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