@react-xp/aeiou 0.1.0-beta.12 → 0.1.0-beta.14

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 (196) hide show
  1. package/dist/cjs/components/a/a.native.js +7 -7
  2. package/dist/cjs/components/a/a.web.js +7 -7
  3. package/dist/cjs/components/d/d.native.js +7 -7
  4. package/dist/cjs/components/d/d.web.js +8 -8
  5. package/dist/cjs/components/e/e.native.js +7 -14
  6. package/dist/cjs/components/e/e.web.js +7 -9
  7. package/dist/cjs/components/i/i.native.js +9 -5
  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/hooks/index.js +0 -3
  18. package/dist/cjs/hooks/index.native.js +2 -2
  19. package/dist/cjs/hooks/index.web.js +2 -2
  20. package/dist/cjs/hooks/useInteractiveHandlers/useInteractiveHandlers.native.js +43 -0
  21. package/dist/cjs/hooks/useInteractiveHandlers/useInteractiveHandlers.web.js +45 -0
  22. package/dist/cjs/hooks/useInteractiveState/useInteractiveState.native.js +53 -15
  23. package/dist/cjs/hooks/useInteractiveState/useInteractiveState.web.js +51 -39
  24. package/dist/cjs/hooks/useStyles/useStyles.helpers.js +35 -0
  25. package/dist/cjs/hooks/useStyles/useStyles.native.js +42 -0
  26. package/dist/cjs/hooks/useStyles/useStyles.web.js +71 -0
  27. package/dist/esm/components/a/a.native.js +7 -7
  28. package/dist/esm/components/a/a.web.js +7 -7
  29. package/dist/esm/components/d/d.native.js +5 -5
  30. package/dist/esm/components/d/d.web.js +5 -5
  31. package/dist/esm/components/e/e.native.js +6 -13
  32. package/dist/esm/components/e/e.web.js +6 -8
  33. package/dist/esm/components/i/i.native.js +7 -3
  34. package/dist/esm/components/i/i.web.js +7 -3
  35. package/dist/esm/components/l/l.web.js +6 -8
  36. package/dist/esm/components/o/o.native.js +3 -3
  37. package/dist/esm/components/o/o.web.js +6 -3
  38. package/dist/esm/components/p/p.native.js +3 -3
  39. package/dist/esm/components/p/p.web.js +6 -3
  40. package/dist/esm/components/s/s.native.js +3 -3
  41. package/dist/esm/components/t/t.native.js +6 -7
  42. package/dist/esm/components/t/t.web.js +6 -7
  43. package/dist/esm/hooks/index.js +0 -3
  44. package/dist/esm/hooks/index.native.js +2 -2
  45. package/dist/esm/hooks/index.web.js +2 -2
  46. package/dist/esm/hooks/useInteractiveHandlers/useInteractiveHandlers.native.js +40 -0
  47. package/dist/esm/hooks/useInteractiveHandlers/useInteractiveHandlers.web.js +42 -0
  48. package/dist/esm/hooks/useInteractiveState/useInteractiveState.native.js +54 -16
  49. package/dist/esm/hooks/useInteractiveState/useInteractiveState.web.js +51 -39
  50. package/dist/esm/hooks/useStyles/useStyles.helpers.js +29 -0
  51. package/dist/esm/hooks/useStyles/useStyles.native.js +38 -0
  52. package/dist/esm/hooks/useStyles/useStyles.web.js +66 -0
  53. package/dist/native/cjs/components/a/a.native.js +7 -7
  54. package/dist/native/cjs/components/a/a.web.js +7 -7
  55. package/dist/native/cjs/components/d/d.native.js +7 -7
  56. package/dist/native/cjs/components/d/d.web.js +8 -8
  57. package/dist/native/cjs/components/e/e.native.js +7 -14
  58. package/dist/native/cjs/components/e/e.web.js +7 -9
  59. package/dist/native/cjs/components/i/i.native.js +9 -5
  60. package/dist/native/cjs/components/i/i.web.js +9 -5
  61. package/dist/native/cjs/components/l/l.web.js +7 -9
  62. package/dist/native/cjs/components/o/o.native.js +4 -4
  63. package/dist/native/cjs/components/o/o.web.js +7 -4
  64. package/dist/native/cjs/components/p/p.native.js +4 -4
  65. package/dist/native/cjs/components/p/p.web.js +7 -4
  66. package/dist/native/cjs/components/s/s.native.js +4 -4
  67. package/dist/native/cjs/components/t/t.native.js +7 -8
  68. package/dist/native/cjs/components/t/t.web.js +7 -8
  69. package/dist/native/cjs/hooks/index.js +0 -3
  70. package/dist/native/cjs/hooks/index.native.js +2 -2
  71. package/dist/native/cjs/hooks/index.web.js +2 -2
  72. package/dist/native/cjs/hooks/useInteractiveHandlers/useInteractiveHandlers.native.js +43 -0
  73. package/dist/native/cjs/hooks/useInteractiveHandlers/useInteractiveHandlers.web.js +45 -0
  74. package/dist/native/cjs/hooks/useInteractiveState/useInteractiveState.native.js +53 -15
  75. package/dist/native/cjs/hooks/useInteractiveState/useInteractiveState.web.js +51 -39
  76. package/dist/native/cjs/hooks/useStyles/useStyles.helpers.js +35 -0
  77. package/dist/native/cjs/hooks/useStyles/useStyles.native.js +42 -0
  78. package/dist/native/cjs/hooks/useStyles/useStyles.web.js +71 -0
  79. package/dist/native/esm/components/a/a.native.js +7 -7
  80. package/dist/native/esm/components/a/a.web.js +7 -7
  81. package/dist/native/esm/components/d/d.native.js +5 -5
  82. package/dist/native/esm/components/d/d.web.js +5 -5
  83. package/dist/native/esm/components/e/e.native.js +6 -13
  84. package/dist/native/esm/components/e/e.web.js +6 -8
  85. package/dist/native/esm/components/i/i.native.js +7 -3
  86. package/dist/native/esm/components/i/i.web.js +7 -3
  87. package/dist/native/esm/components/l/l.web.js +6 -8
  88. package/dist/native/esm/components/o/o.native.js +3 -3
  89. package/dist/native/esm/components/o/o.web.js +6 -3
  90. package/dist/native/esm/components/p/p.native.js +3 -3
  91. package/dist/native/esm/components/p/p.web.js +6 -3
  92. package/dist/native/esm/components/s/s.native.js +3 -3
  93. package/dist/native/esm/components/t/t.native.js +6 -7
  94. package/dist/native/esm/components/t/t.web.js +6 -7
  95. package/dist/native/esm/hooks/index.js +0 -3
  96. package/dist/native/esm/hooks/index.native.js +2 -2
  97. package/dist/native/esm/hooks/index.web.js +2 -2
  98. package/dist/native/esm/hooks/useInteractiveHandlers/useInteractiveHandlers.native.js +40 -0
  99. package/dist/native/esm/hooks/useInteractiveHandlers/useInteractiveHandlers.web.js +42 -0
  100. package/dist/native/esm/hooks/useInteractiveState/useInteractiveState.native.js +54 -16
  101. package/dist/native/esm/hooks/useInteractiveState/useInteractiveState.web.js +51 -39
  102. package/dist/native/esm/hooks/useStyles/useStyles.helpers.js +29 -0
  103. package/dist/native/esm/hooks/useStyles/useStyles.native.js +38 -0
  104. package/dist/native/esm/hooks/useStyles/useStyles.web.js +66 -0
  105. package/dist/native/tsconfig.native.cjs.tsbuildinfo +1 -1
  106. package/dist/native/tsconfig.native.esm.tsbuildinfo +1 -1
  107. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  108. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  109. package/dist/types/components/a/a.native.d.ts +1 -1
  110. package/dist/types/components/a/a.native.d.ts.map +1 -1
  111. package/dist/types/components/a/a.web.d.ts +1 -1
  112. package/dist/types/components/a/a.web.d.ts.map +1 -1
  113. package/dist/types/components/d/d.native.d.ts +1 -1
  114. package/dist/types/components/d/d.native.d.ts.map +1 -1
  115. package/dist/types/components/d/d.web.d.ts +1 -1
  116. package/dist/types/components/d/d.web.d.ts.map +1 -1
  117. package/dist/types/components/e/e.native.d.ts +1 -1
  118. package/dist/types/components/e/e.native.d.ts.map +1 -1
  119. package/dist/types/components/e/e.web.d.ts +1 -1
  120. package/dist/types/components/e/e.web.d.ts.map +1 -1
  121. package/dist/types/components/i/i.native.d.ts +1 -1
  122. package/dist/types/components/i/i.native.d.ts.map +1 -1
  123. package/dist/types/components/i/i.web.d.ts +1 -1
  124. package/dist/types/components/i/i.web.d.ts.map +1 -1
  125. package/dist/types/components/i/useIUtils.d.ts +2 -2
  126. package/dist/types/components/l/l.web.d.ts +1 -1
  127. package/dist/types/components/l/l.web.d.ts.map +1 -1
  128. package/dist/types/components/o/o.native.d.ts +1 -1
  129. package/dist/types/components/o/o.native.d.ts.map +1 -1
  130. package/dist/types/components/o/o.web.d.ts +1 -1
  131. package/dist/types/components/o/o.web.d.ts.map +1 -1
  132. package/dist/types/components/p/p.native.d.ts +1 -1
  133. package/dist/types/components/p/p.native.d.ts.map +1 -1
  134. package/dist/types/components/p/p.web.d.ts +1 -1
  135. package/dist/types/components/p/p.web.d.ts.map +1 -1
  136. package/dist/types/components/s/s.native.d.ts +1 -1
  137. package/dist/types/components/s/s.native.d.ts.map +1 -1
  138. package/dist/types/components/t/t.native.d.ts +1 -1
  139. package/dist/types/components/t/t.native.d.ts.map +1 -1
  140. package/dist/types/components/t/t.web.d.ts +1 -1
  141. package/dist/types/components/t/t.web.d.ts.map +1 -1
  142. package/dist/types/hooks/index.d.ts +0 -3
  143. package/dist/types/hooks/index.d.ts.map +1 -1
  144. package/dist/types/hooks/index.native.d.ts +2 -2
  145. package/dist/types/hooks/index.native.d.ts.map +1 -1
  146. package/dist/types/hooks/index.web.d.ts +2 -2
  147. package/dist/types/hooks/index.web.d.ts.map +1 -1
  148. package/dist/types/hooks/useInteractiveHandlers/useInteractiveHandlers.native.d.ts +11 -0
  149. package/dist/types/hooks/useInteractiveHandlers/useInteractiveHandlers.native.d.ts.map +1 -0
  150. package/dist/types/hooks/useInteractiveHandlers/useInteractiveHandlers.web.d.ts +12 -0
  151. package/dist/types/hooks/useInteractiveHandlers/useInteractiveHandlers.web.d.ts.map +1 -0
  152. package/dist/types/hooks/useInteractiveState/useInteractiveState.native.d.ts +12 -6
  153. package/dist/types/hooks/useInteractiveState/useInteractiveState.native.d.ts.map +1 -1
  154. package/dist/types/hooks/useInteractiveState/useInteractiveState.web.d.ts +13 -12
  155. package/dist/types/hooks/useInteractiveState/useInteractiveState.web.d.ts.map +1 -1
  156. package/dist/types/hooks/useStyles/useStyles.helpers.d.ts +171 -0
  157. package/dist/types/hooks/useStyles/useStyles.helpers.d.ts.map +1 -0
  158. package/dist/types/hooks/useStyles/useStyles.native.d.ts +15 -0
  159. package/dist/types/hooks/useStyles/useStyles.native.d.ts.map +1 -0
  160. package/dist/types/hooks/useStyles/useStyles.types.d.ts +6 -0
  161. package/dist/types/hooks/useStyles/useStyles.types.d.ts.map +1 -0
  162. package/dist/types/hooks/useStyles/useStyles.web.d.ts +11 -0
  163. package/dist/types/hooks/useStyles/useStyles.web.d.ts.map +1 -0
  164. package/dist/types/types/base.d.ts +38 -6
  165. package/dist/types/types/base.d.ts.map +1 -1
  166. package/package.json +1 -1
  167. package/dist/cjs/hooks/useAction/useAction.native.js +0 -18
  168. package/dist/cjs/hooks/useAction/useAction.web.js +0 -21
  169. package/dist/cjs/hooks/useOnHoverOrPress.js +0 -21
  170. package/dist/esm/hooks/useAction/useAction.native.js +0 -14
  171. package/dist/esm/hooks/useAction/useAction.web.js +0 -17
  172. package/dist/esm/hooks/useOnHoverOrPress.js +0 -17
  173. package/dist/native/cjs/hooks/useAction/types.js +0 -2
  174. package/dist/native/cjs/hooks/useAction/useAction.native.js +0 -18
  175. package/dist/native/cjs/hooks/useAction/useAction.web.js +0 -21
  176. package/dist/native/cjs/hooks/useInteractiveState/useInteractiveState.types.js +0 -2
  177. package/dist/native/cjs/hooks/useOnHoverOrPress.js +0 -21
  178. package/dist/native/esm/hooks/useAction/types.js +0 -1
  179. package/dist/native/esm/hooks/useAction/useAction.native.js +0 -14
  180. package/dist/native/esm/hooks/useAction/useAction.web.js +0 -17
  181. package/dist/native/esm/hooks/useInteractiveState/useInteractiveState.types.js +0 -1
  182. package/dist/native/esm/hooks/useOnHoverOrPress.js +0 -17
  183. package/dist/types/hooks/useAction/types.d.ts +0 -7
  184. package/dist/types/hooks/useAction/types.d.ts.map +0 -1
  185. package/dist/types/hooks/useAction/useAction.native.d.ts +0 -5
  186. package/dist/types/hooks/useAction/useAction.native.d.ts.map +0 -1
  187. package/dist/types/hooks/useAction/useAction.web.d.ts +0 -5
  188. package/dist/types/hooks/useAction/useAction.web.d.ts.map +0 -1
  189. package/dist/types/hooks/useInteractiveState/useInteractiveState.types.d.ts +0 -18
  190. package/dist/types/hooks/useInteractiveState/useInteractiveState.types.d.ts.map +0 -1
  191. package/dist/types/hooks/useOnHoverOrPress.d.ts +0 -12
  192. package/dist/types/hooks/useOnHoverOrPress.d.ts.map +0 -1
  193. /package/dist/cjs/hooks/{useAction/types.js → useStyles/useStyles.types.js} +0 -0
  194. /package/dist/esm/hooks/{useAction/types.js → useStyles/useStyles.types.js} +0 -0
  195. /package/dist/{cjs/hooks/useInteractiveState/useInteractiveState.types.js → native/cjs/hooks/useStyles/useStyles.types.js} +0 -0
  196. /package/dist/{esm/hooks/useInteractiveState/useInteractiveState.types.js → native/esm/hooks/useStyles/useStyles.types.js} +0 -0
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx } from "nativewind/jsx-runtime";
2
- import { useAction, useCn } from '../../hooks/index.web';
3
- export function A({ className, children, onPress, onClick, disabled, ref, style, ...rest }) {
2
+ import { useInteractiveHandlers, useStyles } from '../../hooks/index.web';
3
+ import { useCn } from '../../hooks/useCn';
4
+ export function A({ className, children, loading, ref, testId, accessibilityLabel, accessibilityRole, accessibilityState, style, ...restProps }) {
4
5
  const cn = useCn();
5
- const { onAction } = useAction({
6
- onClick,
7
- onPress,
8
- });
9
- return (_jsx("button", { ref: ref, type: "button", disabled: disabled, className: cn('cursor-pointer', disabled && 'opacity-60', className), onClick: onAction, style: style, ...rest, children: children }));
6
+ const { getStyles } = useStyles();
7
+ const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
8
+ const isDisabled = Boolean(disabled || loading);
9
+ return (_jsx("button", { ref: ref, type: "button", className: cn('cursor-pointer', disabled && 'opacity-60', className), "aria-disabled": isDisabled || undefined, "aria-busy": loading || undefined, "aria-label": accessibilityLabel, "data-testid": testId, ...restProps, ...eventHandlers, ...getStyles({ disabled, style }), children: children }));
10
10
  }
11
11
  export const Action = A;
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "nativewind/jsx-runtime";
2
2
  import { Modal } from 'react-native';
3
- import { useCn } from '../../hooks/index.native';
3
+ import { useCn } from '../../hooks/useCn';
4
4
  import { E } from '../e/index.native';
5
- export function D({ open, onOpenChange, placement = 'center', backdropClassName, backdropStyle, containerClassName, containerStyle, contentClassName, contentStyle, children, ref, ...rest }) {
5
+ export function D({ open, onOpenChange, placement = 'center', backdropClassName, backdropStyle, containerClassName, containerStyle, contentClassName, contentStyle, children, ref, ...restProps }) {
6
6
  const cn = useCn();
7
7
  const placementClasses = {
8
8
  center: 'items-center justify-center',
@@ -15,10 +15,10 @@ export function D({ open, onOpenChange, placement = 'center', backdropClassName,
15
15
  const contentClasses = cn('bg-background p-4 rounded-lg shadow-lg max-h-[90vh] w-full max-w-lg', placement === 'left' || placement === 'right' ? 'h-full max-h-none' : '', placement === 'bottom' || placement === 'top' ? 'max-w-none' : '', contentClassName);
16
16
  const handleRequestClose = (e) => {
17
17
  onOpenChange?.(false);
18
- if (typeof rest.onRequestClose === 'function') {
19
- rest.onRequestClose?.(e);
18
+ if (typeof restProps.onRequestClose === 'function') {
19
+ restProps.onRequestClose?.(e);
20
20
  }
21
21
  };
22
- return (_jsx(Modal, { visible: open, animationType: "slide", transparent: true, onRequestClose: handleRequestClose, ...rest, children: _jsx(E, { className: containerClasses, style: { ...containerStyle, ...backdropStyle }, children: _jsx(E, { ref: ref, className: contentClasses, style: contentStyle, children: children }) }) }));
22
+ return (_jsx(Modal, { visible: open, animationType: "slide", transparent: true, onRequestClose: handleRequestClose, ...restProps, children: _jsx(E, { className: containerClasses, style: { ...containerStyle, ...backdropStyle }, children: _jsx(E, { ref: ref, className: contentClasses, style: contentStyle, children: children }) }) }));
23
23
  }
24
24
  export const Dialog = D;
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "nativewind/jsx-runtime";
2
2
  import { createPortal } from 'react-dom';
3
- import { useCn } from '../../hooks/index.web';
3
+ import { useCn } from '../../hooks/useCn';
4
4
  import { E } from '../e/index.web';
5
- export function D({ open, onOpenChange, placement = 'center', backdropClassName, backdropStyle, containerClassName, containerStyle, contentClassName, contentStyle, closeOnBackdropClick = true, children, ref, ...rest }) {
5
+ export function D({ open, onOpenChange, placement = 'center', backdropClassName, backdropStyle, containerClassName, containerStyle, contentClassName, contentStyle, closeOnBackdropClick = true, children, ref, ...restProps }) {
6
6
  const cn = useCn();
7
7
  if (typeof document === 'undefined')
8
8
  return null;
@@ -25,10 +25,10 @@ export function D({ open, onOpenChange, placement = 'center', backdropClassName,
25
25
  const backdropClasses = cn('fixed inset-0 z-50 flex bg-black/40', placementClasses[placement], containerClassName, backdropClassName);
26
26
  const contentClasses = cn('relative max-h-[90vh] w-full max-w-lg overflow-auto rounded-lg bg-background p-4 shadow-lg', placement === 'left' || placement === 'right' ? 'h-full max-h-none' : '', placement === 'bottom' || placement === 'top' ? 'max-w-none' : '', contentClassName);
27
27
  return createPortal(_jsx(E, { className: backdropClasses, role: "presentation", onClick: handleBackdropClick, style: {
28
- ...containerStyle,
29
- ...backdropStyle,
28
+ ...(containerStyle || {}),
29
+ ...(backdropStyle || {}),
30
30
  }, children: _jsx("div", { ref: ref,
31
31
  // biome-ignore lint/a11y/useSemanticElements: <explanation>
32
- role: "dialog", "aria-modal": "true", className: contentClasses, style: contentStyle, ...rest, children: children }) }), document.body);
32
+ role: "dialog", "aria-modal": "true", className: contentClasses, style: contentStyle, ...restProps, children: children }) }), document.body);
33
33
  }
34
34
  export const Dialog = D;
@@ -1,19 +1,12 @@
1
1
  import { jsx as _jsx } from "nativewind/jsx-runtime";
2
2
  import { View } from 'react-native';
3
- import { useAction, useCn, useOnHoverOrPress } from '../../hooks/index.native';
3
+ import { useCn } from '../../hooks/useCn';
4
+ import { useInteractiveHandlers, useStyles } from '../../index.native';
4
5
  import { T } from '../t/index.native';
5
- export function E({ className, children, onIn, onOut, onClick, onPress, ref, style, ...rest }) {
6
+ export function E({ className, children, ref, style, ...restProps }) {
6
7
  const cn = useCn();
7
- const { onAction } = useAction({
8
- onClick,
9
- onPress,
10
- });
11
- const { onPress: onHoverOrPress } = useOnHoverOrPress({ onIn, onOut });
12
- const handleOnPress = () => {
13
- onAction();
14
- onHoverOrPress();
15
- return false;
16
- };
17
- return (_jsx(View, { ref: ref, className: cn(className), onStartShouldSetResponder: handleOnPress, style: style, ...rest, children: typeof children === 'string' ? _jsx(T, { children: children }) : children }));
8
+ const { getStyles } = useStyles();
9
+ const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
10
+ return (_jsx(View, { ref: ref, className: cn(className), ...eventHandlers, ...getStyles({ disabled, style }), children: typeof children === 'string' ? _jsx(T, { children: children }) : children }));
18
11
  }
19
12
  export const Element = E;
@@ -1,12 +1,10 @@
1
1
  import { jsx as _jsx } from "nativewind/jsx-runtime";
2
- import { useAction, useCn, useOnHoverOrPress } from '../../hooks/index.web';
3
- export function E({ className, children, onIn, onOut, onPress, onClick, ref, style, ...rest }) {
2
+ import { useCn } from '../../hooks/useCn';
3
+ import { useInteractiveHandlers, useStyles } from '../../index.web';
4
+ export function E({ className, children, ref, role, style, ...restProps }) {
4
5
  const cn = useCn();
5
- const { onAction } = useAction({
6
- onClick,
7
- onPress,
8
- });
9
- const { onMouseEnter, onMouseLeave } = useOnHoverOrPress({ onIn, onOut });
10
- return (_jsx("div", { ref: ref, className: cn(className), onClick: onAction, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, style: style, ...rest, children: children }));
6
+ const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
7
+ const { getStyles } = useStyles();
8
+ return (_jsx("div", { ref: ref, className: cn(className), role: role, ...restProps, ...eventHandlers, ...getStyles({ disabled, style }), children: children }));
11
9
  }
12
10
  export const Element = E;
@@ -1,20 +1,24 @@
1
1
  import { jsx as _jsx } from "nativewind/jsx-runtime";
2
2
  import { TextInput } from 'react-native';
3
- import { useCn, useOnChange } from '../../hooks/index.native';
3
+ import { useCn } from '../../hooks/useCn';
4
+ import { useOnChange } from '../../hooks/useOnChange';
5
+ import { useInteractiveHandlers, useStyles } from '../../index.native';
4
6
  import { useIUtils } from './useIUtils';
5
- export function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, editable, disabled, ref, style, ...rest }) {
7
+ export function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, editable, ref, name, style, ...restProps }) {
6
8
  const { treatTypeModeAndKeyboardType } = useIUtils();
7
9
  const cn = useCn();
8
10
  const { onChange: handleOnChange } = useOnChange({
9
11
  onChange,
10
12
  onChangeValue,
11
13
  });
14
+ const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
15
+ const { getStyles } = useStyles();
12
16
  const effectiveEditable = editable ?? !disabled;
13
17
  const { masterInputType, masterInputKeyboardType } = treatTypeModeAndKeyboardType({
14
18
  inputMode,
15
19
  keyboardType,
16
20
  type,
17
21
  });
18
- return (_jsx(TextInput, { ref: ref, className: cn(!effectiveEditable && 'opacity-60', className), value: value?.toString(), defaultValue: defaultValue?.toString(), placeholder: placeholder, onChange: handleOnChange, secureTextEntry: masterInputType === 'password', keyboardType: masterInputKeyboardType, editable: effectiveEditable, style: style, ...rest }));
22
+ return (_jsx(TextInput, { ref: ref, className: cn(!effectiveEditable && 'opacity-60', className), value: value?.toString(), defaultValue: defaultValue?.toString(), placeholder: placeholder, onChange: handleOnChange, secureTextEntry: masterInputType === 'password', keyboardType: masterInputKeyboardType, editable: effectiveEditable, ...restProps, ...eventHandlers, ...getStyles({ disabled, style }) }));
19
23
  }
20
24
  export const Input = I;
@@ -1,19 +1,23 @@
1
1
  import { jsx as _jsx } from "nativewind/jsx-runtime";
2
- import { useCn, useOnChange } from '../../hooks/index.web';
2
+ import { useCn } from '../../hooks/useCn';
3
+ import { useOnChange } from '../../hooks/useOnChange';
4
+ import { useInteractiveHandlers, useStyles } from '../../index.web';
3
5
  import { useIUtils } from './useIUtils';
4
- export function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, disabled, editable, ref, style, ...rest }) {
6
+ export function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, editable, ref, style, ...restProps }) {
5
7
  const { treatTypeModeAndKeyboardType } = useIUtils();
6
8
  const cn = useCn();
7
9
  const { onChange: handleOnChange } = useOnChange({
8
10
  onChange,
9
11
  onChangeValue,
10
12
  });
13
+ const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
14
+ const { getStyles } = useStyles();
11
15
  const effectiveDisabled = disabled || editable === false;
12
16
  const { masterInputType, masterInputMode } = treatTypeModeAndKeyboardType({
13
17
  inputMode,
14
18
  keyboardType,
15
19
  type,
16
20
  });
17
- return (_jsx("input", { ref: ref, type: masterInputType, inputMode: masterInputMode, className: cn('outline-none', effectiveDisabled && 'opacity-60 cursor-not-allowed', className), value: value?.toString(), defaultValue: defaultValue?.toString(), placeholder: placeholder, onChange: handleOnChange, disabled: effectiveDisabled, style: style, ...rest }));
21
+ return (_jsx("input", { ref: ref, type: masterInputType, inputMode: masterInputMode, className: cn('outline-none', effectiveDisabled && 'opacity-60 cursor-not-allowed', className), value: value?.toString(), defaultValue: defaultValue?.toString(), placeholder: placeholder, onChange: handleOnChange, disabled: effectiveDisabled, ...restProps, ...eventHandlers, ...getStyles({ disabled, style }) }));
18
22
  }
