@react-xp/aeiou 0.1.0-rc.1 → 1.0.0-beta.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 (280) hide show
  1. package/dist/cjs/components/a/a.native.js +8 -7
  2. package/dist/cjs/components/a/a.web.js +7 -7
  3. package/dist/cjs/components/d/d.native.js +8 -8
  4. package/dist/cjs/components/d/d.web.js +11 -6
  5. package/dist/cjs/components/e/e.native.js +8 -12
  6. package/dist/cjs/components/e/e.web.js +8 -8
  7. package/dist/cjs/components/i/i.native.js +9 -11
  8. package/dist/cjs/components/i/i.web.js +9 -5
  9. package/dist/cjs/components/l/l.web.js +7 -9
  10. package/dist/cjs/components/o/o.native.js +4 -4
  11. package/dist/cjs/components/o/o.web.js +7 -4
  12. package/dist/cjs/components/p/p.native.js +4 -4
  13. package/dist/cjs/components/p/p.web.js +7 -4
  14. package/dist/cjs/components/s/s.native.js +4 -4
  15. package/dist/cjs/components/t/t.native.js +7 -8
  16. package/dist/cjs/components/t/t.web.js +7 -8
  17. package/dist/cjs/components/u/errorBoundary.js +27 -0
  18. package/dist/cjs/components/u/provider.native.js +3 -2
  19. package/dist/cjs/components/u/provider.web.js +3 -2
  20. package/dist/cjs/hooks/index.js +0 -2
  21. package/dist/cjs/hooks/index.native.js +2 -1
  22. package/dist/cjs/hooks/index.web.js +2 -1
  23. package/dist/cjs/hooks/useInteractiveHandlers/useInteractiveHandlers.native.js +43 -0
  24. package/dist/cjs/hooks/useInteractiveHandlers/useInteractiveHandlers.web.js +45 -0
  25. package/dist/cjs/hooks/useInteractiveState/useInteractiveState.native.js +52 -54
  26. package/dist/cjs/hooks/useInteractiveState/useInteractiveState.web.js +56 -53
  27. package/dist/cjs/hooks/useOnChange.js +1 -1
  28. package/dist/cjs/hooks/useStyles/useStyles.helpers.js +35 -0
  29. package/dist/cjs/hooks/useStyles/useStyles.native.js +42 -0
  30. package/dist/cjs/hooks/useStyles/useStyles.web.js +71 -0
  31. package/dist/esm/components/a/a.native.js +9 -8
  32. package/dist/esm/components/a/a.web.js +7 -7
  33. package/dist/esm/components/d/d.native.js +6 -6
  34. package/dist/esm/components/d/d.web.js +9 -4
  35. package/dist/esm/components/e/e.native.js +7 -11
  36. package/dist/esm/components/e/e.web.js +7 -7
  37. package/dist/esm/components/i/i.native.js +7 -9
  38. package/dist/esm/components/i/i.web.js +7 -3
  39. package/dist/esm/components/l/l.web.js +6 -8
  40. package/dist/esm/components/o/o.native.js +3 -3
  41. package/dist/esm/components/o/o.web.js +6 -3
  42. package/dist/esm/components/p/p.native.js +3 -3
  43. package/dist/esm/components/p/p.web.js +6 -3
  44. package/dist/esm/components/s/s.native.js +3 -3
  45. package/dist/esm/components/t/t.native.js +6 -7
  46. package/dist/esm/components/t/t.web.js +6 -7
  47. package/dist/esm/components/u/errorBoundary.js +23 -0
  48. package/dist/esm/components/u/provider.native.js +3 -2
  49. package/dist/esm/components/u/provider.web.js +3 -2
  50. package/dist/esm/hooks/index.js +0 -2
  51. package/dist/esm/hooks/index.native.js +2 -1
  52. package/dist/esm/hooks/index.web.js +2 -1
  53. package/dist/esm/hooks/useInteractiveHandlers/useInteractiveHandlers.native.js +40 -0
  54. package/dist/esm/hooks/useInteractiveHandlers/useInteractiveHandlers.web.js +42 -0
  55. package/dist/esm/hooks/useInteractiveState/useInteractiveState.native.js +53 -55
  56. package/dist/esm/hooks/useInteractiveState/useInteractiveState.web.js +57 -54
  57. package/dist/esm/hooks/useOnChange.js +1 -1
  58. package/dist/esm/hooks/useStyles/useStyles.helpers.js +29 -0
  59. package/dist/esm/hooks/useStyles/useStyles.native.js +38 -0
  60. package/dist/esm/hooks/useStyles/useStyles.web.js +66 -0
  61. package/dist/native/cjs/components/a/a.native.js +17 -0
  62. package/dist/native/cjs/components/a/a.web.js +15 -0
  63. package/dist/native/cjs/components/a/index.native.js +17 -0
  64. package/dist/native/cjs/components/a/index.web.js +17 -0
  65. package/dist/native/cjs/components/d/d.native.js +28 -0
  66. package/dist/native/cjs/components/d/d.web.js +38 -0
  67. package/dist/native/cjs/components/d/index.native.js +17 -0
  68. package/dist/native/cjs/components/d/index.web.js +17 -0
  69. package/dist/native/cjs/components/e/e.native.js +16 -0
  70. package/dist/native/cjs/components/e/e.web.js +15 -0
  71. package/dist/native/cjs/components/e/index.native.js +17 -0
  72. package/dist/native/cjs/components/e/index.web.js +17 -0
  73. package/dist/native/cjs/components/i/i.native.js +28 -0
  74. package/dist/native/cjs/components/i/i.web.js +27 -0
  75. package/dist/native/cjs/components/i/index.native.js +17 -0
  76. package/dist/native/cjs/components/i/index.web.js +17 -0
  77. package/dist/native/cjs/components/i/useIUtils.js +71 -0
  78. package/dist/native/cjs/components/index.js +26 -0
  79. package/dist/native/cjs/components/index.native.js +26 -0
  80. package/dist/native/cjs/components/index.web.js +26 -0
  81. package/dist/native/cjs/components/l/index.native.js +17 -0
  82. package/dist/native/cjs/components/l/index.web.js +17 -0
  83. package/dist/native/cjs/components/l/l.native.js +10 -0
  84. package/dist/native/cjs/components/l/l.web.js +15 -0
  85. package/dist/native/cjs/components/o/index.native.js +17 -0
  86. package/dist/native/cjs/components/o/index.web.js +17 -0
  87. package/dist/native/cjs/components/o/o.native.js +12 -0
  88. package/dist/native/cjs/components/o/o.web.js +15 -0
  89. package/dist/native/cjs/components/p/index.native.js +17 -0
  90. package/dist/native/cjs/components/p/index.web.js +17 -0
  91. package/dist/native/cjs/components/p/p.native.js +13 -0
  92. package/dist/native/cjs/components/p/p.web.js +16 -0
  93. package/dist/native/cjs/components/s/index.native.js +17 -0
  94. package/dist/native/cjs/components/s/index.web.js +17 -0
  95. package/dist/native/cjs/components/s/s.native.js +10 -0
  96. package/dist/native/cjs/components/s/s.web.js +10 -0
  97. package/dist/native/cjs/components/t/index.native.js +17 -0
  98. package/dist/native/cjs/components/t/index.web.js +17 -0
  99. package/dist/native/cjs/components/t/t.native.js +15 -0
  100. package/dist/native/cjs/components/t/t.web.js +15 -0
  101. package/dist/native/cjs/components/u/context.js +14 -0
  102. package/dist/native/cjs/components/u/errorBoundary.js +27 -0
  103. package/dist/native/cjs/components/u/index.native.js +19 -0
  104. package/dist/native/cjs/components/u/index.web.js +19 -0
  105. package/dist/native/cjs/components/u/provider.native.js +24 -0
  106. package/dist/native/cjs/components/u/provider.web.js +21 -0
  107. package/dist/native/cjs/components/u/useUniverse.js +8 -0
  108. package/dist/native/cjs/hooks/index.js +19 -0
  109. package/dist/native/cjs/hooks/index.native.js +22 -0
  110. package/dist/native/cjs/hooks/index.web.js +22 -0
  111. package/dist/native/cjs/hooks/useCn.js +15 -0
  112. package/dist/native/cjs/hooks/useInteractiveHandlers/useInteractiveHandlers.native.js +43 -0
  113. package/dist/native/cjs/hooks/useInteractiveHandlers/useInteractiveHandlers.web.js +45 -0
  114. package/dist/native/cjs/hooks/useInteractiveState/useInteractiveState.native.js +69 -0
  115. package/dist/native/cjs/hooks/useInteractiveState/useInteractiveState.web.js +74 -0
  116. package/dist/native/cjs/hooks/useOnChange.js +18 -0
  117. package/dist/native/cjs/hooks/useProps.js +66 -0
  118. package/dist/native/cjs/hooks/useStyles/useStyles.helpers.js +35 -0
  119. package/dist/native/cjs/hooks/useStyles/useStyles.native.js +42 -0
  120. package/dist/native/cjs/hooks/useStyles/useStyles.types.js +2 -0
  121. package/dist/native/cjs/hooks/useStyles/useStyles.web.js +71 -0
  122. package/dist/native/cjs/index.js +19 -0
  123. package/dist/native/cjs/index.native.js +19 -0
  124. package/dist/native/cjs/index.web.js +19 -0
  125. package/dist/native/cjs/types/base.js +2 -0
  126. package/dist/native/cjs/types/index.js +17 -0
  127. package/dist/native/esm/components/a/a.native.js +13 -0
  128. package/dist/native/esm/components/a/a.web.js +11 -0
  129. package/dist/native/esm/components/a/index.native.js +1 -0
  130. package/dist/native/esm/components/a/index.web.js +1 -0
  131. package/dist/native/esm/components/d/d.native.js +24 -0
  132. package/dist/native/esm/components/d/d.web.js +34 -0
  133. package/dist/native/esm/components/d/index.native.js +1 -0
  134. package/dist/native/esm/components/d/index.web.js +1 -0
  135. package/dist/native/esm/components/e/e.native.js +12 -0
  136. package/dist/native/esm/components/e/e.web.js +11 -0
  137. package/dist/native/esm/components/e/index.native.js +1 -0
  138. package/dist/native/esm/components/e/index.web.js +1 -0
  139. package/dist/native/esm/components/i/i.native.js +24 -0
  140. package/dist/native/esm/components/i/i.web.js +23 -0
  141. package/dist/native/esm/components/i/index.native.js +1 -0
  142. package/dist/native/esm/components/i/index.web.js +1 -0
  143. package/dist/native/esm/components/i/useIUtils.js +67 -0
  144. package/dist/native/esm/components/index.js +10 -0
  145. package/dist/native/esm/components/index.native.js +10 -0
  146. package/dist/native/esm/components/index.web.js +10 -0
  147. package/dist/native/esm/components/l/index.native.js +1 -0
  148. package/dist/native/esm/components/l/index.web.js +1 -0
  149. package/dist/native/esm/components/l/l.native.js +6 -0
  150. package/dist/native/esm/components/l/l.web.js +11 -0
  151. package/dist/native/esm/components/o/index.native.js +1 -0
  152. package/dist/native/esm/components/o/index.web.js +1 -0
  153. package/dist/native/esm/components/o/o.native.js +8 -0
  154. package/dist/native/esm/components/o/o.web.js +11 -0
  155. package/dist/native/esm/components/p/index.native.js +1 -0
  156. package/dist/native/esm/components/p/index.web.js +1 -0
  157. package/dist/native/esm/components/p/p.native.js +9 -0
  158. package/dist/native/esm/components/p/p.web.js +12 -0
  159. package/dist/native/esm/components/s/index.native.js +1 -0
  160. package/dist/native/esm/components/s/index.web.js +1 -0
  161. package/dist/native/esm/components/s/s.native.js +7 -0
  162. package/dist/native/esm/components/s/s.web.js +6 -0
  163. package/dist/native/esm/components/t/index.native.js +1 -0
  164. package/dist/native/esm/components/t/index.web.js +1 -0
  165. package/dist/native/esm/components/t/t.native.js +11 -0
  166. package/dist/native/esm/components/t/t.web.js +11 -0
  167. package/dist/native/esm/components/u/context.js +11 -0
  168. package/dist/native/esm/components/u/errorBoundary.js +23 -0
  169. package/dist/native/esm/components/u/index.native.js +3 -0
  170. package/dist/native/esm/components/u/index.web.js +3 -0
  171. package/dist/native/esm/components/u/provider.native.js +20 -0
  172. package/dist/native/esm/components/u/provider.web.js +17 -0
  173. package/dist/native/esm/components/u/useUniverse.js +5 -0
  174. package/dist/native/esm/hooks/index.js +3 -0
  175. package/dist/native/esm/hooks/index.native.js +6 -0
  176. package/dist/native/esm/hooks/index.web.js +6 -0
  177. package/dist/native/esm/hooks/useCn.js +8 -0
  178. package/dist/native/esm/hooks/useInteractiveHandlers/useInteractiveHandlers.native.js +40 -0
  179. package/dist/native/esm/hooks/useInteractiveHandlers/useInteractiveHandlers.web.js +42 -0
  180. package/dist/native/esm/hooks/useInteractiveState/useInteractiveState.native.js +66 -0
  181. package/dist/native/esm/hooks/useInteractiveState/useInteractiveState.web.js +71 -0
  182. package/dist/native/esm/hooks/useOnChange.js +14 -0
  183. package/dist/native/esm/hooks/useProps.js +59 -0
  184. package/dist/native/esm/hooks/useStyles/useStyles.helpers.js +29 -0
  185. package/dist/native/esm/hooks/useStyles/useStyles.native.js +38 -0
  186. package/dist/native/esm/hooks/useStyles/useStyles.types.js +1 -0
  187. package/dist/native/esm/hooks/useStyles/useStyles.web.js +66 -0
  188. package/dist/native/esm/index.js +3 -0
  189. package/dist/native/esm/index.native.js +3 -0
  190. package/dist/native/esm/index.web.js +3 -0
  191. package/dist/native/esm/types/base.js +1 -0
  192. package/dist/native/esm/types/index.js +1 -0
  193. package/dist/native/tsconfig.native.cjs.tsbuildinfo +1 -0
  194. package/dist/native/tsconfig.native.esm.tsbuildinfo +1 -0
  195. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  196. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  197. package/dist/types/components/a/a.native.d.ts +1 -1
  198. package/dist/types/components/a/a.native.d.ts.map +1 -1
  199. package/dist/types/components/a/a.web.d.ts +1 -1
  200. package/dist/types/components/a/a.web.d.ts.map +1 -1
  201. package/dist/types/components/d/d.native.d.ts +1 -1
  202. package/dist/types/components/d/d.native.d.ts.map +1 -1
  203. package/dist/types/components/d/d.web.d.ts +1 -1
  204. package/dist/types/components/d/d.web.d.ts.map +1 -1
  205. package/dist/types/components/e/e.native.d.ts +1 -1
  206. package/dist/types/components/e/e.native.d.ts.map +1 -1
  207. package/dist/types/components/e/e.web.d.ts +3 -1
  208. package/dist/types/components/e/e.web.d.ts.map +1 -1
  209. package/dist/types/components/i/i.native.d.ts +1 -1
  210. package/dist/types/components/i/i.native.d.ts.map +1 -1
  211. package/dist/types/components/i/i.web.d.ts +1 -1
  212. package/dist/types/components/i/i.web.d.ts.map +1 -1
  213. package/dist/types/components/i/useIUtils.d.ts +2 -2
  214. package/dist/types/components/l/l.web.d.ts +1 -1
  215. package/dist/types/components/l/l.web.d.ts.map +1 -1
  216. package/dist/types/components/o/o.native.d.ts +1 -1
  217. package/dist/types/components/o/o.native.d.ts.map +1 -1
  218. package/dist/types/components/o/o.web.d.ts +1 -1
  219. package/dist/types/components/o/o.web.d.ts.map +1 -1
  220. package/dist/types/components/p/p.native.d.ts +1 -1
  221. package/dist/types/components/p/p.native.d.ts.map +1 -1
  222. package/dist/types/components/p/p.web.d.ts +1 -1
  223. package/dist/types/components/p/p.web.d.ts.map +1 -1
  224. package/dist/types/components/s/s.native.d.ts +1 -1
  225. package/dist/types/components/s/s.native.d.ts.map +1 -1
  226. package/dist/types/components/t/t.native.d.ts +1 -1
  227. package/dist/types/components/t/t.native.d.ts.map +1 -1
  228. package/dist/types/components/t/t.web.d.ts +3 -1
  229. package/dist/types/components/t/t.web.d.ts.map +1 -1
  230. package/dist/types/components/u/errorBoundary.d.ts +18 -0
  231. package/dist/types/components/u/errorBoundary.d.ts.map +1 -0
  232. package/dist/types/components/u/provider.native.d.ts +1 -1
  233. package/dist/types/components/u/provider.native.d.ts.map +1 -1
  234. package/dist/types/components/u/provider.web.d.ts +1 -1
  235. package/dist/types/components/u/provider.web.d.ts.map +1 -1
  236. package/dist/types/components/u/types.d.ts +5 -0
  237. package/dist/types/components/u/types.d.ts.map +1 -1
  238. package/dist/types/hooks/index.d.ts +0 -2
  239. package/dist/types/hooks/index.d.ts.map +1 -1
  240. package/dist/types/hooks/index.native.d.ts +2 -1
  241. package/dist/types/hooks/index.native.d.ts.map +1 -1
  242. package/dist/types/hooks/index.web.d.ts +2 -1
  243. package/dist/types/hooks/index.web.d.ts.map +1 -1
  244. package/dist/types/hooks/useInteractiveHandlers/useInteractiveHandlers.native.d.ts +11 -0
  245. package/dist/types/hooks/useInteractiveHandlers/useInteractiveHandlers.native.d.ts.map +1 -0
  246. package/dist/types/hooks/useInteractiveHandlers/useInteractiveHandlers.web.d.ts +12 -0
  247. package/dist/types/hooks/useInteractiveHandlers/useInteractiveHandlers.web.d.ts.map +1 -0
  248. package/dist/types/hooks/useInteractiveState/useInteractiveState.native.d.ts +20 -2
  249. package/dist/types/hooks/useInteractiveState/useInteractiveState.native.d.ts.map +1 -1
  250. package/dist/types/hooks/useInteractiveState/useInteractiveState.web.d.ts +21 -2
  251. package/dist/types/hooks/useInteractiveState/useInteractiveState.web.d.ts.map +1 -1
  252. package/dist/types/hooks/useOnChange.d.ts +3 -3
  253. package/dist/types/hooks/useOnChange.d.ts.map +1 -1
  254. package/dist/types/hooks/useStyles/useStyles.helpers.d.ts +171 -0
  255. package/dist/types/hooks/useStyles/useStyles.helpers.d.ts.map +1 -0
  256. package/dist/types/hooks/useStyles/useStyles.native.d.ts +15 -0
  257. package/dist/types/hooks/useStyles/useStyles.native.d.ts.map +1 -0
  258. package/dist/types/hooks/useStyles/useStyles.types.d.ts +6 -0
  259. package/dist/types/hooks/useStyles/useStyles.types.d.ts.map +1 -0
  260. package/dist/types/hooks/useStyles/useStyles.web.d.ts +11 -0
  261. package/dist/types/hooks/useStyles/useStyles.web.d.ts.map +1 -0
  262. package/dist/types/types/base.d.ts +56 -13
  263. package/dist/types/types/base.d.ts.map +1 -1
  264. package/package.json +5 -6
  265. package/dist/cjs/hooks/useAction/useAction.native.js +0 -18
  266. package/dist/cjs/hooks/useAction/useAction.web.js +0 -21
  267. package/dist/esm/hooks/useAction/useAction.native.js +0 -14
  268. package/dist/esm/hooks/useAction/useAction.web.js +0 -17
  269. package/dist/types/hooks/useAction/types.d.ts +0 -7
  270. package/dist/types/hooks/useAction/types.d.ts.map +0 -1
  271. package/dist/types/hooks/useAction/useAction.native.d.ts +0 -5
  272. package/dist/types/hooks/useAction/useAction.native.d.ts.map +0 -1
  273. package/dist/types/hooks/useAction/useAction.web.d.ts +0 -5
  274. package/dist/types/hooks/useAction/useAction.web.d.ts.map +0 -1
  275. package/dist/types/hooks/useInteractiveState/useInteractiveState.types.d.ts +0 -24
  276. package/dist/types/hooks/useInteractiveState/useInteractiveState.types.d.ts.map +0 -1
  277. /package/dist/cjs/hooks/{useAction/types.js → useStyles/useStyles.types.js} +0 -0
  278. /package/dist/esm/hooks/{useAction/types.js → useStyles/useStyles.types.js} +0 -0
  279. /package/dist/{cjs/hooks/useInteractiveState/useInteractiveState.types.js → native/cjs/components/u/types.js} +0 -0
  280. /package/dist/{esm/hooks/useInteractiveState/useInteractiveState.types.js → native/esm/components/u/types.js} +0 -0
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { ScrollView } from 'react-native';
3
- import { useCn } from '../../hooks/index.native';
4
- export function O({ className, children, horizontal, ref, ...rest }) {
3
+ import { useCn } from '../../hooks/useCn';
4
+ export function O({ className, children, horizontal, ref, ...restProps }) {
5
5
  const cn = useCn();
6
- return (_jsx(ScrollView, { ref: ref, className: cn(className), horizontal: horizontal, ...rest, children: children }));
6
+ return (_jsx(ScrollView, { ref: ref, className: cn(className), horizontal: horizontal, ...restProps, children: children }));
7
7
  }
8
8
  export const Overflow = O;
@@ -1,8 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useCn } from '../../hooks/index.web';
3
- export function O({ className, children, horizontal, ref, ...rest }) {
2
+ import { useCn } from '../../hooks/useCn';
3
+ import { useInteractiveHandlers, useStyles } from '../../index.web';
4
+ export function O({ className, children, horizontal, ref, style, ...restProps }) {
4
5
  const cn = useCn();
6
+ const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
7
+ const { getStyles } = useStyles();
5
8
  const overflowClass = horizontal ? 'overflow-x-auto' : 'overflow-y-auto';
6
- return (_jsx("div", { ref: ref, className: cn(overflowClass, className), ...rest, children: children }));
9
+ return (_jsx("div", { ref: ref, className: cn(overflowClass, className), ...restProps, ...eventHandlers, ...getStyles({ disabled, style }), children: children }));
7
10
  }
8
11
  export const Overflow = O;
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Image } from 'react-native';
3
- import { useCn } from '../../hooks/index.native';
4
- export function P({ className, src, source, ref, ...rest }) {
3
+ import { useCn } from '../../hooks/useCn';
4
+ export function P({ className, src, source, ref, ...restProps }) {
5
5
  const cn = useCn();
6
6
  const finalSource = src != null ? { uri: src } : source;
7
- return (_jsx(Image, { ref: ref, className: cn(className), source: finalSource, ...rest }));
7
+ return (_jsx(Image, { ref: ref, className: cn(className), source: finalSource, ...restProps }));
8
8
  }
9
9
  export const Picture = P;
@@ -1,9 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useCn } from '../../hooks/index.web';
3
- export function P({ alt, className, ref, ...rest }) {
2
+ import { useCn } from '../../hooks/useCn';
3
+ import { useInteractiveHandlers, useStyles } from '../../index.web';
4
+ export function P({ alt, className, ref, style, source, src, ...restProps }) {
4
5
  const cn = useCn();
6
+ const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
7
+ const { getStyles } = useStyles();
5
8
  return (
6
9
  // biome-ignore lint/a11y/useAltText: <explanation>
7
- _jsx("img", { alt: alt, "aria-label": alt, ref: ref, className: cn('object-cover', className), ...rest }));
10
+ _jsx("img", { alt: alt, "aria-label": alt, ref: ref, className: cn('object-cover', className), src: src ?? source, ...restProps, ...eventHandlers, ...getStyles({ disabled, style }) }));
8
11
  }
