@mrmeg/expo-ui 0.1.1 → 0.1.2
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/README.md +173 -33
- package/package.json +12 -1
package/README.md
CHANGED
|
@@ -19,9 +19,11 @@ bun add @mrmeg/expo-ui
|
|
|
19
19
|
Consumers must also install the peer dependencies listed in `package.json`.
|
|
20
20
|
The tested baseline is Expo SDK 55 with React 19.2, React Native 0.83,
|
|
21
21
|
React Native Web 0.21, Reanimated 4.2, Worklets 0.7, and
|
|
22
|
-
`@rn-primitives/*` 1.4.
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
`@rn-primitives/*` 1.4. `i18next` and `react-i18next` are runtime peers
|
|
23
|
+
because `StyledText` and `Notification` support translated text keys. Start
|
|
24
|
+
consumer apps from the same Expo SDK family or update the package and peer
|
|
25
|
+
ranges deliberately. Keep npm auth tokens in developer or CI configuration,
|
|
26
|
+
not in this repository.
|
|
25
27
|
|
|
26
28
|
## Imports
|
|
27
29
|
|
|
@@ -29,7 +31,9 @@ developer or CI configuration, not in this repository.
|
|
|
29
31
|
import { Button, StyledText } from "@mrmeg/expo-ui/components";
|
|
30
32
|
import { Button as ButtonDirect } from "@mrmeg/expo-ui/components/Button";
|
|
31
33
|
import { colors, spacing, typography } from "@mrmeg/expo-ui/constants";
|
|
34
|
+
import { colors as colorsDirect } from "@mrmeg/expo-ui/constants/colors";
|
|
32
35
|
import { useResources, useTheme } from "@mrmeg/expo-ui/hooks";
|
|
36
|
+
import { useTheme as useThemeDirect } from "@mrmeg/expo-ui/hooks/useTheme";
|
|
33
37
|
import { globalUIStore, useThemeStore } from "@mrmeg/expo-ui/state";
|
|
34
38
|
import { hapticLight } from "@mrmeg/expo-ui/lib";
|
|
35
39
|
```
|
|
@@ -105,33 +109,88 @@ Useful `StyledText` props:
|
|
|
105
109
|
|
|
106
110
|
## Component Guide
|
|
107
111
|
|
|
108
|
-
All components are exported from `@mrmeg/expo-ui/components`; direct imports such as `@mrmeg/expo-ui/components/Button` are supported.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
112
|
+
All components are exported from `@mrmeg/expo-ui/components`; direct imports such as `@mrmeg/expo-ui/components/Button` are supported. Use this table as the first stop before building a new primitive in a consumer app.
|
|
113
|
+
|
|
114
|
+
### LLM Component Use-Case Index
|
|
115
|
+
|
|
116
|
+
| Component | Use For | Prefer It Instead Of | Common Example Use Cases |
|
|
117
|
+
|-----------|---------|----------------------|--------------------------|
|
|
118
|
+
| `Accordion`, `AccordionItem`, `AccordionTrigger`, `AccordionContent` | Multi-section disclosure | Custom FAQ/settings expanders | FAQ lists, grouped settings, help sections, dense detail pages |
|
|
119
|
+
| `Alert` | Cross-platform imperative alerts | Direct `window.alert` or duplicated RN/web branching | Confirm destructive actions, native alert dialogs, simple blocking messages |
|
|
120
|
+
| `AnimatedView` | Entrance and visibility animation | Hand-rolled Reanimated wrappers | Staggered list rows, revealed panels, animated empty states |
|
|
121
|
+
| `Badge` | Short status labels | Custom pill `View` + `Text` | Draft/active states, counts, plan labels, role tags |
|
|
122
|
+
| `BottomSheet` | Mobile-first modal sheets | Custom absolute-position sheets | Action pickers, mobile filters, quick edit forms, contextual details |
|
|
123
|
+
| `Button` | Commands and CTAs | Pressable plus custom text styling | Submit, save, cancel, delete, navigation CTAs, icon-accessory buttons |
|
|
124
|
+
| `Card`, `CardHeader`, `CardTitle`, `CardDescription`, `CardContent`, `CardFooter` | Framed content groups | Ad hoc bordered panels | List items, pricing plans, settings sections, summaries, dashboards |
|
|
125
|
+
| `Checkbox` | Boolean selection | Custom checkmark controls | Terms consent, checklist items, multi-select filters, notification opt-ins |
|
|
126
|
+
| `Collapsible`, `CollapsibleTrigger`, `CollapsibleContent` | One-off disclosure | Local animated height wrappers | Advanced settings, hidden helper text, optional details |
|
|
127
|
+
| `Dialog`, `AlertDialog` | Modal decisions and custom modal content | Custom modal overlays | Confirm delete, edit profile, invite user, blocking warnings |
|
|
128
|
+
| `DismissKeyboard` | Tap-away keyboard dismissal | Screen-level keyboard handling | Forms, search screens, sign-in screens |
|
|
129
|
+
| `Drawer` | Side panels and drawer navigation | Custom sliding panels | Filter drawer, app navigation drawer, inspector panel |
|
|
130
|
+
| `DropdownMenu` | Menus and command lists | Homemade popover menus | Row actions, account menu, sort menu, checkbox/radio menu groups |
|
|
131
|
+
| `EmptyState` | No-data or recoverable error regions | One-off empty placeholders | Empty inbox, no search results, missing permissions, failed list load |
|
|
132
|
+
| `ErrorBoundary` | React render error fallback | Unhandled screen crashes | Route-level fallback, feature boundary, recoverable widget crashes |
|
|
133
|
+
| `Icon` | Feather or custom icons with theme tokens | Raw vector icons with hardcoded colors | Button accessories, empty-state icons, menu icons, status glyphs |
|
|
134
|
+
| `InputOTP` | Verification code entry | Multiple manually managed text inputs | Email codes, SMS codes, MFA, invite codes |
|
|
135
|
+
| `Label` | Accessible form labels | Plain styled text labels | Required labels, disabled labels, field group labels |
|
|
136
|
+
| `MaxWidthContainer` | Centered responsive width | Per-screen max-width wrappers | Web pages, tablet layouts, settings forms, auth panels |
|
|
137
|
+
| `Notification` | Global toast surface | Screen-local toast state | Saved/error/sync notifications, loading toast, bottom-position alerts |
|
|
138
|
+
| `Popover` | Anchored contextual content | Custom anchored views | Inline help, quick previews, contextual controls, small forms |
|
|
139
|
+
| `Progress` | Determinate or indeterminate progress | Layout-shifting spinners for progress regions | Upload progress, onboarding completion, long-running task state |
|
|
140
|
+
| `RadioGroup`, `RadioGroupItem` | Mutually exclusive choices | Custom radio rows | Plan interval, visibility choice, survey answer, preference setting |
|
|
141
|
+
| `Select` | Option menus | Custom dropdowns | Country picker, category selector, status selector, compact form choice |
|
|
142
|
+
| `Separator` | Horizontal or vertical dividers | Border-only spacer views | Menu dividers, section dividers, card dividers |
|
|
143
|
+
| `Skeleton`, `SkeletonText`, `SkeletonAvatar`, `SkeletonCard` | Loading placeholders | Blank space or generic spinners | List loading, profile card loading, dashboard placeholders |
|
|
144
|
+
| `Slider` | Numeric value selection | Custom pan gesture track | Volume, percentage, rating, threshold, range-like settings |
|
|
145
|
+
| `StatusBar` | Theme-aware native status bar | Per-screen status-bar duplication | Root layout status styling, dark/light mode updates |
|
|
146
|
+
| `StyledText` and text aliases | Theme-aware typography | Raw `Text` with hardcoded styles | Titles, headings, labels, body copy, captions, translated text |
|
|
147
|
+
| `Switch` | Binary settings | Custom toggle switches | Enable notifications, privacy setting, feature toggles |
|
|
148
|
+
| `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent` | In-page tabbed views | Custom segmented/tab controls | Profile sections, report views, settings categories |
|
|
149
|
+
| `TextInput` | Text entry | Raw `TextInput` with repeated label/error code | Email/password, search, numeric input, multiline notes |
|
|
150
|
+
| `Toggle`, `ToggleIcon` | Pressed/unpressed control | Button with local selected styling | Favorite, mute, bold/italic, view mode button |
|
|
151
|
+
| `ToggleGroup`, `ToggleGroupItem`, `ToggleGroupIcon` | Single or multi toggle groups | Custom segmented controls | Alignment, formatting toolbar, filter chips, view mode switcher |
|
|
152
|
+
| `Tooltip` | Short hover/focus help | Persistent helper text or custom hover cards | Icon button labels, field hints, disabled action explanations |
|
|
153
|
+
|
|
154
|
+
### Compound Parts And Aliases
|
|
155
|
+
|
|
156
|
+
Most compound components support both direct named imports and dot notation on the root component. Prefer the named exports when code completion or LLM context benefits from explicit names.
|
|
157
|
+
|
|
158
|
+
| Root | Exported Parts |
|
|
159
|
+
|------|----------------|
|
|
160
|
+
| `Accordion` | `AccordionItem`, `AccordionTrigger`, `AccordionContent` |
|
|
161
|
+
| `AlertDialog` | `AlertDialogTrigger`, `AlertDialogContent`, `AlertDialogTitle`, `AlertDialogDescription`, `AlertDialogAction`, `AlertDialogCancel` |
|
|
162
|
+
| `BottomSheet` | `BottomSheetTrigger`, `BottomSheetContent`, `BottomSheetHandle`, `BottomSheetHeader`, `BottomSheetBody`, `BottomSheetFooter`, `BottomSheetClose` |
|
|
163
|
+
| `Card` | `CardHeader`, `CardTitle`, `CardDescription`, `CardContent`, `CardFooter` |
|
|
164
|
+
| `Collapsible` | `CollapsibleTrigger`, `CollapsibleContent` |
|
|
165
|
+
| `Dialog` | `DialogTrigger`, `DialogContent`, `DialogHeader`, `DialogFooter`, `DialogTitle`, `DialogDescription`, `DialogClose` |
|
|
166
|
+
| `Drawer` | `DrawerTrigger`, `DrawerContent`, `DrawerHeader`, `DrawerBody`, `DrawerFooter`, `DrawerClose` |
|
|
167
|
+
| `DropdownMenu` | `DropdownMenuTrigger`, `DropdownMenuContent`, `DropdownMenuGroup`, `DropdownMenuItem`, `DropdownMenuCheckboxItem`, `DropdownMenuRadioGroup`, `DropdownMenuRadioItem`, `DropdownMenuLabel`, `DropdownMenuSeparator`, `DropdownMenuShortcut`, `DropdownMenuPortal`, `DropdownMenuSub`, `DropdownMenuSubTrigger`, `DropdownMenuSubContent` |
|
|
168
|
+
| `Popover` | `PopoverTrigger`, `PopoverContent`, `PopoverHeader`, `PopoverBody`, `PopoverFooter` |
|
|
169
|
+
| `RadioGroup` | `RadioGroupItem` |
|
|
170
|
+
| `Select` | `SelectTrigger`, `SelectValue`, `SelectContent`, `SelectItem`, `SelectGroup`, `SelectLabel`, `SelectSeparator` |
|
|
171
|
+
| `Skeleton` | `SkeletonText`, `SkeletonAvatar`, `SkeletonCard` |
|
|
172
|
+
| `Tabs` | `TabsList`, `TabsTrigger`, `TabsContent` |
|
|
173
|
+
| `Toggle` | `ToggleIcon` |
|
|
174
|
+
| `ToggleGroup` | `ToggleGroupItem`, `ToggleGroupIcon` |
|
|
175
|
+
| `Tooltip` | `TooltipTrigger`, `TooltipContent`, `TooltipBody` |
|
|
176
|
+
|
|
177
|
+
Text aliases are exported for common semantic typography: `SerifText`, `SansSerifText`, `SerifBoldText`, `SansSerifBoldText`, `DisplayText`, `TitleText`, `HeadingText`, `SubheadingText`, `BodyText`, `CaptionText`, and `LabelText`. `TextClassContext` and `TextColorContext` are advanced context exports used by package controls to pass nested text styling.
|
|
178
|
+
|
|
179
|
+
### Common Patterns
|
|
180
|
+
|
|
181
|
+
Use `Button.preset`, not `variant`. `default` is the neutral primary action, `secondary` is a neutral secondary surface, `outline` is for lower-emphasis actions, `ghost` is for compact toolbars, `link` is for text-like commands, and `destructive` is for dangerous actions.
|
|
182
|
+
|
|
183
|
+
Use `StyledText` or its aliases instead of raw `Text` whenever the text is part of app UI. Use `TextInput` for labeled fields because it already owns label, helper text, error text, clear buttons, password visibility, numeric filtering, and left/right elements.
|
|
184
|
+
|
|
185
|
+
Mount `PortalHost` once before using `Dialog`, `AlertDialog`, `BottomSheet`, `Drawer`, `DropdownMenu`, `Popover`, `SelectContent`, or `Tooltip`. Mount `Notification` once near the root and trigger it from `globalUIStore`.
|
|
186
|
+
|
|
187
|
+
Use `Skeleton` components for loading content with stable dimensions, `EmptyState` for no-data/recoverable errors, `Alert` for blocking confirm/alert dialogs, and `Notification` for transient global feedback.
|
|
188
|
+
|
|
189
|
+
Use `Toggle` for one pressed state, `ToggleGroup` for a related set of pressed states, `Switch` for binary settings, `RadioGroup` for small mutually exclusive choices, and `Select` for longer option sets.
|
|
190
|
+
|
|
191
|
+
### Quick Examples
|
|
192
|
+
|
|
193
|
+
Card, badge, and CTA:
|
|
135
194
|
|
|
136
195
|
```tsx
|
|
137
196
|
import { Badge, Button, Card, CardContent, CardHeader, CardTitle } from "@mrmeg/expo-ui/components";
|
|
@@ -149,6 +208,43 @@ import { Badge, Button, Card, CardContent, CardHeader, CardTitle } from "@mrmeg/
|
|
|
149
208
|
</Card>
|
|
150
209
|
```
|
|
151
210
|
|
|
211
|
+
Form controls:
|
|
212
|
+
|
|
213
|
+
```tsx
|
|
214
|
+
import { Button, TextInput, Switch } from "@mrmeg/expo-ui/components";
|
|
215
|
+
|
|
216
|
+
<TextInput
|
|
217
|
+
label="Email"
|
|
218
|
+
placeholder="you@example.com"
|
|
219
|
+
autoCapitalize="none"
|
|
220
|
+
keyboardType="email-address"
|
|
221
|
+
errorText={emailError}
|
|
222
|
+
/>
|
|
223
|
+
|
|
224
|
+
<Switch checked={enabled} onCheckedChange={setEnabled} variant="ios" />
|
|
225
|
+
|
|
226
|
+
<Button preset="default" size="lg" fullWidth loading={isSubmitting}>
|
|
227
|
+
Continue
|
|
228
|
+
</Button>
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Feedback:
|
|
232
|
+
|
|
233
|
+
```tsx
|
|
234
|
+
import { EmptyState, Progress, SkeletonCard } from "@mrmeg/expo-ui/components";
|
|
235
|
+
import { globalUIStore } from "@mrmeg/expo-ui/state";
|
|
236
|
+
|
|
237
|
+
{isLoading ? <SkeletonCard /> : null}
|
|
238
|
+
<Progress value={65} variant="accent" />
|
|
239
|
+
<EmptyState icon="inbox" title="No messages" description="New messages will appear here." />
|
|
240
|
+
|
|
241
|
+
globalUIStore.getState().show({
|
|
242
|
+
type: "success",
|
|
243
|
+
title: "Saved",
|
|
244
|
+
messages: ["Your changes were saved."],
|
|
245
|
+
});
|
|
246
|
+
```
|
|
247
|
+
|
|
152
248
|
LLM rules:
|
|
153
249
|
|
|
154
250
|
- Prefer `StyledText` semantic variants over raw `Text`.
|
|
@@ -211,7 +307,50 @@ On native, the package uses platform sans-serif fallbacks. `useResources()` stil
|
|
|
211
307
|
|
|
212
308
|
## Package Checks
|
|
213
309
|
|
|
214
|
-
|
|
310
|
+
For a one-command release from the repo root, use:
|
|
311
|
+
|
|
312
|
+
```sh
|
|
313
|
+
bun run ui:release -- --patch --publish
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
Replace `--patch` with `--minor`, `--major`, or an exact version such as `0.2.0`.
|
|
317
|
+
The command updates `packages/ui/package.json` and `bun.lock`, runs all package
|
|
318
|
+
gates, then publishes with `npm publish --access public` only when `--publish`
|
|
319
|
+
is present. Without `--publish`, it performs the same version bump and gates as
|
|
320
|
+
a dry run.
|
|
321
|
+
|
|
322
|
+
The release command requires a clean working tree by default. Commit current
|
|
323
|
+
changes first, or pass `--allow-dirty` when you intentionally want to release
|
|
324
|
+
from uncommitted local changes.
|
|
325
|
+
|
|
326
|
+
If npm login email is unavailable, publish through GitHub Actions trusted
|
|
327
|
+
publishing instead:
|
|
328
|
+
|
|
329
|
+
1. In npm package settings for `@mrmeg/expo-ui`, add a trusted publisher:
|
|
330
|
+
GitHub Actions, owner `mrmeg`, repository `expo-template`, workflow
|
|
331
|
+
filename `publish-ui.yml`.
|
|
332
|
+
2. In GitHub Actions, run the `Publish UI Package` workflow with `version=patch`
|
|
333
|
+
and `ref=dev`.
|
|
334
|
+
|
|
335
|
+
The workflow uses npm OIDC, not a checked-in token or local npm login. It bumps
|
|
336
|
+
the package version, updates `bun.lock`, runs the package gates, lets npm CLI
|
|
337
|
+
use the GitHub Actions OIDC environment, commits the version bump, and publishes
|
|
338
|
+
from `packages/ui`.
|
|
339
|
+
|
|
340
|
+
Keep `repository.url` in `package.json` as
|
|
341
|
+
`git+https://github.com/mrmeg/expo-template.git`. npm trusted publishing checks
|
|
342
|
+
that metadata during publish, and publish-time URL normalization can block OIDC
|
|
343
|
+
auth.
|
|
344
|
+
|
|
345
|
+
If npm trusted publishing is blocked by package settings, add an npm automation
|
|
346
|
+
or granular publish token to GitHub Actions secrets as `NPM_TOKEN` and rerun the
|
|
347
|
+
same workflow. The token is used only for the publish step.
|
|
348
|
+
|
|
349
|
+
If the workflow fails after the version is already bumped, rerun it with the
|
|
350
|
+
exact current package version, for example `version=0.1.2`. Exact-version reruns
|
|
351
|
+
do not bump again.
|
|
352
|
+
|
|
353
|
+
Manual package checks:
|
|
215
354
|
|
|
216
355
|
```sh
|
|
217
356
|
bun run ui:typecheck
|
|
@@ -224,5 +363,6 @@ bun run ui:consumer-smoke
|
|
|
224
363
|
`bun run ui:pack` runs a dry pack so the published file list and package size can be inspected before release.
|
|
225
364
|
`bun run ui:consumer-smoke` installs the packed tarball into a clean fixture,
|
|
226
365
|
checks the documented export-map files, type-checks all public package
|
|
227
|
-
entrypoints,
|
|
228
|
-
|
|
366
|
+
entrypoints, verifies that `@mrmeg/expo-ui/constants` can be imported by
|
|
367
|
+
plain Node ESM for token inspection, and runs an Expo SDK 55 iOS export
|
|
368
|
+
against the packed package without a custom Metro config.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrmeg/expo-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Reusable Expo and React Native UI primitives for MrMeg projects.",
|
|
6
6
|
"keywords": [
|
|
@@ -50,10 +50,18 @@
|
|
|
50
50
|
"types": "./dist/constants/index.d.ts",
|
|
51
51
|
"default": "./dist/constants/index.js"
|
|
52
52
|
},
|
|
53
|
+
"./constants/*": {
|
|
54
|
+
"types": "./dist/constants/*.d.ts",
|
|
55
|
+
"default": "./dist/constants/*.js"
|
|
56
|
+
},
|
|
53
57
|
"./hooks": {
|
|
54
58
|
"types": "./dist/hooks/index.d.ts",
|
|
55
59
|
"default": "./dist/hooks/index.js"
|
|
56
60
|
},
|
|
61
|
+
"./hooks/*": {
|
|
62
|
+
"types": "./dist/hooks/*.d.ts",
|
|
63
|
+
"default": "./dist/hooks/*.js"
|
|
64
|
+
},
|
|
57
65
|
"./state": {
|
|
58
66
|
"types": "./dist/state/index.d.ts",
|
|
59
67
|
"default": "./dist/state/index.js"
|
|
@@ -94,11 +102,14 @@
|
|
|
94
102
|
"expo": "~55.0.0",
|
|
95
103
|
"expo-font": "~55.0.0",
|
|
96
104
|
"expo-haptics": "~55.0.0",
|
|
105
|
+
"i18next": ">=25.0.0 <27.0.0",
|
|
97
106
|
"react": ">=19.2.0 <20.0.0",
|
|
107
|
+
"react-i18next": ">=15.0.0 <18.0.0",
|
|
98
108
|
"react-native": ">=0.83.0 <0.84.0",
|
|
99
109
|
"react-native-gesture-handler": "~2.30.0",
|
|
100
110
|
"react-native-reanimated": "~4.2.0",
|
|
101
111
|
"react-native-safe-area-context": "~5.6.0",
|
|
112
|
+
"react-native-screens": "~4.23.0",
|
|
102
113
|
"react-native-web": ">=0.21.0 <0.22.0",
|
|
103
114
|
"react-native-worklets": "~0.7.0",
|
|
104
115
|
"zustand": ">=5.0.0 <6.0.0"
|