cynx-ui 1.3.17 → 1.3.18

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.
@@ -20,13 +20,15 @@ const STYLES = `
20
20
  display: flex; align-items: center; justify-content: space-between;
21
21
  padding: 15px 20px; border-bottom: 1px solid var(--border-light);
22
22
  border-radius: 14px 14px 0 0;
23
+ flex-shrink: 0;
23
24
  }
24
25
  .modal-title { font-size: .88rem; font-weight: 700; letter-spacing: -.01em; }
25
- .modal-body { padding: 20px; overflow: visible; }
26
+ .modal-body { padding: 20px; overflow-x: hidden; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
26
27
  .modal-footer {
27
28
  display: flex; justify-content: flex-end; gap: 8px;
28
29
  padding: 13px 20px; border-top: 1px solid var(--border-light);
29
30
  background: var(--grey-1); border-radius: 0 0 14px 14px;
31
+ flex-shrink: 0;
30
32
  }
31
33
  .modal-card {
32
34
  background: var(--surface); border: 1px solid var(--border);
@@ -94,7 +96,7 @@ function ensureStyles() {
94
96
  // Auto-inject on module load
95
97
  if (typeof document !== 'undefined') ensureStyles();
96
98
 
97
- export function Modal({ open, onClose, onBeforeClose, title, children, footer, maxWidth = 520, bodyStyle }) {
99
+ export function Modal({ open, onClose, onBeforeClose, title, children, footer, maxWidth = 520, maxHeight, bodyStyle, style }) {
98
100
  const [closing, setClosing] = useState(false);
99
101
  const mounted = useRef(open);
100
102
 
@@ -131,6 +133,7 @@ export function Modal({ open, onClose, onBeforeClose, title, children, footer, m
131
133
 
132
134
  const resolvedFooter = typeof footer === 'function' ? footer(close) : footer;
133
135
  const resolvedChildren = typeof children === 'function' ? children(close) : children;
136
+ const resolvedMaxHeight = style?.maxHeight || maxHeight || '60vh';
134
137
 
135
138
  return createPortal(
136
139
  <div
@@ -138,7 +141,7 @@ export function Modal({ open, onClose, onBeforeClose, title, children, footer, m
138
141
  style={{
139
142
  position: 'fixed', inset: 0,
140
143
  background: 'rgba(20,22,41,.45)',
141
- display: 'flex', alignItems: 'center', justifyContent: 'center',
144
+ display: 'flex', alignItems: 'center', justifyItems: 'center', justifyContent: 'center',
142
145
  zIndex: 8000, padding: 20,
143
146
  animation: `${closing ? 'modalFadeOut' : 'modalFadeIn'} .26s ease forwards`,
144
147
  }}
@@ -148,25 +151,28 @@ export function Modal({ open, onClose, onBeforeClose, title, children, footer, m
148
151
  className="modal-card"
149
152
  style={{
150
153
  background: 'var(--surface)', border: '1px solid var(--border)',
151
- borderRadius: 14, width: '100%', maxWidth, maxHeight: '60vh',
154
+ borderRadius: 14, width: '100%',
155
+ maxWidth: style?.maxWidth || maxWidth,
156
+ maxHeight: resolvedMaxHeight,
152
157
  boxShadow: 'var(--slg, 0 20px 60px rgba(0,0,0,.25))',
153
158
  overflow: 'hidden', display: 'flex', flexDirection: 'column',
154
159
  animation: `${closing ? 'modalCardOut' : 'modalCardIn'} .26s cubic-bezier(.4,0,.2,1) forwards`,
160
+ ...style,
155
161
  }}
156
162
  onMouseDown={e => e.stopPropagation()}
157
163
  >
158
164
  <div className="modal-hdr" style={{
159
165
  display: 'flex', alignItems: 'center', justifyContent: 'space-between',
160
166
  padding: '15px 20px', borderBottom: '1px solid var(--border-light)',
161
- borderRadius: '14px 14px 0 0',
167
+ borderRadius: '14px 14px 0 0', flexShrink: 0,
162
168
  }}>
163
169
  <span className="modal-title" style={{ fontSize: '.88rem', fontWeight: 700, letterSpacing: '-.01em' }}>{title}</span>
164
170
  </div>
165
- <div className="modal-body" style={{ padding: 20, overflowX: 'hidden', overflowY: 'auto', flex: 1, minHeight: 0, ...bodyStyle }}>{resolvedChildren}</div>
171
+ <div className="modal-body" style={{ padding: 20, overflowX: 'hidden', overflowY: 'auto', flex: '1 1 auto', minHeight: 0, ...bodyStyle }}>{resolvedChildren}</div>
166
172
  {resolvedFooter && <div className="modal-footer" style={{
167
173
  display: 'flex', justifyContent: 'flex-end', gap: 8,
168
174
  padding: '13px 20px', borderTop: '1px solid var(--border-light)',
169
- background: 'var(--grey-1)', borderRadius: '0 0 14px 14px',
175
+ background: 'var(--grey-1)', borderRadius: '0 0 14px 14px', flexShrink: 0,
170
176
  }}>{resolvedFooter}</div>}
171
177
  </div>
172
178
  </div>,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cynx-ui",
3
- "version": "1.3.17",
3
+ "version": "1.3.18",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js"