@measured/puck 0.19.0-canary.1fc19b5 → 0.19.0-canary.24030a9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FieldProps, a as Field, D as DropZoneProps, C as Config, U as UserGenerics, b as Data, c as UiState, O as OnAction, P as Permissions, d as Plugin, e as Overrides, f as PuckAction, V as Viewports, I as IframeConfig, g as InitialHistory, M as Metadata, h as DefaultComponentProps, i as DefaultRootFieldProps, H as History, j as ComponentData, k as Fields, A as AppState, l as ComponentConfig } from './resolve-all-data-wwgDuTnC.mjs';
2
- export { Q as Adaptor, K as ArrayField, t as ArrayState, a2 as AsFieldProps, B as BaseData, E as BaseField, y as ComponentDataMap, z as Content, Y as CustomField, $ as DefaultRootProps, _ as DefaultRootRenderProps, m as Direction, n as DragAxis, X as ExternalField, W as ExternalFieldWithAdaptor, a4 as ExtractPropsFromConfig, a5 as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, x as MappedItem, N as NumberField, L as ObjectField, q as OverrideKey, u as PuckComponent, Z as PuckContext, J as RadioField, w as RootData, R as RootDataWithProps, v as RootDataWithoutProps, S as SelectField, T as TextField, G as TextareaField, o as Viewport, a3 as WithChildren, a0 as WithId, a1 as WithPuckProps, p as overrideKeys, a6 as resolveAllData } from './resolve-all-data-wwgDuTnC.mjs';
1
+ import { F as FieldProps, a as Field, D as DropZoneProps, C as Config, U as UserGenerics, b as Data, c as UiState, O as OnAction, P as Permissions, d as Plugin, e as Overrides, f as PuckAction, V as Viewports, I as IframeConfig, g as InitialHistory, M as Metadata, h as DefaultComponentProps, i as DefaultRootFieldProps, H as History, j as ComponentData, k as Fields, A as AppState, l as ComponentConfig } from './resolve-all-data-DleIzc4N.mjs';
2
+ export { Q as Adaptor, K as ArrayField, t as ArrayState, a2 as AsFieldProps, B as BaseData, E as BaseField, y as ComponentDataMap, z as Content, Y as CustomField, $ as DefaultRootProps, _ as DefaultRootRenderProps, m as Direction, n as DragAxis, X as ExternalField, W as ExternalFieldWithAdaptor, a4 as ExtractPropsFromConfig, a5 as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, x as MappedItem, N as NumberField, L as ObjectField, q as OverrideKey, u as PuckComponent, Z as PuckContext, J as RadioField, w as RootData, R as RootDataWithProps, v as RootDataWithoutProps, S as SelectField, T as TextField, G as TextareaField, o as Viewport, a3 as WithChildren, a0 as WithId, a1 as WithPuckProps, p as overrideKeys, a6 as resolveAllData } from './resolve-all-data-DleIzc4N.mjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import react__default, { ReactNode, SyntheticEvent, ReactElement } from 'react';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FieldProps, a as Field, D as DropZoneProps, C as Config, U as UserGenerics, b as Data, c as UiState, O as OnAction, P as Permissions, d as Plugin, e as Overrides, f as PuckAction, V as Viewports, I as IframeConfig, g as InitialHistory, M as Metadata, h as DefaultComponentProps, i as DefaultRootFieldProps, H as History, j as ComponentData, k as Fields, A as AppState, l as ComponentConfig } from './resolve-all-data-wwgDuTnC.js';
2
- export { Q as Adaptor, K as ArrayField, t as ArrayState, a2 as AsFieldProps, B as BaseData, E as BaseField, y as ComponentDataMap, z as Content, Y as CustomField, $ as DefaultRootProps, _ as DefaultRootRenderProps, m as Direction, n as DragAxis, X as ExternalField, W as ExternalFieldWithAdaptor, a4 as ExtractPropsFromConfig, a5 as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, x as MappedItem, N as NumberField, L as ObjectField, q as OverrideKey, u as PuckComponent, Z as PuckContext, J as RadioField, w as RootData, R as RootDataWithProps, v as RootDataWithoutProps, S as SelectField, T as TextField, G as TextareaField, o as Viewport, a3 as WithChildren, a0 as WithId, a1 as WithPuckProps, p as overrideKeys, a6 as resolveAllData } from './resolve-all-data-wwgDuTnC.js';
1
+ import { F as FieldProps, a as Field, D as DropZoneProps, C as Config, U as UserGenerics, b as Data, c as UiState, O as OnAction, P as Permissions, d as Plugin, e as Overrides, f as PuckAction, V as Viewports, I as IframeConfig, g as InitialHistory, M as Metadata, h as DefaultComponentProps, i as DefaultRootFieldProps, H as History, j as ComponentData, k as Fields, A as AppState, l as ComponentConfig } from './resolve-all-data-DleIzc4N.js';
2
+ export { Q as Adaptor, K as ArrayField, t as ArrayState, a2 as AsFieldProps, B as BaseData, E as BaseField, y as ComponentDataMap, z as Content, Y as CustomField, $ as DefaultRootProps, _ as DefaultRootRenderProps, m as Direction, n as DragAxis, X as ExternalField, W as ExternalFieldWithAdaptor, a4 as ExtractPropsFromConfig, a5 as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, x as MappedItem, N as NumberField, L as ObjectField, q as OverrideKey, u as PuckComponent, Z as PuckContext, J as RadioField, w as RootData, R as RootDataWithProps, v as RootDataWithoutProps, S as SelectField, T as TextField, G as TextareaField, o as Viewport, a3 as WithChildren, a0 as WithId, a1 as WithPuckProps, p as overrideKeys, a6 as resolveAllData } from './resolve-all-data-DleIzc4N.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import react__default, { ReactNode, SyntheticEvent, ReactElement } from 'react';
package/dist/index.js CHANGED
@@ -2758,6 +2758,7 @@ var createDynamicCollisionDetector = (dragAxis, midpointOffset = 0.05) => (input
2758
2758
  var import_modifiers = require("@dnd-kit/dom/modifiers");
2759
2759
  var import_jsx_runtime5 = require("react/jsx-runtime");
2760
2760
  var SortableProvider = ({
2761
+ container,
2761
2762
  children,
2762
2763
  onDragStart,
2763
2764
  onDragEnd,
@@ -2772,7 +2773,7 @@ var SortableProvider = ({
2772
2773
  modifiers: [
2773
2774
  import_modifiers.RestrictToElement.configure({
2774
2775
  element() {
2775
- return document.querySelector("[data-dnd-container]");
2776
+ return container.current;
2776
2777
  }
2777
2778
  })
2778
2779
  ],
@@ -2885,6 +2886,7 @@ var ArrayField = ({
2885
2886
  value: _value,
2886
2887
  name,
2887
2888
  label,
2889
+ labelIcon,
2888
2890
  readOnly,
2889
2891
  id,
2890
2892
  Label: Label2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", __spreadValues({}, props))
@@ -2949,6 +2951,7 @@ var ArrayField = ({
2949
2951
  }
2950
2952
  }, []);
2951
2953
  const [isDragging, setIsDragging] = (0, import_react16.useState)(false);
2954
+ const dndContainerRef = (0, import_react16.useRef)(null);
2952
2955
  const canEdit = useAppStore(
2953
2956
  (s) => s.permissions.getPermissions({ item: s.selectedItem }).edit
2954
2957
  );
@@ -2961,12 +2964,13 @@ var ArrayField = ({
2961
2964
  Label2,
2962
2965
  {
2963
2966
  label: label || name,
2964
- icon: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(List, { size: 16 }),
2967
+ icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(List, { size: 16 }),
2965
2968
  el: "div",
2966
2969
  readOnly,
2967
2970
  children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2968
2971
  SortableProvider,
2969
2972
  {
2973
+ container: dndContainerRef,
2970
2974
  onDragStart: () => setIsDragging(true),
2971
2975
  onDragEnd: () => setIsDragging(false),
2972
2976
  onMove: (move) => {
@@ -2997,164 +3001,172 @@ var ArrayField = ({
2997
3001
  addDisabled
2998
3002
  }),
2999
3003
  children: [
3000
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName5("inner"), "data-dnd-container": true, children: localState.arrayState.items.map((item, i) => {
3001
- const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
3002
- const data = Array.from(localState.value || [])[i] || {};
3003
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3004
- Sortable,
3005
- {
3006
- id: _arrayId,
3007
- index: i,
3008
- disabled: readOnly,
3009
- children: ({ status, ref }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
3010
- "div",
3004
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3005
+ "div",
3006
+ {
3007
+ ref: dndContainerRef,
3008
+ className: getClassName5("inner"),
3009
+ "data-dnd-container": true,
3010
+ children: localState.arrayState.items.map((item, i) => {
3011
+ const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
3012
+ const data = Array.from(localState.value || [])[i] || {};
3013
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3014
+ Sortable,
3011
3015
  {
3012
- ref,
3013
- className: getClassNameItem({
3014
- isExpanded: arrayState.openId === _arrayId,
3015
- isDragging: status === "dragging",
3016
- readOnly
3017
- }),
3018
- children: [
3019
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
3020
- "div",
3021
- {
3022
- onClick: (e) => {
3023
- if (isDragging) return;
3024
- e.preventDefault();
3025
- e.stopPropagation();
3026
- if (arrayState.openId === _arrayId) {
3027
- setUi(
3028
- mapArrayStateToUi({
3029
- openId: ""
3030
- })
3031
- );
3032
- } else {
3033
- setUi(
3034
- mapArrayStateToUi({
3035
- openId: _arrayId
3036
- })
3037
- );
3016
+ id: _arrayId,
3017
+ index: i,
3018
+ disabled: readOnly,
3019
+ children: ({ status, ref }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
3020
+ "div",
3021
+ {
3022
+ ref,
3023
+ className: getClassNameItem({
3024
+ isExpanded: arrayState.openId === _arrayId,
3025
+ isDragging: status === "dragging",
3026
+ readOnly
3027
+ }),
3028
+ children: [
3029
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
3030
+ "div",
3031
+ {
3032
+ onClick: (e) => {
3033
+ if (isDragging) return;
3034
+ e.preventDefault();
3035
+ e.stopPropagation();
3036
+ if (arrayState.openId === _arrayId) {
3037
+ setUi(
3038
+ mapArrayStateToUi({
3039
+ openId: ""
3040
+ })
3041
+ );
3042
+ } else {
3043
+ setUi(
3044
+ mapArrayStateToUi({
3045
+ openId: _arrayId
3046
+ })
3047
+ );
3048
+ }
3049
+ },
3050
+ className: getClassNameItem("summary"),
3051
+ children: [
3052
+ field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
3053
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: getClassNameItem("rhs"), children: [
3054
+ !readOnly && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: getClassNameItem("actions"), children: [
3055
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3056
+ IconButton,
3057
+ {
3058
+ type: "button",
3059
+ disabled: !!addDisabled,
3060
+ onClick: (e) => {
3061
+ e.stopPropagation();
3062
+ const existingValue = [...value || []];
3063
+ existingValue.splice(
3064
+ i,
3065
+ 0,
3066
+ existingValue[i]
3067
+ );
3068
+ onChange(
3069
+ existingValue,
3070
+ mapArrayStateToUi(
3071
+ regenerateArrayState(existingValue)
3072
+ )
3073
+ );
3074
+ },
3075
+ title: "Duplicate",
3076
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Copy, { size: 16 })
3077
+ }
3078
+ ) }),
3079
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3080
+ IconButton,
3081
+ {
3082
+ type: "button",
3083
+ disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
3084
+ onClick: (e) => {
3085
+ e.stopPropagation();
3086
+ const existingValue = [...value || []];
3087
+ const existingItems = [
3088
+ ...arrayState.items || []
3089
+ ];
3090
+ existingValue.splice(i, 1);
3091
+ existingItems.splice(i, 1);
3092
+ onChange(
3093
+ existingValue,
3094
+ mapArrayStateToUi({
3095
+ items: existingItems
3096
+ })
3097
+ );
3098
+ },
3099
+ title: "Delete",
3100
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Trash, { size: 16 })
3101
+ }
3102
+ ) })
3103
+ ] }),
3104
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DragIcon, {}) })
3105
+ ] })
3106
+ ]
3038
3107
  }
3039
- },
3040
- className: getClassNameItem("summary"),
3041
- children: [
3042
- field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
3043
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: getClassNameItem("rhs"), children: [
3044
- !readOnly && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: getClassNameItem("actions"), children: [
3045
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3046
- IconButton,
3047
- {
3048
- type: "button",
3049
- disabled: !!addDisabled,
3050
- onClick: (e) => {
3051
- e.stopPropagation();
3052
- const existingValue = [...value || []];
3053
- existingValue.splice(
3054
- i,
3055
- 0,
3056
- existingValue[i]
3057
- );
3058
- onChange(
3059
- existingValue,
3060
- mapArrayStateToUi(
3061
- regenerateArrayState(existingValue)
3062
- )
3063
- );
3064
- },
3065
- title: "Duplicate",
3066
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Copy, { size: 16 })
3067
- }
3068
- ) }),
3069
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3070
- IconButton,
3071
- {
3072
- type: "button",
3073
- disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
3074
- onClick: (e) => {
3075
- e.stopPropagation();
3076
- const existingValue = [...value || []];
3077
- const existingItems = [
3078
- ...arrayState.items || []
3079
- ];
3080
- existingValue.splice(i, 1);
3081
- existingItems.splice(i, 1);
3082
- onChange(
3083
- existingValue,
3084
- mapArrayStateToUi({
3085
- items: existingItems
3086
- })
3087
- );
3088
- },
3089
- title: "Delete",
3090
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Trash, { size: 16 })
3091
- }
3092
- ) })
3093
- ] }),
3094
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DragIcon, {}) })
3095
- ] })
3096
- ]
3097
- }
3098
- ),
3099
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3100
- "fieldset",
3101
- {
3102
- className: getClassNameItem("fieldset"),
3103
- onPointerDownCapture: (e) => {
3104
- e.stopPropagation();
3105
- },
3106
- children: Object.keys(field.arrayFields).map((subName) => {
3107
- const subField = field.arrayFields[subName];
3108
- const indexName = `${name}[${i}]`;
3109
- const subPath = `${indexName}.${subName}`;
3110
- const localIndexName = `${localName}[${i}]`;
3111
- const localWildcardName = `${localName}[*]`;
3112
- const localSubPath = `${localIndexName}.${subName}`;
3113
- const localWildcardSubPath = `${localWildcardName}.${subName}`;
3114
- const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
3115
- const label2 = subField.label || subName;
3116
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3117
- NestedFieldProvider,
3118
- {
3119
- name: localIndexName,
3120
- wildcardName: localWildcardName,
3121
- subName,
3122
- readOnlyFields,
3123
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3124
- AutoFieldPrivate,
3125
- {
3126
- name: subPath,
3127
- label: label2,
3128
- id: `${_arrayId}_${subName}`,
3129
- readOnly: subReadOnly,
3130
- field: __spreadProps(__spreadValues({}, subField), {
3131
- label: label2
3132
- // May be used by custom fields
3133
- }),
3134
- value: data[subName],
3135
- onChange: (val, ui) => {
3136
- onChange(
3137
- replace(value, i, __spreadProps(__spreadValues({}, data), {
3138
- [subName]: val
3139
- })),
3140
- ui
3141
- );
3142
- }
3143
- }
3144
- )
3108
+ ),
3109
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3110
+ "fieldset",
3111
+ {
3112
+ className: getClassNameItem("fieldset"),
3113
+ onPointerDownCapture: (e) => {
3114
+ e.stopPropagation();
3145
3115
  },
3146
- subPath
3147
- );
3148
- })
3149
- }
3150
- ) })
3151
- ]
3152
- }
3153
- )
3154
- },
3155
- _arrayId
3156
- );
3157
- }) }),
3116
+ children: Object.keys(field.arrayFields).map((subName) => {
3117
+ const subField = field.arrayFields[subName];
3118
+ const indexName = `${name}[${i}]`;
3119
+ const subPath = `${indexName}.${subName}`;
3120
+ const localIndexName = `${localName}[${i}]`;
3121
+ const localWildcardName = `${localName}[*]`;
3122
+ const localSubPath = `${localIndexName}.${subName}`;
3123
+ const localWildcardSubPath = `${localWildcardName}.${subName}`;
3124
+ const subReadOnly = forceReadOnly ? forceReadOnly : typeof readOnlyFields[subPath] !== "undefined" ? readOnlyFields[localSubPath] : readOnlyFields[localWildcardSubPath];
3125
+ const label2 = subField.label || subName;
3126
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3127
+ NestedFieldProvider,
3128
+ {
3129
+ name: localIndexName,
3130
+ wildcardName: localWildcardName,
3131
+ subName,
3132
+ readOnlyFields,
3133
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3134
+ AutoFieldPrivate,
3135
+ {
3136
+ name: subPath,
3137
+ label: label2,
3138
+ id: `${_arrayId}_${subName}`,
3139
+ readOnly: subReadOnly,
3140
+ field: __spreadProps(__spreadValues({}, subField), {
3141
+ label: label2
3142
+ // May be used by custom fields
3143
+ }),
3144
+ value: data[subName],
3145
+ onChange: (val, ui) => {
3146
+ onChange(
3147
+ replace(value, i, __spreadProps(__spreadValues({}, data), {
3148
+ [subName]: val
3149
+ })),
3150
+ ui
3151
+ );
3152
+ }
3153
+ }
3154
+ )
3155
+ },
3156
+ subPath
3157
+ );
3158
+ })
3159
+ }
3160
+ ) })
3161
+ ]
3162
+ }
3163
+ )
3164
+ },
3165
+ _arrayId
3166
+ );
3167
+ })
3168
+ }
3169
+ ),
3158
3170
  !addDisabled && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3159
