@measured/puck-plugin-heading-analyzer 0.16.0-canary.c7007ac → 0.16.0-canary.cad95b8
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +4 -0
- package/dist/index.js +740 -582
- 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,81 @@ 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
|
+
var getPermissions = ({
|
74262
|
+
selectedItem,
|
74263
|
+
type,
|
74264
|
+
globalPermissions,
|
74265
|
+
config
|
74266
|
+
}) => {
|
74267
|
+
const componentType = type || selectedItem && selectedItem.type || "";
|
74268
|
+
let componentPermissions = getInitialPermissions({
|
74269
|
+
componentType,
|
74270
|
+
config,
|
74271
|
+
globalPermissions
|
74272
|
+
});
|
74273
|
+
return componentPermissions;
|
74274
|
+
};
|
74275
|
+
var getInitialPermissions = ({
|
74276
|
+
componentType,
|
74277
|
+
globalPermissions,
|
74278
|
+
config
|
74279
|
+
}) => {
|
74280
|
+
var _a3;
|
74281
|
+
return __spreadValues2(__spreadValues2({}, globalPermissions), (_a3 = config.components[componentType]) == null ? void 0 : _a3.permissions);
|
74282
|
+
};
|
74283
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
74284
|
+
var getClassName17 = get_class_name_factory_default2("DraggableComponent", styles_module_default11);
|
74185
74285
|
var space2 = 8;
|
74186
74286
|
var actionsOverlayTop = space2 * 6.5;
|
74187
74287
|
var actionsTop = -(actionsOverlayTop - 8);
|
74188
74288
|
var actionsRight = space2;
|
74289
|
+
var DefaultActionBar = ({
|
74290
|
+
label,
|
74291
|
+
children
|
74292
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ActionBar, { label, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DefaultOverride, { children }) });
|
74189
74293
|
var DraggableComponent = ({
|
74190
74294
|
children,
|
74191
74295
|
id,
|
@@ -74208,30 +74312,50 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74208
74312
|
indicativeHover = false,
|
74209
74313
|
style: style2
|
74210
74314
|
}) => {
|
74211
|
-
const {
|
74315
|
+
const {
|
74316
|
+
zoomConfig,
|
74317
|
+
status,
|
74318
|
+
overrides,
|
74319
|
+
plugins,
|
74320
|
+
selectedItem,
|
74321
|
+
config,
|
74322
|
+
globalPermissions
|
74323
|
+
} = useAppContext2();
|
74212
74324
|
const isModifierHeld = useModifierHeld("Alt");
|
74213
|
-
const { status } = useAppContext2();
|
74214
74325
|
const El = status !== "LOADING" ? import_dnd4.Draggable : DefaultDraggable;
|
74215
|
-
(0,
|
74216
|
-
const [disableSecondaryAnimation, setDisableSecondaryAnimation] = (0,
|
74217
|
-
(0,
|
74326
|
+
(0, import_react15.useEffect)(onMount, []);
|
74327
|
+
const [disableSecondaryAnimation, setDisableSecondaryAnimation] = (0, import_react15.useState)(false);
|
74328
|
+
(0, import_react15.useEffect)(() => {
|
74218
74329
|
if (isIos()) {
|
74219
74330
|
setDisableSecondaryAnimation(true);
|
74220
74331
|
}
|
74221
74332
|
}, []);
|
74222
|
-
|
74333
|
+
const loadedOverrides = useLoadedOverrides({
|
74334
|
+
overrides,
|
74335
|
+
plugins
|
74336
|
+
});
|
74337
|
+
const CustomActionBar = (0, import_react15.useMemo)(
|
74338
|
+
() => loadedOverrides.actionBar || DefaultActionBar,
|
74339
|
+
[loadedOverrides]
|
74340
|
+
);
|
74341
|
+
const permissions = selectedItem && getPermissions({
|
74342
|
+
selectedItem,
|
74343
|
+
globalPermissions: globalPermissions || {},
|
74344
|
+
config
|
74345
|
+
});
|
74346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
74223
74347
|
El,
|
74224
74348
|
{
|
74225
74349
|
draggableId: id,
|
74226
74350
|
index,
|
74227
74351
|
isDragDisabled,
|
74228
74352
|
disableSecondaryAnimation,
|
74229
|
-
children: (provided, snapshot) => /* @__PURE__ */ (0,
|
74353
|
+
children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
74230
74354
|
"div",
|
74231
74355
|
__spreadProps2(__spreadValues2(__spreadValues2({
|
74232
74356
|
ref: provided.innerRef
|
74233
74357
|
}, provided.draggableProps), provided.dragHandleProps), {
|
74234
|
-
className:
|
74358
|
+
className: getClassName17({
|
74235
74359
|
isSelected,
|
74236
74360
|
isModifierHeld,
|
74237
74361
|
isDragging: snapshot.isDragging,
|
@@ -74240,7 +74364,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74240
74364
|
indicativeHover
|
74241
74365
|
}),
|
74242
74366
|
style: __spreadProps2(__spreadValues2(__spreadValues2({}, style2), provided.draggableProps.style), {
|
74243
|
-
cursor: isModifierHeld ? "initial" : "grab"
|
74367
|
+
cursor: isModifierHeld || isDragDisabled ? "initial" : "grab"
|
74244
74368
|
}),
|
74245
74369
|
onMouseOver,
|
74246
74370
|
onMouseOut,
|
@@ -74249,34 +74373,33 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74249
74373
|
onClick,
|
74250
74374
|
children: [
|
74251
74375
|
debug,
|
74252
|
-
isLoading && /* @__PURE__ */ (0,
|
74253
|
-
/* @__PURE__ */ (0,
|
74376
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Loader2, {}) }),
|
74377
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
74254
74378
|
"div",
|
74255
74379
|
{
|
74256
|
-
className:
|
74380
|
+
className: getClassName17("actionsOverlay"),
|
74257
74381
|
style: {
|
74258
74382
|
top: actionsOverlayTop / zoomConfig.zoom
|
74259
74383
|
},
|
74260
|
-
children: /* @__PURE__ */ (0,
|
74384
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
74261
74385
|
"div",
|
74262
74386
|
{
|
74263
|
-
className:
|
74387
|
+
className: getClassName17("actions"),
|
74264
74388
|
style: {
|
74265
74389
|
transform: `scale(${1 / zoomConfig.zoom}`,
|
74266
74390
|
top: actionsTop / zoomConfig.zoom,
|
74267
74391
|
right: actionsRight / zoomConfig.zoom
|
74268
74392
|
},
|
74269
|
-
children: [
|
74270
|
-
|
74271
|
-
/* @__PURE__ */ (0,
|
74272
|
-
|
74273
|
-
]
|
74393
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(CustomActionBar, { label, children: [
|
74394
|
+
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 }) }),
|
74395
|
+
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 }) })
|
74396
|
+
] })
|
74274
74397
|
}
|
74275
74398
|
)
|
74276
74399
|
}
|
74277
74400
|
),
|
74278
|
-
/* @__PURE__ */ (0,
|
74279
|
-
/* @__PURE__ */ (0,
|
74401
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17("overlay") }),
|
74402
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17("contents"), children })
|
74280
74403
|
]
|
74281
74404
|
})
|
74282
74405
|
)
|
@@ -74285,9 +74408,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74285
74408
|
);
|
74286
74409
|
};
|
74287
74410
|
init_react_import2();
|
74288
|
-
var
|
74411
|
+
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
74412
|
init_react_import2();
|
74290
|
-
var
|
74413
|
+
var import_react16 = require("react");
|
74291
74414
|
var import_use_debounce2 = (init_index_module(), __toCommonJS(index_module_exports));
|
74292
74415
|
init_react_import2();
|
74293
74416
|
var getZoneId2 = (zoneCompound) => {
|
@@ -74299,30 +74422,30 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74299
74422
|
}
|
74300
74423
|
return [rootDroppableId2, zoneCompound];
|
74301
74424
|
};
|
74302
|
-
var
|
74303
|
-
var dropZoneContext2 = (0,
|
74425
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
74426
|
+
var dropZoneContext2 = (0, import_react16.createContext)(null);
|
74304
74427
|
var DropZoneProvider = ({
|
74305
74428
|
children,
|
74306
74429
|
value
|
74307
74430
|
}) => {
|
74308
|
-
const [hoveringArea, setHoveringArea] = (0,
|
74309
|
-
const [hoveringZone, setHoveringZone] = (0,
|
74431
|
+
const [hoveringArea, setHoveringArea] = (0, import_react16.useState)(null);
|
74432
|
+
const [hoveringZone, setHoveringZone] = (0, import_react16.useState)(
|
74310
74433
|
rootDroppableId2
|
74311
74434
|
);
|
74312
|
-
const [hoveringComponent, setHoveringComponent] = (0,
|
74435
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react16.useState)();
|
74313
74436
|
const [hoveringAreaDb] = (0, import_use_debounce2.useDebounce)(hoveringArea, 75, { leading: false });
|
74314
|
-
const [areasWithZones, setAreasWithZones] = (0,
|
74437
|
+
const [areasWithZones, setAreasWithZones] = (0, import_react16.useState)(
|
74315
74438
|
{}
|
74316
74439
|
);
|
74317
|
-
const [activeZones, setActiveZones] = (0,
|
74440
|
+
const [activeZones, setActiveZones] = (0, import_react16.useState)({});
|
74318
74441
|
const { dispatch = null } = value ? value : {};
|
74319
|
-
const registerZoneArea = (0,
|
74442
|
+
const registerZoneArea = (0, import_react16.useCallback)(
|
74320
74443
|
(area) => {
|
74321
74444
|
setAreasWithZones((latest) => __spreadProps2(__spreadValues2({}, latest), { [area]: true }));
|
74322
74445
|
},
|
74323
74446
|
[setAreasWithZones]
|
74324
74447
|
);
|
74325
|
-
const registerZone = (0,
|
74448
|
+
const registerZone = (0, import_react16.useCallback)(
|
74326
74449
|
(zoneCompound) => {
|
74327
74450
|
if (!dispatch) {
|
74328
74451
|
return;
|
@@ -74335,7 +74458,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74335
74458
|
},
|
74336
74459
|
[setActiveZones, dispatch]
|
74337
74460
|
);
|
74338
|
-
const unregisterZone = (0,
|
74461
|
+
const unregisterZone = (0, import_react16.useCallback)(
|
74339
74462
|
(zoneCompound) => {
|
74340
74463
|
if (!dispatch) {
|
74341
74464
|
return;
|
@@ -74350,8 +74473,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74350
74473
|
},
|
74351
74474
|
[setActiveZones, dispatch]
|
74352
74475
|
);
|
74353
|
-
const [pathData, setPathData] = (0,
|
74354
|
-
const registerPath = (0,
|
74476
|
+
const [pathData, setPathData] = (0, import_react16.useState)();
|
74477
|
+
const registerPath = (0, import_react16.useCallback)(
|
74355
74478
|
(selector) => {
|
74356
74479
|
if (!(value == null ? void 0 : value.data)) {
|
74357
74480
|
return;
|
@@ -74376,8 +74499,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74376
74499
|
},
|
74377
74500
|
[value, setPathData]
|
74378
74501
|
);
|
74379
|
-
const [zoneWillDrag, setZoneWillDrag] = (0,
|
74380
|
-
return /* @__PURE__ */ (0,
|
74502
|
+
const [zoneWillDrag, setZoneWillDrag] = (0, import_react16.useState)("");
|
74503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
74381
74504
|
dropZoneContext2.Provider,
|
74382
74505
|
{
|
74383
74506
|
value: __spreadValues2({
|
@@ -74401,12 +74524,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74401
74524
|
}
|
74402
74525
|
) });
|
74403
74526
|
};
|
74404
|
-
var
|
74405
|
-
var
|
74527
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
74528
|
+
var getClassName18 = get_class_name_factory_default2("DropZone", styles_module_default12);
|
74406
74529
|
function DropZoneEdit({ zone, allow, disallow, style: style2 }) {
|
74407
74530
|
var _a3;
|
74408
74531
|
const appContext22 = useAppContext2();
|
74409
|
-
const ctx = (0,
|
74532
|
+
const ctx = (0, import_react17.useContext)(dropZoneContext2);
|
74410
74533
|
const {
|
74411
74534
|
// These all need setting via context
|
74412
74535
|
data,
|
@@ -74425,12 +74548,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74425
74548
|
} = ctx || {};
|
74426
74549
|
let content = data.content || [];
|
74427
74550
|
let zoneCompound = rootDroppableId2;
|
74428
|
-
(0,
|
74551
|
+
(0, import_react17.useEffect)(() => {
|
74429
74552
|
if (areaId && registerZoneArea) {
|
74430
74553
|
registerZoneArea(areaId);
|
74431
74554
|
}
|
74432
74555
|
}, [areaId]);
|
74433
|
-
(0,
|
74556
|
+
(0, import_react17.useEffect)(() => {
|
74434
74557
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
74435
74558
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
74436
74559
|
}
|
@@ -74456,7 +74579,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74456
74579
|
const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
|
74457
74580
|
const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
|
74458
74581
|
if (!(ctx == null ? void 0 : ctx.config) || !ctx.setHoveringArea || !ctx.setHoveringZone || !ctx.setHoveringComponent || !ctx.setItemSelector || !ctx.registerPath || !ctx.dispatch) {
|
74459
|
-
return /* @__PURE__ */ (0,
|
74582
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: "DropZone requires context to work." });
|
74460
74583
|
}
|
74461
74584
|
const {
|
74462
74585
|
hoveringArea = "root",
|
@@ -74497,10 +74620,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74497
74620
|
}
|
74498
74621
|
const selectedItem = itemSelector ? getItem2(itemSelector, data) : null;
|
74499
74622
|
const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
|
74500
|
-
return /* @__PURE__ */ (0,
|
74623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74501
74624
|
"div",
|
74502
74625
|
{
|
74503
|
-
className:
|
74626
|
+
className: getClassName18({
|
74504
74627
|
isRootZone,
|
74505
74628
|
userIsDragging,
|
74506
74629
|
draggingOverArea,
|
@@ -74514,17 +74637,17 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74514
74637
|
onMouseUp: () => {
|
74515
74638
|
setZoneWillDrag("");
|
74516
74639
|
},
|
74517
|
-
children: /* @__PURE__ */ (0,
|
74640
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74518
74641
|
Droppable2,
|
74519
74642
|
{
|
74520
74643
|
droppableId: zoneCompound,
|
74521
74644
|
direction: "vertical",
|
74522
74645
|
isDropDisabled: !isEnabled,
|
74523
74646
|
children: (provided, snapshot) => {
|
74524
|
-
return /* @__PURE__ */ (0,
|
74647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
74525
74648
|
"div",
|
74526
74649
|
__spreadProps2(__spreadValues2({}, (provided || { droppableProps: {} }).droppableProps), {
|
74527
|
-
className:
|
74650
|
+
className: getClassName18("content"),
|
74528
74651
|
ref: provided == null ? void 0 : provided.innerRef,
|
74529
74652
|
style: style2,
|
74530
74653
|
id: zoneCompound,
|
@@ -74551,25 +74674,33 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74551
74674
|
"draggable-"
|
74552
74675
|
)[1] === componentId;
|
74553
74676
|
const containsZone = areasWithZones ? areasWithZones[componentId] : false;
|
74554
|
-
const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0,
|
74677
|
+
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
74678
|
"No configuration for ",
|
74556
74679
|
item.type
|
74557
74680
|
] });
|
74558
74681
|
const componentConfig = config.components[item.type];
|
74559
74682
|
const label = (_b2 = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _b2 : item.type.toString();
|
74560
|
-
|
74683
|
+
const canDrag = getPermissions({
|
74684
|
+
selectedItem: getItem2(
|
74685
|
+
{ index: i2, zone: zoneCompound },
|
74686
|
+
appContext22.state.data
|
74687
|
+
),
|
74688
|
+
config: appContext22.config,
|
74689
|
+
globalPermissions: appContext22.globalPermissions || {}
|
74690
|
+
}).drag;
|
74691
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
74561
74692
|
"div",
|
74562
74693
|
{
|
74563
|
-
className:
|
74694
|
+
className: getClassName18("item"),
|
74564
74695
|
style: { zIndex: isDragging2 ? 1 : void 0 },
|
74565
74696
|
children: [
|
74566
|
-
/* @__PURE__ */ (0,
|
74697
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74567
74698
|
DropZoneProvider,
|
74568
74699
|
{
|
74569
74700
|
value: __spreadProps2(__spreadValues2({}, ctx), {
|
74570
74701
|
areaId: componentId
|
74571
74702
|
}),
|
74572
|
-
children: /* @__PURE__ */ (0,
|
74703
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74573
74704
|
DraggableComponent,
|
74574
74705
|
{
|
74575
74706
|
label,
|
@@ -74578,6 +74709,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74578
74709
|
isSelected,
|
74579
74710
|
isLocked: userIsDragging,
|
74580
74711
|
forceHover: hoveringComponent === componentId && !userIsDragging,
|
74712
|
+
isDragDisabled: !canDrag,
|
74581
74713
|
indicativeHover: userIsDragging && containsZone && hoveringArea === componentId,
|
74582
74714
|
isLoading: (_c = appContext22.componentState[componentId]) == null ? void 0 : _c.loading,
|
74583
74715
|
onMount: () => {
|
@@ -74636,15 +74768,15 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74636
74768
|
style: {
|
74637
74769
|
pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
|
74638
74770
|
},
|
74639
|
-
children: /* @__PURE__ */ (0,
|
74771
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName18("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Render2, __spreadValues2({}, defaultedProps)) })
|
74640
74772
|
}
|
74641
74773
|
)
|
74642
74774
|
}
|
74643
74775
|
),
|
74644
|
-
userIsDragging && /* @__PURE__ */ (0,
|
74776
|
+
userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74645
74777
|
"div",
|
74646
74778
|
{
|
74647
|
-
className:
|
74779
|
+
className: getClassName18("hitbox"),
|
74648
74780
|
onMouseOver: (e2) => {
|
74649
74781
|
e2.stopPropagation();
|
74650
74782
|
setHoveringArea(zoneArea);
|
@@ -74658,7 +74790,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74658
74790
|
);
|
74659
74791
|
}),
|
74660
74792
|
provided == null ? void 0 : provided.placeholder,
|
74661
|
-
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0,
|
74793
|
+
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74662
74794
|
"div",
|
74663
74795
|
{
|
74664
74796
|
"data-puck-placeholder": true,
|
@@ -74679,7 +74811,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74679
74811
|
);
|
74680
74812
|
}
|
74681
74813
|
function DropZoneRender({ zone }) {
|
74682
|
-
const ctx = (0,
|
74814
|
+
const ctx = (0, import_react17.useContext)(dropZoneContext2);
|
74683
74815
|
const { data, areaId = "root", config } = ctx || {};
|
74684
74816
|
let zoneCompound = rootDroppableId2;
|
74685
74817
|
let content = (data == null ? void 0 : data.content) || [];
|
@@ -74690,14 +74822,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74690
74822
|
zoneCompound = `${areaId}:${zone}`;
|
74691
74823
|
content = setupZone2(data, zoneCompound).zones[zoneCompound];
|
74692
74824
|
}
|
74693
|
-
return /* @__PURE__ */ (0,
|
74825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: content.map((item) => {
|
74694
74826
|
const Component = config.components[item.type];
|
74695
74827
|
if (Component) {
|
74696
|
-
return /* @__PURE__ */ (0,
|
74828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74697
74829
|
DropZoneProvider,
|
74698
74830
|
{
|
74699
74831
|
value: { data, config, areaId: item.props.id },
|
74700
|
-
children: /* @__PURE__ */ (0,
|
74832
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
74701
74833
|
Component.render,
|
74702
74834
|
__spreadProps2(__spreadValues2({}, item.props), {
|
74703
74835
|
puck: { renderDropZone: DropZone }
|
@@ -74711,16 +74843,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74711
74843
|
}) });
|
74712
74844
|
}
|
74713
74845
|
function DropZone(props) {
|
74714
|
-
const ctx = (0,
|
74846
|
+
const ctx = (0, import_react17.useContext)(dropZoneContext2);
|
74715
74847
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
74716
|
-
return /* @__PURE__ */ (0,
|
74848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneEdit, __spreadValues2({}, props));
|
74717
74849
|
}
|
74718
|
-
return /* @__PURE__ */ (0,
|
74850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRender, __spreadValues2({}, props));
|
74719
74851
|
}
|
74720
74852
|
init_react_import2();
|
74721
|
-
var
|
74853
|
+
var import_react31 = require("react");
|
74722
74854
|
init_react_import2();
|
74723
|
-
var
|
74855
|
+
var import_react18 = require("react");
|
74724
74856
|
init_react_import2();
|
74725
74857
|
var getFrame3 = () => {
|
74726
74858
|
let frame = document.querySelector("#preview-frame");
|
@@ -74731,7 +74863,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74731
74863
|
};
|
74732
74864
|
var usePlaceholderStyle = () => {
|
74733
74865
|
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
74734
|
-
const [placeholderStyle, setPlaceholderStyle] = (0,
|
74866
|
+
const [placeholderStyle, setPlaceholderStyle] = (0, import_react18.useState)();
|
74735
74867
|
const onDragStartOrUpdate = (draggedItem) => {
|
74736
74868
|
var _a3;
|
74737
74869
|
const draggableId = draggedItem.draggableId;
|
@@ -74776,9 +74908,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74776
74908
|
};
|
74777
74909
|
init_react_import2();
|
74778
74910
|
init_react_import2();
|
74779
|
-
var
|
74911
|
+
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
74912
|
init_react_import2();
|
74781
|
-
var
|
74913
|
+
var import_react19 = require("react");
|
74782
74914
|
var convertPathDataToBreadcrumbs2 = (selectedItem, pathData, data) => {
|
74783
74915
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
74784
74916
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues2({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -74828,8 +74960,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74828
74960
|
state: { data },
|
74829
74961
|
selectedItem
|
74830
74962
|
} = useAppContext2();
|
74831
|
-
const dzContext = (0,
|
74832
|
-
return (0,
|
74963
|
+
const dzContext = (0, import_react19.useContext)(dropZoneContext2);
|
74964
|
+
return (0, import_react19.useMemo)(() => {
|
74833
74965
|
const breadcrumbs = convertPathDataToBreadcrumbs2(
|
74834
74966
|
selectedItem,
|
74835
74967
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -74841,8 +74973,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74841
74973
|
return breadcrumbs;
|
74842
74974
|
}, [selectedItem, dzContext == null ? void 0 : dzContext.pathData, renderCount]);
|
74843
74975
|
};
|
74844
|
-
var
|
74845
|
-
var
|
74976
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
74977
|
+
var getClassName19 = get_class_name_factory_default2("SidebarSection", styles_module_default13);
|
74846
74978
|
var SidebarSection2 = ({
|
74847
74979
|
children,
|
74848
74980
|
title,
|
@@ -74854,28 +74986,28 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74854
74986
|
}) => {
|
74855
74987
|
const { setUi } = useAppContext2();
|
74856
74988
|
const breadcrumbs = useBreadcrumbs2(1);
|
74857
|
-
return /* @__PURE__ */ (0,
|
74989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
74858
74990
|
"div",
|
74859
74991
|
{
|
74860
|
-
className:
|
74992
|
+
className: getClassName19({ noBorderTop, noPadding }),
|
74861
74993
|
style: { background },
|
74862
74994
|
children: [
|
74863
|
-
/* @__PURE__ */ (0,
|
74864
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i2) => /* @__PURE__ */ (0,
|
74865
|
-
/* @__PURE__ */ (0,
|
74995
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
|
74996
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i2) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
|
74997
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
74866
74998
|
"button",
|
74867
74999
|
{
|
74868
|
-
className:
|
75000
|
+
className: getClassName19("breadcrumbLabel"),
|
74869
75001
|
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
74870
75002
|
children: breadcrumb.label
|
74871
75003
|
}
|
74872
75004
|
),
|
74873
|
-
/* @__PURE__ */ (0,
|
75005
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronRight2, { size: 16 })
|
74874
75006
|
] }, i2)) : null,
|
74875
|
-
/* @__PURE__ */ (0,
|
75007
|
+
/* @__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
75008
|
] }) }),
|
74877
|
-
/* @__PURE__ */ (0,
|
74878
|
-
isLoading && /* @__PURE__ */ (0,
|
75009
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("content"), children }),
|
75010
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Loader2, { size: 32 }) })
|
74879
75011
|
]
|
74880
75012
|
}
|
74881
75013
|
);
|
@@ -74977,34 +75109,37 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
74977
75109
|
})
|
74978
75110
|
});
|
74979
75111
|
};
|
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);
|
75112
|
+
var insertAction = (data, action, config) => {
|
75113
|
+
const emptyComponentData = {
|
75114
|
+
type: action.componentType,
|
75115
|
+
props: __spreadProps2(__spreadValues2({}, config.components[action.componentType].defaultProps || {}), {
|
75116
|
+
id: action.id || generateId(action.componentType)
|
75117
|
+
})
|
75118
|
+
};
|
75119
|
+
if (action.destinationZone === rootDroppableId2) {
|
74998
75120
|
return __spreadProps2(__spreadValues2({}, data), {
|
74999
|
-
|
75000
|
-
|
75001
|
-
|
75002
|
-
|
75003
|
-
|
75004
|
-
)
|
75005
|
-
})
|
75121
|
+
content: insert(
|
75122
|
+
data.content,
|
75123
|
+
action.destinationIndex,
|
75124
|
+
emptyComponentData
|
75125
|
+
)
|
75006
75126
|
});
|
75007
75127
|
}
|
75128
|
+
const newData = setupZone2(data, action.destinationZone);
|
75129
|
+
return __spreadProps2(__spreadValues2({}, data), {
|
75130
|
+
zones: __spreadProps2(__spreadValues2({}, newData.zones), {
|
75131
|
+
[action.destinationZone]: insert(
|
75132
|
+
newData.zones[action.destinationZone],
|
75133
|
+
action.destinationIndex,
|
75134
|
+
emptyComponentData
|
75135
|
+
)
|
75136
|
+
})
|
75137
|
+
});
|
75138
|
+
};
|
75139
|
+
var reduceData = (data, action, config) => {
|
75140
|
+
if (action.type === "insert") {
|
75141
|
+
return insertAction(data, action, config);
|
75142
|
+
}
|
75008
75143
|
if (action.type === "duplicate") {
|
75009
75144
|
const item = getItem2(
|
75010
75145
|
{ index: action.sourceIndex, zone: action.sourceZone },
|
@@ -75219,7 +75354,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75219
75354
|
return appState;
|
75220
75355
|
};
|
75221
75356
|
init_react_import2();
|
75222
|
-
var
|
75357
|
+
var import_react20 = require("react");
|
75223
75358
|
init_react_import2();
|
75224
75359
|
init_react_import2();
|
75225
75360
|
var getChanged = (newItem, oldItem) => {
|
@@ -75316,13 +75451,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75316
75451
|
return data.root;
|
75317
75452
|
});
|
75318
75453
|
var useResolvedData = (appState, config, dispatch) => {
|
75319
|
-
const [{ resolverKey, newAppState }, setResolverState] = (0,
|
75454
|
+
const [{ resolverKey, newAppState }, setResolverState] = (0, import_react20.useState)({
|
75320
75455
|
resolverKey: 0,
|
75321
75456
|
newAppState: appState
|
75322
75457
|
});
|
75323
|
-
const [componentState, setComponentState] = (0,
|
75458
|
+
const [componentState, setComponentState] = (0, import_react20.useState)({});
|
75324
75459
|
const deferredSetStates = {};
|
75325
|
-
const setComponentLoading = (0,
|
75460
|
+
const setComponentLoading = (0, import_react20.useCallback)(
|
75326
75461
|
(id, loading, defer2 = 0) => {
|
75327
75462
|
if (deferredSetStates[id]) {
|
75328
75463
|
clearTimeout(deferredSetStates[id]);
|
@@ -75392,10 +75527,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75392
75527
|
});
|
75393
75528
|
yield Promise.all(promises);
|
75394
75529
|
});
|
75395
|
-
(0,
|
75530
|
+
(0, import_react20.useEffect)(() => {
|
75396
75531
|
runResolvers();
|
75397
75532
|
}, [resolverKey]);
|
75398
|
-
const resolveData = (0,
|
75533
|
+
const resolveData = (0, import_react20.useCallback)((newAppState2 = appState) => {
|
75399
75534
|
setResolverState((curr) => ({
|
75400
75535
|
resolverKey: curr.resolverKey + 1,
|
75401
75536
|
newAppState: newAppState2
|
@@ -75408,9 +75543,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75408
75543
|
};
|
75409
75544
|
init_react_import2();
|
75410
75545
|
init_react_import2();
|
75411
|
-
var
|
75412
|
-
var
|
75413
|
-
var
|
75546
|
+
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" };
|
75547
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
75548
|
+
var getClassName20 = get_class_name_factory_default2("MenuBar", styles_module_default14);
|
75414
75549
|
var MenuBar = ({
|
75415
75550
|
appState,
|
75416
75551
|
data = { content: [], root: {} },
|
@@ -75424,10 +75559,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75424
75559
|
history: { back, forward, historyStore }
|
75425
75560
|
} = useAppContext2();
|
75426
75561
|
const { hasFuture = false, hasPast = false } = historyStore || {};
|
75427
|
-
return /* @__PURE__ */ (0,
|
75562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
75428
75563
|
"div",
|
75429
75564
|
{
|
75430
|
-
className:
|
75565
|
+
className: getClassName20({ menuOpen }),
|
75431
75566
|
onClick: (event) => {
|
75432
75567
|
var _a3;
|
75433
75568
|
const element = event.target;
|
@@ -75438,24 +75573,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75438
75573
|
setMenuOpen(false);
|
75439
75574
|
}
|
75440
75575
|
},
|
75441
|
-
children: /* @__PURE__ */ (0,
|
75442
|
-
/* @__PURE__ */ (0,
|
75443
|
-
/* @__PURE__ */ (0,
|
75444
|
-
|
75445
|
-
{
|
75446
|
-
size: 21,
|
75447
|
-
stroke: hasPast ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
|
75448
|
-
}
|
75449
|
-
) }),
|
75450
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
75451
|
-
Redo2,
|
75452
|
-
{
|
75453
|
-
size: 21,
|
75454
|
-
stroke: hasFuture ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
|
75455
|
-
}
|
75456
|
-
) })
|
75576
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName20("inner"), children: [
|
75577
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName20("history"), children: [
|
75578
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Undo2, { size: 21 }) }),
|
75579
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Redo2, { size: 21 }) })
|
75457
75580
|
] }),
|
75458
|
-
/* @__PURE__ */ (0,
|
75581
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: renderHeaderActions && renderHeaderActions({
|
75459
75582
|
state: appState,
|
75460
75583
|
dispatch
|
75461
75584
|
}) })
|
@@ -75464,20 +75587,20 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75464
75587
|
);
|
75465
75588
|
};
|
75466
75589
|
init_react_import2();
|
75467
|
-
var
|
75590
|
+
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" };
|
75468
75591
|
init_react_import2();
|
75469
75592
|
init_react_import2();
|
75470
|
-
var
|
75471
|
-
var
|
75472
|
-
var
|
75473
|
-
var
|
75593
|
+
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" };
|
75594
|
+
var import_react21 = require("react");
|
75595
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
75596
|
+
var getClassName21 = get_class_name_factory_default2("PuckFields", styles_module_default16);
|
75474
75597
|
var defaultPageFields = {
|
75475
75598
|
title: { type: "text" }
|
75476
75599
|
};
|
75477
75600
|
var DefaultFields = ({
|
75478
75601
|
children
|
75479
75602
|
}) => {
|
75480
|
-
return /* @__PURE__ */ (0,
|
75603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children });
|
75481
75604
|
};
|
75482
75605
|
var useResolvedFields = () => {
|
75483
75606
|
var _a3;
|
@@ -75487,14 +75610,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75487
75610
|
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
75488
75611
|
const defaultFields = selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields;
|
75489
75612
|
const rootProps = data.root.props || data.root;
|
75490
|
-
const [lastSelectedData, setLastSelectedData] = (0,
|
75613
|
+
const [lastSelectedData, setLastSelectedData] = (0, import_react21.useState)(
|
75491
75614
|
{}
|
75492
75615
|
);
|
75493
|
-
const [resolvedFields, setResolvedFields] = (0,
|
75494
|
-
const [fieldsLoading, setFieldsLoading] = (0,
|
75616
|
+
const [resolvedFields, setResolvedFields] = (0, import_react21.useState)(defaultFields || {});
|
75617
|
+
const [fieldsLoading, setFieldsLoading] = (0, import_react21.useState)(false);
|
75495
75618
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
75496
75619
|
const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
|
75497
|
-
const resolveFields = (0,
|
75620
|
+
const resolveFields = (0, import_react21.useCallback)(
|
75498
75621
|
(..._0) => __async2(void 0, [..._0], function* (fields = {}) {
|
75499
75622
|
var _a22, _b2, _c;
|
75500
75623
|
const lastData = ((_a22 = lastSelectedData.props) == null ? void 0 : _a22.id) === componentData.props.id ? lastSelectedData : {};
|
@@ -75530,7 +75653,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75530
75653
|
}),
|
75531
75654
|
[data, config, componentData, selectedItem, resolvedFields, state]
|
75532
75655
|
);
|
75533
|
-
(0,
|
75656
|
+
(0, import_react21.useEffect)(() => {
|
75534
75657
|
setFieldsLoading(true);
|
75535
75658
|
resolveFields(defaultFields).then((fields) => {
|
75536
75659
|
setResolvedFields(fields || {});
|
@@ -75548,7 +75671,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75548
75671
|
config,
|
75549
75672
|
resolveData,
|
75550
75673
|
componentState,
|
75551
|
-
overrides
|
75674
|
+
overrides,
|
75675
|
+
globalPermissions
|
75552
75676
|
} = useAppContext2();
|
75553
75677
|
const { data, ui } = state;
|
75554
75678
|
const { itemSelector } = ui;
|
@@ -75556,16 +75680,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75556
75680
|
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;
|
75557
75681
|
const isLoading = fieldsResolving || componentResolving;
|
75558
75682
|
const rootProps = data.root.props || data.root;
|
75559
|
-
const Wrapper = (0,
|
75560
|
-
return /* @__PURE__ */ (0,
|
75683
|
+
const Wrapper = (0, import_react21.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
75684
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
75561
75685
|
"form",
|
75562
75686
|
{
|
75563
|
-
className:
|
75687
|
+
className: getClassName21(),
|
75564
75688
|
onSubmit: (e2) => {
|
75565
75689
|
e2.preventDefault();
|
75566
75690
|
},
|
75567
75691
|
children: [
|
75568
|
-
/* @__PURE__ */ (0,
|
75692
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
|
75569
75693
|
const field = fields[fieldName];
|
75570
75694
|
if (!(field == null ? void 0 : field.type)) return null;
|
75571
75695
|
const onChange = (value, updatedUi) => {
|
@@ -75632,13 +75756,18 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75632
75756
|
};
|
75633
75757
|
if (selectedItem && itemSelector) {
|
75634
75758
|
const { readOnly = {} } = selectedItem;
|
75635
|
-
|
75759
|
+
const { edit } = getPermissions({
|
75760
|
+
selectedItem,
|
75761
|
+
config,
|
75762
|
+
globalPermissions: globalPermissions || {}
|
75763
|
+
});
|
75764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
75636
75765
|
AutoFieldPrivate,
|
75637
75766
|
{
|
75638
75767
|
field,
|
75639
75768
|
name: fieldName,
|
75640
75769
|
id: `${selectedItem.props.id}_${fieldName}`,
|
75641
|
-
readOnly: readOnly[fieldName],
|
75770
|
+
readOnly: !edit || readOnly[fieldName],
|
75642
75771
|
value: selectedItem.props[fieldName],
|
75643
75772
|
onChange
|
75644
75773
|
},
|
@@ -75646,7 +75775,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75646
75775
|
);
|
75647
75776
|
} else {
|
75648
75777
|
const { readOnly = {} } = data.root;
|
75649
|
-
return /* @__PURE__ */ (0,
|
75778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
75650
75779
|
AutoFieldPrivate,
|
75651
75780
|
{
|
75652
75781
|
field,
|
@@ -75660,26 +75789,40 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75660
75789
|
);
|
75661
75790
|
}
|
75662
75791
|
}) }),
|
75663
|
-
isLoading && /* @__PURE__ */ (0,
|
75792
|
+
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 }) }) })
|
75664
75793
|
]
|
75665
75794
|
}
|
75666
75795
|
);
|
75667
75796
|
};
|
75668
75797
|
init_react_import2();
|
75669
75798
|
init_react_import2();
|
75670
|
-
var
|
75799
|
+
var import_react222 = require("react");
|
75671
75800
|
init_react_import2();
|
75672
75801
|
init_react_import2();
|
75673
|
-
var
|
75674
|
-
var
|
75675
|
-
var
|
75802
|
+
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" };
|
75803
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
75804
|
+
var getClassName222 = get_class_name_factory_default2("ComponentList", styles_module_default17);
|
75676
75805
|
var ComponentListItem = ({
|
75677
75806
|
name,
|
75678
75807
|
label,
|
75679
75808
|
index
|
75680
75809
|
}) => {
|
75681
|
-
const { overrides } = useAppContext2();
|
75682
|
-
|
75810
|
+
const { overrides, config, globalPermissions } = useAppContext2();
|
75811
|
+
const canInsert = getPermissions({
|
75812
|
+
type: name,
|
75813
|
+
config,
|
75814
|
+
globalPermissions: globalPermissions || {}
|
75815
|
+
}).insert;
|
75816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
75817
|
+
Drawer.Item,
|
75818
|
+
{
|
75819
|
+
label,
|
75820
|
+
name,
|
75821
|
+
index,
|
75822
|
+
isDragDisabled: !canInsert,
|
75823
|
+
children: overrides.componentItem
|
75824
|
+
}
|
75825
|
+
);
|
75683
75826
|
};
|
75684
75827
|
var ComponentList = ({
|
75685
75828
|
children,
|
@@ -75688,11 +75831,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75688
75831
|
}) => {
|
75689
75832
|
const { config, state, setUi } = useAppContext2();
|
75690
75833
|
const { expanded = true } = state.ui.componentList[id] || {};
|
75691
|
-
return /* @__PURE__ */ (0,
|
75692
|
-
title && /* @__PURE__ */ (0,
|
75834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName222({ isExpanded: expanded }), children: [
|
75835
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
75693
75836
|
"button",
|
75694
75837
|
{
|
75695
|
-
className:
|
75838
|
+
className: getClassName222("title"),
|
75696
75839
|
onClick: () => setUi({
|
75697
75840
|
componentList: __spreadProps2(__spreadValues2({}, state.ui.componentList), {
|
75698
75841
|
[id]: __spreadProps2(__spreadValues2({}, state.ui.componentList[id]), {
|
@@ -75702,14 +75845,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75702
75845
|
}),
|
75703
75846
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
75704
75847
|
children: [
|
75705
|
-
/* @__PURE__ */ (0,
|
75706
|
-
/* @__PURE__ */ (0,
|
75848
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: title }),
|
75849
|
+
/* @__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 }) })
|
75707
75850
|
]
|
75708
75851
|
}
|
75709
75852
|
),
|
75710
|
-
/* @__PURE__ */ (0,
|
75853
|
+
/* @__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) => {
|
75711
75854
|
var _a3;
|
75712
|
-
return /* @__PURE__ */ (0,
|
75855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
75713
75856
|
ComponentListItem,
|
75714
75857
|
{
|
75715
75858
|
label: (_a3 = config.components[componentKey]["label"]) != null ? _a3 : componentKey,
|
@@ -75722,10 +75865,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75722
75865
|
] });
|
75723
75866
|
};
|
75724
75867
|
ComponentList.Item = ComponentListItem;
|
75725
|
-
var
|
75868
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
75726
75869
|
var useComponentList = (config, ui) => {
|
75727
|
-
const [componentList, setComponentList] = (0,
|
75728
|
-
(0,
|
75870
|
+
const [componentList, setComponentList] = (0, import_react222.useState)();
|
75871
|
+
(0, import_react222.useEffect)(() => {
|
75729
75872
|
var _a3, _b2, _c;
|
75730
75873
|
if (Object.keys(ui.componentList).length > 0) {
|
75731
75874
|
const matchedComponents = [];
|
@@ -75735,7 +75878,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75735
75878
|
if (category.visible === false || !category.components) {
|
75736
75879
|
return null;
|
75737
75880
|
}
|
75738
|
-
return /* @__PURE__ */ (0,
|
75881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
75739
75882
|
ComponentList,
|
75740
75883
|
{
|
75741
75884
|
id: categoryKey,
|
@@ -75744,7 +75887,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75744
75887
|
var _a22;
|
75745
75888
|
matchedComponents.push(componentName);
|
75746
75889
|
const componentConf = config.components[componentName] || {};
|
75747
|
-
return /* @__PURE__ */ (0,
|
75890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
75748
75891
|
ComponentList.Item,
|
75749
75892
|
{
|
75750
75893
|
label: (_a22 = componentConf["label"]) != null ? _a22 : componentName,
|
@@ -75764,7 +75907,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75764
75907
|
);
|
75765
75908
|
if (remainingComponents.length > 0 && !((_a3 = ui.componentList.other) == null ? void 0 : _a3.components) && ((_b2 = ui.componentList.other) == null ? void 0 : _b2.visible) !== false) {
|
75766
75909
|
_componentList.push(
|
75767
|
-
/* @__PURE__ */ (0,
|
75910
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
75768
75911
|
ComponentList,
|
75769
75912
|
{
|
75770
75913
|
id: "other",
|
@@ -75772,7 +75915,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75772
75915
|
children: remainingComponents.map((componentName, i2) => {
|
75773
75916
|
var _a22;
|
75774
75917
|
const componentConf = config.components[componentName] || {};
|
75775
|
-
return /* @__PURE__ */ (0,
|
75918
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
75776
75919
|
ComponentList.Item,
|
75777
75920
|
{
|
75778
75921
|
name: componentName,
|
@@ -75792,21 +75935,21 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75792
75935
|
}, [config.categories, config.components, ui.componentList]);
|
75793
75936
|
return componentList;
|
75794
75937
|
};
|
75795
|
-
var
|
75796
|
-
var
|
75938
|
+
var import_react23 = require("react");
|
75939
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
75797
75940
|
var Components = () => {
|
75798
75941
|
const { config, state, overrides } = useAppContext2();
|
75799
75942
|
const componentList = useComponentList(config, state.ui);
|
75800
|
-
const Wrapper = (0,
|
75801
|
-
return /* @__PURE__ */ (0,
|
75943
|
+
const Wrapper = (0, import_react23.useMemo)(() => overrides.components || "div", [overrides]);
|
75944
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ComponentList, { id: "all" }) });
|
75802
75945
|
};
|
75803
75946
|
init_react_import2();
|
75804
|
-
var
|
75947
|
+
var import_react25 = require("react");
|
75805
75948
|
init_react_import2();
|
75806
|
-
var
|
75949
|
+
var import_react24 = __toESM2(require("react"));
|
75807
75950
|
var import_react_frame_component = __toESM2(require_lib());
|
75808
75951
|
var import_object_hash = __toESM2(require_object_hash());
|
75809
|
-
var
|
75952
|
+
var import_jsx_runtime322 = require("react/jsx-runtime");
|
75810
75953
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
75811
75954
|
var collectStyles = (doc) => {
|
75812
75955
|
const collected = [];
|
@@ -75849,7 +75992,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
75849
75992
|
onStylesLoaded = () => null
|
75850
75993
|
}) => {
|
75851
75994
|
const { document: doc, window: win } = (0, import_react_frame_component.useFrame)();
|
75852
|
-
(0,
|
75995
|
+
(0, import_react24.useEffect)(() => {
|
75853
75996
|
if (!win || !doc) {
|
75854
75997
|
return () => {
|
75855
75998
|
};
|
@@ -76006,23 +76149,23 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76006
76149
|
observer.disconnect();
|
76007
76150
|
};
|
76008
76151
|
}, []);
|
76009
|
-
return /* @__PURE__ */ (0,
|
76152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime322.jsx)(import_jsx_runtime322.Fragment, { children });
|
76010
76153
|
};
|
76011
|
-
var AutoFrameComponent =
|
76154
|
+
var AutoFrameComponent = import_react24.default.forwardRef(
|
76012
76155
|
function(_a3, ref2) {
|
76013
76156
|
var _b2 = _a3, { children, debug, onStylesLoaded } = _b2, props = __objRest2(_b2, ["children", "debug", "onStylesLoaded"]);
|
76014
|
-
return /* @__PURE__ */ (0,
|
76157
|
+
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 }) }));
|
76015
76158
|
}
|
76016
76159
|
);
|
76017
76160
|
AutoFrameComponent.displayName = "AutoFrameComponent";
|
76018
76161
|
var AutoFrame_default = AutoFrameComponent;
|
76019
76162
|
init_react_import2();
|
76020
|
-
var
|
76021
|
-
var
|
76022
|
-
var
|
76163
|
+
var styles_module_default18 = { "PuckPreview": "_PuckPreview_rxwlr_1", "PuckPreview-frame": "_PuckPreview-frame_rxwlr_5" };
|
76164
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
76165
|
+
var getClassName23 = get_class_name_factory_default2("PuckPreview", styles_module_default18);
|
76023
76166
|
var Preview = ({ id = "puck-preview" }) => {
|
76024
76167
|
const { config, dispatch, state, setStatus, iframe } = useAppContext2();
|
76025
|
-
const Page = (0,
|
76168
|
+
const Page = (0, import_react25.useCallback)(
|
76026
76169
|
(pageProps) => {
|
76027
76170
|
var _a3, _b2;
|
76028
76171
|
return ((_a3 = config.root) == null ? void 0 : _a3.render) ? (_b2 = config.root) == null ? void 0 : _b2.render(__spreadProps2(__spreadValues2({
|
@@ -76031,33 +76174,33 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76031
76174
|
editMode: true,
|
76032
76175
|
// DEPRECATED
|
76033
76176
|
puck: { renderDropZone: DropZone, isEditing: true }
|
76034
|
-
})) : /* @__PURE__ */ (0,
|
76177
|
+
})) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: pageProps.children });
|
76035
76178
|
},
|
76036
76179
|
[config.root]
|
76037
76180
|
);
|
76038
76181
|
const rootProps = state.data.root.props || state.data.root;
|
76039
|
-
const ref2 = (0,
|
76040
|
-
return /* @__PURE__ */ (0,
|
76182
|
+
const ref2 = (0, import_react25.useRef)(null);
|
76183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
76041
76184
|
"div",
|
76042
76185
|
{
|
76043
|
-
className:
|
76186
|
+
className: getClassName23(),
|
76044
76187
|
id,
|
76045
76188
|
onClick: () => {
|
76046
76189
|
dispatch({ type: "setUi", ui: __spreadProps2(__spreadValues2({}, state.ui), { itemSelector: null }) });
|
76047
76190
|
},
|
76048
|
-
children: iframe.enabled ? /* @__PURE__ */ (0,
|
76191
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
76049
76192
|
AutoFrame_default,
|
76050
76193
|
{
|
76051
76194
|
id: "preview-frame",
|
76052
|
-
className:
|
76195
|
+
className: getClassName23("frame"),
|
76053
76196
|
"data-rfd-iframe": true,
|
76054
76197
|
ref: ref2,
|
76055
76198
|
onStylesLoaded: () => {
|
76056
76199
|
setStatus("READY");
|
76057
76200
|
},
|
76058
|
-
children: /* @__PURE__ */ (0,
|
76201
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Page, __spreadProps2(__spreadValues2({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId2 }) }))
|
76059
76202
|
}
|
76060
|
-
) : /* @__PURE__ */ (0,
|
76203
|
+
) : /* @__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 }) })) })
|
76061
76204
|
}
|
76062
76205
|
);
|
76063
76206
|
};
|
@@ -76079,7 +76222,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76079
76222
|
};
|
76080
76223
|
init_react_import2();
|
76081
76224
|
init_react_import2();
|
76082
|
-
var
|
76225
|
+
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" };
|
76083
76226
|
init_react_import2();
|
76084
76227
|
var scrollIntoView2 = (el) => {
|
76085
76228
|
const oldStyle = __spreadValues2({}, el.style);
|
@@ -76089,7 +76232,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76089
76232
|
el.style.scrollMargin = oldStyle.scrollMargin || "";
|
76090
76233
|
}
|
76091
76234
|
};
|
76092
|
-
var
|
76235
|
+
var import_react26 = require("react");
|
76093
76236
|
init_react_import2();
|
76094
76237
|
var isChildOfZone = (item, maybeChild, ctx) => {
|
76095
76238
|
var _a3;
|
@@ -76099,9 +76242,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76099
76242
|
return area === item.props.id;
|
76100
76243
|
})) : false;
|
76101
76244
|
};
|
76102
|
-
var
|
76103
|
-
var
|
76104
|
-
var getClassNameLayer = get_class_name_factory_default2("Layer",
|
76245
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
76246
|
+
var getClassName24 = get_class_name_factory_default2("LayerTree", styles_module_default19);
|
76247
|
+
var getClassNameLayer = get_class_name_factory_default2("Layer", styles_module_default19);
|
76105
76248
|
var LayerTree = ({
|
76106
76249
|
data,
|
76107
76250
|
config,
|
@@ -76112,15 +76255,15 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76112
76255
|
label
|
76113
76256
|
}) => {
|
76114
76257
|
const zones = data.zones || {};
|
76115
|
-
const ctx = (0,
|
76116
|
-
return /* @__PURE__ */ (0,
|
76117
|
-
label && /* @__PURE__ */ (0,
|
76118
|
-
/* @__PURE__ */ (0,
|
76258
|
+
const ctx = (0, import_react26.useContext)(dropZoneContext2);
|
76259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
76260
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
|
76261
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Layers, { size: "16" }) }),
|
76119
76262
|
" ",
|
76120
76263
|
label
|
76121
76264
|
] }),
|
76122
|
-
/* @__PURE__ */ (0,
|
76123
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
76265
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("ul", { className: getClassName24(), children: [
|
76266
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
|
76124
76267
|
zoneContent.map((item, i2) => {
|
76125
76268
|
var _a3;
|
76126
76269
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i2 && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId2 && !zone);
|
@@ -76138,7 +76281,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76138
76281
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
76139
76282
|
const componentConfig = config.components[item.type];
|
76140
76283
|
const label2 = (_a3 = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a3 : item.type.toString();
|
76141
|
-
return /* @__PURE__ */ (0,
|
76284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
76142
76285
|
"li",
|
76143
76286
|
{
|
76144
76287
|
className: getClassNameLayer({
|
@@ -76148,7 +76291,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76148
76291
|
childIsSelected
|
76149
76292
|
}),
|
76150
76293
|
children: [
|
76151
|
-
/* @__PURE__ */ (0,
|
76294
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
76152
76295
|
"button",
|
76153
76296
|
{
|
76154
76297
|
className: getClassNameLayer("clickable"),
|
@@ -76180,22 +76323,22 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76180
76323
|
setHoveringComponent(null);
|
76181
76324
|
},
|
76182
76325
|
children: [
|
76183
|
-
containsZone && /* @__PURE__ */ (0,
|
76326
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
76184
76327
|
"div",
|
76185
76328
|
{
|
76186
76329
|
className: getClassNameLayer("chevron"),
|
76187
76330
|
title: isSelected ? "Collapse" : "Expand",
|
76188
|
-
children: /* @__PURE__ */ (0,
|
76331
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { size: "12" })
|
76189
76332
|
}
|
76190
76333
|
),
|
76191
|
-
/* @__PURE__ */ (0,
|
76192
|
-
/* @__PURE__ */ (0,
|
76193
|
-
/* @__PURE__ */ (0,
|
76334
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
76335
|
+
/* @__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" }) }),
|
76336
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("name"), children: label2 })
|
76194
76337
|
] })
|
76195
76338
|
]
|
76196
76339
|
}
|
76197
76340
|
) }),
|
76198
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
76341
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
76199
76342
|
LayerTree,
|
76200
76343
|
{
|
76201
76344
|
config,
|
@@ -76215,13 +76358,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76215
76358
|
] })
|
76216
76359
|
] });
|
76217
76360
|
};
|
76218
|
-
var
|
76219
|
-
var
|
76361
|
+
var import_react27 = require("react");
|
76362
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
76220
76363
|
var Outline = () => {
|
76221
76364
|
const { dispatch, state, overrides, config } = useAppContext2();
|
76222
76365
|
const { data, ui } = state;
|
76223
76366
|
const { itemSelector } = ui;
|
76224
|
-
const setItemSelector = (0,
|
76367
|
+
const setItemSelector = (0, import_react27.useCallback)(
|
76225
76368
|
(newItemSelector) => {
|
76226
76369
|
dispatch({
|
76227
76370
|
type: "setUi",
|
@@ -76230,9 +76373,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76230
76373
|
},
|
76231
76374
|
[]
|
76232
76375
|
);
|
76233
|
-
const Wrapper = (0,
|
76234
|
-
return /* @__PURE__ */ (0,
|
76235
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId2]) && /* @__PURE__ */ (0,
|
76376
|
+
const Wrapper = (0, import_react27.useMemo)(() => overrides.outline || "div", [overrides]);
|
76377
|
+
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: [
|
76378
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId2]) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
76236
76379
|
LayerTree,
|
76237
76380
|
{
|
76238
76381
|
config,
|
@@ -76245,7 +76388,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76245
76388
|
),
|
76246
76389
|
Object.entries(findZonesForArea(data, "root")).map(
|
76247
76390
|
([zoneKey, zone]) => {
|
76248
|
-
return /* @__PURE__ */ (0,
|
76391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
76249
76392
|
LayerTree,
|
76250
76393
|
{
|
76251
76394
|
config,
|
@@ -76263,35 +76406,6 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76263
76406
|
] }) }) });
|
76264
76407
|
};
|
76265
76408
|
init_react_import2();
|
76266
|
-
var loadOverrides = ({
|
76267
|
-
overrides,
|
76268
|
-
plugins
|
76269
|
-
}) => {
|
76270
|
-
const collected = __spreadValues2({}, overrides);
|
76271
|
-
plugins.forEach((plugin) => {
|
76272
|
-
Object.keys(plugin.overrides).forEach((overridesType) => {
|
76273
|
-
if (overridesType === "fieldTypes") {
|
76274
|
-
const fieldTypes = plugin.overrides.fieldTypes;
|
76275
|
-
Object.keys(fieldTypes).forEach((fieldType) => {
|
76276
|
-
collected.fieldTypes = collected.fieldTypes || {};
|
76277
|
-
const childNode2 = collected.fieldTypes[fieldType];
|
76278
|
-
const Comp2 = (props) => fieldTypes[fieldType](__spreadProps2(__spreadValues2({}, props), {
|
76279
|
-
children: childNode2 ? childNode2(props) : props.children
|
76280
|
-
}));
|
76281
|
-
collected.fieldTypes[fieldType] = Comp2;
|
76282
|
-
});
|
76283
|
-
return;
|
76284
|
-
}
|
76285
|
-
const childNode = collected[overridesType];
|
76286
|
-
const Comp = (props) => plugin.overrides[overridesType](__spreadProps2(__spreadValues2({}, props), {
|
76287
|
-
children: childNode ? childNode(props) : props.children
|
76288
|
-
}));
|
76289
|
-
collected[overridesType] = Comp;
|
76290
|
-
});
|
76291
|
-
});
|
76292
|
-
return collected;
|
76293
|
-
};
|
76294
|
-
init_react_import2();
|
76295
76409
|
var import_react_hotkeys_hook = (init_react_hotkeys_hook_esm(), __toCommonJS(react_hotkeys_hook_esm_exports));
|
76296
76410
|
function usePuckHistory({
|
76297
76411
|
dispatch,
|
@@ -76344,19 +76458,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76344
76458
|
};
|
76345
76459
|
}
|
76346
76460
|
init_react_import2();
|
76347
|
-
var
|
76461
|
+
var import_react28 = require("react");
|
76348
76462
|
var import_use_debounce3 = (init_index_module(), __toCommonJS(index_module_exports));
|
76349
76463
|
var EMPTY_HISTORY_INDEX = -1;
|
76350
76464
|
function useHistoryStore(initialHistory) {
|
76351
76465
|
var _a3, _b2;
|
76352
|
-
const [histories, setHistories] = (0,
|
76466
|
+
const [histories, setHistories] = (0, import_react28.useState)(
|
76353
76467
|
(_a3 = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a3 : []
|
76354
76468
|
);
|
76355
76469
|
const updateHistories = (histories2) => {
|
76356
76470
|
setHistories(histories2);
|
76357
76471
|
setIndex(histories2.length - 1);
|
76358
76472
|
};
|
76359
|
-
const [index, setIndex] = (0,
|
76473
|
+
const [index, setIndex] = (0, import_react28.useState)(
|
76360
76474
|
(_b2 = initialHistory == null ? void 0 : initialHistory.index) != null ? _b2 : EMPTY_HISTORY_INDEX
|
76361
76475
|
);
|
76362
76476
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
@@ -76506,19 +76620,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76506
76620
|
var styles = window.getComputedStyle(el);
|
76507
76621
|
return calculateBox3(borderBox, styles);
|
76508
76622
|
};
|
76509
|
-
var
|
76623
|
+
var import_react30 = require("react");
|
76510
76624
|
init_react_import2();
|
76511
|
-
var
|
76625
|
+
var import_react29 = require("react");
|
76512
76626
|
init_react_import2();
|
76513
|
-
var
|
76514
|
-
var
|
76627
|
+
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" };
|
76628
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
76515
76629
|
var icons = {
|
76516
|
-
Smartphone: /* @__PURE__ */ (0,
|
76517
|
-
Tablet: /* @__PURE__ */ (0,
|
76518
|
-
Monitor: /* @__PURE__ */ (0,
|
76630
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Smartphone, { size: 16 }),
|
76631
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Tablet, { size: 16 }),
|
76632
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Monitor, { size: 16 })
|
76519
76633
|
};
|
76520
|
-
var
|
76521
|
-
var getClassNameButton = get_class_name_factory_default2("ViewportButton",
|
76634
|
+
var getClassName25 = get_class_name_factory_default2("ViewportControls", styles_module_default20);
|
76635
|
+
var getClassNameButton = get_class_name_factory_default2("ViewportButton", styles_module_default20);
|
76522
76636
|
var ViewportButton = ({
|
76523
76637
|
children,
|
76524
76638
|
height = "auto",
|
@@ -76527,11 +76641,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76527
76641
|
onClick
|
76528
76642
|
}) => {
|
76529
76643
|
const { state } = useAppContext2();
|
76530
|
-
const [isActive2, setIsActive] = (0,
|
76531
|
-
(0,
|
76644
|
+
const [isActive2, setIsActive] = (0, import_react29.useState)(false);
|
76645
|
+
(0, import_react29.useEffect)(() => {
|
76532
76646
|
setIsActive(width === state.ui.viewports.current.width);
|
76533
76647
|
}, [width, state.ui.viewports.current.width]);
|
76534
|
-
return /* @__PURE__ */ (0,
|
76648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton({ isActive: isActive2 }), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76535
76649
|
IconButton,
|
76536
76650
|
{
|
76537
76651
|
title,
|
@@ -76540,7 +76654,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76540
76654
|
e2.stopPropagation();
|
76541
76655
|
onClick({ width, height });
|
76542
76656
|
},
|
76543
|
-
children: /* @__PURE__ */ (0,
|
76657
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton("inner"), children })
|
76544
76658
|
}
|
76545
76659
|
) });
|
76546
76660
|
};
|
@@ -76564,7 +76678,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76564
76678
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
76565
76679
|
(option) => option.value === autoZoom
|
76566
76680
|
);
|
76567
|
-
const zoomOptions = (0,
|
76681
|
+
const zoomOptions = (0, import_react29.useMemo)(
|
76568
76682
|
() => [
|
76569
76683
|
...defaultZoomOptions,
|
76570
76684
|
...defaultsContainAutoZoom ? [] : [
|
@@ -76576,8 +76690,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76576
76690
|
].filter((a2) => a2.value <= autoZoom).sort((a2, b) => a2.value > b.value ? 1 : -1),
|
76577
76691
|
[autoZoom]
|
76578
76692
|
);
|
76579
|
-
return /* @__PURE__ */ (0,
|
76580
|
-
viewports.map((viewport, i2) => /* @__PURE__ */ (0,
|
76693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassName25(), children: [
|
76694
|
+
viewports.map((viewport, i2) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76581
76695
|
ViewportButton,
|
76582
76696
|
{
|
76583
76697
|
height: viewport.height,
|
@@ -76588,8 +76702,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76588
76702
|
},
|
76589
76703
|
i2
|
76590
76704
|
)),
|
76591
|
-
/* @__PURE__ */ (0,
|
76592
|
-
/* @__PURE__ */ (0,
|
76705
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
|
76706
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76593
76707
|
IconButton,
|
76594
76708
|
{
|
76595
76709
|
title: "Zoom viewport out",
|
@@ -76603,10 +76717,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76603
76717
|
)].value
|
76604
76718
|
);
|
76605
76719
|
},
|
76606
|
-
children: /* @__PURE__ */ (0,
|
76720
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomOut, { size: 16 })
|
76607
76721
|
}
|
76608
76722
|
),
|
76609
|
-
/* @__PURE__ */ (0,
|
76723
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76610
76724
|
IconButton,
|
76611
76725
|
{
|
76612
76726
|
title: "Zoom viewport in",
|
@@ -76620,19 +76734,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76620
76734
|
)].value
|
76621
76735
|
);
|
76622
76736
|
},
|
76623
|
-
children: /* @__PURE__ */ (0,
|
76737
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomIn, { size: 16 })
|
76624
76738
|
}
|
76625
76739
|
),
|
76626
|
-
/* @__PURE__ */ (0,
|
76627
|
-
/* @__PURE__ */ (0,
|
76740
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
|
76741
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76628
76742
|
"select",
|
76629
76743
|
{
|
76630
|
-
className:
|
76744
|
+
className: getClassName25("zoomSelect"),
|
76631
76745
|
value: zoom.toString(),
|
76632
76746
|
onChange: (e2) => {
|
76633
76747
|
onZoom(parseFloat(e2.currentTarget.value));
|
76634
76748
|
},
|
76635
|
-
children: zoomOptions.map((option) => /* @__PURE__ */ (0,
|
76749
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
76636
76750
|
"option",
|
76637
76751
|
{
|
76638
76752
|
value: option.value,
|
@@ -76645,7 +76759,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76645
76759
|
] });
|
76646
76760
|
};
|
76647
76761
|
init_react_import2();
|
76648
|
-
var
|
76762
|
+
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" };
|
76649
76763
|
init_react_import2();
|
76650
76764
|
var RESET_ZOOM_SMALLER_THAN_FRAME = true;
|
76651
76765
|
var getZoomConfig = (uiViewport, frame, zoom) => {
|
@@ -76674,24 +76788,24 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76674
76788
|
}
|
76675
76789
|
return { autoZoom, rootHeight, zoom };
|
76676
76790
|
};
|
76677
|
-
var
|
76678
|
-
var
|
76791
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
76792
|
+
var getClassName26 = get_class_name_factory_default2("PuckCanvas", styles_module_default21);
|
76679
76793
|
var ZOOM_ON_CHANGE = true;
|
76680
76794
|
var Canvas = () => {
|
76681
76795
|
const { status, iframe } = useAppContext2();
|
76682
76796
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext2();
|
76683
76797
|
const { ui } = state;
|
76684
|
-
const frameRef = (0,
|
76685
|
-
const [showTransition, setShowTransition] = (0,
|
76686
|
-
const defaultRender = (0,
|
76687
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */ (0,
|
76798
|
+
const frameRef = (0, import_react30.useRef)(null);
|
76799
|
+
const [showTransition, setShowTransition] = (0, import_react30.useState)(false);
|
76800
|
+
const defaultRender = (0, import_react30.useMemo)(() => {
|
76801
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children });
|
76688
76802
|
return PuckDefault;
|
76689
76803
|
}, []);
|
76690
|
-
const CustomPreview = (0,
|
76804
|
+
const CustomPreview = (0, import_react30.useMemo)(
|
76691
76805
|
() => overrides.preview || defaultRender,
|
76692
76806
|
[overrides]
|
76693
76807
|
);
|
76694
|
-
const getFrameDimensions = (0,
|
76808
|
+
const getFrameDimensions = (0, import_react30.useCallback)(() => {
|
76695
76809
|
if (frameRef.current) {
|
76696
76810
|
const frame = frameRef.current;
|
76697
76811
|
const box = getBox3(frame);
|
@@ -76699,7 +76813,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76699
76813
|
}
|
76700
76814
|
return { width: 0, height: 0 };
|
76701
76815
|
}, [frameRef]);
|
76702
|
-
const resetAutoZoom = (0,
|
76816
|
+
const resetAutoZoom = (0, import_react30.useCallback)(
|
76703
76817
|
(ui2 = state.ui) => {
|
76704
76818
|
if (frameRef.current) {
|
76705
76819
|
setZoomConfig(
|
@@ -76709,11 +76823,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76709
76823
|
},
|
76710
76824
|
[frameRef, zoomConfig, state.ui]
|
76711
76825
|
);
|
76712
|
-
(0,
|
76826
|
+
(0, import_react30.useEffect)(() => {
|
76713
76827
|
setShowTransition(false);
|
76714
76828
|
resetAutoZoom();
|
76715
76829
|
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
76716
|
-
(0,
|
76830
|
+
(0, import_react30.useEffect)(() => {
|
76717
76831
|
const { height: frameHeight } = getFrameDimensions();
|
76718
76832
|
if (ui.viewports.current.height === "auto") {
|
76719
76833
|
setZoomConfig(__spreadProps2(__spreadValues2({}, zoomConfig), {
|
@@ -76721,7 +76835,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76721
76835
|
}));
|
76722
76836
|
}
|
76723
76837
|
}, [zoomConfig.zoom]);
|
76724
|
-
(0,
|
76838
|
+
(0, import_react30.useEffect)(() => {
|
76725
76839
|
const observer = new ResizeObserver(() => {
|
76726
76840
|
setShowTransition(false);
|
76727
76841
|
resetAutoZoom();
|
@@ -76733,10 +76847,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76733
76847
|
observer.disconnect();
|
76734
76848
|
};
|
76735
76849
|
}, []);
|
76736
|
-
return /* @__PURE__ */ (0,
|
76850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
76737
76851
|
"div",
|
76738
76852
|
{
|
76739
|
-
className:
|
76853
|
+
className: getClassName26({
|
76740
76854
|
ready: status === "READY" || !iframe.enabled
|
76741
76855
|
}),
|
76742
76856
|
onClick: () => dispatch({
|
@@ -76745,7 +76859,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76745
76859
|
recordHistory: true
|
76746
76860
|
}),
|
76747
76861
|
children: [
|
76748
|
-
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0,
|
76862
|
+
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
76749
76863
|
ViewportControls,
|
76750
76864
|
{
|
76751
76865
|
autoZoom: zoomConfig.autoZoom,
|
@@ -76770,10 +76884,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76770
76884
|
}
|
76771
76885
|
}
|
76772
76886
|
) }),
|
76773
|
-
/* @__PURE__ */ (0,
|
76887
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
76774
76888
|
"div",
|
76775
76889
|
{
|
76776
|
-
className:
|
76890
|
+
className: getClassName26("root"),
|
76777
76891
|
style: {
|
76778
76892
|
width: iframe.enabled ? ui.viewports.current.width : "100%",
|
76779
76893
|
height: zoomConfig.rootHeight,
|
@@ -76782,16 +76896,46 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76782
76896
|
overflow: iframe.enabled ? void 0 : "auto"
|
76783
76897
|
},
|
76784
76898
|
suppressHydrationWarning: true,
|
76785
|
-
children: /* @__PURE__ */ (0,
|
76899
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Preview, {}) })
|
76786
76900
|
}
|
76787
76901
|
) })
|
76788
76902
|
]
|
76789
76903
|
}
|
76790
76904
|
);
|
76791
76905
|
};
|
76792
|
-
|
76793
|
-
var
|
76794
|
-
|
76906
|
+
init_react_import2();
|
76907
|
+
var insertComponent = (componentType, zone, index, {
|
76908
|
+
config,
|
76909
|
+
dispatch,
|
76910
|
+
resolveData,
|
76911
|
+
state
|
76912
|
+
}) => {
|
76913
|
+
const id = generateId(componentType);
|
76914
|
+
const insertActionData = {
|
76915
|
+
type: "insert",
|
76916
|
+
componentType,
|
76917
|
+
destinationIndex: index,
|
76918
|
+
destinationZone: zone,
|
76919
|
+
id
|
76920
|
+
};
|
76921
|
+
const insertedData = insertAction(state.data, insertActionData, config);
|
76922
|
+
dispatch(__spreadProps2(__spreadValues2({}, insertActionData), {
|
76923
|
+
// Dispatch insert rather set, as user's may rely on this via onAction
|
76924
|
+
recordHistory: false
|
76925
|
+
}));
|
76926
|
+
const itemSelector = {
|
76927
|
+
index,
|
76928
|
+
zone
|
76929
|
+
};
|
76930
|
+
dispatch({ type: "setUi", ui: { itemSelector } });
|
76931
|
+
resolveData({
|
76932
|
+
data: insertedData,
|
76933
|
+
ui: __spreadProps2(__spreadValues2({}, state.ui), { itemSelector })
|
76934
|
+
});
|
76935
|
+
};
|
76936
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
76937
|
+
var getClassName27 = get_class_name_factory_default2("Puck", styles_module_default15);
|
76938
|
+
var getLayoutClassName = get_class_name_factory_default2("PuckLayout", styles_module_default15);
|
76795
76939
|
function Puck({
|
76796
76940
|
children,
|
76797
76941
|
config,
|
@@ -76800,6 +76944,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76800
76944
|
onChange,
|
76801
76945
|
onPublish,
|
76802
76946
|
onAction,
|
76947
|
+
permissions = {},
|
76803
76948
|
plugins = [],
|
76804
76949
|
overrides = {},
|
76805
76950
|
renderHeader,
|
@@ -76815,10 +76960,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76815
76960
|
}) {
|
76816
76961
|
var _a3;
|
76817
76962
|
const historyStore = useHistoryStore(initialHistory);
|
76818
|
-
const [reducer2] = (0,
|
76963
|
+
const [reducer2] = (0, import_react31.useState)(
|
76819
76964
|
() => createReducer({ config, record: historyStore.record, onAction })
|
76820
76965
|
);
|
76821
|
-
const [initialAppState] = (0,
|
76966
|
+
const [initialAppState] = (0, import_react31.useState)(() => {
|
76822
76967
|
var _a22, _b2, _c, _d, _e, _f, _g;
|
76823
76968
|
const initial = __spreadValues2(__spreadValues2({}, defaultAppState2.ui), initialUi);
|
76824
76969
|
let clientUiState = {};
|
@@ -76876,7 +77021,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76876
77021
|
})
|
76877
77022
|
});
|
76878
77023
|
});
|
76879
|
-
const [appState, dispatch] = (0,
|
77024
|
+
const [appState, dispatch] = (0, import_react31.useReducer)(
|
76880
77025
|
reducer2,
|
76881
77026
|
flushZones(initialAppState)
|
76882
77027
|
);
|
@@ -76887,9 +77032,9 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76887
77032
|
config,
|
76888
77033
|
dispatch
|
76889
77034
|
);
|
76890
|
-
const [menuOpen, setMenuOpen] = (0,
|
77035
|
+
const [menuOpen, setMenuOpen] = (0, import_react31.useState)(false);
|
76891
77036
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
76892
|
-
const setItemSelector = (0,
|
77037
|
+
const setItemSelector = (0, import_react31.useCallback)(
|
76893
77038
|
(newItemSelector) => {
|
76894
77039
|
if (newItemSelector === itemSelector) return;
|
76895
77040
|
dispatch({
|
@@ -76901,13 +77046,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76901
77046
|
[itemSelector]
|
76902
77047
|
);
|
76903
77048
|
const selectedItem = itemSelector ? getItem2(itemSelector, data) : null;
|
76904
|
-
(0,
|
77049
|
+
(0, import_react31.useEffect)(() => {
|
76905
77050
|
if (onChange) onChange(data);
|
76906
77051
|
}, [data]);
|
76907
77052
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
76908
|
-
const [draggedItem, setDraggedItem] = (0,
|
77053
|
+
const [draggedItem, setDraggedItem] = (0, import_react31.useState)();
|
76909
77054
|
const rootProps = data.root.props || data.root;
|
76910
|
-
const toggleSidebars = (0,
|
77055
|
+
const toggleSidebars = (0, import_react31.useCallback)(
|
76911
77056
|
(sidebar) => {
|
76912
77057
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
76913
77058
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -76921,7 +77066,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76921
77066
|
},
|
76922
77067
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
76923
77068
|
);
|
76924
|
-
(0,
|
77069
|
+
(0, import_react31.useEffect)(() => {
|
76925
77070
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
76926
77071
|
dispatch({
|
76927
77072
|
type: "setUi",
|
@@ -76944,11 +77089,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76944
77089
|
window.removeEventListener("resize", handleResize);
|
76945
77090
|
};
|
76946
77091
|
}, []);
|
76947
|
-
const
|
76948
|
-
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children: children2 });
|
76949
|
-
return PuckDefault;
|
76950
|
-
}, []);
|
76951
|
-
const defaultHeaderRender = (0, import_react30.useMemo)(() => {
|
77092
|
+
const defaultHeaderRender = (0, import_react31.useMemo)(() => {
|
76952
77093
|
if (renderHeader) {
|
76953
77094
|
console.warn(
|
76954
77095
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -76956,48 +77097,49 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
76956
77097
|
const RenderHeader = (_a22) => {
|
76957
77098
|
var _b2 = _a22, { actions } = _b2, props = __objRest2(_b2, ["actions"]);
|
76958
77099
|
const Comp = renderHeader;
|
76959
|
-
return /* @__PURE__ */ (0,
|
77100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState, children: actions }));
|
76960
77101
|
};
|
76961
77102
|
return RenderHeader;
|
76962
77103
|
}
|
76963
|
-
return
|
77104
|
+
return DefaultOverride;
|
76964
77105
|
}, [renderHeader]);
|
76965
|
-
const defaultHeaderActionsRender = (0,
|
77106
|
+
const defaultHeaderActionsRender = (0, import_react31.useMemo)(() => {
|
76966
77107
|
if (renderHeaderActions) {
|
76967
77108
|
console.warn(
|
76968
77109
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
76969
77110
|
);
|
76970
77111
|
const RenderHeader = (props) => {
|
76971
77112
|
const Comp = renderHeaderActions;
|
76972
|
-
return /* @__PURE__ */ (0,
|
77113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Comp, __spreadProps2(__spreadValues2({}, props), { dispatch, state: appState }));
|
76973
77114
|
};
|
76974
77115
|
return RenderHeader;
|
76975
77116
|
}
|
76976
|
-
return
|
77117
|
+
return DefaultOverride;
|
76977
77118
|
}, [renderHeader]);
|
76978
|
-
const loadedOverrides = (
|
76979
|
-
|
76980
|
-
|
76981
|
-
|
76982
|
-
|
77119
|
+
const loadedOverrides = useLoadedOverrides({
|
77120
|
+
overrides,
|
77121
|
+
plugins
|
77122
|
+
});
|
77123
|
+
const CustomPuck = (0, import_react31.useMemo)(
|
77124
|
+
() => loadedOverrides.puck || DefaultOverride,
|
76983
77125
|
[loadedOverrides]
|
76984
77126
|
);
|
76985
|
-
const CustomHeader = (0,
|
77127
|
+
const CustomHeader = (0, import_react31.useMemo)(
|
76986
77128
|
() => loadedOverrides.header || defaultHeaderRender,
|
76987
77129
|
[loadedOverrides]
|
76988
77130
|
);
|
76989
|
-
const CustomHeaderActions = (0,
|
77131
|
+
const CustomHeaderActions = (0, import_react31.useMemo)(
|
76990
77132
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
76991
77133
|
[loadedOverrides]
|
76992
77134
|
);
|
76993
|
-
const [mounted, setMounted] = (0,
|
76994
|
-
(0,
|
77135
|
+
const [mounted, setMounted] = (0, import_react31.useState)(false);
|
77136
|
+
(0, import_react31.useEffect)(() => {
|
76995
77137
|
setMounted(true);
|
76996
77138
|
}, []);
|
76997
77139
|
const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
|
76998
77140
|
const selectedComponentLabel = selectedItem ? (_a3 = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _a3 : selectedItem.type.toString() : "";
|
76999
|
-
return /* @__PURE__ */ (0,
|
77000
|
-
/* @__PURE__ */ (0,
|
77141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: `Puck ${getClassName27()}`, children: [
|
77142
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77001
77143
|
AppProvider,
|
77002
77144
|
{
|
77003
77145
|
value: {
|
@@ -77010,9 +77152,16 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77010
77152
|
overrides: loadedOverrides,
|
77011
77153
|
history,
|
77012
77154
|
viewports,
|
77013
|
-
iframe
|
77155
|
+
iframe,
|
77156
|
+
globalPermissions: __spreadValues2({
|
77157
|
+
delete: true,
|
77158
|
+
drag: true,
|
77159
|
+
duplicate: true,
|
77160
|
+
insert: true,
|
77161
|
+
edit: true
|
77162
|
+
}, permissions)
|
77014
77163
|
},
|
77015
|
-
children: /* @__PURE__ */ (0,
|
77164
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77016
77165
|
DragDropContext2,
|
77017
77166
|
{
|
77018
77167
|
autoScrollerOptions: { disabled: dnd == null ? void 0 : dnd.disableAutoScroll },
|
@@ -77033,16 +77182,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77033
77182
|
}
|
77034
77183
|
if (droppedItem.source.droppableId.startsWith("component-list") && droppedItem.destination) {
|
77035
77184
|
const [_, componentType] = droppedItem.draggableId.split("::");
|
77036
|
-
|
77037
|
-
|
77038
|
-
|
77039
|
-
|
77040
|
-
|
77041
|
-
|
77042
|
-
setItemSelector({
|
77043
|
-
index: droppedItem.destination.index,
|
77044
|
-
zone: droppedItem.destination.droppableId
|
77045
|
-
});
|
77185
|
+
insertComponent(
|
77186
|
+
componentType || droppedItem.draggableId,
|
77187
|
+
droppedItem.destination.droppableId,
|
77188
|
+
droppedItem.destination.index,
|
77189
|
+
{ config, dispatch, resolveData, state: appState }
|
77190
|
+
);
|
77046
77191
|
return;
|
77047
77192
|
} else {
|
77048
77193
|
const { source, destination } = droppedItem;
|
@@ -77068,7 +77213,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77068
77213
|
});
|
77069
77214
|
}
|
77070
77215
|
},
|
77071
|
-
children: /* @__PURE__ */ (0,
|
77216
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77072
77217
|
DropZoneProvider,
|
77073
77218
|
{
|
77074
77219
|
value: {
|
@@ -77082,7 +77227,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77082
77227
|
mode: "edit",
|
77083
77228
|
areaId: "root"
|
77084
77229
|
},
|
77085
|
-
children: /* @__PURE__ */ (0,
|
77230
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77086
77231
|
"div",
|
77087
77232
|
{
|
77088
77233
|
className: getLayoutClassName({
|
@@ -77091,64 +77236,64 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77091
77236
|
mounted,
|
77092
77237
|
rightSideBarVisible
|
77093
77238
|
}),
|
77094
|
-
children: /* @__PURE__ */ (0,
|
77095
|
-
/* @__PURE__ */ (0,
|
77239
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("inner"), children: [
|
77240
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77096
77241
|
CustomHeader,
|
77097
77242
|
{
|
77098
|
-
actions: /* @__PURE__ */ (0,
|
77243
|
+
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)(
|
77099
77244
|
Button,
|
77100
77245
|
{
|
77101
77246
|
onClick: () => {
|
77102
77247
|
onPublish && onPublish(data);
|
77103
77248
|
},
|
77104
|
-
icon: /* @__PURE__ */ (0,
|
77249
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Globe, { size: "14px" }),
|
77105
77250
|
children: "Publish"
|
77106
77251
|
}
|
77107
77252
|
) }) }),
|
77108
|
-
children: /* @__PURE__ */ (0,
|
77109
|
-
/* @__PURE__ */ (0,
|
77110
|
-
/* @__PURE__ */ (0,
|
77253
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerInner"), children: [
|
77254
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerToggle"), children: [
|
77255
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77111
77256
|
"div",
|
77112
77257
|
{
|
77113
77258
|
className: getLayoutClassName(
|
77114
77259
|
"leftSideBarToggle"
|
77115
77260
|
),
|
77116
|
-
children: /* @__PURE__ */ (0,
|
77261
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77117
77262
|
IconButton,
|
77118
77263
|
{
|
77119
77264
|
onClick: () => {
|
77120
77265
|
toggleSidebars("left");
|
77121
77266
|
},
|
77122
77267
|
title: "Toggle left sidebar",
|
77123
|
-
children: /* @__PURE__ */ (0,
|
77268
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelLeft, { focusable: "false" })
|
77124
77269
|
}
|
77125
77270
|
)
|
77126
77271
|
}
|
77127
77272
|
),
|
77128
|
-
/* @__PURE__ */ (0,
|
77273
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77129
77274
|
"div",
|
77130
77275
|
{
|
77131
77276
|
className: getLayoutClassName(
|
77132
77277
|
"rightSideBarToggle"
|
77133
77278
|
),
|
77134
|
-
children: /* @__PURE__ */ (0,
|
77279
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77135
77280
|
IconButton,
|
77136
77281
|
{
|
77137
77282
|
onClick: () => {
|
77138
77283
|
toggleSidebars("right");
|
77139
77284
|
},
|
77140
77285
|
title: "Toggle right sidebar",
|
77141
|
-
children: /* @__PURE__ */ (0,
|
77286
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelRight, { focusable: "false" })
|
77142
77287
|
}
|
77143
77288
|
)
|
77144
77289
|
}
|
77145
77290
|
)
|
77146
77291
|
] }),
|
77147
|
-
/* @__PURE__ */ (0,
|
77292
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Heading2, { rank: 2, size: "xs", children: [
|
77148
77293
|
headerTitle || rootProps.title || "Page",
|
77149
|
-
headerPath && /* @__PURE__ */ (0,
|
77294
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
77150
77295
|
" ",
|
77151
|
-
/* @__PURE__ */ (0,
|
77296
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77152
77297
|
"code",
|
77153
77298
|
{
|
77154
77299
|
className: getLayoutClassName("headerPath"),
|
@@ -77157,18 +77302,18 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77157
77302
|
)
|
77158
77303
|
] })
|
77159
77304
|
] }) }),
|
77160
|
-
/* @__PURE__ */ (0,
|
77161
|
-
/* @__PURE__ */ (0,
|
77305
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerTools"), children: [
|
77306
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77162
77307
|
IconButton,
|
77163
77308
|
{
|
77164
77309
|
onClick: () => {
|
77165
77310
|
return setMenuOpen(!menuOpen);
|
77166
77311
|
},
|
77167
77312
|
title: "Toggle menu bar",
|
77168
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
77313
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronDown, { focusable: "false" })
|
77169
77314
|
}
|
77170
77315
|
) }),
|
77171
|
-
/* @__PURE__ */ (0,
|
77316
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77172
77317
|
MenuBar,
|
77173
77318
|
{
|
77174
77319
|
appState,
|
@@ -77176,13 +77321,13 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77176
77321
|
dispatch,
|
77177
77322
|
onPublish,
|
77178
77323
|
menuOpen,
|
77179
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
77324
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77180
77325
|
Button,
|
77181
77326
|
{
|
77182
77327
|
onClick: () => {
|
77183
77328
|
onPublish && onPublish(data);
|
77184
77329
|
},
|
77185
|
-
icon: /* @__PURE__ */ (0,
|
77330
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Globe, { size: "14px" }),
|
77186
77331
|
children: "Publish"
|
77187
77332
|
}
|
77188
77333
|
) }),
|
@@ -77193,19 +77338,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77193
77338
|
] }) })
|
77194
77339
|
}
|
77195
77340
|
),
|
77196
|
-
/* @__PURE__ */ (0,
|
77197
|
-
/* @__PURE__ */ (0,
|
77198
|
-
/* @__PURE__ */ (0,
|
77341
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
|
77342
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SidebarSection2, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Components, {}) }),
|
77343
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SidebarSection2, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Outline, {}) })
|
77199
77344
|
] }),
|
77200
|
-
/* @__PURE__ */ (0,
|
77201
|
-
/* @__PURE__ */ (0,
|
77345
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Canvas, {}),
|
77346
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
77202
77347
|
SidebarSection2,
|
77203
77348
|
{
|
77204
77349
|
noPadding: true,
|
77205
77350
|
noBorderTop: true,
|
77206
77351
|
showBreadcrumbs: true,
|
77207
77352
|
title: selectedItem ? selectedComponentLabel : "Page",
|
77208
|
-
children: /* @__PURE__ */ (0,
|
77353
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Fields, {})
|
77209
77354
|
}
|
77210
77355
|
) })
|
77211
77356
|
] })
|
@@ -77217,7 +77362,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77217
77362
|
)
|
77218
77363
|
}
|
77219
77364
|
),
|
77220
|
-
/* @__PURE__ */ (0,
|
77365
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { id: "puck-portal-root", className: getClassName27("portal") })
|
77221
77366
|
] });
|
77222
77367
|
}
|
77223
77368
|
Puck.Components = Components;
|
@@ -77225,7 +77370,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77225
77370
|
Puck.Outline = Outline;
|
77226
77371
|
Puck.Preview = Preview;
|
77227
77372
|
init_react_import2();
|
77228
|
-
var
|
77373
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
77229
77374
|
function Render({
|
77230
77375
|
config,
|
77231
77376
|
data
|
@@ -77238,7 +77383,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77238
77383
|
const rootProps = defaultedData.root.props || defaultedData.root;
|
77239
77384
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
77240
77385
|
if ((_a3 = config.root) == null ? void 0 : _a3.render) {
|
77241
|
-
return /* @__PURE__ */ (0,
|
77386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
77242
77387
|
config.root.render,
|
77243
77388
|
__spreadProps2(__spreadValues2({}, rootProps), {
|
77244
77389
|
puck: {
|
@@ -77248,11 +77393,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77248
77393
|
title,
|
77249
77394
|
editMode: false,
|
77250
77395
|
id: "puck-root",
|
77251
|
-
children: /* @__PURE__ */ (0,
|
77396
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZone, { zone: rootDroppableId2 })
|
77252
77397
|
})
|
77253
77398
|
) });
|
77254
77399
|
}
|
77255
|
-
return /* @__PURE__ */ (0,
|
77400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZone, { zone: rootDroppableId2 }) });
|
77256
77401
|
}
|
77257
77402
|
init_react_import2();
|
77258
77403
|
var migrations = [
|
@@ -77348,12 +77493,24 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77348
77493
|
config,
|
77349
77494
|
history,
|
77350
77495
|
dispatch,
|
77351
|
-
selectedItem
|
77496
|
+
selectedItem: currentItem,
|
77497
|
+
globalPermissions
|
77352
77498
|
} = useAppContext2();
|
77353
77499
|
return {
|
77354
77500
|
appState,
|
77355
77501
|
config,
|
77356
77502
|
dispatch,
|
77503
|
+
getPermissions: ({
|
77504
|
+
item,
|
77505
|
+
type
|
77506
|
+
} = {}) => {
|
77507
|
+
return getPermissions({
|
77508
|
+
selectedItem: item || currentItem,
|
77509
|
+
type,
|
77510
|
+
globalPermissions: globalPermissions || {},
|
77511
|
+
config
|
77512
|
+
});
|
77513
|
+
},
|
77357
77514
|
history: {
|
77358
77515
|
back: history.back,
|
77359
77516
|
forward: history.forward,
|
@@ -77365,7 +77522,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
77365
77522
|
index: history.historyStore.index,
|
77366
77523
|
historyStore: history.historyStore
|
77367
77524
|
},
|
77368
|
-
selectedItem:
|
77525
|
+
selectedItem: currentItem || null
|
77369
77526
|
};
|
77370
77527
|
};
|
77371
77528
|
}
|
@@ -77666,7 +77823,8 @@ var defaultContext = {
|
|
77666
77823
|
status: "LOADING",
|
77667
77824
|
setStatus: () => null,
|
77668
77825
|
iframe: {},
|
77669
|
-
safariFallbackMode: false
|
77826
|
+
safariFallbackMode: false,
|
77827
|
+
globalPermissions: {}
|
77670
77828
|
};
|
77671
77829
|
var appContext = (0, import_react10.createContext)(defaultContext);
|
77672
77830
|
function useAppContext() {
|