inconel 0.1.18 → 0.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),u=require("react"),ve=require("../FieldFeedback/FieldFeedback.cjs");;/* empty css */;/* empty css */;/* empty css */;/* empty css */const i=require("./utils.cjs"),Ve=u.forwardRef(function({id:J,label:d,hint:E,errorMessage:O,startAdornment:R,endAdornment:w,fullWidth:S=!1,inputClassName:Q,labelClassName:x,className:y,required:b,disabled:h,value:B,defaultValue:U="",onChange:v,onBlur:X,onFocus:Z,onKeyDown:W,onMouseEnter:A,onMouseLeave:ee,type:n="text",locale:f="tr-TR",currency:V="TRY",decimalScale:j=0,roundMode:ne="floor",roundOnBlur:re=!1,min:T,max:N,allowNegative:$=!1,debounceMs:D=0,validateOnSubmit:z=!1,validationMessages:ie,mask:s,limit:m,isClearable:oe=!1,readOnly:te=!1,clearButtonLabel:L,readOnlyEmptyValue:le=null,size:P="md",variant:ue="outlined",autoComplete:se="off","aria-describedby":ae,...ce},de){const fe=u.useId(),I=J??`inconel-input-${fe.replace(/:/g,"")}`,C=`${I}-hint`,K=`${I}-error`,Y=B!==void 0,[pe,he]=u.useState(U),t=Y?B:pe,[k,F]=u.useState(""),[je,G]=u.useState(!1),[me,M]=u.useState(null),a=u.useRef(null),Ie=ie??{},p=O??me,g=e=>i.validateInputValue(e,{required:!!b,type:n,min:T,max:N,mask:s,messages:Ie}),q=u.useMemo(()=>i.formatInputValue(t,n,f,j,V,s),[t,V,j,f,s,n]),c=(e,r,l=null)=>({rawValue:e,formattedValue:i.formatInputValue(e,n,f,j,V,s),error:!!g(e),char:l,eventType:r}),_=(e,r=!1)=>{Y||he(e.rawValue),a.current&&clearTimeout(a.current),v&&(r||D<=0?v(e):a.current=setTimeout(()=>v(e),D))};u.useEffect(()=>()=>{a.current&&clearTimeout(a.current)},[]),u.useEffect(()=>{z&&M(g(t))},[z]);const H=e=>{if(n==="phone"&&s)return e.replace(/\D/g,"");if(i.isFormattedInputType(n)){const r=i.parseInputNumber(e,f);return r===null?e===""?null:e:$?r:Math.abs(r)}return e},ge=e=>{const r=e.replace(/\D/g,"");if(m&&(i.isFormattedInputType(n)||n==="phone")&&r.length>m||m&&i.isLengthValidatedInputType(n)&&e.length>m)return;const l=H(e);typeof l=="number"&&(typeof T=="number"&&l<T||typeof N=="number"&&l>N)||(F(n==="phone"&&s?i.applyInputMask(l,s):e),_(c(l,"change",e.slice(-1)||null)))},be=[ae,E&&!p?C:void 0,p?K:void 0].filter(Boolean).join(" ")||void 0;return te?o.jsxs("div",{className:["inconel-field",`inconel-size-${P}`,S?"inconel-field--full-width":"",y??""].join(" "),children:[d&&o.jsx("span",{className:["inconel-field__label",x??""].join(" "),children:d}),o.jsx("div",{className:"inconel-input-readonly","aria-label":d,children:q||le})]}):o.jsxs("div",{className:["inconel-field",`inconel-size-${P}`,S?"inconel-field--full-width":"",y??""].join(" "),children:[d&&o.jsxs("label",{className:["inconel-field__label",x??""].join(" "),htmlFor:I,children:[d,b&&o.jsx("span",{className:"inconel-field__required","aria-hidden":"true",children:" *"})]}),o.jsxs("div",{className:["inconel-input-control",ue==="plain"?"inconel-input-control--plain":"",p?"inconel-is-invalid":"",h?"inconel-is-disabled":""].join(" "),children:[R&&o.jsx("span",{className:"inconel-input-adornment","aria-hidden":"true",children:R}),o.jsx("input",{...ce,ref:de,id:I,type:n==="password"||n==="email"?n:"text",inputMode:i.isFormattedInputType(n)?"decimal":n==="phone"?"tel":void 0,value:je?k:q,required:b,disabled:h,autoComplete:se,"aria-invalid":!!p,"aria-describedby":be,className:["inconel-input",Q??""].join(" "),onChange:e=>ge(e.target.value),onFocus:e=>{if(h)return;G(!0);const r=n==="phone"&&s?i.applyInputMask(t,s):i.isFormattedInputType(n)?String(t??"").replace(".",i.getInputSeparators(f).decimal):String(t??"");F(r),Z?.(c(t,"focus"),e)},onBlur:e=>{G(!1),a.current&&clearTimeout(a.current);let r=H(k);typeof r=="number"&&(r=i.roundInputNumber(r,j,re?ne:"floor")),M(g(r));const l=c(r,"blur");_(l,!0),X?.(l,e)},onKeyDown:e=>{!$&&(e.key==="-"||e.key==="Subtract")&&e.preventDefault(),W?.(c(t,"keydown",e.key),e)},onMouseEnter:e=>A?.(c(t,"mouseenter"),e),onMouseLeave:e=>ee?.(c(t,"mouseleave"),e)}),oe&&!h&&q&&L&&o.jsx("button",{type:"button",className:"inconel-input-clear","aria-label":L,onClick:()=>{F(""),M(g(null)),_(c(null,"clear"),!0)},children:"×"}),w&&o.jsx("span",{className:"inconel-input-adornment","aria-hidden":"true",children:w})]}),o.jsx(ve.default,{hint:E,errorMessage:p,hintId:C,errorId:K})]})});exports.default=Ve;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),u=require("react"),Ve=require("../FieldFeedback/FieldFeedback.cjs");;/* empty css */;/* empty css */;/* empty css */;/* empty css */const i=require("./utils.cjs"),Ne=require("../../adapters/context.cjs"),qe=u.forwardRef(function({id:H,label:d,hint:B,errorMessage:J,startAdornment:E,endAdornment:R,fullWidth:S=!1,inputClassName:O,labelClassName:w,className:x,required:b,disabled:h,value:y,defaultValue:Q="",onChange:v,onBlur:U,onFocus:X,onKeyDown:Z,onMouseEnter:A,onMouseLeave:W,type:n="text",locale:f="tr-TR",currency:T="TRY",decimalScale:m=0,roundMode:ee="floor",roundOnBlur:ne=!1,min:V,max:N,allowNegative:$=!1,debounceMs:z=0,validateOnSubmit:D=!1,validationMessages:re,mask:s,limit:j,isClearable:ie=!1,readOnly:te=!1,clearButtonLabel:oe,readOnlyEmptyValue:le=null,size:L="md",variant:ue="outlined",autoComplete:se="off","aria-describedby":ae,...ce},de){const fe=Ne.useInconelAdapters(),pe=oe??String(fe.translate?.("clear","Temizle")??"Temizle"),he=u.useId(),I=H??`inconel-input-${he.replace(/:/g,"")}`,C=`${I}-hint`,P=`${I}-error`,K=y!==void 0,[me,je]=u.useState(Q),o=K?y:me,[Y,q]=u.useState(""),[Ie,k]=u.useState(!1),[ge,F]=u.useState(null),a=u.useRef(null),be=re??{},p=J??ge,g=e=>i.validateInputValue(e,{required:!!b,type:n,min:V,max:N,mask:s,messages:be}),M=u.useMemo(()=>i.formatInputValue(o,n,f,m,T,s),[o,T,m,f,s,n]),c=(e,r,l=null)=>({rawValue:e,formattedValue:i.formatInputValue(e,n,f,m,T,s),error:!!g(e),char:l,eventType:r}),_=(e,r=!1)=>{K||je(e.rawValue),a.current&&clearTimeout(a.current),v&&(r||z<=0?v(e):a.current=setTimeout(()=>v(e),z))};u.useEffect(()=>()=>{a.current&&clearTimeout(a.current)},[]),u.useEffect(()=>{D&&F(g(o))},[D]);const G=e=>{if(n==="phone"&&s)return e.replace(/\D/g,"");if(i.isFormattedInputType(n)){const r=i.parseInputNumber(e,f);return r===null?e===""?null:e:$?r:Math.abs(r)}return e},ve=e=>{const r=e.replace(/\D/g,"");if(j&&(i.isFormattedInputType(n)||n==="phone")&&r.length>j||j&&i.isLengthValidatedInputType(n)&&e.length>j)return;const l=G(e);typeof l=="number"&&(typeof V=="number"&&l<V||typeof N=="number"&&l>N)||(q(n==="phone"&&s?i.applyInputMask(l,s):e),_(c(l,"change",e.slice(-1)||null)))},Te=[ae,B&&!p?C:void 0,p?P:void 0].filter(Boolean).join(" ")||void 0;return te?t.jsxs("div",{className:["inconel-field",`inconel-size-${L}`,S?"inconel-field--full-width":"",x??""].join(" "),children:[d&&t.jsx("span",{className:["inconel-field__label",w??""].join(" "),children:d}),t.jsx("div",{className:"inconel-input-readonly","aria-label":d,children:M||le})]}):t.jsxs("div",{className:["inconel-field",`inconel-size-${L}`,S?"inconel-field--full-width":"",x??""].join(" "),children:[d&&t.jsxs("label",{className:["inconel-field__label",w??""].join(" "),htmlFor:I,children:[d,b&&t.jsx("span",{className:"inconel-field__required","aria-hidden":"true",children:" *"})]}),t.jsxs("div",{className:["inconel-input-control",ue==="plain"?"inconel-input-control--plain":"",p?"inconel-is-invalid":"",h?"inconel-is-disabled":""].join(" "),children:[E&&t.jsx("span",{className:"inconel-input-adornment","aria-hidden":"true",children:E}),t.jsx("input",{...ce,ref:de,id:I,type:n==="password"||n==="email"?n:"text",inputMode:i.isFormattedInputType(n)?"decimal":n==="phone"?"tel":void 0,value:Ie?Y:M,required:b,disabled:h,autoComplete:se,"aria-invalid":!!p,"aria-describedby":Te,className:["inconel-input",O??""].join(" "),onChange:e=>ve(e.target.value),onFocus:e=>{if(h)return;k(!0);const r=n==="phone"&&s?i.applyInputMask(o,s):i.isFormattedInputType(n)?String(o??"").replace(".",i.getInputSeparators(f).decimal):String(o??"");q(r),X?.(c(o,"focus"),e)},onBlur:e=>{k(!1),a.current&&clearTimeout(a.current);let r=G(Y);typeof r=="number"&&(r=i.roundInputNumber(r,m,ne?ee:"floor")),F(g(r));const l=c(r,"blur");_(l,!0),U?.(l,e)},onKeyDown:e=>{!$&&(e.key==="-"||e.key==="Subtract")&&e.preventDefault(),Z?.(c(o,"keydown",e.key),e)},onMouseEnter:e=>A?.(c(o,"mouseenter"),e),onMouseLeave:e=>W?.(c(o,"mouseleave"),e)}),ie&&!h&&M&&t.jsx("button",{type:"button",className:"inconel-input-clear","aria-label":pe,onClick:()=>{q(""),F(g(null)),_(c(null,"clear"),!0)},children:"×"}),R&&t.jsx("span",{className:"inconel-input-adornment","aria-hidden":"true",children:R})]}),t.jsx(Ve.default,{hint:B,errorMessage:p,hintId:C,errorId:P})]})});exports.default=qe;
2
2
  //# sourceMappingURL=Input.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Input.cjs","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type FocusEvent,\n type InputHTMLAttributes,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n} from 'react'\n\nimport FieldFeedback from '../FieldFeedback/FieldFeedback'\nimport type { FieldFeedbackContentProps } from '../FieldFeedback/FieldFeedback'\nimport '../shared/field.css'\nimport '../shared/field-controls.css'\nimport '../shared/sizes.css'\nimport type { ControlSize } from '../shared/types'\nimport './styles.css'\nimport {\n applyInputMask,\n formatInputValue,\n getInputSeparators,\n isFormattedInputType,\n isLengthValidatedInputType,\n parseInputNumber,\n roundInputNumber,\n validateInputValue,\n} from './utils'\n\nexport type InputType =\n | 'text'\n | 'number'\n | 'currency'\n | 'percent'\n | 'phone'\n | 'email'\n | 'password'\n\nexport type InputRoundMode = 'ceil' | 'floor' | 'round'\nexport type InputValue = string | number | null\nexport type InputEventType =\n | 'change'\n | 'blur'\n | 'focus'\n | 'keydown'\n | 'mouseenter'\n | 'mouseleave'\n | 'clear'\n\nexport interface InputPayload {\n rawValue: InputValue\n formattedValue: string\n error: boolean\n char: string | null\n eventType: InputEventType\n}\n\nexport interface InputValidationMessages {\n required?: string\n invalidNumber?: string\n minNumber?: string\n maxNumber?: string\n minLength?: string\n maxLength?: string\n invalidPhone?: string\n invalidEmail?: string\n}\n\ntype NativeInputProps = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n | 'type'\n | 'value'\n | 'defaultValue'\n | 'onChange'\n | 'onBlur'\n | 'onFocus'\n | 'onKeyDown'\n | 'onMouseEnter'\n | 'onMouseLeave'\n | 'min'\n | 'max'\n | 'size'\n | 'readOnly'\n>\n\nexport interface InputProps extends NativeInputProps, FieldFeedbackContentProps {\n label?: string\n startAdornment?: ReactNode\n endAdornment?: ReactNode\n fullWidth?: boolean\n inputClassName?: string\n labelClassName?: string\n value?: InputValue\n defaultValue?: InputValue\n onChange?: (payload: InputPayload) => void\n onBlur?: (payload: InputPayload, event: FocusEvent<HTMLInputElement>) => void\n onFocus?: (payload: InputPayload, event: FocusEvent<HTMLInputElement>) => void\n onKeyDown?: (\n payload: InputPayload,\n event: KeyboardEvent<HTMLInputElement>,\n ) => void\n onMouseEnter?: (\n payload: InputPayload,\n event: MouseEvent<HTMLInputElement>,\n ) => void\n onMouseLeave?: (\n payload: InputPayload,\n event: MouseEvent<HTMLInputElement>,\n ) => void\n type?: InputType\n locale?: string\n currency?: string\n decimalScale?: number\n roundMode?: InputRoundMode\n roundOnBlur?: boolean\n min?: number\n max?: number\n allowNegative?: boolean\n debounceMs?: number\n validateOnSubmit?: boolean\n validationMessages?: InputValidationMessages\n mask?: string\n limit?: number\n isClearable?: boolean\n readOnly?: boolean\n clearButtonLabel?: string\n readOnlyEmptyValue?: ReactNode\n size?: ControlSize\n variant?: 'outlined' | 'plain'\n}\n\nconst Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n id,\n label,\n hint,\n errorMessage,\n startAdornment,\n endAdornment,\n fullWidth = false,\n inputClassName,\n labelClassName,\n className,\n required,\n disabled,\n value,\n defaultValue = '',\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n onMouseEnter,\n onMouseLeave,\n type = 'text',\n locale = 'tr-TR',\n currency = 'TRY',\n decimalScale = 0,\n roundMode = 'floor',\n roundOnBlur = false,\n min,\n max,\n allowNegative = false,\n debounceMs = 0,\n validateOnSubmit = false,\n validationMessages,\n mask,\n limit,\n isClearable = false,\n readOnly = false,\n clearButtonLabel,\n readOnlyEmptyValue = null,\n size = 'md',\n variant = 'outlined',\n autoComplete = 'off',\n 'aria-describedby': ariaDescribedBy,\n ...inputProps\n },\n ref,\n) {\n const generatedId = useId()\n const inputId = id ?? `inconel-input-${generatedId.replace(/:/g, '')}`\n const hintId = `${inputId}-hint`\n const errorId = `${inputId}-error`\n const controlled = value !== undefined\n const [localValue, setLocalValue] = useState<InputValue>(defaultValue)\n const currentValue = controlled ? value : localValue\n const [editingValue, setEditingValue] = useState('')\n const [focused, setFocused] = useState(false)\n const [validationError, setValidationError] = useState<string | null>(null)\n const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n const messages = validationMessages ?? {}\n const visibleError = errorMessage ?? validationError\n\n const validate = (candidate: InputValue) =>\n validateInputValue(candidate, {\n required: Boolean(required),\n type,\n min,\n max,\n mask,\n messages,\n })\n\n const formattedValue = useMemo(\n () =>\n formatInputValue(\n currentValue,\n type,\n locale,\n decimalScale,\n currency,\n mask,\n ),\n [currentValue, currency, decimalScale, locale, mask, type],\n )\n\n const buildPayload = (\n rawValue: InputValue,\n eventType: InputEventType,\n char: string | null = null,\n ): InputPayload => ({\n rawValue,\n formattedValue: formatInputValue(\n rawValue,\n type,\n locale,\n decimalScale,\n currency,\n mask,\n ),\n error: Boolean(validate(rawValue)),\n char,\n eventType,\n })\n\n const emitChange = (payload: InputPayload, immediate = false) => {\n if (!controlled) setLocalValue(payload.rawValue)\n if (debounceRef.current) clearTimeout(debounceRef.current)\n if (!onChange) return\n if (immediate || debounceMs <= 0) onChange(payload)\n else debounceRef.current = setTimeout(() => onChange(payload), debounceMs)\n }\n\n useEffect(() => () => {\n if (debounceRef.current) clearTimeout(debounceRef.current)\n }, [])\n\n useEffect(() => {\n if (validateOnSubmit) setValidationError(validate(currentValue))\n // Validation intentionally runs when submit state changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [validateOnSubmit])\n\n const normalize = (text: string): InputValue => {\n if (type === 'phone' && mask) return text.replace(/\\D/g, '')\n if (isFormattedInputType(type)) {\n const parsed = parseInputNumber(text, locale)\n if (parsed === null) return text === '' ? null : text\n return allowNegative ? parsed : Math.abs(parsed)\n }\n return text\n }\n\n const handleChange = (text: string) => {\n const digits = text.replace(/\\D/g, '')\n if (\n limit &&\n (isFormattedInputType(type) || type === 'phone') &&\n digits.length > limit\n ) return\n if (limit && isLengthValidatedInputType(type) && text.length > limit) return\n const rawValue = normalize(text)\n if (typeof rawValue === 'number') {\n if (typeof min === 'number' && rawValue < min) return\n if (typeof max === 'number' && rawValue > max) return\n }\n setEditingValue(\n type === 'phone' && mask ? applyInputMask(rawValue, mask) : text,\n )\n emitChange(buildPayload(rawValue, 'change', text.slice(-1) || null))\n }\n\n const describedBy = [\n ariaDescribedBy,\n hint && !visibleError ? hintId : undefined,\n visibleError ? errorId : undefined,\n ].filter(Boolean).join(' ') || undefined\n\n if (readOnly) {\n return (\n <div className={['inconel-field', `inconel-size-${size}`, fullWidth ? 'inconel-field--full-width' : '', className ?? ''].join(' ')}>\n {label && <span className={['inconel-field__label', labelClassName ?? ''].join(' ')}>{label}</span>}\n <div className=\"inconel-input-readonly\" aria-label={label}>\n {formattedValue || readOnlyEmptyValue}\n </div>\n </div>\n )\n }\n\n return (\n <div className={['inconel-field', `inconel-size-${size}`, fullWidth ? 'inconel-field--full-width' : '', className ?? ''].join(' ')}>\n {label && (\n <label className={['inconel-field__label', labelClassName ?? ''].join(' ')} htmlFor={inputId}>\n {label}{required && <span className=\"inconel-field__required\" aria-hidden=\"true\"> *</span>}\n </label>\n )}\n <div className={['inconel-input-control', variant === 'plain' ? 'inconel-input-control--plain' : '', visibleError ? 'inconel-is-invalid' : '', disabled ? 'inconel-is-disabled' : ''].join(' ')}>\n {startAdornment && <span className=\"inconel-input-adornment\" aria-hidden=\"true\">{startAdornment}</span>}\n <input\n {...inputProps}\n ref={ref}\n id={inputId}\n type={type === 'password' || type === 'email' ? type : 'text'}\n inputMode={isFormattedInputType(type) ? 'decimal' : type === 'phone' ? 'tel' : undefined}\n value={focused ? editingValue : formattedValue}\n required={required}\n disabled={disabled}\n autoComplete={autoComplete}\n aria-invalid={Boolean(visibleError)}\n aria-describedby={describedBy}\n className={['inconel-input', inputClassName ?? ''].join(' ')}\n onChange={(event) => handleChange(event.target.value)}\n onFocus={(event) => {\n if (disabled) return\n setFocused(true)\n const editValue = type === 'phone' && mask\n ? applyInputMask(currentValue, mask)\n : isFormattedInputType(type)\n ? String(currentValue ?? '').replace('.', getInputSeparators(locale).decimal)\n : String(currentValue ?? '')\n setEditingValue(editValue)\n onFocus?.(buildPayload(currentValue, 'focus'), event)\n }}\n onBlur={(event) => {\n setFocused(false)\n if (debounceRef.current) clearTimeout(debounceRef.current)\n let rawValue = normalize(editingValue)\n if (typeof rawValue === 'number') {\n rawValue = roundInputNumber(rawValue, decimalScale, roundOnBlur ? roundMode : 'floor')\n }\n setValidationError(validate(rawValue))\n const payload = buildPayload(rawValue, 'blur')\n emitChange(payload, true)\n onBlur?.(payload, event)\n }}\n onKeyDown={(event) => {\n if (!allowNegative && (event.key === '-' || event.key === 'Subtract')) event.preventDefault()\n onKeyDown?.(buildPayload(currentValue, 'keydown', event.key), event)\n }}\n onMouseEnter={(event) => onMouseEnter?.(buildPayload(currentValue, 'mouseenter'), event)}\n onMouseLeave={(event) => onMouseLeave?.(buildPayload(currentValue, 'mouseleave'), event)}\n />\n {isClearable && !disabled && formattedValue && clearButtonLabel && (\n <button\n type=\"button\"\n className=\"inconel-input-clear\"\n aria-label={clearButtonLabel}\n onClick={() => {\n setEditingValue('')\n setValidationError(validate(null))\n emitChange(buildPayload(null, 'clear'), true)\n }}\n >\n ×\n </button>\n )}\n {endAdornment && <span className=\"inconel-input-adornment\" aria-hidden=\"true\">{endAdornment}</span>}\n </div>\n <FieldFeedback\n hint={hint}\n errorMessage={visibleError}\n hintId={hintId}\n errorId={errorId}\n />\n </div>\n )\n})\n\nexport default Input\n"],"names":["Input","forwardRef","id","label","hint","errorMessage","startAdornment","endAdornment","fullWidth","inputClassName","labelClassName","className","required","disabled","value","defaultValue","onChange","onBlur","onFocus","onKeyDown","onMouseEnter","onMouseLeave","type","locale","currency","decimalScale","roundMode","roundOnBlur","min","max","allowNegative","debounceMs","validateOnSubmit","validationMessages","mask","limit","isClearable","readOnly","clearButtonLabel","readOnlyEmptyValue","size","variant","autoComplete","ariaDescribedBy","inputProps","ref","generatedId","useId","inputId","hintId","errorId","controlled","localValue","setLocalValue","useState","currentValue","editingValue","setEditingValue","focused","setFocused","validationError","setValidationError","debounceRef","useRef","messages","visibleError","validate","candidate","validateInputValue","formattedValue","useMemo","formatInputValue","buildPayload","rawValue","eventType","char","emitChange","payload","immediate","useEffect","normalize","text","isFormattedInputType","parsed","parseInputNumber","handleChange","digits","isLengthValidatedInputType","applyInputMask","describedBy","jsx","jsxs","event","editValue","getInputSeparators","roundInputNumber","FieldFeedback"],"mappings":"kYAsIMA,GAAQC,EAAAA,WAAyC,SACrD,CACE,GAAAC,EACA,MAAAC,EACA,KAAAC,EACA,aAAAC,EACA,eAAAC,EACA,aAAAC,EACA,UAAAC,EAAY,GACZ,eAAAC,EACA,eAAAC,EACA,UAAAC,EACA,SAAAC,EACA,SAAAC,EACA,MAAAC,EACA,aAAAC,EAAe,GACf,SAAAC,EACA,OAAAC,EACA,QAAAC,EACA,UAAAC,EACA,aAAAC,EACA,aAAAC,GACA,KAAAC,EAAO,OACP,OAAAC,EAAS,QACT,SAAAC,EAAW,MACX,aAAAC,EAAe,EACf,UAAAC,GAAY,QACZ,YAAAC,GAAc,GACd,IAAAC,EACA,IAAAC,EACA,cAAAC,EAAgB,GAChB,WAAAC,EAAa,EACb,iBAAAC,EAAmB,GACnB,mBAAAC,GACA,KAAAC,EACA,MAAAC,EACA,YAAAC,GAAc,GACd,SAAAC,GAAW,GACX,iBAAAC,EACA,mBAAAC,GAAqB,KACrB,KAAAC,EAAO,KACP,QAAAC,GAAU,WACV,aAAAC,GAAe,MACf,mBAAoBC,GACpB,GAAGC,EACL,EACAC,GACA,CACA,MAAMC,GAAcC,EAAAA,MAAA,EACdC,EAAU9C,GAAM,iBAAiB4C,GAAY,QAAQ,KAAM,EAAE,CAAC,GAC9DG,EAAS,GAAGD,CAAO,QACnBE,EAAU,GAAGF,CAAO,SACpBG,EAAarC,IAAU,OACvB,CAACsC,GAAYC,EAAa,EAAIC,EAAAA,SAAqBvC,CAAY,EAC/DwC,EAAeJ,EAAarC,EAAQsC,GACpC,CAACI,EAAcC,CAAe,EAAIH,EAAAA,SAAS,EAAE,EAC7C,CAACI,GAASC,CAAU,EAAIL,EAAAA,SAAS,EAAK,EACtC,CAACM,GAAiBC,CAAkB,EAAIP,EAAAA,SAAwB,IAAI,EACpEQ,EA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AY,EACjC,OAAOiB,GAAa,WACtBA,EAAWsB,EAAAA,iBAAiBtB,EAAUhD,EAAcE,GAAcD,GAAY,OAAO,GAEvFmC,EAAmBK,EAASO,CAAQ,CAAC,EACrC,MAAMI,EAAUL,EAAaC,EAAU,MAAM,EAC7CG,EAAWC,EAAS,EAAI,EACxB5D,IAAS4D,EAASe,CAAK,CACzB,EACA,UAAYA,GAAU,CAChB,CAAC9D,IAAkB8D,EAAM,MAAQ,KAAOA,EAAM,MAAQ,aAAaA,EAAM,eAAA,EAC7EzE,IAAYqD,EAAajB,EAAc,UAAWqC,EAAM,GAAG,EAAGA,CAAK,CACrE,EACA,aAAeA,GAAUxE,IAAeoD,EAAajB,EAAc,YAAY,EAAGqC,CAAK,EACvF,aAAeA,GAAUvE,KAAemD,EAAajB,EAAc,YAAY,EAAGqC,CAAK,CAAA,CAAA,EAExFxD,IAAe,CAACvB,GAAYwD,GAAkB/B,GAC7CoD,EAAAA,IAAC,SAAA,CACC,KAAK,SACL,UAAU,sBACV,aAAYpD,EACZ,QAAS,IAAM,CACbmB,EAAgB,EAAE,EAClBI,EAAmBK,EAAS,IAAI,CAAC,EACjCU,EAAWJ,EAAa,KAAM,OAAO,EAAG,EAAI,CAC9C,EACD,SAAA,GAAA,CAAA,EAIFjE,GAAgBmF,EAAAA,IAAC,OAAA,CAAK,UAAU,0BAA0B,cAAY,OAAQ,SAAAnF,CAAA,CAAa,CAAA,EAC9F,EACAmF,EAAAA,IAACM,GAAAA,QAAA,CACC,KAAA5F,EACA,aAAc6D,EACd,OAAAhB,EACA,QAAAC,CAAA,CAAA,CACF,EACF,CAEJ,CAAC"}
