import{_ as __rest,a as __assign}from"./tslib.es6-bjGg6Bxl.js";import React__default from"react";import{I as Icon}from"./Icon.component-7-ap-6Ys.js";import{S as Spinner}from"./Spinner.component-B_OKKh5D.js";var btnBase="\n  jn-font-bold\n  jn-inline-flex \n  jn-justify-center \n  jn-items-center\n  jn-rounded\n  jn-shadow-sm \n  jn-w-auto\n  focus:jn-outline-none \n  focus-visible:jn-ring-2\n  focus-visible:jn-ring-theme-focus\n  focus-visible:jn-ring-offset-1\n  focus-visible:jn-ring-offset-theme-focus\n  disabled:jn-opacity-50\n  disabled:jn-cursor-not-allowed\n  disabled:jn-pointer-events-none\n",btnSmallBase="\n  jn-text-sm\n  jn-leading-5\n",btnDefaultBase="\n  jn-text-base\n  jn-leading-6\n",btnSmallDefaultPadding="\n  jn-py-[0.3125rem]\n  jn-px-[0.5rem]\n",btnSmallSubduedPadding="\n  jn-py-[0.25rem]\n  jn-px-[0.4375rem]\n",btnDefaultPadding="\n  jn-py-[0.4375rem]\n  jn-px-[0.625rem] \n",btnDefaultSubduedPadding="\n  jn-py-[0.375rem]\n  jn-px-[0.5625rem]\n",getButtonPadding=function(a,b){return"small"===a?"subdued"===b?"".concat(btnSmallSubduedPadding):"".concat(btnSmallDefaultPadding):"subdued"===b?"".concat(btnDefaultSubduedPadding):"".concat(btnDefaultPadding)},btnIconSmall="\n  jn-mr-2\n",btnIconDefault="\n  jn-mr-2\n",iconClasses=function(a){return"small"===a?"".concat(btnIconSmall):"".concat(btnIconDefault)},progressClass=function(a){var b=a?"in-progress":"";return b},spinnerColorClass=function(a){return"default"===a?"jn-text-theme-accent":"primary"===a?"jn-text-white":"primary-danger"===a?"jn-text-white":""},Button=React__default.forwardRef(function(a,b){var c=a.label,d=a.title,e=void 0===d?null:d,f=a.variant,g=a.size,h=void 0===g?"default":g,i=a.disabled,j=void 0===i?null:i,k=a.href,l=void 0===k?null:k,m=a.icon,n=void 0===m?null:m,o=a.className,p=void 0===o?"":o,q=a.onClick,r=a.children,s=a.progress,t=void 0!==s&&s,u=a.progressLabel,v=void 0===u?"":u,w=__rest(a,["label","title","variant","size","disabled","href","icon","className","onClick","children","progress","progressLabel"]),x=f||"default",y=e||c||"",z=t?(React__default.createElement(Spinner,{size:"small"===h?"1.125rem":"1.5rem",color:"".concat(spinnerColorClass(x))})):n?(React__default.createElement(Icon,{icon:n,title:y,className:"juno-button-icon ".concat(c||r?iconClasses(h):""," "),size:"small"===h?"1.125rem":"1.5rem"})):null,A=t&&v?v:c||r,B=React__default.createElement("button",__assign({className:"\n          juno-button \n          juno-button-".concat(x," \n          juno-button-").concat(h,"-size \n          ").concat(btnBase," \n          ").concat("small"===h?btnSmallBase:btnDefaultBase," \n          ").concat(getButtonPadding(h,f),"\n          ").concat(progressClass(t)," \n          ").concat(p),disabled:j||void 0,onClick:function(a){q&&q(a)},ref:b},w,{type:"button",title:y}),z,A),C=React__default.createElement("a",__assign({href:l||void 0,role:"button",className:"\n          juno-button \n          juno-button-".concat(x," \n          juno-button-").concat(h,"-size \n          ").concat(btnBase," \n          ").concat("small"===h?btnSmallBase:btnDefaultBase,"\n          ").concat(getButtonPadding(h,f),"\n          ").concat(progressClass(t)," \n          ").concat(p,"\n        "),disabled:j,onClick:q,ref:b},w,{title:y}),z,A);return l?C:B});Button.displayName="Button";export{Button as B};