@box/metadata-editor 0.93.1 → 0.93.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.
- package/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +8 -10
- package/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +17 -19
- package/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +20 -23
- package/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance/custom-instance.js +27 -29
- package/package.json +2 -2
@@ -2,26 +2,25 @@ import { TextInput as T } from "@box/blueprint-web";
|
|
2
2
|
import { useFormikContext as V, getIn as $, Field as b } from "formik";
|
3
3
|
import { forwardRef as B, useRef as I } from "react";
|
4
4
|
import { g as M } from "../../../../../../chunks/utils2.js";
|
5
|
-
import {
|
6
|
-
import { useFloatValidation as j } from "./use-float-validation.js";
|
5
|
+
import { useFloatValidation as O } from "./use-float-validation.js";
|
7
6
|
import { jsx as r } from "react/jsx-runtime";
|
8
7
|
const y = /* @__PURE__ */ B(({
|
9
8
|
className: l,
|
10
|
-
description:
|
9
|
+
description: n,
|
11
10
|
isAiSuggestionApplied: d,
|
12
11
|
label: o,
|
13
|
-
fieldNamePrefix:
|
12
|
+
fieldNamePrefix: i,
|
14
13
|
disableForm: s,
|
15
14
|
onValueEdited: u,
|
16
|
-
updateModePrefix:
|
15
|
+
updateModePrefix: c
|
17
16
|
}, m) => {
|
18
17
|
const {
|
19
|
-
values:
|
18
|
+
values: f,
|
20
19
|
setFieldValue: p,
|
21
20
|
setFieldTouched: F
|
22
|
-
} = V(), t = `${
|
21
|
+
} = V(), t = `${c ?? i}.value`, h = $(f, t), a = I(h), {
|
23
22
|
validateFloats: g
|
24
|
-
} =
|
23
|
+
} = O(), v = (e) => {
|
25
24
|
a.current = e, p(t, e), u();
|
26
25
|
}, x = (e) => {
|
27
26
|
F(e, !0);
|
@@ -35,14 +34,13 @@ const y = /* @__PURE__ */ B(({
|
|
35
34
|
field: e,
|
36
35
|
meta: C
|
37
36
|
}) => /* @__PURE__ */ r(T, {
|
38
|
-
...O,
|
39
37
|
...e,
|
40
38
|
ref: m,
|
41
39
|
className: l,
|
42
40
|
disabled: s,
|
43
41
|
error: C.error,
|
44
42
|
inputMode: "decimal",
|
45
|
-
label: M(o,
|
43
|
+
label: M(o, n, d),
|
46
44
|
onBlur: () => x(t),
|
47
45
|
onChange: (R) => v(R.currentTarget.value),
|
48
46
|
placeholder: "0"
|
@@ -3,52 +3,50 @@ import { useFormikContext as x, getIn as M, Field as $ } from "formik";
|
|
3
3
|
import { forwardRef as I } from "react";
|
4
4
|
import { useIntl as j } from "react-intl";
|
5
5
|
import k from "../../../../messages.js";
|
6
|
-
import { g as
|
7
|
-
import { fieldDefaultProps as O } from "../constants.js";
|
6
|
+
import { g as O } from "../../../../../../chunks/utils2.js";
|
8
7
|
import { jsx as t } from "react/jsx-runtime";
|
9
|
-
const
|
10
|
-
className:
|
11
|
-
isAiSuggestionApplied:
|
8
|
+
const D = /* @__PURE__ */ I(({
|
9
|
+
className: s,
|
10
|
+
isAiSuggestionApplied: i,
|
12
11
|
description: m,
|
13
12
|
disableForm: u,
|
14
13
|
fieldNamePrefix: o,
|
15
14
|
label: l,
|
16
15
|
onValueEdited: d,
|
17
|
-
options:
|
18
|
-
portalElement:
|
16
|
+
options: c,
|
17
|
+
portalElement: f,
|
19
18
|
updateModePrefix: p
|
20
19
|
}, g) => {
|
21
20
|
const {
|
22
21
|
setFieldValue: h,
|
23
22
|
values: F
|
24
|
-
} = x(), v = j(),
|
23
|
+
} = x(), v = j(), a = `${p ?? o}.value`, C = c || M(F, `${o}.options`, []).map(({
|
25
24
|
key: e
|
26
|
-
}) => e), L = (e,
|
25
|
+
}) => e), L = (e, r) => r.toLowerCase().includes(e.toLowerCase());
|
27
26
|
return /* @__PURE__ */ t("div", {
|
28
27
|
"data-testid": `${l}-field`,
|
29
28
|
children: /* @__PURE__ */ t($, {
|
30
|
-
name:
|
29
|
+
name: a,
|
31
30
|
children: ({
|
32
31
|
field: e
|
33
32
|
}) => {
|
34
|
-
var
|
35
|
-
const b = (((
|
33
|
+
var n;
|
34
|
+
const b = (((n = e.value) == null ? void 0 : n.length) || 0) === 0 ? v.formatMessage(k.multiselectPlaceholder) : "";
|
36
35
|
return /* @__PURE__ */ t(w, {
|
37
|
-
...O,
|
38
36
|
ref: g,
|
39
37
|
as: "input",
|
40
|
-
className:
|
38
|
+
className: s,
|
41
39
|
disabled: u,
|
42
40
|
filterFn: L,
|
43
|
-
label:
|
41
|
+
label: O(l, m, i),
|
44
42
|
multiselect: !0,
|
45
43
|
name: e.name,
|
46
44
|
onValueChange: (V) => {
|
47
|
-
h(
|
45
|
+
h(a, V), d();
|
48
46
|
},
|
49
47
|
options: C,
|
50
48
|
placeholder: b,
|
51
|
-
portalElement:
|
49
|
+
portalElement: f,
|
52
50
|
value: e.value
|
53
51
|
});
|
54
52
|
}
|
@@ -56,6 +54,6 @@ const E = /* @__PURE__ */ I(({
|
|
56
54
|
});
|
57
55
|
});
|
58
56
|
export {
|
59
|
-
|
60
|
-
|
57
|
+
D as MetadataMultiSelectField,
|
58
|
+
D as default
|
61
59
|
};
|
@@ -1,46 +1,43 @@
|
|
1
|
-
import { TextInput as
|
2
|
-
import { Field as
|
1
|
+
import { TextInput as g } from "@box/blueprint-web";
|
2
|
+
import { Field as u } from "formik";
|
3
3
|
import { forwardRef as h } from "react";
|
4
|
-
import { useIntl as
|
5
|
-
import
|
4
|
+
import { useIntl as F } from "react-intl";
|
5
|
+
import x from "../../../../messages.js";
|
6
6
|
import { g as M } from "../../../../../../chunks/utils2.js";
|
7
|
-
import { fieldDefaultProps as b } from "../constants.js";
|
8
7
|
import { jsx as e } from "react/jsx-runtime";
|
9
|
-
const
|
8
|
+
const b = /* @__PURE__ */ h(({
|
10
9
|
className: t,
|
11
10
|
description: a,
|
12
11
|
isAiSuggestionApplied: o,
|
13
12
|
disableForm: i,
|
14
|
-
fieldNamePrefix:
|
13
|
+
fieldNamePrefix: d,
|
15
14
|
label: r,
|
16
|
-
onValueEdited:
|
17
|
-
updateModePrefix:
|
18
|
-
},
|
19
|
-
const
|
15
|
+
onValueEdited: l,
|
16
|
+
updateModePrefix: m
|
17
|
+
}, s) => {
|
18
|
+
const f = F(), n = `${m ?? d}.value`;
|
20
19
|
return /* @__PURE__ */ e("div", {
|
21
20
|
"data-testid": `${r}-field`,
|
22
|
-
children: /* @__PURE__ */ e(
|
21
|
+
children: /* @__PURE__ */ e(u, {
|
23
22
|
name: n,
|
24
23
|
children: ({
|
25
24
|
field: p,
|
26
|
-
meta:
|
27
|
-
}) => /* @__PURE__ */ e(
|
28
|
-
...b,
|
25
|
+
meta: c
|
26
|
+
}) => /* @__PURE__ */ e(g, {
|
29
27
|
...p,
|
30
|
-
ref:
|
28
|
+
ref: s,
|
31
29
|
className: t,
|
32
30
|
disabled: i,
|
33
|
-
error:
|
31
|
+
error: c.error,
|
34
32
|
label: M(r, a, o),
|
35
|
-
|
36
|
-
|
37
|
-
placeholder: s.formatMessage(F.setValuePlaceholder)
|
33
|
+
onChangeCapture: l,
|
34
|
+
placeholder: f.formatMessage(x.setValuePlaceholder)
|
38
35
|
})
|
39
36
|
})
|
40
37
|
});
|
41
38
|
});
|
42
|
-
|
39
|
+
b.displayName = "MetadataStringField";
|
43
40
|
export {
|
44
|
-
|
45
|
-
|
41
|
+
b as MetadataStringField,
|
42
|
+
b as default
|
46
43
|
};
|
package/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance/custom-instance.js
CHANGED
@@ -1,38 +1,37 @@
|
|
1
1
|
import { useFormikContext as A, FieldArray as N, Field as k } from "formik";
|
2
|
-
import { useState as
|
2
|
+
import { useState as f, useRef as v, useEffect as y } from "react";
|
3
3
|
import { useIntl as C } from "react-intl";
|
4
4
|
import { TextInput as q, IconButton as B, TextButton as T } from "@box/blueprint-web";
|
5
5
|
import { Trash as w } from "@box/blueprint-web-assets/icons/Line";
|
6
6
|
import { CustomInstanceNewField as M } from "../custom-instance-new-field/custom-instance-new-field.js";
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
customInstanceFieldInput: P,
|
7
|
+
import r from "./messages.js";
|
8
|
+
import { jsx as t, jsxs as F } from "react/jsx-runtime";
|
9
|
+
import '../../../../../../styles/custom-instance.css';const R = "_customInstance_xq8r7_1", V = "_customInstanceField_xq8r7_7", j = "_customInstanceFieldInput_xq8r7_12", z = "_customInstanceFieldIcon_xq8r7_16", c = {
|
10
|
+
customInstance: R,
|
11
|
+
customInstanceField: V,
|
12
|
+
customInstanceFieldInput: j,
|
14
13
|
customInstanceFieldIcon: z
|
15
|
-
},
|
14
|
+
}, H = (p) => {
|
16
15
|
const {
|
17
16
|
isLoading: l
|
18
|
-
} =
|
17
|
+
} = p, {
|
19
18
|
values: e
|
20
|
-
} = A(), i = C(), [m,
|
21
|
-
|
22
|
-
}, b = (
|
23
|
-
|
24
|
-
},
|
19
|
+
} = A(), i = C(), [m, a] = f(!e.metadata.fields.length), [u, d] = f(0), h = () => {
|
20
|
+
d(e.metadata.fields.length);
|
21
|
+
}, b = (o) => {
|
22
|
+
d(o === 0 ? 0 : o - 1);
|
23
|
+
}, I = v(null);
|
25
24
|
return y(() => {
|
26
|
-
e.metadata.fields.length > 0 ?
|
25
|
+
e.metadata.fields.length > 0 ? I.current.focus() : a(!0);
|
27
26
|
}, [u, e.metadata.fields.length]), /* @__PURE__ */ t("div", {
|
28
27
|
children: /* @__PURE__ */ t(N, {
|
29
28
|
name: "metadata.fields",
|
30
29
|
children: ({
|
31
|
-
remove:
|
30
|
+
remove: o,
|
32
31
|
push: _
|
33
|
-
}) => /* @__PURE__ */
|
32
|
+
}) => /* @__PURE__ */ F("div", {
|
34
33
|
className: c.customInstance,
|
35
|
-
children: [e == null ? void 0 : e.metadata.fields.map((s, n) => /* @__PURE__ */
|
34
|
+
children: [e == null ? void 0 : e.metadata.fields.map((s, n) => /* @__PURE__ */ F("div", {
|
36
35
|
className: c.customInstanceField,
|
37
36
|
children: [/* @__PURE__ */ t("div", {
|
38
37
|
className: c.customInstanceFieldInput,
|
@@ -42,24 +41,23 @@ import '../../../../../../styles/custom-instance.css';const V = "_customInstance
|
|
42
41
|
field: g,
|
43
42
|
meta: x
|
44
43
|
}) => /* @__PURE__ */ t(q, {
|
45
|
-
...R,
|
46
44
|
...g,
|
47
|
-
ref: n === u ?
|
45
|
+
ref: n === u ? I : null,
|
48
46
|
disabled: l,
|
49
47
|
error: x.error,
|
50
48
|
label: s.key,
|
51
|
-
placeholder: i.formatMessage(
|
49
|
+
placeholder: i.formatMessage(r.setValuePlaceholder)
|
52
50
|
})
|
53
51
|
})
|
54
52
|
}), /* @__PURE__ */ t(B, {
|
55
|
-
"aria-label": i.formatMessage(
|
53
|
+
"aria-label": i.formatMessage(r.removeAttribute, {
|
56
54
|
fieldName: s.key
|
57
55
|
}),
|
58
56
|
className: c.customInstanceFieldIcon,
|
59
57
|
disabled: l,
|
60
58
|
icon: w,
|
61
59
|
onClick: () => {
|
62
|
-
|
60
|
+
o(n), b(n);
|
63
61
|
},
|
64
62
|
size: "x-small",
|
65
63
|
"data-target-id": "IconButton-removeAttribute"
|
@@ -70,19 +68,19 @@ import '../../../../../../styles/custom-instance.css';const V = "_customInstance
|
|
70
68
|
_({
|
71
69
|
key: s,
|
72
70
|
value: n
|
73
|
-
}), h(),
|
71
|
+
}), h(), a(!1);
|
74
72
|
},
|
75
|
-
onCancel: () =>
|
73
|
+
onCancel: () => a(!1)
|
76
74
|
}), !m && /* @__PURE__ */ t(T, {
|
77
75
|
disabled: l,
|
78
|
-
onClick: () =>
|
76
|
+
onClick: () => a(!0),
|
79
77
|
"data-target-id": "TextButton-addAttribute",
|
80
|
-
children: i.formatMessage(
|
78
|
+
children: i.formatMessage(r.addAttribute)
|
81
79
|
})]
|
82
80
|
})
|
83
81
|
})
|
84
82
|
});
|
85
83
|
};
|
86
84
|
export {
|
87
|
-
|
85
|
+
H as CustomInstance
|
88
86
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@box/metadata-editor",
|
3
|
-
"version": "0.93.
|
3
|
+
"version": "0.93.2",
|
4
4
|
"peerDependencies": {
|
5
5
|
"@ariakit/react": "0.4.15",
|
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": "d7b0622598d060b689dc20c6767f6f43ea081211"
|
57
57
|
}
|