@tribepad/themis 1.0.0 → 1.0.1

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 (326) hide show
  1. package/dist/elements/Accordion/index.js +325 -66
  2. package/dist/elements/Accordion/index.js.map +1 -1
  3. package/dist/elements/Accordion/index.mjs +317 -3
  4. package/dist/elements/Accordion/index.mjs.map +1 -1
  5. package/dist/elements/Avatar/index.js +461 -45
  6. package/dist/elements/Avatar/index.js.map +1 -1
  7. package/dist/elements/Avatar/index.mjs +456 -3
  8. package/dist/elements/Avatar/index.mjs.map +1 -1
  9. package/dist/elements/Badge/index.js +238 -36
  10. package/dist/elements/Badge/index.js.map +1 -1
  11. package/dist/elements/Badge/index.mjs +234 -4
  12. package/dist/elements/Badge/index.mjs.map +1 -1
  13. package/dist/elements/Breadcrumbs/index.js +808 -39
  14. package/dist/elements/Breadcrumbs/index.js.map +1 -1
  15. package/dist/elements/Breadcrumbs/index.mjs +810 -7
  16. package/dist/elements/Breadcrumbs/index.mjs.map +1 -1
  17. package/dist/elements/Button/index.js +282 -19
  18. package/dist/elements/Button/index.js.map +1 -1
  19. package/dist/elements/Button/index.mjs +283 -4
  20. package/dist/elements/Button/index.mjs.map +1 -1
  21. package/dist/elements/ButtonGroup/index.js +229 -56
  22. package/dist/elements/ButtonGroup/index.js.map +1 -1
  23. package/dist/elements/ButtonGroup/index.mjs +222 -3
  24. package/dist/elements/ButtonGroup/index.mjs.map +1 -1
  25. package/dist/elements/Card/Card.d.ts.map +1 -1
  26. package/dist/elements/Card/index.js +563 -67
  27. package/dist/elements/Card/index.js.map +1 -1
  28. package/dist/elements/Card/index.mjs +560 -6
  29. package/dist/elements/Card/index.mjs.map +1 -1
  30. package/dist/elements/Carousel/index.js +782 -14
  31. package/dist/elements/Carousel/index.js.map +1 -1
  32. package/dist/elements/Carousel/index.mjs +786 -8
  33. package/dist/elements/Carousel/index.mjs.map +1 -1
  34. package/dist/elements/Chart/index.js +1833 -36
  35. package/dist/elements/Chart/index.js.map +1 -1
  36. package/dist/elements/Chart/index.mjs +1832 -4
  37. package/dist/elements/Chart/index.mjs.map +1 -1
  38. package/dist/elements/Checkbox/index.js +310 -39
  39. package/dist/elements/Checkbox/index.js.map +1 -1
  40. package/dist/elements/Checkbox/index.mjs +306 -4
  41. package/dist/elements/Checkbox/index.mjs.map +1 -1
  42. package/dist/elements/CheckboxGroup/index.js +445 -59
  43. package/dist/elements/CheckboxGroup/index.js.map +1 -1
  44. package/dist/elements/CheckboxGroup/index.mjs +439 -4
  45. package/dist/elements/CheckboxGroup/index.mjs.map +1 -1
  46. package/dist/elements/DatePicker/index.js +871 -89
  47. package/dist/elements/DatePicker/index.js.map +1 -1
  48. package/dist/elements/DatePicker/index.mjs +853 -4
  49. package/dist/elements/DatePicker/index.mjs.map +1 -1
  50. package/dist/elements/Dropdown/index.js +189 -35
  51. package/dist/elements/Dropdown/index.js.map +1 -1
  52. package/dist/elements/Dropdown/index.mjs +184 -2
  53. package/dist/elements/Dropdown/index.mjs.map +1 -1
  54. package/dist/elements/FileField/index.js +1532 -129
  55. package/dist/elements/FileField/index.js.map +1 -1
  56. package/dist/elements/FileField/index.mjs +1507 -7
  57. package/dist/elements/FileField/index.mjs.map +1 -1
  58. package/dist/elements/FormLayout/index.js +166 -11
  59. package/dist/elements/FormLayout/index.js.map +1 -1
  60. package/dist/elements/FormLayout/index.mjs +167 -2
  61. package/dist/elements/FormLayout/index.mjs.map +1 -1
  62. package/dist/elements/Modal/index.js +228 -46
  63. package/dist/elements/Modal/index.js.map +1 -1
  64. package/dist/elements/Modal/index.mjs +220 -1
  65. package/dist/elements/Modal/index.mjs.map +1 -1
  66. package/dist/elements/NumberField/index.js +659 -48
  67. package/dist/elements/NumberField/index.js.map +1 -1
  68. package/dist/elements/NumberField/index.mjs +654 -6
  69. package/dist/elements/NumberField/index.mjs.map +1 -1
  70. package/dist/elements/OTPInput/index.js +729 -6
  71. package/dist/elements/OTPInput/index.js.map +1 -1
  72. package/dist/elements/OTPInput/index.mjs +732 -2
  73. package/dist/elements/OTPInput/index.mjs.map +1 -1
  74. package/dist/elements/Panel/index.js +326 -27
  75. package/dist/elements/Panel/index.js.map +1 -1
  76. package/dist/elements/Panel/index.mjs +323 -2
  77. package/dist/elements/Panel/index.mjs.map +1 -1
  78. package/dist/elements/Progress/index.js +181 -22
  79. package/dist/elements/Progress/index.js.map +1 -1
  80. package/dist/elements/Progress/index.mjs +181 -3
  81. package/dist/elements/Progress/index.mjs.map +1 -1
  82. package/dist/elements/RadioGroup/index.js +358 -34
  83. package/dist/elements/RadioGroup/index.js.map +1 -1
  84. package/dist/elements/RadioGroup/index.mjs +359 -4
  85. package/dist/elements/RadioGroup/index.mjs.map +1 -1
  86. package/dist/elements/Resizable/components/ResizableHandle.d.ts +0 -8
  87. package/dist/elements/Resizable/components/ResizableHandle.d.ts.map +1 -1
  88. package/dist/elements/Resizable/components/ResizablePanel.d.ts +0 -8
  89. package/dist/elements/Resizable/components/ResizablePanel.d.ts.map +1 -1
  90. package/dist/elements/Resizable/components/ResizablePanelGroup.d.ts +0 -8
  91. package/dist/elements/Resizable/components/ResizablePanelGroup.d.ts.map +1 -1
  92. package/dist/elements/Resizable/components/ResizablePopover.d.ts +0 -8
  93. package/dist/elements/Resizable/components/ResizablePopover.d.ts.map +1 -1
  94. package/dist/elements/Resizable/index.js +1568 -51
  95. package/dist/elements/Resizable/index.js.map +1 -1
  96. package/dist/elements/Resizable/index.mjs +1566 -6
  97. package/dist/elements/Resizable/index.mjs.map +1 -1
  98. package/dist/elements/Select/index.js +580 -22
  99. package/dist/elements/Select/index.js.map +1 -1
  100. package/dist/elements/Select/index.mjs +582 -2
  101. package/dist/elements/Select/index.mjs.map +1 -1
  102. package/dist/elements/Skeleton/index.js +77 -15
  103. package/dist/elements/Skeleton/index.js.map +1 -1
  104. package/dist/elements/Skeleton/index.mjs +78 -3
  105. package/dist/elements/Skeleton/index.mjs.map +1 -1
  106. package/dist/elements/Switch/index.js +153 -21
  107. package/dist/elements/Switch/index.js.map +1 -1
  108. package/dist/elements/Switch/index.mjs +149 -5
  109. package/dist/elements/Switch/index.mjs.map +1 -1
  110. package/dist/elements/Table/index.js +589 -68
  111. package/dist/elements/Table/index.js.map +1 -1
  112. package/dist/elements/Table/index.mjs +578 -5
  113. package/dist/elements/Table/index.mjs.map +1 -1
  114. package/dist/elements/Tabs/index.js +328 -63
  115. package/dist/elements/Tabs/index.js.map +1 -1
  116. package/dist/elements/Tabs/index.mjs +320 -3
  117. package/dist/elements/Tabs/index.mjs.map +1 -1
  118. package/dist/elements/TextField/index.js +695 -51
  119. package/dist/elements/TextField/index.js.map +1 -1
  120. package/dist/elements/TextField/index.mjs +684 -7
  121. package/dist/elements/TextField/index.mjs.map +1 -1
  122. package/dist/elements/TimeField/index.js +244 -33
  123. package/dist/elements/TimeField/index.js.map +1 -1
  124. package/dist/elements/TimeField/index.mjs +238 -2
  125. package/dist/elements/TimeField/index.mjs.map +1 -1
  126. package/dist/elements/Toast/index.js +727 -48
  127. package/dist/elements/Toast/index.js.map +1 -1
  128. package/dist/elements/Toast/index.mjs +724 -5
  129. package/dist/elements/Toast/index.mjs.map +1 -1
  130. package/dist/elements/Tooltip/index.js +315 -49
  131. package/dist/elements/Tooltip/index.js.map +1 -1
  132. package/dist/elements/Tooltip/index.mjs +310 -4
  133. package/dist/elements/Tooltip/index.mjs.map +1 -1
  134. package/dist/elements/index.js +12417 -799
  135. package/dist/elements/index.js.map +1 -1
  136. package/dist/elements/index.mjs +12233 -40
  137. package/dist/elements/index.mjs.map +1 -1
  138. package/dist/index.js +12452 -825
  139. package/dist/index.js.map +1 -1
  140. package/dist/index.mjs +12262 -42
  141. package/dist/index.mjs.map +1 -1
  142. package/dist/schemas/index.js +47 -21
  143. package/dist/schemas/index.js.map +1 -1
  144. package/dist/schemas/index.mjs +47 -2
  145. package/dist/schemas/index.mjs.map +1 -1
  146. package/dist/styles/index.js +161 -147
  147. package/dist/styles/index.js.map +1 -1
  148. package/dist/styles/index.mjs +128 -2
  149. package/dist/styles/index.mjs.map +1 -1
  150. package/dist/utils/index.js +7 -7
  151. package/dist/utils/index.js.map +1 -1
  152. package/dist/utils/index.mjs +9 -2
  153. package/dist/utils/index.mjs.map +1 -1
  154. package/package.json +1 -1
  155. package/dist/Carousel-NTZX5TOW.js +0 -16
  156. package/dist/Carousel-NTZX5TOW.js.map +0 -1
  157. package/dist/Carousel-YH3DOQJU.mjs +0 -7
  158. package/dist/Carousel-YH3DOQJU.mjs.map +0 -1
  159. package/dist/chunk-2HIUTHMU.mjs +0 -234
  160. package/dist/chunk-2HIUTHMU.mjs.map +0 -1
  161. package/dist/chunk-34GTFTDO.js +0 -431
  162. package/dist/chunk-34GTFTDO.js.map +0 -1
  163. package/dist/chunk-3H7ASYR7.js +0 -250
  164. package/dist/chunk-3H7ASYR7.js.map +0 -1
  165. package/dist/chunk-3IEN7JOP.js +0 -316
  166. package/dist/chunk-3IEN7JOP.js.map +0 -1
  167. package/dist/chunk-3JHN4GAL.js +0 -326
  168. package/dist/chunk-3JHN4GAL.js.map +0 -1
  169. package/dist/chunk-3MJPASQU.js +0 -232
  170. package/dist/chunk-3MJPASQU.js.map +0 -1
  171. package/dist/chunk-3XD2JUL3.js +0 -572
  172. package/dist/chunk-3XD2JUL3.js.map +0 -1
  173. package/dist/chunk-3YOY2VJ6.js +0 -189
  174. package/dist/chunk-3YOY2VJ6.js.map +0 -1
  175. package/dist/chunk-4DU5JSXB.js +0 -408
  176. package/dist/chunk-4DU5JSXB.js.map +0 -1
  177. package/dist/chunk-4E4E2GSS.js +0 -352
  178. package/dist/chunk-4E4E2GSS.js.map +0 -1
  179. package/dist/chunk-4NHAP4AN.mjs +0 -3
  180. package/dist/chunk-4NHAP4AN.mjs.map +0 -1
  181. package/dist/chunk-4S33J5NY.mjs +0 -415
  182. package/dist/chunk-4S33J5NY.mjs.map +0 -1
  183. package/dist/chunk-5SMGRT3G.mjs +0 -354
  184. package/dist/chunk-5SMGRT3G.mjs.map +0 -1
  185. package/dist/chunk-5SVLJN2C.mjs +0 -22
  186. package/dist/chunk-5SVLJN2C.mjs.map +0 -1
  187. package/dist/chunk-66WTU4EB.mjs +0 -299
  188. package/dist/chunk-66WTU4EB.mjs.map +0 -1
  189. package/dist/chunk-6S25NMOT.mjs +0 -335
  190. package/dist/chunk-6S25NMOT.mjs.map +0 -1
  191. package/dist/chunk-6SP7UB3D.js +0 -4
  192. package/dist/chunk-6SP7UB3D.js.map +0 -1
  193. package/dist/chunk-6TYWWQHM.mjs +0 -565
  194. package/dist/chunk-6TYWWQHM.mjs.map +0 -1
  195. package/dist/chunk-A3YUJA6W.mjs +0 -384
  196. package/dist/chunk-A3YUJA6W.mjs.map +0 -1
  197. package/dist/chunk-A6KEDVUR.js +0 -61
  198. package/dist/chunk-A6KEDVUR.js.map +0 -1
  199. package/dist/chunk-A77RUEWL.js +0 -730
  200. package/dist/chunk-A77RUEWL.js.map +0 -1
  201. package/dist/chunk-AA4IKMPE.mjs +0 -3
  202. package/dist/chunk-AA4IKMPE.mjs.map +0 -1
  203. package/dist/chunk-AKIA6GW6.mjs +0 -163
  204. package/dist/chunk-AKIA6GW6.mjs.map +0 -1
  205. package/dist/chunk-AL6P275L.mjs +0 -435
  206. package/dist/chunk-AL6P275L.mjs.map +0 -1
  207. package/dist/chunk-AZ3RJYTB.js +0 -37
  208. package/dist/chunk-AZ3RJYTB.js.map +0 -1
  209. package/dist/chunk-B5Q4UPL6.js +0 -32
  210. package/dist/chunk-B5Q4UPL6.js.map +0 -1
  211. package/dist/chunk-B6DHPMDP.mjs +0 -335
  212. package/dist/chunk-B6DHPMDP.mjs.map +0 -1
  213. package/dist/chunk-BDXKKMBZ.mjs +0 -184
  214. package/dist/chunk-BDXKKMBZ.mjs.map +0 -1
  215. package/dist/chunk-BL6E2DLZ.mjs +0 -52
  216. package/dist/chunk-BL6E2DLZ.mjs.map +0 -1
  217. package/dist/chunk-CGFDS4XS.mjs +0 -121
  218. package/dist/chunk-CGFDS4XS.mjs.map +0 -1
  219. package/dist/chunk-CJIW5TKI.js +0 -139
  220. package/dist/chunk-CJIW5TKI.js.map +0 -1
  221. package/dist/chunk-CKNISJOQ.js +0 -314
  222. package/dist/chunk-CKNISJOQ.js.map +0 -1
  223. package/dist/chunk-D6CBOECS.mjs +0 -1757
  224. package/dist/chunk-D6CBOECS.mjs.map +0 -1
  225. package/dist/chunk-DDWEVC2S.js +0 -166
  226. package/dist/chunk-DDWEVC2S.js.map +0 -1
  227. package/dist/chunk-DZ556D2F.mjs +0 -176
  228. package/dist/chunk-DZ556D2F.mjs.map +0 -1
  229. package/dist/chunk-E2KQFV3O.mjs +0 -10
  230. package/dist/chunk-E2KQFV3O.mjs.map +0 -1
  231. package/dist/chunk-EMMLADSC.js +0 -126
  232. package/dist/chunk-EMMLADSC.js.map +0 -1
  233. package/dist/chunk-EP4WOI5D.mjs +0 -926
  234. package/dist/chunk-EP4WOI5D.mjs.map +0 -1
  235. package/dist/chunk-FJRXLJC2.mjs +0 -160
  236. package/dist/chunk-FJRXLJC2.mjs.map +0 -1
  237. package/dist/chunk-FKQI434R.js +0 -345
  238. package/dist/chunk-FKQI434R.js.map +0 -1
  239. package/dist/chunk-FPKEAJRZ.mjs +0 -100
  240. package/dist/chunk-FPKEAJRZ.mjs.map +0 -1
  241. package/dist/chunk-FWQYB22U.js +0 -183
  242. package/dist/chunk-FWQYB22U.js.map +0 -1
  243. package/dist/chunk-GD5GHTMA.js +0 -189
  244. package/dist/chunk-GD5GHTMA.js.map +0 -1
  245. package/dist/chunk-GE5XTSDZ.js +0 -447
  246. package/dist/chunk-GE5XTSDZ.js.map +0 -1
  247. package/dist/chunk-GVE47ZAX.mjs +0 -32
  248. package/dist/chunk-GVE47ZAX.mjs.map +0 -1
  249. package/dist/chunk-HK46BT5U.mjs +0 -18
  250. package/dist/chunk-HK46BT5U.mjs.map +0 -1
  251. package/dist/chunk-HQVRMR6N.js +0 -365
  252. package/dist/chunk-HQVRMR6N.js.map +0 -1
  253. package/dist/chunk-HSGBJPJO.mjs +0 -398
  254. package/dist/chunk-HSGBJPJO.mjs.map +0 -1
  255. package/dist/chunk-I3AUTOMZ.mjs +0 -125
  256. package/dist/chunk-I3AUTOMZ.mjs.map +0 -1
  257. package/dist/chunk-IEI5LD5C.mjs +0 -1161
  258. package/dist/chunk-IEI5LD5C.mjs.map +0 -1
  259. package/dist/chunk-IIPTC2X7.mjs +0 -118
  260. package/dist/chunk-IIPTC2X7.mjs.map +0 -1
  261. package/dist/chunk-J7TLHF2Q.js +0 -4
  262. package/dist/chunk-J7TLHF2Q.js.map +0 -1
  263. package/dist/chunk-JJOWXFXQ.mjs +0 -765
  264. package/dist/chunk-JJOWXFXQ.mjs.map +0 -1
  265. package/dist/chunk-JPTSS2OA.mjs +0 -3
  266. package/dist/chunk-JPTSS2OA.mjs.map +0 -1
  267. package/dist/chunk-KFXXRLTP.js +0 -396
  268. package/dist/chunk-KFXXRLTP.js.map +0 -1
  269. package/dist/chunk-KPRRBSG6.mjs +0 -272
  270. package/dist/chunk-KPRRBSG6.mjs.map +0 -1
  271. package/dist/chunk-NFSBGRDB.mjs +0 -57
  272. package/dist/chunk-NFSBGRDB.mjs.map +0 -1
  273. package/dist/chunk-NGJVCFTM.js +0 -219
  274. package/dist/chunk-NGJVCFTM.js.map +0 -1
  275. package/dist/chunk-NSQ6MZJ6.mjs +0 -728
  276. package/dist/chunk-NSQ6MZJ6.mjs.map +0 -1
  277. package/dist/chunk-NYQYHT76.mjs +0 -296
  278. package/dist/chunk-NYQYHT76.mjs.map +0 -1
  279. package/dist/chunk-OLJJGI5B.js +0 -1193
  280. package/dist/chunk-OLJJGI5B.js.map +0 -1
  281. package/dist/chunk-Q3572X2J.js +0 -292
  282. package/dist/chunk-Q3572X2J.js.map +0 -1
  283. package/dist/chunk-QH7N7D4I.mjs +0 -210
  284. package/dist/chunk-QH7N7D4I.mjs.map +0 -1
  285. package/dist/chunk-R7XUIV25.js +0 -466
  286. package/dist/chunk-R7XUIV25.js.map +0 -1
  287. package/dist/chunk-RFFO4KPM.js +0 -135
  288. package/dist/chunk-RFFO4KPM.js.map +0 -1
  289. package/dist/chunk-RFX7QKA7.mjs +0 -180
  290. package/dist/chunk-RFX7QKA7.mjs.map +0 -1
  291. package/dist/chunk-SN5LFAP3.js +0 -940
  292. package/dist/chunk-SN5LFAP3.js.map +0 -1
  293. package/dist/chunk-T4COXKQ3.js +0 -24
  294. package/dist/chunk-T4COXKQ3.js.map +0 -1
  295. package/dist/chunk-TS54QM27.js +0 -125
  296. package/dist/chunk-TS54QM27.js.map +0 -1
  297. package/dist/chunk-UE2S4PCX.mjs +0 -220
  298. package/dist/chunk-UE2S4PCX.mjs.map +0 -1
  299. package/dist/chunk-UTW3QX2A.mjs +0 -282
  300. package/dist/chunk-UTW3QX2A.mjs.map +0 -1
  301. package/dist/chunk-V74LGMAE.js +0 -1767
  302. package/dist/chunk-V74LGMAE.js.map +0 -1
  303. package/dist/chunk-VIREG536.js +0 -12
  304. package/dist/chunk-VIREG536.js.map +0 -1
  305. package/dist/chunk-VY7M7346.js +0 -4
  306. package/dist/chunk-VY7M7346.js.map +0 -1
  307. package/dist/chunk-W3TJOO7H.mjs +0 -319
  308. package/dist/chunk-W3TJOO7H.mjs.map +0 -1
  309. package/dist/chunk-WIUOB36M.js +0 -54
  310. package/dist/chunk-WIUOB36M.js.map +0 -1
  311. package/dist/chunk-WJGLM4CY.js +0 -291
  312. package/dist/chunk-WJGLM4CY.js.map +0 -1
  313. package/dist/chunk-WNURH5OO.mjs +0 -453
  314. package/dist/chunk-WNURH5OO.mjs.map +0 -1
  315. package/dist/chunk-X25TNRSD.mjs +0 -364
  316. package/dist/chunk-X25TNRSD.mjs.map +0 -1
  317. package/dist/chunk-Y3GT7ETK.js +0 -108
  318. package/dist/chunk-Y3GT7ETK.js.map +0 -1
  319. package/dist/chunk-Z4FRNOF6.mjs +0 -115
  320. package/dist/chunk-Z4FRNOF6.mjs.map +0 -1
  321. package/dist/chunk-ZMYLD3BN.js +0 -166
  322. package/dist/chunk-ZMYLD3BN.js.map +0 -1
  323. package/dist/chunk-ZP2KV6EX.js +0 -815
  324. package/dist/chunk-ZP2KV6EX.js.map +0 -1
  325. package/dist/chunk-ZVKXFELU.js +0 -366
  326. package/dist/chunk-ZVKXFELU.js.map +0 -1