3171
  "button",
3160
3172
  {
@@ -3193,6 +3205,7 @@ var DefaultField = ({
3193
3205
  value: _value,
3194
3206
  name,
3195
3207
  label,
3208
+ labelIcon,
3196
3209
  Label: Label2,
3197
3210
  id
3198
3211
  }) => {
@@ -3201,7 +3214,7 @@ var DefaultField = ({
3201
3214
  Label2,
3202
3215
  {
3203
3216
  label: label || name,
3204
- icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
3217
+ icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
3205
3218
  field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Type, { size: 16 }),
3206
3219
  field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Hash, { size: 16 })
3207
3220
  ] }),
@@ -3631,6 +3644,7 @@ var ExternalField = ({
3631
3644
  value,
3632
3645
  name,
3633
3646
  label,
3647
+ labelIcon,
3634
3648
  Label: Label2,
3635
3649
  id,
3636
3650
  readOnly
@@ -3648,27 +3662,35 @@ var ExternalField = ({
3648
3662
  if (field.type !== "external") {
3649
3663
  return null;
3650
3664
  }
3651
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Label2, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3652
- ExternalInput,
3665
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3666
+ Label2,
3653
3667
  {
3654
- name,
3655
- field: __spreadProps(__spreadValues({}, validField), {
3656
- // DEPRECATED
3657
- placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
3658
- mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
3659
- mapRow: validField.mapRow,
3660
- fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
3661
- return yield deprecatedField.adaptor.fetchList(
3662
- deprecatedField.adaptorParams
3663
- );
3664
- }) : validField.fetchList
3665
- }),
3666
- onChange,
3667
- value,
3668
- id,
3669
- readOnly
3668
+ label: label || name,
3669
+ icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Link, { size: 16 }),
3670
+ el: "div",
3671
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3672
+ ExternalInput,
3673
+ {
3674
+ name,
3675
+ field: __spreadProps(__spreadValues({}, validField), {
3676
+ // DEPRECATED
3677
+ placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
3678
+ mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
3679
+ mapRow: validField.mapRow,
3680
+ fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
3681
+ return yield deprecatedField.adaptor.fetchList(
3682
+ deprecatedField.adaptorParams
3683
+ );
3684
+ }) : validField.fetchList
3685
+ }),
3686
+ onChange,
3687
+ value,
3688
+ id,
3689
+ readOnly
3690
+ }
3691
+ )
3670
3692
  }
