import{_ as _extends}from"./_rollupPluginBabelHelpers-B5fk9IVe.js";import React__default from"react";import PropTypes from"prop-types";import{k as knownIcons,I as Icon}from"./Icon.component-BVkaZqpA.js";import{S as Spinner}from"./Spinner.component-3BfGSLKB.js";const btnBase=`
  jn-font-bold
  jn-inline-flex 
  jn-justify-center 
  jn-items-center
  jn-rounded
  jn-shadow-sm 
  jn-w-auto
  focus:jn-outline-none 
  focus-visible:jn-ring-2
  focus-visible:jn-ring-theme-focus
  focus-visible:jn-ring-offset-1
  focus-visible:jn-ring-offset-theme-focus
  disabled:jn-opacity-50
  disabled:jn-cursor-not-allowed
  disabled:jn-pointer-events-none
`,btnSmallBase=`
  jn-text-sm
  jn-leading-5
`,btnDefaultBase=`
  jn-text-base
  jn-leading-6
`,btnSmallDefaultPadding=`
  jn-py-[0.3125rem]
  jn-px-[0.5rem]
`,btnSmallSubduedPadding=`
  jn-py-[0.25rem]
  jn-px-[0.4375rem]
`,btnDefaultPadding=`
  jn-py-[0.4375rem]
  jn-px-[0.625rem] 
`,btnDefaultSubduedPadding=`
  jn-py-[0.375rem]
  jn-px-[0.5625rem]
`,getButtonPadding=(a,b)=>"small"===a?"subdued"===b?`${btnSmallSubduedPadding}`:`${btnSmallDefaultPadding}`:"subdued"===b?`${btnDefaultSubduedPadding}`:`${btnDefaultPadding}`,btnIconSmall=`
  jn-mr-2
`,btnIconDefault=`
  jn-mr-2
`,iconClasses=a=>"small"===a?`${btnIconSmall}`:`${btnIconDefault}`,progressClass=a=>{const b=a?`in-progress`:``;return b},spinnerColorClass=a=>"default"===a?"jn-text-theme-accent":"primary"===a?"jn-text-white":"primary-danger"===a?"jn-text-white":"",Button=React__default.forwardRef((a,b)=>{let{label:c,title:h=null,variant:d,size:i="default",disabled:j=null,href:k=null,icon:l=null,className:m="",onClick:e,children:f,progress:n=!1,progressLabel:o="",...g}=a;const p=d||"default",q=h||c||"",r=n?React__default.createElement(Spinner,{size:"small"===i?"1.125rem":"1.5rem",color:`${spinnerColorClass(p)}`}):l?React__default.createElement(Icon,{icon:l,title:q,className:`juno-button-icon ${c||f?iconClasses(i):""} `,size:"small"===i?"1.125rem":"1.5rem"}):null,s=n&&o?o:c||f,t=React__default.createElement("button",_extends({type:"button",className:`
          juno-button 
          juno-button-${p} 
          juno-button-${i}-size 
          ${btnBase} 
          ${"small"===i?btnSmallBase:btnDefaultBase} 
          ${getButtonPadding(i,d)}
          ${progressClass(n)} 
          ${m}`,disabled:j,onClick:a=>{e&&e(a)},title:q,ref:b},g),r,s),u=React__default.createElement("a",_extends({href:k,role:"button",className:`
          juno-button 
          juno-button-${p} 
          juno-button-${i}-size 
          ${btnBase} 
          ${"small"===i?btnSmallBase:btnDefaultBase}
          ${getButtonPadding(i,d)}
          ${progressClass(n)} 
          ${m}
        `,disabled:j,onClick:e,title:q,ref:b},g),r,s);return k?u:t});Button.displayName="Button",Button.propTypes={children:PropTypes.any,variant:PropTypes.oneOf(["primary","primary-danger","default","subdued"]),size:PropTypes.oneOf(["small","default"]),disabled:PropTypes.bool,href:PropTypes.string,label:PropTypes.string,title:PropTypes.string,icon:PropTypes.oneOf(knownIcons),className:PropTypes.string,onClick:PropTypes.func,progress:PropTypes.bool,progressLabel:PropTypes.string};export{Button as B};