@korsolutions/ui 0.0.56 → 0.0.57
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/module/components/index.js +1 -0
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/components/touchable/index.js +4 -0
- package/dist/module/components/touchable/index.js.map +1 -0
- package/dist/module/components/touchable/touchable.js +46 -0
- package/dist/module/components/touchable/touchable.js.map +1 -0
- package/dist/module/components/touchable/types.js +4 -0
- package/dist/module/components/touchable/types.js.map +1 -0
- package/dist/module/components/touchable/variants/default.js +22 -0
- package/dist/module/components/touchable/variants/default.js.map +1 -0
- package/dist/module/components/touchable/variants/index.js +7 -0
- package/dist/module/components/touchable/variants/index.js.map +1 -0
- package/dist/typescript/src/components/index.d.ts +1 -0
- package/dist/typescript/src/components/index.d.ts.map +1 -1
- package/dist/typescript/src/components/touchable/index.d.ts +2 -0
- package/dist/typescript/src/components/touchable/index.d.ts.map +1 -0
- package/dist/typescript/src/components/touchable/touchable.d.ts +13 -0
- package/dist/typescript/src/components/touchable/touchable.d.ts.map +1 -0
- package/dist/typescript/src/components/touchable/types.d.ts +4 -0
- package/dist/typescript/src/components/touchable/types.d.ts.map +1 -0
- package/dist/typescript/src/components/touchable/variants/default.d.ts +3 -0
- package/dist/typescript/src/components/touchable/variants/default.d.ts.map +1 -0
- package/dist/typescript/src/components/touchable/variants/index.d.ts +4 -0
- package/dist/typescript/src/components/touchable/variants/index.d.ts.map +1 -0
- package/package.json +6 -2
- package/src/components/index.ts +1 -0
- package/src/components/touchable/index.ts +1 -0
- package/src/components/touchable/touchable.tsx +71 -0
- package/src/components/touchable/types.ts +5 -0
- package/src/components/touchable/variants/default.tsx +19 -0
- package/src/components/touchable/variants/index.ts +5 -0
|
@@ -24,5 +24,6 @@ export * from "./select/index.js";
|
|
|
24
24
|
export * from "./tabs/index.js";
|
|
25
25
|
export * from "./textarea/index.js";
|
|
26
26
|
export * from "./toast/index.js";
|
|
27
|
+
export * from "./touchable/index.js";
|
|
27
28
|
export * from "./typography/index.js";
|
|
28
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA,cAAc,kBAAS;AACvB,cAAc,yBAAgB;AAC9B,cAAc,mBAAU;AACxB,cAAc,kBAAS;AACvB,cAAc,mBAAU;AACxB,cAAc,qBAAY;AAC1B,cAAc,iBAAQ;AACtB,cAAc,qBAAY;AAC1B,cAAc,kBAAS;AACvB,cAAc,kBAAS;AACvB,cAAc,iBAAQ;AACtB,cAAc,kBAAS;AACvB,cAAc,iBAAQ;AACtB,cAAc,iBAAQ;AACtB,cAAc,iBAAQ;AACtB,cAAc,wBAAe;AAC7B,cAAc,oBAAW;AACzB,cAAc,mBAAU;AACxB,cAAc,qBAAY;AAC1B,cAAc,uBAAc;AAC5B,cAAc,mBAAU;AACxB,cAAc,iBAAQ;AACtB,cAAc,qBAAY;AAC1B,cAAc,kBAAS;AACvB,cAAc,uBAAc","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA,cAAc,kBAAS;AACvB,cAAc,yBAAgB;AAC9B,cAAc,mBAAU;AACxB,cAAc,kBAAS;AACvB,cAAc,mBAAU;AACxB,cAAc,qBAAY;AAC1B,cAAc,iBAAQ;AACtB,cAAc,qBAAY;AAC1B,cAAc,kBAAS;AACvB,cAAc,kBAAS;AACvB,cAAc,iBAAQ;AACtB,cAAc,kBAAS;AACvB,cAAc,iBAAQ;AACtB,cAAc,iBAAQ;AACtB,cAAc,iBAAQ;AACtB,cAAc,wBAAe;AAC7B,cAAc,oBAAW;AACzB,cAAc,mBAAU;AACxB,cAAc,qBAAY;AAC1B,cAAc,uBAAc;AAC5B,cAAc,mBAAU;AACxB,cAAc,iBAAQ;AACtB,cAAc,qBAAY;AAC1B,cAAc,kBAAS;AACvB,cAAc,sBAAa;AAC3B,cAAc,uBAAc","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Touchable"],"sourceRoot":"../../../../src","sources":["components/touchable/index.ts"],"mappings":";;AAAA,SAASA,SAAS,QAA6B,gBAAa","ignoreList":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useState } from "react";
|
|
4
|
+
import { Pressable } from "react-native";
|
|
5
|
+
import { PressableVariants } from "./variants/index.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const calculateState = (props, isPressed, isHovered) => {
|
|
8
|
+
if (props.isDisabled) return "disabled";
|
|
9
|
+
if (isPressed) return "pressed";
|
|
10
|
+
if (isHovered) return "hovered";
|
|
11
|
+
return "default";
|
|
12
|
+
};
|
|
13
|
+
export function Touchable(props) {
|
|
14
|
+
const {
|
|
15
|
+
variant = "default",
|
|
16
|
+
isDisabled,
|
|
17
|
+
style,
|
|
18
|
+
children,
|
|
19
|
+
...rest
|
|
20
|
+
} = props;
|
|
21
|
+
const variantStyles = PressableVariants[variant]();
|
|
22
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
23
|
+
const handlePress = event => {
|
|
24
|
+
if (isDisabled) return;
|
|
25
|
+
rest.onPress?.(event);
|
|
26
|
+
};
|
|
27
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
28
|
+
...rest,
|
|
29
|
+
onPress: handlePress,
|
|
30
|
+
onHoverIn: e => {
|
|
31
|
+
setIsHovered(true);
|
|
32
|
+
rest.onHoverIn?.(e);
|
|
33
|
+
},
|
|
34
|
+
onHoverOut: e => {
|
|
35
|
+
setIsHovered(false);
|
|
36
|
+
rest.onHoverOut?.(e);
|
|
37
|
+
},
|
|
38
|
+
disabled: isDisabled,
|
|
39
|
+
style: styleState => {
|
|
40
|
+
const currentState = calculateState(props, styleState.pressed, isHovered);
|
|
41
|
+
return [variantStyles?.default, variantStyles?.[currentState], style ? style(styleState) : null];
|
|
42
|
+
},
|
|
43
|
+
children: children
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=touchable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useState","Pressable","PressableVariants","jsx","_jsx","calculateState","props","isPressed","isHovered","isDisabled","Touchable","variant","style","children","rest","variantStyles","setIsHovered","handlePress","event","onPress","onHoverIn","e","onHoverOut","disabled","styleState","currentState","pressed","default"],"sourceRoot":"../../../../src","sources":["components/touchable/touchable.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SACEC,SAAS,QAIJ,cAAc;AAErB,SAASC,iBAAiB,QAAQ,qBAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAW/C,MAAMC,cAAc,GAAGA,CACrBC,KAAqB,EACrBC,SAAkB,EAClBC,SAAkB,KACC;EACnB,IAAIF,KAAK,CAACG,UAAU,EAAE,OAAO,UAAU;EACvC,IAAIF,SAAS,EAAE,OAAO,SAAS;EAC/B,IAAIC,SAAS,EAAE,OAAO,SAAS;EAC/B,OAAO,SAAS;AAClB,CAAC;AAED,OAAO,SAASE,SAASA,CAACJ,KAAqB,EAAE;EAC/C,MAAM;IAAEK,OAAO,GAAG,SAAS;IAAEF,UAAU;IAAEG,KAAK;IAAEC,QAAQ;IAAE,GAAGC;EAAK,CAAC,GAAGR,KAAK;EAC3E,MAAMS,aAAa,GAAGb,iBAAiB,CAACS,OAAO,CAAC,CAAC,CAAC;EAClD,MAAM,CAACH,SAAS,EAAEQ,YAAY,CAAC,GAAGhB,QAAQ,CAAC,KAAK,CAAC;EAEjD,MAAMiB,WAAsC,GAAIC,KAAK,IAAK;IACxD,IAAIT,UAAU,EAAE;IAChBK,IAAI,CAACK,OAAO,GAAGD,KAAK,CAAC;EACvB,CAAC;EAED,oBACEd,IAAA,CAACH,SAAS;IAAA,GACJa,IAAI;IACRK,OAAO,EAAEF,WAAY;IACrBG,SAAS,EAAGC,CAAC,IAAK;MAChBL,YAAY,CAAC,IAAI,CAAC;MAClBF,IAAI,CAACM,SAAS,GAAGC,CAAC,CAAC;IACrB,CAAE;IACFC,UAAU,EAAGD,CAAC,IAAK;MACjBL,YAAY,CAAC,KAAK,CAAC;MACnBF,IAAI,CAACQ,UAAU,GAAGD,CAAC,CAAC;IACtB,CAAE;IACFE,QAAQ,EAAEd,UAAW;IACrBG,KAAK,EAAGY,UAAU,IAAK;MACrB,MAAMC,YAAY,GAAGpB,cAAc,CACjCC,KAAK,EACLkB,UAAU,CAACE,OAAO,EAClBlB,SACF,CAAC;MAED,OAAO,CACLO,aAAa,EAAEY,OAAO,EACtBZ,aAAa,GAAGU,YAAY,CAAC,EAC7Bb,KAAK,GAAGA,KAAK,CAACY,UAAU,CAAC,GAAG,IAAI,CACjC;IACH,CAAE;IAAAX,QAAA,EAEDA;EAAQ,CACA,CAAC;AAEhB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/touchable/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const usePressableVariantDefault = () => {
|
|
4
|
+
return {
|
|
5
|
+
default: {
|
|
6
|
+
cursor: "pointer"
|
|
7
|
+
},
|
|
8
|
+
pressed: {
|
|
9
|
+
opacity: 0.8,
|
|
10
|
+
transform: [{
|
|
11
|
+
scale: 0.98
|
|
12
|
+
}]
|
|
13
|
+
},
|
|
14
|
+
hovered: {
|
|
15
|
+
opacity: 0.9
|
|
16
|
+
},
|
|
17
|
+
disabled: {
|
|
18
|
+
cursor: "not-allowed"
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=default.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["usePressableVariantDefault","default","cursor","pressed","opacity","transform","scale","hovered","disabled"],"sourceRoot":"../../../../../src","sources":["components/touchable/variants/default.tsx"],"mappings":";;AAEA,OAAO,MAAMA,0BAA0B,GAAGA,CAAA,KAAuB;EAC/D,OAAO;IACLC,OAAO,EAAE;MACPC,MAAM,EAAE;IACV,CAAC;IACDC,OAAO,EAAE;MACPC,OAAO,EAAE,GAAG;MACZC,SAAS,EAAE,CAAC;QAAEC,KAAK,EAAE;MAAK,CAAC;IAC7B,CAAC;IACDC,OAAO,EAAE;MACPH,OAAO,EAAE;IACX,CAAC;IACDI,QAAQ,EAAE;MACRN,MAAM,EAAE;IACV;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["usePressableVariantDefault","PressableVariants","default"],"sourceRoot":"../../../../../src","sources":["components/touchable/variants/index.ts"],"mappings":";;AAAA,SAASA,0BAA0B,QAAQ,cAAW;AAEtD,OAAO,MAAMC,iBAAiB,GAAG;EAC/BC,OAAO,EAAEF;AACX,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/touchable/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type PressableProps, type PressableStateCallbackType, type ViewStyle } from "react-native";
|
|
3
|
+
import { PressableVariants } from "./variants";
|
|
4
|
+
type ExtendablePressableProps = Omit<PressableProps, "style" | "disabled">;
|
|
5
|
+
export interface TouchableProps extends ExtendablePressableProps {
|
|
6
|
+
variant?: keyof typeof PressableVariants;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
isDisabled?: boolean;
|
|
9
|
+
style?: (state: PressableStateCallbackType) => ViewStyle;
|
|
10
|
+
}
|
|
11
|
+
export declare function Touchable(props: TouchableProps): React.JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=touchable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"touchable.d.ts","sourceRoot":"","sources":["../../../../../src/components/touchable/touchable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAC/B,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,KAAK,wBAAwB,GAAG,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,UAAU,CAAC,CAAC;AAE3E,MAAM,WAAW,cAAe,SAAQ,wBAAwB;IAC9D,OAAO,CAAC,EAAE,MAAM,OAAO,iBAAiB,CAAC;IACzC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,0BAA0B,KAAK,SAAS,CAAC;CAC1D;AAaD,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,qBAwC9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/touchable/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;AAE5E,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../../../../src/components/touchable/variants/default.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,eAAO,MAAM,0BAA0B,QAAO,eAgB7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/touchable/variants/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB;;CAE7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@korsolutions/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.57",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,12 +29,16 @@
|
|
|
29
29
|
"@types/react": "^19.2.3",
|
|
30
30
|
"@types/react-dom": "^19.2.3",
|
|
31
31
|
"react-native-builder-bob": "^0.40.17",
|
|
32
|
+
"react-native-reanimated": "catalog:",
|
|
33
|
+
"react-native-worklets": "catalog:",
|
|
32
34
|
"typescript": "^5.9.3"
|
|
33
35
|
},
|
|
34
36
|
"peerDependencies": {
|
|
35
37
|
"react": "*",
|
|
36
38
|
"react-dom": "*",
|
|
37
39
|
"react-native": "*",
|
|
38
|
-
"react-native-
|
|
40
|
+
"react-native-reanimated": "*",
|
|
41
|
+
"react-native-web": "*",
|
|
42
|
+
"react-native-worklets": "*"
|
|
39
43
|
}
|
|
40
44
|
}
|
package/src/components/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Touchable, type TouchableProps } from "./touchable";
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Pressable,
|
|
4
|
+
type PressableProps,
|
|
5
|
+
type PressableStateCallbackType,
|
|
6
|
+
type ViewStyle,
|
|
7
|
+
} from "react-native";
|
|
8
|
+
import type { PressableState } from "./types";
|
|
9
|
+
import { PressableVariants } from "./variants";
|
|
10
|
+
|
|
11
|
+
type ExtendablePressableProps = Omit<PressableProps, "style" | "disabled">;
|
|
12
|
+
|
|
13
|
+
export interface TouchableProps extends ExtendablePressableProps {
|
|
14
|
+
variant?: keyof typeof PressableVariants;
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
isDisabled?: boolean;
|
|
17
|
+
style?: (state: PressableStateCallbackType) => ViewStyle;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const calculateState = (
|
|
21
|
+
props: TouchableProps,
|
|
22
|
+
isPressed: boolean,
|
|
23
|
+
isHovered: boolean,
|
|
24
|
+
): PressableState => {
|
|
25
|
+
if (props.isDisabled) return "disabled";
|
|
26
|
+
if (isPressed) return "pressed";
|
|
27
|
+
if (isHovered) return "hovered";
|
|
28
|
+
return "default";
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export function Touchable(props: TouchableProps) {
|
|
32
|
+
const { variant = "default", isDisabled, style, children, ...rest } = props;
|
|
33
|
+
const variantStyles = PressableVariants[variant]();
|
|
34
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
35
|
+
|
|
36
|
+
const handlePress: PressableProps["onPress"] = (event) => {
|
|
37
|
+
if (isDisabled) return;
|
|
38
|
+
rest.onPress?.(event);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Pressable
|
|
43
|
+
{...rest}
|
|
44
|
+
onPress={handlePress}
|
|
45
|
+
onHoverIn={(e) => {
|
|
46
|
+
setIsHovered(true);
|
|
47
|
+
rest.onHoverIn?.(e);
|
|
48
|
+
}}
|
|
49
|
+
onHoverOut={(e) => {
|
|
50
|
+
setIsHovered(false);
|
|
51
|
+
rest.onHoverOut?.(e);
|
|
52
|
+
}}
|
|
53
|
+
disabled={isDisabled}
|
|
54
|
+
style={(styleState) => {
|
|
55
|
+
const currentState = calculateState(
|
|
56
|
+
props,
|
|
57
|
+
styleState.pressed,
|
|
58
|
+
isHovered,
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
return [
|
|
62
|
+
variantStyles?.default,
|
|
63
|
+
variantStyles?.[currentState],
|
|
64
|
+
style ? style(styleState) : null,
|
|
65
|
+
];
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
{children}
|
|
69
|
+
</Pressable>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PressableStyles } from "../types";
|
|
2
|
+
|
|
3
|
+
export const usePressableVariantDefault = (): PressableStyles => {
|
|
4
|
+
return {
|
|
5
|
+
default: {
|
|
6
|
+
cursor: "pointer",
|
|
7
|
+
},
|
|
8
|
+
pressed: {
|
|
9
|
+
opacity: 0.8,
|
|
10
|
+
transform: [{ scale: 0.98 }],
|
|
11
|
+
},
|
|
12
|
+
hovered: {
|
|
13
|
+
opacity: 0.9,
|
|
14
|
+
},
|
|
15
|
+
disabled: {
|
|
16
|
+
cursor: "not-allowed" as any,
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
};
|