@mrmeg/expo-ui 0.13.0 → 0.15.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/CHANGELOG.md +34 -0
- package/LLM_USAGE.md +4 -0
- package/README.md +13 -9
- package/dist/components/Accordion.d.ts +1 -1
- package/dist/components/Accordion.js +25 -19
- package/dist/components/Badge.js +6 -5
- package/dist/components/BottomSheet.js +21 -19
- package/dist/components/Button.d.ts +2 -1
- package/dist/components/Button.js +14 -4
- package/dist/components/Checkbox.js +49 -19
- package/dist/components/Collapsible.d.ts +1 -1
- package/dist/components/Collapsible.js +22 -16
- package/dist/components/Drawer.js +8 -7
- package/dist/components/DropdownMenu.d.ts +1 -1
- package/dist/components/DropdownMenu.js +80 -59
- package/dist/components/EmptyState.d.ts +7 -1
- package/dist/components/EmptyState.js +23 -7
- package/dist/components/InputOTP.js +6 -2
- package/dist/components/Item.d.ts +93 -0
- package/dist/components/Item.js +125 -0
- package/dist/components/Label.js +7 -2
- package/dist/components/Notification.js +10 -22
- package/dist/components/Popover.d.ts +3 -18
- package/dist/components/Popover.js +10 -6
- package/dist/components/RadioGroup.js +49 -22
- package/dist/components/SectionHeader.d.ts +42 -0
- package/dist/components/SectionHeader.js +41 -0
- package/dist/components/Select.js +73 -41
- package/dist/components/Skeleton.js +2 -2
- package/dist/components/StatCard.d.ts +45 -0
- package/dist/components/StatCard.js +41 -0
- package/dist/components/StyledText.d.ts +20 -10
- package/dist/components/StyledText.js +64 -25
- package/dist/components/Switch.js +84 -57
- package/dist/components/Tabs.js +43 -12
- package/dist/components/TextInput.js +8 -9
- package/dist/components/Toggle.js +69 -42
- package/dist/components/ToggleGroup.js +82 -55
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +3 -0
- package/dist/constants/fonts.d.ts +3 -0
- package/dist/constants/fonts.js +35 -12
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +1 -0
- package/dist/constants/motion.d.ts +24 -0
- package/dist/constants/motion.js +24 -0
- package/dist/constants/spacing.d.ts +7 -7
- package/dist/constants/spacing.js +7 -7
- package/dist/hooks/useResources.d.ts +4 -2
- package/dist/hooks/useResources.js +30 -8
- package/dist/hooks/useStaggeredEntrance.d.ts +1 -1
- package/dist/hooks/useStaggeredEntrance.js +2 -1
- package/dist/hooks/useTheme.d.ts +1 -1
- package/dist/hooks/useTheme.js +53 -16
- package/package.json +24 -24
package/dist/hooks/useTheme.js
CHANGED
|
@@ -42,7 +42,7 @@ function getCachedOrCompute(key, compute) {
|
|
|
42
42
|
* - getTextColorForBackground("#000") → "light"
|
|
43
43
|
* - getContrastingColor("#f4f4f4", "#222", "#fff") → "#222"
|
|
44
44
|
* - withAlpha("#336699", 0.6) → "rgba(51,102,153,0.6)"
|
|
45
|
-
* - getShadowStyle('base') → { boxShadow: "0px
|
|
45
|
+
* - getShadowStyle('base') → { boxShadow: "0px 2px 6px rgba(0, 0, 0, 0.05), 0px 4px 12px rgba(0, 0, 0, 0.03)" }
|
|
46
46
|
*/
|
|
47
47
|
export function useTheme() {
|
|
48
48
|
const userTheme = useThemeStore((s) => s.userTheme);
|
|
@@ -100,29 +100,66 @@ export function useTheme() {
|
|
|
100
100
|
* `boxShadow` has no separate opacity field, each preset's opacity is folded
|
|
101
101
|
* into the color's alpha via `withAlpha`. `elevation` is dropped — `boxShadow`
|
|
102
102
|
* renders shadows on Android in 0.85+.
|
|
103
|
+
*
|
|
104
|
+
* Every preset (except `sharp` and `glow`, which are deliberately
|
|
105
|
+
* single-layer) is a dual-layer shadow: a tight "contact" layer plus a
|
|
106
|
+
* wider, softer "ambient" layer, pitsi-ui-style. Layers are comma-joined
|
|
107
|
+
* into one `boxShadow` value.
|
|
103
108
|
*/
|
|
104
109
|
const getShadowStyle = useCallback((type) => {
|
|
105
|
-
// Each preset
|
|
110
|
+
// Each preset is one or more layers of [offsetX, offsetY, blurRadius, color, opacity].
|
|
106
111
|
// Darker themes get a stronger alpha so shadows stay visible.
|
|
107
112
|
const boost = theme.dark ? 3 : 1;
|
|
108
113
|
const overlay = theme.colors.overlay;
|
|
109
114
|
const shadowConfigs = {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
subtle: [
|
|
116
|
+
{ x: 0, y: 1, blur: 3, color: overlay, opacity: 0.04 },
|
|
117
|
+
{ x: 0, y: 2, blur: 8, color: overlay, opacity: 0.03 },
|
|
118
|
+
],
|
|
119
|
+
base: [
|
|
120
|
+
{ x: 0, y: 2, blur: 6, color: overlay, opacity: 0.05 },
|
|
121
|
+
{ x: 0, y: 4, blur: 12, color: overlay, opacity: 0.03 },
|
|
122
|
+
],
|
|
123
|
+
soft: [
|
|
124
|
+
{ x: 0, y: 4, blur: 10, color: overlay, opacity: 0.05 },
|
|
125
|
+
{ x: 0, y: 8, blur: 20, color: overlay, opacity: 0.03 },
|
|
126
|
+
],
|
|
127
|
+
card: [
|
|
128
|
+
{ x: 0, y: 4, blur: 12, color: overlay, opacity: 0.05 },
|
|
129
|
+
{ x: 0, y: 8, blur: 24, color: overlay, opacity: 0.03 },
|
|
130
|
+
],
|
|
131
|
+
cardSubtle: [
|
|
132
|
+
{ x: 0, y: 1, blur: 3, color: overlay, opacity: 0.05 },
|
|
133
|
+
{ x: 0, y: 3, blur: 9, color: overlay, opacity: 0.03 },
|
|
134
|
+
],
|
|
135
|
+
cardHover: [
|
|
136
|
+
{ x: 0, y: 8, blur: 24, color: overlay, opacity: 0.06 },
|
|
137
|
+
{ x: 0, y: 16, blur: 48, color: overlay, opacity: 0.04 },
|
|
138
|
+
],
|
|
139
|
+
elevated: [
|
|
140
|
+
{ x: 0, y: 16, blur: 48, color: overlay, opacity: 0.08 },
|
|
141
|
+
{ x: 0, y: 32, blur: 96, color: overlay, opacity: 0.05 },
|
|
142
|
+
],
|
|
143
|
+
glass: [
|
|
144
|
+
{ x: 0, y: 4, blur: 30, color: overlay, opacity: 0.05 },
|
|
145
|
+
{ x: 0, y: 8, blur: 60, color: overlay, opacity: 0.03 },
|
|
146
|
+
],
|
|
147
|
+
// Single layer — intentional crispness, not a soft dual-layer shadow.
|
|
148
|
+
sharp: [
|
|
149
|
+
{ x: 0, y: 1, blur: 1, color: overlay, opacity: 0.15 },
|
|
150
|
+
],
|
|
151
|
+
// Single layer — already a deliberate, vivid accent glow.
|
|
152
|
+
glow: [
|
|
153
|
+
{ x: 0, y: 4, blur: 20, color: theme.colors.primary, opacity: 0.4 },
|
|
154
|
+
],
|
|
120
155
|
};
|
|
121
|
-
const { x, y, blur, color, opacity }
|
|
122
|
-
|
|
123
|
-
|
|
156
|
+
const layers = shadowConfigs[type].map(({ x, y, blur, color, opacity }) => {
|
|
157
|
+
// Don't boost the glow accent — it's already a deliberate, vivid alpha.
|
|
158
|
+
const alpha = color === theme.colors.primary ? opacity : Math.min(opacity * boost, 1);
|
|
159
|
+
return `${x}px ${y}px ${blur}px ${withAlpha(color, alpha)}`;
|
|
160
|
+
});
|
|
124
161
|
return {
|
|
125
|
-
boxShadow:
|
|
162
|
+
boxShadow: layers.join(", "),
|
|
126
163
|
};
|
|
127
164
|
}, [theme]);
|
|
128
165
|
const getFocusRingStyle = useCallback((offset = 2) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrmeg/expo-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Reusable Expo and React Native UI primitives for MrMeg projects.",
|
|
6
6
|
"keywords": [
|
|
@@ -88,34 +88,35 @@
|
|
|
88
88
|
"publish:dry-run": "bun pm pack --dry-run"
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
+
"@expo-google-fonts/inter": "^0.4.2",
|
|
91
92
|
"@expo/vector-icons": ">=15.0.0 <16.0.0",
|
|
92
|
-
"@rn-primitives/accordion": "~1.
|
|
93
|
-
"@rn-primitives/alert-dialog": "~1.
|
|
94
|
-
"@rn-primitives/checkbox": "~1.
|
|
95
|
-
"@rn-primitives/collapsible": "~1.
|
|
96
|
-
"@rn-primitives/dialog": "~1.
|
|
97
|
-
"@rn-primitives/dropdown-menu": "~1.
|
|
98
|
-
"@rn-primitives/label": "~1.
|
|
99
|
-
"@rn-primitives/popover": "~1.
|
|
100
|
-
"@rn-primitives/portal": "~1.
|
|
101
|
-
"@rn-primitives/radio-group": "~1.
|
|
102
|
-
"@rn-primitives/select": "~1.
|
|
103
|
-
"@rn-primitives/separator": "~1.
|
|
104
|
-
"@rn-primitives/slot": "~1.
|
|
105
|
-
"@rn-primitives/switch": "~1.
|
|
106
|
-
"@rn-primitives/tabs": "~1.
|
|
107
|
-
"@rn-primitives/toggle": "~1.
|
|
108
|
-
"@rn-primitives/toggle-group": "~1.
|
|
109
|
-
"@rn-primitives/tooltip": "~1.
|
|
93
|
+
"@rn-primitives/accordion": "~1.5.2",
|
|
94
|
+
"@rn-primitives/alert-dialog": "~1.5.2",
|
|
95
|
+
"@rn-primitives/checkbox": "~1.5.2",
|
|
96
|
+
"@rn-primitives/collapsible": "~1.5.2",
|
|
97
|
+
"@rn-primitives/dialog": "~1.5.2",
|
|
98
|
+
"@rn-primitives/dropdown-menu": "~1.5.2",
|
|
99
|
+
"@rn-primitives/label": "~1.5.2",
|
|
100
|
+
"@rn-primitives/popover": "~1.5.2",
|
|
101
|
+
"@rn-primitives/portal": "~1.5.2",
|
|
102
|
+
"@rn-primitives/radio-group": "~1.5.2",
|
|
103
|
+
"@rn-primitives/select": "~1.5.2",
|
|
104
|
+
"@rn-primitives/separator": "~1.5.2",
|
|
105
|
+
"@rn-primitives/slot": "~1.5.2",
|
|
106
|
+
"@rn-primitives/switch": "~1.5.2",
|
|
107
|
+
"@rn-primitives/tabs": "~1.5.2",
|
|
108
|
+
"@rn-primitives/toggle": "~1.5.2",
|
|
109
|
+
"@rn-primitives/toggle-group": "~1.5.2",
|
|
110
|
+
"@rn-primitives/tooltip": "~1.5.2"
|
|
110
111
|
},
|
|
111
112
|
"peerDependencies": {
|
|
112
113
|
"@expo/ui": ">=56.0.0 <58.0.0",
|
|
113
114
|
"@react-native-async-storage/async-storage": ">=2.2.0 <2.3.0",
|
|
114
|
-
"expo": ">=
|
|
115
|
-
"expo-font": ">=
|
|
116
|
-
"expo-haptics": ">=
|
|
115
|
+
"expo": ">=56.0.0 <58.0.0",
|
|
116
|
+
"expo-font": ">=56.0.0 <58.0.0",
|
|
117
|
+
"expo-haptics": ">=56.0.0 <58.0.0",
|
|
117
118
|
"react": ">=19.2.0 <20.0.0",
|
|
118
|
-
"react-native": ">=0.
|
|
119
|
+
"react-native": ">=0.85.0 <0.87.0",
|
|
119
120
|
"react-native-gesture-handler": ">=2.30.0 <2.33.0",
|
|
120
121
|
"react-native-keyboard-controller": ">=1.21.0 <2.0.0",
|
|
121
122
|
"react-native-safe-area-context": ">=5.6.0 <6.0.0",
|
|
@@ -125,7 +126,6 @@
|
|
|
125
126
|
},
|
|
126
127
|
"devDependencies": {
|
|
127
128
|
"@types/react": "~19.2.17",
|
|
128
|
-
"react-native-keyboard-controller": "1.21.9",
|
|
129
129
|
"typescript": "~6.0.3"
|
|
130
130
|
}
|
|
131
131
|
}
|