{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAMM,SAAS,0CACd,GAA6F,EAC7F,YAAe,EACf,OAA2B;IAG3B,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE,CAAC;QAChC,IAAI,WAAW,CAAC,EAAE,gBAAgB,EAChC,QAAQ;IAEZ;IAEA,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,OAAO,KAAK,SAAS;QAEzB,MAAM,iBAAiB,SAAS;QAChC,OAAO;YACL,MAAM,oBAAoB,SAAS;QACrC;IACF,GAAG;QAAC;KAAI;AACV","sources":["packages/react-aria/src/utils/useFormReset.ts"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {RefObject} from '@react-types/shared';\nimport {useEffect} from 'react';\nimport {useEffectEvent} from './useEffectEvent';\n\nexport function useFormReset<T>(\n  ref: RefObject<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null> | undefined,\n  initialValue: T,\n  onReset: (value: T) => void\n): void {\n\n  let handleReset = useEffectEvent((e: Event) => {\n    if (onReset && !e.defaultPrevented) {\n      onReset(initialValue);\n    }\n  });\n\n  useEffect(() => {\n    let form = ref?.current?.form;\n\n    form?.addEventListener('reset', handleReset);\n    return () => {\n      form?.removeEventListener('reset', handleReset);\n    };\n  }, [ref]);\n}\n"],"names":[],"version":3,"file":"useFormReset.cjs.map"}