@moving-walls/design-system 1.0.18 → 1.0.20

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/dist/index.js CHANGED
@@ -45657,13 +45657,15 @@ function DialogContent(_a) {
45657
45657
  };
45658
45658
  }, [context === null || context === void 0 ? void 0 : context.open]);
45659
45659
  if (!(context === null || context === void 0 ? void 0 : context.open)) return null;
45660
- return require$$1.jsxs("div", {
45660
+ var portalTarget = typeof document !== 'undefined' ? document.body : null;
45661
+ if (!portalTarget) return null;
45662
+ return /*#__PURE__*/ReactDOM.createPortal(require$$1.jsxs("div", {
45661
45663
  className: "fixed inset-0 flex items-center justify-center",
45662
45664
  style: {
45663
45665
  zIndex: 999999
45664
45666
  },
45665
45667
  children: [require$$1.jsx("div", {
45666
- className: "fixed inset-0 bg-black/50 backdrop-blur-sm",
45668
+ className: "fixed inset-0 bg-black/50",
45667
45669
  style: {
45668
45670
  zIndex: 999998
45669
45671
  },
@@ -45671,7 +45673,7 @@ function DialogContent(_a) {
45671
45673
  return context.onOpenChange(false);
45672
45674
  }
45673
45675
  }), require$$1.jsxs("div", Object.assign({
45674
- className: clsx('relative w-full max-w-lg mx-4 max-h-[90vh] overflow-y-auto', 'bg-white dark:bg-mw-neutral-800 rounded-lg shadow-lg border border-mw-neutral-200 dark:border-mw-neutral-700', 'animate-in fade-in-0 zoom-in-95 duration-200', className),
45676
+ className: clsx('relative w-full max-w-lg max-h-[90vh] overflow-y-auto', 'bg-white dark:bg-mw-neutral-800 rounded-lg shadow-lg border border-mw-neutral-200 dark:border-mw-neutral-700', 'animate-in fade-in-0 zoom-in-95 duration-200', className),
45675
45677
  style: {
45676
45678
  zIndex: 999999
45677
45679
  }
@@ -45686,7 +45688,7 @@ function DialogContent(_a) {
45686
45688
  })
45687
45689
  }), children]
45688
45690
  }))]
45689
- });
45691
+ }), portalTarget);
45690
45692
  }
45691
45693
  function DialogHeader(_a) {
45692
45694
  var children = _a.children,
@@ -49273,6 +49275,169 @@ function getRowSelectionOption(rowSelection, serverSidePagination) {
49273
49275
  }
49274
49276
  return rowSelection;
49275
49277
  }
