@box/metadata-editor 0.59.1 → 0.59.3

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,24 +2,24 @@ import "../../../../../../styles/metadata-instance-form.css";
2
2
  import { Card as v } from "@box/blueprint-web";
3
3
  import { Formik as N, Form as P } from "formik";
4
4
  import { useState as c, useRef as U, useEffect as _, useMemo as x } from "react";
5
- import { TEMPLATE_CUSTOM_PROPERTIES as L } from "../../../../constants.js";
6
- import { useAutofill as R } from "../../../../utils/autofill-context.js";
7
- import { TemplateInstance as B } from "../../../metadata-editor-fields/metadata-editor-fields.js";
8
- import { MetadataEmptyState as j } from "../../../metadata-empty-state/metadata-empty-state.js";
9
- import { UnsavedChangesModal as k } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
10
- import { CustomInstance as w } from "../custom-instance/custom-instance.js";
11
- import { DeleteConfirmationModal as H } from "../delete-confirmation-modal/delete-confirmation-modal.js";
12
- import { MetadataInstanceFormFooter as J } from "../metadata-instance-form-footer/metadata-instance-form-footer.js";
13
- import { MetadataInstanceFormHeader as K } from "../metadata-instance-form-header/metadata-instance-form-header.js";
14
- import { createJSONPatch as V } from "./utils.js";
5
+ import { TEMPLATE_CUSTOM_PROPERTIES as K } from "../../../../constants.js";
6
+ import { useAutofill as L } from "../../../../utils/autofill-context.js";
7
+ import { TemplateInstance as R } from "../../../metadata-editor-fields/metadata-editor-fields.js";
8
+ import { MetadataEmptyState as B } from "../../../metadata-empty-state/metadata-empty-state.js";
9
+ import { UnsavedChangesModal as j } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
10
+ import { CustomInstance as k } from "../custom-instance/custom-instance.js";
11
+ import { DeleteConfirmationModal as $ } from "../delete-confirmation-modal/delete-confirmation-modal.js";
12
+ import { MetadataInstanceFormFooter as w } from "../metadata-instance-form-footer/metadata-instance-form-footer.js";
13
+ import { MetadataInstanceFormHeader as H } from "../metadata-instance-form-header/metadata-instance-form-header.js";
14
+ import { createJSONPatch as J } from "./utils.js";
15
15
  import { jsx as t, jsxs as d } from "react/jsx-runtime";
