cynx-ui 1.2.8 → 1.2.10

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.
@@ -29,14 +29,15 @@ const SHAPES = {
29
29
  };
30
30
 
31
31
  const KEYFRAMES = `@keyframes badge-pulse{0%,100%{opacity:1}50%{opacity:.4}}`;
32
- let styleInjected = false;
32
+ let _id = 'cynx-badge-styles';
33
33
 
34
34
  function ensureStyles() {
35
- if (styleInjected || typeof document === 'undefined') return;
35
+ if (typeof document === 'undefined') return;
36
+ if (document.getElementById(_id)) return;
36
37
  const tag = document.createElement('style');
38
+ tag.id = _id;
37
39
  tag.textContent = KEYFRAMES;
38
40
  document.head.appendChild(tag);
39
- styleInjected = true;
40
41
  }
41
42
 
42
43
  const SIZE_MAP = {
@@ -81,15 +81,19 @@ const STYLES = `
81
81
  @keyframes modalCardOut { from { opacity:1; transform:scale(1) translateY(0) } to { opacity:0; transform:scale(.96) translateY(-8px) } }
82
82
  `;
83
83
 
84
- let injected = false;
84
+ let _id = 'cynx-modal-styles';
85
85
  function ensureStyles() {
86
- if (injected || typeof document === 'undefined') return;
86
+ if (typeof document === 'undefined') return;
87
+ if (document.getElementById(_id)) return;
87
88
  const tag = document.createElement('style');
89
+ tag.id = _id;
88
90
  tag.textContent = STYLES;
89
91
  document.head.appendChild(tag);
90
- injected = true;
91
92
  }
92
93
 
94
+ // Auto-inject on module load
95
+ if (typeof document !== 'undefined') ensureStyles();
96
+
93
97
  export function Modal({ open, onClose, onBeforeClose, title, children, footer, maxWidth = 520, bodyStyle }) {
94
98
  const [closing, setClosing] = useState(false);
95
99
  const mounted = useRef(open);
@@ -17,14 +17,15 @@ const SIZES = {
17
17
  };
18
18
 
19
19
  const KEYFRAMES = `@keyframes pdot-pulse{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.3);opacity:0}}`;
20
- let styleInjected = false;
20
+ let _id = 'cynx-pulsedot-styles';
21
21
 
22
22
  function ensureStyles() {
23
- if (styleInjected || typeof document === 'undefined') return;
23
+ if (typeof document === 'undefined') return;
24
+ if (document.getElementById(_id)) return;
24
25
  const tag = document.createElement('style');
26
+ tag.id = _id;
25
27
  tag.textContent = KEYFRAMES;
26
28
  document.head.appendChild(tag);
27
- styleInjected = true;
28
29
  }
29
30
 
30
31
  export default function PulseDot({
@@ -3,14 +3,15 @@ import { createPortal } from 'react-dom';
3
3
  import { ChevronDown, Check, X } from 'lucide-react';
4
4
 
5
5
  const KEYFRAMES = `@keyframes selFadeIn{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}`;
6
- let styleInjected = false;
6
+ let _id = 'cynx-select-styles';
7
7
 
8
8
  function ensureStyles() {
9
- if (styleInjected || typeof document === 'undefined') return;
9
+ if (typeof document === 'undefined') return;
10
+ if (document.getElementById(_id)) return;
10
11
  const tag = document.createElement('style');
12
+ tag.id = _id;
11
13
  tag.textContent = KEYFRAMES;
12
14
  document.head.appendChild(tag);
13
- styleInjected = true;
14
15
  }
15
16
 
16
17
  export default function Select({
@@ -3,16 +3,19 @@ const STYLES = `
3
3
  .skeleton{background:linear-gradient(90deg,var(--grey-1,#f0f1f5) 25%,var(--border-light,#e8e8ec) 50%,var(--grey-1,#f0f1f5) 75%);background-size:600px 100%;animation:sk-shimmer 1.4s ease infinite;border-radius:var(--radxs,4px)}
4
4
  .skeleton-text{height:12px;margin-bottom:6px}
5
5
  `;
6
- let styleInjected = false;
7
-
6
+ let _id = 'cynx-skeleton-styles';
8
7
  function ensureStyles() {
9
- if (styleInjected || typeof document === 'undefined') return;
8
+ if (typeof document === 'undefined') return;
9
+ if (document.getElementById(_id)) return;
10
10
  const tag = document.createElement('style');
11
+ tag.id = _id;
11
12
  tag.textContent = STYLES;
12
13
  document.head.appendChild(tag);
13
- styleInjected = true;
14
14
  }
15
15
 
16
+ // Auto-inject on module load so raw className="skeleton" works everywhere
17
+ if (typeof document !== 'undefined') ensureStyles();
18
+
16
19
  const SK_BASE = {
17
20
  background: 'linear-gradient(90deg, var(--grey-1, #f0f1f5) 25%, var(--border-light, #e8e8ec) 50%, var(--grey-1, #f0f1f5) 75%)',
18
21
  backgroundSize: '600px 100%',
@@ -1,14 +1,18 @@
1
1
  const STYLES = `.spin{animation:cx-spin .7s linear infinite}@keyframes cx-spin{to{transform:rotate(360deg)}}`;
2
2
 
3
- let injected = false;
3
+ let _id = 'cynx-spinner-styles';
4
4
  function ensureStyles() {
5
- if (injected || typeof document === 'undefined') return;
5
+ if (typeof document === 'undefined') return;
6
+ if (document.getElementById(_id)) return;
6
7
  const tag = document.createElement('style');
8
+ tag.id = _id;
7
9
  tag.textContent = STYLES;
8
10
  document.head.appendChild(tag);
9
- injected = true;
10
11
  }
11
12
 
13
+ // Auto-inject on module load
14
+ if (typeof document !== 'undefined') ensureStyles();
15
+
12
16
  export function Spinner({ size = 20, inline = false, color = 'currentColor', fullPage = false }) {
13
17
  ensureStyles();
14
18
  const s = inline ? 14 : size;
@@ -17,15 +17,19 @@ const STYLES = `
17
17
  @keyframes cx-toastSlide { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
18
18
  `;
19
19
 
20
- let injected = false;
20
+ let _id = 'cynx-toast-styles';
21
21
  function ensureStyles() {
22
- if (injected || typeof document === 'undefined') return;
22
+ if (typeof document === 'undefined') return;
23
+ if (document.getElementById(_id)) return;
23
24
  const tag = document.createElement('style');
25
+ tag.id = _id;
24
26
  tag.textContent = STYLES;
25
27
  document.head.appendChild(tag);
26
- injected = true;
27
28
  }
28
29
 
30
+ // Auto-inject on module load
31
+ if (typeof document !== 'undefined') ensureStyles();
32
+
29
33
  // ── Module-level state ────────────────────────────────────────────────────────
30
34
  let _toasts = [];
31
35
  let _listeners = new Set();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cynx-ui",
3
- "version": "1.2.8",
3
+ "version": "1.2.10",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js"