@react-xp/aeiou 0.1.0-beta.3 → 0.1.0-beta.5
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/hooks/useInteractiveState/useInteractiveState.native.js +18 -58
- package/dist/cjs/hooks/useInteractiveState/useInteractiveState.web.js +33 -42
- package/dist/esm/hooks/useInteractiveState/useInteractiveState.native.js +19 -59
- package/dist/esm/hooks/useInteractiveState/useInteractiveState.web.js +34 -43
- 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 +35 -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 +21 -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 +30 -0
- package/dist/native/cjs/components/i/i.web.js +23 -0
- package/dist/native/cjs/components/i/index.native.js +17 -0
- package/dist/native/cjs/components/i/index.web.js +17 -0
- package/dist/native/cjs/components/i/useIUtils.js +71 -0
- package/dist/native/cjs/components/index.js +26 -0
- package/dist/native/cjs/components/index.native.js +26 -0
- package/dist/native/cjs/components/index.web.js +26 -0
- package/dist/native/cjs/components/l/index.native.js +17 -0
- package/dist/native/cjs/components/l/index.web.js +17 -0
- package/dist/native/cjs/components/l/l.native.js +10 -0
- package/dist/native/cjs/components/l/l.web.js +17 -0
- package/dist/native/cjs/components/o/index.native.js +17 -0
- package/dist/native/cjs/components/o/index.web.js +17 -0
- package/dist/native/cjs/components/o/o.native.js +12 -0
- package/dist/native/cjs/components/o/o.web.js +12 -0
- package/dist/native/cjs/components/p/index.native.js +17 -0
- package/dist/native/cjs/components/p/index.web.js +17 -0
- package/dist/native/cjs/components/p/p.native.js +13 -0
- package/dist/native/cjs/components/p/p.web.js +13 -0
- package/dist/native/cjs/components/s/index.native.js +17 -0
- package/dist/native/cjs/components/s/index.web.js +17 -0
- package/dist/native/cjs/components/s/s.native.js +10 -0
- package/dist/native/cjs/components/s/s.web.js +10 -0
- package/dist/native/cjs/components/t/index.native.js +17 -0
- package/dist/native/cjs/components/t/index.web.js +17 -0
- package/dist/native/cjs/components/t/t.native.js +16 -0
- package/dist/native/cjs/components/t/t.web.js +16 -0
- package/dist/native/cjs/components/u/context.js +14 -0
- package/dist/native/cjs/components/u/index.native.js +19 -0
- package/dist/native/cjs/components/u/index.web.js +19 -0
- package/dist/native/cjs/components/u/provider.native.js +23 -0
- package/dist/native/cjs/components/u/provider.web.js +20 -0
- package/dist/native/cjs/components/u/types.js +2 -0
- package/dist/native/cjs/components/u/useUniverse.js +8 -0
- package/dist/native/cjs/hooks/index.js +21 -0
- package/dist/native/cjs/hooks/index.native.js +21 -0
- package/dist/native/cjs/hooks/index.web.js +21 -0
- package/dist/native/cjs/hooks/useAction/types.js +2 -0
- package/dist/native/cjs/hooks/useAction/useAction.native.js +18 -0
- package/dist/native/cjs/hooks/useAction/useAction.web.js +21 -0
- package/dist/native/cjs/hooks/useCn.js +15 -0
- package/dist/native/cjs/hooks/useInteractiveState/useInteractiveState.native.js +31 -0
- package/dist/native/cjs/hooks/useInteractiveState/useInteractiveState.types.js +2 -0
- package/dist/native/cjs/hooks/useInteractiveState/useInteractiveState.web.js +62 -0
- package/dist/native/cjs/hooks/useOnChange.js +18 -0
- package/dist/native/cjs/hooks/useProps.js +66 -0
- package/dist/native/cjs/index.js +19 -0
- package/dist/native/cjs/index.native.js +19 -0
- package/dist/native/cjs/index.web.js +19 -0
- package/dist/native/cjs/types/base.js +2 -0
- package/dist/native/cjs/types/index.js +17 -0
- package/dist/native/esm/components/a/a.native.js +13 -0
- package/dist/native/esm/components/a/a.web.js +11 -0
- package/dist/native/esm/components/a/index.native.js +1 -0
- package/dist/native/esm/components/a/index.web.js +1 -0
- package/dist/native/esm/components/d/d.native.js +24 -0
- package/dist/native/esm/components/d/d.web.js +31 -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 +17 -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 +26 -0
- package/dist/native/esm/components/i/i.web.js +19 -0
- package/dist/native/esm/components/i/index.native.js +1 -0
- package/dist/native/esm/components/i/index.web.js +1 -0
- package/dist/native/esm/components/i/useIUtils.js +67 -0
- package/dist/native/esm/components/index.js +10 -0
- package/dist/native/esm/components/index.native.js +10 -0
- package/dist/native/esm/components/index.web.js +10 -0
- package/dist/native/esm/components/l/index.native.js +1 -0
- package/dist/native/esm/components/l/index.web.js +1 -0
- package/dist/native/esm/components/l/l.native.js +6 -0
- package/dist/native/esm/components/l/l.web.js +13 -0
- package/dist/native/esm/components/o/index.native.js +1 -0
- package/dist/native/esm/components/o/index.web.js +1 -0
- package/dist/native/esm/components/o/o.native.js +8 -0
- package/dist/native/esm/components/o/o.web.js +8 -0
- package/dist/native/esm/components/p/index.native.js +1 -0
- package/dist/native/esm/components/p/index.web.js +1 -0
- package/dist/native/esm/components/p/p.native.js +9 -0
- package/dist/native/esm/components/p/p.web.js +9 -0
- package/dist/native/esm/components/s/index.native.js +1 -0
- package/dist/native/esm/components/s/index.web.js +1 -0
- package/dist/native/esm/components/s/s.native.js +7 -0
- package/dist/native/esm/components/s/s.web.js +6 -0
- package/dist/native/esm/components/t/index.native.js +1 -0
- package/dist/native/esm/components/t/index.web.js +1 -0
- package/dist/native/esm/components/t/t.native.js +12 -0
- package/dist/native/esm/components/t/t.web.js +12 -0
- package/dist/native/esm/components/u/context.js +11 -0
- package/dist/native/esm/components/u/index.native.js +3 -0
- package/dist/native/esm/components/u/index.web.js +3 -0
- package/dist/native/esm/components/u/provider.native.js +19 -0
- package/dist/native/esm/components/u/provider.web.js +16 -0
- package/dist/native/esm/components/u/types.js +1 -0
- package/dist/native/esm/components/u/useUniverse.js +5 -0
- package/dist/native/esm/hooks/index.js +5 -0
- package/dist/native/esm/hooks/index.native.js +5 -0
- package/dist/native/esm/hooks/index.web.js +5 -0
- package/dist/native/esm/hooks/useAction/types.js +1 -0
- package/dist/native/esm/hooks/useAction/useAction.native.js +14 -0
- package/dist/native/esm/hooks/useAction/useAction.web.js +17 -0
- package/dist/native/esm/hooks/useCn.js +8 -0
- package/dist/native/esm/hooks/useInteractiveState/useInteractiveState.native.js +28 -0
- package/dist/native/esm/hooks/useInteractiveState/useInteractiveState.types.js +1 -0
- package/dist/native/esm/hooks/useInteractiveState/useInteractiveState.web.js +59 -0
- package/dist/native/esm/hooks/useOnChange.js +14 -0
- package/dist/native/esm/hooks/useProps.js +59 -0
- package/dist/native/esm/index.js +3 -0
- package/dist/native/esm/index.native.js +3 -0
- package/dist/native/esm/index.web.js +3 -0
- package/dist/native/esm/types/base.js +1 -0
- package/dist/native/esm/types/index.js +1 -0
- package/dist/native/tsconfig.native.cjs.tsbuildinfo +1 -0
- package/dist/native/tsconfig.native.esm.tsbuildinfo +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/hooks/useInteractiveState/useInteractiveState.native.d.ts +14 -2
- package/dist/types/hooks/useInteractiveState/useInteractiveState.native.d.ts.map +1 -1
- package/dist/types/hooks/useInteractiveState/useInteractiveState.types.d.ts +3 -9
- package/dist/types/hooks/useInteractiveState/useInteractiveState.types.d.ts.map +1 -1
- package/dist/types/hooks/useInteractiveState/useInteractiveState.web.d.ts +20 -2
- package/dist/types/hooks/useInteractiveState/useInteractiveState.web.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Universe = void 0;
|
|
4
|
+
exports.U = U;
|
|
5
|
+
const jsx_runtime_1 = require("nativewind/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const react_native_1 = require("react-native");
|
|
8
|
+
const context_1 = require("./context");
|
|
9
|
+
function U({ children, config }) {
|
|
10
|
+
const systemColorScheme = react_native_1.Appearance.getColorScheme() ?? 'light';
|
|
11
|
+
const [colorScheme, setColorScheme] = (0, react_1.useState)(config?.colorScheme ?? 'system');
|
|
12
|
+
const [locale, setLocale] = (0, react_1.useState)(config?.locale ?? 'en-US');
|
|
13
|
+
const value = (0, react_1.useMemo)(() => ({
|
|
14
|
+
colorScheme,
|
|
15
|
+
locale,
|
|
16
|
+
platform: 'native',
|
|
17
|
+
systemColorScheme,
|
|
18
|
+
setColorScheme,
|
|
19
|
+
setLocale,
|
|
20
|
+
}), [colorScheme, locale, systemColorScheme]);
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)(context_1.UniverseContext.Provider, { value: value, children: children }));
|
|
22
|
+
}
|
|
23
|
+
exports.Universe = U;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Universe = void 0;
|
|
4
|
+
exports.U = U;
|
|
5
|
+
const jsx_runtime_1 = require("nativewind/jsx-runtime");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const context_1 = require("./context");
|
|
8
|
+
function U({ children, config }) {
|
|
9
|
+
const [colorScheme, setColorScheme] = (0, react_1.useState)(config?.colorScheme ?? 'system');
|
|
10
|
+
const [locale, setLocale] = (0, react_1.useState)(config?.locale ?? 'en-US');
|
|
11
|
+
const value = (0, react_1.useMemo)(() => ({
|
|
12
|
+
colorScheme,
|
|
13
|
+
locale,
|
|
14
|
+
platform: 'web',
|
|
15
|
+
setColorScheme,
|
|
16
|
+
setLocale,
|
|
17
|
+
}), [colorScheme, locale]);
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(context_1.UniverseContext.Provider, { value: value, children: children }));
|
|
19
|
+
}
|
|
20
|
+
exports.Universe = U;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useUniverse = useUniverse;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("./context");
|
|
6
|
+
function useUniverse() {
|
|
7
|
+
return (0, react_1.useContext)(context_1.UniverseContext);
|
|
8
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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("./useAction/useAction.web"), exports);
|
|
18
|
+
__exportStar(require("./useCn"), exports);
|
|
19
|
+
__exportStar(require("./useInteractiveState/useInteractiveState.web"), exports);
|
|
20
|
+
__exportStar(require("./useOnChange"), exports);
|
|
21
|
+
__exportStar(require("./useProps"), exports);
|
|
@@ -0,0 +1,21 @@
|
|
|
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("./useAction/useAction.native"), exports);
|
|
18
|
+
__exportStar(require("./useCn"), exports);
|
|
19
|
+
__exportStar(require("./useInteractiveState/useInteractiveState.native"), exports);
|
|
20
|
+
__exportStar(require("./useOnChange"), exports);
|
|
21
|
+
__exportStar(require("./useProps"), exports);
|
|
@@ -0,0 +1,21 @@
|
|
|
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("./useAction/useAction.web"), exports);
|
|
18
|
+
__exportStar(require("./useCn"), exports);
|
|
19
|
+
__exportStar(require("./useInteractiveState/useInteractiveState.web"), exports);
|
|
20
|
+
__exportStar(require("./useOnChange"), exports);
|
|
21
|
+
__exportStar(require("./useProps"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAction = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useAction = ({ onClick, onPress, }) => {
|
|
6
|
+
return (0, react_1.useMemo)(() => ({
|
|
7
|
+
onAction: (event) => {
|
|
8
|
+
if (onPress) {
|
|
9
|
+
onPress(event);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (onClick) {
|
|
13
|
+
onClick(event);
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
}), [onClick, onPress]);
|
|
17
|
+
};
|
|
18
|
+
exports.useAction = useAction;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAction = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useAction = ({ onClick, onPress, preventDefault, }) => {
|
|
6
|
+
return (0, react_1.useMemo)(() => ({
|
|
7
|
+
onAction: (event) => {
|
|
8
|
+
if (preventDefault && event && 'preventDefault' in event) {
|
|
9
|
+
event.preventDefault();
|
|
10
|
+
}
|
|
11
|
+
if (onClick) {
|
|
12
|
+
onClick(event);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (onPress) {
|
|
16
|
+
onPress(event);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
}), [onClick, onPress, preventDefault]);
|
|
20
|
+
};
|
|
21
|
+
exports.useAction = useAction;
|
|
@@ -0,0 +1,15 @@
|
|
|
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.useCn = void 0;
|
|
7
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const tailwind_merge_1 = require("tailwind-merge");
|
|
10
|
+
const useCn = () => {
|
|
11
|
+
return (0, react_1.useMemo)(() => (...inputs) => {
|
|
12
|
+
return (0, tailwind_merge_1.twMerge)((0, clsx_1.default)(inputs));
|
|
13
|
+
}, []);
|
|
14
|
+
};
|
|
15
|
+
exports.useCn = useCn;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useInteractiveState = useInteractiveState;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
function useInteractiveState(options = {}) {
|
|
6
|
+
const { disabled } = options;
|
|
7
|
+
const [pressed, setPressed] = (0, react_1.useState)(false);
|
|
8
|
+
const state = disabled
|
|
9
|
+
? 'disabled'
|
|
10
|
+
: pressed
|
|
11
|
+
? 'pressed'
|
|
12
|
+
: 'idle';
|
|
13
|
+
const dataAttrs = {
|
|
14
|
+
'data-state': state,
|
|
15
|
+
'data-pressed': pressed ? 'true' : 'false',
|
|
16
|
+
'data-disabled': disabled ? 'true' : 'false',
|
|
17
|
+
};
|
|
18
|
+
const eventHandlers = {
|
|
19
|
+
onPressIn: (e) => {
|
|
20
|
+
if (disabled)
|
|
21
|
+
return;
|
|
22
|
+
setPressed(true);
|
|
23
|
+
},
|
|
24
|
+
onPressOut: (e) => {
|
|
25
|
+
if (disabled)
|
|
26
|
+
return;
|
|
27
|
+
setPressed(false);
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
return { state, dataAttrs, eventHandlers };
|
|
31
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useInteractiveState = useInteractiveState;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
function useInteractiveState(options = {}) {
|
|
6
|
+
const { disabled } = options;
|
|
7
|
+
const [hovered, setHovered] = (0, react_1.useState)(false);
|
|
8
|
+
const [pressed, setPressed] = (0, react_1.useState)(false);
|
|
9
|
+
const [focused, setFocused] = (0, react_1.useState)(false);
|
|
10
|
+
const state = disabled
|
|
11
|
+
? 'disabled'
|
|
12
|
+
: pressed
|
|
13
|
+
? 'pressed'
|
|
14
|
+
: hovered
|
|
15
|
+
? 'hovered'
|
|
16
|
+
: focused
|
|
17
|
+
? 'focused'
|
|
18
|
+
: 'idle';
|
|
19
|
+
const dataAttrs = {
|
|
20
|
+
'data-state': state,
|
|
21
|
+
'data-hovered': hovered ? 'true' : 'false',
|
|
22
|
+
'data-pressed': pressed ? 'true' : 'false',
|
|
23
|
+
'data-focused': focused ? 'true' : 'false',
|
|
24
|
+
'data-disabled': disabled ? 'true' : 'false',
|
|
25
|
+
};
|
|
26
|
+
const eventHandlers = {
|
|
27
|
+
onMouseEnter: () => {
|
|
28
|
+
if (disabled)
|
|
29
|
+
return;
|
|
30
|
+
setHovered(true);
|
|
31
|
+
},
|
|
32
|
+
onMouseLeave: () => {
|
|
33
|
+
if (disabled)
|
|
34
|
+
return;
|
|
35
|
+
setHovered(false);
|
|
36
|
+
setPressed(false);
|
|
37
|
+
},
|
|
38
|
+
onMouseDown: (e) => {
|
|
39
|
+
if (disabled || e.button !== 0)
|
|
40
|
+
return;
|
|
41
|
+
setPressed(true);
|
|
42
|
+
},
|
|
43
|
+
onMouseUp: () => {
|
|
44
|
+
if (disabled)
|
|
45
|
+
return;
|
|
46
|
+
setPressed(false);
|
|
47
|
+
},
|
|
48
|
+
onFocus: () => {
|
|
49
|
+
if (disabled)
|
|
50
|
+
return;
|
|
51
|
+
setFocused(true);
|
|
52
|
+
},
|
|
53
|
+
onBlur: () => {
|
|
54
|
+
if (disabled)
|
|
55
|
+
return;
|
|
56
|
+
setFocused(false);
|
|
57
|
+
setPressed(false);
|
|
58
|
+
setHovered(false);
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
return { state, dataAttrs, eventHandlers };
|
|
62
|
+
}
|
|
@@ -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,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 { useAction, useCn } from '../../hooks/index.native';
|
|
4
|
+
import { E } from '../e/index.native';
|
|
5
|
+
export function A({ className, children, onPress, onClick, disabled, ref, ...rest }) {
|
|
6
|
+
const cn = useCn();
|
|
7
|
+
const { onAction } = useAction({
|
|
8
|
+
onClick,
|
|
9
|
+
onPress,
|
|
10
|
+
});
|
|
11
|
+
return (_jsx(Pressable, { ref: ref, onPress: onAction, disabled: disabled, ...rest, children: _jsx(E, { className: cn(disabled && 'opacity-60', className), children: children }) }));
|
|
12
|
+
}
|
|
13
|
+
export const Action = A;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { useAction, useCn } from '../../hooks/index.web';
|
|
3
|
+
export function A({ className, children, onPress, onClick, disabled, ref, ...rest }) {
|
|
4
|
+
const cn = useCn();
|
|
5
|
+
const { onAction } = useAction({
|
|
6
|
+
onClick,
|
|
7
|
+
onPress,
|
|
8
|
+
});
|
|
9
|
+
return (_jsx("button", { ref: ref, type: "button", disabled: disabled, className: cn('cursor-pointer', disabled && 'opacity-60', className), onClick: onAction, ...rest, 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/index.native';
|
|
4
|
+
import { E } from '../e/index.native';
|
|
5
|
+
export function D({ open, onOpenChange, placement = 'center', className, backdropClassName, containerClassName, contentClassName, children, ref, ...rest }) {
|
|
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' : '', className, contentClassName);
|
|
16
|
+
const handleRequestClose = (e) => {
|
|
17
|
+
onOpenChange?.(false);
|
|
18
|
+
if (typeof rest.onRequestClose === 'function') {
|
|
19
|
+
rest.onRequestClose?.(e);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
return (_jsx(Modal, { visible: open, animationType: "slide", transparent: true, onRequestClose: handleRequestClose, ...rest, children: _jsx(E, { className: containerClasses, children: _jsx(E, { ref: ref, className: contentClasses, children: children }) }) }));
|
|
23
|
+
}
|
|
24
|
+
export const Dialog = D;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
import { useCn } from '../../hooks/index.web';
|
|
4
|
+
import { E } from '../e/index.web';
|
|
5
|
+
export function D({ open, onOpenChange, placement = 'center', className, backdropClassName, containerClassName, contentClassName, closeOnBackdropClick = true, children, ref, ...rest }) {
|
|
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' : '', className, contentClassName);
|
|
27
|
+
return createPortal(_jsx(E, { className: backdropClasses, role: "presentation", onClick: handleBackdropClick, children: _jsx("div", { ref: ref,
|
|
28
|
+
// biome-ignore lint/a11y/useSemanticElements: <explanation>
|
|
29
|
+
role: "dialog", "aria-modal": "true", className: contentClasses, ...rest, children: children }) }), document.body);
|
|
30
|
+
}
|
|
31
|
+
export const Dialog = D;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './d.native';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './d.web';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { useAction, useCn } from '../../hooks/index.native';
|
|
4
|
+
import { T } from '../t/index.native';
|
|
5
|
+
export function E({ className, children, onPress, onClick, ref, ...rest }) {
|
|
6
|
+
const cn = useCn();
|
|
7
|
+
const { onAction } = useAction({
|
|
8
|
+
onClick,
|
|
9
|
+
onPress,
|
|
10
|
+
});
|
|
11
|
+
const handleOnPress = () => {
|
|
12
|
+
onAction();
|
|
13
|
+
return false;
|
|
14
|
+
};
|
|
15
|
+
return (_jsx(View, { ref: ref, className: cn(className), onStartShouldSetResponder: handleOnPress, ...rest, children: typeof children === 'string' ? _jsx(T, { children: children }) : children }));
|
|
16
|
+
}
|
|
17
|
+
export const Element = E;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { useAction, useCn } from '../../hooks/index.web';
|
|
3
|
+
export function E({ className, children, onPress, onClick, ref, ...rest }) {
|
|
4
|
+
const cn = useCn();
|
|
5
|
+
const { onAction } = useAction({
|
|
6
|
+
onClick,
|
|
7
|
+
onPress,
|
|
8
|
+
});
|
|
9
|
+
return (_jsx("div", { ref: ref, className: cn(className), onClick: onAction, ...rest, 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,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { TextInput } from 'react-native';
|
|
3
|
+
import { useCn, useOnChange } from '../../hooks/index.native';
|
|
4
|
+
import { useIUtils } from './useIUtils';
|
|
5
|
+
export function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, editable, disabled, ref, ...rest }) {
|
|
6
|
+
const { treatTypeModeAndKeyboardType } = useIUtils();
|
|
7
|
+
const cn = useCn();
|
|
8
|
+
const { onChange: handleOnChange } = useOnChange({
|
|
9
|
+
onChange,
|
|
10
|
+
onChangeValue,
|
|
11
|
+
});
|
|
12
|
+
const effectiveEditable = editable ?? !disabled;
|
|
13
|
+
const { masterInputType, masterInputKeyboardType } = treatTypeModeAndKeyboardType({
|
|
14
|
+
inputMode,
|
|
15
|
+
keyboardType,
|
|
16
|
+
type,
|
|
17
|
+
});
|
|
18
|
+
const handleChange = (event) => {
|
|
19
|
+
if (onChange)
|
|
20
|
+
onChange(event);
|
|
21
|
+
if (onChangeValue)
|
|
22
|
+
onChangeValue(event.nativeEvent.text);
|
|
23
|
+
};
|
|
24
|
+
return (_jsx(TextInput, { ref: ref, className: cn(!effectiveEditable && 'opacity-60', className), value: value, defaultValue: defaultValue, placeholder: placeholder, onChange: handleChange, secureTextEntry: masterInputType === 'password', keyboardType: masterInputKeyboardType, editable: effectiveEditable, ...rest }));
|
|
25
|
+
}
|
|
26
|
+
export const Input = I;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "nativewind/jsx-runtime";
|
|
2
|
+
import { useCn, useOnChange } from '../../hooks/index.web';
|
|
3
|
+
import { useIUtils } from './useIUtils';
|
|
4
|
+
export function I({ className, value, defaultValue, placeholder, onChange, onChangeValue, type, inputMode, keyboardType, disabled, editable, ref, ...rest }) {
|
|
5
|
+
const { treatTypeModeAndKeyboardType } = useIUtils();
|
|
6
|
+
const cn = useCn();
|
|
7
|
+
const { onChange: handleOnChange } = useOnChange({
|
|
8
|
+
onChange,
|
|
9
|
+
onChangeValue,
|
|
10
|
+
});
|
|
11
|
+
const effectiveDisabled = disabled || editable === false;
|
|
12
|
+
const { masterInputType, masterInputMode } = treatTypeModeAndKeyboardType({
|
|
13
|
+
inputMode,
|
|
14
|
+
keyboardType,
|
|
15
|
+
type,
|
|
16
|
+
});
|
|
17
|
+
return (_jsx("input", { ref: ref, type: masterInputType, inputMode: masterInputMode, className: cn('outline-none', effectiveDisabled && 'opacity-60 cursor-not-allowed', className), value: value, defaultValue: defaultValue, placeholder: placeholder, onChange: handleOnChange, disabled: effectiveDisabled, ...rest }));
|
|
18
|
+
}
|
|
19
|
+
export const Input = I;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './i.native';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './i.web';
|