3671
- ) });
3693
+ );
3672
3694
  };
3673
3695
 
3674
3696
  // components/AutoField/fields/RadioField/index.tsx
@@ -3697,6 +3719,7 @@ var RadioField = ({
3697
3719
  name,
3698
3720
  id,
3699
3721
  label,
3722
+ labelIcon,
3700
3723
  Label: Label2
3701
3724
  }) => {
3702
3725
  const flatOptions = (0, import_react21.useMemo)(
@@ -3709,7 +3732,7 @@ var RadioField = ({
3709
3732
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3710
3733
  Label2,
3711
3734
  {
3712
- icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CircleCheckBig, { size: 16 }),
3735
+ icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CircleCheckBig, { size: 16 }),
3713
3736
  label: label || name,
3714
3737
  readOnly,
3715
3738
  el: "div",
@@ -3756,6 +3779,7 @@ var SelectField = ({
3756
3779
  field,
3757
3780
  onChange,
3758
3781
  label,
3782
+ labelIcon,
3759
3783
  Label: Label2,
3760
3784
  value,
3761
3785
  name,
@@ -3773,7 +3797,7 @@ var SelectField = ({
3773
3797
  Label2,
3774
3798
  {
3775
3799
  label: label || name,
3776
- icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronDown, { size: 16 }),
3800
+ icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronDown, { size: 16 }),
3777
3801
  readOnly,
3778
3802
  children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3779
3803
  "select",
@@ -3817,24 +3841,33 @@ var TextareaField = ({
3817
3841
  value,
3818
3842
  name,
3819
3843
  label,
3844
+ labelIcon,
3820
3845
  Label: Label2,
3821
3846
  id
3822
3847
  }) => {
3823
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Label2, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3824
- "textarea",
3848
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3849
+ Label2,
3825
3850
  {
3826
- id,
3827
- className: getClassName13("input"),
3828
- autoComplete: "off",
3829
- name,
3830
- value: typeof value === "undefined" ? "" : value,
3831
- onChange: (e) => onChange(e.currentTarget.value),
3851
+ label: label || name,
3852
+ icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Type, { size: 16 }),
3832
3853
  readOnly,
3833
- tabIndex: readOnly ? -1 : void 0,
3834
- rows: 5,
3835
- placeholder: field.type === "textarea" ? field.placeholder : void 0
3854
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3855
+ "textarea",
3856
+ {
3857
+ id,
3858
+ className: getClassName13("input"),
3859
+ autoComplete: "off",
3860
+ name,
3861
+ value: typeof value === "undefined" ? "" : value,
3862
+ onChange: (e) => onChange(e.currentTarget.value),
3863
+ readOnly,
3864
+ tabIndex: readOnly ? -1 : void 0,
3865
+ rows: 5,
3866
+ placeholder: field.type === "textarea" ? field.placeholder : void 0
3867
+ }
3868
+ )
3836
3869
  }
3837
- ) });
3870
+ );
3838
3871
  };
