@react-fabric/data 1.0.0-beta.56 → 1.0.0-beta.58

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,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
3
4
  var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
4
5
  var core = require('@react-fabric/core');
5
6
  var utilities = require('@react-fabric/utilities');
@@ -9,15 +10,14 @@ var Context = require('./Context.js');
9
10
  var types = require('./types.js');
10
11
  var jsxRuntime = require('react/jsx-runtime');
11
12
 
13
+ 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; }
14
+ 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; }
12
15
  var HeaderCell = function HeaderCell(_ref) {
13
16
  var id = _ref.id,
14
17
  field = _ref.field,
15
18
  dataType = _ref.dataType,
16
19
  label = _ref.label,
17
20
  icon = _ref.icon,
18
- iconBg = _ref.iconBg,
19
- iconColor = _ref.iconColor,
20
- rtlFlip = _ref.rtlFlip,
21
21
  actions = _ref.actions;
22
22
  _ref.locked;
23
23
  var filter = _ref.filter,
@@ -111,12 +111,7 @@ var HeaderCell = function HeaderCell(_ref) {
111
111
  disabled: !(tooltip !== null && tooltip !== void 0 ? tooltip : label),
112
112
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
113
113
  className: "flex-initial px-2 py-1 text-sm truncate sticky start-0",
114
- children: [icon && /*#__PURE__*/jsxRuntime.jsx(core.Icon, {
115
- icon: icon,
116
- bg: iconBg,
117
- color: iconColor,
118
- rtlFlip: rtlFlip
119
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
114
+ children: [icon && /*#__PURE__*/jsxRuntime.jsx(core.Icon, _objectSpread({}, core.getIconProps(icon))), /*#__PURE__*/jsxRuntime.jsx("span", {
120
115
  children: label !== null && label !== void 0 ? label : " "
121
116
  })]
122
117
  })
@@ -52,7 +52,9 @@ var TreeNode = function TreeNode(_ref) {
52
52
  }, [noLines, node.lines]);
53
53
  var nodeIcon = react.useMemo(function () {
54
54
  if (node.icon) return node.icon;
55
- return node.leaf ? defaultLeafIcon : defaultNodeIcon;
55
+ return {
56
+ icon: node.leaf ? defaultLeafIcon : defaultNodeIcon
57
+ };
56
58
  }, [defaultLeafIcon, defaultNodeIcon, node.icon]);
57
59
  var canCheck = react.useMemo(function () {
58
60
  return checkable === true || checkable === "leafOnly" && node.leaf;
@@ -102,12 +104,7 @@ var TreeNode = function TreeNode(_ref) {
102
104
  },
103
105
  children: [nodeIcon && /*#__PURE__*/jsxRuntime.jsxs("div", {
104
106
  className: "flex-content max-w-6 me-1 self-center leading-none",
105
- children: [/*#__PURE__*/react.isValidElement(nodeIcon) && nodeIcon, utilities.isString(nodeIcon) && /*#__PURE__*/jsxRuntime.jsx(core.Icon, {
106
- icon: nodeIcon,
107
- bg: node.iconBg,
108
- color: node.iconColor,
109
- rtlFlip: node.rtlFlip
110
- })]
107
+ children: [/*#__PURE__*/react.isValidElement(nodeIcon) && nodeIcon, utilities.isString(nodeIcon) && /*#__PURE__*/jsxRuntime.jsx(core.Icon, _objectSpread({}, core.getIconProps(nodeIcon)))]
111
108
  }), node.childSelected && !node.open && /*#__PURE__*/jsxRuntime.jsx("span", {
112
109
  className: " flex-content text-primary-500",
113
110
  children: "\u2022"
@@ -211,9 +211,8 @@ var _VirtualGallery = function _VirtualGallery(_ref) {
211
211
  }, "".concat(key, ":").concat(col));
212
212
  })
213
213
  }, key);
214
- }), onLoadMore && /*#__PURE__*/jsxRuntime.jsx("div", {
215
- className: "h-16",
216
- children: loading && /*#__PURE__*/jsxRuntime.jsx(core.Skeleton, {})
214
+ }), loading && /*#__PURE__*/jsxRuntime.jsx("div", {
215
+ children: /*#__PURE__*/jsxRuntime.jsx(core.Skeleton, {})
217
216
  })]
218
217
  })
219
218
  }), !hideScroller && /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -39,35 +39,43 @@ var Scroller = function Scroller(_ref) {
39
39
  variant: "link",
40
40
  className: "outline",
41
41
  children: [/*#__PURE__*/jsxRuntime.jsx(core.Button, {
42
- rtlFlip: true,
43
42
  size: "sm",
44
43
  variant: "link",
45
44
  "aria-label": "scroll to top",
46
- icon: vertical ? core.CoreIcons.chevronsUp : core.CoreIcons.chevronsLeft,
45
+ icon: {
46
+ icon: vertical ? core.CoreIcons.chevronsUp : core.CoreIcons.chevronsLeft,
47
+ rtlFlip: true
48
+ },
47
49
  disabled: (scrollActive & 2) === 0,
48
50
  onClick: onStart
49
51
  }), /*#__PURE__*/jsxRuntime.jsx(core.Button, {
50
- rtlFlip: true,
51
52
  size: "sm",
52
53
  variant: "link",
53
54
  "aria-label": "scroll up",
54
- icon: vertical ? core.CoreIcons.chevronUp : core.CoreIcons.chevronLeft,
55
+ icon: {
56
+ icon: vertical ? core.CoreIcons.chevronUp : core.CoreIcons.chevronLeft,
57
+ rtlFlip: true
58
+ },
55
59
  disabled: (scrollActive & 2) === 0,
56
60
  onClick: onPrevious
57
61
  }), /*#__PURE__*/jsxRuntime.jsx(core.Button, {
58
- rtlFlip: true,
59
62
  size: "sm",
60
63
  variant: "link",
61
64
  "aria-label": "scroll down",
62
- icon: vertical ? core.CoreIcons.chevronDown : core.CoreIcons.chevronRight,
65
+ icon: {
66
+ icon: vertical ? core.CoreIcons.chevronDown : core.CoreIcons.chevronRight,
67
+ rtlFlip: true
68
+ },
63
69
  disabled: scrollActive % 2 === 0,
64
70
  onClick: onNext
65
71
  }), /*#__PURE__*/jsxRuntime.jsx(core.Button, {
66
- rtlFlip: true,
67
72
  size: "sm",
68
73
  variant: "link",
69
74
  "aria-label": "scroll to bottom",
70
- icon: vertical ? core.CoreIcons.chevronsDown : core.CoreIcons.chevronsRight,
75
+ icon: {
76
+ icon: vertical ? core.CoreIcons.chevronsDown : core.CoreIcons.chevronsRight,
77
+ rtlFlip: true
78
+ },
71
79
  disabled: scrollActive % 2 === 0,
72
80
  onClick: onEnd
73
81
  })]
@@ -1,7 +1,8 @@
1
1
  'use client';
2
2
 
3
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
4
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
4
- import { Menu, CoreIcons, MenuItem, Divider, Tooltip, Icon, DropdownTool, Button } from '@react-fabric/core';
5
+ import { Menu, CoreIcons, MenuItem, Divider, Tooltip, Icon, getIconProps, DropdownTool, Button } from '@react-fabric/core';
5
6
  import { isEmpty } from '@react-fabric/utilities';
6
7
  import { useMemo, useCallback } from 'react';
7
8
  import { ColumnFilters } from './ColumnFilters.js';
@@ -9,15 +10,14 @@ import { useTableContext } from './Context.js';
9
10
  import { COL_DEFAULT_WIDTH, COL_MIN_WIDTH, COL_MAX_WIDTH } from './types.js';
10
11
  import { jsx, jsxs } from 'react/jsx-runtime';
11
12
 
13
+ 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; }
14
+ 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; }
12
15
  var HeaderCell = function HeaderCell(_ref) {
13
16
  var id = _ref.id,
14
17
  field = _ref.field,
15
18
  dataType = _ref.dataType,
16
19
  label = _ref.label,
17
20
  icon = _ref.icon,
18
- iconBg = _ref.iconBg,
19
- iconColor = _ref.iconColor,
20
- rtlFlip = _ref.rtlFlip,
21
21
  actions = _ref.actions;
22
22
  _ref.locked;
23
23
  var filter = _ref.filter,
@@ -111,12 +111,7 @@ var HeaderCell = function HeaderCell(_ref) {
111
111
  disabled: !(tooltip !== null && tooltip !== void 0 ? tooltip : label),
112
112
  children: /*#__PURE__*/jsxs("div", {
113
113
  className: "flex-initial px-2 py-1 text-sm truncate sticky start-0",
114
- children: [icon && /*#__PURE__*/jsx(Icon, {
115
- icon: icon,
116
- bg: iconBg,
117
- color: iconColor,
118
- rtlFlip: rtlFlip
119
- }), /*#__PURE__*/jsx("span", {
114
+ children: [icon && /*#__PURE__*/jsx(Icon, _objectSpread({}, getIconProps(icon))), /*#__PURE__*/jsx("span", {
120
115
  children: label !== null && label !== void 0 ? label : " "
121
116
  })]
122
117
  })
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
- import { getBadgeProps, Icon, CoreIcons, Badge } from '@react-fabric/core';
4
+ import { getBadgeProps, Icon, CoreIcons, getIconProps, Badge } from '@react-fabric/core';
5
5
  import { isString, isEmpty } from '@react-fabric/utilities';
6
6
  import classNames from 'classnames';
7
7
  import { useMemo, isValidElement } from 'react';
@@ -52,7 +52,9 @@ var TreeNode = function TreeNode(_ref) {
52
52
  }, [noLines, node.lines]);
53
53
  var nodeIcon = useMemo(function () {
54
54
  if (node.icon) return node.icon;
55
- return node.leaf ? defaultLeafIcon : defaultNodeIcon;
55
+ return {
56
+ icon: node.leaf ? defaultLeafIcon : defaultNodeIcon
57
+ };
56
58
  }, [defaultLeafIcon, defaultNodeIcon, node.icon]);
57
59
  var canCheck = useMemo(function () {
58
60
  return checkable === true || checkable === "leafOnly" && node.leaf;
@@ -102,12 +104,7 @@ var TreeNode = function TreeNode(_ref) {
102
104
  },
103
105
  children: [nodeIcon && /*#__PURE__*/jsxs("div", {
104
106
  className: "flex-content max-w-6 me-1 self-center leading-none",
105
- children: [/*#__PURE__*/isValidElement(nodeIcon) && nodeIcon, isString(nodeIcon) && /*#__PURE__*/jsx(Icon, {
106
- icon: nodeIcon,
107
- bg: node.iconBg,
108
- color: node.iconColor,
109
- rtlFlip: node.rtlFlip
110
- })]
107
+ children: [/*#__PURE__*/isValidElement(nodeIcon) && nodeIcon, isString(nodeIcon) && /*#__PURE__*/jsx(Icon, _objectSpread({}, getIconProps(nodeIcon)))]
111
108
  }), node.childSelected && !node.open && /*#__PURE__*/jsx("span", {
112
109
  className: " flex-content text-primary-500",
113
110
  children: "\u2022"
@@ -211,9 +211,8 @@ var _VirtualGallery = function _VirtualGallery(_ref) {
211
211
  }, "".concat(key, ":").concat(col));
212
212
  })
213
213
  }, key);
214
- }), onLoadMore && /*#__PURE__*/jsx("div", {
215
- className: "h-16",
216
- children: loading && /*#__PURE__*/jsx(Skeleton, {})
214
+ }), loading && /*#__PURE__*/jsx("div", {
215
+ children: /*#__PURE__*/jsx(Skeleton, {})
217
216
  })]
218
217
  })
