@measured/puck 0.10.0-canary.74cd3a7 → 0.10.0-canary.a7d9a28
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/dist/index.css +171 -224
- package/dist/index.d.ts +1 -10
- package/dist/index.js +438 -791
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -327,7 +327,7 @@ var require_react_is_development = __commonJS({
|
|
327
327
|
var ContextProvider = REACT_PROVIDER_TYPE;
|
328
328
|
var Element = REACT_ELEMENT_TYPE;
|
329
329
|
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
330
|
-
var
|
330
|
+
var Fragment9 = REACT_FRAGMENT_TYPE;
|
331
331
|
var Lazy = REACT_LAZY_TYPE;
|
332
332
|
var Memo = REACT_MEMO_TYPE;
|
333
333
|
var Portal = REACT_PORTAL_TYPE;
|
@@ -386,7 +386,7 @@ var require_react_is_development = __commonJS({
|
|
386
386
|
exports.ContextProvider = ContextProvider;
|
387
387
|
exports.Element = Element;
|
388
388
|
exports.ForwardRef = ForwardRef;
|
389
|
-
exports.Fragment =
|
389
|
+
exports.Fragment = Fragment9;
|
390
390
|
exports.Lazy = Lazy;
|
391
391
|
exports.Memo = Memo;
|
392
392
|
exports.Portal = Portal;
|
@@ -760,7 +760,7 @@ var require_factoryWithTypeCheckers = __commonJS({
|
|
760
760
|
function validate(props, propName, componentName, location, propFullName) {
|
761
761
|
if (!(props[propName] instanceof expectedClass)) {
|
762
762
|
var expectedClassName = expectedClass.name || ANONYMOUS;
|
763
|
-
var actualClassName =
|
763
|
+
var actualClassName = getClassName11(props[propName]);
|
764
764
|
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
|
765
765
|
}
|
766
766
|
return null;
|
@@ -1012,7 +1012,7 @@ var require_factoryWithTypeCheckers = __commonJS({
|
|
1012
1012
|
return type;
|
1013
1013
|
}
|
1014
1014
|
}
|
1015
|
-
function
|
1015
|
+
function getClassName11(propValue) {
|
1016
1016
|
if (!propValue.constructor || !propValue.constructor.name) {
|
1017
1017
|
return ANONYMOUS;
|
1018
1018
|
}
|
@@ -1214,11 +1214,11 @@ var Button = ({
|
|
1214
1214
|
|
1215
1215
|
// components/DropZone/index.tsx
|
1216
1216
|
init_react_import();
|
1217
|
-
var
|
1217
|
+
var import_react21 = require("react");
|
1218
1218
|
|
1219
1219
|
// components/DraggableComponent/index.tsx
|
1220
1220
|
init_react_import();
|
1221
|
-
var
|
1221
|
+
var import_react18 = require("react");
|
1222
1222
|
var import_react_beautiful_dnd = require("react-beautiful-dnd");
|
1223
1223
|
|
1224
1224
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
@@ -2130,7 +2130,7 @@ List.propTypes = {
|
|
2130
2130
|
List.displayName = "List";
|
2131
2131
|
var list_default = List;
|
2132
2132
|
|
2133
|
-
// ../../node_modules/react-feather/dist/icons/
|
2133
|
+
// ../../node_modules/react-feather/dist/icons/sidebar.js
|
2134
2134
|
init_react_import();
|
2135
2135
|
var import_react14 = __toESM(require("react"));
|
2136
2136
|
var import_prop_types12 = __toESM(require_prop_types());
|
@@ -2180,7 +2180,7 @@ function _objectWithoutPropertiesLoose12(source, excluded) {
|
|
2180
2180
|
}
|
2181
2181
|
return target;
|
2182
2182
|
}
|
2183
|
-
var
|
2183
|
+
var Sidebar = (0, import_react14.forwardRef)(function(_ref, ref) {
|
2184
2184
|
var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, _ref$size = _ref.size, size = _ref$size === void 0 ? 24 : _ref$size, rest = _objectWithoutProperties12(_ref, ["color", "size"]);
|
2185
2185
|
return /* @__PURE__ */ import_react14.default.createElement("svg", _extends12({
|
2186
2186
|
ref,
|
@@ -2193,26 +2193,28 @@ var Plus = (0, import_react14.forwardRef)(function(_ref, ref) {
|
|
2193
2193
|
strokeWidth: "2",
|
2194
2194
|
strokeLinecap: "round",
|
2195
2195
|
strokeLinejoin: "round"
|
2196
|
-
}, rest), /* @__PURE__ */ import_react14.default.createElement("
|
2197
|
-
|
2198
|
-
|
2199
|
-
|
2200
|
-
|
2196
|
+
}, rest), /* @__PURE__ */ import_react14.default.createElement("rect", {
|
2197
|
+
x: "3",
|
2198
|
+
y: "3",
|
2199
|
+
width: "18",
|
2200
|
+
height: "18",
|
2201
|
+
rx: "2",
|
2202
|
+
ry: "2"
|
2201
2203
|
}), /* @__PURE__ */ import_react14.default.createElement("line", {
|
2202
|
-
x1: "
|
2203
|
-
y1: "
|
2204
|
-
x2: "
|
2205
|
-
y2: "
|
2204
|
+
x1: "9",
|
2205
|
+
y1: "3",
|
2206
|
+
x2: "9",
|
2207
|
+
y2: "21"
|
2206
2208
|
}));
|
2207
2209
|
});
|
2208
|
-
|
2210
|
+
Sidebar.propTypes = {
|
2209
2211
|
color: import_prop_types12.default.string,
|
2210
2212
|
size: import_prop_types12.default.oneOfType([import_prop_types12.default.string, import_prop_types12.default.number])
|
2211
2213
|
};
|
2212
|
-
|
2213
|
-
var
|
2214
|
+
Sidebar.displayName = "Sidebar";
|
2215
|
+
var sidebar_default = Sidebar;
|
2214
2216
|
|
2215
|
-
// ../../node_modules/react-feather/dist/icons/
|
2217
|
+
// ../../node_modules/react-feather/dist/icons/trash.js
|
2216
2218
|
init_react_import();
|
2217
2219
|
var import_react15 = __toESM(require("react"));
|
2218
2220
|
var import_prop_types13 = __toESM(require_prop_types());
|
@@ -2262,7 +2264,7 @@ function _objectWithoutPropertiesLoose13(source, excluded) {
|
|
2262
2264
|
}
|
2263
2265
|
return target;
|
2264
2266
|
}
|
2265
|
-
var
|
2267
|
+
var Trash = (0, import_react15.forwardRef)(function(_ref, ref) {
|
2266
2268
|
var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, _ref$size = _ref.size, size = _ref$size === void 0 ? 24 : _ref$size, rest = _objectWithoutProperties13(_ref, ["color", "size"]);
|
2267
2269
|
return /* @__PURE__ */ import_react15.default.createElement("svg", _extends13({
|
2268
2270
|
ref,
|
@@ -2275,28 +2277,20 @@ var Sidebar = (0, import_react15.forwardRef)(function(_ref, ref) {
|
|
2275
2277
|
strokeWidth: "2",
|
2276
2278
|
strokeLinecap: "round",
|
2277
2279
|
strokeLinejoin: "round"
|
2278
|
-
}, rest), /* @__PURE__ */ import_react15.default.createElement("
|
2279
|
-
|
2280
|
-
|
2281
|
-
|
2282
|
-
height: "18",
|
2283
|
-
rx: "2",
|
2284
|
-
ry: "2"
|
2285
|
-
}), /* @__PURE__ */ import_react15.default.createElement("line", {
|
2286
|
-
x1: "9",
|
2287
|
-
y1: "3",
|
2288
|
-
x2: "9",
|
2289
|
-
y2: "21"
|
2280
|
+
}, rest), /* @__PURE__ */ import_react15.default.createElement("polyline", {
|
2281
|
+
points: "3 6 5 6 21 6"
|
2282
|
+
}), /* @__PURE__ */ import_react15.default.createElement("path", {
|
2283
|
+
d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"
|
2290
2284
|
}));
|
2291
2285
|
});
|
2292
|
-
|
2286
|
+
Trash.propTypes = {
|
2293
2287
|
color: import_prop_types13.default.string,
|
2294
2288
|
size: import_prop_types13.default.oneOfType([import_prop_types13.default.string, import_prop_types13.default.number])
|
2295
2289
|
};
|
2296
|
-
|
2297
|
-
var
|
2290
|
+
Trash.displayName = "Trash";
|
2291
|
+
var trash_default = Trash;
|
2298
2292
|
|
2299
|
-
// ../../node_modules/react-feather/dist/icons/
|
2293
|
+
// ../../node_modules/react-feather/dist/icons/type.js
|
2300
2294
|
init_react_import();
|
2301
2295
|
var import_react16 = __toESM(require("react"));
|
2302
2296
|
var import_prop_types14 = __toESM(require_prop_types());
|
@@ -2346,7 +2340,7 @@ function _objectWithoutPropertiesLoose14(source, excluded) {
|
|
2346
2340
|
}
|
2347
2341
|
return target;
|
2348
2342
|
}
|
2349
|
-
var
|
2343
|
+
var Type = (0, import_react16.forwardRef)(function(_ref, ref) {
|
2350
2344
|
var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, _ref$size = _ref.size, size = _ref$size === void 0 ? 24 : _ref$size, rest = _objectWithoutProperties14(_ref, ["color", "size"]);
|
2351
2345
|
return /* @__PURE__ */ import_react16.default.createElement("svg", _extends14({
|
2352
2346
|
ref,
|
@@ -2360,89 +2354,13 @@ var Trash = (0, import_react16.forwardRef)(function(_ref, ref) {
|
|
2360
2354
|
strokeLinecap: "round",
|
2361
2355
|
strokeLinejoin: "round"
|
2362
2356
|
}, rest), /* @__PURE__ */ import_react16.default.createElement("polyline", {
|
2363
|
-
points: "3 6 5 6 21 6"
|
2364
|
-
}), /* @__PURE__ */ import_react16.default.createElement("path", {
|
2365
|
-
d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"
|
2366
|
-
}));
|
2367
|
-
});
|
2368
|
-
Trash.propTypes = {
|
2369
|
-
color: import_prop_types14.default.string,
|
2370
|
-
size: import_prop_types14.default.oneOfType([import_prop_types14.default.string, import_prop_types14.default.number])
|
2371
|
-
};
|
2372
|
-
Trash.displayName = "Trash";
|
2373
|
-
var trash_default = Trash;
|
2374
|
-
|
2375
|
-
// ../../node_modules/react-feather/dist/icons/type.js
|
2376
|
-
init_react_import();
|
2377
|
-
var import_react17 = __toESM(require("react"));
|
2378
|
-
var import_prop_types15 = __toESM(require_prop_types());
|
2379
|
-
function _extends15() {
|
2380
|
-
_extends15 = Object.assign || function(target) {
|
2381
|
-
for (var i = 1; i < arguments.length; i++) {
|
2382
|
-
var source = arguments[i];
|
2383
|
-
for (var key in source) {
|
2384
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
2385
|
-
target[key] = source[key];
|
2386
|
-
}
|
2387
|
-
}
|
2388
|
-
}
|
2389
|
-
return target;
|
2390
|
-
};
|
2391
|
-
return _extends15.apply(this, arguments);
|
2392
|
-
}
|
2393
|
-
function _objectWithoutProperties15(source, excluded) {
|
2394
|
-
if (source == null)
|
2395
|
-
return {};
|
2396
|
-
var target = _objectWithoutPropertiesLoose15(source, excluded);
|
2397
|
-
var key, i;
|
2398
|
-
if (Object.getOwnPropertySymbols) {
|
2399
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
2400
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
2401
|
-
key = sourceSymbolKeys[i];
|
2402
|
-
if (excluded.indexOf(key) >= 0)
|
2403
|
-
continue;
|
2404
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key))
|
2405
|
-
continue;
|
2406
|
-
target[key] = source[key];
|
2407
|
-
}
|
2408
|
-
}
|
2409
|
-
return target;
|
2410
|
-
}
|
2411
|
-
function _objectWithoutPropertiesLoose15(source, excluded) {
|
2412
|
-
if (source == null)
|
2413
|
-
return {};
|
2414
|
-
var target = {};
|
2415
|
-
var sourceKeys = Object.keys(source);
|
2416
|
-
var key, i;
|
2417
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
2418
|
-
key = sourceKeys[i];
|
2419
|
-
if (excluded.indexOf(key) >= 0)
|
2420
|
-
continue;
|
2421
|
-
target[key] = source[key];
|
2422
|
-
}
|
2423
|
-
return target;
|
2424
|
-
}
|
2425
|
-
var Type = (0, import_react17.forwardRef)(function(_ref, ref) {
|
2426
|
-
var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, _ref$size = _ref.size, size = _ref$size === void 0 ? 24 : _ref$size, rest = _objectWithoutProperties15(_ref, ["color", "size"]);
|
2427
|
-
return /* @__PURE__ */ import_react17.default.createElement("svg", _extends15({
|
2428
|
-
ref,
|
2429
|
-
xmlns: "http://www.w3.org/2000/svg",
|
2430
|
-
width: size,
|
2431
|
-
height: size,
|
2432
|
-
viewBox: "0 0 24 24",
|
2433
|
-
fill: "none",
|
2434
|
-
stroke: color,
|
2435
|
-
strokeWidth: "2",
|
2436
|
-
strokeLinecap: "round",
|
2437
|
-
strokeLinejoin: "round"
|
2438
|
-
}, rest), /* @__PURE__ */ import_react17.default.createElement("polyline", {
|
2439
2357
|
points: "4 7 4 4 20 4 20 7"
|
2440
|
-
}), /* @__PURE__ */
|
2358
|
+
}), /* @__PURE__ */ import_react16.default.createElement("line", {
|
2441
2359
|
x1: "9",
|
2442
2360
|
y1: "20",
|
2443
2361
|
x2: "15",
|
2444
2362
|
y2: "20"
|
2445
|
-
}), /* @__PURE__ */
|
2363
|
+
}), /* @__PURE__ */ import_react16.default.createElement("line", {
|
2446
2364
|
x1: "12",
|
2447
2365
|
y1: "4",
|
2448
2366
|
x2: "12",
|
@@ -2450,18 +2368,18 @@ var Type = (0, import_react17.forwardRef)(function(_ref, ref) {
|
|
2450
2368
|
}));
|
2451
2369
|
});
|
2452
2370
|
Type.propTypes = {
|
2453
|
-
color:
|
2454
|
-
size:
|
2371
|
+
color: import_prop_types14.default.string,
|
2372
|
+
size: import_prop_types14.default.oneOfType([import_prop_types14.default.string, import_prop_types14.default.number])
|
2455
2373
|
};
|
2456
2374
|
Type.displayName = "Type";
|
2457
2375
|
var type_default = Type;
|
2458
2376
|
|
2459
2377
|
// lib/use-modifier-held.ts
|
2460
2378
|
init_react_import();
|
2461
|
-
var
|
2379
|
+
var import_react17 = require("react");
|
2462
2380
|
var useModifierHeld = (modifier) => {
|
2463
|
-
const [modifierHeld, setModifierHeld] = (0,
|
2464
|
-
(0,
|
2381
|
+
const [modifierHeld, setModifierHeld] = (0, import_react17.useState)(false);
|
2382
|
+
(0, import_react17.useEffect)(() => {
|
2465
2383
|
function downHandler({ key }) {
|
2466
2384
|
if (key === modifier) {
|
2467
2385
|
setModifierHeld(true);
|
@@ -2505,7 +2423,7 @@ var DraggableComponent = ({
|
|
2505
2423
|
style
|
2506
2424
|
}) => {
|
2507
2425
|
const isModifierHeld = useModifierHeld("Alt");
|
2508
|
-
(0,
|
2426
|
+
(0, import_react18.useEffect)(onMount, []);
|
2509
2427
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
2510
2428
|
import_react_beautiful_dnd.Draggable,
|
2511
2429
|
{
|
@@ -2549,13 +2467,13 @@ var DraggableComponent = ({
|
|
2549
2467
|
|
2550
2468
|
// components/DroppableStrictMode/index.tsx
|
2551
2469
|
init_react_import();
|
2552
|
-
var
|
2470
|
+
var import_react19 = require("react");
|
2553
2471
|
var import_react_beautiful_dnd2 = require("react-beautiful-dnd");
|
2554
2472
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
2555
2473
|
var DroppableStrictMode = (_a) => {
|
2556
2474
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
2557
|
-
const [enabled, setEnabled] = (0,
|
2558
|
-
(0,
|
2475
|
+
const [enabled, setEnabled] = (0, import_react19.useState)(false);
|
2476
|
+
(0, import_react19.useEffect)(() => {
|
2559
2477
|
const animation = requestAnimationFrame(() => setEnabled(true));
|
2560
2478
|
return () => {
|
2561
2479
|
cancelAnimationFrame(animation);
|
@@ -2634,7 +2552,7 @@ var styles_module_default2 = { "DropZone": "_DropZone_ou0z5_1", "DropZone-conten
|
|
2634
2552
|
|
2635
2553
|
// components/DropZone/context.tsx
|
2636
2554
|
init_react_import();
|
2637
|
-
var
|
2555
|
+
var import_react20 = require("react");
|
2638
2556
|
var import_use_debounce = require("use-debounce");
|
2639
2557
|
|
2640
2558
|
// lib/get-zone-id.ts
|
@@ -2651,29 +2569,29 @@ var getZoneId = (zoneCompound) => {
|
|
2651
2569
|
|
2652
2570
|
// components/DropZone/context.tsx
|
2653
2571
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
2654
|
-
var dropZoneContext = (0,
|
2572
|
+
var dropZoneContext = (0, import_react20.createContext)(null);
|
2655
2573
|
var DropZoneProvider = ({
|
2656
2574
|
children,
|
2657
2575
|
value
|
2658
2576
|
}) => {
|
2659
|
-
const [hoveringArea, setHoveringArea] = (0,
|
2660
|
-
const [hoveringZone, setHoveringZone] = (0,
|
2577
|
+
const [hoveringArea, setHoveringArea] = (0, import_react20.useState)(null);
|
2578
|
+
const [hoveringZone, setHoveringZone] = (0, import_react20.useState)(
|
2661
2579
|
rootDroppableId
|
2662
2580
|
);
|
2663
|
-
const [hoveringComponent, setHoveringComponent] = (0,
|
2581
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react20.useState)();
|
2664
2582
|
const [hoveringAreaDb] = (0, import_use_debounce.useDebounce)(hoveringArea, 75, { leading: false });
|
2665
|
-
const [areasWithZones, setAreasWithZones] = (0,
|
2583
|
+
const [areasWithZones, setAreasWithZones] = (0, import_react20.useState)(
|
2666
2584
|
{}
|
2667
2585
|
);
|
2668
|
-
const [activeZones, setActiveZones] = (0,
|
2586
|
+
const [activeZones, setActiveZones] = (0, import_react20.useState)({});
|
2669
2587
|
const { dispatch = null } = value ? value : {};
|
2670
|
-
const registerZoneArea = (0,
|
2588
|
+
const registerZoneArea = (0, import_react20.useCallback)(
|
2671
2589
|
(area) => {
|
2672
2590
|
setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
|
2673
2591
|
},
|
2674
2592
|
[setAreasWithZones]
|
2675
2593
|
);
|
2676
|
-
const registerZone = (0,
|
2594
|
+
const registerZone = (0, import_react20.useCallback)(
|
2677
2595
|
(zoneCompound) => {
|
2678
2596
|
if (!dispatch) {
|
2679
2597
|
return;
|
@@ -2686,7 +2604,7 @@ var DropZoneProvider = ({
|
|
2686
2604
|
},
|
2687
2605
|
[setActiveZones, dispatch]
|
2688
2606
|
);
|
2689
|
-
const unregisterZone = (0,
|
2607
|
+
const unregisterZone = (0, import_react20.useCallback)(
|
2690
2608
|
(zoneCompound) => {
|
2691
2609
|
if (!dispatch) {
|
2692
2610
|
return;
|
@@ -2701,8 +2619,8 @@ var DropZoneProvider = ({
|
|
2701
2619
|
},
|
2702
2620
|
[setActiveZones, dispatch]
|
2703
2621
|
);
|
2704
|
-
const [pathData, setPathData] = (0,
|
2705
|
-
const registerPath = (0,
|
2622
|
+
const [pathData, setPathData] = (0, import_react20.useState)();
|
2623
|
+
const registerPath = (0, import_react20.useCallback)(
|
2706
2624
|
(selector) => {
|
2707
2625
|
if (!(value == null ? void 0 : value.data)) {
|
2708
2626
|
return;
|
@@ -2755,7 +2673,7 @@ var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2755
2673
|
var getClassName3 = get_class_name_factory_default("DropZone", styles_module_default2);
|
2756
2674
|
function DropZoneEdit({ zone, style }) {
|
2757
2675
|
var _a;
|
2758
|
-
const ctx = (0,
|
2676
|
+
const ctx = (0, import_react21.useContext)(dropZoneContext);
|
2759
2677
|
const {
|
2760
2678
|
// These all need setting via context
|
2761
2679
|
data,
|
@@ -2772,12 +2690,12 @@ function DropZoneEdit({ zone, style }) {
|
|
2772
2690
|
} = ctx || {};
|
2773
2691
|
let content = data.content || [];
|
2774
2692
|
let zoneCompound = rootDroppableId;
|
2775
|
-
(0,
|
2693
|
+
(0, import_react21.useEffect)(() => {
|
2776
2694
|
if (areaId && registerZoneArea) {
|
2777
2695
|
registerZoneArea(areaId);
|
2778
2696
|
}
|
2779
2697
|
}, [areaId]);
|
2780
|
-
(0,
|
2698
|
+
(0, import_react21.useEffect)(() => {
|
2781
2699
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
2782
2700
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
2783
2701
|
}
|
@@ -2989,7 +2907,7 @@ function DropZoneEdit({ zone, style }) {
|
|
2989
2907
|
);
|
2990
2908
|
}
|
2991
2909
|
function DropZoneRender({ zone }) {
|
2992
|
-
const ctx = (0,
|
2910
|
+
const ctx = (0, import_react21.useContext)(dropZoneContext);
|
2993
2911
|
const { data, areaId = "root", config } = ctx || {};
|
2994
2912
|
let zoneCompound = rootDroppableId;
|
2995
2913
|
let content = (data == null ? void 0 : data.content) || [];
|
@@ -3016,7 +2934,7 @@ function DropZoneRender({ zone }) {
|
|
3016
2934
|
}) });
|
3017
2935
|
}
|
3018
2936
|
function DropZone(props) {
|
3019
|
-
const ctx = (0,
|
2937
|
+
const ctx = (0, import_react21.useContext)(dropZoneContext);
|
3020
2938
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
3021
2939
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DropZoneEdit, __spreadValues({}, props));
|
3022
2940
|
}
|
@@ -3028,7 +2946,7 @@ init_react_import();
|
|
3028
2946
|
|
3029
2947
|
// components/IconButton/IconButton.tsx
|
3030
2948
|
init_react_import();
|
3031
|
-
var
|
2949
|
+
var import_react22 = require("react");
|
3032
2950
|
|
3033
2951
|
// css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
|
3034
2952
|
init_react_import();
|
@@ -3050,7 +2968,7 @@ var IconButton = ({
|
|
3050
2968
|
fullWidth,
|
3051
2969
|
title
|
3052
2970
|
}) => {
|
3053
|
-
const [loading, setLoading] = (0,
|
2971
|
+
const [loading, setLoading] = (0, import_react22.useState)(false);
|
3054
2972
|
const ElementType = href ? "a" : "button";
|
3055
2973
|
const el = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
3056
2974
|
ElementType,
|
@@ -3090,370 +3008,38 @@ var IconButton = ({
|
|
3090
3008
|
|
3091
3009
|
// components/Puck/index.tsx
|
3092
3010
|
init_react_import();
|
3093
|
-
var
|
3094
|
-
var import_react_beautiful_dnd5 = require("react-beautiful-dnd");
|
3095
|
-
|
3096
|
-
// components/InputOrGroup/index.tsx
|
3097
|
-
init_react_import();
|
3098
|
-
|
3099
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/styles.module.css#css-module
|
3100
|
-
init_react_import();
|
3101
|
-
var styles_module_default3 = { "Input": "_Input_nkpu6_1", "Input-label": "_Input-label_nkpu6_27", "Input-labelIcon": "_Input-labelIcon_nkpu6_34", "Input-input": "_Input-input_nkpu6_39", "Input--readOnly": "_Input--readOnly_nkpu6_60", "Input-radioGroupItems": "_Input-radioGroupItems_nkpu6_69", "Input-radio": "_Input-radio_nkpu6_69", "Input-radioInner": "_Input-radioInner_nkpu6_86", "Input-radioInput": "_Input-radioInput_nkpu6_98" };
|
3102
|
-
|
3103
|
-
// components/InputOrGroup/fields/index.tsx
|
3104
|
-
init_react_import();
|
3105
|
-
|
3106
|
-
// components/InputOrGroup/fields/ArrayField/index.tsx
|
3107
|
-
init_react_import();
|
3108
|
-
|
3109
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ArrayField/styles.module.css#css-module
|
3110
|
-
init_react_import();
|
3111
|
-
var styles_module_default4 = { "ArrayField": "_ArrayField_zp334_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_zp334_13", "ArrayField-addButton": "_ArrayField-addButton_zp334_17", "ArrayField--hasItems": "_ArrayField--hasItems_zp334_31", "ArrayFieldItem": "_ArrayFieldItem_zp334_45", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_zp334_53", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_zp334_58", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_zp334_72", "ArrayFieldItem-body": "_ArrayFieldItem-body_zp334_104", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_zp334_112", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_zp334_119", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_zp334_125", "ArrayFieldItem-action": "_ArrayFieldItem-action_zp334_125" };
|
3112
|
-
|
3113
|
-
// components/InputOrGroup/fields/ArrayField/index.tsx
|
3011
|
+
var import_react28 = require("react");
|
3114
3012
|
var import_react_beautiful_dnd4 = require("react-beautiful-dnd");
|
3115
3013
|
|
3116
|
-
// components/
|
3117
|
-
init_react_import();
|
3118
|
-
var import_react_beautiful_dnd3 = require("react-beautiful-dnd");
|
3119
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
3120
|
-
var Draggable2 = ({
|
3121
|
-
className,
|
3122
|
-
children,
|
3123
|
-
id,
|
3124
|
-
index,
|
3125
|
-
showShadow,
|
3126
|
-
disableAnimations = false
|
3127
|
-
}) => {
|
3128
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_beautiful_dnd3.Draggable, { draggableId: id, index, children: (provided, snapshot) => {
|
3129
|
-
var _a;
|
3130
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
3131
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
3132
|
-
"div",
|
3133
|
-
__spreadProps(__spreadValues(__spreadValues({
|
3134
|
-
className: className && className(provided, snapshot),
|
3135
|
-
ref: provided.innerRef
|
3136
|
-
}, provided.draggableProps), provided.dragHandleProps), {
|
3137
|
-
style: __spreadProps(__spreadValues({}, provided.draggableProps.style), {
|
3138
|
-
transform: snapshot.isDragging || !disableAnimations ? (_a = provided.draggableProps.style) == null ? void 0 : _a.transform : "translate(0px, 0px)"
|
3139
|
-
}),
|
3140
|
-
children: children(provided, snapshot)
|
3141
|
-
})
|
3142
|
-
),
|
3143
|
-
showShadow && snapshot.isDragging && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
3144
|
-
"div",
|
3145
|
-
{
|
3146
|
-
className: className && className(provided, snapshot),
|
3147
|
-
style: { transform: "none !important" },
|
3148
|
-
children: children(provided, snapshot)
|
3149
|
-
}
|
3150
|
-
)
|
3151
|
-
] });
|
3152
|
-
} });
|
3153
|
-
};
|
3154
|
-
|
3155
|
-
// lib/generate-id.ts
|
3156
|
-
init_react_import();
|
3157
|
-
var import_crypto = require("crypto");
|
3158
|
-
var generateId = (type) => `${type}-${(0, import_crypto.randomBytes)(20).toString("hex")}`;
|
3159
|
-
|
3160
|
-
// components/InputOrGroup/fields/ArrayField/index.tsx
|
3161
|
-
var import_react25 = require("react");
|
3162
|
-
|
3163
|
-
// components/DragIcon/index.tsx
|
3164
|
-
init_react_import();
|
3165
|
-
|
3166
|
-
// css-module:/home/runner/work/puck/puck/packages/core/components/DragIcon/styles.module.css#css-module
|
3167
|
-
init_react_import();
|
3168
|
-
var styles_module_default5 = { "DragIcon": "_DragIcon_o29on_1" };
|
3169
|
-
|
3170
|
-
// components/DragIcon/index.tsx
|
3171
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
3172
|
-
var getClassName5 = get_class_name_factory_default("DragIcon", styles_module_default5);
|
3173
|
-
var DragIcon = () => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName5(), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { viewBox: "0 0 20 20", width: "12", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime8.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" }) }) });
|
3174
|
-
|
3175
|
-
// components/Puck/context.tsx
|
3176
|
-
init_react_import();
|
3177
|
-
var import_react24 = require("react");
|
3178
|
-
var defaultAppData = {
|
3179
|
-
data: { content: [], root: { title: "" } },
|
3180
|
-
state: {
|
3181
|
-
leftSideBarVisible: true,
|
3182
|
-
arrayState: {}
|
3183
|
-
}
|
3184
|
-
};
|
3185
|
-
var appContext = (0, import_react24.createContext)({
|
3186
|
-
appData: defaultAppData,
|
3187
|
-
dispatch: () => null
|
3188
|
-
});
|
3189
|
-
var AppProvider = appContext.Provider;
|
3190
|
-
var useAppContext = () => {
|
3191
|
-
const mainContext = (0, import_react24.useContext)(appContext);
|
3192
|
-
return __spreadProps(__spreadValues({}, mainContext), {
|
3193
|
-
// Helper
|
3194
|
-
setState: (state, recordHistory) => {
|
3195
|
-
return mainContext.dispatch({
|
3196
|
-
type: "setState",
|
3197
|
-
state,
|
3198
|
-
recordHistory
|
3199
|
-
});
|
3200
|
-
}
|
3201
|
-
});
|
3202
|
-
};
|
3203
|
-
|
3204
|
-
// components/InputOrGroup/fields/ArrayField/index.tsx
|
3205
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
3206
|
-
var getClassNameInput = get_class_name_factory_default("Input", styles_module_default3);
|
3207
|
-
var getClassName6 = get_class_name_factory_default("ArrayField", styles_module_default4);
|
3208
|
-
var getClassNameItem = get_class_name_factory_default("ArrayFieldItem", styles_module_default4);
|
3209
|
-
var ArrayField = ({
|
3210
|
-
field,
|
3211
|
-
onChange,
|
3212
|
-
value,
|
3213
|
-
name,
|
3214
|
-
label
|
3215
|
-
}) => {
|
3216
|
-
const [arrayFieldId] = (0, import_react25.useState)(generateId("ArrayField"));
|
3217
|
-
const { appData, setState } = useAppContext();
|
3218
|
-
const arrayState = appData.state.arrayState[arrayFieldId] || {
|
3219
|
-
items: Array.from(value).map((v) => ({
|
3220
|
-
_arrayId: generateId("ArrayItem"),
|
3221
|
-
data: v
|
3222
|
-
})),
|
3223
|
-
openId: ""
|
3224
|
-
};
|
3225
|
-
const setArrayState = (0, import_react25.useCallback)(
|
3226
|
-
(newArrayState, recordHistory = false) => {
|
3227
|
-
setState(
|
3228
|
-
{
|
3229
|
-
arrayState: __spreadProps(__spreadValues({}, appData.state.arrayState), {
|
3230
|
-
[arrayFieldId]: __spreadValues(__spreadValues({}, arrayState), newArrayState)
|
3231
|
-
})
|
3232
|
-
},
|
3233
|
-
recordHistory
|
3234
|
-
);
|
3235
|
-
},
|
3236
|
-
[arrayState]
|
3237
|
-
);
|
3238
|
-
(0, import_react25.useEffect)(() => {
|
3239
|
-
const newItems = Array.from(value).map((item, idx) => {
|
3240
|
-
var _a;
|
3241
|
-
return {
|
3242
|
-
_arrayId: ((_a = arrayState.items[idx]) == null ? void 0 : _a._arrayId) || generateId("ArrayItem"),
|
3243
|
-
data: item
|
3244
|
-
};
|
3245
|
-
});
|
3246
|
-
setArrayState({ items: newItems });
|
3247
|
-
}, [value]);
|
3248
|
-
if (!field.arrayFields) {
|
3249
|
-
return null;
|
3250
|
-
}
|
3251
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: getClassNameInput(), children: [
|
3252
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("b", { className: getClassNameInput("label"), children: [
|
3253
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameInput("labelIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(list_default, { size: 16 }) }),
|
3254
|
-
label || name
|
3255
|
-
] }),
|
3256
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
3257
|
-
import_react_beautiful_dnd4.DragDropContext,
|
3258
|
-
{
|
3259
|
-
onDragEnd: (event) => {
|
3260
|
-
var _a;
|
3261
|
-
if (event.destination) {
|
3262
|
-
const newValue = reorder(
|
3263
|
-
arrayState.items,
|
3264
|
-
event.source.index,
|
3265
|
-
(_a = event.destination) == null ? void 0 : _a.index
|
3266
|
-
);
|
3267
|
-
setArrayState(__spreadProps(__spreadValues({}, arrayState), { items: newValue }), false);
|
3268
|
-
onChange(newValue.map(({ data }) => data));
|
3269
|
-
}
|
3270
|
-
},
|
3271
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DroppableStrictMode_default, { droppableId: "array", children: (provided, snapshot) => {
|
3272
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
3273
|
-
"div",
|
3274
|
-
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
3275
|
-
ref: provided.innerRef,
|
3276
|
-
className: getClassName6({
|
3277
|
-
isDraggingFrom: !!snapshot.draggingFromThisWith,
|
3278
|
-
hasItems: value.length > 0
|
3279
|
-
}),
|
3280
|
-
children: [
|
3281
|
-
Array.isArray(value) && value.length > 0 ? arrayState.items.map(({ _arrayId, data }, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
3282
|
-
Draggable2,
|
3283
|
-
{
|
3284
|
-
id: _arrayId,
|
3285
|
-
index: i,
|
3286
|
-
className: (_, snapshot2) => getClassNameItem({
|
3287
|
-
isExpanded: arrayState.openId === _arrayId,
|
3288
|
-
isDragging: snapshot2.isDragging
|
3289
|
-
}),
|
3290
|
-
children: () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
3291
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
3292
|
-
"div",
|
3293
|
-
{
|
3294
|
-
onClick: () => {
|
3295
|
-
if (arrayState.openId === _arrayId) {
|
3296
|
-
setArrayState({
|
3297
|
-
openId: ""
|
3298
|
-
});
|
3299
|
-
} else {
|
3300
|
-
setArrayState({
|
3301
|
-
openId: _arrayId
|
3302
|
-
});
|
3303
|
-
}
|
3304
|
-
},
|
3305
|
-
className: getClassNameItem("summary"),
|
3306
|
-
children: [
|
3307
|
-
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${i}`,
|
3308
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: getClassNameItem("rhs"), children: [
|
3309
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
3310
|
-
IconButton,
|
3311
|
-
{
|
3312
|
-
onClick: () => {
|
3313
|
-
const existingValue = [
|
3314
|
-
...value || []
|
3315
|
-
];
|
3316
|
-
const existingItems = [
|
3317
|
-
...arrayState.items || []
|
3318
|
-
];
|
3319
|
-
existingValue.splice(i, 1);
|
3320
|
-
existingItems.splice(i, 1);
|
3321
|
-
setArrayState(
|
3322
|
-
{ items: existingItems },
|
3323
|
-
true
|
3324
|
-
);
|
3325
|
-
onChange(existingValue);
|
3326
|
-
},
|
3327
|
-
title: "Delete",
|
3328
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(trash_default, { size: 16 })
|
3329
|
-
}
|
3330
|
-
) }) }),
|
3331
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DragIcon, {}) })
|
3332
|
-
] })
|
3333
|
-
]
|
3334
|
-
}
|
3335
|
-
),
|
3336
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
3337
|
-
"fieldset",
|
3338
|
-
{
|
3339
|
-
className: getClassNameItem("fieldset"),
|
3340
|
-
children: Object.keys(field.arrayFields).map(
|
3341
|
-
(fieldName) => {
|
3342
|
-
const subField = field.arrayFields[fieldName];
|
3343
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
3344
|
-
InputOrGroup,
|
3345
|
-
{
|
3346
|
-
name: `${name}_${i}_${fieldName}`,
|
3347
|
-
label: subField.label || fieldName,
|
3348
|
-
field: subField,
|
3349
|
-
value: data[fieldName],
|
3350
|
-
onChange: (val) => onChange(
|
3351
|
-
replace(value, i, __spreadProps(__spreadValues({}, data), {
|
3352
|
-
[fieldName]: val
|
3353
|
-
}))
|
3354
|
-
)
|
3355
|
-
},
|
3356
|
-
`${name}_${i}_${fieldName}`
|
3357
|
-
);
|
3358
|
-
}
|
3359
|
-
)
|
3360
|
-
}
|
3361
|
-
) })
|
3362
|
-
] })
|
3363
|
-
},
|
3364
|
-
_arrayId
|
3365
|
-
)) : null,
|
3366
|
-
provided.placeholder,
|
3367
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
3368
|
-
"button",
|
3369
|
-
{
|
3370
|
-
className: getClassName6("addButton"),
|
3371
|
-
onClick: () => {
|
3372
|
-
const existingValue = value || [];
|
3373
|
-
onChange([...existingValue, field.defaultItemProps || {}]);
|
3374
|
-
},
|
3375
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(plus_default, { size: "21" })
|
3376
|
-
}
|
3377
|
-
)
|
3378
|
-
]
|
3379
|
-
})
|
3380
|
-
);
|
3381
|
-
} })
|
3382
|
-
}
|
3383
|
-
)
|
3384
|
-
] });
|
3385
|
-
};
|
3386
|
-
|
3387
|
-
// components/InputOrGroup/fields/DefaultField/index.tsx
|
3388
|
-
init_react_import();
|
3389
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
3390
|
-
var getClassName7 = get_class_name_factory_default("Input", styles_module_default3);
|
3391
|
-
var DefaultField = ({
|
3392
|
-
field,
|
3393
|
-
onChange,
|
3394
|
-
readOnly,
|
3395
|
-
value,
|
3396
|
-
name,
|
3397
|
-
label
|
3398
|
-
}) => {
|
3399
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: getClassName7({ readOnly }), children: [
|
3400
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: getClassName7("label"), children: [
|
3401
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: getClassName7("labelIcon"), children: [
|
3402
|
-
field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(type_default, { size: 16 }),
|
3403
|
-
field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(hash_default, { size: 16 })
|
3404
|
-
] }),
|
3405
|
-
label || name
|
3406
|
-
] }),
|
3407
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
3408
|
-
"input",
|
3409
|
-
{
|
3410
|
-
className: getClassName7("input"),
|
3411
|
-
autoComplete: "off",
|
3412
|
-
type: field.type,
|
3413
|
-
name,
|
3414
|
-
value: typeof value === "undefined" ? "" : value,
|
3415
|
-
onChange: (e) => {
|
3416
|
-
if (field.type === "number") {
|
3417
|
-
onChange(Number(e.currentTarget.value));
|
3418
|
-
} else {
|
3419
|
-
onChange(e.currentTarget.value);
|
3420
|
-
}
|
3421
|
-
},
|
3422
|
-
readOnly
|
3423
|
-
}
|
3424
|
-
)
|
3425
|
-
] });
|
3426
|
-
};
|
3427
|
-
|
3428
|
-
// components/InputOrGroup/fields/ExternalField/index.tsx
|
3014
|
+
// components/InputOrGroup/index.tsx
|
3429
3015
|
init_react_import();
|
3430
3016
|
|
3431
3017
|
// components/ExternalInput/index.tsx
|
3432
3018
|
init_react_import();
|
3433
|
-
var
|
3019
|
+
var import_react23 = require("react");
|
3434
3020
|
|
3435
3021
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
3436
3022
|
init_react_import();
|
3437
|
-
var
|
3023
|
+
var styles_module_default3 = { "ExternalInput": "_ExternalInput_l4bks_1", "ExternalInput-actions": "_ExternalInput-actions_l4bks_5", "ExternalInput-button": "_ExternalInput-button_l4bks_9", "ExternalInput-detachButton": "_ExternalInput-detachButton_l4bks_28", "ExternalInput--hasData": "_ExternalInput--hasData_l4bks_35", "ExternalInput-modal": "_ExternalInput-modal_l4bks_55", "ExternalInput--modalVisible": "_ExternalInput--modalVisible_l4bks_69", "ExternalInput-modalInner": "_ExternalInput-modalInner_l4bks_73", "ExternalInput-modalHeading": "_ExternalInput-modalHeading_l4bks_84", "ExternalInput-modalTableWrapper": "_ExternalInput-modalTableWrapper_l4bks_89" };
|
3438
3024
|
|
3439
3025
|
// components/ExternalInput/index.tsx
|
3440
|
-
var
|
3441
|
-
var
|
3026
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
3027
|
+
var getClassName5 = get_class_name_factory_default("ExternalInput", styles_module_default3);
|
3442
3028
|
var ExternalInput = ({
|
3443
3029
|
field,
|
3444
3030
|
onChange,
|
3445
3031
|
value = null
|
3446
3032
|
}) => {
|
3447
|
-
const [data, setData] = (0,
|
3448
|
-
const [isOpen, setOpen] = (0,
|
3449
|
-
const [selectedData, setSelectedData] = (0,
|
3450
|
-
const keys = (0,
|
3033
|
+
const [data, setData] = (0, import_react23.useState)([]);
|
3034
|
+
const [isOpen, setOpen] = (0, import_react23.useState)(false);
|
3035
|
+
const [selectedData, setSelectedData] = (0, import_react23.useState)(value);
|
3036
|
+
const keys = (0, import_react23.useMemo)(
|
3451
3037
|
() => Object.keys(data).filter(
|
3452
3038
|
(key) => typeof data[key] === "string" || typeof data[key] === "number"
|
3453
3039
|
),
|
3454
3040
|
[data]
|
3455
3041
|
);
|
3456
|
-
(0,
|
3042
|
+
(0, import_react23.useEffect)(() => {
|
3457
3043
|
(() => __async(void 0, null, function* () {
|
3458
3044
|
if (field.adaptor) {
|
3459
3045
|
const listData = yield field.adaptor.fetchList(field.adaptorParams);
|
@@ -3464,35 +3050,35 @@ var ExternalInput = ({
|
|
3464
3050
|
}))();
|
3465
3051
|
}, [field.adaptor, field.adaptorParams]);
|
3466
3052
|
if (!field.adaptor) {
|
3467
|
-
return /* @__PURE__ */ (0,
|
3053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: "Incorrectly configured" });
|
3468
3054
|
}
|
3469
|
-
return /* @__PURE__ */ (0,
|
3055
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
3470
3056
|
"div",
|
3471
3057
|
{
|
3472
|
-
className:
|
3058
|
+
className: getClassName5({
|
3473
3059
|
hasData: !!selectedData,
|
3474
3060
|
modalVisible: isOpen
|
3475
3061
|
}),
|
3476
3062
|
children: [
|
3477
|
-
/* @__PURE__ */ (0,
|
3478
|
-
/* @__PURE__ */ (0,
|
3063
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: getClassName5("actions"), children: [
|
3064
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
3479
3065
|
"button",
|
3480
3066
|
{
|
3481
3067
|
onClick: () => setOpen(true),
|
3482
|
-
className:
|
3483
|
-
children: selectedData ? field.getItemSummary ? field.getItemSummary(selectedData) : `${field.adaptor.name} item` : /* @__PURE__ */ (0,
|
3484
|
-
/* @__PURE__ */ (0,
|
3485
|
-
/* @__PURE__ */ (0,
|
3068
|
+
className: getClassName5("button"),
|
3069
|
+
children: selectedData ? field.getItemSummary ? field.getItemSummary(selectedData) : `${field.adaptor.name} item` : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
3070
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(link_default, { size: "16" }),
|
3071
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
|
3486
3072
|
"Select from ",
|
3487
3073
|
field.adaptor.name
|
3488
3074
|
] })
|
3489
3075
|
] })
|
3490
3076
|
}
|
3491
3077
|
),
|
3492
|
-
selectedData && /* @__PURE__ */ (0,
|
3078
|
+
selectedData && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
3493
3079
|
"button",
|
3494
3080
|
{
|
3495
|
-
className:
|
3081
|
+
className: getClassName5("detachButton"),
|
3496
3082
|
onClick: () => {
|
3497
3083
|
setSelectedData(null);
|
3498
3084
|
onChange(null);
|
@@ -3501,17 +3087,17 @@ var ExternalInput = ({
|
|
3501
3087
|
}
|
3502
3088
|
)
|
3503
3089
|
] }),
|
3504
|
-
/* @__PURE__ */ (0,
|
3090
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName5("modal"), onClick: () => setOpen(false), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
3505
3091
|
"div",
|
3506
3092
|
{
|
3507
|
-
className:
|
3093
|
+
className: getClassName5("modalInner"),
|
3508
3094
|
onClick: (e) => e.stopPropagation(),
|
3509
3095
|
children: [
|
3510
|
-
/* @__PURE__ */ (0,
|
3511
|
-
data.length ? /* @__PURE__ */ (0,
|
3512
|
-
/* @__PURE__ */ (0,
|
3513
|
-
/* @__PURE__ */ (0,
|
3514
|
-
return /* @__PURE__ */ (0,
|
3096
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { className: getClassName5("modalHeading"), children: "Select content" }),
|
3097
|
+
data.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName5("modalTableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("table", { children: [
|
3098
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("tr", { children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("th", { style: { textAlign: "left" }, children: key }, key)) }) }),
|
3099
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("tbody", { children: data.map((item, i) => {
|
3100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
3515
3101
|
"tr",
|
3516
3102
|
{
|
3517
3103
|
style: { whiteSpace: "nowrap" },
|
@@ -3520,12 +3106,12 @@ var ExternalInput = ({
|
|
3520
3106
|
setOpen(false);
|
3521
3107
|
setSelectedData(item);
|
3522
3108
|
},
|
3523
|
-
children: keys.map((key) => /* @__PURE__ */ (0,
|
3109
|
+
children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("td", { children: item[key] }, key))
|
3524
3110
|
},
|
3525
3111
|
i
|
3526
3112
|
);
|
3527
3113
|
}) })
|
3528
|
-
] }) }) : /* @__PURE__ */ (0,
|
3114
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { style: { padding: 24 }, children: "No content" })
|
3529
3115
|
]
|
3530
3116
|
}
|
3531
3117
|
) })
|
@@ -3534,189 +3120,204 @@ var ExternalInput = ({
|
|
3534
3120
|
);
|
3535
3121
|
};
|
3536
3122
|
|
3537
|
-
// components/InputOrGroup/
|
3538
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
3539
|
-
var getClassName9 = get_class_name_factory_default("Input", styles_module_default3);
|
3540
|
-
var ExternalField = ({
|
3541
|
-
field,
|
3542
|
-
onChange,
|
3543
|
-
readOnly,
|
3544
|
-
value,
|
3545
|
-
name,
|
3546
|
-
label
|
3547
|
-
}) => {
|
3548
|
-
if (!field.adaptor) {
|
3549
|
-
return null;
|
3550
|
-
}
|
3551
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName9(""), children: [
|
3552
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName9("label"), children: name === "_data" ? "External content" : label || name }),
|
3553
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ExternalInput, { field, onChange, value })
|
3554
|
-
] });
|
3555
|
-
};
|
3556
|
-
|
3557
|
-
// components/InputOrGroup/fields/RadioField/index.tsx
|
3558
|
-
init_react_import();
|
3559
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
3560
|
-
var getClassName10 = get_class_name_factory_default("Input", styles_module_default3);
|
3561
|
-
var RadioField = ({
|
3562
|
-
field,
|
3563
|
-
onChange,
|
3564
|
-
readOnly,
|
3565
|
-
value,
|
3566
|
-
name
|
3567
|
-
}) => {
|
3568
|
-
if (!field.options) {
|
3569
|
-
return null;
|
3570
|
-
}
|
3571
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassName10(), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName10("radioGroup"), children: [
|
3572
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: getClassName10("label"), children: [
|
3573
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassName10("labelIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(check_circle_default, { size: 16 }) }),
|
3574
|
-
field.label || name
|
3575
|
-
] }),
|
3576
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassName10("radioGroupItems"), children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
3577
|
-
"label",
|
3578
|
-
{
|
3579
|
-
className: getClassName10("radio"),
|
3580
|
-
children: [
|
3581
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
3582
|
-
"input",
|
3583
|
-
{
|
3584
|
-
type: "radio",
|
3585
|
-
className: getClassName10("radioInput"),
|
3586
|
-
value: option.value,
|
3587
|
-
name,
|
3588
|
-
onChange: (e) => {
|
3589
|
-
if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
|
3590
|
-
onChange(JSON.parse(e.currentTarget.value));
|
3591
|
-
return;
|
3592
|
-
}
|
3593
|
-
onChange(e.currentTarget.value);
|
3594
|
-
},
|
3595
|
-
readOnly,
|
3596
|
-
defaultChecked: value === option.value
|
3597
|
-
}
|
3598
|
-
),
|
3599
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassName10("radioInner"), children: option.label || option.value })
|
3600
|
-
]
|
3601
|
-
},
|
3602
|
-
option.label + option.value
|
3603
|
-
)) })
|
3604
|
-
] }) });
|
3605
|
-
};
|
3606
|
-
|
3607
|
-
// components/InputOrGroup/fields/SelectField/index.tsx
|
3608
|
-
init_react_import();
|
3609
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
3610
|
-
var getClassName11 = get_class_name_factory_default("Input", styles_module_default3);
|
3611
|
-
var SelectField = ({
|
3612
|
-
field,
|
3613
|
-
onChange,
|
3614
|
-
label,
|
3615
|
-
value,
|
3616
|
-
name
|
3617
|
-
}) => {
|
3618
|
-
if (!field.options) {
|
3619
|
-
return null;
|
3620
|
-
}
|
3621
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: getClassName11(), children: [
|
3622
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassName11("label"), children: [
|
3623
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName11("labelIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(chevron_down_default, { size: 16 }) }),
|
3624
|
-
label || name
|
3625
|
-
] }),
|
3626
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
3627
|
-
"select",
|
3628
|
-
{
|
3629
|
-
className: getClassName11("input"),
|
3630
|
-
onChange: (e) => {
|
3631
|
-
if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
|
3632
|
-
onChange(Boolean(e.currentTarget.value));
|
3633
|
-
return;
|
3634
|
-
}
|
3635
|
-
onChange(e.currentTarget.value);
|
3636
|
-
},
|
3637
|
-
value,
|
3638
|
-
children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
3639
|
-
"option",
|
3640
|
-
{
|
3641
|
-
label: option.label,
|
3642
|
-
value: option.value
|
3643
|
-
},
|
3644
|
-
option.label + option.value
|
3645
|
-
))
|
3646
|
-
}
|
3647
|
-
)
|
3648
|
-
] });
|
3649
|
-
};
|
3650
|
-
|
3651
|
-
// components/InputOrGroup/fields/TextareaField/index.tsx
|
3123
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/styles.module.css#css-module
|
3652
3124
|
init_react_import();
|
3653
|
-
var
|
3654
|
-
var getClassName12 = get_class_name_factory_default("Input", styles_module_default3);
|
3655
|
-
var TextareaField = ({
|
3656
|
-
onChange,
|
3657
|
-
readOnly,
|
3658
|
-
value,
|
3659
|
-
name,
|
3660
|
-
label
|
3661
|
-
}) => {
|
3662
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: getClassName12({ readOnly }), children: [
|
3663
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassName12("label"), children: [
|
3664
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassName12("labelIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(type_default, { size: 16 }) }),
|
3665
|
-
label || name
|
3666
|
-
] }),
|
3667
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
3668
|
-
"textarea",
|
3669
|
-
{
|
3670
|
-
className: getClassName12("input"),
|
3671
|
-
autoComplete: "off",
|
3672
|
-
name,
|
3673
|
-
value: typeof value === "undefined" ? "" : value,
|
3674
|
-
onChange: (e) => onChange(e.currentTarget.value),
|
3675
|
-
readOnly,
|
3676
|
-
rows: 5
|
3677
|
-
}
|
3678
|
-
)
|
3679
|
-
] });
|
3680
|
-
};
|
3125
|
+
var styles_module_default4 = { "Input": "_Input_izwhv_1", "Input-label": "_Input-label_izwhv_27", "Input-labelIcon": "_Input-labelIcon_izwhv_34", "Input-input": "_Input-input_izwhv_39", "Input--readOnly": "_Input--readOnly_izwhv_60", "Input-arrayItem": "_Input-arrayItem_izwhv_69", "Input-fieldset": "_Input-fieldset_izwhv_95", "Input-arrayItemAction": "_Input-arrayItemAction_izwhv_116", "Input-addButton": "_Input-addButton_izwhv_135", "Input-array": "_Input-array_izwhv_69", "Input-radioGroupItems": "_Input-radioGroupItems_izwhv_156", "Input-radio": "_Input-radio_izwhv_156", "Input-radioInner": "_Input-radioInner_izwhv_173", "Input-radioInput": "_Input-radioInput_izwhv_185" };
|
3681
3126
|
|
3682
3127
|
// components/InputOrGroup/index.tsx
|
3683
|
-
var
|
3684
|
-
var
|
3128
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
3129
|
+
var getClassName6 = get_class_name_factory_default("Input", styles_module_default4);
|
3685
3130
|
var FieldLabel = ({
|
3686
3131
|
children,
|
3687
3132
|
icon,
|
3688
3133
|
label
|
3689
3134
|
}) => {
|
3690
|
-
return /* @__PURE__ */ (0,
|
3691
|
-
/* @__PURE__ */ (0,
|
3692
|
-
icon ? /* @__PURE__ */ (0,
|
3135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { children: [
|
3136
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName6("label"), children: [
|
3137
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, {}),
|
3693
3138
|
label
|
3694
3139
|
] }),
|
3695
3140
|
children
|
3696
3141
|
] });
|
3697
3142
|
};
|
3698
|
-
var InputOrGroup = (
|
3699
|
-
|
3143
|
+
var InputOrGroup = ({
|
3144
|
+
name,
|
3145
|
+
field,
|
3146
|
+
value,
|
3147
|
+
label,
|
3148
|
+
onChange,
|
3149
|
+
readOnly
|
3150
|
+
}) => {
|
3700
3151
|
if (field.type === "array") {
|
3701
|
-
|
3152
|
+
if (!field.arrayFields) {
|
3153
|
+
return null;
|
3154
|
+
}
|
3155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName6(), children: [
|
3156
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("b", { className: getClassName6("label"), children: [
|
3157
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6("labelIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(list_default, { size: 16 }) }),
|
3158
|
+
label || name
|
3159
|
+
] }),
|
3160
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName6("array"), children: [
|
3161
|
+
Array.isArray(value) ? value.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
3162
|
+
"details",
|
3163
|
+
{
|
3164
|
+
className: getClassName6("arrayItem"),
|
3165
|
+
children: [
|
3166
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("summary", { children: [
|
3167
|
+
field.getItemSummary ? field.getItemSummary(item, i) : `Item #${i}`,
|
3168
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6("arrayItemAction"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
3169
|
+
IconButton,
|
3170
|
+
{
|
3171
|
+
onClick: () => {
|
3172
|
+
const existingValue = value || [];
|
3173
|
+
existingValue.splice(i, 1);
|
3174
|
+
onChange(existingValue);
|
3175
|
+
},
|
3176
|
+
title: "Delete",
|
3177
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(trash_default, { size: 21 })
|
3178
|
+
}
|
3179
|
+
) })
|
3180
|
+
] }),
|
3181
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("fieldset", { className: getClassName6("fieldset"), children: Object.keys(field.arrayFields).map((fieldName) => {
|
3182
|
+
const subField = field.arrayFields[fieldName];
|
3183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
3184
|
+
InputOrGroup,
|
3185
|
+
{
|
3186
|
+
name: `${name}_${i}_${fieldName}`,
|
3187
|
+
label: subField.label || fieldName,
|
3188
|
+
field: subField,
|
3189
|
+
value: item[fieldName],
|
3190
|
+
onChange: (val) => onChange(
|
3191
|
+
replace(value, i, __spreadProps(__spreadValues({}, item), { [fieldName]: val }))
|
3192
|
+
)
|
3193
|
+
},
|
3194
|
+
`${name}_${i}_${fieldName}`
|
3195
|
+
);
|
3196
|
+
}) })
|
3197
|
+
]
|
3198
|
+
},
|
3199
|
+
`${name}_${i}`
|
3200
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", {}),
|
3201
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
3202
|
+
"button",
|
3203
|
+
{
|
3204
|
+
className: getClassName6("addButton"),
|
3205
|
+
onClick: () => {
|
3206
|
+
const existingValue = value || [];
|
3207
|
+
onChange([...existingValue, field.defaultItemProps || {}]);
|
3208
|
+
},
|
3209
|
+
children: "+ Add item"
|
3210
|
+
}
|
3211
|
+
)
|
3212
|
+
] })
|
3213
|
+
] });
|
3702
3214
|
}
|
3703
3215
|
if (field.type === "external") {
|
3704
|
-
|
3216
|
+
if (!field.adaptor) {
|
3217
|
+
return null;
|
3218
|
+
}
|
3219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName6(""), children: [
|
3220
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6("label"), children: name === "_data" ? "External content" : label || name }),
|
3221
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ExternalInput, { field, onChange, value })
|
3222
|
+
] });
|
3705
3223
|
}
|
3706
3224
|
if (field.type === "select") {
|
3707
|
-
|
3225
|
+
if (!field.options) {
|
3226
|
+
return null;
|
3227
|
+
}
|
3228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: getClassName6(), children: [
|
3229
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName6("label"), children: [
|
3230
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6("labelIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(chevron_down_default, { size: 16 }) }),
|
3231
|
+
label || name
|
3232
|
+
] }),
|
3233
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
3234
|
+
"select",
|
3235
|
+
{
|
3236
|
+
className: getClassName6("input"),
|
3237
|
+
onChange: (e) => {
|
3238
|
+
if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
|
3239
|
+
onChange(Boolean(e.currentTarget.value));
|
3240
|
+
return;
|
3241
|
+
}
|
3242
|
+
onChange(e.currentTarget.value);
|
3243
|
+
},
|
3244
|
+
value,
|
3245
|
+
children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
3246
|
+
"option",
|
3247
|
+
{
|
3248
|
+
label: option.label,
|
3249
|
+
value: option.value
|
3250
|
+
},
|
3251
|
+
option.label + option.value
|
3252
|
+
))
|
3253
|
+
}
|
3254
|
+
)
|
3255
|
+
] });
|
3708
3256
|
}
|
3709
3257
|
if (field.type === "textarea") {
|
3710
|
-
return /* @__PURE__ */ (0,
|
3258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: getClassName6({ readOnly }), children: [
|
3259
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName6("label"), children: [
|
3260
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6("labelIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(type_default, { size: 16 }) }),
|
3261
|
+
label || name
|
3262
|
+
] }),
|
3263
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
3264
|
+
"textarea",
|
3265
|
+
{
|
3266
|
+
className: getClassName6("input"),
|
3267
|
+
autoComplete: "off",
|
3268
|
+
name,
|
3269
|
+
value: typeof value === "undefined" ? "" : value,
|
3270
|
+
onChange: (e) => onChange(e.currentTarget.value),
|
3271
|
+
readOnly,
|
3272
|
+
rows: 5
|
3273
|
+
}
|
3274
|
+
)
|
3275
|
+
] });
|
3711
3276
|
}
|
3712
3277
|
if (field.type === "radio") {
|
3713
|
-
|
3278
|
+
if (!field.options) {
|
3279
|
+
return null;
|
3280
|
+
}
|
3281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6(), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName6("radioGroup"), children: [
|
3282
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName6("label"), children: [
|
3283
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6("labelIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(check_circle_default, { size: 16 }) }),
|
3284
|
+
field.label || name
|
3285
|
+
] }),
|
3286
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6("radioGroupItems"), children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
3287
|
+
"label",
|
3288
|
+
{
|
3289
|
+
className: getClassName6("radio"),
|
3290
|
+
children: [
|
3291
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
3292
|
+
"input",
|
3293
|
+
{
|
3294
|
+
type: "radio",
|
3295
|
+
className: getClassName6("radioInput"),
|
3296
|
+
value: option.value,
|
3297
|
+
name,
|
3298
|
+
onChange: (e) => {
|
3299
|
+
if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
|
3300
|
+
onChange(JSON.parse(e.currentTarget.value));
|
3301
|
+
return;
|
3302
|
+
}
|
3303
|
+
onChange(e.currentTarget.value);
|
3304
|
+
},
|
3305
|
+
readOnly,
|
3306
|
+
defaultChecked: value === option.value
|
3307
|
+
}
|
3308
|
+
),
|
3309
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6("radioInner"), children: option.label || option.value })
|
3310
|
+
]
|
3311
|
+
},
|
3312
|
+
option.label + option.value
|
3313
|
+
)) })
|
3314
|
+
] }) });
|
3714
3315
|
}
|
3715
3316
|
if (field.type === "custom") {
|
3716
3317
|
if (!field.render) {
|
3717
3318
|
return null;
|
3718
3319
|
}
|
3719
|
-
return /* @__PURE__ */ (0,
|
3320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassName6(), children: field.render({
|
3720
3321
|
field,
|
3721
3322
|
name,
|
3722
3323
|
value,
|
@@ -3724,46 +3325,96 @@ var InputOrGroup = (props) => {
|
|
3724
3325
|
readOnly
|
3725
3326
|
}) });
|
3726
3327
|
}
|
3727
|
-
return /* @__PURE__ */ (0,
|
3328
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: getClassName6({ readOnly }), children: [
|
3329
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName6("label"), children: [
|
3330
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassName6("labelIcon"), children: [
|
3331
|
+
field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(type_default, { size: 16 }),
|
3332
|
+
field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(hash_default, { size: 16 })
|
3333
|
+
] }),
|
3334
|
+
label || name
|
3335
|
+
] }),
|
3336
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
3337
|
+
"input",
|
3338
|
+
{
|
3339
|
+
className: getClassName6("input"),
|
3340
|
+
autoComplete: "off",
|
3341
|
+
type: field.type,
|
3342
|
+
name,
|
3343
|
+
value: typeof value === "undefined" ? "" : value,
|
3344
|
+
onChange: (e) => {
|
3345
|
+
if (field.type === "number") {
|
3346
|
+
onChange(Number(e.currentTarget.value));
|
3347
|
+
} else {
|
3348
|
+
onChange(e.currentTarget.value);
|
3349
|
+
}
|
3350
|
+
},
|
3351
|
+
readOnly
|
3352
|
+
}
|
3353
|
+
)
|
3354
|
+
] });
|
3728
3355
|
};
|
3729
3356
|
|
3730
3357
|
// components/ComponentList/index.tsx
|
3731
3358
|
init_react_import();
|
3359
|
+
var import_react_beautiful_dnd3 = require("react-beautiful-dnd");
|
3732
3360
|
|
3733
3361
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
|
3734
3362
|
init_react_import();
|
3735
|
-
var
|
3363
|
+
var styles_module_default5 = { "ComponentList": "_ComponentList_1ybn0_1", "ComponentList-item": "_ComponentList-item_1ybn0_9", "ComponentList-itemShadow": "_ComponentList-itemShadow_1ybn0_10", "ComponentList-itemIcon": "_ComponentList-itemIcon_1ybn0_28" };
|
3736
3364
|
|
3737
3365
|
// components/ComponentList/index.tsx
|
3738
|
-
var
|
3739
|
-
var
|
3366
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
3367
|
+
var getClassName7 = get_class_name_factory_default("ComponentList", styles_module_default5);
|
3740
3368
|
var ComponentList = ({ config }) => {
|
3741
|
-
return /* @__PURE__ */ (0,
|
3369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DroppableStrictMode_default, { droppableId: "component-list", isDropDisabled: true, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
3742
3370
|
"div",
|
3743
3371
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
3744
3372
|
ref: provided.innerRef,
|
3745
|
-
className:
|
3746
|
-
isDraggingFrom: !!snapshot.draggingFromThisWith
|
3747
|
-
}),
|
3373
|
+
className: getClassName7(),
|
3748
3374
|
children: [
|
3749
3375
|
Object.keys(config.components).map((componentKey, i) => {
|
3750
|
-
|
3751
|
-
|
3376
|
+
const componentConfig = config[componentKey];
|
3377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
3378
|
+
import_react_beautiful_dnd3.Draggable,
|
3752
3379
|
{
|
3753
|
-
|
3380
|
+
draggableId: componentKey,
|
3754
3381
|
index: i,
|
3755
|
-
|
3756
|
-
|
3757
|
-
|
3758
|
-
|
3759
|
-
|
3760
|
-
|
3761
|
-
|
3382
|
+
children: (provided2, snapshot2) => {
|
3383
|
+
var _a;
|
3384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
3385
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
3386
|
+
"div",
|
3387
|
+
__spreadProps(__spreadValues(__spreadValues({
|
3388
|
+
ref: provided2.innerRef
|
3389
|
+
}, provided2.draggableProps), provided2.dragHandleProps), {
|
3390
|
+
className: getClassName7("item"),
|
3391
|
+
style: __spreadProps(__spreadValues({}, provided2.draggableProps.style), {
|
3392
|
+
transform: snapshot2.isDragging ? (_a = provided2.draggableProps.style) == null ? void 0 : _a.transform : "translate(0px, 0px)"
|
3393
|
+
}),
|
3394
|
+
children: [
|
3395
|
+
componentKey,
|
3396
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassName7("itemIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(grid_default, { size: 18 }) })
|
3397
|
+
]
|
3398
|
+
})
|
3399
|
+
),
|
3400
|
+
snapshot2.isDragging && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
3401
|
+
"div",
|
3402
|
+
{
|
3403
|
+
className: getClassName7("itemShadow"),
|
3404
|
+
style: { transform: "none !important" },
|
3405
|
+
children: [
|
3406
|
+
componentKey,
|
3407
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassName7("itemIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(grid_default, { size: 18 }) })
|
3408
|
+
]
|
3409
|
+
}
|
3410
|
+
)
|
3411
|
+
] });
|
3412
|
+
}
|
3762
3413
|
},
|
3763
3414
|
componentKey
|
3764
3415
|
);
|
3765
3416
|
}),
|
3766
|
-
/* @__PURE__ */ (0,
|
3417
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { display: "none" }, children: provided.placeholder })
|
3767
3418
|
]
|
3768
3419
|
})
|
3769
3420
|
) });
|
@@ -3771,10 +3422,10 @@ var ComponentList = ({ config }) => {
|
|
3771
3422
|
|
3772
3423
|
// lib/use-placeholder-style.ts
|
3773
3424
|
init_react_import();
|
3774
|
-
var
|
3425
|
+
var import_react24 = require("react");
|
3775
3426
|
var usePlaceholderStyle = () => {
|
3776
3427
|
const queryAttr = "data-rbd-drag-handle-draggable-id";
|
3777
|
-
const [placeholderStyle, setPlaceholderStyle] = (0,
|
3428
|
+
const [placeholderStyle, setPlaceholderStyle] = (0, import_react24.useState)();
|
3778
3429
|
const onDragStartOrUpdate = (draggedItem) => {
|
3779
3430
|
var _a;
|
3780
3431
|
const draggableId = draggedItem.draggableId;
|
@@ -3822,24 +3473,24 @@ init_react_import();
|
|
3822
3473
|
|
3823
3474
|
// css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
|
3824
3475
|
init_react_import();
|
3825
|
-
var
|
3476
|
+
var styles_module_default6 = { "SidebarSection": "_SidebarSection_f1p35_1", "SidebarSection-title": "_SidebarSection-title_f1p35_12", "SidebarSection-content": "_SidebarSection-content_f1p35_19", "SidebarSection--noPadding": "_SidebarSection--noPadding_f1p35_24", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_f1p35_33", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_f1p35_44", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_f1p35_33", "SidebarSection-heading": "_SidebarSection-heading_f1p35_56" };
|
3826
3477
|
|
3827
3478
|
// components/Heading/index.tsx
|
3828
3479
|
init_react_import();
|
3829
3480
|
|
3830
3481
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
|
3831
3482
|
init_react_import();
|
3832
|
-
var
|
3483
|
+
var styles_module_default7 = { "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" };
|
3833
3484
|
|
3834
3485
|
// components/Heading/index.tsx
|
3835
|
-
var
|
3836
|
-
var
|
3486
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
3487
|
+
var getClassName8 = get_class_name_factory_default("Heading", styles_module_default7);
|
3837
3488
|
var Heading = ({ children, rank, size = "m" }) => {
|
3838
3489
|
const Tag = rank ? `h${rank}` : "span";
|
3839
|
-
return /* @__PURE__ */ (0,
|
3490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
3840
3491
|
Tag,
|
3841
3492
|
{
|
3842
|
-
className:
|
3493
|
+
className: getClassName8({
|
3843
3494
|
[size]: true
|
3844
3495
|
}),
|
3845
3496
|
children
|
@@ -3848,8 +3499,8 @@ var Heading = ({ children, rank, size = "m" }) => {
|
|
3848
3499
|
};
|
3849
3500
|
|
3850
3501
|
// components/SidebarSection/index.tsx
|
3851
|
-
var
|
3852
|
-
var
|
3502
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
3503
|
+
var getClassName9 = get_class_name_factory_default("SidebarSection", styles_module_default6);
|
3853
3504
|
var SidebarSection = ({
|
3854
3505
|
children,
|
3855
3506
|
title,
|
@@ -3858,22 +3509,22 @@ var SidebarSection = ({
|
|
3858
3509
|
breadcrumbClick,
|
3859
3510
|
noPadding
|
3860
3511
|
}) => {
|
3861
|
-
return /* @__PURE__ */ (0,
|
3862
|
-
/* @__PURE__ */ (0,
|
3863
|
-
breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
3864
|
-
/* @__PURE__ */ (0,
|
3512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: getClassName9({ noPadding }), style: { background }, children: [
|
3513
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName9("title"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: getClassName9("breadcrumbs"), children: [
|
3514
|
+
breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: getClassName9("breadcrumb"), children: [
|
3515
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
3865
3516
|
"div",
|
3866
3517
|
{
|
3867
|
-
className:
|
3518
|
+
className: getClassName9("breadcrumbLabel"),
|
3868
3519
|
onClick: () => breadcrumbClick && breadcrumbClick(breadcrumb),
|
3869
3520
|
children: breadcrumb.label
|
3870
3521
|
}
|
3871
3522
|
),
|
3872
|
-
/* @__PURE__ */ (0,
|
3523
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(chevron_right_default, { size: 16 })
|
3873
3524
|
] }, i)),
|
3874
|
-
/* @__PURE__ */ (0,
|
3525
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName9("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
|
3875
3526
|
] }) }),
|
3876
|
-
/* @__PURE__ */ (0,
|
3527
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName9("content"), children })
|
3877
3528
|
] });
|
3878
3529
|
};
|
3879
3530
|
|
@@ -3882,15 +3533,15 @@ init_react_import();
|
|
3882
3533
|
|
3883
3534
|
// lib/use-puck-history.ts
|
3884
3535
|
init_react_import();
|
3885
|
-
var
|
3536
|
+
var import_react26 = require("react");
|
3886
3537
|
|
3887
3538
|
// lib/use-action-history.ts
|
3888
3539
|
init_react_import();
|
3889
|
-
var
|
3540
|
+
var import_react25 = require("react");
|
3890
3541
|
var EMPTY_HISTORY_INDEX = -1;
|
3891
3542
|
function useActionHistory() {
|
3892
|
-
const [histories, setHistories] = (0,
|
3893
|
-
const [currentHistoryIndex, setCurrentHistoryIndex] = (0,
|
3543
|
+
const [histories, setHistories] = (0, import_react25.useState)([]);
|
3544
|
+
const [currentHistoryIndex, setCurrentHistoryIndex] = (0, import_react25.useState)(EMPTY_HISTORY_INDEX);
|
3894
3545
|
const currentHistory = histories[currentHistoryIndex];
|
3895
3546
|
const canRewind = currentHistoryIndex > EMPTY_HISTORY_INDEX;
|
3896
3547
|
const canForward = currentHistoryIndex < histories.length - 1;
|
@@ -3962,7 +3613,7 @@ function usePuckHistory({
|
|
3962
3613
|
dispatch
|
3963
3614
|
});
|
3964
3615
|
}, DEBOUNCE_TIME);
|
3965
|
-
(0,
|
3616
|
+
(0, import_react26.useEffect)(() => {
|
3966
3617
|
historyEmitter.on(RECORD_DIFF, handleRecordDiff);
|
3967
3618
|
return () => {
|
3968
3619
|
historyEmitter.off(RECORD_DIFF, handleRecordDiff);
|
@@ -3997,6 +3648,13 @@ var remove = (list, index) => {
|
|
3997
3648
|
|
3998
3649
|
// lib/reduce-related-zones.ts
|
3999
3650
|
init_react_import();
|
3651
|
+
|
3652
|
+
// lib/generate-id.ts
|
3653
|
+
init_react_import();
|
3654
|
+
var import_crypto = require("crypto");
|
3655
|
+
var generateId = (type) => `${type}-${(0, import_crypto.randomBytes)(20).toString("hex")}`;
|
3656
|
+
|
3657
|
+
// lib/reduce-related-zones.ts
|
4000
3658
|
var reduceRelatedZones = (item, data, fn) => {
|
4001
3659
|
return __spreadProps(__spreadValues({}, data), {
|
4002
3660
|
zones: Object.keys(data.zones || {}).reduce(
|
@@ -4293,7 +3951,7 @@ init_react_import();
|
|
4293
3951
|
|
4294
3952
|
// css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
|
4295
3953
|
init_react_import();
|
4296
|
-
var
|
3954
|
+
var styles_module_default8 = { "LayerTree": "_LayerTree_1dcmd_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_1dcmd_11", "LayerTree-helper": "_LayerTree-helper_1dcmd_17", "Layer": "_Layer_1dcmd_1", "Layer-inner": "_Layer-inner_1dcmd_29", "Layer--containsZone": "_Layer--containsZone_1dcmd_35", "Layer-clickable": "_Layer-clickable_1dcmd_39", "Layer--isSelected": "_Layer--isSelected_1dcmd_48", "Layer--isHovering": "_Layer--isHovering_1dcmd_49", "Layer-chevron": "_Layer-chevron_1dcmd_65", "Layer--childIsSelected": "_Layer--childIsSelected_1dcmd_66", "Layer-zones": "_Layer-zones_1dcmd_70", "Layer-title": "_Layer-title_1dcmd_84", "Layer-icon": "_Layer-icon_1dcmd_92", "Layer-zoneIcon": "_Layer-zoneIcon_1dcmd_97" };
|
4297
3955
|
|
4298
3956
|
// lib/scroll-into-view.ts
|
4299
3957
|
init_react_import();
|
@@ -4307,7 +3965,7 @@ var scrollIntoView = (el) => {
|
|
4307
3965
|
};
|
4308
3966
|
|
4309
3967
|
// components/LayerTree/index.tsx
|
4310
|
-
var
|
3968
|
+
var import_react27 = require("react");
|
4311
3969
|
|
4312
3970
|
// lib/find-zones-for-area.ts
|
4313
3971
|
init_react_import();
|
@@ -4336,9 +3994,9 @@ var isChildOfZone = (item, maybeChild, ctx) => {
|
|
4336
3994
|
};
|
4337
3995
|
|
4338
3996
|
// components/LayerTree/index.tsx
|
4339
|
-
var
|
4340
|
-
var
|
4341
|
-
var getClassNameLayer = get_class_name_factory_default("Layer",
|
3997
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
3998
|
+
var getClassName10 = get_class_name_factory_default("LayerTree", styles_module_default8);
|
3999
|
+
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default8);
|
4342
4000
|
var LayerTree = ({
|
4343
4001
|
data,
|
4344
4002
|
zoneContent,
|
@@ -4348,15 +4006,15 @@ var LayerTree = ({
|
|
4348
4006
|
label
|
4349
4007
|
}) => {
|
4350
4008
|
const zones = data.zones || {};
|
4351
|
-
const ctx = (0,
|
4352
|
-
return /* @__PURE__ */ (0,
|
4353
|
-
label && /* @__PURE__ */ (0,
|
4354
|
-
/* @__PURE__ */ (0,
|
4009
|
+
const ctx = (0, import_react27.useContext)(dropZoneContext);
|
4010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
4011
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName10("zoneTitle"), children: [
|
4012
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName10("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(layers_default, { size: "16" }) }),
|
4355
4013
|
" ",
|
4356
4014
|
label
|
4357
4015
|
] }),
|
4358
|
-
/* @__PURE__ */ (0,
|
4359
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
4016
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("ul", { className: getClassName10(), children: [
|
4017
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName10("helper"), children: "No items" }),
|
4360
4018
|
zoneContent.map((item, i) => {
|
4361
4019
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
4362
4020
|
const zonesForItem = findZonesForArea(data, item.props.id);
|
@@ -4371,7 +4029,7 @@ var LayerTree = ({
|
|
4371
4029
|
const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
|
4372
4030
|
const isHovering = hoveringComponent === item.props.id;
|
4373
4031
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
4374
|
-
return /* @__PURE__ */ (0,
|
4032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
4375
4033
|
"li",
|
4376
4034
|
{
|
4377
4035
|
className: getClassNameLayer({
|
@@ -4381,7 +4039,7 @@ var LayerTree = ({
|
|
4381
4039
|
childIsSelected
|
4382
4040
|
}),
|
4383
4041
|
children: [
|
4384
|
-
/* @__PURE__ */ (0,
|
4042
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
4385
4043
|
"div",
|
4386
4044
|
{
|
4387
4045
|
className: getClassNameLayer("clickable"),
|
@@ -4412,22 +4070,22 @@ var LayerTree = ({
|
|
4412
4070
|
setHoveringComponent(null);
|
4413
4071
|
},
|
4414
4072
|
children: [
|
4415
|
-
containsZone && /* @__PURE__ */ (0,
|
4073
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
4416
4074
|
"div",
|
4417
4075
|
{
|
4418
4076
|
className: getClassNameLayer("chevron"),
|
4419
4077
|
title: isSelected ? "Collapse" : "Expand",
|
4420
|
-
children: /* @__PURE__ */ (0,
|
4078
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(chevron_down_default, { size: "12" })
|
4421
4079
|
}
|
4422
4080
|
),
|
4423
|
-
/* @__PURE__ */ (0,
|
4424
|
-
/* @__PURE__ */ (0,
|
4081
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
4082
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(type_default, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(grid_default, { size: "16" }) }),
|
4425
4083
|
item.type
|
4426
4084
|
] })
|
4427
4085
|
]
|
4428
4086
|
}
|
4429
4087
|
) }),
|
4430
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
4088
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
4431
4089
|
LayerTree,
|
4432
4090
|
{
|
4433
4091
|
data,
|
@@ -4472,7 +4130,7 @@ var flushZones = (appData) => {
|
|
4472
4130
|
};
|
4473
4131
|
|
4474
4132
|
// components/Puck/index.tsx
|
4475
|
-
var
|
4133
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
4476
4134
|
var defaultPageFields = {
|
4477
4135
|
title: { type: "text" }
|
4478
4136
|
};
|
@@ -4483,7 +4141,7 @@ var PluginRenderer = ({
|
|
4483
4141
|
renderMethod
|
4484
4142
|
}) => {
|
4485
4143
|
return plugins.filter((item) => item[renderMethod]).map((item) => item[renderMethod]).reduce(
|
4486
|
-
(accChildren, Item) => /* @__PURE__ */ (0,
|
4144
|
+
(accChildren, Item) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Item, { data, children: accChildren }),
|
4487
4145
|
children
|
4488
4146
|
);
|
4489
4147
|
};
|
@@ -4499,15 +4157,12 @@ function Puck({
|
|
4499
4157
|
headerPath
|
4500
4158
|
}) {
|
4501
4159
|
var _a, _b;
|
4502
|
-
const [reducer] = (0,
|
4160
|
+
const [reducer] = (0, import_react28.useState)(() => createReducer({ config }));
|
4503
4161
|
const initialAppData = {
|
4504
4162
|
data: initialData,
|
4505
|
-
state: {
|
4506
|
-
leftSideBarVisible: true,
|
4507
|
-
arrayState: {}
|
4508
|
-
}
|
4163
|
+
state: { leftSideBarVisible: true, itemSelector: null }
|
4509
4164
|
};
|
4510
|
-
const [appData, dispatch] = (0,
|
4165
|
+
const [appData, dispatch] = (0, import_react28.useReducer)(
|
4511
4166
|
reducer,
|
4512
4167
|
flushZones(initialAppData)
|
4513
4168
|
);
|
@@ -4517,7 +4172,7 @@ function Puck({
|
|
4517
4172
|
dispatch
|
4518
4173
|
});
|
4519
4174
|
const { itemSelector, leftSideBarVisible } = state;
|
4520
|
-
const setItemSelector = (0,
|
4175
|
+
const setItemSelector = (0, import_react28.useCallback)(
|
4521
4176
|
(newItemSelector) => {
|
4522
4177
|
dispatch({
|
4523
4178
|
type: "setState",
|
@@ -4527,10 +4182,10 @@ function Puck({
|
|
4527
4182
|
[]
|
4528
4183
|
);
|
4529
4184
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
4530
|
-
const Page = (0,
|
4185
|
+
const Page = (0, import_react28.useCallback)(
|
4531
4186
|
(pageProps) => {
|
4532
4187
|
var _a2, _b2;
|
4533
|
-
return /* @__PURE__ */ (0,
|
4188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4534
4189
|
PluginRenderer,
|
4535
4190
|
{
|
4536
4191
|
plugins,
|
@@ -4542,8 +4197,8 @@ function Puck({
|
|
4542
4197
|
},
|
4543
4198
|
[config.root]
|
4544
4199
|
);
|
4545
|
-
const PageFieldWrapper = (0,
|
4546
|
-
(props) => /* @__PURE__ */ (0,
|
4200
|
+
const PageFieldWrapper = (0, import_react28.useCallback)(
|
4201
|
+
(props) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4547
4202
|
PluginRenderer,
|
4548
4203
|
{
|
4549
4204
|
plugins,
|
@@ -4554,8 +4209,8 @@ function Puck({
|
|
4554
4209
|
),
|
4555
4210
|
[]
|
4556
4211
|
);
|
4557
|
-
const ComponentFieldWrapper = (0,
|
4558
|
-
(props) => /* @__PURE__ */ (0,
|
4212
|
+
const ComponentFieldWrapper = (0, import_react28.useCallback)(
|
4213
|
+
(props) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4559
4214
|
PluginRenderer,
|
4560
4215
|
{
|
4561
4216
|
plugins,
|
@@ -4569,14 +4224,14 @@ function Puck({
|
|
4569
4224
|
const FieldWrapper = itemSelector ? ComponentFieldWrapper : PageFieldWrapper;
|
4570
4225
|
const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
|
4571
4226
|
let fields = selectedItem ? ((_b = config.components[selectedItem.type]) == null ? void 0 : _b.fields) || {} : rootFields;
|
4572
|
-
(0,
|
4227
|
+
(0, import_react28.useEffect)(() => {
|
4573
4228
|
if (onChange)
|
4574
4229
|
onChange(data);
|
4575
4230
|
}, [data]);
|
4576
4231
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
4577
|
-
const [draggedItem, setDraggedItem] = (0,
|
4578
|
-
return /* @__PURE__ */ (0,
|
4579
|
-
|
4232
|
+
const [draggedItem, setDraggedItem] = (0, import_react28.useState)();
|
4233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "puck", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4234
|
+
import_react_beautiful_dnd4.DragDropContext,
|
4580
4235
|
{
|
4581
4236
|
onDragUpdate: (update) => {
|
4582
4237
|
setDraggedItem(__spreadValues(__spreadValues({}, draggedItem), update));
|
@@ -4627,7 +4282,7 @@ function Puck({
|
|
4627
4282
|
});
|
4628
4283
|
}
|
4629
4284
|
},
|
4630
|
-
children: /* @__PURE__ */ (0,
|
4285
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4631
4286
|
DropZoneProvider,
|
4632
4287
|
{
|
4633
4288
|
value: {
|
@@ -4641,13 +4296,13 @@ function Puck({
|
|
4641
4296
|
mode: "edit",
|
4642
4297
|
areaId: "root"
|
4643
4298
|
},
|
4644
|
-
children: /* @__PURE__ */ (0,
|
4299
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(dropZoneContext.Consumer, { children: (ctx) => {
|
4645
4300
|
let path = (ctx == null ? void 0 : ctx.pathData) && selectedItem ? ctx == null ? void 0 : ctx.pathData[selectedItem == null ? void 0 : selectedItem.props.id] : void 0;
|
4646
4301
|
if (path) {
|
4647
4302
|
path = [{ label: "Page", selector: null }, ...path];
|
4648
4303
|
path = path.slice(path.length - 2, path.length - 1);
|
4649
4304
|
}
|
4650
|
-
return /* @__PURE__ */ (0,
|
4305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
4651
4306
|
"div",
|
4652
4307
|
{
|
4653
4308
|
style: {
|
@@ -4663,7 +4318,7 @@ function Puck({
|
|
4663
4318
|
right: 0
|
4664
4319
|
},
|
4665
4320
|
children: [
|
4666
|
-
/* @__PURE__ */ (0,
|
4321
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4667
4322
|
"header",
|
4668
4323
|
{
|
4669
4324
|
style: {
|
@@ -4673,19 +4328,19 @@ function Puck({
|
|
4673
4328
|
borderBottom: "1px solid var(--puck-color-grey-8)"
|
4674
4329
|
},
|
4675
4330
|
children: renderHeader ? renderHeader({
|
4676
|
-
children: /* @__PURE__ */ (0,
|
4331
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4677
4332
|
Button,
|
4678
4333
|
{
|
4679
4334
|
onClick: () => {
|
4680
4335
|
onPublish(data);
|
4681
4336
|
},
|
4682
|
-
icon: /* @__PURE__ */ (0,
|
4337
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(globe_default, { size: "14px" }),
|
4683
4338
|
children: "Publish"
|
4684
4339
|
}
|
4685
4340
|
),
|
4686
4341
|
data,
|
4687
4342
|
dispatch
|
4688
|
-
}) : /* @__PURE__ */ (0,
|
4343
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
4689
4344
|
"div",
|
4690
4345
|
{
|
4691
4346
|
style: {
|
@@ -4696,14 +4351,14 @@ function Puck({
|
|
4696
4351
|
gridTemplateRows: "auto"
|
4697
4352
|
},
|
4698
4353
|
children: [
|
4699
|
-
/* @__PURE__ */ (0,
|
4354
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4700
4355
|
"div",
|
4701
4356
|
{
|
4702
4357
|
style: {
|
4703
4358
|
display: "flex",
|
4704
4359
|
gap: 16
|
4705
4360
|
},
|
4706
|
-
children: /* @__PURE__ */ (0,
|
4361
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4707
4362
|
IconButton,
|
4708
4363
|
{
|
4709
4364
|
onClick: () => dispatch({
|
@@ -4713,12 +4368,12 @@ function Puck({
|
|
4713
4368
|
}
|
4714
4369
|
}),
|
4715
4370
|
title: "Toggle left sidebar",
|
4716
|
-
children: /* @__PURE__ */ (0,
|
4371
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(sidebar_default, {})
|
4717
4372
|
}
|
4718
4373
|
)
|
4719
4374
|
}
|
4720
4375
|
),
|
4721
|
-
/* @__PURE__ */ (0,
|
4376
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4722
4377
|
"div",
|
4723
4378
|
{
|
4724
4379
|
style: {
|
@@ -4726,19 +4381,13 @@ function Puck({
|
|
4726
4381
|
justifyContent: "center",
|
4727
4382
|
alignItems: "center"
|
4728
4383
|
},
|
4729
|
-
children: /* @__PURE__ */ (0,
|
4384
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
4730
4385
|
headerTitle || data.root.title || "Page",
|
4731
|
-
headerPath && /* @__PURE__ */ (0,
|
4732
|
-
"small",
|
4733
|
-
{
|
4734
|
-
style: { fontWeight: 400, marginLeft: 4 },
|
4735
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("code", { children: headerPath })
|
4736
|
-
}
|
4737
|
-
)
|
4386
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("small", { style: { fontWeight: 400, marginLeft: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("code", { children: headerPath }) })
|
4738
4387
|
] })
|
4739
4388
|
}
|
4740
4389
|
),
|
4741
|
-
/* @__PURE__ */ (0,
|
4390
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
4742
4391
|
"div",
|
4743
4392
|
{
|
4744
4393
|
style: {
|
@@ -4747,14 +4396,14 @@ function Puck({
|
|
4747
4396
|
justifyContent: "flex-end"
|
4748
4397
|
},
|
4749
4398
|
children: [
|
4750
|
-
/* @__PURE__ */ (0,
|
4751
|
-
/* @__PURE__ */ (0,
|
4399
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex" }, children: [
|
4400
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4752
4401
|
IconButton,
|
4753
4402
|
{
|
4754
4403
|
title: "undo",
|
4755
4404
|
disabled: !canRewind,
|
4756
4405
|
onClick: rewind,
|
4757
|
-
children: /* @__PURE__ */ (0,
|
4406
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4758
4407
|
chevron_left_default,
|
4759
4408
|
{
|
4760
4409
|
size: 21,
|
@@ -4763,13 +4412,13 @@ function Puck({
|
|
4763
4412
|
)
|
4764
4413
|
}
|
4765
4414
|
),
|
4766
|
-
/* @__PURE__ */ (0,
|
4415
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4767
4416
|
IconButton,
|
4768
4417
|
{
|
4769
4418
|
title: "redo",
|
4770
4419
|
disabled: !canForward,
|
4771
4420
|
onClick: forward,
|
4772
|
-
children: /* @__PURE__ */ (0,
|
4421
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4773
4422
|
chevron_right_default,
|
4774
4423
|
{
|
4775
4424
|
size: 21,
|
@@ -4780,13 +4429,13 @@ function Puck({
|
|
4780
4429
|
)
|
4781
4430
|
] }),
|
4782
4431
|
renderHeaderActions && renderHeaderActions({ data, dispatch }),
|
4783
|
-
/* @__PURE__ */ (0,
|
4432
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4784
4433
|
Button,
|
4785
4434
|
{
|
4786
4435
|
onClick: () => {
|
4787
4436
|
onPublish(data);
|
4788
4437
|
},
|
4789
|
-
icon: /* @__PURE__ */ (0,
|
4438
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(globe_default, { size: "14px" }),
|
4790
4439
|
children: "Publish"
|
4791
4440
|
}
|
4792
4441
|
)
|
@@ -4798,7 +4447,7 @@ function Puck({
|
|
4798
4447
|
)
|
4799
4448
|
}
|
4800
4449
|
),
|
4801
|
-
/* @__PURE__ */ (0,
|
4450
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
4802
4451
|
"div",
|
4803
4452
|
{
|
4804
4453
|
style: {
|
@@ -4810,9 +4459,9 @@ function Puck({
|
|
4810
4459
|
flexDirection: "column"
|
4811
4460
|
},
|
4812
4461
|
children: [
|
4813
|
-
/* @__PURE__ */ (0,
|
4814
|
-
/* @__PURE__ */ (0,
|
4815
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0,
|
4462
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SidebarSection, { title: "Components", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ComponentList, { config }) }),
|
4463
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(SidebarSection, { title: "Outline", children: [
|
4464
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4816
4465
|
LayerTree,
|
4817
4466
|
{
|
4818
4467
|
data,
|
@@ -4824,7 +4473,7 @@ function Puck({
|
|
4824
4473
|
),
|
4825
4474
|
Object.entries(findZonesForArea(data, "root")).map(
|
4826
4475
|
([zoneKey, zone]) => {
|
4827
|
-
return /* @__PURE__ */ (0,
|
4476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4828
4477
|
LayerTree,
|
4829
4478
|
{
|
4830
4479
|
data,
|
@@ -4842,7 +4491,7 @@ function Puck({
|
|
4842
4491
|
]
|
4843
4492
|
}
|
4844
4493
|
),
|
4845
|
-
/* @__PURE__ */ (0,
|
4494
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
4846
4495
|
"div",
|
4847
4496
|
{
|
4848
4497
|
style: {
|
@@ -4855,7 +4504,7 @@ function Puck({
|
|
4855
4504
|
onClick: () => setItemSelector(null),
|
4856
4505
|
id: "puck-frame",
|
4857
4506
|
children: [
|
4858
|
-
/* @__PURE__ */ (0,
|
4507
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4859
4508
|
"div",
|
4860
4509
|
{
|
4861
4510
|
className: "puck-root",
|
@@ -4864,18 +4513,18 @@ function Puck({
|
|
4864
4513
|
margin: 32,
|
4865
4514
|
zoom: 0.75
|
4866
4515
|
},
|
4867
|
-
children: /* @__PURE__ */ (0,
|
4516
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4868
4517
|
"div",
|
4869
4518
|
{
|
4870
4519
|
style: {
|
4871
4520
|
border: "1px solid var(--puck-color-grey-8)"
|
4872
4521
|
},
|
4873
|
-
children: /* @__PURE__ */ (0,
|
4522
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Page, __spreadProps(__spreadValues({ data }, data.root), { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DropZone, { zone: rootDroppableId }) }))
|
4874
4523
|
}
|
4875
4524
|
)
|
4876
4525
|
}
|
4877
4526
|
),
|
4878
|
-
/* @__PURE__ */ (0,
|
4527
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4879
4528
|
"div",
|
4880
4529
|
{
|
4881
4530
|
style: {
|
@@ -4888,7 +4537,7 @@ function Puck({
|
|
4888
4537
|
]
|
4889
4538
|
}
|
4890
4539
|
),
|
4891
|
-
/* @__PURE__ */ (0,
|
4540
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4892
4541
|
"div",
|
4893
4542
|
{
|
4894
4543
|
style: {
|
@@ -4900,7 +4549,7 @@ function Puck({
|
|
4900
4549
|
flexDirection: "column",
|
4901
4550
|
background: "var(--puck-color-white)"
|
4902
4551
|
},
|
4903
|
-
children: /* @__PURE__ */ (0,
|
4552
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FieldWrapper, { data, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4904
4553
|
SidebarSection,
|
4905
4554
|
{
|
4906
4555
|
noPadding: true,
|
@@ -4959,7 +4608,7 @@ function Puck({
|
|
4959
4608
|
}
|
4960
4609
|
};
|
4961
4610
|
if (selectedItem && itemSelector) {
|
4962
|
-
return /* @__PURE__ */ (0,
|
4611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4963
4612
|
InputOrGroup,
|
4964
4613
|
{
|
4965
4614
|
field,
|
@@ -4975,15 +4624,13 @@ function Puck({
|
|
4975
4624
|
`${selectedItem.props.id}_${fieldName}`
|
4976
4625
|
);
|
4977
4626
|
} else {
|
4978
|
-
return /* @__PURE__ */ (0,
|
4627
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
4979
4628
|
InputOrGroup,
|
4980
4629
|
{
|
4981
4630
|
field,
|
4982
4631
|
name: fieldName,
|
4983
4632
|
label: field.label,
|
4984
|
-
readOnly: ((_d = (_c = data.root._meta) == null ? void 0 : _c.locked) == null ? void 0 : _d.indexOf(
|
4985
|
-
fieldName
|
4986
|
-
)) > -1,
|
4633
|
+
readOnly: ((_d = (_c = data.root._meta) == null ? void 0 : _c.locked) == null ? void 0 : _d.indexOf(fieldName)) > -1,
|
4987
4634
|
value: data.root[fieldName],
|
4988
4635
|
onChange: onChange2
|
4989
4636
|
},
|
@@ -5002,17 +4649,17 @@ function Puck({
|
|
5002
4649
|
}
|
5003
4650
|
)
|
5004
4651
|
}
|
5005
|
-
) })
|
4652
|
+
) });
|
5006
4653
|
}
|
5007
4654
|
|
5008
4655
|
// components/Render/index.tsx
|
5009
4656
|
init_react_import();
|
5010
|
-
var
|
4657
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
5011
4658
|
function Render({ config, data }) {
|
5012
4659
|
if (config.root) {
|
5013
|
-
return /* @__PURE__ */ (0,
|
4660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(config.root.render, __spreadProps(__spreadValues({}, data.root), { editMode: false, id: "puck-root", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DropZone, { zone: rootDroppableId }) })) });
|
5014
4661
|
}
|
5015
|
-
return /* @__PURE__ */ (0,
|
4662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DropZone, { zone: rootDroppableId }) });
|
5016
4663
|
}
|
5017
4664
|
// Annotate the CommonJS export names for ESM import in node:
|
5018
4665
|
0 && (module.exports = {
|