@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.
- package/chunks/metadata-editor-field-wrapper.js +65 -60
- package/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +70 -69
- package/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js +26 -26
- package/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +42 -41
- package/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +24 -23
- package/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +37 -36
- package/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +27 -24
- package/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +26 -24
- package/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +25 -23
- package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js +62 -43
- package/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js +61 -42
- package/package.json +3 -3
- package/styles/ai-suggestion-field.css +1 -1
- package/styles/metadata-editor-field-wrapper.css +1 -1
- package/styles/metadata-instance-form-header.css +1 -1
- package/styles/metadata-instance-header.css +1 -1
- package/types/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.d.ts +1 -0
- package/types/lib/components/combobox-with-api-pagination/types.d.ts +2 -1
- package/types/lib/components/metadata-editor-fields/types.d.ts +1 -0
- package/esm/lib/components/truncated-header-text/truncated-header-text.js +0 -38
- package/styles/truncated-header-text.css +0 -1
- 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
|
3
|
-
import { forwardRef as
|
4
|
-
import { useIntl as
|
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
|
7
|
-
import { jsx as t, jsxs as
|
8
|
-
const
|
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
|
-
|
15
|
-
|
16
|
-
|
17
|
-
},
|
15
|
+
onValueEdited: h,
|
16
|
+
options: v,
|
17
|
+
portalElement: g
|
18
|
+
}, E) => {
|
18
19
|
const {
|
19
|
-
setFieldValue:
|
20
|
-
values:
|
21
|
-
} =
|
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 =
|
24
|
+
}) => a), c = M.formatMessage(d.selectValuePlaceholder);
|
24
25
|
return /* @__PURE__ */ t("div", {
|
25
26
|
"data-testid": `${n}-field`,
|
26
|
-
children: /* @__PURE__ */ t(
|
27
|
+
children: /* @__PURE__ */ t(L, {
|
27
28
|
name: m,
|
28
29
|
children: ({
|
29
30
|
field: a
|
30
31
|
}) => /* @__PURE__ */ t(l, {
|
31
|
-
ref:
|
32
|
+
ref: E,
|
32
33
|
className: i,
|
33
34
|
disabled: p,
|
34
|
-
label:
|
35
|
+
label: j(n, u),
|
35
36
|
onValueChange: (e) => {
|
36
|
-
|
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__ */
|
42
|
-
container:
|
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
|
-
|
62
|
-
|
62
|
+
R as MetadataEnumField,
|
63
|
+
R as default
|
63
64
|
};
|
@@ -1,54 +1,55 @@
|
|
1
|
-
import { TextInput as
|
2
|
-
import { useFormikContext as
|
3
|
-
import { forwardRef as
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
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
|
8
|
+
const q = /* @__PURE__ */ b(({
|
9
9
|
className: l,
|
10
|
-
description:
|
10
|
+
description: i,
|
11
11
|
label: o,
|
12
|
-
fieldNamePrefix:
|
13
|
-
disableForm:
|
14
|
-
|
15
|
-
|
12
|
+
fieldNamePrefix: d,
|
13
|
+
disableForm: n,
|
14
|
+
onValueEdited: s,
|
15
|
+
updateModePrefix: u
|
16
|
+
}, f) => {
|
16
17
|
const {
|
17
|
-
values:
|
18
|
-
setFieldValue:
|
19
|
-
setFieldTouched:
|
20
|
-
} =
|
21
|
-
validateFloats:
|
22
|
-
} =
|
23
|
-
a.current = e,
|
24
|
-
},
|
25
|
-
|
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(
|
30
|
+
children: /* @__PURE__ */ r($, {
|
30
31
|
name: `${t}`,
|
31
|
-
validate: () =>
|
32
|
+
validate: () => h(a.current),
|
32
33
|
children: ({
|
33
34
|
field: e,
|
34
|
-
meta:
|
35
|
-
}) => /* @__PURE__ */ r(
|
36
|
-
...
|
35
|
+
meta: x
|
36
|
+
}) => /* @__PURE__ */ r(R, {
|
37
|
+
...M,
|
37
38
|
...e,
|
38
|
-
ref:
|
39
|
+
ref: f,
|
39
40
|
className: l,
|
40
|
-
disabled:
|
41
|
-
error:
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|
-
|
53
|
-
|
53
|
+
q as MetadataFloatField,
|
54
|
+
q as default
|
54
55
|
};
|
@@ -1,49 +1,52 @@
|
|
1
|
-
import { Combobox as
|
2
|
-
import { useFormikContext as
|
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 "
|
6
|
-
import
|
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
|
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
|
-
|
15
|
+
onValueEdited: m,
|
16
16
|
options: u,
|
17
|
-
|
18
|
-
|
17
|
+
portalElement: d,
|
18
|
+
updateModePrefix: p
|
19
|
+
}, f) => {
|
19
20
|
const {
|
20
|
-
setFieldValue:
|
21
|
-
values:
|
22
|
-
} =
|
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),
|
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(
|
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(
|
34
|
-
...
|
35
|
-
ref:
|
34
|
+
return /* @__PURE__ */ o(b, {
|
35
|
+
...j,
|
36
|
+
ref: f,
|
36
37
|
as: "input",
|
37
38
|
className: i,
|
38
39
|
disabled: n,
|
39
|
-
filterFn:
|
40
|
+
filterFn: v,
|
40
41
|
label: V(l, s),
|
41
42
|
multiselect: !0,
|
42
43
|
name: e.name,
|
43
|
-
onValueChange: (
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|
-
|
55
|
-
|
57
|
+
z as MetadataMultiSelectField,
|
58
|
+
z as default
|
56
59
|
};
|
@@ -1,42 +1,44 @@
|
|
1
|
-
import { TextInput as
|
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 "
|
6
|
-
import
|
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
|
10
|
-
|
11
|
-
|
12
|
-
fieldNamePrefix: o,
|
9
|
+
const b = /* @__PURE__ */ g(({
|
10
|
+
className: t,
|
11
|
+
description: o,
|
13
12
|
disableForm: a,
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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:
|
22
|
+
name: s,
|
22
23
|
children: ({
|
23
|
-
field:
|
24
|
+
field: n,
|
24
25
|
meta: p
|
25
|
-
}) => /* @__PURE__ */ e(
|
26
|
-
...
|
27
|
-
...
|
28
|
-
ref:
|
29
|
-
className:
|
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,
|
33
|
-
|
33
|
+
label: x(r, o),
|
34
|
+
onChangeCapture: l,
|
35
|
+
placeholder: f.formatMessage(F.setValuePlaceholder)
|
34
36
|
})
|
35
37
|
})
|
36
38
|
});
|
37
39
|
});
|
38
|
-
|
40
|
+
b.displayName = "MetadataStringField";
|
39
41
|
export {
|
40
|
-
|
41
|
-
|
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 {
|
4
|
-
import {
|
2
|
+
import { forwardRef as R } from "react";
|
3
|
+
import { useIntl as V } from "react-intl";
|
5
4
|
import $ from "../../../../messages.js";
|
6
|
-
import {
|
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
|
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
|
-
|
17
|
-
|
18
|
-
|
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:
|
23
|
-
scope:
|
23
|
+
templateKey: F,
|
24
|
+
scope: g
|
24
25
|
}
|
25
|
-
} = l,
|
26
|
-
key:
|
26
|
+
} = l, x = I(l, r), {
|
27
|
+
key: v,
|
27
28
|
optionsRules: {
|
28
|
-
multiSelect:
|
29
|
+
multiSelect: y,
|
29
30
|
selectableLevels: e
|
30
31
|
}
|
31
|
-
} =
|
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(
|
39
|
-
ref:
|
40
|
-
|
39
|
+
}) => /* @__PURE__ */ o(j, {
|
40
|
+
ref: f,
|
41
|
+
className: u,
|
42
|
+
defaultFetcher: b,
|
41
43
|
disabled: n,
|
42
|
-
label:
|
43
|
-
multiselect:
|
44
|
-
onValueChange: (
|
45
|
-
placeholder:
|
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
|
-
|
55
|
+
z as MetadataTaxonomyField
|
54
56
|
};
|
@@ -1,55 +1,74 @@
|
|
1
1
|
import "../../../../../../styles/metadata-instance-form-header.css";
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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:
|
21
|
-
values:
|
22
|
-
setFieldValue:
|
23
|
-
} =
|
24
|
-
const
|
25
|
-
|
26
|
-
const
|
27
|
-
return
|
28
|
-
...
|
29
|
-
aiSuggestion:
|
30
|
-
} :
|
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
|
-
},
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
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:
|
67
|
+
children: e.formatMessage(o.autofillButton)
|
49
68
|
})
|
50
69
|
})]
|
51
70
|
});
|
52
71
|
};
|
53
72
|
export {
|
54
|
-
|
73
|
+
Q as MetadataInstanceFormHeader
|
55
74
|
};
|
@@ -1,53 +1,72 @@
|
|
1
1
|
import "../../../../../../styles/metadata-instance-header.css";
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import
|
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 {
|
9
|
-
const
|
10
|
-
metadataInstanceHeader:
|
11
|
-
iconButtonsContainer:
|
12
|
-
title:
|
13
|
-
},
|
14
|
-
areAiSuggestionsAvailable:
|
15
|
-
canEdit:
|
16
|
-
isAiSuggestionsFeatureEnabled:
|
17
|
-
onEdit:
|
18
|
-
onAutofill:
|
19
|
-
templateName:
|
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
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
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__ */
|
34
|
-
"aria-label":
|
35
|
-
templateName:
|
52
|
+
children: /* @__PURE__ */ t(l, {
|
53
|
+
"aria-label": e.formatMessage(n.autofillButtonAriaLabel, {
|
54
|
+
templateName: o
|
36
55
|
}),
|
37
|
-
disabled: !
|
38
|
-
icon:
|
39
|
-
onClick:
|
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__ */
|
44
|
-
content:
|
45
|
-
children: /* @__PURE__ */
|
46
|
-
"aria-label":
|
47
|
-
templateName:
|
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:
|
50
|
-
onClick:
|
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
|
-
|
77
|
+
D as MetadataInstanceHeader
|
59
78
|
};
|