UI theme composition with CSS Modules and React
OTHER License
propTypes
checks are deprecated in React v19, the following related changes have been done in this library:
Removed optional themeSchema
argument of themed() function.
Removed castTheme
property, and themeType
field of themed components.
TypeScript: Theme
type's generic argument is changed to be a union of string literals, rather than a typeof
constant string array; i.e. type definitions for themes should be updated in the following manner:
import { type Theme } from '@dr.pogodin/react-themes';
const validKeys = ['keyA', 'keyB'] as const;
type BaseComponentPropsT = {
theme: Theme<typeof validKeys>;
};
const BaseComponent: React.FunctionComponent<BaseComponentPropsT> = ...
const ThemedComponent = themed(BaseComponent, 'ThemedComponent', validKeys);
import { type Theme } from '@dr.pogodin/react-themes';
type BaseComponentPropsT = {
theme: Theme<'keyA' | 'keyB'>;
};
const BaseComponent: React.FunctionComponent<BaseComponentPropsT> = ...
const ThemedComponent = themed(BaseComponent, 'ThemedComponent');
Published by birdofpreyru 5 months ago
Published by birdofpreyru 6 months ago
Published by birdofpreyru 10 months ago
[#56] Typescript: Improves theme typing.
This is a breaking change for TypeScript projects, as it requires corresponding code updates.
Before:
import themed, { type Theme } from '@dr.pogodin/react-themes';
type ComponentPropsT = {
theme: Theme & {
keyA?: string;
keyB?: string;
};
};
const Component: React.FunctionComponent<ComponentPropsT> = ...
const ThemedComponent = themed(Component, 'Component', [
'keyA',
'keyB',
]);
Now:
import themed, { type Theme } from '@dr.pogodin/react-themes';
const validKeys = ['keyA', 'keyB'] as const;
type ComponentPropsT = {
theme: Theme<typeof validKeys>;
};
const Component: React.FunctionComponent<ComponentPropsT> = ...
const ThemedComponent = themed(Component, 'Component', validKeys);
Published by birdofpreyru 12 months ago
Published by birdofpreyru almost 1 year ago
Published by birdofpreyru about 1 year ago
Published by birdofpreyru over 1 year ago
Published by birdofpreyru almost 2 years ago
Published by birdofpreyru almost 2 years ago
Published by birdofpreyru about 2 years ago
Published by birdofpreyru over 2 years ago
Update of dependencies.
Published by birdofpreyru over 2 years ago
default
export to package.json
, pointing to the Node build of the lib.Published by birdofpreyru over 2 years ago
Published by birdofpreyru over 2 years ago
"main"
entry into package.json
. It points to CommonJS build for Node LTS, and serves as a fallback for environments not recognizing "exports"
object.Published by birdofpreyru over 2 years ago
"exports"
object in package.json
to export CommonJS module for Node (build for the current LTS 16.14.0), and ES module for web bundlers (otherwise build for default browserslist browsers). Presumably, it should not be a breaking change, but just in case be careful about it.Published by birdofpreyru about 3 years ago
Maintenance release: no functional changes.
Published by birdofpreyru over 3 years ago
Published by birdofpreyru almost 4 years ago
<ThemeProvider>
s it prevents the child <ThemeProvider>
from shadowing any themes from parent <ThemeProvider>
, which are not explicitly overriden (provided) by the child provider.Published by birdofpreyru about 4 years ago
>= 16.14.0
, 15.7.0
, 0.14.10
.