9
12
  export const Picture = P;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { SafeAreaView, } from 'react-native-safe-area-context';
3
- import { useCn } from '../../hooks/index.native';
4
- export function S({ className, children, ref, ...rest }) {
3
+ import { useCn } from '../../hooks/useCn';
4
+ export function S({ className, children, ref, ...restProps }) {
5
5
  const cn = useCn();
6
- return (_jsx(SafeAreaView, { ref: ref, className: cn(className), ...rest, children: children }));
6
+ return (_jsx(SafeAreaView, { ref: ref, className: cn(className), ...restProps, children: children }));
7
7
  }
@@ -1,12 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Text as RNText } from 'react-native';
3
- import { useAction, useCn } from '../../hooks/index.native';
4
- export function T({ className, children, onClick, onPress, ref, ...rest }) {
3
+ import { useCn } from '../../hooks/useCn';
4
+ import { useInteractiveHandlers, useStyles } from '../../index.native';
5
+ export function T({ className, children, ref, style, ...restProps }) {
5
6
  const cn = useCn();
6
- const { onAction } = useAction({
7
- onClick,
8
- onPress,
9
- });
10
- return (_jsx(RNText, { ref: ref, className: cn('leading-relaxed', className), onPress: onAction, ...rest, children: children }));
7
+ const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
8
+ const { getStyles } = useStyles();
9
+ return (_jsx(RNText, { ref: ref, className: cn('leading-relaxed', className), ...restProps, ...eventHandlers, ...getStyles({ disabled, style }), children: children }));
11
10
  }
12
11
  export const Text = T;
@@ -1,12 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useAction, useCn } from '../../hooks/index.web';
3
- export function T({ className, children, as = 'span', onClick, onPress, ref, ...rest }) {
2
+ import { useCn } from '../../hooks/useCn';
3
+ import { useInteractiveHandlers, useStyles } from '../../index.web';
4
+ export function T({ as = 'span', className, children, ref, style, ...restProps }) {
4
5
  const cn = useCn();
5
- const { onAction } = useAction({
6
- onClick,
7
- onPress,
8
- });
6
+ const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
7
+ const { getStyles } = useStyles();
9
8
  const Comp = as;
10
- return (_jsx(Comp, { ref: ref, className: cn('leading-relaxed', className), onClick: onAction, ...rest, children: children }));
9
+ return (_jsx(Comp, { ref: ref, className: cn('leading-relaxed', className), ...restProps, ...eventHandlers, ...getStyles({ disabled, style }), children: children }));
11
10
  }
12
11
  export const Text = T;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Component } from 'react';
