@tamagui/focusable 2.7.6 → 3.0.0-beta.637.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/cjs/focusable.cjs +10 -11
  2. package/dist/cjs/focusable.native.cjs +19 -0
  3. package/dist/cjs/focusable.native.js +10 -10
  4. package/dist/cjs/focusable.native.js.map +1 -1
  5. package/dist/cjs/focusableInputHOC.cjs +58 -73
  6. package/dist/cjs/focusableInputHOC.native.cjs +84 -0
  7. package/dist/cjs/focusableInputHOC.native.js +64 -78
  8. package/dist/cjs/focusableInputHOC.native.js.map +1 -1
  9. package/dist/cjs/index.cjs +10 -11
  10. package/dist/cjs/index.native.cjs +23 -0
  11. package/dist/cjs/index.native.js +10 -10
  12. package/dist/cjs/index.native.js.map +1 -1
  13. package/dist/cjs/registerFocusable.cjs +18 -19
  14. package/dist/cjs/registerFocusable.native.cjs +60 -0
  15. package/dist/cjs/registerFocusable.native.js +44 -44
  16. package/dist/cjs/registerFocusable.native.js.map +1 -1
  17. package/dist/esm/focusable.mjs +0 -2
  18. package/dist/esm/focusable.native.js +0 -2
  19. package/dist/esm/focusableInputHOC.mjs +42 -47
  20. package/dist/esm/focusableInputHOC.mjs.map +1 -1
  21. package/dist/esm/focusableInputHOC.native.js +48 -53
  22. package/dist/esm/focusableInputHOC.native.js.map +1 -1
  23. package/dist/esm/index.js +5 -4
  24. package/dist/esm/index.mjs +5 -4
  25. package/dist/esm/index.native.js +5 -4
  26. package/dist/esm/registerFocusable.mjs +3 -2
  27. package/dist/esm/registerFocusable.mjs.map +1 -1
  28. package/dist/esm/registerFocusable.native.js +28 -27
  29. package/dist/esm/registerFocusable.native.js.map +1 -1
  30. package/dist/jsx/focusable.mjs +0 -2
  31. package/dist/jsx/focusable.native.cjs +19 -0
  32. package/dist/jsx/focusable.native.js +10 -10
  33. package/dist/jsx/focusable.native.js.map +1 -1
  34. package/dist/jsx/focusableInputHOC.mjs +42 -47
  35. package/dist/jsx/focusableInputHOC.mjs.map +1 -1
  36. package/dist/jsx/focusableInputHOC.native.cjs +84 -0
  37. package/dist/jsx/focusableInputHOC.native.js +64 -78
  38. package/dist/jsx/focusableInputHOC.native.js.map +1 -1
  39. package/dist/jsx/index.js +5 -4
  40. package/dist/jsx/index.mjs +5 -4
  41. package/dist/jsx/index.native.cjs +23 -0
  42. package/dist/jsx/index.native.js +10 -10
  43. package/dist/jsx/index.native.js.map +1 -1
  44. package/dist/jsx/registerFocusable.mjs +3 -2
  45. package/dist/jsx/registerFocusable.mjs.map +1 -1
  46. package/dist/jsx/registerFocusable.native.cjs +60 -0
  47. package/dist/jsx/registerFocusable.native.js +44 -44
  48. package/dist/jsx/registerFocusable.native.js.map +1 -1
  49. package/package.json +4 -4
  50. package/types/focusableInputHOC.d.ts.map +1 -1
  51. package/types/registerFocusable.d.ts.map +1 -1
  52. package/types/registerFocusable.native.d.ts.map +1 -1
  53. package/dist/esm/focusable.mjs.map +0 -1
  54. package/dist/esm/focusable.native.js.map +0 -1
  55. package/dist/esm/index.js.map +0 -1
  56. package/dist/esm/index.mjs.map +0 -1
  57. package/dist/esm/index.native.js.map +0 -1
  58. package/dist/jsx/focusable.mjs.map +0 -1
  59. package/dist/jsx/index.js.map +0 -1
  60. package/dist/jsx/index.mjs.map +0 -1
