{"version":3,"file":"ComponentContext.mjs","sources":["../../../../../../admin/src/pages/EditView/components/FormInputs/ComponentContext.tsx"],"sourcesContent":["import { createContext } from '@strapi/admin/strapi-admin';\n\ninterface ComponentContextValue {\n /**\n * The id of the component. It will be undefined if the component\n * has not been created in the database yet. This could be on a new\n * or existing entry.\n */\n id?: number;\n /**\n * The level of the component. This is used to determine the nesting\n * of the component. The default is set to -1 so that the base level is 0\n * for the top level component, and increases by 1 for each level of nesting.\n */\n level: number;\n /**\n * The uid of the component. This is used to determine the type of the\n * component. Within an attribute, it is normally the `component` value.\n * It will be undefined if the hook is not called within the confines\n * of a provider.\n */\n uid?: string;\n /**\n * The type of component parent. It will be undefined if the hook\n * is not called within the confines of a provider.\n */\n type?: 'dynamiczone' | 'repeatable' | 'component';\n}\n\n/**\n * We use this component to wrap any individual component field in the Edit View,\n * this could be a component field in a dynamic zone, a component within a repeatable space,\n * or even nested components.\n *\n * We primarily need this to provide the component id to the components so that they can\n * correctly fetch their relations.\n */\nconst [ComponentProvider, useComponent] = createContext('ComponentContext', {\n id: undefined,\n level: -1,\n uid: undefined,\n type: undefined,\n});\n\nexport { ComponentProvider, useComponent };\n"],"names":["ComponentProvider","useComponent","createContext","id","undefined","level","uid","type"],"mappings":";;AA6BA;;;;;;;AAOC,UACK,CAACA,iBAAAA,EAAmBC,YAAAA,CAAa,GAAGC,cAAqC,kBAAA,EAAoB;IACjGC,EAAAA,EAAIC,SAAAA;AACJC,IAAAA,KAAAA,EAAO,EAAC;IACRC,GAAAA,EAAKF,SAAAA;IACLG,IAAAA,EAAMH;AACR,CAAA;;;;"}