@react-xp/aeiou 0.1.0-beta.1 → 0.1.0-beta.11

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 (212) hide show
  1. package/dist/cjs/components/a/a.native.js +3 -2
  2. package/dist/cjs/components/a/a.web.js +2 -2
  3. package/dist/cjs/components/d/d.native.js +3 -3
  4. package/dist/cjs/components/d/d.web.js +8 -3
  5. package/dist/cjs/components/e/e.native.js +5 -2
  6. package/dist/cjs/components/e/e.web.js +3 -2
  7. package/dist/cjs/components/i/i.native.js +2 -8
  8. package/dist/cjs/components/i/i.web.js +2 -2
  9. package/dist/cjs/components/l/l.web.js +2 -2
  10. package/dist/cjs/components/o/o.web.js +2 -2
  11. package/dist/cjs/components/p/p.web.js +2 -2
  12. package/dist/cjs/hooks/index.js +1 -0
  13. package/dist/cjs/hooks/index.native.js +1 -0
  14. package/dist/cjs/hooks/index.web.js +1 -0
  15. package/dist/cjs/hooks/useInteractiveState/useInteractiveState.native.js +18 -58
  16. package/dist/cjs/hooks/useInteractiveState/useInteractiveState.web.js +33 -42
  17. package/dist/cjs/hooks/useOnChange.js +1 -1
  18. package/dist/cjs/hooks/useOnHoverOrPress.js +21 -0
  19. package/dist/esm/components/a/a.native.js +4 -3
  20. package/dist/esm/components/a/a.web.js +2 -2
  21. package/dist/esm/components/d/d.native.js +3 -3
  22. package/dist/esm/components/d/d.web.js +8 -3
  23. package/dist/esm/components/e/e.native.js +6 -3
  24. package/dist/esm/components/e/e.web.js +4 -3
  25. package/dist/esm/components/i/i.native.js +2 -8
  26. package/dist/esm/components/i/i.web.js +2 -2
  27. package/dist/esm/components/l/l.web.js +2 -2
  28. package/dist/esm/components/o/o.web.js +2 -2
  29. package/dist/esm/components/p/p.web.js +2 -2
  30. package/dist/esm/hooks/index.js +1 -0
  31. package/dist/esm/hooks/index.native.js +1 -0
  32. package/dist/esm/hooks/index.web.js +1 -0
  33. package/dist/esm/hooks/useInteractiveState/useInteractiveState.native.js +19 -59
  34. package/dist/esm/hooks/useInteractiveState/useInteractiveState.web.js +34 -43
  35. package/dist/esm/hooks/useOnChange.js +1 -1
  36. package/dist/esm/hooks/useOnHoverOrPress.js +17 -0
  37. package/dist/native/cjs/components/a/a.native.js +17 -0
  38. package/dist/native/cjs/components/a/a.web.js +15 -0
  39. package/dist/native/cjs/components/a/index.native.js +17 -0
  40. package/dist/native/cjs/components/a/index.web.js +17 -0
  41. package/dist/native/cjs/components/d/d.native.js +28 -0
  42. package/dist/native/cjs/components/d/d.web.js +38 -0
  43. package/dist/native/cjs/components/d/index.native.js +17 -0
  44. package/dist/native/cjs/components/d/index.web.js +17 -0
  45. package/dist/native/cjs/components/e/e.native.js +23 -0
  46. package/dist/native/cjs/components/e/e.web.js +16 -0
  47. package/dist/native/cjs/components/e/index.native.js +17 -0
  48. package/dist/native/cjs/components/e/index.web.js +17 -0
  49. package/dist/native/cjs/components/i/i.native.js +24 -0
  50. package/dist/native/cjs/components/i/i.web.js +23 -0
  51. package/dist/native/cjs/components/i/index.native.js +17 -0
  52. package/dist/native/cjs/components/i/index.web.js +17 -0
  53. package/dist/native/cjs/components/i/useIUtils.js +71 -0
  54. package/dist/native/cjs/components/index.js +26 -0
  55. package/dist/native/cjs/components/index.native.js +26 -0
  56. package/dist/native/cjs/components/index.web.js +26 -0
  57. package/dist/native/cjs/components/l/index.native.js +17 -0
  58. package/dist/native/cjs/components/l/index.web.js +17 -0
  59. package/dist/native/cjs/components/l/l.native.js +10 -0
  60. package/dist/native/cjs/components/l/l.web.js +17 -0
  61. package/dist/native/cjs/components/o/index.native.js +17 -0
  62. package/dist/native/cjs/components/o/index.web.js +17 -0
  63. package/dist/native/cjs/components/o/o.native.js +12 -0
  64. package/dist/native/cjs/components/o/o.web.js +12 -0
  65. package/dist/native/cjs/components/p/index.native.js +17 -0
  66. package/dist/native/cjs/components/p/index.web.js +17 -0
  67. package/dist/native/cjs/components/p/p.native.js +13 -0
  68. package/dist/native/cjs/components/p/p.web.js +13 -0
  69. package/dist/native/cjs/components/s/index.native.js +17 -0
  70. package/dist/native/cjs/components/s/index.web.js +17 -0
  71. package/dist/native/cjs/components/s/s.native.js +10 -0
  72. package/dist/native/cjs/components/s/s.web.js +10 -0
  73. package/dist/native/cjs/components/t/index.native.js +17 -0
  74. package/dist/native/cjs/components/t/index.web.js +17 -0
  75. package/dist/native/cjs/components/t/t.native.js +16 -0
  76. package/dist/native/cjs/components/t/t.web.js +16 -0
  77. package/dist/native/cjs/components/u/context.js +14 -0
  78. package/dist/native/cjs/components/u/index.native.js +19 -0
  79. package/dist/native/cjs/components/u/index.web.js +19 -0
  80. package/dist/native/cjs/components/u/provider.native.js +23 -0
  81. package/dist/native/cjs/components/u/provider.web.js +20 -0
  82. package/dist/native/cjs/components/u/types.js +2 -0
  83. package/dist/native/cjs/components/u/useUniverse.js +8 -0
  84. package/dist/native/cjs/hooks/index.js +22 -0
  85. package/dist/native/cjs/hooks/index.native.js +22 -0
  86. package/dist/native/cjs/hooks/index.web.js +22 -0
  87. package/dist/native/cjs/hooks/useAction/types.js +2 -0
  88. package/dist/native/cjs/hooks/useAction/useAction.native.js +18 -0
  89. package/dist/native/cjs/hooks/useAction/useAction.web.js +21 -0
  90. package/dist/native/cjs/hooks/useCn.js +15 -0
  91. package/dist/native/cjs/hooks/useInteractiveState/useInteractiveState.native.js +31 -0
  92. package/dist/native/cjs/hooks/useInteractiveState/useInteractiveState.types.js +2 -0
  93. package/dist/native/cjs/hooks/useInteractiveState/useInteractiveState.web.js +62 -0
  94. package/dist/native/cjs/hooks/useOnChange.js +18 -0
  95. package/dist/native/cjs/hooks/useOnHoverOrPress.js +21 -0
  96. package/dist/native/cjs/hooks/useProps.js +66 -0
  97. package/dist/native/cjs/index.js +19 -0
  98. package/dist/native/cjs/index.native.js +19 -0
  99. package/dist/native/cjs/index.web.js +19 -0
  100. package/dist/native/cjs/types/base.js +2 -0
  101. package/dist/native/cjs/types/index.js +17 -0
  102. package/dist/native/esm/components/a/a.native.js +13 -0
  103. package/dist/native/esm/components/a/a.web.js +11 -0
  104. package/dist/native/esm/components/a/index.native.js +1 -0
  105. package/dist/native/esm/components/a/index.web.js +1 -0
  106. package/dist/native/esm/components/d/d.native.js +24 -0
  107. package/dist/native/esm/components/d/d.web.js +34 -0
  108. package/dist/native/esm/components/d/index.native.js +1 -0
  109. package/dist/native/esm/components/d/index.web.js +1 -0
  110. package/dist/native/esm/components/e/e.native.js +19 -0
  111. package/dist/native/esm/components/e/e.web.js +12 -0
  112. package/dist/native/esm/components/e/index.native.js +1 -0
  113. package/dist/native/esm/components/e/index.web.js +1 -0
  114. package/dist/native/esm/components/i/i.native.js +20 -0
  115. package/dist/native/esm/components/i/i.web.js +19 -0
  116. package/dist/native/esm/components/i/index.native.js +1 -0
  117. package/dist/native/esm/components/i/index.web.js +1 -0
  118. package/dist/native/esm/components/i/useIUtils.js +67 -0
  119. package/dist/native/esm/components/index.js +10 -0
  120. package/dist/native/esm/components/index.native.js +10 -0
  121. package/dist/native/esm/components/index.web.js +10 -0
  122. package/dist/native/esm/components/l/index.native.js +1 -0
  123. package/dist/native/esm/components/l/index.web.js +1 -0
  124. package/dist/native/esm/components/l/l.native.js +6 -0
  125. package/dist/native/esm/components/l/l.web.js +13 -0
  126. package/dist/native/esm/components/o/index.native.js +1 -0
  127. package/dist/native/esm/components/o/index.web.js +1 -0
  128. package/dist/native/esm/components/o/o.native.js +8 -0
  129. package/dist/native/esm/components/o/o.web.js +8 -0
  130. package/dist/native/esm/components/p/index.native.js +1 -0
  131. package/dist/native/esm/components/p/index.web.js +1 -0
  132. package/dist/native/esm/components/p/p.native.js +9 -0
  133. package/dist/native/esm/components/p/p.web.js +9 -0
  134. package/dist/native/esm/components/s/index.native.js +1 -0
  135. package/dist/native/esm/components/s/index.web.js +1 -0
  136. package/dist/native/esm/components/s/s.native.js +7 -0
  137. package/dist/native/esm/components/s/s.web.js +6 -0
  138. package/dist/native/esm/components/t/index.native.js +1 -0
  139. package/dist/native/esm/components/t/index.web.js +1 -0
  140. package/dist/native/esm/components/t/t.native.js +12 -0
  141. package/dist/native/esm/components/t/t.web.js +12 -0
  142. package/dist/native/esm/components/u/context.js +11 -0
  143. package/dist/native/esm/components/u/index.native.js +3 -0
  144. package/dist/native/esm/components/u/index.web.js +3 -0
  145. package/dist/native/esm/components/u/provider.native.js +19 -0
  146. package/dist/native/esm/components/u/provider.web.js +16 -0
  147. package/dist/native/esm/components/u/types.js +1 -0
  148. package/dist/native/esm/components/u/useUniverse.js +5 -0
  149. package/dist/native/esm/hooks/index.js +6 -0
  150. package/dist/native/esm/hooks/index.native.js +6 -0
  151. package/dist/native/esm/hooks/index.web.js +6 -0
  152. package/dist/native/esm/hooks/useAction/types.js +1 -0
  153. package/dist/native/esm/hooks/useAction/useAction.native.js +14 -0
  154. package/dist/native/esm/hooks/useAction/useAction.web.js +17 -0
  155. package/dist/native/esm/hooks/useCn.js +8 -0
  156. package/dist/native/esm/hooks/useInteractiveState/useInteractiveState.native.js +28 -0
  157. package/dist/native/esm/hooks/useInteractiveState/useInteractiveState.types.js +1 -0
  158. package/dist/native/esm/hooks/useInteractiveState/useInteractiveState.web.js +59 -0
  159. package/dist/native/esm/hooks/useOnChange.js +14 -0
  160. package/dist/native/esm/hooks/useOnHoverOrPress.js +17 -0
  161. package/dist/native/esm/hooks/useProps.js +59 -0
  162. package/dist/native/esm/index.js +3 -0
  163. package/dist/native/esm/index.native.js +3 -0
  164. package/dist/native/esm/index.web.js +3 -0
  165. package/dist/native/esm/types/base.js +1 -0
  166. package/dist/native/esm/types/index.js +1 -0
  167. package/dist/native/tsconfig.native.cjs.tsbuildinfo +1 -0
  168. package/dist/native/tsconfig.native.esm.tsbuildinfo +1 -0
  169. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  170. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  171. package/dist/types/components/a/a.native.d.ts +1 -1
  172. package/dist/types/components/a/a.native.d.ts.map +1 -1
  173. package/dist/types/components/a/a.web.d.ts +1 -1
  174. package/dist/types/components/a/a.web.d.ts.map +1 -1
  175. package/dist/types/components/d/d.native.d.ts +1 -1
  176. package/dist/types/components/d/d.native.d.ts.map +1 -1
  177. package/dist/types/components/d/d.web.d.ts +1 -1
  178. package/dist/types/components/d/d.web.d.ts.map +1 -1
  179. package/dist/types/components/e/e.native.d.ts +1 -1
  180. package/dist/types/components/e/e.native.d.ts.map +1 -1
  181. package/dist/types/components/e/e.web.d.ts +1 -1
  182. package/dist/types/components/e/e.web.d.ts.map +1 -1
  183. package/dist/types/components/i/i.native.d.ts +1 -1
  184. package/dist/types/components/i/i.native.d.ts.map +1 -1
  185. package/dist/types/components/i/i.web.d.ts +1 -1
  186. package/dist/types/components/i/i.web.d.ts.map +1 -1
  187. package/dist/types/components/i/useIUtils.d.ts +1 -1
  188. package/dist/types/components/l/l.web.d.ts +1 -1
  189. package/dist/types/components/l/l.web.d.ts.map +1 -1
  190. package/dist/types/components/o/o.web.d.ts +1 -1
  191. package/dist/types/components/o/o.web.d.ts.map +1 -1
  192. package/dist/types/components/p/p.web.d.ts +1 -1
  193. package/dist/types/components/p/p.web.d.ts.map +1 -1
  194. package/dist/types/hooks/index.d.ts +1 -0
  195. package/dist/types/hooks/index.d.ts.map +1 -1
  196. package/dist/types/hooks/index.native.d.ts +1 -0
  197. package/dist/types/hooks/index.native.d.ts.map +1 -1
  198. package/dist/types/hooks/index.web.d.ts +1 -0
  199. package/dist/types/hooks/index.web.d.ts.map +1 -1
  200. package/dist/types/hooks/useInteractiveState/useInteractiveState.native.d.ts +14 -2
  201. package/dist/types/hooks/useInteractiveState/useInteractiveState.native.d.ts.map +1 -1
  202. package/dist/types/hooks/useInteractiveState/useInteractiveState.types.d.ts +3 -9
  203. package/dist/types/hooks/useInteractiveState/useInteractiveState.types.d.ts.map +1 -1
  204. package/dist/types/hooks/useInteractiveState/useInteractiveState.web.d.ts +20 -2
  205. package/dist/types/hooks/useInteractiveState/useInteractiveState.web.d.ts.map +1 -1
  206. package/dist/types/hooks/useOnChange.d.ts +3 -3
  207. package/dist/types/hooks/useOnChange.d.ts.map +1 -1
  208. package/dist/types/hooks/useOnHoverOrPress.d.ts +12 -0
  209. package/dist/types/hooks/useOnHoverOrPress.d.ts.map +1 -0
  210. package/dist/types/types/base.d.ts +20 -7
  211. package/dist/types/types/base.d.ts.map +1 -1
  212. package/package.json +5 -6
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useCn, useOnChange } from '../../hooks/index.web';
3
3
  import { useIUtils } from './useIUtils';
