@tamagui/input 2.7.7 → 3.0.0-beta.643.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 (168) hide show
  1. package/dist/cjs/Input.cjs +78 -162
  2. package/dist/cjs/Input.native.cjs +209 -0
  3. package/dist/cjs/Input.native.js +186 -282
  4. package/dist/cjs/Input.native.js.map +1 -1
  5. package/dist/cjs/InputNativeProps.cjs +10 -11
  6. package/dist/cjs/InputNativeProps.native.cjs +19 -0
  7. package/dist/cjs/InputNativeProps.native.js +10 -10
  8. package/dist/cjs/InputNativeProps.native.js.map +1 -1
  9. package/dist/cjs/TextArea.cjs +25 -38
  10. package/dist/cjs/TextArea.native.cjs +41 -0
  11. package/dist/cjs/TextArea.native.js +25 -37
  12. package/dist/cjs/TextArea.native.js.map +1 -1
  13. package/dist/cjs/index.cjs +16 -17
  14. package/dist/cjs/index.native.cjs +33 -0
  15. package/dist/cjs/index.native.js +16 -16
  16. package/dist/cjs/index.native.js.map +1 -1
  17. package/dist/cjs/shared.cjs +115 -122
  18. package/dist/cjs/shared.native.cjs +144 -0
  19. package/dist/cjs/shared.native.js +120 -126
  20. package/dist/cjs/shared.native.js.map +1 -1
  21. package/dist/cjs/types.cjs +10 -11
  22. package/dist/cjs/types.native.cjs +19 -0
  23. package/dist/cjs/types.native.js +10 -10
  24. package/dist/cjs/types.native.js.map +1 -1
  25. package/dist/esm/Input.mjs +63 -137
  26. package/dist/esm/Input.mjs.map +1 -1
  27. package/dist/esm/Input.native.js +172 -259
  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 -20
  32. package/dist/esm/TextArea.mjs.map +1 -1
  33. package/dist/esm/TextArea.native.js +12 -20
  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 +99 -104
  39. package/dist/esm/shared.mjs.map +1 -1
  40. package/dist/esm/shared.native.js +104 -109
  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 +63 -137
  45. package/dist/jsx/Input.mjs.map +1 -1
  46. package/dist/jsx/Input.native.cjs +209 -0
  47. package/dist/jsx/Input.native.js +186 -282
  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 +19 -0
  51. package/dist/jsx/InputNativeProps.native.js +10 -10
  52. package/dist/jsx/InputNativeProps.native.js.map +1 -1
  53. package/dist/jsx/TextArea.mjs +12 -20
  54. package/dist/jsx/TextArea.mjs.map +1 -1
  55. package/dist/jsx/TextArea.native.cjs +41 -0
  56. package/dist/jsx/TextArea.native.js +25 -37
  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 +33 -0
  61. package/dist/jsx/index.native.js +16 -16
  62. package/dist/jsx/index.native.js.map +1 -1
  63. package/dist/jsx/shared.mjs +99 -104
  64. package/dist/jsx/shared.mjs.map +1 -1
  65. package/dist/jsx/shared.native.cjs +144 -0
  66. package/dist/jsx/shared.native.js +120 -126
  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 +19 -0
  70. package/dist/jsx/types.native.js +10 -10
  71. package/dist/jsx/types.native.js.map +1 -1
  72. package/package.json +13 -15
  73. package/src/Input.native.tsx +263 -240
  74. package/src/Input.tsx +162 -152
  75. package/src/TextArea.tsx +6 -14
  76. package/src/shared.tsx +65 -70
  77. package/src/types.ts +1 -1
  78. package/types/Input.d.ts +57 -41
  79. package/types/Input.d.ts.map +1 -1
  80. package/types/Input.native.d.ts +57 -41
  81. package/types/Input.native.d.ts.map +1 -1
  82. package/types/TextArea.d.ts +172 -24
  83. package/types/TextArea.d.ts.map +1 -1
  84. package/types/shared.d.ts +14 -99
  85. package/types/shared.d.ts.map +1 -1
  86. package/types/types.d.ts +1 -1
  87. package/dist/cjs/inputTypes.test-d.cjs +0 -128
  88. package/dist/cjs/inputTypes.test-d.native.js +0 -131
  89. package/dist/cjs/inputTypes.test-d.native.js.map +0 -1
  90. package/dist/cjs/v1/Input.cjs +0 -200
  91. package/dist/cjs/v1/Input.native.js +0 -183
  92. package/dist/cjs/v1/Input.native.js.map +0 -1
  93. package/dist/cjs/v1/TextArea.cjs +0 -52
  94. package/dist/cjs/v1/TextArea.native.js +0 -55
  95. package/dist/cjs/v1/TextArea.native.js.map +0 -1
  96. package/dist/cjs/v1/index.cjs +0 -21
  97. package/dist/cjs/v1/index.native.js +0 -24
  98. package/dist/cjs/v1/index.native.js.map +0 -1
  99. package/dist/cjs/v1/types.cjs +0 -18
  100. package/dist/cjs/v1/types.native.js +0 -21
  101. package/dist/cjs/v1/types.native.js.map +0 -1
  102. package/dist/esm/InputNativeProps.mjs.map +0 -1
  103. package/dist/esm/InputNativeProps.native.js.map +0 -1
  104. package/dist/esm/index.js.map +0 -1
  105. package/dist/esm/index.mjs.map +0 -1
  106. package/dist/esm/index.native.js.map +0 -1
  107. package/dist/esm/inputTypes.test-d.mjs +0 -129
  108. package/dist/esm/inputTypes.test-d.mjs.map +0 -1
  109. package/dist/esm/inputTypes.test-d.native.js +0 -129
  110. package/dist/esm/inputTypes.test-d.native.js.map +0 -1
  111. package/dist/esm/types.mjs.map +0 -1
  112. package/dist/esm/types.native.js.map +0 -1
  113. package/dist/esm/v1/Input.mjs +0 -164
  114. package/dist/esm/v1/Input.mjs.map +0 -1
  115. package/dist/esm/v1/Input.native.js +0 -144
  116. package/dist/esm/v1/Input.native.js.map +0 -1
  117. package/dist/esm/v1/TextArea.mjs +0 -27
  118. package/dist/esm/v1/TextArea.mjs.map +0 -1
  119. package/dist/esm/v1/TextArea.native.js +0 -27
  120. package/dist/esm/v1/TextArea.native.js.map +0 -1
  121. package/dist/esm/v1/index.mjs +0 -3
  122. package/dist/esm/v1/index.mjs.map +0 -1
  123. package/dist/esm/v1/index.native.js +0 -3
  124. package/dist/esm/v1/index.native.js.map +0 -1
  125. package/dist/esm/v1/types.mjs +0 -2
  126. package/dist/esm/v1/types.mjs.map +0 -1
  127. package/dist/esm/v1/types.native.js +0 -2
  128. package/dist/esm/v1/types.native.js.map +0 -1
  129. package/dist/jsx/InputNativeProps.mjs.map +0 -1
  130. package/dist/jsx/index.js.map +0 -1
  131. package/dist/jsx/index.mjs.map +0 -1
  132. package/dist/jsx/inputTypes.test-d.mjs +0 -129
  133. package/dist/jsx/inputTypes.test-d.mjs.map +0 -1
  134. package/dist/jsx/inputTypes.test-d.native.js +0 -131
  135. package/dist/jsx/inputTypes.test-d.native.js.map +0 -1
  136. package/dist/jsx/types.mjs.map +0 -1
  137. package/dist/jsx/v1/Input.mjs +0 -164
  138. package/dist/jsx/v1/Input.mjs.map +0 -1
  139. package/dist/jsx/v1/Input.native.js +0 -183
  140. package/dist/jsx/v1/Input.native.js.map +0 -1
  141. package/dist/jsx/v1/TextArea.mjs +0 -27
  142. package/dist/jsx/v1/TextArea.mjs.map +0 -1
  143. package/dist/jsx/v1/TextArea.native.js +0 -55
  144. package/dist/jsx/v1/TextArea.native.js.map +0 -1
  145. package/dist/jsx/v1/index.mjs +0 -3
  146. package/dist/jsx/v1/index.mjs.map +0 -1
  147. package/dist/jsx/v1/index.native.js +0 -24
  148. package/dist/jsx/v1/index.native.js.map +0 -1
  149. package/dist/jsx/v1/types.mjs +0 -2
  150. package/dist/jsx/v1/types.mjs.map +0 -1
  151. package/dist/jsx/v1/types.native.js +0 -21
  152. package/dist/jsx/v1/types.native.js.map +0 -1
  153. package/src/inputTypes.test-d.ts +0 -245
  154. package/src/v1/Input.native.tsx +0 -153
  155. package/src/v1/Input.tsx +0 -190
  156. package/src/v1/TextArea.tsx +0 -35
  157. package/src/v1/index.ts +0 -3
  158. package/src/v1/types.ts +0 -65
  159. package/types/v1/Input.d.ts +0 -64
  160. package/types/v1/Input.d.ts.map +0 -1
  161. package/types/v1/Input.native.d.ts +0 -63
  162. package/types/v1/Input.native.d.ts.map +0 -1
  163. package/types/v1/TextArea.d.ts +0 -41
  164. package/types/v1/TextArea.d.ts.map +0 -1
  165. package/types/v1/index.d.ts +0 -4
  166. package/types/v1/index.d.ts.map +0 -1
  167. package/types/v1/types.d.ts +0 -39
  168. package/types/v1/types.d.ts.map +0 -1
