@measured/puck 0.15.0-canary.dd7051e → 0.15.0-canary.e2cd445

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,9 +21,6 @@ type Viewport = {
21
21
  };
22
22
  type Viewports = Viewport[];
23
23
 
24
- type WithPuckProps<Props> = Props & {
25
- id: string;
26
- };
27
24
  type FieldOption = {
28
25
  label: string;
29
26
  value: string | number | boolean;
@@ -114,17 +111,36 @@ type CustomField<Props extends any = {}> = BaseField & {
114
111
  type: "custom";
115
112
  render: (props: {
116
113
  field: CustomField<Props>;
117
- name: string;
114
+ name?: string;
115
+ id: string;
118
116
  value: Props;
119
117
  onChange: (value: Props) => void;
120
118
  readOnly?: boolean;
121
119
  }) => ReactElement;
122
120
  };
123
- type Field<Props extends {
121
+ type Field<Props extends any = any> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<Props extends {
124
122
  [key: string]: any;
125
- } = {
123
+ } ? Props : any> | ObjectField<Props extends {
124
+ [key: string]: any;
125
+ } ? Props : any> | ExternalField<Props extends {
126
126
  [key: string]: any;
127
- }> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<Props> | ObjectField<Props> | ExternalField<Props> | ExternalFieldWithAdaptor<Props> | CustomField<Props>;
127
+ } ? Props : any> | ExternalFieldWithAdaptor<Props extends {
128
+ [key: string]: any;
129
+ } ? Props : any> | CustomField<Props>;
130
+ type Fields<ComponentProps extends DefaultComponentProps = DefaultComponentProps> = {
131
+ [PropName in keyof Omit<Required<ComponentProps>, "children" | "editMode">]: Field<ComponentProps[PropName]>;
132
+ };
133
+ type FieldProps<ValueType = any, F = Field<any>> = {
134
+ field: F;
135
+ value: ValueType;
136
+ id?: string;
137
+ onChange: (value: ValueType, uiState?: Partial<UiState>) => void;
138
+ readOnly?: boolean;
139
+ };
140
+
141
+ type WithPuckProps<Props> = Props & {
142
+ id: string;
143
+ };
128
144
  type DefaultRootProps = {
129
145
  title?: string;
130
146
  [key: string]: any;
@@ -133,9 +149,6 @@ type DefaultComponentProps = {
133
149
  [key: string]: any;
134
150
  editMode?: boolean;
135
151
  };
136
- type Fields<ComponentProps extends DefaultComponentProps = DefaultComponentProps> = {
137
- [PropName in keyof Omit<Required<ComponentProps>, "children" | "editMode">]: Field<ComponentProps[PropName]>;
138
- };
139
152
  type Content<Props extends {
140
153
  [key: string]: any;
141
154
  } = {
@@ -146,6 +159,7 @@ type PuckComponent<Props> = (props: WithPuckProps<Props & {
146
159
  }>) => JSX.Element;
147
160
  type PuckContext = {
148
161
  renderDropZone: React.FC<DropZoneProps>;
162
+ isEditing: boolean;
149
163
  };
150
164
  type ComponentConfig<ComponentProps extends DefaultComponentProps = DefaultComponentProps, DefaultProps = ComponentProps, DataShape = Omit<ComponentData<ComponentProps>, "type">> = {
151
165
  render: PuckComponent<ComponentProps>;
@@ -245,4 +259,4 @@ type AppState = {
245
259
  ui: UiState;
246
260
  };
247
261
 
248
- 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, DefaultRootProps as a, DropZoneProps as b, DefaultComponentProps as c, RootData as d, ComponentData as e, TextareaField as f, RadioField as g, ArrayField as h, Adaptor as i, ExternalField as j, CustomField as k, Fields as l, Content as m, PuckContext as n, ComponentConfig as o, BaseData as p, RootDataWithoutProps as q, ItemWithId as r, ArrayState as s };
262
+ export { AppState as A, BaseData 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, FieldProps as a, DefaultRootProps as b, DropZoneProps as c, DefaultComponentProps as d, RootData as e, ComponentData as f, Content as g, PuckContext as h, ComponentConfig as i, RootDataWithoutProps as j, ItemWithId as k, ArrayState as l, BaseField as m, TextareaField as n, RadioField as o, ArrayField as p, Adaptor as q, ExternalField as r, CustomField as s, Fields as t };