@@ -1,18 +1,17 @@
1
+
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
6
  var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
- get: () => from[key],
9
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
- });
11
- }
12
- return to;
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
9
+ get: () => from[key],
10
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
+ });
12
+ }
13
+ return to;
13
14
  };
14
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
15
- value: true
16
- }), mod);
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
17
16
  var focusable_exports = {};
18
- module.exports = __toCommonJS(focusable_exports);
17
+ module.exports = __toCommonJS(focusable_exports);
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
11
+ get: () => from[key],
12
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
13
+ });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var focusable_exports = {};
19
+ module.exports = __toCommonJS(focusable_exports);
@@ -1,21 +1,21 @@
1
1
  "use strict";
2
2
 
3
+
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from === "object" || typeof from === "function") {
9
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
- get: () => from[key],
11
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
- });
13
- }
14
- return to;
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
11
+ get: () => from[key],
12
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
13
+ });
14
+ }
15
+ return to;
15
16
  };
16
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
17
- value: true
18
- }), mod);
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
18
  var focusable_exports = {};
20
19
  module.exports = __toCommonJS(focusable_exports);
20
+
21
21
  //# sourceMappingURL=focusable.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","focusable_exports"],"sources":["../../src/focusable.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,iBAAA","ignoreList":[]}
1
+ {"version":3,"file":"focusable.native.js","names":[],"sources":["cjs/focusable.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar focusable_exports = {};\nmodule.exports = __toCommonJS(focusable_exports);\n//# sourceMappingURL=focusable.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,oBAAoB,CAAC;AACzB,OAAO,UAAU,aAAa,iBAAiB"}
@@ -1,3 +1,4 @@
1
+
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -5,86 +6,70 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
6
  var __getProtoOf = Object.getPrototypeOf;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
12
13
  };
13
14
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
21
22
  };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
- value: mod,
29
- enumerable: true
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
30
26
  }) : target, mod));
31
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: true
33
- }), mod);
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
34
28
  var focusableInputHOC_exports = {};
35
- __export(focusableInputHOC_exports, {
36
- useFocusable: () => useFocusable
37
- });
29
+ __export(focusableInputHOC_exports, { useFocusable: () => useFocusable });
38
30
  module.exports = __toCommonJS(focusableInputHOC_exports);
39
31
  var import_compose_refs = require("@tamagui/compose-refs");
40
32
  var import_web = require("@tamagui/web");
41
33
  var import_react = __toESM(require("react"), 1);
42
34
  var import_registerFocusable = require("./registerFocusable.cjs");
43
- function useFocusable({
44
- isInput,
45
- props,
46
- ref
47
- }) {
48
- const {
49
- id,
50
- onChangeText,
51
- value,
52
- defaultValue
53
- } = props;
54
- const inputValue = import_react.default.useRef(value || defaultValue || "");
55
- const unregisterFocusable = import_react.default.useRef(void 0);
56
- const focusAndSelect = import_react.default.useCallback(input => {
57
- input.focus();
58
- if (input.setSelection && typeof inputValue.current === "string") {
59
- input.setSelection(0, inputValue.current.length);
60
- }
61
- }, []);
62
- const registerFocusableHandler = import_react.default.useCallback(input => {
63
- if (!id || !input) return;
64
- unregisterFocusable.current?.();
65
- unregisterFocusable.current = (0, import_registerFocusable.registerFocusable)(id, {
66
- focus: input.focus,
67
- ...(isInput && {
68
- focusAndSelect: () => focusAndSelect(input)
69
- })
70
- });
71
- }, [id, isInput, focusAndSelect]);
72
- const inputRef = import_react.default.useCallback(input => {
73
- if (input) {
74
- registerFocusableHandler(input);
75
- }
76
- }, [registerFocusableHandler]);
77
- const handleChangeText = (0, import_web.useEvent)(value2 => {
78
- inputValue.current = value2;
79
- onChangeText?.(value2);
80
- });
81
- import_react.default.useEffect(() => {
82
- return () => {
83
- unregisterFocusable.current?.();
84
- };
85
- }, []);
86
- return {
87
- ref: import_react.default.useMemo(() => (0, import_compose_refs.composeRefs)(ref, inputRef), [ref, inputRef]),
88
- onChangeText: handleChangeText
89
- };
90
- }
35
+ function useFocusable({ isInput, props, ref }) {
36
+ const { id, onChangeText, value, defaultValue } = props;
37
+ const inputValue = import_react.default.useRef(value || defaultValue || "");
38
+ const unregisterFocusable = import_react.default.useRef(void 0);
39
+ const focusAndSelect = import_react.default.useCallback((input) => {
40
+ input.focus();
41
+ if (input.setSelection && typeof inputValue.current === "string") {
42
+ input.setSelection(0, inputValue.current.length);
43
+ }
44
+ }, []);
45
+ const registerFocusableHandler = import_react.default.useCallback((input) => {
46
+ if (!id || !input) return;
47
+ unregisterFocusable.current?.();
48
+ unregisterFocusable.current = (0, import_registerFocusable.registerFocusable)(id, {
49
+ focus: input.focus,
50
+ ...isInput && { focusAndSelect: () => focusAndSelect(input) }
51
+ });
52
+ }, [
53
+ id,
54
+ isInput,
55
+ focusAndSelect
56
+ ]);
57
+ const inputRef = import_react.default.useCallback((input) => {
58
+ if (input) {
59
+ registerFocusableHandler(input);
60
+ }
61
+ }, [registerFocusableHandler]);
62
+ const handleChangeText = (0, import_web.useEvent)((value2) => {
63
+ inputValue.current = value2;
64
+ onChangeText?.(value2);
65
+ });
66
+ import_react.default.useEffect(() => {
67
+ return () => {
68
+ unregisterFocusable.current?.();
69
+ };
70
+ }, []);
71
+ return {
72
+ ref: import_react.default.useMemo(() => (0, import_compose_refs.composeRefs)(ref, inputRef), [ref, inputRef]),
73
+ onChangeText: handleChangeText
74
+ };
75
+ }
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: () => from[key],
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ return to;
24
+ };
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: true
28
+ }) : target, mod));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var focusableInputHOC_exports = {};
31
+ __export(focusableInputHOC_exports, { useFocusable: () => useFocusable });
32
+ module.exports = __toCommonJS(focusableInputHOC_exports);
33
+ var import_compose_refs = require("@tamagui/compose-refs");
34
+ var import_web = require("@tamagui/web");
35
+ var import_react = __toESM(require("react"), 1);
36
+ var import_registerFocusable = require("./registerFocusable.native.js");
37
+ function useFocusable(param) {
38
+ var { isInput, props, ref } = param;
39
+ var { id, onChangeText, value, defaultValue } = props;
40
+ var inputValue = import_react.default.useRef(value || defaultValue || "");
41
+ var unregisterFocusable = import_react.default.useRef(void 0);
42
+ var focusAndSelect = import_react.default.useCallback(function(input) {
43
+ input.focus();
44
+ if (input.setSelection && typeof inputValue.current === "string") {
45
+ input.setSelection(0, inputValue.current.length);
46
+ }
47
+ }, []);
48
+ var registerFocusableHandler = import_react.default.useCallback(function(input) {
49
+ var _unregisterFocusable_current;
50
+ if (!id || !input) return;
51
+ (_unregisterFocusable_current = unregisterFocusable.current) === null || _unregisterFocusable_current === void 0 ? void 0 : _unregisterFocusable_current.call(unregisterFocusable);
52
+ unregisterFocusable.current = (0, import_registerFocusable.registerFocusable)(id, {
53
+ focus: input.focus,
54
+ ...isInput && { focusAndSelect: function() {
55
+ return focusAndSelect(input);
56
+ } }
57
+ });
58
+ }, [
59
+ id,
60
+ isInput,
61
+ focusAndSelect
62
+ ]);
63
+ var inputRef = import_react.default.useCallback(function(input) {
64
+ if (input) {
65
+ registerFocusableHandler(input);
66
+ }
67
+ }, [registerFocusableHandler]);
68
+ var handleChangeText = (0, import_web.useEvent)(function(value2) {
69
+ inputValue.current = value2;
70
+ onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(value2);
71
+ });
72
+ import_react.default.useEffect(function() {
73
+ return function() {
74
+ var _unregisterFocusable_current;
75
+ (_unregisterFocusable_current = unregisterFocusable.current) === null || _unregisterFocusable_current === void 0 ? void 0 : _unregisterFocusable_current.call(unregisterFocusable);
76
+ };
77
+ }, []);
78
+ return {
79
+ ref: import_react.default.useMemo(function() {
80
+ return (0, import_compose_refs.composeRefs)(ref, inputRef);
81
+ }, [ref, inputRef]),
82
+ onChangeText: handleChangeText
83
+ };
84
+ }
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -7,94 +8,79 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
8
  var __getProtoOf = Object.getPrototypeOf;
8
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
10
  var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
14
15
  };
15
16
  var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
- get: () => from[key],
19
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
- });
21
- }
22
- return to;
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: () => from[key],
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ return to;
23
24
  };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
- // If the importer is in node compatibility mode or this is not an ESM
26
- // file that has been converted to a CommonJS file using a Babel-
27
- // compatible transform (i.e. "__esModule" has not been set), then set
28
- // "default" to the CommonJS "module.exports" for node compatibility.
29
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
- value: mod,
31
- enumerable: true
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: true
32
28
  }) : target, mod));
33
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
- value: true
35
- }), mod);
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
30
  var focusableInputHOC_exports = {};
37
- __export(focusableInputHOC_exports, {
38
- useFocusable: () => useFocusable
39
- });
31
+ __export(focusableInputHOC_exports, { useFocusable: () => useFocusable });
40
32
  module.exports = __toCommonJS(focusableInputHOC_exports);
41
33
  var import_compose_refs = require("@tamagui/compose-refs");
42
34
  var import_web = require("@tamagui/web");
43
35
  var import_react = __toESM(require("react"), 1);
44
36
  var import_registerFocusable = require("./registerFocusable.native.js");
45
37
  function useFocusable(param) {
46
- var {
47
- isInput,
48
- props,
49
- ref
50
- } = param;
51
- var {
52
- id,
53
- onChangeText,
54
- value,
55
- defaultValue
56
- } = props;
57
- var inputValue = import_react.default.useRef(value || defaultValue || "");
58
- var unregisterFocusable = import_react.default.useRef(void 0);
59
- var focusAndSelect = import_react.default.useCallback(function (input) {
60
- input.focus();
61
- if (input.setSelection && typeof inputValue.current === "string") {
62
- input.setSelection(0, inputValue.current.length);
63
- }
64
- }, []);
65
- var registerFocusableHandler = import_react.default.useCallback(function (input) {
66
- var _unregisterFocusable_current;
67
- if (!id || !input) return;
68
- (_unregisterFocusable_current = unregisterFocusable.current) === null || _unregisterFocusable_current === void 0 ? void 0 : _unregisterFocusable_current.call(unregisterFocusable);
69
- unregisterFocusable.current = (0, import_registerFocusable.registerFocusable)(id, {
70
- focus: input.focus,
71
- ...(isInput && {
72
- focusAndSelect: function () {
73
- return focusAndSelect(input);
74
- }
75
- })
76
- });
77
- }, [id, isInput, focusAndSelect]);
78
- var inputRef = import_react.default.useCallback(function (input) {
79
- if (input) {
80
- registerFocusableHandler(input);
81
- }
82
- }, [registerFocusableHandler]);
83
- var handleChangeText = (0, import_web.useEvent)(function (value2) {
84
- inputValue.current = value2;
85
- onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(value2);
86
- });
87
- import_react.default.useEffect(function () {
88
- return function () {
89
- var _unregisterFocusable_current;
90
- (_unregisterFocusable_current = unregisterFocusable.current) === null || _unregisterFocusable_current === void 0 ? void 0 : _unregisterFocusable_current.call(unregisterFocusable);
91
- };
92
- }, []);
93
- return {
94
- ref: import_react.default.useMemo(function () {
95
- return (0, import_compose_refs.composeRefs)(ref, inputRef);
96
- }, [ref, inputRef]),
97
- onChangeText: handleChangeText
98
- };
38
+ var { isInput, props, ref } = param;
39
+ var { id, onChangeText, value, defaultValue } = props;
40
+ var inputValue = import_react.default.useRef(value || defaultValue || "");
41
+ var unregisterFocusable = import_react.default.useRef(void 0);
42
+ var focusAndSelect = import_react.default.useCallback(function(input) {
43
+ input.focus();
44
+ if (input.setSelection && typeof inputValue.current === "string") {
45
+ input.setSelection(0, inputValue.current.length);
46
+ }
47
+ }, []);
48
+ var registerFocusableHandler = import_react.default.useCallback(function(input) {
49
+ var _unregisterFocusable_current;
50
+ if (!id || !input) return;
51
+ (_unregisterFocusable_current = unregisterFocusable.current) === null || _unregisterFocusable_current === void 0 ? void 0 : _unregisterFocusable_current.call(unregisterFocusable);
52
+ unregisterFocusable.current = (0, import_registerFocusable.registerFocusable)(id, {
53
+ focus: input.focus,
54
+ ...isInput && { focusAndSelect: function() {
55
+ return focusAndSelect(input);
56
+ } }
57
+ });
58
+ }, [
59
+ id,
60
+ isInput,
61
+ focusAndSelect
62
+ ]);
63
+ var inputRef = import_react.default.useCallback(function(input) {
64
+ if (input) {
65
+ registerFocusableHandler(input);
66
+ }
67
+ }, [registerFocusableHandler]);
68
+ var handleChangeText = (0, import_web.useEvent)(function(value2) {
69
+ inputValue.current = value2;
70
+ onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(value2);
71
+ });
72
+ import_react.default.useEffect(function() {
73
+ return function() {
74
+ var _unregisterFocusable_current;
75
+ (_unregisterFocusable_current = unregisterFocusable.current) === null || _unregisterFocusable_current === void 0 ? void 0 : _unregisterFocusable_current.call(unregisterFocusable);
76
+ };
77
+ }, []);
78
+ return {
79
+ ref: import_react.default.useMemo(function() {
80
+ return (0, import_compose_refs.composeRefs)(ref, inputRef);
81
+ }, [ref, inputRef]),
82
+ onChangeText: handleChangeText
83
+ };
99
84
  }
