boottent-design 0.1.207 → 0.1.208

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/dist/hooks.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./use-metadata-CZiZDN9j.cjs");require("react/jsx-runtime");const t=require("react"),o=require("./portal-manager-B4iWJSBI.cjs");require("./preview-9QZ5P9LT.cjs");require("./index-Cv4pTXfv.cjs");const s=require("./use-toastmodal-B1QxDevT.cjs"),q=()=>{const[u,r]=t.useState([]);t.useEffect(()=>{const e=(c,p)=>{r(n=>p?[...new Set([...n,c.id])]:n.filter(k=>k!==c.id))},l=o.portalManager.subscribe(e);return r(o.portalManager.getOpenPortals()),()=>l()},[]);const a=t.useCallback((e,l)=>o.portalManager.openPortal(e,{...l,onClose:l.onClose??(()=>{})}),[]),d=t.useCallback(e=>a("modal",e),[a]),i=t.useCallback(e=>typeof e=="string"?a("alert",{description:e}):a("alert",e),[a]),g=t.useCallback(e=>a("dialog",e),[a]),M=t.useCallback(e=>a("custom",e),[a]),b=t.useCallback(e=>o.portalManager.getIsPortalOpen(e),[]),P=t.useCallback(e=>o.portalManager.closePortal(e),[]),C=t.useCallback(()=>o.portalManager.closeAllPortals(),[]);return{open:a,confirm:d,alert:i,dialog:g,custom:M,getIsOpen:b,closePortal:P,closeAllPortals:C,openPortals:u}};exports.useMetadata=m.useMetadata;exports.modalReducer=s.modalReducer;exports.toast=s.toast;exports.toastModal=s.toastModal;exports.toastReducer=s.toastReducer;exports.useToast=s.useToast;exports.useToastModal=s.useToastModal;exports.usePortal=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./use-metadata-CZiZDN9j.cjs");require("react/jsx-runtime");const t=require("react"),o=require("./portal-manager-DDusg5F9.cjs");require("./preview-9QZ5P9LT.cjs");require("./index-Cv4pTXfv.cjs");const s=require("./use-toastmodal-B1QxDevT.cjs"),q=()=>{const[u,r]=t.useState([]);t.useEffect(()=>{const e=(c,p)=>{r(n=>p?[...new Set([...n,c.id])]:n.filter(k=>k!==c.id))},l=o.portalManager.subscribe(e);return r(o.portalManager.getOpenPortals()),()=>l()},[]);const a=t.useCallback((e,l)=>o.portalManager.openPortal(e,{...l,onClose:l.onClose??(()=>{})}),[]),d=t.useCallback(e=>a("modal",e),[a]),i=t.useCallback(e=>typeof e=="string"?a("alert",{description:e}):a("alert",e),[a]),g=t.useCallback(e=>a("dialog",e),[a]),M=t.useCallback(e=>a("custom",e),[a]),b=t.useCallback(e=>o.portalManager.getIsPortalOpen(e),[]),P=t.useCallback(e=>o.portalManager.closePortal(e),[]),C=t.useCallback(()=>o.portalManager.closeAllPortals(),[]);return{open:a,confirm:d,alert:i,dialog:g,custom:M,getIsOpen:b,closePortal:P,closeAllPortals:C,openPortals:u}};exports.useMetadata=m.useMetadata;exports.modalReducer=s.modalReducer;exports.toast=s.toast;exports.toastModal=s.toastModal;exports.toastReducer=s.toastReducer;exports.useToast=s.useToast;exports.useToastModal=s.useToastModal;exports.usePortal=q;
package/dist/hooks.es.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { u as w } from "./use-metadata-BrY8rtWx.js";
2
2
  import "react/jsx-runtime";
3
3
  import { useState as M, useEffect as O, useCallback as s } from "react";
4
- import { p as e } from "./portal-manager-C2H67l1q.js";
4
+ import { p as e } from "./portal-manager-DStZY_Ij.js";
5
5
  import "./preview-Cocn_vDi.js";
6
6
  import "./index-DT339AZp.js";
7
7
  import { m as E, a as h, b as j, t as q, u as z, c as B } from "./use-toastmodal-BpqFNqCw.js";
