@react-xp/aeiou 0.1.0-beta.13 → 0.1.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/a/a.native.js +6 -4
- package/dist/cjs/components/a/a.web.js +6 -4
- package/dist/cjs/components/d/d.native.js +7 -7
- package/dist/cjs/components/d/d.web.js +8 -8
- package/dist/cjs/components/e/e.native.js +7 -5
- package/dist/cjs/components/e/e.web.js +7 -5
- package/dist/cjs/components/i/i.native.js +9 -5
- package/dist/cjs/components/i/i.web.js +9 -5
- package/dist/cjs/components/l/l.web.js +7 -5
- package/dist/cjs/components/o/o.native.js +4 -4
- package/dist/cjs/components/o/o.web.js +7 -4
- package/dist/cjs/components/p/p.native.js +4 -4
- package/dist/cjs/components/p/p.web.js +7 -4
- package/dist/cjs/components/s/s.native.js +4 -4
- package/dist/cjs/components/t/t.native.js +7 -5
- package/dist/cjs/components/t/t.web.js +7 -5
- package/dist/cjs/hooks/index.js +0 -1
- package/dist/cjs/hooks/index.native.js +2 -0
- package/dist/cjs/hooks/index.web.js +2 -0
- package/dist/cjs/hooks/useInteractiveHandlers/useInteractiveHandlers.native.js +43 -0
- package/dist/cjs/hooks/useInteractiveHandlers/useInteractiveHandlers.web.js +45 -0
- package/dist/cjs/hooks/useInteractiveState/useInteractiveState.native.js +16 -38
- package/dist/cjs/hooks/useInteractiveState/useInteractiveState.web.js +19 -48
- package/dist/cjs/hooks/useStyles/useStyles.helpers.js +35 -0
- package/dist/cjs/hooks/useStyles/useStyles.native.js +42 -0
- package/dist/cjs/hooks/useStyles/useStyles.web.js +71 -0
- package/dist/esm/components/a/a.native.js +6 -4
- package/dist/esm/components/a/a.web.js +6 -4
- package/dist/esm/components/d/d.native.js +5 -5
- package/dist/esm/components/d/d.web.js +5 -5
- package/dist/esm/components/e/e.native.js +6 -4
- package/dist/esm/components/e/e.web.js +6 -4
- package/dist/esm/components/i/i.native.js +7 -3
- package/dist/esm/components/i/i.web.js +7 -3
- package/dist/esm/components/l/l.web.js +6 -4
- package/dist/esm/components/o/o.native.js +3 -3
- package/dist/esm/components/o/o.web.js +6 -3
- package/dist/esm/components/p/p.native.js +3 -3
- package/dist/esm/components/p/p.web.js +6 -3
- package/dist/esm/components/s/s.native.js +3 -3
- package/dist/esm/components/t/t.native.js +6 -4
- package/dist/esm/components/t/t.web.js +6 -4
- package/dist/esm/hooks/index.js +0 -1
- package/dist/esm/hooks/index.native.js +2 -0
- package/dist/esm/hooks/index.web.js +2 -0
- package/dist/esm/hooks/useInteractiveHandlers/useInteractiveHandlers.native.js +40 -0
- package/dist/esm/hooks/useInteractiveHandlers/useInteractiveHandlers.web.js +42 -0
- package/dist/esm/hooks/useInteractiveState/useInteractiveState.native.js +16 -38
- package/dist/esm/hooks/useInteractiveState/useInteractiveState.web.js +19 -48
- package/dist/esm/hooks/useStyles/useStyles.helpers.js +29 -0
- package/dist/esm/hooks/useStyles/useStyles.native.js +38 -0
- package/dist/esm/hooks/useStyles/useStyles.web.js +66 -0
- package/dist/native/cjs/components/a/a.native.js +6 -4
- package/dist/native/cjs/components/a/a.web.js +6 -4
- package/dist/native/cjs/components/d/d.native.js +7 -7
- package/dist/native/cjs/components/d/d.web.js +8 -8
- package/dist/native/cjs/components/e/e.native.js +7 -5
- package/dist/native/cjs/components/e/e.web.js +7 -5
- package/dist/native/cjs/components/i/i.native.js +9 -5
- package/dist/native/cjs/components/i/i.web.js +9 -5
- package/dist/native/cjs/components/l/l.web.js +7 -5
- package/dist/native/cjs/components/o/o.native.js +4 -4
- package/dist/native/cjs/components/o/o.web.js +7 -4
- package/dist/native/cjs/components/p/p.native.js +4 -4
- package/dist/native/cjs/components/p/p.web.js +7 -4
- package/dist/native/cjs/components/s/s.native.js +4 -4
- package/dist/native/cjs/components/t/t.native.js +7 -5
- package/dist/native/cjs/components/t/t.web.js +7 -5
- package/dist/native/cjs/hooks/index.js +0 -1
- package/dist/native/cjs/hooks/index.native.js +2 -0
- package/dist/native/cjs/hooks/index.web.js +2 -0
- package/dist/native/cjs/hooks/useInteractiveHandlers/useInteractiveHandlers.native.js +43 -0
- package/dist/native/cjs/hooks/useInteractiveHandlers/useInteractiveHandlers.web.js +45 -0
- package/dist/native/cjs/hooks/useInteractiveState/useInteractiveState.native.js +16 -38
- package/dist/native/cjs/hooks/useInteractiveState/useInteractiveState.web.js +19 -48
- package/dist/native/cjs/hooks/useStyles/useStyles.helpers.js +35 -0
- package/dist/native/cjs/hooks/useStyles/useStyles.native.js +42 -0
- package/dist/native/cjs/hooks/useStyles/useStyles.web.js +71 -0
- package/dist/native/esm/components/a/a.native.js +6 -4
- package/dist/native/esm/components/a/a.web.js +6 -4
- package/dist/native/esm/components/d/d.native.js +5 -5
- package/dist/native/esm/components/d/d.web.js +5 -5
- package/dist/native/esm/components/e/e.native.js +6 -4
- package/dist/native/esm/components/e/e.web.js +6 -4
- package/dist/native/esm/components/i/i.native.js +7 -3
- package/dist/native/esm/components/i/i.web.js +7 -3
- package/dist/native/esm/components/l/l.web.js +6 -4
- package/dist/native/esm/components/o/o.native.js +3 -3
- package/dist/native/esm/components/o/o.web.js +6 -3
- package/dist/native/esm/components/p/p.native.js +3 -3
- package/dist/native/esm/components/p/p.web.js +6 -3
- package/dist/native/esm/components/s/s.native.js +3 -3
- package/dist/native/esm/components/t/t.native.js +6 -4
- package/dist/native/esm/components/t/t.web.js +6 -4
- package/dist/native/esm/hooks/index.js +0 -1
- package/dist/native/esm/hooks/index.native.js +2 -0
- package/dist/native/esm/hooks/index.web.js +2 -0
- package/dist/native/esm/hooks/useInteractiveHandlers/useInteractiveHandlers.native.js +40 -0
- package/dist/native/esm/hooks/useInteractiveHandlers/useInteractiveHandlers.web.js +42 -0
- package/dist/native/esm/hooks/useInteractiveState/useInteractiveState.native.js +16 -38
- package/dist/native/esm/hooks/useInteractiveState/useInteractiveState.web.js +19 -48
- package/dist/native/esm/hooks/useStyles/useStyles.helpers.js +29 -0
- package/dist/native/esm/hooks/useStyles/useStyles.native.js +38 -0
- package/dist/native/esm/hooks/useStyles/useStyles.web.js +66 -0
- package/dist/native/tsconfig.native.cjs.tsbuildinfo +1 -1
- package/dist/native/tsconfig.native.esm.tsbuildinfo +1 -1
- 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/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.native.d.ts +1 -1
- package/dist/types/components/o/o.native.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.native.d.ts +1 -1
- package/dist/types/components/p/p.native.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/components/s/s.native.d.ts +1 -1
- package/dist/types/components/s/s.native.d.ts.map +1 -1
- package/dist/types/components/t/t.native.d.ts +1 -1
- package/dist/types/components/t/t.native.d.ts.map +1 -1
- package/dist/types/components/t/t.web.d.ts +1 -1
- package/dist/types/components/t/t.web.d.ts.map +1 -1
- package/dist/types/hooks/index.d.ts +0 -1
- package/dist/types/hooks/index.d.ts.map +1 -1
- package/dist/types/hooks/index.native.d.ts +2 -0
- package/dist/types/hooks/index.native.d.ts.map +1 -1
- package/dist/types/hooks/index.web.d.ts +2 -0
- package/dist/types/hooks/index.web.d.ts.map +1 -1
- package/dist/types/hooks/useInteractiveHandlers/useInteractiveHandlers.native.d.ts +11 -0
- package/dist/types/hooks/useInteractiveHandlers/useInteractiveHandlers.native.d.ts.map +1 -0
- package/dist/types/hooks/useInteractiveHandlers/useInteractiveHandlers.web.d.ts +12 -0
- package/dist/types/hooks/useInteractiveHandlers/useInteractiveHandlers.web.d.ts.map +1 -0
- package/dist/types/hooks/useInteractiveState/useInteractiveState.native.d.ts +5 -7
- package/dist/types/hooks/useInteractiveState/useInteractiveState.native.d.ts.map +1 -1
- package/dist/types/hooks/useInteractiveState/useInteractiveState.web.d.ts +5 -7
- package/dist/types/hooks/useInteractiveState/useInteractiveState.web.d.ts.map +1 -1
- package/dist/types/hooks/useStyles/useStyles.helpers.d.ts +171 -0
- package/dist/types/hooks/useStyles/useStyles.helpers.d.ts.map +1 -0
- package/dist/types/hooks/useStyles/useStyles.native.d.ts +15 -0
- package/dist/types/hooks/useStyles/useStyles.native.d.ts.map +1 -0
- package/dist/types/hooks/useStyles/useStyles.types.d.ts +6 -0
- package/dist/types/hooks/useStyles/useStyles.types.d.ts.map +1 -0
- package/dist/types/hooks/useStyles/useStyles.web.d.ts +11 -0
- package/dist/types/hooks/useStyles/useStyles.web.d.ts.map +1 -0
- package/dist/types/types/base.d.ts +28 -6
- package/dist/types/types/base.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/types/hooks/useInteractiveState/useInteractiveState.types.d.ts +0 -18
- package/dist/types/hooks/useInteractiveState/useInteractiveState.types.d.ts.map +0 -1
- /package/dist/cjs/hooks/{useInteractiveState/useInteractiveState.types.js → useStyles/useStyles.types.js} +0 -0
- /package/dist/esm/hooks/{useInteractiveState/useInteractiveState.types.js → useStyles/useStyles.types.js} +0 -0
- /package/dist/native/cjs/hooks/{useInteractiveState/useInteractiveState.types.js → useStyles/useStyles.types.js} +0 -0
- /package/dist/native/esm/hooks/{useInteractiveState/useInteractiveState.types.js → useStyles/useStyles.types.js} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
2
|
import { Modal } from 'react-native';
|
|
3
|
-
import { useCn } from '../../hooks/
|
|
3
|
+
import { useCn } from '../../hooks/useCn';
|
|
4
4
|
import { E } from '../e/index.native';
|
|
5
|
-
export function D({ open, onOpenChange, placement = 'center', backdropClassName, backdropStyle, containerClassName, containerStyle, contentClassName, contentStyle, children, ref, ...
|
|
5
|
+
export function D({ open, onOpenChange, placement = 'center', backdropClassName, backdropStyle, containerClassName, containerStyle, contentClassName, contentStyle, children, ref, ...restProps }) {
|
|
6
6
|
const cn = useCn();
|
|
7
7
|
const placementClasses = {
|
|
8
8
|
center: 'items-center justify-center',
|
|
@@ -15,10 +15,10 @@ export function D({ open, onOpenChange, placement = 'center', backdropClassName,
|
|
|
15
15
|
const contentClasses = cn('bg-background p-4 rounded-lg shadow-lg max-h-[90vh] w-full max-w-lg', placement === 'left' || placement === 'right' ? 'h-full max-h-none' : '', placement === 'bottom' || placement === 'top' ? 'max-w-none' : '', contentClassName);
|
|
16
16
|
const handleRequestClose = (e) => {
|
|
17
17
|
onOpenChange?.(false);
|
|
18
|
-
if (typeof
|
|
19
|
-
|
|
18
|
+
if (typeof restProps.onRequestClose === 'function') {
|
|
19
|
+
restProps.onRequestClose?.(e);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
return (_jsx(Modal, { visible: open, animationType: "slide", transparent: true, onRequestClose: handleRequestClose, ...
|
|
22
|
+
return (_jsx(Modal, { visible: open, animationType: "slide", transparent: true, onRequestClose: handleRequestClose, ...restProps, children: _jsx(E, { className: containerClasses, style: { ...containerStyle, ...backdropStyle }, children: _jsx(E, { ref: ref, className: contentClasses, style: contentStyle, children: children }) }) }));
|
|
23
23
|
}
|
|
24
24
|
export const Dialog = D;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
|
-
import { useCn } from '../../hooks/
|
|
3
|
+
import { useCn } from '../../hooks/useCn';
|
|
4
4
|
import { E } from '../e/index.web';
|
|
5
|
-
export function D({ open, onOpenChange, placement = 'center', backdropClassName, backdropStyle, containerClassName, containerStyle, contentClassName, contentStyle, closeOnBackdropClick = true, children, ref, ...
|
|
5
|
+
export function D({ open, onOpenChange, placement = 'center', backdropClassName, backdropStyle, containerClassName, containerStyle, contentClassName, contentStyle, closeOnBackdropClick = true, children, ref, ...restProps }) {
|
|
6
6
|
const cn = useCn();
|
|
7
7
|
if (typeof document === 'undefined')
|
|
8
8
|
return null;
|
|
@@ -25,10 +25,10 @@ export function D({ open, onOpenChange, placement = 'center', backdropClassName,
|
|
|
25
25
|
const backdropClasses = cn('fixed inset-0 z-50 flex bg-black/40', placementClasses[placement], containerClassName, backdropClassName);
|
|
26
26
|
const contentClasses = cn('relative max-h-[90vh] w-full max-w-lg overflow-auto rounded-lg bg-background p-4 shadow-lg', placement === 'left' || placement === 'right' ? 'h-full max-h-none' : '', placement === 'bottom' || placement === 'top' ? 'max-w-none' : '', contentClassName);
|
|
27
27
|
return createPortal(_jsx(E, { className: backdropClasses, role: "presentation", onClick: handleBackdropClick, style: {
|
|
28
|
-
...containerStyle,
|
|
29
|
-
...backdropStyle,
|
|
28
|
+
...(containerStyle || {}),
|
|
29
|
+
...(backdropStyle || {}),
|
|
30
30
|
}, children: _jsx("div", { ref: ref,
|
|
31
31
|
// biome-ignore lint/a11y/useSemanticElements: <explanation>
|
|
32
|
-
role: "dialog", "aria-modal": "true", className: contentClasses, style: contentStyle, ...
|
|
32
|
+
role: "dialog", "aria-modal": "true", className: contentClasses, style: contentStyle, ...restProps, children: children }) }), document.body);
|
|
33
33
|
}
|
|
34
34
|
export const Dialog = D;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import { useCn
|
|
3
|
+
import { useCn } from '../../hooks/useCn';
|
|
4
|
+
import { useInteractiveHandlers, useStyles } from '../../index.native';
|
|
4
5
|
import { T } from '../t/index.native';
|
|
5
|
-
export function E({ className, children, ref, style, ...
|
|
6
|
+
export function E({ className, children, ref, style, ...restProps }) {
|
|
6
7
|
const cn = useCn();
|
|
7
|
-
const {
|
|
8
|
-
|
|
8
|
+
const { getStyles } = useStyles();
|
|
9
|
+
const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
|
|
10
|
+
return (_jsx(View, { ref: ref, className: cn(className), ...eventHandlers, ...getStyles({ disabled, style }), children: typeof children === 'string' ? _jsx(T, { children: children }) : children }));
|
|
9
11
|
}
|
|
10
12
|
export const Element = E;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
-
import { useCn
|
|
3
|
-
|
|
2
|
+
import { useCn } from '../../hooks/useCn';
|
|
3
|
+
import { useInteractiveHandlers, useStyles } from '../../index.web';
|
|
4
|
+
export function E({ className, children, ref, role, style, ...restProps }) {
|
|
4
5
|
const cn = useCn();
|
|
5
|
-
const { eventHandlers } =
|
|
6
|
-
|
|
6
|
+
const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
|
|
7
|
+
const { getStyles } = useStyles();
|
|
8
|
+
return (_jsx("div", { ref: ref, className: cn(className), role: role, ...restProps, ...eventHandlers, ...getStyles({ disabled, style }), children: children }));
|
|
7
9
|
}
|
|
8
10
|
export const Element = E;
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
2
|
import { TextInput } from 'react-native';
|
|
3
|
-
import { useCn
|
|
3
|
+
import { useCn } from '../../hooks/useCn';
|
|
4
|
+
import { useOnChange } from '../../hooks/useOnChange';
|
|
5
|
+
import { useInteractiveHandlers, useStyles } from '../../index.native';
|
|
4
6
|
import { useIUtils } from './useIUtils';
|
|
5
|
-
export function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, editable,
|
|
7
|
+
export function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, editable, ref, name, style, ...restProps }) {
|
|
6
8
|
const { treatTypeModeAndKeyboardType } = useIUtils();
|
|
7
9
|
const cn = useCn();
|
|
8
10
|
const { onChange: handleOnChange } = useOnChange({
|
|
9
11
|
onChange,
|
|
10
12
|
onChangeValue,
|
|
11
13
|
});
|
|
14
|
+
const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
|
|
15
|
+
const { getStyles } = useStyles();
|
|
12
16
|
const effectiveEditable = editable ?? !disabled;
|
|
13
17
|
const { masterInputType, masterInputKeyboardType } = treatTypeModeAndKeyboardType({
|
|
14
18
|
inputMode,
|
|
15
19
|
keyboardType,
|
|
16
20
|
type,
|
|
17
21
|
});
|
|
18
|
-
return (_jsx(TextInput, { ref: ref, className: cn(!effectiveEditable && 'opacity-60', className), value: value?.toString(), defaultValue: defaultValue?.toString(), placeholder: placeholder, onChange: handleOnChange, secureTextEntry: masterInputType === 'password', keyboardType: masterInputKeyboardType, editable: effectiveEditable,
|
|
22
|
+
return (_jsx(TextInput, { ref: ref, className: cn(!effectiveEditable && 'opacity-60', className), value: value?.toString(), defaultValue: defaultValue?.toString(), placeholder: placeholder, onChange: handleOnChange, secureTextEntry: masterInputType === 'password', keyboardType: masterInputKeyboardType, editable: effectiveEditable, ...restProps, ...eventHandlers, ...getStyles({ disabled, style }) }));
|
|
19
23
|
}
|
|
20
24
|
export const Input = I;
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
-
import { useCn
|
|
2
|
+
import { useCn } from '../../hooks/useCn';
|
|
3
|
+
import { useOnChange } from '../../hooks/useOnChange';
|
|
4
|
+
import { useInteractiveHandlers, useStyles } from '../../index.web';
|
|
3
5
|
import { useIUtils } from './useIUtils';
|
|
4
|
-
export function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType,
|
|
6
|
+
export function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, editable, ref, style, ...restProps }) {
|
|
5
7
|
const { treatTypeModeAndKeyboardType } = useIUtils();
|
|
6
8
|
const cn = useCn();
|
|
7
9
|
const { onChange: handleOnChange } = useOnChange({
|
|
8
10
|
onChange,
|
|
9
11
|
onChangeValue,
|
|
10
12
|
});
|
|
13
|
+
const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
|
|
14
|
+
const { getStyles } = useStyles();
|
|
11
15
|
const effectiveDisabled = disabled || editable === false;
|
|
12
16
|
const { masterInputType, masterInputMode } = treatTypeModeAndKeyboardType({
|
|
13
17
|
inputMode,
|
|
14
18
|
keyboardType,
|
|
15
19
|
type,
|
|
16
20
|
});
|
|
17
|
-
return (_jsx("input", { ref: ref, type: masterInputType, inputMode: masterInputMode, className: cn('outline-none', effectiveDisabled && 'opacity-60 cursor-not-allowed', className), value: value?.toString(), defaultValue: defaultValue?.toString(), placeholder: placeholder, onChange: handleOnChange, disabled: effectiveDisabled,
|
|
21
|
+
return (_jsx("input", { ref: ref, type: masterInputType, inputMode: masterInputMode, className: cn('outline-none', effectiveDisabled && 'opacity-60 cursor-not-allowed', className), value: value?.toString(), defaultValue: defaultValue?.toString(), placeholder: placeholder, onChange: handleOnChange, disabled: effectiveDisabled, ...restProps, ...eventHandlers, ...getStyles({ disabled, style }) }));
|
|
18
22
|
}
|
|
19
23
|
export const Input = I;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
-
import { useCn
|
|
3
|
-
|
|
2
|
+
import { useCn } from '../../hooks/useCn';
|
|
3
|
+
import { useInteractiveHandlers, useStyles } from '../../index.web';
|
|
4
|
+
export function L({ className, children, to, href, preventDefault, ref, style, ...restProps }) {
|
|
4
5
|
const cn = useCn();
|
|
5
|
-
const { eventHandlers } =
|
|
6
|
+
const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
|
|
7
|
+
const { getStyles } = useStyles();
|
|
6
8
|
const resolvedHref = href ?? to ?? '#';
|
|
7
|
-
return (_jsx("a", { ref: ref, href: resolvedHref, className: cn('cursor-pointer', className),
|
|
9
|
+
return (_jsx("a", { ref: ref, href: resolvedHref, className: cn('cursor-pointer', className), ...restProps, ...eventHandlers, ...getStyles({ disabled, style }), children: children }));
|
|
8
10
|
}
|
|
9
11
|
export const Link = L;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
2
|
import { ScrollView } from 'react-native';
|
|
3
|
-
import { useCn } from '../../hooks/
|
|
4
|
-
export function O({ className, children, horizontal, ref, ...
|
|
3
|
+
import { useCn } from '../../hooks/useCn';
|
|
4
|
+
export function O({ className, children, horizontal, ref, ...restProps }) {
|
|
5
5
|
const cn = useCn();
|
|
6
|
-
return (_jsx(ScrollView, { ref: ref, className: cn(className), horizontal: horizontal, ...
|
|
6
|
+
return (_jsx(ScrollView, { ref: ref, className: cn(className), horizontal: horizontal, ...restProps, children: children }));
|
|
7
7
|
}
|
|
8
8
|
export const Overflow = O;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
-
import { useCn } from '../../hooks/
|
|
3
|
-
|
|
2
|
+
import { useCn } from '../../hooks/useCn';
|
|
3
|
+
import { useInteractiveHandlers, useStyles } from '../../index.web';
|
|
4
|
+
export function O({ className, children, horizontal, ref, style, ...restProps }) {
|
|
4
5
|
const cn = useCn();
|
|
6
|
+
const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
|
|
7
|
+
const { getStyles } = useStyles();
|
|
5
8
|
const overflowClass = horizontal ? 'overflow-x-auto' : 'overflow-y-auto';
|
|
6
|
-
return (_jsx("div", { ref: ref, className: cn(overflowClass, className),
|
|
9
|
+
return (_jsx("div", { ref: ref, className: cn(overflowClass, className), ...restProps, ...eventHandlers, ...getStyles({ disabled, style }), children: children }));
|
|
7
10
|
}
|
|
8
11
|
export const Overflow = O;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
2
|
import { Image } from 'react-native';
|
|
3
|
-
import { useCn } from '../../hooks/
|
|
4
|
-
export function P({ className, src, source, ref, ...
|
|
3
|
+
import { useCn } from '../../hooks/useCn';
|
|
4
|
+
export function P({ className, src, source, ref, ...restProps }) {
|
|
5
5
|
const cn = useCn();
|
|
6
6
|
const finalSource = src != null ? { uri: src } : source;
|
|
7
|
-
return (_jsx(Image, { ref: ref, className: cn(className), source: finalSource, ...
|
|
7
|
+
return (_jsx(Image, { ref: ref, className: cn(className), source: finalSource, ...restProps }));
|
|
8
8
|
}
|
|
9
9
|
export const Picture = P;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
-
import { useCn } from '../../hooks/
|
|
3
|
-
|
|
2
|
+
import { useCn } from '../../hooks/useCn';
|
|
3
|
+
import { useInteractiveHandlers, useStyles } from '../../index.web';
|
|
4
|
+
export function P({ alt, className, ref, style, source, src, ...restProps }) {
|
|
4
5
|
const cn = useCn();
|
|
6
|
+
const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
|
|
7
|
+
const { getStyles } = useStyles();
|
|
5
8
|
return (
|
|
6
9
|
// biome-ignore lint/a11y/useAltText: <explanation>
|
|
7
|
-
_jsx("img", { alt: alt, "aria-label": alt, ref: ref, className: cn('object-cover', className),
|
|
10
|
+
_jsx("img", { alt: alt, "aria-label": alt, ref: ref, className: cn('object-cover', className), src: src ?? source, ...restProps, ...eventHandlers, ...getStyles({ disabled, style }) }));
|
|
8
11
|
}
|
|
9
12
|
export const Picture = P;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
2
|
import { SafeAreaView, } from 'react-native-safe-area-context';
|
|
3
|
-
import { useCn } from '../../hooks/
|
|
4
|
-
export function S({ className, children, ref, ...
|
|
3
|
+
import { useCn } from '../../hooks/useCn';
|
|
4
|
+
export function S({ className, children, ref, ...restProps }) {
|
|
5
5
|
const cn = useCn();
|
|
6
|
-
return (_jsx(SafeAreaView, { ref: ref, className: cn(className), ...
|
|
6
|
+
return (_jsx(SafeAreaView, { ref: ref, className: cn(className), ...restProps, children: children }));
|
|
7
7
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
2
|
import { Text as RNText } from 'react-native';
|
|
3
|
-
import { useCn
|
|
4
|
-
|
|
3
|
+
import { useCn } from '../../hooks/useCn';
|
|
4
|
+
import { useInteractiveHandlers, useStyles } from '../../index.native';
|
|
5
|
+
export function T({ className, children, ref, style, ...restProps }) {
|
|
5
6
|
const cn = useCn();
|
|
6
|
-
const { eventHandlers } =
|
|
7
|
-
|
|
7
|
+
const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
|
|
8
|
+
const { getStyles } = useStyles();
|
|
9
|
+
return (_jsx(RNText, { ref: ref, className: cn('leading-relaxed', className), ...restProps, ...eventHandlers, ...getStyles({ disabled, style }), children: children }));
|
|
8
10
|
}
|
|
9
11
|
export const Text = T;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
-
import { useCn
|
|
3
|
-
|
|
2
|
+
import { useCn } from '../../hooks/useCn';
|
|
3
|
+
import { useInteractiveHandlers, useStyles } from '../../index.web';
|
|
4
|
+
export function T({ className, children, as = 'span', ref, style, ...restProps }) {
|
|
4
5
|
const cn = useCn();
|
|
5
|
-
const { eventHandlers } =
|
|
6
|
+
const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
|
|
7
|
+
const { getStyles } = useStyles();
|
|
6
8
|
const Comp = as;
|
|
7
|
-
return (_jsx(Comp, { ref: ref, className: cn('leading-relaxed', className), ...
|
|
9
|
+
return (_jsx(Comp, { ref: ref, className: cn('leading-relaxed', className), ...restProps, ...eventHandlers, ...getStyles({ disabled, style }), children: children }));
|
|
8
10
|
}
|
|
9
11
|
export const Text = T;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export * from './useCn';
|
|
2
|
+
export * from './useInteractiveHandlers/useInteractiveHandlers.native';
|
|
2
3
|
export * from './useInteractiveState/useInteractiveState.native';
|
|
3
4
|
export * from './useOnChange';
|
|
4
5
|
export * from './useProps';
|
|
6
|
+
export * from './useStyles/useStyles.native';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
export function useInteractiveHandlers({ disabled, onBlur, onClick, onFocus, onPress, onIn, onOut, } = {}) {
|
|
3
|
+
const offOn = useRef('off');
|
|
4
|
+
const eventHandlers = {
|
|
5
|
+
onBlur: (e) => {
|
|
6
|
+
if (disabled) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
onBlur?.(e);
|
|
10
|
+
},
|
|
11
|
+
onFocus: (e) => {
|
|
12
|
+
if (disabled) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
onFocus?.(e);
|
|
16
|
+
},
|
|
17
|
+
onPress: (e) => {
|
|
18
|
+
if (disabled) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if ((onIn || onOut) && offOn.current === 'off') {
|
|
22
|
+
offOn.current = 'on';
|
|
23
|
+
onIn?.(e);
|
|
24
|
+
}
|
|
25
|
+
if ((onIn || onOut) && offOn.current === 'on') {
|
|
26
|
+
offOn.current = 'off';
|
|
27
|
+
onOut?.(e);
|
|
28
|
+
}
|
|
29
|
+
if (onPress) {
|
|
30
|
+
onPress?.(e);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
onClick?.(e);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
disabled,
|
|
38
|
+
eventHandlers,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export function useInteractiveHandlers({ disabled, onBlur, onClick, onFocus, onPress, onIn, onOut, } = {}) {
|
|
2
|
+
const eventHandlers = {
|
|
3
|
+
onBlur: (e) => {
|
|
4
|
+
if (disabled) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
onBlur?.(e);
|
|
8
|
+
},
|
|
9
|
+
onClick: (e) => {
|
|
10
|
+
if (disabled) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (onClick) {
|
|
14
|
+
onClick?.(e);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
onPress?.(e);
|
|
18
|
+
},
|
|
19
|
+
onFocus: (e) => {
|
|
20
|
+
if (disabled) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
onFocus?.(e);
|
|
24
|
+
},
|
|
25
|
+
onMouseEnter: (e) => {
|
|
26
|
+
if (disabled) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
onIn?.(e);
|
|
30
|
+
},
|
|
31
|
+
onMouseLeave: (e) => {
|
|
32
|
+
if (disabled) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
onOut?.(e);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
return {
|
|
39
|
+
disabled,
|
|
40
|
+
eventHandlers,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -1,25 +1,13 @@
|
|
|
1
1
|
import { useRef, useState } from 'react';
|
|
2
|
-
export function useInteractiveState(
|
|
3
|
-
const { disabled, onBlur, onClick, onFocus, onPress, onIn, onOut } = options;
|
|
4
|
-
const [hovered, setHovered] = useState(false);
|
|
5
|
-
const [pressed, setPressed] = useState(false);
|
|
6
|
-
const [focused, setFocused] = useState(false);
|
|
2
|
+
export function useInteractiveState({ disabled, onBlur, onClick, onFocus, onPress, onIn, onOut, } = {}) {
|
|
7
3
|
const offOn = useRef('off');
|
|
8
|
-
const
|
|
9
|
-
? 'disabled'
|
|
10
|
-
: pressed
|
|
11
|
-
? 'pressed'
|
|
12
|
-
: hovered
|
|
13
|
-
? 'hovered'
|
|
14
|
-
: focused
|
|
15
|
-
? 'focused'
|
|
16
|
-
: 'idle';
|
|
4
|
+
const [interactiveState, setInteractiveState] = useState('idle');
|
|
17
5
|
const dataAttrs = {
|
|
18
|
-
'data-state':
|
|
6
|
+
'data-state': interactiveState,
|
|
19
7
|
'data-disabled': disabled ? 'true' : 'false',
|
|
20
|
-
'data-focused': focused ? 'true' : 'false',
|
|
21
|
-
'data-hovered': hovered ? 'true' : 'false',
|
|
22
|
-
'data-pressed': pressed ? 'true' : 'false',
|
|
8
|
+
'data-focused': interactiveState === 'focused' ? 'true' : 'false',
|
|
9
|
+
'data-hovered': interactiveState === 'hovered' ? 'true' : 'false',
|
|
10
|
+
'data-pressed': interactiveState === 'pressed' ? 'true' : 'false',
|
|
23
11
|
};
|
|
24
12
|
const eventHandlers = {
|
|
25
13
|
onBlur: (e) => {
|
|
@@ -27,22 +15,14 @@ export function useInteractiveState(options = {}) {
|
|
|
27
15
|
return;
|
|
28
16
|
}
|
|
29
17
|
onBlur?.(e);
|
|
30
|
-
|
|
31
|
-
setPressed(false);
|
|
18
|
+
setInteractiveState('idle');
|
|
32
19
|
},
|
|
33
20
|
onFocus: (e) => {
|
|
34
21
|
if (disabled) {
|
|
35
22
|
return;
|
|
36
23
|
}
|
|
37
24
|
onFocus?.(e);
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
onIn: (e) => {
|
|
41
|
-
if (disabled) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
console.log('[DEBUG] onIn', typeof onIn, e);
|
|
45
|
-
onIn?.(e);
|
|
25
|
+
setInteractiveState('focused');
|
|
46
26
|
},
|
|
47
27
|
onPress: (e) => {
|
|
48
28
|
if (disabled) {
|
|
@@ -67,22 +47,20 @@ export function useInteractiveState(options = {}) {
|
|
|
67
47
|
return;
|
|
68
48
|
}
|
|
69
49
|
onIn?.(e);
|
|
70
|
-
|
|
50
|
+
setInteractiveState('pressed');
|
|
71
51
|
},
|
|
72
52
|
onPressOut: (e) => {
|
|
73
53
|
if (disabled) {
|
|
74
54
|
return;
|
|
75
55
|
}
|
|
76
56
|
onOut?.(e);
|
|
77
|
-
|
|
78
|
-
},
|
|
79
|
-
onOut: (e) => {
|
|
80
|
-
if (disabled) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
console.log('[DEBUG] onOut', typeof onOut, e);
|
|
84
|
-
onOut?.(e);
|
|
57
|
+
setInteractiveState('idle');
|
|
85
58
|
},
|
|
86
59
|
};
|
|
87
|
-
return {
|
|
60
|
+
return {
|
|
61
|
+
dataAttrs,
|
|
62
|
+
disabled,
|
|
63
|
+
eventHandlers,
|
|
64
|
+
interactiveState,
|
|
65
|
+
};
|
|
88
66
|
}
|
|
@@ -1,41 +1,25 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
export function useInteractiveState(
|
|
3
|
-
const
|
|
4
|
-
const [hovered, setHovered] = useState(false);
|
|
5
|
-
const [pressed, setPressed] = useState(false);
|
|
6
|
-
const [focused, setFocused] = useState(false);
|
|
7
|
-
const state = disabled
|
|
8
|
-
? 'disabled'
|
|
9
|
-
: pressed
|
|
10
|
-
? 'pressed'
|
|
11
|
-
: hovered
|
|
12
|
-
? 'hovered'
|
|
13
|
-
: focused
|
|
14
|
-
? 'focused'
|
|
15
|
-
: 'idle';
|
|
2
|
+
export function useInteractiveState({ disabled, onBlur, onClick, onFocus, onPress, onIn, onOut, } = {}) {
|
|
3
|
+
const [interactiveState, setInteractiveState] = useState('idle');
|
|
16
4
|
const dataAttrs = {
|
|
17
|
-
'data-state':
|
|
5
|
+
'data-state': interactiveState,
|
|
18
6
|
'data-disabled': disabled ? 'true' : 'false',
|
|
19
|
-
'data-focused': focused ? 'true' : 'false',
|
|
20
|
-
'data-hovered': hovered ? 'true' : 'false',
|
|
21
|
-
'data-pressed': pressed ? 'true' : 'false',
|
|
7
|
+
'data-focused': interactiveState === 'focused' ? 'true' : 'false',
|
|
8
|
+
'data-hovered': interactiveState === 'hovered' ? 'true' : 'false',
|
|
9
|
+
'data-pressed': interactiveState === 'pressed' ? 'true' : 'false',
|
|
22
10
|
};
|
|
23
11
|
const eventHandlers = {
|
|
24
12
|
onBlur: (e) => {
|
|
25
13
|
if (disabled) {
|
|
26
14
|
return;
|
|
27
15
|
}
|
|
28
|
-
console.log('[DEBUG] onBlur', typeof onBlur, e);
|
|
29
16
|
onBlur?.(e);
|
|
30
|
-
|
|
31
|
-
setPressed(false);
|
|
32
|
-
setHovered(false);
|
|
17
|
+
setInteractiveState('idle');
|
|
33
18
|
},
|
|
34
19
|
onClick: (e) => {
|
|
35
20
|
if (disabled) {
|
|
36
21
|
return;
|
|
37
22
|
}
|
|
38
|
-
console.log('[DEBUG] onClick', typeof onClick, e);
|
|
39
23
|
if (onClick) {
|
|
40
24
|
onClick?.(e);
|
|
41
25
|
return;
|
|
@@ -46,31 +30,21 @@ export function useInteractiveState(options = {}) {
|
|
|
46
30
|
if (disabled) {
|
|
47
31
|
return;
|
|
48
32
|
}
|
|
49
|
-
console.log('[DEBUG] onFocus', typeof onFocus, e);
|
|
50
33
|
onFocus?.(e);
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
onIn: (e) => {
|
|
54
|
-
if (disabled) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
console.log('[DEBUG] onIn', typeof onIn, e);
|
|
58
|
-
onIn?.(e);
|
|
34
|
+
setInteractiveState('focused');
|
|
59
35
|
},
|
|
60
36
|
onMouseDown: (e) => {
|
|
61
|
-
if (disabled
|
|
37
|
+
if (disabled) {
|
|
62
38
|
return;
|
|
63
39
|
}
|
|
64
|
-
|
|
65
|
-
setPressed(true);
|
|
40
|
+
setInteractiveState('pressed');
|
|
66
41
|
},
|
|
67
42
|
onMouseEnter: (e) => {
|
|
68
43
|
if (disabled) {
|
|
69
44
|
return;
|
|
70
45
|
}
|
|
71
|
-
console.log('[DEBUG] onMouseEnter', typeof onIn, e);
|
|
72
46
|
onIn?.(e);
|
|
73
|
-
|
|
47
|
+
setInteractiveState('hovered');
|
|
74
48
|
},
|
|
75
49
|
onMouseLeave: (e) => {
|
|
76
50
|
if (disabled) {
|
|
@@ -78,23 +52,20 @@ export function useInteractiveState(options = {}) {
|
|
|
78
52
|
}
|
|
79
53
|
console.log('[DEBUG] onMouseLeave', typeof onOut, e);
|
|
80
54
|
onOut?.(e);
|
|
81
|
-
|
|
82
|
-
setPressed(false);
|
|
55
|
+
setInteractiveState('idle');
|
|
83
56
|
},
|
|
84
57
|
onMouseUp: (e) => {
|
|
85
58
|
if (disabled) {
|
|
86
59
|
return;
|
|
87
60
|
}
|
|
88
61
|
console.log('[DEBUG] onMouseUp', e);
|
|
89
|
-
|
|
90
|
-
},
|
|
91
|
-
onOut: (e) => {
|
|
92
|
-
if (disabled) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
console.log('[DEBUG] onOut', typeof onOut, e);
|
|
96
|
-
onOut?.(e);
|
|
62
|
+
setInteractiveState('idle');
|
|
97
63
|
},
|
|
98
64
|
};
|
|
99
|
-
return {
|
|
65
|
+
return {
|
|
66
|
+
dataAttrs,
|
|
67
|
+
disabled,
|
|
68
|
+
eventHandlers,
|
|
69
|
+
interactiveState,
|
|
70
|
+
};
|
|
100
71
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const extractStyles = (style) => {
|
|
2
|
+
const base = { ...style };
|
|
3
|
+
const disabled = style.$disabled || {};
|
|
4
|
+
const focused = style.$focused || {};
|
|
5
|
+
const hovered = style.$hovered || {};
|
|
6
|
+
const pressed = style.$pressed || {};
|
|
7
|
+
base.$disabled = undefined;
|
|
8
|
+
base.$focused = undefined;
|
|
9
|
+
base.$hovered = undefined;
|
|
10
|
+
base.$pressed = undefined;
|
|
11
|
+
return {
|
|
12
|
+
styleBase: base,
|
|
13
|
+
styleDisabled: disabled,
|
|
14
|
+
styleFocused: focused,
|
|
15
|
+
styleHovered: hovered,
|
|
16
|
+
stylePressed: pressed,
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export const toKebab = (s) => s.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
20
|
+
export const toCssDecls = (style) => {
|
|
21
|
+
if (!style) {
|
|
22
|
+
return '';
|
|
23
|
+
}
|
|
24
|
+
// TODO: adiconar os px ou outra medida quando necessario e faça sentido
|
|
25
|
+
return Object.entries(style)
|
|
26
|
+
.filter(([, v]) => v !== undefined && v !== null)
|
|
27
|
+
.map(([k, v]) => `${toKebab(k)}:${typeof v === 'number' ? `${v}` : v};`)
|
|
28
|
+
.join('');
|
|
29
|
+
};
|