@react-xp/aeiou 0.1.0-beta.7 → 0.1.0-beta.8

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 (61) hide show
  1. package/dist/cjs/components/d/d.native.js +2 -2
  2. package/dist/cjs/components/d/d.web.js +3 -3
  3. package/dist/cjs/components/e/e.native.js +3 -1
  4. package/dist/cjs/components/e/e.web.js +3 -2
  5. package/dist/cjs/components/i/i.native.js +1 -7
  6. package/dist/cjs/hooks/index.js +1 -0
  7. package/dist/cjs/hooks/index.native.js +1 -0
  8. package/dist/cjs/hooks/index.web.js +1 -0
  9. package/dist/cjs/hooks/useOnHoverOrPress.js +21 -0
  10. package/dist/esm/components/d/d.native.js +2 -2
  11. package/dist/esm/components/d/d.web.js +3 -3
  12. package/dist/esm/components/e/e.native.js +4 -2
  13. package/dist/esm/components/e/e.web.js +4 -3
  14. package/dist/esm/components/i/i.native.js +1 -7
  15. package/dist/esm/hooks/index.js +1 -0
  16. package/dist/esm/hooks/index.native.js +1 -0
  17. package/dist/esm/hooks/index.web.js +1 -0
  18. package/dist/esm/hooks/useOnHoverOrPress.js +17 -0
  19. package/dist/native/cjs/components/d/d.native.js +2 -2
  20. package/dist/native/cjs/components/d/d.web.js +3 -3
  21. package/dist/native/cjs/components/e/e.native.js +3 -1
  22. package/dist/native/cjs/components/e/e.web.js +3 -2
  23. package/dist/native/cjs/components/i/i.native.js +1 -7
  24. package/dist/native/cjs/hooks/index.js +1 -0
  25. package/dist/native/cjs/hooks/index.native.js +1 -0
  26. package/dist/native/cjs/hooks/index.web.js +1 -0
  27. package/dist/native/cjs/hooks/useOnHoverOrPress.js +21 -0
  28. package/dist/native/esm/components/d/d.native.js +2 -2
  29. package/dist/native/esm/components/d/d.web.js +3 -3
  30. package/dist/native/esm/components/e/e.native.js +4 -2
  31. package/dist/native/esm/components/e/e.web.js +4 -3
  32. package/dist/native/esm/components/i/i.native.js +1 -7
  33. package/dist/native/esm/hooks/index.js +1 -0
  34. package/dist/native/esm/hooks/index.native.js +1 -0
  35. package/dist/native/esm/hooks/index.web.js +1 -0
  36. package/dist/native/esm/hooks/useOnHoverOrPress.js +17 -0
  37. package/dist/native/tsconfig.native.cjs.tsbuildinfo +1 -1
  38. package/dist/native/tsconfig.native.esm.tsbuildinfo +1 -1
  39. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  40. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  41. package/dist/types/components/d/d.native.d.ts +1 -1
  42. package/dist/types/components/d/d.native.d.ts.map +1 -1
  43. package/dist/types/components/d/d.web.d.ts +1 -1
  44. package/dist/types/components/d/d.web.d.ts.map +1 -1
  45. package/dist/types/components/e/e.native.d.ts +1 -1
  46. package/dist/types/components/e/e.native.d.ts.map +1 -1
  47. package/dist/types/components/e/e.web.d.ts +1 -1
  48. package/dist/types/components/e/e.web.d.ts.map +1 -1
  49. package/dist/types/components/i/i.native.d.ts.map +1 -1
  50. package/dist/types/components/i/useIUtils.d.ts +1 -1
  51. package/dist/types/hooks/index.d.ts +1 -0
  52. package/dist/types/hooks/index.d.ts.map +1 -1
  53. package/dist/types/hooks/index.native.d.ts +1 -0
  54. package/dist/types/hooks/index.native.d.ts.map +1 -1
  55. package/dist/types/hooks/index.web.d.ts +1 -0
  56. package/dist/types/hooks/index.web.d.ts.map +1 -1
  57. package/dist/types/hooks/useOnHoverOrPress.d.ts +12 -0
  58. package/dist/types/hooks/useOnHoverOrPress.d.ts.map +1 -0
  59. package/dist/types/types/base.d.ts +7 -1
  60. package/dist/types/types/base.d.ts.map +1 -1
  61. package/package.json +1 -1
