UNPKG

dgz-ui-shared

Version:

Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript, dgz-ui library

2 lines (1 loc) 5.71 kB
"use strict";const o=require("./index-DqTIeHVj-C_gsDkBV.cjs"),M=require("react"),g=require("./createLucideIcon-B950nf2d-DnAaS9t0.cjs"),f=require("./index-DFLDO_Wj-BSSol7QD.cjs"),q=require("./utils-D0f6bOsw-BmDOeWKv.cjs");function S(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const l=S(M);var O="Popover",[b,Q]=o.j(O,[f.jn]),m=f.jn(),[T,c]=b(O),y=e=>{const{__scopePopover:n,children:t,open:a,defaultOpen:r,onOpenChange:s,modal:i=!1}=e,u=m(n),d=l.useRef(null),[h,x]=l.useState(!1),[P,p]=o.y({prop:a,defaultProp:r??!1,onChange:s,caller:O});return o.ae.jsx(f.Vn,{...u,children:o.ae.jsx(T,{scope:n,contentId:o.g(),triggerRef:d,open:P,onOpenChange:p,onOpenToggle:l.useCallback(()=>p(C=>!C),[p]),hasCustomAnchor:h,onCustomAnchorAdd:l.useCallback(()=>x(!0),[]),onCustomAnchorRemove:l.useCallback(()=>x(!1),[]),modal:i,children:t})})};y.displayName=O;var _="PopoverAnchor",$=l.forwardRef((e,n)=>{const{__scopePopover:t,...a}=e,r=c(_,t),s=m(t),{onCustomAnchorAdd:i,onCustomAnchorRemove:u}=r;return l.useEffect(()=>(i(),()=>u()),[i,u]),o.ae.jsx(f.In,{...s,...a,ref:n})});$.displayName=_;var w="PopoverTrigger",R=l.forwardRef((e,n)=>{const{__scopePopover:t,...a}=e,r=c(w,t),s=m(t),i=o.x(n,r.triggerRef),u=o.ae.jsx(o.h.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":E(r.open),...a,ref:i,onClick:o.y$1(e.onClick,r.onOpenToggle)});return r.hasCustomAnchor?u:o.ae.jsx(f.In,{asChild:!0,...s,children:u})});R.displayName=w;var j="PopoverPortal",[z,K]=b(j,{forceMount:void 0}),D=e=>{const{__scopePopover:n,forceMount:t,children:a,container:r}=e,s=c(j,n);return o.ae.jsx(z,{scope:n,forceMount:t,children:o.ae.jsx(o.R,{present:t||s.open,children:o.ae.jsx(g.Me,{asChild:!0,container:r,children:a})})})};D.displayName=j;var v="PopoverContent",A=l.forwardRef((e,n)=>{const t=K(v,e.__scopePopover),{forceMount:a=t.forceMount,...r}=e,s=c(v,e.__scopePopover);return o.ae.jsx(o.R,{present:a||s.open,children:s.modal?o.ae.jsx(V,{...r,ref:n}):o.ae.jsx(X,{...r,ref:n})})});A.displayName=v;var L=o.g$1("PopoverContent.RemoveScroll"),V=l.forwardRef((e,n)=>{const t=c(v,e.__scopePopover),a=l.useRef(null),r=o.x(n,a),s=l.useRef(!1);return l.useEffect(()=>{const i=a.current;if(i)return g.Rt(i)},[]),o.ae.jsx(g.dt,{as:L,allowPinchZoom:!0,children:o.ae.jsx(F,{...e,ref:r,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:o.y$1(e.onCloseAutoFocus,i=>{var u;i.preventDefault(),s.current||(u=t.triggerRef.current)==null||u.focus()}),onPointerDownOutside:o.y$1(e.onPointerDownOutside,i=>{const u=i.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,h=u.button===2||d;s.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:o.y$1(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),X=l.forwardRef((e,n)=>{const t=c(v,e.__scopePopover),a=l.useRef(!1),r=l.useRef(!1);return o.ae.jsx(F,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,u;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(a.current||(u=t.triggerRef.current)==null||u.focus(),s.preventDefault()),a.current=!1,r.current=!1},onInteractOutside:s=>{var i,u;(i=e.onInteractOutside)==null||i.call(e,s),s.defaultPrevented||(a.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const d=s.target;(u=t.triggerRef.current)!=null&&u.contains(d)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})}),F=l.forwardRef((e,n)=>{const{__scopePopover:t,trapFocus:a,onOpenAutoFocus:r,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:x,...P}=e,p=c(v,t),C=m(t);return g.Ct(),o.ae.jsx(g.Se,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:r,onUnmountAutoFocus:s,children:o.ae.jsx(o.M,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:x,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:h,onDismiss:()=>p.onOpenChange(!1),children:o.ae.jsx(f.Yn,{"data-state":E(p.open),role:"dialog",id:p.contentId,...C,...P,ref:n,style:{...P.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),N="PopoverClose",Y=l.forwardRef((e,n)=>{const{__scopePopover:t,...a}=e,r=c(N,t);return o.ae.jsx(o.h.button,{type:"button",...a,ref:n,onClick:o.y$1(e.onClick,()=>r.onOpenChange(!1))})});Y.displayName=N;var B="PopoverArrow",H=l.forwardRef((e,n)=>{const{__scopePopover:t,...a}=e,r=m(t);return o.ae.jsx(f.Xn,{...r,...a,ref:n})});H.displayName=B;function E(e){return e?"open":"closed"}var U=y,W=R,Z=D,I=A;const G=U,J=W,k=l.forwardRef(({className:e,align:n="center",sideOffset:t=4,...a},r)=>o.ae.jsx(Z,{children:o.ae.jsx(I,{ref:r,align:n,sideOffset:t,className:q.mo("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));k.displayName=I.displayName;exports.Oe=G;exports._e=J;exports.ue=k;