@box/metadata-editor 0.65.2 → 0.66.1
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-enum-field/metadata-enum-field.js +31 -30
- package/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-instance-entry.js +32 -26
- package/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-value.js +25 -0
- package/package.json +2 -2
- package/styles/taxonomy-value.css +1 -0
- package/types/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-value.d.ts +6 -0
@@ -1,26 +1,26 @@
|
|
1
|
-
import { Select as l, SELECT_EMPTY_VALUE as
|
1
|
+
import { Select as l, SELECT_EMPTY_VALUE as r } from "@box/blueprint-web";
|
2
2
|
import { useFormikContext as M, getIn as V, Field as C } from "formik";
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import
|
6
|
-
import { getFieldLabel as
|
7
|
-
import { jsx as t, jsxs as
|
8
|
-
const
|
9
|
-
className:
|
10
|
-
description:
|
11
|
-
disableForm:
|
3
|
+
import { forwardRef as L } from "react";
|
4
|
+
import { useIntl as P, FormattedMessage as $ } from "react-intl";
|
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(({
|
9
|
+
className: i,
|
10
|
+
description: u,
|
11
|
+
disableForm: p,
|
12
12
|
fieldNamePrefix: s,
|
13
13
|
label: n,
|
14
|
-
options:
|
15
|
-
portalElement:
|
14
|
+
options: f,
|
15
|
+
portalElement: h,
|
16
16
|
updateModePrefix: v
|
17
17
|
}, g) => {
|
18
18
|
const {
|
19
|
-
setFieldValue:
|
20
|
-
values:
|
21
|
-
} = M(),
|
19
|
+
setFieldValue: E,
|
20
|
+
values: F
|
21
|
+
} = M(), x = P(), m = `${v ?? s}.value`, o = f || V(F, `${s}.options`, []).map(({
|
22
22
|
key: a
|
23
|
-
}) => a),
|
23
|
+
}) => a), c = x.formatMessage(d.selectValuePlaceholder);
|
24
24
|
return /* @__PURE__ */ t("div", {
|
25
25
|
"data-testid": `${n}-field`,
|
26
26
|
children: /* @__PURE__ */ t(C, {
|
@@ -29,24 +29,25 @@ const U = /* @__PURE__ */ b(({
|
|
29
29
|
field: a
|
30
30
|
}) => /* @__PURE__ */ t(l, {
|
31
31
|
ref: g,
|
32
|
-
className:
|
33
|
-
disabled:
|
34
|
-
label:
|
32
|
+
className: i,
|
33
|
+
disabled: p,
|
34
|
+
label: b(n, u),
|
35
35
|
onValueChange: (e) => {
|
36
|
-
|
36
|
+
E(m, e === r ? "" : e);
|
37
37
|
},
|
38
|
-
placeholder:
|
38
|
+
placeholder: c,
|
39
39
|
...a,
|
40
|
-
value: a.value ===
|
41
|
-
children: /* @__PURE__ */
|
42
|
-
container:
|
40
|
+
value: a.value === r ? "" : a.value,
|
41
|
+
children: /* @__PURE__ */ j(l.Content, {
|
42
|
+
container: h,
|
43
|
+
onEscapeKeyDown: (e) => e.stopPropagation(),
|
43
44
|
children: [/* @__PURE__ */ t(l.Option, {
|
44
|
-
text:
|
45
|
-
value:
|
45
|
+
text: c,
|
46
|
+
value: r,
|
46
47
|
children: /* @__PURE__ */ t($, {
|
47
|
-
...
|
48
|
+
...d.selectValuePlaceholder
|
48
49
|
})
|
49
|
-
}),
|
50
|
+
}), o == null ? void 0 : o.map((e) => /* @__PURE__ */ t(l.Option, {
|
50
51
|
text: e,
|
51
52
|
value: e,
|
52
53
|
children: e
|
@@ -57,6 +58,6 @@ const U = /* @__PURE__ */ b(({
|
|
57
58
|
});
|
58
59
|
});
|
59
60
|
export {
|
60
|
-
|
61
|
-
|
61
|
+
O as MetadataEnumField,
|
62
|
+
O as default
|
62
63
|
};
|
@@ -1,15 +1,16 @@
|
|
1
1
|
import "../../../../../../styles/metadata-instance-entry.css";
|
2
|
-
import { Text as
|
3
|
-
import { FormattedDate as
|
4
|
-
import
|
2
|
+
import { Text as m } from "@box/blueprint-web";
|
3
|
+
import { FormattedDate as d } from "react-intl";
|
4
|
+
import y from "../../../interactive-text/interactive-text.js";
|
5
|
+
import { TaxonomyValue as f } from "./taxonomy-value.js";
|
5
6
|
import { jsxs as l, jsx as r } from "react/jsx-runtime";
|
6
|
-
const
|
7
|
-
metadataInstanceEntry:
|
8
|
-
},
|
9
|
-
description:
|
10
|
-
name:
|
11
|
-
shouldHideEmptyValues:
|
12
|
-
type:
|
7
|
+
const u = "_metadataInstanceEntry_kd217_1", x = {
|
8
|
+
metadataInstanceEntry: u
|
9
|
+
}, V = ({
|
10
|
+
description: o,
|
11
|
+
name: a,
|
12
|
+
shouldHideEmptyValues: s,
|
13
|
+
type: e,
|
13
14
|
value: t
|
14
15
|
}) => {
|
15
16
|
const n = (() => {
|
@@ -19,36 +20,41 @@ const f = "_metadataInstanceEntry_kd217_1", y = {
|
|
19
20
|
return null;
|
20
21
|
if (Array.isArray(t))
|
21
22
|
return t.join(", ");
|
22
|
-
if (
|
23
|
-
const
|
24
|
-
return /* @__PURE__ */ r(
|
23
|
+
if (e === "date" && typeof t == "string") {
|
24
|
+
const i = new Date(t);
|
25
|
+
return /* @__PURE__ */ r(d, {
|
25
26
|
day: "numeric",
|
26
27
|
month: "long",
|
27
|
-
value:
|
28
|
+
value: i,
|
28
29
|
year: "numeric"
|
29
30
|
});
|
30
31
|
}
|
31
32
|
return t;
|
32
33
|
})();
|
33
|
-
|
34
|
-
|
35
|
-
|
34
|
+
if (s && !n)
|
35
|
+
return null;
|
36
|
+
const c = () => e === "taxonomy" ? /* @__PURE__ */ r(f, {
|
37
|
+
value: t
|
38
|
+
}) : n && /* @__PURE__ */ r(m, {
|
39
|
+
as: "p",
|
40
|
+
children: n
|
41
|
+
});
|
42
|
+
return /* @__PURE__ */ l("div", {
|
43
|
+
className: x.metadataInstanceEntry,
|
44
|
+
children: [/* @__PURE__ */ r(m, {
|
36
45
|
as: "p",
|
37
46
|
color: "textOnLightSecondary",
|
38
47
|
variant: "bodyDefaultBold",
|
39
|
-
children:
|
48
|
+
children: o ? /* @__PURE__ */ r(y, {
|
40
49
|
as: "span",
|
41
50
|
color: "textOnLightSecondary",
|
42
|
-
tooltipText:
|
51
|
+
tooltipText: o,
|
43
52
|
variant: "bodyDefaultBold",
|
44
|
-
children:
|
45
|
-
}) :
|
46
|
-
}),
|
47
|
-
as: "p",
|
48
|
-
children: n
|
49
|
-
})]
|
53
|
+
children: a
|
54
|
+
}) : a
|
55
|
+
}), c()]
|
50
56
|
});
|
51
57
|
};
|
52
58
|
export {
|
53
|
-
|
59
|
+
V as MetadataInstanceEntry
|
54
60
|
};
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import "../../../../../../styles/taxonomy-value.css";
|
2
|
+
import { FilterChip as n } from "@box/blueprint-web";
|
3
|
+
import { jsx as t } from "react/jsx-runtime";
|
4
|
+
const l = "_taxonomyValueContainer_1m6f6_1", m = "_taxonomyValueButton_1m6f6_1", u = "_taxonomyValueLabel_1m6f6_8", e = {
|
5
|
+
taxonomyValueContainer: l,
|
6
|
+
taxonomyValueButton: m,
|
7
|
+
taxonomyValueLabel: u
|
8
|
+
}, x = ({
|
9
|
+
value: a
|
10
|
+
}) => !a || !Array.isArray(a) || !a.length ? null : /* @__PURE__ */ t(n.Group, {
|
11
|
+
className: e.taxonomyValueContainer,
|
12
|
+
name: "taxonomy-value",
|
13
|
+
type: "single",
|
14
|
+
children: a.map((o) => /* @__PURE__ */ t(n.ChipButton, {
|
15
|
+
className: e.taxonomyValueButton,
|
16
|
+
value: o.value,
|
17
|
+
children: /* @__PURE__ */ t(n.Label, {
|
18
|
+
className: e.taxonomyValueLabel,
|
19
|
+
children: o.displayValue
|
20
|
+
})
|
21
|
+
}, o.value))
|
22
|
+
});
|
23
|
+
export {
|
24
|
+
x as TaxonomyValue
|
25
|
+
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@box/metadata-editor",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.66.1",
|
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": "322d297c0f3b9276c89abc74a8889e21150482e4"
|
57
57
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
._taxonomyValueContainer_1m6f6_1 ._taxonomyValueButton_1m6f6_1{overflow-x:hidden}._taxonomyValueContainer_1m6f6_1 ._taxonomyValueButton_1m6f6_1:focus-visible{overflow-x:hidden}._taxonomyValueButton_1m6f6_1 ._taxonomyValueLabel_1m6f6_8{overflow-x:hidden;text-overflow:ellipsis}
|