@box/metadata-filter 1.52.4 → 1.53.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 (28) hide show
  1. package/dist/chunks/index.js +58 -59
  2. package/dist/chunks/metadata-float-field.module.js +4 -6
  3. package/dist/chunks/types.js +2 -2
  4. package/dist/chunks/types2.js +2 -2
  5. package/dist/chunks/use-float-validation.js +13 -13
  6. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/date-conversion-utils.js +34 -35
  7. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field-advanced.js +52 -52
  8. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field-relative.js +92 -92
  9. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/use-date-validation.js +22 -22
  10. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/use-integer-validation.js +2 -2
  11. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-enum-field/metadata-enum-field.js +19 -19
  12. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/handlers.js +12 -12
  13. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/utils.js +30 -33
  14. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field-advanced.js +54 -54
  15. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +36 -39
  16. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-multi-select-field/utils.js +11 -11
  17. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-string-field/metadata-string-field.js +55 -55
  18. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-string-field/utils.js +12 -12
  19. package/dist/esm/lib/components/metadata-filter-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +52 -52
  20. package/dist/esm/lib/components/metadata-filter-fields/field-processing-utils.js +10 -10
  21. package/dist/esm/lib/components/metadata-filter-fields/is-modified-utils.js +9 -13
  22. package/dist/esm/lib/components/metadata-filter-fields/metadata-filter-fields-accordion.js +67 -67
  23. package/dist/esm/lib/components/metadata-filter-fields/metadata-filter-fields.js +53 -53
  24. package/dist/i18n/en-x-pseudo.js +54 -54
  25. package/dist/i18n/en-x-pseudo.properties +54 -54
  26. package/dist/styles/metadata-date-field.css +1 -1
  27. package/dist/styles/metadata-float-field.css +1 -1
  28. package/package.json +7 -7
