@measured/puck 0.13.2-canary.7d861f5 → 0.14.0-canary.03dd90b
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{Config-5804f327.d.ts → Config-29dc2731.d.ts} +36 -11
- package/dist/index.css +894 -570
- package/dist/index.d.ts +44 -8
- package/dist/index.js +1406 -655
- package/dist/rsc.d.ts +1 -1
- package/package.json +4 -2
@@ -1,4 +1,4 @@
|
|
1
|
-
import { CSSProperties,
|
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,9 +14,23 @@ 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
|
};
|
29
|
+
type FieldOption = {
|
30
|
+
label: string;
|
31
|
+
value: string | number | boolean;
|
32
|
+
};
|
33
|
+
type FieldOptions = Array<FieldOption> | ReadonlyArray<FieldOption>;
|
20
34
|
type BaseField = {
|
21
35
|
label?: string;
|
22
36
|
};
|
@@ -25,23 +39,19 @@ type TextField = BaseField & {
|
|
25
39
|
};
|
26
40
|
type NumberField = BaseField & {
|
27
41
|
type: "number";
|
42
|
+
min?: number;
|
43
|
+
max?: number;
|
28
44
|
};
|
29
45
|
type TextareaField = BaseField & {
|
30
46
|
type: "textarea";
|
31
47
|
};
|
32
48
|
type SelectField = BaseField & {
|
33
49
|
type: "select";
|
34
|
-
options:
|
35
|
-
label: string;
|
36
|
-
value: string | number | boolean;
|
37
|
-
}[];
|
50
|
+
options: FieldOptions;
|
38
51
|
};
|
39
52
|
type RadioField = BaseField & {
|
40
53
|
type: "radio";
|
41
|
-
options:
|
42
|
-
label: string;
|
43
|
-
value: string | number | boolean;
|
44
|
-
}[];
|
54
|
+
options: FieldOptions;
|
45
55
|
};
|
46
56
|
type ArrayField<Props extends {
|
47
57
|
[key: string]: any;
|
@@ -54,6 +64,8 @@ type ArrayField<Props extends {
|
|
54
64
|
};
|
55
65
|
defaultItemProps?: Props[0];
|
56
66
|
getItemSummary?: (item: Props[0], index?: number) => string;
|
67
|
+
max?: number;
|
68
|
+
min?: number;
|
57
69
|
};
|
58
70
|
type ObjectField<Props extends {
|
59
71
|
[key: string]: any;
|
@@ -62,7 +74,7 @@ type ObjectField<Props extends {
|
|
62
74
|
}> = BaseField & {
|
63
75
|
type: "object";
|
64
76
|
objectFields: {
|
65
|
-
[SubPropName in keyof Props
|
77
|
+
[SubPropName in keyof Props]: Field<Props[SubPropName]>;
|
66
78
|
};
|
67
79
|
};
|
68
80
|
type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, PropShape = TableShape> = {
|
@@ -90,11 +102,15 @@ type ExternalField<Props extends {
|
|
90
102
|
placeholder?: string;
|
91
103
|
fetchList: (params: {
|
92
104
|
query: string;
|
105
|
+
filters: Record<string, any>;
|
93
106
|
}) => Promise<any[] | null>;
|
94
107
|
mapProp?: (value: any) => Props;
|
108
|
+
mapRow?: (value: any) => Record<string, string | number>;
|
95
109
|
getItemSummary: (item: Props, index?: number) => string;
|
96
110
|
showSearch?: boolean;
|
97
111
|
initialQuery?: string;
|
112
|
+
filterFields?: Record<string, Field>;
|
113
|
+
initialFilters?: Record<string, any>;
|
98
114
|
};
|
99
115
|
type CustomField<Props extends {
|
100
116
|
[key: string]: any;
|
@@ -139,6 +155,7 @@ type PuckContext = {
|
|
139
155
|
};
|
140
156
|
type ComponentConfig<ComponentProps extends DefaultComponentProps = DefaultComponentProps, DefaultProps = ComponentProps, DataShape = ComponentData<ComponentProps>> = {
|
141
157
|
render: PuckComponent<ComponentProps>;
|
158
|
+
label?: string;
|
142
159
|
defaultProps?: DefaultProps;
|
143
160
|
fields?: Fields<ComponentProps>;
|
144
161
|
resolveData?: (data: DataShape, params: {
|
@@ -217,10 +234,18 @@ type UiState = {
|
|
217
234
|
expanded?: boolean;
|
218
235
|
}>;
|
219
236
|
isDragging: boolean;
|
237
|
+
viewports: {
|
238
|
+
current: {
|
239
|
+
width: number;
|
240
|
+
height: number | "auto";
|
241
|
+
};
|
242
|
+
controlsVisible: boolean;
|
243
|
+
options: Viewport[];
|
244
|
+
};
|
220
245
|
};
|
221
246
|
type AppState = {
|
222
247
|
data: Data;
|
223
248
|
ui: UiState;
|
224
249
|
};
|
225
250
|
|
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 };
|
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 };
|