@khanacademy/perseus 1.4.0 → 2.0.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/es/index.css +9 -245
  3. package/dist/es/index.js +138 -584
  4. package/dist/es/index.js.map +1 -1
  5. package/dist/index.css +9 -245
  6. package/dist/index.js +135 -581
  7. package/dist/index.js.map +1 -1
  8. package/package.json +36 -36
  9. package/src/__stories__/hints-renderer.stories.jsx +9 -1
  10. package/src/__testdata__/graphie_testdata.js +53 -0
  11. package/src/__tests__/__snapshots__/perseus-markdown_test.jsx.snap +0 -9
  12. package/src/__tests__/__snapshots__/renderer_test.jsx.snap +0 -9
  13. package/src/components/__stories__/graphie.stories.jsx +5 -1
  14. package/src/hint-renderer.jsx +11 -14
  15. package/src/perseus-api.jsx +0 -23
  16. package/src/perseus-markdown.jsx +0 -25
  17. package/src/styles/constants.js +0 -21
  18. package/src/styles/global-constants.js +0 -6
  19. package/src/styles/khan-exercise.css +9 -1
  20. package/src/styles/perseus-renderer.less +0 -259
  21. package/src/styles/variables.less +0 -11
  22. package/src/styles/variables.shared.less +0 -10
  23. package/src/types.js +0 -16
  24. package/src/widgets/__stories__/input-number.stories.jsx +0 -14
  25. package/src/widgets/__stories__/radio.stories.jsx +0 -3
  26. package/src/widgets/__tests__/__snapshots__/definition_test.js.snap +18 -28
  27. package/src/widgets/__tests__/__snapshots__/group_test.jsx.snap +0 -9
  28. package/src/widgets/__tests__/__snapshots__/image_test.jsx.snap +0 -18
  29. package/src/widgets/__tests__/__snapshots__/numeric-input_test.jsx.snap +2 -440
  30. package/src/widgets/__tests__/__snapshots__/radio_test.jsx.snap +66 -3726
  31. package/src/widgets/__tests__/numeric-input_test.jsx +54 -118
  32. package/src/widgets/__tests__/radio/choice-icon_test.jsx +25 -75
  33. package/src/widgets/__tests__/radio_test.jsx +362 -394
  34. package/src/widgets/definition.jsx +27 -14
  35. package/src/widgets/input-number.jsx +2 -60
  36. package/src/widgets/numeric-input.jsx +17 -89
  37. package/src/widgets/radio/__stories__/base-radio.stories.jsx +1 -3
  38. package/src/widgets/radio/__stories__/choice-icon.stories.jsx +23 -105
  39. package/src/widgets/radio/__stories__/option-status.stories.jsx +0 -8
  40. package/src/widgets/radio/base-radio.jsx +13 -96
  41. package/src/widgets/radio/choice-icon/choice-icon.jsx +177 -50
  42. package/src/widgets/radio/choice-icon/cross-out-line.jsx +9 -13
  43. package/src/widgets/radio/choice-icon/shared-styles.js +2 -3
  44. package/src/widgets/radio/choice.jsx +5 -59
  45. package/src/widgets/radio/option-status.jsx +2 -14
  46. package/src/components/__stories__/possible-answers.stories.jsx +0 -22
  47. package/src/components/possible-answers.jsx +0 -36
  48. package/src/styles/widgets/definition.less +0 -86
  49. package/src/widgets/radio/__stories__/sat-styles.stories.jsx +0 -191
  50. package/src/widgets/radio/choice-icon/library-choice-icon.jsx +0 -225
  51. package/src/widgets/radio/choice-icon/sat-choice-icon.jsx +0 -120
@@ -65,7 +65,7 @@ exports[`Numeric input widget styles differently on mobile: mobile render 1`] =
65
65
  </div>
