import{b as h}from"./Utilities-Jli9PXBn.js";function I({disabilitato:e,inErrore:n,info:C}){const t=["form-control",e?"disabled":""].filter(Boolean).join(" ");return`<div class="form-group col-sm-4 noPaddingLeft">
	  <label class="control-label inail-label" id="label-number">Label</label>
	  <input type="text" aria-labelledby="label-number ${n?"input-error hint-number":""}"
		class="${t} inail-input ${n?"inail-input-error":""}" 
		id="form-input-1" 
		placeholder="Placeholder" 
		value="" 
		${e?"disabled":""} 
		oninput="validateInput(this)">
	  <span id="error-message" class="inail-span-error" style="display: ${n?"block":"none"};">
		<i class="fa-solid fa-circle-exclamation"></i>  Messaggio d'errore
	  </span>
	  <span class="inail-span-ht" id="hint-number" style="display: ${n?"block":"none"};">*Testo di aiuto</span>
	</div>

	<span class="sr-only" id="input-error">Messaggio d'errore</span>
  
	<script>
	  function validateInput(input) {
		const errorMessage = input.parentElement.querySelector(".inail-span-error");
		const value = input.value.trim();
  
		// If empty, remove the error message
		if (value === "") {
		  errorMessage.style.display = "none";
		  input.classList.remove("inail-input-error");
		  return;
		}
  
		// Check if input is a valid number
		if (isNaN(value)) {
		  errorMessage.style.display = "inline";
		  input.classList.add("inail-input-error");
		} else {
		  errorMessage.style.display = "none";
		  input.classList.remove("inail-input-error");
		}
	  }
	<\/script>
	`}function L(){return`<div class="form-group col-sm-4 noPaddingLeft">
	 <label class="control-label inail-label" for="form-input-1-disabled">Label</label>
	 <input type="text" class="form-control disabled inail-input" id="form-input-1-disabled" placeholder="Placeholder" disabled>
  </div>`}function E(){return I({disabilitato:!1,inErrore:!0,info:!1})}function M({disabilitato:e,inErrore:n,info:C}){const t=["form-control",e?"disabled":""].filter(Boolean).join(" ");return`<div class="form-group col-sm-4 noPaddingLeft">
		<label class="control-label inail-label" id="label-number-info">Label</label>
		<span role="button" aria-label="Etichetta del campo" tabindex="0" 
		  class="fa fa-question-circle fa-lg" 
		  data-toggle="popover" 
		  data-original-title="Etichetta del campo" 
		  data-trigger="focus" 
		  data-content="Inserire un suggerimento o una descrizione relativa a questo campo.">
		</span>
		
		<input type="text" aria-labelledby="label-number-info ${n?"input-error input-info":"input-info"}"
		  class="${t} inail-input ${n?"inail-input-error":""}" 
		  id="form-input-info" 
		  placeholder="Placeholder" 
		  value="" 
		  ${e?"disabled":""} 
		  oninput="validateInput(this)">
	
		<span id="error-message" class="inail-span-error" style="display: ${n?"inline":"none"};">
		  <i class="fa-solid fa-circle-exclamation"></i>  Messaggio d'errore
		</span>
		<span id="input-info" class="inail-span-ht">*Testo di aiuto</span>
		<span class="sr-only" id="input-error">Messaggio d'errore</span>
	  </div>
	
	  <script>
		function validateInput(input) {
		  const errorMessage = input.parentElement.querySelector(".inail-span-error");
		  const value = input.value.trim();
	
		  // If empty, remove the error message
		  if (value === "") {
			errorMessage.style.display = "none";
			input.classList.remove("inail-input-error");
			return;
		  }
	
		  // Check if input is a valid number
		  if (isNaN(value)) {
			errorMessage.style.display = "inline";
			input.classList.add("inail-input-error");
		  } else {
			errorMessage.style.display = "none";
			input.classList.remove("inail-input-error");
		  }
		}
	  <\/script>
	  `}const $={title:"Componenti/Form Items/Input number",decorators:[(e,n)=>h(e,n,4,["static-webkit/js/custom-webkit.js","assets/js/custom-input-number.js"],!0),e=>`<main id="contenutoPrincipale">${e()}</main>`]},r={name:"Campo di input numerico",argTypes:{disabilitato:{control:"boolean"},inErrore:{control:"boolean"},info:{control:"boolean"}},args:{disabilitato:!1,inErrore:!1,info:!1},render:e=>I(e)},a={name:"Campo di input numerico disabilitato",render:()=>L()},i={name:"Campo di input numerico con errore",render:()=>E()},o={argTypes:{disabilitato:{control:"boolean"},inErrore:{control:"boolean"},info:{control:"boolean"}},args:{disabilitato:!1,inErrore:!1,info:!0},name:"Campo di input numerico di info",render:e=>M(e)};var s,l,p;r.parameters={...r.parameters,docs:{...(s=r.parameters)==null?void 0:s.docs,source:{originalSource:`{
  name: "Campo di input numerico",
  argTypes: {
    disabilitato: {
      control: "boolean"
    },
    inErrore: {
      control: "boolean"
    },
    info: {
      control: "boolean"
    }
  },
  args: {
    disabilitato: false,
    inErrore: false,
    info: false
  },
  render: args => CreateInputNumber(args)
}`,...(p=(l=r.parameters)==null?void 0:l.docs)==null?void 0:p.source}}};var u,c,d;a.parameters={...a.parameters,docs:{...(u=a.parameters)==null?void 0:u.docs,source:{originalSource:`{
  name: "Campo di input numerico disabilitato",
  render: () => createInputNumberDisabled()
}`,...(d=(c=a.parameters)==null?void 0:c.docs)==null?void 0:d.source}}};var m,b,f;i.parameters={...i.parameters,docs:{...(m=i.parameters)==null?void 0:m.docs,source:{originalSource:`{
  name: "Campo di input numerico con errore",
  render: () => createInputNumberError()
}`,...(f=(b=i.parameters)==null?void 0:b.docs)==null?void 0:f.source}}};var g,y,v;o.parameters={...o.parameters,docs:{...(g=o.parameters)==null?void 0:g.docs,source:{originalSource:`{
  argTypes: {
    disabilitato: {
      control: "boolean"
    },
    inErrore: {
      control: "boolean"
    },
    info: {
      control: "boolean"
    }
  },
  args: {
    disabilitato: false,
    inErrore: false,
    info: true
  },
  name: "Campo di input numerico di info",
  render: args => createInputNumberInfo(args)
}`,...(v=(y=o.parameters)==null?void 0:y.docs)==null?void 0:v.source}}};const x=["CampiInput","CampiInputDisabled","CampiInputError","CampiInputInfo"];export{r as CampiInput,a as CampiInputDisabled,i as CampiInputError,o as CampiInputInfo,x as __namedExportsOrder,$ as default};
