@box/metadata-filter 1.25.2 → 1.26.0

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 (61) hide show
  1. package/dist/chunks/use-float-validation.js +21 -18
  2. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field-advanced.js +37 -36
  3. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field-relative.js +42 -41
  4. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field.js +34 -33
  5. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-enum-field/metadata-enum-field.js +21 -19
  6. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/metadata-float-field-advanced.js +30 -29
  7. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/metadata-float-field.js +20 -19
  8. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field-advanced.js +35 -34
  9. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +25 -23
  10. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-string-field/metadata-string-field.js +47 -46
  11. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +40 -38
  12. package/dist/esm/lib/components/metadata-filter-fields/field-processing-utils.js +19 -0
  13. package/dist/esm/lib/components/metadata-filter-fields/metadata-filter-fields-accordion.js +82 -0
  14. package/dist/esm/lib/components/metadata-filter-fields/metadata-filter-fields.js +52 -43
  15. package/dist/esm/lib/messages.js +8 -0
  16. package/dist/esm/lib/metadata-filter.js +45 -42
  17. package/dist/i18n/bn-IN.js +2 -0
  18. package/dist/i18n/da-DK.js +2 -0
  19. package/dist/i18n/de-DE.js +2 -0
  20. package/dist/i18n/en-AU.js +2 -0
  21. package/dist/i18n/en-CA.js +2 -0
  22. package/dist/i18n/en-GB.js +2 -0
  23. package/dist/i18n/en-US.js +2 -0
  24. package/dist/i18n/en-US.properties +4 -0
  25. package/dist/i18n/en-x-pseudo.js +2 -0
  26. package/dist/i18n/es-419.js +2 -0
  27. package/dist/i18n/es-ES.js +2 -0
  28. package/dist/i18n/fi-FI.js +2 -0
  29. package/dist/i18n/fr-CA.js +2 -0
  30. package/dist/i18n/fr-FR.js +2 -0
  31. package/dist/i18n/hi-IN.js +2 -0
  32. package/dist/i18n/it-IT.js +2 -0
  33. package/dist/i18n/ja-JP.js +2 -0
  34. package/dist/i18n/json/src/lib/messages.json +1 -1
  35. package/dist/i18n/ko-KR.js +2 -0
  36. package/dist/i18n/nb-NO.js +2 -0
  37. package/dist/i18n/nl-NL.js +2 -0
  38. package/dist/i18n/pl-PL.js +2 -0
  39. package/dist/i18n/pt-BR.js +2 -0
  40. package/dist/i18n/ru-RU.js +2 -0
  41. package/dist/i18n/sv-SE.js +2 -0
  42. package/dist/i18n/tr-TR.js +2 -0
  43. package/dist/i18n/zh-CN.js +2 -0
  44. package/dist/i18n/zh-TW.js +2 -0
  45. package/dist/types/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field-advanced.d.ts +1 -1
  46. package/dist/types/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field-relative.d.ts +1 -1
  47. package/dist/types/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field.d.ts +1 -1
  48. package/dist/types/lib/components/metadata-filter-fields/components/metadata-enum-field/metadata-enum-field.d.ts +1 -1
  49. package/dist/types/lib/components/metadata-filter-fields/components/metadata-float-field/metadata-float-field-advanced.d.ts +1 -1
  50. package/dist/types/lib/components/metadata-filter-fields/components/metadata-float-field/metadata-float-field.d.ts +1 -1
  51. package/dist/types/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field-advanced.d.ts +1 -1
  52. package/dist/types/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field.d.ts +1 -1
  53. package/dist/types/lib/components/metadata-filter-fields/components/metadata-string-field/metadata-string-field.d.ts +1 -1
  54. package/dist/types/lib/components/metadata-filter-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.d.ts +1 -1
  55. package/dist/types/lib/components/metadata-filter-fields/field-processing-utils.d.ts +26 -0
  56. package/dist/types/lib/components/metadata-filter-fields/metadata-filter-fields-accordion.d.ts +3 -0
  57. package/dist/types/lib/components/metadata-filter-fields/types.d.ts +2 -0
  58. package/dist/types/lib/messages.d.ts +10 -0
  59. package/dist/types/lib/metadata-filter.d.ts +1 -1
  60. package/dist/types/lib/types.d.ts +1 -0
  61. package/package.json +4 -4
@@ -1,66 +1,67 @@
1
1
  import { TextInput as N } from "@box/blueprint-web";
2
- import { Field as B } from "formik";
2
+ import { Field as $ } from "formik";
3
3
  import { useState as S, useCallback as F } from "react";
