@hanzogui/component-helpers 2.0.0-rc.41-hanzoai.5

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 (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/dist/cjs/getIcon.cjs +50 -0
  4. package/dist/cjs/getIcon.native.js +53 -0
  5. package/dist/cjs/getIcon.native.js.map +1 -0
  6. package/dist/cjs/index.cjs +24 -0
  7. package/dist/cjs/index.native.js +27 -0
  8. package/dist/cjs/index.native.js.map +1 -0
  9. package/dist/cjs/prevent.cjs +28 -0
  10. package/dist/cjs/prevent.native.js +33 -0
  11. package/dist/cjs/prevent.native.js.map +1 -0
  12. package/dist/cjs/useCurrentColor.cjs +33 -0
  13. package/dist/cjs/useCurrentColor.native.js +37 -0
  14. package/dist/cjs/useCurrentColor.native.js.map +1 -0
  15. package/dist/cjs/useGetThemedIcon.cjs +55 -0
  16. package/dist/cjs/useGetThemedIcon.native.js +58 -0
  17. package/dist/cjs/useGetThemedIcon.native.js.map +1 -0
  18. package/dist/esm/getIcon.mjs +14 -0
  19. package/dist/esm/getIcon.mjs.map +1 -0
  20. package/dist/esm/getIcon.native.js +14 -0
  21. package/dist/esm/getIcon.native.js.map +1 -0
  22. package/dist/esm/index.js +6 -0
  23. package/dist/esm/index.js.map +1 -0
  24. package/dist/esm/index.mjs +6 -0
  25. package/dist/esm/index.mjs.map +1 -0
  26. package/dist/esm/index.native.js +6 -0
  27. package/dist/esm/index.native.js.map +1 -0
  28. package/dist/esm/prevent.mjs +3 -0
  29. package/dist/esm/prevent.mjs.map +1 -0
  30. package/dist/esm/prevent.native.js +5 -0
  31. package/dist/esm/prevent.native.js.map +1 -0
  32. package/dist/esm/useCurrentColor.mjs +8 -0
  33. package/dist/esm/useCurrentColor.mjs.map +1 -0
  34. package/dist/esm/useCurrentColor.native.js +9 -0
  35. package/dist/esm/useCurrentColor.native.js.map +1 -0
  36. package/dist/esm/useGetThemedIcon.mjs +19 -0
  37. package/dist/esm/useGetThemedIcon.mjs.map +1 -0
  38. package/dist/esm/useGetThemedIcon.native.js +19 -0
  39. package/dist/esm/useGetThemedIcon.native.js.map +1 -0
  40. package/package.json +50 -0
  41. package/src/getIcon.tsx +20 -0
  42. package/src/index.ts +5 -0
  43. package/src/prevent.tsx +1 -0
  44. package/src/useCurrentColor.tsx +18 -0
  45. package/src/useGetThemedIcon.tsx +19 -0
  46. package/types/getIcon.d.ts +6 -0
  47. package/types/getIcon.d.ts.map +1 -0
  48. package/types/index.d.ts +6 -0
  49. package/types/index.d.ts.map +1 -0
  50. package/types/prevent.d.ts +2 -0
  51. package/types/prevent.d.ts.map +1 -0
  52. package/types/useCurrentColor.d.ts +5 -0
  53. package/types/useCurrentColor.d.ts.map +1 -0
  54. package/types/useGetThemedIcon.d.ts +6 -0
  55. package/types/useGetThemedIcon.d.ts.map +1 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Nate Wienert
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ This is a superset of @hanzogui/helpers with extra utilities used by `hanzogui`
@@ -0,0 +1,50 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ 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;
21
+ };
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
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
34
+ var getIcon_exports = {};
35
+ __export(getIcon_exports, {
36
+ getIcon: () => getIcon
37
+ });
38
+ module.exports = __toCommonJS(getIcon_exports);
39
+ var import_react = __toESM(require("react"), 1);
40
+ const getIcon = (el, props) => {
41
+ if (!el) return el;
42
+ if (import_react.default.isValidElement(el)) {
43
+ return import_react.default.cloneElement(el, {
44
+ ...props,
45
+ // @ts-expect-error
46
+ ...el.props
47
+ });
48
+ }
49
+ return import_react.default.createElement(el, props);
50
+ };
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ };
15
+ 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;
23
+ };
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
32
+ }) : target, mod));
33
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
+ value: true
35
+ }), mod);
36
+ var getIcon_exports = {};
37
+ __export(getIcon_exports, {
38
+ getIcon: () => getIcon
39
+ });
40
+ module.exports = __toCommonJS(getIcon_exports);
41
+ var import_react = __toESM(require("react"), 1);
42
+ var getIcon = function (el, props) {
43
+ if (!el) return el;
44
+ if (/* @__PURE__ */import_react.default.isValidElement(el)) {
45
+ return /* @__PURE__ */import_react.default.cloneElement(el, {
46
+ ...props,
47
+ // @ts-expect-error
48
+ ...el.props
49
+ });
50
+ }
51
+ return /* @__PURE__ */import_react.default.createElement(el, props);
52
+ };
53
+ //# sourceMappingURL=getIcon.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","getIcon_exports","__export","getIcon","module","exports","import_react","__toESM","require","el","props","default","isValidElement","cloneElement","createElement"],"sources":["../../src/getIcon.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,eAAA;AAAAC,QAAA,CAAAD,eAAA;EAAAE,OAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAkB,CAAAK,eAAA;AAEX,IAAAK,YAAgB,GACrBC,OACA,CAAAC,OAKG;AACH,IAAAL,OAAS,YAAAA,CAAOM,EAAA,EAAAC,KAAA;EAChB,IAAI,CAAAD,EAAA,SAAAA,EAAA;EACF,mBAAOH,YAAM,CAAAK,OAAA,CAAAC,cAAiB,CAAAH,EAAA;IAAA,OACzB,eAAAH,YAAA,CAAAK,OAAA,CAAAE,YAAA,CAAAJ,EAAA;MAAA,GAAAC,KAAA;MAEH;MACD,GAAAD,EAAA,CAAAC;IACH;EACA;EACF,sBAAAJ,YAAA,CAAAK,OAAA,CAAAG,aAAA,CAAAL,EAAA,EAAAC,KAAA","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from)) 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;
13
+ };
14
+ 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);
18
+ var index_exports = {};
19
+ module.exports = __toCommonJS(index_exports);
20
+ __reExport(index_exports, require("@hanzogui/helpers"), module.exports);
21
+ __reExport(index_exports, require("./prevent.cjs"), module.exports);
22
+ __reExport(index_exports, require("./useCurrentColor.cjs"), module.exports);
23
+ __reExport(index_exports, require("./useGetThemedIcon.cjs"), module.exports);
24
+ __reExport(index_exports, require("./getIcon.cjs"), module.exports);
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ 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;
15
+ };
16
+ 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);
20
+ var index_exports = {};
21
+ module.exports = __toCommonJS(index_exports);
22
+ __reExport(index_exports, require("@hanzogui/helpers"), module.exports);
23
+ __reExport(index_exports, require("./prevent.native.js"), module.exports);
24
+ __reExport(index_exports, require("./useCurrentColor.native.js"), module.exports);
25
+ __reExport(index_exports, require("./useGetThemedIcon.native.js"), module.exports);
26
+ __reExport(index_exports, require("./getIcon.native.js"), module.exports);
27
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports","__reExport","require"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAP,YAAc,CAAAK,aAAA;AACdG,UAAA,CAAAH,aAAA,EAAcI,OAAA,oBADd,GAAAH,MAAA,CAAAC,OAAA;AAEAC,UAAA,CAAAH,aAAA,EAAcI,OAAA,yBAAAH,MAAA,CAAAC,OAFd;AAGAC,UAAA,CAAAH,aAAA,EAAcI,OAAA,iCAAAH,MAHd,CAAAC,OAAA;AAIAC,UAAA,CAAAH,aAAA,EAAcI,OAAA,+BAJd,GAAAH,MAAA,CAAAC,OAAA","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: true
22
+ }), mod);
23
+ var prevent_exports = {};
24
+ __export(prevent_exports, {
25
+ prevent: () => prevent
26
+ });
27
+ module.exports = __toCommonJS(prevent_exports);
28
+ const prevent = e => [e.preventDefault(), e.stopPropagation()];
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ 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;
21
+ };
22
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
+ value: true
24
+ }), mod);
25
+ var prevent_exports = {};
26
+ __export(prevent_exports, {
27
+ prevent: () => prevent
28
+ });
29
+ module.exports = __toCommonJS(prevent_exports);
30
+ var prevent = function (e) {
31
+ return [e.preventDefault(), e.stopPropagation()];
32
+ };
33
+ //# sourceMappingURL=prevent.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","prevent_exports","__export","prevent","module","exports"],"sources":["../../src/prevent.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,eAAA;AAAAC,QAAA,CAAAD,eAAA;EAAAE,OAAA,EAAAA,CAAA,KAAAA;AAAA;AAAOC,MAAM,CAAAC,OAAA,GAAWT,YAAS,CAAAK,eAAkB,CAAE","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: () => from[key],
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: true
22
+ }), mod);
23
+ var useCurrentColor_exports = {};
24
+ __export(useCurrentColor_exports, {
25
+ useCurrentColor: () => useCurrentColor
26
+ });
27
+ module.exports = __toCommonJS(useCurrentColor_exports);
28
+ var import_web = require("@hanzogui/web");
29
+ const useCurrentColor = colorProp => {
30
+ const theme = (0, import_web.useTheme)();
31
+ const out = colorProp ? (0, import_web.getVariable)(colorProp) : theme[colorProp]?.get() || theme.color?.get();
32
+ return out;
33
+ };
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ 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;
21
+ };
22
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
23
+ value: true
24
+ }), mod);
25
+ var useCurrentColor_exports = {};
26
+ __export(useCurrentColor_exports, {
27
+ useCurrentColor: () => useCurrentColor
28
+ });
29
+ module.exports = __toCommonJS(useCurrentColor_exports);
30
+ var import_web = require("@hanzogui/web");
31
+ var useCurrentColor = function (colorProp) {
32
+ var _theme_colorProp, _theme_color;
33
+ var theme = (0, import_web.useTheme)();
34
+ var out = colorProp ? (0, import_web.getVariable)(colorProp) : ((_theme_colorProp = theme[colorProp]) === null || _theme_colorProp === void 0 ? void 0 : _theme_colorProp.get()) || ((_theme_color = theme.color) === null || _theme_color === void 0 ? void 0 : _theme_color.get());
35
+ return out;
36
+ };
37
+ //# sourceMappingURL=useCurrentColor.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useCurrentColor_exports","__export","useCurrentColor","module","exports","import_web","require","colorProp","_theme_colorProp","_theme_color","theme","useTheme","out","getVariable","get","color"],"sources":["../../src/useCurrentColor.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,uBAAA;AAAAC,QAAA,CAAAD,uBAAA;EAAAE,eAAA,EAAAA,CAAA,KAAAA;AAAA;AACAC,MAAA,CAAAC,OAAA,GAAsCT,YAAA,CAAAK,uBAAA;AAG/B,IAAAK,UAAM,GAAAC,OAAkB,CAAC,eAAyB;AACvD,IAAAJ,eAAM,GAAQ,SAAAA,CAAAK,SAAA,EAAS;EACvB,IAAAC,gBAAY,EAAAC,YACR;EAEJ,IAAAC,KAAO,OAAAL,UAAA,CAAAM,QAAA;EACT,IAAAC,GAAA,GAAAL,SAAA,OAAAF,UAAA,CAAAQ,WAAA,EAAAN,SAAA,MAAAC,gBAAA,GAAAE,KAAA,CAAAH,SAAA,eAAAC,gBAAA,uBAAAA,gBAAA,CAAAM,GAAA,SAAAL,YAAA,GAAAC,KAAA,CAAAK,KAAA,cAAAN,YAAA,uBAAAA,YAAA,CAAAK,GAAA","ignoreList":[]}
@@ -0,0 +1,55 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ 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;
21
+ };
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
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
34
+ var useGetThemedIcon_exports = {};
35
+ __export(useGetThemedIcon_exports, {
36
+ useGetThemedIcon: () => useGetThemedIcon
37
+ });
38
+ module.exports = __toCommonJS(useGetThemedIcon_exports);
39
+ var import_react = __toESM(require("react"), 1);
40
+ var import_useCurrentColor = require("./useCurrentColor.cjs");
41
+ const useGetThemedIcon = props => {
42
+ const color = (0, import_useCurrentColor.useCurrentColor)(props.color);
43
+ return el => {
44
+ if (!el) return el;
45
+ if (import_react.default.isValidElement(el)) {
46
+ return import_react.default.cloneElement(el, {
47
+ ...props,
48
+ color,
49
+ // @ts-expect-error
50
+ ...el.props
51
+ });
52
+ }
53
+ return import_react.default.createElement(el, props);
54
+ };
55
+ };
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ };
15
+ 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;
23
+ };
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
32
+ }) : target, mod));
33
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
+ value: true
35
+ }), mod);
36
+ var useGetThemedIcon_exports = {};
37
+ __export(useGetThemedIcon_exports, {
38
+ useGetThemedIcon: () => useGetThemedIcon
39
+ });
40
+ module.exports = __toCommonJS(useGetThemedIcon_exports);
41
+ var import_react = __toESM(require("react"), 1);
42
+ var import_useCurrentColor = require("./useCurrentColor.native.js");
43
+ var useGetThemedIcon = function (props) {
44
+ var color = (0, import_useCurrentColor.useCurrentColor)(props.color);
45
+ return function (el) {
46
+ if (!el) return el;
47
+ if (/* @__PURE__ */import_react.default.isValidElement(el)) {
48
+ return /* @__PURE__ */import_react.default.cloneElement(el, {
49
+ ...props,
50
+ color,
51
+ // @ts-expect-error
52
+ ...el.props
53
+ });
54
+ }
55
+ return /* @__PURE__ */import_react.default.createElement(el, props);
56
+ };
57
+ };
58
+ //# sourceMappingURL=useGetThemedIcon.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useGetThemedIcon_exports","__export","useGetThemedIcon","module","exports","import_react","__toESM","require","import_useCurrentColor","props","color","useCurrentColor","el","default","isValidElement","cloneElement","createElement"],"sources":["../../src/useGetThemedIcon.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,wBAAA;AAAAC,QAAA,CAAAD,wBAAA;EAAAE,gBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAkB,CAAAK,wBAAA;AAElB,IAAAK,YAAA,GAAAC,OAAA,CAAAC,OAAgC;AAEzB,IAAAC,sBAA0B,GAAAD,OAA8C;AAC7E,IAAAL,gBAAc,YAAAA,CAAAO,KAAA;EACd,IAAAC,KAAQ,OAAYF,sBAAA,CAAAG,eAAA,EAAAF,KAAA,CAAAC,KAAA;EAClB,OAAK,UAAIE,EAAO;IAChB,IAAI,CAAAA,EAAA,SAAAA,EAAA;IACF,mBAAOP,YAAM,CAAAQ,OAAA,CAAAC,cAAiB,CAAAF,EAAA;MAAA,OACzB,eAAAP,YAAA,CAAAQ,OAAA,CAAAE,YAAA,CAAAH,EAAA;QACH,GAAAH,KAAA;QAAAC,KAAA;QAEA;QACD,GAAAE,EAAA,CAAAH;MACH;IACA;IACF,sBAAAJ,YAAA,CAAAQ,OAAA,CAAAG,aAAA,CAAAJ,EAAA,EAAAH,KAAA;EACF","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ const getIcon = (el, props) => {
3
+ if (!el) return el;
4
+ if (React.isValidElement(el)) {
5
+ return React.cloneElement(el, {
6
+ ...props,
7
+ // @ts-expect-error
8
+ ...el.props
9
+ });
10
+ }
11
+ return React.createElement(el, props);
12
+ };
13
+ export { getIcon };
14
+ //# sourceMappingURL=getIcon.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","getIcon","el","props","isValidElement","cloneElement","createElement"],"sources":["../../src/getIcon.tsx"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,KAAA,MAAW;AAEX,MAAMC,OAAA,GAAUA,CACrBC,EAAA,EACAC,KAAA,KAKG;EACH,IAAI,CAACD,EAAA,EAAI,OAAOA,EAAA;EAChB,IAAIF,KAAA,CAAMI,cAAA,CAAeF,EAAE,GAAG;IAC5B,OAAOF,KAAA,CAAMK,YAAA,CAAaH,EAAA,EAAI;MAC5B,GAAGC,KAAA;MAAA;MAEH,GAAGD,EAAA,CAAGC;IACR,CAAC;EACH;EACA,OAAOH,KAAA,CAAMM,aAAA,CAAcJ,EAAA,EAAIC,KAAK;AACtC","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ var getIcon = function (el, props) {
3
+ if (!el) return el;
4
+ if (/* @__PURE__ */React.isValidElement(el)) {
5
+ return /* @__PURE__ */React.cloneElement(el, {
6
+ ...props,
7
+ // @ts-expect-error
8
+ ...el.props
9
+ });
10
+ }
11
+ return /* @__PURE__ */React.createElement(el, props);
12
+ };
13
+ export { getIcon };
14
+ //# sourceMappingURL=getIcon.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","getIcon","el","props","isValidElement","cloneElement","createElement"],"sources":["../../src/getIcon.tsx"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,KAAA,MAAW;AAEX,IAAAC,OAAM,YAAAA,CAEXC,EAAA,EAAAC,KAKG;EACH,IAAI,CAACD,EAAA,EAAI,OAAOA,EAAA;EAChB,IAAI,eAAMF,KAAe,CAAAI,cAAK,CAAAF,EAAA;IAC5B,OAAO,eAAMF,KAAa,CAAAK,YAAI,CAAAH,EAAA;MAC5B,GAAGC,KAAA;MAAA;MAEH,GAAGD,EAAA,CAAGC;IACR,CAAC;EACH;EACA,OAAO,eAAMH,KAAc,CAAAM,aAAS,CAAAJ,EAAA,EAAAC,KAAA;AACtC","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ export * from "@hanzogui/helpers";
2
+ export * from "./prevent.mjs";
3
+ export * from "./useCurrentColor.mjs";
4
+ export * from "./useGetThemedIcon.mjs";
5
+ export * from "./getIcon.mjs";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ export * from "@hanzogui/helpers";
2
+ export * from "./prevent.mjs";
3
+ export * from "./useCurrentColor.mjs";
4
+ export * from "./useGetThemedIcon.mjs";
5
+ export * from "./getIcon.mjs";
6
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ export * from "@hanzogui/helpers";
2
+ export * from "./prevent.native.js";
3
+ export * from "./useCurrentColor.native.js";
4
+ export * from "./useGetThemedIcon.native.js";
5
+ export * from "./getIcon.native.js";
6
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ const prevent = e => [e.preventDefault(), e.stopPropagation()];
2
+ export { prevent };
3
+ //# sourceMappingURL=prevent.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["prevent","e","preventDefault","stopPropagation"],"sources":["../../src/prevent.tsx"],"sourcesContent":[null],"mappings":"AAAO,MAAMA,OAAA,GAAWC,CAAA,IAAM,CAACA,CAAA,CAAEC,cAAA,CAAe,GAAGD,CAAA,CAAEE,eAAA,CAAgB,CAAC","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ var prevent = function (e) {
2
+ return [e.preventDefault(), e.stopPropagation()];
3
+ };
4
+ export { prevent };
5
+ //# sourceMappingURL=prevent.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["prevent","e"],"sources":["../../src/prevent.tsx"],"sourcesContent":[null],"mappings":"AAAO,IAAAA,OAAM,YAAAA,CAAiBC,CAAC,EAAE","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ import { getVariable, useTheme } from "@hanzogui/web";
2
+ const useCurrentColor = colorProp => {
3
+ const theme = useTheme();
4
+ const out = colorProp ? getVariable(colorProp) : theme[colorProp]?.get() || theme.color?.get();
5
+ return out;
6
+ };
7
+ export { useCurrentColor };
8
+ //# sourceMappingURL=useCurrentColor.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getVariable","useTheme","useCurrentColor","colorProp","theme","out","get","color"],"sources":["../../src/useCurrentColor.tsx"],"sourcesContent":[null],"mappings":"AACA,SAASA,WAAA,EAAaC,QAAA,QAAgB;AAG/B,MAAMC,eAAA,GAAmBC,SAAA,IAAyB;EACvD,MAAMC,KAAA,GAAQH,QAAA,CAAS;EACvB,MAAMI,GAAA,GAAMF,SAAA,GACRH,WAAA,CAAYG,SAAS,IACrBC,KAAA,CAAMD,SAAgB,GAAGG,GAAA,CAAI,KAAKF,KAAA,CAAMG,KAAA,EAAOD,GAAA,CAAI;EACvD,OAAOD,GAAA;AACT","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ import { getVariable, useTheme } from "@hanzogui/web";
2
+ var useCurrentColor = function (colorProp) {
3
+ var _theme_colorProp, _theme_color;
4
+ var theme = useTheme();
5
+ var out = colorProp ? getVariable(colorProp) : ((_theme_colorProp = theme[colorProp]) === null || _theme_colorProp === void 0 ? void 0 : _theme_colorProp.get()) || ((_theme_color = theme.color) === null || _theme_color === void 0 ? void 0 : _theme_color.get());
6
+ return out;
7
+ };
8
+ export { useCurrentColor };
9
+ //# sourceMappingURL=useCurrentColor.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getVariable","useTheme","useCurrentColor","colorProp","_theme_colorProp","_theme_color","theme","out","get","color"],"sources":["../../src/useCurrentColor.tsx"],"sourcesContent":[null],"mappings":"AACA,SAASA,WAAA,EAAaC,QAAA,QAAgB;AAG/B,IAAAC,eAAM,YAAAA,CAAmBC,SAAyB;EACvD,IAAAC,gBAAc,EAAAC,YAAS;EACvB,IAAAC,KAAM,GAAML,QAAA;EAGZ,IAAAM,GAAO,GAAAJ,SAAA,GAAAH,WAAA,CAAAG,SAAA,MAAAC,gBAAA,GAAAE,KAAA,CAAAH,SAAA,eAAAC,gBAAA,uBAAAA,gBAAA,CAAAI,GAAA,SAAAH,YAAA,GAAAC,KAAA,CAAAG,KAAA,cAAAJ,YAAA,uBAAAA,YAAA,CAAAG,GAAA;EACT,OAAAD,GAAA","ignoreList":[]}
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import { useCurrentColor } from "./useCurrentColor.mjs";
3
+ const useGetThemedIcon = props => {
4
+ const color = useCurrentColor(props.color);
5
+ return el => {
6
+ if (!el) return el;
7
+ if (React.isValidElement(el)) {
8
+ return React.cloneElement(el, {
9
+ ...props,
10
+ color,
11
+ // @ts-expect-error
12
+ ...el.props
13
+ });
14
+ }
15
+ return React.createElement(el, props);
16
+ };
17
+ };
18
+ export { useGetThemedIcon };
19
+ //# sourceMappingURL=useGetThemedIcon.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useCurrentColor","useGetThemedIcon","props","color","el","isValidElement","cloneElement","createElement"],"sources":["../../src/useGetThemedIcon.tsx"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,KAAA,MAAW;AAElB,SAASC,eAAA,QAAuB;AAEzB,MAAMC,gBAAA,GAAoBC,KAAA,IAA8C;EAC7E,MAAMC,KAAA,GAAQH,eAAA,CAAgBE,KAAA,CAAMC,KAAK;EACzC,OAAQC,EAAA,IAAY;IAClB,IAAI,CAACA,EAAA,EAAI,OAAOA,EAAA;IAChB,IAAIL,KAAA,CAAMM,cAAA,CAAeD,EAAE,GAAG;MAC5B,OAAOL,KAAA,CAAMO,YAAA,CAAaF,EAAA,EAAI;QAC5B,GAAGF,KAAA;QACHC,KAAA;QAAA;QAEA,GAAGC,EAAA,CAAGF;MACR,CAAC;IACH;IACA,OAAOH,KAAA,CAAMQ,aAAA,CAAcH,EAAA,EAAIF,KAAK;EACtC;AACF","ignoreList":[]}
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import { useCurrentColor } from "./useCurrentColor.native.js";
3
+ var useGetThemedIcon = function (props) {
4
+ var color = useCurrentColor(props.color);
5
+ return function (el) {
6
+ if (!el) return el;
7
+ if (/* @__PURE__ */React.isValidElement(el)) {
8
+ return /* @__PURE__ */React.cloneElement(el, {
9
+ ...props,
10
+ color,
11
+ // @ts-expect-error
12
+ ...el.props
13
+ });
14
+ }
15
+ return /* @__PURE__ */React.createElement(el, props);
16
+ };
17
+ };
18
+ export { useGetThemedIcon };
19
+ //# sourceMappingURL=useGetThemedIcon.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useCurrentColor","useGetThemedIcon","props","color","el","isValidElement","cloneElement","createElement"],"sources":["../../src/useGetThemedIcon.tsx"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,KAAA,MAAW;AAElB,SAASC,eAAA,QAAuB;AAEzB,IAAAC,gBAAM,YAAAA,CAAoBC,KAA8C;EAC7E,IAAAC,KAAM,GAAAH,eAAQ,CAAAE,KAAgB,CAAAC,KAAM;EACpC,OAAO,UAAaC,EAAA;IAClB,IAAI,CAACA,EAAA,EAAI,OAAOA,EAAA;IAChB,IAAI,eAAML,KAAe,CAAAM,cAAK,CAAAD,EAAA;MAC5B,OAAO,eAAML,KAAa,CAAAO,YAAI,CAAAF,EAAA;QAC5B,GAAGF,KAAA;QACHC,KAAA;QAAA;QAEA,GAAGC,EAAA,CAAGF;MACR,CAAC;IACH;IACA,OAAO,eAAMH,KAAc,CAAAQ,aAAS,CAAAH,EAAA,EAAAF,KAAA;EACtC;AACF","ignoreList":[]}
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@hanzogui/component-helpers",
3
+ "version": "2.0.0-rc.41-hanzoai.5",
4
+ "source": "src/index.ts",
5
+ "files": [
6
+ "src",
7
+ "types",
8
+ "dist"
9
+ ],
10
+ "type": "module",
11
+ "sideEffects": false,
12
+ "main": "dist/cjs",
13
+ "module": "dist/esm",
14
+ "types": "./types/index.d.ts",
15
+ "exports": {
16
+ "./package.json": "./package.json",
17
+ ".": {
18
+ "types": "./types/index.d.ts",
19
+ "react-native": "./dist/esm/index.native.js",
20
+ "browser": "./dist/esm/index.mjs",
21
+ "module": "./dist/esm/index.mjs",
22
+ "import": "./dist/esm/index.mjs",
23
+ "require": "./dist/cjs/index.cjs",
24
+ "default": "./dist/esm/index.mjs"
25
+ }
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "scripts": {
31
+ "build": "hanzogui-build",
32
+ "watch": "hanzogui-build --watch",
33
+ "clean": "hanzogui-build clean",
34
+ "clean:build": "hanzogui-build clean:build"
35
+ },
36
+ "dependencies": {
37
+ "@hanzogui/helpers": "2.0.0-rc.41-hanzoai.5",
38
+ "@hanzogui/web": "2.0.0-rc.41-hanzoai.5"
39
+ },
40
+ "devDependencies": {
41
+ "@hanzogui/build": "2.0.0-rc.41-hanzoai.5",
42
+ "react": ">=19",
43
+ "react-native": "0.83.2",
44
+ "vitest": "4.0.4"
45
+ },
46
+ "peerDependencies": {
47
+ "react": ">=19",
48
+ "react-native": "*"
49
+ }
50
+ }
@@ -0,0 +1,20 @@
1
+ import React from 'react'
2
+
3
+ export const getIcon = (
4
+ el: any,
5
+ props: {
6
+ size?: number
7
+ color?: string
8
+ style?: Record<string, any>
9
+ }
10
+ ) => {
11
+ if (!el) return el
12
+ if (React.isValidElement(el)) {
13
+ return React.cloneElement(el, {
14
+ ...props,
15
+ // @ts-expect-error
16
+ ...el.props,
17
+ })
18
+ }
19
+ return React.createElement(el, props)
20
+ }
package/src/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ export * from '@hanzogui/helpers'
2
+ export * from './prevent'
3
+ export * from './useCurrentColor'
4
+ export * from './useGetThemedIcon'
5
+ export * from './getIcon'
@@ -0,0 +1 @@
1
+ export const prevent = (e) => [e.preventDefault(), e.stopPropagation()]
@@ -0,0 +1,18 @@
1
+ import type { ColorTokens, UnionableString, Variable } from '@hanzogui/web'
2
+ import { getVariable, useTheme } from '@hanzogui/web'
3
+ import type { TextStyle } from 'react-native'
4
+
5
+ export const useCurrentColor = (colorProp: ColorProp) => {
6
+ const theme = useTheme()
7
+ const out = colorProp
8
+ ? getVariable(colorProp)
9
+ : theme[colorProp as any]?.get() || theme.color?.get()
10
+ return out
11
+ }
12
+
13
+ export type ColorProp =
14
+ | UnionableString
15
+ | Variable
16
+ | ColorTokens
17
+ | TextStyle['color']
18
+ | undefined
@@ -0,0 +1,19 @@
1
+ import React from 'react'
2
+ import type { ColorProp } from './useCurrentColor'
3
+ import { useCurrentColor } from './useCurrentColor'
4
+
5
+ export const useGetThemedIcon = (props: { color: ColorProp; size: number }) => {
6
+ const color = useCurrentColor(props.color)
7
+ return (el: any) => {
8
+ if (!el) return el
9
+ if (React.isValidElement(el)) {
10
+ return React.cloneElement(el, {
11
+ ...props,
12
+ color,
13
+ // @ts-expect-error
14
+ ...el.props,
15
+ })
16
+ }
17
+ return React.createElement(el, props)
18
+ }
19
+ }
@@ -0,0 +1,6 @@
1
+ export declare const getIcon: (el: any, props: {
2
+ size?: number;
3
+ color?: string;
4
+ style?: Record<string, any>;
5
+ }) => any;
6
+ //# sourceMappingURL=getIcon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getIcon.d.ts","sourceRoot":"","sources":["../src/getIcon.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,GAClB,IAAI,GAAG,EACP,OAAO;IACL,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC5B,QAWF,CAAA"}
@@ -0,0 +1,6 @@
1
+ export * from '@hanzogui/helpers';
2
+ export * from './prevent';
3
+ export * from './useCurrentColor';
4
+ export * from './useGetThemedIcon';
5
+ export * from './getIcon';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,WAAW,CAAA;AACzB,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,WAAW,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const prevent: (e: any) => any[];
2
+ //# sourceMappingURL=prevent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prevent.d.ts","sourceRoot":"","sources":["../src/prevent.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,GAAI,MAAC,UAA8C,CAAA"}
@@ -0,0 +1,5 @@
1
+ import type { ColorTokens, UnionableString, Variable } from '@hanzogui/web';
2
+ import type { TextStyle } from 'react-native';
3
+ export declare const useCurrentColor: (colorProp: ColorProp) => any;
4
+ export type ColorProp = UnionableString | Variable | ColorTokens | TextStyle['color'] | undefined;
5
+ //# sourceMappingURL=useCurrentColor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCurrentColor.d.ts","sourceRoot":"","sources":["../src/useCurrentColor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAE3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,eAAO,MAAM,eAAe,GAAI,WAAW,SAAS,QAMnD,CAAA;AAED,MAAM,MAAM,SAAS,GACjB,eAAe,GACf,QAAQ,GACR,WAAW,GACX,SAAS,CAAC,OAAO,CAAC,GAClB,SAAS,CAAA"}
@@ -0,0 +1,6 @@
1
+ import type { ColorProp } from './useCurrentColor';
2
+ export declare const useGetThemedIcon: (props: {
3
+ color: ColorProp;
4
+ size: number;
5
+ }) => (el: any) => any;
6
+ //# sourceMappingURL=useGetThemedIcon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGetThemedIcon.d.ts","sourceRoot":"","sources":["../src/useGetThemedIcon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAGlD,eAAO,MAAM,gBAAgB,GAAI,OAAO;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,MAEhE,IAAI,GAAG,QAYhB,CAAA"}