@tamagui/input 1.97.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/Input.js +137 -0
  3. package/dist/cjs/Input.js.map +6 -0
  4. package/dist/cjs/Input.native.js +169 -0
  5. package/dist/cjs/Input.native.js.map +6 -0
  6. package/dist/cjs/TextArea.js +42 -0
  7. package/dist/cjs/TextArea.js.map +6 -0
  8. package/dist/cjs/TextArea.native.js +81 -0
  9. package/dist/cjs/TextArea.native.js.map +6 -0
  10. package/dist/cjs/index.js +16 -0
  11. package/dist/cjs/index.js.map +6 -0
  12. package/dist/cjs/index.native.js +22 -0
  13. package/dist/cjs/index.native.js.map +6 -0
  14. package/dist/cjs/shared.js +109 -0
  15. package/dist/cjs/shared.js.map +6 -0
  16. package/dist/cjs/shared.native.js +152 -0
  17. package/dist/cjs/shared.native.js.map +6 -0
  18. package/dist/cjs/types.js +14 -0
  19. package/dist/cjs/types.js.map +6 -0
  20. package/dist/cjs/types.native.js +15 -0
  21. package/dist/cjs/types.native.js.map +6 -0
  22. package/dist/esm/Input.js +117 -0
  23. package/dist/esm/Input.js.map +6 -0
  24. package/dist/esm/Input.mjs +121 -0
  25. package/dist/esm/Input.native.js +145 -0
  26. package/dist/esm/Input.native.js.map +6 -0
  27. package/dist/esm/TextArea.js +28 -0
  28. package/dist/esm/TextArea.js.map +6 -0
  29. package/dist/esm/TextArea.mjs +25 -0
  30. package/dist/esm/TextArea.native.js +62 -0
  31. package/dist/esm/TextArea.native.js.map +6 -0
  32. package/dist/esm/index.js +3 -0
  33. package/dist/esm/index.js.map +6 -0
  34. package/dist/esm/index.mjs +2 -0
  35. package/dist/esm/index.native.js +3 -0
  36. package/dist/esm/index.native.js.map +6 -0
  37. package/dist/esm/shared.js +97 -0
  38. package/dist/esm/shared.js.map +6 -0
  39. package/dist/esm/shared.mjs +100 -0
  40. package/dist/esm/shared.native.js +131 -0
  41. package/dist/esm/shared.native.js.map +6 -0
  42. package/dist/esm/types.js +1 -0
  43. package/dist/esm/types.js.map +6 -0
  44. package/dist/esm/types.mjs +0 -0
  45. package/dist/esm/types.native.js +1 -0
  46. package/dist/esm/types.native.js.map +6 -0
  47. package/dist/jsx/Input.js +117 -0
  48. package/dist/jsx/Input.js.map +6 -0
  49. package/dist/jsx/Input.mjs +121 -0
  50. package/dist/jsx/Input.native.js +145 -0
  51. package/dist/jsx/Input.native.js.map +6 -0
  52. package/dist/jsx/TextArea.js +28 -0
  53. package/dist/jsx/TextArea.js.map +6 -0
  54. package/dist/jsx/TextArea.mjs +25 -0
  55. package/dist/jsx/TextArea.native.js +62 -0
  56. package/dist/jsx/TextArea.native.js.map +6 -0
  57. package/dist/jsx/index.js +3 -0
  58. package/dist/jsx/index.js.map +6 -0
  59. package/dist/jsx/index.mjs +2 -0
  60. package/dist/jsx/index.native.js +3 -0
  61. package/dist/jsx/index.native.js.map +6 -0
  62. package/dist/jsx/shared.js +97 -0
  63. package/dist/jsx/shared.js.map +6 -0
  64. package/dist/jsx/shared.mjs +100 -0
  65. package/dist/jsx/shared.native.js +131 -0
  66. package/dist/jsx/shared.native.js.map +6 -0
  67. package/dist/jsx/types.js +1 -0
  68. package/dist/jsx/types.js.map +6 -0
  69. package/dist/jsx/types.mjs +0 -0
  70. package/dist/jsx/types.native.js +1 -0
  71. package/dist/jsx/types.native.js.map +6 -0
  72. package/package.json +55 -0
  73. package/src/Input.native.tsx +148 -0
  74. package/src/Input.tsx +142 -0
  75. package/src/TextArea.tsx +27 -0
  76. package/src/index.ts +2 -0
  77. package/src/shared.tsx +129 -0
  78. package/src/types.ts +59 -0
  79. package/types/Input.d.ts +293 -0
  80. package/types/Input.d.ts.map +1 -0
  81. package/types/Input.native.d.ts +295 -0
  82. package/types/Input.native.d.ts.map +1 -0
  83. package/types/TextArea.d.ts +277 -0
  84. package/types/TextArea.d.ts.map +1 -0
  85. package/types/index.d.ts +3 -0
  86. package/types/index.d.ts.map +1 -0
  87. package/types/shared.d.ts +307 -0
  88. package/types/shared.d.ts.map +1 -0
  89. package/types/types.d.ts +40 -0
  90. package/types/types.d.ts.map +1 -0
