midestic-rn-library 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.1.1] - 2026-11-07
9
+
10
+ ### Added
11
+
12
+ - Composable React Native tabs with controlled/uncontrolled selection, accessibility state, and NativeWind styling
13
+ - Tabs usage documentation, Storybook example, and component/CLI tests
14
+
8
15
  ## [0.1.0] - 2026-09-28
9
16
 
10
17
  ### Added
package/README.md CHANGED
@@ -27,7 +27,7 @@ Some components require additional native packages, such as `react-native-svg`,
27
27
 
28
28
  ## Available components
29
29
 
30
- `app-image`, `app-switch`, `button`, `calendar`, `celebration-shower`, `checkbox`, `draggable-drawer`, `drawer`, `header-back`, `icons`, `input`, `modal`, `my-text`, `number-input`, `otp-input`, `otp-input-square`, `phone-input`, `safe-top-view`, `search-input`, `select-input`, `status-switch`, `textarea`, `themed-scrollview`, `themed-text`, `themed-title`, `themed-view`.
30
+ `app-image`, `app-switch`, `button`, `calendar`, `celebration-shower`, `checkbox`, `draggable-drawer`, `drawer`, `header-back`, `icons`, `input`, `modal`, `my-text`, `number-input`, `otp-input`, `otp-input-square`, `phone-input`, `safe-top-view`, `search-input`, `select-input`, `status-switch`, `tabs`, `textarea`, `themed-scrollview`, `themed-text`, `themed-title`, `themed-view`.
31
31
 
32
32
  The `icons` entry adds the current icon set as one source file.
33
33
 
@@ -0,0 +1,19 @@
1
+ import { type GestureResponderEvent, type PressableProps, type ViewProps } from "react-native";
2
+ export type TabsProps = ViewProps & {
3
+ value?: string;
4
+ defaultValue?: string;
5
+ onValueChange?: (value: string) => void;
6
+ };
7
+ export declare function Tabs({ value, defaultValue, onValueChange, children, className, ...props }: TabsProps): import("react").JSX.Element;
8
+ export type TabsListProps = ViewProps;
9
+ export declare function TabsList({ children, className, ...props }: TabsListProps): import("react").JSX.Element;
10
+ export type TabsTriggerProps = Omit<PressableProps, "onPress"> & {
11
+ value: string;
12
+ onPress?: (event: GestureResponderEvent) => void;
13
+ };
14
+ export declare function TabsTrigger({ value, children, className, disabled, accessibilityState, onPress, ...props }: TabsTriggerProps): import("react").JSX.Element;
15
+ export type TabsContentProps = ViewProps & {
16
+ value: string;
17
+ };
18
+ export declare function TabsContent({ value, children, className, ...props }: TabsContentProps): import("react").JSX.Element | null;
19
+ //# sourceMappingURL=tabs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/tabs.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAiBtB,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF,wBAAgB,IAAI,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,+BAkBpG;AAED,MAAM,MAAM,aAAa,GAAG,SAAS,CAAC;AAEtC,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,+BAYxE;AAED,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,GAAG;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;CAClD,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,SAAS,EACT,QAAgB,EAChB,kBAAkB,EAClB,OAAO,EACP,GAAG,KAAK,EACT,EAAE,gBAAgB,+BA4BlB;AAED,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG;IACzC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,sCAWrF"}
@@ -26,5 +26,6 @@ export { ThemedScrollView, type ThemedScrollViewProps } from "./components/ui/th
26
26
  export { ThemedText, type ThemedTextProps } from "./components/ui/themed-text";
27
27
  export { ThemedTitle, type ThemedTitleProps } from "./components/ui/themed-title";
28
28
  export { ThemedView, type ThemedViewProps } from "./components/ui/themed-view";
29
+ export { Tabs, TabsList, TabsTrigger, TabsContent, type TabsProps, type TabsListProps, type TabsTriggerProps, type TabsContentProps, } from "./components/ui/tabs";
29
30
  export * from "./icons";
