@box/metadata-view 0.35.3 → 0.36.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.
@@ -2,11 +2,11 @@ import { Button as B } from "@box/blueprint-web";
2
2
  import { Grid as p } from "@box/blueprint-web-assets/icons/Fill";
3
3
  import { useIntl as u } from "react-intl";
4
4
  import { V as r } from "../../../../chunks/types.js";
5
- import { SortDropdown as R } from "./sort-dropdown.js";
6
- import { ZoomButton as v } from "./zoom-button.js";
5
+ import { ZoomButton as R } from "./zoom-button.js";
7
6
  import s from "./messages.js";
8
7
  import { jsxs as e, jsx as o } from "react/jsx-runtime";
9
- import { FilterRow as h } from "../filter-row/filter-row.js";
8
+ import { FilterRow as v } from "../filter-row/filter-row.js";
9
+ import { SortDropdown as h } from "../sort-dropdown/sort-dropdown.js";
10
10
  import '../../../../styles/action-bar.css';const b = "_actionBar_dsa2b_1", A = "_filterRow_dsa2b_8", C = "_additionalActions_dsa2b_13", G = "_viewModeButtonContainer_dsa2b_24", t = {
11
11
  actionBar: b,
12
12
  filterRow: A,
@@ -30,15 +30,15 @@ import '../../../../styles/action-bar.css';const b = "_actionBar_dsa2b_1", A = "
30
30
  className: t.actionBar,
31
31
  children: [/* @__PURE__ */ o("div", {
32
32
  className: t.filterRow,
33
- children: /* @__PURE__ */ o(h, {
33
+ children: /* @__PURE__ */ o(v, {
34
34
  ..._
35
35
  })
36
36
  }), /* @__PURE__ */ e("div", {
37
37
  className: t.additionalActions,
38
- children: [a && /* @__PURE__ */ o(R, {
38
+ children: [a && /* @__PURE__ */ o(h, {
39
39
  ...a,
40
40
  sortableColumnNames: f
41
- }), (c || i === r.GRID) && /* @__PURE__ */ o(v, {
41
+ }), (c || i === r.GRID) && /* @__PURE__ */ o(R, {
42
42
  onZoomLevelChange: l,
43
43
  zoomLevel: w
44
44
  }), !d && /* @__PURE__ */ o("div", {
@@ -0,0 +1,4 @@
1
+ import { SortDropdown as p } from "./sort-dropdown.js";
2
+ export {
3
+ p as SortDropdown
4
+ };
@@ -0,0 +1,40 @@
1
+ import { DropdownMenu as r, TriggerButton as D } from "@box/blueprint-web";
2
+ import { ArrowUp as f, ArrowDown as l } from "@box/blueprint-web-assets/icons/Fill";
3
+ import { useState as s } from "react";
4
+ import { jsxs as u, jsx as i } from "react/jsx-runtime";
5
+ const S = ({
6
+ sortableColumnNames: t,
7
+ initialSortByColumn: g = t[0],
8
+ initialSortDirection: p = "ascending",
9
+ onSortChange: c
10
+ }) => {
11
+ const [o, a] = s(p), [e, h] = s(g), w = (n) => {
12
+ if (n === e) {
13
+ const d = o === "ascending" ? "descending" : "ascending";
14
+ a(d), c(n, d);
15
+ } else
16
+ h(n), a("ascending"), c(n, "ascending");
17
+ };
18
+ return /* @__PURE__ */ u(r.Root, {
19
+ children: [/* @__PURE__ */ i(r.Trigger, {
20
+ children: /* @__PURE__ */ i(D, {
21
+ caretDirection: o === "ascending" ? "up" : "down",
22
+ label: e,
23
+ startIcon: o === "ascending" ? f : l,
24
+ variant: "tertiary"
25
+ })
26
+ }), /* @__PURE__ */ i(r.Content, {
27
+ children: /* @__PURE__ */ i(r.RadioGroup, {
28
+ onValueChange: w,
29
+ value: e,
30
+ children: t.map((n) => /* @__PURE__ */ i(r.RadioSelectItem, {
31
+ value: n,
32
+ children: n
33
+ }, n))
34
+ })
35
+ })]
36
+ });
37
+ };
38
+ export {
39
+ S as SortDropdown
40
+ };
@@ -1,6 +1,6 @@
1
1
  import { ViewMode } from '../../types';
2
2
  import { FilterRowProps } from '../filter-row';
3
- import { SortDropdownProps } from './sort-dropdown';
3
+ import { SortDropdownProps } from '../sort-dropdown';
4
4
  import { FilterGroup } from '../filter-row/types';
5
5
  export interface ActionBarProps extends Omit<FilterRowProps, 'filterGroups'> {
6
6
  filterGroups?: FilterGroup[];
@@ -8,10 +8,12 @@ export interface ActionBarProps extends Omit<FilterRowProps, 'filterGroups'> {
8
8
  isViewModeButtonDisabled?: boolean;
9
9
  onViewModeClick?: () => void;
10
10
  onZoomLevelChange?: (zoomLevel: number) => void;
11
- sortableColumnNames: string[];
12
11
  sortDropdownProps?: SortDropdownProps;
13
12
  viewMode?: ViewMode;
14
13
  zoomLevel?: number;
15
14
  }
16
- export declare const ActionBar: ({ isIconColumnEnabled, isViewModeButtonDisabled, onViewModeClick, onZoomLevelChange, sortableColumnNames, sortDropdownProps, viewMode, zoomLevel, ...rest }: ActionBarProps) => import("react/jsx-runtime").JSX.Element;
15
+ interface ActionBarInternalProps extends ActionBarProps {
16
+ sortableColumnNames: string[];
17
+ }
18
+ export declare const ActionBar: ({ isIconColumnEnabled, isViewModeButtonDisabled, onViewModeClick, onZoomLevelChange, sortableColumnNames, sortDropdownProps, viewMode, zoomLevel, ...rest }: ActionBarInternalProps) => import("react/jsx-runtime").JSX.Element;
17
19
  export default ActionBar;
@@ -0,0 +1 @@
1
+ export * from './sort-dropdown';
@@ -0,0 +1,11 @@
1
+ import { SortDirection } from 'react-aria-components';
2
+ export interface SortDropdownProps {
3
+ initialSortByColumn?: string;
4
+ initialSortDirection?: SortDirection;
5
+ onSortChange: (sortByColumn: string, sortDirection: SortDirection) => void;
6
+ }
7
+ interface SortDropdownInternalProps extends SortDropdownProps {
8
+ sortableColumnNames: string[];
9
+ }
10
+ export declare const SortDropdown: ({ sortableColumnNames, initialSortByColumn, initialSortDirection, onSortChange, }: SortDropdownInternalProps) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -3,7 +3,7 @@ import { PaginationProps } from './components/pagination/pagination';
3
3
  import { ActionBarProps } from './components/action-bar';
4
4
  import { ViewMode, Column, MetadataProps } from './types';
5
5
  export interface MetadataViewProps extends MetadataProps {
6
- actionBarProps?: Omit<ActionBarProps, 'onViewModeClick' | 'onZoomLevelChange' | 'viewMode' | 'sortableColumnNames'>;
6
+ actionBarProps?: Omit<ActionBarProps, 'onViewModeClick' | 'onZoomLevelChange' | 'viewMode'>;
7
7
  columns: Column[];
8
8
  hasError?: boolean;
9
9
  initialViewMode?: ViewMode;
@@ -1,12 +1,12 @@
1
1
  import { Item } from '@box/types';
2
2
  import { SortDirection } from 'react-aria-components';
3
3
  import { ActionBarProps } from '../components/action-bar/action-bar';
4
- import { SortDropdownProps } from '../components/action-bar/sort-dropdown';
5
4
  import { FilterRowProps } from '../components/filter-row/filter-row';
6
5
  import { FilterGroup, FilterOption } from '../components/filter-row/types';
7
6
  import { ItemActionMenuProps } from '../components/item-action-menu/item-action-menu';
8
7
  import { MetadataTableProps } from '../components/metadata-table';
9
8
  import { PaginationProps } from '../components/pagination/pagination';
9
+ import { SortDropdownProps } from '../components/sort-dropdown/sort-dropdown';
10
10
  import { MetadataViewProps } from '../metadata-view';
11
11
  import { Column } from '../types';
12
12
  export declare const getMockFilterGroups: (filters: FilterOption[]) => Array<FilterGroup>;
@@ -18,6 +18,8 @@ export declare const mockFilterOptionsNoSelection: FilterOption[];
18
18
  export declare const mockFilterOptionsWithCustomFilterChips: FilterOption[];
19
19
  export declare const mockFilterOptionsWithoutAlias: FilterOption[];
20
20
  export declare const mockFilterGroupsWithoutAlias: FilterGroup[];
21
+ export declare const mockFilterOptionsWithoutName: FilterOption[];
22
+ export declare const mockFilterGroupsWithoutName: FilterGroup[];
21
23
  export declare const mockFilterOptionsWithInvalidType: FilterOption[];
22
24
  export declare const mockFilterOptionsWithSomeChipsHidden: FilterOption[];
23
25
  export declare const mockMetadata: Item[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-view",
3
- "version": "0.35.3",
3
+ "version": "0.36.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.63.0",
23
- "@box/box-item-type-selector": "^0.63.2",
23
+ "@box/box-item-type-selector": "^0.63.4",
24
24
  "@box/eslint-plugin-blueprint": "*",
25
- "@box/item-icon": "^0.17.5",
26
- "@box/metadata-filter": "^1.18.2",
25
+ "@box/item-icon": "^0.17.7",
26
+ "@box/metadata-filter": "^1.18.4",
27
27
  "@box/storybook-utils": "0.13.18",
28
28
  "@box/types": "0.2.1",
29
29
  "@tanstack/react-virtual": "^3.10.8",
@@ -1,40 +0,0 @@
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
10
- }) => {
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, {
19
- children: [/* @__PURE__ */ o(r.Trigger, {
20
- children: /* @__PURE__ */ o(w, {
21
- caretDirection: i === "ascending" ? "up" : "down",
22
- label: e,
23
- startIcon: i === "ascending" ? u : D,
24
- variant: "tertiary"
25
- })
26
- }), /* @__PURE__ */ o(r.Content, {
27
- children: /* @__PURE__ */ o(r.RadioGroup, {
28
- onValueChange: l,
29
- value: e,
30
- children: p.map((n) => /* @__PURE__ */ o(r.RadioSelectItem, {
31
- value: n,
32
- children: n
33
- }, n))
34
- })
35
- })]
36
- });
37
- };
38
- export {
39
- S as SortDropdown
40
- };
@@ -1,8 +0,0 @@
1
- import { SortDirection } from 'react-aria-components';
2
- export interface SortDropdownProps {
3
- initialSortByColumn: string;
4
- initialSortDirection: SortDirection;
5
- onSortChange: (sortByColumn: string, sortDirection: SortDirection) => void;
6
- sortableColumnNames: string[];
7
- }
8
- export declare const SortDropdown: ({ initialSortByColumn, initialSortDirection, onSortChange, sortableColumnNames, }: SortDropdownProps) => import("react/jsx-runtime").JSX.Element;