@code0-tech/pictor 0.0.0-mvp.29 → 0.0.0-mvp.30
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/_virtual/_commonjsHelpers.js +6 -0
- package/dist/_virtual/index.js +4 -0
- package/dist/_virtual/index2.js +4 -0
- package/dist/_virtual/react-contenteditable.js +7 -0
- package/dist/_virtual/react-contenteditable2.js +4 -0
- package/dist/_virtual/react-dom-server-legacy.browser.development.js +4 -0
- package/dist/_virtual/react-dom-server-legacy.browser.production.js +4 -0
- package/dist/_virtual/react-dom-server.browser.development.js +4 -0
- package/dist/_virtual/react-dom-server.browser.production.js +4 -0
- package/dist/_virtual/react-is.development.js +4 -0
- package/dist/_virtual/react-is.production.min.js +4 -0
- package/dist/_virtual/server.browser.js +5 -0
- package/dist/_virtual/server.browser2.js +4 -0
- package/dist/assets/components/d-resizable/DResizable.style.css +1 -1
- package/dist/assets/components/form/Input.style.css +1 -1
- package/dist/components/breadcrumb/Breadcrumb.js +12 -12
- package/dist/components/button-group/ButtonGroup.js +12 -12
- package/dist/components/d-flow/DFlow.edges.hook.js +57 -54
- package/dist/components/d-flow/DFlow.js +304 -268
- package/dist/components/d-flow/DFlow.nodes.hook.js +60 -59
- package/dist/components/d-flow/DFlow.service.d.ts +3 -2
- package/dist/components/d-flow/DFlow.service.js +62 -47
- package/dist/components/d-flow/DFlow.util.d.ts +4 -0
- package/dist/components/d-flow/DFlow.util.js +63 -0
- package/dist/components/d-flow/DFlowEdge.js +34 -34
- package/dist/components/d-flow-data-type/DFlowDataType.service.js +17 -14
- package/dist/components/d-flow-data-type/DFlowDataType.view.d.ts +7 -4
- package/dist/components/d-flow-data-type/DFlowDataType.view.js +11 -6
- package/dist/components/d-flow-file/DFlowTabDefault.d.ts +0 -3
- package/dist/components/d-flow-file/DFlowTabDefault.js +77 -112
- package/dist/components/d-flow-file/DFlowTabTrigger.js +38 -49
- package/dist/components/d-flow-file/DFlowTabs.js +26 -27
- package/dist/components/d-flow-folder/DFlowFolder.js +170 -143
- package/dist/components/d-flow-folder/DFlowFolderContextMenu.js +18 -11
- package/dist/components/d-flow-folder/DFlowFolderItemPathInput.js +1 -0
- package/dist/components/d-flow-function/DFlowFunction.input.hook.js +4 -5
- package/dist/components/d-flow-function/DFlowFunction.return.hook.js +1 -1
- package/dist/components/d-flow-function/DFlowFunction.view.d.ts +14 -11
- package/dist/components/d-flow-function/DFlowFunction.view.js +19 -12
- package/dist/components/d-flow-function/DFlowFunctionDefaultCard.js +72 -75
- package/dist/components/d-flow-function/DFlowFunctionSuggestionCard.js +27 -32
- package/dist/components/d-flow-function/DFlowFunctionTriggerCard.js +17 -10
- package/dist/components/d-flow-input/DFlowInputDataType.js +38 -33
- package/dist/components/d-flow-input/DFlowInputDefault.d.ts +10 -0
- package/dist/components/d-flow-input/DFlowInputDefault.js +128 -0
- package/dist/components/d-flow-input/DFlowInputLiteralBadge.d.ts +7 -0
- package/dist/components/d-flow-input/DFlowInputLiteralBadge.js +24 -0
- package/dist/components/d-flow-input/DFlowInputNodeBadge.d.ts +11 -0
- package/dist/components/d-flow-input/DFlowInputNodeBadge.js +44 -0
- package/dist/components/d-flow-input/DFlowInputReferenceBadge.d.ts +11 -0
- package/dist/components/d-flow-input/DFlowInputReferenceBadge.js +33 -0
- package/dist/components/d-flow-panel/DFlowExport.js +1 -1
- package/dist/components/d-flow-panel/DFlowMiniMap.js +1 -1
- package/dist/components/d-flow-panel/DFlowPanelControl.js +34 -32
- package/dist/components/d-flow-suggestion/DFlowDataTypeSuggestions.hook.d.ts +3 -0
- package/dist/components/d-flow-suggestion/DFlowDataTypeSuggestions.hook.js +34 -0
- package/dist/components/d-flow-suggestion/DFlowFunctionSuggestions.hook.d.ts +3 -0
- package/dist/components/d-flow-suggestion/DFlowFunctionSuggestions.hook.js +50 -0
- package/dist/components/d-flow-suggestion/DFlowReferenceSuggestions.hook.d.ts +3 -0
- package/dist/components/d-flow-suggestion/DFlowReferenceSuggestions.hook.js +133 -0
- package/dist/components/d-flow-suggestion/DFlowSuggestion.hook.d.ts +3 -18
- package/dist/components/d-flow-suggestion/DFlowSuggestion.hook.js +19 -156
- package/dist/components/d-flow-suggestion/DFlowSuggestionMenu.js +47 -58
- package/dist/components/d-flow-suggestion/DFlowSuggestionMenu.util.js +5 -4
- package/dist/components/d-flow-suggestion/DFlowSuggestionSearchInput.js +6 -6
- package/dist/components/d-flow-suggestion/DFlowValueSuggestions.hook.d.ts +3 -0
- package/dist/components/d-flow-suggestion/DFlowValueSuggestions.hook.js +44 -0
- package/dist/components/d-flow-type/DFlowType.view.d.ts +5 -5
- package/dist/components/d-flow-type/DFlowType.view.js +22 -12
- package/dist/components/d-flow-validation/DFlowValidation.hook.js +1 -1
- package/dist/components/d-flow-validation/DNodeValidation.hook.js +39 -43
- package/dist/components/d-resizable/DResizable.d.ts +4 -4
- package/dist/components/d-resizable/DResizable.js +22 -21
- package/dist/components/d-user/DUserInput.js +23 -21
- package/dist/components/file-tabs/FileTabs.service.d.ts +0 -1
- package/dist/components/file-tabs/FileTabs.service.js +49 -53
- package/dist/components/form/EmailInput.js +9 -9
- package/dist/components/form/Input.d.ts +2 -1
- package/dist/components/form/Input.js +294 -397
- package/dist/components/form/Input.syntax.hook.d.ts +1 -18
- package/dist/components/form/Input.syntax.hook.js +7 -73
- package/dist/components/form/Input.utils.d.ts +1 -2
- package/dist/components/form/Input.utils.js +26 -21
- package/dist/components/form/InputContentEditable.hook.d.ts +40 -0
- package/dist/components/form/InputContentEditable.hook.js +471 -0
- package/dist/components/form/InputSuggestion.d.ts +2 -2
- package/dist/components/form/InputSuggestion.js +169 -107
- package/dist/components/form/PasswordInput.js +8 -8
- package/dist/components/form/TextInput.js +11 -11
- package/dist/components/form/useForm.d.ts +1 -0
- package/dist/components/form/useForm.js +45 -60
- package/dist/components/menu/Menu.js +4 -4
- package/dist/index.js +155 -154
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +30 -30
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +8 -8
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +8 -8
- package/dist/node_modules/fast-deep-equal/index.js +31 -0
- package/dist/node_modules/object-assign/index.js +49 -0
- package/dist/node_modules/prop-types/checkPropTypes.js +54 -0
- package/dist/node_modules/prop-types/factoryWithThrowingShims.js +52 -0
- package/dist/node_modules/prop-types/factoryWithTypeCheckers.js +329 -0
- package/dist/node_modules/prop-types/index.js +17 -0
- package/dist/node_modules/prop-types/lib/ReactPropTypesSecret.js +10 -0
- package/dist/node_modules/prop-types/lib/has.js +7 -0
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +87 -0
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +70 -0
- package/dist/node_modules/prop-types/node_modules/react-is/index.js +10 -0
- package/dist/node_modules/react-contenteditable/lib/react-contenteditable.js +132 -0
- package/dist/node_modules/react-dom/cjs/react-dom-server-legacy.browser.development.js +6235 -0
- package/dist/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.js +4096 -0
- package/dist/node_modules/react-dom/cjs/react-dom-server.browser.development.js +6753 -0
- package/dist/node_modules/react-dom/cjs/react-dom-server.browser.production.js +4645 -0
- package/dist/node_modules/react-dom/server.browser.js +15 -0
- package/dist/utils/generics.d.ts +2 -0
- package/dist/utils/generics.js +93 -80
- package/dist/utils/index.js +22 -21
- package/dist/utils/inspection.d.ts +4 -2
- package/dist/utils/inspection.js +27 -2
- package/package.json +10 -8
- package/dist/components/form/Input.selection.hook.d.ts +0 -17
- package/dist/components/form/Input.selection.hook.js +0 -78
- package/dist/components/form/InputSyntax.d.ts +0 -19
- package/dist/components/form/InputSyntax.js +0 -52
- package/dist/components/form/inputSyntaxMapping.d.ts +0 -3
- package/dist/components/form/inputSyntaxMapping.js +0 -42
|
@@ -1,61 +1,136 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as f, jsxs as z } from "react/jsx-runtime";
|
|
2
|
+
import i, { useRef as y, useState as K, useMemo as L, useEffect as x } from "react";
|
|
3
|
+
import Qe from "../../_virtual/react-contenteditable.js";
|
|
3
4
|
import "../../utils/contextStore.js";
|
|
4
|
-
import { mergeCode0Props as
|
|
5
|
+
import { mergeCode0Props as le } from "../../utils/utils.js";
|
|
5
6
|
import '../../assets/components/form/Input.style.css';/* empty css */
|
|
6
|
-
import { InputLabel as
|
|
7
|
-
import { InputDescription as
|
|
8
|
-
import { InputMessage as
|
|
9
|
-
import { Menu as
|
|
10
|
-
import { InputSuggestionMenuContent as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
import { InputLabel as Xe } from "./InputLabel.js";
|
|
8
|
+
import { InputDescription as Ye } from "./InputDescription.js";
|
|
9
|
+
import { InputMessage as Ze } from "./InputMessage.js";
|
|
10
|
+
import { Menu as _e, MenuTrigger as et, MenuPortal as tt } from "../menu/Menu.js";
|
|
11
|
+
import { InputSuggestionMenuContent as nt, InputSuggestionMenuContentItems as rt } from "./InputSuggestion.js";
|
|
12
|
+
import { getSelectionMetrics as ot, setElementKey as st, setSelectionRangeSafe as at } from "./Input.utils.js";
|
|
13
|
+
import { Card as ut } from "../card/Card.js";
|
|
14
|
+
import { useContentEditableController as it } from "./InputContentEditable.hook.js";
|
|
15
|
+
const X = (u) => {
|
|
16
|
+
const k = u ?? "";
|
|
17
|
+
return typeof k == "string" ? k : String(k);
|
|
18
|
+
}, $e = (u) => {
|
|
19
|
+
if (u == null) return "";
|
|
20
|
+
if (typeof u == "string") return u;
|
|
21
|
+
try {
|
|
22
|
+
return JSON.stringify(u);
|
|
23
|
+
} catch {
|
|
24
|
+
return String(u ?? "");
|
|
25
|
+
}
|
|
26
|
+
}, Fe = (u) => {
|
|
27
|
+
if (!u) return null;
|
|
28
|
+
const k = u.value ?? "", Y = u.selectionStart ?? k.length, E = k.slice(0, Y).match(/\S+$/);
|
|
29
|
+
if (!E || E.index === void 0) return null;
|
|
30
|
+
const g = E[0], $ = E.index, N = $ + g.length;
|
|
31
|
+
return {
|
|
32
|
+
token: g,
|
|
33
|
+
start: $,
|
|
34
|
+
end: N
|
|
35
|
+
};
|
|
36
|
+
}, lt = i.forwardRef((u, k) => {
|
|
17
37
|
const {
|
|
18
|
-
wrapperComponent:
|
|
19
|
-
title:
|
|
20
|
-
description:
|
|
21
|
-
disabled:
|
|
22
|
-
left:
|
|
23
|
-
right:
|
|
24
|
-
leftType:
|
|
25
|
-
rightType:
|
|
26
|
-
formValidation:
|
|
38
|
+
wrapperComponent: Y = {},
|
|
39
|
+
title: Z,
|
|
40
|
+
description: E,
|
|
41
|
+
disabled: g = !1,
|
|
42
|
+
left: $,
|
|
43
|
+
right: N,
|
|
44
|
+
leftType: Be = "icon",
|
|
45
|
+
rightType: Ae = "action",
|
|
46
|
+
formValidation: V = {
|
|
27
47
|
valid: !0,
|
|
28
48
|
notValidMessage: null,
|
|
29
49
|
setValue: null
|
|
30
50
|
},
|
|
31
|
-
suggestions:
|
|
32
|
-
suggestionsHeader:
|
|
33
|
-
suggestionsFooter:
|
|
34
|
-
onSuggestionSelect:
|
|
35
|
-
disableOnValue:
|
|
36
|
-
transformSyntax:
|
|
37
|
-
|
|
38
|
-
filterSuggestionsByLastToken:
|
|
39
|
-
enforceUniqueSuggestions:
|
|
40
|
-
onLastTokenChange:
|
|
41
|
-
suggestionsEmptyState:
|
|
42
|
-
...
|
|
43
|
-
} =
|
|
44
|
-
onFocus:
|
|
45
|
-
onBlur:
|
|
46
|
-
onKeyDown:
|
|
47
|
-
onKeyDownCapture:
|
|
48
|
-
onChange:
|
|
49
|
-
onInput:
|
|
50
|
-
...
|
|
51
|
-
} =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
suggestions: l,
|
|
52
|
+
suggestionsHeader: ce,
|
|
53
|
+
suggestionsFooter: fe,
|
|
54
|
+
onSuggestionSelect: de,
|
|
55
|
+
disableOnValue: pe = () => !1,
|
|
56
|
+
transformSyntax: P,
|
|
57
|
+
validationUsesSyntax: j = !1,
|
|
58
|
+
filterSuggestionsByLastToken: h = !1,
|
|
59
|
+
enforceUniqueSuggestions: ge = !1,
|
|
60
|
+
onLastTokenChange: he,
|
|
61
|
+
suggestionsEmptyState: me,
|
|
62
|
+
...ze
|
|
63
|
+
} = u, {
|
|
64
|
+
onFocus: Se,
|
|
65
|
+
onBlur: _,
|
|
66
|
+
onKeyDown: q,
|
|
67
|
+
onKeyDownCapture: ee,
|
|
68
|
+
onChange: F,
|
|
69
|
+
onInput: B,
|
|
70
|
+
...m
|
|
71
|
+
} = ze, W = y(null), d = y(null), H = y(null), M = y(null), te = y(null), D = y(!1), Ne = y(0), Ce = y(null), ne = m.value ?? u.initialValue ?? u.defaultValue, [ye, je] = K(!1), R = y(!1), a = i.useCallback((e) => {
|
|
72
|
+
R.current = e, je(e);
|
|
73
|
+
}, []), [w, re] = K(ne), [ve, be] = K([]), [ke, oe] = K([]), [we, qe] = K(null), [xe, Ee] = K(null), o = !!P, I = L(() => pe(w), [pe, w]), v = L(() => o ? H : d, [o]);
|
|
74
|
+
i.useImperativeHandle(k, () => v.current ?? null, [v]);
|
|
75
|
+
const We = L(() => ({
|
|
76
|
+
...m,
|
|
77
|
+
onChange: F,
|
|
78
|
+
onInput: B
|
|
79
|
+
}), [m, F, B]), He = L(() => {
|
|
80
|
+
const {
|
|
81
|
+
value: e,
|
|
82
|
+
defaultValue: t,
|
|
83
|
+
...n
|
|
84
|
+
} = m;
|
|
85
|
+
return le("input__control", n);
|
|
86
|
+
}, [m]), U = i.useCallback(() => {
|
|
87
|
+
const e = v.current;
|
|
88
|
+
!e || g || I || e.focus({
|
|
89
|
+
preventScroll: !0
|
|
90
|
+
});
|
|
91
|
+
}, [v, g, I]), T = i.useCallback(() => {
|
|
92
|
+
l && a(!0);
|
|
93
|
+
}, [l, a]), se = i.useCallback((e) => {
|
|
94
|
+
h && (qe(e), e && a(!0), he?.(e));
|
|
95
|
+
}, [h, he, a]), ae = i.useCallback((e, t) => {
|
|
96
|
+
if (!V?.setValue) return;
|
|
97
|
+
const n = m.type !== "checkbox" ? X(e) : e, r = j ? t : n;
|
|
98
|
+
Object.is(Ce.current, r) || (Ce.current = r, V.setValue(r));
|
|
99
|
+
}, [V?.setValue, m.type, j]), p = it({
|
|
100
|
+
editorRef: H,
|
|
101
|
+
transformSyntax: P,
|
|
102
|
+
filterSuggestionsByLastToken: h,
|
|
103
|
+
onLastTokenChange: se,
|
|
104
|
+
onStateChange: ({
|
|
105
|
+
value: e,
|
|
106
|
+
tokens: t,
|
|
107
|
+
segments: n
|
|
108
|
+
}) => {
|
|
109
|
+
re(e), oe(t), Ee(n ?? null), ae(e, n ?? null);
|
|
110
|
+
}
|
|
111
|
+
}), Ve = y(!1);
|
|
112
|
+
x(() => {
|
|
113
|
+
if (!o || !P || Ve.current) return;
|
|
114
|
+
const e = X(ne);
|
|
115
|
+
re(e), p.initializeFromExternalValue(e), j && P && Ee(P(e, [])), Ve.current = !0;
|
|
116
|
+
}, [o, P, ne, j, p]), x(() => {
|
|
117
|
+
o || m.value !== void 0 && re(m.value);
|
|
118
|
+
}, [m.value, o]), x(() => {
|
|
119
|
+
ae(w, xe);
|
|
120
|
+
}, [ae, xe, w]), x(() => {
|
|
121
|
+
if (!l) return;
|
|
122
|
+
const e = (t) => {
|
|
123
|
+
const n = t.target, r = !!H.current?.contains(n), s = !!d.current?.contains(n), c = !!te.current?.contains(n), S = !!W.current?.contains(n), C = r || s || c || S;
|
|
124
|
+
D.current = C, !C && R.current && a(!1);
|
|
125
|
+
};
|
|
126
|
+
return document.addEventListener("pointerdown", e, !0), () => document.removeEventListener("pointerdown", e, !0);
|
|
127
|
+
}, [l, a]), x(() => {
|
|
128
|
+
const e = W.current;
|
|
129
|
+
if (!e) return;
|
|
130
|
+
const t = () => T();
|
|
131
|
+
return e.addEventListener("focusin", t), () => e.removeEventListener("focusin", t);
|
|
132
|
+
}, [T]);
|
|
133
|
+
const De = i.useCallback((e, t, n) => {
|
|
59
134
|
if (e.length === 0) return t <= n.length ? t : null;
|
|
60
135
|
let r = n.indexOf(e);
|
|
61
136
|
if (r === -1) return null;
|
|
@@ -63,388 +138,210 @@ const It = d.forwardRef((te, Ye) => {
|
|
|
63
138
|
for (; s !== -1; )
|
|
64
139
|
Math.abs(s - t) < Math.abs(r - t) && (r = s), s = n.indexOf(e, s + 1);
|
|
65
140
|
return r;
|
|
66
|
-
}, []),
|
|
141
|
+
}, []), J = i.useCallback((e, t) => {
|
|
67
142
|
const n = [];
|
|
68
143
|
return e.forEach((r) => {
|
|
69
|
-
const s =
|
|
144
|
+
const s = De(r.text, r.start, t);
|
|
70
145
|
if (s === null) return;
|
|
71
|
-
const
|
|
72
|
-
t.slice(s,
|
|
146
|
+
const c = s + r.text.length;
|
|
147
|
+
t.slice(s, c) === r.text && n.push({
|
|
73
148
|
...r,
|
|
74
149
|
start: s,
|
|
75
|
-
end:
|
|
150
|
+
end: c
|
|
76
151
|
});
|
|
77
152
|
}), n;
|
|
78
|
-
}, [
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const r = P.type !== "checkbox" ? n.target.value : n.target.checked, s = j ? Re.current : r;
|
|
86
|
-
I.setValue?.(s);
|
|
87
|
-
};
|
|
88
|
-
return e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
89
|
-
}, [I?.setValue, P.type, a, j]), k(() => {
|
|
90
|
-
if (!x) return;
|
|
91
|
-
const e = (t) => {
|
|
92
|
-
const n = t.target, r = !!a.current?.contains(n), s = !!_.current?.contains(n);
|
|
93
|
-
H.current = r || s;
|
|
94
|
-
};
|
|
95
|
-
return document.addEventListener("pointerdown", e, !0), () => document.removeEventListener("pointerdown", e, !0);
|
|
96
|
-
}, [a, x]), k(() => {
|
|
97
|
-
const e = a.current;
|
|
98
|
-
if (!e) return;
|
|
99
|
-
const t = (n) => {
|
|
100
|
-
Y || nt(n.target.value);
|
|
101
|
-
};
|
|
102
|
-
return e.addEventListener("change", t), e.addEventListener("input", t), () => {
|
|
103
|
-
e.removeEventListener("change", t), e.removeEventListener("input", t);
|
|
104
|
-
};
|
|
105
|
-
}, [Y, a]), k(() => {
|
|
106
|
-
const e = b(a.current?.value ?? m);
|
|
107
|
-
Te((t) => {
|
|
108
|
-
const n = G(t, e);
|
|
109
|
-
return Fe(n.map((r) => r.suggestion)), n;
|
|
153
|
+
}, [De]);
|
|
154
|
+
x(() => {
|
|
155
|
+
if (o) return;
|
|
156
|
+
const e = X(d.current?.value ?? w);
|
|
157
|
+
be((t) => {
|
|
158
|
+
const n = J(t, e);
|
|
159
|
+
return oe(n.map((r) => r.suggestion)), n;
|
|
110
160
|
});
|
|
111
|
-
}, [
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
let i = 0;
|
|
115
|
-
return r.forEach((l) => {
|
|
116
|
-
if (l.start < i) return;
|
|
117
|
-
const o = Math.min(l.end, n.length);
|
|
118
|
-
i < l.start && s.push(n.slice(i, l.start));
|
|
119
|
-
const c = l.suggestion?.value ?? l.text ?? "", g = c == null ? "" : String(c), u = Math.max(o - l.start, g.length);
|
|
120
|
-
u > 0 ? (s.push(l.suggestion), i = l.start + u) : i = l.start;
|
|
121
|
-
}), i < n.length && s.push(n.slice(i)), s.length ? s : [n];
|
|
122
|
-
}, [b]);
|
|
123
|
-
k(() => {
|
|
124
|
-
if (!I?.setValue) return;
|
|
125
|
-
const e = P.type !== "checkbox" ? b(a.current?.value ?? m) : m, t = j ? X : e;
|
|
126
|
-
Object.is(Ae.current, t) || (Ae.current = t, I.setValue(t));
|
|
127
|
-
}, [X, I?.setValue, P.type, a, b, j, m]);
|
|
128
|
-
const Be = d.useCallback(() => {
|
|
129
|
-
setTimeout(() => {
|
|
130
|
-
const e = a.current;
|
|
131
|
-
if (!e) return;
|
|
132
|
-
e.focus({
|
|
133
|
-
preventScroll: !0
|
|
134
|
-
});
|
|
135
|
-
const t = e.value.length;
|
|
136
|
-
T(e, t, t), e.scrollLeft = e.scrollWidth;
|
|
137
|
-
}, 0);
|
|
138
|
-
}, [a]), oe = d.useMemo(() => $e(m, J), [J, $e, m]), f = d.useMemo(() => {
|
|
139
|
-
if (ne)
|
|
140
|
-
return (e, t = oe) => ne(e, t);
|
|
141
|
-
}, [oe, ne]), {
|
|
142
|
-
syntaxSegments: ie,
|
|
143
|
-
visualizedSyntaxSegments: M,
|
|
144
|
-
expandSelectionRangeToBlockBoundaries: B,
|
|
145
|
-
mapVisualIndexToRawIndex: K,
|
|
146
|
-
mapRawIndexToVisualIndex: D,
|
|
147
|
-
totalVisualLength: le
|
|
148
|
-
} = St(m, f, a, oe), w = d.useMemo(() => {
|
|
149
|
-
const e = b(a.current?.value ?? m);
|
|
150
|
-
if (!C || !ie?.length) return null;
|
|
151
|
-
const t = [...ie].reverse().find((h) => h?.type === "text" && h?.end === e.length);
|
|
152
|
-
if (!t) return null;
|
|
153
|
-
const n = e.slice(t.start, t.end), r = n.trim();
|
|
154
|
-
if (!r.length) return null;
|
|
155
|
-
const s = r.split(/\s+/), i = s[s.length - 1]?.trim();
|
|
156
|
-
if (!i) return null;
|
|
157
|
-
const l = n.search(/\S/), o = l === -1 ? 0 : l, c = r.lastIndexOf(i), g = t.start + o + c, u = g + i.length;
|
|
158
|
-
return {
|
|
159
|
-
token: i,
|
|
160
|
-
start: g,
|
|
161
|
-
end: u
|
|
162
|
-
};
|
|
163
|
-
}, [C, a, b, ie, m]);
|
|
164
|
-
k(() => {
|
|
165
|
-
C && re && (w?.token && F(!0), re(w?.token ?? null));
|
|
166
|
-
}, [C, re, w?.token]);
|
|
167
|
-
const q = d.useMemo(() => {
|
|
168
|
-
if (!C || !x) return x;
|
|
169
|
-
const e = w?.token?.trim();
|
|
170
|
-
return e?.length ? x.filter((t) => {
|
|
171
|
-
const n = t?.value ?? "";
|
|
172
|
-
return (n == null ? "" : String(n)).toLowerCase().startsWith(e.toLowerCase());
|
|
173
|
-
}) : x;
|
|
174
|
-
}, [C, w?.token, x]), Q = d.useMemo(() => {
|
|
175
|
-
if (!ye || !q) return q;
|
|
176
|
-
const e = new Set(J.map((t) => t.suggestion));
|
|
177
|
-
return q.filter((t) => !e.has(t));
|
|
178
|
-
}, [J, ye, q]), {
|
|
179
|
-
ensureVisualIndexVisible: Z,
|
|
180
|
-
syncSyntaxScroll: S
|
|
181
|
-
} = vt(a, _), Ke = kt(f, B), p = d.useCallback(() => {
|
|
182
|
-
if (!f) return;
|
|
183
|
-
const e = a.current;
|
|
161
|
+
}, [o, J, w]), x(() => {
|
|
162
|
+
if (!h || o) return;
|
|
163
|
+
const e = d.current;
|
|
184
164
|
if (!e) return;
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
} = U(e), r = M.find((u) => u?.type !== "block" ? !1 : t > u?.start && t < u?.end);
|
|
189
|
-
if (r && t === n) {
|
|
190
|
-
const u = t - r.start, h = r.end - t, v = u <= h ? r.start : r.end;
|
|
191
|
-
T(e, v, v);
|
|
192
|
-
const R = v === r.start ? r.visualStart : r.visualEnd;
|
|
193
|
-
O(null), $(R), requestAnimationFrame(() => {
|
|
194
|
-
S(), Z(R);
|
|
195
|
-
});
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
if (t === n) {
|
|
199
|
-
const u = Math.round(D(t));
|
|
200
|
-
O(null), $(Number.isFinite(u) ? u : null), requestAnimationFrame(() => {
|
|
201
|
-
S(), Z(u);
|
|
202
|
-
});
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
let s = D(t), i = D(n);
|
|
206
|
-
M.forEach((u) => {
|
|
207
|
-
u?.type !== "block" || !(t < u?.end && n > u?.start) || (s = Math.min(s, u?.visualStart), i = Math.max(i, u?.visualEnd));
|
|
208
|
-
});
|
|
209
|
-
const l = Math.min(s, i), o = Math.max(s, i);
|
|
210
|
-
$(null), O({
|
|
211
|
-
start: l,
|
|
212
|
-
end: o
|
|
213
|
-
});
|
|
214
|
-
const g = (e.selectionDirection === "backward" ? "backward" : "forward") === "backward" ? l : o;
|
|
215
|
-
requestAnimationFrame(() => {
|
|
216
|
-
S(), Z(g);
|
|
217
|
-
});
|
|
218
|
-
}, [Z, a, D, S, f, M]), qe = wt(f, a, Le, M, D), ze = d.useCallback((e) => {
|
|
219
|
-
if (!e) return null;
|
|
220
|
-
const t = e.dataset.rawIndex, n = e.dataset.visualIndex || e.dataset.visualStart || e.dataset.visualEnd, r = t ? Number(t) : void 0, s = n ? Number(n) : void 0;
|
|
221
|
-
return !Number.isNaN(r) && r !== void 0 ? r : s !== void 0 ? K(s) : null;
|
|
222
|
-
}, [K]), ee = d.useCallback((e) => {
|
|
223
|
-
const t = document.elementFromPoint(e.clientX, e.clientY);
|
|
224
|
-
return ze(t ?? e.target);
|
|
225
|
-
}, [ze]), Ue = d.useCallback((e) => {
|
|
226
|
-
if (!a.current) return;
|
|
227
|
-
const t = ee(e);
|
|
228
|
-
if (t === null || Number.isNaN(t)) return;
|
|
229
|
-
e.preventDefault(), H.current = !0;
|
|
230
|
-
const n = Math.min(Math.max(t, 0), a.current.value.length), {
|
|
231
|
-
selectionStart: r
|
|
232
|
-
} = U(a.current), s = e.shiftKey && Number.isFinite(r) ? r : n;
|
|
233
|
-
V.current = s, a.current.focus({
|
|
234
|
-
preventScroll: !0
|
|
235
|
-
}), T(a.current, s, n), _.current?.setPointerCapture(e.pointerId), p();
|
|
236
|
-
}, [a, ee, p]), We = d.useCallback((e) => {
|
|
237
|
-
if (!a.current || V.current === null) return;
|
|
238
|
-
if (!(e.buttons & 1)) {
|
|
239
|
-
V.current = null;
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
const t = ee(e);
|
|
243
|
-
if (t === null || Number.isNaN(t)) return;
|
|
244
|
-
e.preventDefault();
|
|
245
|
-
const n = V.current, r = Math.min(Math.max(t, 0), a.current.value.length);
|
|
246
|
-
a.current.focus({
|
|
247
|
-
preventScroll: !0
|
|
248
|
-
}), T(a.current, n, r), p();
|
|
249
|
-
}, [a, ee, p]), je = d.useCallback(() => {
|
|
250
|
-
V.current = null;
|
|
251
|
-
}, []), _e = d.useCallback((e) => {
|
|
252
|
-
if (!f) return !1;
|
|
253
|
-
const t = e.target, {
|
|
254
|
-
rawStart: n,
|
|
255
|
-
rawEnd: r
|
|
256
|
-
} = U(t), s = (o, c) => {
|
|
257
|
-
if (o === c) return !1;
|
|
258
|
-
e.preventDefault();
|
|
259
|
-
const g = `${t.value.slice(0, o)}${t.value.slice(c)}`;
|
|
260
|
-
return Xe(t, "value", g, "input"), requestAnimationFrame(() => {
|
|
261
|
-
T(t, o, o), p();
|
|
262
|
-
}), !0;
|
|
165
|
+
const t = () => se(Fe(e)?.token ?? null);
|
|
166
|
+
return e.addEventListener("input", t), e.addEventListener("keyup", t), e.addEventListener("mouseup", t), t(), () => {
|
|
167
|
+
e.removeEventListener("input", t), e.removeEventListener("keyup", t), e.removeEventListener("mouseup", t);
|
|
263
168
|
};
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
return s(i.start, i.end);
|
|
275
|
-
const l = M.find((o) => o?.type !== "block" ? !1 : n === o?.start || n > o?.start && n < o?.end);
|
|
276
|
-
return e.key === "Delete" && l ? s(l.start, l.end) : !1;
|
|
277
|
-
}, [B, f, p, M]), ue = d.useCallback((e) => {
|
|
278
|
-
if (f && Ke(e.target), f && (e.key === "ArrowLeft" || e.key === "ArrowRight")) {
|
|
279
|
-
const t = e.target, {
|
|
280
|
-
selectionStart: n,
|
|
281
|
-
selectionEnd: r,
|
|
282
|
-
rawStart: s,
|
|
283
|
-
rawEnd: i,
|
|
284
|
-
direction: l
|
|
285
|
-
} = U(t), o = e.key === "ArrowLeft" ? -1 : 1;
|
|
286
|
-
if (e.shiftKey) {
|
|
287
|
-
const c = V.current ?? (l === "backward" ? r : n);
|
|
288
|
-
V.current = c;
|
|
289
|
-
const u = Math.round(D(c === n ? r : n)), h = Math.max(0, Math.min(u + o, le)), v = K(h);
|
|
290
|
-
if (!Number.isNaN(v)) {
|
|
291
|
-
e.preventDefault();
|
|
292
|
-
const R = Math.min(Math.max(Math.round(v), 0), t.value.length), at = R < c ? "backward" : "forward", ot = Math.min(c, R), it = Math.max(c, R);
|
|
293
|
-
T(t, ot, it, at), requestAnimationFrame(() => {
|
|
294
|
-
S(), p();
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
} else {
|
|
298
|
-
V.current = null;
|
|
299
|
-
const c = e.key === "ArrowLeft" ? s : i, g = Math.round(D(c)), u = Math.max(0, Math.min(g + o, le)), h = K(u);
|
|
300
|
-
if (!Number.isNaN(h)) {
|
|
301
|
-
e.preventDefault();
|
|
302
|
-
const v = Math.min(Math.max(Math.round(h), 0), t.value.length);
|
|
303
|
-
T(t, v, v), requestAnimationFrame(() => {
|
|
304
|
-
S(), p();
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
if (e.defaultPrevented) return;
|
|
309
|
-
}
|
|
310
|
-
if (!(f && (e.key === "Backspace" || e.key === "Delete") && _e(e)) && x) {
|
|
311
|
-
if (e.key === "ArrowDown") {
|
|
312
|
-
e.preventDefault();
|
|
313
|
-
const t = E;
|
|
314
|
-
F(!0), t ? N.current?.highlightNextItem() : setTimeout(() => N.current?.focusFirstItem(), 0);
|
|
315
|
-
} else if (e.key === "ArrowUp") {
|
|
316
|
-
e.preventDefault();
|
|
317
|
-
const t = E;
|
|
318
|
-
F(!0), t ? N.current?.highlightPreviousItem() : setTimeout(() => N.current?.focusLastItem(), 0);
|
|
319
|
-
} else e.key === "Enter" && E && N.current?.selectActiveItem() && F(!1);
|
|
320
|
-
Ce?.(e);
|
|
169
|
+
}, [h, o, se]);
|
|
170
|
+
const O = L(() => {
|
|
171
|
+
if (!h || !l) return l;
|
|
172
|
+
const e = we?.trim();
|
|
173
|
+
return e?.length ? l.filter((t) => String(t?.value ?? "").toLowerCase().startsWith(e.toLowerCase())) : l;
|
|
174
|
+
}, [h, we, l]), G = L(() => {
|
|
175
|
+
if (!ge || !O) return O;
|
|
176
|
+
if (o) {
|
|
177
|
+
const t = new Set((ke ?? []).map((n) => $e(n?.value ?? n)));
|
|
178
|
+
return O.filter((n) => !t.has($e(n?.value ?? n)));
|
|
321
179
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}, [
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
k(() => {
|
|
332
|
-
const e = a.current;
|
|
333
|
-
if (!e || !f) return;
|
|
334
|
-
const t = () => requestAnimationFrame(p);
|
|
335
|
-
t();
|
|
336
|
-
const n = ["select", "keyup", "mouseup", "input", "keydown"];
|
|
337
|
-
return n.forEach((r) => e.addEventListener(r, t)), () => {
|
|
338
|
-
n.forEach((r) => e.removeEventListener(r, t));
|
|
339
|
-
};
|
|
340
|
-
}, [a, f, p]), k(() => {
|
|
341
|
-
if (!f) return;
|
|
342
|
-
const e = () => {
|
|
343
|
-
document.activeElement === a.current && p();
|
|
344
|
-
};
|
|
345
|
-
return document.addEventListener("selectionchange", e), () => document.removeEventListener("selectionchange", e);
|
|
346
|
-
}, [a, f, p]), k(() => {
|
|
347
|
-
const e = a.current;
|
|
348
|
-
if (!e) return;
|
|
349
|
-
const t = () => S();
|
|
350
|
-
return t(), e.addEventListener("scroll", t), () => e.removeEventListener("scroll", t);
|
|
351
|
-
}, [a, S]), k(() => {
|
|
352
|
-
S();
|
|
353
|
-
}, [S, m, se, Le]), k(() => {
|
|
354
|
-
f || (O(null), $(null));
|
|
355
|
-
}, [f]);
|
|
356
|
-
const He = d.useCallback((e) => {
|
|
357
|
-
if (!a.current) return;
|
|
358
|
-
const t = typeof m == "object" ? JSON.stringify(e.value) : e.value, n = t == null ? "" : String(t), r = e.insertMode ?? "replace", s = a.current.value ?? "";
|
|
359
|
-
let i = s, l = null, o = 0;
|
|
360
|
-
if (C && w)
|
|
361
|
-
i = `${s.slice(0, w.start)}${n}${s.slice(w.end)}`, l = w.start + n.length, o = w.start;
|
|
180
|
+
const e = new Set(ve.map((t) => t.suggestion));
|
|
181
|
+
return O.filter((t) => !e.has(t));
|
|
182
|
+
}, [ve, ke, ge, O, o]), Ie = i.useCallback((e) => {
|
|
183
|
+
if (!d.current) return;
|
|
184
|
+
const t = typeof w == "object" ? JSON.stringify(e.value) : e.value, n = t == null ? "" : String(t), r = e.insertMode ?? "replace", s = d.current.value ?? "";
|
|
185
|
+
let c = s, S = null, C = 0;
|
|
186
|
+
const A = h ? Fe(d.current) : null;
|
|
187
|
+
if (h && A)
|
|
188
|
+
c = `${s.slice(0, A.start)}${n}${s.slice(A.end)}`, S = A.start + n.length, C = A.start;
|
|
362
189
|
else
|
|
363
190
|
switch (r) {
|
|
364
|
-
case "append":
|
|
365
|
-
|
|
191
|
+
case "append":
|
|
192
|
+
c = `${s}${n}`, S = c.length, C = s.length;
|
|
366
193
|
break;
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
i = `${n}${s}`, l = n.length, o = 0;
|
|
194
|
+
case "prepend":
|
|
195
|
+
c = `${n}${s}`, S = n.length, C = 0;
|
|
370
196
|
break;
|
|
371
|
-
}
|
|
372
197
|
case "insert": {
|
|
373
198
|
const {
|
|
374
|
-
rawStart:
|
|
375
|
-
rawEnd:
|
|
376
|
-
} =
|
|
377
|
-
|
|
378
|
-
end: h
|
|
379
|
-
} = f ? B(c, g) : {
|
|
380
|
-
start: c,
|
|
381
|
-
end: g
|
|
382
|
-
};
|
|
383
|
-
i = `${s.slice(0, u)}${n}${s.slice(h)}`, l = u + n.length, o = u;
|
|
199
|
+
rawStart: b,
|
|
200
|
+
rawEnd: ie
|
|
201
|
+
} = ot(d.current);
|
|
202
|
+
c = `${s.slice(0, b)}${n}${s.slice(ie)}`, S = b + n.length, C = b;
|
|
384
203
|
break;
|
|
385
204
|
}
|
|
386
205
|
case "replace":
|
|
387
|
-
default:
|
|
388
|
-
|
|
206
|
+
default:
|
|
207
|
+
c = n, S = n.length, C = 0;
|
|
389
208
|
break;
|
|
390
|
-
}
|
|
391
209
|
}
|
|
392
|
-
|
|
393
|
-
const
|
|
394
|
-
id:
|
|
210
|
+
st(d.current, "value", c, "change"), be((b) => {
|
|
211
|
+
const ie = X(c), Te = J(b, ie), Oe = n.length ? {
|
|
212
|
+
id: Ne.current++,
|
|
395
213
|
suggestion: e,
|
|
396
214
|
text: n,
|
|
397
|
-
start:
|
|
398
|
-
end:
|
|
399
|
-
} : null,
|
|
400
|
-
return
|
|
401
|
-
}),
|
|
402
|
-
const
|
|
403
|
-
|
|
215
|
+
start: C,
|
|
216
|
+
end: C + n.length
|
|
217
|
+
} : null, Ke = Oe ? [...Te, Oe] : Te;
|
|
218
|
+
return oe(Ke.map((Ge) => Ge.suggestion)), Ke;
|
|
219
|
+
}), S !== null && requestAnimationFrame(() => {
|
|
220
|
+
const b = d.current;
|
|
221
|
+
b && (b.focus({
|
|
404
222
|
preventScroll: !0
|
|
405
|
-
}),
|
|
223
|
+
}), at(b, S, S));
|
|
224
|
+
});
|
|
225
|
+
}, [h, J, w]), Le = i.useCallback((e) => {
|
|
226
|
+
if (o ? p.applySuggestionValueSyntax(e) : Ie(e), de?.(e), o) {
|
|
227
|
+
const t = v.current;
|
|
228
|
+
requestAnimationFrame(() => {
|
|
229
|
+
if (!t) return;
|
|
230
|
+
const n = {
|
|
231
|
+
type: "change",
|
|
232
|
+
target: t,
|
|
233
|
+
currentTarget: t
|
|
234
|
+
};
|
|
235
|
+
t.dispatchEvent(new Event("input", {
|
|
236
|
+
bubbles: !0
|
|
237
|
+
})), B?.(n), F?.(n);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
a(!1), D.current = !1, requestAnimationFrame(() => {
|
|
241
|
+
U();
|
|
406
242
|
});
|
|
407
|
-
}, [
|
|
408
|
-
|
|
409
|
-
|
|
243
|
+
}, [v, Ie, p, U, o, de, a, F, B]), Pe = i.useCallback((e) => {
|
|
244
|
+
T(), Se?.(e);
|
|
245
|
+
}, [T, Se]), Q = i.useCallback((e) => {
|
|
246
|
+
if (D.current) {
|
|
247
|
+
_?.(e);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
a(!1), _?.(e);
|
|
251
|
+
}, [_, a]), Me = i.useCallback((e) => {
|
|
252
|
+
if (o) {
|
|
253
|
+
p.handleKeyDownCapture(e), ee?.(e);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
(e.key === " " || e.code === "Space") && (e.stopPropagation(), e.nativeEvent?.stopImmediatePropagation?.()), ee?.(e);
|
|
257
|
+
}, [p, o, ee]), Re = i.useCallback((e) => {
|
|
258
|
+
if (l) {
|
|
259
|
+
if (e.key === "ArrowDown") {
|
|
260
|
+
e.preventDefault(), e.stopPropagation(), R.current ? M.current?.highlightNextItem?.() : (a(!0), setTimeout(() => M.current?.focusFirstItem?.(), 0));
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
if (e.key === "ArrowUp") {
|
|
264
|
+
e.preventDefault(), e.stopPropagation(), R.current ? M.current?.highlightPreviousItem?.() : (a(!0), setTimeout(() => M.current?.focusLastItem?.(), 0));
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if (e.key === "Enter" && R.current) {
|
|
268
|
+
e.preventDefault(), e.stopPropagation(), M.current?.selectActiveItem?.() && a(!1);
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
if (e.key === "Escape" && R.current) {
|
|
272
|
+
e.preventDefault(), e.stopPropagation(), a(!1);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
if (o && p.handleKeyDown(e)) {
|
|
277
|
+
q?.(e);
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
if (o && e.key === "Enter") {
|
|
281
|
+
e.preventDefault(), q?.(e);
|
|
410
282
|
return;
|
|
411
283
|
}
|
|
412
|
-
|
|
284
|
+
q?.(e);
|
|
285
|
+
}, [p, o, l, a, q]), ue = o ? /* @__PURE__ */ f(Qe, { innerRef: H, html: p.editorHtml, ...He, disabled: g || I, onChange: (e) => {
|
|
286
|
+
p.handleChange(e), F?.(e), B?.(e);
|
|
287
|
+
}, onPaste: p.handlePaste, onFocus: Pe, onBlur: Q, onKeyDownCapture: Me, onKeyDown: Re, spellCheck: !1, contentEditable: !g && !I }) : /* @__PURE__ */ f("input", { ref: d, ...le("input__control", We), onFocus: Pe, onBlur: Q, onKeyDownCapture: Me, onKeyDown: Re, spellCheck: !1, disabled: g || I }), Ue = i.useCallback((e) => {
|
|
288
|
+
if (g || I) return;
|
|
289
|
+
const t = e.target;
|
|
290
|
+
te.current?.contains(t) || (D.current = !0, U(), T());
|
|
291
|
+
}, [g, I, U, T]);
|
|
292
|
+
x(() => {
|
|
293
|
+
const e = W.current;
|
|
294
|
+
if (!e) return;
|
|
295
|
+
const t = (n) => {
|
|
296
|
+
const r = n.relatedTarget;
|
|
297
|
+
r && e.contains(r) || Q(n);
|
|
298
|
+
};
|
|
299
|
+
return e.addEventListener("focusout", t), () => e.removeEventListener("focusout", t);
|
|
300
|
+
}, [Q]);
|
|
301
|
+
const Je = L(() => /* @__PURE__ */ z(_e, { open: ye, modal: !1, onOpenChange: (e) => {
|
|
302
|
+
!e && D.current || a(e);
|
|
413
303
|
}, children: [
|
|
414
|
-
/* @__PURE__ */
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
304
|
+
/* @__PURE__ */ f(et, { asChild: !0, children: /* @__PURE__ */ f("button", { type: "button", tabIndex: -1, "aria-hidden": !0, style: {
|
|
305
|
+
position: "absolute",
|
|
306
|
+
inset: 0,
|
|
307
|
+
opacity: 0,
|
|
308
|
+
pointerEvents: "none"
|
|
309
|
+
}, onMouseDown: (e) => e.preventDefault() }) }),
|
|
310
|
+
ue,
|
|
311
|
+
/* @__PURE__ */ f(tt, { children: /* @__PURE__ */ f("div", { ref: te, onPointerDownCapture: () => {
|
|
312
|
+
D.current = !0;
|
|
313
|
+
}, onMouseDownCapture: (e) => {
|
|
314
|
+
e.preventDefault(), D.current = !0;
|
|
315
|
+
}, children: /* @__PURE__ */ z(nt, { color: "secondary", inputRef: v, children: [
|
|
316
|
+
ce,
|
|
317
|
+
/* @__PURE__ */ z(ut, { paddingSize: "xxs", mt: -0.35, mx: -0.35, style: {
|
|
418
318
|
borderWidth: "2px"
|
|
419
319
|
}, children: [
|
|
420
|
-
|
|
421
|
-
!!
|
|
422
|
-
|
|
320
|
+
G?.length === 0 && me,
|
|
321
|
+
!!G?.length && /* @__PURE__ */ f(
|
|
322
|
+
rt,
|
|
423
323
|
{
|
|
424
|
-
ref:
|
|
425
|
-
inputRef:
|
|
426
|
-
suggestions:
|
|
427
|
-
onSuggestionSelect:
|
|
428
|
-
W ? W?.(e) : He(e), F(!1), W && Be();
|
|
429
|
-
}
|
|
324
|
+
ref: M,
|
|
325
|
+
inputRef: v,
|
|
326
|
+
suggestions: G,
|
|
327
|
+
onSuggestionSelect: Le
|
|
430
328
|
}
|
|
431
329
|
)
|
|
432
330
|
] }),
|
|
433
|
-
|
|
434
|
-
] }) })
|
|
435
|
-
] }), [
|
|
436
|
-
return /* @__PURE__ */ z(
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
/* @__PURE__ */ z("div", { ...
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
Se && /* @__PURE__ */ y("div", { className: `input__right input__right--${Ze}`, children: Se })
|
|
331
|
+
fe
|
|
332
|
+
] }) }) })
|
|
333
|
+
] }), [ye, ue, o, G, ce, fe, me, Le, v, a]);
|
|
334
|
+
return /* @__PURE__ */ z("div", { children: [
|
|
335
|
+
Z && /* @__PURE__ */ f(Xe, { children: Z }),
|
|
336
|
+
E && /* @__PURE__ */ f(Ye, { children: E }),
|
|
337
|
+
/* @__PURE__ */ z("div", { ref: W, ...le(`input ${V?.valid ? "" : "input--not-valid"}`, Y), onPointerDown: Ue, children: [
|
|
338
|
+
$ && /* @__PURE__ */ f("div", { className: `input__left input__left--${Be}`, children: $ }),
|
|
339
|
+
l ? Je : ue,
|
|
340
|
+
N && /* @__PURE__ */ f("div", { className: `input__right input__right--${Ae}`, children: N })
|
|
444
341
|
] }),
|
|
445
|
-
!
|
|
342
|
+
!V?.valid && V?.notValidMessage && /* @__PURE__ */ f(Ze, { children: V.notValidMessage })
|
|
446
343
|
] });
|
|
447
|
-
}),
|
|
344
|
+
}), xt = lt;
|
|
448
345
|
export {
|
|
449
|
-
|
|
346
|
+
xt as Input
|
|
450
347
|
};
|