@tamagui/input 2.7.7 → 3.0.0-beta.1091.1
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/cjs/Input.cjs +72 -163
- package/dist/cjs/Input.native.cjs +208 -0
- package/dist/cjs/Input.native.js +186 -283
- package/dist/cjs/Input.native.js.map +1 -1
- package/dist/cjs/InputNativeProps.cjs +9 -11
- package/dist/cjs/InputNativeProps.native.cjs +18 -0
- package/dist/cjs/InputNativeProps.native.js +9 -10
- package/dist/cjs/InputNativeProps.native.js.map +1 -1
- package/dist/cjs/TextArea.cjs +23 -39
- package/dist/cjs/TextArea.native.cjs +38 -0
- package/dist/cjs/TextArea.native.js +23 -38
- package/dist/cjs/TextArea.native.js.map +1 -1
- package/dist/cjs/index.cjs +15 -17
- package/dist/cjs/index.native.cjs +32 -0
- package/dist/cjs/index.native.js +15 -16
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/shared.cjs +74 -124
- package/dist/cjs/shared.native.cjs +101 -0
- package/dist/cjs/shared.native.js +80 -129
- package/dist/cjs/shared.native.js.map +1 -1
- package/dist/cjs/types.cjs +9 -11
- package/dist/cjs/types.native.cjs +18 -0
- package/dist/cjs/types.native.js +9 -10
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/esm/Input.mjs +59 -139
- package/dist/esm/Input.mjs.map +1 -1
- package/dist/esm/Input.native.js +174 -261
- package/dist/esm/Input.native.js.map +1 -1
- package/dist/esm/InputNativeProps.mjs +0 -2
- package/dist/esm/InputNativeProps.native.js +0 -2
- package/dist/esm/TextArea.mjs +12 -22
- package/dist/esm/TextArea.mjs.map +1 -1
- package/dist/esm/TextArea.native.js +12 -22
- package/dist/esm/TextArea.native.js.map +1 -1
- package/dist/esm/index.js +6 -4
- package/dist/esm/index.mjs +6 -4
- package/dist/esm/index.native.js +6 -4
- package/dist/esm/shared.mjs +59 -107
- package/dist/esm/shared.mjs.map +1 -1
- package/dist/esm/shared.native.js +64 -112
- package/dist/esm/shared.native.js.map +1 -1
- package/dist/esm/types.mjs +0 -2
- package/dist/esm/types.native.js +0 -2
- package/dist/jsx/Input.mjs +59 -139
- package/dist/jsx/Input.mjs.map +1 -1
- package/dist/jsx/Input.native.cjs +208 -0
- package/dist/jsx/Input.native.js +186 -283
- package/dist/jsx/Input.native.js.map +1 -1
- package/dist/jsx/InputNativeProps.mjs +0 -2
- package/dist/jsx/InputNativeProps.native.cjs +18 -0
- package/dist/jsx/InputNativeProps.native.js +9 -10
- package/dist/jsx/InputNativeProps.native.js.map +1 -1
- package/dist/jsx/TextArea.mjs +12 -22
- package/dist/jsx/TextArea.mjs.map +1 -1
- package/dist/jsx/TextArea.native.cjs +38 -0
- package/dist/jsx/TextArea.native.js +23 -38
- package/dist/jsx/TextArea.native.js.map +1 -1
- package/dist/jsx/index.js +6 -4
- package/dist/jsx/index.mjs +6 -4
- package/dist/jsx/index.native.cjs +32 -0
- package/dist/jsx/index.native.js +15 -16
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/shared.mjs +59 -107
- package/dist/jsx/shared.mjs.map +1 -1
- package/dist/jsx/shared.native.cjs +101 -0
- package/dist/jsx/shared.native.js +80 -129
- package/dist/jsx/shared.native.js.map +1 -1
- package/dist/jsx/types.mjs +0 -2
- package/dist/jsx/types.native.cjs +18 -0
- package/dist/jsx/types.native.js +9 -10
- package/dist/jsx/types.native.js.map +1 -1
- package/package.json +17 -17
- package/src/Input.native.tsx +267 -242
- package/src/Input.tsx +150 -154
- package/src/TextArea.tsx +9 -18
- package/src/shared.tsx +56 -109
- package/src/types.ts +2 -2
- package/types/Input.d.ts +32 -50
- package/types/Input.d.ts.map +1 -1
- package/types/Input.native.d.ts +32 -50
- package/types/Input.native.d.ts.map +1 -1
- package/types/TextArea.d.ts +16 -34
- package/types/TextArea.d.ts.map +1 -1
- package/types/shared.d.ts +38 -109
- package/types/shared.d.ts.map +1 -1
- package/types/types.d.ts +2 -2
- package/types/types.d.ts.map +1 -1
- package/dist/cjs/inputTypes.test-d.cjs +0 -128
- package/dist/cjs/inputTypes.test-d.native.js +0 -131
- package/dist/cjs/inputTypes.test-d.native.js.map +0 -1
- package/dist/cjs/v1/Input.cjs +0 -200
- package/dist/cjs/v1/Input.native.js +0 -183
- package/dist/cjs/v1/Input.native.js.map +0 -1
- package/dist/cjs/v1/TextArea.cjs +0 -52
- package/dist/cjs/v1/TextArea.native.js +0 -55
- package/dist/cjs/v1/TextArea.native.js.map +0 -1
- package/dist/cjs/v1/index.cjs +0 -21
- package/dist/cjs/v1/index.native.js +0 -24
- package/dist/cjs/v1/index.native.js.map +0 -1
- package/dist/cjs/v1/types.cjs +0 -18
- package/dist/cjs/v1/types.native.js +0 -21
- package/dist/cjs/v1/types.native.js.map +0 -1
- package/dist/esm/InputNativeProps.mjs.map +0 -1
- package/dist/esm/InputNativeProps.native.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/esm/inputTypes.test-d.mjs +0 -129
- package/dist/esm/inputTypes.test-d.mjs.map +0 -1
- package/dist/esm/inputTypes.test-d.native.js +0 -129
- package/dist/esm/inputTypes.test-d.native.js.map +0 -1
- package/dist/esm/types.mjs.map +0 -1
- package/dist/esm/types.native.js.map +0 -1
- package/dist/esm/v1/Input.mjs +0 -164
- package/dist/esm/v1/Input.mjs.map +0 -1
- package/dist/esm/v1/Input.native.js +0 -144
- package/dist/esm/v1/Input.native.js.map +0 -1
- package/dist/esm/v1/TextArea.mjs +0 -27
- package/dist/esm/v1/TextArea.mjs.map +0 -1
- package/dist/esm/v1/TextArea.native.js +0 -27
- package/dist/esm/v1/TextArea.native.js.map +0 -1
- package/dist/esm/v1/index.mjs +0 -3
- package/dist/esm/v1/index.mjs.map +0 -1
- package/dist/esm/v1/index.native.js +0 -3
- package/dist/esm/v1/index.native.js.map +0 -1
- package/dist/esm/v1/types.mjs +0 -2
- package/dist/esm/v1/types.mjs.map +0 -1
- package/dist/esm/v1/types.native.js +0 -2
- package/dist/esm/v1/types.native.js.map +0 -1
- package/dist/jsx/InputNativeProps.mjs.map +0 -1
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs.map +0 -1
- package/dist/jsx/inputTypes.test-d.mjs +0 -129
- package/dist/jsx/inputTypes.test-d.mjs.map +0 -1
- package/dist/jsx/inputTypes.test-d.native.js +0 -131
- package/dist/jsx/inputTypes.test-d.native.js.map +0 -1
- package/dist/jsx/types.mjs.map +0 -1
- package/dist/jsx/v1/Input.mjs +0 -164
- package/dist/jsx/v1/Input.mjs.map +0 -1
- package/dist/jsx/v1/Input.native.js +0 -183
- package/dist/jsx/v1/Input.native.js.map +0 -1
- package/dist/jsx/v1/TextArea.mjs +0 -27
- package/dist/jsx/v1/TextArea.mjs.map +0 -1
- package/dist/jsx/v1/TextArea.native.js +0 -55
- package/dist/jsx/v1/TextArea.native.js.map +0 -1
- package/dist/jsx/v1/index.mjs +0 -3
- package/dist/jsx/v1/index.mjs.map +0 -1
- package/dist/jsx/v1/index.native.js +0 -24
- package/dist/jsx/v1/index.native.js.map +0 -1
- package/dist/jsx/v1/types.mjs +0 -2
- package/dist/jsx/v1/types.mjs.map +0 -1
- package/dist/jsx/v1/types.native.js +0 -21
- package/dist/jsx/v1/types.native.js.map +0 -1
- package/src/inputTypes.test-d.ts +0 -245
- package/src/v1/Input.native.tsx +0 -153
- package/src/v1/Input.tsx +0 -190
- package/src/v1/TextArea.tsx +0 -35
- package/src/v1/index.ts +0 -3
- package/src/v1/types.ts +0 -65
- package/types/v1/Input.d.ts +0 -64
- package/types/v1/Input.d.ts.map +0 -1
- package/types/v1/Input.native.d.ts +0 -63
- package/types/v1/Input.native.d.ts.map +0 -1
- package/types/v1/TextArea.d.ts +0 -41
- package/types/v1/TextArea.d.ts.map +0 -1
- package/types/v1/index.d.ts +0 -4
- package/types/v1/index.d.ts.map +0 -1
- package/types/v1/types.d.ts +0 -39
- package/types/v1/types.d.ts.map +0 -1
package/dist/jsx/Input.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"file":"Input.js","names":[],"sources":["jsx/Input.js"],"sourcesContent":["import { createStyledHOC, View, styled } from \"@tamagui/core\";\nimport { registerFocusable } from \"@tamagui/focusable\";\nimport { useWebRef } from \"@tamagui/element\";\nimport React from \"react\";\nimport { resolveMultilineInputSize, styledBody } from \"./shared\";\nimport { jsx } from \"react/jsx-runtime\";\nconst StyledInput = styled(View, styledBody[0], styledBody[1]).resolve(\n resolveMultilineInputSize\n);\nconst Input = createStyledHOC(\n StyledInput,\n (props, _forwardedRef) => {\n const {\n disabled,\n id,\n onChangeText,\n onSubmitEditing,\n onSelectionChange,\n selection,\n rows,\n // Native-only props (ignored on web)\n keyboardAppearance,\n returnKeyType,\n submitBehavior,\n blurOnSubmit,\n caretHidden,\n contextMenuHidden,\n selectTextOnFocus,\n secureTextEntry,\n maxFontSizeMultiplier,\n allowFontScaling,\n multiline,\n keyboardType,\n autoCapitalize: autoCapitalizeProp,\n autoCorrect: autoCorrectProp,\n autoFocusNative,\n textContentType,\n onEndEditing,\n onContentSizeChange,\n onScroll,\n onKeyPress,\n // iOS-only props (ignored on web)\n clearButtonMode,\n clearTextOnFocus,\n enablesReturnKeyAutomatically,\n dataDetectorTypes,\n scrollEnabled,\n passwordRules,\n rejectResponderTermination,\n spellCheck,\n lineBreakStrategyIOS,\n lineBreakModeIOS,\n smartInsertDelete,\n inputAccessoryViewID,\n inputAccessoryViewButtonLabel,\n disableKeyboardShortcuts,\n // Android-only props (ignored on web)\n underlineColorAndroid,\n importantForAutofill,\n disableFullscreenUI,\n inlineImageLeft,\n inlineImagePadding,\n returnKeyLabel,\n textBreakStrategy,\n textAlignVertical,\n verticalAlign,\n showSoftInputOnFocus,\n numberOfLines,\n ...rest\n } = props;\n const { ref, composedRef } = useWebRef(_forwardedRef);\n const autoCorrect = autoCorrectProp === true ? \"on\" : autoCorrectProp === false ? \"off\" : autoCorrectProp;\n const autoCapitalize = autoCapitalizeProp === \"sentences\" || autoCapitalizeProp === \"words\" ? \"on\" : autoCapitalizeProp === \"none\" || autoCapitalizeProp === \"characters\" ? \"off\" : autoCapitalizeProp;\n React.useEffect(() => {\n if (!onSelectionChange) return;\n const node = ref.current;\n if (!node) return;\n const handleSelectionChange = () => {\n onSelectionChange({\n nativeEvent: {\n selection: {\n start: node.selectionStart ?? 0,\n end: node.selectionEnd ?? 0\n }\n }\n });\n };\n node.addEventListener(\"select\", handleSelectionChange);\n return () => node.removeEventListener(\"select\", handleSelectionChange);\n }, [onSelectionChange]);\n React.useEffect(() => {\n if (selection && ref.current) {\n ref.current.setSelectionRange(selection.start, selection.end ?? selection.start);\n }\n }, [selection?.start, selection?.end]);\n React.useEffect(() => {\n if (!id || disabled) return;\n return registerFocusable(id, {\n focusAndSelect: () => ref.current?.focus(),\n focus: () => ref.current?.focus()\n });\n }, [id, disabled]);\n const handleKeyDown = (e) => {\n if (e.key === \"Enter\" && onSubmitEditing) {\n onSubmitEditing({\n nativeEvent: { text: e.target.value }\n });\n }\n rest.onKeyDown?.(e);\n };\n const handleChange = (e) => {\n onChangeText?.(e.target.value);\n rest.onChange?.(e);\n };\n const finalProps = {\n ...rest,\n disabled,\n id,\n rows,\n autoCorrect,\n autoCapitalize,\n onKeyDown: onSubmitEditing ? handleKeyDown : rest.onKeyDown,\n onChange: onChangeText ? handleChange : rest.onChange\n };\n return /* @__PURE__ */ jsx(StyledInput, { ref: composedRef, ...finalProps });\n }\n);\nexport {\n Input\n};\n//# sourceMappingURL=Input.js.map\n"],"mappings":";;;;;;;;AAMA,MAAM,cAAc,OAAO,MAAM,WAAW,IAAI,WAAW,EAAE,CAAC,CAAC,QAC7D,yBACF;AACA,MAAM,QAAQ,gBACZ,cACC,OAAO,kBAAkB;CACxB,MAAM,EACJ,UACA,IACA,cACA,iBACA,mBACA,WACA,MAEA,oBACA,eACA,gBACA,cACA,aACA,mBACA,mBACA,iBACA,uBACA,kBACA,WACA,cACA,gBAAgB,oBAChB,aAAa,iBACb,iBACA,iBACA,cACA,qBACA,UACA,YAEA,iBACA,kBACA,+BACA,mBACA,eACA,eACA,4BACA,YACA,sBACA,kBACA,mBACA,sBACA,+BACA,0BAEA,uBACA,sBACA,qBACA,iBACA,oBACA,gBACA,mBACA,mBACA,eACA,sBACA,eACA,GAAG,SACD;CACJ,MAAM,EAAE,KAAK,gBAAgB,UAAU,aAAa;CACpD,MAAM,cAAc,oBAAoB,OAAO,OAAO,oBAAoB,QAAQ,QAAQ;CAC1F,MAAM,iBAAiB,uBAAuB,eAAe,uBAAuB,UAAU,OAAO,uBAAuB,UAAU,uBAAuB,eAAe,QAAQ;CACpL,MAAM,gBAAgB;EACpB,IAAI,CAAC,mBAAmB;EACxB,MAAM,OAAO,IAAI;EACjB,IAAI,CAAC,MAAM;EACX,MAAM,8BAA8B;GAClC,kBAAkB,EAChB,aAAa,EACX,WAAW;IACT,OAAO,KAAK,kBAAkB;IAC9B,KAAK,KAAK,gBAAgB;GAC5B,EACF,EACF,CAAC;EACH;EACA,KAAK,iBAAiB,UAAU,qBAAqB;EACrD,aAAa,KAAK,oBAAoB,UAAU,qBAAqB;CACvE,GAAG,CAAC,iBAAiB,CAAC;CACtB,MAAM,gBAAgB;EACpB,IAAI,aAAa,IAAI,SAAS;GAC5B,IAAI,QAAQ,kBAAkB,UAAU,OAAO,UAAU,OAAO,UAAU,KAAK;EACjF;CACF,GAAG,CAAC,WAAW,OAAO,WAAW,GAAG,CAAC;CACrC,MAAM,gBAAgB;EACpB,IAAI,CAAC,MAAM,UAAU;EACrB,OAAO,kBAAkB,IAAI;GAC3B,sBAAsB,IAAI,SAAS,MAAM;GACzC,aAAa,IAAI,SAAS,MAAM;EAClC,CAAC;CACH,GAAG,CAAC,IAAI,QAAQ,CAAC;CACjB,MAAM,iBAAiB,MAAM;EAC3B,IAAI,EAAE,QAAQ,WAAW,iBAAiB;GACxC,gBAAgB,EACd,aAAa,EAAE,MAAM,EAAE,OAAO,MAAM,EACtC,CAAC;EACH;EACA,KAAK,YAAY,CAAC;CACpB;CACA,MAAM,gBAAgB,MAAM;EAC1B,eAAe,EAAE,OAAO,KAAK;EAC7B,KAAK,WAAW,CAAC;CACnB;CACA,MAAM,aAAa;EACjB,GAAG;EACH;EACA;EACA;EACA;EACA;EACA,WAAW,kBAAkB,gBAAgB,KAAK;EAClD,UAAU,eAAe,eAAe,KAAK;CAC/C;CACA,OAAuB,oBAAI,aAAa;EAAE,KAAK;EAAa,GAAG;CAAW,CAAC;AAC7E,CACF"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
+
get: () => from[key],
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
25
|
+
value: mod,
|
|
26
|
+
enumerable: true
|
|
27
|
+
}) : target, mod));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var Input_native_exports = {};
|
|
30
|
+
__export(Input_native_exports, { Input: () => Input });
|
|
31
|
+
module.exports = __toCommonJS(Input_native_exports);
|
|
32
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
33
|
+
var import_react = __toESM(require("react"), 1);
|
|
34
|
+
var import_react_native = require("react-native");
|
|
35
|
+
var import_core = require("@tamagui/core");
|
|
36
|
+
var import_focusable = require("@tamagui/focusable");
|
|
37
|
+
var import_element = require("@tamagui/element");
|
|
38
|
+
var import_shared = require("./shared.native.js");
|
|
39
|
+
var StyledInput = (0, import_core.styled)(import_react_native.TextInput, import_shared.styledBody[0], import_shared.styledBody[1]).resolve(import_shared.resolveMultilineInputSize);
|
|
40
|
+
var Input = (0, import_core.createStyledHOC)(StyledInput, function(props, forwardedRef) {
|
|
41
|
+
var { type, disabled, readOnly, id, rows, autoComplete, enterKeyHint, onChange, onInput, onKeyDown, onChangeText, onSubmitEditing, onSelectionChange, onEndEditing, onContentSizeChange, onScroll, onKeyPress: onKeyPressProp, selection, keyboardAppearance, returnKeyType: returnKeyTypeProp, submitBehavior, blurOnSubmit, caretHidden, contextMenuHidden, selectTextOnFocus, secureTextEntry: secureTextEntryProp, maxFontSizeMultiplier, allowFontScaling, multiline: multilineProp, keyboardType: keyboardTypeProp, inputMode: inputModeProp, autoCapitalize: autoCapitalizeProp, autoCorrect: autoCorrectProp, autoFocusNative, textContentType, clearButtonMode, clearTextOnFocus, enablesReturnKeyAutomatically, dataDetectorTypes, scrollEnabled, passwordRules, rejectResponderTermination, spellCheck, lineBreakStrategyIOS, lineBreakModeIOS, smartInsertDelete, inputAccessoryViewID, inputAccessoryViewButtonLabel, disableKeyboardShortcuts, importantForAutofill, disableFullscreenUI, inlineImageLeft, inlineImagePadding, returnKeyLabel, textBreakStrategy, textAlignVertical, verticalAlign, showSoftInputOnFocus, numberOfLines: numberOfLinesProp, dirname, min, max, minLength, multiple, name, pattern, required, step, render, caretColor, cursorColor: cursorColorProp, selectionColor: selectionColorProp, ...rest } = props;
|
|
42
|
+
var { ref, composedRef } = (0, import_element.useNativeInputRef)(forwardedRef);
|
|
43
|
+
var secureTextEntry = secureTextEntryProp !== null && secureTextEntryProp !== void 0 ? secureTextEntryProp : false;
|
|
44
|
+
var keyboardType = keyboardTypeProp !== null && keyboardTypeProp !== void 0 ? keyboardTypeProp : "default";
|
|
45
|
+
var inputMode = inputModeProp;
|
|
46
|
+
if (!secureTextEntryProp && !keyboardTypeProp && !inputModeProp) {
|
|
47
|
+
switch (type) {
|
|
48
|
+
case "password":
|
|
49
|
+
secureTextEntry = true;
|
|
50
|
+
break;
|
|
51
|
+
case "email":
|
|
52
|
+
keyboardType = "email-address";
|
|
53
|
+
inputMode = "email";
|
|
54
|
+
break;
|
|
55
|
+
case "tel":
|
|
56
|
+
keyboardType = "phone-pad";
|
|
57
|
+
inputMode = "tel";
|
|
58
|
+
break;
|
|
59
|
+
case "number":
|
|
60
|
+
keyboardType = "numeric";
|
|
61
|
+
inputMode = "numeric";
|
|
62
|
+
break;
|
|
63
|
+
case "url":
|
|
64
|
+
keyboardType = "url";
|
|
65
|
+
inputMode = "url";
|
|
66
|
+
break;
|
|
67
|
+
case "search":
|
|
68
|
+
inputMode = "search";
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
var returnKeyType = returnKeyTypeProp;
|
|
73
|
+
if (!returnKeyType && enterKeyHint) {
|
|
74
|
+
switch (enterKeyHint) {
|
|
75
|
+
case "done":
|
|
76
|
+
returnKeyType = "done";
|
|
77
|
+
break;
|
|
78
|
+
case "go":
|
|
79
|
+
returnKeyType = "go";
|
|
80
|
+
break;
|
|
81
|
+
case "next":
|
|
82
|
+
returnKeyType = "next";
|
|
83
|
+
break;
|
|
84
|
+
case "search":
|
|
85
|
+
returnKeyType = "search";
|
|
86
|
+
break;
|
|
87
|
+
case "send":
|
|
88
|
+
returnKeyType = "send";
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
var multiline = multilineProp !== null && multilineProp !== void 0 ? multilineProp : render === "textarea" || rows && rows > 1;
|
|
93
|
+
var numberOfLines = numberOfLinesProp !== null && numberOfLinesProp !== void 0 ? numberOfLinesProp : rows;
|
|
94
|
+
var autoCorrect = autoCorrectProp === "on" ? true : autoCorrectProp === "off" ? false : autoCorrectProp;
|
|
95
|
+
var autoCapitalize = autoCapitalizeProp === "on" ? "sentences" : autoCapitalizeProp === "off" ? "none" : autoCapitalizeProp;
|
|
96
|
+
import_react.default.useEffect(function() {
|
|
97
|
+
if (!id || disabled) return;
|
|
98
|
+
return (0, import_focusable.registerFocusable)(id, {
|
|
99
|
+
focusAndSelect: function() {
|
|
100
|
+
var _ref_current;
|
|
101
|
+
return (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.focus();
|
|
102
|
+
},
|
|
103
|
+
focus: function() {
|
|
104
|
+
var _ref_current;
|
|
105
|
+
return (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.focus();
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}, [id, disabled]);
|
|
109
|
+
var handleChangeText = function(text) {
|
|
110
|
+
onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(text);
|
|
111
|
+
if (onChange) {
|
|
112
|
+
onChange({
|
|
113
|
+
target: { value: text },
|
|
114
|
+
type: "change"
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
if (onInput) {
|
|
118
|
+
onInput({
|
|
119
|
+
target: { value: text },
|
|
120
|
+
type: "input"
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
var handleKeyPress = function(e) {
|
|
125
|
+
onKeyPressProp === null || onKeyPressProp === void 0 ? void 0 : onKeyPressProp(e);
|
|
126
|
+
if (onKeyDown) {
|
|
127
|
+
var { key } = e.nativeEvent;
|
|
128
|
+
if (key === "Backspace" || key === "Enter" || key.length === 1) {
|
|
129
|
+
onKeyDown({
|
|
130
|
+
key,
|
|
131
|
+
type: "keydown"
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
var handleSubmitEditing = function(e) {
|
|
137
|
+
if (onKeyDown) {
|
|
138
|
+
onKeyDown({
|
|
139
|
+
key: "Enter",
|
|
140
|
+
type: "keydown"
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
onSubmitEditing === null || onSubmitEditing === void 0 ? void 0 : onSubmitEditing(e);
|
|
144
|
+
};
|
|
145
|
+
var handleSelectionChange = function(e) {
|
|
146
|
+
onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(e);
|
|
147
|
+
};
|
|
148
|
+
var finalProps = {
|
|
149
|
+
...rest,
|
|
150
|
+
editable: !disabled && !readOnly,
|
|
151
|
+
secureTextEntry,
|
|
152
|
+
keyboardType,
|
|
153
|
+
keyboardAppearance,
|
|
154
|
+
inputMode,
|
|
155
|
+
returnKeyType,
|
|
156
|
+
multiline,
|
|
157
|
+
numberOfLines,
|
|
158
|
+
selection,
|
|
159
|
+
autoComplete,
|
|
160
|
+
autoFocus: autoFocusNative,
|
|
161
|
+
onChangeText: handleChangeText,
|
|
162
|
+
onKeyPress: onKeyPressProp || onKeyDown ? handleKeyPress : void 0,
|
|
163
|
+
onSubmitEditing: onKeyDown || onSubmitEditing ? handleSubmitEditing : void 0,
|
|
164
|
+
onSelectionChange: onSelectionChange ? handleSelectionChange : void 0,
|
|
165
|
+
onEndEditing,
|
|
166
|
+
onContentSizeChange,
|
|
167
|
+
onScroll,
|
|
168
|
+
submitBehavior,
|
|
169
|
+
blurOnSubmit,
|
|
170
|
+
caretHidden,
|
|
171
|
+
contextMenuHidden,
|
|
172
|
+
selectTextOnFocus,
|
|
173
|
+
maxFontSizeMultiplier,
|
|
174
|
+
allowFontScaling,
|
|
175
|
+
autoCapitalize,
|
|
176
|
+
autoCorrect,
|
|
177
|
+
textContentType,
|
|
178
|
+
clearButtonMode,
|
|
179
|
+
clearTextOnFocus,
|
|
180
|
+
enablesReturnKeyAutomatically,
|
|
181
|
+
dataDetectorTypes,
|
|
182
|
+
scrollEnabled,
|
|
183
|
+
passwordRules,
|
|
184
|
+
rejectResponderTermination,
|
|
185
|
+
spellCheck,
|
|
186
|
+
lineBreakStrategyIOS,
|
|
187
|
+
lineBreakModeIOS,
|
|
188
|
+
smartInsertDelete,
|
|
189
|
+
inputAccessoryViewID,
|
|
190
|
+
inputAccessoryViewButtonLabel,
|
|
191
|
+
disableKeyboardShortcuts,
|
|
192
|
+
importantForAutofill,
|
|
193
|
+
disableFullscreenUI,
|
|
194
|
+
inlineImageLeft,
|
|
195
|
+
inlineImagePadding,
|
|
196
|
+
returnKeyLabel,
|
|
197
|
+
textBreakStrategy,
|
|
198
|
+
textAlignVertical,
|
|
199
|
+
verticalAlign,
|
|
200
|
+
showSoftInputOnFocus,
|
|
201
|
+
cursorColor: cursorColorProp !== null && cursorColorProp !== void 0 ? cursorColorProp : caretColor,
|
|
202
|
+
selectionColor: selectionColorProp !== null && selectionColorProp !== void 0 ? selectionColorProp : caretColor
|
|
203
|
+
};
|
|
204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledInput, {
|
|
205
|
+
ref: composedRef,
|
|
206
|
+
...finalProps
|
|
207
|
+
});
|
|
208
|
+
});
|