@box/metadata-view 1.26.1 → 1.28.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.
Files changed (26) hide show
  1. package/dist/chunks/index.js +41 -41
  2. package/dist/chunks/types.js +3 -3
  3. package/dist/esm/lib/components/filter-row/initial-field-values.js +12 -13
  4. package/dist/esm/lib/components/filter-row/metadata-filter-chip.js +1 -0
  5. package/dist/esm/lib/components/filter-row/predefinedFilters/index.js +2 -2
  6. package/dist/esm/lib/components/filter-row/select-filter-chip.js +39 -40
  7. package/dist/esm/lib/components/filter-sidepanel/filter-side-panel.js +36 -36
  8. package/dist/esm/lib/components/filter-sidepanel/filter.js +7 -4
  9. package/dist/esm/lib/components/item-action-menu/item-action-menu.js +103 -103
  10. package/dist/esm/lib/components/metadata-grid/metadata-grid.js +29 -30
  11. package/dist/esm/lib/components/metadata-table/actionColumn.js +3 -3
  12. package/dist/esm/lib/components/metadata-table/hooks/useInfiniteScrollTableItems.js +13 -16
  13. package/dist/esm/lib/components/metadata-table/table-body/table-body-with-data.js +140 -144
  14. package/dist/esm/lib/components/metadata-table/table-renderer.js +35 -35
  15. package/dist/esm/lib/components/metadata-value/metadata-checkbox-field.js +14 -15
  16. package/dist/esm/lib/components/metadata-value/metadata-file-chip.js +13 -14
  17. package/dist/esm/lib/components/metadata-value/metadata-file-field.js +12 -13
  18. package/dist/esm/lib/components/metadata-value/metadata-location-field.js +31 -32
  19. package/dist/esm/lib/components/metadata-value/metadata-radio-field.js +10 -11
  20. package/dist/esm/lib/components/metadata-value/metadata-search-field.js +22 -23
  21. package/dist/esm/lib/components/sort-dropdown/sort-dropdown.js +35 -35
  22. package/dist/esm/lib/metadata-view.js +59 -59
  23. package/dist/i18n/en-x-pseudo.js +31 -31
  24. package/dist/i18n/en-x-pseudo.properties +31 -31
  25. package/dist/styles/action-bar.css +1 -1
  26. package/package.json +12 -12
@@ -1,214 +1,210 @@
1
- import { TableBody as E, Row as u, Cell as f, ActionCell as W, Text as g } from "@box/blueprint-web";
2
- import { ItemTypeIcon as b } from "@box/item-icon";
1
+ import { TableBody as x, Row as C, Cell as I, ActionCell as _, Text as y } from "@box/blueprint-web";
2
+ import { ItemTypeIcon as E } from "@box/item-icon";
3
3
  import L from "clsx";
4
4
  import S from "lodash/get";
5
- import h from "react";
5
+ import m from "react";
6
6
  import { I as p } from "../../../../../chunks/types.js";
