catchup-library-web 2.6.2 → 2.6.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.d.mts CHANGED
@@ -282,7 +282,7 @@ interface IInputGroupProps {
282
282
  title?: string;
283
283
  defaultValue?: string;
284
284
  placeholder?: string;
285
- value: string;
285
+ value: any;
286
286
  minValue?: string;
287
287
  maxValue?: string;
288
288
  onFocus?: (e: any) => void;
@@ -298,6 +298,8 @@ interface IInputGroupProps {
298
298
  disabled?: boolean;
299
299
  limit?: number;
300
300
  useMath?: boolean;
301
+ checked?: boolean;
302
+ description?: string;
301
303
  }
302
304
  interface ILeftTextRightInputGroupProps {
303
305
  type: string;
@@ -349,7 +351,7 @@ declare global {
349
351
  }
350
352
  }
351
353
  }
352
- declare const InputGroup: ({ type, title, defaultValue, placeholder, value, minValue, maxValue, onFocus, onChange, onClick, onKeyDown, optionList, errorText, multiple, accept, theme, useMinHeight, disabled, limit, useMath, }: IInputGroupProps) => react_jsx_runtime.JSX.Element;
354
+ declare const InputGroup: ({ type, title, defaultValue, placeholder, value, minValue, maxValue, onFocus, onChange, onClick, onKeyDown, optionList, errorText, multiple, accept, theme, useMinHeight, disabled, limit, useMath, checked, description, }: IInputGroupProps) => react_jsx_runtime.JSX.Element;
353
355
 
354
356
  declare const LeftTextRightInputGroup: ({ type, title, value, optionList, onChange, disabled, errorText, }: ILeftTextRightInputGroupProps) => react_jsx_runtime.JSX.Element;
355
357
 
package/dist/index.d.ts CHANGED
@@ -282,7 +282,7 @@ interface IInputGroupProps {
282
282
  title?: string;
283
283
  defaultValue?: string;
284
284
  placeholder?: string;
285
- value: string;
285
+ value: any;
286
286
  minValue?: string;
287
287
  maxValue?: string;
288
288
  onFocus?: (e: any) => void;
@@ -298,6 +298,8 @@ interface IInputGroupProps {
298
298
  disabled?: boolean;
299
299
  limit?: number;
300
300
  useMath?: boolean;
301
+ checked?: boolean;
302
+ description?: string;
301
303
  }
302
304
  interface ILeftTextRightInputGroupProps {
303
305
  type: string;
@@ -349,7 +351,7 @@ declare global {
349
351
  }
350
352
  }
351
353
  }
352
- declare const InputGroup: ({ type, title, defaultValue, placeholder, value, minValue, maxValue, onFocus, onChange, onClick, onKeyDown, optionList, errorText, multiple, accept, theme, useMinHeight, disabled, limit, useMath, }: IInputGroupProps) => react_jsx_runtime.JSX.Element;
354
+ declare const InputGroup: ({ type, title, defaultValue, placeholder, value, minValue, maxValue, onFocus, onChange, onClick, onKeyDown, optionList, errorText, multiple, accept, theme, useMinHeight, disabled, limit, useMath, checked, description, }: IInputGroupProps) => react_jsx_runtime.JSX.Element;
353
355
 
354
356
  declare const LeftTextRightInputGroup: ({ type, title, value, optionList, onChange, disabled, errorText, }: ILeftTextRightInputGroupProps) => react_jsx_runtime.JSX.Element;
355
357
 
package/dist/index.js CHANGED
@@ -3844,6 +3844,7 @@ var import_react_katex2 = require("react-katex");
3844
3844
 
3845
3845
  // src/components/groups/InputGroup.tsx
3846
3846
  var import_react_select = __toESM(require("react-select"));
3847
+ var import_react_switch = __toESM(require("react-switch"));
3847
3848
  var import_react12 = require("react");
3848
3849
  var import_jsx_runtime23 = require("react/jsx-runtime");
