@codeleap/styles 5.8.1 → 5.8.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeleap/styles",
3
- "version": "5.8.1",
3
+ "version": "5.8.2",
4
4
  "main": "src/index.ts",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -9,7 +9,7 @@
9
9
  "directory": "packages/styles"
10
10
  },
11
11
  "devDependencies": {
12
- "@codeleap/config": "5.8.1",
12
+ "@codeleap/config": "5.8.2",
13
13
  "ts-node-dev": "^1.1.8"
14
14
  },
15
15
  "scripts": {
package/package.json.bak CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeleap/styles",
3
- "version": "5.8.1",
3
+ "version": "5.8.2",
4
4
  "main": "src/index.ts",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
package/src/lib/hooks.ts CHANGED
@@ -41,7 +41,7 @@ export const useTheme = <T = ThemeState>(
41
41
  }
42
42
 
43
43
  export function useCompositionStyles<T extends string, C extends string>(
44
- composition: Array<T>,
44
+ composition: (T | Array<T>),
45
45
  componentStyles: Partial<Record<C, ICSS>>
46
46
  ): Partial<Record<T, ICSS>> {
47
47
  const styles = {
@@ -51,8 +51,12 @@ export function useCompositionStyles<T extends string, C extends string>(
51
51
  return useMemo(() => {
52
52
  const compositionStyles = {}
53
53
 
54
- for (const element of composition) {
55
- compositionStyles[element as string] = getNestedStylesByKey(element, styles)
54
+ if (Array.isArray(composition)) {
55
+ for (const element of composition) {
56
+ compositionStyles[element as string] = getNestedStylesByKey(element, styles)
57
+ }
58
+ } else {
59
+ compositionStyles[composition as string] = getNestedStylesByKey(composition, styles)
56
60
  }
57
61
 
58
62
  return compositionStyles