@box/metadata-view 1.25.0 → 1.25.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,53 +1,58 @@
1
- import { FilterChip as c } from "@box/blueprint-web";
2
- import { Formik as h, Form as F } from "formik";
3
- import { useRef as C } from "react";
4
- import R from "./all-filters-chip.js";
5
- import { getInitialFieldValues as G } from "./initial-field-values.js";
1
+ import { FilterChip as h } from "@box/blueprint-web";
2
+ import { Formik as F, Form as C } from "formik";
3
+ import { useMemo as R, useRef as y } from "react";
4
+ import G from "./all-filters-chip.js";
5
+ import { getInitialFieldValues as j } from "./initial-field-values.js";
6
6
  import { MetadataFilterChip as x } from "./metadata-filter-chip.js";
7
- import { usePredefinedFilter as V } from "./predefinedFilters/use-predefined-filter.js";
7
+ import { usePredefinedFilter as M } from "./predefinedFilters/use-predefined-filter.js";
8
8
  import { s as b } from "../../../../chunks/filter-row.module.js";
9
- import { jsx as r, jsxs as j } from "react/jsx-runtime";
9
+ import { jsx as i, jsxs as w } from "react/jsx-runtime";
10
10
  import "./form-filter-chip.js";
11
11
  import "./select-filter-chip.js";
12
12
  import "./predefinedFilters/index.js";
13
- const q = ({
14
- predefinedFilterOptions: m,
13
+ const T = ({
14
+ predefinedFilterOptions: p,
15
15
  containerRef: s,
16
- filterGroups: p = [],
17
- initialFilterValues: a,
18
- isAllFiltersDisabled: n,
19
- onFilterSubmit: e
16
+ filterGroups: a = [],
17
+ initialFilterValues: t,
18
+ isAllFiltersDisabled: f,
19
+ onFilterSubmit: o
20
20
  }) => {
21
- const f = V(m), u = ({
21
+ const n = M(p), d = ({
22
22
  metadata: {
23
- fields: i
23
+ fields: e
24
24
  }
25
25
  }) => {
26
- e && e(i);
27
- }, t = [...f, ...p], o = t.flatMap(({
28
- filters: i
29
- }) => i), d = G(o, a), l = C(null);
30
- return /* @__PURE__ */ r(h, {
26
+ o && o(e);
27
+ }, l = [...n, ...a], r = l.flatMap(({
28
+ filters: e
29
+ }) => e), u = r.map((e) => `${e.id}:${e.fieldType}`).join("|"), c = R(
30
+ () => j(r, t),
31
+ // Intentionally depend on filterSchemaKey (not filterOptions identity) to prevent unwanted reinitialization
32
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- depend on schema key instead of filterOptions identity
33
+ [u, t]
34
+ ), m = y(null);
35
+ return /* @__PURE__ */ i(F, {
31
36
  enableReinitialize: !0,
32
- initialValues: d,
33
- onSubmit: u,
34
- children: /* @__PURE__ */ r(F, {
35
- ref: l,
36
- children: /* @__PURE__ */ j(c.Group, {
37
+ initialValues: c,
38
+ onSubmit: d,
39
+ children: /* @__PURE__ */ i(C, {
40
+ ref: m,
41
+ children: /* @__PURE__ */ w(h.Group, {
37
42
  className: b.filterChipGroup,
38
43
  name: "metadata-view-filters",
39
44
  type: "multiple",
40
- children: [n ? null : /* @__PURE__ */ r(R, {
45
+ children: [f ? null : /* @__PURE__ */ i(G, {
41
46
  containerRef: s,
42
- filterGroups: t
43
- }), o.filter((i) => i.shouldRenderChip).map((i) => /* @__PURE__ */ r(x, {
44
- filterOption: i,
45
- formRef: l
46
- }, i.id))]
47
+ filterGroups: l
48
+ }), r.filter((e) => e.shouldRenderChip).map((e) => /* @__PURE__ */ i(x, {
49
+ filterOption: e,
50
+ formRef: m
51
+ }, e.id))]
47
52
  })
48
53
  })
49
54
  });
50
55
  };
51
56
  export {
52
- q as FilterRow
57
+ T as FilterRow
53
58
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-view",
3
- "version": "1.25.0",
3
+ "version": "1.25.2",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
6
  "@box/blueprint-web": "^12.76.2",
@@ -18,13 +18,13 @@
18
18
  "react-intl": "^6.4.2"
19
19
  },
20
20
  "devDependencies": {
21
- "@box/blueprint-web": "^12.103.0",
22
- "@box/blueprint-web-assets": "^4.85.0",
23
- "@box/box-item-type-selector": "^1.14.2",
21
+ "@box/blueprint-web": "^12.103.1",
22
+ "@box/blueprint-web-assets": "^4.86.0",
23
+ "@box/box-item-type-selector": "^1.14.3",
24
24
  "@box/eslint-plugin-blueprint": "1.0.5",
25
- "@box/item-icon": "^2.5.2",
26
- "@box/metadata-filter": "^1.52.2",
27
- "@box/storybook-utils": "0.14.22",
25
+ "@box/item-icon": "^2.5.3",
26
+ "@box/metadata-filter": "^1.52.3",
27
+ "@box/storybook-utils": "0.14.23",
28
28
  "@box/types": "2.0.0",
29
29
  "@tanstack/react-virtual": "^3.10.8",
30
30
  "react-intl": "^6.4.2"