{"version":3,"file":"index.js","names":["React","useWatchForm","RowLabel","createContext","data","path","rowNumber","undefined","RowLabelProvider","children","getDataByPath","getSiblingData","collapsibleData","arrayData","contextValue","useMemo","_jsx","value","useRowLabel","use"],"sources":["../../../../src/forms/RowLabel/Context/index.tsx"],"sourcesContent":["'use client'\n\nimport React from 'react'\n\nimport { useWatchForm } from '../../Form/context.js'\n\ntype RowLabelType = {\n readonly data: T\n readonly path: string\n readonly rowNumber?: number\n}\n\nconst RowLabel = React.createContext({\n data: {},\n path: '',\n rowNumber: undefined,\n})\n\ntype Props = {\n readonly children: React.ReactNode\n} & Omit, 'data'>\n\nexport const RowLabelProvider: React.FC> = ({ children, path, rowNumber }) => {\n const { getDataByPath, getSiblingData } = useWatchForm()\n const collapsibleData = getSiblingData(path)\n const arrayData = getDataByPath(path)\n\n const data = arrayData || collapsibleData\n\n const contextValue = React.useMemo(() => ({ data, path, rowNumber }), [data, path, rowNumber])\n\n return {children}\n}\n\nexport const useRowLabel = () => {\n return React.use(RowLabel) as RowLabelType\n}\n"],"mappings":"AAAA;;;AAEA,OAAOA,KAAA,MAAW;AAElB,SAASC,YAAY,QAAQ;AAQ7B,MAAMC,QAAA,gBAAWF,KAAA,CAAMG,aAAa,CAAe;EACjDC,IAAA,EAAM,CAAC;EACPC,IAAA,EAAM;EACNC,SAAA,EAAWC;AACb;AAMA,OAAO,MAAMC,gBAAA,GAA6CA,CAAC;EAAEC,QAAQ;EAAEJ,IAAI;EAAEC;AAAS,CAAE;EACtF,MAAM;IAAEI,aAAa;IAAEC;EAAc,CAAE,GAAGV,YAAA;EAC1C,MAAMW,eAAA,GAAkBD,cAAA,CAAeN,IAAA;EACvC,MAAMQ,SAAA,GAAYH,aAAA,CAAcL,IAAA;EAEhC,MAAMD,IAAA,GAAOS,SAAA,IAAaD,eAAA;EAE1B,MAAME,YAAA,GAAed,KAAA,CAAMe,OAAO,CAAC,OAAO;IAAEX,IAAA;IAAMC,IAAA;IAAMC;EAAU,IAAI,CAACF,IAAA,EAAMC,IAAA,EAAMC,SAAA,CAAU;EAE7F,oBAAOU,IAAA,CAACd,QAAA;IAASe,KAAA,EAAOH,YAAA;cAAeL;;AACzC;AAEA,OAAO,MAAMS,WAAA,GAAcA,CAAA;EACzB,OAAOlB,KAAA,CAAMmB,GAAG,CAACjB,QAAA;AACnB","ignoreList":[]}