4
- export function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, disabled, editable, ref, ...rest }) {
4
+ export function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, disabled, editable, ref, style, ...rest }) {
5
5
  const { treatTypeModeAndKeyboardType } = useIUtils();
6
6
  const cn = useCn();
7
7
  const { onChange: handleOnChange } = useOnChange({
@@ -14,6 +14,6 @@ export function I({ className, value, defaultValue, placeholder, onChange, onCha
14
14
  keyboardType,
15
15
  type,
16
16
  });
17
- return (_jsx("input", { ref: ref, type: masterInputType, inputMode: masterInputMode, className: cn('outline-none', effectiveDisabled && 'opacity-60 cursor-not-allowed', className), value: value, defaultValue: defaultValue, placeholder: placeholder, onChange: handleOnChange, disabled: effectiveDisabled, ...rest }));
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 }));
18
18
  }
19
19
  export const Input = I;
@@ -1,13 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useAction } from '../../hooks/index.native';
3
3
  import { useCn } from '../../hooks/index.web';
4
- export function L({ className, children, to, href, onClick, onPress, preventDefault, ref, ...rest }) {
4
+ export function L({ className, children, to, href, onClick, onPress, preventDefault, ref, style, ...rest }) {
5
5
  const cn = useCn();
6
6
  const { onAction } = useAction({
7
7
  onClick,
8
8
  onPress,
9
9
  });
10
10
  const resolvedHref = href ?? to ?? '#';
11
- return (_jsx("a", { ref: ref, href: resolvedHref, className: cn('cursor-pointer', className), onClick: onAction, ...rest, children: children }));
11
+ return (_jsx("a", { ref: ref, href: resolvedHref, className: cn('cursor-pointer', className), onClick: onAction, style: style, ...rest, children: children }));
12
12
  }
13
13
  export const Link = L;
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useCn } from '../../hooks/index.web';
3
- export function O({ className, children, horizontal, ref, ...rest }) {
3
+ export function O({ className, children, horizontal, ref, style, ...rest }) {
4
4
  const cn = useCn();
5
5
  const overflowClass = horizontal ? 'overflow-x-auto' : 'overflow-y-auto';
6
- return (_jsx("div", { ref: ref, className: cn(overflowClass, className), ...rest, children: children }));
6
+ return (_jsx("div", { ref: ref, className: cn(overflowClass, className), style: style, ...rest, children: children }));
7
7
  }
8
8
  export const Overflow = O;
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useCn } from '../../hooks/index.web';
3
- export function P({ alt, className, ref, ...rest }) {
3
+ export function P({ alt, className, ref, style, ...rest }) {
4
4
  const cn = useCn();
5
5
  return (
6
6
  // biome-ignore lint/a11y/useAltText: <explanation>
7
- _jsx("img", { alt: alt, "aria-label": alt, ref: ref, className: cn('object-cover', className), ...rest }));
7
+ _jsx("img", { alt: alt, "aria-label": alt, ref: ref, className: cn('object-cover', className), style: style, ...rest }));
8
8
  }
