PageSourceSearch

https://uniimg.com/assets/useField-1-Wm6M2b.js

js uniimg.com collected 2026-10-07 18:29:03 UTC 3,133 bytes, 1 lines download raw bytes

1import{a as e,n as t}from"./jsx-runtime-C27Mmbu5.js";import{t as n}from"./react-dom-BGozS2fx.js";import{D as r,f as i,g as a,h as o,m as s,o as c,s as l}from"./button-DZVC5NpR.js";import{t as u}from"./useBaseUiId-DdWAf0O-.js";var d=e(t());function f({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=d.useRef(e!==void 0),[a,o]=d.useState(t);return[i?e:a,d.useCallback(e=>{i||o(e)},[])]}var p=e(n()),m=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),h={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},g={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},_={disabled:!1,...g},v={valid(e){return e===null?null:e?{[m.valid]:``}:{[m.invalid]:``}}},y=d.createContext({invalid:void 0,name:void 0,validityData:{state:h,errors:[],error:``,value:``,initialValue:null},setValidityData:l,disabled:void 0,touched:g.touched,setTouched:l,dirty:g.dirty,setDirty:l,filled:g.filled,setFilled:l,focu
1sed:g.focused,setFocused:l,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:_,markedDirtyRef:{current:!1},validation:{getValidationProps:(e=c)=>e,getInputValidationProps:(e=c)=>e,inputRef:{current:null},commit:async()=>{}}});function b(e=!0){let t=d.useContext(y);if(t.setValidityData===l&&!e)throw Error(i(28));return t}var x=d.createContext({controlId:void 0,registerControlId:l,labelId:void 0,setLabelId:l,messageIds:[],setMessageIds:l,getDescriptionProps:e=>e});function S(){return d.useContext(x)}function C(e={}){let{id:t,implicit:n=!1,controlRef:i}=e,{controlId:c,registerControlId:f}=S(),p=u(t),m=n?c:void 0,h=a(()=>Symbol(`labelable-control`)),g=d.useRef(!1),_=d.useRef(t!=null),v=o(()=>{!g.current||f===l||(g.current=!1,f(h.current,void 0))});return s(()=>{if(f===l)return;let e;if(n){let n=i?.current;e=r(n)&&n.closest(`label`)!=null?t??null:m??p}else if(t!=null)_.current=!0,e=t;else if(_.current)e=p;else{v();return}if(e===void 0){v();return}g.current=!0,f(h.current,e)},[t,i,m,f,n,p,h,v]),d.useEffect(()=>v,[v]),c??p}var w=d.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:l,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function T(){return d.useContext(w)}function E(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function D(e){let{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:c}=e,{formRef:l}=T(),{invalid:u,markedDirtyRef:d,validityData:f,setValidityData:m}=b(),h=o(e.getValue);s(()=>{if(!t)return;let e=n;e===void 0&&(e=h()),f.initialValue===null&&e!==null&&m(t=>({...t,initialValue:e}))},[t,m,n,f.initialValue,h]),s(()=>{!t||!r||l.current.fields.set(r,{getValue:h,name:i,controlRef:a,validityData:E(f,u),validate(e=!0){let t=n;t===void 0&&(t=h()),d.current=!0,e?p.flushSync(()=>c(t)):c(t)}})},[c,a,t,l,h,r,u,d,i,f,n]),s(()=>{let e=l.current.fields;return()=>{r&&e.delete(r)}},[l,r])}export{b as a,S as i,T as n,v as o,C as r,f as s,D as t};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.