@box/metadata-editor 0.67.8 → 0.67.12

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.
@@ -0,0 +1,37 @@
1
+ import "../../../../styles/interactive-header-text.css";
2
+ import { Focusable as l } from "@ariakit/react";
3
+ import { useFullTextTooltip as i, Text as m } from "@box/blueprint-web";
4
+ import n from "clsx";
5
+ import { useRef as p } from "react";
6
+ import { jsx as e, Fragment as c } from "react/jsx-runtime";
7
+ const d = "_header_d9pl2_1", f = {
8
+ header: d
9
+ }, v = ({
10
+ className: o,
11
+ title: r
12
+ }) => {
13
+ const t = p(null), {
14
+ Wrapper: a,
15
+ wrapperProps: s
16
+ } = i({
17
+ ref: t,
18
+ textValue: r
19
+ });
20
+ return /* @__PURE__ */ e(c, {
21
+ children: /* @__PURE__ */ e(a, {
22
+ ...s,
23
+ children: /* @__PURE__ */ e(l, {
24
+ render: /* @__PURE__ */ e(m, {
25
+ ref: t,
26
+ as: "h1",
27
+ className: n(f.header, o),
28
+ variant: "titleMedium",
29
+ children: r
30
+ })
31
+ })
32
+ })
33
+ });
34
+ };
35
+ export {
36
+ v as default
37
+ };
@@ -1,28 +1,28 @@
1
1
  import "../../../../../../styles/ai-suggestion-field.css";
2
- import { Text as g, IconButton as l, DropdownMenu as t } from "@box/blueprint-web";
2
+ import { Text as g, IconButton as d, DropdownMenu as t } from "@box/blueprint-web";
3
3
  import { Checkmark as u, Ellipsis as S } from "@box/blueprint-web-assets/icons/Fill";
4
4
  import { useIntl as h, FormattedMessage as n } from "react-intl";
5
5
  import r from "./messages.js";
6
6
  import { formatSuggestionValue as w } from "./utils.js";
7
7
  import { jsx as e, jsxs as a } from "react/jsx-runtime";
