catchup-library-web 1.20.4 → 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
  }
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catchup-library-web",
3
- "version": "1.20.04",
3
+ "version": "1.20.05",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -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"