1
+ {"version":3,"file":"Input.cjs","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type FocusEvent,\n type InputHTMLAttributes,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n} from 'react'\n\nimport { useInconelAdapters } from '../../adapters'\nimport FieldFeedback from '../FieldFeedback/FieldFeedback'\nimport type { FieldFeedbackContentProps } from '../FieldFeedback/FieldFeedback'\nimport '../shared/field.css'\nimport '../shared/field-controls.css'\nimport '../shared/sizes.css'\nimport type { ControlSize } from '../shared/types'\nimport './styles.css'\nimport {\n applyInputMask,\n formatInputValue,\n getInputSeparators,\n isFormattedInputType,\n isLengthValidatedInputType,\n parseInputNumber,\n roundInputNumber,\n validateInputValue,\n} from './utils'\n\nexport type InputType =\n | 'text'\n | 'number'\n | 'currency'\n | 'percent'\n | 'phone'\n | 'email'\n | 'password'\n\nexport type InputRoundMode = 'ceil' | 'floor' | 'round'\nexport type InputValue = string | number | null\nexport type InputEventType =\n | 'change'\n | 'blur'\n | 'focus'\n | 'keydown'\n | 'mouseenter'\n | 'mouseleave'\n | 'clear'\n\nexport interface InputPayload {\n rawValue: InputValue\n formattedValue: string\n error: boolean\n char: string | null\n eventType: InputEventType\n}\n\nexport interface InputValidationMessages {\n required?: string\n invalidNumber?: string\n minNumber?: string\n maxNumber?: string\n minLength?: string\n maxLength?: string\n invalidPhone?: string\n invalidEmail?: string\n}\n\ntype NativeInputProps = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n | 'type'\n | 'value'\n | 'defaultValue'\n | 'onChange'\n | 'onBlur'\n | 'onFocus'\n | 'onKeyDown'\n | 'onMouseEnter'\n | 'onMouseLeave'\n | 'min'\n | 'max'\n | 'size'\n | 'readOnly'\n>\n\nexport interface InputProps extends NativeInputProps, FieldFeedbackContentProps {\n label?: string\n startAdornment?: ReactNode\n endAdornment?: ReactNode\n fullWidth?: boolean\n inputClassName?: string\n labelClassName?: string\n value?: InputValue\n defaultValue?: InputValue\n onChange?: (payload: InputPayload) => void\n onBlur?: (payload: InputPayload, event: FocusEvent<HTMLInputElement>) => void\n onFocus?: (payload: InputPayload, event: FocusEvent<HTMLInputElement>) => void\n onKeyDown?: (\n payload: InputPayload,\n event: KeyboardEvent<HTMLInputElement>,\n ) => void\n onMouseEnter?: (\n payload: InputPayload,\n event: MouseEvent<HTMLInputElement>,\n ) => void\n onMouseLeave?: (\n payload: InputPayload,\n event: MouseEvent<HTMLInputElement>,\n ) => void\n type?: InputType\n locale?: string\n currency?: string\n decimalScale?: number\n roundMode?: InputRoundMode\n roundOnBlur?: boolean\n min?: number\n max?: number\n allowNegative?: boolean\n debounceMs?: number\n validateOnSubmit?: boolean\n validationMessages?: InputValidationMessages\n mask?: string\n limit?: number\n isClearable?: boolean\n readOnly?: boolean\n clearButtonLabel?: string\n readOnlyEmptyValue?: ReactNode\n size?: ControlSize\n variant?: 'outlined' | 'plain'\n}\n\nconst Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n id,\n label,\n hint,\n errorMessage,\n startAdornment,\n endAdornment,\n fullWidth = false,\n inputClassName,\n labelClassName,\n className,\n required,\n disabled,\n value,\n defaultValue = '',\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n onMouseEnter,\n onMouseLeave,\n type = 'text',\n locale = 'tr-TR',\n currency = 'TRY',\n decimalScale = 0,\n roundMode = 'floor',\n roundOnBlur = false,\n min,\n max,\n allowNegative = false,\n debounceMs = 0,\n validateOnSubmit = false,\n validationMessages,\n mask,\n limit,\n isClearable = false,\n readOnly = false,\n clearButtonLabel,\n readOnlyEmptyValue = null,\n size = 'md',\n variant = 'outlined',\n autoComplete = 'off',\n 'aria-describedby': ariaDescribedBy,\n ...inputProps\n },\n ref,\n) {\n const adapters = useInconelAdapters()\n const resolvedClearButtonLabel =\n clearButtonLabel ??\n String(adapters.translate?.('clear', 'Temizle') ?? 'Temizle')\n\n const generatedId = useId()\n const inputId = id ?? `inconel-input-${generatedId.replace(/:/g, '')}`\n const hintId = `${inputId}-hint`\n const errorId = `${inputId}-error`\n const controlled = value !== undefined\n const [localValue, setLocalValue] = useState<InputValue>(defaultValue)\n const currentValue = controlled ? value : localValue\n const [editingValue, setEditingValue] = useState('')\n const [focused, setFocused] = useState(false)\n const [validationError, setValidationError] = useState<string | null>(null)\n const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n const messages = validationMessages ?? {}\n const visibleError = errorMessage ?? validationError\n\n const validate = (candidate: InputValue) =>\n validateInputValue(candidate, {\n required: Boolean(required),\n type,\n min,\n max,\n mask,\n messages,\n })\n\n const formattedValue = useMemo(\n () =>\n formatInputValue(\n currentValue,\n type,\n locale,\n decimalScale,\n currency,\n mask,\n ),\n [currentValue, currency, decimalScale, locale, mask, type],\n )\n\n const buildPayload = (\n rawValue: InputValue,\n eventType: InputEventType,\n char: string | null = null,\n ): InputPayload => ({\n rawValue,\n formattedValue: formatInputValue(\n rawValue,\n type,\n locale,\n decimalScale,\n currency,\n mask,\n ),\n error: Boolean(validate(rawValue)),\n char,\n eventType,\n })\n\n const emitChange = (payload: InputPayload, immediate = false) => {\n if (!controlled) setLocalValue(payload.rawValue)\n if (debounceRef.current) clearTimeout(debounceRef.current)\n if (!onChange) return\n if (immediate || debounceMs <= 0) onChange(payload)\n else debounceRef.current = setTimeout(() => onChange(payload), debounceMs)\n }\n\n useEffect(() => () => {\n if (debounceRef.current) clearTimeout(debounceRef.current)\n }, [])\n\n useEffect(() => {\n if (validateOnSubmit) setValidationError(validate(currentValue))\n // Validation intentionally runs when submit state changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [validateOnSubmit])\n\n const normalize = (text: string): InputValue => {\n if (type === 'phone' && mask) return text.replace(/\\D/g, '')\n if (isFormattedInputType(type)) {\n const parsed = parseInputNumber(text, locale)\n if (parsed === null) return text === '' ? null : text\n return allowNegative ? parsed : Math.abs(parsed)\n }\n return text\n }\n\n const handleChange = (text: string) => {\n const digits = text.replace(/\\D/g, '')\n if (\n limit &&\n (isFormattedInputType(type) || type === 'phone') &&\n digits.length > limit\n ) return\n if (limit && isLengthValidatedInputType(type) && text.length > limit) return\n const rawValue = normalize(text)\n if (typeof rawValue === 'number') {\n if (typeof min === 'number' && rawValue < min) return\n if (typeof max === 'number' && rawValue > max) return\n }\n setEditingValue(\n type === 'phone' && mask ? applyInputMask(rawValue, mask) : text,\n )\n emitChange(buildPayload(rawValue, 'change', text.slice(-1) || null))\n }\n\n const describedBy = [\n ariaDescribedBy,\n hint && !visibleError ? hintId : undefined,\n visibleError ? errorId : undefined,\n ].filter(Boolean).join(' ') || undefined\n\n if (readOnly) {\n return (\n <div className={['inconel-field', `inconel-size-${size}`, fullWidth ? 'inconel-field--full-width' : '', className ?? ''].join(' ')}>\n {label && <span className={['inconel-field__label', labelClassName ?? ''].join(' ')}>{label}</span>}\n <div className=\"inconel-input-readonly\" aria-label={label}>\n {formattedValue || readOnlyEmptyValue}\n </div>\n </div>\n )\n }\n\n return (\n <div className={['inconel-field', `inconel-size-${size}`, fullWidth ? 'inconel-field--full-width' : '', className ?? ''].join(' ')}>\n {label && (\n <label className={['inconel-field__label', labelClassName ?? ''].join(' ')} htmlFor={inputId}>\n {label}{required && <span className=\"inconel-field__required\" aria-hidden=\"true\"> *</span>}\n </label>\n )}\n <div className={['inconel-input-control', variant === 'plain' ? 'inconel-input-control--plain' : '', visibleError ? 'inconel-is-invalid' : '', disabled ? 'inconel-is-disabled' : ''].join(' ')}>\n {startAdornment && <span className=\"inconel-input-adornment\" aria-hidden=\"true\">{startAdornment}</span>}\n <input\n {...inputProps}\n ref={ref}\n id={inputId}\n type={type === 'password' || type === 'email' ? type : 'text'}\n inputMode={isFormattedInputType(type) ? 'decimal' : type === 'phone' ? 'tel' : undefined}\n value={focused ? editingValue : formattedValue}\n required={required}\n disabled={disabled}\n autoComplete={autoComplete}\n aria-invalid={Boolean(visibleError)}\n aria-describedby={describedBy}\n className={['inconel-input', inputClassName ?? ''].join(' ')}\n onChange={(event) => handleChange(event.target.value)}\n onFocus={(event) => {\n if (disabled) return\n setFocused(true)\n const editValue = type === 'phone' && mask\n ? applyInputMask(currentValue, mask)\n : isFormattedInputType(type)\n ? String(currentValue ?? '').replace('.', getInputSeparators(locale).decimal)\n : String(currentValue ?? '')\n setEditingValue(editValue)\n onFocus?.(buildPayload(currentValue, 'focus'), event)\n }}\n onBlur={(event) => {\n setFocused(false)\n if (debounceRef.current) clearTimeout(debounceRef.current)\n let rawValue = normalize(editingValue)\n if (typeof rawValue === 'number') {\n rawValue = roundInputNumber(rawValue, decimalScale, roundOnBlur ? roundMode : 'floor')\n }\n setValidationError(validate(rawValue))\n const payload = buildPayload(rawValue, 'blur')\n emitChange(payload, true)\n onBlur?.(payload, event)\n }}\n onKeyDown={(event) => {\n if (!allowNegative && (event.key === '-' || event.key === 'Subtract')) event.preventDefault()\n onKeyDown?.(buildPayload(currentValue, 'keydown', event.key), event)\n }}\n onMouseEnter={(event) => onMouseEnter?.(buildPayload(currentValue, 'mouseenter'), event)}\n onMouseLeave={(event) => onMouseLeave?.(buildPayload(currentValue, 'mouseleave'), event)}\n />\n {isClearable && !disabled && formattedValue && (\n <button\n type=\"button\"\n className=\"inconel-input-clear\"\n aria-label={resolvedClearButtonLabel}\n onClick={() => {\n setEditingValue('')\n setValidationError(validate(null))\n emitChange(buildPayload(null, 'clear'), true)\n }}\n >\n ×\n </button>\n )}\n {endAdornment && <span className=\"inconel-input-adornment\" aria-hidden=\"true\">{endAdornment}</span>}\n </div>\n <FieldFeedback\n hint={hint}\n errorMessage={visibleError}\n hintId={hintId}\n errorId={errorId}\n />\n </div>\n )\n})\n\nexport default Input\n"],"names":["Input","forwardRef","id","label","hint","errorMessage","startAdornment","endAdornment","fullWidth","inputClassName","labelClassName","className","required","disabled","value","defaultValue","onChange","onBlur","onFocus","onKeyDown","onMouseEnter","onMouseLeave","type","locale","currency","decimalScale","roundMode","roundOnBlur","min","max","allowNegative","debounceMs","validateOnSubmit","validationMessages","mask","limit","isClearable","readOnly","clearButtonLabel","readOnlyEmptyValue","size","variant","autoComplete","ariaDescribedBy","inputProps","ref","adapters","useInconelAdapters","resolvedClearButtonLabel","generatedId","useId","inputId","hintId","errorId","controlled","localValue","setLocalValue","useState","currentValue","editingValue","setEditingValue","focused","setFocused","validationError","setValidationError","debounceRef","useRef","messages","visibleError","validate","candidate","validateInputValue","formattedValue","useMemo","formatInputValue","buildPayload","rawValue","eventType","char","emitChange","payload","immediate","useEffect","normalize","text","isFormattedInputType","parsed","parseInputNumber","handleChange","digits","isLengthValidatedInputType","applyInputMask","describedBy","jsx","jsxs","event","editValue","getInputSeparators","roundInputNumber","FieldFeedback"],"mappings":"2aAuIMA,GAAQC,EAAAA,WAAyC,SACrD,CACE,GAAAC,EACA,MAAAC,EACA,KAAAC,EACA,aAAAC,EACA,eAAAC,EACA,aAAAC,EACA,UAAAC,EAAY,GACZ,eAAAC,EACA,eAAAC,EACA,UAAAC,EACA,SAAAC,EACA,SAAAC,EACA,MAAAC,EACA,aAAAC,EAAe,GACf,SAAAC,EACA,OAAAC,EACA,QAAAC,EACA,UAAAC,EACA,aAAAC,EACA,aAAAC,EACA,KAAAC,EAAO,OACP,OAAAC,EAAS,QACT,SAAAC,EAAW,MACX,aAAAC,EAAe,EACf,UAAAC,GAAY,QACZ,YAAAC,GAAc,GACd,IAAAC,EACA,IAAAC,EACA,cAAAC,EAAgB,GAChB,WAAAC,EAAa,EACb,iBAAAC,EAAmB,GACnB,mBAAAC,GACA,KAAAC,EACA,MAAAC,EACA,YAAAC,GAAc,GACd,SAAAC,GAAW,GACX,iBAAAC,GACA,mBAAAC,GAAqB,KACrB,KAAAC,EAAO,KACP,QAAAC,GAAU,WACV,aAAAC,GAAe,MACf,mBAAoBC,GACpB,GAAGC,EACL,EACAC,GACA,CACA,MAAMC,GAAWC,GAAAA,mBAAA,EACXC,GACJV,IACA,OAAOQ,GAAS,YAAY,QAAS,SAAS,GAAK,SAAS,EAExDG,GAAcC,EAAAA,MAAA,EACdC,EAAUjD,GAAM,iBAAiB+C,GAAY,QAAQ,KAAM,EAAE,CAAC,GAC9DG,EAAS,GAAGD,CAAO,QACnBE,EAAU,GAAGF,CAAO,SACpBG,EAAaxC,IAAU,OACvB,CAACyC,GAAYC,EAAa,EAAIC,EAAAA,SAAqB1C,CAAY,EAC/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kBAAkB,CAAC,EAAE,uBAAuB,CAAA;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,kBAAkB,CAAC,EAAE,SAAS,CAAA;IAC9B,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAA;CAC/B;AAED,QAAA,MAAM,KAAK,yGA0PT,CAAA;AAEF,eAAe,KAAK,CAAA"}
@@ -1,118 +1,119 @@
1
1
  import { jsxs as b, jsx as t } from "react/jsx-runtime";
