@measured/puck 0.11.3 → 0.12.0-canary.0b6a527
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +31 -1
- package/dist/Config-60a50493.d.ts +195 -0
- package/dist/index.d.ts +21 -207
- package/dist/index.js +297 -305
- package/dist/rsc.d.ts +10 -0
- package/dist/rsc.js +135 -0
- package/package.json +17 -4
package/dist/index.js
CHANGED
@@ -30213,12 +30213,12 @@ var Button = ({
|
|
30213
30213
|
|
30214
30214
|
// components/DropZone/index.tsx
|
30215
30215
|
init_react_import();
|
30216
|
-
var
|
30216
|
+
var import_react25 = require("react");
|
30217
30217
|
|
30218
30218
|
// components/DraggableComponent/index.tsx
|
30219
30219
|
init_react_import();
|
30220
30220
|
var import_react22 = require("react");
|
30221
|
-
var
|
30221
|
+
var import_dnd = require("@hello-pangea/dnd");
|
30222
30222
|
|
30223
30223
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
30224
30224
|
init_react_import();
|
@@ -31746,7 +31746,7 @@ var DraggableComponent = ({
|
|
31746
31746
|
const isModifierHeld = useModifierHeld("Alt");
|
31747
31747
|
(0, import_react22.useEffect)(onMount, []);
|
31748
31748
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
31749
|
-
|
31749
|
+
import_dnd.Draggable,
|
31750
31750
|
{
|
31751
31751
|
draggableId: id,
|
31752
31752
|
index,
|
@@ -31789,27 +31789,8 @@ var DraggableComponent = ({
|
|
31789
31789
|
);
|
31790
31790
|
};
|
31791
31791
|
|
31792
|
-
// components/
|
31793
|
-
|
31794
|
-
var import_react23 = require("react");
|
31795
|
-
var import_react_beautiful_dnd2 = require("react-beautiful-dnd");
|
31796
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
31797
|
-
var DroppableStrictMode = (_a) => {
|
31798
|
-
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
31799
|
-
const [enabled, setEnabled] = (0, import_react23.useState)(false);
|
31800
|
-
(0, import_react23.useEffect)(() => {
|
31801
|
-
const animation = requestAnimationFrame(() => setEnabled(true));
|
31802
|
-
return () => {
|
31803
|
-
cancelAnimationFrame(animation);
|
31804
|
-
setEnabled(false);
|
31805
|
-
};
|
31806
|
-
}, []);
|
31807
|
-
if (!enabled) {
|
31808
|
-
return null;
|
31809
|
-
}
|
31810
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_beautiful_dnd2.Droppable, __spreadProps(__spreadValues({}, props), { children }));
|
31811
|
-
};
|
31812
|
-
var DroppableStrictMode_default = DroppableStrictMode;
|
31792
|
+
// components/DropZone/index.tsx
|
31793
|
+
var import_dnd2 = require("@hello-pangea/dnd");
|
31813
31794
|
|
31814
31795
|
// lib/get-item.ts
|
31815
31796
|
init_react_import();
|
@@ -31870,7 +31851,7 @@ var styles_module_default2 = { "DropZone": "_DropZone_1akqa_1", "DropZone-conten
|
|
31870
31851
|
|
31871
31852
|
// components/DropZone/context.tsx
|
31872
31853
|
init_react_import();
|
31873
|
-
var
|
31854
|
+
var import_react23 = require("react");
|
31874
31855
|
var import_use_debounce = require("use-debounce");
|
31875
31856
|
|
31876
31857
|
// lib/get-zone-id.ts
|
@@ -31886,30 +31867,30 @@ var getZoneId = (zoneCompound) => {
|
|
31886
31867
|
};
|
31887
31868
|
|
31888
31869
|
// components/DropZone/context.tsx
|
31889
|
-
var
|
31890
|
-
var dropZoneContext = (0,
|
31870
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
31871
|
+
var dropZoneContext = (0, import_react23.createContext)(null);
|
31891
31872
|
var DropZoneProvider = ({
|
31892
31873
|
children,
|
31893
31874
|
value
|
31894
31875
|
}) => {
|
31895
|
-
const [hoveringArea, setHoveringArea] = (0,
|
31896
|
-
const [hoveringZone, setHoveringZone] = (0,
|
31876
|
+
const [hoveringArea, setHoveringArea] = (0, import_react23.useState)(null);
|
31877
|
+
const [hoveringZone, setHoveringZone] = (0, import_react23.useState)(
|
31897
31878
|
rootDroppableId
|
31898
31879
|
);
|
31899
|
-
const [hoveringComponent, setHoveringComponent] = (0,
|
31880
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react23.useState)();
|
31900
31881
|
const [hoveringAreaDb] = (0, import_use_debounce.useDebounce)(hoveringArea, 75, { leading: false });
|
31901
|
-
const [areasWithZones, setAreasWithZones] = (0,
|
31882
|
+
const [areasWithZones, setAreasWithZones] = (0, import_react23.useState)(
|
31902
31883
|
{}
|
31903
31884
|
);
|
31904
|
-
const [activeZones, setActiveZones] = (0,
|
31885
|
+
const [activeZones, setActiveZones] = (0, import_react23.useState)({});
|
31905
31886
|
const { dispatch = null } = value ? value : {};
|
31906
|
-
const registerZoneArea = (0,
|
31887
|
+
const registerZoneArea = (0, import_react23.useCallback)(
|
31907
31888
|
(area) => {
|
31908
31889
|
setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
|
31909
31890
|
},
|
31910
31891
|
[setAreasWithZones]
|
31911
31892
|
);
|
31912
|
-
const registerZone = (0,
|
31893
|
+
const registerZone = (0, import_react23.useCallback)(
|
31913
31894
|
(zoneCompound) => {
|
31914
31895
|
if (!dispatch) {
|
31915
31896
|
return;
|
@@ -31922,7 +31903,7 @@ var DropZoneProvider = ({
|
|
31922
31903
|
},
|
31923
31904
|
[setActiveZones, dispatch]
|
31924
31905
|
);
|
31925
|
-
const unregisterZone = (0,
|
31906
|
+
const unregisterZone = (0, import_react23.useCallback)(
|
31926
31907
|
(zoneCompound) => {
|
31927
31908
|
if (!dispatch) {
|
31928
31909
|
return;
|
@@ -31937,8 +31918,8 @@ var DropZoneProvider = ({
|
|
31937
31918
|
},
|
31938
31919
|
[setActiveZones, dispatch]
|
31939
31920
|
);
|
31940
|
-
const [pathData, setPathData] = (0,
|
31941
|
-
const registerPath = (0,
|
31921
|
+
const [pathData, setPathData] = (0, import_react23.useState)();
|
31922
|
+
const registerPath = (0, import_react23.useCallback)(
|
31942
31923
|
(selector) => {
|
31943
31924
|
if (!(value == null ? void 0 : value.data)) {
|
31944
31925
|
return;
|
@@ -31963,7 +31944,7 @@ var DropZoneProvider = ({
|
|
31963
31944
|
},
|
31964
31945
|
[value, setPathData]
|
31965
31946
|
);
|
31966
|
-
return /* @__PURE__ */ (0,
|
31947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
31967
31948
|
dropZoneContext.Provider,
|
31968
31949
|
{
|
31969
31950
|
value: __spreadValues({
|
@@ -31988,7 +31969,7 @@ var DropZoneProvider = ({
|
|
31988
31969
|
|
31989
31970
|
// components/Puck/context.tsx
|
31990
31971
|
init_react_import();
|
31991
|
-
var
|
31972
|
+
var import_react24 = require("react");
|
31992
31973
|
var defaultAppState = {
|
31993
31974
|
data: { content: [], root: { title: "" } },
|
31994
31975
|
ui: {
|
@@ -31998,7 +31979,7 @@ var defaultAppState = {
|
|
31998
31979
|
componentList: {}
|
31999
31980
|
}
|
32000
31981
|
};
|
32001
|
-
var appContext = (0,
|
31982
|
+
var appContext = (0, import_react24.createContext)({
|
32002
31983
|
state: defaultAppState,
|
32003
31984
|
dispatch: () => null,
|
32004
31985
|
config: { components: {} },
|
@@ -32006,7 +31987,7 @@ var appContext = (0, import_react25.createContext)({
|
|
32006
31987
|
});
|
32007
31988
|
var AppProvider = appContext.Provider;
|
32008
31989
|
var useAppContext = () => {
|
32009
|
-
const mainContext = (0,
|
31990
|
+
const mainContext = (0, import_react24.useContext)(appContext);
|
32010
31991
|
const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
|
32011
31992
|
return __spreadProps(__spreadValues({}, mainContext), {
|
32012
31993
|
// Helpers
|
@@ -32022,12 +32003,12 @@ var useAppContext = () => {
|
|
32022
32003
|
};
|
32023
32004
|
|
32024
32005
|
// components/DropZone/index.tsx
|
32025
|
-
var
|
32006
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
32026
32007
|
var getClassName3 = get_class_name_factory_default("DropZone", styles_module_default2);
|
32027
32008
|
function DropZoneEdit({ zone, style }) {
|
32028
32009
|
var _a;
|
32029
32010
|
const appContext2 = useAppContext();
|
32030
|
-
const ctx = (0,
|
32011
|
+
const ctx = (0, import_react25.useContext)(dropZoneContext);
|
32031
32012
|
const {
|
32032
32013
|
// These all need setting via context
|
32033
32014
|
data,
|
@@ -32044,12 +32025,12 @@ function DropZoneEdit({ zone, style }) {
|
|
32044
32025
|
} = ctx || {};
|
32045
32026
|
let content = data.content || [];
|
32046
32027
|
let zoneCompound = rootDroppableId;
|
32047
|
-
(0,
|
32028
|
+
(0, import_react25.useEffect)(() => {
|
32048
32029
|
if (areaId && registerZoneArea) {
|
32049
32030
|
registerZoneArea(areaId);
|
32050
32031
|
}
|
32051
32032
|
}, [areaId]);
|
32052
|
-
(0,
|
32033
|
+
(0, import_react25.useEffect)(() => {
|
32053
32034
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
32054
32035
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
32055
32036
|
}
|
@@ -32070,12 +32051,12 @@ function DropZoneEdit({ zone, style }) {
|
|
32070
32051
|
const draggedDestinationId = draggedItem && ((_a = draggedItem.destination) == null ? void 0 : _a.droppableId);
|
32071
32052
|
const [zoneArea] = getZoneId(zoneCompound);
|
32072
32053
|
const [draggedSourceArea] = getZoneId(draggedSourceId);
|
32073
|
-
const [userWillDrag, setUserWillDrag] = (0,
|
32054
|
+
const [userWillDrag, setUserWillDrag] = (0, import_react25.useState)(false);
|
32074
32055
|
const userIsDragging = !!draggedItem;
|
32075
32056
|
const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
|
32076
32057
|
const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
|
32077
32058
|
if (!(ctx == null ? void 0 : ctx.config) || !ctx.setHoveringArea || !ctx.setHoveringZone || !ctx.setHoveringComponent || !ctx.setItemSelector || !ctx.registerPath || !ctx.dispatch) {
|
32078
|
-
return /* @__PURE__ */ (0,
|
32059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: "DropZone requires context to work." });
|
32079
32060
|
}
|
32080
32061
|
const {
|
32081
32062
|
hoveringArea = "root",
|
@@ -32096,7 +32077,7 @@ function DropZoneEdit({ zone, style }) {
|
|
32096
32077
|
}
|
32097
32078
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
32098
32079
|
const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
|
32099
|
-
return /* @__PURE__ */ (0,
|
32080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
32100
32081
|
"div",
|
32101
32082
|
{
|
32102
32083
|
className: getClassName3({
|
@@ -32110,14 +32091,14 @@ function DropZoneEdit({ zone, style }) {
|
|
32110
32091
|
isAreaSelected,
|
32111
32092
|
hasChildren: content.length > 0
|
32112
32093
|
}),
|
32113
|
-
children: /* @__PURE__ */ (0,
|
32114
|
-
|
32094
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
32095
|
+
import_dnd2.Droppable,
|
32115
32096
|
{
|
32116
32097
|
droppableId: zoneCompound,
|
32117
32098
|
direction: "vertical",
|
32118
32099
|
isDropDisabled: !isEnabled,
|
32119
32100
|
children: (provided, snapshot) => {
|
32120
|
-
return /* @__PURE__ */ (0,
|
32101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
32121
32102
|
"div",
|
32122
32103
|
__spreadProps(__spreadValues({}, (provided || { droppableProps: {} }).droppableProps), {
|
32123
32104
|
className: getClassName3("content"),
|
@@ -32134,6 +32115,7 @@ function DropZoneEdit({ zone, style }) {
|
|
32134
32115
|
var _a2, _b;
|
32135
32116
|
const componentId = item.props.id;
|
32136
32117
|
const defaultedProps = __spreadProps(__spreadValues(__spreadValues({}, (_a2 = config.components[item.type]) == null ? void 0 : _a2.defaultProps), item.props), {
|
32118
|
+
puck: { renderDropZone: DropZone },
|
32137
32119
|
editMode: true
|
32138
32120
|
});
|
32139
32121
|
const isSelected = (selectedItem == null ? void 0 : selectedItem.props.id) === componentId || false;
|
@@ -32141,23 +32123,23 @@ function DropZoneEdit({ zone, style }) {
|
|
32141
32123
|
"draggable-"
|
32142
32124
|
)[1] === componentId;
|
32143
32125
|
const containsZone = areasWithZones ? areasWithZones[componentId] : false;
|
32144
|
-
const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0,
|
32126
|
+
const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
|
32145
32127
|
"No configuration for ",
|
32146
32128
|
item.type
|
32147
32129
|
] });
|
32148
|
-
return /* @__PURE__ */ (0,
|
32130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
32149
32131
|
"div",
|
32150
32132
|
{
|
32151
32133
|
className: getClassName3("item"),
|
32152
32134
|
style: { zIndex: isDragging ? 1 : void 0 },
|
32153
32135
|
children: [
|
32154
|
-
/* @__PURE__ */ (0,
|
32136
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
32155
32137
|
DropZoneProvider,
|
32156
32138
|
{
|
32157
32139
|
value: __spreadProps(__spreadValues({}, ctx), {
|
32158
32140
|
areaId: componentId
|
32159
32141
|
}),
|
32160
|
-
children: /* @__PURE__ */ (0,
|
32142
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
32161
32143
|
DraggableComponent,
|
32162
32144
|
{
|
32163
32145
|
label: item.type.toString(),
|
@@ -32228,12 +32210,12 @@ function DropZoneEdit({ zone, style }) {
|
|
32228
32210
|
style: {
|
32229
32211
|
pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
|
32230
32212
|
},
|
32231
|
-
children: /* @__PURE__ */ (0,
|
32213
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { zoom: 0.75 }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Render2, __spreadValues({}, defaultedProps)) })
|
32232
32214
|
}
|
32233
32215
|
)
|
32234
32216
|
}
|
32235
32217
|
),
|
32236
|
-
userIsDragging && /* @__PURE__ */ (0,
|
32218
|
+
userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
32237
32219
|
"div",
|
32238
32220
|
{
|
32239
32221
|
className: getClassName3("hitbox"),
|
@@ -32250,7 +32232,7 @@ function DropZoneEdit({ zone, style }) {
|
|
32250
32232
|
);
|
32251
32233
|
}),
|
32252
32234
|
provided == null ? void 0 : provided.placeholder,
|
32253
|
-
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0,
|
32235
|
+
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
32254
32236
|
"div",
|
32255
32237
|
{
|
32256
32238
|
"data-puck-placeholder": true,
|
@@ -32271,7 +32253,7 @@ function DropZoneEdit({ zone, style }) {
|
|
32271
32253
|
);
|
32272
32254
|
}
|
32273
32255
|
function DropZoneRender({ zone }) {
|
32274
|
-
const ctx = (0,
|
32256
|
+
const ctx = (0, import_react25.useContext)(dropZoneContext);
|
32275
32257
|
const { data, areaId = "root", config } = ctx || {};
|
32276
32258
|
let zoneCompound = rootDroppableId;
|
32277
32259
|
let content = (data == null ? void 0 : data.content) || [];
|
@@ -32282,14 +32264,19 @@ function DropZoneRender({ zone }) {
|
|
32282
32264
|
zoneCompound = `${areaId}:${zone}`;
|
32283
32265
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
32284
32266
|
}
|
32285
|
-
return /* @__PURE__ */ (0,
|
32267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: content.map((item) => {
|
32286
32268
|
const Component = config.components[item.type];
|
32287
32269
|
if (Component) {
|
32288
|
-
return /* @__PURE__ */ (0,
|
32270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
32289
32271
|
DropZoneProvider,
|
32290
32272
|
{
|
32291
32273
|
value: { data, config, areaId: item.props.id },
|
32292
|
-
children: /* @__PURE__ */ (0,
|
32274
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
32275
|
+
Component.render,
|
32276
|
+
__spreadProps(__spreadValues({}, item.props), {
|
32277
|
+
puck: { renderDropZone: DropZone }
|
32278
|
+
})
|
32279
|
+
)
|
32293
32280
|
},
|
32294
32281
|
item.props.id
|
32295
32282
|
);
|
@@ -32298,11 +32285,11 @@ function DropZoneRender({ zone }) {
|
|
32298
32285
|
}) });
|
32299
32286
|
}
|
32300
32287
|
function DropZone(props) {
|
32301
|
-
const ctx = (0,
|
32288
|
+
const ctx = (0, import_react25.useContext)(dropZoneContext);
|
32302
32289
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
32303
|
-
return /* @__PURE__ */ (0,
|
32290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DropZoneEdit, __spreadValues({}, props));
|
32304
32291
|
}
|
32305
|
-
return /* @__PURE__ */ (0,
|
32292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DropZoneRender, __spreadValues({}, props));
|
32306
32293
|
}
|
32307
32294
|
|
32308
32295
|
// components/IconButton/index.ts
|
@@ -32310,7 +32297,7 @@ init_react_import();
|
|
32310
32297
|
|
32311
32298
|
// components/IconButton/IconButton.tsx
|
32312
32299
|
init_react_import();
|
32313
|
-
var
|
32300
|
+
var import_react26 = require("react");
|
32314
32301
|
|
32315
32302
|
// css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
|
32316
32303
|
init_react_import();
|
@@ -32318,7 +32305,7 @@ var IconButton_module_default = { "IconButton": "_IconButton_13gzt_1" };
|
|
32318
32305
|
|
32319
32306
|
// components/IconButton/IconButton.tsx
|
32320
32307
|
var import_react_spinners3 = require("react-spinners");
|
32321
|
-
var
|
32308
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
32322
32309
|
var getClassName4 = get_class_name_factory_default("IconButton", IconButton_module_default);
|
32323
32310
|
var IconButton = ({
|
32324
32311
|
children,
|
@@ -32332,9 +32319,9 @@ var IconButton = ({
|
|
32332
32319
|
fullWidth,
|
32333
32320
|
title
|
32334
32321
|
}) => {
|
32335
|
-
const [loading, setLoading] = (0,
|
32322
|
+
const [loading, setLoading] = (0, import_react26.useState)(false);
|
32336
32323
|
const ElementType = href ? "a" : "button";
|
32337
|
-
const el = /* @__PURE__ */ (0,
|
32324
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
32338
32325
|
ElementType,
|
32339
32326
|
{
|
32340
32327
|
className: getClassName4({
|
@@ -32360,9 +32347,9 @@ var IconButton = ({
|
|
32360
32347
|
title,
|
32361
32348
|
children: [
|
32362
32349
|
children,
|
32363
|
-
loading && /* @__PURE__ */ (0,
|
32350
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
32364
32351
|
"\xA0\xA0",
|
32365
|
-
/* @__PURE__ */ (0,
|
32352
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_spinners3.ClipLoader, { color: "inherit", size: "14px" })
|
32366
32353
|
] })
|
32367
32354
|
]
|
32368
32355
|
}
|
@@ -32372,8 +32359,8 @@ var IconButton = ({
|
|
32372
32359
|
|
32373
32360
|
// components/Puck/index.tsx
|
32374
32361
|
init_react_import();
|
32375
|
-
var
|
32376
|
-
var
|
32362
|
+
var import_react38 = require("react");
|
32363
|
+
var import_dnd7 = require("@hello-pangea/dnd");
|
32377
32364
|
|
32378
32365
|
// components/InputOrGroup/index.tsx
|
32379
32366
|
init_react_import();
|
@@ -32383,7 +32370,7 @@ init_react_import();
|
|
32383
32370
|
var styles_module_default3 = { "Input": "_Input_1kw16_1", "Input-label": "_Input-label_1kw16_27", "Input-labelIcon": "_Input-labelIcon_1kw16_34", "Input-disabledIcon": "_Input-disabledIcon_1kw16_40", "Input-input": "_Input-input_1kw16_45", "Input--readOnly": "_Input--readOnly_1kw16_66", "Input-radioGroupItems": "_Input-radioGroupItems_1kw16_78", "Input-radio": "_Input-radio_1kw16_78", "Input-radioInner": "_Input-radioInner_1kw16_95", "Input-radioInput": "_Input-radioInput_1kw16_117" };
|
32384
32371
|
|
32385
32372
|
// components/InputOrGroup/index.tsx
|
32386
|
-
var
|
32373
|
+
var import_react30 = require("react");
|
32387
32374
|
|
32388
32375
|
// components/InputOrGroup/fields/index.tsx
|
32389
32376
|
init_react_import();
|
@@ -32396,12 +32383,13 @@ init_react_import();
|
|
32396
32383
|
var styles_module_default4 = { "ArrayField": "_ArrayField_13rp0_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_13rp0_13", "ArrayField-addButton": "_ArrayField-addButton_13rp0_17", "ArrayField--hasItems": "_ArrayField--hasItems_13rp0_31", "ArrayFieldItem": "_ArrayFieldItem_13rp0_45", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_13rp0_53", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_13rp0_58", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_13rp0_72", "ArrayFieldItem--readOnly": "_ArrayFieldItem--readOnly_13rp0_84", "ArrayFieldItem-body": "_ArrayFieldItem-body_13rp0_105", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_13rp0_113", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_13rp0_120", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_13rp0_126", "ArrayFieldItem-action": "_ArrayFieldItem-action_13rp0_126" };
|
32397
32384
|
|
32398
32385
|
// components/InputOrGroup/fields/ArrayField/index.tsx
|
32399
|
-
var
|
32386
|
+
var import_dnd4 = require("@hello-pangea/dnd");
|
32387
|
+
var import_dnd5 = require("@hello-pangea/dnd");
|
32400
32388
|
|
32401
32389
|
// components/Draggable/index.tsx
|
32402
32390
|
init_react_import();
|
32403
|
-
var
|
32404
|
-
var
|
32391
|
+
var import_dnd3 = require("@hello-pangea/dnd");
|
32392
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
32405
32393
|
var Draggable2 = ({
|
32406
32394
|
className,
|
32407
32395
|
children,
|
@@ -32411,16 +32399,16 @@ var Draggable2 = ({
|
|
32411
32399
|
disableAnimations = false,
|
32412
32400
|
isDragDisabled = false
|
32413
32401
|
}) => {
|
32414
|
-
return /* @__PURE__ */ (0,
|
32415
|
-
|
32402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
32403
|
+
import_dnd3.Draggable,
|
32416
32404
|
{
|
32417
32405
|
draggableId: id,
|
32418
32406
|
index,
|
32419
32407
|
isDragDisabled,
|
32420
32408
|
children: (provided, snapshot) => {
|
32421
32409
|
var _a;
|
32422
|
-
return /* @__PURE__ */ (0,
|
32423
|
-
/* @__PURE__ */ (0,
|
32410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
32411
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
32424
32412
|
"div",
|
32425
32413
|
__spreadProps(__spreadValues(__spreadValues({
|
32426
32414
|
className: className && className(provided, snapshot),
|
@@ -32432,7 +32420,7 @@ var Draggable2 = ({
|
|
32432
32420
|
children: children(provided, snapshot)
|
32433
32421
|
})
|
32434
32422
|
),
|
32435
|
-
showShadow && snapshot.isDragging && /* @__PURE__ */ (0,
|
32423
|
+
showShadow && snapshot.isDragging && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
32436
32424
|
"div",
|
32437
32425
|
{
|
32438
32426
|
className: className && className(provided, snapshot),
|
@@ -32452,7 +32440,7 @@ var import_crypto = require("crypto");
|
|
32452
32440
|
var generateId = (type) => `${type}-${(0, import_crypto.randomBytes)(20).toString("hex")}`;
|
32453
32441
|
|
32454
32442
|
// components/InputOrGroup/fields/ArrayField/index.tsx
|
32455
|
-
var
|
32443
|
+
var import_react27 = require("react");
|
32456
32444
|
|
32457
32445
|
// components/DragIcon/index.tsx
|
32458
32446
|
init_react_import();
|
@@ -32462,12 +32450,12 @@ init_react_import();
|
|
32462
32450
|
var styles_module_default5 = { "DragIcon": "_DragIcon_o29on_1" };
|
32463
32451
|
|
32464
32452
|
// components/DragIcon/index.tsx
|
32465
|
-
var
|
32453
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
32466
32454
|
var getClassName5 = get_class_name_factory_default("DragIcon", styles_module_default5);
|
32467
|
-
var DragIcon = () => /* @__PURE__ */ (0,
|
32455
|
+
var DragIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName5(), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("svg", { viewBox: "0 0 20 20", width: "12", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" }) }) });
|
32468
32456
|
|
32469
32457
|
// components/InputOrGroup/fields/ArrayField/index.tsx
|
32470
|
-
var
|
32458
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
32471
32459
|
var getClassName6 = get_class_name_factory_default("ArrayField", styles_module_default4);
|
32472
32460
|
var getClassNameItem = get_class_name_factory_default("ArrayFieldItem", styles_module_default4);
|
32473
32461
|
var ArrayField = ({
|
@@ -32479,7 +32467,7 @@ var ArrayField = ({
|
|
32479
32467
|
readOnly,
|
32480
32468
|
readOnlyFields = {}
|
32481
32469
|
}) => {
|
32482
|
-
const [arrayFieldId] = (0,
|
32470
|
+
const [arrayFieldId] = (0, import_react27.useState)(generateId("ArrayField"));
|
32483
32471
|
const { state, setUi } = useAppContext();
|
32484
32472
|
const arrayState = state.ui.arrayState[arrayFieldId] || {
|
32485
32473
|
items: Array.from(value || []).map((v) => ({
|
@@ -32488,7 +32476,7 @@ var ArrayField = ({
|
|
32488
32476
|
})),
|
32489
32477
|
openId: ""
|
32490
32478
|
};
|
32491
|
-
const setArrayState = (0,
|
32479
|
+
const setArrayState = (0, import_react27.useCallback)(
|
32492
32480
|
(newArrayState, recordHistory = false) => {
|
32493
32481
|
setUi(
|
32494
32482
|
{
|
@@ -32501,7 +32489,7 @@ var ArrayField = ({
|
|
32501
32489
|
},
|
32502
32490
|
[arrayState]
|
32503
32491
|
);
|
32504
|
-
(0,
|
32492
|
+
(0, import_react27.useEffect)(() => {
|
32505
32493
|
const newItems = Array.from(value || []).map((item, idx) => {
|
32506
32494
|
var _a;
|
32507
32495
|
return {
|
@@ -32514,15 +32502,15 @@ var ArrayField = ({
|
|
32514
32502
|
if (field.type !== "array" || !field.arrayFields) {
|
32515
32503
|
return null;
|
32516
32504
|
}
|
32517
|
-
return /* @__PURE__ */ (0,
|
32505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
32518
32506
|
FieldLabelInternal,
|
32519
32507
|
{
|
32520
32508
|
label: label || name,
|
32521
|
-
icon: /* @__PURE__ */ (0,
|
32509
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(list_default, { size: 16 }),
|
32522
32510
|
el: "div",
|
32523
32511
|
readOnly,
|
32524
|
-
children: /* @__PURE__ */ (0,
|
32525
|
-
|
32512
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
32513
|
+
import_dnd5.DragDropContext,
|
32526
32514
|
{
|
32527
32515
|
onDragEnd: (event) => {
|
32528
32516
|
var _a;
|
@@ -32536,8 +32524,8 @@ var ArrayField = ({
|
|
32536
32524
|
onChange(newValue.map(({ data }) => data));
|
32537
32525
|
}
|
32538
32526
|
},
|
32539
|
-
children: /* @__PURE__ */ (0,
|
32540
|
-
return /* @__PURE__ */ (0,
|
32527
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dnd4.Droppable, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
|
32528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
32541
32529
|
"div",
|
32542
32530
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
32543
32531
|
ref: provided.innerRef,
|
@@ -32546,7 +32534,7 @@ var ArrayField = ({
|
|
32546
32534
|
hasItems: Array.isArray(value) && value.length > 0
|
32547
32535
|
}),
|
32548
32536
|
children: [
|
32549
|
-
Array.isArray(value) && value.length > 0 ? arrayState.items.map(({ _arrayId, data }, i) => /* @__PURE__ */ (0,
|
32537
|
+
Array.isArray(value) && value.length > 0 ? arrayState.items.map(({ _arrayId, data }, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
32550
32538
|
Draggable2,
|
32551
32539
|
{
|
32552
32540
|
id: _arrayId,
|
@@ -32557,8 +32545,8 @@ var ArrayField = ({
|
|
32557
32545
|
readOnly
|
32558
32546
|
}),
|
32559
32547
|
isDragDisabled: readOnly,
|
32560
|
-
children: () => /* @__PURE__ */ (0,
|
32561
|
-
/* @__PURE__ */ (0,
|
32548
|
+
children: () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
32549
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
32562
32550
|
"div",
|
32563
32551
|
{
|
32564
32552
|
onClick: () => {
|
@@ -32575,8 +32563,8 @@ var ArrayField = ({
|
|
32575
32563
|
className: getClassNameItem("summary"),
|
32576
32564
|
children: [
|
32577
32565
|
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${i}`,
|
32578
|
-
/* @__PURE__ */ (0,
|
32579
|
-
!readOnly && /* @__PURE__ */ (0,
|
32566
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassNameItem("rhs"), children: [
|
32567
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
32580
32568
|
IconButton,
|
32581
32569
|
{
|
32582
32570
|
onClick: () => {
|
@@ -32595,15 +32583,15 @@ var ArrayField = ({
|
|
32595
32583
|
onChange(existingValue);
|
32596
32584
|
},
|
32597
32585
|
title: "Delete",
|
32598
|
-
children: /* @__PURE__ */ (0,
|
32586
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(trash_default, { size: 16 })
|
32599
32587
|
}
|
32600
32588
|
) }) }),
|
32601
|
-
/* @__PURE__ */ (0,
|
32589
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DragIcon, {}) })
|
32602
32590
|
] })
|
32603
32591
|
]
|
32604
32592
|
}
|
32605
32593
|
),
|
32606
|
-
/* @__PURE__ */ (0,
|
32594
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
32607
32595
|
"fieldset",
|
32608
32596
|
{
|
32609
32597
|
className: getClassNameItem("fieldset"),
|
@@ -32612,7 +32600,7 @@ var ArrayField = ({
|
|
32612
32600
|
const subField = field.arrayFields[fieldName];
|
32613
32601
|
const subFieldName = `${name}[${i}].${fieldName}`;
|
32614
32602
|
const wildcardFieldName = `${name}[*].${fieldName}`;
|
32615
|
-
return /* @__PURE__ */ (0,
|
32603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
32616
32604
|
InputOrGroup,
|
32617
32605
|
{
|
32618
32606
|
name: subFieldName,
|
@@ -32638,7 +32626,7 @@ var ArrayField = ({
|
|
32638
32626
|
_arrayId
|
32639
32627
|
)) : null,
|
32640
32628
|
provided.placeholder,
|
32641
|
-
/* @__PURE__ */ (0,
|
32629
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
32642
32630
|
"button",
|
32643
32631
|
{
|
32644
32632
|
className: getClassName6("addButton"),
|
@@ -32646,7 +32634,7 @@ var ArrayField = ({
|
|
32646
32634
|
const existingValue = value || [];
|
32647
32635
|
onChange([...existingValue, field.defaultItemProps || {}]);
|
32648
32636
|
},
|
32649
|
-
children: /* @__PURE__ */ (0,
|
32637
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(plus_default, { size: "21" })
|
32650
32638
|
}
|
32651
32639
|
)
|
32652
32640
|
]
|
@@ -32661,7 +32649,7 @@ var ArrayField = ({
|
|
32661
32649
|
|
32662
32650
|
// components/InputOrGroup/fields/DefaultField/index.tsx
|
32663
32651
|
init_react_import();
|
32664
|
-
var
|
32652
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
32665
32653
|
var getClassName7 = get_class_name_factory_default("Input", styles_module_default3);
|
32666
32654
|
var DefaultField = ({
|
32667
32655
|
field,
|
@@ -32671,16 +32659,16 @@ var DefaultField = ({
|
|
32671
32659
|
name,
|
32672
32660
|
label
|
32673
32661
|
}) => {
|
32674
|
-
return /* @__PURE__ */ (0,
|
32662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
32675
32663
|
FieldLabelInternal,
|
32676
32664
|
{
|
32677
32665
|
label: label || name,
|
32678
|
-
icon: /* @__PURE__ */ (0,
|
32679
|
-
field.type === "text" && /* @__PURE__ */ (0,
|
32680
|
-
field.type === "number" && /* @__PURE__ */ (0,
|
32666
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
32667
|
+
field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(type_default, { size: 16 }),
|
32668
|
+
field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(hash_default, { size: 16 })
|
32681
32669
|
] }),
|
32682
32670
|
readOnly,
|
32683
|
-
children: /* @__PURE__ */ (0,
|
32671
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
32684
32672
|
"input",
|
32685
32673
|
{
|
32686
32674
|
className: getClassName7("input"),
|
@@ -32704,11 +32692,11 @@ var DefaultField = ({
|
|
32704
32692
|
|
32705
32693
|
// components/InputOrGroup/fields/ExternalField/index.tsx
|
32706
32694
|
init_react_import();
|
32707
|
-
var
|
32695
|
+
var import_react29 = require("react");
|
32708
32696
|
|
32709
32697
|
// components/ExternalInput/index.tsx
|
32710
32698
|
init_react_import();
|
32711
|
-
var
|
32699
|
+
var import_react28 = require("react");
|
32712
32700
|
|
32713
32701
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
32714
32702
|
init_react_import();
|
@@ -32723,7 +32711,7 @@ var styles_module_default7 = { "Modal": "_Modal_hx2u6_1", "Modal--isOpen": "_Mod
|
|
32723
32711
|
|
32724
32712
|
// components/Modal/index.tsx
|
32725
32713
|
var import_react_dom = __toESM(require_react_dom());
|
32726
|
-
var
|
32714
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
32727
32715
|
var getClassName8 = get_class_name_factory_default("Modal", styles_module_default7);
|
32728
32716
|
var Modal = ({
|
32729
32717
|
children,
|
@@ -32732,10 +32720,10 @@ var Modal = ({
|
|
32732
32720
|
}) => {
|
32733
32721
|
const rootEl = document.getElementById("puck-portal-root");
|
32734
32722
|
if (!rootEl) {
|
32735
|
-
return /* @__PURE__ */ (0,
|
32723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", {});
|
32736
32724
|
}
|
32737
32725
|
return (0, import_react_dom.createPortal)(
|
32738
|
-
/* @__PURE__ */ (0,
|
32726
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName8({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
32739
32727
|
"div",
|
32740
32728
|
{
|
32741
32729
|
className: getClassName8("inner"),
|
@@ -32755,11 +32743,11 @@ init_react_import();
|
|
32755
32743
|
var styles_module_default8 = { "Heading": "_Heading_1bvy5_1", "Heading--xxxxl": "_Heading--xxxxl_1bvy5_13", "Heading--xxxl": "_Heading--xxxl_1bvy5_19", "Heading--xxl": "_Heading--xxl_1bvy5_23", "Heading--xl": "_Heading--xl_1bvy5_27", "Heading--l": "_Heading--l_1bvy5_31", "Heading--m": "_Heading--m_1bvy5_35", "Heading--s": "_Heading--s_1bvy5_39", "Heading--xs": "_Heading--xs_1bvy5_43" };
|
32756
32744
|
|
32757
32745
|
// components/Heading/index.tsx
|
32758
|
-
var
|
32746
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
32759
32747
|
var getClassName9 = get_class_name_factory_default("Heading", styles_module_default8);
|
32760
32748
|
var Heading = ({ children, rank, size = "m" }) => {
|
32761
32749
|
const Tag = rank ? `h${rank}` : "span";
|
32762
|
-
return /* @__PURE__ */ (0,
|
32750
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
32763
32751
|
Tag,
|
32764
32752
|
{
|
32765
32753
|
className: getClassName9({
|
@@ -32772,7 +32760,7 @@ var Heading = ({ children, rank, size = "m" }) => {
|
|
32772
32760
|
|
32773
32761
|
// components/ExternalInput/index.tsx
|
32774
32762
|
var import_react_spinners4 = require("react-spinners");
|
32775
|
-
var
|
32763
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
32776
32764
|
var getClassName10 = get_class_name_factory_default("ExternalInput", styles_module_default6);
|
32777
32765
|
var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default6);
|
32778
32766
|
var dataCache = {};
|
@@ -32783,10 +32771,10 @@ var ExternalInput = ({
|
|
32783
32771
|
name
|
32784
32772
|
}) => {
|
32785
32773
|
const { mapProp = (val) => val } = field || {};
|
32786
|
-
const [data, setData] = (0,
|
32787
|
-
const [isOpen, setOpen] = (0,
|
32788
|
-
const [isLoading, setIsLoading] = (0,
|
32789
|
-
const keys = (0,
|
32774
|
+
const [data, setData] = (0, import_react28.useState)([]);
|
32775
|
+
const [isOpen, setOpen] = (0, import_react28.useState)(false);
|
32776
|
+
const [isLoading, setIsLoading] = (0, import_react28.useState)(true);
|
32777
|
+
const keys = (0, import_react28.useMemo)(() => {
|
32790
32778
|
const validKeys = /* @__PURE__ */ new Set();
|
32791
32779
|
for (const item of data) {
|
32792
32780
|
for (const key of Object.keys(item)) {
|
@@ -32797,7 +32785,7 @@ var ExternalInput = ({
|
|
32797
32785
|
}
|
32798
32786
|
return Array.from(validKeys);
|
32799
32787
|
}, [data]);
|
32800
|
-
(0,
|
32788
|
+
(0, import_react28.useEffect)(() => {
|
32801
32789
|
(() => __async(void 0, null, function* () {
|
32802
32790
|
const listData = dataCache[name] || (yield field.fetchList());
|
32803
32791
|
if (listData) {
|
@@ -32807,7 +32795,7 @@ var ExternalInput = ({
|
|
32807
32795
|
}
|
32808
32796
|
}))();
|
32809
32797
|
}, []);
|
32810
|
-
return /* @__PURE__ */ (0,
|
32798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
32811
32799
|
"div",
|
32812
32800
|
{
|
32813
32801
|
className: getClassName10({
|
@@ -32815,30 +32803,30 @@ var ExternalInput = ({
|
|
32815
32803
|
modalVisible: isOpen
|
32816
32804
|
}),
|
32817
32805
|
children: [
|
32818
|
-
/* @__PURE__ */ (0,
|
32819
|
-
/* @__PURE__ */ (0,
|
32806
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName10("actions"), children: [
|
32807
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
32820
32808
|
"button",
|
32821
32809
|
{
|
32822
32810
|
onClick: () => setOpen(true),
|
32823
32811
|
className: getClassName10("button"),
|
32824
|
-
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0,
|
32825
|
-
/* @__PURE__ */ (0,
|
32826
|
-
/* @__PURE__ */ (0,
|
32812
|
+
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
32813
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(link_default, { size: "16" }),
|
32814
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: field.placeholder })
|
32827
32815
|
] })
|
32828
32816
|
}
|
32829
32817
|
),
|
32830
|
-
value && /* @__PURE__ */ (0,
|
32818
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
32831
32819
|
"button",
|
32832
32820
|
{
|
32833
32821
|
className: getClassName10("detachButton"),
|
32834
32822
|
onClick: () => {
|
32835
32823
|
onChange(null);
|
32836
32824
|
},
|
32837
|
-
children: /* @__PURE__ */ (0,
|
32825
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(unlock_default, { size: 16 })
|
32838
32826
|
}
|
32839
32827
|
)
|
32840
32828
|
] }),
|
32841
|
-
/* @__PURE__ */ (0,
|
32829
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
32842
32830
|
"div",
|
32843
32831
|
{
|
32844
32832
|
className: getClassNameModal({
|
@@ -32847,9 +32835,9 @@ var ExternalInput = ({
|
|
32847
32835
|
hasData: !!data
|
32848
32836
|
}),
|
32849
32837
|
children: [
|
32850
|
-
/* @__PURE__ */ (0,
|
32851
|
-
/* @__PURE__ */ (0,
|
32852
|
-
/* @__PURE__ */ (0,
|
32838
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("masthead"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Heading, { rank: 2, size: "xxl", children: "Select content" }) }),
|
32839
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("tableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("table", { className: getClassNameModal("table"), children: [
|
32840
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
32853
32841
|
"th",
|
32854
32842
|
{
|
32855
32843
|
className: getClassNameModal("th"),
|
@@ -32858,8 +32846,8 @@ var ExternalInput = ({
|
|
32858
32846
|
},
|
32859
32847
|
key
|
32860
32848
|
)) }) }),
|
32861
|
-
/* @__PURE__ */ (0,
|
32862
|
-
return /* @__PURE__ */ (0,
|
32849
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tbody", { className: getClassNameModal("tbody"), children: data.map((item, i) => {
|
32850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
32863
32851
|
"tr",
|
32864
32852
|
{
|
32865
32853
|
style: { whiteSpace: "nowrap" },
|
@@ -32868,14 +32856,14 @@ var ExternalInput = ({
|
|
32868
32856
|
onChange(mapProp(item));
|
32869
32857
|
setOpen(false);
|
32870
32858
|
},
|
32871
|
-
children: keys.map((key) => /* @__PURE__ */ (0,
|
32859
|
+
children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
32872
32860
|
},
|
32873
32861
|
i
|
32874
32862
|
);
|
32875
32863
|
}) })
|
32876
32864
|
] }) }),
|
32877
|
-
/* @__PURE__ */ (0,
|
32878
|
-
/* @__PURE__ */ (0,
|
32865
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("noContentBanner"), children: "No content" }),
|
32866
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_spinners4.ClipLoader, { size: 24 }) })
|
32879
32867
|
]
|
32880
32868
|
}
|
32881
32869
|
) })
|
@@ -32885,7 +32873,7 @@ var ExternalInput = ({
|
|
32885
32873
|
};
|
32886
32874
|
|
32887
32875
|
// components/InputOrGroup/fields/ExternalField/index.tsx
|
32888
|
-
var
|
32876
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
32889
32877
|
var ExternalField = ({
|
32890
32878
|
field,
|
32891
32879
|
onChange,
|
@@ -32896,7 +32884,7 @@ var ExternalField = ({
|
|
32896
32884
|
var _a, _b, _c;
|
32897
32885
|
const validField = field;
|
32898
32886
|
const deprecatedField = field;
|
32899
|
-
(0,
|
32887
|
+
(0, import_react29.useEffect)(() => {
|
32900
32888
|
if (deprecatedField.adaptor) {
|
32901
32889
|
console.error(
|
32902
32890
|
"Warning: The `adaptor` API is deprecated. Please use updated APIs on the `external` field instead. This will be a breaking change in a future release."
|
@@ -32906,13 +32894,13 @@ var ExternalField = ({
|
|
32906
32894
|
if (field.type !== "external") {
|
32907
32895
|
return null;
|
32908
32896
|
}
|
32909
|
-
return /* @__PURE__ */ (0,
|
32897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
32910
32898
|
FieldLabelInternal,
|
32911
32899
|
{
|
32912
32900
|
label: label || name,
|
32913
|
-
icon: /* @__PURE__ */ (0,
|
32901
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(link_default, { size: 16 }),
|
32914
32902
|
el: "div",
|
32915
|
-
children: /* @__PURE__ */ (0,
|
32903
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
32916
32904
|
ExternalInput,
|
32917
32905
|
{
|
32918
32906
|
name,
|
@@ -32936,7 +32924,7 @@ var ExternalField = ({
|
|
32936
32924
|
|
32937
32925
|
// components/InputOrGroup/fields/RadioField/index.tsx
|
32938
32926
|
init_react_import();
|
32939
|
-
var
|
32927
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
32940
32928
|
var getClassName11 = get_class_name_factory_default("Input", styles_module_default3);
|
32941
32929
|
var RadioField = ({
|
32942
32930
|
field,
|
@@ -32948,19 +32936,19 @@ var RadioField = ({
|
|
32948
32936
|
if (field.type !== "radio" || !field.options) {
|
32949
32937
|
return null;
|
32950
32938
|
}
|
32951
|
-
return /* @__PURE__ */ (0,
|
32939
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
32952
32940
|
FieldLabelInternal,
|
32953
32941
|
{
|
32954
|
-
icon: /* @__PURE__ */ (0,
|
32942
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(check_circle_default, { size: 16 }),
|
32955
32943
|
label: field.label || name,
|
32956
32944
|
readOnly,
|
32957
32945
|
el: "div",
|
32958
|
-
children: /* @__PURE__ */ (0,
|
32946
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName11("radioGroupItems"), children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
32959
32947
|
"label",
|
32960
32948
|
{
|
32961
32949
|
className: getClassName11("radio"),
|
32962
32950
|
children: [
|
32963
|
-
/* @__PURE__ */ (0,
|
32951
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
32964
32952
|
"input",
|
32965
32953
|
{
|
32966
32954
|
type: "radio",
|
@@ -32978,7 +32966,7 @@ var RadioField = ({
|
|
32978
32966
|
defaultChecked: value === option.value
|
32979
32967
|
}
|
32980
32968
|
),
|
32981
|
-
/* @__PURE__ */ (0,
|
32969
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName11("radioInner"), children: option.label || option.value })
|
32982
32970
|
]
|
32983
32971
|
},
|
32984
32972
|
option.label + option.value
|
@@ -32989,7 +32977,7 @@ var RadioField = ({
|
|
32989
32977
|
|
32990
32978
|
// components/InputOrGroup/fields/SelectField/index.tsx
|
32991
32979
|
init_react_import();
|
32992
|
-
var
|
32980
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
32993
32981
|
var getClassName12 = get_class_name_factory_default("Input", styles_module_default3);
|
32994
32982
|
var SelectField = ({
|
32995
32983
|
field,
|
@@ -33002,13 +32990,13 @@ var SelectField = ({
|
|
33002
32990
|
if (field.type !== "select" || !field.options) {
|
33003
32991
|
return null;
|
33004
32992
|
}
|
33005
|
-
return /* @__PURE__ */ (0,
|
32993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
33006
32994
|
FieldLabelInternal,
|
33007
32995
|
{
|
33008
32996
|
label: label || name,
|
33009
|
-
icon: /* @__PURE__ */ (0,
|
32997
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(chevron_down_default, { size: 16 }),
|
33010
32998
|
readOnly,
|
33011
|
-
children: /* @__PURE__ */ (0,
|
32999
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
33012
33000
|
"select",
|
33013
33001
|
{
|
33014
33002
|
className: getClassName12("input"),
|
@@ -33021,7 +33009,7 @@ var SelectField = ({
|
|
33021
33009
|
onChange(e.currentTarget.value);
|
33022
33010
|
},
|
33023
33011
|
value,
|
33024
|
-
children: field.options.map((option) => /* @__PURE__ */ (0,
|
33012
|
+
children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
33025
33013
|
"option",
|
33026
33014
|
{
|
33027
33015
|
label: option.label,
|
@@ -33037,7 +33025,7 @@ var SelectField = ({
|
|
33037
33025
|
|
33038
33026
|
// components/InputOrGroup/fields/TextareaField/index.tsx
|
33039
33027
|
init_react_import();
|
33040
|
-
var
|
33028
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
33041
33029
|
var getClassName13 = get_class_name_factory_default("Input", styles_module_default3);
|
33042
33030
|
var TextareaField = ({
|
33043
33031
|
onChange,
|
@@ -33046,13 +33034,13 @@ var TextareaField = ({
|
|
33046
33034
|
name,
|
33047
33035
|
label
|
33048
33036
|
}) => {
|
33049
|
-
return /* @__PURE__ */ (0,
|
33037
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
33050
33038
|
FieldLabelInternal,
|
33051
33039
|
{
|
33052
33040
|
label: label || name,
|
33053
|
-
icon: /* @__PURE__ */ (0,
|
33041
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(type_default, { size: 16 }),
|
33054
33042
|
readOnly,
|
33055
|
-
children: /* @__PURE__ */ (0,
|
33043
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
33056
33044
|
"textarea",
|
33057
33045
|
{
|
33058
33046
|
className: getClassName13("input"),
|
@@ -33070,7 +33058,7 @@ var TextareaField = ({
|
|
33070
33058
|
|
33071
33059
|
// components/InputOrGroup/index.tsx
|
33072
33060
|
var import_use_debounce2 = require("use-debounce");
|
33073
|
-
var
|
33061
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
33074
33062
|
var getClassName14 = get_class_name_factory_default("Input", styles_module_default3);
|
33075
33063
|
var FieldLabel = ({
|
33076
33064
|
children,
|
@@ -33081,11 +33069,11 @@ var FieldLabel = ({
|
|
33081
33069
|
className
|
33082
33070
|
}) => {
|
33083
33071
|
const El = el;
|
33084
|
-
return /* @__PURE__ */ (0,
|
33085
|
-
/* @__PURE__ */ (0,
|
33086
|
-
icon ? /* @__PURE__ */ (0,
|
33072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(El, { className, children: [
|
33073
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: getClassName14("label"), children: [
|
33074
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jsx_runtime17.Fragment, {}),
|
33087
33075
|
label,
|
33088
|
-
readOnly && /* @__PURE__ */ (0,
|
33076
|
+
readOnly && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(lock_default, { size: "12" }) })
|
33089
33077
|
] }),
|
33090
33078
|
children
|
33091
33079
|
] });
|
@@ -33098,7 +33086,7 @@ var FieldLabelInternal = ({
|
|
33098
33086
|
readOnly
|
33099
33087
|
}) => {
|
33100
33088
|
const El = el;
|
33101
|
-
return /* @__PURE__ */ (0,
|
33089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
33102
33090
|
FieldLabel,
|
33103
33091
|
{
|
33104
33092
|
label,
|
@@ -33113,7 +33101,7 @@ var FieldLabelInternal = ({
|
|
33113
33101
|
var InputOrGroup = (_a) => {
|
33114
33102
|
var _b = _a, { onChange } = _b, props = __objRest(_b, ["onChange"]);
|
33115
33103
|
const { name, field, value, readOnly } = props;
|
33116
|
-
const [localValue, setLocalValue] = (0,
|
33104
|
+
const [localValue, setLocalValue] = (0, import_react30.useState)(value);
|
33117
33105
|
const onChangeDb = (0, import_use_debounce2.useDebouncedCallback)(
|
33118
33106
|
(val) => {
|
33119
33107
|
onChange(val);
|
@@ -33121,11 +33109,11 @@ var InputOrGroup = (_a) => {
|
|
33121
33109
|
50,
|
33122
33110
|
{ leading: true }
|
33123
33111
|
);
|
33124
|
-
const onChangeLocal = (0,
|
33112
|
+
const onChangeLocal = (0, import_react30.useCallback)((val) => {
|
33125
33113
|
setLocalValue(val);
|
33126
33114
|
onChangeDb(val);
|
33127
33115
|
}, []);
|
33128
|
-
(0,
|
33116
|
+
(0, import_react30.useEffect)(() => {
|
33129
33117
|
setLocalValue(value);
|
33130
33118
|
}, [value]);
|
33131
33119
|
const localProps = {
|
@@ -33133,42 +33121,43 @@ var InputOrGroup = (_a) => {
|
|
33133
33121
|
onChange: onChangeLocal
|
33134
33122
|
};
|
33135
33123
|
if (field.type === "array") {
|
33136
|
-
return /* @__PURE__ */ (0,
|
33124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ArrayField, __spreadValues(__spreadValues({}, props), localProps));
|
33137
33125
|
}
|
33138
33126
|
if (field.type === "external") {
|
33139
|
-
return /* @__PURE__ */ (0,
|
33127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ExternalField, __spreadValues(__spreadValues({}, props), localProps));
|
33140
33128
|
}
|
33141
33129
|
if (field.type === "select") {
|
33142
|
-
return /* @__PURE__ */ (0,
|
33130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SelectField, __spreadValues(__spreadValues({}, props), localProps));
|
33143
33131
|
}
|
33144
33132
|
if (field.type === "textarea") {
|
33145
|
-
return /* @__PURE__ */ (0,
|
33133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TextareaField, __spreadValues(__spreadValues({}, props), localProps));
|
33146
33134
|
}
|
33147
33135
|
if (field.type === "radio") {
|
33148
|
-
return /* @__PURE__ */ (0,
|
33136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RadioField, __spreadValues(__spreadValues({}, props), localProps));
|
33149
33137
|
}
|
33150
33138
|
if (field.type === "custom") {
|
33151
33139
|
if (!field.render) {
|
33152
33140
|
return null;
|
33153
33141
|
}
|
33154
|
-
return /* @__PURE__ */ (0,
|
33142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14(), children: field.render(__spreadValues({
|
33155
33143
|
field,
|
33156
33144
|
name,
|
33157
33145
|
readOnly
|
33158
33146
|
}, localProps)) });
|
33159
33147
|
}
|
33160
|
-
return /* @__PURE__ */ (0,
|
33148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DefaultField, __spreadValues(__spreadValues({}, props), localProps));
|
33161
33149
|
};
|
33162
33150
|
|
33163
33151
|
// components/ComponentList/index.tsx
|
33164
33152
|
init_react_import();
|
33153
|
+
var import_dnd6 = require("@hello-pangea/dnd");
|
33165
33154
|
|
33166
33155
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
|
33167
33156
|
init_react_import();
|
33168
33157
|
var styles_module_default9 = { "ComponentList": "_ComponentList_3rdy2_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_3rdy2_6", "ComponentList-content": "_ComponentList-content_3rdy2_10", "ComponentList-title": "_ComponentList-title_3rdy2_18", "ComponentList-titleIcon": "_ComponentList-titleIcon_3rdy2_39", "ComponentListItem": "_ComponentListItem_3rdy2_43", "ComponentListItem-draggable": "_ComponentListItem-draggable_3rdy2_43", "ComponentListItemIcon": "_ComponentListItemIcon_3rdy2_61", "ComponentList--isDraggingFrom": "_ComponentList--isDraggingFrom_3rdy2_65" };
|
33169
33158
|
|
33170
33159
|
// components/ComponentList/index.tsx
|
33171
|
-
var
|
33160
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
33172
33161
|
var getClassName15 = get_class_name_factory_default("ComponentList", styles_module_default9);
|
33173
33162
|
var getClassNameItem2 = get_class_name_factory_default("ComponentListItem", styles_module_default9);
|
33174
33163
|
var ComponentListItem = ({
|
@@ -33176,7 +33165,7 @@ var ComponentListItem = ({
|
|
33176
33165
|
index,
|
33177
33166
|
id
|
33178
33167
|
}) => {
|
33179
|
-
return /* @__PURE__ */ (0,
|
33168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameItem2(), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
33180
33169
|
Draggable2,
|
33181
33170
|
{
|
33182
33171
|
id,
|
@@ -33184,9 +33173,9 @@ var ComponentListItem = ({
|
|
33184
33173
|
showShadow: true,
|
33185
33174
|
disableAnimations: true,
|
33186
33175
|
className: () => getClassNameItem2("draggable"),
|
33187
|
-
children: () => /* @__PURE__ */ (0,
|
33176
|
+
children: () => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
33188
33177
|
component,
|
33189
|
-
/* @__PURE__ */ (0,
|
33178
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DragIcon, {}) })
|
33190
33179
|
] })
|
33191
33180
|
},
|
33192
33181
|
component
|
@@ -33199,8 +33188,8 @@ var ComponentList = ({
|
|
33199
33188
|
}) => {
|
33200
33189
|
const { config, state, setUi } = useAppContext();
|
33201
33190
|
const { expanded = true } = state.ui.componentList[id] || {};
|
33202
|
-
return /* @__PURE__ */ (0,
|
33203
|
-
title && /* @__PURE__ */ (0,
|
33191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassName15({ isExpanded: expanded }), children: [
|
33192
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
33204
33193
|
"div",
|
33205
33194
|
{
|
33206
33195
|
className: getClassName15("title"),
|
@@ -33213,17 +33202,17 @@ var ComponentList = ({
|
|
33213
33202
|
}),
|
33214
33203
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
33215
33204
|
children: [
|
33216
|
-
/* @__PURE__ */ (0,
|
33217
|
-
/* @__PURE__ */ (0,
|
33205
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: title }),
|
33206
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName15("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(chevron_up_default, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(chevron_down_default, { size: 12 }) })
|
33218
33207
|
]
|
33219
33208
|
}
|
33220
33209
|
),
|
33221
|
-
/* @__PURE__ */ (0,
|
33222
|
-
|
33210
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName15("content"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
33211
|
+
import_dnd6.Droppable,
|
33223
33212
|
{
|
33224
33213
|
droppableId: `component-list${title ? `:${title}` : ""}`,
|
33225
33214
|
isDropDisabled: true,
|
33226
|
-
children: (provided, snapshot) => /* @__PURE__ */ (0,
|
33215
|
+
children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
33227
33216
|
"div",
|
33228
33217
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
33229
33218
|
ref: provided.innerRef,
|
@@ -33232,7 +33221,7 @@ var ComponentList = ({
|
|
33232
33221
|
}),
|
33233
33222
|
children: [
|
33234
33223
|
children || Object.keys(config.components).map((componentKey, i) => {
|
33235
|
-
return /* @__PURE__ */ (0,
|
33224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
33236
33225
|
ComponentListItem,
|
33237
33226
|
{
|
33238
33227
|
component: componentKey,
|
@@ -33242,7 +33231,7 @@ var ComponentList = ({
|
|
33242
33231
|
componentKey
|
33243
33232
|
);
|
33244
33233
|
}),
|
33245
|
-
/* @__PURE__ */ (0,
|
33234
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
|
33246
33235
|
]
|
33247
33236
|
})
|
33248
33237
|
)
|
@@ -33254,10 +33243,10 @@ ComponentList.Item = ComponentListItem;
|
|
33254
33243
|
|
33255
33244
|
// lib/use-placeholder-style.ts
|
33256
33245
|
init_react_import();
|
33257
|
-
var
|
33246
|
+
var import_react31 = require("react");
|
33258
33247
|
var usePlaceholderStyle = () => {
|
33259
|
-
const queryAttr = "data-
|
33260
|
-
const [placeholderStyle, setPlaceholderStyle] = (0,
|
33248
|
+
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
33249
|
+
const [placeholderStyle, setPlaceholderStyle] = (0, import_react31.useState)();
|
33261
33250
|
const onDragStartOrUpdate = (draggedItem) => {
|
33262
33251
|
var _a;
|
33263
33252
|
const draggableId = draggedItem.draggableId;
|
@@ -33269,7 +33258,7 @@ var usePlaceholderStyle = () => {
|
|
33269
33258
|
return;
|
33270
33259
|
}
|
33271
33260
|
const targetListElement = document.querySelector(
|
33272
|
-
`[data-
|
33261
|
+
`[data-rfd-droppable-id='${droppableId}']`
|
33273
33262
|
);
|
33274
33263
|
const { clientHeight } = draggedDOM;
|
33275
33264
|
if (!targetListElement) {
|
@@ -33280,7 +33269,7 @@ var usePlaceholderStyle = () => {
|
|
33280
33269
|
if (destinationIndex > 0) {
|
33281
33270
|
const end = destinationIndex > draggedItem.source.index && isSameDroppable ? destinationIndex + 1 : destinationIndex;
|
33282
33271
|
const children = Array.from(targetListElement.children).filter(
|
33283
|
-
(item) => item !== draggedDOM && item.getAttributeNames().indexOf("data-puck-placeholder") === -1 && item.getAttributeNames().indexOf("data-
|
33272
|
+
(item) => item !== draggedDOM && item.getAttributeNames().indexOf("data-puck-placeholder") === -1 && item.getAttributeNames().indexOf("data-rfd-placeholder-context-id") === -1
|
33284
33273
|
).slice(0, end);
|
33285
33274
|
clientY = children.reduce(
|
33286
33275
|
(total, item) => total + item.clientHeight + parseInt(window.getComputedStyle(item).marginTop.replace("px", "")) + parseInt(
|
@@ -33309,7 +33298,7 @@ var styles_module_default10 = { "SidebarSection": "_SidebarSection_r7dv3_1", "Si
|
|
33309
33298
|
|
33310
33299
|
// lib/use-breadcrumbs.ts
|
33311
33300
|
init_react_import();
|
33312
|
-
var
|
33301
|
+
var import_react32 = require("react");
|
33313
33302
|
var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
|
33314
33303
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
33315
33304
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -33359,8 +33348,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
33359
33348
|
state: { data },
|
33360
33349
|
selectedItem
|
33361
33350
|
} = useAppContext();
|
33362
|
-
const dzContext = (0,
|
33363
|
-
return (0,
|
33351
|
+
const dzContext = (0, import_react32.useContext)(dropZoneContext);
|
33352
|
+
return (0, import_react32.useMemo)(() => {
|
33364
33353
|
const breadcrumbs = convertPathDataToBreadcrumbs(
|
33365
33354
|
selectedItem,
|
33366
33355
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -33375,7 +33364,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
33375
33364
|
|
33376
33365
|
// components/SidebarSection/index.tsx
|
33377
33366
|
var import_react_spinners5 = require("react-spinners");
|
33378
|
-
var
|
33367
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
33379
33368
|
var getClassName16 = get_class_name_factory_default("SidebarSection", styles_module_default10);
|
33380
33369
|
var SidebarSection = ({
|
33381
33370
|
children,
|
@@ -33387,10 +33376,10 @@ var SidebarSection = ({
|
|
33387
33376
|
}) => {
|
33388
33377
|
const { setUi } = useAppContext();
|
33389
33378
|
const breadcrumbs = useBreadcrumbs(1);
|
33390
|
-
return /* @__PURE__ */ (0,
|
33391
|
-
/* @__PURE__ */ (0,
|
33392
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
33393
|
-
/* @__PURE__ */ (0,
|
33379
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: getClassName16({ noPadding }), style: { background }, children: [
|
33380
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("title"), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: getClassName16("breadcrumbs"), children: [
|
33381
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: getClassName16("breadcrumb"), children: [
|
33382
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
33394
33383
|
"div",
|
33395
33384
|
{
|
33396
33385
|
className: getClassName16("breadcrumbLabel"),
|
@@ -33398,12 +33387,12 @@ var SidebarSection = ({
|
|
33398
33387
|
children: breadcrumb.label
|
33399
33388
|
}
|
33400
33389
|
),
|
33401
|
-
/* @__PURE__ */ (0,
|
33390
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(chevron_right_default, { size: 16 })
|
33402
33391
|
] }, i)) : null,
|
33403
|
-
/* @__PURE__ */ (0,
|
33392
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
|
33404
33393
|
] }) }),
|
33405
|
-
/* @__PURE__ */ (0,
|
33406
|
-
isLoading && /* @__PURE__ */ (0,
|
33394
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("content"), children }),
|
33395
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_spinners5.ClipLoader, {}) })
|
33407
33396
|
] });
|
33408
33397
|
};
|
33409
33398
|
|
@@ -33412,15 +33401,15 @@ init_react_import();
|
|
33412
33401
|
|
33413
33402
|
// lib/use-puck-history.ts
|
33414
33403
|
init_react_import();
|
33415
|
-
var
|
33404
|
+
var import_react34 = require("react");
|
33416
33405
|
|
33417
33406
|
// lib/use-action-history.ts
|
33418
33407
|
init_react_import();
|
33419
|
-
var
|
33408
|
+
var import_react33 = require("react");
|
33420
33409
|
var EMPTY_HISTORY_INDEX = -1;
|
33421
33410
|
function useActionHistory() {
|
33422
|
-
const [histories, setHistories] = (0,
|
33423
|
-
const [currentHistoryIndex, setCurrentHistoryIndex] = (0,
|
33411
|
+
const [histories, setHistories] = (0, import_react33.useState)([]);
|
33412
|
+
const [currentHistoryIndex, setCurrentHistoryIndex] = (0, import_react33.useState)(EMPTY_HISTORY_INDEX);
|
33424
33413
|
const currentHistory = histories[currentHistoryIndex];
|
33425
33414
|
const canRewind = currentHistoryIndex > EMPTY_HISTORY_INDEX;
|
33426
33415
|
const canForward = currentHistoryIndex < histories.length - 1;
|
@@ -33499,7 +33488,7 @@ function usePuckHistory({
|
|
33499
33488
|
dispatch
|
33500
33489
|
});
|
33501
33490
|
}, DEBOUNCE_TIME);
|
33502
|
-
(0,
|
33491
|
+
(0, import_react34.useEffect)(() => {
|
33503
33492
|
historyEmitter.on(RECORD_DIFF, handleRecordDiff);
|
33504
33493
|
return () => {
|
33505
33494
|
historyEmitter.off(RECORD_DIFF, handleRecordDiff);
|
@@ -33855,7 +33844,7 @@ var scrollIntoView = (el) => {
|
|
33855
33844
|
};
|
33856
33845
|
|
33857
33846
|
// components/LayerTree/index.tsx
|
33858
|
-
var
|
33847
|
+
var import_react35 = require("react");
|
33859
33848
|
|
33860
33849
|
// lib/find-zones-for-area.ts
|
33861
33850
|
init_react_import();
|
@@ -33881,7 +33870,7 @@ var isChildOfZone = (item, maybeChild, ctx) => {
|
|
33881
33870
|
};
|
33882
33871
|
|
33883
33872
|
// components/LayerTree/index.tsx
|
33884
|
-
var
|
33873
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
33885
33874
|
var getClassName17 = get_class_name_factory_default("LayerTree", styles_module_default11);
|
33886
33875
|
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default11);
|
33887
33876
|
var LayerTree = ({
|
@@ -33893,15 +33882,15 @@ var LayerTree = ({
|
|
33893
33882
|
label
|
33894
33883
|
}) => {
|
33895
33884
|
const zones = data.zones || {};
|
33896
|
-
const ctx = (0,
|
33897
|
-
return /* @__PURE__ */ (0,
|
33898
|
-
label && /* @__PURE__ */ (0,
|
33899
|
-
/* @__PURE__ */ (0,
|
33885
|
+
const ctx = (0, import_react35.useContext)(dropZoneContext);
|
33886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
33887
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassName17("zoneTitle"), children: [
|
33888
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(layers_default, { size: "16" }) }),
|
33900
33889
|
" ",
|
33901
33890
|
label
|
33902
33891
|
] }),
|
33903
|
-
/* @__PURE__ */ (0,
|
33904
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
33892
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("ul", { className: getClassName17(), children: [
|
33893
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("helper"), children: "No items" }),
|
33905
33894
|
zoneContent.map((item, i) => {
|
33906
33895
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
33907
33896
|
const zonesForItem = findZonesForArea(data, item.props.id);
|
@@ -33916,7 +33905,7 @@ var LayerTree = ({
|
|
33916
33905
|
const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
|
33917
33906
|
const isHovering = hoveringComponent === item.props.id;
|
33918
33907
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
33919
|
-
return /* @__PURE__ */ (0,
|
33908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
33920
33909
|
"li",
|
33921
33910
|
{
|
33922
33911
|
className: getClassNameLayer({
|
@@ -33926,7 +33915,7 @@ var LayerTree = ({
|
|
33926
33915
|
childIsSelected
|
33927
33916
|
}),
|
33928
33917
|
children: [
|
33929
|
-
/* @__PURE__ */ (0,
|
33918
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
33930
33919
|
"div",
|
33931
33920
|
{
|
33932
33921
|
className: getClassNameLayer("clickable"),
|
@@ -33942,7 +33931,7 @@ var LayerTree = ({
|
|
33942
33931
|
const id = zoneContent[i].props.id;
|
33943
33932
|
scrollIntoView(
|
33944
33933
|
document.querySelector(
|
33945
|
-
`[data-
|
33934
|
+
`[data-rfd-drag-handle-draggable-id="draggable-${id}"]`
|
33946
33935
|
)
|
33947
33936
|
);
|
33948
33937
|
},
|
@@ -33957,22 +33946,22 @@ var LayerTree = ({
|
|
33957
33946
|
setHoveringComponent(null);
|
33958
33947
|
},
|
33959
33948
|
children: [
|
33960
|
-
containsZone && /* @__PURE__ */ (0,
|
33949
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
33961
33950
|
"div",
|
33962
33951
|
{
|
33963
33952
|
className: getClassNameLayer("chevron"),
|
33964
33953
|
title: isSelected ? "Collapse" : "Expand",
|
33965
|
-
children: /* @__PURE__ */ (0,
|
33954
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(chevron_down_default, { size: "12" })
|
33966
33955
|
}
|
33967
33956
|
),
|
33968
|
-
/* @__PURE__ */ (0,
|
33969
|
-
/* @__PURE__ */ (0,
|
33957
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
33958
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(type_default, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(grid_default, { size: "16" }) }),
|
33970
33959
|
item.type
|
33971
33960
|
] })
|
33972
33961
|
]
|
33973
33962
|
}
|
33974
33963
|
) }),
|
33975
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
33964
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
33976
33965
|
LayerTree,
|
33977
33966
|
{
|
33978
33967
|
data,
|
@@ -34018,11 +34007,11 @@ var flushZones = (appState) => {
|
|
34018
34007
|
|
34019
34008
|
// lib/use-component-list.tsx
|
34020
34009
|
init_react_import();
|
34021
|
-
var
|
34022
|
-
var
|
34010
|
+
var import_react36 = require("react");
|
34011
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
34023
34012
|
var useComponentList = (config, ui) => {
|
34024
|
-
const [componentList, setComponentList] = (0,
|
34025
|
-
(0,
|
34013
|
+
const [componentList, setComponentList] = (0, import_react36.useState)();
|
34014
|
+
(0, import_react36.useEffect)(() => {
|
34026
34015
|
var _a, _b, _c;
|
34027
34016
|
if (Object.keys(ui.componentList).length > 0) {
|
34028
34017
|
const matchedComponents = [];
|
@@ -34032,14 +34021,14 @@ var useComponentList = (config, ui) => {
|
|
34032
34021
|
if (category.visible === false || !category.components) {
|
34033
34022
|
return null;
|
34034
34023
|
}
|
34035
|
-
return /* @__PURE__ */ (0,
|
34024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
34036
34025
|
ComponentList,
|
34037
34026
|
{
|
34038
34027
|
id: categoryKey,
|
34039
34028
|
title: category.title || categoryKey,
|
34040
34029
|
children: category.components.map((componentName, i) => {
|
34041
34030
|
matchedComponents.push(componentName);
|
34042
|
-
return /* @__PURE__ */ (0,
|
34031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
34043
34032
|
ComponentList.Item,
|
34044
34033
|
{
|
34045
34034
|
component: componentName,
|
@@ -34059,13 +34048,13 @@ var useComponentList = (config, ui) => {
|
|
34059
34048
|
);
|
34060
34049
|
if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
|
34061
34050
|
_componentList.push(
|
34062
|
-
/* @__PURE__ */ (0,
|
34051
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
34063
34052
|
ComponentList,
|
34064
34053
|
{
|
34065
34054
|
id: "other",
|
34066
34055
|
title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
|
34067
34056
|
children: remainingComponents.map((componentName, i) => {
|
34068
|
-
return /* @__PURE__ */ (0,
|
34057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
34069
34058
|
ComponentList.Item,
|
34070
34059
|
{
|
34071
34060
|
component: componentName,
|
@@ -34088,7 +34077,7 @@ var useComponentList = (config, ui) => {
|
|
34088
34077
|
|
34089
34078
|
// lib/use-resolved-data.ts
|
34090
34079
|
init_react_import();
|
34091
|
-
var
|
34080
|
+
var import_react37 = require("react");
|
34092
34081
|
|
34093
34082
|
// lib/resolve-component-data.ts
|
34094
34083
|
init_react_import();
|
@@ -34203,13 +34192,13 @@ var resolveRootData = (data, config) => __async(void 0, null, function* () {
|
|
34203
34192
|
|
34204
34193
|
// lib/use-resolved-data.ts
|
34205
34194
|
var useResolvedData = (data, config, dispatch) => {
|
34206
|
-
const [{ resolverKey, newData }, setResolverState] = (0,
|
34195
|
+
const [{ resolverKey, newData }, setResolverState] = (0, import_react37.useState)({
|
34207
34196
|
resolverKey: 0,
|
34208
34197
|
newData: data
|
34209
34198
|
});
|
34210
|
-
const [componentState, setComponentState] = (0,
|
34199
|
+
const [componentState, setComponentState] = (0, import_react37.useState)({});
|
34211
34200
|
const deferredSetStates = {};
|
34212
|
-
const setComponentLoading = (0,
|
34201
|
+
const setComponentLoading = (0, import_react37.useCallback)(
|
34213
34202
|
(id, loading, defer = 0) => {
|
34214
34203
|
if (deferredSetStates[id]) {
|
34215
34204
|
clearTimeout(deferredSetStates[id]);
|
@@ -34267,10 +34256,10 @@ var useResolvedData = (data, config, dispatch) => {
|
|
34267
34256
|
});
|
34268
34257
|
yield Promise.all(promises);
|
34269
34258
|
});
|
34270
|
-
(0,
|
34259
|
+
(0, import_react37.useEffect)(() => {
|
34271
34260
|
runResolvers();
|
34272
34261
|
}, [resolverKey]);
|
34273
|
-
const resolveData = (0,
|
34262
|
+
const resolveData = (0, import_react37.useCallback)((newData2 = data) => {
|
34274
34263
|
setResolverState((curr) => ({
|
34275
34264
|
resolverKey: curr.resolverKey + 1,
|
34276
34265
|
newData: newData2
|
@@ -34283,7 +34272,7 @@ var useResolvedData = (data, config, dispatch) => {
|
|
34283
34272
|
};
|
34284
34273
|
|
34285
34274
|
// components/Puck/index.tsx
|
34286
|
-
var
|
34275
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
34287
34276
|
var defaultPageFields = {
|
34288
34277
|
title: { type: "text" }
|
34289
34278
|
};
|
@@ -34295,7 +34284,7 @@ var PluginRenderer = ({
|
|
34295
34284
|
renderMethod
|
34296
34285
|
}) => {
|
34297
34286
|
return plugins.filter((item) => item[renderMethod]).map((item) => item[renderMethod]).reduce(
|
34298
|
-
(accChildren, Item) => /* @__PURE__ */ (0,
|
34287
|
+
(accChildren, Item) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Item, { dispatch, state, children: accChildren }),
|
34299
34288
|
children
|
34300
34289
|
);
|
34301
34290
|
};
|
@@ -34312,7 +34301,7 @@ function Puck({
|
|
34312
34301
|
headerPath
|
34313
34302
|
}) {
|
34314
34303
|
var _a, _b;
|
34315
|
-
const [reducer] = (0,
|
34304
|
+
const [reducer] = (0, import_react38.useState)(() => createReducer({ config }));
|
34316
34305
|
const initialAppState = __spreadProps(__spreadValues({}, defaultAppState), {
|
34317
34306
|
data: initialData,
|
34318
34307
|
ui: __spreadProps(__spreadValues({}, defaultAppState.ui), {
|
@@ -34332,7 +34321,7 @@ function Puck({
|
|
34332
34321
|
) : {}
|
34333
34322
|
})
|
34334
34323
|
});
|
34335
|
-
const [appState, dispatch] = (0,
|
34324
|
+
const [appState, dispatch] = (0, import_react38.useReducer)(
|
34336
34325
|
reducer,
|
34337
34326
|
flushZones(initialAppState)
|
34338
34327
|
);
|
@@ -34347,7 +34336,7 @@ function Puck({
|
|
34347
34336
|
dispatch
|
34348
34337
|
});
|
34349
34338
|
const { itemSelector, leftSideBarVisible } = ui;
|
34350
|
-
const setItemSelector = (0,
|
34339
|
+
const setItemSelector = (0, import_react38.useCallback)(
|
34351
34340
|
(newItemSelector) => {
|
34352
34341
|
dispatch({
|
34353
34342
|
type: "setUi",
|
@@ -34357,10 +34346,10 @@ function Puck({
|
|
34357
34346
|
[]
|
34358
34347
|
);
|
34359
34348
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
34360
|
-
const Page = (0,
|
34349
|
+
const Page = (0, import_react38.useCallback)(
|
34361
34350
|
(pageProps) => {
|
34362
34351
|
var _a2, _b2;
|
34363
|
-
return /* @__PURE__ */ (0,
|
34352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34364
34353
|
PluginRenderer,
|
34365
34354
|
{
|
34366
34355
|
plugins,
|
@@ -34373,8 +34362,8 @@ function Puck({
|
|
34373
34362
|
},
|
34374
34363
|
[config.root]
|
34375
34364
|
);
|
34376
|
-
const PageFieldWrapper = (0,
|
34377
|
-
(props) => /* @__PURE__ */ (0,
|
34365
|
+
const PageFieldWrapper = (0, import_react38.useCallback)(
|
34366
|
+
(props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34378
34367
|
PluginRenderer,
|
34379
34368
|
{
|
34380
34369
|
plugins,
|
@@ -34386,8 +34375,8 @@ function Puck({
|
|
34386
34375
|
),
|
34387
34376
|
[]
|
34388
34377
|
);
|
34389
|
-
const ComponentFieldWrapper = (0,
|
34390
|
-
(props) => /* @__PURE__ */ (0,
|
34378
|
+
const ComponentFieldWrapper = (0, import_react38.useCallback)(
|
34379
|
+
(props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34391
34380
|
PluginRenderer,
|
34392
34381
|
{
|
34393
34382
|
plugins,
|
@@ -34399,8 +34388,8 @@ function Puck({
|
|
34399
34388
|
),
|
34400
34389
|
[]
|
34401
34390
|
);
|
34402
|
-
const ComponentListWrapper = (0,
|
34403
|
-
const children = /* @__PURE__ */ (0,
|
34391
|
+
const ComponentListWrapper = (0, import_react38.useCallback)((props) => {
|
34392
|
+
const children = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34404
34393
|
PluginRenderer,
|
34405
34394
|
{
|
34406
34395
|
plugins,
|
@@ -34419,28 +34408,28 @@ function Puck({
|
|
34419
34408
|
const FieldWrapper = itemSelector ? ComponentFieldWrapper : PageFieldWrapper;
|
34420
34409
|
const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
|
34421
34410
|
let fields = selectedItem ? ((_b = config.components[selectedItem.type]) == null ? void 0 : _b.fields) || {} : rootFields;
|
34422
|
-
(0,
|
34411
|
+
(0, import_react38.useEffect)(() => {
|
34423
34412
|
if (onChange)
|
34424
34413
|
onChange(data);
|
34425
34414
|
}, [data]);
|
34426
34415
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
34427
|
-
const [draggedItem, setDraggedItem] = (0,
|
34416
|
+
const [draggedItem, setDraggedItem] = (0, import_react38.useState)();
|
34428
34417
|
const componentList = useComponentList(config, appState.ui);
|
34429
34418
|
const rootProps = data.root.props || data.root;
|
34430
|
-
(0,
|
34419
|
+
(0, import_react38.useEffect)(() => {
|
34431
34420
|
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
34432
34421
|
console.error(
|
34433
34422
|
"Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
|
34434
34423
|
);
|
34435
34424
|
}
|
34436
34425
|
}, []);
|
34437
|
-
return /* @__PURE__ */ (0,
|
34438
|
-
/* @__PURE__ */ (0,
|
34426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "puck", children: [
|
34427
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34439
34428
|
AppProvider,
|
34440
34429
|
{
|
34441
34430
|
value: { state: appState, dispatch, config, componentState },
|
34442
|
-
children: /* @__PURE__ */ (0,
|
34443
|
-
|
34431
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34432
|
+
import_dnd7.DragDropContext,
|
34444
34433
|
{
|
34445
34434
|
onDragUpdate: (update) => {
|
34446
34435
|
setDraggedItem(__spreadValues(__spreadValues({}, draggedItem), update));
|
@@ -34492,7 +34481,7 @@ function Puck({
|
|
34492
34481
|
});
|
34493
34482
|
}
|
34494
34483
|
},
|
34495
|
-
children: /* @__PURE__ */ (0,
|
34484
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34496
34485
|
DropZoneProvider,
|
34497
34486
|
{
|
34498
34487
|
value: {
|
@@ -34506,9 +34495,9 @@ function Puck({
|
|
34506
34495
|
mode: "edit",
|
34507
34496
|
areaId: "root"
|
34508
34497
|
},
|
34509
|
-
children: /* @__PURE__ */ (0,
|
34498
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(dropZoneContext.Consumer, { children: (ctx) => {
|
34510
34499
|
var _a2, _b2;
|
34511
|
-
return /* @__PURE__ */ (0,
|
34500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
34512
34501
|
"div",
|
34513
34502
|
{
|
34514
34503
|
style: {
|
@@ -34524,7 +34513,7 @@ function Puck({
|
|
34524
34513
|
right: 0
|
34525
34514
|
},
|
34526
34515
|
children: [
|
34527
|
-
/* @__PURE__ */ (0,
|
34516
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34528
34517
|
"header",
|
34529
34518
|
{
|
34530
34519
|
style: {
|
@@ -34534,19 +34523,19 @@ function Puck({
|
|
34534
34523
|
borderBottom: "1px solid var(--puck-color-grey-8)"
|
34535
34524
|
},
|
34536
34525
|
children: renderHeader ? renderHeader({
|
34537
|
-
children: /* @__PURE__ */ (0,
|
34526
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34538
34527
|
Button,
|
34539
34528
|
{
|
34540
34529
|
onClick: () => {
|
34541
34530
|
onPublish(data);
|
34542
34531
|
},
|
34543
|
-
icon: /* @__PURE__ */ (0,
|
34532
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(globe_default, { size: "14px" }),
|
34544
34533
|
children: "Publish"
|
34545
34534
|
}
|
34546
34535
|
),
|
34547
34536
|
dispatch,
|
34548
34537
|
state: appState
|
34549
|
-
}) : /* @__PURE__ */ (0,
|
34538
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
34550
34539
|
"div",
|
34551
34540
|
{
|
34552
34541
|
style: {
|
@@ -34557,14 +34546,14 @@ function Puck({
|
|
34557
34546
|
gridTemplateRows: "auto"
|
34558
34547
|
},
|
34559
34548
|
children: [
|
34560
|
-
/* @__PURE__ */ (0,
|
34549
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34561
34550
|
"div",
|
34562
34551
|
{
|
34563
34552
|
style: {
|
34564
34553
|
display: "flex",
|
34565
34554
|
gap: 16
|
34566
34555
|
},
|
34567
|
-
children: /* @__PURE__ */ (0,
|
34556
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34568
34557
|
IconButton,
|
34569
34558
|
{
|
34570
34559
|
onClick: () => dispatch({
|
@@ -34574,12 +34563,12 @@ function Puck({
|
|
34574
34563
|
}
|
34575
34564
|
}),
|
34576
34565
|
title: "Toggle left sidebar",
|
34577
|
-
children: /* @__PURE__ */ (0,
|
34566
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(sidebar_default, {})
|
34578
34567
|
}
|
34579
34568
|
)
|
34580
34569
|
}
|
34581
34570
|
),
|
34582
|
-
/* @__PURE__ */ (0,
|
34571
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34583
34572
|
"div",
|
34584
34573
|
{
|
34585
34574
|
style: {
|
@@ -34587,19 +34576,19 @@ function Puck({
|
|
34587
34576
|
justifyContent: "center",
|
34588
34577
|
alignItems: "center"
|
34589
34578
|
},
|
34590
|
-
children: /* @__PURE__ */ (0,
|
34579
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
34591
34580
|
headerTitle || rootProps.title || "Page",
|
34592
|
-
headerPath && /* @__PURE__ */ (0,
|
34581
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34593
34582
|
"small",
|
34594
34583
|
{
|
34595
34584
|
style: { fontWeight: 400, marginLeft: 4 },
|
34596
|
-
children: /* @__PURE__ */ (0,
|
34585
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("code", { children: headerPath })
|
34597
34586
|
}
|
34598
34587
|
)
|
34599
34588
|
] })
|
34600
34589
|
}
|
34601
34590
|
),
|
34602
|
-
/* @__PURE__ */ (0,
|
34591
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
34603
34592
|
"div",
|
34604
34593
|
{
|
34605
34594
|
style: {
|
@@ -34608,14 +34597,14 @@ function Puck({
|
|
34608
34597
|
justifyContent: "flex-end"
|
34609
34598
|
},
|
34610
34599
|
children: [
|
34611
|
-
/* @__PURE__ */ (0,
|
34612
|
-
/* @__PURE__ */ (0,
|
34600
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex" }, children: [
|
34601
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34613
34602
|
IconButton,
|
34614
34603
|
{
|
34615
34604
|
title: "undo",
|
34616
34605
|
disabled: !canRewind,
|
34617
34606
|
onClick: rewind,
|
34618
|
-
children: /* @__PURE__ */ (0,
|
34607
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34619
34608
|
chevron_left_default,
|
34620
34609
|
{
|
34621
34610
|
size: 21,
|
@@ -34624,13 +34613,13 @@ function Puck({
|
|
34624
34613
|
)
|
34625
34614
|
}
|
34626
34615
|
),
|
34627
|
-
/* @__PURE__ */ (0,
|
34616
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34628
34617
|
IconButton,
|
34629
34618
|
{
|
34630
34619
|
title: "redo",
|
34631
34620
|
disabled: !canForward,
|
34632
34621
|
onClick: forward,
|
34633
|
-
children: /* @__PURE__ */ (0,
|
34622
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34634
34623
|
chevron_right_default,
|
34635
34624
|
{
|
34636
34625
|
size: 21,
|
@@ -34644,13 +34633,13 @@ function Puck({
|
|
34644
34633
|
state: appState,
|
34645
34634
|
dispatch
|
34646
34635
|
}),
|
34647
|
-
/* @__PURE__ */ (0,
|
34636
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34648
34637
|
Button,
|
34649
34638
|
{
|
34650
34639
|
onClick: () => {
|
34651
34640
|
onPublish(data);
|
34652
34641
|
},
|
34653
|
-
icon: /* @__PURE__ */ (0,
|
34642
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(globe_default, { size: "14px" }),
|
34654
34643
|
children: "Publish"
|
34655
34644
|
}
|
34656
34645
|
)
|
@@ -34662,7 +34651,7 @@ function Puck({
|
|
34662
34651
|
)
|
34663
34652
|
}
|
34664
34653
|
),
|
34665
|
-
/* @__PURE__ */ (0,
|
34654
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
34666
34655
|
"div",
|
34667
34656
|
{
|
34668
34657
|
style: {
|
@@ -34674,9 +34663,9 @@ function Puck({
|
|
34674
34663
|
flexDirection: "column"
|
34675
34664
|
},
|
34676
34665
|
children: [
|
34677
|
-
/* @__PURE__ */ (0,
|
34678
|
-
/* @__PURE__ */ (0,
|
34679
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0,
|
34666
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SidebarSection, { title: "Components", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ComponentListWrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ComponentList, { id: "all" }) }) }),
|
34667
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(SidebarSection, { title: "Outline", children: [
|
34668
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34680
34669
|
LayerTree,
|
34681
34670
|
{
|
34682
34671
|
data,
|
@@ -34688,7 +34677,7 @@ function Puck({
|
|
34688
34677
|
),
|
34689
34678
|
Object.entries(findZonesForArea(data, "root")).map(
|
34690
34679
|
([zoneKey, zone]) => {
|
34691
|
-
return /* @__PURE__ */ (0,
|
34680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34692
34681
|
LayerTree,
|
34693
34682
|
{
|
34694
34683
|
data,
|
@@ -34706,7 +34695,7 @@ function Puck({
|
|
34706
34695
|
]
|
34707
34696
|
}
|
34708
34697
|
),
|
34709
|
-
/* @__PURE__ */ (0,
|
34698
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
34710
34699
|
"div",
|
34711
34700
|
{
|
34712
34701
|
style: {
|
@@ -34719,7 +34708,7 @@ function Puck({
|
|
34719
34708
|
onClick: () => setItemSelector(null),
|
34720
34709
|
id: "puck-frame",
|
34721
34710
|
children: [
|
34722
|
-
/* @__PURE__ */ (0,
|
34711
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34723
34712
|
"div",
|
34724
34713
|
{
|
34725
34714
|
className: "puck-root",
|
@@ -34728,26 +34717,26 @@ function Puck({
|
|
34728
34717
|
margin: 32,
|
34729
34718
|
zoom: 0.75
|
34730
34719
|
},
|
34731
|
-
children: /* @__PURE__ */ (0,
|
34720
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34732
34721
|
"div",
|
34733
34722
|
{
|
34734
34723
|
style: {
|
34735
34724
|
border: "1px solid var(--puck-color-grey-8)"
|
34736
34725
|
},
|
34737
|
-
children: /* @__PURE__ */ (0,
|
34726
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34738
34727
|
Page,
|
34739
34728
|
__spreadProps(__spreadValues({
|
34740
34729
|
dispatch,
|
34741
34730
|
state: appState
|
34742
34731
|
}, data.root), {
|
34743
|
-
children: /* @__PURE__ */ (0,
|
34732
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZone, { zone: rootDroppableId })
|
34744
34733
|
})
|
34745
34734
|
)
|
34746
34735
|
}
|
34747
34736
|
)
|
34748
34737
|
}
|
34749
34738
|
),
|
34750
|
-
/* @__PURE__ */ (0,
|
34739
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34751
34740
|
"div",
|
34752
34741
|
{
|
34753
34742
|
style: {
|
@@ -34760,7 +34749,7 @@ function Puck({
|
|
34760
34749
|
]
|
34761
34750
|
}
|
34762
34751
|
),
|
34763
|
-
/* @__PURE__ */ (0,
|
34752
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34764
34753
|
"div",
|
34765
34754
|
{
|
34766
34755
|
style: {
|
@@ -34772,7 +34761,7 @@ function Puck({
|
|
34772
34761
|
flexDirection: "column",
|
34773
34762
|
background: "var(--puck-color-white)"
|
34774
34763
|
},
|
34775
|
-
children: /* @__PURE__ */ (0,
|
34764
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FieldWrapper, { dispatch, state: appState, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34776
34765
|
SidebarSection,
|
34777
34766
|
{
|
34778
34767
|
noPadding: true,
|
@@ -34826,7 +34815,7 @@ function Puck({
|
|
34826
34815
|
};
|
34827
34816
|
if (selectedItem && itemSelector) {
|
34828
34817
|
const { readOnly = {} } = selectedItem;
|
34829
|
-
return /* @__PURE__ */ (0,
|
34818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34830
34819
|
InputOrGroup,
|
34831
34820
|
{
|
34832
34821
|
field,
|
@@ -34841,7 +34830,7 @@ function Puck({
|
|
34841
34830
|
);
|
34842
34831
|
} else {
|
34843
34832
|
const { readOnly = {} } = data.root;
|
34844
|
-
return /* @__PURE__ */ (0,
|
34833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34845
34834
|
InputOrGroup,
|
34846
34835
|
{
|
34847
34836
|
field,
|
@@ -34870,29 +34859,32 @@ function Puck({
|
|
34870
34859
|
)
|
34871
34860
|
}
|
34872
34861
|
),
|
34873
|
-
/* @__PURE__ */ (0,
|
34862
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { id: "puck-portal-root" })
|
34874
34863
|
] });
|
34875
34864
|
}
|
34876
34865
|
|
34877
34866
|
// components/Render/index.tsx
|
34878
34867
|
init_react_import();
|
34879
|
-
var
|
34868
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
34880
34869
|
function Render({ config, data }) {
|
34881
34870
|
var _a;
|
34882
34871
|
const rootProps = data.root.props || data.root;
|
34883
34872
|
const title = rootProps.title || "";
|
34884
34873
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
34885
|
-
return /* @__PURE__ */ (0,
|
34874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34886
34875
|
config.root.render,
|
34887
34876
|
__spreadProps(__spreadValues({}, rootProps), {
|
34877
|
+
puck: {
|
34878
|
+
renderDropZone: DropZone
|
34879
|
+
},
|
34888
34880
|
title,
|
34889
34881
|
editMode: false,
|
34890
34882
|
id: "puck-root",
|
34891
|
-
children: /* @__PURE__ */ (0,
|
34883
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZone, { zone: rootDroppableId })
|
34892
34884
|
})
|
34893
34885
|
) });
|
34894
34886
|
}
|
34895
|
-
return /* @__PURE__ */ (0,
|
34887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZone, { zone: rootDroppableId }) });
|
34896
34888
|
}
|
34897
34889
|
|
34898
34890
|
// lib/resolve-all-data.ts
|