@box/metadata-filter 1.74.1 → 1.75.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.
@@ -1,82 +1,86 @@
1
- import { TooltipProvider as $, Combobox as j } from "@box/blueprint-web";
2
- import { useFormikContext as D, getIn as H, Field as P } from "formik";
3
- import { useState as p, useCallback as f } from "react";
4
- import { useIntl as U } from "react-intl";
5
- import Y from "../../../../messages.js";
6
- import { F as d } from "../../../../../../chunks/types.js";
7
- import { fieldDefaultProps as q } from "../constants.js";
8
- import { getInitialAdvancedFilterValue as z, createFieldValue as I, getInputValue as G } from "./utils.js";
9
- import { jsx as a, jsxs as J, Fragment as Q } from "react/jsx-runtime";
10
- import { A as R } from "../../../../../../chunks/index.js";
11
- const S = (t) => t === d.IS_BLANK || t === d.IS_NOT_BLANK, ae = ({
12
- label: t,
13
- fieldNamePrefix: i,
1
+ import { TooltipProvider as U, Combobox as Y } from "@box/blueprint-web";
2
+ import { useFormikContext as q, getIn as G, Field as J } from "formik";
3
+ import { useMemo as Q, useState as p, useRef as w, useCallback as s } from "react";
4
+ import { useIntl as W } from "react-intl";
5
+ import X from "../../../../messages.js";
6
+ import { F as f } from "../../../../../../chunks/types.js";
7
+ import { fieldDefaultProps as Z } from "../constants.js";
8
+ import { getInitialAdvancedFilterValue as E, createFieldValue as y, getInputValue as ee } from "./utils.js";
9
+ import { jsx as a, jsxs as te, Fragment as oe } from "react/jsx-runtime";
10
+ import { A as ne } from "../../../../../../chunks/index.js";
11
+ const T = (o) => o === f.IS_BLANK || o === f.IS_NOT_BLANK, he = ({
12
+ label: o,
13
+ fieldNamePrefix: c,
14
14
  disableForm: h,
15
15
  isAdvancedFilterEnabled: r,
16
- onAdvancedFilterOptionChange: c,
16
+ onAdvancedFilterOptionChange: i,
17
17
  fieldAdvancedFilterOptions: g,
18
- filterOptionsMap: C,
19
- portalElement: V,
20
- hasAccordion: b,
21
- isModified: x
18
+ filterOptionsMap: d,
19
+ portalElement: C,
20
+ hasAccordion: k,
21
+ isModified: v,
22
+ hasExperimentalVirtualization: M
22
23
  }) => {
23
24
  const {
24
- setFieldValue: L,
25
- values: v
26
- } = D(), w = U(), l = `${i}.value.enum`, y = H(v, `${i}.options`, []).map((e) => e?.key).filter((e) => typeof e == "string"), [u, T] = p(z(g, C) || d.MATCH_ANY), [k, O] = p(!1), [A, F] = p(!1), _ = (e, o) => typeof o != "string" ? !1 : o.toLowerCase().includes(e.toLowerCase()), B = f((e, o, n) => {
27
- const s = e;
28
- T(s), c?.(l, s);
29
- const m = S(e) ? [] : o, N = I(m, e, r);
30
- n.setFieldValue(l, N);
31
- }, [l, r, c]), K = f((e) => {
32
- O(e), e && F(!1);
33
- }, []), M = f((e) => {
34
- F(e), e && O(!1);
35
- }, []);
25
+ setFieldValue: V,
26
+ values: O
27
+ } = q(), S = W(), n = `${c}.value.enum`, _ = Q(() => G(O, `${c}.options`, []).map((e) => e?.key).filter((e) => typeof e == "string"), [O, c]), [u, A] = p(E(g, d) || f.MATCH_ANY), [B, I] = p(!1), [K, F] = p(!1), R = (e, t) => typeof t != "string" ? !1 : t.toLowerCase().includes(e.toLowerCase()), x = w([]), m = w(null), L = s((e, t, l) => {
28
+ const b = e;
29
+ A(b), i?.(n, b);
30
+ const H = T(e) ? [] : t, P = y(H, e, r);
31
+ l.setFieldValue(n, P);
32
+ }, [n, r, i]), $ = s((e) => {
33
+ m.current && L(e, x.current, m.current);
34
+ }, [L]), j = s((e) => {
35
+ const t = y(e, u, r);
36
+ V(n, t);
37
+ }, [u, n, r, V]), N = s((e) => {
38
+ I(e), e && F(!1);
39
+ }, []), z = s((e) => {
40
+ F(e), e && I(!1);
41
+ }, []), D = s((e) => !e || e.length === 0 ? S.formatMessage(X.multiselectPlaceholder) : "", [S]);
36
42
  return /* @__PURE__ */ a("div", {
37
- "data-testid": `${t}-field`,
38
- children: /* @__PURE__ */ a(P, {
39
- name: l,
43
+ "data-testid": `${o}-field`,
44
+ children: /* @__PURE__ */ a(J, {
45
+ name: n,
40
46
  children: ({
41
47
  field: e,
42
- form: o
48
+ form: t
43
49
  }) => {
44
- const n = G(e.value, r);
45
- return /* @__PURE__ */ J(Q, {
46
- children: [/* @__PURE__ */ a(R, {
50
+ const l = ee(e.value, r);
51
+ return x.current = l, m.current = t, /* @__PURE__ */ te(oe, {
52
+ children: [/* @__PURE__ */ a(ne, {
47
53
  disableForm: h,
48
54
  fieldAdvancedFilterOptions: g,
49
- fieldNamePrefix: i,
50
- filterOptionsMap: C,
51
- isModified: x,
52
- label: t,
53
- onAdvancedFilterOptionChange: c,
54
- onOpenChange: M,
55
- onValueChange: (s) => B(s, n, o),
56
- open: A,
57
- portalElement: V,
58
- showLabel: !b,
55
+ fieldNamePrefix: c,
56
+ filterOptionsMap: d,
57
+ isModified: v,
58
+ label: o,
59
+ onAdvancedFilterOptionChange: i,
60
+ onOpenChange: z,
61
+ onValueChange: $,
62
+ open: K,
63
+ portalElement: C,
64
+ showLabel: !k,
59
65
  value: u
60
- }), !S(u) && /* @__PURE__ */ a($, {
61
- children: /* @__PURE__ */ a(j, {
62
- ...q,
66
+ }), !T(u) && /* @__PURE__ */ a(U, {
67
+ children: /* @__PURE__ */ a(Y, {
68
+ ...Z,
63
69
  as: "input",
64
70
  disabled: h,
65
- filterFn: _,
71
+ experimentalVirtualization: M,
72
+ filterFn: R,
66
73
  hideLabel: !0,
67
- label: t,
74
+ label: o,
68
75
  multiselect: !0,
69
76
  name: e.name,
70
- onOpenChange: K,
71
- onValueChange: (s) => {
72
- const m = I(s, u, r);
73
- L(l, m);
74
- },
75
- open: k,
76
- options: y,
77
- placeholder: !n || n.length === 0 ? w.formatMessage(Y.multiselectPlaceholder) : "",
78
- portalElement: V,
79
- value: n
77
+ onOpenChange: N,
78
+ onValueChange: j,
79
+ open: B,
80
+ options: _,
81
+ placeholder: D(l),
82
+ portalElement: C,
83
+ value: l
80
84
  })
81
85
  })]
82
86
  });
@@ -85,5 +89,5 @@ const S = (t) => t === d.IS_BLANK || t === d.IS_NOT_BLANK, ae = ({
85
89
  });
86
90
  };
87
91
  export {
88
- ae as MetadataMultiSelectFieldAdvanced
92
+ he as MetadataMultiSelectFieldAdvanced
89
93
  };
@@ -1,47 +1,50 @@
1
- import { TooltipProvider as h, Combobox as f } from "@box/blueprint-web";
2
- import { useFormikContext as v, getIn as g, Field as C } from "formik";
3
- import { useIntl as F } from "react-intl";
4
- import b from "../../../../messages.js";
5
- import { fieldDefaultProps as $ } from "../constants.js";
6
- import { jsx as t } from "react/jsx-runtime";
7
- const j = ({
8
- disableForm: n,
9
- fieldNamePrefix: o,
10
- label: l,
11
- portalElement: s,
12
- hasAccordion: i
1
+ import { TooltipProvider as b, Combobox as f } from "@box/blueprint-web";
2
+ import { useFormikContext as F, getIn as M, Field as V } from "formik";
3
+ import { useMemo as $, useCallback as l } from "react";
4
+ import { useIntl as x } from "react-intl";
5
+ import L from "../../../../messages.js";
6
+ import { fieldDefaultProps as k } from "../constants.js";
7
+ import { jsx as o } from "react/jsx-runtime";
8
+ const T = ({
9
+ disableForm: m,
10
+ fieldNamePrefix: t,
11
+ label: r,
12
+ portalElement: u,
13
+ hasAccordion: d,
14
+ hasExperimentalVirtualization: c
13
15
  }) => {
14
16
  const {
15
- setFieldValue: m,
16
- values: u
17
- } = v(), d = F(), r = `${o}.value.enum`, c = g(u, `${o}.options`, []).map(({
17
+ setFieldValue: n,
18
+ values: s
19
+ } = F(), i = x(), a = `${t}.value.enum`, p = $(() => M(s, `${t}.options`, []).map(({
18
20
  key: e
19
- }) => e), p = (e, a) => a.toLowerCase().includes(e.toLowerCase());
20
- return /* @__PURE__ */ t("div", {
21
- "data-testid": `${l}-field`,
22
- children: /* @__PURE__ */ t(C, {
23
- name: r,
21
+ }) => e), [s, t]), h = l((e, v) => v.toLowerCase().includes(e.toLowerCase()), []), g = l((e) => n(a, e), [n, a]), C = l((e) => (
22
+ // Empty array must be substituted if there is no value found
23
+ // Otherwise no placeholder appears despite no selection
24
+ (e || [])?.length === 0 ? i.formatMessage(L.multiselectPlaceholder) : ""
25
+ ), [i]);
26
+ return /* @__PURE__ */ o("div", {
27
+ "data-testid": `${r}-field`,
28
+ children: /* @__PURE__ */ o(V, {
29
+ name: a,
24
30
  children: ({
25
31
  field: e
26
- }) => /* @__PURE__ */ t(h, {
27
- children: /* @__PURE__ */ t(f, {
28
- ...$,
32
+ }) => /* @__PURE__ */ o(b, {
33
+ children: /* @__PURE__ */ o(f, {
34
+ ...k,
29
35
  as: "input",
30
- "data-target-id": `Combobox-${o}`,
31
- disabled: n,
32
- filterFn: p,
33
- hideLabel: i,
34
- label: l,
36
+ "data-target-id": `Combobox-${t}`,
37
+ disabled: m,
38
+ filterFn: h,
39
+ hideLabel: d,
40
+ label: r,
35
41
  multiselect: !0,
42
+ experimentalVirtualization: c,
36
43
  name: e.name,
37
- onValueChange: (a) => m(r, a),
38
- options: c,
39
- placeholder: (
40
- // Empty array must be substituded if there is no value found
41
- // Otherwise an no placeholder appears despite no selection
42
- (e.value || [])?.length === 0 ? d.formatMessage(b.multiselectPlaceholder) : ""
43
- ),
44
- portalElement: s,
44
+ onValueChange: g,
45
+ options: p,
46
+ placeholder: C(e.value),
47
+ portalElement: u,
45
48
  value: e.value
46
49
  })
47
50
  })
@@ -49,6 +52,6 @@ const j = ({
49
52
  });
50
53
  };
51
54
  export {
52
- j as MetadataMultiSelectField,
53
- j as default
55
+ T as MetadataMultiSelectField,
56
+ T as default
54
57
  };
@@ -1,105 +1,105 @@
1
1
  import { ComboboxWithApiTreeView as J, ComboboxWithApiPagination as N } from "@box/combobox-with-api";
2
- import L from "clsx";
2
+ import j from "clsx";
3
3
  import { useFormikContext as Q, getIn as X, Field as Y } from "formik";
4
- import { useState as y, useCallback as h } from "react";
4
+ import { useState as F, useCallback as c } from "react";
5
5
  import { useIntl as Z } from "react-intl";
6
6
  import E from "../../../../messages.js";
7
- import { getInitialAdvancedFilterValue as ee, createFieldValue as A, getInputValue as oe, isBlankOption as j } from "./utils.js";
8
- import { jsx as t, jsxs as te, Fragment as le } from "react/jsx-runtime";
9
- import { A as se } from "../../../../../../chunks/index.js";
10
- import '../../../../../../styles/metadata-taxonomy-field-advanced.css';const ae = "_comboboxWrapper_1e1d8_1", ne = "_disabled_1e1d8_1", ie = "_disabledTreeView_1e1d8_5", b = {
7
+ import { getInitialAdvancedFilterValue as ee, isBlankOption as M, createFieldValue as P, getInputValue as oe } from "./utils.js";
8
+ import { jsx as s, jsxs as te, Fragment as se } from "react/jsx-runtime";
9
+ import { A as le } from "../../../../../../chunks/index.js";
10
+ import '../../../../../../styles/metadata-taxonomy-field-advanced.css';const ae = "_comboboxWrapper_1e1d8_1", ne = "_disabled_1e1d8_1", ce = "_disabledTreeView_1e1d8_5", V = {
11
11
  comboboxWrapper: ae,
12
12
  disabled: ne,
13
- disabledTreeView: ie
14
- }, Ve = ({
13
+ disabledTreeView: ce
14
+ }, ge = ({
15
15
  className: g,
16
16
  disableForm: l,
17
- fieldNamePrefix: r,
18
- label: d,
19
- portalElement: u,
20
- taxonomyOptionsFetcher: m,
21
- isMultilevelTaxonomyFieldEnabled: M,
22
- hasAccordion: P,
23
- isAdvancedFilterEnabled: n,
24
- onAdvancedFilterOptionChange: V,
17
+ fieldNamePrefix: d,
18
+ label: u,
19
+ portalElement: m,
20
+ taxonomyOptionsFetcher: p,
21
+ isMultilevelTaxonomyFieldEnabled: $,
22
+ hasAccordion: A,
23
+ isAdvancedFilterEnabled: a,
24
+ onAdvancedFilterOptionChange: h,
25
25
  fieldAdvancedFilterOptions: f,
26
- filterOptionsMap: v,
27
- isModified: $
26
+ filterOptionsMap: C,
27
+ isModified: B
28
28
  }) => {
29
29
  const {
30
- setFieldValue: C,
30
+ setFieldValue: v,
31
31
  values: x
32
32
  } = Q(), {
33
33
  metadata: {
34
34
  templateKey: _,
35
35
  scope: w
36
36
  }
37
- } = x, B = Z(), s = `${r}.value`, K = X(x, r), {
38
- key: T,
37
+ } = x, T = Z(), t = `${d}.value`, K = X(x, d), {
38
+ key: W,
39
39
  optionsRules: R,
40
40
  levels: U
41
- } = K, W = !0, i = R?.selectableLevels, q = M && i?.some((e) => e > 1), [c, z] = y(ee(f, v)), [D, k] = y(!1), I = h((e) => m ? m(w, _, T, i?.[0] ?? 0, e) : Promise.resolve({
41
+ } = K, k = !0, i = R?.selectableLevels, q = $ && i?.some((e) => e > 1), [r, z] = F(ee(f, C)), [D, I] = F(!1), S = c((e) => p ? p(w, _, W, i?.[0] ?? 0, e) : Promise.resolve({
42
42
  options: []
43
- }), [T, w, i, m, _]), O = (e) => e?.length === 0 ? B.formatMessage(E.multiselectPlaceholder) : "", G = (e, a, o) => {
44
- z(e), V?.(s, e);
45
- const p = j(e) ? [] : a, H = A(p, e, n);
46
- o.setFieldValue(s, H);
47
- }, S = h((e) => {
48
- e && k(!1);
49
- }, []), F = h((e) => {
50
- const a = A(e, c, n);
51
- C(s, a);
52
- }, [c, s, n, C]);
53
- return /* @__PURE__ */ t("div", {
54
- "data-testid": `${d}-field`,
55
- children: /* @__PURE__ */ t(Y, {
56
- name: s,
43
+ }), [W, w, i, p, _]), L = c((e) => e?.length === 0 ? T.formatMessage(E.multiselectPlaceholder) : "", [T]), G = c((e, n, o) => {
44
+ z(e), h?.(t, e);
45
+ const b = M(e) ? [] : n, H = P(b, e, a);
46
+ o.setFieldValue(t, H);
47
+ }, [t, a, h]), O = c((e) => {
48
+ e && I(!1);
49
+ }, []), y = c((e) => {
50
+ const n = P(e, r, a);
51
+ v(t, n);
52
+ }, [r, t, a, v]);
53
+ return /* @__PURE__ */ s("div", {
54
+ "data-testid": `${u}-field`,
55
+ children: /* @__PURE__ */ s(Y, {
56
+ name: t,
57
57
  children: ({
58
58
  field: e,
59
- form: a
59
+ form: n
60
60
  }) => {
61
- const o = oe(e.value, n);
62
- return /* @__PURE__ */ te(le, {
63
- children: [/* @__PURE__ */ t(se, {
61
+ const o = oe(e.value, a);
62
+ return /* @__PURE__ */ te(se, {
63
+ children: [/* @__PURE__ */ s(le, {
64
64
  disableForm: l ?? !1,
65
65
  fieldAdvancedFilterOptions: f,
66
- fieldNamePrefix: r,
67
- filterOptionsMap: v,
68
- isModified: $,
69
- label: d,
70
- onAdvancedFilterOptionChange: V,
71
- onOpenChange: k,
72
- onValueChange: (p) => G(p, o, a),
66
+ fieldNamePrefix: d,
67
+ filterOptionsMap: C,
68
+ isModified: B,
69
+ label: u,
70
+ onAdvancedFilterOptionChange: h,
71
+ onOpenChange: I,
72
+ onValueChange: (b) => G(b, o, n),
73
73
  open: D,
74
- portalElement: u,
75
- showLabel: !P,
76
- value: c
77
- }), !j(c) && /* @__PURE__ */ t("div", {
78
- className: L(b.comboboxWrapper, l && b.disabled),
79
- children: q ? /* @__PURE__ */ t(J, {
80
- className: L(g, l && b.disabledTreeView),
81
- defaultFetcher: I,
74
+ portalElement: m,
75
+ showLabel: !A,
76
+ value: r
77
+ }), !M(r) && /* @__PURE__ */ s("div", {
78
+ className: j(V.comboboxWrapper, l && V.disabled),
79
+ children: q ? /* @__PURE__ */ s(J, {
80
+ className: j(g, l && V.disabledTreeView),
81
+ defaultFetcher: S,
82
82
  disabled: l,
83
83
  hideLabel: !0,
84
- label: d,
84
+ label: u,
85
85
  levels: U,
86
- multiselect: W,
87
- onOpenChange: S,
88
- onValueChange: F,
89
- placeholder: O(o),
90
- portalElement: u,
86
+ multiselect: k,
87
+ onOpenChange: O,
88
+ onValueChange: y,
89
+ placeholder: L(o),
90
+ portalElement: m,
91
91
  selectableLevels: i,
92
92
  value: o
93
- }) : /* @__PURE__ */ t(N, {
93
+ }) : /* @__PURE__ */ s(N, {
94
94
  className: g,
95
- defaultFetcher: I,
95
+ defaultFetcher: S,
96
96
  disabled: l,
97
97
  label: void 0,
98
- multiselect: W,
99
- onOpenChange: S,
100
- onValueChange: F,
101
- placeholder: O(o),
102
- portalElement: u,
98
+ multiselect: k,
99
+ onOpenChange: O,
100
+ onValueChange: y,
101
+ placeholder: L(o),
102
+ portalElement: m,
103
103
  value: o
104
104
  })
105
105
  })]
@@ -109,6 +109,6 @@ import '../../../../../../styles/metadata-taxonomy-field-advanced.css';const ae
109
109
  });
110
110
  };
111
111
  export {
112
- Ve as MetadataTaxonomyFieldAdvanced,
113
- Ve as default
112
+ ge as MetadataTaxonomyFieldAdvanced,
113
+ ge as default
114
114
  };
@@ -1,61 +1,61 @@
1
- import { ComboboxWithApiTreeView as M, ComboboxWithApiPagination as T } from "@box/combobox-with-api";
2
- import { useFormikContext as I, getIn as L, Field as P } from "formik";
3
- import { useCallback as W } from "react";
1
+ import { ComboboxWithApiTreeView as T, ComboboxWithApiPagination as I } from "@box/combobox-with-api";
2
+ import { useFormikContext as L, getIn as P, Field as W } from "formik";
3
+ import { useCallback as n } from "react";
4
4
  import { useIntl as $ } from "react-intl";
5
5
  import j from "../../../../messages.js";
6
- import { jsx as o } from "react/jsx-runtime";
6
+ import { jsx as l } from "react/jsx-runtime";
7
7
  const z = ({
8
- className: n,
8
+ className: i,
9
9
  disableForm: r,
10
10
  fieldNamePrefix: u,
11
- label: l,
11
+ label: a,
12
12
  portalElement: m,
13
13
  taxonomyOptionsFetcher: d,
14
- isMultilevelTaxonomyFieldEnabled: C,
14
+ isMultilevelTaxonomyFieldEnabled: k,
15
15
  hasAccordion: c
16
16
  }) => {
17
17
  const {
18
18
  setFieldValue: v,
19
- values: p
20
- } = I(), {
19
+ values: h
20
+ } = L(), {
21
21
  metadata: {
22
- templateKey: h,
22
+ templateKey: p,
23
23
  scope: g
24
24
  }
25
- } = p, k = $(), a = `${u}.value`, y = L(p, u), {
26
- key: b,
25
+ } = h, b = $(), s = `${u}.value`, y = P(h, u), {
26
+ key: f,
27
27
  optionsRules: {
28
- multiSelect: s,
29
- selectableLevels: t
28
+ multiSelect: t,
29
+ selectableLevels: o
30
30
  },
31
31
  levels: F
32
- } = y, V = C && t?.some((e) => e > 1), f = W((e) => d(g, h, b, t?.[0], e), [b, g, t, d, h]), x = (e) => s || !e?.length ? k.formatMessage(j.taxonomyPlaceholder) : void 0;
33
- return /* @__PURE__ */ o("div", {
34
- "data-testid": `${l}-field`,
35
- children: /* @__PURE__ */ o(P, {
36
- name: a,
32
+ } = y, M = k && o?.some((e) => e > 1), C = n((e) => d(g, p, f, o?.[0], e), [f, g, o, d, p]), x = n((e) => t || !e?.length ? b.formatMessage(j.taxonomyPlaceholder) : void 0, [t, b]), V = n((e) => v(s, e), [v, s]);
33
+ return /* @__PURE__ */ l("div", {
34
+ "data-testid": `${a}-field`,
35
+ children: /* @__PURE__ */ l(W, {
36
+ name: s,
37
37
  children: ({
38
38
  field: e
39
- }) => V ? /* @__PURE__ */ o(M, {
40
- className: n,
41
- defaultFetcher: f,
39
+ }) => M ? /* @__PURE__ */ l(T, {
40
+ className: i,
41
+ defaultFetcher: C,
42
42
  disabled: r,
43
43
  hideLabel: c,
44
- label: l,
44
+ label: a,
45
45
  levels: F,
46
- multiselect: s,
47
- onValueChange: (i) => v(a, i),
46
+ multiselect: t,
47
+ onValueChange: V,
48
48
  placeholder: x(e.value),
49
49
  portalElement: m,
50
- selectableLevels: t,
50
+ selectableLevels: o,
51
51
  value: e.value
52
- }) : /* @__PURE__ */ o(T, {
53
- className: n,
54
- defaultFetcher: f,
52
+ }) : /* @__PURE__ */ l(I, {
53
+ className: i,
54
+ defaultFetcher: C,
55
55
  disabled: r,
56
- label: c ? void 0 : l,
57
- multiselect: s,
58
- onValueChange: (i) => v(a, i),
56
+ label: c ? void 0 : a,
57
+ multiselect: t,
58
+ onValueChange: V,
59
59
  placeholder: x(e.value),
60
60
  portalElement: m,
61
61
  value: e.value
@@ -1,13 +1,13 @@
1
1
  import { Text as m } from "@box/blueprint-web";
2
- import { useFormikContext as I, getIn as l, FieldArray as L } from "formik";
3
- import { useEffect as S } from "react";
4
- import { useIntl as V, FormattedMessage as $ } from "react-intl";
5
- import w from "../../messages.js";
6
- import { processMetadataField as C } from "./field-processing-utils.js";
7
- import { isAnyFieldModified as P, isFieldModifiedFromValue as q } from "./is-modified-utils.js";
8
- import { s as z } from "../../../../chunks/index.js";
9
- import { jsx as i, jsxs as B } from "react/jsx-runtime";
10
- const Y = ({
2
+ import { useFormikContext as L, getIn as l, FieldArray as S } from "formik";
3
+ import { useEffect as V } from "react";
4
+ import { useIntl as $, FormattedMessage as w } from "react-intl";
5
+ import C from "../../messages.js";
6
+ import { processMetadataField as P } from "./field-processing-utils.js";
7
+ import { isAnyFieldModified as q, isFieldModifiedFromValue as z } from "./is-modified-utils.js";
8
+ import { s as B } from "../../../../chunks/index.js";
9
+ import { jsx as i, jsxs as G } from "react/jsx-runtime";
10
+ const Z = ({
11
11
  disableForm: d,
12
12
  locale: p,
13
13
  portalElement: c,
@@ -20,46 +20,48 @@ const Y = ({
20
20
  isMultilevelTaxonomyFieldEnabled: y,
21
21
  filterOptionsMap: O,
22
22
  onDirtyChange: a,
23
- isAdvancedTaxonomy: h
23
+ isAdvancedTaxonomy: h,
24
+ hasExperimentalVirtualization: g
24
25
  }) => {
25
26
  const {
26
27
  values: o
27
- } = I(), g = V(), r = "metadata.fields", s = l(o, r);
28
- return S(() => {
28
+ } = L(), v = $(), r = "metadata.fields", s = l(o, r);
29
+ return V(() => {
29
30
  if (a) {
30
- const t = P(s, o, e);
31
+ const t = q(s, o, e);
31
32
  a(t);
32
33
  }
33
- }, [o, e, a, s]), s.length ? /* @__PURE__ */ i(L, {
34
+ }, [o, e, a, s]), s.length ? /* @__PURE__ */ i(S, {
34
35
  name: r,
35
36
  validateOnChange: !1,
36
37
  children: () => s.map((t, n) => {
37
38
  const {
38
- MetadataFilterField: v,
39
- showField: N,
40
- getFilterOptionsForField: T
41
- } = C({
39
+ MetadataFilterField: N,
40
+ showField: T,
41
+ getFilterOptionsForField: k
42
+ } = P({
42
43
  field: t,
43
44
  isAdvancedFilterEnabled: e,
44
45
  isAdvancedTaxonomy: h,
45
- intl: g,
46
+ intl: v,
46
47
  filterOptionsMap: O
47
- }), k = l(o, `metadata.fields[${n}].value`), j = t.advancedFilterOptionToExecute, A = q(t.type, k, e, j);
48
- return N && /* @__PURE__ */ B("div", {
49
- children: [/* @__PURE__ */ i(v, {
48
+ }), j = l(o, `metadata.fields[${n}].value`), A = t.advancedFilterOptionToExecute, I = z(t.type, j, e, A);
49
+ return T && /* @__PURE__ */ G("div", {
50
+ children: [/* @__PURE__ */ i(N, {
50
51
  canUseRelativeDates: u,
51
52
  disableForm: d,
52
53
  fieldAdvancedFilterOptions: M?.[t.key],
53
54
  fieldNamePrefix: `metadata.fields[${n}]`,
54
- filterOptionsMap: T(),
55
+ filterOptionsMap: k(),
55
56
  isAdvancedFilterEnabled: e,
56
- isModified: A && F,
57
+ isModified: I && F,
57
58
  isMultilevelTaxonomyFieldEnabled: y,
58
59
  label: t.displayName,
59
60
  locale: p,
60
61
  onAdvancedFilterOptionChange: x,
61
62
  portalElement: c,
62
- taxonomyOptionsFetcher: f
63
+ taxonomyOptionsFetcher: f,
64
+ hasExperimentalVirtualization: g
63
65
  }), !!t.description && /* @__PURE__ */ i(m, {
64
66
  as: "span",
65
67
  color: "textOnLightSecondary",
@@ -70,14 +72,14 @@ const Y = ({
70
72
  })
71
73
  }) : /* @__PURE__ */ i(m, {
72
74
  as: "span",
73
- className: z.noAttributesText,
75
+ className: B.noAttributesText,
74
76
  color: "textOnLightSecondary",
75
- children: /* @__PURE__ */ i($, {
76
- ...w.noTemplateAtributesError
77
+ children: /* @__PURE__ */ i(w, {
78
+ ...C.noTemplateAtributesError
77
79
  })
78
80
  });
79
81
  };
80
82
  export {
81
- Y as MetadataFilterFields,
82
- Y as default
83
+ Z as MetadataFilterFields,
84
+ Z as default
83
85
  };
@@ -1,26 +1,26 @@
1
1
  import "@box/combobox-with-api";
2
2
  import "./components/metadata-filter-fields/components/metadata-date-field/date-conversion-utils.js";
3
- import { defaultInitialValues as M } from "./defaults.js";
4
- import { LoadingIndicator as N } from "@box/blueprint-web";
5
- import { useFormikContext as V } from "formik";
6
- import { useEffect as b } from "react";
7
- import { useIntl as k } from "react-intl";
8
- import { MetadataFilterFields as D } from "./components/metadata-filter-fields/metadata-filter-fields.js";
9
- import { MetadataFilterFieldsAccordion as L } from "./components/metadata-filter-fields/metadata-filter-fields-accordion.js";
10
- import { MetadataTemplateSelector as S } from "./components/metadata-template-selector/metadata-template-selector.js";
11
- import { mapDataFromTemplate as q } from "./mappers.js";
12
- import w from "./messages.js";
13
- import { jsxs as z, jsx as r } from "react/jsx-runtime";
3
+ import { defaultInitialValues as N } from "./defaults.js";
4
+ import { LoadingIndicator as V } from "@box/blueprint-web";
5
+ import { useFormikContext as b } from "formik";
6
+ import { useEffect as k } from "react";
7
+ import { useIntl as D } from "react-intl";
8
+ import { MetadataFilterFields as L } from "./components/metadata-filter-fields/metadata-filter-fields.js";
9
+ import { MetadataFilterFieldsAccordion as S } from "./components/metadata-filter-fields/metadata-filter-fields-accordion.js";
10
+ import { MetadataTemplateSelector as q } from "./components/metadata-template-selector/metadata-template-selector.js";
11
+ import { mapDataFromTemplate as w } from "./mappers.js";
12
+ import z from "./messages.js";
13
+ import { jsxs as A, jsx as r } from "react/jsx-runtime";
14
14
  import "../../chunks/types.js";
15
15
  import "./components/metadata-filter-fields/components/metadata-date-field/metadata-date-field.js";
16
16
  import "./components/metadata-filter-fields/components/metadata-enum-field/metadata-enum-field.js";
17
17
  import "./components/metadata-filter-fields/components/metadata-float-field/metadata-float-field.js";
18
18
  import "./components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field.js";
19
19
  import "./components/metadata-filter-fields/components/metadata-string-field/metadata-string-field.js";
20
- import '../../styles/metadata-filter.css';const A = "_container_p63iy_1", B = "_loadingIndicator_p63iy_7", e = {
21
- container: A,
22
- loadingIndicator: B
23
- }, it = ({
20
+ import '../../styles/metadata-filter.css';const B = "_container_p63iy_1", G = "_loadingIndicator_p63iy_7", e = {
21
+ container: B,
22
+ loadingIndicator: G
23
+ }, at = ({
24
24
  isAdvancedFilterEnabled: m,
25
25
  isModifiedMarkerEnabled: s,
26
26
  metadataTemplateOptions: l,
@@ -39,18 +39,19 @@ import '../../styles/metadata-filter.css';const A = "_container_p63iy_1", B = "_
39
39
  fieldAdvancedFilterOptions: x,
40
40
  hasAccordion: n = !1,
41
41
  onDirtyChange: C,
42
- isAdvancedTaxonomy: y = !1
42
+ isAdvancedTaxonomy: y = !1,
43
+ hasExperimentalVirtualization: j = !1
43
44
  }) => {
44
45
  const {
45
46
  setFieldValue: o
46
- } = V(), j = k();
47
- b(() => {
48
- t ? o("metadata", q(t)) : o("metadata", M);
47
+ } = b(), v = D();
48
+ k(() => {
49
+ t ? o("metadata", w(t)) : o("metadata", N);
49
50
  }, [t, o]);
50
- const v = () => d ? /* @__PURE__ */ r(N, {
51
- "aria-label": j.formatMessage(w.loading),
51
+ const M = () => d ? /* @__PURE__ */ r(V, {
52
+ "aria-label": v.formatMessage(z.loading),
52
53
  className: e.loadingIndicator
53
- }) : t ? /* @__PURE__ */ r(n ? L : D, {
54
+ }) : t ? /* @__PURE__ */ r(n ? S : L, {
54
55
  canUseRelativeDates: g,
55
56
  disableForm: c,
56
57
  fieldAdvancedFilterOptions: x,
@@ -64,17 +65,18 @@ import '../../styles/metadata-filter.css';const A = "_container_p63iy_1", B = "_
64
65
  onAdvancedFilterOptionChange: _,
65
66
  onDirtyChange: C,
66
67
  portalElement: i,
67
- taxonomyOptionsFetcher: f
68
+ taxonomyOptionsFetcher: f,
69
+ hasExperimentalVirtualization: j
68
70
  }) : null;
69
- return /* @__PURE__ */ z("div", {
71
+ return /* @__PURE__ */ A("div", {
70
72
  className: e.container,
71
- children: [p && /* @__PURE__ */ r(S, {
73
+ children: [p && /* @__PURE__ */ r(q, {
72
74
  hasError: a,
73
75
  metadataTemplateOptions: l,
74
76
  portalElement: i
75
- }), !a && v()]
77
+ }), !a && M()]
76
78
  });
77
79
  };
78
80
  export {
79
- it as MetadataFilter
81
+ at as MetadataFilter
80
82
  };
@@ -1,2 +1,2 @@
1
1
  import { MetadataFieldProps } from '../../types';
2
- export declare const MetadataMultiSelectFieldAdvanced: ({ label, fieldNamePrefix, disableForm, isAdvancedFilterEnabled, onAdvancedFilterOptionChange, fieldAdvancedFilterOptions, filterOptionsMap, portalElement, hasAccordion, isModified, }: MetadataFieldProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const MetadataMultiSelectFieldAdvanced: ({ label, fieldNamePrefix, disableForm, isAdvancedFilterEnabled, onAdvancedFilterOptionChange, fieldAdvancedFilterOptions, filterOptionsMap, portalElement, hasAccordion, isModified, hasExperimentalVirtualization, }: MetadataFieldProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,3 @@
1
1
  import { MetadataFieldProps } from '../../types';
2
- export declare const MetadataMultiSelectField: ({ disableForm, fieldNamePrefix, label, portalElement, hasAccordion, }: Omit<MetadataFieldProps, "locale" | "taxonomyOptionsFetcher">) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const MetadataMultiSelectField: ({ disableForm, fieldNamePrefix, label, portalElement, hasAccordion, hasExperimentalVirtualization, }: Omit<MetadataFieldProps, "locale" | "taxonomyOptionsFetcher">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default MetadataMultiSelectField;
@@ -1,3 +1,3 @@
1
1
  import { MetadataFilterFieldsProps } from './types';
2
- export declare const MetadataFilterFields: ({ disableForm, locale, portalElement, taxonomyOptionsFetcher, canUseRelativeDates, isAdvancedFilterEnabled, isModifiedMarkerEnabled, onAdvancedFilterOptionChange, fieldAdvancedFilterOptions, isMultilevelTaxonomyFieldEnabled, filterOptionsMap, onDirtyChange, isAdvancedTaxonomy, }: MetadataFilterFieldsProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const MetadataFilterFields: ({ disableForm, locale, portalElement, taxonomyOptionsFetcher, canUseRelativeDates, isAdvancedFilterEnabled, isModifiedMarkerEnabled, onAdvancedFilterOptionChange, fieldAdvancedFilterOptions, isMultilevelTaxonomyFieldEnabled, filterOptionsMap, onDirtyChange, isAdvancedTaxonomy, hasExperimentalVirtualization, }: MetadataFilterFieldsProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default MetadataFilterFields;
@@ -28,6 +28,7 @@ export type MetadataFilterFieldsProps = {
28
28
  hasAccordion?: boolean;
29
29
  onDirtyChange?: (isDirty: boolean) => void;
30
30
  isAdvancedTaxonomy?: boolean;
31
+ hasExperimentalVirtualization?: boolean;
31
32
  };
32
33
  export type MetadataFieldProps = {
33
34
  description?: string | null;
@@ -52,6 +53,7 @@ export type MetadataFieldProps = {
52
53
  hasAccordion?: boolean;
53
54
  isModified?: boolean;
54
55
  placeholder?: string;
56
+ hasExperimentalVirtualization?: boolean;
55
57
  };
56
58
  export type FieldType = Extract<MetadataTemplateFieldType, 'string' | 'float' | 'enum' | 'multiSelect' | 'date' | 'taxonomy'>;
57
59
  export type PartialRangeValue = Partial<RangeValue>;
@@ -1,2 +1,2 @@
1
1
  import { MetadataFilterProps } from './types';
2
- export declare const MetadataFilter: ({ isAdvancedFilterEnabled, isModifiedMarkerEnabled, metadataTemplateOptions, portalElement, selectedMetadataTemplate, taxonomyOptionsFetcher, showMetadataSelector, disableForm, isLoading, hasError, locale, canUseRelativeDates, isMultilevelTaxonomyFieldEnabled, filterOptionsMap, onAdvancedFilterOptionChange, fieldAdvancedFilterOptions, hasAccordion, onDirtyChange, isAdvancedTaxonomy, }: MetadataFilterProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const MetadataFilter: ({ isAdvancedFilterEnabled, isModifiedMarkerEnabled, metadataTemplateOptions, portalElement, selectedMetadataTemplate, taxonomyOptionsFetcher, showMetadataSelector, disableForm, isLoading, hasError, locale, canUseRelativeDates, isMultilevelTaxonomyFieldEnabled, filterOptionsMap, onAdvancedFilterOptionChange, fieldAdvancedFilterOptions, hasAccordion, onDirtyChange, isAdvancedTaxonomy, hasExperimentalVirtualization, }: MetadataFilterProps) => import("react/jsx-runtime").JSX.Element;
@@ -130,4 +130,5 @@ export type MetadataFilterProps = {
130
130
  hasAccordion?: boolean;
131
131
  onDirtyChange?: (isDirty: boolean) => void;
132
132
  isAdvancedTaxonomy?: boolean;
133
+ hasExperimentalVirtualization?: boolean;
133
134
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-filter",
3
- "version": "1.74.1",
3
+ "version": "1.75.0",
4
4
  "peerDependencies": {
5
5
  "@box/blueprint-web": "^13.1.2",
6
6
  "@box/blueprint-web-assets": "^4.101.12",