9
9
  export const Picture = P;
@@ -2,4 +2,5 @@ export * from './useAction/useAction.web';
2
2
  export * from './useCn';
3
3
  export * from './useInteractiveState/useInteractiveState.web';
4
4
  export * from './useOnChange';
5
+ export * from './useOnHoverOrPress';
5
6
  export * from './useProps';
@@ -2,4 +2,5 @@ export * from './useAction/useAction.native';
2
2
  export * from './useCn';
3
3
  export * from './useInteractiveState/useInteractiveState.native';
4
4
  export * from './useOnChange';
5
+ export * from './useOnHoverOrPress';
5
6
  export * from './useProps';
@@ -2,4 +2,5 @@ export * from './useAction/useAction.web';
2
2
  export * from './useCn';
3
3
  export * from './useInteractiveState/useInteractiveState.web';
4
4
  export * from './useOnChange';
5
+ export * from './useOnHoverOrPress';
5
6
  export * from './useProps';
@@ -1,68 +1,28 @@
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),
21
- };
22
- }
1
+ import { useState } from 'react';
23
2
  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)
37
- return;
38
- setState((prev) => ({ ...prev, hovered: true }));
39
- },
40
- onMouseLeave: () => {
41
- if (disabled)
42
- return;
43
- setState((prev) => ({ ...prev, hovered: false, pressed: false }));
44
- },
45
- onMouseDown: () => {
46
- if (disabled)
47
- return;
48
- setState((prev) => ({ ...prev, pressed: true }));
49
- },
50
- onMouseUp: () => {
51
- if (disabled)
52
- return;
53
- setState((prev) => ({ ...prev, pressed: false }));
54
- },
55
- onFocus: () => {
3
+ const { disabled } = options;
4
+ const [pressed, setPressed] = useState(false);
5
+ const state = disabled
6
+ ? 'disabled'
7
+ : pressed
8
+ ? 'pressed'
9
+ : 'idle';
10
+ const dataAttrs = {
11
+ 'data-state': state,
12
+ 'data-pressed': pressed ? 'true' : 'false',
13
+ 'data-disabled': disabled ? 'true' : 'false',
14
+ };
15
+ const eventHandlers = {
16
+ onPressIn: (e) => {
56
17
  if (disabled)
57
18
  return;
58
- setState((prev) => ({ ...prev, focused: true }));
19
+ setPressed(true);
59
20
  },
60
- onBlur: () => {
21
+ onPressOut: (e) => {
61
22
  if (disabled)
62
23
  return;
63
- setState((prev) => ({ ...prev, focused: false, pressed: false }));
24
+ setPressed(false);
64
25
  },
65
- }), [disabled]);
66
- const dataAttrs = toDataAttrs(state);
26
+ };
67
27
  return { state, dataAttrs, eventHandlers };
