@measured/puck 0.14.0-canary.adac562 → 0.14.0-canary.bf4f527
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{Config-1b86f0dc.d.ts → Config-Bgx_Bij_.d.ts} +34 -11
- package/dist/index.css +912 -588
- package/dist/index.d.ts +45 -9
- package/dist/index.js +1720 -793
- package/dist/rsc.d.ts +1 -1
- package/package.json +5 -3
@@ -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
|
};
|
@@ -33,17 +47,11 @@ type TextareaField = BaseField & {
|
|
33
47
|
};
|
34
48
|
type SelectField = BaseField & {
|
35
49
|
type: "select";
|
36
|
-
options:
|
37
|
-
label: string;
|
38
|
-
value: string | number | boolean;
|
39
|
-
}[];
|
50
|
+
options: FieldOptions;
|
40
51
|
};
|
41
52
|
type RadioField = BaseField & {
|
42
53
|
type: "radio";
|
43
|
-
options:
|
44
|
-
label: string;
|
45
|
-
value: string | number | boolean;
|
46
|
-
}[];
|
54
|
+
options: FieldOptions;
|
47
55
|
};
|
48
56
|
type ArrayField<Props extends {
|
49
57
|
[key: string]: any;
|
@@ -56,6 +64,8 @@ type ArrayField<Props extends {
|
|
56
64
|
};
|
57
65
|
defaultItemProps?: Props[0];
|
58
66
|
getItemSummary?: (item: Props[0], index?: number) => string;
|
67
|
+
max?: number;
|
68
|
+
min?: number;
|
59
69
|
};
|
60
70
|
type ObjectField<Props extends {
|
61
71
|
[key: string]: any;
|
@@ -64,7 +74,7 @@ type ObjectField<Props extends {
|
|
64
74
|
}> = BaseField & {
|
65
75
|
type: "object";
|
66
76
|
objectFields: {
|
67
|
-
[SubPropName in keyof Props
|
77
|
+
[SubPropName in keyof Props]: Field<Props[SubPropName]>;
|
68
78
|
};
|
69
79
|
};
|
70
80
|
type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, PropShape = TableShape> = {
|
@@ -92,11 +102,15 @@ type ExternalField<Props extends {
|
|
92
102
|
placeholder?: string;
|
93
103
|
fetchList: (params: {
|
94
104
|
query: string;
|
105
|
+
filters: Record<string, any>;
|
95
106
|
}) => Promise<any[] | null>;
|
96
107
|
mapProp?: (value: any) => Props;
|
108
|
+
mapRow?: (value: any) => Record<string, string | number>;
|
97
109
|
getItemSummary: (item: Props, index?: number) => string;
|
98
110
|
showSearch?: boolean;
|
99
111
|
initialQuery?: string;
|
112
|
+
filterFields?: Record<string, Field>;
|
113
|
+
initialFilters?: Record<string, any>;
|
100
114
|
};
|
101
115
|
type CustomField<Props extends {
|
102
116
|
[key: string]: any;
|
@@ -141,6 +155,7 @@ type PuckContext = {
|
|
141
155
|
};
|
142
156
|
type ComponentConfig<ComponentProps extends DefaultComponentProps = DefaultComponentProps, DefaultProps = ComponentProps, DataShape = ComponentData<ComponentProps>> = {
|
143
157
|
render: PuckComponent<ComponentProps>;
|
158
|
+
label?: string;
|
144
159
|
defaultProps?: DefaultProps;
|
145
160
|
fields?: Fields<ComponentProps>;
|
146
161
|
resolveData?: (data: DataShape, params: {
|
@@ -219,10 +234,18 @@ type UiState = {
|
|
219
234
|
expanded?: boolean;
|
220
235
|
}>;
|
221
236
|
isDragging: boolean;
|
237
|
+
viewports: {
|
238
|
+
current: {
|
239
|
+
width: number;
|
240
|
+
height: number | "auto";
|
241
|
+
};
|
242
|
+
controlsVisible: boolean;
|
243
|
+
options: Viewport[];
|
244
|
+
};
|
222
245
|
};
|
223
246
|
type AppState = {
|
224
247
|
data: Data;
|
225
248
|
ui: UiState;
|
226
249
|
};
|
227
250
|
|
228
|
-
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 { type AppState as A, type BaseField as B, type Config as C, type Data as D, type ExternalFieldWithAdaptor as E, type Field as F, type ItemSelector as I, type MappedItem as M, type NumberField as N, type ObjectField as O, type PuckComponent as P, type RootDataWithProps as R, type SelectField as S, type TextField as T, type UiState as U, type Viewports as V, type DefaultComponentProps as a, type DefaultRootProps as b, type RootData as c, type TextareaField as d, type RadioField as e, type ArrayField as f, type Adaptor as g, type ExternalField as h, type CustomField as i, type Fields as j, type Content as k, type PuckContext as l, type ComponentConfig as m, type BaseData as n, type ComponentData as o, type RootDataWithoutProps as p, type ItemWithId as q, type ArrayState as r, DropZone as s };
|