@@ -1 +1 @@
1
- "use strict";var c=Object.defineProperty;var d=(e,t,s)=>t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var a=(e,t,s)=>d(e,typeof t!="symbol"?t+"":t,s);let l;const p=new Uint8Array(16);function h(){if(!l&&(l=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!l))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return l(p)}const o=[];for(let e=0;e<256;++e)o.push((e+256).toString(16).slice(1));function g(e,t=0){return o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]}const w=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),u={randomUUID:w};function y(e,t,s){if(u.randomUUID&&!e)return u.randomUUID();e=e||{};const n=e.random||(e.rng||h)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,g(n)}class f{constructor(){a(this,"listeners",new Set);a(this,"portals",new Map);a(this,"queue",[]);a(this,"isProcessing",!1);a(this,"pendingEvents",[]);a(this,"broadcastScheduled",!1)}schedule(t){typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(()=>t()):setTimeout(t,0)}processQueue(){if(this.isProcessing||this.queue.length===0)return;this.isProcessing=!0;const t=()=>{const s=this.queue.shift();if(!s){this.isProcessing=!1;return}try{s()}finally{this.schedule(t)}};t()}scheduleBroadcast(t){this.pendingEvents.push(t),!this.broadcastScheduled&&(this.broadcastScheduled=!0,this.queue.push(()=>{const s=this.pendingEvents.slice();this.pendingEvents=[],this.broadcastScheduled=!1;for(const n of s)this.listeners.forEach(r=>{try{r(n.options,n.isOpen)}catch(i){process.env.NODE_ENV!=="production"&&console.error("[PortalManager] listener error:",i)}})}),this.processQueue())}isPortalOpen(t){var s;return((s=this.portals.get(t))==null?void 0:s.isOpen)??!1}isDuplicateAllowed(t){return t==="toast"}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}openPortal(t,s){const n=s.id??this.generateId(t);if(!this.isDuplicateAllowed(t)&&this.isPortalOpen(n))return n;const i={...{id:n,type:t,props:{...s,id:n}},isOpen:!0};return this.portals.set(n,i),this.scheduleBroadcast({options:i,isOpen:!0}),n}setPortalOpen(t,s){var r,i;const n=this.portals.get(t);n&&(n.isOpen=s,this.portals.set(t,n),this.scheduleBroadcast({options:n,isOpen:s}),s||(i=(r=n.props).onClose)==null||i.call(r))}updatePortal(t,s,n){const r=this.portals.get(t);if(!r||r.type!==s)return;const i={...r,props:{...r.props,...n}};this.portals.set(t,i),this.scheduleBroadcast({options:i,isOpen:!0})}closePortal(t){this.setPortalOpen(t,!1)}closeAllPortals(){this.getOpenPortals().forEach(t=>this.closePortal(t))}getIsPortalOpen(t){var s;return((s=this.portals.get(t))==null?void 0:s.isOpen)??!1}getOpenPortals(){const t=[];for(const[s,n]of this.portals.entries())n.isOpen&&t.push(s);return t}generateId(t){const s=typeof window<"u"&&window.location?window.location.pathname:"ssr",n=`${t}_${s}`;return this.isDuplicateAllowed(t)?`${n}_${y()}`:n}}const m=new f;exports.portalManager=m;
1
+ "use strict";var c=Object.defineProperty;var d=(e,t,s)=>t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var a=(e,t,s)=>d(e,typeof t!="symbol"?t+"":t,s);let l;const p=new Uint8Array(16);function h(){if(!l&&(l=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!l))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return l(p)}const o=[];for(let e=0;e<256;++e)o.push((e+256).toString(16).slice(1));function g(e,t=0){return o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]}const w=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),u={randomUUID:w};function y(e,t,s){if(u.randomUUID&&!e)return u.randomUUID();e=e||{};const n=e.random||(e.rng||h)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,g(n)}class f{constructor(){a(this,"listeners",new Set);a(this,"portals",new Map);a(this,"queue",[]);a(this,"isProcessing",!1);a(this,"pendingEvents",[]);a(this,"broadcastScheduled",!1)}schedule(t){typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(()=>t()):setTimeout(t,0)}processQueue(){if(this.isProcessing||this.queue.length===0)return;this.isProcessing=!0;const t=()=>{const s=this.queue.shift();if(!s){this.isProcessing=!1;return}try{s()}finally{this.schedule(t)}};t()}scheduleBroadcast(t){this.pendingEvents.push(t),!this.broadcastScheduled&&(this.broadcastScheduled=!0,this.queue.push(()=>{const s=this.pendingEvents.slice();this.pendingEvents=[],this.broadcastScheduled=!1;for(const n of s)this.listeners.forEach(r=>{try{r(n.options,n.isOpen)}catch(i){process.env.NODE_ENV!=="production"&&console.error("[PortalManager] listener error:",i)}})}),this.processQueue())}isPortalOpen(t){var s;return((s=this.portals.get(t))==null?void 0:s.isOpen)??!1}isDuplicateAllowed(t){return t==="toast"}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}openPortal(t,s){const n=s.id??this.generateId(t);if(!this.isDuplicateAllowed(t)&&this.isPortalOpen(n))return this.updatePortal(n,t,s),n;const i={...{id:n,type:t,props:{...s,id:n}},isOpen:!0};return this.portals.set(n,i),this.scheduleBroadcast({options:i,isOpen:!0}),n}setPortalOpen(t,s){var r,i;const n=this.portals.get(t);n&&(n.isOpen=s,this.portals.set(t,n),this.scheduleBroadcast({options:n,isOpen:s}),s||(i=(r=n.props).onClose)==null||i.call(r))}updatePortal(t,s,n){const r=this.portals.get(t);if(!r||r.type!==s)return;const i={...r,props:{...r.props,...n}};this.portals.set(t,i),this.scheduleBroadcast({options:i,isOpen:!0})}closePortal(t){this.setPortalOpen(t,!1)}closeAllPortals(){this.getOpenPortals().forEach(t=>this.closePortal(t))}getIsPortalOpen(t){var s;return((s=this.portals.get(t))==null?void 0:s.isOpen)??!1}getOpenPortals(){const t=[];for(const[s,n]of this.portals.entries())n.isOpen&&t.push(s);return t}generateId(t){const s=typeof window<"u"&&window.location?window.location.pathname:"ssr",n=`${t}_${s}`;return this.isDuplicateAllowed(t)?`${n}_${y()}`:n}}const P=new f;exports.portalManager=P;
@@ -1,12 +1,12 @@
1
1
  var c = Object.defineProperty;
