@react-fabric/data 1.0.0-beta.49 → 1.0.0-beta.51

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.
@@ -66,8 +66,9 @@ var _VirtualGallery = function _VirtualGallery(_ref) {
66
66
  if (scrollerRef.current) {
67
67
  var el = scrollerRef.current;
68
68
  var handler = function handler() {
69
- var _el$offsetWidth;
70
- setColumnCount(columns !== null && columns !== void 0 ? columns : Math.max(1, Math.floor((((_el$offsetWidth = el === null || el === void 0 ? void 0 : el.offsetWidth) !== null && _el$offsetWidth !== void 0 ? _el$offsetWidth : 800) - 32) / width)));
69
+ var _getComputedStyle$pad, _el$firstElementChild, _el$offsetWidth;
70
+ var pad = parseInt((_getComputedStyle$pad = getComputedStyle((_el$firstElementChild = el.firstElementChild) === null || _el$firstElementChild === void 0 ? void 0 : _el$firstElementChild.firstElementChild).padding) !== null && _getComputedStyle$pad !== void 0 ? _getComputedStyle$pad : 8);
71
+ setColumnCount(columns !== null && columns !== void 0 ? columns : Math.max(1, Math.floor((((_el$offsetWidth = el === null || el === void 0 ? void 0 : el.offsetWidth) !== null && _el$offsetWidth !== void 0 ? _el$offsetWidth : 800) - 32 - (isNaN(pad) ? 8 : pad) * 2) / width)));
71
72
  };
72
73
  var ob = new ResizeObserver(handler);
73
74
  handler();
@@ -199,7 +200,7 @@ var _VirtualGallery = function _VirtualGallery(_ref) {
199
200
  var key = _ref3.key,
200
201
  index = _ref3.index;
201
202
  return /*#__PURE__*/jsxRuntime.jsx("div", {
202
- className: "flex justify-start",
203
+ className: "flex justify-center",
203
204
  "data-index": index,
204
205
  ref: virtualizer.measureElement,
205
206
  children: columnMap.map(function (col) {
@@ -66,8 +66,9 @@ var _VirtualGallery = function _VirtualGallery(_ref) {
66
66
  if (scrollerRef.current) {
67
67
  var el = scrollerRef.current;
68
68
  var handler = function handler() {
69
- var _el$offsetWidth;
70
- setColumnCount(columns !== null && columns !== void 0 ? columns : Math.max(1, Math.floor((((_el$offsetWidth = el === null || el === void 0 ? void 0 : el.offsetWidth) !== null && _el$offsetWidth !== void 0 ? _el$offsetWidth : 800) - 32) / width)));
69
+ var _getComputedStyle$pad, _el$firstElementChild, _el$offsetWidth;
70
+ var pad = parseInt((_getComputedStyle$pad = getComputedStyle((_el$firstElementChild = el.firstElementChild) === null || _el$firstElementChild === void 0 ? void 0 : _el$firstElementChild.firstElementChild).padding) !== null && _getComputedStyle$pad !== void 0 ? _getComputedStyle$pad : 8);
71
+ setColumnCount(columns !== null && columns !== void 0 ? columns : Math.max(1, Math.floor((((_el$offsetWidth = el === null || el === void 0 ? void 0 : el.offsetWidth) !== null && _el$offsetWidth !== void 0 ? _el$offsetWidth : 800) - 32 - (isNaN(pad) ? 8 : pad) * 2) / width)));
71
72
  };
72
73
  var ob = new ResizeObserver(handler);
73
74
  handler();
@@ -199,7 +200,7 @@ var _VirtualGallery = function _VirtualGallery(_ref) {
199
200
  var key = _ref3.key,
200
201
  index = _ref3.index;
201
202
  return /*#__PURE__*/jsx("div", {
202
- className: "flex justify-start",
203
+ className: "flex justify-center",
203
204
  "data-index": index,
204
205
  ref: virtualizer.measureElement,
205
206
  children: columnMap.map(function (col) {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ColorType, type PaletteType, type TestProps } from "@react-fabric/core/dist/types/types";
3
2
  interface HistogramItem {
4
3
  id: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type CssProp } from "@react-fabric/core/dist/types/types";
3
2
  export interface JsonViewProps<T> extends CssProp {
4
3
  /**
@@ -14,7 +14,7 @@ export declare const useVirtualTable: <T extends KeyValue<any> = KeyValue<any>>(
14
14
  groupProperty?: keyof T;
15
15
  onCheckChanged?: (checked: AnyObject[]) => void;
16
16
  }) => {
17
- scrollerRef: import("react").RefObject<HTMLDivElement>;
17
+ scrollerRef: import("react").RefObject<HTMLDivElement | null>;
18
18
  items: import("@tanstack/virtual-core").VirtualItem[];
19
19
  checkState: DataState<T>;
20
20
  getData: (index: number) => T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-fabric/data",
3
- "version": "1.0.0-beta.49",
3
+ "version": "1.0.0-beta.51",
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.49",
39
- "@react-fabric/date": "^1.0.0-beta.49",
40
- "@react-fabric/form": "^1.0.0-beta.49",
41
- "@react-fabric/utilities": "^1.0.0-beta.49",
38
+ "@react-fabric/core": "^1.0.0-beta.51",
39
+ "@react-fabric/date": "^1.0.0-beta.51",
40
+ "@react-fabric/form": "^1.0.0-beta.51",
41
+ "@react-fabric/utilities": "^1.0.0-beta.50",
42
42
  "@tanstack/react-virtual": "^3.13.9",
43
43
  "classnames": "^2.5.1",
44
44
  "color": "^4.2.3",
45
45
  "memoize-one": "^6.0.0"
46
46
  },
47
47
  "peerDependencies": {
48
- "i18next": "^23.15.1",
48
+ "i18next": "^25.2.1",
49
49
  "react": "^19.0.0",
50
50
  "react-dom": "^19.0.0",
51
- "react-i18next": "^15.0.2"
51
+ "react-i18next": "^15.5.2"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=18.12.0",
55
55
  "npm": ">=8.19.0"
56
56
  },
57
- "gitHead": "29b3ed65e9f9687d738dd7c6facdb9fedafb4219"
57
+ "gitHead": "a1b04de4663045f82992bff2aef8db26608eac74"
58
58
  }
@@ -150,9 +150,19 @@ const _VirtualGallery = <T extends AnyObject>({
150
150
  if (scrollerRef.current) {
151
151
  const el = scrollerRef.current;
152
152
  const handler = () => {
153
+ const pad = parseInt(
154
+ getComputedStyle(el.firstElementChild?.firstElementChild as any)
155
+ .padding ?? 8,
156
+ );
153
157
  setColumnCount(
154
158
  columns ??
155
- Math.max(1, Math.floor(((el?.offsetWidth ?? 800) - 32) / width)),
159
+ Math.max(
160
+ 1,
161
+ Math.floor(
162
+ ((el?.offsetWidth ?? 800) - 32 - (isNaN(pad) ? 8 : pad) * 2) /
163
+ width,
164
+ ),
165
+ ),
156
166
  );
157
167
  };
158
168
  const ob = new ResizeObserver(handler);
@@ -308,7 +318,7 @@ const _VirtualGallery = <T extends AnyObject>({
308
318
  <div style={{ height: virtualItems[0]?.start }} />
309
319
  {virtualItems.map(({ key, index }) => (
310
320
  <div
311
- className="flex justify-start"
321
+ className="flex justify-center"
312
322
  key={key}
313
323
  data-index={index}
314
324
  ref={virtualizer.measureElement}