@tamagui/input 3.0.0-beta.924.1 → 3.0.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.native.cjs +2 -1
- package/dist/cjs/Input.native.js +2 -1
- package/dist/cjs/Input.native.js.map +1 -1
- package/dist/cjs/TextArea.cjs +1 -2
- package/dist/cjs/TextArea.native.cjs +1 -2
- package/dist/cjs/TextArea.native.js +1 -2
- package/dist/cjs/TextArea.native.js.map +1 -1
- package/dist/cjs/index.cjs +0 -11
- package/dist/cjs/index.native.cjs +0 -11
- package/dist/cjs/index.native.js +0 -11
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/shared.cjs +13 -103
- package/dist/cjs/shared.native.cjs +16 -109
- package/dist/cjs/shared.native.js +16 -109
- package/dist/cjs/shared.native.js.map +1 -1
- package/dist/esm/Input.native.js +2 -1
- package/dist/esm/Input.native.js.map +1 -1
- package/dist/esm/TextArea.mjs +2 -3
- package/dist/esm/TextArea.mjs.map +1 -1
- package/dist/esm/TextArea.native.js +2 -3
- package/dist/esm/TextArea.native.js.map +1 -1
- package/dist/esm/index.js +0 -4
- package/dist/esm/index.mjs +0 -4
- package/dist/esm/index.native.js +0 -4
- package/dist/esm/shared.mjs +14 -102
- package/dist/esm/shared.mjs.map +1 -1
- package/dist/esm/shared.native.js +17 -108
- package/dist/esm/shared.native.js.map +1 -1
- package/dist/jsx/Input.native.cjs +2 -1
- package/dist/jsx/Input.native.js +2 -1
- package/dist/jsx/Input.native.js.map +1 -1
- package/dist/jsx/TextArea.mjs +2 -3
- package/dist/jsx/TextArea.mjs.map +1 -1
- package/dist/jsx/TextArea.native.cjs +1 -2
- package/dist/jsx/TextArea.native.js +1 -2
- package/dist/jsx/TextArea.native.js.map +1 -1
- package/dist/jsx/index.js +0 -4
- package/dist/jsx/index.mjs +0 -4
- package/dist/jsx/index.native.cjs +0 -11
- package/dist/jsx/index.native.js +0 -11
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/shared.mjs +14 -102
- package/dist/jsx/shared.mjs.map +1 -1
- package/dist/jsx/shared.native.cjs +16 -109
- package/dist/jsx/shared.native.js +16 -109
- package/dist/jsx/shared.native.js.map +1 -1
- package/package.json +17 -14
- package/src/Input.native.tsx +6 -1
- package/src/TextArea.tsx +1 -5
- package/src/index.ts +0 -1
- package/src/shared.tsx +34 -113
- package/src/types.ts +1 -1
- package/types/Input.d.ts +4 -47
- package/types/Input.d.ts.map +1 -1
- package/types/Input.native.d.ts +6 -48
- package/types/Input.native.d.ts.map +1 -1
- package/types/TextArea.d.ts +4 -6
- package/types/TextArea.d.ts.map +1 -1
- package/types/index.d.ts +0 -1
- package/types/index.d.ts.map +1 -1
- package/types/shared.d.ts +13 -31
- package/types/shared.d.ts.map +1 -1
- package/types/types.d.ts +1 -1
- package/types/types.d.ts.map +1 -1
|
@@ -1,115 +1,27 @@
|
|
|
1
|
-
import { getVariableValue,
|
|
2
|
-
import { getFontSized } from "@tamagui/get-font-sized";
|
|
1
|
+
import { getVariableValue, resolveTextMetrics } from "@tamagui/core";
|
|
3
2
|
|
|
4
3
|
var defaultStyles = {
|
|
5
|
-
size: true,
|
|
6
4
|
outlineWidth: 0,
|
|
7
5
|
tabIndex: 0,
|
|
8
6
|
minWidth: 0
|
|
9
7
|
};
|
|
10
|
-
var resolveInputFrame = function(val, env) {
|
|
11
|
-
return resolveTokenSize(val, {
|
|
12
|
-
tokens: env.tokens,
|
|
13
|
-
font: env.font
|
|
14
|
-
}).frame;
|
|
15
|
-
};
|
|
16
|
-
var inputSizeKeys = [
|
|
17
|
-
"0",
|
|
18
|
-
"0-25",
|
|
19
|
-
"0-5",
|
|
20
|
-
"0-75",
|
|
21
|
-
"1",
|
|
22
|
-
"1-5",
|
|
23
|
-
"2",
|
|
24
|
-
"2-5",
|
|
25
|
-
"3",
|
|
26
|
-
"3-5",
|
|
27
|
-
"4",
|
|
28
|
-
"4-5",
|
|
29
|
-
"5",
|
|
30
|
-
"6",
|
|
31
|
-
"7",
|
|
32
|
-
"8",
|
|
33
|
-
"9",
|
|
34
|
-
"10",
|
|
35
|
-
"11",
|
|
36
|
-
"12",
|
|
37
|
-
"13",
|
|
38
|
-
"14",
|
|
39
|
-
"15",
|
|
40
|
-
"16",
|
|
41
|
-
"17",
|
|
42
|
-
"18",
|
|
43
|
-
"19",
|
|
44
|
-
"20"
|
|
45
|
-
];
|
|
46
|
-
var getInputPadding = function(val, env, steps) {
|
|
47
|
-
if (typeof val === "number") {
|
|
48
|
-
return steps === 1 ? Math.max(0, Math.round(val * .6 - 12)) : Math.max(0, Math.round(val * .52 - 11.5));
|
|
49
|
-
}
|
|
50
|
-
var key = val === true ? "4" : val;
|
|
51
|
-
var index = inputSizeKeys.indexOf(key);
|
|
52
|
-
return env.tokens.space[inputSizeKeys[Math.max(0, index - steps)]];
|
|
53
|
-
};
|
|
54
|
-
var inputSizeVariant = styled.dynamic(function() {
|
|
55
|
-
var val = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true, env = arguments.length > 1 ? arguments[1] : void 0;
|
|
56
|
-
var frame = resolveInputFrame(val, env);
|
|
57
|
-
var fontStyle = getFontSized(val, env);
|
|
58
|
-
return {
|
|
59
|
-
color: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.color,
|
|
60
|
-
fontFamily: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontFamily,
|
|
61
|
-
fontSize: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontSize,
|
|
62
|
-
fontStyle: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontStyle,
|
|
63
|
-
fontWeight: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontWeight,
|
|
64
|
-
letterSpacing: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.letterSpacing,
|
|
65
|
-
lineHeight: isWeb ? fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.lineHeight : void 0,
|
|
66
|
-
textTransform: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.textTransform,
|
|
67
|
-
height: frame.size,
|
|
68
|
-
borderRadius: frame.radius,
|
|
69
|
-
paddingHorizontal: getInputPadding(val, env, 1)
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
var textAreaSizeVariant = styled.dynamic(function() {
|
|
73
|
-
var val = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true, env = arguments.length > 1 ? arguments[1] : void 0;
|
|
74
|
-
var frame = resolveInputFrame(val, env);
|
|
75
|
-
var fontStyle = getFontSized(val, env);
|
|
76
|
-
return {
|
|
77
|
-
borderRadius: frame.radius,
|
|
78
|
-
color: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.color,
|
|
79
|
-
fontFamily: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontFamily,
|
|
80
|
-
fontSize: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontSize,
|
|
81
|
-
fontStyle: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontStyle,
|
|
82
|
-
fontWeight: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontWeight,
|
|
83
|
-
letterSpacing: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.letterSpacing,
|
|
84
|
-
lineHeight: isWeb ? fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.lineHeight : void 0,
|
|
85
|
-
textTransform: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.textTransform,
|
|
86
|
-
paddingVertical: getInputPadding(val, env, 2),
|
|
87
|
-
paddingHorizontal: getInputPadding(val, env, 1),
|
|
88
|
-
height: "auto"
|
|
89
|
-
};
|
|
90
|
-
});
|
|
91
8
|
var resolveTextAreaSize = function(props, env) {
|
|
92
|
-
var
|
|
93
|
-
var
|
|
94
|
-
var
|
|
95
|
-
var
|
|
9
|
+
var _font_lineHeight, _font_lineHeight1;
|
|
10
|
+
var font = props.fontFamily ? env.fonts[props.fontFamily] : env.font;
|
|
11
|
+
var defaultKey = font && "sm" in font.size ? "sm" : "4";
|
|
12
|
+
var _props_fontSize;
|
|
13
|
+
var fontSize = (_props_fontSize = props.fontSize) !== null && _props_fontSize !== void 0 ? _props_fontSize : defaultKey;
|
|
14
|
+
var _props_lineHeight;
|
|
15
|
+
var lineHeight = (_props_lineHeight = props.lineHeight) !== null && _props_lineHeight !== void 0 ? _props_lineHeight : font === null || font === void 0 ? void 0 : (_font_lineHeight = font.lineHeight) === null || _font_lineHeight === void 0 ? void 0 : _font_lineHeight[defaultKey];
|
|
16
|
+
var configuredSize = typeof fontSize === "string" ? font === null || font === void 0 ? void 0 : font.size[fontSize] : void 0;
|
|
17
|
+
var configuredLeading = typeof lineHeight === "string" ? font === null || font === void 0 ? void 0 : (_font_lineHeight1 = font.lineHeight) === null || _font_lineHeight1 === void 0 ? void 0 : _font_lineHeight1[lineHeight] : void 0;
|
|
18
|
+
var metrics = { fontSize: Number.parseFloat(String(getVariableValue(configuredSize !== null && configuredSize !== void 0 ? configuredSize : fontSize))) };
|
|
19
|
+
var leading = configuredLeading !== null && configuredLeading !== void 0 ? configuredLeading : lineHeight;
|
|
20
|
+
resolveTextMetrics(metrics, (props.lineHeight == null || configuredLeading !== void 0) && typeof leading === "number" ? `${leading}px` : leading);
|
|
96
21
|
var _props_rows;
|
|
97
22
|
var lines = (_props_rows = props.rows) !== null && _props_rows !== void 0 ? _props_rows : props.numberOfLines;
|
|
98
|
-
var height = typeof lines === "number"
|
|
99
|
-
return {
|
|
100
|
-
borderRadius: sized === null || sized === void 0 ? void 0 : sized.borderRadius,
|
|
101
|
-
color: sized === null || sized === void 0 ? void 0 : sized.color,
|
|
102
|
-
fontFamily: sized === null || sized === void 0 ? void 0 : sized.fontFamily,
|
|
103
|
-
fontSize: sized === null || sized === void 0 ? void 0 : sized.fontSize,
|
|
104
|
-
fontStyle: sized === null || sized === void 0 ? void 0 : sized.fontStyle,
|
|
105
|
-
fontWeight: sized === null || sized === void 0 ? void 0 : sized.fontWeight,
|
|
106
|
-
letterSpacing: sized === null || sized === void 0 ? void 0 : sized.letterSpacing,
|
|
107
|
-
lineHeight: sized === null || sized === void 0 ? void 0 : sized.lineHeight,
|
|
108
|
-
textTransform: sized === null || sized === void 0 ? void 0 : sized.textTransform,
|
|
109
|
-
paddingVertical: sized === null || sized === void 0 ? void 0 : sized.paddingVertical,
|
|
110
|
-
paddingHorizontal: sized === null || sized === void 0 ? void 0 : sized.paddingHorizontal,
|
|
111
|
-
height
|
|
112
|
-
};
|
|
23
|
+
var height = typeof lines === "number" && typeof metrics.lineHeight === "number" ? lines * metrics.lineHeight : void 0;
|
|
24
|
+
return { height };
|
|
113
25
|
};
|
|
114
26
|
var resolveMultilineInputSize = function(props, env) {
|
|
115
27
|
if (!(props.rows > 1 || props.multiline || props.numberOfLines > 1)) return;
|
|
@@ -120,11 +32,8 @@ var styledBody = [{
|
|
|
120
32
|
name: INPUT_NAME,
|
|
121
33
|
render: "input",
|
|
122
34
|
...defaultStyles,
|
|
123
|
-
variants: {
|
|
124
|
-
size: inputSizeVariant,
|
|
125
|
-
disabled: { true: {} }
|
|
126
|
-
}
|
|
35
|
+
variants: { disabled: { true: {} } }
|
|
127
36
|
}, { isInput: true }];
|
|
128
37
|
|
|
129
|
-
export { INPUT_NAME, defaultStyles,
|
|
38
|
+
export { INPUT_NAME, defaultStyles, resolveMultilineInputSize, resolveTextAreaSize, styledBody };
|
|
130
39
|
//# sourceMappingURL=shared.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.native.js","names":[],"sources":["esm/shared.native.js"],"sourcesContent":["import { getVariableValue,
|
|
1
|
+
{"version":3,"file":"shared.native.js","names":[],"sources":["esm/shared.native.js"],"sourcesContent":["import { getVariableValue, resolveTextMetrics } from \"@tamagui/core\";\nvar defaultStyles = {\n outlineWidth: 0,\n tabIndex: 0,\n // this fixes a flex bug where it overflows container\n minWidth: 0\n};\nvar resolveTextAreaSize = function(props, env) {\n var _font_lineHeight, _font_lineHeight1;\n var font = props.fontFamily ? env.fonts[props.fontFamily] : env.font;\n var defaultKey = font && \"sm\" in font.size ? \"sm\" : \"4\";\n var _props_fontSize;\n var fontSize = (_props_fontSize = props.fontSize) !== null && _props_fontSize !== void 0 ? _props_fontSize : defaultKey;\n var _props_lineHeight;\n var lineHeight = (_props_lineHeight = props.lineHeight) !== null && _props_lineHeight !== void 0 ? _props_lineHeight : font === null || font === void 0 ? void 0 : (_font_lineHeight = font.lineHeight) === null || _font_lineHeight === void 0 ? void 0 : _font_lineHeight[defaultKey];\n var configuredSize = typeof fontSize === \"string\" ? font === null || font === void 0 ? void 0 : font.size[fontSize] : void 0;\n var configuredLeading = typeof lineHeight === \"string\" ? font === null || font === void 0 ? void 0 : (_font_lineHeight1 = font.lineHeight) === null || _font_lineHeight1 === void 0 ? void 0 : _font_lineHeight1[lineHeight] : void 0;\n var metrics = {\n fontSize: Number.parseFloat(String(getVariableValue(configuredSize !== null && configuredSize !== void 0 ? configuredSize : fontSize)))\n };\n var leading = configuredLeading !== null && configuredLeading !== void 0 ? configuredLeading : lineHeight;\n resolveTextMetrics(metrics, (props.lineHeight == null || configuredLeading !== void 0) && typeof leading === \"number\" ? `${leading}px` : leading);\n var _props_rows;\n var lines = (_props_rows = props.rows) !== null && _props_rows !== void 0 ? _props_rows : props.numberOfLines;\n var height = typeof lines === \"number\" && typeof metrics.lineHeight === \"number\" ? lines * metrics.lineHeight : void 0;\n return {\n height\n };\n};\nvar resolveMultilineInputSize = function(props, env) {\n if (!(props.rows > 1 || props.multiline || props.numberOfLines > 1)) return;\n return resolveTextAreaSize(props, env);\n};\nvar INPUT_NAME = \"Input\";\nvar styledBody = [\n {\n name: INPUT_NAME,\n render: \"input\",\n ...defaultStyles,\n variants: {\n disabled: {\n true: {}\n }\n }\n },\n {\n isInput: true\n }\n];\nexport {\n INPUT_NAME,\n defaultStyles,\n resolveMultilineInputSize,\n resolveTextAreaSize,\n styledBody\n};\n//# sourceMappingURL=sh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,OAAO,QAAQ,eAAe,WAAW,QAAQ,QAAQ,aAAa,KAAK;CACrH,OAAO,EACL,OACF;AACF;AACA,IAAI,4BAA4B,SAAS,OAAO,KAAK;CACnD,IAAI,EAAE,MAAM,OAAO,KAAK,MAAM,aAAa,MAAM,gBAAgB,IAAI;CACrE,OAAO,oBAAoB,OAAO,GAAG;AACvC;AACA,IAAI,aAAa;AACjB,IAAI,aAAa,CACf;CACE,MAAM;CACN,QAAQ;CACR,GAAG;CACH,UAAU,EACR,UAAU,EACR,MAAM,CAAC,EACT,EACF;AACF,GACA,EACE,SAAS,KACX,CACF"}
|
|
@@ -36,7 +36,8 @@ var import_core = require("@tamagui/core");
|
|
|
36
36
|
var import_focusable = require("@tamagui/focusable");
|
|
37
37
|
var import_element = require("@tamagui/element");
|
|
38
38
|
var import_shared = require("./shared.native.js");
|
|
39
|
-
var
|
|
39
|
+
var NativeTextInput = import_react_native.TextInput;
|
|
40
|
+
var StyledInput = (0, import_core.styled)(NativeTextInput, import_shared.styledBody[0], import_shared.styledBody[1]).resolve(import_shared.resolveMultilineInputSize);
|
|
40
41
|
var Input = (0, import_core.createStyledHOC)(StyledInput, function(props, forwardedRef) {
|
|
41
42
|
var { type, disabled, readOnly, id, rows, autoComplete, enterKeyHint, onChange, onInput, onKeyDown, onChangeText, onSubmitEditing, onSelectionChange, onEndEditing, onContentSizeChange, onScroll, onKeyPress: onKeyPressProp, selection, keyboardAppearance, returnKeyType: returnKeyTypeProp, submitBehavior, blurOnSubmit, caretHidden, contextMenuHidden, selectTextOnFocus, secureTextEntry: secureTextEntryProp, maxFontSizeMultiplier, allowFontScaling, multiline: multilineProp, keyboardType: keyboardTypeProp, inputMode: inputModeProp, autoCapitalize: autoCapitalizeProp, autoCorrect: autoCorrectProp, autoFocusNative, textContentType, clearButtonMode, clearTextOnFocus, enablesReturnKeyAutomatically, dataDetectorTypes, scrollEnabled, passwordRules, rejectResponderTermination, spellCheck, lineBreakStrategyIOS, lineBreakModeIOS, smartInsertDelete, inputAccessoryViewID, inputAccessoryViewButtonLabel, disableKeyboardShortcuts, importantForAutofill, disableFullscreenUI, inlineImageLeft, inlineImagePadding, returnKeyLabel, textBreakStrategy, textAlignVertical, verticalAlign, showSoftInputOnFocus, numberOfLines: numberOfLinesProp, dirname, min, max, minLength, multiple, name, pattern, required, step, render, caretColor, cursorColor: cursorColorProp, selectionColor: selectionColorProp, ...rest } = props;
|
|
42
43
|
var { ref, composedRef } = (0, import_element.useNativeInputRef)(forwardedRef);
|
package/dist/jsx/Input.native.js
CHANGED
|
@@ -36,7 +36,8 @@ var import_core = require("@tamagui/core");
|
|
|
36
36
|
var import_focusable = require("@tamagui/focusable");
|
|
37
37
|
var import_element = require("@tamagui/element");
|
|
38
38
|
var import_shared = require("./shared.native.js");
|
|
39
|
-
var
|
|
39
|
+
var NativeTextInput = import_react_native.TextInput;
|
|
40
|
+
var StyledInput = (0, import_core.styled)(NativeTextInput, import_shared.styledBody[0], import_shared.styledBody[1]).resolve(import_shared.resolveMultilineInputSize);
|
|
40
41
|
var Input = (0, import_core.createStyledHOC)(StyledInput, function(props, forwardedRef) {
|
|
41
42
|
var { type, disabled, readOnly, id, rows, autoComplete, enterKeyHint, onChange, onInput, onKeyDown, onChangeText, onSubmitEditing, onSelectionChange, onEndEditing, onContentSizeChange, onScroll, onKeyPress: onKeyPressProp, selection, keyboardAppearance, returnKeyType: returnKeyTypeProp, submitBehavior, blurOnSubmit, caretHidden, contextMenuHidden, selectTextOnFocus, secureTextEntry: secureTextEntryProp, maxFontSizeMultiplier, allowFontScaling, multiline: multilineProp, keyboardType: keyboardTypeProp, inputMode: inputModeProp, autoCapitalize: autoCapitalizeProp, autoCorrect: autoCorrectProp, autoFocusNative, textContentType, clearButtonMode, clearTextOnFocus, enablesReturnKeyAutomatically, dataDetectorTypes, scrollEnabled, passwordRules, rejectResponderTermination, spellCheck, lineBreakStrategyIOS, lineBreakModeIOS, smartInsertDelete, inputAccessoryViewID, inputAccessoryViewButtonLabel, disableKeyboardShortcuts, importantForAutofill, disableFullscreenUI, inlineImageLeft, inlineImagePadding, returnKeyLabel, textBreakStrategy, textAlignVertical, verticalAlign, showSoftInputOnFocus, numberOfLines: numberOfLinesProp, dirname, min, max, minLength, multiple, name, pattern, required, step, render, caretColor, cursorColor: cursorColorProp, selectionColor: selectionColorProp, ...rest } = props;
|
|
42
43
|
var { ref, composedRef } = (0, import_element.useNativeInputRef)(forwardedRef);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.native.js","names":[],"sources":["jsx/Input.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Input_native_exports = {};\n__export(Input_native_exports, {\n Input: () => Input\n});\nmodule.exports = __toCommonJS(Input_native_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_react = __toESM(require(\"react\"), 1);\nvar import_react_native = require(\"react-native\");\nvar import_core = require(\"@tamagui/core\");\nvar import_focusable = require(\"@tamagui/focusable\");\nvar import_element = require(\"@tamagui/element\");\nvar import_shared = require(\"./shared\");\nvar StyledInput = (0, import_core.styled)(import_react_native.TextInput, import_shared.styledBody[0], import_shared.styledBody[1]).resolve(import_shared.resolveMultilineInputSize);\nvar Input = (0, import_core.createStyledHOC)(StyledInput, function(props, forwardedRef) {\n var {\n // Web props we need to convert\n type,\n disabled,\n readOnly,\n id,\n rows,\n autoComplete,\n enterKeyHint,\n // Callbacks\n onChange,\n onInput,\n onKeyDown,\n onChangeText,\n onSubmitEditing,\n onSelectionChange,\n onEndEditing,\n onContentSizeChange,\n onScroll,\n onKeyPress: onKeyPressProp,\n selection,\n // Native-only props (pass through directly)\n keyboardAppearance,\n returnKeyType: returnKeyTypeProp,\n submitBehavior,\n blurOnSubmit,\n caretHidden,\n contextMenuHidden,\n selectTextOnFocus,\n secureTextEntry: secureTextEntryProp,\n maxFontSizeMultiplier,\n allowFontScaling,\n multiline: multilineProp,\n keyboardType: keyboardTypeProp,\n inputMode: inputModeProp,\n autoCapitalize: autoCapitalizeProp,\n autoCorrect: autoCorrectProp,\n autoFocusNative,\n textContentType,\n // iOS-only props\n clearButtonMode,\n clearTextOnFocus,\n enablesReturnKeyAutomatically,\n dataDetectorTypes,\n scrollEnabled,\n passwordRules,\n rejectResponderTermination,\n spellCheck,\n lineBreakStrategyIOS,\n lineBreakModeIOS,\n smartInsertDelete,\n inputAccessoryViewID,\n inputAccessoryViewButtonLabel,\n disableKeyboardShortcuts,\n // Android-only props\n importantForAutofill,\n disableFullscreenUI,\n inlineImageLeft,\n inlineImagePadding,\n returnKeyLabel,\n textBreakStrategy,\n textAlignVertical,\n verticalAlign,\n showSoftInputOnFocus,\n numberOfLines: numberOfLinesProp,\n // Web-only props to filter out\n // @ts-ignore\n dirname,\n min,\n max,\n minLength,\n multiple,\n name,\n pattern,\n required,\n step,\n render,\n // caretColor is web-only as a CSS prop; on native forward to\n // cursorColor (Android) + selectionColor (iOS+Android caret) unless\n // those are explicitly set.\n // @ts-ignore - caretColor is typed as web-only in core\n caretColor,\n cursorColor: cursorColorProp,\n selectionColor: selectionColorProp,\n ...rest\n } = props;\n var { ref, composedRef } = (0, import_element.useNativeInputRef)(forwardedRef);\n var secureTextEntry = secureTextEntryProp !== null && secureTextEntryProp !== void 0 ? secureTextEntryProp : false;\n var keyboardType = keyboardTypeProp !== null && keyboardTypeProp !== void 0 ? keyboardTypeProp : \"default\";\n var inputMode = inputModeProp;\n if (!secureTextEntryProp && !keyboardTypeProp && !inputModeProp) {\n switch (type) {\n case \"password\":\n secureTextEntry = true;\n break;\n case \"email\":\n keyboardType = \"email-address\";\n inputMode = \"email\";\n break;\n case \"tel\":\n keyboardType = \"phone-pad\";\n inputMode = \"tel\";\n break;\n case \"number\":\n keyboardType = \"numeric\";\n inputMode = \"numeric\";\n break;\n case \"url\":\n keyboardType = \"url\";\n inputMode = \"url\";\n break;\n case \"search\":\n inputMode = \"search\";\n break;\n }\n }\n var returnKeyType = returnKeyTypeProp;\n if (!returnKeyType && enterKeyHint) {\n switch (enterKeyHint) {\n case \"done\":\n returnKeyType = \"done\";\n break;\n case \"go\":\n returnKeyType = \"go\";\n break;\n case \"next\":\n returnKeyType = \"next\";\n break;\n case \"search\":\n returnKeyType = \"search\";\n break;\n case \"send\":\n returnKeyType = \"send\";\n break;\n }\n }\n var multiline = multilineProp !== null && multilineProp !== void 0 ? multilineProp : render === \"textarea\" || rows && rows > 1;\n var numberOfLines = numberOfLinesProp !== null && numberOfLinesProp !== void 0 ? numberOfLinesProp : rows;\n var autoCorrect = autoCorrectProp === \"on\" ? true : autoCorrectProp === \"off\" ? false : autoCorrectProp;\n var autoCapitalize = autoCapitalizeProp === \"on\" ? \"sentences\" : autoCapitalizeProp === \"off\" ? \"none\" : autoCapitalizeProp;\n import_react.default.useEffect(function() {\n if (!id || disabled) return;\n return (0, import_focusable.registerFocusable)(id, {\n focusAndSelect: function() {\n var _ref_current;\n return (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.focus();\n },\n focus: function() {\n var _ref_current;\n return (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.focus();\n }\n });\n }, [\n id,\n disabled\n ]);\n var handleChangeText = function(text) {\n onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(text);\n if (onChange) {\n onChange({\n target: {\n value: text\n },\n type: \"change\"\n });\n }\n if (onInput) {\n onInput({\n target: {\n value: text\n },\n type: \"input\"\n });\n }\n };\n var handleKeyPress = function(e) {\n onKeyPressProp === null || onKeyPressProp === void 0 ? void 0 : onKeyPressProp(e);\n if (onKeyDown) {\n var { key } = e.nativeEvent;\n if (key === \"Backspace\" || key === \"Enter\" || key.length === 1) {\n onKeyDown({\n key,\n type: \"keydown\"\n });\n }\n }\n };\n var handleSubmitEditing = function(e) {\n if (onKeyDown) {\n onKeyDown({\n key: \"Enter\",\n type: \"keydown\"\n });\n }\n onSubmitEditing === null || onSubmitEditing === void 0 ? void 0 : onSubmitEditing(e);\n };\n var handleSelectionChange = function(e) {\n onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(e);\n };\n var finalProps = {\n ...rest,\n editable: !disabled && !readOnly,\n secureTextEntry,\n keyboardType,\n keyboardAppearance,\n inputMode,\n returnKeyType,\n multiline,\n numberOfLines,\n selection,\n autoComplete,\n autoFocus: autoFocusNative,\n // callbacks\n onChangeText: handleChangeText,\n onKeyPress: onKeyPressProp || onKeyDown ? handleKeyPress : void 0,\n onSubmitEditing: onKeyDown || onSubmitEditing ? handleSubmitEditing : void 0,\n onSelectionChange: onSelectionChange ? handleSelectionChange : void 0,\n onEndEditing,\n onContentSizeChange,\n onScroll,\n // cross-platform native props\n submitBehavior,\n blurOnSubmit,\n caretHidden,\n contextMenuHidden,\n selectTextOnFocus,\n maxFontSizeMultiplier,\n allowFontScaling,\n autoCapitalize,\n autoCorrect,\n textContentType,\n // iOS-only props\n clearButtonMode,\n clearTextOnFocus,\n enablesReturnKeyAutomatically,\n dataDetectorTypes,\n scrollEnabled,\n passwordRules,\n rejectResponderTermination,\n spellCheck,\n lineBreakStrategyIOS,\n lineBreakModeIOS,\n smartInsertDelete,\n inputAccessoryViewID,\n inputAccessoryViewButtonLabel,\n disableKeyboardShortcuts,\n // Android-only props\n importantForAutofill,\n disableFullscreenUI,\n inlineImageLeft,\n inlineImagePadding,\n returnKeyLabel,\n textBreakStrategy,\n textAlignVertical,\n verticalAlign,\n showSoftInputOnFocus,\n // caretColor → cursorColor (Android) + selectionColor (iOS+Android),\n // unless the caller passed those explicitly.\n cursorColor: cursorColorProp !== null && cursorColorProp !== void 0 ? cursorColorProp : caretColor,\n selectionColor: selectionColorProp !== null && selectionColorProp !== void 0 ? selectionColorProp : caretColor\n };\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledInput, {\n ref: composedRef,\n ...finalProps\n });\n});\n//# sourceMappingURL=Input.native.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,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EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EAEX,cAAc;EACd,YAAY,kBAAkB,YAAY,iBAAiB,KAAK;EAChE,iBAAiB,aAAa,kBAAkB,sBAAsB,KAAK;EAC3E,mBAAmB,oBAAoB,wBAAwB,KAAK;EACpE;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA,aAAa,oBAAoB,QAAQ,oBAAoB,KAAK,IAAI,kBAAkB;EACxF,gBAAgB,uBAAuB,QAAQ,uBAAuB,KAAK,IAAI,qBAAqB;CACtG;CACA,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,aAAa;EAC9D,KAAK;EACL,GAAG;CACL,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"Input.native.js","names":[],"sources":["jsx/Input.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar Input_native_exports = {};\n__export(Input_native_exports, {\n Input: () => Input\n});\nmodule.exports = __toCommonJS(Input_native_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_react = __toESM(require(\"react\"), 1);\nvar import_react_native = require(\"react-native\");\nvar import_core = require(\"@tamagui/core\");\nvar import_focusable = require(\"@tamagui/focusable\");\nvar import_element = require(\"@tamagui/element\");\nvar import_shared = require(\"./shared\");\nvar NativeTextInput = import_react_native.TextInput;\nvar StyledInput = (0, import_core.styled)(NativeTextInput, import_shared.styledBody[0], import_shared.styledBody[1]).resolve(import_shared.resolveMultilineInputSize);\nvar Input = (0, import_core.createStyledHOC)(StyledInput, function(props, forwardedRef) {\n var {\n // Web props we need to convert\n type,\n disabled,\n readOnly,\n id,\n rows,\n autoComplete,\n enterKeyHint,\n // Callbacks\n onChange,\n onInput,\n onKeyDown,\n onChangeText,\n onSubmitEditing,\n onSelectionChange,\n onEndEditing,\n onContentSizeChange,\n onScroll,\n onKeyPress: onKeyPressProp,\n selection,\n // Native-only props (pass through directly)\n keyboardAppearance,\n returnKeyType: returnKeyTypeProp,\n submitBehavior,\n blurOnSubmit,\n caretHidden,\n contextMenuHidden,\n selectTextOnFocus,\n secureTextEntry: secureTextEntryProp,\n maxFontSizeMultiplier,\n allowFontScaling,\n multiline: multilineProp,\n keyboardType: keyboardTypeProp,\n inputMode: inputModeProp,\n autoCapitalize: autoCapitalizeProp,\n autoCorrect: autoCorrectProp,\n autoFocusNative,\n textContentType,\n // iOS-only props\n clearButtonMode,\n clearTextOnFocus,\n enablesReturnKeyAutomatically,\n dataDetectorTypes,\n scrollEnabled,\n passwordRules,\n rejectResponderTermination,\n spellCheck,\n lineBreakStrategyIOS,\n lineBreakModeIOS,\n smartInsertDelete,\n inputAccessoryViewID,\n inputAccessoryViewButtonLabel,\n disableKeyboardShortcuts,\n // Android-only props\n importantForAutofill,\n disableFullscreenUI,\n inlineImageLeft,\n inlineImagePadding,\n returnKeyLabel,\n textBreakStrategy,\n textAlignVertical,\n verticalAlign,\n showSoftInputOnFocus,\n numberOfLines: numberOfLinesProp,\n // Web-only props to filter out\n // @ts-ignore\n dirname,\n min,\n max,\n minLength,\n multiple,\n name,\n pattern,\n required,\n step,\n render,\n // caretColor is web-only as a CSS prop; on native forward to\n // cursorColor (Android) + selectionColor (iOS+Android caret) unless\n // those are explicitly set.\n // @ts-ignore - caretColor is typed as web-only in core\n caretColor,\n cursorColor: cursorColorProp,\n selectionColor: selectionColorProp,\n ...rest\n } = props;\n var { ref, composedRef } = (0, import_element.useNativeInputRef)(forwardedRef);\n var secureTextEntry = secureTextEntryProp !== null && secureTextEntryProp !== void 0 ? secureTextEntryProp : false;\n var keyboardType = keyboardTypeProp !== null && keyboardTypeProp !== void 0 ? keyboardTypeProp : \"default\";\n var inputMode = inputModeProp;\n if (!secureTextEntryProp && !keyboardTypeProp && !inputModeProp) {\n switch (type) {\n case \"password\":\n secureTextEntry = true;\n break;\n case \"email\":\n keyboardType = \"email-address\";\n inputMode = \"email\";\n break;\n case \"tel\":\n keyboardType = \"phone-pad\";\n inputMode = \"tel\";\n break;\n case \"number\":\n keyboardType = \"numeric\";\n inputMode = \"numeric\";\n break;\n case \"url\":\n keyboardType = \"url\";\n inputMode = \"url\";\n break;\n case \"search\":\n inputMode = \"search\";\n break;\n }\n }\n var returnKeyType = returnKeyTypeProp;\n if (!returnKeyType && enterKeyHint) {\n switch (enterKeyHint) {\n case \"done\":\n returnKeyType = \"done\";\n break;\n case \"go\":\n returnKeyType = \"go\";\n break;\n case \"next\":\n returnKeyType = \"next\";\n break;\n case \"search\":\n returnKeyType = \"search\";\n break;\n case \"send\":\n returnKeyType = \"send\";\n break;\n }\n }\n var multiline = multilineProp !== null && multilineProp !== void 0 ? multilineProp : render === \"textarea\" || rows && rows > 1;\n var numberOfLines = numberOfLinesProp !== null && numberOfLinesProp !== void 0 ? numberOfLinesProp : rows;\n var autoCorrect = autoCorrectProp === \"on\" ? true : autoCorrectProp === \"off\" ? false : autoCorrectProp;\n var autoCapitalize = autoCapitalizeProp === \"on\" ? \"sentences\" : autoCapitalizeProp === \"off\" ? \"none\" : autoCapitalizeProp;\n import_react.default.useEffect(function() {\n if (!id || disabled) return;\n return (0, import_focusable.registerFocusable)(id, {\n focusAndSelect: function() {\n var _ref_current;\n return (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.focus();\n },\n focus: function() {\n var _ref_current;\n return (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.focus();\n }\n });\n }, [\n id,\n disabled\n ]);\n var handleChangeText = function(text) {\n onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(text);\n if (onChange) {\n onChange({\n target: {\n value: text\n },\n type: \"change\"\n });\n }\n if (onInput) {\n onInput({\n target: {\n value: text\n },\n type: \"input\"\n });\n }\n };\n var handleKeyPress = function(e) {\n onKeyPressProp === null || onKeyPressProp === void 0 ? void 0 : onKeyPressProp(e);\n if (onKeyDown) {\n var { key } = e.nativeEvent;\n if (key === \"Backspace\" || key === \"Enter\" || key.length === 1) {\n onKeyDown({\n key,\n type: \"keydown\"\n });\n }\n }\n };\n var handleSubmitEditing = function(e) {\n if (onKeyDown) {\n onKeyDown({\n key: \"Enter\",\n type: \"keydown\"\n });\n }\n onSubmitEditing === null || onSubmitEditing === void 0 ? void 0 : onSubmitEditing(e);\n };\n var handleSelectionChange = function(e) {\n onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(e);\n };\n var finalProps = {\n ...rest,\n editable: !disabled && !readOnly,\n secureTextEntry,\n keyboardType,\n keyboardAppearance,\n inputMode,\n returnKeyType,\n multiline,\n numberOfLines,\n selection,\n autoComplete,\n autoFocus: autoFocusNative,\n // callbacks\n onChangeText: handleChangeText,\n onKeyPress: onKeyPressProp || onKeyDown ? handleKeyPress : void 0,\n onSubmitEditing: onKeyDown || onSubmitEditing ? handleSubmitEditing : void 0,\n onSelectionChange: onSelectionChange ? handleSelectionChange : void 0,\n onEndEditing,\n onContentSizeChange,\n onScroll,\n // cross-platform native props\n submitBehavior,\n blurOnSubmit,\n caretHidden,\n contextMenuHidden,\n selectTextOnFocus,\n maxFontSizeMultiplier,\n allowFontScaling,\n autoCapitalize,\n autoCorrect,\n textContentType,\n // iOS-only props\n clearButtonMode,\n clearTextOnFocus,\n enablesReturnKeyAutomatically,\n dataDetectorTypes,\n scrollEnabled,\n passwordRules,\n rejectResponderTermination,\n spellCheck,\n lineBreakStrategyIOS,\n lineBreakModeIOS,\n smartInsertDelete,\n inputAccessoryViewID,\n inputAccessoryViewButtonLabel,\n disableKeyboardShortcuts,\n // Android-only props\n importantForAutofill,\n disableFullscreenUI,\n inlineImageLeft,\n inlineImagePadding,\n returnKeyLabel,\n textBreakStrategy,\n textAlignVertical,\n verticalAlign,\n showSoftInputOnFocus,\n // caretColor → cursorColor (Android) + selectionColor (iOS+Android),\n // unless the caller passed those explicitly.\n cursorColor: cursorColorProp !== null && cursorColorProp !== void 0 ? cursorColorProp : caretColor,\n selectionColor: selectionColorProp !== null && selectionColorProp !== void 0 ? selectionColorProp : caretColor\n };\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledInput, {\n ref: composedRef,\n ...finalProps\n });\n});\n//# sourceMappingURL=Input.native.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;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S,GAAG;EACpC,IAAI,WAAW;GACb,UAAU;IACR,KAAK;IACL,MAAM;GACR,CAAC;EACH;EACA,oBAAoB,QAAQ,oBAAoB,KAAK,IAAI,KAAK,IAAI,gBAAgB,CAAC;CACrF;CACA,IAAI,wBAAwB,SAAS,GAAG;EACtC,sBAAsB,QAAQ,sBAAsB,KAAK,IAAI,KAAK,IAAI,kBAAkB,CAAC;CAC3F;CACA,IAAI,aAAa;EACf,GAAG;EACH,UAAU,CAAC,YAAY,CAAC;EACxB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EAEX,cAAc;EACd,YAAY,kBAAkB,YAAY,iBAAiB,KAAK;EAChE,iBAAiB,aAAa,kBAAkB,sBAAsB,KAAK;EAC3E,mBAAmB,oBAAoB,wBAAwB,KAAK;EACpE;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA,aAAa,oBAAoB,QAAQ,oBAAoB,KAAK,IAAI,kBAAkB;EACxF,gBAAgB,uBAAuB,QAAQ,uBAAuB,KAAK,IAAI,qBAAqB;CACtG;CACA,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,aAAa;EAC9D,KAAK;EACL,GAAG;CACL,CAAC;AACH,CAAC"}
|
package/dist/jsx/TextArea.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { styled } from "@tamagui/web";
|
|
2
2
|
import { Input } from "./Input.mjs";
|
|
3
|
-
import { defaultStyles, resolveTextAreaSize
|
|
3
|
+
import { defaultStyles, resolveTextAreaSize } from "./shared.mjs";
|
|
4
4
|
|
|
5
5
|
const TextAreaFrame = styled(Input, {
|
|
6
6
|
displayName: "TextArea",
|
|
@@ -8,8 +8,7 @@ const TextAreaFrame = styled(Input, {
|
|
|
8
8
|
whiteSpace: "pre-wrap",
|
|
9
9
|
height: "auto",
|
|
10
10
|
...defaultStyles,
|
|
11
|
-
rows: 3
|
|
12
|
-
variants: { size: textAreaSizeVariant }
|
|
11
|
+
rows: 3
|
|
13
12
|
});
|
|
14
13
|
const TextArea = TextAreaFrame.resolve(resolveTextAreaSize);
|
|
15
14
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.js","names":[],"sources":["jsx/TextArea.js"],"sourcesContent":["import { styled } from \"@tamagui/web\";\nimport { Input } from \"./Input\";\nimport { defaultStyles, resolveTextAreaSize
|
|
1
|
+
{"version":3,"file":"TextArea.js","names":[],"sources":["jsx/TextArea.js"],"sourcesContent":["import { styled } from \"@tamagui/web\";\nimport { Input } from \"./Input\";\nimport { defaultStyles, resolveTextAreaSize } from \"./shared\";\nconst TextAreaFrame = styled(Input, {\n displayName: \"TextArea\",\n render: \"textarea\",\n // this attribute fixes firefox newline issue\n // @ts-ignore\n whiteSpace: \"pre-wrap\",\n height: \"auto\",\n ...defaultStyles,\n rows: 3\n});\nconst TextArea = TextAreaFrame.resolve(resolveTextAreaSize);\nexport {\n TextArea\n};\n//# sourceMappingURL=TextArea.js.map\n"],"mappings":";;;;;AAGA,MAAM,gBAAgB,OAAO,OAAO;CAClC,aAAa;CACb,QAAQ;CAGR,YAAY;CACZ,QAAQ;CACR,GAAG;CACH,MAAM;AACR,CAAC;AACD,MAAM,WAAW,cAAc,QAAQ,mBAAmB"}
|
|
@@ -32,7 +32,6 @@ var TextAreaFrame = (0, import_web.styled)(import_Input.Input, {
|
|
|
32
32
|
whiteSpace: "pre-wrap",
|
|
33
33
|
height: "auto",
|
|
34
34
|
...import_shared.defaultStyles,
|
|
35
|
-
rows: 3
|
|
36
|
-
variants: { size: import_shared.textAreaSizeVariant }
|
|
35
|
+
rows: 3
|
|
37
36
|
});
|
|
38
37
|
var TextArea = TextAreaFrame.resolve(import_shared.resolveTextAreaSize);
|
|
@@ -32,8 +32,7 @@ var TextAreaFrame = (0, import_web.styled)(import_Input.Input, {
|
|
|
32
32
|
whiteSpace: "pre-wrap",
|
|
33
33
|
height: "auto",
|
|
34
34
|
...import_shared.defaultStyles,
|
|
35
|
-
rows: 3
|
|
36
|
-
variants: { size: import_shared.textAreaSizeVariant }
|
|
35
|
+
rows: 3
|
|
37
36
|
});
|
|
38
37
|
var TextArea = TextAreaFrame.resolve(import_shared.resolveTextAreaSize);
|
|
39
38
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.native.js","names":[],"sources":["jsx/TextArea.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar TextArea_exports = {};\n__export(TextArea_exports, {\n TextArea: () => TextArea\n});\nmodule.exports = __toCommonJS(TextArea_exports);\nvar import_web = require(\"@tamagui/web\");\nvar import_Input = require(\"./Input\");\nvar import_shared = require(\"./shared\");\nvar TextAreaFrame = (0, import_web.styled)(import_Input.Input, {\n displayName: \"TextArea\",\n render: \"textarea\",\n // this attribute fixes firefox newline issue\n // @ts-ignore\n whiteSpace: \"pre-wrap\",\n height: \"auto\",\n ...import_shared.defaultStyles,\n rows: 3
|
|
1
|
+
{"version":3,"file":"TextArea.native.js","names":[],"sources":["jsx/TextArea.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar TextArea_exports = {};\n__export(TextArea_exports, {\n TextArea: () => TextArea\n});\nmodule.exports = __toCommonJS(TextArea_exports);\nvar import_web = require(\"@tamagui/web\");\nvar import_Input = require(\"./Input\");\nvar import_shared = require(\"./shared\");\nvar TextAreaFrame = (0, import_web.styled)(import_Input.Input, {\n displayName: \"TextArea\",\n render: \"textarea\",\n // this attribute fixes firefox newline issue\n // @ts-ignore\n whiteSpace: \"pre-wrap\",\n height: \"auto\",\n ...import_shared.defaultStyles,\n rows: 3\n});\nvar TextArea = TextAreaFrame.resolve(import_shared.resolveTextAreaSize);\n//# sourceMappingURL=TextArea.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,mBAAmB,CAAC;AACxB,SAAS,kBAAkB,EACzB,gBAAgB,SAClB,CAAC;AACD,OAAO,UAAU,aAAa,gBAAgB;AAC9C,IAAI,aAAa,QAAQ,cAAc;AACvC,IAAI,eAAe,QAAQ,mBAAS;AACpC,IAAI,gBAAgB,QAAQ,oBAAU;AACtC,IAAI,iBAAiB,GAAG,WAAW,OAAM,CAAE,aAAa,OAAO;CAC7D,aAAa;CACb,QAAQ;CAGR,YAAY;CACZ,QAAQ;CACR,GAAG,cAAc;CACjB,MAAM;AACR,CAAC;AACD,IAAI,WAAW,cAAc,QAAQ,cAAc,mBAAmB"}
|
package/dist/jsx/index.js
CHANGED
package/dist/jsx/index.mjs
CHANGED
|
@@ -4,12 +4,6 @@ var __defProp = Object.defineProperty;
|
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
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
7
|
var __copyProps = (to, from, except, desc) => {
|
|
14
8
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
9
|
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
@@ -22,11 +16,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
22
16
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
23
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
18
|
var index_exports = {};
|
|
25
|
-
__export(index_exports, {
|
|
26
|
-
inputSizeVariant: () => import_shared.inputSizeVariant,
|
|
27
|
-
textAreaSizeVariant: () => import_shared.textAreaSizeVariant
|
|
28
|
-
});
|
|
29
19
|
module.exports = __toCommonJS(index_exports);
|
|
30
20
|
__reExport(index_exports, require("./Input.native.js"), module.exports);
|
|
31
21
|
__reExport(index_exports, require("./TextArea.native.js"), module.exports);
|
|
32
|
-
var import_shared = require("./shared.native.js");
|
package/dist/jsx/index.native.js
CHANGED
|
@@ -4,12 +4,6 @@ var __defProp = Object.defineProperty;
|
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
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
7
|
var __copyProps = (to, from, except, desc) => {
|
|
14
8
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
9
|
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
@@ -22,13 +16,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
22
16
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
23
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
18
|
var index_exports = {};
|
|
25
|
-
__export(index_exports, {
|
|
26
|
-
inputSizeVariant: () => import_shared.inputSizeVariant,
|
|
27
|
-
textAreaSizeVariant: () => import_shared.textAreaSizeVariant
|
|
28
|
-
});
|
|
29
19
|
module.exports = __toCommonJS(index_exports);
|
|
30
20
|
__reExport(index_exports, require("./Input.native.js"), module.exports);
|
|
31
21
|
__reExport(index_exports, require("./TextArea.native.js"), module.exports);
|
|
32
|
-
var import_shared = require("./shared.native.js");
|
|
33
22
|
|
|
34
23
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":[],"sources":["jsx/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar
|
|
1
|
+
{"version":3,"file":"index.native.js","names":[],"sources":["jsx/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"./Input\"), module.exports);\n__reExport(index_exports, require(\"./TextArea\"), module.exports);\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,cAAc,QAAQ,KAAK,kBAAkB,YAAY,QAAQ,KAAK,SAAS,GAAG,gBAAgB,YAAY,cAAc,KAAK,SAAS;AAC9I,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,OAAO,UAAU,aAAa,aAAa;AAC3C,WAAW,eAAe,QAAQ,mBAAS,GAAG,OAAO,OAAO;AAC5D,WAAW,eAAe,QAAQ,sBAAY,GAAG,OAAO,OAAO"}
|
package/dist/jsx/shared.mjs
CHANGED
|
@@ -1,108 +1,23 @@
|
|
|
1
|
-
import { getVariableValue,
|
|
2
|
-
import { getFontSized } from "@tamagui/get-font-sized";
|
|
1
|
+
import { getVariableValue, resolveTextMetrics } from "@tamagui/core";
|
|
3
2
|
|
|
4
3
|
const defaultStyles = {
|
|
5
|
-
size: true,
|
|
6
4
|
outlineWidth: 0,
|
|
7
5
|
tabIndex: 0,
|
|
8
6
|
minWidth: 0
|
|
9
7
|
};
|
|
10
|
-
const resolveInputFrame = (val, env) => resolveTokenSize(val, {
|
|
11
|
-
tokens: env.tokens,
|
|
12
|
-
font: env.font
|
|
13
|
-
}).frame;
|
|
14
|
-
const inputSizeKeys = [
|
|
15
|
-
"0",
|
|
16
|
-
"0-25",
|
|
17
|
-
"0-5",
|
|
18
|
-
"0-75",
|
|
19
|
-
"1",
|
|
20
|
-
"1-5",
|
|
21
|
-
"2",
|
|
22
|
-
"2-5",
|
|
23
|
-
"3",
|
|
24
|
-
"3-5",
|
|
25
|
-
"4",
|
|
26
|
-
"4-5",
|
|
27
|
-
"5",
|
|
28
|
-
"6",
|
|
29
|
-
"7",
|
|
30
|
-
"8",
|
|
31
|
-
"9",
|
|
32
|
-
"10",
|
|
33
|
-
"11",
|
|
34
|
-
"12",
|
|
35
|
-
"13",
|
|
36
|
-
"14",
|
|
37
|
-
"15",
|
|
38
|
-
"16",
|
|
39
|
-
"17",
|
|
40
|
-
"18",
|
|
41
|
-
"19",
|
|
42
|
-
"20"
|
|
43
|
-
];
|
|
44
|
-
const getInputPadding = (val, env, steps) => {
|
|
45
|
-
if (typeof val === "number") {
|
|
46
|
-
return steps === 1 ? Math.max(0, Math.round(val * .6 - 12)) : Math.max(0, Math.round(val * .52 - 11.5));
|
|
47
|
-
}
|
|
48
|
-
const key = val === true ? "4" : val;
|
|
49
|
-
const index = inputSizeKeys.indexOf(key);
|
|
50
|
-
return env.tokens.space[inputSizeKeys[Math.max(0, index - steps)]];
|
|
51
|
-
};
|
|
52
|
-
const inputSizeVariant = styled.dynamic((val = true, env) => {
|
|
53
|
-
const frame = resolveInputFrame(val, env);
|
|
54
|
-
const fontStyle = getFontSized(val, env);
|
|
55
|
-
return {
|
|
56
|
-
color: fontStyle?.color,
|
|
57
|
-
fontFamily: fontStyle?.fontFamily,
|
|
58
|
-
fontSize: fontStyle?.fontSize,
|
|
59
|
-
fontStyle: fontStyle?.fontStyle,
|
|
60
|
-
fontWeight: fontStyle?.fontWeight,
|
|
61
|
-
letterSpacing: fontStyle?.letterSpacing,
|
|
62
|
-
lineHeight: isWeb ? fontStyle?.lineHeight : void 0,
|
|
63
|
-
textTransform: fontStyle?.textTransform,
|
|
64
|
-
height: frame.size,
|
|
65
|
-
borderRadius: frame.radius,
|
|
66
|
-
paddingHorizontal: getInputPadding(val, env, 1)
|
|
67
|
-
};
|
|
68
|
-
});
|
|
69
|
-
const textAreaSizeVariant = styled.dynamic((val = true, env) => {
|
|
70
|
-
const frame = resolveInputFrame(val, env);
|
|
71
|
-
const fontStyle = getFontSized(val, env);
|
|
72
|
-
return {
|
|
73
|
-
borderRadius: frame.radius,
|
|
74
|
-
color: fontStyle?.color,
|
|
75
|
-
fontFamily: fontStyle?.fontFamily,
|
|
76
|
-
fontSize: fontStyle?.fontSize,
|
|
77
|
-
fontStyle: fontStyle?.fontStyle,
|
|
78
|
-
fontWeight: fontStyle?.fontWeight,
|
|
79
|
-
letterSpacing: fontStyle?.letterSpacing,
|
|
80
|
-
lineHeight: isWeb ? fontStyle?.lineHeight : void 0,
|
|
81
|
-
textTransform: fontStyle?.textTransform,
|
|
82
|
-
paddingVertical: getInputPadding(val, env, 2),
|
|
83
|
-
paddingHorizontal: getInputPadding(val, env, 1),
|
|
84
|
-
height: "auto"
|
|
85
|
-
};
|
|
86
|
-
});
|
|
87
8
|
const resolveTextAreaSize = (props, env) => {
|
|
88
|
-
const
|
|
89
|
-
const
|
|
9
|
+
const font = props.fontFamily ? env.fonts[props.fontFamily] : env.font;
|
|
10
|
+
const defaultKey = font && "sm" in font.size ? "sm" : "4";
|
|
11
|
+
const fontSize = props.fontSize ?? defaultKey;
|
|
12
|
+
const lineHeight = props.lineHeight ?? font?.lineHeight?.[defaultKey];
|
|
13
|
+
const configuredSize = typeof fontSize === "string" ? font?.size[fontSize] : void 0;
|
|
14
|
+
const configuredLeading = typeof lineHeight === "string" ? font?.lineHeight?.[lineHeight] : void 0;
|
|
15
|
+
const metrics = { fontSize: Number.parseFloat(String(getVariableValue(configuredSize ?? fontSize))) };
|
|
16
|
+
const leading = configuredLeading ?? lineHeight;
|
|
17
|
+
resolveTextMetrics(metrics, (props.lineHeight == null || configuredLeading !== void 0) && typeof leading === "number" ? `${leading}px` : leading);
|
|
90
18
|
const lines = props.rows ?? props.numberOfLines;
|
|
91
|
-
const height = typeof lines === "number" ? lines *
|
|
92
|
-
return {
|
|
93
|
-
borderRadius: sized?.borderRadius,
|
|
94
|
-
color: sized?.color,
|
|
95
|
-
fontFamily: sized?.fontFamily,
|
|
96
|
-
fontSize: sized?.fontSize,
|
|
97
|
-
fontStyle: sized?.fontStyle,
|
|
98
|
-
fontWeight: sized?.fontWeight,
|
|
99
|
-
letterSpacing: sized?.letterSpacing,
|
|
100
|
-
lineHeight: sized?.lineHeight,
|
|
101
|
-
textTransform: sized?.textTransform,
|
|
102
|
-
paddingVertical: sized?.paddingVertical,
|
|
103
|
-
paddingHorizontal: sized?.paddingHorizontal,
|
|
104
|
-
height
|
|
105
|
-
};
|
|
19
|
+
const height = typeof lines === "number" && typeof metrics.lineHeight === "number" ? lines * metrics.lineHeight : void 0;
|
|
20
|
+
return { height };
|
|
106
21
|
};
|
|
107
22
|
const resolveMultilineInputSize = (props, env) => {
|
|
108
23
|
if (!(props.rows > 1 || props.multiline || props.numberOfLines > 1)) return;
|
|
@@ -113,11 +28,8 @@ const styledBody = [{
|
|
|
113
28
|
name: INPUT_NAME,
|
|
114
29
|
render: "input",
|
|
115
30
|
...defaultStyles,
|
|
116
|
-
variants: {
|
|
117
|
-
size: inputSizeVariant,
|
|
118
|
-
disabled: { true: {} }
|
|
119
|
-
}
|
|
31
|
+
variants: { disabled: { true: {} } }
|
|
120
32
|
}, { isInput: true }];
|
|
121
33
|
|
|
122
|
-
export { INPUT_NAME, defaultStyles,
|
|
34
|
+
export { INPUT_NAME, defaultStyles, resolveMultilineInputSize, resolveTextAreaSize, styledBody };
|
|
123
35
|
//# sourceMappingURL=shared.mjs.map
|
package/dist/jsx/shared.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","names":[],"sources":["jsx/shared.js"],"sourcesContent":["import { getVariableValue,
|
|
1
|
+
{"version":3,"file":"shared.js","names":[],"sources":["jsx/shared.js"],"sourcesContent":["import { getVariableValue, resolveTextMetrics } from \"@tamagui/core\";\nconst defaultStyles = {\n outlineWidth: 0,\n tabIndex: 0,\n // this fixes a flex bug where it overflows container\n minWidth: 0\n};\nconst resolveTextAreaSize = (props, env) => {\n const font = props.fontFamily ? env.fonts[props.fontFamily] : env.font;\n const defaultKey = font && \"sm\" in font.size ? \"sm\" : \"4\";\n const fontSize = props.fontSize ?? defaultKey;\n const lineHeight = props.lineHeight ?? font?.lineHeight?.[defaultKey];\n const configuredSize = typeof fontSize === \"string\" ? font?.size[fontSize] : void 0;\n const configuredLeading = typeof lineHeight === \"string\" ? font?.lineHeight?.[lineHeight] : void 0;\n const metrics = {\n fontSize: Number.parseFloat(String(getVariableValue(configuredSize ?? fontSize)))\n };\n const leading = configuredLeading ?? lineHeight;\n resolveTextMetrics(\n metrics,\n (props.lineHeight == null || configuredLeading !== void 0) && typeof leading === \"number\" ? `${leading}px` : leading\n );\n const lines = props.rows ?? props.numberOfLines;\n const height = typeof lines === \"number\" && typeof metrics.lineHeight === \"number\" ? lines * metrics.lineHeight : void 0;\n return {\n height\n };\n};\nconst resolveMultilineInputSize = (props, env) => {\n if (!(props.rows > 1 || props.multiline || props.numberOfLines > 1)) return;\n return resolveTextAreaSize(props, env);\n};\nconst INPUT_NAME = \"Input\";\nconst styledBody = [\n {\n name: INPUT_NAME,\n render: \"input\",\n ...defaultStyles,\n variants: {\n disabled: {\n true: {}\n }\n }\n },\n {\n isInput: true\n }\n];\nexport {\n INPUT_NAME,\n defaultStyles,\n resolveMultilineInputSize,\n resolveTextAreaSize,\n styledBody\n};\n//# sourceMappingURL=shared.js.map\n"],"mappings":";;;AACA,MAAM,gBAAgB;CACpB,cAAc;CACd,UAAU;CAEV,UAAU;AACZ;AACA,MAAM,uBAAuB,OAAO,QAAQ;CAC1C,MAAM,OAAO,MAAM,aAAa,IAAI,MAAM,MAAM,cAAc,IAAI;CAClE,MAAM,aAAa,QAAQ,QAAQ,KAAK,OAAO,OAAO;CACtD,MAAM,WAAW,MAAM,YAAY;CACnC,MAAM,aAAa,MAAM,cAAc,MAAM,aAAa;CAC1D,MAAM,iBAAiB,OAAO,aAAa,WAAW,MAAM,KAAK,YAAY,KAAK;CAClF,MAAM,oBAAoB,OAAO,eAAe,WAAW,MAAM,aAAa,cAAc,KAAK;CACjG,MAAM,UAAU,EACd,UAAU,OAAO,WAAW,OAAO,iBAAiB,kBAAkB,QAAQ,CAAC,CAAC,EAClF;CACA,MAAM,UAAU,qBAAqB;CACrC,mBACE,UACC,MAAM,cAAc,QAAQ,sBAAsB,KAAK,MAAM,OAAO,YAAY,WAAW,GAAG,QAAQ,MAAM,OAC/G;CACA,MAAM,QAAQ,MAAM,QAAQ,MAAM;CAClC,MAAM,SAAS,OAAO,UAAU,YAAY,OAAO,QAAQ,eAAe,WAAW,QAAQ,QAAQ,aAAa,KAAK;CACvH,OAAO,EACL,OACF;AACF;AACA,MAAM,6BAA6B,OAAO,QAAQ;CAChD,IAAI,EAAE,MAAM,OAAO,KAAK,MAAM,aAAa,MAAM,gBAAgB,IAAI;CACrE,OAAO,oBAAoB,OAAO,GAAG;AACvC;AACA,MAAM,aAAa;AACnB,MAAM,aAAa,CACjB;CACE,MAAM;CACN,QAAQ;CACR,GAAG;CACH,UAAU,EACR,UAAU,EACR,MAAM,CAAC,EACT,EACF;AACF,GACA,EACE,SAAS,KACX,CACF"}
|