@tamagui/input 3.0.0-beta.922.1 → 3.0.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.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 +5 -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
|
@@ -24,124 +24,34 @@ var shared_exports = {};
|
|
|
24
24
|
__export(shared_exports, {
|
|
25
25
|
INPUT_NAME: () => INPUT_NAME,
|
|
26
26
|
defaultStyles: () => defaultStyles,
|
|
27
|
-
inputSizeVariant: () => inputSizeVariant,
|
|
28
27
|
resolveMultilineInputSize: () => resolveMultilineInputSize,
|
|
29
28
|
resolveTextAreaSize: () => resolveTextAreaSize,
|
|
30
|
-
styledBody: () => styledBody
|
|
31
|
-
textAreaSizeVariant: () => textAreaSizeVariant
|
|
29
|
+
styledBody: () => styledBody
|
|
32
30
|
});
|
|
33
31
|
module.exports = __toCommonJS(shared_exports);
|
|
34
32
|
var import_core = require("@tamagui/core");
|
|
35
|
-
var import_get_font_sized = require("@tamagui/get-font-sized");
|
|
36
33
|
var defaultStyles = {
|
|
37
|
-
size: true,
|
|
38
34
|
outlineWidth: 0,
|
|
39
35
|
tabIndex: 0,
|
|
40
36
|
minWidth: 0
|
|
41
37
|
};
|
|
42
|
-
var resolveInputFrame = function(val, env) {
|
|
43
|
-
return (0, import_core.resolveTokenSize)(val, {
|
|
44
|
-
tokens: env.tokens,
|
|
45
|
-
font: env.font
|
|
46
|
-
}).frame;
|
|
47
|
-
};
|
|
48
|
-
var inputSizeKeys = [
|
|
49
|
-
"0",
|
|
50
|
-
"0-25",
|
|
51
|
-
"0-5",
|
|
52
|
-
"0-75",
|
|
53
|
-
"1",
|
|
54
|
-
"1-5",
|
|
55
|
-
"2",
|
|
56
|
-
"2-5",
|
|
57
|
-
"3",
|
|
58
|
-
"3-5",
|
|
59
|
-
"4",
|
|
60
|
-
"4-5",
|
|
61
|
-
"5",
|
|
62
|
-
"6",
|
|
63
|
-
"7",
|
|
64
|
-
"8",
|
|
65
|
-
"9",
|
|
66
|
-
"10",
|
|
67
|
-
"11",
|
|
68
|
-
"12",
|
|
69
|
-
"13",
|
|
70
|
-
"14",
|
|
71
|
-
"15",
|
|
72
|
-
"16",
|
|
73
|
-
"17",
|
|
74
|
-
"18",
|
|
75
|
-
"19",
|
|
76
|
-
"20"
|
|
77
|
-
];
|
|
78
|
-
var getInputPadding = function(val, env, steps) {
|
|
79
|
-
if (typeof val === "number") {
|
|
80
|
-
return steps === 1 ? Math.max(0, Math.round(val * .6 - 12)) : Math.max(0, Math.round(val * .52 - 11.5));
|
|
81
|
-
}
|
|
82
|
-
var key = val === true ? "4" : val;
|
|
83
|
-
var index = inputSizeKeys.indexOf(key);
|
|
84
|
-
return env.tokens.space[inputSizeKeys[Math.max(0, index - steps)]];
|
|
85
|
-
};
|
|
86
|
-
var inputSizeVariant = import_core.styled.dynamic(function() {
|
|
87
|
-
var val = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true, env = arguments.length > 1 ? arguments[1] : void 0;
|
|
88
|
-
var frame = resolveInputFrame(val, env);
|
|
89
|
-
var fontStyle = (0, import_get_font_sized.getFontSized)(val, env);
|
|
90
|
-
return {
|
|
91
|
-
color: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.color,
|
|
92
|
-
fontFamily: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontFamily,
|
|
93
|
-
fontSize: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontSize,
|
|
94
|
-
fontStyle: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontStyle,
|
|
95
|
-
fontWeight: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontWeight,
|
|
96
|
-
letterSpacing: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.letterSpacing,
|
|
97
|
-
lineHeight: import_core.isWeb ? fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.lineHeight : void 0,
|
|
98
|
-
textTransform: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.textTransform,
|
|
99
|
-
height: frame.size,
|
|
100
|
-
borderRadius: frame.radius,
|
|
101
|
-
paddingHorizontal: getInputPadding(val, env, 1)
|
|
102
|
-
};
|
|
103
|
-
});
|
|
104
|
-
var textAreaSizeVariant = import_core.styled.dynamic(function() {
|
|
105
|
-
var val = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true, env = arguments.length > 1 ? arguments[1] : void 0;
|
|
106
|
-
var frame = resolveInputFrame(val, env);
|
|
107
|
-
var fontStyle = (0, import_get_font_sized.getFontSized)(val, env);
|
|
108
|
-
return {
|
|
109
|
-
borderRadius: frame.radius,
|
|
110
|
-
color: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.color,
|
|
111
|
-
fontFamily: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontFamily,
|
|
112
|
-
fontSize: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontSize,
|
|
113
|
-
fontStyle: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontStyle,
|
|
114
|
-
fontWeight: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontWeight,
|
|
115
|
-
letterSpacing: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.letterSpacing,
|
|
116
|
-
lineHeight: import_core.isWeb ? fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.lineHeight : void 0,
|
|
117
|
-
textTransform: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.textTransform,
|
|
118
|
-
paddingVertical: getInputPadding(val, env, 2),
|
|
119
|
-
paddingHorizontal: getInputPadding(val, env, 1),
|
|
120
|
-
height: "auto"
|
|
121
|
-
};
|
|
122
|
-
});
|
|
123
38
|
var resolveTextAreaSize = function(props, env) {
|
|
124
|
-
var
|
|
125
|
-
var
|
|
126
|
-
var
|
|
127
|
-
var
|
|
39
|
+
var _font_lineHeight, _font_lineHeight1;
|
|
40
|
+
var font = props.fontFamily ? env.fonts[props.fontFamily] : env.font;
|
|
41
|
+
var defaultKey = font && "sm" in font.size ? "sm" : "4";
|
|
42
|
+
var _props_fontSize;
|
|
43
|
+
var fontSize = (_props_fontSize = props.fontSize) !== null && _props_fontSize !== void 0 ? _props_fontSize : defaultKey;
|
|
44
|
+
var _props_lineHeight;
|
|
45
|
+
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];
|
|
46
|
+
var configuredSize = typeof fontSize === "string" ? font === null || font === void 0 ? void 0 : font.size[fontSize] : void 0;
|
|
47
|
+
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;
|
|
48
|
+
var metrics = { fontSize: Number.parseFloat(String((0, import_core.getVariableValue)(configuredSize !== null && configuredSize !== void 0 ? configuredSize : fontSize))) };
|
|
49
|
+
var leading = configuredLeading !== null && configuredLeading !== void 0 ? configuredLeading : lineHeight;
|
|
50
|
+
(0, import_core.resolveTextMetrics)(metrics, (props.lineHeight == null || configuredLeading !== void 0) && typeof leading === "number" ? `${leading}px` : leading);
|
|
128
51
|
var _props_rows;
|
|
129
52
|
var lines = (_props_rows = props.rows) !== null && _props_rows !== void 0 ? _props_rows : props.numberOfLines;
|
|
130
|
-
var height = typeof lines === "number"
|
|
131
|
-
return {
|
|
132
|
-
borderRadius: sized === null || sized === void 0 ? void 0 : sized.borderRadius,
|
|
133
|
-
color: sized === null || sized === void 0 ? void 0 : sized.color,
|
|
134
|
-
fontFamily: sized === null || sized === void 0 ? void 0 : sized.fontFamily,
|
|
135
|
-
fontSize: sized === null || sized === void 0 ? void 0 : sized.fontSize,
|
|
136
|
-
fontStyle: sized === null || sized === void 0 ? void 0 : sized.fontStyle,
|
|
137
|
-
fontWeight: sized === null || sized === void 0 ? void 0 : sized.fontWeight,
|
|
138
|
-
letterSpacing: sized === null || sized === void 0 ? void 0 : sized.letterSpacing,
|
|
139
|
-
lineHeight: sized === null || sized === void 0 ? void 0 : sized.lineHeight,
|
|
140
|
-
textTransform: sized === null || sized === void 0 ? void 0 : sized.textTransform,
|
|
141
|
-
paddingVertical: sized === null || sized === void 0 ? void 0 : sized.paddingVertical,
|
|
142
|
-
paddingHorizontal: sized === null || sized === void 0 ? void 0 : sized.paddingHorizontal,
|
|
143
|
-
height
|
|
144
|
-
};
|
|
53
|
+
var height = typeof lines === "number" && typeof metrics.lineHeight === "number" ? lines * metrics.lineHeight : void 0;
|
|
54
|
+
return { height };
|
|
145
55
|
};
|
|
146
56
|
var resolveMultilineInputSize = function(props, env) {
|
|
147
57
|
if (!(props.rows > 1 || props.multiline || props.numberOfLines > 1)) return;
|
|
@@ -152,8 +62,5 @@ var styledBody = [{
|
|
|
152
62
|
name: INPUT_NAME,
|
|
153
63
|
render: "input",
|
|
154
64
|
...defaultStyles,
|
|
155
|
-
variants: {
|
|
156
|
-
size: inputSizeVariant,
|
|
157
|
-
disabled: { true: {} }
|
|
158
|
-
}
|
|
65
|
+
variants: { disabled: { true: {} } }
|
|
159
66
|
}, { isInput: true }];
|
|
@@ -24,124 +24,34 @@ var shared_exports = {};
|
|
|
24
24
|
__export(shared_exports, {
|
|
25
25
|
INPUT_NAME: () => INPUT_NAME,
|
|
26
26
|
defaultStyles: () => defaultStyles,
|
|
27
|
-
inputSizeVariant: () => inputSizeVariant,
|
|
28
27
|
resolveMultilineInputSize: () => resolveMultilineInputSize,
|
|
29
28
|
resolveTextAreaSize: () => resolveTextAreaSize,
|
|
30
|
-
styledBody: () => styledBody
|
|
31
|
-
textAreaSizeVariant: () => textAreaSizeVariant
|
|
29
|
+
styledBody: () => styledBody
|
|
32
30
|
});
|
|
33
31
|
module.exports = __toCommonJS(shared_exports);
|
|
34
32
|
var import_core = require("@tamagui/core");
|
|
35
|
-
var import_get_font_sized = require("@tamagui/get-font-sized");
|
|
36
33
|
var defaultStyles = {
|
|
37
|
-
size: true,
|
|
38
34
|
outlineWidth: 0,
|
|
39
35
|
tabIndex: 0,
|
|
40
36
|
minWidth: 0
|
|
41
37
|
};
|
|
42
|
-
var resolveInputFrame = function(val, env) {
|
|
43
|
-
return (0, import_core.resolveTokenSize)(val, {
|
|
44
|
-
tokens: env.tokens,
|
|
45
|
-
font: env.font
|
|
46
|
-
}).frame;
|
|
47
|
-
};
|
|
48
|
-
var inputSizeKeys = [
|
|
49
|
-
"0",
|
|
50
|
-
"0-25",
|
|
51
|
-
"0-5",
|
|
52
|
-
"0-75",
|
|
53
|
-
"1",
|
|
54
|
-
"1-5",
|
|
55
|
-
"2",
|
|
56
|
-
"2-5",
|
|
57
|
-
"3",
|
|
58
|
-
"3-5",
|
|
59
|
-
"4",
|
|
60
|
-
"4-5",
|
|
61
|
-
"5",
|
|
62
|
-
"6",
|
|
63
|
-
"7",
|
|
64
|
-
"8",
|
|
65
|
-
"9",
|
|
66
|
-
"10",
|
|
67
|
-
"11",
|
|
68
|
-
"12",
|
|
69
|
-
"13",
|
|
70
|
-
"14",
|
|
71
|
-
"15",
|
|
72
|
-
"16",
|
|
73
|
-
"17",
|
|
74
|
-
"18",
|
|
75
|
-
"19",
|
|
76
|
-
"20"
|
|
77
|
-
];
|
|
78
|
-
var getInputPadding = function(val, env, steps) {
|
|
79
|
-
if (typeof val === "number") {
|
|
80
|
-
return steps === 1 ? Math.max(0, Math.round(val * .6 - 12)) : Math.max(0, Math.round(val * .52 - 11.5));
|
|
81
|
-
}
|
|
82
|
-
var key = val === true ? "4" : val;
|
|
83
|
-
var index = inputSizeKeys.indexOf(key);
|
|
84
|
-
return env.tokens.space[inputSizeKeys[Math.max(0, index - steps)]];
|
|
85
|
-
};
|
|
86
|
-
var inputSizeVariant = import_core.styled.dynamic(function() {
|
|
87
|
-
var val = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true, env = arguments.length > 1 ? arguments[1] : void 0;
|
|
88
|
-
var frame = resolveInputFrame(val, env);
|
|
89
|
-
var fontStyle = (0, import_get_font_sized.getFontSized)(val, env);
|
|
90
|
-
return {
|
|
91
|
-
color: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.color,
|
|
92
|
-
fontFamily: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontFamily,
|
|
93
|
-
fontSize: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontSize,
|
|
94
|
-
fontStyle: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontStyle,
|
|
95
|
-
fontWeight: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontWeight,
|
|
96
|
-
letterSpacing: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.letterSpacing,
|
|
97
|
-
lineHeight: import_core.isWeb ? fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.lineHeight : void 0,
|
|
98
|
-
textTransform: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.textTransform,
|
|
99
|
-
height: frame.size,
|
|
100
|
-
borderRadius: frame.radius,
|
|
101
|
-
paddingHorizontal: getInputPadding(val, env, 1)
|
|
102
|
-
};
|
|
103
|
-
});
|
|
104
|
-
var textAreaSizeVariant = import_core.styled.dynamic(function() {
|
|
105
|
-
var val = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true, env = arguments.length > 1 ? arguments[1] : void 0;
|
|
106
|
-
var frame = resolveInputFrame(val, env);
|
|
107
|
-
var fontStyle = (0, import_get_font_sized.getFontSized)(val, env);
|
|
108
|
-
return {
|
|
109
|
-
borderRadius: frame.radius,
|
|
110
|
-
color: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.color,
|
|
111
|
-
fontFamily: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontFamily,
|
|
112
|
-
fontSize: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontSize,
|
|
113
|
-
fontStyle: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontStyle,
|
|
114
|
-
fontWeight: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontWeight,
|
|
115
|
-
letterSpacing: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.letterSpacing,
|
|
116
|
-
lineHeight: import_core.isWeb ? fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.lineHeight : void 0,
|
|
117
|
-
textTransform: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.textTransform,
|
|
118
|
-
paddingVertical: getInputPadding(val, env, 2),
|
|
119
|
-
paddingHorizontal: getInputPadding(val, env, 1),
|
|
120
|
-
height: "auto"
|
|
121
|
-
};
|
|
122
|
-
});
|
|
123
38
|
var resolveTextAreaSize = function(props, env) {
|
|
124
|
-
var
|
|
125
|
-
var
|
|
126
|
-
var
|
|
127
|
-
var
|
|
39
|
+
var _font_lineHeight, _font_lineHeight1;
|
|
40
|
+
var font = props.fontFamily ? env.fonts[props.fontFamily] : env.font;
|
|
41
|
+
var defaultKey = font && "sm" in font.size ? "sm" : "4";
|
|
42
|
+
var _props_fontSize;
|
|
43
|
+
var fontSize = (_props_fontSize = props.fontSize) !== null && _props_fontSize !== void 0 ? _props_fontSize : defaultKey;
|
|
44
|
+
var _props_lineHeight;
|
|
45
|
+
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];
|
|
46
|
+
var configuredSize = typeof fontSize === "string" ? font === null || font === void 0 ? void 0 : font.size[fontSize] : void 0;
|
|
47
|
+
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;
|
|
48
|
+
var metrics = { fontSize: Number.parseFloat(String((0, import_core.getVariableValue)(configuredSize !== null && configuredSize !== void 0 ? configuredSize : fontSize))) };
|
|
49
|
+
var leading = configuredLeading !== null && configuredLeading !== void 0 ? configuredLeading : lineHeight;
|
|
50
|
+
(0, import_core.resolveTextMetrics)(metrics, (props.lineHeight == null || configuredLeading !== void 0) && typeof leading === "number" ? `${leading}px` : leading);
|
|
128
51
|
var _props_rows;
|
|
129
52
|
var lines = (_props_rows = props.rows) !== null && _props_rows !== void 0 ? _props_rows : props.numberOfLines;
|
|
130
|
-
var height = typeof lines === "number"
|
|
131
|
-
return {
|
|
132
|
-
borderRadius: sized === null || sized === void 0 ? void 0 : sized.borderRadius,
|
|
133
|
-
color: sized === null || sized === void 0 ? void 0 : sized.color,
|
|
134
|
-
fontFamily: sized === null || sized === void 0 ? void 0 : sized.fontFamily,
|
|
135
|
-
fontSize: sized === null || sized === void 0 ? void 0 : sized.fontSize,
|
|
136
|
-
fontStyle: sized === null || sized === void 0 ? void 0 : sized.fontStyle,
|
|
137
|
-
fontWeight: sized === null || sized === void 0 ? void 0 : sized.fontWeight,
|
|
138
|
-
letterSpacing: sized === null || sized === void 0 ? void 0 : sized.letterSpacing,
|
|
139
|
-
lineHeight: sized === null || sized === void 0 ? void 0 : sized.lineHeight,
|
|
140
|
-
textTransform: sized === null || sized === void 0 ? void 0 : sized.textTransform,
|
|
141
|
-
paddingVertical: sized === null || sized === void 0 ? void 0 : sized.paddingVertical,
|
|
142
|
-
paddingHorizontal: sized === null || sized === void 0 ? void 0 : sized.paddingHorizontal,
|
|
143
|
-
height
|
|
144
|
-
};
|
|
53
|
+
var height = typeof lines === "number" && typeof metrics.lineHeight === "number" ? lines * metrics.lineHeight : void 0;
|
|
54
|
+
return { height };
|
|
145
55
|
};
|
|
146
56
|
var resolveMultilineInputSize = function(props, env) {
|
|
147
57
|
if (!(props.rows > 1 || props.multiline || props.numberOfLines > 1)) return;
|
|
@@ -152,10 +62,7 @@ var styledBody = [{
|
|
|
152
62
|
name: INPUT_NAME,
|
|
153
63
|
render: "input",
|
|
154
64
|
...defaultStyles,
|
|
155
|
-
variants: {
|
|
156
|
-
size: inputSizeVariant,
|
|
157
|
-
disabled: { true: {} }
|
|
158
|
-
}
|
|
65
|
+
variants: { disabled: { true: {} } }
|
|
159
66
|
}, { isInput: true }];
|
|
160
67
|
|
|
161
68
|
//# sourceMappingURL=shared.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.native.js","names":[],"sources":["jsx/shared.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 shared_exports = {};\n__export(shared_exports, {\n INPUT_NAME: () => INPUT_NAME,\n defaultStyles: () => defaultStyles,\n inputSizeVariant: () => inputSizeVariant,\n resolveMultilineInputSize: () => resolveMultilineInputSize,\n resolveTextAreaSize: () => resolveTextAreaSize,\n styledBody: () => styledBody,\n textAreaSizeVariant: () => textAreaSizeVariant\n});\nmodule.exports = __toCommonJS(shared_exports);\nvar import_core = require(\"@tamagui/core\");\nvar import_get_font_sized = require(\"@tamagui/get-font-sized\");\nvar defaultStyles = {\n size: true,\n outlineWidth: 0,\n tabIndex: 0,\n // this fixes a flex bug where it overflows container\n minWidth: 0\n};\nvar resolveInputFrame = function(val, env) {\n return (0, import_core.resolveTokenSize)(val, {\n tokens: env.tokens,\n font: env.font\n }).frame;\n};\nvar inputSizeKeys = [\n \"0\",\n \"0-25\",\n \"0-5\",\n \"0-75\",\n \"1\",\n \"1-5\",\n \"2\",\n \"2-5\",\n \"3\",\n \"3-5\",\n \"4\",\n \"4-5\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"10\",\n \"11\",\n \"12\",\n \"13\",\n \"14\",\n \"15\",\n \"16\",\n \"17\",\n \"18\",\n \"19\",\n \"20\"\n];\nvar getInputPadding = function(val, env, steps) {\n if (typeof val === \"number\") {\n return steps === 1 ? Math.max(0, Math.round(val * 0.6 - 12)) : Math.max(0, Math.round(val * 0.52 - 11.5));\n }\n var key = val === true ? \"4\" : val;\n var index = inputSizeKeys.indexOf(key);\n return env.tokens.space[inputSizeKeys[Math.max(0, index - steps)]];\n};\nvar inputSizeVariant = import_core.styled.dynamic(function() {\n var val = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true, env = arguments.length > 1 ? arguments[1] : void 0;\n var frame = resolveInputFrame(val, env);\n var fontStyle = (0, import_get_font_sized.getFontSized)(val, env);\n return {\n color: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.color,\n fontFamily: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontFamily,\n fontSize: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontSize,\n fontStyle: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontStyle,\n fontWeight: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontWeight,\n letterSpacing: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.letterSpacing,\n lineHeight: import_core.isWeb ? fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.lineHeight : void 0,\n textTransform: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.textTransform,\n height: frame.size,\n borderRadius: frame.radius,\n paddingHorizontal: getInputPadding(val, env, 1)\n };\n});\nvar textAreaSizeVariant = import_core.styled.dynamic(function() {\n var val = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true, env = arguments.length > 1 ? arguments[1] : void 0;\n var frame = resolveInputFrame(val, env);\n var fontStyle = (0, import_get_font_sized.getFontSized)(val, env);\n return {\n borderRadius: frame.radius,\n color: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.color,\n fontFamily: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontFamily,\n fontSize: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontSize,\n fontStyle: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontStyle,\n fontWeight: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontWeight,\n letterSpacing: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.letterSpacing,\n lineHeight: import_core.isWeb ? fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.lineHeight : void 0,\n textTransform: fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.textTransform,\n paddingVertical: getInputPadding(val, env, 2),\n paddingHorizontal: getInputPadding(val, env, 1),\n height: \"auto\"\n };\n});\nvar resolveTextAreaSize = function(props, env) {\n var _props_size;\n var sized = textAreaSizeVariant((_props_size = props.size) !== null && _props_size !== void 0 ? _props_size : true, env);\n var _props_size1;\n var fontStyle = (0, import_get_font_sized.getFontSized)((_props_size1 = props.size) !== null && _props_size1 !== void 0 ? _props_size1 : true, env);\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\" ? lines * (0, import_core.getVariableValue)(fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.lineHeight) : sized === null || sized === void 0 ? void 0 : sized.height;\n return {\n borderRadius: sized === null || sized === void 0 ? void 0 : sized.borderRadius,\n color: sized === null || sized === void 0 ? void 0 : sized.color,\n fontFamily: sized === null || sized === void 0 ? void 0 : sized.fontFamily,\n fontSize: sized === null || sized === void 0 ? void 0 : sized.fontSize,\n fontStyle: sized === null || sized === void 0 ? void 0 : sized.fontStyle,\n fontWeight: sized === null || sized === void 0 ? void 0 : sized.fontWeight,\n letterSpacing: sized === null || sized === void 0 ? void 0 : sized.letterSpacing,\n lineHeight: sized === null || sized === void 0 ? void 0 : sized.lineHeight,\n textTransform: sized === null || sized === void 0 ? void 0 : sized.textTransform,\n paddingVertical: sized === null || sized === void 0 ? void 0 : sized.paddingVertical,\n paddingHorizontal: sized === null || sized === void 0 ? void 0 : sized.paddingHorizontal,\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 size: inputSizeVariant,\n disabled: {\n true: {}\n }\n }\n },\n {\n isInput: true\n }\n];\n//# sourceMappingURL=shared.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,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UAAU,KAAK,IAAI,KAAK,IAAI,MAAM;CACrN,OAAO;EACL,cAAc,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,MAAM;EAClE,OAAO,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,MAAM;EAC3D,YAAY,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,MAAM;EAChE,UAAU,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,MAAM;EAC9D,WAAW,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,MAAM;EAC/D,YAAY,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,MAAM;EAChE,eAAe,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,MAAM;EACnE,YAAY,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,MAAM;EAChE,eAAe,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,MAAM;EACnE,iBAAiB,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,MAAM;EACrE,mBAAmB,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,MAAM;EACvE;CACF;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,MAAM;EACN,UAAU,EACR,MAAM,CAAC,EACT;CACF;AACF,GACA,EACE,SAAS,KACX,CACF"}
|
|
1
|
+
{"version":3,"file":"shared.native.js","names":[],"sources":["jsx/shared.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 shared_exports = {};\n__export(shared_exports, {\n INPUT_NAME: () => INPUT_NAME,\n defaultStyles: () => defaultStyles,\n resolveMultilineInputSize: () => resolveMultilineInputSize,\n resolveTextAreaSize: () => resolveTextAreaSize,\n styledBody: () => styledBody\n});\nmodule.exports = __toCommonJS(shared_exports);\nvar import_core = require(\"@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((0, import_core.getVariableValue)(configuredSize !== null && configuredSize !== void 0 ? configuredSize : fontSize)))\n };\n var leading = configuredLeading !== null && configuredLeading !== void 0 ? configuredLeading : lineHeight;\n (0, import_core.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];\n//# sourceMappingURL=shared.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,UAA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B,KAAK,IAAI,oBAAoB;CAC/F,CAAC,GAAG,YAAY,mBAAkB,CAAE,UAAU,MAAM,cAAc,QAAQ,sBAAsB,KAAK,MAAM,OAAO,YAAY,WAAW,GAAG,QAAQ,MAAM,OAAO;CACjK,IAAI;CACJ,IAAI,SAAS,cAAc,MAAM,UAAU,QAAQ,gBAAgB,KAAK,IAAI,cAAc,MAAM;CAChG,IAAI,SAAS,OAAO,UAAU,YAAY,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/input",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"license": "MIT",
|
|
4
5
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
6
|
"source": "src/index.ts",
|
|
6
7
|
"files": [
|
|
@@ -36,21 +37,22 @@
|
|
|
36
37
|
"test:web": "vitest --typecheck --run"
|
|
37
38
|
},
|
|
38
39
|
"dependencies": {
|
|
39
|
-
"@tamagui/core": "3.0.0
|
|
40
|
-
"@tamagui/element": "3.0.0
|
|
41
|
-
"@tamagui/focusable": "3.0.0
|
|
42
|
-
"@tamagui/font-size": "3.0.0
|
|
43
|
-
"@tamagui/get-font-sized": "3.0.0
|
|
44
|
-
"@tamagui/helpers": "3.0.0
|
|
45
|
-
"@tamagui/helpers-tamagui": "3.0.0
|
|
46
|
-
"@tamagui/
|
|
47
|
-
"@tamagui/
|
|
48
|
-
"@tamagui/
|
|
40
|
+
"@tamagui/core": "3.0.0",
|
|
41
|
+
"@tamagui/element": "3.0.0",
|
|
42
|
+
"@tamagui/focusable": "3.0.0",
|
|
43
|
+
"@tamagui/font-size": "3.0.0",
|
|
44
|
+
"@tamagui/get-font-sized": "3.0.0",
|
|
45
|
+
"@tamagui/helpers": "3.0.0",
|
|
46
|
+
"@tamagui/helpers-tamagui": "3.0.0",
|
|
47
|
+
"@tamagui/react-native-types": "3.0.0",
|
|
48
|
+
"@tamagui/stacks": "3.0.0",
|
|
49
|
+
"@tamagui/text": "3.0.0",
|
|
50
|
+
"@tamagui/web": "3.0.0"
|
|
49
51
|
},
|
|
50
52
|
"devDependencies": {
|
|
51
|
-
"@tamagui/build": "3.0.0
|
|
53
|
+
"@tamagui/build": "3.0.0",
|
|
52
54
|
"react": "19.2.3",
|
|
53
|
-
"react-native": "0.
|
|
55
|
+
"react-native": "0.87.1",
|
|
54
56
|
"vitest": "4.1.0"
|
|
55
57
|
},
|
|
56
58
|
"peerDependencies": {
|
|
@@ -61,5 +63,6 @@
|
|
|
61
63
|
"type": "git",
|
|
62
64
|
"url": "git+https://github.com/tamagui/tamagui.git",
|
|
63
65
|
"directory": "code/ui/input"
|
|
64
|
-
}
|
|
66
|
+
},
|
|
67
|
+
"releaseSourceCommit": "15fbca480b143f876f6975601e23a17d3f90d2ee"
|
|
65
68
|
}
|
package/src/Input.native.tsx
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { TextInput, type TextInputProps as RNTextInputProps } from 'react-native'
|
|
3
|
+
import type { TextInputInstance } from '@tamagui/react-native-types'
|
|
3
4
|
import { createStyledHOC, type GetProps, styled } from '@tamagui/core'
|
|
4
5
|
import { registerFocusable } from '@tamagui/focusable'
|
|
5
6
|
import { useNativeInputRef } from '@tamagui/element'
|
|
6
7
|
import { resolveMultilineInputSize, styledBody } from './shared'
|
|
7
8
|
import type { InputExtraProps } from './types'
|
|
8
9
|
|
|
9
|
-
const
|
|
10
|
+
const NativeTextInput: React.ComponentType<
|
|
11
|
+
RNTextInputProps & React.RefAttributes<TextInputInstance>
|
|
12
|
+
> = TextInput
|
|
13
|
+
|
|
14
|
+
const StyledInput = styled(NativeTextInput, styledBody[0], styledBody[1]).resolve(
|
|
10
15
|
resolveMultilineInputSize
|
|
11
16
|
)
|
|
12
17
|
|
package/src/TextArea.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type GetProps, styled } from '@tamagui/web'
|
|
2
2
|
import { Input } from './Input'
|
|
3
|
-
import { defaultStyles, resolveTextAreaSize
|
|
3
|
+
import { defaultStyles, resolveTextAreaSize } from './shared'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* A web-aligned textarea component (multi-line input).
|
|
@@ -16,10 +16,6 @@ const TextAreaFrame = styled(Input, {
|
|
|
16
16
|
height: 'auto',
|
|
17
17
|
...defaultStyles,
|
|
18
18
|
rows: 3,
|
|
19
|
-
|
|
20
|
-
variants: {
|
|
21
|
-
size: textAreaSizeVariant,
|
|
22
|
-
} as const,
|
|
23
19
|
})
|
|
24
20
|
|
|
25
21
|
export const TextArea = TextAreaFrame.resolve(resolveTextAreaSize)
|
package/src/index.ts
CHANGED
package/src/shared.tsx
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { getVariableValue,
|
|
2
|
-
import { getFontSized } from '@tamagui/get-font-sized'
|
|
1
|
+
import { getVariableValue, resolveTextMetrics } from '@tamagui/core'
|
|
3
2
|
|
|
4
3
|
// Structural-only defaults for the unstyled Input behavior primitive.
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
4
|
+
// Sizing (padding, font, radius) lives in the tamagui skin
|
|
5
|
+
// (code/ui/tamagui/src/components/Input.tsx), which owns a size table per
|
|
6
|
+
// size. Theme decoration (palette, border, background, font family, hover/focus
|
|
7
|
+
// color styling) lives there too, NOT here. Kept: the native outline reset,
|
|
8
|
+
// tab focusability, and the flex-overflow fix.
|
|
9
9
|
export const defaultStyles = {
|
|
10
|
-
size: true,
|
|
11
10
|
outlineWidth: 0,
|
|
12
11
|
tabIndex: 0,
|
|
13
12
|
|
|
@@ -15,122 +14,46 @@ export const defaultStyles = {
|
|
|
15
14
|
minWidth: 0,
|
|
16
15
|
} as const
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const inputSizeKeys = [
|
|
22
|
-
'0',
|
|
23
|
-
'0-25',
|
|
24
|
-
'0-5',
|
|
25
|
-
'0-75',
|
|
26
|
-
'1',
|
|
27
|
-
'1-5',
|
|
28
|
-
'2',
|
|
29
|
-
'2-5',
|
|
30
|
-
'3',
|
|
31
|
-
'3-5',
|
|
32
|
-
'4',
|
|
33
|
-
'4-5',
|
|
34
|
-
'5',
|
|
35
|
-
'6',
|
|
36
|
-
'7',
|
|
37
|
-
'8',
|
|
38
|
-
'9',
|
|
39
|
-
'10',
|
|
40
|
-
'11',
|
|
41
|
-
'12',
|
|
42
|
-
'13',
|
|
43
|
-
'14',
|
|
44
|
-
'15',
|
|
45
|
-
'16',
|
|
46
|
-
'17',
|
|
47
|
-
'18',
|
|
48
|
-
'19',
|
|
49
|
-
'20',
|
|
50
|
-
] as const
|
|
51
|
-
|
|
52
|
-
const getInputPadding = (
|
|
53
|
-
val: any,
|
|
54
|
-
env: Parameters<typeof getFontSized>[1],
|
|
55
|
-
steps: 1 | 2
|
|
56
|
-
) => {
|
|
57
|
-
if (typeof val === 'number') {
|
|
58
|
-
return steps === 1
|
|
59
|
-
? Math.max(0, Math.round(val * 0.6 - 12))
|
|
60
|
-
: Math.max(0, Math.round(val * 0.52 - 11.5))
|
|
61
|
-
}
|
|
62
|
-
const key = val === true ? '4' : val
|
|
63
|
-
const index = inputSizeKeys.indexOf(key)
|
|
64
|
-
return env.tokens.space[inputSizeKeys[Math.max(0, index - steps)]]
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export const inputSizeVariant = styled.dynamic<any>((val = true, env) => {
|
|
68
|
-
const frame = resolveInputFrame(val, env)
|
|
69
|
-
const fontStyle = getFontSized(val as any, env)
|
|
70
|
-
return {
|
|
71
|
-
color: fontStyle?.color,
|
|
72
|
-
fontFamily: fontStyle?.fontFamily,
|
|
73
|
-
fontSize: fontStyle?.fontSize,
|
|
74
|
-
fontStyle: fontStyle?.fontStyle,
|
|
75
|
-
fontWeight: fontStyle?.fontWeight,
|
|
76
|
-
letterSpacing: fontStyle?.letterSpacing,
|
|
77
|
-
lineHeight: isWeb ? fontStyle?.lineHeight : undefined,
|
|
78
|
-
textTransform: fontStyle?.textTransform,
|
|
79
|
-
height: frame.size,
|
|
80
|
-
borderRadius: frame.radius,
|
|
81
|
-
paddingHorizontal: getInputPadding(val, env, 1),
|
|
82
|
-
}
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
export const textAreaSizeVariant = styled.dynamic<any>((val = true, env) => {
|
|
86
|
-
const frame = resolveInputFrame(val, env)
|
|
87
|
-
const fontStyle = getFontSized(val as any, env)
|
|
88
|
-
return {
|
|
89
|
-
borderRadius: frame.radius,
|
|
90
|
-
color: fontStyle?.color,
|
|
91
|
-
fontFamily: fontStyle?.fontFamily,
|
|
92
|
-
fontSize: fontStyle?.fontSize,
|
|
93
|
-
fontStyle: fontStyle?.fontStyle,
|
|
94
|
-
fontWeight: fontStyle?.fontWeight,
|
|
95
|
-
letterSpacing: fontStyle?.letterSpacing,
|
|
96
|
-
lineHeight: isWeb ? fontStyle?.lineHeight : undefined,
|
|
97
|
-
textTransform: fontStyle?.textTransform,
|
|
98
|
-
paddingVertical: getInputPadding(val, env, 2),
|
|
99
|
-
paddingHorizontal: getInputPadding(val, env, 1),
|
|
100
|
-
height: 'auto',
|
|
101
|
-
}
|
|
102
|
-
})
|
|
103
|
-
|
|
17
|
+
// Textarea height from `rows`: lines times the font's line height for the
|
|
18
|
+
// explicit fontSize/lineHeight when given, else the font's default size.
|
|
104
19
|
export const resolveTextAreaSize = (
|
|
105
20
|
props: Record<string, any>,
|
|
106
|
-
env:
|
|
21
|
+
env: {
|
|
22
|
+
font?: { size: Record<string, any>; lineHeight?: Record<string, any> }
|
|
23
|
+
fonts: Record<string, { size: Record<string, any>; lineHeight?: Record<string, any> }>
|
|
24
|
+
}
|
|
107
25
|
) => {
|
|
108
|
-
const
|
|
109
|
-
const
|
|
26
|
+
const font = props.fontFamily ? env.fonts[props.fontFamily] : env.font
|
|
27
|
+
const defaultKey = font && 'sm' in font.size ? 'sm' : '4'
|
|
28
|
+
const fontSize = props.fontSize ?? defaultKey
|
|
29
|
+
const lineHeight = props.lineHeight ?? font?.lineHeight?.[defaultKey]
|
|
30
|
+
const configuredSize = typeof fontSize === 'string' ? font?.size[fontSize] : undefined
|
|
31
|
+
const configuredLeading =
|
|
32
|
+
typeof lineHeight === 'string' ? font?.lineHeight?.[lineHeight] : undefined
|
|
33
|
+
const metrics: Record<string, unknown> = {
|
|
34
|
+
fontSize: Number.parseFloat(String(getVariableValue(configuredSize ?? fontSize))),
|
|
35
|
+
}
|
|
36
|
+
const leading = configuredLeading ?? lineHeight
|
|
37
|
+
resolveTextMetrics(
|
|
38
|
+
metrics,
|
|
39
|
+
(props.lineHeight == null || configuredLeading !== undefined) &&
|
|
40
|
+
typeof leading === 'number'
|
|
41
|
+
? `${leading}px`
|
|
42
|
+
: leading
|
|
43
|
+
)
|
|
110
44
|
const lines = props.rows ?? props.numberOfLines
|
|
111
45
|
const height =
|
|
112
|
-
typeof lines === 'number'
|
|
113
|
-
? lines *
|
|
114
|
-
:
|
|
46
|
+
typeof lines === 'number' && typeof metrics.lineHeight === 'number'
|
|
47
|
+
? lines * metrics.lineHeight
|
|
48
|
+
: undefined
|
|
115
49
|
return {
|
|
116
|
-
borderRadius: sized?.borderRadius,
|
|
117
|
-
color: sized?.color,
|
|
118
|
-
fontFamily: sized?.fontFamily,
|
|
119
|
-
fontSize: sized?.fontSize,
|
|
120
|
-
fontStyle: sized?.fontStyle,
|
|
121
|
-
fontWeight: sized?.fontWeight,
|
|
122
|
-
letterSpacing: sized?.letterSpacing,
|
|
123
|
-
lineHeight: sized?.lineHeight,
|
|
124
|
-
textTransform: sized?.textTransform,
|
|
125
|
-
paddingVertical: sized?.paddingVertical,
|
|
126
|
-
paddingHorizontal: sized?.paddingHorizontal,
|
|
127
50
|
height,
|
|
128
51
|
}
|
|
129
52
|
}
|
|
130
53
|
|
|
131
54
|
export const resolveMultilineInputSize = (
|
|
132
55
|
props: Record<string, any>,
|
|
133
|
-
env: Parameters<typeof
|
|
56
|
+
env: Parameters<typeof resolveTextAreaSize>[1]
|
|
134
57
|
) => {
|
|
135
58
|
if (!(props.rows > 1 || props.multiline || props.numberOfLines > 1)) return
|
|
136
59
|
return resolveTextAreaSize(props, env)
|
|
@@ -143,8 +66,6 @@ export const styledBody = [
|
|
|
143
66
|
render: 'input',
|
|
144
67
|
...defaultStyles,
|
|
145
68
|
variants: {
|
|
146
|
-
size: inputSizeVariant,
|
|
147
|
-
|
|
148
69
|
disabled: {
|
|
149
70
|
true: {},
|
|
150
71
|
},
|
package/src/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ColorTokens, TextStyle, TamaguiElementMethods } from '@tamagui/web'
|
|
2
|
-
import type { TextInput } from 'react-native'
|
|
2
|
+
import type { TextInputInstance as TextInput } from '@tamagui/react-native-types'
|
|
3
3
|
import type { InputNativeProps } from './InputNativeProps'
|
|
4
4
|
|
|
5
5
|
/**
|