@react-xp/aeiou 0.1.0-rc.1 → 1.0.0-beta.0
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 +7 -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 +6 -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 +14 -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 +10 -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 +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 +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 +1 -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 +55 -10
- 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,67 @@
|
|
|
1
|
+
const setWhenUndefined = (value, defaultValue) => {
|
|
2
|
+
return value === undefined ? defaultValue : value;
|
|
3
|
+
};
|
|
4
|
+
const treatTypeModeAndKeyboardType = ({ inputMode, keyboardType, type, }) => {
|
|
5
|
+
let masterInputKeyboardType = keyboardType;
|
|
6
|
+
let masterInputMode = inputMode;
|
|
7
|
+
let masterInputType = type;
|
|
8
|
+
// set values according to inputMode first
|
|
9
|
+
if (masterInputMode === 'numeric' || masterInputMode === 'decimal') {
|
|
10
|
+
masterInputKeyboardType = setWhenUndefined(masterInputKeyboardType, 'numeric');
|
|
11
|
+
masterInputType = setWhenUndefined(masterInputType, 'number');
|
|
12
|
+
}
|
|
13
|
+
else if (masterInputMode === 'email') {
|
|
14
|
+
masterInputKeyboardType = setWhenUndefined(masterInputKeyboardType, 'email-address');
|
|
15
|
+
masterInputType = setWhenUndefined(masterInputType, 'email');
|
|
16
|
+
}
|
|
17
|
+
else if (masterInputMode === 'search') {
|
|
18
|
+
masterInputKeyboardType = setWhenUndefined(masterInputKeyboardType, 'default');
|
|
19
|
+
masterInputType = setWhenUndefined(masterInputType, 'search');
|
|
20
|
+
}
|
|
21
|
+
else if (masterInputMode === 'tel') {
|
|
22
|
+
masterInputKeyboardType = setWhenUndefined(masterInputKeyboardType, 'phone-pad');
|
|
23
|
+
masterInputType = setWhenUndefined(masterInputType, 'tel');
|
|
24
|
+
}
|
|
25
|
+
else if (masterInputMode === 'url') {
|
|
26
|
+
masterInputKeyboardType = setWhenUndefined(masterInputKeyboardType, 'url');
|
|
27
|
+
masterInputType = setWhenUndefined(masterInputType, 'url');
|
|
28
|
+
}
|
|
29
|
+
else if (masterInputType === 'text') {
|
|
30
|
+
masterInputKeyboardType = setWhenUndefined(masterInputKeyboardType, 'default');
|
|
31
|
+
masterInputType = setWhenUndefined(masterInputType, 'text');
|
|
32
|
+
}
|
|
33
|
+
// set values according to keyboardType second
|
|
34
|
+
if (masterInputKeyboardType === 'email-address') {
|
|
35
|
+
masterInputMode = setWhenUndefined(masterInputMode, 'email');
|
|
36
|
+
masterInputType = setWhenUndefined(masterInputType, 'email');
|
|
37
|
+
}
|
|
38
|
+
else if (masterInputKeyboardType === 'numeric' ||
|
|
39
|
+
masterInputKeyboardType === 'decimal-pad') {
|
|
40
|
+
masterInputMode = setWhenUndefined(masterInputMode, 'numeric');
|
|
41
|
+
masterInputType = setWhenUndefined(masterInputType, 'number');
|
|
42
|
+
}
|
|
43
|
+
else if (masterInputKeyboardType === 'phone-pad') {
|
|
44
|
+
masterInputMode = setWhenUndefined(masterInputMode, 'tel');
|
|
45
|
+
masterInputType = setWhenUndefined(masterInputType, 'tel');
|
|
46
|
+
}
|
|
47
|
+
else if (masterInputKeyboardType === 'url') {
|
|
48
|
+
masterInputMode = setWhenUndefined(masterInputMode, 'url');
|
|
49
|
+
masterInputType = setWhenUndefined(masterInputType, 'url');
|
|
50
|
+
}
|
|
51
|
+
else if (masterInputKeyboardType === 'default') {
|
|
52
|
+
masterInputMode = setWhenUndefined(masterInputMode, 'text');
|
|
53
|
+
masterInputType = setWhenUndefined(masterInputType, 'text');
|
|
54
|
+
}
|
|
55
|
+
// finally, set default type if still undefined
|
|
56
|
+
masterInputType = setWhenUndefined(masterInputType, 'text');
|
|
57
|
+
return {
|
|
58
|
+
masterInputKeyboardType,
|
|
59
|
+
masterInputMode,
|
|
60
|
+
masterInputType,
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export const useIUtils = () => {
|
|
64
|
+
return {
|
|
65
|
+
treatTypeModeAndKeyboardType,
|
|
66
|
+
};
|
|
67
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './a/index.web';
|
|
2
|
+
export * from './d/index.web';
|
|
3
|
+
export * from './e/index.web';
|
|
4
|
+
export * from './i/index.web';
|
|
5
|
+
export * from './l/index.web';
|
|
6
|
+
export * from './o/index.web';
|
|
7
|
+
export * from './p/index.web';
|
|
8
|
+
export * from './s/index.web';
|
|
9
|
+
export * from './t/index.web';
|
|
10
|
+
export * from './u/index.web';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './a/index.native';
|
|
2
|
+
export * from './d/index.native';
|
|
3
|
+
export * from './e/index.native';
|
|
4
|
+
export * from './i/index.native';
|
|
5
|
+
export * from './l/index.native';
|
|
6
|
+
export * from './o/index.native';
|
|
7
|
+
export * from './p/index.native';
|
|
8
|
+
export * from './s/index.native';
|
|
9
|
+
export * from './t/index.native';
|
|
10
|
+
export * from './u/index.native';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './a/index.web';
|
|
2
|
+
export * from './d/index.web';
|
|
3
|
+
export * from './e/index.web';
|
|
4
|
+
export * from './i/index.web';
|
|
5
|
+
export * from './l/index.web';
|
|
6
|
+
export * from './o/index.web';
|
|
7
|
+
export * from './p/index.web';
|
|
8
|
+
export * from './s/index.web';
|
|
9
|
+
export * from './t/index.web';
|
|
10
|
+
export * from './u/index.web';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './l.native';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './l.web';
|
|
@@ -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 L({ className, children, to, href, preventDefault, ref, style, ...restProps }) {
|
|
5
|
+
const cn = useCn();
|
|
6
|
+
const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
|
|
7
|
+
const { getStyles } = useStyles();
|
|
8
|
+
const resolvedHref = href ?? to ?? '#';
|
|
9
|
+
return (_jsx("a", { ref: ref, href: resolvedHref, className: cn('cursor-pointer', className), ...restProps, ...eventHandlers, ...getStyles({ disabled, style }), children: children }));
|
|
10
|
+
}
|
|
11
|
+
export const Link = L;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './o.native';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './o.web';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { ScrollView } from 'react-native';
|
|
3
|
+
import { useCn } from '../../hooks/useCn';
|
|
4
|
+
export function O({ className, children, horizontal, ref, ...restProps }) {
|
|
5
|
+
const cn = useCn();
|
|
6
|
+
return (_jsx(ScrollView, { ref: ref, className: cn(className), horizontal: horizontal, ...restProps, children: children }));
|
|
7
|
+
}
|
|
8
|
+
export const Overflow = O;
|
|
@@ -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 O({ className, children, horizontal, ref, style, ...restProps }) {
|
|
5
|
+
const cn = useCn();
|
|
6
|
+
const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
|
|
7
|
+
const { getStyles } = useStyles();
|
|
8
|
+
const overflowClass = horizontal ? 'overflow-x-auto' : 'overflow-y-auto';
|
|
9
|
+
return (_jsx("div", { ref: ref, className: cn(overflowClass, className), ...restProps, ...eventHandlers, ...getStyles({ disabled, style }), children: children }));
|
|
10
|
+
}
|
|
11
|
+
export const Overflow = O;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './p.native';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './p.web';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { Image } from 'react-native';
|
|
3
|
+
import { useCn } from '../../hooks/useCn';
|
|
4
|
+
export function P({ className, src, source, ref, ...restProps }) {
|
|
5
|
+
const cn = useCn();
|
|
6
|
+
const finalSource = src != null ? { uri: src } : source;
|
|
7
|
+
return (_jsx(Image, { ref: ref, className: cn(className), source: finalSource, ...restProps }));
|
|
8
|
+
}
|
|
9
|
+
export const Picture = P;
|
|
@@ -0,0 +1,12 @@
|
|
|
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 P({ alt, className, ref, style, source, src, ...restProps }) {
|
|
5
|
+
const cn = useCn();
|
|
6
|
+
const { disabled, eventHandlers } = useInteractiveHandlers(restProps);
|
|
7
|
+
const { getStyles } = useStyles();
|
|
8
|
+
return (
|
|
9
|
+
// biome-ignore lint/a11y/useAltText: <explanation>
|
|
10
|
+
_jsx("img", { alt: alt, "aria-label": alt, ref: ref, className: cn('object-cover', className), src: src ?? source, ...restProps, ...eventHandlers, ...getStyles({ disabled, style }) }));
|
|
11
|
+
}
|
|
12
|
+
export const Picture = P;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './s.native';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './s.web';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { SafeAreaView, } from 'react-native-safe-area-context';
|
|
3
|
+
import { useCn } from '../../hooks/useCn';
|
|
4
|
+
export function S({ className, children, ref, ...restProps }) {
|
|
5
|
+
const cn = useCn();
|
|
6
|
+
return (_jsx(SafeAreaView, { ref: ref, className: cn(className), ...restProps, children: children }));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './t.native';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './t.web';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { Text as RNText } from 'react-native';
|
|
3
|
+
import { useCn } from '../../hooks/useCn';
|
|
4
|
+
import { useInteractiveHandlers, useStyles } from '../../index.native';
|
|
5
|
+
export function T({ className, children, ref, style, ...restProps }) {
|
|
6
|
+
const cn = useCn();
|
|
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 }));
|
|
10
|
+
}
|
|
11
|
+
export const Text = T;
|
|
@@ -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 T({ className, children, as = 'span', ref, 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('leading-relaxed', className), ...restProps, ...eventHandlers, ...getStyles({ disabled, style }), children: children }));
|
|
10
|
+
}
|
|
11
|
+
export const Text = T;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
const defaultValue = {
|
|
3
|
+
colorScheme: 'system',
|
|
4
|
+
locale: 'en-US',
|
|
5
|
+
platform: 'web',
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
7
|
+
setColorScheme: () => { },
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
9
|
+
setLocale: () => { },
|
|
10
|
+
};
|
|
11
|
+
export const UniverseContext = createContext(defaultValue);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { Component } from 'react';
|
|
3
|
+
export class ErrorBoundary extends Component {
|
|
4
|
+
constructor(props) {
|
|
5
|
+
super(props);
|
|
6
|
+
this.state = { hasError: false };
|
|
7
|
+
}
|
|
8
|
+
static getDerivedStateFromError() {
|
|
9
|
+
return { hasError: true };
|
|
10
|
+
}
|
|
11
|
+
componentDidCatch(error, errorInfo) {
|
|
12
|
+
this.props.onError?.callback?.(error, errorInfo);
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
if (this.state.hasError) {
|
|
16
|
+
if (this.props.onError?.render) {
|
|
17
|
+
return this.props.onError.render;
|
|
18
|
+
}
|
|
19
|
+
return _jsx("h1", { children: "Ocorreu um erro. Por favor, tente novamente mais tarde." });
|
|
20
|
+
}
|
|
21
|
+
return this.props.children;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { Appearance } from 'react-native';
|
|
4
|
+
import { UniverseContext } from './context';
|
|
5
|
+
import { ErrorBoundary } from './errorBoundary';
|
|
6
|
+
export function U({ children, config, onError }) {
|
|
7
|
+
const systemColorScheme = Appearance.getColorScheme() ?? 'light';
|
|
8
|
+
const [colorScheme, setColorScheme] = useState(config?.colorScheme ?? 'system');
|
|
9
|
+
const [locale, setLocale] = useState(config?.locale ?? 'en-US');
|
|
10
|
+
const value = useMemo(() => ({
|
|
11
|
+
colorScheme,
|
|
12
|
+
locale,
|
|
13
|
+
platform: 'native',
|
|
14
|
+
systemColorScheme,
|
|
15
|
+
setColorScheme,
|
|
16
|
+
setLocale,
|
|
17
|
+
}), [colorScheme, locale, systemColorScheme]);
|
|
18
|
+
return (_jsx(ErrorBoundary, { onError: onError, children: _jsx(UniverseContext.Provider, { value: value, children: children }) }));
|
|
19
|
+
}
|
|
20
|
+
export const Universe = U;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { UniverseContext } from './context';
|
|
4
|
+
import { ErrorBoundary } from './errorBoundary';
|
|
5
|
+
export function U({ children, config, onError }) {
|
|
6
|
+
const [colorScheme, setColorScheme] = useState(config?.colorScheme ?? 'system');
|
|
7
|
+
const [locale, setLocale] = useState(config?.locale ?? 'en-US');
|
|
8
|
+
const value = useMemo(() => ({
|
|
9
|
+
colorScheme,
|
|
10
|
+
locale,
|
|
11
|
+
platform: 'web',
|
|
12
|
+
setColorScheme,
|
|
13
|
+
setLocale,
|
|
14
|
+
}), [colorScheme, locale]);
|
|
15
|
+
return (_jsx(ErrorBoundary, { onError: onError, children: _jsx(UniverseContext.Provider, { value: value, children: children }) }));
|
|
16
|
+
}
|
|
17
|
+
export const Universe = U;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './useCn';
|
|
2
|
+
export * from './useInteractiveHandlers/useInteractiveHandlers.native';
|
|
3
|
+
export * from './useInteractiveState/useInteractiveState.native';
|
|
4
|
+
export * from './useOnChange';
|
|
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
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useRef, useState } from 'react';
|
|
2
|
+
export function useInteractiveState({ disabled, onBlur, onClick, onFocus, onPress, onIn, onOut, } = {}) {
|
|
3
|
+
const offOn = useRef('off');
|
|
4
|
+
const [interactiveState, setInteractiveState] = useState('idle');
|
|
5
|
+
const dataAttrs = {
|
|
6
|
+
'data-state': interactiveState,
|
|
7
|
+
'data-disabled': disabled ? 'true' : 'false',
|
|
8
|
+
'data-focused': interactiveState === 'focused' ? 'true' : 'false',
|
|
9
|
+
'data-hovered': interactiveState === 'hovered' ? 'true' : 'false',
|
|
10
|
+
'data-pressed': interactiveState === 'pressed' ? 'true' : 'false',
|
|
11
|
+
};
|
|
12
|
+
const eventHandlers = {
|
|
13
|
+
onBlur: (e) => {
|
|
14
|
+
if (disabled) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
onBlur?.(e);
|
|
18
|
+
setInteractiveState('idle');
|
|
19
|
+
},
|
|
20
|
+
onFocus: (e) => {
|
|
21
|
+
if (disabled) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
onFocus?.(e);
|
|
25
|
+
setInteractiveState('focused');
|
|
26
|
+
},
|
|
27
|
+
onPress: (e) => {
|
|
28
|
+
if (disabled) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if ((onIn || onOut) && offOn.current === 'off') {
|
|
32
|
+
offOn.current = 'on';
|
|
33
|
+
onIn?.(e);
|
|
34
|
+
}
|
|
35
|
+
if ((onIn || onOut) && offOn.current === 'on') {
|
|
36
|
+
offOn.current = 'off';
|
|
37
|
+
onOut?.(e);
|
|
38
|
+
}
|
|
39
|
+
if (onPress) {
|
|
40
|
+
onPress?.(e);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
onClick?.(e);
|
|
44
|
+
},
|
|
45
|
+
onPressIn: (e) => {
|
|
46
|
+
if (disabled) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
onIn?.(e);
|
|
50
|
+
setInteractiveState('pressed');
|
|
51
|
+
},
|
|
52
|
+
onPressOut: (e) => {
|
|
53
|
+
if (disabled) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
onOut?.(e);
|
|
57
|
+
setInteractiveState('idle');
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
return {
|
|
61
|
+
dataAttrs,
|
|
62
|
+
disabled,
|
|
63
|
+
eventHandlers,
|
|
64
|
+
interactiveState,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
export function useInteractiveState({ disabled, onBlur, onClick, onFocus, onPress, onIn, onOut, } = {}) {
|
|
3
|
+
const [interactiveState, setInteractiveState] = useState('idle');
|
|
4
|
+
const dataAttrs = {
|
|
5
|
+
'data-state': interactiveState,
|
|
6
|
+
'data-disabled': disabled ? 'true' : 'false',
|
|
7
|
+
'data-focused': interactiveState === 'focused' ? 'true' : 'false',
|
|
8
|
+
'data-hovered': interactiveState === 'hovered' ? 'true' : 'false',
|
|
9
|
+
'data-pressed': interactiveState === 'pressed' ? 'true' : 'false',
|
|
10
|
+
};
|
|
11
|
+
const eventHandlers = {
|
|
12
|
+
onBlur: (e) => {
|
|
13
|
+
if (disabled) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
onBlur?.(e);
|
|
17
|
+
setInteractiveState('idle');
|
|
18
|
+
},
|
|
19
|
+
onClick: (e) => {
|
|
20
|
+
if (disabled) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (onClick) {
|
|
24
|
+
onClick?.(e);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
onPress?.(e);
|
|
28
|
+
},
|
|
29
|
+
onFocus: (e) => {
|
|
30
|
+
if (disabled) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
onFocus?.(e);
|
|
34
|
+
setInteractiveState('focused');
|
|
35
|
+
},
|
|
36
|
+
onMouseDown: (e) => {
|
|
37
|
+
if (disabled) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
setInteractiveState('pressed');
|
|
41
|
+
},
|
|
42
|
+
onMouseEnter: (e) => {
|
|
43
|
+
if (disabled) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
onIn?.(e);
|
|
47
|
+
setInteractiveState('hovered');
|
|
48
|
+
},
|
|
49
|
+
onMouseLeave: (e) => {
|
|
50
|
+
if (disabled) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
console.log('[DEBUG] onMouseLeave', typeof onOut, e);
|
|
54
|
+
onOut?.(e);
|
|
55
|
+
setInteractiveState('idle');
|
|
56
|
+
},
|
|
57
|
+
onMouseUp: (e) => {
|
|
58
|
+
if (disabled) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
console.log('[DEBUG] onMouseUp', e);
|
|
62
|
+
setInteractiveState('idle');
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
dataAttrs,
|
|
67
|
+
disabled,
|
|
68
|
+
eventHandlers,
|
|
69
|
+
interactiveState,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
export const useOnChange = ({ onChange, onChangeValue, }) => {
|
|
3
|
+
return useMemo(() => ({
|
|
4
|
+
onChange: (event) => {
|
|
5
|
+
if (onChange) {
|
|
6
|
+
onChange(event);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (onChangeValue) {
|
|
10
|
+
onChangeValue(event?.target?.value);
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
}), [onChange, onChangeValue]);
|
|
14
|
+
};
|