@@ -6,7 +6,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const react_native_1 = require("react-native");
7
7
  const index_native_1 = require("../../hooks/index.native");
8
8
  const index_native_2 = require("../e/index.native");
9
- function D({ open, onOpenChange, placement = 'center', className, backdropClassName, containerClassName, contentClassName, children, ref, ...rest }) {
9
+ function D({ open, onOpenChange, placement = 'center', className, backdropClassName, containerClassName, contentClassName, children, ref, containerStyle, contentStyle, ...rest }) {
10
10
  const cn = (0, index_native_1.useCn)();
11
11
  const placementClasses = {
12
12
  center: 'items-center justify-center',
@@ -23,6 +23,6 @@ function D({ open, onOpenChange, placement = 'center', className, backdropClassN
23
23
  rest.onRequestClose?.(e);
24
24
  }
25
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, children: (0, jsx_runtime_1.jsx)(index_native_2.E, { ref: ref, className: contentClasses, children: children }) }) }));
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, children: (0, jsx_runtime_1.jsx)(index_native_2.E, { ref: ref, className: contentClasses, style: contentStyle, children: children }) }) }));
27
27
  }
28
28
  exports.Dialog = D;
@@ -6,7 +6,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const react_dom_1 = require("react-dom");
7
7
  const index_web_1 = require("../../hooks/index.web");
8
8
  const index_web_2 = require("../e/index.web");
9
- function D({ open, onOpenChange, placement = 'center', className, backdropClassName, containerClassName, contentClassName, closeOnBackdropClick = true, children, ref, style, ...rest }) {
9
+ function D({ open, onOpenChange, placement = 'center', className, backdropClassName, containerClassName, contentClassName, closeOnBackdropClick = true, children, ref, containerStyle, contentStyle, ...rest }) {
10
10
  const cn = (0, index_web_1.useCn)();
11
11
  if (typeof document === 'undefined')
12
12
  return null;
@@ -28,8 +28,8 @@ function D({ open, onOpenChange, placement = 'center', className, backdropClassN
28
28
  };
29
29
  const backdropClasses = cn('fixed inset-0 z-50 flex bg-black/40', placementClasses[placement], containerClassName, backdropClassName);
30
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' : '', className, contentClassName);
31
- return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(index_web_2.E, { className: backdropClasses, role: "presentation", onClick: handleBackdropClick, children: (0, jsx_runtime_1.jsx)("div", { ref: ref,
31
+ return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(index_web_2.E, { className: backdropClasses, role: "presentation", onClick: handleBackdropClick, style: containerStyle, children: (0, jsx_runtime_1.jsx)("div", { ref: ref,
32
32
  // biome-ignore lint/a11y/useSemanticElements: <explanation>
33
- role: "dialog", "aria-modal": "true", className: contentClasses, style: style, ...rest, children: children }) }), document.body);
33
+ role: "dialog", "aria-modal": "true", className: contentClasses, style: contentStyle, ...rest, children: children }) }), document.body);
34
34
  }
35
35
  exports.Dialog = D;
@@ -6,14 +6,16 @@ const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const react_native_1 = require("react-native");
7
7
  const index_native_1 = require("../../hooks/index.native");
8
8
  const index_native_2 = require("../t/index.native");
