catchup-library-web 1.20.3 → 1.20.5

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
@@ -3917,6 +3917,15 @@ var InputGroup = ({
3917
3917
  label: option.text
3918
3918
  }));
3919
3919
  };
3920
+ const handleTextOnChange = (e) => {
3921
+ if (limit) {
3922
+ if (e.target.value.length <= limit) {
3923
+ onChange && onChange(e);
3924
+ }
3925
+ } else {
3926
+ onChange && onChange(e);
3927
+ }
3928
+ };
3920
3929
  const handleTextAreaOnChange = (e) => {
3921
3930
  if (!textAreaRef) return;
3922
3931
  if (!textAreaRef.current) return;
@@ -4200,7 +4209,14 @@ var InputGroup = ({
4200
4209
  };
4201
4210
  const TextInputGroup = () => {
4202
4211
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "my-1 relative", children: [
4203
- title ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400", children: title }) : null,
4212
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-row justify-between items-center", children: [
4213
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { children: title ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400", children: title }) : null }),
4214
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { children: value && limit ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("p", { className: "text-md font-semibold pr-2 py-1 text-catchup-gray-400", children: [
4215
+ value.length,
4216
+ " / ",
4217
+ limit
4218
+ ] }) : null })
4219
+ ] }),
4204
4220
  /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4205
4221
  "div",
4206
4222
  {
@@ -4214,7 +4230,7 @@ var InputGroup = ({
4214
4230
  defaultValue,
4215
4231
  placeholder: errorText ? errorText : placeholder,
4216
4232
  value,
4217
- onChange,
4233
+ onChange: handleTextOnChange,
4218
4234
  onFocus,
4219
4235
  onKeyDown
4220
4236
  }
@@ -5318,22 +5334,16 @@ var GroupingActivityMaterialContent = ({
5318
5334
  "div",
5319
5335
  {
5320
5336
  className: `border-catchup-blue ${contentMap.type === "TEXT" ? "h-catchup-activity-text-outer-box-item" : "h-catchup-activity-media-outer-box-item"} flex flex-col items-center justify-center border-2 rounded-catchup-xlarge transition-all duration-300 my-3`,
5321
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5322
- "div",
5323
- {
5324
- className: `flex flex-col items-center justify-center transition-all duration-300 m-4`,
5325
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(answerMapKey).map(
5326
- (inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5327
- "span",
5328
- {
5329
- className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
5330
- children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_katex4.InlineMath, { math: inputPart.value }) }) : inputPart.value
5331
- },
5332
- index2
5333
- )
5334
- ) })
5335
- }
5336
- )
5337
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "flex flex-col items-center justify-center transition-all duration-300 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(answerMapKey).map(
5338
+ (inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5339
+ "span",
5340
+ {
5341
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
5342
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_katex4.InlineMath, { math: inputPart.value }) }) : inputPart.value
5343
+ },
5344
+ index2
5345
+ )
5346
+ ) }) })
5337
5347
  }
5338
5348
  ) }),
5339
5349
  /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "mx-4 w-[2px] bg-catchup-lighter-gray" }),
@@ -5577,22 +5587,16 @@ var MatchingActivityMaterialContent = ({
5577
5587
  setSelectedValue(null);
5578
5588
  }
5579
5589
  },
5580
- children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5581
- "div",
5590
+ children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex flex-col items-center justify-center m-2 min-w-[200px] overflow-y-auto px-4", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
5591
+ materialValue
5592
+ ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5593
+ "span",
5582
5594
  {
5583
- className: `flex flex-col items-center justify-center m-2 min-w-[200px] overflow-y-auto`,
5584
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
5585
- materialValue
5586
- ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5587
- "span",
5588
- {
5589
- className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
5590
- children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-xl", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_katex5.InlineMath, { math: inputPart.value }) }) : inputPart.value
5591
- },
5592
- index2
5593
- )) })
5594
- }
5595
- ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5595
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
5596
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-xl", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_katex5.InlineMath, { math: inputPart.value }) }) : inputPart.value
5597
+ },
5598
+ index2
5599
+ )) }) }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5596
5600
  ShowMaterialMediaByContentType_default,
