@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.
Files changed (169) hide show
  1. package/dist/cjs/Input.cjs +72 -163
  2. package/dist/cjs/Input.native.cjs +208 -0
  3. package/dist/cjs/Input.native.js +186 -283
  4. package/dist/cjs/Input.native.js.map +1 -1
  5. package/dist/cjs/InputNativeProps.cjs +9 -11
  6. package/dist/cjs/InputNativeProps.native.cjs +18 -0
  7. package/dist/cjs/InputNativeProps.native.js +9 -10
  8. package/dist/cjs/InputNativeProps.native.js.map +1 -1
  9. package/dist/cjs/TextArea.cjs +23 -39
  10. package/dist/cjs/TextArea.native.cjs +38 -0
  11. package/dist/cjs/TextArea.native.js +23 -38
  12. package/dist/cjs/TextArea.native.js.map +1 -1
  13. package/dist/cjs/index.cjs +15 -17
  14. package/dist/cjs/index.native.cjs +32 -0
  15. package/dist/cjs/index.native.js +15 -16
  16. package/dist/cjs/index.native.js.map +1 -1
  17. package/dist/cjs/shared.cjs +74 -124
  18. package/dist/cjs/shared.native.cjs +101 -0
  19. package/dist/cjs/shared.native.js +80 -129
  20. package/dist/cjs/shared.native.js.map +1 -1
  21. package/dist/cjs/types.cjs +9 -11
  22. package/dist/cjs/types.native.cjs +18 -0
  23. package/dist/cjs/types.native.js +9 -10
  24. package/dist/cjs/types.native.js.map +1 -1
  25. package/dist/esm/Input.mjs +59 -139
  26. package/dist/esm/Input.mjs.map +1 -1
  27. package/dist/esm/Input.native.js +174 -261
  28. package/dist/esm/Input.native.js.map +1 -1
  29. package/dist/esm/InputNativeProps.mjs +0 -2
  30. package/dist/esm/InputNativeProps.native.js +0 -2
  31. package/dist/esm/TextArea.mjs +12 -22
  32. package/dist/esm/TextArea.mjs.map +1 -1
  33. package/dist/esm/TextArea.native.js +12 -22
  34. package/dist/esm/TextArea.native.js.map +1 -1
  35. package/dist/esm/index.js +6 -4
  36. package/dist/esm/index.mjs +6 -4
  37. package/dist/esm/index.native.js +6 -4
  38. package/dist/esm/shared.mjs +59 -107
  39. package/dist/esm/shared.mjs.map +1 -1
  40. package/dist/esm/shared.native.js +64 -112
  41. package/dist/esm/shared.native.js.map +1 -1
  42. package/dist/esm/types.mjs +0 -2
  43. package/dist/esm/types.native.js +0 -2
  44. package/dist/jsx/Input.mjs +59 -139
  45. package/dist/jsx/Input.mjs.map +1 -1
  46. package/dist/jsx/Input.native.cjs +208 -0
  47. package/dist/jsx/Input.native.js +186 -283
  48. package/dist/jsx/Input.native.js.map +1 -1
  49. package/dist/jsx/InputNativeProps.mjs +0 -2
  50. package/dist/jsx/InputNativeProps.native.cjs +18 -0
  51. package/dist/jsx/InputNativeProps.native.js +9 -10
  52. package/dist/jsx/InputNativeProps.native.js.map +1 -1
  53. package/dist/jsx/TextArea.mjs +12 -22
  54. package/dist/jsx/TextArea.mjs.map +1 -1
  55. package/dist/jsx/TextArea.native.cjs +38 -0
  56. package/dist/jsx/TextArea.native.js +23 -38
  57. package/dist/jsx/TextArea.native.js.map +1 -1
  58. package/dist/jsx/index.js +6 -4
  59. package/dist/jsx/index.mjs +6 -4
  60. package/dist/jsx/index.native.cjs +32 -0
  61. package/dist/jsx/index.native.js +15 -16
  62. package/dist/jsx/index.native.js.map +1 -1
  63. package/dist/jsx/shared.mjs +59 -107
  64. package/dist/jsx/shared.mjs.map +1 -1
  65. package/dist/jsx/shared.native.cjs +101 -0
  66. package/dist/jsx/shared.native.js +80 -129
  67. package/dist/jsx/shared.native.js.map +1 -1
  68. package/dist/jsx/types.mjs +0 -2
  69. package/dist/jsx/types.native.cjs +18 -0
  70. package/dist/jsx/types.native.js +9 -10
  71. package/dist/jsx/types.native.js.map +1 -1
  72. package/package.json +17 -17
  73. package/src/Input.native.tsx +267 -242
  74. package/src/Input.tsx +150 -154
  75. package/src/TextArea.tsx +9 -18
  76. package/src/shared.tsx +56 -109
  77. package/src/types.ts +2 -2
  78. package/types/Input.d.ts +32 -50
  79. package/types/Input.d.ts.map +1 -1
  80. package/types/Input.native.d.ts +32 -50
  81. package/types/Input.native.d.ts.map +1 -1
  82. package/types/TextArea.d.ts +16 -34
  83. package/types/TextArea.d.ts.map +1 -1
  84. package/types/shared.d.ts +38 -109
  85. package/types/shared.d.ts.map +1 -1
  86. package/types/types.d.ts +2 -2
  87. package/types/types.d.ts.map +1 -1
  88. package/dist/cjs/inputTypes.test-d.cjs +0 -128
  89. package/dist/cjs/inputTypes.test-d.native.js +0 -131
  90. package/dist/cjs/inputTypes.test-d.native.js.map +0 -1
  91. package/dist/cjs/v1/Input.cjs +0 -200
  92. package/dist/cjs/v1/Input.native.js +0 -183
  93. package/dist/cjs/v1/Input.native.js.map +0 -1
  94. package/dist/cjs/v1/TextArea.cjs +0 -52
  95. package/dist/cjs/v1/TextArea.native.js +0 -55
  96. package/dist/cjs/v1/TextArea.native.js.map +0 -1
  97. package/dist/cjs/v1/index.cjs +0 -21
  98. package/dist/cjs/v1/index.native.js +0 -24
  99. package/dist/cjs/v1/index.native.js.map +0 -1
  100. package/dist/cjs/v1/types.cjs +0 -18
  101. package/dist/cjs/v1/types.native.js +0 -21
  102. package/dist/cjs/v1/types.native.js.map +0 -1
  103. package/dist/esm/InputNativeProps.mjs.map +0 -1
  104. package/dist/esm/InputNativeProps.native.js.map +0 -1
  105. package/dist/esm/index.js.map +0 -1
  106. package/dist/esm/index.mjs.map +0 -1
  107. package/dist/esm/index.native.js.map +0 -1
  108. package/dist/esm/inputTypes.test-d.mjs +0 -129
  109. package/dist/esm/inputTypes.test-d.mjs.map +0 -1
  110. package/dist/esm/inputTypes.test-d.native.js +0 -129
  111. package/dist/esm/inputTypes.test-d.native.js.map +0 -1
  112. package/dist/esm/types.mjs.map +0 -1
  113. package/dist/esm/types.native.js.map +0 -1
  114. package/dist/esm/v1/Input.mjs +0 -164
  115. package/dist/esm/v1/Input.mjs.map +0 -1
  116. package/dist/esm/v1/Input.native.js +0 -144
  117. package/dist/esm/v1/Input.native.js.map +0 -1
  118. package/dist/esm/v1/TextArea.mjs +0 -27
  119. package/dist/esm/v1/TextArea.mjs.map +0 -1
  120. package/dist/esm/v1/TextArea.native.js +0 -27
  121. package/dist/esm/v1/TextArea.native.js.map +0 -1
  122. package/dist/esm/v1/index.mjs +0 -3
  123. package/dist/esm/v1/index.mjs.map +0 -1
  124. package/dist/esm/v1/index.native.js +0 -3
  125. package/dist/esm/v1/index.native.js.map +0 -1
  126. package/dist/esm/v1/types.mjs +0 -2
  127. package/dist/esm/v1/types.mjs.map +0 -1
  128. package/dist/esm/v1/types.native.js +0 -2
  129. package/dist/esm/v1/types.native.js.map +0 -1
  130. package/dist/jsx/InputNativeProps.mjs.map +0 -1
  131. package/dist/jsx/index.js.map +0 -1
  132. package/dist/jsx/index.mjs.map +0 -1
  133. package/dist/jsx/inputTypes.test-d.mjs +0 -129
  134. package/dist/jsx/inputTypes.test-d.mjs.map +0 -1
  135. package/dist/jsx/inputTypes.test-d.native.js +0 -131
  136. package/dist/jsx/inputTypes.test-d.native.js.map +0 -1
  137. package/dist/jsx/types.mjs.map +0 -1
  138. package/dist/jsx/v1/Input.mjs +0 -164
  139. package/dist/jsx/v1/Input.mjs.map +0 -1
  140. package/dist/jsx/v1/Input.native.js +0 -183
  141. package/dist/jsx/v1/Input.native.js.map +0 -1
  142. package/dist/jsx/v1/TextArea.mjs +0 -27
  143. package/dist/jsx/v1/TextArea.mjs.map +0 -1
  144. package/dist/jsx/v1/TextArea.native.js +0 -55
  145. package/dist/jsx/v1/TextArea.native.js.map +0 -1
  146. package/dist/jsx/v1/index.mjs +0 -3
  147. package/dist/jsx/v1/index.mjs.map +0 -1
  148. package/dist/jsx/v1/index.native.js +0 -24
  149. package/dist/jsx/v1/index.native.js.map +0 -1
  150. package/dist/jsx/v1/types.mjs +0 -2
  151. package/dist/jsx/v1/types.mjs.map +0 -1
  152. package/dist/jsx/v1/types.native.js +0 -21
  153. package/dist/jsx/v1/types.native.js.map +0 -1
  154. package/src/inputTypes.test-d.ts +0 -245
  155. package/src/v1/Input.native.tsx +0 -153
  156. package/src/v1/Input.tsx +0 -190
  157. package/src/v1/TextArea.tsx +0 -35
  158. package/src/v1/index.ts +0 -3
  159. package/src/v1/types.ts +0 -65
  160. package/types/v1/Input.d.ts +0 -64
  161. package/types/v1/Input.d.ts.map +0 -1
  162. package/types/v1/Input.native.d.ts +0 -63
  163. package/types/v1/Input.native.d.ts.map +0 -1
  164. package/types/v1/TextArea.d.ts +0 -41
  165. package/types/v1/TextArea.d.ts.map +0 -1
  166. package/types/v1/index.d.ts +0 -4
  167. package/types/v1/index.d.ts.map +0 -1
  168. package/types/v1/types.d.ts +0 -39
  169. package/types/v1/types.d.ts.map +0 -1