@@ -1,8 +1,1568 @@
1
- export { DEFAULT_MAX_SIZE, DEFAULT_MIN_SIZE, LONG_PRESS_THRESHOLD, ResizableHandle, ResizableHandlePropsSchema, ResizablePanel, ResizablePanelGroup, ResizablePanelGroupPropsSchema, ResizablePanelPropsSchema, ResizePresetSchema, resizableGripVariants, resizableHandleVariants, useResizableContext } from '../../chunk-EP4WOI5D.mjs';
2
- import '../../chunk-A3YUJA6W.mjs';
3
- import '../../chunk-BDXKKMBZ.mjs';
4
- import '../../chunk-FPKEAJRZ.mjs';
5
- import '../../chunk-HK46BT5U.mjs';
6
- import '../../chunk-E2KQFV3O.mjs';
1
+ "use client";
2
+ import { createContext, forwardRef, useImperativeHandle, useRef, useState, useEffect, memo, useId, useCallback, useContext } from 'react';
3
+ import { clsx } from 'clsx';
4
+ import { twMerge } from 'tailwind-merge';
5
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
+ import { z } from 'zod';
7
+ import { cva } from 'class-variance-authority';
8
+ import { Loader2, Zap, Minus, Plus, X, GripVertical, GripHorizontal } from 'lucide-react';
9
+ import { Button as Button$1, NumberField as NumberField$1, Label, Group, Input, Text, FieldError, DialogTrigger, Popover, Dialog } from 'react-aria-components';
10
+
11
+ // src/elements/Resizable/components/ResizablePanelGroup.tsx
12
+ function cn(...inputs) {
13
+ return twMerge(clsx(inputs));
14
+ }
15
+ var ResizableContext = createContext(
16
+ null
17
+ );
18
+ ResizableContext.displayName = "ResizableContext";
19
+ function useResizableContext() {
20
+ const context = useContext(ResizableContext);
21
+ if (!context) {
22
+ throw new Error(
23
+ "useResizableContext must be used within a ResizablePanelGroup. Make sure ResizablePanel and ResizableHandle are children of ResizablePanelGroup."
24
+ );
25
+ }
26
+ return context;
27
+ }
28
+ function useResizableProvider({
29
+ direction,
30
+ groupLabel,
31
+ sizes: controlledSizes,
32
+ onSizesChange
33
+ }) {
34
+ const [internalSizes, setInternalSizes] = useState([]);
35
+ const [panels, setPanels] = useState([]);
36
+ const containerRef = useRef(null);
37
+ const liveRegionRef = useRef(null);
38
+ const announceTimeoutRef = useRef(null);
39
+ const sizesInitializedRef = useRef(false);
40
+ const isControlled = controlledSizes !== void 0;
41
+ const sizes = isControlled ? controlledSizes : internalSizes;
42
+ const setSizes = useCallback(
43
+ (newSizes) => {
44
+ if (isControlled) {
45
+ onSizesChange?.(newSizes);
46
+ } else {
47
+ setInternalSizes(newSizes);
48
+ }
49
+ },
50
+ [isControlled, onSizesChange]
51
+ );
52
+ const registerPanel = useCallback((index, info) => {
53
+ setPanels((prev) => {
54
+ const newPanels = [...prev];
55
+ newPanels[index] = info;
56
+ return newPanels;
57
+ });
58
+ }, []);
59
+ const unregisterPanel = useCallback((index) => {
60
+ setPanels((prev) => {
61
+ const newPanels = [...prev];
62
+ delete newPanels[index];
63
+ return newPanels.filter(Boolean);
64
+ });
65
+ }, []);
66
+ useEffect(() => {
67
+ if (isControlled || sizesInitializedRef.current) return;
68
+ const registeredPanels = panels.filter(Boolean);
69
+ const panelCount = registeredPanels.length;
70
+ if (panelCount < 2) return;
71
+ const needsInit = sizes.length < panelCount || sizes.some((s) => s === void 0);
72
+ if (needsInit) {
73
+ const newSizes = [];
74
+ const equalSize = 100 / panelCount;
75
+ for (let i = 0; i < panelCount; i++) {
76
+ newSizes[i] = equalSize;
77
+ }
78
+ sizesInitializedRef.current = true;
79
+ setInternalSizes(newSizes);
80
+ }
81
+ }, [panels, sizes, isControlled]);
82
+ useEffect(() => {
83
+ return () => {
84
+ if (announceTimeoutRef.current) {
85
+ clearTimeout(announceTimeoutRef.current);
86
+ }
87
+ if (liveRegionRef.current) {
88
+ document.body.removeChild(liveRegionRef.current);
89
+ liveRegionRef.current = null;
90
+ }
91
+ };
92
+ }, []);
93
+ const announce = useCallback((message) => {
94
+ if (!liveRegionRef.current) {
95
+ const liveRegion = document.createElement("div");
96
+ liveRegion.setAttribute("aria-live", "polite");
97
+ liveRegion.setAttribute("aria-atomic", "true");
98
+ liveRegion.className = "sr-only";
99
+ liveRegion.style.cssText = "position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;";
100
+ document.body.appendChild(liveRegion);
101
+ liveRegionRef.current = liveRegion;
102
+ }
103
+ liveRegionRef.current.textContent = message;
104
+ if (announceTimeoutRef.current) {
105
+ clearTimeout(announceTimeoutRef.current);
106
+ }
107
+ announceTimeoutRef.current = setTimeout(() => {
108
+ if (liveRegionRef.current) {
109
+ liveRegionRef.current.textContent = "";
110
+ }
111
+ }, 1e3);
112
+ }, []);
113
+ return {
114
+ direction,
115
+ groupLabel,
116
+ sizes,
117
+ setSizes,
118
+ panels,
119
+ registerPanel,
120
+ unregisterPanel,
121
+ announce,
122
+ containerRef
123
+ };
124
+ }
125
+ var ResizablePanelGroup = forwardRef(function ResizablePanelGroup2({ direction, groupLabel, sizes, onSizesChange, className, children }, ref) {
126
+ const contextValue = useResizableProvider({
127
+ direction,
128
+ groupLabel,
129
+ sizes,
130
+ onSizesChange
131
+ });
132
+ useImperativeHandle(
133
+ ref,
134
+ () => contextValue.containerRef.current,
135
+ [contextValue.containerRef]
136
+ );
137
+ return /* @__PURE__ */ jsx(ResizableContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
138
+ "div",
139
+ {
140
+ ref: contextValue.containerRef,
141
+ role: "group",
142
+ "aria-label": `${groupLabel}, ${direction}`,
143
+ "data-direction": direction,
144
+ className: cn(
145
+ "flex h-full w-full",
146
+ direction === "horizontal" ? "flex-row" : "flex-col",
147
+ className
148
+ ),
149
+ children
150
+ }
151
+ ) });
152
+ });
153
+ ResizablePanelGroup.displayName = "ResizablePanelGroup";
154
+ var DEFAULT_MIN_SIZE = 10;
155
+ var DEFAULT_MAX_SIZE = 90;
156
+ var LONG_PRESS_THRESHOLD = 300;
157
+ var ResizePresetSchema = z.object({
158
+ label: z.string().min(1),
159
+ sizes: z.array(z.number().min(0).max(100))
160
+ });
161
+ var ResizablePanelGroupPropsSchema = z.object({
162
+ /** Layout direction */
163
+ direction: z.enum(["horizontal", "vertical"]),
164
+ /** REQUIRED: Label for screen reader identification of this group */
165
+ groupLabel: z.string().min(1),
166
+ /** Controlled mode: current sizes as percentages */
167
+ sizes: z.array(z.number().min(0).max(100)).optional(),
168
+ /** Callback when sizes change */
169
+ onSizesChange: z.function().optional(),
170
+ /** Additional CSS classes */
171
+ className: z.string().optional(),
172
+ /** Panel children */
173
+ children: z.custom()
174
+ });
175
+ var ResizablePanelPropsSchema = z.object({
176
+ /** REQUIRED: Name for screen reader identification */
177
+ name: z.string().min(1),
178
+ /** Default size as percentage (auto-distributes equally if omitted) */
179
+ defaultSize: z.number().min(0).max(100).optional(),
180
+ /** Minimum size as percentage */
181
+ minSize: z.number().min(0).max(100).optional().default(DEFAULT_MIN_SIZE),
182
+ /** Maximum size as percentage */
183
+ maxSize: z.number().min(0).max(100).optional().default(DEFAULT_MAX_SIZE),
184
+ /** Whether panel can collapse to 0% */
185
+ collapsible: z.boolean().optional().default(false),
186
+ /** Callback when panel collapses */
187
+ onCollapse: z.function().optional(),
188
+ /** Callback when panel expands from collapsed */
189
+ onExpand: z.function().optional(),
190
+ /** Callback when panel resizes */
191
+ onResize: z.function().optional(),
192
+ /** Additional CSS classes */
193
+ className: z.string().optional(),
194
+ /** Panel content */
195
+ children: z.custom()
196
+ });
197
+ var ResizableHandlePropsSchema = z.object({
198
+ /** Whether to show the visual grip indicator */
199
+ withHandle: z.boolean().optional().default(true),
200
+ /** Size presets for quick adjustment */
201
+ presets: z.array(ResizePresetSchema).optional(),
202
+ /** Whether the handle is disabled */
203
+ disabled: z.boolean().optional().default(false),
204
+ /** Additional CSS classes */
205
+ className: z.string().optional()
206
+ });
207
+ var resizableHandleVariants = cva(
208
+ [
209
+ // Base styles - 44px touch target
210
+ "relative flex items-center justify-center",
211
+ "shrink-0",
212
+ "bg-transparent",
213
+ "transition-colors duration-150",
214
+ // Focus styles
215
+ "focus-visible:outline-none focus-visible:ring-2",
216
+ "focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2",
217
+ // Touch target padding for accessibility
218
+ "touch-none select-none"
219
+ ],
220
+ {
221
+ variants: {
222
+ direction: {
223
+ horizontal: [
224
+ "w-3 min-w-[12px]",
225
+ "cursor-col-resize",
226
+ "hover:bg-[var(--accent)]/50",
227
+ // Ensure 44px touch target via padding
228
+ "before:absolute before:inset-y-0 before:-inset-x-4",
229
+ "before:min-w-[44px]"
230
+ ],
231
+ vertical: [
232
+ "h-3 min-h-[12px]",
233
+ "cursor-row-resize",
234
+ "hover:bg-[var(--accent)]/50",
235
+ // Ensure 44px touch target via padding
236
+ "before:absolute before:inset-x-0 before:-inset-y-4",
237
+ "before:min-h-[44px]"
238
+ ]
239
+ },
240
+ disabled: {
241
+ true: "cursor-not-allowed opacity-50 pointer-events-none",
242
+ false: ""
243
+ },
244
+ isDragging: {
245
+ true: "bg-[var(--accent)]",
246
+ false: ""
247
+ }
248
+ },
249
+ defaultVariants: {
250
+ direction: "horizontal",
251
+ disabled: false,
252
+ isDragging: false
253
+ }
254
+ }
255
+ );
256
+ var resizableGripVariants = cva(
257
+ [
258
+ "flex items-center justify-center",
259
+ "rounded-full",
260
+ "bg-[var(--border)]",
261
+ "text-[var(--menu-muted)]"
262
+ ],
263
+ {
264
+ variants: {
265
+ direction: {
266
+ horizontal: "h-8 w-1",
267
+ vertical: "h-1 w-8"
268
+ }
269
+ },
270
+ defaultVariants: {
271
+ direction: "horizontal"
272
+ }
273
+ }
274
+ );
275
+ var ResizablePanel = forwardRef(
276
+ function ResizablePanel2({
277
+ name,
278
+ defaultSize: _defaultSize,
279
+ minSize = DEFAULT_MIN_SIZE,
280
+ maxSize = DEFAULT_MAX_SIZE,
281
+ collapsible = false,
282
+ onCollapse,
283
+ onExpand,
284
+ onResize,
285
+ className,
286
+ children
287
+ }, ref) {
288
+ const { sizes, registerPanel, unregisterPanel, containerRef } = useResizableContext();
289
+ const internalRef = useRef(null);
290
+ const [panelIndex, setPanelIndex] = useState(-1);
291
+ const prevSizeRef = useRef(null);
292
+ const isRegisteredRef = useRef(false);
293
+ const registeredIndexRef = useRef(-1);
294
+ useEffect(() => {
295
+ const panel = internalRef.current;
296
+ const container = containerRef.current;
297
+ if (!panel || !container) return;
298
+ const allPanels = container.querySelectorAll("[data-resizable-panel]");
299
+ let foundIndex = -1;
300
+ for (let i = 0; i < allPanels.length; i++) {
301
+ if (allPanels[i] === panel) {
302
+ foundIndex = i;
303
+ break;
304
+ }
305
+ }
306
+ if (foundIndex === -1) return;
307
+ if (panelIndex !== foundIndex) {
308
+ setPanelIndex(foundIndex);
309
+ }
310
+ if (!isRegisteredRef.current) {
311
+ isRegisteredRef.current = true;
312
+ registeredIndexRef.current = foundIndex;
313
+ registerPanel(foundIndex, {
314
+ name,
315
+ minSize,
316
+ maxSize,
317
+ collapsible
318
+ });
319
+ }
320
+ return () => {
321
+ if (isRegisteredRef.current) {
322
+ unregisterPanel(registeredIndexRef.current);
323
+ isRegisteredRef.current = false;
324
+ }
325
+ };
326
+ }, [containerRef, registerPanel, unregisterPanel, name, minSize, maxSize, collapsible, panelIndex]);
327
+ const currentSize = panelIndex >= 0 ? sizes[panelIndex] ?? 50 : 50;
328
+ useEffect(() => {
329
+ if (prevSizeRef.current === null) {
330
+ prevSizeRef.current = currentSize;
331
+ return;
332
+ }
333
+ const wasCollapsed = prevSizeRef.current === 0;
334
+ const isCollapsed = currentSize === 0;
335
+ if (!wasCollapsed && isCollapsed && onCollapse) {
336
+ onCollapse();
337
+ } else if (wasCollapsed && !isCollapsed && onExpand) {
338
+ onExpand();
339
+ }
340
+ if (onResize && prevSizeRef.current !== currentSize) {
341
+ onResize(currentSize);
342
+ }
343
+ prevSizeRef.current = currentSize;
344
+ }, [currentSize, onCollapse, onExpand, onResize]);
345
+ return /* @__PURE__ */ jsx(
346
+ "div",
347
+ {
348
+ ref: (node) => {
349
+ internalRef.current = node;
350
+ if (typeof ref === "function") {
351
+ ref(node);
352
+ } else if (ref) {
353
+ ref.current = node;
354
+ }
355
+ },
356
+ role: "region",
357
+ "aria-label": name,
358
+ "data-resizable-panel": "",
359
+ "data-panel-name": name,
360
+ "data-panel-index": panelIndex,
361
+ "data-collapsed": currentSize === 0,
362
+ style: {
363
+ flexBasis: `${currentSize}%`,
364
+ flexGrow: 0,
365
+ flexShrink: 0,
366
+ overflow: "hidden"
367
+ },
368
+ className: cn("relative", className),
369
+ children
370
+ }
371
+ );
372
+ }
373
+ );
374
+ ResizablePanel.displayName = "ResizablePanel";
375
+ function clampSize(size, min, max) {
376
+ return Math.max(min, Math.min(max, size));
377
+ }
378
+ function calculateNewSizes(sizes, panels, leftIndex, rightIndex, delta) {
379
+ const newSizes = [...sizes];
380
+ const leftPanel = panels[leftIndex];
381
+ const rightPanel = panels[rightIndex];
382
+ if (!leftPanel || !rightPanel) return sizes;
383
+ const leftSize = sizes[leftIndex] ?? 50;
384
+ const rightSize = sizes[rightIndex] ?? 50;
385
+ let newLeftSize = leftSize + delta;
386
+ let newRightSize = rightSize - delta;
387
+ const leftMin = leftPanel.collapsible ? 0 : leftPanel.minSize;
388
+ const leftMax = leftPanel.maxSize;
389
+ const rightMin = rightPanel.collapsible ? 0 : rightPanel.minSize;
390
+ const rightMax = rightPanel.maxSize;
391
+ newLeftSize = clampSize(newLeftSize, leftMin, leftMax);
392
+ newRightSize = leftSize + rightSize - newLeftSize;
393
+ newRightSize = clampSize(newRightSize, rightMin, rightMax);
394
+ newLeftSize = leftSize + rightSize - newRightSize;
395
+ newSizes[leftIndex] = newLeftSize;
396
+ newSizes[rightIndex] = newRightSize;
397
+ return newSizes;
398
+ }
399
+ function useResizable({
400
+ direction,
401
+ sizes,
402
+ setSizes,
403
+ panels,
404
+ containerRef,
405
+ leftPanelIndex,
406
+ rightPanelIndex,
407
+ disabled = false,
408
+ announce,
409
+ groupLabel,
410
+ onOpenPopover
411
+ }) {
412
+ const [isDragging, setIsDragging] = useState(false);
413
+ const dragStartRef = useRef(null);
414
+ const longPressTimerRef = useRef(null);
415
+ const pointerDownTimeRef = useRef(0);
416
+ const wasLongPressRef = useRef(false);
417
+ const panelsRef = useRef(panels);
418
+ const sizesRef = useRef(sizes);
419
+ const setSizesRef = useRef(setSizes);
420
+ const handlePointerMoveRef = useRef(() => {
421
+ });
422
+ const handlePointerUpRef = useRef(() => {
423
+ });
424
+ useEffect(() => {
425
+ panelsRef.current = panels;
426
+ sizesRef.current = sizes;
427
+ setSizesRef.current = setSizes;
428
+ }, [panels, sizes, setSizes]);
429
+ const getContainerSize = useCallback(() => {
430
+ const container = containerRef.current;
431
+ if (!container) return 0;
432
+ return direction === "horizontal" ? container.offsetWidth : container.offsetHeight;
433
+ }, [containerRef, direction]);
434
+ const pixelsToPercent = useCallback(
435
+ (pixels) => {
436
+ const containerSize = getContainerSize();
437
+ if (containerSize === 0) return 0;
438
+ return pixels / containerSize * 100;
439
+ },
440
+ [getContainerSize]
441
+ );
442
+ const onPointerMove = useCallback((e) => {
443
+ handlePointerMoveRef.current(e);
444
+ }, []);
445
+ const onPointerUp = useCallback(() => {
446
+ handlePointerUpRef.current();
447
+ }, []);
448
+ const handlePointerMove = useCallback(
449
+ (event) => {
450
+ if (!dragStartRef.current || disabled) return;
451
+ const position = direction === "horizontal" ? event.clientX : event.clientY;
452
+ const delta = position - dragStartRef.current.position;
453
+ const percentDelta = pixelsToPercent(delta);
454
+ const newSizes = calculateNewSizes(
455
+ dragStartRef.current.sizes,
456
+ panelsRef.current,
457
+ leftPanelIndex,
458
+ rightPanelIndex,
459
+ percentDelta
460
+ );
461
+ setSizesRef.current(newSizes);
462
+ },
463
+ [
464
+ direction,
465
+ disabled,
466
+ leftPanelIndex,
467
+ pixelsToPercent,
468
+ rightPanelIndex
469
+ ]
470
+ );
471
+ const handlePointerUp = useCallback(() => {
472
+ if (longPressTimerRef.current) {
473
+ clearTimeout(longPressTimerRef.current);
474
+ longPressTimerRef.current = null;
475
+ }
476
+ const duration = Date.now() - pointerDownTimeRef.current;
477
+ const wasTap = duration < LONG_PRESS_THRESHOLD && !wasLongPressRef.current;
478
+ if (wasTap && onOpenPopover && !disabled) {
479
+ onOpenPopover();
480
+ }
481
+ if (isDragging) {
482
+ setIsDragging(false);
483
+ const leftPanel = panelsRef.current[leftPanelIndex];
484
+ const newSize = Math.round(sizesRef.current[leftPanelIndex] ?? 50);
485
+ if (announce && leftPanel && groupLabel) {
486
+ announce(
487
+ `${leftPanel.name} in ${groupLabel} resized to ${newSize} percent`
488
+ );
489
+ }
490
+ }
491
+ dragStartRef.current = null;
492
+ wasLongPressRef.current = false;
493
+ document.removeEventListener("pointermove", onPointerMove);
494
+ document.removeEventListener("pointerup", onPointerUp);
495
+ document.removeEventListener("pointercancel", onPointerUp);
496
+ document.body.style.cursor = "";
497
+ document.body.style.userSelect = "";
498
+ }, [
499
+ announce,
500
+ disabled,
501
+ groupLabel,
502
+ isDragging,
503
+ leftPanelIndex,
504
+ onOpenPopover,
505
+ onPointerMove,
506
+ onPointerUp
507
+ ]);
508
+ useEffect(() => {
509
+ handlePointerMoveRef.current = handlePointerMove;
510
+ handlePointerUpRef.current = handlePointerUp;
511
+ });
512
+ const handlePointerDown = useCallback(
513
+ (event) => {
514
+ if (disabled) return;
515
+ event.preventDefault();
516
+ const position = direction === "horizontal" ? event.clientX : event.clientY;
517
+ pointerDownTimeRef.current = Date.now();
518
+ wasLongPressRef.current = false;
519
+ dragStartRef.current = {
520
+ position,
521
+ sizes: [...sizes],
522
+ containerSize: getContainerSize()
523
+ };
524
+ longPressTimerRef.current = setTimeout(() => {
525
+ wasLongPressRef.current = true;
526
+ setIsDragging(true);
527
+ document.body.style.cursor = direction === "horizontal" ? "col-resize" : "row-resize";
528
+ document.body.style.userSelect = "none";
529
+ }, LONG_PRESS_THRESHOLD);
530
+ document.addEventListener("pointermove", onPointerMove);
531
+ document.addEventListener("pointerup", onPointerUp);
532
+ document.addEventListener("pointercancel", onPointerUp);
533
+ if (event.pointerType === "mouse") {
534
+ if (longPressTimerRef.current) {
535
+ clearTimeout(longPressTimerRef.current);
536
+ longPressTimerRef.current = null;
537
+ }
538
+ wasLongPressRef.current = true;
539
+ setIsDragging(true);
540
+ document.body.style.cursor = direction === "horizontal" ? "col-resize" : "row-resize";
541
+ document.body.style.userSelect = "none";
542
+ }
543
+ },
544
+ [
545
+ direction,
546
+ disabled,
547
+ getContainerSize,
548
+ onPointerMove,
549
+ onPointerUp,
550
+ sizes
551
+ ]
552
+ );
553
+ const handleKeyDown = useCallback(
554
+ (event) => {
555
+ if (disabled) return;
556
+ const step = event.shiftKey ? 10 : 1;
557
+ let delta = 0;
558
+ switch (event.key) {
559
+ case "ArrowLeft":
560
+ case "ArrowUp":
561
+ delta = -step;
562
+ break;
563
+ case "ArrowRight":
564
+ case "ArrowDown":
565
+ delta = step;
566
+ break;
567
+ case "Home": {
568
+ const leftPanel = panels[leftPanelIndex];
569
+ if (leftPanel) {
570
+ const minSize = leftPanel.collapsible ? 0 : leftPanel.minSize;
571
+ delta = minSize - (sizes[leftPanelIndex] ?? 50);
572
+ }
573
+ break;
574
+ }
575
+ case "End": {
576
+ const leftPanel = panels[leftPanelIndex];
577
+ if (leftPanel) {
578
+ delta = leftPanel.maxSize - (sizes[leftPanelIndex] ?? 50);
579
+ }
580
+ break;
581
+ }
582
+ case "Enter":
583
+ case " ":
584
+ event.preventDefault();
585
+ onOpenPopover?.();
586
+ return;
587
+ default:
588
+ return;
589
+ }
590
+ if (delta !== 0) {
591
+ event.preventDefault();
592
+ const newSizes = calculateNewSizes(
593
+ sizes,
594
+ panels,
595
+ leftPanelIndex,
596
+ rightPanelIndex,
597
+ delta
598
+ );
599
+ setSizes(newSizes);
600
+ const leftPanel = panels[leftPanelIndex];
601
+ const newSize = Math.round(newSizes[leftPanelIndex] ?? 50);
602
+ if (announce && leftPanel && groupLabel) {
603
+ announce(
604
+ `${leftPanel.name} in ${groupLabel} resized to ${newSize} percent`
605
+ );
606
+ }
607
+ }
608
+ },
609
+ [
610
+ announce,
611
+ disabled,
612
+ groupLabel,
613
+ leftPanelIndex,
614
+ onOpenPopover,
615
+ panels,
616
+ rightPanelIndex,
617
+ setSizes,
618
+ sizes
619
+ ]
620
+ );
621
+ useEffect(() => {
622
+ const moveHandler = onPointerMove;
623
+ const upHandler = onPointerUp;
624
+ return () => {
625
+ if (longPressTimerRef.current) {
626
+ clearTimeout(longPressTimerRef.current);
627
+ }
628
+ document.removeEventListener("pointermove", moveHandler);
629
+ document.removeEventListener("pointerup", upHandler);
630
+ document.removeEventListener("pointercancel", upHandler);
631
+ };
632
+ }, [onPointerMove, onPointerUp]);
633
+ return {
634
+ isDragging,
635
+ handlePointerDown,
636
+ handleKeyDown
637
+ };
638
+ }
639
+ var PRESSED_STYLES = "data-[pressed]:scale-[0.97]";
640
+ var HOVER_STYLES = "data-[hovered]:shadow-md";
641
+ var HIGH_CONTRAST_HOVER = "hc:data-[hovered]:outline hc:data-[hovered]:outline-2 hc:data-[hovered]:outline-foreground";
642
+ var HIGH_CONTRAST_PRESSED = "hc:data-[pressed]:outline hc:data-[pressed]:outline-2 hc:data-[pressed]:outline-offset-1 hc:data-[pressed]:outline-foreground";
643
+ var ButtonGroupContext = createContext(null);
644
+ ButtonGroupContext.displayName = "ButtonGroupContext";
645
+ function useButtonGroupContext() {
646
+ return useContext(ButtonGroupContext);
647
+ }
648
+ var ButtonGroupItemContext = createContext(null);
649
+ ButtonGroupItemContext.displayName = "ButtonGroupItemContext";
650
+ function useButtonGroupItemContext() {
651
+ return useContext(ButtonGroupItemContext);
652
+ }
653
+ cva("inline-flex items-center gap-0", {
654
+ variants: {
655
+ orientation: {
656
+ horizontal: "flex-row",
657
+ vertical: "flex-col w-full"
658
+ }
659
+ },
660
+ defaultVariants: {
661
+ orientation: "horizontal"
662
+ }
663
+ });
664
+ var buttonGroupItemVariants = cva("", {
665
+ variants: {
666
+ orientation: {
667
+ // min-w-[44px] ensures visual layer fills touch target width (for icon buttons)
668
+ horizontal: "min-w-[44px]",
669
+ // flex (overrides inline-flex) + min-h-[44px] makes visual layer fill touch target,
670
+ // eliminating gaps between stacked buttons in vertical orientation
671
+ vertical: "flex min-h-[44px]"
672
+ },
673
+ position: {
674
+ first: "",
675
+ middle: "",
676
+ last: "",
677
+ only: ""
678
+ // Single button - no modifications needed
679
+ }
680
+ },
681
+ compoundVariants: [
682
+ // ==========================================================================
683
+ // Horizontal Orientation
684
+ // ==========================================================================
685
+ {
686
+ orientation: "horizontal",
687
+ position: "first",
688
+ className: "rounded-r-none border-r-0"
689
+ },
690
+ {
691
+ orientation: "horizontal",
692
+ position: "middle",
693
+ className: "rounded-none border-r-0"
694
+ },
695
+ {
696
+ orientation: "horizontal",
697
+ position: "last",
698
+ className: "rounded-l-none"
699
+ },
700
+ // ==========================================================================
701
+ // Vertical Orientation
702
+ // Note: w-full is handled by Button's effectiveFullWidth for both layers
703
+ // ==========================================================================
704
+ {
705
+ orientation: "vertical",
706
+ position: "first",
707
+ className: "rounded-b-none border-b-0"
708
+ },
709
+ {
710
+ orientation: "vertical",
711
+ position: "middle",
712
+ className: "rounded-none border-b-0"
713
+ },
714
+ {
715
+ orientation: "vertical",
716
+ position: "last",
717
+ className: "rounded-t-none"
718
+ }
719
+ ],
720
+ defaultVariants: {
721
+ orientation: "horizontal",
722
+ position: "only"
723
+ }
724
+ });
725
+ cva("bg-[var(--border)]", {
726
+ variants: {
727
+ orientation: {
728
+ horizontal: "w-px h-6 mx-1",
729
+ vertical: "h-px w-full my-1"
730
+ }
731
+ },
732
+ defaultVariants: {
733
+ orientation: "horizontal"
734
+ }
735
+ });
736
+ var buttonOuterVariants = cva(
737
+ "inline-flex justify-center min-h-[44px] min-w-[44px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",
738
+ {
739
+ variants: {
740
+ fullWidth: {
741
+ true: "w-full",
742
+ false: ""
743
+ },
744
+ inVerticalGroup: {
745
+ true: "items-stretch",
746
+ false: "items-center"
747
+ }
748
+ },
749
+ defaultVariants: {
750
+ fullWidth: false,
751
+ inVerticalGroup: false
752
+ }
753
+ }
754
+ );
755
+ var buttonVisualVariants = cva(
756
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 relative cursor-pointer",
757
+ {
758
+ variants: {
759
+ variant: {
760
+ default: "bg-[var(--primary-action)] text-[var(--primary-action-foreground)] shadow-md hover:bg-[var(--primary-action-hover)] data-[pressed]:bg-[var(--primary-action)]/80",
761
+ destructive: "bg-[var(--destructive-background)] text-[var(--destructive-foreground)] shadow-md hover:bg-[var(--destructive-background)]/90 data-[pressed]:bg-[var(--destructive-background)]/80",
762
+ outline: "border border-[var(--input-border)] bg-[var(--page-background)] hover:bg-[var(--input-border)] data-[pressed]:bg-[var(--input-border)]",
763
+ secondary: "bg-[var(--secondary)] text-[var(--secondary-foreground)] shadow-md hover:bg-[var(--secondary)]/80 data-[pressed]:bg-[var(--secondary)]/70",
764
+ ghost: "hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)] data-[pressed]:bg-[var(--accent)]",
765
+ link: "text-[var(--text-link)] underline-offset-4 hover:underline data-[pressed]:text-[var(--text-link-hover)]"
766
+ },
767
+ fullWidth: {
768
+ true: "w-full",
769
+ false: ""
770
+ },
771
+ visualSize: {
772
+ default: "h-10 px-4 py-2",
773
+ sm: "h-9 rounded-md px-3 text-xs",
774
+ lg: "h-11 rounded-md px-8",
775
+ icon: "h-10 w-10",
776
+ dot: "h-5 w-5 rounded-full p-0 min-h-0 min-w-0"
777
+ },
778
+ paywall: {
779
+ true: "!bg-[var(--paywall)] !text-[var(--paywall-foreground)] !shadow-md hover:!bg-[var(--paywall)]/90 !cursor-not-allowed !border-transparent",
780
+ false: ""
781
+ }
782
+ },
783
+ defaultVariants: {
784
+ variant: "default",
785
+ visualSize: "default",
786
+ paywall: false
787
+ }
788
+ }
789
+ );
790
+ var Button = memo(forwardRef(
791
+ ({
792
+ className,
793
+ buttonVisualClassName,
794
+ variant,
795
+ size,
796
+ visualSize,
797
+ fullWidth,
798
+ loading = false,
799
+ loadingText = "Loading...",
800
+ shortcut,
801
+ children,
802
+ isDisabled,
803
+ paywall = false,
804
+ paywallRedirect,
805
+ paywallDescription,
806
+ onPress,
807
+ ...props
808
+ }, ref) => {
809
+ const paywallDescriptionId = useId();
810
+ const groupContext = useButtonGroupContext();
811
+ const itemContext = useButtonGroupItemContext();
812
+ const effectiveVariant = variant ?? groupContext?.variant ?? "default";
813
+ const effectiveSize = size ?? groupContext?.size;
814
+ const effectiveIsDisabled = isDisabled ?? groupContext?.isDisabled ?? false;
815
+ const isInVerticalGroup = groupContext?.orientation === "vertical";
816
+ const effectiveFullWidth = fullWidth || isInVerticalGroup;
817
+ const positionClassName = itemContext ? buttonGroupItemVariants({
818
+ orientation: groupContext?.orientation ?? "horizontal",
819
+ position: itemContext.position
820
+ }) : "";
821
+ const effectiveVisualSize = visualSize ?? effectiveSize ?? "default";
822
+ if (process.env.NODE_ENV !== "production") {
823
+ if ((effectiveVisualSize === "dot" || effectiveVisualSize === "icon") && !props["aria-label"] && !children) {
824
+ console.warn(
825
+ '[Button] visualSize="dot" or "icon" requires aria-label when no visible text is provided (WCAG 1.1.1)'
826
+ );
827
+ }
828
+ }
829
+ const handlePress = (e) => {
830
+ if (paywall) {
831
+ if (paywallRedirect) {
832
+ window.open(paywallRedirect, "_blank", "noopener,noreferrer");
833
+ }
834
+ return;
835
+ }
836
+ onPress?.(e);
837
+ };
838
+ const computedIsDisabled = effectiveIsDisabled || loading || void 0;
839
+ return /* @__PURE__ */ jsx(
840
+ Button$1,
841
+ {
842
+ ref,
843
+ isDisabled: computedIsDisabled,
844
+ "aria-disabled": paywall ? true : void 0,
845
+ "aria-describedby": paywall ? paywallDescriptionId : void 0,
846
+ onPress: handlePress,
847
+ className: cn(buttonOuterVariants({ fullWidth: effectiveFullWidth, inVerticalGroup: isInVerticalGroup }), className),
848
+ ...props,
849
+ children: (renderProps) => (
850
+ /* Layer 2: Visual Button */
851
+ /* @__PURE__ */ jsxs(
852
+ "span",
853
+ {
854
+ className: cn(
855
+ buttonVisualVariants({
856
+ variant: effectiveVariant,
857
+ visualSize: effectiveVisualSize,
858
+ paywall,
859
+ fullWidth: effectiveFullWidth
860
+ }),
861
+ // Position styling from ButtonGroup context (border-radius adjustments)
862
+ positionClassName,
863
+ buttonVisualClassName,
864
+ // Layer 2 interaction styles (no focus - focus ring is on Layer 1)
865
+ PRESSED_STYLES,
866
+ HOVER_STYLES,
867
+ HIGH_CONTRAST_HOVER,
868
+ HIGH_CONTRAST_PRESSED
869
+ ),
870
+ "data-pressed": renderProps.isPressed || void 0,
871
+ children: [
872
+ loading && /* @__PURE__ */ jsxs(Fragment, { children: [
873
+ /* @__PURE__ */ jsx(Loader2, { className: "motion-safe:animate-spin", "aria-hidden": "true" }),
874
+ /* @__PURE__ */ jsx("span", { className: "sr-only", "aria-live": "polite", children: loadingText })
875
+ ] }),
876
+ !loading && children,
877
+ paywall && /* @__PURE__ */ jsx(
878
+ Zap,
879
+ {
880
+ "data-testid": "zap-icon",
881
+ "aria-hidden": "true",
882
+ className: "ml-1"
883
+ }
884
+ ),
885
+ paywall && /* @__PURE__ */ jsxs("span", { id: paywallDescriptionId, className: "sr-only", children: [
886
+ "Premium feature: ",
887
+ paywallDescription || "Upgrade required to access this feature"
888
+ ] }),
889
+ renderProps.isFocusVisible && shortcut && /* @__PURE__ */ jsx("kbd", { className: "ml-auto hidden text-xs opacity-60 lg:inline", children: shortcut }),
890
+ renderProps.isPressed && /* @__PURE__ */ jsx(
891
+ "span",
892
+ {
893
+ className: "absolute inset-0 rounded-[inherit] bg-current opacity-10 motion-safe:animate-in motion-safe:zoom-in-95",
894
+ "aria-hidden": "true"
895
+ }
896
+ )
897
+ ]
898
+ }
899
+ )
900
+ )
901
+ }
902
+ );
903
+ }
904
+ ));
905
+ Button.displayName = "Button";
906
+ var DEFAULT_MAX_VALUE = 4294967295;
907
+ var DEFAULT_MIN_VALUE = 0;
908
+ var NEGATIVE_MIN_VALUE = -2147483647;
909
+ z.object({
910
+ // Value props
911
+ /** Current value (controlled mode) */
912
+ value: z.number().nullable().optional(),
913
+ /** Default value (uncontrolled mode) */
914
+ defaultValue: z.number().optional(),
915
+ // Constraint props
916
+ /** Minimum allowed value (default: 0) */
917
+ minValue: z.number().optional(),
918
+ /** Maximum allowed value (default: 4294967295 / UINT32_MAX) */
919
+ maxValue: z.number().optional(),
920
+ /** Allow negative numbers (sets minValue to -2147483647 if not explicitly set) */
921
+ allowNegative: z.boolean().optional(),
922
+ /** Step increment for stepper buttons and arrow keys (default: 1) */
923
+ step: z.number().positive().optional(),
924
+ // Formatting props
925
+ /** Intl.NumberFormat options for locale-aware formatting */
926
+ formatOptions: z.custom().optional(),
927
+ // State props
928
+ /** Whether the field is disabled */
929
+ isDisabled: z.boolean().optional(),
930
+ /** Whether the field is read-only */
931
+ isReadOnly: z.boolean().optional(),
932
+ /** Whether the field is required */
933
+ isRequired: z.boolean().optional(),
934
+ /** Whether the field is in an invalid state */
935
+ isInvalid: z.boolean().optional(),
936
+ /** Whether scroll wheel adjustment is disabled */
937
+ isWheelDisabled: z.boolean().optional(),
938
+ // Validation props
939
+ /** Custom validation function that returns an error message or null */
940
+ validate: z.function().optional(),
941
+ /** Validation behavior: 'native' for HTML5 validation, 'aria' for ARIA-only */
942
+ validationBehavior: z.enum(["native", "aria"]).default("native"),
943
+ // Display props
944
+ /** Field label (required for accessibility) */
945
+ label: z.string(),
946
+ /** Description text below the field */
947
+ description: z.string().optional(),
948
+ /** Error message string or render function */
949
+ errorMessage: z.union([z.string(), z.function()]).optional(),
950
+ // Stepper props
951
+ /** Layout for stepper buttons */
952
+ stepperLayout: z.enum(["sides", "stacked", "hidden"]).default("sides"),
953
+ /** Custom aria-label for increment button */
954
+ incrementAriaLabel: z.string().optional(),
955
+ /** Custom aria-label for decrement button */
956
+ decrementAriaLabel: z.string().optional(),
957
+ // Form props
958
+ /** Name attribute for form submission */
959
+ name: z.string().optional(),
960
+ // Variant props
961
+ /** Size variant */
962
+ size: z.enum(["sm", "default", "lg"]).default("default"),
963
+ // Event props
964
+ /** Called when the numeric value changes */
965
+ onChange: z.function().optional(),
966
+ /** Called when the field gains focus */
967
+ onFocus: z.function().optional(),
968
+ /** Called when the field loses focus */
969
+ onBlur: z.function().optional(),
970
+ /** Called when focus state changes */
971
+ onFocusChange: z.function().optional(),
972
+ // Standard props
973
+ /** Additional CSS classes */
974
+ className: z.string().optional(),
975
+ /** Whether to auto-focus on mount */
976
+ autoFocus: z.boolean().optional()
977
+ });
978
+ var numberFieldVariants = cva(
979
+ [
980
+ // Base styles
981
+ "inline-flex items-center rounded-md border",
982
+ "bg-[var(--content-background)] text-[var(--content-foreground)]",
983
+ "transition-colors duration-200",
984
+ // Focus within
985
+ "focus-within:ring-2 focus-within:ring-[var(--ring)] focus-within:ring-offset-2",
986
+ // Disabled
987
+ "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50"
988
+ ],
989
+ {
990
+ variants: {
991
+ size: {
992
+ sm: "h-9 text-sm",
993
+ default: "h-10 text-base",
994
+ lg: "h-12 text-lg"
995
+ },
996
+ isInvalid: {
997
+ true: "border-[var(--destructive)] focus-within:ring-[var(--destructive)]",
998
+ false: "border-[var(--input)] hover:border-[var(--input)]/80"
999
+ }
1000
+ },
1001
+ defaultVariants: {
1002
+ size: "default",
1003
+ isInvalid: false
1004
+ }
1005
+ }
1006
+ );
1007
+ var numberFieldInputVariants = cva(
1008
+ [
1009
+ // Base styles
1010
+ "flex-1 bg-transparent text-center tabular-nums",
1011
+ "min-w-0",
1012
+ // Allow shrinking
1013
+ // Focus
1014
+ "focus:outline-none",
1015
+ // Hide native spinners
1016
+ "[appearance:textfield]",
1017
+ "[&::-webkit-outer-spin-button]:appearance-none",
1018
+ "[&::-webkit-inner-spin-button]:appearance-none"
1019
+ ],
1020
+ {
1021
+ variants: {
1022
+ size: {
1023
+ sm: "px-2 text-sm",
1024
+ default: "px-3 text-base",
1025
+ lg: "px-4 text-lg"
1026
+ }
1027
+ },
1028
+ defaultVariants: {
1029
+ size: "default"
1030
+ }
1031
+ }
1032
+ );
1033
+ var numberFieldStepperVariants = cva(
1034
+ [
1035
+ // Base styles
1036
+ "flex items-center justify-center",
1037
+ "transition-colors duration-150",
1038
+ "select-none",
1039
+ // Hover
1040
+ "hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)]",
1041
+ // Focus
1042
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]",
1043
+ "focus-visible:ring-inset",
1044
+ // Active (pressed)
1045
+ "active:bg-[var(--accent)]/80",
1046
+ // Disabled
1047
+ "disabled:pointer-events-none disabled:opacity-50"
1048
+ ],
1049
+ {
1050
+ variants: {
1051
+ size: {
1052
+ sm: "min-w-8 min-h-8 text-sm",
1053
+ default: "min-w-10 min-h-10 text-base",
1054
+ lg: "min-w-12 min-h-12 text-lg"
1055
+ },
1056
+ position: {
1057
+ left: "rounded-l-md border-r border-[var(--input)]",
1058
+ right: "rounded-r-md border-l border-[var(--input)]",
1059
+ top: "rounded-tr-md border-b border-l border-[var(--input)] h-1/2",
1060
+ bottom: "rounded-br-md border-l border-[var(--input)] h-1/2"
1061
+ }
1062
+ },
1063
+ defaultVariants: {
1064
+ size: "default"
1065
+ }
1066
+ }
1067
+ );
1068
+ var numberFieldLabelVariants = cva(
1069
+ [
1070
+ "block font-medium text-[var(--content-foreground)]",
1071
+ "mb-1.5",
1072
+ // Required indicator
1073
+ 'data-[required]:after:content-["*"] data-[required]:after:ml-0.5',
1074
+ "data-[required]:after:text-[var(--destructive)]"
1075
+ ],
1076
+ {
1077
+ variants: {
1078
+ size: {
1079
+ sm: "text-sm",
1080
+ default: "text-sm",
1081
+ lg: "text-base"
1082
+ }
1083
+ },
1084
+ defaultVariants: {
1085
+ size: "default"
1086
+ }
1087
+ }
1088
+ );
1089
+ var numberFieldDescriptionVariants = cva(
1090
+ [
1091
+ "text-[var(--menu-muted)]",
1092
+ "mt-1"
1093
+ ],
1094
+ {
1095
+ variants: {
1096
+ size: {
1097
+ sm: "text-xs",
1098
+ default: "text-sm",
1099
+ lg: "text-base"
1100
+ }
1101
+ },
1102
+ defaultVariants: {
1103
+ size: "default"
1104
+ }
1105
+ }
1106
+ );
1107
+ var numberFieldErrorVariants = cva(
1108
+ [
1109
+ "flex items-center gap-1",
1110
+ "text-[var(--destructive)]",
1111
+ "mt-1"
1112
+ ],
1113
+ {
1114
+ variants: {
1115
+ size: {
1116
+ sm: "text-xs",
1117
+ default: "text-sm",
1118
+ lg: "text-base"
1119
+ }
1120
+ },
1121
+ defaultVariants: {
1122
+ size: "default"
1123
+ }
1124
+ }
1125
+ );
1126
+ var NumberField = forwardRef(
1127
+ ({
1128
+ // Display props
1129
+ label,
1130
+ description,
1131
+ errorMessage,
1132
+ // Variant props
1133
+ size = "default",
1134
+ stepperLayout = "sides",
1135
+ // Custom props
1136
+ allowNegative = false,
1137
+ incrementAriaLabel,
1138
+ decrementAriaLabel,
1139
+ // Constraint props (apply defaults)
1140
+ minValue,
1141
+ maxValue,
1142
+ // Standard props
1143
+ className,
1144
+ isInvalid,
1145
+ isRequired,
1146
+ isDisabled,
1147
+ isReadOnly,
1148
+ // All other props go to AriaNumberField
1149
+ ...props
1150
+ }, ref) => {
1151
+ const effectiveMinValue = minValue ?? (allowNegative ? NEGATIVE_MIN_VALUE : DEFAULT_MIN_VALUE);
1152
+ const effectiveMaxValue = maxValue ?? DEFAULT_MAX_VALUE;
1153
+ const showSteppers = stepperLayout !== "hidden" && !isReadOnly;
1154
+ const isStackedLayout = stepperLayout === "stacked";
1155
+ return /* @__PURE__ */ jsxs(
1156
+ NumberField$1,
1157
+ {
1158
+ ref,
1159
+ className: cn("group flex flex-col", className),
1160
+ minValue: effectiveMinValue,
1161
+ maxValue: effectiveMaxValue,
1162
+ isInvalid,
1163
+ isRequired,
1164
+ isDisabled,
1165
+ isReadOnly,
1166
+ ...props,
1167
+ children: [
1168
+ /* @__PURE__ */ jsx(
1169
+ Label,
1170
+ {
1171
+ className: cn(numberFieldLabelVariants({ size })),
1172
+ "data-required": isRequired || void 0,
1173
+ children: label
1174
+ }
1175
+ ),
1176
+ /* @__PURE__ */ jsxs(
1177
+ Group,
1178
+ {
1179
+ className: cn(
1180
+ numberFieldVariants({
1181
+ size,
1182
+ isInvalid: isInvalid ?? false
1183
+ }),
1184
+ isStackedLayout && "pr-0"
1185
+ ),
1186
+ children: [
1187
+ showSteppers && !isStackedLayout && /* @__PURE__ */ jsx(
1188
+ Button,
1189
+ {
1190
+ slot: "decrement",
1191
+ variant: "ghost",
1192
+ className: "!min-h-0 !min-w-0",
1193
+ buttonVisualClassName: cn(
1194
+ numberFieldStepperVariants({
1195
+ size,
1196
+ position: "left"
1197
+ })
1198
+ ),
1199
+ "aria-label": decrementAriaLabel ?? "Decrease value",
1200
+ children: /* @__PURE__ */ jsx(Minus, { className: "h-4 w-4", "aria-hidden": "true" })
1201
+ }
1202
+ ),
1203
+ /* @__PURE__ */ jsx(
1204
+ Input,
1205
+ {
1206
+ className: cn(numberFieldInputVariants({ size }))
1207
+ }
1208
+ ),
1209
+ showSteppers && isStackedLayout && /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full", children: [
1210
+ /* @__PURE__ */ jsx(
1211
+ Button,
1212
+ {
1213
+ slot: "increment",
1214
+ variant: "ghost",
1215
+ className: "!min-h-0 !min-w-0",
1216
+ buttonVisualClassName: cn(
1217
+ numberFieldStepperVariants({
1218
+ size,
1219
+ position: "top"
1220
+ })
1221
+ ),
1222
+ "aria-label": incrementAriaLabel ?? "Increase value",
1223
+ children: /* @__PURE__ */ jsx(Plus, { className: "h-3 w-3", "aria-hidden": "true" })
1224
+ }
1225
+ ),
1226
+ /* @__PURE__ */ jsx(
1227
+ Button,
1228
+ {
1229
+ slot: "decrement",
1230
+ variant: "ghost",
1231
+ className: "!min-h-0 !min-w-0",
1232
+ buttonVisualClassName: cn(
1233
+ numberFieldStepperVariants({
1234
+ size,
1235
+ position: "bottom"
1236
+ })
1237
+ ),
1238
+ "aria-label": decrementAriaLabel ?? "Decrease value",
1239
+ children: /* @__PURE__ */ jsx(Minus, { className: "h-3 w-3", "aria-hidden": "true" })
1240
+ }
1241
+ )
1242
+ ] }),
1243
+ showSteppers && !isStackedLayout && /* @__PURE__ */ jsx(
1244
+ Button,
1245
+ {
1246
+ slot: "increment",
1247
+ variant: "ghost",
1248
+ className: "!min-h-0 !min-w-0",
1249
+ buttonVisualClassName: cn(
1250
+ numberFieldStepperVariants({
1251
+ size,
1252
+ position: "right"
1253
+ })
1254
+ ),
1255
+ "aria-label": incrementAriaLabel ?? "Increase value",
1256
+ children: /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4", "aria-hidden": "true" })
1257
+ }
1258
+ )
1259
+ ]
1260
+ }
1261
+ ),
1262
+ description && /* @__PURE__ */ jsx(
1263
+ Text,
1264
+ {
1265
+ slot: "description",
1266
+ className: cn(numberFieldDescriptionVariants({ size })),
1267
+ children: description
1268
+ }
1269
+ ),
1270
+ /* @__PURE__ */ jsx(FieldError, { className: cn(numberFieldErrorVariants({ size })), children: errorMessage })
1271
+ ]
1272
+ }
1273
+ );
1274
+ }
1275
+ );
1276
+ NumberField.displayName = "NumberField";
1277
+ var ResizablePopover = forwardRef(
1278
+ function ResizablePopover2({
1279
+ isOpen,
1280
+ onOpenChange,
1281
+ groupLabel,
1282
+ leftPanel,
1283
+ rightPanel,
1284
+ leftSize,
1285
+ rightSize,
1286
+ onSizesChange,
1287
+ presets,
1288
+ triggerRef,
1289
+ direction
1290
+ }, _ref) {
1291
+ const [originalSizes, setOriginalSizes] = useState({ left: leftSize, right: rightSize });
1292
+ const wasOpenRef = useRef(false);
1293
+ useEffect(() => {
1294
+ if (isOpen && !wasOpenRef.current) {
1295
+ setOriginalSizes({ left: leftSize, right: rightSize });
1296
+ }
1297
+ wasOpenRef.current = isOpen;
1298
+ }, [isOpen, leftSize, rightSize]);
1299
+ const handleLeftChange = useCallback(
1300
+ (value) => {
1301
+ if (value === null) return;
1302
+ const newLeft = Math.max(
1303
+ leftPanel.collapsible ? 0 : leftPanel.minSize,
1304
+ Math.min(leftPanel.maxSize, value)
1305
+ );
1306
+ const newRight = 100 - newLeft;
1307
+ const rightMin = rightPanel.collapsible ? 0 : rightPanel.minSize;
1308
+ const rightMax = rightPanel.maxSize;
1309
+ if (newRight < rightMin || newRight > rightMax) {
1310
+ return;
1311
+ }
1312
+ onSizesChange(newLeft, newRight);
1313
+ },
1314
+ [leftPanel, rightPanel, onSizesChange]
1315
+ );
1316
+ const handleRightChange = useCallback(
1317
+ (value) => {
1318
+ if (value === null) return;
1319
+ const newRight = Math.max(
1320
+ rightPanel.collapsible ? 0 : rightPanel.minSize,
1321
+ Math.min(rightPanel.maxSize, value)
1322
+ );
1323
+ const newLeft = 100 - newRight;
1324
+ const leftMin = leftPanel.collapsible ? 0 : leftPanel.minSize;
1325
+ const leftMax = leftPanel.maxSize;
1326
+ if (newLeft < leftMin || newLeft > leftMax) {
1327
+ return;
1328
+ }
1329
+ onSizesChange(newLeft, newRight);
1330
+ },
1331
+ [leftPanel, rightPanel, onSizesChange]
1332
+ );
1333
+ const handlePreset = useCallback(
1334
+ (preset) => {
1335
+ const leftSize2 = preset.sizes[0];
1336
+ const rightSize2 = preset.sizes[1];
1337
+ if (leftSize2 !== void 0 && rightSize2 !== void 0) {
1338
+ onSizesChange(leftSize2, rightSize2);
1339
+ }
1340
+ },
1341
+ [onSizesChange]
1342
+ );
1343
+ const handleCancel = useCallback(() => {
1344
+ onSizesChange(originalSizes.left, originalSizes.right);
1345
+ onOpenChange(false);
1346
+ }, [onSizesChange, onOpenChange, originalSizes]);
1347
+ const handleClose = useCallback(() => {
1348
+ onOpenChange(false);
1349
+ }, [onOpenChange]);
1350
+ if (!isOpen) return null;
1351
+ const placement = direction === "horizontal" ? "bottom" : "right";
1352
+ return /* @__PURE__ */ jsxs(DialogTrigger, { isOpen, onOpenChange, children: [
1353
+ /* @__PURE__ */ jsx(Button$1, { className: "sr-only", children: "Open resize controls" }),
1354
+ /* @__PURE__ */ jsx(
1355
+ Popover,
1356
+ {
1357
+ triggerRef,
1358
+ placement,
1359
+ offset: 8,
1360
+ className: cn(
1361
+ "w-72",
1362
+ "rounded-lg border border-[var(--border)]",
1363
+ "bg-[var(--popover)] text-[var(--popover-foreground)]",
1364
+ "shadow-lg",
1365
+ "outline-none",
1366
+ "animate-in fade-in-0 zoom-in-95",
1367
+ "data-[exiting]:animate-out data-[exiting]:fade-out-0 data-[exiting]:zoom-out-95"
1368
+ ),
1369
+ children: /* @__PURE__ */ jsxs(Dialog, { className: "outline-none", children: [
1370
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b border-[var(--border)] px-4 py-3", children: [
1371
+ /* @__PURE__ */ jsxs("h3", { className: "text-sm font-medium", children: [
1372
+ "Resize: ",
1373
+ groupLabel
1374
+ ] }),
1375
+ /* @__PURE__ */ jsx(
1376
+ Button$1,
1377
+ {
1378
+ onPress: handleClose,
1379
+ className: cn(
1380
+ "inline-flex items-center justify-center rounded-md",
1381
+ "min-h-[44px] min-w-[44px]",
1382
+ "text-[var(--menu-muted)]",
1383
+ "hover:bg-[var(--accent)] hover:text-[var(--accent-foreground)]",
1384
+ "focus-visible:outline-none focus-visible:ring-2",
1385
+ "focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2"
1386
+ ),
1387
+ "aria-label": "Close",
1388
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
1389
+ }
1390
+ )
1391
+ ] }),
1392
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4 px-4 py-4", children: [
1393
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
1394
+ NumberField,
1395
+ {
1396
+ label: `${leftPanel.name} (%)`,
1397
+ value: Math.round(leftSize),
1398
+ onChange: handleLeftChange,
1399
+ minValue: leftPanel.collapsible ? 0 : leftPanel.minSize,
1400
+ maxValue: leftPanel.maxSize,
1401
+ step: 1,
1402
+ stepperLayout: "sides"
1403
+ }
1404
+ ) }),
1405
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
1406
+ NumberField,
1407
+ {
1408
+ label: `${rightPanel.name} (%)`,
1409
+ value: Math.round(rightSize),
1410
+ onChange: handleRightChange,
1411
+ minValue: rightPanel.collapsible ? 0 : rightPanel.minSize,
1412
+ maxValue: rightPanel.maxSize,
1413
+ step: 1,
1414
+ stepperLayout: "sides"
1415
+ }
1416
+ ) }),
1417
+ presets && presets.length > 0 && /* @__PURE__ */ jsxs("div", { className: "border-t border-[var(--border)] pt-4", children: [
1418
+ /* @__PURE__ */ jsx("div", { className: "mb-2 text-xs font-medium text-[var(--menu-muted)]", children: "Presets" }),
1419
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: presets.map((preset, index) => /* @__PURE__ */ jsx(
1420
+ Button,
1421
+ {
1422
+ variant: "outline",
1423
+ size: "sm",
1424
+ onPress: () => handlePreset(preset),
1425
+ children: preset.label
1426
+ },
1427
+ index
1428
+ )) })
1429
+ ] })
1430
+ ] }),
1431
+ /* @__PURE__ */ jsx("div", { className: "flex justify-end border-t border-[var(--border)] px-4 py-3", children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", onPress: handleCancel, children: "Cancel" }) })
1432
+ ] })
1433
+ }
1434
+ )
1435
+ ] });
1436
+ }
1437
+ );
1438
+ ResizablePopover.displayName = "ResizablePopover";
1439
+ var ResizableHandle = forwardRef(
1440
+ function ResizableHandle2({ withHandle = true, presets, disabled = false, className }, ref) {
1441
+ const {
1442
+ direction,
1443
+ groupLabel,
1444
+ sizes,
1445
+ setSizes,
1446
+ panels,
1447
+ announce,
1448
+ containerRef
1449
+ } = useResizableContext();
1450
+ const internalRef = useRef(null);
1451
+ const handleRef = ref || internalRef;
1452
+ const [handleIndex, setHandleIndex] = useState(0);
1453
+ useEffect(() => {
1454
+ const handle = handleRef.current;
1455
+ const container = containerRef.current;
1456
+ if (!handle || !container) return;
1457
+ const handles = container.querySelectorAll('[role="slider"]');
1458
+ let index = 0;
1459
+ handles.forEach((h, i) => {
1460
+ if (h === handle) {
1461
+ index = i;
1462
+ }
1463
+ });
1464
+ setHandleIndex(index);
1465
+ }, [containerRef, handleRef]);
1466
+ const leftPanelIndex = handleIndex;
1467
+ const rightPanelIndex = handleIndex + 1;
1468
+ const leftPanel = panels[leftPanelIndex];
1469
+ const rightPanel = panels[rightPanelIndex];
1470
+ const leftSize = sizes[leftPanelIndex] ?? 50;
1471
+ const rightSize = sizes[rightPanelIndex] ?? 50;
1472
+ const [isPopoverOpen, setIsPopoverOpen] = useState(false);
1473
+ const handlePopoverSizesChange = useCallback(
1474
+ (newLeftSize, newRightSize) => {
1475
+ const newSizes = [...sizes];
1476
+ newSizes[leftPanelIndex] = newLeftSize;
1477
+ newSizes[rightPanelIndex] = newRightSize;
1478
+ setSizes(newSizes);
1479
+ },
1480
+ [sizes, setSizes, leftPanelIndex, rightPanelIndex]
1481
+ );
1482
+ const { isDragging, handlePointerDown, handleKeyDown } = useResizable({
1483
+ direction,
1484
+ sizes,
1485
+ setSizes,
1486
+ panels,
1487
+ containerRef,
1488
+ leftPanelIndex,
1489
+ rightPanelIndex,
1490
+ disabled,
1491
+ announce,
1492
+ groupLabel,
1493
+ onOpenPopover: () => setIsPopoverOpen(true)
1494
+ });
1495
+ const ariaLabel = leftPanel && rightPanel ? `Resize handle between ${leftPanel.name} and ${rightPanel.name} in ${groupLabel}` : `Resize handle in ${groupLabel}`;
1496
+ const GripIcon = direction === "horizontal" ? GripVertical : GripHorizontal;
1497
+ const leftPanelInfo = leftPanel ?? {
1498
+ name: "Panel 1",
1499
+ minSize: DEFAULT_MIN_SIZE,
1500
+ maxSize: DEFAULT_MAX_SIZE,
1501
+ collapsible: false
1502
+ };
1503
+ const rightPanelInfo = rightPanel ?? {
1504
+ name: "Panel 2",
1505
+ minSize: DEFAULT_MIN_SIZE,
1506
+ maxSize: DEFAULT_MAX_SIZE,
1507
+ collapsible: false
1508
+ };
1509
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1510
+ /* @__PURE__ */ jsx(
1511
+ "div",
1512
+ {
1513
+ ref: handleRef,
1514
+ role: "slider",
1515
+ tabIndex: disabled ? -1 : 0,
1516
+ "aria-label": ariaLabel,
1517
+ "aria-valuenow": Math.round(leftSize),
1518
+ "aria-valuemin": leftPanel?.collapsible ? 0 : leftPanel?.minSize ?? 0,
1519
+ "aria-valuemax": leftPanel?.maxSize ?? 100,
1520
+ "aria-orientation": direction,
1521
+ "aria-disabled": disabled,
1522
+ "data-direction": direction,
1523
+ "data-dragging": isDragging,
1524
+ "data-disabled": disabled,
1525
+ onPointerDown: handlePointerDown,
1526
+ onKeyDown: handleKeyDown,
1527
+ className: cn(
1528
+ resizableHandleVariants({
1529
+ direction,
1530
+ disabled,
1531
+ isDragging
1532
+ }),
1533
+ className
1534
+ ),
1535
+ children: withHandle && /* @__PURE__ */ jsx(
1536
+ "div",
1537
+ {
1538
+ className: cn(resizableGripVariants({ direction })),
1539
+ "aria-hidden": "true",
1540
+ children: /* @__PURE__ */ jsx(GripIcon, { className: "h-4 w-4" })
1541
+ }
1542
+ )
1543
+ }
1544
+ ),
1545
+ /* @__PURE__ */ jsx(
1546
+ ResizablePopover,
1547
+ {
1548
+ isOpen: isPopoverOpen,
1549
+ onOpenChange: setIsPopoverOpen,
1550
+ groupLabel,
1551
+ leftPanel: leftPanelInfo,
1552
+ rightPanel: rightPanelInfo,
1553
+ leftSize,
1554
+ rightSize,
1555
+ onSizesChange: handlePopoverSizesChange,
1556
+ presets,
1557
+ triggerRef: handleRef,
1558
+ direction
1559
+ }
1560
+ )
1561
+ ] });
1562
+ }
1563
+ );
1564
+ ResizableHandle.displayName = "ResizableHandle";
1565
+
1566
+ export { DEFAULT_MAX_SIZE, DEFAULT_MIN_SIZE, LONG_PRESS_THRESHOLD, ResizableHandle, ResizableHandlePropsSchema, ResizablePanel, ResizablePanelGroup, ResizablePanelGroupPropsSchema, ResizablePanelPropsSchema, ResizePresetSchema, resizableGripVariants, resizableHandleVariants, useResizableContext };
7
1567
  //# sourceMappingURL=index.mjs.map
8
1568
  //# sourceMappingURL=index.mjs.map