reaxify 0.0.91 → 0.0.92

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.
@@ -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:u=!1,anchor:l="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[l];return[c[l],D]},[l,t==null?void 0:t.anchor]),g=()=>{u||e()};return i.useImperativeHandle(a,()=>d.current),R.useHotkey("Escape",()=>e(),{enabled:r&&!u}),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",u&&"[&:active~*]:scale-95")}),s.jsx(p.Provider,{value:{open:r,onClose:g,transitionState:c,duration:o,anchor:l,preventClose:u},children:b})]})})})}function k({children:n,className:a="",...r}){const e=x(t=>t.drawer.menu),{anchor:o,duration:u,transitionState:l,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:`${u}ms`},className:C.twMerge("relative flex flex-col transition-[translate,width] rounded-none",y&&"transition-transform",e==null?void 0:e.base,h[l],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 z({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 B({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=z;f.Footer=B;exports.DrawerContext=p;exports.default=f;
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,C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AC,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 c from "../../hooks/useClasses.es.js";
4
- import { createContext as M, useRef as z, useMemo as b, useImperativeHandle as B, useContext as F } from "react";
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 = M({
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 = c((u) => u.drawer), d = z(null), m = n || "div", R = {
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 = b(() => {
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]), h = () => {
48
+ }, [l, t == null ? void 0 : t.anchor]), b = () => {
49
49
  i || e();
50
50
  };
51
- return B(a, () => d.current), S("Escape", () => e(), { enabled: r && !i }), /* @__PURE__ */ s(j, { children: /* @__PURE__ */ s(E, { nodeRef: d, in: r, timeout: o, unmountOnExit: !0, children: (u) => /* @__PURE__ */ k(
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: d,
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: h,
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: h,
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 P({ children: n, className: a = "", ...r }) {
95
- const e = c((t) => t.drawer.menu), { anchor: o, duration: i, transitionState: l, preventClose: p } = F(D), v = b(() => {
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
- }, d = (m = e == null ? void 0 : e.anchor) == null ? void 0 : m[o];
103
- return [t[o], d];
104
- }, [o, e == null ? void 0 : e.anchor]), y = b(() => ({
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 $({ className: n, ...a }) {
153
- const r = c((e) => e.drawer.header.base);
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 I({ className: n, ...a }) {
157
- const r = c((e) => e.drawer.body.base);
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 = c((e) => e.drawer.footer.base);
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 = P;
171
- w.Header = $;
172
- w.Body = I;
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"),$=require("../../helpers/cn.cjs.js"),z=require("../../hooks/useClasses.cjs.js"),t=require("react"),I=require("../../node_modules/@tanstack/react-hotkeys/dist/useHotkey.cjs.js"),k=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js"),S=require("../Button/index.cjs.js"),B=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:a,ref:c,open:n,onClose:r,closeOnClick:d=!1,preventClose:f=!1,anchorEl:m=null,className:b,children:l,...M}){const j=z(e=>e.menu.base),p=a||"ul",s=16,o=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=o.current)==null||u.style.setProperty("--left",`${e.left}px`),(h=o.current)==null||h.style.setProperty("--right",`${e.right}px`),(x=o.current)==null||x.style.setProperty("--top",`${e.top}px`)},[]),g=t.useCallback(()=>{var H,P;if(!n||!m)return;const e=m.getBoundingClientRect(),u=window.innerWidth,h=window.innerHeight,x=((H=o.current)==null?void 0:H.offsetWidth)||150,W=((P=o.current)==null?void 0:P.offsetHeight)||200;let w=e.left,C=e.right,v=e.bottom;w=Math.min(Math.max(w,s),u-x-s),C=Math.min(Math.max(u-e.right,s),u-x-s),v=Math.min(Math.max(v,s),h-W-s),q({left:w,right:C,top:v}),R({left:w,right:C,top:v})},[n,m,q,R]),N=()=>{f||r==null||r()};return t.useEffect(()=>{g()},[g,l]),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(c,()=>o.current),I.useHotkey("Escape",()=>r==null?void 0:r(),{enabled:n&&!f}),i.jsx(B,{children:i.jsx(F.default,{nodeRef:o,in:n,timeout:300,unmountOnExit:!0,children:e=>i.jsx(y.Provider,{value:{open:n,onClose:N,transitionState:e,closeOnClick:d,preventClose:f},children:i.jsxs(T,{children:[i.jsx(A,{}),i.jsx(p,{ref:o,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",j,L[e],b),...M,children:l})]})})})})}function T({children:a}){const{transitionState:c}=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[c]),children:a})}function A(){const{onClose:a,preventClose:c}=t.useContext(y);return i.jsx("div",{className:$("w-full flex-1 opacity-0 cursor-default lg:absolute lg:size-full lg:inset-0",c&&"[&:active~*]:scale-95"),onClick:a})}function D({as:a,closeOnClick:c,className:n,children:r,onClick:d,...f}){const m=z(p=>p.menu.item.base),{closeOnClick:b,onClose:l}=t.useContext(y),M=c??b,j=p=>{M&&(l==null||l()),d==null||d(p)};return i.jsx(S,{as:a??"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",m,n),onClick:j,...f,children:r})}E.Item=D;module.exports=E;
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,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,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 o, jsxs as $ } from "react/jsx-runtime";
2
+ import { jsx as i, jsxs as $ } from "react/jsx-runtime";
3
3
  import F from "../../helpers/cn.es.js";
4
- import W from "../../hooks/useClasses.es.js";
5
- import { createContext as T, useRef as L, useCallback as C, useEffect as N, useImperativeHandle as q, useContext as P } from "react";
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: s,
21
- ref: a,
20
+ as: r,
21
+ ref: s,
22
22
  open: e,
23
- onClose: i,
23
+ onClose: l,
24
24
  closeOnClick: u = !1,
25
25
  preventClose: f = !1,
26
26
  anchorEl: m = null,
27
27
  className: y,
28
- children: l,
28
+ children: a,
29
29
  ...b
30
30
  }) {
31
- const M = W((t) => t.menu.base), d = s || "ul", n = 16, r = L(null), j = L({
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
- }), B = {
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 = C((t) => {
42
- j.current = t;
43
- }, []), O = C((t) => {
41
+ }, z = k((t) => {
42
+ N.current = t;
43
+ }, []), O = k((t) => {
44
44
  var c, g, p;
45
- (c = r.current) == null || c.style.setProperty("--left", `${t.left}px`), (g = r.current) == null || g.style.setProperty("--right", `${t.right}px`), (p = r.current) == null || p.style.setProperty("--top", `${t.top}px`);
46
- }, []), h = C(() => {
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 = r.current) == null ? void 0 : R.offsetWidth) || 150, S = ((E = r.current) == null ? void 0 : E.offsetHeight) || 200;
50
- let x = t.left, k = t.right, w = t.bottom;
51
- x = Math.min(Math.max(x, n), c - p - n), k = Math.min(
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
- ), w = Math.min(Math.max(w, n), g - S - n), z({ left: x, right: k, top: w }), O({ left: x, right: k, top: w });
55
- }, [e, m, z, O]), I = () => {
56
- f || i == null || i();
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 N(() => {
58
+ return B(() => {
59
59
  h();
60
- }, [h, l]), N(() => {
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(a, () => r.current), A("Escape", () => i == null ? void 0 : i(), { enabled: e && !f }), /* @__PURE__ */ o(G, { children: /* @__PURE__ */ o(J, { nodeRef: r, in: e, timeout: 300, unmountOnExit: !0, children: (t) => /* @__PURE__ */ o(
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: I,
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__ */ o(U, {}),
79
- /* @__PURE__ */ o(
82
+ /* @__PURE__ */ i(U, {}),
83
+ /* @__PURE__ */ i(
80
84
  d,
81
85
  {
82
- ref: r,
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
- M,
89
- B[t],
92
+ C,
93
+ W[t],
90
94
  y
91
95
  ),
92
96
  ...b,
93
- children: l
97
+ children: a
94
98
  }
95
99
  )
96
100
  ] })
97
101
  }
98
102
  ) }) });
99
103
  }
100
- function Q({ children: s }) {
101
- const { transitionState: a } = P(v);
102
- return /* @__PURE__ */ o(
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
- }[a]
117
+ }[s]
114
118
  ),
115
- children: s
119
+ children: r
116
120
  }
117
121
  );
118
122
  }
119
123
  function U() {
120
- const { onClose: s, preventClose: a } = P(v);
121
- return /* @__PURE__ */ o(
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
- a && "[&:active~*]:scale-95"
130
+ s && "[&:active~*]:scale-95"
127
131
  ),
128
- onClick: s
132
+ onClick: r
129
133
  }
130
134
  );
131
135
  }
132
136
  function V({
133
- as: s,
134
- closeOnClick: a,
137
+ as: r,
138
+ closeOnClick: s,
135
139
  className: e,
136
- children: i,
140
+ children: l,
137
141
  onClick: u,
138
142
  ...f
139
143
  }) {
140
- const m = W((d) => d.menu.item.base), { closeOnClick: y, onClose: l } = P(v), b = a ?? y, M = (d) => {
141
- b && (l == null || l()), u == null || u(d);
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__ */ o(
147
+ return /* @__PURE__ */ i(
144
148
  D,
145
149
  {
146
- as: s ?? "li",
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: M,
159
+ onClick: C,
156
160
  ...f,
157
- children: i
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 o=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:s="md",open:e=!1,onClose:a=()=>{},duration:i=300,preventClose:r=!1,className:b,children:y,...d}){const m=u(x=>x.modal.base),v=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,()=>v.current),C.useHotkey("Escape",()=>a(),{enabled:e&&!r}),o.jsx(h,{children:o.jsx(w.default,{nodeRef:v,in:e,timeout:i,unmountOnExit:!0,children:x=>o.jsxs(q,{ref:v,"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:[o.jsx("div",{onClick:M,className:f("absolute inset-0 cursor-default opacity-0",r&&"[&:active~*]:scale-95")}),o.jsx(g.Provider,{value:{size:s,open:e,onClose:M,transitionState:x,duration:i},children:y})]})})})}function H({className:t,children:n,...s}){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:""},y=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 o.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,y,b[i],t),...s,children:n})}function N({className:t,...n}){const s=u(e=>e.modal.header.base);return o.jsx(p.Header,{className:f(s,t),...n})}function S({className:t,...n}){const s=u(e=>e.modal.body.base);return o.jsx(p.Body,{className:f(s,t),...n})}function k({className:t,...n}){const s=u(e=>e.modal.footer.base);return o.jsx(p.Footer,{className:f(s,t),...n})}c.Dialog=H;c.Header=N;c.Body=S;c.Footer=k;exports.ModalContext=g;exports.default=c;
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,K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E,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 N, useRef as w, useImperativeHandle as H, useContext as k, useMemo as D } from "react";
6
- import { useHotkey as S } from "../../node_modules/@tanstack/react-hotkeys/dist/useHotkey.es.js";
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 B from "../Portal/index.es.js";
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 = N({
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: s = () => {
24
+ onClose: i = () => {
25
25
  },
26
- duration: i = 300,
26
+ duration: s = 300,
27
27
  preventClose: r = !1,
28
28
  className: x,
29
- children: y,
30
- ...m
29
+ children: v,
30
+ ...c
31
31
  }) {
32
- const c = l((d) => d.modal.base), b = w(null), C = t || "div", M = {
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
- }, v = () => {
39
- r || s();
38
+ }, b = () => {
39
+ r || i();
40
40
  };
41
- return H(o, () => b.current), S("Escape", () => s(), { enabled: e && !r }), /* @__PURE__ */ a(B, { children: /* @__PURE__ */ a(F, { nodeRef: b, in: e, timeout: i, unmountOnExit: !0, children: (d) => /* @__PURE__ */ h(
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: b,
48
+ ref: y,
45
49
  "data-open": e,
46
- style: { transitionDuration: `${i}ms` },
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
- c,
53
+ m,
50
54
  M[d],
51
55
  x
52
56
  ),
53
- ...m,
57
+ ...c,
54
58
  children: [
55
59
  /* @__PURE__ */ a(
56
60
  "div",
57
61
  {
58
- onClick: v,
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: v,
75
+ onClose: b,
72
76
  transitionState: d,
73
- duration: i
77
+ duration: s
74
78
  },
75
- children: y
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((m) => m.modal.dialog), { size: s, transitionState: i, duration: r } = k(z), x = {
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
- }, y = D(() => {
90
- var c;
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
- }[s], (c = e == null ? void 0 : e.size) == null ? void 0 : c[s]];
96
- }, [s, e == null ? void 0 : e.size]);
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
- y,
106
- x[i],
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 P({ className: t, ...o }) {
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 = P;
133
+ p.Footer = I;
130
134
  export {
131
135
  z as ModalContext,
132
136
  p as default
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reaxify",
3
3
  "private": false,
4
- "version": "0.0.91",
4
+ "version": "0.0.92",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "files": [