@tamagui/input 1.114.4 → 1.115.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.
@@ -0,0 +1,156 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
32
+ var Input_exports = {};
33
+ __export(Input_exports, {
34
+ Input: () => Input
35
+ });
36
+ module.exports = __toCommonJS(Input_exports);
37
+ var import_react = __toESM(require("react")),
38
+ import_core = require("@tamagui/core"),
39
+ import_focusable = require("@tamagui/focusable"),
40
+ import_shared = require("./shared.cjs"),
41
+ import_jsx_runtime = require("react/jsx-runtime");
42
+ const StyledInput = (0, import_core.styled)(import_core.View, import_shared.styledBody[0], import_shared.styledBody[1]),
43
+ Input = StyledInput.styleable((inProps, forwardedRef) => {
44
+ const {
45
+ // some of destructed props are just to avoid passing them to ...rest because they are not in web.
46
+ allowFontScaling,
47
+ selectTextOnFocus,
48
+ showSoftInputOnFocus,
49
+ textContentType,
50
+ passwordRules,
51
+ textBreakStrategy,
52
+ underlineColorAndroid,
53
+ selection,
54
+ lineBreakStrategyIOS,
55
+ returnKeyLabel,
56
+ disabled,
57
+ onSubmitEditing,
58
+ caretHidden,
59
+ clearButtonMode,
60
+ clearTextOnFocus,
61
+ contextMenuHidden,
62
+ dataDetectorTypes,
63
+ id,
64
+ enablesReturnKeyAutomatically,
65
+ importantForAutofill,
66
+ inlineImageLeft,
67
+ inlineImagePadding,
68
+ inputAccessoryViewID,
69
+ keyboardAppearance,
70
+ keyboardType,
71
+ cursorColor,
72
+ disableFullscreenUI,
73
+ editable,
74
+ maxFontSizeMultiplier,
75
+ multiline,
76
+ numberOfLines,
77
+ onChangeText,
78
+ onContentSizeChange,
79
+ onEndEditing,
80
+ onScroll,
81
+ onSelectionChange,
82
+ caretColor,
83
+ placeholderTextColor,
84
+ blurOnSubmit,
85
+ enterKeyHint,
86
+ returnKeyType,
87
+ rejectResponderTermination,
88
+ scrollEnabled,
89
+ secureTextEntry,
90
+ selectionColor,
91
+ inputMode,
92
+ ...rest
93
+ } = inProps,
94
+ ref = import_react.default.useRef(null),
95
+ theme = (0, import_core.useTheme)(),
96
+ composedRefs = (0, import_core.useComposedRefs)(forwardedRef, ref),
97
+ _onSelectionChange = (0, import_core.useEvent)(() => {
98
+ const start = ref.current?.selectionStart ?? 0,
99
+ end = ref.current?.selectionEnd ?? 0;
100
+ onSelectionChange?.({
101
+ nativeEvent: {
102
+ selection: {
103
+ end,
104
+ start
105
+ }
106
+ }
107
+ });
108
+ });
109
+ import_react.default.useEffect(() => {
110
+ if (onSelectionChange) return ref.current?.addEventListener("selectionchange", _onSelectionChange), () => {
111
+ ref.current?.removeEventListener("selectionchange", _onSelectionChange);
112
+ };
113
+ }, []), import_react.default.useEffect(() => {
114
+ selection && ref.current?.setSelectionRange(selection.start || null, selection.end || null);
115
+ }, [selection?.start, selection?.end]);
116
+ const finalProps = {
117
+ ...rest,
118
+ inputMode,
119
+ disabled,
120
+ caretColor,
121
+ id,
122
+ enterKeyHint,
123
+ style: {
124
+ ...rest.style,
125
+ ...(placeholderTextColor && {
126
+ "--placeholderColor": theme[placeholderTextColor]?.variable || placeholderTextColor
127
+ }),
128
+ ...(selectionColor && {
129
+ "--selectionColor": theme[selectionColor]?.variable || selectionColor
130
+ })
131
+ }
132
+ };
133
+ return import_react.default.useEffect(() => {
134
+ if (id && !disabled) return (0, import_focusable.registerFocusable)(id, {
135
+ focusAndSelect: () => {
136
+ ref.current?.focus();
137
+ },
138
+ focus: () => {}
139
+ });
140
+ }, [id, disabled]), /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
141
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)("style", {
142
+ children: `
143
+ input::selection, textarea::selection {
144
+ background-color: var(--selectionBackground) !important;
145
+ }
146
+
147
+ input::placeholder, textarea::placeholder {
148
+ color: var(--placeholderColor) !important;
149
+ }
150
+ `
151
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(StyledInput, {
152
+ ref: composedRefs,
153
+ ...finalProps
154
+ })]
155
+ });
156
+ });
@@ -0,0 +1,133 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
32
+ var Input_native_exports = {};
33
+ __export(Input_native_exports, {
34
+ Input: () => Input
35
+ });
36
+ module.exports = __toCommonJS(Input_native_exports);
37
+ var import_react = __toESM(require("react")),
38
+ import_core = require("@tamagui/core"),
39
+ import_focusable = require("@tamagui/focusable"),
40
+ import_react_native = require("react-native-web"),
41
+ import_shared = require("./shared.cjs"),
42
+ import_jsx_runtime = require("react/jsx-runtime");
43
+ const StyledInput = (0, import_core.styled)(import_react_native.TextInput, import_shared.styledBody[0], import_shared.styledBody[1]),
44
+ Input = StyledInput.styleable((inProps, forwardedRef) => {
45
+ const {
46
+ // some of destructed props are just to avoid passing them to ...rest because they are not in native.
47
+ type,
48
+ //@ts-ignore
49
+ dirname,
50
+ max,
51
+ min,
52
+ minLength,
53
+ multiple,
54
+ name,
55
+ required,
56
+ step,
57
+ disabled,
58
+ id,
59
+ caretColor,
60
+ onChange,
61
+ onInput,
62
+ rows,
63
+ enterKeyHint,
64
+ returnKeyType,
65
+ onKeyDown,
66
+ inputMode,
67
+ tag,
68
+ ...rest
69
+ } = inProps,
70
+ ref = import_react.default.useRef(null),
71
+ composedRefs = (0, import_core.useComposedRefs)(forwardedRef, ref);
72
+ let secureTextEntry = !1,
73
+ cursorColor = caretColor,
74
+ _returnKeyType = returnKeyType,
75
+ _enterKeyHint = enterKeyHint;
76
+ enterKeyHint === "go" && (_returnKeyType = "go", _enterKeyHint = void 0);
77
+ let _inputMode = inputMode;
78
+ 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";
79
+ let showSoftInputOnFocus = !0;
80
+ inputMode === "none" && (showSoftInputOnFocus = !1);
81
+ const finalProps = {
82
+ ...rest,
83
+ inputMode: _inputMode,
84
+ showSoftInputOnFocus,
85
+ disabled,
86
+ id,
87
+ cursorColor,
88
+ enterKeyHint: _enterKeyHint,
89
+ returnKeyType: _returnKeyType,
90
+ secureTextEntry,
91
+ numberOfLines: rows || rest.numberOfLines
92
+ };
93
+ return tag === "textarea" && (finalProps.multiline = !0), onKeyDown && (finalProps.onKeyPress = e => {
94
+ const {
95
+ key
96
+ } = e.nativeEvent;
97
+ (key === "Backspace" || tag === "textarea" && key === "Enter" || key.length === 1) && onKeyDown({
98
+ key,
99
+ type: "keydown"
100
+ });
101
+ }, finalProps.onSubmitEditing = e => {
102
+ onKeyDown({
103
+ key: "Enter",
104
+ type: "keydown"
105
+ });
106
+ }), (onChange || onInput) && (finalProps.onChange = e => {
107
+ const {
108
+ text
109
+ } = e.nativeEvent;
110
+ onChange && onChange({
111
+ target: {
112
+ value: text
113
+ },
114
+ type: "change"
115
+ }), onInput?.({
116
+ target: {
117
+ value: text
118
+ },
119
+ type: "input"
120
+ });
121
+ }), import_react.default.useEffect(() => {
122
+ if (id && !disabled) return (0, import_focusable.registerFocusable)(id, {
123
+ focusAndSelect: () => {
124
+ ref.current?.focus();
125
+ },
126
+ focus: () => {}
127
+ });
128
+ }, [id, disabled]), /* @__PURE__ */(0, import_jsx_runtime.jsx)(StyledInput, {
129
+ onChange: e => {},
130
+ ref: composedRefs,
131
+ ...finalProps
132
+ });
133
+ });
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Input.native.tsx"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB,2BAClB,cAAwC,0BACxC,mBAAkC,+BAGlC,sBAA0B,yBAC1B,gBAA2B,qBA6IlB;AA3IT,MAAM,kBAAc,oBAAO,+BAAW,yBAAW,CAAC,GAAG,yBAAW,CAAC,CAAC,GAErD,QAAQ,YAAY,UAAsB,CAAC,SAAS,iBAAiB;AAChF,QAAM;AAAA;AAAA,IAEJ;AAAA;AAAA,IAEA;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,GAAG;AAAA,EACL,IAAI,SAEE,MAAM,aAAAA,QAAM,OAAyB,IAAI,GAEzC,mBAAe,6BAAqB,cAAc,GAAG;AAI3D,MAAI,kBAAkB,IAClB,cAAc,YACd,iBAAiB,eACjB,gBAAgB;AACpB,EAAI,iBAAiB,SACnB,iBAAiB,MACjB,gBAAgB;AAGlB,MAAI,aAAa;AACjB,EAAI,SAAS,UACX,aAAa,UACJ,SAAS,QAClB,aAAa,QACJ,SAAS,WAClB,aAAa,WACJ,SAAS,QAClB,aAAa,QACJ,SAAS,cAClB,kBAAkB,IAClB,aAAa,UACJ,SAAS,WAClB,aAAa,YAEb,aAAa;AAGf,MAAI,uBAAuB;AAC3B,EAAI,cAAc,WAChB,uBAAuB;AAGzB,QAAM,aAAa;AAAA,IACjB,GAAG;AAAA,IACH,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd,eAAe;AAAA,IACf;AAAA,IACA,eAAe,QAAQ,KAAK;AAAA,EAC9B;AAEA,SAAI,QAAQ,eACV,WAAW,YAAY,KAGrB,cACF,WAAW,aAAa,CAAC,MAAM;AAC7B,UAAM,EAAE,IAAI,IAAI,EAAE;AAClB,KACE,QAAQ,eACP,QAAQ,cAAc,QAAQ,WAC/B,IAAI,WAAW,MAEf,UAAU;AAAA,MACR;AAAA,MACA,MAAM;AAAA,IACR,CAAQ;AAAA,EAEZ,GACA,WAAW,kBAAkB,CAAC,MAAM;AAClC,cAAU;AAAA,MACR,KAAK;AAAA,MACL,MAAM;AAAA,IACR,CAAQ;AAAA,EACV,KAGE,YAAY,aACd,WAAW,WAAW,CAAC,MAAsD;AAC3E,UAAM,EAAE,KAAK,IAAI,EAAE;AACnB,IAAI,YACF,SAAS;AAAA,MACP,QAAQ;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,MAAM;AAAA,IACR,CAAQ,GAGR,UAAQ;AAAA,MACN,QAAQ;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,MAAM;AAAA,IACR,CAAQ;AAAA,EAEZ,IAGF,aAAAA,QAAM,UAAU,MAAM;AACpB,QAAK,MACD;AAEJ,iBAAO,oCAAkB,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,GACV,4CAAC,eAAY,UAAU,CAAC,MAAM;AAAA,EAAC,GAAG,KAAK,cAAe,GAAG,YAAY;AAC9E,CAAC;",
5
+ "names": ["React"]
6
+ }
@@ -3,21 +3,29 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: !0 });
8
- }, __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from == "object" || typeof from == "function")
10
- for (let key of __getOwnPropNames(from))
11
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
15
21
  var TextArea_exports = {};
