@kivid/native-components 1.0.0-alpha.7 → 1.0.0-alpha.8

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.
Files changed (73) hide show
  1. package/dist/commonjs/components/Avatar/index.js +5 -4
  2. package/dist/commonjs/components/Avatar/index.js.map +1 -1
  3. package/dist/commonjs/components/ChatBubble/assets/class-variants.js +6 -6
  4. package/dist/commonjs/components/ChatBubble/assets/class-variants.js.map +1 -1
  5. package/dist/commonjs/components/ChatBubble/components/ChatBubbleSeal/index.js +3 -3
  6. package/dist/commonjs/components/ChatBubble/components/ChatBubbleSeal/index.js.map +1 -1
  7. package/dist/commonjs/components/ChatBubble/components/ChatBubbleText/index.js +2 -2
  8. package/dist/commonjs/components/ChatBubble/components/ChatBubbleText/index.js.map +1 -1
  9. package/dist/commonjs/components/ChatBubble/index.js +8 -7
  10. package/dist/commonjs/components/ChatBubble/index.js.map +1 -1
  11. package/dist/commonjs/components/ListButton/assets/class-variants.js +1 -1
  12. package/dist/commonjs/components/ListButton/assets/class-variants.js.map +1 -1
  13. package/dist/commonjs/components/ListButton/index.js +22 -13
  14. package/dist/commonjs/components/ListButton/index.js.map +1 -1
  15. package/dist/commonjs/components/PasswordInput/index.js +42 -0
  16. package/dist/commonjs/components/PasswordInput/index.js.map +1 -0
  17. package/dist/commonjs/components/PasswordInput/types.js +6 -0
  18. package/dist/commonjs/components/PasswordInput/types.js.map +1 -0
  19. package/dist/commonjs/components/TextInput/index.js +13 -2
  20. package/dist/commonjs/components/TextInput/index.js.map +1 -1
  21. package/dist/commonjs/components/index.js +11 -0
  22. package/dist/commonjs/components/index.js.map +1 -1
  23. package/dist/module/components/Avatar/index.js +5 -4
  24. package/dist/module/components/Avatar/index.js.map +1 -1
  25. package/dist/module/components/ChatBubble/assets/class-variants.js +6 -6
  26. package/dist/module/components/ChatBubble/assets/class-variants.js.map +1 -1
  27. package/dist/module/components/ChatBubble/components/ChatBubbleSeal/index.js +3 -3
  28. package/dist/module/components/ChatBubble/components/ChatBubbleSeal/index.js.map +1 -1
  29. package/dist/module/components/ChatBubble/components/ChatBubbleText/index.js +2 -2
  30. package/dist/module/components/ChatBubble/components/ChatBubbleText/index.js.map +1 -1
  31. package/dist/module/components/ChatBubble/index.js +8 -7
  32. package/dist/module/components/ChatBubble/index.js.map +1 -1
  33. package/dist/module/components/ListButton/assets/class-variants.js +1 -1
  34. package/dist/module/components/ListButton/assets/class-variants.js.map +1 -1
  35. package/dist/module/components/ListButton/index.js +22 -13
  36. package/dist/module/components/ListButton/index.js.map +1 -1
  37. package/dist/module/components/PasswordInput/index.js +37 -0
  38. package/dist/module/components/PasswordInput/index.js.map +1 -0
  39. package/dist/module/components/PasswordInput/types.js +4 -0
  40. package/dist/module/components/PasswordInput/types.js.map +1 -0
  41. package/dist/module/components/TextInput/index.js +13 -2
  42. package/dist/module/components/TextInput/index.js.map +1 -1
  43. package/dist/module/components/index.js +1 -0
  44. package/dist/module/components/index.js.map +1 -1
  45. package/dist/typescript/components/Avatar/types.d.ts +1 -0
  46. package/dist/typescript/components/ChatBubble/assets/class-variants.d.ts +1 -1
  47. package/dist/typescript/components/ChatBubble/contexts/ChatBubbleContext/types.d.ts +1 -1
  48. package/dist/typescript/components/ChatBubble/types.d.ts +2 -1
  49. package/dist/typescript/components/ListButton/types.d.ts +2 -1
  50. package/dist/typescript/components/PasswordInput/index.d.ts +2 -0
  51. package/dist/typescript/components/PasswordInput/types.d.ts +3 -0
  52. package/dist/typescript/components/TextInput/index.d.ts +1 -1
  53. package/dist/typescript/components/TextInput/types.d.ts +3 -0
  54. package/dist/typescript/components/Tooltip/types.d.ts +0 -1
  55. package/dist/typescript/components/index.d.ts +2 -0
  56. package/package.json +5 -5
  57. package/src/components/Avatar/index.tsx +4 -4
  58. package/src/components/Avatar/types.ts +1 -0
  59. package/src/components/ChatBubble/assets/class-variants.ts +6 -6
  60. package/src/components/ChatBubble/components/ChatBubbleSeal/index.tsx +3 -3
  61. package/src/components/ChatBubble/components/ChatBubbleText/index.tsx +2 -2
  62. package/src/components/ChatBubble/contexts/ChatBubbleContext/types.ts +1 -1
  63. package/src/components/ChatBubble/index.tsx +8 -9
  64. package/src/components/ChatBubble/types.ts +2 -1
  65. package/src/components/ListButton/assets/class-variants.ts +1 -1
  66. package/src/components/ListButton/index.tsx +27 -26
  67. package/src/components/ListButton/types.ts +2 -1
  68. package/src/components/PasswordInput/index.tsx +37 -0
  69. package/src/components/PasswordInput/types.ts +4 -0
  70. package/src/components/TextInput/index.tsx +16 -2
  71. package/src/components/TextInput/types.ts +3 -0
  72. package/src/components/Tooltip/types.ts +0 -1
  73. package/src/components/index.ts +3 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kivid/native-components",