2
- var p = (e, t, s) => t in e ? c(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
- var a = (e, t, s) => p(e, typeof t != "symbol" ? t + "" : t, s);
2
+ var d = (e, t, s) => t in e ? c(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
+ var a = (e, t, s) => d(e, typeof t != "symbol" ? t + "" : t, s);
4
4
  let l;
5
- const d = new Uint8Array(16);
5
+ const p = new Uint8Array(16);
6
6
  function h() {
7
7
  if (!l && (l = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !l))
8
8
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
9
- return l(d);
9
+ return l(p);
10
10
  }
11
11
  const o = [];
12
12
  for (let e = 0; e < 256; ++e)
@@ -82,7 +82,7 @@ class f {
82
82
  openPortal(t, s) {
83
83
  const n = s.id ?? this.generateId(t);
84
84
  if (!this.isDuplicateAllowed(t) && this.isPortalOpen(n))
85
- return n;
85
+ return this.updatePortal(n, t, s), n;
86
86
  const i = { ...{
87
87
  id: n,
88
88
  type: t,
@@ -125,7 +125,7 @@ class f {
125
125
  return this.isDuplicateAllowed(t) ? `${n}_${y()}` : n;
126
126
  }
127
127
  }
128
- const P = new f();
128
+ const m = new f();
129
129
  export {
130
- P as p
130
+ m as p
131
131
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),h=require("./use-toastmodal-B1QxDevT.cjs"),a=require("./index-C1T36J_d.cjs"),b=require("./preview-9QZ5P9LT.cjs"),m=require("./toast-form-BjkW_vXG.cjs"),u=require("react"),T=require("./portal-manager-B4iWJSBI.cjs");require("./index-z9hRvvSX.cjs");require("./index-Cv4pTXfv.cjs");const q=require("react-dom");function v(){const{modals:t,dismiss:n}=h.useToastModal(),o=t.some(s=>s.open);return r.jsxs(a.ToastModalProvider,{children:[t.map(function({id:s,title:e,description:i,content:f,onConfirm:c,confirmText:d="확인",onCancel:l,cancelText:x="취소",size:j,contents:M,variant:g,width:O,closeType:p,...P}){return r.jsxs(a.ToastModal,{width:O,...P,className:"flex flex-col gap-4",children:[r.jsx(a.ToastModalTitle,{children:e}),r.jsxs("div",{className:"flex flex-col gap-2",children:[i&&r.jsx(a.ToastModalDescription,{className:"text-sm text-foreground",children:i}),f&&r.jsx(a.ToastModalDescription,{children:f})]}),M&&r.jsx(a.ToastModalContents,{children:M}),r.jsxs("div",{className:b.cn("flex items-center justify-between gap-2",p&&"justify-end"),children:[!p&&r.jsx(a.ToastModalClose,{className:"w-1/2",size:j,variant:"outline",children:x}),r.jsx(a.ToastModalAction,{className:p?"":"w-1/2",altText:"confirm",size:j,variant:g,onClick:c,children:d})]})]},s)}),r.jsx(a.ToastModalViewport,{isOpen:o?"open":"close",onClick:()=>t.forEach(s=>!s.closeType&&n(s.id))})]})}const E={modal:(t,n)=>r.jsx(m.ModalForm,{...t.props,onClose:n},t.id),alert:(t,n)=>r.jsx(m.AlertForm,{...t.props,onClose:n},t.id),dialog:(t,n)=>r.jsx(m.DialogForm,{...t.props,onClose:n},t.id),custom:(t,n)=>r.jsx(m.FreeForm,{...t.props,onClose:n},t.id)},C=()=>{const[t,n]=u.useState([]),o=u.useRef(new Map);u.useEffect(()=>{const e=T.portalManager.subscribe((i,f)=>{n(c=>{const d=c.findIndex(l=>l.id===i.id);if(f){if(d===-1)return[...c,{...i,isOpen:!0}];const l=c.slice();l[d]={...l[d],...i,isOpen:!0};const x=o.current.get(i.id);return x&&(clearTimeout(x),o.current.delete(i.id)),l}else{if(d===-1)return c;const l=c.slice();return l[d]={...l[d],isOpen:!1},l}})});return()=>e()},[]);const s=u.useCallback(e=>{T.portalManager.setPortalOpen(e,!1)},[]);return u.useEffect(()=>(t.forEach(e=>{if(!e.isOpen&&!o.current.has(e.id)){const i=setTimeout(()=>{n(f=>f.filter(c=>c.id!==e.id)),o.current.delete(e.id)},300);o.current.set(e.id,i)}}),()=>{o.current.forEach(e=>clearTimeout(e)),o.current.clear()}),[t]),r.jsx(y,{children:t.map(e=>{if(!e.isOpen||e.type==="toast")return null;const i=E[e.type];return i(e,()=>s(e.id))})})},y=({children:t})=>{const[n,o]=u.useState(null);return u.useEffect(()=>{if(typeof document>"u")return;let s=document.getElementById("portal");s||(s=document.createElement("div"),s.id="portal",document.body.appendChild(s)),o(s)},[]),n?q.createPortal(t,n):null},w=["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right"];function F(t){const{toasts:n}=h.useToast();return r.jsxs(a.ToastProvider,{children:[t.children,w.map(o=>{const s=n.filter(e=>e.position===o);return s.length===0?null:r.jsxs("div",{children:[s.map(e=>r.jsx(m.ToastForm,{...e},e.id)),r.jsx(a.ToastViewport,{position:o})]},o)})]})}exports.ModalManager=v;exports.PortalProvider=C;exports.ToastManager=F;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),g=require("./use-toastmodal-B1QxDevT.cjs"),i=require("./index-C1T36J_d.cjs"),E=require("./preview-9QZ5P9LT.cjs"),m=require("./toast-form-BjkW_vXG.cjs"),u=require("react"),p=require("./portal-manager-DDusg5F9.cjs");require("./index-z9hRvvSX.cjs");require("./index-Cv4pTXfv.cjs");const O=require("react-dom");function v(){const{modals:e,dismiss:s}=g.useToastModal(),a=e.some(n=>n.open);return r.jsxs(i.ToastModalProvider,{children:[e.map(function({id:n,title:t,description:o,content:f,onConfirm:l,confirmText:d="확인",onCancel:c,cancelText:x="취소",size:j,contents:T,variant:h,width:P,closeType:M,...q}){return r.jsxs(i.ToastModal,{width:P,...q,className:"flex flex-col gap-4",children:[r.jsx(i.ToastModalTitle,{children:t}),r.jsxs("div",{className:"flex flex-col gap-2",children:[o&&r.jsx(i.ToastModalDescription,{className:"text-sm text-foreground",children:o}),f&&r.jsx(i.ToastModalDescription,{children:f})]}),T&&r.jsx(i.ToastModalContents,{children:T}),r.jsxs("div",{className:E.cn("flex items-center justify-between gap-2",M&&"justify-end"),children:[!M&&r.jsx(i.ToastModalClose,{className:"w-1/2",size:j,variant:"outline",children:x}),r.jsx(i.ToastModalAction,{className:M?"":"w-1/2",altText:"confirm",size:j,variant:h,onClick:l,children:d})]})]},n)}),r.jsx(i.ToastModalViewport,{isOpen:a?"open":"close",onClick:()=>e.forEach(n=>!n.closeType&&s(n.id))})]})}const C={modal:(e,s)=>r.jsx(m.ModalForm,{...e.props,onClose:s},e.id),alert:(e,s)=>r.jsx(m.AlertForm,{...e.props,onClose:s},e.id),dialog:(e,s)=>r.jsx(m.DialogForm,{...e.props,onClose:s},e.id),custom:(e,s)=>r.jsx(m.FreeForm,{...e.props,onClose:s},e.id)},b=()=>{const[e,s]=u.useState([]),a=u.useRef(new Map);u.useEffect(()=>{const t=p.portalManager.subscribe((o,f)=>{s(l=>{const d=l.findIndex(c=>c.id===o.id);if(f){if(d===-1)return[...l,{...o,isOpen:!0}];const c=l.slice();c[d]={...c[d],...o,isOpen:!0};const x=a.current.get(o.id);return x&&(clearTimeout(x),a.current.delete(o.id)),c}else{if(d===-1)return l;const c=l.slice();return c[d]={...c[d],isOpen:!1},c}})});return()=>t()},[]);const n=u.useCallback(t=>{p.portalManager.setPortalOpen(t,!1)},[]);return u.useEffect(()=>(e.forEach(t=>{if(!t.isOpen&&!a.current.has(t.id)){const o=setTimeout(()=>{s(f=>f.filter(l=>l.id!==t.id)),a.current.delete(t.id)},300);a.current.set(t.id,o)}}),()=>{a.current.forEach(t=>clearTimeout(t)),a.current.clear()}),[e]),r.jsx(y,{children:e.map(t=>{if(!t.isOpen||t.type==="toast")return null;const o=C[t.type];return o(t,()=>n(t.id))})})},y=({children:e})=>{const[s,a]=u.useState(null);return u.useEffect(()=>{if(typeof document>"u")return;let n=document.getElementById("portal");n||(n=document.createElement("div"),n.id="portal",document.body.appendChild(n)),a(n)},[]),s?O.createPortal(e,s):null};function w(){const{toasts:e}=g.useToast();return r.jsxs(i.ToastProvider,{children:[e.map(s=>r.jsx(m.ToastForm,{...s},s.id)),r.jsx(i.ToastViewport,{})]})}exports.ModalManager=v;exports.PortalProvider=b;exports.ToastManager=w;
@@ -1,137 +1,124 @@
1
- import { jsxs as u, jsx as s } from "react/jsx-runtime";
2
- import { c as P, u as E } from "./use-toastmodal-BpqFNqCw.js";
3
- import { T as v, a as F, b as N, c as M, d as w, e as y, f as D, g as j, h as A, i as I } from "./index-DuUh97OP.js";
4
- import { c as k } from "./preview-Cocn_vDi.js";
5
- import { F as R, D as S, A as _, M as L, T as V } from "./toast-form-B3hEA_lp.js";
6
- import { useState as x, useRef as B, useEffect as p, useCallback as q } from "react";
7
- import { p as g } from "./portal-manager-C2H67l1q.js";
1
+ import { jsxs as u, jsx as n } from "react/jsx-runtime";
2
+ import { c as P, u as b } from "./use-toastmodal-BpqFNqCw.js";
3
+ import { T as F, a as v, b as w, c as M, d as y, e as N, f as D, g as j, h as k, i as A } from "./index-DuUh97OP.js";
4
+ import { c as R } from "./preview-Cocn_vDi.js";
5
+ import { F as I, D as V, A as _, M as B, T as S } from "./toast-form-B3hEA_lp.js";
6
+ import { useState as g, useRef as q, useEffect as p, useCallback as G } from "react";
7
+ import { p as x } from "./portal-manager-DStZY_Ij.js";
8
8
  import "./index-CEwEyzHV.js";
9
9
  import "./index-DT339AZp.js";
10
- import G from "react-dom";
11
- function re() {
12
- const { modals: t, dismiss: r } = P(), n = t.some((o) => o.open);
13
- return /* @__PURE__ */ u(v, { children: [
14
- t.map(function({
15
- id: o,
16
- title: e,
17
- description: i,
10
+ import H from "react-dom";
11
+ function te() {
12
+ const { modals: e, dismiss: r } = P(), a = e.some((s) => s.open);
13
+ return /* @__PURE__ */ u(F, { children: [
14
+ e.map(function({
15
+ id: s,
16
+ title: t,
17
+ description: o,
18
18
  content: d,
19
19
  onConfirm: l,
20
20
  confirmText: c = "확인",
21
- onCancel: a,
21
+ onCancel: i,
22
22
  cancelText: m = "취소",
23
- size: h,
24
- contents: T,
25
- variant: O,
26
- width: b,
23
+ size: T,
24
+ contents: h,
25
+ variant: C,
26
+ width: O,
27
27
  closeType: f,
28
- ...C
28
+ ...E
29
29
  }) {
30
- return /* @__PURE__ */ u(F, { width: b, ...C, className: "flex flex-col gap-4", children: [
31
- /* @__PURE__ */ s(N, { children: e }),
30
+ return /* @__PURE__ */ u(v, { width: O, ...E, className: "flex flex-col gap-4", children: [
31
+ /* @__PURE__ */ n(w, { children: t }),
32
32
  /* @__PURE__ */ u("div", { className: "flex flex-col gap-2", children: [
33
- i && /* @__PURE__ */ s(M, { className: "text-sm text-foreground", children: i }),
34
- d && /* @__PURE__ */ s(M, { children: d })
33
+ o && /* @__PURE__ */ n(M, { className: "text-sm text-foreground", children: o }),
34
+ d && /* @__PURE__ */ n(M, { children: d })
35
35
  ] }),
36
- T && /* @__PURE__ */ s(w, { children: T }),
37
- /* @__PURE__ */ u("div", { className: k("flex items-center justify-between gap-2", f && "justify-end"), children: [
38
- !f && /* @__PURE__ */ s(y, { className: "w-1/2", size: h, variant: "outline", children: m }),
39
- /* @__PURE__ */ s(
36
+ h && /* @__PURE__ */ n(y, { children: h }),
37
+ /* @__PURE__ */ u("div", { className: R("flex items-center justify-between gap-2", f && "justify-end"), children: [
38
+ !f && /* @__PURE__ */ n(N, { className: "w-1/2", size: T, variant: "outline", children: m }),
39
+ /* @__PURE__ */ n(
40
40
  D,
41
41
  {
42
42
  className: f ? "" : "w-1/2",
43
43
  altText: "confirm",
44
- size: h,
45
- variant: O,
44
+ size: T,
45
+ variant: C,
46
46
  onClick: l,
47
47
  children: c
48
48
  }
49
49
  )
50
50
  ] })
51
- ] }, o);
51
+ ] }, s);
52
52
  }),
53
- /* @__PURE__ */ s(
53
+ /* @__PURE__ */ n(
54
54
  j,
55
55
  {
56
- isOpen: n ? "open" : "close",
57
- onClick: () => t.forEach((o) => !o.closeType && r(o.id))
56
+ isOpen: a ? "open" : "close",
57
+ onClick: () => e.forEach((s) => !s.closeType && r(s.id))
58
58
  }
59
59
  )
60
60
  ] });
61
61
  }
62
- const H = {
63
- modal: (t, r) => /* @__PURE__ */ s(L, { ...t.props, onClose: r }, t.id),
64
- alert: (t, r) => /* @__PURE__ */ s(_, { ...t.props, onClose: r }, t.id),
65
- dialog: (t, r) => /* @__PURE__ */ s(S, { ...t.props, onClose: r }, t.id),
66
- custom: (t, r) => /* @__PURE__ */ s(R, { ...t.props, onClose: r }, t.id)
67
- }, oe = () => {
68
- const [t, r] = x([]), n = B(/* @__PURE__ */ new Map());
62
+ const J = {
63
+ modal: (e, r) => /* @__PURE__ */ n(B, { ...e.props, onClose: r }, e.id),
64
+ alert: (e, r) => /* @__PURE__ */ n(_, { ...e.props, onClose: r }, e.id),
65
+ dialog: (e, r) => /* @__PURE__ */ n(V, { ...e.props, onClose: r }, e.id),
66
+ custom: (e, r) => /* @__PURE__ */ n(I, { ...e.props, onClose: r }, e.id)
67
+ }, re = () => {
68
+ const [e, r] = g([]), a = q(/* @__PURE__ */ new Map());
69
69
  p(() => {
70
- const e = g.subscribe((i, d) => {
70
+ const t = x.subscribe((o, d) => {
71
71
  r((l) => {
72
- const c = l.findIndex((a) => a.id === i.id);
72
+ const c = l.findIndex((i) => i.id === o.id);
73
73
  if (d) {
74
- if (c === -1) return [...l, { ...i, isOpen: !0 }];
75
- const a = l.slice();
76
- a[c] = { ...a[c], ...i, isOpen: !0 };
77
- const m = n.current.get(i.id);
78
- return m && (clearTimeout(m), n.current.delete(i.id)), a;
74
+ if (c === -1) return [...l, { ...o, isOpen: !0 }];
75
+ const i = l.slice();
76
+ i[c] = { ...i[c], ...o, isOpen: !0 };
77
+ const m = a.current.get(o.id);
78
+ return m && (clearTimeout(m), a.current.delete(o.id)), i;
79
79
  } else {
80
80
  if (c === -1) return l;
81
- const a = l.slice();
82
- return a[c] = { ...a[c], isOpen: !1 }, a;
81
+ const i = l.slice();
82
+ return i[c] = { ...i[c], isOpen: !1 }, i;
83
83
  }
84
84
  });
85
85
  });
86
- return () => e();
86
+ return () => t();
87
87
  }, []);
88
- const o = q((e) => {
89
- g.setPortalOpen(e, !1);
88
+ const s = G((t) => {
89
+ x.setPortalOpen(t, !1);
90
90
  }, []);
91
- return p(() => (t.forEach((e) => {
92
- if (!e.isOpen && !n.current.has(e.id)) {
93
- const i = setTimeout(() => {
94
- r((d) => d.filter((l) => l.id !== e.id)), n.current.delete(e.id);
91
+ return p(() => (e.forEach((t) => {
92
+ if (!t.isOpen && !a.current.has(t.id)) {
93
+ const o = setTimeout(() => {
94
+ r((d) => d.filter((l) => l.id !== t.id)), a.current.delete(t.id);
95
95
  }, 300);
96
- n.current.set(e.id, i);
96
+ a.current.set(t.id, o);
97
97
  }
98
98
  }), () => {
99
- n.current.forEach((e) => clearTimeout(e)), n.current.clear();
100
- }), [t]), /* @__PURE__ */ s(J, { children: t.map((e) => {
101
- if (!e.isOpen || e.type === "toast") return null;
102
- const i = H[e.type];
103
- return i(e, () => o(e.id));
99
+ a.current.forEach((t) => clearTimeout(t)), a.current.clear();
100
+ }), [e]), /* @__PURE__ */ n(K, { children: e.map((t) => {
101
+ if (!t.isOpen || t.type === "toast") return null;
102
+ const o = J[t.type];
103
+ return o(t, () => s(t.id));
104
104
  }) });
105
- }, J = ({ children: t }) => {
106
- const [r, n] = x(null);
105
+ }, K = ({ children: e }) => {
106
+ const [r, a] = g(null);
107
107
  return p(() => {
108
108
  if (typeof document > "u") return;
109
- let o = document.getElementById("portal");
110
- o || (o = document.createElement("div"), o.id = "portal", document.body.appendChild(o)), n(o);
111
- }, []), r ? G.createPortal(t, r) : null;
112
- }, K = [
113
- "top-left",
114
- "top-center",
115
- "top-right",
116
- "bottom-left",
117
- "bottom-center",
118
- "bottom-right"
119
- ];
120
- function ne(t) {
121
- const { toasts: r } = E();
122
- return /* @__PURE__ */ u(A, { children: [
123
- t.children,
124
- K.map((n) => {
125
- const o = r.filter((e) => e.position === n);
126
- return o.length === 0 ? null : /* @__PURE__ */ u("div", { children: [
127
- o.map((e) => /* @__PURE__ */ s(V, { ...e }, e.id)),
128
- /* @__PURE__ */ s(I, { position: n })
129
- ] }, n);
130
- })
109
+ let s = document.getElementById("portal");
110
+ s || (s = document.createElement("div"), s.id = "portal", document.body.appendChild(s)), a(s);
111
+ }, []), r ? H.createPortal(e, r) : null;
112
+ };
113
+ function se() {
114
+ const { toasts: e } = b();
115
+ return /* @__PURE__ */ u(k, { children: [
116
+ e.map((r) => /* @__PURE__ */ n(S, { ...r }, r.id)),
117
+ /* @__PURE__ */ n(A, {})
131
118
  ] });
132
119
  }
133
120
  export {
134
- re as ModalManager,
135
- oe as PortalProvider,
136
- ne as ToastManager
121
+ te as ModalManager,
122
+ re as PortalProvider,
123
+ se as ToastManager
137
124
  };
@@ -1,10 +1,9 @@
1
1
  import { JSX as JSX_2 } from 'react/jsx-runtime';
2
- import { PropsWithChildren } from 'react';
3
2
 
4
3
  export declare function ModalManager(): JSX_2.Element;
5
4
 
6
5
  export declare const PortalProvider: () => JSX_2.Element;
7
6
 
8
- export declare function ToastManager(props: PropsWithChildren): JSX_2.Element;
7
+ export declare function ToastManager(): JSX_2.Element;
9
8
 
10
9
  export { }
package/dist/utils.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./notion-Sqp-Xzqi.cjs"),t=require("./preview-9QZ5P9LT.cjs"),r=require("./portal-manager-B4iWJSBI.cjs");exports.buildBlockTree=e.buildBlockTree;exports.getCampDateText=e.getCampDateText;exports.getCampDdayText=e.getCampDdayText;exports.getDropdownButtonText=e.getDropdownButtonText;exports.getEventCampCostValue=e.getEventCampCostValue;exports.getPriority=e.getPriority;exports.getWrapperComponent=e.getWrapperComponent;exports.getYoutubeEmbedUrl=e.getYoutubeEmbedUrl;exports.groupBlocks=e.groupBlocks;exports.isListOrInsideList=e.isListOrInsideList;exports.isPriorityHeading=e.isPriorityHeading;exports.listTypes=e.listTypes;exports.addUTMtoUrl=t.addUTMtoUrl;exports.cn=t.cn;exports.convertBorderColorToHex=t.convertBorderColorToHex;exports.createHexToTokenMap=t.createHexToTokenMap;exports.getDaysDifference=t.getDaysDifference;exports.hexToTokenMap=t.hexToTokenMap;exports.parseDateString=t.parseDateString;exports.parseInlineStyle=t.parseInlineStyle;exports.rgbToHex=t.rgbToHex;exports.portalManager=r.portalManager;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./notion-Sqp-Xzqi.cjs"),t=require("./preview-9QZ5P9LT.cjs"),r=require("./portal-manager-DDusg5F9.cjs");exports.buildBlockTree=e.buildBlockTree;exports.getCampDateText=e.getCampDateText;exports.getCampDdayText=e.getCampDdayText;exports.getDropdownButtonText=e.getDropdownButtonText;exports.getEventCampCostValue=e.getEventCampCostValue;exports.getPriority=e.getPriority;exports.getWrapperComponent=e.getWrapperComponent;exports.getYoutubeEmbedUrl=e.getYoutubeEmbedUrl;exports.groupBlocks=e.groupBlocks;exports.isListOrInsideList=e.isListOrInsideList;exports.isPriorityHeading=e.isPriorityHeading;exports.listTypes=e.listTypes;exports.addUTMtoUrl=t.addUTMtoUrl;exports.cn=t.cn;exports.convertBorderColorToHex=t.convertBorderColorToHex;exports.createHexToTokenMap=t.createHexToTokenMap;exports.getDaysDifference=t.getDaysDifference;exports.hexToTokenMap=t.hexToTokenMap;exports.parseDateString=t.parseDateString;exports.parseInlineStyle=t.parseInlineStyle;exports.rgbToHex=t.rgbToHex;exports.portalManager=r.portalManager;
package/dist/utils.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { d as s, g as t, a as r, c as o, b as p, e as i, f as n, k as g, j as l, h as T, i as d, l as x } from "./notion-CfqLwM8d.js";
2
2
  import { a as m, c as b, d as f, e as u, g as y, h as C, b as D, p as k, r as B } from "./preview-Cocn_vDi.js";
3
- import { p as M } from "./portal-manager-C2H67l1q.js";
3
+ import { p as M } from "./portal-manager-DStZY_Ij.js";
4
4
  export {
5
5
  m as addUTMtoUrl,
6
6
  s as buildBlockTree,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "boottent-design",
3
3
  "private": false,
4
- "version": "0.1.207",
4
+ "version": "0.1.208",
5
5
  "description": "부트텐트 디자인시스템 라이브러리",
6
6
  "repository": {
7
7
  "type": "git",