@tamagui/input 2.0.0-rc.4 → 2.0.0-rc.40

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 (163) hide show
  1. package/dist/cjs/Input.cjs +165 -153
  2. package/dist/cjs/Input.native.js +255 -257
  3. package/dist/cjs/Input.native.js.map +1 -1
  4. package/dist/cjs/InputNativeProps.cjs +7 -5
  5. package/dist/cjs/InputNativeProps.native.js +7 -5
  6. package/dist/cjs/InputNativeProps.native.js.map +1 -1
  7. package/dist/cjs/TextArea.cjs +15 -13
  8. package/dist/cjs/TextArea.native.js +34 -32
  9. package/dist/cjs/TextArea.native.js.map +1 -1
  10. package/dist/cjs/index.cjs +13 -11
  11. package/dist/cjs/index.native.js +13 -11
  12. package/dist/cjs/index.native.js.map +1 -1
  13. package/dist/cjs/inputTypes.test-d.cjs +125 -0
  14. package/dist/cjs/inputTypes.test-d.native.js +128 -0
  15. package/dist/cjs/inputTypes.test-d.native.js.map +1 -0
  16. package/dist/cjs/shared.cjs +113 -101
  17. package/dist/cjs/shared.native.js +119 -107
  18. package/dist/cjs/shared.native.js.map +1 -1
  19. package/dist/cjs/types.cjs +7 -5
  20. package/dist/cjs/types.native.js +7 -5
  21. package/dist/cjs/types.native.js.map +1 -1
  22. package/dist/cjs/v1/Input.cjs +175 -168
  23. package/dist/cjs/v1/Input.native.js +154 -112
  24. package/dist/cjs/v1/Input.native.js.map +1 -1
  25. package/dist/cjs/v1/TextArea.cjs +15 -13
  26. package/dist/cjs/v1/TextArea.native.js +34 -32
  27. package/dist/cjs/v1/TextArea.native.js.map +1 -1
  28. package/dist/cjs/v1/index.cjs +7 -5
  29. package/dist/cjs/v1/index.native.js +7 -5
  30. package/dist/cjs/v1/index.native.js.map +1 -1
  31. package/dist/cjs/v1/types.cjs +7 -5
  32. package/dist/cjs/v1/types.native.js +7 -5
  33. package/dist/cjs/v1/types.native.js.map +1 -1
  34. package/dist/esm/Input.mjs +134 -124
  35. package/dist/esm/Input.mjs.map +1 -1
  36. package/dist/esm/Input.native.js +225 -229
  37. package/dist/esm/Input.native.js.map +1 -1
  38. package/dist/esm/TextArea.mjs.map +1 -1
  39. package/dist/esm/TextArea.native.js.map +1 -1
  40. package/dist/esm/index.js +4 -7
  41. package/dist/esm/index.js.map +1 -6
  42. package/dist/esm/inputTypes.test-d.mjs +126 -0
  43. package/dist/esm/inputTypes.test-d.mjs.map +1 -0
  44. package/dist/esm/inputTypes.test-d.native.js +126 -0
  45. package/dist/esm/inputTypes.test-d.native.js.map +1 -0
  46. package/dist/esm/shared.mjs +96 -86
  47. package/dist/esm/shared.mjs.map +1 -1
  48. package/dist/esm/shared.native.js +101 -91
  49. package/dist/esm/shared.native.js.map +1 -1
  50. package/dist/esm/v1/Input.mjs +144 -139
  51. package/dist/esm/v1/Input.mjs.map +1 -1
  52. package/dist/esm/v1/Input.native.js +123 -83
  53. package/dist/esm/v1/Input.native.js.map +1 -1
  54. package/dist/jsx/Input.mjs +134 -124
  55. package/dist/jsx/Input.mjs.map +1 -1
  56. package/dist/jsx/Input.native.js +255 -257
  57. package/dist/jsx/Input.native.js.map +1 -1
  58. package/dist/jsx/InputNativeProps.native.js +7 -5
  59. package/dist/jsx/TextArea.mjs.map +1 -1
  60. package/dist/jsx/TextArea.native.js +34 -32
  61. package/dist/jsx/TextArea.native.js.map +1 -1
  62. package/dist/jsx/index.js +4 -7
  63. package/dist/jsx/index.js.map +1 -6
  64. package/dist/jsx/index.native.js +13 -11
  65. package/dist/jsx/inputTypes.test-d.mjs +126 -0
  66. package/dist/jsx/inputTypes.test-d.mjs.map +1 -0
  67. package/dist/jsx/inputTypes.test-d.native.js +128 -0
  68. package/dist/jsx/inputTypes.test-d.native.js.map +1 -0
  69. package/dist/jsx/shared.mjs +96 -86
  70. package/dist/jsx/shared.mjs.map +1 -1
  71. package/dist/jsx/shared.native.js +119 -107
  72. package/dist/jsx/shared.native.js.map +1 -1
  73. package/dist/jsx/types.native.js +7 -5
  74. package/dist/jsx/v1/Input.mjs +144 -139
  75. package/dist/jsx/v1/Input.mjs.map +1 -1
  76. package/dist/jsx/v1/Input.native.js +154 -112
  77. package/dist/jsx/v1/Input.native.js.map +1 -1
  78. package/dist/jsx/v1/TextArea.native.js +34 -32
  79. package/dist/jsx/v1/TextArea.native.js.map +1 -1
  80. package/dist/jsx/v1/index.native.js +7 -5
  81. package/dist/jsx/v1/types.native.js +7 -5
  82. package/package.json +20 -22
  83. package/src/Input.native.tsx +3 -30
  84. package/src/Input.tsx +5 -3
  85. package/src/TextArea.tsx +3 -3
  86. package/src/index.ts +1 -1
  87. package/src/inputTypes.test-d.ts +237 -0
  88. package/src/shared.tsx +3 -0
  89. package/src/types.ts +24 -14
  90. package/types/Input.d.ts +17 -6
  91. package/types/Input.d.ts.map +1 -1
  92. package/types/Input.native.d.ts +15 -6
  93. package/types/Input.native.d.ts.map +1 -1
  94. package/types/TextArea.d.ts +11 -4
  95. package/types/TextArea.d.ts.map +1 -1
  96. package/types/index.d.ts +1 -1
  97. package/types/index.d.ts.map +1 -1
  98. package/types/shared.d.ts +3 -0
  99. package/types/shared.d.ts.map +1 -1
  100. package/types/types.d.ts +14 -4
  101. package/types/types.d.ts.map +1 -1
  102. package/types/v1/Input.d.ts +15 -6
  103. package/types/v1/Input.d.ts.map +1 -1
  104. package/types/v1/Input.native.d.ts +15 -6
  105. package/types/v1/Input.native.d.ts.map +1 -1
  106. package/types/v1/TextArea.d.ts +9 -3
  107. package/types/v1/TextArea.d.ts.map +1 -1
  108. package/dist/cjs/Input.js +0 -143
  109. package/dist/cjs/Input.js.map +0 -6
  110. package/dist/cjs/InputNativeProps.js +0 -14
  111. package/dist/cjs/InputNativeProps.js.map +0 -6
  112. package/dist/cjs/TextArea.js +0 -43
  113. package/dist/cjs/TextArea.js.map +0 -6
  114. package/dist/cjs/index.js +0 -24
  115. package/dist/cjs/index.js.map +0 -6
  116. package/dist/cjs/shared.js +0 -108
  117. package/dist/cjs/shared.js.map +0 -6
  118. package/dist/cjs/types.js +0 -14
  119. package/dist/cjs/types.js.map +0 -6
  120. package/dist/cjs/v1/Input.js +0 -171
  121. package/dist/cjs/v1/Input.js.map +0 -6
  122. package/dist/cjs/v1/TextArea.js +0 -43
  123. package/dist/cjs/v1/TextArea.js.map +0 -6
  124. package/dist/cjs/v1/index.js +0 -16
  125. package/dist/cjs/v1/index.js.map +0 -6
  126. package/dist/cjs/v1/types.js +0 -14
  127. package/dist/cjs/v1/types.js.map +0 -6
  128. package/dist/esm/Input.js +0 -124
  129. package/dist/esm/Input.js.map +0 -6
  130. package/dist/esm/InputNativeProps.js +0 -1
  131. package/dist/esm/InputNativeProps.js.map +0 -6
  132. package/dist/esm/TextArea.js +0 -29
  133. package/dist/esm/TextArea.js.map +0 -6
  134. package/dist/esm/shared.js +0 -96
  135. package/dist/esm/shared.js.map +0 -6
  136. package/dist/esm/types.js +0 -1
  137. package/dist/esm/types.js.map +0 -6
  138. package/dist/esm/v1/Input.js +0 -152
  139. package/dist/esm/v1/Input.js.map +0 -6
  140. package/dist/esm/v1/TextArea.js +0 -29
  141. package/dist/esm/v1/TextArea.js.map +0 -6
  142. package/dist/esm/v1/index.js +0 -3
  143. package/dist/esm/v1/index.js.map +0 -6
  144. package/dist/esm/v1/types.js +0 -1
  145. package/dist/esm/v1/types.js.map +0 -6
  146. package/dist/jsx/Input.js +0 -124
  147. package/dist/jsx/Input.js.map +0 -6
  148. package/dist/jsx/InputNativeProps.js +0 -1
  149. package/dist/jsx/InputNativeProps.js.map +0 -6
  150. package/dist/jsx/TextArea.js +0 -29
  151. package/dist/jsx/TextArea.js.map +0 -6
  152. package/dist/jsx/shared.js +0 -96
  153. package/dist/jsx/shared.js.map +0 -6
  154. package/dist/jsx/types.js +0 -1
  155. package/dist/jsx/types.js.map +0 -6
  156. package/dist/jsx/v1/Input.js +0 -152
  157. package/dist/jsx/v1/Input.js.map +0 -6
  158. package/dist/jsx/v1/TextArea.js +0 -29
  159. package/dist/jsx/v1/TextArea.js.map +0 -6
  160. package/dist/jsx/v1/index.js +0 -3
  161. package/dist/jsx/v1/index.js.map +0 -6
  162. package/dist/jsx/v1/types.js +0 -1
  163. package/dist/jsx/v1/types.js.map +0 -6
