@muja-ui/native 0.3.1 → 0.4.0
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 +44 -10
- package/dist/index.cjs +467 -137
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +110 -18
- package/dist/index.d.ts +110 -18
- package/dist/index.js +465 -140
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -46,20 +46,54 @@ Both packages take the same props for the same concepts (`variant`, `size`,
|
|
|
46
46
|
`bg`, `radius`, `shadow`, `w`, `h`, …). The differences are all forced by the
|
|
47
47
|
platform:
|
|
48
48
|
|
|
49
|
-
|
|
|
50
|
-
|
|
51
|
-
| Styling
|
|
52
|
-
| Entry points
|
|
53
|
-
| Change handlers | DOM events (`onChange(event)`) | value callbacks (`onChange(nextValue)`)
|
|
54
|
-
| `Select`
|
|
55
|
-
| Anchored menus
|
|
56
|
-
| `Table`
|
|
57
|
-
| Tooltip
|
|
58
|
-
| `Tabs`
|
|
49
|
+
| | Web | Native |
|
|
50
|
+
| --------------- | ------------------------------ | ----------------------------------------------------------------------- |
|
|
51
|
+
| Styling | `mj-*` classes + `var(--mj-*)` | `useTheme()` resolves tokens to a `StyleSheet` object |
|
|
52
|
+
| Entry points | `.` (RSC-safe) + `./client` | one entry — there are no Server Components |
|
|
53
|
+
| Change handlers | DOM events (`onChange(event)`) | value callbacks (`onChange(nextValue)`) |
|
|
54
|
+
| `Select` | `<option>` children | an `options` array |
|
|
55
|
+
| Anchored menus | `DropdownMenu`, `Popover` | `ActionSheet` — a dropdown anchored to a tap target is wrong on a phone |
|
|
56
|
+
| `Table` | semantic `<table>` | not provided; use `ListRow` or a `FlatList` |
|
|
57
|
+
| Tooltip | hover | long-press, and the label doubles as the accessibility hint |
|
|
58
|
+
| `Tabs` | `TabList` / `Tab` / `TabPanel` | an `items` array; the screen renders the panel for the active value |
|
|
59
59
|
|
|
60
60
|
Native-only additions, for things every screen needs: `Screen` (safe-area page
|
|
61
61
|
shell with pull-to-refresh), `ListRow`, `EmptyState`, `FormField`, `HStack`.
|
|
62
62
|
|
|
63
|
+
## iOS follows the Human Interface Guidelines
|
|
64
|
+
|
|
65
|
+
The same component renders as a native iOS control on iOS and as the shared
|
|
66
|
+
design elsewhere. Nothing in the API changes; `Platform.OS` picks the branch.
|
|
67
|
+
|
|
68
|
+
| | iOS | Android |
|
|
69
|
+
| ----------------------------- | ----------------------------------------------------------------------------------- | -------------------------------------- |
|
|
70
|
+
| Type scale | Dynamic Type sizes: `xs` 13, `sm` 15, `md` 17, `lg` 20, `xl` 22, `2xl` 28, `3xl` 34 | shared tokens (`md` 16) |
|
|
71
|
+
| Radii | UIKit: `md` 10, `lg` 12, `xl` 14, `2xl` 20 | shared tokens |
|
|
72
|
+
| Font | SF Pro (system) unless the theme names a loaded face | Roboto (system) |
|
|
73
|
+
| `Button` `outline` / `ghost` | tinted / plain (UIKit configurations); press dims | stroked / transparent; press recolours |
|
|
74
|
+
| `Switch` | `UISwitch`, tinted with `primary` | drawn from primitives |
|
|
75
|
+
| `Checkbox` | round (Reminders idiom) | square |
|
|
76
|
+
| `Input`, `Textarea`, `Select` | filled, borderless; stroke on focus/error; native clear button | outlined on a surface |
|
|
77
|
+
| `Tabs variant="segmented"` | `UISegmentedControl` look | pill switch |
|
|
78
|
+
| `ActionSheet` | `UIAlertController` action sheet: inset cards, centred tint labels, separate Cancel | list in a `BottomSheet` |
|
|
79
|
+
| `Card` `outline` | hairline | 1pt border |
|
|
80
|
+
| `ListRow` | 44pt table cell | 56pt list item |
|
|
81
|
+
|
|
82
|
+
The metrics are applied by `ThemeProvider` through `adaptThemeToPlatform()`
|
|
83
|
+
(the override itself is exported as `iosThemeOverride`), so `useTheme()` in
|
|
84
|
+
your own screens sees iOS values too — `theme.typography.fontSize.md` is 17 on
|
|
85
|
+
an iPhone. Pass `platformAdaptive={false}` to render the shared tokens
|
|
86
|
+
verbatim everywhere. Colors are never adapted: brand and dark mode stay the
|
|
87
|
+
theme's business.
|
|
88
|
+
|
|
89
|
+
Two helpers are exported for app-built controls:
|
|
90
|
+
|
|
91
|
+
- `nativeFontFamily(stack)` reduces a theme font stack to the one family React
|
|
92
|
+
Native can load (`undefined` means the system font).
|
|
93
|
+
- `pressFeedback(pressed, variantColors(variant, theme))` returns the
|
|
94
|
+
background/opacity a button-like pressable should show — dimming on iOS,
|
|
95
|
+
recolouring on Android.
|
|
96
|
+
|
|
63
97
|
## Components
|
|
64
98
|
|
|
65
99
|
**Primitives** — `Box`, `Flex`, `Stack`, `HStack`, `Spacer`, `Divider`, `Text`,
|