9
- function E({ className, children, onPress, onClick, ref, style, ...rest }) {
9
+ function E({ className, children, onIn, onOut, onClick, onPress, ref, style, ...rest }) {
10
10
  const cn = (0, index_native_1.useCn)();
11
11
  const { onAction } = (0, index_native_1.useAction)({
12
12
  onClick,
13
13
  onPress,
14
14
  });
15
+ const { onPress: onHoverOrPress } = (0, index_native_1.useOnHoverOrPress)({ onIn, onOut });
15
16
  const handleOnPress = () => {
16
17
  onAction();
18
+ onHoverOrPress();
17
19
  return false;
18
20
  };
19
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 }));
@@ -4,12 +4,13 @@ exports.Element = void 0;
4
4
  exports.E = E;
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const index_web_1 = require("../../hooks/index.web");
7
- function E({ className, children, onPress, onClick, ref, style, ...rest }) {
7
+ function E({ className, children, onIn, onOut, onPress, onClick, ref, style, ...rest }) {
8
8
  const cn = (0, index_web_1.useCn)();
9
9
  const { onAction } = (0, index_web_1.useAction)({
10
10
  onClick,
11
11
  onPress,
12
12
  });
13
- return ((0, jsx_runtime_1.jsx)("div", { ref: ref, className: cn(className), onClick: onAction, style: style, ...rest, children: children }));
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 }));
14
15
  }
15
16
  exports.Element = E;
@@ -19,12 +19,6 @@ function I({ className, value, defaultValue, placeholder, onChange, onChangeValu
19
19
  keyboardType,
20
20
  type,
21
21
  });
22
- const handleChange = (event) => {
23
- if (onChange)
24
- onChange(event);
25
- if (onChangeValue)
26
- onChangeValue(event.nativeEvent.text);
27
- };
28
- return ((0, jsx_runtime_1.jsx)(react_native_1.TextInput, { ref: ref, className: cn(!effectiveEditable && 'opacity-60', className), value: value, defaultValue: defaultValue, placeholder: placeholder, onChange: handleChange, secureTextEntry: masterInputType === 'password', keyboardType: masterInputKeyboardType, editable: effectiveEditable, style: style, ...rest }));
22
+ return ((0, jsx_runtime_1.jsx)(react_native_1.TextInput, { ref: ref, className: cn(!effectiveEditable && 'opacity-60', className), value: value, defaultValue: defaultValue, placeholder: placeholder, onChange: handleOnChange, secureTextEntry: masterInputType === 'password', keyboardType: masterInputKeyboardType, editable: effectiveEditable, style: style, ...rest }));
29
23
  }
30
24
  exports.Input = I;
@@ -18,4 +18,5 @@ __exportStar(require("./useAction/useAction.web"), exports);
18
18
  __exportStar(require("./useCn"), exports);
19
19
  __exportStar(require("./useInteractiveState/useInteractiveState.web"), exports);
20
20
  __exportStar(require("./useOnChange"), exports);
21
+ __exportStar(require("./useOnHoverOrPress"), exports);
21
22
  __exportStar(require("./useProps"), exports);
@@ -18,4 +18,5 @@ __exportStar(require("./useAction/useAction.native"), exports);
18
18
  __exportStar(require("./useCn"), exports);
19
19
  __exportStar(require("./useInteractiveState/useInteractiveState.native"), exports);
20
20
  __exportStar(require("./useOnChange"), exports);
21
+ __exportStar(require("./useOnHoverOrPress"), exports);
21
22
  __exportStar(require("./useProps"), exports);
@@ -18,4 +18,5 @@ __exportStar(require("./useAction/useAction.web"), exports);
18
18
  __exportStar(require("./useCn"), exports);
19
19
  __exportStar(require("./useInteractiveState/useInteractiveState.web"), exports);
20
20
  __exportStar(require("./useOnChange"), exports);
21
+ __exportStar(require("./useOnHoverOrPress"), exports);
21
22
  __exportStar(require("./useProps"), exports);
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useOnHoverOrPress = void 0;
4
+ const react_1 = require("react");
5
+ const useOnHoverOrPress = ({ onIn, onOut }) => {
6
+ const value = (0, react_1.useRef)('on');
7
+ return (0, react_1.useMemo)(() => ({
8
+ onMouseEnter: onIn,
9
+ onMouseLeave: onOut,
10
+ onPress: (event) => {
11
+ if (value.current === 'on') {
12
+ value.current = 'off';
13
+ onOut?.(event);
14
+ return;
15
+ }
16
+ value.current = 'on';
17
+ onIn?.(event);
18
+ },
19
+ }), [onIn, onOut]);
20
+ };
21
+ exports.useOnHoverOrPress = useOnHoverOrPress;
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Modal } from 'react-native';
3
3
  import { useCn } from '../../hooks/index.native';