4
- import { useIntl as $ } from "react-intl";
4
+ import { useIntl as k } from "react-intl";
5
5
  import u from "../../../../messages.js";
6
6
  import { R as d } from "../../../../../../chunks/types.js";
7
7
  import { fieldDefaultProps as b } from "../constants.js";
8
- import { createAdvancedFilterOptionHandler as k, createInputChangeHandler as V } from "./handlers.js";
8
+ import { createAdvancedFilterOptionHandler as G, createInputChangeHandler as V } from "./handlers.js";
9
9
  import { s as c } from "../../../../../../chunks/metadata-float-field.module.js";
10
- import { u as G } from "../../../../../../chunks/use-float-validation.js";
11
- import { FloatAdvancedFilterOption as Q, getInputValues as y, getInputDisplayState as U, FloatInputDisplayState as I } from "./utils.js";
12
- import { jsx as n, jsxs as A, Fragment as q } from "react/jsx-runtime";
13
- import { A as z } from "../../../../../../chunks/index.js";
14
- const le = ({
10
+ import { u as Q } from "../../../../../../chunks/use-float-validation.js";
11
+ import { FloatAdvancedFilterOption as U, getInputValues as y, getInputDisplayState as q, FloatInputDisplayState as I } from "./utils.js";
12
+ import { jsx as n, jsxs as A, Fragment as z } from "react/jsx-runtime";
13
+ import { A as J } from "../../../../../../chunks/index.js";
14
+ const se = ({
15
15
  label: m,
16
16
  fieldNamePrefix: C,
17
17
  disableForm: p,
18
18
  onAdvancedFilterOptionChange: h,
19
19
  fieldAdvancedFilterOptions: O,
20
- filterOptionsMap: E
20
+ filterOptionsMap: E,
21
+ hasAccordion: R
21
22
  }) => {
22
- const s = $(), o = `${C}.value.enum[0]`, [R, L] = S(d.FROM), [l, M] = S(O || Q.EQUALS), {
23
+ const s = k(), o = `${C}.value.enum[0]`, [w, L] = S(d.FROM), [l, M] = S(O || U.EQUALS), {
23
24
  validateFloats: f
24
- } = G(), w = F((r, t, a, e) => k(o, h, M)(r, t, a, e), [o, h, M]), x = F((r, t, a) => V(o, l, L, d.FROM)(r, t, a), [o, l]), D = F((r, t, a) => V(o, l, L, d.TO)(r, t, a), [o, l]);
25
+ } = Q(), x = F((a, t, r, e) => G(o, h, M)(a, t, r, e), [o, h, M]), D = F((a, t, r) => V(o, l, L, d.FROM)(a, t, r), [o, l]), H = F((a, t, r) => V(o, l, L, d.TO)(a, t, r), [o, l]);
25
26
  return /* @__PURE__ */ n("div", {
26
27
  className: c.advancedFilterContainer,
27
28
  "data-testid": `${m}-field`,
28
- children: /* @__PURE__ */ n(B, {
29
+ children: /* @__PURE__ */ n($, {
29
30
  name: o,
30
- validate: (r) => {
31
- const t = y(r, !0);
32
- return f(t.from, t.to, R, !0);
31
+ validate: (a) => {
32
+ const t = y(a, !0);
33
+ return f(t.from, t.to, w, !0);
33
34
  },
34
35
  children: ({
35
- field: r,
36
+ field: a,
36
37
  meta: t,
37
- form: a
38
+ form: r
38
39
  }) => {
39
- const e = y(r.value, !0), g = U(l), H = g !== I.NONE, T = g === I.SINGLE, v = g === I.BOTH, P = f(e.from, e.to, d.FROM, !0), j = f(e.from, e.to, d.TO, !0);
40
- return /* @__PURE__ */ A(q, {
41
- children: [/* @__PURE__ */ n(z, {
40
+ const e = y(a.value, !0), g = q(l), P = g !== I.NONE, T = g === I.SINGLE, v = g === I.BOTH, j = f(e.from, e.to, d.FROM, !0), B = f(e.from, e.to, d.TO, !0);
41
+ return /* @__PURE__ */ A(z, {
42
+ children: [/* @__PURE__ */ n(J, {
42
43
  disableForm: p,
43
44
  fieldAdvancedFilterOptions: O,
44
45
  fieldNamePrefix: C,
45
46
  filterOptionsMap: E,
46
47
  label: m,
47
48
  onAdvancedFilterOptionChange: h,
48
- onValueChange: (i) => w(i, e.from, e.to, a),
49
- showLabel: !0,
49
+ onValueChange: (i) => x(i, e.from, e.to, r),
50
+ showLabel: !R,
50
51
  value: l
51
- }), H && /* @__PURE__ */ A("div", {
52
+ }), P && /* @__PURE__ */ A("div", {
52
53
  className: c.rangeInputsContainer,
53
54
  children: [(T || v) && /* @__PURE__ */ n("div", {
54
55
  className: c.inputContainer,
55
56
  children: /* @__PURE__ */ n(N, {
56
57
  ...b,
57
58
  disabled: p,
58
- error: T ? t.error : P,
59
+ error: T ? t.error : j,
59
60
  hideLabel: !0,
60
61
  label: s.formatMessage(u.fieldFromLabel, {
61
62
  label: m
62
63
  }),
63
- onChange: (i) => x(i.currentTarget.value, e.to, a),
64
+ onChange: (i) => D(i.currentTarget.value, e.to, r),
64
65
  placeholder: v ? s.formatMessage(u.minValuePlaceholder) : s.formatMessage(u.enterNumberPlaceholder),
65
66
  value: e.from
66
67
  })
@@ -69,12 +70,12 @@ const le = ({
69
70
  children: /* @__PURE__ */ n(N, {
70
71
  ...b,
71
72
  disabled: p,
72
- error: j,
73
+ error: B,
73
74
  hideLabel: !0,
74
75
  label: s.formatMessage(u.fieldToLabel, {
75
76
  label: m
76
77
  }),
77
- onChange: (i) => D(i.currentTarget.value, e.from, a),
78
+ onChange: (i) => H(i.currentTarget.value, e.from, r),
78
79
  placeholder: s.formatMessage(u.maxValuePlaceholder),
79
80
  value: e.to
80
81
  })
@@ -86,6 +87,6 @@ const le = ({
86
87
  });
87
88
  };
88
89
  export {
89
- le as MetadataFloatFieldAdvanced,
90
- le as default
90
+ se as MetadataFloatFieldAdvanced,
91
+ se as default
91
92
  };
@@ -1,37 +1,38 @@
1
- import { Text as D, TextInput as y } from "@box/blueprint-web";
2
- import { useFormikContext as P, getIn as M, Field as E } from "formik";
3
- import { useState as S, useRef as V } from "react";
4
- import { useIntl as k } from "react-intl";
1
+ import { Text as P, TextInput as y } from "@box/blueprint-web";
2
+ import { useFormikContext as S, getIn as M, Field as E } from "formik";
3
+ import { useState as k, useRef as V } from "react";
4
+ import { useIntl as A } from "react-intl";
5
5
  import x from "../../../../messages.js";
6
6
  import { R as r } from "../../../../../../chunks/types.js";
7
7
  import { fieldDefaultProps as L } from "../constants.js";
8
8
  import { s as i } from "../../../../../../chunks/metadata-float-field.module.js";
9
- import { u as A, E as G } from "../../../../../../chunks/use-float-validation.js";
9
+ import { u as G, E as H } from "../../../../../../chunks/use-float-validation.js";
10
10
  import { jsxs as N, jsx as t } from "react/jsx-runtime";
11
- const Y = ({
11
+ const Z = ({
12
12
  label: n,
13
13
  fieldNamePrefix: m,
14
- disableForm: f
14
+ disableForm: f,
15
+ hasAccordion: I
15
16
  }) => {
16
- const p = k(), [h, d] = S(r.FROM), {
17
+ const p = A(), [h, d] = k(r.FROM), {
17
18
  values: g,
18
19
  setFieldValue: F,
19
- setFieldTouched: I
20
- } = P(), l = `${m}.value.range.gt`, s = `${m}.value.range.lt`, $ = M(g, l), b = M(g, s), c = V($), u = V(b), {
20
+ setFieldTouched: $
21
+ } = S(), l = `${m}.value.range.gt`, s = `${m}.value.range.lt`, b = M(g, l), B = M(g, s), c = V(b), u = V(B), {
21
22
  validateFloats: T,
22
23
  fromErrorType: O,
23
24
  toErrorType: v
24
- } = A(), B = (e) => {
25
+ } = G(), j = (e) => {
25
26
  c.current = e, F(l, e), d(r.FROM);
26
- }, j = (e) => {
27
+ }, D = (e) => {
27
28
  u.current = e, F(s, e), d(r.TO);
28
29
  }, R = (e, o) => {
29
- I(e, !0), d(o);
30
- }, C = (e, o, a) => !!(e === G.OVERLAPPING && a);
30
+ $(e, !0), d(o);
31
+ }, C = (e, o, a) => !!(e === H.OVERLAPPING && a);
31
32
  return /* @__PURE__ */ N("div", {
32
33
  className: i.container,
33
34
  "data-testid": `${n}-field`,
34
- children: [/* @__PURE__ */ t(D, {
35
+ children: [!I && /* @__PURE__ */ t(P, {
35
36
  as: "span",
36
37
  color: "textOnLightSecondary",
37
38
  variant: "bodyDefaultBold",
@@ -55,7 +56,7 @@ const Y = ({
55
56
  label: n
56
57
  }),
57
58
  onBlur: () => R(l, r.FROM),
58
- onChange: (a) => B(a.currentTarget.value),
59
+ onChange: (a) => j(a.currentTarget.value),
59
60
  placeholder: "0"
60
61
  })
61
62
  })
@@ -76,7 +77,7 @@ const Y = ({
76
77
  label: n
77
78
  }),
78
79
  onBlur: () => R(s, r.TO),
79
- onChange: (a) => j(a.currentTarget.value),
80
+ onChange: (a) => D(a.currentTarget.value),
80
81
  placeholder: "0"
81
82
  })
82
83
  })
@@ -85,6 +86,6 @@ const Y = ({
85
86
  });
86
87
  };
87
88
  export {
88
- Y as MetadataFloatField,
89
- Y as default
89
+ Z as MetadataFloatField,
90
+ Z as default
90
91
  };
@@ -1,13 +1,13 @@
1
- import { TooltipProvider as T, Combobox as D } from "@box/blueprint-web";
2
- import { useFormikContext as P, getIn as U, Field as q } from "formik";
1
+ import { TooltipProvider as D, Combobox as P } from "@box/blueprint-web";
2
+ import { useFormikContext as U, getIn as q, Field as v } from "formik";
3
3
  import { useState as f, useCallback as p } from "react";
4
- import { useIntl as v } from "react-intl";
5
- import z from "../../../../messages.js";
6
- import { fieldDefaultProps as G } from "../constants.js";
7
- import { getInitialAdvancedFilterValue as H, createFieldValue as k, getInputValue as J } from "./utils.js";
8
- import { jsx as a, jsxs as K, Fragment as N } from "react/jsx-runtime";
9
- import { A as Q } from "../../../../../../chunks/index.js";
10
- const x = (t) => t === "isBlank" || t === "isNotBlank", te = ({
4
+ import { useIntl as z } from "react-intl";
5
+ import G from "../../../../messages.js";
6
+ import { fieldDefaultProps as H } from "../constants.js";
7
+ import { getInitialAdvancedFilterValue as J, createFieldValue as k, getInputValue as K } from "./utils.js";
8
+ import { jsx as a, jsxs as N, Fragment as Q } from "react/jsx-runtime";
9
+ import { A as R } from "../../../../../../chunks/index.js";
10
+ const x = (t) => t === "isBlank" || t === "isNotBlank", se = ({
11
11
  label: t,
12
12
  fieldNamePrefix: m,
13
13
  disableForm: h,
@@ -15,61 +15,62 @@ const x = (t) => t === "isBlank" || t === "isNotBlank", te = ({
15
15
  onAdvancedFilterOptionChange: l,
16
16
  fieldAdvancedFilterOptions: g,
17
17
  filterOptionsMap: V,
18
- portalElement: C
18
+ portalElement: C,
19
+ hasAccordion: I
19
20
  }) => {
20
21
  const {
21
- setFieldValue: I,
22
- values: S
23
- } = P(), w = v(), n = `${m}.value.enum`, L = U(S, `${m}.options`, []).map((e) => e == null ? void 0 : e.key).filter((e) => typeof e == "string"), [c, y] = f(H(g, V)), [B, d] = f(!1), [O, b] = f(!1), $ = (e, s) => typeof s != "string" ? !1 : s.toLowerCase().includes(e.toLowerCase()), j = p((e, s, o) => {
24
- y(e), l == null || l(n, e);
22
+ setFieldValue: S,
23
+ values: w
24
+ } = U(), L = z(), n = `${m}.value.enum`, y = q(w, `${m}.options`, []).map((e) => e == null ? void 0 : e.key).filter((e) => typeof e == "string"), [c, B] = f(J(g, V)), [O, d] = f(!1), [$, b] = f(!1), j = (e, s) => typeof s != "string" ? !1 : s.toLowerCase().includes(e.toLowerCase()), F = p((e, s, o) => {
25
+ B(e), l == null || l(n, e);
25
26
  const r = x(e) ? [] : s, i = k(r, e, u);
26
27
  o.setFieldValue(n, i);
27
- }, [n, u, l]), F = p((e) => {
28
+ }, [n, u, l]), M = p((e) => {
28
29
  d(e), e && b(!1);
29
- }, []), M = p((e) => {
30
+ }, []), T = p((e) => {
30
31
  b(e), e && d(!1);
31
32
  }, []);
32
33
  return /* @__PURE__ */ a("div", {
33
34
  "data-testid": `${t}-field`,
34
- children: /* @__PURE__ */ a(q, {
35
+ children: /* @__PURE__ */ a(v, {
35
36
  name: n,
36
37
  children: ({
37
38
  field: e,
38
39
  form: s
39
40
  }) => {
40
- const o = J(e.value, u);
41
- return /* @__PURE__ */ K(N, {
42
- children: [/* @__PURE__ */ a(Q, {
41
+ const o = K(e.value, u);
42
+ return /* @__PURE__ */ N(Q, {
43
+ children: [/* @__PURE__ */ a(R, {
43
44
  disableForm: h,
44
45
  fieldAdvancedFilterOptions: g,
45
46
  fieldNamePrefix: m,
46
47
  filterOptionsMap: V,
47
48
  label: t,
48
49
  onAdvancedFilterOptionChange: l,
49
- onOpenChange: M,
50
- onValueChange: (r) => j(r, o, s),
51
- open: O,
50
+ onOpenChange: T,
51
+ onValueChange: (r) => F(r, o, s),
52
+ open: $,
52
53
  portalElement: C,
53
- showLabel: !0,
54
+ showLabel: !I,
54
55
  value: c
55
- }), !x(c) && /* @__PURE__ */ a(T, {
56
- children: /* @__PURE__ */ a(D, {
57
- ...G,
56
+ }), !x(c) && /* @__PURE__ */ a(D, {
57
+ children: /* @__PURE__ */ a(P, {
58
+ ...H,
58
59
  as: "input",
59
60
  disabled: h,
60
- filterFn: $,
61
+ filterFn: j,
61
62
  hideLabel: !0,
62
63
  label: t,
63
64
  multiselect: !0,
64
65
  name: e.name,
65
- onOpenChange: F,
66
+ onOpenChange: M,
66
67
  onValueChange: (r) => {
67
68
  const i = k(r, c, u);
68
- I(n, i);
69
+ S(n, i);
69
70
  },
70
- open: B,
71
- options: L,
72
- placeholder: !o || o.length === 0 ? w.formatMessage(z.multiselectPlaceholder) : "",
71
+ open: O,
72
+ options: y,
73
+ placeholder: !o || o.length === 0 ? L.formatMessage(G.multiselectPlaceholder) : "",
73
74
  portalElement: C,
74
75
  value: o
75
76
  })
@@ -80,5 +81,5 @@ const x = (t) => t === "isBlank" || t === "isNotBlank", te = ({
80
81
  });
81
82
  };
82
83
  export {
83
- te as MetadataMultiSelectFieldAdvanced
84
+ se as MetadataMultiSelectFieldAdvanced
84
85
  };
@@ -1,46 +1,48 @@
1
- import { TooltipProvider as f, Combobox as h } from "@box/blueprint-web";
2
- import { useFormikContext as v, getIn as F, Field as g } from "formik";
3
- import { useIntl as C } from "react-intl";
1
+ import { TooltipProvider as h, Combobox as v } from "@box/blueprint-web";
2
+ import { useFormikContext as F, getIn as g, Field as C } from "formik";
3
+ import { useIntl as b } from "react-intl";
4
4
  import x from "../../../../messages.js";
5
- import { fieldDefaultProps as M } from "../constants.js";
5
+ import { fieldDefaultProps as L } from "../constants.js";
6
6
  import { jsx as o } from "react/jsx-runtime";
7
- const V = ({
8
- disableForm: n,
7
+ const j = ({
8
+ disableForm: i,
9
9
  fieldNamePrefix: l,
10
10
  label: r,
11
- portalElement: s
11
+ portalElement: n,
12
+ hasAccordion: s
12
13
  }) => {
13
14
  const {
14
- setFieldValue: i,
15
- values: m
16
- } = v(), u = C(), a = `${l}.value.enum`, d = F(m, `${l}.options`, []).map(({
15
+ setFieldValue: m,
16
+ values: u
17
+ } = F(), d = b(), a = `${l}.value.enum`, c = g(u, `${l}.options`, []).map(({
17
18
  key: e
18
- }) => e), c = (e, t) => t.toLowerCase().includes(e.toLowerCase());
19
+ }) => e), p = (e, t) => t.toLowerCase().includes(e.toLowerCase());
19
20
  return /* @__PURE__ */ o("div", {
20
21
  "data-testid": `${r}-field`,
21
- children: /* @__PURE__ */ o(g, {
22
+ children: /* @__PURE__ */ o(C, {
22
23
  name: a,
23
24
  children: ({
24
25
  field: e
25
26
  }) => {
26
27
  var t;
27
- return /* @__PURE__ */ o(f, {
28
- children: /* @__PURE__ */ o(h, {
29
- ...M,
28
+ return /* @__PURE__ */ o(h, {
29
+ children: /* @__PURE__ */ o(v, {
30
+ ...L,
30
31
  as: "input",
31
- disabled: n,
32
- filterFn: c,
32
+ disabled: i,
33
+ filterFn: p,
34
+ hideLabel: s,
33
35
  label: r,
34
36
  multiselect: !0,
35
37
  name: e.name,
36
- onValueChange: (p) => i(a, p),
37
- options: d,
38
+ onValueChange: (f) => m(a, f),
39
+ options: c,
38
40
  placeholder: (
39
41
  // Empty array must be substituded if there is no value found
40
42
  // Otherwise an no placeholder appears despite no selection
41
- ((t = e.value || []) == null ? void 0 : t.length) === 0 ? u.formatMessage(x.multiselectPlaceholder) : ""
43
+ ((t = e.value || []) == null ? void 0 : t.length) === 0 ? d.formatMessage(x.multiselectPlaceholder) : ""
42
44
  ),
43
- portalElement: s,
45
+ portalElement: n,
44
46
  value: e.value
45
47
  })
46
48
  });
@@ -49,6 +51,6 @@ const V = ({
49
51
  });
50
52
  };
51
53
  export {
52
- V as MetadataMultiSelectField,
53
- V as default
54
+ j as MetadataMultiSelectField,
55
+ j as default
54
56
  };
@@ -1,71 +1,72 @@
1
- import { TextInput as M } from "@box/blueprint-web";
2
- import { Field as T } from "formik";
3
- import { useState as j, useCallback as i } from "react";
4
- import { useIntl as $ } from "react-intl";
5
- import n from "../../../../messages.js";
6
- import { fieldDefaultProps as k } from "../constants.js";
7
- import { getInitialAdvancedFilterValue as y, createFieldValue as x, getInputValue as D, shouldHideTextInput as H } from "./utils.js";
8
- import { jsx as p, jsxs as N, Fragment as P } from "react/jsx-runtime";
9
- import { A as q } from "../../../../../../chunks/index.js";
10
- const z = ({
11
- label: m,
1
+ import { TextInput as T } from "@box/blueprint-web";
2
+ import { Field as j } from "formik";
3
+ import { useState as $, useCallback as n } from "react";
4
+ import { useIntl as k } from "react-intl";
5
+ import x from "../../../../messages.js";
6
+ import { fieldDefaultProps as y } from "../constants.js";
7
+ import { getInitialAdvancedFilterValue as D, createFieldValue as w, getInputValue as H, shouldHideTextInput as N } from "./utils.js";
8
+ import { jsx as p, jsxs as P, Fragment as q } from "react/jsx-runtime";
9
+ import { A as z } from "../../../../../../chunks/index.js";
10
+ const B = ({
11
+ label: s,
12
12
  fieldNamePrefix: f,
13
- disableForm: c,
13
+ disableForm: g,
14
14
  isAdvancedFilterEnabled: t,
15
15
  onAdvancedFilterOptionChange: o,
16
16
  fieldAdvancedFilterOptions: h,
17
- filterOptionsMap: g
17
+ filterOptionsMap: I,
18
+ hasAccordion: c
18
19
  }) => {
19
- const I = $(), r = `${f}.value.enum[0]`, [l, w] = j(y(h, g)), S = i((e, s, a) => {
20
- w(e), o == null || o(r, e);
21
- const u = x(s, e, t);
22
- a.setFieldValue(r, u);
23
- }, [r, t, o]), L = i((e, s) => {
24
- const a = e.target.value, u = x(a, l, t);
25
- s.setFieldValue(r, u);
20
+ const i = k(), r = `${f}.value.enum[0]`, [l, S] = $(D(h, I)), L = n((e, m, u) => {
21
+ S(e), o == null || o(r, e);
22
+ const a = w(m, e, t);
23
+ u.setFieldValue(r, a);
24
+ }, [r, t, o]), M = n((e, m) => {
25
+ const u = e.target.value, a = w(u, l, t);
26
+ m.setFieldValue(r, a);
26
27
  }, [l, t, r]);
27
28
  return /* @__PURE__ */ p("div", {
28
- "data-testid": `${m}-field`,
29
- children: /* @__PURE__ */ p(T, {
29
+ "data-testid": `${s}-field`,
30
+ children: /* @__PURE__ */ p(j, {
30
31
  name: r,
31
32
  children: ({
32
33
  field: e,
33
- meta: s,
34
- form: a
34
+ meta: m,
35
+ form: u
35
36
  }) => {
36
- const u = D(e.value, t);
37
- return /* @__PURE__ */ N(P, {
38
- children: [t && /* @__PURE__ */ p(q, {
39
- disableForm: c,
37
+ const a = H(e.value, t);
38
+ return /* @__PURE__ */ P(q, {
39
+ children: [t && /* @__PURE__ */ p(z, {
40
+ disableForm: g,
40
41
  fieldAdvancedFilterOptions: h,
41
42
  fieldNamePrefix: f,
42
- filterOptionsMap: g,
43
- label: m,
43
+ filterOptionsMap: I,
44
+ label: s,
44
45
  onAdvancedFilterOptionChange: o,
45
- onValueChange: (V) => S(V, u, a),
46
- showLabel: t,
46
+ onValueChange: (V) => L(V, a, u),
47
+ showLabel: t && !c,
47
48
  value: l
48
- }), !H(t, l) && /* @__PURE__ */ p(M, {
49
- ...k,
49
+ }), !N(t, l) && /* @__PURE__ */ p(T, {
50
+ ...y,
50
51
  ...e,
51
- "aria-label": I.formatMessage(n.enterValueAriaLabel, {
52
- label: m
52
+ "aria-label": i.formatMessage(x.enterValueAriaLabel, {
53
+ label: s
53
54
  }),
54
- disabled: c,
55
- error: s.error,
56
- hideLabel: t,
57
- label: m,
58
- onChange: (V) => L(V, a),
59
- placeholder: I.formatMessage(n.setValuePlaceholder),
60
- value: u
55
+ disabled: g,
56
+ error: m.error,
57
+ hideLabel: t || c,
58
+ label: s,
59
+ onChange: (V) => M(V, u),
60
+ placeholder: i.formatMessage(x.setValuePlaceholder),
61
+ value: a
61
62
  })]
62
63
  });
63
64
  }
64
65
  })
65
66
  });
66
67
  };
67
- z.displayName = "MetadataStringField";
68
+ B.displayName = "MetadataStringField";
68
69
  export {
69
- z as MetadataStringField,
70
- z as default
70
+ B as MetadataStringField,
71
+ B as default
71
72
  };
@@ -1,60 +1,62 @@
1
- import { ComboboxWithApiTreeView as T, ComboboxWithApiPagination as A } from "@box/combobox-with-api";
2
- import { useFormikContext as I, getIn as P, Field as W } from "formik";
3
- import { useCallback as $ } from "react";
4
- import { useIntl as b } from "react-intl";
5
- import j from "../../../../messages.js";
1
+ import { ComboboxWithApiTreeView as T, ComboboxWithApiPagination as I } from "@box/combobox-with-api";
2
+ import { useFormikContext as P, getIn as W, Field as $ } from "formik";
3
+ import { useCallback as j } from "react";
4
+ import { useIntl as w } from "react-intl";
5
+ import A from "../../../../messages.js";
6
6
  import { jsx as e } from "react/jsx-runtime";
7
- const B = ({
7
+ const D = ({
8
8
  className: m,
9
- disableForm: u,
10
- fieldNamePrefix: l,
11
- label: n,
9
+ disableForm: l,
10
+ fieldNamePrefix: u,
11
+ label: a,
12
12
  portalElement: d,
13
13
  taxonomyOptionsFetcher: s,
14
- isMultilevelTaxonomyFieldEnabled: C
14
+ isMultilevelTaxonomyFieldEnabled: k,
15
+ hasAccordion: p
15
16
  }) => {
16
17
  const {
17
18
  setFieldValue: c,
18
- values: p
19
- } = I(), {
19
+ values: h
20
+ } = P(), {
20
21
  metadata: {
21
- templateKey: h,
22
- scope: v
22
+ templateKey: v,
23
+ scope: g
23
24
  }
24
- } = p, k = b(), a = `${l}.value`, y = P(p, l), {
25
- key: g,
25
+ } = h, y = w(), i = `${u}.value`, F = W(h, u), {
26
+ key: f,
26
27
  optionsRules: {
27
- multiSelect: i,
28
+ multiSelect: n,
28
29
  selectableLevels: t
29
30
  },
30
- levels: F
31
- } = y, M = C && (t == null ? void 0 : t.some((o) => o > 1)), f = $((o) => s(v, h, g, t == null ? void 0 : t[0], o), [g, v, t, s, h]), x = (o) => i || !(o != null && o.length) ? k.formatMessage(j.taxonomyPlaceholder) : void 0;
31
+ levels: b
32
+ } = F, M = k && (t == null ? void 0 : t.some((o) => o > 1)), x = j((o) => s(g, v, f, t == null ? void 0 : t[0], o), [f, g, t, s, v]), C = (o) => n || !(o != null && o.length) ? y.formatMessage(A.taxonomyPlaceholder) : void 0;
32
33
  return /* @__PURE__ */ e("div", {
33
- "data-testid": `${n}-field`,
34
- children: /* @__PURE__ */ e(W, {
35
- name: a,
34
+ "data-testid": `${a}-field`,
35
+ children: /* @__PURE__ */ e($, {
36
+ name: i,
36
37
  children: ({
37
38
  field: o
38
39
  }) => M ? /* @__PURE__ */ e(T, {
39
40
  className: m,
40
- defaultFetcher: f,
41
- disabled: u,
42
- label: n,
43
- levels: F,
44
- multiselect: i,
45
- onValueChange: (r) => c(a, r),
46
- placeholder: x(o.value),
41
+ defaultFetcher: x,
42
+ disabled: l,
43
+ hideLabel: p,
44
+ label: a,
45
+ levels: b,
46
+ multiselect: n,
47
+ onValueChange: (r) => c(i, r),
48
+ placeholder: C(o.value),
47
49
  portalElement: d,
48
50
  selectableLevels: t,
49
51
  value: o.value
50
- }) : /* @__PURE__ */ e(A, {
52
+ }) : /* @__PURE__ */ e(I, {
51
53
  className: m,
52
- defaultFetcher: f,
53
- disabled: u,
54
- label: n,
55
- multiselect: i,
56
- onValueChange: (r) => c(a, r),
57
- placeholder: x(o.value),
54
+ defaultFetcher: x,
55
+ disabled: l,
56
+ label: p ? void 0 : a,
57
+ multiselect: n,
58
+ onValueChange: (r) => c(i, r),
59
+ placeholder: C(o.value),
58
60
  portalElement: d,
59
61
  value: o.value
60
62
  })
@@ -62,6 +64,6 @@ const B = ({
62
64
  });
63
65
  };
64
66
  export {
65
- B as MetadataTaxonomyField,
66
- B as default
67
+ D as MetadataTaxonomyField,
68
+ D as default
67
69
  };
@@ -0,0 +1,19 @@
1
+ import t from "../../messages.js";
2
+ import { filterFieldTypes as d, advancedFilterFieldTypes as m } from "./filter-field-types.js";
3
+ const c = ({
4
+ field: a,
5
+ isAdvancedFilterEnabled: s,
6
+ intl: e,
7
+ filterOptionsMap: r
8
+ }) => {
9
+ const o = s ? m : d, F = o[a.type] || d[a.type], i = F && !a.hidden;
10
+ return {
11
+ fieldTypesMap: o,
12
+ MetadataFilterField: F,
13
+ showField: i,
14
+ getFilterOptionsForField: () => a.key === "modified_at" && s ? [["selectFilterType", e.formatMessage(t.selectAdvancedFilterType)], ["isNotBlank", e.formatMessage(t.modifiedAtFilterAnyTime)], ["today", e.formatMessage(t.relativeDateFilterToday)], ["past", e.formatMessage(t.relativeDateFilterPast)], ["olderThan", e.formatMessage(t.relativeDateFilterOlderThan)], ["customRange", e.formatMessage(t.relativeDateFilterCustomRange)]] : (r == null ? void 0 : r[a.type]) || []
15
+ };
16
+ };
17
+ export {
18
+ c as processMetadataField
19
+ };