3
+ export class ErrorBoundary extends Component {
4
+ constructor(props) {
5
+ super(props);
6
+ this.state = { hasError: false };
7
+ }
8
+ static getDerivedStateFromError() {
9
+ return { hasError: true };
10
+ }
11
+ componentDidCatch(error, errorInfo) {
12
+ this.props.onError?.callback?.(error, errorInfo);
13
+ }
14
+ render() {
15
+ if (this.state.hasError) {
16
+ if (this.props.onError?.render) {
17
+ return this.props.onError.render;
18
+ }
19
+ return _jsx("h1", { children: "Ocorreu um erro. Por favor, tente novamente mais tarde." });
20
+ }
21
+ return this.props.children;
22
+ }
23
+ }
@@ -2,7 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useMemo, useState } from 'react';
3
3
  import { Appearance } from 'react-native';
4
4
  import { UniverseContext } from './context';
5
- export function U({ children, config }) {
5
+ import { ErrorBoundary } from './errorBoundary';
6
+ export function U({ children, config, onError }) {
6
7
  const systemColorScheme = Appearance.getColorScheme() ?? 'light';
7
8
  const [colorScheme, setColorScheme] = useState(config?.colorScheme ?? 'system');
8
9
  const [locale, setLocale] = useState(config?.locale ?? 'en-US');
@@ -14,6 +15,6 @@ export function U({ children, config }) {
14
15
  setColorScheme,
15
16
  setLocale,
16
17
  }), [colorScheme, locale, systemColorScheme]);