7
- import { THUMBNAIL_LIST_VIEW_HEIGHTS as j } from "../../constants.js";
8
- import { s as i, T as G } from "../../../../../chunks/index.js";
9
- import { jsxs as $, jsx as t } from "react/jsx-runtime";
10
- import { InlineEditingCell as H } from "./inline-editing-cell/inline-editing-cell.js";
11
- import { ItemActionMenu as w } from "../../item-action-menu/item-action-menu.js";
12
- import { GhostTableRow as A } from "./ghost-table-row/ghost-table-row.js";
13
- const B = (e, n, r) => {
14
- const s = r ? n.split(".")[1] : n;
15
- return S(e, s);
16
- }, R = /* @__PURE__ */ h.memo(({
7
+ import { THUMBNAIL_LIST_VIEW_HEIGHTS as D } from "../../constants.js";
8
+ import { s as c, T as U } from "../../../../../chunks/index.js";
9
+ import { jsxs as T, jsx as t } from "react/jsx-runtime";
10
+ import { GhostTableRow as k } from "./ghost-table-row/ghost-table-row.js";
11
+ import { InlineEditingCell as W } from "./inline-editing-cell/inline-editing-cell.js";
12
+ import { ItemActionMenu as j } from "../../item-action-menu/item-action-menu.js";
13
+ const B = (e, l, n) => {
14
+ const r = n ? l.split(".")[1] : l;
15
+ return S(e, r);
16
+ }, G = /* @__PURE__ */ m.memo(({
17
17
  column: e,
18
- iconColumnVariant: n,
19
- item: r
18
+ iconColumnVariant: l,
19
+ item: n
20
20
  }) => {
21
21
  const {
22
- id: s,
23
- isItemMetadata: d,
24
- subtitle: c,
25
- textValue: m
26
- } = e, a = `${m}-${r.id}`;
27
- return /* @__PURE__ */ t(f, {
28
- children: /* @__PURE__ */ $("div", {
29
- className: i.tableNameCell,
30
- children: [/* @__PURE__ */ t(b, {
31
- className: i.tableNameCellIconInline,
32
- item: r
33
- }), /* @__PURE__ */ $("div", {
34
- className: L(i.tableNameCellTitle, {
35
- [i.hasSubtitle]: n === p.INLINE_SUBTITLE
22
+ id: r,
23
+ isItemMetadata: s,
24
+ subtitle: d,
25
+ textValue: f
26
+ } = e, a = `${f}-${n.id}`;
27
+ return /* @__PURE__ */ t(I, {
28
+ children: /* @__PURE__ */ T("div", {
29
+ className: c.tableNameCell,
30
+ children: [/* @__PURE__ */ t(E, {
31
+ className: c.tableNameCellIconInline,
32
+ item: n
33
+ }), /* @__PURE__ */ T("div", {
34
+ className: L(c.tableNameCellTitle, {
35
+ [c.hasSubtitle]: l === p.INLINE_SUBTITLE
36
36
  }),
37
- children: [/* @__PURE__ */ t(g, {
37
+ children: [/* @__PURE__ */ t(y, {
38
38
  as: "span",
39
- className: i.tableNameCellText,
40
- children: B(r, s, d)
41
- }), n === p.INLINE_SUBTITLE && /* @__PURE__ */ t(g, {
39
+ className: c.tableNameCellText,
40
+ children: B(n, r, s)
41
+ }), l === p.INLINE_SUBTITLE && /* @__PURE__ */ t(y, {
42
42
  as: "span",
43
- className: i.tableNameCellText,
43
+ className: c.tableNameCellText,
44
44
  color: "textOnLightSecondary",
45
- children: c
45
+ children: d
46
46
  })]
47
47
  })]
48
48
  })
49
49
  }, a);
50
- }), F = /* @__PURE__ */ h.memo(({
50
+ }), H = /* @__PURE__ */ m.memo(({
51
51
  column: e,
52
- item: n
52
+ item: l
53
53
  }) => {
54
- var s;
55
- const r = `${e.textValue}-${n.id}`;
56
- return /* @__PURE__ */ t(f, {
57
- children: (s = e.cellRenderer) == null ? void 0 : s.call(e, n, e)
58
- }, r);
59
- }), K = /* @__PURE__ */ h.memo(({
54
+ const n = `${e.textValue}-${l.id}`;
55
+ return /* @__PURE__ */ t(I, {
56
+ children: e.cellRenderer?.(l, e)
57
+ }, n);
58
+ }), A = /* @__PURE__ */ m.memo(({
60
59
  column: e,
61
- item: n
60
+ item: l
62
61
  }) => {
63
- const r = `${e.textValue}-${n.id}`, s = S(n, e.id);
64
- return s ? /* @__PURE__ */ t(f, {
65
- children: s.join(" ")
66
- }, r) : /* @__PURE__ */ t(f, {}, r);
67
- }), k = /* @__PURE__ */ h.memo(({
62
+ const n = `${e.textValue}-${l.id}`, r = S(l, e.id);
63
+ return r ? /* @__PURE__ */ t(I, {
64
+ children: r.join(" ")
65
+ }, n) : /* @__PURE__ */ t(I, {}, n);
66
+ }), F = /* @__PURE__ */ m.memo(({
68
67
  column: e,
69
- item: n
68
+ item: l
70
69
  }) => {
71
70
  const {
72
- id: r,
73
- isItemMetadata: s,
74
- textValue: d
75
- } = e, c = `${d}-${n.id}`;
76
- return /* @__PURE__ */ t(f, {
77
- children: /* @__PURE__ */ t(g, {
71
+ id: n,
72
+ isItemMetadata: r,
73
+ textValue: s
74
+ } = e, d = `${s}-${l.id}`;
75
+ return /* @__PURE__ */ t(I, {
76
+ children: /* @__PURE__ */ t(y, {
78
77
  as: "span",
79
- children: B(n, r, s)
78
+ children: B(l, n, r)
80
79
  })
81
- }, c);
82
- }), q = /* @__PURE__ */ h.memo(({
80
+ }, d);
81
+ }), K = /* @__PURE__ */ m.memo(({
83
82
  column: e,
84
- iconColumnVariant: n,
85
- item: r,
86
- onInlineEditChange: s
83
+ iconColumnVariant: l,
84
+ item: n,
85
+ onInlineEditChange: r
87
86
  }) => {
88
87
  const {
89
- cellRenderer: d,
90
- id: c,
91
- isInlineEditingEnabled: m,
88
+ cellRenderer: s,
89
+ id: d,
90
+ isInlineEditingEnabled: f,
92
91
  type: a
93
- } = e, N = c === "item.name" && (n === p.INLINE || n === p.INLINE_SUBTITLE);
94
- return d ? /* @__PURE__ */ t(F, {
92
+ } = e, u = d === "item.name" && (l === p.INLINE || l === p.INLINE_SUBTITLE);
93
+ return s ? /* @__PURE__ */ t(H, {
95
94
  column: e,
96
- item: r
97
- }) : N ? /* @__PURE__ */ t(R, {
95
+ item: n
96
+ }) : u ? /* @__PURE__ */ t(G, {
98
97
  column: e,
99
- iconColumnVariant: n,
100
- item: r
101
- }) : m && (a === "multiSelect" || a === "enum") ? /* @__PURE__ */ t(H, {
98
+ iconColumnVariant: l,
99
+ item: n
100
+ }) : f && (a === "multiSelect" || a === "enum") ? /* @__PURE__ */ t(W, {
102
101
  column: e,
103
- item: r,
104
- onInlineEditChange: s
105
- }, `${e.id}-${r.id}`) : a === "multiSelect" ? /* @__PURE__ */ t(K, {
102
+ item: n,
103
+ onInlineEditChange: r
104
+ }, `${e.id}-${n.id}`) : a === "multiSelect" ? /* @__PURE__ */ t(A, {
106
105
  column: e,
107
- item: r
108
- }) : /* @__PURE__ */ t(k, {
106
+ item: n
107
+ }) : /* @__PURE__ */ t(F, {
109
108
  column: e,
110
- item: r
109
+ item: n
111
110
  });
112
- }), J = /* @__PURE__ */ h.memo(({
111
+ }), q = /* @__PURE__ */ m.memo(({
113
112
  item: e,
114
- zoomLevel: n
115
- }) => /* @__PURE__ */ t(f, {
113
+ zoomLevel: l
114
+ }) => /* @__PURE__ */ t(I, {
116
115
  style: {
117
- height: j[n]
116
+ height: D[l]
118
117
  },
119
- children: /* @__PURE__ */ t(b, {
120
- className: i.iconCell,
118
+ children: /* @__PURE__ */ t(E, {
119
+ className: c.iconCell,
121
120
  item: e
122
121
  })
123
- }, `item-type-icon-${e.id}`)), Q = /* @__PURE__ */ h.memo(({
122
+ }, `item-type-icon-${e.id}`)), J = /* @__PURE__ */ m.memo(({
124
123
  item: e,
125
- itemActionMenuProps: n,
126
- isCheckboxDisabled: r
127
- }) => /* @__PURE__ */ t(W, {
128
- isCheckboxDisabled: r,
129
- children: (s) => n ? /* @__PURE__ */ t(w, {
130
- ...n,
124
+ itemActionMenuProps: l,
125
+ isCheckboxDisabled: n
126
+ }) => /* @__PURE__ */ t(_, {
127
+ isCheckboxDisabled: n,
128
+ children: (r) => l ? /* @__PURE__ */ t(j, {
129
+ ...l,
131
130
  item: e,
132
- onOpenChange: s
131
+ onOpenChange: r
133
132
  }) : null
134
- })), le = ({
133
+ })), oe = ({
135
134
  areSelectionCheckboxesDisabled: e,
136
- columnCount: n,
137
- columns: r,
138
- iconColumnVariant: s,
139
- items: d,
140
- itemActionMenuProps: c,
141
- onInlineEditChange: m,
135
+ columnCount: l,
136
+ columns: n,
137
+ iconColumnVariant: r,
138
+ items: s,
139
+ itemActionMenuProps: d,
140
+ onInlineEditChange: f,
142
141
  onTableRowClick: a,
143
- shouldRenderActionColumn: N,
144
- virtualItems: I,
145
- totalVirtualSize: M,
146
- zoomLevel: x
142
+ shouldRenderActionColumn: u,
143
+ virtualItems: h,
144
+ totalVirtualSize: w,
145
+ zoomLevel: $
147
146
  }) => {
148
- const O = s === p.COLUMN;
149
- if (I) {
150
- const o = (l) => /* @__PURE__ */ t(A, {
151
- columnLength: n || 0,
152
- rowKey: `ghost-${l}`
153
- }), y = (l) => /* @__PURE__ */ t(G, {
147
+ const M = r === p.COLUMN;
148
+ if (h) {
149
+ const o = (i) => /* @__PURE__ */ t(k, {
150
+ columnLength: l || 0,
151
+ rowKey: `ghost-${i}`
152
+ }), N = (i) => /* @__PURE__ */ t(U, {
154
153
  areSelectionCheckboxesDisabled: e,
155
- columns: r,
156
- iconColumnVariant: s,
157
- item: l,
158
- itemActionMenuProps: c,
154
+ columns: n,
155
+ iconColumnVariant: r,
156
+ item: i,
157
+ itemActionMenuProps: d,
159
158
  onTableRowClick: a,
160
- shouldRenderActionColumn: N,
161
- zoomLevel: x
162
- }), _ = () => {
163
- const l = I[0];
164
- return (l == null ? void 0 : l.start) || 0;
165
- }, D = () => {
166
- const l = I[I.length - 1], U = (l == null ? void 0 : l.end) || 0;
167
- return Math.max((M || 0) - U, 0);
168
- }, T = _(), C = D();
169
- return /* @__PURE__ */ $(E, {
170
- children: [!!T && /* @__PURE__ */ t(u, {
159
+ shouldRenderActionColumn: u,
160
+ zoomLevel: $
161
+ }), O = () => h[0]?.start || 0, R = () => {
162
+ const V = h[h.length - 1]?.end || 0;
163
+ return Math.max((w || 0) - V, 0);
164
+ }, b = O(), g = R();
165
+ return /* @__PURE__ */ T(x, {
166
+ children: [!!b && /* @__PURE__ */ t(C, {
171
167
  isDisabled: !0,
172
168
  style: {
173
- height: `${T}px`
169
+ height: `${b}px`
174
170
  }
175
- }), I.map(({
176
- index: l
177
- }) => l >= d.length ? o(l) : y(d[l])), !!C && /* @__PURE__ */ t(u, {
171
+ }), h.map(({
172
+ index: i
173
+ }) => i >= s.length ? o(i) : N(s[i])), !!g && /* @__PURE__ */ t(C, {
178
174
  isDisabled: !0,
179
175
  style: {
180
- height: `${C}px`
176
+ height: `${g}px`
181
177
  }
182
178
  })]
183
179
  });
184
180
  }
185
- return /* @__PURE__ */ t(E, {
186
- items: d.map((o) => ({
181
+ return /* @__PURE__ */ t(x, {
182
+ items: s.map((o) => ({
187
183
  key: o.id,
188
184
  ...o
189
185
  })),
190
- children: (o) => /* @__PURE__ */ $(u, {
191
- className: L(i.tableRow, {
192
- [i.isClickable]: a
186
+ children: (o) => /* @__PURE__ */ T(C, {
187
+ className: L(c.tableRow, {
188
+ [c.isClickable]: a
193
189
  }),
194
190
  id: o.id,
195
- onAction: () => a == null ? void 0 : a(o),
196
- children: [O && /* @__PURE__ */ t(J, {
191
+ onAction: () => a?.(o),
192
+ children: [M && /* @__PURE__ */ t(q, {
197
193
  item: o,
198
- zoomLevel: x
199
- }), r.map((y) => /* @__PURE__ */ t(q, {
200
- column: y,
201
- iconColumnVariant: s,
194
+ zoomLevel: $
195
+ }), n.map((N) => /* @__PURE__ */ t(K, {
196
+ column: N,
197
+ iconColumnVariant: r,
202
198
  item: o,
203
- onInlineEditChange: m
204
- }, `${y.textValue}-${o.id}`)), N && /* @__PURE__ */ t(Q, {
199
+ onInlineEditChange: f
200
+ }, `${N.textValue}-${o.id}`)), u && /* @__PURE__ */ t(J, {
205
201
  isCheckboxDisabled: e,
206
202
  item: o,
207
- itemActionMenuProps: c
203
+ itemActionMenuProps: d
208
204
  })]
209
205
  }, o.id)
210
206
  });
211
207
  };
212
208
  export {
213
- le as default
209
+ oe as default
214
210
  };
@@ -4,53 +4,53 @@ import { GhostTableBody as j } from "./table-body/ghost-table-body.js";
4
4
  import y from "./table-body/table-body-with-data.js";
5
5
  import { getShouldRenderActionColumn as A } from "./actionColumn.js";
6
6
  import G from "./messages.js";
7
- import { jsxs as V, jsx as c } from "react/jsx-runtime";
8
- const W = ({
9
- columnCount: s,
10
- columns: e,
11
- formatMessage: u,
12
- iconColumnVariant: t,
13
- isLoading: r,
14
- areSelectionCheckboxesDisabled: h,
15
- itemActionMenuProps: C,
16
- items: f,
17
- onInlineEditChange: g,
18
- onTableRowClick: d,
19
- style: p,
20
- tableHeader: a,
21
- tableProps: l,
22
- virtualItems: o,
7
+ import { jsxs as V, jsx as s } from "react/jsx-runtime";
8
+ const U = ({
9
+ columnCount: u,
10
+ columns: t,
11
+ formatMessage: c,
12
+ iconColumnVariant: e,
13
+ isLoading: n,
14
+ areSelectionCheckboxesDisabled: a,
15
+ itemActionMenuProps: h,
16
+ items: C,
17
+ onInlineEditChange: f,
18
+ onTableRowClick: g,
19
+ style: d,
20
+ tableHeader: p,
21
+ tableProps: r,
22
+ virtualItems: l,
23
23
  totalVirtualSize: b,
24
24
  zoomLevel: T
25
25
  }) => {
26
- const m = A(l), i = s || (() => {
27
- let n = e.length;
28
- return t === R.COLUMN && (n += 1), m && (n += 1), n;
29
- })(), x = r && !(o != null && o.length);
26
+ const m = A(r), i = u || (() => {
27
+ let o = t.length;
28
+ return e === R.COLUMN && (o += 1), m && (o += 1), o;
29
+ })(), x = n && !l?.length;
30
30
  return /* @__PURE__ */ V(B, {
31
- "aria-label": u(G.listView),
31
+ "aria-label": c(G.listView),
32
32
  selectionBehavior: "toggle",
33
- style: p,
34
- ...l,
35
- children: [a, x ? /* @__PURE__ */ c(j, {
33
+ style: d,
34
+ ...r,
35
+ children: [p, x ? /* @__PURE__ */ s(j, {
36
36
  columnLength: i
37
- }) : /* @__PURE__ */ c(y, {
38
- areSelectionCheckboxesDisabled: h,
37
+ }) : /* @__PURE__ */ s(y, {
38
+ areSelectionCheckboxesDisabled: a,
39
39
  columnCount: i,
40
- columns: e,
41
- iconColumnVariant: t,
42
- isLoading: r,
43
- itemActionMenuProps: C,
44
- items: f,
45
- onInlineEditChange: g,
46
- onTableRowClick: d,
40
+ columns: t,
41
+ iconColumnVariant: e,
42
+ isLoading: n,
43
+ itemActionMenuProps: h,
44
+ items: C,
45
+ onInlineEditChange: f,
46
+ onTableRowClick: g,
47
47
  shouldRenderActionColumn: m,
48
48
  totalVirtualSize: b,
49
- virtualItems: o,
49
+ virtualItems: l,
50
50
  zoomLevel: T
51
51
  })]
52
52
  });
53
53
  };
54
54
  export {
55
- W as TableRenderer
55
+ U as TableRenderer
56
56
  };
@@ -1,30 +1,29 @@
1
- import { useFormikContext as C } from "formik";
2
- import { Checkbox as c } from "@box/blueprint-web";
3
- import { jsx as m } from "react/jsx-runtime";
4
- const b = ({
1
+ import { useFormikContext as u } from "formik";
2
+ import { Checkbox as n } from "@box/blueprint-web";
3
+ import { jsx as s } from "react/jsx-runtime";
4
+ const p = ({
5
5
  id: a,
6
- name: i
6
+ name: r
7
7
  }) => {
8
- var n, s, r;
9
8
  const {
10
9
  values: d,
11
- setFieldValue: u
12
- } = C(), h = ((n = d.metadata.fields[a]) == null ? void 0 : n.options) || [], l = ((r = (s = d.metadata.fields[a]) == null ? void 0 : s.value) == null ? void 0 : r.enum) || [], f = (e, o) => {
10
+ setFieldValue: c
11
+ } = u(), m = d.metadata.fields[a]?.options || [], l = d.metadata.fields[a]?.value?.enum || [], i = (e, o) => {
13
12
  const t = new Set(l);
14
- o ? t.add(e) : t.delete(e), u(`metadata.fields.${a}.value.enum`, Array.from(t));
13
+ o ? t.add(e) : t.delete(e), c(`metadata.fields.${a}.value.enum`, Array.from(t));
15
14
  };
16
- return /* @__PURE__ */ m(c.Legend, {
17
- header: i,
18
- children: h.map(({
15
+ return /* @__PURE__ */ s(n.Legend, {
16
+ header: r,
17
+ children: m.map(({
19
18
  key: e
20
19
  }) => {
21
20
  const o = l.includes(e);
22
- return /* @__PURE__ */ m(c.Item, {
21
+ return /* @__PURE__ */ s(n.Item, {
23
22
  checked: o,
24
23
  "data-target-id": `CheckboxItem-filter_${a}_${e}`,
25
24
  label: e,
26
25
  onCheckedChange: (t) => {
27
- f(e, t === !0);
26
+ i(e, t === !0);
28
27
  },
29
28
  value: e
30
29
  }, e);
@@ -32,5 +31,5 @@ const b = ({
32
31
  });
33
32
  };
34
33
  export {
35
- b as MetadataCheckboxField
34
+ p as MetadataCheckboxField
36
35
  };
@@ -1,24 +1,23 @@
1
- import { BoxItemTypeSelectorQuickFilter as u } from "@box/box-item-type-selector";
2
- import { useFormikContext as s } from "formik";
3
- import { jsx as p } from "react/jsx-runtime";
4
- const f = ({
1
+ import { BoxItemTypeSelectorQuickFilter as i } from "@box/box-item-type-selector";
2
+ import { useFormikContext as r } from "formik";
3
+ import { jsx as u } from "react/jsx-runtime";
4
+ const c = ({
5
5
  id: e
6
6
  }) => {
7
- var t, l;
8
7
  const {
9
- values: o,
10
- setFieldValue: a,
11
- submitForm: m
12
- } = s(), i = (l = (t = o.metadata.fields[e]) == null ? void 0 : t.value) == null ? void 0 : l.enum;
13
- return /* @__PURE__ */ p(u, {
8
+ values: t,
9
+ setFieldValue: l,
10
+ submitForm: o
11
+ } = r(), a = t.metadata.fields[e]?.value?.enum;
12
+ return /* @__PURE__ */ u(i, {
14
13
  allowAllOptionsSelect: !0,
15
14
  applyButtonType: "submit",
16
- onApply: (r) => {
17
- a(`metadata.fields.${e}.value.enum`, r), m();
15
+ onApply: (m) => {
16
+ l(`metadata.fields.${e}.value.enum`, m), o();
18
17
  },
19
- selected: i || []
18
+ selected: a || []
20
19
  });
21
20
  };
22
21
  export {
23
- f as MetadataFileChip
22
+ c as MetadataFileChip
24
23
  };
@@ -1,21 +1,20 @@
1
- import { BoxItemTypeSelector as i } from "@box/box-item-type-selector";
2
- import { useFormikContext as n } from "formik";
3
- import { jsx as s } from "react/jsx-runtime";
4
- const f = ({
1
+ import { BoxItemTypeSelector as m } from "@box/box-item-type-selector";
2
+ import { useFormikContext as r } from "formik";
3
+ import { jsx as i } from "react/jsx-runtime";
4
+ const d = ({
5
5
  id: e
6
6
  }) => {
7
- var t, o;
8
7
  const {
9
- values: a,
10
- setFieldValue: l
11
- } = n(), m = (o = (t = a.metadata.fields[e]) == null ? void 0 : t.value) == null ? void 0 : o.enum;
12
- return /* @__PURE__ */ s(i, {
13
- onSelectionChange: (r) => {
14
- l(`metadata.fields.${e}.value.enum`, r);
8
+ values: t,
9
+ setFieldValue: o
10
+ } = r(), a = t.metadata.fields[e]?.value?.enum;
11
+ return /* @__PURE__ */ i(m, {
12
+ onSelectionChange: (l) => {
13
+ o(`metadata.fields.${e}.value.enum`, l);
15
14
  },
16
- selected: m || []
15
+ selected: a || []
17
16
  });
18
17
  };
19
18
  export {
20
- f as MetadataFileField
19
+ d as MetadataFileField
21
20
  };
@@ -1,45 +1,44 @@
1
- import { ContentField as f } from "@box/blueprint-web";
2
- import { useFormikContext as u } from "formik";
3
- import p from "lodash/noop";
4
- import { useIntl as C } from "react-intl";
5
- import h from "./messages.js";
1
+ import { ContentField as u } from "@box/blueprint-web";
2
+ import { useFormikContext as F } from "formik";
3
+ import g from "lodash/noop";
4
+ import { useIntl as p } from "react-intl";
5
+ import C from "./messages.js";
6
6
  import { jsx as i } from "react/jsx-runtime";
7
- import '../../../../styles/metadata-location-field.css';const v = "_metadataLocationFieldTrigger_1d3ch_1", L = {
8
- metadataLocationFieldTrigger: v
9
- }, N = ({
7
+ import '../../../../styles/metadata-location-field.css';const h = "_metadataLocationFieldTrigger_1d3ch_1", v = {
8
+ metadataLocationFieldTrigger: h
9
+ }, M = ({
10
10
  id: e,
11
- triggerSetValueCallback: n = p,
12
- renderer: l = (a) => a
11
+ triggerSetValueCallback: l = g,
12
+ renderer: r = (t) => t
13
13
  }) => {
14
- var r;
15
14
  const {
16
- formatMessage: a
17
- } = C(), {
18
- values: s,
19
- setFieldValue: o
20
- } = u(), t = (r = s.metadata.fields[e].value.enum) == null ? void 0 : r[0], m = () => {
21
- o(`metadata.fields.${e}.value.enum`, []);
22
- }, d = () => {
23
- n((c, F, g = !1) => {
24
- o(`metadata.fields.${e}.value.enum[0]`, {
25
- folderId: c,
26
- folderName: F,
27
- isFolderShared: g
15
+ formatMessage: t
16
+ } = p(), {
17
+ values: n,
18
+ setFieldValue: a
19
+ } = F(), o = n.metadata.fields[e].value.enum?.[0], d = () => {
20
+ a(`metadata.fields.${e}.value.enum`, []);
21
+ }, s = () => {
22
+ l((m, c, f = !1) => {
23
+ a(`metadata.fields.${e}.value.enum[0]`, {
24
+ folderId: m,
25
+ folderName: c,
26
+ isFolderShared: f
28
27
  });
29
28
  });
30
29
  };
31
- return l(/* @__PURE__ */ i("div", {
32
- className: L.metadataLocationFieldTrigger,
33
- children: /* @__PURE__ */ i(f, {
30
+ return r(/* @__PURE__ */ i("div", {
31
+ className: v.metadataLocationFieldTrigger,
32
+ children: /* @__PURE__ */ i(u, {
34
33
  "data-target-id": `ContentField-filter_${e}`,
35
- hintText: a(h.selectFolderHint),
36
- isSharedFolder: t == null ? void 0 : t.isFolderShared,
37
- onClick: d,
38
- onClickClearButton: m,
39
- title: t == null ? void 0 : t.folderName
34
+ hintText: t(C.selectFolderHint),
35
+ isSharedFolder: o?.isFolderShared,
36
+ onClick: s,
37
+ onClickClearButton: d,
38
+ title: o?.folderName
40
39
  })
41
40
  }));
42
41
  };
43
42
  export {
44
- N as MetadataLocationField
43
+ M as MetadataLocationField
45
44
  };