|
| 1 | +diff --git a/dist/index.module.js b/dist/index.module.js |
| 2 | +index 8195b87caaaf4dce9694171556953fc35545139b..664c9198f2146cdd40ce478519a8906991796fc9 100644 |
| 3 | +--- a/dist/index.module.js |
| 4 | ++++ b/dist/index.module.js |
| 5 | +@@ -1,2 +1,281 @@ |
| 6 | +-import{Slot as e}from"@radix-ui/react-slot";import{hideOthers as o}from"aria-hidden";import{RemoveScroll as t}from"react-remove-scroll";import{useFocusGuards as r}from"@radix-ui/react-focus-guards";import{Primitive as n}from"@radix-ui/react-primitive";import{Presence as a}from"@radix-ui/react-presence";import{UnstablePortal as i}from"@radix-ui/react-portal";import{FocusScope as l}from"@radix-ui/react-focus-scope";import{DismissableLayer as c}from"@radix-ui/react-dismissable-layer";import{useControllableState as s}from"@radix-ui/react-use-controllable-state";import{useId as u}from"@radix-ui/react-id";import{createContext as p,createContextScope as d}from"@radix-ui/react-context";import{useComposedRefs as f}from"@radix-ui/react-compose-refs";import{composeEventHandlers as g}from"@radix-ui/primitive";import*as m from"react";import D from"@babel/runtime/helpers/esm/extends";const[x,C]=d("Dialog");export{C as createDialogScope};const[v,E]=x("Dialog");export const Dialog=e=>{const{__scopeDialog:o,children:t,open:r,defaultOpen:n,onOpenChange:a,modal:i=!0,allowPinchZoom:l}=e,c=m.useRef(null),p=m.useRef(null),[d=!1,f]=s({prop:r,defaultProp:n,onChange:a});/*#__PURE__*/return m.createElement(v,{scope:o,triggerRef:c,contentRef:p,contentId:u(),titleId:u(),descriptionId:u(),open:d,onOpenChange:f,onOpenToggle:m.useCallback((()=>f((e=>!e))),[f]),modal:i,allowPinchZoom:l},t)};/*#__PURE__*/export const DialogTrigger=/*#__PURE__*/m.forwardRef(((e,o)=>{const{__scopeDialog:t,...r}=e,a=E("DialogTrigger",t),i=f(o,a.triggerRef);/*#__PURE__*/return m.createElement(n.button,D({type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":b(a.open)},r,{ref:i,onClick:g(e.onClick,a.onOpenToggle)}))}));/*#__PURE__*/export const DialogPortal=e=>{const{__scopeDialog:o,forceMount:t,children:r,container:n}=e,l=E("DialogPortal",o);/*#__PURE__*/return m.createElement(m.Fragment,null,m.Children.map(r,(e=>/*#__PURE__*/m.createElement(a,{present:t||l.open},/*#__PURE__*/m.createElement(i,{asChild:!0,container:n},e)))))};/*#__PURE__*/export const DialogOverlay=/*#__PURE__*/m.forwardRef(((e,o)=>{const{forceMount:t,...r}=e,n=E("DialogOverlay",e.__scopeDialog);return n.modal?/*#__PURE__*/m.createElement(a,{present:t||n.open},/*#__PURE__*/m.createElement(R,D({},r,{ref:o}))):null}));/*#__PURE__*/const R=/*#__PURE__*/m.forwardRef(((o,r)=>{const{__scopeDialog:a,...i}=o,l=E("DialogOverlay",a);/*#__PURE__*/return m.createElement(t,{as:e,allowPinchZoom:l.allowPinchZoom,shards:[l.contentRef]},/*#__PURE__*/m.createElement(n.div,D({"data-state":b(l.open)},i,{ref:r,style:{pointerEvents:"auto",...i.style}})))}));export const DialogContent=/*#__PURE__*/m.forwardRef(((e,o)=>{const{forceMount:t,...r}=e,n=E("DialogContent",e.__scopeDialog);/*#__PURE__*/return m.createElement(a,{present:t||n.open},n.modal?/*#__PURE__*/m.createElement(_,D({},r,{ref:o})):/*#__PURE__*/m.createElement(O,D({},r,{ref:o})))}));/*#__PURE__*/const _=/*#__PURE__*/m.forwardRef(((e,t)=>{const r=E("DialogContent",e.__scopeDialog),n=m.useRef(null),a=f(t,r.contentRef,n);return m.useEffect((()=>{const e=n.current;if(e)return o(e)}),[]),/*#__PURE__*/m.createElement(h,D({},e,{ref:a,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:g(e.onCloseAutoFocus,(e=>{var o;e.preventDefault(),null===(o=r.triggerRef.current)||void 0===o||o.focus()})),onPointerDownOutside:g(e.onPointerDownOutside,(e=>{const o=e.detail.originalEvent,t=0===o.button&&!0===o.ctrlKey;(2===o.button||t)&&e.preventDefault()})),onFocusOutside:g(e.onFocusOutside,(e=>e.preventDefault()))}))})),O=/*#__PURE__*/m.forwardRef(((e,o)=>{const t=E("DialogContent",e.__scopeDialog),r=m.useRef(!1);/*#__PURE__*/return m.createElement(h,D({},e,{ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var n,a;(null===(n=e.onCloseAutoFocus)||void 0===n||n.call(e,o),o.defaultPrevented)||(r.current||null===(a=t.triggerRef.current)||void 0===a||a.focus(),o.preventDefault());r.current=!1},onInteractOutside:o=>{var n,a;null===(n=e.onInteractOutside)||void 0===n||n.call(e,o),o.defaultPrevented||(r.current=!0);const i=o.target;(null===(a=t.triggerRef.current)||void 0===a?void 0:a.contains(i))&&o.preventDefault()}}))})),h=/*#__PURE__*/m.forwardRef(((e,o)=>{const{__scopeDialog:t,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:i,...s}=e,u=E("DialogContent",t),p=m.useRef(null),d=f(o,p);return r(),/*#__PURE__*/m.createElement(m.Fragment,null,/*#__PURE__*/m.createElement(l,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:i},/*#__PURE__*/m.createElement(c,D({role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":b(u.open)},s,{ref:d,onDismiss:()=>u.onOpenChange(!1)}))),!1)}));export const DialogTitle=/*#__PURE__*/m.forwardRef(((e,o)=>{const{__scopeDialog:t,...r}=e,a=E("DialogTitle",t);/*#__PURE__*/return m.createElement(n.h2,D({id:a.titleId},r,{ref:o}))}));/*#__PURE__*/export const DialogDescription=/*#__PURE__*/m.forwardRef(((e,o)=>{const{__scopeDialog:t,...r}=e,a=E("DialogDescription",t);/*#__PURE__*/return m.createElement(n.p,D({id:a.descriptionId},r,{ref:o}))}));/*#__PURE__*/export const DialogClose=/*#__PURE__*/m.forwardRef(((e,o)=>{const{__scopeDialog:t,...r}=e,a=E("DialogClose",t);/*#__PURE__*/return m.createElement(n.button,D({type:"button"},r,{ref:o,onClick:g(e.onClick,(()=>a.onOpenChange(!1)))}))}));/*#__PURE__*/function b(e){return e?"open":"closed"}const[w,F]=p("DialogTitleWarning",{contentName:"DialogContent",titleName:"DialogTitle",docsSlug:"dialog"});export{w as WarningProvider};export const Root=Dialog;export const Trigger=DialogTrigger;export const Portal=DialogPortal;export const Overlay=DialogOverlay;export const Content=DialogContent;export const Title=DialogTitle;export const Description=DialogDescription;export const Close=DialogClose; |
| 7 | ++import { Slot as e } from "@radix-ui/react-slot"; |
| 8 | ++import { hideOthers as o } from "aria-hidden"; |
| 9 | ++import { RemoveScroll as t } from "react-remove-scroll"; |
| 10 | ++import { useFocusGuards as r } from "@radix-ui/react-focus-guards"; |
| 11 | ++import { Primitive as n } from "@radix-ui/react-primitive"; |
| 12 | ++import { Presence as a } from "@radix-ui/react-presence"; |
| 13 | ++import { UnstablePortal as i } from "@radix-ui/react-portal"; |
| 14 | ++import { FocusScope as l } from "@radix-ui/react-focus-scope"; |
| 15 | ++import { DismissableLayer as c } from "@radix-ui/react-dismissable-layer"; |
| 16 | ++import { useControllableState as s } from "@radix-ui/react-use-controllable-state"; |
| 17 | ++import { useId as u } from "@radix-ui/react-id"; |
| 18 | ++import { |
| 19 | ++ createContext as p, |
| 20 | ++ createContextScope as d, |
| 21 | ++} from "@radix-ui/react-context"; |
| 22 | ++import { useComposedRefs as f } from "@radix-ui/react-compose-refs"; |
| 23 | ++import { composeEventHandlers as g } from "@radix-ui/primitive"; |
| 24 | ++import * as m from "react"; |
| 25 | ++import D from "@babel/runtime/helpers/esm/extends"; |
| 26 | ++const [x, C] = d("Dialog"); |
| 27 | ++export { C as createDialogScope }; |
| 28 | ++const [v, E] = x("Dialog"); |
| 29 | ++export const Dialog = (e) => { |
| 30 | ++ const { |
| 31 | ++ __scopeDialog: o, |
| 32 | ++ children: t, |
| 33 | ++ open: r, |
| 34 | ++ defaultOpen: n, |
| 35 | ++ onOpenChange: a, |
| 36 | ++ modal: i = !0, |
| 37 | ++ allowPinchZoom: l, |
| 38 | ++ } = e, |
| 39 | ++ c = m.useRef(null), |
| 40 | ++ p = m.useRef(null), |
| 41 | ++ [d = !1, f] = s({ prop: r, defaultProp: n, onChange: a }); |
| 42 | ++ /*#__PURE__*/ return m.createElement( |
| 43 | ++ v, |
| 44 | ++ { |
| 45 | ++ scope: o, |
| 46 | ++ triggerRef: c, |
| 47 | ++ contentRef: p, |
| 48 | ++ contentId: u(), |
| 49 | ++ titleId: u(), |
| 50 | ++ descriptionId: u(), |
| 51 | ++ open: d, |
| 52 | ++ onOpenChange: f, |
| 53 | ++ onOpenToggle: m.useCallback(() => f((e) => !e), [f]), |
| 54 | ++ modal: i, |
| 55 | ++ allowPinchZoom: l, |
| 56 | ++ }, |
| 57 | ++ t |
| 58 | ++ ); |
| 59 | ++}; |
| 60 | ++/*#__PURE__*/ export const DialogTrigger = /*#__PURE__*/ m.forwardRef( |
| 61 | ++ (e, o) => { |
| 62 | ++ const { __scopeDialog: t, ...r } = e, |
| 63 | ++ a = E("DialogTrigger", t), |
| 64 | ++ i = f(o, a.triggerRef); |
| 65 | ++ /*#__PURE__*/ return m.createElement( |
| 66 | ++ n.button, |
| 67 | ++ D( |
| 68 | ++ { |
| 69 | ++ type: "button", |
| 70 | ++ "aria-haspopup": "dialog", |
| 71 | ++ "aria-expanded": a.open, |
| 72 | ++ "aria-controls": a.contentId, |
| 73 | ++ "data-state": b(a.open), |
| 74 | ++ }, |
| 75 | ++ r, |
| 76 | ++ { ref: i, onClick: g(e.onClick, a.onOpenToggle) } |
| 77 | ++ ) |
| 78 | ++ ); |
| 79 | ++ } |
| 80 | ++); |
| 81 | ++/*#__PURE__*/ export const DialogPortal = (e) => { |
| 82 | ++ const { __scopeDialog: o, forceMount: t, children: r, container: n } = e, |
| 83 | ++ l = E("DialogPortal", o); |
| 84 | ++ /*#__PURE__*/ return m.createElement( |
| 85 | ++ m.Fragment, |
| 86 | ++ null, |
| 87 | ++ m.Children.map(r, (e) => |
| 88 | ++ /*#__PURE__*/ m.createElement( |
| 89 | ++ a, |
| 90 | ++ { present: t || l.open }, |
| 91 | ++ /*#__PURE__*/ m.createElement(i, { asChild: !0, container: n }, e) |
| 92 | ++ ) |
| 93 | ++ ) |
| 94 | ++ ); |
| 95 | ++}; |
| 96 | ++/*#__PURE__*/ export const DialogOverlay = /*#__PURE__*/ m.forwardRef( |
| 97 | ++ (e, o) => { |
| 98 | ++ const { forceMount: t, ...r } = e, |
| 99 | ++ n = E("DialogOverlay", e.__scopeDialog); |
| 100 | ++ return n.modal |
| 101 | ++ ? /*#__PURE__*/ m.createElement( |
| 102 | ++ a, |
| 103 | ++ { present: t || n.open }, |
| 104 | ++ /*#__PURE__*/ m.createElement(R, D({}, r, { ref: o })) |
| 105 | ++ ) |
| 106 | ++ : null; |
| 107 | ++ } |
| 108 | ++); |
| 109 | ++/*#__PURE__*/ const R = /*#__PURE__*/ m.forwardRef((o, r) => { |
| 110 | ++ const { __scopeDialog: a, ...i } = o, |
| 111 | ++ l = E("DialogOverlay", a); |
| 112 | ++ /*#__PURE__*/ return m.createElement( |
| 113 | ++ t, |
| 114 | ++ { as: e, allowPinchZoom: l.allowPinchZoom, shards: [l.contentRef] }, |
| 115 | ++ /*#__PURE__*/ m.createElement( |
| 116 | ++ n.div, |
| 117 | ++ D({ "data-state": b(l.open) }, i, { |
| 118 | ++ ref: r, |
| 119 | ++ style: { pointerEvents: "auto", ...i.style }, |
| 120 | ++ }) |
| 121 | ++ ) |
| 122 | ++ ); |
| 123 | ++}); |
| 124 | ++export const DialogContent = /*#__PURE__*/ m.forwardRef((e, o) => { |
| 125 | ++ const { forceMount: t, ...r } = e, |
| 126 | ++ n = E("DialogContent", e.__scopeDialog); |
| 127 | ++ /*#__PURE__*/ return m.createElement( |
| 128 | ++ a, |
| 129 | ++ { present: t || n.open }, |
| 130 | ++ n.modal |
| 131 | ++ ? /*#__PURE__*/ m.createElement(_, D({}, r, { ref: o })) |
| 132 | ++ : /*#__PURE__*/ m.createElement(O, D({}, r, { ref: o })) |
| 133 | ++ ); |
| 134 | ++}); |
| 135 | ++/*#__PURE__*/ const _ = /*#__PURE__*/ m.forwardRef((e, t) => { |
| 136 | ++ const r = E("DialogContent", e.__scopeDialog), |
| 137 | ++ n = m.useRef(null), |
| 138 | ++ a = f(t, r.contentRef, n); |
| 139 | ++ return ( |
| 140 | ++ m.useEffect(() => { |
| 141 | ++ const e = n.current; |
| 142 | ++ if (e) return o(e); |
| 143 | ++ }, []), |
| 144 | ++ /*#__PURE__*/ m.createElement( |
| 145 | ++ h, |
| 146 | ++ D({}, e, { |
| 147 | ++ ref: a, |
| 148 | ++ trapFocus: e.trapFocus ?? r.open, |
| 149 | ++ disableOutsidePointerEvents: !0, |
| 150 | ++ onCloseAutoFocus: g(e.onCloseAutoFocus, (e) => { |
| 151 | ++ var o; |
| 152 | ++ e.preventDefault(), |
| 153 | ++ null === (o = r.triggerRef.current) || void 0 === o || o.focus(); |
| 154 | ++ }), |
| 155 | ++ onPointerDownOutside: g(e.onPointerDownOutside, (e) => { |
| 156 | ++ const o = e.detail.originalEvent, |
| 157 | ++ t = 0 === o.button && !0 === o.ctrlKey; |
| 158 | ++ (2 === o.button || t) && e.preventDefault(); |
| 159 | ++ }), |
| 160 | ++ onFocusOutside: g(e.onFocusOutside, (e) => e.preventDefault()), |
| 161 | ++ }) |
| 162 | ++ ) |
| 163 | ++ ); |
| 164 | ++ }), |
| 165 | ++ O = /*#__PURE__*/ m.forwardRef((e, o) => { |
| 166 | ++ const t = E("DialogContent", e.__scopeDialog), |
| 167 | ++ r = m.useRef(!1); |
| 168 | ++ /*#__PURE__*/ return m.createElement( |
| 169 | ++ h, |
| 170 | ++ D({}, e, { |
| 171 | ++ ref: o, |
| 172 | ++ trapFocus: !1, |
| 173 | ++ disableOutsidePointerEvents: !1, |
| 174 | ++ onCloseAutoFocus: (o) => { |
| 175 | ++ var n, a; |
| 176 | ++ (null === (n = e.onCloseAutoFocus) || void 0 === n || n.call(e, o), |
| 177 | ++ o.defaultPrevented) || |
| 178 | ++ (r.current || |
| 179 | ++ null === (a = t.triggerRef.current) || |
| 180 | ++ void 0 === a || |
| 181 | ++ a.focus(), |
| 182 | ++ o.preventDefault()); |
| 183 | ++ r.current = !1; |
| 184 | ++ }, |
| 185 | ++ onInteractOutside: (o) => { |
| 186 | ++ var n, a; |
| 187 | ++ null === (n = e.onInteractOutside) || void 0 === n || n.call(e, o), |
| 188 | ++ o.defaultPrevented || (r.current = !0); |
| 189 | ++ const i = o.target; |
| 190 | ++ (null === (a = t.triggerRef.current) || void 0 === a |
| 191 | ++ ? void 0 |
| 192 | ++ : a.contains(i)) && o.preventDefault(); |
| 193 | ++ }, |
| 194 | ++ }) |
| 195 | ++ ); |
| 196 | ++ }), |
| 197 | ++ h = /*#__PURE__*/ m.forwardRef((e, o) => { |
| 198 | ++ const { |
| 199 | ++ __scopeDialog: t, |
| 200 | ++ trapFocus: n, |
| 201 | ++ onOpenAutoFocus: a, |
| 202 | ++ onCloseAutoFocus: i, |
| 203 | ++ ...s |
| 204 | ++ } = e, |
| 205 | ++ u = E("DialogContent", t), |
| 206 | ++ p = m.useRef(null), |
| 207 | ++ d = f(o, p); |
| 208 | ++ return ( |
| 209 | ++ r(), |
| 210 | ++ /*#__PURE__*/ m.createElement( |
| 211 | ++ m.Fragment, |
| 212 | ++ null, |
| 213 | ++ /*#__PURE__*/ m.createElement( |
| 214 | ++ l, |
| 215 | ++ { |
| 216 | ++ asChild: !0, |
| 217 | ++ loop: !0, |
| 218 | ++ trapped: n, |
| 219 | ++ onMountAutoFocus: a, |
| 220 | ++ onUnmountAutoFocus: i, |
| 221 | ++ }, |
| 222 | ++ /*#__PURE__*/ m.createElement( |
| 223 | ++ c, |
| 224 | ++ D( |
| 225 | ++ { |
| 226 | ++ role: "dialog", |
| 227 | ++ id: u.contentId, |
| 228 | ++ "aria-describedby": u.descriptionId, |
| 229 | ++ "aria-labelledby": u.titleId, |
| 230 | ++ "data-state": b(u.open), |
| 231 | ++ }, |
| 232 | ++ s, |
| 233 | ++ { ref: d, onDismiss: () => u.onOpenChange(!1) } |
| 234 | ++ ) |
| 235 | ++ ) |
| 236 | ++ ), |
| 237 | ++ !1 |
| 238 | ++ ) |
| 239 | ++ ); |
| 240 | ++ }); |
| 241 | ++export const DialogTitle = /*#__PURE__*/ m.forwardRef((e, o) => { |
| 242 | ++ const { __scopeDialog: t, ...r } = e, |
| 243 | ++ a = E("DialogTitle", t); |
| 244 | ++ /*#__PURE__*/ return m.createElement( |
| 245 | ++ n.h2, |
| 246 | ++ D({ id: a.titleId }, r, { ref: o }) |
| 247 | ++ ); |
| 248 | ++}); |
| 249 | ++/*#__PURE__*/ export const DialogDescription = /*#__PURE__*/ m.forwardRef( |
| 250 | ++ (e, o) => { |
| 251 | ++ const { __scopeDialog: t, ...r } = e, |
| 252 | ++ a = E("DialogDescription", t); |
| 253 | ++ /*#__PURE__*/ return m.createElement( |
| 254 | ++ n.p, |
| 255 | ++ D({ id: a.descriptionId }, r, { ref: o }) |
| 256 | ++ ); |
| 257 | ++ } |
| 258 | ++); |
| 259 | ++/*#__PURE__*/ export const DialogClose = /*#__PURE__*/ m.forwardRef((e, o) => { |
| 260 | ++ const { __scopeDialog: t, ...r } = e, |
| 261 | ++ a = E("DialogClose", t); |
| 262 | ++ /*#__PURE__*/ return m.createElement( |
| 263 | ++ n.button, |
| 264 | ++ D({ type: "button" }, r, { |
| 265 | ++ ref: o, |
| 266 | ++ onClick: g(e.onClick, () => a.onOpenChange(!1)), |
| 267 | ++ }) |
| 268 | ++ ); |
| 269 | ++}); |
| 270 | ++/*#__PURE__*/ function b(e) { |
| 271 | ++ return e ? "open" : "closed"; |
| 272 | ++} |
| 273 | ++const [w, F] = p("DialogTitleWarning", { |
| 274 | ++ contentName: "DialogContent", |
| 275 | ++ titleName: "DialogTitle", |
| 276 | ++ docsSlug: "dialog", |
| 277 | ++}); |
| 278 | ++export { w as WarningProvider }; |
| 279 | ++export const Root = Dialog; |
| 280 | ++export const Trigger = DialogTrigger; |
| 281 | ++export const Portal = DialogPortal; |
| 282 | ++export const Overlay = DialogOverlay; |
| 283 | ++export const Content = DialogContent; |
| 284 | ++export const Title = DialogTitle; |
| 285 | ++export const Description = DialogDescription; |
| 286 | ++export const Close = DialogClose; |
| 287 | + //# sourceMappingURL=index.module.js.map |
0 commit comments