@measured/puck 0.12.1-canary.9470ff9 → 0.13.0-canary.194c4e5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{Config-35e6eaae.d.ts → Config-0331e026.d.ts} +19 -3
- package/dist/index.css +107 -27
- package/dist/index.d.ts +22 -8
- package/dist/index.js +705 -337
- package/dist/rsc.d.ts +3 -3
- package/dist/rsc.js +4 -1
- package/package.json +1 -1
@@ -8,6 +8,8 @@ type ItemSelector = {
|
|
8
8
|
|
9
9
|
type DropZoneProps = {
|
10
10
|
zone: string;
|
11
|
+
allow?: string[];
|
12
|
+
disallow?: string[];
|
11
13
|
style?: CSSProperties;
|
12
14
|
};
|
13
15
|
declare function DropZone(props: DropZoneProps): react_jsx_runtime.JSX.Element;
|
@@ -40,6 +42,16 @@ type ArrayField<Props extends {
|
|
40
42
|
defaultItemProps?: Props[0];
|
41
43
|
getItemSummary?: (item: Props[0], index?: number) => string;
|
42
44
|
};
|
45
|
+
type ObjectField<Props extends {
|
46
|
+
[key: string]: any;
|
47
|
+
} = {
|
48
|
+
[key: string]: any;
|
49
|
+
}> = BaseField & {
|
50
|
+
type: "object";
|
51
|
+
objectFields: {
|
52
|
+
[SubPropName in keyof Props[0]]: Field<Props[0][SubPropName]>;
|
53
|
+
};
|
54
|
+
};
|
43
55
|
type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, PropShape = TableShape> = {
|
44
56
|
name: string;
|
45
57
|
fetchList: (adaptorParams?: AdaptorParams) => Promise<TableShape[] | null>;
|
@@ -63,9 +75,13 @@ type ExternalField<Props extends {
|
|
63
75
|
}> = BaseField & {
|
64
76
|
type: "external";
|
65
77
|
placeholder?: string;
|
66
|
-
fetchList: (
|
78
|
+
fetchList: (params: {
|
79
|
+
query: string;
|
80
|
+
}) => Promise<any[] | null>;
|
67
81
|
mapProp?: (value: any) => Props;
|
68
82
|
getItemSummary: (item: Props, index?: number) => string;
|
83
|
+
showSearch?: boolean;
|
84
|
+
initialQuery?: string;
|
69
85
|
};
|
70
86
|
type CustomField<Props extends {
|
71
87
|
[key: string]: any;
|
@@ -85,7 +101,7 @@ type Field<Props extends {
|
|
85
101
|
[key: string]: any;
|
86
102
|
} = {
|
87
103
|
[key: string]: any;
|
88
|
-
}> = TextField | SelectField | ArrayField<Props> | ExternalField<Props> | ExternalFieldWithAdaptor<Props> | CustomField;
|
104
|
+
}> = TextField | SelectField | ArrayField<Props> | ObjectField<Props> | ExternalField<Props> | ExternalFieldWithAdaptor<Props> | CustomField;
|
89
105
|
type DefaultRootProps = {
|
90
106
|
title?: string;
|
91
107
|
[key: string]: any;
|
@@ -193,4 +209,4 @@ type AppState = {
|
|
193
209
|
ui: UiState;
|
194
210
|
};
|
195
211
|
|
196
|
-
export { AppState as A, BaseField as B, Config as C, Data as D, ExternalFieldWithAdaptor as E, Field as F, ItemSelector as I, MappedItem as M, PuckComponent as P, RootDataWithProps as R, SelectField as S, TextField as T, UiState as U,
|
212
|
+
export { AppState as A, BaseField as B, Config as C, Data as D, ExternalFieldWithAdaptor as E, Field as F, ItemSelector as I, MappedItem as M, ObjectField as O, PuckComponent as P, RootDataWithProps as R, SelectField as S, TextField as T, UiState as U, DefaultComponentProps as a, DefaultRootProps as b, RootData as c, ArrayField as d, Adaptor as e, ExternalField as f, CustomField as g, Fields as h, Content as i, PuckContext as j, ComponentConfig as k, BaseData as l, ComponentData as m, RootDataWithoutProps as n, ItemWithId as o, ArrayState as p, DropZone as q };
|
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 */
|
@@ -854,6 +920,20 @@
|
|
854
920
|
font-size: var(--puck-font-size-xs);
|
855
921
|
}
|
856
922
|
|
923
|
+
/* css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ObjectField/styles.module.css/#css-module-data */
|
924
|
+
._ObjectField_56z4t_5 {
|
925
|
+
display: flex;
|
926
|
+
flex-direction: column;
|
927
|
+
background-color: white;
|
928
|
+
border: 1px solid var(--puck-color-grey-8);
|
929
|
+
border-radius: 4px;
|
930
|
+
}
|
931
|
+
._ObjectField-fieldset_56z4t_13 {
|
932
|
+
border: none;
|
933
|
+
margin: 0;
|
934
|
+
padding: 16px 15px;
|
935
|
+
}
|
936
|
+
|
857
937
|
/* css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css/#css-module-data */
|
858
938
|
._ComponentList_1m8r5_1 {
|
859
939
|
font-family: var(--puck-font-stack);
|
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,
|
2
|
-
export {
|
1
|
+
import { D as Data, C as Config, I as ItemSelector, U as UiState, A as AppState, a as DefaultComponentProps, b as DefaultRootProps, M as MappedItem, R as RootDataWithProps, c as RootData } from './Config-0331e026.js';
|
2
|
+
export { e as Adaptor, d as ArrayField, p as ArrayState, l as BaseData, B as BaseField, k as ComponentConfig, m as ComponentData, i as Content, g as CustomField, q as DropZone, f as ExternalField, E as ExternalFieldWithAdaptor, F as Field, h as Fields, o as ItemWithId, O as ObjectField, P as PuckComponent, j as PuckContext, n as RootDataWithoutProps, S as SelectField, T as TextField } from './Config-0331e026.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, }: {
|
@@ -145,7 +146,7 @@ type Plugin = {
|
|
145
146
|
};
|
146
147
|
|
147
148
|
declare function Puck({ config, data: initialData, onChange, onPublish, plugins, renderComponentList, renderHeader, renderHeaderActions, headerTitle, headerPath, }: {
|
148
|
-
config: Config
|
149
|
+
config: Config<any, any, any>;
|
149
150
|
data: Data;
|
150
151
|
onChange?: (data: Data) => void;
|
151
152
|
onPublish: (data: Data) => void;
|
@@ -168,12 +169,25 @@ declare function Puck({ config, data: initialData, onChange, onPublish, plugins,
|
|
168
169
|
headerPath?: string;
|
169
170
|
}): react_jsx_runtime.JSX.Element;
|
170
171
|
|
171
|
-
declare function Render({ config, data }: {
|
172
|
-
config: Config
|
172
|
+
declare function Render({ config, data, }: {
|
173
|
+
config: Config<any, any, any>;
|
173
174
|
data: Data;
|
174
175
|
}): react_jsx_runtime.JSX.Element;
|
175
176
|
|
176
|
-
declare
|
177
|
+
declare function migrate(data: Data): Data;
|
178
|
+
|
179
|
+
type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultRootProps = DefaultRootProps> = Partial<{
|
180
|
+
[ComponentName in keyof Props]: (props: Props[ComponentName] & {
|
181
|
+
[key: string]: any;
|
182
|
+
}) => Props[ComponentName];
|
183
|
+
} & {
|
184
|
+
root: (props: RootProps & {
|
185
|
+
[key: string]: any;
|
186
|
+
}) => RootProps;
|
187
|
+
}>;
|
188
|
+
declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultComponentProps>(data: Data, propTransforms: PropTransform<Props, RootProps>): Data;
|
189
|
+
|
190
|
+
declare const resolveAllData: (data: Data, config: Config<any, any, any>, onResolveStart?: ((item: MappedItem) => void) | undefined, onResolveEnd?: ((item: MappedItem) => void) | undefined) => Promise<{
|
177
191
|
root: RootDataWithProps<DefaultRootProps> | RootData<DefaultRootProps>;
|
178
192
|
content: any[];
|
179
193
|
zones: Record<string, MappedItem[]>;
|
@@ -188,4 +202,4 @@ declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }:
|
|
188
202
|
className?: string | undefined;
|
189
203
|
}) => react_jsx_runtime.JSX.Element;
|
190
204
|
|
191
|
-
export { AppState, Button, Config, Data, DefaultRootProps, DropZoneProvider, FieldLabel, IconButton, MappedItem, Puck, PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, resolveAllData };
|
205
|
+
export { AppState, Button, Config, Data, DefaultComponentProps, DefaultRootProps, DropZoneProvider, FieldLabel, IconButton, MappedItem, Puck, PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps };
|