master-components-react-ts 2.12.5 → 2.13.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/dist/Provider/Color.types.d.ts +10 -23
- package/dist/Provider/ColorVariables.d.ts +47 -0
- package/dist/Provider/ThemeProvider.d.ts +19 -3
- package/dist/Provider/themeDefaults.d.ts +22 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2571 -2342
- package/package.json +1 -1
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
colorSecondaryHover?: string;
|
|
12
|
-
colorSecondaryPressed?: string;
|
|
13
|
-
colorSecondaryDisabled?: string;
|
|
14
|
-
colorSecondaryText?: string;
|
|
15
|
-
colorSecondaryDisabledText?: string;
|
|
16
|
-
colorTertiaryV2Default?: string;
|
|
17
|
-
colorTertiaryV2Border?: string;
|
|
18
|
-
colorTertiaryV2Hover?: string;
|
|
19
|
-
colorTertiaryV2Pressed?: string;
|
|
20
|
-
colorTertiaryV2Disabled?: string;
|
|
21
|
-
colorTertiaryV2Text?: string;
|
|
22
|
-
colorTertiaryV2DisabledText?: string;
|
|
23
|
-
};
|
|
1
|
+
import { variableMap } from './ColorVariables';
|
|
2
|
+
/** Every themeable color key (camelCase). Maps to a CSS variable via `variableMap`. */
|
|
3
|
+
export type ThemeColorKey = keyof typeof variableMap;
|
|
4
|
+
/**
|
|
5
|
+
* A (partial) set of color overrides. Pass via the ThemeProvider `theme` prop,
|
|
6
|
+
* e.g. <ThemeProvider theme={{ light: {...}, dark: {...} }} />. Every key is
|
|
7
|
+
* optional — only the colors you set are overridden; the rest fall back to the
|
|
8
|
+
* built-in light/dark defaults.
|
|
9
|
+
*/
|
|
10
|
+
export type ThemeColors = Partial<Record<ThemeColorKey, string>>;
|
|
@@ -21,4 +21,51 @@ export declare const variableMap: {
|
|
|
21
21
|
readonly colorTertiaryV2Disabled: "--color-tertiaryV2-disabled";
|
|
22
22
|
readonly colorTertiaryV2Text: "--color-tertiaryV2-text";
|
|
23
23
|
readonly colorTertiaryV2DisabledText: "--color-tertiaryV2-disabled-text";
|
|
24
|
+
readonly colorTextPrimary: "--color-text-primary";
|
|
25
|
+
readonly colorTextSecondary: "--color-text-secondary";
|
|
26
|
+
readonly colorTextTertiary: "--color-text-tertiary";
|
|
27
|
+
readonly colorTextDisabled: "--color-text-disabled";
|
|
28
|
+
readonly colorTextPlaceholder: "--color-text-placeholder";
|
|
29
|
+
readonly colorTextInverse: "--color-text-inverse";
|
|
30
|
+
readonly colorTextLink: "--color-text-link";
|
|
31
|
+
readonly colorSurfacePage: "--color-surface-page";
|
|
32
|
+
readonly colorSurfaceCard: "--color-surface-card";
|
|
33
|
+
readonly colorSurfaceRaised: "--color-surface-raised";
|
|
34
|
+
readonly colorSurfaceSunken: "--color-surface-sunken";
|
|
35
|
+
readonly colorSurfaceHover: "--color-surface-hover";
|
|
36
|
+
readonly colorSurfacePressed: "--color-surface-pressed";
|
|
37
|
+
readonly colorSurfaceSelected: "--color-surface-selected";
|
|
38
|
+
readonly colorSurfaceDisabled: "--color-surface-disabled";
|
|
39
|
+
readonly colorSurfaceInput: "--color-surface-input";
|
|
40
|
+
readonly colorSurfaceInverse: "--color-surface-inverse";
|
|
41
|
+
readonly colorBorderDefault: "--color-border-default";
|
|
42
|
+
readonly colorBorderSubtle: "--color-border-subtle";
|
|
43
|
+
readonly colorBorderStrong: "--color-border-strong";
|
|
44
|
+
readonly colorBorderInverse: "--color-border-inverse";
|
|
45
|
+
readonly colorBorderFocus: "--color-border-focus";
|
|
46
|
+
readonly colorIconDefault: "--color-icon-default";
|
|
47
|
+
readonly colorIconMuted: "--color-icon-muted";
|
|
48
|
+
readonly colorIconInverse: "--color-icon-inverse";
|
|
49
|
+
readonly colorSuccessSolid: "--color-success-solid";
|
|
50
|
+
readonly colorSuccessSolidHover: "--color-success-solid-hover";
|
|
51
|
+
readonly colorSuccessSurface: "--color-success-surface";
|
|
52
|
+
readonly colorSuccessSurfaceHover: "--color-success-surface-hover";
|
|
53
|
+
readonly colorSuccessBorder: "--color-success-border";
|
|
54
|
+
readonly colorSuccessText: "--color-success-text";
|
|
55
|
+
readonly colorErrorSolid: "--color-error-solid";
|
|
56
|
+
readonly colorErrorSolidHover: "--color-error-solid-hover";
|
|
57
|
+
readonly colorErrorSurface: "--color-error-surface";
|
|
58
|
+
readonly colorErrorSurfaceHover: "--color-error-surface-hover";
|
|
59
|
+
readonly colorErrorBorder: "--color-error-border";
|
|
60
|
+
readonly colorErrorText: "--color-error-text";
|
|
61
|
+
readonly colorWarningSolid: "--color-warning-solid";
|
|
62
|
+
readonly colorWarningSolidHover: "--color-warning-solid-hover";
|
|
63
|
+
readonly colorWarningSurface: "--color-warning-surface";
|
|
64
|
+
readonly colorWarningBorder: "--color-warning-border";
|
|
65
|
+
readonly colorWarningText: "--color-warning-text";
|
|
66
|
+
readonly colorOverlayScrim: "--color-overlay-scrim";
|
|
67
|
+
readonly colorShadow: "--color-shadow";
|
|
68
|
+
readonly colorFocusRing: "--color-focus-ring";
|
|
69
|
+
readonly colorSkeletonBase: "--color-skeleton-base";
|
|
70
|
+
readonly colorSkeletonHighlight: "--color-skeleton-highlight";
|
|
24
71
|
};
|
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ThemeColors } from './Color.types';
|
|
3
|
+
export type ThemeMode = 'light' | 'dark';
|
|
4
|
+
/** Color overrides for each scheme. Every key is optional. */
|
|
5
|
+
export type Theme = {
|
|
6
|
+
light?: ThemeColors;
|
|
7
|
+
dark?: ThemeColors;
|
|
8
|
+
};
|
|
3
9
|
export type ThemeProviderProps = {
|
|
4
10
|
children: ReactNode;
|
|
5
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Active color scheme. Sets `data-theme="<mode>"` on the <html> element and
|
|
13
|
+
* selects which set of overrides (theme.light / theme.dark) is applied.
|
|
14
|
+
* Defaults to `'light'`.
|
|
15
|
+
*/
|
|
16
|
+
mode?: ThemeMode;
|
|
17
|
+
/**
|
|
18
|
+
* Color overrides for each scheme, e.g. `theme={{ light: {...}, dark: {...} }}`.
|
|
19
|
+
* Only the colors you set are overridden; the rest use the built-in defaults.
|
|
20
|
+
*/
|
|
21
|
+
theme?: Theme;
|
|
6
22
|
};
|
|
7
23
|
declare const ThemeProvider: {
|
|
8
|
-
({ children, theme }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
propKeys: readonly ["children", "theme"];
|
|
24
|
+
({ children, mode, theme }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
propKeys: readonly ["children", "mode", "theme"];
|
|
10
26
|
};
|
|
11
27
|
export default ThemeProvider;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ThemeColors } from './Color.types';
|
|
2
|
+
/**
|
|
3
|
+
* Canonical LIGHT palette.
|
|
4
|
+
*
|
|
5
|
+
* These are the values the components fall back to when no CSS variable is set
|
|
6
|
+
* (i.e. the default, unstyled light appearance). They are exported for
|
|
7
|
+
* reference and so consumers can spread + tweak:
|
|
8
|
+
*
|
|
9
|
+
* <ThemeProvider theme={{ light: { ...defaultLightTheme, colorPrimaryDefault: '#9406F3' } }} />
|
|
10
|
+
*
|
|
11
|
+
* Note: in the default light state these are NOT written to :root (the
|
|
12
|
+
* components' inline `var(--x, <literal>)` fallbacks provide them), so passing
|
|
13
|
+
* `defaultLightTheme` is only needed if you want to materialise/inspect them.
|
|
14
|
+
*/
|
|
15
|
+
export declare const defaultLightTheme: Required<ThemeColors>;
|
|
16
|
+
/**
|
|
17
|
+
* Canonical DARK palette. Mirrors the [data-theme='dark'] block in
|
|
18
|
+
* src/styles/_ColorVariables.scss. Spread + tweak the same way:
|
|
19
|
+
*
|
|
20
|
+
* <ThemeProvider mode="dark" theme={{ dark: { ...defaultDarkTheme, colorSurfacePage: '#000' } }} />
|
|
21
|
+
*/
|
|
22
|
+
export declare const defaultDarkTheme: Required<ThemeColors>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { default as ThemeProvider } from './Provider/ThemeProvider';
|
|
2
|
-
export type {
|
|
3
|
-
export type {
|
|
2
|
+
export type { ThemeProviderProps, ThemeMode, Theme } from './Provider/ThemeProvider';
|
|
3
|
+
export type { ThemeColors, ThemeColorKey } from './Provider/Color.types';
|
|
4
|
+
export { variableMap } from './Provider/ColorVariables';
|
|
5
|
+
export { defaultLightTheme, defaultDarkTheme } from './Provider/themeDefaults';
|
|
4
6
|
export { default as MainButton } from './components/MainButton/MainButton';
|
|
5
7
|
export type { MainButtonProps } from './components/MainButton/MainButton.types';
|
|
6
8
|
export { default as FormInput } from './components/FormInput/FormInput';
|