@measured/puck 0.13.0-canary.28f24f9 → 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-ff244704.d.ts → Config-162394d8.d.ts} +5 -1
- package/dist/index.css +93 -27
- package/dist/index.d.ts +4 -3
- package/dist/index.js +297 -172
- package/dist/rsc.d.ts +1 -1
- package/package.json +1 -1
@@ -65,9 +65,13 @@ type ExternalField<Props extends {
|
|
65
65
|
}> = BaseField & {
|
66
66
|
type: "external";
|
67
67
|
placeholder?: string;
|
68
|
-
fetchList: (
|
68
|
+
fetchList: (params: {
|
69
|
+
query: string;
|
70
|
+
}) => Promise<any[] | null>;
|
69
71
|
mapProp?: (value: any) => Props;
|
70
72
|
getItemSummary: (item: Props, index?: number) => string;
|
73
|
+
showSearch?: boolean;
|
74
|
+
initialQuery?: string;
|
71
75
|
};
|
72
76
|
type CustomField<Props extends {
|
73
77
|
[key: string]: any;
|
package/dist/index.css
CHANGED
@@ -656,13 +656,13 @@
|
|
656
656
|
}
|
657
657
|
|
658
658
|
/* css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css/#css-module-data */
|
659
|
-
.
|
659
|
+
._ExternalInput_s6fxy_1 {
|
660
660
|
font-family: var(--puck-font-stack);
|
661
661
|
}
|
662
|
-
._ExternalInput-
|
662
|
+
._ExternalInput-actions_s6fxy_5 {
|
663
663
|
display: flex;
|
664
664
|
}
|
665
|
-
._ExternalInput-
|
665
|
+
._ExternalInput-button_s6fxy_9 {
|
666
666
|
display: flex;
|
667
667
|
gap: 8px;
|
668
668
|
align-items: center;
|
@@ -679,20 +679,20 @@
|
|
679
679
|
overflow: hidden;
|
680
680
|
flex-grow: 1;
|
681
681
|
}
|
682
|
-
._ExternalInput-
|
683
|
-
._ExternalInput-
|
682
|
+
._ExternalInput-button_s6fxy_9:hover,
|
683
|
+
._ExternalInput-detachButton_s6fxy_28:hover {
|
684
684
|
cursor: pointer;
|
685
685
|
background: var(--puck-color-azure-9);
|
686
686
|
color: var(--puck-color-azure-4);
|
687
687
|
z-index: 1;
|
688
688
|
}
|
689
|
-
._ExternalInput--
|
689
|
+
._ExternalInput--dataSelected_s6fxy_35 ._ExternalInput-button_s6fxy_9 {
|
690
690
|
color: var(--puck-color-grey-2);
|
691
691
|
display: block;
|
692
692
|
border-top-right-radius: 0px;
|
693
693
|
border-bottom-right-radius: 0px;
|
694
694
|
}
|
695
|
-
._ExternalInput-
|
695
|
+
._ExternalInput-detachButton_s6fxy_28 {
|
696
696
|
border: 1px solid var(--puck-color-grey-8);
|
697
697
|
border-top-right-radius: 4px;
|
698
698
|
border-bottom-right-radius: 4px;
|
@@ -705,22 +705,27 @@
|
|
705
705
|
padding: 8px 12px;
|
706
706
|
margin-left: -1px;
|
707
707
|
}
|
708
|
-
.
|
708
|
+
._ExternalInputModal_s6fxy_56 {
|
709
|
+
color: black;
|
709
710
|
display: flex;
|
710
711
|
flex-direction: column;
|
711
712
|
position: relative;
|
712
713
|
max-height: 90vh;
|
713
714
|
}
|
714
|
-
._ExternalInputModal-
|
715
|
+
._ExternalInputModal-masthead_s6fxy_64 {
|
715
716
|
background-color: white;
|
717
|
+
display: flex;
|
718
|
+
flex-wrap: wrap;
|
719
|
+
gap: 24px;
|
716
720
|
padding: 32px 24px;
|
717
721
|
}
|
718
|
-
._ExternalInputModal-
|
722
|
+
._ExternalInputModal-tableWrapper_s6fxy_72 {
|
723
|
+
position: relative;
|
719
724
|
overflow-x: auto;
|
720
725
|
overflow-y: auto;
|
721
726
|
flex-grow: 1;
|
722
727
|
}
|
723
|
-
._ExternalInputModal-
|
728
|
+
._ExternalInputModal-table_s6fxy_72 {
|
724
729
|
border-collapse: unset;
|
725
730
|
border-spacing: 0px;
|
726
731
|
color: var(--puck-color-neutral-4);
|
@@ -728,64 +733,125 @@
|
|
728
733
|
z-index: 0;
|
729
734
|
min-width: 100%;
|
730
735
|
}
|
731
|
-
._ExternalInputModal-
|
736
|
+
._ExternalInputModal-thead_s6fxy_88 {
|
732
737
|
position: sticky;
|
733
738
|
top: 0;
|
734
739
|
z-index: 1;
|
735
740
|
}
|
736
|
-
._ExternalInputModal-
|
741
|
+
._ExternalInputModal-th_s6fxy_88 {
|
737
742
|
border-bottom: 1px solid var(--puck-color-grey-8);
|
738
743
|
border-top: 1px solid var(--puck-color-grey-8);
|
739
744
|
font-weight: 700;
|
740
745
|
padding: 16px 24px;
|
741
746
|
opacity: 0.9;
|
742
747
|
}
|
743
|
-
._ExternalInputModal-
|
748
|
+
._ExternalInputModal-td_s6fxy_102 {
|
744
749
|
font-family: var(--puck-font-stack);
|
745
750
|
padding: 16px 24px;
|
746
751
|
}
|
747
|
-
._ExternalInputModal-
|
752
|
+
._ExternalInputModal-tr_s6fxy_107:nth-of-type(n) {
|
748
753
|
background-color: white;
|
749
754
|
}
|
750
|
-
._ExternalInputModal-
|
755
|
+
._ExternalInputModal-tr_s6fxy_107:nth-of-type(2n) {
|
751
756
|
background-color: var(--puck-color-grey-10);
|
752
757
|
}
|
753
|
-
._ExternalInputModal-
|
758
|
+
._ExternalInputModal-tr_s6fxy_107 ._ExternalInputModal-td_s6fxy_102:first-of-type {
|
754
759
|
font-weight: 500;
|
755
760
|
}
|
756
|
-
._ExternalInputModal-
|
761
|
+
._ExternalInputModal-tbody_s6fxy_119 ._ExternalInputModal-tr_s6fxy_107:hover {
|
757
762
|
background: var(--puck-color-grey-11);
|
758
763
|
color: var(--puck-color-azure-4);
|
759
764
|
cursor: pointer;
|
760
765
|
position: relative;
|
761
766
|
margin-left: -5px;
|
762
767
|
}
|
763
|
-
._ExternalInputModal-
|
768
|
+
._ExternalInputModal-tbody_s6fxy_119 ._ExternalInputModal-tr_s6fxy_107:hover ._ExternalInputModal-td_s6fxy_102:first-of-type {
|
764
769
|
border-left: 4px solid var(--puck-color-azure-4);
|
765
770
|
padding-left: 20px;
|
766
771
|
}
|
767
|
-
._ExternalInputModal-
|
772
|
+
._ExternalInputModal-tableWrapper_s6fxy_72 {
|
768
773
|
display: none;
|
769
774
|
}
|
770
|
-
._ExternalInputModal--
|
775
|
+
._ExternalInputModal--hasData_s6fxy_138 ._ExternalInputModal-tableWrapper_s6fxy_72 {
|
771
776
|
display: block;
|
772
777
|
}
|
773
|
-
._ExternalInputModal-
|
778
|
+
._ExternalInputModal-loadingBanner_s6fxy_142 {
|
774
779
|
display: none;
|
775
|
-
background-color:
|
780
|
+
background-color: #ffffff90;
|
776
781
|
padding: 64px;
|
777
782
|
align-items: center;
|
778
783
|
justify-content: center;
|
784
|
+
position: absolute;
|
785
|
+
top: 0;
|
786
|
+
left: 0;
|
787
|
+
right: 0;
|
788
|
+
bottom: 0;
|
779
789
|
}
|
780
|
-
._ExternalInputModal--
|
790
|
+
._ExternalInputModal--isLoading_s6fxy_155 ._ExternalInputModal-loadingBanner_s6fxy_142 {
|
781
791
|
display: flex;
|
782
792
|
}
|
783
|
-
._ExternalInputModal-
|
793
|
+
._ExternalInputModal-noContentBanner_s6fxy_159 {
|
784
794
|
display: none;
|
795
|
+
border-top: 1px solid var(--puck-color-grey-8);
|
796
|
+
padding: 24px;
|
797
|
+
text-align: center;
|
785
798
|
}
|
786
|
-
._ExternalInputModal--
|
799
|
+
._ExternalInputModal--loaded_s6fxy_166:not(._ExternalInputModal--hasData_s6fxy_138) ._ExternalInputModal-noContentBanner_s6fxy_159 {
|
787
800
|
display: block;
|
788
|
-
|
801
|
+
}
|
802
|
+
._ExternalInputModal-searchForm_s6fxy_171 {
|
803
|
+
display: flex;
|
804
|
+
margin-left: auto;
|
805
|
+
height: 43px;
|
806
|
+
gap: 12px;
|
807
|
+
}
|
808
|
+
._ExternalInputModal-search_s6fxy_171 {
|
809
|
+
display: flex;
|
810
|
+
background: white;
|
811
|
+
border-width: 1px;
|
812
|
+
border-style: solid;
|
813
|
+
border-color: var(--puck-color-grey-8);
|
814
|
+
border-radius: 4px;
|
815
|
+
width: 100%;
|
816
|
+
}
|
817
|
+
._ExternalInputModal-search_s6fxy_171:focus-within {
|
818
|
+
border-color: var(--puck-color-azure-4);
|
819
|
+
outline: var(--puck-color-azure-8) 4px solid;
|
820
|
+
outline-offset: 0;
|
821
|
+
}
|
822
|
+
._ExternalInputModal-searchIcon_s6fxy_194 {
|
823
|
+
align-items: center;
|
824
|
+
background: var(--puck-color-grey-11);
|
825
|
+
border-bottom-left-radius: 4px;
|
826
|
+
border-top-left-radius: 4px;
|
827
|
+
border-right: 1px solid var(--puck-color-grey-8);
|
828
|
+
color: var(--puck-color-grey-6);
|
829
|
+
display: flex;
|
830
|
+
justify-content: center;
|
831
|
+
padding: 12px 15px;
|
832
|
+
}
|
833
|
+
._ExternalInputModal-searchIconText_s6fxy_206 {
|
834
|
+
clip: rect(0 0 0 0);
|
835
|
+
clip-path: inset(100%);
|
836
|
+
height: 1px;
|
837
|
+
overflow: hidden;
|
838
|
+
position: absolute;
|
839
|
+
white-space: nowrap;
|
840
|
+
width: 1px;
|
841
|
+
}
|
842
|
+
._ExternalInputModal-searchInput_s6fxy_216 {
|
843
|
+
border: none;
|
844
|
+
border-radius: 4px;
|
845
|
+
background: white;
|
846
|
+
font-family: inherit;
|
847
|
+
font-size: 14px;
|
848
|
+
padding: 12px 15px;
|
849
|
+
width: 100%;
|
850
|
+
}
|
851
|
+
._ExternalInputModal-searchInput_s6fxy_216:focus {
|
852
|
+
border: none;
|
853
|
+
outline: none;
|
854
|
+
box-shadow: none;
|
789
855
|
}
|
790
856
|
|
791
857
|
/* css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css/#css-module-data */
|
package/dist/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { D as Data, C as Config, I as ItemSelector, U as UiState, A as AppState, M as MappedItem, R as RootDataWithProps, a as DefaultRootProps, b as RootData } from './Config-
|
2
|
-
export { d as Adaptor, c as ArrayField, p as ArrayState, l as BaseData, B as BaseField, k as ComponentConfig, m as ComponentData, i as Content, f as CustomField, g as DefaultComponentProps, q as DropZone, e as ExternalField, E as ExternalFieldWithAdaptor, F as Field, h as Fields, o as ItemWithId, P as PuckComponent, j as PuckContext, n as RootDataWithoutProps, S as SelectField, T as TextField } from './Config-
|
1
|
+
import { D as Data, C as Config, I as ItemSelector, U as UiState, A as AppState, M as MappedItem, R as RootDataWithProps, a as DefaultRootProps, b as RootData } from './Config-162394d8.js';
|
2
|
+
export { d as Adaptor, c as ArrayField, p as ArrayState, l as BaseData, B as BaseField, k as ComponentConfig, m as ComponentData, i as Content, f as CustomField, g as DefaultComponentProps, q as DropZone, e as ExternalField, E as ExternalFieldWithAdaptor, F as Field, h as Fields, o as ItemWithId, P as PuckComponent, j as PuckContext, n as RootDataWithoutProps, S as SelectField, T as TextField } from './Config-162394d8.js';
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
4
4
|
import * as react from 'react';
|
5
5
|
import { ReactNode, CSSProperties, SyntheticEvent, ReactElement } from 'react';
|
@@ -99,7 +99,7 @@ type PuckAction = {
|
|
99
99
|
recordHistory?: boolean;
|
100
100
|
} & (ReorderAction | InsertAction | MoveAction | ReplaceAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
|
101
101
|
|
102
|
-
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, }: {
|
102
|
+
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, }: {
|
103
103
|
children: ReactNode;
|
104
104
|
href?: string | undefined;
|
105
105
|
onClick?: ((e: any) => void | Promise<void>) | undefined;
|
@@ -111,6 +111,7 @@ declare const Button: ({ children, href, onClick, variant, type, disabled, tabIn
|
|
111
111
|
fullWidth?: boolean | undefined;
|
112
112
|
icon?: ReactNode;
|
113
113
|
size?: "medium" | "large" | undefined;
|
114
|
+
loading?: boolean | undefined;
|
114
115
|
}) => react_jsx_runtime.JSX.Element;
|
115
116
|
|
116
117
|
declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, }: {
|
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
|
@@ -32009,7 +32092,7 @@ var getClassName3 = get_class_name_factory_default("DropZone", styles_module_def
|
|
32009
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, allow, disallow, 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, allow, disallow, 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");
|
@@ -32270,7 +32353,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
32270
32353
|
);
|
32271
32354
|
}
|
32272
32355
|
function DropZoneRender({ zone }) {
|
32273
|
-
const ctx = (0,
|
32356
|
+
const ctx = (0, import_react26.useContext)(dropZoneContext);
|
32274
32357
|
const { data, areaId = "root", config } = ctx || {};
|
32275
32358
|
let zoneCompound = rootDroppableId;
|
32276
32359
|
let content = (data == null ? void 0 : data.content) || [];
|
@@ -32302,7 +32385,7 @@ function DropZoneRender({ zone }) {
|
|
32302
32385
|
}) });
|
32303
32386
|
}
|
32304
32387
|
function DropZone(props) {
|
32305
|
-
const ctx = (0,
|
32388
|
+
const ctx = (0, import_react26.useContext)(dropZoneContext);
|
32306
32389
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
32307
32390
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DropZoneEdit, __spreadValues({}, props));
|
32308
32391
|
}
|
@@ -32314,7 +32397,7 @@ init_react_import();
|
|
32314
32397
|
|
32315
32398
|
// components/IconButton/IconButton.tsx
|
32316
32399
|
init_react_import();
|
32317
|
-
var
|
32400
|
+
var import_react27 = require("react");
|
32318
32401
|
|
32319
32402
|
// css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
|
32320
32403
|
init_react_import();
|
@@ -32336,7 +32419,7 @@ var IconButton = ({
|
|
32336
32419
|
fullWidth,
|
32337
32420
|
title
|
32338
32421
|
}) => {
|
32339
|
-
const [loading, setLoading] = (0,
|
32422
|
+
const [loading, setLoading] = (0, import_react27.useState)(false);
|
32340
32423
|
const ElementType = href ? "a" : "button";
|
32341
32424
|
const el = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
32342
32425
|
ElementType,
|
@@ -32377,7 +32460,7 @@ var IconButton = ({
|
|
32377
32460
|
|
32378
32461
|
// components/Puck/index.tsx
|
32379
32462
|
init_react_import();
|
32380
|
-
var
|
32463
|
+
var import_react40 = require("react");
|
32381
32464
|
var import_dnd7 = require("@hello-pangea/dnd");
|
32382
32465
|
|
32383
32466
|
// components/InputOrGroup/index.tsx
|
@@ -32388,7 +32471,7 @@ init_react_import();
|
|
32388
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" };
|
32389
32472
|
|
32390
32473
|
// components/InputOrGroup/index.tsx
|
32391
|
-
var
|
32474
|
+
var import_react32 = require("react");
|
32392
32475
|
|
32393
32476
|
// components/InputOrGroup/fields/index.tsx
|
32394
32477
|
init_react_import();
|
@@ -32453,7 +32536,7 @@ var Draggable2 = ({
|
|
32453
32536
|
};
|
32454
32537
|
|
32455
32538
|
// components/InputOrGroup/fields/ArrayField/index.tsx
|
32456
|
-
var
|
32539
|
+
var import_react28 = require("react");
|
32457
32540
|
|
32458
32541
|
// components/DragIcon/index.tsx
|
32459
32542
|
init_react_import();
|
@@ -32491,11 +32574,11 @@ var ArrayField = ({
|
|
32491
32574
|
}),
|
32492
32575
|
openId: ""
|
32493
32576
|
};
|
32494
|
-
const [localState, setLocalState] = (0,
|
32495
|
-
(0,
|
32577
|
+
const [localState, setLocalState] = (0, import_react28.useState)({ arrayState, value });
|
32578
|
+
(0, import_react28.useEffect)(() => {
|
32496
32579
|
setLocalState({ arrayState, value });
|
32497
32580
|
}, [value, state.ui.arrayState[id]]);
|
32498
|
-
const mapArrayStateToUi = (0,
|
32581
|
+
const mapArrayStateToUi = (0, import_react28.useCallback)(
|
32499
32582
|
(partialArrayState) => {
|
32500
32583
|
return {
|
32501
32584
|
arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
|
@@ -32505,13 +32588,13 @@ var ArrayField = ({
|
|
32505
32588
|
},
|
32506
32589
|
[arrayState]
|
32507
32590
|
);
|
32508
|
-
const getHighestIndex = (0,
|
32591
|
+
const getHighestIndex = (0, import_react28.useCallback)(() => {
|
32509
32592
|
return arrayState.items.reduce(
|
32510
32593
|
(acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
|
32511
32594
|
-1
|
32512
32595
|
);
|
32513
32596
|
}, [arrayState]);
|
32514
|
-
const regenerateArrayState = (0,
|
32597
|
+
const regenerateArrayState = (0, import_react28.useCallback)(
|
32515
32598
|
(value2) => {
|
32516
32599
|
let highestIndex = getHighestIndex();
|
32517
32600
|
const newItems = Array.from(value2 || []).map((item, idx) => {
|
@@ -32530,10 +32613,10 @@ var ArrayField = ({
|
|
32530
32613
|
},
|
32531
32614
|
[arrayState]
|
32532
32615
|
);
|
32533
|
-
(0,
|
32616
|
+
(0, import_react28.useEffect)(() => {
|
32534
32617
|
setUi(mapArrayStateToUi(arrayState));
|
32535
32618
|
}, []);
|
32536
|
-
const [hovering, setHovering] = (0,
|
32619
|
+
const [hovering, setHovering] = (0, import_react28.useState)(false);
|
32537
32620
|
if (field.type !== "array" || !field.arrayFields) {
|
32538
32621
|
return null;
|
32539
32622
|
}
|
@@ -32762,19 +32845,19 @@ var DefaultField = ({
|
|
32762
32845
|
|
32763
32846
|
// components/InputOrGroup/fields/ExternalField/index.tsx
|
32764
32847
|
init_react_import();
|
32765
|
-
var
|
32848
|
+
var import_react31 = require("react");
|
32766
32849
|
|
32767
32850
|
// components/ExternalInput/index.tsx
|
32768
32851
|
init_react_import();
|
32769
|
-
var
|
32852
|
+
var import_react30 = require("react");
|
32770
32853
|
|
32771
32854
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
32772
32855
|
init_react_import();
|
32773
|
-
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" };
|
32774
32857
|
|
32775
32858
|
// components/Modal/index.tsx
|
32776
32859
|
init_react_import();
|
32777
|
-
var
|
32860
|
+
var import_react29 = require("react");
|
32778
32861
|
|
32779
32862
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
|
32780
32863
|
init_react_import();
|
@@ -32789,8 +32872,8 @@ var Modal = ({
|
|
32789
32872
|
onClose,
|
32790
32873
|
isOpen
|
32791
32874
|
}) => {
|
32792
|
-
const [rootEl, setRootEl] = (0,
|
32793
|
-
(0,
|
32875
|
+
const [rootEl, setRootEl] = (0, import_react29.useState)(null);
|
32876
|
+
(0, import_react29.useEffect)(() => {
|
32794
32877
|
setRootEl(document.getElementById("puck-portal-root"));
|
32795
32878
|
}, []);
|
32796
32879
|
if (!rootEl) {
|
@@ -32846,10 +32929,10 @@ var ExternalInput = ({
|
|
32846
32929
|
id
|
32847
32930
|
}) => {
|
32848
32931
|
const { mapProp = (val) => val } = field || {};
|
32849
|
-
const [data, setData] = (0,
|
32850
|
-
const [isOpen, setOpen] = (0,
|
32851
|
-
const [isLoading, setIsLoading] = (0,
|
32852
|
-
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)(() => {
|
32853
32936
|
const validKeys = /* @__PURE__ */ new Set();
|
32854
32937
|
for (const item of data) {
|
32855
32938
|
for (const key of Object.keys(item)) {
|
@@ -32860,15 +32943,22 @@ var ExternalInput = ({
|
|
32860
32943
|
}
|
32861
32944
|
return Array.from(validKeys);
|
32862
32945
|
}, [data]);
|
32863
|
-
(0,
|
32864
|
-
|
32865
|
-
|
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 }));
|
32866
32952
|
if (listData) {
|
32867
32953
|
setData(listData);
|
32868
32954
|
setIsLoading(false);
|
32869
|
-
dataCache[
|
32955
|
+
dataCache[cacheKey] = listData;
|
32870
32956
|
}
|
32871
|
-
})
|
32957
|
+
}),
|
32958
|
+
[name, field]
|
32959
|
+
);
|
32960
|
+
(0, import_react30.useEffect)(() => {
|
32961
|
+
search(searchQuery);
|
32872
32962
|
}, []);
|
32873
32963
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
32874
32964
|
"div",
|
@@ -32908,38 +32998,73 @@ var ExternalInput = ({
|
|
32908
32998
|
className: getClassNameModal({
|
32909
32999
|
isLoading,
|
32910
33000
|
loaded: !isLoading,
|
32911
|
-
hasData:
|
33001
|
+
hasData: data.length > 0
|
32912
33002
|
}),
|
32913
33003
|
children: [
|
32914
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.
|
32915
|
-
|
32916
|
-
|
32917
|
-
"
|
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",
|
32918
33008
|
{
|
32919
|
-
className: getClassNameModal("
|
32920
|
-
|
32921
|
-
|
32922
|
-
|
32923
|
-
|
32924
|
-
|
32925
|
-
|
32926
|
-
|
32927
|
-
|
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",
|
32928
33042
|
{
|
32929
|
-
|
32930
|
-
|
32931
|
-
|
32932
|
-
onChange(mapProp(item));
|
32933
|
-
setOpen(false);
|
32934
|
-
},
|
32935
|
-
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
|
32936
33046
|
},
|
32937
|
-
|
32938
|
-
)
|
32939
|
-
|
32940
|
-
|
32941
|
-
|
32942
|
-
|
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." })
|
32943
33068
|
]
|
32944
33069
|
}
|
32945
33070
|
) })
|
@@ -32961,7 +33086,7 @@ var ExternalField = ({
|
|
32961
33086
|
var _a, _b, _c;
|
32962
33087
|
const validField = field;
|
32963
33088
|
const deprecatedField = field;
|
32964
|
-
(0,
|
33089
|
+
(0, import_react31.useEffect)(() => {
|
32965
33090
|
if (deprecatedField.adaptor) {
|
32966
33091
|
console.error(
|
32967
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."
|
@@ -33183,7 +33308,7 @@ var FieldLabelInternal = ({
|
|
33183
33308
|
var InputOrGroup = (_a) => {
|
33184
33309
|
var _b = _a, { onChange } = _b, props = __objRest(_b, ["onChange"]);
|
33185
33310
|
const { name, field, value, readOnly } = props;
|
33186
|
-
const [localValue, setLocalValue] = (0,
|
33311
|
+
const [localValue, setLocalValue] = (0, import_react32.useState)(value);
|
33187
33312
|
const onChangeDb = (0, import_use_debounce2.useDebouncedCallback)(
|
33188
33313
|
(val, ui) => {
|
33189
33314
|
onChange(val, ui);
|
@@ -33191,11 +33316,11 @@ var InputOrGroup = (_a) => {
|
|
33191
33316
|
50,
|
33192
33317
|
{ leading: true }
|
33193
33318
|
);
|
33194
|
-
const onChangeLocal = (0,
|
33319
|
+
const onChangeLocal = (0, import_react32.useCallback)((val, ui) => {
|
33195
33320
|
setLocalValue(val);
|
33196
33321
|
onChangeDb(val, ui);
|
33197
33322
|
}, []);
|
33198
|
-
(0,
|
33323
|
+
(0, import_react32.useEffect)(() => {
|
33199
33324
|
setLocalValue(value);
|
33200
33325
|
}, [value]);
|
33201
33326
|
const localProps = {
|
@@ -33325,10 +33450,10 @@ ComponentList.Item = ComponentListItem;
|
|
33325
33450
|
|
33326
33451
|
// lib/use-placeholder-style.ts
|
33327
33452
|
init_react_import();
|
33328
|
-
var
|
33453
|
+
var import_react33 = require("react");
|
33329
33454
|
var usePlaceholderStyle = () => {
|
33330
33455
|
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
33331
|
-
const [placeholderStyle, setPlaceholderStyle] = (0,
|
33456
|
+
const [placeholderStyle, setPlaceholderStyle] = (0, import_react33.useState)();
|
33332
33457
|
const onDragStartOrUpdate = (draggedItem) => {
|
33333
33458
|
var _a;
|
33334
33459
|
const draggableId = draggedItem.draggableId;
|
@@ -33380,7 +33505,7 @@ var styles_module_default10 = { "SidebarSection": "_SidebarSection_1uyg2_1", "Si
|
|
33380
33505
|
|
33381
33506
|
// lib/use-breadcrumbs.ts
|
33382
33507
|
init_react_import();
|
33383
|
-
var
|
33508
|
+
var import_react34 = require("react");
|
33384
33509
|
var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
|
33385
33510
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
33386
33511
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -33430,8 +33555,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
33430
33555
|
state: { data },
|
33431
33556
|
selectedItem
|
33432
33557
|
} = useAppContext();
|
33433
|
-
const dzContext = (0,
|
33434
|
-
return (0,
|
33558
|
+
const dzContext = (0, import_react34.useContext)(dropZoneContext);
|
33559
|
+
return (0, import_react34.useMemo)(() => {
|
33435
33560
|
const breadcrumbs = convertPathDataToBreadcrumbs(
|
33436
33561
|
selectedItem,
|
33437
33562
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -33483,11 +33608,11 @@ init_react_import();
|
|
33483
33608
|
|
33484
33609
|
// lib/use-puck-history.ts
|
33485
33610
|
init_react_import();
|
33486
|
-
var
|
33611
|
+
var import_react36 = require("react");
|
33487
33612
|
|
33488
33613
|
// lib/use-action-history.ts
|
33489
33614
|
init_react_import();
|
33490
|
-
var
|
33615
|
+
var import_react35 = require("react");
|
33491
33616
|
|
33492
33617
|
// lib/generate-id.ts
|
33493
33618
|
init_react_import();
|
@@ -33497,8 +33622,8 @@ var generateId = (type) => `${type}-${(0, import_crypto.randomBytes)(20).toStrin
|
|
33497
33622
|
// lib/use-action-history.ts
|
33498
33623
|
var EMPTY_HISTORY_INDEX = -1;
|
33499
33624
|
function useActionHistory() {
|
33500
|
-
const [histories, setHistories] = (0,
|
33501
|
-
const [currentHistoryIndex, setCurrentHistoryIndex] = (0,
|
33625
|
+
const [histories, setHistories] = (0, import_react35.useState)([]);
|
33626
|
+
const [currentHistoryIndex, setCurrentHistoryIndex] = (0, import_react35.useState)(EMPTY_HISTORY_INDEX);
|
33502
33627
|
const currentHistory = histories[currentHistoryIndex];
|
33503
33628
|
const canRewind = currentHistoryIndex > EMPTY_HISTORY_INDEX;
|
33504
33629
|
const canForward = currentHistoryIndex < histories.length - 1;
|
@@ -33577,7 +33702,7 @@ function usePuckHistory({
|
|
33577
33702
|
dispatch
|
33578
33703
|
});
|
33579
33704
|
}, DEBOUNCE_TIME);
|
33580
|
-
(0,
|
33705
|
+
(0, import_react36.useEffect)(() => {
|
33581
33706
|
historyEmitter.on(RECORD_DIFF, handleRecordDiff);
|
33582
33707
|
return () => {
|
33583
33708
|
historyEmitter.off(RECORD_DIFF, handleRecordDiff);
|
@@ -33939,7 +34064,7 @@ var scrollIntoView = (el) => {
|
|
33939
34064
|
};
|
33940
34065
|
|
33941
34066
|
// components/LayerTree/index.tsx
|
33942
|
-
var
|
34067
|
+
var import_react37 = require("react");
|
33943
34068
|
|
33944
34069
|
// lib/find-zones-for-area.ts
|
33945
34070
|
init_react_import();
|
@@ -33977,7 +34102,7 @@ var LayerTree = ({
|
|
33977
34102
|
label
|
33978
34103
|
}) => {
|
33979
34104
|
const zones = data.zones || {};
|
33980
|
-
const ctx = (0,
|
34105
|
+
const ctx = (0, import_react37.useContext)(dropZoneContext);
|
33981
34106
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
33982
34107
|
label && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassName17("zoneTitle"), children: [
|
33983
34108
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(layers_default, { size: "16" }) }),
|
@@ -34102,11 +34227,11 @@ var flushZones = (appState) => {
|
|
34102
34227
|
|
34103
34228
|
// lib/use-component-list.tsx
|
34104
34229
|
init_react_import();
|
34105
|
-
var
|
34230
|
+
var import_react38 = require("react");
|
34106
34231
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
34107
34232
|
var useComponentList = (config, ui) => {
|
34108
|
-
const [componentList, setComponentList] = (0,
|
34109
|
-
(0,
|
34233
|
+
const [componentList, setComponentList] = (0, import_react38.useState)();
|
34234
|
+
(0, import_react38.useEffect)(() => {
|
34110
34235
|
var _a, _b, _c;
|
34111
34236
|
if (Object.keys(ui.componentList).length > 0) {
|
34112
34237
|
const matchedComponents = [];
|
@@ -34172,7 +34297,7 @@ var useComponentList = (config, ui) => {
|
|
34172
34297
|
|
34173
34298
|
// lib/use-resolved-data.ts
|
34174
34299
|
init_react_import();
|
34175
|
-
var
|
34300
|
+
var import_react39 = require("react");
|
34176
34301
|
|
34177
34302
|
// lib/resolve-component-data.ts
|
34178
34303
|
init_react_import();
|
@@ -34287,13 +34412,13 @@ var resolveRootData = (data, config) => __async(void 0, null, function* () {
|
|
34287
34412
|
|
34288
34413
|
// lib/use-resolved-data.ts
|
34289
34414
|
var useResolvedData = (appState, config, dispatch) => {
|
34290
|
-
const [{ resolverKey, newAppState }, setResolverState] = (0,
|
34415
|
+
const [{ resolverKey, newAppState }, setResolverState] = (0, import_react39.useState)({
|
34291
34416
|
resolverKey: 0,
|
34292
34417
|
newAppState: appState
|
34293
34418
|
});
|
34294
|
-
const [componentState, setComponentState] = (0,
|
34419
|
+
const [componentState, setComponentState] = (0, import_react39.useState)({});
|
34295
34420
|
const deferredSetStates = {};
|
34296
|
-
const setComponentLoading = (0,
|
34421
|
+
const setComponentLoading = (0, import_react39.useCallback)(
|
34297
34422
|
(id, loading, defer = 0) => {
|
34298
34423
|
if (deferredSetStates[id]) {
|
34299
34424
|
clearTimeout(deferredSetStates[id]);
|
@@ -34360,10 +34485,10 @@ var useResolvedData = (appState, config, dispatch) => {
|
|
34360
34485
|
});
|
34361
34486
|
yield Promise.all(promises);
|
34362
34487
|
});
|
34363
|
-
(0,
|
34488
|
+
(0, import_react39.useEffect)(() => {
|
34364
34489
|
runResolvers();
|
34365
34490
|
}, [resolverKey]);
|
34366
|
-
const resolveData = (0,
|
34491
|
+
const resolveData = (0, import_react39.useCallback)((newAppState2 = appState) => {
|
34367
34492
|
setResolverState((curr) => ({
|
34368
34493
|
resolverKey: curr.resolverKey + 1,
|
34369
34494
|
newAppState: newAppState2
|
@@ -34483,8 +34608,8 @@ function Puck({
|
|
34483
34608
|
headerPath
|
34484
34609
|
}) {
|
34485
34610
|
var _a, _b;
|
34486
|
-
const [reducer] = (0,
|
34487
|
-
const [initialAppState] = (0,
|
34611
|
+
const [reducer] = (0, import_react40.useState)(() => createReducer({ config }));
|
34612
|
+
const [initialAppState] = (0, import_react40.useState)(__spreadProps(__spreadValues({}, defaultAppState), {
|
34488
34613
|
data: initialData,
|
34489
34614
|
ui: __spreadProps(__spreadValues({}, defaultAppState.ui), {
|
34490
34615
|
// Store categories under componentList on state to allow render functions and plugins to modify
|
@@ -34503,7 +34628,7 @@ function Puck({
|
|
34503
34628
|
) : {}
|
34504
34629
|
})
|
34505
34630
|
}));
|
34506
|
-
const [appState, dispatch] = (0,
|
34631
|
+
const [appState, dispatch] = (0, import_react40.useReducer)(
|
34507
34632
|
reducer,
|
34508
34633
|
flushZones(initialAppState)
|
34509
34634
|
);
|
@@ -34513,9 +34638,9 @@ function Puck({
|
|
34513
34638
|
config,
|
34514
34639
|
dispatch
|
34515
34640
|
);
|
34516
|
-
const [menuOpen, setMenuOpen] = (0,
|
34641
|
+
const [menuOpen, setMenuOpen] = (0, import_react40.useState)(false);
|
34517
34642
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
34518
|
-
const setItemSelector = (0,
|
34643
|
+
const setItemSelector = (0, import_react40.useCallback)(
|
34519
34644
|
(newItemSelector) => {
|
34520
34645
|
dispatch({
|
34521
34646
|
type: "setUi",
|
@@ -34525,7 +34650,7 @@ function Puck({
|
|
34525
34650
|
[]
|
34526
34651
|
);
|
34527
34652
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
34528
|
-
const Page = (0,
|
34653
|
+
const Page = (0, import_react40.useCallback)(
|
34529
34654
|
(pageProps) => {
|
34530
34655
|
var _a2, _b2;
|
34531
34656
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
@@ -34541,7 +34666,7 @@ function Puck({
|
|
34541
34666
|
},
|
34542
34667
|
[config.root]
|
34543
34668
|
);
|
34544
|
-
const PageFieldWrapper = (0,
|
34669
|
+
const PageFieldWrapper = (0, import_react40.useCallback)(
|
34545
34670
|
(props) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34546
34671
|
PluginRenderer,
|
34547
34672
|
{
|
@@ -34554,7 +34679,7 @@ function Puck({
|
|
34554
34679
|
),
|
34555
34680
|
[]
|
34556
34681
|
);
|
34557
|
-
const ComponentFieldWrapper = (0,
|
34682
|
+
const ComponentFieldWrapper = (0, import_react40.useCallback)(
|
34558
34683
|
(props) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34559
34684
|
PluginRenderer,
|
34560
34685
|
{
|
@@ -34567,7 +34692,7 @@ function Puck({
|
|
34567
34692
|
),
|
34568
34693
|
[]
|
34569
34694
|
);
|
34570
|
-
const ComponentListWrapper = (0,
|
34695
|
+
const ComponentListWrapper = (0, import_react40.useCallback)((props) => {
|
34571
34696
|
const children = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34572
34697
|
PluginRenderer,
|
34573
34698
|
{
|
@@ -34587,22 +34712,22 @@ function Puck({
|
|
34587
34712
|
const FieldWrapper = itemSelector ? ComponentFieldWrapper : PageFieldWrapper;
|
34588
34713
|
const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
|
34589
34714
|
let fields = selectedItem ? ((_b = config.components[selectedItem.type]) == null ? void 0 : _b.fields) || {} : rootFields;
|
34590
|
-
(0,
|
34715
|
+
(0, import_react40.useEffect)(() => {
|
34591
34716
|
if (onChange)
|
34592
34717
|
onChange(data);
|
34593
34718
|
}, [data]);
|
34594
34719
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
34595
|
-
const [draggedItem, setDraggedItem] = (0,
|
34720
|
+
const [draggedItem, setDraggedItem] = (0, import_react40.useState)();
|
34596
34721
|
const componentList = useComponentList(config, appState.ui);
|
34597
34722
|
const rootProps = data.root.props || data.root;
|
34598
|
-
(0,
|
34723
|
+
(0, import_react40.useEffect)(() => {
|
34599
34724
|
if (Object.keys(data.root).length > 0 && !data.root.props) {
|
34600
34725
|
console.error(
|
34601
34726
|
"Warning: Defining props on `root` is deprecated. Please use `root.props`. This will be a breaking change in a future release."
|
34602
34727
|
);
|
34603
34728
|
}
|
34604
34729
|
}, []);
|
34605
|
-
const toggleSidebars = (0,
|
34730
|
+
const toggleSidebars = (0, import_react40.useCallback)(
|
34606
34731
|
(sidebar) => {
|
34607
34732
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
34608
34733
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -34616,7 +34741,7 @@ function Puck({
|
|
34616
34741
|
},
|
34617
34742
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
34618
34743
|
);
|
34619
|
-
(0,
|
34744
|
+
(0, import_react40.useEffect)(() => {
|
34620
34745
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
34621
34746
|
dispatch({
|
34622
34747
|
type: "setUi",
|
package/dist/rsc.d.ts
CHANGED