@react-xp/aeiou 0.1.0-rc.1 → 1.0.0-beta.1
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 +8 -7
- package/dist/cjs/components/a/a.web.js +7 -7
- package/dist/cjs/components/d/d.native.js +8 -8
- package/dist/cjs/components/d/d.web.js +11 -6
- package/dist/cjs/components/e/e.native.js +8 -12
- package/dist/cjs/components/e/e.web.js +8 -8
- package/dist/cjs/components/i/i.native.js +9 -11
- package/dist/cjs/components/i/i.web.js +9 -5
- package/dist/cjs/components/l/l.web.js +7 -9
- 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 -8
- package/dist/cjs/components/t/t.web.js +7 -8
- package/dist/cjs/components/u/errorBoundary.js +27 -0
- package/dist/cjs/components/u/provider.native.js +3 -2
- package/dist/cjs/components/u/provider.web.js +3 -2
- package/dist/cjs/hooks/index.js +0 -2
- package/dist/cjs/hooks/index.native.js +2 -1
- package/dist/cjs/hooks/index.web.js +2 -1
- 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 +52 -54
- package/dist/cjs/hooks/useInteractiveState/useInteractiveState.web.js +56 -53
- package/dist/cjs/hooks/useOnChange.js +1 -1
- 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 +9 -8
- package/dist/esm/components/a/a.web.js +7 -7
- package/dist/esm/components/d/d.native.js +6 -6
- package/dist/esm/components/d/d.web.js +9 -4
- package/dist/esm/components/e/e.native.js +7 -11
- package/dist/esm/components/e/e.web.js +7 -7
- package/dist/esm/components/i/i.native.js +7 -9
- package/dist/esm/components/i/i.web.js +7 -3
- package/dist/esm/components/l/l.web.js +6 -8
- 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 -7
- package/dist/esm/components/t/t.web.js +6 -7
- package/dist/esm/components/u/errorBoundary.js +23 -0
- package/dist/esm/components/u/provider.native.js +3 -2
- package/dist/esm/components/u/provider.web.js +3 -2
- package/dist/esm/hooks/index.js +0 -2
- package/dist/esm/hooks/index.native.js +2 -1
- package/dist/esm/hooks/index.web.js +2 -1
- 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 +53 -55
- package/dist/esm/hooks/useInteractiveState/useInteractiveState.web.js +57 -54
- package/dist/esm/hooks/useOnChange.js +1 -1
- 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 +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 +16 -0
- package/dist/native/cjs/components/e/e.web.js +15 -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 +28 -0
- package/dist/native/cjs/components/i/i.web.js +27 -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 +15 -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 +15 -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 +16 -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 +15 -0
- package/dist/native/cjs/components/t/t.web.js +15 -0
- package/dist/native/cjs/components/u/context.js +14 -0
- package/dist/native/cjs/components/u/errorBoundary.js +27 -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 +24 -0
- package/dist/native/cjs/components/u/provider.web.js +21 -0
- package/dist/native/cjs/components/u/useUniverse.js +8 -0
- package/dist/native/cjs/hooks/index.js +19 -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/useCn.js +15 -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 +69 -0
- package/dist/native/cjs/hooks/useInteractiveState/useInteractiveState.web.js +74 -0
- package/dist/native/cjs/hooks/useOnChange.js +18 -0
- package/dist/native/cjs/hooks/useProps.js +66 -0
- 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.types.js +2 -0
- package/dist/native/cjs/hooks/useStyles/useStyles.web.js +71 -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 +12 -0
- package/dist/native/esm/components/e/e.web.js +11 -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 +24 -0
- package/dist/native/esm/components/i/i.web.js +23 -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 +11 -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 +11 -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 +12 -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 +11 -0
- package/dist/native/esm/components/t/t.web.js +11 -0
- package/dist/native/esm/components/u/context.js +11 -0
- package/dist/native/esm/components/u/errorBoundary.js +23 -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 +20 -0
- package/dist/native/esm/components/u/provider.web.js +17 -0
- package/dist/native/esm/components/u/useUniverse.js +5 -0
- package/dist/native/esm/hooks/index.js +3 -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/useCn.js +8 -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 +66 -0
- package/dist/native/esm/hooks/useInteractiveState/useInteractiveState.web.js +71 -0
- package/dist/native/esm/hooks/useOnChange.js +14 -0
- package/dist/native/esm/hooks/useProps.js +59 -0
- 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.types.js +1 -0
- package/dist/native/esm/hooks/useStyles/useStyles.web.js +66 -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 +3 -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 +2 -2
- 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 +3 -1
- package/dist/types/components/t/t.web.d.ts.map +1 -1
- package/dist/types/components/u/errorBoundary.d.ts +18 -0
- package/dist/types/components/u/errorBoundary.d.ts.map +1 -0
- package/dist/types/components/u/provider.native.d.ts +1 -1
- package/dist/types/components/u/provider.native.d.ts.map +1 -1
- package/dist/types/components/u/provider.web.d.ts +1 -1
- package/dist/types/components/u/provider.web.d.ts.map +1 -1
- package/dist/types/components/u/types.d.ts +5 -0
- package/dist/types/components/u/types.d.ts.map +1 -1
- package/dist/types/hooks/index.d.ts +0 -2
- package/dist/types/hooks/index.d.ts.map +1 -1
- package/dist/types/hooks/index.native.d.ts +2 -1
- package/dist/types/hooks/index.native.d.ts.map +1 -1
- package/dist/types/hooks/index.web.d.ts +2 -1
- 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 +20 -2
- package/dist/types/hooks/useInteractiveState/useInteractiveState.native.d.ts.map +1 -1
- package/dist/types/hooks/useInteractiveState/useInteractiveState.web.d.ts +21 -2
- package/dist/types/hooks/useInteractiveState/useInteractiveState.web.d.ts.map +1 -1
- package/dist/types/hooks/useOnChange.d.ts +3 -3
- package/dist/types/hooks/useOnChange.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 +56 -13
- package/dist/types/types/base.d.ts.map +1 -1
- package/package.json +5 -6
- package/dist/cjs/hooks/useAction/useAction.native.js +0 -18
- package/dist/cjs/hooks/useAction/useAction.web.js +0 -21
- package/dist/esm/hooks/useAction/useAction.native.js +0 -14
- package/dist/esm/hooks/useAction/useAction.web.js +0 -17
- package/dist/types/hooks/useAction/types.d.ts +0 -7
- package/dist/types/hooks/useAction/types.d.ts.map +0 -1
- package/dist/types/hooks/useAction/useAction.native.d.ts +0 -5
- package/dist/types/hooks/useAction/useAction.native.d.ts.map +0 -1
- package/dist/types/hooks/useAction/useAction.web.d.ts +0 -5
- package/dist/types/hooks/useAction/useAction.web.d.ts.map +0 -1
- package/dist/types/hooks/useInteractiveState/useInteractiveState.types.d.ts +0 -24
- package/dist/types/hooks/useInteractiveState/useInteractiveState.types.d.ts.map +0 -1
- /package/dist/cjs/hooks/{useAction/types.js → useStyles/useStyles.types.js} +0 -0
- /package/dist/esm/hooks/{useAction/types.js → useStyles/useStyles.types.js} +0 -0
- /package/dist/{cjs/hooks/useInteractiveState/useInteractiveState.types.js → native/cjs/components/u/types.js} +0 -0
- /package/dist/{esm/hooks/useInteractiveState/useInteractiveState.types.js → native/esm/components/u/types.js} +0 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useInteractiveState = useInteractiveState;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
function useInteractiveState({ disabled, onBlur, onClick, onFocus, onPress, onIn, onOut, } = {}) {
|
|
6
|
+
const [interactiveState, setInteractiveState] = (0, react_1.useState)('idle');
|
|
7
|
+
const dataAttrs = {
|
|
8
|
+
'data-state': interactiveState,
|
|
9
|
+
'data-disabled': disabled ? 'true' : 'false',
|
|
10
|
+
'data-focused': interactiveState === 'focused' ? 'true' : 'false',
|
|
11
|
+
'data-hovered': interactiveState === 'hovered' ? 'true' : 'false',
|
|
12
|
+
'data-pressed': interactiveState === 'pressed' ? 'true' : 'false',
|
|
13
|
+
};
|
|
14
|
+
const eventHandlers = {
|
|
15
|
+
onBlur: (e) => {
|
|
16
|
+
if (disabled) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
onBlur?.(e);
|
|
20
|
+
setInteractiveState('idle');
|
|
21
|
+
},
|
|
22
|
+
onClick: (e) => {
|
|
23
|
+
if (disabled) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (onClick) {
|
|
27
|
+
onClick?.(e);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
onPress?.(e);
|
|
31
|
+
},
|
|
32
|
+
onFocus: (e) => {
|
|
33
|
+
if (disabled) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
onFocus?.(e);
|
|
37
|
+
setInteractiveState('focused');
|
|
38
|
+
},
|
|
39
|
+
onMouseDown: (e) => {
|
|
40
|
+
if (disabled) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
setInteractiveState('pressed');
|
|
44
|
+
},
|
|
45
|
+
onMouseEnter: (e) => {
|
|
46
|
+
if (disabled) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
onIn?.(e);
|
|
50
|
+
setInteractiveState('hovered');
|
|
51
|
+
},
|
|
52
|
+
onMouseLeave: (e) => {
|
|
53
|
+
if (disabled) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
console.log('[DEBUG] onMouseLeave', typeof onOut, e);
|
|
57
|
+
onOut?.(e);
|
|
58
|
+
setInteractiveState('idle');
|
|
59
|
+
},
|
|
60
|
+
onMouseUp: (e) => {
|
|
61
|
+
if (disabled) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
console.log('[DEBUG] onMouseUp', e);
|
|
65
|
+
setInteractiveState('idle');
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
return {
|
|
69
|
+
dataAttrs,
|
|
70
|
+
disabled,
|
|
71
|
+
eventHandlers,
|
|
72
|
+
interactiveState,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useOnChange = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useOnChange = ({ onChange, onChangeValue, }) => {
|
|
6
|
+
return (0, react_1.useMemo)(() => ({
|
|
7
|
+
onChange: (event) => {
|
|
8
|
+
if (onChange) {
|
|
9
|
+
onChange(event);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (onChangeValue) {
|
|
13
|
+
onChangeValue(event?.target?.value);
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
}), [onChange, onChangeValue]);
|
|
17
|
+
};
|
|
18
|
+
exports.useOnChange = useOnChange;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useProps = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const useProps = () => {
|
|
9
|
+
const handleOmit = react_1.default.useCallback((obj = {}, keys = []) => {
|
|
10
|
+
if (!obj) {
|
|
11
|
+
return {
|
|
12
|
+
props: {},
|
|
13
|
+
restProps: {},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
17
|
+
const result = {};
|
|
18
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
19
|
+
const nonUsedProps = {};
|
|
20
|
+
for (const key of Object.keys(obj)) {
|
|
21
|
+
if (!keys.includes(key)) {
|
|
22
|
+
result[key] = obj[key];
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
nonUsedProps[key] = obj[key];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
props: result,
|
|
30
|
+
restProps: nonUsedProps,
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
const handlePick = react_1.default.useCallback((obj = {}, keys = []) => {
|
|
34
|
+
if (!obj) {
|
|
35
|
+
return {
|
|
36
|
+
props: {},
|
|
37
|
+
restProps: {},
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
41
|
+
const result = {};
|
|
42
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
43
|
+
const nonUsedProps = {};
|
|
44
|
+
for (const key of Object.keys(obj)) {
|
|
45
|
+
if (keys.includes(key)) {
|
|
46
|
+
result[key] = obj[key];
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
nonUsedProps[key] = obj[key];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
props: result /*Pick<
|
|
54
|
+
TObject,
|
|
55
|
+
Exclude<keyof TObject, Exclude<keyof TObject, TKeys>>
|
|
56
|
+
>*/,
|
|
57
|
+
restProps: nonUsedProps,
|
|
58
|
+
};
|
|
59
|
+
}, []);
|
|
60
|
+
return {
|
|
61
|
+
getPropKey: (obj = {}) => handlePick(obj, ['key']),
|
|
62
|
+
omitProps: handleOmit,
|
|
63
|
+
pickProps: handlePick,
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
exports.useProps = useProps;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toCssDecls = exports.toKebab = exports.extractStyles = void 0;
|
|
4
|
+
const extractStyles = (style) => {
|
|
5
|
+
const base = { ...style };
|
|
6
|
+
const disabled = style.$disabled || {};
|
|
7
|
+
const focused = style.$focused || {};
|
|
8
|
+
const hovered = style.$hovered || {};
|
|
9
|
+
const pressed = style.$pressed || {};
|
|
10
|
+
base.$disabled = undefined;
|
|
11
|
+
base.$focused = undefined;
|
|
12
|
+
base.$hovered = undefined;
|
|
13
|
+
base.$pressed = undefined;
|
|
14
|
+
return {
|
|
15
|
+
styleBase: base,
|
|
16
|
+
styleDisabled: disabled,
|
|
17
|
+
styleFocused: focused,
|
|
18
|
+
styleHovered: hovered,
|
|
19
|
+
stylePressed: pressed,
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
exports.extractStyles = extractStyles;
|
|
23
|
+
const toKebab = (s) => s.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
24
|
+
exports.toKebab = toKebab;
|
|
25
|
+
const toCssDecls = (style) => {
|
|
26
|
+
if (!style) {
|
|
27
|
+
return '';
|
|
28
|
+
}
|
|
29
|
+
// TODO: adiconar os px ou outra medida quando necessario e faça sentido
|
|
30
|
+
return Object.entries(style)
|
|
31
|
+
.filter(([, v]) => v !== undefined && v !== null)
|
|
32
|
+
.map(([k, v]) => `${(0, exports.toKebab)(k)}:${typeof v === 'number' ? `${v}` : v};`)
|
|
33
|
+
.join('');
|
|
34
|
+
};
|
|
35
|
+
exports.toCssDecls = toCssDecls;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStyles = void 0;
|
|
4
|
+
const useStyles_helpers_1 = require("./useStyles.helpers");
|
|
5
|
+
const getStyles = ({ disabled, style, }) => {
|
|
6
|
+
if (!style) {
|
|
7
|
+
return {};
|
|
8
|
+
}
|
|
9
|
+
const { styleBase, styleDisabled, styleFocused, styleHovered, stylePressed } = (0, useStyles_helpers_1.extractStyles)(style);
|
|
10
|
+
const composedStyle = { ...styleBase };
|
|
11
|
+
if (disabled) {
|
|
12
|
+
Object.assign(composedStyle, styleDisabled || {});
|
|
13
|
+
}
|
|
14
|
+
return { style: composedStyle };
|
|
15
|
+
};
|
|
16
|
+
const getStylesWithInteraction = ({ disabled, style }) => (options) => {
|
|
17
|
+
if (!style) {
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
20
|
+
const { styleBase, styleDisabled, styleFocused, styleHovered, stylePressed, } = (0, useStyles_helpers_1.extractStyles)(style);
|
|
21
|
+
const composedStyle = { ...styleBase };
|
|
22
|
+
if (disabled) {
|
|
23
|
+
Object.assign(composedStyle, styleDisabled || {});
|
|
24
|
+
}
|
|
25
|
+
if (options?.focused) {
|
|
26
|
+
Object.assign(composedStyle, styleFocused || {});
|
|
27
|
+
}
|
|
28
|
+
if (options?.hovered) {
|
|
29
|
+
Object.assign(composedStyle, styleHovered || {});
|
|
30
|
+
}
|
|
31
|
+
if (options?.pressed) {
|
|
32
|
+
Object.assign(composedStyle, stylePressed || {});
|
|
33
|
+
}
|
|
34
|
+
return { style: composedStyle };
|
|
35
|
+
};
|
|
36
|
+
const useStyles = () => {
|
|
37
|
+
return {
|
|
38
|
+
getStyles,
|
|
39
|
+
getStylesWithInteraction,
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
exports.useStyles = useStyles;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStyles = exports.createInteractiveClass = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useStyles_helpers_1 = require("./useStyles.helpers");
|
|
6
|
+
const injected = new Set();
|
|
7
|
+
const injectOnce = (id, cssText) => {
|
|
8
|
+
if (typeof document === 'undefined')
|
|
9
|
+
return;
|
|
10
|
+
if (injected.has(id))
|
|
11
|
+
return;
|
|
12
|
+
const style = document.createElement('style');
|
|
13
|
+
style.setAttribute('data-interactive', id);
|
|
14
|
+
style.textContent = cssText;
|
|
15
|
+
document.head.appendChild(style);
|
|
16
|
+
injected.add(id);
|
|
17
|
+
};
|
|
18
|
+
const createInteractiveClass = ({ disabled, id, style, }) => {
|
|
19
|
+
const className = `ix-${id}`;
|
|
20
|
+
const { styleBase, styleDisabled, styleFocused, styleHovered, stylePressed } = (0, useStyles_helpers_1.extractStyles)(style);
|
|
21
|
+
const hoveredClass = styleHovered
|
|
22
|
+
? `.${className}:hover{${(0, useStyles_helpers_1.toCssDecls)(styleHovered)}}`
|
|
23
|
+
: '';
|
|
24
|
+
const activeClass = stylePressed
|
|
25
|
+
? `.${className}:active{${(0, useStyles_helpers_1.toCssDecls)(stylePressed)}}`
|
|
26
|
+
: '';
|
|
27
|
+
// focus-visible com fallback para browsers sem suporte
|
|
28
|
+
const focusVisibleClass = styleFocused
|
|
29
|
+
? `
|
|
30
|
+
.${className}:focus-visible{${(0, useStyles_helpers_1.toCssDecls)(styleFocused)}}
|
|
31
|
+
@supports not selector(:focus-visible){
|
|
32
|
+
.${className}:focus{${(0, useStyles_helpers_1.toCssDecls)(styleFocused)}}
|
|
33
|
+
}
|
|
34
|
+
`
|
|
35
|
+
: '';
|
|
36
|
+
const disabledClass = disabled
|
|
37
|
+
? `
|
|
38
|
+
.${className}[data-disabled="true"]{${(0, useStyles_helpers_1.toCssDecls)(styleDisabled)}}
|
|
39
|
+
.${className}[data-disabled="true"]:hover{${(0, useStyles_helpers_1.toCssDecls)(styleDisabled)}}
|
|
40
|
+
.${className}[data-disabled="true"]:active{${(0, useStyles_helpers_1.toCssDecls)(styleDisabled)}}
|
|
41
|
+
`
|
|
42
|
+
: '';
|
|
43
|
+
const baseClass = `.${className}{${(0, useStyles_helpers_1.toCssDecls)(styleBase)}}`;
|
|
44
|
+
injectOnce(id, `${baseClass}${hoveredClass}${activeClass}${focusVisibleClass}${disabledClass}`);
|
|
45
|
+
return className;
|
|
46
|
+
};
|
|
47
|
+
exports.createInteractiveClass = createInteractiveClass;
|
|
48
|
+
const getStyles = ({ id }) => ({ disabled, style }) => {
|
|
49
|
+
if (!style) {
|
|
50
|
+
return {};
|
|
51
|
+
}
|
|
52
|
+
const className = (0, exports.createInteractiveClass)({ disabled, id, style });
|
|
53
|
+
return {
|
|
54
|
+
className,
|
|
55
|
+
...(disabled ? { 'aria-disabled': 'true', 'data-disabled': 'true' } : {}),
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
const useStyles = () => {
|
|
59
|
+
const id = (0, react_1.useId)();
|
|
60
|
+
// TODO: cleanup on unmount
|
|
61
|
+
// useEffect(() => {
|
|
62
|
+
// return () => {
|
|
63
|
+
// document.querySelector(`style[data-interactive="${id}"]`)?.remove();
|
|
64
|
+
// injected.delete(id);
|
|
65
|
+
// };
|
|
66
|
+
// }, [id]);
|
|
67
|
+
return {
|
|
68
|
+
getStyles: getStyles({ id }),
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
exports.useStyles = useStyles;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./components/index.web"), exports);
|
|
18
|
+
__exportStar(require("./hooks/index.web"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./components/index.native"), exports);
|
|
18
|
+
__exportStar(require("./hooks/index.native"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./components/index.web"), exports);
|
|
18
|
+
__exportStar(require("./hooks/index.web"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./base"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { Pressable } from 'react-native';
|
|
3
|
+
import { useInteractiveHandlers, useStyles } from '../../hooks/index.native';
|
|
4
|
+
import { useCn } from '../../hooks/useCn';
|
|
5
|
+
import { E } from '../e/index.native';
|
|
6
|
+
export function A({ accessibilityLabel, accessibilityRole, accessibilityState, className, children, loading, ref, style, testId, ...restProps }) {
|
|
7
|
+
const cn = useCn();
|
|
8
|
+
const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
|
|
9
|
+
const { getStylesWithInteraction } = useStyles();
|
|
10
|
+
const isDisabled = Boolean(disabled || loading);
|
|
11
|
+
return (_jsx(Pressable, { ref: ref, disabled: isDisabled, accessibilityLabel: accessibilityLabel, accessibilityRole: accessibilityRole, accessibilityState: accessibilityState, testID: testId, ...eventHandlers, ...getStylesWithInteraction({ disabled, style }), children: _jsx(E, { className: cn(disabled && 'opacity-60', className), style: style, ...restProps, children: children }) }));
|
|
12
|
+
}
|
|
13
|
+
export const Action = A;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { useInteractiveHandlers, useStyles } from '../../hooks/index.web';
|
|
3
|
+
import { useCn } from '../../hooks/useCn';
|
|
4
|
+
export function A({ className, children, loading, ref, testId, accessibilityLabel, accessibilityRole, accessibilityState, style, ...restProps }) {
|
|
5
|
+
const cn = useCn();
|
|
6
|
+
const { getStyles } = useStyles();
|
|
7
|
+
const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
|
|
8
|
+
const isDisabled = Boolean(disabled || loading);
|
|
9
|
+
return (_jsx("button", { ref: ref, type: "button", className: cn('cursor-pointer', disabled && 'opacity-60', className), "aria-disabled": isDisabled || undefined, "aria-busy": loading || undefined, "aria-label": accessibilityLabel, "data-testid": testId, ...restProps, ...eventHandlers, ...getStyles({ disabled, style }), children: children }));
|
|
10
|
+
}
|
|
11
|
+
export const Action = A;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './a.native';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './a.web';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { Modal } from 'react-native';
|
|
3
|
+
import { useCn } from '../../hooks/useCn';
|
|
4
|
+
import { E } from '../e/index.native';
|
|
5
|
+
export function D({ open, onOpenChange, placement = 'center', backdropClassName, backdropStyle, containerClassName, containerStyle, contentClassName, contentStyle, children, ref, ...restProps }) {
|
|
6
|
+
const cn = useCn();
|
|
7
|
+
const placementClasses = {
|
|
8
|
+
center: 'items-center justify-center',
|
|
9
|
+
top: 'items-start justify-center',
|
|
10
|
+
bottom: 'items-end justify-center',
|
|
11
|
+
left: 'items-stretch justify-start',
|
|
12
|
+
right: 'items-stretch justify-end',
|
|
13
|
+
};
|
|
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' : '', contentClassName);
|
|
16
|
+
const handleRequestClose = (e) => {
|
|
17
|
+
onOpenChange?.(false);
|
|
18
|
+
if (typeof restProps.onRequestClose === 'function') {
|
|
19
|
+
restProps.onRequestClose?.(e);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
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
|
+
}
|
|
24
|
+
export const Dialog = D;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
import { useCn } from '../../hooks/useCn';
|
|
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, ...restProps }) {
|
|
6
|
+
const cn = useCn();
|
|
7
|
+
if (typeof document === 'undefined')
|
|
8
|
+
return null;
|
|
9
|
+
if (!open)
|
|
10
|
+
return null;
|
|
11
|
+
const placementClasses = {
|
|
12
|
+
center: 'items-center justify-center',
|
|
13
|
+
top: 'items-start justify-center',
|
|
14
|
+
bottom: 'items-end justify-center',
|
|
15
|
+
left: 'items-stretch justify-start',
|
|
16
|
+
right: 'items-stretch justify-end',
|
|
17
|
+
};
|
|
18
|
+
const handleBackdropClick = (event) => {
|
|
19
|
+
if (event.target !== event.currentTarget)
|
|
20
|
+
return;
|
|
21
|
+
if (closeOnBackdropClick) {
|
|
22
|
+
onOpenChange?.(false);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
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' : '', 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, ...restProps, children: children }) }), document.body);
|
|
33
|
+
}
|
|
34
|
+
export const Dialog = D;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './d.native';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './d.web';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { useCn } from '../../hooks/useCn';
|
|
4
|
+
import { useInteractiveHandlers, useStyles } from '../../index.native';
|
|
5
|
+
import { T } from '../t/index.native';
|
|
6
|
+
export function E({ className, children, ref, style, ...restProps }) {
|
|
7
|
+
const cn = useCn();
|
|
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 }));
|
|
11
|
+
}
|
|
12
|
+
export const Element = E;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { useCn } from '../../hooks/useCn';
|
|
3
|
+
import { useInteractiveHandlers, useStyles } from '../../index.web';
|
|
4
|
+
export function E({ as = 'div', className, children, ref, role, style, ...restProps }) {
|
|
5
|
+
const cn = useCn();
|
|
6
|
+
const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
|
|
7
|
+
const { getStyles } = useStyles();
|
|
8
|
+
const Comp = as;
|
|
9
|
+
return (_jsx(Comp, { ref: ref, className: cn(className), role: role, ...restProps, ...eventHandlers, ...getStyles({ disabled, style }), children: children }));
|
|
10
|
+
}
|
|
11
|
+
export const Element = E;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './e.native';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './e.web';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { TextInput } from 'react-native';
|
|
3
|
+
import { useCn } from '../../hooks/useCn';
|
|
4
|
+
import { useOnChange } from '../../hooks/useOnChange';
|
|
5
|
+
import { useInteractiveHandlers, useStyles } from '../../index.native';
|
|
6
|
+
import { useIUtils } from './useIUtils';
|
|
7
|
+
export function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, editable, ref, name, style, ...restProps }) {
|
|
8
|
+
const { treatTypeModeAndKeyboardType } = useIUtils();
|
|
9
|
+
const cn = useCn();
|
|
10
|
+
const { onChange: handleOnChange } = useOnChange({
|
|
11
|
+
onChange,
|
|
12
|
+
onChangeValue,
|
|
13
|
+
});
|
|
14
|
+
const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
|
|
15
|
+
const { getStyles } = useStyles();
|
|
16
|
+
const effectiveEditable = editable ?? !disabled;
|
|
17
|
+
const { masterInputType, masterInputKeyboardType } = treatTypeModeAndKeyboardType({
|
|
18
|
+
inputMode,
|
|
19
|
+
keyboardType,
|
|
20
|
+
type,
|
|
21
|
+
});
|
|
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 }) }));
|
|
23
|
+
}
|
|
24
|
+
export const Input = I;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { useCn } from '../../hooks/useCn';
|
|
3
|
+
import { useOnChange } from '../../hooks/useOnChange';
|
|
4
|
+
import { useInteractiveHandlers, useStyles } from '../../index.web';
|
|
5
|
+
import { useIUtils } from './useIUtils';
|
|
6
|
+
export function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, editable, ref, style, ...restProps }) {
|
|
7
|
+
const { treatTypeModeAndKeyboardType } = useIUtils();
|
|
8
|
+
const cn = useCn();
|
|
9
|
+
const { onChange: handleOnChange } = useOnChange({
|
|
10
|
+
onChange,
|
|
11
|
+
onChangeValue,
|
|
12
|
+
});
|
|
13
|
+
const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
|
|
14
|
+
const { getStyles } = useStyles();
|
|
15
|
+
const effectiveDisabled = disabled || editable === false;
|
|
16
|
+
const { masterInputType, masterInputMode } = treatTypeModeAndKeyboardType({
|
|
17
|
+
inputMode,
|
|
18
|
+
keyboardType,
|
|
19
|
+
type,
|
|
20
|
+
});
|
|
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 }) }));
|
|
22
|
+
}
|
|
23
|
+
export const Input = I;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './i.native';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './i.web';
|