16
- const q = "_metadataInstanceForm_1hu4u_1", z = {
17
- metadataInstanceForm: q
18
- }, me = (f) => {
16
+ const V = "_metadataInstanceForm_1hu4u_1", q = {
17
+ metadataInstanceForm: V
18
+ }, re = (p) => {
19
19
  const {
20
- areAiSuggestionsAvailable: u,
20
+ areAiSuggestionsAvailable: f,
21
21
  isAiSuggestionsFeatureEnabled: o,
22
- isDeleteButtonDisabled: p,
22
+ isDeleteButtonDisabled: u,
23
23
  isUnsavedChangesModalOpen: g = !1,
24
24
  onCancel: h,
25
25
  onDelete: C,
@@ -27,70 +27,70 @@ const q = "_metadataInstanceForm_1hu4u_1", z = {
27
27
  selectedTemplateInstance: e,
28
28
  setIsUnsavedChangesModalOpen: i,
29
29
  onDiscardUnsavedChanges: M
30
- } = f, [S, r] = c(!1), {
30
+ } = p, [S, m] = c(!1), {
31
31
  isFetchingSuggestions: n,
32
32
  getAiSuggestions: E
33
- } = R(), s = e.templateKey === L, I = async (a) => {
34
- await F(a, V(a, e));
33
+ } = L(), s = e.templateKey === K, I = async (a) => {
34
+ await F(a, J(a, e));
35
35
  }, D = (a) => {
36
36
  a ? i(!0) : h();
37
- }, b = () => {
38
- r(!0);
39
- }, A = {
37
+ }, y = () => {
38
+ m(!0);
39
+ }, b = {
40
40
  metadata: {
41
41
  ...e
42
42
  }
43
- }, m = U(null), [l, y] = c(null);
43
+ }, r = U(null), [l, A] = c(null);
44
44
  _(() => {
45
- y(m.current);
46
- }, []);
45
+ A(r.current);
46
+ }, [e.templateKey, e.scope]);
47
47
  const O = x(() => {
48
48
  const a = e.fields.length === 0;
49
- return s ? /* @__PURE__ */ t(w, {
49
+ return s ? /* @__PURE__ */ t(k, {
50
50
  isLoading: n
51
- }) : a ? /* @__PURE__ */ t(j, {
51
+ }) : a ? /* @__PURE__ */ t(B, {
52
52
  isBoxAiSuggestionsFeatureEnabled: o,
53
53
  level: "instance"
54
- }) : /* @__PURE__ */ t(B, {
54
+ }) : /* @__PURE__ */ t(R, {
55
55
  disableForm: n,
56
56
  portalElement: l
57
57
  });
58
- }, [s, e.fields.length, n, o, l]);
58
+ }, [s, e.fields.length, e.templateKey, e.scope, n, o, l]);
59
59
  return /* @__PURE__ */ t(N, {
60
- initialValues: A,
60
+ initialValues: b,
61
61
  onSubmit: I,
62
62
  children: ({
63
63
  values: a,
64
64
  dirty: T
65
65
  }) => /* @__PURE__ */ d(P, {
66
66
  children: [/* @__PURE__ */ d(v, {
67
- ref: m,
68
- className: z.metadataInstanceForm,
69
- children: [/* @__PURE__ */ t(K, {
70
- areAiSuggestionsAvailable: u,
67
+ ref: r,
68
+ className: q.metadataInstanceForm,
69
+ children: [/* @__PURE__ */ t(H, {
70
+ areAiSuggestionsAvailable: f,
71
71
  isAiSuggestionsFeatureEnabled: o && !s,
72
72
  isLoading: n,
73
73
  onAutofill: E,
74
74
  templateName: e.displayName
75
- }), O, /* @__PURE__ */ t(J, {
76
- isDeleteButtonDisabled: p,
75
+ }), O, /* @__PURE__ */ t(w, {
76
+ isDeleteButtonDisabled: u,
77
77
  isLoading: n,
78
78
  onCancel: () => D(T),
79
- onDelete: b
79
+ onDelete: y
80
80
  })]
81
- }), /* @__PURE__ */ t(k, {
81
+ }), /* @__PURE__ */ t(j, {
82
82
  onBackToEdit: () => i(!1),
83
83
  onDiscardChanges: M,
84
84
  open: g
85
- }), /* @__PURE__ */ t(H, {
85
+ }), /* @__PURE__ */ t($, {
86
86
  onConfirm: () => C(e),
87
- onDismiss: () => r(!1),
87
+ onDismiss: () => m(!1),
88
88
  open: S,
89
89
  templateName: e.displayName
90
90
  })]
91
91
  })
92
- });
92
+ }, `${e.scope}.${e.templateKey}`);
93
93
  };
94
94
  export {
95
- me as MetadataInstanceForm
95
+ re as MetadataInstanceForm
96
96
  };
@@ -1,12 +1,11 @@
1
1
  import "../../../../../../styles/metadata-instance-entry.css";
2
2
  import { Text as o } from "@box/blueprint-web";