4
4
  import { E } from '../e/index.native';
5
- export function D({ open, onOpenChange, placement = 'center', className, backdropClassName, containerClassName, contentClassName, children, ref, ...rest }) {
5
+ export function D({ open, onOpenChange, placement = 'center', className, backdropClassName, containerClassName, contentClassName, children, ref, containerStyle, contentStyle, ...rest }) {
6
6
  const cn = useCn();
7
7
  const placementClasses = {
8
8
  center: 'items-center justify-center',
@@ -19,6 +19,6 @@ export function D({ open, onOpenChange, placement = 'center', className, backdro
19
19
  rest.onRequestClose?.(e);
20
20
  }
21
21
  };
22
- return (_jsx(Modal, { visible: open, animationType: "slide", transparent: true, onRequestClose: handleRequestClose, ...rest, children: _jsx(E, { className: containerClasses, children: _jsx(E, { ref: ref, className: contentClasses, children: children }) }) }));
22
+ return (_jsx(Modal, { visible: open, animationType: "slide", transparent: true, onRequestClose: handleRequestClose, ...rest, children: _jsx(E, { className: containerClasses, style: containerStyle, children: _jsx(E, { ref: ref, className: contentClasses, style: contentStyle, children: children }) }) }));
23
23
  }
24
24
  export const Dialog = D;
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { createPortal } from 'react-dom';
3
3
  import { useCn } from '../../hooks/index.web';
4
4
  import { E } from '../e/index.web';
5
- export function D({ open, onOpenChange, placement = 'center', className, backdropClassName, containerClassName, contentClassName, closeOnBackdropClick = true, children, ref, style, ...rest }) {
5
+ export function D({ open, onOpenChange, placement = 'center', className, backdropClassName, containerClassName, contentClassName, closeOnBackdropClick = true, children, ref, containerStyle, contentStyle, ...rest }) {
6
6
  const cn = useCn();
7
7
  if (typeof document === 'undefined')
8
8
  return null;
@@ -24,8 +24,8 @@ export function D({ open, onOpenChange, placement = 'center', className, backdro
24
24
  };
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' : '', className, contentClassName);
27
- return createPortal(_jsx(E, { className: backdropClasses, role: "presentation", onClick: handleBackdropClick, children: _jsx("div", { ref: ref,
27
+ return createPortal(_jsx(E, { className: backdropClasses, role: "presentation", onClick: handleBackdropClick, style: containerStyle, children: _jsx("div", { ref: ref,
28
28
  // biome-ignore lint/a11y/useSemanticElements: <explanation>
29
- role: "dialog", "aria-modal": "true", className: contentClasses, style: style, ...rest, children: children }) }), document.body);
29
+ role: "dialog", "aria-modal": "true", className: contentClasses, style: contentStyle, ...rest, children: children }) }), document.body);
30
30
  }
31
31
  export const Dialog = D;
@@ -1,15 +1,17 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { View } from 'react-native';
3
- import { useAction, useCn } from '../../hooks/index.native';
3
+ import { useAction, useCn, useOnHoverOrPress } from '../../hooks/index.native';
4
4
  import { T } from '../t/index.native';
5
- export function E({ className, children, onPress, onClick, ref, style, ...rest }) {
5
+ export function E({ className, children, onIn, onOut, onClick, onPress, ref, style, ...rest }) {
6
6
  const cn = useCn();
7
7
  const { onAction } = useAction({
8
8
  onClick,
9
9
  onPress,
10
10
  });
11
+ const { onPress: onHoverOrPress } = useOnHoverOrPress({ onIn, onOut });
11
12
  const handleOnPress = () => {
12
13
  onAction();
14
+ onHoverOrPress();
13
15
  return false;
14
16
  };
15
17
  return (_jsx(View, { ref: ref, className: cn(className), onStartShouldSetResponder: handleOnPress, style: style, ...rest, children: typeof children === 'string' ? _jsx(T, { children: children }) : children }));
@@ -1,11 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useAction, useCn } from '../../hooks/index.web';
3
- export function E({ className, children, onPress, onClick, ref, style, ...rest }) {
2
+ import { useAction, useCn, useOnHoverOrPress } from '../../hooks/index.web';
3
+ export function E({ className, children, onIn, onOut, onPress, onClick, ref, style, ...rest }) {
4
4
  const cn = useCn();
5
5
  const { onAction } = useAction({
6
6
  onClick,
7
7
  onPress,
8
8
  });
9
- return (_jsx("div", { ref: ref, className: cn(className), onClick: onAction, style: style, ...rest, children: children }));
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 }));
10
11
  }
11
12
  export const Element = E;
@@ -15,12 +15,6 @@ export function I({ className, value, defaultValue, placeholder, onChange, onCha
15
15
  keyboardType,
16
16
  type,
17
17
  });
18
- const handleChange = (event) => {
19
- if (onChange)
20
- onChange(event);
21
- if (onChangeValue)
22
- onChangeValue(event.nativeEvent.text);
23
- };
24
- return (_jsx(TextInput, { ref: ref, className: cn(!effectiveEditable && 'opacity-60', className), value: value, defaultValue: defaultValue, placeholder: placeholder, onChange: handleChange, secureTextEntry: masterInputType === 'password', keyboardType: masterInputKeyboardType, editable: effectiveEditable, style: style, ...rest }));
18
+ return (_jsx(TextInput, { ref: ref, className: cn(!effectiveEditable && 'opacity-60', className), value: value, defaultValue: defaultValue, placeholder: placeholder, onChange: handleOnChange, secureTextEntry: masterInputType === 'password', keyboardType: masterInputKeyboardType, editable: effectiveEditable, style: style, ...rest }));
25
19
  }
26
20
  export const Input = I;
@@ -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';
@@ -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
+ };
@@ -6,7 +6,7 @@ const jsx_runtime_1 = require("nativewind/jsx-runtime");
6
6
  const react_native_1 = require("react-native");
7
7
  const index_native_1 = require("../../hooks/index.native");
8
8
  const index_native_2 = require("../e/index.native");
9
- function D({ open, onOpenChange, placement = 'center', className, backdropClassName, containerClassName, contentClassName, children, ref, ...rest }) {
9
+ function D({ open, onOpenChange, placement = 'center', className, backdropClassName, containerClassName, contentClassName, children, ref, containerStyle, contentStyle, ...rest }) {
10
10
  const cn = (0, index_native_1.useCn)();
11
11
  const placementClasses = {
12
12
  center: 'items-center justify-center',
@@ -23,6 +23,6 @@ function D({ open, onOpenChange, placement = 'center', className, backdropClassN
23
23
  rest.onRequestClose?.(e);
24
24
  }
25
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, children: (0, jsx_runtime_1.jsx)(index_native_2.E, { ref: ref, className: contentClasses, children: children }) }) }));
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, children: (0, jsx_runtime_1.jsx)(index_native_2.E, { ref: ref, className: contentClasses, style: contentStyle, children: children }) }) }));
27
27
  }