68
28
  }
@@ -1,68 +1,59 @@
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),
21
- };
22
- }
1
+ import { useState } from 'react';
23
2
  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(() => ({
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';
16
+ const dataAttrs = {
17
+ 'data-state': state,
18
+ 'data-hovered': hovered ? 'true' : 'false',
19
+ 'data-pressed': pressed ? 'true' : 'false',
20
+ 'data-focused': focused ? 'true' : 'false',
21
+ 'data-disabled': disabled ? 'true' : 'false',
22
+ };
23
+ const eventHandlers = {
35
24
  onMouseEnter: () => {
36
25
  if (disabled)
37
26
  return;
38
- setState((prev) => ({ ...prev, hovered: true }));
27
+ setHovered(true);
39
28
  },
40
29
  onMouseLeave: () => {
41
30
  if (disabled)
42
31
  return;
43
- setState((prev) => ({ ...prev, hovered: false, pressed: false }));
32
+ setHovered(false);
33
+ setPressed(false);
44
34
  },
45
- onMouseDown: () => {
46
- if (disabled)
35
+ onMouseDown: (e) => {
36
+ if (disabled || e.button !== 0)
47
37
  return;
48
- setState((prev) => ({ ...prev, pressed: true }));
38
+ setPressed(true);
49
39
  },
50
40
  onMouseUp: () => {
51
41
  if (disabled)
52
42
  return;
53
- setState((prev) => ({ ...prev, pressed: false }));
43
+ setPressed(false);
54
44
  },
55
45
  onFocus: () => {
56
46
  if (disabled)
57
47
  return;
58
- setState((prev) => ({ ...prev, focused: true }));
48
+ setFocused(true);
59
49
  },
60
50
  onBlur: () => {
61
51
  if (disabled)
62
52
  return;
63
- setState((prev) => ({ ...prev, focused: false, pressed: false }));
53
+ setFocused(false);
54
+ setPressed(false);
55
+ setHovered(false);
64
56
  },
65
- }), [disabled]);
66
- const dataAttrs = toDataAttrs(state);
57
+ };
67
58
  return { state, dataAttrs, eventHandlers };
68
59
  }
