@box/metadata-editor 0.70.2 → 0.70.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.
package/chunks/utils.js CHANGED
@@ -1,35 +1,42 @@
1
1
  import "../styles/utils.css";
2
- import { BoxAiLogo as r } from "@box/blueprint-web-assets/icons/Logo";
2
+ import { BoxAiLogo as s } from "@box/blueprint-web-assets/icons/Logo";
3
3
  import n from "../esm/lib/components/interactive-text/interactive-text.js";
4
- import { jsxs as _, jsx as t } from "react/jsx-runtime";
5
- const x = "_noAttributesText_ix3i9_753", c = "_fieldWrapper_ix3i9_757", b = "_hasSuggestion_ix3i9_762", p = "_error_ix3i9_770", d = "_dateField_ix3i9_782", g = "_suggestionApplied_ix3i9_786", m = "_comboboxContainer_ix3i9_786", u = "_labelWrapper_ix3i9_800", T = "_labelText_ix3i9_806", A = "_labelIcon_ix3i9_809", e = {
6
- noAttributesText: x,
7
- fieldWrapper: c,
4
+ import { jsxs as _, jsx as o } from "react/jsx-runtime";
5
+ const c = "_noAttributesText_ix3i9_753", x = "_fieldWrapper_ix3i9_757", b = "_hasSuggestion_ix3i9_762", p = "_error_ix3i9_770", g = "_dateField_ix3i9_782", d = "_suggestionApplied_ix3i9_786", u = "_comboboxContainer_ix3i9_786", m = "_labelWrapper_ix3i9_800", T = "_labelText_ix3i9_806", h = "_labelIcon_ix3i9_809", t = {
6
+ noAttributesText: c,
7
+ fieldWrapper: x,
8
8
  hasSuggestion: b,
9
9
  error: p,
10
- dateField: d,
11
- suggestionApplied: g,
12
- comboboxContainer: m,
13
- labelWrapper: u,
10
+ dateField: g,
11
+ suggestionApplied: d,
12
+ comboboxContainer: u,
13
+ labelWrapper: m,
14
14
  labelText: T,
15
- labelIcon: A
16
- }, F = (o, i, a = !1, s = "label") => (l) => /* @__PURE__ */ _("div", {
17
- className: e.labelWrapper,
18
- children: [i ? /* @__PURE__ */ t(n, {
19
- as: s,
20
- className: e.labelText,
15
+ labelIcon: h
16
+ }, f = (e, i, r = !1, a = "label") => (l) => /* @__PURE__ */ _("div", {
17
+ className: t.labelWrapper,
18
+ children: [i ? /* @__PURE__ */ o(n, {
19
+ as: a,
20
+ className: t.labelText,
21
21
  tooltipText: i,
22
22
  ...l,
23
- children: o
24
- }) : /* @__PURE__ */ t("label", {
25
- className: e.labelText,
23
+ children: e
24
+ }) : /* @__PURE__ */ o("label", {
25
+ className: t.labelText,
26
26
  ...l,
27
- children: o
28
- }), a && /* @__PURE__ */ t(r, {
29
- className: e.labelIcon
27
+ children: e
28
+ }), r && /* @__PURE__ */ o(s, {
29
+ className: t.labelIcon
30
30
  })]
31
- });
31
+ }), F = (e) => {
32
+ try {
33
+ return new Date(e).toISOString();
34
+ } catch {
35
+ return null;
36
+ }
37
+ };
32
38
  export {
33
- F as g,
34
- e as s
39
+ f as g,
40
+ t as s,
41
+ F as t
35
42
  };
@@ -1,49 +1,50 @@
1
1
  import "../../../../styles/combobox-with-api-pagination.css";
2
- import { ComboboxItemValue as oo } from "@ariakit/react";
3
- import { Combobox as m, LoadingIndicator as eo, InlineNotice as to, Text as ro } from "@box/blueprint-web";
4
- import { Search as no, Loader as ao } from "@box/blueprint-web-assets/icons/Fill";
5
- import { IconIconOnLightSecondary as io, Size6 as M, Size1 as so } from "@box/blueprint-web-assets/tokens/tokens";
6
- import { useForkRef as lo } from "@box/blueprint-web/lib-esm/utils/useForkRef";
7
- import co from "clsx";
8
- import { forwardRef as S, useRef as C, useCallback as uo, useMemo as L, useEffect as mo } from "react";
9
- import { useIntl as F, FormattedMessage as T } from "react-intl";
10
- import a from "./messages.js";
11
- import { useAsyncList as po } from "./use-async-list.js";
12
- import { useControllableState as ho } from "./utils/use-controllable-state.js";
13
- import { useTrackVisibility as fo } from "./utils/use-intersection-observer.js";
14
- import { jsx as r, jsxs as V, Fragment as bo } from "react/jsx-runtime";
15
- const go = "_container_181ao_1", xo = "_disabled_181ao_7", Oo = "_highlightOptionText_181ao_11", _o = "_option_181ao_24", Ro = "_errorComboboxOption_181ao_28", Co = "_errorComboboxOptionText_181ao_33", c = {
16
- container: go,
17
- disabled: xo,
18
- highlightOptionText: Oo,
19
- option: _o,
20
- errorComboboxOption: Ro,
21
- errorComboboxOptionText: Co
22
- }, N = /* @__PURE__ */ S(({
2
+ import { ComboboxItemValue as oe } from "@ariakit/react";
3
+ import { Combobox as d, LoadingIndicator as te, InlineNotice as re, Text as ne } from "@box/blueprint-web";
4
+ import { Search as ie, Loader as se } from "@box/blueprint-web-assets/icons/Fill";
5
+ import { IconIconOnLightSecondary as ae, Size6 as M, Size1 as le } from "@box/blueprint-web-assets/tokens/tokens";
6
+ import { useForkRef as ce } from "@box/blueprint-web/lib-esm/utils/useForkRef";
7
+ import T from "clsx";
8
+ import { forwardRef as F, useRef as C, useCallback as ue, useMemo as L, useEffect as me } from "react";
9
+ import { useIntl as P, FormattedMessage as V } from "react-intl";
10
+ import i from "./messages.js";
11
+ import { useAsyncList as de } from "./use-async-list.js";
12
+ import { useControllableState as pe } from "./utils/use-controllable-state.js";
13
+ import { useTrackVisibility as he } from "./utils/use-intersection-observer.js";
14
+ import { jsx as r, jsxs as N, Fragment as fe } from "react/jsx-runtime";
15
+ const be = "_container_1m7se_1", ge = "_disabled_1m7se_7", xe = "_highlightOptionText_1m7se_11", _e = "_selected_1m7se_23", Oe = "_option_1m7se_34", Re = "_errorComboboxOption_1m7se_38", Ce = "_errorComboboxOptionText_1m7se_43", a = {
16
+ container: be,
17
+ disabled: ge,
18
+ highlightOptionText: xe,
19
+ selected: _e,
20
+ option: Oe,
21
+ errorComboboxOption: Re,
22
+ errorComboboxOptionText: Ce
23
+ }, S = /* @__PURE__ */ F(({
23
24
  onTryAgain: y
24
25
  }, p) => {
25
26
  const {
26
27
  formatMessage: h
27
- } = F();
28
- return /* @__PURE__ */ V(bo, {
29
- children: [/* @__PURE__ */ r(to, {
28
+ } = P();
29
+ return /* @__PURE__ */ N(fe, {
30
+ children: [/* @__PURE__ */ r(re, {
30
31
  variant: "error",
31
- variantIconAriaLabel: h(a.loadingResultsErrorIconLabel),
32
- children: /* @__PURE__ */ r(T, {
33
- ...a.loadingResultsErrorMessage
32
+ variantIconAriaLabel: h(i.loadingResultsErrorIconLabel),
33
+ children: /* @__PURE__ */ r(V, {
34
+ ...i.loadingResultsErrorMessage
34
35
  })
35
- }), /* @__PURE__ */ r(m.Option, {
36
+ }), /* @__PURE__ */ r(d.Option, {
36
37
  ref: p,
37
- className: c.errorComboboxOption,
38
+ className: a.errorComboboxOption,
38
39
  onClick: y,
39
- children: /* @__PURE__ */ V(ro, {
40
+ children: /* @__PURE__ */ N(ne, {
40
41
  as: "span",
41
- className: c.errorComboboxOptionText,
42
+ className: a.errorComboboxOptionText,
42
43
  color: "textOnLightLink",
43
44
  variant: "bodyDefaultBold",
44
- children: [/* @__PURE__ */ r(T, {
45
- ...a.loadingResultsErrorAction
46
- }), /* @__PURE__ */ r(ao, {
45
+ children: [/* @__PURE__ */ r(V, {
46
+ ...i.loadingResultsErrorAction
47
+ }), /* @__PURE__ */ r(se, {
47
48
  color: "currentColor",
48
49
  height: "12px",
49
50
  width: "12px"
@@ -51,158 +52,157 @@ const go = "_container_181ao_1", xo = "_disabled_181ao_7", Oo = "_highlightOptio
51
52
  })
52
53
  })]
53
54
  });
54
- }), A = "__LOADING__", E = "__LOADING_ERROR__", Lo = "0px 0px 20px 0px", Ao = /* @__PURE__ */ r(no, {
55
- color: io,
55
+ }), A = "__LOADING__", E = "__LOADING_ERROR__", Le = "0px 0px 20px 0px", Ae = /* @__PURE__ */ r(ie, {
56
+ color: ae,
56
57
  height: M,
57
58
  role: "presentation",
58
59
  style: {
59
- padding: so,
60
+ padding: le,
60
61
  boxSizing: "border-box"
61
62
  },
62
63
  width: M
63
- }), Bo = /* @__PURE__ */ S(function(p, h) {
64
+ }), Be = /* @__PURE__ */ F(function(p, h) {
64
65
  const {
65
- defaultFetcher: P,
66
+ defaultFetcher: k,
66
67
  onInputValueChange: f,
67
- value: k,
68
- onValueChange: D,
69
- noResultMessage: w,
70
- defaultValue: B = [],
71
- loadingAriaLabel: W,
72
- multiselect: s = !1,
73
- disabled: z,
74
- className: G,
75
- ...j
68
+ value: D,
69
+ onValueChange: w,
70
+ noResultMessage: B,
71
+ defaultValue: W = [],
72
+ loadingAriaLabel: z,
73
+ multiselect: l = !1,
74
+ disabled: G,
75
+ className: j,
76
+ ...U
76
77
  } = p, {
77
78
  formatMessage: u
78
- } = F(), b = C(null), g = C(!0), o = po({
79
+ } = P(), b = C(null), g = C(!0), e = de({
79
80
  async load({
80
- marker: e,
81
+ marker: o,
81
82
  searchInput: t,
82
83
  signal: R
83
84
  }) {
84
- const l = await P({
85
+ const c = await k({
85
86
  signal: R,
86
- marker: e,
87
+ marker: o,
87
88
  searchInput: t
88
89
  });
89
90
  return {
90
- items: l.options,
91
- marker: l.marker
91
+ items: c.options,
92
+ marker: c.marker
92
93
  };
93
94
  }
94
- }), v = C(!1), U = uo(() => {
95
- v.current || (o.reload(), v.current = !0);
96
- }, []), [n, x] = ho({
97
- prop: k,
98
- defaultProp: B,
99
- onChange: D
100
- }), O = !s && n.length === 1, q = (e) => {
101
- e === void 0 ? (x([]), g.current || (o.search(""), g.current = !0)) : Array.isArray(e) ? x(e) : x([e]);
102
- }, H = L(() => n.length === 0 ? s ? [] : void 0 : s ? n : n[0], [s, n]), _ = L(() => n.filter((e) => !o.items.some((t) => t.value === e.value)), [n, o.items]), J = (e) => {
95
+ }), v = C(!1), q = ue(() => {
96
+ v.current || (e.reload(), v.current = !0);
97
+ }, []), [n, x] = pe({
98
+ prop: D,
99
+ defaultProp: W,
100
+ onChange: w
101
+ }), _ = !l && n.length === 1, H = (o) => {
102
+ o === void 0 ? (x([]), g.current || (e.search(""), g.current = !0)) : Array.isArray(o) ? x(o) : x([o]);
103
+ }, J = L(() => n.length === 0 ? l ? [] : void 0 : l ? n : n[0], [l, n]), O = L(() => n.filter((o) => !e.items.some((t) => t.value === o.value)), [n, e.items]), K = (o) => {
103
104
  const {
104
105
  value: t,
105
106
  displayValue: R,
106
- ...l
107
- } = e;
107
+ ...c
108
+ } = o;
108
109
  if (t === A)
109
- return o.hasNextPage ? /* @__PURE__ */ r(m.Option, {
110
- ...l,
111
- ref: X,
110
+ return e.hasNextPage ? /* @__PURE__ */ r(d.Option, {
111
+ ...c,
112
+ ref: Y,
112
113
  disabled: !0,
113
114
  value: t,
114
- children: /* @__PURE__ */ r(eo, {
115
- "aria-label": u(a.loadingMoreAriaLabel),
115
+ children: /* @__PURE__ */ r(te, {
116
+ "aria-label": u(i.loadingMoreAriaLabel),
116
117
  style: {
117
118
  position: "unset"
118
119
  }
119
120
  })
120
121
  }) : null;
121
- if (t === E && o.hasError && !o.isEmpty)
122
- return /* @__PURE__ */ r(N, {
122
+ if (t === E && e.hasError && !e.isEmpty)
123
+ return /* @__PURE__ */ r(S, {
123
124
  onTryAgain: () => {
124
- var i;
125
- o.loadMore(), (i = b.current) == null || i.focus();
125
+ var s;
126
+ e.loadMore(), (s = b.current) == null || s.focus();
126
127
  }
127
128
  });
128
- if (_.some((i) => i.value === t))
129
+ if (O.some((s) => s.value === t))
129
130
  return null;
130
- const $ = () => n.some((i) => i.value === t);
131
- return /* @__PURE__ */ r(m.Option, {
132
- ...l,
133
- className: c.option,
134
- disabled: $(),
131
+ const ee = n.some((s) => s.value === t);
132
+ return /* @__PURE__ */ r(d.Option, {
133
+ ...c,
134
+ className: a.option,
135
135
  value: t,
136
- children: /* @__PURE__ */ r(oo, {
137
- className: c.highlightOptionText,
136
+ children: /* @__PURE__ */ r(oe, {
137
+ className: T(a.highlightOptionText, ee && a.selected),
138
138
  value: R || t
139
139
  })
140
140
  });
141
- }, K = (e) => {
142
- if (f == null || f(e), O && e === "") {
141
+ }, Q = (o) => {
142
+ if (f == null || f(o), _ && o === "") {
143
143
  g.current = !1;
144
144
  return;
145
145
  }
146
- o.search(e);
147
- }, Q = () => {
148
- var e;
149
- o.reload(), (e = b.current) == null || e.focus();
146
+ e.search(o);
147
+ }, X = () => {
148
+ var o;
149
+ e.reload(), (o = b.current) == null || o.focus();
150
150
  };
151
- let d;
152
- o.hasError && !o.isLoading ? d = /* @__PURE__ */ r(N, {
153
- onTryAgain: Q
154
- }) : o.isEmpty && !o.isLoading ? d = w || u(a.noResults) : d = void 0;
155
- const [X, {
156
- rootRef: Y,
151
+ let m;
152
+ e.hasError && !e.isLoading ? m = /* @__PURE__ */ r(S, {
153
+ onTryAgain: X
154
+ }) : e.isEmpty && !e.isLoading ? m = B || u(i.noResults) : m = void 0;
155
+ const [Y, {
156
+ rootRef: Z,
157
157
  isVisible: I
158
- }] = fo({
159
- rootMargin: Lo
158
+ }] = he({
159
+ rootMargin: Le
160
160
  });
161
- mo(() => {
162
- if (!(I && o.hasNextPage))
161
+ me(() => {
162
+ if (!(I && e.hasNextPage))
163
163
  return;
164
164
  const t = setTimeout(() => {
165
- o.loadMore();
165
+ e.loadMore();
166
166
  }, 100);
167
167
  return () => {
168
168
  clearTimeout(t);
169
169
  };
170
170
  }, [I]);
171
- const Z = L(() => {
172
- const e = o.hasNextPage ? {
171
+ const $ = L(() => {
172
+ const o = e.hasNextPage ? {
173
173
  displayValue: A,
174
174
  value: A
175
- } : null, t = !e && o.hasError && !o.isEmpty ? {
175
+ } : null, t = !o && e.hasError && !e.isEmpty ? {
176
176
  displayValue: E,
177
177
  value: E
178
178
  } : null;
179
- return [...o.items, ..._, e, t].filter(Boolean);
180
- }, [o.hasNextPage, o.hasError, o.isEmpty, o.items, _]);
181
- return /* @__PURE__ */ r(m, {
179
+ return [...e.items, ...O, o, t].filter(Boolean);
180
+ }, [e.hasNextPage, e.hasError, e.isEmpty, e.items, O]);
181
+ return /* @__PURE__ */ r(d, {
182
182
  as: "input",
183
- ...j,
184
- ref: lo(b, h),
185
- className: co({
186
- [c.disabled]: O
187
- }, G),
188
- clearButtonAriaLabel: u(a.clearButtonAriaLabel),
189
- disabled: z || O,
190
- displayValue: (e) => e.displayValue || e.value,
191
- endComboboxIcon: Ao,
183
+ ...U,
184
+ ref: ce(b, h),
185
+ className: T({
186
+ [a.disabled]: _
187
+ }, j),
188
+ clearButtonAriaLabel: u(i.clearButtonAriaLabel),
189
+ disabled: G || _,
190
+ displayValue: (o) => o.displayValue || o.value,
191
+ endComboboxIcon: Ae,
192
192
  focusLoop: !1,
193
- getPopoverRef: Y,
194
- loading: o.isReloading,
195
- loadingAriaLabel: W || u(a.loadingAriaLabel),
196
- multiselect: s,
197
- noResultMessage: d,
198
- onFocus: U,
199
- onInputValueChange: K,
200
- onValueChange: q,
201
- options: Z,
202
- renderOption: J,
203
- value: H
193
+ getPopoverRef: Z,
194
+ loading: e.isReloading,
195
+ loadingAriaLabel: z || u(i.loadingAriaLabel),
196
+ multiselect: l,
197
+ noResultMessage: m,
198
+ onFocus: q,
199
+ onInputValueChange: Q,
200
+ onValueChange: H,
201
+ options: $,
202
+ renderOption: K,
203
+ value: J
204
204
  });
205
205
  });
206
206
  export {
207
- Bo as ComboboxWithApiPagination
207
+ Be as ComboboxWithApiPagination
208
208
  };
@@ -23,7 +23,7 @@ const d = "_header_d9pl2_1", f = {
23
23
  children: /* @__PURE__ */ e(l, {
24
24
  render: /* @__PURE__ */ e(m, {
25
25
  ref: t,
26
- as: "h1",
26
+ as: "h4",
27
27
  className: n(f.header, o),
28
28
  variant: "titleMedium",
29
29
  children: r
@@ -1,53 +1,54 @@
1
1
  import { Combobox as w } from "@box/blueprint-web";
2
- import { useFormikContext as x, getIn as L, Field as M } from "formik";
3
- import { forwardRef as $ } from "react";
4
- import { useIntl as I } from "react-intl";
5
- import V from "../../../../messages.js";
6
- import { g as j } from "../../../../../../chunks/utils.js";
7
- import { fieldDefaultProps as k } from "../constants.js";
8
- import { jsx as o } from "react/jsx-runtime";
9
- const A = /* @__PURE__ */ $(({
10
- className: s,
11
- isAiSuggestionApplied: i,
12
- description: n,
13
- disableForm: m,
14
- fieldNamePrefix: r,
2
+ import { useFormikContext as x, getIn as M, Field as $ } from "formik";
3
+ import { forwardRef as I } from "react";
4
+ import { useIntl as j } from "react-intl";
5
+ import k from "../../../../messages.js";
6
+ import { g as D } from "../../../../../../chunks/utils.js";
7
+ import { fieldDefaultProps as O } from "../constants.js";
8
+ import { jsx as t } from "react/jsx-runtime";
9
+ const E = /* @__PURE__ */ I(({
10
+ className: i,
11
+ isAiSuggestionApplied: n,
12
+ description: m,
13
+ disableForm: u,
14
+ fieldNamePrefix: o,
15
15
  label: l,
16
- onValueEdited: u,
17
- options: d,
18
- portalElement: p,
19
- updateModePrefix: f
20
- }, c) => {
16
+ onValueEdited: d,
17
+ options: f,
18
+ portalElement: c,
19
+ updateModePrefix: p
20
+ }, g) => {
21
21
  const {
22
- setFieldValue: g,
22
+ setFieldValue: h,
23
23
  values: F
24
- } = x(), h = I(), a = `${f ?? r}.value`, v = d || L(F, `${r}.options`, []).map(({
24
+ } = x(), v = j(), r = `${p ?? o}.value`, C = f || M(F, `${o}.options`, []).map(({
25
25
  key: e
26
- }) => e), C = (e, t) => t.toLowerCase().includes(e.toLowerCase());
27
- return /* @__PURE__ */ o("div", {
26
+ }) => e), L = (e, a) => a.toLowerCase().includes(e.toLowerCase());
27
+ return /* @__PURE__ */ t("div", {
28
28
  "data-testid": `${l}-field`,
29
- children: /* @__PURE__ */ o(M, {
30
- name: a,
29
+ children: /* @__PURE__ */ t($, {
30
+ name: r,
31
31
  children: ({
32
32
  field: e
33
33
  }) => {
34
- var t;
35
- return /* @__PURE__ */ o(w, {
36
- ...k,
37
- ref: c,
34
+ var s;
35
+ const b = (((s = e.value) == null ? void 0 : s.length) || 0) === 0 ? v.formatMessage(k.multiselectPlaceholder) : "";
36
+ return /* @__PURE__ */ t(w, {
37
+ ...O,
38
+ ref: g,
38
39
  as: "input",
39
- className: s,
40
- disabled: m,
41
- filterFn: C,
42
- label: j(l, n, i),
40
+ className: i,
41
+ disabled: u,
42
+ filterFn: L,
43
+ label: D(l, m, n),
43
44
  multiselect: !0,
44
45
  name: e.name,
45
- onValueChange: (b) => {
46
- g(a, b), u();
46
+ onValueChange: (V) => {
47
+ h(r, V), d();
47
48
  },
48
- options: v,
49
- placeholder: ((t = e.value) == null ? void 0 : t.length) === 0 ? h.formatMessage(V.multiselectPlaceholder) : "",
50
- portalElement: p,
49
+ options: C,
50
+ placeholder: b,
51
+ portalElement: c,
51
52
  value: e.value
52
53
  });
53
54
  }
@@ -55,6 +56,6 @@ const A = /* @__PURE__ */ $(({
55
56
  });
56
57
  });
57
58
  export {
58
- A as MetadataMultiSelectField,
59
- A as default
59
+ E as MetadataMultiSelectField,
60
+ E as default
60
61
  };
@@ -1,79 +1,83 @@
1
1
  import I from "clsx";
2
- import { useFormikContext as V } from "formik";
3
- import v from "lodash/isUndefined";
4
- import { forwardRef as C, useState as F, useCallback as P, useEffect as R } from "react";
2
+ import { useFormikContext as P } from "formik";
3
+ import V from "lodash/isUndefined";
4
+ import { forwardRef as v, useState as F, useCallback as C, useEffect as R } from "react";
5
5
  import { AiSuggestionField as T } from "./components/ai-suggestion-field/ai-suggestion-field.js";
6
6
  import { UpdateModeFieldWrapper as U } from "./components/update-mode-field-wrapper/update-mode-field-wrapper.js";
7
7
  import { editorFieldTypes as b } from "./editor-field-types.js";
8
- import { s as n } from "../../../../chunks/utils.js";
9
- import { jsx as a, jsxs as j } from "react/jsx-runtime";
10
- const L = /* @__PURE__ */ C(({
11
- disableForm: d,
8
+ import { t as j, s as n } from "../../../../chunks/utils.js";
9
+ import { jsx as a, jsxs as $ } from "react/jsx-runtime";
10
+ const Q = /* @__PURE__ */ v(({
11
+ disableForm: g,
12
12
  portalElement: u,
13
13
  field: e,
14
14
  index: M,
15
- taxonomyOptionsFetcher: g
16
- }, c) => {
15
+ taxonomyOptionsFetcher: c
16
+ }, m) => {
17
17
  var x;
18
18
  const {
19
- setFieldValue: m
20
- } = V(), [N, S] = F(!0), [p, f] = F(!1), r = b[e.type], {
21
- aiSuggestion: t,
22
- type: A,
19
+ setFieldValue: S
20
+ } = P(), [N, f] = F(!0), [r, A] = F(!1), p = b[e.type], {
21
+ type: l,
23
22
  value: y
24
- } = e, W = r && !e.hidden, k = !v(e.updateMode), s = `metadata.fields[${M}]`, w = e.type === "taxonomy" && ((x = e.optionsRules) == null ? void 0 : x.multiSelect), i = t && N, E = I({
25
- [n.suggestionApplied]: p,
23
+ } = e;
24
+ let {
25
+ aiSuggestion: t
26
+ } = e;
27
+ l === "date" && typeof t == "string" && (t = j(t));
28
+ const W = p && !e.hidden, k = !V(e.updateMode), s = `metadata.fields[${M}]`, w = e.type === "taxonomy" && ((x = e.optionsRules) == null ? void 0 : x.multiSelect), i = t && N, E = I({
29
+ [n.suggestionApplied]: r,
26
30
  [n.hasSuggestion]: i,
27
- [n.dateField]: A === "date"
28
- }), o = P((l) => {
29
- m(`${s}.value`, l), S(!1), f(!0);
30
- }, [s, m]);
31
+ [n.dateField]: l === "date"
32
+ }), o = C((d) => {
33
+ S(`${s}.value`, d), f(!1), A(!0);
34
+ }, [s, S]);
31
35
  R(() => {
32
36
  !i || y || o(t);
33
37
  }, [i, t, o]);
34
38
  const h = () => {
35
- p && f(!1);
39
+ r && A(!1);
36
40
  };
37
41
  return W ? k ? /* @__PURE__ */ a(U, {
38
42
  fieldNamePrefix: s,
39
43
  fieldType: e.type,
40
44
  isTaxonomyMultiSelect: w,
41
- children: /* @__PURE__ */ a(r, {
42
- ref: c,
45
+ children: /* @__PURE__ */ a(p, {
46
+ ref: m,
43
47
  description: e.description,
44
- disableForm: d,
48
+ disableForm: g,
45
49
  fieldNamePrefix: s,
46
50
  isAiSuggestionApplied: !1,
47
51
  label: e.displayName,
48
52
  onValueEdited: h,
49
53
  portalElement: u,
50
- taxonomyOptionsFetcher: g
54
+ taxonomyOptionsFetcher: c
51
55
  })
52
- }, e.key) : /* @__PURE__ */ j("div", {
56
+ }, e.key) : /* @__PURE__ */ $("div", {
53
57
  className: n.fieldWrapper,
54
- children: [/* @__PURE__ */ a(r, {
55
- ref: c,
58
+ children: [/* @__PURE__ */ a(p, {
59
+ ref: m,
56
60
  className: E,
57
61
  description: e.description,
58
- disableForm: d,
62
+ disableForm: g,
59
63
  fieldNamePrefix: s,
60
- isAiSuggestionApplied: p,
64
+ isAiSuggestionApplied: r,
61
65
  label: e.displayName,
62
66
  onValueEdited: h,
63
67
  portalElement: u,
64
- taxonomyOptionsFetcher: g
68
+ taxonomyOptionsFetcher: c
65
69
  }), i && /* @__PURE__ */ a(T, {
66
70
  aiSuggestion: t,
67
71
  onAiSuggestionAppend: () => {
68
- const l = [...new Set([y, t].flat())];
69
- o(l);
72
+ const d = [...new Set([y, t].flat())];
73
+ o(d);
70
74
  },
71
- onAiSuggestionIgnore: () => S(!1),
75
+ onAiSuggestionIgnore: () => f(!1),
72
76
  onAiSuggestionReplace: () => o(t),
73
- type: A
77
+ type: l
74
78
  })]
75
79
  }, e.key) : null;
76
80
  });
77
81
  export {
78
- L as MetadataEditorFieldWrapper
82
+ Q as MetadataEditorFieldWrapper
79
83
  };
@@ -1,7 +1,8 @@
1
1
  import "@box/blueprint-web-assets/icons/Logo";
2
2
  import "../interactive-text/interactive-text.js";
3
- import { g as m } from "../../../../chunks/utils.js";
3
+ import { g as i, t as g } from "../../../../chunks/utils.js";
4
4
  import "react/jsx-runtime";
5
5
  export {
6
- m as getFieldLabel
6
+ i as getFieldLabel,
7
+ g as tryParseDateSuggestion
7
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-editor",
3
- "version": "0.70.2",
3
+ "version": "0.70.5",
4
4
  "peerDependencies": {
5
5
  "@ariakit/react": "0.4.5",
6
6
  "@box/blueprint-web": "^7.30.3",
@@ -14,7 +14,7 @@
14
14
  "devDependencies": {
15
15
  "@ariakit/react": "0.4.5",
16
16
  "@box/babel-plugin-target-attributes": "1.3.0",
17
- "@box/blueprint-web": "^7.36.3",
17
+ "@box/blueprint-web": "^7.36.4",
18
18
  "@box/blueprint-web-assets": "^4.28.0",
19
19
  "@box/storybook-utils": "^0.7.0",
20
20
  "@testing-library/react": "^15.0.6",
@@ -53,5 +53,5 @@
53
53
  "**/*.css"
54
54
  ],
55
55
  "license": "SEE LICENSE IN LICENSE",
56
- "gitHead": "eb5ed5c64409c450071ca60d4c97aec952bfbd79"
56
+ "gitHead": "76637fd3a7b94c5ce67b9ca0823fa87baea7cf4a"
57
57
  }
@@ -1 +1 @@
1
- ._container_181ao_1{display:flex;gap:var(--space-1);justify-content:center}._disabled_181ao_7._disabled_181ao_7{opacity:unset}._highlightOptionText_181ao_11 [data-user-value]{font-weight:700;font-size:.875rem;font-family:Lato,-apple-system,BlinkMacSystemFont,San Francisco,Segoe UI,Roboto,Helvetica Neue,sans-serif;line-height:1.25rem;letter-spacing:.01875rem;text-transform:none;text-decoration:none}._highlightOptionText_181ao_11 [data-autocomplete-value]{color:var(--text-text-on-light-secondary)}._option_181ao_24:nth-last-child(1 of._option_181ao_24){scroll-margin-block-end:var(--space-12)}._errorComboboxOption_181ao_28[role=option]{display:flex;align-items:center;justify-content:center}._errorComboboxOption_181ao_28[role=option] ._errorComboboxOptionText_181ao_33{display:flex;gap:var(--space-1);align-items:center}
1
+ ._container_1m7se_1{display:flex;gap:var(--space-1);justify-content:center}._disabled_1m7se_7._disabled_1m7se_7{opacity:unset}._highlightOptionText_1m7se_11 [data-user-value]{font-weight:700;font-size:.875rem;font-family:Lato,-apple-system,BlinkMacSystemFont,San Francisco,Segoe UI,Roboto,Helvetica Neue,sans-serif;line-height:1.25rem;letter-spacing:.01875rem;text-transform:none;text-decoration:none}._highlightOptionText_1m7se_11 [data-autocomplete-value]{color:var(--text-text-on-light-secondary)}._highlightOptionText_1m7se_11._selected_1m7se_23,._highlightOptionText_1m7se_11._selected_1m7se_23 span{color:var(--text-text-on-light);font-weight:700;font-size:.875rem;font-family:Lato,-apple-system,BlinkMacSystemFont,San Francisco,Segoe UI,Roboto,Helvetica Neue,sans-serif;line-height:1.25rem;letter-spacing:.01875rem;text-transform:none;text-decoration:none}._option_1m7se_34:nth-last-child(1 of._option_1m7se_34){scroll-margin-block-end:var(--space-12)}._errorComboboxOption_1m7se_38[role=option]{display:flex;align-items:center;justify-content:center}._errorComboboxOption_1m7se_38[role=option] ._errorComboboxOptionText_1m7se_43{display:flex;gap:var(--space-1);align-items:center}
@@ -1,2 +1,3 @@
1
1
  import { type Labelable, type TextProps } from '@box/blueprint-web';
2
2
  export declare const getFieldLabel: (fieldName: string, fieldDescription: string | undefined, isAiSuggestionApplied?: boolean, as?: TextProps['as']) => Labelable['label'];
3
+ export declare const tryParseDateSuggestion: (suggestedDate: string) => string;
@@ -20,6 +20,7 @@ declare const templateOptions: MetadataTemplateOption[];
20
20
  declare const fields: MetadataTemplateField[];
21
21
  declare const floatInstanceField: MetadataTemplateField;
22
22
  declare const allFieldsTemplateInstance: MetadataTemplateInstance;
23
+ declare const differentDatesSuggestionTemplateInstance: MetadataTemplateInstance;
23
24
  declare const templateInstanceWithoutEmptyValues: MetadataTemplateInstance;
24
25
  declare const emptyTemplateInstance: MetadataTemplateInstance;
25
26
  declare const templateInstanceWithAllFieldsEmpty: MetadataTemplateInstance;
@@ -39,4 +40,4 @@ declare const firstTemplateInstanceFieldsWithSuggestions: MetadataTemplateField[
39
40
  declare const secondTemplateInstance: MetadataTemplate;
40
41
  declare const secondTemplateSuggestions: AutofillSuggestions;
41
42
  declare const secondTemplateInstanceFieldsWithSuggestions: MetadataTemplateField[];
42
- export { allFieldsSuggestions, allFieldsTemplate, allFieldsTemplateInstance, allFieldsWithAiSuggestions, customTemplate, customTemplateInstance, customTemplateInstanceWithAllFieldsEmpty, customTemplateInstanceWithoutEditPermissions, customTemplateInstanceWithoutEmptyValues, dateField, emptyCustomTemplateInstance, emptyTemplateInstance, enumField, fields, firstTemplateInstance, firstTemplateInstanceFieldsWithSuggestions, firstTemplateSuggestions, floatField, floatInstanceField, hiddenField, multiSelectField, noFieldsTemplate, nonHiddenFieldsTemplate, nonHiddenFieldsWithValuesTemplate, noValueField, secondTemplateInstance, secondTemplateInstanceFieldsWithSuggestions, secondTemplateSuggestions, stringField, taxonomyMultiSelectSingleLevelField, taxonomyMultiSelectSingleLevelFieldWithValue, taxonomySingleSelectSingleLevelField, taxonomySingleSelectSingleLevelFieldWithValue, templateInstancesList, templateInstanceWithAllFieldsEmpty, templateInstanceWithoutEditPermissions, templateInstanceWithoutEmptyValues, templateInstanceWithSomeFieldsEmpty, templateOptions, templates, };
43
+ export { allFieldsSuggestions, allFieldsTemplate, allFieldsTemplateInstance, allFieldsWithAiSuggestions, customTemplate, customTemplateInstance, customTemplateInstanceWithAllFieldsEmpty, customTemplateInstanceWithoutEditPermissions, customTemplateInstanceWithoutEmptyValues, dateField, differentDatesSuggestionTemplateInstance, emptyCustomTemplateInstance, emptyTemplateInstance, enumField, fields, firstTemplateInstance, firstTemplateInstanceFieldsWithSuggestions, firstTemplateSuggestions, floatField, floatInstanceField, hiddenField, multiSelectField, noFieldsTemplate, nonHiddenFieldsTemplate, nonHiddenFieldsWithValuesTemplate, noValueField, secondTemplateInstance, secondTemplateInstanceFieldsWithSuggestions, secondTemplateSuggestions, stringField, taxonomyMultiSelectSingleLevelField, taxonomyMultiSelectSingleLevelFieldWithValue, taxonomySingleSelectSingleLevelField, taxonomySingleSelectSingleLevelFieldWithValue, templateInstancesList, templateInstanceWithAllFieldsEmpty, templateInstanceWithoutEditPermissions, templateInstanceWithoutEmptyValues, templateInstanceWithSomeFieldsEmpty, templateOptions, templates, };