@box/metadata-editor 0.51.1 → 0.51.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.
Files changed (19) hide show
  1. package/chunks/metadata-editor-field-wrapper.js +18 -16
  2. package/esm/lib/components/interactive-text/interactive-text.js +16 -10
  3. package/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +57 -50
  4. package/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +39 -30
  5. package/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +43 -34
  6. package/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +39 -30
  7. package/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +37 -28
  8. package/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-instance-entry.js +19 -21
  9. package/package.json +2 -2
  10. package/styles/interactive-text.css +1 -0
  11. package/styles/metadata-instance-entry.css +1 -1
  12. package/types/lib/components/interactive-text/interactive-text.d.ts +2 -1
  13. package/types/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.d.ts +1 -1
  14. package/types/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.d.ts +1 -1
  15. package/types/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.d.ts +1 -1
  16. package/types/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.d.ts +1 -1
  17. package/types/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.d.ts +1 -1
  18. package/types/lib/components/metadata-editor-fields/types.d.ts +1 -0
  19. package/types/lib/test-utils/sample-data.d.ts +1 -1
@@ -13,48 +13,50 @@ const W = "_noAttributesText_vykxc_1", M = "_fieldWrapper_vykxc_5", N = "_hasSug
13
13
  hasSuggestion: N,
14
14
  error: T
15
15
  }, E = ({
16
- disableForm: a,
17
- portalElement: n,
16
+ disableForm: n,
17
+ portalElement: a,
18
18
  field: e,
19
19
  index: p
20
20
  }) => {
21
21
  const {
22
22
  setFieldValue: d
23
- } = x(), [g, r] = h(!0), i = k[e.type], c = i && !e.hidden, m = !_(e.updateMode), s = `metadata.fields[${p}]`;
24
- if (!c)
23
+ } = x(), [l, i] = h(!0), r = k[e.type], g = r && !e.hidden, m = !_(e.updateMode), s = `metadata.fields[${p}]`;
24
+ if (!g)
25
25
  return null;
26
26
  if (m)
