@box/metadata-view 0.39.4 → 0.40.0

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,59 +1,84 @@
1
- import { useState as v } from "react";
2
- import { useIntl as F } from "react-intl";
3
- import { Popover as e, FilterChip as r, Button as l } from "@box/blueprint-web";
4
- import { useFormikContext as g } from "formik";
5
- import m from "../esm/lib/components/filter-row/messages.js";
6
- import { jsx as o, jsxs as t } from "react/jsx-runtime";
7
- import '../styles/form-filter-chip.css';const y = "_popoverFooter_6tqyh_1", _ = "_filterChipGroup_6tqyh_9", b = {
8
- popoverFooter: y,
9
- filterChipGroup: _
10
- }, j = ({
11
- children: c,
12
- formRef: h,
13
- icon: i,
14
- id: n,
15
- name: u,
16
- selected: d
1
+ import { Popover as n, FilterChip as i, Button as v } from "@box/blueprint-web";
2
+ import { useFormikContext as R, getIn as r } from "formik";
3
+ import { useState as f, useMemo as V } from "react";
4
+ import { useIntl as G } from "react-intl";
5
+ import g from "../esm/lib/components/filter-row/messages.js";
6
+ import { jsx as l, jsxs as p } from "react/jsx-runtime";
7
+ import '../styles/form-filter-chip.css';const M = "_popoverFooter_z1gpu_1", j = "_popoverContent_z1gpu_9", N = "_filterChipGroup_z1gpu_13", h = {
8
+ popoverFooter: M,
9
+ popoverContent: j,
10
+ filterChipGroup: N
11
+ }, H = ({
12
+ children: y,
13
+ formRef: C,
14
+ icon: u,
15
+ id: e,
16
+ name: F
17
17
  }) => {
18
18
  const {
19
- formatMessage: s
20
- } = F(), [f, p] = v(!1), a = g(), C = () => {
21
- a.handleSubmit(), p(!1);
22
- };
23
- return /* @__PURE__ */ o("div", {
24
- children: /* @__PURE__ */ t(e.Root, {
25
- onOpenChange: p,
26
- open: f,
27
- children: [/* @__PURE__ */ o(e.Trigger, {
28
- children: /* @__PURE__ */ t(r.TriggerChip, {
29
- selected: d,
30
- value: n,
31
- children: [i && /* @__PURE__ */ o(r.Icon, {
32
- icon: i
33
- }), /* @__PURE__ */ o(r.Label, {
34
- children: u
35
- }), /* @__PURE__ */ o(r.DropdownIndicator, {})]
36
- }, n)
37
- }), /* @__PURE__ */ t(e.ContentContainer, {
19
+ formatMessage: c
20
+ } = G(), [T, m] = f(!1), {
21
+ handleSubmit: $,
22
+ setFieldValue: s,
23
+ resetForm: D,
24
+ values: t
25
+ } = R(), _ = () => {
26
+ $(), m(!1);
27
+ }, [b, S] = f(t), z = (a) => {
28
+ m(a), a ? S(t) : D({
29
+ values: b
30
+ });
31
+ }, B = () => {
32
+ s(`metadata.fields.${e}.value.enum`, []), s(`metadata.fields.${e}.value.range`, {}), s(`metadata.fields.${e}.value.relativeType`, void 0), s(`metadata.fields.${e}.value.relativeDays`, void 0), s(`metadata.fields.${e}.value.customType`, "anyTime"), s(`metadata.fields.${e}.value.customDays`, void 0);
33
+ }, I = () => {
34
+ const a = r(t, `metadata.fields.${e}.value.customType`), o = a && a !== "anyTime" && a !== "customRange", d = r(t, `metadata.fields.${e}.value.relativeType`), x = d && d !== "customRange", O = r(t, `metadata.fields.${e}.value.range.gt`) || r(t, `metadata.fields.${e}.value.range.lt`);
35
+ return (o || x) && !O;
36
+ }, k = V(() => {
37
+ const a = r(t, `metadata.fields.${e}.fieldType`);
38
+ if (a === "string" || a === "float") {
39
+ const o = r(t, `metadata.fields.${e}.value.enum`);
40
+ return o && o.length > 0 && !!o[0];
41
+ }
42
+ if (a === "date") {
43
+ const o = r(t, `metadata.fields.${e}.value.range`);
44
+ return o && (o.gt || o.lt);
45
+ }
46
+ return !1;
47
+ }, [t, e]);
48
+ return /* @__PURE__ */ l("div", {
49
+ children: /* @__PURE__ */ p(n.Root, {
50
+ onOpenChange: z,
51
+ open: T,
52
+ children: [/* @__PURE__ */ l(n.Trigger, {
53
+ children: /* @__PURE__ */ p(i.TriggerChip, {
54
+ selected: k,
55
+ value: e,
56
+ children: [u && /* @__PURE__ */ l(i.Icon, {
57
+ icon: u
58
+ }), /* @__PURE__ */ l(i.Label, {
59
+ children: F
60
+ }), /* @__PURE__ */ l(i.DropdownIndicator, {})]
61
+ }, e)
62
+ }), /* @__PURE__ */ p(n.ContentContainer, {
38
63
  align: "start",
39
- container: h.current,
40
- children: [/* @__PURE__ */ o(e.MainContent, {
41
- children: c
42
- }), /* @__PURE__ */ t(e.Footer, {
43
- className: b.popoverFooter,
44
- children: [/* @__PURE__ */ o(l, {
45
- onClick: () => {
46
- a.setFieldValue(`metadata.fields.${n}.value.enum`, []);
47
- },
64
+ className: h.popoverContent,
65
+ container: C.current,
66
+ children: [/* @__PURE__ */ l(n.MainContent, {
67
+ children: y
68
+ }), /* @__PURE__ */ p(n.Footer, {
69
+ className: h.popoverFooter,
70
+ children: [/* @__PURE__ */ l(v, {
71
+ onClick: B,
48
72
  size: "small",
49
73
  variant: "secondary",
50
- children: s(m.clearButton)
51
- }), /* @__PURE__ */ o(l, {
52
- onClick: C,
74
+ children: c(g.clearButton)
75
+ }), /* @__PURE__ */ l(v, {
76
+ disabled: I(),
77
+ onClick: _,
53
78
  size: "small",
54
79
  type: "submit",
55
80
  variant: "primary",
56
- children: s(m.applyButton)
81
+ children: c(g.applyButton)
57
82
  })]
58
83
  })]
59
84
  })]
@@ -61,6 +86,6 @@ import '../styles/form-filter-chip.css';const y = "_popoverFooter_6tqyh_1", _ =
61
86
  });
62
87
  };
63
88
  export {
64
- j as F,
65
- b as s
89
+ H as F,
90
+ h as s
66
91
  };
@@ -1,43 +1,48 @@
1
- import { FilterChip as e } from "@box/blueprint-web";
2
- import { Filter as m } from "@box/blueprint-web-assets/icons/Line";
3
- import { useState as f } from "react";
4
- import { useIntl as c } from "react-intl";
5
- import d from "../filter-sidepanel/filter-sidepanel.js";
6
- import { getInitialFieldValues as h } from "./initial-field-values.js";
7
- import u from "./messages.js";
8
- import { jsxs as o, Fragment as g, jsx as t } from "react/jsx-runtime";
9
- const M = ({
10
- activeFilterCount: i,
11
- filterGroups: l
1
+ import { FilterChip as t } from "@box/blueprint-web";
2
+ import { Filter as S } from "@box/blueprint-web-assets/icons/Line";
3
+ import { useFormikContext as I } from "formik";
4
+ import { useState as O, useMemo as x } from "react";
5
+ import { useIntl as b } from "react-intl";
6
+ import j from "../filter-sidepanel/filter-sidepanel.js";
7
+ import { getInitialFieldValues as M } from "./initial-field-values.js";
8
+ import k from "./messages.js";
9
+ import { jsxs as F, Fragment as A, jsx as l } from "react/jsx-runtime";
10
+ const D = ({
11
+ filterGroups: r
12
12
  }) => {
13
13
  const {
14
- formatMessage: s
15
- } = c(), [n, r] = f(!1), a = () => r(!0);
16
- return /* @__PURE__ */ o(g, {
14
+ formatMessage: f
15
+ } = b(), {
16
+ values: i
17
+ } = I(), [a, n] = O(!1), d = () => n(!0), v = ([o, e]) => {
18
+ var m, u, p, c, g, h;
19
+ return ((m = e.value) == null ? void 0 : m.enum) && e.value.enum.length > 0 && !!e.value.enum[0] || ((u = e.value) == null ? void 0 : u.range) && (((c = (p = e.value) == null ? void 0 : p.range) == null ? void 0 : c.gt) || ((h = (g = e.value) == null ? void 0 : g.range) == null ? void 0 : h.lt));
20
+ }, s = x(() => Object.entries(i.metadata.fields).filter(v).length, [i]);
21
+ return /* @__PURE__ */ F(A, {
17
22
  children: [
18
23
  // We need to initialize the sidepanel state at the moment it is opened
19
- n && /* @__PURE__ */ t(d, {
20
- filterGroups: l,
21
- getInitialFormValues: () => h(l.flatMap(({
22
- filters: p
23
- }) => p)),
24
- isOpen: n,
25
- onIsOpenChange: r
24
+ a && /* @__PURE__ */ l(j, {
25
+ filterGroups: r,
26
+ getInitialFormValues: () => M(r.flatMap(({
27
+ filters: o
28
+ }) => o)),
29
+ isOpen: a,
30
+ onIsOpenChange: n
26
31
  }),
27
- /* @__PURE__ */ o(e.ChipButton, {
28
- onClick: a,
32
+ /* @__PURE__ */ F(t.ChipButton, {
33
+ onClick: d,
29
34
  value: "all-filters-chip-btn",
30
- children: [/* @__PURE__ */ t(e.Icon, {
31
- icon: m
32
- }), /* @__PURE__ */ t(e.Label, {
33
- children: s(u.allFilters)
34
- }), i > 0 ? /* @__PURE__ */ t(e.Status, {
35
- children: i.toString()
35
+ children: [/* @__PURE__ */ l(t.Icon, {
36
+ icon: S
37
+ }), /* @__PURE__ */ l(t.Label, {
38
+ children: f(k.allFilters)
39
+ }), s > 0 ? /* @__PURE__ */ l(t.Status, {
40
+ children: s.toString()
36
41
  }) : null]
37
42
  })
38
43
  ]
39
44
  });
40
45
  };
41
46
  export {
42
- M as default
47
+ D as default
43
48
  };
@@ -1,61 +1,53 @@
1
- import { FilterChip as I } from "@box/blueprint-web";
2
- import { Formik as S, Form as v } from "formik";
3
- import { useState as R, useEffect as g, useRef as w } from "react";
4
- import C from "./all-filters-chip.js";
5
- import { getInitialFieldValues as G } from "./initial-field-values.js";
6
- import { MetadataFilterChip as b } from "./metadata-filter-chip.js";
7
- import { usePredefinedFilter as j } from "./predefinedFilters/use-predefined-filter.js";
8
- import { s as x } from "../../../../chunks/form-filter-chip.js";
9
- import { jsx as l, jsxs as V } from "react/jsx-runtime";
10
- const p = (s) => Object.entries(s).filter(([r, t]) => {
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 R from "./all-filters-chip.js";
5
+ import { getInitialFieldValues as v } from "./initial-field-values.js";
6
+ import { MetadataFilterChip as G } from "./metadata-filter-chip.js";
7
+ import { usePredefinedFilter as b } from "./predefinedFilters/use-predefined-filter.js";
8
+ import { s as g } from "../../../../chunks/form-filter-chip.js";
9
+ import { jsx as l, jsxs as j } from "react/jsx-runtime";
10
+ const z = (o) => Object.entries(o).filter(([t, r]) => {
11
11
  var i;
12
- return ((i = t.value) == null ? void 0 : i.enum) && t.value.enum.length > 0 && t.value.enum[0] !== "";
13
- }).map(([r]) => r), q = ({
14
- predefinedFilterOptions: s,
15
- filterGroups: r = [],
16
- initialFilterValues: t,
12
+ return ((i = r.value) == null ? void 0 : i.enum) && r.value.enum.length > 0 && r.value.enum[0] !== "";
13
+ }).map(([t]) => t), A = ({
14
+ predefinedFilterOptions: o,
15
+ filterGroups: t = [],
16
+ initialFilterValues: r,
17
17
  isAllFiltersDisabled: i,
18
- onFilterSubmit: o
18
+ onFilterSubmit: m
19
19
  }) => {
20
- const [a, n] = R([]), f = j(s), F = ({
20
+ const p = b(o), u = ({
21
21
  metadata: {
22
22
  fields: e
23
23
  }
24
24
  }) => {
25
- const h = p(e);
26
- n(h), o && o(e);
27
- }, m = [...f, ...r], u = m.flatMap(({
25
+ m && m(e);
26
+ }, s = [...p, ...t], a = s.flatMap(({
28
27
  filters: e
29
- }) => e), d = G(u, t);
30
- g(() => {
31
- const e = p(d.metadata.fields);
32
- n(e);
33
- }, []);
34
- const c = w(null);
35
- return /* @__PURE__ */ l(S, {
28
+ }) => e), f = v(a, r), n = F(null);
29
+ return /* @__PURE__ */ l(c, {
36
30
  enableReinitialize: !0,
37
- initialValues: d,
38
- onSubmit: F,
39
- children: /* @__PURE__ */ l(v, {
40
- ref: c,
41
- children: /* @__PURE__ */ V(I.Group, {
42
- className: x.filterChipGroup,
31
+ initialValues: f,
32
+ onSubmit: u,
33
+ children: /* @__PURE__ */ l(h, {
34
+ ref: n,
35
+ children: /* @__PURE__ */ j(d.Group, {
36
+ className: g.filterChipGroup,
43
37
  name: "metadata-view-filters",
44
38
  type: "multiple",
45
- children: [i ? null : /* @__PURE__ */ l(C, {
46
- activeFilterCount: a.length,
47
- filterGroups: m
48
- }), u.filter((e) => e.shouldRenderChip).map((e) => /* @__PURE__ */ l(b, {
39
+ children: [i ? null : /* @__PURE__ */ l(R, {
40
+ filterGroups: s
41
+ }), a.filter((e) => e.shouldRenderChip).map((e) => /* @__PURE__ */ l(G, {
49
42
  filterOption: e,
50
- formRef: c,
51
- selected: a.includes(e.id)
43
+ formRef: n
52
44
  }, e.id))]
53
45
  })
54
46
  })
55
47
  });
56
48
  };
57
49
  export {
58
- q as FilterRow,
59
- q as default,
60
- p as getSelectedFilterIds
50
+ A as FilterRow,
51
+ A as default,
52
+ z as getSelectedFilterIds
61
53
  };
@@ -1,7 +1,7 @@
1
- import "react";
2
- import "react-intl";
3
1
  import "@box/blueprint-web";
4
2
  import "formik";
3
+ import "react";
4
+ import "react-intl";
5
5
  import { F as e, F as f } from "../../../../chunks/form-filter-chip.js";
6
6
  import "./messages.js";
7
7
  import "react/jsx-runtime";
@@ -1,19 +1,21 @@
1
- const r = (t) => ({
2
- key: t,
3
- id: t
4
- }), c = ({
5
- fieldType: t,
6
- options: e
7
- }) => ["enum", "multiSelect"].includes(t) ? (e || []).map(r) : [], l = (t, e) => ({
1
+ const c = (e) => ({
2
+ key: e,
3
+ id: e
4
+ }), o = ({
5
+ fieldType: e,
6
+ options: n
7
+ }) => ["enum", "multiSelect"].includes(e) ? (n || []).map(c) : [], l = (e, n) => ({
8
8
  metadata: {
9
- fields: t.reduce((a, n) => {
9
+ fields: e.reduce((a, t) => {
10
10
  var i;
11
- const u = (i = e == null ? void 0 : e[n.id]) == null ? void 0 : i.value, o = {
12
- enum: []
11
+ const u = (i = n == null ? void 0 : n[t.id]) == null ? void 0 : i.value, d = {
12
+ enum: [],
13
+ customType: "anyTime"
13
14
  };
14
- return a[n.id] = {
15
- value: u || o,
16
- options: c(n)
15
+ return a[t.id] = {
16
+ value: u || d,
17
+ fieldType: t.fieldType,
18
+ options: o(t)
17
19
  }, a;
18
20
  }, {})
19
21
  }
@@ -1,56 +1,73 @@
1
- import { MetadataStringField as d } from "@box/metadata-filter";
2
- import { F as p } from "../../../../chunks/form-filter-chip.js";
3
- import { SelectFilterChip as f } from "./select-filter-chip.js";
4
- import { MetadataFileChip as u } from "../metadata-value/metadata-file-chip.js";
1
+ import { MetadataStringField as f, MetadataDateField as F } from "@box/metadata-filter";
2
+ import { useIntl as h } from "react-intl";
3
+ import { F as n } from "../../../../chunks/form-filter-chip.js";
4
+ import { SelectFilterChip as C } from "./select-filter-chip.js";
5
+ import { MetadataFileChip as M } from "../metadata-value/metadata-file-chip.js";
5
6
  import { jsx as t } from "react/jsx-runtime";
6
- const S = ({
7
- filterOption: n,
8
- formRef: a,
9
- selected: m
7
+ const y = ({
8
+ filterOption: s,
9
+ formRef: i
10
10
  }) => {
11
11
  const {
12
- fieldType: r,
13
- icon: l,
12
+ canUseRelativeDates: c,
13
+ customDateFilterOptions: d,
14
+ fieldType: o,
15
+ icon: r,
14
16
  id: e,
15
- name: i,
16
- options: s,
17
- variant: c
18
- } = n, o = `metadata.fields.${e}`;
19
- switch (r) {
17
+ name: a,
18
+ options: m,
19
+ variant: p
20
+ } = s, {
21
+ locale: u
22
+ } = h(), l = `metadata.fields.${e}`;
23
+ switch (o) {
20
24
  case "date":
25
+ return /* @__PURE__ */ t(n, {
26
+ formRef: i,
27
+ icon: r,
28
+ id: e,
29
+ name: a,
30
+ children: /* @__PURE__ */ t(F, {
31
+ canUseRelativeDates: c,
32
+ customDateFilterOptions: d,
33
+ direction: "vertical",
34
+ fieldNamePrefix: l,
35
+ label: a,
36
+ locale: u
37
+ })
38
+ }, e);
21
39
  case "float":
22
40
  case "string":
23
- return /* @__PURE__ */ t(p, {
24
- formRef: a,
25
- icon: l,
41
+ return /* @__PURE__ */ t(n, {
42
+ formRef: i,
43
+ icon: r,
26
44
  id: e,
27
- name: i,
28
- selected: m,
29
- children: /* @__PURE__ */ t(d, {
30
- fieldNamePrefix: o,
31
- label: i
45
+ name: a,
46
+ children: /* @__PURE__ */ t(f, {
47
+ fieldNamePrefix: l,
48
+ label: a
32
49
  })
33
50
  }, e);
34
51
  case "multiSelect":
35
- if (c === "file")
36
- return /* @__PURE__ */ t(u, {
52
+ if (p === "file")
53
+ return /* @__PURE__ */ t(M, {
37
54
  id: e
38
55
  });
39
56
  case "enum":
40
- return /* @__PURE__ */ t(f, {
41
- fieldNamePrefix: o,
42
- formRef: a,
43
- icon: l,
57
+ return /* @__PURE__ */ t(C, {
58
+ fieldNamePrefix: l,
59
+ formRef: i,
60
+ icon: r,
44
61
  id: e,
45
- name: i,
46
- options: s,
47
- type: r
62
+ name: a,
63
+ options: m,
64
+ type: o
48
65
  });
49
66
  default:
50
67
  return null;
51
68
  }
52
69
  };
53
70
  export {
54
- S as MetadataFilterChip,
55
- S as default
71
+ y as MetadataFilterChip,
72
+ y as default
56
73
  };
@@ -1,9 +1,9 @@
1
- import { MetadataStringField as o, MetadataMultiSelectField as s, MetadataEnumField as f, MetadataDateField as m } from "@box/metadata-filter";
2
- import { useIntl as c } from "react-intl";
1
+ import { MetadataStringField as o, MetadataMultiSelectField as f, MetadataEnumField as s, MetadataDateField as m } from "@box/metadata-filter";
2
+ import { useIntl as n } from "react-intl";
3
3
  import { MetadataFileField as F } from "../metadata-value/metadata-file-field.js";
4
4
  import { MetadataLocationField as M } from "../metadata-value/metadata-location-field.js";
5
- import { MetadataSearchField as x } from "../metadata-value/metadata-search-field.js";
6
- import { MetadataRadioField as S } from "../metadata-value/metadata-radio-field.js";
5
+ import { MetadataRadioField as x } from "../metadata-value/metadata-radio-field.js";
6
+ import { MetadataSearchField as S } from "../metadata-value/metadata-search-field.js";
7
7
  import { jsx as t } from "react/jsx-runtime";
8
8
  const i = (e) => `metadata.fields.${e}`, b = ({
9
9
  id: e,
@@ -13,7 +13,7 @@ const i = (e) => `metadata.fields.${e}`, b = ({
13
13
  }) => {
14
14
  switch (r) {
15
15
  case "search":
16
- return /* @__PURE__ */ t(x, {
16
+ return /* @__PURE__ */ t(S, {
17
17
  id: e,
18
18
  name: a,
19
19
  placeholder: l
@@ -38,7 +38,7 @@ const i = (e) => `metadata.fields.${e}`, b = ({
38
38
  });
39
39
  case "default":
40
40
  default:
41
- return /* @__PURE__ */ t(s, {
41
+ return /* @__PURE__ */ t(f, {
42
42
  fieldNamePrefix: i(e),
43
43
  label: a || "",
44
44
  portalElement: r
@@ -49,27 +49,27 @@ const i = (e) => `metadata.fields.${e}`, b = ({
49
49
  name: a,
50
50
  parentRef: l,
51
51
  variant: r,
52
- renderer: d,
53
- triggerCallback: n
52
+ renderer: c,
53
+ triggerCallback: d
54
54
  }) => {
55
55
  const {
56
56
  locale: u
57
- } = c();
57
+ } = n();
58
58
  switch (r) {
59
59
  case "file":
60
60
  return /* @__PURE__ */ t(M, {
61
61
  id: e,
62
- renderer: d,
63
- triggerSetValueCallback: n
62
+ renderer: c,
63
+ triggerSetValueCallback: d
64
64
  });
65
65
  case "radio":
66
- return /* @__PURE__ */ t(S, {
66
+ return /* @__PURE__ */ t(x, {
67
67
  id: e,
68
68
  name: a
69
69
  });
70
70
  case "default":
71
71
  default:
72
- return /* @__PURE__ */ t(f, {
72
+ return /* @__PURE__ */ t(s, {
73
73
  fieldNamePrefix: i(e),
74
74
  label: a || "",
75
75
  locale: u,
@@ -77,22 +77,25 @@ const i = (e) => `metadata.fields.${e}`, b = ({
77
77
  });
78
78
  }
79
79
  }, P = ({
80
- id: e,
81
- customLabels: a,
82
- variant: l
80
+ customLabels: e,
81
+ canUseRelativeDates: a,
82
+ customDateFilterOptions: l,
83
+ id: r,
84
+ name: c
83
85
  }) => {
84
86
  const {
85
- locale: r
86
- } = c();
87
+ locale: d
88
+ } = n();
87
89
  return /* @__PURE__ */ t(m, {
88
- canUseRelativeDates: l === "relative",
89
- customFieldLabels: a,
90
+ canUseRelativeDates: a,
91
+ customDateFilterOptions: l,
92
+ customFieldLabels: e,
90
93
  direction: "vertical",
91
- fieldNamePrefix: i(e),
92
- label: "",
93
- locale: r
94
+ fieldNamePrefix: i(r),
95
+ label: c || "",
96
+ locale: d
94
97
  });
95
- }, R = ({
98
+ }, k = ({
96
99
  ...e
97
100
  }) => {
98
101
  switch (e.fieldType) {
@@ -101,6 +104,10 @@ const i = (e) => `metadata.fields.${e}`, b = ({
101
104
  return /* @__PURE__ */ t(b, {
102
105
  ...e
103
106
  });
107
+ case "date":
108
+ return /* @__PURE__ */ t(P, {
109
+ ...e
110
+ });
104
111
  case "multiSelect":
105
112
  return /* @__PURE__ */ t(g, {
106
113
  ...e
@@ -109,14 +116,10 @@ const i = (e) => `metadata.fields.${e}`, b = ({
109
116
  return /* @__PURE__ */ t(h, {
110
117
  ...e
111
118
  });
112
- case "date":
113
- return /* @__PURE__ */ t(P, {
114
- ...e
115
- });
116
119
  default:
117
120
  return null;
118
121
  }
119
122
  };
120
123
  export {
121
- R as default
124
+ k as default
122
125
  };
@@ -1 +1 @@
1
- ._popoverFooter_6tqyh_1{display:flex;flex-direction:row;gap:var(--space-2);align-items:center;justify-content:flex-end}._filterChipGroup_6tqyh_9{display:flex;flex-wrap:wrap}
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}
@@ -1,7 +1,6 @@
1
1
  import { FilterGroup } from './types';
2
2
  interface AllFiltersChipProps {
3
- activeFilterCount: number;
4
3
  filterGroups: Array<FilterGroup>;
5
4
  }
6
- declare const AllFiltersChip: ({ activeFilterCount, filterGroups }: AllFiltersChipProps) => import("react/jsx-runtime").JSX.Element;
5
+ declare const AllFiltersChip: ({ filterGroups }: AllFiltersChipProps) => import("react/jsx-runtime").JSX.Element;
7
6
  export default AllFiltersChip;
@@ -4,7 +4,6 @@ export interface FormFilterChipProps {
4
4
  icon?: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, 'ref'> & React.RefAttributes<SVGSVGElement>>;
5
5
  id: string;
6
6
  name: string;
7
- selected: boolean;
8
7
  }
9
- export declare const FormFilterChip: ({ children, formRef, icon, id, name, selected }: FormFilterChipProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const FormFilterChip: ({ children, formRef, icon, id, name }: FormFilterChipProps) => import("react/jsx-runtime").JSX.Element;
10
9
  export default FormFilterChip;
@@ -1,8 +1,10 @@
1
1
  import { MetadataFormFieldValue, MetadataTemplateFieldOption } from '@box/metadata-filter';
2
+ import { MetadataFieldType } from '../../types';
2
3
  import { FilterOption, FilterValues } from './types';
3
4
  export declare const getInitialFieldValues: (filterOptions: FilterOption[], customFieldValues?: FilterValues) => {
4
5
  metadata: {
5
6
  fields: Record<string, {
7
+ fieldType: MetadataFieldType;
6
8
  value: MetadataFormFieldValue;
7
9
  options?: Array<MetadataTemplateFieldOption>;
8
10
  }>;
@@ -2,7 +2,6 @@ import { FilterOption } from './types';
2
2
  export interface MetadataFilterChipProps {
3
3
  filterOption: FilterOption;
4
4
  formRef: React.RefObject<HTMLFormElement>;
5
- selected: boolean;
6
5
  }
7
- export declare const MetadataFilterChip: ({ filterOption, formRef, selected }: MetadataFilterChipProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const MetadataFilterChip: ({ filterOption, formRef }: MetadataFilterChipProps) => import("react/jsx-runtime").JSX.Element;
8
7
  export default MetadataFilterChip;
@@ -1,6 +1,18 @@
1
1
  import { MetadataFormFieldValue } from '@box/metadata-filter';
2
2
  import { ReactNode } from 'react';
3
3
  import { FilterVariant, MetadataFieldType } from '../../types';
4
+ export interface CustomDateFilterOption {
5
+ name: string;
6
+ from: number;
7
+ to: number;
8
+ }
9
+ export interface CustomDateFilterOptionsProps {
10
+ name: string;
11
+ type: string;
12
+ options?: Array<CustomDateFilterOption>;
13
+ from?: number;
14
+ to?: number;
15
+ }
4
16
  export interface FilterGroup {
5
17
  filters: Array<FilterOption>;
6
18
  title?: string;
@@ -14,6 +26,8 @@ export interface FilterOption {
14
26
  name?: string;
15
27
  options?: string[];
16
28
  placeholder?: string;
29
+ canUseRelativeDates?: boolean;
30
+ customDateFilterOptions?: Array<CustomDateFilterOptionsProps>;
17
31
  selected: boolean;
18
32
  shouldRenderChip?: boolean;
19
33
  variant?: FilterVariant;
@@ -30,3 +44,8 @@ export interface FilterChipProps {
30
44
  export type FilterValues = Record<string, {
31
45
  value: MetadataFormFieldValue;
32
46
  }>;
47
+ export type MetadataFormValues = {
48
+ metadata: {
49
+ fields: FilterValues;
50
+ };
51
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-view",
3
- "version": "0.39.4",
3
+ "version": "0.40.0",
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.63.10",
24
24
  "@box/eslint-plugin-blueprint": "*",
25
25
  "@box/item-icon": "^0.17.13",
26
- "@box/metadata-filter": "^1.18.11",
26
+ "@box/metadata-filter": "^1.19.0",
27
27
  "@box/storybook-utils": "0.13.18",
28
28
  "@box/types": "0.2.1",
29
29
  "@tanstack/react-virtual": "^3.10.8",