3
- "version": "1.0.0-alpha.7",
3
+ "version": "1.0.0-alpha.8",
4
4
  "description": "A React Native component library for the Butterfly Design System.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -78,8 +78,8 @@
78
78
  "react": "19.0.0",
79
79
  "ts-jest": "^29.2.5",
80
80
  "typescript": "~5.8.3",
81
- "@kivid/tailwind-preset": "1.0.0-alpha.7",
82
- "@kivid/icons": "1.0.0-alpha.7"
81
+ "@kivid/icons": "1.0.0-alpha.8",
82
+ "@kivid/tailwind-preset": "1.0.0-alpha.8"
83
83
  },
84
84
  "peerDependencies": {
85
85
  "@lottiefiles/dotlottie-react": "^0.15.1",
@@ -89,8 +89,8 @@
89
89
  "react-native-svg": "^15.12.0",
90
90
  "react-native": "0.79.5",
91
91
  "react": "19.0.0",
92
- "@kivid/tailwind-preset": "1.0.0-alpha.7",
93
- "@kivid/icons": "1.0.0-alpha.7"
92
+ "@kivid/tailwind-preset": "1.0.0-alpha.8",
93
+ "@kivid/icons": "1.0.0-alpha.8"
94
94
  },
95
95
  "eslintIgnore": [
96
96
  "node_modules/",
@@ -7,7 +7,7 @@ import { merge } from "@kivid/tailwind-preset";
7
7
  import Typography from "../Typography";
8
8
 
9
9
  export function Avatar(props: AvatarProps) {
10
- const { src, name, size = SizeEnum.MEDIUM } = props;
10
+ const { src, name, size = SizeEnum.MEDIUM, className } = props;
11
11
 
12
12
  const personMappedSize = {
13
13
  [SizeEnum.XLARGE]: 56,
@@ -77,7 +77,7 @@ export function Avatar(props: AvatarProps) {
77
77
 
78
78
  //TODO: line height add spaces on font, and element cant be centered
79
79
  return (
80
- <View className={avatarStyle}>
80
+ <View className={merge(avatarStyle, className)}>
81
81
  <Typography
82
82
  className={merge(
83
83
  avatarTextStyleMap[size].className,
@@ -93,7 +93,7 @@ export function Avatar(props: AvatarProps) {
93
93
  }
94
94
 
95
95
  return (
96
- <View className={avatarStyle}>
96
+ <View className={merge(avatarStyle, className)}>
97
97
  <Person
98
98
  color="#B6C2C2"
99
99
  size={personMappedSize}
@@ -108,7 +108,7 @@ export function Avatar(props: AvatarProps) {
108
108
  }
109
109
 
110
110
  return (
111
- <View className={merge(avatarStyle, "overflow-hidden")}>
111
+ <View className={merge(avatarStyle, "overflow-hidden", className)}>
112
112
  <Image
113
113
  source={{ uri: src }}
114
114
  className={"object-cover w-full h-full"}
@@ -12,4 +12,5 @@ export interface AvatarProps {
12
12
  src?: string | null;
13
13
  name?: string;
14
14
  size?: AvatarSize;
15
+ className?: string;
15
16
  }
@@ -4,7 +4,7 @@ export const chatBubbleBoxVariants = cva(
4
4
  "flex-row gap-400 px-600 py-500 min-h-1000",
5
5
  {
6
6
  variants: {
7
- contentType: {
7
+ variant: {
8
8
  check: "",
9
9
  alert: "",
10
10
  error: "",
@@ -25,27 +25,27 @@ export const chatBubbleBoxVariants = cva(
25
25
  },
26
26
  compoundVariants: [
27
27
  {
28
- contentType: "check",
28
+ variant: "check",
29
29
  colorState: "fill",
30
30
  className: "bg-pear-500",
31
31
  },
32
32
  {
33
- contentType: "alert",
33
+ variant: "alert",
34
34
  colorState: "fill",
35
35
  className: "bg-tangerine-500",
36
36
  },
37
37
  {
38
- contentType: "error",
38
+ variant: "error",
39
39
  colorState: "fill",
40
40
  className: "bg-blackberry-500",
41
41
  },
42
42
  {
43
- contentType: "custom",
43
+ variant: "custom",
44
44
  colorState: "fill",
45
45
  className: "bg-chia-100",
46
46
  },
47
47
  {
48
- contentType: "custom",
48
+ variant: "custom",
49
49
  colorState: "outline",
50
50
  className: "bg-chia-100",
51
51
  },
@@ -11,9 +11,9 @@ export const ChatBubbleSeal: React.FC<ChatBubbleSealProps> = ({
11
11
  className,
12
12
  ...props
13
13
  }) => {
14
- const { contentType, colorState } = useChatBubbleContext();
14
+ const { variant, colorState } = useChatBubbleContext();
15
15
 
16
- if (!contentType || contentType === "custom") {
16
+ if (!variant || variant === "custom") {
17
17
  return null;
18
18
  }
19
19
 
@@ -25,7 +25,7 @@ export const ChatBubbleSeal: React.FC<ChatBubbleSealProps> = ({
25
25
 
26
26
  return (
27
27
  <Seal
28
- variant={sealVariantMap[contentType]}
28
+ variant={sealVariantMap[variant]}
29
29
  size={SizeEnum.MEDIUM}
30
30
  inverted={colorState === "fill"}
31
31
  className={merge("ml-[-6px]", className)}
@@ -13,11 +13,11 @@ export const ChatBubbleText: React.FC<ChatBubbleTextProps> = ({
13
13
  children,
14
14
  ...props
15
15
  }) => {
16
- const { colorState, contentType } = useChatBubbleContext();
16
+ const { colorState, variant } = useChatBubbleContext();
17
17
 
18
18
  // Text color based on bubble colorState
19
19
  const textColorClass =
20
- colorState === "fill" && contentType !== "custom"
20
+ colorState === "fill" && variant !== "custom"
21
21
  ? "text-chia-200"
22
22
  : "text-chia-800";
23
23
 
@@ -5,7 +5,7 @@ import {
5
5
  } from "../../types";
6
6
 
7
7
  export interface ChatBubbleContextValue {
8
- contentType?: ChatBubbleType;
8
+ variant?: ChatBubbleType;
9
9
  colorState: ChatBubbleColorState;
10
10
  messageType: ChatBubbleMessageType;
11
11
  }
@@ -15,15 +15,15 @@ import { merge } from "@kivid/tailwind-preset";
15
15
  import { ChatBubbleContext } from "./contexts";
16
16
  import type { ChatBubbleContextValue } from "./contexts/ChatBubbleContext/types";
17
17
 
18
-
19
18
  export function ChatBubble(props: ChatBubbleProps) {
20
19
  const {
21
- contentType = "custom",
20
+ variant = "custom",
22
21
  colorState = "outline",
23
- hasEar = false,
22
+ hasEar = true,
24
23
  className,
25
24
  children,
26
25
  time: timeFromProps,
26
+ shouldDisplayTime = true,
27
27
  messageType = "initial",
28
28
  ...restOfProps
29
29
  } = props;
@@ -38,11 +38,10 @@ export function ChatBubble(props: ChatBubbleProps) {
38
38
  custom: "#FAFCFC",
39
39
  };
40
40
 
41
- const tailColor =
42
- colorState === "outline" ? "#FAFCFC" : colorMap[contentType];
41
+ const tailColor = colorState === "outline" ? "#FAFCFC" : colorMap[variant];
43
42
 
44
43
  const contextInitialValue: ChatBubbleContextValue = {
45
- contentType,
44
+ variant,
46
45
  colorState,
47
46
  messageType,
48
47
  };
@@ -68,7 +67,7 @@ export function ChatBubble(props: ChatBubbleProps) {
68
67
  <ChatBubbleContext.Provider value={contextInitialValue}>
69
68
  <View
70
69
  accessibilityRole="text"
71
- accessibilityLabel={accessibilityLabelMap[contentType]}
70
+ accessibilityLabel={accessibilityLabelMap[variant]}
72
71
  accessible={true}
73
72
  className={merge("flex", className)}
74
73
  {...restOfProps}
@@ -87,7 +86,7 @@ export function ChatBubble(props: ChatBubbleProps) {
87
86
  <View
88
87
  className={merge(
89
88
  chatBubbleBoxVariants({
90
- contentType,
89
+ variant,
91
90
  colorState,
92
91
  hasEar,
93
92
  messageType,
@@ -101,7 +100,7 @@ export function ChatBubble(props: ChatBubbleProps) {
101
100
  {children}
102
101
  </View>
103
102
  </View>
104
- <ChatBubbleTime>{time}</ChatBubbleTime>
103
+ {shouldDisplayTime && <ChatBubbleTime>{time}</ChatBubbleTime>}
105
104
  </View>
106
105
  </ChatBubbleContext.Provider>
107
106
  );
@@ -5,11 +5,12 @@ export type ChatBubbleColorState = "fill" | "outline";
5
5
  export type ChatBubbleMessageType = "initial" | "followUp";
6
6
 
7
7
  export interface ChatBubbleProps extends Omit<ViewProps, "children"> {
8
- contentType?: ChatBubbleType;
8
+ variant?: ChatBubbleType;
9
9
  colorState?: ChatBubbleColorState;
10
10
  hasEar?: boolean;
11
11
  className?: string;
12
12
  children?: React.ReactNode;
13
13
  time?: string;
14
+ shouldDisplayTime?: boolean;
14
15
  messageType?: ChatBubbleMessageType;
15
16
  }
@@ -4,7 +4,7 @@ import { SizeEnum, CornersEnum } from "../../../enums";
4
4
 
5
5
  const buttonVariants = cva(
6
6
  [
7
- "flex flex-row items-center justify-between w-full",
7
+ "flex flex-row items-center justify-between",
8
8
  "font-bold",
9
9
  "disabled:cursor-not-allowed",
10
10
  "relative overflow-hidden",
@@ -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="flex-1 items-end">
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
- <View className="mr-400 flex">
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 min-w-fit")}
116
+ className={merge(textStyle, "truncate flex-1 ")}
117
+ numberOfLines={numberOfLines}
117
118
  >
118
119
  {children}
119
120
  </Typography>
@@ -17,5 +17,6 @@ export interface ListButtonProps
17
17
  corners?: CornersEnum.SMALL | CornersEnum.MEDIUM;
18
18
  className?: string;
19
19
  disabled?: boolean;
20
- accessibilityLabel: string;
20
+ accessibilityLabel?: string;
21
+ numberOfLines?: number;
21
22
  }
@@ -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
+ }
@@ -0,0 +1,4 @@
1
+ import { TextInputProps } from "../TextInput/types";
2
+
3
+ export interface PasswordInputProps
4
+ extends Omit<TextInputProps, "secureTextEntry"> {}
@@ -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="This is a error"
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
- {renderSeal()}
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
  }
@@ -8,7 +8,6 @@ export interface TooltipProps {
8
8
  className?: string;
9
9
  pointerClassName?: string;
10
10
  containerClassName?: string;
11
- triggerButtonClassName?: string;
12
11
  style?: ViewStyle;
13
12
  onChangeVisibility?: (isVisible: boolean) => void;
14
13
  isOpenedByVariantError?: boolean;
@@ -68,3 +68,6 @@ export * from "./RadioInput/enums";
68
68
  export * from "./IconButton";
69
69
  export type * from "./IconButton/types";
70
70
  export * from "./IconButton/enums";
71
+
72
+ export * from "./PasswordInput";
73
+ export type * from "./PasswordInput/types";