reaxify 0.0.84 → 0.0.86

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.
Files changed (115) hide show
  1. package/dist/components/Alert/index.cjs.js +1 -0
  2. package/dist/components/Alert/index.es.js +8 -0
  3. package/dist/components/Badge/index.cjs.js +1 -1
  4. package/dist/components/Badge/index.es.js +36 -36
  5. package/dist/components/Button/index.cjs.js +1 -1
  6. package/dist/components/Button/index.es.js +75 -57
  7. package/dist/components/Drawer/index.cjs.js +1 -1
  8. package/dist/components/Drawer/index.es.js +75 -71
  9. package/dist/components/Menu/index.cjs.js +1 -1
  10. package/dist/components/Menu/index.es.js +91 -88
  11. package/dist/components/Modal/index.cjs.js +1 -1
  12. package/dist/components/Modal/index.es.js +76 -69
  13. package/dist/components/Progress/index.cjs.js +1 -1
  14. package/dist/components/Progress/index.es.js +21 -21
  15. package/dist/components/Spacer/index.cjs.js +1 -1
  16. package/dist/components/Spacer/index.es.js +13 -7
  17. package/dist/components/Stack/index.cjs.js +1 -1
  18. package/dist/components/Stack/index.es.js +28 -28
  19. package/dist/components/Switch/index.cjs.js +1 -1
  20. package/dist/components/Switch/index.es.js +1 -1
  21. package/dist/components/Tabs/index.cjs.js +1 -1
  22. package/dist/components/Tabs/index.es.js +9 -9
  23. package/dist/helpers/scrollIntoView.cjs.js +1 -1
  24. package/dist/helpers/scrollIntoView.es.js +4 -3
  25. package/dist/hooks/index.cjs.js +1 -1
  26. package/dist/hooks/index.es.js +6 -8
  27. package/dist/node_modules/@tanstack/hotkeys/dist/constants.cjs.js +1 -0
  28. package/dist/node_modules/@tanstack/hotkeys/dist/constants.es.js +206 -0
  29. package/dist/node_modules/@tanstack/hotkeys/dist/format.cjs.js +1 -0
  30. package/dist/node_modules/@tanstack/hotkeys/dist/format.es.js +10 -0
  31. package/dist/node_modules/@tanstack/hotkeys/dist/hotkey-manager.cjs.js +1 -0
  32. package/dist/node_modules/@tanstack/hotkeys/dist/hotkey-manager.es.js +276 -0
  33. package/dist/node_modules/@tanstack/hotkeys/dist/manager.utils.cjs.js +1 -0
  34. package/dist/node_modules/@tanstack/hotkeys/dist/manager.utils.es.js +48 -0
  35. package/dist/node_modules/@tanstack/hotkeys/dist/match.cjs.js +1 -0
  36. package/dist/node_modules/@tanstack/hotkeys/dist/match.es.js +27 -0
  37. package/dist/node_modules/@tanstack/hotkeys/dist/parse.cjs.js +1 -0
  38. package/dist/node_modules/@tanstack/hotkeys/dist/parse.es.js +72 -0
  39. package/dist/node_modules/@tanstack/react-hotkeys/dist/HotkeysProvider.cjs.js +1 -0
  40. package/dist/node_modules/@tanstack/react-hotkeys/dist/HotkeysProvider.es.js +10 -0
  41. package/dist/node_modules/@tanstack/react-hotkeys/dist/useHotkey.cjs.js +1 -0
  42. package/dist/node_modules/@tanstack/react-hotkeys/dist/useHotkey.es.js +35 -0
  43. package/dist/node_modules/@tanstack/react-hotkeys/dist/utils.cjs.js +1 -0
  44. package/dist/node_modules/@tanstack/react-hotkeys/dist/utils.es.js +7 -0
  45. package/dist/node_modules/@tanstack/store/dist/esm/alien.cjs.js +1 -0
  46. package/dist/node_modules/@tanstack/store/dist/esm/alien.es.js +129 -0
  47. package/dist/node_modules/@tanstack/store/dist/esm/atom.cjs.js +1 -0
  48. package/dist/node_modules/@tanstack/store/dist/esm/atom.es.js +124 -0
  49. package/dist/node_modules/@tanstack/store/dist/esm/store.cjs.js +1 -0
  50. package/dist/node_modules/@tanstack/store/dist/esm/store.es.js +24 -0
  51. package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.cjs.js +1 -1
  52. package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.es.js +2 -2
  53. package/dist/node_modules/react-transition-group/esm/Transition.cjs.js +1 -1
  54. package/dist/node_modules/react-transition-group/esm/Transition.es.js +2 -2
  55. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.cjs.js +1 -1
  56. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.es.js +745 -553
  57. package/dist/reaxify.css +1 -1
  58. package/dist/{axios → src/axios}/AxiosProvider.d.ts +1 -1
  59. package/dist/{components → src/components}/Accordion/index.d.ts +1 -1
  60. package/dist/src/components/Alert/index.d.ts +26 -0
  61. package/dist/{components → src/components}/Badge/index.d.ts +1 -1
  62. package/dist/{components → src/components}/Button/index.d.ts +3 -3
  63. package/dist/{components → src/components}/ButtonGroup/index.d.ts +1 -1
  64. package/dist/{components → src/components}/Card/index.d.ts +1 -1
  65. package/dist/{components → src/components}/Drawer/index.d.ts +6 -6
  66. package/dist/src/components/Fill/index.d.ts +3 -0
  67. package/dist/{components → src/components}/InputGroup/index.d.ts +1 -1
  68. package/dist/src/components/Menu/index.d.ts +16 -0
  69. package/dist/{components → src/components}/Modal/index.d.ts +5 -6
  70. package/dist/{components → src/components}/Portal/index.d.ts +1 -1
  71. package/dist/{components → src/components}/Progress/index.d.ts +1 -1
  72. package/dist/src/components/Spacer/index.d.ts +6 -0
  73. package/dist/{components → src/components}/Spinner/index.d.ts +1 -1
  74. package/dist/src/components/Stack/index.d.ts +10 -0
  75. package/dist/{components → src/components}/Switch/index.d.ts +1 -1
  76. package/dist/{components → src/components}/Tabs/index.d.ts +1 -1
  77. package/dist/{components → src/components}/Tooltip/index.d.ts +2 -2
  78. package/dist/{components → src/components}/Typography/index.d.ts +1 -1
  79. package/dist/src/helpers/scrollIntoView.d.ts +1 -0
  80. package/dist/{hooks → src/hooks}/index.d.ts +0 -1
  81. package/dist/{hooks → src/hooks}/useClasses.d.ts +2 -2
  82. package/dist/{providers → src/providers}/ThemeProvider.d.ts +28 -5
  83. package/dist/{types → src/types}/index.d.ts +8 -3
  84. package/package.json +26 -26
  85. package/dist/components/Menu/index.d.ts +0 -15
  86. package/dist/components/Spacer/index.d.ts +0 -6
  87. package/dist/components/Stack/index.d.ts +0 -10
  88. package/dist/helpers/scrollIntoView.d.ts +0 -1
  89. package/dist/hooks/useKeyDown.cjs.js +0 -1
  90. package/dist/hooks/useKeyDown.d.ts +0 -6
  91. package/dist/hooks/useKeyDown.es.js +0 -17
  92. /package/dist/{axios → src/axios}/index.d.ts +0 -0
  93. /package/dist/{axios → src/axios}/types.d.ts +0 -0
  94. /package/dist/{axios → src/axios}/useAxios.d.ts +0 -0
  95. /package/dist/{components → src/components}/Skeleton/index.d.ts +0 -0
  96. /package/dist/{components → src/components}/Table/index.d.ts +0 -0
  97. /package/dist/{components → src/components}/index.d.ts +0 -0
  98. /package/dist/{helpers → src/helpers}/cn.d.ts +0 -0
  99. /package/dist/{helpers → src/helpers}/copy.d.ts +0 -0
  100. /package/dist/{helpers → src/helpers}/index.d.ts +0 -0
  101. /package/dist/{helpers → src/helpers}/isEmpty.d.ts +0 -0
  102. /package/dist/{helpers → src/helpers}/isServer.d.ts +0 -0
  103. /package/dist/{helpers → src/helpers}/randomID.d.ts +0 -0
  104. /package/dist/{helpers → src/helpers}/replaceNonDigits.d.ts +0 -0
  105. /package/dist/{helpers → src/helpers}/replacePersianNumbers.d.ts +0 -0
  106. /package/dist/{helpers → src/helpers}/twoDigitNumber.d.ts +0 -0
  107. /package/dist/{helpers → src/helpers}/wait.d.ts +0 -0
  108. /package/dist/{hooks → src/hooks}/useCreateRipple.d.ts +0 -0
  109. /package/dist/{hooks → src/hooks}/useDebounce.d.ts +0 -0
  110. /package/dist/{hooks → src/hooks}/useDocumentVisible.d.ts +0 -0
  111. /package/dist/{hooks → src/hooks}/useIsOffline.d.ts +0 -0
  112. /package/dist/{hooks → src/hooks}/usePersistedState.d.ts +0 -0
  113. /package/dist/{hooks → src/hooks}/useToggle.d.ts +0 -0
  114. /package/dist/{index.d.ts → src/index.d.ts} +0 -0
  115. /package/dist/{providers → src/providers}/index.d.ts +0 -0
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("../../providers/ThemeProvider.cjs.js");const e=require("react"),t=e.createContext({});exports.AlertContext=t;
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import "react/jsx-runtime";
3
+ import "../../providers/ThemeProvider.es.js";
4
+ import { createContext as t } from "react";
5
+ const i = t({});
6
+ export {
7
+ i as AlertContext
8
+ };
@@ -1 +1 @@
1
- "use client";"use strict";const w=require("react/jsx-runtime"),a=require("../../helpers/cn.cjs.js"),h=require("../../hooks/useClasses.cjs.js"),u=require("react"),k=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js");function q({as:x,variant:i="solid",color:n="primary",size:s="md",className:c,children:p,...l}){const r=h(e=>e.badge),m=x||"span",f=u.useMemo(()=>{var t,b,g;if(!n)return"border-transparent";const e={primary:{solid:"bg-primary text-white border-primary",outline:"bg-transparent text-primary border-primary",soft:"bg-primary/10 text-primary border-primary/10"},secondary:{solid:"bg-secondary text-white border-secondary",outline:"bg-transparent text-secondary border-secondary",soft:"bg-secondary/10 text-secondary border-secondary/10"},success:{solid:"bg-success text-white border-success",outline:"bg-transparent text-success border-success",soft:"bg-success/10 text-success border-success/10"},info:{solid:"bg-info text-white border-info",outline:"bg-transparent text-info border-info",soft:"bg-info/10 text-info border-info/10"},warning:{solid:"bg-warning text-white border-warning",outline:"bg-transparent text-warning border-warning",soft:"bg-warning/10 text-warning border-warning/10"},danger:{solid:"bg-danger text-white border-danger",outline:"bg-transparent text-danger border-danger",soft:"bg-danger/10 text-danger border-danger/10"},dark:{solid:"bg-dark text-white border-dark",outline:"bg-transparent text-dark border-dark",soft:"bg-dark/10 text-dark border-dark/10"},light:{solid:"bg-light text-dark border-light",outline:"bg-transparent text-dark border-light",soft:"bg-light/10 text-dark border-light/10"}},o=(t=e==null?void 0:e[n])==null?void 0:t[i],d=(g=(b=r==null?void 0:r.color)==null?void 0:b[n])==null?void 0:g[i];return[o,d]},[n,i,r==null?void 0:r.color]),y=u.useMemo(()=>{var o,d,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",(d=r==null?void 0:r.size)==null?void 0:d.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 w.jsx(m,{className:k.twMerge("inline-flex border border-[#e8eaee] items-center text-center font-medium align-middle whitespace-nowrap rounded",r==null?void 0:r.base,f,y,c),...l,children:p})}module.exports=q;
1
+ "use client";"use strict";const y=require("react/jsx-runtime"),s=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:a="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-dark 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(!a)return null;const e={sm:s("text-xs py-0.5 px-1.5",(o=r==null?void 0:r.size)==null?void 0:o.sm),md:s("text-sm py-[0.1875rem] px-2",(i=r==null?void 0:r.size)==null?void 0:i.md),lg:s("text-base py-1 px-3",(t=r==null?void 0:r.size)==null?void 0:t.lg)};return e==null?void 0:e[a]},[a,r==null?void 0:r.size]);return y.jsx(h,{className:k.twMerge("inline-flex border border-[#e8eaee] 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;
@@ -1,86 +1,86 @@
1
1
  "use client";
2
- import { jsx as w } from "react/jsx-runtime";
3
- import s from "../../helpers/cn.es.js";
4
- import h from "../../hooks/useClasses.es.js";
5
- import { useMemo as x } from "react";
2
+ import { jsx as y } from "react/jsx-runtime";
3
+ import g from "../../helpers/cn.es.js";
4
+ import w from "../../hooks/useClasses.es.js";
5
+ import { useMemo as l } from "react";
6
6
  import { twMerge as k } from "../../node_modules/tailwind-merge/dist/bundle-mjs.es.js";
7
7
  function B({
8
- as: p,
9
- variant: i = "solid",
8
+ as: x,
9
+ variant: d = "solid",
10
10
  color: o = "primary",
11
11
  size: a = "md",
12
- className: m,
13
- children: u,
14
- ...c
12
+ className: p,
13
+ children: m,
14
+ ...u
15
15
  }) {
16
- const r = h((e) => e.badge), f = p || "span", l = x(() => {
17
- var t, b, g;
16
+ const r = w((t) => t.badge), c = x || "span", f = l(() => {
17
+ var e, s, b;
18
18
  if (!o) return "border-transparent";
19
- const e = {
19
+ const t = {
20
20
  primary: {
21
21
  solid: "bg-primary text-white border-primary",
22
22
  outline: "bg-transparent text-primary border-primary",
23
- soft: "bg-primary/10 text-primary border-primary/10"
23
+ soft: "bg-light-primary text-dark-primary border-light-primary"
24
24
  },
25
25
  secondary: {
26
26
  solid: "bg-secondary text-white border-secondary",
27
27
  outline: "bg-transparent text-secondary border-secondary",
28
- soft: "bg-secondary/10 text-secondary border-secondary/10"
28
+ soft: "bg-light-secondary text-dark-secondary border-light-secondary"
29
29
  },
30
30
  success: {
31
31
  solid: "bg-success text-white border-success",
32
32
  outline: "bg-transparent text-success border-success",
33
- soft: "bg-success/10 text-success border-success/10"
33
+ soft: "bg-light-success text-dark-success border-light-success"
34
34
  },
35
35
  info: {
36
36
  solid: "bg-info text-white border-info",
37
37
  outline: "bg-transparent text-info border-info",
38
- soft: "bg-info/10 text-info border-info/10"
38
+ soft: "bg-light-info text-dark-info border-light-info"
39
39
  },
40
40
  warning: {
41
41
  solid: "bg-warning text-white border-warning",
42
42
  outline: "bg-transparent text-warning border-warning",
43
- soft: "bg-warning/10 text-warning border-warning/10"
43
+ soft: "bg-light-warning text-dark-warning border-light-warning"
44
44
  },
45
45
  danger: {
46
46
  solid: "bg-danger text-white border-danger",
47
47
  outline: "bg-transparent text-danger border-danger",
48
- soft: "bg-danger/10 text-danger border-danger/10"
48
+ soft: "bg-light-danger text-dark-danger border-light-danger"
49
49
  },
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/10 text-dark border-dark/10"
53
+ soft: "bg-dark text-dark border-dark"
54
54
  },
55
55
  light: {
56
56
  solid: "bg-light text-dark border-light",
57
57
  outline: "bg-transparent text-dark border-light",
58
- soft: "bg-light/10 text-dark border-light/10"
58
+ soft: "bg-light text-dark border-light"
59
59
  }
60
- }, n = (t = e == null ? void 0 : e[o]) == null ? void 0 : t[i], d = (g = (b = r == null ? void 0 : r.color) == null ? void 0 : b[o]) == null ? void 0 : g[i];
61
- return [n, d];
62
- }, [o, i, r == null ? void 0 : r.color]), y = x(() => {
63
- var n, d, t;
60
+ }, n = (e = t == null ? void 0 : t[o]) == null ? void 0 : e[d], i = (b = (s = r == null ? void 0 : r.color) == null ? void 0 : s[o]) == null ? void 0 : b[d];
61
+ return [n, i];
62
+ }, [o, d, r == null ? void 0 : r.color]), h = l(() => {
63
+ var n, i, e;
64
64
  if (!a) return null;
65
- const e = {
66
- sm: s("text-xs py-0.5 px-1.5", (n = r == null ? void 0 : r.size) == null ? void 0 : n.sm),
67
- md: s("text-sm py-[0.1875rem] px-2", (d = r == null ? void 0 : r.size) == null ? void 0 : d.md),
68
- lg: s("text-base py-1 px-3", (t = r == null ? void 0 : r.size) == null ? void 0 : t.lg)
65
+ const t = {
66
+ sm: g("text-xs py-0.5 px-1.5", (n = r == null ? void 0 : r.size) == null ? void 0 : n.sm),
67
+ md: g("text-sm py-[0.1875rem] px-2", (i = r == null ? void 0 : r.size) == null ? void 0 : i.md),
68
+ lg: g("text-base py-1 px-3", (e = r == null ? void 0 : r.size) == null ? void 0 : e.lg)
69
69
  };
70
- return e == null ? void 0 : e[a];
70
+ return t == null ? void 0 : t[a];
71
71
  }, [a, r == null ? void 0 : r.size]);
72
- return /* @__PURE__ */ w(
73
- f,
72
+ return /* @__PURE__ */ y(
73
+ c,
74
74
  {
75
75
  className: k(
76
76
  "inline-flex border border-[#e8eaee] items-center text-center font-medium align-middle whitespace-nowrap rounded",
77
77
  r == null ? void 0 : r.base,
78
- l,
79
- y,
80
- m
78
+ f,
79
+ h,
80
+ p
81
81
  ),
82
- ...c,
83
- children: u
82
+ ...u,
83
+ children: m
84
84
  }
85
85
  );
86
86
  }
@@ -1 +1 @@
1
- "use client";"use strict";const l=require("react/jsx-runtime"),r=require("react"),f=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js"),m=require("../../helpers/cn.cjs.js"),H=require("../../hooks/useClasses.cjs.js"),I=require("../../hooks/useCreateRipple.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:w,variant:y,color:u,size:h,loading:C,stopPropagation:v=!1,preventDefault:q=!1,closeModal:k=!1,closeDrawer:M=!1,className:j,onClick:b,children:z,disabled:R,...N}){const t=H(e=>e.button),n=r.useContext(J.ButtonGroupContext),D=r.useContext(L.ModalContext),$=r.useContext(K.DrawerContext),B=I(),G=w||"button",c=y??n.variant??"solid",i=r.useMemo(()=>u!==void 0?u:n.color!==void 0?n.color:"primary",[u,n.color]),a=h??n.size??"md",d=C??n.loading??!1,s=r.useMemo(()=>{var p,x,g;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"},secondary:{solid:"bg-secondary text-white border-secondary",outline:"bg-transparent text-secondary border-secondary",text:"bg-transparent text-secondary border-transparent"},success:{solid:"bg-success text-white border-success",outline:"bg-transparent text-success border-success",text:"bg-transparent text-success border-transparent"},info:{solid:"bg-info text-white border-info",outline:"bg-transparent text-info border-info",text:"bg-transparent text-info border-transparent"},warning:{solid:"bg-warning text-white border-warning",outline:"bg-transparent text-warning border-warning",text:"bg-transparent text-warning border-transparent"},danger:{solid:"bg-danger text-white border-danger",outline:"bg-transparent text-danger border-danger",text:"bg-transparent text-danger border-transparent"},dark:{solid:"bg-dark text-white border-dark",outline:"bg-transparent text-dark border-dark",text:"bg-transparent text-dark border-transparent"},light:{solid:"bg-light text-dark border-light",outline:"bg-transparent text-dark border-light",text:"bg-transparent text-dark border-transparent"}},o=(x=(p=t==null?void 0:t.color)==null?void 0:p[i])==null?void 0:x[c],F=(g=e==null?void 0:e[i])==null?void 0:g[c];return f.twMerge(F,o)},[i,c,t==null?void 0:t.color]),P=r.useMemo(()=>s==null?void 0:s.split(" ").find(e=>e.startsWith("text-")),[s]),W=r.useMemo(()=>{var o;if(!a)return null;const e={sm:"text-base py-1 px-3.5",md:"text-base py-1.5 px-4",lg:"text-lg py-2 px-6"};return[e==null?void 0:e[a],(o=t==null?void 0:t.size)==null?void 0:o[a]]},[a,t==null?void 0:t.size]),A=r.useMemo(()=>{var e,o;return d?m("disabled:opacity-100 disabled:cursor-wait disabled:text-transparent",(e=t==null?void 0:t.loading)==null?void 0:e.active):m("disabled:opacity-75 disabled:cursor-not-allowed",(o=t==null?void 0:t.loading)==null?void 0:o.inactive)},[d,t==null?void 0:t.loading]),E=e=>{B(e),k&&D.onClose(),M&&$.onClose(),v&&e.stopPropagation(),q&&e.preventDefault(),b==null||b(e)};return l.jsxs(G,{className:f.twMerge("relative inline-block no-underline whitespace-nowrap font-medium text-center rounded border border-[#e8eaee] cursor-pointer transition-[box-shadow,opacity,color,background-color,border-color]",t==null?void 0:t.base,s,W,A,n.buttonClasses,j),onClick:E,disabled:R||d,...N,children:[z,d&&l.jsx("span",{className:"absolute inset-0 size-full flex items-center justify-center bg-transparent p-2",children:l.jsx(O,{size:a,color:null,className:P})}),l.jsx("span",{className:"ripple-group absolute size-full inset-0 overflow-hidden rounded-[inherit] pointer-events-none"})]})}module.exports=Q;
1
+ "use client";"use strict";const l=require("react/jsx-runtime"),r=require("react"),f=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js"),h=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:m,variant:y,color:w,size:k,loading:C,stopPropagation:v=!1,preventDefault:q=!1,closeModal:z=!1,closeDrawer:j=!1,className:M,onClick:b,children:R,disabled:N,...$}){const t=F(e=>e.button),a=r.useContext(J.ButtonGroupContext),D=r.useContext(L.ModalContext),_=r.useContext(K.DrawerContext),u=r.useContext(I.AlertContext),B=H(),G=m||"button",g=y??a.variant??u.buttonVariant??"solid",i=w??a.color??u.color??"primary",o=k??a.size??"md",d=C??a.loading??!1,s=r.useMemo(()=>{var c,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-light 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-dark"}},n=(x=(c=t==null?void 0:t.color)==null?void 0:c[i])==null?void 0:x[g],E=(p=e==null?void 0:e[i])==null?void 0:p[g];return f.twMerge(E,n)},[i,g,t==null?void 0:t.color]),A=r.useMemo(()=>s==null?void 0:s.split(" ").find(e=>e.startsWith("text-")),[s]),P=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]),V=r.useMemo(()=>{var e,n;return d?h("disabled:opacity-100 disabled:cursor-wait disabled:text-transparent",(e=t==null?void 0:t.loading)==null?void 0:e.active):h("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]),W=e=>{B(e),z&&D.onClose(),j&&_.onClose(),v&&e.stopPropagation(),q&&e.preventDefault(),b==null||b(e)};return l.jsxs(G,{role:"button",className:f.twMerge("relative inline-block no-underline whitespace-nowrap font-medium text-center rounded border border-[#e8eaee] cursor-pointer transition-[box-shadow,opacity,color,background-color,border-color] [user-select:none]",t==null?void 0:t.base,s,P,V,a.buttonClasses,M),onClick:W,disabled:N||d,...$,children:[R,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:A})}),l.jsx("span",{className:"ripple-group absolute size-full inset-0 overflow-hidden rounded-[inherit] pointer-events-none"})]})}module.exports=Q;
@@ -1,102 +1,113 @@
1
1
  "use client";
2
- import { jsxs as I, jsx as u } from "react/jsx-runtime";
3
- import { useContext as c, useMemo as i } from "react";
4
- import { twMerge as f } from "../../node_modules/tailwind-merge/dist/bundle-mjs.es.js";
5
- import w from "../../helpers/cn.es.js";
6
- import J from "../../hooks/useClasses.es.js";
7
- import K from "../../hooks/useCreateRipple.es.js";
2
+ import { jsxs as H, jsx as p } from "react/jsx-runtime";
3
+ import { useContext as d, useMemo as l } from "react";
4
+ import { twMerge as m } from "../../node_modules/tailwind-merge/dist/bundle-mjs.es.js";
5
+ import h from "../../helpers/cn.es.js";
6
+ import I from "../../hooks/useClasses.es.js";
7
+ import J from "../../hooks/useCreateRipple.es.js";
8
+ import { AlertContext as K } from "../Alert/index.es.js";
8
9
  import { ButtonGroupContext as L } from "../ButtonGroup/index.es.js";
9
10
  import { DrawerContext as O } from "../Drawer/index.es.js";
10
11
  import { ModalContext as Q } from "../Modal/index.es.js";
11
12
  import T from "../Spinner/index.es.js";
12
- function nt({
13
+ function it({
13
14
  as: y,
14
- variant: h,
15
- color: l,
16
- size: v,
17
- loading: C,
18
- stopPropagation: k = !1,
19
- preventDefault: z = !1,
15
+ variant: w,
16
+ color: k,
17
+ size: C,
18
+ loading: v,
19
+ stopPropagation: z = !1,
20
+ preventDefault: j = !1,
20
21
  closeModal: N = !1,
21
22
  closeDrawer: R = !1,
22
- className: j,
23
- onClick: p,
24
- children: D,
25
- disabled: M,
23
+ className: D,
24
+ onClick: b,
25
+ children: M,
26
+ disabled: _,
26
27
  ...B
27
28
  }) {
28
- const t = J((r) => r.button), e = c(L), G = c(Q), P = c(O), S = K(), W = y || "button", b = h ?? e.variant ?? "solid", s = i(() => l !== void 0 ? l : e.color !== void 0 ? e.color : "primary", [l, e.color]), o = v ?? e.size ?? "md", d = C ?? e.loading ?? !1, a = i(() => {
29
- var g, x, m;
30
- if (!s) return "border-transparent";
29
+ const t = I((r) => r.button), o = d(L), G = d(Q), A = d(O), c = d(K), P = J(), S = y || "button", g = w ?? o.variant ?? c.buttonVariant ?? "solid", i = k ?? o.color ?? c.color ?? "primary", n = C ?? o.size ?? "md", s = v ?? o.loading ?? !1, a = l(() => {
30
+ var u, x, f;
31
+ if (!i) return "border-transparent";
31
32
  const r = {
32
33
  primary: {
33
34
  solid: "bg-primary text-white border-primary",
34
35
  outline: "bg-transparent text-primary border-primary",
35
- text: "bg-transparent text-primary border-transparent"
36
+ text: "bg-transparent text-primary border-transparent",
37
+ soft: "bg-light-primary text-dark-primary border-light-primary"
36
38
  },
37
39
  secondary: {
38
40
  solid: "bg-secondary text-white border-secondary",
39
41
  outline: "bg-transparent text-secondary border-secondary",
40
- text: "bg-transparent text-secondary border-transparent"
42
+ text: "bg-transparent text-secondary border-transparent",
43
+ soft: "bg-light-secondary text-dark-secondary border-light-secondary"
41
44
  },
42
45
  success: {
43
46
  solid: "bg-success text-white border-success",
44
47
  outline: "bg-transparent text-success border-success",
45
- text: "bg-transparent text-success border-transparent"
48
+ text: "bg-transparent text-success border-transparent",
49
+ soft: "bg-light-success text-dark-success border-light-success"
46
50
  },
47
51
  info: {
48
52
  solid: "bg-info text-white border-info",
49
53
  outline: "bg-transparent text-info border-info",
50
- text: "bg-transparent text-info border-transparent"
54
+ text: "bg-transparent text-info border-transparent",
55
+ soft: "bg-light-info text-dark-info border-light-info"
51
56
  },
52
57
  warning: {
53
58
  solid: "bg-warning text-white border-warning",
54
59
  outline: "bg-transparent text-warning border-warning",
55
- text: "bg-transparent text-warning border-transparent"
60
+ text: "bg-transparent text-warning border-transparent",
61
+ soft: "bg-light-warning text-dark-warning border-light-warning"
56
62
  },
57
63
  danger: {
58
64
  solid: "bg-danger text-white border-danger",
59
65
  outline: "bg-transparent text-danger border-danger",
60
- text: "bg-transparent text-danger border-transparent"
66
+ text: "bg-transparent text-danger border-transparent",
67
+ soft: "bg-light-danger text-dark-danger border-light-danger"
61
68
  },
62
69
  dark: {
63
70
  solid: "bg-dark text-white border-dark",
64
71
  outline: "bg-transparent text-dark border-dark",
65
- text: "bg-transparent text-dark border-transparent"
72
+ text: "bg-transparent text-dark border-transparent",
73
+ soft: "bg-dark text-light border-dark"
66
74
  },
67
75
  light: {
68
76
  solid: "bg-light text-dark border-light",
69
77
  outline: "bg-transparent text-dark border-light",
70
- text: "bg-transparent text-dark border-transparent"
78
+ text: "bg-transparent text-dark border-transparent",
79
+ soft: "bg-light- text-dark border-dark"
71
80
  }
72
- }, n = (x = (g = t == null ? void 0 : t.color) == null ? void 0 : g[s]) == null ? void 0 : x[b], H = (m = r == null ? void 0 : r[s]) == null ? void 0 : m[b];
73
- return f(H, n);
74
- }, [s, b, t == null ? void 0 : t.color]), q = i(() => a == null ? void 0 : a.split(" ").find((r) => r.startsWith("text-")), [a]), A = i(() => {
75
- var n;
76
- if (!o) return null;
81
+ }, e = (x = (u = t == null ? void 0 : t.color) == null ? void 0 : u[i]) == null ? void 0 : x[g], F = (f = r == null ? void 0 : r[i]) == null ? void 0 : f[g];
82
+ return m(F, e);
83
+ }, [i, g, t == null ? void 0 : t.color]), V = l(() => a == null ? void 0 : a.split(" ").find((r) => r.startsWith("text-")), [a]), W = l(() => {
84
+ var e;
85
+ if (!n) return null;
77
86
  const r = {
78
- sm: "text-base py-1 px-3.5",
87
+ sm: "text-sm py-1 px-3.5",
79
88
  md: "text-base py-1.5 px-4",
80
- lg: "text-lg py-2 px-6"
89
+ lg: "text-xl py-1.5 px-6",
90
+ 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"
81
91
  };
82
- return [r == null ? void 0 : r[o], (n = t == null ? void 0 : t.size) == null ? void 0 : n[o]];
83
- }, [o, t == null ? void 0 : t.size]), E = i(() => {
84
- var r, n;
85
- return d ? w(
92
+ return [r == null ? void 0 : r[n], (e = t == null ? void 0 : t.size) == null ? void 0 : e[n]];
93
+ }, [n, t == null ? void 0 : t.size]), q = l(() => {
94
+ var r, e;
95
+ return s ? h(
86
96
  "disabled:opacity-100 disabled:cursor-wait disabled:text-transparent",
87
97
  (r = t == null ? void 0 : t.loading) == null ? void 0 : r.active
88
- ) : w(
98
+ ) : h(
89
99
  "disabled:opacity-75 disabled:cursor-not-allowed",
90
- (n = t == null ? void 0 : t.loading) == null ? void 0 : n.inactive
100
+ (e = t == null ? void 0 : t.loading) == null ? void 0 : e.inactive
91
101
  );
92
- }, [d, t == null ? void 0 : t.loading]), F = (r) => {
93
- S(r), N && G.onClose(), R && P.onClose(), k && r.stopPropagation(), z && r.preventDefault(), p == null || p(r);
102
+ }, [s, t == null ? void 0 : t.loading]), E = (r) => {
103
+ P(r), N && G.onClose(), R && A.onClose(), z && r.stopPropagation(), j && r.preventDefault(), b == null || b(r);
94
104
  };
95
- return /* @__PURE__ */ I(
96
- W,
105
+ return /* @__PURE__ */ H(
106
+ S,
97
107
  {
98
- className: f(
99
- "relative inline-block no-underline whitespace-nowrap font-medium text-center rounded border border-[#e8eaee] cursor-pointer transition-[box-shadow,opacity,color,background-color,border-color]",
108
+ role: "button",
109
+ className: m(
110
+ "relative inline-block no-underline whitespace-nowrap font-medium text-center rounded border border-[#e8eaee] cursor-pointer transition-[box-shadow,opacity,color,background-color,border-color] [user-select:none]",
100
111
  // "focus:outline-none focus:ring-2 focus:ring-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
101
112
  // variant === "solid"
102
113
  // ? "shadow hover:shadow-md active:shadow-lg"
@@ -104,22 +115,29 @@ function nt({
104
115
  // color ? "ring-2 ring-offset-2 ring-transparent" : null,
105
116
  t == null ? void 0 : t.base,
106
117
  a,
107
- A,
108
- E,
109
- e.buttonClasses,
110
- j
118
+ W,
119
+ q,
120
+ o.buttonClasses,
121
+ D
111
122
  ),
112
- onClick: F,
113
- disabled: M || d,
123
+ onClick: E,
124
+ disabled: _ || s,
114
125
  ...B,
115
126
  children: [
116
- D,
117
- d && /* @__PURE__ */ u("span", { className: "absolute inset-0 size-full flex items-center justify-center bg-transparent p-2", children: /* @__PURE__ */ u(T, { size: o, color: null, className: q }) }),
118
- /* @__PURE__ */ u("span", { className: "ripple-group absolute size-full inset-0 overflow-hidden rounded-[inherit] pointer-events-none" })
127
+ M,
128
+ s && /* @__PURE__ */ p("span", { className: "absolute inset-0 size-full flex items-center justify-center bg-transparent p-2", children: /* @__PURE__ */ p(
129
+ T,
130
+ {
131
+ size: n === "icon" ? "sm" : n,
132
+ color: null,
133
+ className: V
134
+ }
135
+ ) }),
136
+ /* @__PURE__ */ p("span", { className: "ripple-group absolute size-full inset-0 overflow-hidden rounded-[inherit] pointer-events-none" })
119
137
  ]
120
138
  }
121
139
  );
122
140
  }
123
141
  export {
124
- nt as default
142
+ it as default
125
143
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),d=require("../../hooks/useClasses.cjs.js"),i=require("react"),q=require("../../hooks/useKeyDown.cjs.js"),g=require("../../node_modules/tailwind-merge/dist/bundle-mjs.cjs.js"),b=require("../../helpers/cn.cjs.js"),f=require("../Card/index.cjs.js"),R=require("../Portal/index.cjs.js"),C=require("../../node_modules/react-transition-group/esm/Transition.cjs.js"),p=i.createContext({open:!1,onClose:()=>{},duration:300,anchor:"start",transitionState:"unmounted"});function x({as:n,ref:a,open:r=!1,onClose:e=()=>{},duration:o=300,anchor:u="end",className:w="",children:y,...v}){const t=d(l=>l.drawer),c=i.useRef(null),m=n||"div",j={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:""},D=i.useMemo(()=>{var h;const l={start:"flex-row-reverse",end:"flex-row",top:"flex-col-reverse",bottom:"flex-col"},M=(h=t==null?void 0:t.anchor)==null?void 0:h[u];return[l[u],M]},[u,t==null?void 0:t.anchor]);return i.useImperativeHandle(a,()=>c.current),q(()=>{e==null||e()},{skip:!r,targetKey:"Escape"}),s.jsx(R,{children:s.jsx(C.default,{nodeRef:c,in:r,timeout:o,unmountOnExit:!0,children:l=>s.jsxs(m,{ref:c,style:{transitionDuration:`${o}ms`},"data-open":r,className:g.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,j[l],D,w),...v,children:[s.jsx("button",{type:"button",onClick:()=>e(),className:"absolute inset-0 size-full cursor-default opacity-0"}),s.jsx(p.Provider,{value:{open:r,onClose:e,transitionState:l,duration:o,anchor:u},children:y})]})})})}function N({children:n,className:a="",...r}){const e=d(t=>t.drawer.menu),{anchor:o,duration:u,transitionState:w}=i.useContext(p),y=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 h-[31.875rem] max-h-[92.5%] rounded-b mb-auto",bottom:"w-full h-[31.875rem] max-h-[92.5%] rounded-t mt-auto"},c=(m=e==null?void 0:e.anchor)==null?void 0:m[o];return[t[o],c]},[o,e==null?void 0:e.anchor]),v=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(f,{as:"div",style:{transitionDuration:`${u}ms`},className:g.twMerge("relative flex flex-col transition-[translate,width] rounded-none",e==null?void 0:e.base,v[w],y,a),...r,children:n})}function S({className:n,...a}){const r=d(e=>e.drawer.header.base);return s.jsx(f.Header,{className:b(r,n),...a})}function k({className:n,...a}){const r=d(e=>e.drawer.body.base);return s.jsx(f.Body,{className:b("flex-1 overflow-auto",r,n),...a})}function H({className:n,...a}){const r=d(e=>e.drawer.footer.base);return s.jsx(f.Footer,{className:b(r,n),...a})}x.Menu=N;x.Header=S;x.Body=k;x.Footer=H;exports.DrawerContext=p;exports.default=x;
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"),y=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:b="",children:v,...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,b),...h,children:[s.jsx("button",{type:"button",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:v})]})})})}function k({children:n,className:a="",...r}){const e=x(t=>t.drawer.menu),{anchor:o,duration:u,transitionState:l,preventClose:b}=i.useContext(p),v=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(y,{as:"div",style:{transitionDuration:`${u}ms`},className:C.twMerge("relative flex flex-col transition-[translate,width] rounded-none",b&&"transition-transform",e==null?void 0:e.base,h[l],v,a),...r,children:n})}function S({className:n,...a}){const r=x(e=>e.drawer.header.base);return s.jsx(y.Header,{className:w(r,n),...a})}function z({className:n,...a}){const r=x(e=>e.drawer.body.base);return s.jsx(y.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(y.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,105 +1,108 @@
1
1
  "use client";
2
- import { jsx as s, jsxs as N } from "react/jsx-runtime";
3
- import d from "../../hooks/useClasses.es.js";
4
- import { createContext as k, useRef as H, useMemo as y, useImperativeHandle as M, useContext as z } from "react";
5
- import B from "../../hooks/useKeyDown.es.js";
6
- import { twMerge as h } from "../../node_modules/tailwind-merge/dist/bundle-mjs.es.js";
7
- import v from "../../helpers/cn.es.js";
8
- import m from "../Card/index.es.js";
9
- import F from "../Portal/index.es.js";
10
- import S from "../../node_modules/react-transition-group/esm/Transition.es.js";
11
- const g = k({
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";
5
+ import { useHotkey as S } from "../../node_modules/@tanstack/react-hotkeys/dist/useHotkey.es.js";
6
+ import { twMerge as C } from "../../node_modules/tailwind-merge/dist/bundle-mjs.es.js";
7
+ import f from "../../helpers/cn.es.js";
8
+ import x from "../Card/index.es.js";
9
+ import j from "../Portal/index.es.js";
10
+ import E from "../../node_modules/react-transition-group/esm/Transition.es.js";
11
+ const D = M({
12
12
  open: !1,
13
13
  onClose: () => {
14
14
  },
15
15
  duration: 300,
16
16
  anchor: "start",
17
- transitionState: "unmounted"
17
+ transitionState: "unmounted",
18
+ preventClose: !1
18
19
  });
19
- function f({
20
+ function w({
20
21
  as: n,
21
22
  ref: a,
22
23
  open: r = !1,
23
24
  onClose: t = () => {
24
25
  },
25
26
  duration: o = 300,
26
- anchor: i = "end",
27
- className: x = "",
28
- children: w,
29
- ...p
27
+ preventClose: i = !1,
28
+ anchor: l = "end",
29
+ className: p = "",
30
+ children: y,
31
+ ...v
30
32
  }) {
31
- const e = d((l) => l.drawer), u = H(null), c = n || "div", D = {
33
+ const e = c((u) => u.drawer), d = z(null), m = n || "div", R = {
32
34
  entering: "active opacity-100 pointer-events-auto",
33
35
  entered: "active opacity-100 pointer-events-auto",
34
36
  exiting: "opacity-0 pointer-events-none",
35
37
  exited: "opacity-0 pointer-events-none",
36
38
  unmounted: ""
37
- }, R = y(() => {
38
- var b;
39
- const l = {
39
+ }, N = b(() => {
40
+ var g;
41
+ const u = {
40
42
  start: "flex-row-reverse",
41
43
  end: "flex-row",
42
44
  top: "flex-col-reverse",
43
45
  bottom: "flex-col"
44
- }, C = (b = e == null ? void 0 : e.anchor) == null ? void 0 : b[i];
45
- return [l[i], C];
46
- }, [i, e == null ? void 0 : e.anchor]);
47
- return M(a, () => u.current), B(
48
- () => {
49
- t == null || t();
50
- },
51
- { skip: !r, targetKey: "Escape" }
52
- ), /* @__PURE__ */ s(F, { children: /* @__PURE__ */ s(S, { nodeRef: u, in: r, timeout: o, unmountOnExit: !0, children: (l) => /* @__PURE__ */ N(
53
- c,
46
+ }, H = (g = e == null ? void 0 : e.anchor) == null ? void 0 : g[l];
47
+ return [u[l], H];
48
+ }, [l, e == null ? void 0 : e.anchor]), h = () => {
49
+ i || t();
50
+ };
51
+ return B(a, () => d.current), S("Escape", () => t(), { enabled: r && !i }), /* @__PURE__ */ s(j, { children: /* @__PURE__ */ s(E, { nodeRef: d, in: r, timeout: o, unmountOnExit: !0, children: (u) => /* @__PURE__ */ k(
52
+ m,
54
53
  {
55
- ref: u,
54
+ ref: d,
56
55
  style: { transitionDuration: `${o}ms` },
57
56
  "data-open": r,
58
- className: h(
57
+ className: C(
59
58
  "fixed size-full inset-0 flex z-10 bg-black/20 backdrop-blur transition-opacity [--drawer-ratio:1] rtl:[--drawer-ratio:-1]",
60
59
  e == null ? void 0 : e.base,
61
- D[l],
62
- R,
63
- x
60
+ R[u],
61
+ N,
62
+ p
64
63
  ),
65
- ...p,
64
+ ...v,
66
65
  children: [
67
66
  /* @__PURE__ */ s(
68
67
  "button",
69
68
  {
70
69
  type: "button",
71
- onClick: () => t(),
72
- className: "absolute inset-0 size-full cursor-default opacity-0"
70
+ onClick: h,
71
+ className: f(
72
+ "absolute inset-0 size-full cursor-default opacity-0",
73
+ i && "[&:active~*]:scale-95"
74
+ )
73
75
  }
74
76
  ),
75
77
  /* @__PURE__ */ s(
76
- g.Provider,
78
+ D.Provider,
77
79
  {
78
80
  value: {
79
81
  open: r,
80
- onClose: t,
81
- transitionState: l,
82
+ onClose: h,
83
+ transitionState: u,
82
84
  duration: o,
83
- anchor: i
85
+ anchor: l,
86
+ preventClose: i
84
87
  },
85
- children: w
88
+ children: y
86
89
  }
87
90
  )
88
91
  ]
89
92
  }
90
93
  ) }) });
91
94
  }
92
- function j({ children: n, className: a = "", ...r }) {
93
- const t = d((e) => e.drawer.menu), { anchor: o, duration: i, transitionState: x } = z(g), w = y(() => {
94
- var c;
95
+ function P({ children: n, className: a = "", ...r }) {
96
+ const t = c((e) => e.drawer.menu), { anchor: o, duration: i, transitionState: l, preventClose: p } = F(D), y = b(() => {
97
+ var m;
95
98
  const e = {
96
99
  start: "w-[31.875rem] h-full max-w-[92.5%] rounded-e me-auto",
97
100
  end: "w-[31.875rem] h-full max-w-[92.5%] rounded-s ms-auto",
98
- top: "w-full h-[31.875rem] max-h-[92.5%] rounded-b mb-auto",
99
- bottom: "w-full h-[31.875rem] max-h-[92.5%] rounded-t mt-auto"
100
- }, u = (c = t == null ? void 0 : t.anchor) == null ? void 0 : c[o];
101
- return [e[o], u];
102
- }, [o, t == null ? void 0 : t.anchor]), p = y(() => ({
101
+ top: "w-full max-h-[92.5%] rounded-b mb-auto",
102
+ bottom: "w-full max-h-[92.5%] rounded-t mt-auto"
103
+ }, d = (m = t == null ? void 0 : t.anchor) == null ? void 0 : m[o];
104
+ return [e[o], d];
105
+ }, [o, t == null ? void 0 : t.anchor]), v = b(() => ({
103
106
  start: {
104
107
  entering: "translate-x-0",
105
108
  entered: "translate-x-0",
@@ -130,15 +133,16 @@ function j({ children: n, className: a = "", ...r }) {
130
133
  }
131
134
  })[o], [o]);
132
135
  return /* @__PURE__ */ s(
133
- m,
136
+ x,
134
137
  {
135
138
  as: "div",
136
139
  style: { transitionDuration: `${i}ms` },
137
- className: h(
140
+ className: C(
138
141
  "relative flex flex-col transition-[translate,width] rounded-none",
142
+ p && "transition-transform",
139
143
  t == null ? void 0 : t.base,
140
- p[x],
141
- w,
144
+ v[l],
145
+ y,
142
146
  a
143
147
  ),
144
148
  ...r,
@@ -146,29 +150,29 @@ function j({ children: n, className: a = "", ...r }) {
146
150
  }
147
151
  );
148
152
  }
149
- function E({ className: n, ...a }) {
150
- const r = d((t) => t.drawer.header.base);
151
- return /* @__PURE__ */ s(m.Header, { className: v(r, n), ...a });
153
+ function $({ className: n, ...a }) {
154
+ const r = c((t) => t.drawer.header.base);
155
+ return /* @__PURE__ */ s(x.Header, { className: f(r, n), ...a });
152
156
  }
153
- function K({ className: n, ...a }) {
154
- const r = d((t) => t.drawer.body.base);
157
+ function I({ className: n, ...a }) {
158
+ const r = c((t) => t.drawer.body.base);
155
159
  return /* @__PURE__ */ s(
156
- m.Body,
160
+ x.Body,
157
161
  {
158
- className: v("flex-1 overflow-auto", r, n),
162
+ className: f("flex-1 overflow-auto", r, n),
159
163
  ...a
160
164
  }
161
165
  );
162
166
  }
163
- function P({ className: n, ...a }) {
164
- const r = d((t) => t.drawer.footer.base);
165
- return /* @__PURE__ */ s(m.Footer, { className: v(r, n), ...a });
167
+ function O({ className: n, ...a }) {
168
+ const r = c((t) => t.drawer.footer.base);
169
+ return /* @__PURE__ */ s(x.Footer, { className: f(r, n), ...a });
166
170
  }
167
- f.Menu = j;
168
- f.Header = E;
169
- f.Body = K;
170
- f.Footer = P;
171
+ w.Menu = P;
172
+ w.Header = $;
173
+ w.Body = I;
174
+ w.Footer = O;
171
175
  export {
172
- g as DrawerContext,
173
- f as default
176
+ D as DrawerContext,
177
+ w as default
174
178
  };