@rific/auto-paper 0.1.3 → 0.3.1
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 +74 -8
- package/dist/index.d.mts +149 -19
- package/dist/index.d.ts +149 -19
- package/dist/index.js +813 -446
- package/dist/index.mjs +2203 -1851
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# @rific/auto-paper
|
|
2
2
|
|
|
3
|
-
Adaptive theming for [`react-native-paper`](https://callstack.github.io/react-native-paper/). Give it one color and an appearance setting — it generates
|
|
3
|
+
Adaptive theming for [`react-native-paper`](https://callstack.github.io/react-native-paper/). Give it one color and an appearance setting — it generates an MD3 palette and handles light/dark/system mode automatically.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- Color harmony palette from a single seed color (primary → secondary → tertiary) — 6 harmony modes available, defaulting to `split-complementary`
|
|
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 (`Button`, `Chip`, `FAB`, `IconButton`, `TextInput`) with prop defaults via context
|
|
11
|
+
- Wrapper components (`Appbar`, `BottomNavigation`, `Button`, `Chip`, `FAB`, `IconButton`, `TextInput`) with prop defaults via context
|
|
12
12
|
- All color utilities exported for standalone use
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
@@ -23,6 +23,12 @@ Peer dependencies:
|
|
|
23
23
|
npm install react-native react-native-paper
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
Optional — needed only if you use `BottomNavigation` on Android (syncs the system navigation bar color):
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install expo-navigation-bar
|
|
30
|
+
```
|
|
31
|
+
|
|
26
32
|
## Usage
|
|
27
33
|
|
|
28
34
|
### Provider (simplest)
|
|
@@ -50,6 +56,23 @@ export default function App() {
|
|
|
50
56
|
</AutoPaperProvider>
|
|
51
57
|
```
|
|
52
58
|
|
|
59
|
+
### Choosing a color harmony
|
|
60
|
+
|
|
61
|
+
The `harmony` prop controls how secondary and tertiary colors are derived from your seed. The default is `split-complementary`, which works well for most apps — it keeps secondary and tertiary close together in hue so they feel like a family of accents rather than three competing dominant colors.
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
<AutoPaperProvider appearance={appearance} color={color} harmony="split-complementary">
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
| Harmony | Offsets | Character |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| `split-complementary` *(default)* | 0°, +150°, +210° | Harmonious contrast — flanks the complement by ±30° |
|
|
70
|
+
| `triadic` | 0°, +120°, +240° | Equilateral — maximum variety, three equal-weight colors |
|
|
71
|
+
| `analogous` | 0°, +30°, +60° | Cohesive, natural — neighboring hues |
|
|
72
|
+
| `square` | 0°, +90°, +270° | Balanced, structured — right-angle symmetry |
|
|
73
|
+
| `complementary` | 0°, +90°, +180° | Bold — accent at 90° plus true opposite |
|
|
74
|
+
| `double-split` | 0°, +30°, +330° | Tight — flanks the primary by ±30° |
|
|
75
|
+
|
|
53
76
|
### With component defaults
|
|
54
77
|
|
|
55
78
|
Pass a `defaults` object to `Provider` to set prop defaults for any of the included wrapper components. Each component merges defaults under its own props, so per-instance props always win:
|
|
@@ -61,6 +84,8 @@ import { Button, Chip, Provider as AutoPaperProvider } from '@rific/auto-paper'
|
|
|
61
84
|
appearance={appearance}
|
|
62
85
|
color={color}
|
|
63
86
|
defaults={{
|
|
87
|
+
AppbarHeader: { elevated: true },
|
|
88
|
+
BottomNavigation: { labeled: false },
|
|
64
89
|
Button: { mode: 'contained' },
|
|
65
90
|
Chip: { compact: true },
|
|
66
91
|
}}
|
|
@@ -71,7 +96,7 @@ import { Button, Chip, Provider as AutoPaperProvider } from '@rific/auto-paper'
|
|
|
71
96
|
</AutoPaperProvider>
|
|
72
97
|
```
|
|
73
98
|
|
|
74
|
-
Available wrapper components: `Button`, `Chip`, `FAB`, `IconButton`, `TextInput`. Each is a thin wrapper around the matching `react-native-paper` component and accepts the same props.
|
|
99
|
+
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.
|
|
75
100
|
|
|
76
101
|
### With Redux
|
|
77
102
|
|
|
@@ -155,26 +180,62 @@ export default function App() {
|
|
|
155
180
|
|---|---|---|
|
|
156
181
|
| `appearance` | `'system' \| 'light' \| 'dark'` | Appearance mode |
|
|
157
182
|
| `color` | `string` | Seed color (hex, rgb, or CSS name) |
|
|
183
|
+
| `harmony` | `ColorHarmony` | Color harmony mode (default: `'split-complementary'`) |
|
|
158
184
|
| `children` | `ReactNode` | |
|
|
159
185
|
| `defaults` | `PaperDefaults` | Prop defaults for wrapper components (see below) |
|
|
160
186
|
| `onReady` | `() => void` | Called once when the theme first resolves |
|
|
161
187
|
| `statusBarProps` | `StatusBarProps` | Spread over the auto-derived `StatusBar` defaults |
|
|
162
188
|
| `style` | `StyleProp<ViewStyle>` | Applied to the wrapper `View` |
|
|
163
189
|
|
|
164
|
-
### `useComputedTheme(appearance, color)`
|
|
190
|
+
### `useComputedTheme(appearance, color, harmony?)`
|
|
165
191
|
|
|
166
192
|
Returns `MD3Theme | null`. `null` on the first render while the theme computes.
|
|
167
193
|
|
|
168
194
|
```ts
|
|
169
195
|
const theme = useComputedTheme('system', '#6750a4')
|
|
196
|
+
const theme = useComputedTheme('system', '#6750a4', 'triadic')
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### `Appbar`
|
|
200
|
+
|
|
201
|
+
A thin wrapper around `react-native-paper`'s `Appbar` that automatically syncs `StatusBar` background color and bar style to the current theme surface color.
|
|
202
|
+
|
|
203
|
+
```tsx
|
|
204
|
+
import { Appbar } from '@rific/auto-paper'
|
|
205
|
+
|
|
206
|
+
<Appbar.Header>
|
|
207
|
+
<Appbar.BackAction onPress={router.back} />
|
|
208
|
+
<Appbar.Content title="Settings" />
|
|
209
|
+
<Appbar.Action icon="magnify" onPress={onSearch} />
|
|
210
|
+
</Appbar.Header>
|
|
170
211
|
```
|
|
171
212
|
|
|
213
|
+
`Appbar.Content`, `Appbar.Action`, and `Appbar.BackAction` are re-exported directly from `react-native-paper`. Only `Appbar.Header` is wrapped — it applies `AppbarHeader` defaults from context and renders the synced `StatusBar`.
|
|
214
|
+
|
|
215
|
+
### `BottomNavigation`
|
|
216
|
+
|
|
217
|
+
A thin wrapper around `react-native-paper`'s `BottomNavigation` that automatically syncs the Android system navigation bar color and button style to the current theme surface color (requires `expo-navigation-bar`; silently no-ops when not installed).
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
import { BottomNavigation } from '@rific/auto-paper'
|
|
221
|
+
|
|
222
|
+
<BottomNavigation
|
|
223
|
+
navigationState={{ index, routes }}
|
|
224
|
+
onIndexChange={setIndex}
|
|
225
|
+
renderScene={BottomNavigation.SceneMap({ home: HomeScreen, settings: SettingsScreen })}
|
|
226
|
+
/>
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
`BottomNavigation.Bar` and `BottomNavigation.SceneMap` are also available and both sync the navigation bar.
|
|
230
|
+
|
|
172
231
|
### `PaperDefaults` / `usePaperDefaults`
|
|
173
232
|
|
|
174
233
|
`PaperDefaults` is the type for the `defaults` prop on `Provider`:
|
|
175
234
|
|
|
176
235
|
```ts
|
|
177
236
|
type PaperDefaults = {
|
|
237
|
+
AppbarHeader?: Partial<AppbarHeaderProps>
|
|
238
|
+
BottomNavigation?: Partial<BottomNavigationProps<BottomNavigationRoute>>
|
|
178
239
|
Button?: Partial<ButtonProps>
|
|
179
240
|
Chip?: Partial<ChipProps>
|
|
180
241
|
FAB?: Partial<FABProps>
|
|
@@ -222,9 +283,14 @@ const appearance = useSelector((state: RootState) => selectThemeAppearance(state
|
|
|
222
283
|
|
|
223
284
|
```ts
|
|
224
285
|
import { getTriadicPalette, getBlendedColor, isDarkColor, getRgb, getHex } from '@rific/auto-paper'
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
286
|
+
import type { ColorHarmony } from '@rific/auto-paper'
|
|
287
|
+
|
|
288
|
+
getTriadicPalette('#6750a4') // split-complementary (default)
|
|
289
|
+
getTriadicPalette('#6750a4', 'triadic') // → { primary, secondary, tertiary }
|
|
290
|
+
getTriadicPalette('#6750a4', 'analogous')
|
|
291
|
+
getTriadicPalette('#6750a4', 'square')
|
|
292
|
+
getTriadicPalette('#6750a4', 'complementary')
|
|
293
|
+
getTriadicPalette('#6750a4', 'double-split')
|
|
228
294
|
|
|
229
295
|
getBlendedColor('#ff0000', '#0000ff', 0.5) // → '#800080'
|
|
230
296
|
isDarkColor('#6750a4') // → true
|
package/dist/index.d.mts
CHANGED
|
@@ -1,24 +1,123 @@
|
|
|
1
|
+
import * as react_native_paper_lib_typescript_utils_forwardRef from 'react-native-paper/lib/typescript/utils/forwardRef';
|
|
2
|
+
import * as react_native from 'react-native';
|
|
3
|
+
import { StyleProp, ViewStyle, TextInput as TextInput$1, StatusBarProps } from 'react-native';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import React__default, { ReactNode } from 'react';
|
|
6
|
+
import * as react_native_paper from 'react-native-paper';
|
|
7
|
+
import { AppbarHeaderProps, MD3Theme, BottomNavigationRoute, BottomNavigationProps, BottomNavigation as BottomNavigation$1, ButtonProps, ChipProps, DialogProps as DialogProps$1, DialogTitleProps, DialogContentProps, DialogActionsProps, DialogScrollAreaProps, FABProps, IconButtonProps, MenuProps as MenuProps$1, MenuItemProps, TextInputProps } from 'react-native-paper';
|
|
8
|
+
export { AppbarHeaderProps, BottomNavigationProps, BottomNavigationRoute, ButtonProps, ChipProps, FABProps, IconButtonProps, DialogProps as PaperDialogProps, MenuProps as PaperMenuProps, TextInputProps } from 'react-native-paper';
|
|
1
9
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
export { ButtonProps, ChipProps, FABProps, IconButtonProps, TextInputProps } from 'react-native-paper';
|
|
4
|
-
import * as react from 'react';
|
|
5
|
-
import { ReactNode } from 'react';
|
|
6
|
-
import { TextInput as TextInput$1, StatusBarProps, StyleProp, ViewStyle } from 'react-native';
|
|
10
|
+
import { BlurViewProps as BlurViewProps$1 } from 'expo-blur';
|
|
7
11
|
import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
8
12
|
import { PayloadAction } from '@reduxjs/toolkit';
|
|
9
13
|
import * as redux from 'redux';
|
|
10
14
|
|
|
15
|
+
declare function useBlur(override?: boolean): boolean;
|
|
16
|
+
|
|
17
|
+
declare function Header({ style, ...props }: AppbarHeaderProps): react_jsx_runtime.JSX.Element;
|
|
18
|
+
declare const Appbar: {
|
|
19
|
+
Header: typeof Header;
|
|
20
|
+
Content: {
|
|
21
|
+
({ color: titleColor, subtitle, subtitleStyle, onPress, disabled, style, titleRef, titleStyle, title, titleMaxFontSizeMultiplier, mode, theme: themeOverrides, testID, ...rest }: react_native_paper.Props): React.JSX.Element;
|
|
22
|
+
displayName: string;
|
|
23
|
+
};
|
|
24
|
+
Action: react_native_paper_lib_typescript_utils_forwardRef.ForwardRefComponent<react_native.View, react_native_paper.AppbarActionProps>;
|
|
25
|
+
BackAction: react_native_paper_lib_typescript_utils_forwardRef.ForwardRefComponent<react_native.View, react_native_paper.AppbarBackActionProps>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type ColorHarmony = 'triadic' | 'split-complementary' | 'analogous' | 'square' | 'complementary' | 'double-split';
|
|
29
|
+
type TriadicPalette = {
|
|
30
|
+
primary: string;
|
|
31
|
+
secondary: string;
|
|
32
|
+
tertiary: string;
|
|
33
|
+
};
|
|
34
|
+
declare function getTriadicPalette(primaryColor: string, harmony?: ColorHarmony): TriadicPalette;
|
|
35
|
+
|
|
36
|
+
type ThemeAppearance = 'system' | 'light' | 'dark';
|
|
37
|
+
declare function useComputedTheme(appearance: ThemeAppearance, color: string, harmony?: ColorHarmony): MD3Theme | null;
|
|
38
|
+
|
|
39
|
+
type Props$2 = {
|
|
40
|
+
value: ThemeAppearance;
|
|
41
|
+
onChange: (appearance: ThemeAppearance) => void;
|
|
42
|
+
};
|
|
43
|
+
declare const AppearancePicker: ({ value, onChange }: Props$2) => react_jsx_runtime.JSX.Element;
|
|
44
|
+
|
|
45
|
+
type BlurViewProps = BlurViewProps$1 & {
|
|
46
|
+
blur?: boolean;
|
|
47
|
+
children?: ReactNode;
|
|
48
|
+
elevation?: 0 | 1 | 2 | 3 | 4 | 5;
|
|
49
|
+
style?: StyleProp<ViewStyle>;
|
|
50
|
+
};
|
|
51
|
+
declare const BlurView: ({ blur, children, elevation, style, ...props }: BlurViewProps) => react_jsx_runtime.JSX.Element;
|
|
52
|
+
|
|
53
|
+
declare function BottomNavigationComponent<Route extends BottomNavigationRoute>(props: BottomNavigationProps<Route>): react_jsx_runtime.JSX.Element;
|
|
54
|
+
declare namespace BottomNavigationComponent {
|
|
55
|
+
var Bar: (props: BarProps) => react_jsx_runtime.JSX.Element;
|
|
56
|
+
var SceneMap: <Route extends BottomNavigationRoute>(scenes: {
|
|
57
|
+
[key: string]: React__default.ComponentType<{
|
|
58
|
+
route: Route;
|
|
59
|
+
jumpTo: (key: string) => void;
|
|
60
|
+
}>;
|
|
61
|
+
}) => ({ route, jumpTo, }: {
|
|
62
|
+
route: Route;
|
|
63
|
+
jumpTo: (key: string) => void;
|
|
64
|
+
}) => React__default.JSX.Element;
|
|
65
|
+
}
|
|
66
|
+
type BarProps = React__default.ComponentProps<typeof BottomNavigation$1.Bar>;
|
|
67
|
+
declare const BottomNavigation: typeof BottomNavigationComponent;
|
|
68
|
+
|
|
11
69
|
declare function Button(props: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
12
70
|
|
|
13
71
|
declare function Chip(props: ChipProps): react_jsx_runtime.JSX.Element;
|
|
14
72
|
|
|
73
|
+
type SeedColor = {
|
|
74
|
+
label: string;
|
|
75
|
+
value: string;
|
|
76
|
+
};
|
|
77
|
+
declare const defaultColors: SeedColor[];
|
|
78
|
+
type Props$1 = {
|
|
79
|
+
value: string;
|
|
80
|
+
onChange: (color: string) => void;
|
|
81
|
+
colors?: SeedColor[];
|
|
82
|
+
blur?: boolean;
|
|
83
|
+
};
|
|
84
|
+
declare const ColorPicker: ({ value, onChange, colors, blur: blurProp }: Props$1) => react_jsx_runtime.JSX.Element;
|
|
85
|
+
|
|
86
|
+
type DialogProps = DialogProps$1 & {
|
|
87
|
+
blur?: boolean;
|
|
88
|
+
};
|
|
89
|
+
declare function DialogComponent({ blur: blurProp, visible, onDismiss, children, style, ...rest }: DialogProps): react_jsx_runtime.JSX.Element | null;
|
|
90
|
+
declare namespace DialogComponent {
|
|
91
|
+
var Title: React__default.FC<DialogTitleProps>;
|
|
92
|
+
var Content: React__default.FC<DialogContentProps>;
|
|
93
|
+
var Actions: React__default.FC<DialogActionsProps>;
|
|
94
|
+
var ScrollArea: React__default.FC<DialogScrollAreaProps>;
|
|
95
|
+
}
|
|
96
|
+
declare const Dialog: typeof DialogComponent;
|
|
97
|
+
|
|
15
98
|
declare function FAB(props: FABProps): react_jsx_runtime.JSX.Element;
|
|
16
99
|
|
|
100
|
+
type Props = {
|
|
101
|
+
value: ColorHarmony;
|
|
102
|
+
onChange: (harmony: ColorHarmony) => void;
|
|
103
|
+
blur?: boolean;
|
|
104
|
+
};
|
|
105
|
+
declare const HarmonyPicker: ({ value, onChange, blur: blurProp }: Props) => react_jsx_runtime.JSX.Element;
|
|
106
|
+
|
|
17
107
|
declare function IconButton(props: IconButtonProps): react_jsx_runtime.JSX.Element;
|
|
18
108
|
|
|
19
|
-
|
|
109
|
+
type MenuProps = MenuProps$1 & {
|
|
110
|
+
blur?: boolean;
|
|
111
|
+
};
|
|
112
|
+
declare const Menu: (({ blur: blurProp, children, ...props }: MenuProps) => react_jsx_runtime.JSX.Element) & {
|
|
113
|
+
Item: React__default.FC<MenuItemProps>;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
declare const TextInput: React.ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & React.RefAttributes<TextInput$1>>;
|
|
20
117
|
|
|
21
118
|
type PaperDefaults = {
|
|
119
|
+
AppbarHeader?: Partial<AppbarHeaderProps>;
|
|
120
|
+
BottomNavigation?: Partial<BottomNavigationProps<BottomNavigationRoute>>;
|
|
22
121
|
Button?: Partial<ButtonProps>;
|
|
23
122
|
Chip?: Partial<ChipProps>;
|
|
24
123
|
FAB?: Partial<FABProps>;
|
|
@@ -27,45 +126,83 @@ type PaperDefaults = {
|
|
|
27
126
|
};
|
|
28
127
|
declare function usePaperDefaults(): PaperDefaults;
|
|
29
128
|
|
|
30
|
-
type ThemeAppearance = 'system' | 'light' | 'dark';
|
|
31
|
-
declare function useComputedTheme(appearance: ThemeAppearance, color: string): MD3Theme | null;
|
|
32
|
-
|
|
33
129
|
type ThemeState = {
|
|
34
130
|
appearance: ThemeAppearance;
|
|
131
|
+
blur: boolean;
|
|
35
132
|
color: string;
|
|
133
|
+
harmony: ColorHarmony;
|
|
36
134
|
};
|
|
37
135
|
declare function createThemeReducer(initialState?: Partial<ThemeState>): redux.Reducer<{
|
|
38
136
|
appearance: ThemeAppearance;
|
|
137
|
+
blur: boolean;
|
|
39
138
|
color: string;
|
|
139
|
+
harmony: ColorHarmony;
|
|
40
140
|
}>;
|
|
41
141
|
declare const themeActions: _reduxjs_toolkit.CaseReducerActions<{
|
|
42
142
|
initialize: (state: ThemeState, action: PayloadAction<Partial<ThemeState>>) => {
|
|
43
143
|
appearance: ThemeAppearance;
|
|
144
|
+
blur: boolean;
|
|
44
145
|
color: string;
|
|
146
|
+
harmony: ColorHarmony;
|
|
45
147
|
};
|
|
46
148
|
setAppearance: (state: ThemeState, action: PayloadAction<ThemeAppearance>) => {
|
|
47
149
|
appearance: ThemeAppearance;
|
|
150
|
+
blur: boolean;
|
|
48
151
|
color: string;
|
|
152
|
+
harmony: ColorHarmony;
|
|
153
|
+
};
|
|
154
|
+
setBlur: (state: ThemeState, action: PayloadAction<boolean>) => {
|
|
155
|
+
blur: boolean;
|
|
156
|
+
appearance: ThemeAppearance;
|
|
157
|
+
color: string;
|
|
158
|
+
harmony: ColorHarmony;
|
|
49
159
|
};
|
|
50
160
|
setColor: (state: ThemeState, action: PayloadAction<string>) => {
|
|
51
161
|
color: string;
|
|
52
162
|
appearance: ThemeAppearance;
|
|
163
|
+
blur: boolean;
|
|
164
|
+
harmony: ColorHarmony;
|
|
165
|
+
};
|
|
166
|
+
setHarmony: (state: ThemeState, action: PayloadAction<ColorHarmony>) => {
|
|
167
|
+
harmony: ColorHarmony;
|
|
168
|
+
appearance: ThemeAppearance;
|
|
169
|
+
blur: boolean;
|
|
170
|
+
color: string;
|
|
53
171
|
};
|
|
54
172
|
}, "theme">;
|
|
55
173
|
declare const themeReducer: redux.Reducer<ThemeState>;
|
|
56
174
|
declare const selectThemeAppearance: (state: ThemeState) => ThemeAppearance;
|
|
175
|
+
declare const selectThemeBlur: (state: ThemeState) => boolean;
|
|
57
176
|
declare const selectThemeColor: (state: ThemeState) => string;
|
|
177
|
+
declare const selectThemeHarmony: (state: ThemeState) => ColorHarmony;
|
|
58
178
|
|
|
59
|
-
type
|
|
179
|
+
type ThemeSettings = {
|
|
60
180
|
appearance: ThemeAppearance;
|
|
181
|
+
blur: boolean;
|
|
182
|
+
blurTint: number;
|
|
61
183
|
color: string;
|
|
184
|
+
harmony: ColorHarmony;
|
|
185
|
+
};
|
|
186
|
+
declare const defaultThemeSettings: ThemeSettings;
|
|
187
|
+
type ThemeSettingsContextType = {
|
|
188
|
+
settings: ThemeSettings;
|
|
189
|
+
set: (patch: Partial<ThemeSettings>) => void;
|
|
190
|
+
};
|
|
191
|
+
declare const ThemeSettingsContext: React.Context<ThemeSettingsContextType>;
|
|
192
|
+
|
|
193
|
+
type ProviderProps = {
|
|
194
|
+
overrides?: Partial<ThemeSettings>;
|
|
195
|
+
onChange?: (settings: ThemeSettings) => void;
|
|
62
196
|
children: ReactNode;
|
|
63
197
|
defaults?: PaperDefaults;
|
|
198
|
+
onNavBarChange?: (color: string, dark: boolean) => void;
|
|
64
199
|
onReady?: () => void;
|
|
65
200
|
statusBarProps?: StatusBarProps;
|
|
66
201
|
style?: StyleProp<ViewStyle>;
|
|
67
202
|
};
|
|
68
|
-
declare function Provider({
|
|
203
|
+
declare function Provider({ overrides, onChange, children, defaults, onNavBarChange, onReady, statusBarProps, style }: ProviderProps): react_jsx_runtime.JSX.Element | null;
|
|
204
|
+
|
|
205
|
+
declare const useThemeSettings: () => ThemeSettingsContextType;
|
|
69
206
|
|
|
70
207
|
declare const getBlendedColor: (foreground: string, background: string, alpha: number) => string;
|
|
71
208
|
|
|
@@ -79,13 +216,6 @@ type RGB = {
|
|
|
79
216
|
};
|
|
80
217
|
declare const getRgb: (value: string) => RGB | null;
|
|
81
218
|
|
|
82
|
-
type TriadicPalette = {
|
|
83
|
-
primary: string;
|
|
84
|
-
secondary: string;
|
|
85
|
-
tertiary: string;
|
|
86
|
-
};
|
|
87
|
-
declare function getTriadicPalette(primaryColor: string): TriadicPalette;
|
|
88
|
-
|
|
89
219
|
declare const isDarkColor: (value: string) => boolean;
|
|
90
220
|
|
|
91
|
-
export { Button, Chip, FAB, IconButton, type PaperDefaults, Provider, type ProviderProps, type RGB, TextInput, type ThemeAppearance, type ThemeState, type TriadicPalette, createThemeReducer, getBlendedColor, getHex, getRgb, getTriadicPalette, isDarkColor, selectThemeAppearance, selectThemeColor, themeActions, themeReducer, useComputedTheme, usePaperDefaults };
|
|
221
|
+
export { Appbar, AppearancePicker, BlurView, type BlurViewProps, BottomNavigation, Button, Chip, type ColorHarmony, ColorPicker, Dialog, type DialogProps, FAB, HarmonyPicker, IconButton, Menu, type MenuProps, type PaperDefaults, Provider, type ProviderProps, type RGB, type SeedColor, TextInput, type ThemeAppearance, type ThemeSettings, ThemeSettingsContext, type ThemeSettingsContextType, type ThemeState, type TriadicPalette, createThemeReducer, defaultColors, defaultThemeSettings, getBlendedColor, getHex, getRgb, getTriadicPalette, isDarkColor, selectThemeAppearance, selectThemeBlur, selectThemeColor, selectThemeHarmony, themeActions, themeReducer, useBlur, useComputedTheme, usePaperDefaults, useThemeSettings };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,123 @@
|
|
|
1
|
+
import * as react_native_paper_lib_typescript_utils_forwardRef from 'react-native-paper/lib/typescript/utils/forwardRef';
|
|
2
|
+
import * as react_native from 'react-native';
|
|
3
|
+
import { StyleProp, ViewStyle, TextInput as TextInput$1, StatusBarProps } from 'react-native';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import React__default, { ReactNode } from 'react';
|
|
6
|
+
import * as react_native_paper from 'react-native-paper';
|
|
7
|
+
import { AppbarHeaderProps, MD3Theme, BottomNavigationRoute, BottomNavigationProps, BottomNavigation as BottomNavigation$1, ButtonProps, ChipProps, DialogProps as DialogProps$1, DialogTitleProps, DialogContentProps, DialogActionsProps, DialogScrollAreaProps, FABProps, IconButtonProps, MenuProps as MenuProps$1, MenuItemProps, TextInputProps } from 'react-native-paper';
|
|
8
|
+
export { AppbarHeaderProps, BottomNavigationProps, BottomNavigationRoute, ButtonProps, ChipProps, FABProps, IconButtonProps, DialogProps as PaperDialogProps, MenuProps as PaperMenuProps, TextInputProps } from 'react-native-paper';
|
|
1
9
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
export { ButtonProps, ChipProps, FABProps, IconButtonProps, TextInputProps } from 'react-native-paper';
|
|
4
|
-
import * as react from 'react';
|
|
5
|
-
import { ReactNode } from 'react';
|
|
6
|
-
import { TextInput as TextInput$1, StatusBarProps, StyleProp, ViewStyle } from 'react-native';
|
|
10
|
+
import { BlurViewProps as BlurViewProps$1 } from 'expo-blur';
|
|
7
11
|
import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
8
12
|
import { PayloadAction } from '@reduxjs/toolkit';
|
|
9
13
|
import * as redux from 'redux';
|
|
10
14
|
|
|
15
|
+
declare function useBlur(override?: boolean): boolean;
|
|
16
|
+
|
|
17
|
+
declare function Header({ style, ...props }: AppbarHeaderProps): react_jsx_runtime.JSX.Element;
|
|
18
|
+
declare const Appbar: {
|
|
19
|
+
Header: typeof Header;
|
|
20
|
+
Content: {
|
|
21
|
+
({ color: titleColor, subtitle, subtitleStyle, onPress, disabled, style, titleRef, titleStyle, title, titleMaxFontSizeMultiplier, mode, theme: themeOverrides, testID, ...rest }: react_native_paper.Props): React.JSX.Element;
|
|
22
|
+
displayName: string;
|
|
23
|
+
};
|
|
24
|
+
Action: react_native_paper_lib_typescript_utils_forwardRef.ForwardRefComponent<react_native.View, react_native_paper.AppbarActionProps>;
|
|
25
|
+
BackAction: react_native_paper_lib_typescript_utils_forwardRef.ForwardRefComponent<react_native.View, react_native_paper.AppbarBackActionProps>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type ColorHarmony = 'triadic' | 'split-complementary' | 'analogous' | 'square' | 'complementary' | 'double-split';
|
|
29
|
+
type TriadicPalette = {
|
|
30
|
+
primary: string;
|
|
31
|
+
secondary: string;
|
|
32
|
+
tertiary: string;
|
|
33
|
+
};
|
|
34
|
+
declare function getTriadicPalette(primaryColor: string, harmony?: ColorHarmony): TriadicPalette;
|
|
35
|
+
|
|
36
|
+
type ThemeAppearance = 'system' | 'light' | 'dark';
|
|
37
|
+
declare function useComputedTheme(appearance: ThemeAppearance, color: string, harmony?: ColorHarmony): MD3Theme | null;
|
|
38
|
+
|
|
39
|
+
type Props$2 = {
|
|
40
|
+
value: ThemeAppearance;
|
|
41
|
+
onChange: (appearance: ThemeAppearance) => void;
|
|
42
|
+
};
|
|
43
|
+
declare const AppearancePicker: ({ value, onChange }: Props$2) => react_jsx_runtime.JSX.Element;
|
|
44
|
+
|
|
45
|
+
type BlurViewProps = BlurViewProps$1 & {
|
|
46
|
+
blur?: boolean;
|
|
47
|
+
children?: ReactNode;
|
|
48
|
+
elevation?: 0 | 1 | 2 | 3 | 4 | 5;
|
|
49
|
+
style?: StyleProp<ViewStyle>;
|
|
50
|
+
};
|
|
51
|
+
declare const BlurView: ({ blur, children, elevation, style, ...props }: BlurViewProps) => react_jsx_runtime.JSX.Element;
|
|
52
|
+
|
|
53
|
+
declare function BottomNavigationComponent<Route extends BottomNavigationRoute>(props: BottomNavigationProps<Route>): react_jsx_runtime.JSX.Element;
|
|
54
|
+
declare namespace BottomNavigationComponent {
|
|
55
|
+
var Bar: (props: BarProps) => react_jsx_runtime.JSX.Element;
|
|
56
|
+
var SceneMap: <Route extends BottomNavigationRoute>(scenes: {
|
|
57
|
+
[key: string]: React__default.ComponentType<{
|
|
58
|
+
route: Route;
|
|
59
|
+
jumpTo: (key: string) => void;
|
|
60
|
+
}>;
|
|
61
|
+
}) => ({ route, jumpTo, }: {
|
|
62
|
+
route: Route;
|
|
63
|
+
jumpTo: (key: string) => void;
|
|
64
|
+
}) => React__default.JSX.Element;
|
|
65
|
+
}
|
|
66
|
+
type BarProps = React__default.ComponentProps<typeof BottomNavigation$1.Bar>;
|
|
67
|
+
declare const BottomNavigation: typeof BottomNavigationComponent;
|
|
68
|
+
|
|
11
69
|
declare function Button(props: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
12
70
|
|
|
13
71
|
declare function Chip(props: ChipProps): react_jsx_runtime.JSX.Element;
|
|
14
72
|
|
|
73
|
+
type SeedColor = {
|
|
74
|
+
label: string;
|
|
75
|
+
value: string;
|
|
76
|
+
};
|
|
77
|
+
declare const defaultColors: SeedColor[];
|
|
78
|
+
type Props$1 = {
|
|
79
|
+
value: string;
|
|
80
|
+
onChange: (color: string) => void;
|
|
81
|
+
colors?: SeedColor[];
|
|
82
|
+
blur?: boolean;
|
|
83
|
+
};
|
|
84
|
+
declare const ColorPicker: ({ value, onChange, colors, blur: blurProp }: Props$1) => react_jsx_runtime.JSX.Element;
|
|
85
|
+
|
|
86
|
+
type DialogProps = DialogProps$1 & {
|
|
87
|
+
blur?: boolean;
|
|
88
|
+
};
|
|
89
|
+
declare function DialogComponent({ blur: blurProp, visible, onDismiss, children, style, ...rest }: DialogProps): react_jsx_runtime.JSX.Element | null;
|
|
90
|
+
declare namespace DialogComponent {
|
|
91
|
+
var Title: React__default.FC<DialogTitleProps>;
|
|
92
|
+
var Content: React__default.FC<DialogContentProps>;
|
|
93
|
+
var Actions: React__default.FC<DialogActionsProps>;
|
|
94
|
+
var ScrollArea: React__default.FC<DialogScrollAreaProps>;
|
|
95
|
+
}
|
|
96
|
+
declare const Dialog: typeof DialogComponent;
|
|
97
|
+
|
|
15
98
|
declare function FAB(props: FABProps): react_jsx_runtime.JSX.Element;
|
|
16
99
|
|
|
100
|
+
type Props = {
|
|
101
|
+
value: ColorHarmony;
|
|
102
|
+
onChange: (harmony: ColorHarmony) => void;
|
|
103
|
+
blur?: boolean;
|
|
104
|
+
};
|
|
105
|
+
declare const HarmonyPicker: ({ value, onChange, blur: blurProp }: Props) => react_jsx_runtime.JSX.Element;
|
|
106
|
+
|
|
17
107
|
declare function IconButton(props: IconButtonProps): react_jsx_runtime.JSX.Element;
|
|
18
108
|
|
|
19
|
-
|
|
109
|
+
type MenuProps = MenuProps$1 & {
|
|
110
|
+
blur?: boolean;
|
|
111
|
+
};
|
|
112
|
+
declare const Menu: (({ blur: blurProp, children, ...props }: MenuProps) => react_jsx_runtime.JSX.Element) & {
|
|
113
|
+
Item: React__default.FC<MenuItemProps>;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
declare const TextInput: React.ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & React.RefAttributes<TextInput$1>>;
|
|
20
117
|
|
|
21
118
|
type PaperDefaults = {
|
|
119
|
+
AppbarHeader?: Partial<AppbarHeaderProps>;
|
|
120
|
+
BottomNavigation?: Partial<BottomNavigationProps<BottomNavigationRoute>>;
|
|
22
121
|
Button?: Partial<ButtonProps>;
|
|
23
122
|
Chip?: Partial<ChipProps>;
|
|
24
123
|
FAB?: Partial<FABProps>;
|
|
@@ -27,45 +126,83 @@ type PaperDefaults = {
|
|
|
27
126
|
};
|
|
28
127
|
declare function usePaperDefaults(): PaperDefaults;
|
|
29
128
|
|
|
30
|
-
type ThemeAppearance = 'system' | 'light' | 'dark';
|
|
31
|
-
declare function useComputedTheme(appearance: ThemeAppearance, color: string): MD3Theme | null;
|
|
32
|
-
|
|
33
129
|
type ThemeState = {
|
|
34
130
|
appearance: ThemeAppearance;
|
|
131
|
+
blur: boolean;
|
|
35
132
|
color: string;
|
|
133
|
+
harmony: ColorHarmony;
|
|
36
134
|
};
|
|
37
135
|
declare function createThemeReducer(initialState?: Partial<ThemeState>): redux.Reducer<{
|
|
38
136
|
appearance: ThemeAppearance;
|
|
137
|
+
blur: boolean;
|
|
39
138
|
color: string;
|
|
139
|
+
harmony: ColorHarmony;
|
|
40
140
|
}>;
|
|
41
141
|
declare const themeActions: _reduxjs_toolkit.CaseReducerActions<{
|
|
42
142
|
initialize: (state: ThemeState, action: PayloadAction<Partial<ThemeState>>) => {
|
|
43
143
|
appearance: ThemeAppearance;
|
|
144
|
+
blur: boolean;
|
|
44
145
|
color: string;
|
|
146
|
+
harmony: ColorHarmony;
|
|
45
147
|
};
|
|
46
148
|
setAppearance: (state: ThemeState, action: PayloadAction<ThemeAppearance>) => {
|
|
47
149
|
appearance: ThemeAppearance;
|
|
150
|
+
blur: boolean;
|
|
48
151
|
color: string;
|
|
152
|
+
harmony: ColorHarmony;
|
|
153
|
+
};
|
|
154
|
+
setBlur: (state: ThemeState, action: PayloadAction<boolean>) => {
|
|
155
|
+
blur: boolean;
|
|
156
|
+
appearance: ThemeAppearance;
|
|
157
|
+
color: string;
|
|
158
|
+
harmony: ColorHarmony;
|
|
49
159
|
};
|
|
50
160
|
setColor: (state: ThemeState, action: PayloadAction<string>) => {
|
|
51
161
|
color: string;
|
|
52
162
|
appearance: ThemeAppearance;
|
|
163
|
+
blur: boolean;
|
|
164
|
+
harmony: ColorHarmony;
|
|
165
|
+
};
|
|
166
|
+
setHarmony: (state: ThemeState, action: PayloadAction<ColorHarmony>) => {
|
|
167
|
+
harmony: ColorHarmony;
|
|
168
|
+
appearance: ThemeAppearance;
|
|
169
|
+
blur: boolean;
|
|
170
|
+
color: string;
|
|
53
171
|
};
|
|
54
172
|
}, "theme">;
|
|
55
173
|
declare const themeReducer: redux.Reducer<ThemeState>;
|
|
56
174
|
declare const selectThemeAppearance: (state: ThemeState) => ThemeAppearance;
|
|
175
|
+
declare const selectThemeBlur: (state: ThemeState) => boolean;
|
|
57
176
|
declare const selectThemeColor: (state: ThemeState) => string;
|
|
177
|
+
declare const selectThemeHarmony: (state: ThemeState) => ColorHarmony;
|
|
58
178
|
|
|
59
|
-
type
|
|
179
|
+
type ThemeSettings = {
|
|
60
180
|
appearance: ThemeAppearance;
|
|
181
|
+
blur: boolean;
|
|
182
|
+
blurTint: number;
|
|
61
183
|
color: string;
|
|
184
|
+
harmony: ColorHarmony;
|
|
185
|
+
};
|
|
186
|
+
declare const defaultThemeSettings: ThemeSettings;
|
|
187
|
+
type ThemeSettingsContextType = {
|
|
188
|
+
settings: ThemeSettings;
|
|
189
|
+
set: (patch: Partial<ThemeSettings>) => void;
|
|
190
|
+
};
|
|
191
|
+
declare const ThemeSettingsContext: React.Context<ThemeSettingsContextType>;
|
|
192
|
+
|
|
193
|
+
type ProviderProps = {
|
|
194
|
+
overrides?: Partial<ThemeSettings>;
|
|
195
|
+
onChange?: (settings: ThemeSettings) => void;
|
|
62
196
|
children: ReactNode;
|
|
63
197
|
defaults?: PaperDefaults;
|
|
198
|
+
onNavBarChange?: (color: string, dark: boolean) => void;
|
|
64
199
|
onReady?: () => void;
|
|
65
200
|
statusBarProps?: StatusBarProps;
|
|
66
201
|
style?: StyleProp<ViewStyle>;
|
|
67
202
|
};
|
|
68
|
-
declare function Provider({
|
|
203
|
+
declare function Provider({ overrides, onChange, children, defaults, onNavBarChange, onReady, statusBarProps, style }: ProviderProps): react_jsx_runtime.JSX.Element | null;
|
|
204
|
+
|
|
205
|
+
declare const useThemeSettings: () => ThemeSettingsContextType;
|
|
69
206
|
|
|
70
207
|
declare const getBlendedColor: (foreground: string, background: string, alpha: number) => string;
|
|
71
208
|
|
|
@@ -79,13 +216,6 @@ type RGB = {
|
|
|
79
216
|
};
|
|
80
217
|
declare const getRgb: (value: string) => RGB | null;
|
|
81
218
|
|
|
82
|
-
type TriadicPalette = {
|
|
83
|
-
primary: string;
|
|
84
|
-
secondary: string;
|
|
85
|
-
tertiary: string;
|
|
86
|
-
};
|
|
87
|
-
declare function getTriadicPalette(primaryColor: string): TriadicPalette;
|
|
88
|
-
|
|
89
219
|
declare const isDarkColor: (value: string) => boolean;
|
|
90
220
|
|
|
91
|
-
export { Button, Chip, FAB, IconButton, type PaperDefaults, Provider, type ProviderProps, type RGB, TextInput, type ThemeAppearance, type ThemeState, type TriadicPalette, createThemeReducer, getBlendedColor, getHex, getRgb, getTriadicPalette, isDarkColor, selectThemeAppearance, selectThemeColor, themeActions, themeReducer, useComputedTheme, usePaperDefaults };
|
|
221
|
+
export { Appbar, AppearancePicker, BlurView, type BlurViewProps, BottomNavigation, Button, Chip, type ColorHarmony, ColorPicker, Dialog, type DialogProps, FAB, HarmonyPicker, IconButton, Menu, type MenuProps, type PaperDefaults, Provider, type ProviderProps, type RGB, type SeedColor, TextInput, type ThemeAppearance, type ThemeSettings, ThemeSettingsContext, type ThemeSettingsContextType, type ThemeState, type TriadicPalette, createThemeReducer, defaultColors, defaultThemeSettings, getBlendedColor, getHex, getRgb, getTriadicPalette, isDarkColor, selectThemeAppearance, selectThemeBlur, selectThemeColor, selectThemeHarmony, themeActions, themeReducer, useBlur, useComputedTheme, usePaperDefaults, useThemeSettings };
|