@@ -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,17 @@
1
+ import { useMemo, useRef } from 'react';
2
+ export const useOnHoverOrPress = ({ onIn, onOut }) => {
3
+ const value = useRef('on');
4
+ return useMemo(() => ({
5
+ onMouseEnter: onIn,
6
+ onMouseLeave: onOut,
7
+ onPress: (event) => {
8
+ if (value.current === 'on') {
9
+ value.current = 'off';
10
+ onOut?.(event);
11
+ return;
12
+ }
13
+ value.current = 'on';
14
+ onIn?.(event);
15
+ },
16
+ }), [onIn, onOut]);
17
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Action = void 0;
4
+ exports.A = A;
5
+ const jsx_runtime_1 = require("nativewind/jsx-runtime");
6
+ const react_native_1 = require("react-native");
7
+ const index_native_1 = require("../../hooks/index.native");
8
+ const index_native_2 = require("../e/index.native");
9
+ function A({ className, children, onPress, onClick, disabled, ref, style, ...rest }) {
10
+ const cn = (0, index_native_1.useCn)();
11
+ const { onAction } = (0, index_native_1.useAction)({
12
+ onClick,
13
+ onPress,
14
+ });
15
+ return ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { ref: ref, onPress: onAction, disabled: disabled, children: (0, jsx_runtime_1.jsx)(index_native_2.E, { className: cn(disabled && 'opacity-60', className), style: style, ...rest, children: children }) }));
16
+ }
17
+ exports.Action = A;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Action = void 0;
4
+ exports.A = A;
5
+ const jsx_runtime_1 = require("nativewind/jsx-runtime");
6
+ const index_web_1 = require("../../hooks/index.web");
7
+ function A({ className, children, onPress, onClick, disabled, ref, style, ...rest }) {
8
+ const cn = (0, index_web_1.useCn)();
9
+ const { onAction } = (0, index_web_1.useAction)({
10
+ onClick,
11
+ onPress,
12
+ });
13
+ return ((0, jsx_runtime_1.jsx)("button", { ref: ref, type: "button", disabled: disabled, className: cn('cursor-pointer', disabled && 'opacity-60', className), onClick: onAction, style: style, ...rest, children: children }));
14
+ }
15
+ exports.Action = A;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./a.native"), exports);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./a.web"), exports);
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Dialog = void 0;
4
+ exports.D = D;
5
+ const jsx_runtime_1 = require("nativewind/jsx-runtime");
6
+ const react_native_1 = require("react-native");
7
+ const index_native_1 = require("../../hooks/index.native");
8
+ const index_native_2 = require("../e/index.native");
9
+ function D({ open, onOpenChange, placement = 'center', backdropClassName, backdropStyle, containerClassName, containerStyle, contentClassName, contentStyle, children, ref, ...rest }) {
10
+ const cn = (0, index_native_1.useCn)();
11
+ const placementClasses = {
12
+ center: 'items-center justify-center',
13
+ top: 'items-start justify-center',
14
+ bottom: 'items-end justify-center',
15
+ left: 'items-stretch justify-start',
16
+ right: 'items-stretch justify-end',
17
+ };
18
+ const containerClasses = cn('flex-1 bg-black/40 flex', placementClasses[placement], containerClassName, backdropClassName);
19
+ 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);
20
+ const handleRequestClose = (e) => {
21
+ onOpenChange?.(false);
22
+ if (typeof rest.onRequestClose === 'function') {
23
+ rest.onRequestClose?.(e);
24
+ }
25
+ };
26
+ return ((0, jsx_runtime_1.jsx)(react_native_1.Modal, { visible: open, animationType: "slide", transparent: true, onRequestClose: handleRequestClose, ...rest, children: (0, jsx_runtime_1.jsx)(index_native_2.E, { className: containerClasses, style: { ...containerStyle, ...backdropStyle }, children: (0, jsx_runtime_1.jsx)(index_native_2.E, { ref: ref, className: contentClasses, style: contentStyle, children: children }) }) }));
27
+ }
28
+ exports.Dialog = D;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Dialog = void 0;
4
+ exports.D = D;
5
+ const jsx_runtime_1 = require("nativewind/jsx-runtime");
6
+ const react_dom_1 = require("react-dom");
7
+ const index_web_1 = require("../../hooks/index.web");
8
+ const index_web_2 = require("../e/index.web");
9
+ function D({ open, onOpenChange, placement = 'center', backdropClassName, backdropStyle, containerClassName, containerStyle, contentClassName, contentStyle, closeOnBackdropClick = true, children, ref, ...rest }) {
10
+ const cn = (0, index_web_1.useCn)();
11
+ if (typeof document === 'undefined')
12
+ return null;
13
+ if (!open)
14
+ return null;
15
+ const placementClasses = {
16
+ center: 'items-center justify-center',
17
+ top: 'items-start justify-center',
18
+ bottom: 'items-end justify-center',
19
+ left: 'items-stretch justify-start',
20
+ right: 'items-stretch justify-end',
21
+ };
22
+ const handleBackdropClick = (event) => {
23
+ if (event.target !== event.currentTarget)
24
+ return;
25
+ if (closeOnBackdropClick) {
26
+ onOpenChange?.(false);
27
+ }
28
+ };
29
+ const backdropClasses = cn('fixed inset-0 z-50 flex bg-black/40', placementClasses[placement], containerClassName, backdropClassName);
30
+ 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);
31
+ return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(index_web_2.E, { className: backdropClasses, role: "presentation", onClick: handleBackdropClick, style: {
32
+ ...containerStyle,
33
+ ...backdropStyle,
34
+ }, children: (0, jsx_runtime_1.jsx)("div", { ref: ref,
35
+ // biome-ignore lint/a11y/useSemanticElements: <explanation>
36
+ role: "dialog", "aria-modal": "true", className: contentClasses, style: contentStyle, ...rest, children: children }) }), document.body);
37
+ }
38
+ exports.Dialog = D;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./d.native"), exports);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./d.web"), exports);
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Element = void 0;
4
+ exports.E = E;
5
+ const jsx_runtime_1 = require("nativewind/jsx-runtime");
6
+ const react_native_1 = require("react-native");
7
+ const index_native_1 = require("../../hooks/index.native");
8
+ const index_native_2 = require("../t/index.native");
9
+ function E({ className, children, onIn, onOut, onClick, onPress, ref, style, ...rest }) {
10
+ const cn = (0, index_native_1.useCn)();
11
+ const { onAction } = (0, index_native_1.useAction)({
12
+ onClick,
13
+ onPress,
14
+ });
15
+ const { onPress: onHoverOrPress } = (0, index_native_1.useOnHoverOrPress)({ onIn, onOut });
16
+ const handleOnPress = () => {
17
+ onAction();
18
+ onHoverOrPress();
19
+ return false;
20
+ };
21
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, className: cn(className), onStartShouldSetResponder: handleOnPress, style: style, ...rest, children: typeof children === 'string' ? (0, jsx_runtime_1.jsx)(index_native_2.T, { children: children }) : children }));
22
+ }
23
+ exports.Element = E;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Element = void 0;
4
+ exports.E = E;
5
+ const jsx_runtime_1 = require("nativewind/jsx-runtime");
6
+ const index_web_1 = require("../../hooks/index.web");
7
+ function E({ className, children, onIn, onOut, onPress, onClick, ref, style, ...rest }) {
8
+ const cn = (0, index_web_1.useCn)();
9
+ const { onAction } = (0, index_web_1.useAction)({
10
+ onClick,
11
+ onPress,
12
+ });
13
+ const { onMouseEnter, onMouseLeave } = (0, index_web_1.useOnHoverOrPress)({ onIn, onOut });
14
+ return ((0, jsx_runtime_1.jsx)("div", { ref: ref, className: cn(className), onClick: onAction, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, style: style, ...rest, children: children }));
15
+ }
16
+ exports.Element = E;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./e.native"), exports);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./e.web"), exports);
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Input = void 0;
4
+ exports.I = I;
5
+ const jsx_runtime_1 = require("nativewind/jsx-runtime");
6
+ const react_native_1 = require("react-native");
7
+ const index_native_1 = require("../../hooks/index.native");
8
+ const useIUtils_1 = require("./useIUtils");
9
+ function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, editable, disabled, ref, style, ...rest }) {
10
+ const { treatTypeModeAndKeyboardType } = (0, useIUtils_1.useIUtils)();
11
+ const cn = (0, index_native_1.useCn)();
12
+ const { onChange: handleOnChange } = (0, index_native_1.useOnChange)({
13
+ onChange,
14
+ onChangeValue,
15
+ });
16
+ const effectiveEditable = editable ?? !disabled;
17
+ const { masterInputType, masterInputKeyboardType } = treatTypeModeAndKeyboardType({
18
+ inputMode,
19
+ keyboardType,
20
+ type,
21
+ });
22
+ return ((0, jsx_runtime_1.jsx)(react_native_1.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 }));
23
+ }
24
+ exports.Input = I;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Input = void 0;
4
+ exports.I = I;
5
+ const jsx_runtime_1 = require("nativewind/jsx-runtime");
6
+ const index_web_1 = require("../../hooks/index.web");
7
+ const useIUtils_1 = require("./useIUtils");
8
+ function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, disabled, editable, ref, style, ...rest }) {
9
+ const { treatTypeModeAndKeyboardType } = (0, useIUtils_1.useIUtils)();
10
+ const cn = (0, index_web_1.useCn)();
11
+ const { onChange: handleOnChange } = (0, index_web_1.useOnChange)({
12
+ onChange,
13
+ onChangeValue,
14
+ });
15
+ const effectiveDisabled = disabled || editable === false;
16
+ const { masterInputType, masterInputMode } = treatTypeModeAndKeyboardType({
17
+ inputMode,
18
+ keyboardType,
19
+ type,
20
+ });
21
+ return ((0, jsx_runtime_1.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 }));
22
+ }
23
+ exports.Input = I;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./i.native"), exports);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./i.web"), exports);