66
66
  `;
67
67
 
68
- exports[`numeric-input widget (options: {"satStyling":false}) question Should render predictably: after interaction 1`] = `
68
+ exports[`numeric-input widget Should render predictably: after interaction 1`] = `
69
69
  <div>
70
70
  <span
71
71
  class="mock-KatexProvider"
@@ -276,7 +276,7 @@ exports[`numeric-input widget (options: {"satStyling":false}) question Should re
276
276
  </div>
277
277
  `;
278
278
 
279
- exports[`numeric-input widget (options: {"satStyling":false}) question Should render predictably: first render 1`] = `
279
+ exports[`numeric-input widget Should render predictably: first render 1`] = `
280
280
  <div>
281
281
  <span
282
282
  class="mock-KatexProvider"
@@ -486,441 +486,3 @@ exports[`numeric-input widget (options: {"satStyling":false}) question Should re
486
486
  </span>
487
487
  </div>
488
488
  `;
489
-
490
- exports[`numeric-input widget (options: {"satStyling":true}) question Should render predictably: after interaction 1`] = `
491
- <div>
492
- <span
493
- class="mock-KatexProvider"
494
- >
495
- <div
496
- class="perseus-renderer perseus-renderer-responsive"
497
- >
498
- <div
499
- class="paragraph"
500
- data-perseus-paragraph-index="0"
501
- >
502
- <div
503
- class="paragraph"
504
- >
505
- <span
506
- style="white-space: nowrap;"
507
- >
508
- <span />
509
- <span
510
- class="mock-TeX"
511
- >
512
- 5008 \\div 4 =
513
- </span>
514
- <span />
515
- </span>
516
-
517
- <div
518
- class="perseus-widget-container widget-nohighlight widget-inline-block"
519
- >
520
- <label
521
- class="perseus-input-with-label"
522
- >
523
- <span
524
- aria-hidden="true"
525
- class="perseus-input-label"
526
- >
527
- Answer:
528
- </span>
529
- <span>
530
- <div>
531
- <input
532
- aria-label="Your answer:"
533
- autocapitalize="off"
534
- autocomplete="off"
535
- autocorrect="off"
536
- class="input_1t4b01j-o_O-LabelMedium_1rew30o-o_O-default_1r2dwp3-o_O-focused_1z0d9ul-o_O-input_19vw1dn"
537
- id="input-with-examples-bnVtZXJpYy1pbnB1dCAx"
538
- type="text"
539
- value="1252"
540
- />
541
- </div>
542
- <div
543
- style="position: relative; height: 0px; display: none;"
544
- >
545
- <div
546
- class="tooltipContainer"
547
- style="position: absolute; left: 0px;"
548
- >
549
- <div
550
- style="display: block; position: relative; visibility: visible; left: 0px; top: -1px; width: 12px; height: 11px; margin-top: -1px; margin-bottom: -2px; z-index: 10;"
551
- >
552
- <div
553
- style="display: block; height: 0px; width: 0px; position: absolute; left: 0px; top: -1px; border-right: 12px solid transparent; border-bottom: 12px solid #ccc;"
554
- />
555
- <div
556
- style="display: block; height: 0px; width: 0px; position: absolute; left: 1px; top: 1px; border-right: 10px solid transparent; border-bottom: 10px solid white;"
557
- />
558
- </div>
559
- <div
560
- class="perseus-formats-tooltip preview-measure"
561
- style="position: relative; top: 0px; left: 0px; border: 1px solid #ccc; box-shadow: 0 1px 3px #ccc; z-index: 9;"
562
- >
563
- <div
564
- id="input-with-examples-bnVtZXJpYy1pbnB1dCAx"
565
- >
566
- <span
567
- class="mock-KatexProvider"
568
- >
569
- <div
570
- class="perseus-renderer perseus-renderer-responsive"
571
- >
572
- <div
573
- class="paragraph"
574
- data-perseus-paragraph-index="0"
575
- >
576
- <ul>
577
- <li>
578
- <strong>
579
- Your answer should be
580
- </strong>
581
- </li>
582
- <li>
583
- an integer, like
584
- <span
585
- style="white-space: nowrap;"
586
- >
587
- <span />
588
- <span
589
- class="mock-TeX"
590
- >
591
- 6
592
- </span>
593
- <span />
594
- </span>
595
- </li>
596
- <li>
597
- a
598
- <em>
599
- simplified proper
600
- </em>
601
- fraction, like
602
- <span
603
- style="white-space: nowrap;"
604
- >
605
- <span />
606
- <span
607
- class="mock-TeX"
608
- >
609
- 3/5
610
- </span>
611
- <span />
612
- </span>
613
- </li>
614
- <li>
615
- a
616
- <em>
617
- simplified improper
618
- </em>
619
- fraction, like
620
- <span
621
- style="white-space: nowrap;"
622
- >
623
- <span />
624
- <span
625
- class="mock-TeX"
626
- >
627
- 7/4
628
- </span>
629
- <span />
630
- </span>
631
- </li>
632
- <li>
633
- a mixed number, like
634
- <span
635
- style="white-space: nowrap;"
636
- >
637
- <span />
638
- <span
639
- class="mock-TeX"
640
- >
641
- 1\\ 3/4
642
- </span>
643
- <span />
644
- </span>
645
- </li>
646
- <li>
647
- an
648
- <em>
649
- exact
650
- </em>
651
- decimal, like
652
- <span
653
- style="white-space: nowrap;"
654
- >
655
- <span />
656
- <span
657
- class="mock-TeX"
658
- >
659
- 0.75
660
- </span>
661
- <span />
662
- </span>
663
- </li>
664
- <li>
665
- a multiple of pi, like
666
- <span
667
- style="white-space: nowrap;"
668
- >
669
- <span />
670
- <span
671
- class="mock-TeX"
672
- >
673
- 12\\ \\text{pi}
674
- </span>
675
- <span />
676
- </span>
677
- or
678
- <span
679
- style="white-space: nowrap;"
680
- >
681
- <span />
682
- <span
683
- class="mock-TeX"
684
- >
685
- 2/3\\ \\text{pi}
686
- </span>
687
- <span />
688
- </span>
689
- </li>
690
- </ul>
691
- </div>
692
- </div>
693
- </span>
694
- </div>
695
- </div>
696
- </div>
697
- </div>
698
- </span>
699
- </label>
700
- </div>
701
-
702
- </div>
703
- </div>
704
- </div>
705
- </span>
706
- </div>
707
- `;
708
-
709
- exports[`numeric-input widget (options: {"satStyling":true}) question Should render predictably: first render 1`] = `
710
- <div>
711
- <span
712
- class="mock-KatexProvider"
713
- >
714
- <div
715
- class="perseus-renderer perseus-renderer-responsive"
716
- >
717
- <div
718
- class="paragraph"
719
- data-perseus-paragraph-index="0"
720
- >
721
- <div
722
- class="paragraph"
723
- >
724
- <span
725
- style="white-space: nowrap;"
726
- >
727
- <span />
728
- <span
729
- class="mock-TeX"
730
- >
731
- 5008 \\div 4 =
732
- </span>
733
- <span />
734
- </span>
735
-
736
- <div
737
- class="perseus-widget-container widget-nohighlight widget-inline-block"
738
- >
739
- <label
740
- class="perseus-input-with-label"
741
- >
742
- <span
743
- aria-hidden="true"
744
- class="perseus-input-label"
745
- >
746
- Answer:
747
- </span>
748
- <span>
749
- <div>
750
- <input
751
- aria-label="Your answer:"
752
- autocapitalize="off"
753
- autocomplete="off"
754
- autocorrect="off"
755
- class="input_1t4b01j-o_O-LabelMedium_1rew30o-o_O-default_1r2dwp3-o_O-input_19vw1dn"
756
- id="input-with-examples-bnVtZXJpYy1pbnB1dCAx"
757
- type="text"
758
- value=""
759
- />
760
- </div>
761
- <div
762
- style="position: relative; height: 0px; display: none;"
763
- >
764
- <div
765
- class="tooltipContainer"
766
- style="position: absolute; left: 0px;"
767
- >
768
- <div
769
- style="display: block; position: relative; visibility: visible; left: 0px; top: -1px; width: 12px; height: 11px; margin-top: -1px; margin-bottom: -2px; z-index: 10;"
770
- >
771
- <div
772
- style="display: block; height: 0px; width: 0px; position: absolute; left: 0px; top: -1px; border-right: 12px solid transparent; border-bottom: 12px solid #ccc;"
773
- />
774
- <div
775
- style="display: block; height: 0px; width: 0px; position: absolute; left: 1px; top: 1px; border-right: 10px solid transparent; border-bottom: 10px solid white;"
776
- />
777
- </div>
778
- <div
779
- class="perseus-formats-tooltip preview-measure"
780
- style="position: relative; top: 0px; left: 0px; border: 1px solid #ccc; box-shadow: 0 1px 3px #ccc; z-index: 9;"
781
- >
782
- <div
783
- id="input-with-examples-bnVtZXJpYy1pbnB1dCAx"
784
- >
785
- <span
786
- class="mock-KatexProvider"
787
- >
788
- <div
789
- class="perseus-renderer perseus-renderer-responsive"
790
- >
791
- <div
792
- class="paragraph"
793
- data-perseus-paragraph-index="0"
794
- >
795
- <ul>
796
- <li>
797
- <strong>
798
- Your answer should be
799
- </strong>
800
- </li>
801
- <li>
802
- an integer, like
803
- <span
804
- style="white-space: nowrap;"
805
- >
806
- <span />
807
- <span
808
- class="mock-TeX"
809
- >
810
- 6
811
- </span>
812
- <span />
813
- </span>
814
- </li>
815
- <li>
816
- a
817
- <em>
818
- simplified proper
819
- </em>
820
- fraction, like
821
- <span
822
- style="white-space: nowrap;"
823
- >
824
- <span />
825
- <span
826
- class="mock-TeX"
827
- >
828
- 3/5
829
- </span>
830
- <span />
831
- </span>
832
- </li>
833
- <li>
834
- a
835
- <em>
836
- simplified improper
837
- </em>
838
- fraction, like
839
- <span
840
- style="white-space: nowrap;"
841
- >
842
- <span />
843
- <span
844
- class="mock-TeX"
845
- >
846
- 7/4
847
- </span>
848
- <span />
849
- </span>
850
- </li>
851
- <li>
852
- a mixed number, like
853
- <span
854
- style="white-space: nowrap;"
855
- >
856
- <span />
857
- <span
858
- class="mock-TeX"
859
- >
860
- 1\\ 3/4
861
- </span>
862
- <span />
863
- </span>
864
- </li>
865
- <li>
866
- an
867
- <em>
868
- exact
869
- </em>
870
- decimal, like
871
- <span
872
- style="white-space: nowrap;"
873
- >
874
- <span />
875
- <span
876
- class="mock-TeX"
877
- >
878
- 0.75
879
- </span>
880
- <span />
881
- </span>
882
- </li>
883
- <li>
884
- a multiple of pi, like
885
- <span
886
- style="white-space: nowrap;"
887
- >
888
- <span />
889
- <span
890
- class="mock-TeX"
891
- >
892
- 12\\ \\text{pi}
893
- </span>
894
- <span />
895
- </span>
896
- or
897
- <span
898
- style="white-space: nowrap;"
899
- >
900
- <span />
901
- <span
902
- class="mock-TeX"
903
- >
904
- 2/3\\ \\text{pi}
905
- </span>
906
- <span />
907
- </span>
908
- </li>
909
- </ul>
910
- </div>
911
- </div>
912
- </span>
913
- </div>
914
- </div>
915
- </div>
916
- </div>
917
- </span>
918
- </label>
919
- </div>
920
-
921
- </div>
922
- </div>
923
- </div>
924
- </span>
925
- </div>
926
- `;