@codeleap/web 7.0.0 → 7.0.2

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 (361) hide show
  1. package/dist/components/ActivityIndicator/index.js +46 -0
  2. package/dist/components/ActivityIndicator/index.js.map +1 -0
  3. package/dist/components/ActivityIndicator/styles.js +3 -0
  4. package/dist/components/ActivityIndicator/styles.js.map +1 -0
  5. package/dist/components/ActivityIndicator/types.js +3 -0
  6. package/dist/components/ActivityIndicator/types.js.map +1 -0
  7. package/dist/components/Badge/index.js +86 -0
  8. package/dist/components/Badge/index.js.map +1 -0
  9. package/dist/components/Badge/styles.js +3 -0
  10. package/dist/components/Badge/styles.js.map +1 -0
  11. package/dist/components/Badge/types.js +3 -0
  12. package/dist/components/Badge/types.js.map +1 -0
  13. package/dist/components/Button/index.js +69 -0
  14. package/dist/components/Button/index.js.map +1 -0
  15. package/dist/components/Button/styles.js +3 -0
  16. package/dist/components/Button/styles.js.map +1 -0
  17. package/dist/components/Button/types.js +3 -0
  18. package/dist/components/Button/types.js.map +1 -0
  19. package/dist/components/Calendar/index.js +67 -0
  20. package/dist/components/Calendar/index.js.map +1 -0
  21. package/dist/components/Calendar/styles.js +3 -0
  22. package/dist/components/Calendar/styles.js.map +1 -0
  23. package/dist/components/Calendar/types.js +3 -0
  24. package/dist/components/Calendar/types.js.map +1 -0
  25. package/dist/components/Carousel/index.js +171 -0
  26. package/dist/components/Carousel/index.js.map +1 -0
  27. package/dist/components/Carousel/styles.js +3 -0
  28. package/dist/components/Carousel/styles.js.map +1 -0
  29. package/dist/components/Carousel/types.js +3 -0
  30. package/dist/components/Carousel/types.js.map +1 -0
  31. package/dist/components/Checkbox/index.js +62 -0
  32. package/dist/components/Checkbox/index.js.map +1 -0
  33. package/dist/components/Checkbox/styles.js +3 -0
  34. package/dist/components/Checkbox/styles.js.map +1 -0
  35. package/dist/components/Checkbox/types.js +3 -0
  36. package/dist/components/Checkbox/types.js.map +1 -0
  37. package/dist/components/Collapse/index.js +45 -0
  38. package/dist/components/Collapse/index.js.map +1 -0
  39. package/dist/components/Collapse/styles.js +3 -0
  40. package/dist/components/Collapse/styles.js.map +1 -0
  41. package/dist/components/Collapse/types.js +3 -0
  42. package/dist/components/Collapse/types.js.map +1 -0
  43. package/dist/components/ColorPicker/index.js +83 -0
  44. package/dist/components/ColorPicker/index.js.map +1 -0
  45. package/dist/components/ColorPicker/styles.js +3 -0
  46. package/dist/components/ColorPicker/styles.js.map +1 -0
  47. package/dist/components/ColorPicker/types.js +3 -0
  48. package/dist/components/ColorPicker/types.js.map +1 -0
  49. package/dist/components/CropPicker/hooks.d.ts +2 -2
  50. package/dist/components/CropPicker/hooks.js +133 -0
  51. package/dist/components/CropPicker/hooks.js.map +1 -0
  52. package/dist/components/CropPicker/index.js +56 -0
  53. package/dist/components/CropPicker/index.js.map +1 -0
  54. package/dist/components/CropPicker/styles.js +3 -0
  55. package/dist/components/CropPicker/styles.js.map +1 -0
  56. package/dist/components/CropPicker/types.js +3 -0
  57. package/dist/components/CropPicker/types.js.map +1 -0
  58. package/dist/components/CropPicker/utils.js +76 -0
  59. package/dist/components/CropPicker/utils.js.map +1 -0
  60. package/dist/components/DatePicker/index.js +87 -0
  61. package/dist/components/DatePicker/index.js.map +1 -0
  62. package/dist/components/DatePicker/styles.js +3 -0
  63. package/dist/components/DatePicker/styles.js.map +1 -0
  64. package/dist/components/DatePicker/types.js +3 -0
  65. package/dist/components/DatePicker/types.js.map +1 -0
  66. package/dist/components/Drawer/index.js +68 -0
  67. package/dist/components/Drawer/index.js.map +1 -0
  68. package/dist/components/Drawer/styles.js +3 -0
  69. package/dist/components/Drawer/styles.js.map +1 -0
  70. package/dist/components/Drawer/types.js +3 -0
  71. package/dist/components/Drawer/types.js.map +1 -0
  72. package/dist/components/Dropzone/context.js +44 -0
  73. package/dist/components/Dropzone/context.js.map +1 -0
  74. package/dist/components/Dropzone/elements.js +57 -0
  75. package/dist/components/Dropzone/elements.js.map +1 -0
  76. package/dist/components/Dropzone/index.js +89 -0
  77. package/dist/components/Dropzone/index.js.map +1 -0
  78. package/dist/components/Dropzone/styles.js +3 -0
  79. package/dist/components/Dropzone/styles.js.map +1 -0
  80. package/dist/components/Dropzone/types.js +3 -0
  81. package/dist/components/Dropzone/types.js.map +1 -0
  82. package/dist/components/Dropzone/useDropzone.js +20 -0
  83. package/dist/components/Dropzone/useDropzone.js.map +1 -0
  84. package/dist/components/EmptyPlaceholder/index.js +86 -0
  85. package/dist/components/EmptyPlaceholder/index.js.map +1 -0
  86. package/dist/components/EmptyPlaceholder/styles.js +3 -0
  87. package/dist/components/EmptyPlaceholder/styles.js.map +1 -0
  88. package/dist/components/EmptyPlaceholder/types.js +3 -0
  89. package/dist/components/EmptyPlaceholder/types.js.map +1 -0
  90. package/dist/components/Field/context.js +58 -0
  91. package/dist/components/Field/context.js.map +1 -0
  92. package/dist/components/Field/elements.js +92 -0
  93. package/dist/components/Field/elements.js.map +1 -0
  94. package/dist/components/Field/index.js +55 -0
  95. package/dist/components/Field/index.js.map +1 -0
  96. package/dist/components/Field/styles.js +3 -0
  97. package/dist/components/Field/styles.js.map +1 -0
  98. package/dist/components/Field/types.js +3 -0
  99. package/dist/components/Field/types.js.map +1 -0
  100. package/dist/components/Field/useFieldInput.d.ts +1 -1
  101. package/dist/components/Field/useFieldInput.js +50 -0
  102. package/dist/components/Field/useFieldInput.js.map +1 -0
  103. package/dist/components/FileInput/index.js +73 -0
  104. package/dist/components/FileInput/index.js.map +1 -0
  105. package/dist/components/FileInput/types.js +3 -0
  106. package/dist/components/FileInput/types.js.map +1 -0
  107. package/dist/components/Icon/index.js +69 -0
  108. package/dist/components/Icon/index.js.map +1 -0
  109. package/dist/components/Icon/styles.js +3 -0
  110. package/dist/components/Icon/styles.js.map +1 -0
  111. package/dist/components/Icon/types.js +3 -0
  112. package/dist/components/Icon/types.js.map +1 -0
  113. package/dist/components/List/context.js +81 -0
  114. package/dist/components/List/context.js.map +1 -0
  115. package/dist/components/List/elements.js +164 -0
  116. package/dist/components/List/elements.js.map +1 -0
  117. package/dist/components/List/index.js +52 -0
  118. package/dist/components/List/index.js.map +1 -0
  119. package/dist/components/List/scroll.js +80 -0
  120. package/dist/components/List/scroll.js.map +1 -0
  121. package/dist/components/List/styles.js +3 -0
  122. package/dist/components/List/styles.js.map +1 -0
  123. package/dist/components/List/types.js +3 -0
  124. package/dist/components/List/types.js.map +1 -0
  125. package/dist/components/LoadingOverlay/index.js +50 -0
  126. package/dist/components/LoadingOverlay/index.js.map +1 -0
  127. package/dist/components/LoadingOverlay/styles.js +3 -0
  128. package/dist/components/LoadingOverlay/styles.js.map +1 -0
  129. package/dist/components/LoadingOverlay/types.js +3 -0
  130. package/dist/components/LoadingOverlay/types.js.map +1 -0
  131. package/dist/components/MaskedTextInput/index.js +52 -0
  132. package/dist/components/MaskedTextInput/index.js.map +1 -0
  133. package/dist/components/MaskedTextInput/mask.js +37 -0
  134. package/dist/components/MaskedTextInput/mask.js.map +1 -0
  135. package/dist/components/MaskedTextInput/types.js +3 -0
  136. package/dist/components/MaskedTextInput/types.js.map +1 -0
  137. package/dist/components/Modal/context.js +41 -0
  138. package/dist/components/Modal/context.js.map +1 -0
  139. package/dist/components/Modal/elements.js +74 -0
  140. package/dist/components/Modal/elements.js.map +1 -0
  141. package/dist/components/Modal/index.js +52 -0
  142. package/dist/components/Modal/index.js.map +1 -0
  143. package/dist/components/Modal/styles.js +3 -0
  144. package/dist/components/Modal/styles.js.map +1 -0
  145. package/dist/components/Modal/types.js +3 -0
  146. package/dist/components/Modal/types.js.map +1 -0
  147. package/dist/components/NumberIncrement/index.js +83 -0
  148. package/dist/components/NumberIncrement/index.js.map +1 -0
  149. package/dist/components/NumberIncrement/styles.js +3 -0
  150. package/dist/components/NumberIncrement/styles.js.map +1 -0
  151. package/dist/components/NumberIncrement/types.js +3 -0
  152. package/dist/components/NumberIncrement/types.js.map +1 -0
  153. package/dist/components/NumberIncrement/useNumberIncrement.js +116 -0
  154. package/dist/components/NumberIncrement/useNumberIncrement.js.map +1 -0
  155. package/dist/components/Overlay/index.js +62 -0
  156. package/dist/components/Overlay/index.js.map +1 -0
  157. package/dist/components/Overlay/styles.js +3 -0
  158. package/dist/components/Overlay/styles.js.map +1 -0
  159. package/dist/components/Overlay/types.js +3 -0
  160. package/dist/components/Overlay/types.js.map +1 -0
  161. package/dist/components/PaginationButtons/index.js +118 -0
  162. package/dist/components/PaginationButtons/index.js.map +1 -0
  163. package/dist/components/PaginationButtons/styles.js +3 -0
  164. package/dist/components/PaginationButtons/styles.js.map +1 -0
  165. package/dist/components/PaginationButtons/types.js +3 -0
  166. package/dist/components/PaginationButtons/types.js.map +1 -0
  167. package/dist/components/PaginationIndicator/index.js +59 -0
  168. package/dist/components/PaginationIndicator/index.js.map +1 -0
  169. package/dist/components/PaginationIndicator/styles.js +3 -0
  170. package/dist/components/PaginationIndicator/styles.js.map +1 -0
  171. package/dist/components/PaginationIndicator/types.js +3 -0
  172. package/dist/components/PaginationIndicator/types.js.map +1 -0
  173. package/dist/components/Progress/Bar/Segmented.js +41 -0
  174. package/dist/components/Progress/Bar/Segmented.js.map +1 -0
  175. package/dist/components/Progress/Bar/index.js +62 -0
  176. package/dist/components/Progress/Bar/index.js.map +1 -0
  177. package/dist/components/Progress/Bar/styles.js +3 -0
  178. package/dist/components/Progress/Bar/styles.js.map +1 -0
  179. package/dist/components/Progress/Bar/types.js +3 -0
  180. package/dist/components/Progress/Bar/types.js.map +1 -0
  181. package/dist/components/Progress/Circle/Segmented.js +64 -0
  182. package/dist/components/Progress/Circle/Segmented.js.map +1 -0
  183. package/dist/components/Progress/Circle/index.js +83 -0
  184. package/dist/components/Progress/Circle/index.js.map +1 -0
  185. package/dist/components/Progress/Circle/styles.js +3 -0
  186. package/dist/components/Progress/Circle/styles.js.map +1 -0
  187. package/dist/components/Progress/Circle/types.js +3 -0
  188. package/dist/components/Progress/Circle/types.js.map +1 -0
  189. package/dist/components/Progress/index.js +19 -0
  190. package/dist/components/Progress/index.js.map +1 -0
  191. package/dist/components/Progress/utils.js +7 -0
  192. package/dist/components/Progress/utils.js.map +1 -0
  193. package/dist/components/RadioInput/index.js +68 -0
  194. package/dist/components/RadioInput/index.js.map +1 -0
  195. package/dist/components/RadioInput/styles.js +3 -0
  196. package/dist/components/RadioInput/styles.js.map +1 -0
  197. package/dist/components/RadioInput/types.js +3 -0
  198. package/dist/components/RadioInput/types.js.map +1 -0
  199. package/dist/components/SearchInput/index.js +98 -0
  200. package/dist/components/SearchInput/index.js.map +1 -0
  201. package/dist/components/SectionFilters/index.js +166 -0
  202. package/dist/components/SectionFilters/index.js.map +1 -0
  203. package/dist/components/SectionFilters/styles.js +3 -0
  204. package/dist/components/SectionFilters/styles.js.map +1 -0
  205. package/dist/components/SectionFilters/types.js +3 -0
  206. package/dist/components/SectionFilters/types.js.map +1 -0
  207. package/dist/components/Select/context.js +162 -0
  208. package/dist/components/Select/context.js.map +1 -0
  209. package/dist/components/Select/elements.js +53 -0
  210. package/dist/components/Select/elements.js.map +1 -0
  211. package/dist/components/Select/index.js +70 -0
  212. package/dist/components/Select/index.js.map +1 -0
  213. package/dist/components/Select/styles.js +3 -0
  214. package/dist/components/Select/styles.js.map +1 -0
  215. package/dist/components/Select/types.js +3 -0
  216. package/dist/components/Select/types.js.map +1 -0
  217. package/dist/components/Select/useTriggerWidth.js +30 -0
  218. package/dist/components/Select/useTriggerWidth.js.map +1 -0
  219. package/dist/components/Slider/index.js +160 -0
  220. package/dist/components/Slider/index.js.map +1 -0
  221. package/dist/components/Slider/styles.js +3 -0
  222. package/dist/components/Slider/styles.js.map +1 -0
  223. package/dist/components/Slider/types.js +3 -0
  224. package/dist/components/Slider/types.js.map +1 -0
  225. package/dist/components/Switch/index.js +66 -0
  226. package/dist/components/Switch/index.js.map +1 -0
  227. package/dist/components/Switch/styles.js +3 -0
  228. package/dist/components/Switch/styles.js.map +1 -0
  229. package/dist/components/Switch/types.js +3 -0
  230. package/dist/components/Switch/types.js.map +1 -0
  231. package/dist/components/Tag/index.js +74 -0
  232. package/dist/components/Tag/index.js.map +1 -0
  233. package/dist/components/Tag/styles.js +3 -0
  234. package/dist/components/Tag/styles.js.map +1 -0
  235. package/dist/components/Tag/types.js +3 -0
  236. package/dist/components/Tag/types.js.map +1 -0
  237. package/dist/components/Text/index.js +115 -0
  238. package/dist/components/Text/index.js.map +1 -0
  239. package/dist/components/Text/styles.js +3 -0
  240. package/dist/components/Text/styles.js.map +1 -0
  241. package/dist/components/Text/types.js +3 -0
  242. package/dist/components/Text/types.js.map +1 -0
  243. package/dist/components/TextEditor/index.js +111 -0
  244. package/dist/components/TextEditor/index.js.map +1 -0
  245. package/dist/components/TextEditor/styles.js +3 -0
  246. package/dist/components/TextEditor/styles.js.map +1 -0
  247. package/dist/components/TextEditor/types.js +3 -0
  248. package/dist/components/TextEditor/types.js.map +1 -0
  249. package/dist/components/TextInput/index.js +86 -0
  250. package/dist/components/TextInput/index.js.map +1 -0
  251. package/dist/components/TextInput/styles.js +3 -0
  252. package/dist/components/TextInput/styles.js.map +1 -0
  253. package/dist/components/TextInput/types.js +3 -0
  254. package/dist/components/TextInput/types.js.map +1 -0
  255. package/dist/components/TextInput/useTextInput.d.ts +2 -2
  256. package/dist/components/TextInput/useTextInput.js +67 -0
  257. package/dist/components/TextInput/useTextInput.js.map +1 -0
  258. package/dist/components/Tooltip/index.js +115 -0
  259. package/dist/components/Tooltip/index.js.map +1 -0
  260. package/dist/components/Tooltip/styles.js +3 -0
  261. package/dist/components/Tooltip/styles.js.map +1 -0
  262. package/dist/components/Tooltip/types.js +3 -0
  263. package/dist/components/Tooltip/types.js.map +1 -0
  264. package/dist/components/Touchable/index.js +100 -0
  265. package/dist/components/Touchable/index.js.map +1 -0
  266. package/dist/components/Touchable/styles.js +3 -0
  267. package/dist/components/Touchable/styles.js.map +1 -0
  268. package/dist/components/Touchable/types.js +3 -0
  269. package/dist/components/Touchable/types.js.map +1 -0
  270. package/dist/components/View/index.js +56 -0
  271. package/dist/components/View/index.js.map +1 -0
  272. package/dist/components/View/styles.js +3 -0
  273. package/dist/components/View/styles.js.map +1 -0
  274. package/dist/components/View/types.js +3 -0
  275. package/dist/components/View/types.js.map +1 -0
  276. package/dist/components/components.js +58 -0
  277. package/dist/components/components.js.map +1 -0
  278. package/dist/index.js +21 -0
  279. package/dist/index.js.map +1 -0
  280. package/dist/lib/ListMasonry.js +95 -0
  281. package/dist/lib/ListMasonry.js.map +1 -0
  282. package/dist/lib/ThemeVariables.js +27 -0
  283. package/dist/lib/ThemeVariables.js.map +1 -0
  284. package/dist/lib/WebStyleRegistry.js +73 -0
  285. package/dist/lib/WebStyleRegistry.js.map +1 -0
  286. package/dist/lib/hooks/index.js +39 -0
  287. package/dist/lib/hooks/index.js.map +1 -0
  288. package/dist/lib/hooks/useAnimatedStyle.js +27 -0
  289. package/dist/lib/hooks/useAnimatedStyle.js.map +1 -0
  290. package/dist/lib/hooks/useAnimatedVariantStyles.js +23 -0
  291. package/dist/lib/hooks/useAnimatedVariantStyles.js.map +1 -0
  292. package/dist/lib/hooks/useAsyncSelect.js +60 -0
  293. package/dist/lib/hooks/useAsyncSelect.js.map +1 -0
  294. package/dist/lib/hooks/useBreakpointMatch.js +111 -0
  295. package/dist/lib/hooks/useBreakpointMatch.js.map +1 -0
  296. package/dist/lib/hooks/useClick.js +41 -0
  297. package/dist/lib/hooks/useClick.js.map +1 -0
  298. package/dist/lib/hooks/useClickOutside.js +34 -0
  299. package/dist/lib/hooks/useClickOutside.js.map +1 -0
  300. package/dist/lib/hooks/useFileInput.js +21 -0
  301. package/dist/lib/hooks/useFileInput.js.map +1 -0
  302. package/dist/lib/hooks/useIsomorphicEffect.js +10 -0
  303. package/dist/lib/hooks/useIsomorphicEffect.js.map +1 -0
  304. package/dist/lib/hooks/useKeydown.js +43 -0
  305. package/dist/lib/hooks/useKeydown.js.map +1 -0
  306. package/dist/lib/hooks/useListFocus.js +49 -0
  307. package/dist/lib/hooks/useListFocus.js.map +1 -0
  308. package/dist/lib/hooks/useMediaQuery.js +28 -0
  309. package/dist/lib/hooks/useMediaQuery.js.map +1 -0
  310. package/dist/lib/hooks/usePageExitBlocker.js +48 -0
  311. package/dist/lib/hooks/usePageExitBlocker.js.map +1 -0
  312. package/dist/lib/hooks/usePagination.js +93 -0
  313. package/dist/lib/hooks/usePagination.js.map +1 -0
  314. package/dist/lib/hooks/usePopState.js +35 -0
  315. package/dist/lib/hooks/usePopState.js.map +1 -0
  316. package/dist/lib/hooks/usePopoverDismiss.js +35 -0
  317. package/dist/lib/hooks/usePopoverDismiss.js.map +1 -0
  318. package/dist/lib/hooks/useRefresh.js +74 -0
  319. package/dist/lib/hooks/useRefresh.js.map +1 -0
  320. package/dist/lib/hooks/useScrollEffect.js +22 -0
  321. package/dist/lib/hooks/useScrollEffect.js.map +1 -0
  322. package/dist/lib/hooks/useSearchParams.js +51 -0
  323. package/dist/lib/hooks/useSearchParams.js.map +1 -0
  324. package/dist/lib/hooks/useStaticAnimationStyles.js +19 -0
  325. package/dist/lib/hooks/useStaticAnimationStyles.js.map +1 -0
  326. package/dist/lib/hooks/useStylesFor.js +40 -0
  327. package/dist/lib/hooks/useStylesFor.js.map +1 -0
  328. package/dist/lib/hooks/useTouchableEvents.js +37 -0
  329. package/dist/lib/hooks/useTouchableEvents.js.map +1 -0
  330. package/dist/lib/hooks/useWindowFocus.js +34 -0
  331. package/dist/lib/hooks/useWindowFocus.js.map +1 -0
  332. package/dist/lib/hooks/useWindowSize.js +32 -0
  333. package/dist/lib/hooks/useWindowSize.js.map +1 -0
  334. package/dist/lib/index.js +23 -0
  335. package/dist/lib/index.js.map +1 -0
  336. package/dist/lib/tools/index.js +20 -0
  337. package/dist/lib/tools/index.js.map +1 -0
  338. package/dist/lib/tools/localStorage.js +159 -0
  339. package/dist/lib/tools/localStorage.js.map +1 -0
  340. package/dist/lib/tools/mediaQuery.js +38 -0
  341. package/dist/lib/tools/mediaQuery.js.map +1 -0
  342. package/dist/lib/tools/modal.js +60 -0
  343. package/dist/lib/tools/modal.js.map +1 -0
  344. package/dist/lib/utils/attributes.js +26 -0
  345. package/dist/lib/utils/attributes.js.map +1 -0
  346. package/dist/lib/utils/cache.d.ts +2 -2
  347. package/dist/lib/utils/cache.js +17 -0
  348. package/dist/lib/utils/cache.js.map +1 -0
  349. package/dist/lib/utils/index.js +22 -0
  350. package/dist/lib/utils/index.js.map +1 -0
  351. package/dist/lib/utils/pollyfils/scroll.js +70 -0
  352. package/dist/lib/utils/pollyfils/scroll.js.map +1 -0
  353. package/dist/lib/utils/stopPropagation.js +22 -0
  354. package/dist/lib/utils/stopPropagation.js.map +1 -0
  355. package/dist/lib/utils/test.js +18 -0
  356. package/dist/lib/utils/test.js.map +1 -0
  357. package/dist/types/index.js +18 -0
  358. package/dist/types/index.js.map +1 -0
  359. package/dist/types/utility.js +3 -0
  360. package/dist/types/utility.js.map +1 -0
  361. package/package.json +18 -18
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useNumberIncrement = useNumberIncrement;
4
+ const react_1 = require("react");
5
+ const Field_1 = require("../Field");
6
+ const form_1 = require("@codeleap/form");
7
+ const types_1 = require("@codeleap/types");
8
+ /**
9
+ * Manages value, focus, increment/decrement button disabled state, and keyboard arrow-key handling for `NumberIncrement`.
10
+ * Clamps the value to `[min, max]` on blur; registers global `keydown` and `mousedown` listeners to track focus outside of React's event system.
11
+ * No provider required; designed to be called only inside `NumberIncrement`.
12
+ */
13
+ function useNumberIncrement(props) {
14
+ const { value, onValueChange, field, min, max, forceError, step, } = props;
15
+ const [isFocused, setIsFocused] = (0, react_1.useState)(false);
16
+ const { fieldHandle, validation, innerInputRef, wrapperRef, inputValue, onInputValueChange, } = (0, Field_1.useFieldInput)(field, form_1.fields.number, { value, onValueChange });
17
+ const innerWrapperRef = (0, react_1.useRef)(null);
18
+ const hasValue = types_1.TypeGuards.isString(inputValue)
19
+ ? inputValue?.length > 0
20
+ : !types_1.TypeGuards.isNil(inputValue);
21
+ const hasError = validation?.showError || !!forceError;
22
+ const errorMessage = validation?.message || forceError;
23
+ const incrementDisabled = (0, react_1.useMemo)(() => {
24
+ if (types_1.TypeGuards.isNumber(max) && (Number(inputValue) >= max)) {
25
+ return true;
26
+ }
27
+ return false;
28
+ }, [inputValue]);
29
+ const decrementDisabled = (0, react_1.useMemo)(() => {
30
+ if (types_1.TypeGuards.isNumber(min) && (Number(inputValue) <= min)) {
31
+ return true;
32
+ }
33
+ return false;
34
+ }, [inputValue]);
35
+ const handleChange = (0, react_1.useCallback)((action) => {
36
+ if (action === 'increment' && !incrementDisabled) {
37
+ const newValue = Number(inputValue || min) + step;
38
+ onInputValueChange(newValue);
39
+ return;
40
+ }
41
+ else if (action === 'decrement' && !decrementDisabled) {
42
+ const newValue = Number(inputValue || min) - step;
43
+ onInputValueChange(newValue);
44
+ return;
45
+ }
46
+ validation?.onInputBlurred?.();
47
+ }, [validation?.onInputBlurred, inputValue]);
48
+ const handleBlur = (0, react_1.useCallback)(() => {
49
+ if (types_1.TypeGuards.isNumber(max) && (inputValue >= max)) {
50
+ onInputValueChange(max);
51
+ return;
52
+ }
53
+ else if (types_1.TypeGuards.isNumber(min) && (inputValue <= min) || !inputValue) {
54
+ onInputValueChange(min);
55
+ return;
56
+ }
57
+ validation?.onInputBlurred?.();
58
+ }, [validation?.onInputBlurred, inputValue]);
59
+ const handleFocus = (0, react_1.useCallback)(() => {
60
+ setIsFocused(true);
61
+ }, []);
62
+ (0, react_1.useEffect)(() => {
63
+ function handleKeyboardEvent(event) {
64
+ if (!isFocused)
65
+ return;
66
+ if (event.keyCode === 39 || event.key === 'ArrowRight') {
67
+ handleChange('increment');
68
+ }
69
+ else if (event.keyCode === 37 || event.key === 'ArrowLeft') {
70
+ handleChange('decrement');
71
+ }
72
+ }
73
+ document.addEventListener('keydown', handleKeyboardEvent);
74
+ return () => {
75
+ document.removeEventListener('keydown', handleKeyboardEvent);
76
+ };
77
+ }, [handleChange, isFocused]);
78
+ (0, react_1.useEffect)(() => {
79
+ function handleClickOutside(event) {
80
+ if (innerWrapperRef.current && !innerWrapperRef.current.contains(event.target)) {
81
+ setIsFocused(false);
82
+ }
83
+ }
84
+ document.addEventListener('mousedown', handleClickOutside);
85
+ return () => {
86
+ document.removeEventListener('mousedown', handleClickOutside);
87
+ };
88
+ }, [innerWrapperRef]);
89
+ const handleChangeInput = (values) => {
90
+ const { floatValue } = values;
91
+ onInputValueChange(Number(floatValue));
92
+ };
93
+ const onPressInnerWrapper = () => {
94
+ setIsFocused(true);
95
+ innerInputRef.current?.focus?.();
96
+ };
97
+ return {
98
+ hasValue,
99
+ hasError,
100
+ errorMessage,
101
+ inputValue: inputValue || min,
102
+ isFocused,
103
+ incrementDisabled,
104
+ decrementDisabled,
105
+ innerInputRef,
106
+ innerWrapperRef,
107
+ handleBlur,
108
+ handleFocus,
109
+ handleChange,
110
+ handleChangeInput,
111
+ onPressInnerWrapper,
112
+ fieldHandle,
113
+ wrapperRef,
114
+ };
115
+ }
116
+ //# sourceMappingURL=useNumberIncrement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNumberIncrement.js","sourceRoot":"","sources":["../../../src/components/NumberIncrement/useNumberIncrement.ts"],"names":[],"mappings":";;AAYA,gDA6IC;AAzJD,iCAAgF;AAEhF,oCAAwC;AACxC,yCAA8C;AAC9C,2CAA4C;AAG5C;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,KAAoC;IACrE,MAAM,EACJ,KAAK,EACL,aAAa,EACb,KAAK,EACL,GAAG,EACH,GAAG,EACH,UAAU,EACV,IAAI,GACL,GAAG,KAAK,CAAA;IAET,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAA;IAEjD,MAAM,EACJ,WAAW,EACX,UAAU,EACV,aAAa,EACb,UAAU,EACV,UAAU,EACV,kBAAkB,GACnB,GAAG,IAAA,qBAAa,EACf,KAAgC,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Q;QACR,QAAQ;QACR,YAAY;QACZ,UAAU,EAAE,UAAU,IAAI,GAAG;QAC7B,SAAS;QACT,iBAAiB;QACjB,iBAAiB;QACjB,aAAa;QACb,eAAe;QACf,UAAU;QACV,WAAW;QACX,YAAY;QACZ,iBAAiB;QACjB,mBAAmB;QACnB,WAAW;QACX,UAAU;KACX,CAAA;AACH,CAAC"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.Overlay = void 0;
18
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
19
+ const Touchable_1 = require("../Touchable");
20
+ const View_1 = require("../View");
21
+ const lib_1 = require("../../lib");
22
+ const WebStyleRegistry_1 = require("../../lib/WebStyleRegistry");
23
+ const useStylesFor_1 = require("../../lib/hooks/useStylesFor");
24
+ __exportStar(require("./styles"), exports);
25
+ __exportStar(require("./types"), exports);
26
+ /**
27
+ * Visually hidden overlay that transitions to visible state and registers a
28
+ * browser pop-state entry so the back button can dismiss it.
29
+ * Renders as `Touchable` when `onPress` or `onClick` is provided, otherwise as `View`.
30
+ * Uses: `Touchable`, `View`, `useStylesFor`, `WebStyleRegistry`
31
+ */
32
+ const Overlay = (overlayProps) => {
33
+ const { visible, style, ...props } = {
34
+ ...exports.Overlay.defaultProps,
35
+ ...overlayProps,
36
+ };
37
+ const styles = (0, useStylesFor_1.useStylesFor)(exports.Overlay.styleRegistryName, style);
38
+ (0, lib_1.usePopState)(visible, props?.onPress);
39
+ const isPressable = !!props?.onClick || !!props?.onPress;
40
+ if (isPressable) {
41
+ return ((0, jsx_runtime_1.jsx)(Touchable_1.Touchable, { ...props, style: [
42
+ { transition: 'opacity 0.2s ease' },
43
+ styles.wrapper,
44
+ visible ? styles['wrapper:visible'] : null,
45
+ ] }));
46
+ }
47
+ return ((0, jsx_runtime_1.jsx)(View_1.View, { ...props, style: [
48
+ { transition: 'opacity 0.2s ease' },
49
+ styles.wrapper,
50
+ visible ? styles['wrapper:visible'] : null,
51
+ ] }));
52
+ };
53
+ exports.Overlay = Overlay;
54
+ exports.Overlay.styleRegistryName = 'Overlay';
55
+ exports.Overlay.elements = ['wrapper'];
56
+ exports.Overlay.rootElement = 'wrapper';
57
+ exports.Overlay.withVariantTypes = (styles) => {
58
+ return exports.Overlay;
59
+ };
60
+ exports.Overlay.defaultProps = {};
61
+ WebStyleRegistry_1.WebStyleRegistry.registerComponent(exports.Overlay);
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Overlay/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,4CAAwC;AACxC,kCAA8B;AAC9B,mCAAuC;AACvC,iEAA6D;AAE7D,+DAA2D;AAG3D,2CAAwB;AACxB,0CAAuB;AAEvB;;;;;GAKG;AACI,MAAM,OAAO,GAAG,CAAC,YAA0B,EAAE,EAAE;IACpD,MAAM,EACJ,OAAO,EACP,KAAK,EACL,GAAG,KAAK,EACT,GAAG;QACF,GAAG,eAAO,CAAC,YAAY;QACvB,GAAG,YAAY;KAChB,CAAA;IAED,MAAM,MAAM,GAAG,IAAA,2BAAY,EAAC,eAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAE7D,IAAA,iBAAW,EAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;IAEpC,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,EAAE,OAAO,IAAI,CAAC,CAAC,KAAK,EAAE,OAAO,CAAA;IAExD,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,CACL,uBAAC,qBAAS,OACJ,KAAK,EACT,KAAK,EAAE;gBACL,EAAE,UAAU,EAAE,mBAAmB,EAAE;gBACnC,MAAM,CAAC,OAAO;gBACd,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI;aAC3C,GACD,CACH,CAAA;IACH,CAAC;IAED,OAAO,CACL,uBAAC,WAAI,OACC,KAAK,EACT,KAAK,EAAE;YACL,EAAE,UAAU,EAAE,mBAAmB,EAAE;YACnC,MAAM,CAAC,OAAO;YACd,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI;SAC3C,GACD,CACH,CAAA;AACH,CAAC,CAAA;AAvCY,QAAA,OAAO,WAuCnB;AAED,eAAO,CAAC,iBAAiB,GAAG,SAAS,CAAA;AACrC,eAAO,CAAC,QAAQ,GAAG,CAAC,SAAS,CAAC,CAAA;AAC9B,eAAO,CAAC,WAAW,GAAG,SAAS,CAAA;AAE/B,eAAO,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IAC5D,OAAO,eAA6E,CAAA;AACtF,CAAC,CAAA;AAED,eAAO,CAAC,YAAY,GAAG,EAA2B,CAAA;AAElD,mCAAgB,CAAC,iBAAiB,CAAC,eAAO,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/Overlay/styles.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Overlay/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.PaginationButtons = void 0;
18
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
19
+ const types_1 = require("@codeleap/types");
20
+ const View_1 = require("../View");
21
+ const Button_1 = require("../Button");
22
+ const lib_1 = require("../../lib");
23
+ const styles_1 = require("@codeleap/styles");
24
+ __exportStar(require("./styles"), exports);
25
+ __exportStar(require("./types"), exports);
26
+ /**
27
+ * Numbered page-navigation control with optional previous/next arrow buttons and responsive abbreviation of middle pages.
28
+ * Abbreviation behaviour and mobile layout are auto-detected from the `tabletSmall` theme breakpoint but can be overridden via props.
29
+ * Uses: `Button`
30
+ */
31
+ const PaginationButtons = (props) => {
32
+ const allProps = {
33
+ ...exports.PaginationButtons.defaultProps,
34
+ ...props,
35
+ };
36
+ const { shouldAbbreviate, displayLeftArrow, displayRightArrow, disabled, style, itemProps, controlLeftIconName, controlRightIconName, leftArrowButtonProps, rightArrowButtonProps, abbreviationSymbol, isMobile, ...paginationProps } = allProps;
37
+ const themeMedia = (0, styles_1.useTheme)(store => store?.theme?.media);
38
+ const { boundaries = 2 } = paginationProps;
39
+ const query = themeMedia?.down('tabletSmall');
40
+ const _isMobile = (0, lib_1.useMediaQuery)(query);
41
+ const isMobileQuery = types_1.TypeGuards.isBoolean(isMobile) ? isMobile : _isMobile;
42
+ const centeredElementIndex = isMobileQuery ? 3 : boundaries + 1;
43
+ const { range, first, next, previous, setPage, page, status, } = (0, lib_1.usePagination)({
44
+ abbreviationSymbol,
45
+ isMobile: isMobileQuery,
46
+ displayLeftArrow,
47
+ displayRightArrow,
48
+ shouldAbbreviate,
49
+ ...paginationProps,
50
+ });
51
+ const styles = (0, lib_1.useStylesFor)(exports.PaginationButtons.styleRegistryName, style);
52
+ const compositionStyles = (0, styles_1.useCompositionStyles)(['button', 'arrowLeftButton', 'arrowRightButton'], styles);
53
+ const fetchPreviousPage = () => {
54
+ props?.onFetchPreviousPage?.();
55
+ previous?.();
56
+ };
57
+ const fetchNextPage = () => {
58
+ props?.onFetchNextPage?.();
59
+ next?.();
60
+ };
61
+ const fetchPage = (page) => {
62
+ setPage?.(page);
63
+ };
64
+ const onPressItem = ({ item, isArrowLeft, isArrowRight }) => {
65
+ if (item === abbreviationSymbol) {
66
+ return null;
67
+ }
68
+ if (isArrowLeft) {
69
+ if (displayLeftArrow) {
70
+ return fetchPreviousPage();
71
+ }
72
+ else {
73
+ return first();
74
+ }
75
+ }
76
+ if (displayRightArrow && isArrowRight) {
77
+ return fetchNextPage();
78
+ }
79
+ props?.onPressItem?.(item);
80
+ fetchPage(Number(item));
81
+ };
82
+ return ((0, jsx_runtime_1.jsxs)(View_1.View, { style: styles.wrapper, children: [displayLeftArrow ? ((0, jsx_runtime_1.jsx)(Button_1.Button, { icon: controlLeftIconName, onPress: () => onPressItem({ item: null, isArrowLeft: true, isArrowRight: false }), ...leftArrowButtonProps, style: compositionStyles.arrowLeftButton })) : null, range?.map?.((item, index) => {
83
+ if (props?.renderItem) {
84
+ return props?.renderItem?.(item, index);
85
+ }
86
+ let selected = null;
87
+ switch (status) {
88
+ case 'initial':
89
+ selected = page === index + 1;
90
+ break;
91
+ case 'abreviated':
92
+ selected = index === centeredElementIndex - 1;
93
+ break;
94
+ case 'end':
95
+ selected = page - (Number(item) - index) === index;
96
+ }
97
+ return ((0, jsx_runtime_1.jsx)(Button_1.Button, { text: String(item), selected: selected, onPress: () => onPressItem({ item, isArrowLeft: false, isArrowRight: false }), disabled: disabled, ...itemProps, style: compositionStyles.button }));
98
+ }), displayRightArrow ? ((0, jsx_runtime_1.jsx)(Button_1.Button, { icon: controlRightIconName, onPress: () => onPressItem({ item: null, isArrowLeft: false, isArrowRight: true }), ...rightArrowButtonProps, style: compositionStyles.arrowRightButton })) : null] }));
99
+ };
100
+ exports.PaginationButtons = PaginationButtons;
101
+ exports.PaginationButtons.styleRegistryName = 'PaginationButtons';
102
+ exports.PaginationButtons.elements = ['wrapper', 'button', 'arrowLeftButton', 'arrowRightButton'];
103
+ exports.PaginationButtons.rootElement = 'wrapper';
104
+ exports.PaginationButtons.withVariantTypes = (styles) => {
105
+ return exports.PaginationButtons;
106
+ };
107
+ exports.PaginationButtons.defaultProps = {
108
+ shouldAbbreviate: true,
109
+ displayLeftArrow: true,
110
+ displayRightArrow: true,
111
+ disabled: false,
112
+ isMobile: null,
113
+ abbreviationSymbol: '...',
114
+ controlLeftIconName: 'chevron-left',
115
+ controlRightIconName: 'chevron-right',
116
+ };
117
+ lib_1.WebStyleRegistry.registerComponent(exports.PaginationButtons);
118
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/PaginationButtons/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,kCAA8B;AAC9B,sCAAkC;AAClC,mCAAwF;AAExF,6CAAiH;AAEjH,2CAAwB;AACxB,0CAAuB;AAEvB;;;;GAIG;AACI,MAAM,iB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,IAAI,EAAE,CAAC,KAC9E,qBAAqB,EACzB,KAAK,EAAE,iBAAiB,CAAC,gBAAgB,GACzC,CACH,CAAC,CAAC,CAAC,IAAI,IACH,CACR,CAAA;AACH,CAAC,CAAA;AA7IY,QAAA,iBAAiB,qBA6I7B;AAED,yBAAiB,CAAC,iBAAiB,GAAG,mBAAmB,CAAA;AACzD,yBAAiB,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,iBAAiB,EAAE,kBAAkB,CAAC,CAAA;AACzF,yBAAiB,CAAC,WAAW,GAAG,SAAS,CAAA;AAEzC,yBAAiB,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IACtE,OAAO,yBAAiG,CAAA;AAC1G,CAAC,CAAA;AAED,yBAAiB,CAAC,YAAY,GAAG;IAC/B,gBAAgB,EAAE,IAAI;IACtB,gBAAgB,EAAE,IAAI;IACtB,iBAAiB,EAAE,IAAI;IACvB,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,IAAI;IACd,kBAAkB,EAAE,KAAK;IACzB,mBAAmB,EAAE,cAAyB;IAC9C,oBAAoB,EAAE,eAA0B;CACd,CAAA;AAEpC,sBAAgB,CAAC,iBAAiB,CAAC,yBAAiB,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/PaginationButtons/styles.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/PaginationButtons/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.PaginationIndicator = void 0;
18
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
19
+ const types_1 = require("@codeleap/types");
20
+ const ActivityIndicator_1 = require("../ActivityIndicator");
21
+ const Text_1 = require("../Text");
22
+ const View_1 = require("../View");
23
+ const useStylesFor_1 = require("../../lib/hooks/useStylesFor");
24
+ const WebStyleRegistry_1 = require("../../lib/WebStyleRegistry");
25
+ const styles_1 = require("@codeleap/styles");
26
+ __exportStar(require("./styles"), exports);
27
+ __exportStar(require("./types"), exports);
28
+ /**
29
+ * Status indicator placed at the bottom of a paginated or infinite-scroll list — shows a spinner while fetching, a "no more items" message when exhausted, or nothing otherwise.
30
+ * Uses: `ActivityIndicator`, `Text`
31
+ */
32
+ const PaginationIndicator = (props) => {
33
+ const { hasMore, isFetching, noMoreItemsText, activityIndicator, style, indicatorProps, debugName, } = {
34
+ ...exports.PaginationIndicator.defaultProps,
35
+ ...props,
36
+ };
37
+ const styles = (0, useStylesFor_1.useStylesFor)(exports.PaginationIndicator.styleRegistryName, style);
38
+ const loaderStyles = (0, styles_1.useNestedStylesByKey)('loader', styles);
39
+ if (isFetching) {
40
+ return activityIndicator || ((0, jsx_runtime_1.jsx)(View_1.View, { style: styles.wrapper, children: (0, jsx_runtime_1.jsx)(ActivityIndicator_1.ActivityIndicator, { debugName: debugName, ...indicatorProps, style: loaderStyles }) }));
41
+ }
42
+ if (!hasMore) {
43
+ if (types_1.TypeGuards.isString(noMoreItemsText) || types_1.TypeGuards.isNumber(noMoreItemsText)) {
44
+ return ((0, jsx_runtime_1.jsx)(View_1.View, { style: styles.wrapper, children: (0, jsx_runtime_1.jsx)(Text_1.Text, { debugName: debugName, style: styles.text, text: String(noMoreItemsText) }) }));
45
+ }
46
+ return noMoreItemsText;
47
+ }
48
+ return null;
49
+ };
50
+ exports.PaginationIndicator = PaginationIndicator;
51
+ exports.PaginationIndicator.styleRegistryName = 'PaginationIndicator';
52
+ exports.PaginationIndicator.elements = ['wrapper', 'text', 'loader'];
53
+ exports.PaginationIndicator.rootElement = 'wrapper';
54
+ exports.PaginationIndicator.withVariantTypes = (styles) => {
55
+ return exports.PaginationIndicator;
56
+ };
57
+ exports.PaginationIndicator.defaultProps = {};
58
+ WebStyleRegistry_1.WebStyleRegistry.registerComponent(exports.PaginationIndicator);
59
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/PaginationIndicator/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,2CAA4C;AAC5C,4DAAwD;AACxD,kCAA8B;AAC9B,kCAA8B;AAC9B,+DAA2D;AAE3D,iEAA6D;AAC7D,6CAA8F;AAE9F,2CAAwB;AACxB,0CAAuB;AAEvB;;;GAGG;AACI,MAAM,mBAAmB,GAAG,CAAC,KAA+B,EAAE,EAAE;IACrE,MAAM,EACJ,OAAO,EACP,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,KAAK,EACL,cAAc,EACd,SAAS,GACV,GAAG;QACF,GAAG,2BAAmB,CAAC,YAAY;QACnC,GAAG,KAAK;KACT,CAAA;IAED,MAAM,MAAM,GAAG,IAAA,2BAAY,EAAC,2BAAmB,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAEzE,MAAM,YAAY,GA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@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/PaginationIndicator/styles.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/PaginationIndicator/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProgressBarSegmented = void 0;
4
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
5
+ const react_1 = require("motion/react");
6
+ const components_1 = require("../../components");
7
+ const WebStyleRegistry_1 = require("../../../lib/WebStyleRegistry");
8
+ const styles_1 = require("@codeleap/styles");
9
+ const useStylesFor_1 = require("../../../lib/hooks/useStylesFor");
10
+ /**
11
+ * Horizontal progress bar made up of N discrete pill segments.
12
+ * Active segments (index < `progress`) receive `styles.segmentActive` merged on top of `styles.segment`.
13
+ * When `animated` is true each active segment fades in with a staggered delay.
14
+ */
15
+ const ProgressBarSegmented = (props) => {
16
+ const { progress, segments, style, debugName, animated, animatedProps, staggerDelay, ...rest } = {
17
+ ...exports.ProgressBarSegmented.defaultProps,
18
+ ...props,
19
+ };
20
+ const styles = (0, useStylesFor_1.useStylesFor)(exports.ProgressBarSegmented.styleRegistryName, style);
21
+ const SegmentComponent = animated ? react_1.motion.div : 'div';
22
+ return ((0, jsx_runtime_1.jsx)(components_1.View, { debugName: debugName, ...rest, style: styles.wrapper, children: Array.from({ length: segments }, (_, i) => {
23
+ const isActive = i < progress;
24
+ return ((0, jsx_runtime_1.jsx)(SegmentComponent, { css: (0, styles_1.mergeStyles)([styles.segment, isActive ? styles.segmentActive : null]), animate: animated ? { opacity: isActive ? 1 : 0.4 } : undefined, initial: animated ? { opacity: 0.4 } : undefined, transition: animated ? { delay: isActive ? i * staggerDelay : 0, duration: 0.2 } : undefined, ...(animated ? animatedProps : {}) }, i));
25
+ }) }));
26
+ };
27
+ exports.ProgressBarSegmented = ProgressBarSegmented;
28
+ exports.ProgressBarSegmented.styleRegistryName = 'ProgressBarSegmented';
29
+ exports.ProgressBarSegmented.elements = ['wrapper', 'segment', 'segmentActive'];
30
+ exports.ProgressBarSegmented.rootElement = 'wrapper';
31
+ exports.ProgressBarSegmented.withVariantTypes = (styles) => {
32
+ return exports.ProgressBarSegmented;
33
+ };
34
+ exports.ProgressBarSegmented.defaultProps = {
35
+ progress: 0,
36
+ segments: 5,
37
+ animated: true,
38
+ staggerDelay: 0.05,
39
+ };
40
+ WebStyleRegistry_1.WebStyleRegistry.registerComponent(exports.ProgressBarSegmented);
41
+ //# sourceMappingURL=Segmented.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Segmented.js","sourceRoot":"","sources":["../../../../src/components/Progress/Bar/Segmented.tsx"],"names":[],"mappings":";;;;AAAA,wCAAqC;AACrC,iDAAuC;AAEvC,oEAAgE;AAChE,6CAAqF;AACrF,kEAA8D;AAE9D;;;;GAIG;AACI,MAAM,oBAAoB,GAAG,CAAC,KAAgC,EAAE,EAAE;IACvE,MAAM,EACJ,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,SAAS,EACT,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,GAAG,IAAI,EACR,GAAG;QACF,GAAG,4BAAoB,CAAC,YAAY;QACpC,GAAG,KAAK;KACT,CAAA;IAED,MAAM,MAAM,GAAG,IAAA,2BAAY,EAAC,4BAAoB,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAE1E,MAAM,gBAAgB,GAAQ,QAAQ,CAAC,CAAC,CAAC,cAAM,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAA;IAE3D,OAAO,CACL,uBAAC,iBAAI,IAAC,SAAS,EAAE,SAAS,KAAM,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,YACxD,KAAK,CAAC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AAY,GAAG;IAClC,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,IAAI;IACd,YAAY,EAAE,IAAI;CACmB,CAAA;AAEvC,mCAAgB,CAAC,iBAAiB,CAAC,4BAAoB,CAAC,CAAA"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ProgressBar = void 0;
18
+ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
19
+ const types_1 = require("@codeleap/types");
20
+ const react_1 = require("motion/react");
21
+ const components_1 = require("../../components");
22
+ const utils_1 = require("../utils");
23
+ const WebStyleRegistry_1 = require("../../../lib/WebStyleRegistry");
24
+ const styles_1 = require("@codeleap/styles");
25
+ const useStylesFor_1 = require("../../../lib/hooks/useStylesFor");
26
+ const Segmented_1 = require("./Segmented");
27
+ __exportStar(require("./types"), exports);
28
+ __exportStar(require("./styles"), exports);
29
+ /**
30
+ * Horizontal progress bar with optional left/right icons and labels.
31
+ * The indicator fills via a `scaleX` transform animated with Framer Motion when `animated` is true.
32
+ * Uses: `Icon`, `Text`
33
+ */
34
+ const ProgressBar = (props) => {
35
+ const { progress, style, debugName, formatProgress, showProgress, animated, animatedProps, leftIcon, leftIconProps, rightIcon, rightIconProps, text, textProps, leftText, leftTextProps, rightText, rightTextProps, ...rest } = {
36
+ ...exports.ProgressBar.defaultProps,
37
+ ...props,
38
+ };
39
+ const styles = (0, useStylesFor_1.useStylesFor)(exports.ProgressBar.styleRegistryName, style);
40
+ const leftIconStyles = (0, styles_1.mergeStyles)([styles.icon, styles.leftIcon]);
41
+ const rightIconStyles = (0, styles_1.mergeStyles)([styles.icon, styles.rightIcon]);
42
+ const leftTextStyles = (0, styles_1.mergeStyles)([styles.text, styles.leftText]);
43
+ const rightTextStyles = (0, styles_1.mergeStyles)([styles.text, styles.rightText]);
44
+ const IndicatorComponent = animated ? react_1.motion.div : 'div';
45
+ return ((0, jsx_runtime_1.jsxs)(components_1.View, { debugName: debugName, ...rest, style: styles.wrapper, children: [!types_1.TypeGuards.isNil(leftIcon) ? ((0, jsx_runtime_1.jsx)(components_1.Icon, { icon: leftIcon, debugName: `leftIcon-${debugName}`, ...leftIconProps, style: leftIconStyles })) : null, types_1.TypeGuards.isString(leftText) ? ((0, jsx_runtime_1.jsx)(components_1.Text, { text: leftText, ...leftTextProps, style: leftTextStyles })) : leftText, (0, jsx_runtime_1.jsx)("div", { css: styles.track, role: 'progressbar', "aria-valuenow": progress, "aria-valuemin": 0, "aria-valuemax": 100, children: (0, jsx_runtime_1.jsx)(IndicatorComponent, { css: styles.indicator, style: { transformOrigin: 'left' }, animate: animated ? { scaleX: progress / 100 } : undefined, initial: animated ? { scaleX: 0 } : undefined, transition: animated ? { duration: 0.6, ease: [0.65, 0, 0.35, 1] } : undefined, ...(animated ? animatedProps : {}) }) }), types_1.TypeGuards.isString(text) || showProgress ? ((0, jsx_runtime_1.jsx)(components_1.Text, { text: showProgress ? formatProgress(progress) : text, ...textProps, style: styles.text })) : text, !types_1.TypeGuards.isNil(rightIcon) ? ((0, jsx_runtime_1.jsx)(components_1.Icon, { icon: rightIcon, debugName: `rightIcon-${debugName}`, ...rightIconProps, style: rightIconStyles })) : null, types_1.TypeGuards.isString(rightText) ? ((0, jsx_runtime_1.jsx)(components_1.Text, { text: rightText, ...rightTextProps, style: rightTextStyles })) : rightText] }));
46
+ };
47
+ exports.ProgressBar = ProgressBar;
48
+ exports.ProgressBar.styleRegistryName = 'ProgressBar';
49
+ exports.ProgressBar.elements = ['wrapper', 'track', 'indicator', 'text', 'icon', 'leftIcon', 'leftText', 'rightIcon', 'rightText'];
50
+ exports.ProgressBar.rootElement = 'wrapper';
51
+ exports.ProgressBar.withVariantTypes = (styles) => {
52
+ return exports.ProgressBar;
53
+ };
54
+ exports.ProgressBar.defaultProps = {
55
+ progress: 0,
56
+ showProgress: false,
57
+ formatProgress: utils_1.formatProgress,
58
+ animated: true,
59
+ };
60
+ exports.ProgressBar.Segmented = Segmented_1.ProgressBarSegmented;
61
+ WebStyleRegistry_1.WebStyleRegistry.registerComponent(exports.ProgressBar);
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Progress/Bar/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,wCAAqC;AACrC,iDAAmD;AAEnD,oCAA4D;AAC5D,oEAAgE;AAChE,6CAAqF;AACrF,kEAA8D;AAC9D,2CAAkD;AAElD,0CAAuB;AACvB,2CAAwB;AAExB;;;;GAIG;AACI,MAAM,WAAW,GAAG,CAAC,KAAuB,EAAE,EAAE;IACrD,MAAM,EACJ,QAAQ,EACR,KAAK,EACL,SAAS,EACT,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,aAAa,EACb,SAAS,EACT,cAAc,EACd,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,aAAa,EACb,SAAS,EACT,cAAc,EACd,GAAG,IAAI,EACR,GAAG;QACF,GAAG,mBAAW,CAAC,YAAY;QAC3B,GAAG,KAAK;KACT,CAAA;IAED,MAAM,MAAM,GAAG,IAAA,2BAAY,EAAC,mBAAW,CAAC,iBAAiB,EAAE,KAAK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AED,mBAAW,CAAC,iBAAiB,GAAG,aAAa,CAAA;AAC7C,mBAAW,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,CAAC,CAAA;AAC1H,mBAAW,CAAC,WAAW,GAAG,SAAS,CAAA;AAEnC,mBAAW,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IAChE,OAAO,mBAAqF,CAAA;AAC9F,CAAC,CAAA;AAED,mBAAW,CAAC,YAAY,GAAG;IACzB,QAAQ,EAAE,CAAC;IACX,YAAY,EAAE,KAAK;IACnB,cAAc,EAAE,sBAAe;IAC/B,QAAQ,EAAE,IAAI;CACc,CAAA;AAE9B,mBAAW,CAAC,SAAS,GAAG,gCAAoB,CAAA;AAE5C,mCAAgB,CAAC,iBAAiB,CAAC,mBAAW,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/components/Progress/Bar/styles.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/Progress/Bar/types.ts"],"names":[],"mappings":""}