@box/metadata-editor 0.60.2 → 0.60.4

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,45 +1,46 @@
1
1
  import "../../../../../../styles/delete-confirmation-modal.css";
2
2
  import { Modal as a, Text as c, TextInput as b } from "@box/blueprint-web";
3
- import { useIntl as F, FormattedMessage as d } from "react-intl";
4
- import { useState as f, useEffect as I } from "react";
3
+ import { useState as f, useEffect as F } from "react";
4
+ import { useIntl as I, FormattedMessage as s } from "react-intl";
5
5
  import o from "./messages.js";
6
- import { jsx as e, jsxs as s } from "react/jsx-runtime";
7
- const x = "_modalBody_yiat3_1", P = {
8
- modalBody: x
6
+ import { jsx as e, jsxs as d } from "react/jsx-runtime";
7
+ const P = "_modalBody_yiat3_1", x = {
8
+ modalBody: P
9
9
  }, T = ({
10
10
  onConfirm: u,
11
- templateName: C,
12
- onDismiss: p,
11
+ templateName: p,
12
+ onDismiss: C,
13
13
  open: h
14
14
  }) => {
15
- const t = F(), [r, m] = f(""), [M, g] = f(!0), i = (n) => {
16
- n || (p(), m(""));
17
- }, l = C || t.formatMessage(o.deleteConfirmationModalCustomMetadata), B = (n) => {
18
- m(n);
19
- }, y = () => {
15
+ const n = I(), [r, m] = f(""), [M, g] = f(!0), i = (t) => {
16
+ t || (C(), m(""));
17
+ }, l = p || n.formatMessage(o.deleteConfirmationModalCustomMetadata), y = (t) => {
18
+ m(t);
19
+ }, B = () => {
20
20
  u(), i(!1);
21
21
  };
22
- return I(() => {
22
+ return F(() => {
23
23
  g(r !== l);
24
24
  }, [r, l]), /* @__PURE__ */ e(a, {
25
25
  onOpenChange: i,
26
26
  open: h,
27
- children: /* @__PURE__ */ s(a.Content, {
27
+ children: /* @__PURE__ */ d(a.Content, {
28
+ onEscapeKeyDown: (t) => t.stopPropagation(),
28
29
  size: "small",
29
30
  children: [/* @__PURE__ */ e(a.Header, {
30
- "aria-label": t.formatMessage(o.deleteConfirmationModalHeaderAriaLabel),
31
- children: /* @__PURE__ */ e(d, {
31
+ "aria-label": n.formatMessage(o.deleteConfirmationModalHeaderAriaLabel),
32
+ children: /* @__PURE__ */ e(s, {
32
33
  ...o.deleteConfirmationModalHeader,
33
34
  values: {
34
35
  templateName: l
35
36
  }
36
37
  })
37
38
  }), /* @__PURE__ */ e(a.ScrollableContainer, {
38
- children: /* @__PURE__ */ s(a.Body, {
39
- className: P.modalBody,
39
+ children: /* @__PURE__ */ d(a.Body, {
40
+ className: x.modalBody,
40
41
  children: [/* @__PURE__ */ e(c, {
41
42
  as: "p",
42
- children: /* @__PURE__ */ e(d, {
43
+ children: /* @__PURE__ */ e(s, {
43
44
  ...o.deleteConfirmationModalBodyFirstParagraph,
44
45
  values: {
45
46
  templateName: l
@@ -47,30 +48,30 @@ const x = "_modalBody_yiat3_1", P = {
47
48
  })
48
49
  }), /* @__PURE__ */ e(c, {
49
50
  as: "p",
50
- children: /* @__PURE__ */ e(d, {
51
+ children: /* @__PURE__ */ e(s, {
51
52
  ...o.deleteConfirmationModalBodySecondParagraph
52
53
  })
53
54
  }), /* @__PURE__ */ e(b, {
54
- label: t.formatMessage(o.deleteConfirmationModalBodyInputFieldLabel),
55
- onChange: (n) => B(n.target.value),
55
+ label: n.formatMessage(o.deleteConfirmationModalBodyInputFieldLabel),
56
+ onChange: (t) => y(t.target.value),
56
57
  placeholder: l,
57
58
  required: !0,
58
59
  value: r
59
60
  })]
60
61
  })
61
- }), /* @__PURE__ */ s(a.Footer, {
62
+ }), /* @__PURE__ */ d(a.Footer, {
62
63
  children: [/* @__PURE__ */ e(a.Footer.SecondaryButton, {
63
64
  onClick: () => i(!1),
64
65
  size: "large",
65
- children: t.formatMessage(o.deleteConfirmationModalCancelButton)
66
+ children: n.formatMessage(o.deleteConfirmationModalCancelButton)
66
67
  }), /* @__PURE__ */ e(a.Footer.PrimaryButton, {
67
68
  disabled: M,
68
- onClick: y,
69
+ onClick: B,
69
70
  size: "large",
70
- children: t.formatMessage(o.deleteConfirmationModalConfirmButton)
71
+ children: n.formatMessage(o.deleteConfirmationModalConfirmButton)
71
72
  })]
72
73
  }), /* @__PURE__ */ e(a.Close, {
73
- "aria-label": t.formatMessage(o.deleteConfirmationModalDismissButton)
74
+ "aria-label": n.formatMessage(o.deleteConfirmationModalDismissButton)
74
75
  })]
75
76
  })
76
77
  });
@@ -1,4 +1,4 @@
1
- import v from "lodash/isEmpty";
1
+ import h from "lodash/isEmpty";
2
2
  import O from "lodash/isArray";
3
3
  import { TEMPLATE_CUSTOM_PROPERTIES as f } from "../../../../constants.js";
4
4
  const n = {
@@ -6,19 +6,19 @@ const n = {
6
6
  REMOVE: "remove",
7
7
  REPLACE: "replace",
8
8
  TEST: "test"
9
- }, o = (e) => e.value === null || e.value === "" || O(e.value) && v(e.value), S = (e, s) => {
10
- const p = [], c = e.metadata.fields, r = s.templateKey === f, m = new Map(s.fields.map((t) => [t.key, t])), h = new Map(c.map((t) => [t.key, t]));
9
+ }, p = (e) => e.value === void 0 || e.value === null || e.value === "" || O(e.value) && h(e.value), S = (e, s) => {
10
+ const o = [], c = e.metadata.fields, r = s.templateKey === f, v = new Map(s.fields.map((t) => [t.key, t])), m = new Map(c.map((t) => [t.key, t]));
11
11
  return c.forEach((t) => {
12
- const a = m.get(t.key);
13
- a ? JSON.stringify(t) === JSON.stringify(a) || (!r && o(a) && !o(t) ? p.push(y(t.key, u(t))) : (
12
+ const a = v.get(t.key);
13
+ a ? JSON.stringify(t) === JSON.stringify(a) || (!r && p(a) && !p(t) ? o.push(y(t.key, u(t))) : (
14
14
  // template instance
15
- (!r && t.value !== a.value && a.value !== null && !o(t) || // custom instance
16
- r && t.value !== a.value) && (p.push(E(a.key, u(a))), p.push(M(t.key, u(t))))
17
- )) : p.push(y(t.key, t.value));
15
+ (!r && t.value !== a.value && a.value !== null && !p(t) || // custom instance
16
+ r && t.value !== a.value) && (o.push(E(a.key, u(a))), o.push(M(t.key, u(t))))
17
+ )) : o.push(y(t.key, t.value));
18
18
  }), s.fields.forEach((t) => {
19
- const a = h.get(t.key);
20
- (!a || !r && o(a) && !o(t)) && (p.push(E(t.key, u(t))), p.push(k(t.key)));
21
- }), p;
19
+ const a = m.get(t.key);
20
+ (!a || !r && p(a) && !p(t)) && (o.push(E(t.key, u(t))), o.push(k(t.key)));
21
+ }), o;
22
22
  }, u = (e) => e.type === "float" ? Number(e.value) : e.value, E = (e, s) => ({
23
23
  op: n.TEST,
24
24
  path: `/${e}`,
@@ -1,28 +1,29 @@
1
1
  import { Modal as e } from "@box/blueprint-web";
2
- import { useState as M, useEffect as v, useCallback as t } from "react";
3
- import { useIntl as b, FormattedMessage as h } from "react-intl";
2
+ import { useState as M, useEffect as p, useCallback as d } from "react";
3
+ import { useIntl as v, FormattedMessage as h } from "react-intl";
4
4
  import n from "./messages.js";
5
5
  import { jsx as a, jsxs as C } from "react/jsx-runtime";
6
6
  function x({
7
- onBackToEdit: d,
8
- onDiscardChanges: i,
9
- defaultOpen: m = !0,
10
- open: s = m
7
+ onBackToEdit: i,
8
+ onDiscardChanges: c,
9
+ defaultOpen: g = !0,
10
+ open: r = g
11
11
  }) {
12
- const l = b(), [g, o] = M(s);
13
- v(() => o(s), [s]);
14
- const r = t(() => {
15
- d(), o(!1);
16
- }, [d]), u = t(() => {
12
+ const t = v(), [m, o] = M(r);
13
+ p(() => o(r), [r]);
14
+ const l = d(() => {
17
15
  i(), o(!1);
18
- }, [i]), f = t((c) => {
19
- o(c), c || r();
20
- }, [r]);
16
+ }, [i]), u = d(() => {
17
+ c(), o(!1);
18
+ }, [c]), f = d((s) => {
19
+ o(s), s || l();
20
+ }, [l]);
21
21
  return /* @__PURE__ */ a(e, {
22
22
  modal: !0,
23
23
  onOpenChange: f,
24
- open: g,
24
+ open: m,
25
25
  children: /* @__PURE__ */ C(e.Content, {
26
+ onEscapeKeyDown: (s) => s.stopPropagation(),
26
27
  size: "small",
27
28
  children: [/* @__PURE__ */ a(e.Header, {
28
29
  children: /* @__PURE__ */ a(h, {
@@ -38,14 +39,14 @@ function x({
38
39
  children: [/* @__PURE__ */ a(e.Footer.SecondaryButton, {
39
40
  onClick: u,
40
41
  size: "large",
41
- children: l.formatMessage(n.unsavedChangesModalDiscardChangesCTA)
42
+ children: t.formatMessage(n.unsavedChangesModalDiscardChangesCTA)
42
43
  }), /* @__PURE__ */ a(e.Footer.PrimaryButton, {
43
- onClick: r,
44
+ onClick: l,
44
45
  size: "large",
45
- children: l.formatMessage(n.unsavedChangesModalContinueEditingCTA)
46
+ children: t.formatMessage(n.unsavedChangesModalContinueEditingCTA)
46
47
  })]
47
48
  }), /* @__PURE__ */ a(e.Close, {
48
- "aria-label": l.formatMessage(n.unsavedChangesModalCloseLabel)
49
+ "aria-label": t.formatMessage(n.unsavedChangesModalCloseLabel)
49
50
  })]
50
51
  })
51
52
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-editor",
3
- "version": "0.60.2",
3
+ "version": "0.60.4",
4
4
  "peerDependencies": {
5
5
  "@ariakit/react": "0.4.5",
6
6
  "@box/blueprint-web": "^7.30.3",
@@ -53,5 +53,5 @@
53
53
  "**/*.css"
54
54
  ],
55
55
  "license": "SEE LICENSE IN LICENSE",
56
- "gitHead": "a917668414b5d0e1dc46512bd579e9cc958b51ea"
56
+ "gitHead": "cc88fe6001296a03f1dfce7edec7b6cd1b0ed9f0"
57
57
  }