@entur/chip
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.2.2](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.1...@entur/chip@0.2.2) (2019-12-10) | ||
### Bug Fixes | ||
- spreading styles on ChoiceChip-components ([4bdfef8](https://bitbucket.org/enturas/design-system/commits/4bdfef86acdc29e3620a9b20792812672b58bfa6)) | ||
- **icon position:** consistent spacing for icons in chips ([f8ab91f](https://bitbucket.org/enturas/design-system/commits/f8ab91f255e70f1945d7145e6aef7c5136232bc1)) | ||
- adding default prop as part of documentation ([1ef7510](https://bitbucket.org/enturas/design-system/commits/1ef75107362f6262429d7fe31519b4353eccc8de)) | ||
## [0.2.1](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.0...@entur/chip@0.2.1) (2019-11-29) | ||
@@ -8,0 +16,0 @@ |
@@ -31,6 +31,12 @@ 'use strict'; | ||
disabled = _ref$disabled === void 0 ? false : _ref$disabled, | ||
rest = _objectWithoutProperties(_ref, ["className", "children", "value", "disabled"]); | ||
style = _ref.style, | ||
rest = _objectWithoutProperties(_ref, ["className", "children", "value", "disabled", "style"]); | ||
var childrenArray = React.Children.toArray(children); | ||
var hasLeadingIcon = childrenArray.length > 1 && typeof childrenArray[0] !== 'string'; | ||
var hasTrailingIcon = childrenArray.length > 1 && typeof childrenArray[childrenArray.length - 1] !== 'string'; | ||
var classList = cx(className, 'eds-chip', { | ||
'eds-chip--disabled': disabled | ||
'eds-chip--disabled': disabled, | ||
'eds-chip--leading-icon': hasLeadingIcon, | ||
'eds-chip--trailing-icon': hasTrailingIcon | ||
}); | ||
@@ -44,3 +50,4 @@ | ||
return React.createElement("label", { | ||
className: "eds-choice-chip" | ||
className: "eds-choice-chip", | ||
style: style | ||
}, React.createElement("input", Object.assign({ | ||
@@ -67,4 +74,10 @@ className: "eds-choice-chip__input", | ||
var childrenArray = React.Children.toArray(children); | ||
var hasLeadingIcon = childrenArray.length > 1 && typeof childrenArray[0] !== 'string'; | ||
var hasTrailingIcon = childrenArray.length > 1 && typeof childrenArray[childrenArray.length - 1] !== 'string'; | ||
return React.createElement("button", Object.assign({ | ||
className: cx('eds-chip', 'eds-action-chip', className), | ||
className: cx('eds-chip', 'eds-action-chip', { | ||
'eds-chip--leading-icon': hasLeadingIcon, | ||
'eds-chip--trailing-icon': hasTrailingIcon | ||
}, className), | ||
ref: ref, | ||
@@ -71,0 +84,0 @@ type: "button" |
@@ -1,2 +0,2 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var a=e(require("@babel/runtime/helpers/objectWithoutProperties")),n=e(require("react")),r=e(require("classnames")),t=n.createContext(null),c=t.Provider,i=n.forwardRef((function(e,c){var i=e.className,s=e.children,o=e.value,l=e.disabled,u=void 0!==l&&l,h=a(e,["className","children","value","disabled"]),d=r(i,"eds-chip",{"eds-chip--disabled":u}),p=function(){var e=n.useContext(t);if(!e)throw new Error("You need to wrap your ChoiceChips in a ChoiceChipGroup-component");return e}();return n.createElement("label",{className:"eds-choice-chip"},n.createElement("input",Object.assign({className:"eds-choice-chip__input",type:"radio",name:p.name,ref:c,value:o,disabled:u,checked:p.value===o,onChange:p.onChange},h)),n.createElement("div",{className:d},s))}));exports.ActionChip=n.forwardRef((function(e,t){var c=e.children,i=e.className,s=a(e,["children","className"]);return n.createElement("button",Object.assign({className:r("eds-chip","eds-action-chip",i),ref:t,type:"button"},s),c)})),exports.ChoiceChip=i,exports.ChoiceChipGroup=function(e){var r=e.name,t=e.value,i=e.children,s=e.onChange,o=a(e,["name","value","children","onChange"]),l=n.useMemo((function(){return{name:r,value:t,onChange:s}}),[r,t,s]);return n.createElement(c,{value:l},n.createElement("div",Object.assign({className:"eds-choice-chips-group"},o),i))}; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var n=e(require("@babel/runtime/helpers/objectWithoutProperties")),t=e(require("react")),i=e(require("classnames")),r=t.createContext(null),a=r.Provider,c=t.forwardRef((function(e,a){var c=e.className,s=e.children,o=e.value,l=e.disabled,h=void 0!==l&&l,d=e.style,u=n(e,["className","children","value","disabled","style"]),p=t.Children.toArray(s),m=i(c,"eds-chip",{"eds-chip--disabled":h,"eds-chip--leading-icon":p.length>1&&"string"!=typeof p[0],"eds-chip--trailing-icon":p.length>1&&"string"!=typeof p[p.length-1]}),g=function(){var e=t.useContext(r);if(!e)throw new Error("You need to wrap your ChoiceChips in a ChoiceChipGroup-component");return e}();return t.createElement("label",{className:"eds-choice-chip",style:d},t.createElement("input",Object.assign({className:"eds-choice-chip__input",type:"radio",name:g.name,ref:a,value:o,disabled:h,checked:g.value===o,onChange:g.onChange},u)),t.createElement("div",{className:m},s))}));exports.ActionChip=t.forwardRef((function(e,r){var a=e.children,c=e.className,s=n(e,["children","className"]),o=t.Children.toArray(a);return t.createElement("button",Object.assign({className:i("eds-chip","eds-action-chip",{"eds-chip--leading-icon":o.length>1&&"string"!=typeof o[0],"eds-chip--trailing-icon":o.length>1&&"string"!=typeof o[o.length-1]},c),ref:r,type:"button"},s),a)})),exports.ChoiceChip=c,exports.ChoiceChipGroup=function(e){var i=e.name,r=e.value,c=e.children,s=e.onChange,o=n(e,["name","value","children","onChange"]),l=t.useMemo((function(){return{name:i,value:r,onChange:s}}),[i,r,s]);return t.createElement(a,{value:l},t.createElement("div",Object.assign({className:"eds-choice-chips-group"},o),c))}; | ||
//# sourceMappingURL=chip.cjs.production.min.js.map |
@@ -27,6 +27,12 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties'; | ||
disabled = _ref$disabled === void 0 ? false : _ref$disabled, | ||
rest = _objectWithoutProperties(_ref, ["className", "children", "value", "disabled"]); | ||
style = _ref.style, | ||
rest = _objectWithoutProperties(_ref, ["className", "children", "value", "disabled", "style"]); | ||
var childrenArray = React.Children.toArray(children); | ||
var hasLeadingIcon = childrenArray.length > 1 && typeof childrenArray[0] !== 'string'; | ||
var hasTrailingIcon = childrenArray.length > 1 && typeof childrenArray[childrenArray.length - 1] !== 'string'; | ||
var classList = cx(className, 'eds-chip', { | ||
'eds-chip--disabled': disabled | ||
'eds-chip--disabled': disabled, | ||
'eds-chip--leading-icon': hasLeadingIcon, | ||
'eds-chip--trailing-icon': hasTrailingIcon | ||
}); | ||
@@ -40,3 +46,4 @@ | ||
return React.createElement("label", { | ||
className: "eds-choice-chip" | ||
className: "eds-choice-chip", | ||
style: style | ||
}, React.createElement("input", Object.assign({ | ||
@@ -63,4 +70,10 @@ className: "eds-choice-chip__input", | ||
var childrenArray = React.Children.toArray(children); | ||
var hasLeadingIcon = childrenArray.length > 1 && typeof childrenArray[0] !== 'string'; | ||
var hasTrailingIcon = childrenArray.length > 1 && typeof childrenArray[childrenArray.length - 1] !== 'string'; | ||
return React.createElement("button", Object.assign({ | ||
className: cx('eds-chip', 'eds-action-chip', className), | ||
className: cx('eds-chip', 'eds-action-chip', { | ||
'eds-chip--leading-icon': hasLeadingIcon, | ||
'eds-chip--trailing-icon': hasTrailingIcon | ||
}, className), | ||
ref: ref, | ||
@@ -67,0 +80,0 @@ type: "button" |
@@ -5,3 +5,5 @@ import React from "react"; | ||
className?: string; | ||
/** Om Choicechip er deaktivert eller ikke */ | ||
/** Om Choicechip er deaktivert eller ikke | ||
* @default false | ||
*/ | ||
disabled?: boolean; | ||
@@ -8,0 +10,0 @@ /** Label til ChoiceChip */ |
{ | ||
"name": "@entur/chip", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"license": "EUPL-1.2", | ||
@@ -33,3 +33,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "063faba53aff9f8a3248ca8880f9f1dd3db36a9d" | ||
"gitHead": "c518a56619cd30d0c7254b0f9f5298c69e54a8a0" | ||
} |
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
57107
353