@@ -5,36 +5,27 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
12
  };
13
13
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
+ get: () => from[key],
17
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
+ });
19
+ }
20
+ return to;
21
21
  };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
- value: mod,
29
- enumerable: true
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
30
25
  }) : target, mod));
31
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: true
33
- }), mod);
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
27
  var Input_exports = {};
35
- __export(Input_exports, {
36
- Input: () => Input
37
- });
28
+ __export(Input_exports, { Input: () => Input });
38
29
  module.exports = __toCommonJS(Input_exports);
39
30
  var import_core = require("@tamagui/core");
40
31
  var import_focusable = require("@tamagui/focusable");
@@ -42,141 +33,59 @@ var import_element = require("@tamagui/element");
42
33
  var import_react = __toESM(require("react"), 1);
43
34
  var import_shared = require("./shared.cjs");
44
35
  var import_jsx_runtime = require("react/jsx-runtime");
45
- const StyledInput = (0, import_core.styled)(import_core.View, import_shared.styledBody[0], import_shared.styledBody[1]);
46
- const Input = StyledInput.styleable((props, _forwardedRef) => {
47
- const {
48
- disabled,
49
- id,
50
- onChangeText,
51
- onSubmitEditing,
52
- onSelectionChange,
53
- selection,
54
- placeholderTextColor,
55
- selectionColor,
56
- rows,
57
- // Native-only props (ignored on web)
58
- keyboardAppearance,
59
- returnKeyType,
60
- submitBehavior,
61
- blurOnSubmit,
62
- caretHidden,
63
- contextMenuHidden,
64
- selectTextOnFocus,
65
- secureTextEntry,
66
- maxFontSizeMultiplier,
67
- allowFontScaling,
68
- multiline,
69
- keyboardType,
70
- autoCapitalize: autoCapitalizeProp,
71
- autoCorrect: autoCorrectProp,
72
- autoFocusNative,
73
- textContentType,
74
- onEndEditing,
75
- onContentSizeChange,
76
- onScroll,
77
- onKeyPress,
78
- // iOS-only props (ignored on web)
79
- clearButtonMode,
80
- clearTextOnFocus,
81
- enablesReturnKeyAutomatically,
82
- dataDetectorTypes,
83
- scrollEnabled,
84
- passwordRules,
85
- rejectResponderTermination,
86
- spellCheck,
87
- lineBreakStrategyIOS,
88
- lineBreakModeIOS,
89
- smartInsertDelete,
90
- inputAccessoryViewID,
91
- inputAccessoryViewButtonLabel,
92
- disableKeyboardShortcuts,
93
- // Android-only props (ignored on web)
94
- cursorColor,
95
- selectionHandleColor,
96
- underlineColorAndroid,
97
- importantForAutofill,
98
- disableFullscreenUI,
99
- inlineImageLeft,
100
- inlineImagePadding,
101
- returnKeyLabel,
102
- textBreakStrategy,
103
- textAlignVertical,
104
- verticalAlign,
105
- showSoftInputOnFocus,
106
- numberOfLines,
107
- ...rest
108
- } = props;
109
- const {
110
- ref,
111
- composedRef
112
- } = (0, import_element.useWebRef)(_forwardedRef);
113
- const theme = (0, import_core.useTheme)();
114
- const autoCorrect = autoCorrectProp === true ? "on" : autoCorrectProp === false ? "off" : autoCorrectProp;
115
- const autoCapitalize = autoCapitalizeProp === "sentences" || autoCapitalizeProp === "words" ? "on" : autoCapitalizeProp === "none" || autoCapitalizeProp === "characters" ? "off" : autoCapitalizeProp;
116
- import_react.default.useEffect(() => {
117
- if (!onSelectionChange) return;
118
- const node = ref.current;
119
- if (!node) return;
120
- const handleSelectionChange = () => {
121
- onSelectionChange({
122
- nativeEvent: {
123
- selection: {
124
- start: node.selectionStart ?? 0,
125
- end: node.selectionEnd ?? 0
126
- }
127
- }
128
- });
129
- };
130
- node.addEventListener("select", handleSelectionChange);
131
- return () => node.removeEventListener("select", handleSelectionChange);
132
- }, [onSelectionChange]);
133
- import_react.default.useEffect(() => {
134
- if (selection && ref.current) {
135
- ref.current.setSelectionRange(selection.start, selection.end ?? selection.start);
136
- }
137
- }, [selection?.start, selection?.end]);
138
- import_react.default.useEffect(() => {
139
- if (!id || disabled) return;
140
- return (0, import_focusable.registerFocusable)(id, {
141
- focusAndSelect: () => ref.current?.focus(),
142
- focus: () => ref.current?.focus()
143
- });
144
- }, [id, disabled]);
145
- const handleKeyDown = e => {
146
- if (e.key === "Enter" && onSubmitEditing) {
147
- onSubmitEditing({
148
- nativeEvent: {
149
- text: e.target.value
150
- }
151
- });
152
- }
153
- rest.onKeyDown?.(e);
154
- };
155
- const handleChange = e => {
156
- onChangeText?.(e.target.value);
157
- rest.onChange?.(e);
158
- };
159
- const finalProps = {
160
- ...rest,
161
- disabled,
162
- id,
163
- rows,
164
- autoCorrect,
165
- autoCapitalize,
166
- onKeyDown: onSubmitEditing ? handleKeyDown : rest.onKeyDown,
167
- onChange: onChangeText ? handleChange : rest.onChange,
168
- style: {
169
- ...rest.style,
170
- ...(placeholderTextColor && {
171
- "--t_placeholderColor": theme[placeholderTextColor]?.variable || placeholderTextColor
172
- }),
173
- ...(selectionColor && {
174
- "--t_selectionColor": theme[selectionColor]?.variable || selectionColor
175
- })
176
- }
177
- };
178
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(StyledInput, {
179
- ref: composedRef,
180
- ...finalProps
181
- });
182
- });
36
+ const StyledInput = (0, import_core.styled)(import_core.View, import_shared.styledBody[0], import_shared.styledBody[1]).resolve(import_shared.resolveMultilineInputSize);
37
+ const Input = (0, import_core.createStyledHOC)(StyledInput, (props, _forwardedRef) => {
38
+ const { disabled, id, onChangeText, onSubmitEditing, onSelectionChange, selection, rows, keyboardAppearance, returnKeyType, submitBehavior, blurOnSubmit, caretHidden, contextMenuHidden, selectTextOnFocus, secureTextEntry, maxFontSizeMultiplier, allowFontScaling, multiline, keyboardType, autoCapitalize: autoCapitalizeProp, autoCorrect: autoCorrectProp, autoFocusNative, textContentType, onEndEditing, onContentSizeChange, onScroll, onKeyPress, clearButtonMode, clearTextOnFocus, enablesReturnKeyAutomatically, dataDetectorTypes, scrollEnabled, passwordRules, rejectResponderTermination, spellCheck, lineBreakStrategyIOS, lineBreakModeIOS, smartInsertDelete, inputAccessoryViewID, inputAccessoryViewButtonLabel, disableKeyboardShortcuts, underlineColorAndroid, importantForAutofill, disableFullscreenUI, inlineImageLeft, inlineImagePadding, returnKeyLabel, textBreakStrategy, textAlignVertical, verticalAlign, showSoftInputOnFocus, numberOfLines, ...rest } = props;
39
+ const { ref, composedRef } = (0, import_element.useWebRef)(_forwardedRef);
40
+ const autoCorrect = autoCorrectProp === true ? "on" : autoCorrectProp === false ? "off" : autoCorrectProp;
41
+ const autoCapitalize = autoCapitalizeProp === "sentences" || autoCapitalizeProp === "words" ? "on" : autoCapitalizeProp === "none" || autoCapitalizeProp === "characters" ? "off" : autoCapitalizeProp;
42
+ import_react.default.useEffect(() => {
43
+ if (!onSelectionChange) return;
44
+ const node = ref.current;
45
+ if (!node) return;
46
+ const handleSelectionChange = () => {
47
+ onSelectionChange({ nativeEvent: { selection: {
48
+ start: node.selectionStart ?? 0,
49
+ end: node.selectionEnd ?? 0
50
+ } } });
51
+ };
52
+ node.addEventListener("select", handleSelectionChange);
53
+ return () => node.removeEventListener("select", handleSelectionChange);
54
+ }, [onSelectionChange]);
55
+ import_react.default.useEffect(() => {
56
+ if (selection && ref.current) {
57
+ ref.current.setSelectionRange(selection.start, selection.end ?? selection.start);
58
+ }
59
+ }, [selection?.start, selection?.end]);
60
+ import_react.default.useEffect(() => {
61
+ if (!id || disabled) return;
62
+ return (0, import_focusable.registerFocusable)(id, {
63
+ focusAndSelect: () => ref.current?.focus(),
64
+ focus: () => ref.current?.focus()
65
+ });
66
+ }, [id, disabled]);
67
+ const handleKeyDown = (e) => {
68
+ if (e.key === "Enter" && onSubmitEditing) {
69
+ onSubmitEditing({ nativeEvent: { text: e.target.value } });
70
+ }
71
+ rest.onKeyDown?.(e);
72
+ };
73
+ const handleChange = (e) => {
74
+ onChangeText?.(e.target.value);
75
+ rest.onChange?.(e);
76
+ };
77
+ const finalProps = {
78
+ ...rest,
79
+ disabled,
80
+ id,
81
+ rows,
82
+ autoCorrect,
83
+ autoCapitalize,
84
+ onKeyDown: onSubmitEditing ? handleKeyDown : rest.onKeyDown,
85
+ onChange: onChangeText ? handleChange : rest.onChange
86
+ };
87
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledInput, {
88
+ ref: composedRef,
89
+ ...finalProps
90
+ });
91
+ });
@@ -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
+ });