UNPKG

@grafana/ui

Version:
1 lines 1.4 kB
{"version":3,"file":"FieldContext.cjs","sources":["../../../../src/components/Forms/FieldContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport interface FieldContextType {\n /**\n * The DOM ID to link the field label to the form control\n */\n id?: string;\n invalid?: boolean;\n disabled?: boolean;\n loading?: boolean;\n /**\n * Used to link the error message to the form control for screen readers\n *\n * Note: once Voiceover and other screenreaders add support, we should probably use `aria-errormessage`\n */\n 'aria-describedby'?: string;\n /**\n * Used to link the label for `RadioButtonGroup` inside an `InlineField`\n *\n * Note: in a normal `Field`, we use a combination of `<fieldset>` and `<legend>`.\n * However when both are used they are \"blockified\". This won't work for inline fields.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/fieldset#styling_with_css\n */\n 'aria-labelledby'?: string;\n}\n\nexport const FieldContext = createContext<FieldContextType>({});\nFieldContext.displayName = 'FieldContext';\n\nexport const useFieldContext = (): FieldContextType => useContext(FieldContext);\n"],"names":["createContext","useContext"],"mappings":";;;;;;;AA2BO,MAAM,YAAA,GAAeA,mBAAA,CAAgC,EAAE;AAC9D,YAAA,CAAa,WAAA,GAAc,cAAA;AAEpB,MAAM,eAAA,GAAkB,MAAwBC,gBAAA,CAAW,YAAY;;;;;"}