react-confirm-lite 1.3.0 → 1.4.1

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/README.md CHANGED
@@ -27,14 +27,23 @@ pnpm add react-confirm-lite
27
27
 
28
28
  ## 🚀 Quick Start
29
29
 
30
- ### 1. Add the Container Component
30
+ ### Complete Example
31
31
 
32
- Place `<ConfirmContainer />` in your app (usually in root layout):
32
+ Place `<ConfirmContainer />` in your app (usually in root layout) and use it with `confirm`
33
33
 
34
34
  ```tsx
35
- import { ConfirmContainer } from 'react-confirm-lite';
35
+ import { ConfirmContainer, confirm } from 'react-confirm-lite';
36
36
 
37
37
  function App() {
38
+ async function handleAction() {
39
+ const result = await confirm('Are you sure?');
40
+
41
+ if (result) {
42
+ console.log('User confirmed!');
43
+ } else {
44
+ console.log('User cancelled!');
45
+ }
46
+ }
38
47
  return (
39
48
  <div>
40
49
  {/* Your app content */}
@@ -44,23 +53,17 @@ function App() {
44
53
  }
45
54
  ```
46
55
 
47
- ### 2. Use the Confirm Function
48
-
49
- Import and use `confirm()` anywhere in your app:
50
-
51
- ```tsx
52
- import { confirm } from 'react-confirm-lite';
56
+ ### Important
57
+ By default it shows the closest container to button to which you clicked to show the confirmation dialog but you are a programmer and you will try thing and sometimes you may use it in useEffect hook then in this case it will show the first rendered confirm container.
53
58
 
54
- async function handleAction() {
55
- const result = await confirm('Are you sure?');
56
-
57
- if (result) {
58
- console.log('User confirmed!');
59
- } else {
60
- console.log('User cancelled!');
61
- }
62
- }
59
+ If you want to show a specific container by confirm api no matters where it is then you can pass the id like this
60
+ ```jsx
61
+ // In confirm Api
62
+ confirm({id:'1' , message:'Are you sure?'})
63
+ // And in confirm Container
64
+ <ConfirmContainer id='1'/>
63
65
  ```
66
+ And make sure that not to pass same id to different `<ConfirmContainer />` In this way It will show both of these containers
64
67
 
65
68
  ## 🎯 Features
66
69
 
@@ -163,6 +166,7 @@ const result = await confirm({
163
166
 
164
167
  | Prop | Type | Default | Description |
165
168
  |------|------|---------|-------------|
169
+ |`id`|`string`| `random` | To show a specific container with a specific confirm() app |
166
170
  | `animation` | `AnimationType` | `'slide'` | Animation type (18 options) |
167
171
  | `animationDuration` | `number` | `300` | Base animation duration (ms) |
168
172
  | `animationDurationIn` | `number` | - | Enter animation duration |
@@ -260,6 +264,7 @@ Want complete control over the UI? Use the render prop:
260
264
  - `colorSchema`: Current color scheme
261
265
  - `animationClass`: CSS class for current animation
262
266
  - `animationStyle`: Style object with animation duration
267
+ - `lockScroll`: Boolean, If will be true then scroll will be locked when dialog will show.
263
268
 
264
269
  ## 📱 Real-World Examples
265
270
 
@@ -336,6 +341,7 @@ const handleFlexibleDialog = async () => {
336
341
  closeOnClickOutside={true} // Allow backdrop click to close
337
342
  animationDurationIn={350} // Enter: 350ms
338
343
  animationDurationOut={250} // Exit: 250ms
344
+ lockScroll={false} // true by default
339
345
  />
340
346
  ```
341
347
 
