catchup-library-web 1.11.3 → 1.11.4

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.js CHANGED
@@ -3623,6 +3623,7 @@ var InputGroup = ({
3623
3623
  }) => {
3624
3624
  const textAreaRef = (0, import_react10.useRef)(null);
3625
3625
  const mathFieldRef = (0, import_react10.useRef)(null);
3626
+ const [isMathMode, setIsMathMode] = (0, import_react10.useState)(false);
3626
3627
  (0, import_react10.useEffect)(() => {
3627
3628
  if (!textAreaRef) return;
3628
3629
  if (!textAreaRef.current) return;
@@ -3835,60 +3836,64 @@ var InputGroup = ({
3835
3836
  ] });
3836
3837
  };
3837
3838
  const TextInputGroup = () => {
3838
- if (useMath) {
3839
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "my-1 relative", children: [
3840
- title ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400", children: title }) : null,
3841
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3842
- "div",
3843
- {
3844
- className: `w-full border ${errorText ? "border-catchup-red shadow-error" : "border-catchup-gray-100"} rounded-catchup-large focus-within:border-catchup-blue-400 focus-within:shadow-input ${disabled ? "bg-catchup-lighter-gray" : "bg-white"}`,
3845
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3846
- "math-field",
3847
- {
3848
- ref: mathFieldRef,
3849
- value: value || "",
3850
- onInput: handleMathFieldChange,
3851
- onFocus: handleMathFieldFocus,
3852
- placeholder: errorText ? errorText : placeholder,
3853
- disabled,
3854
- "virtual-keyboard-mode": "onfocus",
3855
- "smart-fence": true,
3856
- "smart-mode": true,
3857
- "smart-superscript": true,
3858
- style: {
3859
- fontSize: "16px",
3860
- padding: "8px 16px",
3861
- border: "none",
3862
- outline: "none",
3863
- width: "100%",
3864
- minHeight: "44px",
3865
- backgroundColor: disabled ? "#f5f5f5" : "transparent",
3866
- borderRadius: "16px",
3867
- fontFamily: "inherit",
3868
- color: disabled ? "#9ca3af" : "#000000"
3869
- }
3870
- }
3871
- )
3872
- }
3873
- )
3874
- ] });
3875
- }
3876
3839
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "my-1 relative", children: [
3877
3840
  title ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400", children: title }) : null,
3878
3841
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3879
- "input",
3842
+ "div",
3880
3843
  {
3881
- disabled,
3882
- className: `w-full py-2 px-4 border ${errorText ? "border-catchup-red shadow-error placeholder:text-catchup-red placeholder:opacity-80" : "border-catchup-gray-100"} rounded-catchup-large focus:outline-none placeholder-catchup-gray-200 focus:border-catchup-blue-400 ${disabled ? "bg-catchup-lighter-gray" : ""} focus:shadow-input`,
3883
- type,
3884
- defaultValue,
3885
- placeholder: errorText ? errorText : placeholder,
3886
- value,
3887
- onChange,
3888
- onFocus,
3889
- onKeyDown
3844
+ className: `w-full border ${errorText ? "border-catchup-red shadow-error" : "border-catchup-gray-100"} rounded-catchup-large focus-within:border-catchup-blue-400 focus-within:shadow-input ${disabled ? "bg-catchup-lighter-gray" : "bg-white"}`,
3845
+ children: useMath && isMathMode ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3846
+ "math-field",
3847
+ {
3848
+ ref: mathFieldRef,
3849
+ value: value || "",
3850
+ onInput: handleMathFieldChange,
3851
+ onFocus: handleMathFieldFocus,
3852
+ placeholder: errorText ? errorText : placeholder,
3853
+ disabled,
3854
+ "virtual-keyboard-mode": "off",
3855
+ "smart-fence": true,
3856
+ "smart-mode": true,
3857
+ "smart-superscript": true,
3858
+ style: {
3859
+ fontSize: "16px",
3860
+ padding: "8px 16px",
3861
+ border: "none",
3862
+ outline: "none",
3863
+ width: "100%",
3864
+ minHeight: "44px",
3865
+ backgroundColor: "transparent",
3866
+ borderRadius: "16px",
3867
+ fontFamily: "inherit",
3868
+ color: disabled ? "#9ca3af" : "#000000"
3869
+ }
3870
+ }
3871
+ ) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3872
+ "input",
3873
+ {
3874
+ disabled,
3875
+ className: `w-full py-2 px-4 border-none rounded-catchup-large focus:outline-none placeholder-catchup-gray-200 ${disabled ? "bg-catchup-lighter-gray" : ""} ${errorText ? "placeholder:text-catchup-red placeholder:opacity-80" : ""}`,
3876
+ type,
3877
+ defaultValue,
3878
+ placeholder: errorText ? errorText : placeholder,
3879
+ value,
3880
+ onChange,
3881
+ onFocus,
3882
+ onKeyDown
3883
+ }
3884
+ )
3890
3885
  }
