@harshshahcg/survey-render 1.3.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  export type QuestionStatus = "completed" | "unanswered" | "required" | "error";
2
+ export type CarouselVariant = "default" | "PLC";
2
3
  export interface QuestionListCarouselProps {
3
4
  /** Ordered list of visible question IDs (e.g. Q1, Q2, Q6.1) */
4
5
  questions: string[];
@@ -9,5 +10,7 @@ export interface QuestionListCarouselProps {
9
10
  /** Optional map of questionId -> status for styling */
10
11
  questionStatusMap?: Record<string, QuestionStatus>;
11
12
  className?: string;
13
+ /** Visual variant. "PLC" matches the legacy training-app design. Default: "default" */
14
+ variant?: CarouselVariant;
12
15
  }
13
- export declare function QuestionListCarousel({ questions, activeQuestionId, onQuestionSelect, questionStatusMap, className, }: QuestionListCarouselProps): import("react/jsx-runtime").JSX.Element | null;
16
+ export declare function QuestionListCarousel({ questions, activeQuestionId, onQuestionSelect, questionStatusMap, className, variant, }: QuestionListCarouselProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,4 +1,5 @@
1
1
  import type { SurveyQuestion } from "../types/survey.types";
2
+ import { type MCQVariant } from "./custom/MCQSelect";
2
3
  import type { EffectiveMediaConfig } from "../utils/fileUtils";
3
4
  export interface QuestionMapperProps {
4
5
  question: SurveyQuestion;
@@ -9,5 +10,6 @@ export interface QuestionMapperProps {
9
10
  disabled?: boolean;
10
11
  mediaConfig?: EffectiveMediaConfig | null;
11
12
  className?: string;
13
+ variant?: MCQVariant;
12
14
  }
13
- export default function QuestionMapper({ question, value, onChange, error, touched, disabled, mediaConfig, className, }: QuestionMapperProps): import("react/jsx-runtime").JSX.Element;
15
+ export default function QuestionMapper({ question, value, onChange, error, touched, disabled, mediaConfig, className, variant, }: QuestionMapperProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import type { SurveyQuestion } from "../types/survey.types";
2
2
  import type { EffectiveMediaConfig } from "../utils/fileUtils";
3
+ import type { MCQVariant } from "./custom/MCQSelect";
3
4
  export interface QuestionRendererProps {
4
5
  question: SurveyQuestion;
5
6
  value: unknown;
@@ -12,5 +13,6 @@ export interface QuestionRendererProps {
12
13
  }>;
13
14
  mediaConfig?: EffectiveMediaConfig | null;
14
15
  className?: string;
16
+ variant?: MCQVariant;
15
17
  }
16
- export declare function QuestionRenderer({ question, value, onChange, disabled, error, validationErrors, mediaConfig, className, }: QuestionRendererProps): import("react/jsx-runtime").JSX.Element;
18
+ export declare function QuestionRenderer({ question, value, onChange, disabled, error, validationErrors, mediaConfig, className, variant, }: QuestionRendererProps): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import type { SurveyConfig, SurveySubmitPayload } from "../types/survey.types";
2
+ import type { MCQVariant } from "./custom/MCQSelect";
2
3
  export interface SurveyProgressBarConfig {
3
4
  /** "position" = progress by step index. "completion" = by answered mandatory (FMB logic). Default: "completion" */
4
5
  progressMode?: "position" | "completion";
@@ -27,5 +28,7 @@ export interface SurveyContainerProps {
27
28
  theme?: string;
28
29
  /** Progress bar configuration. Omit to use defaults. Pass false to hide. */
29
30
  progressBar?: SurveyProgressBarConfig | false;
31
+ /** Visual variant for MCQ + carousel. "PLC" uses the legacy training-app design. Default: "default" */
32
+ variant?: MCQVariant;
30
33
  }
31
- export declare function SurveyContainer({ data, onSubmit, onSave, onExit, isSubmitting, className, showHeader, theme, progressBar, }: SurveyContainerProps): import("react/jsx-runtime").JSX.Element;
34
+ export declare function SurveyContainer({ data, onSubmit, onSave, onExit, isSubmitting, className, showHeader, theme, progressBar, variant, }: SurveyContainerProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import type { SurveyConfig, SurveySubmitPayload } from "../types/survey.types";
2
2
  import type { PLCSurveyConfig } from "../converters/types";
3
3
  import type { SurveyProgressBarConfig } from "./SurveyContainer";
4
+ import type { MCQVariant } from "./custom/MCQSelect";
4
5
  /** Survey input: FMB (internal format) or PLC (converted to FMB at runtime). */
5
6
  export type SurveyInputData = SurveyConfig | PLCSurveyConfig;
6
7
  /** Payload passed to onSubmit/onSave: FMB or PLC depending on input data type. */
@@ -20,6 +21,8 @@ export interface SurveyRendererProps {
20
21
  theme?: string;
21
22
  /** Progress bar config. Omit for defaults. Pass false to hide. */
22
23
  progressBar?: SurveyProgressBarConfig | false;
24
+ /** Visual variant for MCQ + carousel. "PLC" uses the legacy training-app design. Default: "default" */
25
+ variant?: MCQVariant;
23
26
  }
24
27
  /**
25
28
  * Main entry component. Renders a full survey from JSON config.
@@ -2,6 +2,7 @@ export interface MCQOption {
2
2
  id: string;
3
3
  text: string;
4
4
  }
5
+ export type MCQVariant = "default" | "PLC";
5
6
  export interface MCQSelectProps {
6
7
  options: MCQOption[];
7
8
  selectionMode: "single" | "multiple";
@@ -9,5 +10,6 @@ export interface MCQSelectProps {
9
10
  onOptionSelect: (optionId: string | string[]) => void;
10
11
  className?: string;
11
12
  disabled?: boolean;
13
+ variant?: MCQVariant;
12
14
  }
13
- export default function MCQSelect({ options, selectionMode, selectedOptions, onOptionSelect, className, disabled, }: MCQSelectProps): import("react/jsx-runtime").JSX.Element;
15
+ export default function MCQSelect({ options, selectionMode, selectedOptions, onOptionSelect, className, disabled, variant, }: MCQSelectProps): import("react/jsx-runtime").JSX.Element;
package/dist/index.d.ts CHANGED
@@ -16,7 +16,8 @@ export { SubmissionLoadingOverlay } from "./components/SubmissionLoadingOverlay"
16
16
  export type { SurveyRendererProps } from "./components/SurveyRenderer";
17
17
  export type { SurveyContainerProps, SurveyProgressBarConfig, } from "./components/SurveyContainer";
18
18
  export type { QuestionRendererProps } from "./components/QuestionRenderer";
19
- export type { QuestionListCarouselProps, QuestionStatus as CarouselQuestionStatus } from "./components/QuestionListCarousel";
19
+ export type { QuestionListCarouselProps, QuestionStatus as CarouselQuestionStatus, CarouselVariant, } from "./components/QuestionListCarousel";
20
+ export type { MCQVariant } from "./components/custom/MCQSelect";
20
21
  export type { QuestionOverviewPanelProps } from "./components/QuestionOverviewPanel";
21
22
  export type { ValidationDialogProps } from "./components/ValidationDialog";
22
23
  export type { ExitConfirmationDialogProps } from "./components/ExitConfirmationDialog";