cynx-ui 1.3.8 → 1.3.9

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.
@@ -0,0 +1,96 @@
1
+ import React from 'react';
2
+
3
+ const SIZE_CONFIG = {
4
+ xs: { hMargin: '8px 0', vMargin: '0 4px', vHeight: '14px', fontSize: '.7rem', padding: '0 8px' },
5
+ sm: { hMargin: '12px 0', vMargin: '0 8px', vHeight: '18px', fontSize: '.75rem', padding: '0 10px' },
6
+ md: { hMargin: '16px 0', vMargin: '0 12px', vHeight: '24px', fontSize: '.82rem', padding: '0 12px' },
7
+ lg: { hMargin: '24px 0', vMargin: '0 16px', vHeight: '32px', fontSize: '.9rem', padding: '0 16px' },
8
+ xl: { hMargin: '32px 0', vMargin: '0 24px', vHeight: '48px', fontSize: '1rem', padding: '0 20px' },
9
+ };
10
+
11
+ export default function Divider({
12
+ children,
13
+ label,
14
+ orientation = 'horizontal',
15
+ align = 'center',
16
+ size = 'md',
17
+ color = 'var(--border-light, #ebebf0)',
18
+ thickness = 1,
19
+ variant = 'solid',
20
+ style = {},
21
+ className = '',
22
+ ...props
23
+ }) {
24
+ const content = children || label;
25
+ const cfg = SIZE_CONFIG[size] || SIZE_CONFIG.md;
26
+ const thickStr = typeof thickness === 'number' ? `${thickness}px` : thickness;
27
+ const lineStyle = `${thickStr} ${variant} ${color}`;
28
+
29
+ if (orientation === 'vertical') {
30
+ return (
31
+ <div
32
+ className={`cynx-divider cynx-divider-vertical ${className}`}
33
+ style={{
34
+ display: 'inline-block',
35
+ width: 0,
36
+ height: style.height || cfg.vHeight,
37
+ margin: style.margin || cfg.vMargin,
38
+ borderLeft: lineStyle,
39
+ verticalAlign: 'middle',
40
+ alignSelf: 'center',
41
+ flexShrink: 0,
42
+ ...style,
43
+ }}
44
+ {...props}
45
+ />
46
+ );
47
+ }
48
+
49
+ // Horizontal Divider
50
+ if (content) {
51
+ const leftFlex = align === 'left' ? '0 0 16px' : '1';
52
+ const rightFlex = align === 'right' ? '0 0 16px' : '1';
53
+
54
+ return (
55
+ <div
56
+ className={`cynx-divider cynx-divider-horizontal ${className}`}
57
+ style={{
58
+ display: 'flex',
59
+ alignItems: 'center',
60
+ width: '100%',
61
+ margin: style.margin || cfg.hMargin,
62
+ ...style,
63
+ }}
64
+ {...props}
65
+ >
66
+ <div style={{ flex: leftFlex, borderBottom: lineStyle }} />
67
+ <span
68
+ style={{
69
+ padding: cfg.padding,
70
+ fontSize: cfg.fontSize,
71
+ color: 'var(--muted, #9b9daa)',
72
+ fontWeight: 500,
73
+ whiteSpace: 'nowrap',
74
+ lineHeight: 1,
75
+ }}
76
+ >
77
+ {content}
78
+ </span>
79
+ <div style={{ flex: rightFlex, borderBottom: lineStyle }} />
80
+ </div>
81
+ );
82
+ }
83
+
84
+ return (
85
+ <div
86
+ className={`cynx-divider cynx-divider-horizontal ${className}`}
87
+ style={{
88
+ width: '100%',
89
+ margin: style.margin || cfg.hMargin,
90
+ borderBottom: lineStyle,
91
+ ...style,
92
+ }}
93
+ {...props}
94
+ />
95
+ );
96
+ }
package/index.js CHANGED
@@ -38,9 +38,11 @@ import { XTable as _XTable, XThead as _XThead, XTbody as _XTbody, XTr as _XTr, X
38
38
  import { PageShell as _PageShell, TableCard as _TableCard, TableCardFilters as _TableCardFilters, TableCardBody as _TableCardBody, TableCardFooter as _TableCardFooter, CardHdr as _CardHdr, StatCard as _StatCard, StatCardSkeleton as _StatCardSkeleton } from './components/Card.jsx';
39
39
 
40
40
  import { default as _FilePicker } from './components/FilePicker.jsx';
41
+ import { default as _Divider } from './components/Divider.jsx';
41
42
 
42
43
  export const Button = _Button;
43
44
  export const FilePicker = _FilePicker;
45
+ export const Divider = _Divider;
44
46
  export const Input = _Input;
45
47
  export const Toggle = _Toggle;
46
48
  export const Spinner = _Spinner || _SpinnerNamed;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cynx-ui",
3
- "version": "1.3.8",
3
+ "version": "1.3.9",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js"