@box/metadata-view 1.54.8 → 1.54.10

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.
Files changed (109) hide show
  1. package/dist/chunks/action-bar.js +48 -0
  2. package/dist/chunks/empty-state.js +24 -0
  3. package/dist/chunks/error-state.js +23 -0
  4. package/dist/chunks/filter-row.module.js +6 -8
  5. package/dist/chunks/filter-side-panel.js +65 -0
  6. package/dist/chunks/header.js +56 -0
  7. package/dist/chunks/inline-editing-cell.js +34 -0
  8. package/dist/chunks/item-action-menu.js +86 -0
  9. package/dist/chunks/metadata-grid.js +44 -0
  10. package/dist/chunks/metadata-location-field.js +35 -0
  11. package/dist/chunks/metadata-view.js +102 -0
  12. package/dist/chunks/pagination-controls.js +40 -0
  13. package/dist/chunks/table-row.js +72 -0
  14. package/dist/chunks/types.js +6 -11
  15. package/dist/chunks/types2.js +4 -0
  16. package/dist/chunks/zoom-button.js +20 -0
  17. package/dist/esm/index.js +29 -59
  18. package/dist/esm/lib/components/action-bar/action-bar.js +2 -62
  19. package/dist/esm/lib/components/action-bar/index.js +2 -4
  20. package/dist/esm/lib/components/action-bar/messages.js +22 -24
  21. package/dist/esm/lib/components/action-bar/zoom-button.js +2 -30
  22. package/dist/esm/lib/components/constants.js +14 -6
  23. package/dist/esm/lib/components/empty-state/empty-state.js +2 -30
  24. package/dist/esm/lib/components/empty-state/index.js +2 -4
  25. package/dist/esm/lib/components/empty-state/messages.js +10 -12
  26. package/dist/esm/lib/components/error-state/error-state.js +2 -31
  27. package/dist/esm/lib/components/error-state/index.js +2 -4
  28. package/dist/esm/lib/components/error-state/messages.js +10 -12
  29. package/dist/esm/lib/components/filter-row/advanced-field-content.js +30 -52
  30. package/dist/esm/lib/components/filter-row/advanced-filter-context.js +3 -6
  31. package/dist/esm/lib/components/filter-row/all-filters-chip.js +31 -49
  32. package/dist/esm/lib/components/filter-row/filter-row.js +35 -59
  33. package/dist/esm/lib/components/filter-row/form-filter-chip.js +84 -113
  34. package/dist/esm/lib/components/filter-row/index.js +6 -12
  35. package/dist/esm/lib/components/filter-row/initial-field-values.js +31 -51
  36. package/dist/esm/lib/components/filter-row/is-blank-or-not-blank-filter.js +2 -4
  37. package/dist/esm/lib/components/filter-row/is-filter-selected.js +37 -58
  38. package/dist/esm/lib/components/filter-row/messages.js +38 -40
  39. package/dist/esm/lib/components/filter-row/metadata-filter-chip.js +74 -103
  40. package/dist/esm/lib/components/filter-row/predefinedFilters/index.js +2 -6
  41. package/dist/esm/lib/components/filter-row/predefinedFilters/predefined-filter-options-factory.js +14 -21
  42. package/dist/esm/lib/components/filter-row/predefinedFilters/use-predefined-filter.js +58 -71
  43. package/dist/esm/lib/components/filter-row/select-filter-chip.js +41 -58
  44. package/dist/esm/lib/components/filter-row/use-form-filter-chip.js +36 -40
  45. package/dist/esm/lib/components/filter-sidepanel/filter-side-panel.js +2 -82
  46. package/dist/esm/lib/components/filter-sidepanel/filter.js +95 -140
  47. package/dist/esm/lib/components/filter-sidepanel/index.js +3 -6
  48. package/dist/esm/lib/components/filter-sidepanel/messages.js +18 -20
  49. package/dist/esm/lib/components/header/header.js +2 -82
  50. package/dist/esm/lib/components/header/index.js +2 -4
  51. package/dist/esm/lib/components/header/messages.js +14 -16
  52. package/dist/esm/lib/components/index.js +26 -53
  53. package/dist/esm/lib/components/item-action-menu/identifier.js +4 -7
  54. package/dist/esm/lib/components/item-action-menu/index.js +2 -4
  55. package/dist/esm/lib/components/item-action-menu/item-action-menu.js +2 -127
  56. package/dist/esm/lib/components/item-action-menu/messages.js +5 -9
  57. package/dist/esm/lib/components/metadata-grid/index.js +2 -4
  58. package/dist/esm/lib/components/metadata-grid/messages.js +5 -9
  59. package/dist/esm/lib/components/metadata-grid/metadata-grid.js +2 -62
  60. package/dist/esm/lib/components/metadata-table/actionColumn.js +3 -5
  61. package/dist/esm/lib/components/metadata-table/hooks/useInfiniteScrollTableItems.js +24 -29
  62. package/dist/esm/lib/components/metadata-table/index.js +4 -8
  63. package/dist/esm/lib/components/metadata-table/messages.js +14 -16
  64. package/dist/esm/lib/components/metadata-table/metadata-table.js +89 -127
  65. package/dist/esm/lib/components/metadata-table/table-body/ghost-table-body.js +10 -19
  66. package/dist/esm/lib/components/metadata-table/table-body/ghost-table-row/ghost-table-row.js +8 -19
  67. package/dist/esm/lib/components/metadata-table/table-body/ghost-table-row/index.js +2 -4
  68. package/dist/esm/lib/components/metadata-table/table-body/inline-editing-cell/index.js +2 -4
  69. package/dist/esm/lib/components/metadata-table/table-body/inline-editing-cell/inline-editing-cell.js +2 -56
  70. package/dist/esm/lib/components/metadata-table/table-body/table-body-with-data.js +135 -209
  71. package/dist/esm/lib/components/metadata-table/table-body/table-row/index.js +2 -4
  72. package/dist/esm/lib/components/metadata-table/table-body/table-row/table-row.js +2 -12
  73. package/dist/esm/lib/components/metadata-table/table-renderer.js +34 -55
  74. package/dist/esm/lib/components/metadata-value/index.js +6 -12
  75. package/dist/esm/lib/components/metadata-value/messages.js +15 -17
  76. package/dist/esm/lib/components/metadata-value/metadata-checkbox-field.js +24 -34
  77. package/dist/esm/lib/components/metadata-value/metadata-file-chip.js +14 -22
  78. package/dist/esm/lib/components/metadata-value/metadata-file-field.js +12 -19
  79. package/dist/esm/lib/components/metadata-value/metadata-location-field.js +2 -48
  80. package/dist/esm/lib/components/metadata-value/metadata-radio-field.js +26 -37
  81. package/dist/esm/lib/components/metadata-value/metadata-search-field.js +19 -30
  82. package/dist/esm/lib/components/pagination/index.js +4 -9
  83. package/dist/esm/lib/components/pagination/marker-based-pagination.js +12 -19
  84. package/dist/esm/lib/components/pagination/messages.js +19 -21
  85. package/dist/esm/lib/components/pagination/offset-based-pagination.js +22 -31
  86. package/dist/esm/lib/components/pagination/pagination-controls.js +2 -53
  87. package/dist/esm/lib/components/pagination/pagination.js +20 -35
  88. package/dist/esm/lib/components/pagination/utils.js +4 -6
  89. package/dist/esm/lib/components/sort-dropdown/index.js +2 -4
  90. package/dist/esm/lib/components/sort-dropdown/sort-dropdown.js +37 -56
  91. package/dist/esm/lib/components/switch-case/index.js +2 -5
  92. package/dist/esm/lib/components/switch-case/switch-case.js +4 -12
  93. package/dist/esm/lib/hooks/use-header.js +41 -37
  94. package/dist/esm/lib/index.js +28 -59
  95. package/dist/esm/lib/metadata-view.js +2 -151
  96. package/dist/styles/action-bar.css +1 -1
  97. package/dist/styles/empty-state.css +1 -1
  98. package/dist/styles/filter-row.css +1 -1
  99. package/dist/styles/header.css +1 -1
  100. package/dist/styles/inline-editing-cell.css +1 -1
  101. package/dist/styles/item-action-menu.css +1 -1
  102. package/dist/styles/metadata-grid.css +1 -1
  103. package/dist/styles/metadata-view.css +1 -1
  104. package/dist/styles/pagination-controls.css +1 -1
  105. package/dist/styles/table-row.css +1 -0
  106. package/dist/styles/zoom-button.css +1 -1
  107. package/package.json +17 -17
  108. package/dist/chunks/index.js +0 -105
  109. package/dist/styles/index.css +0 -1
