import{W as f,ad as p,B as i,r as d,u as h,j as o,a as S,b as F,c as I,D as R,d as C,ae as M}from"./index.RuhrnD1v.js";import{af as D}from"./index.RuhrnD1v.js";import{m as x}from"./iconPosition.BnTrQB0J.js";import{F as E,u as O}from"./FormClearHelper.DFo50Lfo.js";function y(a){const{disabled:l,element:t,widgetMgr:e,fragmentId:u}=a,{formId:s}=t,m=t.shortcut?t.shortcut:void 0,{formsData:B}=f(p),b=B.formsWithUploads.has(s);let n=i.SECONDARY_FORM_SUBMIT;t.type==="primary"?n=i.PRIMARY_FORM_SUBMIT:t.type==="tertiary"&&(n=i.TERTIARY_FORM_SUBMIT);const r=l||b;d.useEffect(()=>(e.addSubmitButton(s,t),()=>e.removeSubmitButton(s,t)),[e,s,t]);const c=d.useCallback(()=>{r||e.submitForm(t.formId,u,t)},[r,e,t,u]);return h({shortcut:m,disabled:r,onActivate:c}),o(C,{className:"stFormSubmitButton","data-testid":"stFormSubmitButton",children:o(S,{help:t.help,containerWidth:!0,children:o(F,{kind:n,size:I.SMALL,containerWidth:!0,disabled:r,onClick:c,children:o(R,{icon:t.icon,iconPosition:x(t.iconPosition),label:t.label,shortcut:m})})})})}function _(a){return o(M,{children:o(y,{...a})})}export{E as FormClearHelper,y as FormSubmitButton,_ as FormSubmitContent,D as default,O as useFormClearHelper};
