@measured/puck 0.16.0-canary.3298831 → 0.16.0-canary.39cd3a0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { U as UiState, D as Data, A as AppState, I as ItemSelector, F as Field, a as FieldProps, C as Config, b as DropZoneProps, V as Viewports, c as DefaultComponentProps, d as DefaultRootProps, M as MappedItem, R as RootData, e as RootDataWithProps, f as ComponentData } from './Config-VOJqVbHe.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-VOJqVbHe.js';
1
+ import { U as UiState, D as Data, A as AppState, I as ItemSelector, F as Field, a as FieldProps, C as Config, b as DropZoneProps, P as Permissions, V as Viewports, c as DefaultComponentProps, d as DefaultRootProps, M as MappedItem, R as RootData, e as RootDataWithProps, f as ComponentData } from './Config-CkVFT1_w.js';
2
+ export { r as Adaptor, q as ArrayField, m as ArrayState, B as BaseData, n as BaseField, j as ComponentConfig, g as Content, t as CustomField, s as ExternalField, E as ExternalFieldWithAdaptor, u as Fields, l as ItemWithId, N as NumberField, O as ObjectField, h as PuckComponent, i as PuckContext, p as RadioField, k as RootDataWithoutProps, S as SelectField, T as TextField, o as TextareaField } from './Config-CkVFT1_w.js';
3
3
  import * as react from 'react';
4
- import { ReactNode, ReactElement, CSSProperties, SyntheticEvent } from 'react';
4
+ import { ReactNode, ReactElement, SyntheticEvent, CSSProperties } from 'react';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import { DragStart, DragUpdate } from '@measured/dnd';
7
7
 
@@ -81,6 +81,10 @@ type Overrides = OverridesGeneric<{
81
81
  actions: ReactNode;
82
82
  children: ReactNode;
83
83
  }>;
84
+ actionBar: RenderFunc<{
85
+ label?: string;
86
+ children: ReactNode;
87
+ }>;
84
88
  headerActions: RenderFunc<{
85
89
  children: ReactNode;
86
90
  }>;
@@ -103,6 +107,10 @@ type Overrides = OverridesGeneric<{
103
107
  children: ReactNode;
104
108
  name: string;
105
109
  }>;
110
+ iframe: RenderFunc<{
111
+ children: ReactNode;
112
+ document?: Document;
113
+ }>;
106
114
  outline: RenderFunc;
107
115
  puck: RenderFunc;
108
116
  }>;
@@ -124,6 +132,23 @@ type Plugin = {
124
132
  overrides: Partial<Overrides>;
125
133
  };
126
134
 
135
+ declare const ActionBar: {
136
+ ({ label, children, }: {
137
+ label?: string;
138
+ children?: ReactNode;
139
+ }): react_jsx_runtime.JSX.Element;
140
+ Action: ({ children, label, onClick, }: {
141
+ children: ReactNode;
142
+ label?: string;
143
+ onClick: (e: SyntheticEvent) => void;
144
+ }) => react_jsx_runtime.JSX.Element;
145
+ };
146
+ declare const Action: ({ children, label, onClick, }: {
147
+ children: ReactNode;
148
+ label?: string;
149
+ onClick: (e: SyntheticEvent) => void;
150
+ }) => react_jsx_runtime.JSX.Element;
151
+
127
152
  declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }: {
128
153
  children?: ReactNode;
129
154
  icon?: ReactNode;
@@ -177,7 +202,7 @@ declare const Drawer: {
177
202
  droppableId?: string;
178
203
  direction?: "vertical" | "horizontal";
179
204
  }): react_jsx_runtime.JSX.Element;
180
- Item: ({ name, children, id, label, index, }: {
205
+ Item: ({ name, children, id, label, index, isDragDisabled, }: {
181
206
  name: string;
182
207
  children?: (props: {
183
208
  children: ReactNode;
@@ -186,6 +211,7 @@ declare const Drawer: {
186
211
  id?: string;
187
212
  label?: string;
188
213
  index: number;
214
+ isDragDisabled?: boolean;
189
215
  }) => react_jsx_runtime.JSX.Element;
190
216
  };
191
217
 
@@ -266,7 +292,7 @@ type IframeConfig = {
266
292
  enabled?: boolean;
267
293
  };
268
294
 
269
- declare function Puck<UserConfig extends Config = Config>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, onAction, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe, dnd, initialHistory, }: {
295
+ declare function Puck<UserConfig extends Config = Config>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, onAction, permissions, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe, dnd, initialHistory, }: {
270
296
  children?: ReactNode;
271
297
  config: UserConfig;
272
298
  data: Partial<Data>;
@@ -274,6 +300,7 @@ declare function Puck<UserConfig extends Config = Config>({ children, config, da
274
300
  onChange?: (data: Data) => void;
275
301
  onPublish?: (data: Data) => void;
276
302
  onAction?: OnAction;
303
+ permissions?: Partial<Permissions>;
277
304
  plugins?: Plugin[];
278
305
  overrides?: Partial<Overrides>;
279
306
  renderHeader?: (props: {
@@ -334,6 +361,17 @@ declare const usePuck: () => {
334
361
  appState: AppState;
335
362
  config: Config;
336
363
  dispatch: (action: PuckAction) => void;
364
+ getPermissions: ({ item, type, }?: {
365
+ item?: ComponentData;
366
+ type?: keyof DefaultComponentProps;
367
+ }) => {
368
+ [x: string]: boolean | undefined;
369
+ drag?: boolean | undefined;
370
+ duplicate?: boolean | undefined;
371
+ delete?: boolean | undefined;
372
+ edit?: boolean | undefined;
373
+ insert?: boolean | undefined;
374
+ };
337
375
  history: {
338
376
  back: VoidFunction;
339
377
  forward: VoidFunction;
@@ -350,4 +388,4 @@ declare const usePuck: () => {
350
388
  }> | null;
351
389
  };
352
390
 
353
- export { AppState, AutoField, AutoFieldPrivate, Button, ComponentData, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZone, DropZoneProvider, Field, FieldLabel, FieldLabelInternal, FieldProps, type FieldPropsInternal, type History, IconButton, MappedItem, type Plugin, Puck, type PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
391
+ export { Action, ActionBar, AppState, AutoField, AutoFieldPrivate, Button, ComponentData, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZone, DropZoneProvider, Field, FieldLabel, FieldLabelInternal, FieldProps, type FieldPropsInternal, type History, IconButton, MappedItem, Permissions, type Plugin, Puck, type PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };