catchup-library-web 1.11.2 → 1.11.3
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 +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +65 -1
- package/dist/index.mjs +65 -1
- package/package.json +2 -1
- package/src/components/groups/InputGroup.tsx +112 -0
- package/src/properties/GroupProperties.ts +1 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
+
import { MathfieldElement } from 'mathlive';
|
|
3
4
|
export { default as i18n } from 'i18next';
|
|
4
5
|
|
|
5
6
|
interface IButtonProps {
|
|
@@ -242,6 +243,7 @@ interface IInputGroupProps {
|
|
|
242
243
|
useMinHeight?: boolean;
|
|
243
244
|
disabled?: boolean;
|
|
244
245
|
limit?: number;
|
|
246
|
+
useMath?: boolean;
|
|
245
247
|
}
|
|
246
248
|
interface ILeftTextRightInputGroupProps {
|
|
247
249
|
type: string;
|
|
@@ -253,7 +255,39 @@ interface ILeftTextRightInputGroupProps {
|
|
|
253
255
|
errorText?: string;
|
|
254
256
|
}
|
|
255
257
|
|
|
256
|
-
declare
|
|
258
|
+
declare global {
|
|
259
|
+
namespace JSX {
|
|
260
|
+
interface IntrinsicElements {
|
|
261
|
+
"math-field": React.DetailedHTMLProps<React.HTMLAttributes<MathfieldElement>, MathfieldElement> & {
|
|
262
|
+
value?: string;
|
|
263
|
+
disabled?: boolean;
|
|
264
|
+
readonly?: boolean;
|
|
265
|
+
"virtual-keyboard-mode"?: "manual" | "onfocus" | "off";
|
|
266
|
+
"virtual-keyboard-theme"?: "material" | "apple";
|
|
267
|
+
"math-mode-space"?: string;
|
|
268
|
+
"letter-shape-style"?: "tex" | "french" | "iso" | "upright" | "auto";
|
|
269
|
+
"min-font-scale"?: number;
|
|
270
|
+
"max-font-scale"?: number;
|
|
271
|
+
"smart-fence"?: boolean;
|
|
272
|
+
"smart-mode"?: boolean;
|
|
273
|
+
"smart-superscript"?: boolean;
|
|
274
|
+
"inline-shortcut-timeout"?: number;
|
|
275
|
+
"keybinding-mode"?: "default" | "vim" | "emacs";
|
|
276
|
+
"speech-engine"?: "local" | "amazon" | "google";
|
|
277
|
+
"speech-engine-voice"?: string;
|
|
278
|
+
"speech-engine-rate"?: string;
|
|
279
|
+
"read-only"?: boolean;
|
|
280
|
+
"remove-extraneous-parentheses"?: boolean;
|
|
281
|
+
"script-depth"?: number;
|
|
282
|
+
placeholder?: string;
|
|
283
|
+
"default-mode"?: "math" | "text";
|
|
284
|
+
"fonts-directory"?: string;
|
|
285
|
+
"sounds-directory"?: string;
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
declare const InputGroup: ({ type, title, defaultValue, placeholder, value, onFocus, onChange, onClick, onKeyDown, optionList, errorText, multiple, accept, theme, useMinHeight, disabled, limit, useMath, }: IInputGroupProps) => react_jsx_runtime.JSX.Element | undefined;
|
|
257
291
|
|
|
258
292
|
declare const LeftTextRightInputGroup: ({ type, title, value, optionList, onChange, disabled, errorText, }: ILeftTextRightInputGroupProps) => react_jsx_runtime.JSX.Element;
|
|
259
293
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
+
import { MathfieldElement } from 'mathlive';
|
|
3
4
|
export { default as i18n } from 'i18next';
|
|
4
5
|
|
|
5
6
|
interface IButtonProps {
|
|
@@ -242,6 +243,7 @@ interface IInputGroupProps {
|
|
|
242
243
|
useMinHeight?: boolean;
|
|
243
244
|
disabled?: boolean;
|
|
244
245
|
limit?: number;
|
|
246
|
+
useMath?: boolean;
|
|
245
247
|
}
|
|
246
248
|
interface ILeftTextRightInputGroupProps {
|
|
247
249
|
type: string;
|
|
@@ -253,7 +255,39 @@ interface ILeftTextRightInputGroupProps {
|
|
|
253
255
|
errorText?: string;
|
|
254
256
|
}
|
|
255
257
|
|
|
256
|
-
declare
|
|
258
|
+
declare global {
|
|
259
|
+
namespace JSX {
|
|
260
|
+
interface IntrinsicElements {
|
|
261
|
+
"math-field": React.DetailedHTMLProps<React.HTMLAttributes<MathfieldElement>, MathfieldElement> & {
|
|
262
|
+
value?: string;
|
|
263
|
+
disabled?: boolean;
|
|
264
|
+
readonly?: boolean;
|
|
265
|
+
"virtual-keyboard-mode"?: "manual" | "onfocus" | "off";
|
|
266
|
+
"virtual-keyboard-theme"?: "material" | "apple";
|
|
267
|
+
"math-mode-space"?: string;
|
|
268
|
+
"letter-shape-style"?: "tex" | "french" | "iso" | "upright" | "auto";
|
|
269
|
+
"min-font-scale"?: number;
|
|
270
|
+
"max-font-scale"?: number;
|
|
271
|
+
"smart-fence"?: boolean;
|
|
272
|
+
"smart-mode"?: boolean;
|
|
273
|
+
"smart-superscript"?: boolean;
|
|
274
|
+
"inline-shortcut-timeout"?: number;
|
|
275
|
+
"keybinding-mode"?: "default" | "vim" | "emacs";
|
|
276
|
+
"speech-engine"?: "local" | "amazon" | "google";
|
|
277
|
+
"speech-engine-voice"?: string;
|
|
278
|
+
"speech-engine-rate"?: string;
|
|
279
|
+
"read-only"?: boolean;
|
|
280
|
+
"remove-extraneous-parentheses"?: boolean;
|
|
281
|
+
"script-depth"?: number;
|
|
282
|
+
placeholder?: string;
|
|
283
|
+
"default-mode"?: "math" | "text";
|
|
284
|
+
"fonts-directory"?: string;
|
|
285
|
+
"sounds-directory"?: string;
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
declare const InputGroup: ({ type, title, defaultValue, placeholder, value, onFocus, onChange, onClick, onKeyDown, optionList, errorText, multiple, accept, theme, useMinHeight, disabled, limit, useMath, }: IInputGroupProps) => react_jsx_runtime.JSX.Element | undefined;
|
|
257
291
|
|
|
258
292
|
declare const LeftTextRightInputGroup: ({ type, title, value, optionList, onChange, disabled, errorText, }: ILeftTextRightInputGroupProps) => react_jsx_runtime.JSX.Element;
|
|
259
293
|
|
package/dist/index.js
CHANGED
|
@@ -3618,9 +3618,11 @@ var InputGroup = ({
|
|
|
3618
3618
|
theme,
|
|
3619
3619
|
useMinHeight,
|
|
3620
3620
|
disabled,
|
|
3621
|
-
limit
|
|
3621
|
+
limit,
|
|
3622
|
+
useMath
|
|
3622
3623
|
}) => {
|
|
3623
3624
|
const textAreaRef = (0, import_react10.useRef)(null);
|
|
3625
|
+
const mathFieldRef = (0, import_react10.useRef)(null);
|
|
3624
3626
|
(0, import_react10.useEffect)(() => {
|
|
3625
3627
|
if (!textAreaRef) return;
|
|
3626
3628
|
if (!textAreaRef.current) return;
|
|
@@ -3630,6 +3632,14 @@ var InputGroup = ({
|
|
|
3630
3632
|
textAreaRef.current.style.height = `44px`;
|
|
3631
3633
|
}
|
|
3632
3634
|
}, [textAreaRef, value]);
|
|
3635
|
+
(0, import_react10.useEffect)(() => {
|
|
3636
|
+
if (!useMath) return;
|
|
3637
|
+
import("mathlive").then(({ MathfieldElement }) => {
|
|
3638
|
+
if (!customElements.get("math-field")) {
|
|
3639
|
+
customElements.define("math-field", MathfieldElement);
|
|
3640
|
+
}
|
|
3641
|
+
});
|
|
3642
|
+
}, [useMath, type, placeholder, title]);
|
|
3633
3643
|
const retrieveNullableOptionList = () => {
|
|
3634
3644
|
if (!optionList) return [];
|
|
3635
3645
|
const currentOptionList = {
|
|
@@ -3657,6 +3667,22 @@ var InputGroup = ({
|
|
|
3657
3667
|
onChange && onChange(e);
|
|
3658
3668
|
}
|
|
3659
3669
|
};
|
|
3670
|
+
const handleMathFieldChange = (event) => {
|
|
3671
|
+
const mathField = event.currentTarget;
|
|
3672
|
+
const syntheticEvent = {
|
|
3673
|
+
target: {
|
|
3674
|
+
value: mathField.value,
|
|
3675
|
+
type: "text"
|
|
3676
|
+
}
|
|
3677
|
+
};
|
|
3678
|
+
onChange && onChange(syntheticEvent);
|
|
3679
|
+
};
|
|
3680
|
+
const handleMathFieldFocus = (event) => {
|
|
3681
|
+
const syntheticEvent = {
|
|
3682
|
+
target: event.currentTarget
|
|
3683
|
+
};
|
|
3684
|
+
onFocus && onFocus(syntheticEvent);
|
|
3685
|
+
};
|
|
3660
3686
|
const CheckboxInputGroup = () => {
|
|
3661
3687
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3662
3688
|
"div",
|
|
@@ -3809,6 +3835,44 @@ var InputGroup = ({
|
|
|
3809
3835
|
] });
|
|
3810
3836
|
};
|
|
3811
3837
|
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
|
+
}
|
|
3812
3876
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "my-1 relative", children: [
|
|
3813
3877
|
title ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400", children: title }) : null,
|
|
3814
3878
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
package/dist/index.mjs
CHANGED
|
@@ -3418,9 +3418,11 @@ var InputGroup = ({
|
|
|
3418
3418
|
theme,
|
|
3419
3419
|
useMinHeight,
|
|
3420
3420
|
disabled,
|
|
3421
|
-
limit
|
|
3421
|
+
limit,
|
|
3422
|
+
useMath
|
|
3422
3423
|
}) => {
|
|
3423
3424
|
const textAreaRef = useRef(null);
|
|
3425
|
+
const mathFieldRef = useRef(null);
|
|
3424
3426
|
useEffect2(() => {
|
|
3425
3427
|
if (!textAreaRef) return;
|
|
3426
3428
|
if (!textAreaRef.current) return;
|
|
@@ -3430,6 +3432,14 @@ var InputGroup = ({
|
|
|
3430
3432
|
textAreaRef.current.style.height = `44px`;
|
|
3431
3433
|
}
|
|
3432
3434
|
}, [textAreaRef, value]);
|
|
3435
|
+
useEffect2(() => {
|
|
3436
|
+
if (!useMath) return;
|
|
3437
|
+
import("mathlive").then(({ MathfieldElement }) => {
|
|
3438
|
+
if (!customElements.get("math-field")) {
|
|
3439
|
+
customElements.define("math-field", MathfieldElement);
|
|
3440
|
+
}
|
|
3441
|
+
});
|
|
3442
|
+
}, [useMath, type, placeholder, title]);
|
|
3433
3443
|
const retrieveNullableOptionList = () => {
|
|
3434
3444
|
if (!optionList) return [];
|
|
3435
3445
|
const currentOptionList = {
|
|
@@ -3457,6 +3467,22 @@ var InputGroup = ({
|
|
|
3457
3467
|
onChange && onChange(e);
|
|
3458
3468
|
}
|
|
3459
3469
|
};
|
|
3470
|
+
const handleMathFieldChange = (event) => {
|
|
3471
|
+
const mathField = event.currentTarget;
|
|
3472
|
+
const syntheticEvent = {
|
|
3473
|
+
target: {
|
|
3474
|
+
value: mathField.value,
|
|
3475
|
+
type: "text"
|
|
3476
|
+
}
|
|
3477
|
+
};
|
|
3478
|
+
onChange && onChange(syntheticEvent);
|
|
3479
|
+
};
|
|
3480
|
+
const handleMathFieldFocus = (event) => {
|
|
3481
|
+
const syntheticEvent = {
|
|
3482
|
+
target: event.currentTarget
|
|
3483
|
+
};
|
|
3484
|
+
onFocus && onFocus(syntheticEvent);
|
|
3485
|
+
};
|
|
3460
3486
|
const CheckboxInputGroup = () => {
|
|
3461
3487
|
return /* @__PURE__ */ jsxs9(
|
|
3462
3488
|
"div",
|
|
@@ -3609,6 +3635,44 @@ var InputGroup = ({
|
|
|
3609
3635
|
] });
|
|
3610
3636
|
};
|
|
3611
3637
|
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
|
+
}
|
|
3612
3676
|
return /* @__PURE__ */ jsxs9("div", { className: "my-1 relative", children: [
|
|
3613
3677
|
title ? /* @__PURE__ */ jsx16("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400", children: title }) : null,
|
|
3614
3678
|
/* @__PURE__ */ jsx16(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "catchup-library-web",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"i18next": "^24.2.2",
|
|
15
|
+
"mathlive": "^0.105.3",
|
|
15
16
|
"react": "^18.3.0",
|
|
16
17
|
"react-dnd": "^16.0.1",
|
|
17
18
|
"react-dom": "^18.3.0",
|
|
@@ -4,6 +4,43 @@ import { useEffect, useRef } from "react";
|
|
|
4
4
|
import { IInputGroupProps } from "../../properties/GroupProperties";
|
|
5
5
|
import BaseImage from "../images/BaseImage";
|
|
6
6
|
import { IOptionProps } from "../../properties/CommonProperties";
|
|
7
|
+
import { MathfieldElement } from "mathlive";
|
|
8
|
+
|
|
9
|
+
declare global {
|
|
10
|
+
namespace JSX {
|
|
11
|
+
interface IntrinsicElements {
|
|
12
|
+
"math-field": React.DetailedHTMLProps<
|
|
13
|
+
React.HTMLAttributes<MathfieldElement>,
|
|
14
|
+
MathfieldElement
|
|
15
|
+
> & {
|
|
16
|
+
value?: string;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
readonly?: boolean;
|
|
19
|
+
"virtual-keyboard-mode"?: "manual" | "onfocus" | "off";
|
|
20
|
+
"virtual-keyboard-theme"?: "material" | "apple";
|
|
21
|
+
"math-mode-space"?: string;
|
|
22
|
+
"letter-shape-style"?: "tex" | "french" | "iso" | "upright" | "auto";
|
|
23
|
+
"min-font-scale"?: number;
|
|
24
|
+
"max-font-scale"?: number;
|
|
25
|
+
"smart-fence"?: boolean;
|
|
26
|
+
"smart-mode"?: boolean;
|
|
27
|
+
"smart-superscript"?: boolean;
|
|
28
|
+
"inline-shortcut-timeout"?: number;
|
|
29
|
+
"keybinding-mode"?: "default" | "vim" | "emacs";
|
|
30
|
+
"speech-engine"?: "local" | "amazon" | "google";
|
|
31
|
+
"speech-engine-voice"?: string;
|
|
32
|
+
"speech-engine-rate"?: string;
|
|
33
|
+
"read-only"?: boolean;
|
|
34
|
+
"remove-extraneous-parentheses"?: boolean;
|
|
35
|
+
"script-depth"?: number;
|
|
36
|
+
placeholder?: string;
|
|
37
|
+
"default-mode"?: "math" | "text";
|
|
38
|
+
"fonts-directory"?: string;
|
|
39
|
+
"sounds-directory"?: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
7
44
|
|
|
8
45
|
const InputGroup = ({
|
|
9
46
|
type,
|
|
@@ -23,8 +60,10 @@ const InputGroup = ({
|
|
|
23
60
|
useMinHeight,
|
|
24
61
|
disabled,
|
|
25
62
|
limit,
|
|
63
|
+
useMath,
|
|
26
64
|
}: IInputGroupProps) => {
|
|
27
65
|
const textAreaRef = useRef<HTMLTextAreaElement>(null);
|
|
66
|
+
const mathFieldRef = useRef<MathfieldElement>(null);
|
|
28
67
|
|
|
29
68
|
useEffect(() => {
|
|
30
69
|
if (!textAreaRef) return;
|
|
@@ -36,6 +75,15 @@ const InputGroup = ({
|
|
|
36
75
|
}
|
|
37
76
|
}, [textAreaRef, value]);
|
|
38
77
|
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (!useMath) return;
|
|
80
|
+
import("mathlive").then(({ MathfieldElement }) => {
|
|
81
|
+
if (!customElements.get("math-field")) {
|
|
82
|
+
customElements.define("math-field", MathfieldElement);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}, [useMath, type, placeholder, title]);
|
|
86
|
+
|
|
39
87
|
const retrieveNullableOptionList = () => {
|
|
40
88
|
if (!optionList) return [];
|
|
41
89
|
const currentOptionList = {
|
|
@@ -66,6 +114,24 @@ const InputGroup = ({
|
|
|
66
114
|
}
|
|
67
115
|
};
|
|
68
116
|
|
|
117
|
+
const handleMathFieldChange = (event: React.FormEvent<MathfieldElement>) => {
|
|
118
|
+
const mathField = event.currentTarget;
|
|
119
|
+
const syntheticEvent = {
|
|
120
|
+
target: {
|
|
121
|
+
value: mathField.value,
|
|
122
|
+
type: "text",
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
onChange && onChange(syntheticEvent);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const handleMathFieldFocus = (event: React.FocusEvent<MathfieldElement>) => {
|
|
129
|
+
const syntheticEvent = {
|
|
130
|
+
target: event.currentTarget,
|
|
131
|
+
};
|
|
132
|
+
onFocus && onFocus(syntheticEvent);
|
|
133
|
+
};
|
|
134
|
+
|
|
69
135
|
const CheckboxInputGroup = () => {
|
|
70
136
|
return (
|
|
71
137
|
<div
|
|
@@ -270,6 +336,52 @@ const InputGroup = ({
|
|
|
270
336
|
};
|
|
271
337
|
|
|
272
338
|
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
|
+
>
|
|
356
|
+
<math-field
|
|
357
|
+
ref={mathFieldRef}
|
|
358
|
+
value={value || ""}
|
|
359
|
+
onInput={handleMathFieldChange}
|
|
360
|
+
onFocus={handleMathFieldFocus}
|
|
361
|
+
placeholder={errorText ? errorText : placeholder}
|
|
362
|
+
disabled={disabled}
|
|
363
|
+
virtual-keyboard-mode="onfocus"
|
|
364
|
+
smart-fence={true}
|
|
365
|
+
smart-mode={true}
|
|
366
|
+
smart-superscript={true}
|
|
367
|
+
style={{
|
|
368
|
+
fontSize: "16px",
|
|
369
|
+
padding: "8px 16px",
|
|
370
|
+
border: "none",
|
|
371
|
+
outline: "none",
|
|
372
|
+
width: "100%",
|
|
373
|
+
minHeight: "44px",
|
|
374
|
+
backgroundColor: disabled ? "#f5f5f5" : "transparent",
|
|
375
|
+
borderRadius: "16px",
|
|
376
|
+
fontFamily: "inherit",
|
|
377
|
+
color: disabled ? "#9ca3af" : "#000000",
|
|
378
|
+
}}
|
|
379
|
+
/>
|
|
380
|
+
</div>
|
|
381
|
+
</div>
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
|
|
273
385
|
return (
|
|
274
386
|
<div className="my-1 relative">
|
|
275
387
|
{title ? (
|