28
28
  exports.Dialog = D;
@@ -6,7 +6,7 @@ const jsx_runtime_1 = require("nativewind/jsx-runtime");
6
6
  const react_dom_1 = require("react-dom");
7
7
  const index_web_1 = require("../../hooks/index.web");
8
8
  const index_web_2 = require("../e/index.web");
9
- function D({ open, onOpenChange, placement = 'center', className, backdropClassName, containerClassName, contentClassName, closeOnBackdropClick = true, children, ref, style, ...rest }) {
9
+ function D({ open, onOpenChange, placement = 'center', className, backdropClassName, containerClassName, contentClassName, closeOnBackdropClick = true, children, ref, containerStyle, contentStyle, ...rest }) {
10
10
  const cn = (0, index_web_1.useCn)();
11
11
  if (typeof document === 'undefined')
12
12
  return null;
@@ -28,8 +28,8 @@ function D({ open, onOpenChange, placement = 'center', className, backdropClassN
28
28
  };
29
29
  const backdropClasses = cn('fixed inset-0 z-50 flex bg-black/40', placementClasses[placement], containerClassName, backdropClassName);
30
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' : '', className, contentClassName);
31
- return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(index_web_2.E, { className: backdropClasses, role: "presentation", onClick: handleBackdropClick, children: (0, jsx_runtime_1.jsx)("div", { ref: ref,
31
+ return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(index_web_2.E, { className: backdropClasses, role: "presentation", onClick: handleBackdropClick, style: containerStyle, children: (0, jsx_runtime_1.jsx)("div", { ref: ref,
32
32
  // biome-ignore lint/a11y/useSemanticElements: <explanation>
33
- role: "dialog", "aria-modal": "true", className: contentClasses, style: style, ...rest, children: children }) }), document.body);
33
+ role: "dialog", "aria-modal": "true", className: contentClasses, style: contentStyle, ...rest, children: children }) }), document.body);
34
34
  }
