@infinite-table/infinite-react 5.0.0-canary.0 → 5.0.0-canary.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.
package/index.mjs CHANGED
@@ -1364,7 +1364,7 @@ function stripVar(cssVariableWithVarString) {
1364
1364
  }
1365
1365
 
1366
1366
  // src/components/InfiniteTable/internalVars.css.ts
1367
- var InternalVars = { currentColumnTransformX: "var(--currentColumnTransformX__16hkbkc0)", y: "var(--y__16hkbkc1)", activeCellRowOffset: "var(--activeCellRowOffset__16hkbkc2)", activeCellRowHeight: "var(--activeCellRowHeight__16hkbkc3)", activeCellOffsetX: "var(--activeCellOffsetX__16hkbkc4)", activeCellOffsetY: "var(--activeCellOffsetY__16hkbkc5)", scrollTopForActiveRow: "var(--scrollTopForActiveRow__16hkbkc6)", activeCellColWidth: "var(--activeCellColWidth__16hkbkc7)", activeCellColOffset: "var(--activeCellColOffset__16hkbkc8)", columnReorderEffectDurationAtIndex: "var(--columnReorderEffectDurationAtIndex__16hkbkc9)", columnWidthAtIndex: "var(--columnWidthAtIndex__16hkbkca)", columnOffsetAtIndex: "var(--columnOffsetAtIndex__16hkbkcb)", columnOffsetAtIndexWhileReordering: "var(--columnOffsetAtIndexWhileReordering__16hkbkcc)", columnZIndexAtIndex: "var(--columnZIndexAtIndex__16hkbkcd)", pinnedStartWidth: "var(--pinnedStartWidth__16hkbkce)", pinnedEndWidth: "var(--pinnedEndWidth__16hkbkcf)", pinnedEndOffset: "var(--pinnedEndOffset__16hkbkcg)", computedVisibleColumnsCount: "var(--computedVisibleColumnsCount__16hkbkch)", baseZIndexForCells: "var(--baseZIndexForCells__16hkbkci)", bodyWidth: "var(--bodyWidth__16hkbkcj)", bodyHeight: "var(--bodyHeight__16hkbkck)", scrollbarWidthHorizontal: "var(--scrollbarWidthHorizontal__16hkbkcl)", scrollbarWidthVertical: "var(--scrollbarWidthVertical__16hkbkcm)", scrollLeft: "var(--scrollLeft__16hkbkcn)", scrollTop: "var(--scrollTop__16hkbkco)" };
1367
+ var InternalVars = { currentColumnTransformX: "var(--currentColumnTransformX__16hkbkc0)", y: "var(--y__16hkbkc1)", activeCellRowOffset: "var(--activeCellRowOffset__16hkbkc2)", activeCellRowOffsetX: "var(--activeCellRowOffsetX__16hkbkc3)", activeCellRowHeight: "var(--activeCellRowHeight__16hkbkc4)", activeCellOffsetX: "var(--activeCellOffsetX__16hkbkc5)", activeCellOffsetY: "var(--activeCellOffsetY__16hkbkc6)", scrollTopForActiveRow: "var(--scrollTopForActiveRow__16hkbkc7)", scrollLeftForActiveRowWhenHorizontalLayout: "var(--scrollLeftForActiveRowWhenHorizontalLayout__16hkbkc8)", activeCellColWidth: "var(--activeCellColWidth__16hkbkc9)", activeCellColOffset: "var(--activeCellColOffset__16hkbkca)", columnReorderEffectDurationAtIndex: "var(--columnReorderEffectDurationAtIndex__16hkbkcb)", columnWidthAtIndex: "var(--columnWidthAtIndex__16hkbkcc)", columnOffsetAtIndex: "var(--columnOffsetAtIndex__16hkbkcd)", columnOffsetAtIndexWhileReordering: "var(--columnOffsetAtIndexWhileReordering__16hkbkce)", columnZIndexAtIndex: "var(--columnZIndexAtIndex__16hkbkcf)", pinnedStartWidth: "var(--pinnedStartWidth__16hkbkcg)", pinnedEndWidth: "var(--pinnedEndWidth__16hkbkch)", pinnedEndOffset: "var(--pinnedEndOffset__16hkbkci)", computedVisibleColumnsCount: "var(--computedVisibleColumnsCount__16hkbkcj)", baseZIndexForCells: "var(--baseZIndexForCells__16hkbkck)", bodyWidth: "var(--bodyWidth__16hkbkcl)", bodyHeight: "var(--bodyHeight__16hkbkcm)", scrollbarWidthHorizontal: "var(--scrollbarWidthHorizontal__16hkbkcn)", scrollbarWidthVertical: "var(--scrollbarWidthVertical__16hkbkco)", scrollLeft: "var(--scrollLeft__16hkbkcp)", scrollTop: "var(--scrollTop__16hkbkcq)" };
1368
1368
 
