@box/metadata-view 0.31.0 → 0.32.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.
@@ -1,33 +1,40 @@
1
- import { DropdownMenu as r, TriggerButton as p } from "@box/blueprint-web";
2
- import { ArrowUp as c, ArrowDown as l } from "@box/blueprint-web-assets/icons/Fill";
3
- import { jsxs as s, jsx as o } from "react/jsx-runtime";
4
- const w = ({
5
- onSortChange: i,
6
- sortableColumnNames: a,
7
- sortByColumn: e,
8
- sortDirection: d
1
+ import { DropdownMenu as r, TriggerButton as w } from "@box/blueprint-web";
2
+ import { ArrowUp as u, ArrowDown as D } from "@box/blueprint-web-assets/icons/Fill";
3
+ import { useState as d } from "react";
4
+ import { jsxs as f, jsx as o } from "react/jsx-runtime";
5
+ const S = ({
6
+ initialSortByColumn: s,
7
+ initialSortDirection: g,
8
+ onSortChange: t,
9
+ sortableColumnNames: p
9
10
  }) => {
10
- const n = d === "ascending" ? "up" : "down";
11
- return /* @__PURE__ */ s(r.Root, {
11
+ const [i, c] = d(g), [e, h] = d(s), l = (n) => {
12
+ if (n === e) {
13
+ const a = i === "ascending" ? "descending" : "ascending";
14
+ c(a), t(n, a);
15
+ } else
16
+ h(n), c("ascending"), t(n, "ascending");
17
+ };
18
+ return /* @__PURE__ */ f(r.Root, {
12
19
  children: [/* @__PURE__ */ o(r.Trigger, {
13
- children: /* @__PURE__ */ o(p, {
14
- caretDirection: n,
20
+ children: /* @__PURE__ */ o(w, {
21
+ caretDirection: i === "ascending" ? "up" : "down",
15
22
  label: e,
16
- startIcon: n === "up" ? c : l,
23
+ startIcon: i === "ascending" ? u : D,
17
24
  variant: "tertiary"
18
25
  })
19
26
  }), /* @__PURE__ */ o(r.Content, {
20
27
  children: /* @__PURE__ */ o(r.RadioGroup, {
21
- onValueChange: i,
28
+ onValueChange: l,
22
29
  value: e,
23
- children: a.map((t) => /* @__PURE__ */ o(r.RadioSelectItem, {
24
- value: t,
25
- children: t
26
- }, t))
30
+ children: p.map((n) => /* @__PURE__ */ o(r.RadioSelectItem, {
31
+ value: n,
32
+ children: n
33
+ }, n))
27
34
  })
28
35
  })]
29
36
  });
30
37
  };
31
38
  export {
32
- w as SortDropdown
39
+ S as SortDropdown
33
40
  };
@@ -1,8 +1,8 @@
1
1
  import { SortDirection } from 'react-aria-components';
2
2
  export interface SortDropdownProps {
3
- onSortChange: (sortByColumn: string) => void;
3
+ initialSortByColumn: string;
4
+ initialSortDirection: SortDirection;
5
+ onSortChange: (sortByColumn: string, sortDirection: SortDirection) => void;
4
6
  sortableColumnNames: string[];
5
- sortByColumn: string;
6
- sortDirection: SortDirection;
7
7
  }
8
- export declare const SortDropdown: ({ onSortChange, sortableColumnNames, sortByColumn, sortDirection }: SortDropdownProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const SortDropdown: ({ initialSortByColumn, initialSortDirection, onSortChange, sortableColumnNames, }: SortDropdownProps) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-view",
3
- "version": "0.31.0",
3
+ "version": "0.32.1",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
6
  "@box/blueprint-web": "^11.12.0",
@@ -20,10 +20,10 @@
20
20
  "devDependencies": {
21
21
  "@box/blueprint-web": "^11.12.0",
22
22
  "@box/blueprint-web-assets": "^4.62.0",
23
- "@box/box-item-type-selector": "^0.62.0",
23
+ "@box/box-item-type-selector": "^0.62.1",
24
24
  "@box/eslint-plugin-blueprint": "*",
25
- "@box/item-icon": "^0.17.0",
26
- "@box/metadata-filter": "^1.17.0",
25
+ "@box/item-icon": "^0.17.1",
26
+ "@box/metadata-filter": "^1.17.1",
27
27
  "@box/storybook-utils": "0.13.17",
28
28
  "@box/types": "0.2.1",
29
29
  "@tanstack/react-virtual": "^3.10.8",