@kivid/native-components 1.0.0-alpha.2 → 1.0.0-alpha.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.
Files changed (136) hide show
  1. package/dist/commonjs/components/Avatar/assets/class-variants.js +23 -0
  2. package/dist/commonjs/components/Avatar/assets/class-variants.js.map +1 -0
  3. package/dist/commonjs/components/Avatar/enums/index.js +17 -0
  4. package/dist/commonjs/components/Avatar/enums/index.js.map +1 -0
  5. package/dist/commonjs/components/Avatar/enums/size.js +15 -0
  6. package/dist/commonjs/components/Avatar/enums/size.js.map +1 -0
  7. package/dist/commonjs/components/Avatar/images/girl.jpg +0 -0
  8. package/dist/commonjs/components/Avatar/index.js +97 -0
  9. package/dist/commonjs/components/Avatar/index.js.map +1 -0
  10. package/dist/commonjs/components/Avatar/types.js +6 -0
  11. package/dist/commonjs/components/Avatar/types.js.map +1 -0
  12. package/dist/commonjs/components/Button/assets/class-variants.js +0 -5
  13. package/dist/commonjs/components/Button/assets/class-variants.js.map +1 -1
  14. package/dist/commonjs/components/Button/index.js +10 -4
  15. package/dist/commonjs/components/Button/index.js.map +1 -1
  16. package/dist/commonjs/components/Chip/index.js +7 -3
  17. package/dist/commonjs/components/Chip/index.js.map +1 -1
  18. package/dist/commonjs/components/HighlightedText/index.js +20 -16
  19. package/dist/commonjs/components/HighlightedText/index.js.map +1 -1
  20. package/dist/commonjs/components/InputOTP/components/InformationStatus/index.js +3 -3
  21. package/dist/commonjs/components/InputOTP/components/InformationStatus/index.js.map +1 -1
  22. package/dist/commonjs/components/InputOTP/enums/index.js +9 -11
  23. package/dist/commonjs/components/InputOTP/enums/index.js.map +1 -1
  24. package/dist/commonjs/components/Toggle/enums/variant.js +8 -8
  25. package/dist/commonjs/components/Toggle/enums/variant.js.map +1 -1
  26. package/dist/commonjs/components/Toggle/index.js +1 -1
  27. package/dist/commonjs/components/Toggle/index.js.map +1 -1
  28. package/dist/commonjs/components/Typography/assets/class-variants.js +59 -0
  29. package/dist/commonjs/components/Typography/assets/class-variants.js.map +1 -0
  30. package/dist/commonjs/components/Typography/index.js +9 -5
  31. package/dist/commonjs/components/Typography/index.js.map +1 -1
  32. package/dist/commonjs/components/index.js +110 -11
  33. package/dist/commonjs/components/index.js.map +1 -1
  34. package/dist/commonjs/hooks/use-fonts.js +8 -0
  35. package/dist/commonjs/hooks/use-fonts.js.map +1 -1
  36. package/dist/module/components/Avatar/assets/class-variants.js +20 -0
  37. package/dist/module/components/Avatar/assets/class-variants.js.map +1 -0
  38. package/dist/module/components/Avatar/enums/index.js +4 -0
  39. package/dist/module/components/Avatar/enums/index.js.map +1 -0
  40. package/dist/module/components/Avatar/enums/size.js +11 -0
  41. package/dist/module/components/Avatar/enums/size.js.map +1 -0
  42. package/dist/module/components/Avatar/images/girl.jpg +0 -0
  43. package/dist/module/components/Avatar/index.js +92 -0
  44. package/dist/module/components/Avatar/index.js.map +1 -0
  45. package/dist/module/components/Avatar/types.js +4 -0
  46. package/dist/module/components/Avatar/types.js.map +1 -0
  47. package/dist/module/components/Button/assets/class-variants.js +0 -5
  48. package/dist/module/components/Button/assets/class-variants.js.map +1 -1
  49. package/dist/module/components/Button/index.js +11 -4
  50. package/dist/module/components/Button/index.js.map +1 -1
  51. package/dist/module/components/Chip/index.js +8 -4
  52. package/dist/module/components/Chip/index.js.map +1 -1
  53. package/dist/module/components/HighlightedText/index.js +20 -16
  54. package/dist/module/components/HighlightedText/index.js.map +1 -1
  55. package/dist/module/components/InputOTP/components/InformationStatus/index.js +1 -1
  56. package/dist/module/components/InputOTP/components/InformationStatus/index.js.map +1 -1
  57. package/dist/module/components/InputOTP/enums/index.js +8 -1
  58. package/dist/module/components/InputOTP/enums/index.js.map +1 -1
  59. package/dist/module/components/Toggle/enums/variant.js +7 -7
  60. package/dist/module/components/Toggle/enums/variant.js.map +1 -1
  61. package/dist/module/components/Toggle/index.js +2 -2
  62. package/dist/module/components/Toggle/index.js.map +1 -1
  63. package/dist/module/components/Typography/assets/class-variants.js +55 -0
  64. package/dist/module/components/Typography/assets/class-variants.js.map +1 -0
  65. package/dist/module/components/Typography/index.js +9 -5
  66. package/dist/module/components/Typography/index.js.map +1 -1
  67. package/dist/module/components/index.js +9 -0
  68. package/dist/module/components/index.js.map +1 -1
  69. package/dist/module/hooks/use-fonts.js +8 -0
  70. package/dist/module/hooks/use-fonts.js.map +1 -1
  71. package/dist/package.json +1 -2
  72. package/dist/typescript/components/Avatar/assets/class-variants.d.ts +5 -0
  73. package/dist/typescript/components/Avatar/enums/index.d.ts +1 -0
  74. package/dist/typescript/components/Avatar/enums/size.d.ts +7 -0
  75. package/dist/typescript/components/Avatar/index.d.ts +2 -0
  76. package/dist/typescript/components/Avatar/types.d.ts +6 -0
  77. package/dist/typescript/components/Button/assets/class-variants.d.ts +0 -1
  78. package/dist/typescript/components/Button/index.d.ts +2 -2
  79. package/dist/typescript/components/Chip/assets/class-variants.d.ts +1 -1
  80. package/dist/typescript/components/Chip/index.d.ts +2 -1
  81. package/dist/typescript/components/HighlightedText/index.d.ts +1 -0
  82. package/dist/typescript/components/HighlightedText/types.d.ts +9 -3
  83. package/dist/typescript/components/InputOTP/enums/index.d.ts +7 -1
  84. package/dist/typescript/components/Seal/assets/class-variants.d.ts +1 -1
  85. package/dist/typescript/components/Toggle/enums/variant.d.ts +1 -1
  86. package/dist/typescript/components/Toggle/types.d.ts +2 -2
  87. package/dist/typescript/components/Typography/assets/class-variants.d.ts +4 -0
  88. package/dist/typescript/components/Typography/index.d.ts +3 -3
  89. package/dist/typescript/components/Typography/types.d.ts +3 -3
  90. package/dist/typescript/components/index.d.ts +18 -0
  91. package/package.json +11 -13
  92. package/src/components/Avatar/assets/class-variants.ts +22 -0
  93. package/src/components/Avatar/enums/index.ts +1 -0
  94. package/src/components/Avatar/enums/size.ts +7 -0
  95. package/src/components/Avatar/images/girl.jpg +0 -0
  96. package/src/components/Avatar/index.stories.tsx +84 -0
  97. package/src/components/Avatar/index.tsx +98 -0
  98. package/src/components/Avatar/types.ts +7 -0
  99. package/src/components/Button/assets/class-variants.ts +0 -5
  100. package/src/components/Button/index.tsx +24 -6
  101. package/src/components/Chip/index.tsx +16 -8
  102. package/src/components/HighlightedText/index.stories.tsx +117 -18
  103. package/src/components/HighlightedText/index.tsx +36 -16
  104. package/src/components/HighlightedText/types.ts +9 -3
  105. package/src/components/InputOTP/components/InformationStatus/index.tsx +1 -1
  106. package/src/components/InputOTP/enums/index.ts +7 -1
  107. package/src/components/InputOTP/index.stories.tsx +13 -4
  108. package/src/components/Title/index.stories.tsx +185 -75
  109. package/src/components/Toggle/enums/variant.ts +1 -1
  110. package/src/components/Toggle/index.stories.tsx +19 -19
  111. package/src/components/Toggle/index.tsx +2 -2
  112. package/src/components/Toggle/types.ts +2 -2
  113. package/src/components/Typography/assets/class-variants.ts +56 -0
  114. package/src/components/Typography/index.stories.tsx +117 -159
  115. package/src/components/Typography/index.tsx +9 -5
  116. package/src/components/Typography/types.ts +5 -3
  117. package/src/components/index.ts +28 -0
  118. package/src/hooks/use-fonts.ts +8 -0
  119. package/assets/adaptive-icon.png +0 -0
  120. package/assets/favicon.png +0 -0
  121. package/assets/fonts/Nunito-Bold.ttf +0 -0
  122. package/assets/fonts/Nunito-BoldItalic.ttf +0 -0
  123. package/assets/fonts/Nunito-Italic.ttf +0 -0
  124. package/assets/fonts/Nunito-Medium.ttf +0 -0
  125. package/assets/fonts/Nunito-MediumItalic.ttf +0 -0
  126. package/assets/fonts/Nunito-Regular.ttf +0 -0
  127. package/assets/fonts/Nunito-SemiBold.ttf +0 -0
  128. package/assets/fonts/Nunito-SemiBoldItalic.ttf +0 -0
  129. package/assets/icon.png +0 -0
  130. package/assets/splash.png +0 -0
  131. package/dist/commonjs/components/InputOTP/enums/information-status.js +0 -15
  132. package/dist/commonjs/components/InputOTP/enums/information-status.js.map +0 -1
  133. package/dist/module/components/InputOTP/enums/information-status.js +0 -11
  134. package/dist/module/components/InputOTP/enums/information-status.js.map +0 -1
  135. package/dist/typescript/components/InputOTP/enums/information-status.d.ts +0 -7
  136. package/src/components/InputOTP/enums/information-status.ts +0 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kivid/native-components",
