@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,152 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
16
+ var shared_exports = {};
17
+ __export(shared_exports, {
18
+ INPUT_NAME: () => INPUT_NAME,
19
+ defaultStyles: () => defaultStyles,
20
+ inputSizeVariant: () => inputSizeVariant,
21
+ styledBody: () => styledBody,
22
+ textAreaSizeVariant: () => textAreaSizeVariant
23
+ });
24
+ module.exports = __toCommonJS(shared_exports);
25
+ var import_core = require("@tamagui/core"), import_core2 = require("@tamagui/core"), import_get_button_sized = require("@tamagui/get-button-sized"), import_get_font_sized = require("@tamagui/get-font-sized"), import_get_token = require("@tamagui/get-token");
26
+ function _define_property(obj, key, value) {
27
+ return key in obj ? Object.defineProperty(obj, key, {
28
+ value,
29
+ enumerable: !0,
30
+ configurable: !0,
31
+ writable: !0
32
+ }) : obj[key] = value, obj;
33
+ }
34
+ function _object_spread(target) {
35
+ for (var i = 1; i < arguments.length; i++) {
36
+ var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
37
+ typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
38
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
39
+ }))), ownKeys2.forEach(function(key) {
40
+ _define_property(target, key, source[key]);
41
+ });
42
+ }
43
+ return target;
44
+ }
45
+ function ownKeys(object, enumerableOnly) {
46
+ var keys = Object.keys(object);
47
+ if (Object.getOwnPropertySymbols) {
48
+ var symbols = Object.getOwnPropertySymbols(object);
49
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
50
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
51
+ })), keys.push.apply(keys, symbols);
52
+ }
53
+ return keys;
54
+ }
55
+ function _object_spread_props(target, source) {
56
+ return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
57
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
58
+ }), target;
59
+ }
60
+ var defaultStyles = _object_spread_props(_object_spread({
61
+ size: "$true",
62
+ fontFamily: "$body",
63
+ borderWidth: 1,
64
+ outlineWidth: 0,
65
+ color: "$color"
66
+ }, import_core2.isWeb ? {
67
+ tabIndex: 0
68
+ } : {
69
+ focusable: !0
70
+ }), {
71
+ borderColor: "$borderColor",
72
+ backgroundColor: "$background",
73
+ // this fixes a flex bug where it overflows container
74
+ minWidth: 0,
75
+ hoverStyle: {
76
+ borderColor: "$borderColorHover"
77
+ },
78
+ focusStyle: {
79
+ borderColor: "$borderColorFocus"
80
+ },
81
+ focusVisibleStyle: {
82
+ outlineColor: "$outlineColor",
83
+ outlineWidth: 2,
84
+ outlineStyle: "solid"
85
+ }
86
+ }), inputSizeVariant = function() {
87
+ var val = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "$true", extras = arguments.length > 1 ? arguments[1] : void 0;
88
+ if (extras.props.multiline || extras.props.numberOfLines > 1)
89
+ return textAreaSizeVariant(val, extras);
90
+ var buttonStyles = (0, import_get_button_sized.getButtonSized)(val, extras), paddingHorizontal = (0, import_get_token.getSpace)(val, {
91
+ shift: -1,
92
+ bounds: [
93
+ 2
94
+ ]
95
+ }), fontStyle = (0, import_get_font_sized.getFontSized)(val, extras);
96
+ return !import_core2.isWeb && fontStyle && delete fontStyle.lineHeight, _object_spread_props(_object_spread({}, fontStyle, buttonStyles), {
97
+ paddingHorizontal
98
+ });
99
+ }, textAreaSizeVariant = function() {
100
+ var val = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "$true", extras = arguments.length > 1 ? arguments[1] : void 0, props = extras.props, buttonStyles = (0, import_get_button_sized.getButtonSized)(val, extras), fontStyle = (0, import_get_font_sized.getFontSized)(val, extras), _props_rows, lines = (_props_rows = props.rows) !== null && _props_rows !== void 0 ? _props_rows : props.numberOfLines, height = typeof lines == "number" ? lines * (0, import_core2.getVariableValue)(fontStyle.lineHeight) : "auto", paddingVertical = (0, import_get_token.getSpace)(val, {
101
+ shift: -2,
102
+ bounds: [
103
+ 2
104
+ ]
105
+ }), paddingHorizontal = (0, import_get_token.getSpace)(val, {
106
+ shift: -1,
107
+ bounds: [
108
+ 2
109
+ ]
110
+ });
111
+ return _object_spread_props(_object_spread({}, buttonStyles, fontStyle), {
112
+ paddingVertical,
113
+ paddingHorizontal,
114
+ height
115
+ });
116
+ }, INPUT_NAME = "Input", styledBody = [
117
+ {
118
+ name: INPUT_NAME,
119
+ tag: "input",
120
+ variants: {
121
+ unstyled: {
122
+ false: defaultStyles
123
+ },
124
+ size: {
125
+ "...size": inputSizeVariant
126
+ },
127
+ disabled: {
128
+ true: {}
129
+ }
130
+ },
131
+ defaultVariants: {
132
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
133
+ }
134
+ },
135
+ {
136
+ isInput: !0,
137
+ accept: {
138
+ placeholderTextColor: "color",
139
+ selectionColor: "color"
140
+ },
141
+ validStyles: _object_spread({}, import_core.validStyles, import_core.stylePropsTextOnly)
142
+ }
143
+ ];
144
+ // Annotate the CommonJS export names for ESM import in node:
145
+ 0 && (module.exports = {
146
+ INPUT_NAME,
147
+ defaultStyles,
148
+ inputSizeVariant,
149
+ styledBody,
150
+ textAreaSizeVariant
151
+ });
152
+ //# 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,kBAAgD,0BAChDA,eAAwC,0BACxC,0BAA+B,sCAC/B,wBAA6B,oCAC7B,mBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElB,IAAMC,gBAAgB,qBAAA,eAAA;EAC3BC,MAAM;EACNC,YAAY;EACZC,aAAa;EACbC,cAAc;EACdC,OAAO;GAEHC,qBACA;EACEC,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;IACdX,cAAc;IACdY,cAAc;EAChB;IAGWC,mBAAmD,WAAA;MAC9DC,MAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAAM,SACNC,SAAAA,UAAAA,SAAAA,IAAAA,UAAAA,CAAAA,IAAAA;AAEA,MAAIA,OAAOC,MAAMC,aAAaF,OAAOC,MAAME,gBAAgB;AACzD,WAAOC,oBAAoBL,KAAKC,MAAAA;AAElC,MAAMK,mBAAeC,wCAAeP,KAAKC,MAAAA,GACnCO,wBAAoBC,2BAAST,KAAK;IACtCU,OAAO;IACPC,QAAQ;MAAC;;EACX,CAAA,GACMC,gBAAYC,oCAAab,KAAYC,MAAAA;AAE3C,SAAI,CAACb,sBAASwB,aACZ,OAAOA,UAAU,YAEZ,qBAAA,eAAA,CAAA,GACFA,WACAN,YAAAA,GAAAA;IACHE;;AAEJ,GAEaH,sBAAsD,WAAA;MACjEL,MAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAAM,SACNC,SAAAA,UAAAA,SAAAA,IAAAA,UAAAA,CAAAA,IAAAA,QAEQC,QAAUD,OAAVC,OACFI,mBAAeC,wCAAeP,KAAKC,MAAAA,GACnCW,gBAAYC,oCAAab,KAAYC,MAAAA,GAC7BC,aAARY,SAAQZ,cAAAA,MAAMa,UAAI,QAAVb,gBAAAA,SAAAA,cAAcA,MAAME,eAC5BY,SACJ,OAAOF,SAAU,WAAWA,YAAQG,+BAAiBL,UAAUM,UAAU,IAAI,QACzEC,sBAAkBV,2BAAST,KAAK;IACpCU,OAAO;IACPC,QAAQ;MAAC;;EACX,CAAA,GACMH,wBAAoBC,2BAAST,KAAK;IACtCU,OAAO;IACPC,QAAQ;MAAC;;EACX,CAAA;AACA,SAAO,qBAAA,eAAA,CAAA,GACFL,cACAM,SAAAA,GAAAA;IACHO;IACAX;IACAQ;;AAEJ,GACaI,aAAa,SAEbC,aAAa;EACxB;IACEC,MAAMF;IACNG,KAAK;IACLC,UAAU;MACRC,UAAU;QACRC,OAAO5C;MACT;MAEAC,MAAM;QACJ,WAAWgB;MACb;MAEA4B,UAAU;QACRC,MAAM,CAAC;MACT;IACF;IAEAC,iBAAiB;MACfJ,UAAUK,QAAQC,IAAIC,qBAAqB;IAC7C;EACF;EACA;IACEC,SAAS;IACTC,QAAQ;MACNC,sBAAsB;MACtBC,gBAAgB;IAClB;IACAC,aAAa,eAAA,CAAA,GACRA,yBACAC,8BAAAA;EAEP;;",
5
+ "names": ["import_core", "defaultStyles", "size", "fontFamily", "borderWidth", "outlineWidth", "color", "isWeb", "tabIndex", "focusable", "borderColor", "backgroundColor", "minWidth", "hoverStyle", "focusStyle", "focusVisibleStyle", "outlineColor", "outlineStyle", "inputSizeVariant", "val", "extras", "props", "multiline", "numberOfLines", "textAreaSizeVariant", "buttonStyles", "getButtonSized", "paddingHorizontal", "getSpace", "shift", "bounds", "fontStyle", "getFontSized", "lines", "rows", "height", "getVariableValue", "lineHeight", "paddingVertical", "INPUT_NAME", "styledBody", "name", "tag", "variants", "unstyled", "false", "disabled", "true", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS", "isInput", "accept", "placeholderTextColor", "selectionColor", "validStyles", "stylePropsTextOnly"]
6
+ }
@@ -0,0 +1,14 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function")
7
+ for (let key of __getOwnPropNames(from))
8
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
+ return to;
10
+ };
11
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
12
+ var types_exports = {};
13
+ module.exports = __toCommonJS(types_exports);
14
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/types.ts"],
4
+ "mappings": ";;;;;;;;;;;AAAA;AAAA;",
5
+ "names": []
6
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from == "object" || typeof from == "function")
8
+ for (let key of __getOwnPropNames(from))
9
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ return to;
11
+ };
12
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
13
+ var types_exports = {};
14
+ module.exports = __toCommonJS(types_exports);
15
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/tamagui/packages/input/src/types.ts"],
4
+ "mappings": ";;;;;;;;;;;;AAQA;;",
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 @@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B,mBAAmB,kBAAkB,GAC5D,MAAM;AACX,YAAI,SAAS,oBAAoB,mBAAmB,kBAAkB;AAAA,MACxE;AAAA,EAEJ,GAAG,CAAC,CAAC,GAEL,UAAU,MAAM;AACd,IAAI,aACF,IAAI,SAAS,kBAAkB,UAAU,SAAS,MAAM,UAAU,OAAO,IAAI;AAAA,EAEjF,GAAG,CAAC,WAAW,OAAO,WAAW,GAAG,CAAC;AAErC,QAAM,aAAa;AAAA,IACjB,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,MACL,GAAI,KAAK;AAAA,MACT,GAAI,wBAAwB;AAAA,QAC1B,sBACE,MAAM,oBAAoB,GAAG,YAAY;AAAA,MAC7C;AAAA,MACA,GAAI,kBAAkB;AAAA,QACpB,oBAAoB,MAAM,cAAc,GAAG,YAAY;AAAA,MACzD;AAAA,IACF;AAAA,EACF;AAEA,mBAAU,MAAM;AACd,QAAK,MACD;AAEJ,aAAO,kBAAkB,IAAI;AAAA,QAC3B,gBAAgB,MAAM;AACpB,cAAI,SAAS,MAAM;AAAA,QACrB;AAAA,QACA,OAAO,MAAM;AAAA,QAAC;AAAA,MAChB,CAAC;AAAA,EACH,GAAG,CAAC,IAAI,QAAQ,CAAC,GAGf,iCAEI;AAAA,wBAAC,WACE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SASH;AAAA,IAEF,oBAAC,eAAY,KAAK,cAAe,GAAG,YAAY;AAAA,KAClD;AAEJ,CAAC;",
5
+ "names": []
6
+ }
@@ -0,0 +1,121 @@
1
+ import { View, styled, useComposedRefs, useEvent, useTheme } from "@tamagui/core";
2
+ import { registerFocusable } from "@tamagui/focusable";
3
+ import React, { useEffect } from "react";
4
+ import { styledBody } from "./shared.mjs";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ const StyledInput = styled(View, styledBody[0], styledBody[1]),
7
+ Input = StyledInput.styleable((inProps, forwardedRef) => {
8
+ const {
9
+ // some of destructed props are just to avoid passing them to ...rest because they are not in web.
10
+ allowFontScaling,
11
+ selectTextOnFocus,
12
+ showSoftInputOnFocus,
13
+ textContentType,
14
+ passwordRules,
15
+ textBreakStrategy,
16
+ underlineColorAndroid,
17
+ selection,
18
+ lineBreakStrategyIOS,
19
+ returnKeyLabel,
20
+ disabled,
21
+ onSubmitEditing,
22
+ caretHidden,
23
+ clearButtonMode,
24
+ clearTextOnFocus,
25
+ contextMenuHidden,
26
+ dataDetectorTypes,
27
+ id,
28
+ enablesReturnKeyAutomatically,
29
+ importantForAutofill,
30
+ inlineImageLeft,
31
+ inlineImagePadding,
32
+ inputAccessoryViewID,
33
+ keyboardAppearance,
34
+ keyboardType,
35
+ cursorColor,
36
+ disableFullscreenUI,
37
+ editable,
38
+ maxFontSizeMultiplier,
39
+ multiline,
40
+ numberOfLines,
41
+ onChangeText,
42
+ onContentSizeChange,
43
+ onEndEditing,
44
+ onScroll,
45
+ onSelectionChange,
46
+ caretColor,
47
+ placeholderTextColor,
48
+ blurOnSubmit,
49
+ enterKeyHint,
50
+ returnKeyType,
51
+ rejectResponderTermination,
52
+ scrollEnabled,
53
+ secureTextEntry,
54
+ selectionColor,
55
+ inputMode,
56
+ ...rest
57
+ } = inProps,
58
+ ref = React.useRef(null),
59
+ theme = useTheme(),
60
+ composedRefs = useComposedRefs(forwardedRef, ref),
61
+ _onSelectionChange = useEvent(() => {
62
+ const start = ref.current?.selectionStart ?? 0,
63
+ end = ref.current?.selectionEnd ?? 0;
64
+ onSelectionChange?.({
65
+ nativeEvent: {
66
+ selection: {
67
+ end,
68
+ start
69
+ }
70
+ }
71
+ });
72
+ });
73
+ useEffect(() => {
74
+ if (onSelectionChange) return ref.current?.addEventListener("selectionchange", _onSelectionChange), () => {
75
+ ref.current?.removeEventListener("selectionchange", _onSelectionChange);
76
+ };
77
+ }, []), useEffect(() => {
78
+ selection && ref.current?.setSelectionRange(selection.start || null, selection.end || null);
79
+ }, [selection?.start, selection?.end]);
80
+ const finalProps = {
81
+ ...rest,
82
+ inputMode,
83
+ disabled,
84
+ caretColor,
85
+ id,
86
+ enterKeyHint,
87
+ style: {
88
+ ...rest.style,
89
+ ...(placeholderTextColor && {
90
+ "--placeholderColor": theme[placeholderTextColor]?.variable || placeholderTextColor
91
+ }),
92
+ ...(selectionColor && {
93
+ "--selectionColor": theme[selectionColor]?.variable || selectionColor
94
+ })
95
+ }
96
+ };
97
+ return useEffect(() => {
98
+ if (id && !disabled) return registerFocusable(id, {
99
+ focusAndSelect: () => {
100
+ ref.current?.focus();
101
+ },
102
+ focus: () => {}
103
+ });
104
+ }, [id, disabled]), /* @__PURE__ */jsxs(Fragment, {
105
+ children: [/* @__PURE__ */jsx("style", {
106
+ children: `
107
+ input::selection, textarea::selection {
108
+ background-color: var(--selectionBackground) !important;
109
+ }
110
+
111
+ input::placeholder, textarea::placeholder {
112
+ color: var(--placeholderColor) !important;
113
+ }
114
+ `
115
+ }), /* @__PURE__ */jsx(StyledInput, {
116
+ ref: composedRefs,
117
+ ...finalProps
118
+ })]
119
+ });
120
+ });
121
+ export { Input };
@@ -0,0 +1,145 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { styled, useComposedRefs } from "@tamagui/core";
3
+ import { registerFocusable } from "@tamagui/focusable";
4
+ import React, { useEffect } from "react";
5
+ import { TextInput } from "react-native";
6
+ import { styledBody } from "./shared";
7
+ function _define_property(obj, key, value) {
8
+ return key in obj ? Object.defineProperty(obj, key, {
9
+ value,
10
+ enumerable: !0,
11
+ configurable: !0,
12
+ writable: !0
13
+ }) : obj[key] = value, obj;
14
+ }
15
+ function _object_spread(target) {
16
+ for (var i = 1; i < arguments.length; i++) {
17
+ var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
18
+ typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
19
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
20
+ }))), ownKeys2.forEach(function(key) {
21
+ _define_property(target, key, source[key]);
22
+ });
23
+ }
24
+ return target;
25
+ }
26
+ function ownKeys(object, enumerableOnly) {
27
+ var keys = Object.keys(object);
28
+ if (Object.getOwnPropertySymbols) {
29
+ var symbols = Object.getOwnPropertySymbols(object);
30
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
31
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
32
+ })), keys.push.apply(keys, symbols);
33
+ }
34
+ return keys;
35
+ }
36
+ function _object_spread_props(target, source) {
37
+ return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
38
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
39
+ }), target;
40
+ }
41
+ function _object_without_properties(source, excluded) {
42
+ if (source == null)
43
+ return {};
44
+ var target = _object_without_properties_loose(source, excluded), key, i;
45
+ if (Object.getOwnPropertySymbols) {
46
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
47
+ for (i = 0; i < sourceSymbolKeys.length; i++)
48
+ key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
49
+ }
50
+ return target;
51
+ }
52
+ function _object_without_properties_loose(source, excluded) {
53
+ if (source == null)
54
+ return {};
55
+ var target = {}, sourceKeys = Object.keys(source), key, i;
56
+ for (i = 0; i < sourceKeys.length; i++)
57
+ key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
58
+ return target;
59
+ }
60
+ var StyledInput = styled(TextInput, styledBody[0], styledBody[1]), Input = StyledInput.styleable(function(inProps, forwardedRef) {
61
+ var type = inProps.type, dirname = inProps.dirname, max = inProps.max, min = inProps.min, minLength = inProps.minLength, multiple = inProps.multiple, name = inProps.name, required = inProps.required, step = inProps.step, disabled = inProps.disabled, id = inProps.id, caretColor = inProps.caretColor, onChange = inProps.onChange, onInput = inProps.onInput, rows = inProps.rows, enterKeyHint = inProps.enterKeyHint, returnKeyType = inProps.returnKeyType, onKeyDown = inProps.onKeyDown, inputMode = inProps.inputMode, tag = inProps.tag, rest = _object_without_properties(inProps, [
62
+ "type",
63
+ "dirname",
64
+ "max",
65
+ "min",
66
+ "minLength",
67
+ "multiple",
68
+ "name",
69
+ "required",
70
+ "step",
71
+ "disabled",
72
+ "id",
73
+ "caretColor",
74
+ "onChange",
75
+ "onInput",
76
+ "rows",
77
+ "enterKeyHint",
78
+ "returnKeyType",
79
+ "onKeyDown",
80
+ "inputMode",
81
+ "tag"
82
+ ]), ref = React.useRef(null), composedRefs = useComposedRefs(forwardedRef, ref), secureTextEntry = !1, cursorColor = caretColor, _returnKeyType = returnKeyType, _enterKeyHint = enterKeyHint;
83
+ enterKeyHint === "go" && (_returnKeyType = "go", _enterKeyHint = void 0);
84
+ var _inputMode = inputMode;
85
+ type === "email" ? _inputMode = "email" : type === "tel" ? _inputMode = "tel" : type === "search" ? _inputMode = "search" : type === "url" ? _inputMode = "url" : type === "password" ? (secureTextEntry = !0, _inputMode = "text") : type === "number" ? _inputMode = "numeric" : _inputMode = "text";
86
+ var showSoftInputOnFocus = !0;
87
+ inputMode === "none" && (showSoftInputOnFocus = !1);
88
+ var finalProps = _object_spread_props(_object_spread({}, rest), {
89
+ inputMode: _inputMode,
90
+ showSoftInputOnFocus,
91
+ disabled,
92
+ id,
93
+ cursorColor,
94
+ enterKeyHint: _enterKeyHint,
95
+ returnKeyType: _returnKeyType,
96
+ secureTextEntry,
97
+ numberOfLines: rows || rest.numberOfLines
98
+ });
99
+ return tag === "textarea" && (finalProps.multiline = !0), onKeyDown && (finalProps.onKeyPress = function(e) {
100
+ var key = e.nativeEvent.key;
101
+ (key === "Backspace" || tag === "textarea" && key === "Enter" || key.length === 1) && onKeyDown({
102
+ key,
103
+ type: "keydown"
104
+ });
105
+ }, finalProps.onSubmitEditing = function(e) {
106
+ onKeyDown({
107
+ key: "Enter",
108
+ type: "keydown"
109
+ });
110
+ }), (onChange || onInput) && (finalProps.onChange = function(e) {
111
+ var text = e.nativeEvent.text;
112
+ onChange && onChange({
113
+ target: {
114
+ value: text
115
+ },
116
+ type: "change"
117
+ }), onInput != null && onInput({
118
+ target: {
119
+ value: text
120
+ },
121
+ type: "input"
122
+ });
123
+ }), useEffect(function() {
124
+ if (id && !disabled)
125
+ return registerFocusable(id, {
126
+ focusAndSelect: function() {
127
+ var _ref_current;
128
+ (_ref_current = ref.current) === null || _ref_current === void 0 || _ref_current.focus();
129
+ },
130
+ focus: function() {
131
+ }
132
+ });
133
+ }, [
134
+ id,
135
+ disabled
136
+ ]), /* @__PURE__ */ _jsx(StyledInput, _object_spread({
137
+ onChange: function(e) {
138
+ },
139
+ ref: composedRefs
140
+ }, finalProps));
141
+ });
142
+ export {
143
+ Input
144
+ };
145
+ //# sourceMappingURL=Input.native.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/tamagui/packages/input/src/Input.native.tsx"],
4
+ "mappings": ";AAAA,SAASA,QAAQC,uBAAuB;AACxC,SAASC,yBAAyB;AAClC,OAAOC,SAASC,iBAAiB;AAEjC,SAASC,iBAAiB;AAC1B,SAASC,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE3B,IAAMC,cAAcP,OAAOK,WAAWC,WAAW,CAAA,GAAIA,WAAW,CAAA,CAAE,GAErDE,QAAQD,YAAYE,UAAsB,SAACC,SAASC,cAAAA;AAC/D,MAEEC,OAsBEF,QAtBFE,MAEAC,UAoBEH,QApBFG,SACAC,MAmBEJ,QAnBFI,KACAC,MAkBEL,QAlBFK,KACAC,YAiBEN,QAjBFM,WACAC,WAgBEP,QAhBFO,UACAC,OAeER,QAfFQ,MACAC,WAcET,QAdFS,UACAC,OAaEV,QAbFU,MACAC,WAYEX,QAZFW,UACAC,KAWEZ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,GACA+B,WAAWQ,kBAAkB,SAACJ,GAAAA;AAC5BlB,cAAU;MACRmB,KAAK;MACLpC,MAAM;IACR,CAAA;EACF,KAGEY,YAAYC,aACdkB,WAAWnB,WAAW,SAACuB,GAAAA;AACrB,QAAQK,OAASL,EAAEE,YAAXG;AACR,IAAI5B,YACFA,SAAS;MACP6B,QAAQ;QACNC,OAAOF;MACT;MACAxC,MAAM;IACR,CAAA,GAEEa,WAAW,QACbA,QAAQ;MACN4B,QAAQ;QACNC,OAAOF;MACT;MACAxC,MAAM;IACR,CAAA;EAEJ,IAGFR,UAAU,WAAA;AACR,QAAKkB,MACDD;AAEJ,aAAOnB,kBAAkBoB,IAAI;QAC3BiC,gBAAgB,WAAA;cACdtB;WAAAA,eAAAA,IAAIuB,aAAO,QAAXvB,iBAAAA,UAAAA,aAAawB,MAAK;QACpB;QACAA,OAAO,WAAA;QAAO;MAChB,CAAA;EACF,GAAG;IAACnC;IAAID;GAAS,GACV,qBAACd,aAAAA,eAAAA;IAAYiB,UAAU,SAACuB,GAAAA;IAAO;IAAGd,KAAKE;KAAkBQ,UAAAA,CAAAA;AAClE,CAAA;",
5
+ "names": ["styled", "useComposedRefs", "registerFocusable", "React", "useEffect", "TextInput", "styledBody", "StyledInput", "Input", "styleable", "inProps", "forwardedRef", "type", "dirname", "max", "min", "minLength", "multiple", "name", "required", "step", "disabled", "id", "caretColor", "onChange", "onInput", "rows", "enterKeyHint", "returnKeyType", "onKeyDown", "inputMode", "tag", "rest", "ref", "useRef", "composedRefs", "secureTextEntry", "cursorColor", "_returnKeyType", "_enterKeyHint", "undefined", "_inputMode", "showSoftInputOnFocus", "finalProps", "numberOfLines", "multiline", "onKeyPress", "e", "key", "nativeEvent", "length", "onSubmitEditing", "text", "target", "value", "focusAndSelect", "current", "focus"]
6
+ }
@@ -0,0 +1,28 @@
1
+ import { styled } from "@tamagui/web";
2
+ import { Input } from "./Input";
3
+ import { defaultStyles, textAreaSizeVariant } from "./shared";
4
+ const TextArea = styled(Input, {
5
+ name: "TextArea",
6
+ tag: "textarea",
7
+ // this attribute fixes firefox newline issue
8
+ whiteSpace: "pre-wrap",
9
+ variants: {
10
+ unstyled: {
11
+ false: {
12
+ height: "auto",
13
+ ...defaultStyles,
14
+ numberOfLines: 3
15
+ }
16
+ },
17
+ size: {
18
+ "...size": textAreaSizeVariant
19
+ }
20
+ },
21
+ defaultVariants: {
22
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
23
+ }
24
+ });
25
+ export {
26
+ TextArea
27
+ };
28
+ //# sourceMappingURL=TextArea.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/TextArea.tsx"],
4
+ "mappings": "AAAA,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,eAAe,2BAA2B;AAC5C,MAAM,WAAW,OAAO,OAAO;AAAA,EACpC,MAAM;AAAA,EACN,KAAK;AAAA;AAAA,EAEL,YAAY;AAAA,EAEZ,UAAU;AAAA,IACR,UAAU;AAAA,MACR,OAAO;AAAA,QACL,QAAQ;AAAA,QACR,GAAG;AAAA,QACH,eAAe;AAAA,MACjB;AAAA,IACF;AAAA,IAEA,MAAM;AAAA,MACJ,WAAW;AAAA,IACb;AAAA,EACF;AAAA,EAEA,iBAAiB;AAAA,IACf,UAAU,QAAQ,IAAI,qBAAqB;AAAA,EAC7C;AACF,CAAC;",
5
+ "names": []
6
+ }