@codeandmoney/soelma 0.0.0-dev.7 → 0.0.0-dev.9
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.
|
@@ -5,10 +5,10 @@ export function makeUseStyles<
|
|
|
5
5
|
Theme extends DefaultTheme,
|
|
6
6
|
T extends StyleSheet.NamedStyles<T> | StyleSheet.NamedStyles<any>,
|
|
7
7
|
VariantsConfig extends Record<string, StyleSheet.NamedStyles<any>> | undefined = undefined,
|
|
8
|
-
>(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
): <Variants extends { [Key in keyof VariantsConfig]: keyof VariantsConfig[Key] }>(
|
|
8
|
+
>(config: {
|
|
9
|
+
styles?: (theme: Theme) => T | StyleSheet.NamedStyles<T>;
|
|
10
|
+
variants?: ((theme: Theme) => VariantsConfig) | undefined;
|
|
11
|
+
}): <Variants extends { [Key in keyof VariantsConfig]: keyof VariantsConfig[Key] }>(
|
|
12
12
|
variants?: Partial<Variants>,
|
|
13
13
|
) => T &
|
|
14
14
|
(VariantsConfig extends undefined
|
package/make-use-styles/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createUseStylesWithoutTheme } from "./create-use-styles-without-theme";
|
|
2
2
|
import { createUseStylesTheme } from "./create-use-styles-theme";
|
|
3
3
|
|
|
4
|
-
export function makeUseStyles(
|
|
5
|
-
const hasThemeDependency =
|
|
4
|
+
export function makeUseStyles({ styles, variants }) {
|
|
5
|
+
const hasThemeDependency = styles.length === 1;
|
|
6
6
|
|
|
7
7
|
if (!hasThemeDependency) {
|
|
8
|
-
return createUseStylesWithoutTheme(
|
|
8
|
+
return createUseStylesWithoutTheme(styles, variants);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
return createUseStylesTheme(
|
|
11
|
+
return createUseStylesTheme(styles);
|
|
12
12
|
}
|