3
- "version": "1.0.0-alpha.2",
3
+ "version": "1.0.0-alpha.5",
4
4
  "description": "A React Native component library for the Butterfly Design System.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,8 +15,7 @@
15
15
  "main": "index.js",
16
16
  "files": [
17
17
  "dist",
18
- "src",
19
- "assets"
18
+ "src"
20
19
  ],
21
20
  "exports": {
22
21
  ".": {
@@ -50,21 +49,22 @@
50
49
  "@react-native-async-storage/async-storage": "2.1.2",
51
50
  "@react-native-community/datetimepicker": "8.4.1",
52
51
  "@react-native-community/slider": "4.5.6",
53
- "expo": "~53.0.9",
54
52
  "expo-constants": "~17.1.6",
55
53
  "expo-font": "~13.3.2",
56
54
  "expo-splash-screen": "^0.30.10",
57
55
  "expo-status-bar": "~2.2.3",
56
+ "expo": "~53.0.9",
58
57
  "nativewind": "^4.1.23",
59
- "react": "19.0.0",
60
58
  "react-dom": "19.0.0",
61
- "react-native": "0.79.5",
62
59
  "react-native-gesture-handler": "~2.24.0",
63
60
  "react-native-reanimated": "~3.17.5",
64
61
  "react-native-safe-area-context": "5.4.0",
65
62
  "react-native-svg": "^15.11.2",
66
63
  "react-native-web": "^0.20.0",
67
- "@kivid/icons": "1.0.0-alpha.2"
64
+ "react-native": "0.79.5",
65
+ "react": "19.0.0",
66
+ "@kivid/tailwind-preset": "1.0.0-alpha.5",
67
+ "@kivid/icons": "1.0.0-alpha.5"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@babel/core": "^7.24.0",
@@ -95,8 +95,7 @@
95
95
  "storybook": "^9",
96
96
  "tailwindcss": "^3.4.17",
97
97
  "typescript": "~5.8.3",
98
- "vite": "^6.3.5",
99
- "@kivid/tailwind-preset": "1.0.0-alpha.2"
98
+ "vite": "^6.3.5"
100
99
  },
101
100
  "peerDependencies": {
102
101
  "@lottiefiles/dotlottie-react": "^0.15.1",
@@ -104,8 +103,7 @@
104
103
  "lottie-react-native": "^7.2.4",
105
104
  "react": "19.0.0",
106
105
  "react-native": "0.79.5",
107
- "@kivid/tailwind-preset": "1.0.0-alpha.2",
108
- "@kivid/icons": "1.0.0-alpha.2"
106
+ "@kivid/icons": "1.0.0-alpha.5"
109
107
  },
110
108
  "eslintIgnore": [
111
109
  "node_modules/",
@@ -122,7 +120,7 @@
122
120
  "build-storybook": "storybook build",
123
121
  "storybook-generate": "sb-rn-get-stories",
124
122
  "storybook": "cross-env EXPO_PUBLIC_STORYBOOK_ENABLED='true' expo start",
125
- "storybook:ios": "cross-env EXPO_PUBLIC_STORYBOOK_ENABLED='true' expo start --ios",
126
- "storybook:android": "cross-env EXPO_PUBLIC_STORYBOOK_ENABLED='true' expo start --android"
123
+ "storybook:ios": "cross-env EXPO_PUBLIC_STORYBOOK_ENABLED='true' expo start:ios",
124
+ "storybook:android": "cross-env EXPO_PUBLIC_STORYBOOK_ENABLED='true' expo start:android"
127
125
  }
128
126
  }