35
35
  exports.Dialog = D;
@@ -6,14 +6,16 @@ const jsx_runtime_1 = require("nativewind/jsx-runtime");
6
6
  const react_native_1 = require("react-native");
7
7
  const index_native_1 = require("../../hooks/index.native");
8
8
  const index_native_2 = require("../t/index.native");
9
- function E({ className, children, onPress, onClick, ref, style, ...rest }) {
9
+ function E({ className, children, onIn, onOut, onClick, onPress, ref, style, ...rest }) {
10
10
  const cn = (0, index_native_1.useCn)();
11
11
  const { onAction } = (0, index_native_1.useAction)({
12
12
  onClick,
13
13
  onPress,
14
14
  });
15
+ const { onPress: onHoverOrPress } = (0, index_native_1.useOnHoverOrPress)({ onIn, onOut });
15
16
  const handleOnPress = () => {
16
17
  onAction();
18
+ onHoverOrPress();
17
19
  return false;
18
20
  };
19
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 }));
@@ -4,12 +4,13 @@ exports.Element = void 0;
4
4
  exports.E = E;
5
5
  const jsx_runtime_1 = require("nativewind/jsx-runtime");
6
6
  const index_web_1 = require("../../hooks/index.web");
7
- function E({ className, children, onPress, onClick, ref, style, ...rest }) {
7
+ function E({ className, children, onIn, onOut, onPress, onClick, ref, style, ...rest }) {
8
8
  const cn = (0, index_web_1.useCn)();
9
9
  const { onAction } = (0, index_web_1.useAction)({
10
10
  onClick,
11
11
  onPress,
12
12
  });
13
- return ((0, jsx_runtime_1.jsx)("div", { ref: ref, className: cn(className), onClick: onAction, style: style, ...rest, children: children }));
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 }));
14
15
  }
15
16
  exports.Element = E;
@@ -19,12 +19,6 @@ function I({ className, value, defaultValue, placeholder, onChange, onChangeValu
19
19
  keyboardType,
20
20
  type,
21
21
  });
22
- const handleChange = (event) => {
23
- if (onChange)
24
- onChange(event);
25
- if (onChangeValue)
26
- onChangeValue(event.nativeEvent.text);
27
- };
28
- return ((0, jsx_runtime_1.jsx)(react_native_1.TextInput, { ref: ref, className: cn(!effectiveEditable && 'opacity-60', className), value: value, defaultValue: defaultValue, placeholder: placeholder, onChange: handleChange, secureTextEntry: masterInputType === 'password', keyboardType: masterInputKeyboardType, editable: effectiveEditable, style: style, ...rest }));
22
+ return ((0, jsx_runtime_1.jsx)(react_native_1.TextInput, { ref: ref, className: cn(!effectiveEditable && 'opacity-60', className), value: value, defaultValue: defaultValue, placeholder: placeholder, onChange: handleOnChange, secureTextEntry: masterInputType === 'password', keyboardType: masterInputKeyboardType, editable: effectiveEditable, style: style, ...rest }));
29
23
  }
30
24
  exports.Input = I;
@@ -18,4 +18,5 @@ __exportStar(require("./useAction/useAction.web"), exports);
18
18
  __exportStar(require("./useCn"), exports);
