@react-fabric/data 1.0.0-beta.0 → 1.0.0-beta.11

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 (83) hide show
  1. package/dist/cjs/checklist/CheckList.js +143 -0
  2. package/dist/cjs/histogram/Histogram.js +14 -5
  3. package/dist/cjs/hooks/useSelectableList.js +54 -0
  4. package/dist/cjs/index.js +2 -0
  5. package/dist/cjs/table/AddColumn.js +56 -0
  6. package/dist/cjs/table/BodyCell.js +47 -6
  7. package/dist/cjs/table/BodyRow.js +107 -0
  8. package/dist/cjs/table/CheckboxCell.js +44 -0
  9. package/dist/cjs/table/Context.js +43 -0
  10. package/dist/cjs/table/EmptyCell.js +52 -0
  11. package/dist/cjs/table/HeaderCell.js +78 -32
  12. package/dist/cjs/table/Table.js +173 -96
  13. package/dist/cjs/table/types.js +32 -0
  14. package/dist/cjs/table/useResizer.js +65 -0
  15. package/dist/cjs/table/useTableColumns.js +45 -8
  16. package/dist/cjs/table/useVirtualTable.js +56 -25
  17. package/dist/cjs/tree/TreePanel.js +14 -2
  18. package/dist/cjs/tree/useTree.js +7 -0
  19. package/dist/cjs/virtual/Gallery.js +11 -4
  20. package/dist/cjs/virtual/List.js +11 -4
  21. package/dist/esm/checklist/CheckList.js +143 -0
  22. package/dist/esm/histogram/Histogram.js +14 -5
  23. package/dist/esm/hooks/useSelectableList.js +54 -0
  24. package/dist/esm/index.js +1 -0
  25. package/dist/esm/table/AddColumn.js +56 -0
  26. package/dist/esm/table/BodyCell.js +47 -6
  27. package/dist/esm/table/BodyRow.js +107 -0
  28. package/dist/esm/table/CheckboxCell.js +44 -0
  29. package/dist/esm/table/Context.js +42 -0
  30. package/dist/esm/table/EmptyCell.js +52 -0
  31. package/dist/esm/table/HeaderCell.js +80 -34
  32. package/dist/esm/table/Table.js +174 -97
  33. package/dist/esm/table/types.js +30 -0
  34. package/dist/esm/table/useResizer.js +65 -0
  35. package/dist/esm/table/useTableColumns.js +46 -9
  36. package/dist/esm/table/useVirtualTable.js +57 -26
  37. package/dist/esm/tree/TreePanel.js +15 -3
  38. package/dist/esm/tree/useTree.js +7 -0
  39. package/dist/esm/virtual/Gallery.js +11 -4
  40. package/dist/esm/virtual/List.js +11 -4
  41. package/dist/types/checklist/CheckList.d.ts +30 -0
  42. package/dist/types/histogram/Histogram.d.ts +3 -3
  43. package/dist/types/hooks/useSelectableList.d.ts +28 -0
  44. package/dist/types/index.d.ts +3 -0
  45. package/dist/types/table/AddColumn.d.ts +5 -0
  46. package/dist/types/table/BodyCell.d.ts +4 -3
  47. package/dist/types/table/BodyRow.d.ts +20 -0
  48. package/dist/types/table/CheckboxCell.d.ts +4 -0
  49. package/dist/types/table/Context.d.ts +8 -0
  50. package/dist/types/table/EmptyCell.d.ts +2 -0
  51. package/dist/types/table/HeaderCell.d.ts +2 -2
  52. package/dist/types/table/Table.d.ts +1 -1
  53. package/dist/types/table/types.d.ts +41 -7
  54. package/dist/types/table/useResizer.d.ts +1 -0
  55. package/dist/types/table/useTableColumns.d.ts +8 -6
  56. package/dist/types/table/useVirtualTable.d.ts +13 -1
  57. package/dist/types/tree/TreePanel.d.ts +1 -1
  58. package/dist/types/tree/types.d.ts +6 -2
  59. package/dist/types/tree/useTree.d.ts +1 -0
  60. package/dist/types/virtual/Gallery.d.ts +3 -2
  61. package/dist/types/virtual/List.d.ts +3 -2
  62. package/package.json +6 -5
  63. package/src/checklist/CheckList.tsx +222 -0
  64. package/src/histogram/Histogram.tsx +7 -2
  65. package/src/hooks/useSelectableList.ts +94 -0
  66. package/src/index.ts +3 -0
  67. package/src/table/AddColumn.tsx +55 -0
  68. package/src/table/BodyCell.tsx +47 -6
  69. package/src/table/BodyRow.tsx +142 -0
  70. package/src/table/CheckboxCell.tsx +48 -0
  71. package/src/table/Context.tsx +70 -0
  72. package/src/table/EmptyCell.tsx +57 -0
  73. package/src/table/HeaderCell.tsx +93 -25
  74. package/src/table/Table.tsx +194 -87
  75. package/src/table/types.ts +42 -6
  76. package/src/table/useResizer.ts +66 -0
  77. package/src/table/useTableColumns.ts +52 -19
  78. package/src/table/useVirtualTable.ts +61 -2
  79. package/src/tree/TreePanel.tsx +12 -1
  80. package/src/tree/types.ts +8 -1
  81. package/src/tree/useTree.ts +5 -0
  82. package/src/virtual/Gallery.tsx +4 -1
  83. package/src/virtual/List.tsx +4 -1
@@ -1,6 +1,8 @@
1
1
  'use client';
2
2
 
3
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
6
  import { useEffectDebugger, useDebounce, Skeleton } from '@react-fabric/core';
5
7
  import { debounce } from '@react-fabric/utilities';
6
8
  import { useVirtualizer } from '@tanstack/react-virtual';
@@ -10,6 +12,9 @@ import { useDeferredValue, useMemo, useRef, useState, useEffect, useCallback, us
10
12
  import { Scroller } from './Scroller.js';
11
13
  import { jsx, jsxs } from 'react/jsx-runtime';
12
14
 
15
+ var _excluded = ["items", "children", "columns", "padding", "defaultHeight", "defaultWidth", "hideScroller", "initialScroll", "loading", "onLoadMore", "onScroll", "galleryRef"];
16
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
17
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
18
  var createItemList = memoizeOne(function (items) {
14
19
  return items;
15
20
  });
@@ -29,7 +34,8 @@ var _VirtualGallery = function _VirtualGallery(_ref) {
29
34
  loading = _ref.loading,
30
35
  onLoadMore = _ref.onLoadMore,
31
36
  onScroll = _ref.onScroll,
32
- galleryRef = _ref.galleryRef;
37
+ galleryRef = _ref.galleryRef,
38
+ aria = _objectWithoutProperties(_ref, _excluded);
33
39
  var count = useDeferredValue(items.length);
34
40
  var extraSize = useMemo(function () {
35
41
  return onLoadMore ? 64 : 0;
@@ -163,10 +169,11 @@ var _VirtualGallery = function _VirtualGallery(_ref) {
163
169
  }
164
170
  };
165
171
  }, [virtualizer, columnCount]);
166
- return /*#__PURE__*/jsx("div", {
172
+ return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
167
173
  ref: scrollerRef,
168
174
  onScroll: handleScroll,
169
- className: classNames("area-content bg-base overflow-auto contain-strict"),
175
+ className: classNames("area-content bg-base overflow-auto contain-strict")
176
+ }, aria), {}, {
170
177
  children: /*#__PURE__*/jsxs("div", {
171
178
  className: classNames("inline-flex flex-nowrap gap-2 justify-center min-h-full min-w-full"),
172
179
  children: [/*#__PURE__*/jsx("div", {
@@ -220,7 +227,7 @@ var _VirtualGallery = function _VirtualGallery(_ref) {
220
227
  })
221
228
  })]
222
229
  })
223
- });
230
+ }));
224
231
  };
225
232
  _VirtualGallery.displayName = "VirtualGallery";
226
233
  var GenericMemo = memo;
@@ -1,6 +1,8 @@
1
1
  'use client';
2
2
 
3
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
4
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
6
  import { useDebounce, Skeleton } from '@react-fabric/core';
5
7
  import { debounce } from '@react-fabric/utilities';
6
8
  import { useVirtualizer } from '@tanstack/react-virtual';
@@ -10,6 +12,9 @@ import { useDeferredValue, useMemo, useRef, useEffect, useCallback, useState, us
10
12
  import { Scroller } from './Scroller.js';
11
13
  import { jsx, jsxs } from 'react/jsx-runtime';
12
14
 
15
+ var _excluded = ["items", "children", "fullWidth", "padding", "orientation", "defaultHeight", "defaultWidth", "hideScroller", "initialScroll", "loading", "onLoadMore", "onScroll", "listRef"];
16
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
17
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
18
  var createItemList = memoizeOne(function (items) {
14
19
  return items;
15
20
  });
@@ -31,7 +36,8 @@ var _VirtualList = function _VirtualList(_ref) {
31
36
  loading = _ref.loading,
32
37
  onLoadMore = _ref.onLoadMore,
33
38
  onScroll = _ref.onScroll,
34
- listRef = _ref.listRef;
39
+ listRef = _ref.listRef,
40
+ aria = _objectWithoutProperties(_ref, _excluded);
35
41
  var count = useDeferredValue(items.length);
36
42
  var extraSize = useMemo(function () {
37
43
  return onLoadMore ? 64 : 0;
@@ -154,10 +160,11 @@ var _VirtualList = function _VirtualList(_ref) {
154
160
  }
155
161
  };
156
162
  }, [virtualizer]);
157
- return /*#__PURE__*/jsx("div", {
163
+ return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
158
164
  ref: scrollerRef,
159
165
  onScroll: handleScroll,
160
- className: classNames("area-content bg-base overflow-auto contain-strict"),
166
+ className: classNames("area-content bg-base overflow-auto contain-strict")
167
+ }, aria), {}, {
161
168
  children: /*#__PURE__*/jsxs("div", {
162
169
  className: classNames("inline-flex flex-nowrap gap-2 justify-center min-h-full min-w-full", orientation === "horizontal" && "flex-col"),
163
170
  children: [/*#__PURE__*/jsxs("div", {
@@ -209,7 +216,7 @@ var _VirtualList = function _VirtualList(_ref) {
209
216
  })
210
217
  })]
211
218
  })
212
- });
219
+ }));
213
220
  };
214
221
  _VirtualList.displayName = "VirtualList";
215
222
  var GenericMemo = memo;
