import{r as e}from"./index-NdkWRN8K.js";import{u as E,M as N}from"./MuiPropsContext-DhRylJZk.js";import{M as q}from"./Tooltip-CsVWtVfL.js";import{j as s}from"./jsx-runtime-CnH95YSl.js";import{B as w}from"./Button-BzIwUmSM.js";/*!
 * Copyright (c) 2024-present, Okta, Inc. and/or its affiliates. All rights reserved.
 * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
 *
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and limitations under the License.
 */const G=e.createContext({isFullWidth:!1}),H=()=>e.useContext(G),Y=["small","medium","large"],Z=["button","submit","reset"],_=["primary","secondary","danger","dangerSecondary","floating","floatingAction"],I=({ariaControls:a,ariaDescribedBy:r,ariaExpanded:u,ariaHasPopup:c,ariaLabel:i,ariaLabelledBy:l,buttonRef:k,children:d,endIcon:f,href:m,id:x,isDisabled:B,isFullWidth:b,label:p="",onClick:h,size:y="medium",startIcon:M,tabIndex:C,testId:g,tooltipText:j,translate:W,type:F="button",variant:V})=>{const A=E(),v=V==="tertiary"?"secondary":V,z=e.useRef(null),n=H(),R=e.useMemo(()=>n.isFullWidth?n.isFullWidth:b,[n,b]);e.useImperativeHandle(k,()=>({focus:()=>{var t;(t=z.current)==null||t.focus()}}),[]);const S=e.useCallback(t=>s.jsx(w,{...t,"aria-controls":a,"aria-describedby":r,"aria-expanded":u,"aria-haspopup":c,"aria-label":i,"aria-labelledby":l,"data-se":g,disabled:B,endIcon:f,fullWidth:R,href:m,id:x,onClick:h,ref:o=>{var T;o&&(z.current=o,(T=t==null?void 0:t.ref)==null||T.call(t,o))},size:y,startIcon:M,tabIndex:C,translate:W,type:F,variant:v,children:d??p}),[a,r,u,c,i,l,f,m,x,B,R,p,d,h,y,M,C,g,W,F,v]);return j?s.jsx(q,{ariaType:"description",placement:"top",text:j,children:s.jsx(N.Consumer,{children:S})}):S(A)},J=e.memo(I);J.displayName="BaseButton";export{G as B,J as M,Z as a,_ as b,Y as c};
