@korsolutions/ui 0.0.60 → 0.0.62

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 (125) hide show
  1. package/dist/module/components/button/variants/ghost.js +59 -0
  2. package/dist/module/components/button/variants/ghost.js.map +1 -0
  3. package/dist/module/components/button/variants/index.js +3 -1
  4. package/dist/module/components/button/variants/index.js.map +1 -1
  5. package/dist/module/components/icon-button/icon-button.js +63 -0
  6. package/dist/module/components/icon-button/icon-button.js.map +1 -0
  7. package/dist/module/components/icon-button/index.js +4 -0
  8. package/dist/module/components/icon-button/index.js.map +1 -0
  9. package/dist/module/components/icon-button/types.js +4 -0
  10. package/dist/module/components/icon-button/types.js.map +1 -0
  11. package/dist/module/components/icon-button/variants/default.js +34 -0
  12. package/dist/module/components/icon-button/variants/default.js.map +1 -0
  13. package/dist/module/components/icon-button/variants/ghost.js +35 -0
  14. package/dist/module/components/icon-button/variants/ghost.js.map +1 -0
  15. package/dist/module/components/icon-button/variants/index.js +11 -0
  16. package/dist/module/components/icon-button/variants/index.js.map +1 -0
  17. package/dist/module/components/icon-button/variants/secondary.js +37 -0
  18. package/dist/module/components/icon-button/variants/secondary.js.map +1 -0
  19. package/dist/module/components/index.js +2 -0
  20. package/dist/module/components/index.js.map +1 -1
  21. package/dist/module/components/separator/index.js +4 -0
  22. package/dist/module/components/separator/index.js.map +1 -0
  23. package/dist/module/components/separator/separator.js +17 -0
  24. package/dist/module/components/separator/separator.js.map +1 -0
  25. package/dist/module/components/separator/types.js +4 -0
  26. package/dist/module/components/separator/types.js.map +1 -0
  27. package/dist/module/components/separator/variants/horizontal.js +15 -0
  28. package/dist/module/components/separator/variants/horizontal.js.map +1 -0
  29. package/dist/module/components/separator/variants/index.js +9 -0
  30. package/dist/module/components/separator/variants/index.js.map +1 -0
  31. package/dist/module/components/separator/variants/vertical.js +15 -0
  32. package/dist/module/components/separator/variants/vertical.js.map +1 -0
  33. package/dist/module/components/tabs/components/tabs-item.js +61 -0
  34. package/dist/module/components/tabs/components/tabs-item.js.map +1 -0
  35. package/dist/module/components/tabs/components/tabs-root.js +3 -2
  36. package/dist/module/components/tabs/components/tabs-root.js.map +1 -1
  37. package/dist/module/components/tabs/index.js +2 -6
  38. package/dist/module/components/tabs/index.js.map +1 -1
  39. package/dist/module/components/tabs/use-organized-children.js +37 -0
  40. package/dist/module/components/tabs/use-organized-children.js.map +1 -0
  41. package/dist/module/components/tabs/variants/default.js +26 -8
  42. package/dist/module/components/tabs/variants/default.js.map +1 -1
  43. package/dist/module/components/tabs/variants/line.js +24 -7
  44. package/dist/module/components/tabs/variants/line.js.map +1 -1
  45. package/dist/typescript/src/components/button/variants/ghost.d.ts +3 -0
  46. package/dist/typescript/src/components/button/variants/ghost.d.ts.map +1 -0
  47. package/dist/typescript/src/components/button/variants/index.d.ts +1 -0
  48. package/dist/typescript/src/components/button/variants/index.d.ts.map +1 -1
  49. package/dist/typescript/src/components/icon-button/icon-button.d.ts +15 -0
  50. package/dist/typescript/src/components/icon-button/icon-button.d.ts.map +1 -0
  51. package/dist/typescript/src/components/icon-button/index.d.ts +3 -0
  52. package/dist/typescript/src/components/icon-button/index.d.ts.map +1 -0
  53. package/dist/typescript/src/components/icon-button/types.d.ts +8 -0
  54. package/dist/typescript/src/components/icon-button/types.d.ts.map +1 -0
  55. package/dist/typescript/src/components/icon-button/variants/default.d.ts +3 -0
  56. package/dist/typescript/src/components/icon-button/variants/default.d.ts.map +1 -0
  57. package/dist/typescript/src/components/icon-button/variants/ghost.d.ts +3 -0
  58. package/dist/typescript/src/components/icon-button/variants/ghost.d.ts.map +1 -0
  59. package/dist/typescript/src/components/icon-button/variants/index.d.ts +6 -0
  60. package/dist/typescript/src/components/icon-button/variants/index.d.ts.map +1 -0
  61. package/dist/typescript/src/components/icon-button/variants/secondary.d.ts +3 -0
  62. package/dist/typescript/src/components/icon-button/variants/secondary.d.ts.map +1 -0
  63. package/dist/typescript/src/components/index.d.ts +2 -0
  64. package/dist/typescript/src/components/index.d.ts.map +1 -1
  65. package/dist/typescript/src/components/separator/index.d.ts +3 -0
  66. package/dist/typescript/src/components/separator/index.d.ts.map +1 -0
  67. package/dist/typescript/src/components/separator/separator.d.ts +9 -0
  68. package/dist/typescript/src/components/separator/separator.d.ts.map +1 -0
  69. package/dist/typescript/src/components/separator/types.d.ts +5 -0
  70. package/dist/typescript/src/components/separator/types.d.ts.map +1 -0
  71. package/dist/typescript/src/components/separator/variants/horizontal.d.ts +3 -0
  72. package/dist/typescript/src/components/separator/variants/horizontal.d.ts.map +1 -0
  73. package/dist/typescript/src/components/separator/variants/index.d.ts +5 -0
  74. package/dist/typescript/src/components/separator/variants/index.d.ts.map +1 -0
  75. package/dist/typescript/src/components/separator/variants/vertical.d.ts +3 -0
  76. package/dist/typescript/src/components/separator/variants/vertical.d.ts.map +1 -0
  77. package/dist/typescript/src/components/tabs/components/{tabs-trigger.d.ts → tabs-item.d.ts} +3 -3
  78. package/dist/typescript/src/components/tabs/components/tabs-item.d.ts.map +1 -0
  79. package/dist/typescript/src/components/tabs/components/tabs-root.d.ts.map +1 -1
  80. package/dist/typescript/src/components/tabs/index.d.ts +3 -9
  81. package/dist/typescript/src/components/tabs/index.d.ts.map +1 -1
  82. package/dist/typescript/src/components/tabs/types.d.ts +8 -7
  83. package/dist/typescript/src/components/tabs/types.d.ts.map +1 -1
  84. package/dist/typescript/src/components/tabs/use-organized-children.d.ts +5 -0
  85. package/dist/typescript/src/components/tabs/use-organized-children.d.ts.map +1 -0
  86. package/dist/typescript/src/components/tabs/variants/default.d.ts.map +1 -1
  87. package/dist/typescript/src/components/tabs/variants/line.d.ts.map +1 -1
  88. package/package.json +1 -1
  89. package/src/components/button/variants/ghost.tsx +55 -0
  90. package/src/components/button/variants/index.ts +2 -0
  91. package/src/components/icon-button/icon-button.tsx +92 -0
  92. package/src/components/icon-button/index.ts +2 -0
  93. package/src/components/icon-button/types.ts +9 -0
  94. package/src/components/icon-button/variants/default.tsx +32 -0
  95. package/src/components/icon-button/variants/ghost.tsx +33 -0
  96. package/src/components/icon-button/variants/index.ts +9 -0
  97. package/src/components/icon-button/variants/secondary.tsx +35 -0
  98. package/src/components/index.ts +2 -0
  99. package/src/components/separator/index.ts +2 -0
  100. package/src/components/separator/separator.tsx +15 -0
  101. package/src/components/separator/types.ts +5 -0
  102. package/src/components/separator/variants/horizontal.tsx +14 -0
  103. package/src/components/separator/variants/index.ts +7 -0
  104. package/src/components/separator/variants/vertical.tsx +14 -0
  105. package/src/components/tabs/components/tabs-item.tsx +96 -0
  106. package/src/components/tabs/components/tabs-root.tsx +9 -2
  107. package/src/components/tabs/index.ts +3 -9
  108. package/src/components/tabs/types.ts +8 -7
  109. package/src/components/tabs/use-organized-children.tsx +37 -0
  110. package/src/components/tabs/variants/default.tsx +25 -7
  111. package/src/components/tabs/variants/line.tsx +22 -5
  112. package/dist/module/components/tabs/components/tabs-list.js +0 -23
  113. package/dist/module/components/tabs/components/tabs-list.js.map +0 -1
  114. package/dist/module/components/tabs/components/tabs-trigger-text.js +0 -28
  115. package/dist/module/components/tabs/components/tabs-trigger-text.js.map +0 -1
  116. package/dist/module/components/tabs/components/tabs-trigger.js +0 -45
  117. package/dist/module/components/tabs/components/tabs-trigger.js.map +0 -1
  118. package/dist/typescript/src/components/tabs/components/tabs-list.d.ts +0 -8
  119. package/dist/typescript/src/components/tabs/components/tabs-list.d.ts.map +0 -1
  120. package/dist/typescript/src/components/tabs/components/tabs-trigger-text.d.ts +0 -10
  121. package/dist/typescript/src/components/tabs/components/tabs-trigger-text.d.ts.map +0 -1
  122. package/dist/typescript/src/components/tabs/components/tabs-trigger.d.ts.map +0 -1
  123. package/src/components/tabs/components/tabs-list.tsx +0 -21
  124. package/src/components/tabs/components/tabs-trigger-text.tsx +0 -26
  125. package/src/components/tabs/components/tabs-trigger.tsx +0 -43
