@box/metadata-editor 0.107.1 → 0.108.0

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.
@@ -1,59 +1,60 @@
1
- import { DateI18nProvider as L, DatePicker as P } from "@box/blueprint-web";
2
- import { useFormikContext as A, getIn as I, Field as T } from "formik";
1
+ import { DateI18nProvider as x, DatePicker as I } from "@box/blueprint-web";
2
+ import { useFormikContext as L, getIn as T, Field as A } from "formik";
3
3
  import { forwardRef as w, useMemo as S } from "react";
4
4
  import { useIntl as V } from "react-intl";
5
5
  import { convertIsoStringToCalendarDate as N, convertCalendarDateToISOString as O } from "../../../../utils/convertDate.js";
6
6
  import a from "../../../../messages.js";
7
7
  import { g as B } from "../../../../../../chunks/utils2.js";
8
- import { jsx as t } from "react/jsx-runtime";
8
+ import { jsx as r } from "react/jsx-runtime";
9
9
  const H = /* @__PURE__ */ w(({
10
- className: i,
10
+ className: s,
11
11
  description: d,
12
12
  isAiSuggestionApplied: c,
13
13
  disableForm: m,
14
14
  fieldNamePrefix: f,
15
- label: l,
15
+ label: n,
16
16
  onValueEdited: u,
17
17
  portalElement: h,
18
18
  updateModePrefix: p
19
- }, g) => {
20
- const r = `${p ?? f}.value`, e = V(), {
21
- values: D,
19
+ }, D) => {
20
+ const t = `${p ?? f}.value`, e = V(), {
21
+ values: g,
22
22
  setFieldTouched: M,
23
- setFieldValue: v
24
- } = A(), s = I(D, r), b = S(() => N(s), [s]), k = {
23
+ setFieldValue: k
24
+ } = L(), i = T(g, t), v = S(() => N(i), [i]), b = {
25
25
  clearDatePickerAriaLabel: e.formatMessage(a.clearSelectedDate),
26
26
  nextMonthAriaLabel: e.formatMessage(a.switchToNextMonth),
27
27
  openCalendarDropdownAriaLabel: e.formatMessage(a.openCalendar),
28
28
  previousMonthAriaLabel: e.formatMessage(a.switchToNextMonth)
29
29
  }, C = (o) => {
30
- const n = O(o);
31
- v(r, n), u();
32
- }, x = () => {
33
- M(r, !0);
30
+ const l = O(o);
31
+ k(t, l), u();
32
+ }, F = () => {
33
+ M(t, !0);
34
34
  };
35
- return /* @__PURE__ */ t("div", {
36
- "data-testid": `${l}-field`,
37
- children: /* @__PURE__ */ t(L, {
35
+ return /* @__PURE__ */ r("div", {
36
+ "data-testid": `${n}-field`,
37
+ children: /* @__PURE__ */ r(x, {
38
38
  locale: e.locale,
39
- children: /* @__PURE__ */ t(T, {
40
- name: r,
39
+ children: /* @__PURE__ */ r(A, {
40
+ name: t,
41
41
  children: ({
42
42
  field: o,
43
- meta: n
44
- }) => /* @__PURE__ */ t(P, {
43
+ meta: l
44
+ }) => /* @__PURE__ */ r(I, {
45
45
  ...o,
46
- ...k,
47
- ref: g,
46
+ ...b,
47
+ ref: D,
48
48
  calendarAriaLabel: e.formatMessage(a.selectDate),
49
- className: i,
50
- error: n.error,
49
+ className: s,
50
+ dataTargetId: "DatePicker-MetadataEditorDateField",
51
+ error: l.error,
51
52
  isDisabled: m,
52
- label: B(l, d, c, "span"),
53
- onBlur: () => x(),
54
- onChange: (F) => C(F),
53
+ label: B(n, d, c, "span"),
54
+ onBlur: () => F(),
55
+ onChange: (P) => C(P),
55
56
  portalElement: h,
56
- value: b
57
+ value: v
57
58
  })
58
59
  })
59
60
  })
@@ -1,55 +1,56 @@
1
- import { Select as l, SELECT_EMPTY_VALUE as r } from "@box/blueprint-web";
1
+ import { Select as l, SELECT_EMPTY_VALUE as o } from "@box/blueprint-web";
2
2
  import { useFormikContext as C, getIn as L, Field as P } from "formik";
3
- import { forwardRef as $ } from "react";
4
- import { useIntl as b, FormattedMessage as j } from "react-intl";
5
- import d from "../../../../messages.js";
6
- import { g as w } from "../../../../../../chunks/utils2.js";
7
- import { jsx as t, jsxs as I } from "react/jsx-runtime";
8
- const U = /* @__PURE__ */ $(({
9
- className: i,
3
+ import { forwardRef as S } from "react";
4
+ import { useIntl as $, FormattedMessage as b } from "react-intl";
5
+ import m from "../../../../messages.js";
6
+ import { g as j } from "../../../../../../chunks/utils2.js";
7
+ import { jsx as t, jsxs as w } from "react/jsx-runtime";
8
+ const U = /* @__PURE__ */ S(({
9
+ className: c,
10
10
  isAiSuggestionApplied: u,
11
11
  description: p,
12
12
  disableForm: f,
13
13
  fieldNamePrefix: s,
14
- updateModePrefix: h,
14
+ updateModePrefix: g,
15
15
  label: n,
16
- onValueEdited: v,
17
- options: g,
16
+ onValueEdited: h,
17
+ options: v,
18
18
  portalElement: E
19
19
  }, F) => {
20
20
  const {
21
- setFieldValue: x,
22
- values: M
23
- } = C(), V = b(), m = `${h ?? s}.value`, o = g || L(M, `${s}.options`, []).map(({
21
+ setFieldValue: M,
22
+ values: x
23
+ } = C(), V = $(), d = `${g ?? s}.value`, r = v || L(x, `${s}.options`, []).map(({
24
24
  key: a
25
- }) => a), c = V.formatMessage(d.selectValuePlaceholder);
25
+ }) => a), i = V.formatMessage(m.selectValuePlaceholder);
26
26
  return /* @__PURE__ */ t("div", {
27
27
  "data-testid": `${n}-field`,
28
28
  children: /* @__PURE__ */ t(P, {
29
- name: m,
29
+ name: d,
30
30
  children: ({
31
31
  field: a
32
32
  }) => /* @__PURE__ */ t(l, {
33
33
  ref: F,
34
- className: i,
34
+ className: c,
35
+ "data-target-id": "Select-MetadataEditorEnumField",
35
36
  disabled: f,
36
- label: w(n, p, u),
37
+ label: j(n, p, u),
37
38
  onValueChange: (e) => {
38
- x(m, e === r ? "" : e), v();
39
+ M(d, e === o ? "" : e), h();
39
40
  },
40
- placeholder: c,
41
+ placeholder: i,
41
42
  ...a,
42
- value: a.value === r ? "" : a.value,
43
- children: /* @__PURE__ */ I(l.Content, {
43
+ value: a.value === o ? "" : a.value,
44
+ children: /* @__PURE__ */ w(l.Content, {
44
45
  container: E,
45
46
  onEscapeKeyDown: (e) => e.stopPropagation(),
46
47
  children: [/* @__PURE__ */ t(l.Option, {
47
- text: c,
48
- value: r,
49
- children: /* @__PURE__ */ t(j, {
50
- ...d.selectValuePlaceholder
48
+ text: i,
49
+ value: o,
50
+ children: /* @__PURE__ */ t(b, {
51
+ ...m.selectValuePlaceholder
51
52
  })
52
- }), o == null ? void 0 : o.map((e) => /* @__PURE__ */ t(l.Option, {
53
+ }), r == null ? void 0 : r.map((e) => /* @__PURE__ */ t(l.Option, {
53
54
  text: e,
54
55
  value: e,
55
56
  children: e
@@ -1,15 +1,15 @@
1
- import { TextInput as T } from "@box/blueprint-web";
2
- import { useFormikContext as V, getIn as $, Field as b } from "formik";
3
- import { forwardRef as B, useRef as I } from "react";
4
- import { g as M } from "../../../../../../chunks/utils2.js";
1
+ import { TextInput as I } from "@box/blueprint-web";
2
+ import { useFormikContext as M, getIn as R, Field as V } from "formik";
3
+ import { forwardRef as $, useRef as b } from "react";
4
+ import { g as B } from "../../../../../../chunks/utils2.js";
5
5
  import { useFloatValidation as O } from "./use-float-validation.js";
6
- import { jsx as r } from "react/jsx-runtime";
7
- const y = /* @__PURE__ */ B(({
8
- className: l,
9
- description: n,
10
- isAiSuggestionApplied: d,
11
- label: o,
12
- fieldNamePrefix: i,
6
+ import { jsx as a } from "react/jsx-runtime";
7
+ const q = /* @__PURE__ */ $(({
8
+ className: d,
9
+ description: l,
10
+ isAiSuggestionApplied: i,
11
+ label: r,
12
+ fieldNamePrefix: n,
13
13
  disableForm: s,
14
14
  onValueEdited: u,
15
15
  updateModePrefix: c
@@ -18,37 +18,38 @@ const y = /* @__PURE__ */ B(({
18
18
  values: f,
19
19
  setFieldValue: p,
20
20
  setFieldTouched: F
21
- } = V(), t = `${c ?? i}.value`, h = $(f, t), a = I(h), {
21
+ } = M(), t = `${c ?? n}.value`, h = R(f, t), o = b(h), {
22
22
  validateFloats: g
23
23
  } = O(), v = (e) => {
24
- a.current = e, p(t, e), u();
24
+ o.current = e, p(t, e), u();
25
25
  }, x = (e) => {
26
26
  F(e, !0);
27
27
  };
28
- return /* @__PURE__ */ r("div", {
29
- "data-testid": `${o}-field`,
30
- children: /* @__PURE__ */ r(b, {
28
+ return /* @__PURE__ */ a("div", {
29
+ "data-testid": `${r}-field`,
30
+ children: /* @__PURE__ */ a(V, {
31
31
  name: `${t}`,
32
- validate: () => g(a.current),
32
+ validate: () => g(o.current),
33
33
  children: ({
34
34
  field: e,
35
- meta: C
36
- }) => /* @__PURE__ */ r(T, {
35
+ meta: T
36
+ }) => /* @__PURE__ */ a(I, {
37
37
  ...e,
38
38
  ref: m,
39
- className: l,
39
+ className: d,
40
+ "data-target-id": "TextInput-MetadataEditorFloatField",
40
41
  disabled: s,
41
- error: C.error,
42
+ error: T.error,
42
43
  inputMode: "decimal",
43
- label: M(o, n, d),
44
+ label: B(r, l, i),
44
45
  onBlur: () => x(t),
45
- onChange: (R) => v(R.currentTarget.value),
46
+ onChange: (C) => v(C.currentTarget.value),
46
47
  placeholder: "0"
47
48
  })
48
49
  })
49
50
  });
50
51
  });
51
52
  export {
52
- y as MetadataFloatField,
53
- y as default
53
+ q as MetadataFloatField,
54
+ q as default
54
55
  };
@@ -1,18 +1,18 @@
1
- import { Combobox as w } from "@box/blueprint-web";
2
- import { useFormikContext as x, getIn as M, Field as $ } from "formik";
1
+ import { Combobox as x } from "@box/blueprint-web";
2
+ import { useFormikContext as V, getIn as w, Field as $ } from "formik";
3
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 O } from "../../../../../../chunks/utils2.js";
4
+ import { useIntl as S } from "react-intl";
5
+ import j from "../../../../messages.js";
6
+ import { g as k } from "../../../../../../chunks/utils2.js";
7
7
  import { jsx as t } from "react/jsx-runtime";
8
- const D = /* @__PURE__ */ I(({
9
- className: s,
10
- isAiSuggestionApplied: i,
8
+ const B = /* @__PURE__ */ I(({
9
+ className: n,
10
+ isAiSuggestionApplied: s,
11
11
  description: m,
12
- disableForm: u,
12
+ disableForm: d,
13
13
  fieldNamePrefix: o,
14
- label: l,
15
- onValueEdited: d,
14
+ label: a,
15
+ onValueEdited: u,
16
16
  options: c,
17
17
  portalElement: f,
18
18
  updateModePrefix: p
@@ -20,32 +20,33 @@ const D = /* @__PURE__ */ I(({
20
20
  const {
21
21
  setFieldValue: h,
22
22
  values: F
23
- } = x(), v = j(), a = `${p ?? o}.value`, C = c || M(F, `${o}.options`, []).map(({
23
+ } = V(), b = S(), l = `${p ?? o}.value`, v = c || w(F, `${o}.options`, []).map(({
24
24
  key: e
25
- }) => e), L = (e, r) => r.toLowerCase().includes(e.toLowerCase());
25
+ }) => e), C = (e, r) => r.toLowerCase().includes(e.toLowerCase());
26
26
  return /* @__PURE__ */ t("div", {
27
- "data-testid": `${l}-field`,
27
+ "data-testid": `${a}-field`,
28
28
  children: /* @__PURE__ */ t($, {
29
- name: a,
29
+ name: l,
30
30
  children: ({
31
31
  field: e
32
32
  }) => {
33
- var n;
34
- const b = (((n = e.value) == null ? void 0 : n.length) || 0) === 0 ? v.formatMessage(k.multiselectPlaceholder) : "";
35
- return /* @__PURE__ */ t(w, {
33
+ var i;
34
+ const L = (((i = e.value) == null ? void 0 : i.length) || 0) === 0 ? b.formatMessage(j.multiselectPlaceholder) : "";
35
+ return /* @__PURE__ */ t(x, {
36
36
  ref: g,
37
37
  as: "input",
38
- className: s,
39
- disabled: u,
40
- filterFn: L,
41
- label: O(l, m, i),
38
+ className: n,
39
+ "data-target-id": "Combobox-MetadataEditorMultiSelectField",
40
+ disabled: d,
41
+ filterFn: C,
42
+ label: k(a, m, s),
42
43
  multiselect: !0,
43
44
  name: e.name,
44
- onValueChange: (V) => {
45
- h(a, V), d();
45
+ onValueChange: (M) => {
46
+ h(l, M), u();
46
47
  },
47
- options: C,
48
- placeholder: b,
48
+ options: v,
49
+ placeholder: L,
49
50
  portalElement: f,
50
51
  value: e.value
51
52
  });
@@ -54,6 +55,6 @@ const D = /* @__PURE__ */ I(({
54
55
  });
55
56
  });
56
57
  export {
57
- D as MetadataMultiSelectField,
58
- D as default
58
+ B as MetadataMultiSelectField,
59
+ B as default
59
60
  };
@@ -1,43 +1,44 @@
1
- import { TextInput as g } from "@box/blueprint-web";
2
- import { Field as u } from "formik";
1
+ import { TextInput as u } from "@box/blueprint-web";
2
+ import { Field as c } from "formik";
3
3
  import { forwardRef as h } from "react";
4
4
  import { useIntl as F } from "react-intl";
5
5
  import x from "../../../../messages.js";
6
6
  import { g as M } from "../../../../../../chunks/utils2.js";
7
7
  import { jsx as e } from "react/jsx-runtime";
8
- const b = /* @__PURE__ */ h(({
9
- className: t,
8
+ const I = /* @__PURE__ */ h(({
9
+ className: r,
10
10
  description: a,
11
- isAiSuggestionApplied: o,
12
- disableForm: i,
11
+ isAiSuggestionApplied: i,
12
+ disableForm: o,
13
13
  fieldNamePrefix: d,
14
- label: r,
14
+ label: t,
15
15
  onValueEdited: l,
16
16
  updateModePrefix: m
17
- }, s) => {
18
- const f = F(), n = `${m ?? d}.value`;
17
+ }, n) => {
18
+ const s = F(), f = `${m ?? d}.value`;
19
19
  return /* @__PURE__ */ e("div", {
20
- "data-testid": `${r}-field`,
21
- children: /* @__PURE__ */ e(u, {
22
- name: n,
20
+ "data-testid": `${t}-field`,
21
+ children: /* @__PURE__ */ e(c, {
22
+ name: f,
23
23
  children: ({
24
24
  field: p,
25
- meta: c
26
- }) => /* @__PURE__ */ e(g, {
25
+ meta: g
26
+ }) => /* @__PURE__ */ e(u, {
27
27
  ...p,
28
- ref: s,
29
- className: t,
30
- disabled: i,
31
- error: c.error,
32
- label: M(r, a, o),
28
+ ref: n,
29
+ className: r,
30
+ "data-target-id": "TextInput-MetadataEditorStringField",
31
+ disabled: o,
32
+ error: g.error,
33
+ label: M(t, a, i),
33
34
  onChangeCapture: l,
34
- placeholder: f.formatMessage(x.setValuePlaceholder)
35
+ placeholder: s.formatMessage(x.setValuePlaceholder)
35
36
  })
36
37
  })
37
38
  });
38
39
  });
39
- b.displayName = "MetadataStringField";
40
+ I.displayName = "MetadataStringField";
40
41
  export {
41
- b as MetadataStringField,
42
- b as default
42
+ I as MetadataStringField,
43
+ I as default
43
44
  };
@@ -1,75 +1,76 @@
1
- import { ComboboxWithApiTreeView as K } from "@box/combobox-with-api";
2
- import { useFormikContext as W, getIn as $, Field as j } from "formik";
3
- import { forwardRef as D, useCallback as R } from "react";
4
- import { useIntl as q } from "react-intl";
5
- import z from "../../../../messages.js";
6
- import { g as b } from "../../../../../../chunks/utils2.js";
7
- import { jsx as e } from "react/jsx-runtime";
8
- import { ComboboxWithApiPagination as A } from "../../../combobox-with-api-pagination/combobox-with-api-pagination.js";
9
- const X = /* @__PURE__ */ D(({
10
- description: i,
1
+ import { ComboboxWithApiTreeView as w, ComboboxWithApiPagination as A } from "@box/combobox-with-api";
2
+ import { useFormikContext as K, getIn as $, Field as j } from "formik";
3
+ import { forwardRef as D, useCallback as E } from "react";
4
+ import { useIntl as R } from "react-intl";
5
+ import V from "../../../../messages.js";
6
+ import { g as y } from "../../../../../../chunks/utils2.js";
7
+ import { jsx as a } from "react/jsx-runtime";
8
+ const S = /* @__PURE__ */ D(({
9
+ description: m,
11
10
  disableForm: l,
12
- isAiSuggestionApplied: u,
13
- fieldNamePrefix: p,
14
- label: r,
15
- portalElement: s,
16
- taxonomyOptionsFetcher: c,
17
- updateModePrefix: k,
18
- className: d,
11
+ isAiSuggestionApplied: d,
12
+ fieldNamePrefix: u,
13
+ label: e,
14
+ portalElement: p,
15
+ taxonomyOptionsFetcher: s,
16
+ updateModePrefix: F,
17
+ className: h,
19
18
  isMultilevelTaxonomyFieldEnabled: M
20
- }, h) => {
21
- const P = q(), a = `${k ?? p}.value`, {
22
- setFieldValue: f,
23
- values: g
24
- } = W(), {
19
+ }, c) => {
20
+ const k = R(), r = `${F ?? u}.value`, {
21
+ setFieldValue: g,
22
+ values: x
23
+ } = K(), {
25
24
  metadata: {
26
- templateKey: v,
27
- scope: x
25
+ templateKey: f,
26
+ scope: v
28
27
  }
29
- } = g, T = $(g, p), {
30
- key: C,
28
+ } = x, I = $(x, u), {
29
+ key: b,
31
30
  optionsRules: {
32
- multiSelect: n,
31
+ multiSelect: i,
33
32
  selectableLevels: t
34
33
  },
35
- levels: w
36
- } = T, I = M && (t == null ? void 0 : t.some((o) => o > 1)), y = R((o) => c(x, v, C, t == null ? void 0 : t[0], o), [C, x, t, c, v]), F = (o) => n || !(o != null && o.length) ? P.formatMessage(z.taxonomyPlaceholder) : void 0;
37
- return /* @__PURE__ */ e("div", {
38
- "data-testid": `${r}-field`,
34
+ levels: P
35
+ } = I, W = M && (t == null ? void 0 : t.some((o) => o > 1)), C = E((o) => s(v, f, b, t == null ? void 0 : t[0], o), [b, v, t, s, f]), T = (o) => i || !(o != null && o.length) ? k.formatMessage(V.taxonomyPlaceholder) : void 0;
36
+ return /* @__PURE__ */ a("div", {
37
+ "data-testid": `${e}-field`,
39
38
  onKeyDown: (o) => o.stopPropagation(),
40
39
  role: "presentation",
41
- children: /* @__PURE__ */ e(j, {
42
- name: a,
40
+ children: /* @__PURE__ */ a(j, {
41
+ name: r,
43
42
  children: ({
44
43
  field: o
45
- }) => I ? /* @__PURE__ */ e(K, {
46
- ref: h,
47
- className: d,
48
- defaultFetcher: y,
44
+ }) => W ? /* @__PURE__ */ a(w, {
45
+ ref: c,
46
+ className: h,
47
+ dataTargetId: "ComboboxWithApiTreeView-MetadataEditorTaxonomyField",
48
+ defaultFetcher: C,
49
49
  disabled: l,
50
- label: b(r, i, u),
51
- levels: w,
52
- multiselect: n,
53
- onValueChange: (m) => f(a, m),
54
- placeholder: F(o.value),
55
- portalElement: s,
50
+ label: y(e, m, d),
51
+ levels: P,
52
+ multiselect: i,
53
+ onValueChange: (n) => g(r, n),
54
+ placeholder: T(o.value),
55
+ portalElement: p,
56
56
  selectableLevels: t,
57
57
  value: o.value
58
- }) : /* @__PURE__ */ e(A, {
59
- ref: h,
60
- className: d,
61
- defaultFetcher: y,
58
+ }) : /* @__PURE__ */ a(A, {
59
+ ref: c,
60
+ className: h,
61
+ dataTargetId: "ComboboxWithApiPagination-MetadataEditorTaxonomyField",
62
+ defaultFetcher: C,
62
63
  disabled: l,
63
- label: b(r, i, u),
64
- multiselect: n,
65
- onValueChange: (m) => f(a, m),
66
- placeholder: F(o.value),
67
- portalElement: s,
64
+ label: y(e, m, d),
65
+ multiselect: i,
66
+ onValueChange: (n) => g(r, n),
67
+ placeholder: T(o.value),
68
+ portalElement: p,
68
69
  value: o.value
69
70
  })
70
71
  })
71
72
  });
72
73
  });
73
74
  export {
74
- X as MetadataTaxonomyField
75
+ S as MetadataTaxonomyField
75
76
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-editor",
3
- "version": "0.107.1",
3
+ "version": "0.108.0",
4
4
  "peerDependencies": {
5
5
  "@ariakit/react": "0.4.15",
6
6
  "@box/blueprint-web": "^7.30.3",
@@ -15,7 +15,7 @@
15
15
  "devDependencies": {
16
16
  "@ariakit/react": "0.4.15",
17
17
  "@box/babel-plugin-target-attributes": "1.3.0",
18
- "@box/blueprint-web": "^12.0.0",
18
+ "@box/blueprint-web": "^12.1.0",
19
19
  "@box/blueprint-web-assets": "^4.44.0",
20
20
  "@box/storybook-utils": "^0.12.3",
21
21
  "@testing-library/react": "^15.0.6",