@box/metadata-editor 0.92.3 → 0.92.5

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.
Files changed (53) hide show
  1. package/chunks/taxonomy-ancestor-status-pill.js +34 -35
  2. package/esm/lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js +5 -5
  3. package/esm/lib/components/add-metadata-template-dropdown/messages.js +1 -1
  4. package/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +39 -40
  5. package/esm/lib/components/combobox-with-api-pagination/messages.js +1 -1
  6. package/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-empty-state.js +1 -1
  7. package/esm/lib/components/filter-dropdown-menu/filter-dropdown-menu-search.js +6 -6
  8. package/esm/lib/components/filter-dropdown-menu/messages.js +1 -1
  9. package/esm/lib/components/filter-instances-dropdown/filter-instances-dropdown.js +7 -7
  10. package/esm/lib/components/filter-instances-dropdown/messages.js +1 -1
  11. package/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js +15 -16
  12. package/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.js +1 -1
  13. package/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +1 -1
  14. package/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +27 -28
  15. package/esm/lib/components/metadata-editor-fields/components/metadata-float-field/use-float-validation.js +6 -6
  16. package/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +5 -5
  17. package/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +9 -9
  18. package/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +5 -5
  19. package/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/messages.js +1 -1
  20. package/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/update-mode-field-wrapper.js +1 -1
  21. package/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +70 -567
  22. package/esm/lib/components/metadata-editor-fields/metadata-editor-fields.js +18 -19
  23. package/esm/lib/components/metadata-empty-state/messages.js +1 -1
  24. package/esm/lib/components/metadata-empty-state/metadata-empty-state.js +1 -1
  25. package/esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/autofill-overlay.js +1 -1
  26. package/esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/messages.js +1 -1
  27. package/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance/custom-instance.js +10 -10
  28. package/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance/messages.js +1 -1
  29. package/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/custom-instance-new-field.js +1 -1
  30. package/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/messages.js +1 -1
  31. package/esm/lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/delete-confirmation-modal.js +14 -15
  32. package/esm/lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/messages.js +1 -1
  33. package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/messages.js +1 -1
  34. package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js +1 -1
  35. package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-footer/messages.js +1 -1
  36. package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-footer/metadata-instance-form-footer.js +1 -1
  37. package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/messages.js +2 -2
  38. package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js +1 -1
  39. package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-inline-notice/messages.js +1 -1
  40. package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-inline-notice/metadata-instance-form-inline-notice.js +14 -14
  41. package/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-instance-entry.js +5 -5
  42. package/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/messages.js +3 -3
  43. package/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/taxonomy-ancestor-status-pill.js +3 -4
  44. package/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-footer/messages.js +1 -1
  45. package/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-footer/metadata-instance-footer.js +1 -1
  46. package/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/messages.js +1 -1
  47. package/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js +1 -1
  48. package/esm/lib/components/unsaved-changes-modal/messages.js +1 -1
  49. package/esm/lib/components/unsaved-changes-modal/unsaved-changes-modal.js +18 -19
  50. package/esm/lib/messages.js +1 -1
  51. package/package.json +3 -3
  52. package/chunks/index.js +0 -292
  53. package/chunks/message.js +0 -18