@@ -0,0 +1,32 @@
1
+ import { hslaSetRelativeLightness } from "../../../utils/hsla-utils";
2
+ import { useThemedStyles } from "../../../utils/use-themed-styles";
3
+ import type { IconButtonStyles } from "../types";
4
+
5
+ export const useIconButtonVariantDefault = (): IconButtonStyles => {
6
+ return useThemedStyles(
7
+ ({ colors, radius }): IconButtonStyles => ({
8
+ root: {
9
+ default: {
10
+ alignItems: "center",
11
+ justifyContent: "center",
12
+ padding: 8,
13
+ borderRadius: radius,
14
+ backgroundColor: colors.primary,
15
+ borderWidth: 1,
16
+ borderColor: colors.border,
17
+ },
18
+ disabled: {
19
+ opacity: 0.5,
20
+ },
21
+ hovered: {
22
+ backgroundColor: hslaSetRelativeLightness(colors.primary, -10),
23
+ },
24
+ },
25
+ icon: {
26
+ default: {
27
+ color: colors.primaryForeground,
28
+ },
29
+ },
30
+ }),
31
+ );
32
+ };
@@ -0,0 +1,33 @@
1
+ import { hslaSetRelativeLightness } from "../../../utils/hsla-utils";
2
+ import { useThemedStyles } from "../../../utils/use-themed-styles";
3
+ import type { IconButtonStyles } from "../types";
4
+
5
+ export const useIconButtonVariantGhost = (): IconButtonStyles => {
6
+ return useThemedStyles(
7
+ ({ colors, radius }): IconButtonStyles => ({
8
+ root: {
9
+ default: {
10
+ alignItems: "center",
11
+ justifyContent: "center",
12
+ padding: 8,
13
+ borderRadius: radius,
14
+ backgroundColor: "transparent",
15
+ },
16
+ disabled: {
17
+ opacity: 0.5,
18
+ },
19
+ hovered: {
20
+ backgroundColor: hslaSetRelativeLightness(colors.secondary, -1),
21
+ },
22
+ },
23
+ icon: {
24
+ default: {
25
+ color: colors.foreground,
26
+ },
27
+ disabled: {
28
+ color: colors.mutedForeground,
29
+ },
30
+ },
31
+ }),
32
+ );
33
+ };
@@ -0,0 +1,9 @@
1
+ import { useIconButtonVariantDefault } from "./default";
2
+ import { useIconButtonVariantGhost } from "./ghost";
3
+ import { useIconButtonVariantSecondary } from "./secondary";
4
+
5
+ export const IconButtonVariants = {
6
+ default: useIconButtonVariantDefault,
7
+ secondary: useIconButtonVariantSecondary,
8
+ ghost: useIconButtonVariantGhost,
9
+ };
@@ -0,0 +1,35 @@
1
+ import { hslaSetRelativeLightness } from "../../../utils/hsla-utils";
2
+ import { useThemedStyles } from "../../../utils/use-themed-styles";
3
+ import type { IconButtonStyles } from "../types";
4
+
5
+ export const useIconButtonVariantSecondary = (): IconButtonStyles => {
6
+ return useThemedStyles(
7
+ ({ colors, radius }): IconButtonStyles => ({
8
+ root: {
9
+ default: {
10
+ alignItems: "center",
11
+ justifyContent: "center",
12
+ padding: 8,
13
+ borderRadius: radius,
14
+ borderWidth: 1,
15
+ borderColor: colors.border,
16
+ backgroundColor: colors.secondary,
17
+ },
18
+ disabled: {
19
+ opacity: 0.5,
20
+ },
21
+ hovered: {
22
+ backgroundColor: hslaSetRelativeLightness(colors.secondary, -1),
23
+ },
24
+ },
25
+ icon: {
26
+ default: {
27
+ color: colors.secondaryForeground,
28
+ },
29
+ disabled: {
30
+ color: colors.mutedForeground,
31
+ },
32
+ },
33
+ }),
34
+ );
35
+ };
@@ -9,6 +9,7 @@ export * from "./checkbox";
9
9
  export * from "./empty";
