@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.
@@ -26,7 +26,7 @@ export interface DialogTriggerProps extends React.HTMLAttributes<HTMLElement> {
26
26
  }
27
27
  export declare function Dialog({ open, onOpenChange, children }: DialogProps): import("react/jsx-runtime").JSX.Element;
28
28
  export declare function DialogTrigger({ children, asChild, onClick, ...props }: DialogTriggerProps): import("react/jsx-runtime").JSX.Element;
29
- export declare function DialogContent({ children, className, showCloseButton, ...props }: DialogContentProps): import("react/jsx-runtime").JSX.Element | null;
29
+ export declare function DialogContent({ children, className, showCloseButton, ...props }: DialogContentProps): React.ReactPortal | null;
30
30
  export declare function DialogHeader({ children, className, ...props }: DialogHeaderProps): import("react/jsx-runtime").JSX.Element;
31
31
  export declare function DialogFooter({ children, className, ...props }: DialogFooterProps): import("react/jsx-runtime").JSX.Element;
32
32
  export declare function DialogTitle({ children, className, ...props }: DialogTitleProps): import("react/jsx-runtime").JSX.Element;
package/dist/index.esm.js CHANGED
@@ -45637,13 +45637,15 @@ function DialogContent(_a) {
45637
45637
  };
45638
45638
  }, [context === null || context === void 0 ? void 0 : context.open]);
45639
45639
  if (!(context === null || context === void 0 ? void 0 : context.open)) return null;
45640
- return jsxs("div", {
45640
+ var portalTarget = typeof document !== 'undefined' ? document.body : null;
45641
+ if (!portalTarget) return null;
45642
+ return /*#__PURE__*/ReactDOM__default.createPortal(jsxs("div", {
45641
45643
  className: "fixed inset-0 flex items-center justify-center",
45642
45644
  style: {
45643
45645
  zIndex: 999999
45644
45646
  },
45645
45647
  children: [jsx("div", {
45646
- className: "fixed inset-0 bg-black/50 backdrop-blur-sm",
45648
+ className: "fixed inset-0 bg-black/50",
45647
45649
  style: {
45648
45650
  zIndex: 999998
45649
45651
  },
@@ -45651,7 +45653,7 @@ function DialogContent(_a) {
45651
45653
  return context.onOpenChange(false);
45652
45654
  }
45653
45655
  }), jsxs("div", Object.assign({
45654
- 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),
45656
+ 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),
45655
45657
  style: {
45656
45658
  zIndex: 999999
45657
45659
  }
@@ -45666,7 +45668,7 @@ function DialogContent(_a) {
45666
45668
  })
45667
45669
  }), children]
45668
45670
  }))]
45669
- });
45671
+ }), portalTarget);
45670
45672
  }
45671
45673
  function DialogHeader(_a) {
45672
45674
  var children = _a.children,
@@ -49253,6 +49255,169 @@ function getRowSelectionOption(rowSelection, serverSidePagination) {
49253
49255
  }
49254
49256
  return rowSelection;
49255
49257
  }
