@box/metadata-view 1.58.2 → 1.59.1

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.
@@ -12,33 +12,37 @@ import '../styles/action-bar.css';var u = {
12
12
  filterRow: "_filterRow_bbxsv_8",
13
13
  additionalActions: "_additionalActions_bbxsv_13",
14
14
  viewModeButtonContainer: "_viewModeButtonContainer_bbxsv_24"
15
- }, d = ({ isIconColumnEnabled: d, isViewModeButtonDisabled: f, onSortDescriptorChange: p, onViewModeClick: m, onZoomLevelChange: h, sortableColumns: g, sortDescriptor: _, sortDropdownProps: v, viewMode: y, zoomLevel: b, ...x }) => {
16
- let { formatMessage: S } = s();
15
+ }, d = ({ dataTargetPrefix: d, isIconColumnEnabled: f, isViewModeButtonDisabled: p, onSortDescriptorChange: m, onViewModeClick: h, onZoomLevelChange: g, sortableColumns: _, sortDescriptor: v, sortDropdownProps: y, viewMode: b, zoomLevel: x, ...S }) => {
16
+ let { formatMessage: C } = s(), w = y?.triggerButtonDataTargetId ?? (d ? `${d}-sortButton` : void 0);
17
17
  return /* @__PURE__ */ l("div", {
18
18
  className: u.actionBar,
19
19
  children: [/* @__PURE__ */ c("div", {
20
20
  className: u.filterRow,
21
- children: /* @__PURE__ */ c(t, { ...x })
21
+ children: /* @__PURE__ */ c(t, {
22
+ ...S,
23
+ dataTargetPrefix: d
24
+ })
22
25
  }), /* @__PURE__ */ l("div", {
23
26
  className: u.additionalActions,
24
27
  children: [
25
- v && /* @__PURE__ */ c(n, {
26
- ...v,
27
- onSortDescriptorChange: p,
28
- sortableColumns: g,
29
- sortDescriptor: _
28
+ y && /* @__PURE__ */ c(n, {
29
+ ...y,
30
+ onSortDescriptorChange: m,
31
+ sortableColumns: _,
32
+ sortDescriptor: v,
33
+ triggerButtonDataTargetId: w
30
34
  }),
31
- (d || y === e.GRID) && /* @__PURE__ */ c(r, {
32
- onZoomLevelChange: h,
33
- zoomLevel: b
35
+ (f || b === e.GRID) && /* @__PURE__ */ c(r, {
36
+ onZoomLevelChange: g,
37
+ zoomLevel: x
34
38
  }),
35
- !f && /* @__PURE__ */ c("div", {
39
+ !p && /* @__PURE__ */ c("div", {
36
40
  className: u.viewModeButtonContainer,
37
41
  children: /* @__PURE__ */ c(a, {
38
- "aria-label": y === e.GRID ? S(i.switchToListView) : S(i.switchToGridView),
42
+ "aria-label": b === e.GRID ? C(i.switchToListView) : C(i.switchToGridView),
39
43
  endIcon: o,
40
- onClick: m,
41
- variant: y === e.GRID ? "primary" : "tertiary"
44
+ onClick: h,
45
+ variant: b === e.GRID ? "primary" : "tertiary"
42
46
  })
43
47
  })
44
48
  ]
@@ -2,33 +2,34 @@ import { DropdownMenu as e, TriggerButton as t } from "@box/blueprint-web";
2
2
  import { useState as n } from "react";
3
3
  import { ArrowDown as r, ArrowUp as i } from "@box/blueprint-web-assets/icons/Fill";
4
4
  import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
- var s = ({ onSortDescriptorChange: s, sortableColumns: c, sortDescriptor: l, initialSortByColumnId: u = c[0].id, initialSortDirection: d = "ascending", onSortChange: f }) => {
6
- let p = new Map(c.map((e) => [e.id, e.textValue])), [m, h] = n(u), [g, _] = n(d), v = l?.column == null ? m : String(l.column), y = l?.direction ?? g;
5
+ var s = ({ onSortDescriptorChange: s, sortableColumns: c, sortDescriptor: l, initialSortByColumnId: u = c[0].id, initialSortDirection: d = "ascending", triggerButtonDataTargetId: f, onSortChange: p }) => {
6
+ let m = new Map(c.map((e) => [e.id, e.textValue])), [h, g] = n(u), [_, v] = n(d), y = l?.column == null ? h : String(l.column), b = l?.direction ?? _;
7
7
  return /* @__PURE__ */ o(e.Root, { children: [/* @__PURE__ */ a(e.Trigger, { children: /* @__PURE__ */ a(t, {
8
- caretDirection: y === "ascending" ? "up" : "down",
9
- label: p.get(v),
10
- startIcon: y === "ascending" ? i : r,
8
+ caretDirection: b === "ascending" ? "up" : "down",
9
+ "data-target-id": f,
10
+ label: m.get(y),
11
+ startIcon: b === "ascending" ? i : r,
11
12
  variant: "tertiary"
12
13
  }) }), /* @__PURE__ */ a(e.Content, { children: /* @__PURE__ */ a(e.RadioGroup, {
13
14
  onValueChange: (e) => {
14
- if (e === v) {
15
- let t = y === "ascending" ? "descending" : "ascending";
16
- _(t), s({
15
+ if (e === y) {
16
+ let t = b === "ascending" ? "descending" : "ascending";
17
+ v(t), s({
17
18
  column: e,
18
19
  direction: t
19
- }), f({
20
+ }), p({
20
21
  column: e,
21
22
  direction: t
22
23
  });
23
- } else h(e), _("ascending"), s({
24
+ } else g(e), v("ascending"), s({
24
25
  column: e,
25
26
  direction: "ascending"
26
- }), f({
27
+ }), p({
27
28
  column: e,
28
29
  direction: "ascending"
29
30
  });
30
31
  },
31
- value: v,
32
+ value: y,
32
33
  children: c.map(({ id: t, textValue: n }) => /* @__PURE__ */ a(e.RadioSelectItem, {
33
34
  value: t,
34
35
  children: n
@@ -18,5 +18,5 @@ interface ActionBarInternalProps extends ActionBarProps {
18
18
  sortableColumns: Column[];
19
19
  sortDescriptor: SortDescriptor;
20
20
  }
21
- export declare const ActionBar: ({ isIconColumnEnabled, isViewModeButtonDisabled, onSortDescriptorChange, onViewModeClick, onZoomLevelChange, sortableColumns, sortDescriptor, sortDropdownProps, viewMode, zoomLevel, ...rest }: ActionBarInternalProps) => import("react/jsx-runtime").JSX.Element;
21
+ export declare const ActionBar: ({ dataTargetPrefix, isIconColumnEnabled, isViewModeButtonDisabled, onSortDescriptorChange, onViewModeClick, onZoomLevelChange, sortableColumns, sortDescriptor, sortDropdownProps, viewMode, zoomLevel, ...rest }: ActionBarInternalProps) => import("react/jsx-runtime").JSX.Element;
22
22
  export {};
@@ -3,6 +3,7 @@ import { Column } from '../../types';
3
3
  export interface SortDropdownProps {
4
4
  initialSortByColumnId?: string;
5
5
  initialSortDirection?: SortDirection;
6
+ triggerButtonDataTargetId?: string;
6
7
  onSortChange: (sortDescriptor: SortDescriptor) => void;
7
8
  }
8
9
  interface SortDropdownInternalProps extends SortDropdownProps {
@@ -10,5 +11,5 @@ interface SortDropdownInternalProps extends SortDropdownProps {
10
11
  sortableColumns: Column[];
11
12
  sortDescriptor: SortDescriptor;
12
13
  }
13
- export declare const SortDropdown: ({ onSortDescriptorChange, sortableColumns, sortDescriptor, initialSortByColumnId, initialSortDirection, onSortChange, }: SortDropdownInternalProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const SortDropdown: ({ onSortDescriptorChange, sortableColumns, sortDescriptor, initialSortByColumnId, initialSortDirection, triggerButtonDataTargetId, onSortChange, }: SortDropdownInternalProps) => import("react/jsx-runtime").JSX.Element;
14
15
  export {};
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@box/metadata-view",
3
- "version": "1.58.2",
3
+ "version": "1.59.1",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
- "@box/blueprint-web": "^14.31.0",
7
- "@box/blueprint-web-assets": "^4.118.3",
8
- "@box/box-item-type-selector": "^1.41.10",
9
- "@box/content-field": "^1.42.10",
10
- "@box/item-icon": "^2.35.10",
11
- "@box/metadata-filter": "^1.83.10",
12
- "@box/types": "2.2.1",
6
+ "@box/blueprint-web": "^14.31.1",
7
+ "@box/blueprint-web-assets": "^4.118.4",
8
+ "@box/box-item-type-selector": "^1.41.11",
9
+ "@box/content-field": "^1.42.11",
10
+ "@box/item-icon": "^2.35.11",
11
+ "@box/metadata-filter": "^1.83.11",
12
+ "@box/types": "2.2.2",
13
13
  "@tanstack/react-virtual": "^3.10.8",
14
14
  "formik": "^2.4.5",
15
15
  "lodash": "^4.17.15",
@@ -19,15 +19,15 @@
19
19
  "react-intl": "^6.4.2"
20
20
  },
21
21
  "devDependencies": {
22
- "@box/blueprint-web": "^14.31.0",
23
- "@box/blueprint-web-assets": "^4.118.3",
24
- "@box/box-item-type-selector": "^1.41.10",
25
- "@box/content-field": "^1.42.10",
26
- "@box/eslint-plugin-blueprint": "1.2.1",
27
- "@box/item-icon": "^2.35.10",
28
- "@box/metadata-filter": "^1.83.10",
29
- "@box/storybook-utils": "0.19.7",
30
- "@box/types": "2.2.1",
22
+ "@box/blueprint-web": "^14.31.1",
23
+ "@box/blueprint-web-assets": "^4.118.4",
24
+ "@box/box-item-type-selector": "^1.41.11",
25
+ "@box/content-field": "^1.42.11",
26
+ "@box/eslint-plugin-blueprint": "1.2.2",
27
+ "@box/item-icon": "^2.35.11",
28
+ "@box/metadata-filter": "^1.83.11",
29
+ "@box/storybook-utils": "0.19.8",
30
+ "@box/types": "2.2.2",
31
31
  "@tanstack/react-virtual": "^3.10.8",
32
32
  "react-intl": "^6.4.2"
33
33
  },