85
+
100
86
  //# sourceMappingURL=focusableInputHOC.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","focusableInputHOC_exports","__export","useFocusable","module","exports","import_compose_refs","require","import_web","import_react","__toESM","import_registerFocusable","param","isInput","props","ref","id","onChangeText","defaultValue","inputValue","default","useRef","unregisterFocusable","focusAndSelect","useCallback","input","focus","setSelection","current","length","registerFocusableHandler","_unregisterFocusable_current","call","registerFocusable","inputRef","handleChangeText","useEvent","value2","useEffect","useMemo","composeRefs"],"sources":["../../src/focusableInputHOC.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,yBAAA;AAAAC,QAAA,CAAAD,yBAAA;EAAAE,YAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAA4B,CAAAK,yBAAA;AAC5B,IAAAK,mBAAyB,GAAAC,OAAA;AAEzB,IAAAC,UAAA,GAAAD,OAAkB;AAElB,IAAAE,YAAA,GAAAC,OAAA,CAAAH,OAAkC;AAS3B,IAAAI,wBAAsB,GAAAJ,OAAA;AAAA,SAC3BJ,aAAAS,KAAA;EACA;IAAAC,OAAA;IAAAC,KAAA;IAAAC;EAAA,IAAAH,KAAA;EACA;IAAAI,EAAA;IAAAC,YAAA;IAAAjB,KAAA;IAAAkB;EAAA,IAAAJ,KAAA;EACF,IAIGK,UAAA,GAAAV,YAAA,CAAAW,OAAA,CAAAC,MAAA,CAAArB,KAAA,IAAAkB,YAAA;EACD,IAAAI,mBAAY,GAAcb,YAAO,CAAAW,OAAa,CAAAC,MAAI;EAClD,IAAAE,cAAM,GAAad,YAAA,CAAAW,OAAM,CAAAI,WAAO,WAASC,KAAA;IACzCA,KAAM,CAAAC,KAAA;IAEN,IAAMD,KAAA,CAAAE,YAAiB,WAAAR,UAAM,CAAAS,OAAA,KAAa,UAAe;MACvDH,KAAM,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":3,"file":"focusableInputHOC.native.js","names":[],"sources":["cjs/focusableInputHOC.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar focusableInputHOC_exports = {};\n__export(focusableInputHOC_exports, {\n useFocusable: () => useFocusable\n});\nmodule.exports = __toCommonJS(focusableInputHOC_exports);\nvar import_compose_refs = require(\"@tamagui/compose-refs\");\nvar import_web = require(\"@tamagui/web\");\nvar import_react = __toESM(require(\"react\"), 1);\nvar import_registerFocusable = require(\"./registerFocusable\");\nfunction useFocusable(param) {\n var { isInput, props, ref } = param;\n var { id, onChangeText, value, defaultValue } = props;\n var inputValue = import_react.default.useRef(value || defaultValue || \"\");\n var unregisterFocusable = import_react.default.useRef(void 0);\n var focusAndSelect = import_react.default.useCallback(function(input) {\n input.focus();\n if (input.setSelection && typeof inputValue.current === \"string\") {\n input.setSelection(0, inputValue.current.length);\n }\n }, []);\n var registerFocusableHandler = import_react.default.useCallback(function(input) {\n var _unregisterFocusable_current;\n if (!id || !input) return;\n (_unregisterFocusable_current = unregisterFocusable.current) === null || _unregisterFocusable_current === void 0 ? void 0 : _unregisterFocusable_current.call(unregisterFocusable);\n unregisterFocusable.current = (0, import_registerFocusable.registerFocusable)(id, {\n focus: input.focus,\n ...isInput && {\n focusAndSelect: function() {\n return focusAndSelect(input);\n }\n }\n });\n }, [\n id,\n isInput,\n focusAndSelect\n ]);\n var inputRef = import_react.default.useCallback(function(input) {\n if (input) {\n registerFocusableHandler(input);\n }\n }, [\n registerFocusableHandler\n ]);\n var handleChangeText = (0, import_web.useEvent)(function(value2) {\n inputValue.current = value2;\n onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(value2);\n });\n import_react.default.useEffect(function() {\n return function() {\n var _unregisterFocusable_current;\n (_unregisterFocusable_current = unregisterFocusable.current) === null || _unregisterFocusable_current === void 0 ? void 0 : _unregisterFocusable_current.call(unregisterFocusable);\n };\n }, []);\n return {\n ref: import_react.default.useMemo(function() {\n return (0, import_compose_refs.composeRefs)(ref, inputRef);\n }, [\n ref,\n inputRef\n ]),\n onChangeText: handleChangeText\n };\n}\n//# sourceMappingURL=focusableInputHOC.js.map\n"],"mappings":";;;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KA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SAAS,OAAO;EAC9E,IAAI;EACJ,IAAI,CAAC,MAAM,CAAC,OAAO;EACnB,CAAC,+BAA+B,oBAAoB,aAAa,QAAQ,iCAAiC,KAAK,IAAI,KAAK,IAAI,6BAA6B,KAAK,mBAAmB;EACjL,oBAAoB,WAAW,GAAG,yBAAyB,mBAAmB,IAAI;GAChF,OAAO,MAAM;GACb,GAAG,WAAW,EACZ,gBAAgB,WAAW;IACzB,OAAO,eAAe,KAAK;GAC7B,EACF;EACF,CAAC;CACH,GAAG;EACD;EACA;EACA;CACF,CAAC;CACD,IAAI,WAAW,aAAa,QAAQ,YAAY,SAAS,OAAO;EAC9D,IAAI,OAAO;GACT,yBAAyB,KAAK;EAChC;CACF,GAAG,CACD,wBACF,CAAC;CACD,IAAI,oBAAoB,GAAG,WAAW,UAAU,SAAS,QAAQ;EAC/D,WAAW,UAAU;EACrB,iBAAiB,QAAQ,iBAAiB,KAAK,IAAI,KAAK,IAAI,aAAa,MAAM;CACjF,CAAC;CACD,aAAa,QAAQ,UAAU,WAAW;EACxC,OAAO,WAAW;GAChB,IAAI;GACJ,CAAC,+BAA+B,oBAAoB,aAAa,QAAQ,iCAAiC,KAAK,IAAI,KAAK,IAAI,6BAA6B,KAAK,mBAAmB;EACnL;CACF,GAAG,CAAC,CAAC;CACL,OAAO;EACL,KAAK,aAAa,QAAQ,QAAQ,WAAW;GAC3C,QAAQ,GAAG,oBAAoB,aAAa,KAAK,QAAQ;EAC3D,GAAG,CACD,KACA,QACF,CAAC;EACD,cAAc;CAChB;AACF"}
