@urbint/cl 1.0.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/.cursor/rules +313 -0
- package/.rnstorybook/index.ts +11 -0
- package/.rnstorybook/main.ts +8 -0
- package/.rnstorybook/preview.tsx +14 -0
- package/.rnstorybook/storybook.requires.ts +49 -0
- package/.storybook/main.ts +16 -0
- package/.storybook/preview.ts +32 -0
- package/.storybook/vitest.setup.ts +7 -0
- package/App.tsx +422 -0
- package/README.md +229 -0
- package/app.json +33 -0
- package/assets/adaptive-icon.png +0 -0
- package/assets/favicon.png +0 -0
- package/assets/icon.png +0 -0
- package/assets/splash-icon.png +0 -0
- package/babel.config.js +16 -0
- package/docs/components/CodeBlock.tsx +80 -0
- package/docs/components/PropTable.tsx +93 -0
- package/docs/components/Sidebar.tsx +199 -0
- package/docs/components/index.ts +8 -0
- package/docs/data/colorTokens.ts +70 -0
- package/docs/data/componentData.tsx +1685 -0
- package/docs/data/index.ts +7 -0
- package/docs/index.ts +19 -0
- package/docs/navigation.ts +94 -0
- package/docs/pages/ColorsPage.tsx +226 -0
- package/docs/pages/ComponentPage.tsx +235 -0
- package/docs/pages/InstallationPage.tsx +232 -0
- package/docs/pages/IntroductionPage.tsx +163 -0
- package/docs/pages/ThemingPage.tsx +251 -0
- package/docs/pages/index.ts +10 -0
- package/docs/theme.ts +64 -0
- package/docs/types.ts +54 -0
- package/index.ts +8 -0
- package/llms.txt +1893 -0
- package/mcp-config.example.json +10 -0
- package/mcp-server/README.md +192 -0
- package/mcp-server/package-lock.json +1707 -0
- package/mcp-server/package.json +38 -0
- package/mcp-server/src/index.ts +1136 -0
- package/mcp-server/src/registry/components.ts +1446 -0
- package/mcp-server/src/registry/index.ts +3 -0
- package/mcp-server/src/registry/tokens.ts +256 -0
- package/mcp-server/tsconfig.json +19 -0
- package/package.json +92 -0
- package/src/components/Accordion/Accordion.stories.tsx +226 -0
- package/src/components/Accordion/Accordion.tsx +255 -0
- package/src/components/Accordion/index.ts +12 -0
- package/src/components/ActionSheet/ActionSheet.stories.tsx +393 -0
- package/src/components/ActionSheet/ActionSheet.tsx +258 -0
- package/src/components/ActionSheet/index.ts +2 -0
- package/src/components/Alert/Alert.stories.tsx +165 -0
- package/src/components/Alert/Alert.tsx +164 -0
- package/src/components/Alert/index.ts +2 -0
- package/src/components/AlertDialog/AlertDialog.stories.tsx +330 -0
- package/src/components/AlertDialog/AlertDialog.tsx +234 -0
- package/src/components/AlertDialog/index.ts +2 -0
- package/src/components/Avatar/Avatar.stories.tsx +154 -0
- package/src/components/Avatar/Avatar.tsx +219 -0
- package/src/components/Avatar/index.ts +2 -0
- package/src/components/Badge/Badge.stories.tsx +146 -0
- package/src/components/Badge/Badge.tsx +125 -0
- package/src/components/Badge/index.ts +2 -0
- package/src/components/Box/Box.stories.tsx +192 -0
- package/src/components/Box/Box.tsx +184 -0
- package/src/components/Box/index.ts +2 -0
- package/src/components/Button/Button.stories.tsx +157 -0
- package/src/components/Button/Button.tsx +180 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Card/Card.stories.tsx +145 -0
- package/src/components/Card/Card.tsx +169 -0
- package/src/components/Card/index.ts +11 -0
- package/src/components/Center/Center.stories.tsx +215 -0
- package/src/components/Center/Center.tsx +29 -0
- package/src/components/Center/index.ts +2 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +94 -0
- package/src/components/Checkbox/Checkbox.tsx +242 -0
- package/src/components/Checkbox/index.ts +2 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +623 -0
- package/src/components/DatePicker/DatePicker.tsx +1228 -0
- package/src/components/DatePicker/index.ts +8 -0
- package/src/components/Divider/Divider.stories.tsx +224 -0
- package/src/components/Divider/Divider.tsx +73 -0
- package/src/components/Divider/index.ts +2 -0
- package/src/components/Drawer/Drawer.stories.tsx +414 -0
- package/src/components/Drawer/Drawer.tsx +342 -0
- package/src/components/Drawer/index.ts +11 -0
- package/src/components/Fab/Fab.stories.tsx +360 -0
- package/src/components/Fab/Fab.tsx +185 -0
- package/src/components/Fab/index.ts +2 -0
- package/src/components/FormControl/FormControl.stories.tsx +276 -0
- package/src/components/FormControl/FormControl.tsx +185 -0
- package/src/components/FormControl/index.ts +12 -0
- package/src/components/Grid/Grid.stories.tsx +244 -0
- package/src/components/Grid/Grid.tsx +93 -0
- package/src/components/Grid/index.ts +2 -0
- package/src/components/HStack/HStack.stories.tsx +230 -0
- package/src/components/HStack/HStack.tsx +80 -0
- package/src/components/HStack/index.ts +2 -0
- package/src/components/Heading/Heading.stories.tsx +111 -0
- package/src/components/Heading/Heading.tsx +85 -0
- package/src/components/Heading/index.ts +2 -0
- package/src/components/Icon/Icon.stories.tsx +320 -0
- package/src/components/Icon/Icon.tsx +117 -0
- package/src/components/Icon/index.ts +2 -0
- package/src/components/Image/Image.stories.tsx +357 -0
- package/src/components/Image/Image.tsx +168 -0
- package/src/components/Image/index.ts +2 -0
- package/src/components/Input/Input.stories.tsx +164 -0
- package/src/components/Input/Input.tsx +274 -0
- package/src/components/Input/index.ts +2 -0
- package/src/components/Link/Link.stories.tsx +187 -0
- package/src/components/Link/Link.tsx +104 -0
- package/src/components/Link/index.ts +2 -0
- package/src/components/Menu/Menu.stories.tsx +363 -0
- package/src/components/Menu/Menu.tsx +238 -0
- package/src/components/Menu/index.ts +2 -0
- package/src/components/Modal/Modal.stories.tsx +156 -0
- package/src/components/Modal/Modal.tsx +280 -0
- package/src/components/Modal/index.ts +11 -0
- package/src/components/Popover/Popover.stories.tsx +330 -0
- package/src/components/Popover/Popover.tsx +315 -0
- package/src/components/Popover/index.ts +11 -0
- package/src/components/Portal/Portal.stories.tsx +376 -0
- package/src/components/Portal/Portal.tsx +100 -0
- package/src/components/Portal/index.ts +2 -0
- package/src/components/Pressable/Pressable.stories.tsx +338 -0
- package/src/components/Pressable/Pressable.tsx +71 -0
- package/src/components/Pressable/index.ts +2 -0
- package/src/components/Progress/Progress.stories.tsx +131 -0
- package/src/components/Progress/Progress.tsx +219 -0
- package/src/components/Progress/index.ts +2 -0
- package/src/components/Radio/Radio.stories.tsx +101 -0
- package/src/components/Radio/Radio.tsx +234 -0
- package/src/components/Radio/index.ts +2 -0
- package/src/components/Select/Select.stories.tsx +908 -0
- package/src/components/Select/Select.tsx +659 -0
- package/src/components/Select/index.ts +8 -0
- package/src/components/Skeleton/Skeleton.stories.tsx +154 -0
- package/src/components/Skeleton/Skeleton.tsx +192 -0
- package/src/components/Skeleton/index.ts +8 -0
- package/src/components/Slider/Slider.stories.tsx +363 -0
- package/src/components/Slider/Slider.tsx +209 -0
- package/src/components/Slider/index.ts +2 -0
- package/src/components/Spinner/Spinner.stories.tsx +108 -0
- package/src/components/Spinner/Spinner.tsx +121 -0
- package/src/components/Spinner/index.ts +2 -0
- package/src/components/Switch/Switch.stories.tsx +116 -0
- package/src/components/Switch/Switch.tsx +172 -0
- package/src/components/Switch/index.ts +2 -0
- package/src/components/Table/Table.stories.tsx +417 -0
- package/src/components/Table/Table.tsx +233 -0
- package/src/components/Table/index.ts +2 -0
- package/src/components/Text/Text.stories.tsx +93 -0
- package/src/components/Text/Text.tsx +119 -0
- package/src/components/Text/index.ts +2 -0
- package/src/components/Textarea/Textarea.stories.tsx +280 -0
- package/src/components/Textarea/Textarea.tsx +212 -0
- package/src/components/Textarea/index.ts +2 -0
- package/src/components/Toast/Toast.stories.tsx +446 -0
- package/src/components/Toast/Toast.tsx +221 -0
- package/src/components/Toast/index.ts +2 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +354 -0
- package/src/components/Tooltip/Tooltip.tsx +261 -0
- package/src/components/Tooltip/index.ts +2 -0
- package/src/components/VStack/VStack.stories.tsx +183 -0
- package/src/components/VStack/VStack.tsx +76 -0
- package/src/components/VStack/index.ts +2 -0
- package/src/components/index.ts +62 -0
- package/src/hooks/index.ts +7 -0
- package/src/hooks/useControllableState.ts +41 -0
- package/src/hooks/useDisclosure.ts +51 -0
- package/src/index.ts +22 -0
- package/src/stories/Button.stories.tsx +53 -0
- package/src/stories/Button.tsx +101 -0
- package/src/stories/Configure.mdx +364 -0
- package/src/stories/Header.stories.tsx +33 -0
- package/src/stories/Header.tsx +75 -0
- package/src/stories/Page.stories.tsx +25 -0
- package/src/stories/Page.tsx +154 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/styles/index.ts +7 -0
- package/src/styles/tokens.ts +318 -0
- package/src/styles/unistyles.ts +254 -0
- package/src/utils/createContext.tsx +25 -0
- package/src/utils/index.ts +7 -0
- package/src/utils/mergeRefs.ts +21 -0
- package/tsconfig.json +26 -0
- package/urbint-cl-1.0.0.tgz +0 -0
- package/vitest.config.ts +37 -0
- package/vitest.shims.d.ts +1 -0
package/App.tsx
ADDED
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Urbint Component Library - Documentation Website
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import React, { useState } from 'react';
|
|
6
|
+
import {
|
|
7
|
+
View,
|
|
8
|
+
Text,
|
|
9
|
+
StyleSheet,
|
|
10
|
+
SafeAreaView,
|
|
11
|
+
ScrollView,
|
|
12
|
+
Pressable,
|
|
13
|
+
} from 'react-native';
|
|
14
|
+
|
|
15
|
+
import {
|
|
16
|
+
Sidebar,
|
|
17
|
+
IntroductionPage,
|
|
18
|
+
InstallationPage,
|
|
19
|
+
ColorsPage,
|
|
20
|
+
ThemingPage,
|
|
21
|
+
ComponentPage,
|
|
22
|
+
colors,
|
|
23
|
+
spacing,
|
|
24
|
+
} from './docs';
|
|
25
|
+
|
|
26
|
+
export default function App() {
|
|
27
|
+
const [activePage, setActivePage] = useState('introduction');
|
|
28
|
+
const [expandedSections, setExpandedSections] = useState(['getting-started', 'components']);
|
|
29
|
+
|
|
30
|
+
const handleNavigate = (pageId: string) => {
|
|
31
|
+
setActivePage(pageId);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const handleToggleSection = (sectionId: string) => {
|
|
35
|
+
setExpandedSections(prev =>
|
|
36
|
+
prev.includes(sectionId)
|
|
37
|
+
? prev.filter(id => id !== sectionId)
|
|
38
|
+
: [...prev, sectionId]
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const renderContent = () => {
|
|
43
|
+
switch (activePage) {
|
|
44
|
+
// Getting Started
|
|
45
|
+
case 'introduction':
|
|
46
|
+
return <IntroductionPage />;
|
|
47
|
+
case 'installation':
|
|
48
|
+
return <InstallationPage />;
|
|
49
|
+
case 'quick-start':
|
|
50
|
+
return <QuickStartPage />;
|
|
51
|
+
|
|
52
|
+
// Design System
|
|
53
|
+
case 'colors':
|
|
54
|
+
return <ColorsPage />;
|
|
55
|
+
case 'typography':
|
|
56
|
+
return <TypographyPage />;
|
|
57
|
+
case 'spacing':
|
|
58
|
+
return <SpacingPage />;
|
|
59
|
+
case 'elevation':
|
|
60
|
+
return <ElevationPage />;
|
|
61
|
+
|
|
62
|
+
// Customization
|
|
63
|
+
case 'theming':
|
|
64
|
+
return <ThemingPage />;
|
|
65
|
+
case 'dark-mode':
|
|
66
|
+
return <DarkModePage />;
|
|
67
|
+
case 'custom-tokens':
|
|
68
|
+
return <CustomTokensPage />;
|
|
69
|
+
|
|
70
|
+
// Individual Components (new flat navigation)
|
|
71
|
+
default:
|
|
72
|
+
if (activePage.startsWith('component-')) {
|
|
73
|
+
const componentName = activePage.replace('component-', '');
|
|
74
|
+
return <ComponentPage componentId={componentName} />;
|
|
75
|
+
}
|
|
76
|
+
return <IntroductionPage />;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<SafeAreaView style={styles.container}>
|
|
82
|
+
<View style={styles.layout}>
|
|
83
|
+
{/* Sidebar */}
|
|
84
|
+
<Sidebar
|
|
85
|
+
activePage={activePage}
|
|
86
|
+
onNavigate={handleNavigate}
|
|
87
|
+
expandedSections={expandedSections}
|
|
88
|
+
onToggleSection={handleToggleSection}
|
|
89
|
+
/>
|
|
90
|
+
|
|
91
|
+
{/* Main Content */}
|
|
92
|
+
<ScrollView
|
|
93
|
+
style={styles.main}
|
|
94
|
+
contentContainerStyle={styles.mainContent}
|
|
95
|
+
showsVerticalScrollIndicator={false}
|
|
96
|
+
>
|
|
97
|
+
{renderContent()}
|
|
98
|
+
</ScrollView>
|
|
99
|
+
</View>
|
|
100
|
+
</SafeAreaView>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Placeholder pages
|
|
105
|
+
const QuickStartPage = () => (
|
|
106
|
+
<View style={styles.page}>
|
|
107
|
+
<Text style={styles.pageTitle}>Quick Start</Text>
|
|
108
|
+
<Text style={styles.pageSubtitle}>Get up and running in 5 minutes</Text>
|
|
109
|
+
|
|
110
|
+
<View style={styles.section}>
|
|
111
|
+
<Text style={styles.sectionTitle}>1. Create a new Expo project</Text>
|
|
112
|
+
<View style={styles.codeBlock}>
|
|
113
|
+
<Text style={styles.code}>npx create-expo-app my-app{'\n'}cd my-app</Text>
|
|
114
|
+
</View>
|
|
115
|
+
</View>
|
|
116
|
+
|
|
117
|
+
<View style={styles.section}>
|
|
118
|
+
<Text style={styles.sectionTitle}>2. Install dependencies</Text>
|
|
119
|
+
<View style={styles.codeBlock}>
|
|
120
|
+
<Text style={styles.code}>npm install @urbint/component-library react-native-unistyles</Text>
|
|
121
|
+
</View>
|
|
122
|
+
</View>
|
|
123
|
+
|
|
124
|
+
<View style={styles.section}>
|
|
125
|
+
<Text style={styles.sectionTitle}>3. Import and use components</Text>
|
|
126
|
+
<View style={styles.codeBlock}>
|
|
127
|
+
<Text style={styles.code}>{`import { Button, Text } from '@urbint/component-library';
|
|
128
|
+
|
|
129
|
+
<Button variant="primary">Get Started</Button>`}</Text>
|
|
130
|
+
</View>
|
|
131
|
+
</View>
|
|
132
|
+
</View>
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
const TypographyPage = () => (
|
|
136
|
+
<View style={styles.page}>
|
|
137
|
+
<Text style={styles.pageTitle}>Typography</Text>
|
|
138
|
+
<Text style={styles.pageSubtitle}>Typography scale and font styles for consistent text rendering</Text>
|
|
139
|
+
|
|
140
|
+
<View style={styles.section}>
|
|
141
|
+
<Text style={styles.sectionTitle}>Type Scale</Text>
|
|
142
|
+
<View style={styles.typeList}>
|
|
143
|
+
<View style={styles.typeItem}>
|
|
144
|
+
<Text style={{ fontSize: 32, fontWeight: '700' }}>H1 Heading</Text>
|
|
145
|
+
<Text style={styles.typeLabel}>32px / Bold</Text>
|
|
146
|
+
</View>
|
|
147
|
+
<View style={styles.typeItem}>
|
|
148
|
+
<Text style={{ fontSize: 24, fontWeight: '600' }}>H2 Heading</Text>
|
|
149
|
+
<Text style={styles.typeLabel}>24px / SemiBold</Text>
|
|
150
|
+
</View>
|
|
151
|
+
<View style={styles.typeItem}>
|
|
152
|
+
<Text style={{ fontSize: 20, fontWeight: '600' }}>H3 Heading</Text>
|
|
153
|
+
<Text style={styles.typeLabel}>20px / SemiBold</Text>
|
|
154
|
+
</View>
|
|
155
|
+
<View style={styles.typeItem}>
|
|
156
|
+
<Text style={{ fontSize: 18, fontWeight: '600' }}>H4 Heading</Text>
|
|
157
|
+
<Text style={styles.typeLabel}>18px / SemiBold</Text>
|
|
158
|
+
</View>
|
|
159
|
+
<View style={styles.typeItem}>
|
|
160
|
+
<Text style={{ fontSize: 16 }}>Body Text</Text>
|
|
161
|
+
<Text style={styles.typeLabel}>16px / Regular</Text>
|
|
162
|
+
</View>
|
|
163
|
+
<View style={styles.typeItem}>
|
|
164
|
+
<Text style={{ fontSize: 14 }}>Label Text</Text>
|
|
165
|
+
<Text style={styles.typeLabel}>14px / Regular</Text>
|
|
166
|
+
</View>
|
|
167
|
+
<View style={styles.typeItem}>
|
|
168
|
+
<Text style={{ fontSize: 13, color: '#6B7280' }}>Caption Text</Text>
|
|
169
|
+
<Text style={styles.typeLabel}>13px / Regular</Text>
|
|
170
|
+
</View>
|
|
171
|
+
<View style={styles.typeItem}>
|
|
172
|
+
<Text style={{ fontSize: 12, color: '#9CA3AF' }}>Small Text</Text>
|
|
173
|
+
<Text style={styles.typeLabel}>12px / Regular</Text>
|
|
174
|
+
</View>
|
|
175
|
+
</View>
|
|
176
|
+
</View>
|
|
177
|
+
</View>
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
const SpacingPage = () => (
|
|
181
|
+
<View style={styles.page}>
|
|
182
|
+
<Text style={styles.pageTitle}>Spacing</Text>
|
|
183
|
+
<Text style={styles.pageSubtitle}>Consistent spacing scale for margins, padding, and gaps</Text>
|
|
184
|
+
|
|
185
|
+
<View style={styles.section}>
|
|
186
|
+
<Text style={styles.sectionTitle}>Spacing Scale</Text>
|
|
187
|
+
<View style={styles.spacingList}>
|
|
188
|
+
{[
|
|
189
|
+
{ name: 'xs', value: 4 },
|
|
190
|
+
{ name: 'sm', value: 8 },
|
|
191
|
+
{ name: 'md', value: 12 },
|
|
192
|
+
{ name: 'lg', value: 16 },
|
|
193
|
+
{ name: 'xl', value: 24 },
|
|
194
|
+
{ name: '2xl', value: 32 },
|
|
195
|
+
{ name: '3xl', value: 48 },
|
|
196
|
+
{ name: '4xl', value: 64 },
|
|
197
|
+
].map(item => (
|
|
198
|
+
<View key={item.name} style={styles.spacingItem}>
|
|
199
|
+
<View style={[styles.spacingBox, { width: item.value, height: item.value }]} />
|
|
200
|
+
<Text style={styles.spacingName}>{item.name}</Text>
|
|
201
|
+
<Text style={styles.spacingValue}>{item.value}px</Text>
|
|
202
|
+
</View>
|
|
203
|
+
))}
|
|
204
|
+
</View>
|
|
205
|
+
</View>
|
|
206
|
+
</View>
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
const ElevationPage = () => (
|
|
210
|
+
<View style={styles.page}>
|
|
211
|
+
<Text style={styles.pageTitle}>Elevation</Text>
|
|
212
|
+
<Text style={styles.pageSubtitle}>Shadow levels for creating visual hierarchy</Text>
|
|
213
|
+
|
|
214
|
+
<View style={styles.section}>
|
|
215
|
+
<Text style={styles.sectionTitle}>Elevation Scale</Text>
|
|
216
|
+
<View style={styles.elevationList}>
|
|
217
|
+
{[5, 10, 20, 30, 40].map(level => (
|
|
218
|
+
<View
|
|
219
|
+
key={level}
|
|
220
|
+
style={[
|
|
221
|
+
styles.elevationBox,
|
|
222
|
+
{
|
|
223
|
+
shadowColor: '#000',
|
|
224
|
+
shadowOffset: { width: 0, height: level / 10 },
|
|
225
|
+
shadowOpacity: 0.1 + (level / 100),
|
|
226
|
+
shadowRadius: level / 5,
|
|
227
|
+
elevation: level / 5,
|
|
228
|
+
}
|
|
229
|
+
]}
|
|
230
|
+
>
|
|
231
|
+
<Text style={styles.elevationLabel}>Elevation {level}</Text>
|
|
232
|
+
</View>
|
|
233
|
+
))}
|
|
234
|
+
</View>
|
|
235
|
+
</View>
|
|
236
|
+
</View>
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
const DarkModePage = () => (
|
|
240
|
+
<View style={styles.page}>
|
|
241
|
+
<Text style={styles.pageTitle}>Dark Mode</Text>
|
|
242
|
+
<Text style={styles.pageSubtitle}>Implementing dark mode in your application</Text>
|
|
243
|
+
|
|
244
|
+
<View style={styles.section}>
|
|
245
|
+
<Text style={styles.sectionTitle}>Automatic Theme Detection</Text>
|
|
246
|
+
<Text style={styles.paragraph}>
|
|
247
|
+
Urbint CL supports automatic theme switching based on system preferences.
|
|
248
|
+
Enable adaptive themes in your Unistyles configuration:
|
|
249
|
+
</Text>
|
|
250
|
+
<View style={styles.codeBlock}>
|
|
251
|
+
<Text style={styles.code}>{`StyleSheet.configure({
|
|
252
|
+
themes: { light: lightTheme, dark: darkTheme },
|
|
253
|
+
settings: {
|
|
254
|
+
adaptiveThemes: true, // Auto-switch based on OS
|
|
255
|
+
},
|
|
256
|
+
});`}</Text>
|
|
257
|
+
</View>
|
|
258
|
+
</View>
|
|
259
|
+
|
|
260
|
+
<View style={styles.section}>
|
|
261
|
+
<Text style={styles.sectionTitle}>Manual Theme Toggle</Text>
|
|
262
|
+
<View style={styles.codeBlock}>
|
|
263
|
+
<Text style={styles.code}>{`import { UnistylesRuntime } from 'react-native-unistyles';
|
|
264
|
+
|
|
265
|
+
const toggleTheme = () => {
|
|
266
|
+
const current = UnistylesRuntime.themeName;
|
|
267
|
+
UnistylesRuntime.setTheme(current === 'light' ? 'dark' : 'light');
|
|
268
|
+
};`}</Text>
|
|
269
|
+
</View>
|
|
270
|
+
</View>
|
|
271
|
+
</View>
|
|
272
|
+
);
|
|
273
|
+
|
|
274
|
+
const CustomTokensPage = () => (
|
|
275
|
+
<View style={styles.page}>
|
|
276
|
+
<Text style={styles.pageTitle}>Custom Tokens</Text>
|
|
277
|
+
<Text style={styles.pageSubtitle}>Extending and customizing design tokens</Text>
|
|
278
|
+
|
|
279
|
+
<View style={styles.section}>
|
|
280
|
+
<Text style={styles.sectionTitle}>Adding Custom Colors</Text>
|
|
281
|
+
<View style={styles.codeBlock}>
|
|
282
|
+
<Text style={styles.code}>{`const customTheme = {
|
|
283
|
+
...baseTheme,
|
|
284
|
+
colors: {
|
|
285
|
+
...baseTheme.colors,
|
|
286
|
+
custom: {
|
|
287
|
+
brandPink: '#EC4899',
|
|
288
|
+
brandTeal: '#14B8A6',
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
};`}</Text>
|
|
292
|
+
</View>
|
|
293
|
+
</View>
|
|
294
|
+
|
|
295
|
+
<View style={styles.section}>
|
|
296
|
+
<Text style={styles.sectionTitle}>Custom Spacing</Text>
|
|
297
|
+
<View style={styles.codeBlock}>
|
|
298
|
+
<Text style={styles.code}>{`const customSpacing = {
|
|
299
|
+
...baseTheme.spacing,
|
|
300
|
+
'5xl': 80,
|
|
301
|
+
'6xl': 96,
|
|
302
|
+
};`}</Text>
|
|
303
|
+
</View>
|
|
304
|
+
</View>
|
|
305
|
+
</View>
|
|
306
|
+
);
|
|
307
|
+
|
|
308
|
+
const styles = StyleSheet.create({
|
|
309
|
+
container: {
|
|
310
|
+
flex: 1,
|
|
311
|
+
backgroundColor: colors.bgPrimary,
|
|
312
|
+
},
|
|
313
|
+
layout: {
|
|
314
|
+
flex: 1,
|
|
315
|
+
flexDirection: 'row',
|
|
316
|
+
},
|
|
317
|
+
main: {
|
|
318
|
+
flex: 1,
|
|
319
|
+
backgroundColor: colors.bgPrimary,
|
|
320
|
+
},
|
|
321
|
+
mainContent: {
|
|
322
|
+
minHeight: '100%',
|
|
323
|
+
},
|
|
324
|
+
page: {
|
|
325
|
+
padding: spacing['2xl'],
|
|
326
|
+
maxWidth: 900,
|
|
327
|
+
},
|
|
328
|
+
pageTitle: {
|
|
329
|
+
fontSize: 36,
|
|
330
|
+
fontWeight: '700',
|
|
331
|
+
color: colors.textPrimary,
|
|
332
|
+
marginBottom: spacing.md,
|
|
333
|
+
},
|
|
334
|
+
pageSubtitle: {
|
|
335
|
+
fontSize: 18,
|
|
336
|
+
color: colors.textSecondary,
|
|
337
|
+
lineHeight: 28,
|
|
338
|
+
marginBottom: spacing['2xl'],
|
|
339
|
+
},
|
|
340
|
+
section: {
|
|
341
|
+
marginBottom: spacing['2xl'],
|
|
342
|
+
},
|
|
343
|
+
sectionTitle: {
|
|
344
|
+
fontSize: 20,
|
|
345
|
+
fontWeight: '600',
|
|
346
|
+
color: colors.textPrimary,
|
|
347
|
+
marginBottom: spacing.lg,
|
|
348
|
+
},
|
|
349
|
+
paragraph: {
|
|
350
|
+
fontSize: 16,
|
|
351
|
+
color: colors.textSecondary,
|
|
352
|
+
lineHeight: 26,
|
|
353
|
+
marginBottom: spacing.lg,
|
|
354
|
+
},
|
|
355
|
+
codeBlock: {
|
|
356
|
+
backgroundColor: colors.bgDark,
|
|
357
|
+
padding: spacing.lg,
|
|
358
|
+
borderRadius: 8,
|
|
359
|
+
},
|
|
360
|
+
code: {
|
|
361
|
+
fontFamily: 'monospace',
|
|
362
|
+
fontSize: 13,
|
|
363
|
+
color: '#E5E7EB',
|
|
364
|
+
lineHeight: 20,
|
|
365
|
+
},
|
|
366
|
+
typeList: {
|
|
367
|
+
gap: spacing.lg,
|
|
368
|
+
},
|
|
369
|
+
typeItem: {
|
|
370
|
+
flexDirection: 'row',
|
|
371
|
+
alignItems: 'baseline',
|
|
372
|
+
gap: spacing.lg,
|
|
373
|
+
paddingVertical: spacing.md,
|
|
374
|
+
borderBottomWidth: 1,
|
|
375
|
+
borderBottomColor: colors.borderLight,
|
|
376
|
+
},
|
|
377
|
+
typeLabel: {
|
|
378
|
+
fontSize: 13,
|
|
379
|
+
color: colors.textTertiary,
|
|
380
|
+
marginLeft: 'auto',
|
|
381
|
+
},
|
|
382
|
+
spacingList: {
|
|
383
|
+
flexDirection: 'row',
|
|
384
|
+
flexWrap: 'wrap',
|
|
385
|
+
gap: spacing['2xl'],
|
|
386
|
+
},
|
|
387
|
+
spacingItem: {
|
|
388
|
+
alignItems: 'center',
|
|
389
|
+
gap: spacing.sm,
|
|
390
|
+
},
|
|
391
|
+
spacingBox: {
|
|
392
|
+
backgroundColor: colors.accent,
|
|
393
|
+
borderRadius: 4,
|
|
394
|
+
},
|
|
395
|
+
spacingName: {
|
|
396
|
+
fontSize: 14,
|
|
397
|
+
fontWeight: '500',
|
|
398
|
+
color: colors.textPrimary,
|
|
399
|
+
},
|
|
400
|
+
spacingValue: {
|
|
401
|
+
fontSize: 12,
|
|
402
|
+
color: colors.textTertiary,
|
|
403
|
+
},
|
|
404
|
+
elevationList: {
|
|
405
|
+
flexDirection: 'row',
|
|
406
|
+
flexWrap: 'wrap',
|
|
407
|
+
gap: spacing['2xl'],
|
|
408
|
+
},
|
|
409
|
+
elevationBox: {
|
|
410
|
+
width: 120,
|
|
411
|
+
height: 80,
|
|
412
|
+
backgroundColor: colors.bgSecondary,
|
|
413
|
+
borderRadius: 8,
|
|
414
|
+
alignItems: 'center',
|
|
415
|
+
justifyContent: 'center',
|
|
416
|
+
},
|
|
417
|
+
elevationLabel: {
|
|
418
|
+
fontSize: 13,
|
|
419
|
+
fontWeight: '500',
|
|
420
|
+
color: colors.textSecondary,
|
|
421
|
+
},
|
|
422
|
+
});
|
package/README.md
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# Urbint Component Library
|
|
2
|
+
|
|
3
|
+
An enterprise-ready React Native component library built with [Unistyles 3.0](https://unistyl.es) for consistent styling across all platforms.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🎨 **40+ Production-Ready Components** - Comprehensive set of UI components
|
|
8
|
+
- 🎭 **Light & Dark Theme Support** - Automatic theme switching with system preferences
|
|
9
|
+
- 📱 **Cross-Platform** - Works on iOS, Android, and Web
|
|
10
|
+
- 🔧 **TypeScript First** - Full TypeScript support with excellent DX
|
|
11
|
+
- 📖 **Storybook Integration** - Visual component documentation
|
|
12
|
+
- 🎯 **Enterprise Design System** - Based on Urbint design tokens
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @urbint/cl react-native-unistyles
|
|
18
|
+
# or
|
|
19
|
+
yarn add @urbint/cl react-native-unistyles
|
|
20
|
+
|
|
21
|
+
# For local development, you can link:
|
|
22
|
+
npm link ../path-to-urbint-cl
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import React from 'react';
|
|
29
|
+
// Import styles first (required for Unistyles)
|
|
30
|
+
import '@urbint/cl/styles';
|
|
31
|
+
|
|
32
|
+
import { Button, Card, Text, VStack, ToastProvider, useToast } from '@urbint/cl';
|
|
33
|
+
|
|
34
|
+
function App() {
|
|
35
|
+
const toast = useToast();
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<ToastProvider>
|
|
39
|
+
<VStack space="lg" p="lg">
|
|
40
|
+
<Card>
|
|
41
|
+
<Text>Welcome to Urbint Component Library!</Text>
|
|
42
|
+
</Card>
|
|
43
|
+
<Button onPress={() => toast.show({ title: 'Hello!', status: 'success' })}>
|
|
44
|
+
Show Toast
|
|
45
|
+
</Button>
|
|
46
|
+
</VStack>
|
|
47
|
+
</ToastProvider>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Components
|
|
53
|
+
|
|
54
|
+
### Layout
|
|
55
|
+
- `Box` - Fundamental layout component
|
|
56
|
+
- `Center` - Centers children horizontally and vertically
|
|
57
|
+
- `HStack` - Horizontal stack layout
|
|
58
|
+
- `VStack` - Vertical stack layout
|
|
59
|
+
- `Grid` / `GridItem` - CSS-like grid layout
|
|
60
|
+
- `Divider` - Visual separator
|
|
61
|
+
|
|
62
|
+
### Typography
|
|
63
|
+
- `Text` - Body text with variants (body, caption, label, small)
|
|
64
|
+
- `Heading` - Headings (h1, h2, h3, h4)
|
|
65
|
+
- `Link` - Styled link component
|
|
66
|
+
|
|
67
|
+
### Form Controls
|
|
68
|
+
- `Input` - Text input with variants
|
|
69
|
+
- `Textarea` - Multi-line text input
|
|
70
|
+
- `Checkbox` / `CheckboxGroup` - Checkbox controls
|
|
71
|
+
- `Radio` / `RadioGroup` - Radio button controls
|
|
72
|
+
- `Select` - Dropdown selection
|
|
73
|
+
- `Switch` - Toggle switch
|
|
74
|
+
- `Slider` - Range slider
|
|
75
|
+
- `FormControl` - Form wrapper with label/error states
|
|
76
|
+
|
|
77
|
+
### Feedback
|
|
78
|
+
- `Alert` - Status messages
|
|
79
|
+
- `Toast` / `ToastProvider` - Non-blocking notifications
|
|
80
|
+
- `Progress` - Linear and circular progress indicators
|
|
81
|
+
- `Spinner` - Loading spinner
|
|
82
|
+
- `Skeleton` / `SkeletonText` - Loading placeholders
|
|
83
|
+
|
|
84
|
+
### Overlays
|
|
85
|
+
- `Modal` - Dialog overlay
|
|
86
|
+
- `Drawer` - Slide-in panel
|
|
87
|
+
- `AlertDialog` - Confirmation dialog
|
|
88
|
+
- `ActionSheet` - Bottom action sheet
|
|
89
|
+
- `Popover` - Floating content panel
|
|
90
|
+
- `Menu` - Dropdown menu
|
|
91
|
+
- `Tooltip` - Informational popup
|
|
92
|
+
|
|
93
|
+
### Data Display
|
|
94
|
+
- `Avatar` / `AvatarGroup` - User profile pictures
|
|
95
|
+
- `Badge` - Status indicators
|
|
96
|
+
- `Card` - Content container
|
|
97
|
+
- `Table` - Data table
|
|
98
|
+
- `Image` - Enhanced image component
|
|
99
|
+
- `Icon` - Vector icon component
|
|
100
|
+
|
|
101
|
+
### Actions
|
|
102
|
+
- `Button` - Primary action component
|
|
103
|
+
- `Pressable` - Enhanced pressable
|
|
104
|
+
- `Fab` - Floating Action Button
|
|
105
|
+
- `Accordion` - Expandable sections
|
|
106
|
+
|
|
107
|
+
### Utilities
|
|
108
|
+
- `Portal` / `PortalProvider` - Portal rendering
|
|
109
|
+
|
|
110
|
+
## Design Tokens
|
|
111
|
+
|
|
112
|
+
The library uses design tokens based on the Urbint Design System:
|
|
113
|
+
|
|
114
|
+
### Colors
|
|
115
|
+
```typescript
|
|
116
|
+
// Brand
|
|
117
|
+
brand.navy: '#003F53'
|
|
118
|
+
brand.blue: '#00A0CC'
|
|
119
|
+
|
|
120
|
+
// Feedback
|
|
121
|
+
feedback.info.content: '#3C87DD'
|
|
122
|
+
feedback.success.content: '#2BA329'
|
|
123
|
+
feedback.warning.content: '#D69600'
|
|
124
|
+
feedback.error.content: '#E7183E'
|
|
125
|
+
|
|
126
|
+
// Badges
|
|
127
|
+
badge.red: '#CF3D3D'
|
|
128
|
+
badge.orange: '#B75E0B'
|
|
129
|
+
badge.yellow: '#E8BA30'
|
|
130
|
+
badge.blue: '#3E70D4'
|
|
131
|
+
badge.green: '#238914'
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Typography
|
|
135
|
+
- **H1 PageHeading**: 26px, Regular (400)
|
|
136
|
+
- **H2 SectionHeading**: 22px, Semi-Bold (600)
|
|
137
|
+
- **H3 SectionSubheading**: 20px, Semi-Bold (600)
|
|
138
|
+
- **H4 Subheading**: 18px, Semi-Bold (600)
|
|
139
|
+
- **Body**: 16px, Regular (400)
|
|
140
|
+
- **Caption**: 13px, Regular (400)
|
|
141
|
+
|
|
142
|
+
### Spacing
|
|
143
|
+
```typescript
|
|
144
|
+
spacing['0.5x']: 2 // 0.125rem
|
|
145
|
+
spacing.base: 4 // 0.25rem
|
|
146
|
+
spacing['2x']: 8 // 0.5rem
|
|
147
|
+
spacing['3x']: 12 // 0.75rem
|
|
148
|
+
spacing['4x']: 16 // 1rem
|
|
149
|
+
spacing['6x']: 24 // 1.5rem
|
|
150
|
+
spacing['8x']: 32 // 2rem
|
|
151
|
+
spacing['12x']: 48 // 3rem
|
|
152
|
+
spacing['18x']: 72 // 4.5rem
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Elevation
|
|
156
|
+
- **5**: Slight shadow (borders alternative)
|
|
157
|
+
- **10**: Small elements (buttons, tooltips)
|
|
158
|
+
- **20**: Medium elements (cards, nav-bars)
|
|
159
|
+
- **30**: Overlay panels and toasts
|
|
160
|
+
- **40**: Modals
|
|
161
|
+
|
|
162
|
+
## Theming
|
|
163
|
+
|
|
164
|
+
The library supports light and dark themes that automatically adapt to system preferences:
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
import { StyleSheet, useUnistyles } from 'react-native-unistyles';
|
|
168
|
+
|
|
169
|
+
function MyComponent() {
|
|
170
|
+
const { theme } = useUnistyles();
|
|
171
|
+
|
|
172
|
+
return (
|
|
173
|
+
<View style={{ backgroundColor: theme.colors.background.primary }}>
|
|
174
|
+
<Text style={{ color: theme.colors.text.primary }}>
|
|
175
|
+
Themed content
|
|
176
|
+
</Text>
|
|
177
|
+
</View>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Storybook
|
|
183
|
+
|
|
184
|
+
Run Storybook to explore all components:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
npm run storybook
|
|
188
|
+
# or
|
|
189
|
+
npm run storybook:ios
|
|
190
|
+
npm run storybook:android
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Development
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
# Install dependencies
|
|
197
|
+
npm install
|
|
198
|
+
|
|
199
|
+
# Start the development server
|
|
200
|
+
npm start
|
|
201
|
+
|
|
202
|
+
# Run on iOS
|
|
203
|
+
npm run ios
|
|
204
|
+
|
|
205
|
+
# Run on Android
|
|
206
|
+
npm run android
|
|
207
|
+
|
|
208
|
+
# Type check
|
|
209
|
+
npm run typecheck
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Requirements
|
|
213
|
+
|
|
214
|
+
- React Native 0.81+
|
|
215
|
+
- Expo SDK 54+
|
|
216
|
+
- Node.js 20+
|
|
217
|
+
|
|
218
|
+
## AI/LLM Documentation
|
|
219
|
+
|
|
220
|
+
For AI assistants and LLMs, we provide comprehensive documentation in a single file:
|
|
221
|
+
|
|
222
|
+
- **[llms.txt](./llms.txt)** - Complete API reference, examples, and usage patterns optimized for LLM consumption
|
|
223
|
+
|
|
224
|
+
This file contains all component APIs, props, examples, design tokens, theming guide, and best practices in a structured format that AI assistants can use to help developers.
|
|
225
|
+
|
|
226
|
+
## License
|
|
227
|
+
|
|
228
|
+
MIT © Urbint
|
|
229
|
+
|
package/app.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"expo": {
|
|
3
|
+
"name": "urbint-cl",
|
|
4
|
+
"slug": "urbint-cl",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"orientation": "portrait",
|
|
7
|
+
"icon": "./assets/icon.png",
|
|
8
|
+
"userInterfaceStyle": "light",
|
|
9
|
+
"newArchEnabled": true,
|
|
10
|
+
"entryPoint": "./index.ts",
|
|
11
|
+
"splash": {
|
|
12
|
+
"image": "./assets/splash-icon.png",
|
|
13
|
+
"resizeMode": "contain",
|
|
14
|
+
"backgroundColor": "#ffffff"
|
|
15
|
+
},
|
|
16
|
+
"ios": {
|
|
17
|
+
"supportsTablet": true,
|
|
18
|
+
"bundleIdentifier": "com.amankadam.urbintcl"
|
|
19
|
+
},
|
|
20
|
+
"android": {
|
|
21
|
+
"adaptiveIcon": {
|
|
22
|
+
"foregroundImage": "./assets/adaptive-icon.png",
|
|
23
|
+
"backgroundColor": "#ffffff"
|
|
24
|
+
},
|
|
25
|
+
"edgeToEdgeEnabled": true,
|
|
26
|
+
"predictiveBackGestureEnabled": false,
|
|
27
|
+
"package": "com.amankadam.urbintcl"
|
|
28
|
+
},
|
|
29
|
+
"web": {
|
|
30
|
+
"favicon": "./assets/favicon.png"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
Binary file
|
|
Binary file
|
package/assets/icon.png
ADDED
|
Binary file
|
|
Binary file
|
package/babel.config.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module.exports = function (api) {
|
|
2
|
+
api.cache(true);
|
|
3
|
+
|
|
4
|
+
return {
|
|
5
|
+
presets: ['babel-preset-expo'],
|
|
6
|
+
// Temporarily disabled Unistyles plugin for debugging
|
|
7
|
+
// plugins: [
|
|
8
|
+
// [
|
|
9
|
+
// 'react-native-unistyles/plugin',
|
|
10
|
+
// {
|
|
11
|
+
// root: 'src',
|
|
12
|
+
// },
|
|
13
|
+
// ],
|
|
14
|
+
// ],
|
|
15
|
+
};
|
|
16
|
+
};
|