@entur/button
Advanced tools
Comparing version 2.2.11 to 2.3.0
@@ -6,2 +6,8 @@ # Change Log | ||
# [2.3.0](https://bitbucket.org/enturas/design-system/compare/@entur/button@2.2.11...@entur/button@2.3.0) (2020-07-03) | ||
### Features | ||
- add forwardref for squarebuttons ([bb118a1](https://bitbucket.org/enturas/design-system/commits/bb118a15f07706773273ca2009bb6e338d599d27)) | ||
## [2.2.11](https://bitbucket.org/enturas/design-system/compare/@entur/button@2.2.10...@entur/button@2.2.11) (2020-06-17) | ||
@@ -8,0 +14,0 @@ |
@@ -25,2 +25,2 @@ import React from 'react'; | ||
}; | ||
export declare const BaseSquareButton: React.FC<BaseSquareButtonProps>; | ||
export declare const BaseSquareButton: React.ForwardRefExoticComponent<Pick<BaseSquareButtonProps, React.ReactText> & React.RefAttributes<HTMLButtonElement>>; |
@@ -139,3 +139,5 @@ 'use strict'; | ||
var BaseSquareButton = function BaseSquareButton(_ref) { | ||
var BaseSquareButton = | ||
/*#__PURE__*/ | ||
React.forwardRef(function (_ref, ref) { | ||
var children = _ref.children, | ||
@@ -163,3 +165,4 @@ className = _ref.className, | ||
disabled: disabled, | ||
"aria-disabled": disabled | ||
"aria-disabled": disabled, | ||
ref: ref | ||
}, rest), React.Children.map(children, function (child) { | ||
@@ -178,15 +181,23 @@ if (typeof child === 'string') { | ||
})); | ||
}; | ||
}); | ||
var SecondarySquareButton = function SecondarySquareButton(props) { | ||
return React.createElement(BaseSquareButton, Object.assign({}, props, { | ||
var SecondarySquareButton = | ||
/*#__PURE__*/ | ||
React.forwardRef(function (props, ref) { | ||
return React.createElement(BaseSquareButton, Object.assign({ | ||
ref: ref | ||
}, props, { | ||
variant: "secondary" | ||
})); | ||
}; | ||
}); | ||
var SuccessSquareButton = function SuccessSquareButton(props) { | ||
return React.createElement(BaseSquareButton, Object.assign({}, props, { | ||
var SuccessSquareButton = | ||
/*#__PURE__*/ | ||
React.forwardRef(function (props, ref) { | ||
return React.createElement(BaseSquareButton, Object.assign({ | ||
ref: ref | ||
}, props, { | ||
variant: "success" | ||
})); | ||
}; | ||
}); | ||
@@ -193,0 +204,0 @@ var IconButton = |
@@ -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")),a=e(require("classnames"));function s(e,t){if(null==e)return{};var n,a,s={},r=Object.keys(e);for(a=0;a<r.length;a++)t.indexOf(n=r[a])>=0||(s[n]=e[n]);return s}var r=n.forwardRef((function(e,t){var r,i=e.variant,o=e.size,u=void 0===o?"medium":o,d=e.loading,c=e.className,l=e.children,b=e.disabled,f=void 0!==b&&b,m=e.width,v=void 0===m?"auto":m,g=e.as,p=void 0===g?"button":g,y=s(e,["variant","size","loading","className","children","disabled","width","as"]),N=f?"button":p,h=n.Children.toArray(l),E=h.length>1&&"string"!=typeof h[0],j=h.length>1&&"string"!=typeof h[h.length-1];return n.createElement(N,Object.assign({className:a("eds-button",(r={},r["eds-button--variant-"+i]=i,r["eds-button--size-"+u]=u,r["eds-button--width-fluid"]="fluid"===v,r["eds-button--loading"]=d,r["eds-button--leading-icon"]=E,r["eds-button--trailing-icon"]=j,r),c),ref:t,"aria-busy":d,disabled:f,"aria-disabled":f},y),d?n.createElement("div",{className:"eds-button__spinner"}):l)})),i=n.forwardRef((function(e,t){return n.createElement(r,Object.assign({},e,{ref:t,variant:"primary"}))})),o=n.forwardRef((function(e,t){return n.createElement(r,Object.assign({},e,{ref:t,variant:"secondary"}))})),u=n.forwardRef((function(e,t){return n.createElement(r,Object.assign({},e,{ref:t,variant:"success"}))})),d=n.forwardRef((function(e,t){return n.createElement(r,Object.assign({},e,{ref:t,variant:"negative"}))})),c=n.forwardRef((function(e,t){return n.createElement(r,Object.assign({},e,{ref:t,variant:"tertiary"}))})),l=function(e){var t=e.children,r=e.className,i=e.variant,o=e.disabled,u=void 0!==o&&o,d=e.loading,c=void 0!==d&&d,l=e.as,b=void 0===l?"button":l,f=s(e,["children","className","variant","disabled","loading","as"]);return n.createElement(u?"button":b,Object.assign({className:a("eds-square-button",{"eds-square-button--success":"success"===i},{"eds-square-button--secondary":"secondary"===i},{"eds-square-button--loading":c},r),"aria-busy":c,disabled:u,"aria-disabled":u},f),n.Children.map(t,(function(e){return"string"==typeof e?n.createElement("span",{className:"eds-square-button__label"},e):n.createElement("span",{className:"eds-square-button__icon"},c?n.createElement("div",{className:"eds-button__spinner"}):e)})))},b=n.forwardRef((function(e,t){var r=e.children,i=e.className,o=e.disabled,u=void 0!==o&&o,d=e.as,c=void 0===d?"button":d,l=s(e,["children","className","variant","disabled","as"]);return n.createElement(u?"button":c,Object.assign({className:a("eds-icon-button",i,{"eds-icon-button--disabled":u}),disabled:u,"aria-disabled":u,ref:t},l),r)}));t.warnAboutMissingStyles("button"),exports.Button=r,exports.ButtonGroup=function(e){var t=e.as,r=void 0===t?"div":t,i=e.className,o=s(e,["as","className"]);return n.createElement(r,Object.assign({className:a("eds-button-group",i)},o))},exports.FloatingButton=function(e){var t=e.className,r=e.children,i=e.size,o=void 0===i?"medium":i,u=s(e,["className","children","size"]);return n.createElement("button",Object.assign({className:a("eds-floating-button",{"eds-floating-button--extended":n.Children.count(r)>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}))}(r))},exports.IconButton=b,exports.NegativeButton=d,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=c; | ||
"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,d=e.loading,c=e.className,l=e.children,f=e.disabled,b=void 0!==f&&f,m=e.width,v=void 0===m?"auto":m,g=e.as,p=void 0===g?"button":g,y=r(e,["variant","size","loading","className","children","disabled","width","as"]),N=b?"button":p,h=n.Children.toArray(l),E=h.length>1&&"string"!=typeof h[0],j=h.length>1&&"string"!=typeof h[h.length-1];return n.createElement(N,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"===v,s["eds-button--loading"]=d,s["eds-button--leading-icon"]=E,s["eds-button--trailing-icon"]=j,s),c),ref:t,"aria-busy":d,disabled:b,"aria-disabled":b},y),d?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"}))})),d=n.forwardRef((function(e,t){return n.createElement(s,Object.assign({},e,{ref:t,variant:"negative"}))})),c=n.forwardRef((function(e,t){return n.createElement(s,Object.assign({},e,{ref:t,variant:"tertiary"}))})),l=n.forwardRef((function(e,t){var s=e.children,i=e.className,o=e.variant,u=e.disabled,d=void 0!==u&&u,c=e.loading,l=void 0!==c&&c,f=e.as,b=void 0===f?"button":f,m=r(e,["children","className","variant","disabled","loading","as"]);return n.createElement(d?"button":b,Object.assign({className:a("eds-square-button",{"eds-square-button--success":"success"===o},{"eds-square-button--secondary":"secondary"===o},{"eds-square-button--loading":l},i),"aria-busy":l,disabled:d,"aria-disabled":d,ref:t},m),n.Children.map(s,(function(e){return"string"==typeof e?n.createElement("span",{className:"eds-square-button__label"},e):n.createElement("span",{className:"eds-square-button__icon"},l?n.createElement("div",{className:"eds-button__spinner"}):e)})))})),f=n.forwardRef((function(e,t){return n.createElement(l,Object.assign({ref:t},e,{variant:"secondary"}))})),b=n.forwardRef((function(e,t){return n.createElement(l,Object.assign({ref:t},e,{variant:"success"}))})),m=n.forwardRef((function(e,t){var s=e.children,i=e.className,o=e.disabled,u=void 0!==o&&o,d=e.as,c=void 0===d?"button":d,l=r(e,["children","className","variant","disabled","as"]);return n.createElement(u?"button":c,Object.assign({className:a("eds-icon-button",i,{"eds-icon-button--disabled":u}),disabled:u,"aria-disabled":u,ref:t},l),s)}));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.IconButton=m,exports.NegativeButton=d,exports.PrimaryButton=i,exports.SecondaryButton=o,exports.SecondarySquareButton=f,exports.SuccessButton=u,exports.SuccessSquareButton=b,exports.TertiaryButton=c; | ||
//# sourceMappingURL=button.cjs.production.min.js.map |
@@ -133,3 +133,5 @@ import { warnAboutMissingStyles } from '@entur/utils'; | ||
var BaseSquareButton = function BaseSquareButton(_ref) { | ||
var BaseSquareButton = | ||
/*#__PURE__*/ | ||
React.forwardRef(function (_ref, ref) { | ||
var children = _ref.children, | ||
@@ -157,3 +159,4 @@ className = _ref.className, | ||
disabled: disabled, | ||
"aria-disabled": disabled | ||
"aria-disabled": disabled, | ||
ref: ref | ||
}, rest), React.Children.map(children, function (child) { | ||
@@ -172,15 +175,23 @@ if (typeof child === 'string') { | ||
})); | ||
}; | ||
}); | ||
var SecondarySquareButton = function SecondarySquareButton(props) { | ||
return React.createElement(BaseSquareButton, Object.assign({}, props, { | ||
var SecondarySquareButton = | ||
/*#__PURE__*/ | ||
React.forwardRef(function (props, ref) { | ||
return React.createElement(BaseSquareButton, Object.assign({ | ||
ref: ref | ||
}, props, { | ||
variant: "secondary" | ||
})); | ||
}; | ||
}); | ||
var SuccessSquareButton = function SuccessSquareButton(props) { | ||
return React.createElement(BaseSquareButton, Object.assign({}, props, { | ||
var SuccessSquareButton = | ||
/*#__PURE__*/ | ||
React.forwardRef(function (props, ref) { | ||
return React.createElement(BaseSquareButton, Object.assign({ | ||
ref: ref | ||
}, props, { | ||
variant: "success" | ||
})); | ||
}; | ||
}); | ||
@@ -187,0 +198,0 @@ var IconButton = |
@@ -21,2 +21,2 @@ import React from 'react'; | ||
}; | ||
export declare const SecondarySquareButton: React.FC<SecondarySquareButtonProps>; | ||
export declare const SecondarySquareButton: React.ForwardRefExoticComponent<Pick<SecondarySquareButtonProps, React.ReactText> & React.RefAttributes<HTMLButtonElement>>; |
@@ -21,2 +21,2 @@ import React from 'react'; | ||
}; | ||
export declare const SuccessSquareButton: React.FC<SuccessSquareButtonProps>; | ||
export declare const SuccessSquareButton: React.ForwardRefExoticComponent<Pick<SuccessSquareButtonProps, React.ReactText> & React.RefAttributes<HTMLButtonElement>>; |
{ | ||
"name": "@entur/button", | ||
"version": "2.2.11", | ||
"version": "2.3.0", | ||
"license": "EUPL-1.2", | ||
@@ -34,5 +34,5 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@entur/tokens": "^1.3.5" | ||
"@entur/tokens": "^1.3.6" | ||
}, | ||
"gitHead": "3a208d5a7728adceb92b3f53c460f0a6d8f31051" | ||
"gitHead": "288ecc6509544f555534be1ca794c4c087056cd2" | ||
} |
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
128627
1149