@tamagui/helpers-icon 2.7.7 → 3.0.0-beta.643.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.
- package/dist/cjs/IconProps.cjs +10 -11
- package/dist/cjs/IconProps.native.cjs +19 -0
- package/dist/cjs/IconProps.native.js +10 -10
- package/dist/cjs/IconProps.native.js.map +1 -1
- package/dist/cjs/index.cjs +10 -11
- package/dist/cjs/index.native.cjs +22 -0
- package/dist/cjs/index.native.js +10 -10
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/themed.cjs +61 -68
- package/dist/cjs/themed.native.cjs +77 -0
- package/dist/cjs/themed.native.js +62 -69
- package/dist/cjs/themed.native.js.map +1 -1
- package/dist/esm/IconProps.mjs +0 -2
- package/dist/esm/IconProps.native.js +0 -2
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/index.native.js +3 -3
- package/dist/esm/themed.mjs +50 -51
- package/dist/esm/themed.mjs.map +1 -1
- package/dist/esm/themed.native.js +52 -54
- package/dist/esm/themed.native.js.map +1 -1
- package/package.json +6 -5
- package/src/themed.tsx +54 -35
- package/types/themed.d.ts +2 -3
- package/types/themed.d.ts.map +1 -1
- package/dist/esm/IconProps.mjs.map +0 -1
- package/dist/esm/IconProps.native.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
package/dist/cjs/IconProps.cjs
CHANGED
|
@@ -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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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 IconProps_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(IconProps_exports);
|
|
17
|
+
module.exports = __toCommonJS(IconProps_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 IconProps_exports = {};
|
|
19
|
+
module.exports = __toCommonJS(IconProps_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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 IconProps_exports = {};
|
|
20
19
|
module.exports = __toCommonJS(IconProps_exports);
|
|
20
|
+
|
|
21
21
|
//# sourceMappingURL=IconProps.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"IconProps.native.js","names":[],"sources":["cjs/IconProps.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 IconProps_exports = {};\nmodule.exports = __toCommonJS(IconProps_exports);\n//# sourceMappingURL=IconProps.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"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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("./IconProps.cjs"), module.exports);
|
|
21
|
-
__reExport(index_exports, require("./themed.cjs"), module.exports);
|
|
20
|
+
__reExport(index_exports, require("./themed.cjs"), module.exports);
|
|
@@ -0,0 +1,22 @@
|
|
|
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("./IconProps.native.js"), module.exports);
|
|
22
|
+
__reExport(index_exports, require("./themed.native.js"), module.exports);
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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("./IconProps.native.js"), module.exports);
|
|
23
22
|
__reExport(index_exports, require("./themed.native.js"), module.exports);
|
|
23
|
+
|
|
24
24
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.native.js","names":[],"sources":["cjs/index.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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"./IconProps\"), module.exports);\n__reExport(index_exports, require(\"./themed\"), module.exports);\n//# sourceMappingURL=index.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,cAAc,QAAQ,KAAK,kBAAkB,YAAY,QAAQ,KAAK,SAAS,GAAG,gBAAgB,YAAY,cAAc,KAAK,SAAS;AAC9I,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,OAAO,UAAU,aAAa,aAAa;AAC3C,WAAW,eAAe,QAAQ,uBAAa,GAAG,OAAO,OAAO;AAChE,WAAW,eAAe,QAAQ,oBAAU,GAAG,OAAO,OAAO"}
|
package/dist/cjs/themed.cjs
CHANGED
|
@@ -1,81 +1,74 @@
|
|
|
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 __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
for (var name in all) __defProp(target, name, {
|
|
8
|
+
get: all[name],
|
|
9
|
+
enumerable: true
|
|
10
|
+
});
|
|
10
11
|
};
|
|
11
12
|
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
19
20
|
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: true
|
|
22
|
-
}), mod);
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
22
|
var themed_exports = {};
|
|
24
|
-
__export(themed_exports, {
|
|
25
|
-
SizableContext: () => import_sizable_context.SizableContext,
|
|
26
|
-
themed: () => themed
|
|
27
|
-
});
|
|
23
|
+
__export(themed_exports, { themed: () => themed });
|
|
28
24
|
module.exports = __toCommonJS(themed_exports);
|
|
29
25
|
var import_core = require("@tamagui/core");
|
|
30
|
-
var
|
|
26
|
+
var import_font_size = require("@tamagui/font-size");
|
|
27
|
+
var import_size = require("@tamagui/size");
|
|
31
28
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
-
function needsFullStyleResolution(props) {
|
|
33
|
-
for (const key in props) {
|
|
34
|
-
if (key[0] === "$") return true;
|
|
35
|
-
}
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
29
|
function themed(Component, optsIn = {}) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
30
|
+
const opts = {
|
|
31
|
+
defaultThemeColor: process.env.DEFAULT_ICON_THEME_COLOR || "color",
|
|
32
|
+
defaultStrokeWidth: 2,
|
|
33
|
+
fallbackColor: "#000",
|
|
34
|
+
resolveValues: process.env.TAMAGUI_ICON_COLOR_RESOLVE || "auto",
|
|
35
|
+
...optsIn
|
|
36
|
+
};
|
|
37
|
+
const IconWrapper = (propsIn) => {
|
|
38
|
+
const styledContext = import_size.SizeContext.useStyledContext();
|
|
39
|
+
const theme = (0, import_core.useTheme)();
|
|
40
|
+
const { size: sizeProp, strokeWidth: strokeWidthProp, color: colorProp, fill: fillProp, stroke: strokeProp, disableTheme, style, testID, ...rest } = propsIn;
|
|
41
|
+
const resolveSvgColor = (val) => {
|
|
42
|
+
if (typeof val !== "string") return val;
|
|
43
|
+
const themed2 = theme?.[val];
|
|
44
|
+
if (themed2 != null) return (0, import_core.getVariable)(themed2);
|
|
45
|
+
return (0, import_core.getVariable)(val, "color");
|
|
46
|
+
};
|
|
47
|
+
const fillResolved = resolveSvgColor(fillProp);
|
|
48
|
+
const strokeResolved = resolveSvgColor(strokeProp);
|
|
49
|
+
const colorResolved = resolveSvgColor(colorProp);
|
|
50
|
+
const colorIn = strokeResolved || colorResolved || (opts.defaultThemeColor ? theme[opts.defaultThemeColor] : void 0) || (!disableTheme ? theme.color : null) || opts.fallbackColor;
|
|
51
|
+
const color = (0, import_core.getVariable)(colorIn);
|
|
52
|
+
const size = typeof sizeProp === "number" ? sizeProp : typeof sizeProp === "string" ? (0, import_font_size.getFontSize)(sizeProp) : styledContext.size != null ? (0, import_font_size.getFontSize)(styledContext.size) : void 0;
|
|
53
|
+
const strokeWidth = typeof strokeWidthProp === "string" ? (0, import_core.getTokenValue)(strokeWidthProp, "size") : strokeWidthProp ?? `${opts.defaultStrokeWidth}`;
|
|
54
|
+
const finalProps = {
|
|
55
|
+
...rest,
|
|
56
|
+
color,
|
|
57
|
+
size,
|
|
58
|
+
strokeWidth,
|
|
59
|
+
...fillResolved !== void 0 ? { fill: fillResolved } : null,
|
|
60
|
+
...strokeResolved !== void 0 ? { stroke: strokeResolved } : null,
|
|
61
|
+
...style ? { style } : null,
|
|
62
|
+
...testID != null ? import_core.isWeb ? { "data-testid": testID } : { testID } : null
|
|
63
|
+
};
|
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ...finalProps });
|
|
65
|
+
};
|
|
66
|
+
const wrapped = (propsIn) => {
|
|
67
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconWrapper, { ...propsIn });
|
|
68
|
+
};
|
|
69
|
+
wrapped["staticConfig"] = {
|
|
70
|
+
isHOC: true,
|
|
71
|
+
acceptsClassName: true
|
|
72
|
+
};
|
|
73
|
+
return wrapped;
|
|
74
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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 __export = (target, all) => {
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
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;
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var themed_exports = {};
|
|
25
|
+
__export(themed_exports, { themed: () => themed });
|
|
26
|
+
module.exports = __toCommonJS(themed_exports);
|
|
27
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
+
var import_core = require("@tamagui/core");
|
|
29
|
+
var import_font_size = require("@tamagui/font-size");
|
|
30
|
+
var import_size = require("@tamagui/size");
|
|
31
|
+
function themed(Component) {
|
|
32
|
+
var optsIn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
33
|
+
var opts = {
|
|
34
|
+
defaultThemeColor: process.env.DEFAULT_ICON_THEME_COLOR || "color",
|
|
35
|
+
defaultStrokeWidth: 2,
|
|
36
|
+
fallbackColor: "#000",
|
|
37
|
+
resolveValues: process.env.TAMAGUI_ICON_COLOR_RESOLVE || "auto",
|
|
38
|
+
...optsIn
|
|
39
|
+
};
|
|
40
|
+
var IconWrapper = function(propsIn) {
|
|
41
|
+
var styledContext = import_size.SizeContext.useStyledContext();
|
|
42
|
+
var theme = (0, import_core.useTheme)();
|
|
43
|
+
var { size: sizeProp, strokeWidth: strokeWidthProp, color: colorProp, fill: fillProp, stroke: strokeProp, disableTheme, style, testID, ...rest } = propsIn;
|
|
44
|
+
var resolveSvgColor = function(val) {
|
|
45
|
+
if (typeof val !== "string") return val;
|
|
46
|
+
var themed2 = theme === null || theme === void 0 ? void 0 : theme[val];
|
|
47
|
+
if (themed2 != null) return (0, import_core.getVariable)(themed2);
|
|
48
|
+
return (0, import_core.getVariable)(val, "color");
|
|
49
|
+
};
|
|
50
|
+
var fillResolved = resolveSvgColor(fillProp);
|
|
51
|
+
var strokeResolved = resolveSvgColor(strokeProp);
|
|
52
|
+
var colorResolved = resolveSvgColor(colorProp);
|
|
53
|
+
var colorIn = strokeResolved || colorResolved || (opts.defaultThemeColor ? theme[opts.defaultThemeColor] : void 0) || (!disableTheme ? theme.color : null) || opts.fallbackColor;
|
|
54
|
+
var color = (0, import_core.getVariable)(colorIn);
|
|
55
|
+
var size = typeof sizeProp === "number" ? sizeProp : typeof sizeProp === "string" ? (0, import_font_size.getFontSize)(sizeProp) : styledContext.size != null ? (0, import_font_size.getFontSize)(styledContext.size) : void 0;
|
|
56
|
+
var strokeWidth = typeof strokeWidthProp === "string" ? (0, import_core.getTokenValue)(strokeWidthProp, "size") : strokeWidthProp !== null && strokeWidthProp !== void 0 ? strokeWidthProp : `${opts.defaultStrokeWidth}`;
|
|
57
|
+
var finalProps = {
|
|
58
|
+
...rest,
|
|
59
|
+
color,
|
|
60
|
+
size,
|
|
61
|
+
strokeWidth,
|
|
62
|
+
...fillResolved !== void 0 ? { fill: fillResolved } : null,
|
|
63
|
+
...strokeResolved !== void 0 ? { stroke: strokeResolved } : null,
|
|
64
|
+
...style ? { style } : null,
|
|
65
|
+
...testID != null ? import_core.isWeb ? { "data-testid": testID } : { testID } : null
|
|
66
|
+
};
|
|
67
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ...finalProps });
|
|
68
|
+
};
|
|
69
|
+
var wrapped = function(propsIn) {
|
|
70
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconWrapper, { ...propsIn });
|
|
71
|
+
};
|
|
72
|
+
wrapped["staticConfig"] = {
|
|
73
|
+
isHOC: true,
|
|
74
|
+
acceptsClassName: true
|
|
75
|
+
};
|
|
76
|
+
return wrapped;
|
|
77
|
+
}
|
|
@@ -1,86 +1,79 @@
|
|
|
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 __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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 __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
-
value: true
|
|
24
|
-
}), mod);
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
24
|
var themed_exports = {};
|
|
26
|
-
__export(themed_exports, {
|
|
27
|
-
SizableContext: () => import_sizable_context.SizableContext,
|
|
28
|
-
themed: () => themed
|
|
29
|
-
});
|
|
25
|
+
__export(themed_exports, { themed: () => themed });
|
|
30
26
|
module.exports = __toCommonJS(themed_exports);
|
|
31
27
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
28
|
var import_core = require("@tamagui/core");
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
for (var key in props) {
|
|
36
|
-
if (key[0] === "$") return true;
|
|
37
|
-
}
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
29
|
+
var import_font_size = require("@tamagui/font-size");
|
|
30
|
+
var import_size = require("@tamagui/size");
|
|
40
31
|
function themed(Component) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
32
|
+
var optsIn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
33
|
+
var opts = {
|
|
34
|
+
defaultThemeColor: process.env.DEFAULT_ICON_THEME_COLOR || "color",
|
|
35
|
+
defaultStrokeWidth: 2,
|
|
36
|
+
fallbackColor: "#000",
|
|
37
|
+
resolveValues: process.env.TAMAGUI_ICON_COLOR_RESOLVE || "auto",
|
|
38
|
+
...optsIn
|
|
39
|
+
};
|
|
40
|
+
var IconWrapper = function(propsIn) {
|
|
41
|
+
var styledContext = import_size.SizeContext.useStyledContext();
|
|
42
|
+
var theme = (0, import_core.useTheme)();
|
|
43
|
+
var { size: sizeProp, strokeWidth: strokeWidthProp, color: colorProp, fill: fillProp, stroke: strokeProp, disableTheme, style, testID, ...rest } = propsIn;
|
|
44
|
+
var resolveSvgColor = function(val) {
|
|
45
|
+
if (typeof val !== "string") return val;
|
|
46
|
+
var themed2 = theme === null || theme === void 0 ? void 0 : theme[val];
|
|
47
|
+
if (themed2 != null) return (0, import_core.getVariable)(themed2);
|
|
48
|
+
return (0, import_core.getVariable)(val, "color");
|
|
49
|
+
};
|
|
50
|
+
var fillResolved = resolveSvgColor(fillProp);
|
|
51
|
+
var strokeResolved = resolveSvgColor(strokeProp);
|
|
52
|
+
var colorResolved = resolveSvgColor(colorProp);
|
|
53
|
+
var colorIn = strokeResolved || colorResolved || (opts.defaultThemeColor ? theme[opts.defaultThemeColor] : void 0) || (!disableTheme ? theme.color : null) || opts.fallbackColor;
|
|
54
|
+
var color = (0, import_core.getVariable)(colorIn);
|
|
55
|
+
var size = typeof sizeProp === "number" ? sizeProp : typeof sizeProp === "string" ? (0, import_font_size.getFontSize)(sizeProp) : styledContext.size != null ? (0, import_font_size.getFontSize)(styledContext.size) : void 0;
|
|
56
|
+
var strokeWidth = typeof strokeWidthProp === "string" ? (0, import_core.getTokenValue)(strokeWidthProp, "size") : strokeWidthProp !== null && strokeWidthProp !== void 0 ? strokeWidthProp : `${opts.defaultStrokeWidth}`;
|
|
57
|
+
var finalProps = {
|
|
58
|
+
...rest,
|
|
59
|
+
color,
|
|
60
|
+
size,
|
|
61
|
+
strokeWidth,
|
|
62
|
+
...fillResolved !== void 0 ? { fill: fillResolved } : null,
|
|
63
|
+
...strokeResolved !== void 0 ? { stroke: strokeResolved } : null,
|
|
64
|
+
...style ? { style } : null,
|
|
65
|
+
...testID != null ? import_core.isWeb ? { "data-testid": testID } : { testID } : null
|
|
66
|
+
};
|
|
67
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ...finalProps });
|
|
68
|
+
};
|
|
69
|
+
var wrapped = function(propsIn) {
|
|
70
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconWrapper, { ...propsIn });
|
|
71
|
+
};
|
|
72
|
+
wrapped["staticConfig"] = {
|
|
73
|
+
isHOC: true,
|
|
74
|
+
acceptsClassName: true
|
|
75
|
+
};
|
|
76
|
+
return wrapped;
|
|
85
77
|
}
|
|
78
|
+
|
|
86
79
|
//# sourceMappingURL=themed.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"themed.native.js","names":[],"sources":["cjs/themed.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\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 __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar themed_exports = {};\n__export(themed_exports, {\n themed: () => themed\n});\nmodule.exports = __toCommonJS(themed_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_core = require(\"@tamagui/core\");\nvar import_font_size = require(\"@tamagui/font-size\");\nvar import_size = require(\"@tamagui/size\");\nfunction themed(Component) {\n var optsIn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n var opts = {\n defaultThemeColor: process.env.DEFAULT_ICON_THEME_COLOR || \"color\",\n defaultStrokeWidth: 2,\n fallbackColor: \"#000\",\n resolveValues: process.env.TAMAGUI_ICON_COLOR_RESOLVE || \"auto\",\n ...optsIn\n };\n var IconWrapper = function(propsIn) {\n var styledContext = import_size.SizeContext.useStyledContext();\n var theme = (0, import_core.useTheme)();\n var { size: sizeProp, strokeWidth: strokeWidthProp, color: colorProp, fill: fillProp, stroke: strokeProp, disableTheme, style, testID, ...rest } = propsIn;\n var resolveSvgColor = function(val) {\n if (typeof val !== \"string\") return val;\n var themed2 = theme === null || theme === void 0 ? void 0 : theme[val];\n if (themed2 != null) return (0, import_core.getVariable)(themed2);\n return (0, import_core.getVariable)(val, \"color\");\n };\n var fillResolved = resolveSvgColor(fillProp);\n var strokeResolved = resolveSvgColor(strokeProp);\n var colorResolved = resolveSvgColor(colorProp);\n var colorIn = strokeResolved || colorResolved || (opts.defaultThemeColor ? theme[opts.defaultThemeColor] : void 0) || (!disableTheme ? theme.color : null) || opts.fallbackColor;\n var color = (0, import_core.getVariable)(colorIn);\n var size = typeof sizeProp === \"number\" ? sizeProp : typeof sizeProp === \"string\" ? (0, import_font_size.getFontSize)(sizeProp) : styledContext.size != null ? (0, import_font_size.getFontSize)(styledContext.size) : void 0;\n var strokeWidth = typeof strokeWidthProp === \"string\" ? (0, import_core.getTokenValue)(strokeWidthProp, \"size\") : strokeWidthProp !== null && strokeWidthProp !== void 0 ? strokeWidthProp : `${opts.defaultStrokeWidth}`;\n var finalProps = {\n ...rest,\n color,\n size,\n strokeWidth,\n ...fillResolved !== void 0 ? {\n fill: fillResolved\n } : null,\n ...strokeResolved !== void 0 ? {\n stroke: strokeResolved\n } : null,\n ...style ? {\n style\n } : null,\n // tamagui web maps testID -> data-testid; native keeps testID for react-native-svg\n ...testID != null ? import_core.isWeb ? {\n \"data-testid\": testID\n } : {\n testID\n } : null\n };\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {\n ...finalProps\n });\n };\n var wrapped = function(propsIn) {\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconWrapper, {\n ...propsIn\n });\n };\n wrapped[\"staticConfig\"] = {\n isHOC: true,\n acceptsClassName: true\n };\n return wrapped;\n}\n//# sourceMappingURL=themed.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,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,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,iBAAiB,CAAC;AACtB,SAAS,gBAAgB,EACvB,cAAc,OAChB,CAAC;AACD,OAAO,UAAU,aAAa,cAAc;AAC5C,IAAI,qBAAqB,QAAQ,mBAAmB;AACpD,IAAI,cAAc,QAAQ,eAAe;AACzC,IAAI,mBAAmB,QAAQ,oBAAoB;AACnD,IAAI,cAAc,QAAQ,eAAe;AACzC,SAAS,OAAO,WAAW;CACzB,IAAI,SAAS,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK,CAAC;CAC/E,IAAI,OAAO;EACT,mBAAmB,QAAQ,IAAI,4BAA4B;EAC3D,oBAAoB;EACpB,eAAe;EACf,eAAe,QAAQ,IAAI,8BAA8B;EACzD,GAAG;CACL;CACA,IAAI,cAAc,SAAS,SAAS;EAClC,IAAI,gBAAgB,YAAY,YAAY,iBAAiB;EAC7D,IAAI,SAAS,GAAG,YAAY,UAAU;EACtC,IAAI,EAAE,MAAM,UAAU,aAAa,iBAAiB,OAAO,WAAW,MAAM,UAAU,QAAQ,YAAY,cAAc,OAAO,QAAQ,GAAG,SAAS;EACnJ,IAAI,kBAAkB,SAAS,KAAK;GAClC,IAAI,OAAO,QAAQ,UAAU,OAAO;GACpC,IAAI,UAAU,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,MAAM;GAClE,IAAI,WAAW,MAAM,QAAQ,GAAG,YAAY,aAAa,OAAO;GAChE,QAAQ,GAAG,YAAY,aAAa,KAAK,OAAO;EAClD;EACA,IAAI,eAAe,gBAAgB,QAAQ;EAC3C,IAAI,iBAAiB,gBAAgB,UAAU;EAC/C,IAAI,gBAAgB,gBAAgB,SAAS;EAC7C,IAAI,UAAU,kBAAkB,kBAAkB,KAAK,oBAAoB,MAAM,KAAK,qBAAqB,KAAK,OAAO,CAAC,eAAe,MAAM,QAAQ,SAAS,KAAK;EACnK,IAAI,SAAS,GAAG,YAAY,aAAa,OAAO;EAChD,IAAI,OAAO,OAAO,aAAa,WAAW,WAAW,OAAO,aAAa,YAAY,GAAG,iBAAiB,aAAa,QAAQ,IAAI,cAAc,QAAQ,QAAQ,GAAG,iBAAiB,aAAa,cAAc,IAAI,IAAI,KAAK;EAC5N,IAAI,cAAc,OAAO,oBAAoB,YAAY,GAAG,YAAY,eAAe,iBAAiB,MAAM,IAAI,oBAAoB,QAAQ,oBAAoB,KAAK,IAAI,kBAAkB,GAAG,KAAK;EACrM,IAAI,aAAa;GACf,GAAG;GACH;GACA;GACA;GACA,GAAG,iBAAiB,KAAK,IAAI,EAC3B,MAAM,aACR,IAAI;GACJ,GAAG,mBAAmB,KAAK,IAAI,EAC7B,QAAQ,eACV,IAAI;GACJ,GAAG,QAAQ,EACT,MACF,IAAI;GAEJ,GAAG,UAAU,OAAO,YAAY,QAAQ,EACtC,eAAe,OACjB,IAAI,EACF,OACF,IAAI;EACN;EACA,OAAuB,iBAAC,GAAG,mBAAmB,KAAK,WAAW,EAC5D,GAAG,WACL,CAAC;CACH;CACA,IAAI,UAAU,SAAS,SAAS;EAC9B,OAAuB,iBAAC,GAAG,mBAAmB,KAAK,aAAa,EAC9D,GAAG,QACL,CAAC;CACH;CACA,QAAQ,kBAAkB;EACxB,OAAO;EACP,kBAAkB;CACpB;CACA,OAAO;AACT"}
|
package/dist/esm/IconProps.mjs
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./IconProps.mjs"
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export * from "./IconProps.mjs"
|
|
2
|
+
|
|
3
|
+
export * from "./themed.mjs"
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./IconProps.mjs"
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export * from "./IconProps.mjs"
|
|
2
|
+
|
|
3
|
+
export * from "./themed.mjs"
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./IconProps.native.js"
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export * from "./IconProps.native.js"
|
|
2
|
+
|
|
3
|
+
export * from "./themed.native.js"
|
package/dist/esm/themed.mjs
CHANGED
|
@@ -1,55 +1,54 @@
|
|
|
1
|
-
import { getTokenValue, getVariable,
|
|
2
|
-
import {
|
|
1
|
+
import { getTokenValue, getVariable, isWeb, useTheme } from "@tamagui/core";
|
|
2
|
+
import { getFontSize } from "@tamagui/font-size";
|
|
3
|
+
import { SizeContext } from "@tamagui/size";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
5
|
-
for (const key in props) {
|
|
6
|
-
if (key[0] === "$") return true;
|
|
7
|
-
}
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
5
|
+
|
|
10
6
|
function themed(Component, optsIn = {}) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
7
|
+
const opts = {
|
|
8
|
+
defaultThemeColor: process.env.DEFAULT_ICON_THEME_COLOR || "color",
|
|
9
|
+
defaultStrokeWidth: 2,
|
|
10
|
+
fallbackColor: "#000",
|
|
11
|
+
resolveValues: process.env.TAMAGUI_ICON_COLOR_RESOLVE || "auto",
|
|
12
|
+
...optsIn
|
|
13
|
+
};
|
|
14
|
+
const IconWrapper = (propsIn) => {
|
|
15
|
+
const styledContext = SizeContext.useStyledContext();
|
|
16
|
+
const theme = useTheme();
|
|
17
|
+
const { size: sizeProp, strokeWidth: strokeWidthProp, color: colorProp, fill: fillProp, stroke: strokeProp, disableTheme, style, testID, ...rest } = propsIn;
|
|
18
|
+
const resolveSvgColor = (val) => {
|
|
19
|
+
if (typeof val !== "string") return val;
|
|
20
|
+
const themed2 = theme?.[val];
|
|
21
|
+
if (themed2 != null) return getVariable(themed2);
|
|
22
|
+
return getVariable(val, "color");
|
|
23
|
+
};
|
|
24
|
+
const fillResolved = resolveSvgColor(fillProp);
|
|
25
|
+
const strokeResolved = resolveSvgColor(strokeProp);
|
|
26
|
+
const colorResolved = resolveSvgColor(colorProp);
|
|
27
|
+
const colorIn = strokeResolved || colorResolved || (opts.defaultThemeColor ? theme[opts.defaultThemeColor] : void 0) || (!disableTheme ? theme.color : null) || opts.fallbackColor;
|
|
28
|
+
const color = getVariable(colorIn);
|
|
29
|
+
const size = typeof sizeProp === "number" ? sizeProp : typeof sizeProp === "string" ? getFontSize(sizeProp) : styledContext.size != null ? getFontSize(styledContext.size) : void 0;
|
|
30
|
+
const strokeWidth = typeof strokeWidthProp === "string" ? getTokenValue(strokeWidthProp, "size") : strokeWidthProp ?? `${opts.defaultStrokeWidth}`;
|
|
31
|
+
const finalProps = {
|
|
32
|
+
...rest,
|
|
33
|
+
color,
|
|
34
|
+
size,
|
|
35
|
+
strokeWidth,
|
|
36
|
+
...fillResolved !== void 0 ? { fill: fillResolved } : null,
|
|
37
|
+
...strokeResolved !== void 0 ? { stroke: strokeResolved } : null,
|
|
38
|
+
...style ? { style } : null,
|
|
39
|
+
...testID != null ? isWeb ? { "data-testid": testID } : { testID } : null
|
|
40
|
+
};
|
|
41
|
+
return /* @__PURE__ */ jsx(Component, { ...finalProps });
|
|
42
|
+
};
|
|
43
|
+
const wrapped = (propsIn) => {
|
|
44
|
+
return /* @__PURE__ */ jsx(IconWrapper, { ...propsIn });
|
|
45
|
+
};
|
|
46
|
+
wrapped["staticConfig"] = {
|
|
47
|
+
isHOC: true,
|
|
48
|
+
acceptsClassName: true
|
|
49
|
+
};
|
|
50
|
+
return wrapped;
|
|
53
51
|
}
|
|
54
|
-
|
|
52
|
+
|
|
53
|
+
export { themed };
|
|
55
54
|
//# sourceMappingURL=themed.mjs.map
|
package/dist/esm/themed.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"themed.js","names":[],"sources":["esm/themed.js"],"sourcesContent":["import {\n getTokenValue,\n getVariable,\n isWeb,\n useTheme\n} from \"@tamagui/core\";\nimport { getFontSize } from \"@tamagui/font-size\";\nimport { SizeContext } from \"@tamagui/size\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction themed(Component, optsIn = {}) {\n const opts = {\n defaultThemeColor: process.env.DEFAULT_ICON_THEME_COLOR || \"color\",\n defaultStrokeWidth: 2,\n fallbackColor: \"#000\",\n resolveValues: process.env.TAMAGUI_ICON_COLOR_RESOLVE || \"auto\",\n ...optsIn\n };\n const IconWrapper = (propsIn) => {\n const styledContext = SizeContext.useStyledContext();\n const theme = useTheme();\n const {\n size: sizeProp,\n strokeWidth: strokeWidthProp,\n color: colorProp,\n fill: fillProp,\n stroke: strokeProp,\n disableTheme,\n style,\n testID,\n ...rest\n } = propsIn;\n const resolveSvgColor = (val) => {\n if (typeof val !== \"string\") return val;\n const themed2 = theme?.[val];\n if (themed2 != null) return getVariable(themed2);\n return getVariable(val, \"color\");\n };\n const fillResolved = resolveSvgColor(fillProp);\n const strokeResolved = resolveSvgColor(strokeProp);\n const colorResolved = resolveSvgColor(colorProp);\n const colorIn = strokeResolved || colorResolved || (opts.defaultThemeColor ? theme[opts.defaultThemeColor] : void 0) || (!disableTheme ? theme.color : null) || opts.fallbackColor;\n const color = getVariable(colorIn);\n const size = typeof sizeProp === \"number\" ? sizeProp : typeof sizeProp === \"string\" ? getFontSize(sizeProp) : styledContext.size != null ? getFontSize(styledContext.size) : void 0;\n const strokeWidth = typeof strokeWidthProp === \"string\" ? getTokenValue(strokeWidthProp, \"size\") : strokeWidthProp ?? `${opts.defaultStrokeWidth}`;\n const finalProps = {\n ...rest,\n color,\n size,\n strokeWidth,\n ...fillResolved !== void 0 ? { fill: fillResolved } : null,\n ...strokeResolved !== void 0 ? { stroke: strokeResolved } : null,\n ...style ? { style } : null,\n // tamagui web maps testID -> data-testid; native keeps testID for react-native-svg\n ...testID != null ? isWeb ? { \"data-testid\": testID } : { testID } : null\n };\n return /* @__PURE__ */ jsx(Component, { ...finalProps });\n };\n const wrapped = (propsIn) => {\n return /* @__PURE__ */ jsx(IconWrapper, { ...propsIn });\n };\n wrapped[\"staticConfig\"] = {\n isHOC: true,\n acceptsClassName: true\n };\n return wrapped;\n}\nexport {\n themed\n};\n//# sourceMappingURL=themed.js.map\n"],"mappings":";;;;;;AASA,SAAS,OAAO,WAAW,SAAS,CAAC,GAAG;CACtC,MAAM,OAAO;EACX,mBAAmB,QAAQ,IAAI,4BAA4B;EAC3D,oBAAoB;EACpB,eAAe;EACf,eAAe,QAAQ,IAAI,8BAA8B;EACzD,GAAG;CACL;CACA,MAAM,eAAe,YAAY;EAC/B,MAAM,gBAAgB,YAAY,iBAAiB;EACnD,MAAM,QAAQ,SAAS;EACvB,MAAM,EACJ,MAAM,UACN,aAAa,iBACb,OAAO,WACP,MAAM,UACN,QAAQ,YACR,cACA,OACA,QACA,GAAG,SACD;EACJ,MAAM,mBAAmB,QAAQ;GAC/B,IAAI,OAAO,QAAQ,UAAU,OAAO;GACpC,MAAM,UAAU,QAAQ;GACxB,IAAI,WAAW,MAAM,OAAO,YAAY,OAAO;GAC/C,OAAO,YAAY,KAAK,OAAO;EACjC;EACA,MAAM,eAAe,gBAAgB,QAAQ;EAC7C,MAAM,iBAAiB,gBAAgB,UAAU;EACjD,MAAM,gBAAgB,gBAAgB,SAAS;EAC/C,MAAM,UAAU,kBAAkB,kBAAkB,KAAK,oBAAoB,MAAM,KAAK,qBAAqB,KAAK,OAAO,CAAC,eAAe,MAAM,QAAQ,SAAS,KAAK;EACrK,MAAM,QAAQ,YAAY,OAAO;EACjC,MAAM,OAAO,OAAO,aAAa,WAAW,WAAW,OAAO,aAAa,WAAW,YAAY,QAAQ,IAAI,cAAc,QAAQ,OAAO,YAAY,cAAc,IAAI,IAAI,KAAK;EAClL,MAAM,cAAc,OAAO,oBAAoB,WAAW,cAAc,iBAAiB,MAAM,IAAI,mBAAmB,GAAG,KAAK;EAC9H,MAAM,aAAa;GACjB,GAAG;GACH;GACA;GACA;GACA,GAAG,iBAAiB,KAAK,IAAI,EAAE,MAAM,aAAa,IAAI;GACtD,GAAG,mBAAmB,KAAK,IAAI,EAAE,QAAQ,eAAe,IAAI;GAC5D,GAAG,QAAQ,EAAE,MAAM,IAAI;GAEvB,GAAG,UAAU,OAAO,QAAQ,EAAE,eAAe,OAAO,IAAI,EAAE,OAAO,IAAI;EACvE;EACA,OAAuB,oBAAI,WAAW,EAAE,GAAG,WAAW,CAAC;CACzD;CACA,MAAM,WAAW,YAAY;EAC3B,OAAuB,oBAAI,aAAa,EAAE,GAAG,QAAQ,CAAC;CACxD;CACA,QAAQ,kBAAkB;EACxB,OAAO;EACP,kBAAkB;CACpB;CACA,OAAO;AACT"}
|
|
@@ -1,57 +1,55 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { getTokenValue, getVariable,
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (key[0] === "$") return true;
|
|
7
|
-
}
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getTokenValue, getVariable, isWeb, useTheme } from "@tamagui/core";
|
|
3
|
+
import { getFontSize } from "@tamagui/font-size";
|
|
4
|
+
import { SizeContext } from "@tamagui/size";
|
|
5
|
+
|
|
10
6
|
function themed(Component) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
7
|
+
var optsIn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
8
|
+
var opts = {
|
|
9
|
+
defaultThemeColor: process.env.DEFAULT_ICON_THEME_COLOR || "color",
|
|
10
|
+
defaultStrokeWidth: 2,
|
|
11
|
+
fallbackColor: "#000",
|
|
12
|
+
resolveValues: process.env.TAMAGUI_ICON_COLOR_RESOLVE || "auto",
|
|
13
|
+
...optsIn
|
|
14
|
+
};
|
|
15
|
+
var IconWrapper = function(propsIn) {
|
|
16
|
+
var styledContext = SizeContext.useStyledContext();
|
|
17
|
+
var theme = useTheme();
|
|
18
|
+
var { size: sizeProp, strokeWidth: strokeWidthProp, color: colorProp, fill: fillProp, stroke: strokeProp, disableTheme, style, testID, ...rest } = propsIn;
|
|
19
|
+
var resolveSvgColor = function(val) {
|
|
20
|
+
if (typeof val !== "string") return val;
|
|
21
|
+
var themed2 = theme === null || theme === void 0 ? void 0 : theme[val];
|
|
22
|
+
if (themed2 != null) return getVariable(themed2);
|
|
23
|
+
return getVariable(val, "color");
|
|
24
|
+
};
|
|
25
|
+
var fillResolved = resolveSvgColor(fillProp);
|
|
26
|
+
var strokeResolved = resolveSvgColor(strokeProp);
|
|
27
|
+
var colorResolved = resolveSvgColor(colorProp);
|
|
28
|
+
var colorIn = strokeResolved || colorResolved || (opts.defaultThemeColor ? theme[opts.defaultThemeColor] : void 0) || (!disableTheme ? theme.color : null) || opts.fallbackColor;
|
|
29
|
+
var color = getVariable(colorIn);
|
|
30
|
+
var size = typeof sizeProp === "number" ? sizeProp : typeof sizeProp === "string" ? getFontSize(sizeProp) : styledContext.size != null ? getFontSize(styledContext.size) : void 0;
|
|
31
|
+
var strokeWidth = typeof strokeWidthProp === "string" ? getTokenValue(strokeWidthProp, "size") : strokeWidthProp !== null && strokeWidthProp !== void 0 ? strokeWidthProp : `${opts.defaultStrokeWidth}`;
|
|
32
|
+
var finalProps = {
|
|
33
|
+
...rest,
|
|
34
|
+
color,
|
|
35
|
+
size,
|
|
36
|
+
strokeWidth,
|
|
37
|
+
...fillResolved !== void 0 ? { fill: fillResolved } : null,
|
|
38
|
+
...strokeResolved !== void 0 ? { stroke: strokeResolved } : null,
|
|
39
|
+
...style ? { style } : null,
|
|
40
|
+
...testID != null ? isWeb ? { "data-testid": testID } : { testID } : null
|
|
41
|
+
};
|
|
42
|
+
return /* @__PURE__ */ jsx(Component, { ...finalProps });
|
|
43
|
+
};
|
|
44
|
+
var wrapped = function(propsIn) {
|
|
45
|
+
return /* @__PURE__ */ jsx(IconWrapper, { ...propsIn });
|
|
46
|
+
};
|
|
47
|
+
wrapped["staticConfig"] = {
|
|
48
|
+
isHOC: true,
|
|
49
|
+
acceptsClassName: true
|
|
50
|
+
};
|
|
51
|
+
return wrapped;
|
|
55
52
|
}
|
|
56
|
-
|
|
53
|
+
|
|
54
|
+
export { themed };
|
|
57
55
|
//# sourceMappingURL=themed.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"themed.native.js","names":[],"sources":["esm/themed.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { getTokenValue, getVariable, isWeb, useTheme } from \"@tamagui/core\";\nimport { getFontSize } from \"@tamagui/font-size\";\nimport { SizeContext } from \"@tamagui/size\";\nfunction themed(Component) {\n var optsIn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};\n var opts = {\n defaultThemeColor: process.env.DEFAULT_ICON_THEME_COLOR || \"color\",\n defaultStrokeWidth: 2,\n fallbackColor: \"#000\",\n resolveValues: process.env.TAMAGUI_ICON_COLOR_RESOLVE || \"auto\",\n ...optsIn\n };\n var IconWrapper = function(propsIn) {\n var styledContext = SizeContext.useStyledContext();\n var theme = useTheme();\n var { size: sizeProp, strokeWidth: strokeWidthProp, color: colorProp, fill: fillProp, stroke: strokeProp, disableTheme, style, testID, ...rest } = propsIn;\n var resolveSvgColor = function(val) {\n if (typeof val !== \"string\") return val;\n var themed2 = theme === null || theme === void 0 ? void 0 : theme[val];\n if (themed2 != null) return getVariable(themed2);\n return getVariable(val, \"color\");\n };\n var fillResolved = resolveSvgColor(fillProp);\n var strokeResolved = resolveSvgColor(strokeProp);\n var colorResolved = resolveSvgColor(colorProp);\n var colorIn = strokeResolved || colorResolved || (opts.defaultThemeColor ? theme[opts.defaultThemeColor] : void 0) || (!disableTheme ? theme.color : null) || opts.fallbackColor;\n var color = getVariable(colorIn);\n var size = typeof sizeProp === \"number\" ? sizeProp : typeof sizeProp === \"string\" ? getFontSize(sizeProp) : styledContext.size != null ? getFontSize(styledContext.size) : void 0;\n var strokeWidth = typeof strokeWidthProp === \"string\" ? getTokenValue(strokeWidthProp, \"size\") : strokeWidthProp !== null && strokeWidthProp !== void 0 ? strokeWidthProp : `${opts.defaultStrokeWidth}`;\n var finalProps = {\n ...rest,\n color,\n size,\n strokeWidth,\n ...fillResolved !== void 0 ? {\n fill: fillResolved\n } : null,\n ...strokeResolved !== void 0 ? {\n stroke: strokeResolved\n } : null,\n ...style ? {\n style\n } : null,\n // tamagui web maps testID -> data-testid; native keeps testID for react-native-svg\n ...testID != null ? isWeb ? {\n \"data-testid\": testID\n } : {\n testID\n } : null\n };\n return /* @__PURE__ */ _jsx(Component, {\n ...finalProps\n });\n };\n var wrapped = function(propsIn) {\n return /* @__PURE__ */ _jsx(IconWrapper, {\n ...propsIn\n });\n };\n wrapped[\"staticConfig\"] = {\n isHOC: true,\n acceptsClassName: true\n };\n return wrapped;\n}\nexport {\n themed\n};\n//# sourceMappingURL=themed.js.map\n"],"mappings":";;;;;;AAIA,SAAS,OAAO,WAAW;CACzB,IAAI,SAAS,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK,CAAC;CAC/E,IAAI,OAAO;EACT,mBAAmB,QAAQ,IAAI,4BAA4B;EAC3D,oBAAoB;EACpB,eAAe;EACf,eAAe,QAAQ,IAAI,8BAA8B;EACzD,GAAG;CACL;CACA,IAAI,cAAc,SAAS,SAAS;EAClC,IAAI,gBAAgB,YAAY,iBAAiB;EACjD,IAAI,QAAQ,SAAS;EACrB,IAAI,EAAE,MAAM,UAAU,aAAa,iBAAiB,OAAO,WAAW,MAAM,UAAU,QAAQ,YAAY,cAAc,OAAO,QAAQ,GAAG,SAAS;EACnJ,IAAI,kBAAkB,SAAS,KAAK;GAClC,IAAI,OAAO,QAAQ,UAAU,OAAO;GACpC,IAAI,UAAU,UAAU,QAAQ,UAAU,KAAK,IAAI,KAAK,IAAI,MAAM;GAClE,IAAI,WAAW,MAAM,OAAO,YAAY,OAAO;GAC/C,OAAO,YAAY,KAAK,OAAO;EACjC;EACA,IAAI,eAAe,gBAAgB,QAAQ;EAC3C,IAAI,iBAAiB,gBAAgB,UAAU;EAC/C,IAAI,gBAAgB,gBAAgB,SAAS;EAC7C,IAAI,UAAU,kBAAkB,kBAAkB,KAAK,oBAAoB,MAAM,KAAK,qBAAqB,KAAK,OAAO,CAAC,eAAe,MAAM,QAAQ,SAAS,KAAK;EACnK,IAAI,QAAQ,YAAY,OAAO;EAC/B,IAAI,OAAO,OAAO,aAAa,WAAW,WAAW,OAAO,aAAa,WAAW,YAAY,QAAQ,IAAI,cAAc,QAAQ,OAAO,YAAY,cAAc,IAAI,IAAI,KAAK;EAChL,IAAI,cAAc,OAAO,oBAAoB,WAAW,cAAc,iBAAiB,MAAM,IAAI,oBAAoB,QAAQ,oBAAoB,KAAK,IAAI,kBAAkB,GAAG,KAAK;EACpL,IAAI,aAAa;GACf,GAAG;GACH;GACA;GACA;GACA,GAAG,iBAAiB,KAAK,IAAI,EAC3B,MAAM,aACR,IAAI;GACJ,GAAG,mBAAmB,KAAK,IAAI,EAC7B,QAAQ,eACV,IAAI;GACJ,GAAG,QAAQ,EACT,MACF,IAAI;GAEJ,GAAG,UAAU,OAAO,QAAQ,EAC1B,eAAe,OACjB,IAAI,EACF,OACF,IAAI;EACN;EACA,OAAuB,oBAAK,WAAW,EACrC,GAAG,WACL,CAAC;CACH;CACA,IAAI,UAAU,SAAS,SAAS;EAC9B,OAAuB,oBAAK,aAAa,EACvC,GAAG,QACL,CAAC;CACH;CACA,QAAQ,kBAAkB;EACxB,OAAO;EACP,kBAAkB;CACpB;CACA,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/helpers-icon",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.643.1",
|
|
4
4
|
"description": "Utilities for icon packages",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -33,13 +33,14 @@
|
|
|
33
33
|
"clean:build": "tamagui-build clean:build"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@tamagui/core": "
|
|
37
|
-
"@tamagui/
|
|
36
|
+
"@tamagui/core": "3.0.0-beta.643.1",
|
|
37
|
+
"@tamagui/font-size": "3.0.0-beta.643.1",
|
|
38
|
+
"@tamagui/size": "3.0.0-beta.643.1"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
|
-
"@tamagui/build": "
|
|
41
|
+
"@tamagui/build": "3.0.0-beta.643.1",
|
|
41
42
|
"react": ">=19",
|
|
42
|
-
"react-native-svg": "15.15.
|
|
43
|
+
"react-native-svg": "15.15.4"
|
|
43
44
|
},
|
|
44
45
|
"peerDependencies": {
|
|
45
46
|
"react": ">=19"
|
package/src/themed.tsx
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getTokenValue,
|
|
3
3
|
getVariable,
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
isWeb,
|
|
5
|
+
useTheme,
|
|
6
|
+
type FontSizeTokens,
|
|
6
7
|
type ResolveVariableAs,
|
|
7
8
|
} from '@tamagui/core'
|
|
8
|
-
import {
|
|
9
|
+
import { getFontSize } from '@tamagui/font-size'
|
|
10
|
+
import { SizeContext } from '@tamagui/size'
|
|
9
11
|
|
|
10
12
|
import type { FC } from 'react'
|
|
11
13
|
import type { IconProps } from './IconProps'
|
|
12
14
|
|
|
13
|
-
export { SizableContext }
|
|
14
|
-
|
|
15
15
|
type Options = {
|
|
16
16
|
noClass?: boolean
|
|
17
17
|
defaultThemeColor?: string
|
|
@@ -20,17 +20,9 @@ type Options = {
|
|
|
20
20
|
resolveValues?: ResolveVariableAs
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
// check if props contain media queries ($sm, $md, etc) or other complex tamagui features
|
|
24
|
-
function needsFullStyleResolution(props: IconProps): boolean {
|
|
25
|
-
for (const key in props) {
|
|
26
|
-
if (key[0] === '$') return true
|
|
27
|
-
}
|
|
28
|
-
return false
|
|
29
|
-
}
|
|
30
|
-
|
|
31
23
|
export function themed(Component: FC<IconProps>, optsIn: Options = {}) {
|
|
32
24
|
const opts: Options = {
|
|
33
|
-
defaultThemeColor: process.env.DEFAULT_ICON_THEME_COLOR || '
|
|
25
|
+
defaultThemeColor: process.env.DEFAULT_ICON_THEME_COLOR || 'color',
|
|
34
26
|
defaultStrokeWidth: 2,
|
|
35
27
|
fallbackColor: '#000',
|
|
36
28
|
resolveValues: (process.env.TAMAGUI_ICON_COLOR_RESOLVE as any) || 'auto',
|
|
@@ -38,42 +30,69 @@ export function themed(Component: FC<IconProps>, optsIn: Options = {}) {
|
|
|
38
30
|
}
|
|
39
31
|
|
|
40
32
|
const IconWrapper = (propsIn: IconProps) => {
|
|
41
|
-
const styledContext =
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
33
|
+
const styledContext = SizeContext.useStyledContext()
|
|
34
|
+
const theme = useTheme()
|
|
35
|
+
|
|
36
|
+
const {
|
|
37
|
+
size: sizeProp,
|
|
38
|
+
strokeWidth: strokeWidthProp,
|
|
39
|
+
color: colorProp,
|
|
40
|
+
fill: fillProp,
|
|
41
|
+
stroke: strokeProp,
|
|
42
|
+
disableTheme,
|
|
43
|
+
style,
|
|
44
|
+
testID,
|
|
45
|
+
...rest
|
|
46
|
+
} = propsIn as any
|
|
47
|
+
|
|
48
|
+
// Resolve theme and color tokens config-first; literal colors pass through.
|
|
49
|
+
const resolveSvgColor = (val: unknown) => {
|
|
50
|
+
if (typeof val !== 'string') return val
|
|
51
|
+
const themed = (theme as any)?.[val]
|
|
52
|
+
if (themed != null) return getVariable(themed)
|
|
53
|
+
return getVariable(val, 'color' as any)
|
|
54
|
+
}
|
|
50
55
|
|
|
51
|
-
const
|
|
56
|
+
const fillResolved = resolveSvgColor(fillProp)
|
|
57
|
+
const strokeResolved = resolveSvgColor(strokeProp)
|
|
58
|
+
const colorResolved = resolveSvgColor(colorProp)
|
|
52
59
|
|
|
53
60
|
const colorIn =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
(
|
|
61
|
+
strokeResolved ||
|
|
62
|
+
colorResolved ||
|
|
63
|
+
(opts.defaultThemeColor ? (theme as any)[opts.defaultThemeColor] : undefined) ||
|
|
64
|
+
(!disableTheme ? theme.color : null) ||
|
|
57
65
|
opts.fallbackColor
|
|
58
66
|
|
|
59
67
|
const color = getVariable(colorIn)
|
|
60
68
|
|
|
69
|
+
// v3: icon sizes resolve via the current font's size scale (font.size[token]),
|
|
70
|
+
// so icons visually align with text at each size. raw numbers stay literal.
|
|
71
|
+
// context size (for example from Button/ListItem) resolves the same way.
|
|
61
72
|
const size =
|
|
62
|
-
typeof
|
|
63
|
-
?
|
|
64
|
-
:
|
|
73
|
+
typeof sizeProp === 'number'
|
|
74
|
+
? sizeProp
|
|
75
|
+
: typeof sizeProp === 'string'
|
|
76
|
+
? getFontSize(sizeProp as FontSizeTokens)
|
|
77
|
+
: styledContext.size != null
|
|
78
|
+
? getFontSize(styledContext.size as FontSizeTokens)
|
|
79
|
+
: undefined
|
|
65
80
|
|
|
66
81
|
const strokeWidth =
|
|
67
|
-
typeof
|
|
68
|
-
? getTokenValue(
|
|
69
|
-
: (
|
|
82
|
+
typeof strokeWidthProp === 'string'
|
|
83
|
+
? getTokenValue(strokeWidthProp as any, 'size')
|
|
84
|
+
: (strokeWidthProp ?? `${opts.defaultStrokeWidth}`)
|
|
70
85
|
|
|
71
86
|
const finalProps = {
|
|
72
|
-
...
|
|
87
|
+
...rest,
|
|
73
88
|
color,
|
|
74
89
|
size,
|
|
75
90
|
strokeWidth,
|
|
76
|
-
|
|
91
|
+
...(fillResolved !== undefined ? { fill: fillResolved } : null),
|
|
92
|
+
...(strokeResolved !== undefined ? { stroke: strokeResolved } : null),
|
|
93
|
+
...(style ? { style } : null),
|
|
94
|
+
// tamagui web maps testID -> data-testid; native keeps testID for react-native-svg
|
|
95
|
+
...(testID != null ? (isWeb ? { 'data-testid': testID } : { testID }) : null),
|
|
77
96
|
}
|
|
78
97
|
|
|
79
98
|
return <Component {...finalProps} />
|
package/types/themed.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { type ResolveVariableAs } from '@tamagui/core';
|
|
2
|
-
import { SizableContext } from '@tamagui/sizable-context';
|
|
3
2
|
import type { FC } from 'react';
|
|
4
3
|
import type { IconProps } from './IconProps';
|
|
5
|
-
export { SizableContext };
|
|
6
4
|
type Options = {
|
|
7
5
|
noClass?: boolean;
|
|
8
6
|
defaultThemeColor?: string;
|
|
@@ -11,10 +9,11 @@ type Options = {
|
|
|
11
9
|
resolveValues?: ResolveVariableAs;
|
|
12
10
|
};
|
|
13
11
|
export declare function themed(Component: FC<IconProps>, optsIn?: Options): {
|
|
14
|
-
(propsIn: IconProps): import("react
|
|
12
|
+
(propsIn: IconProps): import("react").JSX.Element;
|
|
15
13
|
staticConfig: {
|
|
16
14
|
isHOC: boolean;
|
|
17
15
|
acceptsClassName: boolean;
|
|
18
16
|
};
|
|
19
17
|
};
|
|
18
|
+
export {};
|
|
20
19
|
//# sourceMappingURL=themed.d.ts.map
|
package/types/themed.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themed.d.ts","sourceRoot":"","sources":["../src/themed.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"themed.d.ts","sourceRoot":"","sources":["../src/themed.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAA;AAItB,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,KAAK,OAAO,GAAG;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,iBAAiB,CAAA;CAClC,CAAA;AAED,wBAAgB,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,GAAE,OAAY;cA8EzC,SAAS;;;;;EAWpC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":[],"sourcesContent":[],"mappings":"","ignoreList":[]}
|
package/dist/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc","ignoreList":[]}
|
package/dist/esm/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc","ignoreList":[]}
|