@@ -1,577 +1,80 @@
1
- import tt from "clsx";
2
- import { useFormikContext as at } from "formik";
3
- import nt from "lodash/isUndefined";
4
- import { forwardRef as ot, useState as _r, useCallback as it, useEffect as vt, useMemo as st } from "react";
5
- import { AiSuggestionField as ct } from "./components/ai-suggestion-field/ai-suggestion-field.js";
6
- import { UpdateModeFieldWrapper as ut } from "./components/update-mode-field-wrapper/update-mode-field-wrapper.js";
7
- import { editorFieldTypes as lt } from "./editor-field-types.js";
8
- import { s as B } from "../../../../chunks/utils2.js";
9
- import { jsx as _, jsxs as ft } from "react/jsx-runtime";
10
- var k = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, D = function(r) {
11
- return r && r.Math === Math && r;
12
- }, f = (
13
- // eslint-disable-next-line es/no-global-this -- safe
14
- D(typeof globalThis == "object" && globalThis) || D(typeof window == "object" && window) || // eslint-disable-next-line no-restricted-globals -- safe
15
- D(typeof self == "object" && self) || D(typeof k == "object" && k) || D(typeof k == "object" && k) || // eslint-disable-next-line no-new-func -- fallback
16
- /* @__PURE__ */ function() {
17
- return this;
18
- }() || Function("return this")()
19
- ), wr = {}, y = function(r) {
20
- try {
21
- return !!r();
22
- } catch {
23
- return !0;
24
- }
25
- }, pt = y, h = !pt(function() {
26
- return Object.defineProperty({}, 1, { get: function() {
27
- return 7;
28
- } })[1] !== 7;
29
- }), $t = y, de = !$t(function() {
30
- var r = (function() {
31
- }).bind();
32
- return typeof r != "function" || r.hasOwnProperty("prototype");
33
- }), dt = de, z = Function.prototype.call, T = dt ? z.bind(z) : function() {
34
- return z.apply(z, arguments);
35
- }, ye = {}, ge = {}.propertyIsEnumerable, he = Object.getOwnPropertyDescriptor, yt = he && !ge.call({ 1: 2 }, 1);
36
- ye.f = yt ? function(e) {
37
- var t = he(this, e);
38
- return !!t && t.enumerable;
39
- } : ge;
40
- var Se = function(r, e) {
41
- return {
42
- enumerable: !(r & 1),
43
- configurable: !(r & 2),
44
- writable: !(r & 4),
45
- value: e
46
- };
47
- }, be = de, me = Function.prototype, gr = me.call, gt = be && me.bind.bind(gr, gr), s = be ? gt : function(r) {
48
- return function() {
49
- return gr.apply(r, arguments);
50
- };
51
- }, Oe = s, ht = Oe({}.toString), St = Oe("".slice), bt = function(r) {
52
- return St(ht(r), 8, -1);
53
- }, mt = s, Ot = y, wt = bt, er = Object, It = mt("".split), Et = Ot(function() {
54
- return !er("z").propertyIsEnumerable(0);
55
- }) ? function(r) {
56
- return wt(r) === "String" ? It(r, "") : er(r);
57
- } : er, we = function(r) {
58
- return r == null;
59
- }, Pt = we, jt = TypeError, Ie = function(r) {
60
- if (Pt(r)) throw new jt("Can't call method on " + r);
61
- return r;
62
- }, Tt = Et, Rt = Ie, Ir = function(r) {
63
- return Tt(Rt(r));
64
- }, tr = typeof document == "object" && document.all, p = typeof tr > "u" && tr !== void 0 ? function(r) {
65
- return typeof r == "function" || r === tr;
66
- } : function(r) {
67
- return typeof r == "function";
68
- }, Dt = p, M = function(r) {
69
- return typeof r == "object" ? r !== null : Dt(r);
70
- }, ar = f, Ct = p, Mt = function(r) {
71
- return Ct(r) ? r : void 0;
72
- }, Er = function(r, e) {
73
- return arguments.length < 2 ? Mt(ar[r]) : ar[r] && ar[r][e];
74
- }, Ft = s, At = Ft({}.isPrototypeOf), Nt = typeof navigator < "u" && String(navigator.userAgent) || "", Ee = f, nr = Nt, kr = Ee.process, zr = Ee.Deno, Kr = kr && kr.versions || zr && zr.version, Ur = Kr && Kr.v8, u, H;
75
- Ur && (u = Ur.split("."), H = u[0] > 0 && u[0] < 4 ? 1 : +(u[0] + u[1]));
76
- !H && nr && (u = nr.match(/Edge\/(\d+)/), (!u || u[1] >= 74) && (u = nr.match(/Chrome\/(\d+)/), u && (H = +u[1])));
77
- var xt = H, Gr = xt, Lt = y, Bt = f, _t = Bt.String, Pe = !!Object.getOwnPropertySymbols && !Lt(function() {
78
- var r = Symbol("symbol detection");
79
- return !_t(r) || !(Object(r) instanceof Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
80
- !Symbol.sham && Gr && Gr < 41;
81
- }), kt = Pe, je = kt && !Symbol.sham && typeof Symbol.iterator == "symbol", zt = Er, Kt = p, Ut = At, Gt = je, Vt = Object, Te = Gt ? function(r) {
82
- return typeof r == "symbol";
83
- } : function(r) {
84
- var e = zt("Symbol");
85
- return Kt(e) && Ut(e.prototype, Vt(r));
86
- }, Wt = String, Ht = function(r) {
87
- try {
88
- return Wt(r);
89
- } catch {
90
- return "Object";
91
- }
92
- }, Yt = p, qt = Ht, Xt = TypeError, Pr = function(r) {
93
- if (Yt(r)) return r;
94
- throw new Xt(qt(r) + " is not a function");
95
- }, Zt = Pr, Jt = we, Re = function(r, e) {
96
- var t = r[e];
97
- return Jt(t) ? void 0 : Zt(t);
98
- }, or = T, ir = p, vr = M, Qt = TypeError, ra = function(r, e) {
99
- var t, a;
100
- if (e === "string" && ir(t = r.toString) && !vr(a = or(t, r)) || ir(t = r.valueOf) && !vr(a = or(t, r)) || e !== "string" && ir(t = r.toString) && !vr(a = or(t, r))) return a;
101
- throw new Qt("Can't convert object to primitive value");
102
- }, De = { exports: {} }, Vr = f, ea = Object.defineProperty, jr = function(r, e) {
103
- try {
104
- ea(Vr, r, { value: e, configurable: !0, writable: !0 });
105
- } catch {
106
- Vr[r] = e;
107
- }
108
- return e;
109
- }, ta = f, aa = jr, Wr = "__core-js_shared__", Hr = De.exports = ta[Wr] || aa(Wr, {});
110
- (Hr.versions || (Hr.versions = [])).push({
111
- version: "3.36.1",
112
- mode: "global",
113
- copyright: "© 2014-2024 Denis Pushkarev (zloirock.ru)",
114
- license: "https://github.com/zloirock/core-js/blob/v3.36.1/LICENSE",
115
- source: "https://github.com/zloirock/core-js"
116
- });
117
- var Tr = De.exports, Yr = Tr, Ce = function(r, e) {
118
- return Yr[r] || (Yr[r] = e || {});
119
- }, na = Ie, oa = Object, ia = function(r) {
120
- return oa(na(r));
121
- }, va = s, sa = ia, ca = va({}.hasOwnProperty), S = Object.hasOwn || function(e, t) {
122
- return ca(sa(e), t);
123
- }, ua = s, la = 0, fa = Math.random(), pa = ua(1 .toString), Me = function(r) {
124
- return "Symbol(" + (r === void 0 ? "" : r) + ")_" + pa(++la + fa, 36);
125
- }, $a = f, da = Ce, qr = S, ya = Me, ga = Pe, ha = je, j = $a.Symbol, sr = da("wks"), Sa = ha ? j.for || j : j && j.withoutSetter || ya, ba = function(r) {
126
- return qr(sr, r) || (sr[r] = ga && qr(j, r) ? j[r] : Sa("Symbol." + r)), sr[r];
127
- }, ma = T, Xr = M, Zr = Te, Oa = Re, wa = ra, Ia = ba, Ea = TypeError, Pa = Ia("toPrimitive"), ja = function(r, e) {
128
- if (!Xr(r) || Zr(r)) return r;
129
- var t = Oa(r, Pa), a;
130
- if (t) {
131
- if (e === void 0 && (e = "default"), a = ma(t, r, e), !Xr(a) || Zr(a)) return a;
132
- throw new Ea("Can't convert object to primitive value");
133
- }
134
- return e === void 0 && (e = "number"), wa(r, e);
135
- }, Ta = ja, Ra = Te, Fe = function(r) {
136
- var e = Ta(r, "string");
137
- return Ra(e) ? e : e + "";
138
- }, Da = f, Jr = M, hr = Da.document, Ca = Jr(hr) && Jr(hr.createElement), Ma = function(r) {
139
- return Ca ? hr.createElement(r) : {};
140
- }, Fa = h, Aa = y, Na = Ma, Ae = !Fa && !Aa(function() {
141
- return Object.defineProperty(Na("div"), "a", {
142
- get: function() {
143
- return 7;
144
- }
145
- }).a !== 7;
146
- }), xa = h, La = T, Ba = ye, _a = Se, ka = Ir, za = Fe, Ka = S, Ua = Ae, Qr = Object.getOwnPropertyDescriptor;
147
- wr.f = xa ? Qr : function(e, t) {
148
- if (e = ka(e), t = za(t), Ua) try {
149
- return Qr(e, t);
150
- } catch {
151
- }
152
- if (Ka(e, t)) return _a(!La(Ba.f, e, t), e[t]);
153
- };
154
- var X = {}, Ga = h, Va = y, Wa = Ga && Va(function() {
155
- return Object.defineProperty(function() {
156
- }, "prototype", {
157
- value: 42,
158
- writable: !1
159
- }).prototype !== 42;
160
- }), Ha = M, Ya = String, qa = TypeError, Z = function(r) {
161
- if (Ha(r)) return r;
162
- throw new qa(Ya(r) + " is not an object");
163
- }, Xa = h, Za = Ae, Ja = Wa, K = Z, re = Fe, Qa = TypeError, cr = Object.defineProperty, rn = Object.getOwnPropertyDescriptor, ur = "enumerable", lr = "configurable", fr = "writable";
164
- X.f = Xa ? Ja ? function(e, t, a) {
165
- if (K(e), t = re(t), K(a), typeof e == "function" && t === "prototype" && "value" in a && fr in a && !a[fr]) {
166
- var n = rn(e, t);
167
- n && n[fr] && (e[t] = a.value, a = {
168
- configurable: lr in a ? a[lr] : n[lr],
169
- enumerable: ur in a ? a[ur] : n[ur],
170
- writable: !1
171
- });
172
- }
173
- return cr(e, t, a);
174
- } : cr : function(e, t, a) {
175
- if (K(e), t = re(t), K(a), Za) try {
176
- return cr(e, t, a);
177
- } catch {
178
- }
179
- if ("get" in a || "set" in a) throw new Qa("Accessors not supported");
180
- return "value" in a && (e[t] = a.value), e;
181
- };
182
- var en = h, tn = X, an = Se, Ne = en ? function(r, e, t) {
183
- return tn.f(r, e, an(1, t));
184
- } : function(r, e, t) {
185
- return r[e] = t, r;
186
- }, xe = { exports: {} }, Sr = h, nn = S, Le = Function.prototype, on = Sr && Object.getOwnPropertyDescriptor, Rr = nn(Le, "name"), vn = Rr && (function() {
187
- }).name === "something", sn = Rr && (!Sr || Sr && on(Le, "name").configurable), cn = {
188
- EXISTS: Rr,
189
- PROPER: vn,
190
- CONFIGURABLE: sn
191
- }, un = s, ln = p, br = Tr, fn = un(Function.toString);
192
- ln(br.inspectSource) || (br.inspectSource = function(r) {
193
- return fn(r);
194
- });
195
- var pn = br.inspectSource, $n = f, dn = p, ee = $n.WeakMap, yn = dn(ee) && /native code/.test(String(ee)), gn = Ce, hn = Me, te = gn("keys"), Sn = function(r) {
196
- return te[r] || (te[r] = hn(r));
197
- }, Be = {}, bn = yn, _e = f, mn = M, On = Ne, pr = S, $r = Tr, wn = Sn, In = Be, ae = "Object already initialized", mr = _e.TypeError, En = _e.WeakMap, Y, C, q, Pn = function(r) {
198
- return q(r) ? C(r) : Y(r, {});
199
- }, jn = function(r) {
200
- return function(e) {
201
- var t;
202
- if (!mn(e) || (t = C(e)).type !== r)
203
- throw new mr("Incompatible receiver, " + r + " required");
204
- return t;
205
- };
206
- };
207
- if (bn || $r.state) {
208
- var l = $r.state || ($r.state = new En());
209
- l.get = l.get, l.has = l.has, l.set = l.set, Y = function(r, e) {
210
- if (l.has(r)) throw new mr(ae);
211
- return e.facade = r, l.set(r, e), e;
212
- }, C = function(r) {
213
- return l.get(r) || {};
214
- }, q = function(r) {
215
- return l.has(r);
216
- };
217
- } else {
218
- var P = wn("state");
219
- In[P] = !0, Y = function(r, e) {
220
- if (pr(r, P)) throw new mr(ae);
221
- return e.facade = r, On(r, P, e), e;
222
- }, C = function(r) {
223
- return pr(r, P) ? r[P] : {};
224
- }, q = function(r) {
225
- return pr(r, P);
226
- };
227
- }
228
- var Tn = {
229
- set: Y,
230
- get: C,
231
- has: q,
232
- enforce: Pn,
233
- getterFor: jn
234
- }, Dr = s, Rn = y, Dn = p, U = S, Or = h, Cn = cn.CONFIGURABLE, Mn = pn, ke = Tn, Fn = ke.enforce, An = ke.get, ne = String, W = Object.defineProperty, Nn = Dr("".slice), xn = Dr("".replace), Ln = Dr([].join), Bn = Or && !Rn(function() {
235
- return W(function() {
236
- }, "length", { value: 8 }).length !== 8;
237
- }), _n = String(String).split("String"), kn = xe.exports = function(r, e, t) {
238
- Nn(ne(e), 0, 7) === "Symbol(" && (e = "[" + xn(ne(e), /^Symbol\(([^)]*)\).*$/, "$1") + "]"), t && t.getter && (e = "get " + e), t && t.setter && (e = "set " + e), (!U(r, "name") || Cn && r.name !== e) && (Or ? W(r, "name", { value: e, configurable: !0 }) : r.name = e), Bn && t && U(t, "arity") && r.length !== t.arity && W(r, "length", { value: t.arity });
239
- try {
240
- t && U(t, "constructor") && t.constructor ? Or && W(r, "prototype", { writable: !1 }) : r.prototype && (r.prototype = void 0);
241
- } catch {
242
- }
243
- var a = Fn(r);
244
- return U(a, "source") || (a.source = Ln(_n, typeof e == "string" ? e : "")), r;
245
- };
246
- Function.prototype.toString = kn(function() {
247
- return Dn(this) && An(this).source || Mn(this);
248
- }, "toString");
249
- var zn = xe.exports, Kn = p, Un = X, Gn = zn, Vn = jr, Wn = function(r, e, t, a) {
250
- a || (a = {});
251
- var n = a.enumerable, o = a.name !== void 0 ? a.name : e;
252
- if (Kn(t) && Gn(t, o, a), a.global)
253
- n ? r[e] = t : Vn(e, t);
254
- else {
255
- try {
256
- a.unsafe ? r[e] && (n = !0) : delete r[e];
257
- } catch {
258
- }
259
- n ? r[e] = t : Un.f(r, e, {
260
- value: t,
261
- enumerable: !1,
262
- configurable: !a.nonConfigurable,
263
- writable: !a.nonWritable
264
- });
265
- }
266
- return r;
267
- }, ze = {}, Hn = Math.ceil, Yn = Math.floor, qn = Math.trunc || function(e) {
268
- var t = +e;
269
- return (t > 0 ? Yn : Hn)(t);
270
- }, Xn = qn, Cr = function(r) {
271
- var e = +r;
272
- return e !== e || e === 0 ? 0 : Xn(e);
273
- }, Zn = Cr, Jn = Math.max, Qn = Math.min, ro = function(r, e) {
274
- var t = Zn(r);
275
- return t < 0 ? Jn(t + e, 0) : Qn(t, e);
276
- }, eo = Cr, to = Math.min, ao = function(r) {
277
- var e = eo(r);
278
- return e > 0 ? to(e, 9007199254740991) : 0;
279
- }, no = ao, oo = function(r) {
280
- return no(r.length);
281
- }, io = Ir, vo = ro, so = oo, oe = function(r) {
282
- return function(e, t, a) {
283
- var n = io(e), o = so(n);
284
- if (o === 0) return !r && -1;
285
- var i = vo(a, o), v;
286
- if (r && t !== t) {
287
- for (; o > i; )
288
- if (v = n[i++], v !== v) return !0;
289
- } else for (; o > i; i++)
290
- if ((r || i in n) && n[i] === t) return r || i || 0;
291
- return !r && -1;
292
- };
293
- }, co = {
294
- // `Array.prototype.includes` method
295
- // https://tc39.es/ecma262/#sec-array.prototype.includes
296
- includes: oe(!0),
297
- // `Array.prototype.indexOf` method
298
- // https://tc39.es/ecma262/#sec-array.prototype.indexof
299
- indexOf: oe(!1)
300
- }, uo = s, dr = S, lo = Ir, fo = co.indexOf, po = Be, ie = uo([].push), $o = function(r, e) {
301
- var t = lo(r), a = 0, n = [], o;
302
- for (o in t) !dr(po, o) && dr(t, o) && ie(n, o);
303
- for (; e.length > a; ) dr(t, o = e[a++]) && (~fo(n, o) || ie(n, o));
304
- return n;
305
- }, yo = [
306
- "constructor",
307
- "hasOwnProperty",
308
- "isPrototypeOf",
309
- "propertyIsEnumerable",
310
- "toLocaleString",
311
- "toString",
312
- "valueOf"
313
- ], go = $o, ho = yo, So = ho.concat("length", "prototype");
314
- ze.f = Object.getOwnPropertyNames || function(e) {
315
- return go(e, So);
316
- };
317
- var Ke = {};
318
- Ke.f = Object.getOwnPropertySymbols;
319
- var bo = Er, mo = s, Oo = ze, wo = Ke, Io = Z, Eo = mo([].concat), Po = bo("Reflect", "ownKeys") || function(e) {
320
- var t = Oo.f(Io(e)), a = wo.f;
321
- return a ? Eo(t, a(e)) : t;
322
- }, ve = S, jo = Po, To = wr, Ro = X, Do = function(r, e, t) {
323
- for (var a = jo(e), n = Ro.f, o = To.f, i = 0; i < a.length; i++) {
324
- var v = a[i];
325
- !ve(r, v) && !(t && ve(t, v)) && n(r, v, o(e, v));
326
- }
327
- }, Co = y, Mo = p, Fo = /#|\.prototype\./, F = function(r, e) {
328
- var t = No[Ao(r)];
329
- return t === Lo ? !0 : t === xo ? !1 : Mo(e) ? Co(e) : !!e;
330
- }, Ao = F.normalize = function(r) {
331
- return String(r).replace(Fo, ".").toLowerCase();
332
- }, No = F.data = {}, xo = F.NATIVE = "N", Lo = F.POLYFILL = "P", Bo = F, G = f, _o = wr.f, ko = Ne, zo = Wn, Ko = jr, Uo = Do, Go = Bo, b = function(r, e) {
333
- var t = r.target, a = r.global, n = r.stat, o, i, v, c, d, E;
334
- if (a ? i = G : n ? i = G[t] || Ko(t, {}) : i = G[t] && G[t].prototype, i) for (v in e) {
335
- if (d = e[v], r.dontCallGetSet ? (E = _o(i, v), c = E && E.value) : c = i[v], o = Go(a ? v : t + (n ? "." : "#") + v, r.forced), !o && c !== void 0) {
336
- if (typeof d == typeof c) continue;
337
- Uo(d, c);
338
- }
339
- (r.sham || c && c.sham) && ko(d, "sham", !0), zo(i, v, d, r);
340
- }
341
- }, yr = s, V = Set.prototype, $ = {
342
- // eslint-disable-next-line es/no-set -- safe
343
- Set,
344
- add: yr(V.add),
345
- has: yr(V.has),
346
- remove: yr(V.delete),
347
- proto: V
348
- }, Vo = $.has, m = function(r) {
349
- return Vo(r), r;
350
- }, Wo = T, O = function(r, e, t) {
351
- for (var a = t ? r : r.iterator, n = r.next, o, i; !(o = Wo(n, a)).done; )
352
- if (i = e(o.value), i !== void 0) return i;
353
- }, Ue = s, Ho = O, Ge = $, Yo = Ge.Set, Ve = Ge.proto, qo = Ue(Ve.forEach), We = Ue(Ve.keys), Xo = We(new Yo()).next, A = function(r, e, t) {
354
- return t ? Ho({ iterator: We(r), next: Xo }, e) : qo(r, e);
355
- }, He = $, Zo = A, Jo = He.Set, Qo = He.add, Mr = function(r) {
356
- var e = new Jo();
357
- return Zo(r, function(t) {
358
- Qo(e, t);
359
- }), e;
360
- }, ri = s, ei = Pr, ti = function(r, e, t) {
361
- try {
362
- return ri(ei(Object.getOwnPropertyDescriptor(r, e)[t]));
363
- } catch {
364
- }
365
- }, ai = ti, ni = $, N = ai(ni.proto, "size", "get") || function(r) {
366
- return r.size;
367
- }, oi = function(r) {
368
- return {
369
- iterator: r,
370
- next: r.next,
371
- done: !1
372
- };
373
- }, se = Pr, Ye = Z, ce = T, ii = Cr, vi = oi, ue = "Invalid size", si = RangeError, ci = TypeError, ui = Math.max, qe = function(r, e) {
374
- this.set = r, this.size = ui(e, 0), this.has = se(r.has), this.keys = se(r.keys);
375
- };
376
- qe.prototype = {
377
- getIterator: function() {
378
- return vi(Ye(ce(this.keys, this.set)));
379
- },
380
- includes: function(r) {
381
- return ce(this.has, this.set, r);
382
- }
383
- };
384
- var w = function(r) {
385
- Ye(r);
386
- var e = +r.size;
387
- if (e !== e) throw new ci(ue);
388
- var t = ii(e);
389
- if (t < 0) throw new si(ue);
390
- return new qe(r, t);
391
- }, li = m, Xe = $, fi = Mr, pi = N, $i = w, di = A, yi = O, gi = Xe.has, le = Xe.remove, hi = function(e) {
392
- var t = li(this), a = $i(e), n = fi(t);
393
- return pi(t) <= a.size ? di(t, function(o) {
394
- a.includes(o) && le(n, o);
395
- }) : yi(a.getIterator(), function(o) {
396
- gi(t, o) && le(n, o);
397
- }), n;
398
- }, Si = Er, fe = function(r) {
399
- return {
400
- size: r,
401
- has: function() {
402
- return !1;
403
- },
404
- keys: function() {
405
- return {
406
- next: function() {
407
- return { done: !0 };
408
- }
409
- };
410
- }
411
- };
412
- }, I = function(r) {
413
- var e = Si("Set");
414
- try {
415
- new e()[r](fe(0));
416
- try {
417
- return new e()[r](fe(-1)), !1;
418
- } catch {
419
- return !0;
420
- }
421
- } catch {
422
- return !1;
423
- }
424
- }, bi = b, mi = hi, Oi = I;
425
- bi({ target: "Set", proto: !0, real: !0, forced: !Oi("difference") }, {
426
- difference: mi
427
- });
428
- var wi = m, Fr = $, Ii = N, Ei = w, Pi = A, ji = O, Ti = Fr.Set, pe = Fr.add, Ri = Fr.has, Di = function(e) {
429
- var t = wi(this), a = Ei(e), n = new Ti();
430
- return Ii(t) > a.size ? ji(a.getIterator(), function(o) {
431
- Ri(t, o) && pe(n, o);
432
- }) : Pi(t, function(o) {
433
- a.includes(o) && pe(n, o);
434
- }), n;
435
- }, Ci = b, Mi = y, Fi = Di, Ai = I, Ni = !Ai("intersection") || Mi(function() {
436
- return String(Array.from((/* @__PURE__ */ new Set([1, 2, 3])).intersection(/* @__PURE__ */ new Set([3, 2])))) !== "3,2";
437
- });
438
- Ci({ target: "Set", proto: !0, real: !0, forced: Ni }, {
439
- intersection: Fi
440
- });
441
- var xi = T, $e = Z, Li = Re, Ze = function(r, e, t) {
442
- var a, n;
443
- $e(r);
444
- try {
445
- if (a = Li(r, "return"), !a) {
446
- if (e === "throw") throw t;
447
- return t;
448
- }
449
- a = xi(a, r);
450
- } catch (o) {
451
- n = !0, a = o;
452
- }
453
- if (e === "throw") throw t;
454
- if (n) throw a;
455
- return $e(a), t;
456
- }, Bi = m, _i = $.has, ki = N, zi = w, Ki = A, Ui = O, Gi = Ze, Vi = function(e) {
457
- var t = Bi(this), a = zi(e);
458
- if (ki(t) <= a.size) return Ki(t, function(o) {
459
- if (a.includes(o)) return !1;
460
- }, !0) !== !1;
461
- var n = a.getIterator();
462
- return Ui(n, function(o) {
463
- if (_i(t, o)) return Gi(n, "normal", !1);
464
- }) !== !1;
465
- }, Wi = b, Hi = Vi, Yi = I;
466
- Wi({ target: "Set", proto: !0, real: !0, forced: !Yi("isDisjointFrom") }, {
467
- isDisjointFrom: Hi
468
- });
469
- var qi = m, Xi = N, Zi = A, Ji = w, Qi = function(e) {
470
- var t = qi(this), a = Ji(e);
471
- return Xi(t) > a.size ? !1 : Zi(t, function(n) {
472
- if (!a.includes(n)) return !1;
473
- }, !0) !== !1;
474
- }, rv = b, ev = Qi, tv = I;
475
- rv({ target: "Set", proto: !0, real: !0, forced: !tv("isSubsetOf") }, {
476
- isSubsetOf: ev
477
- });
478
- var av = m, nv = $.has, ov = N, iv = w, vv = O, sv = Ze, cv = function(e) {
479
- var t = av(this), a = iv(e);
480
- if (ov(t) < a.size) return !1;
481
- var n = a.getIterator();
482
- return vv(n, function(o) {
483
- if (!nv(t, o)) return sv(n, "normal", !1);
484
- }) !== !1;
485
- }, uv = b, lv = cv, fv = I;
486
- uv({ target: "Set", proto: !0, real: !0, forced: !fv("isSupersetOf") }, {
487
- isSupersetOf: lv
488
- });
489
- var pv = m, Ar = $, $v = Mr, dv = w, yv = O, gv = Ar.add, hv = Ar.has, Sv = Ar.remove, bv = function(e) {
490
- var t = pv(this), a = dv(e).getIterator(), n = $v(t);
491
- return yv(a, function(o) {
492
- hv(t, o) ? Sv(n, o) : gv(n, o);
493
- }), n;
494
- }, mv = b, Ov = bv, wv = I;
495
- mv({ target: "Set", proto: !0, real: !0, forced: !wv("symmetricDifference") }, {
496
- symmetricDifference: Ov
497
- });
498
- var Iv = m, Ev = $.add, Pv = Mr, jv = w, Tv = O, Rv = function(e) {
499
- var t = Iv(this), a = jv(e).getIterator(), n = Pv(t);
500
- return Tv(a, function(o) {
501
- Ev(n, o);
502
- }), n;
503
- }, Dv = b, Cv = Rv, Mv = I;
504
- Dv({ target: "Set", proto: !0, real: !0, forced: !Mv("union") }, {
505
- union: Cv
506
- });
507
- const Kv = /* @__PURE__ */ ot(({
508
- disableForm: r,
509
- portalElement: e,
510
- field: t,
511
- index: a,
512
- taxonomyOptionsFetcher: n
513
- }, o) => {
514
- var Br;
1
+ import I from "clsx";
2
+ import { useFormikContext as v } from "formik";
3
+ import C from "lodash/isUndefined";
4
+ import { forwardRef as P, useState as N, useCallback as R, useEffect as T, useMemo as U } from "react";
5
+ import { AiSuggestionField as b } from "./components/ai-suggestion-field/ai-suggestion-field.js";
6
+ import { UpdateModeFieldWrapper as j } from "./components/update-mode-field-wrapper/update-mode-field-wrapper.js";
7
+ import { editorFieldTypes as $ } from "./editor-field-types.js";
8
+ import { s as n } from "../../../../chunks/utils2.js";
9
+ import { jsx as a, jsxs as B } from "react/jsx-runtime";
10
+ const X = /* @__PURE__ */ P(({
11
+ disableForm: g,
12
+ portalElement: c,
13
+ field: e,
14
+ index: V,
15
+ taxonomyOptionsFetcher: m
16
+ }, f) => {
17
+ var M;
515
18
  const {
516
- setFieldValue: i
517
- } = at(), [v, c] = _r(!0), [d, E] = _r(!1), J = lt[t.type], {
518
- aiSuggestion: g,
519
- type: Nr,
520
- value: Q
521
- } = t, Je = J && !t.hidden, Qe = !nt(t.updateMode), R = `metadata.fields[${a}]`, rt = t.type === "taxonomy" && ((Br = t.optionsRules) == null ? void 0 : Br.multiSelect), x = g && v, et = tt({
522
- [B.suggestionApplied]: d,
523
- [B.hasSuggestion]: x,
524
- [B.dateField]: Nr === "date"
525
- }), L = it((rr) => {
526
- i(`${R}.value`, rr), c(!1), E(!0);
527
- }, [R, i]);
528
- vt(() => {
529
- !x || Q || L(g);
530
- }, [x, g, L]);
531
- const xr = st(() => g && Q === g, [v]), Lr = () => {
532
- d && E(!1), xr && c(!1);
19
+ setFieldValue: S
20
+ } = v(), [A, p] = N(!0), [r, y] = N(!1), l = $[e.type], {
21
+ aiSuggestion: t,
22
+ type: h,
23
+ value: d
24
+ } = e, W = l && !e.hidden, k = !C(e.updateMode), s = `metadata.fields[${V}]`, w = e.type === "taxonomy" && ((M = e.optionsRules) == null ? void 0 : M.multiSelect), i = t && A, E = I({
25
+ [n.suggestionApplied]: r,
26
+ [n.hasSuggestion]: i,
27
+ [n.dateField]: h === "date"
28
+ }), o = R((u) => {
29
+ S(`${s}.value`, u), p(!1), y(!0);
30
+ }, [s, S]);
31
+ T(() => {
32
+ !i || d || o(t);
33
+ }, [i, t, o]);
34
+ const x = U(() => t && d === t, [A]), F = () => {
35
+ r && y(!1), x && p(!1);
533
36
  };
534
- return Je ? Qe ? /* @__PURE__ */ _(ut, {
535
- fieldNamePrefix: R,
536
- fieldType: t.type,
537
- isTaxonomyMultiSelect: rt,
538
- children: /* @__PURE__ */ _(J, {
539
- ref: o,
540
- description: t.description,
541
- disableForm: r,
542
- fieldNamePrefix: R,
37
+ return W ? k ? /* @__PURE__ */ a(j, {
38
+ fieldNamePrefix: s,
39
+ fieldType: e.type,
40
+ isTaxonomyMultiSelect: w,
41
+ children: /* @__PURE__ */ a(l, {
42
+ ref: f,
43
+ description: e.description,
44
+ disableForm: g,
45
+ fieldNamePrefix: s,
543
46
  isAiSuggestionApplied: !1,
544
- label: t.displayName,
545
- onValueEdited: Lr,
546
- portalElement: e,
547
- taxonomyOptionsFetcher: n
47
+ label: e.displayName,
48
+ onValueEdited: F,
49
+ portalElement: c,
50
+ taxonomyOptionsFetcher: m
548
51
  })
549
- }, t.key) : /* @__PURE__ */ ft("div", {
550
- className: B.fieldWrapper,
551
- children: [/* @__PURE__ */ _(J, {
552
- ref: o,
553
- className: et,
554
- description: t.description,
555
- disableForm: r,
556
- fieldNamePrefix: R,
557
- isAiSuggestionApplied: d,
558
- label: t.displayName,
559
- onValueEdited: Lr,
560
- portalElement: e,
561
- taxonomyOptionsFetcher: n
562
- }), x && /* @__PURE__ */ _(ct, {
563
- aiSuggestion: g,
564
- isSameValue: xr,
52
+ }, e.key) : /* @__PURE__ */ B("div", {
53
+ className: n.fieldWrapper,
54
+ children: [/* @__PURE__ */ a(l, {
55
+ ref: f,
56
+ className: E,
57
+ description: e.description,
58
+ disableForm: g,
59
+ fieldNamePrefix: s,
60
+ isAiSuggestionApplied: r,
61
+ label: e.displayName,
62
+ onValueEdited: F,
63
+ portalElement: c,
64
+ taxonomyOptionsFetcher: m
65
+ }), i && /* @__PURE__ */ a(b, {
66
+ aiSuggestion: t,
67
+ isSameValue: x,
565
68
  onAiSuggestionAppend: () => {
566
- const rr = [...new Set([Q, g].flat().filter(Boolean))];
567
- L(rr);
69
+ const u = [...new Set([d, t].flat().filter(Boolean))];
70
+ o(u);
568
71
  },
569
- onAiSuggestionIgnore: () => c(!1),
570
- onAiSuggestionReplace: () => L(g),
571
- type: Nr
72
+ onAiSuggestionIgnore: () => p(!1),
73
+ onAiSuggestionReplace: () => o(t),
74
+ type: h
572
75
  })]
573
- }, t.key) : null;
76
+ }, e.key) : null;
574
77
  });
575
78
  export {
576
- Kv as MetadataEditorFieldWrapper
79
+ X as MetadataEditorFieldWrapper
577
80
  };