@tamagui/focusable 1.88.1 → 1.88.2
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/focusableInputHOC.js +4 -12
- package/dist/cjs/focusableInputHOC.js.map +1 -1
- package/dist/cjs/index.js +0 -6
- package/dist/cjs/registerFocusable.js +0 -6
- package/dist/esm/focusable.native.js +14 -0
- package/dist/esm/focusable.native.js.map +2 -2
- package/dist/esm/focusableInputHOC.native.js +37 -16
- package/dist/esm/focusableInputHOC.native.js.map +1 -1
- package/dist/esm/index.native.js +23 -3
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/registerFocusable.native.js +25 -2
- package/dist/esm/registerFocusable.native.js.map +1 -1
- package/dist/jsx/focusable.native.js +14 -0
- package/dist/jsx/focusable.native.js.map +2 -2
- package/dist/jsx/focusableInputHOC.js +2 -1
- package/dist/jsx/focusableInputHOC.js.map +1 -1
- package/dist/jsx/focusableInputHOC.native.js +31 -12
- package/dist/jsx/focusableInputHOC.native.js.map +1 -1
- package/dist/jsx/index.native.js +23 -3
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/registerFocusable.native.js +25 -2
- package/dist/jsx/registerFocusable.native.js.map +1 -1
- package/package.json +4 -4
|
@@ -26,8 +26,7 @@ function useFocusable({
|
|
|
26
26
|
}) {
|
|
27
27
|
const { id, onChangeText, value, defaultValue } = props, inputValue = (0, import_react.useRef)(value || defaultValue || ""), unregisterFocusable = (0, import_react.useRef)(), inputRef = (0, import_react.useCallback)(
|
|
28
28
|
(input) => {
|
|
29
|
-
|
|
30
|
-
id && input && ((_a = unregisterFocusable.current) == null || _a.call(unregisterFocusable), unregisterFocusable.current = (0, import_registerFocusable.registerFocusable)(id, {
|
|
29
|
+
id && input && (unregisterFocusable.current?.(), unregisterFocusable.current = (0, import_registerFocusable.registerFocusable)(id, {
|
|
31
30
|
focus: input.focus,
|
|
32
31
|
...isInput && {
|
|
33
32
|
// react-native doesn't support programmatic .select()
|
|
@@ -40,19 +39,17 @@ function useFocusable({
|
|
|
40
39
|
[isInput, id]
|
|
41
40
|
), combinedRefs = (0, import_compose_refs.composeRefs)(ref, inputRef);
|
|
42
41
|
return (0, import_react.useEffect)(() => () => {
|
|
43
|
-
|
|
44
|
-
(_a = unregisterFocusable.current) == null || _a.call(unregisterFocusable);
|
|
42
|
+
unregisterFocusable.current?.();
|
|
45
43
|
}, []), {
|
|
46
44
|
ref: combinedRefs,
|
|
47
45
|
onChangeText: (0, import_web.useEvent)((value2) => {
|
|
48
|
-
inputValue.current = value2, onChangeText
|
|
46
|
+
inputValue.current = value2, onChangeText?.(value2);
|
|
49
47
|
})
|
|
50
48
|
};
|
|
51
49
|
}
|
|
52
50
|
function focusableInputHOC(Component) {
|
|
53
51
|
return Component.styleable((props, ref) => {
|
|
54
|
-
|
|
55
|
-
const isInput = (_a = Component.staticConfig) == null ? void 0 : _a.isInput, { ref: combinedRef, onChangeText } = useFocusable({
|
|
52
|
+
const isInput = Component.staticConfig?.isInput, { ref: combinedRef, onChangeText } = useFocusable({
|
|
56
53
|
ref,
|
|
57
54
|
props,
|
|
58
55
|
isInput
|
|
@@ -63,9 +60,4 @@ function focusableInputHOC(Component) {
|
|
|
63
60
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ref: combinedRef, ...finalProps });
|
|
64
61
|
});
|
|
65
62
|
}
|
|
66
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
-
0 && (module.exports = {
|
|
68
|
-
focusableInputHOC,
|
|
69
|
-
useFocusable
|
|
70
|
-
});
|
|
71
63
|
//# sourceMappingURL=focusableInputHOC.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/focusableInputHOC.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA4B,kCAC5B,aAA2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,UAAU,UAAU,CAAC,OAAuB,QAAQ;AACzD,UAAM,UAAU,UAAU,cAAc,SAClC,EAAE,KAAK,aAAa,aAAa,IAAI,aAAa;AAAA,MACtD;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC,GACK,aAAa,UACf;AAAA,MACE,GAAG;AAAA,MACH;AAAA,IACF,IACA;AAGJ,WAAO,4CAAC,aAAU,KAAK,aAAc,GAAG,YAAY;AAAA,EACtD,CAAC;AACH;",
|
|
5
5
|
"names": ["value"]
|
|
6
6
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -14,10 +14,4 @@ module.exports = __toCommonJS(src_exports);
|
|
|
14
14
|
__reExport(src_exports, require("./registerFocusable"), module.exports);
|
|
15
15
|
__reExport(src_exports, require("./focusableInputHOC"), module.exports);
|
|
16
16
|
__reExport(src_exports, require("./focusable"), module.exports);
|
|
17
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
18
|
-
0 && (module.exports = {
|
|
19
|
-
...require("./registerFocusable"),
|
|
20
|
-
...require("./focusableInputHOC"),
|
|
21
|
-
...require("./focusable")
|
|
22
|
-
});
|
|
23
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -23,10 +23,4 @@ const registerFocusable = (id, input) => () => {
|
|
|
23
23
|
}, unregisterFocusable = (id) => {
|
|
24
24
|
}, focusFocusable = (id) => {
|
|
25
25
|
};
|
|
26
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
-
0 && (module.exports = {
|
|
28
|
-
focusFocusable,
|
|
29
|
-
registerFocusable,
|
|
30
|
-
unregisterFocusable
|
|
31
|
-
});
|
|
32
26
|
//# sourceMappingURL=registerFocusable.js.map
|
|
@@ -1 +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 focusable_exports = {};
|
|
14
|
+
module.exports = __toCommonJS(focusable_exports);
|
|
1
15
|
//# sourceMappingURL=focusable.js.map
|
|
@@ -1,16 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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 focusableInputHOC_exports = {};
|
|
17
|
+
__export(focusableInputHOC_exports, {
|
|
18
|
+
focusableInputHOC: () => focusableInputHOC,
|
|
19
|
+
useFocusable: () => useFocusable
|
|
20
|
+
});
|
|
21
|
+
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"), import_jsx_runtime = require("react/jsx-runtime");
|
|
6
23
|
function useFocusable({
|
|
7
24
|
isInput,
|
|
8
25
|
props,
|
|
9
26
|
ref
|
|
10
27
|
}) {
|
|
11
|
-
const { id, onChangeText, value, defaultValue } = props, inputValue = useRef(value || defaultValue || ""), unregisterFocusable = useRef(), inputRef = useCallback(
|
|
28
|
+
const { id, onChangeText, value, defaultValue } = props, inputValue = (0, import_react.useRef)(value || defaultValue || ""), unregisterFocusable = (0, import_react.useRef)(), inputRef = (0, import_react.useCallback)(
|
|
12
29
|
(input) => {
|
|
13
|
-
|
|
30
|
+
var _a;
|
|
31
|
+
id && input && ((_a = unregisterFocusable.current) == null || _a.call(unregisterFocusable), unregisterFocusable.current = (0, import_registerFocusable.registerFocusable)(id, {
|
|
14
32
|
focus: input.focus,
|
|
15
33
|
...isInput && {
|
|
16
34
|
// react-native doesn't support programmatic .select()
|
|
@@ -21,19 +39,21 @@ function useFocusable({
|
|
|
21
39
|
}));
|
|
22
40
|
},
|
|
23
41
|
[isInput, id]
|
|
24
|
-
), combinedRefs = composeRefs(ref, inputRef);
|
|
25
|
-
return useEffect(() => () => {
|
|
26
|
-
|
|
42
|
+
), combinedRefs = (0, import_compose_refs.composeRefs)(ref, inputRef);
|
|
43
|
+
return (0, import_react.useEffect)(() => () => {
|
|
44
|
+
var _a;
|
|
45
|
+
(_a = unregisterFocusable.current) == null || _a.call(unregisterFocusable);
|
|
27
46
|
}, []), {
|
|
28
47
|
ref: combinedRefs,
|
|
29
|
-
onChangeText: useEvent((value2) => {
|
|
30
|
-
inputValue.current = value2, onChangeText
|
|
48
|
+
onChangeText: (0, import_web.useEvent)((value2) => {
|
|
49
|
+
inputValue.current = value2, onChangeText == null || onChangeText(value2);
|
|
31
50
|
})
|
|
32
51
|
};
|
|
33
52
|
}
|
|
34
53
|
function focusableInputHOC(Component) {
|
|
35
54
|
return Component.styleable((props, ref) => {
|
|
36
|
-
|
|
55
|
+
var _a;
|
|
56
|
+
const isInput = (_a = Component.staticConfig) == null ? void 0 : _a.isInput, { ref: combinedRef, onChangeText } = useFocusable({
|
|
37
57
|
ref,
|
|
38
58
|
props,
|
|
39
59
|
isInput
|
|
@@ -41,11 +61,12 @@ function focusableInputHOC(Component) {
|
|
|
41
61
|
...props,
|
|
42
62
|
onChangeText
|
|
43
63
|
} : props;
|
|
44
|
-
return /* @__PURE__ */ jsx(Component, { ref: combinedRef, ...finalProps });
|
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ref: combinedRef, ...finalProps });
|
|
45
65
|
});
|
|
46
66
|
}
|
|
47
|
-
export
|
|
67
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
+
0 && (module.exports = {
|
|
48
69
|
focusableInputHOC,
|
|
49
70
|
useFocusable
|
|
50
|
-
};
|
|
71
|
+
});
|
|
51
72
|
//# sourceMappingURL=focusableInputHOC.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/focusableInputHOC.tsx"],
|
|
4
|
-
"mappings": "AAAA
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA4B,kCAC5B,aAA2C,yBAC3C,eAAsD,kBAEtD,2BAAkC,gCA6EvB;AApEJ,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AACF,GAIG;AACD,QAAM,EAAE,IAAI,cAAc,OAAO,aAAa,IAAI,OAC5C,iBAAa,qBAAO,SAAS,gBAAgB,EAAE,GAC/C,0BAAsB,qBAA+B,GAErD,eAAW;AAAA,IACf,CAAC,UAAU;AA3Bf;AA4BM,MAAK,MACA,WACL,yBAAoB,YAApB,sCACA,oBAAoB,cAAU,4CAAkB,IAAI;AAAA,QAClD,OAAO,MAAM;AAAA,QAEb,GAAI,WAAW;AAAA;AAAA,UAEb,iBAAiB;AACf,kBAAM,MAAM,GACR,MAAM,gBAAgB,OAAO,WAAW,WAAY,YACtD,MAAM,aAAa,GAAG,WAAW,QAAQ,MAAM;AAAA,UAEnD;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA,CAAC,SAAS,EAAE;AAAA,EACd,GAEM,mBAAe,iCAAY,KAAK,QAAQ;AAE9C,qCAAU,MACD,MAAM;AAnDjB;AAoDM,8BAAoB,YAApB;AAAA,EACF,GACC,CAAC,CAAC,GAEE;AAAA,IACL,KAAK;AAAA,IACL,kBAAc,qBAAS,CAACA,WAAU;AAChC,iBAAW,UAAUA,QACrB,qCAAeA;AAAA,IACjB,CAAC;AAAA,EACH;AACF;AAEO,SAAS,kBAA8C,WAAiB;AAC7E,SAAO,UAAU,UAAU,CAAC,OAAuB,QAAQ;AAlE7D;AAmEI,UAAM,WAAU,eAAU,iBAAV,mBAAwB,SAClC,EAAE,KAAK,aAAa,aAAa,IAAI,aAAa;AAAA,MACtD;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC,GACK,aAAa,UACf;AAAA,MACE,GAAG;AAAA,MACH;AAAA,IACF,IACA;AAGJ,WAAO,4CAAC,aAAU,KAAK,aAAc,GAAG,YAAY;AAAA,EACtD,CAAC;AACH;",
|
|
5
5
|
"names": ["value"]
|
|
6
6
|
}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
+
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
12
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
13
|
+
var src_exports = {};
|
|
14
|
+
module.exports = __toCommonJS(src_exports);
|
|
15
|
+
__reExport(src_exports, require("./registerFocusable"), module.exports);
|
|
16
|
+
__reExport(src_exports, require("./focusableInputHOC"), module.exports);
|
|
17
|
+
__reExport(src_exports, require("./focusable"), module.exports);
|
|
18
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
19
|
+
0 && (module.exports = {
|
|
20
|
+
...require("./registerFocusable"),
|
|
21
|
+
...require("./focusableInputHOC"),
|
|
22
|
+
...require("./focusable")
|
|
23
|
+
});
|
|
4
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,25 @@
|
|
|
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 registerFocusable_native_exports = {};
|
|
17
|
+
__export(registerFocusable_native_exports, {
|
|
18
|
+
focusFocusable: () => focusFocusable,
|
|
19
|
+
registerFocusable: () => registerFocusable,
|
|
20
|
+
unregisterFocusable: () => unregisterFocusable
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(registerFocusable_native_exports);
|
|
1
23
|
const InputsMap = /* @__PURE__ */ new Map(), registerFocusable = (id, input) => (process.env.NODE_ENV === "development" && InputsMap.has(id) && console.warn(`Warning, duplicate ID for input: ${id}`), InputsMap.set(id, input), () => {
|
|
2
24
|
InputsMap.delete(id);
|
|
3
25
|
}), unregisterFocusable = (id) => {
|
|
@@ -10,9 +32,10 @@ const InputsMap = /* @__PURE__ */ new Map(), registerFocusable = (id, input) =>
|
|
|
10
32
|
}
|
|
11
33
|
select || !input.focusAndSelect ? input.focus() : input.focusAndSelect();
|
|
12
34
|
};
|
|
13
|
-
export
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
14
37
|
focusFocusable,
|
|
15
38
|
registerFocusable,
|
|
16
39
|
unregisterFocusable
|
|
17
|
-
};
|
|
40
|
+
});
|
|
18
41
|
//# sourceMappingURL=registerFocusable.native.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/registerFocusable.native.ts"],
|
|
4
|
-
"mappings": "AAIA,MAAM,YAAY,oBAAI,IAAuB,GAEhC,oBAAoB,CAAC,IAAY,WACxC,QAAQ,IAAI,aAAa,iBACvB,UAAU,IAAI,EAAE,KAClB,QAAQ,KAAK,oCAAoC,EAAE,EAAE,GAGzD,UAAU,IAAI,IAAI,KAAK,GAChB,MAAM;AACX,YAAU,OAAO,EAAE;AACrB,IAGW,sBAAsB,CAAC,OAAe;AACjD,YAAU,OAAO,EAAE;AACrB,GAEa,iBAAiB,CAAC,IAAY,SAAS,OAAU;AAC5D,QAAM,QAAQ,UAAU,IAAI,EAAE;AAC9B,MAAI,CAAC,OAAO;AACV,IAAI,QAAQ,IAAI,aAAa,iBAC3B,QAAQ,KAAK,yBAAyB,EAAE;AAE1C;AAAA,EACF;AACA,EAAI,UAAU,CAAC,MAAM,iBACnB,MAAM,MAAM,IAEZ,MAAM,eAAe;AAEzB;",
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,MAAM,YAAY,oBAAI,IAAuB,GAEhC,oBAAoB,CAAC,IAAY,WACxC,QAAQ,IAAI,aAAa,iBACvB,UAAU,IAAI,EAAE,KAClB,QAAQ,KAAK,oCAAoC,EAAE,EAAE,GAGzD,UAAU,IAAI,IAAI,KAAK,GAChB,MAAM;AACX,YAAU,OAAO,EAAE;AACrB,IAGW,sBAAsB,CAAC,OAAe;AACjD,YAAU,OAAO,EAAE;AACrB,GAEa,iBAAiB,CAAC,IAAY,SAAS,OAAU;AAC5D,QAAM,QAAQ,UAAU,IAAI,EAAE;AAC9B,MAAI,CAAC,OAAO;AACV,IAAI,QAAQ,IAAI,aAAa,iBAC3B,QAAQ,KAAK,yBAAyB,EAAE;AAE1C;AAAA,EACF;AACA,EAAI,UAAU,CAAC,MAAM,iBACnB,MAAM,MAAM,IAEZ,MAAM,eAAe;AAEzB;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1 +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 focusable_exports = {};
|
|
14
|
+
module.exports = __toCommonJS(focusable_exports);
|
|
1
15
|
//# sourceMappingURL=focusable.js.map
|
|
@@ -2,6 +2,7 @@ import { composeRefs } from "@tamagui/compose-refs";
|
|
|
2
2
|
import { useEvent } from "@tamagui/web";
|
|
3
3
|
import { useCallback, useEffect, useRef } from "react";
|
|
4
4
|
import { registerFocusable } from "./registerFocusable";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
function useFocusable({
|
|
6
7
|
isInput,
|
|
7
8
|
props,
|
|
@@ -40,7 +41,7 @@ function focusableInputHOC(Component) {
|
|
|
40
41
|
...props,
|
|
41
42
|
onChangeText
|
|
42
43
|
} : props;
|
|
43
|
-
return
|
|
44
|
+
return /* @__PURE__ */ jsx(Component, { ref: combinedRef, ...finalProps });
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
47
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/focusableInputHOC.tsx"],
|
|
4
|
-
"mappings": "AAAA,SAAS,mBAAmB;AAC5B,SAA2B,gBAAgB;AAC3C,SAAgB,aAAa,WAAW,cAAc;AAEtD,SAAS,yBAAyB;
|
|
4
|
+
"mappings": "AAAA,SAAS,mBAAmB;AAC5B,SAA2B,gBAAgB;AAC3C,SAAgB,aAAa,WAAW,cAAc;AAEtD,SAAS,yBAAyB;AA6EvB;AApEJ,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AA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
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 focusableInputHOC_exports = {};
|
|
17
|
+
__export(focusableInputHOC_exports, {
|
|
18
|
+
focusableInputHOC: () => focusableInputHOC,
|
|
19
|
+
useFocusable: () => useFocusable
|
|
20
|
+
});
|
|
21
|
+
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"), import_jsx_runtime = require("react/jsx-runtime");
|
|
5
23
|
function useFocusable({
|
|
6
24
|
isInput,
|
|
7
25
|
props,
|
|
8
26
|
ref
|
|
9
27
|
}) {
|
|
10
|
-
const { id, onChangeText, value, defaultValue } = props, inputValue = useRef(value || defaultValue || ""), unregisterFocusable = useRef(), inputRef = useCallback(
|
|
28
|
+
const { id, onChangeText, value, defaultValue } = props, inputValue = (0, import_react.useRef)(value || defaultValue || ""), unregisterFocusable = (0, import_react.useRef)(), inputRef = (0, import_react.useCallback)(
|
|
11
29
|
(input) => {
|
|
12
30
|
var _a;
|
|
13
|
-
id && input && ((_a = unregisterFocusable.current) == null || _a.call(unregisterFocusable), unregisterFocusable.current = registerFocusable(id, {
|
|
31
|
+
id && input && ((_a = unregisterFocusable.current) == null || _a.call(unregisterFocusable), unregisterFocusable.current = (0, import_registerFocusable.registerFocusable)(id, {
|
|
14
32
|
focus: input.focus,
|
|
15
33
|
...isInput && {
|
|
16
34
|
// react-native doesn't support programmatic .select()
|
|
@@ -21,13 +39,13 @@ function useFocusable({
|
|
|
21
39
|
}));
|
|
22
40
|
},
|
|
23
41
|
[isInput, id]
|
|
24
|
-
), combinedRefs = composeRefs(ref, inputRef);
|
|
25
|
-
return useEffect(() => () => {
|
|
42
|
+
), combinedRefs = (0, import_compose_refs.composeRefs)(ref, inputRef);
|
|
43
|
+
return (0, import_react.useEffect)(() => () => {
|
|
26
44
|
var _a;
|
|
27
45
|
(_a = unregisterFocusable.current) == null || _a.call(unregisterFocusable);
|
|
28
46
|
}, []), {
|
|
29
47
|
ref: combinedRefs,
|
|
30
|
-
onChangeText: useEvent((value2) => {
|
|
48
|
+
onChangeText: (0, import_web.useEvent)((value2) => {
|
|
31
49
|
inputValue.current = value2, onChangeText == null || onChangeText(value2);
|
|
32
50
|
})
|
|
33
51
|
};
|
|
@@ -43,11 +61,12 @@ function focusableInputHOC(Component) {
|
|
|
43
61
|
...props,
|
|
44
62
|
onChangeText
|
|
45
63
|
} : props;
|
|
46
|
-
return
|
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ref: combinedRef, ...finalProps });
|
|
47
65
|
});
|
|
48
66
|
}
|
|
49
|
-
export
|
|
67
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
+
0 && (module.exports = {
|
|
50
69
|
focusableInputHOC,
|
|
51
70
|
useFocusable
|
|
52
|
-
};
|
|
71
|
+
});
|
|
53
72
|
//# sourceMappingURL=focusableInputHOC.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/focusableInputHOC.tsx"],
|
|
4
|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ACF,IACA;AAGJ,WAAO,4CAAC,aAAU,KAAK,aAAc,GAAG,YAAY;AAAA,EACtD,CAAC;AACH;",
|
|
5
5
|
"names": ["value"]
|
|
6
6
|
}
|
package/dist/jsx/index.native.js
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
+
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
12
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
13
|
+
var src_exports = {};
|
|
14
|
+
module.exports = __toCommonJS(src_exports);
|
|
15
|
+
__reExport(src_exports, require("./registerFocusable"), module.exports);
|
|
16
|
+
__reExport(src_exports, require("./focusableInputHOC"), module.exports);
|
|
17
|
+
__reExport(src_exports, require("./focusable"), module.exports);
|
|
18
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
19
|
+
0 && (module.exports = {
|
|
20
|
+
...require("./registerFocusable"),
|
|
21
|
+
...require("./focusableInputHOC"),
|
|
22
|
+
...require("./focusable")
|
|
23
|
+
});
|
|
4
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,25 @@
|
|
|
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 registerFocusable_native_exports = {};
|
|
17
|
+
__export(registerFocusable_native_exports, {
|
|
18
|
+
focusFocusable: () => focusFocusable,
|
|
19
|
+
registerFocusable: () => registerFocusable,
|
|
20
|
+
unregisterFocusable: () => unregisterFocusable
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(registerFocusable_native_exports);
|
|
1
23
|
const InputsMap = /* @__PURE__ */ new Map(), registerFocusable = (id, input) => (process.env.NODE_ENV === "development" && InputsMap.has(id) && console.warn(`Warning, duplicate ID for input: ${id}`), InputsMap.set(id, input), () => {
|
|
2
24
|
InputsMap.delete(id);
|
|
3
25
|
}), unregisterFocusable = (id) => {
|
|
@@ -10,9 +32,10 @@ const InputsMap = /* @__PURE__ */ new Map(), registerFocusable = (id, input) =>
|
|
|
10
32
|
}
|
|
11
33
|
select || !input.focusAndSelect ? input.focus() : input.focusAndSelect();
|
|
12
34
|
};
|
|
13
|
-
export
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
14
37
|
focusFocusable,
|
|
15
38
|
registerFocusable,
|
|
16
39
|
unregisterFocusable
|
|
17
|
-
};
|
|
40
|
+
});
|
|
18
41
|
//# sourceMappingURL=registerFocusable.native.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/registerFocusable.native.ts"],
|
|
4
|
-
"mappings": "AAIA,MAAM,YAAY,oBAAI,IAAuB,GAEhC,oBAAoB,CAAC,IAAY,WACxC,QAAQ,IAAI,aAAa,iBACvB,UAAU,IAAI,EAAE,KAClB,QAAQ,KAAK,oCAAoC,EAAE,EAAE,GAGzD,UAAU,IAAI,IAAI,KAAK,GAChB,MAAM;AACX,YAAU,OAAO,EAAE;AACrB,IAGW,sBAAsB,CAAC,OAAe;AACjD,YAAU,OAAO,EAAE;AACrB,GAEa,iBAAiB,CAAC,IAAY,SAAS,OAAU;AAC5D,QAAM,QAAQ,UAAU,IAAI,EAAE;AAC9B,MAAI,CAAC,OAAO;AACV,IAAI,QAAQ,IAAI,aAAa,iBAC3B,QAAQ,KAAK,yBAAyB,EAAE;AAE1C;AAAA,EACF;AACA,EAAI,UAAU,CAAC,MAAM,iBACnB,MAAM,MAAM,IAEZ,MAAM,eAAe;AAEzB;",
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,MAAM,YAAY,oBAAI,IAAuB,GAEhC,oBAAoB,CAAC,IAAY,WACxC,QAAQ,IAAI,aAAa,iBACvB,UAAU,IAAI,EAAE,KAClB,QAAQ,KAAK,oCAAoC,EAAE,EAAE,GAGzD,UAAU,IAAI,IAAI,KAAK,GAChB,MAAM;AACX,YAAU,OAAO,EAAE;AACrB,IAGW,sBAAsB,CAAC,OAAe;AACjD,YAAU,OAAO,EAAE;AACrB,GAEa,iBAAiB,CAAC,IAAY,SAAS,OAAU;AAC5D,QAAM,QAAQ,UAAU,IAAI,EAAE;AAC9B,MAAI,CAAC,OAAO;AACV,IAAI,QAAQ,IAAI,aAAa,iBAC3B,QAAQ,KAAK,yBAAyB,EAAE;AAE1C;AAAA,EACF;AACA,EAAI,UAAU,CAAC,MAAM,iBACnB,MAAM,MAAM,IAEZ,MAAM,eAAe;AAEzB;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/focusable",
|
|
3
|
-
"version": "1.88.
|
|
3
|
+
"version": "1.88.2",
|
|
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.88.
|
|
26
|
-
"@tamagui/web": "1.88.
|
|
25
|
+
"@tamagui/compose-refs": "1.88.2",
|
|
26
|
+
"@tamagui/web": "1.88.2"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react": "*"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@tamagui/build": "1.88.
|
|
32
|
+
"@tamagui/build": "1.88.2",
|
|
33
33
|
"react": "^18.2.0"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|