@leafygreen-ui/button
Advanced tools
Comparing version 20.0.7 to 20.0.8-next.0
# @leafygreen-ui/button | ||
## 20.0.8-next.0 | ||
### Patch Changes | ||
- b060d06ce: Updates story files for Storybook 7.x | ||
- Updated dependencies [b060d06ce] | ||
- Updated dependencies [b060d06ce] | ||
- @leafygreen-ui/box@3.1.4-next.0 | ||
- @leafygreen-ui/leafygreen-provider@3.1.3-next.0 | ||
- @leafygreen-ui/lib@10.3.4-next.0 | ||
## 20.0.7 | ||
@@ -4,0 +15,0 @@ |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
import { ButtonProps } from '../types'; | ||
@@ -3,0 +2,0 @@ declare type ButtonContentProps = Omit<ButtonProps, 'as'>; |
@@ -1,2 +0,2 @@ | ||
import n,{useRef as e,useEffect as r}from"react";import o from"prop-types";import a from"@leafygreen-ui/box";import{css as t,cx as l}from"@leafygreen-ui/emotion";import{useDarkMode as i}from"@leafygreen-ui/leafygreen-provider";import{transitionDuration as c,fontFamilies as d,fontWeights as g,typeScales as s,BaseFontSize as b}from"@leafygreen-ui/tokens";import{registerRipple as u}from"@leafygreen-ui/ripple";import{createUniqueClassName as h,Theme as p,getTheme as f}from"@leafygreen-ui/lib";import{palette as y}from"@leafygreen-ui/palette";import{transparentize as k,mix as x}from"polished";function m(n,e){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.push.apply(r,o)}return r}function v(n){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?m(Object(r),!0).forEach((function(e){w(n,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))}))}return n}function w(n,e,r){return e in n?Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[e]=r,n}function O(){return O=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])}return n},O.apply(this,arguments)}function D(n,e){if(null==n)return{};var r,o,a=function(n,e){if(null==n)return{};var r,o,a={},t=Object.keys(n);for(o=0;o<t.length;o++)r=t[o],e.indexOf(r)>=0||(a[r]=n[r]);return a}(n,e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);for(o=0;o<t.length;o++)r=t[o],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(n,r)&&(a[r]=n[r])}return a}function P(n,e){return e||(e=n.slice(0)),Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(e)}}))}var j,z,G,B,S,N,E,L,M,q,F,C,I,X,H,R,T,Y,A,J,K,Q,U,V,W,Z,$,_,nn,en,rn,on,an,tn,ln,cn,dn,gn,sn,bn,un,hn,pn,fn,yn,kn,xn,mn,vn,wn,On=h("button"),Dn={Default:"default",Primary:"primary",PrimaryOutline:"primaryOutline",Danger:"danger",DangerOutline:"dangerOutline",BaseGreen:"baseGreen"},Pn={XSmall:"xsmall",Small:"small",Default:"default",Large:"large"},jn={Body1:13,Body2:16},zn=(w(H={},p.Light,(w(E={},Dn.Default,t(j||(j=P(["\n color: ",";\n "])),y.gray.base)),w(E,Dn.Primary,t(z||(z=P(["\n color: ",";\n "])),y.green.light2)),w(E,Dn.PrimaryOutline,t(G||(G=P(["\n color: ",";\n "])),y.green.dark2)),w(E,Dn.Danger,t(B||(B=P(["\n color: ",";\n "])),y.red.light3)),w(E,Dn.DangerOutline,t(S||(S=P(["\n color: ",";\n "])),y.red.light1)),w(E,Dn.BaseGreen,t(N||(N=P(["\n color: ",";\n "])),y.green.dark2)),E)),w(H,p.Dark,(w(X={},Dn.Default,t(L||(L=P(["\n color: ",";\n "])),y.gray.light2)),w(X,Dn.Primary,t(M||(M=P(["\n color: ",";\n "])),y.green.light2)),w(X,Dn.PrimaryOutline,t(q||(q=P(["\n color: ",";\n "])),y.green.base)),w(X,Dn.Danger,t(F||(F=P(["\n color: ",";\n "])),y.red.light2)),w(X,Dn.DangerOutline,t(C||(C=P(["\n color: ",";\n "])),y.red.light1)),w(X,Dn.BaseGreen,t(I||(I=P(["\n color: ",";\n "])),y.green.dark2)),X)),H),Gn=(w(en={},p.Light,(w(Q={},Dn.Default,t(R||(R=P(["\n color: ",";\n "])),y.black)),w(Q,Dn.Primary,t(T||(T=P(["\n color: ",";\n "])),y.white)),w(Q,Dn.PrimaryOutline,t(Y||(Y=P(["\n color: ",";\n "])),y.green.dark2)),w(Q,Dn.Danger,t(A||(A=P(["\n color: ",";\n "])),y.white)),w(Q,Dn.DangerOutline,t(J||(J=P(["\n color: ",";\n "])),y.red.base)),w(Q,Dn.BaseGreen,t(K||(K=P(["\n color: ",";\n "])),y.green.dark3)),Q)),w(en,p.Dark,(w(nn={},Dn.Default,t(U||(U=P(["\n color: ",";\n "])),y.white)),w(nn,Dn.Primary,t(V||(V=P(["\n color: ",";\n "])),y.white)),w(nn,Dn.PrimaryOutline,t(W||(W=P(["\n color: ",";\n "])),y.green.base)),w(nn,Dn.Danger,t(Z||(Z=P(["\n color: ",";\n "])),y.white)),w(nn,Dn.DangerOutline,t($||($=P(["\n color: ",";\n "])),y.red.light1)),w(nn,Dn.BaseGreen,t(_||(_=P(["\n color: ",";\n "])),y.green.dark3)),nn)),en),Bn=t(rn||(rn=P(["\n ."," {\n &:hover,\n &:active {\n color: currentColor;\n }\n }\n"])),On),Sn=(w(cn={},Pn.XSmall,t(on||(on=P(["\n height: 14px;\n width: 14px;\n "])))),w(cn,Pn.Small,t(an||(an=P(["\n height: 16px;\n width: 16px;\n "])))),w(cn,Pn.Default,t(tn||(tn=P(["\n height: 16px;\n width: 16px;\n "])))),w(cn,Pn.Large,t(ln||(ln=P(["\n height: 20px;\n width: 20px;\n "])))),cn),Nn=(w(sn={},p.Light,t(dn||(dn=P(["\n color: ",";\n "])),y.gray.light1)),w(sn,p.Dark,t(gn||(gn=P(["\n color: ",";\n "])),y.gray.dark1)),sn),En=t(bn||(bn=P(["\n color: ",";\n"])),y.gray.dark2);function Ln(e){var r,o=e.glyph,a=e.variant,t=e.size,i=e.darkMode,c=e.disabled,d=e.isIconOnlyButton,g=e.className,s=!d&&{"aria-hidden":!0,role:"presentation"},b=f(i),u=d?Gn:zn;return n.cloneElement(o,v({className:l(u[b][a],Sn[t],(r={},w(r,Bn,d),w(r,Nn[b],c),w(r,En,c&&d&&i),r),g)},s))}Ln.displayName="ButtonIcon";var Mn,qn,Fn,Cn,In,Xn,Hn,Rn,Tn,Yn,An,Jn,Kn,Qn,Un,Vn,Wn,Zn,$n,_n,ne,ee,re,oe,ae,te,le,ie,ce,de,ge,se,be,ue,he,pe,fe,ye,ke,xe,me,ve,we,Oe,De,Pe=(w(pn={},p.Light,(w(un={},Dn.Default,y.gray.light2),w(un,Dn.Primary,y.green.dark1),w(un,Dn.PrimaryOutline,k(.76,y.green.base)),w(un,Dn.Danger,y.red.light1),w(un,Dn.DangerOutline,k(.76,y.red.base)),w(un,Dn.BaseGreen,y.green.light1),un)),w(pn,p.Dark,(w(hn={},Dn.Default,y.gray.base),w(hn,Dn.Primary,y.green.dark1),w(hn,Dn.PrimaryOutline,k(.76,y.green.base)),w(hn,Dn.Danger,y.red.dark2),w(hn,Dn.DangerOutline,k(.76,y.red.light1)),w(hn,Dn.BaseGreen,y.green.dark1),hn)),pn),je=t(fn||(fn=P(["\n overflow: hidden;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border-radius: 5px;\n"]))),ze=t(yn||(yn=P(["\n display: grid;\n grid-auto-flow: column;\n justify-content: center;\n align-items: center;\n height: 100%;\n width: 100%;\n pointer-events: none;\n position: relative;\n z-index: 0;\n"]))),Ge=(w(wn={},Pn.XSmall,t(kn||(kn=P(["\n padding: 0 7px; // 8px - 1px border\n gap: 6px;\n "])))),w(wn,Pn.Small,t(xn||(xn=P(["\n padding: 0 11px; // 12px - 1px border\n gap: 6px;\n "])))),w(wn,Pn.Default,t(mn||(mn=P(["\n padding: 0 11px; // 12px - 1px border\n gap: 6px;\n "])))),w(wn,Pn.Large,t(vn||(vn=P(["\n padding: 0 15px; // 16px - 1px border\n gap: 8px;\n "])))),wn),Be=function(o){var a,c=o.rightGlyph,d=o.leftGlyph,g=o.darkMode,s=o.disabled,b=void 0!==s&&s,h=o.variant,p=void 0===h?Dn.Default:h,f=o.size,y=void 0===f?Pn.Default:f,k=o.children,x=i(g),m=x.darkMode,v=x.theme,D=e(null);r((function(){var n,e=Pe[v][p];return null==D.current||b||(n=u(D.current,{backgroundColor:e})),n}),[D,p,m,b,v]);var j=null!==(a=(d||c)&&!k)&&void 0!==a&&a,z={variant:p,size:y,darkMode:m,disabled:b,isIconOnlyButton:j};return n.createElement(n.Fragment,null,n.createElement("div",{className:l(je),ref:D}),n.createElement("div",{className:l(ze,Ge[y],w({},t(Mn||(Mn=P(["\n justify-content: space-between;\n "]))),!!c&&m))},d&&n.createElement(Ln,O({glyph:d,className:t(qn||(qn=P(["\n justify-self: right;\n "])))},z)),k,c&&n.createElement(Ln,O({glyph:c,className:t(Fn||(Fn=P(["\n justify-self: left;\n "])))},z))))},Se=function(n){return"\n 0 0 0 2px ".concat(n,", \n 0 0 0 4px ").concat(y.blue.light1,";\n")},Ne=t(Cn||(Cn=P(["\n // unset browser default\n appearance: none;\n padding: 0;\n margin: 0;\n background-color: transparent;\n border: 1px solid transparent;\n display: inline-flex;\n align-items: stretch;\n transition: all ","ms ease-in-out;\n position: relative;\n text-decoration: none;\n cursor: pointer;\n z-index: 0;\n font-family: ",";\n border-radius: 6px;\n\n &:focus,\n &:focus-visible {\n outline: none;\n }\n\n &:active,\n &:focus,\n &:hover {\n text-decoration: none;\n }\n"])),c.default,d.default),Ee=(w($n={},p.Light,(w(An={},Dn.Default,t(In||(In=P(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n // needed to override any global button styles\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n box-shadow: 0 0 0 3px ",";\n }\n "])),y.gray.light3,y.gray.base,y.black,y.black,y.black,y.white,y.gray.light2)),w(An,Dn.Primary,t(Xn||(Xn=P(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: #00593f; // Not quite dark3\n border-color: #00593f; // Not quite dark3\n box-shadow: 0 0 0 3px ",";\n }\n "])),y.green.dark2,y.green.dark2,y.white,y.white,y.white,y.green.light2)),w(An,Dn.PrimaryOutline,t(Hn||(Hn=P(["\n background-color: transparent;\n border-color: ",";\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 "])),y.green.dark2,y.green.dark2,y.green.dark2,y.green.dark2,k(.96,y.green.base),y.green.light2)),w(An,Dn.Danger,t(Rn||(Rn=P(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: #c82222; // not quite dark1\n border-color: #c82222; // not quite dark1\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),y.red.base,y.red.base,y.white,y.white,y.white,y.red.light3)),w(An,Dn.DangerOutline,t(Tn||(Tn=P(["\n background-color: transparent;\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),y.red.light1,y.red.base,y.red.base,y.red.dark2,k(.96,y.red.base),y.red.base,y.red.light3)),w(An,Dn.BaseGreen,t(Yn||(Yn=P(["\n background-color: ",";\n border-color: ",";\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 "])),y.green.base,y.green.dark2,y.green.dark3,y.green.dark3,y.green.dark3,x(.96,y.green.base,y.green.dark3),y.green.light2)),An)),w($n,p.Dark,(w(Zn={},Dn.Default,t(Jn||(Jn=P(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n background-color: ",";\n border-color: ",";\n color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),y.gray.dark2,y.gray.base,y.white,y.white,y.gray.dark1,y.gray.base,y.white,y.gray.dark2)),w(Zn,Dn.Primary,t(Kn||(Kn=P(["\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: #00593f; // Off palette\n box-shadow: 0 0 0 3px ",";\n }\n "])),y.green.dark2,y.green.base,y.white,y.white,y.white,y.green.dark3)),w(Zn,Dn.PrimaryOutline,t(Qn||(Qn=P(["\n background-color: transparent;\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),y.green.base,y.green.base,y.green.base,y.green.base,k(.96,y.green.base),y.green.base,y.green.dark3)),w(Zn,Dn.Danger,t(Un||(Un=P(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n border-color: ",";\n color: ",";\n background-color: #c82222; // Off palette\n box-shadow: 0px 0px 0px 3px ","; // yes, yellow\n }\n "])),y.red.base,y.red.light1,y.white,y.white,y.red.light1,y.white,y.yellow.dark3)),w(Zn,Dn.DangerOutline,t(Vn||(Vn=P(["\n border-color: ",";\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 ","; // yes, yellow\n }\n "])),y.red.light1,y.red.light1,y.red.light1,y.red.light1,k(.96,y.red.base),y.yellow.dark3)),w(Zn,Dn.BaseGreen,t(Wn||(Wn=P(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),y.green.base,y.green.dark2,y.green.dark3,y.green.dark3,y.green.dark3,x(.96,y.green.base,y.green.light3),y.green.dark2,y.green.dark3)),Zn)),$n),Le=(w(ue={},p.Light,(w(te={},Dn.Default,t(_n||(_n=P(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),y.white,Se(y.white))),w(te,Dn.Primary,t(ne||(ne=P(["\n &:focus-visible {\n color: ",";\n background-color: #00593f; // Not quite dark3\n box-shadow: ",";\n }\n "])),y.white,Se(y.white))),w(te,Dn.PrimaryOutline,t(ee||(ee=P(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),k(.96,y.green.base),Se(y.white))),w(te,Dn.Danger,t(re||(re=P(["\n &:focus-visible {\n color: ",";\n background-color: #c82222; // not quite dark1\n box-shadow: ",";\n }\n "])),y.white,Se(y.white))),w(te,Dn.DangerOutline,t(oe||(oe=P(["\n &:focus-visible {\n color: ",";\n box-shadow: ",";\n }\n "])),y.red.dark2,Se(y.white))),w(te,Dn.BaseGreen,t(ae||(ae=P(["\n &:focus-visible {\n box-shadow: ",";\n }\n "])),Se(y.white))),te)),w(ue,p.Dark,(w(be={},Dn.Default,t(le||(le=P(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),y.gray.dark1,Se(y.black))),w(be,Dn.Primary,t(ie||(ie=P(["\n &:focus-visible {\n background-color: #00593f; // Off palette\n box-shadow: ",";\n }\n "])),Se(y.black))),w(be,Dn.PrimaryOutline,t(ce||(ce=P(["\n &:focus-visible {\n background-color: ",";\n border-color: ",";\n box-shadow: ",";\n }\n "])),k(.96,y.green.base),y.green.base,Se(y.black))),w(be,Dn.Danger,t(de||(de=P(["\n &:focus-visible {\n background-color: #c82222; // Off palette\n box-shadow: ",";\n }\n "])),Se(y.black))),w(be,Dn.DangerOutline,t(ge||(ge=P(["\n &:focus-visible {\n background-color: ",";\n border-color: ",";\n box-shadow: ",";\n }\n "])),k(.96,y.red.base),y.red.light1,Se(y.black))),w(be,Dn.BaseGreen,t(se||(se=P(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),y.green.base,Se(y.black))),be)),ue),Me=(w(fe={},p.Light,t(he||(he=P(["\n &,\n &:hover {\n background-color: ",";\n border-color: ",";\n color: ",";\n cursor: not-allowed;\n }\n\n &:focus {\n color: ",";\n box-shadow: ",";\n }\n "])),y.gray.light2,y.gray.light1,y.gray.base,y.gray.base,Se(y.white))),w(fe,p.Dark,t(pe||(pe=P(["\n &,\n &:hover {\n background-color: ",";\n border-color: ",";\n color: ",";\n cursor: not-allowed;\n }\n\n &:focus {\n color: ",";\n box-shadow: ",";\n }\n "])),y.gray.dark3,y.gray.dark1,y.gray.dark1,y.gray.dark1,Se(y.black))),fe),qe=(w(ve={},Pn.XSmall,t(ye||(ye=P(["\n height: 22px;\n text-transform: uppercase;\n font-size: 12px;\n line-height: 1em;\n font-weight: ",";\n letter-spacing: 0.4px;\n "])),g.bold)),w(ve,Pn.Small,t(ke||(ke=P(["\n height: 28px;\n "])))),w(ve,Pn.Default,t(xe||(xe=P(["\n height: 36px;\n "])))),w(ve,Pn.Large,t(me||(me=P(["\n height: 48px;\n font-size: 18px;\n line-height: 24px;\n "])))),ve),Fe=(w(De={},b.Body1,t(we||(we=P(["\n font-size: ","px;\n line-height: ","px;\n font-weight: ",";\n "])),s.body1.fontSize,s.body1.lineHeight,g.medium)),w(De,b.Body2,t(Oe||(Oe=P(["\n font-size: ","px;\n line-height: ","px;\n // Pixel pushing for optical alignment purposes\n transform: translateY(1px);\n font-weight: ",";\n "])),s.body2.fontSize,s.body2.lineHeight,g.medium)),De);var Ce=["variant","size","darkMode","baseFontSize","disabled","onClick","leftGlyph","rightGlyph","children","className","as","type"],Ie=n.forwardRef((function(e,r){var o=e.variant,t=void 0===o?Dn.Default:o,c=e.size,d=void 0===c?Pn.Default:c,g=e.darkMode,s=e.baseFontSize,u=void 0===s?b.Body1:s,h=e.disabled,p=void 0!==h&&h,y=e.onClick,k=e.leftGlyph,x=e.rightGlyph,m=e.children,O=e.className,P=e.as,j=e.type,z=D(e,Ce),G=i(g).darkMode,B=function(n){var e=n.variant,r=n.size,o=n.darkMode,a=n.baseFontSize,t=n.disabled,i=f(o),c=Ee[i][e],d=Le[i][e];return l(Ne,c,Fe[a],qe[r],w({},d,!t),w({},Me[i],t))}({variant:t,size:d,darkMode:G,baseFontSize:u,disabled:p}),S=!(!z.href&&"a"!==P||p),N=v({type:S?void 0:j||"button",className:l(On,B,O),ref:r,as:P||(S?"a":"button"),"aria-disabled":p,onClick:p?void 0:y,href:p?void 0:z.href},z),E={rightGlyph:x,leftGlyph:k,darkMode:G,disabled:p,variant:t,size:d};return n.createElement(a,N,n.createElement(Be,E,m))}));Ie.displayName="Button",Ie.propTypes={variant:o.oneOf(Object.values(Dn)),baseFontSize:o.oneOf(Object.values(b)),size:o.oneOf(Object.values(Pn)),darkMode:o.bool,disabled:o.bool,leftGlyph:o.element,rightGlyph:o.element,href:o.string};export{jn as FontSize,Pn as Size,Dn as Variant,Ie as default}; | ||
import n,{useRef as e,useEffect as r}from"react";import o from"prop-types";import a from"@leafygreen-ui/box";import{css as t,cx as l}from"@leafygreen-ui/emotion";import{useDarkMode as i}from"@leafygreen-ui/leafygreen-provider";import{transitionDuration as c,fontFamilies as d,fontWeights as g,typeScales as s,BaseFontSize as b}from"@leafygreen-ui/tokens";import{registerRipple as u}from"@leafygreen-ui/ripple";import{createUniqueClassName as p,Theme as h,getTheme as f}from"@leafygreen-ui/lib";import{palette as y}from"@leafygreen-ui/palette";import{transparentize as k,mix as x}from"polished";function m(n,e){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.push.apply(r,o)}return r}function v(n){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?m(Object(r),!0).forEach((function(e){w(n,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))}))}return n}function w(n,e,r){return(e=function(n){var e=function(n,e){if("object"!=typeof n||null===n)return n;var r=n[Symbol.toPrimitive];if(void 0!==r){var o=r.call(n,e||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(n)}(n,"string");return"symbol"==typeof e?e:String(e)}(e))in n?Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[e]=r,n}function O(){return O=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])}return n},O.apply(this,arguments)}function D(n,e){if(null==n)return{};var r,o,a=function(n,e){if(null==n)return{};var r,o,a={},t=Object.keys(n);for(o=0;o<t.length;o++)r=t[o],e.indexOf(r)>=0||(a[r]=n[r]);return a}(n,e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);for(o=0;o<t.length;o++)r=t[o],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(n,r)&&(a[r]=n[r])}return a}function P(n,e){return e||(e=n.slice(0)),Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(e)}}))}var j,z,G,S,B,N,E,L,M,q,F,C,I,X,H,T,R,Y,A,J,K,Q,U,V,W,Z,$,_,nn,en,rn,on,an,tn,ln,cn,dn,gn,sn,bn,un,pn,hn,fn,yn,kn,xn,mn,vn,wn,On=p("button"),Dn={Default:"default",Primary:"primary",PrimaryOutline:"primaryOutline",Danger:"danger",DangerOutline:"dangerOutline",BaseGreen:"baseGreen"},Pn={XSmall:"xsmall",Small:"small",Default:"default",Large:"large"},jn={Body1:13,Body2:16},zn=(w(H={},h.Light,(w(E={},Dn.Default,t(j||(j=P(["\n color: ",";\n "])),y.gray.base)),w(E,Dn.Primary,t(z||(z=P(["\n color: ",";\n "])),y.green.light2)),w(E,Dn.PrimaryOutline,t(G||(G=P(["\n color: ",";\n "])),y.green.dark2)),w(E,Dn.Danger,t(S||(S=P(["\n color: ",";\n "])),y.red.light3)),w(E,Dn.DangerOutline,t(B||(B=P(["\n color: ",";\n "])),y.red.light1)),w(E,Dn.BaseGreen,t(N||(N=P(["\n color: ",";\n "])),y.green.dark2)),E)),w(H,h.Dark,(w(X={},Dn.Default,t(L||(L=P(["\n color: ",";\n "])),y.gray.light2)),w(X,Dn.Primary,t(M||(M=P(["\n color: ",";\n "])),y.green.light2)),w(X,Dn.PrimaryOutline,t(q||(q=P(["\n color: ",";\n "])),y.green.base)),w(X,Dn.Danger,t(F||(F=P(["\n color: ",";\n "])),y.red.light2)),w(X,Dn.DangerOutline,t(C||(C=P(["\n color: ",";\n "])),y.red.light1)),w(X,Dn.BaseGreen,t(I||(I=P(["\n color: ",";\n "])),y.green.dark2)),X)),H),Gn=(w(en={},h.Light,(w(Q={},Dn.Default,t(T||(T=P(["\n color: ",";\n "])),y.black)),w(Q,Dn.Primary,t(R||(R=P(["\n color: ",";\n "])),y.white)),w(Q,Dn.PrimaryOutline,t(Y||(Y=P(["\n color: ",";\n "])),y.green.dark2)),w(Q,Dn.Danger,t(A||(A=P(["\n color: ",";\n "])),y.white)),w(Q,Dn.DangerOutline,t(J||(J=P(["\n color: ",";\n "])),y.red.base)),w(Q,Dn.BaseGreen,t(K||(K=P(["\n color: ",";\n "])),y.green.dark3)),Q)),w(en,h.Dark,(w(nn={},Dn.Default,t(U||(U=P(["\n color: ",";\n "])),y.white)),w(nn,Dn.Primary,t(V||(V=P(["\n color: ",";\n "])),y.white)),w(nn,Dn.PrimaryOutline,t(W||(W=P(["\n color: ",";\n "])),y.green.base)),w(nn,Dn.Danger,t(Z||(Z=P(["\n color: ",";\n "])),y.white)),w(nn,Dn.DangerOutline,t($||($=P(["\n color: ",";\n "])),y.red.light1)),w(nn,Dn.BaseGreen,t(_||(_=P(["\n color: ",";\n "])),y.green.dark3)),nn)),en),Sn=t(rn||(rn=P(["\n ."," {\n &:hover,\n &:active {\n color: currentColor;\n }\n }\n"])),On),Bn=(w(cn={},Pn.XSmall,t(on||(on=P(["\n height: 14px;\n width: 14px;\n "])))),w(cn,Pn.Small,t(an||(an=P(["\n height: 16px;\n width: 16px;\n "])))),w(cn,Pn.Default,t(tn||(tn=P(["\n height: 16px;\n width: 16px;\n "])))),w(cn,Pn.Large,t(ln||(ln=P(["\n height: 20px;\n width: 20px;\n "])))),cn),Nn=(w(sn={},h.Light,t(dn||(dn=P(["\n color: ",";\n "])),y.gray.light1)),w(sn,h.Dark,t(gn||(gn=P(["\n color: ",";\n "])),y.gray.dark1)),sn),En=t(bn||(bn=P(["\n color: ",";\n"])),y.gray.dark2);function Ln(e){var r,o=e.glyph,a=e.variant,t=e.size,i=e.darkMode,c=e.disabled,d=e.isIconOnlyButton,g=e.className,s=!d&&{"aria-hidden":!0,role:"presentation"},b=f(i),u=d?Gn:zn;return n.cloneElement(o,v({className:l(u[b][a],Bn[t],(r={},w(r,Sn,d),w(r,Nn[b],c),w(r,En,c&&d&&i),r),g)},s))}Ln.displayName="ButtonIcon";var Mn,qn,Fn,Cn,In,Xn,Hn,Tn,Rn,Yn,An,Jn,Kn,Qn,Un,Vn,Wn,Zn,$n,_n,ne,ee,re,oe,ae,te,le,ie,ce,de,ge,se,be,ue,pe,he,fe,ye,ke,xe,me,ve,we,Oe,De,Pe=(w(hn={},h.Light,(w(un={},Dn.Default,y.gray.light2),w(un,Dn.Primary,y.green.dark1),w(un,Dn.PrimaryOutline,k(.76,y.green.base)),w(un,Dn.Danger,y.red.light1),w(un,Dn.DangerOutline,k(.76,y.red.base)),w(un,Dn.BaseGreen,y.green.light1),un)),w(hn,h.Dark,(w(pn={},Dn.Default,y.gray.base),w(pn,Dn.Primary,y.green.dark1),w(pn,Dn.PrimaryOutline,k(.76,y.green.base)),w(pn,Dn.Danger,y.red.dark2),w(pn,Dn.DangerOutline,k(.76,y.red.light1)),w(pn,Dn.BaseGreen,y.green.dark1),pn)),hn),je=t(fn||(fn=P(["\n overflow: hidden;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border-radius: 5px;\n"]))),ze=t(yn||(yn=P(["\n display: grid;\n grid-auto-flow: column;\n justify-content: center;\n align-items: center;\n height: 100%;\n width: 100%;\n pointer-events: none;\n position: relative;\n z-index: 0;\n"]))),Ge=(w(wn={},Pn.XSmall,t(kn||(kn=P(["\n padding: 0 7px; // 8px - 1px border\n gap: 6px;\n "])))),w(wn,Pn.Small,t(xn||(xn=P(["\n padding: 0 11px; // 12px - 1px border\n gap: 6px;\n "])))),w(wn,Pn.Default,t(mn||(mn=P(["\n padding: 0 11px; // 12px - 1px border\n gap: 6px;\n "])))),w(wn,Pn.Large,t(vn||(vn=P(["\n padding: 0 15px; // 16px - 1px border\n gap: 8px;\n "])))),wn),Se=function(o){var a,c=o.rightGlyph,d=o.leftGlyph,g=o.darkMode,s=o.disabled,b=void 0!==s&&s,p=o.variant,h=void 0===p?Dn.Default:p,f=o.size,y=void 0===f?Pn.Default:f,k=o.children,x=i(g),m=x.darkMode,v=x.theme,D=e(null);r((function(){var n,e=Pe[v][h];return null==D.current||b||(n=u(D.current,{backgroundColor:e})),n}),[D,h,m,b,v]);var j=null!==(a=(d||c)&&!k)&&void 0!==a&&a,z={variant:h,size:y,darkMode:m,disabled:b,isIconOnlyButton:j};return n.createElement(n.Fragment,null,n.createElement("div",{className:l(je),ref:D}),n.createElement("div",{className:l(ze,Ge[y],w({},t(Mn||(Mn=P(["\n justify-content: space-between;\n "]))),!!c&&m))},d&&n.createElement(Ln,O({glyph:d,className:t(qn||(qn=P(["\n justify-self: right;\n "])))},z)),k,c&&n.createElement(Ln,O({glyph:c,className:t(Fn||(Fn=P(["\n justify-self: left;\n "])))},z))))},Be=function(n){return"\n 0 0 0 2px ".concat(n,", \n 0 0 0 4px ").concat(y.blue.light1,";\n")},Ne=t(Cn||(Cn=P(["\n // unset browser default\n appearance: none;\n padding: 0;\n margin: 0;\n background-color: transparent;\n border: 1px solid transparent;\n display: inline-flex;\n align-items: stretch;\n transition: all ","ms ease-in-out;\n position: relative;\n text-decoration: none;\n cursor: pointer;\n z-index: 0;\n font-family: ",";\n border-radius: 6px;\n\n &:focus,\n &:focus-visible {\n outline: none;\n }\n\n &:active,\n &:focus,\n &:hover {\n text-decoration: none;\n }\n"])),c.default,d.default),Ee=(w($n={},h.Light,(w(An={},Dn.Default,t(In||(In=P(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n // needed to override any global button styles\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n box-shadow: 0 0 0 3px ",";\n }\n "])),y.gray.light3,y.gray.base,y.black,y.black,y.black,y.white,y.gray.light2)),w(An,Dn.Primary,t(Xn||(Xn=P(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: #00593f; // Not quite dark3\n border-color: #00593f; // Not quite dark3\n box-shadow: 0 0 0 3px ",";\n }\n "])),y.green.dark2,y.green.dark2,y.white,y.white,y.white,y.green.light2)),w(An,Dn.PrimaryOutline,t(Hn||(Hn=P(["\n background-color: transparent;\n border-color: ",";\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 "])),y.green.dark2,y.green.dark2,y.green.dark2,y.green.dark2,k(.96,y.green.base),y.green.light2)),w(An,Dn.Danger,t(Tn||(Tn=P(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: #c82222; // not quite dark1\n border-color: #c82222; // not quite dark1\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),y.red.base,y.red.base,y.white,y.white,y.white,y.red.light3)),w(An,Dn.DangerOutline,t(Rn||(Rn=P(["\n background-color: transparent;\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),y.red.light1,y.red.base,y.red.base,y.red.dark2,k(.96,y.red.base),y.red.base,y.red.light3)),w(An,Dn.BaseGreen,t(Yn||(Yn=P(["\n background-color: ",";\n border-color: ",";\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 "])),y.green.base,y.green.dark2,y.green.dark3,y.green.dark3,y.green.dark3,x(.96,y.green.base,y.green.dark3),y.green.light2)),An)),w($n,h.Dark,(w(Zn={},Dn.Default,t(Jn||(Jn=P(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n background-color: ",";\n border-color: ",";\n color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),y.gray.dark2,y.gray.base,y.white,y.white,y.gray.dark1,y.gray.base,y.white,y.gray.dark2)),w(Zn,Dn.Primary,t(Kn||(Kn=P(["\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: #00593f; // Off palette\n box-shadow: 0 0 0 3px ",";\n }\n "])),y.green.dark2,y.green.base,y.white,y.white,y.white,y.green.dark3)),w(Zn,Dn.PrimaryOutline,t(Qn||(Qn=P(["\n background-color: transparent;\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),y.green.base,y.green.base,y.green.base,y.green.base,k(.96,y.green.base),y.green.base,y.green.dark3)),w(Zn,Dn.Danger,t(Un||(Un=P(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n border-color: ",";\n color: ",";\n background-color: #c82222; // Off palette\n box-shadow: 0px 0px 0px 3px ","; // yes, yellow\n }\n "])),y.red.base,y.red.light1,y.white,y.white,y.red.light1,y.white,y.yellow.dark3)),w(Zn,Dn.DangerOutline,t(Vn||(Vn=P(["\n border-color: ",";\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 ","; // yes, yellow\n }\n "])),y.red.light1,y.red.light1,y.red.light1,y.red.light1,k(.96,y.red.base),y.yellow.dark3)),w(Zn,Dn.BaseGreen,t(Wn||(Wn=P(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),y.green.base,y.green.dark2,y.green.dark3,y.green.dark3,y.green.dark3,x(.96,y.green.base,y.green.light3),y.green.dark2,y.green.dark3)),Zn)),$n),Le=(w(ue={},h.Light,(w(te={},Dn.Default,t(_n||(_n=P(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),y.white,Be(y.white))),w(te,Dn.Primary,t(ne||(ne=P(["\n &:focus-visible {\n color: ",";\n background-color: #00593f; // Not quite dark3\n box-shadow: ",";\n }\n "])),y.white,Be(y.white))),w(te,Dn.PrimaryOutline,t(ee||(ee=P(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),k(.96,y.green.base),Be(y.white))),w(te,Dn.Danger,t(re||(re=P(["\n &:focus-visible {\n color: ",";\n background-color: #c82222; // not quite dark1\n box-shadow: ",";\n }\n "])),y.white,Be(y.white))),w(te,Dn.DangerOutline,t(oe||(oe=P(["\n &:focus-visible {\n color: ",";\n box-shadow: ",";\n }\n "])),y.red.dark2,Be(y.white))),w(te,Dn.BaseGreen,t(ae||(ae=P(["\n &:focus-visible {\n box-shadow: ",";\n }\n "])),Be(y.white))),te)),w(ue,h.Dark,(w(be={},Dn.Default,t(le||(le=P(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),y.gray.dark1,Be(y.black))),w(be,Dn.Primary,t(ie||(ie=P(["\n &:focus-visible {\n background-color: #00593f; // Off palette\n box-shadow: ",";\n }\n "])),Be(y.black))),w(be,Dn.PrimaryOutline,t(ce||(ce=P(["\n &:focus-visible {\n background-color: ",";\n border-color: ",";\n box-shadow: ",";\n }\n "])),k(.96,y.green.base),y.green.base,Be(y.black))),w(be,Dn.Danger,t(de||(de=P(["\n &:focus-visible {\n background-color: #c82222; // Off palette\n box-shadow: ",";\n }\n "])),Be(y.black))),w(be,Dn.DangerOutline,t(ge||(ge=P(["\n &:focus-visible {\n background-color: ",";\n border-color: ",";\n box-shadow: ",";\n }\n "])),k(.96,y.red.base),y.red.light1,Be(y.black))),w(be,Dn.BaseGreen,t(se||(se=P(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),y.green.base,Be(y.black))),be)),ue),Me=(w(fe={},h.Light,t(pe||(pe=P(["\n &,\n &:hover {\n background-color: ",";\n border-color: ",";\n color: ",";\n cursor: not-allowed;\n }\n\n &:focus {\n color: ",";\n box-shadow: ",";\n }\n "])),y.gray.light2,y.gray.light1,y.gray.base,y.gray.base,Be(y.white))),w(fe,h.Dark,t(he||(he=P(["\n &,\n &:hover {\n background-color: ",";\n border-color: ",";\n color: ",";\n cursor: not-allowed;\n }\n\n &:focus {\n color: ",";\n box-shadow: ",";\n }\n "])),y.gray.dark3,y.gray.dark1,y.gray.dark1,y.gray.dark1,Be(y.black))),fe),qe=(w(ve={},Pn.XSmall,t(ye||(ye=P(["\n height: 22px;\n text-transform: uppercase;\n font-size: 12px;\n line-height: 1em;\n font-weight: ",";\n letter-spacing: 0.4px;\n "])),g.bold)),w(ve,Pn.Small,t(ke||(ke=P(["\n height: 28px;\n "])))),w(ve,Pn.Default,t(xe||(xe=P(["\n height: 36px;\n "])))),w(ve,Pn.Large,t(me||(me=P(["\n height: 48px;\n font-size: 18px;\n line-height: 24px;\n "])))),ve),Fe=(w(De={},b.Body1,t(we||(we=P(["\n font-size: ","px;\n line-height: ","px;\n font-weight: ",";\n "])),s.body1.fontSize,s.body1.lineHeight,g.medium)),w(De,b.Body2,t(Oe||(Oe=P(["\n font-size: ","px;\n line-height: ","px;\n // Pixel pushing for optical alignment purposes\n transform: translateY(1px);\n font-weight: ",";\n "])),s.body2.fontSize,s.body2.lineHeight,g.medium)),De);var Ce=["variant","size","darkMode","baseFontSize","disabled","onClick","leftGlyph","rightGlyph","children","className","as","type"],Ie=n.forwardRef((function(e,r){var o=e.variant,t=void 0===o?Dn.Default:o,c=e.size,d=void 0===c?Pn.Default:c,g=e.darkMode,s=e.baseFontSize,u=void 0===s?b.Body1:s,p=e.disabled,h=void 0!==p&&p,y=e.onClick,k=e.leftGlyph,x=e.rightGlyph,m=e.children,O=e.className,P=e.as,j=e.type,z=D(e,Ce),G=i(g).darkMode,S=function(n){var e=n.variant,r=n.size,o=n.darkMode,a=n.baseFontSize,t=n.disabled,i=f(o),c=Ee[i][e],d=Le[i][e];return l(Ne,c,Fe[a],qe[r],w({},d,!t),w({},Me[i],t))}({variant:t,size:d,darkMode:G,baseFontSize:u,disabled:h}),B=!(!z.href&&"a"!==P||h),N=v({type:B?void 0:j||"button",className:l(On,S,O),ref:r,as:P||(B?"a":"button"),"aria-disabled":h,onClick:h?void 0:y,href:h?void 0:z.href},z),E={rightGlyph:x,leftGlyph:k,darkMode:G,disabled:h,variant:t,size:d};return n.createElement(a,N,n.createElement(Se,E,m))}));Ie.displayName="Button",Ie.propTypes={variant:o.oneOf(Object.values(Dn)),baseFontSize:o.oneOf(Object.values(b)),size:o.oneOf(Object.values(Pn)),darkMode:o.bool,disabled:o.bool,leftGlyph:o.element,rightGlyph:o.element,href:o.string};export{jn as FontSize,Pn as Size,Dn as Variant,Ie as default}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,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/leafygreen-provider"),require("@leafygreen-ui/tokens"),require("@leafygreen-ui/ripple"),require("@leafygreen-ui/lib"),require("@leafygreen-ui/palette"),require("polished")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@leafygreen-ui/box","@leafygreen-ui/emotion","@leafygreen-ui/leafygreen-provider","@leafygreen-ui/tokens","@leafygreen-ui/ripple","@leafygreen-ui/lib","@leafygreen-ui/palette","polished"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)["@leafygreen-ui/button"]={},e.React,e.PropTypes,e["@leafygreen-ui/box"],e["@leafygreen-ui/emotion"],e["@leafygreen-ui/leafygreen-provider"],e["@leafygreen-ui/tokens"],e["@leafygreen-ui/ripple"],e["@leafygreen-ui/lib"],e["@leafygreen-ui/palette"],e.polished)}(this,(function(e,n,t,r,a,o,l,i,s,c,p){"use strict";function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=d(n),u=d(t),b=d(r);function f(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function h(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?f(Object(t),!0).forEach((function(n){y(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):f(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function y(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function x(){return x=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},x.apply(this,arguments)}function k(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function m(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}var v,w,O,D,z,P,j,S,B,G,T,q,N,M,E,F,L,C,I,R,X,W,H,_,U,V,Y,A,J,K,Q,Z,$,ee,ne,te,re,ae,oe,le,ie,se,ce,pe,de,ge,ue,be,fe,he,ye=s.createUniqueClassName("button"),xe={Default:"default",Primary:"primary",PrimaryOutline:"primaryOutline",Danger:"danger",DangerOutline:"dangerOutline",BaseGreen:"baseGreen"},ke={XSmall:"xsmall",Small:"small",Default:"default",Large:"large"},me=(y(E={},s.Theme.Light,(y(j={},xe.Default,a.css(v||(v=m(["\n color: ",";\n "])),c.palette.gray.base)),y(j,xe.Primary,a.css(w||(w=m(["\n color: ",";\n "])),c.palette.green.light2)),y(j,xe.PrimaryOutline,a.css(O||(O=m(["\n color: ",";\n "])),c.palette.green.dark2)),y(j,xe.Danger,a.css(D||(D=m(["\n color: ",";\n "])),c.palette.red.light3)),y(j,xe.DangerOutline,a.css(z||(z=m(["\n color: ",";\n "])),c.palette.red.light1)),y(j,xe.BaseGreen,a.css(P||(P=m(["\n color: ",";\n "])),c.palette.green.dark2)),j)),y(E,s.Theme.Dark,(y(M={},xe.Default,a.css(S||(S=m(["\n color: ",";\n "])),c.palette.gray.light2)),y(M,xe.Primary,a.css(B||(B=m(["\n color: ",";\n "])),c.palette.green.light2)),y(M,xe.PrimaryOutline,a.css(G||(G=m(["\n color: ",";\n "])),c.palette.green.base)),y(M,xe.Danger,a.css(T||(T=m(["\n color: ",";\n "])),c.palette.red.light2)),y(M,xe.DangerOutline,a.css(q||(q=m(["\n color: ",";\n "])),c.palette.red.light1)),y(M,xe.BaseGreen,a.css(N||(N=m(["\n color: ",";\n "])),c.palette.green.dark2)),M)),E),ve=(y(K={},s.Theme.Light,(y(W={},xe.Default,a.css(F||(F=m(["\n color: ",";\n "])),c.palette.black)),y(W,xe.Primary,a.css(L||(L=m(["\n color: ",";\n "])),c.palette.white)),y(W,xe.PrimaryOutline,a.css(C||(C=m(["\n color: ",";\n "])),c.palette.green.dark2)),y(W,xe.Danger,a.css(I||(I=m(["\n color: ",";\n "])),c.palette.white)),y(W,xe.DangerOutline,a.css(R||(R=m(["\n color: ",";\n "])),c.palette.red.base)),y(W,xe.BaseGreen,a.css(X||(X=m(["\n color: ",";\n "])),c.palette.green.dark3)),W)),y(K,s.Theme.Dark,(y(J={},xe.Default,a.css(H||(H=m(["\n color: ",";\n "])),c.palette.white)),y(J,xe.Primary,a.css(_||(_=m(["\n color: ",";\n "])),c.palette.white)),y(J,xe.PrimaryOutline,a.css(U||(U=m(["\n color: ",";\n "])),c.palette.green.base)),y(J,xe.Danger,a.css(V||(V=m(["\n color: ",";\n "])),c.palette.white)),y(J,xe.DangerOutline,a.css(Y||(Y=m(["\n color: ",";\n "])),c.palette.red.light1)),y(J,xe.BaseGreen,a.css(A||(A=m(["\n color: ",";\n "])),c.palette.green.dark3)),J)),K),we=a.css(Q||(Q=m(["\n ."," {\n &:hover,\n &:active {\n color: currentColor;\n }\n }\n"])),ye),Oe=(y(te={},ke.XSmall,a.css(Z||(Z=m(["\n height: 14px;\n width: 14px;\n "])))),y(te,ke.Small,a.css($||($=m(["\n height: 16px;\n width: 16px;\n "])))),y(te,ke.Default,a.css(ee||(ee=m(["\n height: 16px;\n width: 16px;\n "])))),y(te,ke.Large,a.css(ne||(ne=m(["\n height: 20px;\n width: 20px;\n "])))),te),De=(y(oe={},s.Theme.Light,a.css(re||(re=m(["\n color: ",";\n "])),c.palette.gray.light1)),y(oe,s.Theme.Dark,a.css(ae||(ae=m(["\n color: ",";\n "])),c.palette.gray.dark1)),oe),ze=a.css(le||(le=m(["\n color: ",";\n"])),c.palette.gray.dark2);function Pe(e){var n,t=e.glyph,r=e.variant,o=e.size,l=e.darkMode,i=e.disabled,c=e.isIconOnlyButton,p=e.className,d=!c&&{"aria-hidden":!0,role:"presentation"},u=s.getTheme(l),b=c?ve:me;return g.default.cloneElement(t,h({className:a.cx(b[u][r],Oe[o],(n={},y(n,we,c),y(n,De[u],i),y(n,ze,i&&c&&l),n),p)},d))}Pe.displayName="ButtonIcon";var je,Se,Be,Ge,Te,qe,Ne,Me,Ee,Fe,Le,Ce,Ie,Re,Xe,We,He,_e,Ue,Ve,Ye,Ae,Je,Ke,Qe,Ze,$e,en,nn,tn,rn,an,on,ln,sn,cn,pn,dn,gn,un,bn,fn,hn,yn,xn,kn=.76,mn=(y(ce={},s.Theme.Light,(y(ie={},xe.Default,c.palette.gray.light2),y(ie,xe.Primary,c.palette.green.dark1),y(ie,xe.PrimaryOutline,p.transparentize(kn,c.palette.green.base)),y(ie,xe.Danger,c.palette.red.light1),y(ie,xe.DangerOutline,p.transparentize(kn,c.palette.red.base)),y(ie,xe.BaseGreen,c.palette.green.light1),ie)),y(ce,s.Theme.Dark,(y(se={},xe.Default,c.palette.gray.base),y(se,xe.Primary,c.palette.green.dark1),y(se,xe.PrimaryOutline,p.transparentize(kn,c.palette.green.base)),y(se,xe.Danger,c.palette.red.dark2),y(se,xe.DangerOutline,p.transparentize(kn,c.palette.red.light1)),y(se,xe.BaseGreen,c.palette.green.dark1),se)),ce),vn=a.css(pe||(pe=m(["\n overflow: hidden;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border-radius: 5px;\n"]))),wn=a.css(de||(de=m(["\n display: grid;\n grid-auto-flow: column;\n justify-content: center;\n align-items: center;\n height: 100%;\n width: 100%;\n pointer-events: none;\n position: relative;\n z-index: 0;\n"]))),On=(y(he={},ke.XSmall,a.css(ge||(ge=m(["\n padding: 0 7px; // 8px - 1px border\n gap: 6px;\n "])))),y(he,ke.Small,a.css(ue||(ue=m(["\n padding: 0 11px; // 12px - 1px border\n gap: 6px;\n "])))),y(he,ke.Default,a.css(be||(be=m(["\n padding: 0 11px; // 12px - 1px border\n gap: 6px;\n "])))),y(he,ke.Large,a.css(fe||(fe=m(["\n padding: 0 15px; // 16px - 1px border\n gap: 8px;\n "])))),he),Dn=function(e){var t,r=e.rightGlyph,l=e.leftGlyph,s=e.darkMode,c=e.disabled,p=void 0!==c&&c,d=e.variant,u=void 0===d?xe.Default:d,b=e.size,f=void 0===b?ke.Default:b,h=e.children,k=o.useDarkMode(s),v=k.darkMode,w=k.theme,O=n.useRef(null);n.useEffect((function(){var e,n=mn[w][u];return null==O.current||p||(e=i.registerRipple(O.current,{backgroundColor:n})),e}),[O,u,v,p,w]);var D=null!==(t=(l||r)&&!h)&&void 0!==t&&t,z={variant:u,size:f,darkMode:v,disabled:p,isIconOnlyButton:D};return g.default.createElement(g.default.Fragment,null,g.default.createElement("div",{className:a.cx(vn),ref:O}),g.default.createElement("div",{className:a.cx(wn,On[f],y({},a.css(je||(je=m(["\n justify-content: space-between;\n "]))),!!r&&v))},l&&g.default.createElement(Pe,x({glyph:l,className:a.css(Se||(Se=m(["\n justify-self: right;\n "])))},z)),h,r&&g.default.createElement(Pe,x({glyph:r,className:a.css(Be||(Be=m(["\n justify-self: left;\n "])))},z))))},zn=function(e){return"\n 0 0 0 2px ".concat(e,", \n 0 0 0 4px ").concat(c.palette.blue.light1,";\n")},Pn=a.css(Ge||(Ge=m(["\n // unset browser default\n appearance: none;\n padding: 0;\n margin: 0;\n background-color: transparent;\n border: 1px solid transparent;\n display: inline-flex;\n align-items: stretch;\n transition: all ","ms ease-in-out;\n position: relative;\n text-decoration: none;\n cursor: pointer;\n z-index: 0;\n font-family: ",";\n border-radius: 6px;\n\n &:focus,\n &:focus-visible {\n outline: none;\n }\n\n &:active,\n &:focus,\n &:hover {\n text-decoration: none;\n }\n"])),l.transitionDuration.default,l.fontFamilies.default),jn=(y(Ue={},s.Theme.Light,(y(Le={},xe.Default,a.css(Te||(Te=m(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n // needed to override any global button styles\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n box-shadow: 0 0 0 3px ",";\n }\n "])),c.palette.gray.light3,c.palette.gray.base,c.palette.black,c.palette.black,c.palette.black,c.palette.white,c.palette.gray.light2)),y(Le,xe.Primary,a.css(qe||(qe=m(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: #00593f; // Not quite dark3\n border-color: #00593f; // Not quite dark3\n box-shadow: 0 0 0 3px ",";\n }\n "])),c.palette.green.dark2,c.palette.green.dark2,c.palette.white,c.palette.white,c.palette.white,c.palette.green.light2)),y(Le,xe.PrimaryOutline,a.css(Ne||(Ne=m(["\n background-color: transparent;\n border-color: ",";\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 "])),c.palette.green.dark2,c.palette.green.dark2,c.palette.green.dark2,c.palette.green.dark2,p.transparentize(.96,c.palette.green.base),c.palette.green.light2)),y(Le,xe.Danger,a.css(Me||(Me=m(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: #c82222; // not quite dark1\n border-color: #c82222; // not quite dark1\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),c.palette.red.base,c.palette.red.base,c.palette.white,c.palette.white,c.palette.white,c.palette.red.light3)),y(Le,xe.DangerOutline,a.css(Ee||(Ee=m(["\n background-color: transparent;\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),c.palette.red.light1,c.palette.red.base,c.palette.red.base,c.palette.red.dark2,p.transparentize(.96,c.palette.red.base),c.palette.red.base,c.palette.red.light3)),y(Le,xe.BaseGreen,a.css(Fe||(Fe=m(["\n background-color: ",";\n border-color: ",";\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 "])),c.palette.green.base,c.palette.green.dark2,c.palette.green.dark3,c.palette.green.dark3,c.palette.green.dark3,p.mix(.96,c.palette.green.base,c.palette.green.dark3),c.palette.green.light2)),Le)),y(Ue,s.Theme.Dark,(y(_e={},xe.Default,a.css(Ce||(Ce=m(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n background-color: ",";\n border-color: ",";\n color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),c.palette.gray.dark2,c.palette.gray.base,c.palette.white,c.palette.white,c.palette.gray.dark1,c.palette.gray.base,c.palette.white,c.palette.gray.dark2)),y(_e,xe.Primary,a.css(Ie||(Ie=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: #00593f; // Off palette\n box-shadow: 0 0 0 3px ",";\n }\n "])),c.palette.green.dark2,c.palette.green.base,c.palette.white,c.palette.white,c.palette.white,c.palette.green.dark3)),y(_e,xe.PrimaryOutline,a.css(Re||(Re=m(["\n background-color: transparent;\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),c.palette.green.base,c.palette.green.base,c.palette.green.base,c.palette.green.base,p.transparentize(.96,c.palette.green.base),c.palette.green.base,c.palette.green.dark3)),y(_e,xe.Danger,a.css(Xe||(Xe=m(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n border-color: ",";\n color: ",";\n background-color: #c82222; // Off palette\n box-shadow: 0px 0px 0px 3px ","; // yes, yellow\n }\n "])),c.palette.red.base,c.palette.red.light1,c.palette.white,c.palette.white,c.palette.red.light1,c.palette.white,c.palette.yellow.dark3)),y(_e,xe.DangerOutline,a.css(We||(We=m(["\n border-color: ",";\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 ","; // yes, yellow\n }\n "])),c.palette.red.light1,c.palette.red.light1,c.palette.red.light1,c.palette.red.light1,p.transparentize(.96,c.palette.red.base),c.palette.yellow.dark3)),y(_e,xe.BaseGreen,a.css(He||(He=m(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),c.palette.green.base,c.palette.green.dark2,c.palette.green.dark3,c.palette.green.dark3,c.palette.green.dark3,p.mix(.96,c.palette.green.base,c.palette.green.light3),c.palette.green.dark2,c.palette.green.dark3)),_e)),Ue),Sn=(y(ln={},s.Theme.Light,(y(Ze={},xe.Default,a.css(Ve||(Ve=m(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),c.palette.white,zn(c.palette.white))),y(Ze,xe.Primary,a.css(Ye||(Ye=m(["\n &:focus-visible {\n color: ",";\n background-color: #00593f; // Not quite dark3\n box-shadow: ",";\n }\n "])),c.palette.white,zn(c.palette.white))),y(Ze,xe.PrimaryOutline,a.css(Ae||(Ae=m(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),p.transparentize(.96,c.palette.green.base),zn(c.palette.white))),y(Ze,xe.Danger,a.css(Je||(Je=m(["\n &:focus-visible {\n color: ",";\n background-color: #c82222; // not quite dark1\n box-shadow: ",";\n }\n "])),c.palette.white,zn(c.palette.white))),y(Ze,xe.DangerOutline,a.css(Ke||(Ke=m(["\n &:focus-visible {\n color: ",";\n box-shadow: ",";\n }\n "])),c.palette.red.dark2,zn(c.palette.white))),y(Ze,xe.BaseGreen,a.css(Qe||(Qe=m(["\n &:focus-visible {\n box-shadow: ",";\n }\n "])),zn(c.palette.white))),Ze)),y(ln,s.Theme.Dark,(y(on={},xe.Default,a.css($e||($e=m(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),c.palette.gray.dark1,zn(c.palette.black))),y(on,xe.Primary,a.css(en||(en=m(["\n &:focus-visible {\n background-color: #00593f; // Off palette\n box-shadow: ",";\n }\n "])),zn(c.palette.black))),y(on,xe.PrimaryOutline,a.css(nn||(nn=m(["\n &:focus-visible {\n background-color: ",";\n border-color: ",";\n box-shadow: ",";\n }\n "])),p.transparentize(.96,c.palette.green.base),c.palette.green.base,zn(c.palette.black))),y(on,xe.Danger,a.css(tn||(tn=m(["\n &:focus-visible {\n background-color: #c82222; // Off palette\n box-shadow: ",";\n }\n "])),zn(c.palette.black))),y(on,xe.DangerOutline,a.css(rn||(rn=m(["\n &:focus-visible {\n background-color: ",";\n border-color: ",";\n box-shadow: ",";\n }\n "])),p.transparentize(.96,c.palette.red.base),c.palette.red.light1,zn(c.palette.black))),y(on,xe.BaseGreen,a.css(an||(an=m(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),c.palette.green.base,zn(c.palette.black))),on)),ln),Bn=(y(pn={},s.Theme.Light,a.css(sn||(sn=m(["\n &,\n &:hover {\n background-color: ",";\n border-color: ",";\n color: ",";\n cursor: not-allowed;\n }\n\n &:focus {\n color: ",";\n box-shadow: ",";\n }\n "])),c.palette.gray.light2,c.palette.gray.light1,c.palette.gray.base,c.palette.gray.base,zn(c.palette.white))),y(pn,s.Theme.Dark,a.css(cn||(cn=m(["\n &,\n &:hover {\n background-color: ",";\n border-color: ",";\n color: ",";\n cursor: not-allowed;\n }\n\n &:focus {\n color: ",";\n box-shadow: ",";\n }\n "])),c.palette.gray.dark3,c.palette.gray.dark1,c.palette.gray.dark1,c.palette.gray.dark1,zn(c.palette.black))),pn),Gn=(y(fn={},ke.XSmall,a.css(dn||(dn=m(["\n height: 22px;\n text-transform: uppercase;\n font-size: 12px;\n line-height: 1em;\n font-weight: ",";\n letter-spacing: 0.4px;\n "])),l.fontWeights.bold)),y(fn,ke.Small,a.css(gn||(gn=m(["\n height: 28px;\n "])))),y(fn,ke.Default,a.css(un||(un=m(["\n height: 36px;\n "])))),y(fn,ke.Large,a.css(bn||(bn=m(["\n height: 48px;\n font-size: 18px;\n line-height: 24px;\n "])))),fn),Tn=(y(xn={},l.BaseFontSize.Body1,a.css(hn||(hn=m(["\n font-size: ","px;\n line-height: ","px;\n font-weight: ",";\n "])),l.typeScales.body1.fontSize,l.typeScales.body1.lineHeight,l.fontWeights.medium)),y(xn,l.BaseFontSize.Body2,a.css(yn||(yn=m(["\n font-size: ","px;\n line-height: ","px;\n // Pixel pushing for optical alignment purposes\n transform: translateY(1px);\n font-weight: ",";\n "])),l.typeScales.body2.fontSize,l.typeScales.body2.lineHeight,l.fontWeights.medium)),xn);var qn=["variant","size","darkMode","baseFontSize","disabled","onClick","leftGlyph","rightGlyph","children","className","as","type"],Nn=g.default.forwardRef((function(e,n){var t=e.variant,r=void 0===t?xe.Default:t,i=e.size,c=void 0===i?ke.Default:i,p=e.darkMode,d=e.baseFontSize,u=void 0===d?l.BaseFontSize.Body1:d,f=e.disabled,x=void 0!==f&&f,m=e.onClick,v=e.leftGlyph,w=e.rightGlyph,O=e.children,D=e.className,z=e.as,P=e.type,j=k(e,qn),S=o.useDarkMode(p).darkMode,B=function(e){var n=e.variant,t=e.size,r=e.darkMode,o=e.baseFontSize,l=e.disabled,i=s.getTheme(r),c=jn[i][n],p=Sn[i][n],d=Gn[t],g=Tn[o];return a.cx(Pn,c,g,d,y({},p,!l),y({},Bn[i],l))}({variant:r,size:c,darkMode:S,baseFontSize:u,disabled:x}),G=!(!j.href&&"a"!==z||x),T=h({type:G?void 0:P||"button",className:a.cx(ye,B,D),ref:n,as:z||(G?"a":"button"),"aria-disabled":x,onClick:x?void 0:m,href:x?void 0:j.href},j),q={rightGlyph:w,leftGlyph:v,darkMode:S,disabled:x,variant:r,size:c};return g.default.createElement(b.default,T,g.default.createElement(Dn,q,O))}));Nn.displayName="Button",Nn.propTypes={variant:u.default.oneOf(Object.values(xe)),baseFontSize:u.default.oneOf(Object.values(l.BaseFontSize)),size:u.default.oneOf(Object.values(ke)),darkMode:u.default.bool,disabled:u.default.bool,leftGlyph:u.default.element,rightGlyph:u.default.element,href:u.default.string},e.FontSize={Body1:13,Body2:16},e.Size=ke,e.Variant=xe,e.default=Nn,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,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/leafygreen-provider"),require("@leafygreen-ui/tokens"),require("@leafygreen-ui/ripple"),require("@leafygreen-ui/lib"),require("@leafygreen-ui/palette"),require("polished")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@leafygreen-ui/box","@leafygreen-ui/emotion","@leafygreen-ui/leafygreen-provider","@leafygreen-ui/tokens","@leafygreen-ui/ripple","@leafygreen-ui/lib","@leafygreen-ui/palette","polished"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self)["@leafygreen-ui/button"]={},e.React,e.PropTypes,e["@leafygreen-ui/box"],e["@leafygreen-ui/emotion"],e["@leafygreen-ui/leafygreen-provider"],e["@leafygreen-ui/tokens"],e["@leafygreen-ui/ripple"],e["@leafygreen-ui/lib"],e["@leafygreen-ui/palette"],e.polished)}(this,(function(e,n,t,r,a,o,l,i,s,c,p){"use strict";function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=d(n),g=d(t),b=d(r);function f(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function h(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?f(Object(t),!0).forEach((function(n){y(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):f(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function y(e,n,t){return(n=function(e){var n=function(e,n){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==typeof n?n:String(n)}(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function x(){return x=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},x.apply(this,arguments)}function k(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)t=o[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function m(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}var v,w,O,D,z,P,j,S,B,G,T,q,N,M,E,F,L,C,I,R,X,W,H,_,U,V,Y,A,J,K,Q,Z,$,ee,ne,te,re,ae,oe,le,ie,se,ce,pe,de,ue,ge,be,fe,he,ye=s.createUniqueClassName("button"),xe={Default:"default",Primary:"primary",PrimaryOutline:"primaryOutline",Danger:"danger",DangerOutline:"dangerOutline",BaseGreen:"baseGreen"},ke={XSmall:"xsmall",Small:"small",Default:"default",Large:"large"},me=(y(E={},s.Theme.Light,(y(j={},xe.Default,a.css(v||(v=m(["\n color: ",";\n "])),c.palette.gray.base)),y(j,xe.Primary,a.css(w||(w=m(["\n color: ",";\n "])),c.palette.green.light2)),y(j,xe.PrimaryOutline,a.css(O||(O=m(["\n color: ",";\n "])),c.palette.green.dark2)),y(j,xe.Danger,a.css(D||(D=m(["\n color: ",";\n "])),c.palette.red.light3)),y(j,xe.DangerOutline,a.css(z||(z=m(["\n color: ",";\n "])),c.palette.red.light1)),y(j,xe.BaseGreen,a.css(P||(P=m(["\n color: ",";\n "])),c.palette.green.dark2)),j)),y(E,s.Theme.Dark,(y(M={},xe.Default,a.css(S||(S=m(["\n color: ",";\n "])),c.palette.gray.light2)),y(M,xe.Primary,a.css(B||(B=m(["\n color: ",";\n "])),c.palette.green.light2)),y(M,xe.PrimaryOutline,a.css(G||(G=m(["\n color: ",";\n "])),c.palette.green.base)),y(M,xe.Danger,a.css(T||(T=m(["\n color: ",";\n "])),c.palette.red.light2)),y(M,xe.DangerOutline,a.css(q||(q=m(["\n color: ",";\n "])),c.palette.red.light1)),y(M,xe.BaseGreen,a.css(N||(N=m(["\n color: ",";\n "])),c.palette.green.dark2)),M)),E),ve=(y(K={},s.Theme.Light,(y(W={},xe.Default,a.css(F||(F=m(["\n color: ",";\n "])),c.palette.black)),y(W,xe.Primary,a.css(L||(L=m(["\n color: ",";\n "])),c.palette.white)),y(W,xe.PrimaryOutline,a.css(C||(C=m(["\n color: ",";\n "])),c.palette.green.dark2)),y(W,xe.Danger,a.css(I||(I=m(["\n color: ",";\n "])),c.palette.white)),y(W,xe.DangerOutline,a.css(R||(R=m(["\n color: ",";\n "])),c.palette.red.base)),y(W,xe.BaseGreen,a.css(X||(X=m(["\n color: ",";\n "])),c.palette.green.dark3)),W)),y(K,s.Theme.Dark,(y(J={},xe.Default,a.css(H||(H=m(["\n color: ",";\n "])),c.palette.white)),y(J,xe.Primary,a.css(_||(_=m(["\n color: ",";\n "])),c.palette.white)),y(J,xe.PrimaryOutline,a.css(U||(U=m(["\n color: ",";\n "])),c.palette.green.base)),y(J,xe.Danger,a.css(V||(V=m(["\n color: ",";\n "])),c.palette.white)),y(J,xe.DangerOutline,a.css(Y||(Y=m(["\n color: ",";\n "])),c.palette.red.light1)),y(J,xe.BaseGreen,a.css(A||(A=m(["\n color: ",";\n "])),c.palette.green.dark3)),J)),K),we=a.css(Q||(Q=m(["\n ."," {\n &:hover,\n &:active {\n color: currentColor;\n }\n }\n"])),ye),Oe=(y(te={},ke.XSmall,a.css(Z||(Z=m(["\n height: 14px;\n width: 14px;\n "])))),y(te,ke.Small,a.css($||($=m(["\n height: 16px;\n width: 16px;\n "])))),y(te,ke.Default,a.css(ee||(ee=m(["\n height: 16px;\n width: 16px;\n "])))),y(te,ke.Large,a.css(ne||(ne=m(["\n height: 20px;\n width: 20px;\n "])))),te),De=(y(oe={},s.Theme.Light,a.css(re||(re=m(["\n color: ",";\n "])),c.palette.gray.light1)),y(oe,s.Theme.Dark,a.css(ae||(ae=m(["\n color: ",";\n "])),c.palette.gray.dark1)),oe),ze=a.css(le||(le=m(["\n color: ",";\n"])),c.palette.gray.dark2);function Pe(e){var n,t=e.glyph,r=e.variant,o=e.size,l=e.darkMode,i=e.disabled,c=e.isIconOnlyButton,p=e.className,d=!c&&{"aria-hidden":!0,role:"presentation"},g=s.getTheme(l),b=c?ve:me;return u.default.cloneElement(t,h({className:a.cx(b[g][r],Oe[o],(n={},y(n,we,c),y(n,De[g],i),y(n,ze,i&&c&&l),n),p)},d))}Pe.displayName="ButtonIcon";var je,Se,Be,Ge,Te,qe,Ne,Me,Ee,Fe,Le,Ce,Ie,Re,Xe,We,He,_e,Ue,Ve,Ye,Ae,Je,Ke,Qe,Ze,$e,en,nn,tn,rn,an,on,ln,sn,cn,pn,dn,un,gn,bn,fn,hn,yn,xn,kn=.76,mn=(y(ce={},s.Theme.Light,(y(ie={},xe.Default,c.palette.gray.light2),y(ie,xe.Primary,c.palette.green.dark1),y(ie,xe.PrimaryOutline,p.transparentize(kn,c.palette.green.base)),y(ie,xe.Danger,c.palette.red.light1),y(ie,xe.DangerOutline,p.transparentize(kn,c.palette.red.base)),y(ie,xe.BaseGreen,c.palette.green.light1),ie)),y(ce,s.Theme.Dark,(y(se={},xe.Default,c.palette.gray.base),y(se,xe.Primary,c.palette.green.dark1),y(se,xe.PrimaryOutline,p.transparentize(kn,c.palette.green.base)),y(se,xe.Danger,c.palette.red.dark2),y(se,xe.DangerOutline,p.transparentize(kn,c.palette.red.light1)),y(se,xe.BaseGreen,c.palette.green.dark1),se)),ce),vn=a.css(pe||(pe=m(["\n overflow: hidden;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border-radius: 5px;\n"]))),wn=a.css(de||(de=m(["\n display: grid;\n grid-auto-flow: column;\n justify-content: center;\n align-items: center;\n height: 100%;\n width: 100%;\n pointer-events: none;\n position: relative;\n z-index: 0;\n"]))),On=(y(he={},ke.XSmall,a.css(ue||(ue=m(["\n padding: 0 7px; // 8px - 1px border\n gap: 6px;\n "])))),y(he,ke.Small,a.css(ge||(ge=m(["\n padding: 0 11px; // 12px - 1px border\n gap: 6px;\n "])))),y(he,ke.Default,a.css(be||(be=m(["\n padding: 0 11px; // 12px - 1px border\n gap: 6px;\n "])))),y(he,ke.Large,a.css(fe||(fe=m(["\n padding: 0 15px; // 16px - 1px border\n gap: 8px;\n "])))),he),Dn=function(e){var t,r=e.rightGlyph,l=e.leftGlyph,s=e.darkMode,c=e.disabled,p=void 0!==c&&c,d=e.variant,g=void 0===d?xe.Default:d,b=e.size,f=void 0===b?ke.Default:b,h=e.children,k=o.useDarkMode(s),v=k.darkMode,w=k.theme,O=n.useRef(null);n.useEffect((function(){var e,n=mn[w][g];return null==O.current||p||(e=i.registerRipple(O.current,{backgroundColor:n})),e}),[O,g,v,p,w]);var D=null!==(t=(l||r)&&!h)&&void 0!==t&&t,z={variant:g,size:f,darkMode:v,disabled:p,isIconOnlyButton:D};return u.default.createElement(u.default.Fragment,null,u.default.createElement("div",{className:a.cx(vn),ref:O}),u.default.createElement("div",{className:a.cx(wn,On[f],y({},a.css(je||(je=m(["\n justify-content: space-between;\n "]))),!!r&&v))},l&&u.default.createElement(Pe,x({glyph:l,className:a.css(Se||(Se=m(["\n justify-self: right;\n "])))},z)),h,r&&u.default.createElement(Pe,x({glyph:r,className:a.css(Be||(Be=m(["\n justify-self: left;\n "])))},z))))},zn=function(e){return"\n 0 0 0 2px ".concat(e,", \n 0 0 0 4px ").concat(c.palette.blue.light1,";\n")},Pn=a.css(Ge||(Ge=m(["\n // unset browser default\n appearance: none;\n padding: 0;\n margin: 0;\n background-color: transparent;\n border: 1px solid transparent;\n display: inline-flex;\n align-items: stretch;\n transition: all ","ms ease-in-out;\n position: relative;\n text-decoration: none;\n cursor: pointer;\n z-index: 0;\n font-family: ",";\n border-radius: 6px;\n\n &:focus,\n &:focus-visible {\n outline: none;\n }\n\n &:active,\n &:focus,\n &:hover {\n text-decoration: none;\n }\n"])),l.transitionDuration.default,l.fontFamilies.default),jn=(y(Ue={},s.Theme.Light,(y(Le={},xe.Default,a.css(Te||(Te=m(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n // needed to override any global button styles\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n box-shadow: 0 0 0 3px ",";\n }\n "])),c.palette.gray.light3,c.palette.gray.base,c.palette.black,c.palette.black,c.palette.black,c.palette.white,c.palette.gray.light2)),y(Le,xe.Primary,a.css(qe||(qe=m(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: #00593f; // Not quite dark3\n border-color: #00593f; // Not quite dark3\n box-shadow: 0 0 0 3px ",";\n }\n "])),c.palette.green.dark2,c.palette.green.dark2,c.palette.white,c.palette.white,c.palette.white,c.palette.green.light2)),y(Le,xe.PrimaryOutline,a.css(Ne||(Ne=m(["\n background-color: transparent;\n border-color: ",";\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 "])),c.palette.green.dark2,c.palette.green.dark2,c.palette.green.dark2,c.palette.green.dark2,p.transparentize(.96,c.palette.green.base),c.palette.green.light2)),y(Le,xe.Danger,a.css(Me||(Me=m(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: #c82222; // not quite dark1\n border-color: #c82222; // not quite dark1\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),c.palette.red.base,c.palette.red.base,c.palette.white,c.palette.white,c.palette.white,c.palette.red.light3)),y(Le,xe.DangerOutline,a.css(Ee||(Ee=m(["\n background-color: transparent;\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),c.palette.red.light1,c.palette.red.base,c.palette.red.base,c.palette.red.dark2,p.transparentize(.96,c.palette.red.base),c.palette.red.base,c.palette.red.light3)),y(Le,xe.BaseGreen,a.css(Fe||(Fe=m(["\n background-color: ",";\n border-color: ",";\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 "])),c.palette.green.base,c.palette.green.dark2,c.palette.green.dark3,c.palette.green.dark3,c.palette.green.dark3,p.mix(.96,c.palette.green.base,c.palette.green.dark3),c.palette.green.light2)),Le)),y(Ue,s.Theme.Dark,(y(_e={},xe.Default,a.css(Ce||(Ce=m(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n background-color: ",";\n border-color: ",";\n color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),c.palette.gray.dark2,c.palette.gray.base,c.palette.white,c.palette.white,c.palette.gray.dark1,c.palette.gray.base,c.palette.white,c.palette.gray.dark2)),y(_e,xe.Primary,a.css(Ie||(Ie=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: #00593f; // Off palette\n box-shadow: 0 0 0 3px ",";\n }\n "])),c.palette.green.dark2,c.palette.green.base,c.palette.white,c.palette.white,c.palette.white,c.palette.green.dark3)),y(_e,xe.PrimaryOutline,a.css(Re||(Re=m(["\n background-color: transparent;\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),c.palette.green.base,c.palette.green.base,c.palette.green.base,c.palette.green.base,p.transparentize(.96,c.palette.green.base),c.palette.green.base,c.palette.green.dark3)),y(_e,xe.Danger,a.css(Xe||(Xe=m(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n border-color: ",";\n color: ",";\n background-color: #c82222; // Off palette\n box-shadow: 0px 0px 0px 3px ","; // yes, yellow\n }\n "])),c.palette.red.base,c.palette.red.light1,c.palette.white,c.palette.white,c.palette.red.light1,c.palette.white,c.palette.yellow.dark3)),y(_e,xe.DangerOutline,a.css(We||(We=m(["\n border-color: ",";\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 ","; // yes, yellow\n }\n "])),c.palette.red.light1,c.palette.red.light1,c.palette.red.light1,c.palette.red.light1,p.transparentize(.96,c.palette.red.base),c.palette.yellow.dark3)),y(_e,xe.BaseGreen,a.css(He||(He=m(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),c.palette.green.base,c.palette.green.dark2,c.palette.green.dark3,c.palette.green.dark3,c.palette.green.dark3,p.mix(.96,c.palette.green.base,c.palette.green.light3),c.palette.green.dark2,c.palette.green.dark3)),_e)),Ue),Sn=(y(ln={},s.Theme.Light,(y(Ze={},xe.Default,a.css(Ve||(Ve=m(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),c.palette.white,zn(c.palette.white))),y(Ze,xe.Primary,a.css(Ye||(Ye=m(["\n &:focus-visible {\n color: ",";\n background-color: #00593f; // Not quite dark3\n box-shadow: ",";\n }\n "])),c.palette.white,zn(c.palette.white))),y(Ze,xe.PrimaryOutline,a.css(Ae||(Ae=m(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),p.transparentize(.96,c.palette.green.base),zn(c.palette.white))),y(Ze,xe.Danger,a.css(Je||(Je=m(["\n &:focus-visible {\n color: ",";\n background-color: #c82222; // not quite dark1\n box-shadow: ",";\n }\n "])),c.palette.white,zn(c.palette.white))),y(Ze,xe.DangerOutline,a.css(Ke||(Ke=m(["\n &:focus-visible {\n color: ",";\n box-shadow: ",";\n }\n "])),c.palette.red.dark2,zn(c.palette.white))),y(Ze,xe.BaseGreen,a.css(Qe||(Qe=m(["\n &:focus-visible {\n box-shadow: ",";\n }\n "])),zn(c.palette.white))),Ze)),y(ln,s.Theme.Dark,(y(on={},xe.Default,a.css($e||($e=m(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),c.palette.gray.dark1,zn(c.palette.black))),y(on,xe.Primary,a.css(en||(en=m(["\n &:focus-visible {\n background-color: #00593f; // Off palette\n box-shadow: ",";\n }\n "])),zn(c.palette.black))),y(on,xe.PrimaryOutline,a.css(nn||(nn=m(["\n &:focus-visible {\n background-color: ",";\n border-color: ",";\n box-shadow: ",";\n }\n "])),p.transparentize(.96,c.palette.green.base),c.palette.green.base,zn(c.palette.black))),y(on,xe.Danger,a.css(tn||(tn=m(["\n &:focus-visible {\n background-color: #c82222; // Off palette\n box-shadow: ",";\n }\n "])),zn(c.palette.black))),y(on,xe.DangerOutline,a.css(rn||(rn=m(["\n &:focus-visible {\n background-color: ",";\n border-color: ",";\n box-shadow: ",";\n }\n "])),p.transparentize(.96,c.palette.red.base),c.palette.red.light1,zn(c.palette.black))),y(on,xe.BaseGreen,a.css(an||(an=m(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),c.palette.green.base,zn(c.palette.black))),on)),ln),Bn=(y(pn={},s.Theme.Light,a.css(sn||(sn=m(["\n &,\n &:hover {\n background-color: ",";\n border-color: ",";\n color: ",";\n cursor: not-allowed;\n }\n\n &:focus {\n color: ",";\n box-shadow: ",";\n }\n "])),c.palette.gray.light2,c.palette.gray.light1,c.palette.gray.base,c.palette.gray.base,zn(c.palette.white))),y(pn,s.Theme.Dark,a.css(cn||(cn=m(["\n &,\n &:hover {\n background-color: ",";\n border-color: ",";\n color: ",";\n cursor: not-allowed;\n }\n\n &:focus {\n color: ",";\n box-shadow: ",";\n }\n "])),c.palette.gray.dark3,c.palette.gray.dark1,c.palette.gray.dark1,c.palette.gray.dark1,zn(c.palette.black))),pn),Gn=(y(fn={},ke.XSmall,a.css(dn||(dn=m(["\n height: 22px;\n text-transform: uppercase;\n font-size: 12px;\n line-height: 1em;\n font-weight: ",";\n letter-spacing: 0.4px;\n "])),l.fontWeights.bold)),y(fn,ke.Small,a.css(un||(un=m(["\n height: 28px;\n "])))),y(fn,ke.Default,a.css(gn||(gn=m(["\n height: 36px;\n "])))),y(fn,ke.Large,a.css(bn||(bn=m(["\n height: 48px;\n font-size: 18px;\n line-height: 24px;\n "])))),fn),Tn=(y(xn={},l.BaseFontSize.Body1,a.css(hn||(hn=m(["\n font-size: ","px;\n line-height: ","px;\n font-weight: ",";\n "])),l.typeScales.body1.fontSize,l.typeScales.body1.lineHeight,l.fontWeights.medium)),y(xn,l.BaseFontSize.Body2,a.css(yn||(yn=m(["\n font-size: ","px;\n line-height: ","px;\n // Pixel pushing for optical alignment purposes\n transform: translateY(1px);\n font-weight: ",";\n "])),l.typeScales.body2.fontSize,l.typeScales.body2.lineHeight,l.fontWeights.medium)),xn);var qn=["variant","size","darkMode","baseFontSize","disabled","onClick","leftGlyph","rightGlyph","children","className","as","type"],Nn=u.default.forwardRef((function(e,n){var t=e.variant,r=void 0===t?xe.Default:t,i=e.size,c=void 0===i?ke.Default:i,p=e.darkMode,d=e.baseFontSize,g=void 0===d?l.BaseFontSize.Body1:d,f=e.disabled,x=void 0!==f&&f,m=e.onClick,v=e.leftGlyph,w=e.rightGlyph,O=e.children,D=e.className,z=e.as,P=e.type,j=k(e,qn),S=o.useDarkMode(p).darkMode,B=function(e){var n=e.variant,t=e.size,r=e.darkMode,o=e.baseFontSize,l=e.disabled,i=s.getTheme(r),c=jn[i][n],p=Sn[i][n],d=Gn[t],u=Tn[o];return a.cx(Pn,c,u,d,y({},p,!l),y({},Bn[i],l))}({variant:r,size:c,darkMode:S,baseFontSize:g,disabled:x}),G=!(!j.href&&"a"!==z||x),T=h({type:G?void 0:P||"button",className:a.cx(ye,B,D),ref:n,as:z||(G?"a":"button"),"aria-disabled":x,onClick:x?void 0:m,href:x?void 0:j.href},j),q={rightGlyph:w,leftGlyph:v,darkMode:S,disabled:x,variant:r,size:c};return u.default.createElement(b.default,T,u.default.createElement(Dn,q,O))}));Nn.displayName="Button",Nn.propTypes={variant:g.default.oneOf(Object.values(xe)),baseFontSize:g.default.oneOf(Object.values(l.BaseFontSize)),size:g.default.oneOf(Object.values(ke)),darkMode:g.default.bool,disabled:g.default.bool,leftGlyph:g.default.element,rightGlyph:g.default.element,href:g.default.string},e.FontSize={Body1:13,Body2:16},e.Size=ke,e.Variant=xe,e.default=Nn,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@leafygreen-ui/button", | ||
"version": "20.0.7", | ||
"version": "20.0.8-next.0", | ||
"description": "leafyGreen UI Kit Button", | ||
@@ -23,5 +23,5 @@ "main": "./dist/index.js", | ||
"dependencies": { | ||
"@leafygreen-ui/box": "^3.1.3", | ||
"@leafygreen-ui/box": "^3.1.4-next.0", | ||
"@leafygreen-ui/emotion": "^4.0.4", | ||
"@leafygreen-ui/lib": "^10.3.3", | ||
"@leafygreen-ui/lib": "^10.3.4-next.0", | ||
"@leafygreen-ui/palette": "^4.0.4", | ||
@@ -34,6 +34,6 @@ "@leafygreen-ui/ripple": "^1.1.9", | ||
"next": "^13.0.5", | ||
"@leafygreen-ui/icon": "^11.14.0" | ||
"@leafygreen-ui/icon": "^11.16.1-next.0" | ||
}, | ||
"peerDependencies": { | ||
"@leafygreen-ui/leafygreen-provider": "^3.1.2" | ||
"@leafygreen-ui/leafygreen-provider": "^3.1.3-next.0" | ||
}, | ||
@@ -40,0 +40,0 @@ "gitHead": "dd71a2d404218ccec2e657df9c0263dc1c15b9e0", |
@@ -1,1 +0,1 @@ | ||
import n,{useRef as e,useEffect as r}from"react";import o,{glyphs as a}from"@leafygreen-ui/icon";import t,{useDarkMode as l}from"@leafygreen-ui/leafygreen-provider";import{createUniqueClassName as i,Theme as c,getTheme as d,StoryMeta as s}from"@leafygreen-ui/lib";import g from"prop-types";import b from"@leafygreen-ui/box";import{css as u,cx as p}from"@leafygreen-ui/emotion";import{transitionDuration as h,fontFamilies as f,fontWeights as y,typeScales as k,BaseFontSize as x}from"@leafygreen-ui/tokens";import{registerRipple as m}from"@leafygreen-ui/ripple";import{palette as v}from"@leafygreen-ui/palette";import{transparentize as w,mix as O}from"polished";function D(n,e){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.push.apply(r,o)}return r}function P(n){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?D(Object(r),!0).forEach((function(e){j(n,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):D(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))}))}return n}function j(n,e,r){return e in n?Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[e]=r,n}function G(){return G=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])}return n},G.apply(this,arguments)}function z(n,e){if(null==n)return{};var r,o,a=function(n,e){if(null==n)return{};var r,o,a={},t=Object.keys(n);for(o=0;o<t.length;o++)r=t[o],e.indexOf(r)>=0||(a[r]=n[r]);return a}(n,e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);for(o=0;o<t.length;o++)r=t[o],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(n,r)&&(a[r]=n[r])}return a}function B(n,e){return e||(e=n.slice(0)),Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(e)}}))}var S,E,N,M,L,C,q,F,I,X,T,H,V,R,Y,A,J,K,Q,U,W,Z,$,_,nn,en,rn,on,an,tn,ln,cn,dn,sn,gn,bn,un,pn,hn,fn,yn,kn,xn,mn,vn,wn,On,Dn,Pn,jn,Gn={Default:"default",Primary:"primary",PrimaryOutline:"primaryOutline",Danger:"danger",DangerOutline:"dangerOutline",BaseGreen:"baseGreen"},zn={XSmall:"xsmall",Small:"small",Default:"default",Large:"large"},Bn=i("button"),Sn=(j(Y={},c.Light,(j(q={},Gn.Default,u(S||(S=B(["\n color: ",";\n "])),v.gray.base)),j(q,Gn.Primary,u(E||(E=B(["\n color: ",";\n "])),v.green.light2)),j(q,Gn.PrimaryOutline,u(N||(N=B(["\n color: ",";\n "])),v.green.dark2)),j(q,Gn.Danger,u(M||(M=B(["\n color: ",";\n "])),v.red.light3)),j(q,Gn.DangerOutline,u(L||(L=B(["\n color: ",";\n "])),v.red.light1)),j(q,Gn.BaseGreen,u(C||(C=B(["\n color: ",";\n "])),v.green.dark2)),q)),j(Y,c.Dark,(j(R={},Gn.Default,u(F||(F=B(["\n color: ",";\n "])),v.gray.light2)),j(R,Gn.Primary,u(I||(I=B(["\n color: ",";\n "])),v.green.light2)),j(R,Gn.PrimaryOutline,u(X||(X=B(["\n color: ",";\n "])),v.green.base)),j(R,Gn.Danger,u(T||(T=B(["\n color: ",";\n "])),v.red.light2)),j(R,Gn.DangerOutline,u(H||(H=B(["\n color: ",";\n "])),v.red.light1)),j(R,Gn.BaseGreen,u(V||(V=B(["\n color: ",";\n "])),v.green.dark2)),R)),Y),En=(j(tn={},c.Light,(j(Z={},Gn.Default,u(A||(A=B(["\n color: ",";\n "])),v.black)),j(Z,Gn.Primary,u(J||(J=B(["\n color: ",";\n "])),v.white)),j(Z,Gn.PrimaryOutline,u(K||(K=B(["\n color: ",";\n "])),v.green.dark2)),j(Z,Gn.Danger,u(Q||(Q=B(["\n color: ",";\n "])),v.white)),j(Z,Gn.DangerOutline,u(U||(U=B(["\n color: ",";\n "])),v.red.base)),j(Z,Gn.BaseGreen,u(W||(W=B(["\n color: ",";\n "])),v.green.dark3)),Z)),j(tn,c.Dark,(j(an={},Gn.Default,u($||($=B(["\n color: ",";\n "])),v.white)),j(an,Gn.Primary,u(_||(_=B(["\n color: ",";\n "])),v.white)),j(an,Gn.PrimaryOutline,u(nn||(nn=B(["\n color: ",";\n "])),v.green.base)),j(an,Gn.Danger,u(en||(en=B(["\n color: ",";\n "])),v.white)),j(an,Gn.DangerOutline,u(rn||(rn=B(["\n color: ",";\n "])),v.red.light1)),j(an,Gn.BaseGreen,u(on||(on=B(["\n color: ",";\n "])),v.green.dark3)),an)),tn),Nn=u(ln||(ln=B(["\n ."," {\n &:hover,\n &:active {\n color: currentColor;\n }\n }\n"])),Bn),Mn=(j(bn={},zn.XSmall,u(cn||(cn=B(["\n height: 14px;\n width: 14px;\n "])))),j(bn,zn.Small,u(dn||(dn=B(["\n height: 16px;\n width: 16px;\n "])))),j(bn,zn.Default,u(sn||(sn=B(["\n height: 16px;\n width: 16px;\n "])))),j(bn,zn.Large,u(gn||(gn=B(["\n height: 20px;\n width: 20px;\n "])))),bn),Ln=(j(hn={},c.Light,u(un||(un=B(["\n color: ",";\n "])),v.gray.light1)),j(hn,c.Dark,u(pn||(pn=B(["\n color: ",";\n "])),v.gray.dark1)),hn),Cn=u(fn||(fn=B(["\n color: ",";\n"])),v.gray.dark2);function qn(e){var r,o=e.glyph,a=e.variant,t=e.size,l=e.darkMode,i=e.disabled,c=e.isIconOnlyButton,s=e.className,g=!c&&{"aria-hidden":!0,role:"presentation"},b=d(l),u=c?En:Sn;return n.cloneElement(o,P({className:p(u[b][a],Mn[t],(r={},j(r,Nn,c),j(r,Ln[b],i),j(r,Cn,i&&c&&l),r),s)},g))}qn.displayName="ButtonIcon";var Fn,In,Xn,Tn,Hn,Vn,Rn,Yn,An,Jn,Kn,Qn,Un,Wn,Zn,$n,_n,ne,ee,re,oe,ae,te,le,ie,ce,de,se,ge,be,ue,pe,he,fe,ye,ke,xe,me,ve,we,Oe,De,Pe,je,Ge,ze=(j(xn={},c.Light,(j(yn={},Gn.Default,v.gray.light2),j(yn,Gn.Primary,v.green.dark1),j(yn,Gn.PrimaryOutline,w(.76,v.green.base)),j(yn,Gn.Danger,v.red.light1),j(yn,Gn.DangerOutline,w(.76,v.red.base)),j(yn,Gn.BaseGreen,v.green.light1),yn)),j(xn,c.Dark,(j(kn={},Gn.Default,v.gray.base),j(kn,Gn.Primary,v.green.dark1),j(kn,Gn.PrimaryOutline,w(.76,v.green.base)),j(kn,Gn.Danger,v.red.dark2),j(kn,Gn.DangerOutline,w(.76,v.red.light1)),j(kn,Gn.BaseGreen,v.green.dark1),kn)),xn),Be=u(mn||(mn=B(["\n overflow: hidden;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border-radius: 5px;\n"]))),Se=u(vn||(vn=B(["\n display: grid;\n grid-auto-flow: column;\n justify-content: center;\n align-items: center;\n height: 100%;\n width: 100%;\n pointer-events: none;\n position: relative;\n z-index: 0;\n"]))),Ee=(j(jn={},zn.XSmall,u(wn||(wn=B(["\n padding: 0 7px; // 8px - 1px border\n gap: 6px;\n "])))),j(jn,zn.Small,u(On||(On=B(["\n padding: 0 11px; // 12px - 1px border\n gap: 6px;\n "])))),j(jn,zn.Default,u(Dn||(Dn=B(["\n padding: 0 11px; // 12px - 1px border\n gap: 6px;\n "])))),j(jn,zn.Large,u(Pn||(Pn=B(["\n padding: 0 15px; // 16px - 1px border\n gap: 8px;\n "])))),jn),Ne=function(o){var a,t=o.rightGlyph,i=o.leftGlyph,c=o.darkMode,d=o.disabled,s=void 0!==d&&d,g=o.variant,b=void 0===g?Gn.Default:g,h=o.size,f=void 0===h?zn.Default:h,y=o.children,k=l(c),x=k.darkMode,v=k.theme,w=e(null);r((function(){var n,e=ze[v][b];return null==w.current||s||(n=m(w.current,{backgroundColor:e})),n}),[w,b,x,s,v]);var O=null!==(a=(i||t)&&!y)&&void 0!==a&&a,D={variant:b,size:f,darkMode:x,disabled:s,isIconOnlyButton:O};return n.createElement(n.Fragment,null,n.createElement("div",{className:p(Be),ref:w}),n.createElement("div",{className:p(Se,Ee[f],j({},u(Fn||(Fn=B(["\n justify-content: space-between;\n "]))),!!t&&x))},i&&n.createElement(qn,G({glyph:i,className:u(In||(In=B(["\n justify-self: right;\n "])))},D)),y,t&&n.createElement(qn,G({glyph:t,className:u(Xn||(Xn=B(["\n justify-self: left;\n "])))},D))))},Me=function(n){return"\n 0 0 0 2px ".concat(n,", \n 0 0 0 4px ").concat(v.blue.light1,";\n")},Le=u(Tn||(Tn=B(["\n // unset browser default\n appearance: none;\n padding: 0;\n margin: 0;\n background-color: transparent;\n border: 1px solid transparent;\n display: inline-flex;\n align-items: stretch;\n transition: all ","ms ease-in-out;\n position: relative;\n text-decoration: none;\n cursor: pointer;\n z-index: 0;\n font-family: ",";\n border-radius: 6px;\n\n &:focus,\n &:focus-visible {\n outline: none;\n }\n\n &:active,\n &:focus,\n &:hover {\n text-decoration: none;\n }\n"])),h.default,f.default),Ce=(j(ee={},c.Light,(j(Kn={},Gn.Default,u(Hn||(Hn=B(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n // needed to override any global button styles\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n box-shadow: 0 0 0 3px ",";\n }\n "])),v.gray.light3,v.gray.base,v.black,v.black,v.black,v.white,v.gray.light2)),j(Kn,Gn.Primary,u(Vn||(Vn=B(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: #00593f; // Not quite dark3\n border-color: #00593f; // Not quite dark3\n box-shadow: 0 0 0 3px ",";\n }\n "])),v.green.dark2,v.green.dark2,v.white,v.white,v.white,v.green.light2)),j(Kn,Gn.PrimaryOutline,u(Rn||(Rn=B(["\n background-color: transparent;\n border-color: ",";\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 "])),v.green.dark2,v.green.dark2,v.green.dark2,v.green.dark2,w(.96,v.green.base),v.green.light2)),j(Kn,Gn.Danger,u(Yn||(Yn=B(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: #c82222; // not quite dark1\n border-color: #c82222; // not quite dark1\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),v.red.base,v.red.base,v.white,v.white,v.white,v.red.light3)),j(Kn,Gn.DangerOutline,u(An||(An=B(["\n background-color: transparent;\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),v.red.light1,v.red.base,v.red.base,v.red.dark2,w(.96,v.red.base),v.red.base,v.red.light3)),j(Kn,Gn.BaseGreen,u(Jn||(Jn=B(["\n background-color: ",";\n border-color: ",";\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 "])),v.green.base,v.green.dark2,v.green.dark3,v.green.dark3,v.green.dark3,O(.96,v.green.base,v.green.dark3),v.green.light2)),Kn)),j(ee,c.Dark,(j(ne={},Gn.Default,u(Qn||(Qn=B(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n background-color: ",";\n border-color: ",";\n color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),v.gray.dark2,v.gray.base,v.white,v.white,v.gray.dark1,v.gray.base,v.white,v.gray.dark2)),j(ne,Gn.Primary,u(Un||(Un=B(["\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: #00593f; // Off palette\n box-shadow: 0 0 0 3px ",";\n }\n "])),v.green.dark2,v.green.base,v.white,v.white,v.white,v.green.dark3)),j(ne,Gn.PrimaryOutline,u(Wn||(Wn=B(["\n background-color: transparent;\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),v.green.base,v.green.base,v.green.base,v.green.base,w(.96,v.green.base),v.green.base,v.green.dark3)),j(ne,Gn.Danger,u(Zn||(Zn=B(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n border-color: ",";\n color: ",";\n background-color: #c82222; // Off palette\n box-shadow: 0px 0px 0px 3px ","; // yes, yellow\n }\n "])),v.red.base,v.red.light1,v.white,v.white,v.red.light1,v.white,v.yellow.dark3)),j(ne,Gn.DangerOutline,u($n||($n=B(["\n border-color: ",";\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 ","; // yes, yellow\n }\n "])),v.red.light1,v.red.light1,v.red.light1,v.red.light1,w(.96,v.red.base),v.yellow.dark3)),j(ne,Gn.BaseGreen,u(_n||(_n=B(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),v.green.base,v.green.dark2,v.green.dark3,v.green.dark3,v.green.dark3,O(.96,v.green.base,v.green.light3),v.green.dark2,v.green.dark3)),ne)),ee),qe=(j(fe={},c.Light,(j(ce={},Gn.Default,u(re||(re=B(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),v.white,Me(v.white))),j(ce,Gn.Primary,u(oe||(oe=B(["\n &:focus-visible {\n color: ",";\n background-color: #00593f; // Not quite dark3\n box-shadow: ",";\n }\n "])),v.white,Me(v.white))),j(ce,Gn.PrimaryOutline,u(ae||(ae=B(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),w(.96,v.green.base),Me(v.white))),j(ce,Gn.Danger,u(te||(te=B(["\n &:focus-visible {\n color: ",";\n background-color: #c82222; // not quite dark1\n box-shadow: ",";\n }\n "])),v.white,Me(v.white))),j(ce,Gn.DangerOutline,u(le||(le=B(["\n &:focus-visible {\n color: ",";\n box-shadow: ",";\n }\n "])),v.red.dark2,Me(v.white))),j(ce,Gn.BaseGreen,u(ie||(ie=B(["\n &:focus-visible {\n box-shadow: ",";\n }\n "])),Me(v.white))),ce)),j(fe,c.Dark,(j(he={},Gn.Default,u(de||(de=B(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),v.gray.dark1,Me(v.black))),j(he,Gn.Primary,u(se||(se=B(["\n &:focus-visible {\n background-color: #00593f; // Off palette\n box-shadow: ",";\n }\n "])),Me(v.black))),j(he,Gn.PrimaryOutline,u(ge||(ge=B(["\n &:focus-visible {\n background-color: ",";\n border-color: ",";\n box-shadow: ",";\n }\n "])),w(.96,v.green.base),v.green.base,Me(v.black))),j(he,Gn.Danger,u(be||(be=B(["\n &:focus-visible {\n background-color: #c82222; // Off palette\n box-shadow: ",";\n }\n "])),Me(v.black))),j(he,Gn.DangerOutline,u(ue||(ue=B(["\n &:focus-visible {\n background-color: ",";\n border-color: ",";\n box-shadow: ",";\n }\n "])),w(.96,v.red.base),v.red.light1,Me(v.black))),j(he,Gn.BaseGreen,u(pe||(pe=B(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),v.green.base,Me(v.black))),he)),fe),Fe=(j(xe={},c.Light,u(ye||(ye=B(["\n &,\n &:hover {\n background-color: ",";\n border-color: ",";\n color: ",";\n cursor: not-allowed;\n }\n\n &:focus {\n color: ",";\n box-shadow: ",";\n }\n "])),v.gray.light2,v.gray.light1,v.gray.base,v.gray.base,Me(v.white))),j(xe,c.Dark,u(ke||(ke=B(["\n &,\n &:hover {\n background-color: ",";\n border-color: ",";\n color: ",";\n cursor: not-allowed;\n }\n\n &:focus {\n color: ",";\n box-shadow: ",";\n }\n "])),v.gray.dark3,v.gray.dark1,v.gray.dark1,v.gray.dark1,Me(v.black))),xe),Ie=(j(De={},zn.XSmall,u(me||(me=B(["\n height: 22px;\n text-transform: uppercase;\n font-size: 12px;\n line-height: 1em;\n font-weight: ",";\n letter-spacing: 0.4px;\n "])),y.bold)),j(De,zn.Small,u(ve||(ve=B(["\n height: 28px;\n "])))),j(De,zn.Default,u(we||(we=B(["\n height: 36px;\n "])))),j(De,zn.Large,u(Oe||(Oe=B(["\n height: 48px;\n font-size: 18px;\n line-height: 24px;\n "])))),De),Xe=(j(Ge={},x.Body1,u(Pe||(Pe=B(["\n font-size: ","px;\n line-height: ","px;\n font-weight: ",";\n "])),k.body1.fontSize,k.body1.lineHeight,y.medium)),j(Ge,x.Body2,u(je||(je=B(["\n font-size: ","px;\n line-height: ","px;\n // Pixel pushing for optical alignment purposes\n transform: translateY(1px);\n font-weight: ",";\n "])),k.body2.fontSize,k.body2.lineHeight,y.medium)),Ge);var Te=["variant","size","darkMode","baseFontSize","disabled","onClick","leftGlyph","rightGlyph","children","className","as","type"],He=n.forwardRef((function(e,r){var o=e.variant,a=void 0===o?Gn.Default:o,t=e.size,i=void 0===t?zn.Default:t,c=e.darkMode,s=e.baseFontSize,g=void 0===s?x.Body1:s,u=e.disabled,h=void 0!==u&&u,f=e.onClick,y=e.leftGlyph,k=e.rightGlyph,m=e.children,v=e.className,w=e.as,O=e.type,D=z(e,Te),G=l(c).darkMode,B=function(n){var e=n.variant,r=n.size,o=n.darkMode,a=n.baseFontSize,t=n.disabled,l=d(o),i=Ce[l][e],c=qe[l][e];return p(Le,i,Xe[a],Ie[r],j({},c,!t),j({},Fe[l],t))}({variant:a,size:i,darkMode:G,baseFontSize:g,disabled:h}),S=!(!D.href&&"a"!==w||h),E=P({type:S?void 0:O||"button",className:p(Bn,B,v),ref:r,as:w||(S?"a":"button"),"aria-disabled":h,onClick:h?void 0:f,href:h?void 0:D.href},D),N={rightGlyph:k,leftGlyph:y,darkMode:G,disabled:h,variant:a,size:i};return n.createElement(b,E,n.createElement(Ne,N,m))}));He.displayName="Button",He.propTypes={variant:g.oneOf(Object.values(Gn)),baseFontSize:g.oneOf(Object.values(x)),size:g.oneOf(Object.values(zn)),darkMode:g.bool,disabled:g.bool,leftGlyph:g.element,rightGlyph:g.element,href:g.string};var Ve=["leftGlyph","rightGlyph"],Re=s({title:"Components/Button",component:He,excludeStories:["StoryButton"],args:{children:"MongoDB",variant:Gn.Default},parameters:{default:"Default",controls:{exclude:["ref","onClick","className"]}},argTypes:{disabled:{control:{type:"boolean"}},leftGlyph:{options:Object.keys(a),control:{type:"select"}},rightGlyph:{options:Object.keys(a),control:{type:"select"}},type:{control:"select",options:["button","submit"],defaultValue:"button"},size:{control:"select",options:Object.values(zn),defaultValue:zn.Default},href:{control:"text"}}}),Ye=function(e){var r=e.leftGlyph,a=e.rightGlyph,t=z(e,Ve);return n.createElement(He,G({leftGlyph:r?n.createElement(o,{glyph:r}):void 0,rightGlyph:a?n.createElement(o,{glyph:a}):void 0},t))},Ae=Ye.bind({});Ae.args={variant:Gn.Default};var Je=Ye.bind({});Je.args={variant:Gn.Primary};var Ke=Ye.bind({});Ke.args={variant:Gn.PrimaryOutline};var Qe=Ye.bind({});Qe.args={variant:Gn.Danger};var Ue=Ye.bind({});Ue.args={variant:Gn.DangerOutline};var We=Ye.bind({});We.args={variant:Gn.BaseGreen};var Ze=function(e){return n.createElement(t,{darkMode:!0},n.createElement(He,e,"Test"))};export{We as BaseGreen,Qe as Danger,Ue as DangerOutline,Ae as Default,Je as Primary,Ke as PrimaryOutline,Ze as WithGlobalDarkMode,Re as default}; | ||
import n,{useRef as e,useEffect as r}from"react";import o,{glyphs as a}from"@leafygreen-ui/icon";import t from"prop-types";import l from"@leafygreen-ui/box";import{css as i,cx as c}from"@leafygreen-ui/emotion";import{useDarkMode as d}from"@leafygreen-ui/leafygreen-provider";import{transitionDuration as s,fontFamilies as g,fontWeights as u,typeScales as b,BaseFontSize as p}from"@leafygreen-ui/tokens";import{registerRipple as h}from"@leafygreen-ui/ripple";import{createUniqueClassName as f,Theme as y,getTheme as k}from"@leafygreen-ui/lib";import{palette as x}from"@leafygreen-ui/palette";import{transparentize as m,mix as v}from"polished";function w(n,e){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.push.apply(r,o)}return r}function O(n){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?w(Object(r),!0).forEach((function(e){D(n,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))}))}return n}function D(n,e,r){return(e=function(n){var e=function(n,e){if("object"!=typeof n||null===n)return n;var r=n[Symbol.toPrimitive];if(void 0!==r){var o=r.call(n,e||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(n)}(n,"string");return"symbol"==typeof e?e:String(e)}(e))in n?Object.defineProperty(n,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[e]=r,n}function P(){return P=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o])}return n},P.apply(this,arguments)}function j(n,e){if(null==n)return{};var r,o,a=function(n,e){if(null==n)return{};var r,o,a={},t=Object.keys(n);for(o=0;o<t.length;o++)r=t[o],e.indexOf(r)>=0||(a[r]=n[r]);return a}(n,e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);for(o=0;o<t.length;o++)r=t[o],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(n,r)&&(a[r]=n[r])}return a}function G(n,e){return e||(e=n.slice(0)),Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(e)}}))}var z,S,B,N,E,M,L,C,q,F,I,X,T,H,V,R,Y,A,J,K,Q,U,W,Z,$,_,nn,en,rn,on,an,tn,ln,cn,dn,sn,gn,un,bn,pn,hn,fn,yn,kn,xn,mn,vn,wn,On,Dn,Pn={Default:"default",Primary:"primary",PrimaryOutline:"primaryOutline",Danger:"danger",DangerOutline:"dangerOutline",BaseGreen:"baseGreen"},jn={XSmall:"xsmall",Small:"small",Default:"default",Large:"large"},Gn=f("button"),zn=(D(V={},y.Light,(D(L={},Pn.Default,i(z||(z=G(["\n color: ",";\n "])),x.gray.base)),D(L,Pn.Primary,i(S||(S=G(["\n color: ",";\n "])),x.green.light2)),D(L,Pn.PrimaryOutline,i(B||(B=G(["\n color: ",";\n "])),x.green.dark2)),D(L,Pn.Danger,i(N||(N=G(["\n color: ",";\n "])),x.red.light3)),D(L,Pn.DangerOutline,i(E||(E=G(["\n color: ",";\n "])),x.red.light1)),D(L,Pn.BaseGreen,i(M||(M=G(["\n color: ",";\n "])),x.green.dark2)),L)),D(V,y.Dark,(D(H={},Pn.Default,i(C||(C=G(["\n color: ",";\n "])),x.gray.light2)),D(H,Pn.Primary,i(q||(q=G(["\n color: ",";\n "])),x.green.light2)),D(H,Pn.PrimaryOutline,i(F||(F=G(["\n color: ",";\n "])),x.green.base)),D(H,Pn.Danger,i(I||(I=G(["\n color: ",";\n "])),x.red.light2)),D(H,Pn.DangerOutline,i(X||(X=G(["\n color: ",";\n "])),x.red.light1)),D(H,Pn.BaseGreen,i(T||(T=G(["\n color: ",";\n "])),x.green.dark2)),H)),V),Sn=(D(on={},y.Light,(D(U={},Pn.Default,i(R||(R=G(["\n color: ",";\n "])),x.black)),D(U,Pn.Primary,i(Y||(Y=G(["\n color: ",";\n "])),x.white)),D(U,Pn.PrimaryOutline,i(A||(A=G(["\n color: ",";\n "])),x.green.dark2)),D(U,Pn.Danger,i(J||(J=G(["\n color: ",";\n "])),x.white)),D(U,Pn.DangerOutline,i(K||(K=G(["\n color: ",";\n "])),x.red.base)),D(U,Pn.BaseGreen,i(Q||(Q=G(["\n color: ",";\n "])),x.green.dark3)),U)),D(on,y.Dark,(D(rn={},Pn.Default,i(W||(W=G(["\n color: ",";\n "])),x.white)),D(rn,Pn.Primary,i(Z||(Z=G(["\n color: ",";\n "])),x.white)),D(rn,Pn.PrimaryOutline,i($||($=G(["\n color: ",";\n "])),x.green.base)),D(rn,Pn.Danger,i(_||(_=G(["\n color: ",";\n "])),x.white)),D(rn,Pn.DangerOutline,i(nn||(nn=G(["\n color: ",";\n "])),x.red.light1)),D(rn,Pn.BaseGreen,i(en||(en=G(["\n color: ",";\n "])),x.green.dark3)),rn)),on),Bn=i(an||(an=G(["\n ."," {\n &:hover,\n &:active {\n color: currentColor;\n }\n }\n"])),Gn),Nn=(D(sn={},jn.XSmall,i(tn||(tn=G(["\n height: 14px;\n width: 14px;\n "])))),D(sn,jn.Small,i(ln||(ln=G(["\n height: 16px;\n width: 16px;\n "])))),D(sn,jn.Default,i(cn||(cn=G(["\n height: 16px;\n width: 16px;\n "])))),D(sn,jn.Large,i(dn||(dn=G(["\n height: 20px;\n width: 20px;\n "])))),sn),En=(D(bn={},y.Light,i(gn||(gn=G(["\n color: ",";\n "])),x.gray.light1)),D(bn,y.Dark,i(un||(un=G(["\n color: ",";\n "])),x.gray.dark1)),bn),Mn=i(pn||(pn=G(["\n color: ",";\n"])),x.gray.dark2);function Ln(e){var r,o=e.glyph,a=e.variant,t=e.size,l=e.darkMode,i=e.disabled,d=e.isIconOnlyButton,s=e.className,g=!d&&{"aria-hidden":!0,role:"presentation"},u=k(l),b=d?Sn:zn;return n.cloneElement(o,O({className:c(b[u][a],Nn[t],(r={},D(r,Bn,d),D(r,En[u],i),D(r,Mn,i&&d&&l),r),s)},g))}Ln.displayName="ButtonIcon";var Cn,qn,Fn,In,Xn,Tn,Hn,Vn,Rn,Yn,An,Jn,Kn,Qn,Un,Wn,Zn,$n,_n,ne,ee,re,oe,ae,te,le,ie,ce,de,se,ge,ue,be,pe,he,fe,ye,ke,xe,me,ve,we,Oe,De,Pe,je=(D(yn={},y.Light,(D(hn={},Pn.Default,x.gray.light2),D(hn,Pn.Primary,x.green.dark1),D(hn,Pn.PrimaryOutline,m(.76,x.green.base)),D(hn,Pn.Danger,x.red.light1),D(hn,Pn.DangerOutline,m(.76,x.red.base)),D(hn,Pn.BaseGreen,x.green.light1),hn)),D(yn,y.Dark,(D(fn={},Pn.Default,x.gray.base),D(fn,Pn.Primary,x.green.dark1),D(fn,Pn.PrimaryOutline,m(.76,x.green.base)),D(fn,Pn.Danger,x.red.dark2),D(fn,Pn.DangerOutline,m(.76,x.red.light1)),D(fn,Pn.BaseGreen,x.green.dark1),fn)),yn),Ge=i(kn||(kn=G(["\n overflow: hidden;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border-radius: 5px;\n"]))),ze=i(xn||(xn=G(["\n display: grid;\n grid-auto-flow: column;\n justify-content: center;\n align-items: center;\n height: 100%;\n width: 100%;\n pointer-events: none;\n position: relative;\n z-index: 0;\n"]))),Se=(D(Dn={},jn.XSmall,i(mn||(mn=G(["\n padding: 0 7px; // 8px - 1px border\n gap: 6px;\n "])))),D(Dn,jn.Small,i(vn||(vn=G(["\n padding: 0 11px; // 12px - 1px border\n gap: 6px;\n "])))),D(Dn,jn.Default,i(wn||(wn=G(["\n padding: 0 11px; // 12px - 1px border\n gap: 6px;\n "])))),D(Dn,jn.Large,i(On||(On=G(["\n padding: 0 15px; // 16px - 1px border\n gap: 8px;\n "])))),Dn),Be=function(o){var a,t=o.rightGlyph,l=o.leftGlyph,s=o.darkMode,g=o.disabled,u=void 0!==g&&g,b=o.variant,p=void 0===b?Pn.Default:b,f=o.size,y=void 0===f?jn.Default:f,k=o.children,x=d(s),m=x.darkMode,v=x.theme,w=e(null);r((function(){var n,e=je[v][p];return null==w.current||u||(n=h(w.current,{backgroundColor:e})),n}),[w,p,m,u,v]);var O=null!==(a=(l||t)&&!k)&&void 0!==a&&a,j={variant:p,size:y,darkMode:m,disabled:u,isIconOnlyButton:O};return n.createElement(n.Fragment,null,n.createElement("div",{className:c(Ge),ref:w}),n.createElement("div",{className:c(ze,Se[y],D({},i(Cn||(Cn=G(["\n justify-content: space-between;\n "]))),!!t&&m))},l&&n.createElement(Ln,P({glyph:l,className:i(qn||(qn=G(["\n justify-self: right;\n "])))},j)),k,t&&n.createElement(Ln,P({glyph:t,className:i(Fn||(Fn=G(["\n justify-self: left;\n "])))},j))))},Ne=function(n){return"\n 0 0 0 2px ".concat(n,", \n 0 0 0 4px ").concat(x.blue.light1,";\n")},Ee=i(In||(In=G(["\n // unset browser default\n appearance: none;\n padding: 0;\n margin: 0;\n background-color: transparent;\n border: 1px solid transparent;\n display: inline-flex;\n align-items: stretch;\n transition: all ","ms ease-in-out;\n position: relative;\n text-decoration: none;\n cursor: pointer;\n z-index: 0;\n font-family: ",";\n border-radius: 6px;\n\n &:focus,\n &:focus-visible {\n outline: none;\n }\n\n &:active,\n &:focus,\n &:hover {\n text-decoration: none;\n }\n"])),s.default,g.default),Me=(D(_n={},y.Light,(D(An={},Pn.Default,i(Xn||(Xn=G(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n // needed to override any global button styles\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n box-shadow: 0 0 0 3px ",";\n }\n "])),x.gray.light3,x.gray.base,x.black,x.black,x.black,x.white,x.gray.light2)),D(An,Pn.Primary,i(Tn||(Tn=G(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: #00593f; // Not quite dark3\n border-color: #00593f; // Not quite dark3\n box-shadow: 0 0 0 3px ",";\n }\n "])),x.green.dark2,x.green.dark2,x.white,x.white,x.white,x.green.light2)),D(An,Pn.PrimaryOutline,i(Hn||(Hn=G(["\n background-color: transparent;\n border-color: ",";\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 "])),x.green.dark2,x.green.dark2,x.green.dark2,x.green.dark2,m(.96,x.green.base),x.green.light2)),D(An,Pn.Danger,i(Vn||(Vn=G(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: #c82222; // not quite dark1\n border-color: #c82222; // not quite dark1\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),x.red.base,x.red.base,x.white,x.white,x.white,x.red.light3)),D(An,Pn.DangerOutline,i(Rn||(Rn=G(["\n background-color: transparent;\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),x.red.light1,x.red.base,x.red.base,x.red.dark2,m(.96,x.red.base),x.red.base,x.red.light3)),D(An,Pn.BaseGreen,i(Yn||(Yn=G(["\n background-color: ",";\n border-color: ",";\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 "])),x.green.base,x.green.dark2,x.green.dark3,x.green.dark3,x.green.dark3,v(.96,x.green.base,x.green.dark3),x.green.light2)),An)),D(_n,y.Dark,(D($n={},Pn.Default,i(Jn||(Jn=G(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n background-color: ",";\n border-color: ",";\n color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),x.gray.dark2,x.gray.base,x.white,x.white,x.gray.dark1,x.gray.base,x.white,x.gray.dark2)),D($n,Pn.Primary,i(Kn||(Kn=G(["\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: #00593f; // Off palette\n box-shadow: 0 0 0 3px ",";\n }\n "])),x.green.dark2,x.green.base,x.white,x.white,x.white,x.green.dark3)),D($n,Pn.PrimaryOutline,i(Qn||(Qn=G(["\n background-color: transparent;\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),x.green.base,x.green.base,x.green.base,x.green.base,m(.96,x.green.base),x.green.base,x.green.dark3)),D($n,Pn.Danger,i(Un||(Un=G(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n border-color: ",";\n color: ",";\n background-color: #c82222; // Off palette\n box-shadow: 0px 0px 0px 3px ","; // yes, yellow\n }\n "])),x.red.base,x.red.light1,x.white,x.white,x.red.light1,x.white,x.yellow.dark3)),D($n,Pn.DangerOutline,i(Wn||(Wn=G(["\n border-color: ",";\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 ","; // yes, yellow\n }\n "])),x.red.light1,x.red.light1,x.red.light1,x.red.light1,m(.96,x.red.base),x.yellow.dark3)),D($n,Pn.BaseGreen,i(Zn||(Zn=G(["\n background-color: ",";\n border-color: ",";\n color: ",";\n\n &:focus {\n color: ",";\n }\n\n &:hover,\n &:active {\n color: ",";\n background-color: ",";\n border-color: ",";\n box-shadow: 0px 0px 0px 3px ",";\n }\n "])),x.green.base,x.green.dark2,x.green.dark3,x.green.dark3,x.green.dark3,v(.96,x.green.base,x.green.light3),x.green.dark2,x.green.dark3)),$n)),_n),Le=(D(pe={},y.Light,(D(le={},Pn.Default,i(ne||(ne=G(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),x.white,Ne(x.white))),D(le,Pn.Primary,i(ee||(ee=G(["\n &:focus-visible {\n color: ",";\n background-color: #00593f; // Not quite dark3\n box-shadow: ",";\n }\n "])),x.white,Ne(x.white))),D(le,Pn.PrimaryOutline,i(re||(re=G(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),m(.96,x.green.base),Ne(x.white))),D(le,Pn.Danger,i(oe||(oe=G(["\n &:focus-visible {\n color: ",";\n background-color: #c82222; // not quite dark1\n box-shadow: ",";\n }\n "])),x.white,Ne(x.white))),D(le,Pn.DangerOutline,i(ae||(ae=G(["\n &:focus-visible {\n color: ",";\n box-shadow: ",";\n }\n "])),x.red.dark2,Ne(x.white))),D(le,Pn.BaseGreen,i(te||(te=G(["\n &:focus-visible {\n box-shadow: ",";\n }\n "])),Ne(x.white))),le)),D(pe,y.Dark,(D(be={},Pn.Default,i(ie||(ie=G(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),x.gray.dark1,Ne(x.black))),D(be,Pn.Primary,i(ce||(ce=G(["\n &:focus-visible {\n background-color: #00593f; // Off palette\n box-shadow: ",";\n }\n "])),Ne(x.black))),D(be,Pn.PrimaryOutline,i(de||(de=G(["\n &:focus-visible {\n background-color: ",";\n border-color: ",";\n box-shadow: ",";\n }\n "])),m(.96,x.green.base),x.green.base,Ne(x.black))),D(be,Pn.Danger,i(se||(se=G(["\n &:focus-visible {\n background-color: #c82222; // Off palette\n box-shadow: ",";\n }\n "])),Ne(x.black))),D(be,Pn.DangerOutline,i(ge||(ge=G(["\n &:focus-visible {\n background-color: ",";\n border-color: ",";\n box-shadow: ",";\n }\n "])),m(.96,x.red.base),x.red.light1,Ne(x.black))),D(be,Pn.BaseGreen,i(ue||(ue=G(["\n &:focus-visible {\n background-color: ",";\n box-shadow: ",";\n }\n "])),x.green.base,Ne(x.black))),be)),pe),Ce=(D(ye={},y.Light,i(he||(he=G(["\n &,\n &:hover {\n background-color: ",";\n border-color: ",";\n color: ",";\n cursor: not-allowed;\n }\n\n &:focus {\n color: ",";\n box-shadow: ",";\n }\n "])),x.gray.light2,x.gray.light1,x.gray.base,x.gray.base,Ne(x.white))),D(ye,y.Dark,i(fe||(fe=G(["\n &,\n &:hover {\n background-color: ",";\n border-color: ",";\n color: ",";\n cursor: not-allowed;\n }\n\n &:focus {\n color: ",";\n box-shadow: ",";\n }\n "])),x.gray.dark3,x.gray.dark1,x.gray.dark1,x.gray.dark1,Ne(x.black))),ye),qe=(D(we={},jn.XSmall,i(ke||(ke=G(["\n height: 22px;\n text-transform: uppercase;\n font-size: 12px;\n line-height: 1em;\n font-weight: ",";\n letter-spacing: 0.4px;\n "])),u.bold)),D(we,jn.Small,i(xe||(xe=G(["\n height: 28px;\n "])))),D(we,jn.Default,i(me||(me=G(["\n height: 36px;\n "])))),D(we,jn.Large,i(ve||(ve=G(["\n height: 48px;\n font-size: 18px;\n line-height: 24px;\n "])))),we),Fe=(D(Pe={},p.Body1,i(Oe||(Oe=G(["\n font-size: ","px;\n line-height: ","px;\n font-weight: ",";\n "])),b.body1.fontSize,b.body1.lineHeight,u.medium)),D(Pe,p.Body2,i(De||(De=G(["\n font-size: ","px;\n line-height: ","px;\n // Pixel pushing for optical alignment purposes\n transform: translateY(1px);\n font-weight: ",";\n "])),b.body2.fontSize,b.body2.lineHeight,u.medium)),Pe);var Ie=["variant","size","darkMode","baseFontSize","disabled","onClick","leftGlyph","rightGlyph","children","className","as","type"],Xe=n.forwardRef((function(e,r){var o=e.variant,a=void 0===o?Pn.Default:o,t=e.size,i=void 0===t?jn.Default:t,s=e.darkMode,g=e.baseFontSize,u=void 0===g?p.Body1:g,b=e.disabled,h=void 0!==b&&b,f=e.onClick,y=e.leftGlyph,x=e.rightGlyph,m=e.children,v=e.className,w=e.as,P=e.type,G=j(e,Ie),z=d(s).darkMode,S=function(n){var e=n.variant,r=n.size,o=n.darkMode,a=n.baseFontSize,t=n.disabled,l=k(o),i=Me[l][e],d=Le[l][e];return c(Ee,i,Fe[a],qe[r],D({},d,!t),D({},Ce[l],t))}({variant:a,size:i,darkMode:z,baseFontSize:u,disabled:h}),B=!(!G.href&&"a"!==w||h),N=O({type:B?void 0:P||"button",className:c(Gn,S,v),ref:r,as:w||(B?"a":"button"),"aria-disabled":h,onClick:h?void 0:f,href:h?void 0:G.href},G),E={rightGlyph:x,leftGlyph:y,darkMode:z,disabled:h,variant:a,size:i};return n.createElement(l,N,n.createElement(Be,E,m))}));Xe.displayName="Button",Xe.propTypes={variant:t.oneOf(Object.values(Pn)),baseFontSize:t.oneOf(Object.values(p)),size:t.oneOf(Object.values(jn)),darkMode:t.bool,disabled:t.bool,leftGlyph:t.element,rightGlyph:t.element,href:t.string};var Te=["leftGlyph","rightGlyph"],He={title:"Components/Button",component:Xe,args:{children:"MongoDB",variant:Pn.Default},parameters:{default:"Playground",controls:{exclude:["ref","onClick","className"]}},argTypes:{disabled:{control:{type:"boolean"}},leftGlyph:{options:Object.keys(a),control:{type:"select"}},rightGlyph:{options:Object.keys(a),control:{type:"select"}},type:{control:"select",options:["button","submit"],defaultValue:"button"},size:{control:"select",options:Object.values(jn),defaultValue:jn.Default},href:{control:"text"}}},Ve={render:function(e){var r=e.leftGlyph,a=e.rightGlyph,t=j(e,Te);return n.createElement(Xe,P({leftGlyph:r?n.createElement(o,{glyph:r}):void 0,rightGlyph:a?n.createElement(o,{glyph:a}):void 0},t))}},Re=O(O({},Ve),{},{args:{variant:Pn.BaseGreen}});export{Re as BaseGreen,Ve as Playground,He as default}; |
@@ -53,3 +53,3 @@ [ | ||
"defaultValue": { | ||
"value": "button" | ||
"value": "'button'" | ||
}, | ||
@@ -62,3 +62,3 @@ "description": "Specifies the `type` property of the HTML button element", | ||
"tags": { | ||
"default": "button" | ||
"default": "'button'" | ||
} | ||
@@ -108,3 +108,3 @@ }, | ||
"tags": { | ||
"default": "default" | ||
"default": "'default'" | ||
} | ||
@@ -169,3 +169,3 @@ }, | ||
"tags": { | ||
"default": "default" | ||
"default": "'default'" | ||
} | ||
@@ -225,3 +225,3 @@ }, | ||
"defaultValue": null, | ||
"description": "An icon glyph rendered before the button text.\nTo use a custom icon, see {@link Icon } {@link https://github.com/mongodb/leafygreen-ui/blob/main/packages/icon/README.md#usage-registering-custom-icon-sets | createIconComponent} docs", | ||
"description": "An icon glyph rendered before the button text.\nTo use a custom icon, see {@link Icon }: `createIconComponent` docs", | ||
"required": false, | ||
@@ -238,3 +238,3 @@ "type": { | ||
"defaultValue": null, | ||
"description": "An icon glyph rendered after the button text.\nTo use a custom icon, see {@link Icon } {@link https://github.com/mongodb/leafygreen-ui/blob/main/packages/icon/README.md#usage-registering-custom-icon-sets | createIconComponent} docs", | ||
"description": "An icon glyph rendered after the button text.\nTo use a custom icon, see {@link Icon }: `createIconComponent` docs", | ||
"required": false, | ||
@@ -260,5 +260,3 @@ "type": { | ||
"name": "as", | ||
"defaultValue": { | ||
"value": "button" | ||
}, | ||
"defaultValue": null, | ||
"description": "The component or HTML Element that the button is rendered as.\n\nTo use with NextJS Links, pass in a component that wraps the Link:\n```js\nconst Linker = ({ href, children, ...props }) => (\n <NextLink href={href}>\n <a {...props}>{children}</a>\n </NextLink>\n);\n<Button as={Linker} />\n```", | ||
@@ -270,4 +268,3 @@ "required": false, | ||
"tags": { | ||
"type": "HTMLElement | React.Component", | ||
"default": "button" | ||
"type": "HTMLElement | React.Component" | ||
} | ||
@@ -274,0 +271,0 @@ } |
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
297073
1802
2