import{j,k as a}from"./iframe-B4rglaWu.js";import{C as v,u as N,U as k}from"./Form-a1c8JcgO.js";import{C as y}from"./calendar.esm-O4kIknHG.js";import{F as w,E}from"./ErrorMessage-DFhVHOBn.js";import"./preload-helper-PPVm8Dsz.js";import"./button.esm-BWX-wzE5.js";import"./componentbase.esm-O764U3c0.js";import"./index.esm-Bp9biEJw.js";import"./iconbase.esm-CeJUwaxq.js";import"./ripple.esm-Bd7Vm0vw.js";import"./tooltip.esm-C17X5ypA.js";import"./portal.esm-9O3HNf5A.js";import"./index.esm-ykNyILbO.js";import"./index.esm-Dh1FCB31.js";import"./inputtext.esm-PyaMa37F.js";import"./keyfilter.esm-Bl_Obi_0.js";import"./overlayservice.esm-C5VFRSbT.js";const q=p=>{const e=j.c(23);let o,r,t,n,s,i,d;e[0]!==p?({className:o,id:t,name:s,label:n,required:d,error:r,...i}=p,e[0]=p,e[1]=o,e[2]=r,e[3]=t,e[4]=n,e[5]=s,e[6]=i,e[7]=d):(o=e[1],r=e[2],t=e[3],n=e[4],s=e[5],i=e[6],d=e[7]);let l;e[8]!==r||e[9]!==t||e[10]!==n||e[11]!==i||e[12]!==d?(l=F=>{const{field:D}=F;return a.jsxs(w,{className:"w-full",children:[a.jsx(y,{id:t,...i,value:D.value,onChange:T=>D.onChange(T.value),className:"w-full",invalid:!!r}),a.jsxs("label",{htmlFor:t,children:[n," ",d?"*":""]})]})},e[8]=r,e[9]=t,e[10]=n,e[11]=i,e[12]=d,e[13]=l):l=e[13];let m;e[14]!==s||e[15]!==l?(m=a.jsx(v,{name:s,render:l}),e[14]=s,e[15]=l,e[16]=m):m=e[16];let c;e[17]!==r?(c=a.jsx(E,{error:r}),e[17]=r,e[18]=c):c=e[18];let u;return e[19]!==o||e[20]!==m||e[21]!==c?(u=a.jsx(a.Fragment,{children:a.jsxs("div",{className:o,children:[m,c]})}),e[19]=o,e[20]=m,e[21]=c,e[22]=u):u=e[22],u};q.__docgenInfo={description:`Componente de seleção de data controlado por react-hook-form.

Versão controlada do UiCalendar que se integra automaticamente com o
FormProvider do react-hook-form. Utiliza o Controller para gerenciar
o estado do campo.

@remarks
Este componente deve ser usado dentro de um FormProvider do react-hook-form.
Para uso sem formulário, utilize o componente UiCalendar.

@example
\`\`\`tsx
// Dentro de um FormProvider
<UiCalendarControlled
  id="data-nascimento"
  name="dataNascimento"
  label="Data de Nascimento"
  required
  error={errors.dataNascimento?.message}
/>
\`\`\`

@see {@link https://primereact.org/calendar/ | PrimeReact Calendar}
@see {@link https://react-hook-form.com/docs/usecontroller/controller | React Hook Form Controller}`,methods:[],displayName:"UiCalendarControlled",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"},name:{required:!0,tsType:{name:"string"},description:"Nome do campo no formulário, usado pelo react-hook-form para registro"}},composes:["CalendarProps"]};const J={title:"Components/Form/UiCalendarControlled",component:q,parameters:{layout:"centered"},tags:["autodocs"],decorators:[p=>{const e=N({defaultValues:{data:null}});return a.jsx(k,{methods:e,onSubmit:o=>console.log(o),children:a.jsx("div",{style:{width:"300px"},children:a.jsx(p,{})})})}],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"},showIcon:{control:"boolean",description:"Exibe ícone de calendário"},showTime:{control:"boolean",description:"Permite seleção de hora"}}},b={args:{id:"data",name:"data",label:"Data"}},g={args:{id:"data-obrigatoria",name:"data",label:"Data de Nascimento",required:!0}},h={args:{id:"data-erro",name:"data",label:"Data",error:"Data inválida",required:!0}},f={args:{id:"data-icone",name:"data",label:"Data",showIcon:!0}},x={args:{id:"data-hora",name:"data",label:"Data e Hora",showTime:!0,hourFormat:"24"}},C={args:{id:"data-desabilitada",name:"data",label:"Data",disabled:!0}};b.parameters={...b.parameters,docs:{...b.parameters?.docs,source:{originalSource:`{
  args: {
    id: 'data',
    name: 'data',
    label: 'Data'
  }
}`,...b.parameters?.docs?.source}}};g.parameters={...g.parameters,docs:{...g.parameters?.docs,source:{originalSource:`{
  args: {
    id: 'data-obrigatoria',
    name: 'data',
    label: 'Data de Nascimento',
    required: true
  }
}`,...g.parameters?.docs?.source}}};h.parameters={...h.parameters,docs:{...h.parameters?.docs,source:{originalSource:`{
  args: {
    id: 'data-erro',
    name: 'data',
    label: 'Data',
    error: 'Data inválida',
    required: true
  }
}`,...h.parameters?.docs?.source}}};f.parameters={...f.parameters,docs:{...f.parameters?.docs,source:{originalSource:`{
  args: {
    id: 'data-icone',
    name: 'data',
    label: 'Data',
    showIcon: true
  }
}`,...f.parameters?.docs?.source}}};x.parameters={...x.parameters,docs:{...x.parameters?.docs,source:{originalSource:`{
  args: {
    id: 'data-hora',
    name: 'data',
    label: 'Data e Hora',
    showTime: true,
    hourFormat: '24'
  }
}`,...x.parameters?.docs?.source}}};C.parameters={...C.parameters,docs:{...C.parameters?.docs,source:{originalSource:`{
  args: {
    id: 'data-desabilitada',
    name: 'data',
    label: 'Data',
    disabled: true
  }
}`,...C.parameters?.docs?.source}}};const K=["Default","Required","WithError","WithIcon","WithTime","Disabled"];export{b as Default,C as Disabled,g as Required,h as WithError,f as WithIcon,x as WithTime,K as __namedExportsOrder,J as default};
