boottent-design 0.1.6 → 0.1.7
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/boottent-design.main.cjs.js +1 -1
- package/dist/boottent-design.main.es.js +28 -18
- package/dist/boottent-design.provider.cjs.js +1 -51
- package/dist/boottent-design.provider.es.js +61 -2070
- package/dist/boottent-design.ui.cjs.js +1 -1
- package/dist/boottent-design.ui.es.js +17 -12
- package/dist/boottent-design.utils.cjs.js +1 -1
- package/dist/boottent-design.utils.es.js +285 -188
- package/dist/index-JOCM_DIz.cjs +1 -0
- package/dist/index-j8ablNp2.js +384 -0
- package/dist/tooltip-Dbl2Hiq4.cjs +51 -0
- package/dist/tooltip-x7XcU5XA.js +6638 -0
- package/dist/types/hooks.d.ts +1 -1
- package/dist/types/main.d.ts +172 -0
- package/dist/types/ui.d.ts +59 -0
- package/dist/types/utils.d.ts +149 -0
- package/package.json +1 -1
- package/dist/index-DKksyhqt.cjs +0 -1
- package/dist/index-DkEQQBYd.js +0 -2684
- package/dist/index-NAHSuYsJ.js +0 -2439
- package/dist/index-eD5RRver.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-DSrfsFKr.cjs"),n=require("./boottent-design.styles.cjs.js"),o=require("./tooltip-Dbl2Hiq4.cjs"),e=require("./index-JOCM_DIz.cjs"),t=require("./boottent-design.utils.cjs.js"),i=require("./portal-manager-6YGufJVr.cjs");exports.Box=r.Box;exports.Stack=r.Stack;exports.colors=n.colors;exports.Accordion=o.Accordion;exports.AccordionContent=o.AccordionContent;exports.AccordionItem=o.AccordionItem;exports.AccordionTrigger=o.AccordionTrigger;exports.Alert=o.Alert;exports.Button=o.Button;exports.Dialog=o.Dialog;exports.Icon=o.Icon;exports.Input=o.Input;exports.Modal=o.Modal;exports.PortalContainer=o.PortalContainer;exports.Toaster=o.Toaster;exports.TooltipProvider=o.TooltipProvider;exports.buttonVariants=o.buttonVariants;exports.Symbols=e.Symbols;exports.TooltipButton=e.TooltipButton;exports.cn=t.cn;exports.reducer=t.reducer;exports.toast=t.toast;exports.toaster=t.toaster;exports.portalManager=i.portalManager;
|
|
@@ -1,22 +1,32 @@
|
|
|
1
|
-
import { B as
|
|
2
|
-
import { colors as
|
|
3
|
-
import { A as
|
|
4
|
-
import {
|
|
5
|
-
import { cn as
|
|
1
|
+
import { B as r, S as t } from "./index-fOHifeTQ.js";
|
|
2
|
+
import { colors as e } from "./boottent-design.styles.es.js";
|
|
3
|
+
import { A as c, a as i, b as p, c as l, f as d, B as m, D as f, I as x, e as A, M as T, P as g, T as u, g as B, d as I } from "./tooltip-x7XcU5XA.js";
|
|
4
|
+
import { S as b, T as M } from "./index-j8ablNp2.js";
|
|
5
|
+
import { cn as C, reducer as D, toast as k, toaster as v } from "./boottent-design.utils.es.js";
|
|
6
|
+
import { p as V } from "./portal-manager-CttMAZAu.js";
|
|
6
7
|
export {
|
|
7
|
-
|
|
8
|
+
c as Accordion,
|
|
8
9
|
i as AccordionContent,
|
|
9
10
|
p as AccordionItem,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
l as AccordionTrigger,
|
|
12
|
+
d as Alert,
|
|
13
|
+
r as Box,
|
|
14
|
+
m as Button,
|
|
15
|
+
f as Dialog,
|
|
16
|
+
x as Icon,
|
|
17
|
+
A as Input,
|
|
18
|
+
T as Modal,
|
|
19
|
+
g as PortalContainer,
|
|
20
|
+
t as Stack,
|
|
21
|
+
b as Symbols,
|
|
22
|
+
u as Toaster,
|
|
23
|
+
M as TooltipButton,
|
|
24
|
+
B as TooltipProvider,
|
|
25
|
+
I as buttonVariants,
|
|
26
|
+
C as cn,
|
|
27
|
+
e as colors,
|
|
28
|
+
V as portalManager,
|
|
29
|
+
D as reducer,
|
|
30
|
+
k as toast,
|
|
31
|
+
v as toaster
|
|
22
32
|
};
|
|
@@ -1,51 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),Xe=require("./portal-manager-6YGufJVr.cjs"),O=require("react"),d=require("./index-eD5RRver.cjs"),De=require("react-dom"),S=require("./boottent-design.utils.cjs.js");function it(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const i=it(O),Bn=it(De);var Kn="Portal",Ae=i.forwardRef((e,t)=>{var c;const{container:n,...r}=e,[o,a]=i.useState(!1);d.useLayoutEffect2(()=>a(!0),[]);const l=n||o&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return l?De.createPortal(s.jsx(d.Primitive.div,{...r,ref:t}),l):null});Ae.displayName=Kn;const zn=5,Un=2e3;let me=0;function Yn(){return me=(me+1)%Number.MAX_SAFE_INTEGER,me.toString()}const ve=new Map,Ge=e=>{if(ve.has(e))return;const t=setTimeout(()=>{ve.delete(e),X({type:"REMOVE_TOAST",toastId:e})},Un);ve.set(e,t)},Xn=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,zn)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?Ge(n):e.toasts.forEach(r=>{Ge(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},oe=[];let ae={toasts:[]};function X(e){ae=Xn(ae,e),oe.forEach(t=>{t(ae)})}function ct({...e}){const t=Yn(),n=o=>X({type:"UPDATE_TOAST",toast:{...o,id:t}}),r=()=>X({type:"DISMISS_TOAST",toastId:t});return X({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||(r(),e.onClose&&e.onClose())}}}),{id:t,dismiss:r,update:n}}function Gn(){const[e,t]=i.useState(ae);return i.useEffect(()=>(oe.push(t),()=>{const n=oe.indexOf(t);n>-1&&oe.splice(n,1)}),[e]),{...e,toast:ct,dismiss:n=>X({type:"DISMISS_TOAST",toastId:n})}}var ge="focusScope.autoFocusOnMount",he="focusScope.autoFocusOnUnmount",qe={bubbles:!1,cancelable:!0},qn="FocusScope",lt=i.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...l}=e,[c,v]=i.useState(null),f=d.useCallbackRef(o),g=d.useCallbackRef(a),m=i.useRef(null),b=d.useComposedRefs(t,u=>v(u)),T=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(r){let u=function(y){if(T.paused||!c)return;const w=y.target;c.contains(w)?m.current=w:k(m.current,{select:!0})},p=function(y){if(T.paused||!c)return;const w=y.relatedTarget;w!==null&&(c.contains(w)||k(m.current,{select:!0}))},h=function(y){if(document.activeElement===document.body)for(const C of y)C.removedNodes.length>0&&k(c)};document.addEventListener("focusin",u),document.addEventListener("focusout",p);const x=new MutationObserver(h);return c&&x.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",u),document.removeEventListener("focusout",p),x.disconnect()}}},[r,c,T.paused]),i.useEffect(()=>{if(c){Qe.add(T);const u=document.activeElement;if(!c.contains(u)){const h=new CustomEvent(ge,qe);c.addEventListener(ge,f),c.dispatchEvent(h),h.defaultPrevented||(Zn(nr(ut(c)),{select:!0}),document.activeElement===u&&k(c))}return()=>{c.removeEventListener(ge,f),setTimeout(()=>{const h=new CustomEvent(he,qe);c.addEventListener(he,g),c.dispatchEvent(h),h.defaultPrevented||k(u??document.body,{select:!0}),c.removeEventListener(he,g),Qe.remove(T)},0)}}},[c,f,g,T]);const N=i.useCallback(u=>{if(!n&&!r||T.paused)return;const p=u.key==="Tab"&&!u.altKey&&!u.ctrlKey&&!u.metaKey,h=document.activeElement;if(p&&h){const x=u.currentTarget,[y,w]=Qn(x);y&&w?!u.shiftKey&&h===w?(u.preventDefault(),n&&k(y,{select:!0})):u.shiftKey&&h===y&&(u.preventDefault(),n&&k(w,{select:!0})):h===x&&u.preventDefault()}},[n,r,T.paused]);return s.jsx(d.Primitive.div,{tabIndex:-1,...l,ref:b,onKeyDown:N})});lt.displayName=qn;function Zn(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(k(r,{select:t}),document.activeElement!==n)return}function Qn(e){const t=ut(e),n=Ze(t,e),r=Ze(t.reverse(),e);return[n,r]}function ut(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ze(e,t){for(const n of e)if(!Jn(n,{upTo:t}))return n}function Jn(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function er(e){return e instanceof HTMLInputElement&&"select"in e}function k(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&er(e)&&t&&e.select()}}var Qe=tr();function tr(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Je(e,t),e.unshift(t)},remove(t){var n;e=Je(e,t),(n=e[0])==null||n.resume()}}}function Je(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function nr(e){return e.filter(t=>t.tagName!=="A")}var ye=0;function rr(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??et()),document.body.insertAdjacentElement("beforeend",e[1]??et()),ye++,()=>{ye===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),ye--}},[])}function et(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var _=function(){return _=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},_.apply(this,arguments)};function dt(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,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 or(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,a;r<o;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var se="right-scroll-bar-position",ie="width-before-scroll-bar",ar="with-scroll-bars-hidden",sr="--removed-body-scroll-bar-size";function xe(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function ir(e,t){var n=O.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var cr=typeof window<"u"?i.useLayoutEffect:i.useEffect,tt=new WeakMap;function lr(e,t){var n=ir(null,function(r){return e.forEach(function(o){return xe(o,r)})});return cr(function(){var r=tt.get(n);if(r){var o=new Set(r),a=new Set(e),l=n.current;o.forEach(function(c){a.has(c)||xe(c,null)}),a.forEach(function(c){o.has(c)||xe(c,l)})}tt.set(n,e)},[e]),n}function ur(e){return e}function dr(e,t){t===void 0&&(t=ur);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var l=t(a,r);return n.push(l),function(){n=n.filter(function(c){return c!==l})}},assignSyncMedium:function(a){for(r=!0;n.length;){var l=n;n=[],l.forEach(a)}n={push:function(c){return a(c)},filter:function(){return n}}},assignMedium:function(a){r=!0;var l=[];if(n.length){var c=n;n=[],c.forEach(a),l=n}var v=function(){var g=l;l=[],g.forEach(a)},f=function(){return Promise.resolve().then(v)};f(),n={push:function(g){l.push(g),f()},filter:function(g){return l=l.filter(g),n}}}};return o}function fr(e){e===void 0&&(e={});var t=dr(null);return t.options=_({async:!0,ssr:!1},e),t}var ft=function(e){var t=e.sideCar,n=dt(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return i.createElement(r,_({},n))};ft.isSideCarExport=!0;function pr(e,t){return e.useMedium(t),ft}var pt=fr(),we=function(){},le=i.forwardRef(function(e,t){var n=i.useRef(null),r=i.useState({onScrollCapture:we,onWheelCapture:we,onTouchMoveCapture:we}),o=r[0],a=r[1],l=e.forwardProps,c=e.children,v=e.className,f=e.removeScrollBar,g=e.enabled,m=e.shards,b=e.sideCar,T=e.noIsolation,N=e.inert,u=e.allowPinchZoom,p=e.as,h=p===void 0?"div":p,x=e.gapMode,y=dt(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),w=b,C=lr([n,t]),R=_(_({},y),o);return i.createElement(i.Fragment,null,g&&i.createElement(w,{sideCar:pt,removeScrollBar:f,shards:m,noIsolation:T,inert:N,setCallbacks:a,allowPinchZoom:!!u,lockRef:n,gapMode:x}),l?i.cloneElement(i.Children.only(c),_(_({},R),{ref:C})):i.createElement(h,_({},R,{className:v,ref:C}),c))});le.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};le.classNames={fullWidth:ie,zeroRight:se};var mr=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function vr(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=mr();return t&&e.setAttribute("nonce",t),e}function gr(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function hr(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var yr=function(){var e=0,t=null;return{add:function(n){e==0&&(t=vr())&&(gr(t,n),hr(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},xr=function(){var e=yr();return function(t,n){i.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},mt=function(){var e=xr(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},wr={left:0,top:0,right:0,gap:0},Ee=function(e){return parseInt(e||"",10)||0},Er=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Ee(n),Ee(r),Ee(o)]},br=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return wr;var t=Er(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Tr=mt(),K="data-scroll-locked",Cr=function(e,t,n,r){var o=e.left,a=e.top,l=e.right,c=e.gap;return n===void 0&&(n="margin"),`
|
|
2
|
-
.`.concat(ar,` {
|
|
3
|
-
overflow: hidden `).concat(r,`;
|
|
4
|
-
padding-right: `).concat(c,"px ").concat(r,`;
|
|
5
|
-
}
|
|
6
|
-
body[`).concat(K,`] {
|
|
7
|
-
overflow: hidden `).concat(r,`;
|
|
8
|
-
overscroll-behavior: contain;
|
|
9
|
-
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
10
|
-
padding-left: `.concat(o,`px;
|
|
11
|
-
padding-top: `).concat(a,`px;
|
|
12
|
-
padding-right: `).concat(l,`px;
|
|
13
|
-
margin-left:0;
|
|
14
|
-
margin-top:0;
|
|
15
|
-
margin-right: `).concat(c,"px ").concat(r,`;
|
|
16
|
-
`),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.`).concat(se,` {
|
|
20
|
-
right: `).concat(c,"px ").concat(r,`;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.`).concat(ie,` {
|
|
24
|
-
margin-right: `).concat(c,"px ").concat(r,`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.`).concat(se," .").concat(se,` {
|
|
28
|
-
right: 0 `).concat(r,`;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.`).concat(ie," .").concat(ie,` {
|
|
32
|
-
margin-right: 0 `).concat(r,`;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
body[`).concat(K,`] {
|
|
36
|
-
`).concat(sr,": ").concat(c,`px;
|
|
37
|
-
}
|
|
38
|
-
`)},nt=function(){var e=parseInt(document.body.getAttribute(K)||"0",10);return isFinite(e)?e:0},Sr=function(){i.useEffect(function(){return document.body.setAttribute(K,(nt()+1).toString()),function(){var e=nt()-1;e<=0?document.body.removeAttribute(K):document.body.setAttribute(K,e.toString())}},[])},Nr=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Sr();var a=i.useMemo(function(){return br(o)},[o]);return i.createElement(Tr,{styles:Cr(a,!t,o,n?"":"!important")})},Ce=!1;if(typeof window<"u")try{var J=Object.defineProperty({},"passive",{get:function(){return Ce=!0,!0}});window.addEventListener("test",J,J),window.removeEventListener("test",J,J)}catch{Ce=!1}var W=Ce?{passive:!1}:!1,Rr=function(e){return e.tagName==="TEXTAREA"},vt=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Rr(e)&&n[t]==="visible")},Dr=function(e){return vt(e,"overflowY")},Ar=function(e){return vt(e,"overflowX")},rt=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=gt(e,r);if(o){var a=ht(e,r),l=a[1],c=a[2];if(l>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Pr=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},jr=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},gt=function(e,t){return e==="v"?Dr(t):Ar(t)},ht=function(e,t){return e==="v"?Pr(t):jr(t)},_r=function(e,t){return e==="h"&&t==="rtl"?-1:1},Or=function(e,t,n,r,o){var a=_r(e,window.getComputedStyle(t).direction),l=a*r,c=n.target,v=t.contains(c),f=!1,g=l>0,m=0,b=0;do{var T=ht(e,c),N=T[0],u=T[1],p=T[2],h=u-p-a*N;(N||h)&>(e,c)&&(m+=h,b+=N),c instanceof ShadowRoot?c=c.host:c=c.parentNode}while(!v&&c!==document.body||v&&(t.contains(c)||t===c));return(g&&(Math.abs(m)<1||!o)||!g&&(Math.abs(b)<1||!o))&&(f=!0),f},ee=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ot=function(e){return[e.deltaX,e.deltaY]},at=function(e){return e&&"current"in e?e.current:e},Ir=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Mr=function(e){return`
|
|
39
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
40
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
41
|
-
`)},Fr=0,H=[];function kr(e){var t=i.useRef([]),n=i.useRef([0,0]),r=i.useRef(),o=i.useState(Fr++)[0],a=i.useState(mt)[0],l=i.useRef(e);i.useEffect(function(){l.current=e},[e]),i.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var u=or([e.lockRef.current],(e.shards||[]).map(at),!0).filter(Boolean);return u.forEach(function(p){return p.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),u.forEach(function(p){return p.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=i.useCallback(function(u,p){if("touches"in u&&u.touches.length===2||u.type==="wheel"&&u.ctrlKey)return!l.current.allowPinchZoom;var h=ee(u),x=n.current,y="deltaX"in u?u.deltaX:x[0]-h[0],w="deltaY"in u?u.deltaY:x[1]-h[1],C,R=u.target,D=Math.abs(y)>Math.abs(w)?"h":"v";if("touches"in u&&D==="h"&&R.type==="range")return!1;var j=rt(D,R);if(!j)return!0;if(j?C=D:(C=D==="v"?"h":"v",j=rt(D,R)),!j)return!1;if(!r.current&&"changedTouches"in u&&(y||w)&&(r.current=C),!C)return!0;var I=r.current||C;return Or(I,p,u,I==="h"?y:w,!0)},[]),v=i.useCallback(function(u){var p=u;if(!(!H.length||H[H.length-1]!==a)){var h="deltaY"in p?ot(p):ee(p),x=t.current.filter(function(C){return C.name===p.type&&(C.target===p.target||p.target===C.shadowParent)&&Ir(C.delta,h)})[0];if(x&&x.should){p.cancelable&&p.preventDefault();return}if(!x){var y=(l.current.shards||[]).map(at).filter(Boolean).filter(function(C){return C.contains(p.target)}),w=y.length>0?c(p,y[0]):!l.current.noIsolation;w&&p.cancelable&&p.preventDefault()}}},[]),f=i.useCallback(function(u,p,h,x){var y={name:u,delta:p,target:h,should:x,shadowParent:Lr(h)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(w){return w!==y})},1)},[]),g=i.useCallback(function(u){n.current=ee(u),r.current=void 0},[]),m=i.useCallback(function(u){f(u.type,ot(u),u.target,c(u,e.lockRef.current))},[]),b=i.useCallback(function(u){f(u.type,ee(u),u.target,c(u,e.lockRef.current))},[]);i.useEffect(function(){return H.push(a),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:b}),document.addEventListener("wheel",v,W),document.addEventListener("touchmove",v,W),document.addEventListener("touchstart",g,W),function(){H=H.filter(function(u){return u!==a}),document.removeEventListener("wheel",v,W),document.removeEventListener("touchmove",v,W),document.removeEventListener("touchstart",g,W)}},[]);var T=e.removeScrollBar,N=e.inert;return i.createElement(i.Fragment,null,N?i.createElement(a,{styles:Mr(o)}):null,T?i.createElement(Nr,{gapMode:e.gapMode}):null)}function Lr(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const $r=pr(pt,kr);var yt=i.forwardRef(function(e,t){return i.createElement(le,_({},e,{ref:t,sideCar:$r}))});yt.classNames=le.classNames;var Vr=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},B=new WeakMap,te=new WeakMap,ne={},be=0,xt=function(e){return e&&(e.host||xt(e.parentNode))},Wr=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=xt(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Hr=function(e,t,n,r){var o=Wr(t,Array.isArray(e)?e:[e]);ne[n]||(ne[n]=new WeakMap);var a=ne[n],l=[],c=new Set,v=new Set(o),f=function(m){!m||c.has(m)||(c.add(m),f(m.parentNode))};o.forEach(f);var g=function(m){!m||v.has(m)||Array.prototype.forEach.call(m.children,function(b){if(c.has(b))g(b);else try{var T=b.getAttribute(r),N=T!==null&&T!=="false",u=(B.get(b)||0)+1,p=(a.get(b)||0)+1;B.set(b,u),a.set(b,p),l.push(b),u===1&&N&&te.set(b,!0),p===1&&b.setAttribute(n,"true"),N||b.setAttribute(r,"true")}catch(h){console.error("aria-hidden: cannot operate on ",b,h)}})};return g(t),c.clear(),be++,function(){l.forEach(function(m){var b=B.get(m)-1,T=a.get(m)-1;B.set(m,b),a.set(m,T),b||(te.has(m)||m.removeAttribute(r),te.delete(m)),T||m.removeAttribute(n)}),be--,be||(B=new WeakMap,B=new WeakMap,te=new WeakMap,ne={})}},Br=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Vr(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),Hr(r,o,n,"aria-hidden")):function(){return null}},Pe="Dialog",[wt,Et]=d.createContextScope(Pe),[Kr,P]=wt(Pe),bt=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:l=!0}=e,c=i.useRef(null),v=i.useRef(null),[f=!1,g]=d.useControllableState({prop:r,defaultProp:o,onChange:a});return s.jsx(Kr,{scope:t,triggerRef:c,contentRef:v,contentId:d.useId(),titleId:d.useId(),descriptionId:d.useId(),open:f,onOpenChange:g,onOpenToggle:i.useCallback(()=>g(m=>!m),[g]),modal:l,children:n})};bt.displayName=Pe;var Tt="DialogTrigger",Ct=i.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=P(Tt,n),a=d.useComposedRefs(t,o.triggerRef);return s.jsx(d.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Oe(o.open),...r,ref:a,onClick:d.composeEventHandlers(e.onClick,o.onOpenToggle)})});Ct.displayName=Tt;var je="DialogPortal",[zr,St]=wt(je,{forceMount:void 0}),Nt=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,a=P(je,t);return s.jsx(zr,{scope:t,forceMount:n,children:i.Children.map(r,l=>s.jsx(d.Presence,{present:n||a.open,children:s.jsx(Ae,{asChild:!0,container:o,children:l})}))})};Nt.displayName=je;var ce="DialogOverlay",Rt=i.forwardRef((e,t)=>{const n=St(ce,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=P(ce,e.__scopeDialog);return a.modal?s.jsx(d.Presence,{present:r||a.open,children:s.jsx(Ur,{...o,ref:t})}):null});Rt.displayName=ce;var Ur=i.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=P(ce,n);return s.jsx(yt,{as:d.Slot,allowPinchZoom:!0,shards:[o.contentRef],children:s.jsx(d.Primitive.div,{"data-state":Oe(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),$="DialogContent",Dt=i.forwardRef((e,t)=>{const n=St($,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=P($,e.__scopeDialog);return s.jsx(d.Presence,{present:r||a.open,children:a.modal?s.jsx(Yr,{...o,ref:t}):s.jsx(Xr,{...o,ref:t})})});Dt.displayName=$;var Yr=i.forwardRef((e,t)=>{const n=P($,e.__scopeDialog),r=i.useRef(null),o=d.useComposedRefs(t,n.contentRef,r);return i.useEffect(()=>{const a=r.current;if(a)return Br(a)},[]),s.jsx(At,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:d.composeEventHandlers(e.onCloseAutoFocus,a=>{var l;a.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:d.composeEventHandlers(e.onPointerDownOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0;(l.button===2||c)&&a.preventDefault()}),onFocusOutside:d.composeEventHandlers(e.onFocusOutside,a=>a.preventDefault())})}),Xr=i.forwardRef((e,t)=>{const n=P($,e.__scopeDialog),r=i.useRef(!1),o=i.useRef(!1);return s.jsx(At,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var l,c;(l=e.onCloseAutoFocus)==null||l.call(e,a),a.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),a.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:a=>{var v,f;(v=e.onInteractOutside)==null||v.call(e,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const l=a.target;((f=n.triggerRef.current)==null?void 0:f.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),At=i.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...l}=e,c=P($,n),v=i.useRef(null),f=d.useComposedRefs(t,v);return rr(),s.jsxs(s.Fragment,{children:[s.jsx(lt,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:s.jsx(d.DismissableLayer,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Oe(c.open),...l,ref:f,onDismiss:()=>c.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(qr,{titleId:c.titleId}),s.jsx(Qr,{contentRef:v,descriptionId:c.descriptionId})]})]})}),_e="DialogTitle",Pt=i.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=P(_e,n);return s.jsx(d.Primitive.h2,{id:o.titleId,...r,ref:t})});Pt.displayName=_e;var jt="DialogDescription",_t=i.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=P(jt,n);return s.jsx(d.Primitive.p,{id:o.descriptionId,...r,ref:t})});_t.displayName=jt;var Ot="DialogClose",It=i.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=P(Ot,n);return s.jsx(d.Primitive.button,{type:"button",...r,ref:t,onClick:d.composeEventHandlers(e.onClick,()=>o.onOpenChange(!1))})});It.displayName=Ot;function Oe(e){return e?"open":"closed"}var Mt="DialogTitleWarning",[Gr,Ft]=d.createContext2(Mt,{contentName:$,titleName:_e,docsSlug:"dialog"}),qr=({titleId:e})=>{const t=Ft(Mt),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
42
|
-
|
|
43
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
44
|
-
|
|
45
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return i.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Zr="DialogDescriptionWarning",Qr=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ft(Zr).contentName}}.`;return i.useEffect(()=>{var a;const o=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},kt=bt,Jr=Ct,Lt=Nt,Ie=Rt,Me=Dt,Fe=Pt,ke=_t,Le=It,$t="AlertDialog",[eo,$o]=d.createContextScope($t,[Et]),M=Et(),Vt=e=>{const{__scopeAlertDialog:t,...n}=e,r=M(t);return s.jsx(kt,{...r,...n,modal:!0})};Vt.displayName=$t;var to="AlertDialogTrigger",no=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=M(n);return s.jsx(Jr,{...o,...r,ref:t})});no.displayName=to;var ro="AlertDialogPortal",Wt=e=>{const{__scopeAlertDialog:t,...n}=e,r=M(t);return s.jsx(Lt,{...r,...n})};Wt.displayName=ro;var oo="AlertDialogOverlay",Ht=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=M(n);return s.jsx(Ie,{...o,...r,ref:t})});Ht.displayName=oo;var z="AlertDialogContent",[ao,so]=eo(z),Bt=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...o}=e,a=M(n),l=i.useRef(null),c=d.useComposedRefs(t,l),v=i.useRef(null);return s.jsx(Gr,{contentName:z,titleName:Kt,docsSlug:"alert-dialog",children:s.jsx(ao,{scope:n,cancelRef:v,children:s.jsxs(Me,{role:"alertdialog",...a,...o,ref:c,onOpenAutoFocus:d.composeEventHandlers(o.onOpenAutoFocus,f=>{var g;f.preventDefault(),(g=v.current)==null||g.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:[s.jsx(d.Slottable,{children:r}),s.jsx(co,{contentRef:l})]})})})});Bt.displayName=z;var Kt="AlertDialogTitle",zt=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=M(n);return s.jsx(Fe,{...o,...r,ref:t})});zt.displayName=Kt;var Ut="AlertDialogDescription",Yt=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=M(n);return s.jsx(ke,{...o,...r,ref:t})});Yt.displayName=Ut;var io="AlertDialogAction",Xt=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=M(n);return s.jsx(Le,{...o,...r,ref:t})});Xt.displayName=io;var Gt="AlertDialogCancel",qt=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:o}=so(Gt,n),a=M(n),l=d.useComposedRefs(t,o);return s.jsx(Le,{...a,...r,ref:l})});qt.displayName=Gt;var co=({contentRef:e})=>{const t=`\`${z}\` requires a description for the component to be accessible for screen reader users.
|
|
46
|
-
|
|
47
|
-
You can add a description to the \`${z}\` by passing a \`${Ut}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
48
|
-
|
|
49
|
-
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${z}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
50
|
-
|
|
51
|
-
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return i.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},lo=Vt,uo=Wt,Zt=Ht,Qt=Bt,Jt=Xt,en=qt,tn=zt,nn=Yt;const rn=lo,fo=uo,on=i.forwardRef(({className:e,...t},n)=>s.jsx(Zt,{className:S.cn("fixed inset-0 z-50 bg-black/60 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));on.displayName=Zt.displayName;const po={sm:"max-w-[344px]",md:"max-w-[500px]",lg:"max-w-[640px]",fit:"max-w-fit"},$e=i.forwardRef(({className:e,size:t="sm",...n},r)=>s.jsxs(fo,{children:[s.jsx(on,{}),s.jsx(Qt,{ref:r,className:S.cn("fixed left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-4 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",po[t],e),...n})]}));$e.displayName=Qt.displayName;const Ve=({className:e,...t})=>s.jsx("div",{className:S.cn("flex flex-col space-y-2 text-center sm:text-left",e),...t});Ve.displayName="AlertDialogHeader";const We=({className:e,...t})=>s.jsx("div",{className:S.cn("flex flex-col-reverse sm:flex-row sm:justify-between sm:space-x-2",e),...t});We.displayName="AlertDialogFooter";const He=i.forwardRef(({className:e,...t},n)=>s.jsx(tn,{ref:n,className:S.cn("whitespace-pre-wrap text-semibold16",e),...t}));He.displayName=tn.displayName;const G=i.forwardRef(({className:e,...t},n)=>s.jsx(nn,{ref:n,className:S.cn("whitespace-pre-wrap text-xs font-normal text-grey-600",e),...t}));G.displayName=nn.displayName;const Be=i.forwardRef(({className:e,...t},n)=>s.jsx(Jt,{ref:n,className:S.cn(d.buttonVariants({size:"sm"}),e),...t}));Be.displayName=Jt.displayName;const an=i.forwardRef(({className:e,...t},n)=>s.jsx(en,{ref:n,className:S.cn(d.buttonVariants({variant:"outline",size:"sm"}),"mt-2 w-1/2 sm:mt-0",e),...t}));an.displayName=en.displayName;const sn=({title:e="알림",description:t,confirmText:n="확인",onConfirm:r,size:o="sm",onClose:a})=>s.jsx(rn,{open:!0,onOpenChange:l=>{!l&&a&&a()},children:s.jsxs($e,{size:o,children:[s.jsxs(Ve,{children:[s.jsx(He,{children:e}),s.jsx(G,{children:t})]}),s.jsx(We,{children:s.jsx(Be,{className:S.cn("w-full font-normal"),onClick:()=>{a&&a(),r&&r()},children:n})})]})});sn.displayName="Alert";const mo=kt,vo=Lt,cn=i.forwardRef(({className:e,...t},n)=>s.jsx(Ie,{ref:n,className:S.cn("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));cn.displayName=Ie.displayName;const ln=i.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(vo,{children:[s.jsx(cn,{}),s.jsxs(Me,{ref:r,className:S.cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-xl translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",e),...n,children:[t,s.jsxs(Le,{className:"absolute right-4 top-5 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground md:right-[30px] md:top-[25px]",children:[s.jsx(d.Icon.Cancel,{size:"16"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ln.displayName=Me.displayName;const un=({className:e,...t})=>s.jsx("div",{className:S.cn("flex flex-col text-left md:text-center",e),...t});un.displayName="DialogHeader";const dn=({className:e,...t})=>s.jsx("div",{className:S.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});dn.displayName="DialogFooter";const fn=i.forwardRef(({className:e,...t},n)=>s.jsx(Fe,{ref:n,className:S.cn("text-lg font-semibold leading-none tracking-tight",e),...t}));fn.displayName=Fe.displayName;const pn=i.forwardRef(({className:e,...t},n)=>s.jsx(ke,{ref:n,className:S.cn("text-sm text-muted",e),...t}));pn.displayName=ke.displayName;const mn=i.forwardRef(({id:e,title:t,description:n,onConfirm:r,onCancel:o,onClose:a,confirmText:l="확인",cancelText:c="취소",size:v="sm",content:f,className:g,...m},b)=>s.jsx(mo,{open:!0,onOpenChange:T=>{!T&&a&&a()},children:s.jsxs(ln,{className:S.cn("max-w-[328px] gap-0 px-0 py-0 md:max-w-[600px]",g),...m,ref:b,children:[s.jsxs(un,{className:"border-b border-b-border",children:[s.jsx(fn,{className:"flex h-[57px] w-full items-center justify-start px-5 md:h-[65px] md:justify-center md:px-[30px]",children:t}),n&&s.jsx(pn,{children:n})]}),f&&s.jsx("div",{children:f}),s.jsxs(dn,{children:[o&&s.jsx(d.Button,{onClick:()=>{o&&o(),a&&a()},className:S.cn(d.buttonVariants({variant:"outline",size:"sm"}),"w-full sm:w-auto"),children:c}),r&&s.jsx(d.Button,{onClick:()=>{r&&r(),a&&a()},className:S.cn(d.buttonVariants({size:"sm"}),"w-full sm:w-auto"),children:l})]})]})}));mn.displayName="Dialog";const vn=i.forwardRef(({title:e,description:t,subDescription:n,contents:r,onConfirm:o,confirmText:a="확인",cancelText:l="취소",size:c="sm",className:v,onClose:f,...g},m)=>s.jsx(rn,{open:!0,onOpenChange:b=>{!b&&f&&f()},children:s.jsxs($e,{size:c,className:v,...g,ref:m,children:[s.jsxs(Ve,{children:[s.jsx(He,{children:e}),t&&s.jsx(G,{children:t}),n&&s.jsx(G,{className:"text-xs text-grey-600",children:n})]}),r&&s.jsx(G,{className:"text-sm font-normal text-grey-600",children:r}),s.jsxs(We,{children:[s.jsx(an,{className:S.cn("w-full font-normal"),children:l}),s.jsx(Be,{className:S.cn("w-full font-normal"),onClick:()=>{o&&o()},children:a})]})]})}));vn.displayName="Modal";var Ke="ToastProvider",[ze,go,ho]=d.createCollection("Toast"),[gn,Vo]=d.createContextScope("Toast",[ho]),[yo,ue]=gn(Ke),hn=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:a=50,children:l}=e,[c,v]=i.useState(null),[f,g]=i.useState(0),m=i.useRef(!1),b=i.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Ke}\`. Expected non-empty \`string\`.`),s.jsx(ze.Provider,{scope:t,children:s.jsx(yo,{scope:t,label:n,duration:r,swipeDirection:o,swipeThreshold:a,toastCount:f,viewport:c,onViewportChange:v,onToastAdd:i.useCallback(()=>g(T=>T+1),[]),onToastRemove:i.useCallback(()=>g(T=>T-1),[]),isFocusedToastEscapeKeyDownRef:m,isClosePausedRef:b,children:l})})};hn.displayName=Ke;var yn="ToastViewport",xo=["F8"],Se="toast.viewportPause",Ne="toast.viewportResume",xn=i.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=xo,label:o="Notifications ({hotkey})",...a}=e,l=ue(yn,n),c=go(n),v=i.useRef(null),f=i.useRef(null),g=i.useRef(null),m=i.useRef(null),b=d.useComposedRefs(t,m,l.onViewportChange),T=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),N=l.toastCount>0;i.useEffect(()=>{const p=h=>{var y;r.length!==0&&r.every(w=>h[w]||h.code===w)&&((y=m.current)==null||y.focus())};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[r]),i.useEffect(()=>{const p=v.current,h=m.current;if(N&&p&&h){const x=()=>{if(!l.isClosePausedRef.current){const R=new CustomEvent(Se);h.dispatchEvent(R),l.isClosePausedRef.current=!0}},y=()=>{if(l.isClosePausedRef.current){const R=new CustomEvent(Ne);h.dispatchEvent(R),l.isClosePausedRef.current=!1}},w=R=>{!p.contains(R.relatedTarget)&&y()},C=()=>{p.contains(document.activeElement)||y()};return p.addEventListener("focusin",x),p.addEventListener("focusout",w),p.addEventListener("pointermove",x),p.addEventListener("pointerleave",C),window.addEventListener("blur",x),window.addEventListener("focus",y),()=>{p.removeEventListener("focusin",x),p.removeEventListener("focusout",w),p.removeEventListener("pointermove",x),p.removeEventListener("pointerleave",C),window.removeEventListener("blur",x),window.removeEventListener("focus",y)}}},[N,l.isClosePausedRef]);const u=i.useCallback(({tabbingDirection:p})=>{const x=c().map(y=>{const w=y.ref.current,C=[w,..._o(w)];return p==="forwards"?C:C.reverse()});return(p==="forwards"?x.reverse():x).flat()},[c]);return i.useEffect(()=>{const p=m.current;if(p){const h=x=>{var C,R,D;const y=x.altKey||x.ctrlKey||x.metaKey;if(x.key==="Tab"&&!y){const j=document.activeElement,I=x.shiftKey;if(x.target===p&&I){(C=f.current)==null||C.focus();return}const L=u({tabbingDirection:I?"backwards":"forwards"}),q=L.findIndex(E=>E===j);Te(L.slice(q+1))?x.preventDefault():I?(R=f.current)==null||R.focus():(D=g.current)==null||D.focus()}};return p.addEventListener("keydown",h),()=>p.removeEventListener("keydown",h)}},[c,u]),s.jsxs(d.Branch,{ref:v,role:"region","aria-label":o.replace("{hotkey}",T),tabIndex:-1,style:{pointerEvents:N?void 0:"none"},children:[N&&s.jsx(Re,{ref:f,onFocusFromOutsideViewport:()=>{const p=u({tabbingDirection:"forwards"});Te(p)}}),s.jsx(ze.Slot,{scope:n,children:s.jsx(d.Primitive.ol,{tabIndex:-1,...a,ref:b})}),N&&s.jsx(Re,{ref:g,onFocusFromOutsideViewport:()=>{const p=u({tabbingDirection:"backwards"});Te(p)}})]})});xn.displayName=yn;var wn="ToastFocusProxy",Re=i.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=e,a=ue(wn,n);return s.jsx(d.VisuallyHidden,{"aria-hidden":!0,tabIndex:0,...o,ref:t,style:{position:"fixed"},onFocus:l=>{var f;const c=l.relatedTarget;!((f=a.viewport)!=null&&f.contains(c))&&r()}})});Re.displayName=wn;var de="Toast",wo="toast.swipeStart",Eo="toast.swipeMove",bo="toast.swipeCancel",To="toast.swipeEnd",En=i.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:a,...l}=e,[c=!0,v]=d.useControllableState({prop:r,defaultProp:o,onChange:a});return s.jsx(d.Presence,{present:n||c,children:s.jsx(No,{open:c,...l,ref:t,onClose:()=>v(!1),onPause:d.useCallbackRef(e.onPause),onResume:d.useCallbackRef(e.onResume),onSwipeStart:d.composeEventHandlers(e.onSwipeStart,f=>{f.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:d.composeEventHandlers(e.onSwipeMove,f=>{const{x:g,y:m}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","move"),f.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${g}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${m}px`)}),onSwipeCancel:d.composeEventHandlers(e.onSwipeCancel,f=>{f.currentTarget.setAttribute("data-swipe","cancel"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:d.composeEventHandlers(e.onSwipeEnd,f=>{const{x:g,y:m}=f.detail.delta;f.currentTarget.setAttribute("data-swipe","end"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),f.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),f.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${g}px`),f.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${m}px`),v(!1)})})})});En.displayName=de;var[Co,So]=gn(de,{onClose(){}}),No=i.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:a,onClose:l,onEscapeKeyDown:c,onPause:v,onResume:f,onSwipeStart:g,onSwipeMove:m,onSwipeCancel:b,onSwipeEnd:T,...N}=e,u=ue(de,n),[p,h]=i.useState(null),x=d.useComposedRefs(t,E=>h(E)),y=i.useRef(null),w=i.useRef(null),C=o||u.duration,R=i.useRef(0),D=i.useRef(C),j=i.useRef(0),{onToastAdd:I,onToastRemove:fe}=u,V=d.useCallbackRef(()=>{var A;(p==null?void 0:p.contains(document.activeElement))&&((A=u.viewport)==null||A.focus()),l()}),L=i.useCallback(E=>{!E||E===1/0||(window.clearTimeout(j.current),R.current=new Date().getTime(),j.current=window.setTimeout(V,E))},[V]);i.useEffect(()=>{const E=u.viewport;if(E){const A=()=>{L(D.current),f==null||f()},F=()=>{const U=new Date().getTime()-R.current;D.current=D.current-U,window.clearTimeout(j.current),v==null||v()};return E.addEventListener(Se,F),E.addEventListener(Ne,A),()=>{E.removeEventListener(Se,F),E.removeEventListener(Ne,A)}}},[u.viewport,C,v,f,L]),i.useEffect(()=>{a&&!u.isClosePausedRef.current&&L(C)},[a,C,u.isClosePausedRef,L]),i.useEffect(()=>(I(),()=>fe()),[I,fe]);const q=i.useMemo(()=>p?Dn(p):null,[p]);return u.viewport?s.jsxs(s.Fragment,{children:[q&&s.jsx(Ro,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:q}),s.jsx(Co,{scope:n,onClose:V,children:Bn.createPortal(s.jsx(ze.ItemSlot,{scope:n,children:s.jsx(d.Root$1,{asChild:!0,onEscapeKeyDown:d.composeEventHandlers(c,()=>{u.isFocusedToastEscapeKeyDownRef.current||V(),u.isFocusedToastEscapeKeyDownRef.current=!1}),children:s.jsx(d.Primitive.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":a?"open":"closed","data-swipe-direction":u.swipeDirection,...N,ref:x,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:d.composeEventHandlers(e.onKeyDown,E=>{E.key==="Escape"&&(c==null||c(E.nativeEvent),E.nativeEvent.defaultPrevented||(u.isFocusedToastEscapeKeyDownRef.current=!0,V()))}),onPointerDown:d.composeEventHandlers(e.onPointerDown,E=>{E.button===0&&(y.current={x:E.clientX,y:E.clientY})}),onPointerMove:d.composeEventHandlers(e.onPointerMove,E=>{if(!y.current)return;const A=E.clientX-y.current.x,F=E.clientY-y.current.y,U=!!w.current,Y=["left","right"].includes(u.swipeDirection),Z=["left","up"].includes(u.swipeDirection)?Math.min:Math.max,Wn=Y?Z(0,A):0,Hn=Y?0:Z(0,F),pe=E.pointerType==="touch"?10:2,Q={x:Wn,y:Hn},Ye={originalEvent:E,delta:Q};U?(w.current=Q,re(Eo,m,Ye,{discrete:!1})):st(Q,u.swipeDirection,pe)?(w.current=Q,re(wo,g,Ye,{discrete:!1}),E.target.setPointerCapture(E.pointerId)):(Math.abs(A)>pe||Math.abs(F)>pe)&&(y.current=null)}),onPointerUp:d.composeEventHandlers(e.onPointerUp,E=>{const A=w.current,F=E.target;if(F.hasPointerCapture(E.pointerId)&&F.releasePointerCapture(E.pointerId),w.current=null,y.current=null,A){const U=E.currentTarget,Y={originalEvent:E,delta:A};st(A,u.swipeDirection,u.swipeThreshold)?re(To,T,Y,{discrete:!0}):re(bo,b,Y,{discrete:!0}),U.addEventListener("click",Z=>Z.preventDefault(),{once:!0})}})})})}),u.viewport)})]}):null}),Ro=e=>{const{__scopeToast:t,children:n,...r}=e,o=ue(de,t),[a,l]=i.useState(!1),[c,v]=i.useState(!1);return Po(()=>l(!0)),i.useEffect(()=>{const f=window.setTimeout(()=>v(!0),1e3);return()=>window.clearTimeout(f)},[]),c?null:s.jsx(Ae,{asChild:!0,children:s.jsx(d.VisuallyHidden,{...r,children:a&&s.jsxs(s.Fragment,{children:[o.label," ",n]})})})},Do="ToastTitle",bn=i.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return s.jsx(d.Primitive.div,{...r,ref:t})});bn.displayName=Do;var Ao="ToastDescription",Tn=i.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return s.jsx(d.Primitive.div,{...r,ref:t})});Tn.displayName=Ao;var Cn="ToastAction",Sn=i.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?s.jsx(Rn,{altText:n,asChild:!0,children:s.jsx(Ue,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${Cn}\`. Expected non-empty \`string\`.`),null)});Sn.displayName=Cn;var Nn="ToastClose",Ue=i.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,o=So(Nn,n);return s.jsx(Rn,{asChild:!0,children:s.jsx(d.Primitive.button,{type:"button",...r,ref:t,onClick:d.composeEventHandlers(e.onClick,o.onClose)})})});Ue.displayName=Nn;var Rn=i.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...o}=e;return s.jsx(d.Primitive.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...o,ref:t})});function Dn(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),jo(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",a=r.dataset.radixToastAnnounceExclude==="";if(!o)if(a){const l=r.dataset.radixToastAnnounceAlt;l&&t.push(l)}else t.push(...Dn(r))}}),t}function re(e,t,n,{discrete:r}){const o=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?d.dispatchDiscreteCustomEvent(o,a):o.dispatchEvent(a)}var st=(e,t,n=0)=>{const r=Math.abs(e.x),o=Math.abs(e.y),a=r>o;return t==="left"||t==="right"?a&&r>n:!a&&o>n};function Po(e=()=>{}){const t=d.useCallbackRef(e);d.useLayoutEffect2(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function jo(e){return e.nodeType===e.ELEMENT_NODE}function _o(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Te(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var Oo=hn,An=xn,Pn=En,jn=bn,_n=Tn,On=Sn,In=Ue;const Io=Oo,Mn=i.forwardRef(({className:e,id:t,...n},r)=>s.jsx(An,{ref:r,id:t,className:S.cn("fixed z-[100] flex max-h-screen flex-col-reverse gap-2 p-4 outline-none ring-transparent",e),...n}));Mn.displayName=An.displayName;const Mo=d.cva("group pointer-events-auto relative flex w-full whitespace-pre-wrap bg-opacity-90 items-center justify-between space-x-4 overflow-hidden rounded-lg border p-4 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-top-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-top-full",{variants:{variant:{black:"group border bg-grey-800 border-grey-800 text-grey-50",white:"group border bg-grey-50 border-grey-50 text-grey-800"},position:{"top-left":"top-0 left-0","top-center":"top-0 left-1/2 transform -translate-x-1/2","top-right":"top-0 right-0","bottom-left":"bottom-0 left-0","bottom-center":"bottom-0 left-1/2 transform -translate-x-1/2","bottom-right":"bottom-0 right-0"},size:{sm:"max-w-xs",md:"max-w-md",lg:"max-w-lg",xl:"max-w-2xl",full:"max-w-full",fit:"max-w-fit"}},defaultVariants:{variant:"black",position:"top-center",size:"fit"}}),Fn=i.forwardRef(({className:e,variant:t,position:n,size:r,...o},a)=>s.jsx(Pn,{ref:a,className:S.cn(Mo({variant:t,position:n,size:r}),e),...o,duration:2500}));Fn.displayName=Pn.displayName;const kn=i.forwardRef(({className:e,...t},n)=>s.jsx(On,{ref:n,className:S.cn(d.buttonVariants({variant:"outline",size:"sm",theme:"secondary"}),e),...t}));kn.displayName=On.displayName;const Ln=i.forwardRef(({className:e,...t},n)=>s.jsx(In,{ref:n,className:S.cn("absolute right-2 top-2 rounded-md p-1 text-grey-50/50 opacity-0 transition-opacity hover:text-grey-50 focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.white]:text-grey-300 group-[.white]:hover:text-grey-50 group-[.white]:focus:ring-grey-400",e),"toast-close":"",...t,children:s.jsx(d.Icon.Cancel,{size:"12"})}));Ln.displayName=In.displayName;const $n=i.forwardRef(({className:e,...t},n)=>s.jsx(jn,{ref:n,className:S.cn("text-sm font-semibold",e),...t}));$n.displayName=jn.displayName;const Vn=i.forwardRef(({className:e,...t},n)=>s.jsx(_n,{ref:n,className:S.cn("text-sm font-normal",e),...t}));Vn.displayName=_n.displayName;function Fo(){const{toasts:e}=Gn(),t=e.reduce((n,r)=>{const o=r.position||"center";return n[o]||(n[o]=[]),n[o].push(r),n},{});return s.jsx(O.Fragment,{children:Object.entries(t).map(([n,r])=>s.jsxs(Io,{children:[s.jsx(Mn,{className:S.cn(n==="top-left"&&"top-0 left-0",n==="top-center"&&"top-0 left-1/2 transform -translate-x-1/2",n==="top-right"&&"top-0 right-0 items-end",n==="bottom-left"&&"bottom-0 left-0",n==="bottom-center"&&"bottom-0 left-1/2 transform -translate-x-1/2",n==="bottom-right"&&"bottom-0 right-0 items-end")}),r.map(function({id:o,title:a,description:l,action:c,actionText:v="확인",closeButton:f=!1,variant:g="black",...m}){return s.jsxs(Fn,{variant:g,position:n,...m,children:[s.jsxs("div",{className:"grid gap-1",children:[a&&s.jsx($n,{children:a}),l&&s.jsx(Vn,{children:l})]}),c&&s.jsx(kn,{altText:o,onClick:c,className:"overflow-hidden",children:v}),f&&s.jsx(Ln,{})]},o)})]},n))})}const ko=({children:e})=>{const[t,n]=O.useState(!1),[r,o]=O.useState(null);return O.useEffect(()=>{n(!0);let a=document.getElementById("portal");a||(a=document.createElement("div"),a.id="portal",document.body.appendChild(a)),o(a)},[]),!t||!r?null:De.createPortal(e,r)},Lo=()=>{const[e,t]=O.useState([]);O.useEffect(()=>{const r=Xe.portalManager.subscribe((o,a)=>{t(l=>{if(a){if(!l.find(c=>c.id===o.id))return[...l,{...o,isOpen:a}]}else return l.map(c=>c.id===o.id?{...c,isOpen:a}:c);return l})});return()=>{r()}},[]);const n=r=>{Xe.portalManager.setPortalOpen(r,!1)};return O.useEffect(()=>{e.forEach(r=>{if(!r.isOpen){const o=setTimeout(()=>{t(a=>a.filter(l=>l.id!==r.id))},300);return()=>clearTimeout(o)}})},[e]),O.useEffect(()=>{const r=o=>{const a=o.props;ct({title:a.title,description:a.description,action:a.action,closeButton:a.closeButton,variant:a.variant,position:a.position,size:a.size,className:a.className}),n(o.id)};e.forEach(o=>{o.type==="toast"&&o.isOpen&&r(o)})},[e,n]),s.jsxs(ko,{children:[s.jsx(Fo,{}),e.map(r=>{var o;if(!r.isOpen)return null;switch(r.type){case"modal":return s.jsx(vn,{...r.props,onClose:()=>{r.props.onClose&&r.props.onClose(),n(r.id)},description:(o=r.props.description)==null?void 0:o.toString()},r.id);case"alert":return s.jsx(sn,{...r.props,onClose:()=>{r.props.onClose&&r.props.onClose(),n(r.id)}},r.id);case"dialog":return s.jsx(mn,{...r.props,onClose:()=>{r.props.onClose&&r.props.onClose(),n(r.id)}},r.id);case"toast":return null;default:return null}})]})};exports.PortalProvider=Lo;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),u=require("./tooltip-Dbl2Hiq4.cjs"),a=require("react"),l=require("./portal-manager-6YGufJVr.cjs"),f=require("./boottent-design.utils.cjs.js"),p=()=>{const[i,d]=a.useState([]);a.useEffect(()=>{const e=l.portalManager.subscribe((s,t)=>{d(o=>{if(t){if(!o.find(r=>r.id===s.id))return[...o,{...s,isOpen:t}]}else return o.map(r=>r.id===s.id?{...r,isOpen:t}:r);return o})});return()=>{e()}},[]);const n=e=>{l.portalManager.setPortalOpen(e,!1)};return a.useEffect(()=>{i.forEach(e=>{if(!e.isOpen){const s=setTimeout(()=>{d(t=>t.filter(o=>o.id!==e.id))},300);return()=>clearTimeout(s)}})},[i]),a.useEffect(()=>{const e=s=>{const t=s.props;f.toast({title:t.title,description:t.description,action:t.action,closeButton:t.closeButton,variant:t.variant,position:t.position,size:t.size,className:t.className}),n(s.id)};i.forEach(s=>{s.type==="toast"&&s.isOpen&&e(s)})},[i,n]),c.jsxs(u.PortalContainer,{children:[c.jsx(u.Toaster,{}),i.map(e=>{var s;if(!e.isOpen)return null;switch(e.type){case"modal":return c.jsx(u.Modal,{...e.props,onClose:()=>{e.props.onClose&&e.props.onClose(),n(e.id)},description:(s=e.props.description)==null?void 0:s.toString()},e.id);case"alert":return c.jsx(u.Alert,{...e.props,onClose:()=>{e.props.onClose&&e.props.onClose(),n(e.id)}},e.id);case"dialog":return c.jsx(u.Dialog,{...e.props,onClose:()=>{e.props.onClose&&e.props.onClose(),n(e.id)}},e.id);case"toast":return null;default:return null}})]})};exports.PortalProvider=p;
|