@datavac/ui-kit 1.7.0-select.1 → 1.7.1-theme-toggle.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.
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import type { ThemeName, ThemeTokens } from '../../themes';
|
|
3
|
+
export type ExtendedThemeName = ThemeName | 'system';
|
|
3
4
|
interface ThemeContextValue {
|
|
4
|
-
themeName:
|
|
5
|
+
themeName: ExtendedThemeName;
|
|
6
|
+
resolvedTheme: ThemeName;
|
|
5
7
|
tokens: ThemeTokens;
|
|
6
|
-
setTheme: (name:
|
|
8
|
+
setTheme: (name: ExtendedThemeName) => void;
|
|
7
9
|
toggleTheme: () => void;
|
|
8
10
|
}
|
|
9
11
|
interface ThemeProviderProps {
|
|
10
12
|
children: ReactNode;
|
|
11
13
|
/** Начальная тема. По умолчанию следует системным настройкам */
|
|
12
|
-
defaultTheme?:
|
|
14
|
+
defaultTheme?: ExtendedThemeName;
|
|
13
15
|
/** Кастомная тема — переопределяет встроенные */
|
|
14
16
|
customThemes?: Record<string, ThemeTokens>;
|
|
15
17
|
/** Применять CSS-переменные на :root (true) или на обёртку (false) */
|