@tamagui/input 1.97.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/LICENSE +21 -0
- package/dist/cjs/Input.js +137 -0
- package/dist/cjs/Input.js.map +6 -0
- package/dist/cjs/Input.native.js +169 -0
- package/dist/cjs/Input.native.js.map +6 -0
- package/dist/cjs/TextArea.js +42 -0
- package/dist/cjs/TextArea.js.map +6 -0
- package/dist/cjs/TextArea.native.js +81 -0
- package/dist/cjs/TextArea.native.js.map +6 -0
- package/dist/cjs/index.js +16 -0
- package/dist/cjs/index.js.map +6 -0
- package/dist/cjs/index.native.js +22 -0
- package/dist/cjs/index.native.js.map +6 -0
- package/dist/cjs/shared.js +109 -0
- package/dist/cjs/shared.js.map +6 -0
- package/dist/cjs/shared.native.js +152 -0
- package/dist/cjs/shared.native.js.map +6 -0
- package/dist/cjs/types.js +14 -0
- package/dist/cjs/types.js.map +6 -0
- package/dist/cjs/types.native.js +15 -0
- package/dist/cjs/types.native.js.map +6 -0
- package/dist/esm/Input.js +117 -0
- package/dist/esm/Input.js.map +6 -0
- package/dist/esm/Input.mjs +121 -0
- package/dist/esm/Input.native.js +145 -0
- package/dist/esm/Input.native.js.map +6 -0
- package/dist/esm/TextArea.js +28 -0
- package/dist/esm/TextArea.js.map +6 -0
- package/dist/esm/TextArea.mjs +25 -0
- package/dist/esm/TextArea.native.js +62 -0
- package/dist/esm/TextArea.native.js.map +6 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +6 -0
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.native.js +3 -0
- package/dist/esm/index.native.js.map +6 -0
- package/dist/esm/shared.js +97 -0
- package/dist/esm/shared.js.map +6 -0
- package/dist/esm/shared.mjs +100 -0
- package/dist/esm/shared.native.js +131 -0
- package/dist/esm/shared.native.js.map +6 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/types.js.map +6 -0
- package/dist/esm/types.mjs +0 -0
- package/dist/esm/types.native.js +1 -0
- package/dist/esm/types.native.js.map +6 -0
- package/dist/jsx/Input.js +117 -0
- package/dist/jsx/Input.js.map +6 -0
- package/dist/jsx/Input.mjs +121 -0
- package/dist/jsx/Input.native.js +145 -0
- package/dist/jsx/Input.native.js.map +6 -0
- package/dist/jsx/TextArea.js +28 -0
- package/dist/jsx/TextArea.js.map +6 -0
- package/dist/jsx/TextArea.mjs +25 -0
- package/dist/jsx/TextArea.native.js +62 -0
- package/dist/jsx/TextArea.native.js.map +6 -0
- package/dist/jsx/index.js +3 -0
- package/dist/jsx/index.js.map +6 -0
- package/dist/jsx/index.mjs +2 -0
- package/dist/jsx/index.native.js +3 -0
- package/dist/jsx/index.native.js.map +6 -0
- package/dist/jsx/shared.js +97 -0
- package/dist/jsx/shared.js.map +6 -0
- package/dist/jsx/shared.mjs +100 -0
- package/dist/jsx/shared.native.js +131 -0
- package/dist/jsx/shared.native.js.map +6 -0
- package/dist/jsx/types.js +1 -0
- package/dist/jsx/types.js.map +6 -0
- package/dist/jsx/types.mjs +0 -0
- package/dist/jsx/types.native.js +1 -0
- package/dist/jsx/types.native.js.map +6 -0
- package/package.json +55 -0
- package/src/Input.native.tsx +148 -0
- package/src/Input.tsx +142 -0
- package/src/TextArea.tsx +27 -0
- package/src/index.ts +2 -0
- package/src/shared.tsx +129 -0
- package/src/types.ts +59 -0
- package/types/Input.d.ts +293 -0
- package/types/Input.d.ts.map +1 -0
- package/types/Input.native.d.ts +295 -0
- package/types/Input.native.d.ts.map +1 -0
- package/types/TextArea.d.ts +277 -0
- package/types/TextArea.d.ts.map +1 -0
- package/types/index.d.ts +3 -0
- package/types/index.d.ts.map +1 -0
- package/types/shared.d.ts +307 -0
- package/types/shared.d.ts.map +1 -0
- package/types/types.d.ts +40 -0
- package/types/types.d.ts.map +1 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { View, styled, useComposedRefs, useEvent, useTheme } from "@tamagui/core";
|
|
2
|
+
import { registerFocusable } from "@tamagui/focusable";
|
|
3
|
+
import React, { useEffect } from "react";
|
|
4
|
+
import { styledBody } from "./shared.mjs";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
const StyledInput = styled(View, styledBody[0], styledBody[1]),
|
|
7
|
+
Input = StyledInput.styleable((inProps, forwardedRef) => {
|
|
8
|
+
const {
|
|
9
|
+
// some of destructed props are just to avoid passing them to ...rest because they are not in web.
|
|
10
|
+
allowFontScaling,
|
|
11
|
+
selectTextOnFocus,
|
|
12
|
+
showSoftInputOnFocus,
|
|
13
|
+
textContentType,
|
|
14
|
+
passwordRules,
|
|
15
|
+
textBreakStrategy,
|
|
16
|
+
underlineColorAndroid,
|
|
17
|
+
selection,
|
|
18
|
+
lineBreakStrategyIOS,
|
|
19
|
+
returnKeyLabel,
|
|
20
|
+
disabled,
|
|
21
|
+
onSubmitEditing,
|
|
22
|
+
caretHidden,
|
|
23
|
+
clearButtonMode,
|
|
24
|
+
clearTextOnFocus,
|
|
25
|
+
contextMenuHidden,
|
|
26
|
+
dataDetectorTypes,
|
|
27
|
+
id,
|
|
28
|
+
enablesReturnKeyAutomatically,
|
|
29
|
+
importantForAutofill,
|
|
30
|
+
inlineImageLeft,
|
|
31
|
+
inlineImagePadding,
|
|
32
|
+
inputAccessoryViewID,
|
|
33
|
+
keyboardAppearance,
|
|
34
|
+
keyboardType,
|
|
35
|
+
cursorColor,
|
|
36
|
+
disableFullscreenUI,
|
|
37
|
+
editable,
|
|
38
|
+
maxFontSizeMultiplier,
|
|
39
|
+
multiline,
|
|
40
|
+
numberOfLines,
|
|
41
|
+
onChangeText,
|
|
42
|
+
onContentSizeChange,
|
|
43
|
+
onEndEditing,
|
|
44
|
+
onScroll,
|
|
45
|
+
onSelectionChange,
|
|
46
|
+
caretColor,
|
|
47
|
+
placeholderTextColor,
|
|
48
|
+
blurOnSubmit,
|
|
49
|
+
enterKeyHint,
|
|
50
|
+
returnKeyType,
|
|
51
|
+
rejectResponderTermination,
|
|
52
|
+
scrollEnabled,
|
|
53
|
+
secureTextEntry,
|
|
54
|
+
selectionColor,
|
|
55
|
+
inputMode,
|
|
56
|
+
...rest
|
|
57
|
+
} = inProps,
|
|
58
|
+
ref = React.useRef(null),
|
|
59
|
+
theme = useTheme(),
|
|
60
|
+
composedRefs = useComposedRefs(forwardedRef, ref),
|
|
61
|
+
_onSelectionChange = useEvent(() => {
|
|
62
|
+
const start = ref.current?.selectionStart ?? 0,
|
|
63
|
+
end = ref.current?.selectionEnd ?? 0;
|
|
64
|
+
onSelectionChange?.({
|
|
65
|
+
nativeEvent: {
|
|
66
|
+
selection: {
|
|
67
|
+
end,
|
|
68
|
+
start
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (onSelectionChange) return ref.current?.addEventListener("selectionchange", _onSelectionChange), () => {
|
|
75
|
+
ref.current?.removeEventListener("selectionchange", _onSelectionChange);
|
|
76
|
+
};
|
|
77
|
+
}, []), useEffect(() => {
|
|
78
|
+
selection && ref.current?.setSelectionRange(selection.start || null, selection.end || null);
|
|
79
|
+
}, [selection?.start, selection?.end]);
|
|
80
|
+
const finalProps = {
|
|
81
|
+
...rest,
|
|
82
|
+
inputMode,
|
|
83
|
+
disabled,
|
|
84
|
+
caretColor,
|
|
85
|
+
id,
|
|
86
|
+
enterKeyHint,
|
|
87
|
+
style: {
|
|
88
|
+
...rest.style,
|
|
89
|
+
...(placeholderTextColor && {
|
|
90
|
+
"--placeholderColor": theme[placeholderTextColor]?.variable || placeholderTextColor
|
|
91
|
+
}),
|
|
92
|
+
...(selectionColor && {
|
|
93
|
+
"--selectionColor": theme[selectionColor]?.variable || selectionColor
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
return useEffect(() => {
|
|
98
|
+
if (id && !disabled) return registerFocusable(id, {
|
|
99
|
+
focusAndSelect: () => {
|
|
100
|
+
ref.current?.focus();
|
|
101
|
+
},
|
|
102
|
+
focus: () => {}
|
|
103
|
+
});
|
|
104
|
+
}, [id, disabled]), /* @__PURE__ */jsxs(Fragment, {
|
|
105
|
+
children: [/* @__PURE__ */jsx("style", {
|
|
106
|
+
children: `
|
|
107
|
+
input::selection, textarea::selection {
|
|
108
|
+
background-color: var(--selectionBackground) !important;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
input::placeholder, textarea::placeholder {
|
|
112
|
+
color: var(--placeholderColor) !important;
|
|
113
|
+
}
|
|
114
|
+
`
|
|
115
|
+
}), /* @__PURE__ */jsx(StyledInput, {
|
|
116
|
+
ref: composedRefs,
|
|
117
|
+
...finalProps
|
|
118
|
+
})]
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
export { Input };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { styled, useComposedRefs } from "@tamagui/core";
|
|
3
|
+
import { registerFocusable } from "@tamagui/focusable";
|
|
4
|
+
import React, { useEffect } from "react";
|
|
5
|
+
import { TextInput } from "react-native";
|
|
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)
|
|
43
|
+
return {};
|
|
44
|
+
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
45
|
+
if (Object.getOwnPropertySymbols) {
|
|
46
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
47
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
48
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
49
|
+
}
|
|
50
|
+
return target;
|
|
51
|
+
}
|
|
52
|
+
function _object_without_properties_loose(source, excluded) {
|
|
53
|
+
if (source == null)
|
|
54
|
+
return {};
|
|
55
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
56
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
57
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
58
|
+
return target;
|
|
59
|
+
}
|
|
60
|
+
var StyledInput = styled(TextInput, styledBody[0], styledBody[1]), Input = StyledInput.styleable(function(inProps, forwardedRef) {
|
|
61
|
+
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, [
|
|
62
|
+
"type",
|
|
63
|
+
"dirname",
|
|
64
|
+
"max",
|
|
65
|
+
"min",
|
|
66
|
+
"minLength",
|
|
67
|
+
"multiple",
|
|
68
|
+
"name",
|
|
69
|
+
"required",
|
|
70
|
+
"step",
|
|
71
|
+
"disabled",
|
|
72
|
+
"id",
|
|
73
|
+
"caretColor",
|
|
74
|
+
"onChange",
|
|
75
|
+
"onInput",
|
|
76
|
+
"rows",
|
|
77
|
+
"enterKeyHint",
|
|
78
|
+
"returnKeyType",
|
|
79
|
+
"onKeyDown",
|
|
80
|
+
"inputMode",
|
|
81
|
+
"tag"
|
|
82
|
+
]), ref = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, ref), secureTextEntry = !1, cursorColor = caretColor, _returnKeyType = returnKeyType, _enterKeyHint = enterKeyHint;
|
|
83
|
+
enterKeyHint === "go" && (_returnKeyType = "go", _enterKeyHint = void 0);
|
|
84
|
+
var _inputMode = inputMode;
|
|
85
|
+
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";
|
|
86
|
+
var showSoftInputOnFocus = !0;
|
|
87
|
+
inputMode === "none" && (showSoftInputOnFocus = !1);
|
|
88
|
+
var finalProps = _object_spread_props(_object_spread({}, 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 tag === "textarea" && (finalProps.multiline = !0), onKeyDown && (finalProps.onKeyPress = function(e) {
|
|
100
|
+
var key = e.nativeEvent.key;
|
|
101
|
+
(key === "Backspace" || tag === "textarea" && key === "Enter" || key.length === 1) && onKeyDown({
|
|
102
|
+
key,
|
|
103
|
+
type: "keydown"
|
|
104
|
+
});
|
|
105
|
+
}, finalProps.onSubmitEditing = function(e) {
|
|
106
|
+
onKeyDown({
|
|
107
|
+
key: "Enter",
|
|
108
|
+
type: "keydown"
|
|
109
|
+
});
|
|
110
|
+
}), (onChange || onInput) && (finalProps.onChange = function(e) {
|
|
111
|
+
var text = e.nativeEvent.text;
|
|
112
|
+
onChange && onChange({
|
|
113
|
+
target: {
|
|
114
|
+
value: text
|
|
115
|
+
},
|
|
116
|
+
type: "change"
|
|
117
|
+
}), onInput != null && onInput({
|
|
118
|
+
target: {
|
|
119
|
+
value: text
|
|
120
|
+
},
|
|
121
|
+
type: "input"
|
|
122
|
+
});
|
|
123
|
+
}), useEffect(function() {
|
|
124
|
+
if (id && !disabled)
|
|
125
|
+
return registerFocusable(id, {
|
|
126
|
+
focusAndSelect: function() {
|
|
127
|
+
var _ref_current;
|
|
128
|
+
(_ref_current = ref.current) === null || _ref_current === void 0 || _ref_current.focus();
|
|
129
|
+
},
|
|
130
|
+
focus: function() {
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}, [
|
|
134
|
+
id,
|
|
135
|
+
disabled
|
|
136
|
+
]), /* @__PURE__ */ _jsx(StyledInput, _object_spread({
|
|
137
|
+
onChange: function(e) {
|
|
138
|
+
},
|
|
139
|
+
ref: composedRefs
|
|
140
|
+
}, finalProps));
|
|
141
|
+
});
|
|
142
|
+
export {
|
|
143
|
+
Input
|
|
144
|
+
};
|
|
145
|
+
//# sourceMappingURL=Input.native.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/input/src/Input.native.tsx"],
|
|
4
|
+
"mappings": "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",
|
|
5
|
+
"names": ["styled", "useComposedRefs", "registerFocusable", "React", "useEffect", "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", "focusAndSelect", "current", "focus"]
|
|
6
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { styled } from "@tamagui/web";
|
|
2
|
+
import { Input } from "./Input";
|
|
3
|
+
import { defaultStyles, textAreaSizeVariant } from "./shared";
|
|
4
|
+
const TextArea = styled(Input, {
|
|
5
|
+
name: "TextArea",
|
|
6
|
+
tag: "textarea",
|
|
7
|
+
// this attribute fixes firefox newline issue
|
|
8
|
+
whiteSpace: "pre-wrap",
|
|
9
|
+
variants: {
|
|
10
|
+
unstyled: {
|
|
11
|
+
false: {
|
|
12
|
+
height: "auto",
|
|
13
|
+
...defaultStyles,
|
|
14
|
+
numberOfLines: 3
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
size: {
|
|
18
|
+
"...size": textAreaSizeVariant
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
export {
|
|
26
|
+
TextArea
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=TextArea.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/TextArea.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,eAAe,2BAA2B;AAC5C,MAAM,WAAW,OAAO,OAAO;AAAA,EACpC,MAAM;AAAA,EACN,KAAK;AAAA;AAAA,EAEL,YAAY;AAAA,EAEZ,UAAU;AAAA,IACR,UAAU;AAAA,MACR,OAAO;AAAA,QACL,QAAQ;AAAA,QACR,GAAG;AAAA,QACH,eAAe;AAAA,MACjB;AAAA,IACF;AAAA,IAEA,MAAM;AAAA,MACJ,WAAW;AAAA,IACb;AAAA,EACF;AAAA,EAEA,iBAAiB;AAAA,IACf,UAAU,QAAQ,IAAI,qBAAqB;AAAA,EAC7C;AACF,CAAC;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
tag: "textarea",
|
|
7
|
+
// this attribute fixes firefox newline issue
|
|
8
|
+
whiteSpace: "pre-wrap",
|
|
9
|
+
variants: {
|
|
10
|
+
unstyled: {
|
|
11
|
+
false: {
|
|
12
|
+
height: "auto",
|
|
13
|
+
...defaultStyles,
|
|
14
|
+
numberOfLines: 3
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
size: {
|
|
18
|
+
"...size": textAreaSizeVariant
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
export { TextArea };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { styled } from "@tamagui/web";
|
|
2
|
+
import { Input } from "./Input";
|
|
3
|
+
import { defaultStyles, textAreaSizeVariant } from "./shared";
|
|
4
|
+
function _define_property(obj, key, value) {
|
|
5
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
6
|
+
value,
|
|
7
|
+
enumerable: !0,
|
|
8
|
+
configurable: !0,
|
|
9
|
+
writable: !0
|
|
10
|
+
}) : obj[key] = value, obj;
|
|
11
|
+
}
|
|
12
|
+
function _object_spread(target) {
|
|
13
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
14
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
15
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
16
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
17
|
+
}))), ownKeys2.forEach(function(key) {
|
|
18
|
+
_define_property(target, key, source[key]);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return target;
|
|
22
|
+
}
|
|
23
|
+
function ownKeys(object, enumerableOnly) {
|
|
24
|
+
var keys = Object.keys(object);
|
|
25
|
+
if (Object.getOwnPropertySymbols) {
|
|
26
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
27
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
28
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
29
|
+
})), keys.push.apply(keys, symbols);
|
|
30
|
+
}
|
|
31
|
+
return keys;
|
|
32
|
+
}
|
|
33
|
+
function _object_spread_props(target, source) {
|
|
34
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
35
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
36
|
+
}), target;
|
|
37
|
+
}
|
|
38
|
+
var TextArea = styled(Input, {
|
|
39
|
+
name: "TextArea",
|
|
40
|
+
tag: "textarea",
|
|
41
|
+
// this attribute fixes firefox newline issue
|
|
42
|
+
whiteSpace: "pre-wrap",
|
|
43
|
+
variants: {
|
|
44
|
+
unstyled: {
|
|
45
|
+
false: _object_spread_props(_object_spread({
|
|
46
|
+
height: "auto"
|
|
47
|
+
}, defaultStyles), {
|
|
48
|
+
numberOfLines: 3
|
|
49
|
+
})
|
|
50
|
+
},
|
|
51
|
+
size: {
|
|
52
|
+
"...size": textAreaSizeVariant
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
defaultVariants: {
|
|
56
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
export {
|
|
60
|
+
TextArea
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=TextArea.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/input/src/TextArea.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAASA,cAAc;AACvB,SAASC,aAAa;AACtB,SAASC,eAAeC,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAC5C,IAAMC,WAAWJ,OAAOC,OAAO;EACpCI,MAAM;EACNC,KAAK;;EAELC,YAAY;EAEZC,UAAU;IACRC,UAAU;MACRC,OAAO,qBAAA,eAAA;QACLC,QAAQ;SACLT,aAAAA,GAAAA;QACHU,eAAe;;IAEnB;IAEAC,MAAM;MACJ,WAAWV;IACb;EACF;EAEAW,iBAAiB;IACfL,UAAUM,QAAQC,IAAIC,qBAAqB;EAC7C;AACF,CAAA;",
|
|
5
|
+
"names": ["styled", "Input", "defaultStyles", "textAreaSizeVariant", "TextArea", "name", "tag", "whiteSpace", "variants", "unstyled", "false", "height", "numberOfLines", "size", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS"]
|
|
6
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { validStyles, stylePropsTextOnly } from "@tamagui/core";
|
|
2
|
+
import { getVariableValue, isWeb } from "@tamagui/core";
|
|
3
|
+
import { getButtonSized } from "@tamagui/get-button-sized";
|
|
4
|
+
import { getFontSized } from "@tamagui/get-font-sized";
|
|
5
|
+
import { getSpace } from "@tamagui/get-token";
|
|
6
|
+
const defaultStyles = {
|
|
7
|
+
size: "$true",
|
|
8
|
+
fontFamily: "$body",
|
|
9
|
+
borderWidth: 1,
|
|
10
|
+
outlineWidth: 0,
|
|
11
|
+
color: "$color",
|
|
12
|
+
...isWeb ? {
|
|
13
|
+
tabIndex: 0
|
|
14
|
+
} : {
|
|
15
|
+
focusable: !0
|
|
16
|
+
},
|
|
17
|
+
borderColor: "$borderColor",
|
|
18
|
+
backgroundColor: "$background",
|
|
19
|
+
// this fixes a flex bug where it overflows container
|
|
20
|
+
minWidth: 0,
|
|
21
|
+
hoverStyle: {
|
|
22
|
+
borderColor: "$borderColorHover"
|
|
23
|
+
},
|
|
24
|
+
focusStyle: {
|
|
25
|
+
borderColor: "$borderColorFocus"
|
|
26
|
+
},
|
|
27
|
+
focusVisibleStyle: {
|
|
28
|
+
outlineColor: "$outlineColor",
|
|
29
|
+
outlineWidth: 2,
|
|
30
|
+
outlineStyle: "solid"
|
|
31
|
+
}
|
|
32
|
+
}, inputSizeVariant = (val = "$true", extras) => {
|
|
33
|
+
if (extras.props.multiline || extras.props.numberOfLines > 1)
|
|
34
|
+
return textAreaSizeVariant(val, extras);
|
|
35
|
+
const buttonStyles = getButtonSized(val, extras), paddingHorizontal = getSpace(val, {
|
|
36
|
+
shift: -1,
|
|
37
|
+
bounds: [2]
|
|
38
|
+
}), fontStyle = getFontSized(val, extras);
|
|
39
|
+
return !isWeb && fontStyle && delete fontStyle.lineHeight, {
|
|
40
|
+
...fontStyle,
|
|
41
|
+
...buttonStyles,
|
|
42
|
+
paddingHorizontal
|
|
43
|
+
};
|
|
44
|
+
}, textAreaSizeVariant = (val = "$true", extras) => {
|
|
45
|
+
const { props } = extras, buttonStyles = getButtonSized(val, extras), fontStyle = getFontSized(val, extras), lines = props.rows ?? props.numberOfLines, height = typeof lines == "number" ? lines * getVariableValue(fontStyle.lineHeight) : "auto", paddingVertical = getSpace(val, {
|
|
46
|
+
shift: -2,
|
|
47
|
+
bounds: [2]
|
|
48
|
+
}), paddingHorizontal = getSpace(val, {
|
|
49
|
+
shift: -1,
|
|
50
|
+
bounds: [2]
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
...buttonStyles,
|
|
54
|
+
...fontStyle,
|
|
55
|
+
paddingVertical,
|
|
56
|
+
paddingHorizontal,
|
|
57
|
+
height
|
|
58
|
+
};
|
|
59
|
+
}, INPUT_NAME = "Input", styledBody = [
|
|
60
|
+
{
|
|
61
|
+
name: INPUT_NAME,
|
|
62
|
+
tag: "input",
|
|
63
|
+
variants: {
|
|
64
|
+
unstyled: {
|
|
65
|
+
false: defaultStyles
|
|
66
|
+
},
|
|
67
|
+
size: {
|
|
68
|
+
"...size": inputSizeVariant
|
|
69
|
+
},
|
|
70
|
+
disabled: {
|
|
71
|
+
true: {}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
defaultVariants: {
|
|
75
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
isInput: !0,
|
|
80
|
+
accept: {
|
|
81
|
+
placeholderTextColor: "color",
|
|
82
|
+
selectionColor: "color"
|
|
83
|
+
},
|
|
84
|
+
validStyles: {
|
|
85
|
+
...validStyles,
|
|
86
|
+
...stylePropsTextOnly
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
];
|
|
90
|
+
export {
|
|
91
|
+
INPUT_NAME,
|
|
92
|
+
defaultStyles,
|
|
93
|
+
inputSizeVariant,
|
|
94
|
+
styledBody,
|
|
95
|
+
textAreaSizeVariant
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/shared.tsx"],
|
|
4
|
+
"mappings": "AACA,SAAS,aAAa,0BAA0B;AAChD,SAAS,kBAAkB,aAAa;AACxC,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AAElB,MAAM,gBAAgB;AAAA,EAC3B,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,cAAc;AAAA,EACd,OAAO;AAAA,EAEP,GAAI,QACA;AAAA,IACE,UAAU;AAAA,EACZ,IACA;AAAA,IACE,WAAW;AAAA,EACb;AAAA,EAEJ,aAAa;AAAA,EACb,iBAAiB;AAAA;AAAA,EAGjB,UAAU;AAAA,EAEV,YAAY;AAAA,IACV,aAAa;AAAA,EACf;AAAA,EAEA,YAAY;AAAA,IACV,aAAa;AAAA,EACf;AAAA,EAEA,mBAAmB;AAAA,IACjB,cAAc;AAAA,IACd,cAAc;AAAA,IACd,cAAc;AAAA,EAChB;AACF,GAEa,mBAAmD,CAC9D,MAAM,SACN,WACG;AACH,MAAI,OAAO,MAAM,aAAa,OAAO,MAAM,gBAAgB;AACzD,WAAO,oBAAoB,KAAK,MAAM;AAExC,QAAM,eAAe,eAAe,KAAK,MAAM,GACzC,oBAAoB,SAAS,KAAK;AAAA,IACtC,OAAO;AAAA,IACP,QAAQ,CAAC,CAAC;AAAA,EACZ,CAAC,GACK,YAAY,aAAa,KAAY,MAAM;AAEjD,SAAI,CAAC,SAAS,aACZ,OAAO,UAAU,YAEZ;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH;AAAA,EACF;AACF,GAEa,sBAAsD,CACjE,MAAM,SACN,WACG;AACH,QAAM,EAAE,MAAM,IAAI,QACZ,eAAe,eAAe,KAAK,MAAM,GACzC,YAAY,aAAa,KAAY,MAAM,GAC3C,QAAQ,MAAM,QAAQ,MAAM,eAC5B,SACJ,OAAO,SAAU,WAAW,QAAQ,iBAAiB,UAAU,UAAU,IAAI,QACzE,kBAAkB,SAAS,KAAK;AAAA,IACpC,OAAO;AAAA,IACP,QAAQ,CAAC,CAAC;AAAA,EACZ,CAAC,GACK,oBAAoB,SAAS,KAAK;AAAA,IACtC,OAAO;AAAA,IACP,QAAQ,CAAC,CAAC;AAAA,EACZ,CAAC;AACD,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF,GACa,aAAa,SAEb,aAAa;AAAA,EACxB;AAAA,IACE,MAAM;AAAA,IACN,KAAK;AAAA,IACL,UAAU;AAAA,MACR,UAAU;AAAA,QACR,OAAO;AAAA,MACT;AAAA,MAEA,MAAM;AAAA,QACJ,WAAW;AAAA,MACb;AAAA,MAEA,UAAU;AAAA,QACR,MAAM,CAAC;AAAA,MACT;AAAA,IACF;AAAA,IAEA,iBAAiB;AAAA,MACf,UAAU,QAAQ,IAAI,qBAAqB;AAAA,IAC7C;AAAA,EACF;AAAA,EACA;AAAA,IACE,SAAS;AAAA,IACT,QAAQ;AAAA,MACN,sBAAsB;AAAA,MACtB,gBAAgB;AAAA,IAClB;AAAA,IACA,aAAa;AAAA,MACX,GAAG;AAAA,MACH,GAAG;AAAA,IACL;AAAA,EACF;AACF;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { validStyles, stylePropsTextOnly } from "@tamagui/core";
|
|
2
|
+
import { getVariableValue, isWeb } from "@tamagui/core";
|
|
3
|
+
import { getButtonSized } from "@tamagui/get-button-sized";
|
|
4
|
+
import { getFontSized } from "@tamagui/get-font-sized";
|
|
5
|
+
import { getSpace } from "@tamagui/get-token";
|
|
6
|
+
const defaultStyles = {
|
|
7
|
+
size: "$true",
|
|
8
|
+
fontFamily: "$body",
|
|
9
|
+
borderWidth: 1,
|
|
10
|
+
outlineWidth: 0,
|
|
11
|
+
color: "$color",
|
|
12
|
+
...(isWeb ? {
|
|
13
|
+
tabIndex: 0
|
|
14
|
+
} : {
|
|
15
|
+
focusable: !0
|
|
16
|
+
}),
|
|
17
|
+
borderColor: "$borderColor",
|
|
18
|
+
backgroundColor: "$background",
|
|
19
|
+
// this fixes a flex bug where it overflows container
|
|
20
|
+
minWidth: 0,
|
|
21
|
+
hoverStyle: {
|
|
22
|
+
borderColor: "$borderColorHover"
|
|
23
|
+
},
|
|
24
|
+
focusStyle: {
|
|
25
|
+
borderColor: "$borderColorFocus"
|
|
26
|
+
},
|
|
27
|
+
focusVisibleStyle: {
|
|
28
|
+
outlineColor: "$outlineColor",
|
|
29
|
+
outlineWidth: 2,
|
|
30
|
+
outlineStyle: "solid"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
inputSizeVariant = (val = "$true", extras) => {
|
|
34
|
+
if (extras.props.multiline || extras.props.numberOfLines > 1) return textAreaSizeVariant(val, extras);
|
|
35
|
+
const buttonStyles = getButtonSized(val, extras),
|
|
36
|
+
paddingHorizontal = getSpace(val, {
|
|
37
|
+
shift: -1,
|
|
38
|
+
bounds: [2]
|
|
39
|
+
}),
|
|
40
|
+
fontStyle = getFontSized(val, extras);
|
|
41
|
+
return !isWeb && fontStyle && delete fontStyle.lineHeight, {
|
|
42
|
+
...fontStyle,
|
|
43
|
+
...buttonStyles,
|
|
44
|
+
paddingHorizontal
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
textAreaSizeVariant = (val = "$true", extras) => {
|
|
48
|
+
const {
|
|
49
|
+
props
|
|
50
|
+
} = extras,
|
|
51
|
+
buttonStyles = getButtonSized(val, extras),
|
|
52
|
+
fontStyle = getFontSized(val, extras),
|
|
53
|
+
lines = props.rows ?? props.numberOfLines,
|
|
54
|
+
height = typeof lines == "number" ? lines * getVariableValue(fontStyle.lineHeight) : "auto",
|
|
55
|
+
paddingVertical = getSpace(val, {
|
|
56
|
+
shift: -2,
|
|
57
|
+
bounds: [2]
|
|
58
|
+
}),
|
|
59
|
+
paddingHorizontal = getSpace(val, {
|
|
60
|
+
shift: -1,
|
|
61
|
+
bounds: [2]
|
|
62
|
+
});
|
|
63
|
+
return {
|
|
64
|
+
...buttonStyles,
|
|
65
|
+
...fontStyle,
|
|
66
|
+
paddingVertical,
|
|
67
|
+
paddingHorizontal,
|
|
68
|
+
height
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
INPUT_NAME = "Input",
|
|
72
|
+
styledBody = [{
|
|
73
|
+
name: INPUT_NAME,
|
|
74
|
+
tag: "input",
|
|
75
|
+
variants: {
|
|
76
|
+
unstyled: {
|
|
77
|
+
false: defaultStyles
|
|
78
|
+
},
|
|
79
|
+
size: {
|
|
80
|
+
"...size": inputSizeVariant
|
|
81
|
+
},
|
|
82
|
+
disabled: {
|
|
83
|
+
true: {}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
defaultVariants: {
|
|
87
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
88
|
+
}
|
|
89
|
+
}, {
|
|
90
|
+
isInput: !0,
|
|
91
|
+
accept: {
|
|
92
|
+
placeholderTextColor: "color",
|
|
93
|
+
selectionColor: "color"
|
|
94
|
+
},
|
|
95
|
+
validStyles: {
|
|
96
|
+
...validStyles,
|
|
97
|
+
...stylePropsTextOnly
|
|
98
|
+
}
|
|
99
|
+
}];
|
|
100
|
+
export { INPUT_NAME, defaultStyles, inputSizeVariant, styledBody, textAreaSizeVariant };
|