@chakra-ui/system
Advanced tools
Comparing version 1.2.1 to 1.3.0
# Change Log | ||
## 1.3.0 | ||
### Minor Changes | ||
- [`ff4a36bca`](https://github.com/chakra-ui/chakra-ui/commit/ff4a36bca11cc177830f6f1da13700acd1e3a087) | ||
[#3245](https://github.com/chakra-ui/chakra-ui/pull/3245) Thanks | ||
[@segunadebayo](https://github.com/segunadebayo)! - - Add support for | ||
responsive values when using `apply`, `textStyle` and `layerStyle`. | ||
### Patch Changes | ||
- Updated dependencies | ||
[[`ef34c10a0`](https://github.com/chakra-ui/chakra-ui/commit/ef34c10a0c3cfda6bafcca4aa287dfb82f130aeb), | ||
[`a97e42568`](https://github.com/chakra-ui/chakra-ui/commit/a97e42568c4470d6cd1e16b48429af93c52def49), | ||
[`ff4a36bca`](https://github.com/chakra-ui/chakra-ui/commit/ff4a36bca11cc177830f6f1da13700acd1e3a087), | ||
[`ff4a36bca`](https://github.com/chakra-ui/chakra-ui/commit/ff4a36bca11cc177830f6f1da13700acd1e3a087), | ||
[`408aaaace`](https://github.com/chakra-ui/chakra-ui/commit/408aaaace0dd413b61354958a4c30b9f2f8aa376), | ||
[`483687237`](https://github.com/chakra-ui/chakra-ui/commit/483687237f2c4fed05dc6a79693f307c601c1285), | ||
[`9dc37ee37`](https://github.com/chakra-ui/chakra-ui/commit/9dc37ee37575650746e9b006e41428f1bf53e16c), | ||
[`61962345c`](https://github.com/chakra-ui/chakra-ui/commit/61962345c5b1c862445c16c586e304b28c376c9a)]: | ||
- @chakra-ui/styled-system@1.7.0 | ||
- @chakra-ui/utils@1.2.0 | ||
- @chakra-ui/color-mode@1.0.7 | ||
## 1.2.1 | ||
@@ -4,0 +28,0 @@ |
@@ -24,5 +24,5 @@ "use strict"; | ||
*/ | ||
var stylePropNames = _styledSystem.propNames.reduce(function (keymirror, key) { | ||
if (typeof key !== "object" && typeof key !== "function") keymirror[key] = key; | ||
return keymirror; | ||
var stylePropNames = _styledSystem.propNames.reduce(function (acc, key) { | ||
if (typeof key !== "object" && typeof key !== "function") acc[key] = key; | ||
return acc; | ||
}, {}); | ||
@@ -47,5 +47,2 @@ | ||
var theme = props.theme, | ||
layerStyle = props.layerStyle, | ||
textStyle = props.textStyle, | ||
apply = props.apply, | ||
noOfLines = props.noOfLines, | ||
@@ -56,9 +53,5 @@ isTruncated = props.isTruncated, | ||
sx = props.sx, | ||
rest = _objectWithoutPropertiesLoose(props, ["theme", "layerStyle", "textStyle", "apply", "noOfLines", "isTruncated", "css", "__css", "sx"]); | ||
rest = _objectWithoutPropertiesLoose(props, ["theme", "noOfLines", "isTruncated", "css", "__css", "sx"]); // filter out props that aren't style props | ||
var _layerStyle = (0, _utils.memoizedGet)(theme, "layerStyles." + layerStyle, {}); | ||
var _textStyle = (0, _utils.memoizedGet)(theme, "textStyles." + textStyle, {}); // filter out props that aren't style props | ||
var styleProps = (0, _utils.objectFilter)(rest, function (_, prop) { | ||
@@ -90,9 +83,7 @@ return prop in stylePropNames; | ||
var finalStyles = (0, _utils.objectAssign)({}, __css, baseStyle, { | ||
apply: apply | ||
}, _layerStyle, _textStyle, truncateStyle, styleProps, sx); // Converts theme-aware style object to real css object | ||
var finalStyles = Object.assign({}, __css, baseStyle, truncateStyle, styleProps, sx); // Converts theme-aware style object to real css object | ||
var computedCSS = (0, _styledSystem.css)(finalStyles)(props.theme); // Merge the computed css object with styles in css prop | ||
var cssObject = (0, _utils.objectAssign)(computedCSS, (0, _utils.isFunction)(cssProp) ? cssProp(theme) : cssProp); | ||
var cssObject = Object.assign(computedCSS, (0, _utils.isFunction)(cssProp) ? cssProp(theme) : cssProp); | ||
return cssObject; | ||
@@ -99,0 +90,0 @@ }; |
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } | ||
import { css, propNames } from "@chakra-ui/styled-system"; | ||
import { memoizedGet as get, objectFilter, objectAssign, isFunction } from "@chakra-ui/utils"; | ||
import { isFunction, objectFilter } from "@chakra-ui/utils"; | ||
import _styled from "@emotion/styled"; | ||
@@ -12,5 +12,5 @@ import { shouldForwardProp } from "./should-forward-prop"; | ||
var stylePropNames = propNames.reduce((keymirror, key) => { | ||
if (typeof key !== "object" && typeof key !== "function") keymirror[key] = key; | ||
return keymirror; | ||
var stylePropNames = propNames.reduce((acc, key) => { | ||
if (typeof key !== "object" && typeof key !== "function") acc[key] = key; | ||
return acc; | ||
}, {}); | ||
@@ -38,5 +38,2 @@ | ||
theme, | ||
layerStyle, | ||
textStyle, | ||
apply, | ||
noOfLines, | ||
@@ -48,9 +45,5 @@ isTruncated, | ||
} = props, | ||
rest = _objectWithoutPropertiesLoose(props, ["theme", "layerStyle", "textStyle", "apply", "noOfLines", "isTruncated", "css", "__css", "sx"]); | ||
rest = _objectWithoutPropertiesLoose(props, ["theme", "noOfLines", "isTruncated", "css", "__css", "sx"]); // filter out props that aren't style props | ||
var _layerStyle = get(theme, "layerStyles." + layerStyle, {}); | ||
var _textStyle = get(theme, "textStyles." + textStyle, {}); // filter out props that aren't style props | ||
var styleProps = objectFilter(rest, (_, prop) => prop in stylePropNames); | ||
@@ -80,9 +73,7 @@ var truncateStyle = {}; | ||
var finalStyles = objectAssign({}, __css, baseStyle, { | ||
apply | ||
}, _layerStyle, _textStyle, truncateStyle, styleProps, sx); // Converts theme-aware style object to real css object | ||
var finalStyles = Object.assign({}, __css, baseStyle, truncateStyle, styleProps, sx); // Converts theme-aware style object to real css object | ||
var computedCSS = css(finalStyles)(props.theme); // Merge the computed css object with styles in css prop | ||
var cssObject = objectAssign(computedCSS, isFunction(cssProp) ? cssProp(theme) : cssProp); | ||
var cssObject = Object.assign(computedCSS, isFunction(cssProp) ? cssProp(theme) : cssProp); | ||
return cssObject; | ||
@@ -89,0 +80,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
import { ResponsiveValue, SystemProps, SystemStyleObject, StyleProps } from "@chakra-ui/styled-system"; | ||
import { ResponsiveValue, StyleProps, SystemStyleObject } from "@chakra-ui/styled-system"; | ||
import { Dict } from "@chakra-ui/utils"; | ||
@@ -6,3 +6,3 @@ import { CSSObject, FunctionInterpolation } from "@emotion/styled"; | ||
import { DOMElements } from "./system.utils"; | ||
interface StyleResolverProps extends SystemProps { | ||
declare type StyleResolverProps = SystemStyleObject & { | ||
__css?: SystemStyleObject; | ||
@@ -14,9 +14,8 @@ sx?: SystemStyleObject; | ||
isTruncated?: boolean; | ||
layerStyle?: string; | ||
textStyle?: string; | ||
apply?: ResponsiveValue<string>; | ||
}; | ||
interface GetStyleObject { | ||
(options: { | ||
baseStyle?: SystemStyleObject; | ||
}): FunctionInterpolation<StyleResolverProps>; | ||
} | ||
declare type GetStyleObject = (options: { | ||
baseStyle?: SystemStyleObject; | ||
}) => FunctionInterpolation<StyleResolverProps>; | ||
/** | ||
@@ -23,0 +22,0 @@ * Style resolver function that manages how style props are merged |
{ | ||
"name": "@chakra-ui/system", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "Chakra UI system primitives", | ||
@@ -57,5 +57,5 @@ "keywords": [ | ||
"dependencies": { | ||
"@chakra-ui/color-mode": "1.0.6", | ||
"@chakra-ui/styled-system": "1.6.0", | ||
"@chakra-ui/utils": "1.1.0", | ||
"@chakra-ui/color-mode": "1.0.7", | ||
"@chakra-ui/styled-system": "1.7.0", | ||
"@chakra-ui/utils": "1.2.0", | ||
"react-fast-compare": "3.2.0" | ||
@@ -62,0 +62,0 @@ }, |
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
119010
911
+ Added@chakra-ui/color-mode@1.0.7(transitive)
+ Added@chakra-ui/hooks@1.1.4(transitive)
+ Added@chakra-ui/styled-system@1.7.0(transitive)
+ Added@chakra-ui/utils@1.2.0(transitive)
- Removed@chakra-ui/color-mode@1.0.6(transitive)
- Removed@chakra-ui/hooks@1.1.3(transitive)
- Removed@chakra-ui/styled-system@1.6.0(transitive)
- Removed@chakra-ui/utils@1.1.0(transitive)
- Removedobject-assign@4.1.1(transitive)
Updated@chakra-ui/color-mode@1.0.7
Updated@chakra-ui/utils@1.2.0