@codeleap/web 7.0.0 → 7.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 (357) hide show
  1. package/dist/components/ActivityIndicator/index.js +28 -0
  2. package/dist/components/ActivityIndicator/index.js.map +1 -0
  3. package/dist/components/ActivityIndicator/styles.js +2 -0
  4. package/dist/components/ActivityIndicator/styles.js.map +1 -0
  5. package/dist/components/ActivityIndicator/types.js +2 -0
  6. package/dist/components/ActivityIndicator/types.js.map +1 -0
  7. package/dist/components/Badge/index.js +68 -0
  8. package/dist/components/Badge/index.js.map +1 -0
  9. package/dist/components/Badge/styles.js +2 -0
  10. package/dist/components/Badge/styles.js.map +1 -0
  11. package/dist/components/Badge/types.js +2 -0
  12. package/dist/components/Badge/types.js.map +1 -0
  13. package/dist/components/Button/index.js +52 -0
  14. package/dist/components/Button/index.js.map +1 -0
  15. package/dist/components/Button/styles.js +2 -0
  16. package/dist/components/Button/styles.js.map +1 -0
  17. package/dist/components/Button/types.js +2 -0
  18. package/dist/components/Button/types.js.map +1 -0
  19. package/dist/components/Calendar/index.js +50 -0
  20. package/dist/components/Calendar/index.js.map +1 -0
  21. package/dist/components/Calendar/styles.js +2 -0
  22. package/dist/components/Calendar/styles.js.map +1 -0
  23. package/dist/components/Calendar/types.js +2 -0
  24. package/dist/components/Calendar/types.js.map +1 -0
  25. package/dist/components/Carousel/index.js +129 -0
  26. package/dist/components/Carousel/index.js.map +1 -0
  27. package/dist/components/Carousel/styles.js +2 -0
  28. package/dist/components/Carousel/styles.js.map +1 -0
  29. package/dist/components/Carousel/types.js +2 -0
  30. package/dist/components/Carousel/types.js.map +1 -0
  31. package/dist/components/Checkbox/index.js +44 -0
  32. package/dist/components/Checkbox/index.js.map +1 -0
  33. package/dist/components/Checkbox/styles.js +2 -0
  34. package/dist/components/Checkbox/styles.js.map +1 -0
  35. package/dist/components/Checkbox/types.js +2 -0
  36. package/dist/components/Checkbox/types.js.map +1 -0
  37. package/dist/components/Collapse/index.js +27 -0
  38. package/dist/components/Collapse/index.js.map +1 -0
  39. package/dist/components/Collapse/styles.js +2 -0
  40. package/dist/components/Collapse/styles.js.map +1 -0
  41. package/dist/components/Collapse/types.js +2 -0
  42. package/dist/components/Collapse/types.js.map +1 -0
  43. package/dist/components/ColorPicker/index.js +65 -0
  44. package/dist/components/ColorPicker/index.js.map +1 -0
  45. package/dist/components/ColorPicker/styles.js +2 -0
  46. package/dist/components/ColorPicker/styles.js.map +1 -0
  47. package/dist/components/ColorPicker/types.js +2 -0
  48. package/dist/components/ColorPicker/types.js.map +1 -0
  49. package/dist/components/CropPicker/hooks.js +130 -0
  50. package/dist/components/CropPicker/hooks.js.map +1 -0
  51. package/dist/components/CropPicker/index.js +38 -0
  52. package/dist/components/CropPicker/index.js.map +1 -0
  53. package/dist/components/CropPicker/styles.js +2 -0
  54. package/dist/components/CropPicker/styles.js.map +1 -0
  55. package/dist/components/CropPicker/types.js +2 -0
  56. package/dist/components/CropPicker/types.js.map +1 -0
  57. package/dist/components/CropPicker/utils.js +70 -0
  58. package/dist/components/CropPicker/utils.js.map +1 -0
  59. package/dist/components/DatePicker/index.js +70 -0
  60. package/dist/components/DatePicker/index.js.map +1 -0
  61. package/dist/components/DatePicker/styles.js +2 -0
  62. package/dist/components/DatePicker/styles.js.map +1 -0
  63. package/dist/components/DatePicker/types.js +2 -0
  64. package/dist/components/DatePicker/types.js.map +1 -0
  65. package/dist/components/Drawer/index.js +50 -0
  66. package/dist/components/Drawer/index.js.map +1 -0
  67. package/dist/components/Drawer/styles.js +2 -0
  68. package/dist/components/Drawer/styles.js.map +1 -0
  69. package/dist/components/Drawer/types.js +2 -0
  70. package/dist/components/Drawer/types.js.map +1 -0
  71. package/dist/components/Dropzone/context.js +39 -0
  72. package/dist/components/Dropzone/context.js.map +1 -0
  73. package/dist/components/Dropzone/elements.js +51 -0
  74. package/dist/components/Dropzone/elements.js.map +1 -0
  75. package/dist/components/Dropzone/index.js +71 -0
  76. package/dist/components/Dropzone/index.js.map +1 -0
  77. package/dist/components/Dropzone/styles.js +2 -0
  78. package/dist/components/Dropzone/styles.js.map +1 -0
  79. package/dist/components/Dropzone/types.js +2 -0
  80. package/dist/components/Dropzone/types.js.map +1 -0
  81. package/dist/components/Dropzone/useDropzone.js +17 -0
  82. package/dist/components/Dropzone/useDropzone.js.map +1 -0
  83. package/dist/components/EmptyPlaceholder/index.js +65 -0
  84. package/dist/components/EmptyPlaceholder/index.js.map +1 -0
  85. package/dist/components/EmptyPlaceholder/styles.js +2 -0
  86. package/dist/components/EmptyPlaceholder/styles.js.map +1 -0
  87. package/dist/components/EmptyPlaceholder/types.js +2 -0
  88. package/dist/components/EmptyPlaceholder/types.js.map +1 -0
  89. package/dist/components/Field/context.js +52 -0
  90. package/dist/components/Field/context.js.map +1 -0
  91. package/dist/components/Field/elements.js +84 -0
  92. package/dist/components/Field/elements.js.map +1 -0
  93. package/dist/components/Field/index.js +37 -0
  94. package/dist/components/Field/index.js.map +1 -0
  95. package/dist/components/Field/styles.js +2 -0
  96. package/dist/components/Field/styles.js.map +1 -0
  97. package/dist/components/Field/types.js +2 -0
  98. package/dist/components/Field/types.js.map +1 -0
  99. package/dist/components/Field/useFieldInput.js +47 -0
  100. package/dist/components/Field/useFieldInput.js.map +1 -0
  101. package/dist/components/FileInput/index.js +55 -0
  102. package/dist/components/FileInput/index.js.map +1 -0
  103. package/dist/components/FileInput/types.js +2 -0
  104. package/dist/components/FileInput/types.js.map +1 -0
  105. package/dist/components/Icon/index.js +51 -0
  106. package/dist/components/Icon/index.js.map +1 -0
  107. package/dist/components/Icon/styles.js +2 -0
  108. package/dist/components/Icon/styles.js.map +1 -0
  109. package/dist/components/Icon/types.js +2 -0
  110. package/dist/components/Icon/types.js.map +1 -0
  111. package/dist/components/List/context.js +76 -0
  112. package/dist/components/List/context.js.map +1 -0
  113. package/dist/components/List/elements.js +123 -0
  114. package/dist/components/List/elements.js.map +1 -0
  115. package/dist/components/List/index.js +35 -0
  116. package/dist/components/List/index.js.map +1 -0
  117. package/dist/components/List/scroll.js +75 -0
  118. package/dist/components/List/scroll.js.map +1 -0
  119. package/dist/components/List/styles.js +2 -0
  120. package/dist/components/List/styles.js.map +1 -0
  121. package/dist/components/List/types.js +2 -0
  122. package/dist/components/List/types.js.map +1 -0
  123. package/dist/components/LoadingOverlay/index.js +32 -0
  124. package/dist/components/LoadingOverlay/index.js.map +1 -0
  125. package/dist/components/LoadingOverlay/styles.js +2 -0
  126. package/dist/components/LoadingOverlay/styles.js.map +1 -0
  127. package/dist/components/LoadingOverlay/types.js +2 -0
  128. package/dist/components/LoadingOverlay/types.js.map +1 -0
  129. package/dist/components/MaskedTextInput/index.js +34 -0
  130. package/dist/components/MaskedTextInput/index.js.map +1 -0
  131. package/dist/components/MaskedTextInput/mask.js +34 -0
  132. package/dist/components/MaskedTextInput/mask.js.map +1 -0
  133. package/dist/components/MaskedTextInput/types.js +2 -0
  134. package/dist/components/MaskedTextInput/types.js.map +1 -0
  135. package/dist/components/Modal/context.js +36 -0
  136. package/dist/components/Modal/context.js.map +1 -0
  137. package/dist/components/Modal/elements.js +66 -0
  138. package/dist/components/Modal/elements.js.map +1 -0
  139. package/dist/components/Modal/index.js +34 -0
  140. package/dist/components/Modal/index.js.map +1 -0
  141. package/dist/components/Modal/styles.js +2 -0
  142. package/dist/components/Modal/styles.js.map +1 -0
  143. package/dist/components/Modal/types.js +2 -0
  144. package/dist/components/Modal/types.js.map +1 -0
  145. package/dist/components/NumberIncrement/index.js +65 -0
  146. package/dist/components/NumberIncrement/index.js.map +1 -0
  147. package/dist/components/NumberIncrement/styles.js +2 -0
  148. package/dist/components/NumberIncrement/styles.js.map +1 -0
  149. package/dist/components/NumberIncrement/types.js +2 -0
  150. package/dist/components/NumberIncrement/types.js.map +1 -0
  151. package/dist/components/NumberIncrement/useNumberIncrement.js +113 -0
  152. package/dist/components/NumberIncrement/useNumberIncrement.js.map +1 -0
  153. package/dist/components/Overlay/index.js +44 -0
  154. package/dist/components/Overlay/index.js.map +1 -0
  155. package/dist/components/Overlay/styles.js +2 -0
  156. package/dist/components/Overlay/styles.js.map +1 -0
  157. package/dist/components/Overlay/types.js +2 -0
  158. package/dist/components/Overlay/types.js.map +1 -0
  159. package/dist/components/PaginationButtons/index.js +100 -0
  160. package/dist/components/PaginationButtons/index.js.map +1 -0
  161. package/dist/components/PaginationButtons/styles.js +2 -0
  162. package/dist/components/PaginationButtons/styles.js.map +1 -0
  163. package/dist/components/PaginationButtons/types.js +2 -0
  164. package/dist/components/PaginationButtons/types.js.map +1 -0
  165. package/dist/components/PaginationIndicator/index.js +41 -0
  166. package/dist/components/PaginationIndicator/index.js.map +1 -0
  167. package/dist/components/PaginationIndicator/styles.js +2 -0
  168. package/dist/components/PaginationIndicator/styles.js.map +1 -0
  169. package/dist/components/PaginationIndicator/types.js +2 -0
  170. package/dist/components/PaginationIndicator/types.js.map +1 -0
  171. package/dist/components/Progress/Bar/Segmented.js +37 -0
  172. package/dist/components/Progress/Bar/Segmented.js.map +1 -0
  173. package/dist/components/Progress/Bar/index.js +44 -0
  174. package/dist/components/Progress/Bar/index.js.map +1 -0
  175. package/dist/components/Progress/Bar/styles.js +2 -0
  176. package/dist/components/Progress/Bar/styles.js.map +1 -0
  177. package/dist/components/Progress/Bar/types.js +2 -0
  178. package/dist/components/Progress/Bar/types.js.map +1 -0
  179. package/dist/components/Progress/Circle/Segmented.js +60 -0
  180. package/dist/components/Progress/Circle/Segmented.js.map +1 -0
  181. package/dist/components/Progress/Circle/index.js +65 -0
  182. package/dist/components/Progress/Circle/index.js.map +1 -0
  183. package/dist/components/Progress/Circle/styles.js +2 -0
  184. package/dist/components/Progress/Circle/styles.js.map +1 -0
  185. package/dist/components/Progress/Circle/types.js +2 -0
  186. package/dist/components/Progress/Circle/types.js.map +1 -0
  187. package/dist/components/Progress/index.js +3 -0
  188. package/dist/components/Progress/index.js.map +1 -0
  189. package/dist/components/Progress/utils.js +4 -0
  190. package/dist/components/Progress/utils.js.map +1 -0
  191. package/dist/components/RadioInput/index.js +47 -0
  192. package/dist/components/RadioInput/index.js.map +1 -0
  193. package/dist/components/RadioInput/styles.js +2 -0
  194. package/dist/components/RadioInput/styles.js.map +1 -0
  195. package/dist/components/RadioInput/types.js +2 -0
  196. package/dist/components/RadioInput/types.js.map +1 -0
  197. package/dist/components/SearchInput/index.js +61 -0
  198. package/dist/components/SearchInput/index.js.map +1 -0
  199. package/dist/components/SectionFilters/index.js +148 -0
  200. package/dist/components/SectionFilters/index.js.map +1 -0
  201. package/dist/components/SectionFilters/styles.js +2 -0
  202. package/dist/components/SectionFilters/styles.js.map +1 -0
  203. package/dist/components/SectionFilters/types.js +2 -0
  204. package/dist/components/SectionFilters/types.js.map +1 -0
  205. package/dist/components/Select/context.js +156 -0
  206. package/dist/components/Select/context.js.map +1 -0
  207. package/dist/components/Select/elements.js +47 -0
  208. package/dist/components/Select/elements.js.map +1 -0
  209. package/dist/components/Select/index.js +53 -0
  210. package/dist/components/Select/index.js.map +1 -0
  211. package/dist/components/Select/styles.js +2 -0
  212. package/dist/components/Select/styles.js.map +1 -0
  213. package/dist/components/Select/types.js +2 -0
  214. package/dist/components/Select/types.js.map +1 -0
  215. package/dist/components/Select/useTriggerWidth.js +27 -0
  216. package/dist/components/Select/useTriggerWidth.js.map +1 -0
  217. package/dist/components/Slider/index.js +139 -0
  218. package/dist/components/Slider/index.js.map +1 -0
  219. package/dist/components/Slider/styles.js +2 -0
  220. package/dist/components/Slider/styles.js.map +1 -0
  221. package/dist/components/Slider/types.js +2 -0
  222. package/dist/components/Slider/types.js.map +1 -0
  223. package/dist/components/Switch/index.js +48 -0
  224. package/dist/components/Switch/index.js.map +1 -0
  225. package/dist/components/Switch/styles.js +2 -0
  226. package/dist/components/Switch/styles.js.map +1 -0
  227. package/dist/components/Switch/types.js +2 -0
  228. package/dist/components/Switch/types.js.map +1 -0
  229. package/dist/components/Tag/index.js +53 -0
  230. package/dist/components/Tag/index.js.map +1 -0
  231. package/dist/components/Tag/styles.js +2 -0
  232. package/dist/components/Tag/styles.js.map +1 -0
  233. package/dist/components/Tag/types.js +2 -0
  234. package/dist/components/Tag/types.js.map +1 -0
  235. package/dist/components/Text/index.js +94 -0
  236. package/dist/components/Text/index.js.map +1 -0
  237. package/dist/components/Text/styles.js +2 -0
  238. package/dist/components/Text/styles.js.map +1 -0
  239. package/dist/components/Text/types.js +2 -0
  240. package/dist/components/Text/types.js.map +1 -0
  241. package/dist/components/TextEditor/index.js +90 -0
  242. package/dist/components/TextEditor/index.js.map +1 -0
  243. package/dist/components/TextEditor/styles.js +2 -0
  244. package/dist/components/TextEditor/styles.js.map +1 -0
  245. package/dist/components/TextEditor/types.js +2 -0
  246. package/dist/components/TextEditor/types.js.map +1 -0
  247. package/dist/components/TextInput/index.js +65 -0
  248. package/dist/components/TextInput/index.js.map +1 -0
  249. package/dist/components/TextInput/styles.js +2 -0
  250. package/dist/components/TextInput/styles.js.map +1 -0
  251. package/dist/components/TextInput/types.js +2 -0
  252. package/dist/components/TextInput/types.js.map +1 -0
  253. package/dist/components/TextInput/useTextInput.js +64 -0
  254. package/dist/components/TextInput/useTextInput.js.map +1 -0
  255. package/dist/components/Tooltip/index.js +94 -0
  256. package/dist/components/Tooltip/index.js.map +1 -0
  257. package/dist/components/Tooltip/styles.js +2 -0
  258. package/dist/components/Tooltip/styles.js.map +1 -0
  259. package/dist/components/Tooltip/types.js +2 -0
  260. package/dist/components/Tooltip/types.js.map +1 -0
  261. package/dist/components/Touchable/index.js +80 -0
  262. package/dist/components/Touchable/index.js.map +1 -0
  263. package/dist/components/Touchable/styles.js +2 -0
  264. package/dist/components/Touchable/styles.js.map +1 -0
  265. package/dist/components/Touchable/types.js +2 -0
  266. package/dist/components/Touchable/types.js.map +1 -0
  267. package/dist/components/View/index.js +39 -0
  268. package/dist/components/View/index.js.map +1 -0
  269. package/dist/components/View/styles.js +2 -0
  270. package/dist/components/View/styles.js.map +1 -0
  271. package/dist/components/View/types.js +2 -0
  272. package/dist/components/View/types.js.map +1 -0
  273. package/dist/components/components.js +42 -0
  274. package/dist/components/components.js.map +1 -0
  275. package/dist/index.js +5 -0
  276. package/dist/index.js.map +1 -0
  277. package/dist/lib/ListMasonry.js +86 -0
  278. package/dist/lib/ListMasonry.js.map +1 -0
  279. package/dist/lib/ThemeVariables.js +22 -0
  280. package/dist/lib/ThemeVariables.js.map +1 -0
  281. package/dist/lib/WebStyleRegistry.js +69 -0
  282. package/dist/lib/WebStyleRegistry.js.map +1 -0
  283. package/dist/lib/hooks/index.js +23 -0
  284. package/dist/lib/hooks/index.js.map +1 -0
  285. package/dist/lib/hooks/useAnimatedStyle.js +23 -0
  286. package/dist/lib/hooks/useAnimatedStyle.js.map +1 -0
  287. package/dist/lib/hooks/useAnimatedVariantStyles.js +20 -0
  288. package/dist/lib/hooks/useAnimatedVariantStyles.js.map +1 -0
  289. package/dist/lib/hooks/useAsyncSelect.js +57 -0
  290. package/dist/lib/hooks/useAsyncSelect.js.map +1 -0
  291. package/dist/lib/hooks/useBreakpointMatch.js +108 -0
  292. package/dist/lib/hooks/useBreakpointMatch.js.map +1 -0
  293. package/dist/lib/hooks/useClick.js +38 -0
  294. package/dist/lib/hooks/useClick.js.map +1 -0
  295. package/dist/lib/hooks/useClickOutside.js +31 -0
  296. package/dist/lib/hooks/useClickOutside.js.map +1 -0
  297. package/dist/lib/hooks/useFileInput.js +17 -0
  298. package/dist/lib/hooks/useFileInput.js.map +1 -0
  299. package/dist/lib/hooks/useIsomorphicEffect.js +7 -0
  300. package/dist/lib/hooks/useIsomorphicEffect.js.map +1 -0
  301. package/dist/lib/hooks/useKeydown.js +39 -0
  302. package/dist/lib/hooks/useKeydown.js.map +1 -0
  303. package/dist/lib/hooks/useListFocus.js +46 -0
  304. package/dist/lib/hooks/useListFocus.js.map +1 -0
  305. package/dist/lib/hooks/useMediaQuery.js +25 -0
  306. package/dist/lib/hooks/useMediaQuery.js.map +1 -0
  307. package/dist/lib/hooks/usePageExitBlocker.js +44 -0
  308. package/dist/lib/hooks/usePageExitBlocker.js.map +1 -0
  309. package/dist/lib/hooks/usePagination.js +90 -0
  310. package/dist/lib/hooks/usePagination.js.map +1 -0
  311. package/dist/lib/hooks/usePopState.js +31 -0
  312. package/dist/lib/hooks/usePopState.js.map +1 -0
  313. package/dist/lib/hooks/usePopoverDismiss.js +32 -0
  314. package/dist/lib/hooks/usePopoverDismiss.js.map +1 -0
  315. package/dist/lib/hooks/useRefresh.js +67 -0
  316. package/dist/lib/hooks/useRefresh.js.map +1 -0
  317. package/dist/lib/hooks/useScrollEffect.js +19 -0
  318. package/dist/lib/hooks/useScrollEffect.js.map +1 -0
  319. package/dist/lib/hooks/useSearchParams.js +48 -0
  320. package/dist/lib/hooks/useSearchParams.js.map +1 -0
  321. package/dist/lib/hooks/useStaticAnimationStyles.js +16 -0
  322. package/dist/lib/hooks/useStaticAnimationStyles.js.map +1 -0
  323. package/dist/lib/hooks/useStylesFor.js +36 -0
  324. package/dist/lib/hooks/useStylesFor.js.map +1 -0
  325. package/dist/lib/hooks/useTouchableEvents.js +34 -0
  326. package/dist/lib/hooks/useTouchableEvents.js.map +1 -0
  327. package/dist/lib/hooks/useWindowFocus.js +30 -0
  328. package/dist/lib/hooks/useWindowFocus.js.map +1 -0
  329. package/dist/lib/hooks/useWindowSize.js +29 -0
  330. package/dist/lib/hooks/useWindowSize.js.map +1 -0
  331. package/dist/lib/index.js +7 -0
  332. package/dist/lib/index.js.map +1 -0
  333. package/dist/lib/tools/index.js +4 -0
  334. package/dist/lib/tools/index.js.map +1 -0
  335. package/dist/lib/tools/localStorage.js +155 -0
  336. package/dist/lib/tools/localStorage.js.map +1 -0
  337. package/dist/lib/tools/mediaQuery.js +33 -0
  338. package/dist/lib/tools/mediaQuery.js.map +1 -0
  339. package/dist/lib/tools/modal.js +55 -0
  340. package/dist/lib/tools/modal.js.map +1 -0
  341. package/dist/lib/utils/attributes.js +23 -0
  342. package/dist/lib/utils/attributes.js.map +1 -0
  343. package/dist/lib/utils/cache.js +10 -0
  344. package/dist/lib/utils/cache.js.map +1 -0
  345. package/dist/lib/utils/index.js +6 -0
  346. package/dist/lib/utils/index.js.map +1 -0
  347. package/dist/lib/utils/pollyfils/scroll.js +66 -0
  348. package/dist/lib/utils/pollyfils/scroll.js.map +1 -0
  349. package/dist/lib/utils/stopPropagation.js +19 -0
  350. package/dist/lib/utils/stopPropagation.js.map +1 -0
  351. package/dist/lib/utils/test.js +14 -0
  352. package/dist/lib/utils/test.js.map +1 -0
  353. package/dist/types/index.js +2 -0
  354. package/dist/types/index.js.map +1 -0
  355. package/dist/types/utility.js +2 -0
  356. package/dist/types/utility.js.map +1 -0
  357. package/package.json +18 -18
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Touchable/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,39 @@
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
+ import { TypeGuards } from '@codeleap/types';
3
+ import { motion } from 'motion/react';
4
+ import { getTestId } from '../../lib/utils/test';
5
+ import { useStylesFor } from '../../lib/hooks/useStylesFor';
6
+ import { WebStyleRegistry } from '../../lib/WebStyleRegistry';
7
+ export * from './styles';
8
+ export * from './types';
9
+ /**
10
+ * Generic layout wrapper that renders any DOM element with responsive styling,
11
+ * hover callbacks, and optional Framer Motion animation.
12
+ * Uses: `useStylesFor`, `WebStyleRegistry`
13
+ */
14
+ export function View(viewProps) {
15
+ const { component, children, is, not, up, onHover, debugName, down, style, animated, animatedProps, ref, ...props } = {
16
+ ...View.defaultProps,
17
+ ...viewProps,
18
+ };
19
+ const styles = useStylesFor(View.styleRegistryName, style);
20
+ const Component = animated ? (motion?.[component] || motion.div) : (component || 'div');
21
+ function handleHover(isMouseOverElement) {
22
+ onHover?.(isMouseOverElement);
23
+ }
24
+ const hoverProps = TypeGuards.isFunction(onHover) && {
25
+ onMouseEnter: () => handleHover(true),
26
+ onMouseLeave: () => handleHover(false),
27
+ };
28
+ const testId = getTestId(viewProps);
29
+ return (_jsx(Component, { ...hoverProps, ...props, ...animatedProps, ref: ref, "data-testid": testId, css: styles.wrapper, children: children }));
30
+ }
31
+ View.styleRegistryName = 'View';
32
+ View.elements = ['wrapper'];
33
+ View.rootElement = 'wrapper';
34
+ View.defaultProps = {
35
+ component: 'div',
36
+ animated: false,
37
+ };
38
+ WebStyleRegistry.registerComponent(View);
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/View/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAG7D,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AAEvB;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAwB,SAAuB;IACjE,MAAM,EACJ,SAAS,EACT,QAAQ,EACR,EAAE,EACF,GAAG,EACH,EAAE,EACF,OAAO,EACP,SAAS,EACT,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,aAAa,EACb,GAAG,EACH,GAAG,KAAK,EACT,GAAG;QACF,GAAG,IAAI,CAAC,YAAY;QACpB,GAAG,SAAS;KACb,CAAA;IAED,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAE1D,MAAM,SAAS,GAAQ,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,SAAmB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,KAAK,CAAC,CAAA;IAEtG,SAAS,WAAW,CAAC,kBAA2B;QAC9C,OAAO,EAAE,CAAC,kBAAkB,CAAC,CAAA;IAC/B,CAAC;IAED,MAAM,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI;QACnD,YAAY,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC;QACrC,YAAY,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC;KACvC,CAAA;IAED,MAAM,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,CAAA;IAEnC,OAAO,CACL,KAAC,SAAS,OACJ,UAAU,KACV,KAAK,KACL,aAAa,EACjB,GAAG,EAAE,GAAG,iBACK,MAAM,EACnB,GAAG,EAAE,MAAM,CAAC,OAAO,YAElB,QAAQ,GACC,CACb,CAAA;AACH,CAAC;AAED,IAAI,CAAC,iBAAiB,GAAG,MAAM,CAAA;AAC/B,IAAI,CAAC,QAAQ,GAAG,CAAC,SAAS,CAAC,CAAA;AAC3B,IAAI,CAAC,WAAW,GAAG,SAAS,CAAA;AAG5B,IAAI,CAAC,YAAY,GAAG;IAClB,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,KAAK;CACM,CAAA;AAEvB,gBAAgB,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/View/styles.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/View/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,42 @@
1
+ export * from './View';
2
+ export * from './Icon';
3
+ export * from './Touchable';
4
+ export * from './Text';
5
+ export * from './Slider';
6
+ export * from './List';
7
+ export * from './ActivityIndicator';
8
+ export * from './Button';
9
+ export * from './Modal';
10
+ export * from './Checkbox';
11
+ export * from './Collapse';
12
+ export * from './Drawer';
13
+ export * from './Overlay';
14
+ export * from './TextInput';
15
+ export * from './MaskedTextInput';
16
+ export * from './RadioInput';
17
+ export * from './Select';
18
+ export * from './FileInput';
19
+ export * from './Slider';
20
+ export * from './List';
21
+ export * from './LoadingOverlay';
22
+ export * from './Switch';
23
+ export * from './NumberIncrement';
24
+ export * from './SearchInput';
25
+ export * from './Tooltip';
26
+ export * from './Field';
27
+ export * from './Carousel';
28
+ export * from './EmptyPlaceholder';
29
+ export * from './Badge';
30
+ export * from './CropPicker';
31
+ export * from './Calendar';
32
+ export * from './DatePicker';
33
+ export * from './Dropzone';
34
+ export * from './Progress';
35
+ export * from './Tag';
36
+ export * from './TextEditor';
37
+ export * from './ColorPicker';
38
+ export * from './PaginationButtons';
39
+ export * from './SectionFilters';
40
+ export * from './PaginationIndicator';
41
+ export * from './Carousel';
42
+ //# sourceMappingURL=components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/components/components.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,qBAAqB,CAAA;AACnC,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,kBAAkB,CAAA;AAChC,cAAc,UAAU,CAAA;AACxB,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,OAAO,CAAA;AACrB,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA;AACrC,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export * from './components/components';
2
+ export * from './types';
3
+ export * from './lib';
4
+ export * from './lib/WebStyleRegistry';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,SAAS,CAAA;AACvB,cAAc,OAAO,CAAA;AACrB,cAAc,wBAAwB,CAAA"}
@@ -0,0 +1,86 @@
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
+ import React from 'react';
3
+ import { useWindowSize } from '@react-hook/window-size';
4
+ import { TypeGuards } from '@codeleap/types';
5
+ import { EmptyPlaceholder } from '../components/EmptyPlaceholder';
6
+ import { useMasonry, usePositioner, useScroller, useContainerPosition, useResizeObserver, } from 'masonic';
7
+ function fillItems(arr, toCount, fillContent = {}) {
8
+ if (!arr || !TypeGuards.isArray(arr))
9
+ return [];
10
+ if (toCount === arr?.length)
11
+ return arr;
12
+ const diff = toCount - arr?.length;
13
+ if (diff < 0)
14
+ return arr;
15
+ const right = Array(diff).fill(fillContent);
16
+ return arr.concat(right);
17
+ }
18
+ export const useMasonryReload = (args) => {
19
+ const { data, reloadTimeout = 350, } = args;
20
+ const [reloadingLayout, setReloadingLayout] = React.useState(false);
21
+ const previousLengthRef = React.useRef(data?.length ?? 0);
22
+ const updater = () => {
23
+ previousLengthRef.current = (data?.length ?? 0);
24
+ };
25
+ React.useEffect(() => {
26
+ if (previousLengthRef.current > data?.length) {
27
+ setReloadingLayout(true);
28
+ setTimeout(() => {
29
+ updater();
30
+ setTimeout(() => {
31
+ setReloadingLayout(false);
32
+ }, reloadTimeout);
33
+ }, reloadTimeout);
34
+ }
35
+ else {
36
+ updater();
37
+ }
38
+ }, [data?.length]);
39
+ return {
40
+ reloadingLayout,
41
+ setReloadingLayout,
42
+ previousLength: previousLengthRef.current,
43
+ };
44
+ };
45
+ export function MasonryComponent(props) {
46
+ const containerRef = React.useRef(null);
47
+ const windowSize = useWindowSize({
48
+ initialWidth: props?.ssrWidth,
49
+ initialHeight: props?.ssrHeight,
50
+ });
51
+ const containerPosition = useContainerPosition(containerRef, windowSize);
52
+ const listProps = Object.assign({
53
+ offset: containerPosition?.offset,
54
+ width: containerPosition?.width || containerRef?.current?.clientWidth || windowSize?.[0],
55
+ height: windowSize?.[1],
56
+ containerRef,
57
+ scrollFps: props?.scrollFps || 12,
58
+ }, props);
59
+ const positioner = usePositioner({
60
+ width: listProps?.width,
61
+ columnGutter: listProps?.columnGutter,
62
+ columnWidth: listProps?.columnWidth,
63
+ columnCount: listProps?.columnCount,
64
+ maxColumnCount: listProps?.columnCount,
65
+ rowGutter: listProps?.rowGutter
66
+ });
67
+ const { scrollTop, isScrolling } = useScroller(listProps?.offset, listProps?.scrollFps);
68
+ const resizeObserver = useResizeObserver(positioner);
69
+ return useMasonry({
70
+ ...listProps,
71
+ resizeObserver,
72
+ positioner,
73
+ scrollTop,
74
+ isScrolling,
75
+ items: fillItems(props?.items, props?.previousItemsLength)
76
+ });
77
+ }
78
+ export function ListMasonry(props) {
79
+ if (props?.reloadingLayout) {
80
+ return (_jsx(EmptyPlaceholder, { loading: true, title: '', description: null }));
81
+ }
82
+ else {
83
+ return (_jsx(MasonryComponent, { ...props, items: props?.items || [] }));
84
+ }
85
+ }
86
+ //# sourceMappingURL=ListMasonry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListMasonry.js","sourceRoot":"","sources":["../../src/lib/ListMasonry.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAEjE,OAAO,EACL,UAAU,EACV,aAAa,EACb,WAAW,EACX,oBAAoB,EACpB,iBAAiB,GAGlB,MAAM,SAAS,CAAA;AAEhB,SAAS,SAAS,CAAC,GAAe,EAAE,OAAe,EAAE,WAAW,GAAG,EAAE;IACnE,IAAI,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,CAAA;IAE/C,IAAI,OAAO,KAAK,GAAG,EAAE,MAAM;QAAE,OAAO,GAAG,CAAA;IAEvC,MAAM,IAAI,GAAG,OAAO,GAAG,GAAG,EAAE,MAAM,CAAA;IAElC,IAAI,IAAI,GAAG,CAAC;QAAE,OAAO,GAAG,CAAA;IAExB,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;IAE3C,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC1B,CAAC;AAOD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAA0B,EAAE,EAAE;IAC7D,MAAM,EACJ,IAAI,EACJ,aAAa,GAAG,GAAG,GACpB,GAAG,IAAI,CAAA;IAER,MAAM,CAAC,eAAe,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A;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
+ import { DOM_COLOR_SCHEME_KEY } from '@codeleap/styles';
3
+ const toDeclarations = (vars) => Object.entries(vars).map(([n, v]) => ` ${n}: ${v};`).join('\n');
4
+ export const ThemeVariables = ({ theme }) => {
5
+ const defaultVars = theme.getCssVariables();
6
+ const alternateColors = theme.alternateColors ?? {};
7
+ const blocks = [
8
+ `:root {\n${toDeclarations(defaultVars)}\n}`,
9
+ `[data-color-scheme="light"] {\n${toDeclarations(defaultVars)}\n}`,
10
+ ];
11
+ for (const scheme of Object.keys(alternateColors)) {
12
+ const vars = theme.getCssVariables(scheme);
13
+ if (scheme === 'dark') {
14
+ blocks.push(`@media (prefers-color-scheme: dark) {\n :root:not([data-color-scheme="light"]) {\n${toDeclarations(vars)}\n }\n}`);
15
+ }
16
+ blocks.push(`[data-color-scheme="${scheme}"] {\n${toDeclarations(vars)}\n}`);
17
+ }
18
+ return _jsx("style", { dangerouslySetInnerHTML: { __html: blocks.join('\n\n') } });
19
+ };
20
+ const FOUC_SCRIPT = `(function(){try{var s=localStorage.getItem('${DOM_COLOR_SCHEME_KEY}');if(s&&s!=='default')document.documentElement.dataset.colorScheme=s;}catch(e){}})()`;
21
+ export const ColorSchemeFoucScript = () => (_jsx("script", { dangerouslySetInnerHTML: { __html: FOUC_SCRIPT } }));
22
+ //# sourceMappingURL=ThemeVariables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeVariables.js","sourceRoot":"","sources":["../../src/lib/ThemeVariables.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAOvD,MAAM,cAAc,GAAG,CAAC,IAA4B,EAAE,EAAE,CACtD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAElE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,KAAK,EAAkC,EAAE,EAAE;IAC1E,MAAM,WAAW,GAAG,KAAK,CAAC,eAAe,EAAE,CAAA;IAC3C,MAAM,eAAe,GAAG,KAAK,CAAC,eAAe,IAAI,EAAE,CAAA;IAEnD,MAAM,MAAM,GAAa;QACvB,YAAY,cAAc,CAAC,WAAW,CAAC,KAAK;QAC5C,kCAAkC,cAAc,CAAC,WAAW,CAAC,KAAK;KACnE,CAAA;IAED,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;QAClD,MAAM,IAAI,GAAG,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;QAC1C,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,MAAM,CAAC,IAAI,CACT,sFAAsF,cAAc,CAAC,IAAI,CAAC,UAAU,CACrH,CAAA;QACH,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,uBAAuB,MAAM,SAAS,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC9E,CAAC;IAED,OAAO,gBAAO,uBAAuB,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAI,CAAA;AAC5E,CAAC,CAAA;AAED,MAAM,WAAW,GAAG,+CAA+C,oBAAoB,uFAAuF,CAAA;AAE9K,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE,CAAC,CACzC,iBAAQ,uBAAuB,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,GAAI,CAC7D,CAAA"}
@@ -0,0 +1,69 @@
1
+ import { CodeleapStyleRegistry, StylePersistor } from '@codeleap/styles';
2
+ const persistor = new StylePersistor({
3
+ set(key, value) {
4
+ if (typeof window === 'undefined')
5
+ return null;
6
+ return localStorage?.setItem(key, value);
7
+ },
8
+ get(key) {
9
+ if (typeof window === 'undefined')
10
+ return null;
11
+ return localStorage?.getItem(key);
12
+ },
13
+ del(key) {
14
+ if (typeof window === 'undefined')
15
+ return null;
16
+ return localStorage?.removeItem(key);
17
+ },
18
+ });
19
+ let instance;
20
+ const components = [];
21
+ /**
22
+ * Singleton style registry for the web platform.
23
+ *
24
+ * Extends `CodeleapStyleRegistry` with localStorage-backed style persistence
25
+ * and a variant-element map that tracks which HTML element tag should be used
26
+ * for each component variant.
27
+ *
28
+ * Only one instance exists per JS runtime. The first `new WebStyleRegistry()`
29
+ * call creates the instance; subsequent calls return the same object. Components
30
+ * register themselves via the static `WebStyleRegistry.registerComponent()` —
31
+ * call this at module level so registrations survive before the registry is
32
+ * instantiated (they are replayed on construction).
33
+ *
34
+ * Access the live singleton via `WebStyleRegistry.current`.
35
+ */
36
+ export class WebStyleRegistry extends CodeleapStyleRegistry {
37
+ variantElements = {};
38
+ constructor() {
39
+ super(persistor);
40
+ components.forEach((component) => {
41
+ this.registerComponent(component);
42
+ });
43
+ if (!instance) {
44
+ instance = this;
45
+ }
46
+ return instance;
47
+ }
48
+ /** Registers the HTML element tag to render for each variant of a component (e.g. `{ h1: 'h1', p: 'p' }`). */
49
+ registerVariantElements(componentName, elements) {
50
+ this.variantElements[componentName] = elements;
51
+ }
52
+ /** Returns the element tag registered for the given component variant, or `undefined` if none was registered. */
53
+ variantElementFor(componentName, variantName) {
54
+ return this.variantElements[componentName]?.[variantName];
55
+ }
56
+ createStyle(css) {
57
+ return css;
58
+ }
59
+ static get current() {
60
+ return instance;
61
+ }
62
+ static registerComponent(component) {
63
+ components.push(component);
64
+ if (instance) {
65
+ instance.registerComponent(component);
66
+ }
67
+ }
68
+ }
69
+ //# sourceMappingURL=WebStyleRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebStyleRegistry.js","sourceRoot":"","sources":["../../src/lib/WebStyleRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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AAO,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE,CAAC,WAAW,CAAC,CAAA;IAC3D,CAAC;IAED,WAAW,CAAC,GAAS;QACnB,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,MAAM,KAAK,OAAO;QAChB,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,MAAM,CAAC,iBAAiB,CAAC,SAA6B;QACpD,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAC1B,IAAI,QAAQ,EAAE,CAAC;YACb,QAAQ,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAA;QACvC,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,23 @@
1
+ export * from './useAnimatedStyle';
2
+ export * from './useAnimatedVariantStyles';
3
+ export * from './useBreakpointMatch';
4
+ export * from './useClick';
5
+ export * from './useClickOutside';
6
+ export * from './useMediaQuery';
7
+ export * from './usePageExitBlocker';
8
+ export * from './usePagination';
9
+ export * from './usePopState';
10
+ export * from './useScrollEffect';
11
+ export * from './useIsomorphicEffect';
12
+ export * from './useSearchParams';
13
+ export * from './useStaticAnimationStyles';
14
+ export * from './useWindowFocus';
15
+ export * from './useWindowSize';
16
+ export * from './useKeydown';
17
+ export * from './useRefresh';
18
+ export * from './useFileInput';
19
+ export * from './useStylesFor';
20
+ export * from './useAsyncSelect';
21
+ export * from './useListFocus';
22
+ export * from './usePopoverDismiss';
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,mBAAmB,CAAA;AACjC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAEhC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA"}
@@ -0,0 +1,23 @@
1
+ import { useRef, useEffect, useState } from 'react';
2
+ /**
3
+ * Drives a Framer Motion `animate` prop from a reactive updater function.
4
+ *
5
+ * The transition from the initial call is captured once and held stable; only
6
+ * the animated target re-evaluates on dependency changes. Returns `initial: false`
7
+ * so Motion skips the mount animation and begins from the current state.
8
+ */
9
+ export const useAnimatedStyle = (updater, deps) => {
10
+ const initialStyle = updater();
11
+ const [animatedStyle, setAnimatedStyle] = useState(initialStyle);
12
+ const transition = useRef(initialStyle.transition);
13
+ useEffect(() => {
14
+ const animatedStyleUpdated = updater();
15
+ setAnimatedStyle(animatedStyleUpdated);
16
+ }, deps);
17
+ return {
18
+ animate: animatedStyle,
19
+ transition: transition.current,
20
+ initial: false,
21
+ };
22
+ };
23
+ //# sourceMappingURL=useAnimatedStyle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnimatedStyle.js","sourceRoot":"","sources":["../../../src/lib/hooks/useAnimatedStyle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAanD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAA4B,EAAE,IAAgB,EAA0B,EAAE;IACzG,MAAM,YAAY,GAAG,OAAO,EAAE,CAAA;IAE9B,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAsB,YAAY,CAAC,CAAA;IACrF,MAAM,UAAU,GAAG,MAAM,CAAyB,YAAY,CAAC,UAAU,CAAC,CAAA;IAE1E,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,oBAAoB,GAAG,OAAO,EAAE,CAAA;QAEtC,gBAAgB,CAAC,oBAAoB,CAAC,CAAA;IACxC,CAAC,EAAE,IAAI,CAAC,CAAA;IAER,OAAO;QACL,OAAO,EAAE,aAAa;QACtB,UAAU,EAAE,UAAU,CAAC,OAAO;QAC9B,OAAO,EAAE,KAAK;KACf,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,20 @@
1
+ import { useStaticAnimationStyles } from './useStaticAnimationStyles';
2
+ import { useState, useEffect } from 'react';
3
+ /**
4
+ * Derives a Framer Motion animation target from a component's variant styles,
5
+ * animating only the properties listed in `animatedProperties` while keeping the
6
+ * rest static (via `useStaticAnimationStyles`). Re-evaluates the `updater` whenever
7
+ * `dependencies` change.
8
+ */
9
+ export function useAnimatedVariantStyles(config) {
10
+ const { animatedProperties, updater, variantStyles, dependencies = [] } = config;
11
+ const staticStyles = useStaticAnimationStyles(variantStyles, animatedProperties);
12
+ const initialState = updater(staticStyles);
13
+ const [animated, setAnimated] = useState(initialState);
14
+ useEffect(() => {
15
+ const nextState = updater(staticStyles);
16
+ setAnimated(nextState);
17
+ }, dependencies);
18
+ return animated;
19
+ }
20
+ //# sourceMappingURL=useAnimatedVariantStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAnimatedVariantStyles.js","sourceRoot":"","sources":["../../../src/lib/hooks/useAnimatedVariantStyles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAS3C;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAqE,MAA4C;IACvJ,MAAM,EAAE,kBAAkB,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,GAAG,EAAE,EAAE,GAAG,MAAM,CAAA;IAEhF,MAAM,YAAY,GAAG,wBAAwB,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAA;IAEhF,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;IAE1C,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAA;IAEtD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;QAEvC,WAAW,CAAC,SAAS,CAAC,CAAA;IACxB,CAAC,EAAE,YAAY,CAAC,CAAA;IAEhB,OAAO,QAAQ,CAAA;AACjB,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { useState, useId, useCallback } from 'react';
2
+ import { useQuery } from '@tanstack/react-query';
3
+ /**
4
+ * Wraps TanStack Query to power a search-driven async Select component.
5
+ *
6
+ * Returns a `[selectProps, state]` tuple. Spread the first element onto a
7
+ * `Select` component; use the second to drive the search query and inspect
8
+ * loading / error state.
9
+ *
10
+ * The query is gated by `isSearchValid` (defaults to non-empty/non-null).
11
+ * Pass `isSearchValid: () => true` to fetch on mount with an empty query.
12
+ * Requires a TanStack Query `QueryClientProvider` in the tree.
13
+ */
14
+ export function useAsyncSelect(opts) {
15
+ const { load, isSearchValid, renderError, renderNoResults, renderLoading, queryOptions, } = opts;
16
+ const hookId = useId();
17
+ const baseKey = opts.queryKey ?? [hookId];
18
+ const [searchQuery, setSearchQuery] = useState('');
19
+ const defaultIsValid = (q) => q != null && q !== '';
20
+ const enabled = isSearchValid ? isSearchValid(searchQuery) : defaultIsValid(searchQuery);
21
+ const queryResult = useQuery({
22
+ queryKey: ['asyncSelect', ...baseKey, searchQuery],
23
+ queryFn: () => load(searchQuery),
24
+ enabled,
25
+ placeholderData: (prev) => prev,
26
+ ...queryOptions,
27
+ });
28
+ const query = useCallback((q) => setSearchQuery(q), []);
29
+ const renderEmpty = useCallback(({ style }) => {
30
+ if (queryResult.isLoading || queryResult.isFetching) {
31
+ return renderLoading?.(style) ?? null;
32
+ }
33
+ if (queryResult.isError) {
34
+ return renderError?.(queryResult.error, style) ?? null;
35
+ }
36
+ return renderNoResults?.(searchQuery, style) ?? null;
37
+ }, [
38
+ queryResult.isLoading, queryResult.isFetching,
39
+ queryResult.isError, queryResult.error,
40
+ renderLoading, renderError, renderNoResults, searchQuery,
41
+ ]);
42
+ return [
43
+ {
44
+ options: (queryResult.data?.results ?? []),
45
+ renderEmpty,
46
+ },
47
+ {
48
+ query,
49
+ searchQuery,
50
+ data: queryResult.data?.data ?? null,
51
+ isLoading: queryResult.isLoading,
52
+ error: queryResult.error,
53
+ queryResult,
54
+ },
55
+ ];
56
+ }
57
+ //# sourceMappingURL=useAsyncSelect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAsyncSelect.js","sourceRoot":"","sources":["../../../src/lib/hooks/useAsyncSelect.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAA6C,MAAM,uBAAuB,CAAA;AAsD3F;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc,CAI5B,IAA4C;IAE5C,MAAM,EACJ,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,GAC/E,GAAG,IAAI,CAAA;IAER,MAAM,MAAM,GAAG,KAAK,EAAE,CAAA;IACtB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,IAAI,CAAC,MAAM,CAAC,CAAA;IAEzC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAS,EAAY,CAAC,CAAA;IAEpE,MAAM,cAAc,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,KAAM,EAAa,CAAA;IACvE,MAAM,OAAO,GAAG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AAW,CAAC,IAAI,EAAE,IAAI,IAAI,IAAI;YACpC,SAAS,EAAE,WAAW,CAAC,SAAS;YAChC,KAAK,EAAE,WAAW,CAAC,KAAK;YACxB,WAAW;SACZ;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,108 @@
1
+ import { useEffect, useMemo, useRef, useState } from 'react';
2
+ import { TypeGuards } from '@codeleap/types';
3
+ import { themeStore } from '@codeleap/styles';
4
+ import { getMediaQuery, isMediaQuery } from '../tools';
5
+ const getTheme = () => themeStore.themeTyped;
6
+ function validateBreakpoint(currentTheme, breakpoint) {
7
+ const matchesDown = isMediaQuery(currentTheme.media.down(breakpoint));
8
+ const matchesUp = isMediaQuery(currentTheme.media.up(breakpoint));
9
+ return !matchesUp && matchesDown;
10
+ }
11
+ function useBreakpointMatches() {
12
+ return useState(() => {
13
+ const currentTheme = getTheme();
14
+ const breakpointMatches = {};
15
+ for (const breakpoint in currentTheme.breakpoints) {
16
+ breakpointMatches[breakpoint] = validateBreakpoint(currentTheme, breakpoint);
17
+ }
18
+ return breakpointMatches;
19
+ });
20
+ }
21
+ function useBreakpointListeners() {
22
+ const [breakpointMatches, setBreakpointMatches] = useBreakpointMatches();
23
+ const loaded = useRef(false);
24
+ const mediaQueries = useRef({});
25
+ function callback(event, breakpoint) {
26
+ const currentTheme = getTheme();
27
+ setBreakpointMatches((prevState) => {
28
+ const updatedMatches = { ...prevState };
29
+ updatedMatches[breakpoint] = validateBreakpoint(currentTheme, breakpoint);
30
+ return updatedMatches;
31
+ });
32
+ }
33
+ useEffect(() => {
34
+ if (loaded.current)
35
+ return;
36
+ loaded.current = true;
37
+ const currentTheme = getTheme();
38
+ for (const breakpoint in currentTheme.breakpoints) {
39
+ const queryUp = getMediaQuery(currentTheme.media.up(breakpoint));
40
+ const matchUp = window.matchMedia(queryUp);
41
+ mediaQueries.current[breakpoint] = matchUp;
42
+ try {
43
+ matchUp.addEventListener('change', (event) => callback(event, breakpoint));
44
+ }
45
+ catch {
46
+ matchUp.addListener((event) => callback(event, breakpoint));
47
+ }
48
+ }
49
+ return () => {
50
+ for (const breakpoint in mediaQueries.current) {
51
+ const matchUp = mediaQueries.current[breakpoint];
52
+ try {
53
+ matchUp.removeEventListener('change', (event) => callback(event, breakpoint));
54
+ }
55
+ catch {
56
+ matchUp.removeListener((event) => callback(event, breakpoint));
57
+ }
58
+ }
59
+ mediaQueries.current = {};
60
+ };
61
+ }, []);
62
+ return breakpointMatches;
63
+ }
64
+ /**
65
+ * Returns the value mapped to the currently active breakpoint.
66
+ *
67
+ * Reads breakpoint definitions from the active `themeStore` theme and attaches
68
+ * `matchMedia` listeners to track viewport changes reactively. The lookup walks
69
+ * up from the current breakpoint until it finds a key present in `values`, so
70
+ * you can omit smaller breakpoints and let them fall back to the next larger one.
71
+ *
72
+ * Must be rendered in a browser context; SSR always resolves to the fallback
73
+ * value (the largest defined key in `values`).
74
+ */
75
+ export function useBreakpointMatch(values) {
76
+ const breakpointMatches = useBreakpointListeners();
77
+ const breakpoints = useMemo(() => {
78
+ return Object.entries(getTheme().breakpoints)
79
+ .sort(([, a], [, b]) => a - b)
80
+ .reduce((acc, [key, value]) => {
81
+ acc[key] = value;
82
+ return acc;
83
+ }, {});
84
+ }, []);
85
+ const breakpointValues = useMemo(() => {
86
+ return Object.keys(breakpoints).sort((a, b) => breakpoints?.[a] - breakpoints?.[b]);
87
+ }, []);
88
+ const currentBreakpoint = useMemo(() => {
89
+ return Object.keys(breakpointMatches).find((key) => breakpointMatches[key]);
90
+ }, [breakpointMatches]);
91
+ const breakpoint = useMemo(() => {
92
+ const validBreakpointIndex = breakpointValues?.findIndex(key => key === currentBreakpoint);
93
+ const validBreakpoints = breakpointValues?.slice(validBreakpointIndex, 100);
94
+ let validBreakpoint = null;
95
+ validBreakpoint = validBreakpoints?.find((currentValue) => {
96
+ if (Object?.keys(values)?.includes(currentValue)) {
97
+ return currentValue;
98
+ }
99
+ });
100
+ if (TypeGuards.isNil(validBreakpoint)) {
101
+ validBreakpoint = breakpointValues?.reverse()?.find(key => !!values?.[key]);
102
+ }
103
+ return validBreakpoint;
104
+ }, [currentBreakpoint]);
105
+ const value = useMemo(() => values?.[breakpoint], [breakpoint]);
106
+ return value;
107
+ }
108
+ //# sourceMappingURL=useBreakpointMatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBreakpointMatch.js","sourceRoot":"","sources":["../../../src/lib/hooks/useBreakpointMatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAmB,UAAU,EAAc,MAAM,kBAAkB,CAAA;AAC1E,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEtD,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,UAAU,CAAA;AAE5C,SAAS,kBAAkB,CAAC,YAA6B,EAAE,UAAkB;IAC3E,MAAM,WAAW,GAAG,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,UAAmB,CAAC,CAAC,CAAA;IAC9E,MAAM,SAAS,GAAG,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,UAAmB,CAAC,CAAC,CAAA;IAE1E,OAAO,CAAC,SAAS,IAAI,WAAW,CAAA;AAClC,CAAC;AAED,SAAS,oBAAoB;IAC3B,OAAO,QAAQ,CAA0B,GAAG,EAAE;QAC5C,MAAM,YAAY,GAAG,QAAQ,EAAE,CAAA;QAE/B,MAAM,iBAAiB,GAA4B,EAAE,CAAA;QAErD,KAAK,MAAM,UAAU,IAAI,YAAY,CAAC,WAAW,EAAE,CAAC;YAClD,iBAAiB,CAAC,UAAU,CAAC,GAAG,kBAAkB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAA;QAC9E,CAAC;QAED,OAAO,iBAAiB,CAAA;IAC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CAAC,CAAC,CAAA;QAC7E,CAAC;QAED,OAAO,eAAe,CAAA;IACxB,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAA;IAEvB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAA;IAE/D,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { TypeGuards } from '@codeleap/types';
2
+ import { useEffect, useRef, useCallback } from 'react';
3
+ /**
4
+ * Attaches a global `click` listener and calls `handler` with `true` when the
5
+ * user clicks outside the returned ref's element, or `false` when they click
6
+ * inside it. Pass additional `elements` refs to treat those nodes as "inside"
7
+ * as well — the handler fires `false` if any of them contains the click target.
8
+ */
9
+ export function useClickOutsideElement(handler, elements = null) {
10
+ const elementRef = useRef(null);
11
+ const handleClickOutside = useCallback((event) => {
12
+ if (!elementRef.current)
13
+ return;
14
+ const clickedOutsideElement = !elementRef.current.contains(event?.target);
15
+ const clickedOutsideElements = [true];
16
+ if (TypeGuards?.isArray(elements)) {
17
+ elements?.forEach(element => {
18
+ if (element.current) {
19
+ clickedOutsideElements.push(!element.current.contains(event?.target));
20
+ }
21
+ });
22
+ }
23
+ if (clickedOutsideElement && clickedOutsideElements.every((clickedOutside) => !!clickedOutside)) {
24
+ handler(true);
25
+ }
26
+ else {
27
+ handler(false);
28
+ }
29
+ }, [handler]);
30
+ useEffect(() => {
31
+ document.addEventListener('click', handleClickOutside);
32
+ return () => {
33
+ document.removeEventListener('click', handleClickOutside);
34
+ };
35
+ }, [handleClickOutside]);
36
+ return elementRef;
37
+ }
38
+ //# sourceMappingURL=useClick.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useClick.js","sourceRoot":"","sources":["../../../src/lib/hooks/useClick.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAc,EAAE,SA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