@box/metadata-view 0.48.19 → 0.48.20

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.
@@ -0,0 +1,9 @@
1
+ import '../styles/filter-row.css';const o = "_popoverFooter_1q01l_1", p = "_popoverContent_1q01l_9", t = "_filterChipGroup_1q01l_13", e = "_filterChipIcon_1q01l_18", r = {
2
+ popoverFooter: o,
3
+ popoverContent: p,
4
+ filterChipGroup: t,
5
+ filterChipIcon: e
6
+ };
7
+ export {
8
+ r as s
9
+ };
package/dist/esm/index.js CHANGED
@@ -2,9 +2,9 @@ import { MetadataView as o } from "./lib/metadata-view.js";
2
2
  import { I as a, V as i } from "../chunks/types.js";
3
3
  import { ActionBar as m } from "./lib/components/action-bar/action-bar.js";
4
4
  import { FilterRow as x } from "./lib/components/filter-row/filter-row.js";
5
- import { F as n } from "../chunks/form-filter-chip.js";
5
+ import { FormFilterChip as n } from "./lib/components/filter-row/form-filter-chip.js";
6
6
  import { MetadataFilterChip as F } from "./lib/components/filter-row/metadata-filter-chip.js";
7
- import { SelectFilterChip as s } from "./lib/components/filter-row/select-filter-chip.js";
7
+ import { SelectFilterChip as C } from "./lib/components/filter-row/select-filter-chip.js";
8
8
  import { PredefinedFilterName as c } from "./lib/components/filter-row/predefinedFilters/index.js";
9
9
  import { Filter as P } from "./lib/components/filter-sidepanel/filter.js";
10
10
  import { FilterSidePanel as w } from "./lib/components/filter-sidepanel/filter-side-panel.js";
