@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
|
@@ -1,183 +0,0 @@
|
|
|
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(
|
|
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);
|
|
36
|
-
var Input_native_exports = {};
|
|
37
|
-
__export(Input_native_exports, {
|
|
38
|
-
Input: () => Input
|
|
39
|
-
});
|
|
40
|
-
module.exports = __toCommonJS(Input_native_exports);
|
|
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) {
|
|
126
|
-
var {
|
|
127
|
-
key
|
|
128
|
-
} = e.nativeEvent;
|
|
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) {
|
|
137
|
-
onKeyDown({
|
|
138
|
-
key: "Enter",
|
|
139
|
-
type: "keydown"
|
|
140
|
-
});
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
if (onChange || onInput) {
|
|
144
|
-
finalProps.onChange = function (e) {
|
|
145
|
-
var {
|
|
146
|
-
text
|
|
147
|
-
} = e.nativeEvent;
|
|
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 () {}
|
|
175
|
-
});
|
|
176
|
-
}, [id, disabled]);
|
|
177
|
-
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(StyledInput, {
|
|
178
|
-
onChange: function (e) {},
|
|
179
|
-
ref: composedRef,
|
|
180
|
-
...finalProps
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
//# sourceMappingURL=Input.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["Input_native_exports","__export","Input","module","exports","__toCommonJS","import_jsx_runtime","require","import_react","__toESM","import_core","import_focusable","import_element","import_react_native","import_shared","StyledInput","styled","TextInput","styledBody","styleable","inProps","forwardedRef","type","dirname","max","min","minLength","multiple","name","required","step","disabled","id","caretColor","onChange","onInput","rows","enterKeyHint","returnKeyType","onKeyDown","inputMode","render","rest","ref","composedRef","useNativeInputRef","secureTextEntry","cursorColor","_returnKeyType","_enterKeyHint","_inputMode","showSoftInputOnFocus","finalProps","numberOfLines","multiline","onKeyPress","e","key","nativeEvent","length","onSubmitEditing","text","target","value","default","useEffect","registerFocusable","focusAndSelect","_ref_current","current","focus","jsx"],"sources":["../../../src/v1/Input.native.tsx"],"sourcesContent":[null],"mappings":"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","ignoreList":[]}
|
package/dist/jsx/v1/TextArea.mjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { styled } from "@tamagui/web";
|
|
2
|
-
import { Input } from "./Input.mjs";
|
|
3
|
-
import { defaultStyles, textAreaSizeVariant } from "../shared.mjs";
|
|
4
|
-
const TextArea = styled(Input, {
|
|
5
|
-
name: "TextArea",
|
|
6
|
-
render: "textarea",
|
|
7
|
-
// this attribute fixes firefox newline issue
|
|
8
|
-
// @ts-ignore
|
|
9
|
-
whiteSpace: "pre-wrap",
|
|
10
|
-
variants: {
|
|
11
|
-
unstyled: {
|
|
12
|
-
false: {
|
|
13
|
-
height: "auto",
|
|
14
|
-
...defaultStyles,
|
|
15
|
-
numberOfLines: 3
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
size: {
|
|
19
|
-
"...size": textAreaSizeVariant
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
defaultVariants: {
|
|
23
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
export { TextArea };
|
|
27
|
-
//# sourceMappingURL=TextArea.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["styled","Input","defaultStyles","textAreaSizeVariant","TextArea","name","render","whiteSpace","variants","unstyled","false","height","numberOfLines","size","defaultVariants","process","env","TAMAGUI_HEADLESS"],"sources":["../../../src/v1/TextArea.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,MAAA,QAAc;AACvB,SAASC,KAAA,QAAa;AACtB,SAASC,aAAA,EAAeC,mBAAA,QAA2B;AAO5C,MAAMC,QAAA,GAAWJ,MAAA,CAAOC,KAAA,EAAO;EACpCI,IAAA,EAAM;EACNC,MAAA,EAAQ;EAAA;EAAA;EAIRC,UAAA,EAAY;EAEZC,QAAA,EAAU;IACRC,QAAA,EAAU;MACRC,KAAA,EAAO;QACLC,MAAA,EAAQ;QACR,GAAGT,aAAA;QACHU,aAAA,EAAe;MACjB;IACF;IAEAC,IAAA,EAAM;MACJ,WAAWV;IACb;EACF;EAEAW,eAAA,EAAiB;IACfL,QAAA,EAAUM,OAAA,CAAQC,GAAA,CAAIC,gBAAA,KAAqB;EAC7C;AACF,CAAC","ignoreList":[]}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
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, {
|
|
16
|
-
get: () => from[key],
|
|
17
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
-
value: true
|
|
24
|
-
}), mod);
|
|
25
|
-
var TextArea_exports = {};
|
|
26
|
-
__export(TextArea_exports, {
|
|
27
|
-
TextArea: () => TextArea
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(TextArea_exports);
|
|
30
|
-
var import_web = require("@tamagui/web");
|
|
31
|
-
var import_Input = require("./Input.native.js");
|
|
32
|
-
var import_shared = require("../shared.native.js");
|
|
33
|
-
var TextArea = (0, import_web.styled)(import_Input.Input, {
|
|
34
|
-
name: "TextArea",
|
|
35
|
-
render: "textarea",
|
|
36
|
-
// this attribute fixes firefox newline issue
|
|
37
|
-
// @ts-ignore
|
|
38
|
-
whiteSpace: "pre-wrap",
|
|
39
|
-
variants: {
|
|
40
|
-
unstyled: {
|
|
41
|
-
false: {
|
|
42
|
-
height: "auto",
|
|
43
|
-
...import_shared.defaultStyles,
|
|
44
|
-
numberOfLines: 3
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
size: {
|
|
48
|
-
"...size": import_shared.textAreaSizeVariant
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
defaultVariants: {
|
|
52
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
//# sourceMappingURL=TextArea.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","TextArea_exports","TextArea","module","exports","import_web","require","import_Input"],"sources":["../../../src/v1/TextArea.tsx"],"sourcesContent":[null],"mappings":"AAAA,YAAS;;AACT,IAAAA,SAAS,GAAAC,MAAa,CAAAC,cAAA;AACtB,IAAAC,gBAAS,GAAAF,MAAe,CAAAG,wBAA2B;AAO5C,IAAAC,iBAAiB,GAAOJ,MAAA,CAAOK,mBAAA;AAAA,IACpCC,YAAM,GAAAN,MAAA,CAAAO,SAAA,CAAAC,cAAA;AAAA,IACNC,QAAQ,GAAAA,CAAAC,MAAA,EAAAC,GAAA;EAAA,SAAAC,IAAA,IAAAD,GAAA,EAAAZ,SAAA,CAAAW,MAAA,EAAAE,IAAA;IAAAC,GAAA,EAAAF,GAAA,CAAAC,IAAA;IAAAE,UAAA;EAAA;AAAA;AAII,IAEZC,WAAU,GAAAA,CAAAC,EAAA,EAAAC,IAAA,EAAAC,MAAA,EAAAC,IAAA;EAAA,IACRF,IAAA,IAAU,OAAAA,IAAA,wBAAAA,IAAA;IAAA,KACR,IAAOG,GAAA,IAAAhB,iBAAA,CAAAa,IAAA,OACL,CAAAX,YAAQ,CAAAe,IAAA,CAAAL,EAAA,EAAAI,GAAA,KAAAA,GAAA,KAAAF,MAAA,EACRnB,SAAG,CAAAiB,EAAA,EAAAI,GAAA;MAAAP,GAAA,EAAAA,CAAA,KAAAI,IAAA,CAAAG,GAAA;MAAAN,UAAA,IAAAK,IAAA,GAAAjB,gBAAA,CAAAe,IAAA,EAAAG,GAAA,MAAAD,IAAA,CAAAL;IAAA;EAAA;EACY,OACjBE,EAAA;AAAA;AACF,IAEAM,YAAM,GAAAC,GAAA,IAAAR,WAAA,CAAAhB,SAAA;EAAAyB,KAAA;AAAA,IAAAD,GAAA;AAAA,IAAAE,gBACO;AAAAhB,QACb,CAAAgB,gBAAA;EACFC,QAAA,EAAAA,CAAA,KAAAA;AAAA,EAEA;AAAiBC,MACf,CAAAC,OAAU,GAAAN,YAAY,CAAAG,gBAAA,CAAqB;AAAA,IAC7CI,UAAA,GAAAC,OAAA;AACF,IAACC,YAAA,GAAAD,OAAA","ignoreList":[]}
|
package/dist/jsx/v1/index.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/v1/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc","ignoreList":[]}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
10
|
-
get: () => from[key],
|
|
11
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
17
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
18
|
-
value: true
|
|
19
|
-
}), mod);
|
|
20
|
-
var v1_exports = {};
|
|
21
|
-
module.exports = __toCommonJS(v1_exports);
|
|
22
|
-
__reExport(v1_exports, require("./Input.native.js"), module.exports);
|
|
23
|
-
__reExport(v1_exports, require("./TextArea.native.js"), module.exports);
|
|
24
|
-
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__defProp","Object","defineProperty"],"sources":["../../../src/v1/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;AACA,IAAAA,SAAA,GAAcC,MAAA,CAAAC,cAAA","ignoreList":[]}
|
package/dist/jsx/v1/types.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
10
|
-
get: () => from[key],
|
|
11
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
17
|
-
value: true
|
|
18
|
-
}), mod);
|
|
19
|
-
var types_exports = {};
|
|
20
|
-
module.exports = __toCommonJS(types_exports);
|
|
21
|
-
//# sourceMappingURL=types.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
|
package/src/inputTypes.test-d.ts
DELETED
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type tests for Input component.
|
|
3
|
-
*
|
|
4
|
-
* Verifies that:
|
|
5
|
-
* 1. Event handlers are typed with HTMLInputElement (not HTMLDivElement)
|
|
6
|
-
* 2. HTML input-specific props are available (type, placeholder, etc.)
|
|
7
|
-
* 3. Tamagui style props and variants still work
|
|
8
|
-
* 4. Cross-platform props (autoCorrect, autoCapitalize) are present
|
|
9
|
-
* 5. InputRef includes both HTMLInputElement and TextInput
|
|
10
|
-
*
|
|
11
|
-
* Run with: npx vitest typecheck --run
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { expectTypeOf, describe, test } from 'vitest'
|
|
15
|
-
import type { GetProps } from '@tamagui/web'
|
|
16
|
-
import type { TextInput } from 'react-native'
|
|
17
|
-
import {
|
|
18
|
-
Input,
|
|
19
|
-
type InputProps,
|
|
20
|
-
type InputRef,
|
|
21
|
-
TextArea,
|
|
22
|
-
type TextAreaProps,
|
|
23
|
-
} from './index'
|
|
24
|
-
|
|
25
|
-
// helper: extract event param type
|
|
26
|
-
type EventParam<T> = T extends (event: infer E) => any ? E : never
|
|
27
|
-
type IsAssignable<T, U> = T extends U ? true : false
|
|
28
|
-
|
|
29
|
-
// =============================================================================
|
|
30
|
-
// Test: event handlers are typed with HTMLInputElement
|
|
31
|
-
// =============================================================================
|
|
32
|
-
|
|
33
|
-
describe('Input event handler types', () => {
|
|
34
|
-
test('onChange event uses HTMLInputElement', () => {
|
|
35
|
-
type OnChange = NonNullable<InputProps['onChange']>
|
|
36
|
-
type Event = EventParam<OnChange>
|
|
37
|
-
expectTypeOf<Event['currentTarget']>().toMatchTypeOf<HTMLInputElement>()
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
test('onFocus event uses HTMLInputElement', () => {
|
|
41
|
-
type OnFocus = NonNullable<InputProps['onFocus']>
|
|
42
|
-
type Event = EventParam<OnFocus>
|
|
43
|
-
expectTypeOf<Event['currentTarget']>().toMatchTypeOf<HTMLInputElement>()
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
test('onBlur event uses HTMLInputElement', () => {
|
|
47
|
-
type OnBlur = NonNullable<InputProps['onBlur']>
|
|
48
|
-
type Event = EventParam<OnBlur>
|
|
49
|
-
expectTypeOf<Event['currentTarget']>().toMatchTypeOf<HTMLInputElement>()
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
test('onKeyDown event uses HTMLInputElement', () => {
|
|
53
|
-
type OnKeyDown = NonNullable<InputProps['onKeyDown']>
|
|
54
|
-
type Event = EventParam<OnKeyDown>
|
|
55
|
-
expectTypeOf<Event['currentTarget']>().toMatchTypeOf<HTMLInputElement>()
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
test('onClick event uses HTMLInputElement', () => {
|
|
59
|
-
type OnClick = NonNullable<InputProps['onClick']>
|
|
60
|
-
type Event = EventParam<OnClick>
|
|
61
|
-
expectTypeOf<Event['currentTarget']>().toMatchTypeOf<HTMLInputElement>()
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
test('onChange event is NOT typed with HTMLDivElement', () => {
|
|
65
|
-
type OnChange = NonNullable<InputProps['onChange']>
|
|
66
|
-
type Event = EventParam<OnChange>
|
|
67
|
-
// HTMLDivElement should NOT be assignable to the currentTarget
|
|
68
|
-
type DivMatchesCurrentTarget = IsAssignable<HTMLDivElement, Event['currentTarget']>
|
|
69
|
-
expectTypeOf<DivMatchesCurrentTarget>().toEqualTypeOf<false>()
|
|
70
|
-
})
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
// =============================================================================
|
|
74
|
-
// Test: HTML input-specific props
|
|
75
|
-
// =============================================================================
|
|
76
|
-
|
|
77
|
-
describe('Input HTML props', () => {
|
|
78
|
-
test('accepts type prop', () => {
|
|
79
|
-
expectTypeOf<InputProps>().toHaveProperty('type')
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
test('accepts placeholder prop', () => {
|
|
83
|
-
expectTypeOf<InputProps>().toHaveProperty('placeholder')
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
test('accepts value prop', () => {
|
|
87
|
-
expectTypeOf<InputProps>().toHaveProperty('value')
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
test('accepts defaultValue prop', () => {
|
|
91
|
-
expectTypeOf<InputProps>().toHaveProperty('defaultValue')
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
test('accepts maxLength prop', () => {
|
|
95
|
-
expectTypeOf<InputProps>().toHaveProperty('maxLength')
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
test('accepts pattern prop', () => {
|
|
99
|
-
expectTypeOf<InputProps>().toHaveProperty('pattern')
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
test('accepts required prop', () => {
|
|
103
|
-
expectTypeOf<InputProps>().toHaveProperty('required')
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
test('accepts readOnly prop', () => {
|
|
107
|
-
expectTypeOf<InputProps>().toHaveProperty('readOnly')
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
test('accepts autoComplete prop', () => {
|
|
111
|
-
expectTypeOf<InputProps>().toHaveProperty('autoComplete')
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
test('accepts name prop', () => {
|
|
115
|
-
expectTypeOf<InputProps>().toHaveProperty('name')
|
|
116
|
-
})
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
// =============================================================================
|
|
120
|
-
// Test: Tamagui style props still work
|
|
121
|
-
// =============================================================================
|
|
122
|
-
|
|
123
|
-
describe('Input style props', () => {
|
|
124
|
-
test('accepts padding style prop', () => {
|
|
125
|
-
expectTypeOf<InputProps>().toHaveProperty('padding')
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
test('accepts backgroundColor style prop', () => {
|
|
129
|
-
expectTypeOf<InputProps>().toHaveProperty('backgroundColor')
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
test('accepts borderRadius style prop', () => {
|
|
133
|
-
expectTypeOf<InputProps>().toHaveProperty('borderRadius')
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
test('accepts text style props', () => {
|
|
137
|
-
expectTypeOf<InputProps>().toHaveProperty('fontSize')
|
|
138
|
-
expectTypeOf<InputProps>().toHaveProperty('fontWeight')
|
|
139
|
-
expectTypeOf<InputProps>().toHaveProperty('color')
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
// textAlign must be a real base style prop so the `text` shorthand (text ->
|
|
143
|
-
// textAlign) can resolve to it. the shorthand itself is config-dependent, so
|
|
144
|
-
// it's exercised in kitchen-sink (InputTextShorthandType) where a config with
|
|
145
|
-
// the v4/v5 shorthands is registered.
|
|
146
|
-
test('accepts textAlign longhand', () => {
|
|
147
|
-
expectTypeOf<'center'>().toMatchTypeOf<NonNullable<InputProps['textAlign']>>()
|
|
148
|
-
})
|
|
149
|
-
|
|
150
|
-
test('accepts size variant', () => {
|
|
151
|
-
expectTypeOf<InputProps>().toHaveProperty('size')
|
|
152
|
-
})
|
|
153
|
-
|
|
154
|
-
test('accepts unstyled variant', () => {
|
|
155
|
-
expectTypeOf<InputProps>().toHaveProperty('unstyled')
|
|
156
|
-
})
|
|
157
|
-
})
|
|
158
|
-
|
|
159
|
-
// =============================================================================
|
|
160
|
-
// Test: cross-platform props
|
|
161
|
-
// =============================================================================
|
|
162
|
-
|
|
163
|
-
describe('Input cross-platform props', () => {
|
|
164
|
-
test('autoCorrect accepts boolean and string', () => {
|
|
165
|
-
expectTypeOf<InputProps['autoCorrect']>().toMatchTypeOf<
|
|
166
|
-
boolean | 'on' | 'off' | undefined
|
|
167
|
-
>()
|
|
168
|
-
})
|
|
169
|
-
|
|
170
|
-
test('autoCapitalize accepts native and web values', () => {
|
|
171
|
-
expectTypeOf<InputProps['autoCapitalize']>().toMatchTypeOf<
|
|
172
|
-
'none' | 'sentences' | 'words' | 'characters' | 'off' | 'on' | undefined
|
|
173
|
-
>()
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
test('accepts onChangeText callback', () => {
|
|
177
|
-
expectTypeOf<InputProps>().toHaveProperty('onChangeText')
|
|
178
|
-
expectTypeOf<NonNullable<InputProps['onChangeText']>>().toMatchTypeOf<
|
|
179
|
-
(text: string) => void
|
|
180
|
-
>()
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
test('accepts onSubmitEditing callback', () => {
|
|
184
|
-
expectTypeOf<InputProps>().toHaveProperty('onSubmitEditing')
|
|
185
|
-
})
|
|
186
|
-
|
|
187
|
-
test('accepts placeholderTextColor', () => {
|
|
188
|
-
expectTypeOf<InputProps>().toHaveProperty('placeholderTextColor')
|
|
189
|
-
})
|
|
190
|
-
|
|
191
|
-
test('accepts selection prop', () => {
|
|
192
|
-
expectTypeOf<InputProps>().toHaveProperty('selection')
|
|
193
|
-
})
|
|
194
|
-
})
|
|
195
|
-
|
|
196
|
-
// =============================================================================
|
|
197
|
-
// Test: InputRef type
|
|
198
|
-
// =============================================================================
|
|
199
|
-
|
|
200
|
-
describe('InputRef type', () => {
|
|
201
|
-
test('InputRef accepts TextInput', () => {
|
|
202
|
-
const _ref: InputRef = {} as TextInput
|
|
203
|
-
})
|
|
204
|
-
|
|
205
|
-
test('InputRef rejects plain HTMLDivElement', () => {
|
|
206
|
-
// @ts-expect-error - HTMLDivElement should not be assignable to InputRef
|
|
207
|
-
const _ref: InputRef = {} as HTMLDivElement
|
|
208
|
-
})
|
|
209
|
-
})
|
|
210
|
-
|
|
211
|
-
// =============================================================================
|
|
212
|
-
// Test: TextArea types
|
|
213
|
-
// =============================================================================
|
|
214
|
-
|
|
215
|
-
describe('TextArea types', () => {
|
|
216
|
-
test('TextArea has rows prop', () => {
|
|
217
|
-
expectTypeOf<TextAreaProps>().toHaveProperty('rows')
|
|
218
|
-
})
|
|
219
|
-
|
|
220
|
-
test('TextArea accepts style props', () => {
|
|
221
|
-
expectTypeOf<TextAreaProps>().toHaveProperty('padding')
|
|
222
|
-
expectTypeOf<TextAreaProps>().toHaveProperty('fontSize')
|
|
223
|
-
})
|
|
224
|
-
|
|
225
|
-
test('TextArea accepts HTML input props', () => {
|
|
226
|
-
expectTypeOf<TextAreaProps>().toHaveProperty('placeholder')
|
|
227
|
-
expectTypeOf<TextAreaProps>().toHaveProperty('value')
|
|
228
|
-
})
|
|
229
|
-
})
|
|
230
|
-
|
|
231
|
-
// =============================================================================
|
|
232
|
-
// Test: InputProps derived from GetProps (not manually defined)
|
|
233
|
-
// =============================================================================
|
|
234
|
-
|
|
235
|
-
describe('InputProps derivation', () => {
|
|
236
|
-
test('InputProps equals GetProps<typeof Input>', () => {
|
|
237
|
-
type Derived = GetProps<typeof Input>
|
|
238
|
-
expectTypeOf<InputProps>().toEqualTypeOf<Derived>()
|
|
239
|
-
})
|
|
240
|
-
|
|
241
|
-
test('TextAreaProps equals GetProps<typeof TextArea>', () => {
|
|
242
|
-
type Derived = GetProps<typeof TextArea>
|
|
243
|
-
expectTypeOf<TextAreaProps>().toEqualTypeOf<Derived>()
|
|
244
|
-
})
|
|
245
|
-
})
|