@tamagui/focusable 1.89.26 → 1.89.27-1708113113238
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/focusable.native.js.map +2 -2
- package/dist/cjs/focusableInputHOC.native.js +73 -34
- package/dist/cjs/focusableInputHOC.native.js.map +3 -3
- package/dist/cjs/index.native.js.map +2 -2
- package/dist/cjs/registerFocusable.native.js +7 -5
- package/dist/cjs/registerFocusable.native.js.map +3 -3
- package/dist/esm/focusableInputHOC.native.js +63 -33
- package/dist/esm/focusableInputHOC.native.js.map +3 -3
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/registerFocusable.native.js +7 -5
- package/dist/esm/registerFocusable.native.js.map +3 -3
- package/dist/jsx/focusableInputHOC.native.js +63 -33
- package/dist/jsx/focusableInputHOC.native.js.map +3 -3
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/registerFocusable.native.js +7 -5
- package/dist/jsx/registerFocusable.native.js.map +3 -3
- package/package.json +4 -4
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
7
|
var __export = (target, all) => {
|
|
7
8
|
for (var name in all)
|
|
8
9
|
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
@@ -12,56 +13,94 @@ var __export = (target, all) => {
|
|
|
12
13
|
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
14
|
return to;
|
|
14
15
|
};
|
|
15
|
-
var
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
22
|
+
mod
|
|
23
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
24
|
var focusableInputHOC_exports = {};
|
|
17
25
|
__export(focusableInputHOC_exports, {
|
|
18
26
|
focusableInputHOC: () => focusableInputHOC,
|
|
19
27
|
useFocusable: () => useFocusable
|
|
20
28
|
});
|
|
21
29
|
module.exports = __toCommonJS(focusableInputHOC_exports);
|
|
22
|
-
var import_compose_refs = require("@tamagui/compose-refs"), import_web = require("@tamagui/web"), import_react = require("react"), import_registerFocusable = require("./registerFocusable")
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
30
|
+
var import_compose_refs = require("@tamagui/compose-refs"), import_web = require("@tamagui/web"), import_react = __toESM(require("react")), import_registerFocusable = require("./registerFocusable");
|
|
31
|
+
function _define_property(obj, key, value) {
|
|
32
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
33
|
+
value,
|
|
34
|
+
enumerable: !0,
|
|
35
|
+
configurable: !0,
|
|
36
|
+
writable: !0
|
|
37
|
+
}) : obj[key] = value, obj;
|
|
38
|
+
}
|
|
39
|
+
function _object_spread(target) {
|
|
40
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
41
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
42
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
43
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
44
|
+
}))), ownKeys2.forEach(function(key) {
|
|
45
|
+
_define_property(target, key, source[key]);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return target;
|
|
49
|
+
}
|
|
50
|
+
function ownKeys(object, enumerableOnly) {
|
|
51
|
+
var keys = Object.keys(object);
|
|
52
|
+
if (Object.getOwnPropertySymbols) {
|
|
53
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
54
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
55
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
56
|
+
})), keys.push.apply(keys, symbols);
|
|
57
|
+
}
|
|
58
|
+
return keys;
|
|
59
|
+
}
|
|
60
|
+
function _object_spread_props(target, source) {
|
|
61
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
62
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
63
|
+
}), target;
|
|
64
|
+
}
|
|
65
|
+
function useFocusable(param) {
|
|
66
|
+
var isInput = param.isInput, props = param.props, ref = param.ref, id = props.id, onChangeText = props.onChangeText, value = props.value, defaultValue = props.defaultValue, inputValue = (0, import_react.useRef)(value || defaultValue || ""), unregisterFocusable = (0, import_react.useRef)(), inputRef = (0, import_react.useCallback)(function(input) {
|
|
67
|
+
var _unregisterFocusable_current;
|
|
68
|
+
id && input && ((_unregisterFocusable_current = unregisterFocusable.current) === null || _unregisterFocusable_current === void 0 || _unregisterFocusable_current.call(unregisterFocusable), unregisterFocusable.current = (0, import_registerFocusable.registerFocusable)(id, _object_spread({
|
|
69
|
+
focus: input.focus
|
|
70
|
+
}, isInput && {
|
|
71
|
+
// react-native doesn't support programmatic .select()
|
|
72
|
+
focusAndSelect: function() {
|
|
73
|
+
input.focus(), input.setSelection && typeof inputValue.current == "string" && input.setSelection(0, inputValue.current.length);
|
|
74
|
+
}
|
|
75
|
+
})));
|
|
76
|
+
}, [
|
|
77
|
+
isInput,
|
|
78
|
+
id
|
|
79
|
+
]), combinedRefs = (0, import_compose_refs.composeRefs)(ref, inputRef);
|
|
80
|
+
return (0, import_react.useEffect)(function() {
|
|
81
|
+
return function() {
|
|
82
|
+
var _unregisterFocusable_current;
|
|
83
|
+
(_unregisterFocusable_current = unregisterFocusable.current) === null || _unregisterFocusable_current === void 0 || _unregisterFocusable_current.call(unregisterFocusable);
|
|
84
|
+
};
|
|
46
85
|
}, []), {
|
|
47
86
|
ref: combinedRefs,
|
|
48
|
-
onChangeText: (0, import_web.useEvent)((value2)
|
|
87
|
+
onChangeText: (0, import_web.useEvent)(function(value2) {
|
|
49
88
|
inputValue.current = value2, onChangeText == null || onChangeText(value2);
|
|
50
89
|
})
|
|
51
90
|
};
|
|
52
91
|
}
|
|
53
92
|
function focusableInputHOC(Component) {
|
|
54
|
-
return Component.styleable((props, ref)
|
|
55
|
-
var
|
|
56
|
-
const isInput = (_a = Component.staticConfig) == null ? void 0 : _a.isInput, { ref: combinedRef, onChangeText } = useFocusable({
|
|
93
|
+
return Component.styleable(function(props, ref) {
|
|
94
|
+
var _Component_staticConfig, isInput = (_Component_staticConfig = Component.staticConfig) === null || _Component_staticConfig === void 0 ? void 0 : _Component_staticConfig.isInput, _useFocusable = useFocusable({
|
|
57
95
|
ref,
|
|
58
96
|
props,
|
|
59
97
|
isInput
|
|
60
|
-
}), finalProps = isInput ? {
|
|
61
|
-
...props,
|
|
98
|
+
}), combinedRef = _useFocusable.ref, onChangeText = _useFocusable.onChangeText, finalProps = isInput ? _object_spread_props(_object_spread({}, props), {
|
|
62
99
|
onChangeText
|
|
63
|
-
} : props;
|
|
64
|
-
return /* @__PURE__ */
|
|
100
|
+
}) : props;
|
|
101
|
+
return /* @__PURE__ */ import_react.default.createElement(Component, _object_spread({
|
|
102
|
+
ref: combinedRef
|
|
103
|
+
}, finalProps));
|
|
65
104
|
});
|
|
66
105
|
}
|
|
67
106
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/focusableInputHOC.tsx"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": ["value"]
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/focusable/src/focusableInputHOC.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0BAA4B,kCAE5B,aAAyB,yBACzB,eAAsD,2BAEtD,2BAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAS3B,SAASA,aAAa,OAQ5B;MAPCC,UAD2B,MAC3BA,SACAC,QAF2B,MAE3BA,OACAC,MAH2B,MAG3BA,KAMQC,KAA0CF,MAA1CE,IAAIC,eAAsCH,MAAtCG,cAAcC,QAAwBJ,MAAxBI,OAAOC,eAAiBL,MAAjBK,cAC3BC,iBAAaC,qBAAOH,SAASC,gBAAgB,EAAA,GAC7CG,0BAAsBD,qBAAAA,GAEtBE,eAAWC,0BACf,SAACC,OAAAA;QAGCH;AAFA,IAAKN,MACAS,WACLH,+BAAAA,oBAAoBI,aAAO,QAA3BJ,iCAAAA,UAAAA,6BAAAA,KAAAA,mBAAAA,GACAA,oBAAoBI,cAAUC,4CAAkBX,IAAI,eAAA;MAClDY,OAAOH,MAAMG;OAETf,WAAW;;MAEbgB,gBAAAA,WAAAA;AACEJ,cAAMG,MAAK,GACPH,MAAMK,gBAAgB,OAAOV,WAAWM,WAAY,YACtDD,MAAMK,aAAa,GAAGV,WAAWM,QAAQK,MAAM;MAEnD;IACF,CAAA,CAAA;EAEJ,GACA;IAAClB;IAASG;GAAG,GAGTgB,mBAAeC,iCAAYlB,KAAKQ,QAAAA;AAEtCW,qCAAU,WAAA;AACR,WAAO,WAAA;UACLZ;OAAAA,+BAAAA,oBAAoBI,aAAO,QAA3BJ,iCAAAA,UAAAA,6BAAAA,KAAAA,mBAAAA;IACF;EACF,GAAG,CAAA,CAAE,GAEE;IACLP,KAAKiB;IACLf,kBAAckB,qBAAS,SAACjB,QAAAA;AACtBE,iBAAWM,UAAUR,QACrBD,gBAAAA,QAAAA,aAAeC,MAAAA;IACjB,CAAA;EACF;AACF;AAEO,SAASkB,kBAA8CC,WAAY;AACxE,SAAOA,UAAUC,UAAU,SAACxB,OAAuBC,KAAAA;QACjCsB,yBAAVxB,WAAUwB,0BAAAA,UAAUE,kBAAY,QAAtBF,4BAAAA,SAAAA,SAAAA,wBAAwBxB,SACGD,gBAAAA,aAAa;MACtDG;MACAD;MACAD;IACF,CAAA,GAJa2B,cAA8B5B,cAAnCG,KAAkBE,eAAiBL,cAAjBK,cAKpBwB,aAAa5B,UACf,qBAAA,eAAA,CAAA,GACKC,KAAAA,GAAAA;MACHG;SAEFH;AAGJ,WAAO,6BAAA4B,QAAA,cAACL,WAAAA,eAAAA;MAAUtB,KAAKyB;OAAiBC,UAAAA,CAAAA;EAC1C,CAAA;AACF;",
|
|
5
|
+
"names": ["useFocusable", "isInput", "props", "ref", "id", "onChangeText", "value", "defaultValue", "inputValue", "useRef", "unregisterFocusable", "inputRef", "useCallback", "input", "current", "registerFocusable", "focus", "focusAndSelect", "setSelection", "length", "combinedRefs", "composeRefs", "useEffect", "useEvent", "focusableInputHOC", "Component", "styleable", "staticConfig", "combinedRef", "finalProps", "React"]
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;AAAA
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/focusable/src/index.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;AAAA;;wBAAc,gCAAd;AACA,wBAAc,gCADd;AAEA,wBAAc,wBAFd;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -20,12 +20,14 @@ __export(registerFocusable_native_exports, {
|
|
|
20
20
|
unregisterFocusable: () => unregisterFocusable
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(registerFocusable_native_exports);
|
|
23
|
-
|
|
23
|
+
var InputsMap = /* @__PURE__ */ new Map(), registerFocusable = function(id, input) {
|
|
24
|
+
return process.env.NODE_ENV === "development" && InputsMap.has(id) && console.warn("Warning, duplicate ID for input: ".concat(id)), InputsMap.set(id, input), function() {
|
|
25
|
+
InputsMap.delete(id);
|
|
26
|
+
};
|
|
27
|
+
}, unregisterFocusable = function(id) {
|
|
24
28
|
InputsMap.delete(id);
|
|
25
|
-
}
|
|
26
|
-
InputsMap.
|
|
27
|
-
}, focusFocusable = (id, select = !1) => {
|
|
28
|
-
const input = InputsMap.get(id);
|
|
29
|
+
}, focusFocusable = function(id) {
|
|
30
|
+
var select = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, input = InputsMap.get(id);
|
|
29
31
|
if (!input) {
|
|
30
32
|
process.env.NODE_ENV === "development" && console.warn("No input found for id", id);
|
|
31
33
|
return;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/registerFocusable.native.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;AAAA
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/focusable/src/registerFocusable.native.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;;;;;;;AAIA,IAAMA,YAAY,oBAAIC,IAAAA,GAETC,oBAAoB,SAACC,IAAYC,OAAAA;AAC5C,SAAIC,QAAQC,IAAIC,aAAa,iBACvBP,UAAUQ,IAAIL,EAAAA,KAChBM,QAAQC,KAAM,oCAAsC,OAAHP,EAAAA,CAAAA,GAGrDH,UAAUW,IAAIR,IAAIC,KAAAA,GACX,WAAA;AACLJ,cAAUY,OAAOT,EAAAA;EACnB;AACF,GAEaU,sBAAsB,SAACV,IAAAA;AAClCH,YAAUY,OAAOT,EAAAA;AACnB,GAEaW,iBAAiB,SAACX,IAAAA;MAAYY,SAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAAS,IAC5CX,QAAQJ,UAAUgB,IAAIb,EAAAA;AAC5B,MAAI,CAACC,OAAO;AACV,IAAIC,QAAQC,IAAIC,aAAa,iBAC3BE,QAAQC,KAAK,yBAAyBP,EAAAA;AAExC;EACF;AACA,EAAIY,UAAU,CAACX,MAAMa,iBACnBb,MAAMc,MAAK,IAEXd,MAAMa,eAAc;AAExB;",
|
|
5
|
+
"names": ["InputsMap", "Map", "registerFocusable", "id", "input", "process", "env", "NODE_ENV", "has", "console", "warn", "set", "delete", "unregisterFocusable", "focusFocusable", "select", "get", "focusAndSelect", "focus"]
|
|
6
6
|
}
|
|
@@ -1,50 +1,80 @@
|
|
|
1
1
|
import { composeRefs } from "@tamagui/compose-refs";
|
|
2
2
|
import { useEvent } from "@tamagui/web";
|
|
3
|
-
import { useCallback, useEffect, useRef } from "react";
|
|
3
|
+
import React, { useCallback, useEffect, useRef } from "react";
|
|
4
4
|
import { registerFocusable } from "./registerFocusable";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var
|
|
28
|
-
(
|
|
5
|
+
function _define_property(obj, key, value) {
|
|
6
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
7
|
+
value,
|
|
8
|
+
enumerable: !0,
|
|
9
|
+
configurable: !0,
|
|
10
|
+
writable: !0
|
|
11
|
+
}) : obj[key] = value, obj;
|
|
12
|
+
}
|
|
13
|
+
function _object_spread(target) {
|
|
14
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
15
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
16
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
17
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
18
|
+
}))), ownKeys2.forEach(function(key) {
|
|
19
|
+
_define_property(target, key, source[key]);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return target;
|
|
23
|
+
}
|
|
24
|
+
function ownKeys(object, enumerableOnly) {
|
|
25
|
+
var keys = Object.keys(object);
|
|
26
|
+
if (Object.getOwnPropertySymbols) {
|
|
27
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
28
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
29
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
30
|
+
})), keys.push.apply(keys, symbols);
|
|
31
|
+
}
|
|
32
|
+
return keys;
|
|
33
|
+
}
|
|
34
|
+
function _object_spread_props(target, source) {
|
|
35
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
36
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
37
|
+
}), target;
|
|
38
|
+
}
|
|
39
|
+
function useFocusable(param) {
|
|
40
|
+
var isInput = param.isInput, props = param.props, ref = param.ref, id = props.id, onChangeText = props.onChangeText, value = props.value, defaultValue = props.defaultValue, inputValue = useRef(value || defaultValue || ""), unregisterFocusable = useRef(), inputRef = useCallback(function(input) {
|
|
41
|
+
var _unregisterFocusable_current;
|
|
42
|
+
id && input && ((_unregisterFocusable_current = unregisterFocusable.current) === null || _unregisterFocusable_current === void 0 || _unregisterFocusable_current.call(unregisterFocusable), unregisterFocusable.current = registerFocusable(id, _object_spread({
|
|
43
|
+
focus: input.focus
|
|
44
|
+
}, isInput && {
|
|
45
|
+
// react-native doesn't support programmatic .select()
|
|
46
|
+
focusAndSelect: function() {
|
|
47
|
+
input.focus(), input.setSelection && typeof inputValue.current == "string" && input.setSelection(0, inputValue.current.length);
|
|
48
|
+
}
|
|
49
|
+
})));
|
|
50
|
+
}, [
|
|
51
|
+
isInput,
|
|
52
|
+
id
|
|
53
|
+
]), combinedRefs = composeRefs(ref, inputRef);
|
|
54
|
+
return useEffect(function() {
|
|
55
|
+
return function() {
|
|
56
|
+
var _unregisterFocusable_current;
|
|
57
|
+
(_unregisterFocusable_current = unregisterFocusable.current) === null || _unregisterFocusable_current === void 0 || _unregisterFocusable_current.call(unregisterFocusable);
|
|
58
|
+
};
|
|
29
59
|
}, []), {
|
|
30
60
|
ref: combinedRefs,
|
|
31
|
-
onChangeText: useEvent((value2)
|
|
61
|
+
onChangeText: useEvent(function(value2) {
|
|
32
62
|
inputValue.current = value2, onChangeText == null || onChangeText(value2);
|
|
33
63
|
})
|
|
34
64
|
};
|
|
35
65
|
}
|
|
36
66
|
function focusableInputHOC(Component) {
|
|
37
|
-
return Component.styleable((props, ref)
|
|
38
|
-
var
|
|
39
|
-
const isInput = (_a = Component.staticConfig) == null ? void 0 : _a.isInput, { ref: combinedRef, onChangeText } = useFocusable({
|
|
67
|
+
return Component.styleable(function(props, ref) {
|
|
68
|
+
var _Component_staticConfig, isInput = (_Component_staticConfig = Component.staticConfig) === null || _Component_staticConfig === void 0 ? void 0 : _Component_staticConfig.isInput, _useFocusable = useFocusable({
|
|
40
69
|
ref,
|
|
41
70
|
props,
|
|
42
71
|
isInput
|
|
43
|
-
}), finalProps = isInput ? {
|
|
44
|
-
...props,
|
|
72
|
+
}), combinedRef = _useFocusable.ref, onChangeText = _useFocusable.onChangeText, finalProps = isInput ? _object_spread_props(_object_spread({}, props), {
|
|
45
73
|
onChangeText
|
|
46
|
-
} : props;
|
|
47
|
-
return /* @__PURE__ */
|
|
74
|
+
}) : props;
|
|
75
|
+
return /* @__PURE__ */ React.createElement(Component, _object_spread({
|
|
76
|
+
ref: combinedRef
|
|
77
|
+
}, finalProps));
|
|
48
78
|
});
|
|
49
79
|
}
|
|
50
80
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/focusableInputHOC.tsx"],
|
|
4
|
-
"mappings": "AAAA,
|
|
5
|
-
"names": ["value"]
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/focusable/src/focusableInputHOC.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAASA,mBAAmB;AAE5B,SAASC,gBAAgB;AACzB,OAAOC,SAASC,aAAaC,WAAWC,cAAc;AAEtD,SAASC,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAS3B,SAASC,aAAa,OAQ5B;MAPCC,UAD2B,MAC3BA,SACAC,QAF2B,MAE3BA,OACAC,MAH2B,MAG3BA,KAMQC,KAA0CF,MAA1CE,IAAIC,eAAsCH,MAAtCG,cAAcC,QAAwBJ,MAAxBI,OAAOC,eAAiBL,MAAjBK,cAC3BC,aAAaV,OAAOQ,SAASC,gBAAgB,EAAA,GAC7CE,sBAAsBX,OAAAA,GAEtBY,WAAWd,YACf,SAACe,OAAAA;QAGCF;AAFA,IAAKL,MACAO,WACLF,+BAAAA,oBAAoBG,aAAO,QAA3BH,iCAAAA,UAAAA,6BAAAA,KAAAA,mBAAAA,GACAA,oBAAoBG,UAAUb,kBAAkBK,IAAI,eAAA;MAClDS,OAAOF,MAAME;OAETZ,WAAW;;MAEba,gBAAAA,WAAAA;AACEH,cAAME,MAAK,GACPF,MAAMI,gBAAgB,OAAOP,WAAWI,WAAY,YACtDD,MAAMI,aAAa,GAAGP,WAAWI,QAAQI,MAAM;MAEnD;IACF,CAAA,CAAA;EAEJ,GACA;IAACf;IAASG;GAAG,GAGTa,eAAexB,YAAYU,KAAKO,QAAAA;AAEtCb,mBAAU,WAAA;AACR,WAAO,WAAA;UACLY;OAAAA,+BAAAA,oBAAoBG,aAAO,QAA3BH,iCAAAA,UAAAA,6BAAAA,KAAAA,mBAAAA;IACF;EACF,GAAG,CAAA,CAAE,GAEE;IACLN,KAAKc;IACLZ,cAAcX,SAAS,SAACY,QAAAA;AACtBE,iBAAWI,UAAUN,QACrBD,gBAAAA,QAAAA,aAAeC,MAAAA;IACjB,CAAA;EACF;AACF;AAEO,SAASY,kBAA8CC,WAAY;AACxE,SAAOA,UAAUC,UAAU,SAAClB,OAAuBC,KAAAA;QACjCgB,yBAAVlB,WAAUkB,0BAAAA,UAAUE,kBAAY,QAAtBF,4BAAAA,SAAAA,SAAAA,wBAAwBlB,SACGD,gBAAAA,aAAa;MACtDG;MACAD;MACAD;IACF,CAAA,GAJaqB,cAA8BtB,cAAnCG,KAAkBE,eAAiBL,cAAjBK,cAKpBkB,aAAatB,UACf,qBAAA,eAAA,CAAA,GACKC,KAAAA,GAAAA;MACHG;SAEFH;AAGJ,WAAO,sBAAA,cAACiB,WAAAA,eAAAA;MAAUhB,KAAKmB;OAAiBC,UAAAA,CAAAA;EAC1C,CAAA;AACF;",
|
|
5
|
+
"names": ["composeRefs", "useEvent", "React", "useCallback", "useEffect", "useRef", "registerFocusable", "useFocusable", "isInput", "props", "ref", "id", "onChangeText", "value", "defaultValue", "inputValue", "unregisterFocusable", "inputRef", "input", "current", "focus", "focusAndSelect", "setSelection", "length", "combinedRefs", "focusableInputHOC", "Component", "styleable", "staticConfig", "combinedRef", "finalProps"]
|
|
6
6
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
var InputsMap = /* @__PURE__ */ new Map(), registerFocusable = function(id, input) {
|
|
2
|
+
return process.env.NODE_ENV === "development" && InputsMap.has(id) && console.warn("Warning, duplicate ID for input: ".concat(id)), InputsMap.set(id, input), function() {
|
|
3
|
+
InputsMap.delete(id);
|
|
4
|
+
};
|
|
5
|
+
}, unregisterFocusable = function(id) {
|
|
2
6
|
InputsMap.delete(id);
|
|
3
|
-
}
|
|
4
|
-
InputsMap.
|
|
5
|
-
}, focusFocusable = (id, select = !1) => {
|
|
6
|
-
const input = InputsMap.get(id);
|
|
7
|
+
}, focusFocusable = function(id) {
|
|
8
|
+
var select = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, input = InputsMap.get(id);
|
|
7
9
|
if (!input) {
|
|
8
10
|
process.env.NODE_ENV === "development" && console.warn("No input found for id", id);
|
|
9
11
|
return;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/registerFocusable.native.ts"],
|
|
4
|
-
"mappings": "AAIA,
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/focusable/src/registerFocusable.native.ts"],
|
|
4
|
+
"mappings": "AAIA,IAAMA,YAAY,oBAAIC,IAAAA,GAETC,oBAAoB,SAACC,IAAYC,OAAAA;AAC5C,SAAIC,QAAQC,IAAIC,aAAa,iBACvBP,UAAUQ,IAAIL,EAAAA,KAChBM,QAAQC,KAAM,oCAAsC,OAAHP,EAAAA,CAAAA,GAGrDH,UAAUW,IAAIR,IAAIC,KAAAA,GACX,WAAA;AACLJ,cAAUY,OAAOT,EAAAA;EACnB;AACF,GAEaU,sBAAsB,SAACV,IAAAA;AAClCH,YAAUY,OAAOT,EAAAA;AACnB,GAEaW,iBAAiB,SAACX,IAAAA;MAAYY,SAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAAS,IAC5CX,QAAQJ,UAAUgB,IAAIb,EAAAA;AAC5B,MAAI,CAACC,OAAO;AACV,IAAIC,QAAQC,IAAIC,aAAa,iBAC3BE,QAAQC,KAAK,yBAAyBP,EAAAA;AAExC;EACF;AACA,EAAIY,UAAU,CAACX,MAAMa,iBACnBb,MAAMc,MAAK,IAEXd,MAAMa,eAAc;AAExB;",
|
|
5
|
+
"names": ["InputsMap", "Map", "registerFocusable", "id", "input", "process", "env", "NODE_ENV", "has", "console", "warn", "set", "delete", "unregisterFocusable", "focusFocusable", "select", "get", "focusAndSelect", "focus"]
|
|
6
6
|
}
|
|
@@ -1,50 +1,80 @@
|
|
|
1
1
|
import { composeRefs } from "@tamagui/compose-refs";
|
|
2
2
|
import { useEvent } from "@tamagui/web";
|
|
3
|
-
import { useCallback, useEffect, useRef } from "react";
|
|
3
|
+
import React, { useCallback, useEffect, useRef } from "react";
|
|
4
4
|
import { registerFocusable } from "./registerFocusable";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var
|
|
28
|
-
(
|
|
5
|
+
function _define_property(obj, key, value) {
|
|
6
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
7
|
+
value,
|
|
8
|
+
enumerable: !0,
|
|
9
|
+
configurable: !0,
|
|
10
|
+
writable: !0
|
|
11
|
+
}) : obj[key] = value, obj;
|
|
12
|
+
}
|
|
13
|
+
function _object_spread(target) {
|
|
14
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
15
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
16
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
17
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
18
|
+
}))), ownKeys2.forEach(function(key) {
|
|
19
|
+
_define_property(target, key, source[key]);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return target;
|
|
23
|
+
}
|
|
24
|
+
function ownKeys(object, enumerableOnly) {
|
|
25
|
+
var keys = Object.keys(object);
|
|
26
|
+
if (Object.getOwnPropertySymbols) {
|
|
27
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
28
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
29
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
30
|
+
})), keys.push.apply(keys, symbols);
|
|
31
|
+
}
|
|
32
|
+
return keys;
|
|
33
|
+
}
|
|
34
|
+
function _object_spread_props(target, source) {
|
|
35
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
36
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
37
|
+
}), target;
|
|
38
|
+
}
|
|
39
|
+
function useFocusable(param) {
|
|
40
|
+
var isInput = param.isInput, props = param.props, ref = param.ref, id = props.id, onChangeText = props.onChangeText, value = props.value, defaultValue = props.defaultValue, inputValue = useRef(value || defaultValue || ""), unregisterFocusable = useRef(), inputRef = useCallback(function(input) {
|
|
41
|
+
var _unregisterFocusable_current;
|
|
42
|
+
id && input && ((_unregisterFocusable_current = unregisterFocusable.current) === null || _unregisterFocusable_current === void 0 || _unregisterFocusable_current.call(unregisterFocusable), unregisterFocusable.current = registerFocusable(id, _object_spread({
|
|
43
|
+
focus: input.focus
|
|
44
|
+
}, isInput && {
|
|
45
|
+
// react-native doesn't support programmatic .select()
|
|
46
|
+
focusAndSelect: function() {
|
|
47
|
+
input.focus(), input.setSelection && typeof inputValue.current == "string" && input.setSelection(0, inputValue.current.length);
|
|
48
|
+
}
|
|
49
|
+
})));
|
|
50
|
+
}, [
|
|
51
|
+
isInput,
|
|
52
|
+
id
|
|
53
|
+
]), combinedRefs = composeRefs(ref, inputRef);
|
|
54
|
+
return useEffect(function() {
|
|
55
|
+
return function() {
|
|
56
|
+
var _unregisterFocusable_current;
|
|
57
|
+
(_unregisterFocusable_current = unregisterFocusable.current) === null || _unregisterFocusable_current === void 0 || _unregisterFocusable_current.call(unregisterFocusable);
|
|
58
|
+
};
|
|
29
59
|
}, []), {
|
|
30
60
|
ref: combinedRefs,
|
|
31
|
-
onChangeText: useEvent((value2)
|
|
61
|
+
onChangeText: useEvent(function(value2) {
|
|
32
62
|
inputValue.current = value2, onChangeText == null || onChangeText(value2);
|
|
33
63
|
})
|
|
34
64
|
};
|
|
35
65
|
}
|
|
36
66
|
function focusableInputHOC(Component) {
|
|
37
|
-
return Component.styleable((props, ref)
|
|
38
|
-
var
|
|
39
|
-
const isInput = (_a = Component.staticConfig) == null ? void 0 : _a.isInput, { ref: combinedRef, onChangeText } = useFocusable({
|
|
67
|
+
return Component.styleable(function(props, ref) {
|
|
68
|
+
var _Component_staticConfig, isInput = (_Component_staticConfig = Component.staticConfig) === null || _Component_staticConfig === void 0 ? void 0 : _Component_staticConfig.isInput, _useFocusable = useFocusable({
|
|
40
69
|
ref,
|
|
41
70
|
props,
|
|
42
71
|
isInput
|
|
43
|
-
}), finalProps = isInput ? {
|
|
44
|
-
...props,
|
|
72
|
+
}), combinedRef = _useFocusable.ref, onChangeText = _useFocusable.onChangeText, finalProps = isInput ? _object_spread_props(_object_spread({}, props), {
|
|
45
73
|
onChangeText
|
|
46
|
-
} : props;
|
|
47
|
-
return /* @__PURE__ */
|
|
74
|
+
}) : props;
|
|
75
|
+
return /* @__PURE__ */ React.createElement(Component, _object_spread({
|
|
76
|
+
ref: combinedRef
|
|
77
|
+
}, finalProps));
|
|
48
78
|
});
|
|
49
79
|
}
|
|
50
80
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/focusableInputHOC.tsx"],
|
|
4
|
-
"mappings": "AAAA,
|
|
5
|
-
"names": ["value"]
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/focusable/src/focusableInputHOC.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAASA,mBAAmB;AAE5B,SAASC,gBAAgB;AACzB,OAAOC,SAASC,aAAaC,WAAWC,cAAc;AAEtD,SAASC,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAS3B,SAASC,aAAa,OAQ5B;MAPCC,UAD2B,MAC3BA,SACAC,QAF2B,MAE3BA,OACAC,MAH2B,MAG3BA,KAMQC,KAA0CF,MAA1CE,IAAIC,eAAsCH,MAAtCG,cAAcC,QAAwBJ,MAAxBI,OAAOC,eAAiBL,MAAjBK,cAC3BC,aAAaV,OAAOQ,SAASC,gBAAgB,EAAA,GAC7CE,sBAAsBX,OAAAA,GAEtBY,WAAWd,YACf,SAACe,OAAAA;QAGCF;AAFA,IAAKL,MACAO,WACLF,+BAAAA,oBAAoBG,aAAO,QAA3BH,iCAAAA,UAAAA,6BAAAA,KAAAA,mBAAAA,GACAA,oBAAoBG,UAAUb,kBAAkBK,IAAI,eAAA;MAClDS,OAAOF,MAAME;OAETZ,WAAW;;MAEba,gBAAAA,WAAAA;AACEH,cAAME,MAAK,GACPF,MAAMI,gBAAgB,OAAOP,WAAWI,WAAY,YACtDD,MAAMI,aAAa,GAAGP,WAAWI,QAAQI,MAAM;MAEnD;IACF,CAAA,CAAA;EAEJ,GACA;IAACf;IAASG;GAAG,GAGTa,eAAexB,YAAYU,KAAKO,QAAAA;AAEtCb,mBAAU,WAAA;AACR,WAAO,WAAA;UACLY;OAAAA,+BAAAA,oBAAoBG,aAAO,QAA3BH,iCAAAA,UAAAA,6BAAAA,KAAAA,mBAAAA;IACF;EACF,GAAG,CAAA,CAAE,GAEE;IACLN,KAAKc;IACLZ,cAAcX,SAAS,SAACY,QAAAA;AACtBE,iBAAWI,UAAUN,QACrBD,gBAAAA,QAAAA,aAAeC,MAAAA;IACjB,CAAA;EACF;AACF;AAEO,SAASY,kBAA8CC,WAAY;AACxE,SAAOA,UAAUC,UAAU,SAAClB,OAAuBC,KAAAA;QACjCgB,yBAAVlB,WAAUkB,0BAAAA,UAAUE,kBAAY,QAAtBF,4BAAAA,SAAAA,SAAAA,wBAAwBlB,SACGD,gBAAAA,aAAa;MACtDG;MACAD;MACAD;IACF,CAAA,GAJaqB,cAA8BtB,cAAnCG,KAAkBE,eAAiBL,cAAjBK,cAKpBkB,aAAatB,UACf,qBAAA,eAAA,CAAA,GACKC,KAAAA,GAAAA;MACHG;SAEFH;AAGJ,WAAO,sBAAA,cAACiB,WAAAA,eAAAA;MAAUhB,KAAKmB;OAAiBC,UAAAA,CAAAA;EAC1C,CAAA;AACF;",
|
|
5
|
+
"names": ["composeRefs", "useEvent", "React", "useCallback", "useEffect", "useRef", "registerFocusable", "useFocusable", "isInput", "props", "ref", "id", "onChangeText", "value", "defaultValue", "inputValue", "unregisterFocusable", "inputRef", "input", "current", "focus", "focusAndSelect", "setSelection", "length", "combinedRefs", "focusableInputHOC", "Component", "styleable", "staticConfig", "combinedRef", "finalProps"]
|
|
6
6
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
var InputsMap = /* @__PURE__ */ new Map(), registerFocusable = function(id, input) {
|
|
2
|
+
return process.env.NODE_ENV === "development" && InputsMap.has(id) && console.warn("Warning, duplicate ID for input: ".concat(id)), InputsMap.set(id, input), function() {
|
|
3
|
+
InputsMap.delete(id);
|
|
4
|
+
};
|
|
5
|
+
}, unregisterFocusable = function(id) {
|
|
2
6
|
InputsMap.delete(id);
|
|
3
|
-
}
|
|
4
|
-
InputsMap.
|
|
5
|
-
}, focusFocusable = (id, select = !1) => {
|
|
6
|
-
const input = InputsMap.get(id);
|
|
7
|
+
}, focusFocusable = function(id) {
|
|
8
|
+
var select = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, input = InputsMap.get(id);
|
|
7
9
|
if (!input) {
|
|
8
10
|
process.env.NODE_ENV === "development" && console.warn("No input found for id", id);
|
|
9
11
|
return;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/registerFocusable.native.ts"],
|
|
4
|
-
"mappings": "AAIA,
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/focusable/src/registerFocusable.native.ts"],
|
|
4
|
+
"mappings": "AAIA,IAAMA,YAAY,oBAAIC,IAAAA,GAETC,oBAAoB,SAACC,IAAYC,OAAAA;AAC5C,SAAIC,QAAQC,IAAIC,aAAa,iBACvBP,UAAUQ,IAAIL,EAAAA,KAChBM,QAAQC,KAAM,oCAAsC,OAAHP,EAAAA,CAAAA,GAGrDH,UAAUW,IAAIR,IAAIC,KAAAA,GACX,WAAA;AACLJ,cAAUY,OAAOT,EAAAA;EACnB;AACF,GAEaU,sBAAsB,SAACV,IAAAA;AAClCH,YAAUY,OAAOT,EAAAA;AACnB,GAEaW,iBAAiB,SAACX,IAAAA;MAAYY,SAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAAS,IAC5CX,QAAQJ,UAAUgB,IAAIb,EAAAA;AAC5B,MAAI,CAACC,OAAO;AACV,IAAIC,QAAQC,IAAIC,aAAa,iBAC3BE,QAAQC,KAAK,yBAAyBP,EAAAA;AAExC;EACF;AACA,EAAIY,UAAU,CAACX,MAAMa,iBACnBb,MAAMc,MAAK,IAEXd,MAAMa,eAAc;AAExB;",
|
|
5
|
+
"names": ["InputsMap", "Map", "registerFocusable", "id", "input", "process", "env", "NODE_ENV", "has", "console", "warn", "set", "delete", "unregisterFocusable", "focusFocusable", "select", "get", "focusAndSelect", "focus"]
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/focusable",
|
|
3
|
-
"version": "1.89.
|
|
3
|
+
"version": "1.89.27-1708113113238",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"clean:build": "tamagui-build clean:build"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@tamagui/compose-refs": "1.89.
|
|
26
|
-
"@tamagui/web": "1.89.
|
|
25
|
+
"@tamagui/compose-refs": "1.89.27-1708113113238",
|
|
26
|
+
"@tamagui/web": "1.89.27-1708113113238"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react": "*"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@tamagui/build": "1.89.
|
|
32
|
+
"@tamagui/build": "1.89.27-1708113113238",
|
|
33
33
|
"react": "^18.2.0"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|