@box/metadata-editor 0.66.2 → 0.67.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.
Files changed (22) hide show
  1. package/chunks/metadata-editor-field-wrapper.js +65 -60
  2. package/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +70 -69
  3. package/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js +26 -26
  4. package/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +42 -41
  5. package/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +24 -23
  6. package/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +37 -36
  7. package/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +27 -24
  8. package/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +26 -24
  9. package/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +25 -23
  10. package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js +62 -43
  11. package/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js +61 -42
  12. package/package.json +3 -3
  13. package/styles/ai-suggestion-field.css +1 -1
  14. package/styles/metadata-editor-field-wrapper.css +1 -1
  15. package/styles/metadata-instance-form-header.css +1 -1
  16. package/styles/metadata-instance-header.css +1 -1
  17. package/types/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.d.ts +1 -0
  18. package/types/lib/components/combobox-with-api-pagination/types.d.ts +2 -1
  19. package/types/lib/components/metadata-editor-fields/types.d.ts +1 -0
  20. package/esm/lib/components/truncated-header-text/truncated-header-text.js +0 -38
  21. package/styles/truncated-header-text.css +0 -1
  22. package/types/lib/components/truncated-header-text/truncated-header-text.d.ts +0 -7
@@ -1,50 +1,51 @@
1
1
  import { Select as l, SELECT_EMPTY_VALUE as r } from "@box/blueprint-web";
