@measured/puck 0.16.0-canary.eb42734 → 0.16.0-canary.f0655f0

Sign up to get free protection for your applications and to get access to all the features.
@@ -68,7 +68,7 @@ type ObjectField<Props extends {
68
68
  [key: string]: any;
69
69
  }> = BaseField & {
70
70
  type: "object";
71
- objectFields: {
71
+ objectFields: Props extends any[] ? never : {
72
72
  [SubPropName in keyof Props]: Field<Props[SubPropName]>;
73
73
  };
74
74
  };
@@ -166,6 +166,7 @@ type ComponentConfig<ComponentProps extends DefaultComponentProps = DefaultCompo
166
166
  label?: string;
167
167
  defaultProps?: DefaultProps;
168
168
  fields?: Fields<ComponentProps>;
169
+ permissions?: Partial<Permissions>;
169
170
  resolveFields?: (data: DataShape, params: {
170
171
  changed: Partial<Record<keyof ComponentProps, boolean>>;
171
172
  fields: Fields<ComponentProps>;
@@ -183,6 +184,12 @@ type ComponentConfig<ComponentProps extends DefaultComponentProps = DefaultCompo
183
184
  props?: Partial<ComponentProps>;
184
185
  readOnly?: Partial<Record<keyof ComponentProps, boolean>>;
185
186
  };
187
+ resolvePermissions?: (data: DataShape, params: {
188
+ changed: Partial<Record<keyof ComponentProps, boolean>>;
189
+ lastPermissions: Partial<Permissions> | undefined;
190
+ initialPermissions: Partial<Permissions>;
191
+ appState: AppState;
192
+ }) => Partial<Permissions>;
186
193
  };
187
194
  type Category<ComponentName> = {
188
195
  components?: ComponentName[];
@@ -258,5 +265,12 @@ type AppState = {
258
265
  data: Data;
259
266
  ui: UiState;
260
267
  };
268
+ type Permissions = {
269
+ drag: boolean;
270
+ duplicate: boolean;
271
+ delete: boolean;
272
+ edit: boolean;
273
+ insert: boolean;
274
+ } & Record<string, boolean>;
261
275
 
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 };
276
+ export type { 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, Permissions as P, RootData as R, SelectField as S, TextField as T, UiState as U, Viewports as V, FieldProps as a, DropZoneProps as b, DefaultComponentProps as c, DefaultRootProps as d, RootDataWithProps as e, ComponentData as f, Content as g, PuckComponent as h, PuckContext as i, ComponentConfig as j, RootDataWithoutProps as k, ItemWithId as l, ArrayState as m, BaseField as n, TextareaField as o, RadioField as p, ArrayField as q, Adaptor as r, ExternalField as s, CustomField as t, Fields as u };
package/dist/index.css CHANGED
@@ -136,6 +136,65 @@
136
136
 
137
137
  /* styles.css */
138
138
 
139
+ /* css-module:/home/runner/work/puck/puck/packages/core/components/ActionBar/styles.module.css/#css-module-data */
140
+ ._ActionBarComponent_8nyey_1 {
141
+ display: flex;
142
+ width: auto;
143
+ padding: 4px;
144
+ border-top-left-radius: 8px;
145
+ border-top-right-radius: 8px;
146
+ border-radius: 8px;
147
+ background: var(--puck-color-grey-01);
148
+ color: var(--puck-color-white);
149
+ font-family: var(--puck-font-family);
150
+ gap: 4px;
151
+ min-height: 26px;
152
+ }
153
+ ._ActionBarComponent-actionsLabel_8nyey_15 {
154
+ color: var(--puck-color-grey-08);
155
+ display: flex;
156
+ font-size: var(--puck-font-size-xxxs);
157
+ font-weight: 500;
158
+ justify-content: center;
159
+ align-items: center;
160
+ padding-left: 8px;
161
+ padding-right: 8px;
162
+ text-overflow: ellipsis;
163
+ white-space: nowrap;
164
+ }
165
+ ._ActionBarComponent-action_8nyey_15:first-of-type {
166
+ border-left: 0.5px solid var(--puck-color-grey-05);
167
+ border-radius: 0;
168
+ padding-left: 16px;
169
+ }
170
+ ._ActionBarComponent-action_8nyey_15 {
171
+ background: transparent;
172
+ border: none;
173
+ color: var(--puck-color-grey-08);
174
+ cursor: pointer;
175
+ padding: 6px 8px;
176
+ border-radius: 4px;
177
+ overflow: hidden;
178
+ display: flex;
179
+ align-items: center;
180
+ justify-content: center;
181
+ transition: color 50ms ease-in;
182
+ }
183
+ ._ActionBarComponent-action_8nyey_15:focus-visible {
184
+ outline: 2px solid var(--puck-color-azure-05);
185
+ outline-offset: -2px;
186
+ }
187
+ @media (hover: hover) and (pointer: fine) {
188
+ ._ActionBarComponent-action_8nyey_15:hover {
189
+ color: var(--puck-color-azure-06);
190
+ transition: none;
191
+ }
192
+ }
193
+ ._ActionBarComponent-action_8nyey_15:active {
194
+ color: var(--puck-color-azure-07);
195
+ transition: none;
196
+ }
197
+
139
198
  /* css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/styles.module.css/#css-module-data */
140
199
  ._Input_3pq3z_1 {
141
200
  color: var(--puck-color-grey-04);
@@ -523,14 +582,17 @@ textarea._Input-input_3pq3z_47 {
523
582
  }
524
583
 
525
584
  /* css-module:/home/runner/work/puck/puck/packages/core/components/DragIcon/styles.module.css/#css-module-data */
526
- ._DragIcon_1p5wn_1 {
585
+ ._DragIcon_17p8x_1 {
527
586
  color: var(--puck-color-grey-05);
528
587
  cursor: grab;
529
588
  padding: 4px;
530
589
  border-radius: 4px;
531
590
  }
591
+ ._DragIcon--disabled_17p8x_8 {
592
+ cursor: no-drop;
593
+ }
532
594
  @media (hover: hover) and (pointer: fine) {
533
- ._DragIcon_1p5wn_1:hover {
595
+ ._DragIcon_17p8x_1:not(._DragIcon--disabled_17p8x_8):hover {
534
596
  color: var(--puck-color-azure-05);
535
597
  background-color: var(--puck-color-azure-12);
536
598
  }
@@ -989,16 +1051,21 @@ textarea._Input-input_3pq3z_47 {
989
1051
  }
990
1052
 
991
1053
  /* css-module:/home/runner/work/puck/puck/packages/core/components/Drawer/styles.module.css/#css-module-data */
992
- ._Drawer_6zh0b_1 {
1054
+ ._Drawer_4yfqn_1 {
993
1055
  font-family: var(--puck-font-family);
994
1056
  }
995
- ._DrawerItem-default_6zh0b_5 ._DrawerItem-draggableWrapper_6zh0b_5 {
1057
+ ._DrawerItem--disabled_4yfqn_5 {
1058
+ background: var(--puck-color-grey-11);
1059
+ color: var(--puck-color-grey-05);
1060
+ cursor: not-allowed;
1061
+ }
1062
+ ._DrawerItem-default_4yfqn_11 ._DrawerItem-draggableWrapper_4yfqn_11 {
996
1063
  padding-bottom: 12px;
997
1064
  }
998
- ._DrawerItem_6zh0b_5:last-of-type ._DrawerItem-default_6zh0b_5 ._DrawerItem-draggableWrapper_6zh0b_5 {
1065
+ ._DrawerItem_4yfqn_5:last-of-type ._DrawerItem-default_4yfqn_11 ._DrawerItem-draggableWrapper_4yfqn_11 {
999
1066
  padding-bottom: 0;
1000
1067
  }
1001
- ._DrawerItem-draggable_6zh0b_5 {
1068
+ ._DrawerItem-draggable_4yfqn_11 {
1002
1069
  background: var(--puck-color-white);
1003
1070
  padding: 12px;
1004
1071
  display: flex;
@@ -1007,50 +1074,49 @@ textarea._Input-input_3pq3z_47 {
1007
1074
  font-size: var(--puck-font-size-xxs);
1008
1075
  justify-content: space-between;
1009
1076
  align-items: center;
1010
- cursor: grab;
1011
1077
  transition: background-color 50ms ease-in, color 50ms ease-in;
1012
1078
  }
1013
- ._DrawerItem_6zh0b_5:focus-visible {
1079
+ ._DrawerItem_4yfqn_5:focus-visible {
1014
1080
  outline: 0;
1015
1081
  }
1016
- ._Drawer_6zh0b_1:not(._Drawer--isDraggingFrom_6zh0b_31) ._DrawerItem_6zh0b_5:focus-visible ._DrawerItem-draggable_6zh0b_5 {
1082
+ ._Drawer_4yfqn_1:not(._Drawer--isDraggingFrom_4yfqn_36) ._DrawerItem_4yfqn_5:focus-visible ._DrawerItem-draggable_4yfqn_11 {
1017
1083
  border-radius: 4px;
1018
1084
  outline: 2px solid var(--puck-color-azure-05);
1019
1085
  outline-offset: 2px;
1020
1086
  }
1021
1087
  @media (hover: hover) and (pointer: fine) {
1022
- ._Drawer_6zh0b_1:not(._Drawer--isDraggingFrom_6zh0b_31) ._DrawerItem-draggable_6zh0b_5:hover {
1088
+ ._Drawer_4yfqn_1:not(._Drawer--isDraggingFrom_4yfqn_36) ._DrawerItem_4yfqn_5:not(._DrawerItem--disabled_4yfqn_5) ._DrawerItem-draggable_4yfqn_11:hover {
1023
1089
  background-color: var(--puck-color-azure-12);
1024
1090
  color: var(--puck-color-azure-04);
1025
1091
  transition: none;
1026
1092
  }
1027
1093
  }
1028
- ._DrawerItem-name_6zh0b_47 {
1094
+ ._DrawerItem-name_4yfqn_54 {
1029
1095
  overflow-x: hidden;
1030
1096
  text-overflow: ellipsis;
1031
1097
  white-space: nowrap;
1032
1098
  }
1033
1099
 
1034
1100
  /* css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css/#css-module-data */
1035
- ._DraggableComponent_59z7f_1 {
1101
+ ._DraggableComponent_1bhad_1 {
1036
1102
  pointer-events: auto;
1037
1103
  --overlay-background: color-mix( in srgb, var(--puck-color-azure-08) 30%, transparent );
1038
1104
  }
1039
- ._DraggableComponent--isDragging_59z7f_11 {
1105
+ ._DraggableComponent--isDragging_1bhad_11 {
1040
1106
  background: color-mix(in srgb, var(--puck-color-azure-08) 10%, transparent);
1041
1107
  overflow: hidden;
1042
1108
  }
1043
- ._DraggableComponent-contents_59z7f_16 {
1109
+ ._DraggableComponent-contents_1bhad_16 {
1044
1110
  position: relative;
1045
1111
  pointer-events: none;
1046
1112
  z-index: 0;
1047
1113
  }
1048
- ._DraggableComponent-contents_59z7f_16::before,
1049
- ._DraggableComponent-contents_59z7f_16::after {
1114
+ ._DraggableComponent-contents_1bhad_16::before,
1115
+ ._DraggableComponent-contents_1bhad_16::after {
1050
1116
  content: " ";
1051
1117
  display: table;
1052
1118
  }
1053
- ._DraggableComponent-overlay_59z7f_29 {
1119
+ ._DraggableComponent-overlay_1bhad_29 {
1054
1120
  cursor: pointer;
1055
1121
  height: 100%;
1056
1122
  width: 100%;
@@ -1061,13 +1127,13 @@ textarea._Input-input_3pq3z_47 {
1061
1127
  box-sizing: border-box;
1062
1128
  z-index: 1;
1063
1129
  }
1064
- ._DraggableComponent_59z7f_1:focus-visible > ._DraggableComponent-overlay_59z7f_29 {
1130
+ ._DraggableComponent_1bhad_1:focus-visible > ._DraggableComponent-overlay_1bhad_29 {
1065
1131
  outline: 1px solid var(--puck-color-azure-05);
1066
1132
  }
1067
- ._DraggableComponent--isDragging_59z7f_11 > ._DraggableComponent-overlay_59z7f_29 {
1133
+ ._DraggableComponent--isDragging_1bhad_11 > ._DraggableComponent-overlay_1bhad_29 {
1068
1134
  outline: 2px var(--puck-color-azure-09) solid !important;
1069
1135
  }
1070
- ._DraggableComponent-loadingOverlay_59z7f_49 {
1136
+ ._DraggableComponent-loadingOverlay_1bhad_49 {
1071
1137
  background: var(--puck-color-white);
1072
1138
  color: var(--puck-color-grey-03);
1073
1139
  border-radius: 4px;
@@ -1082,91 +1148,42 @@ textarea._Input-input_3pq3z_47 {
1082
1148
  opacity: 0.8;
1083
1149
  z-index: 1;
1084
1150
  }
1085
- ._DraggableComponent_59z7f_1:hover:not(._DraggableComponent--isLocked_59z7f_65) > ._DraggableComponent-overlay_59z7f_29 {
1151
+ ._DraggableComponent_1bhad_1:hover:not(._DraggableComponent--isLocked_1bhad_65) > ._DraggableComponent-overlay_1bhad_29 {
1086
1152
  background: var(--overlay-background);
1087
1153
  pointer-events: none;
1088
1154
  }
1089
- ._DraggableComponent--forceHover_59z7f_71 > ._DraggableComponent-overlay_59z7f_29 {
1155
+ ._DraggableComponent--forceHover_1bhad_71 > ._DraggableComponent-overlay_1bhad_29 {
1090
1156
  background: var(--overlay-background);
1091
1157
  pointer-events: none;
1092
1158
  }
1093
- ._DraggableComponent_59z7f_1:not(._DraggableComponent--isSelected_59z7f_76):hover > ._DraggableComponent-overlay_59z7f_29 {
1159
+ ._DraggableComponent_1bhad_1:not(._DraggableComponent--isSelected_1bhad_76):hover > ._DraggableComponent-overlay_1bhad_29 {
1094
1160
  outline: 2px var(--puck-color-azure-09) solid !important;
1095
1161
  }
1096
- ._DraggableComponent--indicativeHover_59z7f_81 > ._DraggableComponent-overlay_59z7f_29 {
1162
+ ._DraggableComponent--indicativeHover_1bhad_81 > ._DraggableComponent-overlay_1bhad_29 {
1097
1163
  pointer-events: none;
1098
1164
  }
1099
- ._DraggableComponent_59z7f_1:not(._DraggableComponent--isSelected_59z7f_76):has(._DraggableComponent_59z7f_1:hover > ._DraggableComponent-overlay_59z7f_29) > ._DraggableComponent-overlay_59z7f_29 {
1165
+ ._DraggableComponent_1bhad_1:not(._DraggableComponent--isSelected_1bhad_76):has(._DraggableComponent_1bhad_1:hover > ._DraggableComponent-overlay_1bhad_29) > ._DraggableComponent-overlay_1bhad_29 {
1100
1166
  display: none;
1101
1167
  }
1102
- ._DraggableComponent--isSelected_59z7f_76 > ._DraggableComponent-overlay_59z7f_29 {
1168
+ ._DraggableComponent--isSelected_1bhad_76 > ._DraggableComponent-overlay_1bhad_29 {
1103
1169
  outline: 2px var(--puck-color-azure-07) solid !important;
1104
1170
  }
1105
- ._DraggableComponent--isSelected_59z7f_76 > ._DraggableComponent-actionsOverlay_59z7f_97 {
1171
+ ._DraggableComponent--isSelected_1bhad_76 > ._DraggableComponent-actionsOverlay_1bhad_97 {
1106
1172
  display: block;
1107
1173
  position: sticky;
1108
1174
  z-index: 2;
1109
1175
  }
1110
- ._DraggableComponent-actions_59z7f_97 {
1176
+ ._DraggableComponent-actions_1bhad_97 {
1111
1177
  position: absolute;
1112
1178
  width: auto;
1113
- padding: 4px;
1114
- border-top-left-radius: 8px;
1115
- border-top-right-radius: 8px;
1116
- border-radius: 8px;
1117
- background: var(--puck-color-grey-01);
1118
- color: var(--puck-color-white);
1119
1179
  cursor: grab;
1120
1180
  display: none;
1121
- font-family: var(--puck-font-family);
1122
- gap: 4px;
1123
1181
  pointer-events: auto;
1124
1182
  box-sizing: border-box;
1125
1183
  transform-origin: right top;
1126
1184
  }
1127
- ._DraggableComponent--isSelected_59z7f_76 > ._DraggableComponent-actionsOverlay_59z7f_97 > ._DraggableComponent-actions_59z7f_97 {
1128
- display: flex;
1129
- }
1130
- ._DraggableComponent-actionsLabel_59z7f_127 {
1131
- color: var(--puck-color-grey-08);
1132
- display: flex;
1133
- font-size: var(--puck-font-size-xxxs);
1134
- font-weight: 500;
1135
- justify-content: center;
1136
- align-items: center;
1137
- padding-left: 8px;
1138
- padding-right: 16px;
1139
- margin-right: 8px;
1140
- border-right: 0.5px solid var(--puck-color-grey-05);
1141
- text-overflow: ellipsis;
1142
- white-space: nowrap;
1143
- }
1144
- ._DraggableComponent-action_59z7f_97 {
1145
- background: transparent;
1146
- border: none;
1147
- color: var(--puck-color-grey-08);
1148
- cursor: pointer;
1149
- padding: 6px 8px;
1150
- border-radius: 4px;
1151
- overflow: hidden;
1185
+ ._DraggableComponent--isSelected_1bhad_76 > ._DraggableComponent-actionsOverlay_1bhad_97 > ._DraggableComponent-actions_1bhad_97 {
1152
1186
  display: flex;
1153
- align-items: center;
1154
- justify-content: center;
1155
- transition: color 50ms ease-in;
1156
- }
1157
- ._DraggableComponent-action_59z7f_97:focus-visible {
1158
- outline: 2px solid var(--puck-color-azure-05);
1159
- outline-offset: -2px;
1160
- }
1161
- @media (hover: hover) and (pointer: fine) {
1162
- ._DraggableComponent-action_59z7f_97:hover {
1163
- color: var(--puck-color-azure-06);
1164
- transition: none;
1165
- }
1166
- }
1167
- ._DraggableComponent-action_59z7f_97:active {
1168
- color: var(--puck-color-azure-07);
1169
- transition: none;
1170
1187
  }
1171
1188
 
1172
1189
  /* css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css/#css-module-data */
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 DefaultRootProps, c as DropZoneProps, V as Viewports, d as DefaultComponentProps, M as MappedItem, R as RootDataWithProps, e as RootData, f as ComponentData } from './Config-041c35a2.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-041c35a2.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
 
@@ -10,6 +10,7 @@ type InsertAction = {
10
10
  componentType: string;
11
11
  destinationIndex: number;
12
12
  destinationZone: string;
13
+ id?: string;
13
14
  };
14
15
  type DuplicateAction = {
15
16
  type: "duplicate";
@@ -80,6 +81,10 @@ type Overrides = OverridesGeneric<{
80
81
  actions: ReactNode;
81
82
  children: ReactNode;
82
83
  }>;
84
+ actionBar: RenderFunc<{
85
+ label?: string;
86
+ children: ReactNode;
87
+ }>;
83
88
  headerActions: RenderFunc<{
84
89
  children: ReactNode;
85
90
  }>;
@@ -123,13 +128,30 @@ type Plugin = {
123
128
  overrides: Partial<Overrides>;
124
129
  };
125
130
 
131
+ declare const ActionBar: {
132
+ ({ label, children, }: {
133
+ label?: string;
134
+ children?: ReactNode;
135
+ }): react_jsx_runtime.JSX.Element;
136
+ Action: ({ children, label, onClick, }: {
137
+ children: ReactNode;
138
+ label?: string;
139
+ onClick: (e: SyntheticEvent) => void;
140
+ }) => react_jsx_runtime.JSX.Element;
141
+ };
142
+ declare const Action: ({ children, label, onClick, }: {
143
+ children: ReactNode;
144
+ label?: string;
145
+ onClick: (e: SyntheticEvent) => void;
146
+ }) => react_jsx_runtime.JSX.Element;
147
+
126
148
  declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }: {
127
149
  children?: ReactNode;
128
150
  icon?: ReactNode;
129
151
  label: string;
130
- el?: "label" | "div" | undefined;
131
- readOnly?: boolean | undefined;
132
- className?: string | undefined;
152
+ el?: "label" | "div";
153
+ readOnly?: boolean;
154
+ className?: string;
133
155
  }) => react_jsx_runtime.JSX.Element;
134
156
  type FieldLabelPropsInternal = {
135
157
  children?: ReactNode;
@@ -157,37 +179,59 @@ declare function AutoField<ValueType = any, FieldType extends Field<ValueType> =
157
179
 
158
180
  declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, }: {
159
181
  children: ReactNode;
160
- href?: string | undefined;
161
- onClick?: ((e: any) => void | Promise<void>) | undefined;
162
- variant?: "primary" | "secondary" | undefined;
163
- type?: "button" | "submit" | "reset" | undefined;
164
- disabled?: boolean | undefined;
165
- tabIndex?: number | undefined;
166
- newTab?: boolean | undefined;
167
- fullWidth?: boolean | undefined;
182
+ href?: string;
183
+ onClick?: (e: any) => void | Promise<void>;
184
+ variant?: "primary" | "secondary";
185
+ type?: "button" | "submit" | "reset";
186
+ disabled?: boolean;
187
+ tabIndex?: number;
188
+ newTab?: boolean;
189
+ fullWidth?: boolean;
168
190
  icon?: ReactNode;
169
- size?: "medium" | "large" | undefined;
170
- loading?: boolean | undefined;
191
+ size?: "medium" | "large";
192
+ loading?: boolean;
171
193
  }) => react_jsx_runtime.JSX.Element;
172
194
 
173
195
  declare const Drawer: {
174
196
  ({ children, droppableId: _droppableId, direction, }: {
175
197
  children: ReactNode;
176
- droppableId?: string | undefined;
177
- direction?: "vertical" | "horizontal" | undefined;
198
+ droppableId?: string;
199
+ direction?: "vertical" | "horizontal";
178
200
  }): react_jsx_runtime.JSX.Element;
179
- Item: ({ name, children, id, label, index, }: {
201
+ Item: ({ name, children, id, label, index, isDragDisabled, }: {
180
202
  name: string;
181
- children?: ((props: {
203
+ children?: (props: {
182
204
  children: ReactNode;
183
205
  name: string;
184
- }) => ReactElement) | undefined;
185
- id?: string | undefined;
186
- label?: string | undefined;
206
+ }) => ReactElement;
207
+ id?: string;
208
+ label?: string;
187
209
  index: number;
210
+ isDragDisabled?: boolean;
188
211
  }) => react_jsx_runtime.JSX.Element;
189
212
  };
190
213
 
214
+ type History<D = any> = {
215
+ id: string;
216
+ data: D;
217
+ };
218
+ type HistoryStore<D = any> = {
219
+ index: number;
220
+ hasPast: boolean;
221
+ hasFuture: boolean;
222
+ histories: History<D>[];
223
+ record: (data: D) => void;
224
+ back: VoidFunction;
225
+ forward: VoidFunction;
226
+ currentHistory: History;
227
+ nextHistory: History<D> | null;
228
+ prevHistory: History<D> | null;
229
+ setHistories: (histories: History[]) => void;
230
+ setHistoryIndex: (index: number) => void;
231
+ };
232
+
233
+ type OnAction = (action: PuckAction, appState: AppState, prevAppState: AppState) => void;
234
+
191
235
  type PathData = Record<string, {
192
236
  path: string[];
193
237
  label: string;
@@ -219,7 +263,7 @@ type DropZoneContext<UserConfig extends Config = Config> = {
219
263
  zoneWillDrag?: string;
220
264
  setZoneWillDrag?: (zone: string) => void;
221
265
  } | null;
222
- declare const dropZoneContext: react.Context<DropZoneContext<Config<Record<string, any>, DefaultRootProps, string>>>;
266
+ declare const dropZoneContext: react.Context<DropZoneContext<Config>>;
223
267
  declare const DropZoneProvider: ({ children, value, }: {
224
268
  children: ReactNode;
225
269
  value: DropZoneContext;
@@ -229,45 +273,30 @@ declare function DropZone(props: DropZoneProps): react_jsx_runtime.JSX.Element;
229
273
 
230
274
  declare const IconButton: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, title, }: {
231
275
  children: ReactNode;
232
- href?: string | undefined;
233
- onClick?: ((e: SyntheticEvent) => void | Promise<void>) | undefined;
234
- variant?: "primary" | "secondary" | undefined;
235
- type?: "button" | "submit" | "reset" | undefined;
236
- disabled?: boolean | undefined;
237
- tabIndex?: number | undefined;
238
- newTab?: boolean | undefined;
239
- fullWidth?: boolean | undefined;
276
+ href?: string;
277
+ onClick?: (e: SyntheticEvent) => void | Promise<void>;
278
+ variant?: "primary" | "secondary";
279
+ type?: "button" | "submit" | "reset";
280
+ disabled?: boolean;
281
+ tabIndex?: number;
282
+ newTab?: boolean;
283
+ fullWidth?: boolean;
240
284
  title: string;
241
285
  }) => react_jsx_runtime.JSX.Element;
242
286
 
243
- type History<D = any> = {
244
- id: string;
245
- data: D;
246
- };
247
- type HistoryStore<D = any> = {
248
- index: number;
249
- hasPast: boolean;
250
- hasFuture: boolean;
251
- histories: History<D>[];
252
- record: (data: D) => void;
253
- back: VoidFunction;
254
- forward: VoidFunction;
255
- currentHistory: History;
256
- nextHistory: History<D> | null;
257
- prevHistory: History<D> | null;
258
- };
259
-
260
287
  type IframeConfig = {
261
288
  enabled?: boolean;
262
289
  };
263
290
 
264
- declare function Puck<UserConfig extends Config = Config>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe, dnd, initialHistory, }: {
291
+ 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, }: {
265
292
  children?: ReactNode;
266
293
  config: UserConfig;
267
294
  data: Partial<Data>;
268
295
  ui?: Partial<UiState>;
269
296
  onChange?: (data: Data) => void;
270
297
  onPublish?: (data: Data) => void;
298
+ onAction?: OnAction;
299
+ permissions?: Partial<Permissions>;
271
300
  plugins?: Plugin[];
272
301
  overrides?: Partial<Overrides>;
273
302
  renderHeader?: (props: {
@@ -296,7 +325,7 @@ declare namespace Puck {
296
325
  var Fields: () => react_jsx_runtime.JSX.Element;
297
326
  var Outline: () => react_jsx_runtime.JSX.Element;
298
327
  var Preview: ({ id }: {
299
- id?: string | undefined;
328
+ id?: string;
300
329
  }) => react_jsx_runtime.JSX.Element;
301
330
  }
302
331
 
@@ -319,27 +348,40 @@ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps,
319
348
  declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultComponentProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
320
349
 
321
350
  declare function resolveAllData(data: Partial<Data>, config: Config, onResolveStart?: (item: MappedItem) => void, onResolveEnd?: (item: MappedItem) => void): Promise<{
322
- root: RootDataWithProps<DefaultRootProps> | RootData<DefaultRootProps>;
323
- content: any[];
351
+ root: RootData<DefaultRootProps> | RootDataWithProps;
352
+ content: any;
324
353
  zones: Record<string, MappedItem[]>;
325
354
  }>;
326
355
 
327
356
  declare const usePuck: () => {
328
357
  appState: AppState;
329
- config: Config<Record<string, any>, DefaultRootProps, string>;
358
+ config: Config;
330
359
  dispatch: (action: PuckAction) => void;
360
+ getPermissions: ({ item, type, }?: {
361
+ item?: ComponentData;
362
+ type?: keyof DefaultComponentProps;
363
+ }) => {
364
+ [x: string]: boolean | undefined;
365
+ drag?: boolean | undefined;
366
+ duplicate?: boolean | undefined;
367
+ delete?: boolean | undefined;
368
+ edit?: boolean | undefined;
369
+ insert?: boolean | undefined;
370
+ };
331
371
  history: {
332
372
  back: VoidFunction;
333
373
  forward: VoidFunction;
374
+ setHistories: (histories: History[]) => void;
375
+ setHistoryIndex: (index: number) => void;
334
376
  hasPast: boolean;
335
377
  hasFuture: boolean;
336
378
  histories: History<any>[];
337
379
  index: number;
338
- historyStore: HistoryStore<any> | undefined;
380
+ historyStore: HistoryStore | undefined;
339
381
  };
340
382
  selectedItem: ComponentData<DefaultComponentProps & {
341
383
  id: string;
342
384
  }> | null;
343
385
  };
344
386
 
345
- export { AppState, AutoField, AutoFieldPrivate, Button, ComponentData, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZone, DropZoneProvider, Field, FieldLabel, FieldLabelInternal, FieldProps, FieldPropsInternal, IconButton, MappedItem, Plugin, Puck, PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
387
+ 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 };