@rific/auto-paper 0.6.4 → 0.8.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 +77 -5
- package/dist/index.d.mts +63 -10
- package/dist/index.d.ts +63 -10
- package/dist/index.js +238 -63
- package/dist/index.mjs +222 -62
- package/package.json +4 -2
- package/src/components/AppearancePicker.tsx +25 -5
- package/src/components/BlurView.tsx +1 -1
- package/src/components/ColorPicker.tsx +17 -10
- package/src/components/Dialog.tsx +57 -22
- package/src/components/PalettePicker.tsx +117 -0
- package/src/index.ts +9 -2
- package/src/useComputedTheme.ts +87 -21
- package/src/useSwatchGrid.ts +18 -0
- package/src/useTheme.ts +11 -0
- package/src/utils/getColorRoles.ts +29 -0
- package/src/utils/getSwatchContrast.ts +26 -0
package/README.md
CHANGED
|
@@ -7,8 +7,9 @@ Adaptive theming for [`react-native-paper`](https://callstack.github.io/react-na
|
|
|
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
|
+
- Fixed `success`/`warning`/`danger` semantic color roles (each with `on*`/`*Container` variants) alongside MD3's built-in `error`
|
|
10
11
|
- Optional Redux slice for wiring appearance and color into your store
|
|
11
|
-
- Wrapper components (`Appbar`, `AppearancePicker`, `BlurView`, `BottomNavigation`, `Button`, `Chip`, `ColorPicker`, `Dialog`, `FAB`, `HarmonyPicker`, `IconButton`, `Menu`, `TextInput`) with prop defaults via context
|
|
12
|
+
- Wrapper components (`Appbar`, `AppearancePicker`, `BlurView`, `BottomNavigation`, `Button`, `Chip`, `ColorPicker`, `Dialog`, `FAB`, `HarmonyPicker`, `IconButton`, `Menu`, `PalettePicker`, `TextInput`) with prop defaults via context
|
|
12
13
|
- All color utilities exported for standalone use
|
|
13
14
|
|
|
14
15
|
## Installation
|
|
@@ -111,7 +112,7 @@ import { Button, Chip, Provider as AutoPaperProvider } from '@rific/auto-paper'
|
|
|
111
112
|
</AutoPaperProvider>
|
|
112
113
|
```
|
|
113
114
|
|
|
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
|
+
Available wrapper components: `Appbar`, `AppearancePicker`, `BlurView`, `BottomNavigation`, `Button`, `Chip`, `ColorPicker`, `Dialog`, `FAB`, `HarmonyPicker`, `IconButton`, `Menu`, `PalettePicker`, `TextInput`. Each is a thin wrapper around the matching `react-native-paper` component and accepts the same props.
|
|
115
116
|
|
|
116
117
|
### With Redux
|
|
117
118
|
|
|
@@ -228,13 +229,60 @@ set({ harmony: 'triadic' })
|
|
|
228
229
|
|
|
229
230
|
### `useComputedTheme(appearance, color, harmony?)`
|
|
230
231
|
|
|
231
|
-
Returns `
|
|
232
|
+
Returns `AutoPaperTheme | null` — `MD3Theme` plus `success`/`warning`/`danger` color roles (see below). `null` on the first render while the theme computes.
|
|
232
233
|
|
|
233
234
|
```ts
|
|
234
235
|
const theme = useComputedTheme('system', '#6750a4')
|
|
235
236
|
const theme = useComputedTheme('system', '#6750a4', 'triadic')
|
|
236
237
|
```
|
|
237
238
|
|
|
239
|
+
Alongside the standard MD3 `primary`/`secondary`/`tertiary` roles derived from the seed color, `theme.colors` also carries three fixed semantic roles, each with the usual `color`/`onColor`/`Container`/`onContainer` quadruple (`success`, `onSuccess`, `successContainer`, `onSuccessContainer`, and likewise for `warning` and `danger`):
|
|
240
|
+
|
|
241
|
+
| Role | Base color |
|
|
242
|
+
|---|---|
|
|
243
|
+
| `success` | `SEMANTIC_BASE_COLORS.success` (`#2E7D32`) |
|
|
244
|
+
| `warning` | `SEMANTIC_BASE_COLORS.warning` (`#A15C00`) |
|
|
245
|
+
| `danger` | `SEMANTIC_BASE_COLORS.danger` (`#B00020`) |
|
|
246
|
+
|
|
247
|
+
These are fixed brand colors — like MD3's own `error`, which is left untouched — not derived from the seed; only their container blending adapts to light/dark mode. `danger` is deliberately separate from `error`: `react-native-paper` components (`TextInput`'s error state, `HelperText`, `Badge`) read `colors.error`/`colors.onError` directly, so redefining `error` itself would change form-validation colors app-wide.
|
|
248
|
+
|
|
249
|
+
```ts
|
|
250
|
+
import { SEMANTIC_BASE_COLORS } from '@rific/auto-paper'
|
|
251
|
+
import type { AutoPaperTheme, SemanticColorRoles } from '@rific/auto-paper'
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### `useAutoPaperTheme()`
|
|
255
|
+
|
|
256
|
+
A typed alternative to `react-native-paper`'s own `useTheme()` that returns `AutoPaperTheme` — the same theme, with `colors.success`/`warning`/`danger` (and their `on*`/`*Container` variants) typed in, so you get autocomplete without redeclaring the generic yourself at every call site.
|
|
257
|
+
|
|
258
|
+
```tsx
|
|
259
|
+
import { useAutoPaperTheme } from '@rific/auto-paper'
|
|
260
|
+
|
|
261
|
+
const { colors } = useAutoPaperTheme()
|
|
262
|
+
|
|
263
|
+
<Text style={{ color: colors.warning }}>Check your connection</Text>
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### `AppearancePicker`
|
|
267
|
+
|
|
268
|
+
A thin wrapper around `react-native-paper`'s `SegmentedButtons` for switching between `system`/`light`/`dark` appearance.
|
|
269
|
+
|
|
270
|
+
```tsx
|
|
271
|
+
import { AppearancePicker, useThemeSettings } from '@rific/auto-paper'
|
|
272
|
+
|
|
273
|
+
function SettingsScreen() {
|
|
274
|
+
const { settings: { appearance }, set } = useThemeSettings()
|
|
275
|
+
return <AppearancePicker value={appearance} onChange={(a) => set({ appearance: a })} />
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
| Prop | Type | Description |
|
|
280
|
+
|---|---|---|
|
|
281
|
+
| `value` | `ThemeAppearance` | Currently selected appearance |
|
|
282
|
+
| `onChange` | `(appearance: ThemeAppearance) => void` | Called when a segment is tapped |
|
|
283
|
+
| `showLabels` | `boolean` | Set `false` for icon-only segments — useful in tight layouts where "System" would truncate. `accessibilityLabel` is always set regardless, so screen readers still announce the full word. Defaults to `true` |
|
|
284
|
+
| `icons` | `AppearanceIcons` | Per-value icon overrides — pass just the ones you want to change (e.g. `{ system: 'theme-light-dark' }`), merged over the defaults (`monitor` / `white-balance-sunny` / `weather-night`) |
|
|
285
|
+
|
|
238
286
|
### `Appbar`
|
|
239
287
|
|
|
240
288
|
A thin wrapper around `react-native-paper`'s `Appbar` that automatically syncs `StatusBar` background color and bar style to the current theme surface color.
|
|
@@ -309,6 +357,28 @@ import { IconButton } from '@rific/auto-paper'
|
|
|
309
357
|
|
|
310
358
|
`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.
|
|
311
359
|
|
|
360
|
+
### `PalettePicker`
|
|
361
|
+
|
|
362
|
+
Like `ColorPicker`, but each swatch — and the trigger itself — renders the seed's full triadic palette as a 3-wedge pie instead of a flat color, so you see the whole result before picking.
|
|
363
|
+
|
|
364
|
+
```tsx
|
|
365
|
+
import { PalettePicker, useThemeSettings } from '@rific/auto-paper'
|
|
366
|
+
|
|
367
|
+
function SettingsScreen() {
|
|
368
|
+
const { settings: { color, harmony }, set } = useThemeSettings()
|
|
369
|
+
return <PalettePicker value={color} harmony={harmony} onChange={(c) => set({ color: c })} />
|
|
370
|
+
}
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
| Prop | Type | Description |
|
|
374
|
+
|---|---|---|
|
|
375
|
+
| `value` | `string` | Currently selected seed color |
|
|
376
|
+
| `onChange` | `(color: string) => void` | Called with the seed color when a swatch is tapped |
|
|
377
|
+
| `harmony` | `ColorHarmony` | Harmony used to compute each swatch's preview palette. Defaults to `'split-complementary'` |
|
|
378
|
+
| `weights` | `PaletteWeights` | Relative size of each wedge — `{ primary, secondary, tertiary }`. Defaults to `{ primary: 2, secondary: 1, tertiary: 1 }` (primary half the pie, secondary/tertiary a quarter each). Values are normalized, so any positive ratio works; keep each share at or under half the total so its wedge stays a single slice |
|
|
379
|
+
| `colors` | `SeedColor[]` | Seed color swatches to offer. Defaults to the same set as `ColorPicker` |
|
|
380
|
+
| `blur` | `boolean` | Overrides the ambient blur setting for this component's dialog |
|
|
381
|
+
|
|
312
382
|
### `PaperDefaults` / `usePaperDefaults`
|
|
313
383
|
|
|
314
384
|
`PaperDefaults` is the type for the `defaults` prop on `Provider`:
|
|
@@ -365,7 +435,7 @@ const appearance = useSelector((state: RootState) => selectThemeAppearance(state
|
|
|
365
435
|
### Color utilities
|
|
366
436
|
|
|
367
437
|
```ts
|
|
368
|
-
import { getTriadicPalette, getBlendedColor, isDarkColor, getRgb, getHex, getTonalColor, getTintTextColor } from '@rific/auto-paper'
|
|
438
|
+
import { getTriadicPalette, getBlendedColor, getColorRoles, getContrastColor, isDarkColor, getRgb, getHex, getTonalColor, getTintTextColor } from '@rific/auto-paper'
|
|
369
439
|
import type { ColorHarmony } from '@rific/auto-paper'
|
|
370
440
|
|
|
371
441
|
getTriadicPalette('#6750a4') // split-complementary (default)
|
|
@@ -375,7 +445,9 @@ getTriadicPalette('#6750a4', 'square')
|
|
|
375
445
|
getTriadicPalette('#6750a4', 'complementary')
|
|
376
446
|
getTriadicPalette('#6750a4', 'double-split')
|
|
377
447
|
|
|
378
|
-
getBlendedColor('#ff0000', '#0000ff', 0.5)
|
|
448
|
+
getBlendedColor('#ff0000', '#0000ff', 0.5) // → '#800080'
|
|
449
|
+
getColorRoles('#6750a4', '#fffbfe') // → { color, onColor, container, onContainer } — the MD3 color/onColor/container/onContainer math, generalized (this is what useComputedTheme uses internally for every role)
|
|
450
|
+
getContrastColor('#6750a4') // → '#ffffff' — black/white pick for content sitting on a fully saturated fill
|
|
379
451
|
isDarkColor('#6750a4') // → true
|
|
380
452
|
getRgb('coral') // → { r: 255, g: 127, b: 80 }
|
|
381
453
|
getHex('rgb(255, 0, 0)') // → '#ff0000'
|
package/dist/index.d.mts
CHANGED
|
@@ -29,13 +29,38 @@ type TriadicPalette = {
|
|
|
29
29
|
declare function getTriadicPalette(primaryColor: string, harmony?: ColorHarmony): TriadicPalette;
|
|
30
30
|
|
|
31
31
|
type ThemeAppearance = 'system' | 'light' | 'dark';
|
|
32
|
-
declare
|
|
32
|
+
declare const SEMANTIC_BASE_COLORS: {
|
|
33
|
+
success: string;
|
|
34
|
+
warning: string;
|
|
35
|
+
danger: string;
|
|
36
|
+
};
|
|
37
|
+
type SemanticColorRoles = {
|
|
38
|
+
success: string;
|
|
39
|
+
onSuccess: string;
|
|
40
|
+
successContainer: string;
|
|
41
|
+
onSuccessContainer: string;
|
|
42
|
+
warning: string;
|
|
43
|
+
onWarning: string;
|
|
44
|
+
warningContainer: string;
|
|
45
|
+
onWarningContainer: string;
|
|
46
|
+
danger: string;
|
|
47
|
+
onDanger: string;
|
|
48
|
+
dangerContainer: string;
|
|
49
|
+
onDangerContainer: string;
|
|
50
|
+
};
|
|
51
|
+
type AutoPaperTheme = Omit<MD3Theme, 'colors'> & {
|
|
52
|
+
colors: MD3Theme['colors'] & SemanticColorRoles;
|
|
53
|
+
};
|
|
54
|
+
declare function useComputedTheme(appearance: ThemeAppearance, color: string, harmony?: ColorHarmony): AutoPaperTheme | null;
|
|
33
55
|
|
|
34
|
-
type
|
|
56
|
+
type AppearanceIcons = Partial<Record<ThemeAppearance, string>>;
|
|
57
|
+
type Props$3 = {
|
|
35
58
|
value: ThemeAppearance;
|
|
36
59
|
onChange: (appearance: ThemeAppearance) => void;
|
|
60
|
+
showLabels?: boolean;
|
|
61
|
+
icons?: AppearanceIcons;
|
|
37
62
|
};
|
|
38
|
-
declare const AppearancePicker: ({ value, onChange }: Props$
|
|
63
|
+
declare const AppearancePicker: ({ value, onChange, showLabels, icons }: Props$3) => react.JSX.Element;
|
|
39
64
|
|
|
40
65
|
type ExpoBlurTint = 'light' | 'dark' | 'default' | 'extraLight' | 'regular' | 'prominent' | 'systemUltraThinMaterial' | 'systemThinMaterial' | 'systemMaterial' | 'systemThickMaterial' | 'systemChromeMaterial' | 'systemUltraThinMaterialLight' | 'systemThinMaterialLight' | 'systemMaterialLight' | 'systemThickMaterialLight' | 'systemChromeMaterialLight' | 'systemUltraThinMaterialDark' | 'systemThinMaterialDark' | 'systemMaterialDark' | 'systemThickMaterialDark' | 'systemChromeMaterialDark';
|
|
41
66
|
type ExpoBlurMethod = 'none' | 'dimezisBlurView' | 'dimezisBlurViewSdk31Plus';
|
|
@@ -86,18 +111,19 @@ type SeedColor = {
|
|
|
86
111
|
value: string;
|
|
87
112
|
};
|
|
88
113
|
declare const defaultColors: SeedColor[];
|
|
89
|
-
type Props$
|
|
114
|
+
type Props$2 = {
|
|
90
115
|
value: string;
|
|
91
116
|
onChange: (color: string) => void;
|
|
92
117
|
colors?: SeedColor[];
|
|
93
118
|
blur?: boolean;
|
|
94
119
|
};
|
|
95
|
-
declare const ColorPicker: ({ value, onChange, colors, blur: blurProp }: Props$
|
|
120
|
+
declare const ColorPicker: ({ value, onChange, colors, blur: blurProp }: Props$2) => react.JSX.Element;
|
|
96
121
|
|
|
97
|
-
type DialogProps = DialogProps$1 & {
|
|
122
|
+
type DialogProps = Omit<DialogProps$1, 'style'> & {
|
|
98
123
|
blur?: boolean;
|
|
124
|
+
style?: StyleProp<ViewStyle>;
|
|
99
125
|
};
|
|
100
|
-
declare function DialogComponent({ blur: blurProp, visible, onDismiss, children, style,
|
|
126
|
+
declare function DialogComponent({ blur: blurProp, dismissable, dismissableBackButton, visible, onDismiss, children, style, testID }: DialogProps): react__default.JSX.Element | null;
|
|
101
127
|
declare namespace DialogComponent {
|
|
102
128
|
var Title: react__default.FC<DialogTitleProps>;
|
|
103
129
|
var Content: react__default.FC<DialogContentProps>;
|
|
@@ -108,12 +134,12 @@ declare const Dialog: typeof DialogComponent;
|
|
|
108
134
|
|
|
109
135
|
declare function FAB(props: FABProps): react.JSX.Element;
|
|
110
136
|
|
|
111
|
-
type Props = {
|
|
137
|
+
type Props$1 = {
|
|
112
138
|
value: ColorHarmony;
|
|
113
139
|
onChange: (harmony: ColorHarmony) => void;
|
|
114
140
|
blur?: boolean;
|
|
115
141
|
};
|
|
116
|
-
declare const HarmonyPicker: ({ value, onChange, blur: blurProp }: Props) => react.JSX.Element;
|
|
142
|
+
declare const HarmonyPicker: ({ value, onChange, blur: blurProp }: Props$1) => react.JSX.Element;
|
|
117
143
|
|
|
118
144
|
type IconButtonProps = IconButtonProps$1 & {
|
|
119
145
|
variant?: 'primary' | 'secondary' | 'tertiary' | 'surface';
|
|
@@ -127,6 +153,21 @@ declare const Menu: (({ blur: blurProp, children, ...props }: MenuProps) => reac
|
|
|
127
153
|
Item: react__default.FC<MenuItemProps>;
|
|
128
154
|
};
|
|
129
155
|
|
|
156
|
+
type PaletteWeights = {
|
|
157
|
+
primary: number;
|
|
158
|
+
secondary: number;
|
|
159
|
+
tertiary: number;
|
|
160
|
+
};
|
|
161
|
+
type Props = {
|
|
162
|
+
value: string;
|
|
163
|
+
onChange: (color: string) => void;
|
|
164
|
+
harmony?: ColorHarmony;
|
|
165
|
+
weights?: PaletteWeights;
|
|
166
|
+
colors?: SeedColor[];
|
|
167
|
+
blur?: boolean;
|
|
168
|
+
};
|
|
169
|
+
declare const PalettePicker: ({ value, onChange, harmony, weights, colors, blur: blurProp }: Props) => react.JSX.Element;
|
|
170
|
+
|
|
130
171
|
declare const TextInput: react.ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & react.RefAttributes<TextInput$1>>;
|
|
131
172
|
|
|
132
173
|
type PaperDefaults = {
|
|
@@ -224,10 +265,20 @@ type ProviderProps = {
|
|
|
224
265
|
};
|
|
225
266
|
declare function Provider({ initialValue, onChange, children, defaults, onNavBarChange, onReady, statusBarProps, style }: ProviderProps): react.JSX.Element | null;
|
|
226
267
|
|
|
268
|
+
declare const useAutoPaperTheme: () => AutoPaperTheme;
|
|
269
|
+
|
|
227
270
|
declare const useThemeSettings: () => ThemeSettingsContextType;
|
|
228
271
|
|
|
229
272
|
declare const getBlendedColor: (foreground: string, background: string, alpha: number) => string;
|
|
230
273
|
|
|
274
|
+
type ColorRoles = {
|
|
275
|
+
color: string;
|
|
276
|
+
onColor: string;
|
|
277
|
+
container: string;
|
|
278
|
+
onContainer: string;
|
|
279
|
+
};
|
|
280
|
+
declare const getColorRoles: (base: string, surface: string, containerAlpha?: number) => ColorRoles;
|
|
281
|
+
|
|
231
282
|
declare const getHex: (value: string) => string | null;
|
|
232
283
|
|
|
233
284
|
type RGB = {
|
|
@@ -238,10 +289,12 @@ type RGB = {
|
|
|
238
289
|
};
|
|
239
290
|
declare const getRgb: (value: string) => RGB | null;
|
|
240
291
|
|
|
292
|
+
declare const getContrastColor: (color: string) => string;
|
|
293
|
+
|
|
241
294
|
declare const getTintTextColor: (tintColor: string, backdropColor: string, tintOpacity: number) => string;
|
|
242
295
|
|
|
243
296
|
declare const getTonalColor: (color: string, lightness: number) => string;
|
|
244
297
|
|
|
245
298
|
declare const isDarkColor: (value: string) => boolean;
|
|
246
299
|
|
|
247
|
-
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, getTintTextColor, getTonalColor, getTriadicPalette, isDarkColor, selectThemeAppearance, selectThemeBlur, selectThemeColor, selectThemeHarmony, themeActions, themeReducer, useBlur, useComputedTheme, usePaperDefaults, useThemeSettings };
|
|
300
|
+
export { Appbar, type AppearanceIcons, AppearancePicker, type AutoPaperTheme, BlurView, type BlurViewProps, BottomNavigation, Button, Chip, type ChipProps, type ColorHarmony, ColorPicker, type ColorRoles, Dialog, type DialogProps, FAB, HarmonyPicker, IconButton, type IconButtonProps, Menu, type MenuProps, PalettePicker, type PaletteWeights, type PaperDefaults, Provider, type ProviderProps, type RGB, SEMANTIC_BASE_COLORS, type SeedColor, type SemanticColorRoles, TextInput, type ThemeAppearance, type ThemeSettings, ThemeSettingsContext, type ThemeSettingsContextType, type ThemeState, type TriadicPalette, createThemeReducer, defaultColors, defaultThemeSettings, getBlendedColor, getColorRoles, getContrastColor, getHex, getRgb, getTintTextColor, getTonalColor, getTriadicPalette, isDarkColor, selectThemeAppearance, selectThemeBlur, selectThemeColor, selectThemeHarmony, themeActions, themeReducer, useAutoPaperTheme, useBlur, useComputedTheme, usePaperDefaults, useThemeSettings };
|
package/dist/index.d.ts
CHANGED
|
@@ -29,13 +29,38 @@ type TriadicPalette = {
|
|
|
29
29
|
declare function getTriadicPalette(primaryColor: string, harmony?: ColorHarmony): TriadicPalette;
|
|
30
30
|
|
|
31
31
|
type ThemeAppearance = 'system' | 'light' | 'dark';
|
|
32
|
-
declare
|
|
32
|
+
declare const SEMANTIC_BASE_COLORS: {
|
|
33
|
+
success: string;
|
|
34
|
+
warning: string;
|
|
35
|
+
danger: string;
|
|
36
|
+
};
|
|
37
|
+
type SemanticColorRoles = {
|
|
38
|
+
success: string;
|
|
39
|
+
onSuccess: string;
|
|
40
|
+
successContainer: string;
|
|
41
|
+
onSuccessContainer: string;
|
|
42
|
+
warning: string;
|
|
43
|
+
onWarning: string;
|
|
44
|
+
warningContainer: string;
|
|
45
|
+
onWarningContainer: string;
|
|
46
|
+
danger: string;
|
|
47
|
+
onDanger: string;
|
|
48
|
+
dangerContainer: string;
|
|
49
|
+
onDangerContainer: string;
|
|
50
|
+
};
|
|
51
|
+
type AutoPaperTheme = Omit<MD3Theme, 'colors'> & {
|
|
52
|
+
colors: MD3Theme['colors'] & SemanticColorRoles;
|
|
53
|
+
};
|
|
54
|
+
declare function useComputedTheme(appearance: ThemeAppearance, color: string, harmony?: ColorHarmony): AutoPaperTheme | null;
|
|
33
55
|
|
|
34
|
-
type
|
|
56
|
+
type AppearanceIcons = Partial<Record<ThemeAppearance, string>>;
|
|
57
|
+
type Props$3 = {
|
|
35
58
|
value: ThemeAppearance;
|
|
36
59
|
onChange: (appearance: ThemeAppearance) => void;
|
|
60
|
+
showLabels?: boolean;
|
|
61
|
+
icons?: AppearanceIcons;
|
|
37
62
|
};
|
|
38
|
-
declare const AppearancePicker: ({ value, onChange }: Props$
|
|
63
|
+
declare const AppearancePicker: ({ value, onChange, showLabels, icons }: Props$3) => react.JSX.Element;
|
|
39
64
|
|
|
40
65
|
type ExpoBlurTint = 'light' | 'dark' | 'default' | 'extraLight' | 'regular' | 'prominent' | 'systemUltraThinMaterial' | 'systemThinMaterial' | 'systemMaterial' | 'systemThickMaterial' | 'systemChromeMaterial' | 'systemUltraThinMaterialLight' | 'systemThinMaterialLight' | 'systemMaterialLight' | 'systemThickMaterialLight' | 'systemChromeMaterialLight' | 'systemUltraThinMaterialDark' | 'systemThinMaterialDark' | 'systemMaterialDark' | 'systemThickMaterialDark' | 'systemChromeMaterialDark';
|
|
41
66
|
type ExpoBlurMethod = 'none' | 'dimezisBlurView' | 'dimezisBlurViewSdk31Plus';
|
|
@@ -86,18 +111,19 @@ type SeedColor = {
|
|
|
86
111
|
value: string;
|
|
87
112
|
};
|
|
88
113
|
declare const defaultColors: SeedColor[];
|
|
89
|
-
type Props$
|
|
114
|
+
type Props$2 = {
|
|
90
115
|
value: string;
|
|
91
116
|
onChange: (color: string) => void;
|
|
92
117
|
colors?: SeedColor[];
|
|
93
118
|
blur?: boolean;
|
|
94
119
|
};
|
|
95
|
-
declare const ColorPicker: ({ value, onChange, colors, blur: blurProp }: Props$
|
|
120
|
+
declare const ColorPicker: ({ value, onChange, colors, blur: blurProp }: Props$2) => react.JSX.Element;
|
|
96
121
|
|
|
97
|
-
type DialogProps = DialogProps$1 & {
|
|
122
|
+
type DialogProps = Omit<DialogProps$1, 'style'> & {
|
|
98
123
|
blur?: boolean;
|
|
124
|
+
style?: StyleProp<ViewStyle>;
|
|
99
125
|
};
|
|
100
|
-
declare function DialogComponent({ blur: blurProp, visible, onDismiss, children, style,
|
|
126
|
+
declare function DialogComponent({ blur: blurProp, dismissable, dismissableBackButton, visible, onDismiss, children, style, testID }: DialogProps): react__default.JSX.Element | null;
|
|
101
127
|
declare namespace DialogComponent {
|
|
102
128
|
var Title: react__default.FC<DialogTitleProps>;
|
|
103
129
|
var Content: react__default.FC<DialogContentProps>;
|
|
@@ -108,12 +134,12 @@ declare const Dialog: typeof DialogComponent;
|
|
|
108
134
|
|
|
109
135
|
declare function FAB(props: FABProps): react.JSX.Element;
|
|
110
136
|
|
|
111
|
-
type Props = {
|
|
137
|
+
type Props$1 = {
|
|
112
138
|
value: ColorHarmony;
|
|
113
139
|
onChange: (harmony: ColorHarmony) => void;
|
|
114
140
|
blur?: boolean;
|
|
115
141
|
};
|
|
116
|
-
declare const HarmonyPicker: ({ value, onChange, blur: blurProp }: Props) => react.JSX.Element;
|
|
142
|
+
declare const HarmonyPicker: ({ value, onChange, blur: blurProp }: Props$1) => react.JSX.Element;
|
|
117
143
|
|
|
118
144
|
type IconButtonProps = IconButtonProps$1 & {
|
|
119
145
|
variant?: 'primary' | 'secondary' | 'tertiary' | 'surface';
|
|
@@ -127,6 +153,21 @@ declare const Menu: (({ blur: blurProp, children, ...props }: MenuProps) => reac
|
|
|
127
153
|
Item: react__default.FC<MenuItemProps>;
|
|
128
154
|
};
|
|
129
155
|
|
|
156
|
+
type PaletteWeights = {
|
|
157
|
+
primary: number;
|
|
158
|
+
secondary: number;
|
|
159
|
+
tertiary: number;
|
|
160
|
+
};
|
|
161
|
+
type Props = {
|
|
162
|
+
value: string;
|
|
163
|
+
onChange: (color: string) => void;
|
|
164
|
+
harmony?: ColorHarmony;
|
|
165
|
+
weights?: PaletteWeights;
|
|
166
|
+
colors?: SeedColor[];
|
|
167
|
+
blur?: boolean;
|
|
168
|
+
};
|
|
169
|
+
declare const PalettePicker: ({ value, onChange, harmony, weights, colors, blur: blurProp }: Props) => react.JSX.Element;
|
|
170
|
+
|
|
130
171
|
declare const TextInput: react.ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & react.RefAttributes<TextInput$1>>;
|
|
131
172
|
|
|
132
173
|
type PaperDefaults = {
|
|
@@ -224,10 +265,20 @@ type ProviderProps = {
|
|
|
224
265
|
};
|
|
225
266
|
declare function Provider({ initialValue, onChange, children, defaults, onNavBarChange, onReady, statusBarProps, style }: ProviderProps): react.JSX.Element | null;
|
|
226
267
|
|
|
268
|
+
declare const useAutoPaperTheme: () => AutoPaperTheme;
|
|
269
|
+
|
|
227
270
|
declare const useThemeSettings: () => ThemeSettingsContextType;
|
|
228
271
|
|
|
229
272
|
declare const getBlendedColor: (foreground: string, background: string, alpha: number) => string;
|
|
230
273
|
|
|
274
|
+
type ColorRoles = {
|
|
275
|
+
color: string;
|
|
276
|
+
onColor: string;
|
|
277
|
+
container: string;
|
|
278
|
+
onContainer: string;
|
|
279
|
+
};
|
|
280
|
+
declare const getColorRoles: (base: string, surface: string, containerAlpha?: number) => ColorRoles;
|
|
281
|
+
|
|
231
282
|
declare const getHex: (value: string) => string | null;
|
|
232
283
|
|
|
233
284
|
type RGB = {
|
|
@@ -238,10 +289,12 @@ type RGB = {
|
|
|
238
289
|
};
|
|
239
290
|
declare const getRgb: (value: string) => RGB | null;
|
|
240
291
|
|
|
292
|
+
declare const getContrastColor: (color: string) => string;
|
|
293
|
+
|
|
241
294
|
declare const getTintTextColor: (tintColor: string, backdropColor: string, tintOpacity: number) => string;
|
|
242
295
|
|
|
243
296
|
declare const getTonalColor: (color: string, lightness: number) => string;
|
|
244
297
|
|
|
245
298
|
declare const isDarkColor: (value: string) => boolean;
|
|
246
299
|
|
|
247
|
-
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, getTintTextColor, getTonalColor, getTriadicPalette, isDarkColor, selectThemeAppearance, selectThemeBlur, selectThemeColor, selectThemeHarmony, themeActions, themeReducer, useBlur, useComputedTheme, usePaperDefaults, useThemeSettings };
|
|
300
|
+
export { Appbar, type AppearanceIcons, AppearancePicker, type AutoPaperTheme, BlurView, type BlurViewProps, BottomNavigation, Button, Chip, type ChipProps, type ColorHarmony, ColorPicker, type ColorRoles, Dialog, type DialogProps, FAB, HarmonyPicker, IconButton, type IconButtonProps, Menu, type MenuProps, PalettePicker, type PaletteWeights, type PaperDefaults, Provider, type ProviderProps, type RGB, SEMANTIC_BASE_COLORS, type SeedColor, type SemanticColorRoles, TextInput, type ThemeAppearance, type ThemeSettings, ThemeSettingsContext, type ThemeSettingsContextType, type ThemeState, type TriadicPalette, createThemeReducer, defaultColors, defaultThemeSettings, getBlendedColor, getColorRoles, getContrastColor, getHex, getRgb, getTintTextColor, getTonalColor, getTriadicPalette, isDarkColor, selectThemeAppearance, selectThemeBlur, selectThemeColor, selectThemeHarmony, themeActions, themeReducer, useAutoPaperTheme, useBlur, useComputedTheme, usePaperDefaults, useThemeSettings };
|