@tamagui/input 1.110.5 → 1.111.0
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.native.js +35 -82
- package/dist/cjs/Input.native.js.map +1 -1
- package/dist/cjs/TextArea.native.js +5 -40
- package/dist/cjs/TextArea.native.js.map +1 -1
- package/dist/cjs/shared.native.js +21 -49
- package/dist/cjs/shared.native.js.map +1 -1
- package/dist/esm/Input.native.js +35 -81
- package/dist/esm/Input.native.js.map +1 -1
- package/dist/esm/Input.native.mjs +100 -0
- package/dist/esm/Input.native.mjs.map +1 -0
- package/dist/esm/TextArea.native.js +4 -38
- package/dist/esm/TextArea.native.js.map +1 -1
- package/dist/esm/TextArea.native.mjs +27 -0
- package/dist/esm/TextArea.native.mjs.map +1 -0
- package/dist/esm/index.native.mjs +3 -0
- package/dist/esm/index.native.mjs.map +1 -0
- package/dist/esm/shared.native.js +21 -48
- package/dist/esm/shared.native.js.map +1 -1
- package/dist/esm/shared.native.mjs +106 -0
- package/dist/esm/shared.native.mjs.map +1 -0
- package/dist/esm/types.native.mjs +2 -0
- package/dist/esm/types.native.mjs.map +1 -0
- package/dist/jsx/Input.native.js +34 -80
- package/dist/jsx/Input.native.js.map +1 -1
- package/dist/jsx/TextArea.native.js +4 -38
- package/dist/jsx/TextArea.native.js.map +1 -1
- package/dist/jsx/shared.native.js +21 -48
- package/dist/jsx/shared.native.js.map +1 -1
- package/package.json +11 -11
package/dist/cjs/Input.native.js
CHANGED
|
@@ -26,87 +26,39 @@ __export(Input_native_exports, {
|
|
|
26
26
|
Input: () => Input
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(Input_native_exports);
|
|
29
|
-
var import_jsx_runtime = require("react/jsx-runtime"), import_react = __toESM(require("react")), import_core = require("@tamagui/core"), import_focusable = require("@tamagui/focusable"), import_react_native = require("react-native"), import_shared = require("./shared")
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
})), keys.push.apply(keys, symbols);
|
|
56
|
-
}
|
|
57
|
-
return keys;
|
|
58
|
-
}
|
|
59
|
-
function _object_spread_props(target, source) {
|
|
60
|
-
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
61
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
62
|
-
}), target;
|
|
63
|
-
}
|
|
64
|
-
function _object_without_properties(source, excluded) {
|
|
65
|
-
if (source == null) return {};
|
|
66
|
-
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
67
|
-
if (Object.getOwnPropertySymbols) {
|
|
68
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
69
|
-
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
70
|
-
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
71
|
-
}
|
|
72
|
-
return target;
|
|
73
|
-
}
|
|
74
|
-
function _object_without_properties_loose(source, excluded) {
|
|
75
|
-
if (source == null) return {};
|
|
76
|
-
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
77
|
-
for (i = 0; i < sourceKeys.length; i++)
|
|
78
|
-
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
79
|
-
return target;
|
|
80
|
-
}
|
|
81
|
-
var StyledInput = (0, import_core.styled)(import_react_native.TextInput, import_shared.styledBody[0], import_shared.styledBody[1]), Input = StyledInput.styleable(function(inProps, forwardedRef) {
|
|
82
|
-
var type = inProps.type, dirname = inProps.dirname, max = inProps.max, min = inProps.min, minLength = inProps.minLength, multiple = inProps.multiple, name = inProps.name, required = inProps.required, step = inProps.step, disabled = inProps.disabled, id = inProps.id, caretColor = inProps.caretColor, onChange = inProps.onChange, onInput = inProps.onInput, rows = inProps.rows, enterKeyHint = inProps.enterKeyHint, returnKeyType = inProps.returnKeyType, onKeyDown = inProps.onKeyDown, inputMode = inProps.inputMode, tag = inProps.tag, rest = _object_without_properties(inProps, [
|
|
83
|
-
"type",
|
|
84
|
-
"dirname",
|
|
85
|
-
"max",
|
|
86
|
-
"min",
|
|
87
|
-
"minLength",
|
|
88
|
-
"multiple",
|
|
89
|
-
"name",
|
|
90
|
-
"required",
|
|
91
|
-
"step",
|
|
92
|
-
"disabled",
|
|
93
|
-
"id",
|
|
94
|
-
"caretColor",
|
|
95
|
-
"onChange",
|
|
96
|
-
"onInput",
|
|
97
|
-
"rows",
|
|
98
|
-
"enterKeyHint",
|
|
99
|
-
"returnKeyType",
|
|
100
|
-
"onKeyDown",
|
|
101
|
-
"inputMode",
|
|
102
|
-
"tag"
|
|
103
|
-
]), ref = import_react.default.useRef(null), composedRefs = (0, import_core.useComposedRefs)(forwardedRef, ref), secureTextEntry = !1, cursorColor = caretColor, _returnKeyType = returnKeyType, _enterKeyHint = enterKeyHint;
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime"), import_react = __toESM(require("react")), import_core = require("@tamagui/core"), import_focusable = require("@tamagui/focusable"), import_react_native = require("react-native"), import_shared = require("./shared"), StyledInput = (0, import_core.styled)(import_react_native.TextInput, import_shared.styledBody[0], import_shared.styledBody[1]), Input = StyledInput.styleable(function(inProps, forwardedRef) {
|
|
30
|
+
var {
|
|
31
|
+
// some of destructed props are just to avoid passing them to ...rest because they are not in native.
|
|
32
|
+
type,
|
|
33
|
+
//@ts-ignore
|
|
34
|
+
dirname,
|
|
35
|
+
max,
|
|
36
|
+
min,
|
|
37
|
+
minLength,
|
|
38
|
+
multiple,
|
|
39
|
+
name,
|
|
40
|
+
required,
|
|
41
|
+
step,
|
|
42
|
+
disabled,
|
|
43
|
+
id,
|
|
44
|
+
caretColor,
|
|
45
|
+
onChange,
|
|
46
|
+
onInput,
|
|
47
|
+
rows,
|
|
48
|
+
enterKeyHint,
|
|
49
|
+
returnKeyType,
|
|
50
|
+
onKeyDown,
|
|
51
|
+
inputMode,
|
|
52
|
+
tag,
|
|
53
|
+
...rest
|
|
54
|
+
} = inProps, ref = import_react.default.useRef(null), composedRefs = (0, import_core.useComposedRefs)(forwardedRef, ref), secureTextEntry = !1, cursorColor = caretColor, _returnKeyType = returnKeyType, _enterKeyHint = enterKeyHint;
|
|
104
55
|
enterKeyHint === "go" && (_returnKeyType = "go", _enterKeyHint = void 0);
|
|
105
56
|
var _inputMode = inputMode;
|
|
106
57
|
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";
|
|
107
58
|
var showSoftInputOnFocus = !0;
|
|
108
59
|
inputMode === "none" && (showSoftInputOnFocus = !1);
|
|
109
|
-
var finalProps =
|
|
60
|
+
var finalProps = {
|
|
61
|
+
...rest,
|
|
110
62
|
inputMode: _inputMode,
|
|
111
63
|
showSoftInputOnFocus,
|
|
112
64
|
disabled,
|
|
@@ -116,9 +68,9 @@ var StyledInput = (0, import_core.styled)(import_react_native.TextInput, import_
|
|
|
116
68
|
returnKeyType: _returnKeyType,
|
|
117
69
|
secureTextEntry,
|
|
118
70
|
numberOfLines: rows || rest.numberOfLines
|
|
119
|
-
}
|
|
71
|
+
};
|
|
120
72
|
return tag === "textarea" && (finalProps.multiline = !0), onKeyDown && (finalProps.onKeyPress = function(e) {
|
|
121
|
-
var key = e.nativeEvent
|
|
73
|
+
var { key } = e.nativeEvent;
|
|
122
74
|
(key === "Backspace" || tag === "textarea" && key === "Enter" || key.length === 1) && onKeyDown({
|
|
123
75
|
key,
|
|
124
76
|
type: "keydown"
|
|
@@ -129,7 +81,7 @@ var StyledInput = (0, import_core.styled)(import_react_native.TextInput, import_
|
|
|
129
81
|
type: "keydown"
|
|
130
82
|
});
|
|
131
83
|
}), (onChange || onInput) && (finalProps.onChange = function(e) {
|
|
132
|
-
var text = e.nativeEvent
|
|
84
|
+
var { text } = e.nativeEvent;
|
|
133
85
|
onChange && onChange({
|
|
134
86
|
target: {
|
|
135
87
|
value: text
|
|
@@ -154,11 +106,12 @@ var StyledInput = (0, import_core.styled)(import_react_native.TextInput, import_
|
|
|
154
106
|
}, [
|
|
155
107
|
id,
|
|
156
108
|
disabled
|
|
157
|
-
]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledInput,
|
|
109
|
+
]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledInput, {
|
|
158
110
|
onChange: function(e) {
|
|
159
111
|
},
|
|
160
|
-
ref: composedRefs
|
|
161
|
-
|
|
112
|
+
ref: composedRefs,
|
|
113
|
+
...finalProps
|
|
114
|
+
});
|
|
162
115
|
});
|
|
163
116
|
// Annotate the CommonJS export names for ESM import in node:
|
|
164
117
|
0 && (module.exports = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/ui/input/src/Input.native.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAAA,eAAkB,2BAClB,cAAwC,0BACxC,mBAAkC,+BAGlC,sBAA0B,yBAC1B,gBAA2B
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAAA,eAAkB,2BAClB,cAAwC,0BACxC,mBAAkC,+BAGlC,sBAA0B,yBAC1B,gBAA2B,qBAErBA,kBAAcC,oBAAOC,+BAAWC,y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Y,YAAYC,aACdoB,WAAWrB,WAAW,SAACyB,GAAAA;AACrB,QAAM,EAAEK,KAAI,IAAKL,EAAEE;AACnB,IAAI3B,YACFA,SAAS;MACP+B,QAAQ;QACNC,OAAOF;MACT;MACA1C,MAAM;IACR,CAAA,GAEEa,WAAW,QACbA,QAAQ;MACN8B,QAAQ;QACNC,OAAOF;MACT;MACA1C,MAAM;IACR,CAAA;EAEJ,IAGFsB,aAAAA,QAAMuB,UAAU,WAAA;AACd,QAAKnC,MACDD;AAEJ,iBAAOqC,oCAAkBpC,IAAI;QAC3BqC,gBAAgB,WAAA;cACd1B;WAAAA,eAAAA,IAAI2B,aAAO,QAAX3B,iBAAAA,UAAAA,aAAa4B,MAAK;QACpB;QACAA,OAAO,WAAA;QAAO;MAChB,CAAA;EACF,GAAG;IAACvC;IAAID;GAAS,GACV,uCAAAyC,KAAC1D,aAAAA;IAAYoB,UAAU,SAACyB,GAAAA;IAAO;IAAGhB,KAAKG;IAAe,GAAGS;;AAClE,CAAA;",
|
|
5
5
|
"names": ["StyledInput", "styled", "TextInput", "styledBody", "Input", "styleable", "inProps", "forwardedRef", "type", "dirname", "max", "min", "minLength", "multiple", "name", "required", "step", "disabled", "id", "caretColor", "onChange", "onInput", "rows", "enterKeyHint", "returnKeyType", "onKeyDown", "inputMode", "tag", "rest", "ref", "React", "useRef", "composedRefs", "useComposedRefs", "secureTextEntry", "cursorColor", "_returnKeyType", "_enterKeyHint", "undefined", "_inputMode", "showSoftInputOnFocus", "finalProps", "numberOfLines", "multiline", "onKeyPress", "e", "key", "nativeEvent", "length", "onSubmitEditing", "text", "target", "value", "useEffect", "registerFocusable", "focusAndSelect", "current", "focus", "_jsx"]
|
|
6
6
|
}
|
|
@@ -18,42 +18,7 @@ __export(TextArea_exports, {
|
|
|
18
18
|
TextArea: () => TextArea
|
|
19
19
|
});
|
|
20
20
|
module.exports = __toCommonJS(TextArea_exports);
|
|
21
|
-
var import_web = require("@tamagui/web"), import_Input = require("./Input"), import_shared = require("./shared")
|
|
22
|
-
function _define_property(obj, key, value) {
|
|
23
|
-
return key in obj ? Object.defineProperty(obj, key, {
|
|
24
|
-
value,
|
|
25
|
-
enumerable: !0,
|
|
26
|
-
configurable: !0,
|
|
27
|
-
writable: !0
|
|
28
|
-
}) : obj[key] = value, obj;
|
|
29
|
-
}
|
|
30
|
-
function _object_spread(target) {
|
|
31
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
32
|
-
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
33
|
-
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
34
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
35
|
-
}))), ownKeys2.forEach(function(key) {
|
|
36
|
-
_define_property(target, key, source[key]);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
return target;
|
|
40
|
-
}
|
|
41
|
-
function ownKeys(object, enumerableOnly) {
|
|
42
|
-
var keys = Object.keys(object);
|
|
43
|
-
if (Object.getOwnPropertySymbols) {
|
|
44
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
45
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
46
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
47
|
-
})), keys.push.apply(keys, symbols);
|
|
48
|
-
}
|
|
49
|
-
return keys;
|
|
50
|
-
}
|
|
51
|
-
function _object_spread_props(target, source) {
|
|
52
|
-
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
53
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
54
|
-
}), target;
|
|
55
|
-
}
|
|
56
|
-
var TextArea = (0, import_web.styled)(import_Input.Input, {
|
|
21
|
+
var import_web = require("@tamagui/web"), import_Input = require("./Input"), import_shared = require("./shared"), TextArea = (0, import_web.styled)(import_Input.Input, {
|
|
57
22
|
name: "TextArea",
|
|
58
23
|
tag: "textarea",
|
|
59
24
|
// this attribute fixes firefox newline issue
|
|
@@ -61,11 +26,11 @@ var TextArea = (0, import_web.styled)(import_Input.Input, {
|
|
|
61
26
|
whiteSpace: "pre-wrap",
|
|
62
27
|
variants: {
|
|
63
28
|
unstyled: {
|
|
64
|
-
false:
|
|
65
|
-
height: "auto"
|
|
66
|
-
|
|
29
|
+
false: {
|
|
30
|
+
height: "auto",
|
|
31
|
+
...import_shared.defaultStyles,
|
|
67
32
|
numberOfLines: 3
|
|
68
|
-
}
|
|
33
|
+
}
|
|
69
34
|
},
|
|
70
35
|
size: {
|
|
71
36
|
"...size": import_shared.textAreaSizeVariant
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/ui/input/src/TextArea.tsx"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;;;;;iBAAuB,yBACvB,eAAsB,oBACtB,gBAAmD,qBAEtCA,eAAWC,mBAAOC,oBAAO;EACpCC,MAAM;EACNC,KAAK;;;EAILC,YAAY;EAEZC,UAAU;IACRC,UAAU;MACRC,OAAO;QACLC,QAAQ;QACR,GAAGC;QACHC,eAAe;MACjB;IACF;IAEAC,MAAM;MACJ,WAAWC;IACb;EACF;EAEAC,iBAAiB;IACfP,UAAUQ,QAAQC,IAAIC,qBAAqB;EAC7C;AACF,CAAA;",
|
|
5
5
|
"names": ["TextArea", "styled", "Input", "name", "tag", "whiteSpace", "variants", "unstyled", "false", "height", "defaultStyles", "numberOfLines", "size", "textAreaSizeVariant", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS"]
|
|
6
6
|
}
|
|
@@ -22,52 +22,17 @@ __export(shared_exports, {
|
|
|
22
22
|
textAreaSizeVariant: () => textAreaSizeVariant
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(shared_exports);
|
|
25
|
-
var import_core = require("@tamagui/core"), import_core2 = require("@tamagui/core"), import_get_button_sized = require("@tamagui/get-button-sized"), import_get_font_sized = require("@tamagui/get-font-sized"), import_get_token = require("@tamagui/get-token")
|
|
26
|
-
function _define_property(obj, key, value) {
|
|
27
|
-
return key in obj ? Object.defineProperty(obj, key, {
|
|
28
|
-
value,
|
|
29
|
-
enumerable: !0,
|
|
30
|
-
configurable: !0,
|
|
31
|
-
writable: !0
|
|
32
|
-
}) : obj[key] = value, obj;
|
|
33
|
-
}
|
|
34
|
-
function _object_spread(target) {
|
|
35
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
36
|
-
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
37
|
-
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
38
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
39
|
-
}))), ownKeys2.forEach(function(key) {
|
|
40
|
-
_define_property(target, key, source[key]);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
return target;
|
|
44
|
-
}
|
|
45
|
-
function ownKeys(object, enumerableOnly) {
|
|
46
|
-
var keys = Object.keys(object);
|
|
47
|
-
if (Object.getOwnPropertySymbols) {
|
|
48
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
49
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
50
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
51
|
-
})), keys.push.apply(keys, symbols);
|
|
52
|
-
}
|
|
53
|
-
return keys;
|
|
54
|
-
}
|
|
55
|
-
function _object_spread_props(target, source) {
|
|
56
|
-
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
57
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
58
|
-
}), target;
|
|
59
|
-
}
|
|
60
|
-
var defaultStyles = _object_spread_props(_object_spread({
|
|
25
|
+
var import_core = require("@tamagui/core"), import_core2 = require("@tamagui/core"), import_get_button_sized = require("@tamagui/get-button-sized"), import_get_font_sized = require("@tamagui/get-font-sized"), import_get_token = require("@tamagui/get-token"), defaultStyles = {
|
|
61
26
|
size: "$true",
|
|
62
27
|
fontFamily: "$body",
|
|
63
28
|
borderWidth: 1,
|
|
64
29
|
outlineWidth: 0,
|
|
65
|
-
color: "$color"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
} : {
|
|
69
|
-
|
|
70
|
-
}
|
|
30
|
+
color: "$color",
|
|
31
|
+
...import_core2.isWeb ? {
|
|
32
|
+
tabIndex: 0
|
|
33
|
+
} : {
|
|
34
|
+
focusable: !0
|
|
35
|
+
},
|
|
71
36
|
borderColor: "$borderColor",
|
|
72
37
|
backgroundColor: "$background",
|
|
73
38
|
// this fixes a flex bug where it overflows container
|
|
@@ -83,7 +48,7 @@ var defaultStyles = _object_spread_props(_object_spread({
|
|
|
83
48
|
outlineWidth: 2,
|
|
84
49
|
outlineStyle: "solid"
|
|
85
50
|
}
|
|
86
|
-
}
|
|
51
|
+
}, inputSizeVariant = function() {
|
|
87
52
|
var val = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "$true", extras = arguments.length > 1 ? arguments[1] : void 0;
|
|
88
53
|
if (extras.props.multiline || extras.props.numberOfLines > 1)
|
|
89
54
|
return textAreaSizeVariant(val, extras);
|
|
@@ -93,11 +58,13 @@ var defaultStyles = _object_spread_props(_object_spread({
|
|
|
93
58
|
2
|
|
94
59
|
]
|
|
95
60
|
}), fontStyle = (0, import_get_font_sized.getFontSized)(val, extras);
|
|
96
|
-
return !import_core2.isWeb && fontStyle && delete fontStyle.lineHeight,
|
|
61
|
+
return !import_core2.isWeb && fontStyle && delete fontStyle.lineHeight, {
|
|
62
|
+
...fontStyle,
|
|
63
|
+
...buttonStyles,
|
|
97
64
|
paddingHorizontal
|
|
98
|
-
}
|
|
65
|
+
};
|
|
99
66
|
}, textAreaSizeVariant = function() {
|
|
100
|
-
var val = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "$true", extras = arguments.length > 1 ? arguments[1] : void 0, props = extras
|
|
67
|
+
var val = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "$true", extras = arguments.length > 1 ? arguments[1] : void 0, { props } = extras, buttonStyles = (0, import_get_button_sized.getButtonSized)(val, extras), fontStyle = (0, import_get_font_sized.getFontSized)(val, extras), _props_rows, lines = (_props_rows = props.rows) !== null && _props_rows !== void 0 ? _props_rows : props.numberOfLines, height = typeof lines == "number" ? lines * (0, import_core2.getVariableValue)(fontStyle.lineHeight) : "auto", paddingVertical = (0, import_get_token.getSpace)(val, {
|
|
101
68
|
shift: -2,
|
|
102
69
|
bounds: [
|
|
103
70
|
2
|
|
@@ -108,11 +75,13 @@ var defaultStyles = _object_spread_props(_object_spread({
|
|
|
108
75
|
2
|
|
109
76
|
]
|
|
110
77
|
});
|
|
111
|
-
return
|
|
78
|
+
return {
|
|
79
|
+
...buttonStyles,
|
|
80
|
+
...fontStyle,
|
|
112
81
|
paddingVertical,
|
|
113
82
|
paddingHorizontal,
|
|
114
83
|
height
|
|
115
|
-
}
|
|
84
|
+
};
|
|
116
85
|
}, INPUT_NAME = "Input", styledBody = [
|
|
117
86
|
{
|
|
118
87
|
name: INPUT_NAME,
|
|
@@ -138,7 +107,10 @@ var defaultStyles = _object_spread_props(_object_spread({
|
|
|
138
107
|
placeholderTextColor: "color",
|
|
139
108
|
selectionColor: "color"
|
|
140
109
|
},
|
|
141
|
-
validStyles:
|
|
110
|
+
validStyles: {
|
|
111
|
+
...import_core.validStyles,
|
|
112
|
+
...import_core.stylePropsTextOnly
|
|
113
|
+
}
|
|
142
114
|
}
|
|
143
115
|
];
|
|
144
116
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,6 +1,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EAAEC,MAAK,IAAKD,QACZK,mBAAeC,wCAAeP,KAAKC,MAAAA,GACnCW,gBAAYC,oCAAab,KAAYC,MAAAA,GAC7BC,aAARY,SAAQZ,cAAAA,MAAMa,UAAI,QAAVb,gBAAAA,SAAAA,cAAcA,MAAME,eAC5BY,SACJ,OAAOF,SAAU,WAAWA,YAAQG,+BAAiBL,UAAUM,UAAU,IAAI,QACzEC,sBAAkBV,2BAAST,KAAK;IACpCU,OAAO;IACPC,QAAQ;MAAC;;EACX,CAAA,GACMH,wBAAoBC,2BAAST,KAAK;IACtCU,OAAO;IACPC,QAAQ;MAAC;;EACX,CAAA;AACA,SAAO;IACL,GAAGL;IACH,GAAGM;IACHO;IACAX;IACAQ;EACF;AACF,GACaI,aAAa,SAEbC,aAAa;EACxB;IACEC,MAAMF;IACNG,KAAK;IACLC,UAAU;MACRC,UAAU;QACRC,OAAO5C;MACT;MAEAC,MAAM;QACJ,WAAWgB;MACb;MAEA4B,UAAU;QACRC,MAAM,CAAC;MACT;IACF;IAEAC,iBAAiB;MACfJ,UAAUK,QAAQC,IAAIC,qBAAqB;IAC7C;EACF;EACA;IACEC,SAAS;IACTC,QAAQ;MACNC,sBAAsB;MACtBC,gBAAgB;IAClB;IACAC,aAAa;MACX,GAAGA;MACH,GAAGC;IACL;EACF;;",
|
|
5
5
|
"names": ["import_core", "defaultStyles", "size", "fontFamily", "borderWidth", "outlineWidth", "color", "isWeb", "tabIndex", "focusable", "borderColor", "backgroundColor", "minWidth", "hoverStyle", "focusStyle", "focusVisibleStyle", "outlineColor", "outlineStyle", "inputSizeVariant", "val", "extras", "props", "multiline", "numberOfLines", "textAreaSizeVariant", "buttonStyles", "getButtonSized", "paddingHorizontal", "getSpace", "shift", "bounds", "fontStyle", "getFontSized", "lines", "rows", "height", "getVariableValue", "lineHeight", "paddingVertical", "INPUT_NAME", "styledBody", "name", "tag", "variants", "unstyled", "false", "disabled", "true", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS", "isInput", "accept", "placeholderTextColor", "selectionColor", "validStyles", "stylePropsTextOnly"]
|
|
6
6
|
}
|
package/dist/esm/Input.native.js
CHANGED
|
@@ -4,86 +4,39 @@ import { styled, useComposedRefs } from "@tamagui/core";
|
|
|
4
4
|
import { registerFocusable } from "@tamagui/focusable";
|
|
5
5
|
import { TextInput } from "react-native";
|
|
6
6
|
import { styledBody } from "./shared";
|
|
7
|
-
function _define_property(obj, key, value) {
|
|
8
|
-
return key in obj ? Object.defineProperty(obj, key, {
|
|
9
|
-
value,
|
|
10
|
-
enumerable: !0,
|
|
11
|
-
configurable: !0,
|
|
12
|
-
writable: !0
|
|
13
|
-
}) : obj[key] = value, obj;
|
|
14
|
-
}
|
|
15
|
-
function _object_spread(target) {
|
|
16
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
17
|
-
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
18
|
-
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
19
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
20
|
-
}))), ownKeys2.forEach(function(key) {
|
|
21
|
-
_define_property(target, key, source[key]);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
return target;
|
|
25
|
-
}
|
|
26
|
-
function ownKeys(object, enumerableOnly) {
|
|
27
|
-
var keys = Object.keys(object);
|
|
28
|
-
if (Object.getOwnPropertySymbols) {
|
|
29
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
30
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
31
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
32
|
-
})), keys.push.apply(keys, symbols);
|
|
33
|
-
}
|
|
34
|
-
return keys;
|
|
35
|
-
}
|
|
36
|
-
function _object_spread_props(target, source) {
|
|
37
|
-
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
38
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
39
|
-
}), target;
|
|
40
|
-
}
|
|
41
|
-
function _object_without_properties(source, excluded) {
|
|
42
|
-
if (source == null) return {};
|
|
43
|
-
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
44
|
-
if (Object.getOwnPropertySymbols) {
|
|
45
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
46
|
-
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
47
|
-
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
48
|
-
}
|
|
49
|
-
return target;
|
|
50
|
-
}
|
|
51
|
-
function _object_without_properties_loose(source, excluded) {
|
|
52
|
-
if (source == null) return {};
|
|
53
|
-
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
54
|
-
for (i = 0; i < sourceKeys.length; i++)
|
|
55
|
-
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
56
|
-
return target;
|
|
57
|
-
}
|
|
58
7
|
var StyledInput = styled(TextInput, styledBody[0], styledBody[1]), Input = StyledInput.styleable(function(inProps, forwardedRef) {
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
8
|
+
var {
|
|
9
|
+
// some of destructed props are just to avoid passing them to ...rest because they are not in native.
|
|
10
|
+
type,
|
|
11
|
+
//@ts-ignore
|
|
12
|
+
dirname,
|
|
13
|
+
max,
|
|
14
|
+
min,
|
|
15
|
+
minLength,
|
|
16
|
+
multiple,
|
|
17
|
+
name,
|
|
18
|
+
required,
|
|
19
|
+
step,
|
|
20
|
+
disabled,
|
|
21
|
+
id,
|
|
22
|
+
caretColor,
|
|
23
|
+
onChange,
|
|
24
|
+
onInput,
|
|
25
|
+
rows,
|
|
26
|
+
enterKeyHint,
|
|
27
|
+
returnKeyType,
|
|
28
|
+
onKeyDown,
|
|
29
|
+
inputMode,
|
|
30
|
+
tag,
|
|
31
|
+
...rest
|
|
32
|
+
} = inProps, ref = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, ref), secureTextEntry = !1, cursorColor = caretColor, _returnKeyType = returnKeyType, _enterKeyHint = enterKeyHint;
|
|
81
33
|
enterKeyHint === "go" && (_returnKeyType = "go", _enterKeyHint = void 0);
|
|
82
34
|
var _inputMode = inputMode;
|
|
83
35
|
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";
|
|
84
36
|
var showSoftInputOnFocus = !0;
|
|
85
37
|
inputMode === "none" && (showSoftInputOnFocus = !1);
|
|
86
|
-
var finalProps =
|
|
38
|
+
var finalProps = {
|
|
39
|
+
...rest,
|
|
87
40
|
inputMode: _inputMode,
|
|
88
41
|
showSoftInputOnFocus,
|
|
89
42
|
disabled,
|
|
@@ -93,9 +46,9 @@ var StyledInput = styled(TextInput, styledBody[0], styledBody[1]), Input = Style
|
|
|
93
46
|
returnKeyType: _returnKeyType,
|
|
94
47
|
secureTextEntry,
|
|
95
48
|
numberOfLines: rows || rest.numberOfLines
|
|
96
|
-
}
|
|
49
|
+
};
|
|
97
50
|
return tag === "textarea" && (finalProps.multiline = !0), onKeyDown && (finalProps.onKeyPress = function(e) {
|
|
98
|
-
var key = e.nativeEvent
|
|
51
|
+
var { key } = e.nativeEvent;
|
|
99
52
|
(key === "Backspace" || tag === "textarea" && key === "Enter" || key.length === 1) && onKeyDown({
|
|
100
53
|
key,
|
|
101
54
|
type: "keydown"
|
|
@@ -106,13 +59,13 @@ var StyledInput = styled(TextInput, styledBody[0], styledBody[1]), Input = Style
|
|
|
106
59
|
type: "keydown"
|
|
107
60
|
});
|
|
108
61
|
}), (onChange || onInput) && (finalProps.onChange = function(e) {
|
|
109
|
-
var text = e.nativeEvent
|
|
62
|
+
var { text } = e.nativeEvent;
|
|
110
63
|
onChange && onChange({
|
|
111
64
|
target: {
|
|
112
65
|
value: text
|
|
113
66
|
},
|
|
114
67
|
type: "change"
|
|
115
|
-
}), onInput
|
|
68
|
+
}), onInput?.({
|
|
116
69
|
target: {
|
|
117
70
|
value: text
|
|
118
71
|
},
|
|
@@ -131,11 +84,12 @@ var StyledInput = styled(TextInput, styledBody[0], styledBody[1]), Input = Style
|
|
|
131
84
|
}, [
|
|
132
85
|
id,
|
|
133
86
|
disabled
|
|
134
|
-
]), /* @__PURE__ */ _jsx(StyledInput,
|
|
87
|
+
]), /* @__PURE__ */ _jsx(StyledInput, {
|
|
135
88
|
onChange: function(e) {
|
|
136
89
|
},
|
|
137
|
-
ref: composedRefs
|
|
138
|
-
|
|
90
|
+
ref: composedRefs,
|
|
91
|
+
...finalProps
|
|
92
|
+
});
|
|
139
93
|
});
|
|
140
94
|
export {
|
|
141
95
|
Input
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/ui/input/src/Input.native.tsx"],
|
|
4
|
-
"mappings": ";AAAA,OAAOA,WAAW;AAClB,SAASC,QAAQC,uBAAuB;AACxC,SAASC,yBAAyB;AAGlC,SAASC,iBAAiB;AAC1B,SAASC,kBAAkB
|
|
4
|
+
"mappings": ";AAAA,OAAOA,WAAW;AAClB,SAASC,QAAQC,uBAAuB;AACxC,SAASC,yBAAyB;AAGlC,SAASC,iBAAiB;AAC1B,SAASC,kBAAkB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M;IACR,CAAA;EACF,KAGEY,YAAYC,aACdkB,WAAWnB,WAAW,SAACuB,GAAAA;AACrB,QAAM,EAAEK,KAAI,IAAKL,EAAEE;AACnB,IAAIzB,YACFA,SAAS;MACP6B,QAAQ;QACNC,OAAOF;MACT;MACAxC,MAAM;IACR,CAAA,GAGAa,UAAQ;MACN4B,QAAQ;QACNC,OAAOF;MACT;MACAxC,MAAM;IACR,CAAA;EAEJ,IAGFX,MAAMsD,UAAU,WAAA;AACd,QAAKjC,MACDD;AAEJ,aAAOjB,kBAAkBkB,IAAI;QAC3BkC,gBAAgB,WAAA;cACdvB;WAAAA,eAAAA,IAAIwB,aAAO,QAAXxB,iBAAAA,UAAAA,aAAayB,MAAK;QACpB;QACAA,OAAO,WAAA;QAAO;MAChB,CAAA;EACF,GAAG;IAACpC;IAAID;GAAS,GACV,qBAACd,aAAAA;IAAYiB,UAAU,SAACuB,GAAAA;IAAO;IAAGd,KAAKE;IAAe,GAAGQ;;AAClE,CAAA;",
|
|
5
5
|
"names": ["React", "styled", "useComposedRefs", "registerFocusable", "TextInput", "styledBody", "StyledInput", "Input", "styleable", "inProps", "forwardedRef", "type", "dirname", "max", "min", "minLength", "multiple", "name", "required", "step", "disabled", "id", "caretColor", "onChange", "onInput", "rows", "enterKeyHint", "returnKeyType", "onKeyDown", "inputMode", "tag", "rest", "ref", "useRef", "composedRefs", "secureTextEntry", "cursorColor", "_returnKeyType", "_enterKeyHint", "undefined", "_inputMode", "showSoftInputOnFocus", "finalProps", "numberOfLines", "multiline", "onKeyPress", "e", "key", "nativeEvent", "length", "onSubmitEditing", "text", "target", "value", "useEffect", "focusAndSelect", "current", "focus"]
|
|
6
6
|
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { styled, useComposedRefs } from "@tamagui/core";
|
|
4
|
+
import { registerFocusable } from "@tamagui/focusable";
|
|
5
|
+
import { TextInput } from "react-native";
|
|
6
|
+
import { styledBody } from "./shared.mjs";
|
|
7
|
+
var StyledInput = styled(TextInput, styledBody[0], styledBody[1]),
|
|
8
|
+
Input = StyledInput.styleable(function (inProps, forwardedRef) {
|
|
9
|
+
var {
|
|
10
|
+
// some of destructed props are just to avoid passing them to ...rest because they are not in native.
|
|
11
|
+
type,
|
|
12
|
+
//@ts-ignore
|
|
13
|
+
dirname,
|
|
14
|
+
max,
|
|
15
|
+
min,
|
|
16
|
+
minLength,
|
|
17
|
+
multiple,
|
|
18
|
+
name,
|
|
19
|
+
required,
|
|
20
|
+
step,
|
|
21
|
+
disabled,
|
|
22
|
+
id,
|
|
23
|
+
caretColor,
|
|
24
|
+
onChange,
|
|
25
|
+
onInput,
|
|
26
|
+
rows,
|
|
27
|
+
enterKeyHint,
|
|
28
|
+
returnKeyType,
|
|
29
|
+
onKeyDown,
|
|
30
|
+
inputMode,
|
|
31
|
+
tag,
|
|
32
|
+
...rest
|
|
33
|
+
} = inProps,
|
|
34
|
+
ref = React.useRef(null),
|
|
35
|
+
composedRefs = useComposedRefs(forwardedRef, ref),
|
|
36
|
+
secureTextEntry = !1,
|
|
37
|
+
cursorColor = caretColor,
|
|
38
|
+
_returnKeyType = returnKeyType,
|
|
39
|
+
_enterKeyHint = enterKeyHint;
|
|
40
|
+
enterKeyHint === "go" && (_returnKeyType = "go", _enterKeyHint = void 0);
|
|
41
|
+
var _inputMode = inputMode;
|
|
42
|
+
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";
|
|
43
|
+
var showSoftInputOnFocus = !0;
|
|
44
|
+
inputMode === "none" && (showSoftInputOnFocus = !1);
|
|
45
|
+
var finalProps = {
|
|
46
|
+
...rest,
|
|
47
|
+
inputMode: _inputMode,
|
|
48
|
+
showSoftInputOnFocus,
|
|
49
|
+
disabled,
|
|
50
|
+
id,
|
|
51
|
+
cursorColor,
|
|
52
|
+
enterKeyHint: _enterKeyHint,
|
|
53
|
+
returnKeyType: _returnKeyType,
|
|
54
|
+
secureTextEntry,
|
|
55
|
+
numberOfLines: rows || rest.numberOfLines
|
|
56
|
+
};
|
|
57
|
+
return tag === "textarea" && (finalProps.multiline = !0), onKeyDown && (finalProps.onKeyPress = function (e) {
|
|
58
|
+
var {
|
|
59
|
+
key
|
|
60
|
+
} = e.nativeEvent;
|
|
61
|
+
(key === "Backspace" || tag === "textarea" && key === "Enter" || key.length === 1) && onKeyDown({
|
|
62
|
+
key,
|
|
63
|
+
type: "keydown"
|
|
64
|
+
});
|
|
65
|
+
}, finalProps.onSubmitEditing = function (e) {
|
|
66
|
+
onKeyDown({
|
|
67
|
+
key: "Enter",
|
|
68
|
+
type: "keydown"
|
|
69
|
+
});
|
|
70
|
+
}), (onChange || onInput) && (finalProps.onChange = function (e) {
|
|
71
|
+
var {
|
|
72
|
+
text
|
|
73
|
+
} = e.nativeEvent;
|
|
74
|
+
onChange && onChange({
|
|
75
|
+
target: {
|
|
76
|
+
value: text
|
|
77
|
+
},
|
|
78
|
+
type: "change"
|
|
79
|
+
}), onInput?.({
|
|
80
|
+
target: {
|
|
81
|
+
value: text
|
|
82
|
+
},
|
|
83
|
+
type: "input"
|
|
84
|
+
});
|
|
85
|
+
}), React.useEffect(function () {
|
|
86
|
+
if (id && !disabled) return registerFocusable(id, {
|
|
87
|
+
focusAndSelect: function () {
|
|
88
|
+
var _ref_current;
|
|
89
|
+
(_ref_current = ref.current) === null || _ref_current === void 0 || _ref_current.focus();
|
|
90
|
+
},
|
|
91
|
+
focus: function () {}
|
|
92
|
+
});
|
|
93
|
+
}, [id, disabled]), /* @__PURE__ */_jsx(StyledInput, {
|
|
94
|
+
onChange: function (e) {},
|
|
95
|
+
ref: composedRefs,
|
|
96
|
+
...finalProps
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
export { Input };
|
|
100
|
+
//# sourceMappingURL=Input.native.mjs.map
|