@entur/chip
Advanced tools
Comparing version 0.2.8 to 0.2.9
@@ -6,2 +6,6 @@ # Change Log | ||
## [0.2.9](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.8...@entur/chip@0.2.9) (2020-01-14) | ||
**Note:** Version bump only for package @entur/chip | ||
## [0.2.8](https://bitbucket.org/enturas/design-system/compare/@entur/chip@0.2.7...@entur/chip@0.2.8) (2020-01-13) | ||
@@ -8,0 +12,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var utils = require('@entur/utils'); | ||
var _objectWithoutProperties = _interopDefault(require('@babel/runtime/helpers/objectWithoutProperties')); | ||
var React = _interopDefault(require('react')); | ||
@@ -11,2 +12,17 @@ var cx = _interopDefault(require('classnames')); | ||
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; | ||
} | ||
var ChoiceChipGroupContext = | ||
@@ -35,3 +51,3 @@ /*#__PURE__*/ | ||
style = _ref.style, | ||
rest = _objectWithoutProperties(_ref, ["className", "children", "value", "disabled", "style"]); | ||
rest = _objectWithoutPropertiesLoose(_ref, ["className", "children", "value", "disabled", "style"]); | ||
@@ -74,3 +90,3 @@ var childrenArray = React.Children.toArray(children); | ||
className = _ref.className, | ||
rest = _objectWithoutProperties(_ref, ["children", "className"]); | ||
rest = _objectWithoutPropertiesLoose(_ref, ["children", "className"]); | ||
@@ -95,3 +111,3 @@ var childrenArray = React.Children.toArray(children); | ||
onChange = _ref.onChange, | ||
rest = _objectWithoutProperties(_ref, ["name", "value", "children", "onChange"]); | ||
rest = _objectWithoutPropertiesLoose(_ref, ["name", "value", "children", "onChange"]); | ||
@@ -98,0 +114,0 @@ var contextValue = React.useMemo(function () { |
@@ -1,2 +0,2 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var n=require("@entur/utils"),t=e(require("@babel/runtime/helpers/objectWithoutProperties")),r=e(require("react")),i=e(require("classnames")),a=require("@entur/form"),c=r.createContext(null),s=c.Provider,o=r.forwardRef((function(e,n){var a=e.className,s=e.children,o=e.value,l=e.disabled,h=void 0!==l&&l,u=e.style,d=t(e,["className","children","value","disabled","style"]),p=r.Children.toArray(s),m=i(a,"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=r.useContext(c);if(!e)throw new Error("You need to wrap your ChoiceChips in a ChoiceChipGroup-component");return e}();return r.createElement("label",{className:"eds-choice-chip",style:u},r.createElement("input",Object.assign({className:"eds-choice-chip__input",type:"radio",name:g.name,ref:n,value:o,disabled:h,checked:g.value===o,onChange:g.onChange},d)),r.createElement("div",{className:m},s))})),l=r.forwardRef((function(e,n){var a=e.children,c=e.className,s=t(e,["children","className"]),o=r.Children.toArray(a);return r.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:n,type:"button"},s),a)}));n.warnAboutMissingStyles("chip","form"),exports.ActionChip=l,exports.ChoiceChip=o,exports.ChoiceChipGroup=function(e){var n=e.name,i=e.value,c=e.children,o=e.onChange,l=t(e,["name","value","children","onChange"]),h=r.useMemo((function(){return{name:n,value:i,onChange:o}}),[n,i,o]);return r.createElement(s,{value:h},r.createElement(a.Fieldset,Object.assign({className:"eds-choice-chips-group"},l),c))}; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var n=require("@entur/utils"),t=e(require("react")),r=e(require("classnames")),i=require("@entur/form");function a(e,n){if(null==e)return{};var t,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)n.indexOf(t=a[r])>=0||(i[t]=e[t]);return i}var c=t.createContext(null),s=c.Provider,l=t.forwardRef((function(e,n){var i=e.className,s=e.children,l=e.value,o=e.disabled,u=void 0!==o&&o,h=e.style,d=a(e,["className","children","value","disabled","style"]),p=t.Children.toArray(s),f=r(i,"eds-chip",{"eds-chip--disabled":u,"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(c);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:h},t.createElement("input",Object.assign({className:"eds-choice-chip__input",type:"radio",name:g.name,ref:n,value:l,disabled:u,checked:g.value===l,onChange:g.onChange},d)),t.createElement("div",{className:f},s))})),o=t.forwardRef((function(e,n){var i=e.children,c=e.className,s=a(e,["children","className"]),l=t.Children.toArray(i);return t.createElement("button",Object.assign({className:r("eds-chip","eds-action-chip",{"eds-chip--leading-icon":l.length>1&&"string"!=typeof l[0],"eds-chip--trailing-icon":l.length>1&&"string"!=typeof l[l.length-1]},c),ref:n,type:"button"},s),i)}));n.warnAboutMissingStyles("chip","form"),exports.ActionChip=o,exports.ChoiceChip=l,exports.ChoiceChipGroup=function(e){var n=e.name,r=e.value,c=e.children,l=e.onChange,o=a(e,["name","value","children","onChange"]),u=t.useMemo((function(){return{name:n,value:r,onChange:l}}),[n,r,l]);return t.createElement(s,{value:u},t.createElement(i.Fieldset,Object.assign({className:"eds-choice-chips-group"},o),c))}; | ||
//# sourceMappingURL=chip.cjs.production.min.js.map |
import { warnAboutMissingStyles } from '@entur/utils'; | ||
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties'; | ||
import React from 'react'; | ||
@@ -7,2 +6,17 @@ import cx from 'classnames'; | ||
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; | ||
} | ||
var ChoiceChipGroupContext = | ||
@@ -31,3 +45,3 @@ /*#__PURE__*/ | ||
style = _ref.style, | ||
rest = _objectWithoutProperties(_ref, ["className", "children", "value", "disabled", "style"]); | ||
rest = _objectWithoutPropertiesLoose(_ref, ["className", "children", "value", "disabled", "style"]); | ||
@@ -70,3 +84,3 @@ var childrenArray = React.Children.toArray(children); | ||
className = _ref.className, | ||
rest = _objectWithoutProperties(_ref, ["children", "className"]); | ||
rest = _objectWithoutPropertiesLoose(_ref, ["children", "className"]); | ||
@@ -91,3 +105,3 @@ var childrenArray = React.Children.toArray(children); | ||
onChange = _ref.onChange, | ||
rest = _objectWithoutProperties(_ref, ["name", "value", "children", "onChange"]); | ||
rest = _objectWithoutPropertiesLoose(_ref, ["name", "value", "children", "onChange"]); | ||
@@ -94,0 +108,0 @@ var contextValue = React.useMemo(function () { |
{ | ||
"name": "@entur/chip", | ||
"version": "0.2.8", | ||
"version": "0.2.9", | ||
"license": "EUPL-1.2", | ||
@@ -30,8 +30,8 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@entur/form": "^2.2.1", | ||
"@entur/tokens": "^1.1.1", | ||
"@entur/utils": "^0.2.0", | ||
"@entur/form": "^2.2.2", | ||
"@entur/tokens": "^1.1.2", | ||
"@entur/utils": "^0.2.1", | ||
"classnames": "^2.2.6" | ||
}, | ||
"gitHead": "af54ee3149f8b3867555d5fdd68699821d5b8fae" | ||
"gitHead": "424f5b8ed5df86c1332f683d13a3ef59efc977ba" | ||
} |
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
61094
19
399
Updated@entur/form@^2.2.2
Updated@entur/tokens@^1.1.2
Updated@entur/utils@^0.2.1