@@ -1,146 +1,72 @@
1
- import { View, styled, useTheme } from "@tamagui/core";
1
+ import { View, createStyledHOC, styled, useTheme } from "@tamagui/core";
2
2
  import { registerFocusable } from "@tamagui/focusable";
3
3
  import { useWebRef } from "@tamagui/element";
4
4
  import React from "react";
5
5
  import { styledBody } from "./shared.mjs";
6
6
  import { jsx } from "react/jsx-runtime";
7
+
7
8
  const StyledInput = styled(View, styledBody[0], styledBody[1]);
8
- const Input = StyledInput.styleable((props, _forwardedRef) => {
9
- const {
10
- disabled,
11
- id,
12
- onChangeText,
13
- onSubmitEditing,
14
- onSelectionChange,
15
- selection,
16
- placeholderTextColor,
17
- selectionColor,
18
- rows,
19
- // Native-only props (ignored on web)
20
- keyboardAppearance,
21
- returnKeyType,
22
- submitBehavior,
23
- blurOnSubmit,
24
- caretHidden,
25
- contextMenuHidden,
26
- selectTextOnFocus,
27
- secureTextEntry,
28
- maxFontSizeMultiplier,
29
- allowFontScaling,
30
- multiline,
31
- keyboardType,
32
- autoCapitalize: autoCapitalizeProp,
33
- autoCorrect: autoCorrectProp,
34
- autoFocusNative,
35
- textContentType,
36
- onEndEditing,
37
- onContentSizeChange,
38
- onScroll,
39
- onKeyPress,
40
- // iOS-only props (ignored on web)
41
- clearButtonMode,
42
- clearTextOnFocus,
43
- enablesReturnKeyAutomatically,
44
- dataDetectorTypes,
45
- scrollEnabled,
46
- passwordRules,
47
- rejectResponderTermination,
48
- spellCheck,
49
- lineBreakStrategyIOS,
50
- lineBreakModeIOS,
51
- smartInsertDelete,
52
- inputAccessoryViewID,
53
- inputAccessoryViewButtonLabel,
54
- disableKeyboardShortcuts,
55
- // Android-only props (ignored on web)
56
- cursorColor,
57
- selectionHandleColor,
58
- underlineColorAndroid,
59
- importantForAutofill,
60
- disableFullscreenUI,
61
- inlineImageLeft,
62
- inlineImagePadding,
63
- returnKeyLabel,
64
- textBreakStrategy,
65
- textAlignVertical,
66
- verticalAlign,
67
- showSoftInputOnFocus,
68
- numberOfLines,
69
- ...rest
70
- } = props;
71
- const {
72
- ref,
73
- composedRef
74
- } = useWebRef(_forwardedRef);
75
- const theme = useTheme();
76
- const autoCorrect = autoCorrectProp === true ? "on" : autoCorrectProp === false ? "off" : autoCorrectProp;
77
- const autoCapitalize = autoCapitalizeProp === "sentences" || autoCapitalizeProp === "words" ? "on" : autoCapitalizeProp === "none" || autoCapitalizeProp === "characters" ? "off" : autoCapitalizeProp;
78
- React.useEffect(() => {
79
- if (!onSelectionChange) return;
80
- const node = ref.current;
81
- if (!node) return;
82
- const handleSelectionChange = () => {
83
- onSelectionChange({
84
- nativeEvent: {
85
- selection: {
86
- start: node.selectionStart ?? 0,
87
- end: node.selectionEnd ?? 0
88
- }
89
- }
90
- });
91
- };
92
- node.addEventListener("select", handleSelectionChange);
93
- return () => node.removeEventListener("select", handleSelectionChange);
94
- }, [onSelectionChange]);
95
- React.useEffect(() => {
96
- if (selection && ref.current) {
97
- ref.current.setSelectionRange(selection.start, selection.end ?? selection.start);
98
- }
99
- }, [selection?.start, selection?.end]);
100
- React.useEffect(() => {
101
- if (!id || disabled) return;
102
- return registerFocusable(id, {
103
- focusAndSelect: () => ref.current?.focus(),
104
- focus: () => ref.current?.focus()
105
- });
106
- }, [id, disabled]);
107
- const handleKeyDown = e => {
108
- if (e.key === "Enter" && onSubmitEditing) {
109
- onSubmitEditing({
110
- nativeEvent: {
111
- text: e.target.value
112
- }
113
- });
114
- }
115
- rest.onKeyDown?.(e);
116
- };
117
- const handleChange = e => {
118
- onChangeText?.(e.target.value);
119
- rest.onChange?.(e);
120
- };
121
- const finalProps = {
122
- ...rest,
123
- disabled,
124
- id,
125
- rows,
126
- autoCorrect,
127
- autoCapitalize,
128
- onKeyDown: onSubmitEditing ? handleKeyDown : rest.onKeyDown,
129
- onChange: onChangeText ? handleChange : rest.onChange,
130
- style: {
131
- ...rest.style,
132
- ...(placeholderTextColor && {
133
- "--t_placeholderColor": theme[placeholderTextColor]?.variable || placeholderTextColor
134
- }),
135
- ...(selectionColor && {
136
- "--t_selectionColor": theme[selectionColor]?.variable || selectionColor
137
- })
138
- }
139
- };
140
- return /* @__PURE__ */jsx(StyledInput, {
141
- ref: composedRef,
142
- ...finalProps
143
- });
9
+ const Input = createStyledHOC(StyledInput, (props, _forwardedRef) => {
10
+ const { disabled, id, onChangeText, onSubmitEditing, onSelectionChange, selection, placeholderTextColor, selectionColor, 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, cursorColor, selectionHandleColor, underlineColorAndroid, importantForAutofill, disableFullscreenUI, inlineImageLeft, inlineImagePadding, returnKeyLabel, textBreakStrategy, textAlignVertical, verticalAlign, showSoftInputOnFocus, numberOfLines, ...rest } = props;
11
+ const { ref, composedRef } = useWebRef(_forwardedRef);
12
+ const theme = useTheme();
13
+ const autoCorrect = autoCorrectProp === true ? "on" : autoCorrectProp === false ? "off" : autoCorrectProp;
14
+ const autoCapitalize = autoCapitalizeProp === "sentences" || autoCapitalizeProp === "words" ? "on" : autoCapitalizeProp === "none" || autoCapitalizeProp === "characters" ? "off" : autoCapitalizeProp;
15
+ React.useEffect(() => {
16
+ if (!onSelectionChange) return;
17
+ const node = ref.current;
18
+ if (!node) return;
19
+ const handleSelectionChange = () => {
20
+ onSelectionChange({ nativeEvent: { selection: {
21
+ start: node.selectionStart ?? 0,
22
+ end: node.selectionEnd ?? 0
23
+ } } });
24
+ };
25
+ node.addEventListener("select", handleSelectionChange);
26
+ return () => node.removeEventListener("select", handleSelectionChange);
27
+ }, [onSelectionChange]);
28
+ React.useEffect(() => {
29
+ if (selection && ref.current) {
30
+ ref.current.setSelectionRange(selection.start, selection.end ?? selection.start);
31
+ }
32
+ }, [selection?.start, selection?.end]);
33
+ React.useEffect(() => {
34
+ if (!id || disabled) return;
35
+ return registerFocusable(id, {
36
+ focusAndSelect: () => ref.current?.focus(),
37
+ focus: () => ref.current?.focus()
38
+ });
39
+ }, [id, disabled]);
40
+ const handleKeyDown = (e) => {
41
+ if (e.key === "Enter" && onSubmitEditing) {
42
+ onSubmitEditing({ nativeEvent: { text: e.target.value } });
43
+ }
44
+ rest.onKeyDown?.(e);
45
+ };
46
+ const handleChange = (e) => {
47
+ onChangeText?.(e.target.value);
48
+ rest.onChange?.(e);
49
+ };
50
+ const finalProps = {
51
+ ...rest,
52
+ disabled,
53
+ id,
54
+ rows,
55
+ autoCorrect,
56
+ autoCapitalize,
57
+ onKeyDown: onSubmitEditing ? handleKeyDown : rest.onKeyDown,
58
+ onChange: onChangeText ? handleChange : rest.onChange,
59
+ style: {
60
+ ...rest.style,
61
+ ...placeholderTextColor && { "--t_placeholderColor": theme[placeholderTextColor]?.variable || placeholderTextColor },
62
+ ...selectionColor && { "--t_selectionColor": theme[selectionColor]?.variable || selectionColor }
63
+ }
64
+ };
65
+ return /* @__PURE__ */ jsx(StyledInput, {
66
+ ref: composedRef,
67
+ ...finalProps
68
+ });
144
69
  });
70
+
145
71
  export { Input };
146
72
  //# sourceMappingURL=Input.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["View","styled","useTheme","registerFocusable","useWebRef","React","styledBody","jsx","StyledInput","Input","styleable","props","_forwardedRef","disabled","id","onChangeText","onSubmitEditing","onSelectionChange","selection","placeholderTextColor","selectionColor","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","cursorColor","selectionHandleColor","underlineColorAndroid","importantForAutofill","disableFullscreenUI","inlineImageLeft","inlineImagePadding","returnKeyLabel","textBreakStrategy","textAlignVertical","verticalAlign","showSoftInputOnFocus","numberOfLines","rest","ref","composedRef","theme","useEffect","node","current","handleSelectionChange","nativeEvent","start","selectionStart","end","selectionEnd","addEventListener","removeEventListener","setSelectionRange","focusAndSelect","focus","handleKeyDown","e","key","text","target","value","onKeyDown","handleChange","onChange","finalProps","style","variable"],"sources":["../../src/Input.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAAwBA,IAAA,EAAMC,MAAA,EAAQC,QAAA,QAAgB;AACtD,SAASC,iBAAA,QAAyB;AAClC,SAASC,SAAA,QAAiB;AAC1B,OAAOC,KAAA,MAAW;AAClB,SAASC,UAAA,QAAkB;AAqKlB,SAAAC,GAAA;AAlKT,MAAMC,WAAA,GAAcP,MAAA,CAAOD,IAAA,EAAMM,UAAA,CAA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C;IAClE,IAAIA,CAAA,CAAEC,GAAA,KAAQ,WAAW3E,eAAA,EAAiB;MACxCA,eAAA,CAAgB;QACd+D,WAAA,EAAa;UAAEa,IAAA,EAAOF,CAAA,CAAEG,MAAA,CAA4BC;QAAM;MAC5D,CAAC;IACH;IACAvB,IAAA,CAAKwB,SAAA,GAAYL,CAAC;EACpB;EAGA,MAAMM,YAAA,GAAgBN,CAAA,IAA2C;IAC/D3E,YAAA,GAAe2E,CAAA,CAAEG,MAAA,CAAOC,KAAK;IAC7BvB,IAAA,CAAK0B,QAAA,GAAWP,CAAC;EACnB;EAEA,MAAMQ,UAAA,GAAa;IACjB,GAAG3B,IAAA;IACH1D,QAAA;IACAC,EAAA;IACAO,IAAA;IACAe,WAAA;IACAF,cAAA;IACA6D,SAAA,EAAW/E,eAAA,GAAkByE,aAAA,GAAgBlB,IAAA,CAAKwB,SAAA;IAClDE,QAAA,EAAUlF,YAAA,GAAeiF,YAAA,GAAezB,IAAA,CAAK0B,QAAA;IAC7CE,KAAA,EAAO;MACL,GAAI5B,IAAA,CAAK4B,KAAA;MACT,IAAIhF,oBAAA,IAAwB;QAC1B,wBACEuD,KAAA,CAAMvD,oBAAoB,GAAGiF,QAAA,IAAYjF;MAC7C;MACA,IAAIC,cAAA,IAAkB;QACpB,sBAAsBsD,KAAA,CAAMtD,cAAc,GAAGgF,QAAA,IAAYhF;MAC3D;IACF;EACF;EAEA,OAAO,eAAAb,GAAA,CAACC,WAAA;IAAYgE,GAAA,EAAKC,WAAA;IAAc,GAAGyB;EAAA,CAAY;AACxD,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Input.js","names":[],"sources":["jsx/Input.js"],"sourcesContent":["import { createStyledHOC, View, styled, useTheme } from \"@tamagui/core\";\nimport { registerFocusable } from \"@tamagui/focusable\";\nimport { useWebRef } from \"@tamagui/element\";\nimport React from \"react\";\nimport { styledBody } from \"./shared\";\nimport { jsx } from \"react/jsx-runtime\";\nconst StyledInput = styled(View, styledBody[0], styledBody[1]);\nconst Input = createStyledHOC(\n StyledInput,\n (props, _forwardedRef) => {\n const {\n disabled,\n id,\n onChangeText,\n onSubmitEditing,\n onSelectionChange,\n selection,\n placeholderTextColor,\n selectionColor,\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 cursorColor,\n selectionHandleColor,\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 theme = useTheme();\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 style: {\n ...rest.style,\n ...placeholderTextColor && {\n \"--t_placeholderColor\": theme[placeholderTextColor]?.variable || placeholderTextColor\n },\n ...selectionColor && {\n \"--t_selectionColor\": theme[selectionColor]?.variable || selectionColor\n }\n }\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;AAC7D,MAAM,QAAQ,gBACZ,cACC,OAAO,kBAAkB;CACxB,MAAM,EACJ,UACA,IACA,cACA,iBACA,mBACA,WACA,sBACA,gBACA,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,0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AAK;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;EAC7C,OAAO;GACL,GAAG,KAAK;GACR,GAAG,wBAAwB,EACzB,wBAAwB,MAAM,uBAAuB,YAAY,qBACnE;GACA,GAAG,kBAAkB,EACnB,sBAAsB,MAAM,iBAAiB,YAAY,eAC3D;EACF;CACF;CACA,OAAuB,oBAAI,aAAa;EAAE,KAAK;EAAa,GAAG;CAAW,CAAC;AAC7E,CACF"}
@@ -0,0 +1,209 @@
1
+ "use strict";
2
+
3
+
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: () => from[key],
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ return to;
24
+ };
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: true
28
+ }) : target, mod));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var Input_native_exports = {};
31
+ __export(Input_native_exports, { Input: () => Input });
32
+ module.exports = __toCommonJS(Input_native_exports);
33
+ var import_jsx_runtime = require("react/jsx-runtime");
34
+ var import_react = __toESM(require("react"), 1);
35
+ var import_react_native = require("react-native");
36
+ var import_core = require("@tamagui/core");
37
+ var import_focusable = require("@tamagui/focusable");
38
+ var import_element = require("@tamagui/element");
39
+ var import_shared = require("./shared.native.js");
40
+ var StyledInput = (0, import_core.styled)(import_react_native.TextInput, import_shared.styledBody[0], import_shared.styledBody[1]);
41
+ var Input = (0, import_core.createStyledHOC)(StyledInput, function(props, forwardedRef) {
42
+ 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;
43
+ var { ref, composedRef } = (0, import_element.useNativeInputRef)(forwardedRef);
44
+ var secureTextEntry = secureTextEntryProp !== null && secureTextEntryProp !== void 0 ? secureTextEntryProp : false;
45
+ var keyboardType = keyboardTypeProp !== null && keyboardTypeProp !== void 0 ? keyboardTypeProp : "default";
46
+ var inputMode = inputModeProp;
47
+ if (!secureTextEntryProp && !keyboardTypeProp && !inputModeProp) {
48
+ switch (type) {
49
+ case "password":
50
+ secureTextEntry = true;
51
+ break;
52
+ case "email":
53
+ keyboardType = "email-address";
54
+ inputMode = "email";
55
+ break;
56
+ case "tel":
57
+ keyboardType = "phone-pad";
58
+ inputMode = "tel";
59
+ break;
60
+ case "number":
61
+ keyboardType = "numeric";
62
+ inputMode = "numeric";
63
+ break;
64
+ case "url":
65
+ keyboardType = "url";
66
+ inputMode = "url";
67
+ break;
68
+ case "search":
69
+ inputMode = "search";
70
+ break;
71
+ }
72
+ }
73
+ var returnKeyType = returnKeyTypeProp;
74
+ if (!returnKeyType && enterKeyHint) {
75
+ switch (enterKeyHint) {
76
+ case "done":
77
+ returnKeyType = "done";
78
+ break;
79
+ case "go":
80
+ returnKeyType = "go";
81
+ break;
82
+ case "next":
83
+ returnKeyType = "next";
84
+ break;
85
+ case "search":
86
+ returnKeyType = "search";
87
+ break;
88
+ case "send":
89
+ returnKeyType = "send";
90
+ break;
91
+ }
92
+ }
93
+ var multiline = multilineProp !== null && multilineProp !== void 0 ? multilineProp : render === "textarea" || rows && rows > 1;
94
+ var numberOfLines = numberOfLinesProp !== null && numberOfLinesProp !== void 0 ? numberOfLinesProp : rows;
95
+ var autoCorrect = autoCorrectProp === "on" ? true : autoCorrectProp === "off" ? false : autoCorrectProp;
96
+ var autoCapitalize = autoCapitalizeProp === "on" ? "sentences" : autoCapitalizeProp === "off" ? "none" : autoCapitalizeProp;
97
+ import_react.default.useEffect(function() {
98
+ if (!id || disabled) return;
99
+ return (0, import_focusable.registerFocusable)(id, {
100
+ focusAndSelect: function() {
101
+ var _ref_current;
102
+ return (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.focus();
103
+ },
104
+ focus: function() {
105
+ var _ref_current;
106
+ return (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.focus();
107
+ }
108
+ });
109
+ }, [id, disabled]);
110
+ var handleChangeText = function(text) {
111
+ onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(text);
112
+ if (onChange) {
113
+ onChange({
114
+ target: { value: text },
115
+ type: "change"
116
+ });
117
+ }
118
+ if (onInput) {
119
+ onInput({
120
+ target: { value: text },
121
+ type: "input"
122
+ });
123
+ }
124
+ };
125
+ var handleKeyPress = function(e) {
126
+ onKeyPressProp === null || onKeyPressProp === void 0 ? void 0 : onKeyPressProp(e);
127
+ if (onKeyDown) {
128
+ var { key } = e.nativeEvent;
129
+ if (key === "Backspace" || key === "Enter" || key.length === 1) {
130
+ onKeyDown({
131
+ key,
132
+ type: "keydown"
133
+ });
134
+ }
135
+ }
136
+ };
137
+ var handleSubmitEditing = function(e) {
138
+ if (onKeyDown) {
139
+ onKeyDown({
140
+ key: "Enter",
141
+ type: "keydown"
142
+ });
143
+ }
144
+ onSubmitEditing === null || onSubmitEditing === void 0 ? void 0 : onSubmitEditing(e);
145
+ };
146
+ var handleSelectionChange = function(e) {
147
+ onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(e);
148
+ };
149
+ var finalProps = {
150
+ ...rest,
151
+ editable: !disabled && !readOnly,
152
+ secureTextEntry,
153
+ keyboardType,
154
+ keyboardAppearance,
155
+ inputMode,
156
+ returnKeyType,
157
+ multiline,
158
+ numberOfLines,
159
+ selection,
160
+ autoComplete,
161
+ autoFocus: autoFocusNative,
162
+ onChangeText: handleChangeText,
163
+ onKeyPress: onKeyPressProp || onKeyDown ? handleKeyPress : void 0,
164
+ onSubmitEditing: onKeyDown || onSubmitEditing ? handleSubmitEditing : void 0,
165
+ onSelectionChange: onSelectionChange ? handleSelectionChange : void 0,
166
+ onEndEditing,
167
+ onContentSizeChange,
168
+ onScroll,
169
+ submitBehavior,
170
+ blurOnSubmit,
171
+ caretHidden,
172
+ contextMenuHidden,
173
+ selectTextOnFocus,
174
+ maxFontSizeMultiplier,
175
+ allowFontScaling,
176
+ autoCapitalize,
177
+ autoCorrect,
178
+ textContentType,
179
+ clearButtonMode,
180
+ clearTextOnFocus,
181
+ enablesReturnKeyAutomatically,
182
+ dataDetectorTypes,
183
+ scrollEnabled,
184
+ passwordRules,
185
+ rejectResponderTermination,
186
+ spellCheck,
187
+ lineBreakStrategyIOS,
188
+ lineBreakModeIOS,
189
+ smartInsertDelete,
190
+ inputAccessoryViewID,
191
+ inputAccessoryViewButtonLabel,
192
+ disableKeyboardShortcuts,
193
+ importantForAutofill,
194
+ disableFullscreenUI,
195
+ inlineImageLeft,
196
+ inlineImagePadding,
197
+ returnKeyLabel,
198
+ textBreakStrategy,
199
+ textAlignVertical,
200
+ verticalAlign,
201
+ showSoftInputOnFocus,
202
+ cursorColor: cursorColorProp !== null && cursorColorProp !== void 0 ? cursorColorProp : caretColor,
203
+ selectionColor: selectionColorProp !== null && selectionColorProp !== void 0 ? selectionColorProp : caretColor
204
+ };
205
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledInput, {
206
+ ref: composedRef,
207
+ ...finalProps
208
+ });
209
+ });