49278
+ /* ------------------------------------------------------------------ */
49279
+ /* Server-side pagination bar – replaces AG Grid's built-in panel */
49280
+ /* when serverSidePagination=true to avoid page-reset feedback loops */
49281
+ /* ------------------------------------------------------------------ */
49282
+ var paginationBtnStyle = function paginationBtnStyle(disabled) {
49283
+ return {
49284
+ display: 'inline-flex',
49285
+ alignItems: 'center',
49286
+ justifyContent: 'center',
49287
+ width: 32,
49288
+ height: 32,
49289
+ border: '1px solid #e2e8f0',
49290
+ borderRadius: 6,
49291
+ background: disabled ? 'transparent' : '#fff',
49292
+ color: disabled ? '#cbd5e1' : '#475569',
49293
+ cursor: disabled ? 'default' : 'pointer',
49294
+ fontSize: 16,
49295
+ lineHeight: 1,
49296
+ transition: 'background 0.15s, border-color 0.15s'
49297
+ };
49298
+ };
49299
+ var ServerSidePaginationBar = /*#__PURE__*/React.memo(function ServerSidePaginationBar(_ref) {
49300
+ var totalCount = _ref.totalCount,
49301
+ currentPage = _ref.currentPage,
49302
+ pageSize = _ref.pageSize,
49303
+ onPageChange = _ref.onPageChange,
49304
+ onPageSizeChange = _ref.onPageSizeChange,
49305
+ _ref$pageSizeSelector = _ref.pageSizeSelector,
49306
+ pageSizeSelector = _ref$pageSizeSelector === void 0 ? DEFAULT_PAGE_SIZE_SELECTOR : _ref$pageSizeSelector;
49307
+ var totalPages = Math.max(1, Math.ceil(totalCount / pageSize));
49308
+ var start = totalCount === 0 ? 0 : (currentPage - 1) * pageSize + 1;
49309
+ var end = Math.min(currentPage * pageSize, totalCount);
49310
+ var atFirst = currentPage <= 1;
49311
+ var atLast = currentPage >= totalPages;
49312
+ return require$$1.jsxs("div", {
49313
+ style: {
49314
+ display: 'flex',
49315
+ alignItems: 'center',
49316
+ justifyContent: 'flex-end',
49317
+ gap: 16,
49318
+ padding: '10px 16px',
49319
+ borderTop: '1px solid #e2e8f0',
49320
+ fontSize: 13,
49321
+ color: '#64748b',
49322
+ background: '#fff',
49323
+ flexShrink: 0,
49324
+ minHeight: 48
49325
+ },
49326
+ role: "navigation",
49327
+ "aria-label": "Pagination",
49328
+ children: [require$$1.jsxs("span", {
49329
+ style: {
49330
+ display: 'flex',
49331
+ alignItems: 'center',
49332
+ gap: 6
49333
+ },
49334
+ children: [require$$1.jsx("span", {
49335
+ children: "Page Size:"
49336
+ }), require$$1.jsx("select", {
49337
+ value: pageSize,
49338
+ onChange: function onChange(e) {
49339
+ return onPageSizeChange(Number(e.target.value));
49340
+ },
49341
+ style: {
49342
+ border: '1px solid #e2e8f0',
49343
+ borderRadius: 6,
49344
+ padding: '4px 8px',
49345
+ fontSize: 13,
49346
+ background: '#fff',
49347
+ color: '#334155',
49348
+ cursor: 'pointer',
49349
+ outline: 'none'
49350
+ },
49351
+ children: pageSizeSelector.map(function (size) {
49352
+ return require$$1.jsx("option", {
49353
+ value: size,
49354
+ children: size
49355
+ }, size);
49356
+ })
49357
+ })]
49358
+ }), require$$1.jsxs("span", {
49359
+ style: {
49360
+ display: 'flex',
49361
+ gap: 4
49362
+ },
49363
+ children: [require$$1.jsx("strong", {
49364
+ style: {
49365
+ color: '#334155'
49366
+ },
49367
+ children: start
49368
+ }), ' to ', require$$1.jsx("strong", {
49369
+ style: {
49370
+ color: '#334155'
49371
+ },
49372
+ children: end
49373
+ }), ' of ', require$$1.jsx("strong", {
49374
+ style: {
49375
+ color: '#334155'
49376
+ },
49377
+ children: totalCount
49378
+ })]
49379
+ }), require$$1.jsxs("span", {
49380
+ style: {
49381
+ display: 'flex',
49382
+ alignItems: 'center',
49383
+ gap: 4
49384
+ },
49385
+ children: [require$$1.jsx("button", {
49386
+ type: "button",
49387
+ disabled: atFirst,
49388
+ onClick: function onClick() {
49389
+ return onPageChange(1);
49390
+ },
49391
+ style: paginationBtnStyle(atFirst),
49392
+ "aria-label": "First Page",
49393
+ children: "\u226A"
49394
+ }), require$$1.jsx("button", {
49395
+ type: "button",
49396
+ disabled: atFirst,
49397
+ onClick: function onClick() {
49398
+ return onPageChange(currentPage - 1);
49399
+ },
49400
+ style: paginationBtnStyle(atFirst),
49401
+ "aria-label": "Previous Page",
49402
+ children: "\u2039"
49403
+ }), require$$1.jsxs("span", {
49404
+ style: {
49405
+ margin: '0 8px',
49406
+ fontSize: 13
49407
+ },
49408
+ children: ["Page ", require$$1.jsx("strong", {
49409
+ style: {
49410
+ color: '#334155'
49411
+ },
49412
+ children: currentPage
49413
+ }), " of ", require$$1.jsx("strong", {
49414
+ style: {
49415
+ color: '#334155'
49416
+ },
49417
+ children: totalPages
49418
+ })]
49419
+ }), require$$1.jsx("button", {
49420
+ type: "button",
49421
+ disabled: atLast,
49422
+ onClick: function onClick() {
49423
+ return onPageChange(currentPage + 1);
49424
+ },
49425
+ style: paginationBtnStyle(atLast),
49426
+ "aria-label": "Next Page",
49427
+ children: "\u203A"
49428
+ }), require$$1.jsx("button", {
49429
+ type: "button",
49430
+ disabled: atLast,
49431
+ onClick: function onClick() {
49432
+ return onPageChange(totalPages);
49433
+ },
49434
+ style: paginationBtnStyle(atLast),
49435
+ "aria-label": "Last Page",
49436
+ children: "\u226B"
49437
+ })]
49438
+ })]
49439
+ });
49440
+ });
49276
49441
  function AgGridTableInner(props) {
49277
49442
  var _a, _b;
49278
49443
  var rowData = props.rowData,
@@ -49317,7 +49482,8 @@ function AgGridTableInner(props) {
49317
49482
  state: sortStateToColumnState(sortState)
49318
49483
  });