16
22
  __export(TextArea_exports, {
17
23
  TextArea: () => TextArea
18
24
  });
19
25
  module.exports = __toCommonJS(TextArea_exports);
20
- var import_web = require("@tamagui/web"), import_Input = require("./Input"), import_shared = require("./shared");
26
+ var import_web = require("@tamagui/web"),
27
+ import_Input = require("./Input.cjs"),
28
+ import_shared = require("./shared.cjs");
21
29
  const TextArea = (0, import_web.styled)(import_Input.Input, {
22
30
  name: "TextArea",
23
31
  tag: "textarea",
@@ -39,5 +47,4 @@ const TextArea = (0, import_web.styled)(import_Input.Input, {
39
47
  defaultVariants: {
40
48
  unstyled: process.env.TAMAGUI_HEADLESS === "1"
41
49
  }
42
- });
43
- //# sourceMappingURL=TextArea.js.map
50
+ });
@@ -0,0 +1,19 @@
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") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
+ get: () => from[key],
8
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
+ });
10
+ return to;
11
+ },
12
+ __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
13
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
14
+ value: !0
15
+ }), mod);
16
+ var src_exports = {};
17
+ module.exports = __toCommonJS(src_exports);
18
+ __reExport(src_exports, require("./Input.cjs"), module.exports);
19
+ __reExport(src_exports, require("./TextArea.cjs"), module.exports);
@@ -0,0 +1,128 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var shared_exports = {};
22
+ __export(shared_exports, {
23
+ INPUT_NAME: () => INPUT_NAME,
24
+ defaultStyles: () => defaultStyles,
25
+ inputSizeVariant: () => inputSizeVariant,
26
+ styledBody: () => styledBody,
27
+ textAreaSizeVariant: () => textAreaSizeVariant
28
+ });
29
+ module.exports = __toCommonJS(shared_exports);
30
+ var import_core = require("@tamagui/core"),
31
+ import_core2 = require("@tamagui/core"),
32
+ import_get_button_sized = require("@tamagui/get-button-sized"),
33
+ import_get_font_sized = require("@tamagui/get-font-sized"),
34
+ import_get_token = require("@tamagui/get-token");
35
+ const defaultStyles = {
36
+ size: "$true",
37
+ fontFamily: "$body",
38
+ borderWidth: 1,
39
+ outlineWidth: 0,
40
+ color: "$color",
41
+ ...(import_core2.isWeb ? {
42
+ tabIndex: 0
43
+ } : {
44
+ focusable: !0
45
+ }),
46
+ borderColor: "$borderColor",
47
+ backgroundColor: "$background",
48
+ // this fixes a flex bug where it overflows container
49
+ minWidth: 0,
50
+ hoverStyle: {
51
+ borderColor: "$borderColorHover"
52
+ },
53
+ focusStyle: {
54
+ borderColor: "$borderColorFocus"
55
+ },
56
+ focusVisibleStyle: {
57
+ outlineColor: "$outlineColor",
58
+ outlineWidth: 2,
59
+ outlineStyle: "solid"
60
+ }
61
+ },
62
+ inputSizeVariant = (val = "$true", extras) => {
63
+ if (extras.props.multiline || extras.props.numberOfLines > 1) return textAreaSizeVariant(val, extras);
64
+ const buttonStyles = (0, import_get_button_sized.getButtonSized)(val, extras),
65
+ paddingHorizontal = (0, import_get_token.getSpace)(val, {
66
+ shift: -1,
67
+ bounds: [2]
68
+ }),
69
+ fontStyle = (0, import_get_font_sized.getFontSized)(val, extras);
70
+ return !import_core2.isWeb && fontStyle && delete fontStyle.lineHeight, {
71
+ ...fontStyle,
72
+ ...buttonStyles,
73
+ paddingHorizontal
74
+ };
75
+ },
76
+ textAreaSizeVariant = (val = "$true", extras) => {
77
+ const {
78
+ props
79
+ } = extras,
80
+ buttonStyles = (0, import_get_button_sized.getButtonSized)(val, extras),
81
+ fontStyle = (0, import_get_font_sized.getFontSized)(val, extras),
82
+ lines = props.rows ?? props.numberOfLines,
83
+ height = typeof lines == "number" ? lines * (0, import_core2.getVariableValue)(fontStyle.lineHeight) : "auto",
84
+ paddingVertical = (0, import_get_token.getSpace)(val, {
85
+ shift: -2,
86
+ bounds: [2]
87
+ }),
88
+ paddingHorizontal = (0, import_get_token.getSpace)(val, {
89
+ shift: -1,
90
+ bounds: [2]
91
+ });
92
+ return {
93
+ ...buttonStyles,
94
+ ...fontStyle,
95
+ paddingVertical,
96
+ paddingHorizontal,
97
+ height
98
+ };
99
+ },
100
+ INPUT_NAME = "Input",
101
+ styledBody = [{
102
+ name: INPUT_NAME,
103
+ tag: "input",
104
+ variants: {
105
+ unstyled: {
106
+ false: defaultStyles
107
+ },
108
+ size: {
109
+ "...size": inputSizeVariant
110
+ },
111
+ disabled: {
112
+ true: {}
113
+ }
114
+ },
115
+ defaultVariants: {
116
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
117
+ }
118
+ }, {
119
+ isInput: !0,
120
+ accept: {
121
+ placeholderTextColor: "color",
122
+ selectionColor: "color"
123
+ },
124
+ validStyles: {
125
+ ...import_core.validStyles,
126
+ ...import_core.stylePropsTextOnly
127
+ }
128
+ }];
@@ -0,0 +1,16 @@
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") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
7
+ get: () => from[key],
8
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9
+ });
10
+ return to;
11
+ };
12
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
13
+ value: !0
14
+ }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/input",
3
- "version": "1.114.4",
3
+ "version": "1.115.0",
4
4
  "sideEffects": [
5
5
  "*.css"
6
6
  ],
