@zohodesk/theme
Advanced tools
Comparing version 1.0.4 to 1.0.5
import React from 'react'; | ||
const ThemeContext = /*#__PURE__*/React.createContext(null); | ||
if (process.env.NODE_ENV !== 'production') { | ||
ThemeContext.displayName = 'ThemeContext'; | ||
} | ||
export default ThemeContext; | ||
export default ThemeContext; | ||
/* Color contact ally */ | ||
@@ -10,0 +9,0 @@ |
@@ -6,2 +6,3 @@ import React, { useMemo } from 'react'; | ||
import defaultProps from './props/defaultProps'; | ||
/** | ||
@@ -12,3 +13,2 @@ * To used to customized css variables and component default props - components used under this provider. | ||
*/ | ||
export default function ThemeProvider(props) { | ||
@@ -15,0 +15,0 @@ const { |
@@ -7,8 +7,6 @@ import { useContext } from "react"; | ||
} = useContext(ThemeContext); | ||
if (Array.isArray(components)) { | ||
return components.map(component => componentRegistry[component]); | ||
} | ||
return componentRegistry[components]; | ||
} |
import { useContext } from 'react'; | ||
import selectn from 'selectn'; | ||
import ThemeContext from './ThemeContext'; | ||
const useThemeByComponent = componentName => { | ||
@@ -9,3 +8,2 @@ const themeContextValue = useContext(ThemeContext); | ||
}; | ||
export default useThemeByComponent; |
@@ -5,2 +5,3 @@ // export default function combineConfigurations(...configurations) { | ||
// let doneList = []; | ||
import flatVariables from './flatVariables'; | ||
@@ -12,3 +13,2 @@ /** | ||
*/ | ||
export default function combineConfigurations(configurations) { | ||
@@ -24,3 +24,2 @@ const configs = configurations.map(configuration => ({ | ||
} | ||
Object.assign(res[next.library].variables, next.variables); | ||
@@ -30,8 +29,12 @@ return res; | ||
return Object.keys(mergeObject).map(key => mergeObject[key]); | ||
} // configurations.forEach((config, index) => { | ||
} | ||
// configurations.forEach((config, index) => { | ||
// if (!config || doneList.includes(config.library)) { | ||
// return; | ||
// } | ||
// let remainingList = configurations.slice(index); | ||
// let newConfiguration = config; | ||
// remainingList.forEach((config2) => { | ||
@@ -48,6 +51,8 @@ // if (config2 && config.library === config2.library) { | ||
// }); | ||
// doneList.push(config.library); | ||
// resultConfiguration.push(newConfiguration); | ||
// }); | ||
// return resultConfiguration; | ||
// } |
@@ -26,5 +26,4 @@ /** | ||
} | ||
return res; | ||
}, {})), {}); | ||
} |
@@ -21,3 +21,2 @@ import combineConfigurations from './combineConfigurations'; | ||
*/ | ||
export default function getCustomizedCssVariables(cssVariableConfigs) { | ||
@@ -24,0 +23,0 @@ let prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '--lib_'; |
import { colorSchemes, autoSystemMode } from './themeConstants'; | ||
export default (appMode => { | ||
const matched = window.matchMedia('(prefers-color-scheme: dark)').matches; | ||
if (appMode === autoSystemMode) { | ||
return matched ? colorSchemes.dark : colorSchemes.light; | ||
} | ||
return appMode; | ||
}); |
@@ -8,12 +8,10 @@ import React from "react"; | ||
} | ||
if (!componentName) { | ||
throw new Error("The prop componentName shouldn't be empty."); | ||
} | ||
const WrapperComponent = component; | ||
function BaseComponent(props) { | ||
const themeProps = useThemeByComponentProps(componentName); | ||
const themedProps = { ...component.defaultProps, | ||
const themedProps = { | ||
...component.defaultProps, | ||
...themeProps, | ||
@@ -24,4 +22,3 @@ ...props | ||
} | ||
return hoistStatics(WrapperComponent, BaseComponent); | ||
} |
{ | ||
"name": "@zohodesk/theme", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "", | ||
@@ -24,3 +24,3 @@ "private": false, | ||
"license": "ISC", | ||
"gitHead": "e57c562c44c9b82f9e2fa2df1e3c97d106efb72d" | ||
"gitHead": "cc656e6d4c2249ad79916757b2a96828b678245b" | ||
} |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
289
19902