@box/metadata-editor 0.93.0 → 0.93.2

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.
@@ -2,26 +2,25 @@ import { TextInput as T } from "@box/blueprint-web";
2
2
  import { useFormikContext as V, getIn as $, Field as b } from "formik";
3
3
  import { forwardRef as B, useRef as I } from "react";
4
4
  import { g as M } from "../../../../../../chunks/utils2.js";
5
- import { fieldDefaultProps as O } from "../constants.js";
6
- import { useFloatValidation as j } from "./use-float-validation.js";
5
+ import { useFloatValidation as O } from "./use-float-validation.js";
7
6
  import { jsx as r } from "react/jsx-runtime";
8
7
  const y = /* @__PURE__ */ B(({
9
8
  className: l,
10
- description: i,
9
+ description: n,
11
10
  isAiSuggestionApplied: d,
12
11
  label: o,
13
- fieldNamePrefix: n,
12
+ fieldNamePrefix: i,
14
13
  disableForm: s,
15
14
  onValueEdited: u,
16
- updateModePrefix: f
15
+ updateModePrefix: c
17
16
  }, m) => {
18
17
  const {
19
- values: c,
18
+ values: f,
20
19
  setFieldValue: p,
21
20
  setFieldTouched: F
22
- } = V(), t = `${f ?? n}.value`, h = $(c, t), a = I(h), {
21
+ } = V(), t = `${c ?? i}.value`, h = $(f, t), a = I(h), {
23
22
  validateFloats: g
24
- } = j(), v = (e) => {
23
+ } = O(), v = (e) => {
25
24
  a.current = e, p(t, e), u();
26
25
  }, x = (e) => {
27
26
  F(e, !0);
@@ -35,14 +34,13 @@ const y = /* @__PURE__ */ B(({
35
34
  field: e,
36
35
  meta: C
37
36
  }) => /* @__PURE__ */ r(T, {
38
- ...O,
39
37
  ...e,
40
38
  ref: m,
41
39
  className: l,
42
40
  disabled: s,
43
41
  error: C.error,
44
42
  inputMode: "decimal",
45
- label: M(o, i, d),
43
+ label: M(o, n, d),
46
44
  onBlur: () => x(t),
47
45
  onChange: (R) => v(R.currentTarget.value),
48
46
  placeholder: "0"
@@ -3,52 +3,50 @@ import { useFormikContext as x, getIn as M, Field as $ } from "formik";
3
3
  import { forwardRef as I } from "react";
4
4
  import { useIntl as j } from "react-intl";
5
5
  import k from "../../../../messages.js";
6
- import { g as D } from "../../../../../../chunks/utils2.js";
7
- import { fieldDefaultProps as O } from "../constants.js";
6
+ import { g as O } from "../../../../../../chunks/utils2.js";
8
7
  import { jsx as t } from "react/jsx-runtime";
9
- const E = /* @__PURE__ */ I(({
10
- className: i,
11
- isAiSuggestionApplied: n,
8
+ const D = /* @__PURE__ */ I(({
9
+ className: s,
10
+ isAiSuggestionApplied: i,
12
11
  description: m,
13
12
  disableForm: u,
14
13
  fieldNamePrefix: o,
15
14
  label: l,
16
15
  onValueEdited: d,
17
- options: f,
18
- portalElement: c,
16
+ options: c,
17
+ portalElement: f,
19
18
  updateModePrefix: p
20
19
  }, g) => {
21
20
  const {
22
21
  setFieldValue: h,
23
22
  values: F
24
- } = x(), v = j(), r = `${p ?? o}.value`, C = f || M(F, `${o}.options`, []).map(({
23
+ } = x(), v = j(), a = `${p ?? o}.value`, C = c || M(F, `${o}.options`, []).map(({
25
24
  key: e
26
- }) => e), L = (e, a) => a.toLowerCase().includes(e.toLowerCase());
25
+ }) => e), L = (e, r) => r.toLowerCase().includes(e.toLowerCase());
27
26
  return /* @__PURE__ */ t("div", {
28
27
  "data-testid": `${l}-field`,
29
28
  children: /* @__PURE__ */ t($, {
30
- name: r,
29
+ name: a,
31
30
  children: ({
32
31
  field: e
33
32
  }) => {
34
- var s;
35
- const b = (((s = e.value) == null ? void 0 : s.length) || 0) === 0 ? v.formatMessage(k.multiselectPlaceholder) : "";
33
+ var n;
34
+ const b = (((n = e.value) == null ? void 0 : n.length) || 0) === 0 ? v.formatMessage(k.multiselectPlaceholder) : "";
36
35
  return /* @__PURE__ */ t(w, {
37
- ...O,
38
36
  ref: g,
39
37
  as: "input",
40
- className: i,
38
+ className: s,
41
39
  disabled: u,
42
40
  filterFn: L,
43
- label: D(l, m, n),
41
+ label: O(l, m, i),
44
42
  multiselect: !0,
45
43
  name: e.name,
46
44
  onValueChange: (V) => {
47
- h(r, V), d();
45
+ h(a, V), d();
48
46
  },
49
47
  options: C,
50
48
  placeholder: b,
51
- portalElement: c,
49
+ portalElement: f,
52
50
  value: e.value
53
51
  });
54
52
  }
@@ -56,6 +54,6 @@ const E = /* @__PURE__ */ I(({
56
54
  });
57
55
  });
58
56
  export {
59
- E as MetadataMultiSelectField,
60
- E as default
57
+ D as MetadataMultiSelectField,
58
+ D as default
61
59
  };
@@ -1,46 +1,43 @@
1
- import { TextInput as u } from "@box/blueprint-web";
2
- import { Field as c } from "formik";
1
+ import { TextInput as g } from "@box/blueprint-web";
2
+ import { Field as u } from "formik";
3
3
  import { forwardRef as h } from "react";
4
- import { useIntl as x } from "react-intl";
5
- import F from "../../../../messages.js";
4
+ import { useIntl as F } from "react-intl";
5
+ import x from "../../../../messages.js";
6
6
  import { g as M } from "../../../../../../chunks/utils2.js";
7
- import { fieldDefaultProps as b } from "../constants.js";
8
7
  import { jsx as e } from "react/jsx-runtime";
9
- const v = /* @__PURE__ */ h(({
8
+ const b = /* @__PURE__ */ h(({
10
9
  className: t,
11
10
  description: a,
12
11
  isAiSuggestionApplied: o,
13
12
  disableForm: i,
14
- fieldNamePrefix: l,
13
+ fieldNamePrefix: d,
15
14
  label: r,
16
- onValueEdited: m,
17
- updateModePrefix: d
18
- }, f) => {
19
- const s = x(), n = `${d ?? l}.value`;
15
+ onValueEdited: l,
16
+ updateModePrefix: m
17
+ }, s) => {
18
+ const f = F(), n = `${m ?? d}.value`;
20
19
  return /* @__PURE__ */ e("div", {
21
20
  "data-testid": `${r}-field`,
22
- children: /* @__PURE__ */ e(c, {
21
+ children: /* @__PURE__ */ e(u, {
23
22
  name: n,
24
23
  children: ({
25
24
  field: p,
26
- meta: g
27
- }) => /* @__PURE__ */ e(u, {
28
- ...b,
25
+ meta: c
26
+ }) => /* @__PURE__ */ e(g, {
29
27
  ...p,
30
- ref: f,
28
+ ref: s,
31
29
  className: t,
32
30
  disabled: i,
33
- error: g.error,
31
+ error: c.error,
34
32
  label: M(r, a, o),
35
- maxLength: 524288,
36
- onChangeCapture: m,
37
- placeholder: s.formatMessage(F.setValuePlaceholder)
33
+ onChangeCapture: l,
34
+ placeholder: f.formatMessage(x.setValuePlaceholder)
38
35
  })
39
36
  })
40
37
  });
41
38
  });
42
- v.displayName = "MetadataStringField";
39
+ b.displayName = "MetadataStringField";
43
40
  export {
44
- v as MetadataStringField,
45
- v as default
41
+ b as MetadataStringField,
42
+ b as default
46
43
  };
@@ -1,38 +1,37 @@
1
1
  import { useFormikContext as A, FieldArray as N, Field as k } from "formik";
2
- import { useState as I, useRef as v, useEffect as y } from "react";
2
+ import { useState as f, useRef as v, useEffect as y } from "react";
3
3
  import { useIntl as C } from "react-intl";
4
4
  import { TextInput as q, IconButton as B, TextButton as T } from "@box/blueprint-web";
5
5
  import { Trash as w } from "@box/blueprint-web-assets/icons/Line";
6
6
  import { CustomInstanceNewField as M } from "../custom-instance-new-field/custom-instance-new-field.js";
7
- import { fieldDefaultProps as R } from "../../../metadata-editor-fields/components/constants.js";
8
- import d from "./messages.js";
9
- import { jsx as t, jsxs as p } from "react/jsx-runtime";
10
- import '../../../../../../styles/custom-instance.css';const V = "_customInstance_xq8r7_1", j = "_customInstanceField_xq8r7_7", P = "_customInstanceFieldInput_xq8r7_12", z = "_customInstanceFieldIcon_xq8r7_16", c = {
11
- customInstance: V,
12
- customInstanceField: j,
13
- customInstanceFieldInput: P,
7
+ import r from "./messages.js";
8
+ import { jsx as t, jsxs as F } from "react/jsx-runtime";
9
+ import '../../../../../../styles/custom-instance.css';const R = "_customInstance_xq8r7_1", V = "_customInstanceField_xq8r7_7", j = "_customInstanceFieldInput_xq8r7_12", z = "_customInstanceFieldIcon_xq8r7_16", c = {
10
+ customInstance: R,
11
+ customInstanceField: V,
12
+ customInstanceFieldInput: j,
14
13
  customInstanceFieldIcon: z
15
- }, O = (F) => {
14
+ }, H = (p) => {
16
15
  const {
17
16
  isLoading: l
18
- } = F, {
17
+ } = p, {
19
18
  values: e
20
- } = A(), i = C(), [m, o] = I(!e.metadata.fields.length), [u, r] = I(0), h = () => {
21
- r(e.metadata.fields.length);
22
- }, b = (a) => {
23
- r(a === 0 ? 0 : a - 1);
24
- }, f = v(null);
19
+ } = A(), i = C(), [m, a] = f(!e.metadata.fields.length), [u, d] = f(0), h = () => {
20
+ d(e.metadata.fields.length);
21
+ }, b = (o) => {
22
+ d(o === 0 ? 0 : o - 1);
23
+ }, I = v(null);
25
24
  return y(() => {
26
- e.metadata.fields.length > 0 ? f.current.focus() : o(!0);
25
+ e.metadata.fields.length > 0 ? I.current.focus() : a(!0);
27
26
  }, [u, e.metadata.fields.length]), /* @__PURE__ */ t("div", {
28
27
  children: /* @__PURE__ */ t(N, {
29
28
  name: "metadata.fields",
30
29
  children: ({
31
- remove: a,
30
+ remove: o,
32
31
  push: _
33
- }) => /* @__PURE__ */ p("div", {
32
+ }) => /* @__PURE__ */ F("div", {
34
33
  className: c.customInstance,
35
- children: [e == null ? void 0 : e.metadata.fields.map((s, n) => /* @__PURE__ */ p("div", {
34
+ children: [e == null ? void 0 : e.metadata.fields.map((s, n) => /* @__PURE__ */ F("div", {
36
35
  className: c.customInstanceField,
37
36
  children: [/* @__PURE__ */ t("div", {
38
37
  className: c.customInstanceFieldInput,
@@ -42,24 +41,23 @@ import '../../../../../../styles/custom-instance.css';const V = "_customInstance
42
41
  field: g,
43
42
  meta: x
44
43
  }) => /* @__PURE__ */ t(q, {
45
- ...R,
46
44
  ...g,
47
- ref: n === u ? f : null,
45
+ ref: n === u ? I : null,
48
46
  disabled: l,
49
47
  error: x.error,
50
48
  label: s.key,
51
- placeholder: i.formatMessage(d.setValuePlaceholder)
49
+ placeholder: i.formatMessage(r.setValuePlaceholder)
52
50
  })
53
51
  })
54
52
  }), /* @__PURE__ */ t(B, {
55
- "aria-label": i.formatMessage(d.removeAttribute, {
53
+ "aria-label": i.formatMessage(r.removeAttribute, {
56
54
  fieldName: s.key
57
55
  }),
58
56
  className: c.customInstanceFieldIcon,
59
57
  disabled: l,
60
58
  icon: w,
61
59
  onClick: () => {
62
- a(n), b(n);
60
+ o(n), b(n);
63
61
  },
64
62
  size: "x-small",
65
63
  "data-target-id": "IconButton-removeAttribute"
@@ -70,19 +68,19 @@ import '../../../../../../styles/custom-instance.css';const V = "_customInstance
70
68
  _({
71
69
  key: s,
72
70
  value: n
73
- }), h(), o(!1);
71
+ }), h(), a(!1);
74
72
  },
75
- onCancel: () => o(!1)
73
+ onCancel: () => a(!1)
76
74
  }), !m && /* @__PURE__ */ t(T, {
77
75
  disabled: l,
78
- onClick: () => o(!0),
76
+ onClick: () => a(!0),
79
77
  "data-target-id": "TextButton-addAttribute",
80
- children: i.formatMessage(d.addAttribute)
78
+ children: i.formatMessage(r.addAttribute)
81
79
  })]
82
80
  })
83
81
  })
84
82
  });
85
83
  };
86
84
  export {
87
- O as CustomInstance
85
+ H as CustomInstance
88
86
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-editor",
3
- "version": "0.93.0",
3
+ "version": "0.93.2",
4
4
  "peerDependencies": {
5
5
  "@ariakit/react": "0.4.15",
6
6
  "@box/blueprint-web": "^7.30.3",
@@ -14,7 +14,7 @@
14
14
  "devDependencies": {
15
15
  "@ariakit/react": "0.4.15",
16
16
  "@box/babel-plugin-target-attributes": "1.3.0",
17
- "@box/blueprint-web": "^9.18.5",
17
+ "@box/blueprint-web": "^9.18.6",
18
18
  "@box/blueprint-web-assets": "^4.34.0",
19
19
  "@box/storybook-utils": "^0.8.3",
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": "4186e6a642af66984f1fb57cad2b9188d4b8f89a"
56
+ "gitHead": "d7b0622598d060b689dc20c6767f6f43ea081211"
57
57
  }