@measured/puck 0.12.1-canary.9470ff9 → 0.13.0-canary.2e1b5ef
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/{Config-35e6eaae.d.ts → Config-162394d8.d.ts} +7 -1
- package/dist/index.css +93 -27
- package/dist/index.d.ts +8 -7
- package/dist/index.js +341 -185
- package/dist/rsc.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -8989,9 +8989,9 @@ var require_react_dom_development = __commonJS({
|
|
8989
8989
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
|
8990
8990
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
8991
8991
|
}
|
8992
|
-
var
|
8992
|
+
var React21 = require("react");
|
8993
8993
|
var Scheduler = require_scheduler();
|
8994
|
-
var ReactSharedInternals =
|
8994
|
+
var ReactSharedInternals = React21.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
8995
8995
|
var suppressWarning = false;
|
8996
8996
|
function setSuppressWarning(newSuppressWarning) {
|
8997
8997
|
{
|
@@ -10596,7 +10596,7 @@ var require_react_dom_development = __commonJS({
|
|
10596
10596
|
{
|
10597
10597
|
if (props.value == null) {
|
10598
10598
|
if (typeof props.children === "object" && props.children !== null) {
|
10599
|
-
|
10599
|
+
React21.Children.forEach(props.children, function(child) {
|
10600
10600
|
if (child == null) {
|
10601
10601
|
return;
|
10602
10602
|
}
|
@@ -19043,7 +19043,7 @@ var require_react_dom_development = __commonJS({
|
|
19043
19043
|
}
|
19044
19044
|
}
|
19045
19045
|
var fakeInternalInstance = {};
|
19046
|
-
var emptyRefsObject = new
|
19046
|
+
var emptyRefsObject = new React21.Component().refs;
|
19047
19047
|
var didWarnAboutStateAssignmentForComponent;
|
19048
19048
|
var didWarnAboutUninitializedState;
|
19049
19049
|
var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate;
|
@@ -30170,9 +30170,11 @@ var Button = ({
|
|
30170
30170
|
newTab,
|
30171
30171
|
fullWidth,
|
30172
30172
|
icon,
|
30173
|
-
size = "medium"
|
30173
|
+
size = "medium",
|
30174
|
+
loading: loadingProp = false
|
30174
30175
|
}) => {
|
30175
|
-
const [loading, setLoading] = (0, import_react2.useState)(
|
30176
|
+
const [loading, setLoading] = (0, import_react2.useState)(loadingProp);
|
30177
|
+
(0, import_react2.useEffect)(() => setLoading(loadingProp), [loadingProp]);
|
30176
30178
|
const ElementType = href ? "a" : "button";
|
30177
30179
|
const el = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
30178
30180
|
ElementType,
|
@@ -30213,11 +30215,11 @@ var Button = ({
|
|
30213
30215
|
|
30214
30216
|
// components/DropZone/index.tsx
|
30215
30217
|
init_react_import();
|
30216
|
-
var
|
30218
|
+
var import_react26 = require("react");
|
30217
30219
|
|
30218
30220
|
// components/DraggableComponent/index.tsx
|
30219
30221
|
init_react_import();
|
30220
|
-
var
|
30222
|
+
var import_react23 = require("react");
|
30221
30223
|
var import_dnd = require("@hello-pangea/dnd");
|
30222
30224
|
|
30223
30225
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
@@ -31366,7 +31368,7 @@ Plus.propTypes = {
|
|
31366
31368
|
Plus.displayName = "Plus";
|
31367
31369
|
var plus_default = Plus;
|
31368
31370
|
|
31369
|
-
// ../../node_modules/react-feather/dist/icons/
|
31371
|
+
// ../../node_modules/react-feather/dist/icons/search.js
|
31370
31372
|
init_react_import();
|
31371
31373
|
var import_react17 = __toESM(require("react"));
|
31372
31374
|
var import_prop_types15 = __toESM(require_prop_types());
|
@@ -31416,7 +31418,7 @@ function _objectWithoutPropertiesLoose15(source, excluded) {
|
|
31416
31418
|
}
|
31417
31419
|
return target;
|
31418
31420
|
}
|
31419
|
-
var
|
31421
|
+
var Search = (0, import_react17.forwardRef)(function(_ref, ref) {
|
31420
31422
|
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"]);
|
31421
31423
|
return /* @__PURE__ */ import_react17.default.createElement("svg", _extends15({
|
31422
31424
|
ref,
|
@@ -31429,28 +31431,25 @@ var Sidebar = (0, import_react17.forwardRef)(function(_ref, ref) {
|
|
31429
31431
|
strokeWidth: "2",
|
31430
31432
|
strokeLinecap: "round",
|
31431
31433
|
strokeLinejoin: "round"
|
31432
|
-
}, rest), /* @__PURE__ */ import_react17.default.createElement("
|
31433
|
-
|
31434
|
-
|
31435
|
-
|
31436
|
-
height: "18",
|
31437
|
-
rx: "2",
|
31438
|
-
ry: "2"
|
31434
|
+
}, rest), /* @__PURE__ */ import_react17.default.createElement("circle", {
|
31435
|
+
cx: "11",
|
31436
|
+
cy: "11",
|
31437
|
+
r: "8"
|
31439
31438
|
}), /* @__PURE__ */ import_react17.default.createElement("line", {
|
31440
|
-
x1: "
|
31441
|
-
y1: "
|
31442
|
-
x2: "
|
31443
|
-
y2: "
|
31439
|
+
x1: "21",
|
31440
|
+
y1: "21",
|
31441
|
+
x2: "16.65",
|
31442
|
+
y2: "16.65"
|
31444
31443
|
}));
|
31445
31444
|
});
|
31446
|
-
|
31445
|
+
Search.propTypes = {
|
31447
31446
|
color: import_prop_types15.default.string,
|
31448
31447
|
size: import_prop_types15.default.oneOfType([import_prop_types15.default.string, import_prop_types15.default.number])
|
31449
31448
|
};
|
31450
|
-
|
31451
|
-
var
|
31449
|
+
Search.displayName = "Search";
|
31450
|
+
var search_default = Search;
|
31452
31451
|
|
31453
|
-
// ../../node_modules/react-feather/dist/icons/
|
31452
|
+
// ../../node_modules/react-feather/dist/icons/sidebar.js
|
31454
31453
|
init_react_import();
|
31455
31454
|
var import_react18 = __toESM(require("react"));
|
31456
31455
|
var import_prop_types16 = __toESM(require_prop_types());
|
@@ -31500,7 +31499,7 @@ function _objectWithoutPropertiesLoose16(source, excluded) {
|
|
31500
31499
|
}
|
31501
31500
|
return target;
|
31502
31501
|
}
|
31503
|
-
var
|
31502
|
+
var Sidebar = (0, import_react18.forwardRef)(function(_ref, ref) {
|
31504
31503
|
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 = _objectWithoutProperties16(_ref, ["color", "size"]);
|
31505
31504
|
return /* @__PURE__ */ import_react18.default.createElement("svg", _extends16({
|
31506
31505
|
ref,
|
@@ -31513,20 +31512,28 @@ var Trash = (0, import_react18.forwardRef)(function(_ref, ref) {
|
|
31513
31512
|
strokeWidth: "2",
|
31514
31513
|
strokeLinecap: "round",
|
31515
31514
|
strokeLinejoin: "round"
|
31516
|
-
}, rest), /* @__PURE__ */ import_react18.default.createElement("
|
31517
|
-
|
31518
|
-
|
31519
|
-
|
31515
|
+
}, rest), /* @__PURE__ */ import_react18.default.createElement("rect", {
|
31516
|
+
x: "3",
|
31517
|
+
y: "3",
|
31518
|
+
width: "18",
|
31519
|
+
height: "18",
|
31520
|
+
rx: "2",
|
31521
|
+
ry: "2"
|
31522
|
+
}), /* @__PURE__ */ import_react18.default.createElement("line", {
|
31523
|
+
x1: "9",
|
31524
|
+
y1: "3",
|
31525
|
+
x2: "9",
|
31526
|
+
y2: "21"
|
31520
31527
|
}));
|
31521
31528
|
});
|
31522
|
-
|
31529
|
+
Sidebar.propTypes = {
|
31523
31530
|
color: import_prop_types16.default.string,
|
31524
31531
|
size: import_prop_types16.default.oneOfType([import_prop_types16.default.string, import_prop_types16.default.number])
|
31525
31532
|
};
|
31526
|
-
|
31527
|
-
var
|
31533
|
+
Sidebar.displayName = "Sidebar";
|
31534
|
+
var sidebar_default = Sidebar;
|
31528
31535
|
|
31529
|
-
// ../../node_modules/react-feather/dist/icons/
|
31536
|
+
// ../../node_modules/react-feather/dist/icons/trash.js
|
31530
31537
|
init_react_import();
|
31531
31538
|
var import_react19 = __toESM(require("react"));
|
31532
31539
|
var import_prop_types17 = __toESM(require_prop_types());
|
@@ -31576,7 +31583,7 @@ function _objectWithoutPropertiesLoose17(source, excluded) {
|
|
31576
31583
|
}
|
31577
31584
|
return target;
|
31578
31585
|
}
|
31579
|
-
var
|
31586
|
+
var Trash = (0, import_react19.forwardRef)(function(_ref, ref) {
|
31580
31587
|
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 = _objectWithoutProperties17(_ref, ["color", "size"]);
|
31581
31588
|
return /* @__PURE__ */ import_react19.default.createElement("svg", _extends17({
|
31582
31589
|
ref,
|
@@ -31590,13 +31597,89 @@ var Type = (0, import_react19.forwardRef)(function(_ref, ref) {
|
|
31590
31597
|
strokeLinecap: "round",
|
31591
31598
|
strokeLinejoin: "round"
|
31592
31599
|
}, rest), /* @__PURE__ */ import_react19.default.createElement("polyline", {
|
31600
|
+
points: "3 6 5 6 21 6"
|
31601
|
+
}), /* @__PURE__ */ import_react19.default.createElement("path", {
|
31602
|
+
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"
|
31603
|
+
}));
|
31604
|
+
});
|
31605
|
+
Trash.propTypes = {
|
31606
|
+
color: import_prop_types17.default.string,
|
31607
|
+
size: import_prop_types17.default.oneOfType([import_prop_types17.default.string, import_prop_types17.default.number])
|
31608
|
+
};
|
31609
|
+
Trash.displayName = "Trash";
|
31610
|
+
var trash_default = Trash;
|
31611
|
+
|
31612
|
+
// ../../node_modules/react-feather/dist/icons/type.js
|
31613
|
+
init_react_import();
|
31614
|
+
var import_react20 = __toESM(require("react"));
|
31615
|
+
var import_prop_types18 = __toESM(require_prop_types());
|
31616
|
+
function _extends18() {
|
31617
|
+
_extends18 = Object.assign || function(target) {
|
31618
|
+
for (var i = 1; i < arguments.length; i++) {
|
31619
|
+
var source = arguments[i];
|
31620
|
+
for (var key in source) {
|
31621
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
31622
|
+
target[key] = source[key];
|
31623
|
+
}
|
31624
|
+
}
|
31625
|
+
}
|
31626
|
+
return target;
|
31627
|
+
};
|
31628
|
+
return _extends18.apply(this, arguments);
|
31629
|
+
}
|
31630
|
+
function _objectWithoutProperties18(source, excluded) {
|
31631
|
+
if (source == null)
|
31632
|
+
return {};
|
31633
|
+
var target = _objectWithoutPropertiesLoose18(source, excluded);
|
31634
|
+
var key, i;
|
31635
|
+
if (Object.getOwnPropertySymbols) {
|
31636
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
31637
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
31638
|
+
key = sourceSymbolKeys[i];
|
31639
|
+
if (excluded.indexOf(key) >= 0)
|
31640
|
+
continue;
|
31641
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key))
|
31642
|
+
continue;
|
31643
|
+
target[key] = source[key];
|
31644
|
+
}
|
31645
|
+
}
|
31646
|
+
return target;
|
31647
|
+
}
|
31648
|
+
function _objectWithoutPropertiesLoose18(source, excluded) {
|
31649
|
+
if (source == null)
|
31650
|
+
return {};
|
31651
|
+
var target = {};
|
31652
|
+
var sourceKeys = Object.keys(source);
|
31653
|
+
var key, i;
|
31654
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
31655
|
+
key = sourceKeys[i];
|
31656
|
+
if (excluded.indexOf(key) >= 0)
|
31657
|
+
continue;
|
31658
|
+
target[key] = source[key];
|
31659
|
+
}
|
31660
|
+
return target;
|
31661
|
+
}
|
31662
|
+
var Type = (0, import_react20.forwardRef)(function(_ref, ref) {
|
31663
|
+
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 = _objectWithoutProperties18(_ref, ["color", "size"]);
|
31664
|
+
return /* @__PURE__ */ import_react20.default.createElement("svg", _extends18({
|
31665
|
+
ref,
|
31666
|
+
xmlns: "http://www.w3.org/2000/svg",
|
31667
|
+
width: size,
|
31668
|
+
height: size,
|
31669
|
+
viewBox: "0 0 24 24",
|
31670
|
+
fill: "none",
|
31671
|
+
stroke: color,
|
31672
|
+
strokeWidth: "2",
|
31673
|
+
strokeLinecap: "round",
|
31674
|
+
strokeLinejoin: "round"
|
31675
|
+
}, rest), /* @__PURE__ */ import_react20.default.createElement("polyline", {
|
31593
31676
|
points: "4 7 4 4 20 4 20 7"
|
31594
|
-
}), /* @__PURE__ */
|
31677
|
+
}), /* @__PURE__ */ import_react20.default.createElement("line", {
|
31595
31678
|
x1: "9",
|
31596
31679
|
y1: "20",
|
31597
31680
|
x2: "15",
|
31598
31681
|
y2: "20"
|
31599
|
-
}), /* @__PURE__ */
|
31682
|
+
}), /* @__PURE__ */ import_react20.default.createElement("line", {
|
31600
31683
|
x1: "12",
|
31601
31684
|
y1: "4",
|
31602
31685
|
x2: "12",
|
@@ -31604,18 +31687,18 @@ var Type = (0, import_react19.forwardRef)(function(_ref, ref) {
|
|
31604
31687
|
}));
|
31605
31688
|
});
|
31606
31689
|
Type.propTypes = {
|
31607
|
-
color:
|
31608
|
-
size:
|
31690
|
+
color: import_prop_types18.default.string,
|
31691
|
+
size: import_prop_types18.default.oneOfType([import_prop_types18.default.string, import_prop_types18.default.number])
|
31609
31692
|
};
|
31610
31693
|
Type.displayName = "Type";
|
31611
31694
|
var type_default = Type;
|
31612
31695
|
|
31613
31696
|
// ../../node_modules/react-feather/dist/icons/unlock.js
|
31614
31697
|
init_react_import();
|
31615
|
-
var
|
31616
|
-
var
|
31617
|
-
function
|
31618
|
-
|
31698
|
+
var import_react21 = __toESM(require("react"));
|
31699
|
+
var import_prop_types19 = __toESM(require_prop_types());
|
31700
|
+
function _extends19() {
|
31701
|
+
_extends19 = Object.assign || function(target) {
|
31619
31702
|
for (var i = 1; i < arguments.length; i++) {
|
31620
31703
|
var source = arguments[i];
|
31621
31704
|
for (var key in source) {
|
@@ -31626,12 +31709,12 @@ function _extends18() {
|
|
31626
31709
|
}
|
31627
31710
|
return target;
|
31628
31711
|
};
|
31629
|
-
return
|
31712
|
+
return _extends19.apply(this, arguments);
|
31630
31713
|
}
|
31631
|
-
function
|
31714
|
+
function _objectWithoutProperties19(source, excluded) {
|
31632
31715
|
if (source == null)
|
31633
31716
|
return {};
|
31634
|
-
var target =
|
31717
|
+
var target = _objectWithoutPropertiesLoose19(source, excluded);
|
31635
31718
|
var key, i;
|
31636
31719
|
if (Object.getOwnPropertySymbols) {
|
31637
31720
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
@@ -31646,7 +31729,7 @@ function _objectWithoutProperties18(source, excluded) {
|
|
31646
31729
|
}
|
31647
31730
|
return target;
|
31648
31731
|
}
|
31649
|
-
function
|
31732
|
+
function _objectWithoutPropertiesLoose19(source, excluded) {
|
31650
31733
|
if (source == null)
|
31651
31734
|
return {};
|
31652
31735
|
var target = {};
|
@@ -31660,9 +31743,9 @@ function _objectWithoutPropertiesLoose18(source, excluded) {
|
|
31660
31743
|
}
|
31661
31744
|
return target;
|
31662
31745
|
}
|
31663
|
-
var Unlock = (0,
|
31664
|
-
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 =
|
31665
|
-
return /* @__PURE__ */
|
31746
|
+
var Unlock = (0, import_react21.forwardRef)(function(_ref, ref) {
|
31747
|
+
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 = _objectWithoutProperties19(_ref, ["color", "size"]);
|
31748
|
+
return /* @__PURE__ */ import_react21.default.createElement("svg", _extends19({
|
31666
31749
|
ref,
|
31667
31750
|
xmlns: "http://www.w3.org/2000/svg",
|
31668
31751
|
width: size,
|
@@ -31673,30 +31756,30 @@ var Unlock = (0, import_react20.forwardRef)(function(_ref, ref) {
|
|
31673
31756
|
strokeWidth: "2",
|
31674
31757
|
strokeLinecap: "round",
|
31675
31758
|
strokeLinejoin: "round"
|
31676
|
-
}, rest), /* @__PURE__ */
|
31759
|
+
}, rest), /* @__PURE__ */ import_react21.default.createElement("rect", {
|
31677
31760
|
x: "3",
|
31678
31761
|
y: "11",
|
31679
31762
|
width: "18",
|
31680
31763
|
height: "11",
|
31681
31764
|
rx: "2",
|
31682
31765
|
ry: "2"
|
31683
|
-
}), /* @__PURE__ */
|
31766
|
+
}), /* @__PURE__ */ import_react21.default.createElement("path", {
|
31684
31767
|
d: "M7 11V7a5 5 0 0 1 9.9-1"
|
31685
31768
|
}));
|
31686
31769
|
});
|
31687
31770
|
Unlock.propTypes = {
|
31688
|
-
color:
|
31689
|
-
size:
|
31771
|
+
color: import_prop_types19.default.string,
|
31772
|
+
size: import_prop_types19.default.oneOfType([import_prop_types19.default.string, import_prop_types19.default.number])
|
31690
31773
|
};
|
31691
31774
|
Unlock.displayName = "Unlock";
|
31692
31775
|
var unlock_default = Unlock;
|
31693
31776
|
|
31694
31777
|
// lib/use-modifier-held.ts
|
31695
31778
|
init_react_import();
|
31696
|
-
var
|
31779
|
+
var import_react22 = require("react");
|
31697
31780
|
var useModifierHeld = (modifier) => {
|
31698
|
-
const [modifierHeld, setModifierHeld] = (0,
|
31699
|
-
(0,
|
31781
|
+
const [modifierHeld, setModifierHeld] = (0, import_react22.useState)(false);
|
31782
|
+
(0, import_react22.useEffect)(() => {
|
31700
31783
|
function downHandler({ key }) {
|
31701
31784
|
if (key === modifier) {
|
31702
31785
|
setModifierHeld(true);
|
@@ -31744,7 +31827,7 @@ var DraggableComponent = ({
|
|
31744
31827
|
style
|
31745
31828
|
}) => {
|
31746
31829
|
const isModifierHeld = useModifierHeld("Alt");
|
31747
|
-
(0,
|
31830
|
+
(0, import_react23.useEffect)(onMount, []);
|
31748
31831
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
31749
31832
|
import_dnd.Draggable,
|
31750
31833
|
{
|
@@ -31851,7 +31934,7 @@ var styles_module_default2 = { "DropZone": "_DropZone_1akqa_1", "DropZone-conten
|
|
31851
31934
|
|
31852
31935
|
// components/DropZone/context.tsx
|
31853
31936
|
init_react_import();
|
31854
|
-
var
|
31937
|
+
var import_react24 = require("react");
|
31855
31938
|
var import_use_debounce = require("use-debounce");
|
31856
31939
|
|
31857
31940
|
// lib/get-zone-id.ts
|
@@ -31868,29 +31951,29 @@ var getZoneId = (zoneCompound) => {
|
|
31868
31951
|
|
31869
31952
|
// components/DropZone/context.tsx
|
31870
31953
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
31871
|
-
var dropZoneContext = (0,
|
31954
|
+
var dropZoneContext = (0, import_react24.createContext)(null);
|
31872
31955
|
var DropZoneProvider = ({
|
31873
31956
|
children,
|
31874
31957
|
value
|
31875
31958
|
}) => {
|
31876
|
-
const [hoveringArea, setHoveringArea] = (0,
|
31877
|
-
const [hoveringZone, setHoveringZone] = (0,
|
31959
|
+
const [hoveringArea, setHoveringArea] = (0, import_react24.useState)(null);
|
31960
|
+
const [hoveringZone, setHoveringZone] = (0, import_react24.useState)(
|
31878
31961
|
rootDroppableId
|
31879
31962
|
);
|
31880
|
-
const [hoveringComponent, setHoveringComponent] = (0,
|
31963
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react24.useState)();
|
31881
31964
|
const [hoveringAreaDb] = (0, import_use_debounce.useDebounce)(hoveringArea, 75, { leading: false });
|
31882
|
-
const [areasWithZones, setAreasWithZones] = (0,
|
31965
|
+
const [areasWithZones, setAreasWithZones] = (0, import_react24.useState)(
|
31883
31966
|
{}
|
31884
31967
|
);
|
31885
|
-
const [activeZones, setActiveZones] = (0,
|
31968
|
+
const [activeZones, setActiveZones] = (0, import_react24.useState)({});
|
31886
31969
|
const { dispatch = null } = value ? value : {};
|
31887
|
-
const registerZoneArea = (0,
|
31970
|
+
const registerZoneArea = (0, import_react24.useCallback)(
|
31888
31971
|
(area) => {
|
31889
31972
|
setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
|
31890
31973
|
},
|
31891
31974
|
[setAreasWithZones]
|
31892
31975
|
);
|
31893
|
-
const registerZone = (0,
|
31976
|
+
const registerZone = (0, import_react24.useCallback)(
|
31894
31977
|
(zoneCompound) => {
|
31895
31978
|
if (!dispatch) {
|
31896
31979
|
return;
|
@@ -31903,7 +31986,7 @@ var DropZoneProvider = ({
|
|
31903
31986
|
},
|
31904
31987
|
[setActiveZones, dispatch]
|
31905
31988
|
);
|
31906
|
-
const unregisterZone = (0,
|
31989
|
+
const unregisterZone = (0, import_react24.useCallback)(
|
31907
31990
|
(zoneCompound) => {
|
31908
31991
|
if (!dispatch) {
|
31909
31992
|
return;
|
@@ -31918,8 +32001,8 @@ var DropZoneProvider = ({
|
|
31918
32001
|
},
|
31919
32002
|
[setActiveZones, dispatch]
|
31920
32003
|
);
|
31921
|
-
const [pathData, setPathData] = (0,
|
31922
|
-
const registerPath = (0,
|
32004
|
+
const [pathData, setPathData] = (0, import_react24.useState)();
|
32005
|
+
const registerPath = (0, import_react24.useCallback)(
|
31923
32006
|
(selector) => {
|
31924
32007
|
if (!(value == null ? void 0 : value.data)) {
|
31925
32008
|
return;
|
@@ -31969,7 +32052,7 @@ var DropZoneProvider = ({
|
|
31969
32052
|
|
31970
32053
|
// components/Puck/context.tsx
|
31971
32054
|
init_react_import();
|
31972
|
-
var
|
32055
|
+
var import_react25 = require("react");
|
31973
32056
|
var defaultAppState = {
|
31974
32057
|
data: { content: [], root: { title: "" } },
|
31975
32058
|
ui: {
|
@@ -31980,7 +32063,7 @@ var defaultAppState = {
|
|
31980
32063
|
componentList: {}
|
31981
32064
|
}
|
31982
32065
|
};
|
31983
|
-
var appContext = (0,
|
32066
|
+
var appContext = (0, import_react25.createContext)({
|
31984
32067
|
state: defaultAppState,
|
31985
32068
|
dispatch: () => null,
|
31986
32069
|
config: { components: {} },
|
@@ -31988,7 +32071,7 @@ var appContext = (0, import_react24.createContext)({
|
|
31988
32071
|
});
|
31989
32072
|
var AppProvider = appContext.Provider;
|
31990
32073
|
var useAppContext = () => {
|
31991
|
-
const mainContext = (0,
|
32074
|
+
const mainContext = (0, import_react25.useContext)(appContext);
|
31992
32075
|
const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
|
31993
32076
|
return __spreadProps(__spreadValues({}, mainContext), {
|
31994
32077
|
// Helpers
|
@@ -32006,10 +32089,10 @@ var useAppContext = () => {
|
|
32006
32089
|
// components/DropZone/index.tsx
|
32007
32090
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
32008
32091
|
var getClassName3 = get_class_name_factory_default("DropZone", styles_module_default2);
|
32009
|
-
function DropZoneEdit({ zone, style }) {
|
32092
|
+
function DropZoneEdit({ zone, allow, disallow, style }) {
|
32010
32093
|
var _a;
|
32011
32094
|
const appContext2 = useAppContext();
|
32012
|
-
const ctx = (0,
|
32095
|
+
const ctx = (0, import_react26.useContext)(dropZoneContext);
|
32013
32096
|
const {
|
32014
32097
|
// These all need setting via context
|
32015
32098
|
data,
|
@@ -32026,12 +32109,12 @@ function DropZoneEdit({ zone, style }) {
|
|
32026
32109
|
} = ctx || {};
|
32027
32110
|
let content = data.content || [];
|
32028
32111
|
let zoneCompound = rootDroppableId;
|
32029
|
-
(0,
|
32112
|
+
(0, import_react26.useEffect)(() => {
|
32030
32113
|
if (areaId && registerZoneArea) {
|
32031
32114
|
registerZoneArea(areaId);
|
32032
32115
|
}
|
32033
32116
|
}, [areaId]);
|
32034
|
-
(0,
|
32117
|
+
(0, import_react26.useEffect)(() => {
|
32035
32118
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
32036
32119
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
32037
32120
|
}
|
@@ -32052,7 +32135,7 @@ function DropZoneEdit({ zone, style }) {
|
|
32052
32135
|
const draggedDestinationId = draggedItem && ((_a = draggedItem.destination) == null ? void 0 : _a.droppableId);
|
32053
32136
|
const [zoneArea] = getZoneId(zoneCompound);
|
32054
32137
|
const [draggedSourceArea] = getZoneId(draggedSourceId);
|
32055
|
-
const [userWillDrag, setUserWillDrag] = (0,
|
32138
|
+
const [userWillDrag, setUserWillDrag] = (0, import_react26.useState)(false);
|
32056
32139
|
const userIsDragging = !!draggedItem;
|
32057
32140
|
const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
|
32058
32141
|
const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
|
@@ -32076,6 +32159,22 @@ function DropZoneEdit({ zone, style }) {
|
|
32076
32159
|
isEnabled = draggingOverArea && hoveringOverZone;
|
32077
32160
|
}
|
32078
32161
|
}
|
32162
|
+
if (isEnabled && userIsDragging && (allow || disallow)) {
|
32163
|
+
const [_, componentType] = draggedItem.draggableId.split("::");
|
32164
|
+
if (disallow) {
|
32165
|
+
const defaultedAllow = allow || [];
|
32166
|
+
const filteredDisallow = (disallow || []).filter(
|
32167
|
+
(item) => defaultedAllow.indexOf(item) === -1
|
32168
|
+
);
|
32169
|
+
if (filteredDisallow.indexOf(componentType) !== -1) {
|
32170
|
+
isEnabled = false;
|
32171
|
+
}
|
32172
|
+
} else if (allow) {
|
32173
|
+
if (allow.indexOf(componentType) === -1) {
|
32174
|
+
isEnabled = false;
|
32175
|
+
}
|
32176
|
+
}
|
32177
|
+
}
|
32079
32178
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
32080
32179
|
const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
|
32081
32180
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
@@ -32254,7 +32353,7 @@ function DropZoneEdit({ zone, style }) {
|
|
32254
32353
|
);
|
32255
32354
|
}
|
32256
32355
|
function DropZoneRender({ zone }) {
|
32257
|
-
const ctx = (0,
|
32356
|
+
const ctx = (0, import_react26.useContext)(dropZoneContext);
|
32258
32357
|
const { data, areaId = "root", config } = ctx || {};
|
32259
32358
|
let zoneCompound = rootDroppableId;
|
32260
32359
|
let content = (data == null ? void 0 : data.content) || [];
|
@@ -32286,7 +32385,7 @@ function DropZoneRender({ zone }) {
|
|
32286
32385
|
}) });
|
32287
32386
|
}
|
32288
32387
|
function DropZone(props) {
|
32289
|
-
const ctx = (0,
|
32388
|
+
const ctx = (0, import_react26.useContext)(dropZoneContext);
|
32290
32389
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
32291
32390
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DropZoneEdit, __spreadValues({}, props));
|
32292
32391
|
}
|
@@ -32298,7 +32397,7 @@ init_react_import();
|
|
32298
32397
|
|
32299
32398
|
// components/IconButton/IconButton.tsx
|
32300
32399
|
init_react_import();
|
32301
|
-
var
|
32400
|
+
var import_react27 = require("react");
|
32302
32401
|
|
32303
32402
|
// css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
|
32304
32403
|
init_react_import();
|
@@ -32320,7 +32419,7 @@ var IconButton = ({
|
|
32320
32419
|
fullWidth,
|
32321
32420
|
title
|
32322
32421
|
}) => {
|
32323
|
-
const [loading, setLoading] = (0,
|
32422
|
+
const [loading, setLoading] = (0, import_react27.useState)(false);
|
32324
32423
|
const ElementType = href ? "a" : "button";
|
32325
32424
|
const el = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
32326
32425
|
ElementType,
|
@@ -32361,7 +32460,7 @@ var IconButton = ({
|
|
32361
32460
|
|
32362
32461
|
// components/Puck/index.tsx
|
32363
32462
|
init_react_import();
|
32364
|
-
var
|
32463
|
+
var import_react40 = require("react");
|
32365
32464
|
var import_dnd7 = require("@hello-pangea/dnd");
|
32366
32465
|
|
32367
32466
|
// components/InputOrGroup/index.tsx
|
@@ -32372,7 +32471,7 @@ init_react_import();
|
|
32372
32471
|
var styles_module_default3 = { "Input": "_Input_1jyrm_1", "Input-label": "_Input-label_1jyrm_27", "Input-labelIcon": "_Input-labelIcon_1jyrm_35", "Input-disabledIcon": "_Input-disabledIcon_1jyrm_41", "Input-input": "_Input-input_1jyrm_46", "Input--readOnly": "_Input--readOnly_1jyrm_69", "Input-radioGroupItems": "_Input-radioGroupItems_1jyrm_87", "Input-radio": "_Input-radio_1jyrm_87", "Input-radioInner": "_Input-radioInner_1jyrm_104", "Input-radioInput": "_Input-radioInput_1jyrm_126" };
|
32373
32472
|
|
32374
32473
|
// components/InputOrGroup/index.tsx
|
32375
|
-
var
|
32474
|
+
var import_react32 = require("react");
|
32376
32475
|
|
32377
32476
|
// components/InputOrGroup/fields/index.tsx
|
32378
32477
|
init_react_import();
|
@@ -32437,7 +32536,7 @@ var Draggable2 = ({
|
|
32437
32536
|
};
|
32438
32537
|
|
32439
32538
|
// components/InputOrGroup/fields/ArrayField/index.tsx
|
32440
|
-
var
|
32539
|
+
var import_react28 = require("react");
|
32441
32540
|
|
32442
32541
|
// components/DragIcon/index.tsx
|
32443
32542
|
init_react_import();
|
@@ -32470,17 +32569,16 @@ var ArrayField = ({
|
|
32470
32569
|
items: Array.from(value || []).map((item, idx) => {
|
32471
32570
|
return {
|
32472
32571
|
_originalIndex: idx,
|
32473
|
-
_arrayId: `${id}-${idx}
|
32474
|
-
data: item
|
32572
|
+
_arrayId: `${id}-${idx}`
|
32475
32573
|
};
|
32476
32574
|
}),
|
32477
32575
|
openId: ""
|
32478
32576
|
};
|
32479
|
-
const [localState, setLocalState] = (0,
|
32480
|
-
(0,
|
32577
|
+
const [localState, setLocalState] = (0, import_react28.useState)({ arrayState, value });
|
32578
|
+
(0, import_react28.useEffect)(() => {
|
32481
32579
|
setLocalState({ arrayState, value });
|
32482
32580
|
}, [value, state.ui.arrayState[id]]);
|
32483
|
-
const mapArrayStateToUi = (0,
|
32581
|
+
const mapArrayStateToUi = (0, import_react28.useCallback)(
|
32484
32582
|
(partialArrayState) => {
|
32485
32583
|
return {
|
32486
32584
|
arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
|
@@ -32490,31 +32588,35 @@ var ArrayField = ({
|
|
32490
32588
|
},
|
32491
32589
|
[arrayState]
|
32492
32590
|
);
|
32493
|
-
const getHighestIndex = (0,
|
32591
|
+
const getHighestIndex = (0, import_react28.useCallback)(() => {
|
32494
32592
|
return arrayState.items.reduce(
|
32495
32593
|
(acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
|
32496
32594
|
-1
|
32497
32595
|
);
|
32498
32596
|
}, [arrayState]);
|
32499
|
-
const regenerateArrayState = (0,
|
32597
|
+
const regenerateArrayState = (0, import_react28.useCallback)(
|
32500
32598
|
(value2) => {
|
32501
32599
|
let highestIndex = getHighestIndex();
|
32502
32600
|
const newItems = Array.from(value2 || []).map((item, idx) => {
|
32503
32601
|
var _a;
|
32504
32602
|
const arrayStateItem = arrayState.items[idx];
|
32505
|
-
|
32506
|
-
_originalIndex: typeof (arrayStateItem == null ? void 0 : arrayStateItem._originalIndex) !== "undefined" ? arrayStateItem._originalIndex :
|
32507
|
-
_arrayId: ((_a = arrayState.items[idx]) == null ? void 0 : _a._arrayId) || `${id}-${highestIndex}
|
32508
|
-
data: item
|
32603
|
+
const newItem = {
|
32604
|
+
_originalIndex: typeof (arrayStateItem == null ? void 0 : arrayStateItem._originalIndex) !== "undefined" ? arrayStateItem._originalIndex : highestIndex + 1,
|
32605
|
+
_arrayId: ((_a = arrayState.items[idx]) == null ? void 0 : _a._arrayId) || `${id}-${highestIndex + 1}`
|
32509
32606
|
};
|
32607
|
+
if (newItem._originalIndex > highestIndex) {
|
32608
|
+
highestIndex = newItem._originalIndex;
|
32609
|
+
}
|
32610
|
+
return newItem;
|
32510
32611
|
});
|
32511
32612
|
return __spreadProps(__spreadValues({}, arrayState), { items: newItems });
|
32512
32613
|
},
|
32513
32614
|
[arrayState]
|
32514
32615
|
);
|
32515
|
-
(0,
|
32616
|
+
(0, import_react28.useEffect)(() => {
|
32516
32617
|
setUi(mapArrayStateToUi(arrayState));
|
32517
32618
|
}, []);
|
32619
|
+
const [hovering, setHovering] = (0, import_react28.useState)(false);
|
32518
32620
|
if (field.type !== "array" || !field.arrayFields) {
|
32519
32621
|
return null;
|
32520
32622
|
}
|
@@ -32561,6 +32663,14 @@ var ArrayField = ({
|
|
32561
32663
|
isDraggingFrom: !!snapshot.draggingFromThisWith,
|
32562
32664
|
hasItems: Array.isArray(value) && value.length > 0
|
32563
32665
|
}),
|
32666
|
+
onMouseOver: (e) => {
|
32667
|
+
e.stopPropagation();
|
32668
|
+
setHovering(true);
|
32669
|
+
},
|
32670
|
+
onMouseOut: (e) => {
|
32671
|
+
e.stopPropagation();
|
32672
|
+
setHovering(false);
|
32673
|
+
},
|
32564
32674
|
children: [
|
32565
32675
|
localState.arrayState.items.map((item, i) => {
|
32566
32676
|
const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
|
@@ -32575,7 +32685,7 @@ var ArrayField = ({
|
|
32575
32685
|
isDragging: snapshot2 == null ? void 0 : snapshot2.isDragging,
|
32576
32686
|
readOnly
|
32577
32687
|
}),
|
32578
|
-
isDragDisabled: readOnly,
|
32688
|
+
isDragDisabled: readOnly || !hovering,
|
32579
32689
|
children: () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
32580
32690
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
32581
32691
|
"div",
|
@@ -32638,16 +32748,17 @@ var ArrayField = ({
|
|
32638
32748
|
{
|
32639
32749
|
name: subFieldName,
|
32640
32750
|
label: subField.label || fieldName,
|
32641
|
-
id: `${
|
32751
|
+
id: `${_arrayId}_${fieldName}`,
|
32642
32752
|
readOnly: typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName],
|
32643
32753
|
readOnlyFields,
|
32644
32754
|
field: subField,
|
32645
32755
|
value: data[fieldName],
|
32646
|
-
onChange: (val) => {
|
32756
|
+
onChange: (val, ui) => {
|
32647
32757
|
onChange(
|
32648
32758
|
replace(value, i, __spreadProps(__spreadValues({}, data), {
|
32649
32759
|
[fieldName]: val
|
32650
|
-
}))
|
32760
|
+
})),
|
32761
|
+
ui
|
32651
32762
|
);
|
32652
32763
|
}
|
32653
32764
|
},
|
@@ -32734,19 +32845,19 @@ var DefaultField = ({
|
|
32734
32845
|
|
32735
32846
|
// components/InputOrGroup/fields/ExternalField/index.tsx
|
32736
32847
|
init_react_import();
|
32737
|
-
var
|
32848
|
+
var import_react31 = require("react");
|
32738
32849
|
|
32739
32850
|
// components/ExternalInput/index.tsx
|
32740
32851
|
init_react_import();
|
32741
|
-
var
|
32852
|
+
var import_react30 = require("react");
|
32742
32853
|
|
32743
32854
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
32744
32855
|
init_react_import();
|
32745
|
-
var styles_module_default6 = { "ExternalInput": "
|
32856
|
+
var styles_module_default6 = { "ExternalInput": "_ExternalInput_s6fxy_1", "ExternalInput-actions": "_ExternalInput-actions_s6fxy_5", "ExternalInput-button": "_ExternalInput-button_s6fxy_9", "ExternalInput-detachButton": "_ExternalInput-detachButton_s6fxy_28", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_s6fxy_35", "ExternalInputModal": "_ExternalInputModal_s6fxy_56", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_s6fxy_64", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_s6fxy_72", "ExternalInputModal-table": "_ExternalInputModal-table_s6fxy_72", "ExternalInputModal-thead": "_ExternalInputModal-thead_s6fxy_88", "ExternalInputModal-th": "_ExternalInputModal-th_s6fxy_88", "ExternalInputModal-td": "_ExternalInputModal-td_s6fxy_102", "ExternalInputModal-tr": "_ExternalInputModal-tr_s6fxy_107", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_s6fxy_119", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_s6fxy_138", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_s6fxy_142", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_s6fxy_155", "ExternalInputModal-noContentBanner": "_ExternalInputModal-noContentBanner_s6fxy_159", "ExternalInputModal--loaded": "_ExternalInputModal--loaded_s6fxy_166", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_s6fxy_171", "ExternalInputModal-search": "_ExternalInputModal-search_s6fxy_171", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_s6fxy_194", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_s6fxy_206", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_s6fxy_216" };
|
32746
32857
|
|
32747
32858
|
// components/Modal/index.tsx
|
32748
32859
|
init_react_import();
|
32749
|
-
var
|
32860
|
+
var import_react29 = require("react");
|
32750
32861
|
|
32751
32862
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
|
32752
32863
|
init_react_import();
|
@@ -32761,8 +32872,8 @@ var Modal = ({
|
|
32761
32872
|
onClose,
|
32762
32873
|
isOpen
|
32763
32874
|
}) => {
|
32764
|
-
const [rootEl, setRootEl] = (0,
|
32765
|
-
(0,
|
32875
|
+
const [rootEl, setRootEl] = (0, import_react29.useState)(null);
|
32876
|
+
(0, import_react29.useEffect)(() => {
|
32766
32877
|
setRootEl(document.getElementById("puck-portal-root"));
|
32767
32878
|
}, []);
|
32768
32879
|
if (!rootEl) {
|
@@ -32818,10 +32929,10 @@ var ExternalInput = ({
|
|
32818
32929
|
id
|
32819
32930
|
}) => {
|
32820
32931
|
const { mapProp = (val) => val } = field || {};
|
32821
|
-
const [data, setData] = (0,
|
32822
|
-
const [isOpen, setOpen] = (0,
|
32823
|
-
const [isLoading, setIsLoading] = (0,
|
32824
|
-
const keys = (0,
|
32932
|
+
const [data, setData] = (0, import_react30.useState)([]);
|
32933
|
+
const [isOpen, setOpen] = (0, import_react30.useState)(false);
|
32934
|
+
const [isLoading, setIsLoading] = (0, import_react30.useState)(true);
|
32935
|
+
const keys = (0, import_react30.useMemo)(() => {
|
32825
32936
|
const validKeys = /* @__PURE__ */ new Set();
|
32826
32937
|
for (const item of data) {
|
32827
32938
|
for (const key of Object.keys(item)) {
|
@@ -32832,15 +32943,22 @@ var ExternalInput = ({
|
|
32832
32943
|
}
|
32833
32944
|
return Array.from(validKeys);
|
32834
32945
|
}, [data]);
|
32835
|
-
(0,
|
32836
|
-
|
32837
|
-
|
32946
|
+
const [searchQuery, setSearchQuery] = (0, import_react30.useState)(field.initialQuery || "");
|
32947
|
+
const search = (0, import_react30.useCallback)(
|
32948
|
+
(query) => __async(void 0, null, function* () {
|
32949
|
+
setIsLoading(true);
|
32950
|
+
const cacheKey = `${id}-${name}-${query}`;
|
32951
|
+
const listData = dataCache[cacheKey] || (yield field.fetchList({ query }));
|
32838
32952
|
if (listData) {
|
32839
32953
|
setData(listData);
|
32840
32954
|
setIsLoading(false);
|
32841
|
-
dataCache[
|
32955
|
+
dataCache[cacheKey] = listData;
|
32842
32956
|
}
|
32843
|
-
})
|
32957
|
+
}),
|
32958
|
+
[name, field]
|
32959
|
+
);
|
32960
|
+
(0, import_react30.useEffect)(() => {
|
32961
|
+
search(searchQuery);
|
32844
32962
|
}, []);
|
32845
32963
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
32846
32964
|
"div",
|
@@ -32880,38 +32998,73 @@ var ExternalInput = ({
|
|
32880
32998
|
className: getClassNameModal({
|
32881
32999
|
isLoading,
|
32882
33000
|
loaded: !isLoading,
|
32883
|
-
hasData:
|
33001
|
+
hasData: data.length > 0
|
32884
33002
|
}),
|
32885
33003
|
children: [
|
32886
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.
|
32887
|
-
|
32888
|
-
|
32889
|
-
"
|
33004
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameModal("masthead"), children: [
|
33005
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Heading, { rank: 2, size: "xxl", children: "Select content" }),
|
33006
|
+
field.showSearch && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
33007
|
+
"form",
|
32890
33008
|
{
|
32891
|
-
className: getClassNameModal("
|
32892
|
-
|
32893
|
-
|
32894
|
-
|
32895
|
-
|
32896
|
-
|
32897
|
-
|
32898
|
-
|
32899
|
-
|
33009
|
+
className: getClassNameModal("searchForm"),
|
33010
|
+
onSubmit: (e) => {
|
33011
|
+
e.preventDefault();
|
33012
|
+
search(searchQuery);
|
33013
|
+
},
|
33014
|
+
children: [
|
33015
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: getClassNameModal("search"), children: [
|
33016
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
|
33017
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(search_default, { size: "18" }) }),
|
33018
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
33019
|
+
"input",
|
33020
|
+
{
|
33021
|
+
className: getClassNameModal("searchInput"),
|
33022
|
+
name: "q",
|
33023
|
+
type: "search",
|
33024
|
+
placeholder: "Search",
|
33025
|
+
onChange: (e) => {
|
33026
|
+
setSearchQuery(e.currentTarget.value);
|
33027
|
+
},
|
33028
|
+
autoComplete: "off",
|
33029
|
+
value: searchQuery
|
33030
|
+
}
|
33031
|
+
)
|
33032
|
+
] }),
|
33033
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button, { type: "submit", loading: isLoading, disabled: isLoading, children: "Search" })
|
33034
|
+
]
|
33035
|
+
}
|
33036
|
+
)
|
33037
|
+
] }),
|
33038
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
|
33039
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("table", { className: getClassNameModal("table"), children: [
|
33040
|
+
/* @__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)(
|
33041
|
+
"th",
|
32900
33042
|
{
|
32901
|
-
|
32902
|
-
|
32903
|
-
|
32904
|
-
onChange(mapProp(item));
|
32905
|
-
setOpen(false);
|
32906
|
-
},
|
32907
|
-
children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
33043
|
+
className: getClassNameModal("th"),
|
33044
|
+
style: { textAlign: "left" },
|
33045
|
+
children: key
|
32908
33046
|
},
|
32909
|
-
|
32910
|
-
)
|
32911
|
-
|
32912
|
-
|
32913
|
-
|
32914
|
-
|
33047
|
+
key
|
33048
|
+
)) }) }),
|
33049
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tbody", { className: getClassNameModal("tbody"), children: data.map((item, i) => {
|
33050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
33051
|
+
"tr",
|
33052
|
+
{
|
33053
|
+
style: { whiteSpace: "nowrap" },
|
33054
|
+
className: getClassNameModal("tr"),
|
33055
|
+
onClick: (e) => {
|
33056
|
+
onChange(mapProp(item));
|
33057
|
+
setOpen(false);
|
33058
|
+
},
|
33059
|
+
children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
33060
|
+
},
|
33061
|
+
i
|
33062
|
+
);
|
33063
|
+
}) })
|
33064
|
+
] }),
|
33065
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_spinners4.ClipLoader, { size: 24, "aria-label": "Loading" }) })
|
33066
|
+
] }),
|
33067
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("noContentBanner"), children: "No results." })
|
32915
33068
|
]
|
32916
33069
|
}
|
32917
33070
|
) })
|
@@ -32933,7 +33086,7 @@ var ExternalField = ({
|
|
32933
33086
|
var _a, _b, _c;
|
32934
33087
|
const validField = field;
|
32935
33088
|
const deprecatedField = field;
|
32936
|
-
(0,
|
33089
|
+
(0, import_react31.useEffect)(() => {
|
32937
33090
|
if (deprecatedField.adaptor) {
|
32938
33091
|
console.error(
|
32939
33092
|
"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."
|
@@ -33155,7 +33308,7 @@ var FieldLabelInternal = ({
|
|
33155
33308
|
var InputOrGroup = (_a) => {
|
33156
33309
|
var _b = _a, { onChange } = _b, props = __objRest(_b, ["onChange"]);
|
33157
33310
|
const { name, field, value, readOnly } = props;
|
33158
|
-
const [localValue, setLocalValue] = (0,
|
33311
|
+
const [localValue, setLocalValue] = (0, import_react32.useState)(value);
|
33159
33312
|
const onChangeDb = (0, import_use_debounce2.useDebouncedCallback)(
|
33160
33313
|
(val, ui) => {
|
33161
33314
|
onChange(val, ui);
|
@@ -33163,11 +33316,11 @@ var InputOrGroup = (_a) => {
|
|
33163
33316
|
50,
|
33164
33317
|
{ leading: true }
|
33165
33318
|
);
|
33166
|
-
const onChangeLocal = (0,
|
33319
|
+
const onChangeLocal = (0, import_react32.useCallback)((val, ui) => {
|
33167
33320
|
setLocalValue(val);
|
33168
33321
|
onChangeDb(val, ui);
|
33169
33322
|
}, []);
|
33170
|
-
(0,
|
33323
|
+
(0, import_react32.useEffect)(() => {
|
33171
33324
|
setLocalValue(value);
|
33172
33325
|
}, [value]);
|
33173
33326
|
const localProps = {
|
@@ -33297,10 +33450,10 @@ ComponentList.Item = ComponentListItem;
|
|
33297
33450
|
|
33298
33451
|
// lib/use-placeholder-style.ts
|
33299
33452
|
init_react_import();
|
33300
|
-
var
|
33453
|
+
var import_react33 = require("react");
|
33301
33454
|
var usePlaceholderStyle = () => {
|
33302
33455
|
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
33303
|
-
const [placeholderStyle, setPlaceholderStyle] = (0,
|
33456
|
+
const [placeholderStyle, setPlaceholderStyle] = (0, import_react33.useState)();
|
33304
33457
|
const onDragStartOrUpdate = (draggedItem) => {
|
33305
33458
|
var _a;
|
33306
33459
|
const draggableId = draggedItem.draggableId;
|
@@ -33352,7 +33505,7 @@ var styles_module_default10 = { "SidebarSection": "_SidebarSection_1uyg2_1", "Si
|
|
33352
33505
|
|
33353
33506
|
// lib/use-breadcrumbs.ts
|
33354
33507
|
init_react_import();
|
33355
|
-
var
|
33508
|
+
var import_react34 = require("react");
|
33356
33509
|
var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
|
33357
33510
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
33358
33511
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -33402,8 +33555,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
33402
33555
|
state: { data },
|
33403
33556
|
selectedItem
|
33404
33557
|
} = useAppContext();
|
33405
|
-
const dzContext = (0,
|
33406
|
-
return (0,
|
33558
|
+
const dzContext = (0, import_react34.useContext)(dropZoneContext);
|
33559
|
+
return (0, import_react34.useMemo)(() => {
|
33407
33560
|
const breadcrumbs = convertPathDataToBreadcrumbs(
|
33408
33561
|
selectedItem,
|
33409
33562
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -33455,11 +33608,11 @@ init_react_import();
|
|
33455
33608
|
|
33456
33609
|
// lib/use-puck-history.ts
|
33457
33610
|
init_react_import();
|
33458
|
-
var
|
33611
|
+
var import_react36 = require("react");
|
33459
33612
|
|
33460
33613
|
// lib/use-action-history.ts
|
33461
33614
|
init_react_import();
|
33462
|
-
var
|
33615
|
+
var import_react35 = require("react");
|
33463
33616
|
|
33464
33617
|
// lib/generate-id.ts
|
33465
33618
|
init_react_import();
|
@@ -33469,8 +33622,8 @@ var generateId = (type) => `${type}-${(0, import_crypto.randomBytes)(20).toStrin
|
|
33469
33622
|
// lib/use-action-history.ts
|
33470
33623
|
var EMPTY_HISTORY_INDEX = -1;
|
33471
33624
|
function useActionHistory() {
|
33472
|
-
const [histories, setHistories] = (0,
|
33473
|
-
const [currentHistoryIndex, setCurrentHistoryIndex] = (0,
|
33625
|
+
const [histories, setHistories] = (0, import_react35.useState)([]);
|
33626
|
+
const [currentHistoryIndex, setCurrentHistoryIndex] = (0, import_react35.useState)(EMPTY_HISTORY_INDEX);
|
33474
33627
|
const currentHistory = histories[currentHistoryIndex];
|
33475
33628
|
const canRewind = currentHistoryIndex > EMPTY_HISTORY_INDEX;
|
33476
33629
|
const canForward = currentHistoryIndex < histories.length - 1;
|
@@ -33549,7 +33702,7 @@ function usePuckHistory({
|
|
33549
33702
|
dispatch
|
33550
33703
|
});
|
33551
33704
|
}, DEBOUNCE_TIME);
|
33552
|
-
(0,
|
33705
|
+
(0, import_react36.useEffect)(() => {
|
33553
33706
|
historyEmitter.on(RECORD_DIFF, handleRecordDiff);
|
33554
33707
|
return () => {
|
33555
33708
|
historyEmitter.off(RECORD_DIFF, handleRecordDiff);
|
@@ -33911,7 +34064,7 @@ var scrollIntoView = (el) => {
|
|
33911
34064
|
};
|
33912
34065
|
|
33913
34066
|
// components/LayerTree/index.tsx
|
33914
|
-
var
|
34067
|
+
var import_react37 = require("react");
|
33915
34068
|
|
33916
34069
|
// lib/find-zones-for-area.ts
|
33917
34070
|
init_react_import();
|
@@ -33949,7 +34102,7 @@ var LayerTree = ({
|
|
33949
34102
|
label
|
33950
34103
|
}) => {
|
33951
34104
|
const zones = data.zones || {};
|
33952
|
-
const ctx = (0,
|
34105
|
+
const ctx = (0, import_react37.useContext)(dropZoneContext);
|
33953
34106
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
33954
34107
|
label && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassName17("zoneTitle"), children: [
|
33955
34108
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(layers_default, { size: "16" }) }),
|
@@ -34074,11 +34227,11 @@ var flushZones = (appState) => {
|
|
34074
34227
|
|
34075
34228
|
// lib/use-component-list.tsx
|
34076
34229
|
init_react_import();
|
34077
|
-
var
|
34230
|
+
var import_react38 = require("react");
|
34078
34231
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
34079
34232
|
var useComponentList = (config, ui) => {
|
34080
|
-
const [componentList, setComponentList] = (0,
|
34081
|
-
(0,
|
34233
|
+
const [componentList, setComponentList] = (0, import_react38.useState)();
|
34234
|
+
(0, import_react38.useEffect)(() => {
|
34082
34235
|
var _a, _b, _c;
|
34083
34236
|
if (Object.keys(ui.componentList).length > 0) {
|
34084
34237
|
const matchedComponents = [];
|
@@ -34144,7 +34297,7 @@ var useComponentList = (config, ui) => {
|
|
34144
34297
|
|
34145
34298
|
// lib/use-resolved-data.ts
|
34146
34299
|
init_react_import();
|
34147
|
-
var
|
34300
|
+
var import_react39 = require("react");
|
34148
34301
|
|
34149
34302
|
// lib/resolve-component-data.ts
|
34150
34303
|
init_react_import();
|
@@ -34259,13 +34412,13 @@ var resolveRootData = (data, config) => __async(void 0, null, function* () {
|
|
34259
34412
|
|
34260
34413
|
// lib/use-resolved-data.ts
|
34261
34414
|
var useResolvedData = (appState, config, dispatch) => {
|
34262
|
-
const [{ resolverKey, newAppState }, setResolverState] = (0,
|
34415
|
+
const [{ resolverKey, newAppState }, setResolverState] = (0, import_react39.useState)({
|
34263
34416
|
resolverKey: 0,
|
34264
34417
|
newAppState: appState
|
34265
34418
|
});
|
34266
|
-
const [componentState, setComponentState] = (0,
|
34419
|
+
const [componentState, setComponentState] = (0, import_react39.useState)({});
|
34267
34420
|
const deferredSetStates = {};
|
34268
|
-
const setComponentLoading = (0,
|
34421
|
+
const setComponentLoading = (0, import_react39.useCallback)(
|
34269
34422
|
(id, loading, defer = 0) => {
|
34270
34423
|
if (deferredSetStates[id]) {
|
34271
34424
|
clearTimeout(deferredSetStates[id]);
|
@@ -34332,10 +34485,10 @@ var useResolvedData = (appState, config, dispatch) => {
|
|
34332
34485
|
});
|
34333
34486
|
yield Promise.all(promises);
|
34334
34487
|
});
|
34335
|
-
(0,
|
34488
|
+
(0, import_react39.useEffect)(() => {
|
34336
34489
|
runResolvers();
|
34337
34490
|
}, [resolverKey]);
|
34338
|
-
const resolveData = (0,
|
34491
|
+
const resolveData = (0, import_react39.useCallback)((newAppState2 = appState) => {
|
34339
34492
|
setResolverState((curr) => ({
|
34340
34493
|
resolverKey: curr.resolverKey + 1,
|
34341
34494
|
newAppState: newAppState2
|
@@ -34455,8 +34608,8 @@ function Puck({
|
|
34455
34608
|
headerPath
|
34456
34609
|
}) {
|
34457
34610
|
var _a, _b;
|
34458
|
-
const [reducer] = (0,
|
34459
|
-
const [initialAppState] = (0,
|
34611
|
+
const [reducer] = (0, import_react40.useState)(() => createReducer({ config }));
|
34612
|
+
const [initialAppState] = (0, import_react40.useState)(__spreadProps(__spreadValues({}, defaultAppState), {
|
34460
34613
|
data: initialData,
|
34461
34614
|
ui: __spreadProps(__spreadValues({}, defaultAppState.ui), {
|
34462
34615
|
// Store categories under componentList on state to allow render functions and plugins to modify
|
@@ -34475,7 +34628,7 @@ function Puck({
|
|
34475
34628
|
) : {}
|
34476
34629
|
})
|
34477
34630
|
}));
|
34478
|
-
const [appState, dispatch] = (0,
|
34631
|
+
const [appState, dispatch] = (0, import_react40.useReducer)(
|
34479
34632
|
reducer,
|
34480
34633
|
flushZones(initialAppState)
|
34481
34634
|
);
|
@@ -34485,9 +34638,9 @@ function Puck({
|
|
34485
34638
|
config,
|
34486
34639
|
dispatch
|
34487
34640
|
);
|
34488
|
-
const [menuOpen, setMenuOpen] = (0,
|
34641
|
+
const [menuOpen, setMenuOpen] = (0, import_react40.useState)(false);
|
34489
34642
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
34490
|
-
const setItemSelector = (0,
|
34643
|
+
const setItemSelector = (0, import_react40.useCallback)(
|
34491
34644
|
(newItemSelector) => {
|
34492
34645
|
dispatch({
|
34493
34646
|
type: "setUi",
|
@@ -34497,7 +34650,7 @@ function Puck({
|
|
34497
34650
|
[]
|
34498
34651
|
);
|
34499
34652
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
34500
|
-
const Page = (0,
|
34653
|
+
const Page = (0, import_react40.useCallback)(
|
34501
34654
|
(pageProps) => {
|
34502
34655
|
var _a2, _b2;
|
34503
34656
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
@@ -34513,7 +34666,7 @@ function Puck({
|
|
34513
34666
|
},
|
34514
34667
|
[config.root]
|
34515
34668
|
);
|
34516
|
-
const PageFieldWrapper = (0,
|
34669
|
+
const PageFieldWrapper = (0, import_react40.useCallback)(
|
34517
34670
|
(props) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34518
34671
|
PluginRenderer,
|
34519
34672
|
{
|
@@ -34526,7 +34679,7 @@ function Puck({
|
|
34526
34679
|
),
|
34527
34680
|
[]
|
34528
34681
|
);
|
34529
|
-
const ComponentFieldWrapper = (0,
|
34682
|
+
const ComponentFieldWrapper = (0, import_react40.useCallback)(
|
34530
34683
|
(props) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34531
34684
|
PluginRenderer,
|
34532
34685
|
{
|
@@ -34539,7 +34692,7 @@ function Puck({
|
|
34539
34692
|
),
|
34540
34693
|
[]
|
34541
34694
|
);
|
34542
|
-
const ComponentListWrapper = (0,
|
34695
|
+
const ComponentListWrapper = (0, import_react40.useCallback)((props) => {
|
34543
34696
|
const children = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34544
34697
|
PluginRenderer,
|
34545
34698
|
{
|
@@ -34559,22 +34712,22 @@ function Puck({
|
|
34559
34712
|
const FieldWrapper = itemSelector ? ComponentFieldWrapper : PageFieldWrapper;
|
34560
34713
|
const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
|
34561
34714
|
let fields = selectedItem ? ((_b = config.components[selectedItem.type]) == null ? void 0 : _b.fields) || {} : rootFields;
|
34562
|
-
(0,
|
34715
|
+
(0, import_react40.useEffect)(() => {
|
34563
34716
|
if (onChange)
|
34564
34717
|
onChange(data);
|
34565
34718
|
}, [data]);
|
34566
34719
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
34567
|
-
const [draggedItem, setDraggedItem] = (0,
|
34720
|
+
const [draggedItem, setDraggedItem] = (0, import_react40.useState)();
|
34568
34721
|
const componentList = useComponentList(config, appState.ui);
|
34569
34722
|
const rootProps = data.root.props || data.root;
|
34570
|
-
(0,
|
34723
|
+
(0, import_react40.useEffect)(() => {
|
34571
34724
|
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
34572
34725
|
console.error(
|
34573
34726
|
"Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
|
34574
34727
|
);
|
34575
34728
|
}
|
34576
34729
|
}, []);
|
34577
|
-
const toggleSidebars = (0,
|
34730
|
+
const toggleSidebars = (0, import_react40.useCallback)(
|
34578
34731
|
(sidebar) => {
|
34579
34732
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
34580
34733
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -34588,7 +34741,7 @@ function Puck({
|
|
34588
34741
|
},
|
34589
34742
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
34590
34743
|
);
|
34591
|
-
(0,
|
34744
|
+
(0, import_react40.useEffect)(() => {
|
34592
34745
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
34593
34746
|
dispatch({
|
34594
34747
|
type: "setUi",
|
@@ -34633,10 +34786,10 @@ function Puck({
|
|
34633
34786
|
return;
|
34634
34787
|
}
|
34635
34788
|
if (droppedItem.source.droppableId.startsWith("component-list") && droppedItem.destination) {
|
34636
|
-
const [_,
|
34789
|
+
const [_, componentType] = droppedItem.draggableId.split("::");
|
34637
34790
|
dispatch({
|
34638
34791
|
type: "insert",
|
34639
|
-
componentType:
|
34792
|
+
componentType: componentType || droppedItem.draggableId,
|
34640
34793
|
destinationIndex: droppedItem.destination.index,
|
34641
34794
|
destinationZone: droppedItem.destination.droppableId
|
34642
34795
|
});
|
@@ -34951,7 +35104,10 @@ function Puck({
|
|
34951
35104
|
// components/Render/index.tsx
|
34952
35105
|
init_react_import();
|
34953
35106
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
34954
|
-
function Render({
|
35107
|
+
function Render({
|
35108
|
+
config,
|
35109
|
+
data
|
35110
|
+
}) {
|
34955
35111
|
var _a;
|
34956
35112
|
const rootProps = data.root.props || data.root;
|
34957
35113
|
const title = rootProps.title || "";
|