3839
3872
 
3840
3873
  // components/AutoField/fields/ObjectField/index.tsx
@@ -3853,6 +3886,7 @@ var ObjectField = ({
3853
3886
  value,
3854
3887
  name,
3855
3888
  label,
3889
+ labelIcon,
3856
3890
  Label: Label2,
3857
3891
  readOnly,
3858
3892
  id
@@ -3866,7 +3900,7 @@ var ObjectField = ({
3866
3900
  Label2,
3867
3901
  {
3868
3902
  label: label || name,
3869
- icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EllipsisVertical, { size: 16 }),
3903
+ icon: labelIcon || /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EllipsisVertical, { size: 16 }),
3870
3904
  el: "div",
3871
3905
  readOnly,
3872
3906
  children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14(), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((subName) => {
@@ -3983,6 +4017,7 @@ function AutoFieldInternal(props) {
3983
4017
  const { id, Label: Label2 = FieldLabelInternal } = props;
3984
4018
  const field = props.field;
3985
4019
  const label = field.label;
4020
+ const labelIcon = field.labelIcon;
3986
4021
  const defaultId = useSafeId();
3987
4022
  const resolvedId = id || defaultId;
3988
4023
  const defaultFields = {
@@ -4008,6 +4043,7 @@ function AutoFieldInternal(props) {
4008
4043
  const mergedProps = __spreadProps(__spreadValues({}, props), {
4009
4044
  field,
4010
4045
  label,
4046
+ labelIcon,
4011
4047
  Label: Label2,
4012
4048
  id: resolvedId
4013
4049
  });
@@ -4070,10 +4106,13 @@ function AutoFieldPrivate(props) {
4070
4106
  const isFocused = useAppStore((s) => s.state.ui.field.focus === props.name);
4071
4107
  const { value, onChange } = props;
4072
4108
  const [localValue, setLocalValue] = (0, import_react24.useState)(value);
4073
- const onChangeLocal = (0, import_react24.useCallback)((val, ui) => {
4074
- setLocalValue(val);
4075
- onChange(val, ui);
4076
- }, []);
4109
+ const onChangeLocal = (0, import_react24.useCallback)(
4110
+ (val, ui) => {
4111
+ setLocalValue(val);
4112
+ onChange(val, ui);
4113
+ },
4114
+ [onChange]
4115
+ );
4077
4116
  (0, import_react24.useEffect)(() => {
4078
4117
  if (!isFocused) {
4079
4118
  setLocalValue(value);