@measured/puck 0.15.0-canary.480467a → 0.15.0-canary.91dff22

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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { U as UiState, D as Data, A as AppState, C as Config, a as DefaultRootProps, I as ItemSelector, b as DropZoneProps, F as Field, V as Viewports, c as DefaultComponentProps, M as MappedItem, R as RootDataWithProps, d as RootData, e as ComponentData } from './Config-550396e1.js';
2
- export { i as Adaptor, h as ArrayField, s as ArrayState, p as BaseData, B as BaseField, o as ComponentConfig, m as Content, k as CustomField, j as ExternalField, E as ExternalFieldWithAdaptor, l as Fields, r as ItemWithId, N as NumberField, O as ObjectField, P as PuckComponent, n as PuckContext, g as RadioField, q as RootDataWithoutProps, S as SelectField, T as TextField, f as TextareaField } from './Config-550396e1.js';
1
+ import { U as UiState, D as Data, A as AppState, F as Field, a as FieldProps, C as Config, b as DefaultRootProps, I as ItemSelector, c as DropZoneProps, V as Viewports, d as DefaultComponentProps, M as MappedItem, R as RootDataWithProps, e as RootData, f as ComponentData } from './Config-6344ec1b.js';
2
+ export { q as Adaptor, p as ArrayField, l as ArrayState, B as BaseData, m as BaseField, i as ComponentConfig, g as Content, s as CustomField, r as ExternalField, E as ExternalFieldWithAdaptor, t as Fields, k as ItemWithId, N as NumberField, O as ObjectField, P as PuckComponent, h as PuckContext, o as RadioField, j as RootDataWithoutProps, S as SelectField, T as TextField, n as TextareaField } from './Config-6344ec1b.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import { ReactNode, ReactElement, CSSProperties, SyntheticEvent } from 'react';
@@ -64,6 +64,38 @@ type PuckAction = {
64
64
  recordHistory?: boolean;
65
65
  } & (ReorderAction | InsertAction | MoveAction | ReplaceAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
66
66
 
67
+ declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }: {
68
+ children?: ReactNode;
69
+ icon?: ReactNode;
70
+ label: string;
71
+ el?: "label" | "div" | undefined;
72
+ readOnly?: boolean | undefined;
73
+ className?: string | undefined;
74
+ }) => react_jsx_runtime.JSX.Element;
75
+ type FieldLabelPropsInternal = {
76
+ children?: ReactNode;
77
+ icon?: ReactNode;
78
+ label?: string;
79
+ el?: "label" | "div";
80
+ readOnly?: boolean;
81
+ };
82
+ declare const FieldLabelInternal: ({ children, icon, label, el, readOnly, }: FieldLabelPropsInternal) => react_jsx_runtime.JSX.Element;
83
+ type FieldPropsInternalOptional<ValueType = any, F = Field<any>> = FieldProps<ValueType, F> & {
84
+ Label?: React.FC<FieldLabelPropsInternal>;
85
+ label?: string;
86
+ name?: string;
87
+ };
88
+ type FieldPropsInternal<ValueType = any, F = Field<any>> = FieldProps<ValueType, F> & {
89
+ Label: React.FC<FieldLabelPropsInternal>;
90
+ label?: string;
91
+ id: string;
92
+ name?: string;
93
+ };
94
+ declare function AutoFieldPrivate<ValueType = any, FieldType extends Field<ValueType> = Field<ValueType>>(props: FieldPropsInternalOptional<ValueType, FieldType> & {
95
+ Label?: React.FC<FieldLabelPropsInternal>;
96
+ }): react_jsx_runtime.JSX.Element;
97
+ declare function AutoField<ValueType = any, FieldType extends Field<ValueType> = Field<ValueType>>(props: FieldProps<ValueType, FieldType>): react_jsx_runtime.JSX.Element;
98
+
67
99
  declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, }: {
68
100
  children: ReactNode;
69
101
  href?: string | undefined;
@@ -149,25 +181,6 @@ declare const IconButton: ({ children, href, onClick, variant, type, disabled, t
149
181
  title: string;
150
182
  }) => react_jsx_runtime.JSX.Element;
151
183
 
152
- declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }: {
153
- children?: ReactNode;
154
- icon?: ReactNode;
155
- label: string;
156
- el?: "label" | "div" | undefined;
157
- readOnly?: boolean | undefined;
158
- className?: string | undefined;
159
- }) => react_jsx_runtime.JSX.Element;
160
- type InputProps<F = Field<any>> = {
161
- name: string;
162
- field: F;
163
- value: any;
164
- id: string;
165
- label?: string;
166
- onChange: (value: any, uiState?: Partial<UiState>) => void;
167
- readOnly?: boolean;
168
- readOnlyFields?: Record<string, boolean | undefined>;
169
- };
170
-
171
184
  type RenderFunc<Props extends {
172
185
  [key: string]: any;
173
186
  } = {
@@ -210,14 +223,16 @@ type Overrides = OverridesGeneric<{
210
223
  puck: RenderFunc;
211
224
  }>;
212
225
  type FieldRenderFunctions = Omit<{
213
- [Type in Field["type"]]: React.FunctionComponent<InputProps<Extract<Field, {
226
+ [Type in Field["type"]]: React.FunctionComponent<FieldProps<Extract<Field, {
214
227
  type: Type;
215
228
  }>> & {
216
229
  children: ReactNode;
230
+ name: string;
217
231
  }>;
218
232
  }, "custom"> & {
219
- [key: string]: React.FunctionComponent<InputProps<any> & {
233
+ [key: string]: React.FunctionComponent<FieldProps<any> & {
220
234
  children: ReactNode;
235
+ name: string;
221
236
  }>;
222
237
  };
223
238
 
@@ -232,7 +247,7 @@ type IframeConfig = {
232
247
  declare function Puck<UserConfig extends Config = Config>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe, dnd, }: {
233
248
  children?: ReactNode;
234
249
  config: UserConfig;
235
- data: Data;
250
+ data: Partial<Data>;
236
251
  ui?: Partial<UiState>;
237
252
  onChange?: (data: Data) => void;
238
253
  onPublish?: (data: Data) => void;
@@ -266,7 +281,7 @@ declare namespace Puck {
266
281
 
267
282
  declare function Render<UserConfig extends Config = Config>({ config, data, }: {
268
283
  config: UserConfig;
269
- data: Data;
284
+ data: Partial<Data>;
270
285
  }): react_jsx_runtime.JSX.Element;
271
286
 
272
287
  declare function migrate(data: Data): Data;
@@ -280,9 +295,9 @@ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps,
280
295
  [key: string]: any;
281
296
  }) => RootProps;
282
297
  }>;
283
- declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultComponentProps>(data: Data, propTransforms: PropTransform<Props, RootProps>): Data;
298
+ declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultComponentProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
284
299
 
285
- declare function resolveAllData(data: Data, config: Config, onResolveStart?: (item: MappedItem) => void, onResolveEnd?: (item: MappedItem) => void): Promise<{
300
+ declare function resolveAllData(data: Partial<Data>, config: Config, onResolveStart?: (item: MappedItem) => void, onResolveEnd?: (item: MappedItem) => void): Promise<{
286
301
  root: RootDataWithProps<DefaultRootProps> | RootData<DefaultRootProps>;
287
302
  content: any[];
288
303
  zones: Record<string, MappedItem[]>;
@@ -321,4 +336,4 @@ declare const usePuck: () => {
321
336
  }> | null;
322
337
  };
323
338
 
324
- export { AppState, Button, ComponentData, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZone, DropZoneProvider, Field, FieldLabel, IconButton, MappedItem, Puck, PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
339
+ export { AppState, AutoField, AutoFieldPrivate, Button, ComponentData, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZone, DropZoneProvider, Field, FieldLabel, FieldLabelInternal, FieldProps, FieldPropsInternal, IconButton, MappedItem, Puck, PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };