@react-fabric/data 1.0.0-beta.61 → 1.0.0-beta.63

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 (76) hide show
  1. package/dist/cjs/checklist/CheckList.js +1 -1
  2. package/dist/cjs/histogram/Histogram.js +1 -1
  3. package/dist/cjs/i18n/index.js +4 -4
  4. package/dist/cjs/index.js +2 -0
  5. package/dist/cjs/json/JsonViewer.js +8 -8
  6. package/dist/cjs/pagination/Pagination.js +8 -8
  7. package/dist/cjs/table/BodyCell.js +2 -2
  8. package/dist/cjs/table/EmptyCell.js +2 -2
  9. package/dist/cjs/table/HeaderCell.js +6 -6
  10. package/dist/cjs/table/HtmlTable.js +78 -0
  11. package/dist/cjs/table/{Context.js → Provider.js} +2 -6
  12. package/dist/cjs/table/Table.js +4 -4
  13. package/dist/cjs/table/context.js +34 -0
  14. package/dist/cjs/table/useResizer.js +6 -4
  15. package/dist/cjs/tree/utils.js +13 -15
  16. package/dist/cjs/virtual/Gallery.js +2 -2
  17. package/dist/cjs/virtual/List.js +3 -3
  18. package/dist/esm/checklist/CheckList.js +1 -1
  19. package/dist/esm/histogram/Histogram.js +1 -1
  20. package/dist/esm/i18n/index.js +2 -2
  21. package/dist/esm/index.js +1 -0
  22. package/dist/esm/json/JsonViewer.js +8 -8
  23. package/dist/esm/pagination/Pagination.js +8 -8
  24. package/dist/esm/table/BodyCell.js +1 -1
  25. package/dist/esm/table/EmptyCell.js +1 -1
  26. package/dist/esm/table/HeaderCell.js +5 -5
  27. package/dist/esm/table/HtmlTable.js +78 -0
  28. package/dist/esm/table/{Context.js → Provider.js} +3 -6
  29. package/dist/esm/table/Table.js +3 -3
  30. package/dist/esm/table/context.js +33 -0
  31. package/dist/esm/table/useResizer.js +6 -4
  32. package/dist/esm/tree/useTree.js +12 -12
  33. package/dist/esm/tree/utils.js +11 -13
  34. package/dist/esm/virtual/Gallery.js +2 -2
  35. package/dist/esm/virtual/List.js +3 -3
  36. package/dist/types/checklist/CheckList.d.ts +1 -1
  37. package/dist/types/histogram/Histogram.d.ts +3 -3
  38. package/dist/types/index.d.ts +1 -0
  39. package/dist/types/json/JsonViewer.d.ts +2 -2
  40. package/dist/types/pagination/Pagination.d.ts +1 -1
  41. package/dist/types/table/BodyCell.d.ts +1 -1
  42. package/dist/types/table/EmptyCell.d.ts +1 -1
  43. package/dist/types/table/HtmlTable.d.ts +21 -0
  44. package/dist/types/table/{Context.d.ts → Provider.d.ts} +0 -6
  45. package/dist/types/table/Table.d.ts +1 -1
  46. package/dist/types/table/context.d.ts +7 -0
  47. package/dist/types/table/useVirtualTable.d.ts +1 -1
  48. package/dist/types/tree/TreePanel.d.ts +1 -1
  49. package/dist/types/tree/types.d.ts +6 -6
  50. package/dist/types/virtual/Gallery.d.ts +1 -1
  51. package/dist/types/virtual/List.d.ts +1 -1
  52. package/package.json +13 -14
  53. package/src/checklist/CheckList.tsx +1 -1
  54. package/src/histogram/Histogram.tsx +3 -3
  55. package/src/i18n/index.ts +2 -2
  56. package/src/index.ts +1 -0
  57. package/src/json/JsonViewer.tsx +2 -2
  58. package/src/pagination/Pagination.tsx +8 -8
  59. package/src/table/BodyCell.tsx +6 -31
  60. package/src/table/EmptyCell.tsx +4 -17
  61. package/src/table/HeaderCell.tsx +9 -41
  62. package/src/table/HtmlTable.tsx +128 -0
  63. package/src/table/{Context.tsx → Provider.tsx} +3 -20
  64. package/src/table/Table.tsx +4 -4
  65. package/src/table/context.ts +33 -0
  66. package/src/table/useResizer.ts +6 -4
  67. package/src/tree/TreePanel.tsx +1 -1
  68. package/src/tree/types.ts +6 -6
  69. package/src/virtual/Gallery.tsx +2 -2
  70. package/src/virtual/List.tsx +3 -3
  71. /package/dist/cjs/i18n/{ar.json.js → ar/data.json.js} +0 -0
  72. /package/dist/cjs/i18n/{en.json.js → en/data.json.js} +0 -0
  73. /package/dist/esm/i18n/{ar.json.js → ar/data.json.js} +0 -0
  74. /package/dist/esm/i18n/{en.json.js → en/data.json.js} +0 -0
  75. /package/src/i18n/{ar.json → ar/data.json} +0 -0
  76. /package/src/i18n/{en.json → en/data.json} +0 -0
@@ -169,7 +169,7 @@ var _VirtualList = function _VirtualList(_ref) {
169
169
  return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
170
170
  ref: scrollerRef,
171
171
  onScroll: handleScroll,
172
- className: classNames("area-content bg-base overflow-auto")
172
+ className: classNames("area-content bg-default overflow-auto")
173
173
  }, aria), {}, {
174
174
  children: /*#__PURE__*/jsxs("div", {
175
175
  className: classNames("flex flex-nowrap gap-2 justify-center min-h-full min-w-full", orientation === "horizontal" && "flex-col"),
@@ -214,7 +214,7 @@ var _VirtualList = function _VirtualList(_ref) {
214
214
  children: /*#__PURE__*/jsx(Skeleton, {})
215
215
  })]
216
216
  }), !hideScroller && /*#__PURE__*/jsx("div", {
217
- className: classNames(orientation === "vertical" && "self-end sticky bottom-2", orientation === "horizontal" && "self-end sticky end-2"),
217
+ className: classNames(orientation === "vertical" && "self-end sticky bottom-2", orientation === "horizontal" && "self-end sticky inset-e-2"),
218
218
  children: /*#__PURE__*/jsx(Scroller, {
219
219
  vertical: orientation === "vertical",
220
220
  scrollActive: scrollActive,
@@ -246,7 +246,7 @@ var GenericMemo = memo;
246
246
  * It can be used with a ref to control scrolling and hilighting of items.
247
247
  *
248
248
  * @param {VirtualListProps<T>} props - The properties for the VirtualList component.
249
- * @returns {JSX.Element} The rendered VirtualList component.
249
+ * @returns {React.ReactElement} The rendered VirtualList component.
250
250
  * @template T - The type of items in the list, extending AnyObject.
251
251
  *
252
252
  * @example
@@ -32,7 +32,7 @@ export interface CheckListProps extends SelectableProps, TestProps {
32
32
  * It supports selection, deselection, and allows for negative selections.
33
33
  *
34
34
  * @param {CheckListProps} props - The properties for the CheckList component.
35
- * @returns {JSX.Element} The rendered CheckList component.
35
+ * @returns {React.ReactElement} The rendered CheckList component.
36
36
  *
37
37
  * @example
38
38
  * ```jsx
@@ -26,11 +26,11 @@ export interface HistogramProps extends TestProps {
26
26
  /**
27
27
  * title when histo list is empty
28
28
  */
29
- emptyTitle?: string | JSX.Element;
29
+ emptyTitle?: string | React.ReactElement;
30
30
  /**
31
31
  * message when histo list is empty
32
32
  */
33
- emptyMessage?: string | JSX.Element;
33
+ emptyMessage?: string | React.ReactElement;
34
34
  /**
35
35
  * handle histo click
36
36
  */
@@ -43,7 +43,7 @@ export interface HistogramProps extends TestProps {
43
43
  * It also provides an empty state when there are no items to display.
44
44
  *
45
45
  * @param {HistogramProps} props - The properties for the Histogram component.
46
- * @returns {JSX.Element} - The rendered Histogram component.
46
+ * @returns {React.ReactElement} - The rendered Histogram component.
47
47
  *
48
48
  * @example
49
49
  * ```jsx
@@ -3,6 +3,7 @@ export { CheckList } from "./checklist/CheckList";
3
3
  export { Histogram } from "./histogram/Histogram";
4
4
  export { JsonViewer } from "./json/JsonViewer";
5
5
  export { Pagination } from "./pagination/Pagination";
6
+ export { HtmlTable } from "./table/HtmlTable";
6
7
  export { Table } from "./table/Table";
7
8
  export { type TableColumn, type TableRef } from "./table/types";
8
9
  export { TreePanel } from "./tree/TreePanel";
@@ -53,7 +53,7 @@ export interface JsonViewProps<T> extends CssProp {
53
53
  /**
54
54
  * render function for custom value display
55
55
  */
56
- formatter?: (path?: string, value?: AnyObject) => string | JSX.Element | undefined;
56
+ formatter?: (path?: string, value?: AnyObject) => string | React.ReactElement | undefined;
57
57
  }
58
58
  /**
59
59
  * JsonViewer component to display JSON data in a structured format.
@@ -62,7 +62,7 @@ export interface JsonViewProps<T> extends CssProp {
62
62
  * It also provides options for copying values and filtering properties.
63
63
  *
64
64
  * @param {JsonViewProps<T>} props - The properties for the JsonViewer component.
65
- * @returns {JSX.Element} The rendered JsonViewer component.
65
+ * @returns {React.ReactElement} The rendered JsonViewer component.
66
66
  *
67
67
  * @example
68
68
  * ```jsx
@@ -28,6 +28,6 @@ export interface PaginationProps {
28
28
  * It uses memoization to optimize rendering performance.
29
29
  *
30
30
  * @param {PaginationProps} props - The properties for the Pagination component.
31
- * @returns {JSX.Element} The rendered Pagination component.
31
+ * @returns {React.ReactElement} The rendered Pagination component.
32
32
  */
33
33
  export declare const Pagination: import("react").MemoExoticComponent<({ page, ranges, totalPages, minimal, onPageChange }: PaginationProps) => import("react/jsx-runtime").JSX.Element>;
@@ -1,5 +1,5 @@
1
1
  import { type TableColumn } from "./types";
2
- export declare const BodyCell: ({ column, item, index, }: {
2
+ export declare const BodyCell: ({ column, item, index }: {
3
3
  column: TableColumn;
4
4
  item: KeyValue;
5
5
  index: number;
@@ -1,2 +1,2 @@
1
1
  import { type TableColumn } from "./types";
2
- export declare const EmptyCell: ({ id, width: _width, maxWidth, minWidth, }: TableColumn) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const EmptyCell: ({ id, width: _width, maxWidth, minWidth }: TableColumn) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ interface Props<T = KeyValue> {
2
+ data: T[];
3
+ columns: Array<{
4
+ id: keyof T;
5
+ label?: string;
6
+ width?: number | string;
7
+ maxWidth?: number | string;
8
+ align?: "start" | "center" | "end";
9
+ className?: string;
10
+ headRenderer?: React.ReactNode;
11
+ renderer?: (value: any, row: T, index: number) => React.ReactNode;
12
+ }>;
13
+ /**
14
+ * Number of pagination buttons to show, default is 25
15
+ * If set to 0, pagination will be hidden
16
+ */
17
+ paginationSize?: number;
18
+ className?: string;
19
+ }
20
+ export declare const HtmlTable: <T extends KeyValue = KeyValue>({ data, columns, paginationSize, className, }: Props<T>) => import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -1,8 +1,2 @@
1
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
2
  export declare const TableProvider: ({ children }: ChildrenProp) => import("react/jsx-runtime").JSX.Element;
7
- export declare const useTableContext: () => Context;
8
- export {};
@@ -7,7 +7,7 @@ import { type TableProps } from "./types";
7
7
  * Uses TanStack's `useVirtual` for virtualization and React's `useMemo` for performance optimization.
8
8
  *
9
9
  * @param {TableProps<T>} props - The properties for the Table component.
10
- * @returns {JSX.Element} The rendered Table component.
10
+ * @returns {React.ReactElement} The rendered Table component.
11
11
  *
12
12
  * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/story/data-table--table}
13
13
  * @see {@link https://tanstack.com/table/v8/docs/api/virtual}
@@ -0,0 +1,7 @@
1
+ interface Context {
2
+ widths: Map<string, number>;
3
+ startResize: (col: HTMLElement) => void;
4
+ }
5
+ export declare const TableContext: import("react").Context<Context>;
6
+ export declare const useTableContext: () => Context;
7
+ export {};
@@ -25,7 +25,7 @@ export declare const useVirtualTable: <T extends KeyValue = KeyValue>(data: T[],
25
25
  isActiveSticky: (index: number) => boolean;
26
26
  top: number | undefined;
27
27
  totalSize: () => number;
28
- measureElement: (node: Element | null | undefined) => void;
28
+ measureElement: (node: Element | null) => void;
29
29
  toggleGroupExpand: (key: Key) => void;
30
30
  toggleExpand: (key: Key) => void;
31
31
  toggleChecked: (key: Key) => void;
@@ -5,7 +5,7 @@ import { type TreePanelProps } from "./types";
5
5
  * nodes and supports checkable nodes.
6
6
  *
7
7
  * @param {TreePanelProps<T>} props - The properties for the TreePanel component.
8
- * @returns {JSX.Element} The rendered TreePanel component.
8
+ * @returns {React.ReactElement} The rendered TreePanel component.
9
9
  * @template T - The type of items in the tree, extending KeyValue.
10
10
  *
11
11
  * @example
@@ -5,7 +5,7 @@ interface TreeBaseNode<T> extends CssProp, TestProps {
5
5
  /**
6
6
  * display label
7
7
  */
8
- label: Elements<JSX.Element>;
8
+ label: Elements<React.ReactElement>;
9
9
  /**
10
10
  * icon path or props
11
11
  */
@@ -39,7 +39,7 @@ export type TreeNodeType<T extends KeyValue = KeyValue> = TreeBaseNode<T> & ({
39
39
  });
40
40
  export interface InternalNode extends CssProp, TestProps {
41
41
  id: string;
42
- label: Elements<JSX.Element>;
42
+ label: Elements<React.ReactElement>;
43
43
  queryable?: string;
44
44
  badge?: string | number | BadgeType;
45
45
  disabled?: boolean;
@@ -66,8 +66,8 @@ export interface InternalNode extends CssProp, TestProps {
66
66
  export interface TreeNodeProps extends ChildProp {
67
67
  node: InternalNode;
68
68
  expanders: [string, string];
69
- defaultNodeIcon?: Elements<JSX.Element>;
70
- defaultLeafIcon?: Elements<JSX.Element>;
69
+ defaultNodeIcon?: Elements<React.ReactElement>;
70
+ defaultLeafIcon?: Elements<React.ReactElement>;
71
71
  noLines?: boolean;
72
72
  selectable?: true | "leafOnly";
73
73
  checkable?: true | "leafOnly";
@@ -176,8 +176,8 @@ interface BaseTreePanelProps<T extends KeyValue = KeyValue> extends TestProps, R
176
176
  */
177
177
  matcher?: (data: T, query: string) => boolean;
178
178
  sorter?: false | ((a: T, b: T) => number);
179
- makeLabel?: (node: T) => Elements<JSX.Element>;
180
- makeIcon?: (node: T) => Elements<JSX.Element>;
179
+ makeLabel?: (node: T) => Elements<React.ReactElement>;
180
+ makeIcon?: (node: T) => Elements<React.ReactElement>;
181
181
  defaultExpanded?: string[];
182
182
  onExpandToggle?: (id: string[]) => void;
183
183
  leafClassName?: string;
@@ -64,7 +64,7 @@ export interface VirtualGalleryProps<T> extends TestProps {
64
64
  * It also provides a scroller for easy navigation through the items.
65
65
  *
66
66
  * @param {VirtualGalleryProps<T>} props - The properties for the VirtualGallery component.
67
- * @returns {JSX.Element} The rendered VirtualGallery component.
67
+ * @returns {React.ReactElement} The rendered VirtualGallery component.
68
68
  *
69
69
  * @example
70
70
  * ```jsx
@@ -65,7 +65,7 @@ export interface VirtualListProps<T> extends TestProps {
65
65
  * It can be used with a ref to control scrolling and hilighting of items.
66
66
  *
67
67
  * @param {VirtualListProps<T>} props - The properties for the VirtualList component.
68
- * @returns {JSX.Element} The rendered VirtualList component.
68
+ * @returns {React.ReactElement} The rendered VirtualList component.
69
69
  * @template T - The type of items in the list, extending AnyObject.
70
70
  *
71
71
  * @example
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-fabric/data",
3
- "version": "1.0.0-beta.61",
3
+ "version": "1.0.0-beta.63",
4
4
  "description": "RUF: Data package",
5
5
  "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
6
  "license": "MIT",
@@ -35,24 +35,23 @@
35
35
  "watch": "npm-run-all -p watch:rollup watch:dts"
36
36
  },
37
37
  "dependencies": {
38
- "@react-fabric/core": "^1.0.0-beta.61",
39
- "@react-fabric/date": "^1.0.0-beta.61",
40
- "@react-fabric/form": "^1.0.0-beta.61",
41
- "@react-fabric/utilities": "^1.0.0-beta.61",
42
- "@tanstack/react-virtual": "~3.13.12",
38
+ "@react-fabric/core": "^1.0.0-beta.63",
39
+ "@react-fabric/date": "^1.0.0-beta.63",
40
+ "@react-fabric/form": "^1.0.0-beta.63",
41
+ "@react-fabric/utilities": "^1.0.0-beta.63",
42
+ "@tanstack/react-virtual": "~3.13.22",
43
43
  "classnames": "~2.5.1",
44
- "color": "~5.0.2",
45
44
  "memoize-one": "~6.0.0"
46
45
  },
47
46
  "peerDependencies": {
48
- "i18next": "~25.6.0",
49
- "react": "~19.2.0",
50
- "react-dom": "~19.2.0",
51
- "react-i18next": "~16.2.1"
47
+ "i18next": "~25.8.18",
48
+ "react": "~19.2.4",
49
+ "react-dom": "~19.2.4",
50
+ "react-i18next": "~16.5.8"
52
51
  },
53
52
  "engines": {
54
- "node": ">=18.12.0",
55
- "npm": ">=8.19.0"
53
+ "node": ">=22.18.0",
54
+ "npm": ">=10.8.0"
56
55
  },
57
- "gitHead": "a0b0c571bf9c189fa3355bbc3b896ecc4b9d6a04"
56
+ "gitHead": "6e0652b15c6384fbc316842862572e21299a5466"
58
57
  }
@@ -164,7 +164,7 @@ const CheckItem: FC<
164
164
  * It supports selection, deselection, and allows for negative selections.
165
165
  *
166
166
  * @param {CheckListProps} props - The properties for the CheckList component.
167
- * @returns {JSX.Element} The rendered CheckList component.
167
+ * @returns {React.ReactElement} The rendered CheckList component.
168
168
  *
169
169
  * @example
170
170
  * ```jsx
@@ -63,11 +63,11 @@ export interface HistogramProps extends TestProps {
63
63
  /**
64
64
  * title when histo list is empty
65
65
  */
66
- emptyTitle?: string | JSX.Element;
66
+ emptyTitle?: string | React.ReactElement;
67
67
  /**
68
68
  * message when histo list is empty
69
69
  */
70
- emptyMessage?: string | JSX.Element;
70
+ emptyMessage?: string | React.ReactElement;
71
71
  /**
72
72
  * handle histo click
73
73
  */
@@ -81,7 +81,7 @@ export interface HistogramProps extends TestProps {
81
81
  * It also provides an empty state when there are no items to display.
82
82
  *
83
83
  * @param {HistogramProps} props - The properties for the Histogram component.
84
- * @returns {JSX.Element} - The rendered Histogram component.
84
+ * @returns {React.ReactElement} - The rendered Histogram component.
85
85
  *
86
86
  * @example
87
87
  * ```jsx
package/src/i18n/index.ts CHANGED
@@ -22,7 +22,7 @@
22
22
  */
23
23
 
24
24
  import { addTranslationBundle } from "@react-fabric/core";
25
- import ar from "./ar.json";
26
- import en from "./en.json";
25
+ import ar from "./ar/data.json";
26
+ import en from "./en/data.json";
27
27
 
28
28
  addTranslationBundle("data", { en, ar });
package/src/index.ts CHANGED
@@ -27,6 +27,7 @@ export { CheckList } from "./checklist/CheckList";
27
27
  export { Histogram } from "./histogram/Histogram";
28
28
  export { JsonViewer } from "./json/JsonViewer";
29
29
  export { Pagination } from "./pagination/Pagination";
30
+ export { HtmlTable } from "./table/HtmlTable";
30
31
  export { Table } from "./table/Table";
31
32
  export { type TableColumn, type TableRef } from "./table/types";
32
33
  export { TreePanel } from "./tree/TreePanel";
@@ -100,7 +100,7 @@ export interface JsonViewProps<T> extends CssProp {
100
100
  formatter?: (
101
101
  path?: string,
102
102
  value?: AnyObject,
103
- ) => string | JSX.Element | undefined;
103
+ ) => string | React.ReactElement | undefined;
104
104
  }
105
105
 
106
106
  const reduceObject = (json: AnyObject, keys: string[] = [], prefix = "") => {
@@ -356,7 +356,7 @@ const JsonEntry = ({
356
356
  * It also provides options for copying values and filtering properties.
357
357
  *
358
358
  * @param {JsonViewProps<T>} props - The properties for the JsonViewer component.
359
- * @returns {JSX.Element} The rendered JsonViewer component.
359
+ * @returns {React.ReactElement} The rendered JsonViewer component.
360
360
  *
361
361
  * @example
362
362
  * ```jsx
@@ -56,7 +56,7 @@ export interface PaginationProps {
56
56
  * It uses memoization to optimize rendering performance.
57
57
  *
58
58
  * @param {PaginationProps} props - The properties for the Pagination component.
59
- * @returns {JSX.Element} The rendered Pagination component.
59
+ * @returns {React.ReactElement} The rendered Pagination component.
60
60
  */
61
61
  export const Pagination = memo(
62
62
  ({ page, ranges, totalPages, minimal, onPageChange }: PaginationProps) => {
@@ -70,7 +70,7 @@ export const Pagination = memo(
70
70
  key={pg}
71
71
  onClick={() => onPageChange(pg)}
72
72
  className={classNames(
73
- "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full",
73
+ "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer",
74
74
  page === pg && "bg-primary-500 text-white pointer-events-none",
75
75
  )}
76
76
  >
@@ -87,7 +87,7 @@ export const Pagination = memo(
87
87
  key={pg}
88
88
  onClick={() => onPageChange(pg)}
89
89
  className={classNames(
90
- "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full",
90
+ "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer",
91
91
  page === pg && "bg-primary-500 text-white pointer-events-none",
92
92
  )}
93
93
  >
@@ -104,7 +104,7 @@ export const Pagination = memo(
104
104
  key={pg}
105
105
  onClick={() => onPageChange(pg)}
106
106
  className={classNames(
107
- "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full",
107
+ "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer",
108
108
  page === pg && "bg-primary-500 text-white pointer-events-none",
109
109
  )}
110
110
  >
@@ -121,7 +121,7 @@ export const Pagination = memo(
121
121
  <button
122
122
  onClick={() => onPageChange(0)}
123
123
  className={classNames(
124
- "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full",
124
+ "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer",
125
125
  page === 0 && "pointer-events-none text-tint-300",
126
126
  )}
127
127
  >
@@ -130,7 +130,7 @@ export const Pagination = memo(
130
130
  <button
131
131
  onClick={() => onPageChange(page - 1)}
132
132
  className={classNames(
133
- "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full",
133
+ "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer",
134
134
  page === 0 && "pointer-events-none text-tint-300",
135
135
  )}
136
136
  >
@@ -145,7 +145,7 @@ export const Pagination = memo(
145
145
  <button
146
146
  onClick={() => onPageChange(page + 1)}
147
147
  className={classNames(
148
- "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full",
148
+ "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer",
149
149
  page + 1 >= totalPages && "pointer-events-none text-tint-300",
150
150
  )}
151
151
  >
@@ -154,7 +154,7 @@ export const Pagination = memo(
154
154
  <button
155
155
  onClick={() => onPageChange(totalPages - 1)}
156
156
  className={classNames(
157
- "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full",
157
+ "leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full cursor-pointer",
158
158
  page + 1 >= totalPages && "pointer-events-none text-tint-300",
159
159
  )}
160
160
  >
@@ -22,38 +22,16 @@
22
22
  */
23
23
 
24
24
  import { DateDisplay } from "@react-fabric/date";
25
- import {
26
- Format,
27
- getByPath,
28
- isArray,
29
- isObject,
30
- isTrue,
31
- } from "@react-fabric/utilities";
25
+ import { Format, getByPath, isArray, isObject, isTrue } from "@react-fabric/utilities";
32
26
  import classNames from "classnames";
33
27
  import { useMemo } from "react";
34
- import { useTableContext } from "./Context";
35
- import {
36
- COL_DEFAULT_WIDTH,
37
- COL_MAX_WIDTH,
38
- COL_MIN_WIDTH,
39
- type TableColumn,
40
- } from "./types";
28
+ import { useTableContext } from "./context";
29
+ import { COL_DEFAULT_WIDTH, COL_MAX_WIDTH, COL_MIN_WIDTH, type TableColumn } from "./types";
41
30
 
42
- export const BodyCell = ({
43
- column,
44
- item,
45
- index,
46
- }: {
47
- column: TableColumn;
48
- item: KeyValue;
49
- index: number;
50
- }) => {
31
+ export const BodyCell = ({ column, item, index }: { column: TableColumn; item: KeyValue; index: number }) => {
51
32
  const { widths } = useTableContext();
52
33
 
53
- const width = useMemo(
54
- () => widths.get(column.id.toString()) ?? column.width,
55
- [widths, column],
56
- );
34
+ const width = useMemo(() => widths.get(column.id.toString()) ?? column.width, [widths, column]);
57
35
 
58
36
  const content = useMemo(() => {
59
37
  const value = getByPath(item, column.id.toString());
@@ -65,10 +43,7 @@ export const BodyCell = ({
65
43
  return map[`${isTrue(value) ? "true" : "false"}`];
66
44
  }
67
45
  if (column.valueMap != null) {
68
- if (
69
- ["number", "string"].includes(column.dataType ?? "string") &&
70
- value in column.valueMap
71
- ) {
46
+ if (["number", "string"].includes(column.dataType ?? "string") && value in column.valueMap) {
72
47
  return column.valueMap[value];
73
48
  }
74
49
  }
@@ -22,26 +22,13 @@
22
22
  */
23
23
 
24
24
  import { useMemo } from "react";
25
- import { useTableContext } from "./Context";
26
- import {
27
- COL_DEFAULT_WIDTH,
28
- COL_MAX_WIDTH,
29
- COL_MIN_WIDTH,
30
- type TableColumn,
31
- } from "./types";
25
+ import { useTableContext } from "./context";
26
+ import { COL_DEFAULT_WIDTH, COL_MAX_WIDTH, COL_MIN_WIDTH, type TableColumn } from "./types";
32
27
 
33
- export const EmptyCell = ({
34
- id,
35
- width: _width,
36
- maxWidth,
37
- minWidth,
38
- }: TableColumn) => {
28
+ export const EmptyCell = ({ id, width: _width, maxWidth, minWidth }: TableColumn) => {
39
29
  const { widths } = useTableContext();
40
30
 
41
- const width = useMemo(
42
- () => widths.get(id.toString()) ?? _width,
43
- [widths, id, _width],
44
- );
31
+ const width = useMemo(() => widths.get(id.toString()) ?? _width, [widths, id, _width]);
45
32
 
46
33
  return (
47
34
  <div
@@ -21,27 +21,12 @@
21
21
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
- import {
25
- Button,
26
- Divider,
27
- DropdownTool,
28
- getIconProps,
29
- Icon,
30
- Menu,
31
- MenuItem,
32
- Tooltip,
33
- } from "@react-fabric/core";
24
+ import { Button, Divider, DropdownTool, getIconProps, Icon, Menu, MenuItem, Tooltip } from "@react-fabric/core";
34
25
  import { isEmpty } from "@react-fabric/utilities";
35
26
  import { useCallback, useMemo } from "react";
36
27
  import { ColumnFilters } from "./ColumnFilters";
37
- import { useTableContext } from "./Context";
38
- import {
39
- COL_DEFAULT_WIDTH,
40
- COL_MAX_WIDTH,
41
- COL_MIN_WIDTH,
42
- type TableColumn,
43
- type TableProps,
44
- } from "./types";
28
+ import { useTableContext } from "./context";
29
+ import { COL_DEFAULT_WIDTH, COL_MAX_WIDTH, COL_MIN_WIDTH, type TableColumn, type TableProps } from "./types";
45
30
 
46
31
  export const HeaderCell = ({
47
32
  id,
@@ -66,18 +51,14 @@ export const HeaderCell = ({
66
51
  }: TableColumn & Pick<TableProps, "sort" | "onSort" | "onFilter">) => {
67
52
  const { startResize, widths } = useTableContext();
68
53
 
69
- const width = useMemo(
70
- () => widths.get(id.toString()) ?? _width,
71
- [widths, _width, id],
72
- );
54
+ const width = useMemo(() => widths.get(id.toString()) ?? _width, [widths, _width, id]);
73
55
 
74
56
  const handleSort = useCallback(
75
57
  (order?: "asc" | "desc") => {
76
58
  sortable &&
77
59
  onSort?.({
78
60
  id: id.toString(),
79
- order:
80
- order ?? (sort?.id === id && sort.order === "asc" ? "desc" : "asc"),
61
+ order: order ?? (sort?.id === id && sort.order === "asc" ? "desc" : "asc"),
81
62
  });
82
63
  },
83
64
  [onSort, sort, sortable],
@@ -87,12 +68,7 @@ export const HeaderCell = ({
87
68
  let ret = [];
88
69
  if (filterable && (dataType ?? filterOptions)) {
89
70
  ret.push(
90
- <Menu
91
- key="filters"
92
- label="Filter"
93
- icon={filter ? "icon-[mdi--check]" : ""}
94
- trigger="click"
95
- >
71
+ <Menu key="filters" label="Filter" icon={filter ? "icon-[mdi--check]" : ""} trigger="click">
96
72
  <ColumnFilters
97
73
  type={dataType}
98
74
  list={filterOptions}
@@ -104,12 +80,7 @@ export const HeaderCell = ({
104
80
  }
105
81
  if (sortable) {
106
82
  ret.push(
107
- <MenuItem
108
- key="sort-asc"
109
- label="Sort ascending"
110
- icon="icon-[mdi--sort-ascending]"
111
- onClick={() => handleSort("asc")}
112
- />,
83
+ <MenuItem key="sort-asc" label="Sort ascending" icon="icon-[mdi--sort-ascending]" onClick={() => handleSort("asc")} />,
113
84
  <MenuItem
114
85
  key="sort-desc"
115
86
  label="Sort descending"
@@ -149,7 +120,7 @@ export const HeaderCell = ({
149
120
  }}
150
121
  >
151
122
  <Tooltip content={tooltip ?? label} disabled={!(tooltip ?? label)}>
152
- <div className="flex-initial px-2 py-1 text-sm truncate sticky start-0">
123
+ <div className="flex-initial px-2 py-1 text-sm truncate sticky inset-s-0">
153
124
  {icon && <Icon {...getIconProps(icon)} />}
154
125
  <span>{label ?? " "}</span>
155
126
  </div>
@@ -180,10 +151,7 @@ export const HeaderCell = ({
180
151
  <div
181
152
  role="none"
182
153
  className="cursor-col-resize border-e bg-transparent border-tint-200 w-[5px] self-stretch"
183
- onMouseDown={(e) =>
184
- e.currentTarget.parentElement &&
185
- startResize(e.currentTarget.parentElement)
186
- }
154
+ onMouseDown={(e) => e.currentTarget.parentElement && startResize(e.currentTarget.parentElement)}
187
155
  />
188
156
  )}
189
157
  </div>