@leafygreen-ui/button
Advanced tools
Comparing version 12.0.4 to 12.0.5
# @leafygreen-ui/button | ||
## 12.0.5 | ||
### Patch Changes | ||
- 539fab10: Fixes a React console error when providing an onChange handler to a Radio Group | ||
## 12.0.4 | ||
@@ -4,0 +10,0 @@ |
@@ -1,2 +0,2 @@ | ||
import n,{useRef as r,useEffect as e}from"react";import o from"prop-types";import t from"@leafygreen-ui/box";import{css as a,cx as i}from"@leafygreen-ui/emotion";import{fontFamilies as u,spacing as c}from"@leafygreen-ui/tokens";import{registerRipple as l}from"@leafygreen-ui/ripple";import{useUsingKeyboardContext as f}from"@leafygreen-ui/leafygreen-provider";import{transparentize as d}from"polished";import{uiColors as p}from"@leafygreen-ui/palette";import{jsx as g}from"@emotion/react";function s(n,r,e){return r in n?Object.defineProperty(n,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[r]=e,n}function x(){return(x=Object.assign||function(n){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o])}return n}).apply(this,arguments)}function b(n,r){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),e.push.apply(e,o)}return e}function h(n){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?b(Object(e),!0).forEach((function(r){s(n,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):b(Object(e)).forEach((function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(e,r))}))}return n}function v(n,r){if(null==n)return{};var e,o,t=function(n,r){if(null==n)return{};var e,o,t={},a=Object.keys(n);for(o=0;o<a.length;o++)e=a[o],r.indexOf(e)>=0||(t[e]=n[e]);return t}(n,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);for(o=0;o<a.length;o++)e=a[o],r.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(n,e)&&(t[e]=n[e])}return t}function y(n,r){return r||(r=n.slice(0)),Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(r)}}))}var m,k,w,O,D,P,j,z,S,N,F,M,G={Primary:"primary",PrimaryOutline:"primaryOutline",Default:"default",Danger:"danger",DangerOutline:"dangerOutline"},B={XSmall:"xsmall",Small:"small",Default:"default",Large:"large"},L="light",E="dark";function I(){var n=y(["\n font-size: 16px;\n // Pixel pushing for optical alignment purposes\n transform: translateY(1px);\n "]);return I=function(){return n},n}function X(){var n=y(["\n font-size: 14px;\n "]);return X=function(){return n},n}function C(){var n=y(["\n height: 48px;\n font-size: 18px;\n line-height: 24px;\n "]);return C=function(){return n},n}function A(){var n=y(["\n height: 36px;\n "]);return A=function(){return n},n}function K(){var n=y(["\n height: 28px;\n "]);return K=function(){return n},n}function R(){var n=y(["\n height: 22px;\n text-transform: uppercase;\n font-size: 12px;\n line-height: 1em;\n font-weight: bold;\n letter-spacing: 0.4px;\n "]);return R=function(){return n},n}function T(){var n=y(["\n background: rgba(61, 79, 88, 0.3);\n border: 1px solid ",";\n color: ",";\n cursor: not-allowed;\n\n &:hover {\n background: rgba(61, 79, 88, 0.3);\n border: 1px solid ",";\n color: ",";\n cursor: not-allowed;\n }\n "]);return T=function(){return n},n}function Y(){var n=y(["\n background-color: ",";\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 1px ",";\n cursor: not-allowed;\n color: ",";\n\n &:hover {\n background-color: ",";\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 1px ",";\n cursor: not-allowed;\n color: ",";\n }\n "]);return Y=function(){return n},n}function q(){var n=y(["\n &:focus {\n background: rgba(249, 114, 22, 0.08);\n border: 1px solid #f97216;\n box-shadow: 0px 0px 0px 3px #019ee2;\n }\n "]);return q=function(){return n},n}function H(){var n=y(["\n &:focus {\n background: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "]);return H=function(){return n},n}function J(){var n=y(["\n &:focus {\n background-color: ",";\n box-shadow: 0px 0px 0px 3px #2f9fc5;\n }\n "]);return J=function(){return n},n}function Q(){var n=y(["\n &:focus {\n background: rgba(10, 208, 91, 0.08);\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px #139fd7;\n }\n "]);return Q=function(){return n},n}function U(){var n=y(["\n &:focus {\n background: ",";\n box-shadow: 0px 4px 4px rgba(0, 124, 173, 0.4),\n 0px 0px 0px 3px ",";\n }\n "]);return U=function(){return n},n}function V(){var n=y(["\n &:focus {\n background: rgba(207, 74, 34, 0.04);\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px #019ee2;\n }\n "]);return V=function(){return n},n}function W(){var n=y(["\n &:focus {\n background-color: ",";\n box-shadow: 0px 4px 4px rgba(0, 124, 173, 0.4),\n 0px 0px 0px 3px ",";\n }\n "]);return W=function(){return n},n}function Z(){var n=y(["\n &:focus {\n background: ",";\n border: 1px solid ",";\n box-shadow: 0px 4px 4px rgba(0, 124, 173, 0.4),\n 0px 0px 0px 3px ",";\n }\n "]);return Z=function(){return n},n}function $(){var n=y(["\n &:focus {\n background-color: rgba(9, 128, 76, 0.04);\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "]);return $=function(){return n},n}function _(){var n=y(["\n &:focus {\n background-color: ",";\n box-shadow: 0px 4px 4px rgba(0, 124, 173, 0.4),\n 0px 0px 0px 3px ",";\n }\n "]);return _=function(){return n},n}function nn(){var n=y(["\n border: 1px solid #f97216;\n color: #f97216;\n\n &:focus {\n color: #f97216;\n }\n\n &:hover,\n &:active {\n color: #f97216;\n background: rgba(249, 114, 22, 0.08);\n box-shadow: 0px 0px 0px 3px ",";\n }\n "]);return nn=function(){return n},n}function rn(){var n=y(["\n background-color: ",";\n border: 1px solid #f97216;\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border: 1px solid #f97216;\n box-shadow: 0px 0px 0px 3px ",";\n }\n "]);return rn=function(){return n},n}function en(){var n=y(["\n background-color: ",";\n border: 1px solid ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "]);return en=function(){return n},n}function on(){var n=y(["\n border: 1px solid ",";\n color: #0ad05b;\n\n &:focus {\n color: #0ad05b;\n }\n\n &:hover,\n &:active {\n color: #0ad05b;\n background-color: rgba(10, 208, 91, 0.08);\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "]);return on=function(){return n},n}function tn(){var n=y(["\n background-color: ",";\n border: 1px solid ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "]);return tn=function(){return n},n}function an(){var n=y(["\n border: 1px solid ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background: rgba(207, 74, 34, 0.04);\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 4px ",";\n }\n "]);return an=function(){return n},n}function un(){var n=y(["\n background-color: ",";\n box-shadow: 0px 1px 2px rgba(207, 74, 34, 0.4);\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n box-shadow: 0px 4px 4px rgba(207, 74, 34, 0.25),\n 0px 0px 0px 3px ",";\n }\n "]);return un=function(){return n},n}function cn(){var n=y(["\n background-color: ",";\n border: 1px solid ",";\n box-shadow: 0px 1px 2px rgba(6, 22, 33, 0.3);\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border: 1px solid ",";\n box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.3),\n 0px 0px 0px 3px ",";\n }\n "]);return cn=function(){return n},n}function ln(){var n=y(["\n border: 1px solid ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: rgba(9, 128, 76, 0.04); // green dark 1\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "]);return ln=function(){return n},n}function fn(){var n=y(["\n background-color: ",";\n box-shadow: 0px 2px 3px rgba(19, 170, 82, 0.4);\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n box-shadow: 0px 2px 3px rgba(19, 170, 82, 0.4), 0px 0px 0px 3px #c3e7ca;\n }\n "]);return fn=function(){return n},n}function dn(){var n=y(["\n // unset browser default\n appearance: none;\n padding: 0;\n margin: 0;\n background-color: transparent;\n border: 0px solid transparent;\n display: inline-flex;\n align-items: stretch;\n border-radius: 4px;\n transition: all 150ms ease-in-out;\n position: relative;\n text-decoration: none;\n cursor: pointer;\n z-index: 0;\n\n &:focus {\n outline: none;\n }\n\n &:disabled {\n pointer-events: none;\n }\n\n &:active,\n &:focus,\n &:hover {\n text-decoration: none;\n }\n"]);return dn=function(){return n},n}var pn=a(dn()),gn=(s(w={},L,(s(m={},G.Primary,a(fn(),p.green.dark1,p.white,p.white,p.white,p.green.dark2)),s(m,G.PrimaryOutline,a(ln(),p.green.dark1,p.green.dark2,p.green.dark2,p.green.dark2,p.green.dark1,p.green.light2)),s(m,G.Default,a(cn(),p.gray.light3,p.gray.base,p.gray.dark2,p.gray.dark2,p.gray.dark2,p.white,p.gray.dark1,p.gray.light2)),s(m,G.Danger,a(un(),p.red.base,p.white,p.white,p.white,p.red.dark1,p.red.light2)),s(m,G.DangerOutline,a(an(),p.red.base,p.red.dark2,p.red.dark2,p.red.dark2,p.red.base,p.red.light2)),m)),s(w,E,(s(k={},G.Primary,a(tn(),p.green.dark2,p.green.base,p.white,p.white,p.white,p.green.dark1,p.green.dark2)),s(k,G.PrimaryOutline,a(on(),p.green.base,p.green.base,p.green.dark2)),s(k,G.Default,a(en(),p.gray.dark2,p.gray.base,p.white,p.white,p.white,p.gray.dark1,p.gray.base,p.gray.dark2)),s(k,G.Danger,a(rn(),p.red.dark1,p.white,p.white,p.white,p.red.base,p.red.dark2)),s(k,G.DangerOutline,a(nn(),p.red.dark2)),k)),w),sn=(s(P={},L,(s(O={},G.Primary,a(_(),p.green.dark2,p.focus)),s(O,G.PrimaryOutline,a($(),p.green.dark1,p.focus)),s(O,G.Default,a(Z(),p.white,p.gray.dark1,p.focus)),s(O,G.Danger,a(W(),p.red.dark1,p.focus)),s(O,G.DangerOutline,a(V(),p.red.dark2)),O)),s(P,E,(s(D={},G.Primary,a(U(),p.green.dark1,p.focus)),s(D,G.PrimaryOutline,a(Q(),p.green.dark1)),s(D,G.Default,a(J(),p.gray.dark1)),s(D,G.Danger,a(H(),p.red.base,p.focus)),s(D,G.DangerOutline,a(q())),D)),P),xn=(s(j={},L,a(Y(),p.gray.light2,p.gray.light2,p.gray.light1,p.gray.dark1,p.gray.light2,p.gray.light2,p.gray.light1,p.gray.dark1)),s(j,E,a(T(),p.gray.dark2,p.gray.base,p.gray.dark2,p.gray.base)),j),bn=(s(z={},B.XSmall,a(R())),s(z,B.Small,a(K())),s(z,B.Default,a(A())),s(z,B.Large,a(C())),z),hn=(s(S={},14,a(X())),s(S,16,a(I())),S);var vn,yn,mn,kn,wn,On,Dn,Pn,jn="#0AD05B",zn="#09804C",Sn="#F97216",Nn=(s(M={},L,(s(N={},G.Primary,jn),s(N,G.PrimaryOutline,d(.76,zn)),s(N,G.Default,p.gray.light2),s(N,G.Danger,Sn),s(N,G.DangerOutline,d(.76,p.red.base)),N)),s(M,E,(s(F={},G.Primary,jn),s(F,G.PrimaryOutline,d(.76,p.green.base)),s(F,G.Default,p.gray.base),s(F,G.Danger,Sn),s(F,G.DangerOutline,d(.76,Sn)),F)),M);function Fn(){var n=y(["\n color: ",";\n "]);return Fn=function(){return n},n}function Mn(){var n=y(["\n color: ",";\n "]);return Mn=function(){return n},n}function Gn(){var n=y(["\n height: 20px;\n width: 20px;\n "]);return Gn=function(){return n},n}function Bn(){var n=y(["\n height: 16px;\n width: 16px;\n "]);return Bn=function(){return n},n}function Ln(){var n=y(["\n height: 16px;\n width: 16px;\n "]);return Ln=function(){return n},n}function En(){var n=y(["\n height: 14px;\n width: 14px;\n "]);return En=function(){return n},n}function In(){var n=y(["\n color: #f97216;\n "]);return In=function(){return n},n}function Xn(){var n=y(["\n color: ",";\n "]);return Xn=function(){return n},n}function Cn(){var n=y(["\n color: ",";\n "]);return Cn=function(){return n},n}function An(){var n=y(["\n color: #0ad05b;\n "]);return An=function(){return n},n}function Kn(){var n=y(["\n color: ",";\n "]);return Kn=function(){return n},n}function Rn(){var n=y(["\n color: #cf4a22;\n "]);return Rn=function(){return n},n}function Tn(){var n=y(["\n color: ",";\n "]);return Tn=function(){return n},n}function Yn(){var n=y(["\n color: ",";\n "]);return Yn=function(){return n},n}function qn(){var n=y(["\n color: ",";\n "]);return qn=function(){return n},n}function Hn(){var n=y(["\n color: ",";\n "]);return Hn=function(){return n},n}function Jn(){var n=y(["\n color: #f97216;\n "]);return Jn=function(){return n},n}function Qn(){var n=y(["\n color: ",";\n "]);return Qn=function(){return n},n}function Un(){var n=y(["\n color: ",";\n "]);return Un=function(){return n},n}function Vn(){var n=y(["\n color: #13aa52;\n "]);return Vn=function(){return n},n}function Wn(){var n=y(["\n color: ",";\n "]);return Wn=function(){return n},n}function Zn(){var n=y(["\n color: ",";\n "]);return Zn=function(){return n},n}function $n(){var n=y(["\n color: ",";\n "]);return $n=function(){return n},n}function _n(){var n=y(["\n color: ",";\n "]);return _n=function(){return n},n}function nr(){var n=y(["\n color: ",";\n "]);return nr=function(){return n},n}function rr(){var n=y(["\n color: ",";\n "]);return rr=function(){return n},n}var er,or=(s(mn={},L,(s(vn={},G.Primary,a(rr(),p.green.light3)),s(vn,G.PrimaryOutline,a(nr(),p.green.dark1)),s(vn,G.Default,a(_n(),p.gray.dark1)),s(vn,G.Danger,a($n(),p.red.light3)),s(vn,G.DangerOutline,a(Zn(),p.red.base)),vn)),s(mn,E,(s(yn={},G.Primary,a(Wn(),p.green.light2)),s(yn,G.PrimaryOutline,a(Vn())),s(yn,G.Default,a(Un(),p.gray.light1)),s(yn,G.Danger,a(Qn(),p.red.light3)),s(yn,G.DangerOutline,a(Jn())),yn)),mn),tr=(s(On={},L,(s(kn={},G.Primary,a(Hn(),p.white)),s(kn,G.PrimaryOutline,a(qn(),p.green.dark1)),s(kn,G.Default,a(Yn(),p.gray.dark2)),s(kn,G.Danger,a(Tn(),p.white)),s(kn,G.DangerOutline,a(Rn())),kn)),s(On,E,(s(wn={},G.Primary,a(Kn(),p.white)),s(wn,G.PrimaryOutline,a(An())),s(wn,G.Default,a(Cn(),p.white)),s(wn,G.Danger,a(Xn(),p.white)),s(wn,G.DangerOutline,a(In())),wn)),On),ar=(s(Dn={},B.XSmall,a(En())),s(Dn,B.Small,a(Ln())),s(Dn,B.Default,a(Bn())),s(Dn,B.Large,a(Gn())),Dn),ir=(s(Pn={},L,a(Mn(),p.gray.light1)),s(Pn,E,a(Fn(),p.gray.dark1)),Pn);function ur(r){var e=r.glyph,o=r.variant,t=r.size,a=r.darkMode,u=r.disabled,c=r.isIconOnlyButton,l=r.className,f=!c&&{"aria-hidden":!0,role:"presentation"},d=a?E:L,p=c?tr[d][o]:or[d][o];return n.cloneElement(e,h({className:i(p,s({},ir[d],u),ar[t],l)},f))}function cr(){var n=y(["margin-left: ",";}"]);return cr=function(){return n},n}function lr(){var n=y(["\n display: flex;\n align-items: center;\n justify-content: center;\n margin-left: auto;\n "]);return lr=function(){return n},n}function fr(){var n=y(["\n vertical-align: text-top;\n "]);return fr=function(){return n},n}function dr(){var n=y(["margin-right: ",";}"]);return dr=function(){return n},n}function pr(){var n=y(["\n justify-content: center;\n "]);return pr=function(){return n},n}function gr(){var n=y(["\n justify-content: space-between;\n "]);return gr=function(){return n},n}function sr(){var n=y(["\n padding-left: ","px;\n padding-right: ","px;\n "]);return sr=function(){return n},n}function xr(){var n=y(["\n padding-left: 12px;\n padding-right: 12px;\n "]);return xr=function(){return n},n}function br(){var n=y(["\n padding-left: 12px;\n padding-right: 12px;\n "]);return br=function(){return n},n}function hr(){var n=y(["\n padding-left: 6px;\n padding-right: 6px;\n "]);return hr=function(){return n},n}function vr(){var n=y(["\n display: flex;\n align-items: center;\n height: 100%;\n width: 100%;\n pointer-events: none;\n position: relative;\n z-index: 0;\n font-family: ",";\n"]);return vr=function(){return n},n}function yr(){var n=y(["\n overflow: hidden;\n border-radius: 3px;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n"]);return yr=function(){return n},n}ur.displayName="ButtonIcon";var mr=a(yr()),kr=a(vr(),u.default),wr=(s(er={},B.XSmall,a(hr())),s(er,B.Small,a(br())),s(er,B.Default,a(xr())),s(er,B.Large,a(sr(),c[3],c[3])),er),Or=n.forwardRef((function(o,u){var c,d,p=o.variant,b=void 0===p?G.Default:p,y=o.size,m=void 0===y?B.Default:y,k=o.darkMode,w=void 0!==k&&k,O=o.baseFontSize,D=void 0===O?14:O,P=o.disabled,j=void 0!==P&&P,z=o.leftGlyph,S=o.rightGlyph,N=o.children,F=o.className,M=v(o,["variant","size","darkMode","baseFontSize","disabled","leftGlyph","rightGlyph","children","className"]),I=f().usingKeyboard,X=r(null);e((function(){var n,r=Nn[w?E:L][b];return null!=X.current&&(n=l(X.current,{backgroundColor:r})),n}),[X,b,w]);var C,A=null!==(c=(z||S)&&!N)&&void 0!==c&&c,K=function(n){var r=n.variant,e=n.size,o=n.darkMode,t=n.baseFontSize,a=n.disabled,u=n.showFocus,c=o?E:L,l=gn[c][r],f=sn[c][r],d=bn[e],p=hn[t];return i(pn,l,s({},f,u),s({},xn[c],a),p,d)}({variant:b,size:m,darkMode:w,baseFontSize:D,disabled:j,showFocus:I}),R="string"==typeof M.href;(M.as&&"button"===M.as||!R&&!M.as)&&(C="button");var T=h({type:C,className:i(K,F),ref:u,as:function(n,r){return n&&!r?"a":"button"}(R,j)},"string"!=typeof M.href&&{disabled:j},{"aria-disabled":j},M),Y={variant:b,size:m,darkMode:w,disabled:j,isIconOnlyButton:A},q=m===B.Large?"8px":"6px",H=g(n.Fragment,null,g("div",{className:mr,ref:X}),g("div",{className:i(kr,(d={},s(d,a(gr()),!!S),s(d,a(pr()),!S),d),wr[m])},z&&g(ur,x({glyph:z,className:i(s({},a(dr(),q),!A),a(fr()))},Y)),N,S&&g("span",{className:a(lr())},g(ur,x({glyph:S,className:A?"":a(cr(),q)},Y)))));return g(t,T,H)}));Or.displayName="Button",Or.propTypes={variant:o.oneOf(Object.values(G)),darkMode:o.bool,baseFontSize:o.oneOf([14,16]),size:o.oneOf(Object.values(B)),disabled:o.bool,leftGlyph:o.element,rightGlyph:o.element,href:o.string};export default Or;export{B as Size,G as Variant}; | ||
import n,{useRef as r,useEffect as e}from"react";import o from"prop-types";import a from"@leafygreen-ui/box";import{css as t,cx as i}from"@leafygreen-ui/emotion";import{fontFamilies as l,spacing as d}from"@leafygreen-ui/tokens";import{registerRipple as p}from"@leafygreen-ui/ripple";import{useUsingKeyboardContext as c}from"@leafygreen-ui/leafygreen-provider";import{transparentize as g}from"polished";import{uiColors as s}from"@leafygreen-ui/palette";import{jsx as x}from"@emotion/react";function u(n,r){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),e.push.apply(e,o)}return e}function b(n){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?u(Object(e),!0).forEach((function(r){f(n,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):u(Object(e)).forEach((function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(e,r))}))}return n}function f(n,r,e){return r in n?Object.defineProperty(n,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[r]=e,n}function h(){return(h=Object.assign||function(n){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o])}return n}).apply(this,arguments)}function y(n,r){if(null==n)return{};var e,o,a=function(n,r){if(null==n)return{};var e,o,a={},t=Object.keys(n);for(o=0;o<t.length;o++)e=t[o],r.indexOf(e)>=0||(a[e]=n[e]);return a}(n,r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);for(o=0;o<t.length;o++)e=t[o],r.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(n,e)&&(a[e]=n[e])}return a}function m(n,r){return r||(r=n.slice(0)),Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(r)}}))}var k,w,v,O,D,P,j,z,S,N,F,M,G,B,L,E,I,X,C,A,K,R,T,Y,q,H,J,Q,U,V,W,Z,$,_,nn,rn,en,on,an,tn,ln,dn={Primary:"primary",PrimaryOutline:"primaryOutline",Default:"default",Danger:"danger",DangerOutline:"dangerOutline"},pn={XSmall:"xsmall",Small:"small",Default:"default",Large:"large"},cn="light",gn="dark",sn=t(k||(k=m(["\n // unset browser default\n appearance: none;\n padding: 0;\n margin: 0;\n background-color: transparent;\n border: 0px solid transparent;\n display: inline-flex;\n align-items: stretch;\n border-radius: 4px;\n transition: all 150ms ease-in-out;\n position: relative;\n text-decoration: none;\n cursor: pointer;\n z-index: 0;\n\n &:focus {\n outline: none;\n }\n\n &:disabled {\n pointer-events: none;\n }\n\n &:active,\n &:focus,\n &:hover {\n text-decoration: none;\n }\n"]))),xn=(f(B={},cn,(f(j={},dn.Primary,t(w||(w=m(["\n background-color: ",";\n box-shadow: 0px 2px 3px rgba(19, 170, 82, 0.4);\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n box-shadow: 0px 2px 3px rgba(19, 170, 82, 0.4), 0px 0px 0px 3px #c3e7ca;\n }\n "])),s.green.dark1,s.white,s.white,s.white,s.green.dark2)),f(j,dn.PrimaryOutline,t(v||(v=m(["\n border: 1px solid ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: rgba(9, 128, 76, 0.04); // green dark 1\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),s.green.dark1,s.green.dark2,s.green.dark2,s.green.dark2,s.green.dark1,s.green.light2)),f(j,dn.Default,t(O||(O=m(["\n background-color: ",";\n border: 1px solid ",";\n box-shadow: 0px 1px 2px rgba(6, 22, 33, 0.3);\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border: 1px solid ",";\n box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.3),\n 0px 0px 0px 3px ",";\n }\n "])),s.gray.light3,s.gray.base,s.gray.dark2,s.gray.dark2,s.gray.dark2,s.white,s.gray.dark1,s.gray.light2)),f(j,dn.Danger,t(D||(D=m(["\n background-color: ",";\n box-shadow: 0px 1px 2px rgba(207, 74, 34, 0.4);\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n box-shadow: 0px 4px 4px rgba(207, 74, 34, 0.25),\n 0px 0px 0px 3px ",";\n }\n "])),s.red.base,s.white,s.white,s.white,s.red.dark1,s.red.light2)),f(j,dn.DangerOutline,t(P||(P=m(["\n border: 1px solid ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background: rgba(207, 74, 34, 0.04);\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 4px ",";\n }\n "])),s.red.base,s.red.dark2,s.red.dark2,s.red.dark2,s.red.base,s.red.light2)),j)),f(B,gn,(f(G={},dn.Primary,t(z||(z=m(["\n background-color: ",";\n border: 1px solid ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),s.green.dark2,s.green.base,s.white,s.white,s.white,s.green.dark1,s.green.dark2)),f(G,dn.PrimaryOutline,t(S||(S=m(["\n border: 1px solid ",";\n color: #0ad05b;\n\n &:focus {\n color: #0ad05b;\n }\n\n &:hover,\n &:active {\n color: #0ad05b;\n background-color: rgba(10, 208, 91, 0.08);\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),s.green.base,s.green.base,s.green.dark2)),f(G,dn.Default,t(N||(N=m(["\n background-color: ",";\n border: 1px solid ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),s.gray.dark2,s.gray.base,s.white,s.white,s.white,s.gray.dark1,s.gray.base,s.gray.dark2)),f(G,dn.Danger,t(F||(F=m(["\n background-color: ",";\n border: 1px solid #f97216;\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border: 1px solid #f97216;\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),s.red.dark1,s.white,s.white,s.white,s.red.base,s.red.dark2)),f(G,dn.DangerOutline,t(M||(M=m(["\n border: 1px solid #f97216;\n color: #f97216;\n\n &:focus {\n color: #f97216;\n }\n\n &:hover,\n &:active {\n color: #f97216;\n background: rgba(249, 114, 22, 0.08);\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),s.red.dark2)),G)),B),un=(f(J={},cn,(f(A={},dn.Primary,t(L||(L=m(["\n &:focus {\n background-color: ",";\n box-shadow: 0px 4px 4px rgba(0, 124, 173, 0.4),\n 0px 0px 0px 3px ",";\n }\n "])),s.green.dark2,s.focus)),f(A,dn.PrimaryOutline,t(E||(E=m(["\n &:focus {\n background-color: rgba(9, 128, 76, 0.04);\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),s.green.dark1,s.focus)),f(A,dn.Default,t(I||(I=m(["\n &:focus {\n background: ",";\n border: 1px solid ",";\n box-shadow: 0px 4px 4px rgba(0, 124, 173, 0.4),\n 0px 0px 0px 3px ",";\n }\n "])),s.white,s.gray.dark1,s.focus)),f(A,dn.Danger,t(X||(X=m(["\n &:focus {\n background-color: ",";\n box-shadow: 0px 4px 4px rgba(0, 124, 173, 0.4),\n 0px 0px 0px 3px ",";\n }\n "])),s.red.dark1,s.focus)),f(A,dn.DangerOutline,t(C||(C=m(["\n &:focus {\n background: rgba(207, 74, 34, 0.04);\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px #019ee2;\n }\n "])),s.red.dark2)),A)),f(J,gn,(f(H={},dn.Primary,t(K||(K=m(["\n &:focus {\n background: ",";\n box-shadow: 0px 4px 4px rgba(0, 124, 173, 0.4),\n 0px 0px 0px 3px ",";\n }\n "])),s.green.dark1,s.focus)),f(H,dn.PrimaryOutline,t(R||(R=m(["\n &:focus {\n background: rgba(10, 208, 91, 0.08);\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px #139fd7;\n }\n "])),s.green.dark1)),f(H,dn.Default,t(T||(T=m(["\n &:focus {\n background-color: ",";\n box-shadow: 0px 0px 0px 3px #2f9fc5;\n }\n "])),s.gray.dark1)),f(H,dn.Danger,t(Y||(Y=m(["\n &:focus {\n background: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),s.red.base,s.focus)),f(H,dn.DangerOutline,t(q||(q=m(["\n &:focus {\n background: rgba(249, 114, 22, 0.08);\n border: 1px solid #f97216;\n box-shadow: 0px 0px 0px 3px #019ee2;\n }\n "])))),H)),J),bn=(f(V={},cn,t(Q||(Q=m(["\n background-color: ",";\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 1px ",";\n cursor: not-allowed;\n color: ",";\n\n &:hover {\n background-color: ",";\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 1px ",";\n cursor: not-allowed;\n color: ",";\n }\n "])),s.gray.light2,s.gray.light2,s.gray.light1,s.gray.dark1,s.gray.light2,s.gray.light2,s.gray.light1,s.gray.dark1)),f(V,gn,t(U||(U=m(["\n background: rgba(61, 79, 88, 0.3);\n border: 1px solid ",";\n color: ",";\n cursor: not-allowed;\n\n &:hover {\n background: rgba(61, 79, 88, 0.3);\n border: 1px solid ",";\n color: ",";\n cursor: not-allowed;\n }\n "])),s.gray.dark2,s.gray.base,s.gray.dark2,s.gray.base)),V),fn=(f(nn={},pn.XSmall,t(W||(W=m(["\n height: 22px;\n text-transform: uppercase;\n font-size: 12px;\n line-height: 1em;\n font-weight: bold;\n letter-spacing: 0.4px;\n "])))),f(nn,pn.Small,t(Z||(Z=m(["\n height: 28px;\n "])))),f(nn,pn.Default,t($||($=m(["\n height: 36px;\n "])))),f(nn,pn.Large,t(_||(_=m(["\n height: 48px;\n font-size: 18px;\n line-height: 24px;\n "])))),nn),hn=(f(on={},14,t(rn||(rn=m(["\n font-size: 14px;\n "])))),f(on,16,t(en||(en=m(["\n font-size: 16px;\n // Pixel pushing for optical alignment purposes\n transform: translateY(1px);\n "])))),on);var yn,mn,kn,wn,vn,On,Dn,Pn,jn,zn,Sn,Nn,Fn,Mn,Gn,Bn,Ln,En,In,Xn,Cn,An,Kn,Rn,Tn,Yn,qn,Hn,Jn,Qn,Un,Vn,Wn,Zn,$n="#0AD05B",_n="#09804C",nr="#F97216",rr=(f(ln={},cn,(f(an={},dn.Primary,$n),f(an,dn.PrimaryOutline,g(.76,_n)),f(an,dn.Default,s.gray.light2),f(an,dn.Danger,nr),f(an,dn.DangerOutline,g(.76,s.red.base)),an)),f(ln,gn,(f(tn={},dn.Primary,$n),f(tn,dn.PrimaryOutline,g(.76,s.green.base)),f(tn,dn.Default,s.gray.base),f(tn,dn.Danger,nr),f(tn,dn.DangerOutline,g(.76,nr)),tn)),ln),er=(f(Fn={},cn,(f(On={},dn.Primary,t(yn||(yn=m(["\n color: ",";\n "])),s.green.light3)),f(On,dn.PrimaryOutline,t(mn||(mn=m(["\n color: ",";\n "])),s.green.dark1)),f(On,dn.Default,t(kn||(kn=m(["\n color: ",";\n "])),s.gray.dark1)),f(On,dn.Danger,t(wn||(wn=m(["\n color: ",";\n "])),s.red.light3)),f(On,dn.DangerOutline,t(vn||(vn=m(["\n color: ",";\n "])),s.red.base)),On)),f(Fn,gn,(f(Nn={},dn.Primary,t(Dn||(Dn=m(["\n color: ",";\n "])),s.green.light2)),f(Nn,dn.PrimaryOutline,t(Pn||(Pn=m(["\n color: #13aa52;\n "])))),f(Nn,dn.Default,t(jn||(jn=m(["\n color: ",";\n "])),s.gray.light1)),f(Nn,dn.Danger,t(zn||(zn=m(["\n color: ",";\n "])),s.red.light3)),f(Nn,dn.DangerOutline,t(Sn||(Sn=m(["\n color: #f97216;\n "])))),Nn)),Fn),or=(f(Yn={},cn,(f(In={},dn.Primary,t(Mn||(Mn=m(["\n color: ",";\n "])),s.white)),f(In,dn.PrimaryOutline,t(Gn||(Gn=m(["\n color: ",";\n "])),s.green.dark1)),f(In,dn.Default,t(Bn||(Bn=m(["\n color: ",";\n "])),s.gray.dark2)),f(In,dn.Danger,t(Ln||(Ln=m(["\n color: ",";\n "])),s.white)),f(In,dn.DangerOutline,t(En||(En=m(["\n color: #cf4a22;\n "])))),In)),f(Yn,gn,(f(Tn={},dn.Primary,t(Xn||(Xn=m(["\n color: ",";\n "])),s.white)),f(Tn,dn.PrimaryOutline,t(Cn||(Cn=m(["\n color: #0ad05b;\n "])))),f(Tn,dn.Default,t(An||(An=m(["\n color: ",";\n "])),s.white)),f(Tn,dn.Danger,t(Kn||(Kn=m(["\n color: ",";\n "])),s.white)),f(Tn,dn.DangerOutline,t(Rn||(Rn=m(["\n color: #f97216;\n "])))),Tn)),Yn),ar=(f(Un={},pn.XSmall,t(qn||(qn=m(["\n height: 14px;\n width: 14px;\n "])))),f(Un,pn.Small,t(Hn||(Hn=m(["\n height: 16px;\n width: 16px;\n "])))),f(Un,pn.Default,t(Jn||(Jn=m(["\n height: 16px;\n width: 16px;\n "])))),f(Un,pn.Large,t(Qn||(Qn=m(["\n height: 20px;\n width: 20px;\n "])))),Un),tr=(f(Zn={},cn,t(Vn||(Vn=m(["\n color: ",";\n "])),s.gray.light1)),f(Zn,gn,t(Wn||(Wn=m(["\n color: ",";\n "])),s.gray.dark1)),Zn);function ir(r){var e=r.glyph,o=r.variant,a=r.size,t=r.darkMode,l=r.disabled,d=r.isIconOnlyButton,p=r.className,c=!d&&{"aria-hidden":!0,role:"presentation"},g=t?gn:cn,s=d?or[g][o]:er[g][o];return n.cloneElement(e,b({className:i(s,f({},tr[g],l),ar[a],p)},c))}ir.displayName="ButtonIcon";var lr,dr,pr,cr,gr,sr,xr,ur,br,fr,hr,yr,mr,kr=["variant","size","darkMode","baseFontSize","disabled","leftGlyph","rightGlyph","children","className"],wr=t(lr||(lr=m(["\n overflow: hidden;\n border-radius: 3px;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n"]))),vr=t(dr||(dr=m(["\n display: flex;\n align-items: center;\n height: 100%;\n width: 100%;\n pointer-events: none;\n position: relative;\n z-index: 0;\n font-family: ",";\n"])),l.default),Or=(f(xr={},pn.XSmall,t(pr||(pr=m(["\n padding-left: 6px;\n padding-right: 6px;\n "])))),f(xr,pn.Small,t(cr||(cr=m(["\n padding-left: 12px;\n padding-right: 12px;\n "])))),f(xr,pn.Default,t(gr||(gr=m(["\n padding-left: 12px;\n padding-right: 12px;\n "])))),f(xr,pn.Large,t(sr||(sr=m(["\n padding-left: ","px;\n padding-right: ","px;\n "])),d[3],d[3])),xr),Dr=n.forwardRef((function(o,l){var d,g,s=o.variant,u=void 0===s?dn.Default:s,k=o.size,w=void 0===k?pn.Default:k,v=o.darkMode,O=void 0!==v&&v,D=o.baseFontSize,P=void 0===D?14:D,j=o.disabled,z=void 0!==j&&j,S=o.leftGlyph,N=o.rightGlyph,F=o.children,M=o.className,G=y(o,kr),B=c().usingKeyboard,L=r(null);e((function(){var n,r=rr[O?gn:cn][u];return null!=L.current&&(n=p(L.current,{backgroundColor:r})),n}),[L,u,O]);var E,I=null!==(d=(S||N)&&!F)&&void 0!==d&&d,X=function(n){var r=n.variant,e=n.size,o=n.darkMode,a=n.baseFontSize,t=n.disabled,l=n.showFocus,d=o?gn:cn,p=xn[d][r],c=un[d][r],g=fn[e],s=hn[a];return i(sn,p,f({},c,l),f({},bn[d],t),s,g)}({variant:u,size:w,darkMode:O,baseFontSize:P,disabled:z,showFocus:B}),C="string"==typeof G.href;(G.as&&"button"===G.as||!C&&!G.as)&&(E="button");var A=b(b({type:E,className:i(X,M),ref:l,as:function(n,r){return n&&!r?"a":"button"}(C,z)},"string"!=typeof G.href&&{disabled:z}),{},{"aria-disabled":z},G),K={variant:u,size:w,darkMode:O,disabled:z,isIconOnlyButton:I},R=w===pn.Large?"8px":"6px",T=x(n.Fragment,null,x("div",{className:wr,ref:L}),x("div",{className:i(vr,(g={},f(g,t(ur||(ur=m(["\n justify-content: space-between;\n "]))),!!N),f(g,t(br||(br=m(["\n justify-content: center;\n "]))),!N),g),Or[w])},S&&x(ir,h({glyph:S,className:i(f({},t(fr||(fr=m(["margin-right: ",";}"])),R),!I),t(hr||(hr=m(["\n vertical-align: text-top;\n "]))))},K)),F,N&&x("span",{className:t(yr||(yr=m(["\n display: flex;\n align-items: center;\n justify-content: center;\n margin-left: auto;\n "])))},x(ir,h({glyph:N,className:I?"":t(mr||(mr=m(["margin-left: ",";}"])),R)},K)))));return x(a,A,T)}));Dr.displayName="Button",Dr.propTypes={variant:o.oneOf(Object.values(dn)),darkMode:o.bool,baseFontSize:o.oneOf([14,16]),size:o.oneOf(Object.values(pn)),disabled:o.bool,leftGlyph:o.element,rightGlyph:o.element,href:o.string};export default Dr;export{pn as Size,dn as Variant}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("react"),require("prop-types"),require("@leafygreen-ui/box"),require("@leafygreen-ui/emotion"),require("@leafygreen-ui/tokens"),require("@leafygreen-ui/ripple"),require("@leafygreen-ui/leafygreen-provider"),require("polished"),require("@leafygreen-ui/palette"),require("@emotion/react")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@leafygreen-ui/box","@leafygreen-ui/emotion","@leafygreen-ui/tokens","@leafygreen-ui/ripple","@leafygreen-ui/leafygreen-provider","polished","@leafygreen-ui/palette","@emotion/react"],r):r((n="undefined"!=typeof globalThis?globalThis:n||self)["@leafygreen-ui/button"]={},n.React,n.PropTypes,n["@leafygreen-ui/box"],n["@leafygreen-ui/emotion"],n["@leafygreen-ui/tokens"],n["@leafygreen-ui/ripple"],n["@leafygreen-ui/leafygreen-provider"],n.polished,n["@leafygreen-ui/palette"],n.react)}(this,(function(n,r,o,e,t,u,i,a,s,l,c){"use strict";function f(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var d=f(r),p=f(o),g=f(e);function x(n,r,o){return r in n?Object.defineProperty(n,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[r]=o,n}function b(){return(b=Object.assign||function(n){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&(n[e]=o[e])}return n}).apply(this,arguments)}function h(n,r){var o=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);r&&(e=e.filter((function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),o.push.apply(o,e)}return o}function v(n){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?h(Object(o),!0).forEach((function(r){x(n,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):h(Object(o)).forEach((function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(o,r))}))}return n}function y(n,r){if(null==n)return{};var o,e,t=function(n,r){if(null==n)return{};var o,e,t={},u=Object.keys(n);for(e=0;e<u.length;e++)o=u[e],r.indexOf(o)>=0||(t[o]=n[o]);return t}(n,r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(n);for(e=0;e<u.length;e++)o=u[e],r.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(n,o)&&(t[o]=n[o])}return t}function C(n,r){return r||(r=n.slice(0)),Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(r)}}))}var k,m,w,O,D,P,j,z,S,N,q,F,M={Primary:"primary",PrimaryOutline:"primaryOutline",Default:"default",Danger:"danger",DangerOutline:"dangerOutline"},G={XSmall:"xsmall",Small:"small",Default:"default",Large:"large"},B="light",E="dark";function L(){var n=C(["\n font-size: 16px;\n // Pixel pushing for optical alignment purposes\n transform: translateY(1px);\n "]);return L=function(){return n},n}function I(){var n=C(["\n font-size: 14px;\n "]);return I=function(){return n},n}function R(){var n=C(["\n height: 48px;\n font-size: 18px;\n line-height: 24px;\n "]);return R=function(){return n},n}function T(){var n=C(["\n height: 36px;\n "]);return T=function(){return n},n}function X(){var n=C(["\n height: 28px;\n "]);return X=function(){return n},n}function K(){var n=C(["\n height: 22px;\n text-transform: uppercase;\n font-size: 12px;\n line-height: 1em;\n font-weight: bold;\n letter-spacing: 0.4px;\n "]);return K=function(){return n},n}function _(){var n=C(["\n background: rgba(61, 79, 88, 0.3);\n border: 1px solid ",";\n color: ",";\n cursor: not-allowed;\n\n &:hover {\n background: rgba(61, 79, 88, 0.3);\n border: 1px solid ",";\n color: ",";\n cursor: not-allowed;\n }\n "]);return _=function(){return n},n}function A(){var n=C(["\n background-color: ",";\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 1px ",";\n cursor: not-allowed;\n color: ",";\n\n &:hover {\n background-color: ",";\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 1px ",";\n cursor: not-allowed;\n color: ",";\n }\n "]);return A=function(){return n},n}function U(){var n=C(["\n &:focus {\n background: rgba(249, 114, 22, 0.08);\n border: 1px solid #f97216;\n box-shadow: 0px 0px 0px 3px #019ee2;\n }\n "]);return U=function(){return n},n}function V(){var n=C(["\n &:focus {\n background: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "]);return V=function(){return n},n}function Y(){var n=C(["\n &:focus {\n background-color: ",";\n box-shadow: 0px 0px 0px 3px #2f9fc5;\n }\n "]);return Y=function(){return n},n}function H(){var n=C(["\n &:focus {\n background: rgba(10, 208, 91, 0.08);\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px #139fd7;\n }\n "]);return H=function(){return n},n}function J(){var n=C(["\n &:focus {\n background: ",";\n box-shadow: 0px 4px 4px rgba(0, 124, 173, 0.4),\n 0px 0px 0px 3px ",";\n }\n "]);return J=function(){return n},n}function Q(){var n=C(["\n &:focus {\n background: rgba(207, 74, 34, 0.04);\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px #019ee2;\n }\n "]);return Q=function(){return n},n}function W(){var n=C(["\n &:focus {\n background-color: ",";\n box-shadow: 0px 4px 4px rgba(0, 124, 173, 0.4),\n 0px 0px 0px 3px ",";\n }\n "]);return W=function(){return n},n}function Z(){var n=C(["\n &:focus {\n background: ",";\n border: 1px solid ",";\n box-shadow: 0px 4px 4px rgba(0, 124, 173, 0.4),\n 0px 0px 0px 3px ",";\n }\n "]);return Z=function(){return n},n}function $(){var n=C(["\n &:focus {\n background-color: rgba(9, 128, 76, 0.04);\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "]);return $=function(){return n},n}function nn(){var n=C(["\n &:focus {\n background-color: ",";\n box-shadow: 0px 4px 4px rgba(0, 124, 173, 0.4),\n 0px 0px 0px 3px ",";\n }\n "]);return nn=function(){return n},n}function rn(){var n=C(["\n border: 1px solid #f97216;\n color: #f97216;\n\n &:focus {\n color: #f97216;\n }\n\n &:hover,\n &:active {\n color: #f97216;\n background: rgba(249, 114, 22, 0.08);\n box-shadow: 0px 0px 0px 3px ",";\n }\n "]);return rn=function(){return n},n}function on(){var n=C(["\n background-color: ",";\n border: 1px solid #f97216;\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border: 1px solid #f97216;\n box-shadow: 0px 0px 0px 3px ",";\n }\n "]);return on=function(){return n},n}function en(){var n=C(["\n background-color: ",";\n border: 1px solid ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "]);return en=function(){return n},n}function tn(){var n=C(["\n border: 1px solid ",";\n color: #0ad05b;\n\n &:focus {\n color: #0ad05b;\n }\n\n &:hover,\n &:active {\n color: #0ad05b;\n background-color: rgba(10, 208, 91, 0.08);\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "]);return tn=function(){return n},n}function un(){var n=C(["\n background-color: ",";\n border: 1px solid ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "]);return un=function(){return n},n}function an(){var n=C(["\n border: 1px solid ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background: rgba(207, 74, 34, 0.04);\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 4px ",";\n }\n "]);return an=function(){return n},n}function sn(){var n=C(["\n background-color: ",";\n box-shadow: 0px 1px 2px rgba(207, 74, 34, 0.4);\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n box-shadow: 0px 4px 4px rgba(207, 74, 34, 0.25),\n 0px 0px 0px 3px ",";\n }\n "]);return sn=function(){return n},n}function ln(){var n=C(["\n background-color: ",";\n border: 1px solid ",";\n box-shadow: 0px 1px 2px rgba(6, 22, 33, 0.3);\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border: 1px solid ",";\n box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.3),\n 0px 0px 0px 3px ",";\n }\n "]);return ln=function(){return n},n}function cn(){var n=C(["\n border: 1px solid ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: rgba(9, 128, 76, 0.04); // green dark 1\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "]);return cn=function(){return n},n}function fn(){var n=C(["\n background-color: ",";\n box-shadow: 0px 2px 3px rgba(19, 170, 82, 0.4);\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n box-shadow: 0px 2px 3px rgba(19, 170, 82, 0.4), 0px 0px 0px 3px #c3e7ca;\n }\n "]);return fn=function(){return n},n}function dn(){var n=C(["\n // unset browser default\n appearance: none;\n padding: 0;\n margin: 0;\n background-color: transparent;\n border: 0px solid transparent;\n display: inline-flex;\n align-items: stretch;\n border-radius: 4px;\n transition: all 150ms ease-in-out;\n position: relative;\n text-decoration: none;\n cursor: pointer;\n z-index: 0;\n\n &:focus {\n outline: none;\n }\n\n &:disabled {\n pointer-events: none;\n }\n\n &:active,\n &:focus,\n &:hover {\n text-decoration: none;\n }\n"]);return dn=function(){return n},n}var pn=t.css(dn()),gn=(x(w={},B,(x(k={},M.Primary,t.css(fn(),l.uiColors.green.dark1,l.uiColors.white,l.uiColors.white,l.uiColors.white,l.uiColors.green.dark2)),x(k,M.PrimaryOutline,t.css(cn(),l.uiColors.green.dark1,l.uiColors.green.dark2,l.uiColors.green.dark2,l.uiColors.green.dark2,l.uiColors.green.dark1,l.uiColors.green.light2)),x(k,M.Default,t.css(ln(),l.uiColors.gray.light3,l.uiColors.gray.base,l.uiColors.gray.dark2,l.uiColors.gray.dark2,l.uiColors.gray.dark2,l.uiColors.white,l.uiColors.gray.dark1,l.uiColors.gray.light2)),x(k,M.Danger,t.css(sn(),l.uiColors.red.base,l.uiColors.white,l.uiColors.white,l.uiColors.white,l.uiColors.red.dark1,l.uiColors.red.light2)),x(k,M.DangerOutline,t.css(an(),l.uiColors.red.base,l.uiColors.red.dark2,l.uiColors.red.dark2,l.uiColors.red.dark2,l.uiColors.red.base,l.uiColors.red.light2)),k)),x(w,E,(x(m={},M.Primary,t.css(un(),l.uiColors.green.dark2,l.uiColors.green.base,l.uiColors.white,l.uiColors.white,l.uiColors.white,l.uiColors.green.dark1,l.uiColors.green.dark2)),x(m,M.PrimaryOutline,t.css(tn(),l.uiColors.green.base,l.uiColors.green.base,l.uiColors.green.dark2)),x(m,M.Default,t.css(en(),l.uiColors.gray.dark2,l.uiColors.gray.base,l.uiColors.white,l.uiColors.white,l.uiColors.white,l.uiColors.gray.dark1,l.uiColors.gray.base,l.uiColors.gray.dark2)),x(m,M.Danger,t.css(on(),l.uiColors.red.dark1,l.uiColors.white,l.uiColors.white,l.uiColors.white,l.uiColors.red.base,l.uiColors.red.dark2)),x(m,M.DangerOutline,t.css(rn(),l.uiColors.red.dark2)),m)),w),xn=(x(P={},B,(x(O={},M.Primary,t.css(nn(),l.uiColors.green.dark2,l.uiColors.focus)),x(O,M.PrimaryOutline,t.css($(),l.uiColors.green.dark1,l.uiColors.focus)),x(O,M.Default,t.css(Z(),l.uiColors.white,l.uiColors.gray.dark1,l.uiColors.focus)),x(O,M.Danger,t.css(W(),l.uiColors.red.dark1,l.uiColors.focus)),x(O,M.DangerOutline,t.css(Q(),l.uiColors.red.dark2)),O)),x(P,E,(x(D={},M.Primary,t.css(J(),l.uiColors.green.dark1,l.uiColors.focus)),x(D,M.PrimaryOutline,t.css(H(),l.uiColors.green.dark1)),x(D,M.Default,t.css(Y(),l.uiColors.gray.dark1)),x(D,M.Danger,t.css(V(),l.uiColors.red.base,l.uiColors.focus)),x(D,M.DangerOutline,t.css(U())),D)),P),bn=(x(j={},B,t.css(A(),l.uiColors.gray.light2,l.uiColors.gray.light2,l.uiColors.gray.light1,l.uiColors.gray.dark1,l.uiColors.gray.light2,l.uiColors.gray.light2,l.uiColors.gray.light1,l.uiColors.gray.dark1)),x(j,E,t.css(_(),l.uiColors.gray.dark2,l.uiColors.gray.base,l.uiColors.gray.dark2,l.uiColors.gray.base)),j),hn=(x(z={},G.XSmall,t.css(K())),x(z,G.Small,t.css(X())),x(z,G.Default,t.css(T())),x(z,G.Large,t.css(R())),z),vn=(x(S={},14,t.css(I())),x(S,16,t.css(L())),S);var yn,Cn,kn,mn,wn,On,Dn,Pn,jn=.76,zn="#0AD05B",Sn="#09804C",Nn="#F97216",qn=(x(F={},B,(x(N={},M.Primary,zn),x(N,M.PrimaryOutline,s.transparentize(jn,Sn)),x(N,M.Default,l.uiColors.gray.light2),x(N,M.Danger,Nn),x(N,M.DangerOutline,s.transparentize(jn,l.uiColors.red.base)),N)),x(F,E,(x(q={},M.Primary,zn),x(q,M.PrimaryOutline,s.transparentize(jn,l.uiColors.green.base)),x(q,M.Default,l.uiColors.gray.base),x(q,M.Danger,Nn),x(q,M.DangerOutline,s.transparentize(jn,Nn)),q)),F);function Fn(){var n=C(["\n color: ",";\n "]);return Fn=function(){return n},n}function Mn(){var n=C(["\n color: ",";\n "]);return Mn=function(){return n},n}function Gn(){var n=C(["\n height: 20px;\n width: 20px;\n "]);return Gn=function(){return n},n}function Bn(){var n=C(["\n height: 16px;\n width: 16px;\n "]);return Bn=function(){return n},n}function En(){var n=C(["\n height: 16px;\n width: 16px;\n "]);return En=function(){return n},n}function Ln(){var n=C(["\n height: 14px;\n width: 14px;\n "]);return Ln=function(){return n},n}function In(){var n=C(["\n color: #f97216;\n "]);return In=function(){return n},n}function Rn(){var n=C(["\n color: ",";\n "]);return Rn=function(){return n},n}function Tn(){var n=C(["\n color: ",";\n "]);return Tn=function(){return n},n}function Xn(){var n=C(["\n color: #0ad05b;\n "]);return Xn=function(){return n},n}function Kn(){var n=C(["\n color: ",";\n "]);return Kn=function(){return n},n}function _n(){var n=C(["\n color: #cf4a22;\n "]);return _n=function(){return n},n}function An(){var n=C(["\n color: ",";\n "]);return An=function(){return n},n}function Un(){var n=C(["\n color: ",";\n "]);return Un=function(){return n},n}function Vn(){var n=C(["\n color: ",";\n "]);return Vn=function(){return n},n}function Yn(){var n=C(["\n color: ",";\n "]);return Yn=function(){return n},n}function Hn(){var n=C(["\n color: #f97216;\n "]);return Hn=function(){return n},n}function Jn(){var n=C(["\n color: ",";\n "]);return Jn=function(){return n},n}function Qn(){var n=C(["\n color: ",";\n "]);return Qn=function(){return n},n}function Wn(){var n=C(["\n color: #13aa52;\n "]);return Wn=function(){return n},n}function Zn(){var n=C(["\n color: ",";\n "]);return Zn=function(){return n},n}function $n(){var n=C(["\n color: ",";\n "]);return $n=function(){return n},n}function nr(){var n=C(["\n color: ",";\n "]);return nr=function(){return n},n}function rr(){var n=C(["\n color: ",";\n "]);return rr=function(){return n},n}function or(){var n=C(["\n color: ",";\n "]);return or=function(){return n},n}function er(){var n=C(["\n color: ",";\n "]);return er=function(){return n},n}var tr,ur=(x(kn={},B,(x(yn={},M.Primary,t.css(er(),l.uiColors.green.light3)),x(yn,M.PrimaryOutline,t.css(or(),l.uiColors.green.dark1)),x(yn,M.Default,t.css(rr(),l.uiColors.gray.dark1)),x(yn,M.Danger,t.css(nr(),l.uiColors.red.light3)),x(yn,M.DangerOutline,t.css($n(),l.uiColors.red.base)),yn)),x(kn,E,(x(Cn={},M.Primary,t.css(Zn(),l.uiColors.green.light2)),x(Cn,M.PrimaryOutline,t.css(Wn())),x(Cn,M.Default,t.css(Qn(),l.uiColors.gray.light1)),x(Cn,M.Danger,t.css(Jn(),l.uiColors.red.light3)),x(Cn,M.DangerOutline,t.css(Hn())),Cn)),kn),ir=(x(On={},B,(x(mn={},M.Primary,t.css(Yn(),l.uiColors.white)),x(mn,M.PrimaryOutline,t.css(Vn(),l.uiColors.green.dark1)),x(mn,M.Default,t.css(Un(),l.uiColors.gray.dark2)),x(mn,M.Danger,t.css(An(),l.uiColors.white)),x(mn,M.DangerOutline,t.css(_n())),mn)),x(On,E,(x(wn={},M.Primary,t.css(Kn(),l.uiColors.white)),x(wn,M.PrimaryOutline,t.css(Xn())),x(wn,M.Default,t.css(Tn(),l.uiColors.white)),x(wn,M.Danger,t.css(Rn(),l.uiColors.white)),x(wn,M.DangerOutline,t.css(In())),wn)),On),ar=(x(Dn={},G.XSmall,t.css(Ln())),x(Dn,G.Small,t.css(En())),x(Dn,G.Default,t.css(Bn())),x(Dn,G.Large,t.css(Gn())),Dn),sr=(x(Pn={},B,t.css(Mn(),l.uiColors.gray.light1)),x(Pn,E,t.css(Fn(),l.uiColors.gray.dark1)),Pn);function lr(n){var r=n.glyph,o=n.variant,e=n.size,u=n.darkMode,i=n.disabled,a=n.isIconOnlyButton,s=n.className,l=!a&&{"aria-hidden":!0,role:"presentation"},c=u?E:B,f=a?ir[c][o]:ur[c][o];return d.default.cloneElement(r,v({className:t.cx(f,x({},sr[c],i),ar[e],s)},l))}function cr(){var n=C(["margin-left: ",";}"]);return cr=function(){return n},n}function fr(){var n=C(["\n display: flex;\n align-items: center;\n justify-content: center;\n margin-left: auto;\n "]);return fr=function(){return n},n}function dr(){var n=C(["\n vertical-align: text-top;\n "]);return dr=function(){return n},n}function pr(){var n=C(["margin-right: ",";}"]);return pr=function(){return n},n}function gr(){var n=C(["\n justify-content: center;\n "]);return gr=function(){return n},n}function xr(){var n=C(["\n justify-content: space-between;\n "]);return xr=function(){return n},n}function br(){var n=C(["\n padding-left: ","px;\n padding-right: ","px;\n "]);return br=function(){return n},n}function hr(){var n=C(["\n padding-left: 12px;\n padding-right: 12px;\n "]);return hr=function(){return n},n}function vr(){var n=C(["\n padding-left: 12px;\n padding-right: 12px;\n "]);return vr=function(){return n},n}function yr(){var n=C(["\n padding-left: 6px;\n padding-right: 6px;\n "]);return yr=function(){return n},n}function Cr(){var n=C(["\n display: flex;\n align-items: center;\n height: 100%;\n width: 100%;\n pointer-events: none;\n position: relative;\n z-index: 0;\n font-family: ",";\n"]);return Cr=function(){return n},n}function kr(){var n=C(["\n overflow: hidden;\n border-radius: 3px;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n"]);return kr=function(){return n},n}lr.displayName="ButtonIcon";var mr=t.css(kr()),wr=t.css(Cr(),u.fontFamilies.default),Or=(x(tr={},G.XSmall,t.css(yr())),x(tr,G.Small,t.css(vr())),x(tr,G.Default,t.css(hr())),x(tr,G.Large,t.css(br(),u.spacing[3],u.spacing[3])),tr),Dr=d.default.forwardRef((function(n,o){var e,u,s=n.variant,l=void 0===s?M.Default:s,f=n.size,p=void 0===f?G.Default:f,h=n.darkMode,C=void 0!==h&&h,k=n.baseFontSize,m=void 0===k?14:k,w=n.disabled,O=void 0!==w&&w,D=n.leftGlyph,P=n.rightGlyph,j=n.children,z=n.className,S=y(n,["variant","size","darkMode","baseFontSize","disabled","leftGlyph","rightGlyph","children","className"]),N=a.useUsingKeyboardContext().usingKeyboard,q=r.useRef(null);r.useEffect((function(){var n,r=qn[C?E:B][l];return null!=q.current&&(n=i.registerRipple(q.current,{backgroundColor:r})),n}),[q,l,C]);var F,L=null!==(e=(D||P)&&!j)&&void 0!==e&&e,I=function(n){var r=n.variant,o=n.size,e=n.darkMode,u=n.baseFontSize,i=n.disabled,a=n.showFocus,s=e?E:B,l=gn[s][r],c=xn[s][r],f=hn[o],d=vn[u];return t.cx(pn,l,x({},c,a),x({},bn[s],i),d,f)}({variant:l,size:p,darkMode:C,baseFontSize:m,disabled:O,showFocus:N}),R="string"==typeof S.href;(S.as&&"button"===S.as||!R&&!S.as)&&(F="button");var T=v({type:F,className:t.cx(I,z),ref:o,as:function(n,r){return n&&!r?"a":"button"}(R,O)},"string"!=typeof S.href&&{disabled:O},{"aria-disabled":O},S),X={variant:l,size:p,darkMode:C,disabled:O,isIconOnlyButton:L},K=p===G.Large?"8px":"6px",_=c.jsx(d.default.Fragment,null,c.jsx("div",{className:mr,ref:q}),c.jsx("div",{className:t.cx(wr,(u={},x(u,t.css(xr()),!!P),x(u,t.css(gr()),!P),u),Or[p])},D&&c.jsx(lr,b({glyph:D,className:t.cx(x({},t.css(pr(),K),!L),t.css(dr()))},X)),j,P&&c.jsx("span",{className:t.css(fr())},c.jsx(lr,b({glyph:P,className:L?"":t.css(cr(),K)},X)))));return c.jsx(g.default,T,_)}));Dr.displayName="Button",Dr.propTypes={variant:p.default.oneOf(Object.values(M)),darkMode:p.default.bool,baseFontSize:p.default.oneOf([14,16]),size:p.default.oneOf(Object.values(G)),disabled:p.default.bool,leftGlyph:p.default.element,rightGlyph:p.default.element,href:p.default.string},n.Size=G,n.Variant=M,n.default=Dr,Object.defineProperty(n,"__esModule",{value:!0})})); | ||
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("prop-types"),require("@leafygreen-ui/box"),require("@leafygreen-ui/emotion"),require("@leafygreen-ui/tokens"),require("@leafygreen-ui/ripple"),require("@leafygreen-ui/leafygreen-provider"),require("polished"),require("@leafygreen-ui/palette"),require("@emotion/react")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@leafygreen-ui/box","@leafygreen-ui/emotion","@leafygreen-ui/tokens","@leafygreen-ui/ripple","@leafygreen-ui/leafygreen-provider","polished","@leafygreen-ui/palette","@emotion/react"],n):n((r="undefined"!=typeof globalThis?globalThis:r||self)["@leafygreen-ui/button"]={},r.React,r.PropTypes,r["@leafygreen-ui/box"],r["@leafygreen-ui/emotion"],r["@leafygreen-ui/tokens"],r["@leafygreen-ui/ripple"],r["@leafygreen-ui/leafygreen-provider"],r.polished,r["@leafygreen-ui/palette"],r.react)}(this,(function(r,n,o,e,a,s,i,l,t,u,c){"use strict";function d(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}var p=d(n),g=d(o),x=d(e);function f(r,n){var o=Object.keys(r);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(r);n&&(e=e.filter((function(n){return Object.getOwnPropertyDescriptor(r,n).enumerable}))),o.push.apply(o,e)}return o}function b(r){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?f(Object(o),!0).forEach((function(n){h(r,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):f(Object(o)).forEach((function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(o,n))}))}return r}function h(r,n,o){return n in r?Object.defineProperty(r,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[n]=o,r}function y(){return(y=Object.assign||function(r){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&(r[e]=o[e])}return r}).apply(this,arguments)}function C(r,n){if(null==r)return{};var o,e,a=function(r,n){if(null==r)return{};var o,e,a={},s=Object.keys(r);for(e=0;e<s.length;e++)o=s[e],n.indexOf(o)>=0||(a[o]=r[o]);return a}(r,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(r);for(e=0;e<s.length;e++)o=s[e],n.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(r,o)&&(a[o]=r[o])}return a}function k(r,n){return n||(n=r.slice(0)),Object.freeze(Object.defineProperties(r,{raw:{value:Object.freeze(n)}}))}var m,w,v,O,D,P,j,z,S,N,q,F,M,G,B,E,L,I,R,T,X,K,_,A,U,V,Y,H,J,Q,W,Z,$,rr,nr,or,er,ar,sr,ir,lr,tr={Primary:"primary",PrimaryOutline:"primaryOutline",Default:"default",Danger:"danger",DangerOutline:"dangerOutline"},ur={XSmall:"xsmall",Small:"small",Default:"default",Large:"large"},cr="light",dr="dark",pr=a.css(m||(m=k(["\n // unset browser default\n appearance: none;\n padding: 0;\n margin: 0;\n background-color: transparent;\n border: 0px solid transparent;\n display: inline-flex;\n align-items: stretch;\n border-radius: 4px;\n transition: all 150ms ease-in-out;\n position: relative;\n text-decoration: none;\n cursor: pointer;\n z-index: 0;\n\n &:focus {\n outline: none;\n }\n\n &:disabled {\n pointer-events: none;\n }\n\n &:active,\n &:focus,\n &:hover {\n text-decoration: none;\n }\n"]))),gr=(h(G={},cr,(h(j={},tr.Primary,a.css(w||(w=k(["\n background-color: ",";\n box-shadow: 0px 2px 3px rgba(19, 170, 82, 0.4);\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n box-shadow: 0px 2px 3px rgba(19, 170, 82, 0.4), 0px 0px 0px 3px #c3e7ca;\n }\n "])),u.uiColors.green.dark1,u.uiColors.white,u.uiColors.white,u.uiColors.white,u.uiColors.green.dark2)),h(j,tr.PrimaryOutline,a.css(v||(v=k(["\n border: 1px solid ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: rgba(9, 128, 76, 0.04); // green dark 1\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),u.uiColors.green.dark1,u.uiColors.green.dark2,u.uiColors.green.dark2,u.uiColors.green.dark2,u.uiColors.green.dark1,u.uiColors.green.light2)),h(j,tr.Default,a.css(O||(O=k(["\n background-color: ",";\n border: 1px solid ",";\n box-shadow: 0px 1px 2px rgba(6, 22, 33, 0.3);\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border: 1px solid ",";\n box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.3),\n 0px 0px 0px 3px ",";\n }\n "])),u.uiColors.gray.light3,u.uiColors.gray.base,u.uiColors.gray.dark2,u.uiColors.gray.dark2,u.uiColors.gray.dark2,u.uiColors.white,u.uiColors.gray.dark1,u.uiColors.gray.light2)),h(j,tr.Danger,a.css(D||(D=k(["\n background-color: ",";\n box-shadow: 0px 1px 2px rgba(207, 74, 34, 0.4);\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n box-shadow: 0px 4px 4px rgba(207, 74, 34, 0.25),\n 0px 0px 0px 3px ",";\n }\n "])),u.uiColors.red.base,u.uiColors.white,u.uiColors.white,u.uiColors.white,u.uiColors.red.dark1,u.uiColors.red.light2)),h(j,tr.DangerOutline,a.css(P||(P=k(["\n border: 1px solid ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background: rgba(207, 74, 34, 0.04);\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 4px ",";\n }\n "])),u.uiColors.red.base,u.uiColors.red.dark2,u.uiColors.red.dark2,u.uiColors.red.dark2,u.uiColors.red.base,u.uiColors.red.light2)),j)),h(G,dr,(h(M={},tr.Primary,a.css(z||(z=k(["\n background-color: ",";\n border: 1px solid ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),u.uiColors.green.dark2,u.uiColors.green.base,u.uiColors.white,u.uiColors.white,u.uiColors.white,u.uiColors.green.dark1,u.uiColors.green.dark2)),h(M,tr.PrimaryOutline,a.css(S||(S=k(["\n border: 1px solid ",";\n color: #0ad05b;\n\n &:focus {\n color: #0ad05b;\n }\n\n &:hover,\n &:active {\n color: #0ad05b;\n background-color: rgba(10, 208, 91, 0.08);\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),u.uiColors.green.base,u.uiColors.green.base,u.uiColors.green.dark2)),h(M,tr.Default,a.css(N||(N=k(["\n background-color: ",";\n border: 1px solid ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),u.uiColors.gray.dark2,u.uiColors.gray.base,u.uiColors.white,u.uiColors.white,u.uiColors.white,u.uiColors.gray.dark1,u.uiColors.gray.base,u.uiColors.gray.dark2)),h(M,tr.Danger,a.css(q||(q=k(["\n background-color: ",";\n border: 1px solid #f97216;\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border: 1px solid #f97216;\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),u.uiColors.red.dark1,u.uiColors.white,u.uiColors.white,u.uiColors.white,u.uiColors.red.base,u.uiColors.red.dark2)),h(M,tr.DangerOutline,a.css(F||(F=k(["\n border: 1px solid #f97216;\n color: #f97216;\n\n &:focus {\n color: #f97216;\n }\n\n &:hover,\n &:active {\n color: #f97216;\n background: rgba(249, 114, 22, 0.08);\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),u.uiColors.red.dark2)),M)),G),xr=(h(Y={},cr,(h(T={},tr.Primary,a.css(B||(B=k(["\n &:focus {\n background-color: ",";\n box-shadow: 0px 4px 4px rgba(0, 124, 173, 0.4),\n 0px 0px 0px 3px ",";\n }\n "])),u.uiColors.green.dark2,u.uiColors.focus)),h(T,tr.PrimaryOutline,a.css(E||(E=k(["\n &:focus {\n background-color: rgba(9, 128, 76, 0.04);\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),u.uiColors.green.dark1,u.uiColors.focus)),h(T,tr.Default,a.css(L||(L=k(["\n &:focus {\n background: ",";\n border: 1px solid ",";\n box-shadow: 0px 4px 4px rgba(0, 124, 173, 0.4),\n 0px 0px 0px 3px ",";\n }\n "])),u.uiColors.white,u.uiColors.gray.dark1,u.uiColors.focus)),h(T,tr.Danger,a.css(I||(I=k(["\n &:focus {\n background-color: ",";\n box-shadow: 0px 4px 4px rgba(0, 124, 173, 0.4),\n 0px 0px 0px 3px ",";\n }\n "])),u.uiColors.red.dark1,u.uiColors.focus)),h(T,tr.DangerOutline,a.css(R||(R=k(["\n &:focus {\n background: rgba(207, 74, 34, 0.04);\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px #019ee2;\n }\n "])),u.uiColors.red.dark2)),T)),h(Y,dr,(h(V={},tr.Primary,a.css(X||(X=k(["\n &:focus {\n background: ",";\n box-shadow: 0px 4px 4px rgba(0, 124, 173, 0.4),\n 0px 0px 0px 3px ",";\n }\n "])),u.uiColors.green.dark1,u.uiColors.focus)),h(V,tr.PrimaryOutline,a.css(K||(K=k(["\n &:focus {\n background: rgba(10, 208, 91, 0.08);\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 3px #139fd7;\n }\n "])),u.uiColors.green.dark1)),h(V,tr.Default,a.css(_||(_=k(["\n &:focus {\n background-color: ",";\n box-shadow: 0px 0px 0px 3px #2f9fc5;\n }\n "])),u.uiColors.gray.dark1)),h(V,tr.Danger,a.css(A||(A=k(["\n &:focus {\n background: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),u.uiColors.red.base,u.uiColors.focus)),h(V,tr.DangerOutline,a.css(U||(U=k(["\n &:focus {\n background: rgba(249, 114, 22, 0.08);\n border: 1px solid #f97216;\n box-shadow: 0px 0px 0px 3px #019ee2;\n }\n "])))),V)),Y),fr=(h(Q={},cr,a.css(H||(H=k(["\n background-color: ",";\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 1px ",";\n cursor: not-allowed;\n color: ",";\n\n &:hover {\n background-color: ",";\n border: 1px solid ",";\n box-shadow: 0px 0px 0px 1px ",";\n cursor: not-allowed;\n color: ",";\n }\n "])),u.uiColors.gray.light2,u.uiColors.gray.light2,u.uiColors.gray.light1,u.uiColors.gray.dark1,u.uiColors.gray.light2,u.uiColors.gray.light2,u.uiColors.gray.light1,u.uiColors.gray.dark1)),h(Q,dr,a.css(J||(J=k(["\n background: rgba(61, 79, 88, 0.3);\n border: 1px solid ",";\n color: ",";\n cursor: not-allowed;\n\n &:hover {\n background: rgba(61, 79, 88, 0.3);\n border: 1px solid ",";\n color: ",";\n cursor: not-allowed;\n }\n "])),u.uiColors.gray.dark2,u.uiColors.gray.base,u.uiColors.gray.dark2,u.uiColors.gray.base)),Q),br=(h(nr={},ur.XSmall,a.css(W||(W=k(["\n height: 22px;\n text-transform: uppercase;\n font-size: 12px;\n line-height: 1em;\n font-weight: bold;\n letter-spacing: 0.4px;\n "])))),h(nr,ur.Small,a.css(Z||(Z=k(["\n height: 28px;\n "])))),h(nr,ur.Default,a.css($||($=k(["\n height: 36px;\n "])))),h(nr,ur.Large,a.css(rr||(rr=k(["\n height: 48px;\n font-size: 18px;\n line-height: 24px;\n "])))),nr),hr=(h(ar={},14,a.css(or||(or=k(["\n font-size: 14px;\n "])))),h(ar,16,a.css(er||(er=k(["\n font-size: 16px;\n // Pixel pushing for optical alignment purposes\n transform: translateY(1px);\n "])))),ar);var yr,Cr,kr,mr,wr,vr,Or,Dr,Pr,jr,zr,Sr,Nr,qr,Fr,Mr,Gr,Br,Er,Lr,Ir,Rr,Tr,Xr,Kr,_r,Ar,Ur,Vr,Yr,Hr,Jr,Qr,Wr,Zr=.76,$r="#0AD05B",rn="#09804C",nn="#F97216",on=(h(lr={},cr,(h(sr={},tr.Primary,$r),h(sr,tr.PrimaryOutline,t.transparentize(Zr,rn)),h(sr,tr.Default,u.uiColors.gray.light2),h(sr,tr.Danger,nn),h(sr,tr.DangerOutline,t.transparentize(Zr,u.uiColors.red.base)),sr)),h(lr,dr,(h(ir={},tr.Primary,$r),h(ir,tr.PrimaryOutline,t.transparentize(Zr,u.uiColors.green.base)),h(ir,tr.Default,u.uiColors.gray.base),h(ir,tr.Danger,nn),h(ir,tr.DangerOutline,t.transparentize(Zr,nn)),ir)),lr),en=(h(Nr={},cr,(h(vr={},tr.Primary,a.css(yr||(yr=k(["\n color: ",";\n "])),u.uiColors.green.light3)),h(vr,tr.PrimaryOutline,a.css(Cr||(Cr=k(["\n color: ",";\n "])),u.uiColors.green.dark1)),h(vr,tr.Default,a.css(kr||(kr=k(["\n color: ",";\n "])),u.uiColors.gray.dark1)),h(vr,tr.Danger,a.css(mr||(mr=k(["\n color: ",";\n "])),u.uiColors.red.light3)),h(vr,tr.DangerOutline,a.css(wr||(wr=k(["\n color: ",";\n "])),u.uiColors.red.base)),vr)),h(Nr,dr,(h(Sr={},tr.Primary,a.css(Or||(Or=k(["\n color: ",";\n "])),u.uiColors.green.light2)),h(Sr,tr.PrimaryOutline,a.css(Dr||(Dr=k(["\n color: #13aa52;\n "])))),h(Sr,tr.Default,a.css(Pr||(Pr=k(["\n color: ",";\n "])),u.uiColors.gray.light1)),h(Sr,tr.Danger,a.css(jr||(jr=k(["\n color: ",";\n "])),u.uiColors.red.light3)),h(Sr,tr.DangerOutline,a.css(zr||(zr=k(["\n color: #f97216;\n "])))),Sr)),Nr),an=(h(_r={},cr,(h(Er={},tr.Primary,a.css(qr||(qr=k(["\n color: ",";\n "])),u.uiColors.white)),h(Er,tr.PrimaryOutline,a.css(Fr||(Fr=k(["\n color: ",";\n "])),u.uiColors.green.dark1)),h(Er,tr.Default,a.css(Mr||(Mr=k(["\n color: ",";\n "])),u.uiColors.gray.dark2)),h(Er,tr.Danger,a.css(Gr||(Gr=k(["\n color: ",";\n "])),u.uiColors.white)),h(Er,tr.DangerOutline,a.css(Br||(Br=k(["\n color: #cf4a22;\n "])))),Er)),h(_r,dr,(h(Kr={},tr.Primary,a.css(Lr||(Lr=k(["\n color: ",";\n "])),u.uiColors.white)),h(Kr,tr.PrimaryOutline,a.css(Ir||(Ir=k(["\n color: #0ad05b;\n "])))),h(Kr,tr.Default,a.css(Rr||(Rr=k(["\n color: ",";\n "])),u.uiColors.white)),h(Kr,tr.Danger,a.css(Tr||(Tr=k(["\n color: ",";\n "])),u.uiColors.white)),h(Kr,tr.DangerOutline,a.css(Xr||(Xr=k(["\n color: #f97216;\n "])))),Kr)),_r),sn=(h(Hr={},ur.XSmall,a.css(Ar||(Ar=k(["\n height: 14px;\n width: 14px;\n "])))),h(Hr,ur.Small,a.css(Ur||(Ur=k(["\n height: 16px;\n width: 16px;\n "])))),h(Hr,ur.Default,a.css(Vr||(Vr=k(["\n height: 16px;\n width: 16px;\n "])))),h(Hr,ur.Large,a.css(Yr||(Yr=k(["\n height: 20px;\n width: 20px;\n "])))),Hr),ln=(h(Wr={},cr,a.css(Jr||(Jr=k(["\n color: ",";\n "])),u.uiColors.gray.light1)),h(Wr,dr,a.css(Qr||(Qr=k(["\n color: ",";\n "])),u.uiColors.gray.dark1)),Wr);function tn(r){var n=r.glyph,o=r.variant,e=r.size,s=r.darkMode,i=r.disabled,l=r.isIconOnlyButton,t=r.className,u=!l&&{"aria-hidden":!0,role:"presentation"},c=s?dr:cr,d=l?an[c][o]:en[c][o];return p.default.cloneElement(n,b({className:a.cx(d,h({},ln[c],i),sn[e],t)},u))}tn.displayName="ButtonIcon";var un,cn,dn,pn,gn,xn,fn,bn,hn,yn,Cn,kn,mn,wn=["variant","size","darkMode","baseFontSize","disabled","leftGlyph","rightGlyph","children","className"],vn=a.css(un||(un=k(["\n overflow: hidden;\n border-radius: 3px;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n"]))),On=a.css(cn||(cn=k(["\n display: flex;\n align-items: center;\n height: 100%;\n width: 100%;\n pointer-events: none;\n position: relative;\n z-index: 0;\n font-family: ",";\n"])),s.fontFamilies.default),Dn=(h(fn={},ur.XSmall,a.css(dn||(dn=k(["\n padding-left: 6px;\n padding-right: 6px;\n "])))),h(fn,ur.Small,a.css(pn||(pn=k(["\n padding-left: 12px;\n padding-right: 12px;\n "])))),h(fn,ur.Default,a.css(gn||(gn=k(["\n padding-left: 12px;\n padding-right: 12px;\n "])))),h(fn,ur.Large,a.css(xn||(xn=k(["\n padding-left: ","px;\n padding-right: ","px;\n "])),s.spacing[3],s.spacing[3])),fn),Pn=p.default.forwardRef((function(r,o){var e,s,t=r.variant,u=void 0===t?tr.Default:t,d=r.size,g=void 0===d?ur.Default:d,f=r.darkMode,m=void 0!==f&&f,w=r.baseFontSize,v=void 0===w?14:w,O=r.disabled,D=void 0!==O&&O,P=r.leftGlyph,j=r.rightGlyph,z=r.children,S=r.className,N=C(r,wn),q=l.useUsingKeyboardContext().usingKeyboard,F=n.useRef(null);n.useEffect((function(){var r,n=on[m?dr:cr][u];return null!=F.current&&(r=i.registerRipple(F.current,{backgroundColor:n})),r}),[F,u,m]);var M,G=null!==(e=(P||j)&&!z)&&void 0!==e&&e,B=function(r){var n=r.variant,o=r.size,e=r.darkMode,s=r.baseFontSize,i=r.disabled,l=r.showFocus,t=e?dr:cr,u=gr[t][n],c=xr[t][n],d=br[o],p=hr[s];return a.cx(pr,u,h({},c,l),h({},fr[t],i),p,d)}({variant:u,size:g,darkMode:m,baseFontSize:v,disabled:D,showFocus:q}),E="string"==typeof N.href;(N.as&&"button"===N.as||!E&&!N.as)&&(M="button");var L=b(b({type:M,className:a.cx(B,S),ref:o,as:function(r,n){return r&&!n?"a":"button"}(E,D)},"string"!=typeof N.href&&{disabled:D}),{},{"aria-disabled":D},N),I={variant:u,size:g,darkMode:m,disabled:D,isIconOnlyButton:G},R=g===ur.Large?"8px":"6px",T=c.jsx(p.default.Fragment,null,c.jsx("div",{className:vn,ref:F}),c.jsx("div",{className:a.cx(On,(s={},h(s,a.css(bn||(bn=k(["\n justify-content: space-between;\n "]))),!!j),h(s,a.css(hn||(hn=k(["\n justify-content: center;\n "]))),!j),s),Dn[g])},P&&c.jsx(tn,y({glyph:P,className:a.cx(h({},a.css(yn||(yn=k(["margin-right: ",";}"])),R),!G),a.css(Cn||(Cn=k(["\n vertical-align: text-top;\n "]))))},I)),z,j&&c.jsx("span",{className:a.css(kn||(kn=k(["\n display: flex;\n align-items: center;\n justify-content: center;\n margin-left: auto;\n "])))},c.jsx(tn,y({glyph:j,className:G?"":a.css(mn||(mn=k(["margin-left: ",";}"])),R)},I)))));return c.jsx(x.default,L,T)}));Pn.displayName="Button",Pn.propTypes={variant:g.default.oneOf(Object.values(tr)),darkMode:g.default.bool,baseFontSize:g.default.oneOf([14,16]),size:g.default.oneOf(Object.values(ur)),disabled:g.default.bool,leftGlyph:g.default.element,rightGlyph:g.default.element,href:g.default.string},r.Size=ur,r.Variant=tr,r.default=Pn,Object.defineProperty(r,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@leafygreen-ui/button", | ||
"version": "12.0.4", | ||
"version": "12.0.5", | ||
"description": "leafyGreen UI Kit Button", | ||
@@ -31,3 +31,3 @@ "main": "./dist/index.js", | ||
"devDependencies": { | ||
"@leafygreen-ui/icon": "^11.3.0" | ||
"@leafygreen-ui/icon": "^11.4.0" | ||
}, | ||
@@ -34,0 +34,0 @@ "peerDependencies": { |
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
365537
1175