@moving-walls/design-system 1.0.22 → 1.0.24

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.
@@ -39,4 +39,6 @@ export interface AgGridTableProps<T = unknown> {
39
39
  cacheBlockSize?: number;
40
40
  footerData?: any[];
41
41
  pagination?: boolean;
42
+ /** Fired when the user scrolls to the bottom of the grid body. Useful for infinite scroll. */
43
+ onBodyScrollEnd?: () => void;
42
44
  }
package/dist/index.esm.js CHANGED
@@ -36362,9 +36362,10 @@ function CalendarMonth(_ref) {
36362
36362
  }
36363
36363
  // Next month's leading days
36364
36364
  var totalCells = Math.ceil(days.length / 7) * 7;
36365
- for (var _i = days.length; _i < totalCells; _i++) {
36366
- var _date2 = new Date(lastDayOfMonth);
36367
- _date2.setDate(_date2.getDate() + (_i - days.length + 1));
36365
+ var nextMonthStart = days.length;
36366
+ for (var _i = nextMonthStart; _i < totalCells; _i++) {
36367
+ var nextDay = _i - nextMonthStart + 1;
36368
+ var _date2 = new Date(currentMonth.getFullYear(), currentMonth.getMonth() + 1, nextDay);
36368
36369
  days.push({
36369
36370
  date: _date2,
36370
36371
  isCurrentMonth: false
@@ -41317,8 +41318,8 @@ function Tooltip(_ref2) {
41317
41318
  _useState6 = _slicedToArray(_useState5, 2),
41318
41319
  resolvedPosition = _useState6[0],
41319
41320
  setResolvedPosition = _useState6[1];
41320
- useLayoutEffect(function () {
41321
- if (!isVisible || !triggerRef.current || !tooltipRef.current) return;
41321
+ var recalculate = useCallback(function () {
41322
+ if (!triggerRef.current || !tooltipRef.current) return;
41322
41323
  var triggerRect = triggerRef.current.getBoundingClientRect();
41323
41324
  var tooltipRect = tooltipRef.current.getBoundingClientRect();
41324
41325
  var vw = window.innerWidth;
@@ -41326,7 +41327,6 @@ function Tooltip(_ref2) {
41326
41327
  var top = 0;
41327
41328
  var left = 0;
41328
41329
  var resolved = position;
41329
- // Calculate preferred position
41330
41330
  var calc = function calc(pos) {
41331
41331
  switch (pos) {
41332
41332
  case 'top':
@@ -41348,7 +41348,6 @@ function Tooltip(_ref2) {
41348
41348
  }
41349
41349
  };
41350
41350
  calc(position);
41351
- // Flip if overflowing viewport
41352
41351
  if (position === 'top' && top < PADDING) {
41353
41352
  resolved = 'bottom';
41354
41353
  calc('bottom');
@@ -41362,10 +41361,8 @@ function Tooltip(_ref2) {
41362
41361
  resolved = 'left';
41363
41362
  calc('left');
41364
41363
  }
41365
- // Clamp horizontal to stay within viewport
41366
41364
  if (left < PADDING) left = PADDING;
41367
41365
  if (left + tooltipRect.width > vw - PADDING) left = vw - PADDING - tooltipRect.width;
41368
- // Clamp vertical
41369
41366
  if (top < PADDING) top = PADDING;
41370
41367
  if (top + tooltipRect.height > vh - PADDING) top = vh - PADDING - tooltipRect.height;
41371
41368
  setCoords({
@@ -41373,10 +41370,20 @@ function Tooltip(_ref2) {
41373
41370
  left: left
41374
41371
  });
41375
41372
  setResolvedPosition(resolved);
41376
- }, [isVisible, position]);
41373
+ }, [position]);
41374
+ // Recalculate on visibility change
41375
+ useLayoutEffect(function () {
41376
+ if (!isVisible) return;
41377
+ recalculate();
41378
+ }, [isVisible, recalculate]);
41379
+ // Use callback ref to recalculate once the portal element is mounted in the DOM
41380
+ var tooltipCallbackRef = useCallback(function (node) {
41381
+ tooltipRef.current = node;
41382
+ if (node && isVisible) recalculate();
41383
+ }, [isVisible, recalculate]);
41377
41384
  var show = useCallback(function () {
41378
- return setIsVisible(true);
41379
- }, []);
41385
+ if (content != null && content !== '') setIsVisible(true);
41386
+ }, [content]);
41380
41387
  var hide = useCallback(function () {
41381
41388
  setIsVisible(false);
41382
41389
  setCoords(null);
@@ -41412,16 +41419,18 @@ function Tooltip(_ref2) {
41412
41419
  onFocus: show,
41413
41420
  onBlur: hide,
41414
41421
  children: children
41415
- }), isVisible && /*#__PURE__*/createPortal(jsxs("div", {
41416
- ref: tooltipRef,
41422
+ }), isVisible && content != null && content !== '' && /*#__PURE__*/createPortal(jsxs("div", {
41423
+ ref: tooltipCallbackRef,
41417
41424
  style: coords ? {
41418
41425
  top: coords.top,
41419
- left: coords.left
41426
+ left: coords.left,
41427
+ zIndex: 999999
41420
41428
  } : {
41421
41429
  top: -9999,
41422
- left: -9999
41430
+ left: -9999,
41431
+ zIndex: 999999
41423
41432
  },
41424
- className: clsx('fixed z-[9999] px-2 py-1 text-sm text-mw-neutral-500 bg-white border border-mw-neutral-100 rounded-md shadow-sm max-w-xs whitespace-normal', className),
41433
+ className: clsx('fixed px-2 py-1 text-sm text-mw-neutral-500 bg-white border border-mw-neutral-100 rounded-md shadow-sm max-w-sm whitespace-normal', className),
41425
41434
  children: [content, jsx("div", {
41426
41435
  className: clsx('w-0 h-0 border-4', arrowClasses[resolvedPosition]),
41427
41436
  style: arrowStyle()
@@ -49543,7 +49552,8 @@ function AgGridTableInner(props) {
49543
49552
  cacheBlockSize = props.cacheBlockSize,
49544
49553
  footerData = props.footerData,
49545
49554
  _props$pagination = props.pagination,
49546
- pagination = _props$pagination === void 0 ? true : _props$pagination;
49555
+ pagination = _props$pagination === void 0 ? true : _props$pagination,
49556
+ onBodyScrollEnd = props.onBodyScrollEnd;
49547
49557
  var gridRef = useRef(null);
49548
49558
  var apiRef = useRef(null);
49549
49559
  var isSortFromExternalRef = useRef(false);
@@ -49711,6 +49721,9 @@ function AgGridTableInner(props) {
49711
49721
  paginationPageSize: useGridPagination ? (_a = serverSideConfig === null || serverSideConfig === void 0 ? void 0 : serverSideConfig.pageSize) !== null && _a !== void 0 ? _a : 10 : undefined,
49712
49722
  paginationPageSizeSelector: useGridPagination ? (_b = serverSideConfig === null || serverSideConfig === void 0 ? void 0 : serverSideConfig.pageSizeSelector) !== null && _b !== void 0 ? _b : DEFAULT_PAGE_SIZE_SELECTOR : undefined,
49713
49723
  cacheBlockSize: cacheBlockSize,
49724
+ onBodyScrollEnd: onBodyScrollEnd ? function () {
49725
+ return onBodyScrollEnd();
49726
+ } : undefined,
49714
49727
  pinnedBottomRowData: footerData === null || footerData === void 0 ? void 0 : footerData.map(function (row, i) {
49715
49728
  return _typeof(row) === "object" && row !== null && !("id" in row) ? Object.assign(Object.assign({}, row), {
49716
49729
  id: "pinned-bottom-".concat(i)