@@ -29,22 +29,23 @@
29
29
  "react-native": "./dist/cjs/index.native.js",
30
30
  "types": "./types/index.d.ts",
31
31
  "import": "./dist/esm/index.mjs",
32
- "require": "./dist/cjs/index.js"
32
+ "require": "./dist/cjs/index.cjs",
33
+ "default": "./dist/cjs/index.native.js"
33
34
  }
34
35
  },
35
36
  "dependencies": {
36
- "@tamagui/core": "1.114.4",
37
- "@tamagui/focusable": "1.114.4",
38
- "@tamagui/font-size": "1.114.4",
39
- "@tamagui/get-button-sized": "1.114.4",
40
- "@tamagui/helpers": "1.114.4",
41
- "@tamagui/helpers-tamagui": "1.114.4",
42
- "@tamagui/stacks": "1.114.4",
43
- "@tamagui/text": "1.114.4",
44
- "@tamagui/web": "1.114.4"
37
+ "@tamagui/core": "1.115.0",
38
+ "@tamagui/focusable": "1.115.0",
39
+ "@tamagui/font-size": "1.115.0",
40
+ "@tamagui/get-button-sized": "1.115.0",
41
+ "@tamagui/helpers": "1.115.0",
42
+ "@tamagui/helpers-tamagui": "1.115.0",
43
+ "@tamagui/stacks": "1.115.0",
44
+ "@tamagui/text": "1.115.0",
45
+ "@tamagui/web": "1.115.0"
45
46
  },
