@measured/puck 0.11.0 → 0.12.0-canary.c85f82f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/Config-60a50493.d.ts +195 -0
- package/dist/index.d.ts +21 -207
- package/dist/index.js +298 -306
- package/dist/rsc.d.ts +10 -0
- package/dist/rsc.js +135 -0
- package/package.json +3 -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,17 +33101,17 @@ 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 [localValueDb] = (0, import_use_debounce2.useDebounce)(localValue, 50, { leading: true });
|
33118
|
-
(0,
|
33106
|
+
(0, import_react30.useEffect)(() => {
|
33119
33107
|
if (value !== localValueDb) {
|
33120
33108
|
onChange(localValueDb);
|
33121
33109
|
}
|
33122
33110
|
}, [localValueDb]);
|
33123
|
-
const onChangeLocal = (0,
|
33111
|
+
const onChangeLocal = (0, import_react30.useCallback)((val) => {
|
33124
33112
|
setLocalValue(val);
|
33125
33113
|
}, []);
|
33126
|
-
(0,
|
33114
|
+
(0, import_react30.useEffect)(() => {
|
33127
33115
|
setLocalValue(value);
|
33128
33116
|
}, [value]);
|
33129
33117
|
const localProps = {
|
@@ -33131,42 +33119,43 @@ var InputOrGroup = (_a) => {
|
|
33131
33119
|
onChange: onChangeLocal
|
33132
33120
|
};
|
33133
33121
|
if (field.type === "array") {
|
33134
|
-
return /* @__PURE__ */ (0,
|
33122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ArrayField, __spreadValues(__spreadValues({}, props), localProps));
|
33135
33123
|
}
|
33136
33124
|
if (field.type === "external") {
|
33137
|
-
return /* @__PURE__ */ (0,
|
33125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ExternalField, __spreadValues(__spreadValues({}, props), localProps));
|
33138
33126
|
}
|
33139
33127
|
if (field.type === "select") {
|
33140
|
-
return /* @__PURE__ */ (0,
|
33128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SelectField, __spreadValues(__spreadValues({}, props), localProps));
|
33141
33129
|
}
|
33142
33130
|
if (field.type === "textarea") {
|
33143
|
-
return /* @__PURE__ */ (0,
|
33131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TextareaField, __spreadValues(__spreadValues({}, props), localProps));
|
33144
33132
|
}
|
33145
33133
|
if (field.type === "radio") {
|
33146
|
-
return /* @__PURE__ */ (0,
|
33134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RadioField, __spreadValues(__spreadValues({}, props), localProps));
|
33147
33135
|
}
|
33148
33136
|
if (field.type === "custom") {
|
33149
33137
|
if (!field.render) {
|
33150
33138
|
return null;
|
33151
33139
|
}
|
33152
|
-
return /* @__PURE__ */ (0,
|
33140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14(), children: field.render(__spreadValues({
|
33153
33141
|
field,
|
33154
33142
|
name,
|
33155
33143
|
readOnly
|
33156
33144
|
}, localProps)) });
|
33157
33145
|
}
|
33158
|
-
return /* @__PURE__ */ (0,
|
33146
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DefaultField, __spreadValues(__spreadValues({}, props), localProps));
|
33159
33147
|
};
|
33160
33148
|
|
33161
33149
|
// components/ComponentList/index.tsx
|
33162
33150
|
init_react_import();
|
33151
|
+
var import_dnd6 = require("@hello-pangea/dnd");
|
33163
33152
|
|
33164
33153
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
|
33165
33154
|
init_react_import();
|
33166
33155
|
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" };
|
33167
33156
|
|
33168
33157
|
// components/ComponentList/index.tsx
|
33169
|
-
var
|
33158
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
33170
33159
|
var getClassName15 = get_class_name_factory_default("ComponentList", styles_module_default9);
|
33171
33160
|
var getClassNameItem2 = get_class_name_factory_default("ComponentListItem", styles_module_default9);
|
33172
33161
|
var ComponentListItem = ({
|
@@ -33174,7 +33163,7 @@ var ComponentListItem = ({
|
|
33174
33163
|
index,
|
33175
33164
|
id
|
33176
33165
|
}) => {
|
33177
|
-
return /* @__PURE__ */ (0,
|
33166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameItem2(), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
33178
33167
|
Draggable2,
|
33179
33168
|
{
|
33180
33169
|
id,
|
@@ -33182,9 +33171,9 @@ var ComponentListItem = ({
|
|
33182
33171
|
showShadow: true,
|
33183
33172
|
disableAnimations: true,
|
33184
33173
|
className: () => getClassNameItem2("draggable"),
|
33185
|
-
children: () => /* @__PURE__ */ (0,
|
33174
|
+
children: () => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
33186
33175
|
component,
|
33187
|
-
/* @__PURE__ */ (0,
|
33176
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DragIcon, {}) })
|
33188
33177
|
] })
|
33189
33178
|
},
|
33190
33179
|
component
|
@@ -33197,8 +33186,8 @@ var ComponentList = ({
|
|
33197
33186
|
}) => {
|
33198
33187
|
const { config, state, setUi } = useAppContext();
|
33199
33188
|
const { expanded = true } = state.ui.componentList[id] || {};
|
33200
|
-
return /* @__PURE__ */ (0,
|
33201
|
-
title && /* @__PURE__ */ (0,
|
33189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassName15({ isExpanded: expanded }), children: [
|
33190
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
33202
33191
|
"div",
|
33203
33192
|
{
|
33204
33193
|
className: getClassName15("title"),
|
@@ -33211,17 +33200,17 @@ var ComponentList = ({
|
|
33211
33200
|
}),
|
33212
33201
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
33213
33202
|
children: [
|
33214
|
-
/* @__PURE__ */ (0,
|
33215
|
-
/* @__PURE__ */ (0,
|
33203
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: title }),
|
33204
|
+
/* @__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 }) })
|
33216
33205
|
]
|
33217
33206
|
}
|
33218
33207
|
),
|
33219
|
-
/* @__PURE__ */ (0,
|
33220
|
-
|
33208
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName15("content"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
33209
|
+
import_dnd6.Droppable,
|
33221
33210
|
{
|
33222
33211
|
droppableId: `component-list${title ? `:${title}` : ""}`,
|
33223
33212
|
isDropDisabled: true,
|
33224
|
-
children: (provided, snapshot) => /* @__PURE__ */ (0,
|
33213
|
+
children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
33225
33214
|
"div",
|
33226
33215
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
33227
33216
|
ref: provided.innerRef,
|
@@ -33230,7 +33219,7 @@ var ComponentList = ({
|
|
33230
33219
|
}),
|
33231
33220
|
children: [
|
33232
33221
|
children || Object.keys(config.components).map((componentKey, i) => {
|
33233
|
-
return /* @__PURE__ */ (0,
|
33222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
33234
33223
|
ComponentListItem,
|
33235
33224
|
{
|
33236
33225
|
component: componentKey,
|
@@ -33240,7 +33229,7 @@ var ComponentList = ({
|
|
33240
33229
|
componentKey
|
33241
33230
|
);
|
33242
33231
|
}),
|
33243
|
-
/* @__PURE__ */ (0,
|
33232
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
|
33244
33233
|
]
|
33245
33234
|
})
|
33246
33235
|
)
|
@@ -33252,10 +33241,10 @@ ComponentList.Item = ComponentListItem;
|
|
33252
33241
|
|
33253
33242
|
// lib/use-placeholder-style.ts
|
33254
33243
|
init_react_import();
|
33255
|
-
var
|
33244
|
+
var import_react31 = require("react");
|
33256
33245
|
var usePlaceholderStyle = () => {
|
33257
|
-
const queryAttr = "data-
|
33258
|
-
const [placeholderStyle, setPlaceholderStyle] = (0,
|
33246
|
+
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
33247
|
+
const [placeholderStyle, setPlaceholderStyle] = (0, import_react31.useState)();
|
33259
33248
|
const onDragStartOrUpdate = (draggedItem) => {
|
33260
33249
|
var _a;
|
33261
33250
|
const draggableId = draggedItem.draggableId;
|
@@ -33267,7 +33256,7 @@ var usePlaceholderStyle = () => {
|
|
33267
33256
|
return;
|
33268
33257
|
}
|
33269
33258
|
const targetListElement = document.querySelector(
|
33270
|
-
`[data-
|
33259
|
+
`[data-rfd-droppable-id='${droppableId}']`
|
33271
33260
|
);
|
33272
33261
|
const { clientHeight } = draggedDOM;
|
33273
33262
|
if (!targetListElement) {
|
@@ -33278,7 +33267,7 @@ var usePlaceholderStyle = () => {
|
|
33278
33267
|
if (destinationIndex > 0) {
|
33279
33268
|
const end = destinationIndex > draggedItem.source.index && isSameDroppable ? destinationIndex + 1 : destinationIndex;
|
33280
33269
|
const children = Array.from(targetListElement.children).filter(
|
33281
|
-
(item) => item !== draggedDOM && item.getAttributeNames().indexOf("data-puck-placeholder") === -1 && item.getAttributeNames().indexOf("data-
|
33270
|
+
(item) => item !== draggedDOM && item.getAttributeNames().indexOf("data-puck-placeholder") === -1 && item.getAttributeNames().indexOf("data-rfd-placeholder-context-id") === -1
|
33282
33271
|
).slice(0, end);
|
33283
33272
|
clientY = children.reduce(
|
33284
33273
|
(total, item) => total + item.clientHeight + parseInt(window.getComputedStyle(item).marginTop.replace("px", "")) + parseInt(
|
@@ -33307,7 +33296,7 @@ var styles_module_default10 = { "SidebarSection": "_SidebarSection_r7dv3_1", "Si
|
|
33307
33296
|
|
33308
33297
|
// lib/use-breadcrumbs.ts
|
33309
33298
|
init_react_import();
|
33310
|
-
var
|
33299
|
+
var import_react32 = require("react");
|
33311
33300
|
var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
|
33312
33301
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
33313
33302
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -33357,8 +33346,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
33357
33346
|
state: { data },
|
33358
33347
|
selectedItem
|
33359
33348
|
} = useAppContext();
|
33360
|
-
const dzContext = (0,
|
33361
|
-
return (0,
|
33349
|
+
const dzContext = (0, import_react32.useContext)(dropZoneContext);
|
33350
|
+
return (0, import_react32.useMemo)(() => {
|
33362
33351
|
const breadcrumbs = convertPathDataToBreadcrumbs(
|
33363
33352
|
selectedItem,
|
33364
33353
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -33373,7 +33362,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
33373
33362
|
|
33374
33363
|
// components/SidebarSection/index.tsx
|
33375
33364
|
var import_react_spinners5 = require("react-spinners");
|
33376
|
-
var
|
33365
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
33377
33366
|
var getClassName16 = get_class_name_factory_default("SidebarSection", styles_module_default10);
|
33378
33367
|
var SidebarSection = ({
|
33379
33368
|
children,
|
@@ -33385,10 +33374,10 @@ var SidebarSection = ({
|
|
33385
33374
|
}) => {
|
33386
33375
|
const { setUi } = useAppContext();
|
33387
33376
|
const breadcrumbs = useBreadcrumbs(1);
|
33388
|
-
return /* @__PURE__ */ (0,
|
33389
|
-
/* @__PURE__ */ (0,
|
33390
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
33391
|
-
/* @__PURE__ */ (0,
|
33377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: getClassName16({ noPadding }), style: { background }, children: [
|
33378
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("title"), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: getClassName16("breadcrumbs"), children: [
|
33379
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: getClassName16("breadcrumb"), children: [
|
33380
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
33392
33381
|
"div",
|
33393
33382
|
{
|
33394
33383
|
className: getClassName16("breadcrumbLabel"),
|
@@ -33396,12 +33385,12 @@ var SidebarSection = ({
|
|
33396
33385
|
children: breadcrumb.label
|
33397
33386
|
}
|
33398
33387
|
),
|
33399
|
-
/* @__PURE__ */ (0,
|
33388
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(chevron_right_default, { size: 16 })
|
33400
33389
|
] }, i)) : null,
|
33401
|
-
/* @__PURE__ */ (0,
|
33390
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
|
33402
33391
|
] }) }),
|
33403
|
-
/* @__PURE__ */ (0,
|
33404
|
-
isLoading && /* @__PURE__ */ (0,
|
33392
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("content"), children }),
|
33393
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_spinners5.ClipLoader, {}) })
|
33405
33394
|
] });
|
33406
33395
|
};
|
33407
33396
|
|
@@ -33410,15 +33399,15 @@ init_react_import();
|
|
33410
33399
|
|
33411
33400
|
// lib/use-puck-history.ts
|
33412
33401
|
init_react_import();
|
33413
|
-
var
|
33402
|
+
var import_react34 = require("react");
|
33414
33403
|
|
33415
33404
|
// lib/use-action-history.ts
|
33416
33405
|
init_react_import();
|
33417
|
-
var
|
33406
|
+
var import_react33 = require("react");
|
33418
33407
|
var EMPTY_HISTORY_INDEX = -1;
|
33419
33408
|
function useActionHistory() {
|
33420
|
-
const [histories, setHistories] = (0,
|
33421
|
-
const [currentHistoryIndex, setCurrentHistoryIndex] = (0,
|
33409
|
+
const [histories, setHistories] = (0, import_react33.useState)([]);
|
33410
|
+
const [currentHistoryIndex, setCurrentHistoryIndex] = (0, import_react33.useState)(EMPTY_HISTORY_INDEX);
|
33422
33411
|
const currentHistory = histories[currentHistoryIndex];
|
33423
33412
|
const canRewind = currentHistoryIndex > EMPTY_HISTORY_INDEX;
|
33424
33413
|
const canForward = currentHistoryIndex < histories.length - 1;
|
@@ -33497,7 +33486,7 @@ function usePuckHistory({
|
|
33497
33486
|
dispatch
|
33498
33487
|
});
|
33499
33488
|
}, DEBOUNCE_TIME);
|
33500
|
-
(0,
|
33489
|
+
(0, import_react34.useEffect)(() => {
|
33501
33490
|
historyEmitter.on(RECORD_DIFF, handleRecordDiff);
|
33502
33491
|
return () => {
|
33503
33492
|
historyEmitter.off(RECORD_DIFF, handleRecordDiff);
|
@@ -33853,7 +33842,7 @@ var scrollIntoView = (el) => {
|
|
33853
33842
|
};
|
33854
33843
|
|
33855
33844
|
// components/LayerTree/index.tsx
|
33856
|
-
var
|
33845
|
+
var import_react35 = require("react");
|
33857
33846
|
|
33858
33847
|
// lib/find-zones-for-area.ts
|
33859
33848
|
init_react_import();
|
@@ -33879,7 +33868,7 @@ var isChildOfZone = (item, maybeChild, ctx) => {
|
|
33879
33868
|
};
|
33880
33869
|
|
33881
33870
|
// components/LayerTree/index.tsx
|
33882
|
-
var
|
33871
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
33883
33872
|
var getClassName17 = get_class_name_factory_default("LayerTree", styles_module_default11);
|
33884
33873
|
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default11);
|
33885
33874
|
var LayerTree = ({
|
@@ -33891,15 +33880,15 @@ var LayerTree = ({
|
|
33891
33880
|
label
|
33892
33881
|
}) => {
|
33893
33882
|
const zones = data.zones || {};
|
33894
|
-
const ctx = (0,
|
33895
|
-
return /* @__PURE__ */ (0,
|
33896
|
-
label && /* @__PURE__ */ (0,
|
33897
|
-
/* @__PURE__ */ (0,
|
33883
|
+
const ctx = (0, import_react35.useContext)(dropZoneContext);
|
33884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
33885
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassName17("zoneTitle"), children: [
|
33886
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(layers_default, { size: "16" }) }),
|
33898
33887
|
" ",
|
33899
33888
|
label
|
33900
33889
|
] }),
|
33901
|
-
/* @__PURE__ */ (0,
|
33902
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
33890
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("ul", { className: getClassName17(), children: [
|
33891
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("helper"), children: "No items" }),
|
33903
33892
|
zoneContent.map((item, i) => {
|
33904
33893
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
33905
33894
|
const zonesForItem = findZonesForArea(data, item.props.id);
|
@@ -33914,7 +33903,7 @@ var LayerTree = ({
|
|
33914
33903
|
const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
|
33915
33904
|
const isHovering = hoveringComponent === item.props.id;
|
33916
33905
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
33917
|
-
return /* @__PURE__ */ (0,
|
33906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
33918
33907
|
"li",
|
33919
33908
|
{
|
33920
33909
|
className: getClassNameLayer({
|
@@ -33924,7 +33913,7 @@ var LayerTree = ({
|
|
33924
33913
|
childIsSelected
|
33925
33914
|
}),
|
33926
33915
|
children: [
|
33927
|
-
/* @__PURE__ */ (0,
|
33916
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
33928
33917
|
"div",
|
33929
33918
|
{
|
33930
33919
|
className: getClassNameLayer("clickable"),
|
@@ -33940,7 +33929,7 @@ var LayerTree = ({
|
|
33940
33929
|
const id = zoneContent[i].props.id;
|
33941
33930
|
scrollIntoView(
|
33942
33931
|
document.querySelector(
|
33943
|
-
`[data-
|
33932
|
+
`[data-rfd-drag-handle-draggable-id="draggable-${id}"]`
|
33944
33933
|
)
|
33945
33934
|
);
|
33946
33935
|
},
|
@@ -33955,22 +33944,22 @@ var LayerTree = ({
|
|
33955
33944
|
setHoveringComponent(null);
|
33956
33945
|
},
|
33957
33946
|
children: [
|
33958
|
-
containsZone && /* @__PURE__ */ (0,
|
33947
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
33959
33948
|
"div",
|
33960
33949
|
{
|
33961
33950
|
className: getClassNameLayer("chevron"),
|
33962
33951
|
title: isSelected ? "Collapse" : "Expand",
|
33963
|
-
children: /* @__PURE__ */ (0,
|
33952
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(chevron_down_default, { size: "12" })
|
33964
33953
|
}
|
33965
33954
|
),
|
33966
|
-
/* @__PURE__ */ (0,
|
33967
|
-
/* @__PURE__ */ (0,
|
33955
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
33956
|
+
/* @__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" }) }),
|
33968
33957
|
item.type
|
33969
33958
|
] })
|
33970
33959
|
]
|
33971
33960
|
}
|
33972
33961
|
) }),
|
33973
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
33962
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
33974
33963
|
LayerTree,
|
33975
33964
|
{
|
33976
33965
|
data,
|
@@ -34016,11 +34005,11 @@ var flushZones = (appState) => {
|
|
34016
34005
|
|
34017
34006
|
// lib/use-component-list.tsx
|
34018
34007
|
init_react_import();
|
34019
|
-
var
|
34020
|
-
var
|
34008
|
+
var import_react36 = require("react");
|
34009
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
34021
34010
|
var useComponentList = (config, ui) => {
|
34022
|
-
const [componentList, setComponentList] = (0,
|
34023
|
-
(0,
|
34011
|
+
const [componentList, setComponentList] = (0, import_react36.useState)();
|
34012
|
+
(0, import_react36.useEffect)(() => {
|
34024
34013
|
var _a, _b, _c;
|
34025
34014
|
if (Object.keys(ui.componentList).length > 0) {
|
34026
34015
|
const matchedComponents = [];
|
@@ -34030,14 +34019,14 @@ var useComponentList = (config, ui) => {
|
|
34030
34019
|
if (category.visible === false || !category.components) {
|
34031
34020
|
return null;
|
34032
34021
|
}
|
34033
|
-
return /* @__PURE__ */ (0,
|
34022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
34034
34023
|
ComponentList,
|
34035
34024
|
{
|
34036
34025
|
id: categoryKey,
|
34037
34026
|
title: category.title || categoryKey,
|
34038
34027
|
children: category.components.map((componentName, i) => {
|
34039
34028
|
matchedComponents.push(componentName);
|
34040
|
-
return /* @__PURE__ */ (0,
|
34029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
34041
34030
|
ComponentList.Item,
|
34042
34031
|
{
|
34043
34032
|
component: componentName,
|
@@ -34057,13 +34046,13 @@ var useComponentList = (config, ui) => {
|
|
34057
34046
|
);
|
34058
34047
|
if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
|
34059
34048
|
_componentList.push(
|
34060
|
-
/* @__PURE__ */ (0,
|
34049
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
34061
34050
|
ComponentList,
|
34062
34051
|
{
|
34063
34052
|
id: "other",
|
34064
34053
|
title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
|
34065
34054
|
children: remainingComponents.map((componentName, i) => {
|
34066
|
-
return /* @__PURE__ */ (0,
|
34055
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
34067
34056
|
ComponentList.Item,
|
34068
34057
|
{
|
34069
34058
|
component: componentName,
|
@@ -34086,7 +34075,7 @@ var useComponentList = (config, ui) => {
|
|
34086
34075
|
|
34087
34076
|
// lib/use-resolved-data.ts
|
34088
34077
|
init_react_import();
|
34089
|
-
var
|
34078
|
+
var import_react37 = require("react");
|
34090
34079
|
|
34091
34080
|
// lib/resolve-component-data.ts
|
34092
34081
|
init_react_import();
|
@@ -34201,13 +34190,13 @@ var resolveRootData = (data, config) => __async(void 0, null, function* () {
|
|
34201
34190
|
|
34202
34191
|
// lib/use-resolved-data.ts
|
34203
34192
|
var useResolvedData = (data, config, dispatch) => {
|
34204
|
-
const [{ resolverKey, newData }, setResolverState] = (0,
|
34193
|
+
const [{ resolverKey, newData }, setResolverState] = (0, import_react37.useState)({
|
34205
34194
|
resolverKey: 0,
|
34206
34195
|
newData: data
|
34207
34196
|
});
|
34208
|
-
const [componentState, setComponentState] = (0,
|
34197
|
+
const [componentState, setComponentState] = (0, import_react37.useState)({});
|
34209
34198
|
const deferredSetStates = {};
|
34210
|
-
const setComponentLoading = (0,
|
34199
|
+
const setComponentLoading = (0, import_react37.useCallback)(
|
34211
34200
|
(id, loading, defer = 0) => {
|
34212
34201
|
if (deferredSetStates[id]) {
|
34213
34202
|
clearTimeout(deferredSetStates[id]);
|
@@ -34265,10 +34254,10 @@ var useResolvedData = (data, config, dispatch) => {
|
|
34265
34254
|
});
|
34266
34255
|
yield Promise.all(promises);
|
34267
34256
|
});
|
34268
|
-
(0,
|
34257
|
+
(0, import_react37.useEffect)(() => {
|
34269
34258
|
runResolvers();
|
34270
34259
|
}, [resolverKey]);
|
34271
|
-
const resolveData = (0,
|
34260
|
+
const resolveData = (0, import_react37.useCallback)((newData2 = data) => {
|
34272
34261
|
setResolverState((curr) => ({
|
34273
34262
|
resolverKey: curr.resolverKey + 1,
|
34274
34263
|
newData: newData2
|
@@ -34281,7 +34270,7 @@ var useResolvedData = (data, config, dispatch) => {
|
|
34281
34270
|
};
|
34282
34271
|
|
34283
34272
|
// components/Puck/index.tsx
|
34284
|
-
var
|
34273
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
34285
34274
|
var defaultPageFields = {
|
34286
34275
|
title: { type: "text" }
|
34287
34276
|
};
|
@@ -34293,7 +34282,7 @@ var PluginRenderer = ({
|
|
34293
34282
|
renderMethod
|
34294
34283
|
}) => {
|
34295
34284
|
return plugins.filter((item) => item[renderMethod]).map((item) => item[renderMethod]).reduce(
|
34296
|
-
(accChildren, Item) => /* @__PURE__ */ (0,
|
34285
|
+
(accChildren, Item) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Item, { dispatch, state, children: accChildren }),
|
34297
34286
|
children
|
34298
34287
|
);
|
34299
34288
|
};
|
@@ -34310,7 +34299,7 @@ function Puck({
|
|
34310
34299
|
headerPath
|
34311
34300
|
}) {
|
34312
34301
|
var _a, _b;
|
34313
|
-
const [reducer] = (0,
|
34302
|
+
const [reducer] = (0, import_react38.useState)(() => createReducer({ config }));
|
34314
34303
|
const initialAppState = __spreadProps(__spreadValues({}, defaultAppState), {
|
34315
34304
|
data: initialData,
|
34316
34305
|
ui: __spreadProps(__spreadValues({}, defaultAppState.ui), {
|
@@ -34330,7 +34319,7 @@ function Puck({
|
|
34330
34319
|
) : {}
|
34331
34320
|
})
|
34332
34321
|
});
|
34333
|
-
const [appState, dispatch] = (0,
|
34322
|
+
const [appState, dispatch] = (0, import_react38.useReducer)(
|
34334
34323
|
reducer,
|
34335
34324
|
flushZones(initialAppState)
|
34336
34325
|
);
|
@@ -34345,7 +34334,7 @@ function Puck({
|
|
34345
34334
|
dispatch
|
34346
34335
|
});
|
34347
34336
|
const { itemSelector, leftSideBarVisible } = ui;
|
34348
|
-
const setItemSelector = (0,
|
34337
|
+
const setItemSelector = (0, import_react38.useCallback)(
|
34349
34338
|
(newItemSelector) => {
|
34350
34339
|
dispatch({
|
34351
34340
|
type: "setUi",
|
@@ -34355,10 +34344,10 @@ function Puck({
|
|
34355
34344
|
[]
|
34356
34345
|
);
|
34357
34346
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
34358
|
-
const Page = (0,
|
34347
|
+
const Page = (0, import_react38.useCallback)(
|
34359
34348
|
(pageProps) => {
|
34360
34349
|
var _a2, _b2;
|
34361
|
-
return /* @__PURE__ */ (0,
|
34350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34362
34351
|
PluginRenderer,
|
34363
34352
|
{
|
34364
34353
|
plugins,
|
@@ -34371,8 +34360,8 @@ function Puck({
|
|
34371
34360
|
},
|
34372
34361
|
[config.root]
|
34373
34362
|
);
|
34374
|
-
const PageFieldWrapper = (0,
|
34375
|
-
(props) => /* @__PURE__ */ (0,
|
34363
|
+
const PageFieldWrapper = (0, import_react38.useCallback)(
|
34364
|
+
(props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34376
34365
|
PluginRenderer,
|
34377
34366
|
{
|
34378
34367
|
plugins,
|
@@ -34384,8 +34373,8 @@ function Puck({
|
|
34384
34373
|
),
|
34385
34374
|
[]
|
34386
34375
|
);
|
34387
|
-
const ComponentFieldWrapper = (0,
|
34388
|
-
(props) => /* @__PURE__ */ (0,
|
34376
|
+
const ComponentFieldWrapper = (0, import_react38.useCallback)(
|
34377
|
+
(props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34389
34378
|
PluginRenderer,
|
34390
34379
|
{
|
34391
34380
|
plugins,
|
@@ -34397,8 +34386,8 @@ function Puck({
|
|
34397
34386
|
),
|
34398
34387
|
[]
|
34399
34388
|
);
|
34400
|
-
const ComponentListWrapper = (0,
|
34401
|
-
const children = /* @__PURE__ */ (0,
|
34389
|
+
const ComponentListWrapper = (0, import_react38.useCallback)((props) => {
|
34390
|
+
const children = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34402
34391
|
PluginRenderer,
|
34403
34392
|
{
|
34404
34393
|
plugins,
|
@@ -34417,28 +34406,28 @@ function Puck({
|
|
34417
34406
|
const FieldWrapper = itemSelector ? ComponentFieldWrapper : PageFieldWrapper;
|
34418
34407
|
const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
|
34419
34408
|
let fields = selectedItem ? ((_b = config.components[selectedItem.type]) == null ? void 0 : _b.fields) || {} : rootFields;
|
34420
|
-
(0,
|
34409
|
+
(0, import_react38.useEffect)(() => {
|
34421
34410
|
if (onChange)
|
34422
34411
|
onChange(data);
|
34423
34412
|
}, [data]);
|
34424
34413
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
34425
|
-
const [draggedItem, setDraggedItem] = (0,
|
34414
|
+
const [draggedItem, setDraggedItem] = (0, import_react38.useState)();
|
34426
34415
|
const componentList = useComponentList(config, appState.ui);
|
34427
34416
|
const rootProps = data.root.props || data.root;
|
34428
|
-
(0,
|
34417
|
+
(0, import_react38.useEffect)(() => {
|
34429
34418
|
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
34430
34419
|
console.error(
|
34431
34420
|
"Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
|
34432
34421
|
);
|
34433
34422
|
}
|
34434
34423
|
}, []);
|
34435
|
-
return /* @__PURE__ */ (0,
|
34436
|
-
/* @__PURE__ */ (0,
|
34424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "puck", children: [
|
34425
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34437
34426
|
AppProvider,
|
34438
34427
|
{
|
34439
34428
|
value: { state: appState, dispatch, config, componentState },
|
34440
|
-
children: /* @__PURE__ */ (0,
|
34441
|
-
|
34429
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34430
|
+
import_dnd7.DragDropContext,
|
34442
34431
|
{
|
34443
34432
|
onDragUpdate: (update) => {
|
34444
34433
|
setDraggedItem(__spreadValues(__spreadValues({}, draggedItem), update));
|
@@ -34490,7 +34479,7 @@ function Puck({
|
|
34490
34479
|
});
|
34491
34480
|
}
|
34492
34481
|
},
|
34493
|
-
children: /* @__PURE__ */ (0,
|
34482
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34494
34483
|
DropZoneProvider,
|
34495
34484
|
{
|
34496
34485
|
value: {
|
@@ -34504,9 +34493,9 @@ function Puck({
|
|
34504
34493
|
mode: "edit",
|
34505
34494
|
areaId: "root"
|
34506
34495
|
},
|
34507
|
-
children: /* @__PURE__ */ (0,
|
34496
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(dropZoneContext.Consumer, { children: (ctx) => {
|
34508
34497
|
var _a2, _b2;
|
34509
|
-
return /* @__PURE__ */ (0,
|
34498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
34510
34499
|
"div",
|
34511
34500
|
{
|
34512
34501
|
style: {
|
@@ -34522,7 +34511,7 @@ function Puck({
|
|
34522
34511
|
right: 0
|
34523
34512
|
},
|
34524
34513
|
children: [
|
34525
|
-
/* @__PURE__ */ (0,
|
34514
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34526
34515
|
"header",
|
34527
34516
|
{
|
34528
34517
|
style: {
|
@@ -34532,19 +34521,19 @@ function Puck({
|
|
34532
34521
|
borderBottom: "1px solid var(--puck-color-grey-8)"
|
34533
34522
|
},
|
34534
34523
|
children: renderHeader ? renderHeader({
|
34535
|
-
children: /* @__PURE__ */ (0,
|
34524
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34536
34525
|
Button,
|
34537
34526
|
{
|
34538
34527
|
onClick: () => {
|
34539
34528
|
onPublish(data);
|
34540
34529
|
},
|
34541
|
-
icon: /* @__PURE__ */ (0,
|
34530
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(globe_default, { size: "14px" }),
|
34542
34531
|
children: "Publish"
|
34543
34532
|
}
|
34544
34533
|
),
|
34545
34534
|
dispatch,
|
34546
34535
|
state: appState
|
34547
|
-
}) : /* @__PURE__ */ (0,
|
34536
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
34548
34537
|
"div",
|
34549
34538
|
{
|
34550
34539
|
style: {
|
@@ -34555,14 +34544,14 @@ function Puck({
|
|
34555
34544
|
gridTemplateRows: "auto"
|
34556
34545
|
},
|
34557
34546
|
children: [
|
34558
|
-
/* @__PURE__ */ (0,
|
34547
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34559
34548
|
"div",
|
34560
34549
|
{
|
34561
34550
|
style: {
|
34562
34551
|
display: "flex",
|
34563
34552
|
gap: 16
|
34564
34553
|
},
|
34565
|
-
children: /* @__PURE__ */ (0,
|
34554
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34566
34555
|
IconButton,
|
34567
34556
|
{
|
34568
34557
|
onClick: () => dispatch({
|
@@ -34572,12 +34561,12 @@ function Puck({
|
|
34572
34561
|
}
|
34573
34562
|
}),
|
34574
34563
|
title: "Toggle left sidebar",
|
34575
|
-
children: /* @__PURE__ */ (0,
|
34564
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(sidebar_default, {})
|
34576
34565
|
}
|
34577
34566
|
)
|
34578
34567
|
}
|
34579
34568
|
),
|
34580
|
-
/* @__PURE__ */ (0,
|
34569
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34581
34570
|
"div",
|
34582
34571
|
{
|
34583
34572
|
style: {
|
@@ -34585,19 +34574,19 @@ function Puck({
|
|
34585
34574
|
justifyContent: "center",
|
34586
34575
|
alignItems: "center"
|
34587
34576
|
},
|
34588
|
-
children: /* @__PURE__ */ (0,
|
34577
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
34589
34578
|
headerTitle || rootProps.title || "Page",
|
34590
|
-
headerPath && /* @__PURE__ */ (0,
|
34579
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34591
34580
|
"small",
|
34592
34581
|
{
|
34593
34582
|
style: { fontWeight: 400, marginLeft: 4 },
|
34594
|
-
children: /* @__PURE__ */ (0,
|
34583
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("code", { children: headerPath })
|
34595
34584
|
}
|
34596
34585
|
)
|
34597
34586
|
] })
|
34598
34587
|
}
|
34599
34588
|
),
|
34600
|
-
/* @__PURE__ */ (0,
|
34589
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
34601
34590
|
"div",
|
34602
34591
|
{
|
34603
34592
|
style: {
|
@@ -34606,14 +34595,14 @@ function Puck({
|
|
34606
34595
|
justifyContent: "flex-end"
|
34607
34596
|
},
|
34608
34597
|
children: [
|
34609
|
-
/* @__PURE__ */ (0,
|
34610
|
-
/* @__PURE__ */ (0,
|
34598
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex" }, children: [
|
34599
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34611
34600
|
IconButton,
|
34612
34601
|
{
|
34613
34602
|
title: "undo",
|
34614
34603
|
disabled: !canRewind,
|
34615
34604
|
onClick: rewind,
|
34616
|
-
children: /* @__PURE__ */ (0,
|
34605
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34617
34606
|
chevron_left_default,
|
34618
34607
|
{
|
34619
34608
|
size: 21,
|
@@ -34622,13 +34611,13 @@ function Puck({
|
|
34622
34611
|
)
|
34623
34612
|
}
|
34624
34613
|
),
|
34625
|
-
/* @__PURE__ */ (0,
|
34614
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34626
34615
|
IconButton,
|
34627
34616
|
{
|
34628
34617
|
title: "redo",
|
34629
34618
|
disabled: !canForward,
|
34630
34619
|
onClick: forward,
|
34631
|
-
children: /* @__PURE__ */ (0,
|
34620
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34632
34621
|
chevron_right_default,
|
34633
34622
|
{
|
34634
34623
|
size: 21,
|
@@ -34642,13 +34631,13 @@ function Puck({
|
|
34642
34631
|
state: appState,
|
34643
34632
|
dispatch
|
34644
34633
|
}),
|
34645
|
-
/* @__PURE__ */ (0,
|
34634
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34646
34635
|
Button,
|
34647
34636
|
{
|
34648
34637
|
onClick: () => {
|
34649
34638
|
onPublish(data);
|
34650
34639
|
},
|
34651
|
-
icon: /* @__PURE__ */ (0,
|
34640
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(globe_default, { size: "14px" }),
|
34652
34641
|
children: "Publish"
|
34653
34642
|
}
|
34654
34643
|
)
|
@@ -34660,7 +34649,7 @@ function Puck({
|
|
34660
34649
|
)
|
34661
34650
|
}
|
34662
34651
|
),
|
34663
|
-
/* @__PURE__ */ (0,
|
34652
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
34664
34653
|
"div",
|
34665
34654
|
{
|
34666
34655
|
style: {
|
@@ -34672,9 +34661,9 @@ function Puck({
|
|
34672
34661
|
flexDirection: "column"
|
34673
34662
|
},
|
34674
34663
|
children: [
|
34675
|
-
/* @__PURE__ */ (0,
|
34676
|
-
/* @__PURE__ */ (0,
|
34677
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0,
|
34664
|
+
/* @__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" }) }) }),
|
34665
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(SidebarSection, { title: "Outline", children: [
|
34666
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34678
34667
|
LayerTree,
|
34679
34668
|
{
|
34680
34669
|
data,
|
@@ -34686,7 +34675,7 @@ function Puck({
|
|
34686
34675
|
),
|
34687
34676
|
Object.entries(findZonesForArea(data, "root")).map(
|
34688
34677
|
([zoneKey, zone]) => {
|
34689
|
-
return /* @__PURE__ */ (0,
|
34678
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34690
34679
|
LayerTree,
|
34691
34680
|
{
|
34692
34681
|
data,
|
@@ -34704,7 +34693,7 @@ function Puck({
|
|
34704
34693
|
]
|
34705
34694
|
}
|
34706
34695
|
),
|
34707
|
-
/* @__PURE__ */ (0,
|
34696
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
34708
34697
|
"div",
|
34709
34698
|
{
|
34710
34699
|
style: {
|
@@ -34717,7 +34706,7 @@ function Puck({
|
|
34717
34706
|
onClick: () => setItemSelector(null),
|
34718
34707
|
id: "puck-frame",
|
34719
34708
|
children: [
|
34720
|
-
/* @__PURE__ */ (0,
|
34709
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34721
34710
|
"div",
|
34722
34711
|
{
|
34723
34712
|
className: "puck-root",
|
@@ -34726,26 +34715,26 @@ function Puck({
|
|
34726
34715
|
margin: 32,
|
34727
34716
|
zoom: 0.75
|
34728
34717
|
},
|
34729
|
-
children: /* @__PURE__ */ (0,
|
34718
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34730
34719
|
"div",
|
34731
34720
|
{
|
34732
34721
|
style: {
|
34733
34722
|
border: "1px solid var(--puck-color-grey-8)"
|
34734
34723
|
},
|
34735
|
-
children: /* @__PURE__ */ (0,
|
34724
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34736
34725
|
Page,
|
34737
34726
|
__spreadProps(__spreadValues({
|
34738
34727
|
dispatch,
|
34739
34728
|
state: appState
|
34740
34729
|
}, data.root), {
|
34741
|
-
children: /* @__PURE__ */ (0,
|
34730
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZone, { zone: rootDroppableId })
|
34742
34731
|
})
|
34743
34732
|
)
|
34744
34733
|
}
|
34745
34734
|
)
|
34746
34735
|
}
|
34747
34736
|
),
|
34748
|
-
/* @__PURE__ */ (0,
|
34737
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34749
34738
|
"div",
|
34750
34739
|
{
|
34751
34740
|
style: {
|
@@ -34758,7 +34747,7 @@ function Puck({
|
|
34758
34747
|
]
|
34759
34748
|
}
|
34760
34749
|
),
|
34761
|
-
/* @__PURE__ */ (0,
|
34750
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34762
34751
|
"div",
|
34763
34752
|
{
|
34764
34753
|
style: {
|
@@ -34770,7 +34759,7 @@ function Puck({
|
|
34770
34759
|
flexDirection: "column",
|
34771
34760
|
background: "var(--puck-color-white)"
|
34772
34761
|
},
|
34773
|
-
children: /* @__PURE__ */ (0,
|
34762
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FieldWrapper, { dispatch, state: appState, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34774
34763
|
SidebarSection,
|
34775
34764
|
{
|
34776
34765
|
noPadding: true,
|
@@ -34824,7 +34813,7 @@ function Puck({
|
|
34824
34813
|
};
|
34825
34814
|
if (selectedItem && itemSelector) {
|
34826
34815
|
const { readOnly = {} } = selectedItem;
|
34827
|
-
return /* @__PURE__ */ (0,
|
34816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34828
34817
|
InputOrGroup,
|
34829
34818
|
{
|
34830
34819
|
field,
|
@@ -34839,7 +34828,7 @@ function Puck({
|
|
34839
34828
|
);
|
34840
34829
|
} else {
|
34841
34830
|
const { readOnly = {} } = data.root;
|
34842
|
-
return /* @__PURE__ */ (0,
|
34831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34843
34832
|
InputOrGroup,
|
34844
34833
|
{
|
34845
34834
|
field,
|
@@ -34868,29 +34857,32 @@ function Puck({
|
|
34868
34857
|
)
|
34869
34858
|
}
|
34870
34859
|
),
|
34871
|
-
/* @__PURE__ */ (0,
|
34860
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { id: "puck-portal-root" })
|
34872
34861
|
] });
|
34873
34862
|
}
|
34874
34863
|
|
34875
34864
|
// components/Render/index.tsx
|
34876
34865
|
init_react_import();
|
34877
|
-
var
|
34866
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
34878
34867
|
function Render({ config, data }) {
|
34879
34868
|
var _a;
|
34880
34869
|
const rootProps = data.root.props || data.root;
|
34881
34870
|
const title = rootProps.title || "";
|
34882
34871
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
34883
|
-
return /* @__PURE__ */ (0,
|
34872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34884
34873
|
config.root.render,
|
34885
34874
|
__spreadProps(__spreadValues({}, rootProps), {
|
34875
|
+
puck: {
|
34876
|
+
renderDropZone: DropZone
|
34877
|
+
},
|
34886
34878
|
title,
|
34887
34879
|
editMode: false,
|
34888
34880
|
id: "puck-root",
|
34889
|
-
children: /* @__PURE__ */ (0,
|
34881
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZone, { zone: rootDroppableId })
|
34890
34882
|
})
|
34891
34883
|
) });
|
34892
34884
|
}
|
34893
|
-
return /* @__PURE__ */ (0,
|
34885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZone, { zone: rootDroppableId }) });
|
34894
34886
|
}
|
34895
34887
|
|
34896
34888
|
// lib/resolve-all-data.ts
|