19
23
  export const Input = I;
@@ -1,13 +1,11 @@
1
1
  import { jsx as _jsx } from "nativewind/jsx-runtime";
2
- import { useAction } from '../../hooks/index.native';
3
- import { useCn } from '../../hooks/index.web';
4
- export function L({ className, children, to, href, onClick, onPress, preventDefault, ref, style, ...rest }) {
2
+ import { useCn } from '../../hooks/useCn';
3
+ import { useInteractiveHandlers, useStyles } from '../../index.web';
4
+ export function L({ className, children, to, href, preventDefault, ref, style, ...restProps }) {
5
5
  const cn = useCn();
6
- const { onAction } = useAction({
7
- onClick,
8
- onPress,
9
- });
6
+ const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
7
+ const { getStyles } = useStyles();
10
8
  const resolvedHref = href ?? to ?? '#';
11
- return (_jsx("a", { ref: ref, href: resolvedHref, className: cn('cursor-pointer', className), onClick: onAction, style: style, ...rest, children: children }));
9
+ return (_jsx("a", { ref: ref, href: resolvedHref, className: cn('cursor-pointer', className), ...restProps, ...eventHandlers, ...getStyles({ disabled, style }), children: children }));
12
10
  }
13
11
  export const Link = L;
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "nativewind/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 "nativewind/jsx-runtime";
2
- import { useCn } from '../../hooks/index.web';
3
- export function O({ className, children, horizontal, ref, style, ...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), style: style, ...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 "nativewind/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 "nativewind/jsx-runtime";
2
- import { useCn } from '../../hooks/index.web';
3
- export function P({ alt, className, ref, style, ...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), style: style, ...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 "nativewind/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 "nativewind/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 "nativewind/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({ className, children, as = 'span', 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;
@@ -1,6 +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
- export * from './useOnHoverOrPress';
6
3
  export * from './useProps';
@@ -1,6 +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
- export * from './useOnHoverOrPress';
6
5
  export * from './useProps';
6
+ export * from './useStyles/useStyles.native';
@@ -1,6 +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
- export * from './useOnHoverOrPress';
6
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,28 +1,66 @@
1
- import { useState } from 'react';
2
- export function useInteractiveState(options = {}) {
3
- const { disabled } = options;
4
- const [pressed, setPressed] = useState(false);
5
- const state = disabled
6
- ? 'disabled'
7
- : pressed
8
- ? 'pressed'
9
- : 'idle';
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');
10
5
  const dataAttrs = {
11
- 'data-state': state,
12
- 'data-pressed': pressed ? 'true' : 'false',
6
+ 'data-state': interactiveState,
13
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',
14
11
  };
15
12
  const eventHandlers = {
13
+ onBlur: (e) => {
14
+ if (disabled) {
15
+ return;
16
+ }
17
+ onBlur?.(e);
18
+ setInteractiveState('idle');
19
+ },
20
+ onFocus: (e) => {
21
+ if (disabled) {
22
+ return;
23
+ }
24
+ onFocus?.(e);
25
+ setInteractiveState('focused');
26
+ },
27
+ onPress: (e) => {
28
+ if (disabled) {
29
+ return;
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);
41
+ return;
42
+ }
43
+ onClick?.(e);
44
+ },
16
45
  onPressIn: (e) => {
17
- if (disabled)
46
+ if (disabled) {
18
47
  return;
19
- setPressed(true);
48
+ }
49
+ onIn?.(e);
50
+ setInteractiveState('pressed');
20
51
  },
21
52
  onPressOut: (e) => {
22
- if (disabled)
53
+ if (disabled) {
23
54
  return;
24
- setPressed(false);
55
+ }
56
+ onOut?.(e);
57
+ setInteractiveState('idle');
25
58
  },
26
59
  };
27
- return { state, dataAttrs, eventHandlers };
60
+ return {
61
+ dataAttrs,
62
+ disabled,
63
+ eventHandlers,
64
+ interactiveState,
65
+ };
28
66
  }
@@ -1,59 +1,71 @@
1
1
  import { useState } from 'react';
2
- export function useInteractiveState(options = {}) {
3
- const { disabled } = options;
4
- const [hovered, setHovered] = useState(false);
5
- const [pressed, setPressed] = useState(false);
6
- const [focused, setFocused] = useState(false);
7
- const state = disabled
8
- ? 'disabled'
9
- : pressed
10
- ? 'pressed'
11
- : hovered
12
- ? 'hovered'
13
- : focused
14
- ? 'focused'
15
- : 'idle';
2
+ export function useInteractiveState({ disabled, onBlur, onClick, onFocus, onPress, onIn, onOut, } = {}) {
3
+ const [interactiveState, setInteractiveState] = useState('idle');
16
4
  const dataAttrs = {
17
- 'data-state': state,
18
- 'data-hovered': hovered ? 'true' : 'false',
19
- 'data-pressed': pressed ? 'true' : 'false',
20
- 'data-focused': focused ? 'true' : 'false',
5
+ 'data-state': interactiveState,
21
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',
22
10
  };
23
11
  const eventHandlers = {
24
- onMouseEnter: () => {
25
- if (disabled)
12
+ onBlur: (e) => {
13
+ if (disabled) {
26
14
  return;
27
- setHovered(true);
15
+ }
16
+ onBlur?.(e);
17
+ setInteractiveState('idle');
28
18
  },
29
- onMouseLeave: () => {
30
- if (disabled)
19
+ onClick: (e) => {
20
+ if (disabled) {
31
21
  return;
32
- setHovered(false);
33
- setPressed(false);
22
+ }
23
+ if (onClick) {
24
+ onClick?.(e);
25
+ return;
26
+ }
27
+ onPress?.(e);
28
+ },
29
+ onFocus: (e) => {
30
+ if (disabled) {
31
+ return;
32
+ }
33
+ onFocus?.(e);
34
+ setInteractiveState('focused');
34
35
  },
35
36
  onMouseDown: (e) => {
36
- if (disabled || e.button !== 0)
37
+ if (disabled) {
37
38
  return;
38
- setPressed(true);
39
+ }
40
+ setInteractiveState('pressed');
39
41
  },
40
- onMouseUp: () => {
41
- if (disabled)
42
+ onMouseEnter: (e) => {
43
+ if (disabled) {
42
44
  return;
43
- setPressed(false);
45
+ }
46
+ onIn?.(e);
47
+ setInteractiveState('hovered');
44
48
  },
45
- onFocus: () => {
46
- if (disabled)
49
+ onMouseLeave: (e) => {
50
+ if (disabled) {
47
51
  return;
48
- setFocused(true);
52
+ }
53
+ console.log('[DEBUG] onMouseLeave', typeof onOut, e);
54
+ onOut?.(e);
55
+ setInteractiveState('idle');
49
56
  },
50
- onBlur: () => {
51
- if (disabled)
57
+ onMouseUp: (e) => {
58
+ if (disabled) {
52
59
  return;
53
- setFocused(false);
54
- setPressed(false);
55
- setHovered(false);
60
+ }
61
+ console.log('[DEBUG] onMouseUp', e);
62
+ setInteractiveState('idle');
56
63
  },
57
64
  };
58
- return { state, dataAttrs, eventHandlers };
65
+ return {
66
+ dataAttrs,
67
+ disabled,
68
+ eventHandlers,
69
+ interactiveState,
70
+ };
59
71
  }