@entur/button
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -6,2 +6,12 @@ # Change Log | ||
# [2.1.0](https://bitbucket.org/enturas/design-system/compare/@entur/button@2.0.0...@entur/button@2.1.0) (2020-01-31) | ||
### Bug Fixes | ||
- **Bugfiks: let square buttons accept "as":** let square buttons accept "as" ([a94eec1](https://bitbucket.org/enturas/design-system/commits/a94eec11e3e6a65361df2d1087a52afc792051dc)) | ||
### Features | ||
- **Add types for as in square button:** add types for as in square button ([2a71ee3](https://bitbucket.org/enturas/design-system/commits/2a71ee3af96214a5a92957d4d1dd348ec4bc5255)) | ||
# [2.0.0](https://bitbucket.org/enturas/design-system/compare/@entur/button@1.6.1...@entur/button@2.0.0) (2020-01-28) | ||
@@ -8,0 +18,0 @@ |
@@ -10,4 +10,12 @@ import React from 'react'; | ||
variant: 'success' | 'secondary'; | ||
/** Deaktivering av knappen | ||
* @default false | ||
*/ | ||
disabled?: boolean; | ||
/** HTML-elementet eller React-komponenten som lager knappen | ||
* @default 'button' | ||
*/ | ||
as?: 'a' | 'button' | React.ElementType; | ||
[key: string]: any; | ||
}; | ||
export declare const BaseSquareButton: React.FC<BaseSquareButtonProps>; |
@@ -143,5 +143,10 @@ 'use strict'; | ||
variant = _ref.variant, | ||
rest = _objectWithoutPropertiesLoose(_ref, ["children", "className", "variant"]); | ||
_ref$disabled = _ref.disabled, | ||
disabled = _ref$disabled === void 0 ? false : _ref$disabled, | ||
_ref$as = _ref.as, | ||
as = _ref$as === void 0 ? 'button' : _ref$as, | ||
rest = _objectWithoutPropertiesLoose(_ref, ["children", "className", "variant", "disabled", "as"]); | ||
return React.createElement("button", Object.assign({ | ||
var Element = disabled ? 'button' : as; | ||
return React.createElement(Element, Object.assign({ | ||
className: classNames('eds-square-button', { | ||
@@ -148,0 +153,0 @@ 'eds-square-button--success': variant === 'success' |
@@ -1,2 +0,2 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@entur/utils"),n=e(require("react")),r=e(require("classnames"));function a(e,t){if(null==e)return{};var n,r,a={},s=Object.keys(e);for(r=0;r<s.length;r++)t.indexOf(n=s[r])>=0||(a[n]=e[n]);return a}var s=n.forwardRef((function(e,t){var s,i=e.variant,o=e.size,u=void 0===o?"medium":o,c=e.loading,l=e.className,d=e.children,f=e.disabled,b=void 0!==f&&f,m=e.width,g=void 0===m?"auto":m,v=e.as,p=void 0===v?"button":v,y=a(e,["variant","size","loading","className","children","disabled","width","as"]),h=b?"button":p,N=n.Children.toArray(d),j=N.length>1&&"string"!=typeof N[0],E=N.length>1&&"string"!=typeof N[N.length-1];return n.createElement(h,Object.assign({className:r("eds-button",(s={},s["eds-button--variant-"+i]=i,s["eds-button--size-"+u]=u,s["eds-button--width-fluid"]="fluid"===g,s["eds-button--loading"]=c,s["eds-button--leading-icon"]=j,s["eds-button--trailing-icon"]=E,s),l),ref:t,"aria-busy":c,disabled:b,"aria-disabled":b},y),c?n.createElement("div",{className:"eds-button__spinner"}):d)})),i=n.forwardRef((function(e,t){return n.createElement(s,Object.assign({},e,{ref:t,variant:"primary"}))})),o=n.forwardRef((function(e,t){return n.createElement(s,Object.assign({},e,{ref:t,variant:"secondary"}))})),u=n.forwardRef((function(e,t){return n.createElement(s,Object.assign({},e,{ref:t,variant:"success"}))})),c=n.forwardRef((function(e,t){return n.createElement(s,Object.assign({},e,{ref:t,variant:"negative"}))})),l=n.forwardRef((function(e,t){return n.createElement(s,Object.assign({},e,{ref:t,variant:"tertiary"}))})),d=function(e){var t=e.children,s=e.className,i=e.variant,o=a(e,["children","className","variant"]);return n.createElement("button",Object.assign({className:r("eds-square-button",{"eds-square-button--success":"success"===i},{"eds-square-button--secondary":"secondary"===i},s)},o),n.Children.map(t,(function(e){return n.createElement("span","string"==typeof e?{className:"eds-square-button__label"}:{className:"eds-square-button__icon"},e)})))};t.warnAboutMissingStyles("button"),exports.Button=s,exports.ButtonGroup=function(e){var t=e.as,s=void 0===t?"div":t,i=e.className,o=a(e,["as","className"]);return n.createElement(s,Object.assign({className:r("eds-button-group",i)},o))},exports.FloatingButton=function(e){var t=e.className,s=e.children,i=e.size,o=void 0===i?"medium":i,u=a(e,["className","children","size"]);return n.createElement("button",Object.assign({className:r("eds-floating-button",{"eds-floating-button--extended":n.Children.count(s)>1},{"eds-floating-button--small":"small"===o},t),type:"button"},u),function(e){return n.Children.map(e,(function(e){return"string"==typeof e?n.createElement("span",null,e):e}))}(s))},exports.NegativeButton=c,exports.PrimaryButton=i,exports.SecondaryButton=o,exports.SecondarySquareButton=function(e){return n.createElement(d,Object.assign({},e,{variant:"secondary"}))},exports.SuccessButton=u,exports.SuccessSquareButton=function(e){return n.createElement(d,Object.assign({},e,{variant:"success"}))},exports.TertiaryButton=l; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@entur/utils"),n=e(require("react")),a=e(require("classnames"));function r(e,t){if(null==e)return{};var n,a,r={},s=Object.keys(e);for(a=0;a<s.length;a++)t.indexOf(n=s[a])>=0||(r[n]=e[n]);return r}var s=n.forwardRef((function(e,t){var s,i=e.variant,o=e.size,u=void 0===o?"medium":o,c=e.loading,d=e.className,l=e.children,f=e.disabled,b=void 0!==f&&f,m=e.width,g=void 0===m?"auto":m,v=e.as,p=void 0===v?"button":v,y=r(e,["variant","size","loading","className","children","disabled","width","as"]),h=b?"button":p,N=n.Children.toArray(l),j=N.length>1&&"string"!=typeof N[0],E=N.length>1&&"string"!=typeof N[N.length-1];return n.createElement(h,Object.assign({className:a("eds-button",(s={},s["eds-button--variant-"+i]=i,s["eds-button--size-"+u]=u,s["eds-button--width-fluid"]="fluid"===g,s["eds-button--loading"]=c,s["eds-button--leading-icon"]=j,s["eds-button--trailing-icon"]=E,s),d),ref:t,"aria-busy":c,disabled:b,"aria-disabled":b},y),c?n.createElement("div",{className:"eds-button__spinner"}):l)})),i=n.forwardRef((function(e,t){return n.createElement(s,Object.assign({},e,{ref:t,variant:"primary"}))})),o=n.forwardRef((function(e,t){return n.createElement(s,Object.assign({},e,{ref:t,variant:"secondary"}))})),u=n.forwardRef((function(e,t){return n.createElement(s,Object.assign({},e,{ref:t,variant:"success"}))})),c=n.forwardRef((function(e,t){return n.createElement(s,Object.assign({},e,{ref:t,variant:"negative"}))})),d=n.forwardRef((function(e,t){return n.createElement(s,Object.assign({},e,{ref:t,variant:"tertiary"}))})),l=function(e){var t=e.children,s=e.className,i=e.variant,o=e.disabled,u=void 0!==o&&o,c=e.as,d=void 0===c?"button":c,l=r(e,["children","className","variant","disabled","as"]);return n.createElement(u?"button":d,Object.assign({className:a("eds-square-button",{"eds-square-button--success":"success"===i},{"eds-square-button--secondary":"secondary"===i},s)},l),n.Children.map(t,(function(e){return n.createElement("span","string"==typeof e?{className:"eds-square-button__label"}:{className:"eds-square-button__icon"},e)})))};t.warnAboutMissingStyles("button"),exports.Button=s,exports.ButtonGroup=function(e){var t=e.as,s=void 0===t?"div":t,i=e.className,o=r(e,["as","className"]);return n.createElement(s,Object.assign({className:a("eds-button-group",i)},o))},exports.FloatingButton=function(e){var t=e.className,s=e.children,i=e.size,o=void 0===i?"medium":i,u=r(e,["className","children","size"]);return n.createElement("button",Object.assign({className:a("eds-floating-button",{"eds-floating-button--extended":n.Children.count(s)>1},{"eds-floating-button--small":"small"===o},t),type:"button"},u),function(e){return n.Children.map(e,(function(e){return"string"==typeof e?n.createElement("span",null,e):e}))}(s))},exports.NegativeButton=c,exports.PrimaryButton=i,exports.SecondaryButton=o,exports.SecondarySquareButton=function(e){return n.createElement(l,Object.assign({},e,{variant:"secondary"}))},exports.SuccessButton=u,exports.SuccessSquareButton=function(e){return n.createElement(l,Object.assign({},e,{variant:"success"}))},exports.TertiaryButton=d; | ||
//# sourceMappingURL=button.cjs.production.min.js.map |
@@ -137,5 +137,10 @@ import { warnAboutMissingStyles } from '@entur/utils'; | ||
variant = _ref.variant, | ||
rest = _objectWithoutPropertiesLoose(_ref, ["children", "className", "variant"]); | ||
_ref$disabled = _ref.disabled, | ||
disabled = _ref$disabled === void 0 ? false : _ref$disabled, | ||
_ref$as = _ref.as, | ||
as = _ref$as === void 0 ? 'button' : _ref$as, | ||
rest = _objectWithoutPropertiesLoose(_ref, ["children", "className", "variant", "disabled", "as"]); | ||
return React.createElement("button", Object.assign({ | ||
var Element = disabled ? 'button' : as; | ||
return React.createElement(Element, Object.assign({ | ||
className: classNames('eds-square-button', { | ||
@@ -142,0 +147,0 @@ 'eds-square-button--success': variant === 'success' |
{ | ||
"name": "@entur/button", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"license": "EUPL-1.2", | ||
@@ -36,3 +36,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "618617acaf1300290f805dd5773be22c0e62afad" | ||
"gitHead": "faa5f854e797dc58f324608d8dc731fff81b0bbb" | ||
} |
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
106733
25
918