Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make question info a heading #82

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dist/index.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/index.js.map

Large diffs are not rendered by default.

916 changes: 916 additions & 0 deletions dist/index.modern.mjs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/index.modern.mjs.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions dist/index.module.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/index.module.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions dist/index.umd.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/index.umd.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/scripts/download-json.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions dist/scripts/generate-chapter-reading-homework-pdfs.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions dist/scripts/generate-pdf.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
2 changes: 2 additions & 0 deletions dist/src/assets/flag.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const SvgComponent: () => JSX.Element;
export default SvgComponent;
26 changes: 26 additions & 0 deletions dist/src/components/Answer.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { ReactNode } from 'react';
import { Answer as AnswerType, ID } from '../types';
export interface AnswerProps {
answer: AnswerType;
iter: number;
qid: ID;
type: 'teacher-review' | 'teacher-preview' | 'student' | 'student-mpp';
hasCorrectAnswer?: boolean;
onChangeAnswer?: (answer: AnswerType) => void;
disabled: boolean;
answerId?: ID;
correctAnswerId?: ID | null;
incorrectAnswerId?: ID;
onKeyPress?: () => void;
answered_count?: number;
correctIncorrectIcon?: ReactNode;
radioBox?: ReactNode;
contentRenderer?: JSX.Element;
show_all_feedback?: boolean;
tableFeedbackEnabled?: boolean;
feedbackId?: string;
}
export declare const Answer: {
(props: AnswerProps): JSX.Element;
displayName: string;
};
1 change: 1 addition & 0 deletions dist/src/components/Answer.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
4 changes: 4 additions & 0 deletions dist/src/components/Answer.stories.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export declare const Default: () => JSX.Element;
export declare const Checked: () => JSX.Element;
export declare const Correct: () => JSX.Element;
export declare const Incorrect: () => JSX.Element;
23 changes: 23 additions & 0 deletions dist/src/components/AnswersTable.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { AnswerDisplayType, ID, ExerciseQuestionData } from "src/types";
export interface AnswersTableProps {
question: ExerciseQuestionData;
type?: AnswerDisplayType;
answer_id?: ID;
correct_answer_id?: ID | null;
incorrectAnswerId?: ID;
answerIdOrder?: ID[];
feedback_html: string;
correct_answer_feedback_html?: string;
answered_count?: number;
show_all_feedback?: boolean;
tableFeedbackEnabled?: boolean;
onChangeAnswer: () => void;
hideAnswers: boolean;
hasCorrectAnswer?: boolean;
onChangeAttempt?: () => void;
choicesEnabled?: boolean;
onKeyPress?: () => void;
contentRenderer?: JSX.Element;
instructions?: JSX.Element;
}
export declare const AnswersTable: (props: AnswersTableProps) => JSX.Element | null;
1 change: 1 addition & 0 deletions dist/src/components/AnswersTable.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
5 changes: 5 additions & 0 deletions dist/src/components/AnswersTable.stories.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export declare const Default: () => JSX.Element;
export declare const Checked: () => JSX.Element;
export declare const CorrectAnswerFeedback: () => JSX.Element;
export declare const Ordered: () => JSX.Element;
export declare const Instructions: () => JSX.Element;
11 changes: 11 additions & 0 deletions dist/src/components/Button.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/// <reference types="react" />
interface ButtonProps extends React.ComponentPropsWithoutRef<'button'> {
isWaiting?: never;
waitingText?: never;
}
interface WaitingButtonProps extends React.ComponentPropsWithoutRef<'button'> {
isWaiting: boolean;
waitingText: string;
}
declare const Button: (props: ButtonProps | WaitingButtonProps) => JSX.Element;
export default Button;
1 change: 1 addition & 0 deletions dist/src/components/Button.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
3 changes: 3 additions & 0 deletions dist/src/components/Button.stories.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export declare const Default: () => JSX.Element;
export declare const Disabled: () => JSX.Element;
export declare const Waiting: () => JSX.Element;
38 changes: 38 additions & 0 deletions dist/src/components/Card.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { ReactNode } from "react";
import { AvailablePoints, StepBase, StepWithData } from "../types";
export declare const InnerStepCard: import("styled-components").StyledComponent<"div", any, {}, never>;
export declare const OuterStepCard: import("styled-components").StyledComponent<"div", any, {}, never>;
interface SharedProps {
questionNumber: number;
numberOfQuestions: number;
showTotalQuestions: boolean;
leftHeaderChildren?: ReactNode;
rightHeaderChildren?: ReactNode;
headerTitleChildren?: ReactNode;
}
export interface StepCardProps extends SharedProps {
unpadded: boolean;
className?: string;
children?: ReactNode;
stepType: StepWithData['type'];
availablePoints?: AvailablePoints;
questionId?: string;
multipartBadge?: ReactNode;
isHomework: boolean;
}
declare const StepCard: {
({ questionNumber, numberOfQuestions, showTotalQuestions, stepType, isHomework, availablePoints, unpadded, className, children, questionId, multipartBadge, leftHeaderChildren, rightHeaderChildren, headerTitleChildren, ...otherProps }: StepCardProps): JSX.Element;
displayName: string;
};
export interface TaskStepCardProps extends SharedProps {
className?: string;
children?: ReactNode;
step: StepBase | StepWithData;
questionNumber: number;
numberOfQuestions: number;
}
declare const TaskStepCard: {
({ step, questionNumber, numberOfQuestions, children, className, ...otherProps }: TaskStepCardProps): JSX.Element;
displayName: string;
};
export { StepCard, TaskStepCard };
1 change: 1 addition & 0 deletions dist/src/components/Card.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
2 changes: 2 additions & 0 deletions dist/src/components/Card.stories.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export declare const Default: () => JSX.Element;
export declare const CustomComponents: () => JSX.Element;
7 changes: 7 additions & 0 deletions dist/src/components/CompletionStatus.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export interface CompletionStatusProps {
numberOfQuestions: number;
numberCompleted: number;
handleClick: () => void;
className?: string;
}
export declare const CompletionStatus: import("styled-components").StyledComponent<({ numberOfQuestions, numberCompleted, handleClick, className }: CompletionStatusProps) => JSX.Element, any, {}, never>;
1 change: 1 addition & 0 deletions dist/src/components/CompletionStatus.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
3 changes: 3 additions & 0 deletions dist/src/components/CompletionStatus.stories.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export declare const Default: () => JSX.Element;
export declare const PartialComplete: () => JSX.Element;
export declare const Complete: () => JSX.Element;
10 changes: 10 additions & 0 deletions dist/src/components/Content.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from "react";
declare type ComponentType = keyof JSX.IntrinsicElements | React.JSXElementConstructor<any>;
export interface ContentProps<T extends ComponentType | undefined> {
className?: string;
component?: T extends undefined ? undefined : T extends ComponentType ? React.ReactComponentElement<T> : never;
html: string;
block?: boolean;
}
export declare const Content: <T extends ComponentType | undefined>({ html, component, block, ...props }: ContentProps<T>) => JSX.Element;
export {};
1 change: 1 addition & 0 deletions dist/src/components/Content.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
85 changes: 85 additions & 0 deletions dist/src/components/Exercise.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import { Answer, ExerciseData, ID, QuestionState, StepBase, StepWithData } from '../../src/types';
interface ExerciseIconLocation {
desktop: boolean;
mobile: boolean;
}
interface ExerciseIcon {
location?: {
/**
* @default {
* desktop: true,
* mobile: false
* }
**/
header?: ExerciseIconLocation;
/**
* @default {
* desktop: false,
* mobile: true
* }
**/
toolbar?: ExerciseIconLocation;
};
}
export interface ExerciseIcons {
/** An object containing a URL for the errata form for this exercise and settings for rendering the icon. */
errata?: ExerciseIcon & {
url: string;
};
/** An object containing a URL for textbook content relevant to the exercise and settings for rendering the icon. */
topic?: ExerciseIcon & {
url: string;
};
/** An object of settings for rendering the info icon that describes the exercise type (multiple-choice, two-step, etc.) */
info?: ExerciseIcon;
}
export interface ExerciseBaseProps {
/** An object containing a Step ID and Exercise UID */
step: StepBase;
/** An exercise object from the Exercises API */
exercise: ExerciseData;
numberOfQuestions: number;
/** The current question index. For multipart questions this is the first question number. */
questionNumber: number;
/** A boolean that enables showing the amount of attempts remaining. */
hasMultipleAttempts: boolean;
/** A callback with the question_id when the Submit/Re-submit button is clicked. */
onAnswerSave: (question_id: number) => void;
/** A callback with the current question index when the Next/Continue button is clicked. */
onNextStep: (currentIndex: number) => void;
/** A boolean that enables always showing every answer feedback_html field. */
show_all_feedback?: boolean;
/** The question number to scroll into view when the component renders. */
scrollToQuestion?: number;
/** An object containing data for how to render the following icons:
* - An errata icon linking to the errata/feedback form
* - An info icon describing the exercise type (multiple-choice, two-step, etc.)
* - A topic icon linking to the relevant textbook location
*/
exerciseIcons?: ExerciseIcons;
hasFeedback?: boolean;
}
export interface ExerciseWithStepDataProps extends ExerciseBaseProps {
/** A Tutor Step object */
step: StepWithData;
canAnswer: boolean;
needsSaved: boolean;
apiIsPending: boolean;
onAnswerChange: (answer: Answer) => void;
canUpdateCurrentStep: boolean;
answer_id_order?: ID[];
}
export interface ExerciseWithQuestionStatesProps extends ExerciseBaseProps {
questionStates: {
[key: ID]: QuestionState;
};
/** A callback with the IDs of the answer and question */
onAnswerChange: (answer: Omit<Answer, 'id'> & {
id: number;
question_id: number;
}) => void;
}
export declare const Exercise: import("styled-components").StyledComponent<({ numberOfQuestions, questionNumber, step, exercise, show_all_feedback, scrollToQuestion, exerciseIcons, ...props }: {
className?: string;
} & (ExerciseWithStepDataProps | ExerciseWithQuestionStatesProps)) => JSX.Element, any, {}, never>;
export {};
1 change: 1 addition & 0 deletions dist/src/components/Exercise.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
10 changes: 10 additions & 0 deletions dist/src/components/Exercise.stories.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export declare const Default: () => JSX.Element;
export declare const DefaultWithoutFeedback: () => JSX.Element;
export declare const DeprecatedStepData: () => JSX.Element;
export declare const CompleteWithFeedback: () => JSX.Element;
export declare const CompleteWithoutFeedback: () => JSX.Element;
export declare const IncorrectWithFeedbackAndSolution: () => JSX.Element;
export declare const IncorrectWithFeedbackAndSolutionWrappingText: () => JSX.Element;
export declare const MultiPartHalfComplete: () => JSX.Element;
export declare const Icons: () => JSX.Element;
export declare const MathJax: () => JSX.Element;
6 changes: 6 additions & 0 deletions dist/src/components/ExerciseHeaderIcons.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { ExerciseData } from '../../src/types';
import { ExerciseIcons } from './Exercise';
export declare const ExerciseHeaderIcons: ({ exercise, icons }: {
exercise: ExerciseData;
icons: ExerciseIcons;
}) => JSX.Element;
1 change: 1 addition & 0 deletions dist/src/components/ExerciseHeaderIcons.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
45 changes: 45 additions & 0 deletions dist/src/components/ExerciseQuestion.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React from "react";
import { AvailablePoints, ID, ExerciseQuestionData, Task } from "../types";
import { ExerciseBaseProps } from "./Exercise";
export interface ExerciseQuestionProps {
task?: Task;
question: ExerciseQuestionData;
answer_id_order?: ID[];
questionNumber: number;
choicesEnabled: boolean;
hasMultipleAttempts: boolean;
onAnswerChange: () => void;
onAnswerSave: ExerciseBaseProps['onAnswerSave'];
onNextStep: ExerciseBaseProps['onNextStep'];
feedback_html: string;
correct_answer_feedback_html: string;
is_completed: boolean;
correct_answer_id: ID;
incorrectAnswerId: ID;
answer_id?: ID;
attempts_remaining: number;
published_comments?: string;
detailedSolution?: string;
canAnswer: boolean;
needsSaved: boolean;
canUpdateCurrentStep: boolean;
attempt_number: number;
apiIsPending: boolean;
displaySolution: boolean;
available_points?: AvailablePoints;
exercise_uid: string;
free_response?: string;
show_all_feedback?: boolean;
tableFeedbackEnabled?: boolean;
hasFeedback?: ExerciseBaseProps['hasFeedback'];
}
export declare const SaveButton: (props: {
disabled: boolean;
isWaiting: boolean;
attempt_number: number;
willContinue: boolean;
} & React.ComponentPropsWithoutRef<'button'>) => JSX.Element;
export declare const NextButton: (props: {
canUpdateCurrentStep: boolean;
} & React.ComponentPropsWithoutRef<'button'>) => JSX.Element;
export declare const ExerciseQuestion: React.ForwardRefExoticComponent<ExerciseQuestionProps & React.RefAttributes<HTMLDivElement>>;
1 change: 1 addition & 0 deletions dist/src/components/ExerciseQuestion.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
5 changes: 5 additions & 0 deletions dist/src/components/ExerciseQuestion.stories.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export declare const Default: () => JSX.Element;
export declare const FreeResponseEntered: () => JSX.Element;
export declare const MultipleAttemptsAllLeft: () => JSX.Element;
export declare const MultipleAttemptsOneLeft: () => JSX.Element;
export declare const MultipleAttemptsNoneLeft: () => JSX.Element;
8 changes: 8 additions & 0 deletions dist/src/components/ExerciseToolbar.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { ExerciseIcons } from "./Exercise";
export declare const StyledToolbar: import("styled-components").StyledComponent<"div", any, {
mobile: boolean;
desktop: boolean;
}, never>;
export declare const ExerciseToolbar: ({ icons }: {
icons?: ExerciseIcons | undefined;
}) => JSX.Element | null;
1 change: 1 addition & 0 deletions dist/src/components/ExerciseToolbar.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
2 changes: 2 additions & 0 deletions dist/src/components/ExerciseToolbar.stories.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export declare const Default: () => JSX.Element;
export declare const DefaultMobileOnly: () => JSX.Element;
10 changes: 10 additions & 0 deletions dist/src/components/Feedback.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
interface FeedbackProps {
position?: 'top' | 'bottom' | 'left' | 'right';
children: string;
className?: string;
contentRenderer?: JSX.Element;
id: string;
}
declare const SimpleFeedback: (props: Pick<FeedbackProps, 'children' | 'className' | 'contentRenderer'>) => JSX.Element;
declare const Feedback: ({ id, ...props }: FeedbackProps) => JSX.Element;
export { Feedback, SimpleFeedback };
1 change: 1 addition & 0 deletions dist/src/components/Feedback.stories.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare const Default: () => JSX.Element;
24 changes: 24 additions & 0 deletions dist/src/components/FreeResponseInput.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { MouseEventHandler, ReactNode } from 'react';
import { AvailablePoints, ExerciseQuestionData } from 'src/types';
export interface FreeResponseProps {
readOnly: boolean;
wordLimit: number;
infoRowChildren?: ReactNode;
onChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
cancelHandler: MouseEventHandler<HTMLButtonElement>;
saveHandler: MouseEventHandler<HTMLButtonElement>;
defaultValue: string;
isSubmitDisabled: boolean;
questionNumber: number;
question: ExerciseQuestionData;
availablePoints?: AvailablePoints;
textHasChanged: boolean;
submitBtnLabel: string;
}
export declare const FreeResponseTextArea: import("styled-components").StyledComponent<"textarea", any, {
isOverWordLimit: boolean;
} & FreeResponseProps, never>;
export declare const FreeResponseInput: {
(props: FreeResponseProps): JSX.Element;
displayName: string;
};
1 change: 1 addition & 0 deletions dist/src/components/FreeResponseInput.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
3 changes: 3 additions & 0 deletions dist/src/components/FreeResponseInput.stories.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export declare const Default: () => JSX.Element;
export declare const OverWordLimit: () => JSX.Element;
export declare const SubmittedDate: () => JSX.Element;
1 change: 1 addition & 0 deletions dist/src/components/Loader.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare const Loader: () => JSX.Element;
1 change: 1 addition & 0 deletions dist/src/components/Loader.spec.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions dist/src/components/Loader.stories.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare const Default: () => JSX.Element;
1 change: 1 addition & 0 deletions dist/src/components/Print.stories.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare const Default: () => JSX.Element;
Loading
Loading