@urbint/cl 1.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/.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/.cursor/rules
ADDED
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
# Cursor Rules – Cross-Platform React Native Component Library
|
|
2
|
+
## Using Unistyles + Storybook (Web, iOS, Android)
|
|
3
|
+
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## 1. Project Scope & Intent
|
|
7
|
+
|
|
8
|
+
This repository is a **shared UI component library** used across:
|
|
9
|
+
|
|
10
|
+
- React Native (iOS)
|
|
11
|
+
- React Native (Android)
|
|
12
|
+
- React Native Web
|
|
13
|
+
|
|
14
|
+
The library must be:
|
|
15
|
+
|
|
16
|
+
- Theme-driven
|
|
17
|
+
- Platform-agnostic
|
|
18
|
+
- Accessible
|
|
19
|
+
- Performant
|
|
20
|
+
- Strictly typed
|
|
21
|
+
- Reusable across multiple apps
|
|
22
|
+
|
|
23
|
+
Cursor must **not** introduce app-specific logic.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 2. Tech Stack (Non-Negotiable)
|
|
28
|
+
|
|
29
|
+
Cursor must assume and follow:
|
|
30
|
+
|
|
31
|
+
- React Native
|
|
32
|
+
- TypeScript (strict mode)
|
|
33
|
+
- react-native-unistyles
|
|
34
|
+
- react-native-web compatibility
|
|
35
|
+
- Storybook (React Native + Web)
|
|
36
|
+
|
|
37
|
+
Explicitly forbidden:
|
|
38
|
+
|
|
39
|
+
- Inline styles
|
|
40
|
+
- StyleSheet.create
|
|
41
|
+
- Tailwind / CSS-in-JS alternatives
|
|
42
|
+
- Zustand / Redux
|
|
43
|
+
- Side effects (analytics, storage, API calls)
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 3. Folder & Naming Conventions
|
|
48
|
+
|
|
49
|
+
### Component Structure
|
|
50
|
+
components/
|
|
51
|
+
- Button/
|
|
52
|
+
Button.tsx
|
|
53
|
+
Button.styles.ts
|
|
54
|
+
Button.types.ts
|
|
55
|
+
Button.stories.tsx
|
|
56
|
+
index.ts
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### Rules
|
|
60
|
+
|
|
61
|
+
- One component per folder
|
|
62
|
+
- Logic, styles, and types must be separated
|
|
63
|
+
- Barrel export (`index.ts`) is mandatory
|
|
64
|
+
- Filenames must match component name
|
|
65
|
+
- Component names must be PascalCase
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 4. Component Authoring Rules
|
|
70
|
+
|
|
71
|
+
### Design Principles
|
|
72
|
+
|
|
73
|
+
Components must be:
|
|
74
|
+
|
|
75
|
+
- Pure
|
|
76
|
+
- Stateless unless unavoidable
|
|
77
|
+
- Controlled via props
|
|
78
|
+
- Deterministic and predictable
|
|
79
|
+
|
|
80
|
+
Forbidden:
|
|
81
|
+
|
|
82
|
+
- Business logic
|
|
83
|
+
- Navigation
|
|
84
|
+
- Analytics
|
|
85
|
+
- API calls
|
|
86
|
+
- App-specific assumptions
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 5. Styling Rules (Unistyles)
|
|
91
|
+
|
|
92
|
+
### Mandatory Pattern
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
import { createStyleSheet } from 'react-native-unistyles';
|
|
96
|
+
|
|
97
|
+
export const stylesheet = createStyleSheet(theme => ({
|
|
98
|
+
container: {
|
|
99
|
+
paddingVertical: theme.spacing.sm,
|
|
100
|
+
paddingHorizontal: theme.spacing.md,
|
|
101
|
+
borderRadius: theme.radius.md,
|
|
102
|
+
},
|
|
103
|
+
text: {
|
|
104
|
+
color: theme.colors.text.primary,
|
|
105
|
+
fontSize: theme.typography.body.fontSize,
|
|
106
|
+
},
|
|
107
|
+
}));
|
|
108
|
+
|
|
109
|
+
Usage
|
|
110
|
+
|
|
111
|
+
const { styles } = useStyles(stylesheet);
|
|
112
|
+
|
|
113
|
+
Rules
|
|
114
|
+
• ❌ No inline styles
|
|
115
|
+
• ❌ No StyleSheet.create
|
|
116
|
+
• ❌ No hardcoded values
|
|
117
|
+
• ✅ Use semantic tokens from theme
|
|
118
|
+
• ✅ Support light & dark themes automatically
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
6. Theme Contract Assumptions
|
|
122
|
+
|
|
123
|
+
Cursor must assume these theme keys exist:
|
|
124
|
+
|
|
125
|
+
theme.colors
|
|
126
|
+
theme.spacing
|
|
127
|
+
theme.radius
|
|
128
|
+
theme.typography
|
|
129
|
+
theme.shadows
|
|
130
|
+
theme.zIndex
|
|
131
|
+
|
|
132
|
+
Rules:
|
|
133
|
+
• Do not invent new tokens casually
|
|
134
|
+
• Prefer semantic tokens over raw intent
|
|
135
|
+
• Components must work with any theme
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
7. Props & Type Rules
|
|
139
|
+
|
|
140
|
+
export interface ButtonProps {
|
|
141
|
+
label: string;
|
|
142
|
+
variant?: 'primary' | 'secondary' | 'ghost';
|
|
143
|
+
size?: 'sm' | 'md' | 'lg';
|
|
144
|
+
disabled?: boolean;
|
|
145
|
+
onPress?: () => void;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
Rules:
|
|
149
|
+
• No any
|
|
150
|
+
• Explicit props only
|
|
151
|
+
• Optional props must have defaults
|
|
152
|
+
• Use discriminated unions when behavior differs
|
|
153
|
+
• Avoid extending native props unless necessary
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
8. Accessibility (Mandatory)
|
|
157
|
+
|
|
158
|
+
Every interactive component must:
|
|
159
|
+
• Support accessibilityLabel
|
|
160
|
+
• Define accessibilityRole
|
|
161
|
+
• Respect font scaling
|
|
162
|
+
• Respect reduced motion preferences
|
|
163
|
+
• Use Pressable instead of Touchable*
|
|
164
|
+
|
|
165
|
+
Accessibility is not optional.
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
9. Platform Compatibility Rules
|
|
169
|
+
|
|
170
|
+
Components must:
|
|
171
|
+
• Work on iOS, Android, and Web
|
|
172
|
+
• Avoid DOM-only APIs
|
|
173
|
+
• Avoid native-only APIs
|
|
174
|
+
• Use Platform.select() only when unavoidable
|
|
175
|
+
|
|
176
|
+
No pixel-perfect assumptions.
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
10. Performance Rules
|
|
180
|
+
• Avoid anonymous functions in render
|
|
181
|
+
• Use memo where appropriate
|
|
182
|
+
• No heavy calculations during render
|
|
183
|
+
• No unnecessary re-renders
|
|
184
|
+
|
|
185
|
+
11. Storybook (Mandatory)
|
|
186
|
+
|
|
187
|
+
Storybook is the source of truth for:
|
|
188
|
+
• Visual validation
|
|
189
|
+
• Theme coverage
|
|
190
|
+
• Accessibility review
|
|
191
|
+
• Cross-platform parity
|
|
192
|
+
|
|
193
|
+
Every component must include a story.
|
|
194
|
+
|
|
195
|
+
13. Storybook Stack Assumptions
|
|
196
|
+
|
|
197
|
+
Cursor must assume:
|
|
198
|
+
• @storybook/react-native
|
|
199
|
+
• @storybook/react (for web)
|
|
200
|
+
• TypeScript stories
|
|
201
|
+
• CSF (Component Story Format)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
14. Story Placement
|
|
205
|
+
|
|
206
|
+
Stories must be co-located with components:
|
|
207
|
+
components/Button/Button.stories.tsx
|
|
208
|
+
No global stories folder.
|
|
209
|
+
|
|
210
|
+
15. Story Format (Required)
|
|
211
|
+
|
|
212
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
213
|
+
import { Button } from './Button';
|
|
214
|
+
|
|
215
|
+
const meta: Meta<typeof Button> = {
|
|
216
|
+
title: 'Components/Button',
|
|
217
|
+
component: Button,
|
|
218
|
+
argTypes: {
|
|
219
|
+
onPress: { action: 'pressed' },
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export default meta;
|
|
224
|
+
|
|
225
|
+
type Story = StoryObj<typeof Button>;
|
|
226
|
+
|
|
227
|
+
export const Primary: Story = {
|
|
228
|
+
args: {
|
|
229
|
+
label: 'Primary Button',
|
|
230
|
+
variant: 'primary',
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
Rules:
|
|
235
|
+
• Use args, not inline JSX
|
|
236
|
+
• No anonymous components
|
|
237
|
+
• No logic inside stories
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
16. Theme Integration in Storybook
|
|
242
|
+
|
|
243
|
+
Storybook must use a theme decorator:
|
|
244
|
+
|
|
245
|
+
<UnistylesThemeProvider theme="light">
|
|
246
|
+
<Story />
|
|
247
|
+
</UnistylesThemeProvider>
|
|
248
|
+
Rules:
|
|
249
|
+
• All stories must render in light & dark themes
|
|
250
|
+
• No hardcoded colors
|
|
251
|
+
• Prefer toolbar theme switching
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
17. Story Coverage Requirements
|
|
255
|
+
|
|
256
|
+
Each component must include stories for:
|
|
257
|
+
• Default state
|
|
258
|
+
• All variants
|
|
259
|
+
• Disabled state
|
|
260
|
+
• Edge cases (long text, overflow)
|
|
261
|
+
• Interaction states
|
|
262
|
+
|
|
263
|
+
⸻
|
|
264
|
+
|
|
265
|
+
18. Controls & Actions
|
|
266
|
+
• All public props must be exposed via args
|
|
267
|
+
• Use Storybook actions for callbacks
|
|
268
|
+
• No console logging
|
|
269
|
+
|
|
270
|
+
19. Accessibility in Storybook
|
|
271
|
+
|
|
272
|
+
Stories must:
|
|
273
|
+
• Include accessible labels
|
|
274
|
+
• Be keyboard navigable on web
|
|
275
|
+
• Avoid visual-only meaning
|
|
276
|
+
|
|
277
|
+
Optional:
|
|
278
|
+
• @storybook/addon-a11y
|
|
279
|
+
|
|
280
|
+
⸻
|
|
281
|
+
|
|
282
|
+
20. Cross-Platform Story Rules
|
|
283
|
+
|
|
284
|
+
Stories must:
|
|
285
|
+
• Render on iOS, Android, and Web
|
|
286
|
+
• Avoid platform-specific hacks
|
|
287
|
+
• Avoid DOM APIs
|
|
288
|
+
|
|
289
|
+
21. Documentation Stories (Preferred)
|
|
290
|
+
|
|
291
|
+
Core components should include documentation stories using Storybook Docs.
|
|
292
|
+
|
|
293
|
+
⸻
|
|
294
|
+
|
|
295
|
+
22. What Cursor Must NEVER Do
|
|
296
|
+
|
|
297
|
+
❌ Add navigation
|
|
298
|
+
❌ Add analytics
|
|
299
|
+
❌ Add API calls
|
|
300
|
+
❌ Add state management
|
|
301
|
+
❌ Hardcode styles
|
|
302
|
+
❌ Skip Storybook
|
|
303
|
+
❌ Break web compatibility
|
|
304
|
+
|
|
305
|
+
23. Quality Gate Before Completion
|
|
306
|
+
|
|
307
|
+
Cursor must verify:
|
|
308
|
+
• TypeScript passes
|
|
309
|
+
• Component renders on web
|
|
310
|
+
• Theme-driven styling
|
|
311
|
+
• Accessibility compliance
|
|
312
|
+
• Storybook coverage exists
|
|
313
|
+
• Clean public exports
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
2
|
+
import { view } from './storybook.requires';
|
|
3
|
+
|
|
4
|
+
const StorybookUIRoot = view.getStorybookUI({
|
|
5
|
+
storage: {
|
|
6
|
+
getItem: AsyncStorage.getItem,
|
|
7
|
+
setItem: AsyncStorage.setItem,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export default StorybookUIRoot;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StorybookConfig } from '@storybook/react-native';
|
|
2
|
+
|
|
3
|
+
const main: StorybookConfig = {
|
|
4
|
+
stories: ['./stories/**/*.stories.?(ts|tsx|js|jsx)'],
|
|
5
|
+
addons: ['@storybook/addon-ondevice-controls', '@storybook/addon-ondevice-actions'],
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default main;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/* do not change this file, it is auto generated by storybook. */
|
|
2
|
+
|
|
3
|
+
import { start, updateView } from '@storybook/react-native';
|
|
4
|
+
|
|
5
|
+
import '@storybook/addon-ondevice-controls/register';
|
|
6
|
+
import '@storybook/addon-ondevice-actions/register';
|
|
7
|
+
|
|
8
|
+
const normalizedStories = [
|
|
9
|
+
{
|
|
10
|
+
titlePrefix: '',
|
|
11
|
+
directory: './.rnstorybook/stories',
|
|
12
|
+
files: '**/*.stories.?(ts|tsx|js|jsx)',
|
|
13
|
+
importPathMatcher:
|
|
14
|
+
/^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.(?:ts|tsx|js|jsx)?)$/,
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
req: require.context(
|
|
17
|
+
'./stories',
|
|
18
|
+
true,
|
|
19
|
+
/^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.(?:ts|tsx|js|jsx)?)$/
|
|
20
|
+
),
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
declare global {
|
|
25
|
+
var view: ReturnType<typeof start>;
|
|
26
|
+
var STORIES: typeof normalizedStories;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const annotations = [
|
|
30
|
+
require('./preview'),
|
|
31
|
+
require('@storybook/react-native/dist/preview'),
|
|
32
|
+
require('@storybook/addon-ondevice-actions/preview'),
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
global.STORIES = normalizedStories;
|
|
36
|
+
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
module?.hot?.accept?.();
|
|
39
|
+
|
|
40
|
+
if (!global.view) {
|
|
41
|
+
global.view = start({
|
|
42
|
+
annotations,
|
|
43
|
+
storyEntries: normalizedStories,
|
|
44
|
+
});
|
|
45
|
+
} else {
|
|
46
|
+
updateView(global.view, annotations, normalizedStories);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const view = global.view;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { StorybookConfig } from '@storybook/react-native-web-vite';
|
|
2
|
+
|
|
3
|
+
const config: StorybookConfig = {
|
|
4
|
+
"stories": [
|
|
5
|
+
"../src/**/*.mdx",
|
|
6
|
+
"../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"
|
|
7
|
+
],
|
|
8
|
+
"addons": [
|
|
9
|
+
"@chromatic-com/storybook",
|
|
10
|
+
"@storybook/addon-vitest",
|
|
11
|
+
"@storybook/addon-a11y",
|
|
12
|
+
"@storybook/addon-docs"
|
|
13
|
+
],
|
|
14
|
+
"framework": "@storybook/react-native-web-vite"
|
|
15
|
+
};
|
|
16
|
+
export default config;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Preview } from '@storybook/react-native-web-vite';
|
|
2
|
+
|
|
3
|
+
// Import Unistyles configuration - this is required for styled components
|
|
4
|
+
import '../src/styles/unistyles';
|
|
5
|
+
|
|
6
|
+
const preview: Preview = {
|
|
7
|
+
parameters: {
|
|
8
|
+
controls: {
|
|
9
|
+
matchers: {
|
|
10
|
+
color: /(background|color)$/i,
|
|
11
|
+
date: /Date$/i,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
a11y: {
|
|
15
|
+
// 'todo' - show a11y violations in the test UI only
|
|
16
|
+
// 'error' - fail CI on a11y violations
|
|
17
|
+
// 'off' - skip a11y checks entirely
|
|
18
|
+
test: 'todo',
|
|
19
|
+
},
|
|
20
|
+
layout: 'centered',
|
|
21
|
+
backgrounds: {
|
|
22
|
+
default: 'light',
|
|
23
|
+
values: [
|
|
24
|
+
{ name: 'light', value: '#ffffff' },
|
|
25
|
+
{ name: 'dark', value: '#1a1a2e' },
|
|
26
|
+
{ name: 'gray', value: '#f5f5f5' },
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default preview;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as a11yAddonAnnotations from "@storybook/addon-a11y/preview";
|
|
2
|
+
import { setProjectAnnotations } from '@storybook/react-native-web-vite';
|
|
3
|
+
import * as projectAnnotations from './preview';
|
|
4
|
+
|
|
5
|
+
// This is an important step to apply the right configuration when testing your stories.
|
|
6
|
+
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
|
|
7
|
+
setProjectAnnotations([a11yAddonAnnotations, projectAnnotations]);
|