@chakra-ui/stat
Advanced tools
Comparing version 1.0.0-next.6 to 1.0.0-next.7
@@ -6,2 +6,11 @@ # Change Log | ||
# [1.0.0-next.7](https://github.com/chakra-ui/chakra-ui/compare/@chakra-ui/stat@1.0.0-next.6...@chakra-ui/stat@1.0.0-next.7) (2020-07-26) | ||
**Note:** Version bump only for package @chakra-ui/stat | ||
# Change Log | ||
All notable changes to this project will be documented in this file. See | ||
[Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
# [1.0.0-next.6](https://github.com/chakra-ui/chakra-ui/compare/@chakra-ui/stat@1.0.0-next.5...@chakra-ui/stat@1.0.0-next.6) (2020-07-15) | ||
@@ -8,0 +17,0 @@ |
@@ -22,26 +22,14 @@ "use strict"; | ||
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; } | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
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; } | ||
/** | ||
* StatLabel - Theming | ||
* | ||
* The label for the stat card. This is usually the heading for the card. | ||
* | ||
* To style the StatLabel globally, change the styles in | ||
* `theme.components.Stat` under the `Label` key. | ||
*/ | ||
var StatLabel = /*#__PURE__*/React.forwardRef(function StatLabel(props, ref) { | ||
var className = props.className, | ||
rest = _objectWithoutPropertiesLoose(props, ["className"]); | ||
var _className = (0, _utils.cx)("chakra-stat__label", className); | ||
var styles = (0, _system.useStyles)(); | ||
return /*#__PURE__*/React.createElement(_system.chakra.dt, _extends({ | ||
ref: ref, | ||
className: _className, | ||
ref: ref | ||
}, props, { | ||
className: (0, _utils.cx)("chakra-stat__label", props.className), | ||
__css: styles.label | ||
}, rest)); | ||
})); | ||
}); | ||
@@ -55,13 +43,7 @@ exports.StatLabel = StatLabel; | ||
var StatHelpText = /*#__PURE__*/React.forwardRef(function StatHelpText(props, ref) { | ||
var className = props.className, | ||
rest = _objectWithoutPropertiesLoose(props, ["className"]); | ||
var styles = (0, _system.useStyles)(); | ||
var _className = (0, _utils.cx)("chakra-stat__help-text", className); | ||
return /*#__PURE__*/React.createElement(_system.chakra.p, _extends({ | ||
ref: ref, | ||
className: _className | ||
}, rest, { | ||
ref: ref | ||
}, props, { | ||
className: (0, _utils.cx)("chakra-stat__help-text", props.className), | ||
__css: styles.helpText | ||
@@ -77,12 +59,7 @@ })); | ||
var StatNumber = /*#__PURE__*/React.forwardRef(function StatNumber(props, ref) { | ||
var className = props.className, | ||
rest = _objectWithoutPropertiesLoose(props, ["className"]); | ||
var _className = (0, _utils.cx)("chakra-stat__number", className); | ||
var styles = (0, _system.useStyles)(); | ||
return /*#__PURE__*/React.createElement(_system.chakra.dd, _extends({ | ||
ref: ref, | ||
className: _className | ||
}, rest, { | ||
ref: ref | ||
}, props, { | ||
className: (0, _utils.cx)("chakra-stat__number", props.className), | ||
__css: styles.number | ||
@@ -96,9 +73,3 @@ })); | ||
} | ||
/** | ||
* StatDownArrow | ||
* | ||
* Indicator arrow to show a decrease in the stat. | ||
*/ | ||
function StatDownArrow(props) { | ||
@@ -116,9 +87,3 @@ return /*#__PURE__*/React.createElement(_icon.Icon, _extends({ | ||
} | ||
/** | ||
* StatUpArrow | ||
* | ||
* Indicator arrow to show an increase in the stat. | ||
*/ | ||
var StatUpArrow = function StatUpArrow(props) { | ||
@@ -139,7 +104,2 @@ return /*#__PURE__*/React.createElement(_icon.Icon, _extends({ | ||
/** | ||
* StatArrow | ||
* | ||
* Indicator arrow to show an increase or a decrease in the stat. | ||
*/ | ||
function StatArrow(props) { | ||
@@ -151,6 +111,6 @@ var type = props.type, | ||
var styles = (0, _system.useStyles)(); | ||
var Icon = type === "increase" ? StatUpArrow : StatDownArrow; | ||
var IconComponent = type === "increase" ? StatUpArrow : StatDownArrow; | ||
var defaultAriaLabel = type === "increase" ? "increased by" : "decreased by"; | ||
var label = ariaLabel || defaultAriaLabel; | ||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_visuallyHidden.VisuallyHidden, null, label), /*#__PURE__*/React.createElement(Icon, _extends({ | ||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_visuallyHidden.VisuallyHidden, null, label), /*#__PURE__*/React.createElement(IconComponent, _extends({ | ||
"aria-hidden": true | ||
@@ -167,3 +127,3 @@ }, rest, { | ||
var Stat = /*#__PURE__*/React.forwardRef(function Stat(props, ref) { | ||
var styles = (0, _system.useStyleConfig)("Stat", props); | ||
var styles = (0, _system.useMultiStyleConfig)("Stat", props); | ||
@@ -175,8 +135,6 @@ var _omitThemingProps = (0, _system.omitThemingProps)(props), | ||
var _className = (0, _utils.cx)("chakra-stat", className); | ||
return /*#__PURE__*/React.createElement(_system.StylesProvider, { | ||
value: styles | ||
}, /*#__PURE__*/React.createElement(_system.chakra.div, _extends({ | ||
className: _className, | ||
className: (0, _utils.cx)("chakra-stat", className), | ||
ref: ref | ||
@@ -190,18 +148,8 @@ }, rest), /*#__PURE__*/React.createElement("dl", null, children))); | ||
} | ||
/** | ||
* StatGroup | ||
* | ||
* The component to group multiple stats together | ||
*/ | ||
var StatGroup = /*#__PURE__*/React.forwardRef(function StatGroup(props, ref) { | ||
var className = props.className, | ||
rest = _objectWithoutPropertiesLoose(props, ["className"]); | ||
return /*#__PURE__*/React.createElement(_system.chakra.div, _extends({ | ||
return /*#__PURE__*/React.createElement(_system.chakra.div, _extends({}, props, { | ||
ref: ref, | ||
role: "group", | ||
className: (0, _utils.cx)("chakra-stat__group", className) | ||
}, rest, { | ||
className: (0, _utils.cx)("chakra-stat__group", props.className), | ||
__css: { | ||
@@ -208,0 +156,0 @@ display: "flex", |
@@ -0,33 +1,18 @@ | ||
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; } | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
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 { Icon } from "@chakra-ui/icon"; | ||
import { chakra, omitThemingProps, StylesProvider, useStyleConfig, useStyles } from "@chakra-ui/system"; | ||
import { chakra, omitThemingProps, StylesProvider, useMultiStyleConfig, useStyles } from "@chakra-ui/system"; | ||
import { cx, __DEV__ } from "@chakra-ui/utils"; | ||
import { VisuallyHidden } from "@chakra-ui/visually-hidden"; | ||
import * as React from "react"; | ||
/** | ||
* StatLabel - Theming | ||
* | ||
* The label for the stat card. This is usually the heading for the card. | ||
* | ||
* To style the StatLabel globally, change the styles in | ||
* `theme.components.Stat` under the `Label` key. | ||
*/ | ||
export var StatLabel = /*#__PURE__*/React.forwardRef(function StatLabel(props, ref) { | ||
var { | ||
className | ||
} = props, | ||
rest = _objectWithoutPropertiesLoose(props, ["className"]); | ||
var _className = cx("chakra-stat__label", className); | ||
var styles = useStyles(); | ||
return /*#__PURE__*/React.createElement(chakra.dt, _extends({ | ||
ref: ref, | ||
className: _className, | ||
ref: ref | ||
}, props, { | ||
className: cx("chakra-stat__label", props.className), | ||
__css: styles.label | ||
}, rest)); | ||
})); | ||
}); | ||
@@ -40,15 +25,7 @@ | ||
export var StatHelpText = /*#__PURE__*/React.forwardRef(function StatHelpText(props, ref) { | ||
var { | ||
className | ||
} = props, | ||
rest = _objectWithoutPropertiesLoose(props, ["className"]); | ||
var styles = useStyles(); | ||
var _className = cx("chakra-stat__help-text", className); | ||
return /*#__PURE__*/React.createElement(chakra.p, _extends({ | ||
ref: ref, | ||
className: _className | ||
}, rest, { | ||
ref: ref | ||
}, props, { | ||
className: cx("chakra-stat__help-text", props.className), | ||
__css: styles.helpText | ||
@@ -63,14 +40,7 @@ })); | ||
export var StatNumber = /*#__PURE__*/React.forwardRef(function StatNumber(props, ref) { | ||
var { | ||
className | ||
} = props, | ||
rest = _objectWithoutPropertiesLoose(props, ["className"]); | ||
var _className = cx("chakra-stat__number", className); | ||
var styles = useStyles(); | ||
return /*#__PURE__*/React.createElement(chakra.dd, _extends({ | ||
ref: ref, | ||
className: _className | ||
}, rest, { | ||
ref: ref | ||
}, props, { | ||
className: cx("chakra-stat__number", props.className), | ||
__css: styles.number | ||
@@ -83,9 +53,3 @@ })); | ||
} | ||
/** | ||
* StatDownArrow | ||
* | ||
* Indicator arrow to show a decrease in the stat. | ||
*/ | ||
export function StatDownArrow(props) { | ||
@@ -103,9 +67,3 @@ return /*#__PURE__*/React.createElement(Icon, _extends({ | ||
} | ||
/** | ||
* StatUpArrow | ||
* | ||
* Indicator arrow to show an increase in the stat. | ||
*/ | ||
export var StatUpArrow = props => /*#__PURE__*/React.createElement(Icon, _extends({ | ||
@@ -122,7 +80,2 @@ color: "green.400" | ||
/** | ||
* StatArrow | ||
* | ||
* Indicator arrow to show an increase or a decrease in the stat. | ||
*/ | ||
export function StatArrow(props) { | ||
@@ -136,6 +89,6 @@ var { | ||
var styles = useStyles(); | ||
var Icon = type === "increase" ? StatUpArrow : StatDownArrow; | ||
var IconComponent = type === "increase" ? StatUpArrow : StatDownArrow; | ||
var defaultAriaLabel = type === "increase" ? "increased by" : "decreased by"; | ||
var label = ariaLabel || defaultAriaLabel; | ||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(VisuallyHidden, null, label), /*#__PURE__*/React.createElement(Icon, _extends({ | ||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(VisuallyHidden, null, label), /*#__PURE__*/React.createElement(IconComponent, _extends({ | ||
"aria-hidden": true | ||
@@ -152,3 +105,3 @@ }, rest, { | ||
export var Stat = /*#__PURE__*/React.forwardRef(function Stat(props, ref) { | ||
var styles = useStyleConfig("Stat", props); | ||
var styles = useMultiStyleConfig("Stat", props); | ||
@@ -162,8 +115,6 @@ var _omitThemingProps = omitThemingProps(props), | ||
var _className = cx("chakra-stat", className); | ||
return /*#__PURE__*/React.createElement(StylesProvider, { | ||
value: styles | ||
}, /*#__PURE__*/React.createElement(chakra.div, _extends({ | ||
className: _className, | ||
className: cx("chakra-stat", className), | ||
ref: ref | ||
@@ -176,20 +127,8 @@ }, rest), /*#__PURE__*/React.createElement("dl", null, children))); | ||
} | ||
/** | ||
* StatGroup | ||
* | ||
* The component to group multiple stats together | ||
*/ | ||
export var StatGroup = /*#__PURE__*/React.forwardRef(function StatGroup(props, ref) { | ||
var { | ||
className | ||
} = props, | ||
rest = _objectWithoutPropertiesLoose(props, ["className"]); | ||
return /*#__PURE__*/React.createElement(chakra.div, _extends({ | ||
return /*#__PURE__*/React.createElement(chakra.div, _extends({}, props, { | ||
ref: ref, | ||
role: "group", | ||
className: cx("chakra-stat__group", className) | ||
}, rest, { | ||
className: cx("chakra-stat__group", props.className), | ||
__css: { | ||
@@ -196,0 +135,0 @@ display: "flex", |
{ | ||
"name": "@chakra-ui/stat", | ||
"version": "1.0.0-next.6", | ||
"version": "1.0.0-next.7", | ||
"description": "A React component for displaying statistics", | ||
@@ -50,14 +50,14 @@ "keywords": [ | ||
"dependencies": { | ||
"@chakra-ui/icon": "^1.0.0-next.6", | ||
"@chakra-ui/utils": "^1.0.0-next.6", | ||
"@chakra-ui/visually-hidden": "^1.0.0-next.6" | ||
"@chakra-ui/icon": "^1.0.0-next.7", | ||
"@chakra-ui/utils": "^1.0.0-next.7", | ||
"@chakra-ui/visually-hidden": "^1.0.0-next.7" | ||
}, | ||
"devDependencies": { | ||
"@chakra-ui/system": "^1.0.0-next.6" | ||
"@chakra-ui/system": "^1.0.0-next.7" | ||
}, | ||
"peerDependencies": { | ||
"@chakra-ui/system": "^1.0.0-next.5", | ||
"@chakra-ui/system": "^1.0.0-next.7", | ||
"react": "16.x" | ||
}, | ||
"gitHead": "72eeca4ba3fc6e7d8845b0d283a03cb6ec384a50" | ||
"gitHead": "3dcabd8c7e21b32ae1b61485588f70370c4e626f" | ||
} |
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 too big to display
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
150527
697