3
- import { FormattedDate as s } from "react-intl";
4
- import { convertISOStringToUTCDate as d } from "./convertDate.js";
5
- import f from "../../../interactive-text/interactive-text.js";
6
- import { jsxs as y, jsx as r } from "react/jsx-runtime";
7
- const l = "_metadataInstanceEntry_kd217_1", p = {
8
- metadataInstanceEntry: l
9
- }, S = ({
3
+ import { FormattedDate as m } from "react-intl";
4
+ import d from "../../../interactive-text/interactive-text.js";
5
+ import { jsxs as l, jsx as r } from "react/jsx-runtime";
6
+ const f = "_metadataInstanceEntry_kd217_1", y = {
7
+ metadataInstanceEntry: f
8
+ }, D = ({
10
9
  description: a,
11
10
  name: e,
12
11
  shouldHideEmptyValues: i,
@@ -21,23 +20,23 @@ const l = "_metadataInstanceEntry_kd217_1", p = {
21
20
  if (Array.isArray(t))
22
21
  return t.join(", ");
23
22
  if (c === "date" && typeof t == "string") {
24
- const m = d(t);
25
- return /* @__PURE__ */ r(s, {
23
+ const s = new Date(t);
24
+ return /* @__PURE__ */ r(m, {
26
25
  day: "numeric",
27
26
  month: "long",
28
- value: m,
27
+ value: s,
29
28
  year: "numeric"
30
29
  });
31
30
  }
32
31
  return t;
33
32
  })();
34
- return i && !n ? null : /* @__PURE__ */ y("div", {
35
- className: p.metadataInstanceEntry,
33
+ return i && !n ? null : /* @__PURE__ */ l("div", {
34
+ className: y.metadataInstanceEntry,
36
35
  children: [/* @__PURE__ */ r(o, {
37
36
  as: "p",
38
37
  color: "textOnLightSecondary",
39
38
  variant: "bodyDefaultBold",
40
- children: a ? /* @__PURE__ */ r(f, {
39
+ children: a ? /* @__PURE__ */ r(d, {
41
40
  as: "span",
42
41
  color: "textOnLightSecondary",
43
42
  tooltipText: a,
@@ -51,5 +50,5 @@ const l = "_metadataInstanceEntry_kd217_1", p = {
51
50
  });
52
51
  };
53
52
  export {
54
- S as MetadataInstanceEntry
53
+ D as MetadataInstanceEntry
55
54
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-editor",
3
- "version": "0.59.1",
3
+ "version": "0.59.3",
4
4
  "peerDependencies": {
5
5
  "@ariakit/react": "0.4.5",
6
6
  "@box/blueprint-web": "^7.20.0",
@@ -53,5 +53,5 @@
53
53
  "**/*.css"
54
54
  ],
55
55
  "license": "SEE LICENSE IN LICENSE",
56
- "gitHead": "fcbe26ca4e43cc531f46c999749ca18d2f18a773"
56
+ "gitHead": "3e7439683617c58f47e2b395137406b726138e12"
57
57
  }
@@ -1,25 +0,0 @@
1
- const O = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?/, E = /(Z$)/, T = /(?:[+-](?:([0-2]\d$)|([0-2]\d(?:00|30)$)|([0-2]\d:(?:00|30)$)))/, I = new RegExp(`^(${O.source})?(${E.source}|${T.source})$`), _ = 1, M = 2, S = 3, i = 4, r = 5, f = 6, D = 7;
2
- function u(n) {
3
- if (I.test(n)) {
4
- const t = n.split(I);
5
- let e = t[_];
6
- const o = t[M], s = t[S];
7
- if (o || (e += ".000"), t[i])
8
- return n;
9
- if (t[r])
10
- return `${e + s}:00`;
11
- if (t[f])
12
- return `${e + s.substring(0, 3)}:${s.substring(3)}`;
13
- if (t[D])
14
- return n;
15
- }
16
- return n;
17
- }
18
- function N(n) {
19
- const t = new Date(u(n)), e = t.getTime(), s = t.getTimezoneOffset() * 6e4, c = e + s;
20
- return new Date(c);
21
- }
22
- export {
23
- N as convertISOStringToUTCDate,
24
- u as convertISOStringtoRFC3339String
25
- };
@@ -1,30 +0,0 @@
1
- /**
2
- * Will convert ISO8601-compatible dates (with zone designators)
3
- * 2018-06-13T00:00:00.000-0500
4
- * or
5
- * 2018-06-13T00:00:00.000-05
6
- *
7
- * to
8
- * 2018-06-13T00:00:00.000-05:00
9
- *
10
- * Equivalent formats between the two (e.g., uzing 'Z') will remain unchanged.
11
- * If the date format cannot be converted, it will pass along the existing value
12
- *
13
- * @public
14
- * @param isoString - the date to be converted
15
- * @returns converted date format, if applicable
16
- */
17
- export declare function convertISOStringtoRFC3339String(isoString: string): string;
18
- /**
19
- * Will convert
20
- * 2018-06-13T00:00:00.000Z
21
- * to
22
- * 2018-06-13T07:00:00.000Z
23
- *
24
- * This is the opposite of convertDateToUnixMidnightTime
25
- *
26
- * @public
27
- * @param isoString - ISO string in UTC time zone
28
- * @returns date in UTC time zone
29
- */
30
- export declare function convertISOStringToUTCDate(isoString: string): Date;