@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.
@@ -1,18 +1,17 @@
1
+
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
6
  var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
- get: () => from[key],
9
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
- });
11
- }
12
- return to;
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
9
+ get: () => from[key],
10
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
+ });
12
+ }
13
+ return to;
13
14
  };
14
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
15
- value: true
16
- }), mod);
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
17
16
  var 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
- if (from && typeof from === "object" || typeof from === "function") {
9
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
- get: () => from[key],
11
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
- });
13
- }
14
- return to;
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
11
+ get: () => from[key],
12
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
13
+ });
14
+ }
15
+ return to;
15
16
  };
16
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
17
- value: true
18
- }), mod);
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
18
  var IconProps_exports = {};
20
19
  module.exports = __toCommonJS(IconProps_exports);
20
+
21
21
  //# sourceMappingURL=IconProps.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","IconProps_exports"],"sources":["../../src/IconProps.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,iBAAA","ignoreList":[]}
1
+ {"version":3,"file":"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"}
@@ -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
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
8
- get: () => from[key],
9
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
10
- });
11
- }
12
- return to;
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
9
+ get: () => from[key],
10
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
+ });
12
+ }
13
+ return to;
13
14
  };
14
15
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
16
- value: true
17
- }), mod);
16
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
17
  var index_exports = {};
19
18
  module.exports = __toCommonJS(index_exports);
20
19
  __reExport(index_exports, require("./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);
@@ -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
- if (from && typeof from === "object" || typeof from === "function") {
9
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
- get: () => from[key],
11
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
- });
13
- }
14
- return to;
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
11
+ get: () => from[key],
12
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
13
+ });
14
+ }
15
+ return to;
15
16
  };
16
17
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
18
- value: true
19
- }), mod);
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
19
  var index_exports = {};
21
20
  module.exports = __toCommonJS(index_exports);
22
21
  __reExport(index_exports, require("./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,"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,wBADd,GAAAH,MAAA,CAAAC,OAAA","ignoreList":[]}
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"}
@@ -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
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
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
- 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;
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 import_sizable_context = require("@tamagui/sizable-context");
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
- const opts = {
40
- defaultThemeColor: process.env.DEFAULT_ICON_THEME_COLOR || "$color",
41
- defaultStrokeWidth: 2,
42
- fallbackColor: "#000",
43
- resolveValues: process.env.TAMAGUI_ICON_COLOR_RESOLVE || "auto",
44
- ...optsIn
45
- };
46
- const IconWrapper = propsIn => {
47
- const styledContext = import_sizable_context.SizableContext.useStyledContext();
48
- const needsMedia = needsFullStyleResolution(propsIn);
49
- const [props, style, theme] = (0, import_core.usePropsAndStyle)(propsIn, {
50
- ...opts,
51
- forComponent: import_core.Text,
52
- resolveValues: opts.resolveValues,
53
- noMedia: !needsMedia
54
- });
55
- const defaultColor = opts.defaultThemeColor;
56
- const colorIn = style.color || (defaultColor ? theme[defaultColor] : void 0) || (!props.disableTheme ? theme.color : null) || opts.fallbackColor;
57
- const color = (0, import_core.getVariable)(colorIn);
58
- const size = typeof props.size === "string" ? (0, import_core.getTokenValue)(props.size, "size") : props.size || (styledContext.size === "$true" ? void 0 : styledContext.size);
59
- const strokeWidth = typeof props.strokeWidth === "string" ? (0, import_core.getTokenValue)(props.strokeWidth, "size") : props.strokeWidth ?? `${opts.defaultStrokeWidth}`;
60
- const finalProps = {
61
- ...props,
62
- color,
63
- size,
64
- strokeWidth,
65
- style
66
- };
67
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(Component, {
68
- ...finalProps
69
- });
70
- };
71
- const wrapped = propsIn => {
72
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(IconWrapper, {
73
- ...propsIn
74
- });
75
- };
76
- wrapped["staticConfig"] = {
77
- isHOC: true,
78
- acceptsClassName: true
79
- };
80
- return wrapped;
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
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
12
13
  };
13
14
  var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
21
22
  };
