@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.
@@ -1,26 +1,26 @@
1
- import { Select as l, SELECT_EMPTY_VALUE as o } from "@box/blueprint-web";
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 { useIntl as L, FormattedMessage as $ } from "react-intl";
4
- import { forwardRef as b } from "react";
5
- import c from "../../../../messages.js";
6
- import { getFieldLabel as j } from "../../utils.js";
7
- import { jsx as t, jsxs as I } from "react/jsx-runtime";
8
- const U = /* @__PURE__ */ b(({
9
- className: u,
10
- description: i,
11
- disableForm: f,
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: h,
15
- portalElement: p,
14
+ options: f,
15
+ portalElement: h,
16
16
  updateModePrefix: v
17
17
  }, g) => {
18
18
  const {
19
- setFieldValue: F,
20
- values: x
21
- } = M(), E = L(), m = `${v ?? s}.value`, r = h || V(x, `${s}.options`, []).map(({
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), d = E.formatMessage(c.selectValuePlaceholder);
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: u,
33
- disabled: f,
34
- label: j(n, i),
32
+ className: i,
33
+ disabled: p,
34
+ label: b(n, u),
35
35
  onValueChange: (e) => {
36
- F(m, e === o ? "" : e);
36
+ E(m, e === r ? "" : e);
37
37
  },
38
- placeholder: d,
38
+ placeholder: c,
39
39
  ...a,
40
- value: a.value === o ? "" : a.value,
41
- children: /* @__PURE__ */ I(l.Content, {
42
- container: p,
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: d,
45
- value: o,
45
+ text: c,
46
+ value: r,
46
47
  children: /* @__PURE__ */ t($, {
47
- ...c.selectValuePlaceholder
48
+ ...d.selectValuePlaceholder
48
49
  })
49
- }), r == null ? void 0 : r.map((e) => /* @__PURE__ */ t(l.Option, {
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
- U as MetadataEnumField,
61
- U as default
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 o } from "@box/blueprint-web";
3
- import { FormattedDate as m } from "react-intl";
4
- import d from "../../../interactive-text/interactive-text.js";
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 f = "_metadataInstanceEntry_kd217_1", y = {
7
- metadataInstanceEntry: f
8
- }, D = ({
9
- description: a,
10
- name: e,
11
- shouldHideEmptyValues: i,
12
- type: c,
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 (c === "date" && typeof t == "string") {
23
- const s = new Date(t);
24
- return /* @__PURE__ */ r(m, {
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: s,
28
+ value: i,
28
29
  year: "numeric"
29
30
  });
30
31
  }
31
32
  return t;
32
33
  })();
33
- return i && !n ? null : /* @__PURE__ */ l("div", {
34
- className: y.metadataInstanceEntry,
35
- children: [/* @__PURE__ */ r(o, {
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: a ? /* @__PURE__ */ r(d, {
48
+ children: o ? /* @__PURE__ */ r(y, {
40
49
  as: "span",
41
50
  color: "textOnLightSecondary",
42
- tooltipText: a,
51
+ tooltipText: o,
43
52
  variant: "bodyDefaultBold",
44
- children: e
45
- }) : e
46
- }), n && /* @__PURE__ */ r(o, {
47
- as: "p",
48
- children: n
49
- })]
53
+ children: a
54
+ }) : a
55
+ }), c()]
50
56
  });
51
57
  };
52
58
  export {
53
- D as MetadataInstanceEntry
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.65.2",
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": "e77ce4a2951397e35430076450d0390e3ef81d46"
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}
@@ -0,0 +1,6 @@
1
+ import { type MetadataFieldValue } from '../../../../types';
2
+ type Props = {
3
+ value?: MetadataFieldValue;
4
+ };
5
+ export declare const TaxonomyValue: ({ value }: Props) => import("react/jsx-runtime").JSX.Element;
6
+ export {};