@react-xp/aeiou 0.1.0-beta.1 → 0.1.0-beta.10
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.
- package/dist/cjs/components/a/a.native.js +3 -2
- package/dist/cjs/components/a/a.web.js +2 -2
- package/dist/cjs/components/d/d.native.js +3 -3
- package/dist/cjs/components/d/d.web.js +8 -3
- package/dist/cjs/components/e/e.native.js +5 -2
- package/dist/cjs/components/e/e.web.js +3 -2
- package/dist/cjs/components/i/i.native.js +2 -8
- package/dist/cjs/components/i/i.web.js +2 -2
- package/dist/cjs/components/l/l.web.js +2 -2
- package/dist/cjs/components/o/o.web.js +2 -2
- package/dist/cjs/components/p/p.web.js +2 -2
- package/dist/cjs/hooks/index.js +1 -0
- package/dist/cjs/hooks/index.native.js +1 -0
- package/dist/cjs/hooks/index.web.js +1 -0
- package/dist/cjs/hooks/useInteractiveState/useInteractiveState.native.js +18 -58
- package/dist/cjs/hooks/useInteractiveState/useInteractiveState.web.js +33 -42
- package/dist/cjs/hooks/useOnHoverOrPress.js +21 -0
- package/dist/esm/components/a/a.native.js +4 -3
- package/dist/esm/components/a/a.web.js +2 -2
- package/dist/esm/components/d/d.native.js +3 -3
- package/dist/esm/components/d/d.web.js +8 -3
- package/dist/esm/components/e/e.native.js +6 -3
- package/dist/esm/components/e/e.web.js +4 -3
- package/dist/esm/components/i/i.native.js +2 -8
- package/dist/esm/components/i/i.web.js +2 -2
- package/dist/esm/components/l/l.web.js +2 -2
- package/dist/esm/components/o/o.web.js +2 -2
- package/dist/esm/components/p/p.web.js +2 -2
- package/dist/esm/hooks/index.js +1 -0
- package/dist/esm/hooks/index.native.js +1 -0
- package/dist/esm/hooks/index.web.js +1 -0
- package/dist/esm/hooks/useInteractiveState/useInteractiveState.native.js +19 -59
- package/dist/esm/hooks/useInteractiveState/useInteractiveState.web.js +34 -43
- package/dist/esm/hooks/useOnHoverOrPress.js +17 -0
- package/dist/native/cjs/components/a/a.native.js +17 -0
- package/dist/native/cjs/components/a/a.web.js +15 -0
- package/dist/native/cjs/components/a/index.native.js +17 -0
- package/dist/native/cjs/components/a/index.web.js +17 -0
- package/dist/native/cjs/components/d/d.native.js +28 -0
- package/dist/native/cjs/components/d/d.web.js +38 -0
- package/dist/native/cjs/components/d/index.native.js +17 -0
- package/dist/native/cjs/components/d/index.web.js +17 -0
- package/dist/native/cjs/components/e/e.native.js +23 -0
- package/dist/native/cjs/components/e/e.web.js +16 -0
- package/dist/native/cjs/components/e/index.native.js +17 -0
- package/dist/native/cjs/components/e/index.web.js +17 -0
- package/dist/native/cjs/components/i/i.native.js +24 -0
- package/dist/native/cjs/components/i/i.web.js +23 -0
- package/dist/native/cjs/components/i/index.native.js +17 -0
- package/dist/native/cjs/components/i/index.web.js +17 -0
- package/dist/native/cjs/components/i/useIUtils.js +71 -0
- package/dist/native/cjs/components/index.js +26 -0
- package/dist/native/cjs/components/index.native.js +26 -0
- package/dist/native/cjs/components/index.web.js +26 -0
- package/dist/native/cjs/components/l/index.native.js +17 -0
- package/dist/native/cjs/components/l/index.web.js +17 -0
- package/dist/native/cjs/components/l/l.native.js +10 -0
- package/dist/native/cjs/components/l/l.web.js +17 -0
- package/dist/native/cjs/components/o/index.native.js +17 -0
- package/dist/native/cjs/components/o/index.web.js +17 -0
- package/dist/native/cjs/components/o/o.native.js +12 -0
- package/dist/native/cjs/components/o/o.web.js +12 -0
- package/dist/native/cjs/components/p/index.native.js +17 -0
- package/dist/native/cjs/components/p/index.web.js +17 -0
- package/dist/native/cjs/components/p/p.native.js +13 -0
- package/dist/native/cjs/components/p/p.web.js +13 -0
- package/dist/native/cjs/components/s/index.native.js +17 -0
- package/dist/native/cjs/components/s/index.web.js +17 -0
- package/dist/native/cjs/components/s/s.native.js +10 -0
- package/dist/native/cjs/components/s/s.web.js +10 -0
- package/dist/native/cjs/components/t/index.native.js +17 -0
- package/dist/native/cjs/components/t/index.web.js +17 -0
- package/dist/native/cjs/components/t/t.native.js +16 -0
- package/dist/native/cjs/components/t/t.web.js +16 -0
- package/dist/native/cjs/components/u/context.js +14 -0
- package/dist/native/cjs/components/u/index.native.js +19 -0
- package/dist/native/cjs/components/u/index.web.js +19 -0
- package/dist/native/cjs/components/u/provider.native.js +23 -0
- package/dist/native/cjs/components/u/provider.web.js +20 -0
- package/dist/native/cjs/components/u/types.js +2 -0
- package/dist/native/cjs/components/u/useUniverse.js +8 -0
- package/dist/native/cjs/hooks/index.js +22 -0
- package/dist/native/cjs/hooks/index.native.js +22 -0
- package/dist/native/cjs/hooks/index.web.js +22 -0
- package/dist/native/cjs/hooks/useAction/types.js +2 -0
- package/dist/native/cjs/hooks/useAction/useAction.native.js +18 -0
- package/dist/native/cjs/hooks/useAction/useAction.web.js +21 -0
- package/dist/native/cjs/hooks/useCn.js +15 -0
- package/dist/native/cjs/hooks/useInteractiveState/useInteractiveState.native.js +31 -0
- package/dist/native/cjs/hooks/useInteractiveState/useInteractiveState.types.js +2 -0
- package/dist/native/cjs/hooks/useInteractiveState/useInteractiveState.web.js +62 -0
- package/dist/native/cjs/hooks/useOnChange.js +18 -0
- package/dist/native/cjs/hooks/useOnHoverOrPress.js +21 -0
- package/dist/native/cjs/hooks/useProps.js +66 -0
- package/dist/native/cjs/index.js +19 -0
- package/dist/native/cjs/index.native.js +19 -0
- package/dist/native/cjs/index.web.js +19 -0
- package/dist/native/cjs/types/base.js +2 -0
- package/dist/native/cjs/types/index.js +17 -0
- package/dist/native/esm/components/a/a.native.js +13 -0
- package/dist/native/esm/components/a/a.web.js +11 -0
- package/dist/native/esm/components/a/index.native.js +1 -0
- package/dist/native/esm/components/a/index.web.js +1 -0
- package/dist/native/esm/components/d/d.native.js +24 -0
- package/dist/native/esm/components/d/d.web.js +34 -0
- package/dist/native/esm/components/d/index.native.js +1 -0
- package/dist/native/esm/components/d/index.web.js +1 -0
- package/dist/native/esm/components/e/e.native.js +19 -0
- package/dist/native/esm/components/e/e.web.js +12 -0
- package/dist/native/esm/components/e/index.native.js +1 -0
- package/dist/native/esm/components/e/index.web.js +1 -0
- package/dist/native/esm/components/i/i.native.js +20 -0
- package/dist/native/esm/components/i/i.web.js +19 -0
- package/dist/native/esm/components/i/index.native.js +1 -0
- package/dist/native/esm/components/i/index.web.js +1 -0
- package/dist/native/esm/components/i/useIUtils.js +67 -0
- package/dist/native/esm/components/index.js +10 -0
- package/dist/native/esm/components/index.native.js +10 -0
- package/dist/native/esm/components/index.web.js +10 -0
- package/dist/native/esm/components/l/index.native.js +1 -0
- package/dist/native/esm/components/l/index.web.js +1 -0
- package/dist/native/esm/components/l/l.native.js +6 -0
- package/dist/native/esm/components/l/l.web.js +13 -0
- package/dist/native/esm/components/o/index.native.js +1 -0
- package/dist/native/esm/components/o/index.web.js +1 -0
- package/dist/native/esm/components/o/o.native.js +8 -0
- package/dist/native/esm/components/o/o.web.js +8 -0
- package/dist/native/esm/components/p/index.native.js +1 -0
- package/dist/native/esm/components/p/index.web.js +1 -0
- package/dist/native/esm/components/p/p.native.js +9 -0
- package/dist/native/esm/components/p/p.web.js +9 -0
- package/dist/native/esm/components/s/index.native.js +1 -0
- package/dist/native/esm/components/s/index.web.js +1 -0
- package/dist/native/esm/components/s/s.native.js +7 -0
- package/dist/native/esm/components/s/s.web.js +6 -0
- package/dist/native/esm/components/t/index.native.js +1 -0
- package/dist/native/esm/components/t/index.web.js +1 -0
- package/dist/native/esm/components/t/t.native.js +12 -0
- package/dist/native/esm/components/t/t.web.js +12 -0
- package/dist/native/esm/components/u/context.js +11 -0
- package/dist/native/esm/components/u/index.native.js +3 -0
- package/dist/native/esm/components/u/index.web.js +3 -0
- package/dist/native/esm/components/u/provider.native.js +19 -0
- package/dist/native/esm/components/u/provider.web.js +16 -0
- package/dist/native/esm/components/u/types.js +1 -0
- package/dist/native/esm/components/u/useUniverse.js +5 -0
- package/dist/native/esm/hooks/index.js +6 -0
- package/dist/native/esm/hooks/index.native.js +6 -0
- package/dist/native/esm/hooks/index.web.js +6 -0
- package/dist/native/esm/hooks/useAction/types.js +1 -0
- package/dist/native/esm/hooks/useAction/useAction.native.js +14 -0
- package/dist/native/esm/hooks/useAction/useAction.web.js +17 -0
- package/dist/native/esm/hooks/useCn.js +8 -0
- package/dist/native/esm/hooks/useInteractiveState/useInteractiveState.native.js +28 -0
- package/dist/native/esm/hooks/useInteractiveState/useInteractiveState.types.js +1 -0
- package/dist/native/esm/hooks/useInteractiveState/useInteractiveState.web.js +59 -0
- package/dist/native/esm/hooks/useOnChange.js +14 -0
- package/dist/native/esm/hooks/useOnHoverOrPress.js +17 -0
- package/dist/native/esm/hooks/useProps.js +59 -0
- package/dist/native/esm/index.js +3 -0
- package/dist/native/esm/index.native.js +3 -0
- package/dist/native/esm/index.web.js +3 -0
- package/dist/native/esm/types/base.js +1 -0
- package/dist/native/esm/types/index.js +1 -0
- package/dist/native/tsconfig.native.cjs.tsbuildinfo +1 -0
- package/dist/native/tsconfig.native.esm.tsbuildinfo +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/components/a/a.native.d.ts +1 -1
- package/dist/types/components/a/a.native.d.ts.map +1 -1
- package/dist/types/components/a/a.web.d.ts +1 -1
- package/dist/types/components/a/a.web.d.ts.map +1 -1
- package/dist/types/components/d/d.native.d.ts +1 -1
- package/dist/types/components/d/d.native.d.ts.map +1 -1
- package/dist/types/components/d/d.web.d.ts +1 -1
- package/dist/types/components/d/d.web.d.ts.map +1 -1
- package/dist/types/components/e/e.native.d.ts +1 -1
- package/dist/types/components/e/e.native.d.ts.map +1 -1
- package/dist/types/components/e/e.web.d.ts +1 -1
- package/dist/types/components/e/e.web.d.ts.map +1 -1
- package/dist/types/components/i/i.native.d.ts +1 -1
- package/dist/types/components/i/i.native.d.ts.map +1 -1
- package/dist/types/components/i/i.web.d.ts +1 -1
- package/dist/types/components/i/i.web.d.ts.map +1 -1
- package/dist/types/components/i/useIUtils.d.ts +1 -1
- package/dist/types/components/l/l.web.d.ts +1 -1
- package/dist/types/components/l/l.web.d.ts.map +1 -1
- package/dist/types/components/o/o.web.d.ts +1 -1
- package/dist/types/components/o/o.web.d.ts.map +1 -1
- package/dist/types/components/p/p.web.d.ts +1 -1
- package/dist/types/components/p/p.web.d.ts.map +1 -1
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/index.d.ts.map +1 -1
- package/dist/types/hooks/index.native.d.ts +1 -0
- package/dist/types/hooks/index.native.d.ts.map +1 -1
- package/dist/types/hooks/index.web.d.ts +1 -0
- package/dist/types/hooks/index.web.d.ts.map +1 -1
- package/dist/types/hooks/useInteractiveState/useInteractiveState.native.d.ts +14 -2
- package/dist/types/hooks/useInteractiveState/useInteractiveState.native.d.ts.map +1 -1
- package/dist/types/hooks/useInteractiveState/useInteractiveState.types.d.ts +3 -9
- package/dist/types/hooks/useInteractiveState/useInteractiveState.types.d.ts.map +1 -1
- package/dist/types/hooks/useInteractiveState/useInteractiveState.web.d.ts +20 -2
- package/dist/types/hooks/useInteractiveState/useInteractiveState.web.d.ts.map +1 -1
- package/dist/types/hooks/useOnHoverOrPress.d.ts +12 -0
- package/dist/types/hooks/useOnHoverOrPress.d.ts.map +1 -0
- package/dist/types/types/base.d.ts +20 -7
- package/dist/types/types/base.d.ts.map +1 -1
- package/package.json +5 -6
|
@@ -5,12 +5,13 @@ exports.A = A;
|
|
|
5
5
|
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 A({ className, children, onPress, onClick, disabled, ref, style, ...rest }) {
|
|
9
10
|
const cn = (0, index_native_1.useCn)();
|
|
10
11
|
const { onAction } = (0, index_native_1.useAction)({
|
|
11
12
|
onClick,
|
|
12
13
|
onPress,
|
|
13
14
|
});
|
|
14
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { ref: ref, onPress: onAction, disabled: disabled,
|
|
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 }) }));
|
|
15
16
|
}
|
|
16
17
|
exports.Action = A;
|
|
@@ -4,12 +4,12 @@ exports.Action = void 0;
|
|
|
4
4
|
exports.A = A;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const index_web_1 = require("../../hooks/index.web");
|
|
7
|
-
function A({ className, children, onPress, onClick, disabled, ref, ...rest }) {
|
|
7
|
+
function A({ className, children, onPress, onClick, disabled, 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)("button", { ref: ref, type: "button", disabled: disabled, className: cn('cursor-pointer', disabled && 'opacity-60', className), onClick: onAction, ...rest, children: children }));
|
|
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
14
|
}
|
|
15
15
|
exports.Action = A;
|
|
@@ -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',
|
|
9
|
+
function D({ open, onOpenChange, placement = 'center', backdropClassName, backdropStyle, containerClassName, containerStyle, contentClassName, contentStyle, children, ref, ...rest }) {
|
|
10
10
|
const cn = (0, index_native_1.useCn)();
|
|
11
11
|
const placementClasses = {
|
|
12
12
|
center: 'items-center justify-center',
|
|
@@ -16,13 +16,13 @@ function D({ open, onOpenChange, placement = 'center', className, backdropClassN
|
|
|
16
16
|
right: 'items-stretch justify-end',
|
|
17
17
|
};
|
|
18
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' : '',
|
|
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
20
|
const handleRequestClose = (e) => {
|
|
21
21
|
onOpenChange?.(false);
|
|
22
22
|
if (typeof rest.onRequestClose === 'function') {
|
|
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, ...backdropStyle }, 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',
|
|
9
|
+
function D({ open, onOpenChange, placement = 'center', backdropClassName, backdropStyle, containerClassName, containerStyle, contentClassName, contentStyle, closeOnBackdropClick = true, children, ref, ...rest }) {
|
|
10
10
|
const cn = (0, index_web_1.useCn)();
|
|
11
11
|
if (typeof document === 'undefined')
|
|
12
12
|
return null;
|
|
@@ -27,7 +27,12 @@ function D({ open, onOpenChange, placement = 'center', className, backdropClassN
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
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' : '',
|
|
31
|
-
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(index_web_2.E, { className: backdropClasses, role: "presentation", onClick: handleBackdropClick,
|
|
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);
|
|
32
37
|
}
|
|
33
38
|
exports.Dialog = D;
|
|
@@ -5,16 +5,19 @@ exports.E = E;
|
|
|
5
5
|
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, onIn, onOut, onClick, onPress, ref, style, ...rest }) {
|
|
9
10
|
const cn = (0, index_native_1.useCn)();
|
|
10
11
|
const { onAction } = (0, index_native_1.useAction)({
|
|
11
12
|
onClick,
|
|
12
13
|
onPress,
|
|
13
14
|
});
|
|
15
|
+
const { onPress: onHoverOrPress } = (0, index_native_1.useOnHoverOrPress)({ onIn, onOut });
|
|
14
16
|
const handleOnPress = () => {
|
|
15
17
|
onAction();
|
|
18
|
+
onHoverOrPress();
|
|
16
19
|
return false;
|
|
17
20
|
};
|
|
18
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, className: cn(className), onStartShouldSetResponder: handleOnPress, ...rest, children: children }));
|
|
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 }));
|
|
19
22
|
}
|
|
20
23
|
exports.Element = E;
|
|
@@ -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, ...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
|
-
|
|
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;
|
|
@@ -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 useIUtils_1 = require("./useIUtils");
|
|
9
|
-
function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, editable, disabled, ref, ...rest }) {
|
|
9
|
+
function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, editable, disabled, ref, style, ...rest }) {
|
|
10
10
|
const { treatTypeModeAndKeyboardType } = (0, useIUtils_1.useIUtils)();
|
|
11
11
|
const cn = (0, index_native_1.useCn)();
|
|
12
12
|
const { onChange: handleOnChange } = (0, index_native_1.useOnChange)({
|
|
@@ -19,12 +19,6 @@ function I({ className, value, defaultValue, placeholder, onChange, onChangeValu
|
|
|
19
19
|
keyboardType,
|
|
20
20
|
type,
|
|
21
21
|
});
|
|
22
|
-
|
|
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, ...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;
|
|
@@ -5,7 +5,7 @@ exports.I = I;
|
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const index_web_1 = require("../../hooks/index.web");
|
|
7
7
|
const useIUtils_1 = require("./useIUtils");
|
|
8
|
-
function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, disabled, editable, ref, ...rest }) {
|
|
8
|
+
function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, disabled, editable, ref, style, ...rest }) {
|
|
9
9
|
const { treatTypeModeAndKeyboardType } = (0, useIUtils_1.useIUtils)();
|
|
10
10
|
const cn = (0, index_web_1.useCn)();
|
|
11
11
|
const { onChange: handleOnChange } = (0, index_web_1.useOnChange)({
|
|
@@ -18,6 +18,6 @@ function I({ className, value, defaultValue, placeholder, onChange, onChangeValu
|
|
|
18
18
|
keyboardType,
|
|
19
19
|
type,
|
|
20
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, defaultValue: defaultValue, placeholder: placeholder, onChange: handleOnChange, disabled: effectiveDisabled, ...rest }));
|
|
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, defaultValue: defaultValue, placeholder: placeholder, onChange: handleOnChange, disabled: effectiveDisabled, style: style, ...rest }));
|
|
22
22
|
}
|
|
23
23
|
exports.Input = I;
|
|
@@ -5,13 +5,13 @@ exports.L = L;
|
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const index_native_1 = require("../../hooks/index.native");
|
|
7
7
|
const index_web_1 = require("../../hooks/index.web");
|
|
8
|
-
function L({ className, children, to, href, onClick, onPress, preventDefault, ref, ...rest }) {
|
|
8
|
+
function L({ className, children, to, href, onClick, onPress, preventDefault, ref, style, ...rest }) {
|
|
9
9
|
const cn = (0, index_web_1.useCn)();
|
|
10
10
|
const { onAction } = (0, index_native_1.useAction)({
|
|
11
11
|
onClick,
|
|
12
12
|
onPress,
|
|
13
13
|
});
|
|
14
14
|
const resolvedHref = href ?? to ?? '#';
|
|
15
|
-
return ((0, jsx_runtime_1.jsx)("a", { ref: ref, href: resolvedHref, className: cn('cursor-pointer', className), onClick: onAction, ...rest, children: children }));
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)("a", { ref: ref, href: resolvedHref, className: cn('cursor-pointer', className), onClick: onAction, style: style, ...rest, children: children }));
|
|
16
16
|
}
|
|
17
17
|
exports.Link = L;
|
|
@@ -4,9 +4,9 @@ exports.Overflow = void 0;
|
|
|
4
4
|
exports.O = O;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const index_web_1 = require("../../hooks/index.web");
|
|
7
|
-
function O({ className, children, horizontal, ref, ...rest }) {
|
|
7
|
+
function O({ className, children, horizontal, ref, style, ...rest }) {
|
|
8
8
|
const cn = (0, index_web_1.useCn)();
|
|
9
9
|
const overflowClass = horizontal ? 'overflow-x-auto' : 'overflow-y-auto';
|
|
10
|
-
return ((0, jsx_runtime_1.jsx)("div", { ref: ref, className: cn(overflowClass, className), ...rest, children: children }));
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: ref, className: cn(overflowClass, className), style: style, ...rest, children: children }));
|
|
11
11
|
}
|
|
12
12
|
exports.Overflow = O;
|
|
@@ -4,10 +4,10 @@ exports.Picture = void 0;
|
|
|
4
4
|
exports.P = P;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const index_web_1 = require("../../hooks/index.web");
|
|
7
|
-
function P({ alt, className, ref, ...rest }) {
|
|
7
|
+
function P({ alt, className, ref, style, ...rest }) {
|
|
8
8
|
const cn = (0, index_web_1.useCn)();
|
|
9
9
|
return (
|
|
10
10
|
// biome-ignore lint/a11y/useAltText: <explanation>
|
|
11
|
-
(0, jsx_runtime_1.jsx)("img", { alt: alt, "aria-label": alt, ref: ref, className: cn('object-cover', className), ...rest }));
|
|
11
|
+
(0, jsx_runtime_1.jsx)("img", { alt: alt, "aria-label": alt, ref: ref, className: cn('object-cover', className), style: style, ...rest }));
|
|
12
12
|
}
|
|
13
13
|
exports.Picture = P;
|
package/dist/cjs/hooks/index.js
CHANGED
|
@@ -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);
|
|
@@ -2,70 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useInteractiveState = useInteractiveState;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
function computeVisualState(state) {
|
|
6
|
-
if (state.disabled)
|
|
7
|
-
return 'disabled';
|
|
8
|
-
if (state.pressed)
|
|
9
|
-
return 'pressed';
|
|
10
|
-
if (state.hovered)
|
|
11
|
-
return 'hovered';
|
|
12
|
-
if (state.focused)
|
|
13
|
-
return 'focused';
|
|
14
|
-
return 'default';
|
|
15
|
-
}
|
|
16
|
-
function toDataAttrs(state) {
|
|
17
|
-
const visual = computeVisualState(state);
|
|
18
|
-
return {
|
|
19
|
-
'data-state': visual,
|
|
20
|
-
'data-hovered': String(state.hovered),
|
|
21
|
-
'data-pressed': String(state.pressed),
|
|
22
|
-
'data-focused': String(state.focused),
|
|
23
|
-
'data-disabled': String(state.disabled),
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
5
|
function useInteractiveState(options = {}) {
|
|
27
|
-
const { disabled
|
|
28
|
-
const [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
setState((prev) => ({ ...prev, hovered: true }));
|
|
42
|
-
},
|
|
43
|
-
onMouseLeave: () => {
|
|
44
|
-
if (disabled)
|
|
45
|
-
return;
|
|
46
|
-
setState((prev) => ({ ...prev, hovered: false, pressed: false }));
|
|
47
|
-
},
|
|
48
|
-
onMouseDown: () => {
|
|
49
|
-
if (disabled)
|
|
50
|
-
return;
|
|
51
|
-
setState((prev) => ({ ...prev, pressed: true }));
|
|
52
|
-
},
|
|
53
|
-
onMouseUp: () => {
|
|
54
|
-
if (disabled)
|
|
55
|
-
return;
|
|
56
|
-
setState((prev) => ({ ...prev, pressed: false }));
|
|
57
|
-
},
|
|
58
|
-
onFocus: () => {
|
|
6
|
+
const { disabled } = options;
|
|
7
|
+
const [pressed, setPressed] = (0, react_1.useState)(false);
|
|
8
|
+
const state = disabled
|
|
9
|
+
? 'disabled'
|
|
10
|
+
: pressed
|
|
11
|
+
? 'pressed'
|
|
12
|
+
: 'idle';
|
|
13
|
+
const dataAttrs = {
|
|
14
|
+
'data-state': state,
|
|
15
|
+
'data-pressed': pressed ? 'true' : 'false',
|
|
16
|
+
'data-disabled': disabled ? 'true' : 'false',
|
|
17
|
+
};
|
|
18
|
+
const eventHandlers = {
|
|
19
|
+
onPressIn: (e) => {
|
|
59
20
|
if (disabled)
|
|
60
21
|
return;
|
|
61
|
-
|
|
22
|
+
setPressed(true);
|
|
62
23
|
},
|
|
63
|
-
|
|
24
|
+
onPressOut: (e) => {
|
|
64
25
|
if (disabled)
|
|
65
26
|
return;
|
|
66
|
-
|
|
27
|
+
setPressed(false);
|
|
67
28
|
},
|
|
68
|
-
}
|
|
69
|
-
const dataAttrs = toDataAttrs(state);
|
|
29
|
+
};
|
|
70
30
|
return { state, dataAttrs, eventHandlers };
|
|
71
31
|
}
|
|
@@ -2,70 +2,61 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useInteractiveState = useInteractiveState;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
function computeVisualState(state) {
|
|
6
|
-
if (state.disabled)
|
|
7
|
-
return 'disabled';
|
|
8
|
-
if (state.pressed)
|
|
9
|
-
return 'pressed';
|
|
10
|
-
if (state.hovered)
|
|
11
|
-
return 'hovered';
|
|
12
|
-
if (state.focused)
|
|
13
|
-
return 'focused';
|
|
14
|
-
return 'default';
|
|
15
|
-
}
|
|
16
|
-
function toDataAttrs(state) {
|
|
17
|
-
const visual = computeVisualState(state);
|
|
18
|
-
return {
|
|
19
|
-
'data-state': visual,
|
|
20
|
-
'data-hovered': String(state.hovered),
|
|
21
|
-
'data-pressed': String(state.pressed),
|
|
22
|
-
'data-focused': String(state.focused),
|
|
23
|
-
'data-disabled': String(state.disabled),
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
5
|
function useInteractiveState(options = {}) {
|
|
27
|
-
const { disabled
|
|
28
|
-
const [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
disabled
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
6
|
+
const { disabled } = options;
|
|
7
|
+
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
8
|
+
const [pressed, setPressed] = (0, react_1.useState)(false);
|
|
9
|
+
const [focused, setFocused] = (0, react_1.useState)(false);
|
|
10
|
+
const state = disabled
|
|
11
|
+
? 'disabled'
|
|
12
|
+
: pressed
|
|
13
|
+
? 'pressed'
|
|
14
|
+
: hovered
|
|
15
|
+
? 'hovered'
|
|
16
|
+
: focused
|
|
17
|
+
? 'focused'
|
|
18
|
+
: 'idle';
|
|
19
|
+
const dataAttrs = {
|
|
20
|
+
'data-state': state,
|
|
21
|
+
'data-hovered': hovered ? 'true' : 'false',
|
|
22
|
+
'data-pressed': pressed ? 'true' : 'false',
|
|
23
|
+
'data-focused': focused ? 'true' : 'false',
|
|
24
|
+
'data-disabled': disabled ? 'true' : 'false',
|
|
25
|
+
};
|
|
26
|
+
const eventHandlers = {
|
|
38
27
|
onMouseEnter: () => {
|
|
39
28
|
if (disabled)
|
|
40
29
|
return;
|
|
41
|
-
|
|
30
|
+
setHovered(true);
|
|
42
31
|
},
|
|
43
32
|
onMouseLeave: () => {
|
|
44
33
|
if (disabled)
|
|
45
34
|
return;
|
|
46
|
-
|
|
35
|
+
setHovered(false);
|
|
36
|
+
setPressed(false);
|
|
47
37
|
},
|
|
48
|
-
onMouseDown: () => {
|
|
49
|
-
if (disabled)
|
|
38
|
+
onMouseDown: (e) => {
|
|
39
|
+
if (disabled || e.button !== 0)
|
|
50
40
|
return;
|
|
51
|
-
|
|
41
|
+
setPressed(true);
|
|
52
42
|
},
|
|
53
43
|
onMouseUp: () => {
|
|
54
44
|
if (disabled)
|
|
55
45
|
return;
|
|
56
|
-
|
|
46
|
+
setPressed(false);
|
|
57
47
|
},
|
|
58
48
|
onFocus: () => {
|
|
59
49
|
if (disabled)
|
|
60
50
|
return;
|
|
61
|
-
|
|
51
|
+
setFocused(true);
|
|
62
52
|
},
|
|
63
53
|
onBlur: () => {
|
|
64
54
|
if (disabled)
|
|
65
55
|
return;
|
|
66
|
-
|
|
56
|
+
setFocused(false);
|
|
57
|
+
setPressed(false);
|
|
58
|
+
setHovered(false);
|
|
67
59
|
},
|
|
68
|
-
}
|
|
69
|
-
const dataAttrs = toDataAttrs(state);
|
|
60
|
+
};
|
|
70
61
|
return { state, dataAttrs, eventHandlers };
|
|
71
62
|
}
|
|
@@ -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;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Pressable
|
|
2
|
+
import { Pressable } from 'react-native';
|
|
3
3
|
import { useAction, useCn } from '../../hooks/index.native';
|
|
4
|
-
|
|
4
|
+
import { E } from '../e/index.native';
|
|
5
|
+
export function A({ className, children, onPress, onClick, disabled, ref, style, ...rest }) {
|
|
5
6
|
const cn = useCn();
|
|
6
7
|
const { onAction } = useAction({
|
|
7
8
|
onClick,
|
|
8
9
|
onPress,
|
|
9
10
|
});
|
|
10
|
-
return (_jsx(Pressable, { ref: ref, onPress: onAction, disabled: disabled,
|
|
11
|
+
return (_jsx(Pressable, { ref: ref, onPress: onAction, disabled: disabled, children: _jsx(E, { className: cn(disabled && 'opacity-60', className), style: style, ...rest, children: children }) }));
|
|
11
12
|
}
|
|
12
13
|
export const Action = A;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useAction, useCn } from '../../hooks/index.web';
|
|
3
|
-
export function A({ className, children, onPress, onClick, disabled, ref, ...rest }) {
|
|
3
|
+
export function A({ className, children, onPress, onClick, disabled, ref, style, ...rest }) {
|
|
4
4
|
const cn = useCn();
|
|
5
5
|
const { onAction } = useAction({
|
|
6
6
|
onClick,
|
|
7
7
|
onPress,
|
|
8
8
|
});
|
|
9
|
-
return (_jsx("button", { ref: ref, type: "button", disabled: disabled, className: cn('cursor-pointer', disabled && 'opacity-60', className), onClick: onAction, ...rest, children: children }));
|
|
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 }));
|
|
10
10
|
}
|
|
11
11
|
export const Action = A;
|
|
@@ -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',
|
|
5
|
+
export function D({ open, onOpenChange, placement = 'center', backdropClassName, backdropStyle, containerClassName, containerStyle, contentClassName, contentStyle, children, ref, ...rest }) {
|
|
6
6
|
const cn = useCn();
|
|
7
7
|
const placementClasses = {
|
|
8
8
|
center: 'items-center justify-center',
|
|
@@ -12,13 +12,13 @@ export function D({ open, onOpenChange, placement = 'center', className, backdro
|
|
|
12
12
|
right: 'items-stretch justify-end',
|
|
13
13
|
};
|
|
14
14
|
const containerClasses = cn('flex-1 bg-black/40 flex', placementClasses[placement], containerClassName, backdropClassName);
|
|
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' : '',
|
|
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
18
|
if (typeof rest.onRequestClose === 'function') {
|
|
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, ...backdropStyle }, 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',
|
|
5
|
+
export function D({ open, onOpenChange, placement = 'center', backdropClassName, backdropStyle, containerClassName, containerStyle, contentClassName, contentStyle, closeOnBackdropClick = true, children, ref, ...rest }) {
|
|
6
6
|
const cn = useCn();
|
|
7
7
|
if (typeof document === 'undefined')
|
|
8
8
|
return null;
|
|
@@ -23,7 +23,12 @@ export function D({ open, onOpenChange, placement = 'center', className, backdro
|
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
const backdropClasses = cn('fixed inset-0 z-50 flex bg-black/40', placementClasses[placement], containerClassName, backdropClassName);
|
|
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' : '',
|
|
27
|
-
return createPortal(_jsx(E, { className: backdropClasses, role: "presentation", onClick: handleBackdropClick,
|
|
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
|
+
return createPortal(_jsx(E, { className: backdropClasses, role: "presentation", onClick: handleBackdropClick, style: {
|
|
28
|
+
...containerStyle,
|
|
29
|
+
...backdropStyle,
|
|
30
|
+
}, children: _jsx("div", { ref: ref,
|
|
31
|
+
// biome-ignore lint/a11y/useSemanticElements: <explanation>
|
|
32
|
+
role: "dialog", "aria-modal": "true", className: contentClasses, style: contentStyle, ...rest, children: children }) }), document.body);
|
|
28
33
|
}
|
|
29
34
|
export const Dialog = D;
|
|
@@ -1,16 +1,19 @@
|
|
|
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';
|
|
4
|
-
|
|
3
|
+
import { useAction, useCn, useOnHoverOrPress } from '../../hooks/index.native';
|
|
4
|
+
import { T } from '../t/index.native';
|
|
5
|
+
export function E({ className, children, onIn, onOut, onClick, onPress, ref, style, ...rest }) {
|
|
5
6
|
const cn = useCn();
|
|
6
7
|
const { onAction } = useAction({
|
|
7
8
|
onClick,
|
|
8
9
|
onPress,
|
|
9
10
|
});
|
|
11
|
+
const { onPress: onHoverOrPress } = useOnHoverOrPress({ onIn, onOut });
|
|
10
12
|
const handleOnPress = () => {
|
|
11
13
|
onAction();
|
|
14
|
+
onHoverOrPress();
|
|
12
15
|
return false;
|
|
13
16
|
};
|
|
14
|
-
return (_jsx(View, { ref: ref, className: cn(className), onStartShouldSetResponder: handleOnPress, ...rest, children: children }));
|
|
17
|
+
return (_jsx(View, { ref: ref, className: cn(className), onStartShouldSetResponder: handleOnPress, style: style, ...rest, children: typeof children === 'string' ? _jsx(T, { children: children }) : children }));
|
|
15
18
|
}
|
|
16
19
|
export const Element = E;
|
|
@@ -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, ...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
|
-
|
|
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;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { TextInput } from 'react-native';
|
|
3
3
|
import { useCn, useOnChange } from '../../hooks/index.native';
|
|
4
4
|
import { useIUtils } from './useIUtils';
|
|
5
|
-
export function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, editable, disabled, ref, ...rest }) {
|
|
5
|
+
export function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, editable, disabled, ref, style, ...rest }) {
|
|
6
6
|
const { treatTypeModeAndKeyboardType } = useIUtils();
|
|
7
7
|
const cn = useCn();
|
|
8
8
|
const { onChange: handleOnChange } = useOnChange({
|
|
@@ -15,12 +15,6 @@ export function I({ className, value, defaultValue, placeholder, onChange, onCha
|
|
|
15
15
|
keyboardType,
|
|
16
16
|
type,
|
|
17
17
|
});
|
|
18
|
-
|
|
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, ...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;
|
|
@@ -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, defaultValue: defaultValue, placeholder: placeholder, onChange: handleOnChange, disabled: effectiveDisabled, style: style, ...rest }));
|
|
18
18
|
}
|
|
19
19
|
export const Input = I;
|