8
- const I = "_wrapperGradient_t2yak_1", _ = "_wrapper_t2yak_1", f = "_buttons_t2yak_18", k = "_selectTrigger_t2yak_22", i = {
9
- wrapperGradient: I,
10
- wrapper: _,
8
+ const _ = "_wrapperGradient_t2yak_1", I = "_wrapper_t2yak_1", f = "_buttons_t2yak_18", k = "_selectTrigger_t2yak_22", o = {
9
+ wrapperGradient: _,
10
+ wrapper: I,
11
11
  buttons: f,
12
12
  selectTrigger: k
13
13
  };
14
- function A({
15
- aiSuggestion: c,
16
- onAiSuggestionAppend: s,
17
- onAiSuggestionReplace: p,
18
- onAiSuggestionIgnore: d,
19
- type: m
14
+ function D({
15
+ aiSuggestion: p,
16
+ onAiSuggestionAppend: l,
17
+ onAiSuggestionReplace: c,
18
+ onAiSuggestionIgnore: m,
19
+ type: i
20
20
  }) {
21
- const o = h();
21
+ const s = h();
22
22
  return /* @__PURE__ */ e("div", {
23
- className: i.wrapperGradient,
23
+ className: o.wrapperGradient,
24
24
  children: /* @__PURE__ */ a("div", {
25
- className: i.wrapper,
25
+ className: o.wrapper,
26
26
  children: [/* @__PURE__ */ a("div", {
27
27
  children: [/* @__PURE__ */ e(g, {
28
28
  as: "p",
@@ -33,42 +33,41 @@ function A({
33
33
  })
34
34
  }), /* @__PURE__ */ e(g, {
35
35
  as: "p",
36
- children: w(c, {
37
- type: m,
38
- locale: o.locale
36
+ children: w(p, {
37
+ type: i,
38
+ locale: s.locale
39
39
  })
40
40
  })]
41
41
  }), /* @__PURE__ */ a("div", {
42
- className: i.buttons,
43
- children: [/* @__PURE__ */ e(l, {
44
- "aria-label": o.formatMessage(r.aiSuggestionAppend),
42
+ className: o.buttons,
43
+ children: [/* @__PURE__ */ e(d, {
44
+ "aria-label": s.formatMessage(i === "multiSelect" ? r.aiSuggestionAppend : r.aiSuggestionClearAndReplace),
45
45
  icon: u,
46
- onClick: s,
47
- size: "x-small",
48
- "data-target-id": "IconButton-aiSuggestionAppend"
46
+ onClick: i === "multiSelect" ? l : c,
47
+ size: "x-small"
49
48
  }), /* @__PURE__ */ a(t.Root, {
50
49
  children: [/* @__PURE__ */ e(t.Trigger, {
51
- className: i.selectTrigger,
52
- children: /* @__PURE__ */ e(l, {
53
- "aria-label": o.formatMessage(r.aiSuggestionOptions),
50
+ className: o.selectTrigger,
51
+ children: /* @__PURE__ */ e(d, {
52
+ "aria-label": s.formatMessage(r.aiSuggestionOptions),
54
53
  icon: S,
55
54
  "data-target-id": "IconButton-aiSuggestionOptions"
56
55
  })
57
56
  }), /* @__PURE__ */ a(t.Content, {
58
- children: [/* @__PURE__ */ e(t.Item, {
59
- onSelect: s,
57
+ children: [i === "multiSelect" && /* @__PURE__ */ e(t.Item, {
58
+ onSelect: l,
60
59
  "data-target-id": "DropdownMenu.Item-aiSuggestionAppend",
61
60
  children: /* @__PURE__ */ e(n, {
62
61
  ...r.aiSuggestionAppend
63
62
  })
64
63
  }), /* @__PURE__ */ e(t.Item, {
65
- onSelect: p,
64
+ onSelect: c,
66
65
  "data-target-id": "DropdownMenu.Item-aiSuggestionClearAndReplace",
67
66
  children: /* @__PURE__ */ e(n, {
68
67
  ...r.aiSuggestionClearAndReplace
69
68
  })
70
69
  }), /* @__PURE__ */ e(t.Separator, {}), /* @__PURE__ */ e(t.Item, {
71
- onSelect: d,
70
+ onSelect: m,
72
71
  "data-target-id": "DropdownMenu.Item-aiSuggestionIgnore",
73
72
  children: /* @__PURE__ */ e(n, {
74
73
  ...r.aiSuggestionIgnore
@@ -81,5 +80,5 @@ function A({
81
80
  });
82
81
  }
83
82
  export {
84
- A as AiSuggestionField
83
+ D as AiSuggestionField
85
84
  };
@@ -1,85 +1,67 @@
1
1
  import "../../../../../../styles/metadata-instance-form-header.css";
2
- import { Focusable as v } from "@ariakit/react";
3
- import { Text as K, Tooltip as h, Button as k } from "@box/blueprint-web";
4
- import { BoxAiLogo as S } from "@box/blueprint-web-assets/icons/Logo";
5
- import { useFormikContext as j, getIn as i } from "formik";
6
- import { useState as C, useRef as E, useEffect as I } from "react";
7
- import { useIntl as L } from "react-intl";
8
- import { useAutofill as N } from "../../../../utils/autofill-context.js";
9
- import r from "./messages.js";
10
- import { jsx as o, jsxs as R } from "react/jsx-runtime";
11
- const W = "_metadataInstanceFormHeader_rdx5o_1", D = "_title_rdx5o_9", x = {
12
- metadataInstanceFormHeader: W,
13
- title: D
14
- }, X = ({
15
- areAiSuggestionsAvailable: B,
16
- isAiSuggestionsFeatureEnabled: F,
17
- isLoading: d,
18
- templateName: T,
19
- onAutofill: y
2
+ import { Tooltip as _, Button as b } from "@box/blueprint-web";
3
+ import { BoxAiLogo as A } from "@box/blueprint-web-assets/icons/Logo";
4
+ import { useFormikContext as M, getIn as o } from "formik";
5
+ import { useEffect as h } from "react";
6
+ import { useIntl as v } from "react-intl";
7
+ import { useAutofill as K } from "../../../../utils/autofill-context.js";
8
+ import T from "../../../interactive-header-text/interactive-header-text.js";
9
+ import s from "./messages.js";
10
+ import { jsxs as k, jsx as m } from "react/jsx-runtime";
11
+ const j = "_metadataInstanceFormHeader_13lxr_1", C = "_title_13lxr_9", u = {
12
+ metadataInstanceFormHeader: j,
13
+ title: C
14
+ }, J = ({
15
+ areAiSuggestionsAvailable: p,
16
+ isAiSuggestionsFeatureEnabled: g,
17
+ isLoading: l,
18
+ templateName: I,
19
+ onAutofill: x
20
20
  }) => {
21
21
  const {
22
- isSubmitting: b,
23
- values: n,
24
- setFieldValue: u
25
- } = j(), s = L(), {
22
+ isSubmitting: B,
23
+ values: e,
24
+ setFieldValue: c
25
+ } = M(), a = v(), {
26
26
  suggestions: t
27
- } = N(), [M, _] = C(!1), l = E(null);
28
- I(() => {
27
+ } = K();
28
+ h(() => {
29
29
  if (t) {
30
- const e = i(n, "metadata.fields"), a = i(n, "metadata.templateKey");
31
- u("metadata.fields", e.map((c) => {
32
- var g;
33
- const p = (g = t == null ? void 0 : t[a]) == null ? void 0 : g[c.key];
34
- return p ? {
35
- ...c,
36
- aiSuggestion: p
37
- } : c;
30
+ const n = o(e, "metadata.fields"), r = o(e, "metadata.templateKey");
31
+ c("metadata.fields", n.map((i) => {
32
+ var f;
33
+ const d = (f = t == null ? void 0 : t[r]) == null ? void 0 : f[i.key];
34
+ return d ? {
35
+ ...i,
36
+ aiSuggestion: d
37
+ } : i;
38
38
  }));
39
39
  }
40
- }, [t, u]);
41
- const A = () => {
42
- const e = i(n, "metadata.fields"), a = i(n, "metadata.templateKey");
43
- y(a, e);
44
- }, m = T ?? s.formatMessage(r.customInstanceTitle);
45
- I(() => {
46
- if (l.current) {
47
- const {
48
- scrollWidth: e,
49
- clientWidth: a
50
- } = l.current;
51
- _(e > a);
52
- }
53
- }, [m]);
54
- const f = /* @__PURE__ */ o(K, {
55
- ref: l,
56
- as: "h1",
57
- className: x.title,
58
- variant: "titleMedium",
59
- children: m
60
- }), H = !B || b || d;
61
- return /* @__PURE__ */ R("div", {
62
- className: x.metadataInstanceFormHeader,
63
- children: [M ? /* @__PURE__ */ o(h, {
64
- content: m,
65
- children: /* @__PURE__ */ o(v, {
66
- render: f
67
- })
68
- }) : f, F && /* @__PURE__ */ o(h, {
69
- content: s.formatMessage(r.autofillButtonTooltip),
70
- children: /* @__PURE__ */ o(k, {
40
+ }, [t, c]);
41
+ const y = () => {
42
+ const n = o(e, "metadata.fields"), r = o(e, "metadata.templateKey");
43
+ x(r, n);
44
+ }, F = I ?? a.formatMessage(s.customInstanceTitle), H = !p || B || l;
45
+ return /* @__PURE__ */ k("div", {
46
+ className: u.metadataInstanceFormHeader,
47
+ children: [/* @__PURE__ */ m(T, {
48
+ className: u.title,
49
+ title: F
50
+ }), g && /* @__PURE__ */ m(_, {
51
+ content: a.formatMessage(s.autofillButtonTooltip),
52
+ children: /* @__PURE__ */ m(b, {
71
53
  disabled: H,
72
- icon: S,
73
- loading: d,
74
- loadingAriaLabel: s.formatMessage(r.loadingButtonAriaLabel),
75
- onClick: A,
54
+ icon: A,
55
+ loading: l,
56
+ loadingAriaLabel: a.formatMessage(s.loadingButtonAriaLabel),
57
+ onClick: y,
76
58
  variant: "secondary",
77
59
  "data-target-id": "Button-autofillButton",
78
- children: s.formatMessage(r.autofillButton)
60
+ children: a.formatMessage(s.autofillButton)
79
61
  })
80
62
  })]
81
63
  });
82
64
  };
83
65
  export {
84
- X as MetadataInstanceFormHeader
66
+ J as MetadataInstanceFormHeader
85
67
  };
@@ -1,72 +1,53 @@
1
1
  import "../../../../../../styles/metadata-instance-header.css";
2
- import { Focusable as b } from "@ariakit/react";
3
- import { Text as x, Tooltip as r, IconButton as l } from "@box/blueprint-web";
4
- import { Pencil as M } from "@box/blueprint-web-assets/icons/Line";
5
- import { BoxAiLogo as A } from "@box/blueprint-web-assets/icons/Logo";
6
- import { useState as C, useRef as j, useEffect as H } from "react";
7
- import { useIntl as L } from "react-intl";
2
+ import { Tooltip as i, IconButton as r } from "@box/blueprint-web";
3
+ import { Pencil as p } from "@box/blueprint-web-assets/icons/Line";
4
+ import { BoxAiLogo as I } from "@box/blueprint-web-assets/icons/Logo";
5
+ import { useIntl as g } from "react-intl";
6
+ import _ from "../../../interactive-header-text/interactive-header-text.js";
8
7
  import n from "./messages.js";
9
- import { jsx as t, jsxs as d } from "react/jsx-runtime";
10
- const v = "_metadataInstanceHeader_jo0x0_1", k = "_iconButtonsContainer_jo0x0_6", E = "_title_jo0x0_14", s = {
11
- metadataInstanceHeader: v,
12
- iconButtonsContainer: k,
13
- title: E
14
- }, D = ({
15
- areAiSuggestionsAvailable: u,
16
- canEdit: m,
17
- isAiSuggestionsFeatureEnabled: f,
18
- onEdit: B,
19
- onAutofill: I,
20
- templateName: o
8
+ import { jsxs as s, jsx as a } from "react/jsx-runtime";
9
+ const x = "_metadataInstanceHeader_54pdx_1", b = "_iconButtonsContainer_54pdx_6", A = "_title_54pdx_14", e = {
10
+ metadataInstanceHeader: x,
11
+ iconButtonsContainer: b,
12
+ title: A
13
+ }, k = ({
14
+ areAiSuggestionsAvailable: c,
15
+ canEdit: l,
16
+ isAiSuggestionsFeatureEnabled: d,
17
+ onEdit: m,
18
+ onAutofill: u,
19
+ templateName: t
21
20
  }) => {
22
- const e = L(), [g, h] = C(!1), a = j(null), i = o || e.formatMessage(n.customInstanceTitle), p = f && o;
23
- H(() => {
24
- if (a.current) {
25
- const {
26
- scrollWidth: T,
27
- clientWidth: _
28
- } = a.current;
29
- h(T > _);
30
- }
31
- }, [i]);
32
- const c = /* @__PURE__ */ t(x, {
33
- ref: a,
34
- as: "h1",
35
- className: s.title,
36
- variant: "titleMedium",
37
- children: i
38
- });
39
- return /* @__PURE__ */ d("div", {
40
- className: s.metadataInstanceHeader,
41
- children: [g ? /* @__PURE__ */ t(r, {
42
- content: i,
43
- children: /* @__PURE__ */ t(b, {
44
- render: c
45
- })
46
- }) : c, m && /* @__PURE__ */ d("div", {
47
- className: s.iconButtonsContainer,
48
- children: [p && /* @__PURE__ */ t(r, {
49
- content: e.formatMessage(n.autofillButtonTooltip, {
50
- templateName: o
21
+ const o = g(), f = t || o.formatMessage(n.customInstanceTitle), B = d && t;
22
+ return /* @__PURE__ */ s("div", {
23
+ className: e.metadataInstanceHeader,
24
+ children: [/* @__PURE__ */ a(_, {
25
+ className: e.title,
26
+ title: f
27
+ }), l && /* @__PURE__ */ s("div", {
28
+ className: e.iconButtonsContainer,
29
+ children: [B && /* @__PURE__ */ a(i, {
30
+ content: o.formatMessage(n.autofillButtonTooltip, {
31
+ templateName: t
51
32
  }),
52
- children: /* @__PURE__ */ t(l, {
53
- "aria-label": e.formatMessage(n.autofillButtonAriaLabel, {
54
- templateName: o
33
+ children: /* @__PURE__ */ a(r, {
34
+ "aria-label": o.formatMessage(n.autofillButtonAriaLabel, {
35
+ templateName: t
55
36
  }),
56
- disabled: !u,
57
- icon: A,
58
- onClick: I,
37
+ disabled: !c,
38
+ icon: I,
39
+ onClick: u,
59
40
  variant: "icon-logo",
60
41
  "data-target-id": "IconButton-autofillButtonAriaLabel"
61
42
  })
62
- }), /* @__PURE__ */ t(r, {
63
- content: e.formatMessage(n.editButtonTooltip),
64
- children: /* @__PURE__ */ t(l, {
65
- "aria-label": e.formatMessage(n.editButtonAriaLabel, {
66
- templateName: o
43
+ }), /* @__PURE__ */ a(i, {
44
+ content: o.formatMessage(n.editButtonTooltip),
45
+ children: /* @__PURE__ */ a(r, {
46
+ "aria-label": o.formatMessage(n.editButtonAriaLabel, {
47
+ templateName: t
67
48
  }),
68
- icon: M,
69
- onClick: B,
49
+ icon: p,
50
+ onClick: m,
70
51
  "data-target-id": "IconButton-editButtonAriaLabel"
71
52
  })
72
53
  })]
@@ -74,5 +55,5 @@ const v = "_metadataInstanceHeader_jo0x0_1", k = "_iconButtonsContainer_jo0x0_6"
74
55
  });
75
56
  };
76
57
  export {
77
- D as MetadataInstanceHeader
58
+ k as MetadataInstanceHeader
78
59
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-editor",
3
- "version": "0.67.8",
3
+ "version": "0.67.12",
4
4
  "peerDependencies": {
5
5
  "@ariakit/react": "0.4.5",
6
6
  "@box/blueprint-web": "^7.30.3",
@@ -14,9 +14,9 @@
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.34.1",
18
- "@box/blueprint-web-assets": "^4.27.0",
19
- "@box/storybook-utils": "^0.6.1",
17
+ "@box/blueprint-web": "^7.36.0",
18
+ "@box/blueprint-web-assets": "^4.27.2",
19
+ "@box/storybook-utils": "^0.7.0",
20
20
  "@testing-library/react": "^15.0.6",
21
21
  "react": "^18.3.0",
22
22
  "react-dom": "^18.3.0",
@@ -53,5 +53,5 @@
53
53
  "**/*.css"
54
54
  ],
55
55
  "license": "SEE LICENSE IN LICENSE",
56
- "gitHead": "35b9456f5e326f5f66d7cb19ba4bb773bffc2cb8"
56
+ "gitHead": "ef6dc665705b4829db20173c2d8d13a8376a617f"
57
57
  }
@@ -0,0 +1 @@
1
+ ._header_d9pl2_1{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@@ -1 +1 @@
1
- ._metadataInstanceFormHeader_rdx5o_1{display:flex;justify-content:space-between;align-items:center;padding-block-end:var(--space-4);border-block-end:solid var(--gray-10) var(--border-1);gap:var(--space-2)}._metadataInstanceFormHeader_rdx5o_1 ._title_rdx5o_9{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
1
+ ._metadataInstanceFormHeader_13lxr_1{display:flex;justify-content:space-between;align-items:center;padding-block-end:var(--space-4);border-block-end:solid var(--gray-10) var(--border-1);gap:var(--space-2)}._metadataInstanceFormHeader_13lxr_1 ._title_13lxr_9{width:100%}
@@ -1 +1 @@
1
- ._metadataInstanceHeader_jo0x0_1{display:flex;justify-content:space-between;height:var(--size-10)}._metadataInstanceHeader_jo0x0_1 ._iconButtonsContainer_jo0x0_6{display:flex;gap:var(--space-1);justify-content:flex-end;align-self:center;margin-block:0 var(--space-2);padding-left:var(--space-2)}._metadataInstanceHeader_jo0x0_1 ._title_jo0x0_14{margin-block:var(--space-1) var(--space-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
1
+ ._metadataInstanceHeader_54pdx_1{display:flex;justify-content:space-between;height:var(--size-10)}._metadataInstanceHeader_54pdx_1 ._iconButtonsContainer_54pdx_6{display:flex;gap:var(--space-1);justify-content:flex-end;align-self:center;margin-block:0 var(--space-2);padding-left:var(--space-2)}._metadataInstanceHeader_54pdx_1 ._title_54pdx_14{margin-block:var(--space-1) var(--space-3)}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export interface InteractiveHeaderTextProps {
3
+ title: string;
4
+ className?: string;
5
+ }
6
+ declare const InteractiveHeaderText: React.FC<InteractiveHeaderTextProps>;
7
+ export default InteractiveHeaderText;