@rific/auto-paper 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 CHANGED
@@ -37,11 +37,8 @@ npm install expo-navigation-bar
37
37
  import { Provider as AutoPaperProvider } from '@rific/auto-paper'
38
38
 
39
39
  export default function App() {
40
- const [appearance, setAppearance] = useState<'system' | 'light' | 'dark'>('system')
41
- const [color, setColor] = useState('#6750a4')
42
-
43
40
  return (
44
- <AutoPaperProvider appearance={appearance} color={color}>
41
+ <AutoPaperProvider initialValue={{ appearance: 'system', color: '#6750a4' }}>
45
42
  {/* your app */}
46
43
  </AutoPaperProvider>
47
44
  )
@@ -51,17 +48,33 @@ export default function App() {
51
48
  `Provider` renders `null` on the first render while the theme computes, then wraps your app in `PaperProvider` with the computed theme, a matching `StatusBar`, and a background `View`. Use `onReady` to hook into that moment — e.g. to dismiss a splash screen:
52
49
 
53
50
  ```tsx
54
- <AutoPaperProvider appearance={appearance} color={color} onReady={SplashScreen.hideAsync}>
51
+ <AutoPaperProvider initialValue={{ appearance: 'system', color: '#6750a4' }} onReady={SplashScreen.hideAsync}>
55
52
  {/* your app */}
56
53
  </AutoPaperProvider>
57
54
  ```
58
55
 
56
+ Update theme settings from anywhere inside the tree using `useThemeSettings`:
57
+
58
+ ```tsx
59
+ import { useThemeSettings } from '@rific/auto-paper'
60
+
61
+ function SettingsScreen() {
62
+ const { settings, set } = useThemeSettings()
63
+ return (
64
+ <>
65
+ <Button onPress={() => set({ appearance: 'dark' })}>Dark mode</Button>
66
+ <Button onPress={() => set({ color: '#e91e63' })}>Change color</Button>
67
+ </>
68
+ )
69
+ }
70
+ ```
71
+
59
72
  ### Choosing a color harmony
60
73
 
61
74
  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
75
 
63
76
  ```tsx
64
- <AutoPaperProvider appearance={appearance} color={color} harmony="split-complementary">
77
+ <AutoPaperProvider initialValue={{ appearance: 'system', color: '#6750a4', harmony: 'split-complementary' }}>
65
78
  ```
66
79
 
67
80
  | Harmony | Offsets | Character |
@@ -81,8 +94,7 @@ Pass a `defaults` object to `Provider` to set prop defaults for any of the inclu
81
94
  import { Button, Chip, Provider as AutoPaperProvider } from '@rific/auto-paper'
82
95
 
83
96
  <AutoPaperProvider
84
- appearance={appearance}
85
- color={color}
97
+ initialValue={{ appearance: 'system', color: '#6750a4' }}
86
98
  defaults={{
87
99
  AppbarHeader: { elevated: true },
88
100
  BottomNavigation: { labeled: false },
@@ -124,7 +136,7 @@ import { Provider as AutoPaperProvider } from '@rific/auto-paper'
124
136
  export default function App() {
125
137
  const { appearance, color } = useSelector((state: RootState) => state.theme)
126
138
  return (
127
- <AutoPaperProvider appearance={appearance} color={color} onReady={SplashScreen.hideAsync}>
139
+ <AutoPaperProvider initialValue={{ appearance, color }} onReady={SplashScreen.hideAsync}>
128
140
  {/* your app */}
129
141
  </AutoPaperProvider>
130
142
  )
@@ -178,15 +190,38 @@ export default function App() {
178
190
 
179
191
  | Prop | Type | Description |
180
192
  |---|---|---|
181
- | `appearance` | `'system' \| 'light' \| 'dark'` | Appearance mode |
182
- | `color` | `string` | Seed color (hex, rgb, or CSS name) |
183
- | `harmony` | `ColorHarmony` | Color harmony mode (default: `'split-complementary'`) |
193
+ | `initialValue` | `Partial<ThemeSettings>` | Initial theme settings — `appearance`, `color`, `harmony`, `blur`, `blurTint`. Defaults from `defaultThemeSettings` fill any omitted fields. |
194
+ | `onChange` | `(settings: ThemeSettings) => void` | Called whenever settings change via `useThemeSettings().set()` |
184
195
  | `children` | `ReactNode` | |
185
196
  | `defaults` | `PaperDefaults` | Prop defaults for wrapper components (see below) |
186
197
  | `onReady` | `() => void` | Called once when the theme first resolves |
187
198
  | `statusBarProps` | `StatusBarProps` | Spread over the auto-derived `StatusBar` defaults |
188
199
  | `style` | `StyleProp<ViewStyle>` | Applied to the wrapper `View` |
189
200
 
201
+ `ThemeSettings` fields:
202
+
203
+ | Field | Type | Default |
204
+ |---|---|---|
205
+ | `appearance` | `'system' \| 'light' \| 'dark'` | `'system'` |
206
+ | `color` | `string` | `'#6750a4'` |
207
+ | `harmony` | `ColorHarmony` | `'split-complementary'` |
208
+ | `blur` | `boolean` | `true` |
209
+ | `blurTint` | `number` | `0.2` |
210
+
211
+ ### `useThemeSettings()`
212
+
213
+ Returns `{ settings: ThemeSettings, set: (patch: Partial<ThemeSettings>) => void }`. Use this hook from any component inside `Provider` to read or update the current theme settings.
214
+
215
+ ```tsx
216
+ import { useThemeSettings } from '@rific/auto-paper'
217
+
218
+ const { settings, set } = useThemeSettings()
219
+
220
+ set({ appearance: 'dark' })
221
+ set({ color: '#e91e63' })
222
+ set({ harmony: 'triadic' })
223
+ ```
224
+
190
225
  ### `useComputedTheme(appearance, color, harmony?)`
191
226
 
192
227
  Returns `MD3Theme | null`. `null` on the first render while the theme computes.
@@ -228,6 +263,48 @@ import { BottomNavigation } from '@rific/auto-paper'
228
263
 
229
264
  `BottomNavigation.Bar` and `BottomNavigation.SceneMap` are also available and both sync the navigation bar.
230
265
 
266
+ ### `Chip`
267
+
268
+ A thin wrapper around `react-native-paper`'s `Chip` that adds a `variant` prop for applying theme-derived container colors.
269
+
270
+ ```tsx
271
+ import { Chip } from '@rific/auto-paper'
272
+
273
+ <Chip>Default</Chip>
274
+ <Chip variant="primary">Primary</Chip>
275
+ <Chip variant="secondary">Secondary</Chip>
276
+ <Chip variant="tertiary">Tertiary</Chip>
277
+ <Chip variant="surface">Surface</Chip>
278
+ ```
279
+
280
+ | Prop | Type | Description |
281
+ |---|---|---|
282
+ | `variant` | `'primary' \| 'secondary' \| 'tertiary' \| 'surface'` | Applies the matching container color as background and its `on*` counterpart as `selectedColor` |
283
+ | ...all `ChipProps` | | All props from `react-native-paper`'s `Chip` are supported |
284
+
285
+ `ChipProps` is exported from `@rific/auto-paper` and extends `react-native-paper`'s `ChipProps` with the `variant` field. Use `PaperChipProps` if you need the base paper type.
286
+
287
+ ### `IconButton`
288
+
289
+ A thin wrapper around `react-native-paper`'s `IconButton` that adds a `variant` prop for applying theme-derived container and icon colors.
290
+
291
+ ```tsx
292
+ import { IconButton } from '@rific/auto-paper'
293
+
294
+ <IconButton icon="pencil" />
295
+ <IconButton icon="pencil" variant="primary" />
296
+ <IconButton icon="pencil" variant="secondary" />
297
+ <IconButton icon="pencil" variant="tertiary" />
298
+ <IconButton icon="pencil" variant="surface" />
299
+ ```
300
+
301
+ | Prop | Type | Description |
302
+ |---|---|---|
303
+ | `variant` | `'primary' \| 'secondary' \| 'tertiary' \| 'surface'` | Sets `containerColor` and `iconColor` from the matching theme color pair |
304
+ | ...all `IconButtonProps` | | All props from `react-native-paper`'s `IconButton` are supported — explicit `containerColor` or `iconColor` override the variant |
305
+
306
+ `IconButtonProps` is exported from `@rific/auto-paper` and extends `react-native-paper`'s `IconButtonProps` with the `variant` field. Use `PaperIconButtonProps` if you need the base paper type.
307
+
231
308
  ### `PaperDefaults` / `usePaperDefaults`
232
309
 
233
310
  `PaperDefaults` is the type for the `defaults` prop on `Provider`:
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
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
4
  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';
9
- import * as react_jsx_runtime from 'react/jsx-runtime';
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
+ export { AppbarHeaderProps, BottomNavigationProps, BottomNavigationRoute, ButtonProps, FABProps, ChipProps as PaperChipProps, DialogProps as PaperDialogProps, IconButtonProps as PaperIconButtonProps, MenuProps as PaperMenuProps, TextInputProps } from 'react-native-paper';
7
+ import * as react from 'react';
8
+ import react__default, { ReactNode } from 'react';
10
9
  import { BlurViewProps as BlurViewProps$1 } from 'expo-blur';
11
10
  import * as _reduxjs_toolkit from '@reduxjs/toolkit';
12
11
  import { PayloadAction } from '@reduxjs/toolkit';
@@ -14,11 +13,11 @@ import * as redux from 'redux';
14
13
 
15
14
  declare function useBlur(override?: boolean): boolean;
16
15
 
17
- declare function Header({ style, ...props }: AppbarHeaderProps): react_jsx_runtime.JSX.Element;
16
+ declare function Header({ style, ...props }: AppbarHeaderProps): react.JSX.Element;
18
17
  declare const Appbar: {
19
18
  Header: typeof Header;
20
19
  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;
20
+ ({ color: titleColor, subtitle, subtitleStyle, onPress, disabled, style, titleRef, titleStyle, title, titleMaxFontSizeMultiplier, mode, theme: themeOverrides, testID, ...rest }: react_native_paper.Props): react.JSX.Element;
22
21
  displayName: string;
23
22
  };
24
23
  Action: react_native_paper_lib_typescript_utils_forwardRef.ForwardRefComponent<react_native.View, react_native_paper.AppbarActionProps>;
@@ -40,7 +39,7 @@ type Props$2 = {
40
39
  value: ThemeAppearance;
41
40
  onChange: (appearance: ThemeAppearance) => void;
42
41
  };
43
- declare const AppearancePicker: ({ value, onChange }: Props$2) => react_jsx_runtime.JSX.Element;
42
+ declare const AppearancePicker: ({ value, onChange }: Props$2) => react.JSX.Element;
44
43
 
45
44
  type BlurViewProps = BlurViewProps$1 & {
46
45
  blur?: boolean;
@@ -48,27 +47,30 @@ type BlurViewProps = BlurViewProps$1 & {
48
47
  elevation?: 0 | 1 | 2 | 3 | 4 | 5;
49
48
  style?: StyleProp<ViewStyle>;
50
49
  };
51
- declare const BlurView: ({ blur, children, elevation, style, ...props }: BlurViewProps) => react_jsx_runtime.JSX.Element;
50
+ declare const BlurView: ({ blur, children, elevation, style, ...props }: BlurViewProps) => react.JSX.Element;
52
51
 
53
- declare function BottomNavigationComponent<Route extends BottomNavigationRoute>(props: BottomNavigationProps<Route>): react_jsx_runtime.JSX.Element;
52
+ declare function BottomNavigationComponent<Route extends BottomNavigationRoute>(props: BottomNavigationProps<Route>): react__default.JSX.Element;
54
53
  declare namespace BottomNavigationComponent {
55
- var Bar: (props: BarProps) => react_jsx_runtime.JSX.Element;
54
+ var Bar: (props: BarProps) => react__default.JSX.Element;
56
55
  var SceneMap: <Route extends BottomNavigationRoute>(scenes: {
57
- [key: string]: React__default.ComponentType<{
56
+ [key: string]: react__default.ComponentType<{
58
57
  route: Route;
59
58
  jumpTo: (key: string) => void;
60
59
  }>;
61
60
  }) => ({ route, jumpTo, }: {
62
61
  route: Route;
63
62
  jumpTo: (key: string) => void;
64
- }) => React__default.JSX.Element;
63
+ }) => react__default.JSX.Element;
65
64
  }
66
- type BarProps = React__default.ComponentProps<typeof BottomNavigation$1.Bar>;
65
+ type BarProps = react__default.ComponentProps<typeof BottomNavigation$1.Bar>;
67
66
  declare const BottomNavigation: typeof BottomNavigationComponent;
68
67
 
69
- declare function Button(props: ButtonProps): react_jsx_runtime.JSX.Element;
68
+ declare function Button(props: ButtonProps): react.JSX.Element;
70
69
 
71
- declare function Chip(props: ChipProps): react_jsx_runtime.JSX.Element;
70
+ type ChipProps = ChipProps$1 & {
71
+ variant?: 'primary' | 'secondary' | 'tertiary' | 'surface';
72
+ };
73
+ declare function Chip({ variant, style, selectedColor, ...props }: ChipProps): react.JSX.Element;
72
74
 
73
75
  type SeedColor = {
74
76
  label: string;
@@ -81,47 +83,50 @@ type Props$1 = {
81
83
  colors?: SeedColor[];
82
84
  blur?: boolean;
83
85
  };
84
- declare const ColorPicker: ({ value, onChange, colors, blur: blurProp }: Props$1) => react_jsx_runtime.JSX.Element;
86
+ declare const ColorPicker: ({ value, onChange, colors, blur: blurProp }: Props$1) => react.JSX.Element;
85
87
 
86
88
  type DialogProps = DialogProps$1 & {
87
89
  blur?: boolean;
88
90
  };
89
- declare function DialogComponent({ blur: blurProp, visible, onDismiss, children, style, ...rest }: DialogProps): react_jsx_runtime.JSX.Element | null;
91
+ declare function DialogComponent({ blur: blurProp, visible, onDismiss, children, style, ...rest }: DialogProps): react__default.JSX.Element | null;
90
92
  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>;
93
+ var Title: react__default.FC<DialogTitleProps>;
94
+ var Content: react__default.FC<DialogContentProps>;
95
+ var Actions: react__default.FC<DialogActionsProps>;
96
+ var ScrollArea: react__default.FC<DialogScrollAreaProps>;
95
97
  }
96
98
  declare const Dialog: typeof DialogComponent;
97
99
 
98
- declare function FAB(props: FABProps): react_jsx_runtime.JSX.Element;
100
+ declare function FAB(props: FABProps): react.JSX.Element;
99
101
 
100
102
  type Props = {
101
103
  value: ColorHarmony;
102
104
  onChange: (harmony: ColorHarmony) => void;
103
105
  blur?: boolean;
104
106
  };
105
- declare const HarmonyPicker: ({ value, onChange, blur: blurProp }: Props) => react_jsx_runtime.JSX.Element;
107
+ declare const HarmonyPicker: ({ value, onChange, blur: blurProp }: Props) => react.JSX.Element;
106
108
 
107
- declare function IconButton(props: IconButtonProps): react_jsx_runtime.JSX.Element;
109
+ type IconButtonProps = IconButtonProps$1 & {
110
+ variant?: 'primary' | 'secondary' | 'tertiary' | 'surface';
111
+ };
112
+ declare function IconButton({ variant, iconColor, containerColor, ...props }: IconButtonProps): react.JSX.Element;
108
113
 
109
114
  type MenuProps = MenuProps$1 & {
110
115
  blur?: boolean;
111
116
  };
112
- declare const Menu: (({ blur: blurProp, children, ...props }: MenuProps) => react_jsx_runtime.JSX.Element) & {
113
- Item: React__default.FC<MenuItemProps>;
117
+ declare const Menu: (({ blur: blurProp, children, ...props }: MenuProps) => react__default.JSX.Element) & {
118
+ Item: react__default.FC<MenuItemProps>;
114
119
  };
115
120
 
116
- declare const TextInput: React.ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & React.RefAttributes<TextInput$1>>;
121
+ declare const TextInput: react.ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & react.RefAttributes<TextInput$1>>;
117
122
 
118
123
  type PaperDefaults = {
119
124
  AppbarHeader?: Partial<AppbarHeaderProps>;
120
125
  BottomNavigation?: Partial<BottomNavigationProps<BottomNavigationRoute>>;
121
126
  Button?: Partial<ButtonProps>;
122
- Chip?: Partial<ChipProps>;
127
+ Chip?: Partial<ChipProps$1>;
123
128
  FAB?: Partial<FABProps>;
124
- IconButton?: Partial<IconButtonProps>;
129
+ IconButton?: Partial<IconButtonProps$1>;
125
130
  TextInput?: Partial<TextInputProps>;
126
131
  };
127
132
  declare function usePaperDefaults(): PaperDefaults;
@@ -188,10 +193,10 @@ type ThemeSettingsContextType = {
188
193
  settings: ThemeSettings;
189
194
  set: (patch: Partial<ThemeSettings>) => void;
190
195
  };
191
- declare const ThemeSettingsContext: React.Context<ThemeSettingsContextType>;
196
+ declare const ThemeSettingsContext: react.Context<ThemeSettingsContextType>;
192
197
 
193
198
  type ProviderProps = {
194
- overrides?: Partial<ThemeSettings>;
199
+ initialValue?: Partial<ThemeSettings>;
195
200
  onChange?: (settings: ThemeSettings) => void;
196
201
  children: ReactNode;
197
202
  defaults?: PaperDefaults;
@@ -200,7 +205,7 @@ type ProviderProps = {
200
205
  statusBarProps?: StatusBarProps;
201
206
  style?: StyleProp<ViewStyle>;
202
207
  };
203
- declare function Provider({ overrides, onChange, children, defaults, onNavBarChange, onReady, statusBarProps, style }: ProviderProps): react_jsx_runtime.JSX.Element | null;
208
+ declare function Provider({ initialValue, onChange, children, defaults, onNavBarChange, onReady, statusBarProps, style }: ProviderProps): react.JSX.Element | null;
204
209
 
205
210
  declare const useThemeSettings: () => ThemeSettingsContextType;
206
211
 
@@ -218,4 +223,4 @@ declare const getRgb: (value: string) => RGB | null;
218
223
 
219
224
  declare const isDarkColor: (value: string) => boolean;
220
225
 
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 };
226
+ export { Appbar, AppearancePicker, BlurView, type BlurViewProps, BottomNavigation, Button, Chip, type ChipProps, type ColorHarmony, ColorPicker, Dialog, type DialogProps, FAB, HarmonyPicker, IconButton, type IconButtonProps, 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,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
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
4
  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';
9
- import * as react_jsx_runtime from 'react/jsx-runtime';
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
+ export { AppbarHeaderProps, BottomNavigationProps, BottomNavigationRoute, ButtonProps, FABProps, ChipProps as PaperChipProps, DialogProps as PaperDialogProps, IconButtonProps as PaperIconButtonProps, MenuProps as PaperMenuProps, TextInputProps } from 'react-native-paper';
7
+ import * as react from 'react';
8
+ import react__default, { ReactNode } from 'react';
10
9
  import { BlurViewProps as BlurViewProps$1 } from 'expo-blur';
11
10
  import * as _reduxjs_toolkit from '@reduxjs/toolkit';
12
11
  import { PayloadAction } from '@reduxjs/toolkit';
@@ -14,11 +13,11 @@ import * as redux from 'redux';
14
13
 
15
14
  declare function useBlur(override?: boolean): boolean;
16
15
 
17
- declare function Header({ style, ...props }: AppbarHeaderProps): react_jsx_runtime.JSX.Element;
16
+ declare function Header({ style, ...props }: AppbarHeaderProps): react.JSX.Element;
18
17
  declare const Appbar: {
19
18
  Header: typeof Header;
20
19
  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;
20
+ ({ color: titleColor, subtitle, subtitleStyle, onPress, disabled, style, titleRef, titleStyle, title, titleMaxFontSizeMultiplier, mode, theme: themeOverrides, testID, ...rest }: react_native_paper.Props): react.JSX.Element;
22
21
  displayName: string;
23
22
  };
24
23
  Action: react_native_paper_lib_typescript_utils_forwardRef.ForwardRefComponent<react_native.View, react_native_paper.AppbarActionProps>;
@@ -40,7 +39,7 @@ type Props$2 = {
40
39
  value: ThemeAppearance;
41
40
  onChange: (appearance: ThemeAppearance) => void;
42
41
  };
43
- declare const AppearancePicker: ({ value, onChange }: Props$2) => react_jsx_runtime.JSX.Element;
42
+ declare const AppearancePicker: ({ value, onChange }: Props$2) => react.JSX.Element;
44
43
 
45
44
  type BlurViewProps = BlurViewProps$1 & {
46
45
  blur?: boolean;
@@ -48,27 +47,30 @@ type BlurViewProps = BlurViewProps$1 & {
48
47
  elevation?: 0 | 1 | 2 | 3 | 4 | 5;
49
48
  style?: StyleProp<ViewStyle>;
50
49
  };
51
- declare const BlurView: ({ blur, children, elevation, style, ...props }: BlurViewProps) => react_jsx_runtime.JSX.Element;
50
+ declare const BlurView: ({ blur, children, elevation, style, ...props }: BlurViewProps) => react.JSX.Element;
52
51
 
53
- declare function BottomNavigationComponent<Route extends BottomNavigationRoute>(props: BottomNavigationProps<Route>): react_jsx_runtime.JSX.Element;
52
+ declare function BottomNavigationComponent<Route extends BottomNavigationRoute>(props: BottomNavigationProps<Route>): react__default.JSX.Element;
54
53
  declare namespace BottomNavigationComponent {
55
- var Bar: (props: BarProps) => react_jsx_runtime.JSX.Element;
54
+ var Bar: (props: BarProps) => react__default.JSX.Element;
56
55
  var SceneMap: <Route extends BottomNavigationRoute>(scenes: {
57
- [key: string]: React__default.ComponentType<{
56
+ [key: string]: react__default.ComponentType<{
58
57
  route: Route;
59
58
  jumpTo: (key: string) => void;
60
59
  }>;
61
60
  }) => ({ route, jumpTo, }: {
62
61
  route: Route;
63
62
  jumpTo: (key: string) => void;
64
- }) => React__default.JSX.Element;
63
+ }) => react__default.JSX.Element;
65
64
  }
66
- type BarProps = React__default.ComponentProps<typeof BottomNavigation$1.Bar>;
65
+ type BarProps = react__default.ComponentProps<typeof BottomNavigation$1.Bar>;
67
66
  declare const BottomNavigation: typeof BottomNavigationComponent;
68
67
 
69
- declare function Button(props: ButtonProps): react_jsx_runtime.JSX.Element;
68
+ declare function Button(props: ButtonProps): react.JSX.Element;
70
69
 
71
- declare function Chip(props: ChipProps): react_jsx_runtime.JSX.Element;
70
+ type ChipProps = ChipProps$1 & {
71
+ variant?: 'primary' | 'secondary' | 'tertiary' | 'surface';
72
+ };
73
+ declare function Chip({ variant, style, selectedColor, ...props }: ChipProps): react.JSX.Element;
72
74
 
73
75
  type SeedColor = {
74
76
  label: string;
@@ -81,47 +83,50 @@ type Props$1 = {
81
83
  colors?: SeedColor[];
82
84
  blur?: boolean;
83
85
  };
84
- declare const ColorPicker: ({ value, onChange, colors, blur: blurProp }: Props$1) => react_jsx_runtime.JSX.Element;
86
+ declare const ColorPicker: ({ value, onChange, colors, blur: blurProp }: Props$1) => react.JSX.Element;
85
87
 
86
88
  type DialogProps = DialogProps$1 & {
87
89
  blur?: boolean;
88
90
  };
89
- declare function DialogComponent({ blur: blurProp, visible, onDismiss, children, style, ...rest }: DialogProps): react_jsx_runtime.JSX.Element | null;
91
+ declare function DialogComponent({ blur: blurProp, visible, onDismiss, children, style, ...rest }: DialogProps): react__default.JSX.Element | null;
90
92
  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>;
93
+ var Title: react__default.FC<DialogTitleProps>;
94
+ var Content: react__default.FC<DialogContentProps>;
95
+ var Actions: react__default.FC<DialogActionsProps>;
96
+ var ScrollArea: react__default.FC<DialogScrollAreaProps>;
95
97
  }
96
98
  declare const Dialog: typeof DialogComponent;
97
99
 
98
- declare function FAB(props: FABProps): react_jsx_runtime.JSX.Element;
100
+ declare function FAB(props: FABProps): react.JSX.Element;
99
101
 
100
102
  type Props = {
101
103
  value: ColorHarmony;
102
104
  onChange: (harmony: ColorHarmony) => void;
103
105
  blur?: boolean;
104
106
  };
105
- declare const HarmonyPicker: ({ value, onChange, blur: blurProp }: Props) => react_jsx_runtime.JSX.Element;
107
+ declare const HarmonyPicker: ({ value, onChange, blur: blurProp }: Props) => react.JSX.Element;
106
108
 
107
- declare function IconButton(props: IconButtonProps): react_jsx_runtime.JSX.Element;
109
+ type IconButtonProps = IconButtonProps$1 & {
110
+ variant?: 'primary' | 'secondary' | 'tertiary' | 'surface';
111
+ };
112
+ declare function IconButton({ variant, iconColor, containerColor, ...props }: IconButtonProps): react.JSX.Element;
108
113
 
109
114
  type MenuProps = MenuProps$1 & {
110
115
  blur?: boolean;
111
116
  };
112
- declare const Menu: (({ blur: blurProp, children, ...props }: MenuProps) => react_jsx_runtime.JSX.Element) & {
113
- Item: React__default.FC<MenuItemProps>;
117
+ declare const Menu: (({ blur: blurProp, children, ...props }: MenuProps) => react__default.JSX.Element) & {
118
+ Item: react__default.FC<MenuItemProps>;
114
119
  };
115
120
 
116
- declare const TextInput: React.ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & React.RefAttributes<TextInput$1>>;
121
+ declare const TextInput: react.ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & react.RefAttributes<TextInput$1>>;
117
122
 
118
123
  type PaperDefaults = {
119
124
  AppbarHeader?: Partial<AppbarHeaderProps>;
120
125
  BottomNavigation?: Partial<BottomNavigationProps<BottomNavigationRoute>>;
121
126
  Button?: Partial<ButtonProps>;
122
- Chip?: Partial<ChipProps>;
127
+ Chip?: Partial<ChipProps$1>;
123
128
  FAB?: Partial<FABProps>;
124
- IconButton?: Partial<IconButtonProps>;
129
+ IconButton?: Partial<IconButtonProps$1>;
125
130
  TextInput?: Partial<TextInputProps>;
126
131
  };
127
132
  declare function usePaperDefaults(): PaperDefaults;
@@ -188,10 +193,10 @@ type ThemeSettingsContextType = {
188
193
  settings: ThemeSettings;
189
194
  set: (patch: Partial<ThemeSettings>) => void;
190
195
  };
191
- declare const ThemeSettingsContext: React.Context<ThemeSettingsContextType>;
196
+ declare const ThemeSettingsContext: react.Context<ThemeSettingsContextType>;
192
197
 
193
198
  type ProviderProps = {
194
- overrides?: Partial<ThemeSettings>;
199
+ initialValue?: Partial<ThemeSettings>;
195
200
  onChange?: (settings: ThemeSettings) => void;
196
201
  children: ReactNode;
197
202
  defaults?: PaperDefaults;
@@ -200,7 +205,7 @@ type ProviderProps = {
200
205
  statusBarProps?: StatusBarProps;
201
206
  style?: StyleProp<ViewStyle>;
202
207
  };
203
- declare function Provider({ overrides, onChange, children, defaults, onNavBarChange, onReady, statusBarProps, style }: ProviderProps): react_jsx_runtime.JSX.Element | null;
208
+ declare function Provider({ initialValue, onChange, children, defaults, onNavBarChange, onReady, statusBarProps, style }: ProviderProps): react.JSX.Element | null;
204
209
 
205
210
  declare const useThemeSettings: () => ThemeSettingsContextType;
206
211
 
@@ -218,4 +223,4 @@ declare const getRgb: (value: string) => RGB | null;
218
223
 
219
224
  declare const isDarkColor: (value: string) => boolean;
220
225
 
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 };
226
+ export { Appbar, AppearancePicker, BlurView, type BlurViewProps, BottomNavigation, Button, Chip, type ChipProps, type ColorHarmony, ColorPicker, Dialog, type DialogProps, FAB, HarmonyPicker, IconButton, type IconButtonProps, 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.js CHANGED
@@ -589,8 +589,8 @@ function useComputedTheme(appearance, color, harmony = "split-complementary") {
589
589
  var import_jsx_runtime4 = require("react/jsx-runtime");
590
590
  var NavBarContext = (0, import_react6.createContext)({});
591
591
  var useNavBarContext = () => (0, import_react6.useContext)(NavBarContext);
592
- function Provider({ overrides, onChange, children, defaults, onNavBarChange, onReady, statusBarProps, style }) {
593
- const [settings, setSettings] = (0, import_react6.useState)(() => ({ ...defaultThemeSettings, ...overrides }));
592
+ function Provider({ initialValue, onChange, children, defaults, onNavBarChange, onReady, statusBarProps, style }) {
593
+ const [settings, setSettings] = (0, import_react6.useState)(() => ({ ...defaultThemeSettings, ...initialValue }));
594
594
  const set2 = (0, import_react6.useCallback)(
595
595
  (patch) => {
596
596
  setSettings((prev) => {
@@ -653,9 +653,12 @@ function Button(props) {
653
653
  // src/components/Chip.tsx
654
654
  var import_react_native_paper8 = require("react-native-paper");
655
655
  var import_jsx_runtime7 = require("react/jsx-runtime");
656
- function Chip(props) {
656
+ function Chip({ variant, style, selectedColor, ...props }) {
657
657
  const defaults = usePaperDefaults();
658
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native_paper8.Chip, { ...defaults.Chip, ...props });
658
+ const { colors } = (0, import_react_native_paper8.useTheme)();
659
+ const variantStyle = variant === "primary" ? { backgroundColor: colors.primaryContainer } : variant === "secondary" ? { backgroundColor: colors.secondaryContainer } : variant === "tertiary" ? { backgroundColor: colors.tertiaryContainer } : variant === "surface" ? { backgroundColor: colors.surface } : void 0;
660
+ const variantSelectedColor = variant === "primary" ? colors.onPrimaryContainer : variant === "secondary" ? colors.onSecondaryContainer : variant === "tertiary" ? colors.onTertiaryContainer : variant === "surface" ? colors.onSurface : void 0;
661
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_native_paper8.Chip, { ...defaults.Chip, selectedColor: selectedColor ?? variantSelectedColor, ...props, style: [variantStyle, style] });
659
662
  }
660
663
 
661
664
  // src/components/ColorPicker.tsx
@@ -815,9 +818,12 @@ var HarmonyPicker = ({ value, onChange, blur: blurProp }) => {
815
818
  // src/components/IconButton.tsx
816
819
  var import_react_native_paper14 = require("react-native-paper");
817
820
  var import_jsx_runtime13 = require("react/jsx-runtime");
818
- function IconButton(props) {
821
+ function IconButton({ variant, iconColor, containerColor, ...props }) {
819
822
  const defaults = usePaperDefaults();
820
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native_paper14.IconButton, { ...defaults.IconButton, ...props });
823
+ const { colors } = (0, import_react_native_paper14.useTheme)();
824
+ const variantContainerColor = variant === "primary" ? colors.primaryContainer : variant === "secondary" ? colors.secondaryContainer : variant === "tertiary" ? colors.tertiaryContainer : variant === "surface" ? colors.surface : void 0;
825
+ const variantIconColor = variant === "primary" ? colors.onPrimaryContainer : variant === "secondary" ? colors.onSecondaryContainer : variant === "tertiary" ? colors.onTertiaryContainer : variant === "surface" ? colors.onSurface : void 0;
826
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native_paper14.IconButton, { ...defaults.IconButton, containerColor: containerColor ?? variantContainerColor, iconColor: iconColor ?? variantIconColor, ...props });
821
827
  }
822
828
 
823
829
  // src/components/TextInput.tsx
package/dist/index.mjs CHANGED
@@ -533,8 +533,8 @@ function useComputedTheme(appearance, color, harmony = "split-complementary") {
533
533
  import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
534
534
  var NavBarContext = createContext3({});
535
535
  var useNavBarContext = () => useContext4(NavBarContext);
536
- function Provider({ overrides, onChange, children, defaults, onNavBarChange, onReady, statusBarProps, style }) {
537
- const [settings, setSettings] = useState2(() => ({ ...defaultThemeSettings, ...overrides }));
536
+ function Provider({ initialValue, onChange, children, defaults, onNavBarChange, onReady, statusBarProps, style }) {
537
+ const [settings, setSettings] = useState2(() => ({ ...defaultThemeSettings, ...initialValue }));
538
538
  const set2 = useCallback2(
539
539
  (patch) => {
540
540
  setSettings((prev) => {
@@ -595,11 +595,14 @@ function Button(props) {
595
595
  }
596
596
 
597
597
  // src/components/Chip.tsx
598
- import { Chip as PaperChip } from "react-native-paper";
598
+ import { Chip as PaperChip, useTheme as useTheme4 } from "react-native-paper";
599
599
  import { jsx as jsx7 } from "react/jsx-runtime";
600
- function Chip(props) {
600
+ function Chip({ variant, style, selectedColor, ...props }) {
601
601
  const defaults = usePaperDefaults();
602
- return /* @__PURE__ */ jsx7(PaperChip, { ...defaults.Chip, ...props });
602
+ const { colors } = useTheme4();
603
+ const variantStyle = variant === "primary" ? { backgroundColor: colors.primaryContainer } : variant === "secondary" ? { backgroundColor: colors.secondaryContainer } : variant === "tertiary" ? { backgroundColor: colors.tertiaryContainer } : variant === "surface" ? { backgroundColor: colors.surface } : void 0;
604
+ const variantSelectedColor = variant === "primary" ? colors.onPrimaryContainer : variant === "secondary" ? colors.onSecondaryContainer : variant === "tertiary" ? colors.onTertiaryContainer : variant === "surface" ? colors.onSurface : void 0;
605
+ return /* @__PURE__ */ jsx7(PaperChip, { ...defaults.Chip, selectedColor: selectedColor ?? variantSelectedColor, ...props, style: [variantStyle, style] });
603
606
  }
604
607
 
605
608
  // src/components/ColorPicker.tsx
@@ -610,11 +613,11 @@ import { Icon, TouchableRipple } from "react-native-paper";
610
613
  // src/components/Dialog.tsx
611
614
  import { useEffect as useEffect4, useRef as useRef2, useState as useState3 } from "react";
612
615
  import { Animated, StyleSheet as StyleSheet3, TouchableWithoutFeedback, View as View3 } from "react-native";
613
- import { Dialog as PaperDialog, Portal, useTheme as useTheme4 } from "react-native-paper";
616
+ import { Dialog as PaperDialog, Portal, useTheme as useTheme5 } from "react-native-paper";
614
617
  import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
615
618
  function DialogComponent({ blur: blurProp, visible, onDismiss, children, style, ...rest }) {
616
619
  const blur = useBlur(blurProp);
617
- const { roundness, colors } = useTheme4();
620
+ const { roundness, colors } = useTheme5();
618
621
  const opacity = useRef2(new Animated.Value(0)).current;
619
622
  const [mounted, setMounted] = useState3(visible);
620
623
  useEffect4(() => {
@@ -757,11 +760,14 @@ var HarmonyPicker = ({ value, onChange, blur: blurProp }) => {
757
760
  };
758
761
 
759
762
  // src/components/IconButton.tsx
760
- import { IconButton as PaperIconButton } from "react-native-paper";
763
+ import { IconButton as PaperIconButton, useTheme as useTheme6 } from "react-native-paper";
761
764
  import { jsx as jsx13 } from "react/jsx-runtime";
762
- function IconButton(props) {
765
+ function IconButton({ variant, iconColor, containerColor, ...props }) {
763
766
  const defaults = usePaperDefaults();
764
- return /* @__PURE__ */ jsx13(PaperIconButton, { ...defaults.IconButton, ...props });
767
+ const { colors } = useTheme6();
768
+ const variantContainerColor = variant === "primary" ? colors.primaryContainer : variant === "secondary" ? colors.secondaryContainer : variant === "tertiary" ? colors.tertiaryContainer : variant === "surface" ? colors.surface : void 0;
769
+ const variantIconColor = variant === "primary" ? colors.onPrimaryContainer : variant === "secondary" ? colors.onSecondaryContainer : variant === "tertiary" ? colors.onTertiaryContainer : variant === "surface" ? colors.onSurface : void 0;
770
+ return /* @__PURE__ */ jsx13(PaperIconButton, { ...defaults.IconButton, containerColor: containerColor ?? variantContainerColor, iconColor: iconColor ?? variantIconColor, ...props });
765
771
  }
766
772
 
767
773
  // src/components/TextInput.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rific/auto-paper",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
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",
@@ -56,6 +56,9 @@
56
56
  "typecheck": "tsc --noEmit",
57
57
  "preversion": "npm run lint && npm test && npm run build"
58
58
  },
59
+ "overrides": {
60
+ "esbuild": "0.28.1"
61
+ },
59
62
  "devDependencies": {
60
63
  "@reduxjs/toolkit": "^2.0.0",
61
64
  "@testing-library/dom": "^10.4.1",