@box/metadata-editor 0.66.1 → 0.66.3
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/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +21 -21
- package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js +20 -21
- package/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js +26 -27
- package/esm/lib/components/truncated-header-text/truncated-header-text.js +38 -0
- package/package.json +2 -2
- package/styles/metadata-instance-form-header.css +1 -1
- package/styles/metadata-instance-header.css +1 -1
- package/styles/truncated-header-text.css +1 -0
- package/types/lib/components/truncated-header-text/truncated-header-text.d.ts +7 -0
@@ -1,54 +1,54 @@
|
|
1
|
-
import { TextInput as
|
2
|
-
import { useFormikContext as
|
3
|
-
import { forwardRef as
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
1
|
+
import { TextInput as C } from "@box/blueprint-web";
|
2
|
+
import { useFormikContext as R, getIn as T, Field as V } from "formik";
|
3
|
+
import { forwardRef as $, useRef as b } from "react";
|
4
|
+
import { getFieldLabel as B } from "../../utils.js";
|
5
|
+
import { fieldDefaultProps as I } from "../constants.js";
|
6
|
+
import { useFloatValidation as M } from "./use-float-validation.js";
|
7
7
|
import { jsx as r } from "react/jsx-runtime";
|
8
|
-
const
|
8
|
+
const P = /* @__PURE__ */ $(({
|
9
9
|
className: l,
|
10
|
-
description:
|
10
|
+
description: i,
|
11
11
|
label: o,
|
12
|
-
fieldNamePrefix:
|
13
|
-
disableForm:
|
12
|
+
fieldNamePrefix: d,
|
13
|
+
disableForm: n,
|
14
14
|
updateModePrefix: s
|
15
15
|
}, u) => {
|
16
16
|
const {
|
17
17
|
values: f,
|
18
18
|
setFieldValue: m,
|
19
19
|
setFieldTouched: c
|
20
|
-
} =
|
20
|
+
} = R(), t = `${s ?? d}.value`, p = T(f, t), a = b(p), {
|
21
21
|
validateFloats: F
|
22
|
-
} =
|
22
|
+
} = M(), h = (e) => {
|
23
23
|
a.current = e, m(t, e);
|
24
24
|
}, v = (e) => {
|
25
25
|
c(e, !0);
|
26
26
|
};
|
27
27
|
return /* @__PURE__ */ r("div", {
|
28
28
|
"data-testid": `${o}-field`,
|
29
|
-
children: /* @__PURE__ */ r(
|
29
|
+
children: /* @__PURE__ */ r(V, {
|
30
30
|
name: `${t}`,
|
31
31
|
validate: () => F(a.current),
|
32
32
|
children: ({
|
33
33
|
field: e,
|
34
34
|
meta: g
|
35
|
-
}) => /* @__PURE__ */ r(
|
36
|
-
...
|
35
|
+
}) => /* @__PURE__ */ r(C, {
|
36
|
+
...I,
|
37
37
|
...e,
|
38
38
|
ref: u,
|
39
39
|
className: l,
|
40
|
-
disabled:
|
40
|
+
disabled: n,
|
41
41
|
error: g.error,
|
42
|
-
|
42
|
+
inputMode: "decimal",
|
43
|
+
label: B(o, i),
|
43
44
|
onBlur: () => v(t),
|
44
45
|
onChange: (x) => h(x.currentTarget.value),
|
45
|
-
placeholder: "0"
|
46
|
-
type: "number"
|
46
|
+
placeholder: "0"
|
47
47
|
})
|
48
48
|
})
|
49
49
|
});
|
50
50
|
});
|
51
51
|
export {
|
52
|
-
|
53
|
-
|
52
|
+
P as MetadataFloatField,
|
53
|
+
P as default
|
54
54
|
};
|
@@ -1,14 +1,15 @@
|
|
1
1
|
import "../../../../../../styles/metadata-instance-form-header.css";
|
2
|
-
import {
|
3
|
-
import { BoxAiLogo as
|
4
|
-
import { useFormikContext as
|
5
|
-
import { useIntl as
|
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
|
9
|
-
metadataInstanceFormHeader:
|
9
|
+
const v = "_metadataInstanceFormHeader_13lxr_1", S = "_title_13lxr_9", c = {
|
10
|
+
metadataInstanceFormHeader: v,
|
10
11
|
title: S
|
11
|
-
},
|
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:
|
22
|
-
} =
|
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
|
-
|
25
|
-
const l = a == null ? void 0 : a.find((
|
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
|
-
},
|
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(
|
35
|
-
as: "h1",
|
35
|
+
children: [/* @__PURE__ */ n(k, {
|
36
36
|
className: c.title,
|
37
|
-
|
38
|
-
|
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:
|
42
|
+
icon: M,
|
44
43
|
loading: s,
|
45
44
|
loadingAriaLabel: t.formatMessage(e.loadingButtonAriaLabel),
|
46
|
-
onClick:
|
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
|
-
|
54
|
+
q as MetadataInstanceFormHeader
|
56
55
|
};
|
@@ -1,54 +1,53 @@
|
|
1
1
|
import "../../../../../../styles/metadata-instance-header.css";
|
2
|
-
import {
|
3
|
-
import { Pencil as
|
4
|
-
import { BoxAiLogo as
|
5
|
-
import { useIntl as
|
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
|
8
|
-
const
|
9
|
-
metadataInstanceHeader:
|
10
|
-
iconButtonsContainer:
|
11
|
-
title:
|
12
|
-
},
|
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:
|
17
|
-
onAutofill:
|
17
|
+
onEdit: m,
|
18
|
+
onAutofill: u,
|
18
19
|
templateName: t
|
19
20
|
}) => {
|
20
|
-
const o =
|
21
|
-
return /* @__PURE__ */
|
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(
|
24
|
-
as: "h1",
|
24
|
+
children: [/* @__PURE__ */ a(_, {
|
25
25
|
className: e.title,
|
26
|
-
|
27
|
-
|
28
|
-
}), l && /* @__PURE__ */ r("div", {
|
26
|
+
title: f
|
27
|
+
}), l && /* @__PURE__ */ s("div", {
|
29
28
|
className: e.iconButtonsContainer,
|
30
|
-
children: [
|
29
|
+
children: [B && /* @__PURE__ */ a(i, {
|
31
30
|
content: o.formatMessage(n.autofillButtonTooltip, {
|
32
31
|
templateName: t
|
33
32
|
}),
|
34
|
-
children: /* @__PURE__ */ a(
|
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:
|
40
|
-
onClick:
|
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(
|
45
|
+
children: /* @__PURE__ */ a(r, {
|
47
46
|
"aria-label": o.formatMessage(n.editButtonAriaLabel, {
|
48
47
|
templateName: t
|
49
48
|
}),
|
50
|
-
icon:
|
51
|
-
onClick:
|
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
|
-
|
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.
|
3
|
+
"version": "0.66.3",
|
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": "
|
56
|
+
"gitHead": "5bc701e16606e786417f6289c33cf74e17939494"
|
57
57
|
}
|
@@ -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)}
|
@@ -0,0 +1 @@
|
|
1
|
+
._header_d9pl2_1{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|