@@ -0,0 +1,25 @@
1
+ import { styled } from "@tamagui/web";
2
+ import { Input } from "./Input.mjs";
3
+ import { defaultStyles, textAreaSizeVariant } from "./shared.mjs";
4
+ const TextArea = styled(Input, {
5
+ name: "TextArea",
6
+ tag: "textarea",
7
+ // this attribute fixes firefox newline issue
8
+ whiteSpace: "pre-wrap",
9
+ variants: {
10
+ unstyled: {
11
+ false: {
12
+ height: "auto",
13
+ ...defaultStyles,
14
+ numberOfLines: 3
15
+ }
16
+ },
17
+ size: {
18
+ "...size": textAreaSizeVariant
19
+ }
20
+ },
21
+ defaultVariants: {
22
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
23
+ }
24
+ });
25
+ export { TextArea };
@@ -0,0 +1,62 @@
1
+ import { styled } from "@tamagui/web";
2
+ import { Input } from "./Input";
3
+ import { defaultStyles, textAreaSizeVariant } from "./shared";
4
+ function _define_property(obj, key, value) {
5
+ return key in obj ? Object.defineProperty(obj, key, {
6
+ value,
7
+ enumerable: !0,
8
+ configurable: !0,
9
+ writable: !0
10
+ }) : obj[key] = value, obj;
11
+ }
12
+ function _object_spread(target) {
13
+ for (var i = 1; i < arguments.length; i++) {
14
+ var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
15
+ typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
16
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
17
+ }))), ownKeys2.forEach(function(key) {
18
+ _define_property(target, key, source[key]);
19
+ });
20
+ }
21
+ return target;
22
+ }
23
+ function ownKeys(object, enumerableOnly) {
24
+ var keys = Object.keys(object);
25
+ if (Object.getOwnPropertySymbols) {
26
+ var symbols = Object.getOwnPropertySymbols(object);
27
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
28
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
29
+ })), keys.push.apply(keys, symbols);
30
+ }
31
+ return keys;
32
+ }
33
+ function _object_spread_props(target, source) {
34
+ return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
35
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
36
+ }), target;
37
+ }
38
+ var TextArea = styled(Input, {
39
+ name: "TextArea",
40
+ tag: "textarea",
41
+ // this attribute fixes firefox newline issue
42
+ whiteSpace: "pre-wrap",
43
+ variants: {
44
+ unstyled: {
45
+ false: _object_spread_props(_object_spread({
46
+ height: "auto"
47
+ }, defaultStyles), {
48
+ numberOfLines: 3
49
+ })
50
+ },
51
+ size: {
52
+ "...size": textAreaSizeVariant
53
+ }
54
+ },
55
+ defaultVariants: {
56
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
57
+ }
58
+ });
59
+ export {
60
+ TextArea
61
+ };
62
+ //# sourceMappingURL=TextArea.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/tamagui/packages/input/src/TextArea.tsx"],
4
+ "mappings": "AAAA,SAASA,cAAc;AACvB,SAASC,aAAa;AACtB,SAASC,eAAeC,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAC5C,IAAMC,WAAWJ,OAAOC,OAAO;EACpCI,MAAM;EACNC,KAAK;;EAELC,YAAY;EAEZC,UAAU;IACRC,UAAU;MACRC,OAAO,qBAAA,eAAA;QACLC,QAAQ;SACLT,aAAAA,GAAAA;QACHU,eAAe;;IAEnB;IAEAC,MAAM;MACJ,WAAWV;IACb;EACF;EAEAW,iBAAiB;IACfL,UAAUM,QAAQC,IAAIC,qBAAqB;EAC7C;AACF,CAAA;",
5
+ "names": ["styled", "Input", "defaultStyles", "textAreaSizeVariant", "TextArea", "name", "tag", "whiteSpace", "variants", "unstyled", "false", "height", "numberOfLines", "size", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS"]
6
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./Input";
2
+ export * from "./TextArea";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "mappings": "AAAA,cAAc;AACd,cAAc;",
5
+ "names": []
6
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./Input.mjs";
2
+ export * from "./TextArea.mjs";
@@ -0,0 +1,3 @@
1
+ export * from "./Input";
2
+ export * from "./TextArea";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/tamagui/packages/input/src/index.ts"],
4
+ "mappings": "AAAA,cAAc;AACd,cAAc;",
5
+ "names": []
6
+ }
@@ -0,0 +1,97 @@
1
+ import { validStyles, stylePropsTextOnly } from "@tamagui/core";
2
+ import { getVariableValue, isWeb } from "@tamagui/core";
3
+ import { getButtonSized } from "@tamagui/get-button-sized";
4
+ import { getFontSized } from "@tamagui/get-font-sized";
5
+ import { getSpace } from "@tamagui/get-token";
6
+ const defaultStyles = {
7
+ size: "$true",
8
+ fontFamily: "$body",
9
+ borderWidth: 1,
10
+ outlineWidth: 0,
11
+ color: "$color",
12
+ ...isWeb ? {
13
+ tabIndex: 0
14
+ } : {
15
+ focusable: !0
16
+ },
17
+ borderColor: "$borderColor",
18
+ backgroundColor: "$background",
19
+ // this fixes a flex bug where it overflows container
20
+ minWidth: 0,
21
+ hoverStyle: {
22
+ borderColor: "$borderColorHover"
23
+ },
24
+ focusStyle: {
25
+ borderColor: "$borderColorFocus"
26
+ },
27
+ focusVisibleStyle: {
28
+ outlineColor: "$outlineColor",
29
+ outlineWidth: 2,
30
+ outlineStyle: "solid"
31
+ }
32
+ }, inputSizeVariant = (val = "$true", extras) => {
33
+ if (extras.props.multiline || extras.props.numberOfLines > 1)
34
+ return textAreaSizeVariant(val, extras);
35
+ const buttonStyles = getButtonSized(val, extras), paddingHorizontal = getSpace(val, {
36
+ shift: -1,
37
+ bounds: [2]
38
+ }), fontStyle = getFontSized(val, extras);
39
+ return !isWeb && fontStyle && delete fontStyle.lineHeight, {
40
+ ...fontStyle,
41
+ ...buttonStyles,
42
+ paddingHorizontal
43
+ };
44
+ }, textAreaSizeVariant = (val = "$true", extras) => {
45
+ const { props } = extras, buttonStyles = getButtonSized(val, extras), fontStyle = getFontSized(val, extras), lines = props.rows ?? props.numberOfLines, height = typeof lines == "number" ? lines * getVariableValue(fontStyle.lineHeight) : "auto", paddingVertical = getSpace(val, {
46
+ shift: -2,
47
+ bounds: [2]
48
+ }), paddingHorizontal = getSpace(val, {
49
+ shift: -1,
50
+ bounds: [2]
51
+ });
52
+ return {
53
+ ...buttonStyles,
54
+ ...fontStyle,
55
+ paddingVertical,
56
+ paddingHorizontal,
57
+ height
58
+ };
59
+ }, INPUT_NAME = "Input", styledBody = [
60
+ {
61
+ name: INPUT_NAME,
62
+ tag: "input",
63
+ variants: {
64
+ unstyled: {
65
+ false: defaultStyles
66
+ },
67
+ size: {
68
+ "...size": inputSizeVariant
69
+ },
70
+ disabled: {
71
+ true: {}
72
+ }
73
+ },
74
+ defaultVariants: {
75
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
76
+ }
77
+ },
78
+ {
79
+ isInput: !0,
80
+ accept: {
81
+ placeholderTextColor: "color",
82
+ selectionColor: "color"
83
+ },
84
+ validStyles: {
85
+ ...validStyles,
86
+ ...stylePropsTextOnly
87
+ }
88
+ }
89
+ ];
90
+ export {
91
+ INPUT_NAME,
92
+ defaultStyles,
93
+ inputSizeVariant,
94
+ styledBody,
95
+ textAreaSizeVariant
96
+ };
97
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/shared.tsx"],
4
+ "mappings": "AACA,SAAS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A,EACZ,CAAC,GACK,oBAAoB,SAAS,KAAK;AAAA,IACtC,OAAO;AAAA,IACP,QAAQ,CAAC,CAAC;AAAA,EACZ,CAAC;AACD,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF,GACa,aAAa,SAEb,aAAa;AAAA,EACxB;AAAA,IACE,MAAM;AAAA,IACN,KAAK;AAAA,IACL,UAAU;AAAA,MACR,UAAU;AAAA,QACR,OAAO;AAAA,MACT;AAAA,MAEA,MAAM;AAAA,QACJ,WAAW;AAAA,MACb;AAAA,MAEA,UAAU;AAAA,QACR,MAAM,CAAC;AAAA,MACT;AAAA,IACF;AAAA,IAEA,iBAAiB;AAAA,MACf,UAAU,QAAQ,IAAI,qBAAqB;AAAA,IAC7C;AAAA,EACF;AAAA,EACA;AAAA,IACE,SAAS;AAAA,IACT,QAAQ;AAAA,MACN,sBAAsB;AAAA,MACtB,gBAAgB;AAAA,IAClB;AAAA,IACA,aAAa;AAAA,MACX,GAAG;AAAA,MACH,GAAG;AAAA,IACL;AAAA,EACF;AACF;",
5
+ "names": []
6
+ }
@@ -0,0 +1,100 @@
1
+ import { validStyles, stylePropsTextOnly } from "@tamagui/core";
2
+ import { getVariableValue, isWeb } from "@tamagui/core";
3
+ import { getButtonSized } from "@tamagui/get-button-sized";
4
+ import { getFontSized } from "@tamagui/get-font-sized";
5
+ import { getSpace } from "@tamagui/get-token";
6
+ const defaultStyles = {
7
+ size: "$true",
8
+ fontFamily: "$body",
9
+ borderWidth: 1,
10
+ outlineWidth: 0,
11
+ color: "$color",
12
+ ...(isWeb ? {
13
+ tabIndex: 0
14
+ } : {
15
+ focusable: !0
16
+ }),
17
+ borderColor: "$borderColor",
18
+ backgroundColor: "$background",
19
+ // this fixes a flex bug where it overflows container
20
+ minWidth: 0,
21
+ hoverStyle: {
22
+ borderColor: "$borderColorHover"
23
+ },
24
+ focusStyle: {
25
+ borderColor: "$borderColorFocus"
26
+ },
27
+ focusVisibleStyle: {
28
+ outlineColor: "$outlineColor",
29
+ outlineWidth: 2,
30
+ outlineStyle: "solid"
31
+ }
32
+ },
33
+ inputSizeVariant = (val = "$true", extras) => {
34
+ if (extras.props.multiline || extras.props.numberOfLines > 1) return textAreaSizeVariant(val, extras);
35
+ const buttonStyles = getButtonSized(val, extras),
36
+ paddingHorizontal = getSpace(val, {
37
+ shift: -1,
38
+ bounds: [2]
39
+ }),
40
+ fontStyle = getFontSized(val, extras);
41
+ return !isWeb && fontStyle && delete fontStyle.lineHeight, {
42
+ ...fontStyle,
43
+ ...buttonStyles,
44
+ paddingHorizontal
45
+ };
46
+ },
47
+ textAreaSizeVariant = (val = "$true", extras) => {
48
+ const {
49
+ props
50
+ } = extras,
51
+ buttonStyles = getButtonSized(val, extras),
52
+ fontStyle = getFontSized(val, extras),
53
+ lines = props.rows ?? props.numberOfLines,
54
+ height = typeof lines == "number" ? lines * getVariableValue(fontStyle.lineHeight) : "auto",
55
+ paddingVertical = getSpace(val, {
56
+ shift: -2,
57
+ bounds: [2]
58
+ }),
59
+ paddingHorizontal = getSpace(val, {
60
+ shift: -1,
61
+ bounds: [2]
62
+ });
63
+ return {
64
+ ...buttonStyles,
65
+ ...fontStyle,
66
+ paddingVertical,
67
+ paddingHorizontal,
68
+ height
69
+ };
70
+ },
71
+ INPUT_NAME = "Input",
72
+ styledBody = [{
73
+ name: INPUT_NAME,
74
+ tag: "input",
75
+ variants: {
76
+ unstyled: {
77
+ false: defaultStyles
78
+ },
79
+ size: {
80
+ "...size": inputSizeVariant
81
+ },
82
+ disabled: {
83
+ true: {}
84
+ }
85
+ },
86
+ defaultVariants: {
87
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
88
+ }
89
+ }, {
90
+ isInput: !0,
91
+ accept: {
92
+ placeholderTextColor: "color",
93
+ selectionColor: "color"
94
+ },
95
+ validStyles: {
96
+ ...validStyles,
97
+ ...stylePropsTextOnly
98
+ }
99
+ }];
100
+ export { INPUT_NAME, defaultStyles, inputSizeVariant, styledBody, textAreaSizeVariant };
@@ -0,0 +1,131 @@
1
+ import { validStyles, stylePropsTextOnly } from "@tamagui/core";
2
+ import { getVariableValue, isWeb } from "@tamagui/core";
3
+ import { getButtonSized } from "@tamagui/get-button-sized";
4
+ import { getFontSized } from "@tamagui/get-font-sized";
5
+ import { getSpace } from "@tamagui/get-token";
6
+ function _define_property(obj, key, value) {
7
+ return key in obj ? Object.defineProperty(obj, key, {
8
+ value,
9
+ enumerable: !0,
10
+ configurable: !0,
11
+ writable: !0
12
+ }) : obj[key] = value, obj;
13
+ }
14
+ function _object_spread(target) {
15
+ for (var i = 1; i < arguments.length; i++) {
16
+ var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
17
+ typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
18
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
19
+ }))), ownKeys2.forEach(function(key) {
20
+ _define_property(target, key, source[key]);
21
+ });
22
+ }
23
+ return target;
24
+ }
25
+ function ownKeys(object, enumerableOnly) {
26
+ var keys = Object.keys(object);
27
+ if (Object.getOwnPropertySymbols) {
28
+ var symbols = Object.getOwnPropertySymbols(object);
29
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
30
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
31
+ })), keys.push.apply(keys, symbols);
32
+ }
33
+ return keys;
34
+ }
35
+ function _object_spread_props(target, source) {
36
+ return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
37
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
38
+ }), target;
39
+ }
40
+ var defaultStyles = _object_spread_props(_object_spread({
41
+ size: "$true",
42
+ fontFamily: "$body",
43
+ borderWidth: 1,
44
+ outlineWidth: 0,
45
+ color: "$color"
46
+ }, isWeb ? {
47
+ tabIndex: 0
48
+ } : {
49
+ focusable: !0
50
+ }), {
51
+ borderColor: "$borderColor",
52
+ backgroundColor: "$background",
53
+ // this fixes a flex bug where it overflows container
54
+ minWidth: 0,
55
+ hoverStyle: {
56
+ borderColor: "$borderColorHover"
57
+ },
58
+ focusStyle: {
59
+ borderColor: "$borderColorFocus"
60
+ },
61
+ focusVisibleStyle: {
62
+ outlineColor: "$outlineColor",
63
+ outlineWidth: 2,
64
+ outlineStyle: "solid"
65
+ }
66
+ }), inputSizeVariant = function() {
67
+ var val = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "$true", extras = arguments.length > 1 ? arguments[1] : void 0;
68
+ if (extras.props.multiline || extras.props.numberOfLines > 1)
69
+ return textAreaSizeVariant(val, extras);
70
+ var buttonStyles = getButtonSized(val, extras), paddingHorizontal = getSpace(val, {
71
+ shift: -1,
72
+ bounds: [
73
+ 2
74
+ ]
75
+ }), fontStyle = getFontSized(val, extras);
76
+ return !isWeb && fontStyle && delete fontStyle.lineHeight, _object_spread_props(_object_spread({}, fontStyle, buttonStyles), {
77
+ paddingHorizontal
78
+ });
79
+ }, textAreaSizeVariant = function() {
80
+ var val = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "$true", extras = arguments.length > 1 ? arguments[1] : void 0, props = extras.props, buttonStyles = getButtonSized(val, extras), fontStyle = getFontSized(val, extras), _props_rows, lines = (_props_rows = props.rows) !== null && _props_rows !== void 0 ? _props_rows : props.numberOfLines, height = typeof lines == "number" ? lines * getVariableValue(fontStyle.lineHeight) : "auto", paddingVertical = getSpace(val, {
81
+ shift: -2,
82
+ bounds: [
83
+ 2
84
+ ]
85
+ }), paddingHorizontal = getSpace(val, {
86
+ shift: -1,
87
+ bounds: [
88
+ 2
89
+ ]
90
+ });
91
+ return _object_spread_props(_object_spread({}, buttonStyles, fontStyle), {
92
+ paddingVertical,
93
+ paddingHorizontal,
94
+ height
95
+ });
96
+ }, INPUT_NAME = "Input", styledBody = [
97
+ {
98
+ name: INPUT_NAME,
99
+ tag: "input",
100
+ variants: {
101
+ unstyled: {
102
+ false: defaultStyles
103
+ },
104
+ size: {
105
+ "...size": inputSizeVariant
106
+ },
107
+ disabled: {
108
+ true: {}
109
+ }
110
+ },
111
+ defaultVariants: {
112
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
113
+ }
114
+ },
115
+ {
116
+ isInput: !0,
117
+ accept: {
118
+ placeholderTextColor: "color",
119
+ selectionColor: "color"
120
+ },
121
+ validStyles: _object_spread({}, validStyles, stylePropsTextOnly)
122
+ }
123
+ ];
124
+ export {
125
+ INPUT_NAME,
126
+ defaultStyles,
127
+ inputSizeVariant,
128
+ styledBody,
129
+ textAreaSizeVariant
130
+ };
131
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/tamagui/packages/input/src/shared.tsx"],
4
+ "mappings": "AACA,SAASA,aAAaC,0BAA0B;AAChD,SAASC,kBAAkBC,aAAa;AACxC,SAASC,sBAAsB;AAC/B,SAASC,oBAAoB;AAC7B,SAASC,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElB,IAAMC,gBAAgB,qBAAA,eAAA;EAC3BC,MAAM;EACNC,YAAY;EACZC,aAAa;EACbC,cAAc;EACdC,OAAO;GAEHT,QACA;EACEU,UAAU;AACZ,IACA;EACEC,WAAW;AACb,CAAA,GAAA;EAEJC,aAAa;EACbC,iBAAiB;;EAGjBC,UAAU;EAEVC,YAAY;IACVH,aAAa;EACf;EAEAI,YAAY;IACVJ,aAAa;EACf;EAEAK,mBAAmB;IACjBC,cAAc;IACdV,cAAc;IACdW,cAAc;EAChB;IAGWC,mBAAmD,WAAA;MAC9DC,MAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAAM,SACNC,SAAAA,UAAAA,SAAAA,IAAAA,UAAAA,CAAAA,IAA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AIC,qBAAqB;IAC7C;EACF;EACA;IACEC,SAAS;IACTC,QAAQ;MACNC,sBAAsB;MACtBC,gBAAgB;IAClB;IACAxD,aAAa,eAAA,CAAA,GACRA,aACAC,kBAAAA;EAEP;;",
5
+ "names": ["validStyles", "stylePropsTextOnly", "getVariableValue", "isWeb", "getButtonSized", "getFontSized", "getSpace", "defaultStyles", "size", "fontFamily", "borderWidth", "outlineWidth", "color", "tabIndex", "focusable", "borderColor", "backgroundColor", "minWidth", "hoverStyle", "focusStyle", "focusVisibleStyle", "outlineColor", "outlineStyle", "inputSizeVariant", "val", "extras", "props", "multiline", "numberOfLines", "textAreaSizeVariant", "buttonStyles", "paddingHorizontal", "shift", "bounds", "fontStyle", "lines", "rows", "height", "lineHeight", "paddingVertical", "INPUT_NAME", "styledBody", "name", "tag", "variants", "unstyled", "false", "disabled", "true", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS", "isInput", "accept", "placeholderTextColor", "selectionColor"]
6
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "mappings": "",
5
+ "names": []
6
+ }
File without changes
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "mappings": "",
5
+ "names": []
6
+ }
@@ -0,0 +1,117 @@
1
+ import { View, styled, useComposedRefs, useEvent, useTheme } from "@tamagui/core";
2
+ import { registerFocusable } from "@tamagui/focusable";
3
+ import React, { useEffect } from "react";
4
+ import { styledBody } from "./shared";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ const StyledInput = styled(View, styledBody[0], styledBody[1]), Input = StyledInput.styleable((inProps, forwardedRef) => {
7
+ const {
8
+ // some of destructed props are just to avoid passing them to ...rest because they are not in web.
9
+ allowFontScaling,
10
+ selectTextOnFocus,
11
+ showSoftInputOnFocus,
12
+ textContentType,
13
+ passwordRules,
14
+ textBreakStrategy,
15
+ underlineColorAndroid,
16
+ selection,
17
+ lineBreakStrategyIOS,
18
+ returnKeyLabel,
19
+ disabled,
20
+ onSubmitEditing,
21
+ caretHidden,
22
+ clearButtonMode,
23
+ clearTextOnFocus,
24
+ contextMenuHidden,
25
+ dataDetectorTypes,
26
+ id,
27
+ enablesReturnKeyAutomatically,
28
+ importantForAutofill,
29
+ inlineImageLeft,
30
+ inlineImagePadding,
31
+ inputAccessoryViewID,
32
+ keyboardAppearance,
33
+ keyboardType,
34
+ cursorColor,
35
+ disableFullscreenUI,
36
+ editable,
37
+ maxFontSizeMultiplier,
38
+ multiline,
39
+ numberOfLines,
40
+ onChangeText,
41
+ onContentSizeChange,
42
+ onEndEditing,
43
+ onScroll,
44
+ onSelectionChange,
45
+ caretColor,
46
+ placeholderTextColor,
47
+ blurOnSubmit,
48
+ enterKeyHint,
49
+ returnKeyType,
50
+ rejectResponderTermination,
51
+ scrollEnabled,
52
+ secureTextEntry,
53
+ selectionColor,
54
+ inputMode,
55
+ ...rest
56
+ } = inProps, ref = React.useRef(null), theme = useTheme(), composedRefs = useComposedRefs(forwardedRef, ref), _onSelectionChange = useEvent(() => {
57
+ const start = ref.current?.selectionStart ?? 0, end = ref.current?.selectionEnd ?? 0;
58
+ onSelectionChange?.({
59
+ nativeEvent: {
60
+ selection: {
61
+ end,
62
+ start
63
+ }
64
+ }
65
+ });
66
+ });
67
+ useEffect(() => {
68
+ if (onSelectionChange)
69
+ return ref.current?.addEventListener("selectionchange", _onSelectionChange), () => {
70
+ ref.current?.removeEventListener("selectionchange", _onSelectionChange);
71
+ };
72
+ }, []), useEffect(() => {
73
+ selection && ref.current?.setSelectionRange(selection.start || null, selection.end || null);
74
+ }, [selection?.start, selection?.end]);
75
+ const finalProps = {
76
+ ...rest,
77
+ inputMode,
78
+ disabled,
79
+ caretColor,
80
+ id,
81
+ enterKeyHint,
82
+ style: {
83
+ ...rest.style,
84
+ ...placeholderTextColor && {
85
+ "--placeholderColor": theme[placeholderTextColor]?.variable || placeholderTextColor
86
+ },
87
+ ...selectionColor && {
88
+ "--selectionColor": theme[selectionColor]?.variable || selectionColor
89
+ }
90
+ }
91
+ };
92
+ return useEffect(() => {
93
+ if (id && !disabled)
94
+ return registerFocusable(id, {
95
+ focusAndSelect: () => {
96
+ ref.current?.focus();
97
+ },
98
+ focus: () => {
99
+ }
100
+ });
101
+ }, [id, disabled]), /* @__PURE__ */ jsxs(Fragment, { children: [
102
+ /* @__PURE__ */ jsx("style", { children: `
103
+ input::selection, textarea::selection {
104
+ background-color: var(--selectionBackground) !important;
105
+ }
106
+
107
+ input::placeholder, textarea::placeholder {
108
+ color: var(--placeholderColor) !important;
109
+ }
110
+ ` }),
111
+ /* @__PURE__ */ jsx(StyledInput, { ref: composedRefs, ...finalProps })
112
+ ] });
113
+ });
114
+ export {
115
+ Input
116
+ };
117
+ //# sourceMappingURL=Input.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Input.tsx"],
4
+ "mappings": "AAAA,SAAS,MAAM,QAAQ,iBAAiB,UAAU,gBAAgB;AAClE,SAAS,yBAAyB;AAClC,OAAO,SAAS,iBAAiB;AACjC,SAAS,kBAAkB;AAyHvB,mBAEI,KAFJ;AAvHJ,MAAM,cAAc,OAAO,MAAM,WAAW,CAAC,GAAG,WAAW,CAAC,CAAC,GAEhD,QAAQ,YAAY,UAAsB,CAAC,SAAS,iBAAiB;AAChF,QAAM;AAAA;AAAA,IAEJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAA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