19
19
  __exportStar(require("./useInteractiveState/useInteractiveState.web"), exports);
20
20
  __exportStar(require("./useOnChange"), exports);
21
+ __exportStar(require("./useOnHoverOrPress"), exports);
21
22
  __exportStar(require("./useProps"), exports);
@@ -18,4 +18,5 @@ __exportStar(require("./useAction/useAction.native"), exports);
18
18
  __exportStar(require("./useCn"), exports);
19
19
  __exportStar(require("./useInteractiveState/useInteractiveState.native"), exports);
20
20
  __exportStar(require("./useOnChange"), exports);
21
+ __exportStar(require("./useOnHoverOrPress"), exports);
21
22
  __exportStar(require("./useProps"), exports);
@@ -18,4 +18,5 @@ __exportStar(require("./useAction/useAction.web"), exports);
18
18
  __exportStar(require("./useCn"), exports);
19
19
  __exportStar(require("./useInteractiveState/useInteractiveState.web"), exports);
20
20
  __exportStar(require("./useOnChange"), exports);
21
+ __exportStar(require("./useOnHoverOrPress"), exports);
21
22
  __exportStar(require("./useProps"), exports);
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useOnHoverOrPress = void 0;
4
+ const react_1 = require("react");
5
+ const useOnHoverOrPress = ({ onIn, onOut }) => {
6
+ const value = (0, react_1.useRef)('on');
7
+ return (0, react_1.useMemo)(() => ({
8
+ onMouseEnter: onIn,
9
+ onMouseLeave: onOut,
10
+ onPress: (event) => {
11
+ if (value.current === 'on') {
12
+ value.current = 'off';
13
+ onOut?.(event);
14
+ return;
15
+ }
16
+ value.current = 'on';
17
+ onIn?.(event);
18
+ },
19
+ }), [onIn, onOut]);
20
+ };
21
+ exports.useOnHoverOrPress = useOnHoverOrPress;
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "nativewind/jsx-runtime";
2
2
  import { Modal } from 'react-native';
3
3
  import { useCn } from '../../hooks/index.native';
4
4
  import { E } from '../e/index.native';
