diff --git a/packages/core/src/components/error-popup/ErrorPopup.tsx b/packages/core/src/components/error-popup/ErrorPopup.tsx index b64b319..d4b9c20 100644 --- a/packages/core/src/components/error-popup/ErrorPopup.tsx +++ b/packages/core/src/components/error-popup/ErrorPopup.tsx @@ -1,3 +1,4 @@ +"use client"; import React, { useState, useEffect } from 'react'; import { useQuickForm } from "../../state/QuickFormContext"; import { quickformtokens } from '../../style/quickFormTokensDefinition'; diff --git a/packages/core/src/components/paragraph/Paragraph.tsx b/packages/core/src/components/paragraph/Paragraph.tsx index cdea8f9..dc93893 100644 --- a/packages/core/src/components/paragraph/Paragraph.tsx +++ b/packages/core/src/components/paragraph/Paragraph.tsx @@ -1,3 +1,4 @@ +"use client"; import { ReactNode } from "react"; import React from "react"; import { quickformtokens } from "../../style/quickFormTokensDefinition"; diff --git a/packages/core/src/components/renderers/slide-renderer/SlideRenderer.tsx b/packages/core/src/components/renderers/slide-renderer/SlideRenderer.tsx index 3bfd41e..1c14f7f 100644 --- a/packages/core/src/components/renderers/slide-renderer/SlideRenderer.tsx +++ b/packages/core/src/components/renderers/slide-renderer/SlideRenderer.tsx @@ -1,3 +1,4 @@ +"use client"; import React, { useEffect, useRef, useState } from 'react'; import { useQuickForm } from '../../../state/QuickFormContext'; import { Button } from '../../button/Button'; diff --git a/packages/core/src/state/QuickFormContext.tsx b/packages/core/src/state/QuickFormContext.tsx index a6b2731..914b3a0 100644 --- a/packages/core/src/state/QuickFormContext.tsx +++ b/packages/core/src/state/QuickFormContext.tsx @@ -16,6 +16,7 @@ interface IQuickFormContext { isFirstQuestionInCurrentSlide: (questionLogicalName: string) => boolean; getCurrentSlide: () => SlideModel; onSubmitAsync: (formdata: any) => Promise; + cssVariables: { [key: string]: string }; } export const QuickFormContext = React.createContext( @@ -33,6 +34,7 @@ export const QuickFormContext = React.createContext( { questions: [], rows: [], isAnswered: false, addQuestion: () => ({ type: "question", ref: "" }) } ), onSubmitAsync: async (formdata) => { return "" }, + cssVariables: {} } ); diff --git a/packages/core/src/state/QuickformProvider.tsx b/packages/core/src/state/QuickformProvider.tsx index 41127d0..4da405c 100644 --- a/packages/core/src/state/QuickformProvider.tsx +++ b/packages/core/src/state/QuickformProvider.tsx @@ -10,6 +10,7 @@ import { kbaQuickFormTokens } from "../style/kbaQuickFormTokens"; import { isFirstQInCurrentSlide } from "../utils/isFirstQuestionInSlide"; type QuickFormProviderProps = { + className?:string, children: React.ReactNode; definition: QuickFormDefinition; tokens?: Partial; @@ -20,6 +21,7 @@ type QuickFormProviderProps = { export const QuickFormProvider: React.FC = ( { + className, children, definition, payload, @@ -50,7 +52,7 @@ export const QuickFormProvider: React.FC = ( const setErrorMsg = (msg: string) => { dispatch({ type: "SET_ERROR_MSG", msg: msg }) }; const isFirstQuestionInCurrentSlide = (questionLogicalName: string) => { return isFirstQInCurrentSlide(questionLogicalName, state); } const getCurrentSlide = () => (state.slides[state.currIdx]); - + console.log("children", children); return ( = ( isFirstQuestionInCurrentSlide, getCurrentSlide, onSubmitAsync, + cssVariables }}> {asContainer ? ( @@ -72,10 +75,8 @@ export const QuickFormProvider: React.FC = ( {children} ) : ( -
- - {children} -
+ children + ) }