@measured/puck 0.14.0-canary.55740c4 → 0.14.0-canary.70cf177

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- import { CSSProperties, ReactElement, ReactNode } from 'react';
1
+ import { CSSProperties, ReactNode, ReactElement } from 'react';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
 
4
4
  type ItemSelector = {
@@ -14,6 +14,15 @@ type DropZoneProps = {
14
14
  };
15
15
  declare function DropZone(props: DropZoneProps): react_jsx_runtime.JSX.Element;
16
16
 
17
+ type iconTypes = "Smartphone" | "Monitor" | "Tablet";
18
+ type Viewport = {
19
+ width: number;
20
+ height?: number | "auto";
21
+ label?: string;
22
+ icon?: iconTypes | ReactNode;
23
+ };
24
+ type Viewports = Viewport[];
25
+
17
26
  type WithPuckProps<Props> = Props & {
18
27
  id: string;
19
28
  };
@@ -55,6 +64,8 @@ type ArrayField<Props extends {
55
64
  };
56
65
  defaultItemProps?: Props[0];
57
66
  getItemSummary?: (item: Props[0], index?: number) => string;
67
+ max?: number;
68
+ min?: number;
58
69
  };
59
70
  type ObjectField<Props extends {
60
71
  [key: string]: any;
@@ -63,7 +74,7 @@ type ObjectField<Props extends {
63
74
  }> = BaseField & {
64
75
  type: "object";
65
76
  objectFields: {
66
- [SubPropName in keyof Props[0]]: Field<Props[0][SubPropName]>;
77
+ [SubPropName in keyof Props]: Field<Props[SubPropName]>;
67
78
  };
68
79
  };
69
80
  type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, PropShape = TableShape> = {
@@ -91,11 +102,15 @@ type ExternalField<Props extends {
91
102
  placeholder?: string;
92
103
  fetchList: (params: {
93
104
  query: string;
105
+ filters: Record<string, any>;
94
106
  }) => Promise<any[] | null>;
95
107
  mapProp?: (value: any) => Props;
108
+ mapRow?: (value: any) => Record<string, string | number>;
96
109
  getItemSummary: (item: Props, index?: number) => string;
97
110
  showSearch?: boolean;
98
111
  initialQuery?: string;
112
+ filterFields?: Record<string, Field>;
113
+ initialFilters?: Record<string, any>;
99
114
  };
100
115
  type CustomField<Props extends {
101
116
  [key: string]: any;
@@ -140,6 +155,7 @@ type PuckContext = {
140
155
  };
141
156
  type ComponentConfig<ComponentProps extends DefaultComponentProps = DefaultComponentProps, DefaultProps = ComponentProps, DataShape = ComponentData<ComponentProps>> = {
142
157
  render: PuckComponent<ComponentProps>;
158
+ label?: string;
143
159
  defaultProps?: DefaultProps;
144
160
  fields?: Fields<ComponentProps>;
145
161
  resolveData?: (data: DataShape, params: {
@@ -218,10 +234,18 @@ type UiState = {
218
234
  expanded?: boolean;
219
235
  }>;
220
236
  isDragging: boolean;
237
+ viewports: {
238
+ current: {
239
+ width: number;
240
+ height: number | "auto";
241
+ };
242
+ controlsVisible: boolean;
243
+ options: Viewport[];
244
+ };
221
245
  };
222
246
  type AppState = {
223
247
  data: Data;
224
248
  ui: UiState;
225
249
  };
226
250
 
227
- 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 };
251
+ 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, Viewports as V, 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 };