1369
1369
  // src/utils/selectParent.ts
1370
1370
  function selectParent(el, selector2) {
@@ -3076,11 +3076,13 @@ var ReactHeadlessTableRenderer = class extends Logger {
3076
3076
  return { start: startRow, end: endRow };
3077
3077
  };
3078
3078
  this.getScrollPositionForScrollRowIntoView = (rowIndex, config = { offset: 0 }) => {
3079
+ var _a;
3079
3080
  if (this.destroyed) {
3080
3081
  return null;
3081
3082
  }
3082
3083
  const { brain } = this;
3083
3084
  const scrollPosition = brain.getScrollPosition();
3085
+ let scrollLeft2 = scrollPosition.scrollLeft;
3084
3086
  let { scrollAdjustPosition, offset = 0 } = config;
3085
3087
  if (this.isRowFullyVisible(rowIndex) && !scrollAdjustPosition) {
3086
3088
  return scrollPosition;
@@ -3110,9 +3112,22 @@ var ReactHeadlessTableRenderer = class extends Logger {
3110
3112
  offset += rowHeight;
3111
3113
  scrollTop2 += rowOffset - bottom + offset + fixedEndRowsHeight;
3112
3114
  }
3113
- return __spreadProps(__spreadValues({}, scrollPosition), {
3115
+ if (this.brain.isHorizontalLayoutBrain) {
3116
+ const colIndex = (_a = config.colIndex) != null ? _a : Math.ceil(this.brain.getInitialCols() / 2);
3117
+ const colScrollPosition = this.getScrollPositionForScrollColumnIntoView(
3118
+ colIndex,
3119
+ __spreadProps(__spreadValues({}, config), {
3120
+ horizontalLayoutPageIndex: this.brain.getPageIndexForRow(rowIndex)
3121
+ })
3122
+ );
3123
+ if (colScrollPosition) {
3124
+ scrollLeft2 = colScrollPosition.scrollLeft;
3125
+ }
3126
+ }
3127
+ return {
3128
+ scrollLeft: scrollLeft2,
3114
3129
  scrollTop: scrollTop2
3115
- });
3130
+ };
3116
3131
  };
3117
3132
  this.getScrollPositionForScrollColumnIntoView = (colIndex, config = { offset: 0 }) => {
3118
3133
  if (this.destroyed) {
@@ -4223,9 +4238,9 @@ var HorizontalLayoutTableRenderer = class extends ReactHeadlessTableRenderer {
4223
4238
  element.style.setProperty(currentTransformY, currentTransformYValue);
4224
4239
  }
4225
4240
  const xOffset = `calc(var(${columnOffsetX}) + ${pageOffset})`;
4226
- const transformX = `var(${columnOffsetXWhileReordering}, ${xOffset})`;
4241
+ const transformX2 = `var(${columnOffsetXWhileReordering}, ${xOffset})`;
4227
4242
  const transformY = `var(${currentTransformY})`;
4228
- const transformValue = `translate3d(${transformX}, ${transformY}, 0px)`;
4243
+ const transformValue = `translate3d(${transformX2}, ${transformY}, 0px)`;
4229
4244
  if (element.__transformValue !== transformValue) {
4230
4245
  element.__transformValue = transformValue;
4231
4246
  element.style.transform = transformValue;
@@ -4349,46 +4364,169 @@ var useRerender = () => {
4349
4364
  var ActiveCellIndicatorCls = { visible: "ActiveCellIndicator_ActiveCellIndicatorCls_visible__nxbq1c2 ActiveCellIndicator_ActiveCellIndicator__nxbq1c1 utilities_pointerEvents_none__16lm1iwl utilities_position_absolute__16lm1iw2", hidden: "ActiveCellIndicator_ActiveCellIndicatorCls_hidden__nxbq1c3 ActiveCellIndicator_ActiveCellIndicator__nxbq1c1 utilities_pointerEvents_none__16lm1iwl utilities_position_absolute__16lm1iw2" };
4350
4365
  var ActiveIndicatorWrapperCls = "ActiveCellIndicator_ActiveIndicatorWrapperCls__nxbq1c0 utilities_pointerEvents_none__16lm1iwl utilities_position_sticky__16lm1iw4 utilities_left_0__16lm1iw1e utilities_top_0__16lm1iw1c utilities_height_0__16lm1iw18 utilities_zIndex_1000000__16lm1iwu";
4351
4366
 
4367
+ // ../node_modules/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js
4368
+ function toPrimitive(t, r) {
4369
+ if ("object" != typeof t || !t)
4370
+ return t;
4371
+ var e = t[Symbol.toPrimitive];
4372
+ if (void 0 !== e) {
4373
+ var i = e.call(t, r || "default");
4374
+ if ("object" != typeof i)
4375
+ return i;
4376
+ throw new TypeError("@@toPrimitive must return a primitive value.");
4377
+ }
4378
+ return ("string" === r ? String : Number)(t);
4379
+ }
4380
+ function toPropertyKey(t) {
4381
+ var i = toPrimitive(t, "string");
4382
+ return "symbol" == typeof i ? i : String(i);
4383
+ }
4384
+ function _defineProperty(obj, key, value) {
4385
+ key = toPropertyKey(key);
4386
+ if (key in obj) {
4387
+ Object.defineProperty(obj, key, {
4388
+ value,
4389
+ enumerable: true,
4390
+ configurable: true,
4391
+ writable: true
4392
+ });
4393
+ } else {
4394
+ obj[key] = value;
4395
+ }
4396
+ return obj;
4397
+ }
4398
+ function ownKeys(e, r) {
4399
+ var t = Object.keys(e);
4400
+ if (Object.getOwnPropertySymbols) {
4401
+ var o = Object.getOwnPropertySymbols(e);
4402
+ r && (o = o.filter(function(r2) {
4403
+ return Object.getOwnPropertyDescriptor(e, r2).enumerable;
4404
+ })), t.push.apply(t, o);
4405
+ }
4406
+ return t;
4407
+ }
4408
+ function _objectSpread2(e) {
4409
+ for (var r = 1; r < arguments.length; r++) {
4410
+ var t = null != arguments[r] ? arguments[r] : {};
4411
+ r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
4412
+ _defineProperty(e, r2, t[r2]);
4413
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
4414
+ Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
4415
+ });
4416
+ }
4417
+ return e;
4418
+ }
4419
+ function mapValues(input, fn) {
4420
+ var result = {};
4421
+ for (var _key in input) {
4422
+ result[_key] = fn(input[_key], _key);
4423
+ }
4424
+ return result;
4425
+ }
4426
+ var shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {
4427
+ for (var key of Object.keys(compoundCheck)) {
4428
+ var _selections$key;
4429
+ if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) {
4430
+ return false;
4431
+ }
4432
+ }
4433
+ return true;
4434
+ };
4435
+ var createRuntimeFn = (config) => {
4436
+ var runtimeFn = (options) => {
4437
+ var className = config.defaultClassName;
4438
+ var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
4439
+ for (var variantName in selections) {
4440
+ var _selections$variantNa;
4441
+ var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
4442
+ if (variantSelection != null) {
4443
+ var selection = variantSelection;
4444
+ if (typeof selection === "boolean") {
4445
+ selection = selection === true ? "true" : "false";
4446
+ }
4447
+ var selectionClassName = (
4448
+ // @ts-expect-error
4449
+ config.variantClassNames[variantName][selection]
4450
+ );
4451
+ if (selectionClassName) {
4452
+ className += " " + selectionClassName;
4453
+ }
4454
+ }
4455
+ }
4456
+ for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
4457
+ if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) {
4458
+ className += " " + compoundClassName;
4459
+ }
4460
+ }
4461
+ return className;
4462
+ };
4463
+ runtimeFn.variants = () => Object.keys(config.variantClassNames);
4464
+ runtimeFn.classNames = {
4465
+ get base() {
4466
+ return config.defaultClassName.split(" ")[0];
4467
+ },
4468
+ get variants() {
4469
+ return mapValues(config.variantClassNames, (classNames) => mapValues(classNames, (className) => className.split(" ")[0]));
4470
+ }
4471
+ };
4472
+ return runtimeFn;
4473
+ };
4474
+
4352
4475
  // src/components/InfiniteTable/components/ActiveRowIndicator.css.ts
4353
- var ActiveRowIndicatorCls = { visible: "ActiveRowIndicator_ActiveRowIndicatorCls_visible__j26lrx1 ActiveRowIndicator_ActiveRowIndicator__j26lrx0 utilities_pointerEvents_none__16lm1iwl utilities_position_absolute__16lm1iw2 utilities_top_0__16lm1iw1c utilities_left_0__16lm1iw1e", hidden: "ActiveRowIndicator_ActiveRowIndicatorCls_hidden__j26lrx2 ActiveRowIndicator_ActiveRowIndicator__j26lrx0 utilities_pointerEvents_none__16lm1iwl utilities_position_absolute__16lm1iw2 utilities_top_0__16lm1iw1c utilities_left_0__16lm1iw1e" };
4476
+ var ActiveRowIndicatorRecipe = createRuntimeFn({ defaultClassName: "ActiveRowIndicator_ActiveRowIndicator__j26lrx0 utilities_pointerEvents_none__16lm1iwl utilities_position_absolute__16lm1iw2 utilities_top_0__16lm1iw1c utilities_left_0__16lm1iw1e", variantClassNames: { active: { true: "ActiveRowIndicator_ActiveRowIndicatorRecipe_active_true__j26lrx2", false: "ActiveRowIndicator_ActiveRowIndicatorRecipe_active_false__j26lrx3" } }, defaultVariants: {}, compoundVariants: [] });
4354
4477
 
4355
4478
  // src/components/InfiniteTable/components/ActiveRowIndicator.tsx
4356
4479
  var { rootClassName: rootClassName3 } = internalProps;
4357
4480
  var baseCls = `${rootClassName3}-ActiveRowIndicator`;
4481
+ var transformX = `calc(${InternalVars.activeCellRowOffsetX} + var(${stripVar(
4482
+ InternalVars.scrollLeftForActiveRowWhenHorizontalLayout
4483
+ )}, 0px))`;
4358
4484
  var ActiveStyle = {
4359
4485
  [stripVar(InternalVars.activeCellOffsetY)]: InternalVars.activeCellRowOffset,
4360
- transform: `translate3d(0px, calc( ${InternalVars.activeCellOffsetY} + var(${stripVar(InternalVars.scrollTopForActiveRow)}, 0px)), 0px)`,
4486
+ transform: `translate3d(${transformX}, calc( ${InternalVars.activeCellOffsetY} + var(${stripVar(InternalVars.scrollTopForActiveRow)}, 0px)), 0px)`,
4361
4487
  height: InternalVars.activeCellRowHeight,
4362
4488
  maxWidth: ThemeVars.runtime.totalVisibleColumnsWidthVar
4363
4489
  };
4364
4490
  var ActiveRowIndicatorFn = (props) => {
4365
4491
  const { brain } = props;
4366
4492
  const domRef = useRef5(null);
4367
- const active = props.activeRowIndex != null && brain.getRowCount() > props.activeRowIndex;
4493
+ const active = props.activeRowIndex != null && brain.getInitialRows() > props.activeRowIndex;
4368
4494
  const [_rerenderId, rerender] = useRerender();
4369
4495
  useLayoutEffect4(() => {
4370
4496
  if (props.activeRowIndex == null) {
4371
4497
  return;
4372
4498
  }
4373
- const rowIndex = props.activeRowIndex;
4499
+ let activeCellRowOffsetX = "0px";
4500
+ let rowIndex = props.activeRowIndex;
4501
+ if (brain.isHorizontalLayoutBrain && brain.rowsPerPage) {
4502
+ const pageIndex = brain.getPageIndexForRow(rowIndex);
4503
+ if (pageIndex > 0) {
4504
+ activeCellRowOffsetX = `calc(${ThemeVars.runtime.totalVisibleColumnsWidthVar} * ${pageIndex})`;
4505
+ }
4506
+ rowIndex = rowIndex % brain.rowsPerPage;
4507
+ }
4374
4508
  const activeCellRowHeight = brain.getRowHeight(rowIndex);
4375
4509
  const activeCellRowOffset = brain.getItemOffsetFor(rowIndex, "vertical");
4376
4510
  const node = domRef.current;
4377
4511
  const vars = {
4378
4512
  activeCellRowHeight: `${activeCellRowHeight}px`,
4379
- activeCellRowOffset: `${activeCellRowOffset}px`
4513
+ activeCellRowOffset: `${activeCellRowOffset}px`,
4514
+ activeCellRowOffsetX
4380
4515
  };
4381
4516
  setInfiniteVarsOnNode(vars, node);
4382
- }, [props.activeRowIndex]);
4517
+ }, [props.activeRowIndex, brain]);
4383
4518
  useEffect5(() => {
4384
- const removeOnScroll = brain.onScroll((scrollPosition) => {
4519
+ const updateVars = (scrollPosition) => {
4385
4520
  setInfiniteVarsOnNode(
4386
4521
  {
4387
- scrollTopForActiveRow: `${-scrollPosition.scrollTop}px`
4522
+ scrollTopForActiveRow: `${-scrollPosition.scrollTop}px`,
4523
+ scrollLeftForActiveRowWhenHorizontalLayout: `${-scrollPosition.scrollLeft}px`
4388
4524
  },
4389
4525
  domRef.current
4390
4526
  );
4391
- });
4527
+ };
4528
+ updateVars(brain.getScrollPosition());
4529
+ const removeOnScroll = brain.onScroll(updateVars);
4392
4530
  const removeOnRenderCountChange = brain.onRenderCountChange(rerender);
4393
4531
  return () => {
4394
4532
  removeOnRenderCountChange();
@@ -4402,7 +4540,9 @@ var ActiveRowIndicatorFn = (props) => {
4402
4540
  {
4403
4541
  ref: domRef,
4404
4542
  "data-name": "active-row-indicator",
4405
- className: `${baseCls} ${active ? ActiveRowIndicatorCls.visible : ActiveRowIndicatorCls.hidden}`,
4543
+ className: `${baseCls} ${ActiveRowIndicatorRecipe({
4544
+ active
4545
+ })}`,
4406
4546
  style: active ? ActiveStyle : void 0
4407
4547
  }
4408
4548
  ))
@@ -4444,7 +4584,7 @@ var ActiveCellIndicatorFn = (props) => {
4444
4584
  const active = props.activeCellIndex != null && brain.getInitialRows() > props.activeCellIndex[0];
4445
4585
  useLayoutEffect5(() => {
4446
4586
  reposition(brain, props.activeCellIndex, props.rowHeight, domRef);
4447
- }, [props.activeCellIndex, props.rowHeight]);
4587
+ }, [props.activeCellIndex, props.rowHeight, brain]);
4448
4588
  useEffect6(() => {
4449
4589
  const removeOnRenderCountChange = brain.onRenderCountChange(() => {
4450
4590
  rerender();
@@ -5216,114 +5356,6 @@ var useInfiniteTableState = () => {
5216
5356
  import * as React26 from "react";
5217
5357
  import { useEffect as useEffect10, useLayoutEffect as useLayoutEffect8, useState as useState5 } from "react";
5218
5358
 
5219
- // ../node_modules/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js
5220
- function toPrimitive(t, r) {
5221
- if ("object" != typeof t || !t)
5222
- return t;
5223
- var e = t[Symbol.toPrimitive];
5224
- if (void 0 !== e) {
5225
- var i = e.call(t, r || "default");
5226
- if ("object" != typeof i)
5227
- return i;
5228
- throw new TypeError("@@toPrimitive must return a primitive value.");
5229
- }
5230
- return ("string" === r ? String : Number)(t);
5231
- }
5232
- function toPropertyKey(t) {
5233
- var i = toPrimitive(t, "string");
5234
- return "symbol" == typeof i ? i : String(i);
5235
- }
5236
- function _defineProperty(obj, key, value) {
5237
- key = toPropertyKey(key);
5238
- if (key in obj) {
5239
- Object.defineProperty(obj, key, {
5240
- value,
5241
- enumerable: true,
5242
- configurable: true,
5243
- writable: true
5244
- });
5245
- } else {
5246
- obj[key] = value;
5247
- }
5248
- return obj;
5249
- }
5250
- function ownKeys(e, r) {
5251
- var t = Object.keys(e);
5252
- if (Object.getOwnPropertySymbols) {
5253
- var o = Object.getOwnPropertySymbols(e);
5254
- r && (o = o.filter(function(r2) {
5255
- return Object.getOwnPropertyDescriptor(e, r2).enumerable;
5256
- })), t.push.apply(t, o);
5257
- }
5258
- return t;
5259
- }
5260
- function _objectSpread2(e) {
5261
- for (var r = 1; r < arguments.length; r++) {
5262
- var t = null != arguments[r] ? arguments[r] : {};
5263
- r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
5264
- _defineProperty(e, r2, t[r2]);
5265
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
5266
- Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
5267
- });
5268
- }
5269
- return e;
5270
- }
5271
- function mapValues(input, fn) {
5272
- var result = {};
5273
- for (var _key in input) {
5274
- result[_key] = fn(input[_key], _key);
5275
- }
5276
- return result;
5277
- }
5278
- var shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {
5279
- for (var key of Object.keys(compoundCheck)) {
5280
- var _selections$key;
5281
- if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) {
5282
- return false;
5283
- }
5284
- }
5285
- return true;
5286
- };
5287
- var createRuntimeFn = (config) => {
5288
- var runtimeFn = (options) => {
5289
- var className = config.defaultClassName;
5290
- var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
5291
- for (var variantName in selections) {
5292
- var _selections$variantNa;
5293
- var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
5294
- if (variantSelection != null) {
5295
- var selection = variantSelection;
5296
- if (typeof selection === "boolean") {
5297
- selection = selection === true ? "true" : "false";
5298
- }
5299
- var selectionClassName = (
5300
- // @ts-expect-error
5301
- config.variantClassNames[variantName][selection]
5302
- );
5303
- if (selectionClassName) {
5304
- className += " " + selectionClassName;
5305
- }
5306
- }
5307
- }
5308
- for (var [compoundCheck, compoundClassName] of config.compoundVariants) {
5309
- if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) {
5310
- className += " " + compoundClassName;
5311
- }
5312
- }
5313
- return className;
5314
- };
5315
- runtimeFn.variants = () => Object.keys(config.variantClassNames);
5316
- runtimeFn.classNames = {
5317
- get base() {
5318
- return config.defaultClassName.split(" ")[0];
5319
- },
5320
- get variants() {
5321
- return mapValues(config.variantClassNames, (classNames) => mapValues(classNames, (className) => className.split(" ")[0]));
5322
- }
5323
- };
5324
- return runtimeFn;
5325
- };
5326
-
5327
5359
  // src/components/InfiniteTable/components/InfiniteTableHeader/header.css.ts
5328
5360
  var CellCls = "cell_CellCls__1eexc2a5 utilities_display_flex__16lm1iwz utilities_flexFlow_row__16lm1iw1o utilities_alignItems_center__16lm1iw1q utilities_position_absolute__16lm1iw2 utilities_willChange_transform__16lm1iw22 utilities_whiteSpace_nowrap__16lm1iw23 utilities_userSelect_none__16lm1iw17";
5329
5361
  var HeaderCellContentRecipe = createRuntimeFn({ defaultClassName: "header_HeaderCellContentRecipe__12zfob122 utilities_height_100%__16lm1iw19 utilities_width_100%__16lm1iw1b utilities_display_flex__16lm1iwz utilities_flexFlow_row__16lm1iw1o utilities_alignItems_center__16lm1iw1q utilities_justifyContent_start__16lm1iw1v", variantClassNames: { filtered: { false: "header_HeaderCellContentRecipe_filtered_false__12zfob123", true: "header_HeaderCellContentRecipe_filtered_true__12zfob124" }, verticalAlign: { start: "header_HeaderCellContentRecipe_verticalAlign_start__12zfob125", end: "header_HeaderCellContentRecipe_verticalAlign_end__12zfob126", center: "header_HeaderCellContentRecipe_verticalAlign_center__12zfob127" }, align: { start: "header_HeaderCellContentRecipe_align_start__12zfob128", end: "header_HeaderCellContentRecipe_align_end__12zfob129", center: "header_HeaderCellContentRecipe_align_center__12zfob12a" } }, defaultVariants: {}, compoundVariants: [] });
@@ -16988,22 +17020,35 @@ var InfiniteTableApiImpl = class {
16988
17020
  state.scrollerDOMRef.current.scrollTop = Math.max(scrollTop2, 0);
16989
17021
  }
16990
17022
  scrollRowIntoView(rowIndex, config = { offset: 0 }) {
17023
+ var _a;
16991
17024
  const state = this.getState();
17025
+ const computed = this.getComputed();
17026
+ const currentScrollPosition = state.brain.getScrollPosition();
17027
+ let columnId = config.columnId;
17028
+ let colIndex = void 0;
17029
+ if (!columnId && state.brain.isHorizontalLayoutBrain && computed.computedVisibleColumns.length > 0) {
17030
+ columnId = computed.computedVisibleColumns[Math.ceil(computed.computedVisibleColumns.length / 2)].id;
17031
+ colIndex = (_a = computed.computedVisibleColumnsMap.get(columnId)) == null ? void 0 : _a.computedVisibleIndex;
17032
+ }
16992
17033
  const scrollPosition = state.renderer.getScrollPositionForScrollRowIntoView(
16993
17034
  rowIndex,
16994
- config
17035
+ __spreadProps(__spreadValues({}, config), { colIndex })
16995
17036
  );
16996
17037
  if (!scrollPosition) {
16997
17038
  return false;
16998
17039
  }
16999
- const currentScrollPosition = state.brain.getScrollPosition();
17000
17040
  const scrollTopMax = state.brain.scrollTopMax;
17001
- if (scrollPosition.scrollTop > scrollTopMax + (config.offset || 0)) {
17041
+ const scrollLeftChanged = scrollPosition.scrollLeft !== currentScrollPosition.scrollLeft;
17042
+ const scrollTopValid = scrollPosition.scrollTop <= scrollTopMax + (config.offset || 0);
17043
+ if (!scrollTopValid && !scrollLeftChanged) {
17002
17044
  return false;
17003
17045
  }
17004
- if (scrollPosition.scrollTop !== currentScrollPosition.scrollTop) {
17046
+ if (scrollTopValid && scrollPosition.scrollTop !== currentScrollPosition.scrollTop) {
17005
17047
  state.scrollerDOMRef.current.scrollTop = scrollPosition.scrollTop;
17006
17048
  }
17049
+ if (scrollLeftChanged) {
17050
+ state.scrollerDOMRef.current.scrollLeft = scrollPosition.scrollLeft;
17051
+ }
17007
17052
  return true;
17008
17053
  }
17009
17054
  scrollColumnIntoView(columnId, config = { offset: 0 }) {
@@ -19691,7 +19736,7 @@ var useLicense = (licenseKey = "") => {
19691
19736
  }
19692
19737
  let valid2 = isValidLicense(licenseKey, {
19693
19738
  publishedAt: 1624970570587,
19694
- version: "5.0.0-canary.0"
19739
+ version: "5.0.0-canary.1"
19695
19740
  });
19696
19741
  if (!licenseKey && !valid2 && isInsidePlayground) {
19697
19742
  return true;
@@ -19952,6 +19997,15 @@ function handleRowNavigation(options, event) {
19952
19997
  },
19953
19998
  ArrowLeft: () => {
19954
19999
  const rowInfo = dataArray[activeRowIndex];
20000
+ if (brain.isHorizontalLayoutBrain) {
20001
+ const rowsPerPage = brain.rowsPerPage;
20002
+ if (activeRowIndex - rowsPerPage >= min) {
20003
+ activeRowIndex = activeRowIndex - rowsPerPage;
20004
+ } else {
20005
+ KeyToFunction.ArrowUp();
20006
+ }
20007
+ return;
20008
+ }
19955
20009
  if (rowInfo && rowInfo.isGroupRow) {
19956
20010
  return api.collapseGroupRow(rowInfo.groupKeys);
19957
20011
  }
@@ -19962,6 +20016,15 @@ function handleRowNavigation(options, event) {
19962
20016
  },
19963
20017
  ArrowRight: () => {
19964
20018
  const rowInfo = dataArray[activeRowIndex];
20019
+ if (brain.isHorizontalLayoutBrain) {
20020
+ const rowsPerPage = brain.rowsPerPage;
20021
+ if (activeRowIndex + rowsPerPage <= max) {
20022
+ activeRowIndex = activeRowIndex + rowsPerPage;
20023
+ } else {
20024
+ KeyToFunction.ArrowDown();
20025
+ }
20026
+ return;
20027
+ }
19965
20028
  if (rowInfo && rowInfo.isGroupRow) {
19966
20029
  return api.expandGroupRow(rowInfo.groupKeys);
19967
20030
  }
package/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "bugs": {
26
26
  "url": "https://github.com/infinite-table/infinite-react/issues"
27
27
  },
28
- "version": "5.0.0-canary.0",
28
+ "version": "5.0.0-canary.1",
29
29
  "main": "index.js",
30
30
  "module": "index.mjs",
31
31
  "typings": "index.d.ts",
@@ -34,5 +34,5 @@
34
34
  },
35
35
  "license": "Commercial & Open Source",
36
36
  "//": "will be updated at build time",
37
- "publishedAt": 1726753329029
37
+ "publishedAt": 1726844089529
38
38
  }