reaxify 0.0.91 → 0.0.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Badge/index.cjs.js +1 -1
- package/dist/components/Badge/index.es.js +1 -1
- package/dist/components/Button/index.cjs.js +1 -1
- package/dist/components/Button/index.es.js +2 -2
- package/dist/components/Drawer/index.cjs.js +1 -1
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.es.js +27 -23
- package/dist/components/Menu/index.cjs.js +1 -1
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.es.js +52 -48
- package/dist/components/Modal/index.cjs.js +1 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/index.es.js +33 -29
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const y=require("react/jsx-runtime"),a=require("../../helpers/cn.cjs.js"),w=require("../../hooks/useClasses.cjs.js"),l=require("react"),k=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js");function q({as:u,variant:d="solid",color:n="primary",size:s="md",className:x,children:c,...p}){const r=w(e=>e.badge),h=u||"span",m=l.useMemo(()=>{var t,g,b;if(!n)return"border-transparent";const e={primary:{solid:"bg-primary text-white border-primary",outline:"bg-transparent text-primary border-primary",soft:"bg-light-primary text-dark-primary border-light-primary"},secondary:{solid:"bg-secondary text-white border-secondary",outline:"bg-transparent text-secondary border-secondary",soft:"bg-light-secondary text-dark-secondary border-light-secondary"},success:{solid:"bg-success text-white border-success",outline:"bg-transparent text-success border-success",soft:"bg-light-success text-dark-success border-light-success"},info:{solid:"bg-info text-white border-info",outline:"bg-transparent text-info border-info",soft:"bg-light-info text-dark-info border-light-info"},warning:{solid:"bg-warning text-white border-warning",outline:"bg-transparent text-warning border-warning",soft:"bg-light-warning text-dark-warning border-light-warning"},danger:{solid:"bg-danger text-white border-danger",outline:"bg-transparent text-danger border-danger",soft:"bg-light-danger text-dark-danger border-light-danger"},dark:{solid:"bg-dark text-white border-dark",outline:"bg-transparent text-dark border-dark",soft:"bg-dark text-
|
|
1
|
+
"use client";"use strict";const y=require("react/jsx-runtime"),a=require("../../helpers/cn.cjs.js"),w=require("../../hooks/useClasses.cjs.js"),l=require("react"),k=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js");function q({as:u,variant:d="solid",color:n="primary",size:s="md",className:x,children:c,...p}){const r=w(e=>e.badge),h=u||"span",m=l.useMemo(()=>{var t,g,b;if(!n)return"border-transparent";const e={primary:{solid:"bg-primary text-white border-primary",outline:"bg-transparent text-primary border-primary",soft:"bg-light-primary text-dark-primary border-light-primary"},secondary:{solid:"bg-secondary text-white border-secondary",outline:"bg-transparent text-secondary border-secondary",soft:"bg-light-secondary text-dark-secondary border-light-secondary"},success:{solid:"bg-success text-white border-success",outline:"bg-transparent text-success border-success",soft:"bg-light-success text-dark-success border-light-success"},info:{solid:"bg-info text-white border-info",outline:"bg-transparent text-info border-info",soft:"bg-light-info text-dark-info border-light-info"},warning:{solid:"bg-warning text-white border-warning",outline:"bg-transparent text-warning border-warning",soft:"bg-light-warning text-dark-warning border-light-warning"},danger:{solid:"bg-danger text-white border-danger",outline:"bg-transparent text-danger border-danger",soft:"bg-light-danger text-dark-danger border-light-danger"},dark:{solid:"bg-dark text-white border-dark",outline:"bg-transparent text-dark border-dark",soft:"bg-dark text-white border-dark"},light:{solid:"bg-light text-dark border-light",outline:"bg-transparent text-dark border-light",soft:"bg-light text-dark border-light"}},o=(t=e==null?void 0:e[n])==null?void 0:t[d],i=(b=(g=r==null?void 0:r.color)==null?void 0:g[n])==null?void 0:b[d];return[o,i]},[n,d,r==null?void 0:r.color]),f=l.useMemo(()=>{var o,i,t;if(!s)return null;const e={sm:a("text-xs py-0.5 px-1.5",(o=r==null?void 0:r.size)==null?void 0:o.sm),md:a("text-sm py-[0.1875rem] px-2",(i=r==null?void 0:r.size)==null?void 0:i.md),lg:a("text-base py-1 px-3",(t=r==null?void 0:r.size)==null?void 0:t.lg)};return e==null?void 0:e[s]},[s,r==null?void 0:r.size]);return y.jsx(h,{className:k.twMerge("inline-flex border border-border items-center text-center font-medium align-middle whitespace-nowrap rounded",r==null?void 0:r.base,m,f,x),...p,children:c})}module.exports=q;
|
|
@@ -50,7 +50,7 @@ function B({
|
|
|
50
50
|
dark: {
|
|
51
51
|
solid: "bg-dark text-white border-dark",
|
|
52
52
|
outline: "bg-transparent text-dark border-dark",
|
|
53
|
-
soft: "bg-dark text-
|
|
53
|
+
soft: "bg-dark text-white border-dark"
|
|
54
54
|
},
|
|
55
55
|
light: {
|
|
56
56
|
solid: "bg-light text-dark border-light",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const l=require("react/jsx-runtime"),r=require("react"),W=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js"),E=require("../../helpers/cn.cjs.js"),F=require("../../hooks/useClasses.cjs.js"),H=require("../../hooks/useCreateRipple.cjs.js"),I=require("../Alert/index.cjs.js"),J=require("../ButtonGroup/index.cjs.js"),K=require("../Drawer/index.cjs.js"),L=require("../Modal/index.cjs.js"),O=require("../Spinner/index.cjs.js");function Q({as:f,variant:h,color:m,size:y,loading:w,stopPropagation:k=!1,preventDefault:C=!1,closeModal:v=!1,closeDrawer:q=!1,className:z,onClick:b,children:j,disabled:M,...R}){const t=F(e=>e.button),a=r.useContext(J.ButtonGroupContext),N=r.useContext(L.ModalContext),$=r.useContext(K.DrawerContext),c=r.useContext(I.AlertContext),D=H(),_=f||"button",u=h??a.variant??c.buttonVariant??"solid",i=m??a.color??c.color??"primary",o=y??a.size??"md",d=w??a.loading??!1,s=r.useMemo(()=>{var g,x,p;if(!i)return"border-transparent";const e={primary:{solid:"bg-primary text-white border-primary",outline:"bg-transparent text-primary border-primary",text:"bg-transparent text-primary border-transparent",soft:"bg-light-primary text-dark-primary border-light-primary"},secondary:{solid:"bg-secondary text-white border-secondary",outline:"bg-transparent text-secondary border-secondary",text:"bg-transparent text-secondary border-transparent",soft:"bg-light-secondary text-dark-secondary border-light-secondary"},success:{solid:"bg-success text-white border-success",outline:"bg-transparent text-success border-success",text:"bg-transparent text-success border-transparent",soft:"bg-light-success text-dark-success border-light-success"},info:{solid:"bg-info text-white border-info",outline:"bg-transparent text-info border-info",text:"bg-transparent text-info border-transparent",soft:"bg-light-info text-dark-info border-light-info"},warning:{solid:"bg-warning text-white border-warning",outline:"bg-transparent text-warning border-warning",text:"bg-transparent text-warning border-transparent",soft:"bg-light-warning text-dark-warning border-light-warning"},danger:{solid:"bg-danger text-white border-danger",outline:"bg-transparent text-danger border-danger",text:"bg-transparent text-danger border-transparent",soft:"bg-light-danger text-dark-danger border-light-danger"},dark:{solid:"bg-dark text-white border-dark",outline:"bg-transparent text-dark border-dark",text:"bg-transparent text-dark border-transparent",soft:"bg-dark text-
|
|
1
|
+
"use client";"use strict";const l=require("react/jsx-runtime"),r=require("react"),W=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js"),E=require("../../helpers/cn.cjs.js"),F=require("../../hooks/useClasses.cjs.js"),H=require("../../hooks/useCreateRipple.cjs.js"),I=require("../Alert/index.cjs.js"),J=require("../ButtonGroup/index.cjs.js"),K=require("../Drawer/index.cjs.js"),L=require("../Modal/index.cjs.js"),O=require("../Spinner/index.cjs.js");function Q({as:f,variant:h,color:m,size:y,loading:w,stopPropagation:k=!1,preventDefault:C=!1,closeModal:v=!1,closeDrawer:q=!1,className:z,onClick:b,children:j,disabled:M,...R}){const t=F(e=>e.button),a=r.useContext(J.ButtonGroupContext),N=r.useContext(L.ModalContext),$=r.useContext(K.DrawerContext),c=r.useContext(I.AlertContext),D=H(),_=f||"button",u=h??a.variant??c.buttonVariant??"solid",i=m??a.color??c.color??"primary",o=y??a.size??"md",d=w??a.loading??!1,s=r.useMemo(()=>{var g,x,p;if(!i)return"border-transparent";const e={primary:{solid:"bg-primary text-white border-primary",outline:"bg-transparent text-primary border-primary",text:"bg-transparent text-primary border-transparent",soft:"bg-light-primary text-dark-primary border-light-primary"},secondary:{solid:"bg-secondary text-white border-secondary",outline:"bg-transparent text-secondary border-secondary",text:"bg-transparent text-secondary border-transparent",soft:"bg-light-secondary text-dark-secondary border-light-secondary"},success:{solid:"bg-success text-white border-success",outline:"bg-transparent text-success border-success",text:"bg-transparent text-success border-transparent",soft:"bg-light-success text-dark-success border-light-success"},info:{solid:"bg-info text-white border-info",outline:"bg-transparent text-info border-info",text:"bg-transparent text-info border-transparent",soft:"bg-light-info text-dark-info border-light-info"},warning:{solid:"bg-warning text-white border-warning",outline:"bg-transparent text-warning border-warning",text:"bg-transparent text-warning border-transparent",soft:"bg-light-warning text-dark-warning border-light-warning"},danger:{solid:"bg-danger text-white border-danger",outline:"bg-transparent text-danger border-danger",text:"bg-transparent text-danger border-transparent",soft:"bg-light-danger text-dark-danger border-light-danger"},dark:{solid:"bg-dark text-white border-dark",outline:"bg-transparent text-dark border-dark",text:"bg-transparent text-dark border-transparent",soft:"bg-dark text-white border-dark"},light:{solid:"bg-light text-dark border-light",outline:"bg-transparent text-dark border-light",text:"bg-transparent text-dark border-transparent",soft:"bg-light text-dark border-light"}},n=(x=(g=t==null?void 0:t.color)==null?void 0:g[i])==null?void 0:x[u],V=(p=e==null?void 0:e[i])==null?void 0:p[u];return E(V,n)},[i,u,t==null?void 0:t.color]),B=r.useMemo(()=>s==null?void 0:s.split(" ").find(e=>e.startsWith("text-")),[s]),G=r.useMemo(()=>{var n;if(!o)return null;const e={sm:"text-sm py-1 px-3.5",md:"text-base py-1.5 px-4",lg:"text-xl py-1.5 px-6",icon:"size-9 p-0 inline-flex items-center justify-center rounded-full [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-5"};return[e==null?void 0:e[o],(n=t==null?void 0:t.size)==null?void 0:n[o]]},[o,t==null?void 0:t.size]),A=r.useMemo(()=>{var e,n;return d?["disabled:opacity-100 disabled:cursor-wait disabled:text-transparent",(e=t==null?void 0:t.loading)==null?void 0:e.active]:["disabled:opacity-75 disabled:cursor-not-allowed",(n=t==null?void 0:t.loading)==null?void 0:n.inactive]},[d,t==null?void 0:t.loading]),P=e=>{D(e),v&&N.onClose(),q&&$.onClose(),k&&e.stopPropagation(),C&&e.preventDefault(),b==null||b(e)};return l.jsxs(_,{role:"button",className:W.twMerge("relative inline-block no-underline whitespace-nowrap font-medium text-center rounded border border-border cursor-pointer transition-[box-shadow,opacity,color,background-color,border-color] [user-select:none]","focus-visible:outline-none after:content-[''] after:bg-current after:opacity-25 after:absolute after:-inset-y-px after:inset-x-2 after:rounded-full after:mx-auto after:pointer-events-none after:scale-0 focus-visible:after:scale-100 after:transition-transform after:[corner-shape:squircle]",t==null?void 0:t.base,s,G,A,a.buttonClasses,z),onClick:P,disabled:M||d,...R,children:[j,d&&l.jsx("span",{className:"absolute inset-0 size-full flex items-center justify-center bg-transparent p-2",children:l.jsx(O,{size:o==="icon"?"sm":o,color:null,className:B})}),l.jsx("span",{"data-name":"ripple-group",className:"absolute size-full inset-0 overflow-hidden rounded-[inherit] pointer-events-none"})]})}module.exports=Q;
|
|
@@ -70,13 +70,13 @@ function it({
|
|
|
70
70
|
solid: "bg-dark text-white border-dark",
|
|
71
71
|
outline: "bg-transparent text-dark border-dark",
|
|
72
72
|
text: "bg-transparent text-dark border-transparent",
|
|
73
|
-
soft: "bg-dark text-
|
|
73
|
+
soft: "bg-dark text-white border-dark"
|
|
74
74
|
},
|
|
75
75
|
light: {
|
|
76
76
|
solid: "bg-light text-dark border-light",
|
|
77
77
|
outline: "bg-transparent text-dark border-light",
|
|
78
78
|
text: "bg-transparent text-dark border-transparent",
|
|
79
|
-
soft: "bg-light
|
|
79
|
+
soft: "bg-light text-dark border-light"
|
|
80
80
|
}
|
|
81
81
|
}, e = (x = (u = t == null ? void 0 : t.color) == null ? void 0 : u[i]) == null ? void 0 : x[g], W = (f = r == null ? void 0 : r[i]) == null ? void 0 : f[g];
|
|
82
82
|
return H(W, e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),x=require("../../hooks/useClasses.cjs.js"),i=require("react"),R=require("../../node_modules/@tanstack/react-hotkeys/dist/useHotkey.cjs.js"),C=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js"),w=require("../../helpers/cn.cjs.js"),v=require("../Card/index.cjs.js"),H=require("../Portal/index.cjs.js"),N=require("../../node_modules/react-transition-group/esm/Transition.cjs.js"),p=i.createContext({open:!1,onClose:()=>{},duration:300,anchor:"start",transitionState:"unmounted",preventClose:!1});function f({as:n,ref:a,open:r=!1,onClose:e=()=>{},duration:o=300,preventClose:
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),x=require("../../hooks/useClasses.cjs.js"),i=require("react"),R=require("../../node_modules/@tanstack/react-hotkeys/dist/useHotkey.cjs.js"),C=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js"),w=require("../../helpers/cn.cjs.js"),v=require("../Card/index.cjs.js"),H=require("../Portal/index.cjs.js"),N=require("../../node_modules/react-transition-group/esm/Transition.cjs.js"),p=i.createContext({open:!1,onClose:()=>{},duration:300,anchor:"start",transitionState:"unmounted",preventClose:!1});function f({as:n,ref:a,open:r=!1,onClose:e=()=>{},duration:o=300,preventClose:l=!1,anchor:u="end",className:y="",children:b,...h}){const t=x(c=>c.drawer),d=i.useRef(null),m=n||"div",M={entering:"active opacity-100 pointer-events-auto",entered:"active opacity-100 pointer-events-auto",exiting:"opacity-0 pointer-events-none",exited:"opacity-0 pointer-events-none",unmounted:""},q=i.useMemo(()=>{var j;const c={start:"flex-row-reverse",end:"flex-row",top:"flex-col-reverse",bottom:"flex-col"},D=(j=t==null?void 0:t.anchor)==null?void 0:j[u];return[c[u],D]},[u,t==null?void 0:t.anchor]),g=()=>{l||e()};return i.useImperativeHandle(a,()=>d.current),R.useHotkey("Escape",()=>e(),{conflictBehavior:"allow",ignoreInputs:!0,enabled:r&&!l}),s.jsx(H,{children:s.jsx(N.default,{nodeRef:d,in:r,timeout:o,unmountOnExit:!0,children:c=>s.jsxs(m,{ref:d,style:{transitionDuration:`${o}ms`},"data-open":r,className:C.twMerge("fixed size-full inset-0 flex z-10 bg-black/20 backdrop-blur transition-opacity [--drawer-ratio:1] rtl:[--drawer-ratio:-1]",t==null?void 0:t.base,M[c],q,y),...h,children:[s.jsx("div",{onClick:g,className:w("absolute inset-0 size-full cursor-default opacity-0",l&&"[&:active~*]:scale-95")}),s.jsx(p.Provider,{value:{open:r,onClose:g,transitionState:c,duration:o,anchor:u,preventClose:l},children:b})]})})})}function k({children:n,className:a="",...r}){const e=x(t=>t.drawer.menu),{anchor:o,duration:l,transitionState:u,preventClose:y}=i.useContext(p),b=i.useMemo(()=>{var m;const t={start:"w-[31.875rem] h-full max-w-[92.5%] rounded-e me-auto",end:"w-[31.875rem] h-full max-w-[92.5%] rounded-s ms-auto",top:"w-full max-h-[92.5%] rounded-b mb-auto",bottom:"w-full max-h-[92.5%] rounded-t mt-auto"},d=(m=e==null?void 0:e.anchor)==null?void 0:m[o];return[t[o],d]},[o,e==null?void 0:e.anchor]),h=i.useMemo(()=>({start:{entering:"translate-x-0",entered:"translate-x-0",exiting:"-translate-x-[calc(100%*var(--drawer-ratio))]",exited:"-translate-x-[calc(100%*var(--drawer-ratio))]",unmounted:""},end:{entering:"translate-x-0",entered:"translate-x-0",exiting:"translate-x-[calc(100%*var(--drawer-ratio))]",exited:"translate-x-[calc(100%*var(--drawer-ratio))]",unmounted:""},top:{entering:"translate-y-0",entered:"translate-y-0",exiting:"-translate-y-full",exited:"-translate-y-full",unmounted:""},bottom:{entering:"translate-y-0",entered:"translate-y-0",exiting:"translate-y-full",exited:"translate-y-full",unmounted:""}})[o],[o]);return s.jsx(v,{as:"div",style:{transitionDuration:`${l}ms`},className:C.twMerge("relative flex flex-col transition-[translate,width] rounded-none",y&&"transition-transform",e==null?void 0:e.base,h[u],b,a),...r,children:n})}function S({className:n,...a}){const r=x(e=>e.drawer.header.base);return s.jsx(v.Header,{className:w(r,n),...a})}function B({className:n,...a}){const r=x(e=>e.drawer.body.base);return s.jsx(v.Body,{className:w("flex-1 overflow-auto",r,n),...a})}function z({className:n,...a}){const r=x(e=>e.drawer.footer.base);return s.jsx(v.Footer,{className:w(r,n),...a})}f.Menu=k;f.Header=S;f.Body=B;f.Footer=z;exports.DrawerContext=p;exports.default=f;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG5D,OAAO,EACL,cAAc,EAEd,WAAW,EAKZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAc,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAMtE,KAAK,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;AACjD,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,gBAAgB,CAAC;IAClC,YAAY,EAAE,OAAO,CAAC;CACvB,GAAG,WAAW,CAAC;AAChB,KAAK,eAAe,GAAG;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AACzB,KAAK,WAAW,CAAC,CAAC,SAAS,WAAW,IAAI,oBAAoB,CAC5D,CAAC,EACD,eAAe,CAChB,CAAC;AACF,KAAK,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,CAAC;AACjE,KAAK,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAC/C,KAAK,eAAe,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAC7C,KAAK,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAG/C,eAAO,MAAM,aAAa,kCAOxB,CAAC;AAEH,iBAAS,MAAM,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,EAC7C,EAAE,EACF,GAAG,EACH,IAAY,EACZ,OAAkB,EAClB,QAAc,EACd,YAAoB,EACpB,MAAc,EACd,SAAc,EACd,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,WAAW,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG5D,OAAO,EACL,cAAc,EAEd,WAAW,EAKZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAc,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAMtE,KAAK,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;AACjD,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,gBAAgB,CAAC;IAClC,YAAY,EAAE,OAAO,CAAC;CACvB,GAAG,WAAW,CAAC;AAChB,KAAK,eAAe,GAAG;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AACzB,KAAK,WAAW,CAAC,CAAC,SAAS,WAAW,IAAI,oBAAoB,CAC5D,CAAC,EACD,eAAe,CAChB,CAAC;AACF,KAAK,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,CAAC;AACjE,KAAK,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAC/C,KAAK,eAAe,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAC7C,KAAK,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAG/C,eAAO,MAAM,aAAa,kCAOxB,CAAC;AAEH,iBAAS,MAAM,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,EAC7C,EAAE,EACF,GAAG,EACH,IAAY,EACZ,OAAkB,EAClB,QAAc,EACd,YAAoB,EACpB,MAAc,EACd,SAAc,EACd,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,WAAW,CAAC,CAAC,CAAC,2CAyEhB;kBApFQ,MAAM;;;;;;AAqFf,iBAAS,UAAU,CAAC,EAAE,QAAQ,EAAE,SAAc,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CAgE1E;AACD,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,2CAG/D;AACD,iBAAS,UAAU,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CAQ3D;AACD,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,2CAG/D;AAOD,eAAe,MAAM,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as s, jsxs as k } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
4
|
-
import { createContext as
|
|
3
|
+
import d from "../../hooks/useClasses.es.js";
|
|
4
|
+
import { createContext as B, useRef as M, useMemo as h, useImperativeHandle as z, useContext as F } from "react";
|
|
5
5
|
import { useHotkey as S } from "../../node_modules/@tanstack/react-hotkeys/dist/useHotkey.es.js";
|
|
6
6
|
import { twMerge as C } from "../../node_modules/tailwind-merge/dist/bundle-mjs.es.js";
|
|
7
7
|
import f from "../../helpers/cn.es.js";
|
|
8
8
|
import x from "../Card/index.es.js";
|
|
9
9
|
import j from "../Portal/index.es.js";
|
|
10
10
|
import E from "../../node_modules/react-transition-group/esm/Transition.es.js";
|
|
11
|
-
const D =
|
|
11
|
+
const D = B({
|
|
12
12
|
open: !1,
|
|
13
13
|
onClose: () => {
|
|
14
14
|
},
|
|
@@ -30,13 +30,13 @@ function w({
|
|
|
30
30
|
children: v,
|
|
31
31
|
...y
|
|
32
32
|
}) {
|
|
33
|
-
const t =
|
|
33
|
+
const t = d((u) => u.drawer), c = M(null), m = n || "div", R = {
|
|
34
34
|
entering: "active opacity-100 pointer-events-auto",
|
|
35
35
|
entered: "active opacity-100 pointer-events-auto",
|
|
36
36
|
exiting: "opacity-0 pointer-events-none",
|
|
37
37
|
exited: "opacity-0 pointer-events-none",
|
|
38
38
|
unmounted: ""
|
|
39
|
-
}, N =
|
|
39
|
+
}, N = h(() => {
|
|
40
40
|
var g;
|
|
41
41
|
const u = {
|
|
42
42
|
start: "flex-row-reverse",
|
|
@@ -45,13 +45,17 @@ function w({
|
|
|
45
45
|
bottom: "flex-col"
|
|
46
46
|
}, H = (g = t == null ? void 0 : t.anchor) == null ? void 0 : g[l];
|
|
47
47
|
return [u[l], H];
|
|
48
|
-
}, [l, t == null ? void 0 : t.anchor]),
|
|
48
|
+
}, [l, t == null ? void 0 : t.anchor]), b = () => {
|
|
49
49
|
i || e();
|
|
50
50
|
};
|
|
51
|
-
return
|
|
51
|
+
return z(a, () => c.current), S("Escape", () => e(), {
|
|
52
|
+
conflictBehavior: "allow",
|
|
53
|
+
ignoreInputs: !0,
|
|
54
|
+
enabled: r && !i
|
|
55
|
+
}), /* @__PURE__ */ s(j, { children: /* @__PURE__ */ s(E, { nodeRef: c, in: r, timeout: o, unmountOnExit: !0, children: (u) => /* @__PURE__ */ k(
|
|
52
56
|
m,
|
|
53
57
|
{
|
|
54
|
-
ref:
|
|
58
|
+
ref: c,
|
|
55
59
|
style: { transitionDuration: `${o}ms` },
|
|
56
60
|
"data-open": r,
|
|
57
61
|
className: C(
|
|
@@ -66,7 +70,7 @@ function w({
|
|
|
66
70
|
/* @__PURE__ */ s(
|
|
67
71
|
"div",
|
|
68
72
|
{
|
|
69
|
-
onClick:
|
|
73
|
+
onClick: b,
|
|
70
74
|
className: f(
|
|
71
75
|
"absolute inset-0 size-full cursor-default opacity-0",
|
|
72
76
|
i && "[&:active~*]:scale-95"
|
|
@@ -78,7 +82,7 @@ function w({
|
|
|
78
82
|
{
|
|
79
83
|
value: {
|
|
80
84
|
open: r,
|
|
81
|
-
onClose:
|
|
85
|
+
onClose: b,
|
|
82
86
|
transitionState: u,
|
|
83
87
|
duration: o,
|
|
84
88
|
anchor: l,
|
|
@@ -91,17 +95,17 @@ function w({
|
|
|
91
95
|
}
|
|
92
96
|
) }) });
|
|
93
97
|
}
|
|
94
|
-
function
|
|
95
|
-
const e =
|
|
98
|
+
function I({ children: n, className: a = "", ...r }) {
|
|
99
|
+
const e = d((t) => t.drawer.menu), { anchor: o, duration: i, transitionState: l, preventClose: p } = F(D), v = h(() => {
|
|
96
100
|
var m;
|
|
97
101
|
const t = {
|
|
98
102
|
start: "w-[31.875rem] h-full max-w-[92.5%] rounded-e me-auto",
|
|
99
103
|
end: "w-[31.875rem] h-full max-w-[92.5%] rounded-s ms-auto",
|
|
100
104
|
top: "w-full max-h-[92.5%] rounded-b mb-auto",
|
|
101
105
|
bottom: "w-full max-h-[92.5%] rounded-t mt-auto"
|
|
102
|
-
},
|
|
103
|
-
return [t[o],
|
|
104
|
-
}, [o, e == null ? void 0 : e.anchor]), y =
|
|
106
|
+
}, c = (m = e == null ? void 0 : e.anchor) == null ? void 0 : m[o];
|
|
107
|
+
return [t[o], c];
|
|
108
|
+
}, [o, e == null ? void 0 : e.anchor]), y = h(() => ({
|
|
105
109
|
start: {
|
|
106
110
|
entering: "translate-x-0",
|
|
107
111
|
entered: "translate-x-0",
|
|
@@ -149,12 +153,12 @@ function P({ children: n, className: a = "", ...r }) {
|
|
|
149
153
|
}
|
|
150
154
|
);
|
|
151
155
|
}
|
|
152
|
-
function
|
|
153
|
-
const r =
|
|
156
|
+
function P({ className: n, ...a }) {
|
|
157
|
+
const r = d((e) => e.drawer.header.base);
|
|
154
158
|
return /* @__PURE__ */ s(x.Header, { className: f(r, n), ...a });
|
|
155
159
|
}
|
|
156
|
-
function
|
|
157
|
-
const r =
|
|
160
|
+
function $({ className: n, ...a }) {
|
|
161
|
+
const r = d((e) => e.drawer.body.base);
|
|
158
162
|
return /* @__PURE__ */ s(
|
|
159
163
|
x.Body,
|
|
160
164
|
{
|
|
@@ -164,12 +168,12 @@ function I({ className: n, ...a }) {
|
|
|
164
168
|
);
|
|
165
169
|
}
|
|
166
170
|
function O({ className: n, ...a }) {
|
|
167
|
-
const r =
|
|
171
|
+
const r = d((e) => e.drawer.footer.base);
|
|
168
172
|
return /* @__PURE__ */ s(x.Footer, { className: f(r, n), ...a });
|
|
169
173
|
}
|
|
170
|
-
w.Menu =
|
|
171
|
-
w.Header =
|
|
172
|
-
w.Body =
|
|
174
|
+
w.Menu = I;
|
|
175
|
+
w.Header = P;
|
|
176
|
+
w.Body = $;
|
|
173
177
|
w.Footer = O;
|
|
174
178
|
export {
|
|
175
179
|
D as DrawerContext,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const i=require("react/jsx-runtime")
|
|
1
|
+
"use client";"use strict";const i=require("react/jsx-runtime"),W=require("../../helpers/cn.cjs.js"),z=require("../../hooks/useClasses.cjs.js"),t=require("react"),$=require("../../node_modules/@tanstack/react-hotkeys/dist/useHotkey.cjs.js"),k=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js"),B=require("../Button/index.cjs.js"),S=require("../Portal/index.cjs.js"),F=require("../../node_modules/react-transition-group/esm/Transition.cjs.js"),y=t.createContext({open:!1,onClose:()=>{},transitionState:"unmounted",closeOnClick:!1,preventClose:!1});function E({as:o,ref:l,open:n,onClose:a,closeOnClick:d=!1,preventClose:f=!1,anchorEl:p=null,className:C,children:c,...b}){const M=z(e=>e.menu.base),m=o||"ul",s=16,r=t.useRef(null),O=t.useRef({left:s,right:s,top:s}),L={entering:"scale-100 opacity-100",entered:"scale-100 opacity-100",exiting:"scale-90 opacity-0",exited:"scale-90 opacity-0",unmounted:""},q=t.useCallback(e=>{O.current=e},[]),R=t.useCallback(e=>{var u,h,x;(u=r.current)==null||u.style.setProperty("--left",`${e.left}px`),(h=r.current)==null||h.style.setProperty("--right",`${e.right}px`),(x=r.current)==null||x.style.setProperty("--top",`${e.top}px`)},[]),g=t.useCallback(()=>{var H,P;if(!n||!p)return;const e=p.getBoundingClientRect(),u=window.innerWidth,h=window.innerHeight,x=((H=r.current)==null?void 0:H.offsetWidth)||150,N=((P=r.current)==null?void 0:P.offsetHeight)||200;let w=e.left,j=e.right,v=e.bottom;w=Math.min(Math.max(w,s),u-x-s),j=Math.min(Math.max(u-e.right,s),u-x-s),v=Math.min(Math.max(v,s),h-N-s),q({left:w,right:j,top:v}),R({left:w,right:j,top:v})},[n,p,q,R]),I=()=>{f||a==null||a()};return t.useEffect(()=>{g()},[g,c]),t.useEffect(()=>{const e=()=>{g()};return window.addEventListener("scroll",e),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e),window.removeEventListener("resize",e)}},[g]),t.useImperativeHandle(l,()=>r.current),$.useHotkey("Escape",()=>a(),{conflictBehavior:"allow",ignoreInputs:!0,enabled:n&&!f}),i.jsx(S,{children:i.jsx(F.default,{nodeRef:r,in:n,timeout:300,unmountOnExit:!0,children:e=>i.jsx(y.Provider,{value:{open:n,onClose:I,transitionState:e,closeOnClick:d,preventClose:f},children:i.jsxs(T,{children:[i.jsx(A,{}),i.jsx(m,{ref:r,autoFocus:!0,"data-open":n,role:"menu",className:k.twMerge("w-fit min-w-52 bg-white shadow-lg rounded py-2 transition-[scale,opacity] absolute top-(--top) left-(--left) right-auto origin-top-left rtl:left-auto rtl:right-(--right) rtl:origin-top-right",M,L[e],C),...b,children:c})]})})})})}function T({children:o}){const{transitionState:l}=t.useContext(y),n={entering:"active pointer-events-auto",entered:"active pointer-events-auto",exiting:"pointer-events-none",exited:"pointer-events-none",unmounted:""};return i.jsx("div",{className:k.twMerge("fixed inset-0 size-full flex flex-col bg-transparent transition-opacity overflow-hidden z-10",n[l]),children:o})}function A(){const{onClose:o,preventClose:l}=t.useContext(y);return i.jsx("div",{className:W("w-full flex-1 opacity-0 cursor-default lg:absolute lg:size-full lg:inset-0",l&&"[&:active~*]:scale-95"),onClick:o})}function D({as:o,closeOnClick:l,className:n,children:a,onClick:d,...f}){const p=z(m=>m.menu.item.base),{closeOnClick:C,onClose:c}=t.useContext(y),b=l??C,M=m=>{b&&(c==null||c()),d==null||d(m)};return i.jsx(B,{as:o??"li",color:"light",variant:"text",role:"menuitem",className:k.twMerge("w-full flex items-center justify-start align-middle px-4 py-1.5 bg-transparent text-base font-normal rounded-none whitespace-nowrap transition-colors hover:bg-dark/5",p,n),onClick:M,...f,children:a})}E.Item=D;module.exports=E;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,oBAAoB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3E,OAAO,EAEL,WAAW,EAOZ,MAAM,OAAO,CAAC;AAOf,KAAK,SAAS,GAAG;IACf,QAAQ,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,WAAW,CAAC;AAChB,KAAK,aAAa,GAAG;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAgBF,iBAAS,IAAI,CAAC,CAAC,SAAS,WAAW,GAAG,IAAI,EAAE,EAC1C,EAAE,EACF,GAAG,EACH,IAAI,EACJ,OAAO,EACP,YAAoB,EACpB,YAAoB,EACpB,QAAe,EACf,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,CAAC,EAAE,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,oBAAoB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3E,OAAO,EAEL,WAAW,EAOZ,MAAM,OAAO,CAAC;AAOf,KAAK,SAAS,GAAG;IACf,QAAQ,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,WAAW,CAAC;AAChB,KAAK,aAAa,GAAG;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAgBF,iBAAS,IAAI,CAAC,CAAC,SAAS,WAAW,GAAG,IAAI,EAAE,EAC1C,EAAE,EACF,GAAG,EACH,IAAI,EACJ,OAAO,EACP,YAAoB,EACpB,YAAoB,EACpB,QAAe,EACf,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,CAAC,EAAE,SAAS,CAAC,2CA+GpC;kBA1HQ,IAAI;;;AA2Jb,iBAAS,QAAQ,CAAC,CAAC,SAAS,WAAW,GAAG,QAAQ,EAAE,EAClD,EAAE,EACF,YAAY,EAAE,gBAAgB,EAC9B,SAAS,EACT,QAAQ,EACR,OAAO,EACP,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,CAAC,EAAE,aAAa,CAAC,2CAyBxC;AAID,eAAe,IAAI,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as i, jsxs as $ } from "react/jsx-runtime";
|
|
3
3
|
import F from "../../helpers/cn.es.js";
|
|
4
|
-
import
|
|
5
|
-
import { createContext as T, useRef as L, useCallback as
|
|
4
|
+
import I from "../../hooks/useClasses.es.js";
|
|
5
|
+
import { createContext as T, useRef as L, useCallback as k, useEffect as B, useImperativeHandle as q, useContext as P } from "react";
|
|
6
6
|
import { useHotkey as A } from "../../node_modules/@tanstack/react-hotkeys/dist/useHotkey.es.js";
|
|
7
7
|
import { twMerge as H } from "../../node_modules/tailwind-merge/dist/bundle-mjs.es.js";
|
|
8
8
|
import D from "../Button/index.es.js";
|
|
@@ -17,89 +17,93 @@ const v = T({
|
|
|
17
17
|
preventClose: !1
|
|
18
18
|
});
|
|
19
19
|
function K({
|
|
20
|
-
as:
|
|
21
|
-
ref:
|
|
20
|
+
as: r,
|
|
21
|
+
ref: s,
|
|
22
22
|
open: e,
|
|
23
|
-
onClose:
|
|
23
|
+
onClose: l,
|
|
24
24
|
closeOnClick: u = !1,
|
|
25
25
|
preventClose: f = !1,
|
|
26
26
|
anchorEl: m = null,
|
|
27
27
|
className: y,
|
|
28
|
-
children:
|
|
28
|
+
children: a,
|
|
29
29
|
...b
|
|
30
30
|
}) {
|
|
31
|
-
const
|
|
31
|
+
const C = I((t) => t.menu.base), d = r || "ul", n = 16, o = L(null), N = L({
|
|
32
32
|
left: n,
|
|
33
33
|
right: n,
|
|
34
34
|
top: n
|
|
35
|
-
}),
|
|
35
|
+
}), W = {
|
|
36
36
|
entering: "scale-100 opacity-100",
|
|
37
37
|
entered: "scale-100 opacity-100",
|
|
38
38
|
exiting: "scale-90 opacity-0",
|
|
39
39
|
exited: "scale-90 opacity-0",
|
|
40
40
|
unmounted: ""
|
|
41
|
-
}, z =
|
|
42
|
-
|
|
43
|
-
}, []), O =
|
|
41
|
+
}, z = k((t) => {
|
|
42
|
+
N.current = t;
|
|
43
|
+
}, []), O = k((t) => {
|
|
44
44
|
var c, g, p;
|
|
45
|
-
(c =
|
|
46
|
-
}, []), h =
|
|
45
|
+
(c = o.current) == null || c.style.setProperty("--left", `${t.left}px`), (g = o.current) == null || g.style.setProperty("--right", `${t.right}px`), (p = o.current) == null || p.style.setProperty("--top", `${t.top}px`);
|
|
46
|
+
}, []), h = k(() => {
|
|
47
47
|
var R, E;
|
|
48
48
|
if (!e || !m) return;
|
|
49
|
-
const t = m.getBoundingClientRect(), c = window.innerWidth, g = window.innerHeight, p = ((R =
|
|
50
|
-
let
|
|
51
|
-
|
|
49
|
+
const t = m.getBoundingClientRect(), c = window.innerWidth, g = window.innerHeight, p = ((R = o.current) == null ? void 0 : R.offsetWidth) || 150, S = ((E = o.current) == null ? void 0 : E.offsetHeight) || 200;
|
|
50
|
+
let w = t.left, M = t.right, x = t.bottom;
|
|
51
|
+
w = Math.min(Math.max(w, n), c - p - n), M = Math.min(
|
|
52
52
|
Math.max(c - t.right, n),
|
|
53
53
|
c - p - n
|
|
54
|
-
),
|
|
55
|
-
}, [e, m, z, O]),
|
|
56
|
-
f ||
|
|
54
|
+
), x = Math.min(Math.max(x, n), g - S - n), z({ left: w, right: M, top: x }), O({ left: w, right: M, top: x });
|
|
55
|
+
}, [e, m, z, O]), j = () => {
|
|
56
|
+
f || l == null || l();
|
|
57
57
|
};
|
|
58
|
-
return
|
|
58
|
+
return B(() => {
|
|
59
59
|
h();
|
|
60
|
-
}, [h,
|
|
60
|
+
}, [h, a]), B(() => {
|
|
61
61
|
const t = () => {
|
|
62
62
|
h();
|
|
63
63
|
};
|
|
64
64
|
return window.addEventListener("scroll", t), window.addEventListener("resize", t), () => {
|
|
65
65
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t);
|
|
66
66
|
};
|
|
67
|
-
}, [h]), q(
|
|
67
|
+
}, [h]), q(s, () => o.current), A("Escape", () => l(), {
|
|
68
|
+
conflictBehavior: "allow",
|
|
69
|
+
ignoreInputs: !0,
|
|
70
|
+
enabled: e && !f
|
|
71
|
+
}), /* @__PURE__ */ i(G, { children: /* @__PURE__ */ i(J, { nodeRef: o, in: e, timeout: 300, unmountOnExit: !0, children: (t) => /* @__PURE__ */ i(
|
|
68
72
|
v.Provider,
|
|
69
73
|
{
|
|
70
74
|
value: {
|
|
71
75
|
open: e,
|
|
72
|
-
onClose:
|
|
76
|
+
onClose: j,
|
|
73
77
|
transitionState: t,
|
|
74
78
|
closeOnClick: u,
|
|
75
79
|
preventClose: f
|
|
76
80
|
},
|
|
77
81
|
children: /* @__PURE__ */ $(Q, { children: [
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ i(U, {}),
|
|
83
|
+
/* @__PURE__ */ i(
|
|
80
84
|
d,
|
|
81
85
|
{
|
|
82
|
-
ref:
|
|
86
|
+
ref: o,
|
|
83
87
|
autoFocus: !0,
|
|
84
88
|
"data-open": e,
|
|
85
89
|
role: "menu",
|
|
86
90
|
className: H(
|
|
87
91
|
"w-fit min-w-52 bg-white shadow-lg rounded py-2 transition-[scale,opacity] absolute top-(--top) left-(--left) right-auto origin-top-left rtl:left-auto rtl:right-(--right) rtl:origin-top-right",
|
|
88
|
-
|
|
89
|
-
|
|
92
|
+
C,
|
|
93
|
+
W[t],
|
|
90
94
|
y
|
|
91
95
|
),
|
|
92
96
|
...b,
|
|
93
|
-
children:
|
|
97
|
+
children: a
|
|
94
98
|
}
|
|
95
99
|
)
|
|
96
100
|
] })
|
|
97
101
|
}
|
|
98
102
|
) }) });
|
|
99
103
|
}
|
|
100
|
-
function Q({ children:
|
|
101
|
-
const { transitionState:
|
|
102
|
-
return /* @__PURE__ */
|
|
104
|
+
function Q({ children: r }) {
|
|
105
|
+
const { transitionState: s } = P(v);
|
|
106
|
+
return /* @__PURE__ */ i(
|
|
103
107
|
"div",
|
|
104
108
|
{
|
|
105
109
|
className: H(
|
|
@@ -110,40 +114,40 @@ function Q({ children: s }) {
|
|
|
110
114
|
exiting: "pointer-events-none",
|
|
111
115
|
exited: "pointer-events-none",
|
|
112
116
|
unmounted: ""
|
|
113
|
-
}[
|
|
117
|
+
}[s]
|
|
114
118
|
),
|
|
115
|
-
children:
|
|
119
|
+
children: r
|
|
116
120
|
}
|
|
117
121
|
);
|
|
118
122
|
}
|
|
119
123
|
function U() {
|
|
120
|
-
const { onClose:
|
|
121
|
-
return /* @__PURE__ */
|
|
124
|
+
const { onClose: r, preventClose: s } = P(v);
|
|
125
|
+
return /* @__PURE__ */ i(
|
|
122
126
|
"div",
|
|
123
127
|
{
|
|
124
128
|
className: F(
|
|
125
129
|
"w-full flex-1 opacity-0 cursor-default lg:absolute lg:size-full lg:inset-0",
|
|
126
|
-
|
|
130
|
+
s && "[&:active~*]:scale-95"
|
|
127
131
|
),
|
|
128
|
-
onClick:
|
|
132
|
+
onClick: r
|
|
129
133
|
}
|
|
130
134
|
);
|
|
131
135
|
}
|
|
132
136
|
function V({
|
|
133
|
-
as:
|
|
134
|
-
closeOnClick:
|
|
137
|
+
as: r,
|
|
138
|
+
closeOnClick: s,
|
|
135
139
|
className: e,
|
|
136
|
-
children:
|
|
140
|
+
children: l,
|
|
137
141
|
onClick: u,
|
|
138
142
|
...f
|
|
139
143
|
}) {
|
|
140
|
-
const m =
|
|
141
|
-
b && (
|
|
144
|
+
const m = I((d) => d.menu.item.base), { closeOnClick: y, onClose: a } = P(v), b = s ?? y, C = (d) => {
|
|
145
|
+
b && (a == null || a()), u == null || u(d);
|
|
142
146
|
};
|
|
143
|
-
return /* @__PURE__ */
|
|
147
|
+
return /* @__PURE__ */ i(
|
|
144
148
|
D,
|
|
145
149
|
{
|
|
146
|
-
as:
|
|
150
|
+
as: r ?? "li",
|
|
147
151
|
color: "light",
|
|
148
152
|
variant: "text",
|
|
149
153
|
role: "menuitem",
|
|
@@ -152,9 +156,9 @@ function V({
|
|
|
152
156
|
m,
|
|
153
157
|
e
|
|
154
158
|
),
|
|
155
|
-
onClick:
|
|
159
|
+
onClick: C,
|
|
156
160
|
...f,
|
|
157
|
-
children:
|
|
161
|
+
children: l
|
|
158
162
|
}
|
|
159
163
|
);
|
|
160
164
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),f=require("../../helpers/cn.cjs.js"),u=require("../../hooks/useClasses.cjs.js"),l=require("react"),C=require("../../node_modules/@tanstack/react-hotkeys/dist/useHotkey.cjs.js"),j=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js"),p=require("../Card/index.cjs.js"),h=require("../Portal/index.cjs.js"),w=require("../../node_modules/react-transition-group/esm/Transition.cjs.js"),g=l.createContext({size:"md",open:!1,onClose:()=>{},transitionState:"unmounted",duration:300});function c({as:t,ref:n,size:o="md",open:e=!1,onClose:a=()=>{},duration:i=300,preventClose:r=!1,className:b,children:v,...d}){const m=u(x=>x.modal.base),y=l.useRef(null),q=t||"div",z={entering:"active opacity-100 pointer-events-auto",entered:"active opacity-100 pointer-events-auto",exiting:"opacity-0 pointer-events-none",exited:"opacity-0 pointer-events-none",unmounted:""},M=()=>{r||a()};return l.useImperativeHandle(n,()=>y.current),C.useHotkey("Escape",()=>a(),{conflictBehavior:"allow",ignoreInputs:!0,enabled:e&&!r}),s.jsx(h,{children:s.jsx(w.default,{nodeRef:y,in:e,timeout:i,unmountOnExit:!0,children:x=>s.jsxs(q,{ref:y,"data-open":e,style:{transitionDuration:`${i}ms`},className:j.twMerge("modal fixed size-full inset-0 flex flex-col z-10 bg-black/20 transition-opacity backdrop-blur p-4",m,z[x],b),...d,children:[s.jsx("div",{onClick:M,className:f("absolute inset-0 cursor-default opacity-0",r&&"[&:active~*]:scale-95")}),s.jsx(g.Provider,{value:{size:o,open:e,onClose:M,transitionState:x,duration:i},children:v})]})})})}function H({className:t,children:n,...o}){const e=u(d=>d.modal.dialog),{size:a,transitionState:i,duration:r}=l.useContext(g),b={entering:"scale-100",entered:"scale-100",exiting:"scale-75",exited:"scale-75",unmounted:""},v=l.useMemo(()=>{var m;return[{sm:"min-[576px]:w-[300px]",md:"min-[576px]:w-[500px]",lg:"min-[992px]:w-[800px]"}[a],(m=e==null?void 0:e.size)==null?void 0:m[a]]},[a,e==null?void 0:e.size]);return s.jsx(p,{as:"div",style:{transitionDuration:`${r}ms`},className:j.twMerge("max-w-full max-h-full m-auto transition-transform",e==null?void 0:e.base,v,b[i],t),...o,children:n})}function N({className:t,...n}){const o=u(e=>e.modal.header.base);return s.jsx(p.Header,{className:f(o,t),...n})}function S({className:t,...n}){const o=u(e=>e.modal.body.base);return s.jsx(p.Body,{className:f(o,t),...n})}function k({className:t,...n}){const o=u(e=>e.modal.footer.base);return s.jsx(p.Footer,{className:f(o,t),...n})}c.Dialog=H;c.Header=N;c.Body=S;c.Footer=k;exports.ModalContext=g;exports.default=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAIlE,OAAO,EACL,cAAc,EAEd,WAAW,EAKZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAc,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAKtE,KAAK,OAAO,GAAG;IACb,IAAI,EAAE,IAAI,CAAC;IACX,eAAe,EAAE,gBAAgB,CAAC;IAClC,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,WAAW,CAAC;AAChB,KAAK,UAAU,GAAG;IAChB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AACzB,KAAK,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,CAAC;AAClE,KAAK,gBAAgB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAC9C,KAAK,cAAc,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAC5C,KAAK,gBAAgB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE9C,eAAO,MAAM,YAAY,kCAMvB,CAAC;AAEH,iBAAS,KAAK,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,EAC5C,EAAE,EACF,GAAG,EACH,IAAW,EACX,IAAY,EACZ,OAAkB,EAClB,QAAc,EACd,YAAoB,EACpB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,CAAC,EAAE,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAIlE,OAAO,EACL,cAAc,EAEd,WAAW,EAKZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAc,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAKtE,KAAK,OAAO,GAAG;IACb,IAAI,EAAE,IAAI,CAAC;IACX,eAAe,EAAE,gBAAgB,CAAC;IAClC,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,WAAW,CAAC;AAChB,KAAK,UAAU,GAAG;IAChB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AACzB,KAAK,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,CAAC;AAClE,KAAK,gBAAgB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAC9C,KAAK,cAAc,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAC5C,KAAK,gBAAgB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAE9C,eAAO,MAAM,YAAY,kCAMvB,CAAC;AAEH,iBAAS,KAAK,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,EAC5C,EAAE,EACF,GAAG,EACH,IAAW,EACX,IAAY,EACZ,OAAkB,EAClB,QAAc,EACd,YAAoB,EACpB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,CAAC,EAAE,UAAU,CAAC,2CA4DrC;kBAvEQ,KAAK;;;;;;AAwEd,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAkCvE;AACD,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAG7D;AACD,iBAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,2CAGzD;AACD,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CAG7D;AAOD,eAAe,KAAK,CAAC"}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import { jsx as a, jsxs as h } from "react/jsx-runtime";
|
|
3
3
|
import u from "../../helpers/cn.es.js";
|
|
4
4
|
import l from "../../hooks/useClasses.es.js";
|
|
5
|
-
import { createContext as
|
|
6
|
-
import { useHotkey as
|
|
5
|
+
import { createContext as w, useRef as N, useImperativeHandle as H, useContext as k, useMemo as B } from "react";
|
|
6
|
+
import { useHotkey as D } from "../../node_modules/@tanstack/react-hotkeys/dist/useHotkey.es.js";
|
|
7
7
|
import { twMerge as g } from "../../node_modules/tailwind-merge/dist/bundle-mjs.es.js";
|
|
8
8
|
import f from "../Card/index.es.js";
|
|
9
|
-
import
|
|
9
|
+
import S from "../Portal/index.es.js";
|
|
10
10
|
import F from "../../node_modules/react-transition-group/esm/Transition.es.js";
|
|
11
|
-
const z =
|
|
11
|
+
const z = w({
|
|
12
12
|
size: "md",
|
|
13
13
|
open: !1,
|
|
14
14
|
onClose: () => {
|
|
@@ -21,41 +21,45 @@ function p({
|
|
|
21
21
|
ref: o,
|
|
22
22
|
size: n = "md",
|
|
23
23
|
open: e = !1,
|
|
24
|
-
onClose:
|
|
24
|
+
onClose: i = () => {
|
|
25
25
|
},
|
|
26
|
-
duration:
|
|
26
|
+
duration: s = 300,
|
|
27
27
|
preventClose: r = !1,
|
|
28
28
|
className: x,
|
|
29
|
-
children:
|
|
30
|
-
...
|
|
29
|
+
children: v,
|
|
30
|
+
...c
|
|
31
31
|
}) {
|
|
32
|
-
const
|
|
32
|
+
const m = l((d) => d.modal.base), y = N(null), C = t || "div", M = {
|
|
33
33
|
entering: "active opacity-100 pointer-events-auto",
|
|
34
34
|
entered: "active opacity-100 pointer-events-auto",
|
|
35
35
|
exiting: "opacity-0 pointer-events-none",
|
|
36
36
|
exited: "opacity-0 pointer-events-none",
|
|
37
37
|
unmounted: ""
|
|
38
|
-
},
|
|
39
|
-
r ||
|
|
38
|
+
}, b = () => {
|
|
39
|
+
r || i();
|
|
40
40
|
};
|
|
41
|
-
return H(o, () =>
|
|
41
|
+
return H(o, () => y.current), D("Escape", () => i(), {
|
|
42
|
+
conflictBehavior: "allow",
|
|
43
|
+
ignoreInputs: !0,
|
|
44
|
+
enabled: e && !r
|
|
45
|
+
}), /* @__PURE__ */ a(S, { children: /* @__PURE__ */ a(F, { nodeRef: y, in: e, timeout: s, unmountOnExit: !0, children: (d) => /* @__PURE__ */ h(
|
|
42
46
|
C,
|
|
43
47
|
{
|
|
44
|
-
ref:
|
|
48
|
+
ref: y,
|
|
45
49
|
"data-open": e,
|
|
46
|
-
style: { transitionDuration: `${
|
|
50
|
+
style: { transitionDuration: `${s}ms` },
|
|
47
51
|
className: g(
|
|
48
52
|
"modal fixed size-full inset-0 flex flex-col z-10 bg-black/20 transition-opacity backdrop-blur p-4",
|
|
49
|
-
|
|
53
|
+
m,
|
|
50
54
|
M[d],
|
|
51
55
|
x
|
|
52
56
|
),
|
|
53
|
-
...
|
|
57
|
+
...c,
|
|
54
58
|
children: [
|
|
55
59
|
/* @__PURE__ */ a(
|
|
56
60
|
"div",
|
|
57
61
|
{
|
|
58
|
-
onClick:
|
|
62
|
+
onClick: b,
|
|
59
63
|
className: u(
|
|
60
64
|
"absolute inset-0 cursor-default opacity-0",
|
|
61
65
|
r && "[&:active~*]:scale-95"
|
|
@@ -68,11 +72,11 @@ function p({
|
|
|
68
72
|
value: {
|
|
69
73
|
size: n,
|
|
70
74
|
open: e,
|
|
71
|
-
onClose:
|
|
75
|
+
onClose: b,
|
|
72
76
|
transitionState: d,
|
|
73
|
-
duration:
|
|
77
|
+
duration: s
|
|
74
78
|
},
|
|
75
|
-
children:
|
|
79
|
+
children: v
|
|
76
80
|
}
|
|
77
81
|
)
|
|
78
82
|
]
|
|
@@ -80,20 +84,20 @@ function p({
|
|
|
80
84
|
) }) });
|
|
81
85
|
}
|
|
82
86
|
function R({ className: t, children: o, ...n }) {
|
|
83
|
-
const e = l((
|
|
87
|
+
const e = l((c) => c.modal.dialog), { size: i, transitionState: s, duration: r } = k(z), x = {
|
|
84
88
|
entering: "scale-100",
|
|
85
89
|
entered: "scale-100",
|
|
86
90
|
exiting: "scale-75",
|
|
87
91
|
exited: "scale-75",
|
|
88
92
|
unmounted: ""
|
|
89
|
-
},
|
|
90
|
-
var
|
|
93
|
+
}, v = B(() => {
|
|
94
|
+
var m;
|
|
91
95
|
return [{
|
|
92
96
|
sm: "min-[576px]:w-[300px]",
|
|
93
97
|
md: "min-[576px]:w-[500px]",
|
|
94
98
|
lg: "min-[992px]:w-[800px]"
|
|
95
|
-
}[
|
|
96
|
-
}, [
|
|
99
|
+
}[i], (m = e == null ? void 0 : e.size) == null ? void 0 : m[i]];
|
|
100
|
+
}, [i, e == null ? void 0 : e.size]);
|
|
97
101
|
return /* @__PURE__ */ a(
|
|
98
102
|
f,
|
|
99
103
|
{
|
|
@@ -102,8 +106,8 @@ function R({ className: t, children: o, ...n }) {
|
|
|
102
106
|
className: g(
|
|
103
107
|
"max-w-full max-h-full m-auto transition-transform",
|
|
104
108
|
e == null ? void 0 : e.base,
|
|
105
|
-
|
|
106
|
-
x[
|
|
109
|
+
v,
|
|
110
|
+
x[s],
|
|
107
111
|
t
|
|
108
112
|
),
|
|
109
113
|
...n,
|
|
@@ -119,14 +123,14 @@ function E({ className: t, ...o }) {
|
|
|
119
123
|
const n = l((e) => e.modal.body.base);
|
|
120
124
|
return /* @__PURE__ */ a(f.Body, { className: u(n, t), ...o });
|
|
121
125
|
}
|
|
122
|
-
function
|
|
126
|
+
function I({ className: t, ...o }) {
|
|
123
127
|
const n = l((e) => e.modal.footer.base);
|
|
124
128
|
return /* @__PURE__ */ a(f.Footer, { className: u(n, t), ...o });
|
|
125
129
|
}
|
|
126
130
|
p.Dialog = R;
|
|
127
131
|
p.Header = j;
|
|
128
132
|
p.Body = E;
|
|
129
|
-
p.Footer =
|
|
133
|
+
p.Footer = I;
|
|
130
134
|
export {
|
|
131
135
|
z as ModalContext,
|
|
132
136
|
p as default
|