49258
+ /* ------------------------------------------------------------------ */
49259
+ /* Server-side pagination bar – replaces AG Grid's built-in panel */
49260
+ /* when serverSidePagination=true to avoid page-reset feedback loops */
49261
+ /* ------------------------------------------------------------------ */
49262
+ var paginationBtnStyle = function paginationBtnStyle(disabled) {
49263
+ return {
49264
+ display: 'inline-flex',
49265
+ alignItems: 'center',
49266
+ justifyContent: 'center',
49267
+ width: 32,
49268
+ height: 32,
49269
+ border: '1px solid #e2e8f0',
49270
+ borderRadius: 6,
49271
+ background: disabled ? 'transparent' : '#fff',
49272
+ color: disabled ? '#cbd5e1' : '#475569',
49273
+ cursor: disabled ? 'default' : 'pointer',
49274
+ fontSize: 16,
49275
+ lineHeight: 1,
49276
+ transition: 'background 0.15s, border-color 0.15s'
49277
+ };
49278
+ };
49279
+ var ServerSidePaginationBar = /*#__PURE__*/React__default.memo(function ServerSidePaginationBar(_ref) {
49280
+ var totalCount = _ref.totalCount,
49281
+ currentPage = _ref.currentPage,
49282
+ pageSize = _ref.pageSize,
49283
+ onPageChange = _ref.onPageChange,
49284
+ onPageSizeChange = _ref.onPageSizeChange,
49285
+ _ref$pageSizeSelector = _ref.pageSizeSelector,
49286
+ pageSizeSelector = _ref$pageSizeSelector === void 0 ? DEFAULT_PAGE_SIZE_SELECTOR : _ref$pageSizeSelector;
49287
+ var totalPages = Math.max(1, Math.ceil(totalCount / pageSize));
49288
+ var start = totalCount === 0 ? 0 : (currentPage - 1) * pageSize + 1;
49289
+ var end = Math.min(currentPage * pageSize, totalCount);
49290
+ var atFirst = currentPage <= 1;
49291
+ var atLast = currentPage >= totalPages;
49292
+ return jsxs("div", {
49293
+ style: {
49294
+ display: 'flex',
49295
+ alignItems: 'center',
49296
+ justifyContent: 'flex-end',
49297
+ gap: 16,
49298
+ padding: '10px 16px',
49299
+ borderTop: '1px solid #e2e8f0',
49300
+ fontSize: 13,
49301
+ color: '#64748b',
49302
+ background: '#fff',
49303
+ flexShrink: 0,
49304
+ minHeight: 48
49305
+ },
49306
+ role: "navigation",
49307
+ "aria-label": "Pagination",
49308
+ children: [jsxs("span", {
49309
+ style: {
49310
+ display: 'flex',
49311
+ alignItems: 'center',
49312
+ gap: 6
49313
+ },
49314
+ children: [jsx("span", {
49315
+ children: "Page Size:"
49316
+ }), jsx("select", {
49317
+ value: pageSize,
49318
+ onChange: function onChange(e) {
49319
+ return onPageSizeChange(Number(e.target.value));
49320
+ },
49321
+ style: {
49322
+ border: '1px solid #e2e8f0',
49323
+ borderRadius: 6,
49324
+ padding: '4px 8px',
49325
+ fontSize: 13,
49326
+ background: '#fff',
49327
+ color: '#334155',
49328
+ cursor: 'pointer',
49329
+ outline: 'none'
49330
+ },
49331
+ children: pageSizeSelector.map(function (size) {
49332
+ return jsx("option", {
49333
+ value: size,
49334
+ children: size
49335
+ }, size);
49336
+ })
49337
+ })]
49338
+ }), jsxs("span", {
49339
+ style: {
49340
+ display: 'flex',
49341
+ gap: 4
49342
+ },
49343
+ children: [jsx("strong", {
49344
+ style: {
49345
+ color: '#334155'
49346
+ },
49347
+ children: start
49348
+ }), ' to ', jsx("strong", {
49349
+ style: {
49350
+ color: '#334155'
49351
+ },
49352
+ children: end
49353
+ }), ' of ', jsx("strong", {
49354
+ style: {
49355
+ color: '#334155'
49356
+ },
49357
+ children: totalCount
49358
+ })]
49359
+ }), jsxs("span", {
49360
+ style: {
49361
+ display: 'flex',
49362
+ alignItems: 'center',
49363
+ gap: 4
49364
+ },
49365
+ children: [jsx("button", {
49366
+ type: "button",
49367
+ disabled: atFirst,
49368
+ onClick: function onClick() {
49369
+ return onPageChange(1);
49370
+ },
49371
+ style: paginationBtnStyle(atFirst),
49372
+ "aria-label": "First Page",
49373
+ children: "\u226A"
49374
+ }), jsx("button", {
49375
+ type: "button",
49376
+ disabled: atFirst,
49377
+ onClick: function onClick() {
49378
+ return onPageChange(currentPage - 1);
49379
+ },
49380
+ style: paginationBtnStyle(atFirst),
49381
+ "aria-label": "Previous Page",
49382
+ children: "\u2039"
49383
+ }), jsxs("span", {
49384
+ style: {
49385
+ margin: '0 8px',
49386
+ fontSize: 13
49387
+ },
49388
+ children: ["Page ", jsx("strong", {
49389
+ style: {
49390
+ color: '#334155'
49391
+ },
49392
+ children: currentPage
49393
+ }), " of ", jsx("strong", {
49394
+ style: {
49395
+ color: '#334155'
49396
+ },
49397
+ children: totalPages
49398
+ })]
49399
+ }), jsx("button", {
49400
+ type: "button",
49401
+ disabled: atLast,
49402
+ onClick: function onClick() {
49403
+ return onPageChange(currentPage + 1);
49404
+ },
49405
+ style: paginationBtnStyle(atLast),
49406
+ "aria-label": "Next Page",
49407
+ children: "\u203A"
49408
+ }), jsx("button", {
49409
+ type: "button",
49410
+ disabled: atLast,
49411
+ onClick: function onClick() {
49412
+ return onPageChange(totalPages);
49413
+ },
49414
+ style: paginationBtnStyle(atLast),
49415
+ "aria-label": "Last Page",
49416
+ children: "\u226B"
49417
+ })]
49418
+ })]
49419
+ });
49420
+ });
49256
49421
  function AgGridTableInner(props) {
49257
49422
  var _a, _b;
49258
49423
  var rowData = props.rowData,
@@ -49297,7 +49462,8 @@ function AgGridTableInner(props) {
49297
49462
  state: sortStateToColumnState(sortState)
49298
49463
  });
