@jswork/react-questkit 1.0.1 → 1.0.3

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.
package/dist/index.d.mts CHANGED
@@ -63,8 +63,6 @@ interface QuestCommonProps {
63
63
  onSubmit?: (result: QuestResult) => void;
64
64
  /** 默认 true */
65
65
  sound?: boolean;
66
- /** 预览外框(示例与评审用),默认 false */
67
- frame?: boolean;
68
66
  /** 演示直达:0 未答 / 1 首错 / 2 二错 */
69
67
  demoAttempt?: 0 | 1 | 2;
70
68
  className?: string;
@@ -336,7 +334,7 @@ interface InstructionProps {
336
334
  className?: string;
337
335
  }
338
336
  /** 空值整行不渲染;支持 <b> / <u> 行内标记 */
339
- declare function Instruction({ children, icon, variant, className, }: InstructionProps): react.JSX.Element | null;
337
+ declare function Instruction({ children, icon, variant, className }: InstructionProps): react.JSX.Element | null;
340
338
 
341
339
  interface QuestShellProps {
342
340
  mode?: QuestMode;
@@ -350,13 +348,11 @@ interface QuestShellProps {
350
348
  footer?: ReactNode;
351
349
  /** 反馈卡绝对定位在操作栏上方 */
352
350
  feedback?: ReactNode;
353
- frame?: boolean;
354
- statusBar?: boolean;
355
351
  dataQuest?: string;
356
352
  className?: string;
357
353
  children?: ReactNode;
358
354
  }
359
- declare function QuestShell({ mode, title, index, total, instruction, instructionVariant, onBack, footer, feedback, frame, statusBar, dataQuest, className, children, }: QuestShellProps): react.JSX.Element;
355
+ declare function QuestShell({ mode, index, total, instruction, instructionVariant, footer, feedback, dataQuest, className, children }: QuestShellProps): react.JSX.Element;
360
356
 
361
357
  type OptionState = 'default' | 'selected' | 'correct' | 'wrong' | 'disabled' | 'faded';
362
358
  interface OptionItemProps {
@@ -403,7 +399,7 @@ interface ProgressProps {
403
399
  className?: string;
404
400
  }
405
401
  /** 独立答题进度条:左侧题号,右侧渐变轨道 */
406
- declare function Progress({ value, total, showValue, ariaLabel, className, }: ProgressProps): react.JSX.Element;
402
+ declare function Progress({ value, total, showValue, ariaLabel, className }: ProgressProps): react.JSX.Element;
407
403
 
408
404
  interface SegmentedOption {
409
405
  value: string;
@@ -429,79 +425,79 @@ interface SingleChoiceProps extends QuestCommonProps {
429
425
  data: SingleChoiceData;
430
426
  }
431
427
 
432
- declare function SingleChoice({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, frame, demoAttempt, className, }: SingleChoiceProps): react.JSX.Element;
428
+ declare function SingleChoice({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, demoAttempt, className, }: SingleChoiceProps): react.JSX.Element;
433
429
 
434
430
  interface FollowReadProps extends QuestCommonProps, FollowReadExtraProps {
435
431
  data: FollowReadData;
436
432
  }
437
433
 
438
- declare function FollowRead({ data, mode, index, total, title, instruction, onBack, onNext, onSubmit, sound, frame, className, demoState, onScore, onRecordingChange, }: FollowReadProps): react.JSX.Element;
434
+ declare function FollowRead({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, className, demoState, onScore, onRecordingChange, }: FollowReadProps): react.JSX.Element;
439
435
 
440
436
  interface LinkMatchProps extends QuestCommonProps {
441
437
  data: LinkMatchData;
442
438
  }
443
439
 
444
- declare function LinkMatch({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, frame, demoAttempt, className, }: LinkMatchProps): react.JSX.Element;
440
+ declare function LinkMatch({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, demoAttempt, className, }: LinkMatchProps): react.JSX.Element;
445
441
 
446
442
  interface RearrangeProps extends QuestCommonProps {
447
443
  data: RearrangeData;
448
444
  }
449
445
 
450
- declare function Rearrange({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, frame, demoAttempt, className, }: RearrangeProps): react.JSX.Element;
446
+ declare function Rearrange({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, demoAttempt, className, }: RearrangeProps): react.JSX.Element;
451
447
 
452
448
  interface ClassifyProps extends QuestCommonProps {
453
449
  data: ClassifyData;
454
450
  }
455
451
 
456
- declare function Classify({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, frame, demoAttempt, className, }: ClassifyProps): react.JSX.Element;
452
+ declare function Classify({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, demoAttempt, className, }: ClassifyProps): react.JSX.Element;
457
453
 
458
454
  interface RewriteProps extends QuestCommonProps {
459
455
  data: RewriteData;
460
456
  }
461
457
 
462
- declare function Rewrite({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, frame, demoAttempt, className, }: RewriteProps): react.JSX.Element;
458
+ declare function Rewrite({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, demoAttempt, className, }: RewriteProps): react.JSX.Element;
463
459
 
464
460
  interface FillBlankProps extends QuestCommonProps {
465
461
  data: FillBlankData;
466
462
  }
467
463
 
468
- declare function FillBlank({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, frame, demoAttempt, className, }: FillBlankProps): react.JSX.Element;
464
+ declare function FillBlank({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, demoAttempt, className, }: FillBlankProps): react.JSX.Element;
469
465
 
470
466
  interface WordSelectProps extends QuestCommonProps {
471
467
  data: WordSelectData;
472
468
  }
473
469
 
474
- declare function WordSelect({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, frame, demoAttempt, className, }: WordSelectProps): react.JSX.Element;
470
+ declare function WordSelect({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, demoAttempt, className, }: WordSelectProps): react.JSX.Element;
475
471
 
476
472
  interface SortSentencesProps extends QuestCommonProps {
477
473
  data: SortSentencesData;
478
474
  }
479
475
 
480
- declare function SortSentences({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, frame, demoAttempt, className, }: SortSentencesProps): react.JSX.Element;
476
+ declare function SortSentences({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, demoAttempt, className, }: SortSentencesProps): react.JSX.Element;
481
477
 
482
478
  interface ClozeProps extends QuestCommonProps {
483
479
  data: ClozeData;
484
480
  }
485
481
 
486
- declare function Cloze({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, frame, demoAttempt, className, }: ClozeProps): react.JSX.Element;
482
+ declare function Cloze({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, demoAttempt, className, }: ClozeProps): react.JSX.Element;
487
483
 
488
484
  interface ReadingComprehensionProps extends QuestCommonProps {
489
485
  data: ReadingData;
490
486
  }
491
487
 
492
- declare function ReadingComprehension({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, frame, demoAttempt, className, }: ReadingComprehensionProps): react.JSX.Element;
488
+ declare function ReadingComprehension({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, demoAttempt, className, }: ReadingComprehensionProps): react.JSX.Element;
493
489
 
494
490
  interface ListenTaskProps extends QuestCommonProps {
495
491
  data: ListenTaskData;
496
492
  }
497
493
 
498
- declare function ListenTask({ data, mode, index, total, title, instruction, onBack, onNext, onSubmit, frame, className, }: ListenTaskProps): react.JSX.Element;
494
+ declare function ListenTask({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, className, }: ListenTaskProps): react.JSX.Element;
499
495
 
500
496
  interface VideoTaskProps extends QuestCommonProps {
501
497
  data: VideoTaskData;
502
498
  }
503
499
 
504
- declare function VideoTask({ data, mode, index, total, title, instruction, onBack, onNext, onSubmit, frame, className, }: VideoTaskProps): react.JSX.Element;
500
+ declare function VideoTask({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, className, }: VideoTaskProps): react.JSX.Element;
505
501
 
506
502
  declare const defaultQuestLabels: QuestLabels;
507
503
  interface QuestConfig {
@@ -586,9 +582,13 @@ interface QuestAction {
586
582
  }
587
583
  interface ActionBarProps {
588
584
  actions: QuestAction[];
585
+ /** 当前页面进度,1-based;默认 1 */
586
+ index?: number;
587
+ /** 上一题回调;传入后进入自动上一题模式 */
588
+ onPrev?: () => void;
589
589
  className?: string;
590
590
  }
591
- declare function ActionBar({ actions, className }: ActionBarProps): react.JSX.Element | null;
591
+ declare function ActionBar({ actions, index, onPrev, className }: ActionBarProps): react.JSX.Element | null;
592
592
 
593
593
  interface AudioBarProps {
594
594
  src?: string;
@@ -637,9 +637,11 @@ interface CelebrationProps {
637
637
  ribbon?: ReactNode;
638
638
  note?: ReactNode;
639
639
  confetti?: boolean;
640
+ /** 自动消失时长(毫秒),不传则常驻 */
641
+ autoHideMs?: number;
640
642
  className?: string;
641
643
  }
642
- declare function Celebration({ grade, title, ribbon, note, confetti, className }: CelebrationProps): react.JSX.Element;
644
+ declare function Celebration({ grade, title, ribbon, note, confetti, autoHideMs, className }: CelebrationProps): react.JSX.Element | null;
643
645
 
644
646
  type PictureState = 'default' | 'loading' | 'fail' | 'ok';
645
647
  interface PictureBoxProps {
package/dist/index.d.ts CHANGED
@@ -63,8 +63,6 @@ interface QuestCommonProps {
63
63
  onSubmit?: (result: QuestResult) => void;
64
64
  /** 默认 true */
65
65
  sound?: boolean;
66
- /** 预览外框(示例与评审用),默认 false */
67
- frame?: boolean;
68
66
  /** 演示直达:0 未答 / 1 首错 / 2 二错 */
69
67
  demoAttempt?: 0 | 1 | 2;
70
68
  className?: string;
@@ -336,7 +334,7 @@ interface InstructionProps {
336
334
  className?: string;
337
335
  }
338
336
  /** 空值整行不渲染;支持 <b> / <u> 行内标记 */
339
- declare function Instruction({ children, icon, variant, className, }: InstructionProps): react.JSX.Element | null;
337
+ declare function Instruction({ children, icon, variant, className }: InstructionProps): react.JSX.Element | null;
340
338
 
341
339
  interface QuestShellProps {
342
340
  mode?: QuestMode;
@@ -350,13 +348,11 @@ interface QuestShellProps {
350
348
  footer?: ReactNode;
351
349
  /** 反馈卡绝对定位在操作栏上方 */
352
350
  feedback?: ReactNode;
353
- frame?: boolean;
354
- statusBar?: boolean;
355
351
  dataQuest?: string;
356
352
  className?: string;
357
353
  children?: ReactNode;
358
354
  }
359
- declare function QuestShell({ mode, title, index, total, instruction, instructionVariant, onBack, footer, feedback, frame, statusBar, dataQuest, className, children, }: QuestShellProps): react.JSX.Element;
355
+ declare function QuestShell({ mode, index, total, instruction, instructionVariant, footer, feedback, dataQuest, className, children }: QuestShellProps): react.JSX.Element;
360
356
 
361
357
  type OptionState = 'default' | 'selected' | 'correct' | 'wrong' | 'disabled' | 'faded';
362
358
  interface OptionItemProps {
@@ -403,7 +399,7 @@ interface ProgressProps {
403
399
  className?: string;
404
400
  }
405
401
  /** 独立答题进度条:左侧题号,右侧渐变轨道 */
406
- declare function Progress({ value, total, showValue, ariaLabel, className, }: ProgressProps): react.JSX.Element;
402
+ declare function Progress({ value, total, showValue, ariaLabel, className }: ProgressProps): react.JSX.Element;
407
403
 
408
404
  interface SegmentedOption {
409
405
  value: string;
@@ -429,79 +425,79 @@ interface SingleChoiceProps extends QuestCommonProps {
429
425
  data: SingleChoiceData;
430
426
  }
431
427
 
432
- declare function SingleChoice({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, frame, demoAttempt, className, }: SingleChoiceProps): react.JSX.Element;
428
+ declare function SingleChoice({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, demoAttempt, className, }: SingleChoiceProps): react.JSX.Element;
433
429
 
434
430
  interface FollowReadProps extends QuestCommonProps, FollowReadExtraProps {
435
431
  data: FollowReadData;
436
432
  }
437
433
 
438
- declare function FollowRead({ data, mode, index, total, title, instruction, onBack, onNext, onSubmit, sound, frame, className, demoState, onScore, onRecordingChange, }: FollowReadProps): react.JSX.Element;
434
+ declare function FollowRead({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, className, demoState, onScore, onRecordingChange, }: FollowReadProps): react.JSX.Element;
439
435
 
440
436
  interface LinkMatchProps extends QuestCommonProps {
441
437
  data: LinkMatchData;
442
438
  }
443
439
 
444
- declare function LinkMatch({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, frame, demoAttempt, className, }: LinkMatchProps): react.JSX.Element;
440
+ declare function LinkMatch({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, demoAttempt, className, }: LinkMatchProps): react.JSX.Element;
445
441
 
446
442
  interface RearrangeProps extends QuestCommonProps {
447
443
  data: RearrangeData;
448
444
  }
449
445
 
450
- declare function Rearrange({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, frame, demoAttempt, className, }: RearrangeProps): react.JSX.Element;
446
+ declare function Rearrange({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, demoAttempt, className, }: RearrangeProps): react.JSX.Element;
451
447
 
452
448
  interface ClassifyProps extends QuestCommonProps {
453
449
  data: ClassifyData;
454
450
  }
455
451
 
456
- declare function Classify({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, frame, demoAttempt, className, }: ClassifyProps): react.JSX.Element;
452
+ declare function Classify({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, demoAttempt, className, }: ClassifyProps): react.JSX.Element;
457
453
 
458
454
  interface RewriteProps extends QuestCommonProps {
459
455
  data: RewriteData;
460
456
  }
461
457
 
462
- declare function Rewrite({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, frame, demoAttempt, className, }: RewriteProps): react.JSX.Element;
458
+ declare function Rewrite({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, demoAttempt, className, }: RewriteProps): react.JSX.Element;
463
459
 
464
460
  interface FillBlankProps extends QuestCommonProps {
465
461
  data: FillBlankData;
466
462
  }
467
463
 
468
- declare function FillBlank({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, frame, demoAttempt, className, }: FillBlankProps): react.JSX.Element;
464
+ declare function FillBlank({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, demoAttempt, className, }: FillBlankProps): react.JSX.Element;
469
465
 
470
466
  interface WordSelectProps extends QuestCommonProps {
471
467
  data: WordSelectData;
472
468
  }
473
469
 
474
- declare function WordSelect({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, frame, demoAttempt, className, }: WordSelectProps): react.JSX.Element;
470
+ declare function WordSelect({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, demoAttempt, className, }: WordSelectProps): react.JSX.Element;
475
471
 
476
472
  interface SortSentencesProps extends QuestCommonProps {
477
473
  data: SortSentencesData;
478
474
  }
479
475
 
480
- declare function SortSentences({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, frame, demoAttempt, className, }: SortSentencesProps): react.JSX.Element;
476
+ declare function SortSentences({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, demoAttempt, className, }: SortSentencesProps): react.JSX.Element;
481
477
 
482
478
  interface ClozeProps extends QuestCommonProps {
483
479
  data: ClozeData;
484
480
  }
485
481
 
486
- declare function Cloze({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, frame, demoAttempt, className, }: ClozeProps): react.JSX.Element;
482
+ declare function Cloze({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, demoAttempt, className, }: ClozeProps): react.JSX.Element;
487
483
 
488
484
  interface ReadingComprehensionProps extends QuestCommonProps {
489
485
  data: ReadingData;
490
486
  }
491
487
 
492
- declare function ReadingComprehension({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, frame, demoAttempt, className, }: ReadingComprehensionProps): react.JSX.Element;
488
+ declare function ReadingComprehension({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, sound, demoAttempt, className, }: ReadingComprehensionProps): react.JSX.Element;
493
489
 
494
490
  interface ListenTaskProps extends QuestCommonProps {
495
491
  data: ListenTaskData;
496
492
  }
497
493
 
498
- declare function ListenTask({ data, mode, index, total, title, instruction, onBack, onNext, onSubmit, frame, className, }: ListenTaskProps): react.JSX.Element;
494
+ declare function ListenTask({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, className, }: ListenTaskProps): react.JSX.Element;
499
495
 
500
496
  interface VideoTaskProps extends QuestCommonProps {
501
497
  data: VideoTaskData;
502
498
  }
503
499
 
504
- declare function VideoTask({ data, mode, index, total, title, instruction, onBack, onNext, onSubmit, frame, className, }: VideoTaskProps): react.JSX.Element;
500
+ declare function VideoTask({ data, mode, index, total, title, instruction, onBack, onPrev, onNext, onSubmit, className, }: VideoTaskProps): react.JSX.Element;
505
501
 
506
502
  declare const defaultQuestLabels: QuestLabels;
507
503
  interface QuestConfig {
@@ -586,9 +582,13 @@ interface QuestAction {
586
582
  }
587
583
  interface ActionBarProps {
588
584
  actions: QuestAction[];
585
+ /** 当前页面进度,1-based;默认 1 */
586
+ index?: number;
587
+ /** 上一题回调;传入后进入自动上一题模式 */
588
+ onPrev?: () => void;
589
589
  className?: string;
590
590
  }
591
- declare function ActionBar({ actions, className }: ActionBarProps): react.JSX.Element | null;
591
+ declare function ActionBar({ actions, index, onPrev, className }: ActionBarProps): react.JSX.Element | null;
592
592
 
593
593
  interface AudioBarProps {
594
594
  src?: string;
@@ -637,9 +637,11 @@ interface CelebrationProps {
637
637
  ribbon?: ReactNode;
638
638
  note?: ReactNode;
639
639
  confetti?: boolean;
640
+ /** 自动消失时长(毫秒),不传则常驻 */
641
+ autoHideMs?: number;
640
642
  className?: string;
641
643
  }
642
- declare function Celebration({ grade, title, ribbon, note, confetti, className }: CelebrationProps): react.JSX.Element;
644
+ declare function Celebration({ grade, title, ribbon, note, confetti, autoHideMs, className }: CelebrationProps): react.JSX.Element | null;
643
645
 
644
646
  type PictureState = 'default' | 'loading' | 'fail' | 'ok';
645
647
  interface PictureBoxProps {