Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-ghosta

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-ghosta - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

dist/index.cjs

191

dist/index.d.ts

@@ -1,9 +0,10 @@

/// <reference types="react" />
import { VariantProps } from "class-variance-authority";
import React from "react";
import { ComponentPropsWithoutRef } from "react";
import { VariantProps } from 'class-variance-authority';
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
import * as React$1 from 'react';
declare const popup: (props?: ({
size?: "sm" | "md" | "lg" | null | undefined;
alignment?: "left" | "center" | "right" | null | undefined;
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
type GhostaPopupProps = VariantProps<typeof popup> & {

@@ -21,3 +22,3 @@ id: number;

};
type GhostaPopupAlignment = "left" | "center" | "right";
type GhostaPopupAlignment = 'left' | 'center' | 'right';
type GhostaPopupElementColors = {

@@ -44,5 +45,3 @@ textIcon: string;

button: Partial<{
// Base Style of Button
base: string;
// Variants
variants: Partial<{

@@ -54,3 +53,2 @@ default: string;

}>;
// Sizes
sizes: Partial<{

@@ -63,14 +61,6 @@ sm: string;

};
declare const button: (props?: ({
variant?: "default" | "primary" | "success" | "danger" | null | undefined;
size?: "sm" | "md" | "lg" | null | undefined;
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
type ButtonVariant = "default" | "primary" | "success" | "danger";
type ButtonSize = "sm" | "md" | "lg";
type ButtonProps = ComponentPropsWithoutRef<"button"> & VariantProps<typeof button> & {
children?: React.ReactNode;
classNames?: GhostaPopupClassNames["button"];
isFilled?: boolean;
isLoading?: boolean;
};
type ButtonVariant = 'default' | 'primary' | 'success' | 'danger';
type ButtonSize = 'sm' | 'md' | 'lg';
type GhostaProps = {

@@ -81,2 +71,8 @@ classNames?: Partial<GhostaPopupClassNames>;

};
type GhostaActions = {
id: number;
fire: (options: GhostaOptions) => void;
close: (id: number) => void;
closeAll: () => void;
};
type GhostaOptions = {

@@ -95,3 +91,3 @@ id: number;

preventClose: boolean;
size: GhostaPopupProps["size"];
size: GhostaPopupProps['size'];
colors: Partial<GhostaPopupElementColors>;

@@ -112,144 +108,19 @@ classNames: Partial<GhostaPopupClassNames>;

};
type GhostaAnimationOptions = Record<"open" | "close", {
type GhostaAnimationOptions = Record<'open' | 'close', {
delay?: number;
elapsed?: number;
type?: "decay" | "spring" | "keyframes" | "tween" | "inertia";
type?: 'decay' | 'spring' | 'keyframes' | 'tween' | 'inertia';
duration?: number;
}>;
declare const Ghosta: React.FC<GhostaProps>;
declare namespace ghosta {
const popup: (props?: ({
size?: "sm" | "md" | "lg" | null | undefined;
alignment?: "left" | "center" | "right" | null | undefined;
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
const popupContent: (props?: ({
alignment?: "left" | "center" | "right" | null | undefined;
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
type GhostaPopupProps = VariantProps<typeof popup> & {
id: number;
children: React.ReactNode;
isVisible: boolean;
showCloseButton?: boolean;
classNames?: Partial<GhostaPopupClassNames> | null;
colors?: Partial<GhostaPopupElementColors> | null;
animationOptions?: Partial<GhostaAnimationOptions>;
showBackdrop?: boolean;
preventClose?: boolean;
onClose: () => void;
};
type GhostaPopupBodyProps = {
title?: React.ReactNode;
description?: React.ReactNode;
icon?: React.ReactNode;
content?: React.ReactNode;
};
type GhostaPopupHeaderProps = {
title?: string;
description?: string;
};
type GhostaPopupFooterProps = {
buttons?: GhostaButtonOptions[] | null;
};
type GhostaPopupAlignment = "left" | "center" | "right";
type GhostaPopupElementColors = {
textIcon: string;
bgIcon: string;
textTitle: string;
textDescription: string;
bgPanel: string;
bgBackdrop: string;
textCloseButton: string;
bgCloseButton: string;
};
type GhostaPopupClassNames = {
panel: string;
panelHeader: string;
panelBody: string;
panelFooter: string;
backdrop: string;
icon: string;
title: string;
description: string;
closeButton: string;
button: Partial<{
// Base Style of Button
base: string;
// Variants
variants: Partial<{
default: string;
primary: string;
success: string;
danger: string;
}>;
// Sizes
sizes: Partial<{
sm: string;
md: string;
lg: string;
}>;
}>;
};
const button: (props?: ({
variant?: "default" | "primary" | "success" | "danger" | null | undefined;
size?: "sm" | "md" | "lg" | null | undefined;
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
const buttonExtend: ({ variant, size, classNames }: ButtonProps) => string;
type ButtonVariant = "default" | "primary" | "success" | "danger";
type ButtonSize = "sm" | "md" | "lg";
type ButtonProps = ComponentPropsWithoutRef<"button"> & VariantProps<typeof button> & {
children?: React.ReactNode;
classNames?: GhostaPopupClassNames["button"];
isFilled?: boolean;
isLoading?: boolean;
};
type GhostaProps = {
classNames?: Partial<GhostaPopupClassNames>;
colors?: Partial<GhostaPopupElementColors>;
animationOptions?: Partial<GhostaAnimationOptions>;
};
type GhostaActions = {
id: number;
fire: (options: GhostaOptions) => void;
close: (id: number) => void;
closeAll: () => void;
};
type GhostaOptions = {
id: number;
} & Partial<{
title: string;
description: string;
icon: React.ReactNode;
headerTitle: string;
headerDescription: string;
content: React.ReactNode;
buttons: GhostaButtonOptions[] | null;
alignment: GhostaPopupAlignment;
showCloseButton: boolean;
preventClose: boolean;
size: GhostaPopupProps["size"];
colors: Partial<GhostaPopupElementColors>;
classNames: Partial<GhostaPopupClassNames>;
}>;
type GhostaButtonOptions = {
title?: string;
preventClose?: boolean;
variant?: ButtonVariant;
size?: ButtonSize;
isFilled?: boolean;
onClick?: (params: GhostaButtonActionParams) => void | Promise<void>;
};
type GhostaButtonActionParams = {
popupId: number;
onClose: () => void;
};
type GhostaAnimationOptions = Record<"open" | "close", {
delay?: number;
elapsed?: number;
type?: "decay" | "spring" | "keyframes" | "tween" | "inertia";
duration?: number;
}>;
const _default: (options: Omit<GhostaOptions, "id">) => void;
const _default: () => void;
export { _default as fire, _default as closeAll };
declare const Ghosta: React$1.FC<GhostaProps>;
declare const _default$1: (options: Omit<GhostaOptions, 'id'>) => void;
declare const _default: () => void;
declare namespace index {
export { _default as closeAll, _default$1 as fire };
}
export { Ghosta, ghosta };
export { Ghosta, type GhostaActions, type GhostaAnimationOptions, type GhostaButtonActionParams, type GhostaButtonOptions, type GhostaOptions, type GhostaProps, index as ghosta };

@@ -1,1 +0,2 @@

"use strict";var e=require("react"),t=require("react-dom");function n(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r=n(e),o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)};function l(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function a(e,t,n,r){return new(n||(n=Promise))((function(o,l){function a(e){try{u(r.next(e))}catch(e){l(e)}}function i(e){try{u(r.throw(e))}catch(e){l(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,i)}u((r=r.apply(e,t||[])).next())}))}function i(e,t){var n,r,o,l,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return l={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function i(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;l&&(l=0,i[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}}"function"==typeof SuppressedError&&SuppressedError;var u={ghosta:null,register:function(e){!this.ghosta&&"id"in e&&(this.ghosta=e)},unregister:function(e){this.ghosta&&this.ghosta.id===e&&(this.ghosta=null)},get:function(){return this.ghosta}};function s(e,t){return void 0===e&&(e=1),void 0===t&&(t=9999),Math.floor(Math.random()*(t-e)+e)}var c=Object.defineProperty,d=(e,t,n)=>(((e,t,n)=>{t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);let f=new class{constructor(){d(this,"current",this.detect()),d(this,"handoffState","pending"),d(this,"currentId",0)}set(e){this.current!==e&&(this.handoffState="pending",this.currentId=0,this.current=e)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return"server"===this.current}get isClient(){return"client"===this.current}detect(){return"undefined"==typeof window||"undefined"==typeof document?"server":"client"}handoff(){"pending"===this.handoffState&&(this.handoffState="complete")}get isHandoffComplete(){return"complete"===this.handoffState}},m=(t,n)=>{f.isServer?e.useEffect(t,n):e.useLayoutEffect(t,n)};function p(t){let n=e.useRef(t);return m((()=>{n.current=t}),[t]),n}let v=function(t){let n=p(t);return e.useCallback(((...e)=>n.current(...e)),[n])};function h(e){"function"==typeof queueMicrotask?queueMicrotask(e):Promise.resolve().then(e).catch((e=>setTimeout((()=>{throw e}))))}function g(){let e=[],t={addEventListener:(e,n,r,o)=>(e.addEventListener(n,r,o),t.add((()=>e.removeEventListener(n,r,o)))),requestAnimationFrame(...e){let n=requestAnimationFrame(...e);return t.add((()=>cancelAnimationFrame(n)))},nextFrame:(...e)=>t.requestAnimationFrame((()=>t.requestAnimationFrame(...e))),setTimeout(...e){let n=setTimeout(...e);return t.add((()=>clearTimeout(n)))},microTask(...e){let n={current:!0};return h((()=>{n.current&&e[0]()})),t.add((()=>{n.current=!1}))},style(e,t,n){let r=e.style.getPropertyValue(t);return Object.assign(e.style,{[t]:n}),this.add((()=>{Object.assign(e.style,{[t]:r})}))},group(e){let t=g();return e(t),this.add((()=>t.dispose()))},add:t=>(e.push(t),()=>{let n=e.indexOf(t);if(n>=0)for(let t of e.splice(n,1))t()}),dispose(){for(let t of e.splice(0))t()}};return t}function b(){let[t]=e.useState(g);return e.useEffect((()=>()=>t.dispose()),[t]),t}function E(){let e=function(){let e="undefined"==typeof document;return"useSyncExternalStore"in r&&r.useSyncExternalStore((()=>()=>{}),(()=>!1),(()=>!e))}(),[t,n]=r.useState(f.isHandoffComplete);return t&&!1===f.isHandoffComplete&&n(!1),r.useEffect((()=>{!0!==t&&n(!0)}),[t]),r.useEffect((()=>f.handoff()),[]),!e&&t}var w;let y=null!=(w=e.useId)?w:function(){let t=E(),[n,r]=e.useState(t?()=>f.nextId():null);return m((()=>{null===n&&r(f.nextId())}),[n]),null!=n?""+n:void 0};function _(e,t,...n){if(e in t){let r=t[e];return"function"==typeof r?r(...n):r}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map((e=>`"${e}"`)).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,_),r}function T(e){return f.isServer?null:e instanceof Node?e.ownerDocument:null!=e&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let S=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map((e=>`${e}:not([tabindex='-1'])`)).join(",");var C=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(C||{}),N=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(N||{}),O=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(O||{});var F=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(F||{});var P=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(P||{});function L(e){null==e||e.focus({preventScroll:!0})}"undefined"!=typeof window&&"undefined"!=typeof document&&(document.addEventListener("keydown",(e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")}),!0),document.addEventListener("click",(e=>{1===e.detail?delete document.documentElement.dataset.headlessuiFocusVisible:0===e.detail&&(document.documentElement.dataset.headlessuiFocusVisible="")}),!0));let x=["textarea","input"].join(",");function k(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let l=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,a=Array.isArray(e)?n?function(e,t=(e=>e)){return e.slice().sort(((e,n)=>{let r=t(e),o=t(n);if(null===r||null===o)return 0;let l=r.compareDocumentPosition(o);return l&Node.DOCUMENT_POSITION_FOLLOWING?-1:l&Node.DOCUMENT_POSITION_PRECEDING?1:0}))}(e):e:function(e=document.body){return null==e?[]:Array.from(e.querySelectorAll(S)).sort(((e,t)=>Math.sign((e.tabIndex||Number.MAX_SAFE_INTEGER)-(t.tabIndex||Number.MAX_SAFE_INTEGER))))}(e);o.length>0&&a.length>1&&(a=a.filter((e=>!o.includes(e)))),r=null!=r?r:l.activeElement;let i,u=(()=>{if(5&t)return 1;if(10&t)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),s=(()=>{if(1&t)return 0;if(2&t)return Math.max(0,a.indexOf(r))-1;if(4&t)return Math.max(0,a.indexOf(r))+1;if(8&t)return a.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=32&t?{preventScroll:!0}:{},d=0,f=a.length;do{if(d>=f||d+f<=0)return 0;let e=s+d;if(16&t)e=(e+f)%f;else{if(e<0)return 3;if(e>=f)return 1}i=a[e],null==i||i.focus(c),d+=u}while(i!==l.activeElement);return 6&t&&function(e){var t,n;return null!=(n=null==(t=null==e?void 0:e.matches)?void 0:t.call(e,x))&&n}(i)&&i.select(),2}function R(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function A(){return R()||/Android/gi.test(window.navigator.userAgent)}function D(t,n,r){let o=p(n);e.useEffect((()=>{function e(e){o.current(e)}return document.addEventListener(t,e,r),()=>document.removeEventListener(t,e,r)}),[t,r])}function M(t,n,r){let o=p(n);e.useEffect((()=>{function e(e){o.current(e)}return window.addEventListener(t,e,r),()=>window.removeEventListener(t,e,r)}),[t,r])}function j(t,n,r=!0){let o=e.useRef(!1);function l(e,r){if(!o.current||e.defaultPrevented)return;let l=r(e);if(null===l||!l.getRootNode().contains(l)||!l.isConnected)return;let a=function e(t){return"function"==typeof t?e(t()):Array.isArray(t)||t instanceof Set?t:[t]}(t);for(let t of a){if(null===t)continue;let n=t instanceof HTMLElement?t:t.current;if(null!=n&&n.contains(l)||e.composed&&e.composedPath().includes(n))return}return!function(e,t=0){var n;return e!==(null==(n=T(e))?void 0:n.body)&&_(t,{0:()=>e.matches(S),1(){let t=e;for(;null!==t;){if(t.matches(S))return!0;t=t.parentElement}return!1}})}(l,F.Loose)&&-1!==l.tabIndex&&e.preventDefault(),n(e,l)}e.useEffect((()=>{requestAnimationFrame((()=>{o.current=r}))}),[r]);let a=e.useRef(null);D("pointerdown",(e=>{var t,n;o.current&&(a.current=(null==(n=null==(t=e.composedPath)?void 0:t.call(e))?void 0:n[0])||e.target)}),!0),D("mousedown",(e=>{var t,n;o.current&&(a.current=(null==(n=null==(t=e.composedPath)?void 0:t.call(e))?void 0:n[0])||e.target)}),!0),D("click",(e=>{A()||a.current&&(l(e,(()=>a.current)),a.current=null)}),!0),D("touchend",(e=>l(e,(()=>e.target instanceof HTMLElement?e.target:null))),!0),M("blur",(e=>l(e,(()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null))),!0)}function H(...t){return e.useMemo((()=>T(...t)),[...t])}let I=Symbol();function B(...t){let n=e.useRef(t);e.useEffect((()=>{n.current=t}),[t]);let r=v((e=>{for(let t of n.current)null!=t&&("function"==typeof t?t(e):t.current=e)}));return t.every((e=>null==e||(null==e?void 0:e[I])))?void 0:r}function z(t,n){let r=e.useRef([]),o=v(t);e.useEffect((()=>{let e=[...r.current];for(let[t,l]of n.entries())if(r.current[t]!==l){let t=o(n,e);return r.current=n,t}}),[o,...n])}function V(...e){return Array.from(new Set(e.flatMap((e=>"string"==typeof e?e.split(" "):[])))).filter(Boolean).join(" ")}var W=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(W||{}),$=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))($||{});function U({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:l=!0,name:a,mergeRefs:i}){i=null!=i?i:G;let u=Y(t,e);if(l)return q(u,n,r,a,i);let s=null!=o?o:0;if(2&s){let{static:e=!1,...t}=u;if(e)return q(t,n,r,a,i)}if(1&s){let{unmount:e=!0,...t}=u;return _(e?0:1,{0:()=>null,1:()=>q({...t,hidden:!0,style:{display:"none"}},n,r,a,i)})}return q(u,n,r,a,i)}function q(t,n={},r,o,l){let{as:a=r,children:i,refName:u="ref",...s}=Z(t,["unmount","static"]),c=void 0!==t.ref?{[u]:t.ref}:{},d="function"==typeof i?i(n):i;"className"in s&&s.className&&"function"==typeof s.className&&(s.className=s.className(n));let f={};if(n){let e=!1,t=[];for(let[r,o]of Object.entries(n))"boolean"==typeof o&&(e=!0),!0===o&&t.push(r);e&&(f["data-headlessui-state"]=t.join(" "))}if(a===e.Fragment&&Object.keys(X(s)).length>0){if(!e.isValidElement(d)||Array.isArray(d)&&d.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${o} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(s).map((e=>` - ${e}`)).join("\n"),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map((e=>` - ${e}`)).join("\n")].join("\n"));let t=d.props,n="function"==typeof(null==t?void 0:t.className)?(...e)=>V(null==t?void 0:t.className(...e),s.className):V(null==t?void 0:t.className,s.className),r=n?{className:n}:{};return e.cloneElement(d,Object.assign({},Y(d.props,X(Z(s,["ref"]))),f,c,{ref:l(d.ref,c.ref)},r))}return e.createElement(a,Object.assign({},Z(s,["ref"]),a!==e.Fragment&&c,a!==e.Fragment&&f),d)}function G(...e){return e.every((e=>null==e))?void 0:t=>{for(let n of e)null!=n&&("function"==typeof n?n(t):n.current=t)}}function Y(...e){if(0===e.length)return{};if(1===e.length)return e[0];let t={},n={};for(let r of e)for(let e in r)e.startsWith("on")&&"function"==typeof r[e]?(null!=n[e]||(n[e]=[]),n[e].push(r[e])):t[e]=r[e];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map((e=>[e,void 0]))));for(let e in n)Object.assign(t,{[e](t,...r){let o=n[e];for(let e of o){if((t instanceof Event||(null==t?void 0:t.nativeEvent)instanceof Event)&&t.defaultPrevented)return;e(t,...r)}}});return t}function K(t){var n;return Object.assign(e.forwardRef(t),{displayName:null!=(n=t.displayName)?n:t.name})}function X(e){let t=Object.assign({},e);for(let e in t)void 0===t[e]&&delete t[e];return t}function Z(e,t=[]){let n=Object.assign({},e);for(let e of t)e in n&&delete n[e];return n}var J=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(J||{});let Q=K((function(e,t){var n;let{features:r=1,...o}=e;return U({ourProps:{ref:t,"aria-hidden":2==(2&r)||(null!=(n=o["aria-hidden"])?n:void 0),style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...4==(4&r)&&2!=(2&r)&&{display:"none"}}},theirProps:o,slot:{},defaultTag:"div",name:"Hidden"})})),ee=e.createContext(null);ee.displayName="OpenClosedContext";var te=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(te||{});function ne(){return e.useContext(ee)}function re({value:t,children:n}){return e.createElement(ee.Provider,{value:t},n)}let oe=[];function le(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=""===(null==t?void 0:t.getAttribute("disabled"));return(!r||!function(e){if(!e)return!1;let t=e.previousElementSibling;for(;null!==t;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}(n))&&r}!function(e){function t(){"loading"!==document.readyState&&(e(),document.removeEventListener("DOMContentLoaded",t))}"undefined"!=typeof window&&"undefined"!=typeof document&&(document.addEventListener("DOMContentLoaded",t),t())}((()=>{function e(e){e.target instanceof HTMLElement&&e.target!==document.body&&oe[0]!==e.target&&(oe.unshift(e.target),oe=oe.filter((e=>null!=e&&e.isConnected)),oe.splice(10))}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})}));var ae=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(ae||{});function ie(t,n,r,o){let l=p(r);e.useEffect((()=>{function e(e){l.current(e)}return(t=null!=t?t:window).addEventListener(n,e,o),()=>t.removeEventListener(n,e,o)}),[t,n,o])}function ue(){let t=e.useRef(!1);return m((()=>(t.current=!0,()=>{t.current=!1})),[]),t}function se(t){let n=v(t),r=e.useRef(!1);e.useEffect((()=>(r.current=!1,()=>{r.current=!0,h((()=>{r.current&&n()}))})),[n])}var ce=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(ce||{});function de(e){if(!e)return new Set;if("function"==typeof e)return new Set(e());let t=new Set;for(let n of e.current)n.current instanceof HTMLElement&&t.add(n.current);return t}var fe=(e=>(e[e.None=1]="None",e[e.InitialFocus=2]="InitialFocus",e[e.TabLock=4]="TabLock",e[e.FocusLock=8]="FocusLock",e[e.RestoreFocus=16]="RestoreFocus",e[e.All=30]="All",e))(fe||{});let me=K((function(t,n){let r=e.useRef(null),o=B(r,n),{initialFocus:l,containers:a,features:i=30,...u}=t;E()||(i=1);let s=H(r);!function({ownerDocument:t},n){let r=function(t=!0){let n=e.useRef(oe.slice());return z((([e],[t])=>{!0===t&&!1===e&&h((()=>{n.current.splice(0)})),!1===t&&!0===e&&(n.current=oe.slice())}),[t,oe,n]),v((()=>{var e;return null!=(e=n.current.find((e=>null!=e&&e.isConnected)))?e:null}))}(n);z((()=>{n||(null==t?void 0:t.activeElement)===(null==t?void 0:t.body)&&L(r())}),[n]),se((()=>{n&&L(r())}))}({ownerDocument:s},Boolean(16&i));let c=function({ownerDocument:t,container:n,initialFocus:r},o){let l=e.useRef(null),a=ue();return z((()=>{if(!o)return;let e=n.current;e&&h((()=>{if(!a.current)return;let n=null==t?void 0:t.activeElement;if(null!=r&&r.current){if((null==r?void 0:r.current)===n)return void(l.current=n)}else if(e.contains(n))return void(l.current=n);null!=r&&r.current?L(r.current):k(e,C.First)===N.Error&&console.warn("There are no focusable elements inside the <FocusTrap />"),l.current=null==t?void 0:t.activeElement}))}),[o]),l}({ownerDocument:s,container:r,initialFocus:l},Boolean(2&i));!function({ownerDocument:e,container:t,containers:n,previousActiveElement:r},o){let l=ue();ie(null==e?void 0:e.defaultView,"focus",(e=>{if(!o||!l.current)return;let a=de(n);t.current instanceof HTMLElement&&a.add(t.current);let i=r.current;if(!i)return;let u=e.target;u&&u instanceof HTMLElement?ve(a,u)?(r.current=u,L(u)):(e.preventDefault(),e.stopPropagation(),L(i)):L(r.current)}),!0)}({ownerDocument:s,container:r,containers:a,previousActiveElement:c},Boolean(8&i));let d=function(){let t=e.useRef(0);return M("keydown",(e=>{"Tab"===e.key&&(t.current=e.shiftKey?1:0)}),!0),t}(),f=v((e=>{let t=r.current;t&&_(d.current,{[ce.Forwards]:()=>{k(t,C.First,{skipElements:[e.relatedTarget]})},[ce.Backwards]:()=>{k(t,C.Last,{skipElements:[e.relatedTarget]})}})})),m=b(),p=e.useRef(!1),g={ref:o,onKeyDown(e){"Tab"==e.key&&(p.current=!0,m.requestAnimationFrame((()=>{p.current=!1})))},onBlur(e){let t=de(a);r.current instanceof HTMLElement&&t.add(r.current);let n=e.relatedTarget;n instanceof HTMLElement&&"true"!==n.dataset.headlessuiFocusGuard&&(ve(t,n)||(p.current?k(r.current,_(d.current,{[ce.Forwards]:()=>C.Next,[ce.Backwards]:()=>C.Previous})|C.WrapAround,{relativeTo:e.target}):e.target instanceof HTMLElement&&L(e.target)))}};return e.createElement(e.Fragment,null,Boolean(4&i)&&e.createElement(Q,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:f,features:J.Focusable}),U({ourProps:g,theirProps:u,defaultTag:"div",name:"FocusTrap"}),Boolean(4&i)&&e.createElement(Q,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:f,features:J.Focusable}))})),pe=Object.assign(me,{features:fe});function ve(e,t){for(let n of e)if(n.contains(t))return!0;return!1}let he=e.createContext(!1);function ge(){return e.useContext(he)}function be(t){return e.createElement(he.Provider,{value:t.force},t.children)}let Ee=e.Fragment;let we=e.Fragment,ye=e.createContext(null);let _e=e.createContext(null);let Te=K((function(n,r){let o=n,l=e.useRef(null),a=B(function(e,t=!0){return Object.assign(e,{[I]:t})}((e=>{l.current=e})),r),i=H(l),u=function(t){let n=ge(),r=e.useContext(ye),o=H(t),[l,a]=e.useState((()=>{if(!n&&null!==r||f.isServer)return null;let e=null==o?void 0:o.getElementById("headlessui-portal-root");if(e)return e;if(null===o)return null;let t=o.createElement("div");return t.setAttribute("id","headlessui-portal-root"),o.body.appendChild(t)}));return e.useEffect((()=>{null!==l&&(null!=o&&o.body.contains(l)||null==o||o.body.appendChild(l))}),[l,o]),e.useEffect((()=>{n||null!==r&&a(r.current)}),[r,a,n]),l}(l),[s]=e.useState((()=>{var e;return f.isServer?null:null!=(e=null==i?void 0:i.createElement("div"))?e:null})),c=e.useContext(_e),d=E();return m((()=>{!u||!s||u.contains(s)||(s.setAttribute("data-headlessui-portal",""),u.appendChild(s))}),[u,s]),m((()=>{if(s&&c)return c.register(s)}),[c,s]),se((()=>{var e;!u||!s||(s instanceof Node&&u.contains(s)&&u.removeChild(s),u.childNodes.length<=0&&(null==(e=u.parentElement)||e.removeChild(u)))})),d&&u&&s?t.createPortal(U({ourProps:{ref:a},theirProps:o,defaultTag:Ee,name:"Portal"}),s):null})),Se=K((function(t,n){let{target:r,...o}=t,l={ref:B(n)};return e.createElement(ye.Provider,{value:r},U({ourProps:l,theirProps:o,defaultTag:we,name:"Popover.Group"}))})),Ce=Object.assign(Te,{Group:Se});const Ne="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},{useState:Oe,useEffect:Fe,useLayoutEffect:Pe,useDebugValue:Le}=r;function xe(e){const t=e.getSnapshot,n=e.value;try{const e=t();return!Ne(n,e)}catch{return!0}}const ke=!("undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement)?function(e,t,n){return t()}:function(e,t,n){const r=t(),[{inst:o},l]=Oe({inst:{value:r,getSnapshot:t}});return Pe((()=>{o.value=r,o.getSnapshot=t,xe(o)&&l({inst:o})}),[e,r,t]),Fe((()=>(xe(o)&&l({inst:o}),e((()=>{xe(o)&&l({inst:o})})))),[e]),Le(r),r},Re="useSyncExternalStore"in r?r.useSyncExternalStore:ke;function Ae(){let e;return{before({doc:t}){var n;let r=t.documentElement;e=(null!=(n=t.defaultView)?n:window).innerWidth-r.clientWidth},after({doc:t,d:n}){let r=t.documentElement,o=r.clientWidth-r.offsetWidth,l=e-o;n.style(r,"paddingRight",`${l}px`)}}}function De(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Me=function(e,t){let n=e(),r=new Set;return{getSnapshot:()=>n,subscribe:e=>(r.add(e),()=>r.delete(e)),dispatch(e,...o){let l=t[e].call(n,...o);l&&(n=l,r.forEach((e=>e())))}}}((()=>new Map),{PUSH(e,t){var n;let r=null!=(n=this.get(e))?n:{doc:e,count:0,d:g(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:De(n)},o=[R()?{before({doc:e,d:t,meta:n}){function r(e){return n.containers.flatMap((e=>e())).some((t=>t.contains(e)))}t.microTask((()=>{var n;if("auto"!==window.getComputedStyle(e.documentElement).scrollBehavior){let n=g();n.style(e.documentElement,"scrollBehavior","auto"),t.add((()=>t.microTask((()=>n.dispose()))))}let o=null!=(n=window.scrollY)?n:window.pageYOffset,l=null;t.addEventListener(e,"click",(t=>{if(t.target instanceof HTMLElement)try{let n=t.target.closest("a");if(!n)return;let{hash:o}=new URL(n.href),a=e.querySelector(o);a&&!r(a)&&(l=a)}catch{}}),!0),t.addEventListener(e,"touchstart",(e=>{if(e.target instanceof HTMLElement)if(r(e.target)){let n=e.target;for(;n.parentElement&&r(n.parentElement);)n=n.parentElement;t.style(n,"overscrollBehavior","contain")}else t.style(e.target,"touchAction","none")})),t.addEventListener(e,"touchmove",(e=>{if(e.target instanceof HTMLElement)if(r(e.target)){let t=e.target;for(;t.parentElement&&""!==t.dataset.headlessuiPortal&&!(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth);)t=t.parentElement;""===t.dataset.headlessuiPortal&&e.preventDefault()}else e.preventDefault()}),{passive:!1}),t.add((()=>{var e;let t=null!=(e=window.scrollY)?e:window.pageYOffset;o!==t&&window.scrollTo(0,o),l&&l.isConnected&&(l.scrollIntoView({block:"nearest"}),l=null)}))}))}}:{},Ae(),{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}];o.forEach((({before:e})=>null==e?void 0:e(r))),o.forEach((({after:e})=>null==e?void 0:e(r)))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});function je(e,t,n){let r=function(e){return Re(e.subscribe,e.getSnapshot,e.getSnapshot)}(Me),o=e?r.get(e):void 0,l=!!o&&o.count>0;return m((()=>{if(e&&t)return Me.dispatch("PUSH",e,n),()=>Me.dispatch("POP",e,n)}),[t,e]),l}Me.subscribe((()=>{let e=Me.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let e="hidden"===t.get(n.doc),r=0!==n.count;(r&&!e||!r&&e)&&Me.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),0===n.count&&Me.dispatch("TEARDOWN",n)}}));let He=new Map,Ie=new Map;function Be(e,t=!0){m((()=>{var n;if(!t)return;let r="function"==typeof e?e():e.current;if(!r)return;let o=null!=(n=Ie.get(r))?n:0;return Ie.set(r,o+1),0!==o||(He.set(r,{"aria-hidden":r.getAttribute("aria-hidden"),inert:r.inert}),r.setAttribute("aria-hidden","true"),r.inert=!0),function(){var e;if(!r)return;let t=null!=(e=Ie.get(r))?e:1;if(1===t?Ie.delete(r):Ie.set(r,t-1),1!==t)return;let n=He.get(r);n&&(null===n["aria-hidden"]?r.removeAttribute("aria-hidden"):r.setAttribute("aria-hidden",n["aria-hidden"]),r.inert=n.inert,He.delete(r))}}),[e,t])}let ze=e.createContext((()=>{}));ze.displayName="StackContext";var Ve=(e=>(e[e.Add=0]="Add",e[e.Remove=1]="Remove",e))(Ve||{});function We({children:t,onUpdate:n,type:r,element:o,enabled:l}){let a=e.useContext(ze),i=v(((...e)=>{null==n||n(...e),a(...e)}));return m((()=>{let e=void 0===l||!0===l;return e&&i(0,r,o),()=>{e&&i(1,r,o)}}),[i,r,o,l]),e.createElement(ze.Provider,{value:i},t)}let $e=e.createContext(null);function Ue(){let t=e.useContext($e);if(null===t){let e=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(e,Ue),e}return t}let qe=K((function(e,t){let n=y(),{id:r=`headlessui-description-${n}`,...o}=e,l=Ue(),a=B(t);return m((()=>l.register(r)),[r,l.register]),U({ourProps:{ref:a,...l.props,id:r},theirProps:o,slot:l.slot||{},defaultTag:"p",name:l.name||"Description"})})),Ge=Object.assign(qe,{});var Ye=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Ye||{}),Ke=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(Ke||{});let Xe={0:(e,t)=>e.titleId===t.id?e:{...e,titleId:t.id}},Ze=e.createContext(null);function Je(t){let n=e.useContext(Ze);if(null===n){let e=new Error(`<${t} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(e,Je),e}return n}function Qe(e,t,n=(()=>[document.body])){je(e,t,(e=>{var t;return{containers:[...null!=(t=e.containers)?t:[],n]}}))}function et(e,t){return _(t.type,Xe,e,t)}Ze.displayName="DialogContext";let tt=W.RenderStrategy|W.Static;let nt=K((function(t,n){let r=y(),{id:o=`headlessui-dialog-${r}`,open:l,onClose:a,initialFocus:i,role:u="dialog",__demoMode:s=!1,...c}=t,[d,f]=e.useState(0),m=e.useRef(!1);u="dialog"===u||"alertdialog"===u?u:(m.current||(m.current=!0,console.warn(`Invalid role [${u}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog");let p=ne();void 0===l&&null!==p&&(l=(p&te.Open)===te.Open);let h=e.useRef(null),g=B(h,n),b=H(h),w=t.hasOwnProperty("open")||null!==p,T=t.hasOwnProperty("onClose");if(!w&&!T)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!w)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!T)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if("boolean"!=typeof l)throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${l}`);if("function"!=typeof a)throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${a}`);let S=l?0:1,[C,N]=e.useReducer(et,{titleId:null,descriptionId:null,panelRef:e.createRef()}),O=v((()=>a(!1))),F=v((e=>N({type:0,id:e}))),P=!!E()&&(!s&&0===S),L=d>1,x=null!==e.useContext(Ze),[k,R]=function(){let t=e.useContext(_e),n=e.useRef([]),r=v((e=>(n.current.push(e),t&&t.register(e),()=>o(e)))),o=v((e=>{let r=n.current.indexOf(e);-1!==r&&n.current.splice(r,1),t&&t.unregister(e)})),l=e.useMemo((()=>({register:r,unregister:o,portals:n})),[r,o,n]);return[n,e.useMemo((()=>function({children:t}){return e.createElement(_e.Provider,{value:l},t)}),[l])]}(),A={get current(){var e;return null!=(e=C.panelRef.current)?e:h.current}},{resolveContainers:D,mainTreeNodeRef:M,MainTreeNode:I}=function({defaultContainers:t=[],portals:n,mainTreeNodeRef:r}={}){var o;let l=e.useRef(null!=(o=null==r?void 0:r.current)?o:null),a=H(l),i=v((()=>{var e,r,o;let i=[];for(let e of t)null!==e&&(e instanceof HTMLElement?i.push(e):"current"in e&&e.current instanceof HTMLElement&&i.push(e.current));if(null!=n&&n.current)for(let e of n.current)i.push(e);for(let t of null!=(e=null==a?void 0:a.querySelectorAll("html > *, body > *"))?e:[])t!==document.body&&t!==document.head&&t instanceof HTMLElement&&"headlessui-portal-root"!==t.id&&(t.contains(l.current)||t.contains(null==(o=null==(r=l.current)?void 0:r.getRootNode())?void 0:o.host)||i.some((e=>t.contains(e)))||i.push(t));return i}));return{resolveContainers:i,contains:v((e=>i().some((t=>t.contains(e))))),mainTreeNodeRef:l,MainTreeNode:e.useMemo((()=>function(){return null!=r?null:e.createElement(Q,{features:J.Hidden,ref:l})}),[l,r])}}({portals:k,defaultContainers:[A]}),z=L?"parent":"leaf",V=null!==p&&(p&te.Closing)===te.Closing,W=!x&&!V&&P,$=e.useCallback((()=>{var e,t;return null!=(t=Array.from(null!=(e=null==b?void 0:b.querySelectorAll("body > *"))?e:[]).find((e=>"headlessui-portal-root"!==e.id&&(e.contains(M.current)&&e instanceof HTMLElement))))?t:null}),[M]);Be($,W);let q=!!L||P,G=e.useCallback((()=>{var e,t;return null!=(t=Array.from(null!=(e=null==b?void 0:b.querySelectorAll("[data-headlessui-portal]"))?e:[]).find((e=>e.contains(M.current)&&e instanceof HTMLElement)))?t:null}),[M]);Be(G,q),j(D,O,!(!P||L));let Y=!(L||0!==S);ie(null==b?void 0:b.defaultView,"keydown",(e=>{Y&&(e.defaultPrevented||e.key===ae.Escape&&(e.preventDefault(),e.stopPropagation(),O()))})),Qe(b,!(V||0!==S||x),D),e.useEffect((()=>{if(0!==S||!h.current)return;let e=new ResizeObserver((e=>{for(let t of e){let e=t.target.getBoundingClientRect();0===e.x&&0===e.y&&0===e.width&&0===e.height&&O()}}));return e.observe(h.current),()=>e.disconnect()}),[S,h,O]);let[K,X]=function(){let[t,n]=e.useState([]);return[t.length>0?t.join(" "):void 0,e.useMemo((()=>function(t){let r=v((e=>(n((t=>[...t,e])),()=>n((t=>{let n=t.slice(),r=n.indexOf(e);return-1!==r&&n.splice(r,1),n}))))),o=e.useMemo((()=>({register:r,slot:t.slot,name:t.name,props:t.props})),[r,t.slot,t.name,t.props]);return e.createElement($e.Provider,{value:o},t.children)}),[n])]}(),Z=e.useMemo((()=>[{dialogState:S,close:O,setTitleId:F},C]),[S,C,O,F]),ee=e.useMemo((()=>({open:0===S})),[S]),re={ref:g,id:o,role:u,"aria-modal":0===S||void 0,"aria-labelledby":C.titleId,"aria-describedby":K};return e.createElement(We,{type:"Dialog",enabled:0===S,element:h,onUpdate:v(((e,t)=>{"Dialog"===t&&_(e,{[Ve.Add]:()=>f((e=>e+1)),[Ve.Remove]:()=>f((e=>e-1))})}))},e.createElement(be,{force:!0},e.createElement(Ce,null,e.createElement(Ze.Provider,{value:Z},e.createElement(Ce.Group,{target:h},e.createElement(be,{force:!1},e.createElement(X,{slot:ee,name:"Dialog.Description"},e.createElement(pe,{initialFocus:i,containers:D,features:P?_(z,{parent:pe.features.RestoreFocus,leaf:pe.features.All&~pe.features.FocusLock}):pe.features.None},e.createElement(R,null,U({ourProps:re,theirProps:c,slot:ee,defaultTag:"div",features:tt,visible:0===S,name:"Dialog"}))))))))),e.createElement(I,null))})),rt=K((function(t,n){let r=y(),{id:o=`headlessui-dialog-backdrop-${r}`,...l}=t,[{dialogState:a},i]=Je("Dialog.Backdrop"),u=B(n);e.useEffect((()=>{if(null===i.panelRef.current)throw new Error("A <Dialog.Backdrop /> component is being used, but a <Dialog.Panel /> component is missing.")}),[i.panelRef]);let s=e.useMemo((()=>({open:0===a})),[a]);return e.createElement(be,{force:!0},e.createElement(Ce,null,U({ourProps:{ref:u,id:o,"aria-hidden":!0},theirProps:l,slot:s,defaultTag:"div",name:"Dialog.Backdrop"})))})),ot=K((function(t,n){let r=y(),{id:o=`headlessui-dialog-panel-${r}`,...l}=t,[{dialogState:a},i]=Je("Dialog.Panel"),u=B(n,i.panelRef),s=e.useMemo((()=>({open:0===a})),[a]),c=v((e=>{e.stopPropagation()}));return U({ourProps:{ref:u,id:o,onClick:c},theirProps:l,slot:s,defaultTag:"div",name:"Dialog.Panel"})})),lt=K((function(t,n){let r=y(),{id:o=`headlessui-dialog-overlay-${r}`,...l}=t,[{dialogState:a,close:i}]=Je("Dialog.Overlay"),u=B(n),s=v((e=>{if(e.target===e.currentTarget){if(le(e.currentTarget))return e.preventDefault();e.preventDefault(),e.stopPropagation(),i()}}));return U({ourProps:{ref:u,id:o,"aria-hidden":!0,onClick:s},theirProps:l,slot:e.useMemo((()=>({open:0===a})),[a]),defaultTag:"div",name:"Dialog.Overlay"})})),at=K((function(t,n){let r=y(),{id:o=`headlessui-dialog-title-${r}`,...l}=t,[{dialogState:a,setTitleId:i}]=Je("Dialog.Title"),u=B(n);e.useEffect((()=>(i(o),()=>i(null))),[o,i]);let s=e.useMemo((()=>({open:0===a})),[a]);return U({ourProps:{ref:u,id:o},theirProps:l,slot:s,defaultTag:"h2",name:"Dialog.Title"})})),it=Object.assign(nt,{Backdrop:rt,Panel:ot,Overlay:lt,Title:at,Description:Ge});function ut(e,...t){e&&t.length>0&&e.classList.add(...t)}function st(e,...t){e&&t.length>0&&e.classList.remove(...t)}function ct(e,t,n,r){let o=n?"enter":"leave",l=g(),a=void 0!==r?function(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}(r):()=>{};"enter"===o&&(e.removeAttribute("hidden"),e.style.display="");let i=_(o,{enter:()=>t.enter,leave:()=>t.leave}),u=_(o,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),s=_(o,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return st(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),ut(e,...t.base,...i,...s),l.nextFrame((()=>{st(e,...t.base,...i,...s),ut(e,...t.base,...i,...u),function(e,t){let n=g();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:o}=getComputedStyle(e),[l,a]=[r,o].map((e=>{let[t=0]=e.split(",").filter(Boolean).map((e=>e.includes("ms")?parseFloat(e):1e3*parseFloat(e))).sort(((e,t)=>t-e));return t})),i=l+a;if(0!==i){n.group((n=>{n.setTimeout((()=>{t(),n.dispose()}),i),n.addEventListener(e,"transitionrun",(e=>{e.target===e.currentTarget&&n.dispose()}))}));let r=n.addEventListener(e,"transitionend",(e=>{e.target===e.currentTarget&&(t(),r())}))}else t();n.add((()=>t())),n.dispose}(e,(()=>(st(e,...t.base,...i),ut(e,...t.base,...t.entered),a())))})),l.dispose}function dt(e=""){return e.split(/\s+/).filter((e=>e.length>1))}let ft=e.createContext(null);ft.displayName="TransitionContext";var mt=(e=>(e.Visible="visible",e.Hidden="hidden",e))(mt||{});let pt=e.createContext(null);function vt(e){return"children"in e?vt(e.children):e.current.filter((({el:e})=>null!==e.current)).filter((({state:e})=>"visible"===e)).length>0}function ht(t,n){let r=p(t),o=e.useRef([]),l=ue(),a=b(),i=v(((e,t=$.Hidden)=>{let n=o.current.findIndex((({el:t})=>t===e));-1!==n&&(_(t,{[$.Unmount](){o.current.splice(n,1)},[$.Hidden](){o.current[n].state="hidden"}}),a.microTask((()=>{var e;!vt(o)&&l.current&&(null==(e=r.current)||e.call(r))})))})),u=v((e=>{let t=o.current.find((({el:t})=>t===e));return t?"visible"!==t.state&&(t.state="visible"):o.current.push({el:e,state:"visible"}),()=>i(e,$.Unmount)})),s=e.useRef([]),c=e.useRef(Promise.resolve()),d=e.useRef({enter:[],leave:[],idle:[]}),f=v(((e,t,r)=>{s.current.splice(0),n&&(n.chains.current[t]=n.chains.current[t].filter((([t])=>t!==e))),null==n||n.chains.current[t].push([e,new Promise((e=>{s.current.push(e)}))]),null==n||n.chains.current[t].push([e,new Promise((e=>{Promise.all(d.current[t].map((([e,t])=>t))).then((()=>e()))}))]),"enter"===t?c.current=c.current.then((()=>null==n?void 0:n.wait.current)).then((()=>r(t))):r(t)})),m=v(((e,t,n)=>{Promise.all(d.current[t].splice(0).map((([e,t])=>t))).then((()=>{var e;null==(e=s.current.shift())||e()})).then((()=>n(t)))}));return e.useMemo((()=>({children:o,register:u,unregister:i,onStart:f,onStop:m,wait:c,chains:d})),[u,i,o,f,m,d,c])}function gt(){}pt.displayName="NestingContext";let bt=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Et(e){var t;let n={};for(let r of bt)n[r]=null!=(t=e[r])?t:gt;return n}let wt=W.RenderStrategy;let yt=K((function(t,n){let{show:r,appear:o=!1,unmount:l=!0,...a}=t,i=e.useRef(null),u=B(i,n);E();let s=ne();if(void 0===r&&null!==s&&(r=(s&te.Open)===te.Open),![!0,!1].includes(r))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[c,d]=e.useState(r?"visible":"hidden"),f=ht((()=>{d("hidden")})),[p,h]=e.useState(!0),g=e.useRef([r]);m((()=>{!1!==p&&g.current[g.current.length-1]!==r&&(g.current.push(r),h(!1))}),[g,r]);let b=e.useMemo((()=>({show:r,appear:o,initial:p})),[r,o,p]);e.useEffect((()=>{if(r)d("visible");else if(vt(f)){let e=i.current;if(!e)return;let t=e.getBoundingClientRect();0===t.x&&0===t.y&&0===t.width&&0===t.height&&d("hidden")}else d("hidden")}),[r,f]);let w={unmount:l},y=v((()=>{var e;p&&h(!1),null==(e=t.beforeEnter)||e.call(t)})),_=v((()=>{var e;p&&h(!1),null==(e=t.beforeLeave)||e.call(t)}));return e.createElement(pt.Provider,{value:f},e.createElement(ft.Provider,{value:b},U({ourProps:{...w,as:e.Fragment,children:e.createElement(_t,{ref:u,...w,...a,beforeEnter:y,beforeLeave:_})},theirProps:{},defaultTag:e.Fragment,features:wt,visible:"visible"===c,name:"Transition"})))})),_t=K((function(t,n){var r,o;let{beforeEnter:l,afterEnter:a,beforeLeave:i,afterLeave:u,enter:s,enterFrom:c,enterTo:d,entered:f,leave:h,leaveFrom:w,leaveTo:y,...T}=t,S=e.useRef(null),C=B(S,n),N=null==(r=T.unmount)||r?$.Unmount:$.Hidden,{show:O,appear:F,initial:P}=function(){let t=e.useContext(ft);if(null===t)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}(),[L,x]=e.useState(O?"visible":"hidden"),k=function(){let t=e.useContext(pt);if(null===t)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return t}(),{register:R,unregister:A}=k;e.useEffect((()=>R(S)),[R,S]),e.useEffect((()=>{if(N===$.Hidden&&S.current)return O&&"visible"!==L?void x("visible"):_(L,{hidden:()=>A(S),visible:()=>R(S)})}),[L,S,R,A,O,N]);let D=p({base:dt(T.className),enter:dt(s),enterFrom:dt(c),enterTo:dt(d),entered:dt(f),leave:dt(h),leaveFrom:dt(w),leaveTo:dt(y)}),M=function(t){let n=e.useRef(Et(t));return e.useEffect((()=>{n.current=Et(t)}),[t]),n}({beforeEnter:l,afterEnter:a,beforeLeave:i,afterLeave:u}),j=E();e.useEffect((()=>{if(j&&"visible"===L&&null===S.current)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")}),[S,L,j]);let H=F&&O&&P,I=!j||P&&!F?"idle":O?"enter":"leave",z=function(t=0){let[n,r]=e.useState(t),o=ue(),l=e.useCallback((e=>{o.current&&r((t=>t|e))}),[n,o]),a=e.useCallback((e=>Boolean(n&e)),[n]),i=e.useCallback((e=>{o.current&&r((t=>t&~e))}),[r,o]),u=e.useCallback((e=>{o.current&&r((t=>t^e))}),[r]);return{flags:n,addFlag:l,hasFlag:a,removeFlag:i,toggleFlag:u}}(0),W=v((e=>_(e,{enter:()=>{z.addFlag(te.Opening),M.current.beforeEnter()},leave:()=>{z.addFlag(te.Closing),M.current.beforeLeave()},idle:()=>{}}))),q=v((e=>_(e,{enter:()=>{z.removeFlag(te.Opening),M.current.afterEnter()},leave:()=>{z.removeFlag(te.Closing),M.current.afterLeave()},idle:()=>{}}))),G=ht((()=>{x("hidden"),A(S)}),k),Y=e.useRef(!1);!function({immediate:e,container:t,direction:n,classes:r,onStart:o,onStop:l}){let a=ue(),i=b(),u=p(n);m((()=>{e&&(u.current="enter")}),[e]),m((()=>{let e=g();i.add(e.dispose);let n=t.current;if(n&&"idle"!==u.current&&a.current)return e.dispose(),o.current(u.current),e.add(ct(n,r.current,"enter"===u.current,(()=>{e.dispose(),l.current(u.current)}))),e.dispose}),[n])}({immediate:H,container:S,classes:D,direction:I,onStart:p((e=>{Y.current=!0,G.onStart(S,e,W)})),onStop:p((e=>{Y.current=!1,G.onStop(S,e,q),"leave"===e&&!vt(G)&&(x("hidden"),A(S))}))});let K=T,X={ref:C};return H?K={...K,className:V(T.className,...D.current.enter,...D.current.enterFrom)}:Y.current&&(K.className=V(T.className,null==(o=S.current)?void 0:o.className),""===K.className&&delete K.className),e.createElement(pt.Provider,{value:G},e.createElement(re,{value:_(L,{visible:te.Open,hidden:te.Closed})|z.flags},U({ourProps:X,theirProps:K,defaultTag:"div",features:wt,visible:"visible"===L,name:"Transition.Child"})))})),Tt=K((function(t,n){let r=null!==e.useContext(ft),o=null!==ne();return e.createElement(e.Fragment,null,!r&&o?e.createElement(yt,{ref:n,...t}):e.createElement(_t,{ref:n,...t}))})),St=Object.assign(yt,{Child:Tt,Root:yt});function Ct(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Ct(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}const Nt=e=>"boolean"==typeof e?"".concat(e):0===e?"0":e,Ot=function(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Ct(e))&&(r&&(r+=" "),r+=t);return r},Ft=(e,t)=>n=>{var r;if(null==(null==t?void 0:t.variants))return Ot(e,null==n?void 0:n.class,null==n?void 0:n.className);const{variants:o,defaultVariants:l}=t,a=Object.keys(o).map((e=>{const t=null==n?void 0:n[e],r=null==l?void 0:l[e];if(null===t)return null;const a=Nt(t)||Nt(r);return o[e][a]})),i=n&&Object.entries(n).reduce(((e,t)=>{let[n,r]=t;return void 0===r||(e[n]=r),e}),{}),u=null==t||null===(r=t.compoundVariants)||void 0===r?void 0:r.reduce(((e,t)=>{let{class:n,className:r,...o}=t;return Object.entries(o).every((e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...l,...i}[t]):{...l,...i}[t]===n}))?[...e,n,r]:e}),[]);return Ot(e,a,u,null==n?void 0:n.class,null==n?void 0:n.className)};var Pt,Lt=function(t){var n=l(t,[]);return e.createElement("svg",o({width:"24px",height:"24px",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2","aria-hidden":"true"},n),e.createElement("path",{d:"M18 6L6 18M6 6l12 12"}))},xt=Ft("",{variants:{size:{sm:"ghosta--sm",md:"ghosta--md",lg:"ghosta--lg"},alignment:{left:"ghosta__text--left",center:"ghosta__text--center",right:"ghosta__text--right"}},defaultVariants:{alignment:"center",size:"md"}}),kt=Ft("",{variants:{alignment:{left:"ghosta__align--start",center:"ghosta__align--center",right:"ghosta__align--end"}},defaultVariants:{alignment:"center"}}),Rt=e.createContext({}),At=function(t){var n,r=t.id,o=t.isVisible,l=t.alignment,a=t.size,i=t.children,u=t.showCloseButton,s=t.colors,c=t.classNames,d=t.showBackdrop,f=void 0===d||d,m=t.preventClose,p=t.onClose,v=e.useState(o),h=v[0],g=v[1],b=function(){m||(g(!1),Pt=setTimeout(p,250))};return e.useEffect((function(){g(o)}),[o]),e.useEffect((function(){return function(){return clearTimeout(Pt)}}),[]),o?e.createElement(Rt.Provider,{value:{id:r,isVisible:o,alignment:l,size:a,children:i,colors:s,classNames:c,onClose:b}},e.createElement(St,{as:it,show:h,onClose:b,className:Ot("ghosta ghosta--root",xt({size:a,alignment:l})),style:(n=s,Object.entries(n||{}).reduce((function(e,t){var n,r=t[0],o=t[1];return e["--ba-".concat((n=r,n.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()))]=o,e}),{})),appear:!0,unmount:!0},f&&e.createElement(St.Child,{as:"div",className:Ot("ghosta__backdrop",null==c?void 0:c.backdrop),"aria-hidden":"true",enter:"ghosta__backdrop--enter",enterFrom:"ghosta__backdrop--enterFrom",enterTo:"ghosta__backdrop--enterTo",leave:"ghosta__backdrop--leave",leaveFrom:"ghosta__backdrop--leaveFrom",leaveTo:"ghosta__backdrop--leaveTo"}),e.createElement("div",{className:"ghosta__scroll-container"},e.createElement(St.Child,{as:it.Panel,className:Ot("ghosta__panel",null==c?void 0:c.panel,h?"ghosta__panel--entered":"ghosta__panel--leaved"),enter:"ghosta__panel--enter",enterFrom:"ghosta__panel--enterFrom",enterTo:"ghosta__panel--enterTo",leave:"ghosta__panel--leave",leaveFrom:"ghosta__panel--leaveFrom",leaveTo:"ghosta__panel--leaveTo"},u?e.createElement("button",{className:Ot("ghosta__close-button",null==c?void 0:c.closeButton),"aria-label":"Close",onClick:b},e.createElement(Lt,null)):null,i)))):null},Dt=function(t){var n=t.title,r=t.description,o=e.useContext(Rt).classNames;return n&&r?e.createElement("div",{className:Ot("ghosta__header",null==o?void 0:o.panelHeader)},n?e.createElement("div",{className:Ot("ghosta__header__title",null==o?void 0:o.title)},n):null,r?e.createElement("div",{className:Ot("ghosta__header__desc",null==o?void 0:o.description)},r):null):null},Mt=function(t){var n=t.title,r=t.description,o=t.icon,l=t.content,a=e.useContext(Rt),i=a.alignment,u=a.classNames;return n||r||o||l?e.createElement("div",{className:Ot("ghosta__content",kt({alignment:i}),null==u?void 0:u.panelBody)},o?e.createElement("div",{className:Ot("ghosta__content__icon",null==u?void 0:u.icon)},o):null,n?e.createElement(it.Title,{className:Ot("ghosta__content__title",null==u?void 0:u.title)},n):null,r?e.createElement("div",{className:Ot("ghosta__content__desc",null==u?void 0:u.description)},r):null,l?e.createElement("div",{className:"ghosta__content__content"},l):null):e.createElement("div",{className:"ghosta__nocontent"})},jt=function(t){return e.createElement("svg",o({xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor"},t),e.createElement("style",null,"@keyframes spinner_MGfb{93.75%,to{opacity:.2}}.spinner_S1WN{animation:spinner_MGfb .8s linear infinite;animation-delay:-.8s}"),e.createElement("circle",{cx:4,cy:12,r:3,className:"spinner_S1WN"}),e.createElement("circle",{cx:12,cy:12,r:3,className:"spinner_S1WN",style:{animationDelay:"-.65s"}}),e.createElement("circle",{cx:20,cy:12,r:3,className:"spinner_S1WN",style:{animationDelay:"-.5s"}}))},Ht=Ft("",{variants:{variant:{default:"ghosta__button--default",primary:"ghosta__button--primary",success:"ghosta__button--success",danger:"ghosta__button--danger"},size:{sm:"ghosta__button--sm",md:"ghosta__button--md",lg:"ghosta__button--lg"}},defaultVariants:{variant:"default",size:"lg"}}),It=function(e){var t=e.variant,n=e.size,r=e.classNames;return Ot(Ht({variant:t,size:n}),Ft(null==r?void 0:r.base,{variants:{variant:o({},null==r?void 0:r.variants),size:o({},null==r?void 0:r.sizes)}})({variant:t,size:n}))},Bt=function(t){var n=t.variant,r=t.size,a=t.children,i=t.className,u=t.classNames,s=t.isFilled,c=t.isLoading,d=l(t,["variant","size","children","className","classNames","isFilled","isLoading"]);return e.createElement("button",o({className:Ot("ghosta__button",It({variant:n,size:r,classNames:u}),s&&"ghosta__button--filled",i)},d),a,c?e.createElement("span",{className:"ghosta__button__spinner"},e.createElement(jt,null)):null)},zt=function(t){var n=t.buttons,r=e.useContext(Rt),l=r.onClose,u=r.classNames,s=r.id,c=e.useState({}),d=c[0],f=c[1],m=function(e,t){f((function(n){var r;return o(o({},n),((r={})[e]=t,r))}))};return(null==n?void 0:n.length)?e.createElement("div",{className:Ot("ghosta__footer",null==u?void 0:u.panelFooter)},null==n?void 0:n.map((function(t,n){return e.createElement(Bt,{key:n,variant:t.variant,size:t.size,isFilled:t.isFilled,isLoading:d[n],classNames:null==u?void 0:u.button,onClick:function(){return function(e,t){return a(void 0,void 0,void 0,(function(){var n,r,o;return i(this,(function(a){switch(a.label){case 0:if(n={popupId:s,onClose:l},!function(e){if(!e)return!1;var t=e.toString().trim();return!(!t.match(/^async /)&&!t.match(/return _ref[^.]*\.apply/))}(e.onClick))return[3,5];a.label=1;case 1:return a.trys.push([1,,3,4]),m(t,!0),[4,null===(r=e.onClick)||void 0===r?void 0:r.call(e,n)];case 2:return a.sent(),[3,4];case 3:return e.preventClose||null==l||l(),m(t,!1),[7];case 4:return[3,6];case 5:e.preventClose||null==l||l(),null===(o=e.onClick)||void 0===o||o.call(e,n),a.label=6;case 6:return[2]}}))}))}(t,n)}},t.title)}))):null},Vt="You should add <Ghosta /> top of your app to regitster",Wt=Object.freeze({__proto__:null,closeAll:function(){var e=u.get();if(!e)return console.warn(Vt);e.closeAll()},fire:function(e){var t=u.get();if(!t)return console.warn(Vt);t.fire(e)}});exports.Ghosta=function(t){var n=t.classNames,r=t.colors,l=t.animationOptions,a=e.useState([]),i=a[0],c=a[1],d=function(e){c((function(t){return t.filter((function(t){return t.id!==e}))}))},f=e.useRef({id:s(),fire:function(e){c((function(t){return t.concat(o(o({},e),{id:s()}))}))},close:d,closeAll:function(){c([])}});if(e.useEffect((function(){if(f.current){var e=f.current.id;return u.register(f.current),function(){u.unregister(e)}}}),[]),!i.length)return null;var m=i.length;return i.map((function(t,a){return void 0===t.preventClose&&(t.preventClose=a<m-1),e.createElement(At,o({key:t.id,isVisible:!0,onClose:function(){return d(t.id)}},t,{colors:Object.assign({},r,t.colors),classNames:Object.assign({},n,t.classNames),animationOptions:l}),e.createElement(Dt,{title:t.headerTitle,description:t.headerDescription}),e.createElement(Mt,{title:t.title,description:t.description,icon:t.icon,content:t.content}),e.createElement(zt,{buttons:t.buttons}))}))},exports.ghosta=Wt;
var Z=Object.defineProperty;var q=(t,e)=>{for(var o in e)Z(t,o,{get:e[o],enumerable:!0})};import*as m from"react";var g={ghosta:null,register(t){!this.ghosta&&"id"in t&&(this.ghosta=t)},unregister(t){this.ghosta&&this.ghosta.id===t&&(this.ghosta=null)},get(){return this.ghosta}};function b(t=1,e=9999){return Math.floor(Math.random()*(e-t)+t)}function A(t){return Object.entries(t||{}).reduce((e,[o,i])=>(e[`--ba-${Q(o)}`]=i,e),{})}function Q(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function B(t){return t.constructor.name==="AsyncFunction"?!0:t()instanceof Promise}import*as p from"react";import{Dialog as I,Transition as k}from"@headlessui/react";import{cx as x}from"class-variance-authority";import E from"react";var U=({...t})=>E.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2","aria-hidden":"true",...t},E.createElement("path",{d:"M18 6L6 18M6 6l12 12"})),T=U;import{cva as M}from"class-variance-authority";var O=M("",{variants:{size:{sm:"ghosta--sm",md:"ghosta--md",lg:"ghosta--lg"},alignment:{left:"ghosta__text--left",center:"ghosta__text--center",right:"ghosta__text--right"}},defaultVariants:{alignment:"center",size:"md"}}),w=M("",{variants:{alignment:{left:"ghosta__align--start",center:"ghosta__align--center",right:"ghosta__align--end"}},defaultVariants:{alignment:"center"}});var _=p.createContext({}),V,N=({id:t,isVisible:e,alignment:o,size:i,children:l,showCloseButton:a,colors:h,classNames:s,showBackdrop:n=!0,preventClose:u,onClose:r})=>{let[c,f]=p.useState(e),S=()=>{u||(f(!1),V=setTimeout(r,250))};return p.useEffect(()=>{f(e)},[e]),p.useEffect(()=>()=>clearTimeout(V),[]),e?p.createElement(_.Provider,{value:{id:t,isVisible:e,alignment:o,size:i,children:l,colors:h,classNames:s,onClose:S}},p.createElement(k,{as:I,show:c,onClose:S,className:x("ghosta ghosta--root",O({size:i,alignment:o})),style:A(h),appear:!0,unmount:!0},n&&p.createElement(k.Child,{as:"div",className:x("ghosta__backdrop",s==null?void 0:s.backdrop),"aria-hidden":"true",enter:"ghosta__backdrop--enter",enterFrom:"ghosta__backdrop--enterFrom",enterTo:"ghosta__backdrop--enterTo",leave:"ghosta__backdrop--leave",leaveFrom:"ghosta__backdrop--leaveFrom",leaveTo:"ghosta__backdrop--leaveTo"}),p.createElement("div",{className:"ghosta__scroll-container"},p.createElement(k.Child,{as:I.Panel,className:x("ghosta__panel",s==null?void 0:s.panel,c?"ghosta__panel--entered":"ghosta__panel--leaved"),enter:"ghosta__panel--enter",enterFrom:"ghosta__panel--enterFrom",enterTo:"ghosta__panel--enterTo",leave:"ghosta__panel--leave",leaveFrom:"ghosta__panel--leaveFrom",leaveTo:"ghosta__panel--leaveTo"},a?p.createElement("button",{className:x("ghosta__close-button",s==null?void 0:s.closeButton),"aria-label":"Close",onClick:S},p.createElement(T,null)):null,l)))):null},H=N;import*as G from"react";import{cx as F}from"class-variance-authority";var tt=({title:t,description:e})=>{let{classNames:o}=G.useContext(_);return!t||!e?null:G.createElement("div",{className:F("ghosta__header",o==null?void 0:o.panelHeader)},t?G.createElement("div",{className:F("ghosta__header__title",o==null?void 0:o.title)},t):null,e?G.createElement("div",{className:F("ghosta__header__desc",o==null?void 0:o.description)},e):null)},L=tt;import*as d from"react";import{Dialog as ot}from"@headlessui/react";import{cx as y}from"class-variance-authority";var et=({title:t,description:e,icon:o,content:i})=>{let{alignment:l,classNames:a}=d.useContext(_);return!t&&!e&&!o&&!i?d.createElement("div",{className:"ghosta__nocontent"}):d.createElement("div",{className:y("ghosta__content",w({alignment:l}),a==null?void 0:a.panelBody)},o?d.createElement("div",{className:y("ghosta__content__icon",a==null?void 0:a.icon)},o):null,t?d.createElement(ot.Title,{className:y("ghosta__content__title",a==null?void 0:a.title)},t):null,e?d.createElement("div",{className:y("ghosta__content__desc",a==null?void 0:a.description)},e):null,i?d.createElement("div",{className:"ghosta__content__content"},i):null)},z=et;import*as v from"react";import{cx as pt}from"class-variance-authority";import*as C from"react";import{cx as it}from"class-variance-authority";import*as P from"react";var rt=t=>P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...t},P.createElement("style",null,"@keyframes spinner_MGfb{93.75%,to{opacity:.2}}.spinner_S1WN{animation:spinner_MGfb .8s linear infinite;animation-delay:-.8s}"),P.createElement("circle",{cx:4,cy:12,r:3,className:"spinner_S1WN"}),P.createElement("circle",{cx:12,cy:12,r:3,className:"spinner_S1WN",style:{animationDelay:"-.65s"}}),P.createElement("circle",{cx:20,cy:12,r:3,className:"spinner_S1WN",style:{animationDelay:"-.5s"}})),D=rt;import{cva as W,cx as nt}from"class-variance-authority";var at=W("",{variants:{variant:{default:"ghosta__button--default",primary:"ghosta__button--primary",success:"ghosta__button--success",danger:"ghosta__button--danger"},size:{sm:"ghosta__button--sm",md:"ghosta__button--md",lg:"ghosta__button--lg"}},defaultVariants:{variant:"default",size:"lg"}}),j=({variant:t,size:e,classNames:o})=>nt(at({variant:t,size:e}),W(o==null?void 0:o.base,{variants:{variant:{...o==null?void 0:o.variants},size:{...o==null?void 0:o.sizes}}})({variant:t,size:e}));var st=({variant:t,size:e,children:o,className:i,classNames:l,isFilled:a,isLoading:h,...s})=>C.createElement("button",{className:it("ghosta__button",j({variant:t,size:e,classNames:l}),a&&"ghosta__button--filled",i),...s},o,h?C.createElement("span",{className:"ghosta__button__spinner"},C.createElement(D,null)):null),X=st;var lt=({buttons:t})=>{let{onClose:e,classNames:o,id:i}=v.useContext(_),[l,a]=v.useState({}),h=(n,u)=>{a(r=>({...r,[n]:u}))},s=async(n,u)=>{var c,f;let r={popupId:i,onClose:e};if(B(n.onClick))try{h(u,!0),await((c=n.onClick)==null?void 0:c.call(n,r))}finally{n.preventClose||e==null||e(),h(u,!1)}else n.preventClose||e==null||e(),(f=n.onClick)==null||f.call(n,r)};return t!=null&&t.length?v.createElement("div",{className:pt("ghosta__footer",o==null?void 0:o.panelFooter)},t==null?void 0:t.map((n,u)=>v.createElement(X,{key:u,variant:n.variant,size:n.size,isFilled:n.isFilled,isLoading:l[u],classNames:o==null?void 0:o.button,onClick:()=>s(n,u)},n.title))):null},$=lt;var ut=({classNames:t,colors:e,animationOptions:o})=>{let[i,l]=m.useState([]),a=r=>{l(c=>c.concat({...r,id:b()}))},h=r=>{l(c=>c.filter(f=>f.id!==r))},s=()=>{l([])},n=m.useRef({id:b(),fire:a,close:h,closeAll:s});if(m.useEffect(()=>{if(!n.current)return;let r=n.current.id;return g.register(n.current),()=>{g.unregister(r)}},[]),!i.length)return null;let u=i.length;return i.map((r,c)=>(r.preventClose===void 0&&(r.preventClose=c<u-1),m.createElement(H,{key:r.id,isVisible:!0,onClose:()=>h(r.id),...r,colors:Object.assign({},e,r.colors),classNames:Object.assign({},t,r.classNames),animationOptions:o},m.createElement(L,{title:r.headerTitle,description:r.headerDescription}),m.createElement(z,{title:r.title,description:r.description,icon:r.icon,content:r.content}),m.createElement($,{buttons:r.buttons}))))},ct=ut;var Y={};q(Y,{closeAll:()=>K,fire:()=>J});var R={REGISTER:"You should add <Ghosta /> top of your app to regitster"};var J=t=>{let e=g.get();if(!e)return console.warn(R.REGISTER);e.fire(t)};var K=()=>{let t=g.get();if(!t)return console.warn(R.REGISTER);t.closeAll()};export{ct as Ghosta,Y as ghosta};
//# sourceMappingURL=index.js.map
{
"name": "react-ghosta",
"version": "1.1.1",
"version": "1.2.0",
"type": "module",

@@ -9,6 +9,7 @@ "description": "React popup alerts. Lightweight, customizable and beautiful by default.",

"scripts": {
"build": "rm -rf dist && rollup -c",
"build/publish": "npm run build && npm publish",
"start": "tsup --watch",
"build": "rm -rf dist && tsup",
"size": "size-limit",
"prettier": "prettier src --write"
"prettier": "prettier src --write",
"tsc": "tsc"
},

@@ -20,4 +21,4 @@ "exports": {

"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}

@@ -58,13 +59,6 @@ },

"devDependencies": {
"@babel/core": "^7.23.6",
"@babel/preset-env": "^7.23.6",
"@babel/preset-react": "^7.23.3",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@size-limit/preset-small-lib": "^11.0.2",
"@types/node": "^20.11.17",
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.18",
"@types/rollup-plugin-peer-deps-external": "^2.2.4",
"husky": "^9.0.10",

@@ -74,9 +68,6 @@ "prettier": "^3.2.5",

"react-dom": "^18.2.0",
"rollup": "^4.10.0",
"rollup-plugin-import-css": "^3.4.0",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-ts": "^3.4.5",
"size-limit": "^11.0.2",
"tsup": "^8.0.2",
"typescript": "^5.3.3"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc