{"version":3,"file":"RichTextEditor.context.cjs","sources":["../../../../../src/components/forms/rich-text-editor/context/RichTextEditor.context.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\r\nimport type { Editor } from '@tiptap/react'\r\nimport type { RichTextValue } from '@components/forms/rich-text-editor/types/RichTextEditor.types.ts'\r\nimport type { RichTextEditorLabels } from '@components/forms/rich-text-editor/types/RichTextEditorLabels.types.ts'\r\n\r\nexport type RichTextEditorContextValue = {\r\n    editor: Editor | null\r\n    disabled: boolean\r\n    readOnly: boolean\r\n    onImageUpload?: (file: File) => Promise<string>\r\n    label?: string\r\n    helperText?: string\r\n    error?: string\r\n    ariaLabel?: string\r\n    ariaLabelledBy?: string\r\n    labelId: string\r\n    helperId: string\r\n    name?: string\r\n    required: boolean\r\n    renderedValue: RichTextValue\r\n    labels: RichTextEditorLabels\r\n}\r\n\r\nexport const RichTextEditorContext = createContext<RichTextEditorContextValue | undefined>(undefined)\r\n\r\nexport const useRichTextEditorContext = (): RichTextEditorContextValue => {\r\n    const context = useContext(RichTextEditorContext)\r\n\r\n    if (!context) {\r\n        throw new Error('This component must be used inside a RichTextEditor.')\r\n    }\r\n\r\n    return context\r\n}\r\n"],"names":["RichTextEditorContext","createContext","useRichTextEditorContext","context","useContext"],"mappings":"yGAuBaA,EAAwBC,EAAAA,cAAsD,MAAS,EAEvFC,EAA2B,IAAkC,CACtE,MAAMC,EAAUC,EAAAA,WAAWJ,CAAqB,EAEhD,GAAI,CAACG,EACD,MAAM,IAAI,MAAM,sDAAsD,EAG1E,OAAOA,CACX"}