@box/metadata-editor 0.64.0 → 0.65.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.
@@ -4,16 +4,16 @@ import { jsx as a } from "react/jsx-runtime";
4
4
  const d = "_metadataInstanceList_bd83w_1", m = {
5
5
  metadataInstanceList: d
6
6
  }, L = ({
7
- isAiSuggestionsFeatureEnabled: s,
8
- onEdit: n,
9
- onEditWithAutofill: e,
7
+ areAiSuggestionsAvailable: s,
8
+ isAiSuggestionsFeatureEnabled: n,
9
+ onEdit: e,
10
10
  templateInstances: i
11
11
  }) => /* @__PURE__ */ a("div", {
12
12
  className: m.metadataInstanceList,
13
13
  children: i.map((t) => /* @__PURE__ */ a(c, {
14
- isAiSuggestionsFeatureEnabled: s,
15
- onEdit: n,
16
- onEditWithAutofill: e,
14
+ areAiSuggestionsAvailable: s,
15
+ isAiSuggestionsFeatureEnabled: n,
16
+ onEdit: e,
17
17
  templateInstance: t
18
18
  }, t.id))
19
19
  });
@@ -1,43 +1,49 @@
1
1
  import "../../../../../../styles/metadata-instance.css";
2
- import { useState as E } from "react";
3
- import { Card as f, Divider as m } from "@box/blueprint-web";
4
- import { MetadataInstanceHeader as h } from "../metadata-instance-header/metadata-instance-header.js";
5
- import { MetadataInstanceContent as D } from "../metadata-instance-content/metadata-instance-content.js";
6
- import { MetadataInstanceFooter as V } from "../metadata-instance-footer/metadata-instance-footer.js";
2
+ import { useState as v } from "react";
3
+ import { Card as E, Divider as m } from "@box/blueprint-web";
4
+ import { useAutofill as D } from "../../../../utils/autofill-context.js";
5
+ import { MetadataInstanceHeader as V } from "../metadata-instance-header/metadata-instance-header.js";
6
+ import { MetadataInstanceContent as A } from "../metadata-instance-content/metadata-instance-content.js";
7
+ import { MetadataInstanceFooter as S } from "../metadata-instance-footer/metadata-instance-footer.js";
7
8
  import { MetadataEmptyState as b } from "../../../metadata-empty-state/metadata-empty-state.js";