22
- var __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 import_sizable_context = require("@tamagui/sizable-context");
34
- function needsFullStyleResolution(props) {
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
- var optsIn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
42
- var opts = {
43
- defaultThemeColor: process.env.DEFAULT_ICON_THEME_COLOR || "$color",
44
- defaultStrokeWidth: 2,
45
- fallbackColor: "#000",
46
- resolveValues: process.env.TAMAGUI_ICON_COLOR_RESOLVE || "auto",
47
- ...optsIn
48
- };
49
- var IconWrapper = function (propsIn) {
50
- var styledContext = import_sizable_context.SizableContext.useStyledContext();
51
- var needsMedia = needsFullStyleResolution(propsIn);
52
- var [props, style, theme] = (0, import_core.usePropsAndStyle)(propsIn, {
53
- ...opts,
54
- forComponent: import_core.Text,
55
- resolveValues: opts.resolveValues,
56
- noMedia: !needsMedia
57
- });
58
- var defaultColor = opts.defaultThemeColor;
59
- var colorIn = style.color || (defaultColor ? theme[defaultColor] : void 0) || (!props.disableTheme ? theme.color : null) || opts.fallbackColor;
60
- var color = (0, import_core.getVariable)(colorIn);
61
- var size = typeof props.size === "string" ? (0, import_core.getTokenValue)(props.size, "size") : props.size || (styledContext.size === "$true" ? void 0 : styledContext.size);
62
- var _props_strokeWidth;
63
- var strokeWidth = typeof props.strokeWidth === "string" ? (0, import_core.getTokenValue)(props.strokeWidth, "size") : (_props_strokeWidth = props.strokeWidth) !== null && _props_strokeWidth !== void 0 ? _props_strokeWidth : `${opts.defaultStrokeWidth}`;
64
- var finalProps = {
65
- ...props,
66
- color,
67
- size,
68
- strokeWidth,
69
- style
70
- };
71
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(Component, {
72
- ...finalProps
73
- });
74
- };
75
- var wrapped = function (propsIn) {
76
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(IconWrapper, {
77
- ...propsIn
78
- });
79
- };
80
- wrapped["staticConfig"] = {
81
- isHOC: true,
82
- acceptsClassName: true
83
- };
84
- return wrapped;
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,"names":["__toCommonJS","mod","__copyProps","__defProp","value","themed_exports","__export","SizableContext","import_sizable_context","themed","module","exports","import_jsx_runtime","require","import_core","needsFullStyleResolution","props","key","Component","optsIn","arguments","length","opts","defaultThemeColor","process","env","DEFAULT_ICON_THEME_COLOR","defaultStrokeWidth","fallbackColor","resolveValues","TAMAGUI_ICON_COLOR_RESOLVE","IconWrapper","propsIn","styledContext","useStyledContext","needsMedia","style","theme","usePropsAndStyle","forComponent","Text","noMedia","defaultColor","colorIn","color","disableTheme","getVariable","size","getTokenValue","_props_strokeWidth","strokeWidth","finalProps","jsx","wrapped"],"sources":["../../src/themed.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,cAAA;AAAAC,QAAA,CAAAD,cAAA;EAAAE,cAAA,EAAAA,CAAA,KAAAC,sBAAA,CAAAD,cAAA;EAAAE,MAAA,EAAAA,CAAA,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AAAH,OAAA,CAAgB;IAI/B,IAAAI,IAAM,UAAA/B,KAAa,CAAA+B,IAAA,oBAAAjC,WAAA,CAAAkC,aAAA,EAAAhC,KAAA,CAAA+B,IAAA,YAAA/B,KAAA,CAAA+B,IAAA,KAAAd,aAAA,CAAAc,IAAA,wBAAAd,aAAA,CAAAc,IAAA;IAAA,IACjBE,kBAAG;IAAA,IACHC,WAAA,UAAAlC,KAAA,CAAAkC,WAAA,oBAAApC,WAAA,CAAAkC,aAAA,EAAAhC,KAAA,CAAAkC,WAAA,aAAAD,kBAAA,GAAAjC,KAAA,CAAAkC,WAAA,cAAAD,kBAAA,cAAAA,kBAAA,MAAA3B,IAAA,CAAAK,kBAAA;IAAA,IACAwB,UAAA;MACA,GAAAnC,KAAA;MACA4B,KAAA;MACFG,IAAA;MAEAG,WAAO;MACTd;IAEA;IACE,OAAO,mBAAAxB,kBAAA,CAAAwC,GAAA,EAAClC,SAAA;MACV,GAAAiC;IAGA;EAA0B;EACjB,IACPE,OAAA,YAAAA,CAAkBrB,OAAA;IACpB,0BAAApB,kBAAA,CAAAwC,GAAA,EAAArB,WAAA;MAEA,GAAOC;IACT","ignoreList":[]}
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,qB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AAI,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"}
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=IconProps.mjs.map
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=IconProps.native.js.map
package/dist/esm/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export * from "./IconProps.mjs";
2
- export * from "./themed.mjs";
3
- //# sourceMappingURL=index.js.map
1
+ export * from "./IconProps.mjs"
2
+
3
+ export * from "./themed.mjs"
@@ -1,3 +1,3 @@
1
- export * from "./IconProps.mjs";
2
- export * from "./themed.mjs";
3
- //# sourceMappingURL=index.mjs.map
1
+ export * from "./IconProps.mjs"
2
+
3
+ export * from "./themed.mjs"
@@ -1,3 +1,3 @@
1
- export * from "./IconProps.native.js";
2
- export * from "./themed.native.js";
3
- //# sourceMappingURL=index.native.js.map
1
+ export * from "./IconProps.native.js"
2
+
3
+ export * from "./themed.native.js"
@@ -1,55 +1,54 @@
1
- import { getTokenValue, getVariable, Text, usePropsAndStyle } from "@tamagui/core";
2
- import { SizableContext } from "@tamagui/sizable-context";
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
- function needsFullStyleResolution(props) {
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
- const opts = {
12
- defaultThemeColor: process.env.DEFAULT_ICON_THEME_COLOR || "$color",
13
- defaultStrokeWidth: 2,
14
- fallbackColor: "#000",
15
- resolveValues: process.env.TAMAGUI_ICON_COLOR_RESOLVE || "auto",
16
- ...optsIn
17
- };
18
- const IconWrapper = propsIn => {
19
- const styledContext = SizableContext.useStyledContext();
20
- const needsMedia = needsFullStyleResolution(propsIn);
21
- const [props, style, theme] = usePropsAndStyle(propsIn, {
22
- ...opts,
23
- forComponent: Text,
24
- resolveValues: opts.resolveValues,
25
- noMedia: !needsMedia
26
- });
27
- const defaultColor = opts.defaultThemeColor;
28
- const colorIn = style.color || (defaultColor ? theme[defaultColor] : void 0) || (!props.disableTheme ? theme.color : null) || opts.fallbackColor;
29
- const color = getVariable(colorIn);
30
- const size = typeof props.size === "string" ? getTokenValue(props.size, "size") : props.size || (styledContext.size === "$true" ? void 0 : styledContext.size);
31
- const strokeWidth = typeof props.strokeWidth === "string" ? getTokenValue(props.strokeWidth, "size") : props.strokeWidth ?? `${opts.defaultStrokeWidth}`;
32
- const finalProps = {
33
- ...props,
34
- color,
35
- size,
36
- strokeWidth,
37
- style
38
- };
39
- return /* @__PURE__ */jsx(Component, {
40
- ...finalProps
41
- });
42
- };
43
- const wrapped = propsIn => {
44
- return /* @__PURE__ */jsx(IconWrapper, {
45
- ...propsIn
46
- });
47
- };
48
- wrapped["staticConfig"] = {
49
- isHOC: true,
50
- acceptsClassName: true
51
- };
52
- return wrapped;
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
- export { SizableContext, themed };
52
+
53
+ export { themed };
55
54
  //# sourceMappingURL=themed.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["getTokenValue","getVariable","Text","usePropsAndStyle","SizableContext","jsx","needsFullStyleResolution","props","key","themed","Component","optsIn","opts","defaultThemeColor","process","env","DEFAULT_ICON_THEME_COLOR","defaultStrokeWidth","fallbackColor","resolveValues","TAMAGUI_ICON_COLOR_RESOLVE","IconWrapper","propsIn","styledContext","useStyledContext","needsMedia","style","theme","forComponent","noMedia","defaultColor","colorIn","color","disableTheme","size","strokeWidth","finalProps","wrapped","isHOC","acceptsClassName"],"sources":["../../src/themed.tsx"],"sourcesContent":[null],"mappings":"AAAA,SACEA,aAAA,EACAC,WAAA,EACAC,IAAA,EACAC,gBAAA,QAEK;AACP,SAASC,cAAA,QAAsB;AAuEpB,SAAAC,GAAA;AAvDX,SAASC,yBAAyBC,KAAA,EAA2B;EAC3D,WAAWC,GAAA,IAAOD,KAAA,EAAO;IACvB,IAAIC,GAAA,CAAI,CAAC,MAAM,KAAK,OAAO;EAC7B;EACA,OAAO;AACT;AAEO,SAASC,OAAOC,SAAA,EAA0BC,MAAA,GAAkB,CAAC,GAAG;EACrE,MAAMC,IAAA,GAAgB;IACpBC,iBAAA,EAAmBC,OAAA,CAAQC,GAAA,CAAIC,wBAAA,IAA4B;IAC3DC,kBAAA,EAAoB;IACpBC,aAAA,EAAe;IACfC,aAAA,EAAgBL,OAAA,CAAQC,GAAA,CAAIK,0BAAA,IAAsC;IAClE,GAAGT;EACL;EAEA,MAAMU,WAAA,GAAeC,OAAA,IAAuB;IAC1C,MAAMC,aAAA,GAAgBnB,cAAA,CAAeoB,gBAAA,CAAiB;IACtD,MAAMC,UAAA,GAAanB,wBAAA,CAAyBgB,OAAO;IAEnD,MAAM,CAACf,KAAA,EAAOmB,KAAA,EAAOC,KAAK,IAAIxB,gBAAA,CAAiB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":[],"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 as _jsx } from "react/jsx-runtime";
2
- import { getTokenValue, getVariable, Text, usePropsAndStyle } from "@tamagui/core";
3
- import { SizableContext } from "@tamagui/sizable-context";
4
- function needsFullStyleResolution(props) {
5
- for (var key in props) {
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
- var optsIn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
12
- var opts = {
13
- defaultThemeColor: process.env.DEFAULT_ICON_THEME_COLOR || "$color",
14
- defaultStrokeWidth: 2,
15
- fallbackColor: "#000",
16
- resolveValues: process.env.TAMAGUI_ICON_COLOR_RESOLVE || "auto",
17
- ...optsIn
18
- };
19
- var IconWrapper = function (propsIn) {
20
- var styledContext = SizableContext.useStyledContext();
21
- var needsMedia = needsFullStyleResolution(propsIn);
22
- var [props, style, theme] = usePropsAndStyle(propsIn, {
23
- ...opts,
24
- forComponent: Text,
25
- resolveValues: opts.resolveValues,
26
- noMedia: !needsMedia
27
- });
28
- var defaultColor = opts.defaultThemeColor;
29
- var colorIn = style.color || (defaultColor ? theme[defaultColor] : void 0) || (!props.disableTheme ? theme.color : null) || opts.fallbackColor;
30
- var color = getVariable(colorIn);
31
- var size = typeof props.size === "string" ? getTokenValue(props.size, "size") : props.size || (styledContext.size === "$true" ? void 0 : styledContext.size);
32
- var _props_strokeWidth;
33
- var strokeWidth = typeof props.strokeWidth === "string" ? getTokenValue(props.strokeWidth, "size") : (_props_strokeWidth = props.strokeWidth) !== null && _props_strokeWidth !== void 0 ? _props_strokeWidth : `${opts.defaultStrokeWidth}`;
34
- var finalProps = {
35
- ...props,
36
- color,
37
- size,
38
- strokeWidth,
39
- style
40
- };
41
- return /* @__PURE__ */_jsx(Component, {
42
- ...finalProps
43
- });
44
- };
45
- var wrapped = function (propsIn) {
46
- return /* @__PURE__ */_jsx(IconWrapper, {
47
- ...propsIn
48
- });
49
- };
50
- wrapped["staticConfig"] = {
51
- isHOC: true,
52
- acceptsClassName: true
53
- };
54
- return wrapped;
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
- export { SizableContext, themed };
53
+
54
+ export { themed };
57
55
  //# sourceMappingURL=themed.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["jsx","_jsx","getTokenValue","getVariable","Text","usePropsAndStyle","SizableContext","needsFullStyleResolution","props","key","themed","Component","optsIn","arguments","length","opts","defaultThemeColor","process","env","DEFAULT_ICON_THEME_COLOR","defaultStrokeWidth","fallbackColor","resolveValues","TAMAGUI_ICON_COLOR_RESOLVE","IconWrapper","propsIn","styledContext","useStyledContext","needsMedia","style","theme","forComponent","noMedia","defaultColor","colorIn","color","disableTheme","size","_props_strokeWidth","strokeWidth","finalProps","wrapped","isHOC","accepts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,IAAA,YAAA7B,KAAA,CAAA6B,IAAA,KAAAX,aAAA,CAAAW,IAAA,wBAAAX,aAAA,CAAAW,IAAA;IAED,IAAAC,kBAAqB;IAErB,IAAAC,WAAM,GACJ,OAAM/B,KAAA,CAAA+B,WACL,KAAe,QAAM,GAAArC,aAA0B,CAAAM,KAAA,CAAA+B,WACxC,aAAAD,kBAA6B,GAAA9B,KACrC,CAAA+B,WAAK,cAAAD,kBAAA,cAAAA,kBAAA,MAAAvB,IAAA,CAAAK,kBAAA;IAEP,IAAAoB,UAAc;MAEd,GAAAhC,KAAM;MAKN2B,KAAM;MAKNE,IAAM;MACJE,WAAG;MACHV;IAAA;IACA,OACA,eAAA5B,IAAA,CAAAU,SAAA;MACA,GAAA6B;IACF;EAEA;EACF,IAAAC,OAAA,YAAAA,CAAAhB,OAAA;IAEA,OAAM,eAAWxB,IAAuB,CAAAuB,WAAA;MACtC,GAAAC;IACF;EAGA;EAA0BgB,OACxB,eAAO;IACPC,KAAA;IACFC,gBAAA;EAEA;EACF,OAAAF,OAAA","ignoreList":[]}
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,I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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": "2.7.7",
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": "2.7.7",
37
- "@tamagui/sizable-context": "2.7.7"
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": "2.7.7",
41
+ "@tamagui/build": "3.0.0-beta.643.1",
41
42
  "react": ">=19",
42
- "react-native-svg": "15.15.3"
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
- Text,
5
- usePropsAndStyle,
4
+ isWeb,
5
+ useTheme,
6
+ type FontSizeTokens,
6
7
  type ResolveVariableAs,
7
8
  } from '@tamagui/core'
8
- import { SizableContext } from '@tamagui/sizable-context'
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 || '$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 = SizableContext.useStyledContext()
42
- const needsMedia = needsFullStyleResolution(propsIn)
43
-
44
- const [props, style, theme] = usePropsAndStyle(propsIn, {
45
- ...opts,
46
- forComponent: Text,
47
- resolveValues: opts.resolveValues,
48
- noMedia: !needsMedia,
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 defaultColor = opts.defaultThemeColor
56
+ const fillResolved = resolveSvgColor(fillProp)
57
+ const strokeResolved = resolveSvgColor(strokeProp)
58
+ const colorResolved = resolveSvgColor(colorProp)
52
59
 
53
60
  const colorIn =
54
- style.color ||
55
- (defaultColor ? theme[defaultColor as string] : undefined) ||
56
- (!props.disableTheme ? theme.color : null) ||
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 props.size === 'string'
63
- ? getTokenValue(props.size as any, 'size')
64
- : props.size || (styledContext.size === '$true' ? undefined : styledContext.size)
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 props.strokeWidth === 'string'
68
- ? getTokenValue(props.strokeWidth as any, 'size')
69
- : (props.strokeWidth ?? `${opts.defaultStrokeWidth}`)
82
+ typeof strokeWidthProp === 'string'
83
+ ? getTokenValue(strokeWidthProp as any, 'size')
84
+ : (strokeWidthProp ?? `${opts.defaultStrokeWidth}`)
70
85
 
71
86
  const finalProps = {
72
- ...props,
87
+ ...rest,
73
88
  color,
74
89
  size,
75
90
  strokeWidth,
76
- style: style as any,
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/jsx-runtime").JSX.Element;
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
@@ -1 +1 @@
1
- {"version":3,"file":"themed.d.ts","sourceRoot":"","sources":["../src/themed.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAEzD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,OAAO,EAAE,cAAc,EAAE,CAAA;AAEzB,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;AAUD,wBAAgB,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,GAAE,OAAY;cAmDzC,SAAS;;;;;EAWpC"}
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":[]}
@@ -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":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc;AACd,cAAc","ignoreList":[]}