@box/metadata-view 1.50.16 → 1.51.1

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,43 +1,44 @@
1
1
  import { FilterChip as e } from "@box/blueprint-web";
2
- import { Filter as f } from "@box/blueprint-web-assets/icons/Line";
2
+ import { Filter as u } from "@box/blueprint-web-assets/icons/Line";
3
3
  import { useFormikContext as d } from "formik";
4
- import { useState as u, useMemo as h } from "react";
5
- import { useIntl as F } from "react-intl";
6
- import { getInitialFieldValues as g } from "./initial-field-values.js";
7
- import { isFilterSelected as C } from "./is-filter-selected.js";
4
+ import { useState as h, useMemo as F } from "react";
5
+ import { useIntl as g } from "react-intl";
6
+ import { getInitialFieldValues as C } from "./initial-field-values.js";
7
+ import { isFilterSelected as I } from "./is-filter-selected.js";
8
8
  import S from "./messages.js";
9
- import { s as I } from "../../../../chunks/filter-row.module.js";
10
- import { jsxs as a, Fragment as O, jsx as t } from "react/jsx-runtime";
11
- import { FilterSidePanel as v } from "../filter-sidepanel/filter-side-panel.js";
12
- const P = ({
13
- containerRef: m,
14
- filterGroups: l
9
+ import { s as v } from "../../../../chunks/filter-row.module.js";
10
+ import { jsxs as m, Fragment as O, jsx as t } from "react/jsx-runtime";
11
+ import { FilterSidePanel as x } from "../filter-sidepanel/filter-side-panel.js";
12
+ const q = ({
13
+ containerRef: p,
14
+ filterGroups: l,
15
+ onAllFiltersClick: r
15
16
  }) => {
16
17
  const {
17
- formatMessage: p
18
- } = F(), {
19
- values: r
20
- } = d(), [o, s] = u(!1), c = () => s(!0), n = h(() => Object.values(r.metadata.fields).filter((i) => C(i.value)).length, [r.metadata.fields]);
21
- return /* @__PURE__ */ a(O, {
18
+ formatMessage: c
19
+ } = g(), {
20
+ values: o
21
+ } = d(), [s, a] = h(!1), f = () => r ? r() : a(!0), n = F(() => Object.values(o.metadata.fields).filter((i) => I(i.value)).length, [o.metadata.fields]);
22
+ return /* @__PURE__ */ m(O, {
22
23
  children: [
23
24
  // We need to initialize the sidepanel state at the moment it is opened
24
- o && /* @__PURE__ */ t(v, {
25
- containerRef: m,
25
+ s && /* @__PURE__ */ t(x, {
26
+ containerRef: p,
26
27
  filterGroups: l,
27
- getInitialFormValues: () => g(l.flatMap(({
28
+ getInitialFormValues: () => C(l.flatMap(({
28
29
  filters: i
29
30
  }) => i)),
30
- isOpen: o,
31
- onIsOpenChange: s
31
+ isOpen: s,
32
+ onIsOpenChange: a
32
33
  }),
33
- /* @__PURE__ */ a(e.ChipButton, {
34
- onClick: c,
34
+ /* @__PURE__ */ m(e.ChipButton, {
35
+ onClick: f,
35
36
  value: "all-filters-chip-btn",
36
37
  children: [/* @__PURE__ */ t(e.Icon, {
37
- className: I.filterChipIcon,
38
- icon: f
38
+ className: v.filterChipIcon,
39
+ icon: u
39
40
  }), /* @__PURE__ */ t(e.Label, {
40
- children: p(S.allFilters)
41
+ children: c(S.allFilters)
41
42
  }), n > 0 ? /* @__PURE__ */ t(e.Status, {
42
43
  children: n.toString()
43
44
  }) : null]
@@ -46,5 +47,5 @@ const P = ({
46
47
  });
47
48
  };
48
49
  export {
49
- P as default
50
+ q as default
50
51
  };
@@ -1,51 +1,53 @@
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
- import { MetadataFilterChip as x } from "./metadata-filter-chip.js";
7
- import { usePredefinedFilter as M } from "./predefinedFilters/use-predefined-filter.js";
8
- import { s as b } from "../../../../chunks/filter-row.module.js";
9
- import { jsx as i, jsxs as w } from "react/jsx-runtime";
1
+ import { FilterChip as F } from "@box/blueprint-web";
2
+ import { Formik as C, Form as R } from "formik";
3
+ import { useMemo as y, useRef as G } from "react";
4
+ import j from "./all-filters-chip.js";
5
+ import { getInitialFieldValues as x } from "./initial-field-values.js";
6
+ import { MetadataFilterChip as M } from "./metadata-filter-chip.js";
7
+ import { usePredefinedFilter as b } from "./predefinedFilters/use-predefined-filter.js";
8
+ import { s as w } from "../../../../chunks/filter-row.module.js";
9
+ import { jsx as i, jsxs as S } 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 T = ({
13
+ const q = ({
14
14
  predefinedFilterOptions: p,
15
15
  containerRef: s,
16
16
  filterGroups: a = [],
17
17
  initialFilterValues: t,
18
18
  isAllFiltersDisabled: f,
19
+ onAllFiltersClick: n,
19
20
  onFilterSubmit: o
20
21
  }) => {
21
- const n = M(p), d = ({
22
+ const d = b(p), u = ({
22
23
  metadata: {
23
24
  fields: e
24
25
  }
25
26
  }) => {
26
27
  o && o(e);
27
- }, l = [...n, ...a], r = l.flatMap(({
28
+ }, l = [...d, ...a], r = l.flatMap(({
28
29
  filters: e
29
- }) => e), u = r.map((e) => `${e.id}:${e.fieldType}`).join("|"), c = R(
30
- () => j(r, t),
30
+ }) => e), c = r.map((e) => `${e.id}:${e.fieldType}`).join("|"), h = y(
31
+ () => x(r, t),
31
32
  // Intentionally depend on filterSchemaKey (not filterOptions identity) to prevent unwanted reinitialization
32
33
  // 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, {
34
+ [c, t]
35
+ ), m = G(null);
36
+ return /* @__PURE__ */ i(C, {
36
37
  enableReinitialize: !0,
37
- initialValues: c,
38
- onSubmit: d,
39
- children: /* @__PURE__ */ i(C, {
38
+ initialValues: h,
39
+ onSubmit: u,
40
+ children: /* @__PURE__ */ i(R, {
40
41
  ref: m,
41
- children: /* @__PURE__ */ w(h.Group, {
42
- className: b.filterChipGroup,
42
+ children: /* @__PURE__ */ S(F.Group, {
43
+ className: w.filterChipGroup,
43
44
  name: "metadata-view-filters",
44
45
  type: "multiple",
45
- children: [f ? null : /* @__PURE__ */ i(G, {
46
+ children: [f ? null : /* @__PURE__ */ i(j, {
46
47
  containerRef: s,
47
- filterGroups: l
48
- }), r.filter((e) => e.shouldRenderChip).map((e) => /* @__PURE__ */ i(x, {
48
+ filterGroups: l,
49
+ onAllFiltersClick: n
50
+ }), r.filter((e) => e.shouldRenderChip).map((e) => /* @__PURE__ */ i(M, {
49
51
  filterOption: e,
50
52
  formRef: m
51
53
  }, e.id))]
@@ -54,5 +56,5 @@ const T = ({
54
56
  });
55
57
  };
56
58
  export {
57
- T as FilterRow
59
+ q as FilterRow
58
60
  };
@@ -1,7 +1,8 @@
1
1
  import { FilterGroup } from './types';
2
- interface AllFiltersChipProps {
2
+ type AllFiltersChipProps = {
3
3
  containerRef?: React.RefObject<HTMLElement>;
4
4
  filterGroups: Array<FilterGroup>;
5
- }
6
- declare const AllFiltersChip: ({ containerRef, filterGroups }: AllFiltersChipProps) => import("react/jsx-runtime").JSX.Element;
5
+ onAllFiltersClick?: () => void;
6
+ };
7
+ declare const AllFiltersChip: ({ containerRef, filterGroups, onAllFiltersClick }: AllFiltersChipProps) => import("react/jsx-runtime").JSX.Element;
7
8
  export default AllFiltersChip;
@@ -6,6 +6,7 @@ export interface FilterRowProps {
6
6
  filterGroups?: Array<FilterGroup>;
7
7
  initialFilterValues?: InitialFilterValues;
8
8
  isAllFiltersDisabled?: boolean;
9
+ onAllFiltersClick?: () => void;
9
10
  onFilterSubmit?: (fields: FilterValues) => void;
10
11
  }
11
- export declare const FilterRow: ({ predefinedFilterOptions, containerRef, filterGroups: customFilterGroups, initialFilterValues: customFilterValues, isAllFiltersDisabled, onFilterSubmit, }: FilterRowProps) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const FilterRow: ({ predefinedFilterOptions, containerRef, filterGroups: customFilterGroups, initialFilterValues: customFilterValues, isAllFiltersDisabled, onAllFiltersClick, onFilterSubmit, }: FilterRowProps) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@box/metadata-view",
3
- "version": "1.50.16",
3
+ "version": "1.51.1",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
- "@box/blueprint-web": "^13.5.8",
7
- "@box/blueprint-web-assets": "^4.104.3",
8
- "@box/box-item-type-selector": "^1.38.13",
9
- "@box/item-icon": "^2.30.14",
10
- "@box/metadata-filter": "^1.78.5",
11
- "@box/types": "2.1.4",
6
+ "@box/blueprint-web": "^13.5.10",
7
+ "@box/blueprint-web-assets": "^4.104.5",
8
+ "@box/box-item-type-selector": "^1.38.15",
9
+ "@box/item-icon": "^2.30.16",
10
+ "@box/metadata-filter": "^1.78.7",
11
+ "@box/types": "2.1.6",
12
12
  "@tanstack/react-virtual": "^3.10.8",
13
13
  "formik": "^2.4.5",
14
14
  "lodash": "^4.17.15",
@@ -18,14 +18,14 @@
18
18
  "react-intl": "^6.4.2"
19
19
  },
20
20
  "devDependencies": {
21
- "@box/blueprint-web": "^13.5.8",
22
- "@box/blueprint-web-assets": "^4.104.3",
23
- "@box/box-item-type-selector": "^1.38.13",
24
- "@box/eslint-plugin-blueprint": "1.1.3",
25
- "@box/item-icon": "^2.30.14",
26
- "@box/metadata-filter": "^1.78.5",
27
- "@box/storybook-utils": "0.16.64",
28
- "@box/types": "2.1.4",
21
+ "@box/blueprint-web": "^13.5.10",
22
+ "@box/blueprint-web-assets": "^4.104.5",
23
+ "@box/box-item-type-selector": "^1.38.15",
24
+ "@box/eslint-plugin-blueprint": "1.1.5",
25
+ "@box/item-icon": "^2.30.16",
26
+ "@box/metadata-filter": "^1.78.7",
27
+ "@box/storybook-utils": "0.16.66",
28
+ "@box/types": "2.1.6",
29
29
  "@tanstack/react-virtual": "^3.10.8",
30
30
  "react-intl": "^6.4.2"
31
31
  },