import{r as l,P as V,O as v,c as q,D as z,j as Y,k as y}from"./iframe-B4rglaWu.js";import{F as $,E as G}from"./ErrorMessage-DFhVHOBn.js";import{u as J,C as Q,a as X}from"./componentbase.esm-O764U3c0.js";import{K as F}from"./keyfilter.esm-Bl_Obi_0.js";import{T as Z}from"./tooltip.esm-C17X5ypA.js";import"./preload-helper-PPVm8Dsz.js";import"./portal.esm-9O3HNf5A.js";function B(){return B=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var a in o)({}).hasOwnProperty.call(o,a)&&(t[a]=o[a])}return t},B.apply(null,arguments)}function D(t){"@babel/helpers - typeof";return D=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},D(t)}function ee(t,e){if(D(t)!="object"||!t)return t;var o=t[Symbol.toPrimitive];if(o!==void 0){var a=o.call(t,e);if(D(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function re(t){var e=ee(t,"string");return D(e)=="symbol"?e:e+""}function te(t,e,o){return(e=re(e))in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}var oe={root:function(e){var o=e.props,a=e.context,r=e.isFilled;return q("p-inputtextarea p-inputtext p-component",{"p-disabled":o.disabled,"p-filled":r,"p-inputtextarea-resizable":o.autoResize,"p-invalid":o.invalid,"p-variant-filled":o.variant?o.variant==="filled":a&&a.inputStyle==="filled"})}},ae=`
@layer primereact {
    .p-inputtextarea-resizable {
        overflow: hidden;
        resize: none;
    }
    
    .p-fluid .p-inputtextarea {
        width: 100%;
    }
}
`,w=Q.extend({defaultProps:{__TYPE:"InputTextarea",__parentMetadata:null,autoResize:!1,invalid:!1,variant:null,keyfilter:null,onBlur:null,onFocus:null,onBeforeInput:null,onInput:null,onKeyDown:null,onKeyUp:null,onPaste:null,tooltip:null,tooltipOptions:null,validateOnly:!1,children:void 0,className:null},css:{classes:oe,styles:ae}});function K(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),o.push.apply(o,a)}return o}function N(t){for(var e=1;e<arguments.length;e++){var o=arguments[e]!=null?arguments[e]:{};e%2?K(Object(o),!0).forEach(function(a){te(t,a,o[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):K(Object(o)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(o,a))})}return t}var U=l.memo(l.forwardRef(function(t,e){var o=J(),a=l.useContext(V),r=w.getProps(t,a),i=l.useRef(e),c=l.useRef(0),u=w.setMetaData(N(N({props:r},r.__parentMetadata),{},{context:{disabled:r.disabled}})),g=u.ptm,p=u.cx,h=u.isUnstyled;X(w.css.styles,h,{name:"inputtextarea"});var d=function(n){r.autoResize&&P(),r.onFocus&&r.onFocus(n)},m=function(n){r.autoResize&&P(),r.onBlur&&r.onBlur(n)},f=function(n){r.autoResize&&P(),r.onKeyUp&&r.onKeyUp(n)},x=function(n){r.onKeyDown&&r.onKeyDown(n),r.keyfilter&&F.onKeyPress(n,r.keyfilter,r.validateOnly)},C=function(n){r.onBeforeInput&&r.onBeforeInput(n),r.keyfilter&&F.onBeforeInput(n,r.keyfilter,r.validateOnly)},k=function(n){r.onPaste&&r.onPaste(n),r.keyfilter&&F.onPaste(n,r.keyfilter,r.validateOnly)},M=function(n){var s=n.target;r.autoResize&&P(v.isEmpty(s.value)),r.onInput&&r.onInput(n),v.isNotEmpty(s.value)?z.addClass(s,"p-filled"):z.removeClass(s,"p-filled")},P=function(n){var s=i.current;s&&H()&&(c.current||(c.current=s.scrollHeight,s.style.overflow="hidden"),(c.current!==s.scrollHeight||n)&&(s.style.height="",s.style.height=s.scrollHeight+"px",parseFloat(s.style.height)>=parseFloat(s.style.maxHeight)?(s.style.overflowY="scroll",s.style.height=s.style.maxHeight):s.style.overflow="hidden",c.current=s.scrollHeight))},H=function(){if(z.isVisible(i.current)){var n=i.current.getBoundingClientRect();return n.width>0&&n.height>0}return!1};l.useEffect(function(){v.combinedRefs(i,e)},[i,e]),l.useEffect(function(){r.autoResize&&P(!0)},[r.autoResize,r.value]);var L=l.useMemo(function(){return v.isNotEmpty(r.value)||v.isNotEmpty(r.defaultValue)},[r.value,r.defaultValue]),W=v.isNotEmpty(r.tooltip),A=o({ref:i,className:q(r.className,p("root",{context:a,isFilled:L})),onFocus:d,onBlur:m,onKeyUp:f,onKeyDown:x,onBeforeInput:C,onInput:M,onPaste:k},w.getOtherProps(r),g("root"));return l.createElement(l.Fragment,null,l.createElement("textarea",A),W&&l.createElement(Z,B({target:i,content:r.tooltip,pt:g("tooltip")},r.tooltipOptions)))}));U.displayName="InputTextarea";const _=t=>{const e=Y.c(24);let o,a,r,i,c,u;e[0]!==t?({className:o,id:r,label:i,required:u,error:a,...c}=t,e[0]=t,e[1]=o,e[2]=a,e[3]=r,e[4]=i,e[5]=c,e[6]=u):(o=e[1],a=e[2],r=e[3],i=e[4],c=e[5],u=e[6]);const g=!!a;let p;e[7]!==r||e[8]!==c||e[9]!==g?(p=y.jsx(U,{id:r,...c,className:"w-full h-auto",invalid:g}),e[7]=r,e[8]=c,e[9]=g,e[10]=p):p=e[10];const h=u?"*":"";let d;e[11]!==r||e[12]!==i||e[13]!==h?(d=y.jsxs("label",{htmlFor:r,children:[i," ",h]}),e[11]=r,e[12]=i,e[13]=h,e[14]=d):d=e[14];let m;e[15]!==p||e[16]!==d?(m=y.jsxs($,{className:"w-full",children:[p,d]}),e[15]=p,e[16]=d,e[17]=m):m=e[17];let f;e[18]!==a?(f=y.jsx(G,{error:a}),e[18]=a,e[19]=f):f=e[19];let x;return e[20]!==o||e[21]!==m||e[22]!==f?(x=y.jsx(y.Fragment,{children:y.jsxs("div",{className:o,children:[m,f]})}),e[20]=o,e[21]=m,e[22]=f,e[23]=x):x=e[23],x};_.__docgenInfo={description:`Componente de área de texto com label flutuante e suporte a mensagens de erro.

Utiliza o InputTextarea do PrimeReact com FloatLabel para criar um campo
de texto multilinha estilizado e consistente com o design system da aplicação.
A altura do campo se ajusta automaticamente ao conteúdo.

@example
\`\`\`tsx
<UiInputTextarea
  id="descricao"
  label="Descrição"
  value={descricao}
  onChange={(e) => setDescricao(e.target.value)}
  rows={5}
  required
  error={errors.descricao?.message}
/>
\`\`\`

@see {@link https://primereact.org/inputtextarea/ | PrimeReact InputTextarea}`,methods:[],displayName:"UiInputTextarea",props:{id:{required:!0,tsType:{name:"string"},description:"Identificador único do campo, usado para associar o label ao input"},label:{required:!0,tsType:{name:"string"},description:"Texto do label flutuante exibido acima do campo"},className:{required:!1,tsType:{name:"string"},description:"Classes CSS adicionais para o container do componente"},required:{required:!1,tsType:{name:"boolean"},description:"Indica se o campo é obrigatório (adiciona asterisco ao label)"},error:{required:!1,tsType:{name:"string"},description:"Mensagem de erro a ser exibida abaixo do campo"}},composes:["InputTextareaProps"]};const de={title:"Components/Form/UiInputTextarea",component:_,parameters:{layout:"centered"},tags:["autodocs"],argTypes:{error:{control:"text",description:"Mensagem de erro exibida abaixo do campo"},required:{control:"boolean",description:"Indica se o campo é obrigatório"},disabled:{control:"boolean",description:"Desabilita o campo"},rows:{control:"number",description:"Número de linhas visíveis"},autoResize:{control:"boolean",description:"Redimensiona automaticamente conforme o conteúdo"}}},O={args:{id:"descricao",label:"Descrição"}},I={args:{id:"descricao-obrigatoria",label:"Descrição",required:!0}},R={args:{id:"descricao-erro",label:"Descrição",error:"A descrição é obrigatória",required:!0}},j={args:{id:"descricao-linhas",label:"Descrição",rows:5}},T={args:{id:"descricao-auto",label:"Descrição",autoResize:!0}},E={args:{id:"descricao-desabilitada",label:"Descrição",disabled:!0,value:"Texto de exemplo desabilitado"}},S={args:{id:"descricao-max",label:"Descrição (máx 100 caracteres)",maxLength:100}};O.parameters={...O.parameters,docs:{...O.parameters?.docs,source:{originalSource:`{
  args: {
    id: 'descricao',
    label: 'Descrição'
  }
}`,...O.parameters?.docs?.source}}};I.parameters={...I.parameters,docs:{...I.parameters?.docs,source:{originalSource:`{
  args: {
    id: 'descricao-obrigatoria',
    label: 'Descrição',
    required: true
  }
}`,...I.parameters?.docs?.source}}};R.parameters={...R.parameters,docs:{...R.parameters?.docs,source:{originalSource:`{
  args: {
    id: 'descricao-erro',
    label: 'Descrição',
    error: 'A descrição é obrigatória',
    required: true
  }
}`,...R.parameters?.docs?.source}}};j.parameters={...j.parameters,docs:{...j.parameters?.docs,source:{originalSource:`{
  args: {
    id: 'descricao-linhas',
    label: 'Descrição',
    rows: 5
  }
}`,...j.parameters?.docs?.source}}};T.parameters={...T.parameters,docs:{...T.parameters?.docs,source:{originalSource:`{
  args: {
    id: 'descricao-auto',
    label: 'Descrição',
    autoResize: true
  }
}`,...T.parameters?.docs?.source}}};E.parameters={...E.parameters,docs:{...E.parameters?.docs,source:{originalSource:`{
  args: {
    id: 'descricao-desabilitada',
    label: 'Descrição',
    disabled: true,
    value: 'Texto de exemplo desabilitado'
  }
}`,...E.parameters?.docs?.source}}};S.parameters={...S.parameters,docs:{...S.parameters?.docs,source:{originalSource:`{
  args: {
    id: 'descricao-max',
    label: 'Descrição (máx 100 caracteres)',
    maxLength: 100
  }
}`,...S.parameters?.docs?.source}}};const me=["Default","Required","WithError","WithRows","AutoResize","Disabled","WithMaxLength"];export{T as AutoResize,O as Default,E as Disabled,I as Required,R as WithError,S as WithMaxLength,j as WithRows,me as __namedExportsOrder,de as default};
