@box/metadata-filter 1.18.7 → 1.18.8

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,15 +1,15 @@
1
- import { Text as S, Select as c } from "@box/blueprint-web";
2
- import { Field as j } from "formik";
3
- import { useState as D, useCallback as I } from "react";
4
- import { useIntl as k } from "react-intl";
1
+ import { Text as D, Select as c } from "@box/blueprint-web";
2
+ import { Field as I } from "formik";
3
+ import { useState as k, useCallback as B } from "react";
4
+ import { useIntl as $ } from "react-intl";
5
5
  import i from "../esm/lib/messages.js";
6
- import { jsxs as B, Fragment as $, jsx as e } from "react/jsx-runtime";
7
- import '../styles/index.css';const q = "_noAttributesText_12d80_1", w = "_fieldLabel_12d80_5", z = "_selectContainer_12d80_10", E = "_comboboxContainer_12d80_15", _ = {
8
- noAttributesText: q,
9
- fieldLabel: w,
10
- selectContainer: z,
11
- comboboxContainer: E
12
- }, R = ({
6
+ import { jsxs as q, Fragment as w, jsx as e } from "react/jsx-runtime";
7
+ import '../styles/index.css';const z = "_noAttributesText_12d80_1", E = "_fieldLabel_12d80_5", G = "_selectContainer_12d80_10", H = "_comboboxContainer_12d80_15", _ = {
8
+ noAttributesText: z,
9
+ fieldLabel: E,
10
+ selectContainer: G,
11
+ comboboxContainer: H
12
+ }, V = ({
13
13
  label: d,
14
14
  fieldNamePrefix: n,
15
15
  fieldAdvancedFilterOptions: h,
@@ -23,19 +23,21 @@ import '../styles/index.css';const q = "_noAttributesText_12d80_1", w = "_fieldL
23
23
  advancedFilterFieldName: C = `${n}.value.advancedFilterOption`,
24
24
  value: o,
25
25
  labelClassName: L = _.fieldLabel,
26
- labelAs: g = "div"
26
+ labelAs: g = "div",
27
+ open: A,
28
+ onOpenChange: T
27
29
  }) => {
28
- const s = k(), [A, T] = D(h || f), F = o !== void 0 ? o : A, p = I((t, ...r) => {
29
- o === void 0 && T(t), l && l(n, t), m(t, ...r);
30
+ const s = $(), [F, p] = k(h || f), y = o !== void 0 ? o : F, S = B((t, ...r) => {
31
+ o === void 0 && p(t), l && l(n, t), m(t, ...r);
30
32
  }, [n, l, m, o]);
31
- return /* @__PURE__ */ B($, {
32
- children: [v && /* @__PURE__ */ e(S, {
33
+ return /* @__PURE__ */ q(w, {
34
+ children: [v && /* @__PURE__ */ e(D, {
33
35
  as: g,
34
36
  className: L,
35
37
  color: "textOnLightDefault",
36
38
  variant: "bodyDefaultBold",
37
39
  children: d
38
- }), /* @__PURE__ */ e(j, {
40
+ }), /* @__PURE__ */ e(I, {
39
41
  name: C,
40
42
  children: ({
41
43
  field: t,
@@ -52,13 +54,15 @@ import '../styles/index.css';const q = "_noAttributesText_12d80_1", w = "_fieldL
52
54
  error: r.touched && r.error ? r.error : void 0,
53
55
  hideLabel: !0,
54
56
  label: s.formatMessage(i.selectFilterType),
55
- onValueChange: p,
57
+ onOpenChange: T,
58
+ onValueChange: S,
59
+ open: A,
56
60
  placeholder: s.formatMessage(i.selectOptionPlaceholder),
57
- value: F,
61
+ value: y,
58
62
  children: /* @__PURE__ */ e(c.Content, {
59
63
  container: x,
60
- children: a == null ? void 0 : a.map(([u, y]) => /* @__PURE__ */ e(c.Option, {
61
- text: y,
64
+ children: a == null ? void 0 : a.map(([u, j]) => /* @__PURE__ */ e(c.Option, {
65
+ text: j,
62
66
  value: u
63
67
  }, u))
64
68
  })
@@ -68,6 +72,6 @@ import '../styles/index.css';const q = "_noAttributesText_12d80_1", w = "_fieldL
68
72
  });
69
73
  };
70
74
  export {
71
- R as A,
75
+ V as A,
72
76
  _ as s
73
77
  };
@@ -1,68 +1,77 @@
1
- import { TooltipProvider as S, Combobox as $ } from "@box/blueprint-web";
2
- import { useFormikContext as j, getIn as C, Field as F } from "formik";
3
- import { useState as M, useCallback as T } from "react";
4
- import { useIntl as D } from "react-intl";
5
- import P from "../../../../messages.js";
6
- import { fieldDefaultProps as U } from "../constants.js";
7
- import { getInitialAdvancedFilterValue as b, createFieldValue as h, getInputValue as q } from "./utils.js";
8
- import { jsx as a, jsxs as v, Fragment as z } from "react/jsx-runtime";
9
- import { A as G } from "../../../../../../chunks/index.js";
10
- const d = (t) => t === "isBlank" || t === "isNotBlank", Z = ({
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";
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 = ({
11
11
  label: t,
12
- fieldNamePrefix: n,
13
- disableForm: f,
14
- isAdvancedFilterEnabled: m,
15
- onAdvancedFilterOptionChange: o,
16
- fieldAdvancedFilterOptions: p,
12
+ fieldNamePrefix: m,
13
+ disableForm: h,
14
+ isAdvancedFilterEnabled: u,
15
+ onAdvancedFilterOptionChange: l,
16
+ fieldAdvancedFilterOptions: g,
17
17
  filterOptionsMap: V,
18
- portalElement: g
18
+ portalElement: C
19
19
  }) => {
20
20
  const {
21
- setFieldValue: k,
22
- values: w
23
- } = j(), I = D(), l = `${n}.value.enum`, L = C(w, `${n}.options`, []).map((e) => e == null ? void 0 : e.key).filter((e) => typeof e == "string"), [c, x] = M(b(p, V)), y = (e, s) => typeof s != "string" ? !1 : s.toLowerCase().includes(e.toLowerCase()), B = T((e, s, r) => {
24
- x(e), o == null || o(l, e);
25
- const u = d(e) ? [] : s, i = h(u, e, m);
26
- r.setFieldValue(l, i);
27
- }, [l, m, o]);
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);
25
+ const r = x(e) ? [] : s, i = k(r, e, u);
26
+ o.setFieldValue(n, i);
27
+ }, [n, u, l]), F = p((e) => {
28
+ d(e), e && b(!1);
29
+ }, []), M = p((e) => {
30
+ b(e), e && d(!1);
31
+ }, []);
28
32
  return /* @__PURE__ */ a("div", {
29
33
  "data-testid": `${t}-field`,
30
- children: /* @__PURE__ */ a(F, {
31
- name: l,
34
+ children: /* @__PURE__ */ a(q, {
35
+ name: n,
32
36
  children: ({
33
37
  field: e,
34
38
  form: s
35
39
  }) => {
36
- const r = q(e.value, m);
37
- return /* @__PURE__ */ v(z, {
38
- children: [/* @__PURE__ */ a(G, {
39
- disableForm: f,
40
- fieldAdvancedFilterOptions: p,
41
- fieldNamePrefix: n,
40
+ const o = J(e.value, u);
41
+ return /* @__PURE__ */ K(N, {
42
+ children: [/* @__PURE__ */ a(Q, {
43
+ disableForm: h,
44
+ fieldAdvancedFilterOptions: g,
45
+ fieldNamePrefix: m,
42
46
  filterOptionsMap: V,
43
47
  label: t,
44
- onAdvancedFilterOptionChange: o,
45
- onValueChange: (u) => B(u, r, s),
48
+ onAdvancedFilterOptionChange: l,
49
+ onOpenChange: M,
50
+ onValueChange: (r) => j(r, o, s),
51
+ open: O,
52
+ portalElement: C,
46
53
  showLabel: !0,
47
54
  value: c
48
- }), !d(c) && /* @__PURE__ */ a(S, {
49
- children: /* @__PURE__ */ a($, {
50
- ...U,
55
+ }), !x(c) && /* @__PURE__ */ a(T, {
56
+ children: /* @__PURE__ */ a(D, {
57
+ ...G,
51
58
  as: "input",
52
- disabled: f,
53
- filterFn: y,
59
+ disabled: h,
60
+ filterFn: $,
54
61
  hideLabel: !0,
55
62
  label: t,
56
63
  multiselect: !0,
57
64
  name: e.name,
58
- onValueChange: (u) => {
59
- const i = h(u, c, m);
60
- k(l, i);
65
+ onOpenChange: F,
66
+ onValueChange: (r) => {
67
+ const i = k(r, c, u);
68
+ I(n, i);
61
69
  },
70
+ open: B,
62
71
  options: L,
63
- placeholder: !r || r.length === 0 ? I.formatMessage(P.multiselectPlaceholder) : "",
64
- portalElement: g,
65
- value: r
72
+ placeholder: !o || o.length === 0 ? w.formatMessage(z.multiselectPlaceholder) : "",
73
+ portalElement: C,
74
+ value: o
66
75
  })
67
76
  })]
68
77
  });
@@ -71,5 +80,5 @@ const d = (t) => t === "isBlank" || t === "isNotBlank", Z = ({
71
80
  });
72
81
  };
73
82
  export {
74
- Z as MetadataMultiSelectFieldAdvanced
83
+ te as MetadataMultiSelectFieldAdvanced
75
84
  };
@@ -13,6 +13,8 @@ export interface AdvancedFilterSelectProps {
13
13
  value?: string;
14
14
  labelClassName?: string;
15
15
  labelAs?: 'div' | 'span';
16
+ open?: boolean;
17
+ onOpenChange?: (open: boolean) => void;
16
18
  }
17
- export declare const AdvancedFilterSelect: ({ label, fieldNamePrefix, fieldAdvancedFilterOptions, filterOptionsMap, disableForm, portalElement, onAdvancedFilterOptionChange, onValueChange, defaultValue, showLabel, advancedFilterFieldName, value, labelClassName, labelAs, }: AdvancedFilterSelectProps) => import("react/jsx-runtime").JSX.Element;
19
+ export declare const AdvancedFilterSelect: ({ label, fieldNamePrefix, fieldAdvancedFilterOptions, filterOptionsMap, disableForm, portalElement, onAdvancedFilterOptionChange, onValueChange, defaultValue, showLabel, advancedFilterFieldName, value, labelClassName, labelAs, open, onOpenChange, }: AdvancedFilterSelectProps) => import("react/jsx-runtime").JSX.Element;
18
20
  export default AdvancedFilterSelect;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-filter",
3
- "version": "1.18.7",
3
+ "version": "1.18.8",
4
4
  "peerDependencies": {
5
5
  "@box/blueprint-web": "^7.8.0",
6
6
  "@box/blueprint-web-assets": "^4.16.0",