@@ -1,80 +1,80 @@
1
- import { TooltipProvider as P, Combobox as U } from "@box/blueprint-web";
2
- import { useFormikContext as q, getIn as v, Field as z } from "formik";
3
- import { useState as f, useCallback as p } from "react";
4
- import { useIntl as G } from "react-intl";
5
- import H from "../../../../messages.js";
6
- import { fieldDefaultProps as J } from "../constants.js";
7
- import { getInitialAdvancedFilterValue as K, createFieldValue as k, getInputValue as N } from "./utils.js";
8
- import { jsx as a, jsxs as Q, Fragment as R } from "react/jsx-runtime";
9
- import { A as W } from "../../../../../../chunks/index.js";
10
- const x = (t) => t === "isBlank" || t === "isNotBlank", oe = ({
1
+ import { TooltipProvider as D, Combobox as P } from "@box/blueprint-web";
2
+ import { useFormikContext as U, getIn as q, Field as z } from "formik";
3
+ import { useState as p, useCallback as f } from "react";
4
+ import { useIntl as A } from "react-intl";
5
+ import G from "../../../../messages.js";
6
+ import { fieldDefaultProps as H } from "../constants.js";
7
+ import { getInitialAdvancedFilterValue as J, createFieldValue as b, 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 k = (t) => t === "isBlank" || t === "isNotBlank", ne = ({
11
11
  label: t,
12
- fieldNamePrefix: m,
12
+ fieldNamePrefix: i,
13
13
  disableForm: h,
14
- isAdvancedFilterEnabled: u,
15
- onAdvancedFilterOptionChange: l,
16
- fieldAdvancedFilterOptions: g,
17
- filterOptionsMap: V,
14
+ isAdvancedFilterEnabled: r,
15
+ onAdvancedFilterOptionChange: u,
16
+ fieldAdvancedFilterOptions: d,
17
+ filterOptionsMap: g,
18
18
  portalElement: C,
19
- hasAccordion: I,
20
- isModified: S
19
+ hasAccordion: x,
20
+ isModified: F
21
21
  }) => {
22
22
  const {
23
- setFieldValue: w,
24
- values: L
25
- } = q(), y = G(), n = `${m}.value.enum`, B = v(L, `${m}.options`, []).map((e) => e == null ? void 0 : e.key).filter((e) => typeof e == "string"), [c, O] = f(K(g, V)), [$, d] = f(!1), [j, b] = f(!1), F = (e, s) => typeof s != "string" ? !1 : s.toLowerCase().includes(e.toLowerCase()), M = p((e, s, o) => {
26
- O(e), l == null || l(n, e);
27
- const r = x(e) ? [] : s, i = k(r, e, u);
28
- o.setFieldValue(n, i);
29
- }, [n, u, l]), T = p((e) => {
30
- d(e), e && b(!1);
31
- }, []), D = p((e) => {
32
- b(e), e && d(!1);
23
+ setFieldValue: I,
24
+ values: S
25
+ } = U(), w = A(), s = `${i}.value.enum`, v = q(S, `${i}.options`, []).map((e) => e?.key).filter((e) => typeof e == "string"), [c, L] = p(J(d, g)), [y, V] = p(!1), [B, O] = p(!1), $ = (e, o) => typeof o != "string" ? !1 : o.toLowerCase().includes(e.toLowerCase()), j = f((e, o, n) => {
26
+ L(e), u?.(s, e);
27
+ const l = k(e) ? [] : o, m = b(l, e, r);
28
+ n.setFieldValue(s, m);
29
+ }, [s, r, u]), M = f((e) => {
30
+ V(e), e && O(!1);
31
+ }, []), T = f((e) => {
32
+ O(e), e && V(!1);
33
33
  }, []);
34
34
  return /* @__PURE__ */ a("div", {
35
35
  "data-testid": `${t}-field`,
36
36
  children: /* @__PURE__ */ a(z, {
37
- name: n,
37
+ name: s,
38
38
  children: ({
39
39
  field: e,
40
- form: s
40
+ form: o
41
41
  }) => {
42
- const o = N(e.value, u);
43
- return /* @__PURE__ */ Q(R, {
44
- children: [/* @__PURE__ */ a(W, {
42
+ const n = K(e.value, r);
43
+ return /* @__PURE__ */ N(Q, {
44
+ children: [/* @__PURE__ */ a(R, {
45
45
  disableForm: h,
46
- fieldAdvancedFilterOptions: g,
47
- fieldNamePrefix: m,
48
- filterOptionsMap: V,
49
- isModified: S,
46
+ fieldAdvancedFilterOptions: d,
47
+ fieldNamePrefix: i,
48
+ filterOptionsMap: g,
49
+ isModified: F,
50
50
  label: t,
51
- onAdvancedFilterOptionChange: l,
52
- onOpenChange: D,
53
- onValueChange: (r) => M(r, o, s),
54
- open: j,
51
+ onAdvancedFilterOptionChange: u,
52
+ onOpenChange: T,
53
+ onValueChange: (l) => j(l, n, o),
54
+ open: B,
55
55
  portalElement: C,
56
- showLabel: !I,
56
+ showLabel: !x,
57
57
  value: c
58
- }), !x(c) && /* @__PURE__ */ a(P, {
59
- children: /* @__PURE__ */ a(U, {
60
- ...J,
58
+ }), !k(c) && /* @__PURE__ */ a(D, {
59
+ children: /* @__PURE__ */ a(P, {
60
+ ...H,
61
61
  as: "input",
62
62
  disabled: h,
63
- filterFn: F,
63
+ filterFn: $,
64
64
  hideLabel: !0,
65
65
  label: t,
66
66
  multiselect: !0,
67
67
  name: e.name,
68
- onOpenChange: T,
69
- onValueChange: (r) => {
70
- const i = k(r, c, u);
71
- w(n, i);
68
+ onOpenChange: M,
69
+ onValueChange: (l) => {
70
+ const m = b(l, c, r);
71
+ I(s, m);
72
72
  },
73
- open: $,
74
- options: B,
75
- placeholder: !o || o.length === 0 ? y.formatMessage(H.multiselectPlaceholder) : "",
73
+ open: y,
74
+ options: v,
75
+ placeholder: !n || n.length === 0 ? w.formatMessage(G.multiselectPlaceholder) : "",
76
76
  portalElement: C,
77
- value: o
77
+ value: n
78
78
  })
79
79
  })]
80
80
  });
@@ -83,5 +83,5 @@ const x = (t) => t === "isBlank" || t === "isNotBlank", oe = ({
83
83
  });
84
84
  };
85
85
  export {
86
- oe as MetadataMultiSelectFieldAdvanced
86
+ ne as MetadataMultiSelectFieldAdvanced
87
87
  };
@@ -1,12 +1,12 @@
1
- import { TooltipProvider as f, Combobox as v } from "@box/blueprint-web";
2
- import { useFormikContext as g, getIn as C, Field as F } from "formik";
3
- import { useIntl as b } from "react-intl";
4
- import $ from "../../../../messages.js";
5
- import { fieldDefaultProps as x } from "../constants.js";
6
- import { jsx as o } from "react/jsx-runtime";
7
- const k = ({
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
8
  disableForm: n,
9
- fieldNamePrefix: a,
9
+ fieldNamePrefix: o,
10
10
  label: l,
11
11
  portalElement: s,
12
12
  hasAccordion: i
@@ -14,44 +14,41 @@ const k = ({
14
14
  const {
15
15
  setFieldValue: m,
16
16
  values: u
17
- } = g(), d = b(), r = `${a}.value.enum`, c = C(u, `${a}.options`, []).map(({
17
+ } = v(), d = F(), r = `${o}.value.enum`, c = g(u, `${o}.options`, []).map(({
18
18
  key: e
19
- }) => e), p = (e, t) => t.toLowerCase().includes(e.toLowerCase());
20
- return /* @__PURE__ */ o("div", {
19
+ }) => e), p = (e, a) => a.toLowerCase().includes(e.toLowerCase());
20
+ return /* @__PURE__ */ t("div", {
21
21
  "data-testid": `${l}-field`,
22
- children: /* @__PURE__ */ o(F, {
22
+ children: /* @__PURE__ */ t(C, {
23
23
  name: r,
24
24
  children: ({
25
25
  field: e
26
- }) => {
27
- var t;
28
- return /* @__PURE__ */ o(f, {
29
- children: /* @__PURE__ */ o(v, {
30
- ...x,
31
- as: "input",
32
- "data-target-id": `Combobox-${a}`,
33
- disabled: n,
34
- filterFn: p,
35
- hideLabel: i,
36
- label: l,
37
- multiselect: !0,
38
- name: e.name,
39
- onValueChange: (h) => m(r, h),
40
- options: c,
41
- placeholder: (
42
- // Empty array must be substituded if there is no value found
43
- // Otherwise an no placeholder appears despite no selection
44
- ((t = e.value || []) == null ? void 0 : t.length) === 0 ? d.formatMessage($.multiselectPlaceholder) : ""
45
- ),
46
- portalElement: s,
47
- value: e.value
48
- })
49
- });
50
- }
26
+ }) => /* @__PURE__ */ t(h, {
27
+ children: /* @__PURE__ */ t(f, {
28
+ ...$,
29
+ as: "input",
30
+ "data-target-id": `Combobox-${o}`,
31
+ disabled: n,
32
+ filterFn: p,
33
+ hideLabel: i,
34
+ label: l,
35
+ multiselect: !0,
36
+ 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,
45
+ value: e.value
46
+ })
47
+ })
51
48
  })
52
49
  });
53
50
  };
54
51
  export {
55
- k as MetadataMultiSelectField,
56
- k as default
52
+ j as MetadataMultiSelectField,
53
+ j as default
57
54
  };
@@ -1,20 +1,20 @@
1
- let t = /* @__PURE__ */ function(r) {
1
+ let A = /* @__PURE__ */ (function(r) {
2
2
  return r.MATCH_ANY = "matchAny", r.MATCH_ALL = "matchAll", r.IS_BLANK = "isBlank", r.IS_NOT_BLANK = "isNotBlank", r;
3
- }({});
4
- const _ = (r, A) => r && (A == null ? void 0 : A.some(([s]) => s === r)) ? r : t.MATCH_ANY, I = (r, A) => {
3
+ })({});
4
+ const _ = (r, t) => r && t?.some(([s]) => s === r) ? r : A.MATCH_ANY, o = (r, t) => {
5
5
  if (Array.isArray(r))
6
6
  return r.filter((s) => s !== "");
7
- if (A && typeof r == "object" && r !== null)
7
+ if (t && typeof r == "object" && r !== null)
8
8
  return (r.value || []).filter((u) => u !== "");
9
9
  const n = r || [];
10
10
  return Array.isArray(n) ? n.filter((s) => s !== "") : [];
11
- }, B = (r, A, n) => n ? {
12
- value: N(A) ? [] : r,
13
- advancedFilterOption: A
14
- } : r, N = (r) => r === t.IS_BLANK || r === t.IS_NOT_BLANK;
11
+ }, I = (r, t, n) => n ? {
12
+ value: N(t) ? [] : r,
13
+ advancedFilterOption: t
14
+ } : r, N = (r) => r === A.IS_BLANK || r === A.IS_NOT_BLANK;
15
15
  export {
16
- t as MultiSelectAdvancedFilterOption,
17
- B as createFieldValue,
16
+ A as MultiSelectAdvancedFilterOption,
17
+ I as createFieldValue,
18
18
  _ as getInitialAdvancedFilterValue,
19
- I as getInputValue
19
+ o as getInputValue
20
20
  };
@@ -1,76 +1,76 @@
1
- import { TextInput as j } from "@box/blueprint-web";
2
- import { Field as k } from "formik";
3
- import { useState as y, useCallback as x } from "react";
4
- import { useIntl as D } from "react-intl";
5
- import i from "../../../../messages.js";
6
- import { fieldDefaultProps as H } from "../constants.js";
7
- import { getInitialAdvancedFilterValue as q, createFieldValue as w, getInputValue as z, shouldHideTextInput as B } from "./utils.js";
8
- import { jsx as p, jsxs as G, Fragment as J } from "react/jsx-runtime";
9
- import { A as K } from "../../../../../../chunks/index.js";
10
- const N = ({
11
- label: m,
12
- fieldNamePrefix: V,
13
- disableForm: g,
1
+ import { TextInput as M } from "@box/blueprint-web";
2
+ import { Field as $ } from "formik";
3
+ import { useState as j, useCallback as I } 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 d, getInputValue as H, shouldHideTextInput as q } from "./utils.js";
8
+ import { jsx as m, jsxs as z, Fragment as B } from "react/jsx-runtime";
9
+ import { A as F } from "../../../../../../chunks/index.js";
10
+ const G = ({
11
+ label: l,
12
+ fieldNamePrefix: n,
13
+ disableForm: i,
14
14
  isAdvancedFilterEnabled: t,
15
- onAdvancedFilterOptionChange: o,
16
- fieldAdvancedFilterOptions: I,
15
+ onAdvancedFilterOptionChange: p,
16
+ fieldAdvancedFilterOptions: V,
17
17
  filterOptionsMap: h,
18
18
  hasAccordion: c,
19
- isModified: S,
20
- placeholder: T
19
+ isModified: w,
20
+ placeholder: S
21
21
  }) => {
22
- const n = D(), a = `${V}.value.enum[0]`, [l, L] = y(q(I, h)), M = x((e, s, u) => {
23
- L(e), o == null || o(a, e);
24
- const r = w(s, e, t);
25
- u.setFieldValue(a, r);
26
- }, [a, t, o]), $ = x((e, s) => {
27
- const u = e.target.value, r = w(u, l, t);
28
- s.setFieldValue(a, r);
29
- }, [l, t, a]);
30
- return /* @__PURE__ */ p("div", {
31
- "data-testid": `${m}-field`,
32
- children: /* @__PURE__ */ p(k, {
22
+ const f = k(), a = `${n}.value.enum[0]`, [s, T] = j(D(V, h)), C = I((e, u, r) => {
23
+ T(e), p?.(a, e);
24
+ const o = d(u, e, t);
25
+ r.setFieldValue(a, o);
26
+ }, [a, t, p]), L = I((e, u) => {
27
+ const r = e.target.value, o = d(r, s, t);
28
+ u.setFieldValue(a, o);
29
+ }, [s, t, a]);
30
+ return /* @__PURE__ */ m("div", {
31
+ "data-testid": `${l}-field`,
32
+ children: /* @__PURE__ */ m($, {
33
33
  name: a,
34
34
  children: ({
35
35
  field: e,
36
- meta: s,
37
- form: u
36
+ meta: u,
37
+ form: r
38
38
  }) => {
39
- const r = z(e.value, t);
40
- return /* @__PURE__ */ G(J, {
41
- children: [t && /* @__PURE__ */ p(K, {
42
- disableForm: g,
43
- fieldAdvancedFilterOptions: I,
44
- fieldNamePrefix: V,
39
+ const o = H(e.value, t);
40
+ return /* @__PURE__ */ z(B, {
41
+ children: [t && /* @__PURE__ */ m(F, {
42
+ disableForm: i,
43
+ fieldAdvancedFilterOptions: V,
44
+ fieldNamePrefix: n,
45
45
  filterOptionsMap: h,
46
- isModified: S,
47
- label: m,
48
- onAdvancedFilterOptionChange: o,
49
- onValueChange: (f) => M(f, r, u),
46
+ isModified: w,
47
+ label: l,
48
+ onAdvancedFilterOptionChange: p,
49
+ onValueChange: (g) => C(g, o, r),
50
50
  showLabel: t && !c,
51
- value: l
52
- }), !B(t, l) && /* @__PURE__ */ p(j, {
53
- ...H,
51
+ value: s
52
+ }), !q(t, s) && /* @__PURE__ */ m(M, {
53
+ ...y,
54
54
  ...e,
55
- "aria-label": n.formatMessage(i.enterValueAriaLabel, {
56
- label: m
55
+ "aria-label": f.formatMessage(x.enterValueAriaLabel, {
56
+ label: l
57
57
  }),
58
- "data-target-id": `TextInput-${V}`,
59
- disabled: g,
60
- error: s.error,
58
+ "data-target-id": `TextInput-${n}`,
59
+ disabled: i,
60
+ error: u.error,
61
61
  hideLabel: t || c,
62
- label: m,
63
- onChange: (f) => $(f, u),
64
- placeholder: T || n.formatMessage(i.setValuePlaceholder),
65
- value: r
62
+ label: l,
63
+ onChange: (g) => L(g, r),
64
+ placeholder: S || f.formatMessage(x.setValuePlaceholder),
65
+ value: o
66
66
  })]
67
67
  });
68
68
  }
69
69
  })
70
70
  });
71
71
  };
72
- N.displayName = "MetadataStringField";
72
+ G.displayName = "MetadataStringField";
73
73
  export {
74
- N as MetadataStringField,
75
- N as default
74
+ G as MetadataStringField,
75
+ G as default
76
76
  };
@@ -1,15 +1,15 @@
1
- let s = /* @__PURE__ */ function(t) {
1
+ let u = /* @__PURE__ */ (function(t) {
2
2
  return t.MATCH_EXACTLY = "matchExactly", t.STARTS_WITH = "startsWith", t.CONTAINS = "contains", t.IS_NOT = "isNot", t.IS_BLANK = "isBlank", t.IS_NOT_BLANK = "isNotBlank", t;
3
- }({});
4
- const _ = (t, u) => t && (u == null ? void 0 : u.some(([N]) => N === t)) ? t : s.MATCH_EXACTLY, I = (t) => t === s.IS_BLANK || t === s.IS_NOT_BLANK, r = (t, u) => u && typeof t == "object" && t !== null ? t.value || "" : t || "", n = (t, u, T) => T ? {
5
- value: I(u) ? "" : t,
6
- advancedFilterOption: u
7
- } : t, c = (t, u) => t && I(u);
3
+ })({});
4
+ const I = (t, s) => t && s?.some(([n]) => n === t) ? t : u.MATCH_EXACTLY, T = (t) => t === u.IS_BLANK || t === u.IS_NOT_BLANK, N = (t, s) => s && typeof t == "object" && t !== null ? t.value || "" : t || "", _ = (t, s, r) => r ? {
5
+ value: T(s) ? "" : t,
6
+ advancedFilterOption: s
7
+ } : t, e = (t, s) => t && T(s);
8
8
  export {
9
- s as AdvancedFilterOption,
10
- n as createFieldValue,
11
- _ as getInitialAdvancedFilterValue,
12
- r as getInputValue,
13
- I as isBlankOption,
14
- c as shouldHideTextInput
9
+ u as AdvancedFilterOption,
10
+ _ as createFieldValue,
11
+ I as getInitialAdvancedFilterValue,
12
+ N as getInputValue,
13
+ T as isBlankOption,
14
+ e as shouldHideTextInput
15
15
  };
@@ -1,69 +1,69 @@
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
- import { jsx as e } from "react/jsx-runtime";
7
- const D = ({
8
- className: m,
9
- disableForm: l,
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";
4
+ import { useIntl as $ } from "react-intl";
5
+ import j from "../../../../messages.js";
6
+ import { jsx as o } from "react/jsx-runtime";
7
+ const z = ({
8
+ className: n,
9
+ disableForm: r,
10
10
  fieldNamePrefix: u,
11
- label: a,
12
- portalElement: d,
13
- taxonomyOptionsFetcher: s,
14
- isMultilevelTaxonomyFieldEnabled: k,
15
- hasAccordion: p
11
+ label: l,
12
+ portalElement: m,
13
+ taxonomyOptionsFetcher: d,
14
+ isMultilevelTaxonomyFieldEnabled: C,
15
+ hasAccordion: c
16
16
  }) => {
17
17
  const {
18
- setFieldValue: c,
19
- values: h
20
- } = P(), {
18
+ setFieldValue: v,
19
+ values: p
20
+ } = I(), {
21
21
  metadata: {
22
- templateKey: v,
22
+ templateKey: h,
23
23
  scope: g
24
24
  }
25
- } = h, y = w(), i = `${u}.value`, F = W(h, u), {
26
- key: f,
25
+ } = p, k = $(), a = `${u}.value`, y = L(p, u), {
26
+ key: b,
27
27
  optionsRules: {
28
- multiSelect: n,
28
+ multiSelect: s,
29
29
  selectableLevels: t
30
30
  },
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;
33
- return /* @__PURE__ */ e("div", {
34
- "data-testid": `${a}-field`,
35
- children: /* @__PURE__ */ e($, {
36
- name: i,
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,
37
37
  children: ({
38
- field: o
39
- }) => M ? /* @__PURE__ */ e(T, {
40
- className: m,
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),
49
- portalElement: d,
38
+ field: e
39
+ }) => V ? /* @__PURE__ */ o(M, {
40
+ className: n,
41
+ defaultFetcher: f,
42
+ disabled: r,
43
+ hideLabel: c,
44
+ label: l,
45
+ levels: F,
46
+ multiselect: s,
47
+ onValueChange: (i) => v(a, i),
48
+ placeholder: x(e.value),
49
+ portalElement: m,
50
50
  selectableLevels: t,
51
- value: o.value
52
- }) : /* @__PURE__ */ e(I, {
53
- className: m,
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),
60
- portalElement: d,
61
- value: o.value
51
+ value: e.value
52
+ }) : /* @__PURE__ */ o(T, {
53
+ className: n,
54
+ defaultFetcher: f,
55
+ disabled: r,
56
+ label: c ? void 0 : l,
57
+ multiselect: s,
58
+ onValueChange: (i) => v(a, i),
59
+ placeholder: x(e.value),
60
+ portalElement: m,
61
+ value: e.value
62
62
  })
63
63
  })
64
64
  });
65
65
  };
66
66
  export {
67
- D as MetadataTaxonomyField,
68
- D as default
67
+ z as MetadataTaxonomyField,
68
+ z as default
69
69
  };
@@ -1,19 +1,19 @@
1
1
  import t from "../../messages.js";
2
- import { filterFieldTypes as F, advancedFilterFieldTypes as m } from "./filter-field-types.js";
3
- const c = ({
2
+ import { advancedFilterFieldTypes as l, filterFieldTypes as i } from "./filter-field-types.js";
3
+ const y = ({
4
4
  field: a,
5
- isAdvancedFilterEnabled: s,
5
+ isAdvancedFilterEnabled: r,
6
6
  intl: e,
7
- filterOptionsMap: r
7
+ filterOptionsMap: d
8
8
  }) => {
9
- const o = s ? m : F, d = o[a.type] || F[a.type], i = d && !a.hidden;
9
+ const s = r ? l : i, o = s[a.type] || i[a.type], F = o && !a.hidden;
10
10
  return {
11
- fieldTypesMap: o,
12
- MetadataFilterField: d,
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.modifiedAtFilterCustomRange)]] : (r == null ? void 0 : r[a.type]) || []
11
+ fieldTypesMap: s,
12
+ MetadataFilterField: o,
13
+ showField: F,
14
+ getFilterOptionsForField: () => a.key === "modified_at" && r ? [["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.modifiedAtFilterCustomRange)]] : d?.[a.type] || []
15
15
  };
16
16
  };
17
17
  export {
18
- c as processMetadataField
18
+ y as processMetadataField
19
19
  };
@@ -17,8 +17,7 @@ const f = (t) => typeof t == "object" && t !== null && "range" in t, O = (t) =>
17
17
  if (t && typeof t == "object")
18
18
  return o(t.advancedFilterOption);
19
19
  }, h = (t) => {
20
- var e;
21
- const n = (e = t.enum) == null ? void 0 : e[0];
20
+ const n = t.enum?.[0];
22
21
  return a(n);
23
22
  }, F = (t) => {
24
23
  const n = t.enum;
@@ -27,8 +26,7 @@ const f = (t) => typeof t == "object" && t !== null && "range" in t, O = (t) =>
27
26
  const e = Array.isArray(n) ? n[0] : void 0;
28
27
  return a(e);
29
28
  }, j = (t) => {
30
- var e;
31
- const n = (e = t.enum) == null ? void 0 : e[0];
29
+ const n = t.enum?.[0];
32
30
  return a(n);
33
31
  }, x = (t) => o(t.advancedFilterOption), S = {
34
32
  string: h,
@@ -42,10 +40,9 @@ const f = (t) => typeof t == "object" && t !== null && "range" in t, O = (t) =>
42
40
  const r = S[t];
43
41
  return r ? r(n) : void 0;
44
42
  }, E = (t, n) => {
45
- var r;
46
43
  if (!n)
47
44
  return !1;
48
- const e = (r = t.enum) == null ? void 0 : r[0];
45
+ const e = t.enum?.[0];
49
46
  return e && typeof e == "object" && O(e) ? l(e.value) : typeof e == "string" && e !== "";
50
47
  }, p = (t, n) => {
51
48
  if (!n)
@@ -53,14 +50,13 @@ const f = (t) => typeof t == "object" && t !== null && "range" in t, O = (t) =>
53
50
  const e = t.enum;
54
51
  return Array.isArray(e) ? m(e) : e && typeof e == "object" ? m(e.value) : !1;
55
52
  }, C = (t, n) => {
56
- var e;
57
53
  if (n) {
58
- const r = (e = t.enum) == null ? void 0 : e[0];
59
- if (r && typeof r == "object") {
60
- if ("value" in r && f(r.value))
61
- return u(r.value.range);
62
- if (f(r))
63
- return u(r.range);
54
+ const e = t.enum?.[0];
55
+ if (e && typeof e == "object") {
56
+ if ("value" in e && f(e.value))
57
+ return u(e.value.range);
58
+ if (f(e))
59
+ return u(e.range);
64
60
  }
65
61
  }
66
62
  return u(t.range);