@tamagui/focusable 1.113.1 → 1.114.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/focusable.native.js +1 -2
- package/dist/esm/focusable.native.js.map +6 -1
- package/dist/esm/focusableInputHOC.native.js +23 -32
- package/dist/esm/focusableInputHOC.native.js.map +6 -1
- package/dist/esm/index.native.js +4 -4
- package/dist/esm/index.native.js.map +6 -1
- package/dist/esm/registerFocusable.native.js +17 -17
- package/dist/esm/registerFocusable.native.js.map +6 -1
- package/package.json +4 -4
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=focusable.native.js.map
|
|
1
|
+
//# sourceMappingURL=focusable.js.map
|
|
@@ -1,45 +1,36 @@
|
|
|
1
1
|
import { composeRefs } from "@tamagui/compose-refs";
|
|
2
2
|
import { useEvent } from "@tamagui/web";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { registerFocusable } from "./registerFocusable
|
|
4
|
+
import { registerFocusable } from "./registerFocusable";
|
|
5
5
|
function useFocusable(param) {
|
|
6
|
-
var {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
...(isInput && {
|
|
24
|
-
// react-native doesn't support programmatic .select()
|
|
25
|
-
focusAndSelect() {
|
|
26
|
-
input.focus(), input.setSelection && typeof inputValue.current == "string" && input.setSelection(0, inputValue.current.length);
|
|
27
|
-
}
|
|
28
|
-
})
|
|
29
|
-
}));
|
|
30
|
-
}, [isInput, id]),
|
|
31
|
-
combinedRefs = composeRefs(ref, inputRef);
|
|
32
|
-
return React.useEffect(function () {
|
|
33
|
-
return function () {
|
|
6
|
+
var { isInput, props, ref } = param, { id, onChangeText, value, defaultValue } = props, inputValue = React.useRef(value || defaultValue || ""), unregisterFocusable = React.useRef(), inputRef = React.useCallback(function(input) {
|
|
7
|
+
var _unregisterFocusable_current;
|
|
8
|
+
id && input && ((_unregisterFocusable_current = unregisterFocusable.current) === null || _unregisterFocusable_current === void 0 || _unregisterFocusable_current.call(unregisterFocusable), unregisterFocusable.current = registerFocusable(id, {
|
|
9
|
+
focus: input.focus,
|
|
10
|
+
...isInput && {
|
|
11
|
+
// react-native doesn't support programmatic .select()
|
|
12
|
+
focusAndSelect() {
|
|
13
|
+
input.focus(), input.setSelection && typeof inputValue.current == "string" && input.setSelection(0, inputValue.current.length);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}));
|
|
17
|
+
}, [
|
|
18
|
+
isInput,
|
|
19
|
+
id
|
|
20
|
+
]), combinedRefs = composeRefs(ref, inputRef);
|
|
21
|
+
return React.useEffect(function() {
|
|
22
|
+
return function() {
|
|
34
23
|
var _unregisterFocusable_current;
|
|
35
24
|
(_unregisterFocusable_current = unregisterFocusable.current) === null || _unregisterFocusable_current === void 0 || _unregisterFocusable_current.call(unregisterFocusable);
|
|
36
25
|
};
|
|
37
26
|
}, []), {
|
|
38
27
|
ref: combinedRefs,
|
|
39
|
-
onChangeText: useEvent(function
|
|
28
|
+
onChangeText: useEvent(function(value2) {
|
|
40
29
|
inputValue.current = value2, onChangeText?.(value2);
|
|
41
30
|
})
|
|
42
31
|
};
|
|
43
32
|
}
|
|
44
|
-
export {
|
|
45
|
-
|
|
33
|
+
export {
|
|
34
|
+
useFocusable
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=focusableInputHOC.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/ui/focusable/src/focusableInputHOC.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAASA,mBAAmB;AAC5B,SAASC,gBAAgB;AAEzB,OAAOC,WAAW;AAElB,SAASC,yBAAyB;AAS3B,SAASC,aAAa,OAI+C;MAJ/C,EAC3BC,SACAC,OACAC,IAAG,IAHwB,OAKrB,EAAEC,IAAIC,cAAcC,OAAOC,aAAY,IAAKL,OAC5CM,aAAaV,MAAMW,OAAOH,SAASC,gBAAgB,EAAA,GACnDG,sBAAsBZ,MAAMW,OAAM,GAElCE,WAAWb,MAAMc,YACrB,SAACC,OAAAA;QAGCH;AAFA,IAAKN,MACAS,WACLH,+BAAAA,oBAAoBI,aAAO,QAA3BJ,iCAAAA,UAAAA,6BAAAA,KAAAA,mBAAAA,GACAA,oBAAoBI,UAAUf,kBAAkBK,IAAI;MAClDW,OAAOF,MAAME;MAEb,GAAId,WAAW;;QAEbe,iBAAAA;AACEH,gBAAME,MAAK,GACPF,MAAMI,gBAAgB,OAAOT,WAAWM,WAAY,YACtDD,MAAMI,aAAa,GAAGT,WAAWM,QAAQI,MAAM;QAEnD;MACF;IACF,CAAA;EACF,GACA;IAACjB;IAASG;GAAG,GAGTe,eAAevB,YAAYO,KAAKQ,QAAAA;AAEtCb,eAAMsB,UAAU,WAAA;AACd,WAAO,WAAA;UACLV;OAAAA,+BAAAA,oBAAoBI,aAAO,QAA3BJ,iCAAAA,UAAAA,6BAAAA,KAAAA,mBAAAA;IACF;EACF,GAAG,CAAA,CAAE,GAEE;IACLP,KAAKgB;IACLd,cAAcR,SAAS,SAACS,QAAAA;AACtBE,iBAAWM,UAAUR,QACrBD,eAAeC,MAAAA;IACjB,CAAA;EACF;AACF;",
|
|
5
|
+
"names": ["composeRefs", "useEvent", "React", "registerFocusable", "useFocusable", "isInput", "props", "ref", "id", "onChangeText", "value", "defaultValue", "inputValue", "useRef", "unregisterFocusable", "inputRef", "useCallback", "input", "current", "focus", "focusAndSelect", "setSelection", "length", "combinedRefs", "useEffect"]
|
|
6
|
+
}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./registerFocusable
|
|
2
|
-
export * from "./focusableInputHOC
|
|
3
|
-
export * from "./focusable
|
|
4
|
-
//# sourceMappingURL=index.
|
|
1
|
+
export * from "./registerFocusable";
|
|
2
|
+
export * from "./focusableInputHOC";
|
|
3
|
+
export * from "./focusable";
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/ui/focusable/src/index.ts"],
|
|
4
|
+
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var InputsMap = /* @__PURE__ */new Map(),
|
|
2
|
-
|
|
3
|
-
return process.env.NODE_ENV === "development" && InputsMap.has(id) && console.warn(`Warning, duplicate ID for input: ${id}`), InputsMap.set(id, input), function () {
|
|
4
|
-
InputsMap.delete(id);
|
|
5
|
-
};
|
|
6
|
-
},
|
|
7
|
-
unregisterFocusable = function (id) {
|
|
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: ${id}`), InputsMap.set(id, input), function() {
|
|
8
3
|
InputsMap.delete(id);
|
|
9
|
-
},
|
|
10
|
-
focusFocusable = function (id) {
|
|
11
|
-
var select = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1,
|
|
12
|
-
input = InputsMap.get(id);
|
|
13
|
-
if (!input) {
|
|
14
|
-
process.env.NODE_ENV === "development" && console.warn("No input found for id", id);
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
select || !input.focusAndSelect ? input.focus() : input.focusAndSelect();
|
|
18
4
|
};
|
|
19
|
-
|
|
5
|
+
}, unregisterFocusable = function(id) {
|
|
6
|
+
InputsMap.delete(id);
|
|
7
|
+
}, focusFocusable = function(id) {
|
|
8
|
+
var select = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, input = InputsMap.get(id);
|
|
9
|
+
if (!input) {
|
|
10
|
+
process.env.NODE_ENV === "development" && console.warn("No input found for id", id);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
select || !input.focusAndSelect ? input.focus() : input.focusAndSelect();
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
focusFocusable,
|
|
17
|
+
registerFocusable,
|
|
18
|
+
unregisterFocusable
|
|
19
|
+
};
|
|
20
20
|
//# sourceMappingURL=registerFocusable.native.js.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/ui/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,KAAK,oCAAoCP,EAAAA,EAAI,GAGzDH,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
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/focusable",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.114.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@tamagui/compose-refs": "1.
|
|
36
|
-
"@tamagui/web": "1.
|
|
35
|
+
"@tamagui/compose-refs": "1.114.0",
|
|
36
|
+
"@tamagui/web": "1.114.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@tamagui/build": "1.
|
|
39
|
+
"@tamagui/build": "1.114.0",
|
|
40
40
|
"react": "^18.2.0 || ^19.0.0"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|