10
10
  export * from "./field";
11
11
  export * from "./icon";
12
+ export * from "./icon-button";
12
13
  export * from "./input";
13
14
  export * from "./link";
14
15
  export * from "./list";
@@ -19,6 +20,7 @@ export * from "./portal";
19
20
  export * from "./progress";
20
21
  export * from "./scroll-bar";
21
22
  export * from "./select";
23
+ export * from "./separator";
22
24
  export * from "./tabs";
23
25
  export * from "./textarea";
24
26
  export * from "./toast";
@@ -0,0 +1,2 @@
1
+ export { Separator, type SeparatorProps } from "./separator";
2
+ export type { SeparatorStyles } from "./types";
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import { View, type StyleProp, type ViewStyle } from "react-native";
3
+ import { SeparatorVariants } from "./variants";
4
+
5
+ export interface SeparatorProps {
6
+ variant?: keyof typeof SeparatorVariants;
7
+ style?: StyleProp<ViewStyle>;
8
+ }
9
+
10
+ export function Separator(props: SeparatorProps) {
11
+ const { variant = "horizontal", style } = props;
12
+ const variantStyles = SeparatorVariants[variant]();
13
+
14
+ return <View style={[variantStyles.root, style]} />;
15
+ }
@@ -0,0 +1,5 @@
1
+ import type { StyleProp, ViewStyle } from "react-native";
2
+
3
+ export interface SeparatorStyles {
4
+ root?: StyleProp<ViewStyle>;
5
+ }
@@ -0,0 +1,14 @@
1
+ import { useThemedStyles } from "../../../utils/use-themed-styles";
2
+ import type { SeparatorStyles } from "../types";
3
+
4
+ export const useSeparatorVariantHorizontal = (): SeparatorStyles => {
5
+ return useThemedStyles(
6
+ ({ colors }): SeparatorStyles => ({
7
+ root: {
8
+ height: 1,
9
+ alignSelf: "stretch",
10
+ backgroundColor: colors.border,
11
+ },
12
+ }),
13
+ );
14
+ };
@@ -0,0 +1,7 @@
1
+ import { useSeparatorVariantHorizontal } from "./horizontal";
2
+ import { useSeparatorVariantVertical } from "./vertical";
3
+
4
+ export const SeparatorVariants = {
5
+ horizontal: useSeparatorVariantHorizontal,
6
+ vertical: useSeparatorVariantVertical,
7
+ };
@@ -0,0 +1,14 @@
1
+ import { useThemedStyles } from "../../../utils/use-themed-styles";
2
+ import type { SeparatorStyles } from "../types";
3
+
4
+ export const useSeparatorVariantVertical = (): SeparatorStyles => {
5
+ return useThemedStyles(
6
+ ({ colors }): SeparatorStyles => ({
7
+ root: {
8
+ width: 1,
9
+ alignSelf: "stretch",
10
+ backgroundColor: colors.border,
11
+ },
12
+ }),
13
+ );
14
+ };
@@ -0,0 +1,96 @@
1
+ import React, { useState } from "react";
2
+ import {
3
+ Pressable,
4
+ StyleSheet,
5
+ type PressableProps,
6
+ type StyleProp,
7
+ type ViewStyle,
8
+ } from "react-native";
9
+ import { useTabsContext } from "../context";
10
+ import type { TabsItemState } from "../types";
11
+ import { useOrganizedChildren } from "../use-organized-children";
12
+
13
+ export interface TabsItemProps extends PressableProps {
14
+ children: React.ReactNode;
15
+ value: string;
16
+ isDisabled?: boolean;
17
+ style?: StyleProp<ViewStyle>;
18
+ }
19
+
20
+ const calculateState = (
21
+ isActive: boolean,
22
+ isDisabled: boolean,
23
+ isHovered: boolean,
24
+ ): TabsItemState => {
25
+ if (isDisabled) {
26
+ return "disabled";
27
+ }
28
+ if (isActive) {
29
+ return "active";
30
+ }
31
+ if (isHovered) {
32
+ return "hovered";
33
+ }
34
+ return "default";
35
+ };
36
+
37
+ export function TabsItem(props: TabsItemProps) {
38
+ const {
39
+ children,
40
+ value: triggerValue,
41
+ isDisabled = false,
42
+ style,
43
+ ...pressableProps
44
+ } = props;
45
+ const { value, onChange, styles } = useTabsContext();
46
+ const [isHovered, setIsHovered] = useState(false);
47
+ const isActive = value === triggerValue;
48
+ const state = calculateState(isActive, isDisabled, isHovered);
49
+
50
+ const handlePress = () => {
51
+ if (!isDisabled) {
52
+ onChange(triggerValue);
53
+ }
54
+ };
55
+
56
+ const calculatedStyle = StyleSheet.flatten([
57
+ styles?.item?.default,
58
+ styles?.item?.[state],
59
+ style,
60
+ ]);
61
+
62
+ const textStyles = StyleSheet.flatten([
63
+ styles?.itemText?.default,
64
+ styles?.itemText?.[state],
65
+ ]);
66
+
67
+ const iconStyles = StyleSheet.flatten([
68
+ styles?.itemIcon?.default,
69
+ styles?.itemIcon?.[state],
70
+ ]);
71
+
72
+ const organizedChildren = useOrganizedChildren(
73
+ children,
74
+ textStyles,
75
+ iconStyles ?? undefined,
76
+ );
77
+
78
+ return (
79
+ <Pressable
80
+ {...pressableProps}
81
+ onHoverIn={(e) => {
82
+ setIsHovered(true);
83
+ pressableProps.onHoverIn?.(e);
84
+ }}
85
+ onHoverOut={(e) => {
86
+ setIsHovered(false);
87
+ pressableProps.onHoverOut?.(e);
88
+ }}
89
+ disabled={isDisabled}
90
+ onPress={handlePress}
91
+ style={calculatedStyle}
92
+ >
93
+ {organizedChildren}
94
+ </Pressable>
95
+ );
96
+ }
@@ -1,5 +1,11 @@
1
1
  import React, { useMemo } from "react";
