cynx-lib 1.3.103 → 1.3.105

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cynx-lib",
3
- "version": "1.3.103",
3
+ "version": "1.3.105",
4
4
  "type": "module",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
@@ -82,7 +82,7 @@ export function TableCardFooter({ total = 0, page = 1, limit = 100, pages = 1, o
82
82
  boxSizing: 'border-box',
83
83
  ...style,
84
84
  }}>
85
- <span>
85
+ <span style={{ whiteSpace: 'nowrap', flexShrink: 0 }}>
86
86
  {total === 0 ? '0 записей' : `${from}–${to} из ${total}`}
87
87
  </span>
88
88
  <Pagination page={page} pages={pages} onChange={onChange} />
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { ChevronLeft, ChevronRight } from 'lucide-react';
3
3
 
4
- export function Pagination({ page = 1, pages = 1, total, perPage, pageSize, onChange, size = 'md', style = {} }) {
4
+ export function Pagination({ page = 1, pages = 1, total, perPage, pageSize, onChange, size = 'md', showTotal = false, style = {} }) {
5
5
  const effectivePerPage = pageSize || perPage || 20;
6
6
  const totalPages = pages || (total && effectivePerPage ? Math.ceil(total / effectivePerPage) : 0);
7
7
  if (!totalPages || totalPages <= 1) return null;
@@ -12,8 +12,9 @@ export function Pagination({ page = 1, pages = 1, total, perPage, pageSize, onCh
12
12
  else if (items[items.length - 1] !== '...') items.push('...');
13
13
  }
14
14
 
15
- const start = effectivePerPage ? (page - 1) * effectivePerPage + 1 : null;
16
- const end = effectivePerPage ? Math.min(page * effectivePerPage, total) : null;
15
+ const hasTotal = typeof total === 'number' && !isNaN(total);
16
+ const start = hasTotal && effectivePerPage ? (page - 1) * effectivePerPage + 1 : null;
17
+ const end = hasTotal && effectivePerPage ? Math.min(page * effectivePerPage, total) : null;
17
18
 
18
19
  const SIZES = {
19
20
  xs: { box: 26, icon: 13, font: '11px', gap: 6 },
@@ -29,19 +30,20 @@ export function Pagination({ page = 1, pages = 1, total, perPage, pageSize, onCh
29
30
  display: 'flex',
30
31
  alignItems: 'center',
31
32
  justifyContent: 'space-between',
32
- width: '100%',
33
+ flexShrink: 0,
34
+ width: 'auto',
33
35
  padding: '8px 0',
34
36
  userSelect: 'none',
35
37
  ...style,
36
38
  }}
37
39
  >
38
- {start !== null && (
40
+ {showTotal && hasTotal && start !== null && (
39
41
  <div style={{ fontSize: '.75rem', color: 'var(--muted, #797b8d)', fontFamily: 'var(--mono, ui-monospace, monospace)' }}>
40
42
  {start}–{end} of {total}
41
43
  </div>
42
44
  )}
43
45
 
44
- <div style={{ display: 'flex', gap: currentSize.gap, alignItems: 'center', marginLeft: start !== null ? 'auto' : 0 }}>
46
+ <div style={{ display: 'flex', gap: currentSize.gap, alignItems: 'center', marginLeft: 'auto' }}>
45
47
  {/* Prev Button */}
46
48
  <button
47
49
  type="button"
@@ -61,11 +61,15 @@ export function XTr({ children, onClick, style, className = '', ...props }) {
61
61
  );
62
62
  }
63
63
 
64
- export function XTh({ children, style, className = '', ...props }) {
64
+ export function XTh({ children, style, className = '', bg = 'transparent', ...props }) {
65
65
  return (
66
66
  <th
67
67
  className={className}
68
68
  style={{
69
+ position: 'sticky',
70
+ top: 0,
71
+ zIndex: 2,
72
+ background: bg,
69
73
  textAlign: 'left',
70
74
  padding: '8px 10px',
71
75
  fontSize: '.68rem',