@kivid/native-components 1.0.0-alpha.7 → 1.0.0-alpha.9
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/commonjs/components/Avatar/index.js +5 -4
- package/dist/commonjs/components/Avatar/index.js.map +1 -1
- package/dist/commonjs/components/Button/index.js +2 -1
- package/dist/commonjs/components/Button/index.js.map +1 -1
- package/dist/commonjs/components/ChatBubble/assets/class-variants.js +6 -6
- package/dist/commonjs/components/ChatBubble/assets/class-variants.js.map +1 -1
- package/dist/commonjs/components/ChatBubble/components/ChatBubbleSeal/index.js +3 -3
- package/dist/commonjs/components/ChatBubble/components/ChatBubbleSeal/index.js.map +1 -1
- package/dist/commonjs/components/ChatBubble/components/ChatBubbleText/index.js +2 -2
- package/dist/commonjs/components/ChatBubble/components/ChatBubbleText/index.js.map +1 -1
- package/dist/commonjs/components/ChatBubble/index.js +14 -9
- package/dist/commonjs/components/ChatBubble/index.js.map +1 -1
- package/dist/commonjs/components/ListButton/assets/class-variants.js +1 -1
- package/dist/commonjs/components/ListButton/assets/class-variants.js.map +1 -1
- package/dist/commonjs/components/ListButton/index.js +22 -13
- package/dist/commonjs/components/ListButton/index.js.map +1 -1
- package/dist/commonjs/components/PasswordInput/index.js +42 -0
- package/dist/commonjs/components/PasswordInput/index.js.map +1 -0
- package/dist/commonjs/components/PasswordInput/types.js +6 -0
- package/dist/commonjs/components/PasswordInput/types.js.map +1 -0
- package/dist/commonjs/components/TextInput/assets/class-variants.js +1 -1
- package/dist/commonjs/components/TextInput/assets/class-variants.js.map +1 -1
- package/dist/commonjs/components/TextInput/index.js +13 -2
- package/dist/commonjs/components/TextInput/index.js.map +1 -1
- package/dist/commonjs/components/Title/components/icon/types.js +0 -9
- package/dist/commonjs/components/Title/components/icon/types.js.map +1 -1
- package/dist/commonjs/components/index.js +11 -0
- package/dist/commonjs/components/index.js.map +1 -1
- package/dist/commonjs/enums/index.js +11 -0
- package/dist/commonjs/enums/index.js.map +1 -1
- package/dist/commonjs/enums/state-variant.js +15 -0
- package/dist/commonjs/enums/state-variant.js.map +1 -0
- package/dist/module/components/Avatar/index.js +5 -4
- package/dist/module/components/Avatar/index.js.map +1 -1
- package/dist/module/components/Button/index.js +2 -1
- package/dist/module/components/Button/index.js.map +1 -1
- package/dist/module/components/ChatBubble/assets/class-variants.js +6 -6
- package/dist/module/components/ChatBubble/assets/class-variants.js.map +1 -1
- package/dist/module/components/ChatBubble/components/ChatBubbleSeal/index.js +3 -3
- package/dist/module/components/ChatBubble/components/ChatBubbleSeal/index.js.map +1 -1
- package/dist/module/components/ChatBubble/components/ChatBubbleText/index.js +2 -2
- package/dist/module/components/ChatBubble/components/ChatBubbleText/index.js.map +1 -1
- package/dist/module/components/ChatBubble/index.js +14 -9
- package/dist/module/components/ChatBubble/index.js.map +1 -1
- package/dist/module/components/ListButton/assets/class-variants.js +1 -1
- package/dist/module/components/ListButton/assets/class-variants.js.map +1 -1
- package/dist/module/components/ListButton/index.js +22 -13
- package/dist/module/components/ListButton/index.js.map +1 -1
- package/dist/module/components/PasswordInput/index.js +37 -0
- package/dist/module/components/PasswordInput/index.js.map +1 -0
- package/dist/module/components/PasswordInput/types.js +4 -0
- package/dist/module/components/PasswordInput/types.js.map +1 -0
- package/dist/module/components/TextInput/assets/class-variants.js +1 -1
- package/dist/module/components/TextInput/assets/class-variants.js.map +1 -1
- package/dist/module/components/TextInput/index.js +13 -2
- package/dist/module/components/TextInput/index.js.map +1 -1
- package/dist/module/components/Title/components/icon/types.js +1 -8
- package/dist/module/components/Title/components/icon/types.js.map +1 -1
- package/dist/module/components/index.js +1 -0
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/enums/index.js +1 -0
- package/dist/module/enums/index.js.map +1 -1
- package/dist/module/enums/state-variant.js +11 -0
- package/dist/module/enums/state-variant.js.map +1 -0
- package/dist/typescript/components/Avatar/types.d.ts +1 -0
- package/dist/typescript/components/ChatBubble/assets/class-variants.d.ts +1 -1
- package/dist/typescript/components/ChatBubble/contexts/ChatBubbleContext/types.d.ts +1 -1
- package/dist/typescript/components/ChatBubble/types.d.ts +2 -1
- package/dist/typescript/components/Chip/assets/class-variants.d.ts +1 -1
- package/dist/typescript/components/ListButton/types.d.ts +2 -1
- package/dist/typescript/components/PasswordInput/index.d.ts +2 -0
- package/dist/typescript/components/PasswordInput/types.d.ts +3 -0
- package/dist/typescript/components/Seal/assets/class-variants.d.ts +1 -1
- package/dist/typescript/components/TextInput/index.d.ts +1 -1
- package/dist/typescript/components/TextInput/types.d.ts +3 -0
- package/dist/typescript/components/Title/components/icon/types.d.ts +2 -9
- package/dist/typescript/components/Tooltip/types.d.ts +0 -1
- package/dist/typescript/components/index.d.ts +2 -0
- package/dist/typescript/enums/index.d.ts +1 -0
- package/dist/typescript/enums/state-variant.d.ts +7 -0
- package/package.json +5 -5
- package/src/components/Avatar/index.tsx +4 -4
- package/src/components/Avatar/types.ts +1 -0
- package/src/components/Button/index.tsx +2 -1
- package/src/components/ChatBubble/assets/class-variants.ts +6 -6
- package/src/components/ChatBubble/components/ChatBubbleSeal/index.tsx +3 -3
- package/src/components/ChatBubble/components/ChatBubbleText/index.tsx +2 -2
- package/src/components/ChatBubble/contexts/ChatBubbleContext/types.ts +1 -1
- package/src/components/ChatBubble/index.tsx +14 -11
- package/src/components/ChatBubble/types.ts +2 -1
- package/src/components/ListButton/assets/class-variants.ts +1 -1
- package/src/components/ListButton/index.tsx +27 -26
- package/src/components/ListButton/types.ts +2 -1
- package/src/components/PasswordInput/index.tsx +37 -0
- package/src/components/PasswordInput/types.ts +4 -0
- package/src/components/TextInput/assets/class-variants.ts +1 -1
- package/src/components/TextInput/index.tsx +16 -2
- package/src/components/TextInput/types.ts +3 -0
- package/src/components/Title/components/icon/types.ts +2 -10
- package/src/components/Tooltip/types.ts +0 -1
- package/src/components/index.ts +3 -0
- package/src/enums/index.ts +1 -0
- package/src/enums/state-variant.ts +7 -0
|
@@ -4,10 +4,7 @@ import { ListButtonVariantEnum } from "./enums";
|
|
|
4
4
|
import { SizeEnum, CornersEnum } from "../../enums";
|
|
5
5
|
import type { ListButtonProps } from "./types";
|
|
6
6
|
import { ChevronRight } from "@kivid/icons/native";
|
|
7
|
-
import {
|
|
8
|
-
buttonVariants,
|
|
9
|
-
textVariants,
|
|
10
|
-
} from "./assets/class-variants";
|
|
7
|
+
import { buttonVariants, textVariants } from "./assets/class-variants";
|
|
11
8
|
import { merge } from "@kivid/tailwind-preset";
|
|
12
9
|
import { useRef } from "react";
|
|
13
10
|
|
|
@@ -24,6 +21,7 @@ export function ListButton(props: ListButtonProps) {
|
|
|
24
21
|
iconLeftContainerClassName,
|
|
25
22
|
iconRightContainerClassName,
|
|
26
23
|
accessibilityLabel,
|
|
24
|
+
numberOfLines = 1,
|
|
27
25
|
onPressIn,
|
|
28
26
|
onPressOut,
|
|
29
27
|
...rest
|
|
@@ -63,20 +61,24 @@ export function ListButton(props: ListButtonProps) {
|
|
|
63
61
|
onPressOut?.(event);
|
|
64
62
|
};
|
|
65
63
|
|
|
64
|
+
function renderLeftIcon() {
|
|
65
|
+
if (iconLeft) {
|
|
66
|
+
return <View className="mr-400">{iconLeft}</View>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
66
72
|
function renderRightIcon() {
|
|
67
73
|
if (iconRight) {
|
|
68
|
-
return
|
|
69
|
-
<View className="ml-400">
|
|
70
|
-
{iconRight}
|
|
71
|
-
</View>
|
|
72
|
-
)
|
|
74
|
+
return <View className="ml-400">{iconRight}</View>;
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
return (
|
|
76
|
-
<View className="
|
|
78
|
+
<View className="ml-400">
|
|
77
79
|
<ChevronRight color={chevronIconColor} />
|
|
78
80
|
</View>
|
|
79
|
-
)
|
|
81
|
+
);
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
return (
|
|
@@ -84,36 +86,35 @@ export function ListButton(props: ListButtonProps) {
|
|
|
84
86
|
style={{
|
|
85
87
|
opacity: animatedValue,
|
|
86
88
|
}}
|
|
89
|
+
className={merge(
|
|
90
|
+
buttonVariants({
|
|
91
|
+
variant,
|
|
92
|
+
size,
|
|
93
|
+
corners,
|
|
94
|
+
}),
|
|
95
|
+
className
|
|
96
|
+
)}
|
|
87
97
|
>
|
|
88
98
|
<Pressable
|
|
89
|
-
className={merge(
|
|
90
|
-
buttonVariants({
|
|
91
|
-
variant,
|
|
92
|
-
size,
|
|
93
|
-
corners,
|
|
94
|
-
}),
|
|
95
|
-
className
|
|
96
|
-
)}
|
|
97
99
|
disabled={disabled}
|
|
98
100
|
accessibilityRole="button"
|
|
99
|
-
accessibilityLabel={accessibilityLabel}
|
|
101
|
+
accessibilityLabel={accessibilityLabel ?? (typeof children === "string" ? children : undefined)}
|
|
100
102
|
accessibilityState={{
|
|
101
103
|
disabled: disabled,
|
|
102
104
|
}}
|
|
103
105
|
onPressIn={handlePressIn}
|
|
104
106
|
onPressOut={handlePressOut}
|
|
107
|
+
className="flex-row"
|
|
105
108
|
{...rest}
|
|
106
109
|
>
|
|
107
|
-
<View className="flex flex-row items-center">
|
|
108
|
-
|
|
109
|
-
{iconLeft}
|
|
110
|
-
</View>
|
|
111
|
-
|
|
110
|
+
<View className="flex flex-row items-center flex-1">
|
|
111
|
+
{renderLeftIcon()}
|
|
112
112
|
<Typography
|
|
113
113
|
ellipsizeMode="tail"
|
|
114
114
|
variant={typographyVariant}
|
|
115
115
|
weight="700"
|
|
116
|
-
className={merge(textStyle, "truncate
|
|
116
|
+
className={merge(textStyle, "truncate flex-1 ")}
|
|
117
|
+
numberOfLines={numberOfLines}
|
|
117
118
|
>
|
|
118
119
|
{children}
|
|
119
120
|
</Typography>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import TextInput from "../TextInput";
|
|
3
|
+
import { IconButton } from "../IconButton";
|
|
4
|
+
import { PasswordInputProps } from "./types";
|
|
5
|
+
import { Eye, EyeOff } from "@kivid/icons/native";
|
|
6
|
+
import { IconButtonVariantEnum } from "../IconButton/enums";
|
|
7
|
+
|
|
8
|
+
export function PasswordInput(props: PasswordInputProps) {
|
|
9
|
+
const [shouldHidePassword, setShouldHidePassword] = useState(true);
|
|
10
|
+
|
|
11
|
+
function toogleHidePassword() {
|
|
12
|
+
setShouldHidePassword(!shouldHidePassword);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function renderIcon() {
|
|
16
|
+
if (shouldHidePassword) {
|
|
17
|
+
return <Eye size={24} className="text-chia-900" />;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return <EyeOff size={24} className="text-chia-900" />;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<TextInput
|
|
25
|
+
{...props}
|
|
26
|
+
secureTextEntry={shouldHidePassword}
|
|
27
|
+
rightIcon={
|
|
28
|
+
<IconButton
|
|
29
|
+
onPress={toogleHidePassword}
|
|
30
|
+
accessibilityLabel="Toggle Password Visibility"
|
|
31
|
+
variant={IconButtonVariantEnum.GHOST}
|
|
32
|
+
icon={renderIcon()}
|
|
33
|
+
/>
|
|
34
|
+
}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -44,7 +44,7 @@ export const textInputContentVariants = cva("flex-1 flex-col text-chia-900", {
|
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
export const textInputFieldVariants = cva(
|
|
47
|
-
"font-
|
|
47
|
+
"font-nunito-bold text-[16px] leading-[18px] placeholder:text-chia-600 pt-[3px] android:pb-0 android:pl-0",
|
|
48
48
|
{
|
|
49
49
|
variants: {
|
|
50
50
|
disabled: {
|
|
@@ -31,6 +31,9 @@ export function TextInput({
|
|
|
31
31
|
containerTestID,
|
|
32
32
|
ref,
|
|
33
33
|
tooltipClassName = "",
|
|
34
|
+
tooltipPointerClassName,
|
|
35
|
+
tooltipContainerClassName,
|
|
36
|
+
rightIcon,
|
|
34
37
|
...rest
|
|
35
38
|
}: TextInputProps) {
|
|
36
39
|
const inputRef = useRef<RNTextInput>(null);
|
|
@@ -52,6 +55,14 @@ export function TextInput({
|
|
|
52
55
|
);
|
|
53
56
|
};
|
|
54
57
|
|
|
58
|
+
const renderRightIcon = () => {
|
|
59
|
+
if (rightIcon) {
|
|
60
|
+
return rightIcon;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return renderSeal();
|
|
64
|
+
};
|
|
65
|
+
|
|
55
66
|
const handleChangeText = (text: string) => {
|
|
56
67
|
onChangeText?.(text);
|
|
57
68
|
};
|
|
@@ -71,9 +82,11 @@ export function TextInput({
|
|
|
71
82
|
return (
|
|
72
83
|
<Tooltip
|
|
73
84
|
isOpenedByVariantError={hasError}
|
|
74
|
-
message=
|
|
85
|
+
message={error}
|
|
75
86
|
variant={TooltipVariantEnum.ERROR}
|
|
76
87
|
className={tooltipClassName}
|
|
88
|
+
pointerClassName={tooltipPointerClassName}
|
|
89
|
+
containerClassName={tooltipContainerClassName}
|
|
77
90
|
>
|
|
78
91
|
<Pressable
|
|
79
92
|
testID={containerTestID}
|
|
@@ -134,7 +147,8 @@ export function TextInput({
|
|
|
134
147
|
}}
|
|
135
148
|
/>
|
|
136
149
|
</View>
|
|
137
|
-
|
|
150
|
+
|
|
151
|
+
{renderRightIcon()}
|
|
138
152
|
</Pressable>
|
|
139
153
|
</Tooltip>
|
|
140
154
|
);
|
|
@@ -19,6 +19,9 @@ export interface TextInputProps
|
|
|
19
19
|
labelClassName?: string;
|
|
20
20
|
containerTestID?: string;
|
|
21
21
|
tooltipClassName?: string;
|
|
22
|
+
tooltipPointerClassName?: string;
|
|
23
|
+
tooltipContainerClassName?: string;
|
|
24
|
+
rightIcon?: React.ReactNode;
|
|
22
25
|
onChangeText?: (text: string) => void;
|
|
23
26
|
ref?: React.RefObject<RNTextInput | null>;
|
|
24
27
|
}
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
import { SizeEnum } from "../../../../enums";
|
|
2
|
-
|
|
3
|
-
export enum IconVariants {
|
|
4
|
-
SUCCESS = "success",
|
|
5
|
-
ERROR = "error",
|
|
6
|
-
WARNING = "warning",
|
|
7
|
-
ADD = "add",
|
|
8
|
-
CUSTOM = "custom",
|
|
9
|
-
}
|
|
1
|
+
import { StateVariantEnum, SizeEnum } from "../../../../enums";
|
|
10
2
|
|
|
11
3
|
export type IconSize = SizeEnum.SMALL | SizeEnum.MEDIUM | SizeEnum.LARGE;
|
|
12
4
|
|
|
13
5
|
export interface IconProps {
|
|
14
|
-
variants:
|
|
6
|
+
variants: StateVariantEnum;
|
|
15
7
|
size?: IconSize;
|
|
16
8
|
customIcon?: React.ReactNode;
|
|
17
9
|
}
|
package/src/components/index.ts
CHANGED
package/src/enums/index.ts
CHANGED