cynx-ui 1.3.15 → 1.3.17

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.
@@ -106,7 +106,7 @@ export default function Button({
106
106
 
107
107
  return (
108
108
  <button
109
- className={className}
109
+ className={`btn btn-${variant} ${className}`.trim()}
110
110
  disabled={disabled || loading}
111
111
  onClick={onClick}
112
112
  style={{
@@ -2,7 +2,7 @@ import { useState, useEffect, useCallback } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
3
 
4
4
  const STYLES = `
5
- #toast-root { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 99999; }
5
+ #toast-root { position: fixed; top: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 99999; }
6
6
  .toast {
7
7
  background: var(--surface, #fff); border: 1px solid var(--border, #d7d8e0);
8
8
  border-radius: var(--rads, 8px); padding: 10px 14px;
@@ -70,11 +70,23 @@ export function useToast() {
70
70
  return { toasts, toast, remove };
71
71
  }
72
72
 
73
+ const POSITIONS = {
74
+ 'top-right': { top: 20, right: 20, bottom: 'auto', left: 'auto' },
75
+ 'top-left': { top: 20, left: 20, bottom: 'auto', right: 'auto' },
76
+ 'top-center': { top: 20, left: '50%', transform: 'translateX(-50%)', bottom: 'auto', right: 'auto' },
77
+ 'bottom-right': { bottom: 20, right: 20, top: 'auto', left: 'auto' },
78
+ 'bottom-left': { bottom: 20, left: 20, top: 'auto', right: 'auto' },
79
+ 'bottom-center': { bottom: 20, left: '50%', transform: 'translateX(-50%)', top: 'auto', right: 'auto' },
80
+ 'top': { top: 20, right: 20, bottom: 'auto', left: 'auto' },
81
+ 'bottom': { bottom: 20, right: 20, top: 'auto', left: 'auto' },
82
+ };
83
+
73
84
  // ── Render component ──────────────────────────────────────────────────────────
74
- export function Toast({ toasts, remove }) {
85
+ export function Toast({ toasts, remove, position = 'top-right', style = {} }) {
75
86
  ensureStyles();
87
+ const posStyle = POSITIONS[position] || POSITIONS['top-right'];
76
88
  return createPortal(
77
- <div id="toast-root">
89
+ <div id="toast-root" style={{ ...posStyle, ...style }}>
78
90
  {toasts.map(t => (
79
91
  <div key={t.id} className={`toast ${t.type}`} onClick={() => remove(t.id)}>
80
92
  {t.type === 'ok' || t.type === 'success'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cynx-ui",
3
- "version": "1.3.15",
3
+ "version": "1.3.17",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js"