@measured/puck-plugin-heading-analyzer 0.16.0-canary.6386bd1 → 0.16.0-canary.7cac376
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +8 -0
- package/dist/index.js +813 -590
- 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
|
);
|
@@ -74977,34 +75165,37 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74977
75165
|
})
|
74978
75166
|
});
|
74979
75167
|
};
|
74980
|
-
var
|
74981
|
-
|
74982
|
-
|
74983
|
-
|
74984
|
-
|
74985
|
-
|
74986
|
-
|
74987
|
-
|
74988
|
-
if (action.destinationZone === rootDroppableId2) {
|
74989
|
-
return __spreadProps2(__spreadValues2({}, data), {
|
74990
|
-
content: insert(
|
74991
|
-
data.content,
|
74992
|
-
action.destinationIndex,
|
74993
|
-
emptyComponentData
|
74994
|
-
)
|
74995
|
-
});
|
74996
|
-
}
|
74997
|
-
const newData = setupZone2(data, action.destinationZone);
|
75168
|
+
var insertAction = (data, action, config) => {
|
75169
|
+
const emptyComponentData = {
|
75170
|
+
type: action.componentType,
|
75171
|
+
props: __spreadProps2(__spreadValues2({}, config.components[action.componentType].defaultProps || {}), {
|
75172
|
+
id: action.id || generateId(action.componentType)
|
75173
|
+
})
|
75174
|
+
};
|
75175
|
+
if (action.destinationZone === rootDroppableId2) {
|
74998
75176
|
return __spreadProps2(__spreadValues2({}, data), {
|
74999
|
-
|
75000
|
-
|
75001
|
-
|
75002
|
-
|
75003
|
-
|
75004
|
-
)
|
75005
|
-
})
|
75177
|
+
content: insert(
|
75178
|
+
data.content,
|
75179
|
+
action.destinationIndex,
|
75180
|
+
emptyComponentData
|
75181
|
+
)
|
75006
75182
|
});
|
75007
75183
|
}
|
75184
|
+
const newData = setupZone2(data, action.destinationZone);
|
75185
|
+
return __spreadProps2(__spreadValues2({}, data), {
|
75186
|
+
zones: __spreadProps2(__spreadValues2({}, newData.zones), {
|
75187
|
+
[action.destinationZone]: insert(
|
75188
|
+
newData.zones[action.destinationZone],
|
75189
|
+
action.destinationIndex,
|
75190
|
+
emptyComponentData
|
75191
|
+
)
|
75192
|
+
})
|
75193
|
+
});
|
75194
|
+
};
|
75195
|
+
var reduceData = (data, action, config) => {
|
75196
|
+
if (action.type === "insert") {
|
75197
|
+
return insertAction(data, action, config);
|
75198
|
+
}
|
75008
75199
|
if (action.type === "duplicate") {
|
75009
75200
|
const item = getItem2(
|
75010
75201
|
{ index: action.sourceIndex, zone: action.sourceZone },
|
@@ -75219,19 +75410,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75219
75410
|
return appState;
|
75220
75411
|
};
|
75221
75412
|
init_react_import2();
|
75222
|
-
var
|
75223
|
-
init_react_import2();
|
75413
|
+
var import_react20 = require("react");
|
75224
75414
|
init_react_import2();
|
75225
|
-
var
|
75226
|
-
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
75227
|
-
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
75228
|
-
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
75229
|
-
return __spreadProps2(__spreadValues2({}, acc), {
|
75230
|
-
[item]: oldItemProps[item] !== newItemProps[item]
|
75231
|
-
});
|
75232
|
-
}, {}) : {};
|
75233
|
-
};
|
75234
|
-
var cache = { lastChange: {} };
|
75415
|
+
var cache2 = { lastChange: {} };
|
75235
75416
|
var resolveAllComponentData = (content, config, onResolveStart, onResolveEnd) => __async2(void 0, null, function* () {
|
75236
75417
|
return yield Promise.all(
|
75237
75418
|
content.map((item) => __async2(void 0, null, function* () {
|
@@ -75247,7 +75428,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75247
75428
|
var resolveComponentData = (item, config, onResolveStart, onResolveEnd) => __async2(void 0, null, function* () {
|
75248
75429
|
const configForItem = config.components[item.type];
|
75249
75430
|
if (configForItem.resolveData) {
|
75250
|
-
const { item: oldItem = {}, resolved = {} } =
|
75431
|
+
const { item: oldItem = {}, resolved = {} } = cache2.lastChange[item.props.id] || {};
|
75251
75432
|
if (item && item === oldItem) {
|
75252
75433
|
return resolved;
|
75253
75434
|
}
|
@@ -75264,7 +75445,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75264
75445
|
if (Object.keys(newReadOnly).length) {
|
75265
75446
|
resolvedItem.readOnly = newReadOnly;
|
75266
75447
|
}
|
75267
|
-
|
75448
|
+
cache2.lastChange[item.props.id] = {
|
75268
75449
|
item,
|
75269
75450
|
resolved: resolvedItem
|
75270
75451
|
};
|
@@ -75292,20 +75473,20 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75292
75473
|
});
|
75293
75474
|
};
|
75294
75475
|
init_react_import2();
|
75295
|
-
var
|
75476
|
+
var cache3 = {};
|
75296
75477
|
var resolveRootData = (data, config) => __async2(void 0, null, function* () {
|
75297
75478
|
var _a3, _b2, _c, _d, _e;
|
75298
75479
|
if (((_a3 = config.root) == null ? void 0 : _a3.resolveData) && data.root.props) {
|
75299
|
-
if (((_b2 =
|
75300
|
-
return
|
75480
|
+
if (((_b2 = cache3.lastChange) == null ? void 0 : _b2.original) === data.root) {
|
75481
|
+
return cache3.lastChange.resolved;
|
75301
75482
|
}
|
75302
|
-
const changed = getChanged(data.root, (_c =
|
75483
|
+
const changed = getChanged(data.root, (_c = cache3.lastChange) == null ? void 0 : _c.original);
|
75303
75484
|
const rootWithProps = data.root;
|
75304
75485
|
const resolvedRoot = yield (_e = config.root) == null ? void 0 : _e.resolveData(rootWithProps, {
|
75305
75486
|
changed,
|
75306
|
-
lastData: ((_d =
|
75487
|
+
lastData: ((_d = cache3.lastChange) == null ? void 0 : _d.original) || {}
|
75307
75488
|
});
|
75308
|
-
|
75489
|
+
cache3.lastChange = {
|
75309
75490
|
original: data.root,
|
75310
75491
|
resolved: resolvedRoot
|
75311
75492
|
};
|
@@ -75316,13 +75497,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75316
75497
|
return data.root;
|
75317
75498
|
});
|
75318
75499
|
var useResolvedData = (appState, config, dispatch) => {
|
75319
|
-
const [{ resolverKey, newAppState }, setResolverState] = (0,
|
75500
|
+
const [{ resolverKey, newAppState }, setResolverState] = (0, import_react20.useState)({
|
75320
75501
|
resolverKey: 0,
|
75321
75502
|
newAppState: appState
|
75322
75503
|
});
|
75323
|
-
const [componentState, setComponentState] = (0,
|
75504
|
+
const [componentState, setComponentState] = (0, import_react20.useState)({});
|
75324
75505
|
const deferredSetStates = {};
|
75325
|
-
const setComponentLoading = (0,
|
75506
|
+
const setComponentLoading = (0, import_react20.useCallback)(
|
75326
75507
|
(id, loading, defer2 = 0) => {
|
75327
75508
|
if (deferredSetStates[id]) {
|
75328
75509
|
clearTimeout(deferredSetStates[id]);
|
@@ -75392,10 +75573,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75392
75573
|
});
|
75393
75574
|
yield Promise.all(promises);
|
75394
75575
|
});
|
75395
|
-
(0,
|
75576
|
+
(0, import_react20.useEffect)(() => {
|
75396
75577
|
runResolvers();
|
75397
75578
|
}, [resolverKey]);
|
75398
|
-
const resolveData = (0,
|
75579
|
+
const resolveData = (0, import_react20.useCallback)((newAppState2 = appState) => {
|
75399
75580
|
setResolverState((curr) => ({
|
75400
75581
|
resolverKey: curr.resolverKey + 1,
|
75401
75582
|
newAppState: newAppState2
|
@@ -75408,9 +75589,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75408
75589
|
};
|
75409
75590
|
init_react_import2();
|
75410
75591
|
init_react_import2();
|
75411
|
-
var
|
75412
|
-
var
|
75413
|
-
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);
|
75414
75595
|
var MenuBar = ({
|
75415
75596
|
appState,
|
75416
75597
|
data = { content: [], root: {} },
|
@@ -75424,10 +75605,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75424
75605
|
history: { back, forward, historyStore }
|
75425
75606
|
} = useAppContext2();
|
75426
75607
|
const { hasFuture = false, hasPast = false } = historyStore || {};
|
75427
|
-
return /* @__PURE__ */ (0,
|
75608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
75428
75609
|
"div",
|
75429
75610
|
{
|
75430
|
-
className:
|
75611
|
+
className: getClassName20({ menuOpen }),
|
75431
75612
|
onClick: (event) => {
|
75432
75613
|
var _a3;
|
75433
75614
|
const element = event.target;
|
@@ -75438,12 +75619,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75438
75619
|
setMenuOpen(false);
|
75439
75620
|
}
|
75440
75621
|
},
|
75441
|
-
children: /* @__PURE__ */ (0,
|
75442
|
-
/* @__PURE__ */ (0,
|
75443
|
-
/* @__PURE__ */ (0,
|
75444
|
-
/* @__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 }) })
|
75445
75626
|
] }),
|
75446
|
-
/* @__PURE__ */ (0,
|
75627
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: renderHeaderActions && renderHeaderActions({
|
75447
75628
|
state: appState,
|
75448
75629
|
dispatch
|
75449
75630
|
}) })
|
@@ -75452,20 +75633,20 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75452
75633
|
);
|
75453
75634
|
};
|
75454
75635
|
init_react_import2();
|
75455
|
-
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" };
|
75456
75637
|
init_react_import2();
|
75457
75638
|
init_react_import2();
|
75458
|
-
var
|
75459
|
-
var
|
75460
|
-
var
|
75461
|
-
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);
|
75462
75643
|
var defaultPageFields = {
|
75463
75644
|
title: { type: "text" }
|
75464
75645
|
};
|
75465
75646
|
var DefaultFields = ({
|
75466
75647
|
children
|
75467
75648
|
}) => {
|
75468
|
-
return /* @__PURE__ */ (0,
|
75649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children });
|
75469
75650
|
};
|
75470
75651
|
var useResolvedFields = () => {
|
75471
75652
|
var _a3;
|
@@ -75475,14 +75656,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75475
75656
|
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
75476
75657
|
const defaultFields = selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields;
|
75477
75658
|
const rootProps = data.root.props || data.root;
|
75478
|
-
const [lastSelectedData, setLastSelectedData] = (0,
|
75659
|
+
const [lastSelectedData, setLastSelectedData] = (0, import_react21.useState)(
|
75479
75660
|
{}
|
75480
75661
|
);
|
75481
|
-
const [resolvedFields, setResolvedFields] = (0,
|
75482
|
-
const [fieldsLoading, setFieldsLoading] = (0,
|
75662
|
+
const [resolvedFields, setResolvedFields] = (0, import_react21.useState)(defaultFields || {});
|
75663
|
+
const [fieldsLoading, setFieldsLoading] = (0, import_react21.useState)(false);
|
75483
75664
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
75484
75665
|
const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
|
75485
|
-
const resolveFields = (0,
|
75666
|
+
const resolveFields = (0, import_react21.useCallback)(
|
75486
75667
|
(..._0) => __async2(void 0, [..._0], function* (fields = {}) {
|
75487
75668
|
var _a22, _b2, _c;
|
75488
75669
|
const lastData = ((_a22 = lastSelectedData.props) == null ? void 0 : _a22.id) === componentData.props.id ? lastSelectedData : {};
|
@@ -75518,7 +75699,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75518
75699
|
}),
|
75519
75700
|
[data, config, componentData, selectedItem, resolvedFields, state]
|
75520
75701
|
);
|
75521
|
-
(0,
|
75702
|
+
(0, import_react21.useEffect)(() => {
|
75522
75703
|
setFieldsLoading(true);
|
75523
75704
|
resolveFields(defaultFields).then((fields) => {
|
75524
75705
|
setResolvedFields(fields || {});
|
@@ -75536,7 +75717,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75536
75717
|
config,
|
75537
75718
|
resolveData,
|
75538
75719
|
componentState,
|
75539
|
-
overrides
|
75720
|
+
overrides,
|
75721
|
+
globalPermissions
|
75540
75722
|
} = useAppContext2();
|
75541
75723
|
const { data, ui } = state;
|
75542
75724
|
const { itemSelector } = ui;
|
@@ -75544,16 +75726,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75544
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;
|
75545
75727
|
const isLoading = fieldsResolving || componentResolving;
|
75546
75728
|
const rootProps = data.root.props || data.root;
|
75547
|
-
const Wrapper = (0,
|
75548
|
-
return /* @__PURE__ */ (0,
|
75729
|
+
const Wrapper = (0, import_react21.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
75730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
75549
75731
|
"form",
|
75550
75732
|
{
|
75551
|
-
className:
|
75733
|
+
className: getClassName21(),
|
75552
75734
|
onSubmit: (e2) => {
|
75553
75735
|
e2.preventDefault();
|
75554
75736
|
},
|
75555
75737
|
children: [
|
75556
|
-
/* @__PURE__ */ (0,
|
75738
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
|
75557
75739
|
const field = fields[fieldName];
|
75558
75740
|
if (!(field == null ? void 0 : field.type)) return null;
|
75559
75741
|
const onChange = (value, updatedUi) => {
|
@@ -75620,13 +75802,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75620
75802
|
};
|
75621
75803
|
if (selectedItem && itemSelector) {
|
75622
75804
|
const { readOnly = {} } = selectedItem;
|
75623
|
-
|
75805
|
+
const { edit } = getPermissions({
|
75806
|
+
selectedItem,
|
75807
|
+
config,
|
75808
|
+
globalPermissions: globalPermissions || {},
|
75809
|
+
appState: state
|
75810
|
+
});
|
75811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
75624
75812
|
AutoFieldPrivate,
|
75625
75813
|
{
|
75626
75814
|
field,
|
75627
75815
|
name: fieldName,
|
75628
75816
|
id: `${selectedItem.props.id}_${fieldName}`,
|
75629
|
-
readOnly: readOnly[fieldName],
|
75817
|
+
readOnly: !edit || readOnly[fieldName],
|
75630
75818
|
value: selectedItem.props[fieldName],
|
75631
75819
|
onChange
|
75632
75820
|
},
|
@@ -75634,7 +75822,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75634
75822
|
);
|
75635
75823
|
} else {
|
75636
75824
|
const { readOnly = {} } = data.root;
|
75637
|
-
return /* @__PURE__ */ (0,
|
75825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
75638
75826
|
AutoFieldPrivate,
|
75639
75827
|
{
|
75640
75828
|
field,
|
@@ -75648,26 +75836,41 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75648
75836
|
);
|
75649
75837
|
}
|
75650
75838
|
}) }),
|
75651
|
-
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 }) }) })
|
75652
75840
|
]
|
75653
75841
|
}
|
75654
75842
|
);
|
75655
75843
|
};
|
75656
75844
|
init_react_import2();
|
75657
75845
|
init_react_import2();
|
75658
|
-
var
|
75846
|
+
var import_react222 = require("react");
|
75659
75847
|
init_react_import2();
|
75660
75848
|
init_react_import2();
|
75661
|
-
var
|
75662
|
-
var
|
75663
|
-
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);
|
75664
75852
|
var ComponentListItem = ({
|
75665
75853
|
name,
|
75666
75854
|
label,
|
75667
75855
|
index
|
75668
75856
|
}) => {
|
75669
|
-
const { overrides } = useAppContext2();
|
75670
|
-
|
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
|
+
);
|
75671
75874
|
};
|
75672
75875
|
var ComponentList = ({
|
75673
75876
|
children,
|
@@ -75676,11 +75879,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75676
75879
|
}) => {
|
75677
75880
|
const { config, state, setUi } = useAppContext2();
|
75678
75881
|
const { expanded = true } = state.ui.componentList[id] || {};
|
75679
|
-
return /* @__PURE__ */ (0,
|
75680
|
-
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)(
|
75681
75884
|
"button",
|
75682
75885
|
{
|
75683
|
-
className:
|
75886
|
+
className: getClassName222("title"),
|
75684
75887
|
onClick: () => setUi({
|
75685
75888
|
componentList: __spreadProps2(__spreadValues2({}, state.ui.componentList), {
|
75686
75889
|
[id]: __spreadProps2(__spreadValues2({}, state.ui.componentList[id]), {
|
@@ -75690,14 +75893,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75690
75893
|
}),
|
75691
75894
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
75692
75895
|
children: [
|
75693
|
-
/* @__PURE__ */ (0,
|
75694
|
-
/* @__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 }) })
|
75695
75898
|
]
|
75696
75899
|
}
|
75697
75900
|
),
|
75698
|
-
/* @__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) => {
|
75699
75902
|
var _a3;
|
75700
|
-
return /* @__PURE__ */ (0,
|
75903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
75701
75904
|
ComponentListItem,
|
75702
75905
|
{
|
75703
75906
|
label: (_a3 = config.components[componentKey]["label"]) != null ? _a3 : componentKey,
|
@@ -75710,10 +75913,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75710
75913
|
] });
|
75711
75914
|
};
|
75712
75915
|
ComponentList.Item = ComponentListItem;
|
75713
|
-
var
|
75916
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
75714
75917
|
var useComponentList = (config, ui) => {
|
75715
|
-
const [componentList, setComponentList] = (0,
|
75716
|
-
(0,
|
75918
|
+
const [componentList, setComponentList] = (0, import_react222.useState)();
|
75919
|
+
(0, import_react222.useEffect)(() => {
|
75717
75920
|
var _a3, _b2, _c;
|
75718
75921
|
if (Object.keys(ui.componentList).length > 0) {
|
75719
75922
|
const matchedComponents = [];
|
@@ -75723,7 +75926,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75723
75926
|
if (category.visible === false || !category.components) {
|
75724
75927
|
return null;
|
75725
75928
|
}
|
75726
|
-
return /* @__PURE__ */ (0,
|
75929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
75727
75930
|
ComponentList,
|
75728
75931
|
{
|
75729
75932
|
id: categoryKey,
|
@@ -75732,7 +75935,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75732
75935
|
var _a22;
|
75733
75936
|
matchedComponents.push(componentName);
|
75734
75937
|
const componentConf = config.components[componentName] || {};
|
75735
|
-
return /* @__PURE__ */ (0,
|
75938
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
75736
75939
|
ComponentList.Item,
|
75737
75940
|
{
|
75738
75941
|
label: (_a22 = componentConf["label"]) != null ? _a22 : componentName,
|
@@ -75752,7 +75955,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75752
75955
|
);
|
75753
75956
|
if (remainingComponents.length > 0 && !((_a3 = ui.componentList.other) == null ? void 0 : _a3.components) && ((_b2 = ui.componentList.other) == null ? void 0 : _b2.visible) !== false) {
|
75754
75957
|
_componentList.push(
|
75755
|
-
/* @__PURE__ */ (0,
|
75958
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
75756
75959
|
ComponentList,
|
75757
75960
|
{
|
75758
75961
|
id: "other",
|
@@ -75760,7 +75963,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75760
75963
|
children: remainingComponents.map((componentName, i2) => {
|
75761
75964
|
var _a22;
|
75762
75965
|
const componentConf = config.components[componentName] || {};
|
75763
|
-
return /* @__PURE__ */ (0,
|
75966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
75764
75967
|
ComponentList.Item,
|
75765
75968
|
{
|
75766
75969
|
name: componentName,
|
@@ -75780,21 +75983,21 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75780
75983
|
}, [config.categories, config.components, ui.componentList]);
|
75781
75984
|
return componentList;
|
75782
75985
|
};
|
75783
|
-
var
|
75784
|
-
var
|
75986
|
+
var import_react23 = require("react");
|
75987
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
75785
75988
|
var Components = () => {
|
75786
75989
|
const { config, state, overrides } = useAppContext2();
|
75787
75990
|
const componentList = useComponentList(config, state.ui);
|
75788
|
-
const Wrapper = (0,
|
75789
|
-
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" }) });
|
75790
75993
|
};
|
75791
75994
|
init_react_import2();
|
75792
|
-
var
|
75995
|
+
var import_react25 = require("react");
|
75793
75996
|
init_react_import2();
|
75794
|
-
var
|
75997
|
+
var import_react24 = __toESM2(require("react"));
|
75795
75998
|
var import_react_frame_component = __toESM2(require_lib());
|
75796
75999
|
var import_object_hash = __toESM2(require_object_hash());
|
75797
|
-
var
|
76000
|
+
var import_jsx_runtime322 = require("react/jsx-runtime");
|
75798
76001
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
75799
76002
|
var collectStyles = (doc) => {
|
75800
76003
|
const collected = [];
|
@@ -75837,7 +76040,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75837
76040
|
onStylesLoaded = () => null
|
75838
76041
|
}) => {
|
75839
76042
|
const { document: doc, window: win } = (0, import_react_frame_component.useFrame)();
|
75840
|
-
(0,
|
76043
|
+
(0, import_react24.useEffect)(() => {
|
75841
76044
|
if (!win || !doc) {
|
75842
76045
|
return () => {
|
75843
76046
|
};
|
@@ -75994,23 +76197,24 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75994
76197
|
observer.disconnect();
|
75995
76198
|
};
|
75996
76199
|
}, []);
|
75997
|
-
return /* @__PURE__ */ (0,
|
76200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(import_jsx_runtime322.Fragment, { children });
|
75998
76201
|
};
|
75999
|
-
var AutoFrameComponent =
|
76202
|
+
var AutoFrameComponent = import_react24.default.forwardRef(
|
76000
76203
|
function(_a3, ref2) {
|
76001
76204
|
var _b2 = _a3, { children, debug, onStylesLoaded } = _b2, props = __objRest2(_b2, ["children", "debug", "onStylesLoaded"]);
|
76002
|
-
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 }) }));
|
76003
76206
|
}
|
76004
76207
|
);
|
76005
76208
|
AutoFrameComponent.displayName = "AutoFrameComponent";
|
76006
76209
|
var AutoFrame_default = AutoFrameComponent;
|
76007
76210
|
init_react_import2();
|
76008
|
-
var
|
76009
|
-
var
|
76010
|
-
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);
|
76011
76215
|
var Preview = ({ id = "puck-preview" }) => {
|
76012
|
-
const { config, dispatch, state, setStatus, iframe } = useAppContext2();
|
76013
|
-
const Page = (0,
|
76216
|
+
const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext2();
|
76217
|
+
const Page = (0, import_react25.useCallback)(
|
76014
76218
|
(pageProps) => {
|
76015
76219
|
var _a3, _b2;
|
76016
76220
|
return ((_a3 = config.root) == null ? void 0 : _a3.render) ? (_b2 = config.root) == null ? void 0 : _b2.render(__spreadProps2(__spreadValues2({
|
@@ -76019,33 +76223,36 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76019
76223
|
editMode: true,
|
76020
76224
|
// DEPRECATED
|
76021
76225
|
puck: { renderDropZone: DropZone, isEditing: true }
|
76022
|
-
})) : /* @__PURE__ */ (0,
|
76226
|
+
})) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: pageProps.children });
|
76023
76227
|
},
|
76024
76228
|
[config.root]
|
76025
76229
|
);
|
76230
|
+
const Frame2 = (0, import_react25.useMemo)(() => overrides.iframe || "div", [overrides]);
|
76026
76231
|
const rootProps = state.data.root.props || state.data.root;
|
76027
|
-
const ref2 = (0,
|
76028
|
-
return /* @__PURE__ */ (0,
|
76232
|
+
const ref2 = (0, import_react25.useRef)(null);
|
76233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
76029
76234
|
"div",
|
76030
76235
|
{
|
76031
|
-
className:
|
76236
|
+
className: getClassName23(),
|
76032
76237
|
id,
|
76033
76238
|
onClick: () => {
|
76034
76239
|
dispatch({ type: "setUi", ui: __spreadProps2(__spreadValues2({}, state.ui), { itemSelector: null }) });
|
76035
76240
|
},
|
76036
|
-
children: iframe.enabled ? /* @__PURE__ */ (0,
|
76241
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
76037
76242
|
AutoFrame_default,
|
76038
76243
|
{
|
76039
76244
|
id: "preview-frame",
|
76040
|
-
className:
|
76245
|
+
className: getClassName23("frame"),
|
76041
76246
|
"data-rfd-iframe": true,
|
76042
76247
|
ref: ref2,
|
76043
76248
|
onStylesLoaded: () => {
|
76044
76249
|
setStatus("READY");
|
76045
76250
|
},
|
76046
|
-
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
|
+
} })
|
76047
76254
|
}
|
76048
|
-
) : /* @__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 }) })) })
|
76049
76256
|
}
|
76050
76257
|
);
|
76051
76258
|
};
|
@@ -76067,7 +76274,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76067
76274
|
};
|
76068
76275
|
init_react_import2();
|
76069
76276
|
init_react_import2();
|
76070
|
-
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" };
|
76071
76278
|
init_react_import2();
|
76072
76279
|
var scrollIntoView2 = (el) => {
|
76073
76280
|
const oldStyle = __spreadValues2({}, el.style);
|
@@ -76077,7 +76284,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76077
76284
|
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
76078
76285
|
}
|
76079
76286
|
};
|
76080
|
-
var
|
76287
|
+
var import_react26 = require("react");
|
76081
76288
|
init_react_import2();
|
76082
76289
|
var isChildOfZone = (item, maybeChild, ctx) => {
|
76083
76290
|
var _a3;
|
@@ -76087,9 +76294,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76087
76294
|
return area === item.props.id;
|
76088
76295
|
})) : false;
|
76089
76296
|
};
|
76090
|
-
var
|
76091
|
-
var
|
76092
|
-
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);
|
76093
76300
|
var LayerTree = ({
|
76094
76301
|
data,
|
76095
76302
|
config,
|
@@ -76100,15 +76307,15 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76100
76307
|
label
|
76101
76308
|
}) => {
|
76102
76309
|
const zones = data.zones || {};
|
76103
|
-
const ctx = (0,
|
76104
|
-
return /* @__PURE__ */ (0,
|
76105
|
-
label && /* @__PURE__ */ (0,
|
76106
|
-
/* @__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" }) }),
|
76107
76314
|
" ",
|
76108
76315
|
label
|
76109
76316
|
] }),
|
76110
|
-
/* @__PURE__ */ (0,
|
76111
|
-
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" }),
|
76112
76319
|
zoneContent.map((item, i2) => {
|
76113
76320
|
var _a3;
|
76114
76321
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i2 && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId2 && !zone);
|
@@ -76126,7 +76333,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76126
76333
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
76127
76334
|
const componentConfig = config.components[item.type];
|
76128
76335
|
const label2 = (_a3 = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a3 : item.type.toString();
|
76129
|
-
return /* @__PURE__ */ (0,
|
76336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
76130
76337
|
"li",
|
76131
76338
|
{
|
76132
76339
|
className: getClassNameLayer({
|
@@ -76136,7 +76343,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76136
76343
|
childIsSelected
|
76137
76344
|
}),
|
76138
76345
|
children: [
|
76139
|
-
/* @__PURE__ */ (0,
|
76346
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
76140
76347
|
"button",
|
76141
76348
|
{
|
76142
76349
|
className: getClassNameLayer("clickable"),
|
@@ -76168,22 +76375,22 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76168
76375
|
setHoveringComponent(null);
|
76169
76376
|
},
|
76170
76377
|
children: [
|
76171
|
-
containsZone && /* @__PURE__ */ (0,
|
76378
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
76172
76379
|
"div",
|
76173
76380
|
{
|
76174
76381
|
className: getClassNameLayer("chevron"),
|
76175
76382
|
title: isSelected ? "Collapse" : "Expand",
|
76176
|
-
children: /* @__PURE__ */ (0,
|
76383
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { size: "12" })
|
76177
76384
|
}
|
76178
76385
|
),
|
76179
|
-
/* @__PURE__ */ (0,
|
76180
|
-
/* @__PURE__ */ (0,
|
76181
|
-
/* @__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 })
|
76182
76389
|
] })
|
76183
76390
|
]
|
76184
76391
|
}
|
76185
76392
|
) }),
|
76186
|
-
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)(
|
76187
76394
|
LayerTree,
|
76188
76395
|
{
|
76189
76396
|
config,
|
@@ -76203,13 +76410,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76203
76410
|
] })
|
76204
76411
|
] });
|
76205
76412
|
};
|
76206
|
-
var
|
76207
|
-
var
|
76413
|
+
var import_react27 = require("react");
|
76414
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
76208
76415
|
var Outline = () => {
|
76209
76416
|
const { dispatch, state, overrides, config } = useAppContext2();
|
76210
76417
|
const { data, ui } = state;
|
76211
76418
|
const { itemSelector } = ui;
|
76212
|
-
const setItemSelector = (0,
|
76419
|
+
const setItemSelector = (0, import_react27.useCallback)(
|
76213
76420
|
(newItemSelector) => {
|
76214
76421
|
dispatch({
|
76215
76422
|
type: "setUi",
|
@@ -76218,9 +76425,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76218
76425
|
},
|
76219
76426
|
[]
|
76220
76427
|
);
|
76221
|
-
const Wrapper = (0,
|
76222
|
-
return /* @__PURE__ */ (0,
|
76223
|
-
(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)(
|
76224
76431
|
LayerTree,
|
76225
76432
|
{
|
76226
76433
|
config,
|
@@ -76233,7 +76440,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76233
76440
|
),
|
76234
76441
|
Object.entries(findZonesForArea(data, "root")).map(
|
76235
76442
|
([zoneKey, zone]) => {
|
76236
|
-
return /* @__PURE__ */ (0,
|
76443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
76237
76444
|
LayerTree,
|
76238
76445
|
{
|
76239
76446
|
config,
|
@@ -76251,35 +76458,6 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76251
76458
|
] }) }) });
|
76252
76459
|
};
|
76253
76460
|
init_react_import2();
|
76254
|
-
var loadOverrides = ({
|
76255
|
-
overrides,
|
76256
|
-
plugins
|
76257
|
-
}) => {
|
76258
|
-
const collected = __spreadValues2({}, overrides);
|
76259
|
-
plugins.forEach((plugin) => {
|
76260
|
-
Object.keys(plugin.overrides).forEach((overridesType) => {
|
76261
|
-
if (overridesType === "fieldTypes") {
|
76262
|
-
const fieldTypes = plugin.overrides.fieldTypes;
|
76263
|
-
Object.keys(fieldTypes).forEach((fieldType) => {
|
76264
|
-
collected.fieldTypes = collected.fieldTypes || {};
|
76265
|
-
const childNode2 = collected.fieldTypes[fieldType];
|
76266
|
-
const Comp2 = (props) => fieldTypes[fieldType](__spreadProps2(__spreadValues2({}, props), {
|
76267
|
-
children: childNode2 ? childNode2(props) : props.children
|
76268
|
-
}));
|
76269
|
-
collected.fieldTypes[fieldType] = Comp2;
|
76270
|
-
});
|
76271
|
-
return;
|
76272
|
-
}
|
76273
|
-
const childNode = collected[overridesType];
|
76274
|
-
const Comp = (props) => plugin.overrides[overridesType](__spreadProps2(__spreadValues2({}, props), {
|
76275
|
-
children: childNode ? childNode(props) : props.children
|
76276
|
-
}));
|
76277
|
-
collected[overridesType] = Comp;
|
76278
|
-
});
|
76279
|
-
});
|
76280
|
-
return collected;
|
76281
|
-
};
|
76282
|
-
init_react_import2();
|
76283
76461
|
var import_react_hotkeys_hook = (init_react_hotkeys_hook_esm(), __toCommonJS(react_hotkeys_hook_esm_exports));
|
76284
76462
|
function usePuckHistory({
|
76285
76463
|
dispatch,
|
@@ -76332,19 +76510,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76332
76510
|
};
|
76333
76511
|
}
|
76334
76512
|
init_react_import2();
|
76335
|
-
var
|
76513
|
+
var import_react28 = require("react");
|
76336
76514
|
var import_use_debounce3 = (init_index_module(), __toCommonJS(index_module_exports));
|
76337
76515
|
var EMPTY_HISTORY_INDEX = -1;
|
76338
76516
|
function useHistoryStore(initialHistory) {
|
76339
76517
|
var _a3, _b2;
|
76340
|
-
const [histories, setHistories] = (0,
|
76518
|
+
const [histories, setHistories] = (0, import_react28.useState)(
|
76341
76519
|
(_a3 = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a3 : []
|
76342
76520
|
);
|
76343
76521
|
const updateHistories = (histories2) => {
|
76344
76522
|
setHistories(histories2);
|
76345
76523
|
setIndex(histories2.length - 1);
|
76346
76524
|
};
|
76347
|
-
const [index, setIndex] = (0,
|
76525
|
+
const [index, setIndex] = (0, import_react28.useState)(
|
76348
76526
|
(_b2 = initialHistory == null ? void 0 : initialHistory.index) != null ? _b2 : EMPTY_HISTORY_INDEX
|
76349
76527
|
);
|
76350
76528
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
@@ -76494,19 +76672,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76494
76672
|
var styles = window.getComputedStyle(el);
|
76495
76673
|
return calculateBox3(borderBox, styles);
|
76496
76674
|
};
|
76497
|
-
var
|
76675
|
+
var import_react30 = require("react");
|
76498
76676
|
init_react_import2();
|
76499
|
-
var
|
76677
|
+
var import_react29 = require("react");
|
76500
76678
|
init_react_import2();
|
76501
|
-
var
|
76502
|
-
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");
|
76503
76681
|
var icons = {
|
76504
|
-
Smartphone: /* @__PURE__ */ (0,
|
76505
|
-
Tablet: /* @__PURE__ */ (0,
|
76506
|
-
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 })
|
76507
76685
|
};
|
76508
|
-
var
|
76509
|
-
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);
|
76510
76688
|
var ViewportButton = ({
|
76511
76689
|
children,
|
76512
76690
|
height = "auto",
|
@@ -76515,11 +76693,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76515
76693
|
onClick
|
76516
76694
|
}) => {
|
76517
76695
|
const { state } = useAppContext2();
|
76518
|
-
const [isActive2, setIsActive] = (0,
|
76519
|
-
(0,
|
76696
|
+
const [isActive2, setIsActive] = (0, import_react29.useState)(false);
|
76697
|
+
(0, import_react29.useEffect)(() => {
|
76520
76698
|
setIsActive(width === state.ui.viewports.current.width);
|
76521
76699
|
}, [width, state.ui.viewports.current.width]);
|
76522
|
-
return /* @__PURE__ */ (0,
|
76700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton({ isActive: isActive2 }), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76523
76701
|
IconButton,
|
76524
76702
|
{
|
76525
76703
|
title,
|
@@ -76528,7 +76706,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76528
76706
|
e2.stopPropagation();
|
76529
76707
|
onClick({ width, height });
|
76530
76708
|
},
|
76531
|
-
children: /* @__PURE__ */ (0,
|
76709
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton("inner"), children })
|
76532
76710
|
}
|
76533
76711
|
) });
|
76534
76712
|
};
|
@@ -76552,7 +76730,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76552
76730
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
76553
76731
|
(option) => option.value === autoZoom
|
76554
76732
|
);
|
76555
|
-
const zoomOptions = (0,
|
76733
|
+
const zoomOptions = (0, import_react29.useMemo)(
|
76556
76734
|
() => [
|
76557
76735
|
...defaultZoomOptions,
|
76558
76736
|
...defaultsContainAutoZoom ? [] : [
|
@@ -76564,8 +76742,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76564
76742
|
].filter((a2) => a2.value <= autoZoom).sort((a2, b) => a2.value > b.value ? 1 : -1),
|
76565
76743
|
[autoZoom]
|
76566
76744
|
);
|
76567
|
-
return /* @__PURE__ */ (0,
|
76568
|
-
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)(
|
76569
76747
|
ViewportButton,
|
76570
76748
|
{
|
76571
76749
|
height: viewport.height,
|
@@ -76576,8 +76754,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76576
76754
|
},
|
76577
76755
|
i2
|
76578
76756
|
)),
|
76579
|
-
/* @__PURE__ */ (0,
|
76580
|
-
/* @__PURE__ */ (0,
|
76757
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
|
76758
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76581
76759
|
IconButton,
|
76582
76760
|
{
|
76583
76761
|
title: "Zoom viewport out",
|
@@ -76591,10 +76769,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76591
76769
|
)].value
|
76592
76770
|
);
|
76593
76771
|
},
|
76594
|
-
children: /* @__PURE__ */ (0,
|
76772
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomOut, { size: 16 })
|
76595
76773
|
}
|
76596
76774
|
),
|
76597
|
-
/* @__PURE__ */ (0,
|
76775
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76598
76776
|
IconButton,
|
76599
76777
|
{
|
76600
76778
|
title: "Zoom viewport in",
|
@@ -76608,19 +76786,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76608
76786
|
)].value
|
76609
76787
|
);
|
76610
76788
|
},
|
76611
|
-
children: /* @__PURE__ */ (0,
|
76789
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomIn, { size: 16 })
|
76612
76790
|
}
|
76613
76791
|
),
|
76614
|
-
/* @__PURE__ */ (0,
|
76615
|
-
/* @__PURE__ */ (0,
|
76792
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
|
76793
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76616
76794
|
"select",
|
76617
76795
|
{
|
76618
|
-
className:
|
76796
|
+
className: getClassName25("zoomSelect"),
|
76619
76797
|
value: zoom.toString(),
|
76620
76798
|
onChange: (e2) => {
|
76621
76799
|
onZoom(parseFloat(e2.currentTarget.value));
|
76622
76800
|
},
|
76623
|
-
children: zoomOptions.map((option) => /* @__PURE__ */ (0,
|
76801
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76624
76802
|
"option",
|
76625
76803
|
{
|
76626
76804
|
value: option.value,
|
@@ -76633,7 +76811,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76633
76811
|
] });
|
76634
76812
|
};
|
76635
76813
|
init_react_import2();
|
76636
|
-
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" };
|
76637
76815
|
init_react_import2();
|
76638
76816
|
var RESET_ZOOM_SMALLER_THAN_FRAME = true;
|
76639
76817
|
var getZoomConfig = (uiViewport, frame, zoom) => {
|
@@ -76662,24 +76840,24 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76662
76840
|
}
|
76663
76841
|
return { autoZoom, rootHeight, zoom };
|
76664
76842
|
};
|
76665
|
-
var
|
76666
|
-
var
|
76843
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
76844
|
+
var getClassName26 = get_class_name_factory_default2("PuckCanvas", styles_module_default21);
|
76667
76845
|
var ZOOM_ON_CHANGE = true;
|
76668
76846
|
var Canvas = () => {
|
76669
76847
|
const { status, iframe } = useAppContext2();
|
76670
76848
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext2();
|
76671
76849
|
const { ui } = state;
|
76672
|
-
const frameRef = (0,
|
76673
|
-
const [showTransition, setShowTransition] = (0,
|
76674
|
-
const defaultRender = (0,
|
76675
|
-
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 });
|
76676
76854
|
return PuckDefault;
|
76677
76855
|
}, []);
|
76678
|
-
const CustomPreview = (0,
|
76856
|
+
const CustomPreview = (0, import_react30.useMemo)(
|
76679
76857
|
() => overrides.preview || defaultRender,
|
76680
76858
|
[overrides]
|
76681
76859
|
);
|
76682
|
-
const getFrameDimensions = (0,
|
76860
|
+
const getFrameDimensions = (0, import_react30.useCallback)(() => {
|
76683
76861
|
if (frameRef.current) {
|
76684
76862
|
const frame = frameRef.current;
|
76685
76863
|
const box = getBox3(frame);
|
@@ -76687,7 +76865,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76687
76865
|
}
|
76688
76866
|
return { width: 0, height: 0 };
|
76689
76867
|
}, [frameRef]);
|
76690
|
-
const resetAutoZoom = (0,
|
76868
|
+
const resetAutoZoom = (0, import_react30.useCallback)(
|
76691
76869
|
(ui2 = state.ui) => {
|
76692
76870
|
if (frameRef.current) {
|
76693
76871
|
setZoomConfig(
|
@@ -76697,11 +76875,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76697
76875
|
},
|
76698
76876
|
[frameRef, zoomConfig, state.ui]
|
76699
76877
|
);
|
76700
|
-
(0,
|
76878
|
+
(0, import_react30.useEffect)(() => {
|
76701
76879
|
setShowTransition(false);
|
76702
76880
|
resetAutoZoom();
|
76703
76881
|
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
76704
|
-
(0,
|
76882
|
+
(0, import_react30.useEffect)(() => {
|
76705
76883
|
const { height: frameHeight } = getFrameDimensions();
|
76706
76884
|
if (ui.viewports.current.height === "auto") {
|
76707
76885
|
setZoomConfig(__spreadProps2(__spreadValues2({}, zoomConfig), {
|
@@ -76709,7 +76887,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76709
76887
|
}));
|
76710
76888
|
}
|
76711
76889
|
}, [zoomConfig.zoom]);
|
76712
|
-
(0,
|
76890
|
+
(0, import_react30.useEffect)(() => {
|
76713
76891
|
const observer = new ResizeObserver(() => {
|
76714
76892
|
setShowTransition(false);
|
76715
76893
|
resetAutoZoom();
|
@@ -76721,10 +76899,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76721
76899
|
observer.disconnect();
|
76722
76900
|
};
|
76723
76901
|
}, []);
|
76724
|
-
return /* @__PURE__ */ (0,
|
76902
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
76725
76903
|
"div",
|
76726
76904
|
{
|
76727
|
-
className:
|
76905
|
+
className: getClassName26({
|
76728
76906
|
ready: status === "READY" || !iframe.enabled
|
76729
76907
|
}),
|
76730
76908
|
onClick: () => dispatch({
|
@@ -76733,7 +76911,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76733
76911
|
recordHistory: true
|
76734
76912
|
}),
|
76735
76913
|
children: [
|
76736
|
-
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)(
|
76737
76915
|
ViewportControls,
|
76738
76916
|
{
|
76739
76917
|
autoZoom: zoomConfig.autoZoom,
|
@@ -76758,10 +76936,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76758
76936
|
}
|
76759
76937
|
}
|
76760
76938
|
) }),
|
76761
|
-
/* @__PURE__ */ (0,
|
76939
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
76762
76940
|
"div",
|
76763
76941
|
{
|
76764
|
-
className:
|
76942
|
+
className: getClassName26("root"),
|
76765
76943
|
style: {
|
76766
76944
|
width: iframe.enabled ? ui.viewports.current.width : "100%",
|
76767
76945
|
height: zoomConfig.rootHeight,
|
@@ -76770,16 +76948,46 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76770
76948
|
overflow: iframe.enabled ? void 0 : "auto"
|
76771
76949
|
},
|
76772
76950
|
suppressHydrationWarning: true,
|
76773
|
-
children: /* @__PURE__ */ (0,
|
76951
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Preview, {}) })
|
76774
76952
|
}
|
76775
76953
|
) })
|
76776
76954
|
]
|
76777
76955
|
}
|
76778
76956
|
);
|
76779
76957
|
};
|
76780
|
-
|
76781
|
-
var
|
76782
|
-
|
76958
|
+
init_react_import2();
|
76959
|
+
var insertComponent = (componentType, zone, index, {
|
76960
|
+
config,
|
76961
|
+
dispatch,
|
76962
|
+
resolveData,
|
76963
|
+
state
|
76964
|
+
}) => {
|
76965
|
+
const id = generateId(componentType);
|
76966
|
+
const insertActionData = {
|
76967
|
+
type: "insert",
|
76968
|
+
componentType,
|
76969
|
+
destinationIndex: index,
|
76970
|
+
destinationZone: zone,
|
76971
|
+
id
|
76972
|
+
};
|
76973
|
+
const insertedData = insertAction(state.data, insertActionData, config);
|
76974
|
+
dispatch(__spreadProps2(__spreadValues2({}, insertActionData), {
|
76975
|
+
// Dispatch insert rather set, as user's may rely on this via onAction
|
76976
|
+
recordHistory: false
|
76977
|
+
}));
|
76978
|
+
const itemSelector = {
|
76979
|
+
index,
|
76980
|
+
zone
|
76981
|
+
};
|
76982
|
+
dispatch({ type: "setUi", ui: { itemSelector } });
|
76983
|
+
resolveData({
|
76984
|
+
data: insertedData,
|
76985
|
+
ui: __spreadProps2(__spreadValues2({}, state.ui), { itemSelector })
|
76986
|
+
});
|
76987
|
+
};
|
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);
|
76783
76991
|
function Puck({
|
76784
76992
|
children,
|
76785
76993
|
config,
|
@@ -76788,6 +76996,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76788
76996
|
onChange,
|
76789
76997
|
onPublish,
|
76790
76998
|
onAction,
|
76999
|
+
permissions = {},
|
76791
77000
|
plugins = [],
|
76792
77001
|
overrides = {},
|
76793
77002
|
renderHeader,
|
@@ -76803,10 +77012,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76803
77012
|
}) {
|
76804
77013
|
var _a3;
|
76805
77014
|
const historyStore = useHistoryStore(initialHistory);
|
76806
|
-
const [reducer2] = (0,
|
77015
|
+
const [reducer2] = (0, import_react31.useState)(
|
76807
77016
|
() => createReducer({ config, record: historyStore.record, onAction })
|
76808
77017
|
);
|
76809
|
-
const [initialAppState] = (0,
|
77018
|
+
const [initialAppState] = (0, import_react31.useState)(() => {
|
76810
77019
|
var _a22, _b2, _c, _d, _e, _f, _g;
|
76811
77020
|
const initial = __spreadValues2(__spreadValues2({}, defaultAppState2.ui), initialUi);
|
76812
77021
|
let clientUiState = {};
|
@@ -76864,7 +77073,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76864
77073
|
})
|
76865
77074
|
});
|
76866
77075
|
});
|
76867
|
-
const [appState, dispatch] = (0,
|
77076
|
+
const [appState, dispatch] = (0, import_react31.useReducer)(
|
76868
77077
|
reducer2,
|
76869
77078
|
flushZones(initialAppState)
|
76870
77079
|
);
|
@@ -76875,9 +77084,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76875
77084
|
config,
|
76876
77085
|
dispatch
|
76877
77086
|
);
|
76878
|
-
const [menuOpen, setMenuOpen] = (0,
|
77087
|
+
const [menuOpen, setMenuOpen] = (0, import_react31.useState)(false);
|
76879
77088
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
76880
|
-
const setItemSelector = (0,
|
77089
|
+
const setItemSelector = (0, import_react31.useCallback)(
|
76881
77090
|
(newItemSelector) => {
|
76882
77091
|
if (newItemSelector === itemSelector) return;
|
76883
77092
|
dispatch({
|
@@ -76889,13 +77098,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76889
77098
|
[itemSelector]
|
76890
77099
|
);
|
76891
77100
|
const selectedItem = itemSelector ? getItem2(itemSelector, data) : null;
|
76892
|
-
(0,
|
77101
|
+
(0, import_react31.useEffect)(() => {
|
76893
77102
|
if (onChange) onChange(data);
|
76894
77103
|
}, [data]);
|
76895
77104
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
76896
|
-
const [draggedItem, setDraggedItem] = (0,
|
77105
|
+
const [draggedItem, setDraggedItem] = (0, import_react31.useState)();
|
76897
77106
|
const rootProps = data.root.props || data.root;
|
76898
|
-
const toggleSidebars = (0,
|
77107
|
+
const toggleSidebars = (0, import_react31.useCallback)(
|
76899
77108
|
(sidebar) => {
|
76900
77109
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
76901
77110
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -76909,7 +77118,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76909
77118
|
},
|
76910
77119
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
76911
77120
|
);
|
76912
|
-
(0,
|
77121
|
+
(0, import_react31.useEffect)(() => {
|
76913
77122
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
76914
77123
|
dispatch({
|
76915
77124
|
type: "setUi",
|
@@ -76932,11 +77141,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76932
77141
|
window.removeEventListener("resize", handleResize);
|
76933
77142
|
};
|
76934
77143
|
}, []);
|
76935
|
-
const
|
76936
|
-
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children: children2 });
|
76937
|
-
return PuckDefault;
|
76938
|
-
}, []);
|
76939
|
-
const defaultHeaderRender = (0, import_react30.useMemo)(() => {
|
77144
|
+
const defaultHeaderRender = (0, import_react31.useMemo)(() => {
|
76940
77145
|
if (renderHeader) {
|
76941
77146
|
console.warn(
|
76942
77147
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -76944,48 +77149,49 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76944
77149
|
const RenderHeader = (_a22) => {
|
76945
77150
|
var _b2 = _a22, { actions } = _b2, props = __objRest2(_b2, ["actions"]);
|
76946
77151
|
const Comp = renderHeader;
|
76947
|
-
return /* @__PURE__ */ (0,
|
77152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState, children: actions }));
|
76948
77153
|
};
|
76949
77154
|
return RenderHeader;
|
76950
77155
|
}
|
76951
|
-
return
|
77156
|
+
return DefaultOverride;
|
76952
77157
|
}, [renderHeader]);
|
76953
|
-
const defaultHeaderActionsRender = (0,
|
77158
|
+
const defaultHeaderActionsRender = (0, import_react31.useMemo)(() => {
|
76954
77159
|
if (renderHeaderActions) {
|
76955
77160
|
console.warn(
|
76956
77161
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
76957
77162
|
);
|
76958
77163
|
const RenderHeader = (props) => {
|
76959
77164
|
const Comp = renderHeaderActions;
|
76960
|
-
return /* @__PURE__ */ (0,
|
77165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState }));
|
76961
77166
|
};
|
76962
77167
|
return RenderHeader;
|
76963
77168
|
}
|
76964
|
-
return
|
77169
|
+
return DefaultOverride;
|
76965
77170
|
}, [renderHeader]);
|
76966
|
-
const loadedOverrides = (
|
76967
|
-
|
76968
|
-
|
76969
|
-
|
76970
|
-
|
77171
|
+
const loadedOverrides = useLoadedOverrides({
|
77172
|
+
overrides,
|
77173
|
+
plugins
|
77174
|
+
});
|
77175
|
+
const CustomPuck = (0, import_react31.useMemo)(
|
77176
|
+
() => loadedOverrides.puck || DefaultOverride,
|
76971
77177
|
[loadedOverrides]
|
76972
77178
|
);
|
76973
|
-
const CustomHeader = (0,
|
77179
|
+
const CustomHeader = (0, import_react31.useMemo)(
|
76974
77180
|
() => loadedOverrides.header || defaultHeaderRender,
|
76975
77181
|
[loadedOverrides]
|
76976
77182
|
);
|
76977
|
-
const CustomHeaderActions = (0,
|
77183
|
+
const CustomHeaderActions = (0, import_react31.useMemo)(
|
76978
77184
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
76979
77185
|
[loadedOverrides]
|
76980
77186
|
);
|
76981
|
-
const [mounted, setMounted] = (0,
|
76982
|
-
(0,
|
77187
|
+
const [mounted, setMounted] = (0, import_react31.useState)(false);
|
77188
|
+
(0, import_react31.useEffect)(() => {
|
76983
77189
|
setMounted(true);
|
76984
77190
|
}, []);
|
76985
77191
|
const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
|
76986
77192
|
const selectedComponentLabel = selectedItem ? (_a3 = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _a3 : selectedItem.type.toString() : "";
|
76987
|
-
return /* @__PURE__ */ (0,
|
76988
|
-
/* @__PURE__ */ (0,
|
77193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: `Puck ${getClassName27()}`, children: [
|
77194
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
76989
77195
|
AppProvider,
|
76990
77196
|
{
|
76991
77197
|
value: {
|
@@ -76998,9 +77204,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76998
77204
|
overrides: loadedOverrides,
|
76999
77205
|
history,
|
77000
77206
|
viewports,
|
77001
|
-
iframe
|
77207
|
+
iframe,
|
77208
|
+
globalPermissions: __spreadValues2({
|
77209
|
+
delete: true,
|
77210
|
+
drag: true,
|
77211
|
+
duplicate: true,
|
77212
|
+
insert: true,
|
77213
|
+
edit: true
|
77214
|
+
}, permissions)
|
77002
77215
|
},
|
77003
|
-
children: /* @__PURE__ */ (0,
|
77216
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77004
77217
|
DragDropContext2,
|
77005
77218
|
{
|
77006
77219
|
autoScrollerOptions: { disabled: dnd == null ? void 0 : dnd.disableAutoScroll },
|
@@ -77021,16 +77234,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77021
77234
|
}
|
77022
77235
|
if (droppedItem.source.droppableId.startsWith("component-list") && droppedItem.destination) {
|
77023
77236
|
const [_, componentType] = droppedItem.draggableId.split("::");
|
77024
|
-
|
77025
|
-
|
77026
|
-
|
77027
|
-
|
77028
|
-
|
77029
|
-
|
77030
|
-
setItemSelector({
|
77031
|
-
index: droppedItem.destination.index,
|
77032
|
-
zone: droppedItem.destination.droppableId
|
77033
|
-
});
|
77237
|
+
insertComponent(
|
77238
|
+
componentType || droppedItem.draggableId,
|
77239
|
+
droppedItem.destination.droppableId,
|
77240
|
+
droppedItem.destination.index,
|
77241
|
+
{ config, dispatch, resolveData, state: appState }
|
77242
|
+
);
|
77034
77243
|
return;
|
77035
77244
|
} else {
|
77036
77245
|
const { source, destination } = droppedItem;
|
@@ -77056,7 +77265,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77056
77265
|
});
|
77057
77266
|
}
|
77058
77267
|
},
|
77059
|
-
children: /* @__PURE__ */ (0,
|
77268
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77060
77269
|
DropZoneProvider,
|
77061
77270
|
{
|
77062
77271
|
value: {
|
@@ -77070,7 +77279,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77070
77279
|
mode: "edit",
|
77071
77280
|
areaId: "root"
|
77072
77281
|
},
|
77073
|
-
children: /* @__PURE__ */ (0,
|
77282
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77074
77283
|
"div",
|
77075
77284
|
{
|
77076
77285
|
className: getLayoutClassName({
|
@@ -77079,64 +77288,64 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77079
77288
|
mounted,
|
77080
77289
|
rightSideBarVisible
|
77081
77290
|
}),
|
77082
|
-
children: /* @__PURE__ */ (0,
|
77083
|
-
/* @__PURE__ */ (0,
|
77291
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("inner"), children: [
|
77292
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77084
77293
|
CustomHeader,
|
77085
77294
|
{
|
77086
|
-
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)(
|
77087
77296
|
Button,
|
77088
77297
|
{
|
77089
77298
|
onClick: () => {
|
77090
77299
|
onPublish && onPublish(data);
|
77091
77300
|
},
|
77092
|
-
icon: /* @__PURE__ */ (0,
|
77301
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Globe, { size: "14px" }),
|
77093
77302
|
children: "Publish"
|
77094
77303
|
}
|
77095
77304
|
) }) }),
|
77096
|
-
children: /* @__PURE__ */ (0,
|
77097
|
-
/* @__PURE__ */ (0,
|
77098
|
-
/* @__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)(
|
77099
77308
|
"div",
|
77100
77309
|
{
|
77101
77310
|
className: getLayoutClassName(
|
77102
77311
|
"leftSideBarToggle"
|
77103
77312
|
),
|
77104
|
-
children: /* @__PURE__ */ (0,
|
77313
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77105
77314
|
IconButton,
|
77106
77315
|
{
|
77107
77316
|
onClick: () => {
|
77108
77317
|
toggleSidebars("left");
|
77109
77318
|
},
|
77110
77319
|
title: "Toggle left sidebar",
|
77111
|
-
children: /* @__PURE__ */ (0,
|
77320
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelLeft, { focusable: "false" })
|
77112
77321
|
}
|
77113
77322
|
)
|
77114
77323
|
}
|
77115
77324
|
),
|
77116
|
-
/* @__PURE__ */ (0,
|
77325
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77117
77326
|
"div",
|
77118
77327
|
{
|
77119
77328
|
className: getLayoutClassName(
|
77120
77329
|
"rightSideBarToggle"
|
77121
77330
|
),
|
77122
|
-
children: /* @__PURE__ */ (0,
|
77331
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77123
77332
|
IconButton,
|
77124
77333
|
{
|
77125
77334
|
onClick: () => {
|
77126
77335
|
toggleSidebars("right");
|
77127
77336
|
},
|
77128
77337
|
title: "Toggle right sidebar",
|
77129
|
-
children: /* @__PURE__ */ (0,
|
77338
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelRight, { focusable: "false" })
|
77130
77339
|
}
|
77131
77340
|
)
|
77132
77341
|
}
|
77133
77342
|
)
|
77134
77343
|
] }),
|
77135
|
-
/* @__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: [
|
77136
77345
|
headerTitle || rootProps.title || "Page",
|
77137
|
-
headerPath && /* @__PURE__ */ (0,
|
77346
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
77138
77347
|
" ",
|
77139
|
-
/* @__PURE__ */ (0,
|
77348
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77140
77349
|
"code",
|
77141
77350
|
{
|
77142
77351
|
className: getLayoutClassName("headerPath"),
|
@@ -77145,18 +77354,18 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77145
77354
|
)
|
77146
77355
|
] })
|
77147
77356
|
] }) }),
|
77148
|
-
/* @__PURE__ */ (0,
|
77149
|
-
/* @__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)(
|
77150
77359
|
IconButton,
|
77151
77360
|
{
|
77152
77361
|
onClick: () => {
|
77153
77362
|
return setMenuOpen(!menuOpen);
|
77154
77363
|
},
|
77155
77364
|
title: "Toggle menu bar",
|
77156
|
-
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" })
|
77157
77366
|
}
|
77158
77367
|
) }),
|
77159
|
-
/* @__PURE__ */ (0,
|
77368
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77160
77369
|
MenuBar,
|
77161
77370
|
{
|
77162
77371
|
appState,
|
@@ -77164,13 +77373,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77164
77373
|
dispatch,
|
77165
77374
|
onPublish,
|
77166
77375
|
menuOpen,
|
77167
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
77376
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77168
77377
|
Button,
|
77169
77378
|
{
|
77170
77379
|
onClick: () => {
|
77171
77380
|
onPublish && onPublish(data);
|
77172
77381
|
},
|
77173
|
-
icon: /* @__PURE__ */ (0,
|
77382
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Globe, { size: "14px" }),
|
77174
77383
|
children: "Publish"
|
77175
77384
|
}
|
77176
77385
|
) }),
|
@@ -77181,19 +77390,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77181
77390
|
] }) })
|
77182
77391
|
}
|
77183
77392
|
),
|
77184
|
-
/* @__PURE__ */ (0,
|
77185
|
-
/* @__PURE__ */ (0,
|
77186
|
-
/* @__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, {}) })
|
77187
77396
|
] }),
|
77188
|
-
/* @__PURE__ */ (0,
|
77189
|
-
/* @__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)(
|
77190
77399
|
SidebarSection2,
|
77191
77400
|
{
|
77192
77401
|
noPadding: true,
|
77193
77402
|
noBorderTop: true,
|
77194
77403
|
showBreadcrumbs: true,
|
77195
77404
|
title: selectedItem ? selectedComponentLabel : "Page",
|
77196
|
-
children: /* @__PURE__ */ (0,
|
77405
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Fields, {})
|
77197
77406
|
}
|
77198
77407
|
) })
|
77199
77408
|
] })
|
@@ -77205,7 +77414,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77205
77414
|
)
|
77206
77415
|
}
|
77207
77416
|
),
|
77208
|
-
/* @__PURE__ */ (0,
|
77417
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { id: "puck-portal-root", className: getClassName27("portal") })
|
77209
77418
|
] });
|
77210
77419
|
}
|
77211
77420
|
Puck.Components = Components;
|
@@ -77213,7 +77422,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77213
77422
|
Puck.Outline = Outline;
|
77214
77423
|
Puck.Preview = Preview;
|
77215
77424
|
init_react_import2();
|
77216
|
-
var
|
77425
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
77217
77426
|
function Render({
|
77218
77427
|
config,
|
77219
77428
|
data
|
@@ -77226,7 +77435,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77226
77435
|
const rootProps = defaultedData.root.props || defaultedData.root;
|
77227
77436
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
77228
77437
|
if ((_a3 = config.root) == null ? void 0 : _a3.render) {
|
77229
|
-
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)(
|
77230
77439
|
config.root.render,
|
77231
77440
|
__spreadProps2(__spreadValues2({}, rootProps), {
|
77232
77441
|
puck: {
|
@@ -77236,11 +77445,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77236
77445
|
title,
|
77237
77446
|
editMode: false,
|
77238
77447
|
id: "puck-root",
|
77239
|
-
children: /* @__PURE__ */ (0,
|
77448
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZone, { zone: rootDroppableId2 })
|
77240
77449
|
})
|
77241
77450
|
) });
|
77242
77451
|
}
|
77243
|
-
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 }) });
|
77244
77453
|
}
|
77245
77454
|
init_react_import2();
|
77246
77455
|
var migrations = [
|
@@ -77336,12 +77545,25 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77336
77545
|
config,
|
77337
77546
|
history,
|
77338
77547
|
dispatch,
|
77339
|
-
selectedItem
|
77548
|
+
selectedItem: currentItem,
|
77549
|
+
globalPermissions
|
77340
77550
|
} = useAppContext2();
|
77341
77551
|
return {
|
77342
77552
|
appState,
|
77343
77553
|
config,
|
77344
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
|
+
},
|
77345
77567
|
history: {
|
77346
77568
|
back: history.back,
|
77347
77569
|
forward: history.forward,
|
@@ -77353,7 +77575,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77353
77575
|
index: history.historyStore.index,
|
77354
77576
|
historyStore: history.historyStore
|
77355
77577
|
},
|
77356
|
-
selectedItem:
|
77578
|
+
selectedItem: currentItem || null
|
77357
77579
|
};
|
77358
77580
|
};
|
77359
77581
|
}
|
@@ -77654,7 +77876,8 @@ var defaultContext = {
|
|
77654
77876
|
status: "LOADING",
|
77655
77877
|
setStatus: () => null,
|
77656
77878
|
iframe: {},
|
77657
|
-
safariFallbackMode: false
|
77879
|
+
safariFallbackMode: false,
|
77880
|
+
globalPermissions: {}
|
77658
77881
|
};
|
77659
77882
|
var appContext = (0, import_react10.createContext)(defaultContext);
|
77660
77883
|
function useAppContext() {
|