@@ -0,0 +1,30 @@
1
+ import { type BadgeType, type TestProps } from "@react-fabric/core/dist/types/types";
2
+ import { type FC } from "react";
3
+ import { type SelectableProps } from "../hooks/useSelectableList";
4
+ export interface CheckListItem extends KeyValue {
5
+ id: string;
6
+ label: string;
7
+ icon?: string;
8
+ badge?: BadgeType;
9
+ isDisabled?: boolean;
10
+ }
11
+ export interface CheckListProps extends SelectableProps, TestProps {
12
+ /**
13
+ * list items
14
+ */
15
+ items: CheckListItem[];
16
+ /**
17
+ * allow negative selections
18
+ */
19
+ allowNegative?: boolean;
20
+ /**
21
+ * max list items
22
+ */
23
+ maxCount?: number;
24
+ /**
25
+ * message for empty list
26
+ */
27
+ emptyMessage?: string;
28
+ sortItems?: boolean;
29
+ }
30
+ export declare const CheckList: FC<CheckListProps>;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { type ColorType, type PaletteType } from "@react-fabric/core/dist/types/types";
2
+ import { type ColorType, type PaletteType, type TestProps } from "@react-fabric/core/dist/types/types";
3
3
  interface HistogramItem {
4
4
  id: string;
5
5
  label: string;
@@ -7,7 +7,7 @@ interface HistogramItem {
7
7
  total?: number;
8
8
  disabled?: boolean;
9
9
  }
10
- export interface HistogramProps {
10
+ export interface HistogramProps extends TestProps {
11
11
  /**
12
12
  * histogram items list
13
13
  */
@@ -37,5 +37,5 @@ export interface HistogramProps {
37
37
  */
38
38
  onClick?: (id: string, negative?: true) => void;
39
39
  }
40
- export declare const Histogram: ({ items, total, color, sortBy, emptyTitle, emptyMessage, onClick, }: HistogramProps) => import("react/jsx-runtime").JSX.Element;
40
+ export declare const Histogram: ({ items, total, color, sortBy, emptyTitle, emptyMessage, onClick, ...aria }: HistogramProps) => import("react/jsx-runtime").JSX.Element;
41
41
  export {};
@@ -0,0 +1,28 @@
1
+ export interface SelectableProps {
2
+ /**
3
+ * list items
4
+ */
5
+ items: Array<{
6
+ label: string;
7
+ } & KeyValue>;
8
+ /**
9
+ * selected item ids
10
+ */
11
+ selected?: string[];
12
+ /**
13
+ * selected negative item ids
14
+ */
15
+ nonselected?: string[];
16
+ /**
17
+ * change callback
18
+ */
19
+ onChange?: (ids: string[], nonIds?: string[]) => void;
20
+ /**
21
+ * item click callback
22
+ */
23
+ onClick?: (id: string, isNegative: boolean) => void;
24
+ }
25
+ export declare const useSelectableList: ({ items, selected, nonselected, onChange, onClick, }: SelectableProps) => {
26
+ selection: KeyValue<number>;
27
+ toggleSelection: (id: string, isNegative?: boolean) => void;
28
+ };
@@ -1,9 +1,12 @@
1
1
  import "./i18n";
2
+ export { CheckList } from "./checklist/CheckList";
2
3
  export { Histogram } from "./histogram/Histogram";
3
4
  export { JsonViewer } from "./json/JsonViewer";
4
5
  export { Pagination } from "./pagination/Pagination";
5
6
  export { Table } from "./table/Table";
7
+ export { type TableColumn, type TableRef } from "./table/types";
6
8
  export { TreePanel } from "./tree/TreePanel";
9
+ export { type TreeNodeType as TreeNode } from "./tree/types";
7
10
  export { VirtualGallery, type VirtualGalleryRef } from "./virtual/Gallery";
8
11
  export { VirtualList, type VirtualListRef } from "./virtual/List";
9
12
  export * from "./hooks/useFilteredList";
@@ -0,0 +1,5 @@
1
+ import { type TableColumn } from "./types";
2
+ export declare const AddColumn: ({ columns, onClick, }: {
3
+ columns: TableColumn[];
4
+ onClick: (id: string) => void;
5
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
- import { type ColumnType } from "./types";
2
- export declare const BodyCell: ({ column, item, }: {
3
- column: ColumnType;
1
+ import { type TableColumn } from "./types";
2
+ export declare const BodyCell: ({ column, item, index, }: {
3
+ column: TableColumn;
4
4
  item: KeyValue;
5
+ index: number;
5
6
  }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { type TableColumn } from "./types";
2
+ export declare const BodyRow: ({ rowKey, index, data, keyProperty, measureElement, state, hideableColumns, wrapperStart, wrapperEnd, onRowClick, checkableRows, checked, toggleChecked, canExpand, expanded, toggleExpand, expandRow, }: {
3
+ rowKey: Key;
4
+ index: number;
5
+ data: KeyValue;
6
+ keyProperty?: Key;
7
+ measureElement: AnyObject;
8
+ state: KeyValue<TableColumn[]>;
9
+ hideableColumns?: boolean;
10
+ wrapperStart: string;
11
+ wrapperEnd: string;
12
+ checkableRows?: boolean;
13
+ checked: 0 | 1;
14
+ onRowClick?: AnyObject;
15
+ canExpand?: AnyObject;
16
+ expandRow?: AnyObject;
17
+ expanded: boolean;
18
+ toggleExpand: (key: Key) => void;
19
+ toggleChecked: (key: Key) => void;
20
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export declare const CheckboxCell: ({ state, onClick, }: {
2
+ state: 0 | 1 | 2;
3
+ onClick?: () => void;
4
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { type ChildrenProp } from "@react-fabric/core/dist/types/types";
2
+ interface Context {
3
+ widths: Map<string, number>;
4
+ startResize: (col: HTMLElement) => void;
5
+ }
6
+ export declare const TableProvider: ({ children }: ChildrenProp) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const useTableContext: () => Context;
8
+ export {};
@@ -0,0 +1,2 @@
1
+ import { type TableColumn } from "./types";
2
+ export declare const EmptyCell: ({ id, width: _width, maxWidth, minWidth, }: TableColumn) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
- import { type ColumnType } from "./types";
2
- export declare const HeaderCell: ({ label, icon, iconBg, iconColor, rtlFlip, actions, locked, resizable, width, maxWidth, minWidth, }: ColumnType) => import("react/jsx-runtime").JSX.Element;
1
+ import { type TableColumn, type TableProps } from "./types";
2
+ export declare const HeaderCell: ({ id, label, icon, iconBg, iconColor, rtlFlip, actions, locked, tooltip, sortable, resizable, width: _width, maxWidth, minWidth, sort, onSort, }: TableColumn & Pick<TableProps, "sort" | "onSort">) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import { type TableProps } from "./types";
2
- export declare const Table: <T extends KeyValue<any> = KeyValue<any>>({ data, columns, }: TableProps<T>) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const Table: <T extends KeyValue<any> = KeyValue<any>>({ ref, data, columns, keyProperty, checkableRows, initialScroll, hideableColumns, sort, loading, emptyDisplay, canExpand, children, onSort, onScroll, onRowClick, onCheckedChanged, }: TableProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,12 @@
1
- import { type CssProp, type IconProps, type TestProps } from "@react-fabric/core/dist/types/types";
1
+ import { type CssProp, type Elements, type IconProps, type RefProp, type TestProps } from "@react-fabric/core/dist/types/types";
2
2
  import { type ReactElement } from "react";
3
- export interface ColumnType<T = KeyValue> extends CssProp, IconProps, TestProps {
4
- id: keyof T;
3
+ export declare const COL_MIN_WIDTH = "3rem";
4
+ export declare const COL_MAX_WIDTH = "64rem";
5
+ export declare const COL_DEFAULT_WIDTH = "12rem";
6
+ export interface TableColumn<T = KeyValue> extends CssProp, IconProps, TestProps {
7
+ id: keyof T | string;
5
8
  label?: string;
9
+ tooltip?: string;
6
10
  actions?: ReactElement;
7
11
  align?: "start" | "center" | "end";
8
12
  locked?: "start" | "end";
@@ -17,10 +21,40 @@ export interface ColumnType<T = KeyValue> extends CssProp, IconProps, TestProps
17
21
  maxWidth?: string | number;
18
22
  dataType?: "string" | "number" | "boolean" | "datetime" | "date" | "time" | "unknown";
19
23
  format?: string;
20
- renderer?: (value: AnyObject, data: T) => void;
24
+ valueMap?: KeyValue;
25
+ renderer?: (value: AnyObject, data: T, index: number) => Elements<AnyObject>;
21
26
  }
22
- export interface TableProps<T = KeyValue> {
23
- columns: Array<ColumnType<T>>;
27
+ export interface TableRef {
28
+ hilight: (row: number) => void;
29
+ unhilight: () => void;
30
+ scrollTo: (row: number) => void;
31
+ }
32
+ export interface TableProps<T = KeyValue> extends RefProp<TableRef> {
33
+ columns: Array<TableColumn<T>>;
24
34
  data: T[];
25
- autoColumns?: boolean;
35
+ keyProperty?: keyof T;
36
+ emptyDisplay?: ReactElement;
37
+ /**
38
+ * checkable rows
39
+ */
40
+ checkableRows?: boolean;
41
+ onCheckedChanged?: (rows: Array<keyof T>) => void;
42
+ /**
43
+ * sorting
44
+ */
45
+ sort?: {
46
+ id: string;
47
+ order: "asc" | "desc";
48
+ };
49
+ onSort?: (sort: {
50
+ id: string;
51
+ order: "asc" | "desc";
52
+ }) => void;
53
+ loading?: boolean;
54
+ hideableColumns?: boolean;
55
+ onRowClick?: (data: T) => void;
56
+ initialScroll?: number;
57
+ onScroll?: (firstItem: number) => void;
58
+ canExpand?: (record: T) => boolean;
59
+ children?: (record: T) => Elements<AnyObject>;
26
60
  }
@@ -0,0 +1 @@
1
+ export declare const useResizer: (colEl: HTMLElement, ghostEl: HTMLElement, callback: (width: number) => void) => void;
@@ -1,8 +1,10 @@
1
- import { type ColumnType } from "./types";
2
- export declare const useTableColumns: (columns: ColumnType[]) => {
3
- columnMap: {
4
- start: ColumnType[];
5
- end: ColumnType[];
6
- cols: ColumnType[];
1
+ import { type TableColumn } from "./types";
2
+ export declare const useTableColumns: (columns: TableColumn[]) => {
3
+ state: {
4
+ start: TableColumn<KeyValue<any>>[];
5
+ end: TableColumn<KeyValue<any>>[];
6
+ cols: TableColumn<KeyValue<any>>[];
7
+ columns: TableColumn[];
7
8
  };
9
+ onHide: (id: string) => void;
8
10
  };
@@ -1,8 +1,20 @@
1
1
  /// <reference types="react" />
2
- export declare const useVirtualTable: (data: KeyValue[]) => {
2
+ interface DataState {
3
+ expanded: Key[];
4
+ checked: Key[];
5
+ allChecked: 0 | 1 | 2;
6
+ }
7
+ export declare const useVirtualTable: (data: KeyValue[], keyProperty?: Key, onCheckChanged?: (checked: Key[]) => void) => {
3
8
  scrollerRef: import("react").RefObject<HTMLDivElement>;
4
9
  items: import("@tanstack/virtual-core").VirtualItem<Element>[];
10
+ checkState: DataState;
5
11
  getData: (index: number) => KeyValue<any>;
12
+ virtualizer: import("@tanstack/virtual-core").Virtualizer<HTMLDivElement, Element>;
13
+ top: number | undefined;
6
14
  totalSize: () => number;
7
15
  measureElement: (node: Element | null | undefined) => void;
16
+ toggleExpand: (key: Key) => void;
17
+ toggleChecked: (key: Key) => void;
18
+ toggleAllChecked: () => void;
8
19
  };
20
+ export {};
@@ -1,2 +1,2 @@
1
1
  import { type TreePanelProps } from "./types";
2
- export declare const TreePanel: <T extends KeyValue<any>>({ items, selected, checked, checkable, noLines, renderer, searchable, selectable, matcher, filterPlaceholder, defaultLeafIcon, defaultNodeIcon, expander, onChecked, onLoad, onSelect, ...aria }: TreePanelProps<T>) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const TreePanel: <T extends KeyValue<any>>({ ref, items, selected, checked, checkable, noLines, renderer, searchable, selectable, matcher, filterPlaceholder, defaultLeafIcon, defaultNodeIcon, expander, onChecked, onLoad, onSelect, ...aria }: TreePanelProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { type BadgeType, type ChildProp, type CssProp, type Elements, type IconProps, type TestProps } from "@react-fabric/core/dist/types/types";
2
+ import { type BadgeType, type ChildProp, type CssProp, type Elements, type IconProps, type RefProp, type TestProps } from "@react-fabric/core/dist/types/types";
3
3
  interface TreeBaseNode<T> extends IconProps, CssProp, TestProps {
4
4
  id: string;
5
5
  /**
@@ -70,7 +70,11 @@ export interface TreeNodeProps extends ChildProp {
70
70
  onSelect: (id: string) => void;
71
71
  onChecked: (id: string) => void;
72
72
  }
73
- export interface TreePanelProps<T extends KeyValue = KeyValue> extends TestProps {
73
+ export interface TreeRef {
74
+ select: (id: string) => void;
75
+ open: (id: string) => void;
76
+ }
77
+ export interface TreePanelProps<T extends KeyValue = KeyValue> extends TestProps, RefProp<TreeRef> {
74
78
  items?: Array<TreeNodeType<T>>;
75
79
  /**
76
80
  * make tree searchable
@@ -13,6 +13,7 @@ export declare const useTree: <T extends KeyValue<any>>({ items, checked, select
13
13
  collapseAll: () => void;
14
14
  toggleCheck: (id: string) => void;
15
15
  select: (id: string) => void;
16
+ expand: (id: string) => void;
16
17
  onFilter: {
17
18
  (...args: any): void;
18
19
  cancel(): void;
@@ -1,10 +1,11 @@
1
+ import { type TestProps } from "@react-fabric/core/dist/types/types";
1
2
  import { type ReactElement, type Ref } from "react";
2
3
  export interface VirtualGalleryRef {
3
4
  scrollToItem: (index: number) => void;
4
5
  hilight: (index: number) => void;
5
6
  unhilight: () => void;
6
7
  }
7
- export interface VirtualGalleryProps<T> {
8
+ export interface VirtualGalleryProps<T> extends TestProps {
8
9
  children: (props: {
9
10
  data: T;
10
11
  index: number;
@@ -50,6 +51,6 @@ export interface VirtualGalleryProps<T> {
50
51
  onScroll?: (top: number) => void;
51
52
  }
52
53
  export declare const VirtualGallery: {
53
- <T extends KeyValue<any>>({ items, children, columns, padding, defaultHeight: height, defaultWidth: width, hideScroller, initialScroll, loading, onLoadMore, onScroll, galleryRef, }: VirtualGalleryProps<T>): import("react/jsx-runtime").JSX.Element;
54
+ <T extends KeyValue<any>>({ items, children, columns, padding, defaultHeight: height, defaultWidth: width, hideScroller, initialScroll, loading, onLoadMore, onScroll, galleryRef, ...aria }: VirtualGalleryProps<T>): import("react/jsx-runtime").JSX.Element;
54
55
  displayName: string;
55
56
  };
@@ -1,10 +1,11 @@
1
+ import { type TestProps } from "@react-fabric/core/dist/types/types";
1
2
  import { type ReactElement, type Ref } from "react";
2
3
  export interface VirtualListRef {
3
4
  scrollToItem: (index: number) => void;
4
5
  hilight: (index: number) => void;
5
6
  unhilight: () => void;
6
7
  }
7
- export interface VirtualListProps<T> {
8
+ export interface VirtualListProps<T> extends TestProps {
8
9
  children: (props: {
9
10
  data: T;
10
11
  index: number;
@@ -54,6 +55,6 @@ export interface VirtualListProps<T> {
54
55
  onScroll?: (top: number) => void;
55
56
  }
56
57
  export declare const VirtualList: {
57
- <T extends KeyValue<any>>({ items, children, fullWidth, padding, orientation, defaultHeight: height, defaultWidth: width, hideScroller, initialScroll, loading, onLoadMore, onScroll, listRef, }: VirtualListProps<T>): import("react/jsx-runtime").JSX.Element;
58
+ <T extends KeyValue<any>>({ items, children, fullWidth, padding, orientation, defaultHeight: height, defaultWidth: width, hideScroller, initialScroll, loading, onLoadMore, onScroll, listRef, ...aria }: VirtualListProps<T>): import("react/jsx-runtime").JSX.Element;
58
59
  displayName: string;
59
60
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-fabric/data",
3
- "version": "1.0.0-beta.0",
3
+ "version": "1.0.0-beta.11",
4
4
  "description": "RUF: Data package",
5
5
  "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
6
  "license": "MIT",
@@ -33,9 +33,10 @@
33
33
  "watch": "npm-run-all -p watch:rollup watch:dts"
34
34
  },
35
35
  "dependencies": {
36
- "@react-fabric/core": "^1.0.0-beta.0",
37
- "@react-fabric/form": "^1.0.0-beta.0",
38
- "@react-fabric/utilities": "^1.0.0-beta.0",
36
+ "@react-fabric/core": "^1.0.0-beta.11",
37
+ "@react-fabric/date": "^1.0.0-beta.11",
38
+ "@react-fabric/form": "^1.0.0-beta.11",
39
+ "@react-fabric/utilities": "^1.0.0-beta.11",
39
40
  "@tanstack/react-virtual": "^3.8.6",
40
41
  "classnames": "^2.5.1",
41
42
  "color": "^4.2.3",
@@ -51,5 +52,5 @@
51
52
  "node": ">=18.12.0",
52
53
  "npm": ">=8.19.0"
53
54
  },
54
- "gitHead": "83fa79064b1d57e71149005432192d506810bbda"
55
+ "gitHead": "c113890832384265335f0572bfad9438e811917f"
55
56
  }