@@ -1,22 +1,21 @@
1
+
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
6
  var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
- get: () => from[key],
9
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
- });
11
- }
12
- return to;
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
9
+ get: () => from[key],
10
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
+ });
12
+ }
13
+ return to;
13
14
  };
14
15
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
16
- value: true
17
- }), mod);
16
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
17
  var index_exports = {};
19
18
  module.exports = __toCommonJS(index_exports);
20
19
  __reExport(index_exports, require("./registerFocusable.cjs"), module.exports);
21
20
  __reExport(index_exports, require("./focusableInputHOC.cjs"), module.exports);
22
- __reExport(index_exports, require("./focusable.cjs"), module.exports);
21
+ __reExport(index_exports, require("./focusable.cjs"), module.exports);
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
11
+ get: () => from[key],
12
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
13
+ });
14
+ }
15
+ return to;
16
+ };
17
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var index_exports = {};
20
+ module.exports = __toCommonJS(index_exports);
21
+ __reExport(index_exports, require("./registerFocusable.native.js"), module.exports);
22
+ __reExport(index_exports, require("./focusableInputHOC.native.js"), module.exports);
23
+ __reExport(index_exports, require("./focusable.native.js"), module.exports);
@@ -1,25 +1,25 @@
1
1
  "use strict";
2
2
 
3
+
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
8
  var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from === "object" || typeof from === "function") {
9
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
- get: () => from[key],
11
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
- });
13
- }
14
- return to;
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
11
+ get: () => from[key],
12
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
13
+ });
14
+ }
15
+ return to;
15
16
  };
16
17
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
18
- value: true
19
- }), mod);
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
19
  var index_exports = {};
21
20
  module.exports = __toCommonJS(index_exports);
22
21
  __reExport(index_exports, require("./registerFocusable.native.js"), module.exports);
23
22
  __reExport(index_exports, require("./focusableInputHOC.native.js"), module.exports);
24
23
  __reExport(index_exports, require("./focusable.native.js"), module.exports);
24
+
25
25
  //# sourceMappingURL=index.native.js.map