49299
49464
  }
49300
- if (serverSidePagination && serverSideConfig) {
49465
+ // For non-server-side pagination, sync AG Grid's internal page
49466
+ if (!serverSidePagination && serverSideConfig) {
49301
49467
  isPaginationFromExternalRef.current = true;
49302
49468
  event.api.paginationGoToPage(serverSideConfig.currentPage - 1);
49303
49469
  event.api.setGridOption("paginationPageSize", serverSideConfig.pageSize);
@@ -49310,8 +49476,9 @@ function AgGridTableInner(props) {
49310
49476
  state: sortStateToColumnState(sortState)
49311
49477
  });
49312
49478
  }, [sortState]);
49479
+ // Sync AG Grid internal page — only for NON-server-side pagination
49313
49480
  useEffect(function () {
49314
- if (!serverSidePagination || !serverSideConfig || !apiRef.current) return;
49481
+ if (serverSidePagination || !serverSideConfig || !apiRef.current) return;
49315
49482
  var api = apiRef.current;
49316
49483
  var currentGridPage = api.paginationGetCurrentPage();
49317
49484
  var currentGridSize = api.paginationGetPageSize();
@@ -49324,8 +49491,12 @@ function AgGridTableInner(props) {
49324
49491
  },
49325
49492
  // eslint-disable-next-line react-hooks/exhaustive-deps
49326
49493
  [serverSidePagination, serverSideConfig === null || serverSideConfig === void 0 ? void 0 : serverSideConfig.currentPage, serverSideConfig === null || serverSideConfig === void 0 ? void 0 : serverSideConfig.pageSize]);
49494
+ // onPaginationChanged — only relevant for NON-server-side mode
49327
49495
  var onPaginationChanged = useCallback(function (event) {
49328
- if (!serverSidePagination || !serverSideConfig || !event.api) return;
49496
+ // When serverSidePagination is true, AG Grid's pagination is disabled;
49497
+ // our custom bar handles page changes directly. Ignore all grid events.
49498
+ if (serverSidePagination) return;
49499
+ if (!serverSideConfig || !event.api) return;
49329
49500
  if (event.newData) return;
49330
49501
  if (isPaginationFromExternalRef.current) {
49331
49502
  isPaginationFromExternalRef.current = false;
@@ -49396,45 +49567,70 @@ function AgGridTableInner(props) {
49396
49567
  width: "100%"
49397
49568
  };
49398
49569
  }, [height]);
49399
- return jsx("div", {
49400
- className: "".concat(AG_GRID_THEME_CLASS, " ag-grid-table-wrapper ").concat(className),
49401
- style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : {
49402
- height: "100%",
49403
- width: "100%"
49404
- },
49405
- children: jsx(AgGridReact, {
49406
- ref: gridRef,
49407
- rowData: rowData,
49408
- columnDefs: columnDefsWithVisibility,
49409
- getRowId: function getRowId(params) {
49410
- return _getRowId(params.data);
49570
+ // When serverSidePagination is true, disable AG Grid's built-in pagination.
49571
+ // We render our own bar below with proper React click handlers.
49572
+ var useGridPagination = !serverSidePagination && pagination;
49573
+ // When server-side pagination is active, wrap in a flex column so the grid
49574
+ // shrinks and the pagination bar is always visible (never clipped by overflow-hidden).
49575
+ var outerStyle = serverSidePagination ? {
49576
+ display: 'flex',
49577
+ flexDirection: 'column',
49578
+ height: '100%',
49579
+ width: '100%'
49580
+ } : {};
49581
+ return jsxs("div", {
49582
+ style: outerStyle,
49583
+ children: [jsx("div", {
49584
+ className: "".concat(AG_GRID_THEME_CLASS, " ag-grid-table-wrapper ").concat(className),
49585
+ style: serverSidePagination ? {
49586
+ flex: '1 1 0%',
49587
+ minHeight: 0,
49588
+ width: '100%'
49589
+ } : containerStyle !== null && containerStyle !== void 0 ? containerStyle : {
49590
+ height: "100%",
49591
+ width: "100%"
49411
49592
  },
49412
- loading: loading,
49413
- overlayNoRowsTemplate: "<span class=\"ag-overlay-no-rows-center\">".concat(escapeOverlayText(emptyMessage), "</span>"),
49414
- rowSelection: getRowSelectionOption(rowSelection, serverSidePagination),
49415
- popupParent: typeof document !== "undefined" ? document.body : null,
49416
- onGridReady: onGridReady,
49417
- onSortChanged: onSortChanged,
49418
- onPaginationChanged: onPaginationChanged,
49419
- onSelectionChanged: rowSelection !== false ? onSelectionChanged : undefined,
49420
- defaultColDef: Object.assign({
49421
- sortable: false,
49422
- resizable: true
49423
- }, defaultColDef),
49424
- domLayout: domLayout,
49425
- rowHeight: 60,
49426
- suppressRowTransform: true,
49427
- headerHeight: 44,
49428
- pagination: pagination,
49429
- paginationPageSize: (_a = serverSideConfig === null || serverSideConfig === void 0 ? void 0 : serverSideConfig.pageSize) !== null && _a !== void 0 ? _a : 10,
49430
- paginationPageSizeSelector: (_b = serverSideConfig === null || serverSideConfig === void 0 ? void 0 : serverSideConfig.pageSizeSelector) !== null && _b !== void 0 ? _b : DEFAULT_PAGE_SIZE_SELECTOR,
49431
- cacheBlockSize: cacheBlockSize,
49432
- pinnedBottomRowData: footerData === null || footerData === void 0 ? void 0 : footerData.map(function (row, i) {
49433
- return _typeof(row) === "object" && row !== null && !("id" in row) ? Object.assign(Object.assign({}, row), {
49434
- id: "pinned-bottom-".concat(i)
49435
- }) : row;
49593
+ children: jsx(AgGridReact, {
49594
+ ref: gridRef,
49595
+ rowData: rowData,
49596
+ columnDefs: columnDefsWithVisibility,
49597
+ getRowId: function getRowId(params) {
49598
+ return _getRowId(params.data);
49599
+ },
49600
+ loading: loading,
49601
+ overlayNoRowsTemplate: "<span class=\"ag-overlay-no-rows-center\">".concat(escapeOverlayText(emptyMessage), "</span>"),
49602
+ rowSelection: getRowSelectionOption(rowSelection, serverSidePagination),
49603
+ popupParent: typeof document !== "undefined" ? document.body : null,
49604
+ onGridReady: onGridReady,
49605
+ onSortChanged: onSortChanged,
49606
+ onPaginationChanged: useGridPagination ? onPaginationChanged : undefined,
49607
+ onSelectionChanged: rowSelection !== false ? onSelectionChanged : undefined,
49608
+ defaultColDef: Object.assign({
49609
+ sortable: false,
49610
+ resizable: true
49611
+ }, defaultColDef),
49612
+ domLayout: domLayout,
49613
+ rowHeight: 60,
49614
+ suppressRowTransform: true,
49615
+ headerHeight: 44,
49616
+ pagination: useGridPagination,
49617
+ paginationPageSize: useGridPagination ? (_a = serverSideConfig === null || serverSideConfig === void 0 ? void 0 : serverSideConfig.pageSize) !== null && _a !== void 0 ? _a : 10 : undefined,
49618
+ paginationPageSizeSelector: useGridPagination ? (_b = serverSideConfig === null || serverSideConfig === void 0 ? void 0 : serverSideConfig.pageSizeSelector) !== null && _b !== void 0 ? _b : DEFAULT_PAGE_SIZE_SELECTOR : undefined,
49619
+ cacheBlockSize: cacheBlockSize,
49620
+ pinnedBottomRowData: footerData === null || footerData === void 0 ? void 0 : footerData.map(function (row, i) {
49621
+ return _typeof(row) === "object" && row !== null && !("id" in row) ? Object.assign(Object.assign({}, row), {
49622
+ id: "pinned-bottom-".concat(i)
49623
+ }) : row;
49624
+ })
49436
49625
  })
49437
- })
49626
+ }), serverSidePagination && serverSideConfig && jsx(ServerSidePaginationBar, {
49627
+ totalCount: serverSideConfig.totalCount,
49628
+ currentPage: serverSideConfig.currentPage,
49629
+ pageSize: serverSideConfig.pageSize,
49630
+ onPageChange: serverSideConfig.onPageChange,
49631
+ onPageSizeChange: serverSideConfig.onPageSizeChange,
49632
+ pageSizeSelector: serverSideConfig.pageSizeSelector
49633
+ })]
49438
49634
  });
49439
49635
  }
49440
49636
  var AgGridTable = AgGridTableInner;