2
- import { useFormikContext as M, getIn as V, Field as C } from "formik";
3
- import { forwardRef as L } from "react";
4
- import { useIntl as P, FormattedMessage as $ } from "react-intl";
2
+ import { useFormikContext as V, getIn as C, Field as L } from "formik";
3
+ import { forwardRef as P } from "react";
4
+ import { useIntl as $, FormattedMessage as b } from "react-intl";
5
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(({
6
+ import { getFieldLabel as j } from "../../utils.js";
7
+ import { jsx as t, jsxs as w } from "react/jsx-runtime";
8
+ const R = /* @__PURE__ */ P(({
9
9
  className: i,
10
10
  description: u,
11
11
  disableForm: p,
12
12
  fieldNamePrefix: s,
13
+ updateModePrefix: f,
13
14
  label: n,
14
- options: f,
15
- portalElement: h,
16
- updateModePrefix: v
17
- }, g) => {
15
+ onValueEdited: h,
16
+ options: v,
17
+ portalElement: g
18
+ }, E) => {
18
19
  const {
19
- setFieldValue: E,
20
- values: F
21
- } = M(), x = P(), m = `${v ?? s}.value`, o = f || V(F, `${s}.options`, []).map(({
20
+ setFieldValue: F,
21
+ values: x
22
+ } = V(), M = $(), m = `${f ?? s}.value`, o = v || C(x, `${s}.options`, []).map(({
22
23
  key: a
23
- }) => a), c = x.formatMessage(d.selectValuePlaceholder);
24
+ }) => a), c = M.formatMessage(d.selectValuePlaceholder);
24
25
  return /* @__PURE__ */ t("div", {
25
26
  "data-testid": `${n}-field`,
26
- children: /* @__PURE__ */ t(C, {
27
+ children: /* @__PURE__ */ t(L, {
27
28
  name: m,
28
29
  children: ({
29
30
  field: a
30
31
  }) => /* @__PURE__ */ t(l, {
31
- ref: g,
32
+ ref: E,
32
33
  className: i,
33
34
  disabled: p,
34
- label: b(n, u),
35
+ label: j(n, u),
35
36
  onValueChange: (e) => {
36
- E(m, e === r ? "" : e);
37
+ F(m, e === r ? "" : e), h();
37
38
  },
38
39
  placeholder: c,
39
40
  ...a,
40
41
  value: a.value === r ? "" : a.value,
41
- children: /* @__PURE__ */ j(l.Content, {
42
- container: h,
42
+ children: /* @__PURE__ */ w(l.Content, {
43
+ container: g,
43
44
  onEscapeKeyDown: (e) => e.stopPropagation(),
44
45
  children: [/* @__PURE__ */ t(l.Option, {
45
46
  text: c,
46
47
  value: r,
47
- children: /* @__PURE__ */ t($, {
48
+ children: /* @__PURE__ */ t(b, {
48
49
  ...d.selectValuePlaceholder
49
50
  })
50
51
  }), o == null ? void 0 : o.map((e) => /* @__PURE__ */ t(l.Option, {
@@ -58,6 +59,6 @@ const O = /* @__PURE__ */ L(({
58
59
  });
59
60
  });
60
61
  export {
61
- O as MetadataEnumField,
62
- O as default
62
+ R as MetadataEnumField,
63
+ R as default
63
64
  };
@@ -1,54 +1,55 @@
1
- import { TextInput as b } from "@box/blueprint-web";
2
- import { useFormikContext as C, getIn as R, Field as T } from "formik";
3
- import { forwardRef as V, useRef as $ } from "react";
4
- import { fieldDefaultProps as B } from "../constants.js";
5
- import { useFloatValidation as I } from "./use-float-validation.js";
6
- import { getFieldLabel as O } from "../../utils.js";
1
+ import { TextInput as R } from "@box/blueprint-web";
2
+ import { useFormikContext as T, getIn as V, Field as $ } from "formik";
3
+ import { forwardRef as b, useRef as B } from "react";
4
+ import { getFieldLabel as I } from "../../utils.js";
5
+ import { fieldDefaultProps as M } from "../constants.js";
6
+ import { useFloatValidation as O } from "./use-float-validation.js";
7
7
  import { jsx as r } from "react/jsx-runtime";
8
- const N = /* @__PURE__ */ V(({
8
+ const q = /* @__PURE__ */ b(({
9
9
  className: l,
10
- description: n,
10
+ description: i,
11
11
  label: o,
12
- fieldNamePrefix: i,
13
- disableForm: d,
14
- updateModePrefix: s
15
- }, u) => {
12
+ fieldNamePrefix: d,
13
+ disableForm: n,
14
+ onValueEdited: s,
15
+ updateModePrefix: u
16
+ }, f) => {
16
17
  const {
17
- values: f,
18
- setFieldValue: m,
19
- setFieldTouched: c
20
- } = C(), t = `${s ?? i}.value`, p = R(f, t), a = $(p), {
21
- validateFloats: F
22
- } = I(), h = (e) => {
23
- a.current = e, m(t, e);
24
- }, v = (e) => {
25
- c(e, !0);
18
+ values: m,
19
+ setFieldValue: c,
20
+ setFieldTouched: p
21
+ } = T(), t = `${u ?? d}.value`, F = V(m, t), a = B(F), {
22
+ validateFloats: h
23
+ } = O(), v = (e) => {
24
+ a.current = e, c(t, e), s();
25
+ }, g = (e) => {
26
+ p(e, !0);
26
27
  };
27
28
  return /* @__PURE__ */ r("div", {
28
29
  "data-testid": `${o}-field`,
29
- children: /* @__PURE__ */ r(T, {
30
+ children: /* @__PURE__ */ r($, {
30
31
  name: `${t}`,
31
- validate: () => F(a.current),
32
+ validate: () => h(a.current),
32
33
  children: ({
33
34
  field: e,
34
- meta: g
35
- }) => /* @__PURE__ */ r(b, {
36
- ...B,
35
+ meta: x
36
+ }) => /* @__PURE__ */ r(R, {
37
+ ...M,
37
38
  ...e,
38
- ref: u,
39
+ ref: f,
39
40
  className: l,
40
- disabled: d,
41
- error: g.error,
42
- label: O(o, n),
43
- onBlur: () => v(t),
44
- onChange: (x) => h(x.currentTarget.value),
45
- placeholder: "0",
46
- type: "number"
41
+ disabled: n,
42
+ error: x.error,
43
+ inputMode: "decimal",
44
+ label: I(o, i),
45
+ onBlur: () => g(t),
46
+ onChange: (C) => v(C.currentTarget.value),
47
+ placeholder: "0"
47
48
  })
48
49
  })
49
50
  });
50
51
  });
51
52
  export {
52
- N as MetadataFloatField,
53
- N as default
53
+ q as MetadataFloatField,
54
+ q as default
54
55
  };
@@ -1,49 +1,52 @@
1
- import { Combobox as C } from "@box/blueprint-web";
2
- import { useFormikContext as b, getIn as w, Field as x } from "formik";
3
- import { useIntl as L } from "react-intl";
1
+ import { Combobox as b } from "@box/blueprint-web";
2
+ import { useFormikContext as w, getIn as x, Field as L } from "formik";
4
3
  import { forwardRef as M } from "react";
5
- import $ from "../../../../messages.js";
6
- import { fieldDefaultProps as I } from "../constants.js";
4
+ import { useIntl as $ } from "react-intl";
5
+ import I from "../../../../messages.js";
7
6
  import { getFieldLabel as V } from "../../utils.js";
7
+ import { fieldDefaultProps as j } from "../constants.js";
8
8
  import { jsx as o } from "react/jsx-runtime";
9
- const y = /* @__PURE__ */ M(({
9
+ const z = /* @__PURE__ */ M(({
10
10
  className: i,
11
11
  description: s,
12
12
  disableForm: n,
13
13
  fieldNamePrefix: r,
14
14
  label: l,
15
- portalElement: m,
15
+ onValueEdited: m,
16
16
  options: u,
17
- updateModePrefix: d
18
- }, p) => {
17
+ portalElement: d,
18
+ updateModePrefix: p
19
+ }, f) => {
19
20
  const {
20
- setFieldValue: f,
21
- values: c
22
- } = b(), F = L(), a = `${d ?? r}.value`, g = u || w(c, `${r}.options`, []).map(({
21
+ setFieldValue: c,
22
+ values: F
23
+ } = w(), g = $(), a = `${p ?? r}.value`, h = u || x(F, `${r}.options`, []).map(({
23
24
  key: e
24
- }) => e), h = (e, t) => t.toLowerCase().includes(e.toLowerCase());
25
+ }) => e), v = (e, t) => t.toLowerCase().includes(e.toLowerCase());
25
26
  return /* @__PURE__ */ o("div", {
26
27
  "data-testid": `${l}-field`,
27
- children: /* @__PURE__ */ o(x, {
28
+ children: /* @__PURE__ */ o(L, {
28
29
  name: a,
29
30
  children: ({
30
31
  field: e
31
32
  }) => {
32
33
  var t;
33
- return /* @__PURE__ */ o(C, {
34
- ...I,
35
- ref: p,
34
+ return /* @__PURE__ */ o(b, {
35
+ ...j,
36
+ ref: f,
36
37
  as: "input",
37
38
  className: i,
38
39
  disabled: n,
39
- filterFn: h,
40
+ filterFn: v,
40
41
  label: V(l, s),
41
42
  multiselect: !0,
42
43
  name: e.name,
43
- onValueChange: (v) => f(a, v),
44
- options: g,
45
- placeholder: ((t = e.value) == null ? void 0 : t.length) === 0 ? F.formatMessage($.multiselectPlaceholder) : "",
46
- portalElement: m,
44
+ onValueChange: (C) => {
45
+ c(a, C), m();
46
+ },
47
+ options: h,
48
+ placeholder: ((t = e.value) == null ? void 0 : t.length) === 0 ? g.formatMessage(I.multiselectPlaceholder) : "",
49
+ portalElement: d,
47
50
  value: e.value
48
51
  });
49
52
  }
@@ -51,6 +54,6 @@ const y = /* @__PURE__ */ M(({
51
54
  });
52
55
  });
53
56
  export {
54
- y as MetadataMultiSelectField,
55
- y as default
57
+ z as MetadataMultiSelectField,
58
+ z as default
56
59
  };
@@ -1,42 +1,44 @@
1
- import { TextInput as n } from "@box/blueprint-web";
1
+ import { TextInput as u } from "@box/blueprint-web";
2
2
  import { Field as c } from "formik";
3
- import { useIntl as u } from "react-intl";
4
3
  import { forwardRef as g } from "react";
5
- import h from "../../../../messages.js";
6
- import { fieldDefaultProps as F } from "../constants.js";
4
+ import { useIntl as h } from "react-intl";
5
+ import F from "../../../../messages.js";
7
6
  import { getFieldLabel as x } from "../../utils.js";
7
+ import { fieldDefaultProps as M } from "../constants.js";
8
8
  import { jsx as e } from "react/jsx-runtime";
9
- const M = /* @__PURE__ */ g(({
10
- description: t,
11
- label: r,
12
- fieldNamePrefix: o,
9
+ const b = /* @__PURE__ */ g(({
10
+ className: t,
11
+ description: o,
13
12
  disableForm: a,
14
- className: i,
15
- updateModePrefix: l
16
- }, d) => {
17
- const m = u(), f = `${l ?? o}.value`;
13
+ fieldNamePrefix: i,
14
+ label: r,
15
+ onValueEdited: l,
16
+ updateModePrefix: d
17
+ }, m) => {
18
+ const f = h(), s = `${d ?? i}.value`;
18
19
  return /* @__PURE__ */ e("div", {
19
20
  "data-testid": `${r}-field`,
20
21
  children: /* @__PURE__ */ e(c, {
21
- name: f,
22
+ name: s,
22
23
  children: ({
23
- field: s,
24
+ field: n,
24
25
  meta: p
25
- }) => /* @__PURE__ */ e(n, {
26
- ...F,
27
- ...s,
28
- ref: d,
29
- className: i,
26
+ }) => /* @__PURE__ */ e(u, {
27
+ ...M,
28
+ ...n,
29
+ ref: m,
30
+ className: t,
30
31
  disabled: a,
31
32
  error: p.error,
32
- label: x(r, t),
33
- placeholder: m.formatMessage(h.setValuePlaceholder)
33
+ label: x(r, o),
34
+ onChangeCapture: l,
35
+ placeholder: f.formatMessage(F.setValuePlaceholder)
34
36
  })
35
37
  })
36
38
  });
37
39
  });
38
- M.displayName = "MetadataStringField";
40
+ b.displayName = "MetadataStringField";
39
41
  export {
40
- M as MetadataStringField,
41
- M as default
42
+ b as MetadataStringField,
43
+ b as default
42
44
  };
@@ -1,48 +1,50 @@
1
- import { forwardRef as k } from "react";
2
1
  import { useFormikContext as C, getIn as I, Field as M } from "formik";
3
- import { useIntl as R } from "react-intl";
4
- import { ComboboxWithApiPagination as V } from "../../../combobox-with-api-pagination/combobox-with-api-pagination.js";
2
+ import { forwardRef as R } from "react";
3
+ import { useIntl as V } from "react-intl";
5
4
  import $ from "../../../../messages.js";
6
- import { getFieldLabel as j } from "../../utils.js";
5
+ import { ComboboxWithApiPagination as j } from "../../../combobox-with-api-pagination/combobox-with-api-pagination.js";
6
+ import { getFieldLabel as w } from "../../utils.js";
7
7
  import { jsx as o } from "react/jsx-runtime";
8
- const q = /* @__PURE__ */ k(({
8
+ const z = /* @__PURE__ */ R(({
9
9
  description: m,
10
10
  disableForm: n,
11
11
  fieldNamePrefix: r,
12
12
  label: a,
13
13
  portalElement: s,
14
14
  taxonomyOptionsFetcher: d,
15
- updateModePrefix: c
16
- }, u) => {
17
- const f = R(), i = `${c ?? r}.value`, {
18
- setFieldValue: p,
15
+ updateModePrefix: c,
16
+ className: u
17
+ }, f) => {
18
+ const p = V(), i = `${c ?? r}.value`, {
19
+ setFieldValue: h,
19
20
  values: l
20
21
  } = C(), {
21
22
  metadata: {
22
- templateKey: h,
23
- scope: F
23
+ templateKey: F,
24
+ scope: g
24
25
  }
25
- } = l, g = I(l, r), {
26
- key: x,
26
+ } = l, x = I(l, r), {
27
+ key: v,
27
28
  optionsRules: {
28
- multiSelect: v,
29
+ multiSelect: y,
29
30
  selectableLevels: e
30
31
  }
31
- } = g, y = (t) => d(F, h, x, e == null ? void 0 : e[0], t);
32
+ } = x, b = (t) => d(g, F, v, e == null ? void 0 : e[0], t);
32
33
  return /* @__PURE__ */ o("div", {
33
34
  "data-testid": `${a}-field`,
34
35
  children: /* @__PURE__ */ o(M, {
35
36
  name: i,
36
37
  children: ({
37
38
  field: t
38
- }) => /* @__PURE__ */ o(V, {
39
- ref: u,
40
- defaultFetcher: y,
39
+ }) => /* @__PURE__ */ o(j, {
40
+ ref: f,
41
+ className: u,
42
+ defaultFetcher: b,
41
43
  disabled: n,
42
- label: j(a, m),
43
- multiselect: v,
44
- onValueChange: (b) => p(i, b),
45
- placeholder: f.formatMessage($.taxonomyPlaceholder),
44
+ label: w(a, m),
45
+ multiselect: y,
46
+ onValueChange: (k) => h(i, k),
47
+ placeholder: p.formatMessage($.taxonomyPlaceholder),
46
48
  portalElement: s,
47
49
  value: t.value
48
50
  })
@@ -50,5 +52,5 @@ const q = /* @__PURE__ */ k(({
50
52
  });
51
53
  });
52
54
  export {
53
- q as MetadataTaxonomyField
55
+ z as MetadataTaxonomyField
54
56
  };
@@ -1,55 +1,74 @@
1
1
  import "../../../../../../styles/metadata-instance-form-header.css";
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";
7
- import e from "./messages.js";
8
- import { jsxs as A, jsx as n } from "react/jsx-runtime";
9
- const v = "_metadataInstanceFormHeader_13lxr_1", S = "_title_13lxr_9", c = {
10
- metadataInstanceFormHeader: v,
11
- title: S
12
- }, q = ({
13
- areAiSuggestionsAvailable: d,
14
- isAiSuggestionsFeatureEnabled: u,
15
- isLoading: s,
16
- templateName: f,
17
- onAutofill: g
2
+ import { Focusable as k } from "@ariakit/react";
3
+ import { Text as v, Tooltip as f, Button as A } from "@box/blueprint-web";
4
+ import { BoxAiLogo as S } from "@box/blueprint-web-assets/icons/Logo";
5
+ import { useFormikContext as j, getIn as g } from "formik";
6
+ import { useState as C, useRef as E, useEffect as K } from "react";
7
+ import { useIntl as L } from "react-intl";
8
+ import o from "./messages.js";
9
+ import { jsx as t, jsxs as N } from "react/jsx-runtime";
10
+ const R = "_metadataInstanceFormHeader_rdx5o_1", W = "_title_rdx5o_9", p = {
11
+ metadataInstanceFormHeader: R,
12
+ title: W
13
+ }, Q = ({
14
+ areAiSuggestionsAvailable: h,
15
+ isAiSuggestionsFeatureEnabled: I,
16
+ isLoading: c,
17
+ templateName: x,
18
+ onAutofill: B
18
19
  }) => {
19
20
  const {
20
- isSubmitting: p,
21
- values: i,
22
- setFieldValue: x
23
- } = T(), t = h(), B = async () => {
24
- const r = m(i, "metadata.fields"), F = m(i, "metadata.templateKey"), a = await g(F, r);
25
- x("metadata.fields", r.map((o) => {
26
- const l = a == null ? void 0 : a.find((H) => H.key === o.key);
27
- return l ? {
28
- ...o,
29
- aiSuggestion: l.aiSuggestion
30
- } : o;
21
+ isSubmitting: F,
22
+ values: m,
23
+ setFieldValue: T
24
+ } = j(), e = L(), [y, b] = C(!1), n = E(null), M = async () => {
25
+ const a = g(m, "metadata.fields"), i = g(m, "metadata.templateKey"), r = await B(i, a);
26
+ T("metadata.fields", a.map((l) => {
27
+ const u = r == null ? void 0 : r.find((H) => H.key === l.key);
28
+ return u ? {
29
+ ...l,
30
+ aiSuggestion: u.aiSuggestion
31
+ } : l;
31
32
  }));
32
- }, I = f ?? t.formatMessage(e.customInstanceTitle), y = !d || p || s;
33
- return /* @__PURE__ */ A("div", {
34
- className: c.metadataInstanceFormHeader,
35
- children: [/* @__PURE__ */ n(k, {
36
- className: c.title,
37
- title: I
38
- }), u && /* @__PURE__ */ n(_, {
39
- content: t.formatMessage(e.autofillButtonTooltip),
40
- children: /* @__PURE__ */ n(b, {
41
- disabled: y,
42
- icon: M,
43
- loading: s,
44
- loadingAriaLabel: t.formatMessage(e.loadingButtonAriaLabel),
45
- onClick: B,
33
+ }, s = x ?? e.formatMessage(o.customInstanceTitle);
34
+ K(() => {
35
+ if (n.current) {
36
+ const {
37
+ scrollWidth: a,
38
+ clientWidth: i
39
+ } = n.current;
40
+ b(a > i);
41
+ }
42
+ }, [s]);
43
+ const d = /* @__PURE__ */ t(v, {
44
+ ref: n,
45
+ as: "h1",
46
+ className: p.title,
47
+ variant: "titleMedium",
48
+ children: s
49
+ }), _ = !h || F || c;
50
+ return /* @__PURE__ */ N("div", {
51
+ className: p.metadataInstanceFormHeader,
52
+ children: [y ? /* @__PURE__ */ t(f, {
53
+ content: s,
54
+ children: /* @__PURE__ */ t(k, {
55
+ render: d
56
+ })
57
+ }) : d, I && /* @__PURE__ */ t(f, {
58
+ content: e.formatMessage(o.autofillButtonTooltip),
59
+ children: /* @__PURE__ */ t(A, {
60
+ disabled: _,
61
+ icon: S,
62
+ loading: c,
63
+ loadingAriaLabel: e.formatMessage(o.loadingButtonAriaLabel),
64
+ onClick: M,
46
65
  variant: "secondary",
47
66
  "data-target-id": "Button-autofillButton",
48
- children: t.formatMessage(e.autofillButton)
67
+ children: e.formatMessage(o.autofillButton)
49
68
  })
50
69
  })]
51
70
  });
52
71
  };
53
72
  export {
54
- q as MetadataInstanceFormHeader
73
+ Q as MetadataInstanceFormHeader
55
74
  };
@@ -1,53 +1,72 @@
1
1
  import "../../../../../../styles/metadata-instance-header.css";
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";
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";
7
8
  import n from "./messages.js";
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
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
20
21
  }) => {
21
- const o = I(), 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
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
32
51
  }),
33
- children: /* @__PURE__ */ a(r, {
34
- "aria-label": o.formatMessage(n.autofillButtonAriaLabel, {
35
- templateName: t
52
+ children: /* @__PURE__ */ t(l, {
53
+ "aria-label": e.formatMessage(n.autofillButtonAriaLabel, {
54
+ templateName: o
36
55
  }),
37
- disabled: !c,
38
- icon: g,
39
- onClick: u,
56
+ disabled: !u,
57
+ icon: A,
58
+ onClick: I,
40
59
  variant: "icon-logo",
41
60
  "data-target-id": "IconButton-autofillButtonAriaLabel"
42
61
  })
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
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
48
67
  }),
49
- icon: p,
50
- onClick: m,
68
+ icon: M,
69
+ onClick: B,
51
70
  "data-target-id": "IconButton-editButtonAriaLabel"
52
71
  })
53
72
  })]
@@ -55,5 +74,5 @@ const x = "_metadataInstanceHeader_54pdx_1", b = "_iconButtonsContainer_54pdx_6"
55
74
  });
56
75
  };
57
76
  export {
58
- k as MetadataInstanceHeader
77
+ D as MetadataInstanceHeader
59
78
  };