@box/metadata-editor 0.67.9 → 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.
- package/esm/lib/components/interactive-header-text/interactive-header-text.js +37 -0
- package/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js +29 -30
- package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js +51 -69
- package/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js +42 -61
- package/package.json +5 -5
- package/styles/interactive-header-text.css +1 -0
- package/styles/metadata-instance-form-header.css +1 -1
- package/styles/metadata-instance-header.css +1 -1
- package/types/lib/components/interactive-header-text/interactive-header-text.d.ts +7 -0
@@ -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
|
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
|
9
|
-
wrapperGradient:
|
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
|
15
|
-
aiSuggestion:
|
16
|
-
onAiSuggestionAppend:
|
17
|
-
onAiSuggestionReplace:
|
18
|
-
onAiSuggestionIgnore:
|
19
|
-
type:
|
14
|
+
function D({
|
15
|
+
aiSuggestion: p,
|
16
|
+
onAiSuggestionAppend: l,
|
17
|
+
onAiSuggestionReplace: c,
|
18
|
+
onAiSuggestionIgnore: m,
|
19
|
+
type: i
|
20
20
|
}) {
|
21
|
-
const
|
21
|
+
const s = h();
|
22
22
|
return /* @__PURE__ */ e("div", {
|
23
|
-
className:
|
23
|
+
className: o.wrapperGradient,
|
24
24
|
children: /* @__PURE__ */ a("div", {
|
25
|
-
className:
|
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(
|
37
|
-
type:
|
38
|
-
locale:
|
36
|
+
children: w(p, {
|
37
|
+
type: i,
|
38
|
+
locale: s.locale
|
39
39
|
})
|
40
40
|
})]
|
41
41
|
}), /* @__PURE__ */ a("div", {
|
42
|
-
className:
|
43
|
-
children: [/* @__PURE__ */ e(
|
44
|
-
"aria-label":
|
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:
|
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:
|
52
|
-
children: /* @__PURE__ */ e(
|
53
|
-
"aria-label":
|
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:
|
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:
|
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:
|
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
|
-
|
83
|
+
D as AiSuggestionField
|
85
84
|
};
|
@@ -1,85 +1,67 @@
|
|
1
1
|
import "../../../../../../styles/metadata-instance-form-header.css";
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import
|
9
|
-
import
|
10
|
-
import {
|
11
|
-
const
|
12
|
-
metadataInstanceFormHeader:
|
13
|
-
title:
|
14
|
-
},
|
15
|
-
areAiSuggestionsAvailable:
|
16
|
-
isAiSuggestionsFeatureEnabled:
|
17
|
-
isLoading:
|
18
|
-
templateName:
|
19
|
-
onAutofill:
|
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:
|
23
|
-
values:
|
24
|
-
setFieldValue:
|
25
|
-
} =
|
22
|
+
isSubmitting: B,
|
23
|
+
values: e,
|
24
|
+
setFieldValue: c
|
25
|
+
} = M(), a = v(), {
|
26
26
|
suggestions: t
|
27
|
-
} =
|
28
|
-
|
27
|
+
} = K();
|
28
|
+
h(() => {
|
29
29
|
if (t) {
|
30
|
-
const
|
31
|
-
|
32
|
-
var
|
33
|
-
const
|
34
|
-
return
|
35
|
-
...
|
36
|
-
aiSuggestion:
|
37
|
-
} :
|
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,
|
41
|
-
const
|
42
|
-
const
|
43
|
-
|
44
|
-
},
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
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:
|
73
|
-
loading:
|
74
|
-
loadingAriaLabel:
|
75
|
-
onClick:
|
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:
|
60
|
+
children: a.formatMessage(s.autofillButton)
|
79
61
|
})
|
80
62
|
})]
|
81
63
|
});
|
82
64
|
};
|
83
65
|
export {
|
84
|
-
|
66
|
+
J as MetadataInstanceFormHeader
|
85
67
|
};
|
@@ -1,72 +1,53 @@
|
|
1
1
|
import "../../../../../../styles/metadata-instance-header.css";
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import
|
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 {
|
10
|
-
const
|
11
|
-
metadataInstanceHeader:
|
12
|
-
iconButtonsContainer:
|
13
|
-
title:
|
14
|
-
},
|
15
|
-
areAiSuggestionsAvailable:
|
16
|
-
canEdit:
|
17
|
-
isAiSuggestionsFeatureEnabled:
|
18
|
-
onEdit:
|
19
|
-
onAutofill:
|
20
|
-
templateName:
|
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
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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__ */
|
53
|
-
"aria-label":
|
54
|
-
templateName:
|
33
|
+
children: /* @__PURE__ */ a(r, {
|
34
|
+
"aria-label": o.formatMessage(n.autofillButtonAriaLabel, {
|
35
|
+
templateName: t
|
55
36
|
}),
|
56
|
-
disabled: !
|
57
|
-
icon:
|
58
|
-
onClick:
|
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__ */
|
63
|
-
content:
|
64
|
-
children: /* @__PURE__ */
|
65
|
-
"aria-label":
|
66
|
-
templateName:
|
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:
|
69
|
-
onClick:
|
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
|
-
|
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.
|
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.
|
18
|
-
"@box/blueprint-web-assets": "^4.27.
|
19
|
-
"@box/storybook-utils": "^0.
|
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": "
|
56
|
+
"gitHead": "ef6dc665705b4829db20173c2d8d13a8376a617f"
|
57
57
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
._header_d9pl2_1{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
@@ -1 +1 @@
|
|
1
|
-
.
|
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
|
-
.
|
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)}
|