2
- import { View, type StyleProp, type ViewProps, type ViewStyle } from "react-native";
2
+ import {
3
+ StyleSheet,
4
+ View,
5
+ type StyleProp,
6
+ type ViewProps,
7
+ type ViewStyle,
8
+ } from "react-native";
3
9
  import { TabsContext } from "../context";
4
10
  import { TabsVariants } from "../variants";
5
11
 
@@ -23,10 +29,11 @@ export function TabsRoot(props: TabsRootProps) {
23
29
  }),
24
30
  [value, onChange, variantStyles],
25
31
  );
32
+ const composedStyles = StyleSheet.flatten([variantStyles?.root, style]);
26
33
 
27
34
  return (
28
35
  <TabsContext.Provider value={contextValue}>
29
- <View {...viewProps} style={style}>
36
+ <View {...viewProps} style={composedStyles}>
30
37
  {children}
31
38
  </View>
32
39
  </TabsContext.Provider>
@@ -1,17 +1,11 @@
1
- import { TabsList } from "./components/tabs-list";
1
+ import { TabsItem } from "./components/tabs-item";
2
2
  import { TabsRoot } from "./components/tabs-root";
3
- import { TabsTrigger } from "./components/tabs-trigger";
4
- import { TabsTriggerText } from "./components/tabs-trigger-text";
5
3
 
6
4
  export const Tabs = {
7
5
  Root: TabsRoot,
8
- List: TabsList,
9
- Trigger: TabsTrigger,
10
- TriggerText: TabsTriggerText,
6
+ Item: TabsItem,
11
7
  };
12
8
 
13
- export type { TabsListProps } from "./components/tabs-list";
9
+ export type { TabsItemProps } from "./components/tabs-item";
14
10
  export type { TabsRootProps } from "./components/tabs-root";
15
- export type { TabsTriggerProps } from "./components/tabs-trigger";
16
- export type { TabsTriggerTextProps } from "./components/tabs-trigger-text";
17
11
  export * from "./types";
@@ -1,12 +1,13 @@
1
1
  import type { StyleProp, TextStyle } from "react-native";
2
- import type { TabsListProps } from "./components/tabs-list";
3
- import type { TabsTriggerProps } from "./components/tabs-trigger";
2
+ import type { IconProps } from "../icon";
3
+ import type { TabsItemProps } from "./components/tabs-item";
4
+ import type { TabsRootProps } from "./components/tabs-root";
4
5
 
5
- export type TabsState = "default" | "active" | "disabled";
6
+ export type TabsItemState = "default" | "active" | "disabled" | "hovered";
6
7
 
7
8
  export interface TabsStyles {
8
- root?: TabsListProps["style"];
9
- list?: TabsListProps["style"];
10
- trigger?: Partial<Record<TabsState, TabsTriggerProps["style"]>>;
11
- triggerText?: Partial<Record<TabsState, StyleProp<TextStyle>>>;
9
+ root?: TabsRootProps["style"];
10
+ item?: Partial<Record<TabsItemState, TabsItemProps["style"]>>;
11
+ itemText?: Partial<Record<TabsItemState, StyleProp<TextStyle>>>;
12
+ itemIcon?: Partial<Record<TabsItemState, IconProps>>;
12
13
  }
@@ -0,0 +1,37 @@
1
+ import React, { useMemo } from "react";
2
+ import { Text, type StyleProp, type TextStyle } from "react-native";
3
+ import { getElementProp } from "../../utils/element-utils";
4
+ import { Icon, type IconProps } from "../icon";
5
+
6
+ export function useOrganizedChildren(
7
+ children: React.ReactNode,
8
+ textStyle: StyleProp<TextStyle> | undefined,
9
+ iconProps: IconProps | undefined,
10
+ ) {
11
+ const organizedChildren = useMemo(() => {
12
+ if (typeof children === "string") {
13
+ return <Text style={textStyle}>{children}</Text>;
14
+ }
15
+ if (Array.isArray(children)) {
16
+ return children.map((child, index) => {
17
+ if (typeof child === "string") {
18
+ return (
19
+ <Text key={index} style={textStyle}>
20
+ {child}
21
+ </Text>
22
+ );
23
+ } else if (React.isValidElement(child) && child.type === Icon) {
24
+ return React.cloneElement(child as React.ReactElement<any>, {
25
+ key: child.key,
26
+ ...iconProps,
27
+ style: [iconProps?.style, getElementProp(child, "style")],
28
+ });
29
+ }
30
+ return child;
31
+ });
32
+ }
33
+ return children;
34
+ }, [children, iconProps, textStyle]);
35
+
36
+ return organizedChildren;
37
+ }
@@ -4,37 +4,55 @@ import { type TabsStyles } from "../types";
4
4
  export const useTabsVariantDefault = (): TabsStyles => {
5
5
  return useThemedStyles(
6
6
  ({ colors, radius, fontFamily, fontSize }): TabsStyles => ({
7
- list: {
7
+ root: {
8
8
  flexDirection: "row",
9
9
  backgroundColor: colors.muted,
10
10
  padding: 4,
11
11
  borderRadius: radius,
12
12
  gap: 4,
13
13
  },
14
- trigger: {
14
+ item: {
15
15
  default: {
16
- paddingVertical: 8,
16
+ flex: 1,
17
+ flexDirection: "row",
18
+ alignItems: "center",
19
+ justifyContent: "center",
20
+ gap: 8,
21
+ paddingVertical: 6,
17
22
  paddingHorizontal: 12,
18
- borderRadius: radius,
23
+ borderRadius: radius - 2,
19
24
  backgroundColor: "transparent",
20
25
  },
21
26
  active: {
22
27
  backgroundColor: colors.background,
23
28
  shadowColor: "#000",
24
29
  shadowOffset: { width: 0, height: 1 },
25
- shadowOpacity: 0.1,
30
+ shadowOpacity: 0.05,
26
31
  shadowRadius: 2,
27
- elevation: 2,
32
+ elevation: 1,
28
33
  },
29
34
  disabled: {
30
35
  opacity: 0.5,
31
36
  },
32
37
  },
33
- triggerText: {
38
+ itemText: {
34
39
  default: {
35
40
  color: colors.mutedForeground,
36
41
  fontSize,
37
42
  fontFamily,
43
+ fontWeight: "500",
44
+ },
45
+ active: {
46
+ color: colors.foreground,
47
+ },
48
+ disabled: {
49
+ color: colors.mutedForeground,
50
+ },
51
+ },
52
+ itemIcon: {
53
+ default: {
54
+ color: colors.mutedForeground,
55
+ size: fontSize,
38
56
  },
39
57
  active: {
40
58
  color: colors.foreground,
@@ -4,16 +4,20 @@ import { useThemedStyles } from "../../../utils/use-themed-styles";
4
4
  export const useTabsVariantLine = (): TabsStyles => {
5
5
  return useThemedStyles(
6
6
  ({ colors, fontFamily, fontSize }): TabsStyles => ({
7
- list: {
7
+ root: {
8
8
  flexDirection: "row",
9
9
  borderBottomWidth: 1,
10
10
  borderBottomColor: colors.border,
11
- gap: 0,
12
11
  },
13
- trigger: {
12
+ item: {
14
13
  default: {
15
- paddingVertical: 12,
14
+ flexDirection: "row",
15
+ alignItems: "center",
16
+ justifyContent: "center",
17
+ gap: 8,
18
+ paddingVertical: 8,
16
19
  paddingHorizontal: 16,
20
+ marginBottom: -1,
17
21
  borderBottomWidth: 2,
18
22
  borderBottomColor: "transparent",
19
23
  backgroundColor: "transparent",
@@ -25,11 +29,24 @@ export const useTabsVariantLine = (): TabsStyles => {
25
29
  opacity: 0.5,
26
30
  },
27
31
  },
28
- triggerText: {
32
+ itemText: {
29
33
  default: {
30
34
  color: colors.mutedForeground,
31
35
  fontSize,
32
36
  fontFamily,
37
+ fontWeight: "500",
38
+ },
39
+ active: {
40
+ color: colors.foreground,
41
+ },
42
+ disabled: {
43
+ color: colors.mutedForeground,
44
+ },
45
+ },
46
+ itemIcon: {
47
+ default: {
48
+ color: colors.mutedForeground,
49
+ size: fontSize,
33
50
  },
34
51
  active: {
35
52
  color: colors.foreground,
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- import React from "react";
4
- import { View } from "react-native";
5
- import { useTabsContext } from "../context.js";
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- export function TabsList(props) {
8
- const {
9
- children,
10
- style,
11
- ...viewProps
12
- } = props;
13
- const {
14
- styles
15
- } = useTabsContext();
16
- const calculatedStyle = [styles?.list, style];
17
- return /*#__PURE__*/_jsx(View, {
18
- ...viewProps,
19
- style: calculatedStyle,
20
- children: children
21
- });
22
- }
23
- //# sourceMappingURL=tabs-list.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","View","useTabsContext","jsx","_jsx","TabsList","props","children","style","viewProps","styles","calculatedStyle","list"],"sourceRoot":"../../../../../src","sources":["components/tabs/components/tabs-list.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAwD,cAAc;AACnF,SAASC,cAAc,QAAQ,eAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAO5C,OAAO,SAASC,QAAQA,CAACC,KAAoB,EAAE;EAC7C,MAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAE,GAAGC;EAAU,CAAC,GAAGH,KAAK;EAC/C,MAAM;IAAEI;EAAO,CAAC,GAAGR,cAAc,CAAC,CAAC;EAEnC,MAAMS,eAAe,GAAG,CAACD,MAAM,EAAEE,IAAI,EAAEJ,KAAK,CAAC;EAE7C,oBACEJ,IAAA,CAACH,IAAI;IAAA,GAAKQ,SAAS;IAAED,KAAK,EAAEG,eAAgB;IAAAJ,QAAA,EACzCA;EAAQ,CACL,CAAC;AAEX","ignoreList":[]}
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- import React from "react";
4
- import { Text } from "react-native";
5
- import { useTabsContext } from "../context.js";
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- export function TabsTriggerText(props) {
8
- const {
9
- children,
10
- value: triggerValue,
11
- isDisabled,
12
- style,
13
- ...textProps
14
- } = props;
15
- const {
16
- value,
17
- styles
18
- } = useTabsContext();
19
- const isActive = value === triggerValue;
20
- const state = isDisabled ? "disabled" : isActive ? "active" : "default";
21
- const calculatedStyle = [styles?.triggerText?.default, styles?.triggerText?.[state], style];
22
- return /*#__PURE__*/_jsx(Text, {
23
- ...textProps,
24
- style: calculatedStyle,
25
- children: children
26
- });
27
- }
28
- //# sourceMappingURL=tabs-trigger-text.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","Text","useTabsContext","jsx","_jsx","TabsTriggerText","props","children","value","triggerValue","isDisabled","style","textProps","styles","isActive","state","calculatedStyle","triggerText","default"],"sourceRoot":"../../../../../src","sources":["components/tabs/components/tabs-trigger-text.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAwD,cAAc;AACnF,SAASC,cAAc,QAAQ,eAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAS5C,OAAO,SAASC,eAAeA,CAACC,KAA2B,EAAE;EAC3D,MAAM;IAAEC,QAAQ;IAAEC,KAAK,EAAEC,YAAY;IAAEC,UAAU;IAAEC,KAAK;IAAE,GAAGC;EAAU,CAAC,GAAGN,KAAK;EAChF,MAAM;IAAEE,KAAK;IAAEK;EAAO,CAAC,GAAGX,cAAc,CAAC,CAAC;EAE1C,MAAMY,QAAQ,GAAGN,KAAK,KAAKC,YAAY;EACvC,MAAMM,KAAK,GAAGL,UAAU,GAAG,UAAU,GAAGI,QAAQ,GAAG,QAAQ,GAAG,SAAS;EAEvE,MAAME,eAAe,GAAG,CAACH,MAAM,EAAEI,WAAW,EAAEC,OAAO,EAAEL,MAAM,EAAEI,WAAW,GAAGF,KAAK,CAAC,EAAEJ,KAAK,CAAC;EAE3F,oBACEP,IAAA,CAACH,IAAI;IAAA,GAAKW,SAAS;IAAED,KAAK,EAAEK,eAAgB;IAAAT,QAAA,EACzCA;EAAQ,CACL,CAAC;AAEX","ignoreList":[]}
@@ -1,45 +0,0 @@
1
- "use strict";
2
-
3
- import React from "react";
4
- import { Pressable } from "react-native";
5
- import { useTabsContext } from "../context.js";
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- const calculateState = (isActive, isDisabled) => {
8
- if (isDisabled) {
9
- return "disabled";
10
- }
11
- if (isActive) {
12
- return "active";
13
- }
14
- return "default";
15
- };
16
- export function TabsTrigger(props) {
17
- const {
18
- children,
19
- value: triggerValue,
20
- isDisabled,
21
- style,
22
- ...pressableProps
23
- } = props;
24
- const {
25
- value,
26
- onChange,
27
- styles
28
- } = useTabsContext();
29
- const isActive = value === triggerValue;
30
- const state = calculateState(isActive, isDisabled);
31
- const handlePress = () => {
32
- if (!isDisabled) {
33
- onChange(triggerValue);
34
- }
35
- };
36
- const calculatedStyle = [styles?.trigger?.default, styles?.trigger?.[state], style];
37
- return /*#__PURE__*/_jsx(Pressable, {
38
- ...pressableProps,
39
- disabled: isDisabled,
40
- onPress: handlePress,
41
- style: calculatedStyle,
42
- children: children
43
- });
44
- }
45
- //# sourceMappingURL=tabs-trigger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","Pressable","useTabsContext","jsx","_jsx","calculateState","isActive","isDisabled","TabsTrigger","props","children","value","triggerValue","style","pressableProps","onChange","styles","state","handlePress","calculatedStyle","trigger","default","disabled","onPress"],"sourceRoot":"../../../../../src","sources":["components/tabs/components/tabs-trigger.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,QAA6D,cAAc;AAC7F,SAASC,cAAc,QAAQ,eAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAU5C,MAAMC,cAAc,GAAGA,CAACC,QAAiB,EAAEC,UAA+B,KAAgB;EACxF,IAAIA,UAAU,EAAE;IACd,OAAO,UAAU;EACnB;EACA,IAAID,QAAQ,EAAE;IACZ,OAAO,QAAQ;EACjB;EACA,OAAO,SAAS;AAClB,CAAC;AAED,OAAO,SAASE,WAAWA,CAACC,KAAuB,EAAE;EACnD,MAAM;IAAEC,QAAQ;IAAEC,KAAK,EAAEC,YAAY;IAAEL,UAAU;IAAEM,KAAK;IAAE,GAAGC;EAAe,CAAC,GAAGL,KAAK;EACrF,MAAM;IAAEE,KAAK;IAAEI,QAAQ;IAAEC;EAAO,CAAC,GAAGd,cAAc,CAAC,CAAC;EAEpD,MAAMI,QAAQ,GAAGK,KAAK,KAAKC,YAAY;EACvC,MAAMK,KAAK,GAAGZ,cAAc,CAACC,QAAQ,EAAEC,UAAU,CAAC;EAElD,MAAMW,WAAW,GAAGA,CAAA,KAAM;IACxB,IAAI,CAACX,UAAU,EAAE;MACfQ,QAAQ,CAACH,YAAY,CAAC;IACxB;EACF,CAAC;EAED,MAAMO,eAAe,GAAG,CAACH,MAAM,EAAEI,OAAO,EAAEC,OAAO,EAAEL,MAAM,EAAEI,OAAO,GAAGH,KAAK,CAAC,EAAEJ,KAAK,CAAC;EAEnF,oBACET,IAAA,CAACH,SAAS;IAAA,GAAKa,cAAc;IAAEQ,QAAQ,EAAEf,UAAW;IAACgB,OAAO,EAAEL,WAAY;IAACL,KAAK,EAAEM,eAAgB;IAAAT,QAAA,EAC/FA;EAAQ,CACA,CAAC;AAEhB","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- import React from "react";
2
- import { type StyleProp, type ViewProps, type ViewStyle } from "react-native";
3
- export interface TabsListProps extends ViewProps {
4
- children: React.ReactNode;
5
- style?: StyleProp<ViewStyle>;
6
- }
7
- export declare function TabsList(props: TabsListProps): React.JSX.Element;
8
- //# sourceMappingURL=tabs-list.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tabs-list.d.ts","sourceRoot":"","sources":["../../../../../../src/components/tabs/components/tabs-list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpF,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,qBAW5C"}
@@ -1,10 +0,0 @@
1
- import React from "react";
2
- import { type StyleProp, type TextProps, type TextStyle } from "react-native";
3
- export interface TabsTriggerTextProps extends TextProps {
4
- children: React.ReactNode;
5
- value: string;
6
- isDisabled?: boolean;
7
- style?: StyleProp<TextStyle>;
8
- }
9
- export declare function TabsTriggerText(props: TabsTriggerTextProps): React.JSX.Element;
10
- //# sourceMappingURL=tabs-trigger-text.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tabs-trigger-text.d.ts","sourceRoot":"","sources":["../../../../../../src/components/tabs/components/tabs-trigger-text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpF,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBAc1D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tabs-trigger.d.ts","sourceRoot":"","sources":["../../../../../../src/components/tabs/components/tabs-trigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAa,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9F,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACtD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAYD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,qBAoBlD"}