5597
5601
  {
5598
5602
  contentType: contentMap.type,
@@ -5628,7 +5632,7 @@ var MatchingActivityMaterialContent = ({
5628
5632
  "div",
5629
5633
  {
5630
5634
  className: `${contentMap.type === "TEXT" ? "h-catchup-activity-text-box-item" : "h-catchup-activity-media-box-item"} flex flex-col items-center justify-center border-2 rounded-catchup-xlarge transition-all duration-300 my-3 ${learnerAnswerState === "EMPTY" ? "border-catchup-blue" : learnerAnswerState === "CORRECT" ? "border-catchup-green" : learnerAnswerState === "INCORRECT" ? "border-catchup-red" : "border-catchup-blue"}`,
5631
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex flex-col items-center justify-center transition-all duration-300 m-4", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
5635
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex flex-col items-center justify-center transition-all duration-300 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
5632
5636
  answerMapKey
5633
5637
  ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5634
5638
  "span",
@@ -5661,7 +5665,7 @@ var MatchingActivityMaterialContent = ({
5661
5665
  component: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
5662
5666
  "div",
5663
5667
  {
5664
- className: "h-full flex-1 flex flex-row items-center justify-center",
5668
+ className: "h-full flex-1 flex flex-row items-center justify-center px-4",
5665
5669
  onClick: (e) => {
5666
5670
  e.preventDefault();
5667
5671
  if (checkCanAnswerQuestion()) {
package/dist/index.mjs CHANGED
@@ -3701,6 +3701,15 @@ var InputGroup = ({
3701
3701
  label: option.text
3702
3702
  }));
3703
3703
  };
3704
+ const handleTextOnChange = (e) => {
3705
+ if (limit) {
3706
+ if (e.target.value.length <= limit) {
3707
+ onChange && onChange(e);
3708
+ }
3709
+ } else {
3710
+ onChange && onChange(e);
3711
+ }
3712
+ };
3704
3713
  const handleTextAreaOnChange = (e) => {
3705
3714
  if (!textAreaRef) return;
3706
3715
  if (!textAreaRef.current) return;
@@ -3984,7 +3993,14 @@ var InputGroup = ({
3984
3993
  };
3985
3994
  const TextInputGroup = () => {
3986
3995
  return /* @__PURE__ */ jsxs12("div", { className: "my-1 relative", children: [
3987
- title ? /* @__PURE__ */ jsx22("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400", children: title }) : null,
3996
+ /* @__PURE__ */ jsxs12("div", { className: "flex flex-row justify-between items-center", children: [
3997
+ /* @__PURE__ */ jsx22("div", { children: title ? /* @__PURE__ */ jsx22("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400", children: title }) : null }),
3998
+ /* @__PURE__ */ jsx22("div", { children: value && limit ? /* @__PURE__ */ jsxs12("p", { className: "text-md font-semibold pr-2 py-1 text-catchup-gray-400", children: [
3999
+ value.length,
4000
+ " / ",
4001
+ limit
4002
+ ] }) : null })
4003
+ ] }),
3988
4004
  /* @__PURE__ */ jsx22(
3989
4005
  "div",
3990
4006
  {
@@ -3998,7 +4014,7 @@ var InputGroup = ({
3998
4014
  defaultValue,
3999
4015
  placeholder: errorText ? errorText : placeholder,
4000
4016
  value,
4001
- onChange,
4017
+ onChange: handleTextOnChange,
4002
4018
  onFocus,
4003
4019
  onKeyDown
4004
4020
  }
@@ -5102,22 +5118,16 @@ var GroupingActivityMaterialContent = ({
5102
5118
  "div",
5103
5119
  {
5104
5120
  className: `border-catchup-blue ${contentMap.type === "TEXT" ? "h-catchup-activity-text-outer-box-item" : "h-catchup-activity-media-outer-box-item"} flex flex-col items-center justify-center border-2 rounded-catchup-xlarge transition-all duration-300 my-3`,
5105
- children: /* @__PURE__ */ jsx31(
5106
- "div",
5107
- {
5108
- className: `flex flex-col items-center justify-center transition-all duration-300 m-4`,
5109
- children: /* @__PURE__ */ jsx31("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(answerMapKey).map(
5110
- (inputPart, index2) => /* @__PURE__ */ jsx31(
5111
- "span",
5112
- {
5113
- className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
5114
- children: inputPart.isEquation ? /* @__PURE__ */ jsx31("span", { className: "text-2xl", children: /* @__PURE__ */ jsx31(InlineMath4, { math: inputPart.value }) }) : inputPart.value
5115
- },
5116
- index2
5117
- )
5118
- ) })
5119
- }
5120
- )
5121
+ children: /* @__PURE__ */ jsx31("div", { className: "flex flex-col items-center justify-center transition-all duration-300 px-4", children: /* @__PURE__ */ jsx31("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(answerMapKey).map(
5122
+ (inputPart, index2) => /* @__PURE__ */ jsx31(
5123
+ "span",
5124
+ {
5125
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
5126
+ children: inputPart.isEquation ? /* @__PURE__ */ jsx31("span", { className: "text-2xl", children: /* @__PURE__ */ jsx31(InlineMath4, { math: inputPart.value }) }) : inputPart.value
5127
+ },
5128
+ index2
5129
+ )
5130
+ ) }) })
5121
5131
  }
5122
5132
  ) }),
5123
5133
  /* @__PURE__ */ jsx31("div", { className: "mx-4 w-[2px] bg-catchup-lighter-gray" }),
@@ -5361,22 +5371,16 @@ var MatchingActivityMaterialContent = ({
5361
5371
  setSelectedValue(null);
5362
5372
  }
5363
5373
  },
5364
- children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx33(
5365
- "div",
5374
+ children: contentMap.type === "TEXT" ? /* @__PURE__ */ jsx33("div", { className: "flex flex-col items-center justify-center m-2 min-w-[200px] overflow-y-auto px-4", children: /* @__PURE__ */ jsx33("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
5375
+ materialValue
5376
+ ).map((inputPart, index2) => /* @__PURE__ */ jsx33(
5377
+ "span",
5366
5378
  {
5367
- className: `flex flex-col items-center justify-center m-2 min-w-[200px] overflow-y-auto`,
5368
- children: /* @__PURE__ */ jsx33("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
5369
- materialValue
5370
- ).map((inputPart, index2) => /* @__PURE__ */ jsx33(
5371
- "span",
5372
- {
5373
- className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
5374
- children: inputPart.isEquation ? /* @__PURE__ */ jsx33("span", { className: "text-xl", children: /* @__PURE__ */ jsx33(InlineMath5, { math: inputPart.value }) }) : inputPart.value
5375
- },
5376
- index2
5377
- )) })
5378
- }
5379
- ) : /* @__PURE__ */ jsx33(
5379
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
5380
+ children: inputPart.isEquation ? /* @__PURE__ */ jsx33("span", { className: "text-xl", children: /* @__PURE__ */ jsx33(InlineMath5, { math: inputPart.value }) }) : inputPart.value
5381
+ },
5382
+ index2
5383
+ )) }) }) : /* @__PURE__ */ jsx33(
5380
5384
  ShowMaterialMediaByContentType_default,
5381
5385
  {
5382
5386
  contentType: contentMap.type,
@@ -5412,7 +5416,7 @@ var MatchingActivityMaterialContent = ({
5412
5416
  "div",
5413
5417
  {
5414
5418
  className: `${contentMap.type === "TEXT" ? "h-catchup-activity-text-box-item" : "h-catchup-activity-media-box-item"} flex flex-col items-center justify-center border-2 rounded-catchup-xlarge transition-all duration-300 my-3 ${learnerAnswerState === "EMPTY" ? "border-catchup-blue" : learnerAnswerState === "CORRECT" ? "border-catchup-green" : learnerAnswerState === "INCORRECT" ? "border-catchup-red" : "border-catchup-blue"}`,
5415
- children: /* @__PURE__ */ jsx33("div", { className: "flex flex-col items-center justify-center transition-all duration-300 m-4", children: /* @__PURE__ */ jsx33("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
5419
+ children: /* @__PURE__ */ jsx33("div", { className: "flex flex-col items-center justify-center transition-all duration-300 px-4", children: /* @__PURE__ */ jsx33("p", { className: "text-lg whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
5416
5420
  answerMapKey
5417
5421
  ).map((inputPart, index2) => /* @__PURE__ */ jsx33(
5418
5422
  "span",
@@ -5445,7 +5449,7 @@ var MatchingActivityMaterialContent = ({
5445
5449
  component: /* @__PURE__ */ jsx33(
5446
5450
  "div",
5447
5451
  {
5448
- className: "h-full flex-1 flex flex-row items-center justify-center",
5452
+ className: "h-full flex-1 flex flex-row items-center justify-center px-4",
5449
5453
  onClick: (e) => {
5450
5454
  e.preventDefault();
5451
5455
  if (checkCanAnswerQuestion()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catchup-library-web",
3
- "version": "1.20.03",
3
+ "version": "1.20.05",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -201,9 +201,7 @@ const GroupingActivityMaterialContent = ({
201
201
  : "h-catchup-activity-media-outer-box-item"
202
202
  } flex flex-col items-center justify-center border-2 rounded-catchup-xlarge transition-all duration-300 my-3`}
203
203
  >
204
- <div
205
- className={`flex flex-col items-center justify-center transition-all duration-300 m-4`}
206
- >
204
+ <div className="flex flex-col items-center justify-center transition-all duration-300 px-4">
207
205
  <p className="text-lg whitespace-pre-wrap">
208
206
  {constructInputWithSpecialExpressionList(answerMapKey).map(
209
207
  (inputPart, index) => (
@@ -149,9 +149,7 @@ const MatchingActivityMaterialContent = ({
149
149
  }}
150
150
  >
151
151
  {contentMap.type === "TEXT" ? (
152
- <div
153
- className={`flex flex-col items-center justify-center m-2 min-w-[200px] overflow-y-auto`}
154
- >
152
+ <div className="flex flex-col items-center justify-center m-2 min-w-[200px] overflow-y-auto px-4">
155
153
  <p className="text-lg whitespace-pre-wrap">
156
154
  {constructInputWithSpecialExpressionList(
157
155
  materialValue
@@ -225,7 +223,7 @@ const MatchingActivityMaterialContent = ({
225
223
  : "border-catchup-blue"
226
224
  }`}
227
225
  >
228
- <div className="flex flex-col items-center justify-center transition-all duration-300 m-4">
226
+ <div className="flex flex-col items-center justify-center transition-all duration-300 px-4">
229
227
  <p className="text-lg whitespace-pre-wrap">
230
228
  {constructInputWithSpecialExpressionList(
231
229
  answerMapKey
@@ -286,7 +284,7 @@ const MatchingActivityMaterialContent = ({
286
284
  dropRef={drop}
287
285
  component={
288
286
  <div
289
- className="h-full flex-1 flex flex-row items-center justify-center"
287
+ className="h-full flex-1 flex flex-row items-center justify-center px-4"
290
288
  onClick={(e) => {
291
289
  e.preventDefault();
292
290
  if (checkCanAnswerQuestion()) {
@@ -118,6 +118,16 @@ const InputGroup = ({
118
118
  }));
119
119
  };
120
120
 
121
+ const handleTextOnChange = (e: any) => {
122
+ if (limit) {
123
+ if (e.target.value.length <= limit) {
124
+ onChange && onChange(e);
125
+ }
126
+ } else {
127
+ onChange && onChange(e);
128
+ }
129
+ };
130
+
121
131
  const handleTextAreaOnChange = (e: any) => {
122
132
  if (!textAreaRef) return;
123
133
  if (!textAreaRef.current) return;
@@ -137,10 +147,7 @@ const InputGroup = ({
137
147
  const latexValue = mathFieldRef.current.value;
138
148
  const wasFocused = mathFieldRef.current === document.activeElement;
139
149
  const cursorPosition = mathFieldRef.current.position;
140
-
141
150
  setMathValue(latexValue);
142
-
143
- // Restore focus and cursor position after state update
144
151
  if (wasFocused) {
145
152
  setTimeout(() => {
146
153
  if (mathFieldRef.current) {
@@ -423,7 +430,6 @@ const InputGroup = ({
423
430
  onKeyDown={onKeyDown}
424
431
  />
425
432
 
426
- {/* Math constructor button */}
427
433
  {useMath && (
428
434
  <button
429
435
  className="absolute right-2 top-1/2 transform -translate-y-1/2 bg-catchup-blue-400 text-white rounded-md px-3 py-1 shadow-sm hover:bg-catchup-blue-500 transition-colors duration-200 z-10"
@@ -455,11 +461,22 @@ const InputGroup = ({
455
461
  const TextInputGroup = () => {
456
462
  return (
457
463
  <div className="my-1 relative">
458
- {title ? (
459
- <p className="text-md font-semibold pl-2 py-1 text-catchup-gray-400">
460
- {title}
461
- </p>
462
- ) : null}
464
+ <div className="flex flex-row justify-between items-center">
465
+ <div>
466
+ {title ? (
467
+ <p className="text-md font-semibold pl-2 py-1 text-catchup-gray-400">
468
+ {title}
469
+ </p>
470
+ ) : null}
471
+ </div>
472
+ <div>
473
+ {value && limit ? (
474
+ <p className="text-md font-semibold pr-2 py-1 text-catchup-gray-400">
475
+ {value.length} / {limit}
476
+ </p>
477
+ ) : null}
478
+ </div>
479
+ </div>
463
480
 
464
481
  <div
465
482
  className={`w-full border ${
@@ -483,13 +500,12 @@ const InputGroup = ({
483
500
  defaultValue={defaultValue}
484
501
  placeholder={errorText ? errorText : placeholder}
485
502
  value={value}
486
- onChange={onChange}
503
+ onChange={handleTextOnChange}
487
504
  onFocus={onFocus}
488
505
  onKeyDown={onKeyDown}
489
506
  />
490
507
  </div>
491
508
 
492
- {/* Math constructor button */}
493
509
  {useMath && (
494
510
  <button
495
511
  className="absolute right-2 top-1/2 transform -translate-y-1/2 bg-catchup-blue-400 text-white rounded-md px-3 py-1 shadow-sm hover:bg-catchup-blue-500 transition-colors duration-200"