219
218
  }), !hideScroller && /*#__PURE__*/jsx("div", {
@@ -39,35 +39,43 @@ var Scroller = function Scroller(_ref) {
39
39
  variant: "link",
40
40
  className: "outline",
41
41
  children: [/*#__PURE__*/jsx(Button, {
42
- rtlFlip: true,
43
42
  size: "sm",
44
43
  variant: "link",
45
44
  "aria-label": "scroll to top",
46
- icon: vertical ? CoreIcons.chevronsUp : CoreIcons.chevronsLeft,
45
+ icon: {
46
+ icon: vertical ? CoreIcons.chevronsUp : CoreIcons.chevronsLeft,
47
+ rtlFlip: true
48
+ },
47
49
  disabled: (scrollActive & 2) === 0,
48
50
  onClick: onStart
49
51
  }), /*#__PURE__*/jsx(Button, {
50
- rtlFlip: true,
51
52
  size: "sm",
52
53
  variant: "link",
53
54
  "aria-label": "scroll up",
54
- icon: vertical ? CoreIcons.chevronUp : CoreIcons.chevronLeft,
55
+ icon: {
56
+ icon: vertical ? CoreIcons.chevronUp : CoreIcons.chevronLeft,
57
+ rtlFlip: true
58
+ },
55
59
  disabled: (scrollActive & 2) === 0,
56
60
  onClick: onPrevious
57
61
  }), /*#__PURE__*/jsx(Button, {
58
- rtlFlip: true,
59
62
  size: "sm",
60
63
  variant: "link",
61
64
  "aria-label": "scroll down",
62
- icon: vertical ? CoreIcons.chevronDown : CoreIcons.chevronRight,
65
+ icon: {
66
+ icon: vertical ? CoreIcons.chevronDown : CoreIcons.chevronRight,
67
+ rtlFlip: true
68
+ },
63
69
  disabled: scrollActive % 2 === 0,
64
70
  onClick: onNext
65
71
  }), /*#__PURE__*/jsx(Button, {
66
- rtlFlip: true,
67
72
  size: "sm",
68
73
  variant: "link",
69
74
  "aria-label": "scroll to bottom",
70
- icon: vertical ? CoreIcons.chevronsDown : CoreIcons.chevronsRight,
75
+ icon: {
76
+ icon: vertical ? CoreIcons.chevronsDown : CoreIcons.chevronsRight,
77
+ rtlFlip: true
78
+ },
71
79
  disabled: scrollActive % 2 === 0,
72
80
  onClick: onEnd
73
81
  })]
@@ -1,2 +1,2 @@
1
1
  import { type TableColumn, type TableProps } from "./types";
2
- export declare const HeaderCell: ({ id, field, dataType, label, icon, iconBg, iconColor, rtlFlip, actions, locked, filter, filterable, filterOptions, tooltip, sortable, resizable, width: _width, maxWidth, minWidth, sort, onSort, onFilter, }: TableColumn & Pick<TableProps, "sort" | "onSort" | "onFilter">) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const HeaderCell: ({ id, field, dataType, label, icon, actions, locked, filter, filterable, filterOptions, tooltip, sortable, resizable, width: _width, maxWidth, minWidth, sort, onSort, onFilter, }: TableColumn & Pick<TableProps, "sort" | "onSort" | "onFilter">) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,5 @@
1
- import { type CssProp, type Elements, type IconProps, type RefProp, type TestProps } from "@react-fabric/core/dist/types/types";
1
+ import { IconProps } from "@react-fabric/core/dist/types/components/icon/Icon";
2
+ import { type CssProp, type Elements, type RefProp, type TestProps } from "@react-fabric/core/dist/types/types";
2
3
  import { type ReactElement } from "react";
3
4
  export declare const COL_MIN_WIDTH = "3rem";
4
5
  export declare const COL_MAX_WIDTH = "64rem";
@@ -31,11 +32,12 @@ export declare const COL_DEFAULT_WIDTH = "12rem";
31
32
  * @property {KeyValue} [valueMap] - Mapping of values for the column.
32
33
  * @property {(value: AnyObject, data: T, index: number) => Elements<AnyObject>} [renderer] - Custom renderer function for the column values.
33
34
  */
34
- export interface TableColumn<T = KeyValue> extends CssProp, IconProps, TestProps {
35
+ export interface TableColumn<T = KeyValue> extends CssProp, TestProps {
35
36
  id: keyof T | string;
36
37
  field?: string;
37
38
  label?: string;
38
39
  tooltip?: string;
40
+ icon?: IconProps;
39
41
  actions?: ReactElement[];
40
42
  align?: "start" | "center" | "end";
41
43
  locked?: "start" | "end";
@@ -1,10 +1,15 @@
1
- import { type BadgeType, type ChildProp, type CssProp, type Elements, type IconProps, type RefProp, type TestProps } from "@react-fabric/core/dist/types/types";
2
- interface TreeBaseNode<T> extends Omit<IconProps, "icon">, CssProp, TestProps {
1
+ import { IconProps } from "@react-fabric/core/dist/types/components/icon/Icon";
2
+ import { type BadgeType, type ChildProp, type CssProp, type Elements, type RefProp, type TestProps } from "@react-fabric/core/dist/types/types";
3
+ interface TreeBaseNode<T> extends CssProp, TestProps {
3
4
  id: string;
4
5
  /**
5
6
  * display label
6
7
  */
7
8
  label: Elements<JSX.Element>;
9
+ /**
10
+ * icon path or props
11
+ */
12
+ icon?: IconProps;
8
13
  /**
9
14
  * full text to be used for querying purposes
10
15
  */
@@ -22,7 +27,6 @@ interface TreeBaseNode<T> extends Omit<IconProps, "icon">, CssProp, TestProps {
22
27
  */
23
28
  disabled?: boolean;
24
29
  data?: T;
25
- icon?: Elements<JSX.Element>;
26
30
  }
27
31
  export type TreeNodeType<T extends KeyValue = KeyValue> = TreeBaseNode<T> & ({
28
32
  leaf: true;
@@ -33,7 +37,7 @@ export type TreeNodeType<T extends KeyValue = KeyValue> = TreeBaseNode<T> & ({
33
37
  open?: boolean;
34
38
  iconOpen?: string;
35
39
  });
36
- export interface InternalNode extends Omit<IconProps, "icon">, CssProp, TestProps {
40
+ export interface InternalNode extends CssProp, TestProps {
37
41
  id: string;
38
42
  label: Elements<JSX.Element>;
39
43
  queryable?: string;
@@ -50,7 +54,7 @@ export interface InternalNode extends Omit<IconProps, "icon">, CssProp, TestProp
50
54
  loaded: boolean;
51
55
  parent?: string;
52
56
  empty?: boolean;
53
- icon?: Elements<JSX.Element>;
57
+ icon?: IconProps;
54
58
  errored?: string;
55
59
  selected?: true;
56
60
  childSelected?: true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-fabric/data",
3
- "version": "1.0.0-beta.56",
3
+ "version": "1.0.0-beta.58",
4
4
  "description": "RUF: Data package",
5
5
  "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
6
  "license": "MIT",
@@ -35,24 +35,24 @@
35
35
  "watch": "npm-run-all -p watch:rollup watch:dts"
36
36
  },
37
37
  "dependencies": {
38
- "@react-fabric/core": "^1.0.0-beta.55",
39
- "@react-fabric/date": "^1.0.0-beta.55",
40
- "@react-fabric/form": "^1.0.0-beta.56",
41
- "@react-fabric/utilities": "^1.0.0-beta.52",
42
- "@tanstack/react-virtual": "^3.13.9",
43
- "classnames": "^2.5.1",
44
- "color": "^4.2.3",
45
- "memoize-one": "^6.0.0"
38
+ "@react-fabric/core": "^1.0.0-beta.58",
39
+ "@react-fabric/date": "^1.0.0-beta.58",
40
+ "@react-fabric/form": "^1.0.0-beta.58",
41
+ "@react-fabric/utilities": "^1.0.0-beta.58",
42
+ "@tanstack/react-virtual": "~3.13.12",
43
+ "classnames": "~2.5.1",
44
+ "color": "~5.0.2",
45
+ "memoize-one": "~6.0.0"
46
46
  },
47
47
  "peerDependencies": {
48
- "i18next": "^25.2.1",
49
- "react": "^19.0.0",
50
- "react-dom": "^19.0.0",
51
- "react-i18next": "^15.5.2"
48
+ "i18next": "~25.6.0",
49
+ "react": "~19.2.0",
50
+ "react-dom": "~19.2.0",
51
+ "react-i18next": "~16.2.1"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=18.12.0",
55
55
  "npm": ">=8.19.0"
56
56
  },
57
- "gitHead": "fd9dd6cfd1a58efb5c4bfb6446928a78cb4f4266"
57
+ "gitHead": "7e66f8c498e37a40e410ecafff2ea6b31505dc1a"
58
58
  }
@@ -26,6 +26,7 @@ import {
26
26
  CoreIcons,
27
27
  Divider,
28
28
  DropdownTool,
29
+ getIconProps,
29
30
  Icon,
30
31
  Menu,
31
32
  MenuItem,
@@ -49,9 +50,6 @@ export const HeaderCell = ({
49
50
  dataType,
50
51
  label,
51
52
  icon,
52
- iconBg,
53
- iconColor,
54
- rtlFlip,
55
53
  actions,
56
54
  locked,
57
55
  filter,
@@ -153,9 +151,7 @@ export const HeaderCell = ({
153
151
  >
154
152
  <Tooltip content={tooltip ?? label} disabled={!(tooltip ?? label)}>
155
153
  <div className="flex-initial px-2 py-1 text-sm truncate sticky start-0">
156
- {icon && (
157
- <Icon icon={icon} bg={iconBg} color={iconColor} rtlFlip={rtlFlip} />
158
- )}
154
+ {icon && <Icon {...getIconProps(icon)} />}
159
155
  <span>{label ?? " "}</span>
160
156
  </div>
161
157
  </Tooltip>
@@ -21,10 +21,10 @@
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 { IconProps } from "@react-fabric/core/dist/types/components/icon/Icon";
24
25
  import {
25
26
  type CssProp,
26
27
  type Elements,
27
- type IconProps,
28
28
  type RefProp,
29
29
  type TestProps,
30
30
  } from "@react-fabric/core/dist/types/types";
@@ -62,14 +62,12 @@ export const COL_DEFAULT_WIDTH = "12rem";
62
62
  * @property {KeyValue} [valueMap] - Mapping of values for the column.
63
63
  * @property {(value: AnyObject, data: T, index: number) => Elements<AnyObject>} [renderer] - Custom renderer function for the column values.
64
64
  */
65
- export interface TableColumn<T = KeyValue>
66
- extends CssProp,
67
- IconProps,
68
- TestProps {
65
+ export interface TableColumn<T = KeyValue> extends CssProp, TestProps {
69
66
  id: keyof T | string;
70
67
  field?: string;
71
68
  label?: string;
72
69
  tooltip?: string;
70
+ icon?: IconProps;
73
71
  actions?: ReactElement[];
74
72
  align?: "start" | "center" | "end";
75
73
  locked?: "start" | "end";
@@ -21,7 +21,13 @@
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 { Badge, CoreIcons, getBadgeProps, Icon } from "@react-fabric/core";
24
+ import {
25
+ Badge,
26
+ CoreIcons,
27
+ getBadgeProps,
28
+ getIconProps,
29
+ Icon,
30
+ } from "@react-fabric/core";
25
31
  import { isEmpty, isString } from "@react-fabric/utilities";
26
32
  import classNames from "classnames";
27
33
  import { isValidElement, useMemo } from "react";
@@ -79,7 +85,7 @@ export const TreeNode = ({
79
85
 
80
86
  const nodeIcon = useMemo(() => {
81
87
  if (node.icon) return node.icon;
82
- return node.leaf ? defaultLeafIcon : defaultNodeIcon;
88
+ return { icon: node.leaf ? defaultLeafIcon : defaultNodeIcon };
83
89
  }, [defaultLeafIcon, defaultNodeIcon, node.icon]);
84
90
 
85
91
  const canCheck = useMemo(() => {
@@ -167,14 +173,7 @@ export const TreeNode = ({
167
173
  {nodeIcon && (
168
174
  <div className="flex-content max-w-6 me-1 self-center leading-none">
169
175
  {isValidElement(nodeIcon) && nodeIcon}
170
- {isString(nodeIcon) && (
171
- <Icon
172
- icon={nodeIcon}
173
- bg={node.iconBg}
174
- color={node.iconColor}
175
- rtlFlip={node.rtlFlip}
176
- />
177
- )}
176
+ {isString(nodeIcon) && <Icon {...getIconProps(nodeIcon)} />}
178
177
  </div>
179
178
  )}
180
179
  {node.childSelected && !node.open && (
package/src/tree/types.ts CHANGED
@@ -21,22 +21,26 @@
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 { IconProps } from "@react-fabric/core/dist/types/components/icon/Icon";
24
25
  import {
25
26
  type BadgeType,
26
27
  type ChildProp,
27
28
  type CssProp,
28
29
  type Elements,
29
- type IconProps,
30
30
  type RefProp,
31
31
  type TestProps,
32
32
  } from "@react-fabric/core/dist/types/types";
33
33
 
34
- interface TreeBaseNode<T> extends Omit<IconProps, "icon">, CssProp, TestProps {
34
+ interface TreeBaseNode<T> extends CssProp, TestProps {
35
35
  id: string;
36
36
  /**
37
37
  * display label
38
38
  */
39
39
  label: Elements<JSX.Element>;
40
+ /**
41
+ * icon path or props
42
+ */
43
+ icon?: IconProps;
40
44
  /**
41
45
  * full text to be used for querying purposes
42
46
  */
@@ -54,8 +58,6 @@ interface TreeBaseNode<T> extends Omit<IconProps, "icon">, CssProp, TestProps {
54
58
  */
55
59
  disabled?: boolean;
56
60
  data?: T;
57
-
58
- icon?: Elements<JSX.Element>;
59
61
  }
60
62
 
61
63
  export type TreeNodeType<T extends KeyValue = KeyValue> = TreeBaseNode<T> &
@@ -69,10 +71,7 @@ export type TreeNodeType<T extends KeyValue = KeyValue> = TreeBaseNode<T> &
69
71
  }
70
72
  );
71
73
 
72
- export interface InternalNode
73
- extends Omit<IconProps, "icon">,
74
- CssProp,
75
- TestProps {
74
+ export interface InternalNode extends CssProp, TestProps {
76
75
  id: string;
77
76
  label: Elements<JSX.Element>;
78
77
  queryable?: string;
@@ -89,7 +88,7 @@ export interface InternalNode
89
88
  loaded: boolean;
90
89
  parent?: string;
91
90
  empty?: boolean;
92
- icon?: Elements<JSX.Element>;
91
+ icon?: IconProps;
93
92
  errored?: string;
94
93
  selected?: true;
95
94
  childSelected?: true;
@@ -337,8 +337,10 @@ const _VirtualGallery = <T extends AnyObject>({
337
337
  ))}
338
338
  </div>
339
339
  ))}
340
- {onLoadMore && (
341
- <div className="h-16">{loading && <Skeleton />}</div>
340
+ {loading && (
341
+ <div>
342
+ <Skeleton />
343
+ </div>
342
344
  )}
343
345
  </div>
344
346
  </div>
@@ -41,38 +41,46 @@ export const Scroller = ({
41
41
  return (
42
42
  <ButtonGroup vertical={vertical} variant="link" className="outline">
43
43
  <Button
44
- rtlFlip
45
44
  size="sm"
46
45
  variant="link"
47
46
  aria-label="scroll to top"
48
- icon={vertical ? CoreIcons.chevronsUp : CoreIcons.chevronsLeft}
47
+ icon={{
48
+ icon: vertical ? CoreIcons.chevronsUp : CoreIcons.chevronsLeft,
49
+ rtlFlip: true,
50
+ }}
49
51
  disabled={(scrollActive & 2) === 0}
50
52
  onClick={onStart}
51
53
  />
52
54
  <Button
53
- rtlFlip
54
55
  size="sm"
55
56
  variant="link"
56
57
  aria-label="scroll up"
57
- icon={vertical ? CoreIcons.chevronUp : CoreIcons.chevronLeft}
58
+ icon={{
59
+ icon: vertical ? CoreIcons.chevronUp : CoreIcons.chevronLeft,
60
+ rtlFlip: true,
61
+ }}
58
62
  disabled={(scrollActive & 2) === 0}
59
63
  onClick={onPrevious}
60
64
  />
61
65
  <Button
62
- rtlFlip
63
66
  size="sm"
64
67
  variant="link"
65
68
  aria-label="scroll down"
66
- icon={vertical ? CoreIcons.chevronDown : CoreIcons.chevronRight}
69
+ icon={{
70
+ icon: vertical ? CoreIcons.chevronDown : CoreIcons.chevronRight,
71
+ rtlFlip: true,
72
+ }}
67
73
  disabled={scrollActive % 2 === 0}
68
74
  onClick={onNext}
69
75
  />
70
76
  <Button
71
- rtlFlip
72
77
  size="sm"
73
78
  variant="link"
74
79
  aria-label="scroll to bottom"
75
- icon={vertical ? CoreIcons.chevronsDown : CoreIcons.chevronsRight}
80
+ icon={{
81
+ icon: vertical ? CoreIcons.chevronsDown : CoreIcons.chevronsRight,
82
+ rtlFlip: true,
83
+ }}
76
84
  disabled={scrollActive % 2 === 0}
77
85
  onClick={onEnd}
78
86
  />