@clasing/ui 0.1.127 → 0.1.129

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 (132) hide show
  1. package/dist/{badge-Czof3oqL.cjs → badge-Bm8BEABb.cjs} +1 -1
  2. package/dist/{badge-BnerQ2lF.js → badge-CJxUpkWv.js} +2 -2
  3. package/dist/{button-DddHyyHa.js → button-DcSOP6sn.js} +157 -151
  4. package/dist/{button-Cegl49Yi.cjs → button-Ha5yZjbm.cjs} +1 -1
  5. package/dist/{calendar-DL8gqdRp.cjs → calendar-BcTJ_AFV.cjs} +1 -1
  6. package/dist/{calendar-BAQkzm4v.js → calendar-DA08oJl2.js} +2 -2
  7. package/dist/{card-BfBXE5Kq.js → card-9-UcGdV0.js} +1 -1
  8. package/dist/{card-BCgtou88.cjs → card-B6Rvxvhq.cjs} +1 -1
  9. package/dist/{chip-ZZHZ8i1Q.js → chip-D12iiF8O.js} +2 -2
  10. package/dist/{chip-A32aAc-8.cjs → chip-DXIbNG3r.cjs} +1 -1
  11. package/dist/command-8g6GQBZ9.cjs +1 -0
  12. package/dist/command-pED95x7-.js +176 -0
  13. package/dist/components/accordion.cjs.js +1 -1
  14. package/dist/components/accordion.es.js +2 -2
  15. package/dist/components/alert-dialog.cjs.js +1 -1
  16. package/dist/components/alert-dialog.es.js +2 -2
  17. package/dist/components/alert.cjs.js +1 -1
  18. package/dist/components/alert.es.js +2 -2
  19. package/dist/components/avatar.cjs.js +1 -1
  20. package/dist/components/avatar.es.js +1 -1
  21. package/dist/components/badge.cjs.js +1 -1
  22. package/dist/components/badge.es.js +1 -1
  23. package/dist/components/blocks/date-picker.cjs.js +1 -1
  24. package/dist/components/blocks/date-picker.es.js +5 -5
  25. package/dist/components/blocks/date-range-picker.cjs.js +1 -1
  26. package/dist/components/blocks/date-range-picker.es.js +4 -4
  27. package/dist/components/blocks/interactive-card.cjs.js +1 -1
  28. package/dist/components/blocks/interactive-card.es.js +5 -5
  29. package/dist/components/blocks/selectable-chips.cjs.js +1 -1
  30. package/dist/components/blocks/selectable-chips.es.js +3 -3
  31. package/dist/components/breadcrumb.cjs.js +1 -1
  32. package/dist/components/breadcrumb.es.js +2 -2
  33. package/dist/components/button.cjs.js +1 -1
  34. package/dist/components/button.d.ts +4 -4
  35. package/dist/components/button.es.js +1 -1
  36. package/dist/components/calendar.cjs.js +1 -1
  37. package/dist/components/calendar.es.js +1 -1
  38. package/dist/components/card.cjs.js +1 -1
  39. package/dist/components/card.es.js +1 -1
  40. package/dist/components/chart.cjs.js +1 -1
  41. package/dist/components/chart.es.js +1 -1
  42. package/dist/components/checkbox.cjs.js +1 -1
  43. package/dist/components/checkbox.es.js +2 -2
  44. package/dist/components/chip.cjs.js +1 -1
  45. package/dist/components/chip.d.ts +1 -1
  46. package/dist/components/chip.es.js +1 -1
  47. package/dist/components/collapsible.cjs.js +1 -1
  48. package/dist/components/collapsible.es.js +1 -1
  49. package/dist/components/command.cjs.js +1 -1
  50. package/dist/components/command.es.js +1 -1
  51. package/dist/components/context-menu.cjs.js +1 -1
  52. package/dist/components/context-menu.es.js +2 -2
  53. package/dist/components/dialog.cjs.js +1 -1
  54. package/dist/components/dialog.es.js +1 -1
  55. package/dist/components/divider.cjs.js +1 -1
  56. package/dist/components/divider.es.js +1 -1
  57. package/dist/components/drawer.cjs.js +1 -3
  58. package/dist/components/drawer.es.js +58 -1091
  59. package/dist/components/dropdown-menu.cjs.js +1 -1
  60. package/dist/components/dropdown-menu.es.js +2 -2
  61. package/dist/components/hover-card.cjs.js +1 -1
  62. package/dist/components/hover-card.es.js +1 -1
  63. package/dist/components/icon-component.cjs.js +1 -1
  64. package/dist/components/icon-component.d.ts +2 -2
  65. package/dist/components/icon-component.es.js +1 -1
  66. package/dist/components/input-otp.cjs.js +1 -20
  67. package/dist/components/input-otp.es.js +37 -225
  68. package/dist/components/input.cjs.js +1 -1
  69. package/dist/components/input.d.ts +5 -8
  70. package/dist/components/input.es.js +1 -1
  71. package/dist/components/label.cjs.js +1 -1
  72. package/dist/components/label.es.js +1 -1
  73. package/dist/components/menubar.cjs.js +1 -1
  74. package/dist/components/menubar.es.js +2 -2
  75. package/dist/components/multi-select.cjs.js +1 -1
  76. package/dist/components/multi-select.es.js +5 -5
  77. package/dist/components/navigation-menu.cjs.js +1 -1
  78. package/dist/components/navigation-menu.es.js +2 -2
  79. package/dist/components/phone-input.cjs.js +1 -1
  80. package/dist/components/phone-input.es.js +8 -8
  81. package/dist/components/popover.cjs.js +1 -1
  82. package/dist/components/popover.es.js +1 -1
  83. package/dist/components/progress.cjs.js +1 -1
  84. package/dist/components/progress.es.js +1 -1
  85. package/dist/components/resizable.cjs.js +1 -1
  86. package/dist/components/resizable.es.js +24 -1527
  87. package/dist/components/scroll-area.cjs.js +1 -1
  88. package/dist/components/scroll-area.es.js +1 -1
  89. package/dist/components/select.cjs.js +1 -1
  90. package/dist/components/select.es.js +2 -2
  91. package/dist/components/sheet.cjs.js +1 -1
  92. package/dist/components/sheet.es.js +2 -2
  93. package/dist/components/skeleton.cjs.js +1 -1
  94. package/dist/components/skeleton.es.js +1 -1
  95. package/dist/components/slider.cjs.js +1 -1
  96. package/dist/components/slider.es.js +1 -1
  97. package/dist/components/sonner.cjs.js +1 -1
  98. package/dist/components/sonner.es.js +1 -1
  99. package/dist/components/switch.cjs.js +1 -1
  100. package/dist/components/switch.es.js +1 -1
  101. package/dist/components/table.cjs.js +1 -1
  102. package/dist/components/table.es.js +1 -1
  103. package/dist/components/toggle-group.cjs.js +1 -1
  104. package/dist/components/toggle-group.es.js +2 -2
  105. package/dist/components/toggle.cjs.js +1 -1
  106. package/dist/components/toggle.es.js +1 -1
  107. package/dist/components/tooltip.cjs.js +1 -1
  108. package/dist/components/tooltip.es.js +1 -1
  109. package/dist/{dialog-DZpF7OXg.js → dialog-DIua9sAl.js} +2 -2
  110. package/dist/{dialog-BKm2PZl2.cjs → dialog-aUOPw4Iw.cjs} +1 -1
  111. package/dist/{icon-component-BZ-4FDV6.js → icon-component-CxQsODCa.js} +12 -11
  112. package/dist/icon-component-DuSAouum.cjs +1 -0
  113. package/dist/{input-DwPDvbRE.js → input-CUSAqhCy.js} +56 -56
  114. package/dist/input-DHz92pYC.cjs +1 -0
  115. package/dist/{jsx-runtime-DUiatUiq.cjs → jsx-runtime-CEDi24JD.cjs} +3 -3
  116. package/dist/{jsx-runtime-C5mzlN2N.js → jsx-runtime-DywqP_6a.js} +13 -13
  117. package/dist/{label-CbzkBbPT.cjs → label-DzIkWgU7.cjs} +1 -1
  118. package/dist/{label-BpDUqtrC.js → label-_kG7WBoJ.js} +1 -1
  119. package/dist/{popover-BoDRCUh2.js → popover-CHAUhJda.js} +1 -1
  120. package/dist/{popover-B8wp2cHF.cjs → popover-DuG87bap.cjs} +1 -1
  121. package/dist/{scroll-area-Dr-7opp_.cjs → scroll-area-DWxaYCKb.cjs} +1 -1
  122. package/dist/{scroll-area-CNsThIs_.js → scroll-area-DwBiu3Jn.js} +1 -1
  123. package/dist/{toggle-Dgd7L2Mq.cjs → toggle-8gRQB7cM.cjs} +1 -1
  124. package/dist/{toggle-DjbiWYXD.js → toggle-nsKZaKsW.js} +1 -1
  125. package/dist/{tooltip-Btr9ROSo.js → tooltip-BnIdKYZi.js} +1 -1
  126. package/dist/{tooltip-W9iE1O--.cjs → tooltip-CqOXzvfb.cjs} +1 -1
  127. package/dist/utils/index.d.ts +0 -3
  128. package/package.json +27 -28
  129. package/dist/command-BGCSJ9vX.js +0 -506
  130. package/dist/command-D9M8dk1M.cjs +0 -1
  131. package/dist/icon-component-LY_vGYHZ.cjs +0 -1
  132. package/dist/input-DFPJ_mtM.cjs +0 -1
