@orioncactuscorp/ui 1.0.0

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 (454) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +273 -0
  3. package/dist/components/Accordion/Accordion.css +1 -0
  4. package/dist/components/Accordion/Accordion.js +320 -0
  5. package/dist/components/Accordion/Accordion.module.scss.js +31 -0
  6. package/dist/components/Accordion.d.ts +6 -0
  7. package/dist/components/Accordion.js +9 -0
  8. package/dist/components/ActionArea/ActionArea.css +1 -0
  9. package/dist/components/ActionArea/ActionArea.js +158 -0
  10. package/dist/components/ActionArea/ActionArea.module.scss.js +9 -0
  11. package/dist/components/ActionArea.d.ts +6 -0
  12. package/dist/components/ActionArea.js +6 -0
  13. package/dist/components/Alert/Alert.css +1 -0
  14. package/dist/components/Alert/Alert.js +293 -0
  15. package/dist/components/Alert/Alert.module.scss.js +21 -0
  16. package/dist/components/Alert.d.ts +6 -0
  17. package/dist/components/Alert.js +10 -0
  18. package/dist/components/Background/Background.css +1 -0
  19. package/dist/components/Background/Background.js +45 -0
  20. package/dist/components/Background/Background.module.scss.js +21 -0
  21. package/dist/components/Background.d.ts +6 -0
  22. package/dist/components/Background.js +4 -0
  23. package/dist/components/BackgroundIconButton/BackgroundIconButton.css +1 -0
  24. package/dist/components/BackgroundIconButton/BackgroundIconButton.js +61 -0
  25. package/dist/components/BackgroundIconButton/BackgroundIconButton.module.scss.js +13 -0
  26. package/dist/components/BackgroundIconButton.d.ts +6 -0
  27. package/dist/components/BackgroundIconButton.js +4 -0
  28. package/dist/components/Badge/Badge.css +1 -0
  29. package/dist/components/Badge/Badge.js +34 -0
  30. package/dist/components/Badge/Badge.module.scss.js +17 -0
  31. package/dist/components/Badge.d.ts +6 -0
  32. package/dist/components/Badge.js +4 -0
  33. package/dist/components/Button/Button.css +1 -0
  34. package/dist/components/Button/Button.js +151 -0
  35. package/dist/components/Button/Button.module.scss.js +29 -0
  36. package/dist/components/Button.d.ts +6 -0
  37. package/dist/components/Button.js +4 -0
  38. package/dist/components/Cell/Cell.css +1 -0
  39. package/dist/components/Cell/Cell.js +129 -0
  40. package/dist/components/Cell/Cell.module.scss.js +17 -0
  41. package/dist/components/Cell.d.ts +6 -0
  42. package/dist/components/Cell.js +5 -0
  43. package/dist/components/CheckMark/CheckMark.css +1 -0
  44. package/dist/components/CheckMark/CheckMark.js +44 -0
  45. package/dist/components/CheckMark/CheckMark.module.scss.js +7 -0
  46. package/dist/components/CheckMark.d.ts +6 -0
  47. package/dist/components/CheckMark.js +4 -0
  48. package/dist/components/Checkbox/Checkbox.css +1 -0
  49. package/dist/components/Checkbox/Checkbox.js +82 -0
  50. package/dist/components/Checkbox/Checkbox.module.scss.js +11 -0
  51. package/dist/components/Checkbox.d.ts +6 -0
  52. package/dist/components/Checkbox.js +4 -0
  53. package/dist/components/Divider/Divider.css +1 -0
  54. package/dist/components/Divider/Divider.js +41 -0
  55. package/dist/components/Divider/Divider.module.scss.js +17 -0
  56. package/dist/components/Divider.d.ts +6 -0
  57. package/dist/components/Divider.js +4 -0
  58. package/dist/components/Field/Field.css +1 -0
  59. package/dist/components/Field/Field.js +179 -0
  60. package/dist/components/Field/Field.module.scss.js +17 -0
  61. package/dist/components/Field/useFieldControlOverlayMetrics.js +44 -0
  62. package/dist/components/Field.d.ts +6 -0
  63. package/dist/components/Field.js +10 -0
  64. package/dist/components/Fieldset/Fieldset.css +1 -0
  65. package/dist/components/Fieldset/Fieldset.js +97 -0
  66. package/dist/components/Fieldset/Fieldset.module.scss.js +11 -0
  67. package/dist/components/Fieldset.d.ts +6 -0
  68. package/dist/components/Fieldset.js +8 -0
  69. package/dist/components/IconButton/IconButton.css +1 -0
  70. package/dist/components/IconButton/IconButton.js +49 -0
  71. package/dist/components/IconButton/IconButton.module.scss.js +11 -0
  72. package/dist/components/IconButton.d.ts +6 -0
  73. package/dist/components/IconButton.js +4 -0
  74. package/dist/components/Interaction/Interaction.css +1 -0
  75. package/dist/components/Interaction/Interaction.js +23 -0
  76. package/dist/components/Interaction/Interaction.module.scss.js +11 -0
  77. package/dist/components/Interaction.d.ts +6 -0
  78. package/dist/components/Interaction.js +4 -0
  79. package/dist/components/Loading/Loading.css +1 -0
  80. package/dist/components/Loading/Loading.js +47 -0
  81. package/dist/components/Loading/Loading.module.scss.js +21 -0
  82. package/dist/components/Loading.d.ts +6 -0
  83. package/dist/components/Loading.js +4 -0
  84. package/dist/components/Menu/Menu.css +1 -0
  85. package/dist/components/Menu/Menu.js +238 -0
  86. package/dist/components/Menu/Menu.module.scss.js +31 -0
  87. package/dist/components/Menu.d.ts +6 -0
  88. package/dist/components/Menu.js +9 -0
  89. package/dist/components/Modal/Modal.css +1 -0
  90. package/dist/components/Modal/Modal.js +628 -0
  91. package/dist/components/Modal/Modal.module.scss.js +48 -0
  92. package/dist/components/Modal/contexts.js +14 -0
  93. package/dist/components/Modal/modalScrollArbitration.js +134 -0
  94. package/dist/components/Modal/snapPoints.js +79 -0
  95. package/dist/components/Modal/useControllableState.js +17 -0
  96. package/dist/components/Modal/useElementSize.js +23 -0
  97. package/dist/components/Modal/useModalDrag.js +1498 -0
  98. package/dist/components/Modal/useModalPlacement.js +26 -0
  99. package/dist/components/Modal/useModalStackDepth.js +41 -0
  100. package/dist/components/Modal.d.ts +6 -0
  101. package/dist/components/Modal.js +11 -0
  102. package/dist/components/Radio/Radio.css +1 -0
  103. package/dist/components/Radio/Radio.js +68 -0
  104. package/dist/components/Radio/Radio.module.scss.js +11 -0
  105. package/dist/components/Radio.d.ts +6 -0
  106. package/dist/components/Radio.js +4 -0
  107. package/dist/components/ScrollArea/ScrollArea.css +1 -0
  108. package/dist/components/ScrollArea/ScrollArea.js +541 -0
  109. package/dist/components/ScrollArea/ScrollArea.module.scss.js +17 -0
  110. package/dist/components/ScrollArea/contexts.js +7 -0
  111. package/dist/components/ScrollArea.d.ts +6 -0
  112. package/dist/components/ScrollArea.js +8 -0
  113. package/dist/components/SectionHeader/SectionHeader.css +1 -0
  114. package/dist/components/SectionHeader/SectionHeader.js +48 -0
  115. package/dist/components/SectionHeader/SectionHeader.module.scss.js +7 -0
  116. package/dist/components/SectionHeader.d.ts +6 -0
  117. package/dist/components/SectionHeader.js +4 -0
  118. package/dist/components/Select/Select.css +1 -0
  119. package/dist/components/Select/Select.js +67 -0
  120. package/dist/components/Select/Select.module.scss.js +9 -0
  121. package/dist/components/Select/SelectContent.css +1 -0
  122. package/dist/components/Select/SelectContent.js +26 -0
  123. package/dist/components/Select/SelectContent.module.scss.js +15 -0
  124. package/dist/components/Select.d.ts +6 -0
  125. package/dist/components/Select.js +6 -0
  126. package/dist/components/SvgIcon.d.ts +6 -0
  127. package/dist/components/SvgIcon.js +4 -0
  128. package/dist/components/Switch/Switch.css +1 -0
  129. package/dist/components/Switch/Switch.js +46 -0
  130. package/dist/components/Switch/Switch.module.scss.js +8 -0
  131. package/dist/components/Switch.d.ts +6 -0
  132. package/dist/components/Switch.js +4 -0
  133. package/dist/components/TextArea/TextArea.css +1 -0
  134. package/dist/components/TextArea/TextArea.js +105 -0
  135. package/dist/components/TextArea/TextArea.module.scss.js +9 -0
  136. package/dist/components/TextArea/TextAreaContent.css +1 -0
  137. package/dist/components/TextArea/TextAreaContent.js +26 -0
  138. package/dist/components/TextArea/TextAreaContent.module.scss.js +15 -0
  139. package/dist/components/TextArea.d.ts +6 -0
  140. package/dist/components/TextArea.js +6 -0
  141. package/dist/components/TextButton/TextButton.css +1 -0
  142. package/dist/components/TextButton/TextButton.js +74 -0
  143. package/dist/components/TextButton/TextButton.module.scss.js +15 -0
  144. package/dist/components/TextButton.d.ts +6 -0
  145. package/dist/components/TextButton.js +4 -0
  146. package/dist/components/TextInput/TextInput.css +1 -0
  147. package/dist/components/TextInput/TextInput.js +69 -0
  148. package/dist/components/TextInput/TextInput.module.scss.js +9 -0
  149. package/dist/components/TextInput/TextInputContent.css +1 -0
  150. package/dist/components/TextInput/TextInputContent.js +26 -0
  151. package/dist/components/TextInput/TextInputContent.module.scss.js +15 -0
  152. package/dist/components/TextInput.d.ts +6 -0
  153. package/dist/components/TextInput.js +6 -0
  154. package/dist/components/Tooltip/Tooltip.css +1 -0
  155. package/dist/components/Tooltip/Tooltip.js +123 -0
  156. package/dist/components/Tooltip/Tooltip.module.scss.js +9 -0
  157. package/dist/components/Tooltip.d.ts +6 -0
  158. package/dist/components/Tooltip.js +8 -0
  159. package/dist/components/internal/slot.js +10 -0
  160. package/dist/foundations/atomic.css +1 -0
  161. package/dist/foundations/breakpoint.css +1 -0
  162. package/dist/foundations/color.global.css +1 -0
  163. package/dist/foundations/color.theme.dark.css +1 -0
  164. package/dist/foundations/color.theme.light.css +1 -0
  165. package/dist/foundations/motion.css +1 -0
  166. package/dist/foundations/reset.css +1 -0
  167. package/dist/foundations/space.css +1 -0
  168. package/dist/foundations/typo.css +1 -0
  169. package/dist/foundations/zindex.css +1 -0
  170. package/dist/foundations.css +11 -0
  171. package/dist/index.d.ts +2 -0
  172. package/dist/index.js +102 -0
  173. package/dist/react/motion.d.ts +6 -0
  174. package/dist/react/motion.js +176 -0
  175. package/dist/react/spring.d.ts +2 -0
  176. package/dist/react/spring.js +87 -0
  177. package/dist/reset.css +2 -0
  178. package/dist/styles.css +41 -0
  179. package/dist/ui/src/components/Accordion/Accordion.d.ts +9 -0
  180. package/dist/ui/src/components/Accordion/Accordion.d.ts.map +1 -0
  181. package/dist/ui/src/components/Accordion/index.d.ts +3 -0
  182. package/dist/ui/src/components/Accordion/index.d.ts.map +1 -0
  183. package/dist/ui/src/components/Accordion/types.d.ts +39 -0
  184. package/dist/ui/src/components/Accordion/types.d.ts.map +1 -0
  185. package/dist/ui/src/components/ActionArea/ActionArea.d.ts +8 -0
  186. package/dist/ui/src/components/ActionArea/ActionArea.d.ts.map +1 -0
  187. package/dist/ui/src/components/ActionArea/index.d.ts +3 -0
  188. package/dist/ui/src/components/ActionArea/index.d.ts.map +1 -0
  189. package/dist/ui/src/components/ActionArea/types.d.ts +34 -0
  190. package/dist/ui/src/components/ActionArea/types.d.ts.map +1 -0
  191. package/dist/ui/src/components/Alert/Alert.d.ts +17 -0
  192. package/dist/ui/src/components/Alert/Alert.d.ts.map +1 -0
  193. package/dist/ui/src/components/Alert/index.d.ts +3 -0
  194. package/dist/ui/src/components/Alert/index.d.ts.map +1 -0
  195. package/dist/ui/src/components/Alert/types.d.ts +43 -0
  196. package/dist/ui/src/components/Alert/types.d.ts.map +1 -0
  197. package/dist/ui/src/components/Background/Background.d.ts +4 -0
  198. package/dist/ui/src/components/Background/Background.d.ts.map +1 -0
  199. package/dist/ui/src/components/Background/index.d.ts +3 -0
  200. package/dist/ui/src/components/Background/index.d.ts.map +1 -0
  201. package/dist/ui/src/components/Background/types.d.ts +17 -0
  202. package/dist/ui/src/components/Background/types.d.ts.map +1 -0
  203. package/dist/ui/src/components/BackgroundIconButton/BackgroundIconButton.d.ts +4 -0
  204. package/dist/ui/src/components/BackgroundIconButton/BackgroundIconButton.d.ts.map +1 -0
  205. package/dist/ui/src/components/BackgroundIconButton/index.d.ts +3 -0
  206. package/dist/ui/src/components/BackgroundIconButton/index.d.ts.map +1 -0
  207. package/dist/ui/src/components/BackgroundIconButton/types.d.ts +16 -0
  208. package/dist/ui/src/components/BackgroundIconButton/types.d.ts.map +1 -0
  209. package/dist/ui/src/components/Badge/Badge.d.ts +4 -0
  210. package/dist/ui/src/components/Badge/Badge.d.ts.map +1 -0
  211. package/dist/ui/src/components/Badge/index.d.ts +3 -0
  212. package/dist/ui/src/components/Badge/index.d.ts.map +1 -0
  213. package/dist/ui/src/components/Badge/types.d.ts +9 -0
  214. package/dist/ui/src/components/Badge/types.d.ts.map +1 -0
  215. package/dist/ui/src/components/Button/Button.d.ts +4 -0
  216. package/dist/ui/src/components/Button/Button.d.ts.map +1 -0
  217. package/dist/ui/src/components/Button/index.d.ts +3 -0
  218. package/dist/ui/src/components/Button/index.d.ts.map +1 -0
  219. package/dist/ui/src/components/Button/types.d.ts +30 -0
  220. package/dist/ui/src/components/Button/types.d.ts.map +1 -0
  221. package/dist/ui/src/components/Cell/Cell.d.ts +5 -0
  222. package/dist/ui/src/components/Cell/Cell.d.ts.map +1 -0
  223. package/dist/ui/src/components/Cell/index.d.ts +3 -0
  224. package/dist/ui/src/components/Cell/index.d.ts.map +1 -0
  225. package/dist/ui/src/components/Cell/types.d.ts +23 -0
  226. package/dist/ui/src/components/Cell/types.d.ts.map +1 -0
  227. package/dist/ui/src/components/CheckMark/CheckMark.d.ts +4 -0
  228. package/dist/ui/src/components/CheckMark/CheckMark.d.ts.map +1 -0
  229. package/dist/ui/src/components/CheckMark/index.d.ts +3 -0
  230. package/dist/ui/src/components/CheckMark/index.d.ts.map +1 -0
  231. package/dist/ui/src/components/CheckMark/types.d.ts +6 -0
  232. package/dist/ui/src/components/CheckMark/types.d.ts.map +1 -0
  233. package/dist/ui/src/components/Checkbox/Checkbox.d.ts +4 -0
  234. package/dist/ui/src/components/Checkbox/Checkbox.d.ts.map +1 -0
  235. package/dist/ui/src/components/Checkbox/index.d.ts +3 -0
  236. package/dist/ui/src/components/Checkbox/index.d.ts.map +1 -0
  237. package/dist/ui/src/components/Checkbox/types.d.ts +11 -0
  238. package/dist/ui/src/components/Checkbox/types.d.ts.map +1 -0
  239. package/dist/ui/src/components/Divider/Divider.d.ts +4 -0
  240. package/dist/ui/src/components/Divider/Divider.d.ts.map +1 -0
  241. package/dist/ui/src/components/Divider/index.d.ts +3 -0
  242. package/dist/ui/src/components/Divider/index.d.ts.map +1 -0
  243. package/dist/ui/src/components/Divider/types.d.ts +10 -0
  244. package/dist/ui/src/components/Divider/types.d.ts.map +1 -0
  245. package/dist/ui/src/components/Field/Field.d.ts +9 -0
  246. package/dist/ui/src/components/Field/Field.d.ts.map +1 -0
  247. package/dist/ui/src/components/Field/index.d.ts +3 -0
  248. package/dist/ui/src/components/Field/index.d.ts.map +1 -0
  249. package/dist/ui/src/components/Field/types.d.ts +30 -0
  250. package/dist/ui/src/components/Field/types.d.ts.map +1 -0
  251. package/dist/ui/src/components/Field/useFieldControlOverlayMetrics.d.ts +14 -0
  252. package/dist/ui/src/components/Field/useFieldControlOverlayMetrics.d.ts.map +1 -0
  253. package/dist/ui/src/components/Fieldset/Fieldset.d.ts +9 -0
  254. package/dist/ui/src/components/Fieldset/Fieldset.d.ts.map +1 -0
  255. package/dist/ui/src/components/Fieldset/index.d.ts +3 -0
  256. package/dist/ui/src/components/Fieldset/index.d.ts.map +1 -0
  257. package/dist/ui/src/components/Fieldset/types.d.ts +7 -0
  258. package/dist/ui/src/components/Fieldset/types.d.ts.map +1 -0
  259. package/dist/ui/src/components/IconButton/IconButton.d.ts +4 -0
  260. package/dist/ui/src/components/IconButton/IconButton.d.ts.map +1 -0
  261. package/dist/ui/src/components/IconButton/index.d.ts +3 -0
  262. package/dist/ui/src/components/IconButton/index.d.ts.map +1 -0
  263. package/dist/ui/src/components/IconButton/types.d.ts +16 -0
  264. package/dist/ui/src/components/IconButton/types.d.ts.map +1 -0
  265. package/dist/ui/src/components/Interaction/Interaction.d.ts +4 -0
  266. package/dist/ui/src/components/Interaction/Interaction.d.ts.map +1 -0
  267. package/dist/ui/src/components/Interaction/index.d.ts +3 -0
  268. package/dist/ui/src/components/Interaction/index.d.ts.map +1 -0
  269. package/dist/ui/src/components/Interaction/types.d.ts +6 -0
  270. package/dist/ui/src/components/Interaction/types.d.ts.map +1 -0
  271. package/dist/ui/src/components/Loading/Loading.d.ts +4 -0
  272. package/dist/ui/src/components/Loading/Loading.d.ts.map +1 -0
  273. package/dist/ui/src/components/Loading/index.d.ts +3 -0
  274. package/dist/ui/src/components/Loading/index.d.ts.map +1 -0
  275. package/dist/ui/src/components/Loading/types.d.ts +8 -0
  276. package/dist/ui/src/components/Loading/types.d.ts.map +1 -0
  277. package/dist/ui/src/components/Menu/Menu.d.ts +12 -0
  278. package/dist/ui/src/components/Menu/Menu.d.ts.map +1 -0
  279. package/dist/ui/src/components/Menu/index.d.ts +3 -0
  280. package/dist/ui/src/components/Menu/index.d.ts.map +1 -0
  281. package/dist/ui/src/components/Menu/types.d.ts +52 -0
  282. package/dist/ui/src/components/Menu/types.d.ts.map +1 -0
  283. package/dist/ui/src/components/Modal/Modal.d.ts +19 -0
  284. package/dist/ui/src/components/Modal/Modal.d.ts.map +1 -0
  285. package/dist/ui/src/components/Modal/contexts.d.ts +33 -0
  286. package/dist/ui/src/components/Modal/contexts.d.ts.map +1 -0
  287. package/dist/ui/src/components/Modal/index.d.ts +3 -0
  288. package/dist/ui/src/components/Modal/index.d.ts.map +1 -0
  289. package/dist/ui/src/components/Modal/modalScrollArbitration.d.ts +33 -0
  290. package/dist/ui/src/components/Modal/modalScrollArbitration.d.ts.map +1 -0
  291. package/dist/ui/src/components/Modal/snapPoints.d.ts +38 -0
  292. package/dist/ui/src/components/Modal/snapPoints.d.ts.map +1 -0
  293. package/dist/ui/src/components/Modal/types.d.ts +117 -0
  294. package/dist/ui/src/components/Modal/types.d.ts.map +1 -0
  295. package/dist/ui/src/components/Modal/useControllableState.d.ts +6 -0
  296. package/dist/ui/src/components/Modal/useControllableState.d.ts.map +1 -0
  297. package/dist/ui/src/components/Modal/useElementSize.d.ts +6 -0
  298. package/dist/ui/src/components/Modal/useElementSize.d.ts.map +1 -0
  299. package/dist/ui/src/components/Modal/useModalDrag.d.ts +37 -0
  300. package/dist/ui/src/components/Modal/useModalDrag.d.ts.map +1 -0
  301. package/dist/ui/src/components/Modal/useModalPlacement.d.ts +3 -0
  302. package/dist/ui/src/components/Modal/useModalPlacement.d.ts.map +1 -0
  303. package/dist/ui/src/components/Modal/useModalStackDepth.d.ts +2 -0
  304. package/dist/ui/src/components/Modal/useModalStackDepth.d.ts.map +1 -0
  305. package/dist/ui/src/components/Radio/Radio.d.ts +4 -0
  306. package/dist/ui/src/components/Radio/Radio.d.ts.map +1 -0
  307. package/dist/ui/src/components/Radio/index.d.ts +3 -0
  308. package/dist/ui/src/components/Radio/index.d.ts.map +1 -0
  309. package/dist/ui/src/components/Radio/types.d.ts +10 -0
  310. package/dist/ui/src/components/Radio/types.d.ts.map +1 -0
  311. package/dist/ui/src/components/ScrollArea/ScrollArea.d.ts +6 -0
  312. package/dist/ui/src/components/ScrollArea/ScrollArea.d.ts.map +1 -0
  313. package/dist/ui/src/components/ScrollArea/contexts.d.ts +3 -0
  314. package/dist/ui/src/components/ScrollArea/contexts.d.ts.map +1 -0
  315. package/dist/ui/src/components/ScrollArea/index.d.ts +4 -0
  316. package/dist/ui/src/components/ScrollArea/index.d.ts.map +1 -0
  317. package/dist/ui/src/components/ScrollArea/types.d.ts +21 -0
  318. package/dist/ui/src/components/ScrollArea/types.d.ts.map +1 -0
  319. package/dist/ui/src/components/SectionHeader/SectionHeader.d.ts +4 -0
  320. package/dist/ui/src/components/SectionHeader/SectionHeader.d.ts.map +1 -0
  321. package/dist/ui/src/components/SectionHeader/index.d.ts +3 -0
  322. package/dist/ui/src/components/SectionHeader/index.d.ts.map +1 -0
  323. package/dist/ui/src/components/SectionHeader/types.d.ts +13 -0
  324. package/dist/ui/src/components/SectionHeader/types.d.ts.map +1 -0
  325. package/dist/ui/src/components/Select/Select.d.ts +4 -0
  326. package/dist/ui/src/components/Select/Select.d.ts.map +1 -0
  327. package/dist/ui/src/components/Select/SelectContent.d.ts +4 -0
  328. package/dist/ui/src/components/Select/SelectContent.d.ts.map +1 -0
  329. package/dist/ui/src/components/Select/index.d.ts +4 -0
  330. package/dist/ui/src/components/Select/index.d.ts.map +1 -0
  331. package/dist/ui/src/components/Select/types.d.ts +12 -0
  332. package/dist/ui/src/components/Select/types.d.ts.map +1 -0
  333. package/dist/ui/src/components/SvgIcon/SvgIcon.d.ts +2 -0
  334. package/dist/ui/src/components/SvgIcon/SvgIcon.d.ts.map +1 -0
  335. package/dist/ui/src/components/SvgIcon/index.d.ts +3 -0
  336. package/dist/ui/src/components/SvgIcon/index.d.ts.map +1 -0
  337. package/dist/ui/src/components/SvgIcon/types.d.ts +2 -0
  338. package/dist/ui/src/components/SvgIcon/types.d.ts.map +1 -0
  339. package/dist/ui/src/components/Switch/Switch.d.ts +4 -0
  340. package/dist/ui/src/components/Switch/Switch.d.ts.map +1 -0
  341. package/dist/ui/src/components/Switch/index.d.ts +3 -0
  342. package/dist/ui/src/components/Switch/index.d.ts.map +1 -0
  343. package/dist/ui/src/components/Switch/types.d.ts +8 -0
  344. package/dist/ui/src/components/Switch/types.d.ts.map +1 -0
  345. package/dist/ui/src/components/TextArea/TextArea.d.ts +4 -0
  346. package/dist/ui/src/components/TextArea/TextArea.d.ts.map +1 -0
  347. package/dist/ui/src/components/TextArea/TextAreaContent.d.ts +4 -0
  348. package/dist/ui/src/components/TextArea/TextAreaContent.d.ts.map +1 -0
  349. package/dist/ui/src/components/TextArea/index.d.ts +4 -0
  350. package/dist/ui/src/components/TextArea/index.d.ts.map +1 -0
  351. package/dist/ui/src/components/TextArea/types.d.ts +15 -0
  352. package/dist/ui/src/components/TextArea/types.d.ts.map +1 -0
  353. package/dist/ui/src/components/TextButton/TextButton.d.ts +4 -0
  354. package/dist/ui/src/components/TextButton/TextButton.d.ts.map +1 -0
  355. package/dist/ui/src/components/TextButton/index.d.ts +3 -0
  356. package/dist/ui/src/components/TextButton/index.d.ts.map +1 -0
  357. package/dist/ui/src/components/TextButton/types.d.ts +25 -0
  358. package/dist/ui/src/components/TextButton/types.d.ts.map +1 -0
  359. package/dist/ui/src/components/TextInput/TextInput.d.ts +4 -0
  360. package/dist/ui/src/components/TextInput/TextInput.d.ts.map +1 -0
  361. package/dist/ui/src/components/TextInput/TextInputContent.d.ts +4 -0
  362. package/dist/ui/src/components/TextInput/TextInputContent.d.ts.map +1 -0
  363. package/dist/ui/src/components/TextInput/index.d.ts +4 -0
  364. package/dist/ui/src/components/TextInput/index.d.ts.map +1 -0
  365. package/dist/ui/src/components/TextInput/types.d.ts +12 -0
  366. package/dist/ui/src/components/TextInput/types.d.ts.map +1 -0
  367. package/dist/ui/src/components/Tooltip/Tooltip.d.ts +8 -0
  368. package/dist/ui/src/components/Tooltip/Tooltip.d.ts.map +1 -0
  369. package/dist/ui/src/components/Tooltip/index.d.ts +3 -0
  370. package/dist/ui/src/components/Tooltip/index.d.ts.map +1 -0
  371. package/dist/ui/src/components/Tooltip/types.d.ts +21 -0
  372. package/dist/ui/src/components/Tooltip/types.d.ts.map +1 -0
  373. package/dist/ui/src/components/internal/slot.d.ts +3 -0
  374. package/dist/ui/src/components/internal/slot.d.ts.map +1 -0
  375. package/dist/ui/src/components/types.d.ts +2 -0
  376. package/dist/ui/src/components/types.d.ts.map +1 -0
  377. package/dist/ui/src/index.d.ts +59 -0
  378. package/dist/ui/src/index.d.ts.map +1 -0
  379. package/dist/ui/src/react/motion/index.d.ts +27 -0
  380. package/dist/ui/src/react/motion/index.d.ts.map +1 -0
  381. package/dist/ui/src/react/spring/index.d.ts +33 -0
  382. package/dist/ui/src/react/spring/index.d.ts.map +1 -0
  383. package/dist/ui/src/utils/breakpoints.d.ts +6 -0
  384. package/dist/ui/src/utils/breakpoints.d.ts.map +1 -0
  385. package/dist/ui/src/utils/css.d.ts +3 -0
  386. package/dist/ui/src/utils/css.d.ts.map +1 -0
  387. package/dist/ui/src/utils/motion.d.ts +80 -0
  388. package/dist/ui/src/utils/motion.d.ts.map +1 -0
  389. package/dist/ui/src/utils/spring/animator.d.ts +3 -0
  390. package/dist/ui/src/utils/spring/animator.d.ts.map +1 -0
  391. package/dist/ui/src/utils/spring/constants.d.ts +13 -0
  392. package/dist/ui/src/utils/spring/constants.d.ts.map +1 -0
  393. package/dist/ui/src/utils/spring/format.d.ts +5 -0
  394. package/dist/ui/src/utils/spring/format.d.ts.map +1 -0
  395. package/dist/ui/src/utils/spring/model.d.ts +18 -0
  396. package/dist/ui/src/utils/spring/model.d.ts.map +1 -0
  397. package/dist/ui/src/utils/spring/solver.d.ts +6 -0
  398. package/dist/ui/src/utils/spring/solver.d.ts.map +1 -0
  399. package/dist/ui/src/utils/spring/static.d.ts +5 -0
  400. package/dist/ui/src/utils/spring/static.d.ts.map +1 -0
  401. package/dist/ui/src/utils/spring/types.d.ts +141 -0
  402. package/dist/ui/src/utils/spring/types.d.ts.map +1 -0
  403. package/dist/ui/src/utils/spring/validation.d.ts +5 -0
  404. package/dist/ui/src/utils/spring/validation.d.ts.map +1 -0
  405. package/dist/ui/src/utils/spring/value.d.ts +5 -0
  406. package/dist/ui/src/utils/spring/value.d.ts.map +1 -0
  407. package/dist/ui/src/utils/spring.d.ts +12 -0
  408. package/dist/ui/src/utils/spring.d.ts.map +1 -0
  409. package/dist/utils/breakpoints.d.ts +2 -0
  410. package/dist/utils/breakpoints.js +26 -0
  411. package/dist/utils/css.js +7 -0
  412. package/dist/utils/motion.d.ts +2 -0
  413. package/dist/utils/motion.js +343 -0
  414. package/dist/utils/spring/animator.js +179 -0
  415. package/dist/utils/spring/constants.js +15 -0
  416. package/dist/utils/spring/format.js +10 -0
  417. package/dist/utils/spring/model.js +120 -0
  418. package/dist/utils/spring/solver.js +78 -0
  419. package/dist/utils/spring/static.js +76 -0
  420. package/dist/utils/spring/validation.js +19 -0
  421. package/dist/utils/spring/value.js +65 -0
  422. package/dist/utils/spring.d.ts +2 -0
  423. package/dist/utils/spring.js +14 -0
  424. package/dist/vscode/oc-ui-vars.css +468 -0
  425. package/package.json +128 -0
  426. package/src/scss/foundations/_color.config.scss +14 -0
  427. package/src/scss/foundations/_responsive.config.scss +6 -0
  428. package/src/scss/foundations/atomic.scss +24 -0
  429. package/src/scss/foundations/breakpoint.scss +3 -0
  430. package/src/scss/foundations/color-theme.test.ts +99 -0
  431. package/src/scss/foundations/color.global.scss +210 -0
  432. package/src/scss/foundations/color.theme.dark.scss +80 -0
  433. package/src/scss/foundations/color.theme.light.scss +72 -0
  434. package/src/scss/foundations/motion.scss +46 -0
  435. package/src/scss/foundations/reset.scss +129 -0
  436. package/src/scss/foundations/responsive.test.ts +294 -0
  437. package/src/scss/foundations/space.scss +206 -0
  438. package/src/scss/foundations/typo.scss +381 -0
  439. package/src/scss/foundations/zindex.scss +12 -0
  440. package/src/scss/index.scss +18 -0
  441. package/src/scss/mixins/_breakpoint.scss +115 -0
  442. package/src/scss/mixins/_color.scss +29 -0
  443. package/src/scss/mixins/_color.test.ts +35 -0
  444. package/src/scss/mixins/_element.scss +52 -0
  445. package/src/scss/mixins/_element.test.ts +44 -0
  446. package/src/scss/mixins/_motion.scss +450 -0
  447. package/src/scss/mixins/_motion.test.ts +336 -0
  448. package/src/scss/mixins/_responsive.scss +366 -0
  449. package/src/scss/mixins/_spring.scss +396 -0
  450. package/src/scss/mixins/_spring.test.ts +128 -0
  451. package/src/scss/mixins/_typo.scss +67 -0
  452. package/src/scss/mixins/_typo.test.ts +28 -0
  453. package/src/scss/mixins/_utils.scss +26 -0
  454. package/src/scss/spring.scss +1 -0