3849
3850
  var InputGroup = ({
@@ -3866,7 +3867,9 @@ var InputGroup = ({
3866
3867
  useMinHeight,
3867
3868
  disabled,
3868
3869
  limit,
3869
- useMath
3870
+ useMath,
3871
+ checked,
3872
+ description
3870
3873
  }) => {
3871
3874
  const textAreaRef = (0, import_react12.useRef)(null);
3872
3875
  const latexTextAreaRef = (0, import_react12.useRef)(null);
@@ -4266,6 +4269,39 @@ var InputGroup = ({
4266
4269
  )
4267
4270
  ] });
4268
4271
  };
4272
+ const SwitchInputGroup = () => {
4273
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col my-1", children: [
4274
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-row items-center", children: [
4275
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4276
+ import_react_switch.default,
4277
+ {
4278
+ onChange: () => {
4279
+ onClick && onClick(!checked);
4280
+ },
4281
+ checkedIcon: false,
4282
+ offColor: "#e2e8f0",
4283
+ onColor: "#57C2D3",
4284
+ offHandleColor: "#57C2D3",
4285
+ onHandleColor: "#e2e8f0",
4286
+ uncheckedIcon: false,
4287
+ checked: !!checked,
4288
+ height: 20,
4289
+ width: 40,
4290
+ handleDiameter: 14,
4291
+ disabled
4292
+ }
4293
+ ),
4294
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4295
+ "p",
4296
+ {
4297
+ className: `${checked ? "font-bold" : "text-catchup-gray"} px-2 transition-all duration-300`,
4298
+ children: title
4299
+ }
4300
+ )
4301
+ ] }),
4302
+ description ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm text-catchup-gray-300 mt-1 ml-12", children: description }) : null
4303
+ ] });
4304
+ };
4269
4305
  const RenderMainContent = () => {
4270
4306
  if (type === "text" || type === "number") {
4271
4307
  return TextInputGroup();
@@ -4281,6 +4317,8 @@ var InputGroup = ({
4281
4317
  return FileInputGroup();
4282
4318
  } else if (type === "checkbox") {
4283
4319
  return CheckboxInputGroup();
4320
+ } else if (type === "switch") {
4321
+ return SwitchInputGroup();
4284
4322
  }
4285
4323
  };
4286
4324
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
@@ -4943,6 +4981,7 @@ var FillInTheBlanksActivityMaterialContent = ({
4943
4981
  setMousePosition({ x: 0, y: 0 });
4944
4982
  };
4945
4983
  const handleTouchStart = (e, option, element) => {
4984
+ e.preventDefault();
4946
4985
  const touch = e.touches[0];
4947
4986
  setDraggedOption(option);
4948
4987
  setDraggedElement(element);
@@ -5060,6 +5099,7 @@ var FillInTheBlanksActivityMaterialContent = ({
5060
5099
  {
5061
5100
  ref: draggedOption === option ? dragElementRef : null,
5062
5101
  className: `${draggedOption === option ? "opacity-40" : selectedOption === option ? "ring-2 ring-blue-500" : "opacity-100"} transition-all duration-200`,
5102
+ style: { touchAction: "none" },
5063
5103
  onMouseDown: (e) => handleMouseDown(e, option),
5064
5104
  onTouchStart: (e) => handleTouchStart(e, option, e.currentTarget),
5065
5105
  onTouchMove: handleTouchMove,
@@ -5431,6 +5471,7 @@ var GroupingActivityMaterialContent = ({
5431
5471
  };
5432
5472
  const handleTouchStart = (e, materialValue, element) => {
5433
5473
  if (!checkCanAnswerQuestion()) return;
5474
+ e.preventDefault();
5434
5475
  const touch = e.touches[0];
5435
5476
  setDraggedValue(materialValue);
5436
5477
  setDraggedElement(element);
@@ -5540,6 +5581,7 @@ var GroupingActivityMaterialContent = ({
5540
5581
  {
5541
5582
  ref: draggedValue === materialValue ? dragElementRef : null,
5542
5583
  className: `${draggedValue === materialValue ? "opacity-40" : selectedValue === materialValue ? "ring-2 ring-blue-500" : "opacity-100"} transition-all duration-200`,
5584
+ style: { touchAction: "none" },
5543
5585
  onMouseDown: (e) => handleMouseDown(e, materialValue),
5544
5586
  onTouchStart: (e) => handleTouchStart(e, materialValue, e.currentTarget),
5545
5587
  onTouchMove: handleTouchMove,
@@ -5874,6 +5916,7 @@ var MatchingActivityMaterialContent = ({
5874
5916
  };
5875
5917
  const handleTouchStart = (e, materialValue, element) => {
5876
5918
  if (!checkCanAnswerQuestion()) return;
5919
+ e.preventDefault();
5877
5920
  const touch = e.touches[0];
5878
5921
  setDraggedValue(materialValue);
5879
5922
  setDraggedElement(element);
@@ -5987,6 +6030,7 @@ var MatchingActivityMaterialContent = ({
5987
6030
  {
5988
6031
  ref: draggedValue === materialValue ? dragElementRef : null,
5989
6032
  className: `${draggedValue === materialValue ? "opacity-40" : selectedValue === materialValue ? "ring-2 ring-blue-500" : "opacity-100"} transition-all duration-200`,
6033
+ style: { touchAction: "none" },
5990
6034
  onMouseDown: (e) => handleMouseDown(e, materialValue),
5991
6035
  onTouchStart: (e) => handleTouchStart(e, materialValue, e.currentTarget),
5992
6036
  onTouchMove: handleTouchMove,
@@ -6572,7 +6616,7 @@ var OpenEndedActivityMaterialContent = ({
6572
6616
  src: answerMapAnswer,
6573
6617
  alt: "document",
6574
6618
  size: "custom",
6575
- className: "w-[80%] rounded-catchup-xlarge"
6619
+ className: "w-[80%] rounded-catchup-xlarge max-h-[50vh] object-contain"
6576
6620
  }
6577
6621
  ) });
6578
6622
  } else if (fileType === "PDF") {
@@ -6614,7 +6658,7 @@ var OpenEndedActivityMaterialContent = ({
6614
6658
  src: answerMapAnswer,
6615
6659
  alt: "document",
6616
6660
  size: "custom",
6617
- className: "w-[80%] rounded-catchup-xlarge"
6661
+ className: "w-[80%] rounded-catchup-xlarge max-h-[50vh] object-contain"
6618
6662
  }
6619
6663
  ) }) : fileType === "PDF" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex flex-col justify-center items-center my-5", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BasePDF_default, { file: answerMapAnswer }) }) : null });
6620
6664
  };
@@ -6771,6 +6815,7 @@ var OrderingActivityMaterialContent = ({
6771
6815
  };
6772
6816
  const handleTouchStart = (e, materialKey, element) => {
6773
6817
  if (!checkCanAnswerQuestion()) return;
6818
+ e.preventDefault();
6774
6819
  const touch = e.touches[0];
6775
6820
  setDraggedKey(materialKey);
6776
6821
  setDraggedElement(element);
@@ -6902,6 +6947,7 @@ var OrderingActivityMaterialContent = ({
6902
6947
  ref: draggedKey === materialKey ? dragElementRef : null,
6903
6948
  "data-ordering-drop-zone": materialKey,
6904
6949
  className: `flex-1 ${draggedKey === materialKey ? "opacity-40" : selectedKey === materialKey ? "ring-2 ring-blue-500" : "opacity-100"} ${dropTargetKey === materialKey && draggedKey !== materialKey ? "ring-2 ring-blue-400 bg-blue-50" : ""} transition-all duration-200`,
6950
+ style: { touchAction: "none" },
6905
6951
  onMouseDown: (e) => handleMouseDown(e, materialKey),
6906
6952
  onMouseEnter: () => draggedKey && draggedKey !== materialKey && setDropTargetKey(materialKey),
6907
6953
  onMouseLeave: () => setDropTargetKey(null),
package/dist/index.mjs CHANGED
@@ -3610,6 +3610,7 @@ import { InlineMath as InlineMath2 } from "react-katex";
3610
3610
 
3611
3611
  // src/components/groups/InputGroup.tsx
3612
3612
  import Select from "react-select";
3613
+ import Switch from "react-switch";
3613
3614
  import { useEffect as useEffect3, useRef, useState as useState12, useCallback } from "react";
3614
3615
  import { Fragment, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
3615
3616
  var InputGroup = ({
@@ -3632,7 +3633,9 @@ var InputGroup = ({
3632
3633
  useMinHeight,
3633
3634
  disabled,
3634
3635
  limit,
3635
- useMath
3636
+ useMath,
3637
+ checked,
3638
+ description
3636
3639
  }) => {
3637
3640
  const textAreaRef = useRef(null);
3638
3641
  const latexTextAreaRef = useRef(null);
@@ -4032,6 +4035,39 @@ var InputGroup = ({
4032
4035
  )
4033
4036
  ] });
4034
4037
  };
4038
+ const SwitchInputGroup = () => {
4039
+ return /* @__PURE__ */ jsxs14("div", { className: "flex flex-col my-1", children: [
4040
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-row items-center", children: [
4041
+ /* @__PURE__ */ jsx23(
4042
+ Switch,
4043
+ {
4044
+ onChange: () => {
4045
+ onClick && onClick(!checked);
4046
+ },
4047
+ checkedIcon: false,
4048
+ offColor: "#e2e8f0",
4049
+ onColor: "#57C2D3",
4050
+ offHandleColor: "#57C2D3",
4051
+ onHandleColor: "#e2e8f0",
4052
+ uncheckedIcon: false,
4053
+ checked: !!checked,
4054
+ height: 20,
4055
+ width: 40,
4056
+ handleDiameter: 14,
4057
+ disabled
4058
+ }
4059
+ ),
4060
+ /* @__PURE__ */ jsx23(
4061
+ "p",
4062
+ {
4063
+ className: `${checked ? "font-bold" : "text-catchup-gray"} px-2 transition-all duration-300`,
4064
+ children: title
4065
+ }
4066
+ )
4067
+ ] }),
4068
+ description ? /* @__PURE__ */ jsx23("p", { className: "text-sm text-catchup-gray-300 mt-1 ml-12", children: description }) : null
4069
+ ] });
4070
+ };
4035
4071
  const RenderMainContent = () => {
4036
4072
  if (type === "text" || type === "number") {
4037
4073
  return TextInputGroup();
@@ -4047,6 +4083,8 @@ var InputGroup = ({
4047
4083
  return FileInputGroup();
4048
4084
  } else if (type === "checkbox") {
4049
4085
  return CheckboxInputGroup();
4086
+ } else if (type === "switch") {
4087
+ return SwitchInputGroup();
4050
4088
  }
4051
4089
  };
4052
4090
  return /* @__PURE__ */ jsxs14(Fragment, { children: [
@@ -4709,6 +4747,7 @@ var FillInTheBlanksActivityMaterialContent = ({
4709
4747
  setMousePosition({ x: 0, y: 0 });
4710
4748
  };
4711
4749
  const handleTouchStart = (e, option, element) => {
4750
+ e.preventDefault();
4712
4751
  const touch = e.touches[0];
4713
4752
  setDraggedOption(option);
4714
4753
  setDraggedElement(element);
@@ -4826,6 +4865,7 @@ var FillInTheBlanksActivityMaterialContent = ({
4826
4865
  {
4827
4866
  ref: draggedOption === option ? dragElementRef : null,
4828
4867
  className: `${draggedOption === option ? "opacity-40" : selectedOption === option ? "ring-2 ring-blue-500" : "opacity-100"} transition-all duration-200`,
4868
+ style: { touchAction: "none" },
4829
4869
  onMouseDown: (e) => handleMouseDown(e, option),
4830
4870
  onTouchStart: (e) => handleTouchStart(e, option, e.currentTarget),
4831
4871
  onTouchMove: handleTouchMove,
@@ -5197,6 +5237,7 @@ var GroupingActivityMaterialContent = ({
5197
5237
  };
5198
5238
  const handleTouchStart = (e, materialValue, element) => {
5199
5239
  if (!checkCanAnswerQuestion()) return;
5240
+ e.preventDefault();
5200
5241
  const touch = e.touches[0];
5201
5242
  setDraggedValue(materialValue);
5202
5243
  setDraggedElement(element);
@@ -5306,6 +5347,7 @@ var GroupingActivityMaterialContent = ({
5306
5347
  {
5307
5348
  ref: draggedValue === materialValue ? dragElementRef : null,
5308
5349
  className: `${draggedValue === materialValue ? "opacity-40" : selectedValue === materialValue ? "ring-2 ring-blue-500" : "opacity-100"} transition-all duration-200`,
5350
+ style: { touchAction: "none" },
5309
5351
  onMouseDown: (e) => handleMouseDown(e, materialValue),
5310
5352
  onTouchStart: (e) => handleTouchStart(e, materialValue, e.currentTarget),
5311
5353
  onTouchMove: handleTouchMove,
@@ -5640,6 +5682,7 @@ var MatchingActivityMaterialContent = ({
5640
5682
  };
5641
5683
  const handleTouchStart = (e, materialValue, element) => {
5642
5684
  if (!checkCanAnswerQuestion()) return;
5685
+ e.preventDefault();
5643
5686
  const touch = e.touches[0];
5644
5687
  setDraggedValue(materialValue);
5645
5688
  setDraggedElement(element);
@@ -5753,6 +5796,7 @@ var MatchingActivityMaterialContent = ({
5753
5796
  {
5754
5797
  ref: draggedValue === materialValue ? dragElementRef : null,
5755
5798
  className: `${draggedValue === materialValue ? "opacity-40" : selectedValue === materialValue ? "ring-2 ring-blue-500" : "opacity-100"} transition-all duration-200`,
5799
+ style: { touchAction: "none" },
5756
5800
  onMouseDown: (e) => handleMouseDown(e, materialValue),
5757
5801
  onTouchStart: (e) => handleTouchStart(e, materialValue, e.currentTarget),
5758
5802
  onTouchMove: handleTouchMove,
@@ -6338,7 +6382,7 @@ var OpenEndedActivityMaterialContent = ({
6338
6382
  src: answerMapAnswer,
6339
6383
  alt: "document",
6340
6384
  size: "custom",
6341
- className: "w-[80%] rounded-catchup-xlarge"
6385
+ className: "w-[80%] rounded-catchup-xlarge max-h-[50vh] object-contain"
6342
6386
  }
6343
6387
  ) });
6344
6388
  } else if (fileType === "PDF") {
@@ -6380,7 +6424,7 @@ var OpenEndedActivityMaterialContent = ({
6380
6424
  src: answerMapAnswer,
6381
6425
  alt: "document",
6382
6426
  size: "custom",
6383
- className: "w-[80%] rounded-catchup-xlarge"
6427
+ className: "w-[80%] rounded-catchup-xlarge max-h-[50vh] object-contain"
6384
6428
  }
6385
6429
  ) }) : fileType === "PDF" ? /* @__PURE__ */ jsx39("div", { className: "flex flex-col justify-center items-center my-5", children: /* @__PURE__ */ jsx39(BasePDF_default, { file: answerMapAnswer }) }) : null });
6386
6430
  };
@@ -6537,6 +6581,7 @@ var OrderingActivityMaterialContent = ({
6537
6581
  };
6538
6582
  const handleTouchStart = (e, materialKey, element) => {
6539
6583
  if (!checkCanAnswerQuestion()) return;
6584
+ e.preventDefault();
6540
6585
  const touch = e.touches[0];
6541
6586
  setDraggedKey(materialKey);
6542
6587
  setDraggedElement(element);
@@ -6668,6 +6713,7 @@ var OrderingActivityMaterialContent = ({
6668
6713
  ref: draggedKey === materialKey ? dragElementRef : null,
6669
6714
  "data-ordering-drop-zone": materialKey,
6670
6715
  className: `flex-1 ${draggedKey === materialKey ? "opacity-40" : selectedKey === materialKey ? "ring-2 ring-blue-500" : "opacity-100"} ${dropTargetKey === materialKey && draggedKey !== materialKey ? "ring-2 ring-blue-400 bg-blue-50" : ""} transition-all duration-200`,
6716
+ style: { touchAction: "none" },
6671
6717
  onMouseDown: (e) => handleMouseDown(e, materialKey),
6672
6718
  onMouseEnter: () => draggedKey && draggedKey !== materialKey && setDropTargetKey(materialKey),
6673
6719
  onMouseLeave: () => setDropTargetKey(null),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catchup-library-web",
3
- "version": "2.6.2",
3
+ "version": "2.6.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -24,7 +24,8 @@
24
24
  "react-loader-spinner": ">=5.0.0",
25
25
  "react-modal": "^3.16.0",
26
26
  "react-pdf": ">=7.0.0",
27
- "react-select": "^5.8.0"
27
+ "react-select": "^5.8.0",
28
+ "react-switch": "^7.0.0"
28
29
  },
29
30
  "devDependencies": {
30
31
  "@types/react": "^18.3.0",
@@ -40,6 +41,7 @@
40
41
  "react-modal": "^3.16.3",
41
42
  "react-pdf": "^10.0.1",
42
43
  "react-select": "^5.10.0",
44
+ "react-switch": "^7.0.0",
43
45
  "tsup": "^8.3.6",
44
46
  "typescript": "^5.9.2"
45
47
  }
@@ -122,6 +122,7 @@ const FillInTheBlanksActivityMaterialContent = ({
122
122
  option: any,
123
123
  element: HTMLElement,
124
124
  ): void => {
125
+ e.preventDefault();
125
126
  const touch = e.touches[0];
126
127
  setDraggedOption(option);
127
128
  setDraggedElement(element);
@@ -273,6 +274,7 @@ const FillInTheBlanksActivityMaterialContent = ({
273
274
  ? "ring-2 ring-blue-500"
274
275
  : "opacity-100"
275
276
  } transition-all duration-200`}
277
+ style={{ touchAction: "none" }}
276
278
  onMouseDown={(e) => handleMouseDown(e, option)}
277
279
  onTouchStart={(e) => handleTouchStart(e, option, e.currentTarget)}
278
280
  onTouchMove={handleTouchMove}
@@ -201,6 +201,7 @@ const GroupingActivityMaterialContent = ({
201
201
  element: HTMLElement,
202
202
  ): void => {
203
203
  if (!checkCanAnswerQuestion()) return;
204
+ e.preventDefault();
204
205
  const touch = e.touches[0];
205
206
  setDraggedValue(materialValue);
206
207
  setDraggedElement(element);
@@ -366,6 +367,7 @@ const GroupingActivityMaterialContent = ({
366
367
  ? "ring-2 ring-blue-500"
367
368
  : "opacity-100"
368
369
  } transition-all duration-200`}
370
+ style={{ touchAction: "none" }}
369
371
  onMouseDown={(e) => handleMouseDown(e, materialValue)}
370
372
  onTouchStart={(e) =>
371
373
  handleTouchStart(e, materialValue, e.currentTarget)
@@ -198,6 +198,7 @@ const MatchingActivityMaterialContent = ({
198
198
  element: HTMLElement,
199
199
  ): void => {
200
200
  if (!checkCanAnswerQuestion()) return;
201
+ e.preventDefault();
201
202
  const touch = e.touches[0];
202
203
  setDraggedValue(materialValue);
203
204
  setDraggedElement(element);
@@ -365,6 +366,7 @@ const MatchingActivityMaterialContent = ({
365
366
  ? "ring-2 ring-blue-500"
366
367
  : "opacity-100"
367
368
  } transition-all duration-200`}
369
+ style={{ touchAction: "none" }}
368
370
  onMouseDown={(e) => handleMouseDown(e, materialValue)}
369
371
  onTouchStart={(e) =>
370
372
  handleTouchStart(e, materialValue, e.currentTarget)
@@ -29,7 +29,7 @@ const OpenEndedActivityMaterialContent = ({
29
29
  src={answerMapAnswer}
30
30
  alt="document"
31
31
  size="custom"
32
- className="w-[80%] rounded-catchup-xlarge"
32
+ className="w-[80%] rounded-catchup-xlarge max-h-[50vh] object-contain"
33
33
  />
34
34
  </div>
35
35
  );
@@ -74,7 +74,7 @@ const OpenEndedActivityMaterialContent = ({
74
74
  src={answerMapAnswer}
75
75
  alt="document"
76
76
  size="custom"
77
- className="w-[80%] rounded-catchup-xlarge"
77
+ className="w-[80%] rounded-catchup-xlarge max-h-[50vh] object-contain"
78
78
  />
79
79
  </div>
80
80
  ) : fileType === "PDF" ? (
@@ -95,6 +95,7 @@ const OrderingActivityMaterialContent = ({
95
95
  element: HTMLElement,
96
96
  ): void => {
97
97
  if (!checkCanAnswerQuestion()) return;
98
+ e.preventDefault();
98
99
  const touch = e.touches[0];
99
100
  setDraggedKey(materialKey);
100
101
  setDraggedElement(element);
@@ -286,6 +287,7 @@ const OrderingActivityMaterialContent = ({
286
287
  ? "ring-2 ring-blue-400 bg-blue-50"
287
288
  : ""
288
289
  } transition-all duration-200`}
290
+ style={{ touchAction: "none" }}
289
291
  onMouseDown={(e) => handleMouseDown(e, materialKey)}
290
292
  onMouseEnter={() =>
291
293
  draggedKey &&
@@ -1,4 +1,5 @@
1
1
  import Select from "react-select";
2
+ import Switch from "react-switch";
2
3
  import i18n from "../../language/i18n";
3
4
  import { useEffect, useRef, useState, useCallback } from "react";
4
5
  import { IInputGroupProps } from "../../properties/GroupProperties";
@@ -65,6 +66,8 @@ const InputGroup = ({
65
66
  disabled,
66
67
  limit,
67
68
  useMath,
69
+ checked,
70
+ description,
68
71
  }: IInputGroupProps) => {
69
72
  const textAreaRef = useRef<HTMLTextAreaElement>(null);
70
73
  const latexTextAreaRef = useRef<HTMLTextAreaElement>(null);
@@ -534,6 +537,43 @@ const InputGroup = ({
534
537
  );
535
538
  };
536
539
 
540
+ const SwitchInputGroup = () => {
541
+ return (
542
+ <div className="flex flex-col my-1">
543
+ <div className="flex flex-row items-center">
544
+ <Switch
545
+ onChange={() => {
546
+ onClick && onClick(!checked);
547
+ }}
548
+ checkedIcon={false}
549
+ offColor={"#e2e8f0"}
550
+ onColor={"#57C2D3"}
551
+ offHandleColor={"#57C2D3"}
552
+ onHandleColor={"#e2e8f0"}
553
+ uncheckedIcon={false}
554
+ checked={!!checked}
555
+ height={20}
556
+ width={40}
557
+ handleDiameter={14}
558
+ disabled={disabled}
559
+ />
560
+ <p
561
+ className={`${
562
+ checked ? "font-bold" : "text-catchup-gray"
563
+ } px-2 transition-all duration-300`}
564
+ >
565
+ {title}
566
+ </p>
567
+ </div>
568
+ {description ? (
569
+ <p className="text-sm text-catchup-gray-300 mt-1 ml-12">
570
+ {description}
571
+ </p>
572
+ ) : null}
573
+ </div>
574
+ );
575
+ };
576
+
537
577
  const RenderMainContent = () => {
538
578
  if (type === "text" || type === "number") {
539
579
  return TextInputGroup();
@@ -549,6 +589,8 @@ const InputGroup = ({
549
589
  return FileInputGroup();
550
590
  } else if (type === "checkbox") {
551
591
  return CheckboxInputGroup();
592
+ } else if (type === "switch") {
593
+ return SwitchInputGroup();
552
594
  }
553
595
  };
554
596
 
@@ -3,7 +3,7 @@ export interface IInputGroupProps {
3
3
  title?: string;
4
4
  defaultValue?: string;
5
5
  placeholder?: string;
6
- value: string;
6
+ value: any;
7
7
  minValue?: string;
8
8
  maxValue?: string;
9
9
  onFocus?: (e: any) => void;
@@ -19,6 +19,8 @@ export interface IInputGroupProps {
19
19
  disabled?: boolean;
20
20
  limit?: number;
21
21
  useMath?: boolean;
22
+ checked?: boolean;
23
+ description?: string;
22
24
  }
23
25
 
24
26
  export interface ILeftTextRightInputGroupProps {