2
- import { forwardRef as we, useId as Ee, useState as I, useRef as Fe, useMemo as Me, useEffect as X } from "react";
3
- import _e from "../FieldFeedback/FieldFeedback.js";
2
+ import { forwardRef as Ee, useId as Fe, useState as I, useRef as Me, useMemo as _e, useEffect as U } from "react";
3
+ import Re from "../FieldFeedback/FieldFeedback.js";
4
4
  /* empty css */
5
5
  /* empty css */
6
6
  /* empty css */
7
7
  /* empty css */
8
- import { formatInputValue as Z, applyInputMask as k, isFormattedInputType as v, getInputSeparators as Be, validateInputValue as Re, parseInputNumber as $e, isLengthValidatedInputType as De, roundInputNumber as ze } from "./utils.js";
9
- const He = we(function({
10
- id: O,
8
+ import { formatInputValue as X, applyInputMask as Z, isFormattedInputType as v, getInputSeparators as $e, validateInputValue as ze, parseInputNumber as De, isLengthValidatedInputType as Le, roundInputNumber as Ce } from "./utils.js";
9
+ import { useInconelAdapters as Se } from "../../adapters/context.js";
10
+ const Xe = Ee(function({
11
+ id: k,
11
12
  label: s,
12
- hint: B,
13
- errorMessage: W,
13
+ hint: _,
14
+ errorMessage: A,
14
15
  startAdornment: R,
15
16
  endAdornment: $,
16
- fullWidth: D = !1,
17
- inputClassName: A,
18
- labelClassName: z,
17
+ fullWidth: z = !1,
18
+ inputClassName: O,
19
+ labelClassName: D,
19
20
  className: L,
20
21
  required: V,
21
22
  disabled: f,
22
23
  value: C,
23
- defaultValue: x = "",
24
+ defaultValue: W = "",
24
25
  onChange: N,
25
- onBlur: ee,
26
- onFocus: ne,
27
- onKeyDown: re,
28
- onMouseEnter: oe,
29
- onMouseLeave: ie,
26
+ onBlur: x,
27
+ onFocus: ee,
28
+ onKeyDown: ne,
29
+ onMouseEnter: re,
30
+ onMouseLeave: oe,
30
31
  type: n = "text",
31
32
  locale: c = "tr-TR",
32
- currency: j = "TRY",
33
+ currency: T = "TRY",
33
34
  decimalScale: p = 0,
34
- roundMode: le = "floor",
35
- roundOnBlur: te = !1,
36
- min: T,
37
- max: w,
38
- allowNegative: K = !1,
39
- debounceMs: P = 0,
40
- validateOnSubmit: S = !1,
41
- validationMessages: ue,
35
+ roundMode: ie = "floor",
36
+ roundOnBlur: le = !1,
37
+ min: j,
38
+ max: B,
39
+ allowNegative: S = !1,
40
+ debounceMs: K = 0,
41
+ validateOnSubmit: P = !1,
42
+ validationMessages: te,
42
43
  mask: l,
43
- limit: h,
44
+ limit: m,
44
45
  isClearable: ae = !1,
45
- readOnly: se = !1,
46
- clearButtonLabel: Y,
46
+ readOnly: ue = !1,
47
+ clearButtonLabel: se,
47
48
  readOnlyEmptyValue: ce = null,
48
- size: q = "md",
49
+ size: Y = "md",
49
50
  variant: de = "outlined",
50
51
  autoComplete: fe = "off",
51
52
  "aria-describedby": pe,
52
- ...he
53
- }, me) {
54
- const ge = Ee(), m = O ?? `inconel-input-${ge.replace(/:/g, "")}`, y = `${m}-hint`, G = `${m}-error`, H = C !== void 0, [be, Ie] = I(x), o = H ? C : be, [J, E] = I(""), [ve, Q] = I(!1), [Ve, F] = I(null), u = Fe(null), Ne = ue ?? {}, d = W ?? Ve, g = (e) => Re(e, {
53
+ ...me
54
+ }, he) {
55
+ const ge = Se(), be = se ?? String(ge.translate?.("clear", "Temizle") ?? "Temizle"), Ie = Fe(), h = k ?? `inconel-input-${Ie.replace(/:/g, "")}`, q = `${h}-hint`, y = `${h}-error`, G = C !== void 0, [ve, Ve] = I(W), o = G ? C : ve, [H, w] = I(""), [Ne, J] = I(!1), [Te, E] = I(null), a = Me(null), je = te ?? {}, d = A ?? Te, g = (e) => ze(e, {
55
56
  required: !!V,
56
57
  type: n,
57
- min: T,
58
- max: w,
58
+ min: j,
59
+ max: B,
59
60
  mask: l,
60
- messages: Ne
61
- }), M = Me(
62
- () => Z(
61
+ messages: je
62
+ }), F = _e(
63
+ () => X(
63
64
  o,
64
65
  n,
65
66
  c,
66
67
  p,
67
- j,
68
+ T,
68
69
  l
69
70
  ),
70
- [o, j, p, c, l, n]
71
- ), a = (e, r, i = null) => ({
71
+ [o, T, p, c, l, n]
72
+ ), u = (e, r, i = null) => ({
72
73
  rawValue: e,
73
- formattedValue: Z(
74
+ formattedValue: X(
74
75
  e,
75
76
  n,
76
77
  c,
77
78
  p,
78
- j,
79
+ T,
79
80
  l
80
81
  ),
81
82
  error: !!g(e),
82
83
  char: i,
83
84
  eventType: r
84
- }), _ = (e, r = !1) => {
85
- H || Ie(e.rawValue), u.current && clearTimeout(u.current), N && (r || P <= 0 ? N(e) : u.current = setTimeout(() => N(e), P));
85
+ }), M = (e, r = !1) => {
86
+ G || Ve(e.rawValue), a.current && clearTimeout(a.current), N && (r || K <= 0 ? N(e) : a.current = setTimeout(() => N(e), K));
86
87
  };
87
- X(() => () => {
88
- u.current && clearTimeout(u.current);
89
- }, []), X(() => {
90
- S && F(g(o));
91
- }, [S]);
92
- const U = (e) => {
88
+ U(() => () => {
89
+ a.current && clearTimeout(a.current);
90
+ }, []), U(() => {
91
+ P && E(g(o));
92
+ }, [P]);
93
+ const Q = (e) => {
93
94
  if (n === "phone" && l) return e.replace(/\D/g, "");
94
95
  if (v(n)) {
95
- const r = $e(e, c);
96
- return r === null ? e === "" ? null : e : K ? r : Math.abs(r);
96
+ const r = De(e, c);
97
+ return r === null ? e === "" ? null : e : S ? r : Math.abs(r);
97
98
  }
98
99
  return e;
99
- }, je = (e) => {
100
+ }, Be = (e) => {
100
101
  const r = e.replace(/\D/g, "");
101
- if (h && (v(n) || n === "phone") && r.length > h || h && De(n) && e.length > h) return;
102
- const i = U(e);
103
- typeof i == "number" && (typeof T == "number" && i < T || typeof w == "number" && i > w) || (E(
104
- n === "phone" && l ? k(i, l) : e
105
- ), _(a(i, "change", e.slice(-1) || null)));
106
- }, Te = [
102
+ if (m && (v(n) || n === "phone") && r.length > m || m && Le(n) && e.length > m) return;
103
+ const i = Q(e);
104
+ typeof i == "number" && (typeof j == "number" && i < j || typeof B == "number" && i > B) || (w(
105
+ n === "phone" && l ? Z(i, l) : e
106
+ ), M(u(i, "change", e.slice(-1) || null)));
107
+ }, we = [
107
108
  pe,
108
- B && !d ? y : void 0,
109
- d ? G : void 0
109
+ _ && !d ? q : void 0,
110
+ d ? y : void 0
110
111
  ].filter(Boolean).join(" ") || void 0;
111
- return se ? /* @__PURE__ */ b("div", { className: ["inconel-field", `inconel-size-${q}`, D ? "inconel-field--full-width" : "", L ?? ""].join(" "), children: [
112
- s && /* @__PURE__ */ t("span", { className: ["inconel-field__label", z ?? ""].join(" "), children: s }),
113
- /* @__PURE__ */ t("div", { className: "inconel-input-readonly", "aria-label": s, children: M || ce })
114
- ] }) : /* @__PURE__ */ b("div", { className: ["inconel-field", `inconel-size-${q}`, D ? "inconel-field--full-width" : "", L ?? ""].join(" "), children: [
115
- s && /* @__PURE__ */ b("label", { className: ["inconel-field__label", z ?? ""].join(" "), htmlFor: m, children: [
112
+ return ue ? /* @__PURE__ */ b("div", { className: ["inconel-field", `inconel-size-${Y}`, z ? "inconel-field--full-width" : "", L ?? ""].join(" "), children: [
113
+ s && /* @__PURE__ */ t("span", { className: ["inconel-field__label", D ?? ""].join(" "), children: s }),
114
+ /* @__PURE__ */ t("div", { className: "inconel-input-readonly", "aria-label": s, children: F || ce })
115
+ ] }) : /* @__PURE__ */ b("div", { className: ["inconel-field", `inconel-size-${Y}`, z ? "inconel-field--full-width" : "", L ?? ""].join(" "), children: [
116
+ s && /* @__PURE__ */ b("label", { className: ["inconel-field__label", D ?? ""].join(" "), htmlFor: h, children: [
116
117
  s,
117
118
  V && /* @__PURE__ */ t("span", { className: "inconel-field__required", "aria-hidden": "true", children: " *" })
118
119
  ] }),
@@ -121,47 +122,47 @@ const He = we(function({
121
122
  /* @__PURE__ */ t(
122
123
  "input",
123
124
  {
124
- ...he,
125
- ref: me,
126
- id: m,
125
+ ...me,
126
+ ref: he,
127
+ id: h,
127
128
  type: n === "password" || n === "email" ? n : "text",
128
129
  inputMode: v(n) ? "decimal" : n === "phone" ? "tel" : void 0,
129
- value: ve ? J : M,
130
+ value: Ne ? H : F,
130
131
  required: V,
131
132
  disabled: f,
132
133
  autoComplete: fe,
133
134
  "aria-invalid": !!d,
134
- "aria-describedby": Te,
135
- className: ["inconel-input", A ?? ""].join(" "),
136
- onChange: (e) => je(e.target.value),
135
+ "aria-describedby": we,
136
+ className: ["inconel-input", O ?? ""].join(" "),
137
+ onChange: (e) => Be(e.target.value),
137
138
  onFocus: (e) => {
138
139
  if (f) return;
139
- Q(!0);
140
- const r = n === "phone" && l ? k(o, l) : v(n) ? String(o ?? "").replace(".", Be(c).decimal) : String(o ?? "");
141
- E(r), ne?.(a(o, "focus"), e);
140
+ J(!0);
141
+ const r = n === "phone" && l ? Z(o, l) : v(n) ? String(o ?? "").replace(".", $e(c).decimal) : String(o ?? "");
142
+ w(r), ee?.(u(o, "focus"), e);
142
143
  },
143
144
  onBlur: (e) => {
144
- Q(!1), u.current && clearTimeout(u.current);
145
- let r = U(J);
146
- typeof r == "number" && (r = ze(r, p, te ? le : "floor")), F(g(r));
147
- const i = a(r, "blur");
148
- _(i, !0), ee?.(i, e);
145
+ J(!1), a.current && clearTimeout(a.current);
146
+ let r = Q(H);
147
+ typeof r == "number" && (r = Ce(r, p, le ? ie : "floor")), E(g(r));
148
+ const i = u(r, "blur");
149
+ M(i, !0), x?.(i, e);
149
150
  },
150
151
  onKeyDown: (e) => {
151
- !K && (e.key === "-" || e.key === "Subtract") && e.preventDefault(), re?.(a(o, "keydown", e.key), e);
152
+ !S && (e.key === "-" || e.key === "Subtract") && e.preventDefault(), ne?.(u(o, "keydown", e.key), e);
152
153
  },
153
- onMouseEnter: (e) => oe?.(a(o, "mouseenter"), e),
154
- onMouseLeave: (e) => ie?.(a(o, "mouseleave"), e)
154
+ onMouseEnter: (e) => re?.(u(o, "mouseenter"), e),
155
+ onMouseLeave: (e) => oe?.(u(o, "mouseleave"), e)
155
156
  }
156
157
  ),
157
- ae && !f && M && Y && /* @__PURE__ */ t(
158
+ ae && !f && F && /* @__PURE__ */ t(
158
159
  "button",
159
160
  {
160
161
  type: "button",
161
162
  className: "inconel-input-clear",
162
- "aria-label": Y,
163
+ "aria-label": be,
163
164
  onClick: () => {
164
- E(""), F(g(null)), _(a(null, "clear"), !0);
165
+ w(""), E(g(null)), M(u(null, "clear"), !0);
165
166
  },
166
167
  children: "×"
167
168
  }
@@ -169,17 +170,17 @@ const He = we(function({
169
170
  $ && /* @__PURE__ */ t("span", { className: "inconel-input-adornment", "aria-hidden": "true", children: $ })
170
171
  ] }),
171
172
  /* @__PURE__ */ t(
172
- _e,
173
+ Re,
173
174
  {
174
- hint: B,
175
+ hint: _,
175
176
  errorMessage: d,
176
- hintId: y,
177
- errorId: G
177
+ hintId: q,
178
+ errorId: y
178
179
  }
179
180
  )
180
181
  ] });
181
182
  });
182
183
  export {
183
- He as default
184
+ Xe as default
184
185
  };
185
186
  //# sourceMappingURL=Input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sources":["../../../src/components/Input/Input.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type FocusEvent,\n type InputHTMLAttributes,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n} from 'react'\n\nimport FieldFeedback from '../FieldFeedback/FieldFeedback'\nimport type { FieldFeedbackContentProps } from '../FieldFeedback/FieldFeedback'\nimport '../shared/field.css'\nimport '../shared/field-controls.css'\nimport '../shared/sizes.css'\nimport type { ControlSize } from '../shared/types'\nimport './styles.css'\nimport {\n applyInputMask,\n formatInputValue,\n getInputSeparators,\n isFormattedInputType,\n isLengthValidatedInputType,\n parseInputNumber,\n roundInputNumber,\n validateInputValue,\n} from './utils'\n\nexport type InputType =\n | 'text'\n | 'number'\n | 'currency'\n | 'percent'\n | 'phone'\n | 'email'\n | 'password'\n\nexport type InputRoundMode = 'ceil' | 'floor' | 'round'\nexport type InputValue = string | number | null\nexport type InputEventType =\n | 'change'\n | 'blur'\n | 'focus'\n | 'keydown'\n | 'mouseenter'\n | 'mouseleave'\n | 'clear'\n\nexport interface InputPayload {\n rawValue: InputValue\n formattedValue: string\n error: boolean\n char: string | null\n eventType: InputEventType\n}\n\nexport interface InputValidationMessages {\n required?: string\n invalidNumber?: string\n minNumber?: string\n maxNumber?: string\n minLength?: string\n maxLength?: string\n invalidPhone?: string\n invalidEmail?: string\n}\n\ntype NativeInputProps = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n | 'type'\n | 'value'\n | 'defaultValue'\n | 'onChange'\n | 'onBlur'\n | 'onFocus'\n | 'onKeyDown'\n | 'onMouseEnter'\n | 'onMouseLeave'\n | 'min'\n | 'max'\n | 'size'\n | 'readOnly'\n>\n\nexport interface InputProps extends NativeInputProps, FieldFeedbackContentProps {\n label?: string\n startAdornment?: ReactNode\n endAdornment?: ReactNode\n fullWidth?: boolean\n inputClassName?: string\n labelClassName?: string\n value?: InputValue\n defaultValue?: InputValue\n onChange?: (payload: InputPayload) => void\n onBlur?: (payload: InputPayload, event: FocusEvent<HTMLInputElement>) => void\n onFocus?: (payload: InputPayload, event: FocusEvent<HTMLInputElement>) => void\n onKeyDown?: (\n payload: InputPayload,\n event: KeyboardEvent<HTMLInputElement>,\n ) => void\n onMouseEnter?: (\n payload: InputPayload,\n event: MouseEvent<HTMLInputElement>,\n ) => void\n onMouseLeave?: (\n payload: InputPayload,\n event: MouseEvent<HTMLInputElement>,\n ) => void\n type?: InputType\n locale?: string\n currency?: string\n decimalScale?: number\n roundMode?: InputRoundMode\n roundOnBlur?: boolean\n min?: number\n max?: number\n allowNegative?: boolean\n debounceMs?: number\n validateOnSubmit?: boolean\n validationMessages?: InputValidationMessages\n mask?: string\n limit?: number\n isClearable?: boolean\n readOnly?: boolean\n clearButtonLabel?: string\n readOnlyEmptyValue?: ReactNode\n size?: ControlSize\n variant?: 'outlined' | 'plain'\n}\n\nconst Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n id,\n label,\n hint,\n errorMessage,\n startAdornment,\n endAdornment,\n fullWidth = false,\n inputClassName,\n labelClassName,\n className,\n required,\n disabled,\n value,\n defaultValue = '',\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n onMouseEnter,\n onMouseLeave,\n type = 'text',\n locale = 'tr-TR',\n currency = 'TRY',\n decimalScale = 0,\n roundMode = 'floor',\n roundOnBlur = false,\n min,\n max,\n allowNegative = false,\n debounceMs = 0,\n validateOnSubmit = false,\n validationMessages,\n mask,\n limit,\n isClearable = false,\n readOnly = false,\n clearButtonLabel,\n readOnlyEmptyValue = null,\n size = 'md',\n variant = 'outlined',\n autoComplete = 'off',\n 'aria-describedby': ariaDescribedBy,\n ...inputProps\n },\n ref,\n) {\n const generatedId = useId()\n const inputId = id ?? `inconel-input-${generatedId.replace(/:/g, '')}`\n const hintId = `${inputId}-hint`\n const errorId = `${inputId}-error`\n const controlled = value !== undefined\n const [localValue, setLocalValue] = useState<InputValue>(defaultValue)\n const currentValue = controlled ? value : localValue\n const [editingValue, setEditingValue] = useState('')\n const [focused, setFocused] = useState(false)\n const [validationError, setValidationError] = useState<string | null>(null)\n const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n const messages = validationMessages ?? {}\n const visibleError = errorMessage ?? validationError\n\n const validate = (candidate: InputValue) =>\n validateInputValue(candidate, {\n required: Boolean(required),\n type,\n min,\n max,\n mask,\n messages,\n })\n\n const formattedValue = useMemo(\n () =>\n formatInputValue(\n currentValue,\n type,\n locale,\n decimalScale,\n currency,\n mask,\n ),\n [currentValue, currency, decimalScale, locale, mask, type],\n )\n\n const buildPayload = (\n rawValue: InputValue,\n eventType: InputEventType,\n char: string | null = null,\n ): InputPayload => ({\n rawValue,\n formattedValue: formatInputValue(\n rawValue,\n type,\n locale,\n decimalScale,\n currency,\n mask,\n ),\n error: Boolean(validate(rawValue)),\n char,\n eventType,\n })\n\n const emitChange = (payload: InputPayload, immediate = false) => {\n if (!controlled) setLocalValue(payload.rawValue)\n if (debounceRef.current) clearTimeout(debounceRef.current)\n if (!onChange) return\n if (immediate || debounceMs <= 0) onChange(payload)\n else debounceRef.current = setTimeout(() => onChange(payload), debounceMs)\n }\n\n useEffect(() => () => {\n if (debounceRef.current) clearTimeout(debounceRef.current)\n }, [])\n\n useEffect(() => {\n if (validateOnSubmit) setValidationError(validate(currentValue))\n // Validation intentionally runs when submit state changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [validateOnSubmit])\n\n const normalize = (text: string): InputValue => {\n if (type === 'phone' && mask) return text.replace(/\\D/g, '')\n if (isFormattedInputType(type)) {\n const parsed = parseInputNumber(text, locale)\n if (parsed === null) return text === '' ? null : text\n return allowNegative ? parsed : Math.abs(parsed)\n }\n return text\n }\n\n const handleChange = (text: string) => {\n const digits = text.replace(/\\D/g, '')\n if (\n limit &&\n (isFormattedInputType(type) || type === 'phone') &&\n digits.length > limit\n ) return\n if (limit && isLengthValidatedInputType(type) && text.length > limit) return\n const rawValue = normalize(text)\n if (typeof rawValue === 'number') {\n if (typeof min === 'number' && rawValue < min) return\n if (typeof max === 'number' && rawValue > max) return\n }\n setEditingValue(\n type === 'phone' && mask ? applyInputMask(rawValue, mask) : text,\n )\n emitChange(buildPayload(rawValue, 'change', text.slice(-1) || null))\n }\n\n const describedBy = [\n ariaDescribedBy,\n hint && !visibleError ? hintId : undefined,\n visibleError ? errorId : undefined,\n ].filter(Boolean).join(' ') || undefined\n\n if (readOnly) {\n return (\n <div className={['inconel-field', `inconel-size-${size}`, fullWidth ? 'inconel-field--full-width' : '', className ?? ''].join(' ')}>\n {label && <span className={['inconel-field__label', labelClassName ?? ''].join(' ')}>{label}</span>}\n <div className=\"inconel-input-readonly\" aria-label={label}>\n {formattedValue || readOnlyEmptyValue}\n </div>\n </div>\n )\n }\n\n return (\n <div className={['inconel-field', `inconel-size-${size}`, fullWidth ? 'inconel-field--full-width' : '', className ?? ''].join(' ')}>\n {label && (\n <label className={['inconel-field__label', labelClassName ?? ''].join(' ')} htmlFor={inputId}>\n {label}{required && <span className=\"inconel-field__required\" aria-hidden=\"true\"> *</span>}\n </label>\n )}\n <div className={['inconel-input-control', variant === 'plain' ? 'inconel-input-control--plain' : '', visibleError ? 'inconel-is-invalid' : '', disabled ? 'inconel-is-disabled' : ''].join(' ')}>\n {startAdornment && <span className=\"inconel-input-adornment\" aria-hidden=\"true\">{startAdornment}</span>}\n <input\n {...inputProps}\n ref={ref}\n id={inputId}\n type={type === 'password' || type === 'email' ? type : 'text'}\n inputMode={isFormattedInputType(type) ? 'decimal' : type === 'phone' ? 'tel' : undefined}\n value={focused ? editingValue : formattedValue}\n required={required}\n disabled={disabled}\n autoComplete={autoComplete}\n aria-invalid={Boolean(visibleError)}\n aria-describedby={describedBy}\n className={['inconel-input', inputClassName ?? ''].join(' ')}\n onChange={(event) => handleChange(event.target.value)}\n onFocus={(event) => {\n if (disabled) return\n setFocused(true)\n const editValue = type === 'phone' && mask\n ? applyInputMask(currentValue, mask)\n : isFormattedInputType(type)\n ? String(currentValue ?? '').replace('.', getInputSeparators(locale).decimal)\n : String(currentValue ?? '')\n setEditingValue(editValue)\n onFocus?.(buildPayload(currentValue, 'focus'), event)\n }}\n onBlur={(event) => {\n setFocused(false)\n if (debounceRef.current) clearTimeout(debounceRef.current)\n let rawValue = normalize(editingValue)\n if (typeof rawValue === 'number') {\n rawValue = roundInputNumber(rawValue, decimalScale, roundOnBlur ? roundMode : 'floor')\n }\n setValidationError(validate(rawValue))\n const payload = buildPayload(rawValue, 'blur')\n emitChange(payload, true)\n onBlur?.(payload, event)\n }}\n onKeyDown={(event) => {\n if (!allowNegative && (event.key === '-' || event.key === 'Subtract')) event.preventDefault()\n onKeyDown?.(buildPayload(currentValue, 'keydown', event.key), event)\n }}\n onMouseEnter={(event) => onMouseEnter?.(buildPayload(currentValue, 'mouseenter'), event)}\n onMouseLeave={(event) => onMouseLeave?.(buildPayload(currentValue, 'mouseleave'), event)}\n />\n {isClearable && !disabled && formattedValue && clearButtonLabel && (\n <button\n type=\"button\"\n className=\"inconel-input-clear\"\n aria-label={clearButtonLabel}\n onClick={() => {\n setEditingValue('')\n setValidationError(validate(null))\n emitChange(buildPayload(null, 'clear'), true)\n }}\n >\n ×\n </button>\n )}\n {endAdornment && <span className=\"inconel-input-adornment\" aria-hidden=\"true\">{endAdornment}</span>}\n </div>\n <FieldFeedback\n hint={hint}\n errorMessage={visibleError}\n hintId={hintId}\n errorId={errorId}\n />\n </div>\n )\n})\n\nexport default Input\n"],"names":["Input","forwardRef","id","label","hint","errorMessage","startAdornment","endAdornment","fullWidth","inputClassName","labelClassName","className","required","disabled","value","defaultValue","onChange","onBlur","onFocus","onKeyDown","onMouseEnter","onMouseLeave","type","locale","currency","decimalScale","roundMode","roundOnBlur","min","max","allowNegative","debounceMs","validateOnSubmit","validationMessages","mask","limit","isClearable","readOnly","clearButtonLabel","readOnlyEmptyValue","size","variant","autoComplete","ariaDescribedBy","inputProps","ref","generatedId","useId","inputId","hintId","errorId","controlled","localValue","setLocalValue","useState","currentValue","editingValue","setEditingValue","focused","setFocused","validationError","setValidationError","debounceRef","useRef","messages","visibleError","validate","candidate","validateInputValue","formattedValue","useMemo","formatInputValue","buildPayload","rawValue","eventType","char","emitChange","payload","immediate","useEffect","normalize","text","isFormattedInputType","parsed","parseInputNumber","handleChange","digits","isLengthValidatedInputType","applyInputMask","describedBy","jsx","jsxs","event","editValue","get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;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,WAAU;AAAA,UACV,cAAYpD;AAAA,UACZ,SAAS,MAAM;AACb,YAAAmB,EAAgB,EAAE,GAClBI,EAAmBK,EAAS,IAAI,CAAC,GACjCU,EAAWJ,EAAa,MAAM,OAAO,GAAG,EAAI;AAAA,UAC9C;AAAA,UACD,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,MAIFjE,KAAgB,gBAAAmF,EAAC,QAAA,EAAK,WAAU,2BAA0B,eAAY,QAAQ,UAAAnF,EAAA,CAAa;AAAA,IAAA,GAC9F;AAAA,IACA,gBAAAmF;AAAA,MAACM;AAAA,MAAA;AAAA,QACC,MAAA5F;AAAA,QACA,cAAc6D;AAAA,QACd,QAAAhB;AAAA,QACA,SAAAC;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ,CAAC;"}
1
+ {"version":3,"file":"Input.js","sources":["../../../src/components/Input/Input.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type FocusEvent,\n type InputHTMLAttributes,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n} from 'react'\n\nimport { useInconelAdapters } from '../../adapters'\nimport FieldFeedback from '../FieldFeedback/FieldFeedback'\nimport type { FieldFeedbackContentProps } from '../FieldFeedback/FieldFeedback'\nimport '../shared/field.css'\nimport '../shared/field-controls.css'\nimport '../shared/sizes.css'\nimport type { ControlSize } from '../shared/types'\nimport './styles.css'\nimport {\n applyInputMask,\n formatInputValue,\n getInputSeparators,\n isFormattedInputType,\n isLengthValidatedInputType,\n parseInputNumber,\n roundInputNumber,\n validateInputValue,\n} from './utils'\n\nexport type InputType =\n | 'text'\n | 'number'\n | 'currency'\n | 'percent'\n | 'phone'\n | 'email'\n | 'password'\n\nexport type InputRoundMode = 'ceil' | 'floor' | 'round'\nexport type InputValue = string | number | null\nexport type InputEventType =\n | 'change'\n | 'blur'\n | 'focus'\n | 'keydown'\n | 'mouseenter'\n | 'mouseleave'\n | 'clear'\n\nexport interface InputPayload {\n rawValue: InputValue\n formattedValue: string\n error: boolean\n char: string | null\n eventType: InputEventType\n}\n\nexport interface InputValidationMessages {\n required?: string\n invalidNumber?: string\n minNumber?: string\n maxNumber?: string\n minLength?: string\n maxLength?: string\n invalidPhone?: string\n invalidEmail?: string\n}\n\ntype NativeInputProps = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n | 'type'\n | 'value'\n | 'defaultValue'\n | 'onChange'\n | 'onBlur'\n | 'onFocus'\n | 'onKeyDown'\n | 'onMouseEnter'\n | 'onMouseLeave'\n | 'min'\n | 'max'\n | 'size'\n | 'readOnly'\n>\n\nexport interface InputProps extends NativeInputProps, FieldFeedbackContentProps {\n label?: string\n startAdornment?: ReactNode\n endAdornment?: ReactNode\n fullWidth?: boolean\n inputClassName?: string\n labelClassName?: string\n value?: InputValue\n defaultValue?: InputValue\n onChange?: (payload: InputPayload) => void\n onBlur?: (payload: InputPayload, event: FocusEvent<HTMLInputElement>) => void\n onFocus?: (payload: InputPayload, event: FocusEvent<HTMLInputElement>) => void\n onKeyDown?: (\n payload: InputPayload,\n event: KeyboardEvent<HTMLInputElement>,\n ) => void\n onMouseEnter?: (\n payload: InputPayload,\n event: MouseEvent<HTMLInputElement>,\n ) => void\n onMouseLeave?: (\n payload: InputPayload,\n event: MouseEvent<HTMLInputElement>,\n ) => void\n type?: InputType\n locale?: string\n currency?: string\n decimalScale?: number\n roundMode?: InputRoundMode\n roundOnBlur?: boolean\n min?: number\n max?: number\n allowNegative?: boolean\n debounceMs?: number\n validateOnSubmit?: boolean\n validationMessages?: InputValidationMessages\n mask?: string\n limit?: number\n isClearable?: boolean\n readOnly?: boolean\n clearButtonLabel?: string\n readOnlyEmptyValue?: ReactNode\n size?: ControlSize\n variant?: 'outlined' | 'plain'\n}\n\nconst Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n id,\n label,\n hint,\n errorMessage,\n startAdornment,\n endAdornment,\n fullWidth = false,\n inputClassName,\n labelClassName,\n className,\n required,\n disabled,\n value,\n defaultValue = '',\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n onMouseEnter,\n onMouseLeave,\n type = 'text',\n locale = 'tr-TR',\n currency = 'TRY',\n decimalScale = 0,\n roundMode = 'floor',\n roundOnBlur = false,\n min,\n max,\n allowNegative = false,\n debounceMs = 0,\n validateOnSubmit = false,\n validationMessages,\n mask,\n limit,\n isClearable = false,\n readOnly = false,\n clearButtonLabel,\n readOnlyEmptyValue = null,\n size = 'md',\n variant = 'outlined',\n autoComplete = 'off',\n 'aria-describedby': ariaDescribedBy,\n ...inputProps\n },\n ref,\n) {\n const adapters = useInconelAdapters()\n const resolvedClearButtonLabel =\n clearButtonLabel ??\n String(adapters.translate?.('clear', 'Temizle') ?? 'Temizle')\n\n const generatedId = useId()\n const inputId = id ?? `inconel-input-${generatedId.replace(/:/g, '')}`\n const hintId = `${inputId}-hint`\n const errorId = `${inputId}-error`\n const controlled = value !== undefined\n const [localValue, setLocalValue] = useState<InputValue>(defaultValue)\n const currentValue = controlled ? value : localValue\n const [editingValue, setEditingValue] = useState('')\n const [focused, setFocused] = useState(false)\n const [validationError, setValidationError] = useState<string | null>(null)\n const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n const messages = validationMessages ?? {}\n const visibleError = errorMessage ?? validationError\n\n const validate = (candidate: InputValue) =>\n validateInputValue(candidate, {\n required: Boolean(required),\n type,\n min,\n max,\n mask,\n messages,\n })\n\n const formattedValue = useMemo(\n () =>\n formatInputValue(\n currentValue,\n type,\n locale,\n decimalScale,\n currency,\n mask,\n ),\n [currentValue, currency, decimalScale, locale, mask, type],\n )\n\n const buildPayload = (\n rawValue: InputValue,\n eventType: InputEventType,\n char: string | null = null,\n ): InputPayload => ({\n rawValue,\n formattedValue: formatInputValue(\n rawValue,\n type,\n locale,\n decimalScale,\n currency,\n mask,\n ),\n error: Boolean(validate(rawValue)),\n char,\n eventType,\n })\n\n const emitChange = (payload: InputPayload, immediate = false) => {\n if (!controlled) setLocalValue(payload.rawValue)\n if (debounceRef.current) clearTimeout(debounceRef.current)\n if (!onChange) return\n if (immediate || debounceMs <= 0) onChange(payload)\n else debounceRef.current = setTimeout(() => onChange(payload), debounceMs)\n }\n\n useEffect(() => () => {\n if (debounceRef.current) clearTimeout(debounceRef.current)\n }, [])\n\n useEffect(() => {\n if (validateOnSubmit) setValidationError(validate(currentValue))\n // Validation intentionally runs when submit state changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [validateOnSubmit])\n\n const normalize = (text: string): InputValue => {\n if (type === 'phone' && mask) return text.replace(/\\D/g, '')\n if (isFormattedInputType(type)) {\n const parsed = parseInputNumber(text, locale)\n if (parsed === null) return text === '' ? null : text\n return allowNegative ? parsed : Math.abs(parsed)\n }\n return text\n }\n\n const handleChange = (text: string) => {\n const digits = text.replace(/\\D/g, '')\n if (\n limit &&\n (isFormattedInputType(type) || type === 'phone') &&\n digits.length > limit\n ) return\n if (limit && isLengthValidatedInputType(type) && text.length > limit) return\n const rawValue = normalize(text)\n if (typeof rawValue === 'number') {\n if (typeof min === 'number' && rawValue < min) return\n if (typeof max === 'number' && rawValue > max) return\n }\n setEditingValue(\n type === 'phone' && mask ? applyInputMask(rawValue, mask) : text,\n )\n emitChange(buildPayload(rawValue, 'change', text.slice(-1) || null))\n }\n\n const describedBy = [\n ariaDescribedBy,\n hint && !visibleError ? hintId : undefined,\n visibleError ? errorId : undefined,\n ].filter(Boolean).join(' ') || undefined\n\n if (readOnly) {\n return (\n <div className={['inconel-field', `inconel-size-${size}`, fullWidth ? 'inconel-field--full-width' : '', className ?? ''].join(' ')}>\n {label && <span className={['inconel-field__label', labelClassName ?? ''].join(' ')}>{label}</span>}\n <div className=\"inconel-input-readonly\" aria-label={label}>\n {formattedValue || readOnlyEmptyValue}\n </div>\n </div>\n )\n }\n\n return (\n <div className={['inconel-field', `inconel-size-${size}`, fullWidth ? 'inconel-field--full-width' : '', className ?? ''].join(' ')}>\n {label && (\n <label className={['inconel-field__label', labelClassName ?? ''].join(' ')} htmlFor={inputId}>\n {label}{required && <span className=\"inconel-field__required\" aria-hidden=\"true\"> *</span>}\n </label>\n )}\n <div className={['inconel-input-control', variant === 'plain' ? 'inconel-input-control--plain' : '', visibleError ? 'inconel-is-invalid' : '', disabled ? 'inconel-is-disabled' : ''].join(' ')}>\n {startAdornment && <span className=\"inconel-input-adornment\" aria-hidden=\"true\">{startAdornment}</span>}\n <input\n {...inputProps}\n ref={ref}\n id={inputId}\n type={type === 'password' || type === 'email' ? type : 'text'}\n inputMode={isFormattedInputType(type) ? 'decimal' : type === 'phone' ? 'tel' : undefined}\n value={focused ? editingValue : formattedValue}\n required={required}\n disabled={disabled}\n autoComplete={autoComplete}\n aria-invalid={Boolean(visibleError)}\n aria-describedby={describedBy}\n className={['inconel-input', inputClassName ?? ''].join(' ')}\n onChange={(event) => handleChange(event.target.value)}\n onFocus={(event) => {\n if (disabled) return\n setFocused(true)\n const editValue = type === 'phone' && mask\n ? applyInputMask(currentValue, mask)\n : isFormattedInputType(type)\n ? String(currentValue ?? '').replace('.', getInputSeparators(locale).decimal)\n : String(currentValue ?? '')\n setEditingValue(editValue)\n onFocus?.(buildPayload(currentValue, 'focus'), event)\n }}\n onBlur={(event) => {\n setFocused(false)\n if (debounceRef.current) clearTimeout(debounceRef.current)\n let rawValue = normalize(editingValue)\n if (typeof rawValue === 'number') {\n rawValue = roundInputNumber(rawValue, decimalScale, roundOnBlur ? roundMode : 'floor')\n }\n setValidationError(validate(rawValue))\n const payload = buildPayload(rawValue, 'blur')\n emitChange(payload, true)\n onBlur?.(payload, event)\n }}\n onKeyDown={(event) => {\n if (!allowNegative && (event.key === '-' || event.key === 'Subtract')) event.preventDefault()\n onKeyDown?.(buildPayload(currentValue, 'keydown', event.key), event)\n }}\n onMouseEnter={(event) => onMouseEnter?.(buildPayload(currentValue, 'mouseenter'), event)}\n onMouseLeave={(event) => onMouseLeave?.(buildPayload(currentValue, 'mouseleave'), event)}\n />\n {isClearable && !disabled && formattedValue && (\n <button\n type=\"button\"\n className=\"inconel-input-clear\"\n aria-label={resolvedClearButtonLabel}\n onClick={() => {\n setEditingValue('')\n setValidationError(validate(null))\n emitChange(buildPayload(null, 'clear'), true)\n }}\n >\n ×\n </button>\n )}\n {endAdornment && <span className=\"inconel-input-adornment\" aria-hidden=\"true\">{endAdornment}</span>}\n </div>\n <FieldFeedback\n hint={hint}\n errorMessage={visibleError}\n hintId={hintId}\n errorId={errorId}\n />\n </div>\n )\n})\n\nexport default Input\n"],"names":["Input","forwardRef","id","label","hint","errorMessage","startAdornment","endAdornment","fullWidth","inputClassName","labelClassName","className","required","disabled","value","defaultValue","onChange","onBlur","onFocus","onKeyDown","onMouseEnter","onMouseLeave","type","locale","currency","decimalScale","roundMode","roundOnBlur","min","max","allowNegative","debounceMs","validateOnSubmit","validationMessages","mask","limit","isClearable","readOnly","clearButtonLabel","readOnlyEmptyValue","size","variant","autoComplete","ariaDescribedBy","inputProps","ref","adapters","useInconelAdapters","resolvedClearButtonLabel","generatedId","useId","inputId","hintId","errorId","controlled","localValue","setLocalValue","useState","currentValue","editingValue","setEditingValue","focused","setFocused","validationError","setValidationError","debounceRef","useRef","messages","visibleError","validate","candidate","validateInputValue","formattedValue","useMemo","formatInputValue","buildPayload","rawValue","eventType","char","emitChange","payload","immediate","useEffect","normalize","text","isFormattedInputType","parsed","parseInputNumber","handleChange","digits","isLengthValidatedInputType","applyInputMask","describedBy","jsx","jsxs","event","editValue","getInputSeparators","roundInputNumber","FieldFeedback"],"mappings":";;;;;;;;;AAuIA,MAAMA,KAAQC,GAAyC,SACrD;AAAA,EACE,IAAAC;AAAA,EACA,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,gBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AA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A;AAAA,QAAA;AAAA,MAAA;AAAA,MAIFpE,KAAgB,gBAAAsF,EAAC,QAAA,EAAK,WAAU,2BAA0B,eAAY,QAAQ,UAAAtF,EAAA,CAAa;AAAA,IAAA,GAC9F;AAAA,IACA,gBAAAsF;AAAA,MAACM;AAAA,MAAA;AAAA,QACC,MAAA/F;AAAA,QACA,cAAcgE;AAAA,QACd,QAAAhB;AAAA,QACA,SAAAC;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ,CAAC;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inconel",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "Accessible, type-safe React UI components for modern applications.",
5
5
  "keywords": [
6
6
  "react",