@measured/puck-plugin-heading-analyzer 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/index.d.ts +8 -0
- package/dist/index.js +749 -555
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -51483,7 +51483,7 @@ var require_dist = __commonJS({
|
|
51483
51483
|
var HostPortal = 4;
|
51484
51484
|
var HostComponent = 5;
|
51485
51485
|
var HostText = 6;
|
51486
|
-
var
|
51486
|
+
var Fragment20 = 7;
|
51487
51487
|
var Mode = 8;
|
51488
51488
|
var ContextConsumer = 9;
|
51489
51489
|
var ContextProvider = 10;
|
@@ -52639,7 +52639,7 @@ var require_dist = __commonJS({
|
|
52639
52639
|
return "DehydratedFragment";
|
52640
52640
|
case ForwardRef:
|
52641
52641
|
return getWrappedName$1(type, type.render, "ForwardRef");
|
52642
|
-
case
|
52642
|
+
case Fragment20:
|
52643
52643
|
return "Fragment";
|
52644
52644
|
case HostComponent:
|
52645
52645
|
return type;
|
@@ -62290,7 +62290,7 @@ var require_dist = __commonJS({
|
|
62290
62290
|
}
|
62291
62291
|
}
|
62292
62292
|
function updateFragment2(returnFiber, current2, fragment, lanes, key) {
|
62293
|
-
if (current2 === null || current2.tag !==
|
62293
|
+
if (current2 === null || current2.tag !== Fragment20) {
|
62294
62294
|
var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
|
62295
62295
|
created.return = returnFiber;
|
62296
62296
|
return created;
|
@@ -62693,7 +62693,7 @@ var require_dist = __commonJS({
|
|
62693
62693
|
if (child.key === key) {
|
62694
62694
|
var elementType = element.type;
|
62695
62695
|
if (elementType === REACT_FRAGMENT_TYPE) {
|
62696
|
-
if (child.tag ===
|
62696
|
+
if (child.tag === Fragment20) {
|
62697
62697
|
deleteRemainingChildren(returnFiber, child.sibling);
|
62698
62698
|
var existing = useFiber(child, element.props.children);
|
62699
62699
|
existing.return = returnFiber;
|
@@ -66868,7 +66868,7 @@ var require_dist = __commonJS({
|
|
66868
66868
|
var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
66869
66869
|
return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
|
66870
66870
|
}
|
66871
|
-
case
|
66871
|
+
case Fragment20:
|
66872
66872
|
return updateFragment(current2, workInProgress2, renderLanes2);
|
66873
66873
|
case Mode:
|
66874
66874
|
return updateMode(current2, workInProgress2, renderLanes2);
|
@@ -67140,7 +67140,7 @@ var require_dist = __commonJS({
|
|
67140
67140
|
case SimpleMemoComponent:
|
67141
67141
|
case FunctionComponent:
|
67142
67142
|
case ForwardRef:
|
67143
|
-
case
|
67143
|
+
case Fragment20:
|
67144
67144
|
case Mode:
|
67145
67145
|
case Profiler:
|
67146
67146
|
case ContextConsumer:
|
@@ -71391,7 +71391,7 @@ var require_dist = __commonJS({
|
|
71391
71391
|
return fiber;
|
71392
71392
|
}
|
71393
71393
|
function createFiberFromFragment(elements, mode, lanes, key) {
|
71394
|
-
var fiber = createFiber(
|
71394
|
+
var fiber = createFiber(Fragment20, elements, key, mode);
|
71395
71395
|
fiber.lanes = lanes;
|
71396
71396
|
return fiber;
|
71397
71397
|
}
|
@@ -72510,6 +72510,8 @@ var require_dist = __commonJS({
|
|
72510
72510
|
});
|
72511
72511
|
var core_exports = {};
|
72512
72512
|
__export2(core_exports, {
|
72513
|
+
Action: () => Action,
|
72514
|
+
ActionBar: () => ActionBar,
|
72513
72515
|
AutoField: () => AutoField,
|
72514
72516
|
AutoFieldPrivate: () => AutoFieldPrivate,
|
72515
72517
|
Button: () => Button,
|
@@ -72564,12 +72566,30 @@ var require_dist = __commonJS({
|
|
72564
72566
|
};
|
72565
72567
|
var get_class_name_factory_default2 = getClassNameFactory2;
|
72566
72568
|
init_react_import2();
|
72567
|
-
var styles_module_default5 = { "
|
72569
|
+
var styles_module_default5 = { "ActionBarComponent": "_ActionBarComponent_8nyey_1", "ActionBarComponent-actionsLabel": "_ActionBarComponent-actionsLabel_8nyey_15", "ActionBarComponent-action": "_ActionBarComponent-action_8nyey_15" };
|
72570
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
72571
|
+
var getClassName6 = get_class_name_factory_default2("ActionBarComponent", styles_module_default5);
|
72572
|
+
var ActionBar = ({
|
72573
|
+
label,
|
72574
|
+
children
|
72575
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: getClassName6(), children: [
|
72576
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassName6("actionsLabel"), children: label }),
|
72577
|
+
children
|
72578
|
+
] });
|
72579
|
+
var Action = ({
|
72580
|
+
children,
|
72581
|
+
label,
|
72582
|
+
onClick
|
72583
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { className: getClassName6("action"), onClick, title: label, children });
|
72584
|
+
ActionBar.Action = Action;
|
72585
|
+
init_react_import2();
|
72586
|
+
init_react_import2();
|
72587
|
+
var styles_module_default22 = { "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" };
|
72568
72588
|
var import_react112 = require("react");
|
72569
72589
|
init_react_import2();
|
72570
72590
|
init_react_import2();
|
72571
72591
|
init_react_import2();
|
72572
|
-
var
|
72592
|
+
var styles_module_default32 = { "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" };
|
72573
72593
|
init_react_import2();
|
72574
72594
|
init_react_import2();
|
72575
72595
|
var import_react22 = require("react");
|
@@ -72799,9 +72819,9 @@ var require_dist = __commonJS({
|
|
72799
72819
|
return result;
|
72800
72820
|
};
|
72801
72821
|
init_react_import2();
|
72802
|
-
var
|
72803
|
-
var
|
72804
|
-
var
|
72822
|
+
var styles_module_default42 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
72823
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
72824
|
+
var getClassName22 = get_class_name_factory_default2("Loader", styles_module_default42);
|
72805
72825
|
var Loader2 = (_a3) => {
|
72806
72826
|
var _b2 = _a3, {
|
72807
72827
|
color,
|
@@ -72810,10 +72830,10 @@ var require_dist = __commonJS({
|
|
72810
72830
|
"color",
|
72811
72831
|
"size"
|
72812
72832
|
]);
|
72813
|
-
return /* @__PURE__ */ (0,
|
72833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
72814
72834
|
"span",
|
72815
72835
|
__spreadValues2({
|
72816
|
-
className:
|
72836
|
+
className: getClassName22(),
|
72817
72837
|
style: {
|
72818
72838
|
width: size,
|
72819
72839
|
height: size,
|
@@ -72823,8 +72843,8 @@ var require_dist = __commonJS({
|
|
72823
72843
|
}, props)
|
72824
72844
|
);
|
72825
72845
|
};
|
72826
|
-
var
|
72827
|
-
var
|
72846
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
72847
|
+
var getClassName32 = get_class_name_factory_default2("IconButton", IconButton_module_default);
|
72828
72848
|
var IconButton = ({
|
72829
72849
|
children,
|
72830
72850
|
href,
|
@@ -72839,10 +72859,10 @@ var require_dist = __commonJS({
|
|
72839
72859
|
}) => {
|
72840
72860
|
const [loading, setLoading] = (0, import_react32.useState)(false);
|
72841
72861
|
const ElementType = href ? "a" : "button";
|
72842
|
-
const el = /* @__PURE__ */ (0,
|
72862
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
72843
72863
|
ElementType,
|
72844
72864
|
{
|
72845
|
-
className:
|
72865
|
+
className: getClassName32({
|
72846
72866
|
primary: variant === "primary",
|
72847
72867
|
secondary: variant === "secondary",
|
72848
72868
|
disabled,
|
@@ -72863,11 +72883,11 @@ var require_dist = __commonJS({
|
|
72863
72883
|
href,
|
72864
72884
|
title,
|
72865
72885
|
children: [
|
72866
|
-
/* @__PURE__ */ (0,
|
72886
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: getClassName32("title"), children: title }),
|
72867
72887
|
children,
|
72868
|
-
loading && /* @__PURE__ */ (0,
|
72888
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
72869
72889
|
"\xA0\xA0",
|
72870
|
-
/* @__PURE__ */ (0,
|
72890
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Loader2, { size: 14 })
|
72871
72891
|
] })
|
72872
72892
|
]
|
72873
72893
|
}
|
@@ -72906,7 +72926,7 @@ var require_dist = __commonJS({
|
|
72906
72926
|
{ width: 1280, height: "auto", icon: "Monitor", label: "Large" }
|
72907
72927
|
];
|
72908
72928
|
var import_ua_parser_js2 = require_ua_parser();
|
72909
|
-
var
|
72929
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
72910
72930
|
var defaultAppState2 = {
|
72911
72931
|
data: { content: [], root: { props: {} } },
|
72912
72932
|
ui: {
|
@@ -72946,7 +72966,8 @@ var require_dist = __commonJS({
|
|
72946
72966
|
status: "LOADING",
|
72947
72967
|
setStatus: () => null,
|
72948
72968
|
iframe: {},
|
72949
|
-
safariFallbackMode: false
|
72969
|
+
safariFallbackMode: false,
|
72970
|
+
globalPermissions: {}
|
72950
72971
|
};
|
72951
72972
|
var appContext2 = (0, import_react42.createContext)(defaultContext2);
|
72952
72973
|
var AppProvider = ({
|
@@ -72976,7 +72997,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
72976
72997
|
setSafariFallbackMode(true);
|
72977
72998
|
}
|
72978
72999
|
}, []);
|
72979
|
-
return /* @__PURE__ */ (0,
|
73000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
72980
73001
|
appContext2.Provider,
|
72981
73002
|
{
|
72982
73003
|
value: __spreadProps2(__spreadValues2({}, value), {
|
@@ -73005,7 +73026,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73005
73026
|
}
|
73006
73027
|
});
|
73007
73028
|
}
|
73008
|
-
var
|
73029
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
73009
73030
|
var defaultProvided = {
|
73010
73031
|
droppableProps: {
|
73011
73032
|
"data-rfd-droppable-context-id": "",
|
@@ -73020,15 +73041,15 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73020
73041
|
draggingFromThisWith: null,
|
73021
73042
|
isUsingPlaceholder: false
|
73022
73043
|
};
|
73023
|
-
var DefaultDroppable = ({ children }) => /* @__PURE__ */ (0,
|
73044
|
+
var DefaultDroppable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children: children(defaultProvided, defaultSnapshot) });
|
73024
73045
|
var Droppable2 = (props) => {
|
73025
73046
|
const { status } = useAppContext2();
|
73026
73047
|
const El = status !== "LOADING" ? import_dnd.Droppable : DefaultDroppable;
|
73027
|
-
return /* @__PURE__ */ (0,
|
73048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(El, __spreadValues2({}, props));
|
73028
73049
|
};
|
73029
73050
|
init_react_import2();
|
73030
73051
|
var import_dnd2 = (init_dnd_esm(), __toCommonJS(dnd_esm_exports));
|
73031
|
-
var
|
73052
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
73032
73053
|
var defaultProvided2 = {
|
73033
73054
|
draggableProps: {
|
73034
73055
|
"data-rfd-draggable-context-id": "",
|
@@ -73052,7 +73073,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73052
73073
|
type: "",
|
73053
73074
|
source: { droppableId: "", index: 0 }
|
73054
73075
|
};
|
73055
|
-
var DefaultDraggable = ({ children }) => /* @__PURE__ */ (0,
|
73076
|
+
var DefaultDraggable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_jsx_runtime62.Fragment, { children: children(defaultProvided2, defaultSnapshot2, defaultRubric) });
|
73056
73077
|
var Draggable2 = ({
|
73057
73078
|
className,
|
73058
73079
|
children,
|
@@ -73064,22 +73085,23 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73064
73085
|
}) => {
|
73065
73086
|
const { status } = useAppContext2();
|
73066
73087
|
const El = status !== "LOADING" ? import_dnd2.Draggable : DefaultDraggable;
|
73067
|
-
return /* @__PURE__ */ (0,
|
73088
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(El, { draggableId: id, index, isDragDisabled, children: (provided, snapshot) => {
|
73068
73089
|
var _a3;
|
73069
|
-
return /* @__PURE__ */ (0,
|
73070
|
-
/* @__PURE__ */ (0,
|
73090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
73091
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
73071
73092
|
"div",
|
73072
73093
|
__spreadProps2(__spreadValues2(__spreadValues2({
|
73073
73094
|
className: className && className(provided, snapshot),
|
73074
73095
|
ref: provided.innerRef
|
73075
73096
|
}, provided.draggableProps), provided.dragHandleProps), {
|
73076
73097
|
style: __spreadProps2(__spreadValues2({}, provided.draggableProps.style), {
|
73077
|
-
transform: snapshot.isDragging || !disableAnimations ? (_a3 = provided.draggableProps.style) == null ? void 0 : _a3.transform : "translate(0px, 0px)"
|
73098
|
+
transform: snapshot.isDragging || !disableAnimations ? (_a3 = provided.draggableProps.style) == null ? void 0 : _a3.transform : "translate(0px, 0px)",
|
73099
|
+
cursor: isDragDisabled ? "no-drop" : "grab"
|
73078
73100
|
}),
|
73079
73101
|
children: children(provided, snapshot)
|
73080
73102
|
})
|
73081
73103
|
),
|
73082
|
-
showShadow && snapshot.isDragging && /* @__PURE__ */ (0,
|
73104
|
+
showShadow && snapshot.isDragging && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
73083
73105
|
"div",
|
73084
73106
|
{
|
73085
73107
|
className: className && className(provided, snapshot),
|
@@ -73093,22 +73115,22 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73093
73115
|
var import_react52 = require("react");
|
73094
73116
|
init_react_import2();
|
73095
73117
|
init_react_import2();
|
73096
|
-
var
|
73097
|
-
var
|
73098
|
-
var
|
73099
|
-
var DragIcon = () => /* @__PURE__ */ (0,
|
73118
|
+
var styles_module_default52 = { "DragIcon": "_DragIcon_17p8x_1", "DragIcon--disabled": "_DragIcon--disabled_17p8x_8" };
|
73119
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
73120
|
+
var getClassName42 = get_class_name_factory_default2("DragIcon", styles_module_default52);
|
73121
|
+
var DragIcon = ({ isDragDisabled }) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: getClassName42({ disabled: isDragDisabled }), children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("svg", { viewBox: "0 0 20 20", width: "12", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime72.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" }) }) });
|
73100
73122
|
init_react_import2();
|
73101
73123
|
var import_dnd3 = (init_dnd_esm(), __toCommonJS(dnd_esm_exports));
|
73102
|
-
var
|
73103
|
-
var DefaultDragDropContext = ({ children }) => /* @__PURE__ */ (0,
|
73124
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
73125
|
+
var DefaultDragDropContext = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_jsx_runtime82.Fragment, { children });
|
73104
73126
|
var DragDropContext2 = (props) => {
|
73105
73127
|
const { status } = useAppContext2();
|
73106
73128
|
const El = status !== "LOADING" ? import_dnd3.DragDropContext : DefaultDragDropContext;
|
73107
|
-
return /* @__PURE__ */ (0,
|
73129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(El, __spreadValues2({}, props));
|
73108
73130
|
};
|
73109
|
-
var
|
73110
|
-
var
|
73111
|
-
var getClassNameItem3 = get_class_name_factory_default2("ArrayFieldItem",
|
73131
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
73132
|
+
var getClassName52 = get_class_name_factory_default2("ArrayField", styles_module_default32);
|
73133
|
+
var getClassNameItem3 = get_class_name_factory_default2("ArrayFieldItem", styles_module_default32);
|
73112
73134
|
var ArrayField = ({
|
73113
73135
|
field,
|
73114
73136
|
onChange,
|
@@ -73117,7 +73139,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73117
73139
|
label,
|
73118
73140
|
readOnly,
|
73119
73141
|
id,
|
73120
|
-
Label = (props) => /* @__PURE__ */ (0,
|
73142
|
+
Label = (props) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", __spreadValues2({}, props))
|
73121
73143
|
}) => {
|
73122
73144
|
const { state, setUi, selectedItem } = useAppContext2();
|
73123
73145
|
const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
|
@@ -73180,14 +73202,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73180
73202
|
return null;
|
73181
73203
|
}
|
73182
73204
|
const addDisabled = field.max !== void 0 && localState.arrayState.items.length >= field.max || readOnly;
|
73183
|
-
return /* @__PURE__ */ (0,
|
73205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
73184
73206
|
Label,
|
73185
73207
|
{
|
73186
73208
|
label: label || name,
|
73187
|
-
icon: /* @__PURE__ */ (0,
|
73209
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(List, { size: 16 }),
|
73188
73210
|
el: "div",
|
73189
73211
|
readOnly,
|
73190
|
-
children: /* @__PURE__ */ (0,
|
73212
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
73191
73213
|
DragDropContext2,
|
73192
73214
|
{
|
73193
73215
|
onDragEnd: (event) => {
|
@@ -73214,12 +73236,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73214
73236
|
});
|
73215
73237
|
}
|
73216
73238
|
},
|
73217
|
-
children: /* @__PURE__ */ (0,
|
73218
|
-
return /* @__PURE__ */ (0,
|
73239
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Droppable2, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
|
73240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
73219
73241
|
"div",
|
73220
73242
|
__spreadProps2(__spreadValues2({}, provided.droppableProps), {
|
73221
73243
|
ref: provided.innerRef,
|
73222
|
-
className:
|
73244
|
+
className: getClassName52({
|
73223
73245
|
isDraggingFrom: !!snapshot.draggingFromThisWith,
|
73224
73246
|
hasItems: Array.isArray(value) && value.length > 0,
|
73225
73247
|
addDisabled
|
@@ -73236,7 +73258,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73236
73258
|
localState.arrayState.items.map((item, i2) => {
|
73237
73259
|
const { _arrayId = `${id}-${i2}`, _originalIndex = i2 } = item;
|
73238
73260
|
const data = Array.from(localState.value || [])[i2] || {};
|
73239
|
-
return /* @__PURE__ */ (0,
|
73261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
73240
73262
|
Draggable2,
|
73241
73263
|
{
|
73242
73264
|
id: _arrayId,
|
@@ -73247,8 +73269,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73247
73269
|
readOnly
|
73248
73270
|
}),
|
73249
73271
|
isDragDisabled: readOnly || !hovering,
|
73250
|
-
children: () => /* @__PURE__ */ (0,
|
73251
|
-
/* @__PURE__ */ (0,
|
73272
|
+
children: () => /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
|
73273
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
73252
73274
|
"div",
|
73253
73275
|
{
|
73254
73276
|
onClick: () => {
|
@@ -73269,8 +73291,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73269
73291
|
className: getClassNameItem3("summary"),
|
73270
73292
|
children: [
|
73271
73293
|
field.getItemSummary ? field.getItemSummary(data, i2) : `Item #${_originalIndex}`,
|
73272
|
-
/* @__PURE__ */ (0,
|
73273
|
-
!readOnly && /* @__PURE__ */ (0,
|
73294
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: getClassNameItem3("rhs"), children: [
|
73295
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: getClassNameItem3("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: getClassNameItem3("action"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
73274
73296
|
IconButton,
|
73275
73297
|
{
|
73276
73298
|
type: "button",
|
@@ -73293,20 +73315,20 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73293
73315
|
);
|
73294
73316
|
},
|
73295
73317
|
title: "Delete",
|
73296
|
-
children: /* @__PURE__ */ (0,
|
73318
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Trash, { size: 16 })
|
73297
73319
|
}
|
73298
73320
|
) }) }),
|
73299
|
-
/* @__PURE__ */ (0,
|
73321
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DragIcon, {}) })
|
73300
73322
|
] })
|
73301
73323
|
]
|
73302
73324
|
}
|
73303
73325
|
),
|
73304
|
-
/* @__PURE__ */ (0,
|
73326
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: getClassNameItem3("body"), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("fieldset", { className: getClassNameItem3("fieldset"), children: Object.keys(field.arrayFields).map(
|
73305
73327
|
(fieldName) => {
|
73306
73328
|
const subField = field.arrayFields[fieldName];
|
73307
73329
|
const subFieldName = `${name}[${i2}].${fieldName}`;
|
73308
73330
|
const wildcardFieldName = `${name}[*].${fieldName}`;
|
73309
|
-
return /* @__PURE__ */ (0,
|
73331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
73310
73332
|
AutoFieldPrivate,
|
73311
73333
|
{
|
73312
73334
|
name: subFieldName,
|
@@ -73334,11 +73356,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73334
73356
|
);
|
73335
73357
|
}),
|
73336
73358
|
provided.placeholder,
|
73337
|
-
!addDisabled && /* @__PURE__ */ (0,
|
73359
|
+
!addDisabled && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
73338
73360
|
"button",
|
73339
73361
|
{
|
73340
73362
|
type: "button",
|
73341
|
-
className:
|
73363
|
+
className: getClassName52("addButton"),
|
73342
73364
|
onClick: () => {
|
73343
73365
|
const existingValue = value || [];
|
73344
73366
|
const newValue = [
|
@@ -73348,7 +73370,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73348
73370
|
const newArrayState = regenerateArrayState(newValue);
|
73349
73371
|
onChange(newValue, mapArrayStateToUi(newArrayState));
|
73350
73372
|
},
|
73351
|
-
children: /* @__PURE__ */ (0,
|
73373
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Plus, { size: 21 })
|
73352
73374
|
}
|
73353
73375
|
)
|
73354
73376
|
]
|
@@ -73361,8 +73383,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73361
73383
|
);
|
73362
73384
|
};
|
73363
73385
|
init_react_import2();
|
73364
|
-
var
|
73365
|
-
var
|
73386
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
73387
|
+
var getClassName62 = get_class_name_factory_default2("Input", styles_module_default22);
|
73366
73388
|
var DefaultField = ({
|
73367
73389
|
field,
|
73368
73390
|
onChange,
|
@@ -73373,19 +73395,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73373
73395
|
Label,
|
73374
73396
|
id
|
73375
73397
|
}) => {
|
73376
|
-
return /* @__PURE__ */ (0,
|
73398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
73377
73399
|
Label,
|
73378
73400
|
{
|
73379
73401
|
label: label || name,
|
73380
|
-
icon: /* @__PURE__ */ (0,
|
73381
|
-
field.type === "text" && /* @__PURE__ */ (0,
|
73382
|
-
field.type === "number" && /* @__PURE__ */ (0,
|
73402
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
73403
|
+
field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Type, { size: 16 }),
|
73404
|
+
field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Hash, { size: 16 })
|
73383
73405
|
] }),
|
73384
73406
|
readOnly,
|
73385
|
-
children: /* @__PURE__ */ (0,
|
73407
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
73386
73408
|
"input",
|
73387
73409
|
{
|
73388
|
-
className:
|
73410
|
+
className: getClassName62("input"),
|
73389
73411
|
autoComplete: "off",
|
73390
73412
|
type: field.type,
|
73391
73413
|
name,
|
@@ -73412,14 +73434,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73412
73434
|
init_react_import2();
|
73413
73435
|
var import_react82 = require("react");
|
73414
73436
|
init_react_import2();
|
73415
|
-
var
|
73437
|
+
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" };
|
73416
73438
|
init_react_import2();
|
73417
73439
|
var import_react62 = require("react");
|
73418
73440
|
init_react_import2();
|
73419
|
-
var
|
73441
|
+
var styles_module_default7 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Modal--isOpen_ikbaj_15", "Modal-inner": "_Modal-inner_ikbaj_19" };
|
73420
73442
|
var import_react_dom3 = __toESM2(require_react_dom2());
|
73421
|
-
var
|
73422
|
-
var
|
73443
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
73444
|
+
var getClassName7 = get_class_name_factory_default2("Modal", styles_module_default7);
|
73423
73445
|
var Modal = ({
|
73424
73446
|
children,
|
73425
73447
|
onClose,
|
@@ -73430,13 +73452,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73430
73452
|
setRootEl(document.getElementById("puck-portal-root"));
|
73431
73453
|
}, []);
|
73432
73454
|
if (!rootEl) {
|
73433
|
-
return /* @__PURE__ */ (0,
|
73455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", {});
|
73434
73456
|
}
|
73435
73457
|
return (0, import_react_dom3.createPortal)(
|
73436
|
-
/* @__PURE__ */ (0,
|
73458
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName7({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
73437
73459
|
"div",
|
73438
73460
|
{
|
73439
|
-
className:
|
73461
|
+
className: getClassName7("inner"),
|
73440
73462
|
onClick: (e2) => e2.stopPropagation(),
|
73441
73463
|
children
|
73442
73464
|
}
|
@@ -73446,15 +73468,15 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73446
73468
|
};
|
73447
73469
|
init_react_import2();
|
73448
73470
|
init_react_import2();
|
73449
|
-
var
|
73450
|
-
var
|
73451
|
-
var
|
73471
|
+
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" };
|
73472
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
73473
|
+
var getClassName8 = get_class_name_factory_default2("Heading", styles_module_default8);
|
73452
73474
|
var Heading2 = ({ children, rank, size = "m" }) => {
|
73453
73475
|
const Tag = rank ? `h${rank}` : "span";
|
73454
|
-
return /* @__PURE__ */ (0,
|
73476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
73455
73477
|
Tag,
|
73456
73478
|
{
|
73457
|
-
className:
|
73479
|
+
className: getClassName8({
|
73458
73480
|
[size]: true
|
73459
73481
|
}),
|
73460
73482
|
children
|
@@ -73466,8 +73488,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73466
73488
|
var import_react72 = require("react");
|
73467
73489
|
init_react_import2();
|
73468
73490
|
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" };
|
73469
|
-
var
|
73470
|
-
var
|
73491
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
73492
|
+
var getClassName9 = get_class_name_factory_default2("Button", Button_module_default);
|
73471
73493
|
var Button = ({
|
73472
73494
|
children,
|
73473
73495
|
href,
|
@@ -73485,10 +73507,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73485
73507
|
const [loading, setLoading] = (0, import_react72.useState)(loadingProp);
|
73486
73508
|
(0, import_react72.useEffect)(() => setLoading(loadingProp), [loadingProp]);
|
73487
73509
|
const ElementType = href ? "a" : type ? "button" : "span";
|
73488
|
-
const el = /* @__PURE__ */ (0,
|
73510
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
73489
73511
|
ElementType,
|
73490
73512
|
{
|
73491
|
-
className:
|
73513
|
+
className: getClassName9({
|
73492
73514
|
primary: variant === "primary",
|
73493
73515
|
secondary: variant === "secondary",
|
73494
73516
|
disabled,
|
@@ -73509,17 +73531,17 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73509
73531
|
rel: newTab ? "noreferrer" : void 0,
|
73510
73532
|
href,
|
73511
73533
|
children: [
|
73512
|
-
icon && /* @__PURE__ */ (0,
|
73534
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassName9("icon"), children: icon }),
|
73513
73535
|
children,
|
73514
|
-
loading && /* @__PURE__ */ (0,
|
73536
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Loader2, { size: 14 }) })
|
73515
73537
|
]
|
73516
73538
|
}
|
73517
73539
|
);
|
73518
73540
|
return el;
|
73519
73541
|
};
|
73520
|
-
var
|
73521
|
-
var
|
73522
|
-
var getClassNameModal = get_class_name_factory_default2("ExternalInputModal",
|
73542
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
73543
|
+
var getClassName10 = get_class_name_factory_default2("ExternalInput", styles_module_default6);
|
73544
|
+
var getClassNameModal = get_class_name_factory_default2("ExternalInputModal", styles_module_default6);
|
73523
73545
|
var dataCache = {};
|
73524
73546
|
var ExternalInput = ({
|
73525
73547
|
field,
|
@@ -73570,40 +73592,40 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73570
73592
|
(0, import_react82.useEffect)(() => {
|
73571
73593
|
search(searchQuery, filters);
|
73572
73594
|
}, []);
|
73573
|
-
return /* @__PURE__ */ (0,
|
73595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
73574
73596
|
"div",
|
73575
73597
|
{
|
73576
|
-
className:
|
73598
|
+
className: getClassName10({
|
73577
73599
|
dataSelected: !!value,
|
73578
73600
|
modalVisible: isOpen
|
73579
73601
|
}),
|
73580
73602
|
id,
|
73581
73603
|
children: [
|
73582
|
-
/* @__PURE__ */ (0,
|
73583
|
-
/* @__PURE__ */ (0,
|
73604
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassName10("actions"), children: [
|
73605
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
73584
73606
|
"button",
|
73585
73607
|
{
|
73586
73608
|
type: "button",
|
73587
73609
|
onClick: () => setOpen(true),
|
73588
|
-
className:
|
73589
|
-
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0,
|
73590
|
-
/* @__PURE__ */ (0,
|
73591
|
-
/* @__PURE__ */ (0,
|
73610
|
+
className: getClassName10("button"),
|
73611
|
+
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
73612
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Link, { size: "16" }),
|
73613
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: field.placeholder })
|
73592
73614
|
] })
|
73593
73615
|
}
|
73594
73616
|
),
|
73595
|
-
value && /* @__PURE__ */ (0,
|
73617
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
73596
73618
|
"button",
|
73597
73619
|
{
|
73598
|
-
className:
|
73620
|
+
className: getClassName10("detachButton"),
|
73599
73621
|
onClick: () => {
|
73600
73622
|
onChange(null);
|
73601
73623
|
},
|
73602
|
-
children: /* @__PURE__ */ (0,
|
73624
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Unlock, { size: 16 })
|
73603
73625
|
}
|
73604
73626
|
)
|
73605
73627
|
] }),
|
73606
|
-
/* @__PURE__ */ (0,
|
73628
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
73607
73629
|
"form",
|
73608
73630
|
{
|
73609
73631
|
className: getClassNameModal({
|
@@ -73617,11 +73639,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73617
73639
|
search(searchQuery, filters);
|
73618
73640
|
},
|
73619
73641
|
children: [
|
73620
|
-
/* @__PURE__ */ (0,
|
73621
|
-
/* @__PURE__ */ (0,
|
73622
|
-
/* @__PURE__ */ (0,
|
73623
|
-
/* @__PURE__ */ (0,
|
73624
|
-
/* @__PURE__ */ (0,
|
73642
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
|
73643
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: getClassNameModal("search"), children: [
|
73644
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
|
73645
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Search, { size: "18" }) }),
|
73646
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
73625
73647
|
"input",
|
73626
73648
|
{
|
73627
73649
|
className: getClassNameModal("searchInput"),
|
@@ -73636,9 +73658,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73636
73658
|
}
|
73637
73659
|
)
|
73638
73660
|
] }),
|
73639
|
-
/* @__PURE__ */ (0,
|
73640
|
-
/* @__PURE__ */ (0,
|
73641
|
-
hasFilterFields && /* @__PURE__ */ (0,
|
73661
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
|
73662
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
|
73663
|
+
hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
73642
73664
|
IconButton,
|
73643
73665
|
{
|
73644
73666
|
title: "Toggle filters",
|
@@ -73647,15 +73669,15 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73647
73669
|
e2.stopPropagation();
|
73648
73670
|
setFiltersToggled(!filtersToggled);
|
73649
73671
|
},
|
73650
|
-
children: /* @__PURE__ */ (0,
|
73672
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SlidersHorizontal, { size: 20 })
|
73651
73673
|
}
|
73652
73674
|
) })
|
73653
73675
|
] })
|
73654
|
-
] }) : /* @__PURE__ */ (0,
|
73655
|
-
/* @__PURE__ */ (0,
|
73656
|
-
hasFilterFields && /* @__PURE__ */ (0,
|
73676
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Heading2, { rank: 2, size: "xs", children: field.placeholder || "Select data" }) }),
|
73677
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("grid"), children: [
|
73678
|
+
hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
|
73657
73679
|
const filterField = filterFields[fieldName];
|
73658
|
-
return /* @__PURE__ */ (0,
|
73680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
73659
73681
|
AutoFieldPrivate,
|
73660
73682
|
{
|
73661
73683
|
field: filterField,
|
@@ -73672,9 +73694,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73672
73694
|
fieldName
|
73673
73695
|
);
|
73674
73696
|
}) }),
|
73675
|
-
/* @__PURE__ */ (0,
|
73676
|
-
/* @__PURE__ */ (0,
|
73677
|
-
/* @__PURE__ */ (0,
|
73697
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
|
73698
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { className: getClassNameModal("table"), children: [
|
73699
|
+
/* @__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)(
|
73678
73700
|
"th",
|
73679
73701
|
{
|
73680
73702
|
className: getClassNameModal("th"),
|
@@ -73683,8 +73705,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73683
73705
|
},
|
73684
73706
|
key
|
73685
73707
|
)) }) }),
|
73686
|
-
/* @__PURE__ */ (0,
|
73687
|
-
return /* @__PURE__ */ (0,
|
73708
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i2) => {
|
73709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
73688
73710
|
"tr",
|
73689
73711
|
{
|
73690
73712
|
style: { whiteSpace: "nowrap" },
|
@@ -73693,16 +73715,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73693
73715
|
onChange(mapProp(data[i2]));
|
73694
73716
|
setOpen(false);
|
73695
73717
|
},
|
73696
|
-
children: keys.map((key) => /* @__PURE__ */ (0,
|
73718
|
+
children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
73697
73719
|
},
|
73698
73720
|
i2
|
73699
73721
|
);
|
73700
73722
|
}) })
|
73701
73723
|
] }),
|
73702
|
-
/* @__PURE__ */ (0,
|
73724
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Loader2, { size: 24 }) })
|
73703
73725
|
] })
|
73704
73726
|
] }),
|
73705
|
-
/* @__PURE__ */ (0,
|
73727
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("footer"), children: [
|
73706
73728
|
mappedData.length,
|
73707
73729
|
" result",
|
73708
73730
|
mappedData.length === 1 ? "" : "s"
|
@@ -73714,7 +73736,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73714
73736
|
}
|
73715
73737
|
);
|
73716
73738
|
};
|
73717
|
-
var
|
73739
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
73718
73740
|
var ExternalField = ({
|
73719
73741
|
field,
|
73720
73742
|
onChange,
|
@@ -73737,7 +73759,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73737
73759
|
if (field.type !== "external") {
|
73738
73760
|
return null;
|
73739
73761
|
}
|
73740
|
-
return /* @__PURE__ */ (0,
|
73762
|
+
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)(
|
73741
73763
|
ExternalInput,
|
73742
73764
|
{
|
73743
73765
|
name,
|
@@ -73759,8 +73781,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73759
73781
|
) });
|
73760
73782
|
};
|
73761
73783
|
init_react_import2();
|
73762
|
-
var
|
73763
|
-
var
|
73784
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
73785
|
+
var getClassName11 = get_class_name_factory_default2("Input", styles_module_default22);
|
73764
73786
|
var RadioField = ({
|
73765
73787
|
field,
|
73766
73788
|
onChange,
|
@@ -73774,23 +73796,23 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73774
73796
|
if (field.type !== "radio" || !field.options) {
|
73775
73797
|
return null;
|
73776
73798
|
}
|
73777
|
-
return /* @__PURE__ */ (0,
|
73799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
73778
73800
|
Label,
|
73779
73801
|
{
|
73780
|
-
icon: /* @__PURE__ */ (0,
|
73802
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CheckCircle, { size: 16 }),
|
73781
73803
|
label: label || name,
|
73782
73804
|
readOnly,
|
73783
73805
|
el: "div",
|
73784
|
-
children: /* @__PURE__ */ (0,
|
73806
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
73785
73807
|
"label",
|
73786
73808
|
{
|
73787
|
-
className:
|
73809
|
+
className: getClassName11("radio"),
|
73788
73810
|
children: [
|
73789
|
-
/* @__PURE__ */ (0,
|
73811
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
73790
73812
|
"input",
|
73791
73813
|
{
|
73792
73814
|
type: "radio",
|
73793
|
-
className:
|
73815
|
+
className: getClassName11("radioInput"),
|
73794
73816
|
value: option.value,
|
73795
73817
|
name,
|
73796
73818
|
onChange: (e2) => {
|
@@ -73804,7 +73826,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73804
73826
|
checked: value === option.value
|
73805
73827
|
}
|
73806
73828
|
),
|
73807
|
-
/* @__PURE__ */ (0,
|
73829
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassName11("radioInner"), children: option.label || option.value })
|
73808
73830
|
]
|
73809
73831
|
},
|
73810
73832
|
option.label + option.value
|
@@ -73813,8 +73835,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73813
73835
|
);
|
73814
73836
|
};
|
73815
73837
|
init_react_import2();
|
73816
|
-
var
|
73817
|
-
var
|
73838
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
73839
|
+
var getClassName12 = get_class_name_factory_default2("Input", styles_module_default22);
|
73818
73840
|
var SelectField = ({
|
73819
73841
|
field,
|
73820
73842
|
onChange,
|
@@ -73828,17 +73850,17 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73828
73850
|
if (field.type !== "select" || !field.options) {
|
73829
73851
|
return null;
|
73830
73852
|
}
|
73831
|
-
return /* @__PURE__ */ (0,
|
73853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
73832
73854
|
Label,
|
73833
73855
|
{
|
73834
73856
|
label: label || name,
|
73835
|
-
icon: /* @__PURE__ */ (0,
|
73857
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronDown, { size: 16 }),
|
73836
73858
|
readOnly,
|
73837
|
-
children: /* @__PURE__ */ (0,
|
73859
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
73838
73860
|
"select",
|
73839
73861
|
{
|
73840
73862
|
id,
|
73841
|
-
className:
|
73863
|
+
className: getClassName12("input"),
|
73842
73864
|
disabled: readOnly,
|
73843
73865
|
onChange: (e2) => {
|
73844
73866
|
if (e2.currentTarget.value === "true" || e2.currentTarget.value === "false") {
|
@@ -73848,7 +73870,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73848
73870
|
onChange(e2.currentTarget.value);
|
73849
73871
|
},
|
73850
73872
|
value,
|
73851
|
-
children: field.options.map((option) => /* @__PURE__ */ (0,
|
73873
|
+
children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
73852
73874
|
"option",
|
73853
73875
|
{
|
73854
73876
|
label: option.label,
|
@@ -73862,8 +73884,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73862
73884
|
);
|
73863
73885
|
};
|
73864
73886
|
init_react_import2();
|
73865
|
-
var
|
73866
|
-
var
|
73887
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
73888
|
+
var getClassName13 = get_class_name_factory_default2("Input", styles_module_default22);
|
73867
73889
|
var TextareaField = ({
|
73868
73890
|
onChange,
|
73869
73891
|
readOnly,
|
@@ -73873,11 +73895,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73873
73895
|
Label,
|
73874
73896
|
id
|
73875
73897
|
}) => {
|
73876
|
-
return /* @__PURE__ */ (0,
|
73898
|
+
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)(
|
73877
73899
|
"textarea",
|
73878
73900
|
{
|
73879
73901
|
id,
|
73880
|
-
className:
|
73902
|
+
className: getClassName13("input"),
|
73881
73903
|
autoComplete: "off",
|
73882
73904
|
name,
|
73883
73905
|
value: typeof value === "undefined" ? "" : value,
|
@@ -73891,9 +73913,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73891
73913
|
var import_use_debounce = (init_index_module(), __toCommonJS(index_module_exports));
|
73892
73914
|
init_react_import2();
|
73893
73915
|
init_react_import2();
|
73894
|
-
var
|
73895
|
-
var
|
73896
|
-
var
|
73916
|
+
var styles_module_default9 = { "ObjectField": "_ObjectField_1ua3y_5", "ObjectField-fieldset": "_ObjectField-fieldset_1ua3y_13" };
|
73917
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
73918
|
+
var getClassName14 = get_class_name_factory_default2("ObjectField", styles_module_default9);
|
73897
73919
|
var ObjectField = ({
|
73898
73920
|
field,
|
73899
73921
|
onChange,
|
@@ -73910,18 +73932,18 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73910
73932
|
}
|
73911
73933
|
const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
|
73912
73934
|
const data = value || {};
|
73913
|
-
return /* @__PURE__ */ (0,
|
73935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
73914
73936
|
Label,
|
73915
73937
|
{
|
73916
73938
|
label: label || name,
|
73917
|
-
icon: /* @__PURE__ */ (0,
|
73939
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(MoreVertical, { size: 16 }),
|
73918
73940
|
el: "div",
|
73919
73941
|
readOnly,
|
73920
|
-
children: /* @__PURE__ */ (0,
|
73942
|
+
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) => {
|
73921
73943
|
const subField = field.objectFields[fieldName];
|
73922
73944
|
const subFieldName = `${name}.${fieldName}`;
|
73923
73945
|
const wildcardFieldName = `${name}.${fieldName}`;
|
73924
|
-
return /* @__PURE__ */ (0,
|
73946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
73925
73947
|
AutoFieldPrivate,
|
73926
73948
|
{
|
73927
73949
|
name: subFieldName,
|
@@ -73957,8 +73979,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73957
73979
|
const [id] = (0, import_react102.useState)(generateId());
|
73958
73980
|
return id;
|
73959
73981
|
};
|
73960
|
-
var
|
73961
|
-
var
|
73982
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
73983
|
+
var getClassName15 = get_class_name_factory_default2("Input", styles_module_default22);
|
73962
73984
|
var FieldLabel = ({
|
73963
73985
|
children,
|
73964
73986
|
icon,
|
@@ -73968,11 +73990,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73968
73990
|
className
|
73969
73991
|
}) => {
|
73970
73992
|
const El = el;
|
73971
|
-
return /* @__PURE__ */ (0,
|
73972
|
-
/* @__PURE__ */ (0,
|
73973
|
-
icon ? /* @__PURE__ */ (0,
|
73993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(El, { className, children: [
|
73994
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassName15("label"), children: [
|
73995
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, {}),
|
73974
73996
|
label,
|
73975
|
-
readOnly && /* @__PURE__ */ (0,
|
73997
|
+
readOnly && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName15("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Lock, { size: "12" }) })
|
73976
73998
|
] }),
|
73977
73999
|
children
|
73978
74000
|
] });
|
@@ -73990,14 +74012,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
73990
74012
|
[overrides]
|
73991
74013
|
);
|
73992
74014
|
if (!label) {
|
73993
|
-
return /* @__PURE__ */ (0,
|
74015
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children });
|
73994
74016
|
}
|
73995
|
-
return /* @__PURE__ */ (0,
|
74017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
73996
74018
|
Wrapper,
|
73997
74019
|
{
|
73998
74020
|
label,
|
73999
74021
|
icon,
|
74000
|
-
className:
|
74022
|
+
className: getClassName15({ readOnly }),
|
74001
74023
|
readOnly,
|
74002
74024
|
el,
|
74003
74025
|
children
|
@@ -74041,11 +74063,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74041
74063
|
return null;
|
74042
74064
|
}
|
74043
74065
|
const CustomField = field.render;
|
74044
|
-
return /* @__PURE__ */ (0,
|
74066
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName15(), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CustomField, __spreadValues2({}, mergedProps)) });
|
74045
74067
|
}
|
74046
74068
|
const children = defaultFields[field.type](mergedProps);
|
74047
74069
|
const Render2 = render[field.type];
|
74048
|
-
return /* @__PURE__ */ (0,
|
74070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Render2, __spreadProps2(__spreadValues2({}, mergedProps), { children }));
|
74049
74071
|
}
|
74050
74072
|
function AutoFieldPrivate(props) {
|
74051
74073
|
const { value, onChange } = props;
|
@@ -74068,55 +74090,68 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74068
74090
|
value: localValue,
|
74069
74091
|
onChange: onChangeLocal
|
74070
74092
|
};
|
74071
|
-
return /* @__PURE__ */ (0,
|
74093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AutoFieldInternal, __spreadValues2(__spreadValues2({}, props), localProps));
|
74072
74094
|
}
|
74073
|
-
var DefaultLabel = (props) => /* @__PURE__ */ (0,
|
74095
|
+
var DefaultLabel = (props) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", __spreadValues2({}, props));
|
74074
74096
|
function AutoField(props) {
|
74075
|
-
return /* @__PURE__ */ (0,
|
74097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AutoFieldInternal, __spreadProps2(__spreadValues2({}, props), { Label: DefaultLabel }));
|
74076
74098
|
}
|
74077
74099
|
init_react_import2();
|
74078
74100
|
init_react_import2();
|
74079
|
-
var
|
74101
|
+
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" };
|
74080
74102
|
var import_react122 = require("react");
|
74081
|
-
var
|
74082
|
-
var
|
74083
|
-
var getClassNameItem22 = get_class_name_factory_default2("DrawerItem",
|
74103
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
74104
|
+
var getClassName16 = get_class_name_factory_default2("Drawer", styles_module_default10);
|
74105
|
+
var getClassNameItem22 = get_class_name_factory_default2("DrawerItem", styles_module_default10);
|
74084
74106
|
var drawerContext = (0, import_react122.createContext)({
|
74085
74107
|
droppableId: ""
|
74086
74108
|
});
|
74087
74109
|
var DrawerDraggable = ({
|
74088
74110
|
children,
|
74089
74111
|
id,
|
74090
|
-
index
|
74091
|
-
|
74092
|
-
|
74093
|
-
|
74094
|
-
|
74095
|
-
|
74096
|
-
|
74097
|
-
|
74098
|
-
|
74099
|
-
|
74100
|
-
|
74101
|
-
|
74102
|
-
|
74112
|
+
index,
|
74113
|
+
isDragDisabled
|
74114
|
+
}) => {
|
74115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
74116
|
+
Draggable2,
|
74117
|
+
{
|
74118
|
+
id,
|
74119
|
+
index,
|
74120
|
+
isDragDisabled,
|
74121
|
+
showShadow: true,
|
74122
|
+
disableAnimations: true,
|
74123
|
+
className: () => getClassNameItem22({ disabled: isDragDisabled }),
|
74124
|
+
children: () => children
|
74125
|
+
},
|
74126
|
+
id
|
74127
|
+
);
|
74128
|
+
};
|
74103
74129
|
var DrawerItem = ({
|
74104
74130
|
name,
|
74105
74131
|
children,
|
74106
74132
|
id,
|
74107
74133
|
label,
|
74108
|
-
index
|
74134
|
+
index,
|
74135
|
+
isDragDisabled
|
74109
74136
|
}) => {
|
74110
74137
|
const ctx = (0, import_react122.useContext)(drawerContext);
|
74111
74138
|
const resolvedId = `${ctx.droppableId}::${id || name}`;
|
74112
74139
|
const CustomInner = (0, import_react122.useMemo)(
|
74113
|
-
() => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0,
|
74140
|
+
() => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameItem22("default"), children: children2 })),
|
74114
74141
|
[children]
|
74115
74142
|
);
|
74116
|
-
return /* @__PURE__ */ (0,
|
74117
|
-
|
74118
|
-
|
74119
|
-
|
74143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
74144
|
+
DrawerDraggable,
|
74145
|
+
{
|
74146
|
+
id: resolvedId,
|
74147
|
+
index,
|
74148
|
+
isDragDisabled,
|
74149
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameItem22("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: getClassNameItem22("draggable"), children: [
|
74150
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameItem22("name"), children: label != null ? label : name }),
|
74151
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameItem22("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DragIcon, { isDragDisabled }) })
|
74152
|
+
] }) }) })
|
74153
|
+
}
|
74154
|
+
);
|
74120
74155
|
};
|
74121
74156
|
var Drawer = ({
|
74122
74157
|
children,
|
@@ -74124,28 +74159,28 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74124
74159
|
direction = "vertical"
|
74125
74160
|
}) => {
|
74126
74161
|
const droppableId = `component-list:${_droppableId}`;
|
74127
|
-
return /* @__PURE__ */ (0,
|
74162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(drawerContext.Provider, { value: { droppableId }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Droppable2, { droppableId, isDropDisabled: true, direction, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
74128
74163
|
"div",
|
74129
74164
|
__spreadProps2(__spreadValues2({}, provided.droppableProps), {
|
74130
74165
|
ref: provided.innerRef,
|
74131
|
-
className:
|
74166
|
+
className: getClassName16({
|
74132
74167
|
isDraggingFrom: !!snapshot.draggingFromThisWith
|
74133
74168
|
}),
|
74134
74169
|
children: [
|
74135
74170
|
children,
|
74136
|
-
/* @__PURE__ */ (0,
|
74171
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
|
74137
74172
|
]
|
74138
74173
|
})
|
74139
74174
|
) }) });
|
74140
74175
|
};
|
74141
74176
|
Drawer.Item = DrawerItem;
|
74142
74177
|
init_react_import2();
|
74143
|
-
var
|
74178
|
+
var import_react17 = require("react");
|
74144
74179
|
init_react_import2();
|
74145
|
-
var
|
74180
|
+
var import_react15 = require("react");
|
74146
74181
|
var import_dnd4 = (init_dnd_esm(), __toCommonJS(dnd_esm_exports));
|
74147
74182
|
init_react_import2();
|
74148
|
-
var
|
74183
|
+
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" };
|
74149
74184
|
init_react_import2();
|
74150
74185
|
var import_react132 = require("react");
|
74151
74186
|
var useModifierHeld = (modifier) => {
|
@@ -74180,12 +74215,134 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74180
74215
|
"iPod"
|
74181
74216
|
].includes(navigator.platform) || // iPad on iOS 13 detection
|
74182
74217
|
navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
74183
|
-
|
74184
|
-
var
|
74218
|
+
init_react_import2();
|
74219
|
+
var import_jsx_runtime222 = require("react/jsx-runtime");
|
74220
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(import_jsx_runtime222.Fragment, { children });
|
74221
|
+
init_react_import2();
|
74222
|
+
var import_react14 = require("react");
|
74223
|
+
init_react_import2();
|
74224
|
+
var loadOverrides = ({
|
74225
|
+
overrides,
|
74226
|
+
plugins
|
74227
|
+
}) => {
|
74228
|
+
const collected = __spreadValues2({}, overrides);
|
74229
|
+
plugins.forEach((plugin) => {
|
74230
|
+
Object.keys(plugin.overrides).forEach((overridesType) => {
|
74231
|
+
if (overridesType === "fieldTypes") {
|
74232
|
+
const fieldTypes = plugin.overrides.fieldTypes;
|
74233
|
+
Object.keys(fieldTypes).forEach((fieldType) => {
|
74234
|
+
collected.fieldTypes = collected.fieldTypes || {};
|
74235
|
+
const childNode2 = collected.fieldTypes[fieldType];
|
74236
|
+
const Comp2 = (props) => fieldTypes[fieldType](__spreadProps2(__spreadValues2({}, props), {
|
74237
|
+
children: childNode2 ? childNode2(props) : props.children
|
74238
|
+
}));
|
74239
|
+
collected.fieldTypes[fieldType] = Comp2;
|
74240
|
+
});
|
74241
|
+
return;
|
74242
|
+
}
|
74243
|
+
const childNode = collected[overridesType];
|
74244
|
+
const Comp = (props) => plugin.overrides[overridesType](__spreadProps2(__spreadValues2({}, props), {
|
74245
|
+
children: childNode ? childNode(props) : props.children
|
74246
|
+
}));
|
74247
|
+
collected[overridesType] = Comp;
|
74248
|
+
});
|
74249
|
+
});
|
74250
|
+
return collected;
|
74251
|
+
};
|
74252
|
+
var useLoadedOverrides = ({
|
74253
|
+
overrides,
|
74254
|
+
plugins
|
74255
|
+
}) => {
|
74256
|
+
return (0, import_react14.useMemo)(() => {
|
74257
|
+
return loadOverrides({ overrides, plugins });
|
74258
|
+
}, [plugins, overrides]);
|
74259
|
+
};
|
74260
|
+
init_react_import2();
|
74261
|
+
init_react_import2();
|
74262
|
+
var getChanged = (newItem, oldItem) => {
|
74263
|
+
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
74264
|
+
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
74265
|
+
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
74266
|
+
return __spreadProps2(__spreadValues2({}, acc), {
|
74267
|
+
[item]: oldItemProps[item] !== newItemProps[item]
|
74268
|
+
});
|
74269
|
+
}, {}) : {};
|
74270
|
+
};
|
74271
|
+
init_react_import2();
|
74272
|
+
var resolvePermissions = ({
|
74273
|
+
selectedItem,
|
74274
|
+
config,
|
74275
|
+
changed,
|
74276
|
+
lastPermissions,
|
74277
|
+
initialPermissions,
|
74278
|
+
appState
|
74279
|
+
}) => {
|
74280
|
+
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
74281
|
+
if (selectedItem && (componentConfig == null ? void 0 : componentConfig.resolvePermissions)) {
|
74282
|
+
return componentConfig.resolvePermissions(selectedItem, {
|
74283
|
+
changed,
|
74284
|
+
lastPermissions,
|
74285
|
+
initialPermissions,
|
74286
|
+
appState
|
74287
|
+
});
|
74288
|
+
}
|
74289
|
+
return {};
|
74290
|
+
};
|
74291
|
+
var cache = { lastPermissions: {}, lastSelected: {} };
|
74292
|
+
var getPermissions = ({
|
74293
|
+
selectedItem,
|
74294
|
+
type,
|
74295
|
+
globalPermissions,
|
74296
|
+
config,
|
74297
|
+
appState
|
74298
|
+
}) => {
|
74299
|
+
const componentType = type || selectedItem && selectedItem.type || "";
|
74300
|
+
const componentId = selectedItem && selectedItem.props.id || "";
|
74301
|
+
let componentPermissions = getInitialPermissions({
|
74302
|
+
componentType,
|
74303
|
+
config,
|
74304
|
+
globalPermissions
|
74305
|
+
});
|
74306
|
+
const changed = getChanged(selectedItem, cache.lastSelected);
|
74307
|
+
if (Object.values(changed).some((el) => el === true)) {
|
74308
|
+
const resolvedPermissions = resolvePermissions({
|
74309
|
+
selectedItem,
|
74310
|
+
config,
|
74311
|
+
changed,
|
74312
|
+
lastPermissions: cache.lastPermissions[componentId] || componentPermissions,
|
74313
|
+
initialPermissions: componentPermissions,
|
74314
|
+
appState
|
74315
|
+
});
|
74316
|
+
if (resolvedPermissions !== void 0) {
|
74317
|
+
componentPermissions = __spreadValues2(__spreadValues2({}, componentPermissions), resolvedPermissions);
|
74318
|
+
}
|
74319
|
+
cache.lastSelected = selectedItem;
|
74320
|
+
cache.lastPermissions[componentId] = componentPermissions;
|
74321
|
+
return componentPermissions;
|
74322
|
+
}
|
74323
|
+
if (Object.keys(componentId && cache.lastPermissions[componentId]).length !== 0) {
|
74324
|
+
componentPermissions = cache.lastPermissions[componentId];
|
74325
|
+
}
|
74326
|
+
return componentPermissions;
|
74327
|
+
};
|
74328
|
+
var getInitialPermissions = ({
|
74329
|
+
componentType,
|
74330
|
+
globalPermissions,
|
74331
|
+
config
|
74332
|
+
}) => {
|
74333
|
+
var _a3;
|
74334
|
+
return __spreadValues2(__spreadValues2({}, globalPermissions), (_a3 = config.components[componentType]) == null ? void 0 : _a3.permissions);
|
74335
|
+
};
|
74336
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
74337
|
+
var getClassName17 = get_class_name_factory_default2("DraggableComponent", styles_module_default11);
|
74185
74338
|
var space2 = 8;
|
74186
74339
|
var actionsOverlayTop = space2 * 6.5;
|
74187
74340
|
var actionsTop = -(actionsOverlayTop - 8);
|
74188
74341
|
var actionsRight = space2;
|
74342
|
+
var DefaultActionBar = ({
|
74343
|
+
label,
|
74344
|
+
children
|
74345
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ActionBar, { label, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DefaultOverride, { children }) });
|
74189
74346
|
var DraggableComponent = ({
|
74190
74347
|
children,
|
74191
74348
|
id,
|
@@ -74208,30 +74365,52 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74208
74365
|
indicativeHover = false,
|
74209
74366
|
style: style2
|
74210
74367
|
}) => {
|
74211
|
-
const {
|
74368
|
+
const {
|
74369
|
+
zoomConfig,
|
74370
|
+
status,
|
74371
|
+
overrides,
|
74372
|
+
plugins,
|
74373
|
+
selectedItem,
|
74374
|
+
config,
|
74375
|
+
globalPermissions,
|
74376
|
+
state
|
74377
|
+
} = useAppContext2();
|
74212
74378
|
const isModifierHeld = useModifierHeld("Alt");
|
74213
|
-
const { status } = useAppContext2();
|
74214
74379
|
const El = status !== "LOADING" ? import_dnd4.Draggable : DefaultDraggable;
|
74215
|
-
(0,
|
74216
|
-
const [disableSecondaryAnimation, setDisableSecondaryAnimation] = (0,
|
74217
|
-
(0,
|
74380
|
+
(0, import_react15.useEffect)(onMount, []);
|
74381
|
+
const [disableSecondaryAnimation, setDisableSecondaryAnimation] = (0, import_react15.useState)(false);
|
74382
|
+
(0, import_react15.useEffect)(() => {
|
74218
74383
|
if (isIos()) {
|
74219
74384
|
setDisableSecondaryAnimation(true);
|
74220
74385
|
}
|
74221
74386
|
}, []);
|
74222
|
-
|
74387
|
+
const loadedOverrides = useLoadedOverrides({
|
74388
|
+
overrides,
|
74389
|
+
plugins
|
74390
|
+
});
|
74391
|
+
const CustomActionBar = (0, import_react15.useMemo)(
|
74392
|
+
() => loadedOverrides.actionBar || DefaultActionBar,
|
74393
|
+
[loadedOverrides]
|
74394
|
+
);
|
74395
|
+
const permissions = selectedItem && getPermissions({
|
74396
|
+
selectedItem,
|
74397
|
+
globalPermissions: globalPermissions || {},
|
74398
|
+
config,
|
74399
|
+
appState: state
|
74400
|
+
});
|
74401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
74223
74402
|
El,
|
74224
74403
|
{
|
74225
74404
|
draggableId: id,
|
74226
74405
|
index,
|
74227
74406
|
isDragDisabled,
|
74228
74407
|
disableSecondaryAnimation,
|
74229
|
-
children: (provided, snapshot) => /* @__PURE__ */ (0,
|
74408
|
+
children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
74230
74409
|
"div",
|
74231
74410
|
__spreadProps2(__spreadValues2(__spreadValues2({
|
74232
74411
|
ref: provided.innerRef
|
74233
74412
|
}, provided.draggableProps), provided.dragHandleProps), {
|
74234
|
-
className:
|
74413
|
+
className: getClassName17({
|
74235
74414
|
isSelected,
|
74236
74415
|
isModifierHeld,
|
74237
74416
|
isDragging: snapshot.isDragging,
|
@@ -74240,7 +74419,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74240
74419
|
indicativeHover
|
74241
74420
|
}),
|
74242
74421
|
style: __spreadProps2(__spreadValues2(__spreadValues2({}, style2), provided.draggableProps.style), {
|
74243
|
-
cursor: isModifierHeld ? "initial" : "grab"
|
74422
|
+
cursor: isModifierHeld || isDragDisabled ? "initial" : "grab"
|
74244
74423
|
}),
|
74245
74424
|
onMouseOver,
|
74246
74425
|
onMouseOut,
|
@@ -74249,34 +74428,33 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74249
74428
|
onClick,
|
74250
74429
|
children: [
|
74251
74430
|
debug,
|
74252
|
-
isLoading && /* @__PURE__ */ (0,
|
74253
|
-
/* @__PURE__ */ (0,
|
74431
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Loader2, {}) }),
|
74432
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
74254
74433
|
"div",
|
74255
74434
|
{
|
74256
|
-
className:
|
74435
|
+
className: getClassName17("actionsOverlay"),
|
74257
74436
|
style: {
|
74258
74437
|
top: actionsOverlayTop / zoomConfig.zoom
|
74259
74438
|
},
|
74260
|
-
children: /* @__PURE__ */ (0,
|
74439
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
74261
74440
|
"div",
|
74262
74441
|
{
|
74263
|
-
className:
|
74442
|
+
className: getClassName17("actions"),
|
74264
74443
|
style: {
|
74265
74444
|
transform: `scale(${1 / zoomConfig.zoom}`,
|
74266
74445
|
top: actionsTop / zoomConfig.zoom,
|
74267
74446
|
right: actionsRight / zoomConfig.zoom
|
74268
74447
|
},
|
74269
|
-
children: [
|
74270
|
-
|
74271
|
-
/* @__PURE__ */ (0,
|
74272
|
-
|
74273
|
-
]
|
74448
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(CustomActionBar, { label, children: [
|
74449
|
+
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 }) }),
|
74450
|
+
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 }) })
|
74451
|
+
] })
|
74274
74452
|
}
|
74275
74453
|
)
|
74276
74454
|
}
|
74277
74455
|
),
|
74278
|
-
/* @__PURE__ */ (0,
|
74279
|
-
/* @__PURE__ */ (0,
|
74456
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17("overlay") }),
|
74457
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17("contents"), children })
|
74280
74458
|
]
|
74281
74459
|
})
|
74282
74460
|
)
|
@@ -74285,9 +74463,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74285
74463
|
);
|
74286
74464
|
};
|
74287
74465
|
init_react_import2();
|
74288
|
-
var
|
74466
|
+
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" };
|
74289
74467
|
init_react_import2();
|
74290
|
-
var
|
74468
|
+
var import_react16 = require("react");
|
74291
74469
|
var import_use_debounce2 = (init_index_module(), __toCommonJS(index_module_exports));
|
74292
74470
|
init_react_import2();
|
74293
74471
|
var getZoneId2 = (zoneCompound) => {
|
@@ -74299,30 +74477,30 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74299
74477
|
}
|
74300
74478
|
return [rootDroppableId2, zoneCompound];
|
74301
74479
|
};
|
74302
|
-
var
|
74303
|
-
var dropZoneContext2 = (0,
|
74480
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
74481
|
+
var dropZoneContext2 = (0, import_react16.createContext)(null);
|
74304
74482
|
var DropZoneProvider = ({
|
74305
74483
|
children,
|
74306
74484
|
value
|
74307
74485
|
}) => {
|
74308
|
-
const [hoveringArea, setHoveringArea] = (0,
|
74309
|
-
const [hoveringZone, setHoveringZone] = (0,
|
74486
|
+
const [hoveringArea, setHoveringArea] = (0, import_react16.useState)(null);
|
74487
|
+
const [hoveringZone, setHoveringZone] = (0, import_react16.useState)(
|
74310
74488
|
rootDroppableId2
|
74311
74489
|
);
|
74312
|
-
const [hoveringComponent, setHoveringComponent] = (0,
|
74490
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react16.useState)();
|
74313
74491
|
const [hoveringAreaDb] = (0, import_use_debounce2.useDebounce)(hoveringArea, 75, { leading: false });
|
74314
|
-
const [areasWithZones, setAreasWithZones] = (0,
|
74492
|
+
const [areasWithZones, setAreasWithZones] = (0, import_react16.useState)(
|
74315
74493
|
{}
|
74316
74494
|
);
|
74317
|
-
const [activeZones, setActiveZones] = (0,
|
74495
|
+
const [activeZones, setActiveZones] = (0, import_react16.useState)({});
|
74318
74496
|
const { dispatch = null } = value ? value : {};
|
74319
|
-
const registerZoneArea = (0,
|
74497
|
+
const registerZoneArea = (0, import_react16.useCallback)(
|
74320
74498
|
(area) => {
|
74321
74499
|
setAreasWithZones((latest) => __spreadProps2(__spreadValues2({}, latest), { [area]: true }));
|
74322
74500
|
},
|
74323
74501
|
[setAreasWithZones]
|
74324
74502
|
);
|
74325
|
-
const registerZone = (0,
|
74503
|
+
const registerZone = (0, import_react16.useCallback)(
|
74326
74504
|
(zoneCompound) => {
|
74327
74505
|
if (!dispatch) {
|
74328
74506
|
return;
|
@@ -74335,7 +74513,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74335
74513
|
},
|
74336
74514
|
[setActiveZones, dispatch]
|
74337
74515
|
);
|
74338
|
-
const unregisterZone = (0,
|
74516
|
+
const unregisterZone = (0, import_react16.useCallback)(
|
74339
74517
|
(zoneCompound) => {
|
74340
74518
|
if (!dispatch) {
|
74341
74519
|
return;
|
@@ -74350,8 +74528,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74350
74528
|
},
|
74351
74529
|
[setActiveZones, dispatch]
|
74352
74530
|
);
|
74353
|
-
const [pathData, setPathData] = (0,
|
74354
|
-
const registerPath = (0,
|
74531
|
+
const [pathData, setPathData] = (0, import_react16.useState)();
|
74532
|
+
const registerPath = (0, import_react16.useCallback)(
|
74355
74533
|
(selector) => {
|
74356
74534
|
if (!(value == null ? void 0 : value.data)) {
|
74357
74535
|
return;
|
@@ -74376,8 +74554,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74376
74554
|
},
|
74377
74555
|
[value, setPathData]
|
74378
74556
|
);
|
74379
|
-
const [zoneWillDrag, setZoneWillDrag] = (0,
|
74380
|
-
return /* @__PURE__ */ (0,
|
74557
|
+
const [zoneWillDrag, setZoneWillDrag] = (0, import_react16.useState)("");
|
74558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
74381
74559
|
dropZoneContext2.Provider,
|
74382
74560
|
{
|
74383
74561
|
value: __spreadValues2({
|
@@ -74401,12 +74579,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74401
74579
|
}
|
74402
74580
|
) });
|
74403
74581
|
};
|
74404
|
-
var
|
74405
|
-
var
|
74582
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
74583
|
+
var getClassName18 = get_class_name_factory_default2("DropZone", styles_module_default12);
|
74406
74584
|
function DropZoneEdit({ zone, allow, disallow, style: style2 }) {
|
74407
74585
|
var _a3;
|
74408
74586
|
const appContext22 = useAppContext2();
|
74409
|
-
const ctx = (0,
|
74587
|
+
const ctx = (0, import_react17.useContext)(dropZoneContext2);
|
74410
74588
|
const {
|
74411
74589
|
// These all need setting via context
|
74412
74590
|
data,
|
@@ -74425,12 +74603,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74425
74603
|
} = ctx || {};
|
74426
74604
|
let content = data.content || [];
|
74427
74605
|
let zoneCompound = rootDroppableId2;
|
74428
|
-
(0,
|
74606
|
+
(0, import_react17.useEffect)(() => {
|
74429
74607
|
if (areaId && registerZoneArea) {
|
74430
74608
|
registerZoneArea(areaId);
|
74431
74609
|
}
|
74432
74610
|
}, [areaId]);
|
74433
|
-
(0,
|
74611
|
+
(0, import_react17.useEffect)(() => {
|
74434
74612
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
74435
74613
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
74436
74614
|
}
|
@@ -74456,7 +74634,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74456
74634
|
const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
|
74457
74635
|
const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
|
74458
74636
|
if (!(ctx == null ? void 0 : ctx.config) || !ctx.setHoveringArea || !ctx.setHoveringZone || !ctx.setHoveringComponent || !ctx.setItemSelector || !ctx.registerPath || !ctx.dispatch) {
|
74459
|
-
return /* @__PURE__ */ (0,
|
74637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: "DropZone requires context to work." });
|
74460
74638
|
}
|
74461
74639
|
const {
|
74462
74640
|
hoveringArea = "root",
|
@@ -74497,10 +74675,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74497
74675
|
}
|
74498
74676
|
const selectedItem = itemSelector ? getItem2(itemSelector, data) : null;
|
74499
74677
|
const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
|
74500
|
-
return /* @__PURE__ */ (0,
|
74678
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74501
74679
|
"div",
|
74502
74680
|
{
|
74503
|
-
className:
|
74681
|
+
className: getClassName18({
|
74504
74682
|
isRootZone,
|
74505
74683
|
userIsDragging,
|
74506
74684
|
draggingOverArea,
|
@@ -74514,17 +74692,17 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74514
74692
|
onMouseUp: () => {
|
74515
74693
|
setZoneWillDrag("");
|
74516
74694
|
},
|
74517
|
-
children: /* @__PURE__ */ (0,
|
74695
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74518
74696
|
Droppable2,
|
74519
74697
|
{
|
74520
74698
|
droppableId: zoneCompound,
|
74521
74699
|
direction: "vertical",
|
74522
74700
|
isDropDisabled: !isEnabled,
|
74523
74701
|
children: (provided, snapshot) => {
|
74524
|
-
return /* @__PURE__ */ (0,
|
74702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
74525
74703
|
"div",
|
74526
74704
|
__spreadProps2(__spreadValues2({}, (provided || { droppableProps: {} }).droppableProps), {
|
74527
|
-
className:
|
74705
|
+
className: getClassName18("content"),
|
74528
74706
|
ref: provided == null ? void 0 : provided.innerRef,
|
74529
74707
|
style: style2,
|
74530
74708
|
id: zoneCompound,
|
@@ -74551,25 +74729,34 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74551
74729
|
"draggable-"
|
74552
74730
|
)[1] === componentId;
|
74553
74731
|
const containsZone = areasWithZones ? areasWithZones[componentId] : false;
|
74554
|
-
const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0,
|
74732
|
+
const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
|
74555
74733
|
"No configuration for ",
|
74556
74734
|
item.type
|
74557
74735
|
] });
|
74558
74736
|
const componentConfig = config.components[item.type];
|
74559
74737
|
const label = (_b2 = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _b2 : item.type.toString();
|
74560
|
-
|
74738
|
+
const canDrag = getPermissions({
|
74739
|
+
selectedItem: getItem2(
|
74740
|
+
{ index: i2, zone: zoneCompound },
|
74741
|
+
appContext22.state.data
|
74742
|
+
),
|
74743
|
+
config: appContext22.config,
|
74744
|
+
globalPermissions: appContext22.globalPermissions || {},
|
74745
|
+
appState: appContext22.state
|
74746
|
+
}).drag;
|
74747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
74561
74748
|
"div",
|
74562
74749
|
{
|
74563
|
-
className:
|
74750
|
+
className: getClassName18("item"),
|
74564
74751
|
style: { zIndex: isDragging2 ? 1 : void 0 },
|
74565
74752
|
children: [
|
74566
|
-
/* @__PURE__ */ (0,
|
74753
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74567
74754
|
DropZoneProvider,
|
74568
74755
|
{
|
74569
74756
|
value: __spreadProps2(__spreadValues2({}, ctx), {
|
74570
74757
|
areaId: componentId
|
74571
74758
|
}),
|
74572
|
-
children: /* @__PURE__ */ (0,
|
74759
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74573
74760
|
DraggableComponent,
|
74574
74761
|
{
|
74575
74762
|
label,
|
@@ -74578,6 +74765,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74578
74765
|
isSelected,
|
74579
74766
|
isLocked: userIsDragging,
|
74580
74767
|
forceHover: hoveringComponent === componentId && !userIsDragging,
|
74768
|
+
isDragDisabled: !canDrag,
|
74581
74769
|
indicativeHover: userIsDragging && containsZone && hoveringArea === componentId,
|
74582
74770
|
isLoading: (_c = appContext22.componentState[componentId]) == null ? void 0 : _c.loading,
|
74583
74771
|
onMount: () => {
|
@@ -74636,15 +74824,15 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74636
74824
|
style: {
|
74637
74825
|
pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
|
74638
74826
|
},
|
74639
|
-
children: /* @__PURE__ */ (0,
|
74827
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName18("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Render2, __spreadValues2({}, defaultedProps)) })
|
74640
74828
|
}
|
74641
74829
|
)
|
74642
74830
|
}
|
74643
74831
|
),
|
74644
|
-
userIsDragging && /* @__PURE__ */ (0,
|
74832
|
+
userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74645
74833
|
"div",
|
74646
74834
|
{
|
74647
|
-
className:
|
74835
|
+
className: getClassName18("hitbox"),
|
74648
74836
|
onMouseOver: (e2) => {
|
74649
74837
|
e2.stopPropagation();
|
74650
74838
|
setHoveringArea(zoneArea);
|
@@ -74658,7 +74846,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74658
74846
|
);
|
74659
74847
|
}),
|
74660
74848
|
provided == null ? void 0 : provided.placeholder,
|
74661
|
-
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0,
|
74849
|
+
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74662
74850
|
"div",
|
74663
74851
|
{
|
74664
74852
|
"data-puck-placeholder": true,
|
@@ -74679,7 +74867,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74679
74867
|
);
|
74680
74868
|
}
|
74681
74869
|
function DropZoneRender({ zone }) {
|
74682
|
-
const ctx = (0,
|
74870
|
+
const ctx = (0, import_react17.useContext)(dropZoneContext2);
|
74683
74871
|
const { data, areaId = "root", config } = ctx || {};
|
74684
74872
|
let zoneCompound = rootDroppableId2;
|
74685
74873
|
let content = (data == null ? void 0 : data.content) || [];
|
@@ -74690,14 +74878,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74690
74878
|
zoneCompound = `${areaId}:${zone}`;
|
74691
74879
|
content = setupZone2(data, zoneCompound).zones[zoneCompound];
|
74692
74880
|
}
|
74693
|
-
return /* @__PURE__ */ (0,
|
74881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: content.map((item) => {
|
74694
74882
|
const Component = config.components[item.type];
|
74695
74883
|
if (Component) {
|
74696
|
-
return /* @__PURE__ */ (0,
|
74884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74697
74885
|
DropZoneProvider,
|
74698
74886
|
{
|
74699
74887
|
value: { data, config, areaId: item.props.id },
|
74700
|
-
children: /* @__PURE__ */ (0,
|
74888
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74701
74889
|
Component.render,
|
74702
74890
|
__spreadProps2(__spreadValues2({}, item.props), {
|
74703
74891
|
puck: { renderDropZone: DropZone }
|
@@ -74711,16 +74899,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74711
74899
|
}) });
|
74712
74900
|
}
|
74713
74901
|
function DropZone(props) {
|
74714
|
-
const ctx = (0,
|
74902
|
+
const ctx = (0, import_react17.useContext)(dropZoneContext2);
|
74715
74903
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
74716
|
-
return /* @__PURE__ */ (0,
|
74904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneEdit, __spreadValues2({}, props));
|
74717
74905
|
}
|
74718
|
-
return /* @__PURE__ */ (0,
|
74906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRender, __spreadValues2({}, props));
|
74719
74907
|
}
|
74720
74908
|
init_react_import2();
|
74721
|
-
var
|
74909
|
+
var import_react31 = require("react");
|
74722
74910
|
init_react_import2();
|
74723
|
-
var
|
74911
|
+
var import_react18 = require("react");
|
74724
74912
|
init_react_import2();
|
74725
74913
|
var getFrame3 = () => {
|
74726
74914
|
let frame = document.querySelector("#preview-frame");
|
@@ -74731,7 +74919,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74731
74919
|
};
|
74732
74920
|
var usePlaceholderStyle = () => {
|
74733
74921
|
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
74734
|
-
const [placeholderStyle, setPlaceholderStyle] = (0,
|
74922
|
+
const [placeholderStyle, setPlaceholderStyle] = (0, import_react18.useState)();
|
74735
74923
|
const onDragStartOrUpdate = (draggedItem) => {
|
74736
74924
|
var _a3;
|
74737
74925
|
const draggableId = draggedItem.draggableId;
|
@@ -74776,9 +74964,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74776
74964
|
};
|
74777
74965
|
init_react_import2();
|
74778
74966
|
init_react_import2();
|
74779
|
-
var
|
74967
|
+
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" };
|
74780
74968
|
init_react_import2();
|
74781
|
-
var
|
74969
|
+
var import_react19 = require("react");
|
74782
74970
|
var convertPathDataToBreadcrumbs2 = (selectedItem, pathData, data) => {
|
74783
74971
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
74784
74972
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues2({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -74828,8 +75016,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74828
75016
|
state: { data },
|
74829
75017
|
selectedItem
|
74830
75018
|
} = useAppContext2();
|
74831
|
-
const dzContext = (0,
|
74832
|
-
return (0,
|
75019
|
+
const dzContext = (0, import_react19.useContext)(dropZoneContext2);
|
75020
|
+
return (0, import_react19.useMemo)(() => {
|
74833
75021
|
const breadcrumbs = convertPathDataToBreadcrumbs2(
|
74834
75022
|
selectedItem,
|
74835
75023
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -74841,8 +75029,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74841
75029
|
return breadcrumbs;
|
74842
75030
|
}, [selectedItem, dzContext == null ? void 0 : dzContext.pathData, renderCount]);
|
74843
75031
|
};
|
74844
|
-
var
|
74845
|
-
var
|
75032
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
75033
|
+
var getClassName19 = get_class_name_factory_default2("SidebarSection", styles_module_default13);
|
74846
75034
|
var SidebarSection2 = ({
|
74847
75035
|
children,
|
74848
75036
|
title,
|
@@ -74854,28 +75042,28 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74854
75042
|
}) => {
|
74855
75043
|
const { setUi } = useAppContext2();
|
74856
75044
|
const breadcrumbs = useBreadcrumbs2(1);
|
74857
|
-
return /* @__PURE__ */ (0,
|
75045
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
74858
75046
|
"div",
|
74859
75047
|
{
|
74860
|
-
className:
|
75048
|
+
className: getClassName19({ noBorderTop, noPadding }),
|
74861
75049
|
style: { background },
|
74862
75050
|
children: [
|
74863
|
-
/* @__PURE__ */ (0,
|
74864
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i2) => /* @__PURE__ */ (0,
|
74865
|
-
/* @__PURE__ */ (0,
|
75051
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
|
75052
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i2) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
|
75053
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
74866
75054
|
"button",
|
74867
75055
|
{
|
74868
|
-
className:
|
75056
|
+
className: getClassName19("breadcrumbLabel"),
|
74869
75057
|
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
74870
75058
|
children: breadcrumb.label
|
74871
75059
|
}
|
74872
75060
|
),
|
74873
|
-
/* @__PURE__ */ (0,
|
75061
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronRight2, { size: 16 })
|
74874
75062
|
] }, i2)) : null,
|
74875
|
-
/* @__PURE__ */ (0,
|
75063
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Heading2, { rank: 2, size: "xs", children: title }) })
|
74876
75064
|
] }) }),
|
74877
|
-
/* @__PURE__ */ (0,
|
74878
|
-
isLoading && /* @__PURE__ */ (0,
|
75065
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("content"), children }),
|
75066
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Loader2, { size: 32 }) })
|
74879
75067
|
]
|
74880
75068
|
}
|
74881
75069
|
);
|
@@ -75222,19 +75410,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75222
75410
|
return appState;
|
75223
75411
|
};
|
75224
75412
|
init_react_import2();
|
75225
|
-
var
|
75226
|
-
init_react_import2();
|
75413
|
+
var import_react20 = require("react");
|
75227
75414
|
init_react_import2();
|
75228
|
-
var
|
75229
|
-
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
75230
|
-
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
75231
|
-
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
75232
|
-
return __spreadProps2(__spreadValues2({}, acc), {
|
75233
|
-
[item]: oldItemProps[item] !== newItemProps[item]
|
75234
|
-
});
|
75235
|
-
}, {}) : {};
|
75236
|
-
};
|
75237
|
-
var cache = { lastChange: {} };
|
75415
|
+
var cache2 = { lastChange: {} };
|
75238
75416
|
var resolveAllComponentData = (content, config, onResolveStart, onResolveEnd) => __async2(void 0, null, function* () {
|
75239
75417
|
return yield Promise.all(
|
75240
75418
|
content.map((item) => __async2(void 0, null, function* () {
|
@@ -75250,7 +75428,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75250
75428
|
var resolveComponentData = (item, config, onResolveStart, onResolveEnd) => __async2(void 0, null, function* () {
|
75251
75429
|
const configForItem = config.components[item.type];
|
75252
75430
|
if (configForItem.resolveData) {
|
75253
|
-
const { item: oldItem = {}, resolved = {} } =
|
75431
|
+
const { item: oldItem = {}, resolved = {} } = cache2.lastChange[item.props.id] || {};
|
75254
75432
|
if (item && item === oldItem) {
|
75255
75433
|
return resolved;
|
75256
75434
|
}
|
@@ -75267,7 +75445,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75267
75445
|
if (Object.keys(newReadOnly).length) {
|
75268
75446
|
resolvedItem.readOnly = newReadOnly;
|
75269
75447
|
}
|
75270
|
-
|
75448
|
+
cache2.lastChange[item.props.id] = {
|
75271
75449
|
item,
|
75272
75450
|
resolved: resolvedItem
|
75273
75451
|
};
|
@@ -75295,20 +75473,20 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75295
75473
|
});
|
75296
75474
|
};
|
75297
75475
|
init_react_import2();
|
75298
|
-
var
|
75476
|
+
var cache3 = {};
|
75299
75477
|
var resolveRootData = (data, config) => __async2(void 0, null, function* () {
|
75300
75478
|
var _a3, _b2, _c, _d, _e;
|
75301
75479
|
if (((_a3 = config.root) == null ? void 0 : _a3.resolveData) && data.root.props) {
|
75302
|
-
if (((_b2 =
|
75303
|
-
return
|
75480
|
+
if (((_b2 = cache3.lastChange) == null ? void 0 : _b2.original) === data.root) {
|
75481
|
+
return cache3.lastChange.resolved;
|
75304
75482
|
}
|
75305
|
-
const changed = getChanged(data.root, (_c =
|
75483
|
+
const changed = getChanged(data.root, (_c = cache3.lastChange) == null ? void 0 : _c.original);
|
75306
75484
|
const rootWithProps = data.root;
|
75307
75485
|
const resolvedRoot = yield (_e = config.root) == null ? void 0 : _e.resolveData(rootWithProps, {
|
75308
75486
|
changed,
|
75309
|
-
lastData: ((_d =
|
75487
|
+
lastData: ((_d = cache3.lastChange) == null ? void 0 : _d.original) || {}
|
75310
75488
|
});
|
75311
|
-
|
75489
|
+
cache3.lastChange = {
|
75312
75490
|
original: data.root,
|
75313
75491
|
resolved: resolvedRoot
|
75314
75492
|
};
|
@@ -75319,13 +75497,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75319
75497
|
return data.root;
|
75320
75498
|
});
|
75321
75499
|
var useResolvedData = (appState, config, dispatch) => {
|
75322
|
-
const [{ resolverKey, newAppState }, setResolverState] = (0,
|
75500
|
+
const [{ resolverKey, newAppState }, setResolverState] = (0, import_react20.useState)({
|
75323
75501
|
resolverKey: 0,
|
75324
75502
|
newAppState: appState
|
75325
75503
|
});
|
75326
|
-
const [componentState, setComponentState] = (0,
|
75504
|
+
const [componentState, setComponentState] = (0, import_react20.useState)({});
|
75327
75505
|
const deferredSetStates = {};
|
75328
|
-
const setComponentLoading = (0,
|
75506
|
+
const setComponentLoading = (0, import_react20.useCallback)(
|
75329
75507
|
(id, loading, defer2 = 0) => {
|
75330
75508
|
if (deferredSetStates[id]) {
|
75331
75509
|
clearTimeout(deferredSetStates[id]);
|
@@ -75395,10 +75573,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75395
75573
|
});
|
75396
75574
|
yield Promise.all(promises);
|
75397
75575
|
});
|
75398
|
-
(0,
|
75576
|
+
(0, import_react20.useEffect)(() => {
|
75399
75577
|
runResolvers();
|
75400
75578
|
}, [resolverKey]);
|
75401
|
-
const resolveData = (0,
|
75579
|
+
const resolveData = (0, import_react20.useCallback)((newAppState2 = appState) => {
|
75402
75580
|
setResolverState((curr) => ({
|
75403
75581
|
resolverKey: curr.resolverKey + 1,
|
75404
75582
|
newAppState: newAppState2
|
@@ -75411,9 +75589,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75411
75589
|
};
|
75412
75590
|
init_react_import2();
|
75413
75591
|
init_react_import2();
|
75414
|
-
var
|
75415
|
-
var
|
75416
|
-
var
|
75592
|
+
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" };
|
75593
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
75594
|
+
var getClassName20 = get_class_name_factory_default2("MenuBar", styles_module_default14);
|
75417
75595
|
var MenuBar = ({
|
75418
75596
|
appState,
|
75419
75597
|
data = { content: [], root: {} },
|
@@ -75427,10 +75605,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75427
75605
|
history: { back, forward, historyStore }
|
75428
75606
|
} = useAppContext2();
|
75429
75607
|
const { hasFuture = false, hasPast = false } = historyStore || {};
|
75430
|
-
return /* @__PURE__ */ (0,
|
75608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
75431
75609
|
"div",
|
75432
75610
|
{
|
75433
|
-
className:
|
75611
|
+
className: getClassName20({ menuOpen }),
|
75434
75612
|
onClick: (event) => {
|
75435
75613
|
var _a3;
|
75436
75614
|
const element = event.target;
|
@@ -75441,12 +75619,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75441
75619
|
setMenuOpen(false);
|
75442
75620
|
}
|
75443
75621
|
},
|
75444
|
-
children: /* @__PURE__ */ (0,
|
75445
|
-
/* @__PURE__ */ (0,
|
75446
|
-
/* @__PURE__ */ (0,
|
75447
|
-
/* @__PURE__ */ (0,
|
75622
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName20("inner"), children: [
|
75623
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName20("history"), children: [
|
75624
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Undo2, { size: 21 }) }),
|
75625
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Redo2, { size: 21 }) })
|
75448
75626
|
] }),
|
75449
|
-
/* @__PURE__ */ (0,
|
75627
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: renderHeaderActions && renderHeaderActions({
|
75450
75628
|
state: appState,
|
75451
75629
|
dispatch
|
75452
75630
|
}) })
|
@@ -75455,20 +75633,20 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75455
75633
|
);
|
75456
75634
|
};
|
75457
75635
|
init_react_import2();
|
75458
|
-
var
|
75636
|
+
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" };
|
75459
75637
|
init_react_import2();
|
75460
75638
|
init_react_import2();
|
75461
|
-
var
|
75462
|
-
var
|
75463
|
-
var
|
75464
|
-
var
|
75639
|
+
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" };
|
75640
|
+
var import_react21 = require("react");
|
75641
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
75642
|
+
var getClassName21 = get_class_name_factory_default2("PuckFields", styles_module_default16);
|
75465
75643
|
var defaultPageFields = {
|
75466
75644
|
title: { type: "text" }
|
75467
75645
|
};
|
75468
75646
|
var DefaultFields = ({
|
75469
75647
|
children
|
75470
75648
|
}) => {
|
75471
|
-
return /* @__PURE__ */ (0,
|
75649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children });
|
75472
75650
|
};
|
75473
75651
|
var useResolvedFields = () => {
|
75474
75652
|
var _a3;
|
@@ -75478,14 +75656,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75478
75656
|
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
75479
75657
|
const defaultFields = selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields;
|
75480
75658
|
const rootProps = data.root.props || data.root;
|
75481
|
-
const [lastSelectedData, setLastSelectedData] = (0,
|
75659
|
+
const [lastSelectedData, setLastSelectedData] = (0, import_react21.useState)(
|
75482
75660
|
{}
|
75483
75661
|
);
|
75484
|
-
const [resolvedFields, setResolvedFields] = (0,
|
75485
|
-
const [fieldsLoading, setFieldsLoading] = (0,
|
75662
|
+
const [resolvedFields, setResolvedFields] = (0, import_react21.useState)(defaultFields || {});
|
75663
|
+
const [fieldsLoading, setFieldsLoading] = (0, import_react21.useState)(false);
|
75486
75664
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
75487
75665
|
const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
|
75488
|
-
const resolveFields = (0,
|
75666
|
+
const resolveFields = (0, import_react21.useCallback)(
|
75489
75667
|
(..._0) => __async2(void 0, [..._0], function* (fields = {}) {
|
75490
75668
|
var _a22, _b2, _c;
|
75491
75669
|
const lastData = ((_a22 = lastSelectedData.props) == null ? void 0 : _a22.id) === componentData.props.id ? lastSelectedData : {};
|
@@ -75521,7 +75699,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75521
75699
|
}),
|
75522
75700
|
[data, config, componentData, selectedItem, resolvedFields, state]
|
75523
75701
|
);
|
75524
|
-
(0,
|
75702
|
+
(0, import_react21.useEffect)(() => {
|
75525
75703
|
setFieldsLoading(true);
|
75526
75704
|
resolveFields(defaultFields).then((fields) => {
|
75527
75705
|
setResolvedFields(fields || {});
|
@@ -75539,7 +75717,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75539
75717
|
config,
|
75540
75718
|
resolveData,
|
75541
75719
|
componentState,
|
75542
|
-
overrides
|
75720
|
+
overrides,
|
75721
|
+
globalPermissions
|
75543
75722
|
} = useAppContext2();
|
75544
75723
|
const { data, ui } = state;
|
75545
75724
|
const { itemSelector } = ui;
|
@@ -75547,16 +75726,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75547
75726
|
const componentResolving = selectedItem ? (_a3 = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _a3.loading : (_b2 = componentState["puck-root"]) == null ? void 0 : _b2.loading;
|
75548
75727
|
const isLoading = fieldsResolving || componentResolving;
|
75549
75728
|
const rootProps = data.root.props || data.root;
|
75550
|
-
const Wrapper = (0,
|
75551
|
-
return /* @__PURE__ */ (0,
|
75729
|
+
const Wrapper = (0, import_react21.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
75730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
75552
75731
|
"form",
|
75553
75732
|
{
|
75554
|
-
className:
|
75733
|
+
className: getClassName21(),
|
75555
75734
|
onSubmit: (e2) => {
|
75556
75735
|
e2.preventDefault();
|
75557
75736
|
},
|
75558
75737
|
children: [
|
75559
|
-
/* @__PURE__ */ (0,
|
75738
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
|
75560
75739
|
const field = fields[fieldName];
|
75561
75740
|
if (!(field == null ? void 0 : field.type)) return null;
|
75562
75741
|
const onChange = (value, updatedUi) => {
|
@@ -75623,13 +75802,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75623
75802
|
};
|
75624
75803
|
if (selectedItem && itemSelector) {
|
75625
75804
|
const { readOnly = {} } = selectedItem;
|
75626
|
-
|
75805
|
+
const { edit } = getPermissions({
|
75806
|
+
selectedItem,
|
75807
|
+
config,
|
75808
|
+
globalPermissions: globalPermissions || {},
|
75809
|
+
appState: state
|
75810
|
+
});
|
75811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
75627
75812
|
AutoFieldPrivate,
|
75628
75813
|
{
|
75629
75814
|
field,
|
75630
75815
|
name: fieldName,
|
75631
75816
|
id: `${selectedItem.props.id}_${fieldName}`,
|
75632
|
-
readOnly: readOnly[fieldName],
|
75817
|
+
readOnly: !edit || readOnly[fieldName],
|
75633
75818
|
value: selectedItem.props[fieldName],
|
75634
75819
|
onChange
|
75635
75820
|
},
|
@@ -75637,7 +75822,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75637
75822
|
);
|
75638
75823
|
} else {
|
75639
75824
|
const { readOnly = {} } = data.root;
|
75640
|
-
return /* @__PURE__ */ (0,
|
75825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
75641
75826
|
AutoFieldPrivate,
|
75642
75827
|
{
|
75643
75828
|
field,
|
@@ -75651,26 +75836,41 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75651
75836
|
);
|
75652
75837
|
}
|
75653
75838
|
}) }),
|
75654
|
-
isLoading && /* @__PURE__ */ (0,
|
75839
|
+
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)(Loader2, { size: 16 }) }) })
|
75655
75840
|
]
|
75656
75841
|
}
|
75657
75842
|
);
|
75658
75843
|
};
|
75659
75844
|
init_react_import2();
|
75660
75845
|
init_react_import2();
|
75661
|
-
var
|
75846
|
+
var import_react222 = require("react");
|
75662
75847
|
init_react_import2();
|
75663
75848
|
init_react_import2();
|
75664
|
-
var
|
75665
|
-
var
|
75666
|
-
var
|
75849
|
+
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" };
|
75850
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
75851
|
+
var getClassName222 = get_class_name_factory_default2("ComponentList", styles_module_default17);
|
75667
75852
|
var ComponentListItem = ({
|
75668
75853
|
name,
|
75669
75854
|
label,
|
75670
75855
|
index
|
75671
75856
|
}) => {
|
75672
|
-
const { overrides } = useAppContext2();
|
75673
|
-
|
75857
|
+
const { overrides, config, globalPermissions, state } = useAppContext2();
|
75858
|
+
const canInsert = getPermissions({
|
75859
|
+
type: name,
|
75860
|
+
config,
|
75861
|
+
globalPermissions: globalPermissions || {},
|
75862
|
+
appState: state
|
75863
|
+
}).insert;
|
75864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
75865
|
+
Drawer.Item,
|
75866
|
+
{
|
75867
|
+
label,
|
75868
|
+
name,
|
75869
|
+
index,
|
75870
|
+
isDragDisabled: !canInsert,
|
75871
|
+
children: overrides.componentItem
|
75872
|
+
}
|
75873
|
+
);
|
75674
75874
|
};
|
75675
75875
|
var ComponentList = ({
|
75676
75876
|
children,
|
@@ -75679,11 +75879,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75679
75879
|
}) => {
|
75680
75880
|
const { config, state, setUi } = useAppContext2();
|
75681
75881
|
const { expanded = true } = state.ui.componentList[id] || {};
|
75682
|
-
return /* @__PURE__ */ (0,
|
75683
|
-
title && /* @__PURE__ */ (0,
|
75882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName222({ isExpanded: expanded }), children: [
|
75883
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
75684
75884
|
"button",
|
75685
75885
|
{
|
75686
|
-
className:
|
75886
|
+
className: getClassName222("title"),
|
75687
75887
|
onClick: () => setUi({
|
75688
75888
|
componentList: __spreadProps2(__spreadValues2({}, state.ui.componentList), {
|
75689
75889
|
[id]: __spreadProps2(__spreadValues2({}, state.ui.componentList[id]), {
|
@@ -75693,14 +75893,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75693
75893
|
}),
|
75694
75894
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
75695
75895
|
children: [
|
75696
|
-
/* @__PURE__ */ (0,
|
75697
|
-
/* @__PURE__ */ (0,
|
75896
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: title }),
|
75897
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName222("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronDown, { size: 12 }) })
|
75698
75898
|
]
|
75699
75899
|
}
|
75700
75900
|
),
|
75701
|
-
/* @__PURE__ */ (0,
|
75901
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName222("content"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Drawer, { droppableId: title, children: children || Object.keys(config.components).map((componentKey, i2) => {
|
75702
75902
|
var _a3;
|
75703
|
-
return /* @__PURE__ */ (0,
|
75903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
75704
75904
|
ComponentListItem,
|
75705
75905
|
{
|
75706
75906
|
label: (_a3 = config.components[componentKey]["label"]) != null ? _a3 : componentKey,
|
@@ -75713,10 +75913,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75713
75913
|
] });
|
75714
75914
|
};
|
75715
75915
|
ComponentList.Item = ComponentListItem;
|
75716
|
-
var
|
75916
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
75717
75917
|
var useComponentList = (config, ui) => {
|
75718
|
-
const [componentList, setComponentList] = (0,
|
75719
|
-
(0,
|
75918
|
+
const [componentList, setComponentList] = (0, import_react222.useState)();
|
75919
|
+
(0, import_react222.useEffect)(() => {
|
75720
75920
|
var _a3, _b2, _c;
|
75721
75921
|
if (Object.keys(ui.componentList).length > 0) {
|
75722
75922
|
const matchedComponents = [];
|
@@ -75726,7 +75926,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75726
75926
|
if (category.visible === false || !category.components) {
|
75727
75927
|
return null;
|
75728
75928
|
}
|
75729
|
-
return /* @__PURE__ */ (0,
|
75929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
75730
75930
|
ComponentList,
|
75731
75931
|
{
|
75732
75932
|
id: categoryKey,
|
@@ -75735,7 +75935,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75735
75935
|
var _a22;
|
75736
75936
|
matchedComponents.push(componentName);
|
75737
75937
|
const componentConf = config.components[componentName] || {};
|
75738
|
-
return /* @__PURE__ */ (0,
|
75938
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
75739
75939
|
ComponentList.Item,
|
75740
75940
|
{
|
75741
75941
|
label: (_a22 = componentConf["label"]) != null ? _a22 : componentName,
|
@@ -75755,7 +75955,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75755
75955
|
);
|
75756
75956
|
if (remainingComponents.length > 0 && !((_a3 = ui.componentList.other) == null ? void 0 : _a3.components) && ((_b2 = ui.componentList.other) == null ? void 0 : _b2.visible) !== false) {
|
75757
75957
|
_componentList.push(
|
75758
|
-
/* @__PURE__ */ (0,
|
75958
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
75759
75959
|
ComponentList,
|
75760
75960
|
{
|
75761
75961
|
id: "other",
|
@@ -75763,7 +75963,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75763
75963
|
children: remainingComponents.map((componentName, i2) => {
|
75764
75964
|
var _a22;
|
75765
75965
|
const componentConf = config.components[componentName] || {};
|
75766
|
-
return /* @__PURE__ */ (0,
|
75966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
75767
75967
|
ComponentList.Item,
|
75768
75968
|
{
|
75769
75969
|
name: componentName,
|
@@ -75783,21 +75983,21 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75783
75983
|
}, [config.categories, config.components, ui.componentList]);
|
75784
75984
|
return componentList;
|
75785
75985
|
};
|
75786
|
-
var
|
75787
|
-
var
|
75986
|
+
var import_react23 = require("react");
|
75987
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
75788
75988
|
var Components = () => {
|
75789
75989
|
const { config, state, overrides } = useAppContext2();
|
75790
75990
|
const componentList = useComponentList(config, state.ui);
|
75791
|
-
const Wrapper = (0,
|
75792
|
-
return /* @__PURE__ */ (0,
|
75991
|
+
const Wrapper = (0, import_react23.useMemo)(() => overrides.components || "div", [overrides]);
|
75992
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ComponentList, { id: "all" }) });
|
75793
75993
|
};
|
75794
75994
|
init_react_import2();
|
75795
|
-
var
|
75995
|
+
var import_react25 = require("react");
|
75796
75996
|
init_react_import2();
|
75797
|
-
var
|
75997
|
+
var import_react24 = __toESM2(require("react"));
|
75798
75998
|
var import_react_frame_component = __toESM2(require_lib());
|
75799
75999
|
var import_object_hash = __toESM2(require_object_hash());
|
75800
|
-
var
|
76000
|
+
var import_jsx_runtime322 = require("react/jsx-runtime");
|
75801
76001
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
75802
76002
|
var collectStyles = (doc) => {
|
75803
76003
|
const collected = [];
|
@@ -75840,7 +76040,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75840
76040
|
onStylesLoaded = () => null
|
75841
76041
|
}) => {
|
75842
76042
|
const { document: doc, window: win } = (0, import_react_frame_component.useFrame)();
|
75843
|
-
(0,
|
76043
|
+
(0, import_react24.useEffect)(() => {
|
75844
76044
|
if (!win || !doc) {
|
75845
76045
|
return () => {
|
75846
76046
|
};
|
@@ -75997,23 +76197,24 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75997
76197
|
observer.disconnect();
|
75998
76198
|
};
|
75999
76199
|
}, []);
|
76000
|
-
return /* @__PURE__ */ (0,
|
76200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(import_jsx_runtime322.Fragment, { children });
|
76001
76201
|
};
|
76002
|
-
var AutoFrameComponent =
|
76202
|
+
var AutoFrameComponent = import_react24.default.forwardRef(
|
76003
76203
|
function(_a3, ref2) {
|
76004
76204
|
var _b2 = _a3, { children, debug, onStylesLoaded } = _b2, props = __objRest2(_b2, ["children", "debug", "onStylesLoaded"]);
|
76005
|
-
return /* @__PURE__ */ (0,
|
76205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(import_react_frame_component.default, __spreadProps2(__spreadValues2({}, props), { ref: ref2, children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(CopyHostStyles, { debug, onStylesLoaded, children }) }));
|
76006
76206
|
}
|
76007
76207
|
);
|
76008
76208
|
AutoFrameComponent.displayName = "AutoFrameComponent";
|
76009
76209
|
var AutoFrame_default = AutoFrameComponent;
|
76010
76210
|
init_react_import2();
|
76011
|
-
var
|
76012
|
-
var
|
76013
|
-
var
|
76211
|
+
var styles_module_default18 = { "PuckPreview": "_PuckPreview_rxwlr_1", "PuckPreview-frame": "_PuckPreview-frame_rxwlr_5" };
|
76212
|
+
var import_react_frame_component2 = require_lib();
|
76213
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
76214
|
+
var getClassName23 = get_class_name_factory_default2("PuckPreview", styles_module_default18);
|
76014
76215
|
var Preview = ({ id = "puck-preview" }) => {
|
76015
|
-
const { config, dispatch, state, setStatus, iframe } = useAppContext2();
|
76016
|
-
const Page = (0,
|
76216
|
+
const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext2();
|
76217
|
+
const Page = (0, import_react25.useCallback)(
|
76017
76218
|
(pageProps) => {
|
76018
76219
|
var _a3, _b2;
|
76019
76220
|
return ((_a3 = config.root) == null ? void 0 : _a3.render) ? (_b2 = config.root) == null ? void 0 : _b2.render(__spreadProps2(__spreadValues2({
|
@@ -76022,33 +76223,36 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76022
76223
|
editMode: true,
|
76023
76224
|
// DEPRECATED
|
76024
76225
|
puck: { renderDropZone: DropZone, isEditing: true }
|
76025
|
-
})) : /* @__PURE__ */ (0,
|
76226
|
+
})) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: pageProps.children });
|
76026
76227
|
},
|
76027
76228
|
[config.root]
|
76028
76229
|
);
|
76230
|
+
const Frame2 = (0, import_react25.useMemo)(() => overrides.iframe || "div", [overrides]);
|
76029
76231
|
const rootProps = state.data.root.props || state.data.root;
|
76030
|
-
const ref2 = (0,
|
76031
|
-
return /* @__PURE__ */ (0,
|
76232
|
+
const ref2 = (0, import_react25.useRef)(null);
|
76233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
76032
76234
|
"div",
|
76033
76235
|
{
|
76034
|
-
className:
|
76236
|
+
className: getClassName23(),
|
76035
76237
|
id,
|
76036
76238
|
onClick: () => {
|
76037
76239
|
dispatch({ type: "setUi", ui: __spreadProps2(__spreadValues2({}, state.ui), { itemSelector: null }) });
|
76038
76240
|
},
|
76039
|
-
children: iframe.enabled ? /* @__PURE__ */ (0,
|
76241
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
76040
76242
|
AutoFrame_default,
|
76041
76243
|
{
|
76042
76244
|
id: "preview-frame",
|
76043
|
-
className:
|
76245
|
+
className: getClassName23("frame"),
|
76044
76246
|
"data-rfd-iframe": true,
|
76045
76247
|
ref: ref2,
|
76046
76248
|
onStylesLoaded: () => {
|
76047
76249
|
setStatus("READY");
|
76048
76250
|
},
|
76049
|
-
children: /* @__PURE__ */ (0,
|
76251
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_frame_component2.FrameContextConsumer, { children: ({ document: document2 }) => {
|
76252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Frame2, { document: document2, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Page, __spreadProps2(__spreadValues2({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId2 }) })) });
|
76253
|
+
} })
|
76050
76254
|
}
|
76051
|
-
) : /* @__PURE__ */ (0,
|
76255
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { id: "preview-frame", className: getClassName23("frame"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Page, __spreadProps2(__spreadValues2({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId2 }) })) })
|
76052
76256
|
}
|
76053
76257
|
);
|
76054
76258
|
};
|
@@ -76070,7 +76274,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76070
76274
|
};
|
76071
76275
|
init_react_import2();
|
76072
76276
|
init_react_import2();
|
76073
|
-
var
|
76277
|
+
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" };
|
76074
76278
|
init_react_import2();
|
76075
76279
|
var scrollIntoView2 = (el) => {
|
76076
76280
|
const oldStyle = __spreadValues2({}, el.style);
|
@@ -76080,7 +76284,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76080
76284
|
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
76081
76285
|
}
|
76082
76286
|
};
|
76083
|
-
var
|
76287
|
+
var import_react26 = require("react");
|
76084
76288
|
init_react_import2();
|
76085
76289
|
var isChildOfZone = (item, maybeChild, ctx) => {
|
76086
76290
|
var _a3;
|
@@ -76090,9 +76294,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76090
76294
|
return area === item.props.id;
|
76091
76295
|
})) : false;
|
76092
76296
|
};
|
76093
|
-
var
|
76094
|
-
var
|
76095
|
-
var getClassNameLayer = get_class_name_factory_default2("Layer",
|
76297
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
76298
|
+
var getClassName24 = get_class_name_factory_default2("LayerTree", styles_module_default19);
|
76299
|
+
var getClassNameLayer = get_class_name_factory_default2("Layer", styles_module_default19);
|
76096
76300
|
var LayerTree = ({
|
76097
76301
|
data,
|
76098
76302
|
config,
|
@@ -76103,15 +76307,15 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76103
76307
|
label
|
76104
76308
|
}) => {
|
76105
76309
|
const zones = data.zones || {};
|
76106
|
-
const ctx = (0,
|
76107
|
-
return /* @__PURE__ */ (0,
|
76108
|
-
label && /* @__PURE__ */ (0,
|
76109
|
-
/* @__PURE__ */ (0,
|
76310
|
+
const ctx = (0, import_react26.useContext)(dropZoneContext2);
|
76311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
76312
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
|
76313
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Layers, { size: "16" }) }),
|
76110
76314
|
" ",
|
76111
76315
|
label
|
76112
76316
|
] }),
|
76113
|
-
/* @__PURE__ */ (0,
|
76114
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
76317
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("ul", { className: getClassName24(), children: [
|
76318
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
|
76115
76319
|
zoneContent.map((item, i2) => {
|
76116
76320
|
var _a3;
|
76117
76321
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i2 && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId2 && !zone);
|
@@ -76129,7 +76333,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76129
76333
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
76130
76334
|
const componentConfig = config.components[item.type];
|
76131
76335
|
const label2 = (_a3 = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a3 : item.type.toString();
|
76132
|
-
return /* @__PURE__ */ (0,
|
76336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
76133
76337
|
"li",
|
76134
76338
|
{
|
76135
76339
|
className: getClassNameLayer({
|
@@ -76139,7 +76343,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76139
76343
|
childIsSelected
|
76140
76344
|
}),
|
76141
76345
|
children: [
|
76142
|
-
/* @__PURE__ */ (0,
|
76346
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
76143
76347
|
"button",
|
76144
76348
|
{
|
76145
76349
|
className: getClassNameLayer("clickable"),
|
@@ -76171,22 +76375,22 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76171
76375
|
setHoveringComponent(null);
|
76172
76376
|
},
|
76173
76377
|
children: [
|
76174
|
-
containsZone && /* @__PURE__ */ (0,
|
76378
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
76175
76379
|
"div",
|
76176
76380
|
{
|
76177
76381
|
className: getClassNameLayer("chevron"),
|
76178
76382
|
title: isSelected ? "Collapse" : "Expand",
|
76179
|
-
children: /* @__PURE__ */ (0,
|
76383
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { size: "12" })
|
76180
76384
|
}
|
76181
76385
|
),
|
76182
|
-
/* @__PURE__ */ (0,
|
76183
|
-
/* @__PURE__ */ (0,
|
76184
|
-
/* @__PURE__ */ (0,
|
76386
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
76387
|
+
/* @__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" }) }),
|
76388
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("name"), children: label2 })
|
76185
76389
|
] })
|
76186
76390
|
]
|
76187
76391
|
}
|
76188
76392
|
) }),
|
76189
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
76393
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
76190
76394
|
LayerTree,
|
76191
76395
|
{
|
76192
76396
|
config,
|
@@ -76206,13 +76410,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76206
76410
|
] })
|
76207
76411
|
] });
|
76208
76412
|
};
|
76209
|
-
var
|
76210
|
-
var
|
76413
|
+
var import_react27 = require("react");
|
76414
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
76211
76415
|
var Outline = () => {
|
76212
76416
|
const { dispatch, state, overrides, config } = useAppContext2();
|
76213
76417
|
const { data, ui } = state;
|
76214
76418
|
const { itemSelector } = ui;
|
76215
|
-
const setItemSelector = (0,
|
76419
|
+
const setItemSelector = (0, import_react27.useCallback)(
|
76216
76420
|
(newItemSelector) => {
|
76217
76421
|
dispatch({
|
76218
76422
|
type: "setUi",
|
@@ -76221,9 +76425,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76221
76425
|
},
|
76222
76426
|
[]
|
76223
76427
|
);
|
76224
|
-
const Wrapper = (0,
|
76225
|
-
return /* @__PURE__ */ (0,
|
76226
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId2]) && /* @__PURE__ */ (0,
|
76428
|
+
const Wrapper = (0, import_react27.useMemo)(() => overrides.outline || "div", [overrides]);
|
76429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(dropZoneContext2.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
76430
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId2]) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
76227
76431
|
LayerTree,
|
76228
76432
|
{
|
76229
76433
|
config,
|
@@ -76236,7 +76440,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76236
76440
|
),
|
76237
76441
|
Object.entries(findZonesForArea(data, "root")).map(
|
76238
76442
|
([zoneKey, zone]) => {
|
76239
|
-
return /* @__PURE__ */ (0,
|
76443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
76240
76444
|
LayerTree,
|
76241
76445
|
{
|
76242
76446
|
config,
|
@@ -76254,35 +76458,6 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76254
76458
|
] }) }) });
|
76255
76459
|
};
|
76256
76460
|
init_react_import2();
|
76257
|
-
var loadOverrides = ({
|
76258
|
-
overrides,
|
76259
|
-
plugins
|
76260
|
-
}) => {
|
76261
|
-
const collected = __spreadValues2({}, overrides);
|
76262
|
-
plugins.forEach((plugin) => {
|
76263
|
-
Object.keys(plugin.overrides).forEach((overridesType) => {
|
76264
|
-
if (overridesType === "fieldTypes") {
|
76265
|
-
const fieldTypes = plugin.overrides.fieldTypes;
|
76266
|
-
Object.keys(fieldTypes).forEach((fieldType) => {
|
76267
|
-
collected.fieldTypes = collected.fieldTypes || {};
|
76268
|
-
const childNode2 = collected.fieldTypes[fieldType];
|
76269
|
-
const Comp2 = (props) => fieldTypes[fieldType](__spreadProps2(__spreadValues2({}, props), {
|
76270
|
-
children: childNode2 ? childNode2(props) : props.children
|
76271
|
-
}));
|
76272
|
-
collected.fieldTypes[fieldType] = Comp2;
|
76273
|
-
});
|
76274
|
-
return;
|
76275
|
-
}
|
76276
|
-
const childNode = collected[overridesType];
|
76277
|
-
const Comp = (props) => plugin.overrides[overridesType](__spreadProps2(__spreadValues2({}, props), {
|
76278
|
-
children: childNode ? childNode(props) : props.children
|
76279
|
-
}));
|
76280
|
-
collected[overridesType] = Comp;
|
76281
|
-
});
|
76282
|
-
});
|
76283
|
-
return collected;
|
76284
|
-
};
|
76285
|
-
init_react_import2();
|
76286
76461
|
var import_react_hotkeys_hook = (init_react_hotkeys_hook_esm(), __toCommonJS(react_hotkeys_hook_esm_exports));
|
76287
76462
|
function usePuckHistory({
|
76288
76463
|
dispatch,
|
@@ -76335,19 +76510,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76335
76510
|
};
|
76336
76511
|
}
|
76337
76512
|
init_react_import2();
|
76338
|
-
var
|
76513
|
+
var import_react28 = require("react");
|
76339
76514
|
var import_use_debounce3 = (init_index_module(), __toCommonJS(index_module_exports));
|
76340
76515
|
var EMPTY_HISTORY_INDEX = -1;
|
76341
76516
|
function useHistoryStore(initialHistory) {
|
76342
76517
|
var _a3, _b2;
|
76343
|
-
const [histories, setHistories] = (0,
|
76518
|
+
const [histories, setHistories] = (0, import_react28.useState)(
|
76344
76519
|
(_a3 = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a3 : []
|
76345
76520
|
);
|
76346
76521
|
const updateHistories = (histories2) => {
|
76347
76522
|
setHistories(histories2);
|
76348
76523
|
setIndex(histories2.length - 1);
|
76349
76524
|
};
|
76350
|
-
const [index, setIndex] = (0,
|
76525
|
+
const [index, setIndex] = (0, import_react28.useState)(
|
76351
76526
|
(_b2 = initialHistory == null ? void 0 : initialHistory.index) != null ? _b2 : EMPTY_HISTORY_INDEX
|
76352
76527
|
);
|
76353
76528
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
@@ -76497,19 +76672,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76497
76672
|
var styles = window.getComputedStyle(el);
|
76498
76673
|
return calculateBox3(borderBox, styles);
|
76499
76674
|
};
|
76500
|
-
var
|
76675
|
+
var import_react30 = require("react");
|
76501
76676
|
init_react_import2();
|
76502
|
-
var
|
76677
|
+
var import_react29 = require("react");
|
76503
76678
|
init_react_import2();
|
76504
|
-
var
|
76505
|
-
var
|
76679
|
+
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" };
|
76680
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
76506
76681
|
var icons = {
|
76507
|
-
Smartphone: /* @__PURE__ */ (0,
|
76508
|
-
Tablet: /* @__PURE__ */ (0,
|
76509
|
-
Monitor: /* @__PURE__ */ (0,
|
76682
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Smartphone, { size: 16 }),
|
76683
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Tablet, { size: 16 }),
|
76684
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Monitor, { size: 16 })
|
76510
76685
|
};
|
76511
|
-
var
|
76512
|
-
var getClassNameButton = get_class_name_factory_default2("ViewportButton",
|
76686
|
+
var getClassName25 = get_class_name_factory_default2("ViewportControls", styles_module_default20);
|
76687
|
+
var getClassNameButton = get_class_name_factory_default2("ViewportButton", styles_module_default20);
|
76513
76688
|
var ViewportButton = ({
|
76514
76689
|
children,
|
76515
76690
|
height = "auto",
|
@@ -76518,11 +76693,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76518
76693
|
onClick
|
76519
76694
|
}) => {
|
76520
76695
|
const { state } = useAppContext2();
|
76521
|
-
const [isActive2, setIsActive] = (0,
|
76522
|
-
(0,
|
76696
|
+
const [isActive2, setIsActive] = (0, import_react29.useState)(false);
|
76697
|
+
(0, import_react29.useEffect)(() => {
|
76523
76698
|
setIsActive(width === state.ui.viewports.current.width);
|
76524
76699
|
}, [width, state.ui.viewports.current.width]);
|
76525
|
-
return /* @__PURE__ */ (0,
|
76700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton({ isActive: isActive2 }), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76526
76701
|
IconButton,
|
76527
76702
|
{
|
76528
76703
|
title,
|
@@ -76531,7 +76706,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76531
76706
|
e2.stopPropagation();
|
76532
76707
|
onClick({ width, height });
|
76533
76708
|
},
|
76534
|
-
children: /* @__PURE__ */ (0,
|
76709
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton("inner"), children })
|
76535
76710
|
}
|
76536
76711
|
) });
|
76537
76712
|
};
|
@@ -76555,7 +76730,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76555
76730
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
76556
76731
|
(option) => option.value === autoZoom
|
76557
76732
|
);
|
76558
|
-
const zoomOptions = (0,
|
76733
|
+
const zoomOptions = (0, import_react29.useMemo)(
|
76559
76734
|
() => [
|
76560
76735
|
...defaultZoomOptions,
|
76561
76736
|
...defaultsContainAutoZoom ? [] : [
|
@@ -76567,8 +76742,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76567
76742
|
].filter((a2) => a2.value <= autoZoom).sort((a2, b) => a2.value > b.value ? 1 : -1),
|
76568
76743
|
[autoZoom]
|
76569
76744
|
);
|
76570
|
-
return /* @__PURE__ */ (0,
|
76571
|
-
viewports.map((viewport, i2) => /* @__PURE__ */ (0,
|
76745
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassName25(), children: [
|
76746
|
+
viewports.map((viewport, i2) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76572
76747
|
ViewportButton,
|
76573
76748
|
{
|
76574
76749
|
height: viewport.height,
|
@@ -76579,8 +76754,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76579
76754
|
},
|
76580
76755
|
i2
|
76581
76756
|
)),
|
76582
|
-
/* @__PURE__ */ (0,
|
76583
|
-
/* @__PURE__ */ (0,
|
76757
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
|
76758
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76584
76759
|
IconButton,
|
76585
76760
|
{
|
76586
76761
|
title: "Zoom viewport out",
|
@@ -76594,10 +76769,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76594
76769
|
)].value
|
76595
76770
|
);
|
76596
76771
|
},
|
76597
|
-
children: /* @__PURE__ */ (0,
|
76772
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomOut, { size: 16 })
|
76598
76773
|
}
|
76599
76774
|
),
|
76600
|
-
/* @__PURE__ */ (0,
|
76775
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76601
76776
|
IconButton,
|
76602
76777
|
{
|
76603
76778
|
title: "Zoom viewport in",
|
@@ -76611,19 +76786,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76611
76786
|
)].value
|
76612
76787
|
);
|
76613
76788
|
},
|
76614
|
-
children: /* @__PURE__ */ (0,
|
76789
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomIn, { size: 16 })
|
76615
76790
|
}
|
76616
76791
|
),
|
76617
|
-
/* @__PURE__ */ (0,
|
76618
|
-
/* @__PURE__ */ (0,
|
76792
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
|
76793
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76619
76794
|
"select",
|
76620
76795
|
{
|
76621
|
-
className:
|
76796
|
+
className: getClassName25("zoomSelect"),
|
76622
76797
|
value: zoom.toString(),
|
76623
76798
|
onChange: (e2) => {
|
76624
76799
|
onZoom(parseFloat(e2.currentTarget.value));
|
76625
76800
|
},
|
76626
|
-
children: zoomOptions.map((option) => /* @__PURE__ */ (0,
|
76801
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76627
76802
|
"option",
|
76628
76803
|
{
|
76629
76804
|
value: option.value,
|
@@ -76636,7 +76811,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76636
76811
|
] });
|
76637
76812
|
};
|
76638
76813
|
init_react_import2();
|
76639
|
-
var
|
76814
|
+
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" };
|
76640
76815
|
init_react_import2();
|
76641
76816
|
var RESET_ZOOM_SMALLER_THAN_FRAME = true;
|
76642
76817
|
var getZoomConfig = (uiViewport, frame, zoom) => {
|
@@ -76665,24 +76840,24 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76665
76840
|
}
|
76666
76841
|
return { autoZoom, rootHeight, zoom };
|
76667
76842
|
};
|
76668
|
-
var
|
76669
|
-
var
|
76843
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
76844
|
+
var getClassName26 = get_class_name_factory_default2("PuckCanvas", styles_module_default21);
|
76670
76845
|
var ZOOM_ON_CHANGE = true;
|
76671
76846
|
var Canvas = () => {
|
76672
76847
|
const { status, iframe } = useAppContext2();
|
76673
76848
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext2();
|
76674
76849
|
const { ui } = state;
|
76675
|
-
const frameRef = (0,
|
76676
|
-
const [showTransition, setShowTransition] = (0,
|
76677
|
-
const defaultRender = (0,
|
76678
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */ (0,
|
76850
|
+
const frameRef = (0, import_react30.useRef)(null);
|
76851
|
+
const [showTransition, setShowTransition] = (0, import_react30.useState)(false);
|
76852
|
+
const defaultRender = (0, import_react30.useMemo)(() => {
|
76853
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children });
|
76679
76854
|
return PuckDefault;
|
76680
76855
|
}, []);
|
76681
|
-
const CustomPreview = (0,
|
76856
|
+
const CustomPreview = (0, import_react30.useMemo)(
|
76682
76857
|
() => overrides.preview || defaultRender,
|
76683
76858
|
[overrides]
|
76684
76859
|
);
|
76685
|
-
const getFrameDimensions = (0,
|
76860
|
+
const getFrameDimensions = (0, import_react30.useCallback)(() => {
|
76686
76861
|
if (frameRef.current) {
|
76687
76862
|
const frame = frameRef.current;
|
76688
76863
|
const box = getBox3(frame);
|
@@ -76690,7 +76865,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76690
76865
|
}
|
76691
76866
|
return { width: 0, height: 0 };
|
76692
76867
|
}, [frameRef]);
|
76693
|
-
const resetAutoZoom = (0,
|
76868
|
+
const resetAutoZoom = (0, import_react30.useCallback)(
|
76694
76869
|
(ui2 = state.ui) => {
|
76695
76870
|
if (frameRef.current) {
|
76696
76871
|
setZoomConfig(
|
@@ -76700,11 +76875,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76700
76875
|
},
|
76701
76876
|
[frameRef, zoomConfig, state.ui]
|
76702
76877
|
);
|
76703
|
-
(0,
|
76878
|
+
(0, import_react30.useEffect)(() => {
|
76704
76879
|
setShowTransition(false);
|
76705
76880
|
resetAutoZoom();
|
76706
76881
|
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
76707
|
-
(0,
|
76882
|
+
(0, import_react30.useEffect)(() => {
|
76708
76883
|
const { height: frameHeight } = getFrameDimensions();
|
76709
76884
|
if (ui.viewports.current.height === "auto") {
|
76710
76885
|
setZoomConfig(__spreadProps2(__spreadValues2({}, zoomConfig), {
|
@@ -76712,7 +76887,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76712
76887
|
}));
|
76713
76888
|
}
|
76714
76889
|
}, [zoomConfig.zoom]);
|
76715
|
-
(0,
|
76890
|
+
(0, import_react30.useEffect)(() => {
|
76716
76891
|
const observer = new ResizeObserver(() => {
|
76717
76892
|
setShowTransition(false);
|
76718
76893
|
resetAutoZoom();
|
@@ -76724,10 +76899,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76724
76899
|
observer.disconnect();
|
76725
76900
|
};
|
76726
76901
|
}, []);
|
76727
|
-
return /* @__PURE__ */ (0,
|
76902
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
76728
76903
|
"div",
|
76729
76904
|
{
|
76730
|
-
className:
|
76905
|
+
className: getClassName26({
|
76731
76906
|
ready: status === "READY" || !iframe.enabled
|
76732
76907
|
}),
|
76733
76908
|
onClick: () => dispatch({
|
@@ -76736,7 +76911,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76736
76911
|
recordHistory: true
|
76737
76912
|
}),
|
76738
76913
|
children: [
|
76739
|
-
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0,
|
76914
|
+
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
76740
76915
|
ViewportControls,
|
76741
76916
|
{
|
76742
76917
|
autoZoom: zoomConfig.autoZoom,
|
@@ -76761,10 +76936,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76761
76936
|
}
|
76762
76937
|
}
|
76763
76938
|
) }),
|
76764
|
-
/* @__PURE__ */ (0,
|
76939
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
76765
76940
|
"div",
|
76766
76941
|
{
|
76767
|
-
className:
|
76942
|
+
className: getClassName26("root"),
|
76768
76943
|
style: {
|
76769
76944
|
width: iframe.enabled ? ui.viewports.current.width : "100%",
|
76770
76945
|
height: zoomConfig.rootHeight,
|
@@ -76773,7 +76948,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76773
76948
|
overflow: iframe.enabled ? void 0 : "auto"
|
76774
76949
|
},
|
76775
76950
|
suppressHydrationWarning: true,
|
76776
|
-
children: /* @__PURE__ */ (0,
|
76951
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Preview, {}) })
|
76777
76952
|
}
|
76778
76953
|
) })
|
76779
76954
|
]
|
@@ -76810,9 +76985,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76810
76985
|
ui: __spreadProps2(__spreadValues2({}, state.ui), { itemSelector })
|
76811
76986
|
});
|
76812
76987
|
};
|
76813
|
-
var
|
76814
|
-
var
|
76815
|
-
var getLayoutClassName = get_class_name_factory_default2("PuckLayout",
|
76988
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
76989
|
+
var getClassName27 = get_class_name_factory_default2("Puck", styles_module_default15);
|
76990
|
+
var getLayoutClassName = get_class_name_factory_default2("PuckLayout", styles_module_default15);
|
76816
76991
|
function Puck({
|
76817
76992
|
children,
|
76818
76993
|
config,
|
@@ -76821,6 +76996,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76821
76996
|
onChange,
|
76822
76997
|
onPublish,
|
76823
76998
|
onAction,
|
76999
|
+
permissions = {},
|
76824
77000
|
plugins = [],
|
76825
77001
|
overrides = {},
|
76826
77002
|
renderHeader,
|
@@ -76836,10 +77012,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76836
77012
|
}) {
|
76837
77013
|
var _a3;
|
76838
77014
|
const historyStore = useHistoryStore(initialHistory);
|
76839
|
-
const [reducer2] = (0,
|
77015
|
+
const [reducer2] = (0, import_react31.useState)(
|
76840
77016
|
() => createReducer({ config, record: historyStore.record, onAction })
|
76841
77017
|
);
|
76842
|
-
const [initialAppState] = (0,
|
77018
|
+
const [initialAppState] = (0, import_react31.useState)(() => {
|
76843
77019
|
var _a22, _b2, _c, _d, _e, _f, _g;
|
76844
77020
|
const initial = __spreadValues2(__spreadValues2({}, defaultAppState2.ui), initialUi);
|
76845
77021
|
let clientUiState = {};
|
@@ -76897,7 +77073,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76897
77073
|
})
|
76898
77074
|
});
|
76899
77075
|
});
|
76900
|
-
const [appState, dispatch] = (0,
|
77076
|
+
const [appState, dispatch] = (0, import_react31.useReducer)(
|
76901
77077
|
reducer2,
|
76902
77078
|
flushZones(initialAppState)
|
76903
77079
|
);
|
@@ -76908,9 +77084,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76908
77084
|
config,
|
76909
77085
|
dispatch
|
76910
77086
|
);
|
76911
|
-
const [menuOpen, setMenuOpen] = (0,
|
77087
|
+
const [menuOpen, setMenuOpen] = (0, import_react31.useState)(false);
|
76912
77088
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
76913
|
-
const setItemSelector = (0,
|
77089
|
+
const setItemSelector = (0, import_react31.useCallback)(
|
76914
77090
|
(newItemSelector) => {
|
76915
77091
|
if (newItemSelector === itemSelector) return;
|
76916
77092
|
dispatch({
|
@@ -76922,13 +77098,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76922
77098
|
[itemSelector]
|
76923
77099
|
);
|
76924
77100
|
const selectedItem = itemSelector ? getItem2(itemSelector, data) : null;
|
76925
|
-
(0,
|
77101
|
+
(0, import_react31.useEffect)(() => {
|
76926
77102
|
if (onChange) onChange(data);
|
76927
77103
|
}, [data]);
|
76928
77104
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
76929
|
-
const [draggedItem, setDraggedItem] = (0,
|
77105
|
+
const [draggedItem, setDraggedItem] = (0, import_react31.useState)();
|
76930
77106
|
const rootProps = data.root.props || data.root;
|
76931
|
-
const toggleSidebars = (0,
|
77107
|
+
const toggleSidebars = (0, import_react31.useCallback)(
|
76932
77108
|
(sidebar) => {
|
76933
77109
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
76934
77110
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -76942,7 +77118,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76942
77118
|
},
|
76943
77119
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
76944
77120
|
);
|
76945
|
-
(0,
|
77121
|
+
(0, import_react31.useEffect)(() => {
|
76946
77122
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
76947
77123
|
dispatch({
|
76948
77124
|
type: "setUi",
|
@@ -76965,11 +77141,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76965
77141
|
window.removeEventListener("resize", handleResize);
|
76966
77142
|
};
|
76967
77143
|
}, []);
|
76968
|
-
const
|
76969
|
-
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children: children2 });
|
76970
|
-
return PuckDefault;
|
76971
|
-
}, []);
|
76972
|
-
const defaultHeaderRender = (0, import_react30.useMemo)(() => {
|
77144
|
+
const defaultHeaderRender = (0, import_react31.useMemo)(() => {
|
76973
77145
|
if (renderHeader) {
|
76974
77146
|
console.warn(
|
76975
77147
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -76977,48 +77149,49 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76977
77149
|
const RenderHeader = (_a22) => {
|
76978
77150
|
var _b2 = _a22, { actions } = _b2, props = __objRest2(_b2, ["actions"]);
|
76979
77151
|
const Comp = renderHeader;
|
76980
|
-
return /* @__PURE__ */ (0,
|
77152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState, children: actions }));
|
76981
77153
|
};
|
76982
77154
|
return RenderHeader;
|
76983
77155
|
}
|
76984
|
-
return
|
77156
|
+
return DefaultOverride;
|
76985
77157
|
}, [renderHeader]);
|
76986
|
-
const defaultHeaderActionsRender = (0,
|
77158
|
+
const defaultHeaderActionsRender = (0, import_react31.useMemo)(() => {
|
76987
77159
|
if (renderHeaderActions) {
|
76988
77160
|
console.warn(
|
76989
77161
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
76990
77162
|
);
|
76991
77163
|
const RenderHeader = (props) => {
|
76992
77164
|
const Comp = renderHeaderActions;
|
76993
|
-
return /* @__PURE__ */ (0,
|
77165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState }));
|
76994
77166
|
};
|
76995
77167
|
return RenderHeader;
|
76996
77168
|
}
|
76997
|
-
return
|
77169
|
+
return DefaultOverride;
|
76998
77170
|
}, [renderHeader]);
|
76999
|
-
const loadedOverrides = (
|
77000
|
-
|
77001
|
-
|
77002
|
-
|
77003
|
-
|
77171
|
+
const loadedOverrides = useLoadedOverrides({
|
77172
|
+
overrides,
|
77173
|
+
plugins
|
77174
|
+
});
|
77175
|
+
const CustomPuck = (0, import_react31.useMemo)(
|
77176
|
+
() => loadedOverrides.puck || DefaultOverride,
|
77004
77177
|
[loadedOverrides]
|
77005
77178
|
);
|
77006
|
-
const CustomHeader = (0,
|
77179
|
+
const CustomHeader = (0, import_react31.useMemo)(
|
77007
77180
|
() => loadedOverrides.header || defaultHeaderRender,
|
77008
77181
|
[loadedOverrides]
|
77009
77182
|
);
|
77010
|
-
const CustomHeaderActions = (0,
|
77183
|
+
const CustomHeaderActions = (0, import_react31.useMemo)(
|
77011
77184
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
77012
77185
|
[loadedOverrides]
|
77013
77186
|
);
|
77014
|
-
const [mounted, setMounted] = (0,
|
77015
|
-
(0,
|
77187
|
+
const [mounted, setMounted] = (0, import_react31.useState)(false);
|
77188
|
+
(0, import_react31.useEffect)(() => {
|
77016
77189
|
setMounted(true);
|
77017
77190
|
}, []);
|
77018
77191
|
const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
|
77019
77192
|
const selectedComponentLabel = selectedItem ? (_a3 = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _a3 : selectedItem.type.toString() : "";
|
77020
|
-
return /* @__PURE__ */ (0,
|
77021
|
-
/* @__PURE__ */ (0,
|
77193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: `Puck ${getClassName27()}`, children: [
|
77194
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77022
77195
|
AppProvider,
|
77023
77196
|
{
|
77024
77197
|
value: {
|
@@ -77031,9 +77204,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77031
77204
|
overrides: loadedOverrides,
|
77032
77205
|
history,
|
77033
77206
|
viewports,
|
77034
|
-
iframe
|
77207
|
+
iframe,
|
77208
|
+
globalPermissions: __spreadValues2({
|
77209
|
+
delete: true,
|
77210
|
+
drag: true,
|
77211
|
+
duplicate: true,
|
77212
|
+
insert: true,
|
77213
|
+
edit: true
|
77214
|
+
}, permissions)
|
77035
77215
|
},
|
77036
|
-
children: /* @__PURE__ */ (0,
|
77216
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77037
77217
|
DragDropContext2,
|
77038
77218
|
{
|
77039
77219
|
autoScrollerOptions: { disabled: dnd == null ? void 0 : dnd.disableAutoScroll },
|
@@ -77085,7 +77265,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77085
77265
|
});
|
77086
77266
|
}
|
77087
77267
|
},
|
77088
|
-
children: /* @__PURE__ */ (0,
|
77268
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77089
77269
|
DropZoneProvider,
|
77090
77270
|
{
|
77091
77271
|
value: {
|
@@ -77099,7 +77279,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77099
77279
|
mode: "edit",
|
77100
77280
|
areaId: "root"
|
77101
77281
|
},
|
77102
|
-
children: /* @__PURE__ */ (0,
|
77282
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77103
77283
|
"div",
|
77104
77284
|
{
|
77105
77285
|
className: getLayoutClassName({
|
@@ -77108,64 +77288,64 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77108
77288
|
mounted,
|
77109
77289
|
rightSideBarVisible
|
77110
77290
|
}),
|
77111
|
-
children: /* @__PURE__ */ (0,
|
77112
|
-
/* @__PURE__ */ (0,
|
77291
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("inner"), children: [
|
77292
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77113
77293
|
CustomHeader,
|
77114
77294
|
{
|
77115
|
-
actions: /* @__PURE__ */ (0,
|
77295
|
+
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)(
|
77116
77296
|
Button,
|
77117
77297
|
{
|
77118
77298
|
onClick: () => {
|
77119
77299
|
onPublish && onPublish(data);
|
77120
77300
|
},
|
77121
|
-
icon: /* @__PURE__ */ (0,
|
77301
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Globe, { size: "14px" }),
|
77122
77302
|
children: "Publish"
|
77123
77303
|
}
|
77124
77304
|
) }) }),
|
77125
|
-
children: /* @__PURE__ */ (0,
|
77126
|
-
/* @__PURE__ */ (0,
|
77127
|
-
/* @__PURE__ */ (0,
|
77305
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerInner"), children: [
|
77306
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerToggle"), children: [
|
77307
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77128
77308
|
"div",
|
77129
77309
|
{
|
77130
77310
|
className: getLayoutClassName(
|
77131
77311
|
"leftSideBarToggle"
|
77132
77312
|
),
|
77133
|
-
children: /* @__PURE__ */ (0,
|
77313
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77134
77314
|
IconButton,
|
77135
77315
|
{
|
77136
77316
|
onClick: () => {
|
77137
77317
|
toggleSidebars("left");
|
77138
77318
|
},
|
77139
77319
|
title: "Toggle left sidebar",
|
77140
|
-
children: /* @__PURE__ */ (0,
|
77320
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelLeft, { focusable: "false" })
|
77141
77321
|
}
|
77142
77322
|
)
|
77143
77323
|
}
|
77144
77324
|
),
|
77145
|
-
/* @__PURE__ */ (0,
|
77325
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77146
77326
|
"div",
|
77147
77327
|
{
|
77148
77328
|
className: getLayoutClassName(
|
77149
77329
|
"rightSideBarToggle"
|
77150
77330
|
),
|
77151
|
-
children: /* @__PURE__ */ (0,
|
77331
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77152
77332
|
IconButton,
|
77153
77333
|
{
|
77154
77334
|
onClick: () => {
|
77155
77335
|
toggleSidebars("right");
|
77156
77336
|
},
|
77157
77337
|
title: "Toggle right sidebar",
|
77158
|
-
children: /* @__PURE__ */ (0,
|
77338
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelRight, { focusable: "false" })
|
77159
77339
|
}
|
77160
77340
|
)
|
77161
77341
|
}
|
77162
77342
|
)
|
77163
77343
|
] }),
|
77164
|
-
/* @__PURE__ */ (0,
|
77344
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Heading2, { rank: 2, size: "xs", children: [
|
77165
77345
|
headerTitle || rootProps.title || "Page",
|
77166
|
-
headerPath && /* @__PURE__ */ (0,
|
77346
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
77167
77347
|
" ",
|
77168
|
-
/* @__PURE__ */ (0,
|
77348
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77169
77349
|
"code",
|
77170
77350
|
{
|
77171
77351
|
className: getLayoutClassName("headerPath"),
|
@@ -77174,18 +77354,18 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77174
77354
|
)
|
77175
77355
|
] })
|
77176
77356
|
] }) }),
|
77177
|
-
/* @__PURE__ */ (0,
|
77178
|
-
/* @__PURE__ */ (0,
|
77357
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerTools"), children: [
|
77358
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77179
77359
|
IconButton,
|
77180
77360
|
{
|
77181
77361
|
onClick: () => {
|
77182
77362
|
return setMenuOpen(!menuOpen);
|
77183
77363
|
},
|
77184
77364
|
title: "Toggle menu bar",
|
77185
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
77365
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronDown, { focusable: "false" })
|
77186
77366
|
}
|
77187
77367
|
) }),
|
77188
|
-
/* @__PURE__ */ (0,
|
77368
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77189
77369
|
MenuBar,
|
77190
77370
|
{
|
77191
77371
|
appState,
|
@@ -77193,13 +77373,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77193
77373
|
dispatch,
|
77194
77374
|
onPublish,
|
77195
77375
|
menuOpen,
|
77196
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
77376
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77197
77377
|
Button,
|
77198
77378
|
{
|
77199
77379
|
onClick: () => {
|
77200
77380
|
onPublish && onPublish(data);
|
77201
77381
|
},
|
77202
|
-
icon: /* @__PURE__ */ (0,
|
77382
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Globe, { size: "14px" }),
|
77203
77383
|
children: "Publish"
|
77204
77384
|
}
|
77205
77385
|
) }),
|
@@ -77210,19 +77390,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77210
77390
|
] }) })
|
77211
77391
|
}
|
77212
77392
|
),
|
77213
|
-
/* @__PURE__ */ (0,
|
77214
|
-
/* @__PURE__ */ (0,
|
77215
|
-
/* @__PURE__ */ (0,
|
77393
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
|
77394
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SidebarSection2, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Components, {}) }),
|
77395
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SidebarSection2, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Outline, {}) })
|
77216
77396
|
] }),
|
77217
|
-
/* @__PURE__ */ (0,
|
77218
|
-
/* @__PURE__ */ (0,
|
77397
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Canvas, {}),
|
77398
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77219
77399
|
SidebarSection2,
|
77220
77400
|
{
|
77221
77401
|
noPadding: true,
|
77222
77402
|
noBorderTop: true,
|
77223
77403
|
showBreadcrumbs: true,
|
77224
77404
|
title: selectedItem ? selectedComponentLabel : "Page",
|
77225
|
-
children: /* @__PURE__ */ (0,
|
77405
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Fields, {})
|
77226
77406
|
}
|
77227
77407
|
) })
|
77228
77408
|
] })
|
@@ -77234,7 +77414,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77234
77414
|
)
|
77235
77415
|
}
|
77236
77416
|
),
|
77237
|
-
/* @__PURE__ */ (0,
|
77417
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { id: "puck-portal-root", className: getClassName27("portal") })
|
77238
77418
|
] });
|
77239
77419
|
}
|
77240
77420
|
Puck.Components = Components;
|
@@ -77242,7 +77422,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77242
77422
|
Puck.Outline = Outline;
|
77243
77423
|
Puck.Preview = Preview;
|
77244
77424
|
init_react_import2();
|
77245
|
-
var
|
77425
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
77246
77426
|
function Render({
|
77247
77427
|
config,
|
77248
77428
|
data
|
@@ -77255,7 +77435,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77255
77435
|
const rootProps = defaultedData.root.props || defaultedData.root;
|
77256
77436
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
77257
77437
|
if ((_a3 = config.root) == null ? void 0 : _a3.render) {
|
77258
|
-
return /* @__PURE__ */ (0,
|
77438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
77259
77439
|
config.root.render,
|
77260
77440
|
__spreadProps2(__spreadValues2({}, rootProps), {
|
77261
77441
|
puck: {
|
@@ -77265,11 +77445,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77265
77445
|
title,
|
77266
77446
|
editMode: false,
|
77267
77447
|
id: "puck-root",
|
77268
|
-
children: /* @__PURE__ */ (0,
|
77448
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZone, { zone: rootDroppableId2 })
|
77269
77449
|
})
|
77270
77450
|
) });
|
77271
77451
|
}
|
77272
|
-
return /* @__PURE__ */ (0,
|
77452
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZone, { zone: rootDroppableId2 }) });
|
77273
77453
|
}
|
77274
77454
|
init_react_import2();
|
77275
77455
|
var migrations = [
|
@@ -77365,12 +77545,25 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77365
77545
|
config,
|
77366
77546
|
history,
|
77367
77547
|
dispatch,
|
77368
|
-
selectedItem
|
77548
|
+
selectedItem: currentItem,
|
77549
|
+
globalPermissions
|
77369
77550
|
} = useAppContext2();
|
77370
77551
|
return {
|
77371
77552
|
appState,
|
77372
77553
|
config,
|
77373
77554
|
dispatch,
|
77555
|
+
getPermissions: ({
|
77556
|
+
item,
|
77557
|
+
type
|
77558
|
+
} = {}) => {
|
77559
|
+
return getPermissions({
|
77560
|
+
selectedItem: item || currentItem,
|
77561
|
+
type,
|
77562
|
+
globalPermissions: globalPermissions || {},
|
77563
|
+
config,
|
77564
|
+
appState
|
77565
|
+
});
|
77566
|
+
},
|
77374
77567
|
history: {
|
77375
77568
|
back: history.back,
|
77376
77569
|
forward: history.forward,
|
@@ -77382,7 +77575,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77382
77575
|
index: history.historyStore.index,
|
77383
77576
|
historyStore: history.historyStore
|
77384
77577
|
},
|
77385
|
-
selectedItem:
|
77578
|
+
selectedItem: currentItem || null
|
77386
77579
|
};
|
77387
77580
|
};
|
77388
77581
|
}
|
@@ -77683,7 +77876,8 @@ var defaultContext = {
|
|
77683
77876
|
status: "LOADING",
|
77684
77877
|
setStatus: () => null,
|
77685
77878
|
iframe: {},
|
77686
|
-
safariFallbackMode: false
|
77879
|
+
safariFallbackMode: false,
|
77880
|
+
globalPermissions: {}
|
77687
77881
|
};
|
77688
77882
|
var appContext = (0, import_react10.createContext)(defaultContext);
|
77689
77883
|
function useAppContext() {
|