46
47
  "devDependencies": {
47
- "@tamagui/build": "1.114.4",
48
+ "@tamagui/build": "1.115.0",
48
49
  "react": "^18.2.0 || ^19.0.0",
49
50
  "vitest": "2.1.1"
50
51
  },
package/dist/cjs/Input.js DELETED
@@ -1,137 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf, __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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
- // If the importer is in node compatibility mode or this is not an ESM
17
- // file that has been converted to a CommonJS file using a Babel-
18
- // compatible transform (i.e. "__esModule" has not been set), then set
19
- // "default" to the CommonJS "module.exports" for node compatibility.
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
- mod
22
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
- var Input_exports = {};
24
- __export(Input_exports, {
25
- Input: () => Input
26
- });
27
- module.exports = __toCommonJS(Input_exports);
28
- var import_react = __toESM(require("react")), import_core = require("@tamagui/core"), import_focusable = require("@tamagui/focusable"), import_shared = require("./shared"), import_jsx_runtime = require("react/jsx-runtime");
29
- const StyledInput = (0, import_core.styled)(import_core.View, import_shared.styledBody[0], import_shared.styledBody[1]), Input = StyledInput.styleable((inProps, forwardedRef) => {
30
- const {
31
- // some of destructed props are just to avoid passing them to ...rest because they are not in web.
32
- allowFontScaling,
33
- selectTextOnFocus,
34
- showSoftInputOnFocus,
35
- textContentType,
36
- passwordRules,
37
- textBreakStrategy,
38
- underlineColorAndroid,
39
- selection,
40
- lineBreakStrategyIOS,
41
- returnKeyLabel,
42
- disabled,
43
- onSubmitEditing,
44
- caretHidden,
45
- clearButtonMode,
46
- clearTextOnFocus,
47
- contextMenuHidden,
48
- dataDetectorTypes,
49
- id,
50
- enablesReturnKeyAutomatically,
51
- importantForAutofill,
52
- inlineImageLeft,
53
- inlineImagePadding,
54
- inputAccessoryViewID,
55
- keyboardAppearance,
56
- keyboardType,
57
- cursorColor,
58
- disableFullscreenUI,
59
- editable,
60
- maxFontSizeMultiplier,
61
- multiline,
62
- numberOfLines,
63
- onChangeText,
64
- onContentSizeChange,
65
- onEndEditing,
66
- onScroll,
67
- onSelectionChange,
68
- caretColor,
69
- placeholderTextColor,
70
- blurOnSubmit,
71
- enterKeyHint,
72
- returnKeyType,
73
- rejectResponderTermination,
74
- scrollEnabled,
75
- secureTextEntry,
76
- selectionColor,
77
- inputMode,
78
- ...rest
79
- } = inProps, ref = import_react.default.useRef(null), theme = (0, import_core.useTheme)(), composedRefs = (0, import_core.useComposedRefs)(forwardedRef, ref), _onSelectionChange = (0, import_core.useEvent)(() => {
80
- const start = ref.current?.selectionStart ?? 0, end = ref.current?.selectionEnd ?? 0;
81
- onSelectionChange?.({
82
- nativeEvent: {
83
- selection: {
84
- end,
85
- start
86
- }
87
- }
88
- });
89
- });
90
- import_react.default.useEffect(() => {
91
- if (onSelectionChange)
92
- return ref.current?.addEventListener("selectionchange", _onSelectionChange), () => {
93
- ref.current?.removeEventListener("selectionchange", _onSelectionChange);
94
- };
95
- }, []), import_react.default.useEffect(() => {
96
- selection && ref.current?.setSelectionRange(selection.start || null, selection.end || null);
97
- }, [selection?.start, selection?.end]);
98
- const finalProps = {
99
- ...rest,
100
- inputMode,
101
- disabled,
102
- caretColor,
103
- id,
104
- enterKeyHint,
105
- style: {
106
- ...rest.style,
107
- ...placeholderTextColor && {
108
- "--placeholderColor": theme[placeholderTextColor]?.variable || placeholderTextColor
109
- },
110
- ...selectionColor && {
111
- "--selectionColor": theme[selectionColor]?.variable || selectionColor
112
- }
113
- }
114
- };
115
- return import_react.default.useEffect(() => {
116
- if (id && !disabled)
117
- return (0, import_focusable.registerFocusable)(id, {
118
- focusAndSelect: () => {
119
- ref.current?.focus();
120
- },
121
- focus: () => {
122
- }
123
- });
124
- }, [id, disabled]), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
125
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: `
126
- input::selection, textarea::selection {
127
- background-color: var(--selectionBackground) !important;
128
- }
129
-
130
- input::placeholder, textarea::placeholder {
131
- color: var(--placeholderColor) !important;
132
- }
133
- ` }),
134
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledInput, { ref: composedRefs, ...finalProps })
135
- ] });
136
- });
137
- //# sourceMappingURL=Input.js.map
package/dist/cjs/index.js DELETED
@@ -1,16 +0,0 @@
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
- }, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
11
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
12
- var src_exports = {};
13
- module.exports = __toCommonJS(src_exports);
14
- __reExport(src_exports, require("./Input"), module.exports);
15
- __reExport(src_exports, require("./TextArea"), module.exports);
16
- //# sourceMappingURL=index.js.map
@@ -1,109 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: !0 });
8
- }, __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from == "object" || typeof from == "function")
10
- for (let key of __getOwnPropNames(from))
11
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
- var shared_exports = {};
16
- __export(shared_exports, {
17
- INPUT_NAME: () => INPUT_NAME,
18
- defaultStyles: () => defaultStyles,
19
- inputSizeVariant: () => inputSizeVariant,
20
- styledBody: () => styledBody,
21
- textAreaSizeVariant: () => textAreaSizeVariant
22
- });
23
- module.exports = __toCommonJS(shared_exports);
24
- 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");
25
- const defaultStyles = {
26
- size: "$true",
27
- fontFamily: "$body",
28
- borderWidth: 1,
29
- outlineWidth: 0,
30
- color: "$color",
31
- ...import_core2.isWeb ? {
32
- tabIndex: 0
33
- } : {
34
- focusable: !0
35
- },
36
- borderColor: "$borderColor",
37
- backgroundColor: "$background",
38
- // this fixes a flex bug where it overflows container
39
- minWidth: 0,
40
- hoverStyle: {
41
- borderColor: "$borderColorHover"
42
- },
43
- focusStyle: {
44
- borderColor: "$borderColorFocus"
45
- },
46
- focusVisibleStyle: {
47
- outlineColor: "$outlineColor",
48
- outlineWidth: 2,
49
- outlineStyle: "solid"
50
- }
51
- }, inputSizeVariant = (val = "$true", extras) => {
52
- if (extras.props.multiline || extras.props.numberOfLines > 1)
53
- return textAreaSizeVariant(val, extras);
54
- const buttonStyles = (0, import_get_button_sized.getButtonSized)(val, extras), paddingHorizontal = (0, import_get_token.getSpace)(val, {
55
- shift: -1,
56
- bounds: [2]
57
- }), fontStyle = (0, import_get_font_sized.getFontSized)(val, extras);
58
- return !import_core2.isWeb && fontStyle && delete fontStyle.lineHeight, {
59
- ...fontStyle,
60
- ...buttonStyles,
61
- paddingHorizontal
62
- };
63
- }, textAreaSizeVariant = (val = "$true", extras) => {
64
- const { props } = extras, buttonStyles = (0, import_get_button_sized.getButtonSized)(val, extras), fontStyle = (0, import_get_font_sized.getFontSized)(val, extras), lines = props.rows ?? props.numberOfLines, height = typeof lines == "number" ? lines * (0, import_core2.getVariableValue)(fontStyle.lineHeight) : "auto", paddingVertical = (0, import_get_token.getSpace)(val, {
65
- shift: -2,
66
- bounds: [2]
67
- }), paddingHorizontal = (0, import_get_token.getSpace)(val, {
68
- shift: -1,
69
- bounds: [2]
70
- });
71
- return {
72
- ...buttonStyles,
73
- ...fontStyle,
74
- paddingVertical,
75
- paddingHorizontal,
76
- height
77
- };
78
- }, INPUT_NAME = "Input", styledBody = [
79
- {
80
- name: INPUT_NAME,
81
- tag: "input",
82
- variants: {
83
- unstyled: {
84
- false: defaultStyles
85
- },
86
- size: {
87
- "...size": inputSizeVariant
88
- },
89
- disabled: {
90
- true: {}
91
- }
92
- },
93
- defaultVariants: {
94
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
95
- }
96
- },
97
- {
98
- isInput: !0,
99
- accept: {
100
- placeholderTextColor: "color",
101
- selectionColor: "color"
102
- },
103
- validStyles: {
104
- ...import_core.validStyles,
105
- ...import_core.stylePropsTextOnly
106
- }
107
- }
108
- ];
109
- //# sourceMappingURL=shared.js.map
package/dist/cjs/types.js DELETED
@@ -1,14 +0,0 @@
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
File without changes
File without changes
File without changes
File without changes
File without changes