5
- export function D({ open, onOpenChange, placement = 'center', className, backdropClassName, containerClassName, contentClassName, children, ref, ...rest }) {
5
+ export function D({ open, onOpenChange, placement = 'center', className, backdropClassName, containerClassName, contentClassName, children, ref, containerStyle, contentStyle, ...rest }) {
6
6
  const cn = useCn();
7
7
  const placementClasses = {
8
8
  center: 'items-center justify-center',
@@ -19,6 +19,6 @@ export function D({ open, onOpenChange, placement = 'center', className, backdro
19
19
  rest.onRequestClose?.(e);
20
20
  }
21
21
  };
22
- return (_jsx(Modal, { visible: open, animationType: "slide", transparent: true, onRequestClose: handleRequestClose, ...rest, children: _jsx(E, { className: containerClasses, children: _jsx(E, { ref: ref, className: contentClasses, children: children }) }) }));
22
+ return (_jsx(Modal, { visible: open, animationType: "slide", transparent: true, onRequestClose: handleRequestClose, ...rest, children: _jsx(E, { className: containerClasses, style: containerStyle, children: _jsx(E, { ref: ref, className: contentClasses, style: contentStyle, children: children }) }) }));
23
23
  }
24
24
  export const Dialog = D;
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "nativewind/jsx-runtime";
2
2
  import { createPortal } from 'react-dom';
3
3
  import { useCn } from '../../hooks/index.web';
4
4
  import { E } from '../e/index.web';
5
- export function D({ open, onOpenChange, placement = 'center', className, backdropClassName, containerClassName, contentClassName, closeOnBackdropClick = true, children, ref, style, ...rest }) {
5
+ export function D({ open, onOpenChange, placement = 'center', className, backdropClassName, containerClassName, contentClassName, closeOnBackdropClick = true, children, ref, containerStyle, contentStyle, ...rest }) {
6
6
  const cn = useCn();
7
7
  if (typeof document === 'undefined')
8
8
  return null;
@@ -24,8 +24,8 @@ export function D({ open, onOpenChange, placement = 'center', className, backdro
24
24
  };
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' : '', className, contentClassName);
27
- return createPortal(_jsx(E, { className: backdropClasses, role: "presentation", onClick: handleBackdropClick, children: _jsx("div", { ref: ref,
27
+ return createPortal(_jsx(E, { className: backdropClasses, role: "presentation", onClick: handleBackdropClick, style: containerStyle, children: _jsx("div", { ref: ref,
28
28
  // biome-ignore lint/a11y/useSemanticElements: <explanation>
29
- role: "dialog", "aria-modal": "true", className: contentClasses, style: style, ...rest, children: children }) }), document.body);
29
+ role: "dialog", "aria-modal": "true", className: contentClasses, style: contentStyle, ...rest, children: children }) }), document.body);
30
30
  }
31
31
  export const Dialog = D;
@@ -1,15 +1,17 @@
1
1
  import { jsx as _jsx } from "nativewind/jsx-runtime";
2
2
  import { View } from 'react-native';
3
- import { useAction, useCn } from '../../hooks/index.native';
3
+ import { useAction, useCn, useOnHoverOrPress } from '../../hooks/index.native';
4
4
  import { T } from '../t/index.native';
5
- export function E({ className, children, onPress, onClick, ref, style, ...rest }) {
5
+ export function E({ className, children, onIn, onOut, onClick, onPress, ref, style, ...rest }) {
6
6
  const cn = useCn();
7
7
  const { onAction } = useAction({
8
8
  onClick,
9
9
  onPress,
10
10
  });
11
+ const { onPress: onHoverOrPress } = useOnHoverOrPress({ onIn, onOut });
11
12
  const handleOnPress = () => {
12
13
  onAction();
14
+ onHoverOrPress();
13
15
  return false;
14
16
  };
15
17
  return (_jsx(View, { ref: ref, className: cn(className), onStartShouldSetResponder: handleOnPress, style: style, ...rest, children: typeof children === 'string' ? _jsx(T, { children: children }) : children }));
@@ -1,11 +1,12 @@
1
1
  import { jsx as _jsx } from "nativewind/jsx-runtime";
2
- import { useAction, useCn } from '../../hooks/index.web';
3
- export function E({ className, children, onPress, onClick, ref, style, ...rest }) {
2
+ import { useAction, useCn, useOnHoverOrPress } from '../../hooks/index.web';
3
+ export function E({ className, children, onIn, onOut, onPress, onClick, ref, style, ...rest }) {
4
4
  const cn = useCn();
5
5
  const { onAction } = useAction({
6
6
  onClick,
7
7
  onPress,
8
8
  });
9
- return (_jsx("div", { ref: ref, className: cn(className), onClick: onAction, style: style, ...rest, children: children }));
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 }));
10
11
  }
11
12
  export const Element = E;
@@ -15,12 +15,6 @@ export function I({ className, value, defaultValue, placeholder, onChange, onCha
15
15
  keyboardType,
16
16
  type,
17
17
  });
18
- const handleChange = (event) => {
19
- if (onChange)
20
- onChange(event);
21
- if (onChangeValue)
22
- onChangeValue(event.nativeEvent.text);
23
- };
24
- return (_jsx(TextInput, { ref: ref, className: cn(!effectiveEditable && 'opacity-60', className), value: value, defaultValue: defaultValue, placeholder: placeholder, onChange: handleChange, secureTextEntry: masterInputType === 'password', keyboardType: masterInputKeyboardType, editable: effectiveEditable, style: style, ...rest }));
18
+ return (_jsx(TextInput, { ref: ref, className: cn(!effectiveEditable && 'opacity-60', className), value: value, defaultValue: defaultValue, placeholder: placeholder, onChange: handleOnChange, secureTextEntry: masterInputType === 'password', keyboardType: masterInputKeyboardType, editable: effectiveEditable, style: style, ...rest }));
25
19
  }
26
20
  export const Input = I;
@@ -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';
@@ -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
+ };