@commercetools-uikit/stamp
Advanced tools
Comparing version 0.0.0-canary-13a4f7037f77a041964e36460e7beb59f08a246f to 0.0.0-canary-202010215528
@@ -5,9 +5,10 @@ 'use strict'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var PropTypes = _interopDefault(require('prop-types')); | ||
var PropTypes = require('prop-types'); | ||
var core = require('@emotion/core'); | ||
var designSystem = require('@commercetools-uikit/design-system'); | ||
var InsetSquish = _interopDefault(require('@commercetools-uikit/spacings-inset-squish')); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes); | ||
function _defineProperty(obj, key, value) { | ||
@@ -63,2 +64,6 @@ if (key in obj) { | ||
var availableTones = ['critical', 'warning', 'positive', 'information', 'primary', 'secondary']; | ||
var getPaddingStyle = function getPaddingStyle(props) { | ||
if (props.isCondensed) return core.css("padding:1px ", designSystem.customProperties.spacingXs, ";"); | ||
return core.css("padding:", designSystem.customProperties.spacingXs, " ", designSystem.customProperties.spacingS, ";"); | ||
}; | ||
var getToneStyles = function getToneStyles(props, theme) { | ||
@@ -102,17 +107,16 @@ var overwrittenVars = _objectSpread2(_objectSpread2({}, designSystem.customProperties), theme); | ||
css: function css(theme) { | ||
return [getStampStyles(props, theme), getToneStyles(props, theme)]; | ||
return [getStampStyles(props, theme), getToneStyles(props, theme), getPaddingStyle(props)]; | ||
} | ||
}, core.jsx(InsetSquish, { | ||
scale: "s" | ||
}, props.children)); | ||
}, props.children); | ||
}; | ||
Stamp.displayName = 'Stamp'; | ||
Stamp.propTypes = process.env.NODE_ENV !== "production" ? { | ||
tone: PropTypes.oneOf(availableTones).isRequired, | ||
children: PropTypes.node.isRequired | ||
tone: PropTypes__default['default'].oneOf(availableTones).isRequired, | ||
isCondensed: PropTypes__default['default'].bool, | ||
children: PropTypes__default['default'].node.isRequired | ||
} : {}; | ||
var version = '0.0.0-canary-13a4f7037f77a041964e36460e7beb59f08a246f'; | ||
var version = '0.0.0-canary-202010215528'; | ||
exports.default = Stamp; | ||
exports.version = version; |
import PropTypes from 'prop-types'; | ||
import { jsx, css } from '@emotion/core'; | ||
import { customProperties } from '@commercetools-uikit/design-system'; | ||
import InsetSquish from '@commercetools-uikit/spacings-inset-squish'; | ||
@@ -56,2 +55,6 @@ function _defineProperty(obj, key, value) { | ||
var availableTones = ['critical', 'warning', 'positive', 'information', 'primary', 'secondary']; | ||
var getPaddingStyle = function getPaddingStyle(props) { | ||
if (props.isCondensed) return css("padding:1px ", customProperties.spacingXs, ";"); | ||
return css("padding:", customProperties.spacingXs, " ", customProperties.spacingS, ";"); | ||
}; | ||
var getToneStyles = function getToneStyles(props, theme) { | ||
@@ -95,7 +98,5 @@ var overwrittenVars = _objectSpread2(_objectSpread2({}, customProperties), theme); | ||
css: function css(theme) { | ||
return [getStampStyles(props, theme), getToneStyles(props, theme)]; | ||
return [getStampStyles(props, theme), getToneStyles(props, theme), getPaddingStyle(props)]; | ||
} | ||
}, jsx(InsetSquish, { | ||
scale: "s" | ||
}, props.children)); | ||
}, props.children); | ||
}; | ||
@@ -105,8 +106,9 @@ Stamp.displayName = 'Stamp'; | ||
tone: PropTypes.oneOf(availableTones).isRequired, | ||
isCondensed: PropTypes.bool, | ||
children: PropTypes.node.isRequired | ||
} : {}; | ||
var version = '0.0.0-canary-13a4f7037f77a041964e36460e7beb59f08a246f'; | ||
var version = '0.0.0-canary-202010215528'; | ||
export default Stamp; | ||
export { version }; |
{ | ||
"name": "@commercetools-uikit/stamp", | ||
"version": "0.0.0-canary-13a4f7037f77a041964e36460e7beb59f08a246f", | ||
"description": "", | ||
"main": "dist/stamp.cjs.js", | ||
"module": "dist/stamp.esm.js", | ||
"description": "Stamps are visual labels which hold small amounts of information regarding an item. (E.g Indicating if a product is published in a list).", | ||
"version": "0.0.0-canary-202010215528", | ||
"bugs": "https://github.com/commercetools/ui-kit/issues", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/commercetools/ui-kit.git", | ||
"directory": "packages/components/stamp" | ||
}, | ||
"homepage": "https://uikit.commercetools.com", | ||
"keywords": [ | ||
"javascript", | ||
"design system", | ||
"react", | ||
"uikit" | ||
], | ||
"license": "MIT", | ||
"private": false, | ||
@@ -11,16 +23,15 @@ "publishConfig": { | ||
}, | ||
"sideEffects": false, | ||
"main": "dist/stamp.cjs.js", | ||
"module": "dist/stamp.esm.js", | ||
"files": ["dist"], | ||
"scripts": { | ||
"prepare": "../../../scripts/version.js replace", | ||
"prebuild": "rimraf dist", | ||
"build": "cross-env NODE_ENV=production rollup -c ../../../rollup.config.js -i ./src/index.js" | ||
"build": "cross-env NODE_ENV=production rollup -c ../../../rollup.config.js -i ./src/index.js", | ||
"generate-readme": "generate-readme ." | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"sideEffects": false, | ||
"license": "MIT", | ||
"dependencies": { | ||
"@commercetools-uikit/design-system": "0.0.0-canary-13a4f7037f77a041964e36460e7beb59f08a246f", | ||
"@commercetools-uikit/spacings-inset-squish": "0.0.0-canary-13a4f7037f77a041964e36460e7beb59f08a246f", | ||
"@emotion/core": "10.0.28", | ||
"@commercetools-uikit/design-system": "0.0.0-canary-202010215528", | ||
"@emotion/core": "^10.0.34", | ||
"prop-types": "15.7.2" | ||
@@ -30,4 +41,3 @@ }, | ||
"react": ">= 16.8.0" | ||
}, | ||
"gitHead": "5f63d3ebfe81e02c4166958386725a1bd10f79b2" | ||
} | ||
} |
@@ -0,1 +1,4 @@ | ||
<!-- THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. --> | ||
<!-- This file is created by the `yarn generate-readme` script. --> | ||
# Stamp | ||
@@ -5,12 +8,38 @@ | ||
Stamps are visual labels which hold small amounts of information regarding an item. (E.g Indicating if a product is published in a list) | ||
Stamps are visual labels which hold small amounts of information regarding an item. (E.g Indicating if a product is published in a list). | ||
## Installation | ||
``` | ||
yarn add @commercetools-uikit/stamp | ||
``` | ||
``` | ||
npm --save install @commercetools-uikit/stamp | ||
``` | ||
Additionally install the peer dependencies (if not present) | ||
``` | ||
yarn add react | ||
``` | ||
``` | ||
npm --save install react | ||
``` | ||
## Usage | ||
```jsx | ||
import React from 'react'; | ||
import Stamp from '@commercetools-uikit/stamp'; | ||
import Text from '@commercetools-uikit/text'; | ||
<Stamp tone="primary"> | ||
<Text.Detail>{'Hello'}</Text.Detail> | ||
</Stamp>; | ||
const Example = () => ( | ||
<Stamp tone="primary"> | ||
<Text.Detail>Hello</Text.Detail> | ||
</Stamp> | ||
); | ||
export default Example; | ||
``` | ||
@@ -20,5 +49,6 @@ | ||
| Props | Type | Required | Values | Default | | ||
| ---------- | ---------------- | :------: | ---------------------------------------------------------------------------- | ------- | | ||
| `tone` | `String` | ✅ | `['critical', 'warning', 'positive', 'information', 'primary', 'secondary']` | - | | ||
| `children` | `PropTypes.node` | ✅ | - | - | | ||
| Props | Type | Required | Default | Description | | ||
| ------------- | ------------------------------------------------------------------------------------------------------------------ | :------: | ------- | ----------------------------------- | | ||
| `tone` | `enum`<br>Possible values:<br>`'critical' \| 'warning' \| 'positive' \| 'information' \| 'primary' \| 'secondary'` | ✅ | | Indicates the color scheme of stamp | | ||
| `isCondensed` | `bool` | | | | | ||
| `children` | `node` | ✅ | | | |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
15222
4
6
204
1
53
2
+ Added@commercetools-uikit/design-system@0.0.0-canary-202010215528(transitive)
+ Added@emotion/core@10.3.1(transitive)
- Removed@commercetools-uikit/spacings-inset-squish@0.0.0-canary-13a4f7037f77a041964e36460e7beb59f08a246f
- Removed@commercetools-uikit/design-system@0.0.0-canary-13a4f7037f77a041964e36460e7beb59f08a246f(transitive)
- Removed@commercetools-uikit/spacings-inset-squish@0.0.0-canary-13a4f7037f77a041964e36460e7beb59f08a246f(transitive)
- Removed@commercetools-uikit/utils@0.0.0-canary-13a4f7037f77a041964e36460e7beb59f08a246f(transitive)
- Removed@emotion/core@10.0.28(transitive)
- Removed@emotion/is-prop-valid@0.8.8(transitive)
- Removedwarning@4.0.3(transitive)
Updated@commercetools-uikit/design-system@0.0.0-canary-202010215528
Updated@emotion/core@^10.0.34