@@ -357,6 +363,7 @@ const handleFlexibleDialog = async () => {
357
363
  <ConfirmContainer closeOnEscape={true} closeOnClickOutside={false} />
358
364
  // Users can close via: OK, Cancel, or ESC key
359
365
  ```
366
+ If user will close dialog box by clicking outside or by pressing escape then it will return `null`
360
367
 
361
368
  ## 🎨 Animation Gallery
362
369
 
@@ -383,6 +390,10 @@ const handleFlexibleDialog = async () => {
383
390
 
384
391
  ## 🚨 Troubleshooting
385
392
 
393
+ ### Multiple dialogs are showing?
394
+ - Make sure you are on version `>=1.4`
395
+ - Make sure you didn't pass same id to different `<ConfirmContainer />`
396
+
386
397
  ### Dialog not showing?
387
398
  - Make sure `<ConfirmContainer />` is mounted
388
399
  - Check it's not conditionally rendered
@@ -408,6 +419,9 @@ const handleFlexibleDialog = async () => {
408
419
  - Use `classes` prop to override styles
409
420
  - Check CSS specificity
410
421
 
422
+ You can also use it in TanStack with react easily
423
+
424
+
411
425
  ## 📱 Next.js Support
412
426
 
413
427
  ### App Router (Next.js 15+)
@@ -475,6 +489,207 @@ if (result === true) {
475
489
  - Zero configuration
476
490
  - Three return states (true/false/null)
477
491
 
492
+ # Contributing to react-confirm-lite
493
+
494
+ Thanks for your interest in contributing. This project is intentionally lightweight, so the contribution workflow is kept simple and explicit. Please read this fully before starting.
495
+
496
+ ---
497
+
498
+ ## 📦 Project Structure
499
+
500
+ ```
501
+ react-confirm-lite/
502
+ ├─ src/ # Library source code
503
+ ├─ dist/ # Built output (generated)
504
+ ├─ example/ # Local playground app (Vite + React)
505
+ ├─ CONTRIBUTING.md
506
+ ├─ README.md
507
+ ├─ package.json
508
+ ├─ tsup.config.ts
509
+ ```
510
+
511
+ * **src/** → where you make changes
512
+ * **dist/** → auto-generated by tsup (do not edit manually)
513
+ * **example/** → used to test changes locally
514
+
515
+ ---
516
+
517
+ ## 🧰 Prerequisites
518
+
519
+ * Node.js >= 18
520
+ * npm >= 9
521
+ * Basic familiarity with React + TypeScript
522
+
523
+ ---
524
+
525
+ ## 🚀 Local Development Setup
526
+
527
+ ### 1. Clone the repository
528
+
529
+ ```bash
530
+ git clone https://github.com/SaadNasir-git/react-confirm-lite.git
531
+ cd react-confirm-lite
532
+ ```
533
+
534
+ ### 2. Install dependencies (root)
535
+
536
+ ```bash
537
+ npm install
538
+ ```
539
+
540
+ ---
541
+
542
+ ## 🔁 Development Workflow (IMPORTANT)
543
+
544
+ This project uses **tsup watch mode** for live rebuilding.
545
+
546
+ ### Terminal 1 — Run library in watch mode
547
+
548
+ From the project root:
549
+
550
+ ```bash
551
+ npm run build:watch
552
+ ```
553
+
554
+ This will:
555
+
556
+ * Watch `src/` for changes
557
+ * Automatically rebuild `dist/`
558
+ * Re-run post-build steps when files change
559
+
560
+ ⚠️ Leave this terminal running.
561
+
562
+ ---
563
+
564
+ ### Terminal 2 — Run example app
565
+
566
+ ```bash
567
+ cd example
568
+ npm install
569
+ npm run dev
570
+ ```
571
+
572
+ Open the provided local URL in your browser.
573
+
574
+ ---
575
+
576
+ ## 🧪 How to Test Your Changes
577
+
578
+ 1. Modify files inside `src/`
579
+ 2. tsup automatically rebuilds the library
580
+ 3. Refresh the browser running the example app
581
+ 4. Verify behavior visually and via console logs
582
+
583
+ You **do not** need to:
584
+
585
+ * run `npm pack`
586
+ * reinstall the package
587
+ * publish to npm
588
+
589
+ This setup mirrors real-world library development.
590
+
591
+ ---
592
+
593
+ ## 🧠 What to Change (and What Not to)
594
+
595
+ ### ✅ You can change
596
+
597
+ * Logic in `src/`
598
+ * Types in `types.ts`
599
+ * Styles / animations
600
+ * README documentation
601
+
602
+ ### ❌ Do not change
603
+
604
+ * `dist/` files manually
605
+ * Version number (maintainer handles releases)
606
+ * Build configuration unless discussed
607
+
608
+ ---
609
+
610
+ ## 🧹 Code Style
611
+
612
+ * Use TypeScript types explicitly
613
+ * Avoid unnecessary abstractions
614
+ * Prefer clarity over cleverness
615
+ * Keep bundle size in mind
616
+
617
+ ---
618
+
619
+ ## 🐞 Reporting Bugs
620
+
621
+ When opening an issue, include:
622
+
623
+ * What you expected
624
+ * What actually happened
625
+ * Steps to reproduce
626
+ * Browser and React version
627
+
628
+ ---
629
+
630
+ ## 💡 Feature Requests
631
+
632
+ Feature requests are welcome, but keep in mind:
633
+
634
+ * This library aims to stay minimal
635
+ * Features should not add heavy dependencies
636
+ * API simplicity is a priority
637
+
638
+ ---
639
+
640
+ ## 🛠 Development & Contributing
641
+
642
+ If you want to contribute or modify the library locally, use the built-in example app and watch mode.
643
+
644
+ ### Local Development Setup
645
+
646
+ ```bash
647
+ git clone https://github.com/SaadNasir-git/react-confirm-lite.git
648
+ cd react-confirm-lite
649
+ npm install
650
+ ```
651
+
652
+ ### Run Library in Watch Mode
653
+
654
+ In the project root:
655
+
656
+ ```bash
657
+ npm run build:watch
658
+ ```
659
+
660
+ This watches the `src/` directory and automatically rebuilds `dist/` on every change.
661
+
662
+ ### Run Example App
663
+
664
+ In a second terminal:
665
+
666
+ ```bash
667
+ cd example
668
+ npm install
669
+ npm run dev
670
+ ```
671
+
672
+ Open the local URL shown by Vite. Any change you make in `src/` will be reflected after a browser refresh.
673
+
674
+ ### Notes
675
+
676
+ * Do **not** edit files inside `dist/` manually
677
+ * You do **not** need to run `npm pack` or reinstall the package
678
+ * Versioning and releases are handled by the maintainer
679
+
680
+ For more details, see **CONTRIBUTING.md**.
681
+
682
+ ---
683
+
684
+ ## 📄 License
685
+
686
+ By contributing, you agree that your contributions will be licensed under the MIT License.
687
+
688
+ ---
689
+
690
+ Thanks for contributing to **react-confirm-lite** 🙌
691
+
692
+
478
693
  ## 📄 License
479
694
 
480
695
  MIT License - free for personal and commercial use.
package/dist/index.d.ts CHANGED
@@ -12,7 +12,8 @@ type ConfirmClasses = {
12
12
  cancel?: string;
13
13
  ok?: string;
14
14
  };
15
- type ConfirmInput = string | {
15
+ type ConfirmInput = {
16
+ id?: string;
16
17
  title?: string;
17
18
  message: string;
18
19
  colorSchema?: ColorSchema;
@@ -20,6 +21,7 @@ type ConfirmInput = string | {
20
21
  cancelText?: string;
21
22
  };
22
23
  type ConfirmOptions = {
24
+ id: string;
23
25
  title: string;
24
26
  message: string;
25
27
  resolve: (value: boolean | null) => void;
@@ -60,6 +62,7 @@ type Props = {
60
62
  animationDuration?: number;
61
63
  animationDurationIn?: number;
62
64
  animationDurationOut?: number;
65
+ lockScroll?: boolean;
63
66
  children?: (props: {
64
67
  isVisible: boolean;
65
68
  confirm: ConfirmOptions;
@@ -70,9 +73,10 @@ type Props = {
70
73
  animationClass: string;
71
74
  animationStyle: CSSProperties;
72
75
  }) => ReactNode;
76
+ id?: string;
73
77
  };
74
- declare const ConfirmContainer: ({ classes, animationDuration, defaultColorSchema, closeOnEscape, closeOnClickOutside, animation, animationDurationIn, animationDurationOut, children }: Props) => string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
78
+ declare const ConfirmContainer: ({ classes, animationDuration, defaultColorSchema, closeOnEscape, closeOnClickOutside, animation, animationDurationIn, animationDurationOut, lockScroll, children, id }: Props) => react_jsx_runtime.JSX.Element;
75
79
 
76
- declare function confirm(input: ConfirmInput): Promise<boolean | null>;
80
+ declare function confirm(input: string | ConfirmInput): Promise<boolean | null>;
77
81
 
78
82
  export { type AnimationType, type ColorSchema, type ConfirmClasses, ConfirmContainer, type ConfirmInput, type ConfirmOptions, type animationPairs, confirm };
package/dist/index.js CHANGED
@@ -1,17 +1,32 @@
1
1
  'use client';
2
2
  import { useState, useRef, useEffect, useCallback } from 'react';
3
- import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
 
5
5
  // src/confirm_store.ts
6
+ var containerId = "";
6
7
  var confirms = [];
7
8
  var listeners = /* @__PURE__ */ new Set();
8
- function addAlert(input) {
9
+ var isActiveContainer = false;
10
+ var containers = [];
11
+ var scrollPosition;
12
+ var activeContainerId = null;
13
+ function setIsContainerActive(value) {
14
+ isActiveContainer = value;
15
+ }
16
+ function getIsContainerActive() {
17
+ return isActiveContainer;
18
+ }
19
+ function setActiveContainer(id) {
20
+ activeContainerId = id;
21
+ }
22
+ function getActiveContainerId() {
23
+ return activeContainerId;
24
+ }
25
+ async function addAlert(input) {
9
26
  return new Promise((resolve) => {
10
- const alert = typeof input === "string" ? {
11
- title: "Confirm",
12
- message: input,
13
- resolve
14
- } : {
27
+ const alert = {
28
+ id: input.id || "",
29
+ // Keep the ID for container targeting
15
30
  title: input.title || "Confirm",
16
31
  message: input.message,
17
32
  okText: input.okText,
@@ -20,16 +35,25 @@ function addAlert(input) {
20
35
  resolve
21
36
  };
22
37
  confirms = [...confirms, alert];
38
+ if (input.id) {
39
+ setActiveContainer(input.id);
40
+ } else {
41
+ setActiveContainer(null);
42
+ }
23
43
  if (confirms.length === 1) {
24
44
  emit();
25
45
  }
26
46
  });
27
47
  }
28
- function closeAlert(result) {
48
+ async function closeAlert(result) {
29
49
  const alert = confirms[0];
50
+ containerId = "";
30
51
  if (!alert) return;
31
52
  alert.resolve(result);
32
53
  confirms = confirms.slice(1);
54
+ if (confirms.length === 0) {
55
+ setActiveContainer(null);
56
+ }
33
57
  emit();
34
58
  }
35
59
  function subscribe(listener) {
@@ -40,9 +64,57 @@ function subscribe(listener) {
40
64
  function emit() {
41
65
  listeners.forEach((listener) => listener(confirms));
42
66
  }
67
+ var EventListener = (e) => {
68
+ if (containers.length === 0) {
69
+ containers.push(document.querySelectorAll(".null-confirm-container"));
70
+ }
71
+ if (containers.length === 0) return;
72
+ if (containers.length === 1) {
73
+ containerId = containers[0][0].id;
74
+ return;
75
+ }
76
+ let parentElement = e.view?.document.activeElement?.parentElement;
77
+ let container = parentElement?.querySelector(".null-confirm-container");
78
+ while (true) {
79
+ if (container?.id) {
80
+ break;
81
+ }
82
+ parentElement = parentElement?.parentElement;
83
+ container = parentElement?.querySelector(".null-confirm-container");
84
+ }
85
+ if (container?.id) {
86
+ containerId = container.id;
87
+ }
88
+ };
89
+ async function getElement() {
90
+ document.addEventListener("click", EventListener, { once: true });
91
+ await new Promise((resolve) => {
92
+ setTimeout(() => {
93
+ document.removeEventListener("click", EventListener);
94
+ resolve();
95
+ }, 0);
96
+ });
97
+ if (containerId === "") {
98
+ if (containers.length === 0) {
99
+ containers.push(document.querySelectorAll(".null-confirm-container"));
100
+ }
101
+ return containers[0][0].id;
102
+ }
103
+ return containerId;
104
+ }
105
+ var lockBodyScroll = () => {
106
+ scrollPosition = window.pageYOffset || document.documentElement.scrollTop;
107
+ document.body.classList.add("body-scroll-lock");
108
+ document.body.style.top = `-${scrollPosition}px`;
109
+ };
110
+ var unlockBodyScroll = () => {
111
+ document.body.classList.remove("body-scroll-lock");
112
+ document.body.style.removeProperty("top");
113
+ window.scrollTo(0, scrollPosition);
114
+ };
43
115
 
44
116
  // src/confirm.css
45
- var confirm_default = "/* confirm.css */\n.alert-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 9999;\n display: flex;\n align-items: center;\n justify-content: center;\n backdrop-filter: blur(4px);\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',\n 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n animation: overlayFadeIn 0.3s ease-out forwards;\n}\n\n.alert-overlay-exit {\n animation: overlayFadeOut 0.3s ease-in forwards;\n}\n\n.alert-wrapper {\n width: 90%;\n max-width: 400px;\n border-radius: 12px;\n padding: 24px;\n box-shadow: \n 0 20px 25px -5px rgba(0, 0, 0, 0.1),\n 0 10px 10px -5px rgba(0, 0, 0, 0.04),\n 0 0 0 1px rgba(0, 0, 0, 0.05);\n animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;\n transform: translateY(20px) scale(0.98);\n}\n\n.alert-wrapper-exit {\n animation: modalSlideDown 0.3s ease-in forwards;\n}\n\n.alert-title {\n font-size: 18px;\n font-weight: 600;\n line-height: 1.4;\n margin: 0 0 12px 0;\n}\n\n.alert-message {\n font-size: 14px;\n line-height: 1.5;\n margin: 0 0 24px 0;\n}\n\n.alert-buttons {\n display: flex;\n justify-content: flex-end;\n gap: 12px;\n margin-top: 8px;\n}\n\n.alert-button {\n padding: 10px 20px;\n border-radius: 8px;\n font-size: 14px;\n font-weight: 500;\n border: none;\n cursor: pointer;\n font-family: inherit;\n transition: all 0.2s ease;\n min-width: 80px;\n text-align: center;\n}\n\n.alert-button:focus {\n outline-offset: 2px;\n}\n\n.alert-button:active {\n transform: translateY(1px);\n}\n\n/* Default animations */\n.alert-wrapper-exit {\n animation: modalSlideDown 0.3s ease-in forwards;\n}\n\n/* Entrance Animation Classes */\n.alert-animate-fadeInScale {\n animation: fadeInScale 0.4s ease-out forwards;\n}\n\n.alert-animate-bounceIn {\n animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;\n}\n\n.alert-animate-flipIn {\n animation: flipIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;\n}\n\n.alert-animate-zoomIn {\n animation: zoomIn 0.3s ease-out forwards;\n}\n\n.alert-animate-rotateIn {\n animation: rotateIn 0.5s ease-out forwards;\n}\n\n.alert-animate-fadeInUp {\n animation: fadeInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;\n}\n\n.alert-animate-dropIn {\n animation: dropIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;\n}\n\n.alert-animate-slideInRight {\n animation: slideInRight 0.4s ease-out forwards;\n}\n\n.alert-animate-slideInLeft {\n animation: slideInLeft 0.4s ease-out forwards;\n}\n\n.alert-animate-fadeInDown {\n animation: fadeInDown 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;\n}\n\n.alert-animate-slideDownIn {\n animation: slideDownIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;\n}\n\n.alert-animate-rotateInRight {\n animation: rotateInRight 0.5s ease-out forwards;\n}\n\n.alert-animate-zoomInSmall {\n animation: zoomInSmall 0.3s ease-out forwards;\n}\n\n.alert-animate-bounceInSmall {\n animation: bounceInSmall 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;\n}\n\n.alert-animate-fadeInBlur {\n animation: fadeInBlur 0.4s ease-out forwards;\n}\n\n.alert-animate-fadeInShrink {\n animation: fadeInShrink 0.3s ease-out forwards;\n}\n\n/* Exit Animation Classes */\n.alert-animate-fadeOutScale {\n animation: fadeOutScale 0.3s ease-in forwards;\n}\n\n.alert-animate-bounceOut {\n animation: bounceOut 0.4s ease-in forwards;\n}\n\n.alert-animate-zoomOut {\n animation: zoomOut 0.3s ease-in forwards;\n}\n\n.alert-animate-rotateOut {\n animation: rotateOut 0.3s ease-in forwards;\n}\n\n.alert-animate-fadeOutDown {\n animation: fadeOutDown 0.3s ease-in forwards;\n}\n\n.alert-animate-slideOutRight {\n animation: slideOutRight 0.3s ease-in forwards;\n}\n\n.alert-animate-slideOutLeft {\n animation: slideOutLeft 0.3s ease-in forwards;\n}\n\n.alert-animate-flipOut {\n animation: flipOut 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;\n}\n\n.alert-animate-dropOut {\n animation: dropOut 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;\n}\n\n.alert-animate-fadeOutUp {\n animation: fadeOutUp 0.3s ease-in forwards;\n}\n\n.alert-animate-slideUpOut {\n animation: slideUpOut 0.3s ease-in forwards;\n}\n\n.alert-animate-rotateOutLeft {\n animation: rotateOutLeft 0.3s ease-in forwards;\n}\n\n.alert-animate-zoomOutSmall {\n animation: zoomOutSmall 0.3s ease-in forwards;\n}\n\n.alert-animate-bounceOutSmall {\n animation: bounceOutSmall 0.4s ease-in forwards;\n}\n\n.alert-animate-fadeOutBlur {\n animation: fadeOutBlur 0.4s ease-in forwards;\n}\n\n.alert-animate-fadeOutShrink {\n animation: fadeOutShrink 0.3s ease-in forwards;\n}\n\n.alert-wrapper {\n width: 90%;\n max-width: 400px;\n border-radius: 12px;\n padding: 24px;\n box-shadow: \n 0 20px 25px -5px rgba(0, 0, 0, 0.1),\n 0 10px 10px -5px rgba(0, 0, 0, 0.04),\n 0 0 0 1px rgba(0, 0, 0, 0.05);\n}";
117
+ var confirm_default = "/* confirm.css */\n.alert-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 9999;\n display: flex;\n align-items: center;\n justify-content: center;\n backdrop-filter: blur(4px);\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',\n 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n animation: overlayFadeIn 0.3s ease-out forwards;\n}\n\n.alert-overlay-exit {\n animation: overlayFadeOut 0.3s ease-in forwards;\n}\n\n.alert-wrapper {\n width: 90%;\n max-width: 400px;\n border-radius: 12px;\n padding: 24px;\n box-shadow: \n 0 20px 25px -5px rgba(0, 0, 0, 0.1),\n 0 10px 10px -5px rgba(0, 0, 0, 0.04),\n 0 0 0 1px rgba(0, 0, 0, 0.05);\n animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;\n transform: translateY(20px) scale(0.98);\n}\n\n.alert-wrapper-exit {\n animation: modalSlideDown 0.3s ease-in forwards;\n}\n\n.alert-title {\n font-size: 18px;\n font-weight: 600;\n line-height: 1.4;\n margin: 0 0 12px 0;\n}\n\n.alert-message {\n font-size: 14px;\n line-height: 1.5;\n margin: 0 0 24px 0;\n}\n\n.alert-buttons {\n display: flex;\n justify-content: flex-end;\n gap: 12px;\n margin-top: 8px;\n}\n\n.alert-button {\n padding: 10px 20px;\n border-radius: 8px;\n font-size: 14px;\n font-weight: 500;\n border: none;\n cursor: pointer;\n font-family: inherit;\n transition: all 0.2s ease;\n min-width: 80px;\n text-align: center;\n}\n\n.alert-button:focus {\n outline-offset: 2px;\n}\n\n.alert-button:active {\n transform: translateY(1px);\n}\n\n/* Default animations */\n.alert-wrapper-exit {\n animation: modalSlideDown 0.3s ease-in forwards;\n}\n\n/* Entrance Animation Classes */\n.alert-animate-fadeInScale {\n animation: fadeInScale 0.4s ease-out forwards;\n}\n\n.alert-animate-bounceIn {\n animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;\n}\n\n.alert-animate-flipIn {\n animation: flipIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;\n}\n\n.alert-animate-zoomIn {\n animation: zoomIn 0.3s ease-out forwards;\n}\n\n.alert-animate-rotateIn {\n animation: rotateIn 0.5s ease-out forwards;\n}\n\n.alert-animate-fadeInUp {\n animation: fadeInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;\n}\n\n.alert-animate-dropIn {\n animation: dropIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;\n}\n\n.alert-animate-slideInRight {\n animation: slideInRight 0.4s ease-out forwards;\n}\n\n.alert-animate-slideInLeft {\n animation: slideInLeft 0.4s ease-out forwards;\n}\n\n.alert-animate-fadeInDown {\n animation: fadeInDown 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;\n}\n\n.alert-animate-slideDownIn {\n animation: slideDownIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;\n}\n\n.alert-animate-rotateInRight {\n animation: rotateInRight 0.5s ease-out forwards;\n}\n\n.alert-animate-zoomInSmall {\n animation: zoomInSmall 0.3s ease-out forwards;\n}\n\n.alert-animate-bounceInSmall {\n animation: bounceInSmall 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;\n}\n\n.alert-animate-fadeInBlur {\n animation: fadeInBlur 0.4s ease-out forwards;\n}\n\n.alert-animate-fadeInShrink {\n animation: fadeInShrink 0.3s ease-out forwards;\n}\n\n/* Exit Animation Classes */\n.alert-animate-fadeOutScale {\n animation: fadeOutScale 0.3s ease-in forwards;\n}\n\n.alert-animate-bounceOut {\n animation: bounceOut 0.4s ease-in forwards;\n}\n\n.alert-animate-zoomOut {\n animation: zoomOut 0.3s ease-in forwards;\n}\n\n.alert-animate-rotateOut {\n animation: rotateOut 0.3s ease-in forwards;\n}\n\n.alert-animate-fadeOutDown {\n animation: fadeOutDown 0.3s ease-in forwards;\n}\n\n.alert-animate-slideOutRight {\n animation: slideOutRight 0.3s ease-in forwards;\n}\n\n.alert-animate-slideOutLeft {\n animation: slideOutLeft 0.3s ease-in forwards;\n}\n\n.alert-animate-flipOut {\n animation: flipOut 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;\n}\n\n.alert-animate-dropOut {\n animation: dropOut 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;\n}\n\n.alert-animate-fadeOutUp {\n animation: fadeOutUp 0.3s ease-in forwards;\n}\n\n.alert-animate-slideUpOut {\n animation: slideUpOut 0.3s ease-in forwards;\n}\n\n.alert-animate-rotateOutLeft {\n animation: rotateOutLeft 0.3s ease-in forwards;\n}\n\n.alert-animate-zoomOutSmall {\n animation: zoomOutSmall 0.3s ease-in forwards;\n}\n\n.alert-animate-bounceOutSmall {\n animation: bounceOutSmall 0.4s ease-in forwards;\n}\n\n.alert-animate-fadeOutBlur {\n animation: fadeOutBlur 0.4s ease-in forwards;\n}\n\n.alert-animate-fadeOutShrink {\n animation: fadeOutShrink 0.3s ease-in forwards;\n}\n\n.alert-wrapper {\n width: 90%;\n max-width: 400px;\n border-radius: 12px;\n padding: 24px;\n box-shadow: \n 0 20px 25px -5px rgba(0, 0, 0, 0.1),\n 0 10px 10px -5px rgba(0, 0, 0, 0.04),\n 0 0 0 1px rgba(0, 0, 0, 0.05);\n}\n\n.null-confirm-container{\n width: 0;\n height: 0;\n opacity: 0;\n}\n\n.body-scroll-lock {\n overflow: hidden !important;\n position: fixed !important;\n width: 100% !important;\n}";
46
118
 
47
119
  // src/animations.css
48
120
  var animations_default = "/* animations.css - Complete Animation Keyframes */\n\n/* Overlay Animations */\n@keyframes overlayFadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes overlayFadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n/* Default Modal Animations */\n@keyframes modalSlideUp {\n from {\n opacity: 0;\n transform: translateY(20px) scale(0.98);\n }\n to {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n}\n\n@keyframes modalSlideDown {\n from {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n to {\n opacity: 0;\n transform: translateY(20px) scale(0.98);\n }\n}\n\n/* Fade In/Out with Scale */\n@keyframes fadeInScale {\n from {\n opacity: 0;\n transform: scale(0.95);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n@keyframes fadeOutScale {\n from {\n opacity: 1;\n transform: scale(1);\n }\n to {\n opacity: 0;\n transform: scale(0.95);\n }\n}\n\n/* Slide In/Out from Right */\n@keyframes slideInRight {\n from {\n opacity: 0;\n transform: translateX(30px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n\n@keyframes slideOutRight {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(30px);\n }\n}\n\n/* Slide In/Out from Left */\n@keyframes slideInLeft {\n from {\n opacity: 0;\n transform: translateX(-30px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n\n@keyframes slideOutLeft {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(-30px);\n }\n}\n\n/* Bounce In/Out */\n@keyframes bounceIn {\n 0% {\n opacity: 0;\n transform: scale(0.3);\n }\n 50% {\n opacity: 1;\n transform: scale(1.05);\n }\n 70% {\n transform: scale(0.9);\n }\n 100% {\n transform: scale(1);\n }\n}\n\n@keyframes bounceOut {\n 20% {\n transform: scale(1.1);\n }\n 100% {\n opacity: 0;\n transform: scale(0.3);\n }\n}\n\n/* Small Bounce In/Out */\n@keyframes bounceInSmall {\n 0% {\n opacity: 0;\n transform: scale(0.8);\n }\n 50% {\n opacity: 1;\n transform: scale(1.05);\n }\n 70% {\n transform: scale(0.95);\n }\n 100% {\n transform: scale(1);\n }\n}\n\n@keyframes bounceOutSmall {\n 20% {\n transform: scale(1.05);\n }\n 100% {\n opacity: 0;\n transform: scale(0.8);\n }\n}\n\n/* Flip In/Out */\n@keyframes flipIn {\n 0% {\n opacity: 0;\n transform: perspective(400px) rotateY(90deg);\n }\n 100% {\n opacity: 1;\n transform: perspective(400px) rotateY(0deg);\n }\n}\n\n@keyframes flipOut {\n 0% {\n opacity: 1;\n transform: perspective(400px) rotateY(0deg);\n }\n 100% {\n opacity: 0;\n transform: perspective(400px) rotateY(90deg);\n }\n}\n\n/* Zoom In/Out */\n@keyframes zoomIn {\n from {\n opacity: 0;\n transform: scale(0.5);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n@keyframes zoomOut {\n from {\n opacity: 1;\n transform: scale(1);\n }\n to {\n opacity: 0;\n transform: scale(0.5);\n }\n}\n\n/* Small Zoom In/Out */\n@keyframes zoomInSmall {\n from {\n opacity: 0;\n transform: scale(0.8);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n@keyframes zoomOutSmall {\n from {\n opacity: 1;\n transform: scale(1);\n }\n to {\n opacity: 0;\n transform: scale(0.8);\n }\n}\n\n/* Rotate In/Out */\n@keyframes rotateIn {\n from {\n opacity: 0;\n transform: rotate(-15deg) scale(0.95);\n }\n to {\n opacity: 1;\n transform: rotate(0deg) scale(1);\n }\n}\n\n@keyframes rotateOut {\n from {\n opacity: 1;\n transform: rotate(0deg) scale(1);\n }\n to {\n opacity: 0;\n transform: rotate(15deg) scale(0.95);\n }\n}\n\n/* Rotate Right In/Left Out */\n@keyframes rotateInRight {\n from {\n opacity: 0;\n transform: rotate(15deg) scale(0.95);\n }\n to {\n opacity: 1;\n transform: rotate(0deg) scale(1);\n }\n}\n\n@keyframes rotateOutLeft {\n from {\n opacity: 1;\n transform: rotate(0deg) scale(1);\n }\n to {\n opacity: 0;\n transform: rotate(-15deg) scale(0.95);\n }\n}\n\n/* Fade Up In/Down Out */\n@keyframes fadeInUp {\n from {\n opacity: 0;\n transform: translateY(40px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes fadeOutDown {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(40px);\n }\n}\n\n/* Fade Down In/Up Out */\n@keyframes fadeInDown {\n from {\n opacity: 0;\n transform: translateY(-40px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes fadeOutUp {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(-40px);\n }\n}\n\n/* Drop In/Out (3D) */\n@keyframes dropIn {\n 0% {\n opacity: 0;\n transform: translateY(-100px) rotateX(90deg);\n }\n 70% {\n opacity: 1;\n transform: translateY(10px) rotateX(-10deg);\n }\n 100% {\n transform: translateY(0) rotateX(0deg);\n }\n}\n\n@keyframes dropOut {\n 0% {\n opacity: 1;\n transform: translateY(0) rotateX(0deg);\n }\n 30% {\n opacity: 1;\n transform: translateY(10px) rotateX(-10deg);\n }\n 100% {\n opacity: 0;\n transform: translateY(-100px) rotateX(90deg);\n }\n}\n\n/* Slide Up Out/Down In */\n@keyframes slideUpOut {\n from {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n to {\n opacity: 0;\n transform: translateY(-20px) scale(0.98);\n }\n}\n\n@keyframes slideDownIn {\n from {\n opacity: 0;\n transform: translateY(-20px) scale(0.98);\n }\n to {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n}\n\n/* Blur In/Out Effects */\n@keyframes fadeInBlur {\n from {\n opacity: 0;\n filter: blur(10px);\n }\n to {\n opacity: 1;\n filter: blur(0px);\n }\n}\n\n@keyframes fadeOutBlur {\n from {\n opacity: 1;\n filter: blur(0px);\n }\n to {\n opacity: 0;\n filter: blur(10px);\n }\n}\n\n/* Shrink In/Out Effects */\n@keyframes fadeInShrink {\n from {\n opacity: 0;\n transform: scale(1.2) translateY(20px);\n }\n to {\n opacity: 1;\n transform: scale(1) translateY(0);\n }\n}\n\n@keyframes fadeOutShrink {\n from {\n opacity: 1;\n transform: scale(1) translateY(0);\n }\n to {\n opacity: 0;\n transform: scale(0.8) translateY(20px);\n }\n}\n\n/* Background Blur Animations */\n@keyframes blurIn {\n from {\n backdrop-filter: blur(0px);\n }\n to {\n backdrop-filter: blur(4px);\n }\n}\n\n@keyframes blurOut {\n from {\n backdrop-filter: blur(4px);\n }\n to {\n backdrop-filter: blur(0px);\n }\n}\n\n/* Special Effects Animations */\n\n/* Shake Animation (for errors) */\n@keyframes shake {\n 0%, 100% {\n transform: translateX(0);\n }\n 10%, 30%, 50%, 70%, 90% {\n transform: translateX(-5px);\n }\n 20%, 40%, 60%, 80% {\n transform: translateX(5px);\n }\n}\n\n/* Pulse Animation (for emphasis) */\n@keyframes pulse {\n 0% {\n transform: scale(1);\n }\n 50% {\n transform: scale(1.05);\n }\n 100% {\n transform: scale(1);\n }\n}\n\n/* Button Hover Effects */\n@keyframes buttonHover {\n 0% {\n transform: translateY(0);\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n }\n 50% {\n transform: translateY(-2px);\n box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);\n }\n 100% {\n transform: translateY(-1px);\n box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);\n }\n}\n\n/* Accessibility: Reduce motion */\n@media (prefers-reduced-motion: reduce) {\n .alert-overlay,\n .alert-wrapper,\n .alert-button {\n animation-duration: 0.01ms;\n animation-iteration-count: 1;\n transition-duration: 0.01ms;\n }\n \n .alert-overlay {\n animation: none;\n opacity: 1;\n }\n \n .alert-wrapper {\n animation: none;\n opacity: 1;\n transform: none;\n }\n}";
@@ -99,7 +171,9 @@ var ConfirmContainer = ({
99
171
  animation = "slide",
100
172
  animationDurationIn,
101
173
  animationDurationOut,
102
- children
174
+ lockScroll = true,
175
+ children,
176
+ id
103
177
  }) => {
104
178
  const [alerts, setAlerts] = useState([]);
105
179
  const [isVisible, setIsVisible] = useState(false);
@@ -109,6 +183,8 @@ var ConfirmContainer = ({
109
183
  const overlayRef = useRef(null);
110
184
  const wrapperRef = useRef(null);
111
185
  const exitTimerRef = useRef(null);
186
+ const containerId2 = useRef(id || `confirm-${Date.now().toString()}`);
187
+ const nullElement = /* @__PURE__ */ jsx("div", { id: containerId2.current, className: "null-confirm-container" });
112
188
  useEffect(() => {
113
189
  subscribe((newAlerts) => {
114
190
  setAlerts(newAlerts);
@@ -119,12 +195,21 @@ var ConfirmContainer = ({
119
195
  }, []);
120
196
  useEffect(() => {
121
197
  if (alerts.length > 0 && !currentAlert && !isExiting) {
122
- setIsMounted(true);
123
- const newAlert = alerts[0];
124
- setCurrentAlert(newAlert);
125
- requestAnimationFrame(() => {
126
- setIsVisible(true);
127
- });
198
+ const nextAlert = alerts[0];
199
+ const shouldShowAlert = !nextAlert.id || nextAlert.id === containerId2.current || !getActiveContainerId();
200
+ if (shouldShowAlert) {
201
+ const currentActive = getActiveContainerId();
202
+ if (!currentActive || currentActive === containerId2.current) {
203
+ if (lockScroll) {
204
+ lockBodyScroll();
205
+ }
206
+ setActiveContainer(containerId2.current);
207
+ setIsContainerActive(true);
208
+ setIsMounted(true);
209
+ setCurrentAlert(nextAlert);
210
+ setIsVisible(true);
211
+ }
212
+ }
128
213
  } else if (alerts.length === 0 && currentAlert && isVisible) {
129
214
  setIsExiting(true);
130
215
  setIsVisible(false);
@@ -133,11 +218,12 @@ var ConfirmContainer = ({
133
218
  }
134
219
  const exitDuration = animationDurationOut || animationDuration;
135
220
  exitTimerRef.current = setTimeout(() => {
221
+ setIsContainerActive(false);
136
222
  setIsExiting(false);
137
223
  setCurrentAlert(null);
138
224
  setIsMounted(false);
139
225
  }, exitDuration);
140
- } else if (alerts.length > 0 && currentAlert && alerts[0] !== currentAlert) {
226
+ } else if (alerts.length > 0 && currentAlert && alerts[0].id !== currentAlert.id) {
141
227
  setIsExiting(true);
142
228
  setIsVisible(false);
143
229
  if (exitTimerRef.current) {
@@ -145,25 +231,30 @@ var ConfirmContainer = ({
145
231
  }
146
232
  const exitDuration = animationDurationOut || animationDuration;
147
233
  exitTimerRef.current = setTimeout(() => {
234
+ setIsContainerActive(false);
148
235
  setIsExiting(false);
149
- const newAlert = alerts[0];
150
- setCurrentAlert(newAlert);
151
- requestAnimationFrame(() => {
152
- setIsVisible(true);
153
- });
236
+ setCurrentAlert(null);
237
+ setIsMounted(false);
154
238
  }, exitDuration);
155
239
  }
156
240
  }, [alerts, currentAlert, animationDuration, animationDurationOut, isVisible]);
157
- useEffect(() => {
158
- return () => {
159
- if (exitTimerRef.current) {
160
- clearTimeout(exitTimerRef.current);
161
- }
162
- };
163
- }, []);
164
- const handleClose = useCallback((value) => {
165
- closeAlert(value);
166
- }, []);
241
+ const handleClose = useCallback(async (value) => {
242
+ if (!currentAlert || isExiting) return;
243
+ setIsExiting(true);
244
+ setIsVisible(false);
245
+ const exitDuration = animationDurationOut || animationDuration;
246
+ if (exitTimerRef.current) {
247
+ clearTimeout(exitTimerRef.current);
248
+ }
249
+ exitTimerRef.current = setTimeout(() => {
250
+ closeAlert(value);
251
+ setIsExiting(false);
252
+ setCurrentAlert(null);
253
+ setIsMounted(false);
254
+ setIsContainerActive(false);
255
+ unlockBodyScroll();
256
+ }, exitDuration);
257
+ }, [currentAlert, isExiting, animationDuration, animationDurationOut]);
167
258
  const handleCancel = useCallback(() => {
168
259
  if (currentAlert && isVisible && !isExiting) {
169
260
  handleClose(false);
@@ -203,105 +294,125 @@ var ConfirmContainer = ({
203
294
  };
204
295
  }, [closeOnClickOutside, currentAlert, isVisible, isExiting, handleClose]);
205
296
  if (!isMounted && !isExiting) {
206
- return null;
297
+ return nullElement;
298
+ }
299
+ if (!currentAlert || !getIsContainerActive()) {
300
+ return nullElement;
207
301
  }
208
302
  const colorSchema = currentAlert?.colorSchema || defaultColorSchema;
209
303
  const schemaClass = `schema-${colorSchema}`;
210
304
  const animationStyle = {};
211
305
  const currentDuration = isVisible ? animationDurationIn || animationDuration : animationDurationOut || animationDuration;
212
- if (currentDuration && currentDuration !== 300) {
213
- animationStyle.animationDuration = `${currentDuration}ms`;
214
- }
306
+ animationStyle.animationDuration = `${currentDuration}ms`;
215
307
  animationStyle.animationFillMode = "forwards";
216
308
  const animationClass = isVisible ? animationPairs[animation].enter : animationPairs[animation].exit;
217
- if (children && currentAlert) {
218
- return children({
219
- isVisible: isVisible && !isExiting,
220
- confirm: currentAlert,
221
- handleCancel,
222
- handleOk,
223
- containerRef: wrapperRef,
224
- colorSchema,
225
- animationClass,
226
- animationStyle
227
- });
309
+ if (children && currentAlert && getActiveContainerId() === containerId2.current) {
310
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
311
+ nullElement,
312
+ children({
313
+ isVisible: isVisible && !isExiting,
314
+ confirm: currentAlert,
315
+ handleCancel,
316
+ handleOk,
317
+ containerRef: wrapperRef,
318
+ colorSchema,
319
+ animationClass,
320
+ animationStyle
321
+ })
322
+ ] });
228
323
  }
229
- if (!currentAlert) {
230
- return null;
231
- }
232
- return /* @__PURE__ */ jsx(
233
- "div",
234
- {
235
- ref: overlayRef,
236
- className: cx(
237
- "alert-overlay",
238
- !isVisible ? "alert-overlay-exit" : "",
239
- `${schemaClass}-overlay`,
240
- classes.overlay
241
- ),
242
- style: animationStyle,
243
- children: /* @__PURE__ */ jsxs(
244
- "div",
245
- {
246
- ref: wrapperRef,
247
- className: cx(
248
- "alert-wrapper",
249
- animationClass,
250
- `${schemaClass}-wrapper`,
251
- classes.wrapper
252
- ),
253
- style: animationStyle,
254
- children: [
255
- /* @__PURE__ */ jsx("h2", { className: cx(
256
- "alert-title",
257
- `${schemaClass}-title`,
258
- classes.title
259
- ), children: currentAlert.title }),
260
- /* @__PURE__ */ jsx("p", { className: cx(
261
- "alert-message",
262
- `${schemaClass}-message`,
263
- classes.message
264
- ), children: currentAlert.message }),
265
- /* @__PURE__ */ jsxs("div", { className: "alert-buttons", children: [
266
- /* @__PURE__ */ jsx(
267
- "button",
268
- {
269
- onClick: handleCancel,
270
- disabled: isExiting || !isVisible,
271
- className: cx(
272
- "alert-button alert-button-cancel",
273
- `${schemaClass}-cancel`,
274
- classes.button,
275
- classes.cancel
276
- ),
277
- children: currentAlert.cancelText || "Cancel"
278
- }
279
- ),
280
- /* @__PURE__ */ jsx(
281
- "button",
282
- {
283
- onClick: handleOk,
284
- disabled: isExiting || !isVisible,
285
- className: cx(
286
- "alert-button alert-button-ok",
287
- `${schemaClass}-ok`,
288
- classes.button,
289
- classes.ok
290
- ),
291
- children: currentAlert.okText || "OK"
292
- }
293
- )
294
- ] })
295
- ]
296
- }
297
- )
298
- }
299
- );
324
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
325
+ nullElement,
326
+ /* @__PURE__ */ jsx(
327
+ "div",
328
+ {
329
+ ref: overlayRef,
330
+ className: cx(
331
+ "alert-overlay",
332
+ !isVisible ? "alert-overlay-exit" : "",
333
+ `${schemaClass}-overlay`,
334
+ classes.overlay
335
+ ),
336
+ style: animationStyle,
337
+ children: /* @__PURE__ */ jsxs(
338
+ "div",
339
+ {
340
+ ref: wrapperRef,
341
+ className: cx(
342
+ "alert-wrapper",
343
+ animationClass,
344
+ `${schemaClass}-wrapper`,
345
+ classes.wrapper
346
+ ),
347
+ style: animationStyle,
348
+ children: [
349
+ /* @__PURE__ */ jsx("h2", { className: cx(
350
+ "alert-title",
351
+ `${schemaClass}-title`,
352
+ classes.title
353
+ ), children: currentAlert.title }),
354
+ /* @__PURE__ */ jsx("p", { className: cx(
355
+ "alert-message",
356
+ `${schemaClass}-message`,
357
+ classes.message
358
+ ), children: currentAlert.message }),
359
+ /* @__PURE__ */ jsxs("div", { className: "alert-buttons", children: [
360
+ /* @__PURE__ */ jsx(
361
+ "button",
362
+ {
363
+ onClick: handleCancel,
364
+ disabled: isExiting || !isVisible,
365
+ className: cx(
366
+ "alert-button alert-button-cancel",
367
+ `${schemaClass}-cancel`,
368
+ classes.button,
369
+ classes.cancel
370
+ ),
371
+ children: currentAlert.cancelText || "Cancel"
372
+ }
373
+ ),
374
+ /* @__PURE__ */ jsx(
375
+ "button",
376
+ {
377
+ onClick: handleOk,
378
+ disabled: isExiting || !isVisible,
379
+ className: cx(
380
+ "alert-button alert-button-ok",
381
+ `${schemaClass}-ok`,
382
+ classes.button,
383
+ classes.ok
384
+ ),
385
+ children: currentAlert.okText || "OK"
386
+ }
387
+ )
388
+ ] })
389
+ ]
390
+ }
391
+ )
392
+ }
393
+ )
394
+ ] });
300
395
  };
301
396
  var confirmContainer_default = ConfirmContainer;
302
397
 
303
398
  // src/confirm.ts
304
399
  async function confirm(input) {
400
+ if (typeof input === "string") {
401
+ const containerId2 = await getElement();
402
+ const result2 = await addAlert({
403
+ message: input,
404
+ id: containerId2
405
+ });
406
+ return result2;
407
+ }
408
+ if (!input.id) {
409
+ const containerId2 = await getElement();
410
+ const result2 = await addAlert({
411
+ ...input,
412
+ id: containerId2
413
+ });
414
+ return result2;
415
+ }
305
416
  const result = await addAlert(input);
306
417
  return result;
307
418
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/confirm_store.ts","../src/confirm.css","../src/animations.css","../src/colorSchemas.css","../src/bundle-css.ts","../src/confirmContainer.tsx","../src/confirm.ts"],"names":[],"mappings":";;;;AAIA,IAAI,WAA6B,EAAC;AAClC,IAAI,SAAA,uBAAgB,GAAA,EAAc;AAE3B,SAAS,SAAS,KAAA,EAA8C;AACrE,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,OAAA,KAAY;AAC9B,IAAA,MAAM,KAAA,GACJ,OAAO,KAAA,KAAU,QAAA,GACb;AAAA,MACA,KAAA,EAAO,SAAA;AAAA,MACP,OAAA,EAAS,KAAA;AAAA,MACT;AAAA,KACF,GACE;AAAA,MACA,KAAA,EAAO,MAAM,KAAA,IAAS,SAAA;AAAA,MACtB,SAAS,KAAA,CAAM,OAAA;AAAA,MACf,QAAQ,KAAA,CAAM,MAAA;AAAA,MACd,YAAY,KAAA,CAAM,UAAA;AAAA,MAClB,aAAa,KAAA,CAAM,WAAA;AAAA,MACnB;AAAA,KACF;AAEJ,IAAA,QAAA,GAAW,CAAC,GAAG,QAAA,EAAU,KAAK,CAAA;AAE9B,IAAA,IAAI,QAAA,CAAS,WAAW,CAAA,EAAG;AACzB,MAAA,IAAA,EAAK;AAAA,IACP;AAAA,EACF,CAAC,CAAA;AACH;AAEO,SAAS,WAAW,MAAA,EAAwB;AACjD,EAAA,MAAM,KAAA,GAAQ,SAAS,CAAC,CAAA;AACxB,EAAA,IAAI,CAAC,KAAA,EAAO;AAGZ,EAAA,KAAA,CAAM,QAAQ,MAAM,CAAA;AAGpB,EAAA,QAAA,GAAW,QAAA,CAAS,MAAM,CAAC,CAAA;AAE3B,EA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;AAEA,IAAO,wBAAA,GAAQ;;;ACzSf,eAAsB,QAAQ,KAAA,EAA8C;AAC1E,EAAA,MAAM,MAAA,GAAS,MAAM,QAAA,CAAS,KAAK,CAAA;AACnC,EAAA,OAAO,MAAA;AACT","file":"index.js","sourcesContent":["import type { ConfirmOptions, ConfirmInput } from \"./types\";\n\ntype Listener = (alerts: ConfirmOptions[]) => void;\n\nlet confirms: ConfirmOptions[] = [];\nlet listeners = new Set<Listener>();\n\nexport function addAlert(input: ConfirmInput): Promise<boolean | null> {\n return new Promise((resolve) => {\n const alert: ConfirmOptions =\n typeof input === \"string\"\n ? {\n title: \"Confirm\",\n message: input,\n resolve\n }\n : {\n title: input.title || \"Confirm\",\n message: input.message,\n okText: input.okText,\n cancelText: input.cancelText,\n colorSchema: input.colorSchema,\n resolve\n };\n\n confirms = [...confirms, alert];\n \n if (confirms.length === 1) {\n emit();\n }\n });\n}\n\nexport function closeAlert(result: boolean | null) {\n const alert = confirms[0];\n if (!alert) return;\n\n // Resolve current alert\n alert.resolve(result);\n \n // Remove from queue\n confirms = confirms.slice(1);\n \n emit()\n}\n\nexport function subscribe(listener: Listener) {\n listeners.add(listener);\n listener(confirms);\n return () => listeners.delete(listener);\n}\n\nexport function emit() {\n listeners.forEach((listener) => listener(confirms));\n}","/* confirm.css */\n.alert-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 9999;\n display: flex;\n align-items: center;\n justify-content: center;\n backdrop-filter: blur(4px);\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',\n 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n animation: overlayFadeIn 0.3s ease-out forwards;\n}\n\n.alert-overlay-exit {\n animation: overlayFadeOut 0.3s ease-in forwards;\n}\n\n.alert-wrapper {\n width: 90%;\n max-width: 400px;\n border-radius: 12px;\n padding: 24px;\n box-shadow: \n 0 20px 25px -5px rgba(0, 0, 0, 0.1),\n 0 10px 10px -5px rgba(0, 0, 0, 0.04),\n 0 0 0 1px rgba(0, 0, 0, 0.05);\n animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;\n transform: translateY(20px) scale(0.98);\n}\n\n.alert-wrapper-exit {\n animation: modalSlideDown 0.3s ease-in forwards;\n}\n\n.alert-title {\n font-size: 18px;\n font-weight: 600;\n line-height: 1.4;\n margin: 0 0 12px 0;\n}\n\n.alert-message {\n font-size: 14px;\n line-height: 1.5;\n margin: 0 0 24px 0;\n}\n\n.alert-buttons {\n display: flex;\n justify-content: flex-end;\n gap: 12px;\n margin-top: 8px;\n}\n\n.alert-button {\n padding: 10px 20px;\n border-radius: 8px;\n font-size: 14px;\n font-weight: 500;\n border: none;\n cursor: pointer;\n font-family: inherit;\n transition: all 0.2s ease;\n min-width: 80px;\n text-align: center;\n}\n\n.alert-button:focus {\n outline-offset: 2px;\n}\n\n.alert-button:active {\n transform: translateY(1px);\n}\n\n/* Default animations */\n.alert-wrapper-exit {\n animation: modalSlideDown 0.3s ease-in forwards;\n}\n\n/* Entrance Animation Classes */\n.alert-animate-fadeInScale {\n animation: fadeInScale 0.4s ease-out forwards;\n}\n\n.alert-animate-bounceIn {\n animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;\n}\n\n.alert-animate-flipIn {\n animation: flipIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;\n}\n\n.alert-animate-zoomIn {\n animation: zoomIn 0.3s ease-out forwards;\n}\n\n.alert-animate-rotateIn {\n animation: rotateIn 0.5s ease-out forwards;\n}\n\n.alert-animate-fadeInUp {\n animation: fadeInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;\n}\n\n.alert-animate-dropIn {\n animation: dropIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;\n}\n\n.alert-animate-slideInRight {\n animation: slideInRight 0.4s ease-out forwards;\n}\n\n.alert-animate-slideInLeft {\n animation: slideInLeft 0.4s ease-out forwards;\n}\n\n.alert-animate-fadeInDown {\n animation: fadeInDown 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;\n}\n\n.alert-animate-slideDownIn {\n animation: slideDownIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;\n}\n\n.alert-animate-rotateInRight {\n animation: rotateInRight 0.5s ease-out forwards;\n}\n\n.alert-animate-zoomInSmall {\n animation: zoomInSmall 0.3s ease-out forwards;\n}\n\n.alert-animate-bounceInSmall {\n animation: bounceInSmall 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;\n}\n\n.alert-animate-fadeInBlur {\n animation: fadeInBlur 0.4s ease-out forwards;\n}\n\n.alert-animate-fadeInShrink {\n animation: fadeInShrink 0.3s ease-out forwards;\n}\n\n/* Exit Animation Classes */\n.alert-animate-fadeOutScale {\n animation: fadeOutScale 0.3s ease-in forwards;\n}\n\n.alert-animate-bounceOut {\n animation: bounceOut 0.4s ease-in forwards;\n}\n\n.alert-animate-zoomOut {\n animation: zoomOut 0.3s ease-in forwards;\n}\n\n.alert-animate-rotateOut {\n animation: rotateOut 0.3s ease-in forwards;\n}\n\n.alert-animate-fadeOutDown {\n animation: fadeOutDown 0.3s ease-in forwards;\n}\n\n.alert-animate-slideOutRight {\n animation: slideOutRight 0.3s ease-in forwards;\n}\n\n.alert-animate-slideOutLeft {\n animation: slideOutLeft 0.3s ease-in forwards;\n}\n\n.alert-animate-flipOut {\n animation: flipOut 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;\n}\n\n.alert-animate-dropOut {\n animation: dropOut 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;\n}\n\n.alert-animate-fadeOutUp {\n animation: fadeOutUp 0.3s ease-in forwards;\n}\n\n.alert-animate-slideUpOut {\n animation: slideUpOut 0.3s ease-in forwards;\n}\n\n.alert-animate-rotateOutLeft {\n animation: rotateOutLeft 0.3s ease-in forwards;\n}\n\n.alert-animate-zoomOutSmall {\n animation: zoomOutSmall 0.3s ease-in forwards;\n}\n\n.alert-animate-bounceOutSmall {\n animation: bounceOutSmall 0.4s ease-in forwards;\n}\n\n.alert-animate-fadeOutBlur {\n animation: fadeOutBlur 0.4s ease-in forwards;\n}\n\n.alert-animate-fadeOutShrink {\n animation: fadeOutShrink 0.3s ease-in forwards;\n}\n\n.alert-wrapper {\n width: 90%;\n max-width: 400px;\n border-radius: 12px;\n padding: 24px;\n box-shadow: \n 0 20px 25px -5px rgba(0, 0, 0, 0.1),\n 0 10px 10px -5px rgba(0, 0, 0, 0.04),\n 0 0 0 1px rgba(0, 0, 0, 0.05);\n}","/* animations.css - Complete Animation Keyframes */\n\n/* Overlay Animations */\n@keyframes overlayFadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes overlayFadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n/* Default Modal Animations */\n@keyframes modalSlideUp {\n from {\n opacity: 0;\n transform: translateY(20px) scale(0.98);\n }\n to {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n}\n\n@keyframes modalSlideDown {\n from {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n to {\n opacity: 0;\n transform: translateY(20px) scale(0.98);\n }\n}\n\n/* Fade In/Out with Scale */\n@keyframes fadeInScale {\n from {\n opacity: 0;\n transform: scale(0.95);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n@keyframes fadeOutScale {\n from {\n opacity: 1;\n transform: scale(1);\n }\n to {\n opacity: 0;\n transform: scale(0.95);\n }\n}\n\n/* Slide In/Out from Right */\n@keyframes slideInRight {\n from {\n opacity: 0;\n transform: translateX(30px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n\n@keyframes slideOutRight {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(30px);\n }\n}\n\n/* Slide In/Out from Left */\n@keyframes slideInLeft {\n from {\n opacity: 0;\n transform: translateX(-30px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n\n@keyframes slideOutLeft {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(-30px);\n }\n}\n\n/* Bounce In/Out */\n@keyframes bounceIn {\n 0% {\n opacity: 0;\n transform: scale(0.3);\n }\n 50% {\n opacity: 1;\n transform: scale(1.05);\n }\n 70% {\n transform: scale(0.9);\n }\n 100% {\n transform: scale(1);\n }\n}\n\n@keyframes bounceOut {\n 20% {\n transform: scale(1.1);\n }\n 100% {\n opacity: 0;\n transform: scale(0.3);\n }\n}\n\n/* Small Bounce In/Out */\n@keyframes bounceInSmall {\n 0% {\n opacity: 0;\n transform: scale(0.8);\n }\n 50% {\n opacity: 1;\n transform: scale(1.05);\n }\n 70% {\n transform: scale(0.95);\n }\n 100% {\n transform: scale(1);\n }\n}\n\n@keyframes bounceOutSmall {\n 20% {\n transform: scale(1.05);\n }\n 100% {\n opacity: 0;\n transform: scale(0.8);\n }\n}\n\n/* Flip In/Out */\n@keyframes flipIn {\n 0% {\n opacity: 0;\n transform: perspective(400px) rotateY(90deg);\n }\n 100% {\n opacity: 1;\n transform: perspective(400px) rotateY(0deg);\n }\n}\n\n@keyframes flipOut {\n 0% {\n opacity: 1;\n transform: perspective(400px) rotateY(0deg);\n }\n 100% {\n opacity: 0;\n transform: perspective(400px) rotateY(90deg);\n }\n}\n\n/* Zoom In/Out */\n@keyframes zoomIn {\n from {\n opacity: 0;\n transform: scale(0.5);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n@keyframes zoomOut {\n from {\n opacity: 1;\n transform: scale(1);\n }\n to {\n opacity: 0;\n transform: scale(0.5);\n }\n}\n\n/* Small Zoom In/Out */\n@keyframes zoomInSmall {\n from {\n opacity: 0;\n transform: scale(0.8);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n@keyframes zoomOutSmall {\n from {\n opacity: 1;\n transform: scale(1);\n }\n to {\n opacity: 0;\n transform: scale(0.8);\n }\n}\n\n/* Rotate In/Out */\n@keyframes rotateIn {\n from {\n opacity: 0;\n transform: rotate(-15deg) scale(0.95);\n }\n to {\n opacity: 1;\n transform: rotate(0deg) scale(1);\n }\n}\n\n@keyframes rotateOut {\n from {\n opacity: 1;\n transform: rotate(0deg) scale(1);\n }\n to {\n opacity: 0;\n transform: rotate(15deg) scale(0.95);\n }\n}\n\n/* Rotate Right In/Left Out */\n@keyframes rotateInRight {\n from {\n opacity: 0;\n transform: rotate(15deg) scale(0.95);\n }\n to {\n opacity: 1;\n transform: rotate(0deg) scale(1);\n }\n}\n\n@keyframes rotateOutLeft {\n from {\n opacity: 1;\n transform: rotate(0deg) scale(1);\n }\n to {\n opacity: 0;\n transform: rotate(-15deg) scale(0.95);\n }\n}\n\n/* Fade Up In/Down Out */\n@keyframes fadeInUp {\n from {\n opacity: 0;\n transform: translateY(40px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes fadeOutDown {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(40px);\n }\n}\n\n/* Fade Down In/Up Out */\n@keyframes fadeInDown {\n from {\n opacity: 0;\n transform: translateY(-40px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes fadeOutUp {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(-40px);\n }\n}\n\n/* Drop In/Out (3D) */\n@keyframes dropIn {\n 0% {\n opacity: 0;\n transform: translateY(-100px) rotateX(90deg);\n }\n 70% {\n opacity: 1;\n transform: translateY(10px) rotateX(-10deg);\n }\n 100% {\n transform: translateY(0) rotateX(0deg);\n }\n}\n\n@keyframes dropOut {\n 0% {\n opacity: 1;\n transform: translateY(0) rotateX(0deg);\n }\n 30% {\n opacity: 1;\n transform: translateY(10px) rotateX(-10deg);\n }\n 100% {\n opacity: 0;\n transform: translateY(-100px) rotateX(90deg);\n }\n}\n\n/* Slide Up Out/Down In */\n@keyframes slideUpOut {\n from {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n to {\n opacity: 0;\n transform: translateY(-20px) scale(0.98);\n }\n}\n\n@keyframes slideDownIn {\n from {\n opacity: 0;\n transform: translateY(-20px) scale(0.98);\n }\n to {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n}\n\n/* Blur In/Out Effects */\n@keyframes fadeInBlur {\n from {\n opacity: 0;\n filter: blur(10px);\n }\n to {\n opacity: 1;\n filter: blur(0px);\n }\n}\n\n@keyframes fadeOutBlur {\n from {\n opacity: 1;\n filter: blur(0px);\n }\n to {\n opacity: 0;\n filter: blur(10px);\n }\n}\n\n/* Shrink In/Out Effects */\n@keyframes fadeInShrink {\n from {\n opacity: 0;\n transform: scale(1.2) translateY(20px);\n }\n to {\n opacity: 1;\n transform: scale(1) translateY(0);\n }\n}\n\n@keyframes fadeOutShrink {\n from {\n opacity: 1;\n transform: scale(1) translateY(0);\n }\n to {\n opacity: 0;\n transform: scale(0.8) translateY(20px);\n }\n}\n\n/* Background Blur Animations */\n@keyframes blurIn {\n from {\n backdrop-filter: blur(0px);\n }\n to {\n backdrop-filter: blur(4px);\n }\n}\n\n@keyframes blurOut {\n from {\n backdrop-filter: blur(4px);\n }\n to {\n backdrop-filter: blur(0px);\n }\n}\n\n/* Special Effects Animations */\n\n/* Shake Animation (for errors) */\n@keyframes shake {\n 0%, 100% {\n transform: translateX(0);\n }\n 10%, 30%, 50%, 70%, 90% {\n transform: translateX(-5px);\n }\n 20%, 40%, 60%, 80% {\n transform: translateX(5px);\n }\n}\n\n/* Pulse Animation (for emphasis) */\n@keyframes pulse {\n 0% {\n transform: scale(1);\n }\n 50% {\n transform: scale(1.05);\n }\n 100% {\n transform: scale(1);\n }\n}\n\n/* Button Hover Effects */\n@keyframes buttonHover {\n 0% {\n transform: translateY(0);\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n }\n 50% {\n transform: translateY(-2px);\n box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);\n }\n 100% {\n transform: translateY(-1px);\n box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);\n }\n}\n\n/* Accessibility: Reduce motion */\n@media (prefers-reduced-motion: reduce) {\n .alert-overlay,\n .alert-wrapper,\n .alert-button {\n animation-duration: 0.01ms;\n animation-iteration-count: 1;\n transition-duration: 0.01ms;\n }\n \n .alert-overlay {\n animation: none;\n opacity: 1;\n }\n \n .alert-wrapper {\n animation: none;\n opacity: 1;\n transform: none;\n }\n}","/* ========== LIGHT SCHEMA (Default) ========== */\n.schema-light-overlay {\n background-color: rgba(0, 0, 0, 0.5);\n}\n\n.schema-light-wrapper {\n background-color: #ffffff;\n color: #111827;\n}\n\n.schema-light-title {\n color: #111827;\n}\n\n.schema-light-message {\n color: #6b7280;\n}\n\n.schema-light-cancel {\n background-color: #f3f4f6;\n color: #374151;\n outline-color: #9ca3af;\n}\n\n.schema-light-cancel:hover {\n background-color: #e5e7eb;\n transform: translateY(-1px);\n}\n\n.schema-light-cancel:active {\n background-color: #d1d5db;\n}\n\n.schema-light-cancel-danger {\n background-color: #fee2e2;\n color: #991b1b;\n outline-color: #f87171;\n}\n\n.schema-light-cancel-danger:hover {\n background-color: #fecaca;\n}\n\n.schema-light-ok {\n background-color: #10b981;\n color: #ffffff;\n outline-color: #34d399;\n}\n\n.schema-light-ok:hover {\n background-color: #059669;\n transform: translateY(-1px);\n}\n\n.schema-light-ok:active {\n background-color: #047857;\n}\n\n.schema-light-ok-danger {\n background-color: #ef4444;\n color: #ffffff;\n outline-color: #f87171;\n}\n\n.schema-light-ok-danger:hover {\n background-color: #dc2626;\n}\n\n/* ========== DARK SCHEMA ========== */\n.schema-dark-overlay {\n background-color: rgba(0, 0, 0, 0.7);\n}\n\n.schema-dark-wrapper {\n background-color: #18181b;\n color: #f4f4f5;\n box-shadow: \n 0 20px 25px -5px rgba(0, 0, 0, 0.3),\n 0 10px 10px -5px rgba(0, 0, 0, 0.2),\n 0 0 0 1px rgba(255, 255, 255, 0.1);\n}\n\n.schema-dark-title {\n color: #f4f4f5;\n}\n\n.schema-dark-message {\n color: #a1a1aa;\n}\n\n.schema-dark-cancel {\n background-color: #27272a;\n color: #e4e4e7;\n outline-color: #71717a;\n}\n\n.schema-dark-cancel:hover {\n background-color: #3f3f46;\n transform: translateY(-1px);\n}\n\n.schema-dark-cancel:active {\n background-color: #52525b;\n}\n\n.schema-dark-cancel-danger {\n background-color: #7f1d1d;\n color: #fecaca;\n outline-color: #ef4444;\n}\n\n.schema-dark-cancel-danger:hover {\n background-color: #991b1b;\n}\n\n.schema-dark-ok {\n background-color: #10b981;\n color: #ffffff;\n outline-color: #34d399;\n}\n\n.schema-dark-ok:hover {\n background-color: #059669;\n transform: translateY(-1px);\n}\n\n.schema-dark-ok:active {\n background-color: #047857;\n}\n\n.schema-dark-ok-danger {\n background-color: #dc2626;\n color: #ffffff;\n outline-color: #ef4444;\n}\n\n.schema-dark-ok-danger:hover {\n background-color: #b91c1c;\n}\n\n/* ========== BLUE SCHEMA ========== */\n.schema-blue-overlay {\n background-color: rgba(59, 130, 246, 0.3);\n}\n\n.schema-blue-wrapper {\n background-color: #eff6ff;\n color: #1e3a8a;\n box-shadow: \n 0 20px 25px -5px rgba(59, 130, 246, 0.15),\n 0 10px 10px -5px rgba(59, 130, 246, 0.1),\n 0 0 0 1px rgba(59, 130, 246, 0.1);\n}\n\n.schema-blue-title {\n color: #1e3a8a;\n}\n\n.schema-blue-message {\n color: #3b82f6;\n}\n\n.schema-blue-cancel {\n background-color: #dbeafe;\n color: #1e40af;\n outline-color: #60a5fa;\n}\n\n.schema-blue-cancel:hover {\n background-color: #bfdbfe;\n transform: translateY(-1px);\n}\n\n.schema-blue-cancel:active {\n background-color: #93c5fd;\n}\n\n.schema-blue-cancel-danger {\n background-color: #fee2e2;\n color: #991b1b;\n outline-color: #f87171;\n}\n\n.schema-blue-ok {\n background-color: #3b82f6;\n color: #ffffff;\n outline-color: #60a5fa;\n}\n\n.schema-blue-ok:hover {\n background-color: #2563eb;\n transform: translateY(-1px);\n}\n\n.schema-blue-ok:active {\n background-color: #1d4ed8;\n}\n\n.schema-blue-ok-danger {\n background-color: #ef4444;\n color: #ffffff;\n outline-color: #f87171;\n}\n\n/* ========== RED SCHEMA ========== */\n.schema-red-overlay {\n background-color: rgba(220, 38, 38, 0.2);\n}\n\n.schema-red-wrapper {\n background-color: #fef2f2;\n color: #7f1d1d;\n box-shadow: \n 0 20px 25px -5px rgba(220, 38, 38, 0.15),\n 0 10px 10px -5px rgba(220, 38, 38, 0.1),\n 0 0 0 1px rgba(220, 38, 38, 0.1);\n}\n\n.schema-red-title {\n color: #7f1d1d;\n}\n\n.schema-red-message {\n color: #ef4444;\n}\n\n.schema-red-cancel {\n background-color: #fecaca;\n color: #991b1b;\n outline-color: #f87171;\n}\n\n.schema-red-cancel:hover {\n background-color: #fca5a5;\n transform: translateY(-1px);\n}\n\n.schema-red-cancel:active {\n background-color: #f87171;\n}\n\n.schema-red-ok {\n background-color: #dc2626;\n color: #ffffff;\n outline-color: #ef4444;\n}\n\n.schema-red-ok:hover {\n background-color: #b91c1c;\n transform: translateY(-1px);\n}\n\n.schema-red-ok:active {\n background-color: #991b1b;\n}\n\n.schema-red-ok-danger {\n background-color: #991b1b;\n color: #ffffff;\n outline-color: #dc2626;\n}\n\n/* ========== GREEN SCHEMA ========== */\n.schema-green-overlay {\n background-color: rgba(16, 185, 129, 0.2);\n}\n\n.schema-green-wrapper {\n background-color: #ecfdf5;\n color: #064e3b;\n box-shadow: \n 0 20px 25px -5px rgba(16, 185, 129, 0.15),\n 0 10px 10px -5px rgba(16, 185, 129, 0.1),\n 0 0 0 1px rgba(16, 185, 129, 0.1);\n}\n\n.schema-green-title {\n color: #064e3b;\n}\n\n.schema-green-message {\n color: #10b981;\n}\n\n.schema-green-cancel {\n background-color: #d1fae5;\n color: #047857;\n outline-color: #34d399;\n}\n\n.schema-green-cancel:hover {\n background-color: #a7f3d0;\n transform: translateY(-1px);\n}\n\n.schema-green-cancel:active {\n background-color: #6ee7b7;\n}\n\n.schema-green-cancel-danger {\n background-color: #fee2e2;\n color: #991b1b;\n outline-color: #f87171;\n}\n\n.schema-green-ok {\n background-color: #10b981;\n color: #ffffff;\n outline-color: #34d399;\n}\n\n.schema-green-ok:hover {\n background-color: #059669;\n transform: translateY(-1px);\n}\n\n.schema-green-ok:active {\n background-color: #047857;\n}\n\n.schema-green-ok-danger {\n background-color: #ef4444;\n color: #ffffff;\n outline-color: #f87171;\n}\n\n/* ========== PURPLE SCHEMA ========== */\n.schema-purple-overlay {\n background-color: rgba(139, 92, 246, 0.2);\n}\n\n.schema-purple-wrapper {\n background-color: #f5f3ff;\n color: #5b21b6;\n box-shadow: \n 0 20px 25px -5px rgba(139, 92, 246, 0.15),\n 0 10px 10px -5px rgba(139, 92, 246, 0.1),\n 0 0 0 1px rgba(139, 92, 246, 0.1);\n}\n\n.schema-purple-title {\n color: #5b21b6;\n}\n\n.schema-purple-message {\n color: #8b5cf6;\n}\n\n.schema-purple-cancel {\n background-color: #ede9fe;\n color: #6d28d9;\n outline-color: #a78bfa;\n}\n\n.schema-purple-cancel:hover {\n background-color: #ddd6fe;\n transform: translateY(-1px);\n}\n\n.schema-purple-cancel:active {\n background-color: #c4b5fd;\n}\n\n.schema-purple-cancel-danger {\n background-color: #fee2e2;\n color: #991b1b;\n outline-color: #f87171;\n}\n\n.schema-purple-ok {\n background-color: #8b5cf6;\n color: #ffffff;\n outline-color: #a78bfa;\n}\n\n.schema-purple-ok:hover {\n background-color: #7c3aed;\n transform: translateY(-1px);\n}\n\n.schema-purple-ok:active {\n background-color: #6d28d9;\n}\n\n.schema-purple-ok-danger {\n background-color: #ef4444;\n color: #ffffff;\n outline-color: #f87171;\n}\n","import confirmCSS from './confirm.css';\nimport animationsCSS from './animations.css';\nimport colorSchemasCSS from './colorSchemas.css';\n\n// Combine all CSS\nconst ALL_CSS = `${confirmCSS}\\n${animationsCSS}\\n${colorSchemasCSS}`;\n\nlet stylesInjected = false;\n\nexport function ensureStyles() {\n if (typeof document === 'undefined') {\n return; // Server-side rendering\n }\n \n if (stylesInjected) {\n return; // Already injected\n }\n \n // Create and inject style tag\n const style = document.createElement('style');\n style.setAttribute('data-react-confirm-lite', '');\n style.textContent = ALL_CSS;\n document.head.appendChild(style);\n \n stylesInjected = true;\n}","import React, { useEffect, useState, useCallback, useRef, type ReactNode, type CSSProperties } from \"react\";\nimport { subscribe, closeAlert } from \"./confirm_store\";\nimport type { ConfirmClasses, ConfirmOptions, ColorSchema, AnimationType, animationPairs } from \"./types\";\nimport \"./confirm.css\";\nimport './animations.css'\nimport './colorSchemas.css'\nimport { ensureStyles } from \"./bundle-css\";\n\nfunction cx(...classes: (string | undefined)[]) {\n return classes.filter(Boolean).join(\" \");\n}\n\nconst animationPairs = {\n slide: { enter: '', exit: 'alert-wrapper-exit' },\n fadeScale: { enter: 'alert-animate-fadeInScale', exit: 'alert-animate-fadeOutScale' },\n bounce: { enter: 'alert-animate-bounceIn', exit: 'alert-animate-bounceOut' },\n flip: { enter: 'alert-animate-flipIn', exit: 'alert-animate-flipOut' },\n zoom: { enter: 'alert-animate-zoomIn', exit: 'alert-animate-zoomOut' },\n rotate: { enter: 'alert-animate-rotateIn', exit: 'alert-animate-rotateOut' },\n fadeUp: { enter: 'alert-animate-fadeInUp', exit: 'alert-animate-fadeOutDown' },\n drop: { enter: 'alert-animate-dropIn', exit: 'alert-animate-dropOut' },\n slideRight: { enter: 'alert-animate-slideInRight', exit: 'alert-animate-slideOutLeft' },\n slideLeft: { enter: 'alert-animate-slideInLeft', exit: 'alert-animate-slideOutRight' },\n fadeDown: { enter: 'alert-animate-fadeInDown', exit: 'alert-animate-fadeOutUp' },\n slideVertical: { enter: 'alert-animate-slideDownIn', exit: 'alert-animate-slideUpOut' },\n rotateRight: { enter: 'alert-animate-rotateInRight', exit: 'alert-animate-rotateOutLeft' },\n zoomSmall: { enter: 'alert-animate-zoomInSmall', exit: 'alert-animate-zoomOutSmall' },\n bounceSmall: { enter: 'alert-animate-bounceInSmall', exit: 'alert-animate-bounceOutSmall' },\n fadeBlur: { enter: 'alert-animate-fadeInBlur', exit: 'alert-animate-fadeOutBlur' },\n fadeShrink: { enter: 'alert-animate-fadeInShrink', exit: 'alert-animate-fadeOutShrink' },\n} as const;\n\ntype Props = {\n classes?: ConfirmClasses;\n defaultColorSchema?: ColorSchema;\n closeOnEscape?: boolean;\n closeOnClickOutside?: boolean;\n animation?: AnimationType;\n animationDuration?: number;\n animationDurationIn?: number;\n animationDurationOut?: number;\n children?: (props: {\n isVisible: boolean;\n confirm: ConfirmOptions;\n handleCancel: () => void;\n handleOk: () => void;\n containerRef: React.RefObject<HTMLDivElement | null>;\n colorSchema: ColorSchema;\n animationClass: string;\n animationStyle: CSSProperties;\n }) => ReactNode;\n};\n\nconst ConfirmContainer = ({\n classes = {},\n animationDuration = 300,\n defaultColorSchema = 'dark',\n closeOnEscape = true,\n closeOnClickOutside = true,\n animation = 'slide',\n animationDurationIn,\n animationDurationOut,\n children\n}: Props) => {\n const [alerts, setAlerts] = useState<ConfirmOptions[]>([]);\n const [isVisible, setIsVisible] = useState(false);\n const [currentAlert, setCurrentAlert] = useState<ConfirmOptions | null>(null);\n const [isExiting, setIsExiting] = useState(false);\n const [isMounted, setIsMounted] = useState(false);\n const overlayRef = useRef<HTMLDivElement>(null);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const exitTimerRef = useRef<number | null>(null);\n\n useEffect(() => {\n subscribe((newAlerts) => {\n setAlerts(newAlerts);\n });\n }, []);\n\n useEffect(() => {\n ensureStyles()\n }, [])\n \n\n useEffect(() => {\n if (alerts.length > 0 && !currentAlert && !isExiting) {\n // New alert arriving - start mount sequence\n setIsMounted(true);\n const newAlert = alerts[0];\n setCurrentAlert(newAlert);\n requestAnimationFrame(() => {\n setIsVisible(true);\n });\n } else if (alerts.length === 0 && currentAlert && isVisible) {\n // Start exit animation\n setIsExiting(true);\n setIsVisible(false);\n\n // Clear any existing timer\n if (exitTimerRef.current) {\n clearTimeout(exitTimerRef.current);\n }\n\n // Keep component mounted until exit animation completes\n const exitDuration = animationDurationOut || animationDuration;\n exitTimerRef.current = setTimeout(() => {\n setIsExiting(false);\n setCurrentAlert(null);\n setIsMounted(false);\n }, exitDuration);\n } else if (alerts.length > 0 && currentAlert && alerts[0] !== currentAlert) {\n // Replacing current alert\n setIsExiting(true);\n setIsVisible(false);\n\n if (exitTimerRef.current) {\n clearTimeout(exitTimerRef.current);\n }\n\n const exitDuration = animationDurationOut || animationDuration;\n exitTimerRef.current = setTimeout(() => {\n setIsExiting(false);\n const newAlert = alerts[0];\n setCurrentAlert(newAlert);\n requestAnimationFrame(() => {\n setIsVisible(true);\n });\n }, exitDuration);\n }\n }, [alerts, currentAlert, animationDuration, animationDurationOut, isVisible]);\n\n useEffect(() => {\n return () => {\n if (exitTimerRef.current) {\n clearTimeout(exitTimerRef.current);\n }\n };\n }, []);\n\n const handleClose = useCallback((value: boolean | null) => {\n closeAlert(value);\n }, []);\n\n const handleCancel = useCallback(() => {\n if (currentAlert && isVisible && !isExiting) {\n handleClose(false);\n }\n }, [currentAlert, isVisible, isExiting, handleClose]);\n\n const handleOk = useCallback(() => {\n if (currentAlert && isVisible && !isExiting) {\n handleClose(true);\n }\n }, [currentAlert, isVisible, isExiting, handleClose]);\n\n const handleEscKey = useCallback((event: KeyboardEvent) => {\n if (event.key === 'Escape' && closeOnEscape && currentAlert && isVisible && !isExiting) {\n event.preventDefault();\n event.stopPropagation();\n handleClose(null);\n }\n }, [closeOnEscape, currentAlert, isVisible, isExiting, handleClose]);\n\n useEffect(() => {\n if (currentAlert && isVisible && !isExiting) {\n window.addEventListener('keydown', handleEscKey, { capture: true });\n }\n\n return () => {\n window.removeEventListener('keydown', handleEscKey, { capture: true });\n };\n }, [handleEscKey, currentAlert, isVisible, isExiting]);\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (wrapperRef.current &&\n !wrapperRef.current.contains(event.target as Node) &&\n closeOnClickOutside &&\n currentAlert &&\n isVisible &&\n !isExiting) {\n handleClose(null);\n }\n };\n\n if (currentAlert && isVisible && !isExiting) {\n document.addEventListener(\"mousedown\", handleClickOutside);\n }\n\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n }, [closeOnClickOutside, currentAlert, isVisible, isExiting, handleClose]);\n\n // Don't render anything if not mounted and not exiting\n if (!isMounted && !isExiting) {\n return null;\n }\n\n const colorSchema = currentAlert?.colorSchema || defaultColorSchema;\n const schemaClass = `schema-${colorSchema}`;\n\n const animationStyle: CSSProperties = {};\n const currentDuration = isVisible\n ? (animationDurationIn || animationDuration)\n : (animationDurationOut || animationDuration);\n\n if (currentDuration && currentDuration !== 300) {\n animationStyle.animationDuration = `${currentDuration}ms`;\n }\n animationStyle.animationFillMode = 'forwards';\n\n const animationClass = isVisible\n ? animationPairs[animation as keyof animationPairs].enter\n : animationPairs[animation as keyof animationPairs].exit;\n\n // For children render\n if (children && currentAlert) {\n return children({\n isVisible: isVisible && !isExiting,\n confirm: currentAlert,\n handleCancel,\n handleOk,\n containerRef: wrapperRef,\n colorSchema,\n animationClass,\n animationStyle\n });\n }\n\n if (!currentAlert) {\n return null;\n }\n\n return (\n <div\n ref={overlayRef}\n className={cx(\n \"alert-overlay\",\n !isVisible ? \"alert-overlay-exit\" : '',\n `${schemaClass}-overlay`,\n classes.overlay\n )}\n style={animationStyle}\n >\n <div\n ref={wrapperRef}\n className={cx(\n \"alert-wrapper\",\n animationClass,\n `${schemaClass}-wrapper`,\n classes.wrapper\n )}\n style={animationStyle}\n >\n <h2 className={cx(\n \"alert-title\",\n `${schemaClass}-title`,\n classes.title\n )}>\n {currentAlert.title}\n </h2>\n <p className={cx(\n \"alert-message\",\n `${schemaClass}-message`,\n classes.message\n )}>\n {currentAlert.message}\n </p>\n <div className=\"alert-buttons\">\n <button\n onClick={handleCancel}\n disabled={isExiting || !isVisible}\n className={cx(\n \"alert-button alert-button-cancel\",\n `${schemaClass}-cancel`,\n classes.button,\n classes.cancel\n )}\n >\n {currentAlert.cancelText || 'Cancel'}\n </button>\n <button\n onClick={handleOk}\n disabled={isExiting || !isVisible}\n className={cx(\n 'alert-button alert-button-ok',\n `${schemaClass}-ok`,\n classes.button,\n classes.ok\n )}\n >\n {currentAlert.okText || 'OK'}\n </button>\n </div>\n </div>\n </div>\n );\n};\n\nexport default ConfirmContainer;","import { addAlert } from \"./confirm_store\";\nimport type { ConfirmInput } from \"./types\";\n\nexport async function confirm(input: ConfirmInput): Promise<boolean | null> {\n const result = await addAlert(input);\n return result;\n}"]}
1
+ {"version":3,"sources":["../src/confirm_store.ts","../src/confirm.css","../src/animations.css","../src/colorSchemas.css","../src/bundle-css.ts","../src/confirmContainer.tsx","../src/confirm.ts"],"names":["containerId","result"],"mappings":";;;;AAIA,IAAI,WAAA,GAAsB,EAAA;AAC1B,IAAI,WAA6B,EAAC;AAClC,IAAI,SAAA,uBAAgB,GAAA,EAAc;AAClC,IAAI,iBAAA,GAA6B,KAAA;AACjC,IAAM,aAAoC,EAAC;AAC3C,IAAI,cAAA;AAGJ,IAAI,iBAAA,GAAmC,IAAA;AAEhC,SAAS,qBAAqB,KAAA,EAAgB;AACnD,EAAA,iBAAA,GAAoB,KAAA;AACtB;AAEO,SAAS,oBAAA,GAAuB;AACrC,EAAA,OAAO,iBAAA;AACT;AAEO,SAAS,mBAAmB,EAAA,EAAmB;AACpD,EAAA,iBAAA,GAAoB,EAAA;AACtB;AAEO,SAAS,oBAAA,GAAsC;AACpD,EAAA,OAAO,iBAAA;AACT;AAEA,eAAsB,SAAS,KAAA,EAA8C;AAC3E,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,OAAA,KAAY;AAC9B,IAAA,MAAM,KAAA,GAAwB;AAAA,MAC5B,EAAA,EAAI,MAAM,EAAA,IAAM,EAAA;AAAA;AAAA,M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AAA,IAAc;AAAA;AAAA,iBAC9B;AAAA,gCACA,GAAA;AAAA,kBAAC,QAAA;AAAA,kBAAA;AAAA,oBACC,OAAA,EAAS,QAAA;AAAA,oBACT,QAAA,EAAU,aAAa,CAAC,SAAA;AAAA,oBACxB,SAAA,EAAW,EAAA;AAAA,sBACT,8BAAA;AAAA,sBACA,GAAG,WAAW,CAAA,GAAA,CAAA;AAAA,sBACd,OAAA,CAAQ,MAAA;AAAA,sBACR,OAAA,CAAQ;AAAA,qBACV;AAAA,oBAEC,uBAAa,MAAA,IAAU;AAAA;AAAA;AAC1B,eAAA,EACF;AAAA;AAAA;AAAA;AACF;AAAA;AACF,GAAA,EACF,CAAA;AAEJ,CAAA;AAEA,IAAO,wBAAA,GAAQ;;;ACxVf,eAAsB,QAAQ,KAAA,EAAuD;AACnF,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC7B,IAAA,MAAMA,YAAAA,GAAc,MAAM,UAAA,EAAW;AACrC,IAAA,MAAMC,OAAAA,GAAS,MAAM,QAAA,CAAS;AAAA,MAC5B,OAAA,EAAS,KAAA;AAAA,MACT,EAAA,EAAID;AAAA,KACL,CAAA;AACD,IAAA,OAAOC,OAAAA;AAAA,EACT;AAEA,EAAA,IAAI,CAAC,MAAM,EAAA,EAAI;AACb,IAAA,MAAMD,YAAAA,GAAc,MAAM,UAAA,EAAW;AACrC,IAAA,MAAMC,OAAAA,GAAS,MAAM,QAAA,CAAS;AAAA,MAC5B,GAAG,KAAA;AAAA,MACH,EAAA,EAAID;AAAA,KACL,CAAA;AACD,IAAA,OAAOC,OAAAA;AAAA,EACT;AAEA,EAAA,MAAM,MAAA,GAAS,MAAM,QAAA,CAAS,KAAK,CAAA;AACnC,EAAA,OAAO,MAAA;AACT","file":"index.js","sourcesContent":["import type { ConfirmOptions, ConfirmInput } from \"./types\";\n\ntype Listener = (alerts: ConfirmOptions[]) => void;\n\nlet containerId: string = '';\nlet confirms: ConfirmOptions[] = [];\nlet listeners = new Set<Listener>();\nlet isActiveContainer: boolean = false\nconst containers: NodeListOf<Element>[] = [];\nlet scrollPosition: number;\n\n// Global lock - only ONE container can show alerts at a time\nlet activeContainerId: string | null = null;\n\nexport function setIsContainerActive(value: boolean) {\n isActiveContainer = value;\n}\n\nexport function getIsContainerActive() {\n return isActiveContainer;\n}\n\nexport function setActiveContainer(id: string | null) {\n activeContainerId = id;\n}\n\nexport function getActiveContainerId(): string | null {\n return activeContainerId;\n}\n\nexport async function addAlert(input: ConfirmInput): Promise<boolean | null> {\n return new Promise((resolve) => {\n const alert: ConfirmOptions = {\n id: input.id || '', // Keep the ID for container targeting\n title: input.title || \"Confirm\",\n message: input.message,\n okText: input.okText,\n cancelText: input.cancelText,\n colorSchema: input.colorSchema,\n resolve\n };\n\n confirms = [...confirms, alert];\n\n // If this alert has an ID, set it as the active container\n if (input.id) {\n setActiveContainer(input.id);\n }\n // If this alert doesn't have an ID, clear any active container\n // so any container can potentially show it\n else {\n setActiveContainer(null);\n }\n\n if (confirms.length === 1) {\n emit();\n }\n });\n}\n\nexport async function closeAlert(result: boolean | null) {\n const alert = confirms[0];\n containerId = '';\n if (!alert) return;\n\n // Resolve current alert\n alert.resolve(result);\n // Remove from queue\n confirms = confirms.slice(1);\n\n // If there are no more alerts, clear the active container\n if (confirms.length === 0) {\n setActiveContainer(null);\n }\n\n emit();\n}\n\nexport function subscribe(listener: Listener) {\n listeners.add(listener);\n listener(confirms);\n return () => listeners.delete(listener);\n}\n\nexport function emit() {\n listeners.forEach((listener) => listener(confirms));\n}\n\n\nconst EventListener = (e: PointerEvent) => {\n if (containers.length === 0) {\n containers.push(document.querySelectorAll('.null-confirm-container'));\n }\n if (containers.length === 0) return;\n if (containers.length === 1) {\n containerId = containers[0][0].id\n return\n }\n\n let parentElement = e.view?.document.activeElement?.parentElement;\n let container = parentElement?.querySelector('.null-confirm-container');\n\n while (true) {\n if (container?.id) {\n break;\n }\n parentElement = parentElement?.parentElement;\n container = parentElement?.querySelector('.null-confirm-container');\n }\n\n if (container?.id) {\n containerId = container.id;\n }\n}\n\nexport async function getElement() {\n document.addEventListener('click', EventListener, { once: true })\n await new Promise<void>((resolve) => {\n setTimeout(() => {\n document.removeEventListener('click', EventListener)\n resolve()\n }, 0);\n })\n if (containerId === '') {\n if (containers.length === 0) {\n containers.push(document.querySelectorAll('.null-confirm-container'));\n }\n return containers[0][0].id\n }\n return containerId;\n}\n\nexport const lockBodyScroll = () => {\n scrollPosition = window.pageYOffset || document.documentElement.scrollTop;\n document.body.classList.add('body-scroll-lock');\n document.body.style.top = `-${scrollPosition}px`;\n};\n\nexport const unlockBodyScroll = () => {\n document.body.classList.remove('body-scroll-lock');\n document.body.style.removeProperty('top');\n window.scrollTo(0, scrollPosition);\n};","/* confirm.css */\n.alert-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 9999;\n display: flex;\n align-items: center;\n justify-content: center;\n backdrop-filter: blur(4px);\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',\n 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',\n sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n animation: overlayFadeIn 0.3s ease-out forwards;\n}\n\n.alert-overlay-exit {\n animation: overlayFadeOut 0.3s ease-in forwards;\n}\n\n.alert-wrapper {\n width: 90%;\n max-width: 400px;\n border-radius: 12px;\n padding: 24px;\n box-shadow: \n 0 20px 25px -5px rgba(0, 0, 0, 0.1),\n 0 10px 10px -5px rgba(0, 0, 0, 0.04),\n 0 0 0 1px rgba(0, 0, 0, 0.05);\n animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;\n transform: translateY(20px) scale(0.98);\n}\n\n.alert-wrapper-exit {\n animation: modalSlideDown 0.3s ease-in forwards;\n}\n\n.alert-title {\n font-size: 18px;\n font-weight: 600;\n line-height: 1.4;\n margin: 0 0 12px 0;\n}\n\n.alert-message {\n font-size: 14px;\n line-height: 1.5;\n margin: 0 0 24px 0;\n}\n\n.alert-buttons {\n display: flex;\n justify-content: flex-end;\n gap: 12px;\n margin-top: 8px;\n}\n\n.alert-button {\n padding: 10px 20px;\n border-radius: 8px;\n font-size: 14px;\n font-weight: 500;\n border: none;\n cursor: pointer;\n font-family: inherit;\n transition: all 0.2s ease;\n min-width: 80px;\n text-align: center;\n}\n\n.alert-button:focus {\n outline-offset: 2px;\n}\n\n.alert-button:active {\n transform: translateY(1px);\n}\n\n/* Default animations */\n.alert-wrapper-exit {\n animation: modalSlideDown 0.3s ease-in forwards;\n}\n\n/* Entrance Animation Classes */\n.alert-animate-fadeInScale {\n animation: fadeInScale 0.4s ease-out forwards;\n}\n\n.alert-animate-bounceIn {\n animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;\n}\n\n.alert-animate-flipIn {\n animation: flipIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;\n}\n\n.alert-animate-zoomIn {\n animation: zoomIn 0.3s ease-out forwards;\n}\n\n.alert-animate-rotateIn {\n animation: rotateIn 0.5s ease-out forwards;\n}\n\n.alert-animate-fadeInUp {\n animation: fadeInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;\n}\n\n.alert-animate-dropIn {\n animation: dropIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;\n}\n\n.alert-animate-slideInRight {\n animation: slideInRight 0.4s ease-out forwards;\n}\n\n.alert-animate-slideInLeft {\n animation: slideInLeft 0.4s ease-out forwards;\n}\n\n.alert-animate-fadeInDown {\n animation: fadeInDown 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;\n}\n\n.alert-animate-slideDownIn {\n animation: slideDownIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;\n}\n\n.alert-animate-rotateInRight {\n animation: rotateInRight 0.5s ease-out forwards;\n}\n\n.alert-animate-zoomInSmall {\n animation: zoomInSmall 0.3s ease-out forwards;\n}\n\n.alert-animate-bounceInSmall {\n animation: bounceInSmall 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;\n}\n\n.alert-animate-fadeInBlur {\n animation: fadeInBlur 0.4s ease-out forwards;\n}\n\n.alert-animate-fadeInShrink {\n animation: fadeInShrink 0.3s ease-out forwards;\n}\n\n/* Exit Animation Classes */\n.alert-animate-fadeOutScale {\n animation: fadeOutScale 0.3s ease-in forwards;\n}\n\n.alert-animate-bounceOut {\n animation: bounceOut 0.4s ease-in forwards;\n}\n\n.alert-animate-zoomOut {\n animation: zoomOut 0.3s ease-in forwards;\n}\n\n.alert-animate-rotateOut {\n animation: rotateOut 0.3s ease-in forwards;\n}\n\n.alert-animate-fadeOutDown {\n animation: fadeOutDown 0.3s ease-in forwards;\n}\n\n.alert-animate-slideOutRight {\n animation: slideOutRight 0.3s ease-in forwards;\n}\n\n.alert-animate-slideOutLeft {\n animation: slideOutLeft 0.3s ease-in forwards;\n}\n\n.alert-animate-flipOut {\n animation: flipOut 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;\n}\n\n.alert-animate-dropOut {\n animation: dropOut 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;\n}\n\n.alert-animate-fadeOutUp {\n animation: fadeOutUp 0.3s ease-in forwards;\n}\n\n.alert-animate-slideUpOut {\n animation: slideUpOut 0.3s ease-in forwards;\n}\n\n.alert-animate-rotateOutLeft {\n animation: rotateOutLeft 0.3s ease-in forwards;\n}\n\n.alert-animate-zoomOutSmall {\n animation: zoomOutSmall 0.3s ease-in forwards;\n}\n\n.alert-animate-bounceOutSmall {\n animation: bounceOutSmall 0.4s ease-in forwards;\n}\n\n.alert-animate-fadeOutBlur {\n animation: fadeOutBlur 0.4s ease-in forwards;\n}\n\n.alert-animate-fadeOutShrink {\n animation: fadeOutShrink 0.3s ease-in forwards;\n}\n\n.alert-wrapper {\n width: 90%;\n max-width: 400px;\n border-radius: 12px;\n padding: 24px;\n box-shadow: \n 0 20px 25px -5px rgba(0, 0, 0, 0.1),\n 0 10px 10px -5px rgba(0, 0, 0, 0.04),\n 0 0 0 1px rgba(0, 0, 0, 0.05);\n}\n\n.null-confirm-container{\n width: 0;\n height: 0;\n opacity: 0;\n}\n\n.body-scroll-lock {\n overflow: hidden !important;\n position: fixed !important;\n width: 100% !important;\n}","/* animations.css - Complete Animation Keyframes */\n\n/* Overlay Animations */\n@keyframes overlayFadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes overlayFadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n/* Default Modal Animations */\n@keyframes modalSlideUp {\n from {\n opacity: 0;\n transform: translateY(20px) scale(0.98);\n }\n to {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n}\n\n@keyframes modalSlideDown {\n from {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n to {\n opacity: 0;\n transform: translateY(20px) scale(0.98);\n }\n}\n\n/* Fade In/Out with Scale */\n@keyframes fadeInScale {\n from {\n opacity: 0;\n transform: scale(0.95);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n@keyframes fadeOutScale {\n from {\n opacity: 1;\n transform: scale(1);\n }\n to {\n opacity: 0;\n transform: scale(0.95);\n }\n}\n\n/* Slide In/Out from Right */\n@keyframes slideInRight {\n from {\n opacity: 0;\n transform: translateX(30px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n\n@keyframes slideOutRight {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(30px);\n }\n}\n\n/* Slide In/Out from Left */\n@keyframes slideInLeft {\n from {\n opacity: 0;\n transform: translateX(-30px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n\n@keyframes slideOutLeft {\n from {\n opacity: 1;\n transform: translateX(0);\n }\n to {\n opacity: 0;\n transform: translateX(-30px);\n }\n}\n\n/* Bounce In/Out */\n@keyframes bounceIn {\n 0% {\n opacity: 0;\n transform: scale(0.3);\n }\n 50% {\n opacity: 1;\n transform: scale(1.05);\n }\n 70% {\n transform: scale(0.9);\n }\n 100% {\n transform: scale(1);\n }\n}\n\n@keyframes bounceOut {\n 20% {\n transform: scale(1.1);\n }\n 100% {\n opacity: 0;\n transform: scale(0.3);\n }\n}\n\n/* Small Bounce In/Out */\n@keyframes bounceInSmall {\n 0% {\n opacity: 0;\n transform: scale(0.8);\n }\n 50% {\n opacity: 1;\n transform: scale(1.05);\n }\n 70% {\n transform: scale(0.95);\n }\n 100% {\n transform: scale(1);\n }\n}\n\n@keyframes bounceOutSmall {\n 20% {\n transform: scale(1.05);\n }\n 100% {\n opacity: 0;\n transform: scale(0.8);\n }\n}\n\n/* Flip In/Out */\n@keyframes flipIn {\n 0% {\n opacity: 0;\n transform: perspective(400px) rotateY(90deg);\n }\n 100% {\n opacity: 1;\n transform: perspective(400px) rotateY(0deg);\n }\n}\n\n@keyframes flipOut {\n 0% {\n opacity: 1;\n transform: perspective(400px) rotateY(0deg);\n }\n 100% {\n opacity: 0;\n transform: perspective(400px) rotateY(90deg);\n }\n}\n\n/* Zoom In/Out */\n@keyframes zoomIn {\n from {\n opacity: 0;\n transform: scale(0.5);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n@keyframes zoomOut {\n from {\n opacity: 1;\n transform: scale(1);\n }\n to {\n opacity: 0;\n transform: scale(0.5);\n }\n}\n\n/* Small Zoom In/Out */\n@keyframes zoomInSmall {\n from {\n opacity: 0;\n transform: scale(0.8);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n@keyframes zoomOutSmall {\n from {\n opacity: 1;\n transform: scale(1);\n }\n to {\n opacity: 0;\n transform: scale(0.8);\n }\n}\n\n/* Rotate In/Out */\n@keyframes rotateIn {\n from {\n opacity: 0;\n transform: rotate(-15deg) scale(0.95);\n }\n to {\n opacity: 1;\n transform: rotate(0deg) scale(1);\n }\n}\n\n@keyframes rotateOut {\n from {\n opacity: 1;\n transform: rotate(0deg) scale(1);\n }\n to {\n opacity: 0;\n transform: rotate(15deg) scale(0.95);\n }\n}\n\n/* Rotate Right In/Left Out */\n@keyframes rotateInRight {\n from {\n opacity: 0;\n transform: rotate(15deg) scale(0.95);\n }\n to {\n opacity: 1;\n transform: rotate(0deg) scale(1);\n }\n}\n\n@keyframes rotateOutLeft {\n from {\n opacity: 1;\n transform: rotate(0deg) scale(1);\n }\n to {\n opacity: 0;\n transform: rotate(-15deg) scale(0.95);\n }\n}\n\n/* Fade Up In/Down Out */\n@keyframes fadeInUp {\n from {\n opacity: 0;\n transform: translateY(40px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes fadeOutDown {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(40px);\n }\n}\n\n/* Fade Down In/Up Out */\n@keyframes fadeInDown {\n from {\n opacity: 0;\n transform: translateY(-40px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes fadeOutUp {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(-40px);\n }\n}\n\n/* Drop In/Out (3D) */\n@keyframes dropIn {\n 0% {\n opacity: 0;\n transform: translateY(-100px) rotateX(90deg);\n }\n 70% {\n opacity: 1;\n transform: translateY(10px) rotateX(-10deg);\n }\n 100% {\n transform: translateY(0) rotateX(0deg);\n }\n}\n\n@keyframes dropOut {\n 0% {\n opacity: 1;\n transform: translateY(0) rotateX(0deg);\n }\n 30% {\n opacity: 1;\n transform: translateY(10px) rotateX(-10deg);\n }\n 100% {\n opacity: 0;\n transform: translateY(-100px) rotateX(90deg);\n }\n}\n\n/* Slide Up Out/Down In */\n@keyframes slideUpOut {\n from {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n to {\n opacity: 0;\n transform: translateY(-20px) scale(0.98);\n }\n}\n\n@keyframes slideDownIn {\n from {\n opacity: 0;\n transform: translateY(-20px) scale(0.98);\n }\n to {\n opacity: 1;\n transform: translateY(0) scale(1);\n }\n}\n\n/* Blur In/Out Effects */\n@keyframes fadeInBlur {\n from {\n opacity: 0;\n filter: blur(10px);\n }\n to {\n opacity: 1;\n filter: blur(0px);\n }\n}\n\n@keyframes fadeOutBlur {\n from {\n opacity: 1;\n filter: blur(0px);\n }\n to {\n opacity: 0;\n filter: blur(10px);\n }\n}\n\n/* Shrink In/Out Effects */\n@keyframes fadeInShrink {\n from {\n opacity: 0;\n transform: scale(1.2) translateY(20px);\n }\n to {\n opacity: 1;\n transform: scale(1) translateY(0);\n }\n}\n\n@keyframes fadeOutShrink {\n from {\n opacity: 1;\n transform: scale(1) translateY(0);\n }\n to {\n opacity: 0;\n transform: scale(0.8) translateY(20px);\n }\n}\n\n/* Background Blur Animations */\n@keyframes blurIn {\n from {\n backdrop-filter: blur(0px);\n }\n to {\n backdrop-filter: blur(4px);\n }\n}\n\n@keyframes blurOut {\n from {\n backdrop-filter: blur(4px);\n }\n to {\n backdrop-filter: blur(0px);\n }\n}\n\n/* Special Effects Animations */\n\n/* Shake Animation (for errors) */\n@keyframes shake {\n 0%, 100% {\n transform: translateX(0);\n }\n 10%, 30%, 50%, 70%, 90% {\n transform: translateX(-5px);\n }\n 20%, 40%, 60%, 80% {\n transform: translateX(5px);\n }\n}\n\n/* Pulse Animation (for emphasis) */\n@keyframes pulse {\n 0% {\n transform: scale(1);\n }\n 50% {\n transform: scale(1.05);\n }\n 100% {\n transform: scale(1);\n }\n}\n\n/* Button Hover Effects */\n@keyframes buttonHover {\n 0% {\n transform: translateY(0);\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n }\n 50% {\n transform: translateY(-2px);\n box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);\n }\n 100% {\n transform: translateY(-1px);\n box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);\n }\n}\n\n/* Accessibility: Reduce motion */\n@media (prefers-reduced-motion: reduce) {\n .alert-overlay,\n .alert-wrapper,\n .alert-button {\n animation-duration: 0.01ms;\n animation-iteration-count: 1;\n transition-duration: 0.01ms;\n }\n \n .alert-overlay {\n animation: none;\n opacity: 1;\n }\n \n .alert-wrapper {\n animation: none;\n opacity: 1;\n transform: none;\n }\n}","/* ========== LIGHT SCHEMA (Default) ========== */\n.schema-light-overlay {\n background-color: rgba(0, 0, 0, 0.5);\n}\n\n.schema-light-wrapper {\n background-color: #ffffff;\n color: #111827;\n}\n\n.schema-light-title {\n color: #111827;\n}\n\n.schema-light-message {\n color: #6b7280;\n}\n\n.schema-light-cancel {\n background-color: #f3f4f6;\n color: #374151;\n outline-color: #9ca3af;\n}\n\n.schema-light-cancel:hover {\n background-color: #e5e7eb;\n transform: translateY(-1px);\n}\n\n.schema-light-cancel:active {\n background-color: #d1d5db;\n}\n\n.schema-light-cancel-danger {\n background-color: #fee2e2;\n color: #991b1b;\n outline-color: #f87171;\n}\n\n.schema-light-cancel-danger:hover {\n background-color: #fecaca;\n}\n\n.schema-light-ok {\n background-color: #10b981;\n color: #ffffff;\n outline-color: #34d399;\n}\n\n.schema-light-ok:hover {\n background-color: #059669;\n transform: translateY(-1px);\n}\n\n.schema-light-ok:active {\n background-color: #047857;\n}\n\n.schema-light-ok-danger {\n background-color: #ef4444;\n color: #ffffff;\n outline-color: #f87171;\n}\n\n.schema-light-ok-danger:hover {\n background-color: #dc2626;\n}\n\n/* ========== DARK SCHEMA ========== */\n.schema-dark-overlay {\n background-color: rgba(0, 0, 0, 0.7);\n}\n\n.schema-dark-wrapper {\n background-color: #18181b;\n color: #f4f4f5;\n box-shadow: \n 0 20px 25px -5px rgba(0, 0, 0, 0.3),\n 0 10px 10px -5px rgba(0, 0, 0, 0.2),\n 0 0 0 1px rgba(255, 255, 255, 0.1);\n}\n\n.schema-dark-title {\n color: #f4f4f5;\n}\n\n.schema-dark-message {\n color: #a1a1aa;\n}\n\n.schema-dark-cancel {\n background-color: #27272a;\n color: #e4e4e7;\n outline-color: #71717a;\n}\n\n.schema-dark-cancel:hover {\n background-color: #3f3f46;\n transform: translateY(-1px);\n}\n\n.schema-dark-cancel:active {\n background-color: #52525b;\n}\n\n.schema-dark-cancel-danger {\n background-color: #7f1d1d;\n color: #fecaca;\n outline-color: #ef4444;\n}\n\n.schema-dark-cancel-danger:hover {\n background-color: #991b1b;\n}\n\n.schema-dark-ok {\n background-color: #10b981;\n color: #ffffff;\n outline-color: #34d399;\n}\n\n.schema-dark-ok:hover {\n background-color: #059669;\n transform: translateY(-1px);\n}\n\n.schema-dark-ok:active {\n background-color: #047857;\n}\n\n.schema-dark-ok-danger {\n background-color: #dc2626;\n color: #ffffff;\n outline-color: #ef4444;\n}\n\n.schema-dark-ok-danger:hover {\n background-color: #b91c1c;\n}\n\n/* ========== BLUE SCHEMA ========== */\n.schema-blue-overlay {\n background-color: rgba(59, 130, 246, 0.3);\n}\n\n.schema-blue-wrapper {\n background-color: #eff6ff;\n color: #1e3a8a;\n box-shadow: \n 0 20px 25px -5px rgba(59, 130, 246, 0.15),\n 0 10px 10px -5px rgba(59, 130, 246, 0.1),\n 0 0 0 1px rgba(59, 130, 246, 0.1);\n}\n\n.schema-blue-title {\n color: #1e3a8a;\n}\n\n.schema-blue-message {\n color: #3b82f6;\n}\n\n.schema-blue-cancel {\n background-color: #dbeafe;\n color: #1e40af;\n outline-color: #60a5fa;\n}\n\n.schema-blue-cancel:hover {\n background-color: #bfdbfe;\n transform: translateY(-1px);\n}\n\n.schema-blue-cancel:active {\n background-color: #93c5fd;\n}\n\n.schema-blue-cancel-danger {\n background-color: #fee2e2;\n color: #991b1b;\n outline-color: #f87171;\n}\n\n.schema-blue-ok {\n background-color: #3b82f6;\n color: #ffffff;\n outline-color: #60a5fa;\n}\n\n.schema-blue-ok:hover {\n background-color: #2563eb;\n transform: translateY(-1px);\n}\n\n.schema-blue-ok:active {\n background-color: #1d4ed8;\n}\n\n.schema-blue-ok-danger {\n background-color: #ef4444;\n color: #ffffff;\n outline-color: #f87171;\n}\n\n/* ========== RED SCHEMA ========== */\n.schema-red-overlay {\n background-color: rgba(220, 38, 38, 0.2);\n}\n\n.schema-red-wrapper {\n background-color: #fef2f2;\n color: #7f1d1d;\n box-shadow: \n 0 20px 25px -5px rgba(220, 38, 38, 0.15),\n 0 10px 10px -5px rgba(220, 38, 38, 0.1),\n 0 0 0 1px rgba(220, 38, 38, 0.1);\n}\n\n.schema-red-title {\n color: #7f1d1d;\n}\n\n.schema-red-message {\n color: #ef4444;\n}\n\n.schema-red-cancel {\n background-color: #fecaca;\n color: #991b1b;\n outline-color: #f87171;\n}\n\n.schema-red-cancel:hover {\n background-color: #fca5a5;\n transform: translateY(-1px);\n}\n\n.schema-red-cancel:active {\n background-color: #f87171;\n}\n\n.schema-red-ok {\n background-color: #dc2626;\n color: #ffffff;\n outline-color: #ef4444;\n}\n\n.schema-red-ok:hover {\n background-color: #b91c1c;\n transform: translateY(-1px);\n}\n\n.schema-red-ok:active {\n background-color: #991b1b;\n}\n\n.schema-red-ok-danger {\n background-color: #991b1b;\n color: #ffffff;\n outline-color: #dc2626;\n}\n\n/* ========== GREEN SCHEMA ========== */\n.schema-green-overlay {\n background-color: rgba(16, 185, 129, 0.2);\n}\n\n.schema-green-wrapper {\n background-color: #ecfdf5;\n color: #064e3b;\n box-shadow: \n 0 20px 25px -5px rgba(16, 185, 129, 0.15),\n 0 10px 10px -5px rgba(16, 185, 129, 0.1),\n 0 0 0 1px rgba(16, 185, 129, 0.1);\n}\n\n.schema-green-title {\n color: #064e3b;\n}\n\n.schema-green-message {\n color: #10b981;\n}\n\n.schema-green-cancel {\n background-color: #d1fae5;\n color: #047857;\n outline-color: #34d399;\n}\n\n.schema-green-cancel:hover {\n background-color: #a7f3d0;\n transform: translateY(-1px);\n}\n\n.schema-green-cancel:active {\n background-color: #6ee7b7;\n}\n\n.schema-green-cancel-danger {\n background-color: #fee2e2;\n color: #991b1b;\n outline-color: #f87171;\n}\n\n.schema-green-ok {\n background-color: #10b981;\n color: #ffffff;\n outline-color: #34d399;\n}\n\n.schema-green-ok:hover {\n background-color: #059669;\n transform: translateY(-1px);\n}\n\n.schema-green-ok:active {\n background-color: #047857;\n}\n\n.schema-green-ok-danger {\n background-color: #ef4444;\n color: #ffffff;\n outline-color: #f87171;\n}\n\n/* ========== PURPLE SCHEMA ========== */\n.schema-purple-overlay {\n background-color: rgba(139, 92, 246, 0.2);\n}\n\n.schema-purple-wrapper {\n background-color: #f5f3ff;\n color: #5b21b6;\n box-shadow: \n 0 20px 25px -5px rgba(139, 92, 246, 0.15),\n 0 10px 10px -5px rgba(139, 92, 246, 0.1),\n 0 0 0 1px rgba(139, 92, 246, 0.1);\n}\n\n.schema-purple-title {\n color: #5b21b6;\n}\n\n.schema-purple-message {\n color: #8b5cf6;\n}\n\n.schema-purple-cancel {\n background-color: #ede9fe;\n color: #6d28d9;\n outline-color: #a78bfa;\n}\n\n.schema-purple-cancel:hover {\n background-color: #ddd6fe;\n transform: translateY(-1px);\n}\n\n.schema-purple-cancel:active {\n background-color: #c4b5fd;\n}\n\n.schema-purple-cancel-danger {\n background-color: #fee2e2;\n color: #991b1b;\n outline-color: #f87171;\n}\n\n.schema-purple-ok {\n background-color: #8b5cf6;\n color: #ffffff;\n outline-color: #a78bfa;\n}\n\n.schema-purple-ok:hover {\n background-color: #7c3aed;\n transform: translateY(-1px);\n}\n\n.schema-purple-ok:active {\n background-color: #6d28d9;\n}\n\n.schema-purple-ok-danger {\n background-color: #ef4444;\n color: #ffffff;\n outline-color: #f87171;\n}\n","import confirmCSS from './confirm.css';\nimport animationsCSS from './animations.css';\nimport colorSchemasCSS from './colorSchemas.css';\n\n// Combine all CSS\nconst ALL_CSS = `${confirmCSS}\\n${animationsCSS}\\n${colorSchemasCSS}`;\n\nlet stylesInjected = false;\n\nexport function ensureStyles() {\n if (typeof document === 'undefined') {\n return; // Server-side rendering\n }\n \n if (stylesInjected) {\n return; // Already injected\n }\n \n // Create and inject style tag\n const style = document.createElement('style');\n style.setAttribute('data-react-confirm-lite', '');\n style.textContent = ALL_CSS;\n document.head.appendChild(style);\n \n stylesInjected = true;\n}","import React, { useEffect, useState, useCallback, useRef, type ReactNode, type CSSProperties } from \"react\";\nimport { subscribe, closeAlert, setActiveContainer, setIsContainerActive, getIsContainerActive, getActiveContainerId } from \"./confirm_store\";\nimport type { ConfirmClasses, ConfirmOptions, ColorSchema, AnimationType, animationPairs } from \"./types\";\nimport { lockBodyScroll, unlockBodyScroll } from \"./confirm_store\";\nimport \"./confirm.css\";\nimport './animations.css'\nimport './colorSchemas.css'\nimport { ensureStyles } from \"./bundle-css\";\n\nfunction cx(...classes: (string | undefined)[]) {\n return classes.filter(Boolean).join(\" \");\n}\n\nconst animationPairs = {\n slide: { enter: '', exit: 'alert-wrapper-exit' },\n fadeScale: { enter: 'alert-animate-fadeInScale', exit: 'alert-animate-fadeOutScale' },\n bounce: { enter: 'alert-animate-bounceIn', exit: 'alert-animate-bounceOut' },\n flip: { enter: 'alert-animate-flipIn', exit: 'alert-animate-flipOut' },\n zoom: { enter: 'alert-animate-zoomIn', exit: 'alert-animate-zoomOut' },\n rotate: { enter: 'alert-animate-rotateIn', exit: 'alert-animate-rotateOut' },\n fadeUp: { enter: 'alert-animate-fadeInUp', exit: 'alert-animate-fadeOutDown' },\n drop: { enter: 'alert-animate-dropIn', exit: 'alert-animate-dropOut' },\n slideRight: { enter: 'alert-animate-slideInRight', exit: 'alert-animate-slideOutLeft' },\n slideLeft: { enter: 'alert-animate-slideInLeft', exit: 'alert-animate-slideOutRight' },\n fadeDown: { enter: 'alert-animate-fadeInDown', exit: 'alert-animate-fadeOutUp' },\n slideVertical: { enter: 'alert-animate-slideDownIn', exit: 'alert-animate-slideUpOut' },\n rotateRight: { enter: 'alert-animate-rotateInRight', exit: 'alert-animate-rotateOutLeft' },\n zoomSmall: { enter: 'alert-animate-zoomInSmall', exit: 'alert-animate-zoomOutSmall' },\n bounceSmall: { enter: 'alert-animate-bounceInSmall', exit: 'alert-animate-bounceOutSmall' },\n fadeBlur: { enter: 'alert-animate-fadeInBlur', exit: 'alert-animate-fadeOutBlur' },\n fadeShrink: { enter: 'alert-animate-fadeInShrink', exit: 'alert-animate-fadeOutShrink' },\n} as const;\n\ntype Props = {\n classes?: ConfirmClasses;\n defaultColorSchema?: ColorSchema;\n closeOnEscape?: boolean;\n closeOnClickOutside?: boolean;\n animation?: AnimationType;\n animationDuration?: number;\n animationDurationIn?: number;\n animationDurationOut?: number;\n lockScroll?: boolean;\n children?: (props: {\n isVisible: boolean;\n confirm: ConfirmOptions;\n handleCancel: () => void;\n handleOk: () => void;\n containerRef: React.RefObject<HTMLDivElement | null>;\n colorSchema: ColorSchema;\n animationClass: string;\n animationStyle: CSSProperties;\n }) => ReactNode;\n id?: string;\n};\n\nconst ConfirmContainer = ({\n classes = {},\n animationDuration = 300,\n defaultColorSchema = 'dark',\n closeOnEscape = true,\n closeOnClickOutside = true,\n animation = 'slide',\n animationDurationIn,\n animationDurationOut,\n lockScroll = true,\n children,\n id\n}: Props) => {\n const [alerts, setAlerts] = useState<ConfirmOptions[]>([]);\n const [isVisible, setIsVisible] = useState(false);\n const [currentAlert, setCurrentAlert] = useState<ConfirmOptions | null>(null);\n const [isExiting, setIsExiting] = useState(false);\n const [isMounted, setIsMounted] = useState(false);\n const overlayRef = useRef<HTMLDivElement>(null);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const exitTimerRef = useRef<number | null>(null);\n const containerId = useRef(id || `confirm-${Date.now().toString()}`)\n const nullElement = <div id={containerId.current} className=\"null-confirm-container\"></div>\n\n useEffect(() => {\n subscribe((newAlerts) => {\n setAlerts(newAlerts);\n });\n }, []);\n\n useEffect(() => {\n ensureStyles()\n }, []);\n\n useEffect(() => {\n if (alerts.length > 0 && !currentAlert && !isExiting) {\n const nextAlert = alerts[0];\n\n // Check if we should show this alert\n const shouldShowAlert =\n !nextAlert.id ||\n nextAlert.id === containerId.current ||\n !getActiveContainerId();\n\n if (shouldShowAlert) {\n // Check if we can become active\n const currentActive = getActiveContainerId();\n\n if (!currentActive || currentActive === containerId.current) {\n if (lockScroll) {\n lockBodyScroll()\n }\n setActiveContainer(containerId.current);\n setIsContainerActive(true);\n\n // Show the alert\n setIsMounted(true);\n setCurrentAlert(nextAlert);\n setIsVisible(true);\n }\n }\n }\n else if (alerts.length === 0 && currentAlert && isVisible) {\n // No more alerts, but we're showing one - start exit\n setIsExiting(true);\n setIsVisible(false);\n\n if (exitTimerRef.current) {\n clearTimeout(exitTimerRef.current);\n }\n\n const exitDuration = animationDurationOut || animationDuration;\n exitTimerRef.current = setTimeout(() => {\n setIsContainerActive(false);\n setIsExiting(false);\n setCurrentAlert(null);\n setIsMounted(false);\n }, exitDuration);\n }\n else if (alerts.length > 0 && currentAlert && alerts[0].id !== currentAlert.id) {\n // New alert with different ID is replacing current one\n setIsExiting(true);\n setIsVisible(false);\n\n if (exitTimerRef.current) {\n clearTimeout(exitTimerRef.current);\n }\n\n const exitDuration = animationDurationOut || animationDuration;\n exitTimerRef.current = setTimeout(() => {\n setIsContainerActive(false);\n setIsExiting(false);\n setCurrentAlert(null);\n setIsMounted(false);\n // The new alert will be picked up in the next render\n }, exitDuration);\n }\n }, [alerts, currentAlert, animationDuration, animationDurationOut, isVisible]);\n\n const handleClose = useCallback(async (value: boolean | null) => {\n if (!currentAlert || isExiting) return;\n\n // Start exit animation immediately\n setIsExiting(true);\n setIsVisible(false);\n\n // Delay the actual closeAlert call until animation completes\n const exitDuration = animationDurationOut || animationDuration;\n\n if (exitTimerRef.current) {\n clearTimeout(exitTimerRef.current);\n }\n\n exitTimerRef.current = setTimeout(() => {\n // Now call closeAlert which will resolve the promise\n closeAlert(value);\n\n // Reset state\n setIsExiting(false);\n setCurrentAlert(null);\n setIsMounted(false);\n setIsContainerActive(false);\n unlockBodyScroll()\n }, exitDuration);\n }, [currentAlert, isExiting, animationDuration, animationDurationOut]);\n\n const handleCancel = useCallback(() => {\n if (currentAlert && isVisible && !isExiting) {\n handleClose(false);\n }\n }, [currentAlert, isVisible, isExiting, handleClose]);\n\n const handleOk = useCallback(() => {\n if (currentAlert && isVisible && !isExiting) {\n handleClose(true);\n }\n }, [currentAlert, isVisible, isExiting, handleClose]);\n\n const handleEscKey = useCallback((event: KeyboardEvent) => {\n if (event.key === 'Escape' && closeOnEscape && currentAlert && isVisible && !isExiting) {\n event.preventDefault();\n event.stopPropagation();\n handleClose(null);\n }\n }, [closeOnEscape, currentAlert, isVisible, isExiting, handleClose]);\n\n useEffect(() => {\n if (currentAlert && isVisible && !isExiting) {\n window.addEventListener('keydown', handleEscKey, { capture: true });\n }\n\n return () => {\n window.removeEventListener('keydown', handleEscKey, { capture: true });\n };\n }, [handleEscKey, currentAlert, isVisible, isExiting]);\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (wrapperRef.current &&\n !wrapperRef.current.contains(event.target as Node) &&\n closeOnClickOutside &&\n currentAlert &&\n isVisible &&\n !isExiting) {\n handleClose(null);\n }\n };\n\n if (currentAlert && isVisible && !isExiting) {\n document.addEventListener(\"mousedown\", handleClickOutside);\n }\n\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n }, [closeOnClickOutside, currentAlert, isVisible, isExiting, handleClose]);\n\n // Replace the render conditions with:\n if (!isMounted && !isExiting) {\n return nullElement;\n }\n\n if (!currentAlert || !getIsContainerActive()) {\n return nullElement;\n }\n\n // Always render if we have a current alert\n const colorSchema = currentAlert?.colorSchema || defaultColorSchema;\n const schemaClass = `schema-${colorSchema}`;\n\n const animationStyle: CSSProperties = {};\n const currentDuration = isVisible\n ? (animationDurationIn || animationDuration)\n : (animationDurationOut || animationDuration);\n\n animationStyle.animationDuration = `${currentDuration}ms`;\n animationStyle.animationFillMode = 'forwards';\n\n const animationClass = isVisible\n ? animationPairs[animation as keyof animationPairs].enter\n : animationPairs[animation as keyof animationPairs].exit;\n\n\n // For children render\n if (children && currentAlert && getActiveContainerId() === containerId.current) {\n return (\n <>\n {nullElement}\n {children({\n isVisible: isVisible && !isExiting,\n confirm: currentAlert,\n handleCancel,\n handleOk,\n containerRef: wrapperRef,\n colorSchema,\n animationClass,\n animationStyle\n })}\n </>\n )\n }\n\n return (\n <>\n {nullElement}\n <div\n ref={overlayRef}\n className={cx(\n \"alert-overlay\",\n !isVisible ? \"alert-overlay-exit\" : '',\n `${schemaClass}-overlay`,\n classes.overlay\n )}\n style={animationStyle}\n >\n <div\n ref={wrapperRef}\n className={cx(\n \"alert-wrapper\",\n animationClass,\n `${schemaClass}-wrapper`,\n classes.wrapper\n )}\n style={animationStyle}\n >\n <h2 className={cx(\n \"alert-title\",\n `${schemaClass}-title`,\n classes.title\n )}>\n {currentAlert.title}\n </h2>\n <p className={cx(\n \"alert-message\",\n `${schemaClass}-message`,\n classes.message\n )}>\n {currentAlert.message}\n </p>\n <div className=\"alert-buttons\">\n <button\n onClick={handleCancel}\n disabled={isExiting || !isVisible}\n className={cx(\n \"alert-button alert-button-cancel\",\n `${schemaClass}-cancel`,\n classes.button,\n classes.cancel\n )}\n >\n {currentAlert.cancelText || 'Cancel'}\n </button>\n <button\n onClick={handleOk}\n disabled={isExiting || !isVisible}\n className={cx(\n 'alert-button alert-button-ok',\n `${schemaClass}-ok`,\n classes.button,\n classes.ok\n )}\n >\n {currentAlert.okText || 'OK'}\n </button>\n </div>\n </div>\n </div>\n </>\n );\n};\n\nexport default ConfirmContainer;","import { addAlert, getElement } from \"./confirm_store\";\nimport type { ConfirmInput } from \"./types\";\n\nexport async function confirm(input: string | ConfirmInput): Promise<boolean | null> {\n if (typeof input === 'string') {\n const containerId = await getElement();\n const result = await addAlert({ \n message: input, \n id: containerId \n });\n return result;\n } \n \n if (!input.id) {\n const containerId = await getElement();\n const result = await addAlert({ \n ...input, \n id: containerId \n });\n return result;\n } \n \n const result = await addAlert(input);\n return result;\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-confirm-lite",
3
- "version": "1.3.0",
3
+ "version": "1.4.1",
4
4
  "description": "A lightweight, promise-based confirm dialog for React, designed to be as easy to use as react-toastify, while remaining fully customizable.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -22,6 +22,7 @@
22
22
  "homepage": "https://github.com/SaadNasir-git/react-confirm-lite#readme",
23
23
  "scripts": {
24
24
  "build": "tsup && cp LICENSE dist/",
25
+ "build:watch": "tsup --watch",
25
26
  "clean": "rm -rf dist",
26
27
  "postbuild": "echo \"'use client';\" | cat - dist/index.js > temp && mv temp dist/index.js",
27
28
  "prepack": "npm run clean && npm run build"
@@ -38,5 +39,11 @@
38
39
  },
39
40
  "license": "MIT",
40
41
  "author": "Saad Nasir",
41
- "keywords": ["react-confirm" , "react-confirm-lite" , "react confirm lite" , "react confirm" , "confirm"]
42
- }
42
+ "keywords": [
43
+ "react-confirm",
44
+ "react-confirm-lite",
45
+ "react confirm lite",
46
+ "react confirm",
47
+ "confirm"
48
+ ]
49
+ }