27
27
  return /* @__PURE__ */ o(v, {
28
28
  fieldNamePrefix: s,
29
29
  fieldType: e.type,
30
- children: /* @__PURE__ */ o(i, {
31
- disableForm: a,
30
+ children: /* @__PURE__ */ o(r, {
31
+ description: e.description,
32
+ disableForm: n,
32
33
  fieldNamePrefix: s,
33
34
  label: e.displayName,
34
- portalElement: n
35
+ portalElement: a
35
36
  })
36
37
  }, e.key);
37
38
  const {
38
39
  aiSuggestion: t,
39
40
  value: f
40
- } = e, l = t && g;
41
+ } = e, c = t && l;
41
42
  return /* @__PURE__ */ F("div", {
42
43
  className: u.fieldWrapper,
43
- children: [/* @__PURE__ */ o(i, {
44
- className: S(l && u.hasSuggestion),
45
- disableForm: a,
44
+ children: [/* @__PURE__ */ o(r, {
45
+ className: S(c && u.hasSuggestion),
46
+ description: e.description,
47
+ disableForm: n,
46
48
  fieldNamePrefix: `metadata.fields[${p}]`,
47
49
  label: e.displayName,
48
- portalElement: n
49
- }), l && /* @__PURE__ */ o(A, {
50
+ portalElement: a
51
+ }), c && /* @__PURE__ */ o(A, {
50
52
  aiSuggestion: t,
51
53
  onAiSuggestionAppend: () => {
52
54
  const y = e.type === "multiSelect" ? [f, t].flat() : t;
53
- d(`${s}.value`, y), r(!1);
55
+ d(`${s}.value`, y), i(!1);
54
56
  },
55
- onAiSuggestionIgnore: () => r(!1),
57
+ onAiSuggestionIgnore: () => i(!1),
56
58
  onAiSuggestionReplace: () => {
57
- d(`${s}.value`, t), r(!1);
59
+ d(`${s}.value`, t), i(!1);
58
60
  }
59
61
  })]
60
62
  }, e.key);
@@ -1,26 +1,32 @@
1
- import { Focusable as c } from "@ariakit/react";
2
- import { Tooltip as a, Text as i } from "@box/blueprint-web";
1
+ import "../../../../styles/interactive-text.css";
2
+ import { Focusable as n } from "@ariakit/react";
3
+ import { Tooltip as a, Text as s } from "@box/blueprint-web";
4
+ import m from "clsx";
3
5
  import { jsx as t } from "react/jsx-runtime";
4
- const l = ({
6
+ const x = "_interactiveText_2jv0p_1", l = {
7
+ interactiveText: x
8
+ }, d = ({
5
9
  tooltipText: r,
6
- children: o,
10
+ className: i,
11
+ children: c,
7
12
  ...e
8
13
  }) => {
9
14
  const {
10
- as: n = "span"
15
+ as: o = "span"
11
16
  } = e;
12
17
  return /* @__PURE__ */ t(a, {
13
18
  __checkInteractivity: !1,
14
19
  content: r,
15
- children: /* @__PURE__ */ t(c, {
16
- render: /* @__PURE__ */ t(i, {
17
- as: n,
20
+ children: /* @__PURE__ */ t(n, {
21
+ render: /* @__PURE__ */ t(s, {
22
+ as: o,
23
+ className: m(l.interactiveText, i),
18
24
  ...e,
19
- children: o
25
+ children: c
20
26
  })
21
27
  })
22
28
  });
23
29
  };
24
30
  export {
25
- l as default
31
+ d as default
26
32
  };
@@ -1,64 +1,71 @@
1
- import { DateI18nProvider as P, DatePicker as x } from "@box/blueprint-web";
2
- import { useFormikContext as F, getIn as T, Field as V } from "formik";
3
- import { useMemo as b } from "react";
4
- import { useIntl as A } from "react-intl";
5
- import { convertToDatePickerValue as C, convertToFormikValue as L } from "./date-conversion-utils.js";
6
- import { useDateInternationalization as I } from "./use-date-internationalization.js";
7
- import o from "../../../../messages.js";
8
- import { jsx as t } from "react/jsx-runtime";
9
- const q = ({
10
- disableForm: c,
11
- fieldNamePrefix: m,
12
- label: i,
13
- portalElement: d,
1
+ import { DateI18nProvider as T, DatePicker as P } from "@box/blueprint-web";
2
+ import { useFormikContext as F, getIn as V, Field as b } from "formik";
3
+ import { useMemo as A } from "react";
4
+ import { useIntl as C } from "react-intl";
5
+ import { convertToDatePickerValue as I, convertToFormikValue as L } from "./date-conversion-utils.js";
6
+ import { useDateInternationalization as w } from "./use-date-internationalization.js";
7
+ import a from "../../../../messages.js";
8
+ import N from "../../../interactive-text/interactive-text.js";
9
+ import { jsx as o } from "react/jsx-runtime";
10
+ const G = ({
11
+ description: s,
12
+ disableForm: m,
13
+ fieldNamePrefix: d,
14
+ label: r,
15
+ portalElement: f,
14
16
  className: u
15
17
  }) => {
16
- const a = `${m}.value`, e = A(), {
17
- values: f,
18
- setFieldTouched: h,
19
- setFieldValue: p
18
+ const t = `${d}.value`, e = C(), {
19
+ values: h,
20
+ setFieldTouched: p,
21
+ setFieldValue: D
20
22
  } = F(), {
21
- localTimezone: D
22
- } = I(e.locale), r = T(f, a), s = b(() => C(r), [r]);
23
- console.log(0, r, s);
24
- const M = {
25
- clearDatePickerAriaLabel: e.formatMessage(o.clearSelectedDate),
26
- nextMonthAriaLabel: e.formatMessage(o.switchToNextMonth),
27
- openCalendarDropdownAriaLabel: e.formatMessage(o.openCalendar),
28
- previousMonthAriaLabel: e.formatMessage(o.switchToNextMonth)
29
- }, g = (l) => {
30
- const n = L(l, D);
31
- p(a, n);
32
- }, k = () => {
33
- h(a, !0);
23
+ localTimezone: M
24
+ } = w(e.locale), c = V(h, t), g = A(() => I(c), [c]), k = {
25
+ clearDatePickerAriaLabel: e.formatMessage(a.clearSelectedDate),
26
+ nextMonthAriaLabel: e.formatMessage(a.switchToNextMonth),
27
+ openCalendarDropdownAriaLabel: e.formatMessage(a.openCalendar),
28
+ previousMonthAriaLabel: e.formatMessage(a.switchToNextMonth)
29
+ }, v = (n) => {
30
+ const l = L(n, M);
31
+ D(t, l);
32
+ }, x = () => {
33
+ p(t, !0);
34
34
  };
35
- return /* @__PURE__ */ t("div", {
36
- "data-testid": `${i}-field`,
37
- children: /* @__PURE__ */ t(P, {
35
+ return /* @__PURE__ */ o("div", {
36
+ "data-testid": `${r}-field`,
37
+ children: /* @__PURE__ */ o(T, {
38
38
  locale: e.locale,
39
- children: /* @__PURE__ */ t(V, {
40
- name: a,
39
+ children: /* @__PURE__ */ o(b, {
40
+ name: t,
41
41
  children: ({
42
- field: l,
43
- meta: n
44
- }) => /* @__PURE__ */ t(x, {
45
- ...l,
46
- ...M,
47
- calendarAriaLabel: e.formatMessage(o.selectDate),
42
+ field: n,
43
+ meta: l
44
+ }) => /* @__PURE__ */ o(P, {
45
+ ...n,
46
+ ...k,
47
+ calendarAriaLabel: e.formatMessage(a.selectDate),
48
48
  className: u,
49
- error: n.error,
50
- isDisabled: c,
51
- label: i,
52
- onBlur: () => k(),
53
- onChange: (v) => g(v),
54
- portalElement: d,
55
- value: s
49
+ error: l.error,
50
+ isDisabled: m,
51
+ label: s ? ({
52
+ ...i
53
+ }) => N({
54
+ as: "span",
55
+ tooltipText: s,
56
+ children: r,
57
+ ...i
58
+ }) : r,
59
+ onBlur: () => x(),
60
+ onChange: (i) => v(i),
61
+ portalElement: f,
62
+ value: g
56
63
  })
57
64
  })
58
65
  })
59
66
  });
60
67
  };
61
68
  export {
62
- q as MetadataDateField,
63
- q as default
69
+ G as MetadataDateField,
70
+ G as default
64
71
  };
@@ -1,47 +1,56 @@
1
- import { Select as l, SELECT_EMPTY_VALUE as r } from "@box/blueprint-web";
2
- import { useFormikContext as x, getIn as E, Field as F } from "formik";
3
- import { useIntl as M, FormattedMessage as V } from "react-intl";
1
+ import { Select as l, SELECT_EMPTY_VALUE as s } from "@box/blueprint-web";
2
+ import { useFormikContext as E, getIn as F, Field as M } from "formik";
3
+ import { useIntl as V, FormattedMessage as C } from "react-intl";
4
4
  import d from "../../../../messages.js";
5
- import { jsx as t, jsxs as C } from "react/jsx-runtime";
6
- const T = ({
7
- className: m,
8
- disableForm: i,
9
- fieldNamePrefix: n,
10
- label: o,
11
- options: h,
12
- portalElement: v
5
+ import T from "../../../interactive-text/interactive-text.js";
6
+ import { jsx as t, jsxs as I } from "react/jsx-runtime";
7
+ const A = ({
8
+ className: i,
9
+ description: n,
10
+ disableForm: h,
11
+ fieldNamePrefix: c,
12
+ label: r,
13
+ options: v,
14
+ portalElement: p
13
15
  }) => {
14
16
  const {
15
- setFieldValue: p,
16
- values: g
17
- } = x(), f = M(), c = `${n}.value`, s = h || E(g, `${n}.options`, []).map(({
17
+ setFieldValue: x,
18
+ values: f
19
+ } = E(), g = V(), m = `${c}.value`, o = v || F(f, `${c}.options`, []).map(({
18
20
  key: a
19
- }) => a), u = f.formatMessage(d.selectValuePlaceholder);
21
+ }) => a), u = g.formatMessage(d.selectValuePlaceholder);
20
22
  return /* @__PURE__ */ t("div", {
21
- "data-testid": `${o}-field`,
22
- children: /* @__PURE__ */ t(F, {
23
- name: c,
23
+ "data-testid": `${r}-field`,
24
+ children: /* @__PURE__ */ t(M, {
25
+ name: m,
24
26
  children: ({
25
27
  field: a
26
28
  }) => /* @__PURE__ */ t(l, {
27
- className: m,
28
- disabled: i,
29
- label: o,
29
+ className: i,
30
+ disabled: h,
31
+ label: n ? ({
32
+ ...e
33
+ }) => T({
34
+ as: "label",
35
+ tooltipText: n,
36
+ children: r,
37
+ ...e
38
+ }) : r,
30
39
  onValueChange: (e) => {
31
- p(c, e === r ? "" : e);
40
+ x(m, e === s ? "" : e);
32
41
  },
33
42
  placeholder: u,
34
43
  ...a,
35
- value: a.value === r ? "" : a.value,
36
- children: /* @__PURE__ */ C(l.Content, {
37
- container: v,
44
+ value: a.value === s ? "" : a.value,
45
+ children: /* @__PURE__ */ I(l.Content, {
46
+ container: p,
38
47
  children: [/* @__PURE__ */ t(l.Option, {
39
48
  text: u,
40
- value: r,
41
- children: /* @__PURE__ */ t(V, {
49
+ value: s,
50
+ children: /* @__PURE__ */ t(C, {
42
51
  ...d.selectValuePlaceholder
43
52
  })
44
- }), s == null ? void 0 : s.map((e) => /* @__PURE__ */ t(l.Option, {
53
+ }), o == null ? void 0 : o.map((e) => /* @__PURE__ */ t(l.Option, {
45
54
  text: e,
46
55
  value: e,
47
56
  children: e
@@ -52,6 +61,6 @@ const T = ({
52
61
  });
53
62
  };
54
63
  export {
55
- T as MetadataEnumField,
56
- T as default
64
+ A as MetadataEnumField,
65
+ A as default
57
66
  };
@@ -1,49 +1,58 @@
1
- import { TextInput as v } from "@box/blueprint-web";
2
- import { useFormikContext as g, getIn as x, Field as C } from "formik";
3
- import { useRef as T } from "react";
4
- import { fieldDefaultProps as V } from "../constants.js";
5
- import { useFloatValidation as $ } from "./use-float-validation.js";
6
- import { jsx as r } from "react/jsx-runtime";
7
- const D = ({
8
- label: o,
9
- fieldNamePrefix: l,
10
- disableForm: n,
11
- className: i
1
+ import { TextInput as x } from "@box/blueprint-web";
2
+ import { useFormikContext as T, getIn as g, Field as C } from "formik";
3
+ import { useRef as I } from "react";
4
+ import V from "../../../interactive-text/interactive-text.js";
5
+ import { fieldDefaultProps as $ } from "../constants.js";
6
+ import { useFloatValidation as B } from "./use-float-validation.js";
7
+ import { jsx as a } from "react/jsx-runtime";
8
+ const N = ({
9
+ className: i,
10
+ description: l,
11
+ label: r,
12
+ fieldNamePrefix: d,
13
+ disableForm: s
12
14
  }) => {
13
15
  const {
14
- values: d,
15
- setFieldValue: s,
16
- setFieldTouched: u
17
- } = g(), t = `${l}.value`, c = x(d, t), a = T(c), {
18
- validateFloats: m
19
- } = $(), f = (e) => {
20
- a.current = e, s(t, e);
21
- }, p = (e) => {
22
- u(e, !0);
16
+ values: u,
17
+ setFieldValue: m,
18
+ setFieldTouched: c
19
+ } = T(), t = `${d}.value`, f = g(u, t), n = I(f), {
20
+ validateFloats: p
21
+ } = B(), h = (e) => {
22
+ n.current = e, m(t, e);
23
+ }, F = (e) => {
24
+ c(e, !0);
23
25
  };
24
- return /* @__PURE__ */ r("div", {
25
- "data-testid": `${o}-field`,
26
- children: /* @__PURE__ */ r(C, {
26
+ return /* @__PURE__ */ a("div", {
27
+ "data-testid": `${r}-field`,
28
+ children: /* @__PURE__ */ a(C, {
27
29
  name: `${t}`,
28
- validate: () => m(a.current),
30
+ validate: () => p(n.current),
29
31
  children: ({
30
32
  field: e,
31
- meta: h
32
- }) => /* @__PURE__ */ r(v, {
33
- ...V,
33
+ meta: v
34
+ }) => /* @__PURE__ */ a(x, {
35
+ ...$,
34
36
  ...e,
35
37
  className: i,
36
- disabled: n,
37
- error: h.error,
38
- label: o,
39
- onBlur: () => p(t),
40
- onChange: (F) => f(F.currentTarget.value),
38
+ disabled: s,
39
+ error: v.error,
40
+ label: l ? ({
41
+ ...o
42
+ }) => V({
43
+ as: "label",
44
+ tooltipText: l,
45
+ children: r,
46
+ ...o
47
+ }) : r,
48
+ onBlur: () => F(t),
49
+ onChange: (o) => h(o.currentTarget.value),
41
50
  placeholder: "0"
42
51
  })
43
52
  })
44
53
  });
45
54
  };
46
55
  export {
47
- D as MetadataFloatField,
48
- D as default
56
+ N as MetadataFloatField,
57
+ N as default
49
58
  };
@@ -1,45 +1,54 @@
1
- import { TooltipProvider as v, Combobox as F } from "@box/blueprint-web";
2
- import { useFormikContext as g, getIn as C, Field as x } from "formik";
3
- import { useIntl as M } from "react-intl";
4
- import $ from "../../../../messages.js";
5
- import { fieldDefaultProps as b } from "../constants.js";
1
+ import { TooltipProvider as F, Combobox as g } from "@box/blueprint-web";
2
+ import { useFormikContext as x, getIn as C, Field as b } from "formik";
3
+ import { useIntl as I } from "react-intl";
4
+ import M from "../../../../messages.js";
5
+ import T from "../../../interactive-text/interactive-text.js";
6
+ import { fieldDefaultProps as $ } from "../constants.js";
6
7
  import { jsx as o } from "react/jsx-runtime";
7
- const k = ({
8
+ const O = ({
8
9
  className: s,
9
- disableForm: a,
10
- fieldNamePrefix: l,
11
- label: r,
12
- portalElement: n,
13
- options: m
10
+ description: a,
11
+ disableForm: m,
12
+ fieldNamePrefix: i,
13
+ label: l,
14
+ portalElement: u,
15
+ options: d
14
16
  }) => {
15
17
  const {
16
- setFieldValue: u,
17
- values: d
18
- } = g(), c = M(), i = `${l}.value`, p = m || C(d, `${l}.options`, []).map(({
18
+ setFieldValue: c,
19
+ values: p
20
+ } = x(), f = I(), n = `${i}.value`, h = d || C(p, `${i}.options`, []).map(({
19
21
  key: e
20
- }) => e), f = (e, t) => t.toLowerCase().includes(e.toLowerCase());
22
+ }) => e), v = (e, t) => t.toLowerCase().includes(e.toLowerCase());
21
23
  return /* @__PURE__ */ o("div", {
22
- "data-testid": `${r}-field`,
23
- children: /* @__PURE__ */ o(x, {
24
- name: i,
24
+ "data-testid": `${l}-field`,
25
+ children: /* @__PURE__ */ o(b, {
26
+ name: n,
25
27
  children: ({
26
28
  field: e
27
29
  }) => {
28
30
  var t;
29
- return /* @__PURE__ */ o(v, {
30
- children: /* @__PURE__ */ o(F, {
31
- ...b,
31
+ return /* @__PURE__ */ o(F, {
32
+ children: /* @__PURE__ */ o(g, {
33
+ ...$,
32
34
  as: "input",
33
35
  className: s,
34
- disabled: a,
35
- filterFn: f,
36
- label: r,
36
+ disabled: m,
37
+ filterFn: v,
38
+ label: a ? ({
39
+ ...r
40
+ }) => T({
41
+ as: "label",
42
+ tooltipText: a,
43
+ children: l,
44
+ ...r
45
+ }) : l,
37
46
  multiselect: !0,
38
47
  name: e.name,
39
- onValueChange: (h) => u(i, h),
40
- options: p,
41
- placeholder: ((t = e.value) == null ? void 0 : t.length) === 0 ? c.formatMessage($.multiselectPlaceholder) : "",
42
- portalElement: n,
48
+ onValueChange: (r) => c(n, r),
49
+ options: h,
50
+ placeholder: ((t = e.value) == null ? void 0 : t.length) === 0 ? f.formatMessage(M.multiselectPlaceholder) : "",
51
+ portalElement: u,
43
52
  value: e.value
44
53
  })
45
54
  });
@@ -48,6 +57,6 @@ const k = ({
48
57
  });
49
58
  };
50
59
  export {
51
- k as MetadataMultiSelectField,
52
- k as default
60
+ O as MetadataMultiSelectField,
61
+ O as default
53
62
  };
@@ -1,37 +1,46 @@
1
- import { TextInput as s } from "@box/blueprint-web";
2
- import { Field as f } from "formik";
3
- import { useIntl as n } from "react-intl";
4
- import p from "../../../../messages.js";
5
- import { fieldDefaultProps as c } from "../constants.js";
6
- import { jsx as e } from "react/jsx-runtime";
7
- const u = ({
8
- label: r,
9
- fieldNamePrefix: t,
10
- disableForm: a,
11
- className: o
1
+ import { TextInput as n } from "@box/blueprint-web";
2
+ import { Field as p } from "formik";
3
+ import { useIntl as c } from "react-intl";
4
+ import u from "../../../../messages.js";
5
+ import h from "../../../interactive-text/interactive-text.js";
6
+ import { fieldDefaultProps as x } from "../constants.js";
7
+ import { jsx as t } from "react/jsx-runtime";
8
+ const g = ({
9
+ description: r,
10
+ label: e,
11
+ fieldNamePrefix: a,
12
+ disableForm: o,
13
+ className: i
12
14
  }) => {
13
- const i = n(), d = `${t}.value`;
14
- return /* @__PURE__ */ e("div", {
15
- "data-testid": `${r}-field`,
16
- children: /* @__PURE__ */ e(f, {
15
+ const l = c(), d = `${a}.value`;
16
+ return /* @__PURE__ */ t("div", {
17
+ "data-testid": `${e}-field`,
18
+ children: /* @__PURE__ */ t(p, {
17
19
  name: d,
18
20
  children: ({
19
- field: l,
20
- meta: m
21
- }) => /* @__PURE__ */ e(s, {
22
- ...c,
23
- ...l,
24
- className: o,
25
- disabled: a,
26
- error: m.error,
27
- label: r,
28
- placeholder: i.formatMessage(p.setValuePlaceholder)
21
+ field: m,
22
+ meta: s
23
+ }) => /* @__PURE__ */ t(n, {
24
+ ...x,
25
+ ...m,
26
+ className: i,
27
+ disabled: o,
28
+ error: s.error,
29
+ label: r ? ({
30
+ ...f
31
+ }) => h({
32
+ as: "label",
33
+ tooltipText: r,
34
+ children: e,
35
+ ...f
36
+ }) : e,
37
+ placeholder: l.formatMessage(u.setValuePlaceholder)
29
38
  })
30
39
  })
31
40
  });
32
41
  };
33
- u.displayName = "MetadataStringField";
42
+ g.displayName = "MetadataStringField";
34
43
  export {
35
- u as MetadataStringField,
36
- u as default
44
+ g as MetadataStringField,
45
+ g as default
37
46
  };
@@ -1,17 +1,16 @@
1
1
  import "../../../../../../styles/metadata-instance-entry.css";
2
2
  import { Text as o } from "@box/blueprint-web";
3
- import { FormattedDate as d } from "react-intl";
4
- import { convertISOStringToUTCDate as l } from "./convertDate.js";
5
- import y from "../../../interactive-text/interactive-text.js";
6
- import { jsxs as f, jsx as a } from "react/jsx-runtime";
7
- const I = "_metadataInstanceEntry_1qhk8_1", p = "_metadataInstanceEntryInteractiveLabel_1qhk8_7", c = {
8
- metadataInstanceEntry: I,
9
- metadataInstanceEntryInteractiveLabel: p
10
- }, _ = ({
11
- description: r,
3
+ import { FormattedDate as s } from "react-intl";
4
+ import { convertISOStringToUTCDate as d } from "./convertDate.js";
5
+ import f from "../../../interactive-text/interactive-text.js";
6
+ import { jsxs as y, jsx as r } from "react/jsx-runtime";
7
+ const l = "_metadataInstanceEntry_gwoh6_1", p = {
8
+ metadataInstanceEntry: l
9
+ }, S = ({
10
+ description: a,
12
11
  name: e,
13
12
  shouldHideEmptyValues: i,
14
- type: s,
13
+ type: c,
15
14
  value: t
16
15
  }) => {
17
16
  const n = (() => {
@@ -21,9 +20,9 @@ const I = "_metadataInstanceEntry_1qhk8_1", p = "_metadataInstanceEntryInteracti
21
20
  return null;
22
21
  if (Array.isArray(t))
23
22
  return t.join(", ");
24
- if (s === "date" && typeof t == "string") {
25
- const m = l(t);
26
- return /* @__PURE__ */ a(d, {
23
+ if (c === "date" && typeof t == "string") {
24
+ const m = d(t);
25
+ return /* @__PURE__ */ r(s, {
27
26
  day: "numeric",
28
27
  month: "long",
29
28
  value: m,
@@ -32,26 +31,25 @@ const I = "_metadataInstanceEntry_1qhk8_1", p = "_metadataInstanceEntryInteracti
32
31
  }
33
32
  return t;
34
33
  })();
35
- return i && !n ? null : /* @__PURE__ */ f("div", {
36
- className: c.metadataInstanceEntry,
37
- children: [/* @__PURE__ */ a(o, {
34
+ return i && !n ? null : /* @__PURE__ */ y("div", {
35
+ className: p.metadataInstanceEntry,
36
+ children: [/* @__PURE__ */ r(o, {
38
37
  as: "p",
39
38
  color: "textOnLightSecondary",
40
39
  variant: "bodyDefaultBold",
41
- children: r ? /* @__PURE__ */ a(y, {
40
+ children: a ? /* @__PURE__ */ r(f, {
42
41
  as: "span",
43
- className: c.metadataInstanceEntryInteractiveLabel,
44
42
  color: "textOnLightSecondary",
45
- tooltipText: r,
43
+ tooltipText: a,
46
44
  variant: "bodyDefaultBold",
47
45
  children: e
48
46
  }) : e
49
- }), n && /* @__PURE__ */ a(o, {
47
+ }), n && /* @__PURE__ */ r(o, {
50
48
  as: "p",
51
49
  children: n
52
50
  })]
53
51
  });
54
52
  };
55
53
  export {
56
- _ as MetadataInstanceEntry
54
+ S as MetadataInstanceEntry
57
55
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-editor",
3
- "version": "0.51.1",
3
+ "version": "0.51.2",
4
4
  "peerDependencies": {
5
5
  "@ariakit/react": "0.4.5",
6
6
  "@box/blueprint-web": "^7.20.0",
@@ -52,5 +52,5 @@
52
52
  "**/*.css"
53
53
  ],
54
54
  "license": "SEE LICENSE IN LICENSE",
55
- "gitHead": "114a9fc84dfc0b21d45b6b647064e736ea022384"
55
+ "gitHead": "fd714816101aaeb678900361350e92c6372cd03f"
56
56
  }
@@ -0,0 +1 @@
1
+ ._interactiveText_2jv0p_1{text-decoration:dashed underline var(--gray-50) .5px!important;text-underline-offset:2px;width:fit-content}._interactiveText_2jv0p_1:hover{color:var(--gray-100);text-decoration-color:var(--gray-100)!important}
@@ -1 +1 @@
1
- ._metadataInstanceEntry_1qhk8_1{display:flex;flex-direction:column;gap:var(--space-2)}._metadataInstanceEntryInteractiveLabel_1qhk8_7{text-decoration:dashed underline var(--gray-50) .5px!important;text-underline-offset:2px}._metadataInstanceEntryInteractiveLabel_1qhk8_7:hover{color:var(--gray-100);text-decoration-color:var(--gray-100)!important}
1
+ ._metadataInstanceEntry_gwoh6_1{display:flex;flex-direction:column;gap:var(--space-2)}
@@ -1,9 +1,10 @@
1
1
  import { type TextProps } from '@box/blueprint-web';
2
2
  export type InteractiveTextProps = TextProps & {
3
+ className?: string;
3
4
  tooltipText: string;
4
5
  };
5
6
  /**
6
7
  * Wrapper component for displaying tooltip content on focusing text nodes
7
8
  */
8
- declare const InteractiveText: ({ tooltipText, children, ...props }: InteractiveTextProps) => import("react/jsx-runtime").JSX.Element;
9
+ declare const InteractiveText: ({ tooltipText, className, children, ...props }: InteractiveTextProps) => import("react/jsx-runtime").JSX.Element;
9
10
  export default InteractiveText;
@@ -1,3 +1,3 @@
1
1
  import { type MetadataFieldProps } from '../../types';
2
- export declare const MetadataDateField: ({ disableForm, fieldNamePrefix, label, portalElement, className, }: MetadataFieldProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const MetadataDateField: ({ description, disableForm, fieldNamePrefix, label, portalElement, className, }: MetadataFieldProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default MetadataDateField;
@@ -1,3 +1,3 @@
1
1
  import { type MetadataFieldProps } from '../../types';
2
- export declare const MetadataEnumField: ({ className, disableForm, fieldNamePrefix, label, options, portalElement, }: MetadataFieldProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const MetadataEnumField: ({ className, description, disableForm, fieldNamePrefix, label, options, portalElement, }: MetadataFieldProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default MetadataEnumField;
@@ -1,3 +1,3 @@
1
1
  import { type MetadataFieldProps } from '../../types';
2
- export declare const MetadataFloatField: ({ label, fieldNamePrefix, disableForm, className }: MetadataFieldProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const MetadataFloatField: ({ className, description, label, fieldNamePrefix, disableForm, }: MetadataFieldProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default MetadataFloatField;
@@ -1,3 +1,3 @@
1
1
  import { type MetadataFieldProps } from '../../types';
2
- export declare const MetadataMultiSelectField: ({ className, disableForm, fieldNamePrefix, label, portalElement, options, }: MetadataFieldProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const MetadataMultiSelectField: ({ className, description, disableForm, fieldNamePrefix, label, portalElement, options, }: MetadataFieldProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default MetadataMultiSelectField;
@@ -1,6 +1,6 @@
1
1
  import { type MetadataFieldProps } from '../../types';
2
2
  export declare const MetadataStringField: {
3
- ({ label, fieldNamePrefix, disableForm, className }: MetadataFieldProps): import("react/jsx-runtime").JSX.Element;
3
+ ({ description, label, fieldNamePrefix, disableForm, className, }: MetadataFieldProps): import("react/jsx-runtime").JSX.Element;
4
4
  displayName: string;
5
5
  };
6
6
  export default MetadataStringField;
@@ -4,6 +4,7 @@ export type TemplateInstanceProps = {
4
4
  portalElement?: HTMLElement;
5
5
  };
6
6
  export type MetadataFieldProps = {
7
+ description?: string | null;
7
8
  label: string;
8
9
  fieldNamePrefix: string;
9
10
  disableForm: boolean;
@@ -1,4 +1,4 @@
1
- import { type MetadataTemplate, type MetadataTemplateField, type MetadataTemplateInstance, type MetadataTemplateOption, type AutofillSuggestions } from '../types';
1
+ import { type AutofillSuggestions, type MetadataTemplate, type MetadataTemplateField, type MetadataTemplateInstance, type MetadataTemplateOption } from '../types';
2
2
  declare const stringField: MetadataTemplateField;
3
3
  declare const dateField: MetadataTemplateField;
4
4
  declare const enumField: MetadataTemplateField;