catchup-library-web 1.20.4 → 1.20.6

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
@@ -68,12 +68,12 @@ declare const FullCard: ({ backgroundColor, borderColor, opacity, usePadding, ch
68
68
 
69
69
  declare const BaseCard: ({ children }: IBaseCardProps) => react_jsx_runtime.JSX.Element;
70
70
 
71
- declare const BaseImage: react.ForwardRefExoticComponent<IBaseImageProps & react.RefAttributes<HTMLImageElement>>;
72
71
  interface IBaseImageProps {
73
72
  size?: "xsmall" | "small" | "medium" | "large" | "xlarge" | "2xlarge" | "3xlarge" | "4xlarge" | "5xlarge" | "6xlarge" | "custom";
74
73
  className?: string;
75
74
  widthClassName?: string;
76
75
  heightClassName?: string;
76
+ imageClassName?: string;
77
77
  src?: string;
78
78
  hidden?: boolean;
79
79
  alt?: string;
@@ -88,6 +88,8 @@ interface IBaseImageProps {
88
88
  borderRadius?: string;
89
89
  }
90
90
 
91
+ declare const BaseImage: react.ForwardRefExoticComponent<IBaseImageProps & react.RefAttributes<HTMLImageElement>>;
92
+
91
93
  interface IBaseLoadingProps {
92
94
  height?: number;
93
95
  width?: number;
package/dist/index.d.ts CHANGED
@@ -68,12 +68,12 @@ declare const FullCard: ({ backgroundColor, borderColor, opacity, usePadding, ch
68
68
 
69
69
  declare const BaseCard: ({ children }: IBaseCardProps) => react_jsx_runtime.JSX.Element;
70
70
 
71
- declare const BaseImage: react.ForwardRefExoticComponent<IBaseImageProps & react.RefAttributes<HTMLImageElement>>;
72
71
  interface IBaseImageProps {
73
72
  size?: "xsmall" | "small" | "medium" | "large" | "xlarge" | "2xlarge" | "3xlarge" | "4xlarge" | "5xlarge" | "6xlarge" | "custom";
74
73
  className?: string;
75
74
  widthClassName?: string;
76
75
  heightClassName?: string;
76
+ imageClassName?: string;
77
77
  src?: string;
78
78
  hidden?: boolean;
79
79
  alt?: string;
@@ -88,6 +88,8 @@ interface IBaseImageProps {
88
88
  borderRadius?: string;
89
89
  }
90
90
 
91
+ declare const BaseImage: react.ForwardRefExoticComponent<IBaseImageProps & react.RefAttributes<HTMLImageElement>>;
92
+
91
93
  interface IBaseLoadingProps {
92
94
  height?: number;
93
95
  width?: number;
package/dist/index.js CHANGED
@@ -476,6 +476,7 @@ var BaseImage = (0, import_react2.forwardRef)(
476
476
  className,
477
477
  widthClassName,
478
478
  heightClassName,
479
+ imageClassName,
479
480
  src,
480
481
  hidden,
481
482
  alt,
@@ -505,6 +506,7 @@ var BaseImage = (0, import_react2.forwardRef)(
505
506
  let currentClassName;
506
507
  let currentWidthClassName;
507
508
  let currentHeightClassName;
509
+ let currentImageClassName = "w-full h-full object-contain";
508
510
  if (size === "xsmall") {
509
511
  currentWidthClassName = "w-4";
510
512
  currentHeightClassName = "h-4";
@@ -539,6 +541,9 @@ var BaseImage = (0, import_react2.forwardRef)(
539
541
  currentClassName = className;
540
542
  currentWidthClassName = widthClassName;
541
543
  currentHeightClassName = heightClassName;
544
+ if (imageClassName) {
545
+ currentImageClassName = imageClassName;
546
+ }
542
547
  }
543
548
  return loading ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
544
549
  BaseLoading_default,
@@ -556,7 +561,7 @@ var BaseImage = (0, import_react2.forwardRef)(
556
561
  "img",
557
562
  {
558
563
  ref,
559
- className: `w-full h-full object-contain ${borderRadius || ""}`,
564
+ className: `${currentImageClassName} ${borderRadius}`,
560
565
  src,
561
566
  alt,
562
567
  onLoad,
@@ -572,7 +577,6 @@ var BaseImage = (0, import_react2.forwardRef)(
572
577
  );
573
578
  }
574
579
  );
575
- BaseImage.displayName = "BaseImage";
576
580
  var BaseImage_default = BaseImage;
577
581
 
578
582
  // src/components/buttons/PrimaryButton.tsx
@@ -3917,6 +3921,15 @@ var InputGroup = ({
3917
3921
  label: option.text
3918
3922
  }));
3919
3923
  };
3924
+ const handleTextOnChange = (e) => {
3925
+ if (limit) {
3926
+ if (e.target.value.length <= limit) {
3927
+ onChange && onChange(e);
3928
+ }
3929
+ } else {
3930
+ onChange && onChange(e);
3931
+ }
3932
+ };
3920
3933
  const handleTextAreaOnChange = (e) => {
3921
3934
  if (!textAreaRef) return;
3922
3935
  if (!textAreaRef.current) return;
@@ -4200,7 +4213,14 @@ var InputGroup = ({
4200
4213
  };
4201
4214
  const TextInputGroup = () => {
4202
4215
  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,
4216
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-row justify-between items-center", children: [
4217
+ /* @__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 }),
4218
+ /* @__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: [
4219
+ value.length,
4220
+ " / ",
4221
+ limit
4222
+ ] }) : null })
4223
+ ] }),
4204
4224
  /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4205
4225
  "div",
4206
4226
  {
@@ -4214,7 +4234,7 @@ var InputGroup = ({
4214
4234
  defaultValue,
4215
4235
  placeholder: errorText ? errorText : placeholder,
4216
4236
  value,
4217
- onChange,
4237
+ onChange: handleTextOnChange,
4218
4238
  onFocus,
4219
4239
  onKeyDown
4220
4240
  }
package/dist/index.mjs CHANGED
@@ -260,6 +260,7 @@ var BaseImage = forwardRef(
260
260
  className,
261
261
  widthClassName,
262
262
  heightClassName,
263
+ imageClassName,
263
264
  src,
264
265
  hidden,
265
266
  alt,
@@ -289,6 +290,7 @@ var BaseImage = forwardRef(
289
290
  let currentClassName;
290
291
  let currentWidthClassName;
291
292
  let currentHeightClassName;
293
+ let currentImageClassName = "w-full h-full object-contain";
292
294
  if (size === "xsmall") {
293
295
  currentWidthClassName = "w-4";
294
296
  currentHeightClassName = "h-4";
@@ -323,6 +325,9 @@ var BaseImage = forwardRef(
323
325
  currentClassName = className;
324
326
  currentWidthClassName = widthClassName;
325
327
  currentHeightClassName = heightClassName;
328
+ if (imageClassName) {
329
+ currentImageClassName = imageClassName;
330
+ }
326
331
  }
327
332
  return loading ? /* @__PURE__ */ jsx5(
328
333
  BaseLoading_default,
@@ -340,7 +345,7 @@ var BaseImage = forwardRef(
340
345
  "img",
341
346
  {
342
347
  ref,
343
- className: `w-full h-full object-contain ${borderRadius || ""}`,
348
+ className: `${currentImageClassName} ${borderRadius}`,
344
349
  src,
345
350
  alt,
346
351
  onLoad,
@@ -356,7 +361,6 @@ var BaseImage = forwardRef(
356
361
  );
357
362
  }
358
363
  );
359
- BaseImage.displayName = "BaseImage";
360
364
  var BaseImage_default = BaseImage;
361
365
 
362
366
  // src/components/buttons/PrimaryButton.tsx
@@ -3701,6 +3705,15 @@ var InputGroup = ({
3701
3705
  label: option.text
3702
3706
  }));
3703
3707
  };
3708
+ const handleTextOnChange = (e) => {
3709
+ if (limit) {
3710
+ if (e.target.value.length <= limit) {
3711
+ onChange && onChange(e);
3712
+ }
3713
+ } else {
3714
+ onChange && onChange(e);
3715
+ }
3716
+ };
3704
3717
  const handleTextAreaOnChange = (e) => {
3705
3718
  if (!textAreaRef) return;
3706
3719
  if (!textAreaRef.current) return;
@@ -3984,7 +3997,14 @@ var InputGroup = ({
3984
3997
  };
3985
3998
  const TextInputGroup = () => {
3986
3999
  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,
4000
+ /* @__PURE__ */ jsxs12("div", { className: "flex flex-row justify-between items-center", children: [
4001
+ /* @__PURE__ */ jsx22("div", { children: title ? /* @__PURE__ */ jsx22("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400", children: title }) : null }),
4002
+ /* @__PURE__ */ jsx22("div", { children: value && limit ? /* @__PURE__ */ jsxs12("p", { className: "text-md font-semibold pr-2 py-1 text-catchup-gray-400", children: [
4003
+ value.length,
4004
+ " / ",
4005
+ limit
4006
+ ] }) : null })
4007
+ ] }),
3988
4008
  /* @__PURE__ */ jsx22(
3989
4009
  "div",
3990
4010
  {
@@ -3998,7 +4018,7 @@ var InputGroup = ({
3998
4018
  defaultValue,
3999
4019
  placeholder: errorText ? errorText : placeholder,
4000
4020
  value,
4001
- onChange,
4021
+ onChange: handleTextOnChange,
4002
4022
  onFocus,
4003
4023
  onKeyDown
4004
4024
  }
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.06",
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"
@@ -1,5 +1,6 @@
1
1
  import { useState, forwardRef } from "react";
2
2
  import BaseLoading from "../loading/BaseLoading";
3
+ import { IBaseImageProps } from "../../properties/ImageProperties";
3
4
 
4
5
  const BaseImage = forwardRef<HTMLImageElement, IBaseImageProps>(
5
6
  (props, ref) => {
@@ -8,6 +9,7 @@ const BaseImage = forwardRef<HTMLImageElement, IBaseImageProps>(
8
9
  className,
9
10
  widthClassName,
10
11
  heightClassName,
12
+ imageClassName,
11
13
  src,
12
14
  hidden,
13
15
  alt,
@@ -41,6 +43,8 @@ const BaseImage = forwardRef<HTMLImageElement, IBaseImageProps>(
41
43
  let currentClassName;
42
44
  let currentWidthClassName;
43
45
  let currentHeightClassName;
46
+ let currentImageClassName = "w-full h-full object-contain";
47
+
44
48
  if (size === "xsmall") {
45
49
  currentWidthClassName = "w-4";
46
50
  currentHeightClassName = "h-4";
@@ -75,6 +79,9 @@ const BaseImage = forwardRef<HTMLImageElement, IBaseImageProps>(
75
79
  currentClassName = className;
76
80
  currentWidthClassName = widthClassName;
77
81
  currentHeightClassName = heightClassName;
82
+ if (imageClassName) {
83
+ currentImageClassName = imageClassName;
84
+ }
78
85
  }
79
86
 
80
87
  return loading ? (
@@ -95,7 +102,7 @@ const BaseImage = forwardRef<HTMLImageElement, IBaseImageProps>(
95
102
  >
96
103
  <img
97
104
  ref={ref}
98
- className={`w-full h-full object-contain ${borderRadius || ""}`}
105
+ className={`${currentImageClassName} ${borderRadius}`}
99
106
  src={src}
100
107
  alt={alt}
101
108
  onLoad={onLoad}
@@ -110,36 +117,4 @@ const BaseImage = forwardRef<HTMLImageElement, IBaseImageProps>(
110
117
  }
111
118
  );
112
119
 
113
- BaseImage.displayName = "BaseImage";
114
-
115
- interface IBaseImageProps {
116
- size?:
117
- | "xsmall"
118
- | "small"
119
- | "medium"
120
- | "large"
121
- | "xlarge"
122
- | "2xlarge"
123
- | "3xlarge"
124
- | "4xlarge"
125
- | "5xlarge"
126
- | "6xlarge"
127
- | "custom";
128
- className?: string;
129
- widthClassName?: string;
130
- heightClassName?: string;
131
- src?: string;
132
- hidden?: boolean;
133
- alt?: string;
134
- showLoading?: boolean;
135
- onLoad?: () => void;
136
- onClick?: (e: any) => void;
137
- dataToolTipId?: string;
138
- dataToolTipContent?: string;
139
- dataToolTipPlace?: string;
140
- dataToolTipVariant?: string;
141
- dataToolTipHTML?: string;
142
- borderRadius?: string;
143
- }
144
-
145
120
  export default BaseImage;
@@ -1,12 +1,23 @@
1
1
  export interface IBaseImageProps {
2
- ref?: any;
3
- size: string;
2
+ size?:
3
+ | "xsmall"
4
+ | "small"
5
+ | "medium"
6
+ | "large"
7
+ | "xlarge"
8
+ | "2xlarge"
9
+ | "3xlarge"
10
+ | "4xlarge"
11
+ | "5xlarge"
12
+ | "6xlarge"
13
+ | "custom";
4
14
  className?: string;
5
15
  widthClassName?: string;
6
16
  heightClassName?: string;
7
- src: string;
17
+ imageClassName?: string;
18
+ src?: string;
8
19
  hidden?: boolean;
9
- alt: string;
20
+ alt?: string;
10
21
  showLoading?: boolean;
11
22
  onLoad?: () => void;
12
23
  onClick?: (e: any) => void;
@@ -15,4 +26,5 @@ export interface IBaseImageProps {
15
26
  dataToolTipPlace?: string;
16
27
  dataToolTipVariant?: string;
17
28
  dataToolTipHTML?: string;
29
+ borderRadius?: string;
18
30
  }