@rific/auto-paper 0.6.2 → 0.6.4
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 +3 -3
- package/dist/index.d.mts +13 -4
- package/dist/index.d.ts +13 -4
- package/package.json +4 -4
- package/src/components/BlurView.tsx +27 -4
- package/src/navigation-bar.ts +10 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Adaptive theming for [`react-native-paper`](https://callstack.github.io/react-na
|
|
|
8
8
|
- System/light/dark appearance with live updates via `Appearance` API
|
|
9
9
|
- Tinted surface, surfaceVariant, outline, and elevation levels derived from the seed
|
|
10
10
|
- Optional Redux slice for wiring appearance and color into your store
|
|
11
|
-
- Wrapper components (`Appbar`, `BottomNavigation`, `Button`, `Chip`, `FAB`, `IconButton`, `TextInput`) with prop defaults via context
|
|
11
|
+
- Wrapper components (`Appbar`, `AppearancePicker`, `BlurView`, `BottomNavigation`, `Button`, `Chip`, `ColorPicker`, `Dialog`, `FAB`, `HarmonyPicker`, `IconButton`, `Menu`, `TextInput`) with prop defaults via context
|
|
12
12
|
- All color utilities exported for standalone use
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
@@ -111,7 +111,7 @@ import { Button, Chip, Provider as AutoPaperProvider } from '@rific/auto-paper'
|
|
|
111
111
|
</AutoPaperProvider>
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
-
Available wrapper components: `Appbar`, `BottomNavigation`, `Button`, `Chip`, `FAB`, `IconButton`, `TextInput`. Each is a thin wrapper around the matching `react-native-paper` component and accepts the same props.
|
|
114
|
+
Available wrapper components: `Appbar`, `AppearancePicker`, `BlurView`, `BottomNavigation`, `Button`, `Chip`, `ColorPicker`, `Dialog`, `FAB`, `HarmonyPicker`, `IconButton`, `Menu`, `TextInput`. Each is a thin wrapper around the matching `react-native-paper` component and accepts the same props.
|
|
115
115
|
|
|
116
116
|
### With Redux
|
|
117
117
|
|
|
@@ -365,7 +365,7 @@ const appearance = useSelector((state: RootState) => selectThemeAppearance(state
|
|
|
365
365
|
### Color utilities
|
|
366
366
|
|
|
367
367
|
```ts
|
|
368
|
-
import { getTriadicPalette, getBlendedColor, isDarkColor, getRgb, getHex } from '@rific/auto-paper'
|
|
368
|
+
import { getTriadicPalette, getBlendedColor, isDarkColor, getRgb, getHex, getTonalColor, getTintTextColor } from '@rific/auto-paper'
|
|
369
369
|
import type { ColorHarmony } from '@rific/auto-paper'
|
|
370
370
|
|
|
371
371
|
getTriadicPalette('#6750a4') // split-complementary (default)
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as react_native_paper_lib_typescript_utils_forwardRef from 'react-native-paper/lib/typescript/utils/forwardRef';
|
|
2
2
|
import * as react_native from 'react-native';
|
|
3
|
-
import { StyleProp, ViewStyle, TextInput as TextInput$1, StatusBarProps } from 'react-native';
|
|
3
|
+
import { View, ViewProps, StyleProp, ViewStyle, TextInput as TextInput$1, StatusBarProps } from 'react-native';
|
|
4
4
|
import * as react_native_paper from 'react-native-paper';
|
|
5
5
|
import { AppbarHeaderProps, MD3Theme, BottomNavigationRoute, BottomNavigationProps, BottomNavigation as BottomNavigation$1, ButtonProps, ChipProps as ChipProps$1, DialogProps as DialogProps$1, DialogTitleProps, DialogContentProps, DialogActionsProps, DialogScrollAreaProps, FABProps, IconButtonProps as IconButtonProps$1, MenuProps as MenuProps$1, MenuItemProps, TextInputProps } from 'react-native-paper';
|
|
6
6
|
export { AppbarHeaderProps, BottomNavigationProps, BottomNavigationRoute, ButtonProps, FABProps, ChipProps as PaperChipProps, DialogProps as PaperDialogProps, IconButtonProps as PaperIconButtonProps, MenuProps as PaperMenuProps, TextInputProps } from 'react-native-paper';
|
|
7
7
|
import * as react from 'react';
|
|
8
|
-
import react__default, { ReactNode } from 'react';
|
|
9
|
-
import { BlurViewProps as BlurViewProps$1 } from 'expo-blur';
|
|
8
|
+
import react__default, { RefObject, ReactNode } from 'react';
|
|
10
9
|
|
|
11
10
|
declare function useBlur(override?: boolean): boolean;
|
|
12
11
|
|
|
@@ -38,7 +37,17 @@ type Props$2 = {
|
|
|
38
37
|
};
|
|
39
38
|
declare const AppearancePicker: ({ value, onChange }: Props$2) => react.JSX.Element;
|
|
40
39
|
|
|
41
|
-
type
|
|
40
|
+
type ExpoBlurTint = 'light' | 'dark' | 'default' | 'extraLight' | 'regular' | 'prominent' | 'systemUltraThinMaterial' | 'systemThinMaterial' | 'systemMaterial' | 'systemThickMaterial' | 'systemChromeMaterial' | 'systemUltraThinMaterialLight' | 'systemThinMaterialLight' | 'systemMaterialLight' | 'systemThickMaterialLight' | 'systemChromeMaterialLight' | 'systemUltraThinMaterialDark' | 'systemThinMaterialDark' | 'systemMaterialDark' | 'systemThickMaterialDark' | 'systemChromeMaterialDark';
|
|
41
|
+
type ExpoBlurMethod = 'none' | 'dimezisBlurView' | 'dimezisBlurViewSdk31Plus';
|
|
42
|
+
type ExpoBlurViewProps = {
|
|
43
|
+
blurMethod?: ExpoBlurMethod;
|
|
44
|
+
blurReductionFactor?: number;
|
|
45
|
+
blurTarget?: RefObject<View | null>;
|
|
46
|
+
experimentalBlurMethod?: ExpoBlurMethod;
|
|
47
|
+
intensity?: number;
|
|
48
|
+
tint?: ExpoBlurTint;
|
|
49
|
+
} & ViewProps;
|
|
50
|
+
type BlurViewProps = ExpoBlurViewProps & {
|
|
42
51
|
blur?: boolean;
|
|
43
52
|
children?: ReactNode;
|
|
44
53
|
elevation?: 0 | 1 | 2 | 3 | 4 | 5;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as react_native_paper_lib_typescript_utils_forwardRef from 'react-native-paper/lib/typescript/utils/forwardRef';
|
|
2
2
|
import * as react_native from 'react-native';
|
|
3
|
-
import { StyleProp, ViewStyle, TextInput as TextInput$1, StatusBarProps } from 'react-native';
|
|
3
|
+
import { View, ViewProps, StyleProp, ViewStyle, TextInput as TextInput$1, StatusBarProps } from 'react-native';
|
|
4
4
|
import * as react_native_paper from 'react-native-paper';
|
|
5
5
|
import { AppbarHeaderProps, MD3Theme, BottomNavigationRoute, BottomNavigationProps, BottomNavigation as BottomNavigation$1, ButtonProps, ChipProps as ChipProps$1, DialogProps as DialogProps$1, DialogTitleProps, DialogContentProps, DialogActionsProps, DialogScrollAreaProps, FABProps, IconButtonProps as IconButtonProps$1, MenuProps as MenuProps$1, MenuItemProps, TextInputProps } from 'react-native-paper';
|
|
6
6
|
export { AppbarHeaderProps, BottomNavigationProps, BottomNavigationRoute, ButtonProps, FABProps, ChipProps as PaperChipProps, DialogProps as PaperDialogProps, IconButtonProps as PaperIconButtonProps, MenuProps as PaperMenuProps, TextInputProps } from 'react-native-paper';
|
|
7
7
|
import * as react from 'react';
|
|
8
|
-
import react__default, { ReactNode } from 'react';
|
|
9
|
-
import { BlurViewProps as BlurViewProps$1 } from 'expo-blur';
|
|
8
|
+
import react__default, { RefObject, ReactNode } from 'react';
|
|
10
9
|
|
|
11
10
|
declare function useBlur(override?: boolean): boolean;
|
|
12
11
|
|
|
@@ -38,7 +37,17 @@ type Props$2 = {
|
|
|
38
37
|
};
|
|
39
38
|
declare const AppearancePicker: ({ value, onChange }: Props$2) => react.JSX.Element;
|
|
40
39
|
|
|
41
|
-
type
|
|
40
|
+
type ExpoBlurTint = 'light' | 'dark' | 'default' | 'extraLight' | 'regular' | 'prominent' | 'systemUltraThinMaterial' | 'systemThinMaterial' | 'systemMaterial' | 'systemThickMaterial' | 'systemChromeMaterial' | 'systemUltraThinMaterialLight' | 'systemThinMaterialLight' | 'systemMaterialLight' | 'systemThickMaterialLight' | 'systemChromeMaterialLight' | 'systemUltraThinMaterialDark' | 'systemThinMaterialDark' | 'systemMaterialDark' | 'systemThickMaterialDark' | 'systemChromeMaterialDark';
|
|
41
|
+
type ExpoBlurMethod = 'none' | 'dimezisBlurView' | 'dimezisBlurViewSdk31Plus';
|
|
42
|
+
type ExpoBlurViewProps = {
|
|
43
|
+
blurMethod?: ExpoBlurMethod;
|
|
44
|
+
blurReductionFactor?: number;
|
|
45
|
+
blurTarget?: RefObject<View | null>;
|
|
46
|
+
experimentalBlurMethod?: ExpoBlurMethod;
|
|
47
|
+
intensity?: number;
|
|
48
|
+
tint?: ExpoBlurTint;
|
|
49
|
+
} & ViewProps;
|
|
50
|
+
type BlurViewProps = ExpoBlurViewProps & {
|
|
42
51
|
blur?: boolean;
|
|
43
52
|
children?: ReactNode;
|
|
44
53
|
elevation?: 0 | 1 | 2 | 3 | 4 | 5;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rific/auto-paper",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"description": "Adaptive react-native-paper theming: triadic palette from a seed color + system/light/dark appearance",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"type": "commonjs",
|
|
32
32
|
"exports": {
|
|
33
33
|
".": {
|
|
34
|
-
"react-native": "./
|
|
34
|
+
"react-native": "./dist/index.js",
|
|
35
35
|
"types": "./dist/index.d.ts",
|
|
36
36
|
"import": "./dist/index.js",
|
|
37
37
|
"require": "./dist/index.js"
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
],
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
|
|
51
|
+
"build:watch": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
51
52
|
"fix": "eslint --fix",
|
|
52
53
|
"lint": "eslint",
|
|
53
54
|
"prepublishOnly": "npm run build",
|
|
@@ -69,7 +70,6 @@
|
|
|
69
70
|
"@testing-library/react": "^16.0.0",
|
|
70
71
|
"@types/jest": "^30.0.0",
|
|
71
72
|
"@types/react": "^19.0.0",
|
|
72
|
-
"@types/react-native": "^0.73.0",
|
|
73
73
|
"@typescript-eslint/parser": "^8.59.3",
|
|
74
74
|
"eslint": "^9.39.4",
|
|
75
75
|
"eslint-config-prettier": "^10.1.8",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"ts-jest": "^29.4.9",
|
|
90
90
|
"ts-node": "^10.9.2",
|
|
91
91
|
"tsup": "^8.0.0",
|
|
92
|
-
"typescript": "^
|
|
92
|
+
"typescript": "^6.0.3",
|
|
93
93
|
"typescript-eslint": "^8.59.3"
|
|
94
94
|
},
|
|
95
95
|
"peerDependencies": {
|
|
@@ -1,14 +1,37 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { type
|
|
3
|
-
import { type StyleProp, StyleSheet, View, type ViewStyle } from 'react-native'
|
|
1
|
+
import { type ComponentType, type ReactNode, type RefObject, useContext } from 'react'
|
|
2
|
+
import { type StyleProp, StyleSheet, View, type ViewProps, type ViewStyle } from 'react-native'
|
|
4
3
|
import { useTheme } from 'react-native-paper'
|
|
5
4
|
|
|
6
5
|
import { ThemeSettingsContext } from '../ThemeSettingsContext'
|
|
7
6
|
|
|
7
|
+
// Minimal local shape of expo-blur covering only the member used below — avoids forcing
|
|
8
|
+
// TypeScript to resolve the optional peer's real types for consumers who never installed it.
|
|
9
|
+
interface ExpoBlurModule {
|
|
10
|
+
BlurView: ComponentType<{
|
|
11
|
+
children?: ReactNode
|
|
12
|
+
style?: StyleProp<ViewStyle>
|
|
13
|
+
tint?: string
|
|
14
|
+
[key: string]: unknown
|
|
15
|
+
}>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Local mirror of expo-blur's public BlurViewProps (node_modules/expo-blur/build/BlurView.types.d.ts)
|
|
19
|
+
// — same reason as ExpoBlurModule above: the peer's real type must never be imported unconditionally.
|
|
20
|
+
type ExpoBlurTint = 'light' | 'dark' | 'default' | 'extraLight' | 'regular' | 'prominent' | 'systemUltraThinMaterial' | 'systemThinMaterial' | 'systemMaterial' | 'systemThickMaterial' | 'systemChromeMaterial' | 'systemUltraThinMaterialLight' | 'systemThinMaterialLight' | 'systemMaterialLight' | 'systemThickMaterialLight' | 'systemChromeMaterialLight' | 'systemUltraThinMaterialDark' | 'systemThinMaterialDark' | 'systemMaterialDark' | 'systemThickMaterialDark' | 'systemChromeMaterialDark'
|
|
21
|
+
type ExpoBlurMethod = 'none' | 'dimezisBlurView' | 'dimezisBlurViewSdk31Plus'
|
|
22
|
+
type ExpoBlurViewProps = {
|
|
23
|
+
blurMethod?: ExpoBlurMethod
|
|
24
|
+
blurReductionFactor?: number
|
|
25
|
+
blurTarget?: RefObject<View | null>
|
|
26
|
+
experimentalBlurMethod?: ExpoBlurMethod
|
|
27
|
+
intensity?: number
|
|
28
|
+
tint?: ExpoBlurTint
|
|
29
|
+
} & ViewProps
|
|
30
|
+
|
|
8
31
|
// expo-blur is an optional peer — when absent, BlurView renders its solid (non-blur) fallback
|
|
9
32
|
const ExpoBlurView = (() => {
|
|
10
33
|
try {
|
|
11
|
-
return (require('expo-blur') as
|
|
34
|
+
return (require('expo-blur') as ExpoBlurModule).BlurView
|
|
12
35
|
} catch {
|
|
13
36
|
return null
|
|
14
37
|
}
|
package/src/navigation-bar.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
+
// Minimal local shape of expo-navigation-bar covering only the members used below —
|
|
2
|
+
// avoids forcing TypeScript to resolve the optional peer's real types for consumers
|
|
3
|
+
// who never installed it.
|
|
4
|
+
interface ExpoNavigationBarModule {
|
|
5
|
+
NavigationBar: {
|
|
6
|
+
setStyle: (style: 'light' | 'dark') => void
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
1
10
|
export const navigationBar = (() => {
|
|
2
11
|
try {
|
|
3
|
-
return require('expo-navigation-bar') as
|
|
12
|
+
return require('expo-navigation-bar') as ExpoNavigationBarModule
|
|
4
13
|
} catch {
|
|
5
14
|
return null
|
|
6
15
|
}
|