17
- return (_jsx(UniverseContext.Provider, { value: value, children: children }));
18
+ return (_jsx(ErrorBoundary, { onError: onError, children: _jsx(UniverseContext.Provider, { value: value, children: children }) }));
18
19
  }
19
20
  export const Universe = U;
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useMemo, useState } from 'react';
3
3
  import { UniverseContext } from './context';
4
- export function U({ children, config }) {
4
+ import { ErrorBoundary } from './errorBoundary';
5
+ export function U({ children, config, onError }) {
5
6
  const [colorScheme, setColorScheme] = useState(config?.colorScheme ?? 'system');
6
7
  const [locale, setLocale] = useState(config?.locale ?? 'en-US');
7
8
  const value = useMemo(() => ({
@@ -11,6 +12,6 @@ export function U({ children, config }) {
11
12
  setColorScheme,
12
13
  setLocale,
13
14
  }), [colorScheme, locale]);
14
- return (_jsx(UniverseContext.Provider, { value: value, children: children }));
15
+ return (_jsx(ErrorBoundary, { onError: onError, children: _jsx(UniverseContext.Provider, { value: value, children: children }) }));
15
16
  }
16
17
  export const Universe = U;
@@ -1,5 +1,3 @@
1
- export * from './useAction/useAction.web';
2
1
  export * from './useCn';
3
- export * from './useInteractiveState/useInteractiveState.web';
4
2
  export * from './useOnChange';
5
3
  export * from './useProps';
@@ -1,5 +1,6 @@
1
- export * from './useAction/useAction.native';
2
1
  export * from './useCn';
2
+ export * from './useInteractiveHandlers/useInteractiveHandlers.native';
3
3
  export * from './useInteractiveState/useInteractiveState.native';
4
4
  export * from './useOnChange';
5
5
  export * from './useProps';
6
+ export * from './useStyles/useStyles.native';
@@ -1,5 +1,6 @@
1
- export * from './useAction/useAction.web';
2
1
  export * from './useCn';
2
+ export * from './useInteractiveHandlers/useInteractiveHandlers.web';
3
3
  export * from './useInteractiveState/useInteractiveState.web';
4
4
  export * from './useOnChange';
5
5
  export * from './useProps';
6
+ export * from './useStyles/useStyles.web';
@@ -0,0 +1,40 @@
1
+ import { useRef } from 'react';
2
+ export function useInteractiveHandlers({ disabled, onBlur, onClick, onFocus, onPress, onIn, onOut, } = {}) {
3
+ const offOn = useRef('off');
4
+ const eventHandlers = {
5
+ onBlur: (e) => {
6
+ if (disabled) {
7
+ return;
8
+ }
9
+ onBlur?.(e);
10
+ },
11
+ onFocus: (e) => {
12
+ if (disabled) {
13
+ return;
14
+ }
15
+ onFocus?.(e);
16
+ },
17
+ onPress: (e) => {
18
+ if (disabled) {
19
+ return;
20
+ }
21
+ if ((onIn || onOut) && offOn.current === 'off') {
22
+ offOn.current = 'on';
23
+ onIn?.(e);
24
+ }
25
+ if ((onIn || onOut) && offOn.current === 'on') {
26
+ offOn.current = 'off';
27
+ onOut?.(e);
28
+ }
29
+ if (onPress) {
30
+ onPress?.(e);
31
+ return;
32
+ }
33
+ onClick?.(e);
34
+ },
35
+ };
36
+ return {
37
+ disabled,
38
+ eventHandlers,
39
+ };
40
+ }
@@ -0,0 +1,42 @@
1
+ export function useInteractiveHandlers({ disabled, onBlur, onClick, onFocus, onPress, onIn, onOut, } = {}) {
2
+ const eventHandlers = {
3
+ onBlur: (e) => {
4
+ if (disabled) {
5
+ return;
6
+ }
7
+ onBlur?.(e);
8
+ },
9
+ onClick: (e) => {
10
+ if (disabled) {
11
+ return;
12
+ }
13
+ if (onClick) {
14
+ onClick?.(e);
15
+ return;
16
+ }
17
+ onPress?.(e);
18
+ },
19
+ onFocus: (e) => {
20
+ if (disabled) {
21
+ return;
22
+ }
23
+ onFocus?.(e);
24
+ },
25
+ onMouseEnter: (e) => {
26
+ if (disabled) {
27
+ return;
28
+ }
29
+ onIn?.(e);
30
+ },
31
+ onMouseLeave: (e) => {
32
+ if (disabled) {
33
+ return;
34
+ }
35
+ onOut?.(e);
36
+ },
37
+ };
38
+ return {
39
+ disabled,
40
+ eventHandlers,
41
+ };
42
+ }
@@ -1,68 +1,66 @@
1
- import { useEffect, useMemo, useState } from 'react';
2
- function computeVisualState(state) {
3
- if (state.disabled)
4
- return 'disabled';
5
- if (state.pressed)
6
- return 'pressed';
7
- if (state.hovered)
8
- return 'hovered';
9
- if (state.focused)
10
- return 'focused';
11
- return 'default';
12
- }
13
- function toDataAttrs(state) {
14
- const visual = computeVisualState(state);
15
- return {
16
- 'data-state': visual,
17
- 'data-hovered': String(state.hovered),
18
- 'data-pressed': String(state.pressed),
19
- 'data-focused': String(state.focused),
20
- 'data-disabled': String(state.disabled),
1
+ import { useRef, useState } from 'react';
2
+ export function useInteractiveState({ disabled, onBlur, onClick, onFocus, onPress, onIn, onOut, } = {}) {
3
+ const offOn = useRef('off');
4
+ const [interactiveState, setInteractiveState] = useState('idle');
5
+ const dataAttrs = {
6
+ 'data-state': interactiveState,
7
+ 'data-disabled': disabled ? 'true' : 'false',
8
+ 'data-focused': interactiveState === 'focused' ? 'true' : 'false',
9
+ 'data-hovered': interactiveState === 'hovered' ? 'true' : 'false',
10
+ 'data-pressed': interactiveState === 'pressed' ? 'true' : 'false',
21
11
  };
22
- }
23
- export function useInteractiveState(options = {}) {
24
- const { disabled = false } = options;
25
- const [state, setState] = useState({
26
- hovered: false,
27
- pressed: false,
28
- focused: false,
29
- disabled,
30
- });
31
- useEffect(() => {
32
- setState((prev) => ({ ...prev, disabled }));
33
- }, [disabled]);
34
- const eventHandlers = useMemo(() => ({
35
- onMouseEnter: () => {
36
- if (disabled)
12
+ const eventHandlers = {
13
+ onBlur: (e) => {
14
+ if (disabled) {
37
15
  return;
38
- setState((prev) => ({ ...prev, hovered: true }));
16
+ }
17
+ onBlur?.(e);
18
+ setInteractiveState('idle');
39
19
  },
40
- onMouseLeave: () => {
41
- if (disabled)
20
+ onFocus: (e) => {
21
+ if (disabled) {
42
22
  return;
43
- setState((prev) => ({ ...prev, hovered: false, pressed: false }));
23
+ }
24
+ onFocus?.(e);
25
+ setInteractiveState('focused');
44
26
  },
45
- onMouseDown: () => {
46
- if (disabled)
27
+ onPress: (e) => {
28
+ if (disabled) {
47
29
  return;
48
- setState((prev) => ({ ...prev, pressed: true }));
49
- },
50
- onMouseUp: () => {
51
- if (disabled)
30
+ }
31
+ if ((onIn || onOut) && offOn.current === 'off') {
32
+ offOn.current = 'on';
33
+ onIn?.(e);
34
+ }
35
+ if ((onIn || onOut) && offOn.current === 'on') {
36
+ offOn.current = 'off';
37
+ onOut?.(e);
38
+ }
39
+ if (onPress) {
40
+ onPress?.(e);
52
41
  return;
53
- setState((prev) => ({ ...prev, pressed: false }));
42
+ }
43
+ onClick?.(e);
54
44
  },
55
- onFocus: () => {
56
- if (disabled)
45
+ onPressIn: (e) => {
46
+ if (disabled) {
57
47
  return;
58
- setState((prev) => ({ ...prev, focused: true }));
48
+ }
49
+ onIn?.(e);
50
+ setInteractiveState('pressed');
59
51
  },
60
- onBlur: () => {
61
- if (disabled)
52
+ onPressOut: (e) => {
53
+ if (disabled) {
62
54
  return;
63
- setState((prev) => ({ ...prev, focused: false, pressed: false }));
55
+ }
56
+ onOut?.(e);
57
+ setInteractiveState('idle');
64
58
  },
65
- }), [disabled]);
66
- const dataAttrs = toDataAttrs(state);
67
- return { state, dataAttrs, eventHandlers };
59
+ };
60
+ return {
61
+ dataAttrs,
62
+ disabled,
63
+ eventHandlers,
64
+ interactiveState,
65
+ };
68
66
  }
@@ -1,68 +1,71 @@
1
- import { useEffect, useMemo, useState } from 'react';
2
- function computeVisualState(state) {
3
- if (state.disabled)
4
- return 'disabled';
5
- if (state.pressed)
6
- return 'pressed';
7
- if (state.hovered)
8
- return 'hovered';
9
- if (state.focused)
10
- return 'focused';
11
- return 'default';
12
- }
13
- function toDataAttrs(state) {
14
- const visual = computeVisualState(state);
15
- return {
16
- 'data-state': visual,
17
- 'data-hovered': String(state.hovered),
18
- 'data-pressed': String(state.pressed),
19
- 'data-focused': String(state.focused),
20
- 'data-disabled': String(state.disabled),
1
+ import { useState } from 'react';
2
+ export function useInteractiveState({ disabled, onBlur, onClick, onFocus, onPress, onIn, onOut, } = {}) {
3
+ const [interactiveState, setInteractiveState] = useState('idle');
4
+ const dataAttrs = {
5
+ 'data-state': interactiveState,
6
+ 'data-disabled': disabled ? 'true' : 'false',
7
+ 'data-focused': interactiveState === 'focused' ? 'true' : 'false',
8
+ 'data-hovered': interactiveState === 'hovered' ? 'true' : 'false',
9
+ 'data-pressed': interactiveState === 'pressed' ? 'true' : 'false',
21
10
  };
22
- }
23
- export function useInteractiveState(options = {}) {
24
- const { disabled = false } = options;
25
- const [state, setState] = useState({
26
- hovered: false,
27
- pressed: false,
28
- focused: false,
29
- disabled,
30
- });
31
- useEffect(() => {
32
- setState((prev) => ({ ...prev, disabled }));
33
- }, [disabled]);
34
- const eventHandlers = useMemo(() => ({
35
- onMouseEnter: () => {
36
- if (disabled)
11
+ const eventHandlers = {
12
+ onBlur: (e) => {
13
+ if (disabled) {
37
14
  return;
38
- setState((prev) => ({ ...prev, hovered: true }));
15
+ }
16
+ onBlur?.(e);
17
+ setInteractiveState('idle');
39
18
  },
40
- onMouseLeave: () => {
41
- if (disabled)
19
+ onClick: (e) => {
20
+ if (disabled) {
21
+ return;
22
+ }
23
+ if (onClick) {
24
+ onClick?.(e);
42
25
  return;
43
- setState((prev) => ({ ...prev, hovered: false, pressed: false }));
26
+ }
27
+ onPress?.(e);
44
28
  },
45
- onMouseDown: () => {
46
- if (disabled)
29
+ onFocus: (e) => {
30
+ if (disabled) {
47
31
  return;
48
- setState((prev) => ({ ...prev, pressed: true }));
32
+ }
33
+ onFocus?.(e);
34
+ setInteractiveState('focused');
49
35
  },
50
- onMouseUp: () => {
51
- if (disabled)
36
+ onMouseDown: (e) => {
37
+ if (disabled) {
52
38
  return;
53
- setState((prev) => ({ ...prev, pressed: false }));
39
+ }
40
+ setInteractiveState('pressed');
54
41
  },
55
- onFocus: () => {
56
- if (disabled)
42
+ onMouseEnter: (e) => {
43
+ if (disabled) {
57
44
  return;
58
- setState((prev) => ({ ...prev, focused: true }));
45
+ }
46
+ onIn?.(e);
47
+ setInteractiveState('hovered');
59
48
  },
60
- onBlur: () => {
61
- if (disabled)
49
+ onMouseLeave: (e) => {
50
+ if (disabled) {
62
51
  return;
63
- setState((prev) => ({ ...prev, focused: false, pressed: false }));
52
+ }
53
+ console.log('[DEBUG] onMouseLeave', typeof onOut, e);
54
+ onOut?.(e);
55
+ setInteractiveState('idle');
64
56
  },
65
- }), [disabled]);
66
- const dataAttrs = toDataAttrs(state);
67
- return { state, dataAttrs, eventHandlers };
57
+ onMouseUp: (e) => {
58
+ if (disabled) {
59
+ return;
60
+ }
61
+ console.log('[DEBUG] onMouseUp', e);
62
+ setInteractiveState('idle');
63
+ },
64
+ };
65
+ return {
66
+ dataAttrs,
67
+ disabled,
68
+ eventHandlers,
69
+ interactiveState,
70
+ };
68
71
  }
@@ -1,5 +1,5 @@
1
1
  import { useMemo } from 'react';
2
- export const useOnChange = ({ onChange, onChangeValue }) => {
2
+ export const useOnChange = ({ onChange, onChangeValue, }) => {
3
3
  return useMemo(() => ({
4
4
  onChange: (event) => {
5
5
  if (onChange) {
@@ -0,0 +1,29 @@
1
+ export const extractStyles = (style) => {
2
+ const base = { ...style };
3
+ const disabled = style.$disabled || {};
4
+ const focused = style.$focused || {};
5
+ const hovered = style.$hovered || {};
6
+ const pressed = style.$pressed || {};
7
+ base.$disabled = undefined;
8
+ base.$focused = undefined;
9
+ base.$hovered = undefined;
10
+ base.$pressed = undefined;
11
+ return {
12
+ styleBase: base,
13
+ styleDisabled: disabled,
14
+ styleFocused: focused,
15
+ styleHovered: hovered,
16
+ stylePressed: pressed,
17
+ };
18
+ };
19
+ export const toKebab = (s) => s.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
20
+ export const toCssDecls = (style) => {
21
+ if (!style) {
22
+ return '';
23
+ }
24
+ // TODO: adiconar os px ou outra medida quando necessario e faça sentido
25
+ return Object.entries(style)
26
+ .filter(([, v]) => v !== undefined && v !== null)
27
+ .map(([k, v]) => `${toKebab(k)}:${typeof v === 'number' ? `${v}` : v};`)
28
+ .join('');
29
+ };
@@ -0,0 +1,38 @@
1
+ import { extractStyles } from './useStyles.helpers';
2
+ const getStyles = ({ disabled, style, }) => {
3
+ if (!style) {
4
+ return {};
5
+ }
6
+ const { styleBase, styleDisabled, styleFocused, styleHovered, stylePressed } = extractStyles(style);
7
+ const composedStyle = { ...styleBase };
8
+ if (disabled) {
9
+ Object.assign(composedStyle, styleDisabled || {});
10
+ }
11
+ return { style: composedStyle };
12
+ };
13
+ const getStylesWithInteraction = ({ disabled, style }) => (options) => {
14
+ if (!style) {
15
+ return {};
16
+ }
17
+ const { styleBase, styleDisabled, styleFocused, styleHovered, stylePressed, } = extractStyles(style);
18
+ const composedStyle = { ...styleBase };
19
+ if (disabled) {
20
+ Object.assign(composedStyle, styleDisabled || {});
21
+ }
22
+ if (options?.focused) {
23
+ Object.assign(composedStyle, styleFocused || {});
24
+ }
25
+ if (options?.hovered) {
26
+ Object.assign(composedStyle, styleHovered || {});
27
+ }
28
+ if (options?.pressed) {
29
+ Object.assign(composedStyle, stylePressed || {});
30
+ }
31
+ return { style: composedStyle };
32
+ };
33
+ export const useStyles = () => {
34
+ return {
35
+ getStyles,
36
+ getStylesWithInteraction,
37
+ };
38
+ };