@@ -2,181 +2,188 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
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: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
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, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
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
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
32
34
  var Input_exports = {};
33
35
  __export(Input_exports, {
34
36
  Input: () => Input
35
37
  });
36
38
  module.exports = __toCommonJS(Input_exports);
37
- var import_core = require("@tamagui/core"),
38
- import_focusable = require("@tamagui/focusable"),
39
- import_element = require("@tamagui/element"),
40
- import_react = __toESM(require("react"), 1),
41
- import_shared = require("../shared.cjs"),
42
- import_jsx_runtime = require("react/jsx-runtime");
43
- const StyledInput = (0, import_core.styled)(import_core.View, import_shared.styledBody[0], import_shared.styledBody[1]),
44
- Input = StyledInput.styleable((inProps, forwardedRef) => {
45
- const {
46
- // some of destructed props are just to avoid passing them to ...rest because they are not in web.
47
- allowFontScaling,
48
- selectTextOnFocus,
49
- showSoftInputOnFocus,
50
- textContentType,
51
- passwordRules,
52
- textBreakStrategy,
53
- underlineColorAndroid,
54
- selection,
55
- lineBreakStrategyIOS,
56
- returnKeyLabel,
57
- disabled,
58
- onSubmitEditing,
59
- caretHidden,
60
- clearButtonMode,
61
- clearTextOnFocus,
62
- contextMenuHidden,
63
- dataDetectorTypes,
64
- id,
65
- enablesReturnKeyAutomatically,
66
- importantForAutofill,
67
- inlineImageLeft,
68
- inlineImagePadding,
69
- inputAccessoryViewID,
70
- keyboardAppearance,
71
- keyboardType,
72
- cursorColor,
73
- disableFullscreenUI,
74
- editable,
75
- maxFontSizeMultiplier,
76
- multiline,
77
- numberOfLines,
78
- onChangeText,
79
- onContentSizeChange,
80
- onEndEditing,
81
- onScroll,
82
- onSelectionChange,
83
- // @ts-ignore
84
- caretColor,
85
- placeholderTextColor,
86
- blurOnSubmit,
87
- enterKeyHint,
88
- returnKeyType,
89
- rejectResponderTermination,
90
- scrollEnabled,
91
- secureTextEntry,
92
- selectionColor,
93
- inputMode,
94
- ...rest
95
- } = inProps,
96
- {
97
- ref,
98
- composedRef
99
- } = (0, import_element.useWebRef)(forwardedRef),
100
- theme = (0, import_core.useTheme)(),
101
- _onSelectionChange = (0, import_core.useEvent)(() => {
102
- const start = ref.current?.selectionStart ?? 0,
103
- end = ref.current?.selectionEnd ?? 0;
104
- onSelectionChange?.({
105
- nativeEvent: {
106
- selection: {
107
- end,
108
- start
109
- }
110
- }
111
- });
112
- });
113
- import_react.default.useEffect(() => {
114
- if (onSelectionChange) return ref.current?.addEventListener("selectionchange", _onSelectionChange), () => {
39
+ var import_core = require("@tamagui/core");
40
+ var import_focusable = require("@tamagui/focusable");
41
+ var import_element = require("@tamagui/element");
42
+ var import_react = __toESM(require("react"), 1);
43
+ var import_shared = require("../shared.cjs");
44
+ 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((inProps, forwardedRef) => {
47
+ const {
48
+ allowFontScaling,
49
+ selectTextOnFocus,
50
+ showSoftInputOnFocus,
51
+ textContentType,
52
+ passwordRules,
53
+ textBreakStrategy,
54
+ underlineColorAndroid,
55
+ selection,
56
+ lineBreakStrategyIOS,
57
+ returnKeyLabel,
58
+ disabled,
59
+ onSubmitEditing,
60
+ caretHidden,
61
+ clearButtonMode,
62
+ clearTextOnFocus,
63
+ contextMenuHidden,
64
+ dataDetectorTypes,
65
+ id,
66
+ enablesReturnKeyAutomatically,
67
+ importantForAutofill,
68
+ inlineImageLeft,
69
+ inlineImagePadding,
70
+ inputAccessoryViewID,
71
+ keyboardAppearance,
72
+ keyboardType,
73
+ cursorColor,
74
+ disableFullscreenUI,
75
+ editable,
76
+ maxFontSizeMultiplier,
77
+ multiline,
78
+ numberOfLines,
79
+ onChangeText,
80
+ onContentSizeChange,
81
+ onEndEditing,
82
+ onScroll,
83
+ onSelectionChange,
84
+ caretColor,
85
+ placeholderTextColor,
86
+ blurOnSubmit,
87
+ enterKeyHint,
88
+ returnKeyType,
89
+ rejectResponderTermination,
90
+ scrollEnabled,
91
+ secureTextEntry,
92
+ selectionColor,
93
+ inputMode,
94
+ ...rest
95
+ } = inProps;
96
+ const {
97
+ ref,
98
+ composedRef
99
+ } = (0, import_element.useWebRef)(forwardedRef);
100
+ const theme = (0, import_core.useTheme)();
101
+ const _onSelectionChange = (0, import_core.useEvent)(() => {
102
+ const start = ref.current?.selectionStart ?? 0;
103
+ const end = ref.current?.selectionEnd ?? 0;
104
+ onSelectionChange?.({
105
+ nativeEvent: {
106
+ selection: {
107
+ end,
108
+ start
109
+ }
110
+ }
111
+ });
112
+ });
113
+ import_react.default.useEffect(() => {
114
+ if (onSelectionChange) {
115
+ ref.current?.addEventListener("selectionchange", _onSelectionChange);
116
+ return () => {
115
117
  ref.current?.removeEventListener("selectionchange", _onSelectionChange);
116
118
  };
117
- }, []), import_react.default.useEffect(() => {
118
- selection && ref.current?.setSelectionRange(selection.start || null, selection.end || null);
119
- }, [selection?.start, selection?.end]);
120
- const finalProps = {
121
- ...rest,
122
- disabled,
123
- caretColor,
124
- id,
125
- enterKeyHint,
126
- type: (() => {
127
- if (rest?.type) return rest.type;
128
- if (secureTextEntry) return "password";
129
- switch (keyboardType) {
130
- case "number-pad":
131
- case "numeric":
132
- return "number";
133
- case "email-address":
134
- return "email";
135
- case "phone-pad":
136
- return "tel";
137
- case "url":
138
- return "url";
139
- default:
140
- return "text";
141
- }
142
- })(),
143
- inputMode: (() => {
144
- switch (keyboardType) {
145
- case "number-pad":
146
- case "numeric":
147
- return "numeric";
148
- case "decimal-pad":
149
- return "decimal";
150
- case "email-address":
151
- return "email";
152
- case "phone-pad":
153
- return "tel";
154
- case "url":
155
- return "url";
156
- default:
157
- return;
158
- }
159
- })(),
160
- style: {
161
- ...rest.style,
162
- ...(placeholderTextColor && {
163
- "--placeholderColor": theme[placeholderTextColor]?.variable || placeholderTextColor
164
- }),
165
- ...(selectionColor && {
166
- "--selectionBackground": theme[selectionColor]?.variable || selectionColor
167
- })
119
+ }
120
+ }, []);
121
+ import_react.default.useEffect(() => {
122
+ if (selection) ref.current?.setSelectionRange(selection.start || null, selection.end || null);
123
+ }, [selection?.start, selection?.end]);
124
+ const finalProps = {
125
+ ...rest,
126
+ disabled,
127
+ caretColor,
128
+ id,
129
+ enterKeyHint,
130
+ type: (() => {
131
+ if (rest?.type) return rest.type;
132
+ if (secureTextEntry) return "password";
133
+ switch (keyboardType) {
134
+ case "number-pad":
135
+ case "numeric":
136
+ return "number";
137
+ case "email-address":
138
+ return "email";
139
+ case "phone-pad":
140
+ return "tel";
141
+ case "url":
142
+ return "url";
143
+ default:
144
+ return "text";
145
+ }
146
+ })(),
147
+ inputMode: (() => {
148
+ switch (keyboardType) {
149
+ case "number-pad":
150
+ case "numeric":
151
+ return "numeric";
152
+ case "decimal-pad":
153
+ return "decimal";
154
+ case "email-address":
155
+ return "email";
156
+ case "phone-pad":
157
+ return "tel";
158
+ case "url":
159
+ return "url";
160
+ default:
161
+ return;
168
162
  }
169
- };
170
- return import_react.default.useEffect(() => {
171
- if (id && !disabled) return (0, import_focusable.registerFocusable)(id, {
172
- focusAndSelect: () => {
173
- ref.current?.focus();
174
- },
175
- focus: () => {}
176
- });
177
- }, [id, disabled]), /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
178
- children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)("style", {
179
- children: `
163
+ })(),
164
+ style: {
165
+ ...rest.style,
166
+ ...(placeholderTextColor && {
167
+ "--placeholderColor": theme[placeholderTextColor]?.variable || placeholderTextColor
168
+ }),
169
+ ...(selectionColor && {
170
+ "--selectionBackground": theme[selectionColor]?.variable || selectionColor
171
+ })
172
+ }
173
+ };
174
+ import_react.default.useEffect(() => {
175
+ if (!id) return;
176
+ if (disabled) return;
177
+ return (0, import_focusable.registerFocusable)(id, {
178
+ focusAndSelect: () => {
179
+ ref.current?.focus();
180
+ },
181
+ focus: () => {}
182
+ });
183
+ }, [id, disabled]);
184
+ return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
185
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)("style", {
186
+ children: `
180
187
  input::selection, textarea::selection {
181
188
  background-color: var(--selectionBackground) !important;
182
189
  }
@@ -185,9 +192,9 @@ const StyledInput = (0, import_core.styled)(import_core.View, import_shared.styl
185
192
  color: var(--placeholderColor) !important;
186
193
  }
187
194
  `
188
- }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(StyledInput, {
189
- ref: composedRef,
190
- ...finalProps
191
- })]
192
- });
193
- });
195
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(StyledInput, {
196
+ ref: composedRef,
197
+ ...finalProps
198
+ })]
199
+ });
200
+ });
@@ -4,138 +4,180 @@ var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf,
8
- __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: !0
13
- });
14
- },
15
- __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
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, {
17
18
  get: () => from[key],
18
19
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
20
  });
20
- return to;
21
- };
21
+ }
22
+ return to;
23
+ };
22
24
  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: !0
30
- }) : target, mod)),
31
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: !0
33
- }), mod);
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
+ value: mod,
31
+ enumerable: true
32
+ }) : target, mod));
33
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
+ value: true
35
+ }), mod);
34
36
  var Input_native_exports = {};
35
37
  __export(Input_native_exports, {
36
38
  Input: () => Input
37
39
  });
38
40
  module.exports = __toCommonJS(Input_native_exports);
39
- var import_jsx_runtime = require("react/jsx-runtime"),
40
- import_react = __toESM(require("react"), 1),
41
- import_core = require("@tamagui/core"),
42
- import_focusable = require("@tamagui/focusable"),
43
- import_element = require("@tamagui/element"),
44
- import_react_native = require("react-native"),
45
- import_shared = require("../shared.native.js"),
46
- StyledInput = (0, import_core.styled)(import_react_native.TextInput, import_shared.styledBody[0], import_shared.styledBody[1]),
47
- Input = StyledInput.styleable(function (inProps, forwardedRef) {
48
- var {
49
- // some of destructed props are just to avoid passing them to ...rest because they are not in native.
50
- type,
51
- //@ts-ignore
52
- dirname,
53
- max,
54
- min,
55
- minLength,
56
- multiple,
57
- name,
58
- required,
59
- step,
60
- disabled,
61
- id,
62
- // @ts-ignore
63
- caretColor,
64
- onChange,
65
- onInput,
66
- rows,
67
- enterKeyHint,
68
- returnKeyType,
69
- onKeyDown,
70
- inputMode,
71
- render,
72
- ...rest
73
- } = inProps,
74
- {
75
- ref,
76
- composedRef
77
- } = (0, import_element.useNativeInputRef)(forwardedRef),
78
- secureTextEntry = !1,
79
- cursorColor = caretColor,
80
- _returnKeyType = returnKeyType,
81
- _enterKeyHint = enterKeyHint;
82
- enterKeyHint === "go" && (_returnKeyType = "go", _enterKeyHint = void 0);
83
- var _inputMode = inputMode;
84
- type === "email" ? _inputMode = "email" : type === "tel" ? _inputMode = "tel" : type === "search" ? _inputMode = "search" : type === "url" ? _inputMode = "url" : type === "password" ? (secureTextEntry = !0, _inputMode = "text") : type === "number" ? _inputMode = "numeric" : _inputMode = "text";
85
- var showSoftInputOnFocus = !0;
86
- inputMode === "none" && (showSoftInputOnFocus = !1);
87
- var finalProps = {
88
- ...rest,
89
- inputMode: _inputMode,
90
- showSoftInputOnFocus,
91
- disabled,
92
- id,
93
- cursorColor,
94
- enterKeyHint: _enterKeyHint,
95
- returnKeyType: _returnKeyType,
96
- secureTextEntry,
97
- numberOfLines: rows || rest.numberOfLines
98
- };
99
- return render === "textarea" && (finalProps.multiline = !0), onKeyDown && (finalProps.onKeyPress = function (e) {
41
+ var import_jsx_runtime = require("react/jsx-runtime");
42
+ var import_react = __toESM(require("react"), 1);
43
+ var import_core = require("@tamagui/core");
44
+ var import_focusable = require("@tamagui/focusable");
45
+ var import_element = require("@tamagui/element");
46
+ var import_react_native = require("react-native");
47
+ var import_shared = require("../shared.native.js");
48
+ var StyledInput = (0, import_core.styled)(import_react_native.TextInput, import_shared.styledBody[0], import_shared.styledBody[1]);
49
+ var Input = StyledInput.styleable(function (inProps, forwardedRef) {
50
+ var {
51
+ // some of destructed props are just to avoid passing them to ...rest because they are not in native.
52
+ type,
53
+ //@ts-ignore
54
+ dirname,
55
+ max,
56
+ min,
57
+ minLength,
58
+ multiple,
59
+ name,
60
+ required,
61
+ step,
62
+ disabled,
63
+ id,
64
+ // @ts-ignore
65
+ caretColor,
66
+ onChange,
67
+ onInput,
68
+ rows,
69
+ enterKeyHint,
70
+ returnKeyType,
71
+ onKeyDown,
72
+ inputMode,
73
+ render,
74
+ ...rest
75
+ } = inProps;
76
+ var {
77
+ ref,
78
+ composedRef
79
+ } = (0, import_element.useNativeInputRef)(forwardedRef);
80
+ var secureTextEntry = false;
81
+ var cursorColor = caretColor;
82
+ var _returnKeyType = returnKeyType;
83
+ var _enterKeyHint = enterKeyHint;
84
+ if (enterKeyHint === "go") {
85
+ _returnKeyType = "go";
86
+ _enterKeyHint = void 0;
87
+ }
88
+ var _inputMode = inputMode;
89
+ if (type === "email") {
90
+ _inputMode = "email";
91
+ } else if (type === "tel") {
92
+ _inputMode = "tel";
93
+ } else if (type === "search") {
94
+ _inputMode = "search";
95
+ } else if (type === "url") {
96
+ _inputMode = "url";
97
+ } else if (type === "password") {
98
+ secureTextEntry = true;
99
+ _inputMode = "text";
100
+ } else if (type === "number") {
101
+ _inputMode = "numeric";
102
+ } else {
103
+ _inputMode = "text";
104
+ }
105
+ var showSoftInputOnFocus = true;
106
+ if (inputMode === "none") {
107
+ showSoftInputOnFocus = false;
108
+ }
109
+ var finalProps = {
110
+ ...rest,
111
+ inputMode: _inputMode,
112
+ showSoftInputOnFocus,
113
+ disabled,
114
+ id,
115
+ cursorColor,
116
+ enterKeyHint: _enterKeyHint,
117
+ returnKeyType: _returnKeyType,
118
+ secureTextEntry,
119
+ numberOfLines: rows || rest.numberOfLines
120
+ };
121
+ if (render === "textarea") {
122
+ finalProps.multiline = true;
123
+ }
124
+ if (onKeyDown) {
125
+ finalProps.onKeyPress = function (e) {
100
126
  var {
101
127
  key
102
128
  } = e.nativeEvent;
103
- (key === "Backspace" || render === "textarea" && key === "Enter" || key.length === 1) && onKeyDown({
104
- key,
105
- type: "keydown"
106
- });
107
- }, finalProps.onSubmitEditing = function (e) {
129
+ if (key === "Backspace" || render === "textarea" && key === "Enter" || key.length === 1) {
130
+ onKeyDown({
131
+ key,
132
+ type: "keydown"
133
+ });
134
+ }
135
+ };
136
+ finalProps.onSubmitEditing = function (e) {
108
137
  onKeyDown({
109
138
  key: "Enter",
110
139
  type: "keydown"
111
140
  });
112
- }), (onChange || onInput) && (finalProps.onChange = function (e) {
141
+ };
142
+ }
143
+ if (onChange || onInput) {
144
+ finalProps.onChange = function (e) {
113
145
  var {
114
146
  text
115
147
  } = e.nativeEvent;
116
- onChange && onChange({
117
- target: {
118
- value: text
119
- },
120
- type: "change"
121
- }), onInput?.({
122
- target: {
123
- value: text
124
- },
125
- type: "input"
126
- });
127
- }), import_react.default.useEffect(function () {
128
- if (id && !disabled) return (0, import_focusable.registerFocusable)(id, {
129
- focusAndSelect: function () {
130
- var _ref_current;
131
- (_ref_current = ref.current) === null || _ref_current === void 0 || _ref_current.focus();
132
- },
133
- focus: function () {}
134
- });
135
- }, [id, disabled]), /* @__PURE__ */(0, import_jsx_runtime.jsx)(StyledInput, {
136
- onChange: function (e) {},
137
- ref: composedRef,
138
- ...finalProps
148
+ if (onChange) {
149
+ onChange({
150
+ target: {
151
+ value: text
152
+ },
153
+ type: "change"
154
+ });
155
+ }
156
+ if (onInput != null) {
157
+ onInput({
158
+ target: {
159
+ value: text
160
+ },
161
+ type: "input"
162
+ });
163
+ }
164
+ };
165
+ }
166
+ import_react.default.useEffect(function () {
167
+ if (!id) return;
168
+ if (disabled) return;
169
+ return (0, import_focusable.registerFocusable)(id, {
170
+ focusAndSelect: function () {
171
+ var _ref_current;
172
+ (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.focus();
173
+ },
174
+ focus: function () {}
139
175
  });
176
+ }, [id, disabled]);
177
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(StyledInput, {
178
+ onChange: function (e) {},
179
+ ref: composedRef,
180
+ ...finalProps
140
181
  });
182
+ });
141
183
  //# sourceMappingURL=Input.native.js.map