@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.
Files changed (103) 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/Button/index.js +2 -1
  4. package/dist/commonjs/components/Button/index.js.map +1 -1
  5. package/dist/commonjs/components/ChatBubble/assets/class-variants.js +6 -6
  6. package/dist/commonjs/components/ChatBubble/assets/class-variants.js.map +1 -1
  7. package/dist/commonjs/components/ChatBubble/components/ChatBubbleSeal/index.js +3 -3
  8. package/dist/commonjs/components/ChatBubble/components/ChatBubbleSeal/index.js.map +1 -1
  9. package/dist/commonjs/components/ChatBubble/components/ChatBubbleText/index.js +2 -2
  10. package/dist/commonjs/components/ChatBubble/components/ChatBubbleText/index.js.map +1 -1
  11. package/dist/commonjs/components/ChatBubble/index.js +14 -9
  12. package/dist/commonjs/components/ChatBubble/index.js.map +1 -1
  13. package/dist/commonjs/components/ListButton/assets/class-variants.js +1 -1
  14. package/dist/commonjs/components/ListButton/assets/class-variants.js.map +1 -1
  15. package/dist/commonjs/components/ListButton/index.js +22 -13
  16. package/dist/commonjs/components/ListButton/index.js.map +1 -1
  17. package/dist/commonjs/components/PasswordInput/index.js +42 -0
  18. package/dist/commonjs/components/PasswordInput/index.js.map +1 -0
  19. package/dist/commonjs/components/PasswordInput/types.js +6 -0
  20. package/dist/commonjs/components/PasswordInput/types.js.map +1 -0
  21. package/dist/commonjs/components/TextInput/assets/class-variants.js +1 -1
  22. package/dist/commonjs/components/TextInput/assets/class-variants.js.map +1 -1
  23. package/dist/commonjs/components/TextInput/index.js +13 -2
  24. package/dist/commonjs/components/TextInput/index.js.map +1 -1
  25. package/dist/commonjs/components/Title/components/icon/types.js +0 -9
  26. package/dist/commonjs/components/Title/components/icon/types.js.map +1 -1
  27. package/dist/commonjs/components/index.js +11 -0
  28. package/dist/commonjs/components/index.js.map +1 -1
  29. package/dist/commonjs/enums/index.js +11 -0
  30. package/dist/commonjs/enums/index.js.map +1 -1
  31. package/dist/commonjs/enums/state-variant.js +15 -0
  32. package/dist/commonjs/enums/state-variant.js.map +1 -0
  33. package/dist/module/components/Avatar/index.js +5 -4
  34. package/dist/module/components/Avatar/index.js.map +1 -1
  35. package/dist/module/components/Button/index.js +2 -1
  36. package/dist/module/components/Button/index.js.map +1 -1
  37. package/dist/module/components/ChatBubble/assets/class-variants.js +6 -6
  38. package/dist/module/components/ChatBubble/assets/class-variants.js.map +1 -1
  39. package/dist/module/components/ChatBubble/components/ChatBubbleSeal/index.js +3 -3
  40. package/dist/module/components/ChatBubble/components/ChatBubbleSeal/index.js.map +1 -1
  41. package/dist/module/components/ChatBubble/components/ChatBubbleText/index.js +2 -2
  42. package/dist/module/components/ChatBubble/components/ChatBubbleText/index.js.map +1 -1
  43. package/dist/module/components/ChatBubble/index.js +14 -9
  44. package/dist/module/components/ChatBubble/index.js.map +1 -1
  45. package/dist/module/components/ListButton/assets/class-variants.js +1 -1
  46. package/dist/module/components/ListButton/assets/class-variants.js.map +1 -1
  47. package/dist/module/components/ListButton/index.js +22 -13
  48. package/dist/module/components/ListButton/index.js.map +1 -1
  49. package/dist/module/components/PasswordInput/index.js +37 -0
  50. package/dist/module/components/PasswordInput/index.js.map +1 -0
  51. package/dist/module/components/PasswordInput/types.js +4 -0
  52. package/dist/module/components/PasswordInput/types.js.map +1 -0
  53. package/dist/module/components/TextInput/assets/class-variants.js +1 -1
  54. package/dist/module/components/TextInput/assets/class-variants.js.map +1 -1
  55. package/dist/module/components/TextInput/index.js +13 -2
  56. package/dist/module/components/TextInput/index.js.map +1 -1
  57. package/dist/module/components/Title/components/icon/types.js +1 -8
  58. package/dist/module/components/Title/components/icon/types.js.map +1 -1
  59. package/dist/module/components/index.js +1 -0
  60. package/dist/module/components/index.js.map +1 -1
  61. package/dist/module/enums/index.js +1 -0
  62. package/dist/module/enums/index.js.map +1 -1
  63. package/dist/module/enums/state-variant.js +11 -0
  64. package/dist/module/enums/state-variant.js.map +1 -0
  65. package/dist/typescript/components/Avatar/types.d.ts +1 -0
  66. package/dist/typescript/components/ChatBubble/assets/class-variants.d.ts +1 -1
  67. package/dist/typescript/components/ChatBubble/contexts/ChatBubbleContext/types.d.ts +1 -1
  68. package/dist/typescript/components/ChatBubble/types.d.ts +2 -1
  69. package/dist/typescript/components/Chip/assets/class-variants.d.ts +1 -1
  70. package/dist/typescript/components/ListButton/types.d.ts +2 -1
  71. package/dist/typescript/components/PasswordInput/index.d.ts +2 -0
  72. package/dist/typescript/components/PasswordInput/types.d.ts +3 -0
  73. package/dist/typescript/components/Seal/assets/class-variants.d.ts +1 -1
  74. package/dist/typescript/components/TextInput/index.d.ts +1 -1
  75. package/dist/typescript/components/TextInput/types.d.ts +3 -0
  76. package/dist/typescript/components/Title/components/icon/types.d.ts +2 -9
  77. package/dist/typescript/components/Tooltip/types.d.ts +0 -1
  78. package/dist/typescript/components/index.d.ts +2 -0
  79. package/dist/typescript/enums/index.d.ts +1 -0
  80. package/dist/typescript/enums/state-variant.d.ts +7 -0
  81. package/package.json +5 -5
  82. package/src/components/Avatar/index.tsx +4 -4
  83. package/src/components/Avatar/types.ts +1 -0
  84. package/src/components/Button/index.tsx +2 -1
  85. package/src/components/ChatBubble/assets/class-variants.ts +6 -6
  86. package/src/components/ChatBubble/components/ChatBubbleSeal/index.tsx +3 -3
  87. package/src/components/ChatBubble/components/ChatBubbleText/index.tsx +2 -2
  88. package/src/components/ChatBubble/contexts/ChatBubbleContext/types.ts +1 -1
  89. package/src/components/ChatBubble/index.tsx +14 -11
  90. package/src/components/ChatBubble/types.ts +2 -1
  91. package/src/components/ListButton/assets/class-variants.ts +1 -1
  92. package/src/components/ListButton/index.tsx +27 -26
  93. package/src/components/ListButton/types.ts +2 -1
  94. package/src/components/PasswordInput/index.tsx +37 -0
  95. package/src/components/PasswordInput/types.ts +4 -0
  96. package/src/components/TextInput/assets/class-variants.ts +1 -1
  97. package/src/components/TextInput/index.tsx +16 -2
  98. package/src/components/TextInput/types.ts +3 -0
  99. package/src/components/Title/components/icon/types.ts +2 -10
  100. package/src/components/Tooltip/types.ts +0 -1
  101. package/src/components/index.ts +3 -0
  102. package/src/enums/index.ts +1 -0
  103. 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="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"> {}
@@ -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-semibold text-[16px] leading-[18px] placeholder:text-chia-600 pt-[3px]",
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="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
  }
@@ -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: IconVariants;
6
+ variants: StateVariantEnum;
15
7
  size?: IconSize;
16
8
  customIcon?: React.ReactNode;
17
9
  }
@@ -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";
@@ -1,2 +1,3 @@
1
1
  export * from "./size";
2
2
  export * from "./corners";
3
+ export * from "./state-variant";
@@ -0,0 +1,7 @@
1
+ export enum StateVariantEnum {
2
+ SUCCESS = "success",
3
+ ERROR = "error",
4
+ WARNING = "warning",
5
+ ADD = "add",
6
+ CUSTOM = "custom",
7
+ }