@codeleap/web 6.8.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,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ import { ModalProvider } from './context';
3
+ import { ModalBackdrop, ModalBox, ModalHeader, ModalBody, ModalFooter, } from './elements';
4
+ import { WebStyleRegistry } from '../../lib/WebStyleRegistry';
5
+ export * from './styles';
6
+ export * from './types';
7
+ export * from './context';
8
+ export * from './elements';
9
+ /**
10
+ * Accessible dialog that blocks page interaction while open, with backdrop-click and Escape-key dismissal.
11
+ * Controlled via `visible` / `toggle`; defaults to `closable`, `dismissOnBackdrop`, and `closeOnEscape` all `true`.
12
+ * Uses: `Modal.Provider`, `Modal.Backdrop`, `Modal.Box`, `Modal.Header`, `Modal.Body`, `Modal.Footer`
13
+ */
14
+ export const Modal = (props) => {
15
+ const { children, ...providerProps } = { ...Modal.defaultProps, ...props };
16
+ return (_jsx(ModalProvider, { ...providerProps, children: _jsx(ModalBackdrop, { children: _jsxs(ModalBox, { children: [_jsx(ModalHeader, {}), _jsx(ModalBody, { children: children }), _jsx(ModalFooter, {})] }) }) }));
17
+ };
18
+ Modal.Provider = ModalProvider;
19
+ Modal.Backdrop = ModalBackdrop;
20
+ Modal.Box = ModalBox;
21
+ Modal.Header = ModalHeader;
22
+ Modal.Body = ModalBody;
23
+ Modal.Footer = ModalFooter;
24
+ Modal.styleRegistryName = 'Modal';
25
+ Modal.elements = ['backdrop', 'box', 'header', 'body', 'footer', 'title', 'description'];
26
+ Modal.rootElement = 'backdrop';
27
+ Modal.defaultProps = {
28
+ closable: true,
29
+ showClose: true,
30
+ dismissOnBackdrop: true,
31
+ closeOnEscape: true,
32
+ };
33
+ WebStyleRegistry.registerComponent(Modal);
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EACL,aAAa,EACb,QAAQ,EACR,WAAW,EACX,SAAS,EACT,WAAW,GACZ,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAE7D,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAE1B;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAiB,EAAE,EAAE;IACzC,MAAM,EAAE,QAAQ,EAAE,GAAG,aAAa,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC,YAAY,EAAE,GAAG,KAAK,EAAE,CAAA;IAE1E,OAAO,CACL,KAAC,aAAa,OAAK,aAAa,YAC9B,KAAC,aAAa,cACZ,MAAC,QAAQ,eACP,KAAC,WAAW,KAAG,EACf,KAAC,SAAS,cAAE,QAAQ,GAAa,EACjC,KAAC,WAAW,KAAG,IACN,GACG,GACF,CACjB,CAAA;AACH,CAAC,CAAA;AAED,KAAK,CAAC,QAAQ,GAAG,aAAa,CAAA;AAC9B,KAAK,CAAC,QAAQ,GAAG,aAAa,CAAA;AAC9B,KAAK,CAAC,GAAG,GAAG,QAAQ,CAAA;AACpB,KAAK,CAAC,MAAM,GAAG,WAAW,CAAA;AAC1B,KAAK,CAAC,IAAI,GAAG,SAAS,CAAA;AACtB,KAAK,CAAC,MAAM,GAAG,WAAW,CAAA;AAE1B,KAAK,CAAC,iBAAiB,GAAG,OAAO,CAAA;AACjC,KAAK,CAAC,QAAQ,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,CAAA;AACxF,KAAK,CAAC,WAAW,GAAG,UAAU,CAAA;AAE9B,KAAK,CAAC,YAAY,GAAG;IACnB,QAAQ,EAAE,IAAI;IACd,SAAS,EAAE,IAAI;IACf,iBAAiB,EAAE,IAAI;IACvB,aAAa,EAAE,IAAI;CACG,CAAA;AAExB,gBAAgB,CAAC,iBAAiB,CAAC,KAAK,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/Modal/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/Modal/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,65 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ import { TypeGuards } from '@codeleap/types';
3
+ import { PatternFormat, NumericFormat, NumberFormatBase } from 'react-number-format';
4
+ import { WebStyleRegistry } from '../../lib/WebStyleRegistry';
5
+ import { useStylesFor } from '../../lib/hooks/useStylesFor';
6
+ import { useNumberIncrement } from './useNumberIncrement';
7
+ import { Field } from '../Field';
8
+ import { toDataAttrs } from '../../lib';
9
+ import { Icon } from '../Icon';
10
+ export * from './types';
11
+ export * from './styles';
12
+ /**
13
+ * Numeric stepper field with `Icon`-driven increment/decrement buttons, optional direct keyboard entry, and `Field` layout (label, helper, left/right sections).
14
+ * Arrow-left/right keyboard events increment or decrement the value while the field is focused; clicking outside closes focus.
15
+ * Uses: `Field.Provider`, `Field.Wrapper`, `Field.Box`, `Field.Heading`, `Field.Helper`, `Field.SectionSlot`, `Icon`, `useNumberIncrement`
16
+ */
17
+ export const NumberIncrement = (props) => {
18
+ const allProps = {
19
+ ...NumberIncrement.defaultProps,
20
+ ...props,
21
+ };
22
+ const { style, disabled, editable, hasSeparator, format, mask, suffix, separator, prefix, formatter, placeholder, label, helper, } = allProps;
23
+ const { isFocused, hasError, hasValue, errorMessage, incrementDisabled, decrementDisabled, innerInputRef, innerWrapperRef, wrapperRef, handleBlur, handleFocus, handleChange, handleChangeInput, onPressInnerWrapper, inputValue, } = useNumberIncrement(allProps);
24
+ const fieldContext = {
25
+ disabled: !!disabled,
26
+ hasValue: !!hasValue,
27
+ error: !!hasError,
28
+ focused: !!isFocused,
29
+ };
30
+ const styles = useStylesFor(NumberIncrement.styleRegistryName, style, fieldContext);
31
+ const stateAttrs = toDataAttrs({ disabled: !!disabled, error: !!hasError, focused: !!isFocused });
32
+ const InputFormat = TypeGuards.isString(format) || TypeGuards.isString(mask)
33
+ ? PatternFormat
34
+ : NumericFormat;
35
+ const shouldUseBaseInput = TypeGuards.isFunction(formatter);
36
+ const Input = shouldUseBaseInput
37
+ ? NumberFormatBase
38
+ : InputFormat;
39
+ const thousandProps = !shouldUseBaseInput ? {
40
+ thousandSeparator: separator,
41
+ thousandsGroupStyle: hasSeparator || TypeGuards.isString(separator) ? 'thousand' : 'none',
42
+ } : {};
43
+ return (_jsx(Field.Provider, { context: fieldContext, label: label, helper: hasError ? errorMessage : helper, componentName: 'number_increment', leftSection: _jsx(Icon, { icon: 'minus', onPress: () => handleChange('decrement'), disabled: disabled || decrementDisabled, style: styles.leftSection }), rightSection: _jsx(Icon, { icon: 'plus', onPress: () => handleChange('increment'), disabled: disabled || incrementDisabled, style: styles.rightSection }), children: _jsxs(Field.Wrapper, { ref: wrapperRef, style: styles.wrapper, children: [_jsx(Field.Heading, { style: styles.heading }), _jsxs(Field.Box, { ref: innerWrapperRef, style: [styles.box, editable ? styles['box:cursor'] : undefined], onClick: onPressInnerWrapper, ...stateAttrs, children: [_jsx(Field.SectionSlot, { position: 'left' }), _jsx(Input, { displayType: 'input', css: [
44
+ styles.input,
45
+ {
46
+ '&:focus': { outline: 'none', borderWidth: 0, borderColor: 'transparent' },
47
+ },
48
+ ], inputMode: 'numeric', onValueChange: handleChangeInput, onBlur: handleBlur, onFocus: handleFocus, value: inputValue, ...thousandProps, suffix: suffix, prefix: prefix, format: TypeGuards.isFunction(formatter) ? formatter : format, mask: mask, placeholder: placeholder, getInputRef: innerInputRef, disabled: disabled }), _jsx(Field.SectionSlot, { position: 'right' })] }), _jsx(Field.Helper, { style: styles.helper })] }) }));
49
+ };
50
+ NumberIncrement.styleRegistryName = 'NumberIncrement';
51
+ NumberIncrement.elements = [...Field.elements, 'input', 'placeholder'];
52
+ NumberIncrement.rootElement = 'wrapper';
53
+ NumberIncrement.defaultProps = {
54
+ max: 1000000000,
55
+ min: 0,
56
+ step: 1,
57
+ editable: true,
58
+ hasSeparator: false,
59
+ mask: undefined,
60
+ separator: null,
61
+ format: null,
62
+ formatter: null,
63
+ };
64
+ WebStyleRegistry.registerComponent(NumberIncrement);
65
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/NumberIncrement/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAG7D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,UAA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E,eAAe,CAAC,WAAW,GAAG,SAAS,CAAA;AAEvC,eAAe,CAAC,YAAY,GAAG;IAC7B,GAAG,EAAE,UAAU;IACf,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,CAAC;IACP,QAAQ,EAAE,IAAI;IACd,YAAY,EAAE,KAAK;IACnB,IAAI,EAAE,SAAS;IACf,SAAS,EAAE,IAAI;IACf,MAAM,EAAE,IAAI;IACZ,SAAS,EAAE,IAAI;CACiB,CAAA;AAElC,gBAAgB,CAAC,iBAAiB,CAAC,eAAe,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/NumberIncrement/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/NumberIncrement/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,113 @@
1
+ import { useRef, useState, useCallback, useEffect, useMemo } from 'react';
2
+ import { useFieldInput } from '../Field';
3
+ import { fields } from '@codeleap/form';
4
+ import { TypeGuards } from '@codeleap/types';
5
+ /**
6
+ * Manages value, focus, increment/decrement button disabled state, and keyboard arrow-key handling for `NumberIncrement`.
7
+ * Clamps the value to `[min, max]` on blur; registers global `keydown` and `mousedown` listeners to track focus outside of React's event system.
8
+ * No provider required; designed to be called only inside `NumberIncrement`.
9
+ */
10
+ export function useNumberIncrement(props) {
11
+ const { value, onValueChange, field, min, max, forceError, step, } = props;
12
+ const [isFocused, setIsFocused] = useState(false);
13
+ const { fieldHandle, validation, innerInputRef, wrapperRef, inputValue, onInputValueChange, } = useFieldInput(field, fields.number, { value, onValueChange });
14
+ const innerWrapperRef = useRef(null);
15
+ const hasValue = TypeGuards.isString(inputValue)
16
+ ? inputValue?.length > 0
17
+ : !TypeGuards.isNil(inputValue);
18
+ const hasError = validation?.showError || !!forceError;
19
+ const errorMessage = validation?.message || forceError;
20
+ const incrementDisabled = useMemo(() => {
21
+ if (TypeGuards.isNumber(max) && (Number(inputValue) >= max)) {
22
+ return true;
23
+ }
24
+ return false;
25
+ }, [inputValue]);
26
+ const decrementDisabled = useMemo(() => {
27
+ if (TypeGuards.isNumber(min) && (Number(inputValue) <= min)) {
28
+ return true;
29
+ }
30
+ return false;
31
+ }, [inputValue]);
32
+ const handleChange = useCallback((action) => {
33
+ if (action === 'increment' && !incrementDisabled) {
34
+ const newValue = Number(inputValue || min) + step;
35
+ onInputValueChange(newValue);
36
+ return;
37
+ }
38
+ else if (action === 'decrement' && !decrementDisabled) {
39
+ const newValue = Number(inputValue || min) - step;
40
+ onInputValueChange(newValue);
41
+ return;
42
+ }
43
+ validation?.onInputBlurred?.();
44
+ }, [validation?.onInputBlurred, inputValue]);
45
+ const handleBlur = useCallback(() => {
46
+ if (TypeGuards.isNumber(max) && (inputValue >= max)) {
47
+ onInputValueChange(max);
48
+ return;
49
+ }
50
+ else if (TypeGuards.isNumber(min) && (inputValue <= min) || !inputValue) {
51
+ onInputValueChange(min);
52
+ return;
53
+ }
54
+ validation?.onInputBlurred?.();
55
+ }, [validation?.onInputBlurred, inputValue]);
56
+ const handleFocus = useCallback(() => {
57
+ setIsFocused(true);
58
+ }, []);
59
+ useEffect(() => {
60
+ function handleKeyboardEvent(event) {
61
+ if (!isFocused)
62
+ return;
63
+ if (event.keyCode === 39 || event.key === 'ArrowRight') {
64
+ handleChange('increment');
65
+ }
66
+ else if (event.keyCode === 37 || event.key === 'ArrowLeft') {
67
+ handleChange('decrement');
68
+ }
69
+ }
70
+ document.addEventListener('keydown', handleKeyboardEvent);
71
+ return () => {
72
+ document.removeEventListener('keydown', handleKeyboardEvent);
73
+ };
74
+ }, [handleChange, isFocused]);
75
+ useEffect(() => {
76
+ function handleClickOutside(event) {
77
+ if (innerWrapperRef.current && !innerWrapperRef.current.contains(event.target)) {
78
+ setIsFocused(false);
79
+ }
80
+ }
81
+ document.addEventListener('mousedown', handleClickOutside);
82
+ return () => {
83
+ document.removeEventListener('mousedown', handleClickOutside);
84
+ };
85
+ }, [innerWrapperRef]);
86
+ const handleChangeInput = (values) => {
87
+ const { floatValue } = values;
88
+ onInputValueChange(Number(floatValue));
89
+ };
90
+ const onPressInnerWrapper = () => {
91
+ setIsFocused(true);
92
+ innerInputRef.current?.focus?.();
93
+ };
94
+ return {
95
+ hasValue,
96
+ hasError,
97
+ errorMessage,
98
+ inputValue: inputValue || min,
99
+ isFocused,
100
+ incrementDisabled,
101
+ decrementDisabled,
102
+ innerInputRef,
103
+ innerWrapperRef,
104
+ handleBlur,
105
+ handleFocus,
106
+ handleChange,
107
+ handleChangeInput,
108
+ onPressInnerWrapper,
109
+ fieldHandle,
110
+ wrapperRef,
111
+ };
112
+ }
113
+ //# sourceMappingURL=useNumberIncrement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNumberIncrement.js","sourceRoot":"","sources":["../../../src/components/NumberIncrement/useNumberIncrement.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAEhF,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAS,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG5C;;;;GAIG;AACH,MAAM,UAAU,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,QAAQ,CAAC,KAAK,CAAC,CAAA;IAEjD,MAAM,EACJ,WAAW,EACX,UAAU,EACV,aAAa,EACb,UAA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ACR,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,44 @@
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
+ import { Touchable } from '../Touchable';
3
+ import { View } from '../View';
4
+ import { usePopState } from '../../lib';
5
+ import { WebStyleRegistry } from '../../lib/WebStyleRegistry';
6
+ import { useStylesFor } from '../../lib/hooks/useStylesFor';
7
+ export * from './styles';
8
+ export * from './types';
9
+ /**
10
+ * Visually hidden overlay that transitions to visible state and registers a
11
+ * browser pop-state entry so the back button can dismiss it.
12
+ * Renders as `Touchable` when `onPress` or `onClick` is provided, otherwise as `View`.
13
+ * Uses: `Touchable`, `View`, `useStylesFor`, `WebStyleRegistry`
14
+ */
15
+ export const Overlay = (overlayProps) => {
16
+ const { visible, style, ...props } = {
17
+ ...Overlay.defaultProps,
18
+ ...overlayProps,
19
+ };
20
+ const styles = useStylesFor(Overlay.styleRegistryName, style);
21
+ usePopState(visible, props?.onPress);
22
+ const isPressable = !!props?.onClick || !!props?.onPress;
23
+ if (isPressable) {
24
+ return (_jsx(Touchable, { ...props, style: [
25
+ { transition: 'opacity 0.2s ease' },
26
+ styles.wrapper,
27
+ visible ? styles['wrapper:visible'] : null,
28
+ ] }));
29
+ }
30
+ return (_jsx(View, { ...props, style: [
31
+ { transition: 'opacity 0.2s ease' },
32
+ styles.wrapper,
33
+ visible ? styles['wrapper:visible'] : null,
34
+ ] }));
35
+ };
36
+ Overlay.styleRegistryName = 'Overlay';
37
+ Overlay.elements = ['wrapper'];
38
+ Overlay.rootElement = 'wrapper';
39
+ Overlay.withVariantTypes = (styles) => {
40
+ return Overlay;
41
+ };
42
+ Overlay.defaultProps = {};
43
+ WebStyleRegistry.registerComponent(Overlay);
44
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Overlay/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAG3D,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AAEvB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,YAA0B,EAAE,EAAE;IACpD,MAAM,EACJ,OAAO,EACP,KAAK,EACL,GAAG,KAAK,EACT,GAAG;QACF,GAAG,OAAO,CAAC,YAAY;QACvB,GAAG,YAAY;KAChB,CAAA;IAED,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAE7D,WAAW,CAAC,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,KAAC,SAAS,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,KAAC,IAAI,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;AAED,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAA;AACrC,OAAO,CAAC,QAAQ,GAAG,CAAC,SAAS,CAAC,CAAA;AAC9B,OAAO,CAAC,WAAW,GAAG,SAAS,CAAA;AAE/B,OAAO,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IAC5D,OAAO,OAA6E,CAAA;AACtF,CAAC,CAAA;AAED,OAAO,CAAC,YAAY,GAAG,EAA2B,CAAA;AAElD,gBAAgB,CAAC,iBAAiB,CAAC,OAAO,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/Overlay/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/Overlay/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,100 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ import { TypeGuards } from '@codeleap/types';
3
+ import { View } from '../View';
4
+ import { Button } from '../Button';
5
+ import { useMediaQuery, usePagination, useStylesFor, WebStyleRegistry } from '../../lib';
6
+ import { useCompositionStyles, useTheme } from '@codeleap/styles';
7
+ export * from './styles';
8
+ export * from './types';
9
+ /**
10
+ * Numbered page-navigation control with optional previous/next arrow buttons and responsive abbreviation of middle pages.
11
+ * Abbreviation behaviour and mobile layout are auto-detected from the `tabletSmall` theme breakpoint but can be overridden via props.
12
+ * Uses: `Button`
13
+ */
14
+ export const PaginationButtons = (props) => {
15
+ const allProps = {
16
+ ...PaginationButtons.defaultProps,
17
+ ...props,
18
+ };
19
+ const { shouldAbbreviate, displayLeftArrow, displayRightArrow, disabled, style, itemProps, controlLeftIconName, controlRightIconName, leftArrowButtonProps, rightArrowButtonProps, abbreviationSymbol, isMobile, ...paginationProps } = allProps;
20
+ const themeMedia = useTheme(store => store?.theme?.media);
21
+ const { boundaries = 2 } = paginationProps;
22
+ const query = themeMedia?.down('tabletSmall');
23
+ const _isMobile = useMediaQuery(query);
24
+ const isMobileQuery = TypeGuards.isBoolean(isMobile) ? isMobile : _isMobile;
25
+ const centeredElementIndex = isMobileQuery ? 3 : boundaries + 1;
26
+ const { range, first, next, previous, setPage, page, status, } = usePagination({
27
+ abbreviationSymbol,
28
+ isMobile: isMobileQuery,
29
+ displayLeftArrow,
30
+ displayRightArrow,
31
+ shouldAbbreviate,
32
+ ...paginationProps,
33
+ });
34
+ const styles = useStylesFor(PaginationButtons.styleRegistryName, style);
35
+ const compositionStyles = useCompositionStyles(['button', 'arrowLeftButton', 'arrowRightButton'], styles);
36
+ const fetchPreviousPage = () => {
37
+ props?.onFetchPreviousPage?.();
38
+ previous?.();
39
+ };
40
+ const fetchNextPage = () => {
41
+ props?.onFetchNextPage?.();
42
+ next?.();
43
+ };
44
+ const fetchPage = (page) => {
45
+ setPage?.(page);
46
+ };
47
+ const onPressItem = ({ item, isArrowLeft, isArrowRight }) => {
48
+ if (item === abbreviationSymbol) {
49
+ return null;
50
+ }
51
+ if (isArrowLeft) {
52
+ if (displayLeftArrow) {
53
+ return fetchPreviousPage();
54
+ }
55
+ else {
56
+ return first();
57
+ }
58
+ }
59
+ if (displayRightArrow && isArrowRight) {
60
+ return fetchNextPage();
61
+ }
62
+ props?.onPressItem?.(item);
63
+ fetchPage(Number(item));
64
+ };
65
+ return (_jsxs(View, { style: styles.wrapper, children: [displayLeftArrow ? (_jsx(Button, { icon: controlLeftIconName, onPress: () => onPressItem({ item: null, isArrowLeft: true, isArrowRight: false }), ...leftArrowButtonProps, style: compositionStyles.arrowLeftButton })) : null, range?.map?.((item, index) => {
66
+ if (props?.renderItem) {
67
+ return props?.renderItem?.(item, index);
68
+ }
69
+ let selected = null;
70
+ switch (status) {
71
+ case 'initial':
72
+ selected = page === index + 1;
73
+ break;
74
+ case 'abreviated':
75
+ selected = index === centeredElementIndex - 1;
76
+ break;
77
+ case 'end':
78
+ selected = page - (Number(item) - index) === index;
79
+ }
80
+ return (_jsx(Button, { text: String(item), selected: selected, onPress: () => onPressItem({ item, isArrowLeft: false, isArrowRight: false }), disabled: disabled, ...itemProps, style: compositionStyles.button }));
81
+ }), displayRightArrow ? (_jsx(Button, { icon: controlRightIconName, onPress: () => onPressItem({ item: null, isArrowLeft: false, isArrowRight: true }), ...rightArrowButtonProps, style: compositionStyles.arrowRightButton })) : null] }));
82
+ };
83
+ PaginationButtons.styleRegistryName = 'PaginationButtons';
84
+ PaginationButtons.elements = ['wrapper', 'button', 'arrowLeftButton', 'arrowRightButton'];
85
+ PaginationButtons.rootElement = 'wrapper';
86
+ PaginationButtons.withVariantTypes = (styles) => {
87
+ return PaginationButtons;
88
+ };
89
+ PaginationButtons.defaultProps = {
90
+ shouldAbbreviate: true,
91
+ displayLeftArrow: true,
92
+ displayRightArrow: true,
93
+ disabled: false,
94
+ isMobile: null,
95
+ abbreviationSymbol: '...',
96
+ controlLeftIconName: 'chevron-left',
97
+ controlRightIconName: 'chevron-right',
98
+ };
99
+ WebStyleRegistry.registerComponent(PaginationButtons);
100
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/PaginationButtons/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,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AAC,MAAM,IACL,IAAI,EAAE,oBAAoB,EAC1B,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,KAC9E,qBAAqB,EACzB,KAAK,EAAE,iBAAiB,CAAC,gBAAgB,GACzC,CACH,CAAC,CAAC,CAAC,IAAI,IACH,CACR,CAAA;AACH,CAAC,CAAA;AAED,iBAAiB,CAAC,iBAAiB,GAAG,mBAAmB,CAAA;AACzD,iBAAiB,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,iBAAiB,EAAE,kBAAkB,CAAC,CAAA;AACzF,iBAAiB,CAAC,WAAW,GAAG,SAAS,CAAA;AAEzC,iBAAiB,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IACtE,OAAO,iBAAiG,CAAA;AAC1G,CAAC,CAAA;AAED,iBAAiB,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,gBAAgB,CAAC,iBAAiB,CAAC,iBAAiB,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/PaginationButtons/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/PaginationButtons/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
+ import { TypeGuards } from '@codeleap/types';
3
+ import { ActivityIndicator } from '../ActivityIndicator';
4
+ import { Text } from '../Text';
5
+ import { View } from '../View';
6
+ import { useStylesFor } from '../../lib/hooks/useStylesFor';
7
+ import { WebStyleRegistry } from '../../lib/WebStyleRegistry';
8
+ import { useNestedStylesByKey } from '@codeleap/styles';
9
+ export * from './styles';
10
+ export * from './types';
11
+ /**
12
+ * 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.
13
+ * Uses: `ActivityIndicator`, `Text`
14
+ */
15
+ export const PaginationIndicator = (props) => {
16
+ const { hasMore, isFetching, noMoreItemsText, activityIndicator, style, indicatorProps, debugName, } = {
17
+ ...PaginationIndicator.defaultProps,
18
+ ...props,
19
+ };
20
+ const styles = useStylesFor(PaginationIndicator.styleRegistryName, style);
21
+ const loaderStyles = useNestedStylesByKey('loader', styles);
22
+ if (isFetching) {
23
+ return activityIndicator || (_jsx(View, { style: styles.wrapper, children: _jsx(ActivityIndicator, { debugName: debugName, ...indicatorProps, style: loaderStyles }) }));
24
+ }
25
+ if (!hasMore) {
26
+ if (TypeGuards.isString(noMoreItemsText) || TypeGuards.isNumber(noMoreItemsText)) {
27
+ return (_jsx(View, { style: styles.wrapper, children: _jsx(Text, { debugName: debugName, style: styles.text, text: String(noMoreItemsText) }) }));
28
+ }
29
+ return noMoreItemsText;
30
+ }
31
+ return null;
32
+ };
33
+ PaginationIndicator.styleRegistryName = 'PaginationIndicator';
34
+ PaginationIndicator.elements = ['wrapper', 'text', 'loader'];
35
+ PaginationIndicator.rootElement = 'wrapper';
36
+ PaginationIndicator.withVariantTypes = (styles) => {
37
+ return PaginationIndicator;
38
+ };
39
+ PaginationIndicator.defaultProps = {};
40
+ WebStyleRegistry.registerComponent(PaginationIndicator);
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sour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OAAO,CACL,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,OAAO,YACzB,KAAC,IAAI,IACH,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,MAAM,CAAC,IAAI,EAClB,IAAI,EAAE,MAAM,CAAC,eAAe,CAAC,GAC7B,GACG,CACR,CAAA;QACH,CAAC;QAED,OAAO,eAAe,CAAA;IACxB,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,mBAAmB,CAAC,iBAAiB,GAAG,qBAAqB,CAAA;AAC7D,mBAAmB,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;AAC5D,mBAAmB,CAAC,WAAW,GAAG,SAAS,CAAA;AAE3C,mBAAmB,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IACxE,OAAO,mBAAqG,CAAA;AAC9G,CAAC,CAAA;AAED,mBAAmB,CAAC,YAAY,GAAG,EAAuC,CAAA;AAE1E,gBAAgB,CAAC,iBAAiB,CAAC,mBAAmB,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/PaginationIndicator/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/PaginationIndicator/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
+ import { motion } from 'motion/react';
3
+ import { View } from '../../components';
4
+ import { WebStyleRegistry } from '../../../lib/WebStyleRegistry';
5
+ import { mergeStyles } from '@codeleap/styles';
6
+ import { useStylesFor } from '../../../lib/hooks/useStylesFor';
7
+ /**
8
+ * Horizontal progress bar made up of N discrete pill segments.
9
+ * Active segments (index < `progress`) receive `styles.segmentActive` merged on top of `styles.segment`.
10
+ * When `animated` is true each active segment fades in with a staggered delay.
11
+ */
12
+ export const ProgressBarSegmented = (props) => {
13
+ const { progress, segments, style, debugName, animated, animatedProps, staggerDelay, ...rest } = {
14
+ ...ProgressBarSegmented.defaultProps,
15
+ ...props,
16
+ };
17
+ const styles = useStylesFor(ProgressBarSegmented.styleRegistryName, style);
18
+ const SegmentComponent = animated ? motion.div : 'div';
19
+ return (_jsx(View, { debugName: debugName, ...rest, style: styles.wrapper, children: Array.from({ length: segments }, (_, i) => {
20
+ const isActive = i < progress;
21
+ return (_jsx(SegmentComponent, { css: 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));
22
+ }) }));
23
+ };
24
+ ProgressBarSegmented.styleRegistryName = 'ProgressBarSegmented';
25
+ ProgressBarSegmented.elements = ['wrapper', 'segment', 'segmentActive'];
26
+ ProgressBarSegmented.rootElement = 'wrapper';
27
+ ProgressBarSegmented.withVariantTypes = (styles) => {
28
+ return ProgressBarSegmented;
29
+ };
30
+ ProgressBarSegmented.defaultProps = {
31
+ progress: 0,
32
+ segments: 5,
33
+ animated: true,
34
+ staggerDelay: 0.05,
35
+ };
36
+ WebStyleRegistry.registerComponent(ProgressBarSegmented);
37
+ //# sourceMappingURL=Segmented.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Segmented.js","sourceRoot":"","sources":["../../../../src/components/Progress/Bar/Segmented.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAmB,W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C,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,KACxF,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,IAL9B,CAAC,CAMN,CACH,CAAA;QACH,CAAC,CAAC,GACG,CACR,CAAA;AACH,CAAC,CAAA;AAED,oBAAoB,CAAC,iBAAiB,GAAG,sBAAsB,CAAA;AAC/D,oBAAoB,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,eAAe,CAAC,CAAA;AACvE,oBAAoB,CAAC,WAAW,GAAG,SAAS,CAAA;AAE5C,oBAAoB,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IACzE,OAAO,oBAAuG,CAAA;AAChH,CAAC,CAAA;AAED,oBAAoB,CAAC,YAAY,GAAG;IAClC,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,IAAI;IACd,YAAY,EAAE,IAAI;CACmB,CAAA;AAEvC,gBAAgB,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAAA"}
@@ -0,0 +1,44 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
+ import { TypeGuards } from '@codeleap/types';
3
+ import { motion } from 'motion/react';
4
+ import { Icon, Text, View } from '../../components';
5
+ import { formatProgress as _formatProgress } from '../utils';
6
+ import { WebStyleRegistry } from '../../../lib/WebStyleRegistry';
7
+ import { mergeStyles } from '@codeleap/styles';
8
+ import { useStylesFor } from '../../../lib/hooks/useStylesFor';
9
+ import { ProgressBarSegmented } from './Segmented';
10
+ export * from './types';
11
+ export * from './styles';
12
+ /**
13
+ * Horizontal progress bar with optional left/right icons and labels.
14
+ * The indicator fills via a `scaleX` transform animated with Framer Motion when `animated` is true.
15
+ * Uses: `Icon`, `Text`
16
+ */
17
+ export const ProgressBar = (props) => {
18
+ const { progress, style, debugName, formatProgress, showProgress, animated, animatedProps, leftIcon, leftIconProps, rightIcon, rightIconProps, text, textProps, leftText, leftTextProps, rightText, rightTextProps, ...rest } = {
19
+ ...ProgressBar.defaultProps,
20
+ ...props,
21
+ };
22
+ const styles = useStylesFor(ProgressBar.styleRegistryName, style);
23
+ const leftIconStyles = mergeStyles([styles.icon, styles.leftIcon]);
24
+ const rightIconStyles = mergeStyles([styles.icon, styles.rightIcon]);
25
+ const leftTextStyles = mergeStyles([styles.text, styles.leftText]);
26
+ const rightTextStyles = mergeStyles([styles.text, styles.rightText]);
27
+ const IndicatorComponent = animated ? motion.div : 'div';
28
+ return (_jsxs(View, { debugName: debugName, ...rest, style: styles.wrapper, children: [!TypeGuards.isNil(leftIcon) ? (_jsx(Icon, { icon: leftIcon, debugName: `leftIcon-${debugName}`, ...leftIconProps, style: leftIconStyles })) : null, TypeGuards.isString(leftText) ? (_jsx(Text, { text: leftText, ...leftTextProps, style: leftTextStyles })) : leftText, _jsx("div", { css: styles.track, role: 'progressbar', "aria-valuenow": progress, "aria-valuemin": 0, "aria-valuemax": 100, children: _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 : {}) }) }), TypeGuards.isString(text) || showProgress ? (_jsx(Text, { text: showProgress ? formatProgress(progress) : text, ...textProps, style: styles.text })) : text, !TypeGuards.isNil(rightIcon) ? (_jsx(Icon, { icon: rightIcon, debugName: `rightIcon-${debugName}`, ...rightIconProps, style: rightIconStyles })) : null, TypeGuards.isString(rightText) ? (_jsx(Text, { text: rightText, ...rightTextProps, style: rightTextStyles })) : rightText] }));
29
+ };
30
+ ProgressBar.styleRegistryName = 'ProgressBar';
31
+ ProgressBar.elements = ['wrapper', 'track', 'indicator', 'text', 'icon', 'leftIcon', 'leftText', 'rightIcon', 'rightText'];
32
+ ProgressBar.rootElement = 'wrapper';
33
+ ProgressBar.withVariantTypes = (styles) => {
34
+ return ProgressBar;
35
+ };
36
+ ProgressBar.defaultProps = {
37
+ progress: 0,
38
+ showProgress: false,
39
+ formatProgress: _formatProgress,
40
+ animated: true,
41
+ };
42
+ ProgressBar.Segmented = ProgressBarSegmented;
43
+ WebStyleRegistry.registerComponent(ProgressBar);
44
+ //# sourceMappingURL=index.js.map