@rific/auto-paper 0.6.1 → 0.6.3
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/dist/index.d.mts +13 -4
- package/dist/index.d.ts +13 -4
- package/dist/index.js +4 -2
- package/dist/index.mjs +4 -2
- package/package.json +11 -11
- package/src/components/BlurView.tsx +27 -4
- package/src/components/Dialog.tsx +4 -2
- package/src/navigation-bar.ts +10 -1
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/dist/index.js
CHANGED
|
@@ -711,7 +711,7 @@ function DialogComponent({ blur: blurProp, visible, onDismiss, children, style,
|
|
|
711
711
|
}
|
|
712
712
|
}, [visible]);
|
|
713
713
|
if (!blur) {
|
|
714
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native_paper9.Dialog, { visible, onDismiss, style, ...rest, children });
|
|
714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native_paper9.Dialog, { visible, onDismiss, style: [styles2.sized, style], ...rest, children });
|
|
715
715
|
}
|
|
716
716
|
if (!mounted) return null;
|
|
717
717
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native_paper9.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_native6.Animated.View, { style: [import_react_native6.StyleSheet.absoluteFill, { opacity }], pointerEvents: visible ? "box-none" : "none", children: [
|
|
@@ -725,7 +725,9 @@ DialogComponent.Actions = import_react_native_paper9.Dialog.Actions;
|
|
|
725
725
|
DialogComponent.ScrollArea = import_react_native_paper9.Dialog.ScrollArea;
|
|
726
726
|
var Dialog = DialogComponent;
|
|
727
727
|
var styles2 = import_react_native6.StyleSheet.create({
|
|
728
|
-
card
|
|
728
|
+
// Width cap keeps dialogs card-sized on wide viewports (web/tablet); no effect on phones.
|
|
729
|
+
card: { alignSelf: "center", maxWidth: 400, overflow: "hidden", width: "100%" },
|
|
730
|
+
sized: { alignSelf: "center", maxWidth: 400, width: "100%" },
|
|
729
731
|
wrapper: { flex: 1, justifyContent: "center", paddingHorizontal: 26 }
|
|
730
732
|
});
|
|
731
733
|
|
package/dist/index.mjs
CHANGED
|
@@ -658,7 +658,7 @@ function DialogComponent({ blur: blurProp, visible, onDismiss, children, style,
|
|
|
658
658
|
}
|
|
659
659
|
}, [visible]);
|
|
660
660
|
if (!blur) {
|
|
661
|
-
return /* @__PURE__ */ jsx8(PaperDialog, { visible, onDismiss, style, ...rest, children });
|
|
661
|
+
return /* @__PURE__ */ jsx8(PaperDialog, { visible, onDismiss, style: [styles2.sized, style], ...rest, children });
|
|
662
662
|
}
|
|
663
663
|
if (!mounted) return null;
|
|
664
664
|
return /* @__PURE__ */ jsx8(Portal, { children: /* @__PURE__ */ jsxs4(Animated.View, { style: [StyleSheet3.absoluteFill, { opacity }], pointerEvents: visible ? "box-none" : "none", children: [
|
|
@@ -672,7 +672,9 @@ DialogComponent.Actions = PaperDialog.Actions;
|
|
|
672
672
|
DialogComponent.ScrollArea = PaperDialog.ScrollArea;
|
|
673
673
|
var Dialog = DialogComponent;
|
|
674
674
|
var styles2 = StyleSheet3.create({
|
|
675
|
-
card
|
|
675
|
+
// Width cap keeps dialogs card-sized on wide viewports (web/tablet); no effect on phones.
|
|
676
|
+
card: { alignSelf: "center", maxWidth: 400, overflow: "hidden", width: "100%" },
|
|
677
|
+
sized: { alignSelf: "center", maxWidth: 400, width: "100%" },
|
|
676
678
|
wrapper: { flex: 1, justifyContent: "center", paddingHorizontal: 26 }
|
|
677
679
|
});
|
|
678
680
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rific/auto-paper",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
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",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
".": {
|
|
34
34
|
"react-native": "./dist/index.js",
|
|
35
35
|
"types": "./dist/index.d.ts",
|
|
36
|
-
"import": "./dist/index.
|
|
36
|
+
"import": "./dist/index.js",
|
|
37
37
|
"require": "./dist/index.js"
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"main": "dist/index.js",
|
|
41
|
-
"module": "dist/index.
|
|
41
|
+
"module": "dist/index.js",
|
|
42
42
|
"types": "dist/index.d.ts",
|
|
43
43
|
"files": [
|
|
44
44
|
"dist",
|
|
@@ -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": {
|
|
@@ -99,12 +99,6 @@
|
|
|
99
99
|
"react-native": ">=0.76.0",
|
|
100
100
|
"react-native-paper": ">=5.0.0"
|
|
101
101
|
},
|
|
102
|
-
"optionalDependencies": {
|
|
103
|
-
"@reduxjs/toolkit": "^2.0.0"
|
|
104
|
-
},
|
|
105
|
-
"publishConfig": {
|
|
106
|
-
"access": "public"
|
|
107
|
-
},
|
|
108
102
|
"peerDependenciesMeta": {
|
|
109
103
|
"expo-blur": {
|
|
110
104
|
"optional": true
|
|
@@ -112,5 +106,11 @@
|
|
|
112
106
|
"expo-navigation-bar": {
|
|
113
107
|
"optional": true
|
|
114
108
|
}
|
|
109
|
+
},
|
|
110
|
+
"optionalDependencies": {
|
|
111
|
+
"@reduxjs/toolkit": "^2.0.0"
|
|
112
|
+
},
|
|
113
|
+
"publishConfig": {
|
|
114
|
+
"access": "public"
|
|
115
115
|
}
|
|
116
116
|
}
|
|
@@ -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
|
}
|
|
@@ -26,7 +26,7 @@ function DialogComponent({ blur: blurProp, visible, onDismiss, children, style,
|
|
|
26
26
|
|
|
27
27
|
if (!blur) {
|
|
28
28
|
return (
|
|
29
|
-
<PaperDialog visible={visible} onDismiss={onDismiss} style={style} {...rest}>
|
|
29
|
+
<PaperDialog visible={visible} onDismiss={onDismiss} style={[styles.sized, style]} {...rest}>
|
|
30
30
|
{children}
|
|
31
31
|
</PaperDialog>
|
|
32
32
|
)
|
|
@@ -56,6 +56,8 @@ DialogComponent.ScrollArea = PaperDialog.ScrollArea as React.FC<DialogScrollArea
|
|
|
56
56
|
export const Dialog = DialogComponent
|
|
57
57
|
|
|
58
58
|
const styles = StyleSheet.create({
|
|
59
|
-
card
|
|
59
|
+
// Width cap keeps dialogs card-sized on wide viewports (web/tablet); no effect on phones.
|
|
60
|
+
card: { alignSelf: 'center', maxWidth: 400, overflow: 'hidden', width: '100%' },
|
|
61
|
+
sized: { alignSelf: 'center', maxWidth: 400, width: '100%' },
|
|
60
62
|
wrapper: { flex: 1, justifyContent: 'center', paddingHorizontal: 26 }
|
|
61
63
|
})
|
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
|
}
|