@measured/puck 0.12.1-canary.aa431b7 → 0.13.0-canary.0450f4e

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Puck
2
2
 
3
- The self-hosted, drag and drop editor for React.
3
+ The visual editor for React.
4
4
 
5
5
  <p align="left">
6
6
  <a aria-label="Measured logo" href="https://measured.co">
@@ -104,4 +104,4 @@ If you need support integrating Puck or creating a beautiful component library,
104
104
 
105
105
  ## License
106
106
 
107
- MIT © [Measured Co.](https://github.com/measuredco)
107
+ MIT © [Measured Corporation Ltd](https://measured.co)
@@ -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;
@@ -19,10 +21,23 @@ type BaseField = {
19
21
  label?: string;
20
22
  };
21
23
  type TextField = BaseField & {
22
- type: "text" | "number" | "textarea";
24
+ type: "text";
25
+ };
26
+ type NumberField = BaseField & {
27
+ type: "number";
28
+ };
29
+ type TextareaField = BaseField & {
30
+ type: "textarea";
23
31
  };
24
32
  type SelectField = BaseField & {
25
- type: "select" | "radio";
33
+ type: "select";
34
+ options: {
35
+ label: string;
36
+ value: string | number | boolean;
37
+ }[];
38
+ };
39
+ type RadioField = BaseField & {
40
+ type: "radio";
26
41
  options: {
27
42
  label: string;
28
43
  value: string | number | boolean;
@@ -40,6 +55,16 @@ type ArrayField<Props extends {
40
55
  defaultItemProps?: Props[0];
41
56
  getItemSummary?: (item: Props[0], index?: number) => string;
42
57
  };
58
+ type ObjectField<Props extends {
59
+ [key: string]: any;
60
+ } = {
61
+ [key: string]: any;
62
+ }> = BaseField & {
63
+ type: "object";
64
+ objectFields: {
65
+ [SubPropName in keyof Props[0]]: Field<Props[0][SubPropName]>;
66
+ };
67
+ };
43
68
  type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, PropShape = TableShape> = {
44
69
  name: string;
45
70
  fetchList: (adaptorParams?: AdaptorParams) => Promise<TableShape[] | null>;
@@ -63,9 +88,13 @@ type ExternalField<Props extends {
63
88
  }> = BaseField & {
64
89
  type: "external";
65
90
  placeholder?: string;
66
- fetchList: () => Promise<any[] | null>;
91
+ fetchList: (params: {
92
+ query: string;
93
+ }) => Promise<any[] | null>;
67
94
  mapProp?: (value: any) => Props;
68
95
  getItemSummary: (item: Props, index?: number) => string;
96
+ showSearch?: boolean;
97
+ initialQuery?: string;
69
98
  };
70
99
  type CustomField<Props extends {
71
100
  [key: string]: any;
@@ -85,7 +114,7 @@ type Field<Props extends {
85
114
  [key: string]: any;
86
115
  } = {
87
116
  [key: string]: any;
88
- }> = TextField | SelectField | ArrayField<Props> | ExternalField<Props> | ExternalFieldWithAdaptor<Props> | CustomField;
117
+ }> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<Props> | ObjectField<Props> | ExternalField<Props> | ExternalFieldWithAdaptor<Props> | CustomField;
89
118
  type DefaultRootProps = {
90
119
  title?: string;
91
120
  [key: string]: any;
@@ -187,10 +216,11 @@ type UiState = {
187
216
  visible?: boolean;
188
217
  expanded?: boolean;
189
218
  }>;
219
+ isDragging: boolean;
190
220
  };
191
221
  type AppState = {
192
222
  data: Data;
193
223
  ui: UiState;
194
224
  };
195
225
 
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, DefaultRootProps as a, RootData as b, ArrayField as c, Adaptor as d, ExternalField as e, CustomField as f, DefaultComponentProps 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 };
226
+ 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, NumberField as N, 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, TextareaField as d, RadioField as e, ArrayField as f, Adaptor as g, ExternalField as h, CustomField as i, Fields as j, Content as k, PuckContext as l, ComponentConfig as m, BaseData as n, ComponentData as o, RootDataWithoutProps as p, ItemWithId as q, ArrayState as r, DropZone as s };