30
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,KAAK,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ACrB,KAAK,gBAAgB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,cAAc,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "midestic-rn-library",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "CLI for adding individual, editable NativeWind React Native components to your app.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -0,0 +1,126 @@
1
+ import { cn } from "../../lib/utils";
2
+ import { createContext, useContext, useState } from "react";
3
+ import {
4
+ Pressable,
5
+ View,
6
+ type GestureResponderEvent,
7
+ type PressableProps,
8
+ type ViewProps,
9
+ } from "react-native";
10
+
11
+ type TabsContextValue = {
12
+ value: string | undefined;
13
+ setValue: (value: string) => void;
14
+ };
15
+
16
+ const TabsContext = createContext<TabsContextValue | null>(null);
17
+
18
+ function useTabsContext(componentName: string) {
19
+ const context = useContext(TabsContext);
20
+ if (!context) {
21
+ throw new Error(`${componentName} must be used within a Tabs component.`);
22
+ }
23
+ return context;
24
+ }
25
+
26
+ export type TabsProps = ViewProps & {
27
+ value?: string;
28
+ defaultValue?: string;
29
+ onValueChange?: (value: string) => void;
30
+ };
31
+
32
+ export function Tabs({ value, defaultValue, onValueChange, children, className, ...props }: TabsProps) {
33
+ const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
34
+ const selectedValue = value === undefined ? uncontrolledValue : value;
35
+
36
+ const setValue = (nextValue: string) => {
37
+ if (value === undefined) {
38
+ setUncontrolledValue(nextValue);
39
+ }
40
+ onValueChange?.(nextValue);
41
+ };
42
+
43
+ return (
44
+ <TabsContext.Provider value={{ value: selectedValue, setValue }}>
45
+ <View className={cn("flex-col", className)} {...props}>
46
+ {children}
47
+ </View>
48
+ </TabsContext.Provider>
49
+ );
50
+ }
51
+
52
+ export type TabsListProps = ViewProps;
53
+
54
+ export function TabsList({ children, className, ...props }: TabsListProps) {
55
+ useTabsContext("TabsList");
56
+
57
+ return (
58
+ <View
59
+ accessibilityRole="tablist"
60
+ className={cn("flex-row items-center rounded-md bg-gray-100 p-1 dark:bg-gray-800", className)}
61
+ {...props}
62
+ >
63
+ {children}
64
+ </View>
65
+ );
66
+ }
67
+
68
+ export type TabsTriggerProps = Omit<PressableProps, "onPress"> & {
69
+ value: string;
70
+ onPress?: (event: GestureResponderEvent) => void;
71
+ };
72
+
73
+ export function TabsTrigger({
74
+ value,
75
+ children,
76
+ className,
77
+ disabled = false,
78
+ accessibilityState,
79
+ onPress,
80
+ ...props
81
+ }: TabsTriggerProps) {
82
+ const tabs = useTabsContext("TabsTrigger");
83
+ const selected = tabs.value === value;
84
+
85
+ return (
86
+ <Pressable
87
+ accessibilityRole="tab"
88
+ accessibilityState={{
89
+ ...accessibilityState,
90
+ selected,
91
+ disabled: disabled || accessibilityState?.disabled,
92
+ }}
93
+ className={cn(
94
+ "flex-1 items-center justify-center rounded-sm px-3 py-2",
95
+ selected && "bg-white dark:bg-gray-700",
96
+ disabled && "opacity-50",
97
+ className,
98
+ )}
99
+ disabled={disabled}
100
+ onPress={(event) => {
101
+ tabs.setValue(value);
102
+ onPress?.(event);
103
+ }}
104
+ {...props}
105
+ >
106
+ {children}
107
+ </Pressable>
108
+ );
109
+ }
110
+
111
+ export type TabsContentProps = ViewProps & {
112
+ value: string;
113
+ };
114
+
115
+ export function TabsContent({ value, children, className, ...props }: TabsContentProps) {
116
+ const tabs = useTabsContext("TabsContent");
117
+ if (tabs.value !== value) {
118
+ return null;
119
+ }
120
+
121
+ return (
122
+ <View className={cn("mt-2", className)} {...props}>
123
+ {children}
124
+ </View>
125
+ );
126
+ }
package/src/index.ts CHANGED
@@ -33,5 +33,15 @@ export { ThemedScrollView, type ThemedScrollViewProps } from "./components/ui/th
33
33
  export { ThemedText, type ThemedTextProps } from "./components/ui/themed-text";
34
34
  export { ThemedTitle, type ThemedTitleProps } from "./components/ui/themed-title";
35
35
  export { ThemedView, type ThemedViewProps } from "./components/ui/themed-view";
36
+ export {
37
+ Tabs,
38
+ TabsList,
39
+ TabsTrigger,
40
+ TabsContent,
41
+ type TabsProps,
42
+ type TabsListProps,
43
+ type TabsTriggerProps,
44
+ type TabsContentProps,
45
+ } from "./components/ui/tabs";
36
46
 
37
47
  export * from "./icons";