49319
49484
  }
49320
- if (serverSidePagination && serverSideConfig) {
49485
+ // For non-server-side pagination, sync AG Grid's internal page
49486
+ if (!serverSidePagination && serverSideConfig) {
49321
49487
  isPaginationFromExternalRef.current = true;
49322
49488
  event.api.paginationGoToPage(serverSideConfig.currentPage - 1);
49323
49489
  event.api.setGridOption("paginationPageSize", serverSideConfig.pageSize);
@@ -49330,8 +49496,9 @@ function AgGridTableInner(props) {
49330
49496
  state: sortStateToColumnState(sortState)
49331
49497
  });
49332
49498
  }, [sortState]);
49499
+ // Sync AG Grid internal page — only for NON-server-side pagination
49333
49500
  React.useEffect(function () {
49334
- if (!serverSidePagination || !serverSideConfig || !apiRef.current) return;
49501
+ if (serverSidePagination || !serverSideConfig || !apiRef.current) return;
49335
49502
  var api = apiRef.current;
49336
49503
  var currentGridPage = api.paginationGetCurrentPage();
49337
49504
  var currentGridSize = api.paginationGetPageSize();
@@ -49344,8 +49511,12 @@ function AgGridTableInner(props) {
49344
49511
  },
49345
49512
  // eslint-disable-next-line react-hooks/exhaustive-deps
49346
49513
  [serverSidePagination, serverSideConfig === null || serverSideConfig === void 0 ? void 0 : serverSideConfig.currentPage, serverSideConfig === null || serverSideConfig === void 0 ? void 0 : serverSideConfig.pageSize]);
49514
+ // onPaginationChanged — only relevant for NON-server-side mode
49347
49515
  var onPaginationChanged = React.useCallback(function (event) {
49348
- if (!serverSidePagination || !serverSideConfig || !event.api) return;
49516
+ // When serverSidePagination is true, AG Grid's pagination is disabled;
49517
+ // our custom bar handles page changes directly. Ignore all grid events.
49518
+ if (serverSidePagination) return;
49519
+ if (!serverSideConfig || !event.api) return;
49349
49520
  if (event.newData) return;
49350
49521
  if (isPaginationFromExternalRef.current) {
49351
49522
  isPaginationFromExternalRef.current = false;
@@ -49416,45 +49587,70 @@ function AgGridTableInner(props) {
49416
49587
  width: "100%"
49417
49588
  };
49418
49589
  }, [height]);
49419
- return require$$1.jsx("div", {
49420
- className: "".concat(AG_GRID_THEME_CLASS, " ag-grid-table-wrapper ").concat(className),
49421
- style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : {
49422
- height: "100%",
49423
- width: "100%"
49424
- },
49425
- children: require$$1.jsx(agGridReact.AgGridReact, {
49426
- ref: gridRef,
49427
- rowData: rowData,
49428
- columnDefs: columnDefsWithVisibility,
49429
- getRowId: function getRowId(params) {
49430
- return _getRowId(params.data);
49590
+ // When serverSidePagination is true, disable AG Grid's built-in pagination.
49591
+ // We render our own bar below with proper React click handlers.
49592
+ var useGridPagination = !serverSidePagination && pagination;
49593
+ // When server-side pagination is active, wrap in a flex column so the grid
49594
+ // shrinks and the pagination bar is always visible (never clipped by overflow-hidden).
49595
+ var outerStyle = serverSidePagination ? {
49596
+ display: 'flex',
49597
+ flexDirection: 'column',
49598
+ height: '100%',
49599
+ width: '100%'
49600
+ } : {};
49601
+ return require$$1.jsxs("div", {
49602
+ style: outerStyle,
49603
+ children: [require$$1.jsx("div", {
49604
+ className: "".concat(AG_GRID_THEME_CLASS, " ag-grid-table-wrapper ").concat(className),
49605
+ style: serverSidePagination ? {
49606
+ flex: '1 1 0%',
49607
+ minHeight: 0,
49608
+ width: '100%'
49609
+ } : containerStyle !== null && containerStyle !== void 0 ? containerStyle : {
49610
+ height: "100%",
49611
+ width: "100%"
49431
49612
  },
49432
- loading: loading,
49433
- overlayNoRowsTemplate: "<span class=\"ag-overlay-no-rows-center\">".concat(escapeOverlayText(emptyMessage), "</span>"),
49434
- rowSelection: getRowSelectionOption(rowSelection, serverSidePagination),
49435
- popupParent: typeof document !== "undefined" ? document.body : null,
49436
- onGridReady: onGridReady,
49437
- onSortChanged: onSortChanged,
49438
- onPaginationChanged: onPaginationChanged,
49439
- onSelectionChanged: rowSelection !== false ? onSelectionChanged : undefined,
49440
- defaultColDef: Object.assign({
49441
- sortable: false,
49442
- resizable: true
49443
- }, defaultColDef),
49444
- domLayout: domLayout,
49445
- rowHeight: 60,
49446
- suppressRowTransform: true,
49447
- headerHeight: 44,
49448
- pagination: pagination,
49449
- paginationPageSize: (_a = serverSideConfig === null || serverSideConfig === void 0 ? void 0 : serverSideConfig.pageSize) !== null && _a !== void 0 ? _a : 10,
49450
- paginationPageSizeSelector: (_b = serverSideConfig === null || serverSideConfig === void 0 ? void 0 : serverSideConfig.pageSizeSelector) !== null && _b !== void 0 ? _b : DEFAULT_PAGE_SIZE_SELECTOR,
49451
- cacheBlockSize: cacheBlockSize,
49452
- pinnedBottomRowData: footerData === null || footerData === void 0 ? void 0 : footerData.map(function (row, i) {
49453
- return _typeof(row) === "object" && row !== null && !("id" in row) ? Object.assign(Object.assign({}, row), {
49454
- id: "pinned-bottom-".concat(i)
49455
- }) : row;
49613
+ children: require$$1.jsx(agGridReact.AgGridReact, {
49614
+ ref: gridRef,
49615
+ rowData: rowData,
49616
+ columnDefs: columnDefsWithVisibility,
49617
+ getRowId: function getRowId(params) {
49618
+ return _getRowId(params.data);
49619
+ },
49620
+ loading: loading,
49621
+ overlayNoRowsTemplate: "<span class=\"ag-overlay-no-rows-center\">".concat(escapeOverlayText(emptyMessage), "</span>"),
49622
+ rowSelection: getRowSelectionOption(rowSelection, serverSidePagination),
49623
+ popupParent: typeof document !== "undefined" ? document.body : null,
49624
+ onGridReady: onGridReady,
49625
+ onSortChanged: onSortChanged,
49626
+ onPaginationChanged: useGridPagination ? onPaginationChanged : undefined,
49627
+ onSelectionChanged: rowSelection !== false ? onSelectionChanged : undefined,
49628
+ defaultColDef: Object.assign({
49629
+ sortable: false,
49630
+ resizable: true
49631
+ }, defaultColDef),
49632
+ domLayout: domLayout,
49633
+ rowHeight: 60,
49634
+ suppressRowTransform: true,
49635
+ headerHeight: 44,
49636
+ pagination: useGridPagination,
49637
+ paginationPageSize: useGridPagination ? (_a = serverSideConfig === null || serverSideConfig === void 0 ? void 0 : serverSideConfig.pageSize) !== null && _a !== void 0 ? _a : 10 : undefined,
49638
+ paginationPageSizeSelector: useGridPagination ? (_b = serverSideConfig === null || serverSideConfig === void 0 ? void 0 : serverSideConfig.pageSizeSelector) !== null && _b !== void 0 ? _b : DEFAULT_PAGE_SIZE_SELECTOR : undefined,
49639
+ cacheBlockSize: cacheBlockSize,
49640
+ pinnedBottomRowData: footerData === null || footerData === void 0 ? void 0 : footerData.map(function (row, i) {
49641
+ return _typeof(row) === "object" && row !== null && !("id" in row) ? Object.assign(Object.assign({}, row), {
49642
+ id: "pinned-bottom-".concat(i)
49643
+ }) : row;
49644
+ })
49456
49645
  })
49457
- })
49646
+ }), serverSidePagination && serverSideConfig && require$$1.jsx(ServerSidePaginationBar, {
49647
+ totalCount: serverSideConfig.totalCount,
49648
+ currentPage: serverSideConfig.currentPage,
49649
+ pageSize: serverSideConfig.pageSize,
49650
+ onPageChange: serverSideConfig.onPageChange,
49651
+ onPageSizeChange: serverSideConfig.onPageSizeChange,
49652
+ pageSizeSelector: serverSideConfig.pageSizeSelector
49653
+ })]
49458
49654
  });
49459
49655
  }
49460
49656
  var AgGridTable = AgGridTableInner;