@box/metadata-view 0.48.3 → 0.48.5

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,39 +1,41 @@
1
1
  import { FilterChip as e } from "@box/blueprint-web";
2
- import { Filter as c } from "@box/blueprint-web-assets/icons/Line";
3
- import { useFormikContext as f } from "formik";
4
- import { useState as d, useMemo as u } from "react";
5
- import { useIntl as h } from "react-intl";
6
- import { getInitialFieldValues as F } from "./initial-field-values.js";
7
- import { isFilterSelected as g } from "./is-filter-selected.js";
8
- import S from "./messages.js";
9
- import { jsxs as a, Fragment as C, jsx as t } from "react/jsx-runtime";
10
- import { FilterSidePanel as I } from "../filter-sidepanel/filter-side-panel.js";
11
- const L = ({
2
+ import { Filter as f } from "@box/blueprint-web-assets/icons/Line";
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 S } from "./is-filter-selected.js";
8
+ import C from "./messages.js";
9
+ import { jsxs as a, Fragment as I, jsx as t } from "react/jsx-runtime";
10
+ import { FilterSidePanel as O } from "../filter-sidepanel/filter-side-panel.js";
11
+ const P = ({
12
+ containerRef: m,
12
13
  filterGroups: l
13
14
  }) => {
14
15
  const {
15
- formatMessage: m
16
- } = h(), {
16
+ formatMessage: p
17
+ } = F(), {
17
18
  values: r
18
- } = f(), [o, n] = d(!1), p = () => n(!0), s = u(() => Object.values(r.metadata.fields).filter((i) => g(i.value)).length, [r.metadata.fields]);
19
- return /* @__PURE__ */ a(C, {
19
+ } = d(), [o, n] = u(!1), c = () => n(!0), s = h(() => Object.values(r.metadata.fields).filter((i) => S(i.value)).length, [r.metadata.fields]);
20
+ return /* @__PURE__ */ a(I, {
20
21
  children: [
21
22
  // We need to initialize the sidepanel state at the moment it is opened
22
- o && /* @__PURE__ */ t(I, {
23
+ o && /* @__PURE__ */ t(O, {
24
+ containerRef: m,
23
25
  filterGroups: l,
24
- getInitialFormValues: () => F(l.flatMap(({
26
+ getInitialFormValues: () => g(l.flatMap(({
25
27
  filters: i
26
28
  }) => i)),
27
29
  isOpen: o,
28
30
  onIsOpenChange: n
29
31
  }),
30
32
  /* @__PURE__ */ a(e.ChipButton, {
31
- onClick: p,
33
+ onClick: c,
32
34
  value: "all-filters-chip-btn",
33
35
  children: [/* @__PURE__ */ t(e.Icon, {
34
- icon: c
36
+ icon: f
35
37
  }), /* @__PURE__ */ t(e.Label, {
36
- children: m(S.allFilters)
38
+ children: p(C.allFilters)
37
39
  }), s > 0 ? /* @__PURE__ */ t(e.Status, {
38
40
  children: s.toString()
39
41
  }) : null]
@@ -42,5 +44,5 @@ const L = ({
42
44
  });
43
45
  };
44
46
  export {
45
- L as default
47
+ P as default
46
48
  };
@@ -1,42 +1,44 @@
1
- import { FilterChip as d } from "@box/blueprint-web";
2
- import { Formik as c, Form as h } from "formik";
3
- import { useRef as F } from "react";
4
- import C from "./all-filters-chip.js";
5
- import { getInitialFieldValues as R } from "./initial-field-values.js";
6
- import { MetadataFilterChip as G } from "./metadata-filter-chip.js";
7
- import { usePredefinedFilter as x } from "./predefinedFilters/use-predefined-filter.js";
8
- import { s as V } from "../../../../chunks/form-filter-chip.js";
9
- import { jsx as e, jsxs as b } from "react/jsx-runtime";
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";
6
+ import { MetadataFilterChip as x } from "./metadata-filter-chip.js";
7
+ import { usePredefinedFilter as V } from "./predefinedFilters/use-predefined-filter.js";
8
+ import { s as b } from "../../../../chunks/form-filter-chip.js";
9
+ import { jsx as e, jsxs as j } from "react/jsx-runtime";
10
10
  import "./select-filter-chip.js";
11
- const N = ({
11
+ const P = ({
12
12
  predefinedFilterOptions: m,
13
- filterGroups: s = [],
14
- initialFilterValues: a,
15
- isAllFiltersDisabled: p,
13
+ containerRef: s,
14
+ filterGroups: a = [],
15
+ initialFilterValues: p,
16
+ isAllFiltersDisabled: n,
16
17
  onFilterSubmit: r
17
18
  }) => {
18
- const n = x(m), f = ({
19
+ const f = V(m), u = ({
19
20
  metadata: {
20
21
  fields: i
21
22
  }
22
23
  }) => {
23
24
  r && r(i);
24
- }, t = [...n, ...s], l = t.flatMap(({
25
+ }, t = [...f, ...a], l = t.flatMap(({
25
26
  filters: i
26
- }) => i), u = R(l, a), o = F(null);
27
- return /* @__PURE__ */ e(c, {
27
+ }) => i), d = G(l, p), o = C(null);
28
+ return /* @__PURE__ */ e(h, {
28
29
  enableReinitialize: !0,
29
- initialValues: u,
30
- onSubmit: f,
31
- children: /* @__PURE__ */ e(h, {
30
+ initialValues: d,
31
+ onSubmit: u,
32
+ children: /* @__PURE__ */ e(F, {
32
33
  ref: o,
33
- children: /* @__PURE__ */ b(d.Group, {
34
- className: V.filterChipGroup,
34
+ children: /* @__PURE__ */ j(c.Group, {
35
+ className: b.filterChipGroup,
35
36
  name: "metadata-view-filters",
36
37
  type: "multiple",
37
- children: [p ? null : /* @__PURE__ */ e(C, {
38
+ children: [n ? null : /* @__PURE__ */ e(R, {
39
+ containerRef: s,
38
40
  filterGroups: t
39
- }), l.filter((i) => i.shouldRenderChip).map((i) => /* @__PURE__ */ e(G, {
41
+ }), l.filter((i) => i.shouldRenderChip).map((i) => /* @__PURE__ */ e(x, {
40
42
  filterOption: i,
41
43
  formRef: o
42
44
  }, i.id))]
@@ -45,5 +47,5 @@ const N = ({
45
47
  });
46
48
  };
47
49
  export {
48
- N as FilterRow
50
+ P as FilterRow
49
51
  };
@@ -1,74 +1,76 @@
1
- import { Filter as x } from "./filter.js";
1
+ import { Filter as B } from "./filter.js";
2
2
  import { SidePanel as t, Accordion as c } from "@box/blueprint-web";
3
- import { useIntl as B } from "react-intl";
4
- import { useFormikContext as R } from "formik";
5
- import k from "lodash/noop";
6
- import { useState as d } from "react";
7
- import n from "./messages.js";
8
- import { jsx as e, jsxs as u } from "react/jsx-runtime";
9
- const w = ({
10
- filterGroups: a,
11
- isOpen: h,
12
- onIsOpenChange: i = k,
13
- getInitialFormValues: p
3
+ import { useIntl as k } from "react-intl";
4
+ import { useFormikContext as A } from "formik";
5
+ import P from "lodash/noop";
6
+ import { useState as u } from "react";
7
+ import o from "./messages.js";
8
+ import { jsx as e, jsxs as h } from "react/jsx-runtime";
9
+ const M = ({
10
+ containerRef: n,
11
+ filterGroups: i,
12
+ isOpen: p,
13
+ onIsOpenChange: s = P,
14
+ getInitialFormValues: C
14
15
  }) => {
15
16
  const {
16
- formatMessage: l
17
- } = B(), {
18
- handleSubmit: f,
19
- resetForm: s,
20
- values: C
21
- } = R(), [F] = d(C), [S, v] = d(null), b = () => {
22
- s({
23
- values: p()
17
+ formatMessage: r
18
+ } = k(), {
19
+ handleSubmit: F,
20
+ resetForm: m,
21
+ values: f
22
+ } = A(), [S] = u(f), [v, b] = u(null), y = () => {
23
+ m({
24
+ values: C()
24
25
  });
25
- }, y = (r) => {
26
- s({
27
- values: F
28
- }), i(r);
29
- }, g = () => {
30
- f(), i(!1);
26
+ }, g = (l) => {
27
+ m({
28
+ values: S
29
+ }), s(l);
30
+ }, x = () => {
31
+ F(), s(!1);
31
32
  };
32
33
  return /* @__PURE__ */ e(t, {
33
- onOpenChange: y,
34
- open: h,
34
+ onOpenChange: g,
35
+ open: p,
35
36
  variant: "overlay",
36
37
  children: /* @__PURE__ */ e(t.Overlay, {
37
- children: /* @__PURE__ */ u(t.Content, {
38
+ container: n == null ? void 0 : n.current,
39
+ children: /* @__PURE__ */ h(t.Content, {
38
40
  children: [/* @__PURE__ */ e(t.Header, {
39
- children: l(n.filtersHeader)
41
+ children: r(o.filtersHeader)
40
42
  }), /* @__PURE__ */ e(t.ScrollableContainer, {
41
- ref: v,
43
+ ref: b,
42
44
  children: /* @__PURE__ */ e(c, {
43
- defaultValue: a.map((r, o) => `item-${o}`),
45
+ defaultValue: i.map((l, a) => `item-${a}`),
44
46
  type: "multiple",
45
- children: a.map((r, o) => /* @__PURE__ */ e(c.Item, {
46
- ...r.toggleable ? {} : {
47
+ children: i.map((l, a) => /* @__PURE__ */ e(c.Item, {
48
+ ...l.toggleable ? {} : {
47
49
  fixed: "true"
48
50
  },
49
- title: r.title,
50
- value: `item-${o}`,
51
- children: r.filters.map((m) => /* @__PURE__ */ e(x, {
52
- ...m,
53
- parentRef: S
54
- }, m.id))
55
- }, `accordion-item-${r.title || "unnamed"}`))
51
+ title: l.title,
52
+ value: `item-${a}`,
53
+ children: l.filters.map((d) => /* @__PURE__ */ e(B, {
54
+ ...d,
55
+ parentRef: v
56
+ }, d.id))
57
+ }, `accordion-item-${l.title || "unnamed"}`))
56
58
  })
57
- }), /* @__PURE__ */ u(t.Footer, {
59
+ }), /* @__PURE__ */ h(t.Footer, {
58
60
  children: [/* @__PURE__ */ e(t.Footer.SecondaryButton, {
59
- onClick: b,
60
- children: l(n.clearAllButton)
61
+ onClick: y,
62
+ children: r(o.clearAllButton)
61
63
  }), /* @__PURE__ */ e(t.Footer.PrimaryButton, {
62
- onClick: g,
63
- children: l(n.showResultsButton)
64
+ onClick: x,
65
+ children: r(o.showResultsButton)
64
66
  })]
65
67
  }), /* @__PURE__ */ e(t.Close, {
66
- "aria-label": l(n.closeAriaLabel)
68
+ "aria-label": r(o.closeAriaLabel)
67
69
  })]
68
70
  })
69
71
  })
70
72
  });
71
73
  };
72
74
  export {
73
- w as FilterSidePanel
75
+ M as FilterSidePanel
74
76
  };
@@ -1,5 +1,5 @@
1
- import { I as T, V as o } from "../../chunks/types.js";
2
- import { ActionBar as _ } from "./components/action-bar/action-bar.js";
1
+ import { I as _, V as o } from "../../chunks/types.js";
2
+ import { ActionBar as x } from "./components/action-bar/action-bar.js";
3
3
  import "./components/filter-row/filter-row.js";
4
4
  import "../../chunks/form-filter-chip.js";
5
5
  import "./components/filter-row/metadata-filter-chip.js";
@@ -7,8 +7,8 @@ import "./components/filter-row/select-filter-chip.js";
7
7
  import "./components/filter-sidepanel/filter.js";
8
8
  import "./components/filter-sidepanel/filter-side-panel.js";
9
9
  import "./components/item-action-menu/item-action-menu.js";
10
- import { MetadataGrid as x } from "./components/metadata-grid/metadata-grid.js";
11
- import { MetadataTable as E } from "./components/metadata-table/metadata-table.js";
10
+ import { MetadataGrid as E } from "./components/metadata-grid/metadata-grid.js";
11
+ import { MetadataTable as N } from "./components/metadata-table/metadata-table.js";
12
12
  import "./components/metadata-table/table-body/inline-editing-cell/inline-editing-cell.js";
13
13
  import "./components/metadata-table/table-renderer.js";
14
14
  import "./components/metadata-value/metadata-file-chip.js";
@@ -16,75 +16,77 @@ import "./components/metadata-value/metadata-file-field.js";
16
16
  import "./components/metadata-value/metadata-location-field.js";
17
17
  import "./components/metadata-value/metadata-radio-field.js";
18
18
  import "./components/metadata-value/metadata-search-field.js";
19
- import { Pagination as N } from "./components/pagination/pagination.js";
19
+ import { Pagination as R } from "./components/pagination/pagination.js";
20
20
  import "./components/pagination/marker-based-pagination.js";
21
21
  import "./components/pagination/offset-based-pagination.js";
22
22
  import "./components/pagination/pagination-controls.js";
23
23
  import "./components/sort-dropdown/sort-dropdown.js";
24
24
  import { SwitchCase as b, Case as a } from "./components/switch-case/switch-case.js";
25
25
  import { TooltipProvider as g } from "@box/blueprint-web";
26
- import { useState as f } from "react";
27
- import { jsx as t, jsxs as h, Fragment as k } from "react/jsx-runtime";
28
- import { ErrorState as D } from "./components/error-state/error-state.js";
29
- import G from "./components/empty-state/empty-state.js";
30
- import '../../styles/metadata-view.css';const j = "_container_nykl3_5", R = "_contentContainer_nykl3_14", M = {
31
- container: j,
32
- contentContainer: R
26
+ import { useState as h, useRef as k } from "react";
27
+ import { jsx as t, jsxs as u, Fragment as D } from "react/jsx-runtime";
28
+ import { ErrorState as G } from "./components/error-state/error-state.js";
29
+ import j from "./components/empty-state/empty-state.js";
30
+ import '../../styles/metadata-view.css';const Z = "_container_nykl3_5", z = "_contentContainer_nykl3_14", M = {
31
+ container: Z,
32
+ contentContainer: z
33
33
  };
34
- function st({
35
- actionBarProps: n,
34
+ function Ct({
35
+ actionBarProps: i,
36
36
  columns: c,
37
37
  tableProps: p,
38
- hasError: u,
39
- onRefresh: I,
40
- initialViewMode: S = o.LIST,
38
+ hasError: I,
39
+ onRefresh: S,
40
+ initialViewMode: V = o.LIST,
41
41
  paginationProps: l,
42
- isLoading: d,
42
+ isLoading: s,
43
43
  ...r
44
44
  }) {
45
- const [e, s] = f(S), [m, V] = f(0), w = () => {
46
- e === o.LIST ? s(o.GRID) : s(o.LIST);
47
- }, v = !d && r.items.length === 0, y = n && n.sortDropdownProps && c.filter((i) => i.type !== "multiSelect" && i.type !== "enum").map((i) => i.textValue), {
45
+ const [e, d] = h(V), [m, w] = h(0), f = k(null), v = () => {
46
+ e === o.LIST ? d(o.GRID) : d(o.LIST);
47
+ }, y = !s && r.items.length === 0, L = i && i.sortDropdownProps && c.filter((n) => n.type !== "multiSelect" && n.type !== "enum").map((n) => n.textValue), {
48
48
  iconColumnVariant: C
49
- } = p || {}, L = C && C === T.COLUMN;
49
+ } = p || {}, T = C && C === _.COLUMN;
50
50
  return /* @__PURE__ */ t(g, {
51
51
  children: /* @__PURE__ */ t("div", {
52
+ ref: f,
52
53
  className: M.container,
53
- children: u ? /* @__PURE__ */ t(D, {
54
- onRefresh: I
55
- }) : /* @__PURE__ */ h(k, {
56
- children: [/* @__PURE__ */ t(_, {
57
- ...n,
58
- isIconColumnEnabled: L,
59
- onViewModeClick: w,
60
- onZoomLevelChange: V,
61
- sortableColumnNames: y,
54
+ children: I ? /* @__PURE__ */ t(G, {
55
+ onRefresh: S
56
+ }) : /* @__PURE__ */ u(D, {
57
+ children: [/* @__PURE__ */ t(x, {
58
+ ...i,
59
+ containerRef: f,
60
+ isIconColumnEnabled: T,
61
+ onViewModeClick: v,
62
+ onZoomLevelChange: w,
63
+ sortableColumnNames: L,
62
64
  viewMode: e,
63
65
  zoomLevel: m
64
66
  }), /* @__PURE__ */ t("div", {
65
67
  className: M.contentContainer,
66
- children: /* @__PURE__ */ h(b, {
68
+ children: /* @__PURE__ */ u(b, {
67
69
  children: [/* @__PURE__ */ t(a, {
68
- condition: v,
69
- children: /* @__PURE__ */ t(G, {})
70
+ condition: y,
71
+ children: /* @__PURE__ */ t(j, {})
70
72
  }), /* @__PURE__ */ t(a, {
71
73
  condition: e === o.LIST,
72
- children: /* @__PURE__ */ t(E, {
74
+ children: /* @__PURE__ */ t(N, {
73
75
  columns: c,
74
- isLoading: d,
76
+ isLoading: s,
75
77
  zoomLevel: m,
76
78
  ...r,
77
79
  ...p
78
80
  })
79
81
  }), /* @__PURE__ */ t(a, {
80
82
  condition: e === o.GRID,
81
- children: /* @__PURE__ */ t(x, {
83
+ children: /* @__PURE__ */ t(E, {
82
84
  zoomLevel: m,
83
85
  ...r
84
86
  })
85
87
  })]
86
88
  })
87
- }), l && /* @__PURE__ */ t(N, {
89
+ }), l && /* @__PURE__ */ t(R, {
88
90
  ...l
89
91
  })]
90
92
  })
@@ -92,6 +94,6 @@ function st({
92
94
  });
93
95
  }
94
96
  export {
95
- st as MetadataView,
96
- st as default
97
+ Ct as MetadataView,
98
+ Ct as default
97
99
  };
@@ -1,6 +1,7 @@
1
1
  import { FilterGroup } from './types';
2
2
  interface AllFiltersChipProps {
3
+ containerRef?: React.RefObject<HTMLElement>;
3
4
  filterGroups: Array<FilterGroup>;
4
5
  }
5
- declare const AllFiltersChip: ({ filterGroups }: AllFiltersChipProps) => import("react/jsx-runtime").JSX.Element;
6
+ declare const AllFiltersChip: ({ containerRef, filterGroups }: AllFiltersChipProps) => import("react/jsx-runtime").JSX.Element;
6
7
  export default AllFiltersChip;
@@ -2,9 +2,10 @@ import { PredefinedFilterOptions } from './predefinedFilters/types';
2
2
  import { FilterGroup, FilterValues, InitialFilterValues } from './types';
3
3
  export interface FilterRowProps {
4
4
  predefinedFilterOptions?: Partial<PredefinedFilterOptions>;
5
+ containerRef?: React.RefObject<HTMLElement>;
5
6
  filterGroups?: Array<FilterGroup>;
6
7
  initialFilterValues?: InitialFilterValues;
7
8
  isAllFiltersDisabled?: boolean;
8
9
  onFilterSubmit?: (fields: FilterValues) => void;
9
10
  }
10
- export declare const FilterRow: ({ predefinedFilterOptions, filterGroups: customFilterGroups, initialFilterValues: customFilterValues, isAllFiltersDisabled, onFilterSubmit, }: FilterRowProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const FilterRow: ({ predefinedFilterOptions, containerRef, filterGroups: customFilterGroups, initialFilterValues: customFilterValues, isAllFiltersDisabled, onFilterSubmit, }: FilterRowProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,9 @@
1
1
  import { FilterGroup } from '../filter-row/types';
2
2
  export interface FilterSidePanelProps {
3
+ containerRef?: React.RefObject<HTMLElement>;
3
4
  filterGroups: Array<FilterGroup>;
4
5
  isOpen?: boolean;
5
6
  onIsOpenChange?: (isOpen: boolean) => void;
6
7
  getInitialFormValues: () => void;
7
8
  }
8
- export declare const FilterSidePanel: ({ filterGroups, isOpen, onIsOpenChange, getInitialFormValues, }: FilterSidePanelProps) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const FilterSidePanel: ({ containerRef, filterGroups, isOpen, onIsOpenChange, getInitialFormValues, }: FilterSidePanelProps) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-view",
3
- "version": "0.48.3",
3
+ "version": "0.48.5",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
6
  "@box/blueprint-web": "^11.12.0",
@@ -23,7 +23,7 @@
23
23
  "@box/box-item-type-selector": "^0.69.3",
24
24
  "@box/eslint-plugin-blueprint": "*",
25
25
  "@box/item-icon": "^0.23.3",
26
- "@box/metadata-filter": "^1.25.3",
26
+ "@box/metadata-filter": "^1.26.0",
27
27
  "@box/storybook-utils": "0.14.1",
28
28
  "@box/types": "0.2.1",
29
29
  "@tanstack/react-virtual": "^3.10.8",