@measured/puck 0.11.3-canary.ab9d43f → 0.12.0-canary.01939fc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -456
- package/dist/Config-a03de579.d.ts +196 -0
- package/dist/index.css +287 -150
- package/dist/index.d.ts +22 -208
- package/dist/index.js +572 -690
- package/dist/rsc.d.ts +10 -0
- package/dist/rsc.js +135 -0
- package/package.json +24 -4
package/dist/index.d.ts
CHANGED
@@ -1,203 +1,9 @@
|
|
1
|
-
import
|
2
|
-
|
1
|
+
import { U as UiState, D as Data, A as AppState, C as Config, I as ItemSelector, M as MappedItem, R as RootDataWithProps, a as DefaultRootProps, b as RootData } from './Config-a03de579.js';
|
2
|
+
export { d as Adaptor, c as ArrayField, p as ArrayState, l as BaseData, B as BaseField, k as ComponentConfig, m as ComponentData, i as Content, f as CustomField, g as DefaultComponentProps, q as DropZone, e as ExternalField, E as ExternalFieldWithAdaptor, F as Field, h as Fields, o as ItemWithId, P as PuckComponent, j as PuckContext, n as RootDataWithoutProps, S as SelectField, T as TextField } from './Config-a03de579.js';
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
4
|
-
import
|
5
|
-
|
6
|
-
|
7
|
-
index: number;
|
8
|
-
zone?: string;
|
9
|
-
};
|
10
|
-
|
11
|
-
type WithPuckProps<Props> = Props & {
|
12
|
-
id: string;
|
13
|
-
};
|
14
|
-
type BaseField = {
|
15
|
-
label?: string;
|
16
|
-
};
|
17
|
-
type TextField = BaseField & {
|
18
|
-
type: "text" | "number" | "textarea";
|
19
|
-
};
|
20
|
-
type SelectField = BaseField & {
|
21
|
-
type: "select" | "radio";
|
22
|
-
options: {
|
23
|
-
label: string;
|
24
|
-
value: string | number | boolean;
|
25
|
-
}[];
|
26
|
-
};
|
27
|
-
type ArrayField<Props extends {
|
28
|
-
[key: string]: any;
|
29
|
-
} = {
|
30
|
-
[key: string]: any;
|
31
|
-
}> = BaseField & {
|
32
|
-
type: "array";
|
33
|
-
arrayFields: {
|
34
|
-
[SubPropName in keyof Props[0]]: Field<Props[0][SubPropName]>;
|
35
|
-
};
|
36
|
-
defaultItemProps?: Props[0];
|
37
|
-
getItemSummary?: (item: Props[0], index?: number) => string;
|
38
|
-
};
|
39
|
-
type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, PropShape = TableShape> = {
|
40
|
-
name: string;
|
41
|
-
fetchList: (adaptorParams?: AdaptorParams) => Promise<TableShape[] | null>;
|
42
|
-
mapProp?: (value: TableShape) => PropShape;
|
43
|
-
};
|
44
|
-
type ExternalFieldWithAdaptor<Props extends {
|
45
|
-
[key: string]: any;
|
46
|
-
} = {
|
47
|
-
[key: string]: any;
|
48
|
-
}> = BaseField & {
|
49
|
-
type: "external";
|
50
|
-
placeholder?: string;
|
51
|
-
adaptor: Adaptor<any, any, Props>;
|
52
|
-
adaptorParams?: object;
|
53
|
-
getItemSummary: (item: Props, index?: number) => string;
|
54
|
-
};
|
55
|
-
type ExternalField<Props extends {
|
56
|
-
[key: string]: any;
|
57
|
-
} = {
|
58
|
-
[key: string]: any;
|
59
|
-
}> = BaseField & {
|
60
|
-
type: "external";
|
61
|
-
placeholder?: string;
|
62
|
-
fetchList: () => Promise<any[] | null>;
|
63
|
-
mapProp?: (value: any) => Props;
|
64
|
-
getItemSummary: (item: Props, index?: number) => string;
|
65
|
-
};
|
66
|
-
type CustomField<Props extends {
|
67
|
-
[key: string]: any;
|
68
|
-
} = {
|
69
|
-
[key: string]: any;
|
70
|
-
}> = BaseField & {
|
71
|
-
type: "custom";
|
72
|
-
render: (props: {
|
73
|
-
field: CustomField;
|
74
|
-
name: string;
|
75
|
-
value: any;
|
76
|
-
onChange: (value: Props) => void;
|
77
|
-
readOnly?: boolean;
|
78
|
-
}) => ReactElement;
|
79
|
-
};
|
80
|
-
type Field<Props extends {
|
81
|
-
[key: string]: any;
|
82
|
-
} = {
|
83
|
-
[key: string]: any;
|
84
|
-
}> = TextField | SelectField | ArrayField<Props> | ExternalField<Props> | ExternalFieldWithAdaptor<Props> | CustomField;
|
85
|
-
type DefaultRootProps = {
|
86
|
-
title?: string;
|
87
|
-
[key: string]: any;
|
88
|
-
};
|
89
|
-
type DefaultRootRenderProps = {
|
90
|
-
editMode: boolean;
|
91
|
-
} & DefaultRootProps;
|
92
|
-
type DefaultComponentProps = {
|
93
|
-
[key: string]: any;
|
94
|
-
editMode?: boolean;
|
95
|
-
};
|
96
|
-
type Fields<ComponentProps extends DefaultComponentProps = DefaultComponentProps> = {
|
97
|
-
[PropName in keyof Omit<Required<ComponentProps>, "children" | "editMode">]: Field<ComponentProps[PropName]>;
|
98
|
-
};
|
99
|
-
type Content<Props extends {
|
100
|
-
[key: string]: any;
|
101
|
-
} = {
|
102
|
-
[key: string]: any;
|
103
|
-
}> = ComponentData<Props>[];
|
104
|
-
type ComponentConfig<ComponentProps extends DefaultComponentProps = DefaultComponentProps, DefaultProps = ComponentProps, DataShape = ComponentData<ComponentProps>> = {
|
105
|
-
render: (props: WithPuckProps<ComponentProps>) => ReactElement;
|
106
|
-
defaultProps?: DefaultProps;
|
107
|
-
fields?: Fields<ComponentProps>;
|
108
|
-
resolveData?: (data: DataShape, params: {
|
109
|
-
changed: Partial<Record<keyof ComponentProps, boolean>>;
|
110
|
-
}) => Promise<Partial<ComponentDataWithOptionalProps<ComponentProps>>> | Partial<ComponentDataWithOptionalProps<ComponentProps>>;
|
111
|
-
};
|
112
|
-
type Category<ComponentName> = {
|
113
|
-
components?: ComponentName[];
|
114
|
-
title?: string;
|
115
|
-
visible?: boolean;
|
116
|
-
defaultExpanded?: boolean;
|
117
|
-
};
|
118
|
-
type Config<Props extends {
|
119
|
-
[key: string]: any;
|
120
|
-
} = {
|
121
|
-
[key: string]: any;
|
122
|
-
}, RootProps extends DefaultRootProps = DefaultRootProps, CategoryName extends string = string> = {
|
123
|
-
categories?: Record<CategoryName, Category<keyof Props>> & {
|
124
|
-
other?: Category<Props>;
|
125
|
-
};
|
126
|
-
components: {
|
127
|
-
[ComponentName in keyof Props]: Omit<ComponentConfig<Props[ComponentName], Props[ComponentName]>, "type">;
|
128
|
-
};
|
129
|
-
root?: Partial<ComponentConfig<RootProps & {
|
130
|
-
children: ReactNode;
|
131
|
-
}, Partial<RootProps & {
|
132
|
-
children: ReactNode;
|
133
|
-
}>, RootDataWithProps<RootProps>>>;
|
134
|
-
};
|
135
|
-
type BaseData<Props extends {
|
136
|
-
[key: string]: any;
|
137
|
-
} = {
|
138
|
-
[key: string]: any;
|
139
|
-
}> = {
|
140
|
-
readOnly?: Partial<Record<keyof Props, boolean>>;
|
141
|
-
};
|
142
|
-
type ComponentData<Props extends DefaultComponentProps = DefaultComponentProps> = {
|
143
|
-
type: keyof Props;
|
144
|
-
props: WithPuckProps<Props>;
|
145
|
-
} & BaseData<Props>;
|
146
|
-
type RootDataWithProps<Props extends DefaultRootProps = DefaultRootProps> = {
|
147
|
-
props: Props;
|
148
|
-
};
|
149
|
-
type RootDataWithoutProps<Props extends DefaultRootProps = DefaultRootProps> = Props;
|
150
|
-
type RootData<Props extends DefaultRootProps = DefaultRootProps> = BaseData<Props> & Partial<RootDataWithProps<Props>> & Partial<RootDataWithoutProps<Props>>;
|
151
|
-
type ComponentDataWithOptionalProps<Props extends {
|
152
|
-
[key: string]: any;
|
153
|
-
} = {
|
154
|
-
[key: string]: any;
|
155
|
-
}> = Omit<ComponentData, "props"> & {
|
156
|
-
props: Partial<WithPuckProps<Props>>;
|
157
|
-
};
|
158
|
-
type MappedItem = ComponentData;
|
159
|
-
type Data<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultRootProps = DefaultRootProps> = {
|
160
|
-
root: RootData<RootProps>;
|
161
|
-
content: Content<WithPuckProps<Props>>;
|
162
|
-
zones?: Record<string, Content<WithPuckProps<Props>>>;
|
163
|
-
};
|
164
|
-
type ItemWithId = {
|
165
|
-
_arrayId: string;
|
166
|
-
data: any;
|
167
|
-
};
|
168
|
-
type ArrayState = {
|
169
|
-
items: ItemWithId[];
|
170
|
-
openId: string;
|
171
|
-
};
|
172
|
-
type UiState = {
|
173
|
-
leftSideBarVisible: boolean;
|
174
|
-
itemSelector: ItemSelector | null;
|
175
|
-
arrayState: Record<string, ArrayState | undefined>;
|
176
|
-
componentList: Record<string, {
|
177
|
-
components?: string[];
|
178
|
-
title?: string;
|
179
|
-
visible?: boolean;
|
180
|
-
expanded?: boolean;
|
181
|
-
}>;
|
182
|
-
};
|
183
|
-
type AppState = {
|
184
|
-
data: Data;
|
185
|
-
ui: UiState;
|
186
|
-
};
|
187
|
-
|
188
|
-
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, }: {
|
189
|
-
children: ReactNode;
|
190
|
-
href?: string | undefined;
|
191
|
-
onClick?: ((e: any) => void | Promise<void>) | undefined;
|
192
|
-
variant?: "primary" | "secondary" | undefined;
|
193
|
-
type?: "button" | "submit" | "reset" | undefined;
|
194
|
-
disabled?: boolean | undefined;
|
195
|
-
tabIndex?: number | undefined;
|
196
|
-
newTab?: boolean | undefined;
|
197
|
-
fullWidth?: boolean | undefined;
|
198
|
-
icon?: ReactNode;
|
199
|
-
size?: "medium" | "large" | undefined;
|
200
|
-
}) => react_jsx_runtime.JSX.Element;
|
4
|
+
import * as react from 'react';
|
5
|
+
import { ReactNode, CSSProperties, SyntheticEvent, ReactElement } from 'react';
|
6
|
+
import { DragStart, DragUpdate } from '@hello-pangea/dnd';
|
201
7
|
|
202
8
|
type InsertAction = {
|
203
9
|
type: "insert";
|
@@ -293,18 +99,26 @@ declare const DropZoneProvider: ({ children, value, }: {
|
|
293
99
|
value: DropZoneContext;
|
294
100
|
}) => react_jsx_runtime.JSX.Element;
|
295
101
|
|
296
|
-
type
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
102
|
+
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, }: {
|
103
|
+
children: ReactNode;
|
104
|
+
href?: string | undefined;
|
105
|
+
onClick?: ((e: any) => void | Promise<void>) | undefined;
|
106
|
+
variant?: "primary" | "secondary" | undefined;
|
107
|
+
type?: "reset" | "submit" | "button" | undefined;
|
108
|
+
disabled?: boolean | undefined;
|
109
|
+
tabIndex?: number | undefined;
|
110
|
+
newTab?: boolean | undefined;
|
111
|
+
fullWidth?: boolean | undefined;
|
112
|
+
icon?: ReactNode;
|
113
|
+
size?: "medium" | "large" | undefined;
|
114
|
+
}) => react_jsx_runtime.JSX.Element;
|
301
115
|
|
302
116
|
declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, }: {
|
303
117
|
children: ReactNode;
|
304
118
|
href?: string | undefined;
|
305
|
-
onClick?: ((e:
|
119
|
+
onClick?: ((e: SyntheticEvent) => void | Promise<void>) | undefined;
|
306
120
|
variant?: "primary" | "secondary" | undefined;
|
307
|
-
type?: "
|
121
|
+
type?: "reset" | "submit" | "button" | undefined;
|
308
122
|
disabled?: boolean | undefined;
|
309
123
|
tabIndex?: number | undefined;
|
310
124
|
newTab?: boolean | undefined;
|
@@ -369,9 +183,9 @@ declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }:
|
|
369
183
|
children?: ReactNode;
|
370
184
|
icon?: ReactNode;
|
371
185
|
label: string;
|
372
|
-
el?: "
|
186
|
+
el?: "label" | "div" | undefined;
|
373
187
|
readOnly?: boolean | undefined;
|
374
188
|
className?: string | undefined;
|
375
189
|
}) => react_jsx_runtime.JSX.Element;
|
376
190
|
|
377
|
-
export {
|
191
|
+
export { AppState, Button, Config, Data, DefaultRootProps, DropZoneProvider, FieldLabel, IconButton, MappedItem, Puck, Render, RootData, RootDataWithProps, UiState, dropZoneContext, resolveAllData };
|