"use strict";const e=require("react/jsx-runtime"),j=require("react"),_=require("./search.es-Cg2amJSR.js"),k=require("./text-field-B8a-NKm4.js"),f=require("./bind-DeUYJ6m9.js"),d=require("./button-ChYUPi2k.js"),v={"purpur-search-field":"_purpur-search-field_uhpkq_1","purpur-search-field--has-clear-button":"_purpur-search-field--has-clear-button_uhpkq_4","purpur-search-field--no-gap":"_purpur-search-field--no-gap_uhpkq_13","purpur-search-field__wrapper":"_purpur-search-field__wrapper_uhpkq_17","purpur-search-field__wrapper--gap":"_purpur-search-field__wrapper--gap_uhpkq_20","purpur-search-field__search-icon":"_purpur-search-field__search-icon_uhpkq_24","purpur-search-field__close-icon":"_purpur-search-field__close-icon_uhpkq_24"},N={"purpur-search-field-button":"_purpur-search-field-button_c16yo_1","purpur-search-field-button--icon-only":"_purpur-search-field-button--icon-only_c16yo_1"},w=f.c.bind(N),h="purpur-search-field-button",z=({["data-testid"]:s,disabled:i,iconOnly:c,label:r})=>{const a={className:w(h,{[`${h}--icon-only`]:c}),disabled:i,"data-testid":s};return c?e.jsx(d.Button,{...a,"aria-label":r,iconOnly:!0,size:"sm",type:"submit",variant:"primary",children:e.jsx(_.s,{size:"xs"})}):e.jsx(d.Button,{...a,size:"sm",type:"submit",variant:"primary",children:r})},S=["button-attached","no-button"],l=f.c.bind(v),u="purpur-search-field",b=j.forwardRef(({["data-testid"]:s,className:i,clearButtonAriaLabel:c,disabled:r,iconOnlySearchButton:a,onClear:m,onSearch:x,searchButtonLabel:y,variant:o,formRef:q,...t},$)=>{const p=n=>s?`${s}-${n}`:void 0,F=(typeof t.value=="number"?t.value!==void 0:t.value?.length)&&!r&&!t.readOnly&&!t.loading,g=l(i,u,{[`${u}--no-gap`]:o==="button-attached",[`${u}--has-clear-button`]:F});return e.jsx("form",{ref:q,className:l(`${u}__wrapper`),"data-testid":s,onSubmit:n=>{n.preventDefault(),x?.(n)},children:e.jsx(k.TextField,{ref:$,className:g,clearButtonAriaLabel:c,disabled:r,onClear:m,startAdornment:a?null:e.jsx(_.s,{size:"xs",className:l(`${u}__search-icon`)},"1"),afterField:o!=="no-button"?e.jsx(z,{disabled:r,iconOnly:a,label:y,"data-testid":p("button")}):null,"data-testid":p("text-field"),type:"search",...t})})});b.displayName="SearchField";exports.SearchField=b;exports.searchFieldVariants=S;
//# sourceMappingURL=search-field-CxX4BBcg.js.map