3891
- )
3886
+ ),
3887
+ useMath && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "absolute right-5 -top-2 z-10 bg-catchup-white border border-catchup-gray-100 rounded-md px-2", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3888
+ "div",
3889
+ {
3890
+ className: "flex flex-row items-center gap-x-2 cursor-pointer text-md transition-all duration-300 text-catchup-gray-300",
3891
+ onClick: () => {
3892
+ setIsMathMode(!isMathMode);
3893
+ },
3894
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-row items-center gap-x-1", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "font-bold", children: isMathMode ? i18n_default.t("text_mode") : i18n_default.t("math_mode") }) })
3895
+ }
3896
+ ) })
3892
3897
  ] });
3893
3898
  };
3894
3899
  const RenderMainContent = () => {
package/dist/index.mjs CHANGED
@@ -3399,7 +3399,7 @@ import { InlineMath as InlineMath2 } from "react-katex";
3399
3399
 
3400
3400
  // src/components/groups/InputGroup.tsx
3401
3401
  import Select from "react-select";
3402
- import { useEffect as useEffect2, useRef } from "react";
3402
+ import { useEffect as useEffect2, useRef, useState as useState10 } from "react";
3403
3403
  import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
3404
3404
  var InputGroup = ({
3405
3405
  type,
@@ -3423,6 +3423,7 @@ var InputGroup = ({
3423
3423
  }) => {
3424
3424
  const textAreaRef = useRef(null);
3425
3425
  const mathFieldRef = useRef(null);
3426
+ const [isMathMode, setIsMathMode] = useState10(false);
3426
3427
  useEffect2(() => {
3427
3428
  if (!textAreaRef) return;
3428
3429
  if (!textAreaRef.current) return;
@@ -3635,60 +3636,64 @@ var InputGroup = ({
3635
3636
  ] });
3636
3637
  };
3637
3638
  const TextInputGroup = () => {
3638
- if (useMath) {
3639
- return /* @__PURE__ */ jsxs9("div", { className: "my-1 relative", children: [
3640
- title ? /* @__PURE__ */ jsx16("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400", children: title }) : null,
3641
- /* @__PURE__ */ jsx16(
3642
- "div",
3643
- {
3644
- className: `w-full border ${errorText ? "border-catchup-red shadow-error" : "border-catchup-gray-100"} rounded-catchup-large focus-within:border-catchup-blue-400 focus-within:shadow-input ${disabled ? "bg-catchup-lighter-gray" : "bg-white"}`,
3645
- children: /* @__PURE__ */ jsx16(
3646
- "math-field",
3647
- {
3648
- ref: mathFieldRef,
3649
- value: value || "",
3650
- onInput: handleMathFieldChange,
3651
- onFocus: handleMathFieldFocus,
3652
- placeholder: errorText ? errorText : placeholder,
3653
- disabled,
3654
- "virtual-keyboard-mode": "onfocus",
3655
- "smart-fence": true,
3656
- "smart-mode": true,
3657
- "smart-superscript": true,
3658
- style: {
3659
- fontSize: "16px",
3660
- padding: "8px 16px",
3661
- border: "none",
3662
- outline: "none",
3663
- width: "100%",
3664
- minHeight: "44px",
3665
- backgroundColor: disabled ? "#f5f5f5" : "transparent",
3666
- borderRadius: "16px",
3667
- fontFamily: "inherit",
3668
- color: disabled ? "#9ca3af" : "#000000"
3669
- }
3670
- }
3671
- )
3672
- }
3673
- )
3674
- ] });
3675
- }
3676
3639
  return /* @__PURE__ */ jsxs9("div", { className: "my-1 relative", children: [
3677
3640
  title ? /* @__PURE__ */ jsx16("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400", children: title }) : null,
3678
3641
  /* @__PURE__ */ jsx16(
3679
- "input",
3642
+ "div",
3680
3643
  {
3681
- disabled,
3682
- className: `w-full py-2 px-4 border ${errorText ? "border-catchup-red shadow-error placeholder:text-catchup-red placeholder:opacity-80" : "border-catchup-gray-100"} rounded-catchup-large focus:outline-none placeholder-catchup-gray-200 focus:border-catchup-blue-400 ${disabled ? "bg-catchup-lighter-gray" : ""} focus:shadow-input`,
3683
- type,
3684
- defaultValue,
3685
- placeholder: errorText ? errorText : placeholder,
3686
- value,
3687
- onChange,
3688
- onFocus,
3689
- onKeyDown
3644
+ className: `w-full border ${errorText ? "border-catchup-red shadow-error" : "border-catchup-gray-100"} rounded-catchup-large focus-within:border-catchup-blue-400 focus-within:shadow-input ${disabled ? "bg-catchup-lighter-gray" : "bg-white"}`,
3645
+ children: useMath && isMathMode ? /* @__PURE__ */ jsx16(
3646
+ "math-field",
3647
+ {
3648
+ ref: mathFieldRef,
3649
+ value: value || "",
3650
+ onInput: handleMathFieldChange,
3651
+ onFocus: handleMathFieldFocus,
3652
+ placeholder: errorText ? errorText : placeholder,
3653
+ disabled,
3654
+ "virtual-keyboard-mode": "off",
3655
+ "smart-fence": true,
3656
+ "smart-mode": true,
3657
+ "smart-superscript": true,
3658
+ style: {
3659
+ fontSize: "16px",
3660
+ padding: "8px 16px",
3661
+ border: "none",
3662
+ outline: "none",
3663
+ width: "100%",
3664
+ minHeight: "44px",
3665
+ backgroundColor: "transparent",
3666
+ borderRadius: "16px",
3667
+ fontFamily: "inherit",
3668
+ color: disabled ? "#9ca3af" : "#000000"
3669
+ }
3670
+ }
3671
+ ) : /* @__PURE__ */ jsx16(
3672
+ "input",
3673
+ {
3674
+ disabled,
3675
+ className: `w-full py-2 px-4 border-none rounded-catchup-large focus:outline-none placeholder-catchup-gray-200 ${disabled ? "bg-catchup-lighter-gray" : ""} ${errorText ? "placeholder:text-catchup-red placeholder:opacity-80" : ""}`,
3676
+ type,
3677
+ defaultValue,
3678
+ placeholder: errorText ? errorText : placeholder,
3679
+ value,
3680
+ onChange,
3681
+ onFocus,
3682
+ onKeyDown
3683
+ }
3684
+ )
3690
3685
  }
3691
- )
3686
+ ),
3687
+ useMath && /* @__PURE__ */ jsx16("div", { className: "absolute right-5 -top-2 z-10 bg-catchup-white border border-catchup-gray-100 rounded-md px-2", children: /* @__PURE__ */ jsx16(
3688
+ "div",
3689
+ {
3690
+ className: "flex flex-row items-center gap-x-2 cursor-pointer text-md transition-all duration-300 text-catchup-gray-300",
3691
+ onClick: () => {
3692
+ setIsMathMode(!isMathMode);
3693
+ },
3694
+ children: /* @__PURE__ */ jsx16("div", { className: "flex flex-row items-center gap-x-1", children: /* @__PURE__ */ jsx16("p", { className: "font-bold", children: isMathMode ? i18n_default.t("text_mode") : i18n_default.t("math_mode") }) })
3695
+ }
3696
+ ) })
3692
3697
  ] });
3693
3698
  };
3694
3699
  const RenderMainContent = () => {
@@ -3714,7 +3719,7 @@ var InputGroup_default = InputGroup;
3714
3719
 
3715
3720
  // src/components/activities/material-content/DropdownActivityMaterialContent.tsx
3716
3721
  import { useEffect as useEffect4 } from "react";
3717
- import { useState as useState12 } from "react";
3722
+ import { useState as useState13 } from "react";
3718
3723
 
3719
3724
  // src/utilization/AppUtilization.ts
3720
3725
  var colors = [
@@ -3814,10 +3819,10 @@ var getColorByIndex = (index) => {
3814
3819
  };
3815
3820
 
3816
3821
  // src/components/dropdowns/MediaDropdown.tsx
3817
- import { useState as useState10 } from "react";
3822
+ import { useState as useState11 } from "react";
3818
3823
  import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
3819
3824
  var MediaDropdown = ({ id, answer, optionList }) => {
3820
- const [showDropdown, setShowDropdown] = useState10(false);
3825
+ const [showDropdown, setShowDropdown] = useState11(false);
3821
3826
  return /* @__PURE__ */ jsxs10(
3822
3827
  "div",
3823
3828
  {
@@ -3862,7 +3867,7 @@ var MediaDropdown = ({ id, answer, optionList }) => {
3862
3867
  var MediaDropdown_default = MediaDropdown;
3863
3868
 
3864
3869
  // src/components/activities/material-content/ShowMaterialMediaByContentType.tsx
3865
- import { useEffect as useEffect3, useRef as useRef2, useState as useState11 } from "react";
3870
+ import { useEffect as useEffect3, useRef as useRef2, useState as useState12 } from "react";
3866
3871
  import Modal3 from "react-modal";
3867
3872
  import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
3868
3873
  var ShowMaterialMediaByContentType = ({
@@ -3871,10 +3876,10 @@ var ShowMaterialMediaByContentType = ({
3871
3876
  src,
3872
3877
  canFullScreen
3873
3878
  }) => {
3874
- const [showFullScreen, setShowFullScreen] = useState11(false);
3875
- const [selectedFullScreenItem, setSelectedFullScreenItem] = useState11(null);
3876
- const [isLoaded, setIsLoaded] = useState11(false);
3877
- const [isFullHeight, setIsFullHeight] = useState11(false);
3879
+ const [showFullScreen, setShowFullScreen] = useState12(false);
3880
+ const [selectedFullScreenItem, setSelectedFullScreenItem] = useState12(null);
3881
+ const [isLoaded, setIsLoaded] = useState12(false);
3882
+ const [isFullHeight, setIsFullHeight] = useState12(false);
3878
3883
  const imageRef = useRef2(null);
3879
3884
  useEffect3(() => {
3880
3885
  setIsLoaded(false);
@@ -4029,7 +4034,7 @@ var DropdownActivityMaterialContent = ({
4029
4034
  isPreview,
4030
4035
  showCorrectAnswer
4031
4036
  }) => {
4032
- const [updated, setUpdated] = useState12(false);
4037
+ const [updated, setUpdated] = useState13(false);
4033
4038
  useEffect4(() => {
4034
4039
  if (!showCorrectAnswer) return;
4035
4040
  const foundAnswer = answer.data.find(
@@ -4173,7 +4178,7 @@ var DropdownActivityMaterialContent = ({
4173
4178
  var DropdownActivityMaterialContent_default = DropdownActivityMaterialContent;
4174
4179
 
4175
4180
  // src/components/activities/DropdownActivityContent.tsx
4176
- import { useState as useState13, useEffect as useEffect5 } from "react";
4181
+ import { useState as useState14, useEffect as useEffect5 } from "react";
4177
4182
  import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
4178
4183
  var DropdownActivityContent = ({
4179
4184
  answer,
@@ -4187,7 +4192,7 @@ var DropdownActivityContent = ({
4187
4192
  const contentMap = parseContentMapFromData(data);
4188
4193
  const dropdownBodyMap = parseBodyMapFromData(data, "DROPDOWN");
4189
4194
  const dropdownMaterialMap = parseMaterialMapFromData(data, "DROPDOWN");
4190
- const [currentAnswerMap, setCurrentAnswerMap] = useState13(() => {
4195
+ const [currentAnswerMap, setCurrentAnswerMap] = useState14(() => {
4191
4196
  return retrieveCurrentAnswerMap();
4192
4197
  });
4193
4198
  function retrieveCurrentAnswerMap() {
@@ -4247,7 +4252,7 @@ var DropdownActivityContent_default = DropdownActivityContent;
4247
4252
 
4248
4253
  // src/components/activities/material-content/FillInTheBlanksActivityMaterialContent.tsx
4249
4254
  import { InlineMath as InlineMath3 } from "react-katex";
4250
- import { useState as useState14 } from "react";
4255
+ import { useState as useState15 } from "react";
4251
4256
  import { useEffect as useEffect6 } from "react";
4252
4257
  import { useDrop as useDrop2 } from "react-dnd";
4253
4258
 
@@ -4334,9 +4339,9 @@ var FillInTheBlanksActivityMaterialContent = ({
4334
4339
  isPreview,
4335
4340
  showCorrectAnswer
4336
4341
  }) => {
4337
- const [shuffleOptionList, setShuffleOptionList] = useState14([]);
4338
- const [selectedOption, setSelectedOption] = useState14(null);
4339
- const [pasteOptionIndex, setPasteOptionIndex] = useState14(null);
4342
+ const [shuffleOptionList, setShuffleOptionList] = useState15([]);
4343
+ const [selectedOption, setSelectedOption] = useState15(null);
4344
+ const [pasteOptionIndex, setPasteOptionIndex] = useState15(null);
4340
4345
  const [{ isOver, canDrop }, drop] = useDrop2({
4341
4346
  accept: "FILL_IN_THE_BLANKS",
4342
4347
  drop: () => {
@@ -4527,7 +4532,7 @@ var FillInTheBlanksActivityMaterialContent = ({
4527
4532
  var FillInTheBlanksActivityMaterialContent_default = FillInTheBlanksActivityMaterialContent;
4528
4533
 
4529
4534
  // src/components/activities/FillInTheBlanksActivityContent.tsx
4530
- import { useState as useState15, useEffect as useEffect7 } from "react";
4535
+ import { useState as useState16, useEffect as useEffect7 } from "react";
4531
4536
  import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
4532
4537
  var FillInTheBlanksActivityContent = ({
4533
4538
  answer,
@@ -4548,7 +4553,7 @@ var FillInTheBlanksActivityContent = ({
4548
4553
  "FILL_IN_THE_BLANKS"
4549
4554
  );
4550
4555
  const fillInTheBlanksIncorrectList = data.fillInTheBlanksIncorrectList ? JSON.parse(data.fillInTheBlanksIncorrectList) : [];
4551
- const [currentAnswerMap, setCurrentAnswerMap] = useState15(() => {
4556
+ const [currentAnswerMap, setCurrentAnswerMap] = useState16(() => {
4552
4557
  return retrieveCurrentAnswerMap();
4553
4558
  });
4554
4559
  function retrieveCurrentAnswerMap() {
@@ -4626,18 +4631,18 @@ var FillInTheBlanksActivityContent = ({
4626
4631
  var FillInTheBlanksActivityContent_default = FillInTheBlanksActivityContent;
4627
4632
 
4628
4633
  // src/components/activities/material-content/GroupingActivityMaterialContent.tsx
4629
- import { useEffect as useEffect9, useRef as useRef4, useState as useState17 } from "react";
4634
+ import { useEffect as useEffect9, useRef as useRef4, useState as useState18 } from "react";
4630
4635
  import { useDrop as useDrop3 } from "react-dnd";
4631
4636
  import { InlineMath as InlineMath4 } from "react-katex";
4632
4637
 
4633
4638
  // src/hooks/useScreenSize.ts
4634
- import { useState as useState16, useEffect as useEffect8 } from "react";
4639
+ import { useState as useState17, useEffect as useEffect8 } from "react";
4635
4640
  var useScreenSize = () => {
4636
- const [containerSize, setContainerSize] = useState16({
4641
+ const [containerSize, setContainerSize] = useState17({
4637
4642
  width: 0,
4638
4643
  height: 0
4639
4644
  });
4640
- const [screenSize, setScreenSize] = useState16({
4645
+ const [screenSize, setScreenSize] = useState17({
4641
4646
  width: window.innerWidth,
4642
4647
  height: window.innerHeight
4643
4648
  });
@@ -4677,10 +4682,10 @@ var GroupingActivityMaterialContent = ({
4677
4682
  isPreview,
4678
4683
  showCorrectAnswer
4679
4684
  }) => {
4680
- const [selectedValue, setSelectedValue] = useState17(null);
4681
- const [selectedTargetKey, setSelectedTargetKey] = useState17(null);
4682
- const [isShuffled, setIsShuffled] = useState17(false);
4683
- const [shuffledMaterialList, setShuffledMaterialList] = useState17([]);
4685
+ const [selectedValue, setSelectedValue] = useState18(null);
4686
+ const [selectedTargetKey, setSelectedTargetKey] = useState18(null);
4687
+ const [isShuffled, setIsShuffled] = useState18(false);
4688
+ const [shuffledMaterialList, setShuffledMaterialList] = useState18([]);
4684
4689
  const { screenSize, containerSize } = useScreenSize_default();
4685
4690
  const [{ isOver, canDrop }, drop] = useDrop3({
4686
4691
  accept: "GROUPING",
@@ -4693,7 +4698,7 @@ var GroupingActivityMaterialContent = ({
4693
4698
  });
4694
4699
  const ref = useRef4(null);
4695
4700
  const itemsRef = useRef4(null);
4696
- const [maxWidth, setMaxWidth] = useState17(0);
4701
+ const [maxWidth, setMaxWidth] = useState18(0);
4697
4702
  useEffect9(() => {
4698
4703
  if (!ref) return;
4699
4704
  if (!ref.current) return;
@@ -4995,7 +5000,7 @@ var GroupingActivityContent = ({
4995
5000
  var GroupingActivityContent_default = GroupingActivityContent;
4996
5001
 
4997
5002
  // src/components/activities/material-content/MatchingActivityMaterialContent.tsx
4998
- import { useEffect as useEffect10, useRef as useRef5, useState as useState18 } from "react";
5003
+ import { useEffect as useEffect10, useRef as useRef5, useState as useState19 } from "react";
4999
5004
  import { useDrop as useDrop4 } from "react-dnd";
5000
5005
  import { InlineMath as InlineMath5 } from "react-katex";
5001
5006
  import { Fragment as Fragment3, jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
@@ -5009,10 +5014,10 @@ var MatchingActivityMaterialContent = ({
5009
5014
  isPreview,
5010
5015
  showCorrectAnswer
5011
5016
  }) => {
5012
- const [selectedValue, setSelectedValue] = useState18(null);
5013
- const [selectedTargetKey, setSelectedTargetKey] = useState18(null);
5014
- const [isShuffled, setIsShuffled] = useState18(false);
5015
- const [shuffledMaterialList, setShuffledMaterialList] = useState18([]);
5017
+ const [selectedValue, setSelectedValue] = useState19(null);
5018
+ const [selectedTargetKey, setSelectedTargetKey] = useState19(null);
5019
+ const [isShuffled, setIsShuffled] = useState19(false);
5020
+ const [shuffledMaterialList, setShuffledMaterialList] = useState19([]);
5016
5021
  const [{ isOver, canDrop }, drop] = useDrop4({
5017
5022
  accept: "MATCHING",
5018
5023
  drop: () => {
@@ -5698,7 +5703,7 @@ var OpenEndedActivityContent = ({
5698
5703
  var OpenEndedActivityContent_default = OpenEndedActivityContent;
5699
5704
 
5700
5705
  // src/components/activities/material-content/OrderingActivityMaterialContent.tsx
5701
- import { useEffect as useEffect11, useState as useState19 } from "react";
5706
+ import { useEffect as useEffect11, useState as useState20 } from "react";
5702
5707
  import { useDrop as useDrop6 } from "react-dnd";
5703
5708
  import { InlineMath as InlineMath8 } from "react-katex";
5704
5709
 
@@ -5767,10 +5772,10 @@ var OrderingActivityMaterialContent = ({
5767
5772
  isPreview,
5768
5773
  showCorrectAnswer
5769
5774
  }) => {
5770
- const [selectedTargetKey, setSelectedTargetKey] = useState19(null);
5771
- const [selectedKey, setSelectedKey] = useState19(null);
5775
+ const [selectedTargetKey, setSelectedTargetKey] = useState20(null);
5776
+ const [selectedKey, setSelectedKey] = useState20(null);
5772
5777
  const { screenSize } = useScreenSize_default();
5773
- const [view, setView] = useState19("PC");
5778
+ const [view, setView] = useState20("PC");
5774
5779
  const [{ isOver, canDrop }, drop] = useDrop6({
5775
5780
  accept: "ORDERING",
5776
5781
  drop: () => {
@@ -5965,7 +5970,7 @@ var OrderingActivityContent = ({
5965
5970
  var OrderingActivityContent_default = OrderingActivityContent;
5966
5971
 
5967
5972
  // src/components/activities/material-content/TrueFalseActivityMaterialContent.tsx
5968
- import { useEffect as useEffect12, useState as useState20 } from "react";
5973
+ import { useEffect as useEffect12, useState as useState21 } from "react";
5969
5974
  import { InlineMath as InlineMath9 } from "react-katex";
5970
5975
  import { Fragment as Fragment8, jsx as jsx38, jsxs as jsxs28 } from "react/jsx-runtime";
5971
5976
  var TrueFalseActivityMaterialContent = ({
@@ -5979,7 +5984,7 @@ var TrueFalseActivityMaterialContent = ({
5979
5984
  showCorrectAnswer
5980
5985
  }) => {
5981
5986
  const { screenSize } = useScreenSize_default();
5982
- const [shuffleOptionList, setShuffleOptionList] = useState20([]);
5987
+ const [shuffleOptionList, setShuffleOptionList] = useState21([]);
5983
5988
  useEffect12(() => {
5984
5989
  const optionList = [];
5985
5990
  optionList.push(...materialMap.trueList);
@@ -6298,7 +6303,7 @@ var ActivityEvaluationRubricContent = ({
6298
6303
  var ActivityEvaluationRubricContent_default = ActivityEvaluationRubricContent;
6299
6304
 
6300
6305
  // src/components/activities/ActivityPreviewByData.tsx
6301
- import { useEffect as useEffect13, useState as useState21 } from "react";
6306
+ import { useEffect as useEffect13, useState as useState22 } from "react";
6302
6307
 
6303
6308
  // src/components/boxes/SelectionBox.tsx
6304
6309
  import { jsx as jsx42, jsxs as jsxs32 } from "react/jsx-runtime";
@@ -6350,9 +6355,9 @@ var ActivityPreviewByData = ({
6350
6355
  showTaxonomy,
6351
6356
  isFullScreen
6352
6357
  }) => {
6353
- const [key, setKey] = useState21((/* @__PURE__ */ new Date()).getTime());
6354
- const [selectedType, setSelectedType] = useState21(null);
6355
- const [optionList, setOptionList] = useState21([]);
6358
+ const [key, setKey] = useState22((/* @__PURE__ */ new Date()).getTime());
6359
+ const [selectedType, setSelectedType] = useState22(null);
6360
+ const [optionList, setOptionList] = useState22([]);
6356
6361
  useEffect13(() => {
6357
6362
  if (!data) return;
6358
6363
  setKey((/* @__PURE__ */ new Date()).getTime());
@@ -6577,7 +6582,7 @@ var ActivityPreviewByData = ({
6577
6582
  var ActivityPreviewByData_default = ActivityPreviewByData;
6578
6583
 
6579
6584
  // src/components/activities/ActivityPreviewByAnswerData.tsx
6580
- import { useEffect as useEffect14, useState as useState22 } from "react";
6585
+ import { useEffect as useEffect14, useState as useState23 } from "react";
6581
6586
  import { jsx as jsx44, jsxs as jsxs34 } from "react/jsx-runtime";
6582
6587
  var ActivityPreviewByAnswerData = ({
6583
6588
  data,
@@ -6592,10 +6597,10 @@ var ActivityPreviewByAnswerData = ({
6592
6597
  showCorrectAnswer = false
6593
6598
  }) => {
6594
6599
  var _a;
6595
- const [key, setKey] = useState22((/* @__PURE__ */ new Date()).getTime());
6596
- const [selectedType, setSelectedType] = useState22(null);
6597
- const [optionList, setOptionList] = useState22([]);
6598
- const [answer, setAnswer] = useState22({ data: [] });
6600
+ const [key, setKey] = useState23((/* @__PURE__ */ new Date()).getTime());
6601
+ const [selectedType, setSelectedType] = useState23(null);
6602
+ const [optionList, setOptionList] = useState23([]);
6603
+ const [answer, setAnswer] = useState23({ data: [] });
6599
6604
  useEffect14(() => {
6600
6605
  if (!data) return;
6601
6606
  setKey((/* @__PURE__ */ new Date()).getTime());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catchup-library-web",
3
- "version": "1.11.3",
3
+ "version": "1.11.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  import Select from "react-select";
2
2
  import i18n from "../../language/i18n";
3
- import { useEffect, useRef } from "react";
3
+ import { useEffect, useRef, useState } from "react";
4
4
  import { IInputGroupProps } from "../../properties/GroupProperties";
5
5
  import BaseImage from "../images/BaseImage";
6
6
  import { IOptionProps } from "../../properties/CommonProperties";
@@ -64,6 +64,7 @@ const InputGroup = ({
64
64
  }: IInputGroupProps) => {
65
65
  const textAreaRef = useRef<HTMLTextAreaElement>(null);
66
66
  const mathFieldRef = useRef<MathfieldElement>(null);
67
+ const [isMathMode, setIsMathMode] = useState<boolean>(false);
67
68
 
68
69
  useEffect(() => {
69
70
  if (!textAreaRef) return;
@@ -336,23 +337,24 @@ const InputGroup = ({
336
337
  };
337
338
 
338
339
  const TextInputGroup = () => {
339
- if (useMath) {
340
- return (
341
- <div className="my-1 relative">
342
- {title ? (
343
- <p className="text-md font-semibold pl-2 py-1 text-catchup-gray-400">
344
- {title}
345
- </p>
346
- ) : null}
347
- <div
348
- className={`w-full border ${
349
- errorText
350
- ? "border-catchup-red shadow-error"
351
- : "border-catchup-gray-100"
352
- } rounded-catchup-large focus-within:border-catchup-blue-400 focus-within:shadow-input ${
353
- disabled ? "bg-catchup-lighter-gray" : "bg-white"
354
- }`}
355
- >
340
+ return (
341
+ <div className="my-1 relative">
342
+ {title ? (
343
+ <p className="text-md font-semibold pl-2 py-1 text-catchup-gray-400">
344
+ {title}
345
+ </p>
346
+ ) : null}
347
+
348
+ <div
349
+ className={`w-full border ${
350
+ errorText
351
+ ? "border-catchup-red shadow-error"
352
+ : "border-catchup-gray-100"
353
+ } rounded-catchup-large focus-within:border-catchup-blue-400 focus-within:shadow-input ${
354
+ disabled ? "bg-catchup-lighter-gray" : "bg-white"
355
+ }`}
356
+ >
357
+ {useMath && isMathMode ? (
356
358
  <math-field
357
359
  ref={mathFieldRef}
358
360
  value={value || ""}
@@ -360,7 +362,7 @@ const InputGroup = ({
360
362
  onFocus={handleMathFieldFocus}
361
363
  placeholder={errorText ? errorText : placeholder}
362
364
  disabled={disabled}
363
- virtual-keyboard-mode="onfocus"
365
+ virtual-keyboard-mode="off"
364
366
  smart-fence={true}
365
367
  smart-mode={true}
366
368
  smart-superscript={true}
@@ -371,49 +373,49 @@ const InputGroup = ({
371
373
  outline: "none",
372
374
  width: "100%",
373
375
  minHeight: "44px",
374
- backgroundColor: disabled ? "#f5f5f5" : "transparent",
376
+ backgroundColor: "transparent",
375
377
  borderRadius: "16px",
376
378
  fontFamily: "inherit",
377
379
  color: disabled ? "#9ca3af" : "#000000",
378
380
  }}
379
381
  />
380
- </div>
382
+ ) : (
383
+ <input
384
+ disabled={disabled}
385
+ className={`w-full py-2 px-4 border-none rounded-catchup-large focus:outline-none placeholder-catchup-gray-200 ${
386
+ disabled ? "bg-catchup-lighter-gray" : ""
387
+ } ${
388
+ errorText
389
+ ? "placeholder:text-catchup-red placeholder:opacity-80"
390
+ : ""
391
+ }`}
392
+ type={type}
393
+ defaultValue={defaultValue}
394
+ placeholder={errorText ? errorText : placeholder}
395
+ value={value}
396
+ onChange={onChange}
397
+ onFocus={onFocus}
398
+ onKeyDown={onKeyDown}
399
+ />
400
+ )}
381
401
  </div>
382
- );
383
- }
384
-
385
- return (
386
- <div className="my-1 relative">
387
- {title ? (
388
- <p className="text-md font-semibold pl-2 py-1 text-catchup-gray-400">
389
- {title}
390
- </p>
391
- ) : null}
392
- <input
393
- disabled={disabled}
394
- className={`w-full py-2 px-4 border ${
395
- errorText
396
- ? "border-catchup-red shadow-error placeholder:text-catchup-red placeholder:opacity-80"
397
- : "border-catchup-gray-100"
398
- } rounded-catchup-large focus:outline-none placeholder-catchup-gray-200 focus:border-catchup-blue-400 ${
399
- disabled ? "bg-catchup-lighter-gray" : ""
400
- } focus:shadow-input`}
401
- type={type}
402
- defaultValue={defaultValue}
403
- placeholder={errorText ? errorText : placeholder}
404
- value={value}
405
- onChange={onChange}
406
- onFocus={onFocus}
407
- onKeyDown={onKeyDown}
408
- />
409
402
 
410
- {/* <div
411
- className={`${
412
- title ? "absolute top-0 right-0" : "absolute top-3 left-5"
413
- }`}
414
- >
415
- <p className="italic text-catchup-red opacity-70">{errorText}</p>
416
- </div> */}
403
+ {useMath && (
404
+ <div className="absolute right-5 -top-2 z-10 bg-catchup-white border border-catchup-gray-100 rounded-md px-2">
405
+ <div
406
+ className="flex flex-row items-center gap-x-2 cursor-pointer text-md transition-all duration-300 text-catchup-gray-300"
407
+ onClick={() => {
408
+ setIsMathMode(!isMathMode);
409
+ }}
410
+ >
411
+ <div className="flex flex-row items-center gap-x-1">
412
+ <p className="font-bold">
413
+ {isMathMode ? i18n.t("text_mode") : i18n.t("math_mode")}
414
+ </p>
415
+ </div>
416
+ </div>
417
+ </div>
418
+ )}
417
419
  </div>
418
420
  );
419
421
  };