@measured/puck 0.14.0-canary.22a4182 → 0.14.0-canary.2c15323

Sign up to get free protection for your applications and to get access to all the features.
@@ -55,6 +55,8 @@ type ArrayField<Props extends {
55
55
  };
56
56
  defaultItemProps?: Props[0];
57
57
  getItemSummary?: (item: Props[0], index?: number) => string;
58
+ max?: number;
59
+ min?: number;
58
60
  };
59
61
  type ObjectField<Props extends {
60
62
  [key: string]: any;
@@ -91,11 +93,15 @@ type ExternalField<Props extends {
91
93
  placeholder?: string;
92
94
  fetchList: (params: {
93
95
  query: string;
96
+ filters: Record<string, any>;
94
97
  }) => Promise<any[] | null>;
95
98
  mapProp?: (value: any) => Props;
99
+ mapRow?: (value: any) => Record<string, string | number>;
96
100
  getItemSummary: (item: Props, index?: number) => string;
97
101
  showSearch?: boolean;
98
102
  initialQuery?: string;
103
+ filterFields?: Record<string, Field>;
104
+ initialFilters?: Record<string, any>;
99
105
  };
100
106
  type CustomField<Props extends {
101
107
  [key: string]: any;
package/dist/index.css CHANGED
@@ -137,7 +137,7 @@
137
137
  /* styles.css */
138
138
 
139
139
  /* css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css/#css-module-data */
140
- ._Button_1hb69_1 {
140
+ ._Button_8fn3a_1 {
141
141
  appearance: none;
142
142
  background: none;
143
143
  border: 1px solid transparent;
@@ -159,65 +159,69 @@
159
159
  white-space: nowrap;
160
160
  margin: 0;
161
161
  }
162
- ._Button_1hb69_1:hover,
163
- ._Button_1hb69_1:active {
162
+ ._Button_8fn3a_1:hover,
163
+ ._Button_8fn3a_1:active {
164
164
  transition: none;
165
165
  }
166
- ._Button--medium_1hb69_29 {
166
+ ._Button--medium_8fn3a_29 {
167
167
  min-height: 34px;
168
168
  padding-bottom: 7px;
169
169
  padding-left: 19px;
170
170
  padding-right: 19px;
171
171
  padding-top: 7px;
172
172
  }
173
- ._Button--large_1hb69_37 {
173
+ ._Button--large_8fn3a_37 {
174
174
  padding-bottom: 11px;
175
175
  padding-left: 19px;
176
176
  padding-right: 19px;
177
177
  padding-top: 11px;
178
178
  }
179
- ._Button-icon_1hb69_44 {
179
+ ._Button-icon_8fn3a_44 {
180
180
  margin-top: 2px;
181
181
  }
182
- ._Button--primary_1hb69_48 {
182
+ ._Button--primary_8fn3a_48 {
183
183
  background: var(--puck-color-azure-04);
184
184
  }
185
- ._Button_1hb69_1:focus-visible {
185
+ ._Button_8fn3a_1:focus-visible {
186
186
  outline: 2px solid var(--puck-color-azure-05);
187
187
  outline-offset: 2px;
188
188
  }
189
189
  @media (hover: hover) and (pointer: fine) {
190
- ._Button--primary_1hb69_48:hover {
190
+ ._Button--primary_8fn3a_48:hover {
191
191
  background-color: var(--puck-color-azure-03);
192
192
  }
193
193
  }
194
- ._Button--primary_1hb69_48:active {
194
+ ._Button--primary_8fn3a_48:active {
195
195
  background-color: var(--puck-color-azure-02);
196
196
  }
197
- ._Button--secondary_1hb69_67 {
197
+ ._Button--secondary_8fn3a_67 {
198
198
  border: 1px solid var(--puck-color-grey-01);
199
199
  color: var(--puck-color-black);
200
200
  }
201
201
  @media (hover: hover) and (pointer: fine) {
202
- ._Button--secondary_1hb69_67:hover {
202
+ ._Button--secondary_8fn3a_67:hover {
203
203
  background-color: var(--puck-color-azure-12);
204
204
  }
205
205
  }
206
- ._Button--secondary_1hb69_67:active {
206
+ ._Button--secondary_8fn3a_67:active {
207
207
  background-color: var(--puck-color-azure-11);
208
208
  }
209
- ._Button--flush_1hb69_82 {
209
+ ._Button--flush_8fn3a_82 {
210
210
  border-radius: 0;
211
211
  }
212
- ._Button--disabled_1hb69_86,
213
- ._Button--disabled_1hb69_86:hover {
212
+ ._Button--disabled_8fn3a_86,
213
+ ._Button--disabled_8fn3a_86:hover {
214
214
  background-color: var(--puck-color-grey-07);
215
215
  color: var(--puck-color-grey-03);
216
216
  cursor: not-allowed;
217
217
  }
218
- ._Button--fullWidth_1hb69_93 {
218
+ ._Button--fullWidth_8fn3a_93 {
219
+ justify-content: center;
219
220
  width: 100%;
220
221
  }
222
+ ._Button-spinner_8fn3a_98 {
223
+ padding-left: 8px;
224
+ }
221
225
 
222
226
  /* css-module:/home/runner/work/puck/puck/packages/core/components/Drawer/styles.module.css/#css-module-data */
223
227
  ._Drawer_6zh0b_1 {
@@ -826,43 +830,44 @@
826
830
  }
827
831
 
828
832
  /* css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/styles.module.css/#css-module-data */
829
- ._Input_3msty_1 {
833
+ ._Input_1qi5b_1 {
830
834
  color: var(--puck-color-grey-04);
831
835
  padding: 16px;
832
836
  padding-bottom: 12px;
833
837
  display: block;
834
838
  }
835
- ._Input_3msty_1 ._Input_3msty_1 {
839
+ ._Input_1qi5b_1 ._Input_1qi5b_1 {
836
840
  padding: 0px;
837
841
  }
838
- ._Input_3msty_1 * {
842
+ ._Input_1qi5b_1 * {
839
843
  box-sizing: border-box;
840
844
  }
841
- ._Input_3msty_1 + ._Input_3msty_1 {
845
+ ._Input_1qi5b_1 + ._Input_1qi5b_1 {
842
846
  border-top: 1px solid var(--puck-color-grey-09);
843
847
  margin-top: 8px;
844
848
  }
845
- ._Input_3msty_1 ._Input_3msty_1 + ._Input_3msty_1 {
849
+ ._Input_1qi5b_1 ._Input_1qi5b_1 + ._Input_1qi5b_1 {
846
850
  border-top: 0px;
847
851
  margin-top: 12px;
848
852
  }
849
- ._Input-label_3msty_26 {
853
+ ._Input-label_1qi5b_26 {
850
854
  align-items: center;
851
855
  display: flex;
852
856
  padding-bottom: 12px;
853
857
  font-size: var(--puck-font-size-xxs);
854
858
  font-weight: 600;
855
859
  }
856
- ._Input-labelIcon_3msty_34 {
860
+ ._Input-labelIcon_1qi5b_34 {
857
861
  color: var(--puck-color-grey-07);
862
+ display: flex;
858
863
  margin-right: 4px;
859
864
  padding-left: 4px;
860
865
  }
861
- ._Input-disabledIcon_3msty_40 {
866
+ ._Input-disabledIcon_1qi5b_41 {
862
867
  color: var(--puck-color-grey-05);
863
868
  margin-left: auto;
864
869
  }
865
- ._Input-input_3msty_45 {
870
+ ._Input-input_1qi5b_46 {
866
871
  background: var(--puck-color-white);
867
872
  border-width: 1px;
868
873
  border-style: solid;
@@ -874,7 +879,7 @@
874
879
  transition: border-color 50ms ease-in;
875
880
  width: 100%;
876
881
  }
877
- select._Input-input_3msty_45 {
882
+ select._Input-input_1qi5b_46 {
878
883
  appearance: none;
879
884
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23c3c3c3'><polygon points='0,0 100,0 50,50'/></svg>") no-repeat;
880
885
  background-size: 12px;
@@ -884,25 +889,25 @@ select._Input-input_3msty_45 {
884
889
  cursor: pointer;
885
890
  }
886
891
  @media (hover: hover) and (pointer: fine) {
887
- ._Input_3msty_1:has(> input):hover ._Input-input_3msty_45:not([readonly]),
888
- ._Input_3msty_1:has(> textarea):hover ._Input-input_3msty_45:not([readonly]) {
892
+ ._Input_1qi5b_1:has(> input):hover ._Input-input_1qi5b_46:not([readonly]),
893
+ ._Input_1qi5b_1:has(> textarea):hover ._Input-input_1qi5b_46:not([readonly]) {
889
894
  border-color: var(--puck-color-grey-05);
890
895
  transition: none;
891
896
  }
892
- ._Input_3msty_1:has(> select):hover ._Input-input_3msty_45:not([disabled]) {
897
+ ._Input_1qi5b_1:has(> select):hover ._Input-input_1qi5b_46:not([disabled]) {
893
898
  background-color: var(--puck-color-azure-12);
894
899
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%235a5a5a'><polygon points='0,0 100,0 50,50'/></svg>");
895
900
  border-color: var(--puck-color-grey-05);
896
901
  transition: none;
897
902
  }
898
903
  }
899
- ._Input-input_3msty_45:focus {
904
+ ._Input-input_1qi5b_46:focus {
900
905
  border-color: var(--puck-color-grey-05);
901
906
  outline: 2px solid var(--puck-color-azure-05);
902
907
  transition: none;
903
908
  }
904
- ._Input--readOnly_3msty_89 > ._Input-input_3msty_45,
905
- ._Input--readOnly_3msty_89 > select._Input-input_3msty_45 {
909
+ ._Input--readOnly_1qi5b_90 > ._Input-input_1qi5b_46,
910
+ ._Input--readOnly_1qi5b_90 > select._Input-input_1qi5b_46 {
906
911
  background-color: var(--puck-color-grey-11);
907
912
  border-color: var(--puck-color-grey-09);
908
913
  color: var(--puck-color-grey-04);
@@ -911,34 +916,34 @@ select._Input-input_3msty_45 {
911
916
  outline: 0;
912
917
  transition: none;
913
918
  }
914
- ._Input-radioGroupItems_3msty_100 {
919
+ ._Input-radioGroupItems_1qi5b_101 {
915
920
  display: flex;
916
921
  border: 1px solid var(--puck-color-grey-09);
917
922
  border-radius: 4px;
918
923
  flex-wrap: wrap;
919
924
  }
920
- ._Input-radio_3msty_100 {
925
+ ._Input-radio_1qi5b_101 {
921
926
  border-right: 1px solid var(--puck-color-grey-09);
922
927
  flex-grow: 1;
923
928
  }
924
- ._Input-radio_3msty_100:first-of-type {
929
+ ._Input-radio_1qi5b_101:first-of-type {
925
930
  border-bottom-left-radius: 4px;
926
931
  border-top-left-radius: 4px;
927
932
  }
928
- ._Input-radio_3msty_100:first-of-type ._Input-radioInner_3msty_117 {
933
+ ._Input-radio_1qi5b_101:first-of-type ._Input-radioInner_1qi5b_118 {
929
934
  border-bottom-left-radius: 3px;
930
935
  border-top-left-radius: 3px;
931
936
  }
932
- ._Input-radio_3msty_100:last-of-type {
937
+ ._Input-radio_1qi5b_101:last-of-type {
933
938
  border-bottom-right-radius: 4px;
934
939
  border-right: 0;
935
940
  border-top-right-radius: 4px;
936
941
  }
937
- ._Input-radio_3msty_100:last-of-type ._Input-radioInner_3msty_117 {
942
+ ._Input-radio_1qi5b_101:last-of-type ._Input-radioInner_1qi5b_118 {
938
943
  border-bottom-right-radius: 3px;
939
944
  border-top-right-radius: 3px;
940
945
  }
941
- ._Input-radioInner_3msty_117 {
946
+ ._Input-radioInner_1qi5b_118 {
942
947
  background-color: var(--puck-color-white);
943
948
  color: var(--puck-color-grey-04);
944
949
  cursor: pointer;
@@ -947,32 +952,32 @@ select._Input-input_3msty_45 {
947
952
  text-align: center;
948
953
  transition: background-color 50ms ease-in;
949
954
  }
950
- ._Input-radio_3msty_100:has(:focus-visible) {
955
+ ._Input-radio_1qi5b_101:has(:focus-visible) {
951
956
  outline: 2px solid var(--puck-color-azure-05);
952
957
  outline-offset: 2px;
953
958
  position: relative;
954
959
  }
955
960
  @media (hover: hover) and (pointer: fine) {
956
- ._Input-radioInner_3msty_117:hover {
961
+ ._Input-radioInner_1qi5b_118:hover {
957
962
  background-color: var(--puck-color-azure-12);
958
963
  transition: none;
959
964
  }
960
965
  }
961
- ._Input--readOnly_3msty_89 ._Input-radioInner_3msty_117 {
966
+ ._Input--readOnly_1qi5b_90 ._Input-radioInner_1qi5b_118 {
962
967
  background-color: var(--puck-color-white);
963
968
  color: var(--puck-color-grey-04);
964
969
  cursor: default;
965
970
  }
966
- ._Input-radio_3msty_100 ._Input-radioInput_3msty_162:checked ~ ._Input-radioInner_3msty_117 {
971
+ ._Input-radio_1qi5b_101 ._Input-radioInput_1qi5b_163:checked ~ ._Input-radioInner_1qi5b_118 {
967
972
  background-color: var(--puck-color-azure-11);
968
973
  color: var(--puck-color-azure-04);
969
974
  font-weight: 500;
970
975
  }
971
- ._Input--readOnly_3msty_89 ._Input-radioInput_3msty_162:checked ~ ._Input-radioInner_3msty_117 {
976
+ ._Input--readOnly_1qi5b_90 ._Input-radioInput_1qi5b_163:checked ~ ._Input-radioInner_1qi5b_118 {
972
977
  background-color: var(--puck-color-grey-11);
973
978
  color: var(--puck-color-grey-04);
974
979
  }
975
- ._Input-radio_3msty_100 ._Input-radioInput_3msty_162 {
980
+ ._Input-radio_1qi5b_101 ._Input-radioInput_1qi5b_163 {
976
981
  clip: rect(0 0 0 0);
977
982
  clip-path: inset(100%);
978
983
  height: 1px;
@@ -981,7 +986,7 @@ select._Input-input_3msty_45 {
981
986
  white-space: nowrap;
982
987
  width: 1px;
983
988
  }
984
- textarea._Input-input_3msty_45 {
989
+ textarea._Input-input_1qi5b_46 {
985
990
  margin-bottom: -4px;
986
991
  }
987
992
 
@@ -1128,10 +1133,10 @@ textarea._Input-input_3msty_45 {
1128
1133
  }
1129
1134
 
1130
1135
  /* css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css/#css-module-data */
1131
- ._ExternalInput-actions_oqtaj_1 {
1136
+ ._ExternalInput-actions_q3l5a_1 {
1132
1137
  display: flex;
1133
1138
  }
1134
- ._ExternalInput-button_oqtaj_5 {
1139
+ ._ExternalInput-button_q3l5a_5 {
1135
1140
  display: flex;
1136
1141
  gap: 8px;
1137
1142
  align-items: center;
@@ -1150,13 +1155,13 @@ textarea._Input-input_3msty_45 {
1150
1155
  overflow: hidden;
1151
1156
  flex-grow: 1;
1152
1157
  }
1153
- ._ExternalInput--dataSelected_oqtaj_25 ._ExternalInput-button_oqtaj_5 {
1158
+ ._ExternalInput--dataSelected_q3l5a_25 ._ExternalInput-button_q3l5a_5 {
1154
1159
  color: var(--puck-color-grey-03);
1155
1160
  display: block;
1156
1161
  border-top-right-radius: 0px;
1157
1162
  border-bottom-right-radius: 0px;
1158
1163
  }
1159
- ._ExternalInput-detachButton_oqtaj_32 {
1164
+ ._ExternalInput-detachButton_q3l5a_32 {
1160
1165
  border: 1px solid var(--puck-color-grey-09);
1161
1166
  border-top-right-radius: 4px;
1162
1167
  border-bottom-right-radius: 4px;
@@ -1172,48 +1177,79 @@ textarea._Input-input_3msty_45 {
1172
1177
  transition: background-color 50ms ease-in, color 50ms ease-in;
1173
1178
  margin-left: -1px;
1174
1179
  }
1175
- ._ExternalInput-button_oqtaj_5:focus-visible,
1176
- ._ExternalInput-detachButton_oqtaj_32:focus-visible {
1180
+ ._ExternalInput-button_q3l5a_5:focus-visible,
1181
+ ._ExternalInput-detachButton_q3l5a_32:focus-visible {
1177
1182
  outline: 2px solid var(--puck-color-azure-05);
1178
1183
  outline-offset: 2px;
1179
1184
  z-index: 1;
1180
1185
  }
1181
1186
  @media (hover: hover) and (pointer: fine) {
1182
- ._ExternalInput-button_oqtaj_5:hover,
1183
- ._ExternalInput-detachButton_oqtaj_32:hover {
1187
+ ._ExternalInput-button_q3l5a_5:hover,
1188
+ ._ExternalInput-detachButton_q3l5a_32:hover {
1184
1189
  background: var(--puck-color-azure-12);
1185
1190
  transition: none;
1186
1191
  }
1187
- ._ExternalInput-detachButton_oqtaj_32:hover {
1192
+ ._ExternalInput-detachButton_q3l5a_32:hover {
1188
1193
  color: var(--puck-color-azure-04);
1189
1194
  }
1190
1195
  }
1191
- ._ExternalInput-button_oqtaj_5:active,
1192
- ._ExternalInput-detachButton_oqtaj_32:active {
1196
+ ._ExternalInput-button_q3l5a_5:active,
1197
+ ._ExternalInput-detachButton_q3l5a_32:active {
1193
1198
  background: var(--puck-color-azure-11);
1194
1199
  transition: none;
1195
1200
  }
1196
- ._ExternalInputModal_oqtaj_74 {
1201
+ ._ExternalInputModal_q3l5a_74 {
1197
1202
  color: var(--puck-color-black);
1198
- display: flex;
1199
- flex-direction: column;
1203
+ display: grid;
1204
+ grid-template-rows: min-content minmax(128px, 100%) min-content;
1205
+ grid-template-columns: 100%;
1200
1206
  position: relative;
1207
+ min-height: 50vh;
1201
1208
  max-height: 90vh;
1202
1209
  }
1203
- ._ExternalInputModal-masthead_oqtaj_82 {
1204
- background-color: var(--puck-color-white);
1210
+ ._ExternalInputModal-grid_q3l5a_84 {
1211
+ display: flex;
1212
+ flex-direction: column;
1213
+ }
1214
+ @media (min-width: 458px) {
1215
+ ._ExternalInputModal-grid_q3l5a_84 {
1216
+ display: grid;
1217
+ grid-template-columns: 100%;
1218
+ }
1219
+ ._ExternalInputModal--filtersToggled_q3l5a_95 ._ExternalInputModal-grid_q3l5a_84 {
1220
+ grid-template-columns: 25% 75%;
1221
+ }
1222
+ }
1223
+ ._ExternalInputModal-filters_q3l5a_100 {
1224
+ border-bottom: 1px solid var(--puck-color-grey-09);
1225
+ }
1226
+ ._ExternalInputModal--filtersToggled_q3l5a_95 ._ExternalInputModal-filters_q3l5a_100 {
1227
+ display: none;
1228
+ }
1229
+ @media (min-width: 458px) {
1230
+ ._ExternalInputModal-filters_q3l5a_100 {
1231
+ border-right: 1px solid var(--puck-color-grey-09);
1232
+ display: none;
1233
+ }
1234
+ ._ExternalInputModal--filtersToggled_q3l5a_95 ._ExternalInputModal-filters_q3l5a_100 {
1235
+ display: block;
1236
+ }
1237
+ }
1238
+ ._ExternalInputModal-masthead_q3l5a_119 {
1239
+ background-color: var(--puck-color-grey-12);
1240
+ border-bottom: 1px solid var(--puck-color-grey-09);
1205
1241
  display: flex;
1206
1242
  flex-wrap: wrap;
1207
1243
  gap: 24px;
1208
- padding: 32px 24px;
1244
+ padding: 24px;
1209
1245
  }
1210
- ._ExternalInputModal-tableWrapper_oqtaj_90 {
1246
+ ._ExternalInputModal-tableWrapper_q3l5a_128 {
1211
1247
  position: relative;
1212
1248
  overflow-x: auto;
1213
1249
  overflow-y: auto;
1214
1250
  flex-grow: 1;
1215
1251
  }
1216
- ._ExternalInputModal-table_oqtaj_90 {
1252
+ ._ExternalInputModal-table_q3l5a_128 {
1217
1253
  border-collapse: unset;
1218
1254
  border-spacing: 0px;
1219
1255
  color: var(--puck-color-grey-02);
@@ -1221,50 +1257,51 @@ textarea._Input-input_3msty_45 {
1221
1257
  z-index: 0;
1222
1258
  min-width: 100%;
1223
1259
  }
1224
- ._ExternalInputModal-thead_oqtaj_106 {
1260
+ ._ExternalInputModal-thead_q3l5a_144 {
1261
+ background-color: var(--puck-color-white);
1225
1262
  position: sticky;
1226
1263
  top: 0;
1227
1264
  z-index: 1;
1228
1265
  }
1229
- ._ExternalInputModal-th_oqtaj_106 {
1266
+ ._ExternalInputModal-th_q3l5a_144 {
1230
1267
  border-bottom: 1px solid var(--puck-color-grey-09);
1231
- border-top: 1px solid var(--puck-color-grey-09);
1232
- font-weight: 700;
1268
+ color: var(--puck-color-grey-04);
1269
+ font-weight: 500;
1270
+ font-size: 14px;
1233
1271
  padding: 16px 24px;
1234
- opacity: 0.9;
1235
1272
  }
1236
- ._ExternalInputModal-td_oqtaj_120 {
1273
+ ._ExternalInputModal-td_q3l5a_159 {
1274
+ border-bottom: 1px solid var(--puck-color-grey-10);
1237
1275
  padding: 16px 24px;
1238
1276
  }
1239
- ._ExternalInputModal-tr_oqtaj_124:nth-of-type(n) {
1240
- background-color: var(--puck-color-white);
1241
- }
1242
- ._ExternalInputModal-tr_oqtaj_124:nth-of-type(2n) {
1243
- background-color: var(--puck-color-grey-12);
1244
- }
1245
- ._ExternalInputModal-tr_oqtaj_124 ._ExternalInputModal-td_oqtaj_120:first-of-type {
1277
+ ._ExternalInputModal-tr_q3l5a_164 ._ExternalInputModal-td_q3l5a_159:first-of-type {
1246
1278
  font-weight: 500;
1279
+ width: 1%;
1280
+ white-space: nowrap;
1247
1281
  }
1248
1282
  @media (hover: hover) and (pointer: fine) {
1249
- ._ExternalInputModal-tbody_oqtaj_137 ._ExternalInputModal-tr_oqtaj_124:hover {
1250
- background: var(--puck-color-grey-11);
1283
+ ._ExternalInputModal-tbody_q3l5a_171 ._ExternalInputModal-tr_q3l5a_164:hover {
1284
+ background: var(--puck-color-azure-12);
1251
1285
  color: var(--puck-color-azure-04);
1252
1286
  cursor: pointer;
1253
1287
  position: relative;
1254
1288
  margin-left: -5px;
1255
1289
  }
1256
- ._ExternalInputModal-tbody_oqtaj_137 ._ExternalInputModal-tr_oqtaj_124:hover ._ExternalInputModal-td_oqtaj_120:first-of-type {
1290
+ ._ExternalInputModal-tbody_q3l5a_171 ._ExternalInputModal-tr_q3l5a_164:hover ._ExternalInputModal-td_q3l5a_159:first-of-type {
1257
1291
  border-left: 4px solid var(--puck-color-azure-04);
1258
1292
  padding-left: 20px;
1259
1293
  }
1260
1294
  }
1261
- ._ExternalInputModal-tableWrapper_oqtaj_90 {
1295
+ ._ExternalInputModal-tbody_q3l5a_171 ._ExternalInputModal-tr_q3l5a_164:last-of-type ._ExternalInputModal-td_q3l5a_159 {
1296
+ border-bottom: none;
1297
+ }
1298
+ ._ExternalInputModal-tableWrapper_q3l5a_128 {
1262
1299
  display: none;
1263
1300
  }
1264
- ._ExternalInputModal--hasData_oqtaj_157 ._ExternalInputModal-tableWrapper_oqtaj_90 {
1301
+ ._ExternalInputModal--hasData_q3l5a_197 ._ExternalInputModal-tableWrapper_q3l5a_128 {
1265
1302
  display: block;
1266
1303
  }
1267
- ._ExternalInputModal-loadingBanner_oqtaj_161 {
1304
+ ._ExternalInputModal-loadingBanner_q3l5a_201 {
1268
1305
  display: none;
1269
1306
  background-color: color-mix(in srgb, var(--puck-color-white) 90%, transparent);
1270
1307
  padding: 64px;
@@ -1276,46 +1313,42 @@ textarea._Input-input_3msty_45 {
1276
1313
  right: 0;
1277
1314
  bottom: 0;
1278
1315
  }
1279
- ._ExternalInputModal--isLoading_oqtaj_174 ._ExternalInputModal-loadingBanner_oqtaj_161 {
1316
+ ._ExternalInputModal--isLoading_q3l5a_218 ._ExternalInputModal-loadingBanner_q3l5a_201 {
1280
1317
  display: flex;
1281
1318
  }
1282
- ._ExternalInputModal-noContentBanner_oqtaj_178 {
1283
- display: none;
1284
- border-top: 1px solid var(--puck-color-grey-09);
1285
- padding: 24px;
1286
- text-align: center;
1287
- }
1288
- ._ExternalInputModal--loaded_oqtaj_185:not(._ExternalInputModal--hasData_oqtaj_157) ._ExternalInputModal-noContentBanner_oqtaj_178 {
1289
- display: block;
1290
- }
1291
- ._ExternalInputModal-searchForm_oqtaj_190 {
1319
+ ._ExternalInputModal-searchForm_q3l5a_222 {
1292
1320
  display: flex;
1293
- margin-left: auto;
1294
- height: 43px;
1321
+ flex-wrap: wrap;
1295
1322
  gap: 12px;
1323
+ flex-grow: 1;
1296
1324
  }
1297
- ._ExternalInputModal-search_oqtaj_190 {
1325
+ @media (min-width: 458px) {
1326
+ ._ExternalInputModal-searchForm_q3l5a_222 {
1327
+ flex-wrap: nowrap;
1328
+ }
1329
+ }
1330
+ ._ExternalInputModal-search_q3l5a_222 {
1298
1331
  display: flex;
1299
1332
  background: var(--puck-color-white);
1300
1333
  border-width: 1px;
1301
1334
  border-style: solid;
1302
1335
  border-color: var(--puck-color-grey-09);
1303
1336
  border-radius: 4px;
1337
+ flex-grow: 1;
1304
1338
  transition: border-color 50ms ease-in;
1305
- width: 100%;
1306
1339
  }
1307
- ._ExternalInputModal-search_oqtaj_190:focus-within {
1340
+ ._ExternalInputModal-search_q3l5a_222:focus-within {
1308
1341
  border-color: var(--puck-color-grey-05);
1309
1342
  outline: 2px solid var(--puck-color-azure-05);
1310
1343
  transition: none;
1311
1344
  }
1312
1345
  @media (hover: hover) and (pointer: fine) {
1313
- ._ExternalInputModal-search_oqtaj_190:hover {
1346
+ ._ExternalInputModal-search_q3l5a_222:hover {
1314
1347
  border-color: var(--puck-color-grey-05);
1315
1348
  transition: none;
1316
1349
  }
1317
1350
  }
1318
- ._ExternalInputModal-searchIcon_oqtaj_221 {
1351
+ ._ExternalInputModal-searchIcon_q3l5a_259 {
1319
1352
  align-items: center;
1320
1353
  background: var(--puck-color-grey-12);
1321
1354
  border-bottom-left-radius: 4px;
@@ -1327,17 +1360,17 @@ textarea._Input-input_3msty_45 {
1327
1360
  padding: 12px 15px;
1328
1361
  transition: color 50ms ease-in;
1329
1362
  }
1330
- ._ExternalInputModal-search_oqtaj_190:focus-within ._ExternalInputModal-searchIcon_oqtaj_221 {
1363
+ ._ExternalInputModal-search_q3l5a_222:focus-within ._ExternalInputModal-searchIcon_q3l5a_259 {
1331
1364
  color: var(--puck-color-grey-04);
1332
1365
  transition: none;
1333
1366
  }
1334
1367
  @media (hover: hover) and (pointer: fine) {
1335
- ._ExternalInputModal-search_oqtaj_190:hover ._ExternalInputModal-searchIcon_oqtaj_221 {
1368
+ ._ExternalInputModal-search_q3l5a_222:hover ._ExternalInputModal-searchIcon_q3l5a_259 {
1336
1369
  color: var(--puck-color-grey-04);
1337
1370
  transition: none;
1338
1371
  }
1339
1372
  }
1340
- ._ExternalInputModal-searchIconText_oqtaj_246 {
1373
+ ._ExternalInputModal-searchIconText_q3l5a_284 {
1341
1374
  clip: rect(0 0 0 0);
1342
1375
  clip-path: inset(100%);
1343
1376
  height: 1px;
@@ -1346,7 +1379,7 @@ textarea._Input-input_3msty_45 {
1346
1379
  white-space: nowrap;
1347
1380
  width: 1px;
1348
1381
  }
1349
- ._ExternalInputModal-searchInput_oqtaj_256 {
1382
+ ._ExternalInputModal-searchInput_q3l5a_294 {
1350
1383
  border: none;
1351
1384
  border-radius: 4px;
1352
1385
  background: var(--puck-color-white);
@@ -1355,13 +1388,36 @@ textarea._Input-input_3msty_45 {
1355
1388
  padding: 12px 15px;
1356
1389
  width: 100%;
1357
1390
  }
1358
- ._ExternalInputModal-searchInput_oqtaj_256:focus {
1391
+ ._ExternalInputModal-searchInput_q3l5a_294:focus {
1359
1392
  outline: 0;
1360
1393
  }
1394
+ ._ExternalInputModal-searchActions_q3l5a_308 {
1395
+ display: flex;
1396
+ gap: 8px;
1397
+ height: 44px;
1398
+ width: 100%;
1399
+ }
1400
+ @media (min-width: 458px) {
1401
+ ._ExternalInputModal-searchActions_q3l5a_308 {
1402
+ width: auto;
1403
+ }
1404
+ }
1405
+ ._ExternalInputModal-searchActionIcon_q3l5a_321 {
1406
+ align-self: center;
1407
+ }
1408
+ ._ExternalInputModal-footer_q3l5a_325 {
1409
+ background-color: var(--puck-color-grey-12);
1410
+ border-top: 1px solid var(--puck-color-grey-09);
1411
+ color: var(--puck-color-grey-04);
1412
+ font-weight: 500;
1413
+ font-size: 14px;
1414
+ padding: 16px;
1415
+ text-align: right;
1416
+ }
1361
1417
 
1362
1418
  /* css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css/#css-module-data */
1363
- ._Modal_1yh4j_1 {
1364
- background: color-mix(in srgb, var(--puck-color-black) 99%, transparent);
1419
+ ._Modal_zud0i_1 {
1420
+ background: color-mix(in srgb, var(--puck-color-black) 75%, transparent);
1365
1421
  display: none;
1366
1422
  justify-content: center;
1367
1423
  align-items: center;
@@ -1371,15 +1427,15 @@ textarea._Input-input_3msty_45 {
1371
1427
  bottom: 0;
1372
1428
  right: 0;
1373
1429
  z-index: 1;
1374
- padding: 64px;
1430
+ padding: 32px;
1375
1431
  }
1376
- ._Modal--isOpen_1yh4j_15 {
1432
+ ._Modal--isOpen_zud0i_15 {
1377
1433
  display: flex;
1378
1434
  }
1379
- ._Modal-inner_1yh4j_19 {
1435
+ ._Modal-inner_zud0i_19 {
1380
1436
  width: 100%;
1381
1437
  max-width: 1024px;
1382
- border-radius: 16px;
1438
+ border-radius: 8px;
1383
1439
  overflow: hidden;
1384
1440
  background: var(--puck-color-white);
1385
1441
  display: flex;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as Config, D as Data, I as ItemSelector, U as UiState, A as AppState, F as Field, a as DefaultComponentProps, b as DefaultRootProps, M as MappedItem, R as RootDataWithProps, c as RootData } from './Config-1444273f.js';
2
- export { g as Adaptor, f as ArrayField, r as ArrayState, n as BaseData, B as BaseField, m as ComponentConfig, o as ComponentData, k as Content, i as CustomField, s as DropZone, h as ExternalField, E as ExternalFieldWithAdaptor, j as Fields, q as ItemWithId, N as NumberField, O as ObjectField, P as PuckComponent, l as PuckContext, e as RadioField, p as RootDataWithoutProps, S as SelectField, T as TextField, d as TextareaField } from './Config-1444273f.js';
1
+ import { C as Config, D as Data, I as ItemSelector, U as UiState, A as AppState, F as Field, a as DefaultComponentProps, b as DefaultRootProps, M as MappedItem, R as RootDataWithProps, c as RootData } from './Config-0bf39037.js';
2
+ export { g as Adaptor, f as ArrayField, r as ArrayState, n as BaseData, B as BaseField, m as ComponentConfig, o as ComponentData, k as Content, i as CustomField, s as DropZone, h as ExternalField, E as ExternalFieldWithAdaptor, j as Fields, q as ItemWithId, N as NumberField, O as ObjectField, P as PuckComponent, l as PuckContext, e as RadioField, p as RootDataWithoutProps, S as SelectField, T as TextField, d as TextareaField } from './Config-0bf39037.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import { ReactNode, CSSProperties, ReactElement, SyntheticEvent } from 'react';
@@ -125,6 +125,7 @@ declare const Drawer: {
125
125
  name: string;
126
126
  children?: ((props: {
127
127
  children: ReactNode;
128
+ name: string;
128
129
  }) => ReactElement) | undefined;
129
130
  id?: string | undefined;
130
131
  index: number;
@@ -167,7 +168,7 @@ type RenderFunc<Props extends {
167
168
  [key: string]: any;
168
169
  } = {
169
170
  children: ReactNode;
170
- }> = React.FunctionComponent<Props>;
171
+ }> = (props: Props) => ReactElement;
171
172
  declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "components", "componentItem", "outline", "puck", "preview"];
172
173
  type OverrideKey = (typeof overrideKeys)[number];
173
174
  type OverridesGeneric<Shape extends {
@@ -197,7 +198,10 @@ type Overrides = OverridesGeneric<{
197
198
  className?: string;
198
199
  }>;
199
200
  components: RenderFunc;
200
- componentItem: RenderFunc;
201
+ componentItem: RenderFunc<{
202
+ children: ReactNode;
203
+ name: string;
204
+ }>;
201
205
  outline: RenderFunc;
202
206
  puck: RenderFunc;
203
207
  }>;
@@ -271,10 +275,34 @@ declare const resolveAllData: (data: Data, config: Config<any, any, any>, onReso
271
275
  zones: Record<string, MappedItem[]>;
272
276
  }>;
273
277
 
278
+ type History<D = any> = {
279
+ id: string;
280
+ data: D;
281
+ };
282
+ type HistoryStore<D = any> = {
283
+ index: number;
284
+ currentHistory: History;
285
+ hasPast: boolean;
286
+ hasFuture: boolean;
287
+ record: (data: D) => void;
288
+ back: VoidFunction;
289
+ forward: VoidFunction;
290
+ nextHistory: History<D> | null;
291
+ prevHistory: History<D> | null;
292
+ histories: History<D>[];
293
+ };
294
+
295
+ type PuckHistory = {
296
+ back: VoidFunction;
297
+ forward: VoidFunction;
298
+ historyStore: HistoryStore;
299
+ };
300
+
274
301
  declare const usePuck: () => {
275
302
  appState: AppState;
276
303
  config: Config<any, any, any>;
277
304
  dispatch: (action: PuckAction) => void;
305
+ history: Partial<PuckHistory>;
278
306
  };
279
307
 
280
308
  export { AppState, Button, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZoneProvider, Field, FieldLabel, IconButton, MappedItem, Puck, PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
package/dist/index.js CHANGED
@@ -8084,7 +8084,7 @@ var require_react_dom_development = __commonJS({
8084
8084
  var HostPortal = 4;
8085
8085
  var HostComponent = 5;
8086
8086
  var HostText = 6;
8087
- var Fragment14 = 7;
8087
+ var Fragment13 = 7;
8088
8088
  var Mode = 8;
8089
8089
  var ContextConsumer = 9;
8090
8090
  var ContextProvider = 10;
@@ -9240,7 +9240,7 @@ var require_react_dom_development = __commonJS({
9240
9240
  return "DehydratedFragment";
9241
9241
  case ForwardRef:
9242
9242
  return getWrappedName$1(type, type.render, "ForwardRef");
9243
- case Fragment14:
9243
+ case Fragment13:
9244
9244
  return "Fragment";
9245
9245
  case HostComponent:
9246
9246
  return type;
@@ -18911,7 +18911,7 @@ var require_react_dom_development = __commonJS({
18911
18911
  }
18912
18912
  }
18913
18913
  function updateFragment2(returnFiber, current2, fragment, lanes, key) {
18914
- if (current2 === null || current2.tag !== Fragment14) {
18914
+ if (current2 === null || current2.tag !== Fragment13) {
18915
18915
  var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
18916
18916
  created.return = returnFiber;
18917
18917
  return created;
@@ -19314,7 +19314,7 @@ var require_react_dom_development = __commonJS({
19314
19314
  if (child.key === key) {
19315
19315
  var elementType = element.type;
19316
19316
  if (elementType === REACT_FRAGMENT_TYPE) {
19317
- if (child.tag === Fragment14) {
19317
+ if (child.tag === Fragment13) {
19318
19318
  deleteRemainingChildren(returnFiber, child.sibling);
19319
19319
  var existing = useFiber(child, element.props.children);
19320
19320
  existing.return = returnFiber;
@@ -23489,7 +23489,7 @@ var require_react_dom_development = __commonJS({
23489
23489
  var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
23490
23490
  return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
23491
23491
  }
23492
- case Fragment14:
23492
+ case Fragment13:
23493
23493
  return updateFragment(current2, workInProgress2, renderLanes2);
23494
23494
  case Mode:
23495
23495
  return updateMode(current2, workInProgress2, renderLanes2);
@@ -23762,7 +23762,7 @@ var require_react_dom_development = __commonJS({
23762
23762
  case SimpleMemoComponent:
23763
23763
  case FunctionComponent:
23764
23764
  case ForwardRef:
23765
- case Fragment14:
23765
+ case Fragment13:
23766
23766
  case Mode:
23767
23767
  case Profiler:
23768
23768
  case ContextConsumer:
@@ -28021,7 +28021,7 @@ var require_react_dom_development = __commonJS({
28021
28021
  return fiber;
28022
28022
  }
28023
28023
  function createFiberFromFragment(elements, mode, lanes, key) {
28024
- var fiber = createFiber(Fragment14, elements, key, mode);
28024
+ var fiber = createFiber(Fragment13, elements, key, mode);
28025
28025
  fiber.lanes = lanes;
28026
28026
  return fiber;
28027
28027
  }
@@ -29173,7 +29173,7 @@ var import_react2 = require("react");
29173
29173
 
29174
29174
  // css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
29175
29175
  init_react_import();
29176
- var Button_module_default = { "Button": "_Button_1hb69_1", "Button--medium": "_Button--medium_1hb69_29", "Button--large": "_Button--large_1hb69_37", "Button-icon": "_Button-icon_1hb69_44", "Button--primary": "_Button--primary_1hb69_48", "Button--secondary": "_Button--secondary_1hb69_67", "Button--flush": "_Button--flush_1hb69_82", "Button--disabled": "_Button--disabled_1hb69_86", "Button--fullWidth": "_Button--fullWidth_1hb69_93" };
29176
+ var Button_module_default = { "Button": "_Button_8fn3a_1", "Button--medium": "_Button--medium_8fn3a_29", "Button--large": "_Button--large_8fn3a_37", "Button-icon": "_Button-icon_8fn3a_44", "Button--primary": "_Button--primary_8fn3a_48", "Button--secondary": "_Button--secondary_8fn3a_67", "Button--flush": "_Button--flush_8fn3a_82", "Button--disabled": "_Button--disabled_8fn3a_86", "Button--fullWidth": "_Button--fullWidth_8fn3a_93", "Button-spinner": "_Button-spinner_8fn3a_98" };
29177
29177
 
29178
29178
  // lib/get-class-name-factory.ts
29179
29179
  init_react_import();
@@ -29255,10 +29255,7 @@ var Button = ({
29255
29255
  children: [
29256
29256
  icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassName("icon"), children: icon }),
29257
29257
  children,
29258
- loading && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
29259
- "\xA0\xA0",
29260
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_spinners.ClipLoader, { "aria-label": "loading", color: "inherit", size: "14px" })
29261
- ] })
29258
+ loading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassName("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_spinners.ClipLoader, { "aria-label": "loading", color: "inherit", size: "14px" }) })
29262
29259
  ]
29263
29260
  }
29264
29261
  );
@@ -29390,10 +29387,10 @@ var DrawerItem = ({
29390
29387
  const ctx = (0, import_react3.useContext)(drawerContext);
29391
29388
  const resolvedId = `${ctx.droppableId}::${id || name}`;
29392
29389
  const CustomInner = (0, import_react3.useMemo)(
29393
- () => children || (({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("default"), children: children2 })),
29390
+ () => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("default"), children: children2 })),
29394
29391
  [children]
29395
29392
  );
29396
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DrawerDraggable, { id: resolvedId, index, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CustomInner, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: getClassNameItem("draggable"), children: [
29393
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DrawerDraggable, { id: resolvedId, index, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: getClassNameItem("draggable"), children: [
29397
29394
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("name"), children: name }),
29398
29395
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: getClassNameItem("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DragIcon, {}) })
29399
29396
  ] }) }) }) });
@@ -29618,6 +29615,20 @@ var Search = createLucideIcon("Search", [
29618
29615
  ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
29619
29616
  ]);
29620
29617
 
29618
+ // ../../node_modules/lucide-react/dist/esm/icons/sliders-horizontal.js
29619
+ init_react_import();
29620
+ var SlidersHorizontal = createLucideIcon("SlidersHorizontal", [
29621
+ ["line", { x1: "21", x2: "14", y1: "4", y2: "4", key: "obuewd" }],
29622
+ ["line", { x1: "10", x2: "3", y1: "4", y2: "4", key: "1q6298" }],
29623
+ ["line", { x1: "21", x2: "12", y1: "12", y2: "12", key: "1iu8h1" }],
29624
+ ["line", { x1: "8", x2: "3", y1: "12", y2: "12", key: "ntss68" }],
29625
+ ["line", { x1: "21", x2: "16", y1: "20", y2: "20", key: "14d8ph" }],
29626
+ ["line", { x1: "12", x2: "3", y1: "20", y2: "20", key: "m0wm8r" }],
29627
+ ["line", { x1: "14", x2: "14", y1: "2", y2: "6", key: "14e1ph" }],
29628
+ ["line", { x1: "8", x2: "8", y1: "10", y2: "14", key: "1i6ji0" }],
29629
+ ["line", { x1: "16", x2: "16", y1: "18", y2: "22", key: "1lctlv" }]
29630
+ ]);
29631
+
29621
29632
  // ../../node_modules/lucide-react/dist/esm/icons/trash.js
29622
29633
  init_react_import();
29623
29634
  var Trash = createLucideIcon("Trash", [
@@ -31000,7 +31011,10 @@ var useResolvedData = (appState, config, dispatch) => {
31000
31011
  );
31001
31012
  const runResolvers = () => __async(void 0, null, function* () {
31002
31013
  const newData = newAppState.data;
31003
- const flatContent = Object.keys(newData.zones || {}).reduce((acc, zone) => [...acc, ...newData.zones[zone]], newData.content).filter((item) => !!config.components[item.type].resolveData);
31014
+ const flatContent = Object.keys(newData.zones || {}).reduce((acc, zone) => [...acc, ...newData.zones[zone]], newData.content).filter((item) => {
31015
+ var _a;
31016
+ return !!((_a = config.components[item.type]) == null ? void 0 : _a.resolveData);
31017
+ });
31004
31018
  const applyIfChange = (dynamicDataMap, dynamicRoot) => {
31005
31019
  const processed = applyDynamicProps(
31006
31020
  appState.data,
@@ -31151,7 +31165,7 @@ init_react_import();
31151
31165
 
31152
31166
  // css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/styles.module.css#css-module
31153
31167
  init_react_import();
31154
- var styles_module_default9 = { "Input": "_Input_3msty_1", "Input-label": "_Input-label_3msty_26", "Input-labelIcon": "_Input-labelIcon_3msty_34", "Input-disabledIcon": "_Input-disabledIcon_3msty_40", "Input-input": "_Input-input_3msty_45", "Input--readOnly": "_Input--readOnly_3msty_89", "Input-radioGroupItems": "_Input-radioGroupItems_3msty_100", "Input-radio": "_Input-radio_3msty_100", "Input-radioInner": "_Input-radioInner_3msty_117", "Input-radioInput": "_Input-radioInput_3msty_162" };
31168
+ var styles_module_default9 = { "Input": "_Input_1qi5b_1", "Input-label": "_Input-label_1qi5b_26", "Input-labelIcon": "_Input-labelIcon_1qi5b_34", "Input-disabledIcon": "_Input-disabledIcon_1qi5b_41", "Input-input": "_Input-input_1qi5b_46", "Input--readOnly": "_Input--readOnly_1qi5b_90", "Input-radioGroupItems": "_Input-radioGroupItems_1qi5b_101", "Input-radio": "_Input-radio_1qi5b_101", "Input-radioInner": "_Input-radioInner_1qi5b_118", "Input-radioInput": "_Input-radioInput_1qi5b_163" };
31155
31169
 
31156
31170
  // components/InputOrGroup/index.tsx
31157
31171
  var import_react18 = require("react");
@@ -31332,6 +31346,7 @@ var ArrayField = ({
31332
31346
  !readOnly && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameItem2("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameItem2("action"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
31333
31347
  IconButton,
31334
31348
  {
31349
+ disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
31335
31350
  onClick: (e) => {
31336
31351
  e.stopPropagation();
31337
31352
  const existingValue = [
@@ -31396,6 +31411,7 @@ var ArrayField = ({
31396
31411
  "button",
31397
31412
  {
31398
31413
  className: getClassName10("addButton"),
31414
+ disabled: field.max !== void 0 && localState.arrayState.items.length >= field.max,
31399
31415
  onClick: () => {
31400
31416
  const existingValue = value || [];
31401
31417
  const newValue = [
@@ -31405,7 +31421,7 @@ var ArrayField = ({
31405
31421
  const newArrayState = regenerateArrayState(newValue);
31406
31422
  onChange(newValue, mapArrayStateToUi(newArrayState));
31407
31423
  },
31408
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Plus, { size: "21" })
31424
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Plus, { size: 21 })
31409
31425
  }
31410
31426
  )
31411
31427
  ]
@@ -31476,7 +31492,7 @@ var import_react16 = require("react");
31476
31492
 
31477
31493
  // css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
31478
31494
  init_react_import();
31479
- var styles_module_default11 = { "ExternalInput-actions": "_ExternalInput-actions_oqtaj_1", "ExternalInput-button": "_ExternalInput-button_oqtaj_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_oqtaj_25", "ExternalInput-detachButton": "_ExternalInput-detachButton_oqtaj_32", "ExternalInputModal": "_ExternalInputModal_oqtaj_74", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_oqtaj_82", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_oqtaj_90", "ExternalInputModal-table": "_ExternalInputModal-table_oqtaj_90", "ExternalInputModal-thead": "_ExternalInputModal-thead_oqtaj_106", "ExternalInputModal-th": "_ExternalInputModal-th_oqtaj_106", "ExternalInputModal-td": "_ExternalInputModal-td_oqtaj_120", "ExternalInputModal-tr": "_ExternalInputModal-tr_oqtaj_124", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_oqtaj_137", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_oqtaj_157", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_oqtaj_161", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_oqtaj_174", "ExternalInputModal-noContentBanner": "_ExternalInputModal-noContentBanner_oqtaj_178", "ExternalInputModal--loaded": "_ExternalInputModal--loaded_oqtaj_185", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_oqtaj_190", "ExternalInputModal-search": "_ExternalInputModal-search_oqtaj_190", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_oqtaj_221", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_oqtaj_246", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_oqtaj_256" };
31495
+ var styles_module_default11 = { "ExternalInput-actions": "_ExternalInput-actions_q3l5a_1", "ExternalInput-button": "_ExternalInput-button_q3l5a_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_q3l5a_25", "ExternalInput-detachButton": "_ExternalInput-detachButton_q3l5a_32", "ExternalInputModal": "_ExternalInputModal_q3l5a_74", "ExternalInputModal-grid": "_ExternalInputModal-grid_q3l5a_84", "ExternalInputModal--filtersToggled": "_ExternalInputModal--filtersToggled_q3l5a_95", "ExternalInputModal-filters": "_ExternalInputModal-filters_q3l5a_100", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_q3l5a_119", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_q3l5a_128", "ExternalInputModal-table": "_ExternalInputModal-table_q3l5a_128", "ExternalInputModal-thead": "_ExternalInputModal-thead_q3l5a_144", "ExternalInputModal-th": "_ExternalInputModal-th_q3l5a_144", "ExternalInputModal-td": "_ExternalInputModal-td_q3l5a_159", "ExternalInputModal-tr": "_ExternalInputModal-tr_q3l5a_164", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_q3l5a_171", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_q3l5a_197", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_q3l5a_201", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_q3l5a_218", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_q3l5a_222", "ExternalInputModal-search": "_ExternalInputModal-search_q3l5a_222", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_q3l5a_259", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_q3l5a_284", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_q3l5a_294", "ExternalInputModal-searchActions": "_ExternalInputModal-searchActions_q3l5a_308", "ExternalInputModal-searchActionIcon": "_ExternalInputModal-searchActionIcon_q3l5a_321", "ExternalInputModal-footer": "_ExternalInputModal-footer_q3l5a_325" };
31480
31496
 
31481
31497
  // components/Modal/index.tsx
31482
31498
  init_react_import();
@@ -31484,7 +31500,7 @@ var import_react15 = require("react");
31484
31500
 
31485
31501
  // css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
31486
31502
  init_react_import();
31487
- var styles_module_default12 = { "Modal": "_Modal_1yh4j_1", "Modal--isOpen": "_Modal--isOpen_1yh4j_15", "Modal-inner": "_Modal-inner_1yh4j_19" };
31503
+ var styles_module_default12 = { "Modal": "_Modal_zud0i_1", "Modal--isOpen": "_Modal--isOpen_zud0i_15", "Modal-inner": "_Modal-inner_zud0i_19" };
31488
31504
 
31489
31505
  // components/Modal/index.tsx
31490
31506
  var import_react_dom = __toESM(require_react_dom());
@@ -31528,13 +31544,23 @@ var ExternalInput = ({
31528
31544
  name,
31529
31545
  id
31530
31546
  }) => {
31531
- const { mapProp = (val) => val } = field || {};
31547
+ const {
31548
+ mapProp = (val) => val,
31549
+ mapRow = (val) => val,
31550
+ filterFields
31551
+ } = field || {};
31532
31552
  const [data, setData] = (0, import_react16.useState)([]);
31533
31553
  const [isOpen, setOpen] = (0, import_react16.useState)(false);
31534
31554
  const [isLoading, setIsLoading] = (0, import_react16.useState)(true);
31555
+ const hasFilterFields = !!filterFields;
31556
+ const [filters, setFilters] = (0, import_react16.useState)(field.initialFilters || {});
31557
+ const [filtersToggled, setFiltersToggled] = (0, import_react16.useState)(hasFilterFields);
31558
+ const mappedData = (0, import_react16.useMemo)(() => {
31559
+ return data.map(mapRow);
31560
+ }, [data]);
31535
31561
  const keys = (0, import_react16.useMemo)(() => {
31536
31562
  const validKeys = /* @__PURE__ */ new Set();
31537
- for (const item of data) {
31563
+ for (const item of mappedData) {
31538
31564
  for (const key of Object.keys(item)) {
31539
31565
  if (typeof item[key] === "string" || typeof item[key] === "number") {
31540
31566
  validKeys.add(key);
@@ -31542,13 +31568,13 @@ var ExternalInput = ({
31542
31568
  }
31543
31569
  }
31544
31570
  return Array.from(validKeys);
31545
- }, [data]);
31571
+ }, [mappedData]);
31546
31572
  const [searchQuery, setSearchQuery] = (0, import_react16.useState)(field.initialQuery || "");
31547
31573
  const search = (0, import_react16.useCallback)(
31548
- (query) => __async(void 0, null, function* () {
31574
+ (query, filters2) => __async(void 0, null, function* () {
31549
31575
  setIsLoading(true);
31550
- const cacheKey = `${id}-${name}-${query}`;
31551
- const listData = dataCache[cacheKey] || (yield field.fetchList({ query }));
31576
+ const cacheKey = `${id}-${name}-${query}-${JSON.stringify(filters2)}`;
31577
+ const listData = dataCache[cacheKey] || (yield field.fetchList({ query, filters: filters2 }));
31552
31578
  if (listData) {
31553
31579
  setData(listData);
31554
31580
  setIsLoading(false);
@@ -31558,7 +31584,7 @@ var ExternalInput = ({
31558
31584
  [name, field]
31559
31585
  );
31560
31586
  (0, import_react16.useEffect)(() => {
31561
- search(searchQuery);
31587
+ search(searchQuery, filters);
31562
31588
  }, []);
31563
31589
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31564
31590
  "div",
@@ -31593,78 +31619,109 @@ var ExternalInput = ({
31593
31619
  )
31594
31620
  ] }),
31595
31621
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31596
- "div",
31622
+ "form",
31597
31623
  {
31598
31624
  className: getClassNameModal({
31599
31625
  isLoading,
31600
31626
  loaded: !isLoading,
31601
- hasData: data.length > 0
31627
+ hasData: mappedData.length > 0,
31628
+ filtersToggled
31602
31629
  }),
31630
+ onSubmit: (e) => {
31631
+ e.preventDefault();
31632
+ search(searchQuery, filters);
31633
+ },
31603
31634
  children: [
31604
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("masthead"), children: [
31605
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Heading, { rank: 2, size: "xxl", children: "Select content" }),
31606
- field.showSearch && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
31607
- "form",
31608
- {
31609
- className: getClassNameModal("searchForm"),
31610
- onSubmit: (e) => {
31611
- e.preventDefault();
31612
- search(searchQuery);
31613
- },
31614
- children: [
31615
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: getClassNameModal("search"), children: [
31616
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
31617
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Search, { size: "18" }) }),
31618
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31619
- "input",
31620
- {
31621
- className: getClassNameModal("searchInput"),
31622
- name: "q",
31623
- type: "search",
31624
- placeholder: "Search",
31625
- onChange: (e) => {
31626
- setSearchQuery(e.currentTarget.value);
31627
- },
31628
- autoComplete: "off",
31629
- value: searchQuery
31630
- }
31631
- )
31632
- ] }),
31633
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { type: "submit", loading: isLoading, disabled: isLoading, children: "Search" })
31634
- ]
31635
- }
31636
- )
31637
- ] }),
31638
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
31639
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("table", { className: getClassNameModal("table"), children: [
31640
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31641
- "th",
31635
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
31636
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: getClassNameModal("search"), children: [
31637
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
31638
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Search, { size: "18" }) }),
31639
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31640
+ "input",
31641
+ {
31642
+ className: getClassNameModal("searchInput"),
31643
+ name: "q",
31644
+ type: "search",
31645
+ placeholder: field.placeholder,
31646
+ onChange: (e) => {
31647
+ setSearchQuery(e.currentTarget.value);
31648
+ },
31649
+ autoComplete: "off",
31650
+ value: searchQuery
31651
+ }
31652
+ )
31653
+ ] }),
31654
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
31655
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
31656
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31657
+ IconButton,
31658
+ {
31659
+ title: "Toggle filters",
31660
+ onClick: (e) => {
31661
+ e.preventDefault();
31662
+ e.stopPropagation();
31663
+ setFiltersToggled(!filtersToggled);
31664
+ },
31665
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SlidersHorizontal, { size: 20 })
31666
+ }
31667
+ ) })
31668
+ ] })
31669
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Heading, { rank: 2, size: "xs", children: field.placeholder || "Select data" }) }),
31670
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("grid"), children: [
31671
+ hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
31672
+ const filterField = filterFields[fieldName];
31673
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31674
+ InputOrGroup,
31642
31675
  {
31643
- className: getClassNameModal("th"),
31644
- style: { textAlign: "left" },
31645
- children: key
31676
+ field: filterField,
31677
+ name: fieldName,
31678
+ id: `external_field_${fieldName}_filter`,
31679
+ label: filterField.label || fieldName,
31680
+ value: filters[fieldName],
31681
+ onChange: (value2) => {
31682
+ const newFilters = __spreadProps(__spreadValues({}, filters), { [fieldName]: value2 });
31683
+ setFilters(newFilters);
31684
+ search(searchQuery, newFilters);
31685
+ }
31646
31686
  },
31647
- key
31648
- )) }) }),
31649
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tbody", { className: getClassNameModal("tbody"), children: data.map((item, i) => {
31650
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31651
- "tr",
31687
+ fieldName
31688
+ );
31689
+ }) }),
31690
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
31691
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("table", { className: getClassNameModal("table"), children: [
31692
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31693
+ "th",
31652
31694
  {
31653
- style: { whiteSpace: "nowrap" },
31654
- className: getClassNameModal("tr"),
31655
- onClick: (e) => {
31656
- onChange(mapProp(item));
31657
- setOpen(false);
31658
- },
31659
- children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
31695
+ className: getClassNameModal("th"),
31696
+ style: { textAlign: "left" },
31697
+ children: key
31660
31698
  },
31661
- i
31662
- );
31663
- }) })
31664
- ] }),
31665
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_spinners5.ClipLoader, { size: 24, "aria-label": "Loading" }) })
31699
+ key
31700
+ )) }) }),
31701
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
31702
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
31703
+ "tr",
31704
+ {
31705
+ style: { whiteSpace: "nowrap" },
31706
+ className: getClassNameModal("tr"),
31707
+ onClick: () => {
31708
+ onChange(mapProp(data[i]));
31709
+ setOpen(false);
31710
+ },
31711
+ children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
31712
+ },
31713
+ i
31714
+ );
31715
+ }) })
31716
+ ] }),
31717
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_spinners5.ClipLoader, { size: 24, "aria-label": "Loading" }) })
31718
+ ] })
31666
31719
  ] }),
31667
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: getClassNameModal("noContentBanner"), children: "No results." })
31720
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: getClassNameModal("footer"), children: [
31721
+ mappedData.length,
31722
+ " result",
31723
+ mappedData.length === 1 ? "" : "s"
31724
+ ] })
31668
31725
  ]
31669
31726
  }
31670
31727
  ) })
@@ -31710,6 +31767,7 @@ var ExternalField = ({
31710
31767
  // DEPRECATED
31711
31768
  placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
31712
31769
  mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
31770
+ mapRow: validField.mapRow,
31713
31771
  fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
31714
31772
  return yield deprecatedField.adaptor.fetchList(
31715
31773
  deprecatedField.adaptorParams
@@ -33172,8 +33230,8 @@ var resolveAllData = (data, config, onResolveStart, onResolveEnd) => __async(voi
33172
33230
  // lib/use-puck.ts
33173
33231
  init_react_import();
33174
33232
  var usePuck = () => {
33175
- const { state: appState, config, dispatch } = useAppContext();
33176
- return { appState, config, dispatch };
33233
+ const { state: appState, config, history, dispatch } = useAppContext();
33234
+ return { appState, config, dispatch, history };
33177
33235
  };
33178
33236
  // Annotate the CommonJS export names for ESM import in node:
33179
33237
  0 && (module.exports = {
@@ -33417,6 +33475,14 @@ lucide-react/dist/esm/icons/search.js:
33417
33475
  * See the LICENSE file in the root directory of this source tree.
33418
33476
  *)
33419
33477
 
33478
+ lucide-react/dist/esm/icons/sliders-horizontal.js:
33479
+ (**
33480
+ * @license lucide-react v0.298.0 - ISC
33481
+ *
33482
+ * This source code is licensed under the ISC license.
33483
+ * See the LICENSE file in the root directory of this source tree.
33484
+ *)
33485
+
33420
33486
  lucide-react/dist/esm/icons/trash.js:
33421
33487
  (**
33422
33488
  * @license lucide-react v0.298.0 - ISC
package/dist/rsc.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as Config, D as Data } from './Config-1444273f.js';
2
+ import { C as Config, D as Data } from './Config-0bf39037.js';
3
3
  import 'react';
4
4
 
5
5
  declare function Render<UserConfig extends Config<any, any, any> = Config<any, any, any>>({ config, data }: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.14.0-canary.22a4182",
3
+ "version": "0.14.0-canary.2c15323",
4
4
  "author": "Measured Corporation Ltd <hello@measured.co>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",