@@ -0,0 +1,22 @@
1
+ import { cva } from "class-variance-authority";
2
+ import { AvatarSizeEnum } from "../enums";
3
+
4
+ const avatarVariants = cva(
5
+ "border-[1px] border-chia-400 rounded-full items-center justify-center",
6
+ {
7
+ variants: {
8
+ size: {
9
+ [AvatarSizeEnum.XSMALL]: "w-[32px] h-[32px]",
10
+ [AvatarSizeEnum.SMALL]: "w-[40px] h-[40px]",
11
+ [AvatarSizeEnum.MEDIUM]: "w-[56px] h-[56px]",
12
+ [AvatarSizeEnum.LARGE]: "w-[72px] h-[72px]",
13
+ [AvatarSizeEnum.XLARGE]: "w-[96px] h-[96px]",
14
+ },
15
+ },
16
+ defaultVariants: {
17
+ size: AvatarSizeEnum.MEDIUM,
18
+ },
19
+ }
20
+ );
21
+
22
+ export { avatarVariants };
@@ -0,0 +1 @@
1
+ export * from "./size";
@@ -0,0 +1,7 @@
1
+ export enum AvatarSizeEnum {
2
+ XSMALL = "xsmall",
3
+ SMALL = "small",
4
+ MEDIUM = "medium",
5
+ LARGE = "large",
6
+ XLARGE = "xlarge",
7
+ }
@@ -0,0 +1,84 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-native";
2
+ import { Avatar } from "./index";
3
+ import { AvatarSizeEnum } from "./enums";
4
+ import { View, Image } from "react-native";
5
+
6
+ const sizeOptions = Object.values(AvatarSizeEnum);
7
+
8
+ const meta: Meta<typeof Avatar> = {
9
+ title: "Components/Avatar",
10
+ component: Avatar,
11
+ parameters: {
12
+ layout: "centered",
13
+ },
14
+ tags: ["autodocs"],
15
+ argTypes: {
16
+ src: {
17
+ control: { type: "text" },
18
+ description: "URL da imagem do avatar",
19
+ },
20
+ size: {
21
+ control: { type: "select" },
22
+ options: sizeOptions,
23
+ description: "Tamanho do avatar",
24
+ table: {
25
+ type: { summary: sizeOptions.join(" | ") },
26
+ },
27
+ },
28
+ name: {
29
+ control: { type: "text" },
30
+ description: "Nome do usuário para exibir as iniciais caso a imagem não seja fornecida",
31
+ },
32
+ },
33
+ };
34
+
35
+ export default meta;
36
+ type Story = StoryObj<typeof meta>;
37
+
38
+ const localImageUri = Image.resolveAssetSource(require("./images/girl.jpg")).uri;
39
+
40
+ export const Default: Story = {
41
+ args: {
42
+ src: localImageUri,
43
+ size: AvatarSizeEnum.MEDIUM,
44
+ },
45
+ };
46
+
47
+ export const AllVariants: Story = {
48
+ render: () => (
49
+ <View className="flex flex-col gap-500">
50
+ <View className="flex flex-row gap-400 bg-chia-200">
51
+ {sizeOptions.map((size) => (
52
+ <Avatar
53
+ key={size}
54
+ src=""
55
+ size={size}
56
+ name="John Doe"
57
+ />
58
+ ))}
59
+ </View>
60
+ <View className="flex flex-row gap-400">
61
+ {sizeOptions.map((size) => (
62
+ <Avatar
63
+ key={size}
64
+ src=""
65
+ size={size}
66
+ />
67
+ ))}
68
+ </View>
69
+ <View className="flex flex-row gap-400 bg-chia-700">
70
+ {sizeOptions.map((size) => (
71
+ <Avatar
72
+ key={size}
73
+ src={localImageUri}
74
+ size={size}
75
+ />
76
+ ))}
77
+ </View>
78
+ </View>
79
+ ),
80
+ args: {
81
+ src: localImageUri,
82
+ size: AvatarSizeEnum.MEDIUM,
83
+ },
84
+ };
@@ -0,0 +1,98 @@
1
+ import type { AvatarProps } from "./types";
2
+ import { Person } from "@kivid/icons/native";
3
+ import { View, Image } from "react-native";
4
+ import { AvatarSizeEnum } from "./enums";
5
+ import { avatarVariants } from "./assets/class-variants";
6
+ import { merge } from "@kivid/tailwind-preset";
7
+ import Typography from "../Typography";
8
+
9
+ export function Avatar(props: AvatarProps) {
10
+ const { src, name, size = AvatarSizeEnum.MEDIUM } = props;
11
+
12
+ const mappedSize = {
13
+ [AvatarSizeEnum.XLARGE]: 96,
14
+ [AvatarSizeEnum.LARGE]: 72,
15
+ [AvatarSizeEnum.MEDIUM]: 56,
16
+ [AvatarSizeEnum.SMALL]: 40,
17
+ [AvatarSizeEnum.XSMALL]: 32,
18
+ }[size];
19
+
20
+ const avatarStyle = avatarVariants({ size });
21
+
22
+ const avatarTextStyleMap = {
23
+ [AvatarSizeEnum.XSMALL]: {
24
+ variant: "body_small" as const,
25
+ fontWeight: "700" as const,
26
+ },
27
+ [AvatarSizeEnum.SMALL]: {
28
+ variant: "title_small" as const,
29
+ fontWeight: "700" as const,
30
+ },
31
+ [AvatarSizeEnum.MEDIUM]: {
32
+ variant: "title_large" as const,
33
+ fontWeight: "700" as const,
34
+ },
35
+ [AvatarSizeEnum.LARGE]: {
36
+ variant: "headline_small" as const,
37
+ fontWeight: "700" as const,
38
+ },
39
+ [AvatarSizeEnum.XLARGE]: {
40
+ variant: "headline_medium" as const,
41
+ fontWeight: "700" as const,
42
+ },
43
+ };
44
+
45
+ const calulatedInsideImageContainerSize = mappedSize - 1;
46
+
47
+ function renderFallbackType() {
48
+ if (name && !!name.trim()) {
49
+ const [firstName, surname] = name.split(" ");
50
+
51
+ const hasSurname = !!surname;
52
+ const hasName = !!firstName;
53
+
54
+ const firstLetterOfFirstName = hasName ? firstName?.at(0) : "";
55
+ const firstLetterOfSurname = hasSurname ? surname?.at(0) : "";
56
+
57
+ const firstLetters =
58
+ `${firstLetterOfFirstName}${firstLetterOfSurname}`.toUpperCase();
59
+
60
+ return (
61
+ <View className={avatarStyle}>
62
+ <Typography
63
+ className={"text-chia-600"}
64
+ variant={avatarTextStyleMap[size].variant}
65
+ weight={avatarTextStyleMap[size].fontWeight}
66
+ >
67
+ {firstLetters}
68
+ </Typography>
69
+ </View>
70
+ );
71
+ }
72
+
73
+ return (
74
+ <View
75
+ className={merge(avatarStyle, "bg-chia-300 border-chia-400 max-h-fit")}
76
+ >
77
+ <Person color="#B6C2C2" size={mappedSize} />
78
+ </View>
79
+ );
80
+ }
81
+
82
+ if (!src) {
83
+ return renderFallbackType();
84
+ }
85
+
86
+ return (
87
+ <View className={merge(avatarStyle, "border-chia-100 relative")}>
88
+ <Image
89
+ source={{ uri: src }}
90
+ className="rounded-full"
91
+ style={{
92
+ width: calulatedInsideImageContainerSize,
93
+ height: calulatedInsideImageContainerSize,
94
+ }}
95
+ />
96
+ </View>
97
+ );
98
+ }
@@ -0,0 +1,7 @@
1
+ import type { AvatarSizeEnum } from "./enums";
2
+
3
+ export interface AvatarProps {
4
+ src?: string | null;
5
+ name?: string;
6
+ size?: AvatarSizeEnum;
7
+ }
@@ -69,11 +69,6 @@ const textVariants = cva("", {
69
69
  glass: "text-chia-900",
70
70
  ghost: "text-chia-900",
71
71
  },
72
- size: {
73
- small: "text-label_small_700",
74
- medium: "text-label_medium_700",
75
- large: "text-label_large_700",
76
- },
77
72
  selected: {
78
73
  true: "",
79
74
  },
@@ -1,9 +1,15 @@
1
1
  import React from "react";
2
- import { Text, Pressable, Animated, GestureResponderEvent } from "react-native";
2
+ import { Pressable, Animated, GestureResponderEvent } from "react-native";
3
3
  import { merge } from "@kivid/tailwind-preset";
4
4
  import { LoadingDots } from "../LoadingDots";
5
5
  import { LoadingDotsVariant } from "../LoadingDots/types";
6
- import { ButtonProps, ButtonVariant } from "./types";
6
+ import type {
7
+ ButtonCorners,
8
+ ButtonProps,
9
+ ButtonSize,
10
+ ButtonVariant,
11
+ } from "./types";
12
+ import { Typography } from "../Typography";
7
13
  import {
8
14
  textVariants,
9
15
  buttonVariants,
@@ -43,11 +49,18 @@ export function Button(props: ButtonProps) {
43
49
  ghost: "grape",
44
50
  };
45
51
 
52
+ const typographyVariantMap = {
53
+ small: "label_small" as const,
54
+ medium: "label_medium" as const,
55
+ large: "label_large" as const,
56
+ };
57
+
58
+ const typographyVariant = typographyVariantMap[size ?? "medium"];
59
+
46
60
  function renderContent() {
47
61
  const textStyle = merge(
48
62
  textVariants({
49
63
  variant,
50
- size,
51
64
  selected: selected && (variant === "outline" || variant === "ghost"),
52
65
  })
53
66
  );
@@ -63,9 +76,14 @@ export function Button(props: ButtonProps) {
63
76
  }
64
77
 
65
78
  return (
66
- <Text className={textStyle} numberOfLines={1}>
79
+ <Typography
80
+ variant={typographyVariant}
81
+ weight="700"
82
+ className={textStyle}
83
+ numberOfLines={1}
84
+ >
67
85
  {children}
68
- </Text>
86
+ </Typography>
69
87
  );
70
88
  }
71
89
 
@@ -134,4 +152,4 @@ export function Button(props: ButtonProps) {
134
152
 
135
153
  Button.displayName = "Button";
136
154
 
137
- export default Button;
155
+ export { ButtonProps, ButtonVariant, ButtonSize, ButtonCorners };
@@ -1,9 +1,10 @@
1
1
  import { merge } from "@kivid/tailwind-preset";
2
- import type { ChipProps } from "./types";
2
+ import type { ChipProps, ChipSize, ChipVariant } from "./types";
3
3
  import { chipVariants } from "./assets/class-variants";
4
4
  import { Seal } from "../Seal";
5
- import { Text, View } from "react-native";
5
+ import { View } from "react-native";
6
6
  import { SealVariantEnum } from "../Seal/enums";
7
+ import { Typography } from "../Typography";
7
8
 
8
9
  export function Chip(props: ChipProps) {
9
10
  const {
@@ -14,11 +15,10 @@ export function Chip(props: ChipProps) {
14
15
  variant = "outline",
15
16
  } = props;
16
17
 
17
- const labelStyles = merge(
18
- "mx-auto",
19
- size === "medium" ? "text-label_small_700" : "text-label_medium_700",
20
- variant === "filled" ? "text-chia-200" : "text-chia-900"
21
- );
18
+ const typographyVariant = size === "medium" ? "label_small" : "label_medium";
19
+
20
+ const textColorClass =
21
+ variant === "filled" ? "text-chia-200" : "text-chia-900";
22
22
 
23
23
  return (
24
24
  <View
@@ -29,7 +29,15 @@ export function Chip(props: ChipProps) {
29
29
  inverted={variant === "filled"}
30
30
  size="small"
31
31
  />
32
- <Text className={labelStyles}>{label}</Text>
32
+ <Typography
33
+ variant={typographyVariant}
34
+ weight="700"
35
+ className={merge("mx-auto", textColorClass)}
36
+ >
37
+ {label}
38
+ </Typography>
33
39
  </View>
34
40
  );
35
41
  }
42
+
43
+ export { ChipProps, ChipSize, ChipVariant };
@@ -15,10 +15,33 @@ const meta = {
15
15
  highlightText: {
16
16
  control: "text",
17
17
  },
18
- className: {
19
- control: "text",
18
+ variant: {
19
+ control: "select",
20
+ options: [
21
+ "label_small",
22
+ "label_medium",
23
+ "label_large",
24
+ "body_small",
25
+ "body_medium",
26
+ "body_large",
27
+ "title_small",
28
+ "title_medium",
29
+ "title_large",
30
+ "headline_small",
31
+ "headline_medium",
32
+ "headline_large",
33
+ "display_small",
34
+ "display_medium",
35
+ "display_large",
36
+ ],
37
+ description: "Typography variant for the base text",
20
38
  },
21
- highlightTextClassName: {
39
+ weight: {
40
+ control: "select",
41
+ options: ["400", "500", "600", "700"],
42
+ description: "Typography weight for the base text",
43
+ },
44
+ className: {
22
45
  control: "text",
23
46
  },
24
47
  reverse: {
@@ -26,6 +49,11 @@ const meta = {
26
49
  description:
27
50
  "If true, the highlighted text will be displayed before the regular text.",
28
51
  },
52
+ highlightedTextProps: {
53
+ control: "object",
54
+ description:
55
+ "Props for the highlighted text Typography component (className, variant, weight)",
56
+ },
29
57
  },
30
58
  } satisfies Meta<typeof HighlightedText>;
31
59
 
@@ -49,8 +77,12 @@ export const LabelVariant: Story = {
49
77
  args: {
50
78
  text: "Label text",
51
79
  highlightText: "important",
52
- className: "text-label_medium_300",
53
- highlightTextClassName: "text-label_medium_700",
80
+ variant: "label_medium",
81
+ weight: "400",
82
+ highlightedTextProps: {
83
+ variant: "label_medium",
84
+ weight: "700",
85
+ },
54
86
  },
55
87
  };
56
88
 
@@ -58,8 +90,12 @@ export const BodyVariant: Story = {
58
90
  args: {
59
91
  text: "Body text content",
60
92
  highlightText: "highlighted part",
61
- className: "text-body_medium_300",
62
- highlightTextClassName: "text-body_medium_700",
93
+ variant: "body_medium",
94
+ weight: "400",
95
+ highlightedTextProps: {
96
+ variant: "body_medium",
97
+ weight: "700",
98
+ },
63
99
  },
64
100
  };
65
101
 
@@ -67,17 +103,25 @@ export const TitleVariant: Story = {
67
103
  args: {
68
104
  text: "Title text content",
69
105
  highlightText: "highlighted part",
70
- className: "text-title_medium_300",
71
- highlightTextClassName: "text-title_medium_700",
106
+ variant: "title_medium",
107
+ weight: "400",
108
+ highlightedTextProps: {
109
+ variant: "title_medium",
110
+ weight: "700",
111
+ },
72
112
  },
73
113
  };
74
114
 
75
- export const HeadlineVariant: Story = {
115
+ export const HeadingVariant: Story = {
76
116
  args: {
77
- text: "Headline text content",
117
+ text: "Heading text content",
78
118
  highlightText: "highlighted part",
79
- className: "text-headline_medium_300",
80
- highlightTextClassName: "text-headline_medium_700",
119
+ variant: "headline_medium",
120
+ weight: "400",
121
+ highlightedTextProps: {
122
+ variant: "headline_medium",
123
+ weight: "700",
124
+ },
81
125
  },
82
126
  };
83
127
 
@@ -85,8 +129,12 @@ export const DisplayVariant: Story = {
85
129
  args: {
86
130
  text: "Display text content",
87
131
  highlightText: "highlighted part",
88
- className: "text-display_medium_300",
89
- highlightTextClassName: "text-display_medium_700",
132
+ variant: "display_medium",
133
+ weight: "400",
134
+ highlightedTextProps: {
135
+ variant: "display_medium",
136
+ weight: "700",
137
+ },
90
138
  },
91
139
  };
92
140
 
@@ -94,8 +142,14 @@ export const WithCustomClasses: Story = {
94
142
  args: {
95
143
  text: "Styled text",
96
144
  highlightText: "with custom styling",
145
+ variant: "body_medium",
146
+ weight: "400",
97
147
  className: "text-tangerine-900",
98
- highlightTextClassName: "text-mango-900 underline",
148
+ highlightedTextProps: {
149
+ variant: "body_medium",
150
+ weight: "600",
151
+ className: "text-mango-900 underline",
152
+ },
99
153
  },
100
154
  };
101
155
 
@@ -103,8 +157,53 @@ export const ReverseHighlight: Story = {
103
157
  args: {
104
158
  text: "text with reverse highlight",
105
159
  highlightText: "Highlighted first",
160
+ variant: "label_medium",
161
+ weight: "400",
106
162
  reverse: true,
107
- className: "text-label_medium_300",
108
- highlightTextClassName: "text-label_medium_700",
163
+ highlightedTextProps: {
164
+ variant: "label_medium",
165
+ weight: "700",
166
+ },
167
+ },
168
+ };
169
+
170
+ export const WeightVariations: Story = {
171
+ args: {
172
+ text: "Different weight for",
173
+ highlightText: "highlighted text",
174
+ variant: "body_medium",
175
+ weight: "400",
176
+ highlightedTextProps: {
177
+ variant: "body_medium",
178
+ weight: "600",
179
+ },
180
+ },
181
+ };
182
+
183
+ export const MixedStyling: Story = {
184
+ args: {
185
+ text: "Typography props with",
186
+ highlightText: "custom classes",
187
+ variant: "body_medium",
188
+ weight: "400",
189
+ className: "text-blue-600",
190
+ highlightedTextProps: {
191
+ variant: "title_small",
192
+ weight: "700",
193
+ className: "text-red-500 underline",
194
+ },
195
+ },
196
+ };
197
+
198
+ export const BaseTextVariations: Story = {
199
+ args: {
200
+ text: "Large title base text with",
201
+ highlightText: "small label highlight",
202
+ variant: "title_large",
203
+ weight: "600",
204
+ highlightedTextProps: {
205
+ variant: "label_small",
206
+ weight: "700",
207
+ },
109
208
  },
110
209
  };
@@ -1,38 +1,58 @@
1
1
  import type { HighlightedTextProps } from "./types";
2
- import { merge } from "@kivid/tailwind-preset";
3
- import { Text } from "react-native";
2
+ import { Typography } from "../Typography";
4
3
 
5
4
  export function HighlightedText(props: HighlightedTextProps) {
6
5
  const {
7
6
  text,
8
7
  highlightText,
9
8
  className,
10
- highlightTextClassName,
11
9
  reverse,
12
- ref,
10
+ highlightedTextProps = {},
11
+ variant = "label_medium",
12
+ weight = "400",
13
13
  ...rest
14
14
  } = props;
15
15
 
16
- const mergeClassName = merge("text-label_medium_300", className);
17
- const mergeHighlightClassName = merge(
18
- "text-label_medium_700",
19
- highlightTextClassName
20
- );
21
-
22
16
  if (reverse) {
23
17
  return (
24
- <Text ref={ref} className={mergeClassName} {...rest}>
25
- <Text className={mergeHighlightClassName}>{highlightText}</Text> {text}
26
- </Text>
18
+ <Typography
19
+ variant={variant}
20
+ weight={weight}
21
+ className={className}
22
+ {...rest}
23
+ >
24
+ <Typography
25
+ variant={highlightedTextProps.variant}
26
+ weight={highlightedTextProps.weight}
27
+ {...highlightedTextProps}
28
+ >
29
+ {highlightText}
30
+ </Typography>{" "}
31
+ {text}
32
+ </Typography>
27
33
  );
28
34
  }
29
35
 
30
36
  return (
31
- <Text ref={ref} className={mergeClassName} {...rest}>
32
- {text} <Text className={mergeHighlightClassName}>{highlightText}</Text>
33
- </Text>
37
+ <Typography
38
+ variant={variant}
39
+ weight={weight}
40
+ className={className}
41
+ {...rest}
42
+ >
43
+ {text}{" "}
44
+ <Typography
45
+ variant={highlightedTextProps.variant || "label_medium"}
46
+ weight={highlightedTextProps.weight || "700"}
47
+ {...highlightedTextProps}
48
+ >
49
+ {highlightText}
50
+ </Typography>
51
+ </Typography>
34
52
  );
35
53
  }
36
54
 
37
55
  HighlightedText.displayName = "HighlightedText";
38
56
  export default HighlightedText;
57
+
58
+ export { HighlightedTextProps };