@@ -1,1087 +1,54 @@
1
- import { j as F } from "../jsx-runtime-C5mzlN2N.js";
2
- import * as Q from "@radix-ui/react-dialog";
3
- import * as ge from "react";
4
- import r, { useMemo as ve, useLayoutEffect as ye, useEffect as be } from "react";
5
- import { c as it } from "../index-CRiPKpXj.js";
6
- function Se(t) {
7
- if (typeof document > "u") return;
8
- let n = document.head || document.getElementsByTagName("head")[0], e = document.createElement("style");
9
- e.type = "text/css", n.appendChild(e), e.styleSheet ? e.styleSheet.cssText = t : e.appendChild(document.createTextNode(t));
10
- }
11
- const Yt = r.createContext({
12
- drawerRef: {
13
- current: null
14
- },
15
- overlayRef: {
16
- current: null
17
- },
18
- onPress: () => {
19
- },
20
- onRelease: () => {
21
- },
22
- onDrag: () => {
23
- },
24
- onNestedDrag: () => {
25
- },
26
- onNestedOpenChange: () => {
27
- },
28
- onNestedRelease: () => {
29
- },
30
- openProp: void 0,
31
- dismissible: !1,
32
- isOpen: !1,
33
- isDragging: !1,
34
- keyboardIsOpen: {
35
- current: !1
36
- },
37
- snapPointsOffset: null,
38
- snapPoints: null,
39
- handleOnly: !1,
40
- modal: !1,
41
- shouldFade: !1,
42
- activeSnapPoint: null,
43
- onOpenChange: () => {
44
- },
45
- setActiveSnapPoint: () => {
46
- },
47
- closeDrawer: () => {
48
- },
49
- direction: "bottom",
50
- shouldAnimate: {
51
- current: !0
52
- },
53
- shouldScaleBackground: !1,
54
- setBackgroundColorOnScale: !0,
55
- noBodyStyles: !1,
56
- container: null,
57
- autoFocus: !1
58
- }), wt = () => {
59
- const t = r.useContext(Yt);
60
- if (!t)
61
- throw new Error("useDrawerContext must be used within a Drawer.Root");
62
- return t;
63
- };
64
- Se(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
65
- [data-state=closed]
66
- ){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);
67
- function Te() {
68
- const t = navigator.userAgent;
69
- return typeof window < "u" && (/Firefox/.test(t) && /Mobile/.test(t) || // Android Firefox
70
- /FxiOS/.test(t));
71
- }
72
- function xe() {
73
- return Mt(/^Mac/);
74
- }
75
- function De() {
76
- return Mt(/^iPhone/);
77
- }
78
- function Ft() {
79
- return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
80
- }
81
- function Re() {
82
- return Mt(/^iPad/) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
83
- xe() && navigator.maxTouchPoints > 1;
84
- }
85
- function qt() {
86
- return De() || Re();
87
- }
88
- function Mt(t) {
89
- return typeof window < "u" && window.navigator != null ? t.test(window.navigator.platform) : void 0;
90
- }
91
- const Ee = 24, Oe = typeof window < "u" ? ye : be;
92
- function Wt(...t) {
93
- return (...n) => {
94
- for (let e of t)
95
- typeof e == "function" && e(...n);
96
- };
97
- }
98
- const Rt = typeof document < "u" && window.visualViewport;
99
- function zt(t) {
100
- let n = window.getComputedStyle(t);
101
- return /(auto|scroll)/.test(n.overflow + n.overflowX + n.overflowY);
102
- }
103
- function Xt(t) {
104
- for (zt(t) && (t = t.parentElement); t && !zt(t); )
105
- t = t.parentElement;
106
- return t || document.scrollingElement || document.documentElement;
107
- }
108
- const Ce = /* @__PURE__ */ new Set([
109
- "checkbox",
110
- "radio",
111
- "range",
112
- "color",
113
- "file",
114
- "image",
115
- "button",
116
- "submit",
117
- "reset"
118
- ]);
119
- let vt = 0, Et;
120
- function $e(t = {}) {
121
- let { isDisabled: n } = t;
122
- Oe(() => {
123
- if (!n)
124
- return vt++, vt === 1 && qt() && (Et = Ae()), () => {
125
- vt--, vt === 0 && Et?.();
126
- };
127
- }, [
128
- n
129
- ]);
130
- }
131
- function Ae() {
132
- let t, n = 0, e = (f) => {
133
- t = Xt(f.target), !(t === document.documentElement && t === document.body) && (n = f.changedTouches[0].pageY);
134
- }, o = (f) => {
135
- if (!t || t === document.documentElement || t === document.body) {
136
- f.preventDefault();
137
- return;
138
- }
139
- let m = f.changedTouches[0].pageY, B = t.scrollTop, k = t.scrollHeight - t.clientHeight;
140
- k !== 0 && ((B <= 0 && m > n || B >= k && m < n) && f.preventDefault(), n = m);
141
- }, i = (f) => {
142
- let m = f.target;
143
- $t(m) && m !== document.activeElement && (f.preventDefault(), m.style.transform = "translateY(-2000px)", m.focus(), requestAnimationFrame(() => {
144
- m.style.transform = "";
145
- }));
146
- }, a = (f) => {
147
- let m = f.target;
148
- $t(m) && (m.style.transform = "translateY(-2000px)", requestAnimationFrame(() => {
149
- m.style.transform = "", Rt && (Rt.height < window.innerHeight ? requestAnimationFrame(() => {
150
- Vt(m);
151
- }) : Rt.addEventListener("resize", () => Vt(m), {
152
- once: !0
153
- }));
154
- }));
155
- }, v = () => {
156
- window.scrollTo(0, 0);
157
- }, p = window.pageXOffset, T = window.pageYOffset, D = Wt(Me(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`));
158
- window.scrollTo(0, 0);
159
- let h = Wt(ft(document, "touchstart", e, {
160
- passive: !1,
161
- capture: !0
162
- }), ft(document, "touchmove", o, {
163
- passive: !1,
164
- capture: !0
165
- }), ft(document, "touchend", i, {
166
- passive: !1,
167
- capture: !0
168
- }), ft(document, "focus", a, !0), ft(window, "scroll", v));
169
- return () => {
170
- D(), h(), window.scrollTo(p, T);
171
- };
172
- }
173
- function Me(t, n, e) {
174
- let o = t.style[n];
175
- return t.style[n] = e, () => {
176
- t.style[n] = o;
177
- };
178
- }
179
- function ft(t, n, e, o) {
180
- return t.addEventListener(n, e, o), () => {
181
- t.removeEventListener(n, e, o);
182
- };
183
- }
184
- function Vt(t) {
185
- let n = document.scrollingElement || document.documentElement;
186
- for (; t && t !== n; ) {
187
- let e = Xt(t);
188
- if (e !== document.documentElement && e !== document.body && e !== t) {
189
- let o = e.getBoundingClientRect().top, i = t.getBoundingClientRect().top, a = t.getBoundingClientRect().bottom;
190
- const v = e.getBoundingClientRect().bottom + Ee;
191
- a > v && (e.scrollTop += i - o);
192
- }
193
- t = e.parentElement;
194
- }
195
- }
196
- function $t(t) {
197
- return t instanceof HTMLInputElement && !Ce.has(t.type) || t instanceof HTMLTextAreaElement || t instanceof HTMLElement && t.isContentEditable;
198
- }
199
- function Pe(t, n) {
200
- typeof t == "function" ? t(n) : t != null && (t.current = n);
201
- }
202
- function Ie(...t) {
203
- return (n) => t.forEach((e) => Pe(e, n));
204
- }
205
- function Kt(...t) {
206
- return ge.useCallback(Ie(...t), t);
207
- }
208
- const Gt = /* @__PURE__ */ new WeakMap();
209
- function $(t, n, e = !1) {
210
- if (!t || !(t instanceof HTMLElement)) return;
211
- let o = {};
212
- Object.entries(n).forEach(([i, a]) => {
213
- if (i.startsWith("--")) {
214
- t.style.setProperty(i, a);
215
- return;
216
- }
217
- o[i] = t.style[i], t.style[i] = a;
218
- }), !e && Gt.set(t, o);
219
- }
220
- function Ne(t, n) {
221
- if (!t || !(t instanceof HTMLElement)) return;
222
- let e = Gt.get(t);
223
- e && (t.style[n] = e[n]);
224
- }
225
- const C = (t) => {
226
- switch (t) {
227
- case "top":
228
- case "bottom":
229
- return !0;
230
- case "left":
231
- case "right":
232
- return !1;
233
- default:
234
- return t;
235
- }
236
- };
237
- function yt(t, n) {
238
- if (!t)
239
- return null;
240
- const e = window.getComputedStyle(t), o = (
241
- // @ts-ignore
242
- e.transform || e.webkitTransform || e.mozTransform
243
- );
244
- let i = o.match(/^matrix3d\((.+)\)$/);
245
- return i ? parseFloat(i[1].split(", ")[C(n) ? 13 : 12]) : (i = o.match(/^matrix\((.+)\)$/), i ? parseFloat(i[1].split(", ")[C(n) ? 5 : 4]) : null);
246
- }
247
- function _e(t) {
248
- return 8 * (Math.log(t + 1) - 2);
249
- }
250
- function Ot(t, n) {
251
- if (!t) return () => {
252
- };
253
- const e = t.style.cssText;
254
- return Object.assign(t.style, n), () => {
255
- t.style.cssText = e;
256
- };
257
- }
258
- function He(...t) {
259
- return (...n) => {
260
- for (const e of t)
261
- typeof e == "function" && e(...n);
262
- };
263
- }
264
- const E = {
265
- DURATION: 0.5,
266
- EASE: [
267
- 0.32,
268
- 0.72,
269
- 0,
270
- 1
271
- ]
272
- }, Jt = 0.4, ke = 0.25, Le = 100, Qt = 8, nt = 16, At = 26, Ct = "vaul-dragging";
273
- function Zt(t) {
274
- const n = r.useRef(t);
275
- return r.useEffect(() => {
276
- n.current = t;
277
- }), r.useMemo(() => (...e) => n.current == null ? void 0 : n.current.call(n, ...e), []);
278
- }
279
- function Be({ defaultProp: t, onChange: n }) {
280
- const e = r.useState(t), [o] = e, i = r.useRef(o), a = Zt(n);
281
- return r.useEffect(() => {
282
- i.current !== o && (a(o), i.current = o);
283
- }, [
284
- o,
285
- i,
286
- a
287
- ]), e;
288
- }
289
- function te({ prop: t, defaultProp: n, onChange: e = () => {
290
- } }) {
291
- const [o, i] = Be({
292
- defaultProp: n,
293
- onChange: e
294
- }), a = t !== void 0, v = a ? t : o, p = Zt(e), T = r.useCallback((D) => {
295
- if (a) {
296
- const f = typeof D == "function" ? D(t) : D;
297
- f !== t && p(f);
298
- } else
299
- i(D);
300
- }, [
301
- a,
302
- t,
303
- i,
304
- p
305
- ]);
306
- return [
307
- v,
308
- T
309
- ];
310
- }
311
- function Ue({ activeSnapPointProp: t, setActiveSnapPointProp: n, snapPoints: e, drawerRef: o, overlayRef: i, fadeFromIndex: a, onSnapPointChange: v, direction: p = "bottom", container: T, snapToSequentialPoint: D }) {
312
- const [h, f] = te({
313
- prop: t,
314
- defaultProp: e?.[0],
315
- onChange: n
316
- }), [m, B] = r.useState(typeof window < "u" ? {
317
- innerWidth: window.innerWidth,
318
- innerHeight: window.innerHeight
319
- } : void 0);
320
- r.useEffect(() => {
321
- function u() {
322
- B({
323
- innerWidth: window.innerWidth,
324
- innerHeight: window.innerHeight
325
- });
326
- }
327
- return window.addEventListener("resize", u), () => window.removeEventListener("resize", u);
328
- }, []);
329
- const k = r.useMemo(() => h === e?.[e.length - 1] || null, [
330
- e,
331
- h
332
- ]), R = r.useMemo(() => {
333
- var u;
334
- return (u = e?.findIndex((b) => b === h)) != null ? u : null;
335
- }, [
336
- e,
337
- h
338
- ]), U = e && e.length > 0 && (a || a === 0) && !Number.isNaN(a) && e[a] === h || !e, w = r.useMemo(() => {
339
- const u = T ? {
340
- width: T.getBoundingClientRect().width,
341
- height: T.getBoundingClientRect().height
342
- } : typeof window < "u" ? {
343
- width: window.innerWidth,
344
- height: window.innerHeight
345
- } : {
346
- width: 0,
347
- height: 0
348
- };
349
- var b;
350
- return (b = e?.map((y) => {
351
- const N = typeof y == "string";
352
- let P = 0;
353
- if (N && (P = parseInt(y, 10)), C(p)) {
354
- const s = N ? P : m ? y * u.height : 0;
355
- return m ? p === "bottom" ? u.height - s : -u.height + s : s;
356
- }
357
- const W = N ? P : m ? y * u.width : 0;
358
- return m ? p === "right" ? u.width - W : -u.width + W : W;
359
- })) != null ? b : [];
360
- }, [
361
- e,
362
- m,
363
- T
364
- ]), M = r.useMemo(() => R !== null ? w?.[R] : null, [
365
- w,
366
- R
367
- ]), A = r.useCallback((u) => {
368
- var b;
369
- const y = (b = w?.findIndex((N) => N === u)) != null ? b : null;
370
- v(y), $(o.current, {
371
- transition: `transform ${E.DURATION}s cubic-bezier(${E.EASE.join(",")})`,
372
- transform: C(p) ? `translate3d(0, ${u}px, 0)` : `translate3d(${u}px, 0, 0)`
373
- }), w && y !== w.length - 1 && a !== void 0 && y !== a && y < a ? $(i.current, {
374
- transition: `opacity ${E.DURATION}s cubic-bezier(${E.EASE.join(",")})`,
375
- opacity: "0"
376
- }) : $(i.current, {
377
- transition: `opacity ${E.DURATION}s cubic-bezier(${E.EASE.join(",")})`,
378
- opacity: "1"
379
- }), f(e?.[Math.max(y, 0)]);
380
- }, [
381
- o.current,
382
- e,
383
- w,
384
- a,
385
- i,
386
- f
387
- ]);
388
- r.useEffect(() => {
389
- if (h || t) {
390
- var u;
391
- const b = (u = e?.findIndex((y) => y === t || y === h)) != null ? u : -1;
392
- w && b !== -1 && typeof w[b] == "number" && A(w[b]);
393
- }
394
- }, [
395
- h,
396
- t,
397
- e,
398
- w,
399
- A
400
- ]);
401
- function c({ draggedDistance: u, closeDrawer: b, velocity: y, dismissible: N }) {
402
- if (a === void 0) return;
403
- const P = p === "bottom" || p === "right" ? (M ?? 0) - u : (M ?? 0) + u, W = R === a - 1, s = R === 0, j = u > 0;
404
- if (W && $(i.current, {
405
- transition: `opacity ${E.DURATION}s cubic-bezier(${E.EASE.join(",")})`
406
- }), !D && y > 2 && !j) {
407
- N ? b() : A(w[0]);
408
- return;
409
- }
410
- if (!D && y > 2 && j && w && e) {
411
- A(w[e.length - 1]);
412
- return;
413
- }
414
- const _ = w?.reduce((I, X) => typeof I != "number" || typeof X != "number" ? I : Math.abs(X - P) < Math.abs(I - P) ? X : I), z = C(p) ? window.innerHeight : window.innerWidth;
415
- if (y > Jt && Math.abs(u) < z * 0.4) {
416
- const I = j ? 1 : -1;
417
- if (I > 0 && k && e) {
418
- A(w[e.length - 1]);
419
- return;
420
- }
421
- if (s && I < 0 && N && b(), R === null) return;
422
- A(w[R + I]);
423
- return;
424
- }
425
- A(_);
426
- }
427
- function Y({ draggedDistance: u }) {
428
- if (M === null) return;
429
- const b = p === "bottom" || p === "right" ? M - u : M + u;
430
- (p === "bottom" || p === "right") && b < w[w.length - 1] || (p === "top" || p === "left") && b > w[w.length - 1] || $(o.current, {
431
- transform: C(p) ? `translate3d(0, ${b}px, 0)` : `translate3d(${b}px, 0, 0)`
432
- });
433
- }
434
- function tt(u, b) {
435
- if (!e || typeof R != "number" || !w || a === void 0) return null;
436
- const y = R === a - 1;
437
- if (R >= a && b)
438
- return 0;
439
- if (y && !b) return 1;
440
- if (!U && !y) return null;
441
- const P = y ? R + 1 : R - 1, W = y ? w[P] - w[P - 1] : w[P + 1] - w[P], s = u / Math.abs(W);
442
- return y ? 1 - s : s;
443
- }
444
- return {
445
- isLastSnapPoint: k,
446
- activeSnapPoint: h,
447
- shouldFade: U,
448
- getPercentageDragged: tt,
449
- setActiveSnapPoint: f,
450
- activeSnapPointIndex: R,
451
- onRelease: c,
452
- onDrag: Y,
453
- snapPointsOffset: w
454
- };
455
- }
456
- const je = () => () => {
457
- };
458
- function Fe() {
459
- const { direction: t, isOpen: n, shouldScaleBackground: e, setBackgroundColorOnScale: o, noBodyStyles: i } = wt(), a = r.useRef(null), v = ve(() => document.body.style.backgroundColor, []);
460
- function p() {
461
- return (window.innerWidth - At) / window.innerWidth;
462
- }
463
- r.useEffect(() => {
464
- if (n && e) {
465
- a.current && clearTimeout(a.current);
466
- const T = document.querySelector("[data-vaul-drawer-wrapper]") || document.querySelector("[vaul-drawer-wrapper]");
467
- if (!T) return;
468
- He(o && !i ? Ot(document.body, {
469
- background: "black"
470
- }) : je, Ot(T, {
471
- transformOrigin: C(t) ? "top" : "left",
472
- transitionProperty: "transform, border-radius",
473
- transitionDuration: `${E.DURATION}s`,
474
- transitionTimingFunction: `cubic-bezier(${E.EASE.join(",")})`
475
- }));
476
- const D = Ot(T, {
477
- borderRadius: `${Qt}px`,
478
- overflow: "hidden",
479
- ...C(t) ? {
480
- transform: `scale(${p()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`
481
- } : {
482
- transform: `scale(${p()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`
483
- }
484
- });
485
- return () => {
486
- D(), a.current = window.setTimeout(() => {
487
- v ? document.body.style.background = v : document.body.style.removeProperty("background");
488
- }, E.DURATION * 1e3);
489
- };
490
- }
491
- }, [
492
- n,
493
- e,
494
- v
495
- ]);
496
- }
497
- let mt = null;
498
- function We({ isOpen: t, modal: n, nested: e, hasBeenOpened: o, preventScrollRestoration: i, noBodyStyles: a }) {
499
- const [v, p] = r.useState(() => typeof window < "u" ? window.location.href : ""), T = r.useRef(0), D = r.useCallback(() => {
500
- if (Ft() && mt === null && t && !a) {
501
- mt = {
502
- position: document.body.style.position,
503
- top: document.body.style.top,
504
- left: document.body.style.left,
505
- height: document.body.style.height,
506
- right: "unset"
507
- };
508
- const { scrollX: f, innerHeight: m } = window;
509
- document.body.style.setProperty("position", "fixed", "important"), Object.assign(document.body.style, {
510
- top: `${-T.current}px`,
511
- left: `${-f}px`,
512
- right: "0px",
513
- height: "auto"
514
- }), window.setTimeout(() => window.requestAnimationFrame(() => {
515
- const B = m - window.innerHeight;
516
- B && T.current >= m && (document.body.style.top = `${-(T.current + B)}px`);
517
- }), 300);
518
- }
519
- }, [
520
- t
521
- ]), h = r.useCallback(() => {
522
- if (Ft() && mt !== null && !a) {
523
- const f = -parseInt(document.body.style.top, 10), m = -parseInt(document.body.style.left, 10);
524
- Object.assign(document.body.style, mt), window.requestAnimationFrame(() => {
525
- if (i && v !== window.location.href) {
526
- p(window.location.href);
527
- return;
528
- }
529
- window.scrollTo(m, f);
530
- }), mt = null;
531
- }
532
- }, [
533
- v
534
- ]);
535
- return r.useEffect(() => {
536
- function f() {
537
- T.current = window.scrollY;
538
- }
539
- return f(), window.addEventListener("scroll", f), () => {
540
- window.removeEventListener("scroll", f);
541
- };
542
- }, []), r.useEffect(() => {
543
- if (n)
544
- return () => {
545
- typeof document > "u" || document.querySelector("[data-vaul-drawer]") || h();
546
- };
547
- }, [
548
- n,
549
- h
550
- ]), r.useEffect(() => {
551
- e || !o || (t ? (!window.matchMedia("(display-mode: standalone)").matches && D(), n || window.setTimeout(() => {
552
- h();
553
- }, 500)) : h());
554
- }, [
555
- t,
556
- o,
557
- v,
558
- n,
559
- e,
560
- D,
561
- h
562
- ]), {
563
- restorePositionSetting: h
564
- };
565
- }
566
- function ze({ open: t, onOpenChange: n, children: e, onDrag: o, onRelease: i, snapPoints: a, shouldScaleBackground: v = !1, setBackgroundColorOnScale: p = !0, closeThreshold: T = ke, scrollLockTimeout: D = Le, dismissible: h = !0, handleOnly: f = !1, fadeFromIndex: m = a && a.length - 1, activeSnapPoint: B, setActiveSnapPoint: k, fixed: R, modal: U = !0, onClose: w, nested: M, noBodyStyles: A = !1, direction: c = "bottom", defaultOpen: Y = !1, disablePreventScroll: tt = !0, snapToSequentialPoint: u = !1, preventScrollRestoration: b = !1, repositionInputs: y = !0, onAnimationEnd: N, container: P, autoFocus: W = !1 }) {
567
- var s, j;
568
- const [_ = !1, z] = te({
569
- defaultProp: Y,
570
- prop: t,
571
- onChange: (l) => {
572
- n?.(l), !l && !M && ue(), setTimeout(() => {
573
- N?.(l);
574
- }, E.DURATION * 1e3), l && !U && typeof window < "u" && window.requestAnimationFrame(() => {
575
- document.body.style.pointerEvents = "auto";
576
- }), l || (document.body.style.pointerEvents = "auto");
577
- }
578
- }), [I, X] = r.useState(!1), [K, lt] = r.useState(!1), [re, Pt] = r.useState(!1), rt = r.useRef(null), pt = r.useRef(null), bt = r.useRef(null), St = r.useRef(null), st = r.useRef(null), ut = r.useRef(!1), Tt = r.useRef(null), xt = r.useRef(0), at = r.useRef(!1), It = r.useRef(!Y), Nt = r.useRef(0), d = r.useRef(null), _t = r.useRef(((s = d.current) == null ? void 0 : s.getBoundingClientRect().height) || 0), Ht = r.useRef(((j = d.current) == null ? void 0 : j.getBoundingClientRect().width) || 0), Dt = r.useRef(0), ae = r.useCallback((l) => {
579
- a && l === ct.length - 1 && (pt.current = /* @__PURE__ */ new Date());
580
- }, []), { activeSnapPoint: oe, activeSnapPointIndex: ot, setActiveSnapPoint: kt, onRelease: ie, snapPointsOffset: ct, onDrag: le, shouldFade: Lt, getPercentageDragged: se } = Ue({
581
- snapPoints: a,
582
- activeSnapPointProp: B,
583
- setActiveSnapPointProp: k,
584
- drawerRef: d,
585
- fadeFromIndex: m,
586
- overlayRef: rt,
587
- onSnapPointChange: ae,
588
- direction: c,
589
- container: P,
590
- snapToSequentialPoint: u
591
- });
592
- $e({
593
- isDisabled: !_ || K || !U || re || !I || !y || !tt
594
- });
595
- const { restorePositionSetting: ue } = We({
596
- isOpen: _,
597
- modal: U,
598
- nested: M ?? !1,
599
- hasBeenOpened: I,
600
- preventScrollRestoration: b,
601
- noBodyStyles: A
602
- });
603
- function ht() {
604
- return (window.innerWidth - At) / window.innerWidth;
605
- }
606
- function ce(l) {
607
- var S, x;
608
- !h && !a || d.current && !d.current.contains(l.target) || (_t.current = ((S = d.current) == null ? void 0 : S.getBoundingClientRect().height) || 0, Ht.current = ((x = d.current) == null ? void 0 : x.getBoundingClientRect().width) || 0, lt(!0), bt.current = /* @__PURE__ */ new Date(), qt() && window.addEventListener("touchend", () => ut.current = !1, {
609
- once: !0
610
- }), l.target.setPointerCapture(l.pointerId), xt.current = C(c) ? l.pageY : l.pageX);
611
- }
612
- function Bt(l, S) {
613
- var x;
614
- let g = l;
615
- const O = (x = window.getSelection()) == null ? void 0 : x.toString(), L = d.current ? yt(d.current, c) : null, H = /* @__PURE__ */ new Date();
616
- if (g.tagName === "SELECT" || g.hasAttribute("data-vaul-no-drag") || g.closest("[data-vaul-no-drag]"))
617
- return !1;
618
- if (c === "right" || c === "left")
619
- return !0;
620
- if (pt.current && H.getTime() - pt.current.getTime() < 500)
621
- return !1;
622
- if (L !== null && (c === "bottom" ? L > 0 : L < 0))
623
- return !0;
624
- if (O && O.length > 0)
625
- return !1;
626
- if (st.current && H.getTime() - st.current.getTime() < D && L === 0 || S)
627
- return st.current = H, !1;
628
- for (; g; ) {
629
- if (g.scrollHeight > g.clientHeight) {
630
- if (g.scrollTop !== 0)
631
- return st.current = /* @__PURE__ */ new Date(), !1;
632
- if (g.getAttribute("role") === "dialog")
633
- return !0;
634
- }
635
- g = g.parentNode;
636
- }
637
- return !0;
638
- }
639
- function de(l) {
640
- if (d.current && K) {
641
- const S = c === "bottom" || c === "right" ? 1 : -1, x = (xt.current - (C(c) ? l.pageY : l.pageX)) * S, g = x > 0, O = a && !h && !g;
642
- if (O && ot === 0) return;
643
- const L = Math.abs(x), H = document.querySelector("[data-vaul-drawer-wrapper]"), G = c === "bottom" || c === "top" ? _t.current : Ht.current;
644
- let V = L / G;
645
- const et = se(L, g);
646
- if (et !== null && (V = et), O && V >= 1 || !ut.current && !Bt(l.target, g)) return;
647
- if (d.current.classList.add(Ct), ut.current = !0, $(d.current, {
648
- transition: "none"
649
- }), $(rt.current, {
650
- transition: "none"
651
- }), a && le({
652
- draggedDistance: x
653
- }), g && !a) {
654
- const q = _e(x), gt = Math.min(q * -1, 0) * S;
655
- $(d.current, {
656
- transform: C(c) ? `translate3d(0, ${gt}px, 0)` : `translate3d(${gt}px, 0, 0)`
657
- });
658
- return;
659
- }
660
- const J = 1 - V;
661
- if ((Lt || m && ot === m - 1) && (o?.(l, V), $(rt.current, {
662
- opacity: `${J}`,
663
- transition: "none"
664
- }, !0)), H && rt.current && v) {
665
- const q = Math.min(ht() + V * (1 - ht()), 1), gt = 8 - V * 8, jt = Math.max(0, 14 - V * 14);
666
- $(H, {
667
- borderRadius: `${gt}px`,
668
- transform: C(c) ? `scale(${q}) translate3d(0, ${jt}px, 0)` : `scale(${q}) translate3d(${jt}px, 0, 0)`,
669
- transition: "none"
670
- }, !0);
671
- }
672
- if (!a) {
673
- const q = L * S;
674
- $(d.current, {
675
- transform: C(c) ? `translate3d(0, ${q}px, 0)` : `translate3d(${q}px, 0, 0)`
676
- });
677
- }
678
- }
679
- }
680
- r.useEffect(() => {
681
- window.requestAnimationFrame(() => {
682
- It.current = !0;
683
- });
684
- }, []), r.useEffect(() => {
685
- var l;
686
- function S() {
687
- if (!d.current || !y) return;
688
- const x = document.activeElement;
689
- if ($t(x) || at.current) {
690
- var g;
691
- const O = ((g = window.visualViewport) == null ? void 0 : g.height) || 0, L = window.innerHeight;
692
- let H = L - O;
693
- const G = d.current.getBoundingClientRect().height || 0, V = G > L * 0.8;
694
- Dt.current || (Dt.current = G);
695
- const et = d.current.getBoundingClientRect().top;
696
- if (Math.abs(Nt.current - H) > 60 && (at.current = !at.current), a && a.length > 0 && ct && ot) {
697
- const J = ct[ot] || 0;
698
- H += J;
699
- }
700
- if (Nt.current = H, G > O || at.current) {
701
- const J = d.current.getBoundingClientRect().height;
702
- let q = J;
703
- J > O && (q = O - (V ? et : At)), R ? d.current.style.height = `${J - Math.max(H, 0)}px` : d.current.style.height = `${Math.max(q, O - et)}px`;
704
- } else Te() || (d.current.style.height = `${Dt.current}px`);
705
- a && a.length > 0 && !at.current ? d.current.style.bottom = "0px" : d.current.style.bottom = `${Math.max(H, 0)}px`;
706
- }
707
- }
708
- return (l = window.visualViewport) == null || l.addEventListener("resize", S), () => {
709
- var x;
710
- return (x = window.visualViewport) == null ? void 0 : x.removeEventListener("resize", S);
711
- };
712
- }, [
713
- ot,
714
- a,
715
- ct
716
- ]);
717
- function dt(l) {
718
- fe(), w?.(), l || z(!1), setTimeout(() => {
719
- a && kt(a[0]);
720
- }, E.DURATION * 1e3);
721
- }
722
- function Ut() {
723
- if (!d.current) return;
724
- const l = document.querySelector("[data-vaul-drawer-wrapper]"), S = yt(d.current, c);
725
- $(d.current, {
726
- transform: "translate3d(0, 0, 0)",
727
- transition: `transform ${E.DURATION}s cubic-bezier(${E.EASE.join(",")})`
728
- }), $(rt.current, {
729
- transition: `opacity ${E.DURATION}s cubic-bezier(${E.EASE.join(",")})`,
730
- opacity: "1"
731
- }), v && S && S > 0 && _ && $(l, {
732
- borderRadius: `${Qt}px`,
733
- overflow: "hidden",
734
- ...C(c) ? {
735
- transform: `scale(${ht()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,
736
- transformOrigin: "top"
737
- } : {
738
- transform: `scale(${ht()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,
739
- transformOrigin: "left"
740
- },
741
- transitionProperty: "transform, border-radius",
742
- transitionDuration: `${E.DURATION}s`,
743
- transitionTimingFunction: `cubic-bezier(${E.EASE.join(",")})`
744
- }, !0);
745
- }
746
- function fe() {
747
- !K || !d.current || (d.current.classList.remove(Ct), ut.current = !1, lt(!1), St.current = /* @__PURE__ */ new Date());
748
- }
749
- function me(l) {
750
- if (!K || !d.current) return;
751
- d.current.classList.remove(Ct), ut.current = !1, lt(!1), St.current = /* @__PURE__ */ new Date();
752
- const S = yt(d.current, c);
753
- if (!l || !Bt(l.target, !1) || !S || Number.isNaN(S) || bt.current === null) return;
754
- const x = St.current.getTime() - bt.current.getTime(), g = xt.current - (C(c) ? l.pageY : l.pageX), O = Math.abs(g) / x;
755
- if (O > 0.05 && (Pt(!0), setTimeout(() => {
756
- Pt(!1);
757
- }, 200)), a) {
758
- ie({
759
- draggedDistance: g * (c === "bottom" || c === "right" ? 1 : -1),
760
- closeDrawer: dt,
761
- velocity: O,
762
- dismissible: h
763
- }), i?.(l, !0);
764
- return;
765
- }
766
- if (c === "bottom" || c === "right" ? g > 0 : g < 0) {
767
- Ut(), i?.(l, !0);
768
- return;
769
- }
770
- if (O > Jt) {
771
- dt(), i?.(l, !1);
772
- return;
773
- }
774
- var L;
775
- const H = Math.min((L = d.current.getBoundingClientRect().height) != null ? L : 0, window.innerHeight);
776
- var G;
777
- const V = Math.min((G = d.current.getBoundingClientRect().width) != null ? G : 0, window.innerWidth), et = c === "left" || c === "right";
778
- if (Math.abs(S) >= (et ? V : H) * T) {
779
- dt(), i?.(l, !1);
780
- return;
781
- }
782
- i?.(l, !0), Ut();
783
- }
784
- r.useEffect(() => (_ && ($(document.documentElement, {
785
- scrollBehavior: "auto"
786
- }), pt.current = /* @__PURE__ */ new Date()), () => {
787
- Ne(document.documentElement, "scrollBehavior");
788
- }), [
789
- _
790
- ]);
791
- function we(l) {
792
- const S = l ? (window.innerWidth - nt) / window.innerWidth : 1, x = l ? -nt : 0;
793
- Tt.current && window.clearTimeout(Tt.current), $(d.current, {
794
- transition: `transform ${E.DURATION}s cubic-bezier(${E.EASE.join(",")})`,
795
- transform: C(c) ? `scale(${S}) translate3d(0, ${x}px, 0)` : `scale(${S}) translate3d(${x}px, 0, 0)`
796
- }), !l && d.current && (Tt.current = setTimeout(() => {
797
- const g = yt(d.current, c);
798
- $(d.current, {
799
- transition: "none",
800
- transform: C(c) ? `translate3d(0, ${g}px, 0)` : `translate3d(${g}px, 0, 0)`
801
- });
802
- }, 500));
803
- }
804
- function pe(l, S) {
805
- if (S < 0) return;
806
- const x = (window.innerWidth - nt) / window.innerWidth, g = x + S * (1 - x), O = -nt + S * nt;
807
- $(d.current, {
808
- transform: C(c) ? `scale(${g}) translate3d(0, ${O}px, 0)` : `scale(${g}) translate3d(${O}px, 0, 0)`,
809
- transition: "none"
810
- });
811
- }
812
- function he(l, S) {
813
- const x = C(c) ? window.innerHeight : window.innerWidth, g = S ? (x - nt) / x : 1, O = S ? -nt : 0;
814
- S && $(d.current, {
815
- transition: `transform ${E.DURATION}s cubic-bezier(${E.EASE.join(",")})`,
816
- transform: C(c) ? `scale(${g}) translate3d(0, ${O}px, 0)` : `scale(${g}) translate3d(${O}px, 0, 0)`
817
- });
818
- }
819
- return r.useEffect(() => {
820
- U || window.requestAnimationFrame(() => {
821
- document.body.style.pointerEvents = "auto";
822
- });
823
- }, [
824
- U
825
- ]), /* @__PURE__ */ r.createElement(Q.Root, {
826
- defaultOpen: Y,
827
- onOpenChange: (l) => {
828
- !h && !l || (l ? X(!0) : dt(!0), z(l));
829
- },
830
- open: _
831
- }, /* @__PURE__ */ r.createElement(Yt.Provider, {
832
- value: {
833
- activeSnapPoint: oe,
834
- snapPoints: a,
835
- setActiveSnapPoint: kt,
836
- drawerRef: d,
837
- overlayRef: rt,
838
- onOpenChange: n,
839
- onPress: ce,
840
- onRelease: me,
841
- onDrag: de,
842
- dismissible: h,
843
- shouldAnimate: It,
844
- handleOnly: f,
845
- isOpen: _,
846
- isDragging: K,
847
- shouldFade: Lt,
848
- closeDrawer: dt,
849
- onNestedDrag: pe,
850
- onNestedOpenChange: we,
851
- onNestedRelease: he,
852
- keyboardIsOpen: at,
853
- modal: U,
854
- snapPointsOffset: ct,
855
- activeSnapPointIndex: ot,
856
- direction: c,
857
- shouldScaleBackground: v,
858
- setBackgroundColorOnScale: p,
859
- noBodyStyles: A,
860
- container: P,
861
- autoFocus: W
862
- }
863
- }, e));
864
- }
865
- const ee = /* @__PURE__ */ r.forwardRef(function({ ...t }, n) {
866
- const { overlayRef: e, snapPoints: o, onRelease: i, shouldFade: a, isOpen: v, modal: p, shouldAnimate: T } = wt(), D = Kt(n, e), h = o && o.length > 0;
867
- if (!p)
868
- return null;
869
- const f = r.useCallback((m) => i(m), [
870
- i
871
- ]);
872
- return /* @__PURE__ */ r.createElement(Q.Overlay, {
873
- onMouseUp: f,
874
- ref: D,
875
- "data-vaul-overlay": "",
876
- "data-vaul-snap-points": v && h ? "true" : "false",
877
- "data-vaul-snap-points-overlay": v && a ? "true" : "false",
878
- "data-vaul-animate": T?.current ? "true" : "false",
879
- ...t
880
- });
881
- });
882
- ee.displayName = "Drawer.Overlay";
883
- const ne = /* @__PURE__ */ r.forwardRef(function({ onPointerDownOutside: t, style: n, onOpenAutoFocus: e, ...o }, i) {
884
- const { drawerRef: a, onPress: v, onRelease: p, onDrag: T, keyboardIsOpen: D, snapPointsOffset: h, activeSnapPointIndex: f, modal: m, isOpen: B, direction: k, snapPoints: R, container: U, handleOnly: w, shouldAnimate: M, autoFocus: A } = wt(), [c, Y] = r.useState(!1), tt = Kt(i, a), u = r.useRef(null), b = r.useRef(null), y = r.useRef(!1), N = R && R.length > 0;
885
- Fe();
886
- const P = (s, j, _ = 0) => {
887
- if (y.current) return !0;
888
- const z = Math.abs(s.y), I = Math.abs(s.x), X = I > z, K = [
889
- "bottom",
890
- "right"
891
- ].includes(j) ? 1 : -1;
892
- if (j === "left" || j === "right") {
893
- if (!(s.x * K < 0) && I >= 0 && I <= _)
894
- return X;
895
- } else if (!(s.y * K < 0) && z >= 0 && z <= _)
896
- return !X;
897
- return y.current = !0, !0;
898
- };
899
- r.useEffect(() => {
900
- N && window.requestAnimationFrame(() => {
901
- Y(!0);
902
- });
903
- }, []);
904
- function W(s) {
905
- u.current = null, y.current = !1, p(s);
906
- }
907
- return /* @__PURE__ */ r.createElement(Q.Content, {
908
- "data-vaul-drawer-direction": k,
909
- "data-vaul-drawer": "",
910
- "data-vaul-delayed-snap-points": c ? "true" : "false",
911
- "data-vaul-snap-points": B && N ? "true" : "false",
912
- "data-vaul-custom-container": U ? "true" : "false",
913
- "data-vaul-animate": M?.current ? "true" : "false",
914
- ...o,
915
- ref: tt,
916
- style: h && h.length > 0 ? {
917
- "--snap-point-height": `${h[f ?? 0]}px`,
918
- ...n
919
- } : n,
920
- onPointerDown: (s) => {
921
- w || (o.onPointerDown == null || o.onPointerDown.call(o, s), u.current = {
922
- x: s.pageX,
923
- y: s.pageY
924
- }, v(s));
925
- },
926
- onOpenAutoFocus: (s) => {
927
- e?.(s), A || s.preventDefault();
928
- },
929
- onPointerDownOutside: (s) => {
930
- if (t?.(s), !m || s.defaultPrevented) {
931
- s.preventDefault();
932
- return;
933
- }
934
- D.current && (D.current = !1);
935
- },
936
- onFocusOutside: (s) => {
937
- if (!m) {
938
- s.preventDefault();
939
- return;
940
- }
941
- },
942
- onPointerMove: (s) => {
943
- if (b.current = s, w || (o.onPointerMove == null || o.onPointerMove.call(o, s), !u.current)) return;
944
- const j = s.pageY - u.current.y, _ = s.pageX - u.current.x, z = s.pointerType === "touch" ? 10 : 2;
945
- P({
946
- x: _,
947
- y: j
948
- }, k, z) ? T(s) : (Math.abs(_) > z || Math.abs(j) > z) && (u.current = null);
949
- },
950
- onPointerUp: (s) => {
951
- o.onPointerUp == null || o.onPointerUp.call(o, s), u.current = null, y.current = !1, p(s);
952
- },
953
- onPointerOut: (s) => {
954
- o.onPointerOut == null || o.onPointerOut.call(o, s), W(b.current);
955
- },
956
- onContextMenu: (s) => {
957
- o.onContextMenu == null || o.onContextMenu.call(o, s), b.current && W(b.current);
958
- }
959
- });
960
- });
961
- ne.displayName = "Drawer.Content";
962
- const Ve = 250, Ye = 120, qe = /* @__PURE__ */ r.forwardRef(function({ preventCycle: t = !1, children: n, ...e }, o) {
963
- const { closeDrawer: i, isDragging: a, snapPoints: v, activeSnapPoint: p, setActiveSnapPoint: T, dismissible: D, handleOnly: h, isOpen: f, onPress: m, onDrag: B } = wt(), k = r.useRef(null), R = r.useRef(!1);
964
- function U() {
965
- if (R.current) {
966
- A();
967
- return;
968
- }
969
- window.setTimeout(() => {
970
- w();
971
- }, Ye);
972
- }
973
- function w() {
974
- if (a || t || R.current) {
975
- A();
976
- return;
977
- }
978
- if (A(), !v || v.length === 0) {
979
- D || i();
980
- return;
981
- }
982
- if (p === v[v.length - 1] && D) {
983
- i();
984
- return;
985
- }
986
- const Y = v.findIndex((u) => u === p);
987
- if (Y === -1) return;
988
- const tt = v[Y + 1];
989
- T(tt);
990
- }
991
- function M() {
992
- k.current = window.setTimeout(() => {
993
- R.current = !0;
994
- }, Ve);
995
- }
996
- function A() {
997
- k.current && window.clearTimeout(k.current), R.current = !1;
998
- }
999
- return /* @__PURE__ */ r.createElement("div", {
1000
- onClick: U,
1001
- onPointerCancel: A,
1002
- onPointerDown: (c) => {
1003
- h && m(c), M();
1004
- },
1005
- onPointerMove: (c) => {
1006
- h && B(c);
1007
- },
1008
- // onPointerUp is already handled by the content component
1009
- ref: o,
1010
- "data-vaul-drawer-visible": f ? "true" : "false",
1011
- "data-vaul-handle": "",
1012
- "aria-hidden": "true",
1013
- ...e
1014
- }, /* @__PURE__ */ r.createElement("span", {
1015
- "data-vaul-handle-hitarea": "",
1016
- "aria-hidden": "true"
1017
- }, n));
1018
- });
1019
- qe.displayName = "Drawer.Handle";
1020
- function Xe(t) {
1021
- const n = wt(), { container: e = n.container, ...o } = t;
1022
- return /* @__PURE__ */ r.createElement(Q.Portal, {
1023
- container: e,
1024
- ...o
1025
- });
1026
- }
1027
- const Z = {
1028
- Root: ze,
1029
- Content: ne,
1030
- Overlay: ee,
1031
- Trigger: Q.Trigger,
1032
- Portal: Xe,
1033
- Close: Q.Close,
1034
- Title: Q.Title,
1035
- Description: Q.Description
1036
- };
1037
- function tn({
1
+ import { j as r } from "../jsx-runtime-DywqP_6a.js";
2
+ import { Drawer as e } from "vaul";
3
+ import { c as d } from "../index-CRiPKpXj.js";
4
+ function u({
1038
5
  ...t
1039
6
  }) {
1040
- return /* @__PURE__ */ F.jsx(Z.Root, { "data-slot": "drawer", ...t });
7
+ return /* @__PURE__ */ r.jsx(e.Root, { "data-slot": "drawer", ...t });
1041
8
  }
1042
- function en({
9
+ function w({
1043
10
  ...t
1044
11
  }) {
1045
- return /* @__PURE__ */ F.jsx(Z.Trigger, { "data-slot": "drawer-trigger", ...t });
12
+ return /* @__PURE__ */ r.jsx(e.Trigger, { "data-slot": "drawer-trigger", ...t });
1046
13
  }
1047
- function Ke({
14
+ function i({
1048
15
  ...t
1049
16
  }) {
1050
- return /* @__PURE__ */ F.jsx(Z.Portal, { "data-slot": "drawer-portal", ...t });
17
+ return /* @__PURE__ */ r.jsx(e.Portal, { "data-slot": "drawer-portal", ...t });
1051
18
  }
1052
- function nn({
19
+ function m({
1053
20
  ...t
1054
21
  }) {
1055
- return /* @__PURE__ */ F.jsx(Z.Close, { "data-slot": "drawer-close", ...t });
22
+ return /* @__PURE__ */ r.jsx(e.Close, { "data-slot": "drawer-close", ...t });
1056
23
  }
1057
- function Ge({
24
+ function n({
1058
25
  className: t,
1059
- ...n
26
+ ...a
1060
27
  }) {
1061
- return /* @__PURE__ */ F.jsx(
1062
- Z.Overlay,
28
+ return /* @__PURE__ */ r.jsx(
29
+ e.Overlay,
1063
30
  {
1064
31
  "data-slot": "drawer-overlay",
1065
- className: it(
32
+ className: d(
1066
33
  "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
1067
34
  t
1068
35
  ),
1069
- ...n
36
+ ...a
1070
37
  }
1071
38
  );
1072
39
  }
1073
- function rn({
40
+ function x({
1074
41
  className: t,
1075
- children: n,
1076
- ...e
42
+ children: a,
43
+ ...o
1077
44
  }) {
1078
- return /* @__PURE__ */ F.jsxs(Ke, { "data-slot": "drawer-portal", children: [
1079
- /* @__PURE__ */ F.jsx(Ge, {}),
1080
- /* @__PURE__ */ F.jsxs(
1081
- Z.Content,
45
+ return /* @__PURE__ */ r.jsxs(i, { "data-slot": "drawer-portal", children: [
46
+ /* @__PURE__ */ r.jsx(n, {}),
47
+ /* @__PURE__ */ r.jsxs(
48
+ e.Content,
1082
49
  {
1083
50
  "data-slot": "drawer-content",
1084
- className: it(
51
+ className: d(
1085
52
  "group/drawer-content bg-background fixed z-50 flex h-auto flex-col",
1086
53
  "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
1087
54
  "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t",
@@ -1089,73 +56,73 @@ function rn({
1089
56
  "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
1090
57
  t
1091
58
  ),
1092
- ...e,
59
+ ...o,
1093
60
  children: [
1094
- /* @__PURE__ */ F.jsx("div", { className: "bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" }),
1095
- n
61
+ /* @__PURE__ */ r.jsx("div", { className: "bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" }),
62
+ a
1096
63
  ]
1097
64
  }
1098
65
  )
1099
66
  ] });
1100
67
  }
1101
- function an({ className: t, ...n }) {
1102
- return /* @__PURE__ */ F.jsx(
68
+ function f({ className: t, ...a }) {
69
+ return /* @__PURE__ */ r.jsx(
1103
70
  "div",
1104
71
  {
1105
72
  "data-slot": "drawer-header",
1106
- className: it(
73
+ className: d(
1107
74
  "flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
1108
75
  t
1109
76
  ),
1110
- ...n
77
+ ...a
1111
78
  }
1112
79
  );
1113
80
  }
1114
- function on({ className: t, ...n }) {
1115
- return /* @__PURE__ */ F.jsx(
81
+ function v({ className: t, ...a }) {
82
+ return /* @__PURE__ */ r.jsx(
1116
83
  "div",
1117
84
  {
1118
85
  "data-slot": "drawer-footer",
1119
- className: it("mt-auto flex flex-col gap-2 p-4", t),
1120
- ...n
86
+ className: d("mt-auto flex flex-col gap-2 p-4", t),
87
+ ...a
1121
88
  }
1122
89
  );
1123
90
  }
1124
- function ln({
91
+ function p({
1125
92
  className: t,
1126
- ...n
93
+ ...a
1127
94
  }) {
1128
- return /* @__PURE__ */ F.jsx(
1129
- Z.Title,
95
+ return /* @__PURE__ */ r.jsx(
96
+ e.Title,
1130
97
  {
1131
98
  "data-slot": "drawer-title",
1132
- className: it("text-foreground font-semibold", t),
1133
- ...n
99
+ className: d("text-foreground font-semibold", t),
100
+ ...a
1134
101
  }
1135
102
  );
1136
103
  }
1137
- function sn({
104
+ function g({
1138
105
  className: t,
1139
- ...n
106
+ ...a
1140
107
  }) {
1141
- return /* @__PURE__ */ F.jsx(
1142
- Z.Description,
108
+ return /* @__PURE__ */ r.jsx(
109
+ e.Description,
1143
110
  {
1144
111
  "data-slot": "drawer-description",
1145
- className: it("text-muted-foreground text-sm", t),
1146
- ...n
112
+ className: d("text-muted-foreground text-sm", t),
113
+ ...a
1147
114
  }
1148
115
  );
1149
116
  }
1150
117
  export {
1151
- tn as Drawer,
1152
- nn as DrawerClose,
1153
- rn as DrawerContent,
1154
- sn as DrawerDescription,
1155
- on as DrawerFooter,
1156
- an as DrawerHeader,
1157
- Ge as DrawerOverlay,
1158
- Ke as DrawerPortal,
1159
- ln as DrawerTitle,
1160
- en as DrawerTrigger
118
+ u as Drawer,
119
+ m as DrawerClose,
120
+ x as DrawerContent,
121
+ g as DrawerDescription,
122
+ v as DrawerFooter,
123
+ f as DrawerHeader,
124
+ n as DrawerOverlay,
125
+ i as DrawerPortal,
126
+ p as DrawerTitle,
127
+ w as DrawerTrigger
1161
128
  };