@@ -48,7 +48,7 @@ export {
48
48
  H as Pagination,
49
49
  X as PaginationControls,
50
50
  c as PredefinedFilterName,
51
- s as SelectFilterChip,
51
+ C as SelectFilterChip,
52
52
  Z as SortDropdown,
53
53
  ee as SwitchCase,
54
54
  k as TableRenderer,
@@ -4,10 +4,11 @@ import { useFormikContext as d } from "formik";
4
4
  import { useState as u, useMemo as h } from "react";
5
5
  import { useIntl as F } from "react-intl";
6
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";
7
+ import { isFilterSelected as C } from "./is-filter-selected.js";
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";
11
12
  const P = ({
12
13
  containerRef: m,
13
14
  filterGroups: l
@@ -16,28 +17,29 @@ const P = ({
16
17
  formatMessage: p
17
18
  } = F(), {
18
19
  values: r
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
+ } = 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, {
21
22
  children: [
22
23
  // We need to initialize the sidepanel state at the moment it is opened
23
- o && /* @__PURE__ */ t(O, {
24
+ o && /* @__PURE__ */ t(v, {
24
25
  containerRef: m,
25
26
  filterGroups: l,
26
27
  getInitialFormValues: () => g(l.flatMap(({
27
28
  filters: i
28
29
  }) => i)),
29
30
  isOpen: o,
30
- onIsOpenChange: n
31
+ onIsOpenChange: s
31
32
  }),
32
33
  /* @__PURE__ */ a(e.ChipButton, {
33
34
  onClick: c,
34
35
  value: "all-filters-chip-btn",
35
36
  children: [/* @__PURE__ */ t(e.Icon, {
37
+ className: I.filterChipIcon,
36
38
  icon: f
37
39
  }), /* @__PURE__ */ t(e.Label, {
38
- children: p(C.allFilters)
39
- }), s > 0 ? /* @__PURE__ */ t(e.Status, {
40
- children: s.toString()
40
+ children: p(S.allFilters)
41
+ }), n > 0 ? /* @__PURE__ */ t(e.Status, {
42
+ children: n.toString()
41
43
  }) : null]
42
44
  })
43
45
  ]
@@ -5,41 +5,42 @@ import R from "./all-filters-chip.js";
5
5
  import { getInitialFieldValues as G } from "./initial-field-values.js";
6
6
  import { MetadataFilterChip as x } from "./metadata-filter-chip.js";
7
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";
8
+ import { s as b } from "../../../../chunks/filter-row.module.js";
9
+ import { jsx as r, jsxs as j } from "react/jsx-runtime";
10
+ import "./form-filter-chip.js";
10
11
  import "./select-filter-chip.js";
11
12
  import "./predefinedFilters/index.js";
12
- const S = ({
13
+ const q = ({
13
14
  predefinedFilterOptions: m,
14
15
  containerRef: s,
15
16
  filterGroups: p = [],
16
17
  initialFilterValues: a,
17
18
  isAllFiltersDisabled: n,
18
- onFilterSubmit: r
19
+ onFilterSubmit: e
19
20
  }) => {
20
21
  const f = V(m), u = ({
21
22
  metadata: {
22
23
  fields: i
23
24
  }
24
25
  }) => {
25
- r && r(i);
26
+ e && e(i);
26
27
  }, t = [...f, ...p], o = t.flatMap(({
27
28
  filters: i
28
29
  }) => i), d = G(o, a), l = C(null);
29
- return /* @__PURE__ */ e(h, {
30
+ return /* @__PURE__ */ r(h, {
30
31
  enableReinitialize: !0,
31
32
  initialValues: d,
32
33
  onSubmit: u,
33
- children: /* @__PURE__ */ e(F, {
34
+ children: /* @__PURE__ */ r(F, {
34
35
  ref: l,
35
36
  children: /* @__PURE__ */ j(c.Group, {
36
37
  className: b.filterChipGroup,
37
38
  name: "metadata-view-filters",
38
39
  type: "multiple",
39
- children: [n ? null : /* @__PURE__ */ e(R, {
40
+ children: [n ? null : /* @__PURE__ */ r(R, {
40
41
  containerRef: s,
41
42
  filterGroups: t
42
- }), o.filter((i) => i.shouldRenderChip).map((i) => /* @__PURE__ */ e(x, {
43
+ }), o.filter((i) => i.shouldRenderChip).map((i) => /* @__PURE__ */ r(x, {
43
44
  filterOption: i,
44
45
  formRef: l
45
46
  }, i.id))]
@@ -48,5 +49,5 @@ const S = ({
48
49
  });
49
50
  };
50
51
  export {
51
- S as FilterRow
52
+ q as FilterRow
52
53
  };
@@ -1,12 +1,85 @@
1
- import "@box/blueprint-web";
2
- import "formik";
3
- import "react";
4
- import "react-intl";
5
- import { F as h } from "../../../../chunks/form-filter-chip.js";
6
- import "./initial-field-values.js";
7
- import "./is-filter-selected.js";
8
- import "./messages.js";
9
- import "react/jsx-runtime";
1
+ import { Popover as a, FilterChip as s, Button as f } from "@box/blueprint-web";
2
+ import { useFormikContext as V, getIn as l } from "formik";
3
+ import { useState as v, useMemo as M } from "react";
4
+ import { useIntl as j } from "react-intl";
5
+ import { s as h } from "../../../../chunks/filter-row.module.js";
6
+ import { getDefaultFieldValue as z } from "./initial-field-values.js";
7
+ import { isFilterSelected as N } from "./is-filter-selected.js";
8
+ import y from "./messages.js";
9
+ import { jsx as o, jsxs as n } from "react/jsx-runtime";
10
+ const Q = ({
11
+ children: C,
12
+ formRef: F,
13
+ icon: i,
14
+ id: t,
15
+ name: g
16
+ }) => {
17
+ const {
18
+ formatMessage: c
19
+ } = j(), [T, m] = v(!1), {
20
+ handleSubmit: D,
21
+ setFieldValue: S,
22
+ resetForm: b,
23
+ values: r
24
+ } = V(), p = l(r, `metadata.fields.${t}.fieldType`), B = () => {
25
+ D(), m(!1);
26
+ }, [I, R] = v(r), $ = (e) => {
27
+ m(e), e ? R(r) : b({
28
+ values: I
29
+ });
30
+ }, k = () => {
31
+ S(`metadata.fields.${t}.value`, z(p));
32
+ }, d = M(() => {
33
+ const e = l(r, `metadata.fields.${t}.value`);
34
+ return e ? N(e) : !1;
35
+ }, [r, t]), x = () => {
36
+ if (p === "date") {
37
+ const e = l(r, `metadata.fields.${t}.value.customType`), O = e && e !== "anyTime" && e !== "customRange", u = l(r, `metadata.fields.${t}.value.relativeType`);
38
+ return (O || u && u !== "customRange") && !d;
39
+ }
40
+ return !1;
41
+ };
42
+ return /* @__PURE__ */ o("div", {
43
+ children: /* @__PURE__ */ n(a.Root, {
44
+ onOpenChange: $,
45
+ open: T,
46
+ children: [/* @__PURE__ */ o(a.Trigger, {
47
+ children: /* @__PURE__ */ n(s.TriggerChip, {
48
+ selected: d,
49
+ value: t,
50
+ children: [i && /* @__PURE__ */ o(s.Icon, {
51
+ icon: i
52
+ }), /* @__PURE__ */ o(s.Label, {
53
+ children: g
54
+ }), /* @__PURE__ */ o(s.DropdownIndicator, {})]
55
+ }, t)
56
+ }), /* @__PURE__ */ n(a.ContentContainer, {
57
+ align: "start",
58
+ className: h.popoverContent,
59
+ container: F.current,
60
+ "data-testid": "form-filter-chip-popover",
61
+ children: [/* @__PURE__ */ o(a.MainContent, {
62
+ children: C
63
+ }), /* @__PURE__ */ n(a.Footer, {
64
+ className: h.popoverFooter,
65
+ children: [/* @__PURE__ */ o(f, {
66
+ onClick: k,
67
+ size: "small",
68
+ variant: "secondary",
69
+ children: c(y.clearButton)
70
+ }), /* @__PURE__ */ o(f, {
71
+ disabled: x(),
72
+ onClick: B,
73
+ size: "small",
74
+ type: "submit",
75
+ variant: "primary",
76
+ children: c(y.applyButton)
77
+ })]
78
+ })]
79
+ })]
80
+ })
81
+ });
82
+ };
10
83
  export {
11
- h as FormFilterChip
84
+ Q as FormFilterChip
12
85
  };
@@ -1,12 +1,12 @@
1
1
  import { FilterRow as t } from "./filter-row.js";
2
- import { F as i } from "../../../../chunks/form-filter-chip.js";
2
+ import { FormFilterChip as i } from "./form-filter-chip.js";
3
3
  import { MetadataFilterChip as m } from "./metadata-filter-chip.js";
4
- import { SelectFilterChip as f } from "./select-filter-chip.js";
5
- import { PredefinedFilterName as a } from "./predefinedFilters/index.js";
4
+ import { SelectFilterChip as l } from "./select-filter-chip.js";
5
+ import { PredefinedFilterName as x } from "./predefinedFilters/index.js";
6
6
  export {
7
7
  t as FilterRow,
8
8
  i as FormFilterChip,
9
9
  m as MetadataFilterChip,
10
- a as PredefinedFilterName,
11
- f as SelectFilterChip
10
+ x as PredefinedFilterName,
11
+ l as SelectFilterChip
12
12
  };
@@ -1,7 +1,7 @@
1
1
  import { MetadataStringField as F, MetadataFloatField as f, MetadataDateField as h } from "@box/metadata-filter";
2
2
  import { useIntl as M } from "react-intl";
3
3
  import { MetadataFileChip as C } from "../metadata-value/metadata-file-chip.js";
4
- import { F as n } from "../../../../chunks/form-filter-chip.js";
4
+ import { FormFilterChip as n } from "./form-filter-chip.js";
5
5
  import { SelectFilterChip as b } from "./select-filter-chip.js";
6
6
  import { jsx as t } from "react/jsx-runtime";
7
7
  const j = ({
@@ -9,8 +9,8 @@ const j = ({
9
9
  formRef: i
10
10
  }) => {
11
11
  const {
12
- canUseRelativeDates: s,
13
- customDateFilterOptions: d,
12
+ canUseRelativeDates: d,
13
+ customDateFilterOptions: s,
14
14
  fieldType: o,
15
15
  icon: r,
16
16
  id: e,
@@ -28,8 +28,8 @@ const j = ({
28
28
  id: e,
29
29
  name: a,
30
30
  children: /* @__PURE__ */ t(h, {
31
- canUseRelativeDates: s,
32
- customDateFilterOptions: d,
31
+ canUseRelativeDates: d,
32
+ customDateFilterOptions: s,
33
33
  direction: "vertical",
34
34
  fieldNamePrefix: l,
35
35
  label: a,
@@ -1,12 +1,12 @@
1
1
  import { ActionBar as o } from "./action-bar/action-bar.js";
2
2
  import { FilterRow as a } from "./filter-row/filter-row.js";
3
- import { F as p } from "../../../chunks/form-filter-chip.js";
3
+ import { FormFilterChip as p } from "./filter-row/form-filter-chip.js";
4
4
  import { MetadataFilterChip as m } from "./filter-row/metadata-filter-chip.js";
5
5
  import { SelectFilterChip as d } from "./filter-row/select-filter-chip.js";
6
6
  import { PredefinedFilterName as n } from "./filter-row/predefinedFilters/index.js";
7
7
  import { Filter as M } from "./filter-sidepanel/filter.js";
8
- import { FilterSidePanel as s } from "./filter-sidepanel/filter-side-panel.js";
9
- import { ItemActionMenu as h } from "./item-action-menu/item-action-menu.js";
8
+ import { FilterSidePanel as c } from "./filter-sidepanel/filter-side-panel.js";
9
+ import { ItemActionMenu as s } from "./item-action-menu/item-action-menu.js";
10
10
  import { MetadataGrid as g } from "./metadata-grid/metadata-grid.js";
11
11
  import { MetadataTable as w } from "./metadata-table/metadata-table.js";
12
12
  import { InlineEditingCell as R } from "./metadata-table/table-body/inline-editing-cell/inline-editing-cell.js";
@@ -27,10 +27,10 @@ export {
27
27
  W as Case,
28
28
  M as Filter,
29
29
  a as FilterRow,
30
- s as FilterSidePanel,
30
+ c as FilterSidePanel,
31
31
  p as FormFilterChip,
32
32
  R as InlineEditingCell,
33
- h as ItemActionMenu,
33
+ s as ItemActionMenu,
34
34
  y as MarkerBasedPagination,
35
35
  T as MetadataFileChip,
36
36
  u as MetadataFileField,
@@ -2,9 +2,9 @@ import { MetadataView as o } from "./metadata-view.js";
2
2
  import { I as a, V as i } from "../../chunks/types.js";
3
3
  import { ActionBar as m } from "./components/action-bar/action-bar.js";
4
4
  import { FilterRow as x } from "./components/filter-row/filter-row.js";
5
- import { F as n } from "../../chunks/form-filter-chip.js";
5
+ import { FormFilterChip as n } from "./components/filter-row/form-filter-chip.js";
6
6
  import { MetadataFilterChip as F } from "./components/filter-row/metadata-filter-chip.js";
7
- import { SelectFilterChip as s } from "./components/filter-row/select-filter-chip.js";
7
+ import { SelectFilterChip as C } from "./components/filter-row/select-filter-chip.js";
8
8
  import { PredefinedFilterName as c } from "./components/filter-row/predefinedFilters/index.js";
9
9
  import { Filter as P } from "./components/filter-sidepanel/filter.js";
10
10
  import { FilterSidePanel as w } from "./components/filter-sidepanel/filter-side-panel.js";
@@ -48,7 +48,7 @@ export {
48
48
  H as Pagination,
49
49
  X as PaginationControls,
50
50
  c as PredefinedFilterName,
51
- s as SelectFilterChip,
51
+ C as SelectFilterChip,
52
52
  Z as SortDropdown,
53
53
  ee as SwitchCase,
54
54
  k as TableRenderer,
@@ -1,7 +1,7 @@
1
1
  import { I as R, V as t } from "../../chunks/types.js";
2
2
  import { ActionBar as g } from "./components/action-bar/action-bar.js";
3
3
  import "./components/filter-row/filter-row.js";
4
- import "../../chunks/form-filter-chip.js";
4
+ import "./components/filter-row/form-filter-chip.js";
5
5
  import "./components/filter-row/metadata-filter-chip.js";
6
6
  import "./components/filter-row/select-filter-chip.js";
7
7
  import "./components/filter-row/predefinedFilters/index.js";
@@ -0,0 +1 @@
1
+ ._popoverFooter_1q01l_1{display:flex;flex-direction:row;gap:var(--space-2);align-items:center;justify-content:flex-end}._popoverContent_1q01l_9{width:320px}._filterChipGroup_1q01l_13{display:flex;flex-wrap:wrap}._filterChipIcon_1q01l_18>path{fill:var(--icon-icon-on-light)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-view",
3
- "version": "0.48.19",
3
+ "version": "0.48.20",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
6
  "@box/blueprint-web": "^12.66.0",
@@ -18,13 +18,13 @@
18
18
  "react-intl": "^6.4.2"
19
19
  },
20
20
  "devDependencies": {
21
- "@box/blueprint-web": "^12.69.0",
22
- "@box/blueprint-web-assets": "^4.66.1",
23
- "@box/box-item-type-selector": "^0.69.12",
21
+ "@box/blueprint-web": "^12.69.1",
22
+ "@box/blueprint-web-assets": "^4.67.0",
23
+ "@box/box-item-type-selector": "^0.69.13",
24
24
  "@box/eslint-plugin-blueprint": "1.0.4",
25
- "@box/item-icon": "^0.23.12",
26
- "@box/metadata-filter": "^1.26.10",
27
- "@box/storybook-utils": "0.14.2",
25
+ "@box/item-icon": "^0.23.13",
26
+ "@box/metadata-filter": "^1.26.11",
27
+ "@box/storybook-utils": "0.14.3",
28
28
  "@box/types": "0.2.1",
29
29
  "@tanstack/react-virtual": "^3.10.8",
30
30
  "react-intl": "^6.4.2"
@@ -1,89 +0,0 @@
1
- import { Popover as s, FilterChip as a, Button as f } from "@box/blueprint-web";
2
- import { useFormikContext as x, getIn as l } from "formik";
3
- import { useState as v, useMemo as O } from "react";
4
- import { useIntl as V } from "react-intl";
5
- import { getDefaultFieldValue as G } from "../esm/lib/components/filter-row/initial-field-values.js";
6
- import { isFilterSelected as M } from "../esm/lib/components/filter-row/is-filter-selected.js";
7
- import h from "../esm/lib/components/filter-row/messages.js";
8
- import { jsx as o, jsxs as n } from "react/jsx-runtime";
9
- import '../styles/form-filter-chip.css';const j = "_popoverFooter_z1gpu_1", N = "_popoverContent_z1gpu_9", P = "_filterChipGroup_z1gpu_13", C = {
10
- popoverFooter: j,
11
- popoverContent: N,
12
- filterChipGroup: P
13
- }, U = ({
14
- children: F,
15
- formRef: y,
16
- icon: i,
17
- id: t,
18
- name: g
19
- }) => {
20
- const {
21
- formatMessage: p
22
- } = V(), [T, c] = v(!1), {
23
- handleSubmit: _,
24
- setFieldValue: D,
25
- resetForm: S,
26
- values: r
27
- } = x(), m = l(r, `metadata.fields.${t}.fieldType`), b = () => {
28
- _(), c(!1);
29
- }, [z, B] = v(r), I = (e) => {
30
- c(e), e ? B(r) : S({
31
- values: z
32
- });
33
- }, R = () => {
34
- D(`metadata.fields.${t}.value`, G(m));
35
- }, u = O(() => {
36
- const e = l(r, `metadata.fields.${t}.value`);
37
- return e ? M(e) : !1;
38
- }, [r, t]), $ = () => {
39
- if (m === "date") {
40
- const e = l(r, `metadata.fields.${t}.value.customType`), k = e && e !== "anyTime" && e !== "customRange", d = l(r, `metadata.fields.${t}.value.relativeType`);
41
- return (k || d && d !== "customRange") && !u;
42
- }
43
- return !1;
44
- };
45
- return /* @__PURE__ */ o("div", {
46
- children: /* @__PURE__ */ n(s.Root, {
47
- onOpenChange: I,
48
- open: T,
49
- children: [/* @__PURE__ */ o(s.Trigger, {
50
- children: /* @__PURE__ */ n(a.TriggerChip, {
51
- selected: u,
52
- value: t,
53
- children: [i && /* @__PURE__ */ o(a.Icon, {
54
- icon: i
55
- }), /* @__PURE__ */ o(a.Label, {
56
- children: g
57
- }), /* @__PURE__ */ o(a.DropdownIndicator, {})]
58
- }, t)
59
- }), /* @__PURE__ */ n(s.ContentContainer, {
60
- align: "start",
61
- className: C.popoverContent,
62
- container: y.current,
63
- "data-testid": "form-filter-chip-popover",
64
- children: [/* @__PURE__ */ o(s.MainContent, {
65
- children: F
66
- }), /* @__PURE__ */ n(s.Footer, {
67
- className: C.popoverFooter,
68
- children: [/* @__PURE__ */ o(f, {
69
- onClick: R,
70
- size: "small",
71
- variant: "secondary",
72
- children: p(h.clearButton)
73
- }), /* @__PURE__ */ o(f, {
74
- disabled: $(),
75
- onClick: b,
76
- size: "small",
77
- type: "submit",
78
- variant: "primary",
79
- children: p(h.applyButton)
80
- })]
81
- })]
82
- })]
83
- })
84
- });
85
- };
86
- export {
87
- U as F,
88
- C as s
89
- };
@@ -1 +0,0 @@
1
- ._popoverFooter_z1gpu_1{display:flex;flex-direction:row;gap:var(--space-2);align-items:center;justify-content:flex-end}._popoverContent_z1gpu_9{width:320px}._filterChipGroup_z1gpu_13{display:flex;flex-wrap:wrap}