@marimo-team/islands 0.21.2-dev96 → 0.21.2-dev98
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/main.js +90 -98
- package/package.json +1 -1
- package/src/plugins/impl/TextInputPlugin.tsx +97 -60
package/dist/main.js
CHANGED
|
@@ -58285,7 +58285,7 @@ ${c}
|
|
|
58285
58285
|
fullWidth: h,
|
|
58286
58286
|
children: S
|
|
58287
58287
|
}), r[53] = e.fullWidth, r[54] = e.label, r[55] = S, r[56] = w) : w = r[56], w;
|
|
58288
|
-
}, import_compiler_runtime$22 = require_compiler_runtime(), TextInputPlugin = class {
|
|
58288
|
+
}, import_compiler_runtime$22 = require_compiler_runtime(), MASK_PLACEHOLDER = "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022", TextInputPlugin = class {
|
|
58289
58289
|
constructor() {
|
|
58290
58290
|
__publicField(this, "tagName", "marimo-text");
|
|
58291
58291
|
__publicField(this, "validator", object({
|
|
@@ -58305,19 +58305,30 @@ ${c}
|
|
|
58305
58305
|
debounce: optional(union([
|
|
58306
58306
|
boolean(),
|
|
58307
58307
|
number()
|
|
58308
|
-
]))
|
|
58308
|
+
])),
|
|
58309
|
+
passwordHasValue: boolean().optional()
|
|
58309
58310
|
}));
|
|
58310
58311
|
}
|
|
58311
58312
|
render(e) {
|
|
58313
|
+
var _a3;
|
|
58314
|
+
let r = e.data.kind === "password" ? (_a3 = e.host.closest(`[${RANDOM_ID_ATTR}]`)) == null ? void 0 : _a3.getAttribute(RANDOM_ID_ATTR) : void 0;
|
|
58312
58315
|
return (0, import_jsx_runtime.jsx)(TextComponent, {
|
|
58313
58316
|
...e.data,
|
|
58314
58317
|
value: e.value,
|
|
58315
58318
|
setValue: e.setValue
|
|
58316
|
-
});
|
|
58319
|
+
}, r ?? void 0);
|
|
58317
58320
|
}
|
|
58318
58321
|
}, TextComponent = (e) => {
|
|
58319
|
-
let r = (0, import_compiler_runtime$22.c)(
|
|
58320
|
-
r[0]
|
|
58322
|
+
let r = (0, import_compiler_runtime$22.c)(60), [c, d] = (0, import_react.useState)(e.kind === "password" && e.passwordHasValue === true), f = (0, import_react.useRef)(false), h = c ? "" : e.value, _ = c ? MASK_PLACEHOLDER : e.placeholder, v;
|
|
58323
|
+
r[0] !== c || r[1] !== e ? (v = c ? (r2) => {
|
|
58324
|
+
f.current && (d(false), e.setValue(r2));
|
|
58325
|
+
} : e.setValue, r[0] = c, r[1] = e, r[2] = v) : v = r[2];
|
|
58326
|
+
let y = v, S;
|
|
58327
|
+
r[3] === c ? S = r[4] : (S = c ? () => {
|
|
58328
|
+
f.current = true;
|
|
58329
|
+
} : void 0, r[3] = c, r[4] = S);
|
|
58330
|
+
let w = S, [E, O] = (0, import_react.useState)(e.value), M = E ?? h, I = validate(e.kind, M), z;
|
|
58331
|
+
r[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (z = {
|
|
58321
58332
|
text: null,
|
|
58322
58333
|
password: (0, import_jsx_runtime.jsx)(Lock, {
|
|
58323
58334
|
size: 16
|
|
@@ -58328,108 +58339,89 @@ ${c}
|
|
|
58328
58339
|
url: (0, import_jsx_runtime.jsx)(Globe, {
|
|
58329
58340
|
size: 16
|
|
58330
58341
|
})
|
|
58331
|
-
}, r[
|
|
58332
|
-
let
|
|
58333
|
-
r[
|
|
58342
|
+
}, r[5] = z) : z = r[5];
|
|
58343
|
+
let G = z, q;
|
|
58344
|
+
r[6] !== e.maxLength || r[7] !== h ? (q = e.maxLength ? (0, import_jsx_runtime.jsxs)("span", {
|
|
58334
58345
|
className: "text-muted-foreground text-xs font-medium",
|
|
58335
58346
|
children: [
|
|
58336
|
-
|
|
58347
|
+
h.length,
|
|
58337
58348
|
"/",
|
|
58338
58349
|
e.maxLength
|
|
58339
58350
|
]
|
|
58340
|
-
}) : null, r[
|
|
58341
|
-
let
|
|
58351
|
+
}) : null, r[6] = e.maxLength, r[7] = h, r[8] = q) : q = r[8];
|
|
58352
|
+
let Q7 = q, $7 = !I, e9;
|
|
58353
|
+
r[9] !== e.fullWidth || r[10] !== $7 ? (e9 = cn({
|
|
58354
|
+
"border-destructive": $7,
|
|
58355
|
+
"w-full": e.fullWidth
|
|
58356
|
+
}), r[9] = e.fullWidth, r[10] = $7, r[11] = e9) : e9 = r[11];
|
|
58357
|
+
let t9 = e9, n9;
|
|
58342
58358
|
if (e.debounce === true) {
|
|
58343
|
-
let c2 =
|
|
58344
|
-
r[
|
|
58345
|
-
"border-destructive": I2,
|
|
58346
|
-
"w-full": e.fullWidth
|
|
58347
|
-
}), r[4] = e.fullWidth, r[5] = I2, r[6] = z2) : z2 = r[6];
|
|
58348
|
-
let G2;
|
|
58349
|
-
r[7] !== S || r[8] !== e.disabled || r[9] !== e.kind || r[10] !== e.maxLength || r[11] !== e.minLength || r[12] !== e.placeholder || r[13] !== e.setValue || r[14] !== e.value || r[15] !== z2 || r[16] !== _2 || r[17] !== O2 ? (G2 = (0, import_jsx_runtime.jsx)(OnBlurredInput, {
|
|
58359
|
+
let c2 = G[e.kind], d2 = e.minLength != null && e.minLength > 0, f2;
|
|
58360
|
+
r[12] !== Q7 || r[13] !== t9 || r[14] !== w || r[15] !== _ || r[16] !== e.disabled || r[17] !== e.kind || r[18] !== e.maxLength || r[19] !== e.minLength || r[20] !== y || r[21] !== c2 || r[22] !== d2 || r[23] !== h ? (f2 = (0, import_jsx_runtime.jsx)(OnBlurredInput, {
|
|
58350
58361
|
"data-testid": "marimo-plugin-text-input",
|
|
58351
|
-
type:
|
|
58352
|
-
icon:
|
|
58353
|
-
placeholder:
|
|
58354
|
-
maxLength:
|
|
58355
|
-
minLength:
|
|
58356
|
-
required:
|
|
58357
|
-
disabled:
|
|
58358
|
-
className:
|
|
58359
|
-
endAdornment:
|
|
58360
|
-
value:
|
|
58361
|
-
onValueChange:
|
|
58362
|
-
|
|
58363
|
-
|
|
58364
|
-
|
|
58365
|
-
|
|
58366
|
-
|
|
58367
|
-
|
|
58368
|
-
|
|
58369
|
-
}
|
|
58370
|
-
if (typeof e.debounce == "number") {
|
|
58371
|
-
let c2 = e.label, f2 = e.fullWidth, _2 = e.kind, y2 = v[e.kind], w2 = e.placeholder, E2 = e.maxLength, O2 = e.minLength, M2 = e.minLength != null && e.minLength > 0, I2 = e.disabled, z2 = !h, G2;
|
|
58372
|
-
r[23] !== e.fullWidth || r[24] !== z2 ? (G2 = cn({
|
|
58373
|
-
"border-destructive": z2,
|
|
58374
|
-
"w-full": e.fullWidth
|
|
58375
|
-
}), r[23] = e.fullWidth, r[24] = z2, r[25] = G2) : G2 = r[25];
|
|
58376
|
-
let q2;
|
|
58377
|
-
r[26] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (q2 = (e2) => d(e2.currentTarget.value), r[26] = q2) : q2 = r[26];
|
|
58378
|
-
let Q72;
|
|
58379
|
-
r[27] !== S || r[28] !== e.debounce || r[29] !== e.disabled || r[30] !== e.kind || r[31] !== e.maxLength || r[32] !== e.minLength || r[33] !== e.placeholder || r[34] !== e.setValue || r[35] !== e.value || r[36] !== G2 || r[37] !== y2 || r[38] !== M2 ? (Q72 = (0, import_jsx_runtime.jsx)(DebouncedInput, {
|
|
58362
|
+
type: e.kind,
|
|
58363
|
+
icon: c2,
|
|
58364
|
+
placeholder: _,
|
|
58365
|
+
maxLength: e.maxLength,
|
|
58366
|
+
minLength: e.minLength,
|
|
58367
|
+
required: d2,
|
|
58368
|
+
disabled: e.disabled,
|
|
58369
|
+
className: t9,
|
|
58370
|
+
endAdornment: Q7,
|
|
58371
|
+
value: h,
|
|
58372
|
+
onValueChange: y,
|
|
58373
|
+
onInputCapture: w
|
|
58374
|
+
}), r[12] = Q7, r[13] = t9, r[14] = w, r[15] = _, r[16] = e.disabled, r[17] = e.kind, r[18] = e.maxLength, r[19] = e.minLength, r[20] = y, r[21] = c2, r[22] = d2, r[23] = h, r[24] = f2) : f2 = r[24], n9 = f2;
|
|
58375
|
+
} else if (typeof e.debounce == "number") {
|
|
58376
|
+
let c2 = G[e.kind], d2 = e.minLength != null && e.minLength > 0, f2;
|
|
58377
|
+
r[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (f2 = (e2) => O(e2.currentTarget.value), r[25] = f2) : f2 = r[25];
|
|
58378
|
+
let v2;
|
|
58379
|
+
r[26] !== Q7 || r[27] !== t9 || r[28] !== w || r[29] !== _ || r[30] !== e.debounce || r[31] !== e.disabled || r[32] !== e.kind || r[33] !== e.maxLength || r[34] !== e.minLength || r[35] !== y || r[36] !== c2 || r[37] !== d2 || r[38] !== h ? (v2 = (0, import_jsx_runtime.jsx)(DebouncedInput, {
|
|
58380
58380
|
"data-testid": "marimo-plugin-text-input",
|
|
58381
|
-
type:
|
|
58382
|
-
icon:
|
|
58383
|
-
placeholder:
|
|
58384
|
-
maxLength:
|
|
58385
|
-
minLength:
|
|
58386
|
-
required:
|
|
58387
|
-
disabled:
|
|
58388
|
-
className:
|
|
58389
|
-
endAdornment:
|
|
58390
|
-
value:
|
|
58391
|
-
onValueChange:
|
|
58392
|
-
onBlur:
|
|
58393
|
-
delay: e.debounce
|
|
58394
|
-
|
|
58395
|
-
|
|
58396
|
-
|
|
58397
|
-
|
|
58398
|
-
|
|
58399
|
-
|
|
58400
|
-
|
|
58381
|
+
type: e.kind,
|
|
58382
|
+
icon: c2,
|
|
58383
|
+
placeholder: _,
|
|
58384
|
+
maxLength: e.maxLength,
|
|
58385
|
+
minLength: e.minLength,
|
|
58386
|
+
required: d2,
|
|
58387
|
+
disabled: e.disabled,
|
|
58388
|
+
className: t9,
|
|
58389
|
+
endAdornment: Q7,
|
|
58390
|
+
value: h,
|
|
58391
|
+
onValueChange: y,
|
|
58392
|
+
onBlur: f2,
|
|
58393
|
+
delay: e.debounce,
|
|
58394
|
+
onInputCapture: w
|
|
58395
|
+
}), r[26] = Q7, r[27] = t9, r[28] = w, r[29] = _, r[30] = e.debounce, r[31] = e.disabled, r[32] = e.kind, r[33] = e.maxLength, r[34] = e.minLength, r[35] = y, r[36] = c2, r[37] = d2, r[38] = h, r[39] = v2) : v2 = r[39], n9 = v2;
|
|
58396
|
+
} else {
|
|
58397
|
+
let c2 = G[e.kind], d2 = e.minLength != null && e.minLength > 0, f2;
|
|
58398
|
+
r[40] === y ? f2 = r[41] : (f2 = (e2) => y(e2.currentTarget.value), r[40] = y, r[41] = f2);
|
|
58399
|
+
let v2;
|
|
58400
|
+
r[42] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (v2 = (e2) => O(e2.currentTarget.value), r[42] = v2) : v2 = r[42];
|
|
58401
|
+
let S2;
|
|
58402
|
+
r[43] !== Q7 || r[44] !== t9 || r[45] !== w || r[46] !== _ || r[47] !== e.disabled || r[48] !== e.kind || r[49] !== e.maxLength || r[50] !== e.minLength || r[51] !== c2 || r[52] !== d2 || r[53] !== f2 || r[54] !== h ? (S2 = (0, import_jsx_runtime.jsx)(Input, {
|
|
58403
|
+
"data-testid": "marimo-plugin-text-input",
|
|
58404
|
+
type: e.kind,
|
|
58405
|
+
icon: c2,
|
|
58406
|
+
placeholder: _,
|
|
58407
|
+
maxLength: e.maxLength,
|
|
58408
|
+
minLength: e.minLength,
|
|
58409
|
+
required: d2,
|
|
58410
|
+
disabled: e.disabled,
|
|
58411
|
+
className: t9,
|
|
58412
|
+
endAdornment: Q7,
|
|
58413
|
+
value: h,
|
|
58414
|
+
onInput: f2,
|
|
58415
|
+
onBlur: v2,
|
|
58416
|
+
onInputCapture: w
|
|
58417
|
+
}), r[43] = Q7, r[44] = t9, r[45] = w, r[46] = _, r[47] = e.disabled, r[48] = e.kind, r[49] = e.maxLength, r[50] = e.minLength, r[51] = c2, r[52] = d2, r[53] = f2, r[54] = h, r[55] = S2) : S2 = r[55], n9 = S2;
|
|
58401
58418
|
}
|
|
58402
|
-
let w = e.label, E = e.fullWidth, O = e.kind, M = v[e.kind], I = e.placeholder, z = e.maxLength, G = e.minLength, q = e.minLength != null && e.minLength > 0, Q7 = e.disabled, $7 = !h, e9;
|
|
58403
|
-
r[44] !== e.fullWidth || r[45] !== $7 ? (e9 = cn({
|
|
58404
|
-
"border-destructive": $7,
|
|
58405
|
-
"w-full": e.fullWidth
|
|
58406
|
-
}), r[44] = e.fullWidth, r[45] = $7, r[46] = e9) : e9 = r[46];
|
|
58407
|
-
let t9;
|
|
58408
|
-
r[47] === e ? t9 = r[48] : (t9 = (r2) => e.setValue(r2.currentTarget.value), r[47] = e, r[48] = t9);
|
|
58409
|
-
let n9;
|
|
58410
|
-
r[49] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (n9 = (e2) => d(e2.currentTarget.value), r[49] = n9) : n9 = r[49];
|
|
58411
58419
|
let r9;
|
|
58412
|
-
|
|
58413
|
-
|
|
58414
|
-
|
|
58415
|
-
|
|
58416
|
-
|
|
58417
|
-
maxLength: z,
|
|
58418
|
-
minLength: G,
|
|
58419
|
-
required: q,
|
|
58420
|
-
disabled: Q7,
|
|
58421
|
-
className: e9,
|
|
58422
|
-
endAdornment: S,
|
|
58423
|
-
value: e.value,
|
|
58424
|
-
onInput: t9,
|
|
58425
|
-
onBlur: n9
|
|
58426
|
-
}), r[50] = S, r[51] = e.disabled, r[52] = e.kind, r[53] = e.maxLength, r[54] = e.minLength, r[55] = e.placeholder, r[56] = e.value, r[57] = e9, r[58] = t9, r[59] = M, r[60] = q, r[61] = r9) : r9 = r[61];
|
|
58427
|
-
let i9;
|
|
58428
|
-
return r[62] !== e.fullWidth || r[63] !== e.label || r[64] !== r9 ? (i9 = (0, import_jsx_runtime.jsx)(Labeled, {
|
|
58429
|
-
label: w,
|
|
58430
|
-
fullWidth: E,
|
|
58431
|
-
children: r9
|
|
58432
|
-
}), r[62] = e.fullWidth, r[63] = e.label, r[64] = r9, r[65] = i9) : i9 = r[65], i9;
|
|
58420
|
+
return r[56] !== n9 || r[57] !== e.fullWidth || r[58] !== e.label ? (r9 = (0, import_jsx_runtime.jsx)(Labeled, {
|
|
58421
|
+
label: e.label,
|
|
58422
|
+
fullWidth: e.fullWidth,
|
|
58423
|
+
children: n9
|
|
58424
|
+
}), r[56] = n9, r[57] = e.fullWidth, r[58] = e.label, r[59] = r9) : r9 = r[59], r9;
|
|
58433
58425
|
};
|
|
58434
58426
|
function validate(e, r) {
|
|
58435
58427
|
if (!r) return true;
|
|
@@ -65466,7 +65458,7 @@ ${c}
|
|
|
65466
65458
|
return Logger.warn("Failed to get version from mount config"), null;
|
|
65467
65459
|
}
|
|
65468
65460
|
}
|
|
65469
|
-
const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.21.2-
|
|
65461
|
+
const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.21.2-dev98"), showCodeInRunModeAtom = atom(true);
|
|
65470
65462
|
atom(null);
|
|
65471
65463
|
var VIRTUAL_FILE_REGEX = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, VirtualFileTracker = class e {
|
|
65472
65464
|
constructor() {
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
3
|
import { AtSignIcon, GlobeIcon, LockIcon } from "lucide-react";
|
|
4
|
-
import { type JSX, useState } from "react";
|
|
4
|
+
import { type JSX, useRef, useState } from "react";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import {
|
|
7
7
|
DebouncedInput,
|
|
8
8
|
Input,
|
|
9
9
|
OnBlurredInput,
|
|
10
10
|
} from "../../components/ui/input";
|
|
11
|
+
import { RANDOM_ID_ATTR } from "../../core/dom/ui-element-constants";
|
|
11
12
|
import { cn } from "../../utils/cn";
|
|
12
13
|
import type { IPlugin, IPluginProps, Setter } from "../types";
|
|
13
14
|
import { Labeled } from "./common/labeled";
|
|
@@ -25,8 +26,12 @@ interface Data {
|
|
|
25
26
|
disabled?: boolean;
|
|
26
27
|
debounce?: boolean | number;
|
|
27
28
|
fullWidth: boolean;
|
|
29
|
+
passwordHasValue?: boolean;
|
|
28
30
|
}
|
|
29
31
|
|
|
32
|
+
// Matches the masked dots.
|
|
33
|
+
const MASK_PLACEHOLDER = "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
|
|
34
|
+
|
|
30
35
|
export class TextInputPlugin implements IPlugin<T, Data> {
|
|
31
36
|
tagName = "marimo-text";
|
|
32
37
|
|
|
@@ -40,11 +45,20 @@ export class TextInputPlugin implements IPlugin<T, Data> {
|
|
|
40
45
|
fullWidth: z.boolean().default(false),
|
|
41
46
|
disabled: z.boolean().optional(),
|
|
42
47
|
debounce: z.optional(z.union([z.boolean(), z.number()])),
|
|
48
|
+
passwordHasValue: z.boolean().optional(),
|
|
43
49
|
});
|
|
44
50
|
|
|
45
51
|
render(props: IPluginProps<T, Data>): JSX.Element {
|
|
52
|
+
// Force remount on cell re-run so masked state resets cleanly
|
|
53
|
+
const remountKey =
|
|
54
|
+
props.data.kind === "password"
|
|
55
|
+
? props.host
|
|
56
|
+
.closest(`[${RANDOM_ID_ATTR}]`)
|
|
57
|
+
?.getAttribute(RANDOM_ID_ATTR)
|
|
58
|
+
: undefined;
|
|
46
59
|
return (
|
|
47
60
|
<TextComponent
|
|
61
|
+
key={remountKey ?? undefined}
|
|
48
62
|
{...props.data}
|
|
49
63
|
value={props.value}
|
|
50
64
|
setValue={props.setValue}
|
|
@@ -59,9 +73,33 @@ interface TextComponentProps extends Data {
|
|
|
59
73
|
}
|
|
60
74
|
|
|
61
75
|
const TextComponent = (props: TextComponentProps) => {
|
|
62
|
-
|
|
76
|
+
// Before first real keystroke: show masked placeholder, suppress setValue.
|
|
77
|
+
// After first keystroke: normal password field.
|
|
78
|
+
const initiallyMasked =
|
|
79
|
+
props.kind === "password" && props.passwordHasValue === true;
|
|
80
|
+
const [masked, setMasked] = useState(initiallyMasked);
|
|
81
|
+
const hasTyped = useRef(false);
|
|
82
|
+
|
|
83
|
+
const value = masked ? "" : props.value;
|
|
84
|
+
const placeholder = masked ? MASK_PLACEHOLDER : props.placeholder;
|
|
85
|
+
const setValue: Setter<T> = masked
|
|
86
|
+
? (v) => {
|
|
87
|
+
if (!hasTyped.current) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
setMasked(false);
|
|
91
|
+
props.setValue(v);
|
|
92
|
+
}
|
|
93
|
+
: props.setValue;
|
|
94
|
+
// Capture-phase handler sets the ref synchronously before child onChange
|
|
95
|
+
const onInputCapture = masked
|
|
96
|
+
? () => {
|
|
97
|
+
hasTyped.current = true;
|
|
98
|
+
}
|
|
99
|
+
: undefined;
|
|
63
100
|
|
|
64
|
-
const
|
|
101
|
+
const [valueOnBlur, setValueOnBlur] = useState(props.value);
|
|
102
|
+
const valueToValidate = valueOnBlur == null ? value : valueOnBlur;
|
|
65
103
|
const isValid = validate(props.kind, valueToValidate);
|
|
66
104
|
|
|
67
105
|
const icon: Record<InputType, JSX.Element | null> = {
|
|
@@ -73,80 +111,79 @@ const TextComponent = (props: TextComponentProps) => {
|
|
|
73
111
|
|
|
74
112
|
const endAdornment = props.maxLength ? (
|
|
75
113
|
<span className="text-muted-foreground text-xs font-medium">
|
|
76
|
-
{
|
|
114
|
+
{value.length}/{props.maxLength}
|
|
77
115
|
</span>
|
|
78
116
|
) : null;
|
|
79
117
|
|
|
118
|
+
const inputClassName = cn({
|
|
119
|
+
"border-destructive": !isValid,
|
|
120
|
+
"w-full": props.fullWidth,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
let input: JSX.Element;
|
|
124
|
+
|
|
80
125
|
if (props.debounce === true) {
|
|
81
|
-
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
value={props.value}
|
|
98
|
-
onValueChange={props.setValue}
|
|
99
|
-
/>
|
|
100
|
-
</Labeled>
|
|
126
|
+
input = (
|
|
127
|
+
<OnBlurredInput
|
|
128
|
+
data-testid="marimo-plugin-text-input"
|
|
129
|
+
type={props.kind}
|
|
130
|
+
icon={icon[props.kind]}
|
|
131
|
+
placeholder={placeholder}
|
|
132
|
+
maxLength={props.maxLength}
|
|
133
|
+
minLength={props.minLength}
|
|
134
|
+
required={props.minLength != null && props.minLength > 0}
|
|
135
|
+
disabled={props.disabled}
|
|
136
|
+
className={inputClassName}
|
|
137
|
+
endAdornment={endAdornment}
|
|
138
|
+
value={value}
|
|
139
|
+
onValueChange={setValue}
|
|
140
|
+
onInputCapture={onInputCapture}
|
|
141
|
+
/>
|
|
101
142
|
);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
value={props.value}
|
|
122
|
-
onValueChange={props.setValue}
|
|
123
|
-
onBlur={(event) => setValueOnBlur(event.currentTarget.value)}
|
|
124
|
-
delay={props.debounce}
|
|
125
|
-
/>
|
|
126
|
-
</Labeled>
|
|
143
|
+
} else if (typeof props.debounce === "number") {
|
|
144
|
+
input = (
|
|
145
|
+
<DebouncedInput
|
|
146
|
+
data-testid="marimo-plugin-text-input"
|
|
147
|
+
type={props.kind}
|
|
148
|
+
icon={icon[props.kind]}
|
|
149
|
+
placeholder={placeholder}
|
|
150
|
+
maxLength={props.maxLength}
|
|
151
|
+
minLength={props.minLength}
|
|
152
|
+
required={props.minLength != null && props.minLength > 0}
|
|
153
|
+
disabled={props.disabled}
|
|
154
|
+
className={inputClassName}
|
|
155
|
+
endAdornment={endAdornment}
|
|
156
|
+
value={value}
|
|
157
|
+
onValueChange={setValue}
|
|
158
|
+
onBlur={(event) => setValueOnBlur(event.currentTarget.value)}
|
|
159
|
+
delay={props.debounce}
|
|
160
|
+
onInputCapture={onInputCapture}
|
|
161
|
+
/>
|
|
127
162
|
);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return (
|
|
131
|
-
<Labeled label={props.label} fullWidth={props.fullWidth}>
|
|
163
|
+
} else {
|
|
164
|
+
input = (
|
|
132
165
|
<Input
|
|
133
166
|
data-testid="marimo-plugin-text-input"
|
|
134
167
|
type={props.kind}
|
|
135
168
|
icon={icon[props.kind]}
|
|
136
|
-
placeholder={
|
|
169
|
+
placeholder={placeholder}
|
|
137
170
|
maxLength={props.maxLength}
|
|
138
171
|
minLength={props.minLength}
|
|
139
172
|
required={props.minLength != null && props.minLength > 0}
|
|
140
173
|
disabled={props.disabled}
|
|
141
|
-
className={
|
|
142
|
-
"border-destructive": !isValid,
|
|
143
|
-
"w-full": props.fullWidth,
|
|
144
|
-
})}
|
|
174
|
+
className={inputClassName}
|
|
145
175
|
endAdornment={endAdornment}
|
|
146
|
-
value={
|
|
147
|
-
onInput={(event) =>
|
|
176
|
+
value={value}
|
|
177
|
+
onInput={(event) => setValue(event.currentTarget.value)}
|
|
148
178
|
onBlur={(event) => setValueOnBlur(event.currentTarget.value)}
|
|
179
|
+
onInputCapture={onInputCapture}
|
|
149
180
|
/>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<Labeled label={props.label} fullWidth={props.fullWidth}>
|
|
186
|
+
{input}
|
|
150
187
|
</Labeled>
|
|
151
188
|
);
|
|
152
189
|
};
|