@contember/react-utils
Advanced tools
Comparing version 1.2.0-rc.15 to 1.2.0-rc.16
import { flatClassNameList, deduplicateClassName } from "@contember/utilities"; | ||
import { useContext } from "react"; | ||
import { GlobalClassNamePrefixContext } from "./GlobalClassNamePrefixContext.js"; | ||
import { useReferentiallyStableCallback } from "../referentiallyStable/useReferentiallyStableCallback.js"; | ||
function useClassNameFactory(componentClassName, glue = "-", prefixOverride) { | ||
@@ -10,3 +11,3 @@ const contextPrefix = useContext(GlobalClassNamePrefixContext); | ||
); | ||
return function componentClassNameFor(suffix = null, additionalClassName = null) { | ||
function componentClassNameFor(suffix = null, additionalClassName = null) { | ||
const classNameSuffix = suffix ?? ""; | ||
@@ -16,3 +17,4 @@ return deduplicateClassName((classNameSuffix ? classNameSuffix.match(/^[a-zA-Z0-9]/) ? componentClassNameList.map((componentClassName2) => `${componentClassName2}${glue}${classNameSuffix}`) : componentClassNameList.map((componentClassName2) => `${componentClassName2}${classNameSuffix}`) : componentClassNameList).concat( | ||
)).join(" "); | ||
}; | ||
} | ||
return useReferentiallyStableCallback(componentClassNameFor); | ||
} | ||
@@ -19,0 +21,0 @@ export { |
@@ -5,2 +5,3 @@ import { flatClassNameList, colorSchemeClassName, deduplicateClassName, filterThemedClassName } from "@contember/utilities"; | ||
import { useColorScheme } from "./contexts.js"; | ||
import { useReferentiallyStableCallback } from "../referentiallyStable/useReferentiallyStableCallback.js"; | ||
function useThemedClassNameFactory(componentClassName, glue = "-", prefixOverride) { | ||
@@ -13,3 +14,3 @@ const contextPrefix = useContext(GlobalClassNamePrefixContext); | ||
const colorScheme = colorSchemeClassName(useColorScheme()); | ||
return function componentClassNameFor(suffix = null, additionalClassName = null) { | ||
function componentClassNameFor(suffix = null, additionalClassName = null) { | ||
const classNameSuffix = suffix ?? ""; | ||
@@ -24,3 +25,4 @@ return deduplicateClassName((classNameSuffix ? classNameSuffix.match(/^[a-zA-Z0-9]/) ? componentClassNameList.map((componentClassName2) => `${componentClassName2}${glue}${classNameSuffix}`) : componentClassNameList.map((componentClassName2) => `${componentClassName2}${classNameSuffix}`) : componentClassNameList).concat( | ||
)).join(" "); | ||
}; | ||
} | ||
return useReferentiallyStableCallback(componentClassNameFor); | ||
} | ||
@@ -27,0 +29,0 @@ export { |
import { flatClassNameList, deduplicateClassName } from "@contember/utilities"; | ||
import { useContext } from "react"; | ||
import { GlobalClassNamePrefixContext } from "./GlobalClassNamePrefixContext.js"; | ||
import { useReferentiallyStableCallback } from "../referentiallyStable/useReferentiallyStableCallback.js"; | ||
function useClassNameFactory(componentClassName, glue = "-", prefixOverride) { | ||
@@ -10,3 +11,3 @@ const contextPrefix = useContext(GlobalClassNamePrefixContext); | ||
); | ||
return function componentClassNameFor(suffix = null, additionalClassName = null) { | ||
function componentClassNameFor(suffix = null, additionalClassName = null) { | ||
const classNameSuffix = suffix ?? ""; | ||
@@ -16,3 +17,4 @@ return deduplicateClassName((classNameSuffix ? classNameSuffix.match(/^[a-zA-Z0-9]/) ? componentClassNameList.map((componentClassName2) => `${componentClassName2}${glue}${classNameSuffix}`) : componentClassNameList.map((componentClassName2) => `${componentClassName2}${classNameSuffix}`) : componentClassNameList).concat( | ||
)).join(" "); | ||
}; | ||
} | ||
return useReferentiallyStableCallback(componentClassNameFor); | ||
} | ||
@@ -19,0 +21,0 @@ export { |
@@ -5,2 +5,3 @@ import { flatClassNameList, colorSchemeClassName, deduplicateClassName, filterThemedClassName } from "@contember/utilities"; | ||
import { useColorScheme } from "./contexts.js"; | ||
import { useReferentiallyStableCallback } from "../referentiallyStable/useReferentiallyStableCallback.js"; | ||
function useThemedClassNameFactory(componentClassName, glue = "-", prefixOverride) { | ||
@@ -13,3 +14,3 @@ const contextPrefix = useContext(GlobalClassNamePrefixContext); | ||
const colorScheme = colorSchemeClassName(useColorScheme()); | ||
return function componentClassNameFor(suffix = null, additionalClassName = null) { | ||
function componentClassNameFor(suffix = null, additionalClassName = null) { | ||
const classNameSuffix = suffix ?? ""; | ||
@@ -24,3 +25,4 @@ return deduplicateClassName((classNameSuffix ? classNameSuffix.match(/^[a-zA-Z0-9]/) ? componentClassNameList.map((componentClassName2) => `${componentClassName2}${glue}${classNameSuffix}`) : componentClassNameList.map((componentClassName2) => `${componentClassName2}${classNameSuffix}`) : componentClassNameList).concat( | ||
)).join(" "); | ||
}; | ||
} | ||
return useReferentiallyStableCallback(componentClassNameFor); | ||
} | ||
@@ -27,0 +29,0 @@ export { |
{ | ||
"name": "@contember/react-utils", | ||
"license": "Apache-2.0", | ||
"version": "1.2.0-rc.15", | ||
"version": "1.2.0-rc.16", | ||
"type": "module", | ||
@@ -33,3 +33,3 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@contember/utilities": "1.2.0-rc.15", | ||
"@contember/utilities": "1.2.0-rc.16", | ||
"deep-equal": "^2.2.0" | ||
@@ -36,0 +36,0 @@ }, |
import { NestedClassName, deduplicateClassName, flatClassNameList } from '@contember/utilities' | ||
import { useContext } from 'react' | ||
import { useReferentiallyStableCallback } from '../referentiallyStable' | ||
import { GlobalClassNamePrefixContext } from './GlobalClassNamePrefixContext' | ||
@@ -31,3 +32,3 @@ | ||
return function componentClassNameFor( | ||
function componentClassNameFor( | ||
suffix: string | null | undefined = null, | ||
@@ -48,2 +49,4 @@ additionalClassName: NestedClassName = null, | ||
} | ||
return useReferentiallyStableCallback(componentClassNameFor) | ||
} |
import { NestedClassName, colorSchemeClassName, deduplicateClassName, filterThemedClassName, flatClassNameList } from '@contember/utilities' | ||
import { useContext } from 'react' | ||
import { useReferentiallyStableCallback } from '../referentiallyStable' | ||
import { GlobalClassNamePrefixContext } from './GlobalClassNamePrefixContext' | ||
@@ -20,3 +21,3 @@ import { useColorScheme } from './contexts' | ||
return function componentClassNameFor( | ||
function componentClassNameFor( | ||
suffix: string | null | undefined = null, | ||
@@ -42,2 +43,4 @@ additionalClassName: NestedClassName = null, | ||
} | ||
return useReferentiallyStableCallback(componentClassNameFor) | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
330851
3606
9
1
+ Added@contember/utilities@1.2.0-rc.16(transitive)
- Removed@contember/utilities@1.2.0-rc.15(transitive)