@@ -0,0 +1,1498 @@
1
+ import { useRef as S, useLayoutEffect as ut, useCallback as p, useEffect as Ct } from "react";
2
+ import { ocSpring as Ye } from "../../utils/spring.js";
3
+ import { resolveOcMotion as Nt } from "../../utils/motion.js";
4
+ import { resolveModalPopupSnapPositions as Me } from "./snapPoints.js";
5
+ import { setModalBodyTouchScrollLock as Ot, shouldLockModalBodyTouchScroll as be, shouldIgnoreDragTarget as Bt, getScrollableAncestor as Ee, getBottomTouchDragDecision as Fe, getPopupTouchDragDecision as Ae } from "./modalScrollArbitration.js";
6
+ import { createSpringAnimator as Vt } from "../../utils/spring/animator.js";
7
+ const E = {
8
+ dragStartThresholdPx: {
9
+ touch: 10,
10
+ mouse: 2
11
+ },
12
+ releaseVelocity: {
13
+ sampleWindowMs: 90,
14
+ maxPxPerSecond: 4e3,
15
+ flickThresholdPxPerMs: 0.55
16
+ },
17
+ snapProjection: {
18
+ lookaheadSeconds: 0.16,
19
+ maxDistancePx: 24
20
+ },
21
+ dismissal: {
22
+ minDistancePx: 24
23
+ },
24
+ rubberBand: {
25
+ resistance: 0.55
26
+ },
27
+ settleSpring: {
28
+ durationSeconds: 0.5
29
+ },
30
+ popupDragFollower: {
31
+ settleDurationScale: 1 / 6
32
+ }
33
+ }, Ie = Ye.snappy({
34
+ duration: E.settleSpring.durationSeconds * E.popupDragFollower.settleDurationScale
35
+ }), _t = 500, ke = [], Le = [];
36
+ function ne(r) {
37
+ r.cancelable !== !1 && r.preventDefault();
38
+ }
39
+ function F(r, n, l) {
40
+ return Math.min(Math.max(r, n), l);
41
+ }
42
+ function ae(r) {
43
+ return [...new Set(r)].sort((n, l) => n - l);
44
+ }
45
+ function Ce(r, n) {
46
+ return r.reduce(
47
+ (l, o) => Math.abs(o - n) < Math.abs(l - n) ? o : l
48
+ );
49
+ }
50
+ function oe({
51
+ deltaX: r,
52
+ deltaY: n,
53
+ placement: l
54
+ }) {
55
+ return l === "bottom" ? Math.abs(n) : Math.hypot(r, n);
56
+ }
57
+ function Ne(r, n, l) {
58
+ if (l === "down")
59
+ return r.find((c) => c > n + 1) ?? r[r.length - 1] ?? 0;
60
+ for (let c = r.length - 1; c >= 0; c -= 1) {
61
+ const g = r[c];
62
+ if (g !== void 0 && g < n - 1)
63
+ return g;
64
+ }
65
+ return r[0] ?? 0;
66
+ }
67
+ function Oe(r, n, l, o, c = l) {
68
+ const y = Ne(r, n, o), h = o === "down" ? Math.max(l, c) : Math.min(l, c);
69
+ if (o === "down") {
70
+ if (r.filter(
71
+ (A) => A > n + 1 && A <= l + 1
72
+ ).length === 0) return y;
73
+ const $ = r.filter(
74
+ (A) => A > n + 1 && A <= h + 1
75
+ );
76
+ return $[$.length - 1] ?? y;
77
+ }
78
+ return r.filter(
79
+ (Y) => Y < n - 1 && Y >= l - 1
80
+ ).length === 0 ? y : r.filter(
81
+ (Y) => Y < n - 1 && Y >= h - 1
82
+ )[0] ?? y;
83
+ }
84
+ function se(r, n) {
85
+ const l = Math.max(n, 1), { resistance: o } = E.rubberBand;
86
+ return r * o * l / (l + o * r);
87
+ }
88
+ function jt({
89
+ targetTranslate: r,
90
+ minTranslate: n,
91
+ maxTranslate: l,
92
+ dimension: o
93
+ }) {
94
+ return r < n ? n - se(n - r, o) : r > l ? l + se(r - l, o) : r;
95
+ }
96
+ function le(r) {
97
+ return typeof Element > "u" || !(r instanceof Element) ? !1 : !!r.closest('[data-oc-part="handle"], [data-oc-part="header"]');
98
+ }
99
+ function Be(r, n) {
100
+ return n ? !0 : r.pointerType ? r.pointerType === "touch" : typeof window > "u" ? !1 : window.matchMedia?.("(pointer: coarse)").matches ?? !1;
101
+ }
102
+ function ie(r, n) {
103
+ if (!r.length)
104
+ return {
105
+ minTranslate: 0,
106
+ maxTranslate: 0
107
+ };
108
+ const l = r.map((g) => g[n]), o = Math.min(...l), c = Math.max(...l);
109
+ if (Math.abs(c - o) < 0.5) {
110
+ const g = (o + c) / 2;
111
+ return {
112
+ minTranslate: g,
113
+ maxTranslate: g
114
+ };
115
+ }
116
+ return {
117
+ minTranslate: o,
118
+ maxTranslate: c
119
+ };
120
+ }
121
+ function ce(r, n) {
122
+ for (let l = 0; l < r.length; l += 1) {
123
+ const o = "item" in r && typeof r.item == "function" ? r.item(l) : r[l];
124
+ if (o?.identifier === n) return o;
125
+ }
126
+ return null;
127
+ }
128
+ function ye(r) {
129
+ if (!r) return { x: 0, y: 0 };
130
+ const n = window.getComputedStyle(r).transform;
131
+ if (!n || n === "none") return { x: 0, y: 0 };
132
+ const l = n.match(/^matrix\((.+)\)$/);
133
+ if (l) {
134
+ const c = l[1].split(",").map((g) => g.trim());
135
+ return {
136
+ x: Number.parseFloat(c[4] ?? "0") || 0,
137
+ y: Number.parseFloat(c[5] ?? "0") || 0
138
+ };
139
+ }
140
+ const o = n.match(/^matrix3d\((.+)\)$/);
141
+ if (o) {
142
+ const c = o[1].split(",").map((g) => g.trim());
143
+ return {
144
+ x: Number.parseFloat(c[12] ?? "0") || 0,
145
+ y: Number.parseFloat(c[13] ?? "0") || 0
146
+ };
147
+ }
148
+ return { x: 0, y: 0 };
149
+ }
150
+ function ue(r) {
151
+ return ye(r).y;
152
+ }
153
+ function de(r) {
154
+ return ye(r);
155
+ }
156
+ function st(r) {
157
+ if (!r) return;
158
+ const n = Number.parseFloat(r);
159
+ return Number.isFinite(n) ? n : void 0;
160
+ }
161
+ function pe(r) {
162
+ if (!r) return 0;
163
+ const n = Number.parseFloat(r);
164
+ return Number.isFinite(n) ? r.trim().endsWith("ms") ? n : n * 1e3 : 0;
165
+ }
166
+ function fe(r) {
167
+ if (typeof window > "u")
168
+ return _t;
169
+ const n = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1;
170
+ if (!r) return n ? 0 : _t;
171
+ const l = r.style.transition;
172
+ l === "none" && r.style.removeProperty("transition");
173
+ const o = window.getComputedStyle(r), c = (o.transitionDuration ?? "").split(",").map(pe), g = (o.transitionDelay ?? "").split(",").map(pe), y = c.reduce((h, P, X) => {
174
+ const Y = g[X] ?? g[g.length - 1] ?? 0;
175
+ return Math.max(h, P + Y);
176
+ }, 0);
177
+ return l === "none" && r.style.setProperty("transition", "none"), y > 0 ? y : n ? 0 : _t;
178
+ }
179
+ function dt() {
180
+ return Date.now();
181
+ }
182
+ function Ve(r, n) {
183
+ const l = n - E.releaseVelocity.sampleWindowMs;
184
+ for (; r.length > 2 && (r[1]?.time ?? n) < l; )
185
+ r.shift();
186
+ }
187
+ function pt(r, n) {
188
+ const l = n.time ?? dt();
189
+ r.samples.push({
190
+ time: l,
191
+ pageX: n.pageX,
192
+ pageY: n.pageY,
193
+ translateX: n.translateX,
194
+ translateY: n.translateY
195
+ }), Ve(r.samples, l);
196
+ }
197
+ function bt(r, n) {
198
+ return {
199
+ x: r.startTranslateX + n.pageX - r.startX,
200
+ y: r.startTranslate + n.pageY - r.startY
201
+ };
202
+ }
203
+ function ge(r, n) {
204
+ const l = bt(r, n);
205
+ pt(r, {
206
+ pageX: n.pageX,
207
+ pageY: n.pageY,
208
+ translateX: l.x,
209
+ translateY: l.y
210
+ });
211
+ }
212
+ function me({
213
+ session: r,
214
+ fallbackDeltaY: n,
215
+ fallbackElapsed: l
216
+ }) {
217
+ const o = r.samples[r.samples.length - 1], { maxPxPerSecond: c, sampleWindowMs: g } = E.releaseVelocity;
218
+ if (o) {
219
+ const y = o.time - g, h = r.samples.find((P) => P.time >= y) ?? r.samples[0];
220
+ if (h && h !== o) {
221
+ const P = Math.max(o.time - h.time, 1), X = (o.translateY - h.translateY) / P * 1e3;
222
+ if (Number.isFinite(X))
223
+ return F(X, -c, c);
224
+ }
225
+ }
226
+ return F(
227
+ n / Math.max(l, 1) * 1e3,
228
+ -c,
229
+ c
230
+ );
231
+ }
232
+ function he({
233
+ session: r,
234
+ fallbackDelta: n,
235
+ fallbackElapsed: l
236
+ }) {
237
+ const o = r.samples[r.samples.length - 1], { maxPxPerSecond: c, sampleWindowMs: g } = E.releaseVelocity;
238
+ if (o) {
239
+ const y = o.time - g, h = r.samples.find((P) => P.time >= y) ?? r.samples[0];
240
+ if (h && h !== o) {
241
+ const P = Math.max(o.time - h.time, 1), X = {
242
+ x: (o.translateX - h.translateX) / P * 1e3,
243
+ y: (o.translateY - h.translateY) / P * 1e3
244
+ };
245
+ if (Number.isFinite(X.x) && Number.isFinite(X.y))
246
+ return {
247
+ x: F(X.x, -c, c),
248
+ y: F(X.y, -c, c)
249
+ };
250
+ }
251
+ }
252
+ return {
253
+ x: F(
254
+ n.x / Math.max(l, 1) * 1e3,
255
+ -c,
256
+ c
257
+ ),
258
+ y: F(
259
+ n.y / Math.max(l, 1) * 1e3,
260
+ -c,
261
+ c
262
+ )
263
+ };
264
+ }
265
+ function _e({
266
+ currentTranslate: r,
267
+ releaseVelocity: n
268
+ }) {
269
+ const { lookaheadSeconds: l, maxDistancePx: o } = E.snapProjection;
270
+ return r + F(n * l, -o, o);
271
+ }
272
+ function je({
273
+ currentTranslate: r,
274
+ releaseVelocity: n
275
+ }) {
276
+ const { lookaheadSeconds: l, maxDistancePx: o } = E.snapProjection;
277
+ return {
278
+ x: r.x + F(
279
+ n.x * l,
280
+ -o,
281
+ o
282
+ ),
283
+ y: r.y + F(
284
+ n.y * l,
285
+ -o,
286
+ o
287
+ )
288
+ };
289
+ }
290
+ function ze(r) {
291
+ return Math.abs(r) / 1e3 > E.releaseVelocity.flickThresholdPxPerMs;
292
+ }
293
+ function Ue(r) {
294
+ return Math.hypot(r.x, r.y) / 1e3 > E.releaseVelocity.flickThresholdPxPerMs;
295
+ }
296
+ function ft(r, n) {
297
+ return Math.hypot(r.x - n.x, r.y - n.y);
298
+ }
299
+ function Te(r, n) {
300
+ return r.reduce(
301
+ (l, o) => ft(o, n) < ft(l, n) ? o : l
302
+ );
303
+ }
304
+ function We({
305
+ currentTranslate: r,
306
+ releaseVelocity: n,
307
+ targets: l
308
+ }) {
309
+ const o = je({
310
+ currentTranslate: r,
311
+ releaseVelocity: n
312
+ });
313
+ if (!Ue(n))
314
+ return Te(l, r);
315
+ const c = l.filter((g) => {
316
+ const y = g.x - r.x, h = g.y - r.y;
317
+ return y * n.x + h * n.y > 0;
318
+ });
319
+ return Te(
320
+ c.length ? c : l,
321
+ o
322
+ );
323
+ }
324
+ function $e({
325
+ presentationState: r,
326
+ releaseTranslate: n,
327
+ visibleTranslate: l
328
+ }) {
329
+ return r !== "visible" || Math.abs(n - l) > 1;
330
+ }
331
+ function He({
332
+ drag: r,
333
+ placement: n,
334
+ snapPositionCount: l
335
+ }) {
336
+ return n === "popup" && r === "content" && l > 0;
337
+ }
338
+ function Ge({
339
+ dismissible: r,
340
+ peekTranslate: n,
341
+ sheetHeight: l,
342
+ visibleTranslate: o
343
+ }) {
344
+ return {
345
+ maxTranslate: n > 0 ? n : r ? l : o,
346
+ minTranslate: 0
347
+ };
348
+ }
349
+ function qe({
350
+ rubberBand: r,
351
+ targetTranslate: n,
352
+ sheetHeight: l,
353
+ peekTranslate: o,
354
+ visibleTranslate: c,
355
+ dismissible: g
356
+ }) {
357
+ const y = Ge({
358
+ dismissible: g,
359
+ peekTranslate: o,
360
+ sheetHeight: l,
361
+ visibleTranslate: c
362
+ }), h = F(
363
+ r ? jt({
364
+ targetTranslate: n,
365
+ dimension: l,
366
+ ...y
367
+ }) : n,
368
+ -l,
369
+ y.maxTranslate + l
370
+ ), P = Math.max(-h, 0), X = Math.max(h, 0), Y = o > 0 ? o : l, $ = Y > 0 ? 1 - X / Math.max(Y, 1) : 0;
371
+ return {
372
+ translate: h,
373
+ overshootFillHeight: P,
374
+ backdropOpacity: F($, 0, 1)
375
+ };
376
+ }
377
+ function er({
378
+ enabled: r,
379
+ drag: n,
380
+ open: l,
381
+ placement: o,
382
+ surfaceMotionRef: c,
383
+ backdropRef: g,
384
+ bodyNode: y,
385
+ snapHeights: h = ke,
386
+ snapPositions: P = Le,
387
+ defaultSnapPosition: X,
388
+ peekHeight: Y,
389
+ peekFallback: $,
390
+ presentationState: A,
391
+ setPresentationState: Et,
392
+ requestClose: gt,
393
+ canCloseAttempt: zt,
394
+ dismissible: U = !0,
395
+ visibleTranslate: B = 0,
396
+ closeThreshold: Ft = 0.35,
397
+ scrollLockTimeout: Ut = 500
398
+ }) {
399
+ const w = S({
400
+ dragging: !1,
401
+ allowed: !1,
402
+ chrome: !1,
403
+ closeAllowed: null,
404
+ started: !1,
405
+ source: null,
406
+ startX: 0,
407
+ startY: 0,
408
+ lastX: 0,
409
+ lastY: 0,
410
+ startTranslateX: 0,
411
+ startTranslate: 0,
412
+ lastTranslateX: 0,
413
+ lastTranslate: 0,
414
+ startTime: 0,
415
+ samples: [],
416
+ pointerId: null,
417
+ touchId: null
418
+ }), H = S(y), Wt = S(!1), mt = S(0), At = S(!1), W = S(null), V = S(
419
+ null
420
+ ), ht = S(null), lt = S(null), _ = S(null), G = S(null), q = S(null), It = S(!1), kt = S(!1), it = S(!1), D = He({
421
+ drag: n,
422
+ placement: o,
423
+ snapPositionCount: P.length
424
+ }), $t = `${X ?? ""}:${P.join("|")}`, Ht = S(P), Tt = S(X);
425
+ ut(() => {
426
+ Ht.current = P, Tt.current = X;
427
+ }, [X, $t, P]), ut(() => {
428
+ const t = H.current;
429
+ t && t !== y && Ot(t, !1), H.current = y, Wt.current && Ot(y, !0);
430
+ }, [y]);
431
+ const J = p((t) => {
432
+ Wt.current = t, Ot(H.current, t);
433
+ }, []), yt = p(
434
+ ({ chrome: t, target: e }) => {
435
+ const a = be({
436
+ target: e,
437
+ chrome: t,
438
+ bodyNode: H.current
439
+ });
440
+ return J(a), a;
441
+ },
442
+ [J]
443
+ ), L = p(() => c.current?.getBoundingClientRect().height ?? window.innerHeight, [c]), Gt = p(() => {
444
+ if (Y !== void 0) return Y;
445
+ if ($ === "header")
446
+ return c.current?.querySelector('[data-oc-part="header"]')?.getBoundingClientRect().height ?? void 0;
447
+ }, [$, Y, c]), I = p(() => {
448
+ const t = Gt();
449
+ if (t === void 0 || t <= 0) return 0;
450
+ const e = L();
451
+ return F(e - t, 0, e);
452
+ }, [Gt, L]), Lt = p(
453
+ () => A === "peeked" ? I() : B,
454
+ [I, A, B]
455
+ ), xt = p(() => {
456
+ const t = c.current;
457
+ if (!t) return Lt();
458
+ const e = st(
459
+ t.style.getPropertyValue("--oc-modal-translate-y")
460
+ );
461
+ if (e !== void 0) return e;
462
+ const a = st(
463
+ window.getComputedStyle(t).getPropertyValue("--oc-modal-translate-y")
464
+ );
465
+ return a !== void 0 ? a : Lt();
466
+ }, [Lt, c]), wt = p(() => {
467
+ const t = c.current;
468
+ if (!t) return { x: 0, y: 0 };
469
+ const e = st(
470
+ t.style.getPropertyValue("--oc-modal-translate-x")
471
+ ), a = st(
472
+ t.style.getPropertyValue("--oc-modal-translate-y")
473
+ );
474
+ if (e !== void 0 || a !== void 0)
475
+ return {
476
+ x: e ?? 0,
477
+ y: a ?? 0
478
+ };
479
+ const i = window.getComputedStyle(t);
480
+ return {
481
+ x: st(i.getPropertyValue("--oc-modal-translate-x")) ?? 0,
482
+ y: st(i.getPropertyValue("--oc-modal-translate-y")) ?? 0
483
+ };
484
+ }, [c]), Pt = p(() => {
485
+ const t = xt(), e = ue(c.current);
486
+ return Math.abs(e - t) > 1 ? e : t;
487
+ }, [xt, c]), Q = p(() => {
488
+ const t = wt(), e = de(c.current);
489
+ return ft(e, t) > 1 ? e : t;
490
+ }, [wt, c]), C = p(
491
+ (t, {
492
+ active: e,
493
+ nextDismissible: a = U,
494
+ rubberBand: i = !1
495
+ }) => {
496
+ const s = c.current;
497
+ if (!s) return;
498
+ const u = L(), d = s.parentElement, f = I(), m = qe({
499
+ rubberBand: i,
500
+ targetTranslate: t,
501
+ sheetHeight: u,
502
+ peekTranslate: f,
503
+ visibleTranslate: B,
504
+ dismissible: a
505
+ });
506
+ w.current.lastTranslate = m.translate, s.style.setProperty(
507
+ "--oc-modal-translate-y",
508
+ `${m.translate}px`
509
+ ), s.dataset.ocModalDragging = e ? "true" : "false", d?.style.setProperty(
510
+ "--oc-modal-overshoot-fill-height",
511
+ `${m.overshootFillHeight}px`
512
+ ), d && (d.dataset.ocModalDragging = e ? "true" : "false"), e ? s.style.setProperty("transition", "none") : s.style.removeProperty("transition"), g.current && (g.current.style.setProperty(
513
+ "--oc-modal-backdrop-opacity",
514
+ String(m.backdropOpacity)
515
+ ), g.current.style.transition = e ? "none" : "");
516
+ },
517
+ [
518
+ g,
519
+ U,
520
+ I,
521
+ L,
522
+ c,
523
+ B
524
+ ]
525
+ ), Z = p(() => {
526
+ const t = c.current, e = Ht.current;
527
+ if (!(!t || !e.length))
528
+ return Me({
529
+ defaultSnapPosition: Tt.current,
530
+ snapPositions: e,
531
+ surfaceMotion: t
532
+ });
533
+ }, [c]), K = p(
534
+ ({ destroy: t = !0 } = {}) => {
535
+ t && V.current?.destroy(), V.current = null, ht.current = null;
536
+ },
537
+ []
538
+ ), v = p(
539
+ (t, { active: e }) => {
540
+ const a = c.current;
541
+ if (!a) return;
542
+ const i = Z(), s = i ? a.getBoundingClientRect() : void 0, u = i ? ie(i.targets, "x") : void 0, d = i ? ie(i.targets, "y") : void 0, f = i ? {
543
+ x: jt({
544
+ targetTranslate: t.x,
545
+ minTranslate: u?.minTranslate ?? 0,
546
+ maxTranslate: u?.maxTranslate ?? 0,
547
+ dimension: Math.abs(
548
+ (u?.maxTranslate ?? 0) - (u?.minTranslate ?? 0)
549
+ ) || s?.width || 1
550
+ }),
551
+ y: jt({
552
+ targetTranslate: t.y,
553
+ minTranslate: d?.minTranslate ?? 0,
554
+ maxTranslate: d?.maxTranslate ?? 0,
555
+ dimension: Math.abs(
556
+ (d?.maxTranslate ?? 0) - (d?.minTranslate ?? 0)
557
+ ) || s?.height || 1
558
+ })
559
+ } : t;
560
+ w.current.lastTranslateX = f.x, w.current.lastTranslate = f.y, a.style.setProperty(
561
+ "--oc-modal-translate-x",
562
+ `${f.x}px`
563
+ ), a.style.setProperty(
564
+ "--oc-modal-translate-y",
565
+ `${f.y}px`
566
+ ), a.dataset.ocModalDragging = e ? "true" : "false", a.parentElement && (a.parentElement.dataset.ocModalDragging = e ? "true" : "false"), a.style.transition = e ? "none" : "";
567
+ },
568
+ [Z, c]
569
+ ), M = p(() => {
570
+ W.current?.destroy(), W.current = null, K(), G.current !== null && (window.cancelAnimationFrame(G.current), G.current = null), q.current !== null && (window.clearTimeout(q.current), q.current = null);
571
+ }, [K]), tt = p(
572
+ (t, e = U) => {
573
+ M(), C(t, {
574
+ active: !0,
575
+ nextDismissible: e,
576
+ rubberBand: !0
577
+ });
578
+ },
579
+ [C, M, U]
580
+ ), et = p(
581
+ (t, e = {}) => {
582
+ const a = c.current, i = a?.parentElement, s = g.current;
583
+ for (const u of [a, i, s])
584
+ u && (t === null ? (delete u.dataset.ocModalTransition, u.style.removeProperty("--_-modal-transition-duration"), u.style.removeProperty("--_-modal-transition-timing-function")) : (u.dataset.ocModalTransition = t, e.durationMs !== void 0 && u.style.setProperty(
585
+ "--_-modal-transition-duration",
586
+ `${e.durationMs}ms`
587
+ ), e.timingFunction !== void 0 && u.style.setProperty(
588
+ "--_-modal-transition-timing-function",
589
+ e.timingFunction
590
+ )));
591
+ },
592
+ [g, c]
593
+ ), x = p(() => {
594
+ const t = c.current;
595
+ t && (t.dataset.ocModalDragging = "false", t.style.removeProperty("transition"), t.parentElement && (t.parentElement.dataset.ocModalDragging = "false"), g.current?.style.removeProperty("transition"), et(null));
596
+ }, [g, et, c]), qt = p(
597
+ ({ resetY: t = !0 } = {}) => {
598
+ const e = c.current;
599
+ e && (lt.current = null, w.current.lastTranslateX = 0, e.style.removeProperty("--oc-modal-translate-x"), t && (w.current.lastTranslate = 0, e.style.removeProperty("--oc-modal-translate-y")), x());
600
+ },
601
+ [x, c]
602
+ ), k = p(
603
+ (t, {
604
+ initialVelocity: e = 0,
605
+ intent: a = "gesture",
606
+ phase: i = "settle",
607
+ from: s,
608
+ onComplete: u
609
+ } = {}) => {
610
+ const d = c.current;
611
+ if (!d) return;
612
+ M();
613
+ const f = s ?? ue(d);
614
+ if (Math.abs(f - t) < 0.5) {
615
+ C(t, { active: !1 }), x(), u?.();
616
+ return;
617
+ }
618
+ C(f, { active: !0 });
619
+ const m = Nt({
620
+ element: d,
621
+ intent: a,
622
+ phase: i,
623
+ reduced: "preserve",
624
+ reducedMotion: !1,
625
+ property: "transform"
626
+ });
627
+ if (!m.springBacked) {
628
+ et("gesture-settle", {
629
+ timingFunction: m.timingFunction
630
+ });
631
+ const b = fe(d);
632
+ G.current = window.requestAnimationFrame(() => {
633
+ G.current = null, C(t, { active: !1 }), b <= 0 && (x(), u?.());
634
+ }), b > 0 && (q.current = window.setTimeout(() => {
635
+ q.current = null, x(), u?.();
636
+ }, b));
637
+ return;
638
+ }
639
+ const T = Vt({
640
+ value: f,
641
+ target: t,
642
+ velocity: e,
643
+ spring: m.spring,
644
+ epsilon: 0.5,
645
+ velocityEpsilon: 50,
646
+ stabilityWindow: 0.02,
647
+ onUpdate: (b) => {
648
+ C(b, { active: !0 });
649
+ },
650
+ onComplete: () => {
651
+ W.current === T && (W.current = null), C(t, { active: !1 }), x(), u?.();
652
+ }
653
+ });
654
+ W.current = T;
655
+ },
656
+ [
657
+ C,
658
+ M,
659
+ x,
660
+ et,
661
+ c
662
+ ]
663
+ ), j = p(
664
+ (t, {
665
+ from: e,
666
+ initialVelocity: a = { x: 0, y: 0 }
667
+ } = {}) => {
668
+ const i = c.current;
669
+ if (!i) return;
670
+ M();
671
+ const s = e ?? de(i), u = { x: t.x, y: t.y };
672
+ if (ft(s, u) < 0.5) {
673
+ v(u, { active: !1 }), x();
674
+ return;
675
+ }
676
+ v(s, { active: !0 });
677
+ const f = Nt({
678
+ element: i,
679
+ intent: "gesture",
680
+ phase: "settle",
681
+ reduced: "preserve",
682
+ reducedMotion: !1,
683
+ property: "transform"
684
+ });
685
+ if (!f.springBacked) {
686
+ et("gesture-settle", {
687
+ timingFunction: f.timingFunction
688
+ });
689
+ const T = fe(i);
690
+ G.current = window.requestAnimationFrame(() => {
691
+ G.current = null, v(u, { active: !1 }), T <= 0 && x();
692
+ }), T > 0 && (q.current = window.setTimeout(() => {
693
+ q.current = null, x();
694
+ }, T));
695
+ return;
696
+ }
697
+ const m = Vt({
698
+ value: s,
699
+ target: u,
700
+ velocity: a,
701
+ spring: f.spring,
702
+ epsilon: 0.5,
703
+ velocityEpsilon: 50,
704
+ stabilityWindow: 0.02,
705
+ onUpdate: (T) => {
706
+ v(T, { active: !0 });
707
+ },
708
+ onComplete: () => {
709
+ W.current === m && (W.current = null), v(u, { active: !1 }), x();
710
+ }
711
+ });
712
+ W.current = m;
713
+ },
714
+ [
715
+ v,
716
+ M,
717
+ x,
718
+ et,
719
+ c
720
+ ]
721
+ ), rt = p(() => {
722
+ const t = V.current;
723
+ if (!t) return null;
724
+ const e = t.sample();
725
+ return v(e.value, { active: !0 }), e;
726
+ }, [v]), Kt = p(
727
+ (t) => {
728
+ if (!c.current) return null;
729
+ M(), v(t, { active: !0 });
730
+ const a = Vt({
731
+ value: t,
732
+ target: t,
733
+ spring: Ie,
734
+ autoplay: !1,
735
+ epsilon: 0.5,
736
+ velocityEpsilon: 50,
737
+ stabilityWindow: 0.02,
738
+ onUpdate: (i) => {
739
+ v(i, { active: !0 });
740
+ },
741
+ onComplete: () => {
742
+ const i = ht.current;
743
+ !i || V.current !== a || (K({ destroy: !1 }), v(i, { active: !1 }), x());
744
+ }
745
+ });
746
+ return V.current = a, a;
747
+ },
748
+ [
749
+ v,
750
+ M,
751
+ K,
752
+ x,
753
+ c
754
+ ]
755
+ ), Rt = p(
756
+ (t) => {
757
+ const e = V.current ?? Kt(Q());
758
+ e && (ht.current = null, e.setTarget(t));
759
+ },
760
+ [Q, Kt]
761
+ ), nt = p(
762
+ (t, e) => {
763
+ const a = bt(t, e);
764
+ return Rt(a), rt(), a;
765
+ },
766
+ [rt, Rt]
767
+ ), Dt = p(
768
+ (t) => {
769
+ const e = c.current, a = V.current;
770
+ if (!e || !a) {
771
+ j(t);
772
+ return;
773
+ }
774
+ const i = rt(), s = i ? wt() : a.value, u = { x: t.x, y: t.y };
775
+ if (ft(s, u) < 0.5) {
776
+ K(), v(u, { active: !1 }), x();
777
+ return;
778
+ }
779
+ const d = Nt({
780
+ element: e,
781
+ intent: "gesture",
782
+ phase: "settle",
783
+ reduced: "preserve",
784
+ reducedMotion: !1,
785
+ property: "transform"
786
+ });
787
+ if (!d.springBacked) {
788
+ const f = i?.velocity ?? a.velocity;
789
+ K(), j(u, {
790
+ from: s,
791
+ initialVelocity: f
792
+ });
793
+ return;
794
+ }
795
+ ht.current = u, a.setTarget(u, { spring: d.spring });
796
+ },
797
+ [
798
+ v,
799
+ K,
800
+ x,
801
+ wt,
802
+ rt,
803
+ j,
804
+ c
805
+ ]
806
+ ), Xt = p(
807
+ ({
808
+ key: t,
809
+ settle: e
810
+ }) => {
811
+ if (w.current.dragging) return !1;
812
+ const a = Z();
813
+ if (!a) return !1;
814
+ const i = (t ? a.targets.find((s) => s.key === t) : void 0) ?? a.defaultTarget;
815
+ return lt.current = i.key, e ? j(i) : (M(), v(i, { active: !1 }), x()), !0;
816
+ },
817
+ [
818
+ v,
819
+ M,
820
+ x,
821
+ Z,
822
+ j
823
+ ]
824
+ ), Jt = p(
825
+ (t, { from: e, initialVelocity: a = 0 }) => {
826
+ k(t, {
827
+ from: e,
828
+ initialVelocity: a,
829
+ onComplete: () => {
830
+ gt({ reason: "drag-dismiss" }, { skipAttempt: !0 });
831
+ }
832
+ });
833
+ },
834
+ [gt, k]
835
+ );
836
+ Ct(
837
+ () => () => {
838
+ M(), c.current && x();
839
+ },
840
+ [M, x, c]
841
+ ), ut(() => {
842
+ if (!l || !r || o !== "bottom") {
843
+ It.current = l;
844
+ return;
845
+ }
846
+ const t = It.current;
847
+ It.current = !0;
848
+ const e = A === "peeked" ? I() : B;
849
+ if (!t) {
850
+ const a = L();
851
+ C(a, { active: !0 }), k(e, {
852
+ from: a,
853
+ intent: "move",
854
+ phase: "enter"
855
+ });
856
+ return;
857
+ }
858
+ if (A === "peeked") {
859
+ k(I());
860
+ return;
861
+ }
862
+ if (At.current) {
863
+ At.current = !1;
864
+ return;
865
+ }
866
+ k(B);
867
+ }, [
868
+ r,
869
+ I,
870
+ L,
871
+ l,
872
+ o,
873
+ A,
874
+ C,
875
+ k,
876
+ B
877
+ ]), ut(() => {
878
+ if (!l || !r || !D) {
879
+ const i = !l && o === "popup" && it.current;
880
+ it.current && !i && (_.current !== null && (window.cancelAnimationFrame(_.current), _.current = null), M(), qt()), it.current && i && (M(), x()), kt.current = l && o === "popup", it.current = !1;
881
+ return;
882
+ }
883
+ const t = kt.current;
884
+ kt.current = !0, it.current = !0;
885
+ let e = null;
886
+ const a = (i) => Xt({
887
+ key: i,
888
+ settle: t
889
+ });
890
+ return a(Tt.current) || (e = window.requestAnimationFrame(() => {
891
+ e = null, a(
892
+ lt.current ?? Tt.current
893
+ );
894
+ })), () => {
895
+ e !== null && window.cancelAnimationFrame(e);
896
+ };
897
+ }, [
898
+ M,
899
+ r,
900
+ x,
901
+ l,
902
+ o,
903
+ $t,
904
+ D,
905
+ qt,
906
+ Xt
907
+ ]), ut(() => {
908
+ if (!l || !r || !D) return;
909
+ const t = () => {
910
+ w.current.dragging || _.current === null && (_.current = window.requestAnimationFrame(() => {
911
+ _.current = null, !w.current.dragging && Xt({
912
+ key: lt.current,
913
+ settle: !1
914
+ });
915
+ }));
916
+ };
917
+ window.addEventListener("resize", t), window.visualViewport?.addEventListener("resize", t);
918
+ const e = c.current, a = e?.parentElement, i = typeof ResizeObserver > "u" ? null : new ResizeObserver(t);
919
+ return i && (e && i.observe(e), a && i.observe(a)), () => {
920
+ window.removeEventListener("resize", t), window.visualViewport?.removeEventListener("resize", t), i?.disconnect(), _.current !== null && (window.cancelAnimationFrame(_.current), _.current = null);
921
+ };
922
+ }, [
923
+ r,
924
+ l,
925
+ D,
926
+ c,
927
+ Xt
928
+ ]);
929
+ const Qt = p(
930
+ (t, e, a) => {
931
+ if (typeof Element > "u" || !(t instanceof Element) || Bt(t)) return !1;
932
+ const i = Date.now(), s = e > 0, u = Ee(t, H.current);
933
+ return !a && u && s && u.scrollTop > 0 || !a && mt.current && i - mt.current < Ut && Math.abs(xt()) <= 1 ? (mt.current = i, !1) : !0;
934
+ },
935
+ [xt, Ut]
936
+ ), St = p(
937
+ ({
938
+ chrome: t,
939
+ pointerId: e = null,
940
+ source: a,
941
+ startX: i = 0,
942
+ startY: s,
943
+ touchId: u = null
944
+ }) => {
945
+ const d = Pt(), f = Q(), m = dt();
946
+ w.current = {
947
+ dragging: !0,
948
+ allowed: !1,
949
+ chrome: t,
950
+ closeAllowed: null,
951
+ started: !1,
952
+ source: a,
953
+ startX: i,
954
+ startY: s,
955
+ lastX: i,
956
+ lastY: s,
957
+ startTranslateX: f.x,
958
+ startTranslate: d,
959
+ lastTranslateX: f.x,
960
+ lastTranslate: d,
961
+ startTime: m,
962
+ samples: [
963
+ {
964
+ time: m,
965
+ pageX: i,
966
+ pageY: s,
967
+ translateX: f.x,
968
+ translateY: d
969
+ }
970
+ ],
971
+ pointerId: e,
972
+ touchId: u
973
+ };
974
+ },
975
+ [Pt, Q]
976
+ ), at = p(
977
+ (t) => {
978
+ t.source === "touch" && J(!1), t.dragging = !1, t.allowed = !1, t.closeAllowed = null, t.started = !1, t.source = null, t.startX = 0, t.startY = 0, t.lastX = 0, t.lastY = 0, t.startTranslateX = 0, t.startTranslate = 0, t.lastTranslateX = 0, t.lastTranslate = 0, t.pointerId = null, t.touchId = null;
979
+ },
980
+ [J]
981
+ ), Zt = p(
982
+ (t, e) => {
983
+ const a = Pt(), i = Q();
984
+ t.startX = e.x, t.startY = e.y, t.lastX = e.x, t.lastY = e.y, t.startTranslateX = i.x, t.startTranslate = a, t.lastTranslateX = i.x, t.lastTranslate = a, t.startTime = dt(), t.samples = [
985
+ {
986
+ time: t.startTime,
987
+ pageX: e.x,
988
+ pageY: e.y,
989
+ translateX: i.x,
990
+ translateY: a
991
+ }
992
+ ];
993
+ },
994
+ [Pt, Q]
995
+ ), te = p(
996
+ ({
997
+ currentTranslate: t,
998
+ dismissible: e,
999
+ releaseVelocity: a,
1000
+ deltaY: i,
1001
+ startTranslate: s
1002
+ }) => {
1003
+ const u = L(), d = I(), f = d > 0, m = u, T = Math.max(
1004
+ E.dismissal.minDistancePx,
1005
+ (u - d) * Ft
1006
+ ), b = h.map(
1007
+ (O) => F(u - O, 0, u)
1008
+ ), z = ae(
1009
+ b.length ? b : [0]
1010
+ ), N = _e({
1011
+ currentTranslate: t,
1012
+ releaseVelocity: a
1013
+ });
1014
+ f && z.push(d);
1015
+ const ct = ae(z);
1016
+ return e && !f && i > 0 && t >= d + T ? m : ze(a) ? ct.length > 1 ? Oe(
1017
+ ct,
1018
+ s,
1019
+ t,
1020
+ i > 0 ? "down" : "up",
1021
+ N
1022
+ ) : 0 : e && t > u * Ft && !f ? m : Ce(ct, t);
1023
+ },
1024
+ [Ft, I, L, h]
1025
+ ), xe = p(
1026
+ (t) => {
1027
+ if (!r || o !== "bottom" && !D || n === !1 || t.pointerType === "touch" || Bt(t.target)) return;
1028
+ let e = !1;
1029
+ if (n === "handle" && t.target instanceof Element && t.target.closest('[data-oc-part="handle"]'))
1030
+ e = !0;
1031
+ else if (n === "handle")
1032
+ return;
1033
+ n === "content" && (e = le(t.target), !Be(t, e)) || (St({
1034
+ chrome: e,
1035
+ pointerId: t.pointerId,
1036
+ source: "pointer",
1037
+ startX: t.pageX,
1038
+ startY: t.pageY
1039
+ }), t.currentTarget.setPointerCapture(t.pointerId));
1040
+ },
1041
+ [St, n, r, o, D]
1042
+ ), ot = p(
1043
+ (t, e) => {
1044
+ if (!U) return !1;
1045
+ if (e <= 0) return !0;
1046
+ if (t.closeAllowed !== null) return t.closeAllowed;
1047
+ const a = zt({ reason: "drag-dismiss" });
1048
+ return t.closeAllowed = a, a;
1049
+ },
1050
+ [zt, U]
1051
+ ), vt = p(
1052
+ ({
1053
+ closeAllowed: t,
1054
+ currentTranslate: e,
1055
+ deltaY: a,
1056
+ releaseVelocity: i,
1057
+ startTranslate: s
1058
+ }) => {
1059
+ const d = te({
1060
+ currentTranslate: e,
1061
+ dismissible: U && t !== !1,
1062
+ releaseVelocity: i,
1063
+ deltaY: a,
1064
+ startTranslate: s
1065
+ }), f = L(), m = I();
1066
+ if (d >= f - 1) {
1067
+ gt({ reason: "drag-dismiss" }, { commit: !1 }) ? Jt(d, {
1068
+ from: e,
1069
+ initialVelocity: i
1070
+ }) : k(s, {
1071
+ from: e,
1072
+ initialVelocity: i
1073
+ });
1074
+ return;
1075
+ }
1076
+ m > 0 && d >= m - 1 ? Et("peeked") : ($e({
1077
+ presentationState: A,
1078
+ releaseTranslate: d,
1079
+ visibleTranslate: B
1080
+ }) && (At.current = !0), Et("visible")), k(d, {
1081
+ from: e,
1082
+ initialVelocity: i
1083
+ });
1084
+ },
1085
+ [
1086
+ Jt,
1087
+ U,
1088
+ I,
1089
+ te,
1090
+ L,
1091
+ A,
1092
+ gt,
1093
+ Et,
1094
+ k,
1095
+ B
1096
+ ]
1097
+ ), Yt = p(
1098
+ ({ currentTranslate: t, releaseVelocity: e }) => {
1099
+ const a = Z();
1100
+ if (!a) return;
1101
+ const i = We({
1102
+ currentTranslate: t,
1103
+ releaseVelocity: e,
1104
+ targets: a.targets
1105
+ });
1106
+ if (lt.current = i.key, V.current) {
1107
+ Dt(i);
1108
+ return;
1109
+ }
1110
+ j(i, {
1111
+ from: t,
1112
+ initialVelocity: e
1113
+ });
1114
+ },
1115
+ [Z, Dt, j]
1116
+ ), we = p(
1117
+ (t) => {
1118
+ const e = w.current;
1119
+ if (!e.dragging || e.source !== "pointer" || !r || o !== "bottom" && !D)
1120
+ return;
1121
+ const a = t.pageX - e.startX, i = t.pageY - e.startY, s = t.pointerType === "touch" ? E.dragStartThresholdPx.touch : E.dragStartThresholdPx.mouse;
1122
+ if (!(!e.started && oe({ deltaX: a, deltaY: i, placement: o }) < s)) {
1123
+ if (!e.allowed) {
1124
+ if (o === "bottom" && !Qt(t.target, i, e.chrome))
1125
+ return;
1126
+ e.allowed = !0, e.started = !0;
1127
+ }
1128
+ if (t.preventDefault(), e.lastX = t.pageX, e.lastY = t.pageY, o === "popup")
1129
+ nt(e, t), ge(e, t);
1130
+ else {
1131
+ const u = e.startTranslate + i, d = ot(e, i);
1132
+ tt(u, d), pt(e, {
1133
+ pageX: t.pageX,
1134
+ pageY: t.pageY,
1135
+ translateX: e.lastTranslateX,
1136
+ translateY: e.lastTranslate
1137
+ });
1138
+ }
1139
+ }
1140
+ },
1141
+ [
1142
+ r,
1143
+ nt,
1144
+ ot,
1145
+ o,
1146
+ D,
1147
+ tt,
1148
+ Qt
1149
+ ]
1150
+ ), R = p(
1151
+ ({
1152
+ currentTarget: t,
1153
+ pageX: e,
1154
+ pageY: a,
1155
+ releaseCapture: i = !0
1156
+ }) => {
1157
+ const s = w.current;
1158
+ if (!s.dragging || s.source !== "pointer" || !r || o !== "bottom" && !D)
1159
+ return;
1160
+ const u = s.started, d = Number.isFinite(e) ? e : s.lastX, f = Number.isFinite(a) ? a : s.lastY, m = d - s.startX, T = f - s.startY, b = Math.max(dt() - s.startTime, 1);
1161
+ let z = {
1162
+ x: s.lastTranslateX,
1163
+ y: s.lastTranslate
1164
+ };
1165
+ const N = s.startTranslate;
1166
+ if (u)
1167
+ if (o === "popup")
1168
+ nt(s, {
1169
+ pageX: d,
1170
+ pageY: f
1171
+ }), z = {
1172
+ x: s.lastTranslateX,
1173
+ y: s.lastTranslate
1174
+ };
1175
+ else {
1176
+ const O = s.startTranslate + T, ve = ot(s, T);
1177
+ tt(O, ve), z = {
1178
+ x: s.lastTranslateX,
1179
+ y: s.lastTranslate
1180
+ };
1181
+ }
1182
+ const ct = s.closeAllowed;
1183
+ if (i && t && s.pointerId !== null && t.hasPointerCapture(s.pointerId) && t.releasePointerCapture(s.pointerId), u) {
1184
+ const O = o === "popup" ? bt(s, {
1185
+ pageX: d,
1186
+ pageY: f
1187
+ }) : {
1188
+ x: s.lastTranslateX,
1189
+ y: s.lastTranslate
1190
+ };
1191
+ pt(s, {
1192
+ pageX: d,
1193
+ pageY: f,
1194
+ translateX: O.x,
1195
+ translateY: O.y
1196
+ });
1197
+ }
1198
+ if (at(s), !!u)
1199
+ if (o === "popup") {
1200
+ const O = he({
1201
+ session: s,
1202
+ fallbackDelta: { x: m, y: T },
1203
+ fallbackElapsed: b
1204
+ });
1205
+ Yt({
1206
+ currentTranslate: z,
1207
+ releaseVelocity: O
1208
+ });
1209
+ } else {
1210
+ const O = me({
1211
+ session: s,
1212
+ fallbackDeltaY: T,
1213
+ fallbackElapsed: b
1214
+ });
1215
+ vt({
1216
+ closeAllowed: ct,
1217
+ currentTranslate: z.y,
1218
+ deltaY: T,
1219
+ releaseVelocity: O,
1220
+ startTranslate: N
1221
+ });
1222
+ }
1223
+ },
1224
+ [
1225
+ vt,
1226
+ Yt,
1227
+ r,
1228
+ nt,
1229
+ ot,
1230
+ o,
1231
+ D,
1232
+ at,
1233
+ tt
1234
+ ]
1235
+ ), ee = p(
1236
+ (t) => {
1237
+ R({
1238
+ currentTarget: t.currentTarget,
1239
+ pageX: t.pageX,
1240
+ pageY: t.pageY
1241
+ });
1242
+ },
1243
+ [R]
1244
+ ), Pe = p(
1245
+ (t) => {
1246
+ const e = w.current;
1247
+ e.pointerId !== null && t.pointerId !== e.pointerId || R({
1248
+ pageX: t.pageX,
1249
+ pageY: t.pageY,
1250
+ releaseCapture: !1
1251
+ });
1252
+ },
1253
+ [R]
1254
+ );
1255
+ Ct(() => {
1256
+ if (!r) return;
1257
+ const t = (s) => {
1258
+ const u = w.current;
1259
+ !u.dragging || u.source !== "pointer" || "pointerId" in s && u.pointerId !== null && s.pointerId !== u.pointerId || R({
1260
+ pageX: s.pageX,
1261
+ pageY: s.pageY,
1262
+ releaseCapture: !1
1263
+ });
1264
+ }, e = () => {
1265
+ const s = w.current;
1266
+ !s.dragging || s.source !== "pointer" || R({
1267
+ pageX: s.lastX,
1268
+ pageY: s.lastY,
1269
+ releaseCapture: !1
1270
+ });
1271
+ }, a = (s) => {
1272
+ const u = w.current;
1273
+ !u.dragging || u.source !== "pointer" || s.relatedTarget === null && t(s);
1274
+ }, i = (s) => {
1275
+ const u = w.current;
1276
+ !u.dragging || u.source !== "pointer" || s.relatedTarget === null && t(s);
1277
+ };
1278
+ return document.addEventListener("pointerout", a, !0), document.addEventListener("mouseout", i, !0), window.addEventListener("pointerup", t, !0), window.addEventListener(
1279
+ "pointercancel",
1280
+ t,
1281
+ !0
1282
+ ), window.addEventListener("blur", e), () => {
1283
+ document.removeEventListener(
1284
+ "pointerout",
1285
+ a,
1286
+ !0
1287
+ ), document.removeEventListener("mouseout", i, !0), window.removeEventListener(
1288
+ "pointerup",
1289
+ t,
1290
+ !0
1291
+ ), window.removeEventListener(
1292
+ "pointercancel",
1293
+ t,
1294
+ !0
1295
+ ), window.removeEventListener("blur", e);
1296
+ };
1297
+ }, [R, r]);
1298
+ const Mt = p((t) => {
1299
+ const e = w.current;
1300
+ return e.touchId !== null ? ce(t.changedTouches, e.touchId) ?? ce(t.touches, e.touchId) : t.touches[0] ?? t.changedTouches[0] ?? null;
1301
+ }, []), De = p(
1302
+ (t) => {
1303
+ if (!r || o !== "bottom" && !D || n === !1 || t.touches.length !== 1 || Bt(t.target)) return;
1304
+ let e = !1;
1305
+ if (n === "handle" && t.target instanceof Element && t.target.closest('[data-oc-part="handle"]'))
1306
+ e = !0;
1307
+ else if (n === "handle")
1308
+ return;
1309
+ n === "content" && (e = le(t.target));
1310
+ const a = t.touches[0];
1311
+ o === "bottom" && yt({
1312
+ target: t.target,
1313
+ chrome: e
1314
+ }), St({
1315
+ chrome: e,
1316
+ source: "touch",
1317
+ startX: a.pageX,
1318
+ startY: a.pageY,
1319
+ touchId: a.identifier
1320
+ });
1321
+ },
1322
+ [
1323
+ St,
1324
+ n,
1325
+ r,
1326
+ o,
1327
+ D,
1328
+ yt
1329
+ ]
1330
+ ), re = p(
1331
+ (t) => {
1332
+ const e = w.current;
1333
+ if (!e.dragging || e.source !== "touch" || !r || o !== "bottom" && !D)
1334
+ return;
1335
+ const a = Mt(t);
1336
+ if (!a) return;
1337
+ const i = a.pageX - e.startX, s = a.pageY - e.startY, u = oe({
1338
+ deltaX: i,
1339
+ deltaY: s,
1340
+ placement: o
1341
+ }), d = E.dragStartThresholdPx.touch, f = o === "bottom" ? Fe({
1342
+ target: t.target,
1343
+ deltaY: s,
1344
+ chrome: e.chrome,
1345
+ bodyNode: H.current
1346
+ }) : Ae({
1347
+ target: t.target,
1348
+ bodyNode: H.current
1349
+ });
1350
+ if (f.preventDefault) {
1351
+ const T = o === "bottom" && Math.abs(i) > Math.abs(s) && Math.abs(s) < d && !e.started && u < d;
1352
+ !T && o === "bottom" && yt({
1353
+ target: t.target,
1354
+ chrome: e.chrome
1355
+ }), T || ne(t);
1356
+ }
1357
+ if (f.resetAnchor) {
1358
+ J(!1), Zt(e, { x: a.pageX, y: a.pageY });
1359
+ return;
1360
+ }
1361
+ if (f.allowDrag && !(!e.started && u < d))
1362
+ if (e.allowed || (e.allowed = !0, e.started = !0), f.preventDefault || ne(t), e.lastX = a.pageX, e.lastY = a.pageY, o === "popup")
1363
+ nt(e, a), ge(e, a);
1364
+ else {
1365
+ const m = e.startTranslate + s, T = ot(e, s);
1366
+ tt(m, T), pt(e, {
1367
+ pageX: a.pageX,
1368
+ pageY: a.pageY,
1369
+ translateX: e.lastTranslateX,
1370
+ translateY: e.lastTranslate
1371
+ });
1372
+ }
1373
+ },
1374
+ [
1375
+ r,
1376
+ nt,
1377
+ ot,
1378
+ Mt,
1379
+ o,
1380
+ D,
1381
+ Zt,
1382
+ J,
1383
+ tt,
1384
+ yt
1385
+ ]
1386
+ );
1387
+ Ct(() => {
1388
+ if (!l || !r || o !== "bottom" && !D || n === !1 || typeof window > "u") return;
1389
+ const t = (e) => {
1390
+ re(e);
1391
+ };
1392
+ return window.addEventListener("touchmove", t, {
1393
+ capture: !0,
1394
+ passive: !1
1395
+ }), () => {
1396
+ window.removeEventListener("touchmove", t, !0);
1397
+ };
1398
+ }, [n, r, re, l, o, D]);
1399
+ const Xe = p(
1400
+ (t) => {
1401
+ const e = w.current;
1402
+ if (!e.dragging || e.source !== "touch" || !r || o !== "bottom" && !D)
1403
+ return;
1404
+ const a = Mt(t), i = a?.pageX ?? e.lastX, s = a?.pageY ?? e.lastY, u = e.started, d = e.closeAllowed, f = i - e.startX, m = s - e.startY, T = Math.max(dt() - e.startTime, 1);
1405
+ o === "popup" && rt();
1406
+ const b = {
1407
+ x: e.lastTranslateX,
1408
+ y: e.lastTranslate
1409
+ }, z = e.startTranslate;
1410
+ if (u) {
1411
+ const N = o === "popup" ? bt(e, {
1412
+ pageX: i,
1413
+ pageY: s
1414
+ }) : {
1415
+ x: e.lastTranslateX,
1416
+ y: e.lastTranslate
1417
+ };
1418
+ pt(e, {
1419
+ pageX: i,
1420
+ pageY: s,
1421
+ translateX: N.x,
1422
+ translateY: N.y
1423
+ });
1424
+ }
1425
+ if (at(e), !!u)
1426
+ if (o === "popup") {
1427
+ const N = he({
1428
+ session: e,
1429
+ fallbackDelta: { x: f, y: m },
1430
+ fallbackElapsed: T
1431
+ });
1432
+ Yt({
1433
+ currentTranslate: b,
1434
+ releaseVelocity: N
1435
+ });
1436
+ } else {
1437
+ const N = me({
1438
+ session: e,
1439
+ fallbackDeltaY: m,
1440
+ fallbackElapsed: T
1441
+ });
1442
+ vt({
1443
+ closeAllowed: d,
1444
+ currentTranslate: b.y,
1445
+ deltaY: m,
1446
+ releaseVelocity: N,
1447
+ startTranslate: z
1448
+ });
1449
+ }
1450
+ },
1451
+ [
1452
+ vt,
1453
+ Yt,
1454
+ r,
1455
+ Mt,
1456
+ o,
1457
+ D,
1458
+ at,
1459
+ rt
1460
+ ]
1461
+ ), Se = p(() => {
1462
+ const t = w.current;
1463
+ if (!t.dragging || t.source !== "touch") return;
1464
+ const e = t.started, a = t.startTranslate, i = t.lastTranslate, s = {
1465
+ x: t.startTranslateX,
1466
+ y: t.startTranslate
1467
+ }, u = {
1468
+ x: t.lastTranslateX,
1469
+ y: t.lastTranslate
1470
+ }, d = o;
1471
+ if (at(t), !!e) {
1472
+ if (d === "popup") {
1473
+ V.current ? Dt(s) : j(s, { from: u });
1474
+ return;
1475
+ }
1476
+ k(a, { from: i });
1477
+ }
1478
+ }, [
1479
+ o,
1480
+ at,
1481
+ Dt,
1482
+ j,
1483
+ k
1484
+ ]);
1485
+ return {
1486
+ onPointerDown: xe,
1487
+ onPointerMove: we,
1488
+ onPointerUp: ee,
1489
+ onPointerCancel: ee,
1490
+ onLostPointerCapture: Pe,
1491
+ onTouchStart: De,
1492
+ onTouchEnd: Xe,
1493
+ onTouchCancel: Se
1494
+ };
1495
+ }
1496
+ export {
1497
+ er as useModalDrag
1498
+ };