@@ -1,104 +1,75 @@
1
- import { MetadataStringField as M, MetadataFloatField as C, MetadataDateField as S } from "@box/metadata-filter";
2
- import { useIntl as b } from "react-intl";
3
- import { MetadataFileChip as x } from "../metadata-value/metadata-file-chip.js";
4
- import { AdvancedFieldContent as A } from "./advanced-field-content.js";
5
- import { FormFilterChip as o } from "./form-filter-chip.js";
6
- import { SelectFilterChip as D } from "./select-filter-chip.js";
7
- import { jsx as t } from "react/jsx-runtime";
8
- const N = ({
9
- filterOption: p,
10
- formRef: a
11
- }) => {
12
- const {
13
- advancedFilterOptionsMap: c,
14
- canUseRelativeDates: m,
15
- customDateFilterOptions: u,
16
- fieldType: n,
17
- icon: r,
18
- id: e,
19
- isAdvancedFilterEnabled: F,
20
- name: i,
21
- options: f,
22
- placeholder: h,
23
- variant: v
24
- } = p, {
25
- locale: s
26
- } = b(), l = `metadata.fields.${e}`, d = i ?? "";
27
- if (n === "multiSelect" && v === "file")
28
- return /* @__PURE__ */ t(x, {
29
- id: e
30
- });
31
- if (F)
32
- return /* @__PURE__ */ t(o, {
33
- advancedFilterOptionsMap: c,
34
- formRef: a,
35
- icon: r,
36
- id: e,
37
- isAdvancedFilterEnabled: !0,
38
- name: i,
39
- children: /* @__PURE__ */ t(A, {
40
- fieldType: n,
41
- fieldNamePrefix: l,
42
- filterOptionsMap: c,
43
- label: d,
44
- locale: s
45
- })
46
- }, e);
47
- switch (n) {
48
- case "date":
49
- return /* @__PURE__ */ t(o, {
50
- formRef: a,
51
- icon: r,
52
- id: e,
53
- name: i,
54
- children: /* @__PURE__ */ t(S, {
55
- canUseRelativeDates: m,
56
- customDateFilterOptions: u,
57
- direction: "vertical",
58
- fieldNamePrefix: l,
59
- label: d,
60
- locale: s
61
- })
62
- }, e);
63
- case "float":
64
- return /* @__PURE__ */ t(o, {
65
- formRef: a,
66
- icon: r,
67
- id: e,
68
- name: i,
69
- children: /* @__PURE__ */ t(C, {
70
- fieldNamePrefix: l,
71
- label: d
72
- })
73
- }, e);
74
- case "string":
75
- return /* @__PURE__ */ t(o, {
76
- formRef: a,
77
- icon: r,
78
- id: e,
79
- name: i,
80
- children: /* @__PURE__ */ t(M, {
81
- fieldNamePrefix: l,
82
- label: d
83
- })
84
- }, e);
85
- case "multiSelect":
86
- case "enum":
87
- return /* @__PURE__ */ t(D, {
88
- fieldNamePrefix: l,
89
- formRef: a,
90
- icon: r,
91
- id: e,
92
- name: i,
93
- options: f,
94
- placeholder: h,
95
- type: n
96
- });
97
- default:
98
- return null;
99
- }
100
- };
101
- export {
102
- N as MetadataFilterChip,
103
- N as default
1
+ import { MetadataFileChip as e } from "../metadata-value/metadata-file-chip.js";
2
+ import { AdvancedFieldContent as t } from "./advanced-field-content.js";
3
+ import { FormFilterChip as n } from "./form-filter-chip.js";
4
+ import { SelectFilterChip as r } from "./select-filter-chip.js";
5
+ import { useIntl as i } from "react-intl";
6
+ import { MetadataDateField as a, MetadataFloatField as o, MetadataStringField as s } from "@box/metadata-filter";
7
+ import { jsx as c } from "react/jsx-runtime";
8
+ var l = ({ filterOption: l, formRef: u }) => {
9
+ let { advancedFilterOptionsMap: d, canUseRelativeDates: f, customDateFilterOptions: p, fieldType: m, icon: h, id: g, isAdvancedFilterEnabled: _, name: v, options: y, placeholder: b, variant: x } = l, { locale: S } = i(), C = `metadata.fields.${g}`, w = v ?? "";
10
+ if (m === "multiSelect" && x === "file") return /* @__PURE__ */ c(e, { id: g });
11
+ if (_) return /* @__PURE__ */ c(n, {
12
+ advancedFilterOptionsMap: d,
13
+ formRef: u,
14
+ icon: h,
15
+ id: g,
16
+ isAdvancedFilterEnabled: !0,
17
+ name: v,
18
+ children: /* @__PURE__ */ c(t, {
19
+ fieldType: m,
20
+ fieldNamePrefix: C,
21
+ filterOptionsMap: d,
22
+ label: w,
23
+ locale: S
24
+ })
25
+ }, g);
26
+ switch (m) {
27
+ case "date": return /* @__PURE__ */ c(n, {
28
+ formRef: u,
29
+ icon: h,
30
+ id: g,
31
+ name: v,
32
+ children: /* @__PURE__ */ c(a, {
33
+ canUseRelativeDates: f,
34
+ customDateFilterOptions: p,
35
+ direction: "vertical",
36
+ fieldNamePrefix: C,
37
+ label: w,
38
+ locale: S
39
+ })
40
+ }, g);
41
+ case "float": return /* @__PURE__ */ c(n, {
42
+ formRef: u,
43
+ icon: h,
44
+ id: g,
45
+ name: v,
46
+ children: /* @__PURE__ */ c(o, {
47
+ fieldNamePrefix: C,
48
+ label: w
49
+ })
50
+ }, g);
51
+ case "string": return /* @__PURE__ */ c(n, {
52
+ formRef: u,
53
+ icon: h,
54
+ id: g,
55
+ name: v,
56
+ children: /* @__PURE__ */ c(s, {
57
+ fieldNamePrefix: C,
58
+ label: w
59
+ })
60
+ }, g);
61
+ case "multiSelect":
62
+ case "enum": return /* @__PURE__ */ c(r, {
63
+ fieldNamePrefix: C,
64
+ formRef: u,
65
+ icon: h,
66
+ id: g,
67
+ name: v,
68
+ options: y,
69
+ placeholder: b,
70
+ type: m
71
+ });
72
+ default: return null;
73
+ }
104
74
  };
75
+ export { l as MetadataFilterChip, l as default };
@@ -1,6 +1,2 @@
1
- let o = /* @__PURE__ */ (function(r) {
2
- return r.KeywordSearchFilterGroup = "KeywordSearchFilterGroup", r.FileTypeFilterGroup = "FileTypeFilterGroup", r.LocationFilterGroup = "LocationFilterGroup", r;
3
- })({});
4
- export {
5
- o as PredefinedFilterName
6
- };
1
+ import { t as e } from "../../../../../chunks/types2.js";
2
+ export { e as PredefinedFilterName };
@@ -1,22 +1,15 @@
1
- import o from "lodash/merge";
2
- import { PredefinedFilterName as e } from "./index.js";
3
- function a(r = {}) {
4
- const i = {
5
- [e.KeywordSearchFilterGroup]: {
6
- isDisabled: !1
7
- },
8
- [e.FileTypeFilterGroup]: {
9
- isDisabled: !1
10
- },
11
- [e.LocationFilterGroup]: {
12
- isDisabled: !1,
13
- triggerCallback: () => {
14
- console.error("Custom callback needs to be provided");
15
- }
16
- }
17
- };
18
- return o(i, r);
1
+ import { t as e } from "../../../../../chunks/types2.js";
2
+ import t from "lodash/merge";
3
+ function n(n = {}) {
4
+ return t({
5
+ [e.KeywordSearchFilterGroup]: { isDisabled: !1 },
6
+ [e.FileTypeFilterGroup]: { isDisabled: !1 },
7
+ [e.LocationFilterGroup]: {
8
+ isDisabled: !1,
9
+ triggerCallback: () => {
10
+ console.error("Custom callback needs to be provided");
11
+ }
12
+ }
13
+ }, n);
19
14
  }
20
- export {
21
- a as predefinedFilterOptionsFactory
22
- };
15
+ export { n as predefinedFilterOptionsFactory };
@@ -1,72 +1,59 @@
1
- import { useIntl as l } from "react-intl";
2
- import o from "../messages.js";
3
- import { predefinedFilterOptionsFactory as a } from "./predefined-filter-options-factory.js";
4
- import { PredefinedFilterName as i } from "./index.js";
5
- const p = {
6
- fieldType: "string",
7
- id: "keyword-filter",
8
- name: "",
9
- selected: !1,
10
- variant: "search"
11
- }, f = {
12
- fieldType: "multiSelect",
13
- id: "mimetype-filter",
14
- name: "",
15
- selected: !1,
16
- shouldRenderChip: !0,
17
- variant: "file"
18
- }, c = {
19
- fieldType: "enum",
20
- id: "location-filter",
21
- name: "",
22
- selected: !1,
23
- shouldRenderChip: !1,
24
- variant: "file"
25
- }, d = ({
26
- isDisabled: t
27
- }) => {
28
- const {
29
- formatMessage: e
30
- } = l();
31
- return t ? [] : [{
32
- filters: [{
33
- ...p,
34
- placeholder: e(o.keywordSearchFilterPlaceholder)
35
- }],
36
- toggleable: !1
37
- }];
38
- }, u = ({
39
- isDisabled: t
40
- }) => {
41
- const {
42
- formatMessage: e
43
- } = l();
44
- return t ? [] : [{
45
- filters: [{
46
- ...f
47
- }],
48
- title: e(o.fileTypeFilterTitle),
49
- toggleable: !0
50
- }];
51
- }, m = ({
52
- isDisabled: t,
53
- ...e
54
- }) => {
55
- const {
56
- formatMessage: r
57
- } = l();
58
- return t ? [] : [{
59
- filters: [{
60
- ...c,
61
- ...e
62
- }],
63
- title: r(o.locationFilterTitle),
64
- toggleable: !0
65
- }];
66
- }, h = (t = {}) => {
67
- const e = a(t), r = d(e[i.KeywordSearchFilterGroup]), n = u(e[i.FileTypeFilterGroup]), s = m(e[i.LocationFilterGroup]);
68
- return [...r, ...n, ...s];
69
- };
70
- export {
71
- h as usePredefinedFilter
1
+ import e from "../messages.js";
2
+ import { t } from "../../../../../chunks/types2.js";
3
+ import { predefinedFilterOptionsFactory as n } from "./predefined-filter-options-factory.js";
4
+ import { useIntl as r } from "react-intl";
5
+ var i = {
6
+ fieldType: "string",
7
+ id: "keyword-filter",
8
+ name: "",
9
+ selected: !1,
10
+ variant: "search"
11
+ }, a = {
12
+ fieldType: "multiSelect",
13
+ id: "mimetype-filter",
14
+ name: "",
15
+ selected: !1,
16
+ shouldRenderChip: !0,
17
+ variant: "file"
18
+ }, o = {
19
+ fieldType: "enum",
20
+ id: "location-filter",
21
+ name: "",
22
+ selected: !1,
23
+ shouldRenderChip: !1,
24
+ variant: "file"
25
+ }, s = ({ isDisabled: t }) => {
26
+ let { formatMessage: n } = r();
27
+ return t ? [] : [{
28
+ filters: [{
29
+ ...i,
30
+ placeholder: n(e.keywordSearchFilterPlaceholder)
31
+ }],
32
+ toggleable: !1
33
+ }];
34
+ }, c = ({ isDisabled: t }) => {
35
+ let { formatMessage: n } = r();
36
+ return t ? [] : [{
37
+ filters: [{ ...a }],
38
+ title: n(e.fileTypeFilterTitle),
39
+ toggleable: !0
40
+ }];
41
+ }, l = ({ isDisabled: t, ...n }) => {
42
+ let { formatMessage: i } = r();
43
+ return t ? [] : [{
44
+ filters: [{
45
+ ...o,
46
+ ...n
47
+ }],
48
+ title: i(e.locationFilterTitle),
49
+ toggleable: !0
50
+ }];
51
+ }, u = (e = {}) => {
52
+ let r = n(e), i = s(r[t.KeywordSearchFilterGroup]), a = c(r[t.FileTypeFilterGroup]), o = l(r[t.LocationFilterGroup]);
53
+ return [
54
+ ...i,
55
+ ...a,
56
+ ...o
57
+ ];
72
58
  };
59
+ export { u as usePredefinedFilter };
@@ -1,59 +1,42 @@
1
- import { DropdownMenu as o, FilterChip as c } from "@box/blueprint-web";
2
- import { useFormikContext as z } from "formik";
3
- import { useState as A } from "react";
4
- import { useIntl as O } from "react-intl";
5
- import S from "./messages.js";
6
- import { jsxs as a, jsx as t } from "react/jsx-runtime";
7
- const R = ({
8
- fieldNamePrefix: p,
9
- formRef: C,
10
- icon: m,
11
- id: i,
12
- name: h = "",
13
- options: f,
14
- type: l,
15
- placeholder: n
16
- }) => {
17
- const {
18
- formatMessage: g
19
- } = O(), [k, v] = A(!1), {
20
- values: x,
21
- setFieldValue: b,
22
- submitForm: w
23
- } = z(), u = x.metadata?.fields?.[i]?.value?.enum, F = Array.isArray(u) ? u : [], e = new Set(F), I = e.size > 0 ? g(S.chipNameWithCount, {
24
- name: h,
25
- count: e.size
26
- }) : h, y = !!n && l !== "multiSelect", d = async (r, s) => {
27
- l === "enum" ? e.clear() : e.delete(s), r && s !== n && e.add(s), await b(`${p}.value.enum`, Array.from(e)), w();
28
- };
29
- return /* @__PURE__ */ a(o.Root, {
30
- onOpenChange: v,
31
- open: k,
32
- children: [/* @__PURE__ */ t(o.Trigger, {
33
- asChild: !0,
34
- children: /* @__PURE__ */ a(c.TriggerChip, {
35
- selected: e.size > 0,
36
- value: i,
37
- children: [m && /* @__PURE__ */ t(c.Icon, {
38
- icon: m
39
- }), /* @__PURE__ */ t(c.Label, {
40
- children: I
41
- }), /* @__PURE__ */ t(c.DropdownIndicator, {})]
42
- }, i)
43
- }), /* @__PURE__ */ a(o.Content, {
44
- container: C.current,
45
- children: [y && /* @__PURE__ */ t(o.CheckboxItem, {
46
- checked: e.size === 0,
47
- onCheckedChange: (r) => d(r, n),
48
- children: n
49
- }, n), f?.map((r) => /* @__PURE__ */ t(o.CheckboxItem, {
50
- checked: e.has(r),
51
- onCheckedChange: (s) => d(s, r),
52
- children: r
53
- }, r))]
54
- })]
55
- });
56
- };
57
- export {
58
- R as SelectFilterChip
1
+ import e from "./messages.js";
2
+ import { DropdownMenu as t, FilterChip as n } from "@box/blueprint-web";
3
+ import { useState as r } from "react";
4
+ import { useIntl as i } from "react-intl";
5
+ import { useFormikContext as a } from "formik";
6
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
+ var c = ({ fieldNamePrefix: c, formRef: l, icon: u, id: d, name: f = "", options: p, type: m, placeholder: h }) => {
8
+ let { formatMessage: g } = i(), [_, v] = r(!1), { values: y, setFieldValue: b, submitForm: x } = a(), S = y.metadata?.fields?.[d]?.value?.enum, C = new Set(Array.isArray(S) ? S : []), w = C.size > 0 ? g(e.chipNameWithCount, {
9
+ name: f,
10
+ count: C.size
11
+ }) : f, T = !!h && m !== "multiSelect", E = async (e, t) => {
12
+ m === "enum" ? C.clear() : C.delete(t), e && t !== h && C.add(t), await b(`${c}.value.enum`, Array.from(C)), x();
13
+ };
14
+ return /* @__PURE__ */ s(t.Root, {
15
+ onOpenChange: v,
16
+ open: _,
17
+ children: [/* @__PURE__ */ o(t.Trigger, {
18
+ asChild: !0,
19
+ children: /* @__PURE__ */ s(n.TriggerChip, {
20
+ selected: C.size > 0,
21
+ value: d,
22
+ children: [
23
+ u && /* @__PURE__ */ o(n.Icon, { icon: u }),
24
+ /* @__PURE__ */ o(n.Label, { children: w }),
25
+ /* @__PURE__ */ o(n.DropdownIndicator, {})
26
+ ]
27
+ }, d)
28
+ }), /* @__PURE__ */ s(t.Content, {
29
+ container: l.current,
30
+ children: [T && /* @__PURE__ */ o(t.CheckboxItem, {
31
+ checked: C.size === 0,
32
+ onCheckedChange: (e) => E(e, h),
33
+ children: h
34
+ }, h), p?.map((e) => /* @__PURE__ */ o(t.CheckboxItem, {
35
+ checked: C.has(e),
36
+ onCheckedChange: (t) => E(t, e),
37
+ children: e
38
+ }, e))]
39
+ })]
40
+ });
59
41
  };
42
+ export { c as SelectFilterChip };
@@ -1,41 +1,37 @@
1
- import { useState as p, useCallback as n, useMemo as A } from "react";
2
- import { useIntl as C } from "react-intl";
3
- import { isBlankOrNotBlankFilter as v } from "./is-blank-or-not-blank-filter.js";
4
- import O from "./messages.js";
5
- const b = ({
6
- name: e,
7
- advancedFilterOptionsMap: s,
8
- initialAdvancedFilterOption: l
9
- }) => {
10
- const {
11
- formatMessage: a
12
- } = C(), [r, i] = p(l), [t, c] = p(l), d = n((o) => {
13
- i(o);
14
- }, []), m = n(() => {
15
- c(r);
16
- }, [r]), u = n(() => {
17
- i(t);
18
- }, [t]), h = n(() => {
19
- i(void 0), c(void 0);
20
- }, []), f = A(() => {
21
- if (!t || !v(t))
22
- return e;
23
- const [, o] = s?.find(([F]) => F === t) ?? [];
24
- return o ? a(O.chipNameWithFilterOption, {
25
- name: e,
26
- optionLabel: o
27
- }) : e;
28
- }, [e, t, s, a]);
29
- return {
30
- currentAdvancedFilterOption: r,
31
- appliedAdvancedFilterOption: t,
32
- dynamicDisplayName: f,
33
- handleAdvancedFilterOptionChange: d,
34
- handleApply: m,
35
- handleCancel: u,
36
- handleClear: h
37
- };
38
- };
39
- export {
40
- b as useFormFilterChip
1
+ import { isBlankOrNotBlankFilter as e } from "./is-blank-or-not-blank-filter.js";
2
+ import t from "./messages.js";
3
+ import { useCallback as n, useMemo as r, useState as i } from "react";
4
+ import { useIntl as a } from "react-intl";
5
+ var o = ({ name: o, advancedFilterOptionsMap: s, initialAdvancedFilterOption: c }) => {
6
+ let { formatMessage: l } = a(), [u, d] = i(c), [f, p] = i(c), m = n((e) => {
7
+ d(e);
8
+ }, []), h = n(() => {
9
+ p(u);
10
+ }, [u]), g = n(() => {
11
+ d(f);
12
+ }, [f]), _ = n(() => {
13
+ d(void 0), p(void 0);
14
+ }, []);
15
+ return {
16
+ currentAdvancedFilterOption: u,
17
+ appliedAdvancedFilterOption: f,
18
+ dynamicDisplayName: r(() => {
19
+ if (!f || !e(f)) return o;
20
+ let [, n] = s?.find(([e]) => e === f) ?? [];
21
+ return n ? l(t.chipNameWithFilterOption, {
22
+ name: o,
23
+ optionLabel: n
24
+ }) : o;
25
+ }, [
26
+ o,
27
+ f,
28
+ s,
29
+ l
30
+ ]),
31
+ handleAdvancedFilterOptionChange: m,
32
+ handleApply: h,
33
+ handleCancel: g,
34
+ handleClear: _
35
+ };
41
36
  };
37
+ export { o as useFormFilterChip };
@@ -1,82 +1,2 @@
1
- import { Filter as x } from "./filter.js";
2
- import { SidePanel as t, Accordion as d } from "@box/blueprint-web";
3
- import { useIntl as j } from "react-intl";
4
- import { useFormikContext as B } from "formik";
5
- import R from "lodash/noop";
6
- import { useState as u } from "react";
7
- import i from "./messages.js";
8
- import { jsx as e, jsxs as p } from "react/jsx-runtime";
9
- import '../../../../styles/filter-side-panel.css';const k = "_sidePanelContent_1j6pr_1", A = "_staticPosition_1j6pr_1", a = {
10
- sidePanelContent: k,
11
- staticPosition: A
12
- }, M = ({
13
- containerRef: h,
14
- filterGroups: r,
15
- isOpen: C,
16
- onIsOpenChange: s = R,
17
- getInitialFormValues: f
18
- }) => {
19
- const {
20
- formatMessage: o
21
- } = j(), {
22
- handleSubmit: P,
23
- resetForm: c,
24
- values: F
25
- } = B(), [S] = u(F), [v, y] = u(null), _ = () => {
26
- c({
27
- values: f()
28
- });
29
- }, b = (n) => {
30
- c({
31
- values: S
32
- }), s(n);
33
- }, g = () => {
34
- P(), s(!1);
35
- };
36
- return /* @__PURE__ */ e(t, {
37
- onOpenChange: b,
38
- open: C,
39
- variant: "overlay",
40
- children: /* @__PURE__ */ e(t.Overlay, {
41
- container: h?.current,
42
- children: /* @__PURE__ */ p(t.Content, {
43
- className: a.sidePanelContent,
44
- children: [/* @__PURE__ */ e(t.Header, {
45
- className: a.staticPosition,
46
- children: o(i.filtersHeader)
47
- }), /* @__PURE__ */ e(t.ScrollableContainer, {
48
- ref: y,
49
- children: /* @__PURE__ */ e(d, {
50
- defaultValue: r.map((n, l) => `item-${l}`),
51
- type: "multiple",
52
- children: r.map((n, l) => /* @__PURE__ */ e(d.Item, {
53
- ...n.toggleable ? {} : {
54
- fixed: "true"
55
- },
56
- title: n.title,
57
- value: `item-${l}`,
58
- children: n.filters.map((m) => /* @__PURE__ */ e(x, {
59
- ...m,
60
- parentRef: v
61
- }, m.id))
62
- }, `accordion-item-${n.title || "unnamed"}`))
63
- })
64
- }), /* @__PURE__ */ p(t.Footer, {
65
- className: a.staticPosition,
66
- children: [/* @__PURE__ */ e(t.Footer.SecondaryButton, {
67
- onClick: _,
68
- children: o(i.clearAllButton)
69
- }), /* @__PURE__ */ e(t.Footer.PrimaryButton, {
70
- onClick: g,
71
- children: o(i.showResultsButton)
72
- })]
73
- }), /* @__PURE__ */ e(t.Close, {
74
- "aria-label": o(i.closeAriaLabel)
75
- })]
76
- })
77
- })
78
- });
79
- };
80
- export {
81
- M as FilterSidePanel
82
- };
1
+ import { t as e } from "../../../../chunks/filter-side-panel.js";
2
+ export { e as FilterSidePanel };