8
- import { jsxs as d, jsx as o, Fragment as l } from "react/jsx-runtime";
9
- const H = "_topDivider_tzhlb_1", S = "_bottomDivider_tzhlb_5", n = {
9
+ import { jsxs as a, jsx as o, Fragment as u } from "react/jsx-runtime";
10
+ const H = "_topDivider_tzhlb_1", _ = "_bottomDivider_tzhlb_5", n = {
10
11
  topDivider: H,
11
- bottomDivider: S
12
- }, w = ({
13
- isAiSuggestionsFeatureEnabled: s,
14
- onEdit: u,
15
- onEditWithAutofill: p,
12
+ bottomDivider: _
13
+ }, B = ({
14
+ areAiSuggestionsAvailable: p,
15
+ isAiSuggestionsFeatureEnabled: d,
16
+ onEdit: l,
16
17
  templateInstance: t
17
18
  }) => {
18
- const e = t.fields, y = e.every((a) => !a.value), v = e.some((a) => !a.value), c = e.length > 0, [i, r] = E(!0);
19
- return /* @__PURE__ */ d(f, {
20
- children: [/* @__PURE__ */ o(h, {
19
+ const e = t.fields, y = e.every((s) => !s.value), f = e.some((s) => !s.value), c = e.length > 0, [i, r] = v(!0), {
20
+ getAiSuggestions: h
21
+ } = D();
22
+ return /* @__PURE__ */ a(E, {
23
+ children: [/* @__PURE__ */ o(V, {
24
+ areAiSuggestionsAvailable: p,
21
25
  canEdit: !0,
22
- isAiSuggestionsFeatureEnabled: s,
23
- onAutofill: () => p(t),
24
- onEdit: () => u(t),
26
+ isAiSuggestionsFeatureEnabled: d,
27
+ onAutofill: () => {
28
+ l(t), h(t.templateKey, e);
29
+ },
30
+ onEdit: () => l(t),
25
31
  templateName: t == null ? void 0 : t.displayName
26
32
  }), /* @__PURE__ */ o(m, {
27
33
  className: n.topDivider
28
34
  }), i && y ? /* @__PURE__ */ o(b, {
29
35
  isAnyEmptyValueHidden: c,
30
- isBoxAiSuggestionsFeatureEnabled: s,
36
+ isBoxAiSuggestionsFeatureEnabled: d,
31
37
  level: "instance",
32
38
  onShowEmptyValues: () => r(!1)
33
- }) : /* @__PURE__ */ d(l, {
34
- children: [/* @__PURE__ */ o(D, {
39
+ }) : /* @__PURE__ */ a(u, {
40
+ children: [/* @__PURE__ */ o(A, {
35
41
  shouldHideEmptyValues: i,
36
42
  templateInstance: t
37
- }), v && /* @__PURE__ */ d(l, {
43
+ }), f && /* @__PURE__ */ a(u, {
38
44
  children: [/* @__PURE__ */ o(m, {
39
45
  className: n.bottomDivider
40
- }), /* @__PURE__ */ o(V, {
46
+ }), /* @__PURE__ */ o(S, {
41
47
  isAnyEmptyValueHidden: i,
42
48
  onHideEmptyValues: () => r(!0),
43
49
  onShowEmptyValues: () => r(!1)
@@ -47,5 +53,5 @@ const H = "_topDivider_tzhlb_1", S = "_bottomDivider_tzhlb_5", n = {
47
53
  });
48
54
  };
49
55
  export {
50
- w as MetadataInstance
56
+ B as MetadataInstance
51
57
  };
@@ -1,32 +1,33 @@
1
1
  import "../../../../../../styles/metadata-instance-header.css";
2
- import { Text as f, Tooltip as i, IconButton as s } from "@box/blueprint-web";
2
+ import { Text as b, Tooltip as i, IconButton as s } from "@box/blueprint-web";
3
3
  import { Pencil as g } from "@box/blueprint-web-assets/icons/Line";
4
- import { BoxAiLogo as b } from "@box/blueprint-web-assets/icons/Logo";
5
- import { useIntl as I } from "react-intl";
4
+ import { BoxAiLogo as I } from "@box/blueprint-web-assets/icons/Logo";
5
+ import { useIntl as _ } from "react-intl";
6
6
  import n from "./messages.js";
7
7
  import { jsxs as r, jsx as a } from "react/jsx-runtime";
8
- const _ = "_metadataInstanceHeader_1vbbg_1", h = "_iconButtonsContainer_1vbbg_7", p = "_title_1vbbg_15", e = {
9
- metadataInstanceHeader: _,
10
- iconButtonsContainer: h,
11
- title: p
12
- }, T = ({
13
- canEdit: c,
14
- isAiSuggestionsFeatureEnabled: l,
15
- onEdit: d,
16
- onAutofill: u,
8
+ const h = "_metadataInstanceHeader_1vbbg_1", p = "_iconButtonsContainer_1vbbg_7", v = "_title_1vbbg_15", e = {
9
+ metadataInstanceHeader: h,
10
+ iconButtonsContainer: p,
11
+ title: v
12
+ }, j = ({
13
+ areAiSuggestionsAvailable: c,
14
+ canEdit: l,
15
+ isAiSuggestionsFeatureEnabled: d,
16
+ onEdit: u,
17
+ onAutofill: m,
17
18
  templateName: t
18
19
  }) => {
19
- const o = I(), m = t || o.formatMessage(n.customInstanceTitle), B = l && t;
20
+ const o = _(), B = t || o.formatMessage(n.customInstanceTitle), f = d && t;
20
21
  return /* @__PURE__ */ r("div", {
21
22
  className: e.metadataInstanceHeader,
22
- children: [/* @__PURE__ */ a(f, {
23
+ children: [/* @__PURE__ */ a(b, {
23
24
  as: "h1",
24
25
  className: e.title,
25
26
  variant: "titleMedium",
26
- children: m
27
- }), c && /* @__PURE__ */ r("div", {
27
+ children: B
28
+ }), l && /* @__PURE__ */ r("div", {
28
29
  className: e.iconButtonsContainer,
29
- children: [B && /* @__PURE__ */ a(i, {
30
+ children: [f && /* @__PURE__ */ a(i, {
30
31
  content: o.formatMessage(n.autofillButtonTooltip, {
31
32
  templateName: t
32
33
  }),
@@ -34,8 +35,9 @@ const _ = "_metadataInstanceHeader_1vbbg_1", h = "_iconButtonsContainer_1vbbg_7"
34
35
  "aria-label": o.formatMessage(n.autofillButtonAriaLabel, {
35
36
  templateName: t
36
37
  }),
37
- icon: b,
38
- onClick: u,
38
+ disabled: !c,
39
+ icon: I,
40
+ onClick: m,
39
41
  variant: "icon-logo",
40
42
  "data-target-id": "IconButton-autofillButtonAriaLabel"
41
43
  })
@@ -46,7 +48,7 @@ const _ = "_metadataInstanceHeader_1vbbg_1", h = "_iconButtonsContainer_1vbbg_7"
46
48
  templateName: t
47
49
  }),
48
50
  icon: g,
49
- onClick: d,
51
+ onClick: u,
50
52
  "data-target-id": "IconButton-editButtonAriaLabel"
51
53
  })
52
54
  })]
@@ -54,5 +56,5 @@ const _ = "_metadataInstanceHeader_1vbbg_1", h = "_iconButtonsContainer_1vbbg_7"
54
56
  });
55
57
  };
56
58
  export {
57
- T as MetadataInstanceHeader
59
+ j as MetadataInstanceHeader
58
60
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-editor",
3
- "version": "0.64.0",
3
+ "version": "0.65.0",
4
4
  "peerDependencies": {
5
5
  "@ariakit/react": "0.4.5",
6
6
  "@box/blueprint-web": "^7.30.3",
@@ -14,7 +14,7 @@
14
14
  "devDependencies": {
15
15
  "@ariakit/react": "0.4.5",
16
16
  "@box/babel-plugin-target-attributes": "1.3.0",
17
- "@box/blueprint-web": "^7.32.1",
17
+ "@box/blueprint-web": "^7.33.0",
18
18
  "@box/blueprint-web-assets": "^4.27.0",
19
19
  "@box/storybook-utils": "^0.6.1",
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": "f62fc0186afc974ccd50f3df0ad7e386024a430b"
56
+ "gitHead": "9210e9b3a6f169b12238b78e4c4060c1e228cd70"
57
57
  }
@@ -1,2 +1,2 @@
1
1
  import { type MetadataInstanceListProps } from './types';
2
- export declare const MetadataInstanceList: ({ isAiSuggestionsFeatureEnabled, onEdit, onEditWithAutofill, templateInstances, }: MetadataInstanceListProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const MetadataInstanceList: ({ areAiSuggestionsAvailable, isAiSuggestionsFeatureEnabled, onEdit, templateInstances, }: MetadataInstanceListProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import { type MetadataInstanceProps } from './types';
2
- export declare const MetadataInstance: ({ isAiSuggestionsFeatureEnabled, onEdit, onEditWithAutofill, templateInstance, }: MetadataInstanceProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const MetadataInstance: ({ areAiSuggestionsAvailable, isAiSuggestionsFeatureEnabled, onEdit, templateInstance, }: MetadataInstanceProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { type MetadataTemplateInstance } from '../../../../types';
2
2
  export type MetadataInstanceProps = {
3
+ areAiSuggestionsAvailable: boolean;
3
4
  isAiSuggestionsFeatureEnabled: boolean;
4
5
  onEdit: (templateInstance: MetadataTemplateInstance) => void;
5
- onEditWithAutofill: (templateInstance: MetadataTemplateInstance) => void;
6
6
  templateInstance: MetadataTemplateInstance;
7
7
  };
@@ -1,2 +1,2 @@
1
1
  import { type MetadataInstanceHeaderProps } from './types';
2
- export declare const MetadataInstanceHeader: ({ canEdit, isAiSuggestionsFeatureEnabled, onEdit, onAutofill, templateName, }: MetadataInstanceHeaderProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const MetadataInstanceHeader: ({ areAiSuggestionsAvailable, canEdit, isAiSuggestionsFeatureEnabled, onEdit, onAutofill, templateName, }: MetadataInstanceHeaderProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  export type MetadataInstanceHeaderProps = {
2
+ areAiSuggestionsAvailable: boolean;
2
3
  canEdit: boolean;
3
4
  isAiSuggestionsFeatureEnabled: boolean;
4
5
  onEdit: () => void;
@@ -1,7 +1,7 @@
1
1
  import { type MetadataTemplateInstance } from '../../types';
2
2
  export type MetadataInstanceListProps = {
3
+ areAiSuggestionsAvailable: boolean;
3
4
  isAiSuggestionsFeatureEnabled: boolean;
4
5
  onEdit: (templateInstacne: MetadataTemplateInstance) => void;
5
- onEditWithAutofill: (templateInstance: MetadataTemplateInstance) => void;
6
6
  templateInstances: MetadataTemplateInstance[];
7
7
  };