@box/metadata-editor 0.66.0 → 0.66.2

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,26 +1,26 @@
1
- import { Select as l, SELECT_EMPTY_VALUE as o } from "@box/blueprint-web";
1
+ import { Select as l, SELECT_EMPTY_VALUE as r } from "@box/blueprint-web";
2
2
  import { useFormikContext as M, getIn as V, Field as C } from "formik";
3
- import { useIntl as L, FormattedMessage as $ } from "react-intl";
4
- import { forwardRef as b } from "react";
5
- import c from "../../../../messages.js";
6
- import { getFieldLabel as j } from "../../utils.js";
7
- import { jsx as t, jsxs as I } from "react/jsx-runtime";
8
- const U = /* @__PURE__ */ b(({
9
- className: u,
10
- description: i,
11
- disableForm: f,
3
+ import { forwardRef as L } from "react";
4
+ import { useIntl as P, FormattedMessage as $ } from "react-intl";
5
+ import d from "../../../../messages.js";
6
+ import { getFieldLabel as b } from "../../utils.js";
7
+ import { jsx as t, jsxs as j } from "react/jsx-runtime";
8
+ const O = /* @__PURE__ */ L(({
9
+ className: i,
10
+ description: u,
11
+ disableForm: p,
12
12
  fieldNamePrefix: s,
13
13
  label: n,
14
- options: h,
15
- portalElement: p,
14
+ options: f,
15
+ portalElement: h,
16
16
  updateModePrefix: v
17
17
  }, g) => {
18
18
  const {
19
- setFieldValue: F,
20
- values: x
21
- } = M(), E = L(), m = `${v ?? s}.value`, r = h || V(x, `${s}.options`, []).map(({
19
+ setFieldValue: E,
20
+ values: F
21
+ } = M(), x = P(), m = `${v ?? s}.value`, o = f || V(F, `${s}.options`, []).map(({
22
22
  key: a
23
- }) => a), d = E.formatMessage(c.selectValuePlaceholder);
23
+ }) => a), c = x.formatMessage(d.selectValuePlaceholder);
24
24
  return /* @__PURE__ */ t("div", {
25
25
  "data-testid": `${n}-field`,
26
26
  children: /* @__PURE__ */ t(C, {
@@ -29,24 +29,25 @@ const U = /* @__PURE__ */ b(({
29
29
  field: a
30
30
  }) => /* @__PURE__ */ t(l, {
31
31
  ref: g,
32
- className: u,
33
- disabled: f,
34
- label: j(n, i),
32
+ className: i,
33
+ disabled: p,
34
+ label: b(n, u),
35
35
  onValueChange: (e) => {
36
- F(m, e === o ? "" : e);
36
+ E(m, e === r ? "" : e);
37
37
  },
38
- placeholder: d,
38
+ placeholder: c,
39
39
  ...a,
40
- value: a.value === o ? "" : a.value,
41
- children: /* @__PURE__ */ I(l.Content, {
42
- container: p,
40
+ value: a.value === r ? "" : a.value,
41
+ children: /* @__PURE__ */ j(l.Content, {
42
+ container: h,
43
+ onEscapeKeyDown: (e) => e.stopPropagation(),
43
44
  children: [/* @__PURE__ */ t(l.Option, {
44
- text: d,
45
- value: o,
45
+ text: c,
46
+ value: r,
46
47
  children: /* @__PURE__ */ t($, {
47
- ...c.selectValuePlaceholder
48
+ ...d.selectValuePlaceholder
48
49
  })
49
- }), r == null ? void 0 : r.map((e) => /* @__PURE__ */ t(l.Option, {
50
+ }), o == null ? void 0 : o.map((e) => /* @__PURE__ */ t(l.Option, {
50
51
  text: e,
51
52
  value: e,
52
53
  children: e
@@ -57,6 +58,6 @@ const U = /* @__PURE__ */ b(({
57
58
  });
58
59
  });
59
60
  export {
60
- U as MetadataEnumField,
61
- U as default
61
+ O as MetadataEnumField,
62
+ O as default
62
63
  };
@@ -1,14 +1,15 @@
1
1
  import "../../../../../../styles/metadata-instance-form-header.css";
2
- import { Text as x, Tooltip as M, Button as _ } from "@box/blueprint-web";
3
- import { BoxAiLogo as H } from "@box/blueprint-web-assets/icons/Logo";
4
- import { useFormikContext as k, getIn as m } from "formik";
5
- import { useIntl as v } from "react-intl";
2
+ import { Tooltip as _, Button as b } from "@box/blueprint-web";
3
+ import { BoxAiLogo as M } from "@box/blueprint-web-assets/icons/Logo";
4
+ import { useFormikContext as T, getIn as m } from "formik";
5
+ import { useIntl as h } from "react-intl";
6
+ import k from "../../../truncated-header-text/truncated-header-text.js";
6
7
  import e from "./messages.js";
7
8
  import { jsxs as A, jsx as n } from "react/jsx-runtime";
8
- const T = "_metadataInstanceFormHeader_1b2cc_1", S = "_title_1b2cc_8", c = {
9
- metadataInstanceFormHeader: T,
9
+ const v = "_metadataInstanceFormHeader_13lxr_1", S = "_title_13lxr_9", c = {
10
+ metadataInstanceFormHeader: v,
10
11
  title: S
11
- }, V = ({
12
+ }, q = ({
12
13
  areAiSuggestionsAvailable: d,
13
14
  isAiSuggestionsFeatureEnabled: u,
14
15
  isLoading: s,
@@ -18,32 +19,30 @@ const T = "_metadataInstanceFormHeader_1b2cc_1", S = "_title_1b2cc_8", c = {
18
19
  const {
19
20
  isSubmitting: p,
20
21
  values: i,
21
- setFieldValue: B
22
- } = k(), t = v(), I = async () => {
22
+ setFieldValue: x
23
+ } = T(), t = h(), B = async () => {
23
24
  const r = m(i, "metadata.fields"), F = m(i, "metadata.templateKey"), a = await g(F, r);
24
- B("metadata.fields", r.map((o) => {
25
- const l = a == null ? void 0 : a.find((h) => h.key === o.key);
25
+ x("metadata.fields", r.map((o) => {
26
+ const l = a == null ? void 0 : a.find((H) => H.key === o.key);
26
27
  return l ? {
27
28
  ...o,
28
29
  aiSuggestion: l.aiSuggestion
29
30
  } : o;
30
31
  }));
31
- }, b = f ?? t.formatMessage(e.customInstanceTitle), y = !d || p || s;
32
+ }, I = f ?? t.formatMessage(e.customInstanceTitle), y = !d || p || s;
32
33
  return /* @__PURE__ */ A("div", {
33
34
  className: c.metadataInstanceFormHeader,
34
- children: [/* @__PURE__ */ n(x, {
35
- as: "h1",
35
+ children: [/* @__PURE__ */ n(k, {
36
36
  className: c.title,
37
- variant: "titleMedium",
38
- children: b
39
- }), u && /* @__PURE__ */ n(M, {
37
+ title: I
38
+ }), u && /* @__PURE__ */ n(_, {
40
39
  content: t.formatMessage(e.autofillButtonTooltip),
41
- children: /* @__PURE__ */ n(_, {
40
+ children: /* @__PURE__ */ n(b, {
42
41
  disabled: y,
43
- icon: H,
42
+ icon: M,
44
43
  loading: s,
45
44
  loadingAriaLabel: t.formatMessage(e.loadingButtonAriaLabel),
46
- onClick: I,
45
+ onClick: B,
47
46
  variant: "secondary",
48
47
  "data-target-id": "Button-autofillButton",
49
48
  children: t.formatMessage(e.autofillButton)
@@ -52,5 +51,5 @@ const T = "_metadataInstanceFormHeader_1b2cc_1", S = "_title_1b2cc_8", c = {
52
51
  });
53
52
  };
54
53
  export {
55
- V as MetadataInstanceFormHeader
54
+ q as MetadataInstanceFormHeader
56
55
  };
@@ -1,54 +1,53 @@
1
1
  import "../../../../../../styles/metadata-instance-header.css";
2
- import { Text as b, Tooltip as i, IconButton as s } from "@box/blueprint-web";
3
- import { Pencil as g } from "@box/blueprint-web-assets/icons/Line";
4
- import { BoxAiLogo as I } from "@box/blueprint-web-assets/icons/Logo";
5
- import { useIntl as _ } 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 g } from "@box/blueprint-web-assets/icons/Logo";
5
+ import { useIntl as I } from "react-intl";
6
+ import _ from "../../../truncated-header-text/truncated-header-text.js";
6
7
  import n from "./messages.js";
7
- import { jsxs as r, jsx as a } from "react/jsx-runtime";
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 = ({
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 = ({
13
14
  areAiSuggestionsAvailable: c,
14
15
  canEdit: l,
15
16
  isAiSuggestionsFeatureEnabled: d,
16
- onEdit: u,
17
- onAutofill: m,
17
+ onEdit: m,
18
+ onAutofill: u,
18
19
  templateName: t
19
20
  }) => {
20
- const o = _(), B = t || o.formatMessage(n.customInstanceTitle), f = d && t;
21
- return /* @__PURE__ */ r("div", {
21
+ const o = I(), f = t || o.formatMessage(n.customInstanceTitle), B = d && t;
22
+ return /* @__PURE__ */ s("div", {
22
23
  className: e.metadataInstanceHeader,
23
- children: [/* @__PURE__ */ a(b, {
24
- as: "h1",
24
+ children: [/* @__PURE__ */ a(_, {
25
25
  className: e.title,
26
- variant: "titleMedium",
27
- children: B
28
- }), l && /* @__PURE__ */ r("div", {
26
+ title: f
27
+ }), l && /* @__PURE__ */ s("div", {
29
28
  className: e.iconButtonsContainer,
30
- children: [f && /* @__PURE__ */ a(i, {
29
+ children: [B && /* @__PURE__ */ a(i, {
31
30
  content: o.formatMessage(n.autofillButtonTooltip, {
32
31
  templateName: t
33
32
  }),
34
- children: /* @__PURE__ */ a(s, {
33
+ children: /* @__PURE__ */ a(r, {
35
34
  "aria-label": o.formatMessage(n.autofillButtonAriaLabel, {
36
35
  templateName: t
37
36
  }),
38
37
  disabled: !c,
39
- icon: I,
40
- onClick: m,
38
+ icon: g,
39
+ onClick: u,
41
40
  variant: "icon-logo",
42
41
  "data-target-id": "IconButton-autofillButtonAriaLabel"
43
42
  })
44
43
  }), /* @__PURE__ */ a(i, {
45
44
  content: o.formatMessage(n.editButtonTooltip),
46
- children: /* @__PURE__ */ a(s, {
45
+ children: /* @__PURE__ */ a(r, {
47
46
  "aria-label": o.formatMessage(n.editButtonAriaLabel, {
48
47
  templateName: t
49
48
  }),
50
- icon: g,
51
- onClick: u,
49
+ icon: p,
50
+ onClick: m,
52
51
  "data-target-id": "IconButton-editButtonAriaLabel"
53
52
  })
54
53
  })]
@@ -56,5 +55,5 @@ const h = "_metadataInstanceHeader_1vbbg_1", p = "_iconButtonsContainer_1vbbg_7"
56
55
  });
57
56
  };
58
57
  export {
59
- j as MetadataInstanceHeader
58
+ k as MetadataInstanceHeader
60
59
  };
@@ -0,0 +1,38 @@
1
+ import "../../../../styles/truncated-header-text.css";
2
+ import { Focusable as l } from "@ariakit/react";
3
+ import { Text as m } from "@box/blueprint-web";
4
+ import { useFullTextTooltip as p } from "@box/blueprint-web/src/lib/utils/useFullTextTooltip";
5
+ import i from "clsx";
6
+ import { useRef as n } from "react";
7
+ import { jsx as e, Fragment as d } from "react/jsx-runtime";
8
+ const c = "_header_d9pl2_1", f = {
9
+ header: c
10
+ }, b = ({
11
+ className: o,
12
+ title: r
13
+ }) => {
14
+ const t = n(null), {
15
+ Wrapper: a,
16
+ wrapperProps: s
17
+ } = p({
18
+ ref: t,
19
+ textValue: r
20
+ });
21
+ return /* @__PURE__ */ e(d, {
22
+ children: /* @__PURE__ */ e(a, {
23
+ ...s,
24
+ children: /* @__PURE__ */ e(l, {
25
+ render: /* @__PURE__ */ e(m, {
26
+ ref: t,
27
+ as: "h1",
28
+ className: i(f.header, o),
29
+ variant: "titleMedium",
30
+ children: r
31
+ })
32
+ })
33
+ })
34
+ });
35
+ };
36
+ export {
37
+ b as default
38
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-editor",
3
- "version": "0.66.0",
3
+ "version": "0.66.2",
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": "fec5f60d64cecfdab83b9ec202aa14114171031f"
56
+ "gitHead": "68206eae5c0d7a75eebc0c49c911b1cd0b77c419"
57
57
  }
@@ -1 +1 @@
1
- ._metadataInstanceFormHeader_1b2cc_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)}._metadataInstanceFormHeader_1b2cc_1 ._title_1b2cc_8{width:100%}
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_1vbbg_1{display:flex;justify-content:flex-end;height:var(--size-10);width:100%}._metadataInstanceHeader_1vbbg_1 ._iconButtonsContainer_1vbbg_7{display:flex;gap:var(--space-1);justify-content:flex-end;align-self:center;margin-block:0 var(--space-2);width:100%}._metadataInstanceHeader_1vbbg_1 ._title_1vbbg_15{align-self:center;margin-block:var(--space-1) var(--space-3);width:100%}
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 @@
1
+ ._header_d9pl2_1{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export interface TruncatedHeaderTextProps {
3
+ title: string;
4
+ className?: string;
5
+ }
6
+ declare const TruncatedHeaderText: React.FC<TruncatedHeaderTextProps>;
7
+ export default TruncatedHeaderText;