@telegraph/modal 0.0.47 → 0.0.48

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @telegraph/modal
2
2
 
3
+ ## 0.0.48
4
+
5
+ ### Patch Changes
6
+
7
+ - [#304](https://github.com/knocklabs/telegraph/pull/304) [`5406a48`](https://github.com/knocklabs/telegraph/commit/5406a48748577104a9cdcad5bbb46b617bb6b8cb) Thanks [@kylemcd](https://github.com/kylemcd)! - fix modal overflow issue
8
+
3
9
  ## 0.0.47
4
10
 
5
11
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),Y=require("@radix-ui/react-dialog"),Z=require("@radix-ui/react-focus-scope"),v=require("react"),G=require("@radix-ui/react-visually-hidden"),J=require("@telegraph/button"),Q=require("@telegraph/icon"),m=require("@telegraph/layout"),P=require("framer-motion"),ee=require("react-dom");function L(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 E=L(Y),o=L(v),te=L(G),ne=L(ee);function _(e){const t=o.useRef(e);return o.useEffect(()=>{t.current=e}),o.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function re({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,s]=se({defaultProp:t,onChange:n}),i=e!==void 0,l=i?e:r,a=_(n),d=o.useCallback(c=>{if(i){const g=typeof c=="function"?c(e):c;g!==e&&a(g)}else s(c)},[i,e,s,a]);return[l,d]}function se({defaultProp:e,onChange:t}){const n=o.useState(e),[r]=n,s=o.useRef(r),i=_(t);return o.useEffect(()=>{s.current!==r&&(i(r),s.current=r)},[r,s,i]),n}function R(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function oe(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function ie(...e){return t=>e.forEach(n=>oe(n,t))}var F=o.forwardRef((e,t)=>{const{children:n,...r}=e,s=o.Children.toArray(n),i=s.find(ce);if(i){const l=i.props.children,a=s.map(d=>d===i?o.Children.count(l)>1?o.Children.only(null):o.isValidElement(l)?l.props.children:null:d);return u.jsx(S,{...r,ref:t,children:o.isValidElement(l)?o.cloneElement(l,void 0,a):null})}return u.jsx(S,{...r,ref:t,children:n})});F.displayName="Slot";var S=o.forwardRef((e,t)=>{const{children:n,...r}=e;if(o.isValidElement(n)){const s=ue(n);return o.cloneElement(n,{...le(r,n.props),ref:t?ie(t,s):s})}return o.Children.count(n)>1?o.Children.only(null):null});S.displayName="SlotClone";var ae=({children:e})=>u.jsx(u.Fragment,{children:e});function ce(e){return o.isValidElement(e)&&e.type===ae}function le(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...a)=>{i(...a),s(...a)}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function ue(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var de=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],A=de.reduce((e,t)=>{const n=o.forwardRef((r,s)=>{const{asChild:i,...l}=r,a=i?F:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(a,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function fe(e,t){e&&ne.flushSync(()=>e.dispatchEvent(t))}function pe(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function ye(...e){return t=>e.forEach(n=>pe(n,t))}function I(...e){return o.useCallback(ye(...e),e)}function D(e){const t=o.useRef(e);return o.useEffect(()=>{t.current=e}),o.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function he(e,t=globalThis==null?void 0:globalThis.document){const n=D(e);o.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var ve="DismissableLayer",w="dismissableLayer.update",me="dismissableLayer.pointerDownOutside",ge="dismissableLayer.focusOutside",M,q=o.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),$=o.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:l,onDismiss:a,...d}=e,c=o.useContext(q),[p,g]=o.useState(null),y=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=o.useState({}),h=I(t,f=>g(f)),O=Array.from(c.layers),[x]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),K=O.indexOf(x),T=p?O.indexOf(p):-1,H=c.layersWithOutsidePointerEventsDisabled.size>0,k=T>=K,X=xe(f=>{const C=f.target,B=[...c.branches].some(j=>j.contains(C));!k||B||(s==null||s(f),l==null||l(f),f.defaultPrevented||a==null||a())},y),W=Ce(f=>{const C=f.target;[...c.branches].some(j=>j.contains(C))||(i==null||i(f),l==null||l(f),f.defaultPrevented||a==null||a())},y);return he(f=>{T===c.layers.size-1&&(r==null||r(f),!f.defaultPrevented&&a&&(f.preventDefault(),a()))},y),o.useEffect(()=>{if(p)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(M=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(p)),c.layers.add(p),N(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=M)}},[p,y,n,c]),o.useEffect(()=>()=>{p&&(c.layers.delete(p),c.layersWithOutsidePointerEventsDisabled.delete(p),N())},[p,c]),o.useEffect(()=>{const f=()=>b({});return document.addEventListener(w,f),()=>document.removeEventListener(w,f)},[]),u.jsx(A.div,{...d,ref:h,style:{pointerEvents:H?k?"auto":"none":void 0,...e.style},onFocusCapture:R(e.onFocusCapture,W.onFocusCapture),onBlurCapture:R(e.onBlurCapture,W.onBlurCapture),onPointerDownCapture:R(e.onPointerDownCapture,X.onPointerDownCapture)})});$.displayName=ve;var Ee="DismissableLayerBranch",be=o.forwardRef((e,t)=>{const n=o.useContext(q),r=o.useRef(null),s=I(t,r);return o.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),u.jsx(A.div,{...e,ref:s})});be.displayName=Ee;function xe(e,t=globalThis==null?void 0:globalThis.document){const n=D(e),r=o.useRef(!1),s=o.useRef(()=>{});return o.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let d=function(){z(me,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=d,t.addEventListener("click",s.current,{once:!0})):d()}else t.removeEventListener("click",s.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",i),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Ce(e,t=globalThis==null?void 0:globalThis.document){const n=D(e),r=o.useRef(!1);return o.useEffect(()=>{const s=i=>{i.target&&!r.current&&z(ge,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function N(){const e=new CustomEvent(w);document.dispatchEvent(e)}function z(e,t,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?fe(s,i):s.dispatchEvent(i)}const Pe=({id:e,layers:t,children:n,...r})=>e===t[t.length-1]?u.jsx($,{...r,children:n}):u.jsx(u.Fragment,{children:n}),U=v.createContext({layers:[],setLayers:()=>{},addLayer:()=>{},removeLayer:()=>{},removeTopLayer:()=>{}}),Le=({children:e})=>{const[t,n]=v.useState([]),r=(l,a={})=>{const{layer:d}=a;if(typeof d=="number")return n(c=>c.length-1<d?[...c,l]:[...c.slice(0,d),l,...c.slice(d)]);n(c=>[...c,l])},s=l=>{n(t.filter(a=>a!==l))},i=()=>{const l=t[t.length-1];l&&s(l)};return u.jsx(U.Provider,{value:{layers:t,setLayers:n,addLayer:r,removeLayer:s,removeTopLayer:i},children:e})},Oe=()=>v.useContext(U),je=({defaultOpen:e,open:t,onOpenChange:n,...r})=>{const[s,i]=re({prop:t,onChange:n,defaultProp:e});if(s)return u.jsx(Re,{open:s,onOpenChange:i,...r})},Re=({open:e,onOpenChange:t,a11yTitle:n,a11yDescription:r,children:s,layer:i,...l})=>{var y,b;const a=v.useId(),d=Oe();v.useEffect(()=>{!d||!e||d.layers.includes(a)||d.addLayer(a,{layer:i})},[a,i,d,e]);const c=((y=d.layers)==null?void 0:y.indexOf(a))||0,p=((b=d.layers)==null?void 0:b.length)||0,g=c!==0;return u.jsx(Pe,{id:a,layers:d.layers,onEscapeKeyDown:h=>{h.preventDefault(),d.removeTopLayer(),t(!1)},onPointerDownOutside:h=>{h.preventDefault(),d.removeTopLayer(),t(!1)},children:u.jsxs(E.Root,{open:e,onOpenChange:h=>{var x;if(((x=d==null?void 0:d.layers)==null?void 0:x.length)>0)return h===!1&&a===d.layers[d.layers.length-1]?(d.removeLayer(a),t(!1)):void 0;t(h)},children:[u.jsxs(te.Root,{children:[u.jsx(E.Title,{children:n}),r&&u.jsx(E.Description,{children:r})]}),u.jsx(P.AnimatePresence,{children:e&&u.jsx(Se,{layer:c,children:u.jsx(m.Stack,{as:P.motion.div,initial:{top:`calc(var(--tgph-spacing-16) + var(--tgph-spacing-4) * ${p-1})`},animate:{top:g?`calc(var(--tgph-spacing-16) + var(--tgph-spacing-4) * ${c} )`:"var(--tgph-spacing-16)"},exit:{top:0},transition:{type:"spring",duration:.3,bounce:0},w:"full",justify:"center",style:{position:"fixed",left:0,maxHeight:"calc(100vh - var(--tgph-spacing-32))",maxWidth:"calc(100vw - var(--tgph-spacing-8))",zIndex:`calc(var(--tgph-zIndex-modal) + ${c})`},children:u.jsx(m.Stack,{direction:"column",as:P.motion.div,animate:{scale:1.02-Math.abs(p-c)*.02,transformOrigin:"center center"},transition:{duration:.2,bounce:0,type:"spring"},maxW:l.maxW??"160",w:l.w??"full",bg:"surface-1",border:"px",rounded:"4",shadow:"3",...l,children:s},`content-${a}`)},`container-${a}`)})})]},a)})},Se=({layer:e,children:t})=>e>0?t:u.jsxs(E.Overlay,{children:[u.jsx(m.Box,{as:P.motion.div,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3,bounce:0,type:"spring"},bg:"alpha-black-6",w:"full",h:"full",zIndex:"overlay",style:{position:"fixed",cursor:"pointer",inset:"0px"}}),t]}),we=v.forwardRef(({children:e,...t},n)=>u.jsx(Z.FocusScope,{trapped:!0,children:u.jsx(E.Content,{ref:n,asChild:!0,...t,children:u.jsx(m.Stack,{direction:"column",h:"full",...t,children:e})})})),De=({size:e="1",variant:t="ghost",...n})=>u.jsx(E.Close,{asChild:!0,children:u.jsx(J.Button,{icon:{icon:Q.Lucide.X,alt:"Close Modal"},variant:t,size:e,...n})}),Te=({children:e,...t})=>u.jsx(m.Stack,{direction:"column",px:"6",py:"4",...t,children:e}),ke=({children:e,...t})=>u.jsx(m.Stack,{direction:"row",justify:"space-between",align:"center",px:"6",py:"4",borderBottom:"px",...t,children:e}),We=({children:e,...t})=>u.jsx(m.Stack,{direction:"row",align:"center",justify:"flex-end",gap:"2",px:"6",py:"4",borderTop:"px",...t,children:e}),V={};Object.assign(V,{Root:je,Content:we,Close:De,Body:Te,Header:ke,Footer:We});exports.Modal=V;exports.ModalStackingProvider=Le;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),Y=require("@radix-ui/react-dialog"),Z=require("@radix-ui/react-focus-scope"),v=require("react"),G=require("@radix-ui/react-visually-hidden"),J=require("@telegraph/button"),Q=require("@telegraph/helpers"),ee=require("@telegraph/icon"),m=require("@telegraph/layout"),P=require("framer-motion"),te=require("react-dom");function L(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 E=L(Y),o=L(v),ne=L(G),re=L(te);function _(e){const t=o.useRef(e);return o.useEffect(()=>{t.current=e}),o.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function se({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,s]=oe({defaultProp:t,onChange:n}),i=e!==void 0,l=i?e:r,a=_(n),d=o.useCallback(c=>{if(i){const g=typeof c=="function"?c(e):c;g!==e&&a(g)}else s(c)},[i,e,s,a]);return[l,d]}function oe({defaultProp:e,onChange:t}){const n=o.useState(e),[r]=n,s=o.useRef(r),i=_(t);return o.useEffect(()=>{s.current!==r&&(i(r),s.current=r)},[r,s,i]),n}function O(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function ie(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function ae(...e){return t=>e.forEach(n=>ie(n,t))}var F=o.forwardRef((e,t)=>{const{children:n,...r}=e,s=o.Children.toArray(n),i=s.find(le);if(i){const l=i.props.children,a=s.map(d=>d===i?o.Children.count(l)>1?o.Children.only(null):o.isValidElement(l)?l.props.children:null:d);return u.jsx(w,{...r,ref:t,children:o.isValidElement(l)?o.cloneElement(l,void 0,a):null})}return u.jsx(w,{...r,ref:t,children:n})});F.displayName="Slot";var w=o.forwardRef((e,t)=>{const{children:n,...r}=e;if(o.isValidElement(n)){const s=de(n);return o.cloneElement(n,{...ue(r,n.props),ref:t?ae(t,s):s})}return o.Children.count(n)>1?o.Children.only(null):null});w.displayName="SlotClone";var ce=({children:e})=>u.jsx(u.Fragment,{children:e});function le(e){return o.isValidElement(e)&&e.type===ce}function ue(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...a)=>{i(...a),s(...a)}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function de(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var fe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],A=fe.reduce((e,t)=>{const n=o.forwardRef((r,s)=>{const{asChild:i,...l}=r,a=i?F:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(a,{...l,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function pe(e,t){e&&re.flushSync(()=>e.dispatchEvent(t))}function ye(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function he(...e){return t=>e.forEach(n=>ye(n,t))}function I(...e){return o.useCallback(he(...e),e)}function D(e){const t=o.useRef(e);return o.useEffect(()=>{t.current=e}),o.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function ve(e,t=globalThis==null?void 0:globalThis.document){const n=D(e);o.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var me="DismissableLayer",S="dismissableLayer.update",ge="dismissableLayer.pointerDownOutside",Ee="dismissableLayer.focusOutside",M,q=o.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),$=o.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:l,onDismiss:a,...d}=e,c=o.useContext(q),[p,g]=o.useState(null),y=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=o.useState({}),h=I(t,f=>g(f)),R=Array.from(c.layers),[x]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),K=R.indexOf(x),T=p?R.indexOf(p):-1,H=c.layersWithOutsidePointerEventsDisabled.size>0,k=T>=K,X=Ce(f=>{const C=f.target,B=[...c.branches].some(j=>j.contains(C));!k||B||(s==null||s(f),l==null||l(f),f.defaultPrevented||a==null||a())},y),W=Pe(f=>{const C=f.target;[...c.branches].some(j=>j.contains(C))||(i==null||i(f),l==null||l(f),f.defaultPrevented||a==null||a())},y);return ve(f=>{T===c.layers.size-1&&(r==null||r(f),!f.defaultPrevented&&a&&(f.preventDefault(),a()))},y),o.useEffect(()=>{if(p)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(M=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(p)),c.layers.add(p),N(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=M)}},[p,y,n,c]),o.useEffect(()=>()=>{p&&(c.layers.delete(p),c.layersWithOutsidePointerEventsDisabled.delete(p),N())},[p,c]),o.useEffect(()=>{const f=()=>b({});return document.addEventListener(S,f),()=>document.removeEventListener(S,f)},[]),u.jsx(A.div,{...d,ref:h,style:{pointerEvents:H?k?"auto":"none":void 0,...e.style},onFocusCapture:O(e.onFocusCapture,W.onFocusCapture),onBlurCapture:O(e.onBlurCapture,W.onBlurCapture),onPointerDownCapture:O(e.onPointerDownCapture,X.onPointerDownCapture)})});$.displayName=me;var be="DismissableLayerBranch",xe=o.forwardRef((e,t)=>{const n=o.useContext(q),r=o.useRef(null),s=I(t,r);return o.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),u.jsx(A.div,{...e,ref:s})});xe.displayName=be;function Ce(e,t=globalThis==null?void 0:globalThis.document){const n=D(e),r=o.useRef(!1),s=o.useRef(()=>{});return o.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let d=function(){z(ge,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=d,t.addEventListener("click",s.current,{once:!0})):d()}else t.removeEventListener("click",s.current);r.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",i),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Pe(e,t=globalThis==null?void 0:globalThis.document){const n=D(e),r=o.useRef(!1);return o.useEffect(()=>{const s=i=>{i.target&&!r.current&&z(Ee,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function N(){const e=new CustomEvent(S);document.dispatchEvent(e)}function z(e,t,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?pe(s,i):s.dispatchEvent(i)}const Le=({id:e,layers:t,children:n,...r})=>e===t[t.length-1]?u.jsx($,{...r,children:n}):u.jsx(u.Fragment,{children:n}),U=v.createContext({layers:[],setLayers:()=>{},addLayer:()=>{},removeLayer:()=>{},removeTopLayer:()=>{}}),Re=({children:e})=>{const[t,n]=v.useState([]),r=(l,a={})=>{const{layer:d}=a;if(typeof d=="number")return n(c=>c.length-1<d?[...c,l]:[...c.slice(0,d),l,...c.slice(d)]);n(c=>[...c,l])},s=l=>{n(t.filter(a=>a!==l))},i=()=>{const l=t[t.length-1];l&&s(l)};return u.jsx(U.Provider,{value:{layers:t,setLayers:n,addLayer:r,removeLayer:s,removeTopLayer:i},children:e})},je=()=>v.useContext(U),Oe=({defaultOpen:e,open:t,onOpenChange:n,...r})=>{const[s,i]=se({prop:t,onChange:n,defaultProp:e});if(s)return u.jsx(we,{open:s,onOpenChange:i,...r})},we=({open:e,onOpenChange:t,a11yTitle:n,a11yDescription:r,children:s,layer:i,...l})=>{var y,b;const a=v.useId(),d=je();v.useEffect(()=>{!d||!e||d.layers.includes(a)||d.addLayer(a,{layer:i})},[a,i,d,e]);const c=((y=d.layers)==null?void 0:y.indexOf(a))||0,p=((b=d.layers)==null?void 0:b.length)||0,g=c!==0;return u.jsx(Le,{id:a,layers:d.layers,onEscapeKeyDown:h=>{h.preventDefault(),d.removeTopLayer(),t(!1)},onPointerDownOutside:h=>{h.preventDefault(),d.removeTopLayer(),t(!1)},children:u.jsxs(E.Root,{open:e,onOpenChange:h=>{var x;if(((x=d==null?void 0:d.layers)==null?void 0:x.length)>0)return h===!1&&a===d.layers[d.layers.length-1]?(d.removeLayer(a),t(!1)):void 0;t(h)},children:[u.jsxs(ne.Root,{children:[u.jsx(E.Title,{children:n}),r&&u.jsx(E.Description,{children:r})]}),u.jsx(P.AnimatePresence,{children:e&&u.jsx(Se,{layer:c,children:u.jsx(m.Stack,{as:P.motion.div,initial:{top:`calc(var(--tgph-spacing-16) + var(--tgph-spacing-4) * ${p-1})`},animate:{top:g?`calc(var(--tgph-spacing-16) + var(--tgph-spacing-4) * ${c} )`:"var(--tgph-spacing-16)"},exit:{top:0},transition:{type:"spring",duration:.3,bounce:0},w:"full",justify:"center",style:{position:"fixed",left:0,maxHeight:"calc(100vh - var(--tgph-spacing-32))",maxWidth:"calc(100vw - var(--tgph-spacing-8))",zIndex:`calc(var(--tgph-zIndex-modal) + ${c})`},children:u.jsx(m.Stack,{direction:"column",as:P.motion.div,animate:{scale:1.02-Math.abs(p-c)*.02,transformOrigin:"center center"},transition:{duration:.2,bounce:0,type:"spring"},maxW:l.maxW??"160",w:l.w??"full",bg:"surface-1",border:"px",rounded:"4",shadow:"3",...l,children:s},`content-${a}`)},`container-${a}`)})})]},a)})},Se=({layer:e,children:t})=>e>0?t:u.jsxs(E.Overlay,{children:[u.jsx(m.Box,{as:P.motion.div,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3,bounce:0,type:"spring"},bg:"alpha-black-6",w:"full",h:"full",zIndex:"overlay",style:{position:"fixed",cursor:"pointer",inset:"0px"}}),t]}),De=v.forwardRef(({children:e,...t},n)=>u.jsx(Z.FocusScope,{trapped:!0,asChild:!0,children:u.jsx(Q.RefToTgphRef,{children:u.jsx(E.Content,{ref:n,asChild:!0,...t,children:u.jsx(m.Stack,{direction:"column",h:"full",...t,children:e})})})})),Te=({size:e="1",variant:t="ghost",...n})=>u.jsx(E.Close,{asChild:!0,children:u.jsx(J.Button,{icon:{icon:ee.Lucide.X,alt:"Close Modal"},variant:t,size:e,...n})}),ke=({style:e,children:t,...n})=>u.jsx(m.Stack,{direction:"column",px:"6",py:"4",style:{overflowY:"auto",...e},...n,children:t}),We=({children:e,...t})=>u.jsx(m.Stack,{direction:"row",justify:"space-between",align:"center",px:"6",py:"4",borderBottom:"px",...t,children:e}),Be=({children:e,...t})=>u.jsx(m.Stack,{direction:"row",align:"center",justify:"flex-end",gap:"2",px:"6",py:"4",borderTop:"px",...t,children:e}),V={};Object.assign(V,{Root:Oe,Content:De,Close:Te,Body:ke,Header:We,Footer:Be});exports.Modal=V;exports.ModalStackingProvider=Re;
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../node_modules/@radix-ui/react-use-controllable-state/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs","../../../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/primitive/dist/index.mjs","../../../../node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.mjs","../../../../node_modules/@radix-ui/react-slot/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-primitive/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-compose-refs/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs","../../src/Modal/Modal.helpers.tsx","../../src/Modal/ModalStacking.tsx","../../src/Modal/Modal.tsx"],"sourcesContent":["// packages/react/use-callback-ref/src/useCallbackRef.tsx\nimport * as React from \"react\";\nfunction useCallbackRef(callback) {\n const callbackRef = React.useRef(callback);\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);\n}\nexport {\n useCallbackRef\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/use-controllable-state/src/useControllableState.tsx\nimport * as React from \"react\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nfunction useControllableState({\n prop,\n defaultProp,\n onChange = () => {\n }\n}) {\n const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });\n const isControlled = prop !== void 0;\n const value = isControlled ? prop : uncontrolledProp;\n const handleChange = useCallbackRef(onChange);\n const setValue = React.useCallback(\n (nextValue) => {\n if (isControlled) {\n const setter = nextValue;\n const value2 = typeof nextValue === \"function\" ? setter(prop) : nextValue;\n if (value2 !== prop) handleChange(value2);\n } else {\n setUncontrolledProp(nextValue);\n }\n },\n [isControlled, prop, setUncontrolledProp, handleChange]\n );\n return [value, setValue];\n}\nfunction useUncontrolledState({\n defaultProp,\n onChange\n}) {\n const uncontrolledState = React.useState(defaultProp);\n const [value] = uncontrolledState;\n const prevValueRef = React.useRef(value);\n const handleChange = useCallbackRef(onChange);\n React.useEffect(() => {\n if (prevValueRef.current !== value) {\n handleChange(value);\n prevValueRef.current = value;\n }\n }, [value, prevValueRef, handleChange]);\n return uncontrolledState;\n}\nexport {\n useControllableState\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/core/primitive/src/primitive.tsx\nfunction composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {\n return function handleEvent(event) {\n originalEventHandler?.(event);\n if (checkForDefaultPrevented === false || !event.defaultPrevented) {\n return ourEventHandler?.(event);\n }\n };\n}\nexport {\n composeEventHandlers\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/compose-refs/src/composeRefs.tsx\nimport * as React from \"react\";\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null && ref !== void 0) {\n ref.current = value;\n }\n}\nfunction composeRefs(...refs) {\n return (node) => refs.forEach((ref) => setRef(ref, node));\n}\nfunction useComposedRefs(...refs) {\n return React.useCallback(composeRefs(...refs), refs);\n}\nexport {\n composeRefs,\n useComposedRefs\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/slot/src/Slot.tsx\nimport * as React from \"react\";\nimport { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { Fragment, jsx } from \"react/jsx-runtime\";\nvar Slot = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n if (slottable) {\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement) ? newElement.props.children : null;\n } else {\n return child;\n }\n });\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });\n }\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });\n});\nSlot.displayName = \"Slot\";\nvar SlotClone = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n return React.cloneElement(children, {\n ...mergeProps(slotProps, children.props),\n // @ts-ignore\n ref: forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef\n });\n }\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n});\nSlotClone.displayName = \"SlotClone\";\nvar Slottable = ({ children }) => {\n return /* @__PURE__ */ jsx(Fragment, { children });\n};\nfunction isSlottable(child) {\n return React.isValidElement(child) && child.type === Slottable;\n}\nfunction mergeProps(slotProps, childProps) {\n const overrideProps = { ...childProps };\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args) => {\n childPropValue(...args);\n slotPropValue(...args);\n };\n } else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n } else if (propName === \"style\") {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === \"className\") {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(\" \");\n }\n }\n return { ...slotProps, ...overrideProps };\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nvar Root = Slot;\nexport {\n Root,\n Slot,\n Slottable\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/primitive/src/Primitive.tsx\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nvar NODES = [\n \"a\",\n \"button\",\n \"div\",\n \"form\",\n \"h2\",\n \"h3\",\n \"img\",\n \"input\",\n \"label\",\n \"li\",\n \"nav\",\n \"ol\",\n \"p\",\n \"span\",\n \"svg\",\n \"ul\"\n];\nvar Primitive = NODES.reduce((primitive, node) => {\n const Node = React.forwardRef((props, forwardedRef) => {\n const { asChild, ...primitiveProps } = props;\n const Comp = asChild ? Slot : node;\n if (typeof window !== \"undefined\") {\n window[Symbol.for(\"radix-ui\")] = true;\n }\n return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });\n });\n Node.displayName = `Primitive.${node}`;\n return { ...primitive, [node]: Node };\n}, {});\nfunction dispatchDiscreteCustomEvent(target, event) {\n if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));\n}\nvar Root = Primitive;\nexport {\n Primitive,\n Root,\n dispatchDiscreteCustomEvent\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/compose-refs/src/composeRefs.tsx\nimport * as React from \"react\";\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null && ref !== void 0) {\n ref.current = value;\n }\n}\nfunction composeRefs(...refs) {\n return (node) => refs.forEach((ref) => setRef(ref, node));\n}\nfunction useComposedRefs(...refs) {\n return React.useCallback(composeRefs(...refs), refs);\n}\nexport {\n composeRefs,\n useComposedRefs\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/use-callback-ref/src/useCallbackRef.tsx\nimport * as React from \"react\";\nfunction useCallbackRef(callback) {\n const callbackRef = React.useRef(callback);\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);\n}\nexport {\n useCallbackRef\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/use-escape-keydown/src/useEscapeKeydown.tsx\nimport * as React from \"react\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nfunction useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {\n const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);\n React.useEffect(() => {\n const handleKeyDown = (event) => {\n if (event.key === \"Escape\") {\n onEscapeKeyDown(event);\n }\n };\n ownerDocument.addEventListener(\"keydown\", handleKeyDown, { capture: true });\n return () => ownerDocument.removeEventListener(\"keydown\", handleKeyDown, { capture: true });\n }, [onEscapeKeyDown, ownerDocument]);\n}\nexport {\n useEscapeKeydown\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// packages/react/dismissable-layer/src/DismissableLayer.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { Primitive, dispatchDiscreteCustomEvent } from \"@radix-ui/react-primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useEscapeKeydown } from \"@radix-ui/react-use-escape-keydown\";\nimport { jsx } from \"react/jsx-runtime\";\nvar DISMISSABLE_LAYER_NAME = \"DismissableLayer\";\nvar CONTEXT_UPDATE = \"dismissableLayer.update\";\nvar POINTER_DOWN_OUTSIDE = \"dismissableLayer.pointerDownOutside\";\nvar FOCUS_OUTSIDE = \"dismissableLayer.focusOutside\";\nvar originalBodyPointerEvents;\nvar DismissableLayerContext = React.createContext({\n layers: /* @__PURE__ */ new Set(),\n layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),\n branches: /* @__PURE__ */ new Set()\n});\nvar DismissableLayer = React.forwardRef(\n (props, forwardedRef) => {\n const {\n disableOutsidePointerEvents = false,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n ...layerProps\n } = props;\n const context = React.useContext(DismissableLayerContext);\n const [node, setNode] = React.useState(null);\n const ownerDocument = node?.ownerDocument ?? globalThis?.document;\n const [, force] = React.useState({});\n const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));\n const layers = Array.from(context.layers);\n const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);\n const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);\n const index = node ? layers.indexOf(node) : -1;\n const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;\n const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;\n const pointerDownOutside = usePointerDownOutside((event) => {\n const target = event.target;\n const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));\n if (!isPointerEventsEnabled || isPointerDownOnBranch) return;\n onPointerDownOutside?.(event);\n onInteractOutside?.(event);\n if (!event.defaultPrevented) onDismiss?.();\n }, ownerDocument);\n const focusOutside = useFocusOutside((event) => {\n const target = event.target;\n const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));\n if (isFocusInBranch) return;\n onFocusOutside?.(event);\n onInteractOutside?.(event);\n if (!event.defaultPrevented) onDismiss?.();\n }, ownerDocument);\n useEscapeKeydown((event) => {\n const isHighestLayer = index === context.layers.size - 1;\n if (!isHighestLayer) return;\n onEscapeKeyDown?.(event);\n if (!event.defaultPrevented && onDismiss) {\n event.preventDefault();\n onDismiss();\n }\n }, ownerDocument);\n React.useEffect(() => {\n if (!node) return;\n if (disableOutsidePointerEvents) {\n if (context.layersWithOutsidePointerEventsDisabled.size === 0) {\n originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;\n ownerDocument.body.style.pointerEvents = \"none\";\n }\n context.layersWithOutsidePointerEventsDisabled.add(node);\n }\n context.layers.add(node);\n dispatchUpdate();\n return () => {\n if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {\n ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;\n }\n };\n }, [node, ownerDocument, disableOutsidePointerEvents, context]);\n React.useEffect(() => {\n return () => {\n if (!node) return;\n context.layers.delete(node);\n context.layersWithOutsidePointerEventsDisabled.delete(node);\n dispatchUpdate();\n };\n }, [node, context]);\n React.useEffect(() => {\n const handleUpdate = () => force({});\n document.addEventListener(CONTEXT_UPDATE, handleUpdate);\n return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);\n }, []);\n return /* @__PURE__ */ jsx(\n Primitive.div,\n {\n ...layerProps,\n ref: composedRefs,\n style: {\n pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? \"auto\" : \"none\" : void 0,\n ...props.style\n },\n onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),\n onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),\n onPointerDownCapture: composeEventHandlers(\n props.onPointerDownCapture,\n pointerDownOutside.onPointerDownCapture\n )\n }\n );\n }\n);\nDismissableLayer.displayName = DISMISSABLE_LAYER_NAME;\nvar BRANCH_NAME = \"DismissableLayerBranch\";\nvar DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {\n const context = React.useContext(DismissableLayerContext);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n React.useEffect(() => {\n const node = ref.current;\n if (node) {\n context.branches.add(node);\n return () => {\n context.branches.delete(node);\n };\n }\n }, [context.branches]);\n return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });\n});\nDismissableLayerBranch.displayName = BRANCH_NAME;\nfunction usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {\n const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);\n const isPointerInsideReactTreeRef = React.useRef(false);\n const handleClickRef = React.useRef(() => {\n });\n React.useEffect(() => {\n const handlePointerDown = (event) => {\n if (event.target && !isPointerInsideReactTreeRef.current) {\n let handleAndDispatchPointerDownOutsideEvent2 = function() {\n handleAndDispatchCustomEvent(\n POINTER_DOWN_OUTSIDE,\n handlePointerDownOutside,\n eventDetail,\n { discrete: true }\n );\n };\n var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;\n const eventDetail = { originalEvent: event };\n if (event.pointerType === \"touch\") {\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;\n ownerDocument.addEventListener(\"click\", handleClickRef.current, { once: true });\n } else {\n handleAndDispatchPointerDownOutsideEvent2();\n }\n } else {\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n }\n isPointerInsideReactTreeRef.current = false;\n };\n const timerId = window.setTimeout(() => {\n ownerDocument.addEventListener(\"pointerdown\", handlePointerDown);\n }, 0);\n return () => {\n window.clearTimeout(timerId);\n ownerDocument.removeEventListener(\"pointerdown\", handlePointerDown);\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n };\n }, [ownerDocument, handlePointerDownOutside]);\n return {\n // ensures we check React component tree (not just DOM tree)\n onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true\n };\n}\nfunction useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {\n const handleFocusOutside = useCallbackRef(onFocusOutside);\n const isFocusInsideReactTreeRef = React.useRef(false);\n React.useEffect(() => {\n const handleFocus = (event) => {\n if (event.target && !isFocusInsideReactTreeRef.current) {\n const eventDetail = { originalEvent: event };\n handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {\n discrete: false\n });\n }\n };\n ownerDocument.addEventListener(\"focusin\", handleFocus);\n return () => ownerDocument.removeEventListener(\"focusin\", handleFocus);\n }, [ownerDocument, handleFocusOutside]);\n return {\n onFocusCapture: () => isFocusInsideReactTreeRef.current = true,\n onBlurCapture: () => isFocusInsideReactTreeRef.current = false\n };\n}\nfunction dispatchUpdate() {\n const event = new CustomEvent(CONTEXT_UPDATE);\n document.dispatchEvent(event);\n}\nfunction handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {\n const target = detail.originalEvent.target;\n const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });\n if (handler) target.addEventListener(name, handler, { once: true });\n if (discrete) {\n dispatchDiscreteCustomEvent(target, event);\n } else {\n target.dispatchEvent(event);\n }\n}\nvar Root = DismissableLayer;\nvar Branch = DismissableLayerBranch;\nexport {\n Branch,\n DismissableLayer,\n DismissableLayerBranch,\n Root\n};\n//# sourceMappingURL=index.mjs.map\n","import {\n DismissableLayer,\n type DismissableLayerProps,\n} from \"@radix-ui/react-dismissable-layer\";\n\ntype DismissableWrapperProps = DismissableLayerProps & {\n id: string;\n layers: Array<string>;\n children: React.ReactNode;\n};\n\n//\n// Handles the logic for when a global action like \"esc\" or clicking outside\n// should close the modal. When stacking modals, we don't want to close the\n// modal if we are not on the top-most layer.\n//\nconst DismissableWrapper = ({\n id,\n layers,\n children,\n ...props\n}: DismissableWrapperProps) => {\n const isTopLayer = id === layers[layers.length - 1];\n\n if (isTopLayer) {\n return <DismissableLayer {...props}>{children}</DismissableLayer>;\n }\n\n return <>{children}</>;\n};\n\nexport { DismissableWrapper };\n","import React from \"react\";\n\ntype AddLayerOptions = {\n layer?: number;\n};\n\nconst ModalStackingContext = React.createContext<{\n layers: Array<string>;\n setLayers: React.Dispatch<React.SetStateAction<Array<string>>>;\n addLayer: (id: string, options: AddLayerOptions) => void;\n removeLayer: (id: string) => void;\n removeTopLayer: () => void;\n}>({\n layers: [],\n setLayers: () => {},\n addLayer: () => {},\n removeLayer: () => {},\n removeTopLayer: () => {},\n});\n\ntype ModalStackingProviderProps = {\n children: React.ReactNode;\n};\n\nconst ModalStackingProvider = ({ children }: ModalStackingProviderProps) => {\n const [layers, setLayers] = React.useState<Array<string>>([]);\n\n const addLayer = (id: string, options: AddLayerOptions = {}) => {\n const { layer } = options;\n\n // If a layer is specified, insert the layer at the specified index\n // so that the modal renders at the correct layer in the stack.\n if (typeof layer === \"number\") {\n return setLayers((current) => {\n if (current.length - 1 < layer) {\n return [...current, id];\n }\n\n return [...current.slice(0, layer), id, ...current.slice(layer)];\n });\n } else {\n setLayers((current) => [...current, id]);\n }\n };\n\n const removeLayer = (id: string) => {\n setLayers(layers.filter((layer) => layer !== id));\n };\n\n const removeTopLayer = () => {\n const id = layers[layers.length - 1];\n if (!id) return;\n removeLayer(id);\n };\n\n return (\n <ModalStackingContext.Provider\n value={{ layers, setLayers, addLayer, removeLayer, removeTopLayer }}\n >\n {children}\n </ModalStackingContext.Provider>\n );\n};\n\nconst useModalStacking = () => {\n return React.useContext(ModalStackingContext);\n};\n\nexport { ModalStackingProvider, useModalStacking };\n","import * as Dialog from \"@radix-ui/react-dialog\";\nimport { FocusScope } from \"@radix-ui/react-focus-scope\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport * as VisuallyHidden from \"@radix-ui/react-visually-hidden\";\nimport { Button } from \"@telegraph/button\";\nimport type { Required } from \"@telegraph/helpers\";\nimport type {\n PolymorphicProps,\n TgphComponentProps,\n TgphElement,\n} from \"@telegraph/helpers\";\nimport { Lucide } from \"@telegraph/icon\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport React from \"react\";\n\nimport { DismissableWrapper } from \"./Modal.helpers\";\nimport { useModalStacking } from \"./ModalStacking\";\n\ntype RootProps = Omit<\n React.ComponentPropsWithoutRef<typeof Dialog.Root>,\n \"modal\"\n> &\n TgphComponentProps<typeof Stack> & {\n a11yTitle: string;\n a11yDescription?: string;\n layer?: number;\n };\n\nconst Root = ({\n defaultOpen: defaultOpenProp,\n open: openProp,\n onOpenChange: onOpenChangeProp,\n ...props\n}: RootProps) => {\n const [open, onOpenChange] = useControllableState({\n prop: openProp,\n onChange: onOpenChangeProp,\n defaultProp: defaultOpenProp,\n });\n\n // Prevent rendering anything within the modal if it is not open\n if (!open) return;\n\n return <RootComponent open={open} onOpenChange={onOpenChange} {...props} />;\n};\n\nconst RootComponent = ({\n open,\n onOpenChange,\n a11yTitle,\n a11yDescription,\n children,\n layer: layerProp,\n ...props\n}: Required<RootProps, \"open\" | \"onOpenChange\">) => {\n const id = React.useId();\n const stacking = useModalStacking();\n\n React.useEffect(() => {\n if (!stacking || !open || stacking.layers.includes(id)) return;\n stacking.addLayer(id, { layer: layerProp });\n }, [id, layerProp, stacking, open]);\n\n const layer = stacking.layers?.indexOf(id) || 0;\n const layersLength = stacking.layers?.length || 0;\n const isStacked = layer !== 0;\n\n return (\n <DismissableWrapper\n id={id}\n layers={stacking.layers}\n onEscapeKeyDown={(event) => {\n event.preventDefault();\n stacking.removeTopLayer();\n onOpenChange(false);\n }}\n onPointerDownOutside={(event) => {\n event.preventDefault();\n stacking.removeTopLayer();\n onOpenChange(false);\n }}\n >\n <Dialog.Root\n open={open}\n onOpenChange={(value) => {\n const hasLayers = stacking?.layers?.length > 0;\n\n if (hasLayers) {\n if (\n value === false &&\n id === stacking.layers[stacking.layers.length - 1]\n ) {\n stacking.removeLayer(id);\n return onOpenChange(false);\n }\n // If the modal is not the top layer, do not call onOpenChange\n // when we are stacking the modals\n return;\n }\n\n onOpenChange(value);\n }}\n key={id}\n >\n <VisuallyHidden.Root>\n <Dialog.Title>{a11yTitle}</Dialog.Title>\n {a11yDescription && (\n <Dialog.Description>{a11yDescription}</Dialog.Description>\n )}\n </VisuallyHidden.Root>\n <AnimatePresence>\n {open && (\n <Overlay layer={layer}>\n <Stack\n as={motion.div}\n initial={{\n top: `calc(var(--tgph-spacing-16) + var(--tgph-spacing-4) * ${layersLength - 1})`,\n }}\n animate={{\n top: isStacked\n ? `calc(var(--tgph-spacing-16) + var(--tgph-spacing-4) * ${layer} )`\n : \"var(--tgph-spacing-16)\",\n }}\n exit={{ top: 0 }}\n transition={{ type: \"spring\", duration: 0.3, bounce: 0 }}\n w=\"full\"\n justify=\"center\"\n style={{\n position: \"fixed\",\n left: 0,\n maxHeight: \"calc(100vh - var(--tgph-spacing-32))\",\n maxWidth: \"calc(100vw - var(--tgph-spacing-8))\",\n zIndex: `calc(var(--tgph-zIndex-modal) + ${layer})`,\n }}\n key={`container-${id}`}\n >\n <Stack\n direction=\"column\"\n as={motion.div}\n animate={{\n scale: 1.02 - Math.abs(layersLength - layer) * 0.02,\n transformOrigin: \"center center\",\n }}\n transition={{ duration: 0.2, bounce: 0, type: \"spring\" }}\n maxW={props.maxW ?? \"160\"}\n w={props.w ?? \"full\"}\n bg=\"surface-1\"\n border=\"px\"\n rounded=\"4\"\n shadow=\"3\"\n key={`content-${id}`}\n {...props}\n >\n {children}\n </Stack>\n </Stack>\n </Overlay>\n )}\n </AnimatePresence>\n </Dialog.Root>\n </DismissableWrapper>\n );\n};\n\ntype OverlayProps = TgphComponentProps<typeof Box> & {\n layer: number;\n};\n\nconst Overlay = ({ layer, children }: OverlayProps) => {\n // If the layer is greater than 0, we don't want to show this\n // overlay as to not stack the overlays on top of each other.\n if (layer > 0) return children;\n return (\n <Dialog.Overlay>\n <Box\n as={motion.div}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.3, bounce: 0, type: \"spring\" }}\n bg=\"alpha-black-6\"\n w=\"full\"\n h=\"full\"\n zIndex=\"overlay\"\n style={{\n position: \"fixed\",\n cursor: \"pointer\",\n inset: \"0px\",\n }}\n />\n {children}\n </Dialog.Overlay>\n );\n};\n\ntype ContentProps = React.ComponentPropsWithoutRef<typeof Dialog.Content> &\n TgphComponentProps<typeof Stack>;\ntype ContentRef = React.ElementRef<typeof Dialog.Content>;\n\nconst Content = React.forwardRef<ContentRef, ContentProps>(\n ({ children, ...props }, forwardedRef) => {\n return (\n <FocusScope trapped={true}>\n <Dialog.Content ref={forwardedRef} asChild {...props}>\n <Stack direction=\"column\" h=\"full\" {...props}>\n {children}\n </Stack>\n </Dialog.Content>\n </FocusScope>\n );\n },\n);\n\ntype CloseProps<T extends TgphElement> = TgphComponentProps<typeof Button<T>> &\n Omit<React.ComponentPropsWithoutRef<typeof Dialog.Close>, \"color\">;\nconst Close = <T extends TgphElement>({\n size = \"1\",\n variant = \"ghost\",\n ...props\n}: CloseProps<T>) => {\n return (\n <Dialog.Close asChild>\n <Button\n icon={{ icon: Lucide.X, alt: \"Close Modal\" }}\n variant={variant}\n size={size}\n {...props}\n />\n </Dialog.Close>\n );\n};\n\ntype BodyProps<T extends TgphElement> = PolymorphicProps<T> &\n TgphComponentProps<typeof Stack>;\n\nconst Body = <T extends TgphElement>({ children, ...props }: BodyProps<T>) => {\n return (\n <Stack direction=\"column\" px=\"6\" py=\"4\" {...props}>\n {children}\n </Stack>\n );\n};\n\ntype HeaderProps<T extends TgphElement> = PolymorphicProps<T> &\n TgphComponentProps<typeof Stack>;\n\nconst Header = <T extends TgphElement>({\n children,\n ...props\n}: HeaderProps<T>) => {\n return (\n <Stack\n direction=\"row\"\n justify=\"space-between\"\n align=\"center\"\n px=\"6\"\n py=\"4\"\n borderBottom=\"px\"\n {...props}\n >\n {children}\n </Stack>\n );\n};\n\ntype FooterProps<T extends TgphElement> = PolymorphicProps<T> &\n TgphComponentProps<typeof Stack>;\n\nconst Footer = <T extends TgphElement>({\n children,\n ...props\n}: FooterProps<T>) => {\n return (\n <Stack\n direction=\"row\"\n align=\"center\"\n justify=\"flex-end\"\n gap=\"2\"\n px=\"6\"\n py=\"4\"\n borderTop=\"px\"\n {...props}\n >\n {children}\n </Stack>\n );\n};\n\nconst Modal = {} as {\n Root: typeof Root;\n Content: typeof Content;\n Close: typeof Close;\n Body: typeof Body;\n Header: typeof Header;\n Footer: typeof Footer;\n};\n\nObject.assign(Modal, {\n Root,\n Content,\n Close,\n Body,\n Header,\n Footer,\n});\n\nexport { Modal };\n"],"names":["useCallbackRef","callback","callbackRef","React","args","_a","useControllableState","prop","defaultProp","onChange","uncontrolledProp","setUncontrolledProp","useUncontrolledState","isControlled","value","handleChange","setValue","nextValue","value2","uncontrolledState","prevValueRef","composeEventHandlers","originalEventHandler","ourEventHandler","checkForDefaultPrevented","event","setRef","ref","composeRefs","refs","node","Slot","props","forwardedRef","children","slotProps","childrenArray","slottable","isSlottable","newElement","newChildren","child","jsx","SlotClone","childrenRef","getElementRef","mergeProps","Slottable","Fragment","childProps","overrideProps","propName","slotPropValue","childPropValue","element","getter","mayWarn","_b","NODES","Primitive","primitive","Node","asChild","primitiveProps","Comp","dispatchDiscreteCustomEvent","target","ReactDOM","useComposedRefs","useEscapeKeydown","onEscapeKeyDownProp","ownerDocument","onEscapeKeyDown","handleKeyDown","DISMISSABLE_LAYER_NAME","CONTEXT_UPDATE","POINTER_DOWN_OUTSIDE","FOCUS_OUTSIDE","originalBodyPointerEvents","DismissableLayerContext","DismissableLayer","disableOutsidePointerEvents","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","layerProps","context","setNode","force","composedRefs","node2","layers","highestLayerWithOutsidePointerEventsDisabled","highestLayerWithOutsidePointerEventsDisabledIndex","index","isBodyPointerEventsDisabled","isPointerEventsEnabled","pointerDownOutside","usePointerDownOutside","isPointerDownOnBranch","branch","focusOutside","useFocusOutside","dispatchUpdate","handleUpdate","BRANCH_NAME","DismissableLayerBranch","handlePointerDownOutside","isPointerInsideReactTreeRef","handleClickRef","handlePointerDown","handleAndDispatchPointerDownOutsideEvent2","handleAndDispatchCustomEvent","eventDetail","timerId","handleFocusOutside","isFocusInsideReactTreeRef","handleFocus","name","handler","detail","discrete","DismissableWrapper","id","ModalStackingContext","ModalStackingProvider","setLayers","addLayer","options","layer","current","removeLayer","removeTopLayer","useModalStacking","Root","defaultOpenProp","openProp","onOpenChangeProp","open","onOpenChange","RootComponent","a11yTitle","a11yDescription","layerProp","stacking","layersLength","isStacked","jsxs","Dialog","VisuallyHidden","AnimatePresence","Overlay","Stack","motion","Box","Content","FocusScope","Close","size","variant","Button","Lucide","Body","Header","Footer","Modal"],"mappings":"ksBA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GAAE,GAAGD,EAC7C,SAAAU,EAAA,IAAC+G,EAAM,MAAA,CAAA,UAAU,SAAS,EAAE,OAAQ,GAAGzH,EACpC,SAAAE,CACH,CAAA,CACF,CAAA,CACF,CAAA,CAGN,EAIM4H,GAAQ,CAAwB,CACpC,KAAAC,EAAO,IACP,QAAAC,EAAU,QACV,GAAGhI,CACL,IAEKU,EAAAA,IAAA2G,EAAO,MAAP,CAAa,QAAO,GACnB,SAAA3G,EAAA,IAACuH,EAAA,OAAA,CACC,KAAM,CAAE,KAAMC,EAAAA,OAAO,EAAG,IAAK,aAAc,EAC3C,QAAAF,EACA,KAAAD,EACC,GAAG/H,CAAA,CAER,CAAA,CAAA,EAOEmI,GAAO,CAAwB,CAAE,SAAAjI,EAAU,GAAGF,KAEhDU,EAAA,IAAC+G,EAAM,MAAA,CAAA,UAAU,SAAS,GAAG,IAAI,GAAG,IAAK,GAAGzH,EACzC,SAAAE,CACH,CAAA,EAOEkI,GAAS,CAAwB,CACrC,SAAAlI,EACA,GAAGF,CACL,IAEIU,EAAA,IAAC+G,EAAA,MAAA,CACC,UAAU,MACV,QAAQ,gBACR,MAAM,SACN,GAAG,IACH,GAAG,IACH,aAAa,KACZ,GAAGzH,EAEH,SAAAE,CAAA,CAAA,EAQDmI,GAAS,CAAwB,CACrC,SAAAnI,EACA,GAAGF,CACL,IAEIU,EAAA,IAAC+G,EAAA,MAAA,CACC,UAAU,MACV,MAAM,SACN,QAAQ,WACR,IAAI,IACJ,GAAG,IACH,GAAG,IACH,UAAU,KACT,GAAGzH,EAEH,SAAAE,CAAA,CAAA,EAKDoI,EAAQ,CAAC,EASf,OAAO,OAAOA,EAAO,CACnB,KAAA/B,GACA,QAAAqB,GACA,MAAAE,GACA,KAAAK,GACA,OAAAC,GACA,OAAAC,EACF,CAAC","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9]}
1
+ {"version":3,"file":"index.js","sources":["../../../../node_modules/@radix-ui/react-use-controllable-state/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs","../../../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/primitive/dist/index.mjs","../../../../node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.mjs","../../../../node_modules/@radix-ui/react-slot/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-primitive/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-compose-refs/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs","../../src/Modal/Modal.helpers.tsx","../../src/Modal/ModalStacking.tsx","../../src/Modal/Modal.tsx"],"sourcesContent":["// packages/react/use-callback-ref/src/useCallbackRef.tsx\nimport * as React from \"react\";\nfunction useCallbackRef(callback) {\n const callbackRef = React.useRef(callback);\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);\n}\nexport {\n useCallbackRef\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/use-controllable-state/src/useControllableState.tsx\nimport * as React from \"react\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nfunction useControllableState({\n prop,\n defaultProp,\n onChange = () => {\n }\n}) {\n const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });\n const isControlled = prop !== void 0;\n const value = isControlled ? prop : uncontrolledProp;\n const handleChange = useCallbackRef(onChange);\n const setValue = React.useCallback(\n (nextValue) => {\n if (isControlled) {\n const setter = nextValue;\n const value2 = typeof nextValue === \"function\" ? setter(prop) : nextValue;\n if (value2 !== prop) handleChange(value2);\n } else {\n setUncontrolledProp(nextValue);\n }\n },\n [isControlled, prop, setUncontrolledProp, handleChange]\n );\n return [value, setValue];\n}\nfunction useUncontrolledState({\n defaultProp,\n onChange\n}) {\n const uncontrolledState = React.useState(defaultProp);\n const [value] = uncontrolledState;\n const prevValueRef = React.useRef(value);\n const handleChange = useCallbackRef(onChange);\n React.useEffect(() => {\n if (prevValueRef.current !== value) {\n handleChange(value);\n prevValueRef.current = value;\n }\n }, [value, prevValueRef, handleChange]);\n return uncontrolledState;\n}\nexport {\n useControllableState\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/core/primitive/src/primitive.tsx\nfunction composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {\n return function handleEvent(event) {\n originalEventHandler?.(event);\n if (checkForDefaultPrevented === false || !event.defaultPrevented) {\n return ourEventHandler?.(event);\n }\n };\n}\nexport {\n composeEventHandlers\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/compose-refs/src/composeRefs.tsx\nimport * as React from \"react\";\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null && ref !== void 0) {\n ref.current = value;\n }\n}\nfunction composeRefs(...refs) {\n return (node) => refs.forEach((ref) => setRef(ref, node));\n}\nfunction useComposedRefs(...refs) {\n return React.useCallback(composeRefs(...refs), refs);\n}\nexport {\n composeRefs,\n useComposedRefs\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/slot/src/Slot.tsx\nimport * as React from \"react\";\nimport { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { Fragment, jsx } from \"react/jsx-runtime\";\nvar Slot = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n if (slottable) {\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement) ? newElement.props.children : null;\n } else {\n return child;\n }\n });\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });\n }\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });\n});\nSlot.displayName = \"Slot\";\nvar SlotClone = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n return React.cloneElement(children, {\n ...mergeProps(slotProps, children.props),\n // @ts-ignore\n ref: forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef\n });\n }\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n});\nSlotClone.displayName = \"SlotClone\";\nvar Slottable = ({ children }) => {\n return /* @__PURE__ */ jsx(Fragment, { children });\n};\nfunction isSlottable(child) {\n return React.isValidElement(child) && child.type === Slottable;\n}\nfunction mergeProps(slotProps, childProps) {\n const overrideProps = { ...childProps };\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args) => {\n childPropValue(...args);\n slotPropValue(...args);\n };\n } else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n } else if (propName === \"style\") {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === \"className\") {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(\" \");\n }\n }\n return { ...slotProps, ...overrideProps };\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nvar Root = Slot;\nexport {\n Root,\n Slot,\n Slottable\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/primitive/src/Primitive.tsx\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nvar NODES = [\n \"a\",\n \"button\",\n \"div\",\n \"form\",\n \"h2\",\n \"h3\",\n \"img\",\n \"input\",\n \"label\",\n \"li\",\n \"nav\",\n \"ol\",\n \"p\",\n \"span\",\n \"svg\",\n \"ul\"\n];\nvar Primitive = NODES.reduce((primitive, node) => {\n const Node = React.forwardRef((props, forwardedRef) => {\n const { asChild, ...primitiveProps } = props;\n const Comp = asChild ? Slot : node;\n if (typeof window !== \"undefined\") {\n window[Symbol.for(\"radix-ui\")] = true;\n }\n return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });\n });\n Node.displayName = `Primitive.${node}`;\n return { ...primitive, [node]: Node };\n}, {});\nfunction dispatchDiscreteCustomEvent(target, event) {\n if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));\n}\nvar Root = Primitive;\nexport {\n Primitive,\n Root,\n dispatchDiscreteCustomEvent\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/compose-refs/src/composeRefs.tsx\nimport * as React from \"react\";\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null && ref !== void 0) {\n ref.current = value;\n }\n}\nfunction composeRefs(...refs) {\n return (node) => refs.forEach((ref) => setRef(ref, node));\n}\nfunction useComposedRefs(...refs) {\n return React.useCallback(composeRefs(...refs), refs);\n}\nexport {\n composeRefs,\n useComposedRefs\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/use-callback-ref/src/useCallbackRef.tsx\nimport * as React from \"react\";\nfunction useCallbackRef(callback) {\n const callbackRef = React.useRef(callback);\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);\n}\nexport {\n useCallbackRef\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/use-escape-keydown/src/useEscapeKeydown.tsx\nimport * as React from \"react\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nfunction useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {\n const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);\n React.useEffect(() => {\n const handleKeyDown = (event) => {\n if (event.key === \"Escape\") {\n onEscapeKeyDown(event);\n }\n };\n ownerDocument.addEventListener(\"keydown\", handleKeyDown, { capture: true });\n return () => ownerDocument.removeEventListener(\"keydown\", handleKeyDown, { capture: true });\n }, [onEscapeKeyDown, ownerDocument]);\n}\nexport {\n useEscapeKeydown\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// packages/react/dismissable-layer/src/DismissableLayer.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { Primitive, dispatchDiscreteCustomEvent } from \"@radix-ui/react-primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useEscapeKeydown } from \"@radix-ui/react-use-escape-keydown\";\nimport { jsx } from \"react/jsx-runtime\";\nvar DISMISSABLE_LAYER_NAME = \"DismissableLayer\";\nvar CONTEXT_UPDATE = \"dismissableLayer.update\";\nvar POINTER_DOWN_OUTSIDE = \"dismissableLayer.pointerDownOutside\";\nvar FOCUS_OUTSIDE = \"dismissableLayer.focusOutside\";\nvar originalBodyPointerEvents;\nvar DismissableLayerContext = React.createContext({\n layers: /* @__PURE__ */ new Set(),\n layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),\n branches: /* @__PURE__ */ new Set()\n});\nvar DismissableLayer = React.forwardRef(\n (props, forwardedRef) => {\n const {\n disableOutsidePointerEvents = false,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n ...layerProps\n } = props;\n const context = React.useContext(DismissableLayerContext);\n const [node, setNode] = React.useState(null);\n const ownerDocument = node?.ownerDocument ?? globalThis?.document;\n const [, force] = React.useState({});\n const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));\n const layers = Array.from(context.layers);\n const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);\n const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);\n const index = node ? layers.indexOf(node) : -1;\n const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;\n const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;\n const pointerDownOutside = usePointerDownOutside((event) => {\n const target = event.target;\n const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));\n if (!isPointerEventsEnabled || isPointerDownOnBranch) return;\n onPointerDownOutside?.(event);\n onInteractOutside?.(event);\n if (!event.defaultPrevented) onDismiss?.();\n }, ownerDocument);\n const focusOutside = useFocusOutside((event) => {\n const target = event.target;\n const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));\n if (isFocusInBranch) return;\n onFocusOutside?.(event);\n onInteractOutside?.(event);\n if (!event.defaultPrevented) onDismiss?.();\n }, ownerDocument);\n useEscapeKeydown((event) => {\n const isHighestLayer = index === context.layers.size - 1;\n if (!isHighestLayer) return;\n onEscapeKeyDown?.(event);\n if (!event.defaultPrevented && onDismiss) {\n event.preventDefault();\n onDismiss();\n }\n }, ownerDocument);\n React.useEffect(() => {\n if (!node) return;\n if (disableOutsidePointerEvents) {\n if (context.layersWithOutsidePointerEventsDisabled.size === 0) {\n originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;\n ownerDocument.body.style.pointerEvents = \"none\";\n }\n context.layersWithOutsidePointerEventsDisabled.add(node);\n }\n context.layers.add(node);\n dispatchUpdate();\n return () => {\n if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {\n ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;\n }\n };\n }, [node, ownerDocument, disableOutsidePointerEvents, context]);\n React.useEffect(() => {\n return () => {\n if (!node) return;\n context.layers.delete(node);\n context.layersWithOutsidePointerEventsDisabled.delete(node);\n dispatchUpdate();\n };\n }, [node, context]);\n React.useEffect(() => {\n const handleUpdate = () => force({});\n document.addEventListener(CONTEXT_UPDATE, handleUpdate);\n return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);\n }, []);\n return /* @__PURE__ */ jsx(\n Primitive.div,\n {\n ...layerProps,\n ref: composedRefs,\n style: {\n pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? \"auto\" : \"none\" : void 0,\n ...props.style\n },\n onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),\n onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),\n onPointerDownCapture: composeEventHandlers(\n props.onPointerDownCapture,\n pointerDownOutside.onPointerDownCapture\n )\n }\n );\n }\n);\nDismissableLayer.displayName = DISMISSABLE_LAYER_NAME;\nvar BRANCH_NAME = \"DismissableLayerBranch\";\nvar DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {\n const context = React.useContext(DismissableLayerContext);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n React.useEffect(() => {\n const node = ref.current;\n if (node) {\n context.branches.add(node);\n return () => {\n context.branches.delete(node);\n };\n }\n }, [context.branches]);\n return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });\n});\nDismissableLayerBranch.displayName = BRANCH_NAME;\nfunction usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {\n const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);\n const isPointerInsideReactTreeRef = React.useRef(false);\n const handleClickRef = React.useRef(() => {\n });\n React.useEffect(() => {\n const handlePointerDown = (event) => {\n if (event.target && !isPointerInsideReactTreeRef.current) {\n let handleAndDispatchPointerDownOutsideEvent2 = function() {\n handleAndDispatchCustomEvent(\n POINTER_DOWN_OUTSIDE,\n handlePointerDownOutside,\n eventDetail,\n { discrete: true }\n );\n };\n var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;\n const eventDetail = { originalEvent: event };\n if (event.pointerType === \"touch\") {\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;\n ownerDocument.addEventListener(\"click\", handleClickRef.current, { once: true });\n } else {\n handleAndDispatchPointerDownOutsideEvent2();\n }\n } else {\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n }\n isPointerInsideReactTreeRef.current = false;\n };\n const timerId = window.setTimeout(() => {\n ownerDocument.addEventListener(\"pointerdown\", handlePointerDown);\n }, 0);\n return () => {\n window.clearTimeout(timerId);\n ownerDocument.removeEventListener(\"pointerdown\", handlePointerDown);\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n };\n }, [ownerDocument, handlePointerDownOutside]);\n return {\n // ensures we check React component tree (not just DOM tree)\n onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true\n };\n}\nfunction useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {\n const handleFocusOutside = useCallbackRef(onFocusOutside);\n const isFocusInsideReactTreeRef = React.useRef(false);\n React.useEffect(() => {\n const handleFocus = (event) => {\n if (event.target && !isFocusInsideReactTreeRef.current) {\n const eventDetail = { originalEvent: event };\n handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {\n discrete: false\n });\n }\n };\n ownerDocument.addEventListener(\"focusin\", handleFocus);\n return () => ownerDocument.removeEventListener(\"focusin\", handleFocus);\n }, [ownerDocument, handleFocusOutside]);\n return {\n onFocusCapture: () => isFocusInsideReactTreeRef.current = true,\n onBlurCapture: () => isFocusInsideReactTreeRef.current = false\n };\n}\nfunction dispatchUpdate() {\n const event = new CustomEvent(CONTEXT_UPDATE);\n document.dispatchEvent(event);\n}\nfunction handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {\n const target = detail.originalEvent.target;\n const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });\n if (handler) target.addEventListener(name, handler, { once: true });\n if (discrete) {\n dispatchDiscreteCustomEvent(target, event);\n } else {\n target.dispatchEvent(event);\n }\n}\nvar Root = DismissableLayer;\nvar Branch = DismissableLayerBranch;\nexport {\n Branch,\n DismissableLayer,\n DismissableLayerBranch,\n Root\n};\n//# sourceMappingURL=index.mjs.map\n","import {\n DismissableLayer,\n type DismissableLayerProps,\n} from \"@radix-ui/react-dismissable-layer\";\n\ntype DismissableWrapperProps = DismissableLayerProps & {\n id: string;\n layers: Array<string>;\n children: React.ReactNode;\n};\n\n//\n// Handles the logic for when a global action like \"esc\" or clicking outside\n// should close the modal. When stacking modals, we don't want to close the\n// modal if we are not on the top-most layer.\n//\nconst DismissableWrapper = ({\n id,\n layers,\n children,\n ...props\n}: DismissableWrapperProps) => {\n const isTopLayer = id === layers[layers.length - 1];\n\n if (isTopLayer) {\n return <DismissableLayer {...props}>{children}</DismissableLayer>;\n }\n\n return <>{children}</>;\n};\n\nexport { DismissableWrapper };\n","import React from \"react\";\n\ntype AddLayerOptions = {\n layer?: number;\n};\n\nconst ModalStackingContext = React.createContext<{\n layers: Array<string>;\n setLayers: React.Dispatch<React.SetStateAction<Array<string>>>;\n addLayer: (id: string, options: AddLayerOptions) => void;\n removeLayer: (id: string) => void;\n removeTopLayer: () => void;\n}>({\n layers: [],\n setLayers: () => {},\n addLayer: () => {},\n removeLayer: () => {},\n removeTopLayer: () => {},\n});\n\ntype ModalStackingProviderProps = {\n children: React.ReactNode;\n};\n\nconst ModalStackingProvider = ({ children }: ModalStackingProviderProps) => {\n const [layers, setLayers] = React.useState<Array<string>>([]);\n\n const addLayer = (id: string, options: AddLayerOptions = {}) => {\n const { layer } = options;\n\n // If a layer is specified, insert the layer at the specified index\n // so that the modal renders at the correct layer in the stack.\n if (typeof layer === \"number\") {\n return setLayers((current) => {\n if (current.length - 1 < layer) {\n return [...current, id];\n }\n\n return [...current.slice(0, layer), id, ...current.slice(layer)];\n });\n } else {\n setLayers((current) => [...current, id]);\n }\n };\n\n const removeLayer = (id: string) => {\n setLayers(layers.filter((layer) => layer !== id));\n };\n\n const removeTopLayer = () => {\n const id = layers[layers.length - 1];\n if (!id) return;\n removeLayer(id);\n };\n\n return (\n <ModalStackingContext.Provider\n value={{ layers, setLayers, addLayer, removeLayer, removeTopLayer }}\n >\n {children}\n </ModalStackingContext.Provider>\n );\n};\n\nconst useModalStacking = () => {\n return React.useContext(ModalStackingContext);\n};\n\nexport { ModalStackingProvider, useModalStacking };\n","import * as Dialog from \"@radix-ui/react-dialog\";\nimport { FocusScope } from \"@radix-ui/react-focus-scope\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport * as VisuallyHidden from \"@radix-ui/react-visually-hidden\";\nimport { Button } from \"@telegraph/button\";\nimport { RefToTgphRef, type Required } from \"@telegraph/helpers\";\nimport type {\n PolymorphicProps,\n TgphComponentProps,\n TgphElement,\n} from \"@telegraph/helpers\";\nimport { Lucide } from \"@telegraph/icon\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport React from \"react\";\n\nimport { DismissableWrapper } from \"./Modal.helpers\";\nimport { useModalStacking } from \"./ModalStacking\";\n\ntype RootProps = Omit<\n React.ComponentPropsWithoutRef<typeof Dialog.Root>,\n \"modal\"\n> &\n TgphComponentProps<typeof Stack> & {\n a11yTitle: string;\n a11yDescription?: string;\n layer?: number;\n };\n\nconst Root = ({\n defaultOpen: defaultOpenProp,\n open: openProp,\n onOpenChange: onOpenChangeProp,\n ...props\n}: RootProps) => {\n const [open, onOpenChange] = useControllableState({\n prop: openProp,\n onChange: onOpenChangeProp,\n defaultProp: defaultOpenProp,\n });\n\n // Prevent rendering anything within the modal if it is not open\n if (!open) return;\n\n return <RootComponent open={open} onOpenChange={onOpenChange} {...props} />;\n};\n\nconst RootComponent = ({\n open,\n onOpenChange,\n a11yTitle,\n a11yDescription,\n children,\n layer: layerProp,\n ...props\n}: Required<RootProps, \"open\" | \"onOpenChange\">) => {\n const id = React.useId();\n const stacking = useModalStacking();\n\n React.useEffect(() => {\n if (!stacking || !open || stacking.layers.includes(id)) return;\n stacking.addLayer(id, { layer: layerProp });\n }, [id, layerProp, stacking, open]);\n\n const layer = stacking.layers?.indexOf(id) || 0;\n const layersLength = stacking.layers?.length || 0;\n const isStacked = layer !== 0;\n\n return (\n <DismissableWrapper\n id={id}\n layers={stacking.layers}\n onEscapeKeyDown={(event) => {\n event.preventDefault();\n stacking.removeTopLayer();\n onOpenChange(false);\n }}\n onPointerDownOutside={(event) => {\n event.preventDefault();\n stacking.removeTopLayer();\n onOpenChange(false);\n }}\n >\n <Dialog.Root\n open={open}\n onOpenChange={(value) => {\n const hasLayers = stacking?.layers?.length > 0;\n\n if (hasLayers) {\n if (\n value === false &&\n id === stacking.layers[stacking.layers.length - 1]\n ) {\n stacking.removeLayer(id);\n return onOpenChange(false);\n }\n // If the modal is not the top layer, do not call onOpenChange\n // when we are stacking the modals\n return;\n }\n\n onOpenChange(value);\n }}\n key={id}\n >\n <VisuallyHidden.Root>\n <Dialog.Title>{a11yTitle}</Dialog.Title>\n {a11yDescription && (\n <Dialog.Description>{a11yDescription}</Dialog.Description>\n )}\n </VisuallyHidden.Root>\n <AnimatePresence>\n {open && (\n <Overlay layer={layer}>\n <Stack\n as={motion.div}\n initial={{\n top: `calc(var(--tgph-spacing-16) + var(--tgph-spacing-4) * ${layersLength - 1})`,\n }}\n animate={{\n top: isStacked\n ? `calc(var(--tgph-spacing-16) + var(--tgph-spacing-4) * ${layer} )`\n : \"var(--tgph-spacing-16)\",\n }}\n exit={{ top: 0 }}\n transition={{ type: \"spring\", duration: 0.3, bounce: 0 }}\n w=\"full\"\n justify=\"center\"\n style={{\n position: \"fixed\",\n left: 0,\n maxHeight: \"calc(100vh - var(--tgph-spacing-32))\",\n maxWidth: \"calc(100vw - var(--tgph-spacing-8))\",\n zIndex: `calc(var(--tgph-zIndex-modal) + ${layer})`,\n }}\n key={`container-${id}`}\n >\n <Stack\n direction=\"column\"\n as={motion.div}\n animate={{\n scale: 1.02 - Math.abs(layersLength - layer) * 0.02,\n transformOrigin: \"center center\",\n }}\n transition={{ duration: 0.2, bounce: 0, type: \"spring\" }}\n maxW={props.maxW ?? \"160\"}\n w={props.w ?? \"full\"}\n bg=\"surface-1\"\n border=\"px\"\n rounded=\"4\"\n shadow=\"3\"\n key={`content-${id}`}\n {...props}\n >\n {children}\n </Stack>\n </Stack>\n </Overlay>\n )}\n </AnimatePresence>\n </Dialog.Root>\n </DismissableWrapper>\n );\n};\n\ntype OverlayProps = TgphComponentProps<typeof Box> & {\n layer: number;\n};\n\nconst Overlay = ({ layer, children }: OverlayProps) => {\n // If the layer is greater than 0, we don't want to show this\n // overlay as to not stack the overlays on top of each other.\n if (layer > 0) return children;\n return (\n <Dialog.Overlay>\n <Box\n as={motion.div}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.3, bounce: 0, type: \"spring\" }}\n bg=\"alpha-black-6\"\n w=\"full\"\n h=\"full\"\n zIndex=\"overlay\"\n style={{\n position: \"fixed\",\n cursor: \"pointer\",\n inset: \"0px\",\n }}\n />\n {children}\n </Dialog.Overlay>\n );\n};\n\ntype ContentProps = React.ComponentPropsWithoutRef<typeof Dialog.Content> &\n TgphComponentProps<typeof Stack>;\ntype ContentRef = React.ElementRef<typeof Dialog.Content>;\n\nconst Content = React.forwardRef<ContentRef, ContentProps>(\n ({ children, ...props }, forwardedRef) => {\n return (\n <FocusScope trapped={true} asChild>\n <RefToTgphRef>\n <Dialog.Content ref={forwardedRef} asChild {...props}>\n <Stack direction=\"column\" h=\"full\" {...props}>\n {children}\n </Stack>\n </Dialog.Content>\n </RefToTgphRef>\n </FocusScope>\n );\n },\n);\n\ntype CloseProps<T extends TgphElement> = TgphComponentProps<typeof Button<T>> &\n Omit<React.ComponentPropsWithoutRef<typeof Dialog.Close>, \"color\">;\nconst Close = <T extends TgphElement>({\n size = \"1\",\n variant = \"ghost\",\n ...props\n}: CloseProps<T>) => {\n return (\n <Dialog.Close asChild>\n <Button\n icon={{ icon: Lucide.X, alt: \"Close Modal\" }}\n variant={variant}\n size={size}\n {...props}\n />\n </Dialog.Close>\n );\n};\n\ntype BodyProps<T extends TgphElement> = PolymorphicProps<T> &\n TgphComponentProps<typeof Stack>;\n\nconst Body = <T extends TgphElement>({\n style,\n children,\n ...props\n}: BodyProps<T>) => {\n return (\n <Stack\n direction=\"column\"\n px=\"6\"\n py=\"4\"\n style={{\n overflowY: \"auto\",\n ...style,\n }}\n {...props}\n >\n {children}\n </Stack>\n );\n};\n\ntype HeaderProps<T extends TgphElement> = PolymorphicProps<T> &\n TgphComponentProps<typeof Stack>;\n\nconst Header = <T extends TgphElement>({\n children,\n ...props\n}: HeaderProps<T>) => {\n return (\n <Stack\n direction=\"row\"\n justify=\"space-between\"\n align=\"center\"\n px=\"6\"\n py=\"4\"\n borderBottom=\"px\"\n {...props}\n >\n {children}\n </Stack>\n );\n};\n\ntype FooterProps<T extends TgphElement> = PolymorphicProps<T> &\n TgphComponentProps<typeof Stack>;\n\nconst Footer = <T extends TgphElement>({\n children,\n ...props\n}: FooterProps<T>) => {\n return (\n <Stack\n direction=\"row\"\n align=\"center\"\n justify=\"flex-end\"\n gap=\"2\"\n px=\"6\"\n py=\"4\"\n borderTop=\"px\"\n {...props}\n >\n {children}\n </Stack>\n );\n};\n\nconst Modal = {} as {\n Root: typeof Root;\n Content: typeof Content;\n Close: typeof Close;\n Body: typeof Body;\n Header: typeof Header;\n Footer: typeof Footer;\n};\n\nObject.assign(Modal, {\n Root,\n Content,\n Close,\n Body,\n Header,\n Footer,\n});\n\nexport { Modal };\n"],"names":["useCallbackRef","callback","callbackRef","React","args","_a","useControllableState","prop","defaultProp","onChange","uncontrolledProp","setUncontrolledProp","useUncontrolledState","isControlled","value","handleChange","setValue","nextValue","value2","uncontrolledState","prevValueRef","composeEventHandlers","originalEventHandler","ourEventHandler","checkForDefaultPrevented","event","setRef","ref","composeRefs","refs","node","Slot","props","forwardedRef","children","slotProps","childrenArray","slottable","isSlottable","newElement","newChildren","child","jsx","SlotClone","childrenRef","getElementRef","mergeProps","Slottable","Fragment","childProps","overrideProps","propName","slotPropValue","childPropValue","element","getter","mayWarn","_b","NODES","Primitive","primitive","Node","asChild","primitiveProps","Comp","dispatchDiscreteCustomEvent","target","ReactDOM","useComposedRefs","useEscapeKeydown","onEscapeKeyDownProp","ownerDocument","onEscapeKeyDown","handleKeyDown","DISMISSABLE_LAYER_NAME","CONTEXT_UPDATE","POINTER_DOWN_OUTSIDE","FOCUS_OUTSIDE","originalBodyPointerEvents","DismissableLayerContext","DismissableLayer","disableOutsidePointerEvents","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","layerProps","context","setNode","force","composedRefs","node2","layers","highestLayerWithOutsidePointerEventsDisabled","highestLayerWithOutsidePointerEventsDisabledIndex","index","isBodyPointerEventsDisabled","isPointerEventsEnabled","pointerDownOutside","usePointerDownOutside","isPointerDownOnBranch","branch","focusOutside","useFocusOutside","dispatchUpdate","handleUpdate","BRANCH_NAME","DismissableLayerBranch","handlePointerDownOutside","isPointerInsideReactTreeRef","handleClickRef","handlePointerDown","handleAndDispatchPointerDownOutsideEvent2","handleAndDispatchCustomEvent","eventDetail","timerId","handleFocusOutside","isFocusInsideReactTreeRef","handleFocus","name","handler","detail","discrete","DismissableWrapper","id","ModalStackingContext","ModalStackingProvider","setLayers","addLayer","options","layer","current","removeLayer","removeTopLayer","useModalStacking","Root","defaultOpenProp","openProp","onOpenChangeProp","open","onOpenChange","RootComponent","a11yTitle","a11yDescription","layerProp","stacking","layersLength","isStacked","jsxs","Dialog","VisuallyHidden","AnimatePresence","Overlay","Stack","motion","Box","Content","FocusScope","RefToTgphRef","Close","size","variant","Button","Lucide","Body","style","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A,OAAAC,EACF,CAAC","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9]}
@@ -5,10 +5,11 @@ import * as o from "react";
5
5
  import E from "react";
6
6
  import * as q from "@radix-ui/react-visually-hidden";
7
7
  import { Button as G } from "@telegraph/button";
8
- import { Lucide as J } from "@telegraph/icon";
9
- import { Stack as g, Box as Q } from "@telegraph/layout";
10
- import { AnimatePresence as ee, motion as O } from "framer-motion";
11
- import * as te from "react-dom";
8
+ import { RefToTgphRef as J } from "@telegraph/helpers";
9
+ import { Lucide as Q } from "@telegraph/icon";
10
+ import { Stack as g, Box as ee } from "@telegraph/layout";
11
+ import { AnimatePresence as te, motion as O } from "framer-motion";
12
+ import * as ne from "react-dom";
12
13
  function M(t) {
13
14
  const e = o.useRef(t);
14
15
  return o.useEffect(() => {
@@ -18,13 +19,13 @@ function M(t) {
18
19
  return (r = e.current) == null ? void 0 : r.call(e, ...n);
19
20
  }, []);
20
21
  }
21
- function ne({
22
+ function re({
22
23
  prop: t,
23
24
  defaultProp: e,
24
25
  onChange: n = () => {
25
26
  }
26
27
  }) {
27
- const [r, s] = re({ defaultProp: e, onChange: n }), i = t !== void 0, l = i ? t : r, a = M(n), u = o.useCallback(
28
+ const [r, s] = se({ defaultProp: e, onChange: n }), i = t !== void 0, l = i ? t : r, a = M(n), u = o.useCallback(
28
29
  (c) => {
29
30
  if (i) {
30
31
  const m = typeof c == "function" ? c(t) : c;
@@ -36,7 +37,7 @@ function ne({
36
37
  );
37
38
  return [l, u];
38
39
  }
39
- function re({
40
+ function se({
40
41
  defaultProp: t,
41
42
  onChange: e
42
43
  }) {
@@ -45,20 +46,20 @@ function re({
45
46
  s.current !== r && (i(r), s.current = r);
46
47
  }, [r, s, i]), n;
47
48
  }
48
- function R(t, e, { checkForDefaultPrevented: n = !0 } = {}) {
49
+ function w(t, e, { checkForDefaultPrevented: n = !0 } = {}) {
49
50
  return function(s) {
50
51
  if (t == null || t(s), n === !1 || !s.defaultPrevented)
51
52
  return e == null ? void 0 : e(s);
52
53
  };
53
54
  }
54
- function se(t, e) {
55
+ function oe(t, e) {
55
56
  typeof t == "function" ? t(e) : t != null && (t.current = e);
56
57
  }
57
- function oe(...t) {
58
- return (e) => t.forEach((n) => se(n, e));
58
+ function ie(...t) {
59
+ return (e) => t.forEach((n) => oe(n, e));
59
60
  }
60
61
  var j = o.forwardRef((t, e) => {
61
- const { children: n, ...r } = t, s = o.Children.toArray(n), i = s.find(ae);
62
+ const { children: n, ...r } = t, s = o.Children.toArray(n), i = s.find(ce);
62
63
  if (i) {
63
64
  const l = i.props.children, a = s.map((u) => u === i ? o.Children.count(l) > 1 ? o.Children.only(null) : o.isValidElement(l) ? l.props.children : null : u);
64
65
  return /* @__PURE__ */ d(x, { ...r, ref: e, children: o.isValidElement(l) ? o.cloneElement(l, void 0, a) : null });
@@ -69,21 +70,21 @@ j.displayName = "Slot";
69
70
  var x = o.forwardRef((t, e) => {
70
71
  const { children: n, ...r } = t;
71
72
  if (o.isValidElement(n)) {
72
- const s = le(n);
73
+ const s = ue(n);
73
74
  return o.cloneElement(n, {
74
- ...ce(r, n.props),
75
+ ...le(r, n.props),
75
76
  // @ts-ignore
76
- ref: e ? oe(e, s) : s
77
+ ref: e ? ie(e, s) : s
77
78
  });
78
79
  }
79
80
  return o.Children.count(n) > 1 ? o.Children.only(null) : null;
80
81
  });
81
82
  x.displayName = "SlotClone";
82
- var ie = ({ children: t }) => /* @__PURE__ */ d(I, { children: t });
83
- function ae(t) {
84
- return o.isValidElement(t) && t.type === ie;
83
+ var ae = ({ children: t }) => /* @__PURE__ */ d(I, { children: t });
84
+ function ce(t) {
85
+ return o.isValidElement(t) && t.type === ae;
85
86
  }
86
- function ce(t, e) {
87
+ function le(t, e) {
87
88
  const n = { ...e };
88
89
  for (const r in e) {
89
90
  const s = t[r], i = e[r];
@@ -93,12 +94,12 @@ function ce(t, e) {
93
94
  }
94
95
  return { ...t, ...n };
95
96
  }
96
- function le(t) {
97
+ function ue(t) {
97
98
  var r, s;
98
99
  let e = (r = Object.getOwnPropertyDescriptor(t.props, "ref")) == null ? void 0 : r.get, n = e && "isReactWarning" in e && e.isReactWarning;
99
100
  return n ? t.ref : (e = (s = Object.getOwnPropertyDescriptor(t, "ref")) == null ? void 0 : s.get, n = e && "isReactWarning" in e && e.isReactWarning, n ? t.props.ref : t.props.ref || t.ref);
100
101
  }
101
- var ue = [
102
+ var de = [
102
103
  "a",
103
104
  "button",
104
105
  "div",
@@ -115,24 +116,24 @@ var ue = [
115
116
  "span",
116
117
  "svg",
117
118
  "ul"
118
- ], _ = ue.reduce((t, e) => {
119
+ ], _ = de.reduce((t, e) => {
119
120
  const n = o.forwardRef((r, s) => {
120
121
  const { asChild: i, ...l } = r, a = i ? j : e;
121
122
  return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ d(a, { ...l, ref: s });
122
123
  });
123
124
  return n.displayName = `Primitive.${e}`, { ...t, [e]: n };
124
125
  }, {});
125
- function de(t, e) {
126
- t && te.flushSync(() => t.dispatchEvent(e));
127
- }
128
126
  function fe(t, e) {
127
+ t && ne.flushSync(() => t.dispatchEvent(e));
128
+ }
129
+ function pe(t, e) {
129
130
  typeof t == "function" ? t(e) : t != null && (t.current = e);
130
131
  }
131
- function pe(...t) {
132
- return (e) => t.forEach((n) => fe(n, e));
132
+ function ye(...t) {
133
+ return (e) => t.forEach((n) => pe(n, e));
133
134
  }
134
135
  function $(...t) {
135
- return o.useCallback(pe(...t), t);
136
+ return o.useCallback(ye(...t), t);
136
137
  }
137
138
  function T(t) {
138
139
  const e = o.useRef(t);
@@ -143,7 +144,7 @@ function T(t) {
143
144
  return (r = e.current) == null ? void 0 : r.call(e, ...n);
144
145
  }, []);
145
146
  }
146
- function ye(t, e = globalThis == null ? void 0 : globalThis.document) {
147
+ function he(t, e = globalThis == null ? void 0 : globalThis.document) {
147
148
  const n = T(t);
148
149
  o.useEffect(() => {
149
150
  const r = (s) => {
@@ -152,7 +153,7 @@ function ye(t, e = globalThis == null ? void 0 : globalThis.document) {
152
153
  return e.addEventListener("keydown", r, { capture: !0 }), () => e.removeEventListener("keydown", r, { capture: !0 });
153
154
  }, [n, e]);
154
155
  }
155
- var he = "DismissableLayer", S = "dismissableLayer.update", me = "dismissableLayer.pointerDownOutside", ve = "dismissableLayer.focusOutside", A, U = o.createContext({
156
+ var me = "DismissableLayer", S = "dismissableLayer.update", ve = "dismissableLayer.pointerDownOutside", Ee = "dismissableLayer.focusOutside", A, U = o.createContext({
156
157
  layers: /* @__PURE__ */ new Set(),
157
158
  layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
158
159
  branches: /* @__PURE__ */ new Set()
@@ -166,14 +167,14 @@ var he = "DismissableLayer", S = "dismissableLayer.update", me = "dismissableLay
166
167
  onInteractOutside: l,
167
168
  onDismiss: a,
168
169
  ...u
169
- } = t, c = o.useContext(U), [p, m] = o.useState(null), y = (p == null ? void 0 : p.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, b] = o.useState({}), h = $(e, (f) => m(f)), P = Array.from(c.layers), [C] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), X = P.indexOf(C), W = p ? P.indexOf(p) : -1, H = c.layersWithOutsidePointerEventsDisabled.size > 0, B = W >= X, Y = be((f) => {
170
- const L = f.target, k = [...c.branches].some((w) => w.contains(L));
170
+ } = t, c = o.useContext(U), [p, m] = o.useState(null), y = (p == null ? void 0 : p.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, b] = o.useState({}), h = $(e, (f) => m(f)), P = Array.from(c.layers), [C] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), X = P.indexOf(C), W = p ? P.indexOf(p) : -1, Y = c.layersWithOutsidePointerEventsDisabled.size > 0, B = W >= X, H = Ce((f) => {
171
+ const L = f.target, k = [...c.branches].some((R) => R.contains(L));
171
172
  !B || k || (s == null || s(f), l == null || l(f), f.defaultPrevented || a == null || a());
172
- }, y), N = Ce((f) => {
173
+ }, y), N = Le((f) => {
173
174
  const L = f.target;
174
- [...c.branches].some((w) => w.contains(L)) || (i == null || i(f), l == null || l(f), f.defaultPrevented || a == null || a());
175
+ [...c.branches].some((R) => R.contains(L)) || (i == null || i(f), l == null || l(f), f.defaultPrevented || a == null || a());
175
176
  }, y);
176
- return ye((f) => {
177
+ return he((f) => {
177
178
  W === c.layers.size - 1 && (r == null || r(f), !f.defaultPrevented && a && (f.preventDefault(), a()));
178
179
  }, y), o.useEffect(() => {
179
180
  if (p)
@@ -191,21 +192,21 @@ var he = "DismissableLayer", S = "dismissableLayer.update", me = "dismissableLay
191
192
  ...u,
192
193
  ref: h,
193
194
  style: {
194
- pointerEvents: H ? B ? "auto" : "none" : void 0,
195
+ pointerEvents: Y ? B ? "auto" : "none" : void 0,
195
196
  ...t.style
196
197
  },
197
- onFocusCapture: R(t.onFocusCapture, N.onFocusCapture),
198
- onBlurCapture: R(t.onBlurCapture, N.onBlurCapture),
199
- onPointerDownCapture: R(
198
+ onFocusCapture: w(t.onFocusCapture, N.onFocusCapture),
199
+ onBlurCapture: w(t.onBlurCapture, N.onBlurCapture),
200
+ onPointerDownCapture: w(
200
201
  t.onPointerDownCapture,
201
- Y.onPointerDownCapture
202
+ H.onPointerDownCapture
202
203
  )
203
204
  }
204
205
  );
205
206
  }
206
207
  );
207
- z.displayName = he;
208
- var Ee = "DismissableLayerBranch", ge = o.forwardRef((t, e) => {
208
+ z.displayName = me;
209
+ var ge = "DismissableLayerBranch", be = o.forwardRef((t, e) => {
209
210
  const n = o.useContext(U), r = o.useRef(null), s = $(e, r);
210
211
  return o.useEffect(() => {
211
212
  const i = r.current;
@@ -215,8 +216,8 @@ var Ee = "DismissableLayerBranch", ge = o.forwardRef((t, e) => {
215
216
  };
216
217
  }, [n.branches]), /* @__PURE__ */ d(_.div, { ...t, ref: s });
217
218
  });
218
- ge.displayName = Ee;
219
- function be(t, e = globalThis == null ? void 0 : globalThis.document) {
219
+ be.displayName = ge;
220
+ function Ce(t, e = globalThis == null ? void 0 : globalThis.document) {
220
221
  const n = T(t), r = o.useRef(!1), s = o.useRef(() => {
221
222
  });
222
223
  return o.useEffect(() => {
@@ -224,7 +225,7 @@ function be(t, e = globalThis == null ? void 0 : globalThis.document) {
224
225
  if (a.target && !r.current) {
225
226
  let u = function() {
226
227
  V(
227
- me,
228
+ ve,
228
229
  n,
229
230
  c,
230
231
  { discrete: !0 }
@@ -246,11 +247,11 @@ function be(t, e = globalThis == null ? void 0 : globalThis.document) {
246
247
  onPointerDownCapture: () => r.current = !0
247
248
  };
248
249
  }
249
- function Ce(t, e = globalThis == null ? void 0 : globalThis.document) {
250
+ function Le(t, e = globalThis == null ? void 0 : globalThis.document) {
250
251
  const n = T(t), r = o.useRef(!1);
251
252
  return o.useEffect(() => {
252
253
  const s = (i) => {
253
- i.target && !r.current && V(ve, n, { originalEvent: i }, {
254
+ i.target && !r.current && V(Ee, n, { originalEvent: i }, {
254
255
  discrete: !1
255
256
  });
256
257
  };
@@ -266,9 +267,9 @@ function F() {
266
267
  }
267
268
  function V(t, e, n, { discrete: r }) {
268
269
  const s = n.originalEvent.target, i = new CustomEvent(t, { bubbles: !1, cancelable: !0, detail: n });
269
- e && s.addEventListener(t, e, { once: !0 }), r ? de(s, i) : s.dispatchEvent(i);
270
+ e && s.addEventListener(t, e, { once: !0 }), r ? fe(s, i) : s.dispatchEvent(i);
270
271
  }
271
- const Le = ({
272
+ const Pe = ({
272
273
  id: t,
273
274
  layers: e,
274
275
  children: n,
@@ -283,7 +284,7 @@ const Le = ({
283
284
  },
284
285
  removeTopLayer: () => {
285
286
  }
286
- }), _e = ({ children: t }) => {
287
+ }), Ue = ({ children: t }) => {
287
288
  const [e, n] = E.useState([]), r = (l, a = {}) => {
288
289
  const { layer: u } = a;
289
290
  if (typeof u == "number")
@@ -302,20 +303,20 @@ const Le = ({
302
303
  children: t
303
304
  }
304
305
  );
305
- }, Pe = () => E.useContext(K), we = ({
306
+ }, Re = () => E.useContext(K), we = ({
306
307
  defaultOpen: t,
307
308
  open: e,
308
309
  onOpenChange: n,
309
310
  ...r
310
311
  }) => {
311
- const [s, i] = ne({
312
+ const [s, i] = re({
312
313
  prop: e,
313
314
  onChange: n,
314
315
  defaultProp: t
315
316
  });
316
317
  if (s)
317
- return /* @__PURE__ */ d(Re, { open: s, onOpenChange: i, ...r });
318
- }, Re = ({
318
+ return /* @__PURE__ */ d(De, { open: s, onOpenChange: i, ...r });
319
+ }, De = ({
319
320
  open: t,
320
321
  onOpenChange: e,
321
322
  a11yTitle: n,
@@ -325,13 +326,13 @@ const Le = ({
325
326
  ...l
326
327
  }) => {
327
328
  var y, b;
328
- const a = E.useId(), u = Pe();
329
+ const a = E.useId(), u = Re();
329
330
  E.useEffect(() => {
330
331
  !u || !t || u.layers.includes(a) || u.addLayer(a, { layer: i });
331
332
  }, [a, i, u, t]);
332
333
  const c = ((y = u.layers) == null ? void 0 : y.indexOf(a)) || 0, p = ((b = u.layers) == null ? void 0 : b.length) || 0, m = c !== 0;
333
334
  return /* @__PURE__ */ d(
334
- Le,
335
+ Pe,
335
336
  {
336
337
  id: a,
337
338
  layers: u.layers,
@@ -356,7 +357,7 @@ const Le = ({
356
357
  /* @__PURE__ */ d(v.Title, { children: n }),
357
358
  r && /* @__PURE__ */ d(v.Description, { children: r })
358
359
  ] }),
359
- /* @__PURE__ */ d(ee, { children: t && /* @__PURE__ */ d(De, { layer: c, children: /* @__PURE__ */ d(
360
+ /* @__PURE__ */ d(te, { children: t && /* @__PURE__ */ d(Oe, { layer: c, children: /* @__PURE__ */ d(
360
361
  g,
361
362
  {
362
363
  as: O.div,
@@ -407,9 +408,9 @@ const Le = ({
407
408
  )
408
409
  }
409
410
  );
410
- }, De = ({ layer: t, children: e }) => t > 0 ? e : /* @__PURE__ */ D(v.Overlay, { children: [
411
+ }, Oe = ({ layer: t, children: e }) => t > 0 ? e : /* @__PURE__ */ D(v.Overlay, { children: [
411
412
  /* @__PURE__ */ d(
412
- Q,
413
+ ee,
413
414
  {
414
415
  as: O.div,
415
416
  initial: { opacity: 0 },
@@ -428,21 +429,38 @@ const Le = ({
428
429
  }
429
430
  ),
430
431
  e
431
- ] }), Oe = E.forwardRef(
432
- ({ children: t, ...e }, n) => /* @__PURE__ */ d(Z, { trapped: !0, children: /* @__PURE__ */ d(v.Content, { ref: n, asChild: !0, ...e, children: /* @__PURE__ */ d(g, { direction: "column", h: "full", ...e, children: t }) }) })
433
- ), xe = ({
432
+ ] }), xe = E.forwardRef(
433
+ ({ children: t, ...e }, n) => /* @__PURE__ */ d(Z, { trapped: !0, asChild: !0, children: /* @__PURE__ */ d(J, { children: /* @__PURE__ */ d(v.Content, { ref: n, asChild: !0, ...e, children: /* @__PURE__ */ d(g, { direction: "column", h: "full", ...e, children: t }) }) }) })
434
+ ), Se = ({
434
435
  size: t = "1",
435
436
  variant: e = "ghost",
436
437
  ...n
437
438
  }) => /* @__PURE__ */ d(v.Close, { asChild: !0, children: /* @__PURE__ */ d(
438
439
  G,
439
440
  {
440
- icon: { icon: J.X, alt: "Close Modal" },
441
+ icon: { icon: Q.X, alt: "Close Modal" },
441
442
  variant: e,
442
443
  size: t,
443
444
  ...n
444
445
  }
445
- ) }), Se = ({ children: t, ...e }) => /* @__PURE__ */ d(g, { direction: "column", px: "6", py: "4", ...e, children: t }), Te = ({
446
+ ) }), Te = ({
447
+ style: t,
448
+ children: e,
449
+ ...n
450
+ }) => /* @__PURE__ */ d(
451
+ g,
452
+ {
453
+ direction: "column",
454
+ px: "6",
455
+ py: "4",
456
+ style: {
457
+ overflowY: "auto",
458
+ ...t
459
+ },
460
+ ...n,
461
+ children: e
462
+ }
463
+ ), We = ({
446
464
  children: t,
447
465
  ...e
448
466
  }) => /* @__PURE__ */ d(
@@ -457,7 +475,7 @@ const Le = ({
457
475
  ...e,
458
476
  children: t
459
477
  }
460
- ), We = ({
478
+ ), Be = ({
461
479
  children: t,
462
480
  ...e
463
481
  }) => /* @__PURE__ */ d(
@@ -473,17 +491,17 @@ const Le = ({
473
491
  ...e,
474
492
  children: t
475
493
  }
476
- ), Be = {};
477
- Object.assign(Be, {
494
+ ), Ne = {};
495
+ Object.assign(Ne, {
478
496
  Root: we,
479
- Content: Oe,
480
- Close: xe,
481
- Body: Se,
482
- Header: Te,
483
- Footer: We
497
+ Content: xe,
498
+ Close: Se,
499
+ Body: Te,
500
+ Header: We,
501
+ Footer: Be
484
502
  });
485
503
  export {
486
- Be as Modal,
487
- _e as ModalStackingProvider
504
+ Ne as Modal,
505
+ Ue as ModalStackingProvider
488
506
  };
489
507
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../../node_modules/@radix-ui/react-use-controllable-state/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs","../../../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/primitive/dist/index.mjs","../../../../node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.mjs","../../../../node_modules/@radix-ui/react-slot/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-primitive/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-compose-refs/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs","../../src/Modal/Modal.helpers.tsx","../../src/Modal/ModalStacking.tsx","../../src/Modal/Modal.tsx"],"sourcesContent":["// packages/react/use-callback-ref/src/useCallbackRef.tsx\nimport * as React from \"react\";\nfunction useCallbackRef(callback) {\n const callbackRef = React.useRef(callback);\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);\n}\nexport {\n useCallbackRef\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/use-controllable-state/src/useControllableState.tsx\nimport * as React from \"react\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nfunction useControllableState({\n prop,\n defaultProp,\n onChange = () => {\n }\n}) {\n const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });\n const isControlled = prop !== void 0;\n const value = isControlled ? prop : uncontrolledProp;\n const handleChange = useCallbackRef(onChange);\n const setValue = React.useCallback(\n (nextValue) => {\n if (isControlled) {\n const setter = nextValue;\n const value2 = typeof nextValue === \"function\" ? setter(prop) : nextValue;\n if (value2 !== prop) handleChange(value2);\n } else {\n setUncontrolledProp(nextValue);\n }\n },\n [isControlled, prop, setUncontrolledProp, handleChange]\n );\n return [value, setValue];\n}\nfunction useUncontrolledState({\n defaultProp,\n onChange\n}) {\n const uncontrolledState = React.useState(defaultProp);\n const [value] = uncontrolledState;\n const prevValueRef = React.useRef(value);\n const handleChange = useCallbackRef(onChange);\n React.useEffect(() => {\n if (prevValueRef.current !== value) {\n handleChange(value);\n prevValueRef.current = value;\n }\n }, [value, prevValueRef, handleChange]);\n return uncontrolledState;\n}\nexport {\n useControllableState\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/core/primitive/src/primitive.tsx\nfunction composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {\n return function handleEvent(event) {\n originalEventHandler?.(event);\n if (checkForDefaultPrevented === false || !event.defaultPrevented) {\n return ourEventHandler?.(event);\n }\n };\n}\nexport {\n composeEventHandlers\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/compose-refs/src/composeRefs.tsx\nimport * as React from \"react\";\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null && ref !== void 0) {\n ref.current = value;\n }\n}\nfunction composeRefs(...refs) {\n return (node) => refs.forEach((ref) => setRef(ref, node));\n}\nfunction useComposedRefs(...refs) {\n return React.useCallback(composeRefs(...refs), refs);\n}\nexport {\n composeRefs,\n useComposedRefs\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/slot/src/Slot.tsx\nimport * as React from \"react\";\nimport { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { Fragment, jsx } from \"react/jsx-runtime\";\nvar Slot = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n if (slottable) {\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement) ? newElement.props.children : null;\n } else {\n return child;\n }\n });\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });\n }\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });\n});\nSlot.displayName = \"Slot\";\nvar SlotClone = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n return React.cloneElement(children, {\n ...mergeProps(slotProps, children.props),\n // @ts-ignore\n ref: forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef\n });\n }\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n});\nSlotClone.displayName = \"SlotClone\";\nvar Slottable = ({ children }) => {\n return /* @__PURE__ */ jsx(Fragment, { children });\n};\nfunction isSlottable(child) {\n return React.isValidElement(child) && child.type === Slottable;\n}\nfunction mergeProps(slotProps, childProps) {\n const overrideProps = { ...childProps };\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args) => {\n childPropValue(...args);\n slotPropValue(...args);\n };\n } else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n } else if (propName === \"style\") {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === \"className\") {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(\" \");\n }\n }\n return { ...slotProps, ...overrideProps };\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nvar Root = Slot;\nexport {\n Root,\n Slot,\n Slottable\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/primitive/src/Primitive.tsx\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nvar NODES = [\n \"a\",\n \"button\",\n \"div\",\n \"form\",\n \"h2\",\n \"h3\",\n \"img\",\n \"input\",\n \"label\",\n \"li\",\n \"nav\",\n \"ol\",\n \"p\",\n \"span\",\n \"svg\",\n \"ul\"\n];\nvar Primitive = NODES.reduce((primitive, node) => {\n const Node = React.forwardRef((props, forwardedRef) => {\n const { asChild, ...primitiveProps } = props;\n const Comp = asChild ? Slot : node;\n if (typeof window !== \"undefined\") {\n window[Symbol.for(\"radix-ui\")] = true;\n }\n return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });\n });\n Node.displayName = `Primitive.${node}`;\n return { ...primitive, [node]: Node };\n}, {});\nfunction dispatchDiscreteCustomEvent(target, event) {\n if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));\n}\nvar Root = Primitive;\nexport {\n Primitive,\n Root,\n dispatchDiscreteCustomEvent\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/compose-refs/src/composeRefs.tsx\nimport * as React from \"react\";\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null && ref !== void 0) {\n ref.current = value;\n }\n}\nfunction composeRefs(...refs) {\n return (node) => refs.forEach((ref) => setRef(ref, node));\n}\nfunction useComposedRefs(...refs) {\n return React.useCallback(composeRefs(...refs), refs);\n}\nexport {\n composeRefs,\n useComposedRefs\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/use-callback-ref/src/useCallbackRef.tsx\nimport * as React from \"react\";\nfunction useCallbackRef(callback) {\n const callbackRef = React.useRef(callback);\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);\n}\nexport {\n useCallbackRef\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/use-escape-keydown/src/useEscapeKeydown.tsx\nimport * as React from \"react\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nfunction useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {\n const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);\n React.useEffect(() => {\n const handleKeyDown = (event) => {\n if (event.key === \"Escape\") {\n onEscapeKeyDown(event);\n }\n };\n ownerDocument.addEventListener(\"keydown\", handleKeyDown, { capture: true });\n return () => ownerDocument.removeEventListener(\"keydown\", handleKeyDown, { capture: true });\n }, [onEscapeKeyDown, ownerDocument]);\n}\nexport {\n useEscapeKeydown\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// packages/react/dismissable-layer/src/DismissableLayer.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { Primitive, dispatchDiscreteCustomEvent } from \"@radix-ui/react-primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useEscapeKeydown } from \"@radix-ui/react-use-escape-keydown\";\nimport { jsx } from \"react/jsx-runtime\";\nvar DISMISSABLE_LAYER_NAME = \"DismissableLayer\";\nvar CONTEXT_UPDATE = \"dismissableLayer.update\";\nvar POINTER_DOWN_OUTSIDE = \"dismissableLayer.pointerDownOutside\";\nvar FOCUS_OUTSIDE = \"dismissableLayer.focusOutside\";\nvar originalBodyPointerEvents;\nvar DismissableLayerContext = React.createContext({\n layers: /* @__PURE__ */ new Set(),\n layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),\n branches: /* @__PURE__ */ new Set()\n});\nvar DismissableLayer = React.forwardRef(\n (props, forwardedRef) => {\n const {\n disableOutsidePointerEvents = false,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n ...layerProps\n } = props;\n const context = React.useContext(DismissableLayerContext);\n const [node, setNode] = React.useState(null);\n const ownerDocument = node?.ownerDocument ?? globalThis?.document;\n const [, force] = React.useState({});\n const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));\n const layers = Array.from(context.layers);\n const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);\n const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);\n const index = node ? layers.indexOf(node) : -1;\n const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;\n const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;\n const pointerDownOutside = usePointerDownOutside((event) => {\n const target = event.target;\n const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));\n if (!isPointerEventsEnabled || isPointerDownOnBranch) return;\n onPointerDownOutside?.(event);\n onInteractOutside?.(event);\n if (!event.defaultPrevented) onDismiss?.();\n }, ownerDocument);\n const focusOutside = useFocusOutside((event) => {\n const target = event.target;\n const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));\n if (isFocusInBranch) return;\n onFocusOutside?.(event);\n onInteractOutside?.(event);\n if (!event.defaultPrevented) onDismiss?.();\n }, ownerDocument);\n useEscapeKeydown((event) => {\n const isHighestLayer = index === context.layers.size - 1;\n if (!isHighestLayer) return;\n onEscapeKeyDown?.(event);\n if (!event.defaultPrevented && onDismiss) {\n event.preventDefault();\n onDismiss();\n }\n }, ownerDocument);\n React.useEffect(() => {\n if (!node) return;\n if (disableOutsidePointerEvents) {\n if (context.layersWithOutsidePointerEventsDisabled.size === 0) {\n originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;\n ownerDocument.body.style.pointerEvents = \"none\";\n }\n context.layersWithOutsidePointerEventsDisabled.add(node);\n }\n context.layers.add(node);\n dispatchUpdate();\n return () => {\n if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {\n ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;\n }\n };\n }, [node, ownerDocument, disableOutsidePointerEvents, context]);\n React.useEffect(() => {\n return () => {\n if (!node) return;\n context.layers.delete(node);\n context.layersWithOutsidePointerEventsDisabled.delete(node);\n dispatchUpdate();\n };\n }, [node, context]);\n React.useEffect(() => {\n const handleUpdate = () => force({});\n document.addEventListener(CONTEXT_UPDATE, handleUpdate);\n return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);\n }, []);\n return /* @__PURE__ */ jsx(\n Primitive.div,\n {\n ...layerProps,\n ref: composedRefs,\n style: {\n pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? \"auto\" : \"none\" : void 0,\n ...props.style\n },\n onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),\n onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),\n onPointerDownCapture: composeEventHandlers(\n props.onPointerDownCapture,\n pointerDownOutside.onPointerDownCapture\n )\n }\n );\n }\n);\nDismissableLayer.displayName = DISMISSABLE_LAYER_NAME;\nvar BRANCH_NAME = \"DismissableLayerBranch\";\nvar DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {\n const context = React.useContext(DismissableLayerContext);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n React.useEffect(() => {\n const node = ref.current;\n if (node) {\n context.branches.add(node);\n return () => {\n context.branches.delete(node);\n };\n }\n }, [context.branches]);\n return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });\n});\nDismissableLayerBranch.displayName = BRANCH_NAME;\nfunction usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {\n const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);\n const isPointerInsideReactTreeRef = React.useRef(false);\n const handleClickRef = React.useRef(() => {\n });\n React.useEffect(() => {\n const handlePointerDown = (event) => {\n if (event.target && !isPointerInsideReactTreeRef.current) {\n let handleAndDispatchPointerDownOutsideEvent2 = function() {\n handleAndDispatchCustomEvent(\n POINTER_DOWN_OUTSIDE,\n handlePointerDownOutside,\n eventDetail,\n { discrete: true }\n );\n };\n var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;\n const eventDetail = { originalEvent: event };\n if (event.pointerType === \"touch\") {\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;\n ownerDocument.addEventListener(\"click\", handleClickRef.current, { once: true });\n } else {\n handleAndDispatchPointerDownOutsideEvent2();\n }\n } else {\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n }\n isPointerInsideReactTreeRef.current = false;\n };\n const timerId = window.setTimeout(() => {\n ownerDocument.addEventListener(\"pointerdown\", handlePointerDown);\n }, 0);\n return () => {\n window.clearTimeout(timerId);\n ownerDocument.removeEventListener(\"pointerdown\", handlePointerDown);\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n };\n }, [ownerDocument, handlePointerDownOutside]);\n return {\n // ensures we check React component tree (not just DOM tree)\n onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true\n };\n}\nfunction useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {\n const handleFocusOutside = useCallbackRef(onFocusOutside);\n const isFocusInsideReactTreeRef = React.useRef(false);\n React.useEffect(() => {\n const handleFocus = (event) => {\n if (event.target && !isFocusInsideReactTreeRef.current) {\n const eventDetail = { originalEvent: event };\n handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {\n discrete: false\n });\n }\n };\n ownerDocument.addEventListener(\"focusin\", handleFocus);\n return () => ownerDocument.removeEventListener(\"focusin\", handleFocus);\n }, [ownerDocument, handleFocusOutside]);\n return {\n onFocusCapture: () => isFocusInsideReactTreeRef.current = true,\n onBlurCapture: () => isFocusInsideReactTreeRef.current = false\n };\n}\nfunction dispatchUpdate() {\n const event = new CustomEvent(CONTEXT_UPDATE);\n document.dispatchEvent(event);\n}\nfunction handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {\n const target = detail.originalEvent.target;\n const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });\n if (handler) target.addEventListener(name, handler, { once: true });\n if (discrete) {\n dispatchDiscreteCustomEvent(target, event);\n } else {\n target.dispatchEvent(event);\n }\n}\nvar Root = DismissableLayer;\nvar Branch = DismissableLayerBranch;\nexport {\n Branch,\n DismissableLayer,\n DismissableLayerBranch,\n Root\n};\n//# sourceMappingURL=index.mjs.map\n","import {\n DismissableLayer,\n type DismissableLayerProps,\n} from \"@radix-ui/react-dismissable-layer\";\n\ntype DismissableWrapperProps = DismissableLayerProps & {\n id: string;\n layers: Array<string>;\n children: React.ReactNode;\n};\n\n//\n// Handles the logic for when a global action like \"esc\" or clicking outside\n// should close the modal. When stacking modals, we don't want to close the\n// modal if we are not on the top-most layer.\n//\nconst DismissableWrapper = ({\n id,\n layers,\n children,\n ...props\n}: DismissableWrapperProps) => {\n const isTopLayer = id === layers[layers.length - 1];\n\n if (isTopLayer) {\n return <DismissableLayer {...props}>{children}</DismissableLayer>;\n }\n\n return <>{children}</>;\n};\n\nexport { DismissableWrapper };\n","import React from \"react\";\n\ntype AddLayerOptions = {\n layer?: number;\n};\n\nconst ModalStackingContext = React.createContext<{\n layers: Array<string>;\n setLayers: React.Dispatch<React.SetStateAction<Array<string>>>;\n addLayer: (id: string, options: AddLayerOptions) => void;\n removeLayer: (id: string) => void;\n removeTopLayer: () => void;\n}>({\n layers: [],\n setLayers: () => {},\n addLayer: () => {},\n removeLayer: () => {},\n removeTopLayer: () => {},\n});\n\ntype ModalStackingProviderProps = {\n children: React.ReactNode;\n};\n\nconst ModalStackingProvider = ({ children }: ModalStackingProviderProps) => {\n const [layers, setLayers] = React.useState<Array<string>>([]);\n\n const addLayer = (id: string, options: AddLayerOptions = {}) => {\n const { layer } = options;\n\n // If a layer is specified, insert the layer at the specified index\n // so that the modal renders at the correct layer in the stack.\n if (typeof layer === \"number\") {\n return setLayers((current) => {\n if (current.length - 1 < layer) {\n return [...current, id];\n }\n\n return [...current.slice(0, layer), id, ...current.slice(layer)];\n });\n } else {\n setLayers((current) => [...current, id]);\n }\n };\n\n const removeLayer = (id: string) => {\n setLayers(layers.filter((layer) => layer !== id));\n };\n\n const removeTopLayer = () => {\n const id = layers[layers.length - 1];\n if (!id) return;\n removeLayer(id);\n };\n\n return (\n <ModalStackingContext.Provider\n value={{ layers, setLayers, addLayer, removeLayer, removeTopLayer }}\n >\n {children}\n </ModalStackingContext.Provider>\n );\n};\n\nconst useModalStacking = () => {\n return React.useContext(ModalStackingContext);\n};\n\nexport { ModalStackingProvider, useModalStacking };\n","import * as Dialog from \"@radix-ui/react-dialog\";\nimport { FocusScope } from \"@radix-ui/react-focus-scope\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport * as VisuallyHidden from \"@radix-ui/react-visually-hidden\";\nimport { Button } from \"@telegraph/button\";\nimport type { Required } from \"@telegraph/helpers\";\nimport type {\n PolymorphicProps,\n TgphComponentProps,\n TgphElement,\n} from \"@telegraph/helpers\";\nimport { Lucide } from \"@telegraph/icon\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport React from \"react\";\n\nimport { DismissableWrapper } from \"./Modal.helpers\";\nimport { useModalStacking } from \"./ModalStacking\";\n\ntype RootProps = Omit<\n React.ComponentPropsWithoutRef<typeof Dialog.Root>,\n \"modal\"\n> &\n TgphComponentProps<typeof Stack> & {\n a11yTitle: string;\n a11yDescription?: string;\n layer?: number;\n };\n\nconst Root = ({\n defaultOpen: defaultOpenProp,\n open: openProp,\n onOpenChange: onOpenChangeProp,\n ...props\n}: RootProps) => {\n const [open, onOpenChange] = useControllableState({\n prop: openProp,\n onChange: onOpenChangeProp,\n defaultProp: defaultOpenProp,\n });\n\n // Prevent rendering anything within the modal if it is not open\n if (!open) return;\n\n return <RootComponent open={open} onOpenChange={onOpenChange} {...props} />;\n};\n\nconst RootComponent = ({\n open,\n onOpenChange,\n a11yTitle,\n a11yDescription,\n children,\n layer: layerProp,\n ...props\n}: Required<RootProps, \"open\" | \"onOpenChange\">) => {\n const id = React.useId();\n const stacking = useModalStacking();\n\n React.useEffect(() => {\n if (!stacking || !open || stacking.layers.includes(id)) return;\n stacking.addLayer(id, { layer: layerProp });\n }, [id, layerProp, stacking, open]);\n\n const layer = stacking.layers?.indexOf(id) || 0;\n const layersLength = stacking.layers?.length || 0;\n const isStacked = layer !== 0;\n\n return (\n <DismissableWrapper\n id={id}\n layers={stacking.layers}\n onEscapeKeyDown={(event) => {\n event.preventDefault();\n stacking.removeTopLayer();\n onOpenChange(false);\n }}\n onPointerDownOutside={(event) => {\n event.preventDefault();\n stacking.removeTopLayer();\n onOpenChange(false);\n }}\n >\n <Dialog.Root\n open={open}\n onOpenChange={(value) => {\n const hasLayers = stacking?.layers?.length > 0;\n\n if (hasLayers) {\n if (\n value === false &&\n id === stacking.layers[stacking.layers.length - 1]\n ) {\n stacking.removeLayer(id);\n return onOpenChange(false);\n }\n // If the modal is not the top layer, do not call onOpenChange\n // when we are stacking the modals\n return;\n }\n\n onOpenChange(value);\n }}\n key={id}\n >\n <VisuallyHidden.Root>\n <Dialog.Title>{a11yTitle}</Dialog.Title>\n {a11yDescription && (\n <Dialog.Description>{a11yDescription}</Dialog.Description>\n )}\n </VisuallyHidden.Root>\n <AnimatePresence>\n {open && (\n <Overlay layer={layer}>\n <Stack\n as={motion.div}\n initial={{\n top: `calc(var(--tgph-spacing-16) + var(--tgph-spacing-4) * ${layersLength - 1})`,\n }}\n animate={{\n top: isStacked\n ? `calc(var(--tgph-spacing-16) + var(--tgph-spacing-4) * ${layer} )`\n : \"var(--tgph-spacing-16)\",\n }}\n exit={{ top: 0 }}\n transition={{ type: \"spring\", duration: 0.3, bounce: 0 }}\n w=\"full\"\n justify=\"center\"\n style={{\n position: \"fixed\",\n left: 0,\n maxHeight: \"calc(100vh - var(--tgph-spacing-32))\",\n maxWidth: \"calc(100vw - var(--tgph-spacing-8))\",\n zIndex: `calc(var(--tgph-zIndex-modal) + ${layer})`,\n }}\n key={`container-${id}`}\n >\n <Stack\n direction=\"column\"\n as={motion.div}\n animate={{\n scale: 1.02 - Math.abs(layersLength - layer) * 0.02,\n transformOrigin: \"center center\",\n }}\n transition={{ duration: 0.2, bounce: 0, type: \"spring\" }}\n maxW={props.maxW ?? \"160\"}\n w={props.w ?? \"full\"}\n bg=\"surface-1\"\n border=\"px\"\n rounded=\"4\"\n shadow=\"3\"\n key={`content-${id}`}\n {...props}\n >\n {children}\n </Stack>\n </Stack>\n </Overlay>\n )}\n </AnimatePresence>\n </Dialog.Root>\n </DismissableWrapper>\n );\n};\n\ntype OverlayProps = TgphComponentProps<typeof Box> & {\n layer: number;\n};\n\nconst Overlay = ({ layer, children }: OverlayProps) => {\n // If the layer is greater than 0, we don't want to show this\n // overlay as to not stack the overlays on top of each other.\n if (layer > 0) return children;\n return (\n <Dialog.Overlay>\n <Box\n as={motion.div}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.3, bounce: 0, type: \"spring\" }}\n bg=\"alpha-black-6\"\n w=\"full\"\n h=\"full\"\n zIndex=\"overlay\"\n style={{\n position: \"fixed\",\n cursor: \"pointer\",\n inset: \"0px\",\n }}\n />\n {children}\n </Dialog.Overlay>\n );\n};\n\ntype ContentProps = React.ComponentPropsWithoutRef<typeof Dialog.Content> &\n TgphComponentProps<typeof Stack>;\ntype ContentRef = React.ElementRef<typeof Dialog.Content>;\n\nconst Content = React.forwardRef<ContentRef, ContentProps>(\n ({ children, ...props }, forwardedRef) => {\n return (\n <FocusScope trapped={true}>\n <Dialog.Content ref={forwardedRef} asChild {...props}>\n <Stack direction=\"column\" h=\"full\" {...props}>\n {children}\n </Stack>\n </Dialog.Content>\n </FocusScope>\n );\n },\n);\n\ntype CloseProps<T extends TgphElement> = TgphComponentProps<typeof Button<T>> &\n Omit<React.ComponentPropsWithoutRef<typeof Dialog.Close>, \"color\">;\nconst Close = <T extends TgphElement>({\n size = \"1\",\n variant = \"ghost\",\n ...props\n}: CloseProps<T>) => {\n return (\n <Dialog.Close asChild>\n <Button\n icon={{ icon: Lucide.X, alt: \"Close Modal\" }}\n variant={variant}\n size={size}\n {...props}\n />\n </Dialog.Close>\n );\n};\n\ntype BodyProps<T extends TgphElement> = PolymorphicProps<T> &\n TgphComponentProps<typeof Stack>;\n\nconst Body = <T extends TgphElement>({ children, ...props }: BodyProps<T>) => {\n return (\n <Stack direction=\"column\" px=\"6\" py=\"4\" {...props}>\n {children}\n </Stack>\n );\n};\n\ntype HeaderProps<T extends TgphElement> = PolymorphicProps<T> &\n TgphComponentProps<typeof Stack>;\n\nconst Header = <T extends TgphElement>({\n children,\n ...props\n}: HeaderProps<T>) => {\n return (\n <Stack\n direction=\"row\"\n justify=\"space-between\"\n align=\"center\"\n px=\"6\"\n py=\"4\"\n borderBottom=\"px\"\n {...props}\n >\n {children}\n </Stack>\n );\n};\n\ntype FooterProps<T extends TgphElement> = PolymorphicProps<T> &\n TgphComponentProps<typeof Stack>;\n\nconst Footer = <T extends TgphElement>({\n children,\n ...props\n}: FooterProps<T>) => {\n return (\n <Stack\n direction=\"row\"\n align=\"center\"\n justify=\"flex-end\"\n gap=\"2\"\n px=\"6\"\n py=\"4\"\n borderTop=\"px\"\n {...props}\n >\n {children}\n </Stack>\n );\n};\n\nconst Modal = {} as {\n Root: typeof Root;\n Content: typeof Content;\n Close: typeof Close;\n Body: typeof Body;\n Header: typeof Header;\n Footer: typeof Footer;\n};\n\nObject.assign(Modal, {\n Root,\n Content,\n Close,\n Body,\n Header,\n Footer,\n});\n\nexport { Modal };\n"],"names":["useCallbackRef","callback","callbackRef","React","args","_a","useControllableState","prop","defaultProp","onChange","uncontrolledProp","setUncontrolledProp","useUncontrolledState","isControlled","value","handleChange","setValue","nextValue","value2","uncontrolledState","prevValueRef","composeEventHandlers","originalEventHandler","ourEventHandler","checkForDefaultPrevented","event","setRef","ref","composeRefs","refs","node","Slot","props","forwardedRef","children","slotProps","childrenArray","slottable","isSlottable","newElement","newChildren","child","jsx","SlotClone","childrenRef","getElementRef","mergeProps","Slottable","Fragment","childProps","overrideProps","propName","slotPropValue","childPropValue","element","getter","mayWarn","_b","NODES","Primitive","primitive","Node","asChild","primitiveProps","Comp","dispatchDiscreteCustomEvent","target","ReactDOM","useComposedRefs","useEscapeKeydown","onEscapeKeyDownProp","ownerDocument","onEscapeKeyDown","handleKeyDown","DISMISSABLE_LAYER_NAME","CONTEXT_UPDATE","POINTER_DOWN_OUTSIDE","FOCUS_OUTSIDE","originalBodyPointerEvents","DismissableLayerContext","DismissableLayer","disableOutsidePointerEvents","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","layerProps","context","setNode","force","composedRefs","node2","layers","highestLayerWithOutsidePointerEventsDisabled","highestLayerWithOutsidePointerEventsDisabledIndex","index","isBodyPointerEventsDisabled","isPointerEventsEnabled","pointerDownOutside","usePointerDownOutside","isPointerDownOnBranch","branch","focusOutside","useFocusOutside","dispatchUpdate","handleUpdate","BRANCH_NAME","DismissableLayerBranch","handlePointerDownOutside","isPointerInsideReactTreeRef","handleClickRef","handlePointerDown","handleAndDispatchPointerDownOutsideEvent2","handleAndDispatchCustomEvent","eventDetail","timerId","handleFocusOutside","isFocusInsideReactTreeRef","handleFocus","name","handler","detail","discrete","DismissableWrapper","id","ModalStackingContext","ModalStackingProvider","setLayers","addLayer","options","layer","current","removeLayer","removeTopLayer","useModalStacking","Root","defaultOpenProp","openProp","onOpenChangeProp","open","onOpenChange","RootComponent","a11yTitle","a11yDescription","layerProp","stacking","layersLength","isStacked","jsxs","Dialog","VisuallyHidden","AnimatePresence","Overlay","Stack","motion","Box","Content","FocusScope","Close","size","variant","Button","Lucide","Body","Header","Footer","Modal"],"mappings":";;;;;;;;;;;AAEA,SAASA,EAAeC,GAAU;AAChC,QAAMC,IAAcC,EAAM,OAAOF,CAAQ;AACzC,SAAAE,EAAM,UAAU,MAAM;AACpB,IAAAD,EAAY,UAAUD;AAAA,EAC1B,CAAG,GACME,EAAM,QAAQ,MAAM,IAAIC,MAAI;;AAAK,YAAAC,IAAAH,EAAY,YAAZ,gBAAAG,EAAA,KAAAH,GAAsB,GAAGE;AAAA,KAAO,CAAA,CAAE;AAC5E;ACLA,SAASE,GAAqB;AAAA,EAC5B,MAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC,IAAW,MAAM;AAAA,EAChB;AACH,GAAG;AACD,QAAM,CAACC,GAAkBC,CAAmB,IAAIC,GAAqB,EAAE,aAAAJ,GAAa,UAAAC,EAAQ,CAAE,GACxFI,IAAeN,MAAS,QACxBO,IAAQD,IAAeN,IAAOG,GAC9BK,IAAef,EAAeS,CAAQ,GACtCO,IAAWb,EAAM;AAAA,IACrB,CAACc,MAAc;AACb,UAAIJ,GAAc;AAEhB,cAAMK,IAAS,OAAOD,KAAc,aADrBA,EACyCV,CAAI,IAAIU;AAChE,QAAIC,MAAWX,KAAMQ,EAAaG,CAAM;AAAA,MAChD;AACQ,QAAAP,EAAoBM,CAAS;AAAA,IAEhC;AAAA,IACD,CAACJ,GAAcN,GAAMI,GAAqBI,CAAY;AAAA,EAC1D;AACE,SAAO,CAACD,GAAOE,CAAQ;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H;AAAA,EAAA;AAAA,IACC,MAAM,EAAE,MAAMC,EAAO,GAAG,KAAK,cAAc;AAAA,IAC3C,SAAAF;AAAA,IACA,MAAAD;AAAA,IACC,GAAG/H;AAAA,EAAA;AAER,EAAA,CAAA,GAOEmI,KAAO,CAAwB,EAAE,UAAAjI,GAAU,GAAGF,QAEhD,gBAAAU,EAAC+G,GAAM,EAAA,WAAU,UAAS,IAAG,KAAI,IAAG,KAAK,GAAGzH,GACzC,UAAAE,EACH,CAAA,GAOEkI,KAAS,CAAwB;AAAA,EACrC,UAAAlI;AAAA,EACA,GAAGF;AACL,MAEI,gBAAAU;AAAA,EAAC+G;AAAA,EAAA;AAAA,IACC,WAAU;AAAA,IACV,SAAQ;AAAA,IACR,OAAM;AAAA,IACN,IAAG;AAAA,IACH,IAAG;AAAA,IACH,cAAa;AAAA,IACZ,GAAGzH;AAAA,IAEH,UAAAE;AAAA,EAAA;AAAA,GAQDmI,KAAS,CAAwB;AAAA,EACrC,UAAAnI;AAAA,EACA,GAAGF;AACL,MAEI,gBAAAU;AAAA,EAAC+G;AAAA,EAAA;AAAA,IACC,WAAU;AAAA,IACV,OAAM;AAAA,IACN,SAAQ;AAAA,IACR,KAAI;AAAA,IACJ,IAAG;AAAA,IACH,IAAG;AAAA,IACH,WAAU;AAAA,IACT,GAAGzH;AAAA,IAEH,UAAAE;AAAA,EAAA;AAAA,GAKDoI,KAAQ,CAAC;AASf,OAAO,OAAOA,IAAO;AAAA,EACnB,MAAA/B;AAAA,EACA,SAAAqB;AAAA,EACA,OAAAE;AAAA,EACA,MAAAK;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AACF,CAAC;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9]}
1
+ {"version":3,"file":"index.mjs","sources":["../../../../node_modules/@radix-ui/react-use-controllable-state/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs","../../../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/primitive/dist/index.mjs","../../../../node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.mjs","../../../../node_modules/@radix-ui/react-slot/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-primitive/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-compose-refs/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs","../../../../node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs","../../src/Modal/Modal.helpers.tsx","../../src/Modal/ModalStacking.tsx","../../src/Modal/Modal.tsx"],"sourcesContent":["// packages/react/use-callback-ref/src/useCallbackRef.tsx\nimport * as React from \"react\";\nfunction useCallbackRef(callback) {\n const callbackRef = React.useRef(callback);\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);\n}\nexport {\n useCallbackRef\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/use-controllable-state/src/useControllableState.tsx\nimport * as React from \"react\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nfunction useControllableState({\n prop,\n defaultProp,\n onChange = () => {\n }\n}) {\n const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });\n const isControlled = prop !== void 0;\n const value = isControlled ? prop : uncontrolledProp;\n const handleChange = useCallbackRef(onChange);\n const setValue = React.useCallback(\n (nextValue) => {\n if (isControlled) {\n const setter = nextValue;\n const value2 = typeof nextValue === \"function\" ? setter(prop) : nextValue;\n if (value2 !== prop) handleChange(value2);\n } else {\n setUncontrolledProp(nextValue);\n }\n },\n [isControlled, prop, setUncontrolledProp, handleChange]\n );\n return [value, setValue];\n}\nfunction useUncontrolledState({\n defaultProp,\n onChange\n}) {\n const uncontrolledState = React.useState(defaultProp);\n const [value] = uncontrolledState;\n const prevValueRef = React.useRef(value);\n const handleChange = useCallbackRef(onChange);\n React.useEffect(() => {\n if (prevValueRef.current !== value) {\n handleChange(value);\n prevValueRef.current = value;\n }\n }, [value, prevValueRef, handleChange]);\n return uncontrolledState;\n}\nexport {\n useControllableState\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/core/primitive/src/primitive.tsx\nfunction composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {\n return function handleEvent(event) {\n originalEventHandler?.(event);\n if (checkForDefaultPrevented === false || !event.defaultPrevented) {\n return ourEventHandler?.(event);\n }\n };\n}\nexport {\n composeEventHandlers\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/compose-refs/src/composeRefs.tsx\nimport * as React from \"react\";\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null && ref !== void 0) {\n ref.current = value;\n }\n}\nfunction composeRefs(...refs) {\n return (node) => refs.forEach((ref) => setRef(ref, node));\n}\nfunction useComposedRefs(...refs) {\n return React.useCallback(composeRefs(...refs), refs);\n}\nexport {\n composeRefs,\n useComposedRefs\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/slot/src/Slot.tsx\nimport * as React from \"react\";\nimport { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { Fragment, jsx } from \"react/jsx-runtime\";\nvar Slot = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n if (slottable) {\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement) ? newElement.props.children : null;\n } else {\n return child;\n }\n });\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });\n }\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });\n});\nSlot.displayName = \"Slot\";\nvar SlotClone = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n return React.cloneElement(children, {\n ...mergeProps(slotProps, children.props),\n // @ts-ignore\n ref: forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef\n });\n }\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n});\nSlotClone.displayName = \"SlotClone\";\nvar Slottable = ({ children }) => {\n return /* @__PURE__ */ jsx(Fragment, { children });\n};\nfunction isSlottable(child) {\n return React.isValidElement(child) && child.type === Slottable;\n}\nfunction mergeProps(slotProps, childProps) {\n const overrideProps = { ...childProps };\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args) => {\n childPropValue(...args);\n slotPropValue(...args);\n };\n } else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n } else if (propName === \"style\") {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === \"className\") {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(\" \");\n }\n }\n return { ...slotProps, ...overrideProps };\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nvar Root = Slot;\nexport {\n Root,\n Slot,\n Slottable\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/primitive/src/Primitive.tsx\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nvar NODES = [\n \"a\",\n \"button\",\n \"div\",\n \"form\",\n \"h2\",\n \"h3\",\n \"img\",\n \"input\",\n \"label\",\n \"li\",\n \"nav\",\n \"ol\",\n \"p\",\n \"span\",\n \"svg\",\n \"ul\"\n];\nvar Primitive = NODES.reduce((primitive, node) => {\n const Node = React.forwardRef((props, forwardedRef) => {\n const { asChild, ...primitiveProps } = props;\n const Comp = asChild ? Slot : node;\n if (typeof window !== \"undefined\") {\n window[Symbol.for(\"radix-ui\")] = true;\n }\n return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });\n });\n Node.displayName = `Primitive.${node}`;\n return { ...primitive, [node]: Node };\n}, {});\nfunction dispatchDiscreteCustomEvent(target, event) {\n if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));\n}\nvar Root = Primitive;\nexport {\n Primitive,\n Root,\n dispatchDiscreteCustomEvent\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/compose-refs/src/composeRefs.tsx\nimport * as React from \"react\";\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null && ref !== void 0) {\n ref.current = value;\n }\n}\nfunction composeRefs(...refs) {\n return (node) => refs.forEach((ref) => setRef(ref, node));\n}\nfunction useComposedRefs(...refs) {\n return React.useCallback(composeRefs(...refs), refs);\n}\nexport {\n composeRefs,\n useComposedRefs\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/use-callback-ref/src/useCallbackRef.tsx\nimport * as React from \"react\";\nfunction useCallbackRef(callback) {\n const callbackRef = React.useRef(callback);\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);\n}\nexport {\n useCallbackRef\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/use-escape-keydown/src/useEscapeKeydown.tsx\nimport * as React from \"react\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nfunction useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {\n const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);\n React.useEffect(() => {\n const handleKeyDown = (event) => {\n if (event.key === \"Escape\") {\n onEscapeKeyDown(event);\n }\n };\n ownerDocument.addEventListener(\"keydown\", handleKeyDown, { capture: true });\n return () => ownerDocument.removeEventListener(\"keydown\", handleKeyDown, { capture: true });\n }, [onEscapeKeyDown, ownerDocument]);\n}\nexport {\n useEscapeKeydown\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// packages/react/dismissable-layer/src/DismissableLayer.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { Primitive, dispatchDiscreteCustomEvent } from \"@radix-ui/react-primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useEscapeKeydown } from \"@radix-ui/react-use-escape-keydown\";\nimport { jsx } from \"react/jsx-runtime\";\nvar DISMISSABLE_LAYER_NAME = \"DismissableLayer\";\nvar CONTEXT_UPDATE = \"dismissableLayer.update\";\nvar POINTER_DOWN_OUTSIDE = \"dismissableLayer.pointerDownOutside\";\nvar FOCUS_OUTSIDE = \"dismissableLayer.focusOutside\";\nvar originalBodyPointerEvents;\nvar DismissableLayerContext = React.createContext({\n layers: /* @__PURE__ */ new Set(),\n layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),\n branches: /* @__PURE__ */ new Set()\n});\nvar DismissableLayer = React.forwardRef(\n (props, forwardedRef) => {\n const {\n disableOutsidePointerEvents = false,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n ...layerProps\n } = props;\n const context = React.useContext(DismissableLayerContext);\n const [node, setNode] = React.useState(null);\n const ownerDocument = node?.ownerDocument ?? globalThis?.document;\n const [, force] = React.useState({});\n const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));\n const layers = Array.from(context.layers);\n const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);\n const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);\n const index = node ? layers.indexOf(node) : -1;\n const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;\n const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;\n const pointerDownOutside = usePointerDownOutside((event) => {\n const target = event.target;\n const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));\n if (!isPointerEventsEnabled || isPointerDownOnBranch) return;\n onPointerDownOutside?.(event);\n onInteractOutside?.(event);\n if (!event.defaultPrevented) onDismiss?.();\n }, ownerDocument);\n const focusOutside = useFocusOutside((event) => {\n const target = event.target;\n const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));\n if (isFocusInBranch) return;\n onFocusOutside?.(event);\n onInteractOutside?.(event);\n if (!event.defaultPrevented) onDismiss?.();\n }, ownerDocument);\n useEscapeKeydown((event) => {\n const isHighestLayer = index === context.layers.size - 1;\n if (!isHighestLayer) return;\n onEscapeKeyDown?.(event);\n if (!event.defaultPrevented && onDismiss) {\n event.preventDefault();\n onDismiss();\n }\n }, ownerDocument);\n React.useEffect(() => {\n if (!node) return;\n if (disableOutsidePointerEvents) {\n if (context.layersWithOutsidePointerEventsDisabled.size === 0) {\n originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;\n ownerDocument.body.style.pointerEvents = \"none\";\n }\n context.layersWithOutsidePointerEventsDisabled.add(node);\n }\n context.layers.add(node);\n dispatchUpdate();\n return () => {\n if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {\n ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;\n }\n };\n }, [node, ownerDocument, disableOutsidePointerEvents, context]);\n React.useEffect(() => {\n return () => {\n if (!node) return;\n context.layers.delete(node);\n context.layersWithOutsidePointerEventsDisabled.delete(node);\n dispatchUpdate();\n };\n }, [node, context]);\n React.useEffect(() => {\n const handleUpdate = () => force({});\n document.addEventListener(CONTEXT_UPDATE, handleUpdate);\n return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);\n }, []);\n return /* @__PURE__ */ jsx(\n Primitive.div,\n {\n ...layerProps,\n ref: composedRefs,\n style: {\n pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? \"auto\" : \"none\" : void 0,\n ...props.style\n },\n onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),\n onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),\n onPointerDownCapture: composeEventHandlers(\n props.onPointerDownCapture,\n pointerDownOutside.onPointerDownCapture\n )\n }\n );\n }\n);\nDismissableLayer.displayName = DISMISSABLE_LAYER_NAME;\nvar BRANCH_NAME = \"DismissableLayerBranch\";\nvar DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {\n const context = React.useContext(DismissableLayerContext);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n React.useEffect(() => {\n const node = ref.current;\n if (node) {\n context.branches.add(node);\n return () => {\n context.branches.delete(node);\n };\n }\n }, [context.branches]);\n return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });\n});\nDismissableLayerBranch.displayName = BRANCH_NAME;\nfunction usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {\n const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);\n const isPointerInsideReactTreeRef = React.useRef(false);\n const handleClickRef = React.useRef(() => {\n });\n React.useEffect(() => {\n const handlePointerDown = (event) => {\n if (event.target && !isPointerInsideReactTreeRef.current) {\n let handleAndDispatchPointerDownOutsideEvent2 = function() {\n handleAndDispatchCustomEvent(\n POINTER_DOWN_OUTSIDE,\n handlePointerDownOutside,\n eventDetail,\n { discrete: true }\n );\n };\n var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;\n const eventDetail = { originalEvent: event };\n if (event.pointerType === \"touch\") {\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;\n ownerDocument.addEventListener(\"click\", handleClickRef.current, { once: true });\n } else {\n handleAndDispatchPointerDownOutsideEvent2();\n }\n } else {\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n }\n isPointerInsideReactTreeRef.current = false;\n };\n const timerId = window.setTimeout(() => {\n ownerDocument.addEventListener(\"pointerdown\", handlePointerDown);\n }, 0);\n return () => {\n window.clearTimeout(timerId);\n ownerDocument.removeEventListener(\"pointerdown\", handlePointerDown);\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n };\n }, [ownerDocument, handlePointerDownOutside]);\n return {\n // ensures we check React component tree (not just DOM tree)\n onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true\n };\n}\nfunction useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {\n const handleFocusOutside = useCallbackRef(onFocusOutside);\n const isFocusInsideReactTreeRef = React.useRef(false);\n React.useEffect(() => {\n const handleFocus = (event) => {\n if (event.target && !isFocusInsideReactTreeRef.current) {\n const eventDetail = { originalEvent: event };\n handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {\n discrete: false\n });\n }\n };\n ownerDocument.addEventListener(\"focusin\", handleFocus);\n return () => ownerDocument.removeEventListener(\"focusin\", handleFocus);\n }, [ownerDocument, handleFocusOutside]);\n return {\n onFocusCapture: () => isFocusInsideReactTreeRef.current = true,\n onBlurCapture: () => isFocusInsideReactTreeRef.current = false\n };\n}\nfunction dispatchUpdate() {\n const event = new CustomEvent(CONTEXT_UPDATE);\n document.dispatchEvent(event);\n}\nfunction handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {\n const target = detail.originalEvent.target;\n const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });\n if (handler) target.addEventListener(name, handler, { once: true });\n if (discrete) {\n dispatchDiscreteCustomEvent(target, event);\n } else {\n target.dispatchEvent(event);\n }\n}\nvar Root = DismissableLayer;\nvar Branch = DismissableLayerBranch;\nexport {\n Branch,\n DismissableLayer,\n DismissableLayerBranch,\n Root\n};\n//# sourceMappingURL=index.mjs.map\n","import {\n DismissableLayer,\n type DismissableLayerProps,\n} from \"@radix-ui/react-dismissable-layer\";\n\ntype DismissableWrapperProps = DismissableLayerProps & {\n id: string;\n layers: Array<string>;\n children: React.ReactNode;\n};\n\n//\n// Handles the logic for when a global action like \"esc\" or clicking outside\n// should close the modal. When stacking modals, we don't want to close the\n// modal if we are not on the top-most layer.\n//\nconst DismissableWrapper = ({\n id,\n layers,\n children,\n ...props\n}: DismissableWrapperProps) => {\n const isTopLayer = id === layers[layers.length - 1];\n\n if (isTopLayer) {\n return <DismissableLayer {...props}>{children}</DismissableLayer>;\n }\n\n return <>{children}</>;\n};\n\nexport { DismissableWrapper };\n","import React from \"react\";\n\ntype AddLayerOptions = {\n layer?: number;\n};\n\nconst ModalStackingContext = React.createContext<{\n layers: Array<string>;\n setLayers: React.Dispatch<React.SetStateAction<Array<string>>>;\n addLayer: (id: string, options: AddLayerOptions) => void;\n removeLayer: (id: string) => void;\n removeTopLayer: () => void;\n}>({\n layers: [],\n setLayers: () => {},\n addLayer: () => {},\n removeLayer: () => {},\n removeTopLayer: () => {},\n});\n\ntype ModalStackingProviderProps = {\n children: React.ReactNode;\n};\n\nconst ModalStackingProvider = ({ children }: ModalStackingProviderProps) => {\n const [layers, setLayers] = React.useState<Array<string>>([]);\n\n const addLayer = (id: string, options: AddLayerOptions = {}) => {\n const { layer } = options;\n\n // If a layer is specified, insert the layer at the specified index\n // so that the modal renders at the correct layer in the stack.\n if (typeof layer === \"number\") {\n return setLayers((current) => {\n if (current.length - 1 < layer) {\n return [...current, id];\n }\n\n return [...current.slice(0, layer), id, ...current.slice(layer)];\n });\n } else {\n setLayers((current) => [...current, id]);\n }\n };\n\n const removeLayer = (id: string) => {\n setLayers(layers.filter((layer) => layer !== id));\n };\n\n const removeTopLayer = () => {\n const id = layers[layers.length - 1];\n if (!id) return;\n removeLayer(id);\n };\n\n return (\n <ModalStackingContext.Provider\n value={{ layers, setLayers, addLayer, removeLayer, removeTopLayer }}\n >\n {children}\n </ModalStackingContext.Provider>\n );\n};\n\nconst useModalStacking = () => {\n return React.useContext(ModalStackingContext);\n};\n\nexport { ModalStackingProvider, useModalStacking };\n","import * as Dialog from \"@radix-ui/react-dialog\";\nimport { FocusScope } from \"@radix-ui/react-focus-scope\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport * as VisuallyHidden from \"@radix-ui/react-visually-hidden\";\nimport { Button } from \"@telegraph/button\";\nimport { RefToTgphRef, type Required } from \"@telegraph/helpers\";\nimport type {\n PolymorphicProps,\n TgphComponentProps,\n TgphElement,\n} from \"@telegraph/helpers\";\nimport { Lucide } from \"@telegraph/icon\";\nimport { Box, Stack } from \"@telegraph/layout\";\nimport { AnimatePresence, motion } from \"framer-motion\";\nimport React from \"react\";\n\nimport { DismissableWrapper } from \"./Modal.helpers\";\nimport { useModalStacking } from \"./ModalStacking\";\n\ntype RootProps = Omit<\n React.ComponentPropsWithoutRef<typeof Dialog.Root>,\n \"modal\"\n> &\n TgphComponentProps<typeof Stack> & {\n a11yTitle: string;\n a11yDescription?: string;\n layer?: number;\n };\n\nconst Root = ({\n defaultOpen: defaultOpenProp,\n open: openProp,\n onOpenChange: onOpenChangeProp,\n ...props\n}: RootProps) => {\n const [open, onOpenChange] = useControllableState({\n prop: openProp,\n onChange: onOpenChangeProp,\n defaultProp: defaultOpenProp,\n });\n\n // Prevent rendering anything within the modal if it is not open\n if (!open) return;\n\n return <RootComponent open={open} onOpenChange={onOpenChange} {...props} />;\n};\n\nconst RootComponent = ({\n open,\n onOpenChange,\n a11yTitle,\n a11yDescription,\n children,\n layer: layerProp,\n ...props\n}: Required<RootProps, \"open\" | \"onOpenChange\">) => {\n const id = React.useId();\n const stacking = useModalStacking();\n\n React.useEffect(() => {\n if (!stacking || !open || stacking.layers.includes(id)) return;\n stacking.addLayer(id, { layer: layerProp });\n }, [id, layerProp, stacking, open]);\n\n const layer = stacking.layers?.indexOf(id) || 0;\n const layersLength = stacking.layers?.length || 0;\n const isStacked = layer !== 0;\n\n return (\n <DismissableWrapper\n id={id}\n layers={stacking.layers}\n onEscapeKeyDown={(event) => {\n event.preventDefault();\n stacking.removeTopLayer();\n onOpenChange(false);\n }}\n onPointerDownOutside={(event) => {\n event.preventDefault();\n stacking.removeTopLayer();\n onOpenChange(false);\n }}\n >\n <Dialog.Root\n open={open}\n onOpenChange={(value) => {\n const hasLayers = stacking?.layers?.length > 0;\n\n if (hasLayers) {\n if (\n value === false &&\n id === stacking.layers[stacking.layers.length - 1]\n ) {\n stacking.removeLayer(id);\n return onOpenChange(false);\n }\n // If the modal is not the top layer, do not call onOpenChange\n // when we are stacking the modals\n return;\n }\n\n onOpenChange(value);\n }}\n key={id}\n >\n <VisuallyHidden.Root>\n <Dialog.Title>{a11yTitle}</Dialog.Title>\n {a11yDescription && (\n <Dialog.Description>{a11yDescription}</Dialog.Description>\n )}\n </VisuallyHidden.Root>\n <AnimatePresence>\n {open && (\n <Overlay layer={layer}>\n <Stack\n as={motion.div}\n initial={{\n top: `calc(var(--tgph-spacing-16) + var(--tgph-spacing-4) * ${layersLength - 1})`,\n }}\n animate={{\n top: isStacked\n ? `calc(var(--tgph-spacing-16) + var(--tgph-spacing-4) * ${layer} )`\n : \"var(--tgph-spacing-16)\",\n }}\n exit={{ top: 0 }}\n transition={{ type: \"spring\", duration: 0.3, bounce: 0 }}\n w=\"full\"\n justify=\"center\"\n style={{\n position: \"fixed\",\n left: 0,\n maxHeight: \"calc(100vh - var(--tgph-spacing-32))\",\n maxWidth: \"calc(100vw - var(--tgph-spacing-8))\",\n zIndex: `calc(var(--tgph-zIndex-modal) + ${layer})`,\n }}\n key={`container-${id}`}\n >\n <Stack\n direction=\"column\"\n as={motion.div}\n animate={{\n scale: 1.02 - Math.abs(layersLength - layer) * 0.02,\n transformOrigin: \"center center\",\n }}\n transition={{ duration: 0.2, bounce: 0, type: \"spring\" }}\n maxW={props.maxW ?? \"160\"}\n w={props.w ?? \"full\"}\n bg=\"surface-1\"\n border=\"px\"\n rounded=\"4\"\n shadow=\"3\"\n key={`content-${id}`}\n {...props}\n >\n {children}\n </Stack>\n </Stack>\n </Overlay>\n )}\n </AnimatePresence>\n </Dialog.Root>\n </DismissableWrapper>\n );\n};\n\ntype OverlayProps = TgphComponentProps<typeof Box> & {\n layer: number;\n};\n\nconst Overlay = ({ layer, children }: OverlayProps) => {\n // If the layer is greater than 0, we don't want to show this\n // overlay as to not stack the overlays on top of each other.\n if (layer > 0) return children;\n return (\n <Dialog.Overlay>\n <Box\n as={motion.div}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.3, bounce: 0, type: \"spring\" }}\n bg=\"alpha-black-6\"\n w=\"full\"\n h=\"full\"\n zIndex=\"overlay\"\n style={{\n position: \"fixed\",\n cursor: \"pointer\",\n inset: \"0px\",\n }}\n />\n {children}\n </Dialog.Overlay>\n );\n};\n\ntype ContentProps = React.ComponentPropsWithoutRef<typeof Dialog.Content> &\n TgphComponentProps<typeof Stack>;\ntype ContentRef = React.ElementRef<typeof Dialog.Content>;\n\nconst Content = React.forwardRef<ContentRef, ContentProps>(\n ({ children, ...props }, forwardedRef) => {\n return (\n <FocusScope trapped={true} asChild>\n <RefToTgphRef>\n <Dialog.Content ref={forwardedRef} asChild {...props}>\n <Stack direction=\"column\" h=\"full\" {...props}>\n {children}\n </Stack>\n </Dialog.Content>\n </RefToTgphRef>\n </FocusScope>\n );\n },\n);\n\ntype CloseProps<T extends TgphElement> = TgphComponentProps<typeof Button<T>> &\n Omit<React.ComponentPropsWithoutRef<typeof Dialog.Close>, \"color\">;\nconst Close = <T extends TgphElement>({\n size = \"1\",\n variant = \"ghost\",\n ...props\n}: CloseProps<T>) => {\n return (\n <Dialog.Close asChild>\n <Button\n icon={{ icon: Lucide.X, alt: \"Close Modal\" }}\n variant={variant}\n size={size}\n {...props}\n />\n </Dialog.Close>\n );\n};\n\ntype BodyProps<T extends TgphElement> = PolymorphicProps<T> &\n TgphComponentProps<typeof Stack>;\n\nconst Body = <T extends TgphElement>({\n style,\n children,\n ...props\n}: BodyProps<T>) => {\n return (\n <Stack\n direction=\"column\"\n px=\"6\"\n py=\"4\"\n style={{\n overflowY: \"auto\",\n ...style,\n }}\n {...props}\n >\n {children}\n </Stack>\n );\n};\n\ntype HeaderProps<T extends TgphElement> = PolymorphicProps<T> &\n TgphComponentProps<typeof Stack>;\n\nconst Header = <T extends TgphElement>({\n children,\n ...props\n}: HeaderProps<T>) => {\n return (\n <Stack\n direction=\"row\"\n justify=\"space-between\"\n align=\"center\"\n px=\"6\"\n py=\"4\"\n borderBottom=\"px\"\n {...props}\n >\n {children}\n </Stack>\n );\n};\n\ntype FooterProps<T extends TgphElement> = PolymorphicProps<T> &\n TgphComponentProps<typeof Stack>;\n\nconst Footer = <T extends TgphElement>({\n children,\n ...props\n}: FooterProps<T>) => {\n return (\n <Stack\n direction=\"row\"\n align=\"center\"\n justify=\"flex-end\"\n gap=\"2\"\n px=\"6\"\n py=\"4\"\n borderTop=\"px\"\n {...props}\n >\n {children}\n </Stack>\n );\n};\n\nconst Modal = {} as {\n Root: typeof Root;\n Content: typeof Content;\n Close: typeof Close;\n Body: typeof Body;\n Header: typeof Header;\n Footer: typeof Footer;\n};\n\nObject.assign(Modal, {\n Root,\n Content,\n Close,\n Body,\n Header,\n Footer,\n});\n\nexport { Modal };\n"],"names":["useCallbackRef","callback","callbackRef","React","args","_a","useControllableState","prop","defaultProp","onChange","uncontrolledProp","setUncontrolledProp","useUncontrolledState","isControlled","value","handleChange","setValue","nextValue","value2","uncontrolledState","prevValueRef","composeEventHandlers","originalEventHandler","ourEventHandler","checkForDefaultPrevented","event","setRef","ref","composeRefs","refs","node","Slot","props","forwardedRef","children","slotProps","childrenArray","slottable","isSlottable","newElement","newChildren","child","jsx","SlotClone","childrenRef","getElementRef","mergeProps","Slottable","Fragment","childProps","overrideProps","propName","slotPropValue","childPropValue","element","getter","mayWarn","_b","NODES","Primitive","primitive","Node","asChild","primitiveProps","Comp","dispatchDiscreteCustomEvent","target","ReactDOM","useComposedRefs","useEscapeKeydown","onEscapeKeyDownProp","ownerDocument","onEscapeKeyDown","handleKeyDown","DISMISSABLE_LAYER_NAME","CONTEXT_UPDATE","POINTER_DOWN_OUTSIDE","FOCUS_OUTSIDE","originalBodyPointerEvents","DismissableLayerContext","DismissableLayer","disableOutsidePointerEvents","onPointerDownOutside","onFocusOutside","onInteractOutside","onDismiss","layerProps","context","setNode","force","composedRefs","node2","layers","highestLayerWithOutsidePointerEventsDisabled","highestLayerWithOutsidePointerEventsDisabledIndex","index","isBodyPointerEventsDisabled","isPointerEventsEnabled","pointerDownOutside","usePointerDownOutside","isPointerDownOnBranch","branch","focusOutside","useFocusOutside","dispatchUpdate","handleUpdate","BRANCH_NAME","DismissableLayerBranch","handlePointerDownOutside","isPointerInsideReactTreeRef","handleClickRef","handlePointerDown","handleAndDispatchPointerDownOutsideEvent2","handleAndDispatchCustomEvent","eventDetail","timerId","handleFocusOutside","isFocusInsideReactTreeRef","handleFocus","name","handler","detail","discrete","DismissableWrapper","id","ModalStackingContext","ModalStackingProvider","setLayers","addLayer","options","layer","current","removeLayer","removeTopLayer","useModalStacking","Root","defaultOpenProp","openProp","onOpenChangeProp","open","onOpenChange","RootComponent","a11yTitle","a11yDescription","layerProp","stacking","layersLength","isStacked","jsxs","Dialog","VisuallyHidden","AnimatePresence","Overlay","Stack","motion","Box","Content","FocusScope","RefToTgphRef","Close","size","variant","Button","Lucide","Body","style","Header","Footer","Modal"],"mappings":";;;;;;;;;;;;AAEA,SAASA,EAAeC,GAAU;AAChC,QAAMC,IAAcC,EAAM,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AW;AAAA,MACX,GAAGY;AAAA,IACL;AAAA,IACC,GAAGrI;AAAA,IAEH,UAAAE;AAAA,EAAA;AAAA,GAQDoI,KAAS,CAAwB;AAAA,EACrC,UAAApI;AAAA,EACA,GAAGF;AACL,MAEI,gBAAAU;AAAA,EAAC+G;AAAA,EAAA;AAAA,IACC,WAAU;AAAA,IACV,SAAQ;AAAA,IACR,OAAM;AAAA,IACN,IAAG;AAAA,IACH,IAAG;AAAA,IACH,cAAa;AAAA,IACZ,GAAGzH;AAAA,IAEH,UAAAE;AAAA,EAAA;AAAA,GAQDqI,KAAS,CAAwB;AAAA,EACrC,UAAArI;AAAA,EACA,GAAGF;AACL,MAEI,gBAAAU;AAAA,EAAC+G;AAAA,EAAA;AAAA,IACC,WAAU;AAAA,IACV,OAAM;AAAA,IACN,SAAQ;AAAA,IACR,KAAI;AAAA,IACJ,IAAG;AAAA,IACH,IAAG;AAAA,IACH,WAAU;AAAA,IACT,GAAGzH;AAAA,IAEH,UAAAE;AAAA,EAAA;AAAA,GAKDsI,KAAQ,CAAC;AASf,OAAO,OAAOA,IAAO;AAAA,EACnB,MAAAjC;AAAA,EACA,SAAAqB;AAAA,EACA,OAAAG;AAAA,EACA,MAAAK;AAAA,EACA,QAAAE;AAAA,EACA,QAAAC;AACF,CAAC;","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9]}
@@ -14,7 +14,7 @@ declare const Content: React.ForwardRefExoticComponent<Omit<ContentProps, "ref">
14
14
  type CloseProps<T extends TgphElement> = TgphComponentProps<typeof Button<T>> & Omit<React.ComponentPropsWithoutRef<typeof Dialog.Close>, "color">;
15
15
  declare const Close: <T extends TgphElement>({ size, variant, ...props }: CloseProps<T>) => import("react/jsx-runtime").JSX.Element;
16
16
  type BodyProps<T extends TgphElement> = PolymorphicProps<T> & TgphComponentProps<typeof Stack>;
17
- declare const Body: <T extends TgphElement>({ children, ...props }: BodyProps<T>) => import("react/jsx-runtime").JSX.Element;
17
+ declare const Body: <T extends TgphElement>({ style, children, ...props }: BodyProps<T>) => import("react/jsx-runtime").JSX.Element;
18
18
  type HeaderProps<T extends TgphElement> = PolymorphicProps<T> & TgphComponentProps<typeof Stack>;
19
19
  declare const Header: <T extends TgphElement>({ children, ...props }: HeaderProps<T>) => import("react/jsx-runtime").JSX.Element;
20
20
  type FooterProps<T extends TgphElement> = PolymorphicProps<T> & TgphComponentProps<typeof Stack>;
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AAIjD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAO,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,KAAK,SAAS,GAAG,IAAI,CACnB,KAAK,CAAC,wBAAwB,CAAC,OAAO,MAAM,CAAC,IAAI,CAAC,EAClD,OAAO,CACR,GACC,kBAAkB,CAAC,OAAO,KAAK,CAAC,GAAG;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEJ,QAAA,MAAM,IAAI,+FAKP,SAAS,wDAWX,CAAC;AAuJF,KAAK,YAAY,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,MAAM,CAAC,OAAO,CAAC,GACvE,kBAAkB,CAAC,OAAO,KAAK,CAAC,CAAC;AAGnC,QAAA,MAAM,OAAO,kGAYZ,CAAC;AAEF,KAAK,UAAU,CAAC,CAAC,SAAS,WAAW,IAAI,kBAAkB,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,GAC3E,IAAI,CAAC,KAAK,CAAC,wBA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C,CAAC,SAAS,WAAW,IAAI,gBAAgB,CAAC,CAAC,CAAC,GAC3D,kBAAkB,CAAC,OAAO,KAAK,CAAC,CAAC;AAEnC,QAAA,MAAM,MAAM,GAAI,CAAC,SAAS,WAAW,0BAGlC,WAAW,CAAC,CAAC,CAAC,4CAchB,CAAC;AAEF,KAAK,WAAW,CAAC,CAAC,SAAS,WAAW,IAAI,gBAAgB,CAAC,CAAC,CAAC,GAC3D,kBAAkB,CAAC,OAAO,KAAK,CAAC,CAAC;AAEnC,QAAA,MAAM,MAAM,GAAI,CAAC,SAAS,WAAW,0BAGlC,WAAW,CAAC,CAAC,CAAC,4CAehB,CAAC;AAEF,QAAA,MAAM,KAAK,EAAS;IAClB,IAAI,EAAE,OAAO,IAAI,CAAC;IAClB,OAAO,EAAE,OAAO,OAAO,CAAC;IACxB,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,IAAI,EAAE,OAAO,IAAI,CAAC;IAClB,MAAM,EAAE,OAAO,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,MAAM,CAAC;CACvB,CAAC;AAWF,OAAO,EAAE,KAAK,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telegraph/modal",
3
- "version": "0.0.47",
3
+ "version": "0.0.48",
4
4
  "repository": "https://github.com/knocklabs/telegraph/tree/main/packages/modal",
5
5
  "author": "@knocklabs",
6
6
  "license": "MIT",