@box/metadata-editor 0.47.0 → 0.47.1

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,22 +1,26 @@
1
1
  import { Focusable as c } from "@ariakit/react";
2
- import { Tooltip as i, Text as a } from "@box/blueprint-web";
2
+ import { Tooltip as a, Text as i } from "@box/blueprint-web";
3
3
  import { jsx as t } from "react/jsx-runtime";
4
- const f = ({
5
- tooltipText: e,
6
- children: r,
7
- as: o = "span",
8
- ...n
9
- }) => /* @__PURE__ */ t(i, {
10
- __checkInteractivity: !1,
11
- content: e,
12
- children: /* @__PURE__ */ t(c, {
13
- render: /* @__PURE__ */ t(a, {
14
- as: o,
15
- ...n,
16
- children: r
4
+ const l = ({
5
+ tooltipText: r,
6
+ children: o,
7
+ ...e
8
+ }) => {
9
+ const {
10
+ as: n = "span"
11
+ } = e;
12
+ return /* @__PURE__ */ t(a, {
13
+ __checkInteractivity: !1,
14
+ content: r,
15
+ children: /* @__PURE__ */ t(c, {
16
+ render: /* @__PURE__ */ t(i, {
17
+ as: n,
18
+ ...e,
19
+ children: o
20
+ })
17
21
  })
18
- })
19
- });
22
+ });
23
+ };
20
24
  export {
21
- f as default
25
+ l as default
22
26
  };
@@ -1,5 +1,5 @@
1
1
  import "../../../../../../styles/metadata-instance-form.css";
2
- import { useState as l, useMemo as S } from "react";
2
+ import { useState as g, useMemo as S } from "react";
3
3
  import { Formik as D } from "formik";
4
4
  import { Card as E } from "@box/blueprint-web";
5
5
  import { CustomInstance as y } from "../custom-instance/custom-instance.js";
@@ -11,32 +11,34 @@ import { UnsavedChangesModal as v } from "../../../unsaved-changes-modal/unsaved
11
11
  import { TemplateInstance as _ } from "../../../metadata-editor-fields/metadata-editor-fields.js";
12
12
  import { TEMPLATE_CUSTOM_PROPERTIES as x } from "../../../../constants.js";
13
13
  import { createJSONPatch as A } from "./utils.js";
14
- import { jsx as t, jsxs as d, Fragment as P } from "react/jsx-runtime";
14
+ import { jsx as t, jsxs as l, Fragment as P } from "react/jsx-runtime";
15
15
  const U = "_metadataInstanceForm_1hu4u_1", j = {
16
16
  metadataInstanceForm: U
17
- }, X = (c) => {
17
+ }, X = (d) => {
18
18
  const {
19
19
  isAiSuggestionsFeatureEnabled: o,
20
20
  isLoading: n,
21
+ isUnsavedChangesModalOpen: c = !1,
21
22
  onCancel: p,
22
23
  onDelete: f,
23
24
  onSubmit: u,
24
- selectedTemplateInstance: e
25
- } = c, [C, m] = l(!1), [M, r] = l(!1), i = (a) => {
26
- u(e.id, A(a, e));
27
- }, h = (a) => {
28
- a ? m(!0) : p();
29
- }, F = () => {
25
+ selectedTemplateInstance: e,
26
+ setIsUnsavedChangesModalOpen: s
27
+ } = d, [C, r] = g(!1), i = (a) => {
28
+ u(e.id, A(a, e)), s(!1);
29
+ }, M = (a) => {
30
+ a ? s(!0) : p();
31
+ }, h = () => {
30
32
  r(!0);
31
- }, I = {
33
+ }, F = {
32
34
  metadata: {
33
35
  ...e
34
36
  }
35
- }, g = S(() => {
36
- const a = e.templateKey === x, s = e.fields.length === 0;
37
+ }, I = S(() => {
38
+ const a = e.templateKey === x, m = e.fields.length === 0;
37
39
  return a ? /* @__PURE__ */ t(y, {
38
40
  isLoading: n
39
- }) : s ? /* @__PURE__ */ t(b, {
41
+ }) : m ? /* @__PURE__ */ t(b, {
40
42
  isBoxAiSuggestionsFeatureEnabled: o,
41
43
  level: "instance"
42
44
  }) : /* @__PURE__ */ t(_, {
@@ -44,31 +46,31 @@ const U = "_metadataInstanceForm_1hu4u_1", j = {
44
46
  });
45
47
  }, [e.templateKey, e.fields.length, n, o]);
46
48
  return /* @__PURE__ */ t(D, {
47
- initialValues: I,
49
+ initialValues: F,
48
50
  onSubmit: i,
49
51
  children: ({
50
52
  values: a,
51
- dirty: s
52
- }) => /* @__PURE__ */ d(P, {
53
- children: [/* @__PURE__ */ d(E, {
53
+ dirty: m
54
+ }) => /* @__PURE__ */ l(P, {
55
+ children: [/* @__PURE__ */ l(E, {
54
56
  className: j.metadataInstanceForm,
55
57
  children: [/* @__PURE__ */ t(T, {
56
58
  isAiSuggestionsFeatureEnabled: o,
57
59
  isLoading: n,
58
60
  templateName: e.displayName
59
- }), g, /* @__PURE__ */ t(N, {
61
+ }), I, /* @__PURE__ */ t(N, {
60
62
  isLoading: n,
61
- onCancel: () => h(s),
62
- onDelete: F
63
+ onCancel: () => M(m),
64
+ onDelete: h
63
65
  })]
64
66
  }), /* @__PURE__ */ t(v, {
65
- onDismiss: () => m(!1),
67
+ onDismiss: () => s(!1),
66
68
  onSaveAndContinue: () => i(a),
67
- open: C
69
+ open: c
68
70
  }), /* @__PURE__ */ t(O, {
69
71
  onConfirm: () => f(e.id),
70
72
  onDismiss: () => r(!1),
71
- open: M,
73
+ open: C,
72
74
  templateName: e.displayName
73
75
  })]
74
76
  })
@@ -4,14 +4,14 @@ import { FormattedDate as d } from "react-intl";
4
4
  import { convertISOStringToUTCDate as l } from "./convertDate.js";
5
5
  import y from "../../../interactive-text/interactive-text.js";
6
6
  import { jsxs as f, jsx as a } from "react/jsx-runtime";
7
- const I = "_metadataInstanceEntry_1qhk8_1", u = "_metadataInstanceEntryInteractiveLabel_1qhk8_7", c = {
7
+ const I = "_metadataInstanceEntry_1qhk8_1", p = "_metadataInstanceEntryInteractiveLabel_1qhk8_7", c = {
8
8
  metadataInstanceEntry: I,
9
- metadataInstanceEntryInteractiveLabel: u
9
+ metadataInstanceEntryInteractiveLabel: p
10
10
  }, _ = ({
11
11
  description: r,
12
12
  name: e,
13
13
  shouldHideEmptyValues: i,
14
- type: m,
14
+ type: s,
15
15
  value: t
16
16
  }) => {
17
17
  const n = (() => {
@@ -21,12 +21,12 @@ const I = "_metadataInstanceEntry_1qhk8_1", u = "_metadataInstanceEntryInteracti
21
21
  return null;
22
22
  if (Array.isArray(t))
23
23
  return t.join(", ");
24
- if (m === "date" && typeof t == "string") {
25
- const s = l(t);
24
+ if (s === "date" && typeof t == "string") {
25
+ const m = l(t);
26
26
  return /* @__PURE__ */ a(d, {
27
27
  day: "numeric",
28
28
  month: "long",
29
- value: s,
29
+ value: m,
30
30
  year: "numeric"
31
31
  });
32
32
  }
@@ -39,6 +39,7 @@ const I = "_metadataInstanceEntry_1qhk8_1", u = "_metadataInstanceEntryInteracti
39
39
  color: "textOnLightSecondary",
40
40
  variant: "bodyDefaultBold",
41
41
  children: r ? /* @__PURE__ */ a(y, {
42
+ as: "span",
42
43
  className: c.metadataInstanceEntryInteractiveLabel,
43
44
  color: "textOnLightSecondary",
44
45
  tooltipText: r,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-editor",
3
- "version": "0.47.0",
3
+ "version": "0.47.1",
4
4
  "peerDependencies": {
5
5
  "@ariakit/react": "0.4.5",
6
6
  "@box/blueprint-web": "^7.20.0",
@@ -13,9 +13,9 @@
13
13
  },
14
14
  "devDependencies": {
15
15
  "@ariakit/react": "0.4.5",
16
- "@box/blueprint-web": "^7.24.0",
17
- "@box/blueprint-web-assets": "^4.21.4",
18
- "@box/storybook-utils": "^0.6.0",
16
+ "@box/blueprint-web": "^7.24.1",
17
+ "@box/blueprint-web-assets": "^4.21.5",
18
+ "@box/storybook-utils": "^0.6.1",
19
19
  "react": "^18.3.0",
20
20
  "react-dom": "^18.3.0",
21
21
  "react-intl": "6.4.2"
@@ -51,5 +51,5 @@
51
51
  "**/*.css"
52
52
  ],
53
53
  "license": "SEE LICENSE IN LICENSE",
54
- "gitHead": "37b063b25167acf31fea09e1971732ad1d169709"
54
+ "gitHead": "bb2a831c3e3b11c1af207a693263069f26f7076a"
55
55
  }
@@ -1,10 +1,9 @@
1
1
  import { type TextProps } from '@box/blueprint-web';
2
- export type InteractiveTextProps = Omit<TextProps, 'as'> & {
3
- as?: TextProps['as'];
2
+ export type InteractiveTextProps = TextProps & {
4
3
  tooltipText: string;
5
4
  };
6
5
  /**
7
6
  * Wrapper component for displaying tooltip content on focusing text nodes
8
7
  */
9
- declare const InteractiveText: ({ tooltipText, children, as, ...props }: InteractiveTextProps) => import("react/jsx-runtime").JSX.Element;
8
+ declare const InteractiveText: ({ tooltipText, children, ...props }: InteractiveTextProps) => import("react/jsx-runtime").JSX.Element;
10
9
  export default InteractiveText;
@@ -2,11 +2,13 @@ import { type MetadataTemplate, type MetadataTemplateInstance } from '../../../.
2
2
  export type MetadataInstanceFormProps = {
3
3
  isAiSuggestionsFeatureEnabled: boolean;
4
4
  isLoading: boolean;
5
+ isUnsavedChangesModalOpen: boolean;
5
6
  /** The MetadataTemplate is used when creating a new instance, while MetadataTemplateInstance is applied when editing an existing one. */
6
7
  selectedTemplateInstance: MetadataTemplateInstance | MetadataTemplate;
7
8
  onCancel: () => void;
8
9
  onDelete: (id: string) => void;
9
10
  onSubmit: (id: string, operations: JSONPatchOperations) => void;
11
+ setIsUnsavedChangesModalOpen: (isUnsavedChangesModalOpen: boolean) => void;
10
12
  };
11
13
  export declare const JSONPatchOp: {
12
14
  readonly ADD: "add";