@box/metadata-view 1.24.2 → 1.25.2

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,53 +1,58 @@
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";
1
+ import { FilterChip as h } from "@box/blueprint-web";
2
+ import { Formik as F, Form as C } from "formik";
3
+ import { useMemo as R, useRef as y } from "react";
4
+ import G from "./all-filters-chip.js";
5
+ import { getInitialFieldValues as j } from "./initial-field-values.js";
6
6
  import { MetadataFilterChip as x } from "./metadata-filter-chip.js";
7
- import { usePredefinedFilter as V } from "./predefinedFilters/use-predefined-filter.js";
7
+ import { usePredefinedFilter as M } from "./predefinedFilters/use-predefined-filter.js";
8
8
  import { s as b } from "../../../../chunks/filter-row.module.js";
9
- import { jsx as r, jsxs as j } from "react/jsx-runtime";
9
+ import { jsx as i, jsxs as w } from "react/jsx-runtime";
10
10
  import "./form-filter-chip.js";
11
11
  import "./select-filter-chip.js";
12
12
  import "./predefinedFilters/index.js";
13
- const q = ({
14
- predefinedFilterOptions: m,
13
+ const T = ({
14
+ predefinedFilterOptions: p,
15
15
  containerRef: s,
16
- filterGroups: p = [],
17
- initialFilterValues: a,
18
- isAllFiltersDisabled: n,
19
- onFilterSubmit: e
16
+ filterGroups: a = [],
17
+ initialFilterValues: t,
18
+ isAllFiltersDisabled: f,
19
+ onFilterSubmit: o
20
20
  }) => {
21
- const f = V(m), u = ({
21
+ const n = M(p), d = ({
22
22
  metadata: {
23
- fields: i
23
+ fields: e
24
24
  }
25
25
  }) => {
26
- e && e(i);
27
- }, t = [...f, ...p], o = t.flatMap(({
28
- filters: i
29
- }) => i), d = G(o, a), l = C(null);
30
- return /* @__PURE__ */ r(h, {
26
+ o && o(e);
27
+ }, l = [...n, ...a], r = l.flatMap(({
28
+ filters: e
29
+ }) => e), u = r.map((e) => `${e.id}:${e.fieldType}`).join("|"), c = R(
30
+ () => j(r, t),
31
+ // Intentionally depend on filterSchemaKey (not filterOptions identity) to prevent unwanted reinitialization
32
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- depend on schema key instead of filterOptions identity
33
+ [u, t]
34
+ ), m = y(null);
35
+ return /* @__PURE__ */ i(F, {
31
36
  enableReinitialize: !0,
32
- initialValues: d,
33
- onSubmit: u,
34
- children: /* @__PURE__ */ r(F, {
35
- ref: l,
36
- children: /* @__PURE__ */ j(c.Group, {
37
+ initialValues: c,
38
+ onSubmit: d,
39
+ children: /* @__PURE__ */ i(C, {
40
+ ref: m,
41
+ children: /* @__PURE__ */ w(h.Group, {
37
42
  className: b.filterChipGroup,
38
43
  name: "metadata-view-filters",
39
44
  type: "multiple",
40
- children: [n ? null : /* @__PURE__ */ r(R, {
45
+ children: [f ? null : /* @__PURE__ */ i(G, {
41
46
  containerRef: s,
42
- filterGroups: t
43
- }), o.filter((i) => i.shouldRenderChip).map((i) => /* @__PURE__ */ r(x, {
44
- filterOption: i,
45
- formRef: l
46
- }, i.id))]
47
+ filterGroups: l
48
+ }), r.filter((e) => e.shouldRenderChip).map((e) => /* @__PURE__ */ i(x, {
49
+ filterOption: e,
50
+ formRef: m
51
+ }, e.id))]
47
52
  })
48
53
  })
49
54
  });
50
55
  };
51
56
  export {
52
- q as FilterRow
57
+ T as FilterRow
53
58
  };
@@ -1,12 +1,12 @@
1
1
  import T, { useMemo as j } from "react";
2
2
  import { useIntl as y } from "react-intl";
3
- import { IconButton as f, Tooltip as z, DropdownMenu as a, GridList as h } from "@box/blueprint-web";
4
- import { Ellipsis as R } from "@box/blueprint-web-assets/icons/Fill";
5
- import { V as M } from "../../../../chunks/types.js";
6
- import { getDataTargetId as m } from "./identifier.js";
3
+ import { IconButton as I, Tooltip as z, DropdownMenu as r, GridList as f } from "@box/blueprint-web";
4
+ import { Ellipsis as W } from "@box/blueprint-web-assets/icons/Fill";
5
+ import { V as h } from "../../../../chunks/types.js";
6
+ import { getDataTargetId as l } from "./identifier.js";
7
7
  import $ from "./messages.js";
8
- import { jsxs as p, jsx as o } from "react/jsx-runtime";
9
- import '../../../../styles/item-action-menu.css';const G = "_tableActionBar_akgtp_1", V = "_actionItemIcon_akgtp_6", k = {
8
+ import { jsxs as i, jsx as n } from "react/jsx-runtime";
9
+ import '../../../../styles/item-action-menu.css';const G = "_tableActionBar_akgtp_1", V = "_actionItemIcon_akgtp_6", g = {
10
10
  tableActionBar: G,
11
11
  actionItemIcon: V
12
12
  };
@@ -18,109 +18,110 @@ function A(c) {
18
18
  function x({
19
19
  item: c,
20
20
  label: t,
21
- onClick: l,
22
- icon: r,
21
+ onClick: m,
22
+ icon: o,
23
23
  isDisabled: d
24
24
  }) {
25
- const i = A(() => {
26
- l(c);
27
- }), I = j(() => (d == null ? void 0 : d(c)) ?? !1, [d, c]);
28
- return /* @__PURE__ */ p(a.Item, {
29
- "data-target-id": m(a.Item, t),
30
- disabled: I,
31
- onClick: i,
32
- children: [/* @__PURE__ */ o(r, {
33
- className: k.actionItemIcon
25
+ const p = A(() => {
26
+ m(c);
27
+ }), s = j(() => (d == null ? void 0 : d(c)) ?? !1, [d, c]);
28
+ return /* @__PURE__ */ i(r.Item, {
29
+ "data-target-id": l(r.Item, t),
30
+ disabled: s,
31
+ onClick: p,
32
+ children: [/* @__PURE__ */ n(o, {
33
+ className: g.actionItemIcon
34
34
  }), t]
35
35
  }, t);
36
36
  }
37
- function K({
37
+ function O({
38
38
  actions: c,
39
39
  inlineActions: t,
40
- isDisabled: l,
41
- item: r,
40
+ isDisabled: m,
41
+ item: o,
42
42
  onOpenChange: d,
43
- subMenuActions: i,
44
- subMenuTrigger: I,
45
- viewMode: S = M.LIST
43
+ subMenuActions: p,
44
+ subMenuTrigger: s,
45
+ viewMode: b = h.LIST
46
46
  }) {
47
47
  const {
48
- formatMessage: s
48
+ formatMessage: k
49
49
  } = y(), {
50
50
  label: N,
51
51
  icon: _
52
- } = I || {};
53
- return /* @__PURE__ */ p("div", {
54
- className: k.tableActionBar,
55
- children: [S === M.LIST && (t == null ? void 0 : t.map(({
56
- onClick: n,
52
+ } = s || {};
53
+ return /* @__PURE__ */ i("div", {
54
+ className: g.tableActionBar,
55
+ children: [b === h.LIST && (t == null ? void 0 : t.map(({
56
+ onClick: a,
57
57
  label: e,
58
- icon: g,
58
+ icon: M,
59
59
  isDisabled: u,
60
60
  getTooltipContent: B
61
61
  }) => {
62
- const b = B == null ? void 0 : B(r), L = `${r.id}-${e}`, C = /* @__PURE__ */ o(f, {
62
+ const S = B == null ? void 0 : B(o), L = `${o.id}-${e}`, C = (u == null ? void 0 : u(o)) ?? !1, R = /* @__PURE__ */ n(I, {
63
+ accessibleWhenDisabled: C && !!S || void 0,
63
64
  "aria-label": e,
64
- "data-target-id": m(f, e),
65
- disabled: (u == null ? void 0 : u(r)) ?? !1,
66
- icon: g,
67
- onClick: A(() => n(r)),
65
+ "data-target-id": l(I, e),
66
+ disabled: C,
67
+ icon: M,
68
+ onClick: A(() => a(o)),
68
69
  size: "large"
69
70
  });
70
- return b ? /* @__PURE__ */ o(z, {
71
- content: b,
72
- children: C
73
- }, L) : /* @__PURE__ */ o(T.Fragment, {
74
- children: C
71
+ return S ? /* @__PURE__ */ n(z, {
72
+ content: S,
73
+ children: R
74
+ }, L) : /* @__PURE__ */ n(T.Fragment, {
75
+ children: R
75
76
  }, L);
76
- })), c ? /* @__PURE__ */ p(a.Root, {
77
+ })), c ? /* @__PURE__ */ i(r.Root, {
77
78
  onOpenChange: d,
78
- children: [/* @__PURE__ */ o(a.Trigger, {
79
- children: S === M.LIST ? /* @__PURE__ */ o(f, {
80
- "aria-label": s($.actionMenu),
81
- "data-target-id": m(f, "openActionMenu"),
82
- disabled: l,
83
- icon: R,
79
+ children: [/* @__PURE__ */ n(r.Trigger, {
80
+ children: b === h.LIST ? /* @__PURE__ */ n(I, {
81
+ "aria-label": k($.actionMenu),
82
+ "data-target-id": l(I, "openActionMenu"),
83
+ disabled: m,
84
+ icon: W,
84
85
  size: "large"
85
- }) : /* @__PURE__ */ o(h.ActionIconButton, {
86
- "aria-label": s($.actionMenu),
87
- "data-target-id": m(h.ActionIconButton, "openActionMenu"),
88
- disabled: l,
89
- icon: R
86
+ }) : /* @__PURE__ */ n(f.ActionIconButton, {
87
+ "aria-label": k($.actionMenu),
88
+ "data-target-id": l(f.ActionIconButton, "openActionMenu"),
89
+ disabled: m,
90
+ icon: W
90
91
  })
91
- }), /* @__PURE__ */ p(a.Content, {
92
+ }), /* @__PURE__ */ i(r.Content, {
92
93
  align: "start",
93
- children: [c.map((n) => /* @__PURE__ */ o(x, {
94
- item: r,
95
- ...n
96
- }, n.label)), i && I && /* @__PURE__ */ p(a.SubMenuRoot, {
97
- children: [/* @__PURE__ */ p(a.SubMenuTrigger, {
98
- "data-target-id": m(a.SubMenuTrigger, "openActionSubmenu"),
99
- children: [_ && /* @__PURE__ */ o(_, {
100
- className: k.actionItemIcon
94
+ children: [c.map((a) => /* @__PURE__ */ n(x, {
95
+ item: o,
96
+ ...a
97
+ }, a.label)), p && s && /* @__PURE__ */ i(r.SubMenuRoot, {
98
+ children: [/* @__PURE__ */ i(r.SubMenuTrigger, {
99
+ "data-target-id": l(r.SubMenuTrigger, "openActionSubmenu"),
100
+ children: [_ && /* @__PURE__ */ n(_, {
101
+ className: g.actionItemIcon
101
102
  }), N]
102
- }), /* @__PURE__ */ o(a.SubMenuContent, {
103
- children: i.map((n) => /* @__PURE__ */ o(x, {
104
- item: r,
105
- ...n
106
- }, n.label))
103
+ }), /* @__PURE__ */ n(r.SubMenuContent, {
104
+ children: p.map((a) => /* @__PURE__ */ n(x, {
105
+ item: o,
106
+ ...a
107
+ }, a.label))
107
108
  })]
108
109
  })]
109
110
  })]
110
- }) : null, S === M.GRID && (t == null ? void 0 : t.map(({
111
- onClick: n,
111
+ }) : null, b === h.GRID && (t == null ? void 0 : t.map(({
112
+ onClick: a,
112
113
  label: e,
113
- icon: g,
114
+ icon: M,
114
115
  isDisabled: u
115
- }) => /* @__PURE__ */ o(h.ActionIconButton, {
116
+ }) => /* @__PURE__ */ n(f.ActionIconButton, {
116
117
  "aria-label": e,
117
- "data-target-id": m(h.ActionIconButton, e),
118
- disabled: (u == null ? void 0 : u(r)) ?? !1,
119
- icon: g,
120
- onClick: () => n(r)
121
- }, `${r.id}-${e}`)))]
118
+ "data-target-id": l(f.ActionIconButton, e),
119
+ disabled: (u == null ? void 0 : u(o)) ?? !1,
120
+ icon: M,
121
+ onClick: () => a(o)
122
+ }, `${o.id}-${e}`)))]
122
123
  });
123
124
  }
124
125
  export {
125
- K as ItemActionMenu
126
+ O as ItemActionMenu
126
127
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-view",
3
- "version": "1.24.2",
3
+ "version": "1.25.2",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
6
  "@box/blueprint-web": "^12.76.2",
@@ -18,13 +18,13 @@
18
18
  "react-intl": "^6.4.2"
19
19
  },
20
20
  "devDependencies": {
21
- "@box/blueprint-web": "^12.103.0",
22
- "@box/blueprint-web-assets": "^4.85.0",
23
- "@box/box-item-type-selector": "^1.14.2",
21
+ "@box/blueprint-web": "^12.103.1",
22
+ "@box/blueprint-web-assets": "^4.86.0",
23
+ "@box/box-item-type-selector": "^1.14.3",
24
24
  "@box/eslint-plugin-blueprint": "1.0.5",
25
- "@box/item-icon": "^2.5.2",
26
- "@box/metadata-filter": "^1.52.2",
27
- "@box/storybook-utils": "0.14.22",
25
+ "@box/item-icon": "^2.5.3",
26
+ "@box/metadata-filter": "^1.52.3",
27
+ "@box/storybook-utils": "0.14.23",
28
28
  "@box/types": "2.0.0",
29
29
  "@tanstack/react-virtual": "^3.10.8",
30
30
  "react-intl": "^6.4.2"