@tamagui/helpers-tamagui 3.0.0-beta.922.1 → 3.0.0
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/useGetThemedIcon.cjs +3 -1
- package/dist/cjs/useGetThemedIcon.native.cjs +3 -1
- package/dist/cjs/useGetThemedIcon.native.js +3 -1
- package/dist/cjs/useGetThemedIcon.native.js.map +1 -1
- package/dist/esm/useGetThemedIcon.mjs +3 -1
- package/dist/esm/useGetThemedIcon.mjs.map +1 -1
- package/dist/esm/useGetThemedIcon.native.js +3 -1
- package/dist/esm/useGetThemedIcon.native.js.map +1 -1
- package/package.json +10 -7
- package/src/useCurrentColor.tsx +1 -1
- package/src/useGetThemedIcon.tsx +5 -3
- package/types/useCurrentColor.d.ts +1 -1
- package/types/useCurrentColor.d.ts.map +1 -1
- package/types/useGetThemedIcon.d.ts +2 -2
- package/types/useGetThemedIcon.d.ts.map +1 -1
|
@@ -28,7 +28,9 @@ var import_font_size = require("@tamagui/font-size");
|
|
|
28
28
|
var import_getIcon = require("./getIcon.cjs");
|
|
29
29
|
var import_useCurrentColor = require("./useCurrentColor.cjs");
|
|
30
30
|
const getThemedIconSize = (size, scaleIcon = 1) => {
|
|
31
|
-
|
|
31
|
+
if (typeof size === "number") return size * scaleIcon;
|
|
32
|
+
if (typeof size === "string") return (0, import_font_size.getFontSize)(size) * scaleIcon;
|
|
33
|
+
return 16 * scaleIcon;
|
|
32
34
|
};
|
|
33
35
|
const useGetThemedIcon = (props) => {
|
|
34
36
|
const color = (0, import_useCurrentColor.useCurrentColor)(props.color);
|
|
@@ -31,7 +31,9 @@ var import_getIcon = require("./getIcon.native.js");
|
|
|
31
31
|
var import_useCurrentColor = require("./useCurrentColor.native.js");
|
|
32
32
|
var getThemedIconSize = function(size) {
|
|
33
33
|
var scaleIcon = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
|
|
34
|
-
|
|
34
|
+
if (typeof size === "number") return size * scaleIcon;
|
|
35
|
+
if (typeof size === "string") return (0, import_font_size.getFontSize)(size) * scaleIcon;
|
|
36
|
+
return 16 * scaleIcon;
|
|
35
37
|
};
|
|
36
38
|
var useGetThemedIcon = function(props) {
|
|
37
39
|
var color = (0, import_useCurrentColor.useCurrentColor)(props.color);
|
|
@@ -31,7 +31,9 @@ var import_getIcon = require("./getIcon.native.js");
|
|
|
31
31
|
var import_useCurrentColor = require("./useCurrentColor.native.js");
|
|
32
32
|
var getThemedIconSize = function(size) {
|
|
33
33
|
var scaleIcon = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
|
|
34
|
-
|
|
34
|
+
if (typeof size === "number") return size * scaleIcon;
|
|
35
|
+
if (typeof size === "string") return (0, import_font_size.getFontSize)(size) * scaleIcon;
|
|
36
|
+
return 16 * scaleIcon;
|
|
35
37
|
};
|
|
36
38
|
var useGetThemedIcon = function(props) {
|
|
37
39
|
var color = (0, import_useCurrentColor.useCurrentColor)(props.color);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetThemedIcon.native.js","names":[],"sources":["cjs/useGetThemedIcon.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 useGetThemedIcon_exports = {};\n__export(useGetThemedIcon_exports, {\n getThemedIconSize: () => getThemedIconSize,\n useGetThemedIcon: () => useGetThemedIcon\n});\nmodule.exports = __toCommonJS(useGetThemedIcon_exports);\nvar import_font_size = require(\"@tamagui/font-size\");\nvar import_getIcon = require(\"./getIcon\");\nvar import_useCurrentColor = require(\"./useCurrentColor\");\nvar getThemedIconSize = function(size) {\n var scaleIcon = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;\n
|
|
1
|
+
{"version":3,"file":"useGetThemedIcon.native.js","names":[],"sources":["cjs/useGetThemedIcon.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 useGetThemedIcon_exports = {};\n__export(useGetThemedIcon_exports, {\n getThemedIconSize: () => getThemedIconSize,\n useGetThemedIcon: () => useGetThemedIcon\n});\nmodule.exports = __toCommonJS(useGetThemedIcon_exports);\nvar import_font_size = require(\"@tamagui/font-size\");\nvar import_getIcon = require(\"./getIcon\");\nvar import_useCurrentColor = require(\"./useCurrentColor\");\nvar getThemedIconSize = function(size) {\n var scaleIcon = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;\n if (typeof size === \"number\") return size * scaleIcon;\n if (typeof size === \"string\") return (0, import_font_size.getFontSize)(size) * scaleIcon;\n return 16 * scaleIcon;\n};\nvar useGetThemedIcon = function(props) {\n var color = (0, import_useCurrentColor.useCurrentColor)(props.color);\n return function(el) {\n return (0, import_getIcon.getIcon)(el, {\n ...props,\n color\n });\n };\n};\n//# sourceMappingURL=useGetThemedIcon.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,2BAA2B,CAAC;AAChC,SAAS,0BAA0B;CACjC,yBAAyB;CACzB,wBAAwB;AAC1B,CAAC;AACD,OAAO,UAAU,aAAa,wBAAwB;AACtD,IAAI,mBAAmB,QAAQ,oBAAoB;AACnD,IAAI,iBAAiB,QAAQ,qBAAW;AACxC,IAAI,yBAAyB,QAAQ,6BAAmB;AACxD,IAAI,oBAAoB,SAAS,MAAM;CACrC,IAAI,YAAY,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK;CACjF,IAAI,OAAO,SAAS,UAAU,OAAO,OAAO;CAC5C,IAAI,OAAO,SAAS,UAAU,QAAQ,GAAG,iBAAiB,YAAW,CAAE,IAAI,IAAI;CAC/E,OAAO,KAAK;AACd;AACA,IAAI,mBAAmB,SAAS,OAAO;CACrC,IAAI,SAAS,GAAG,uBAAuB,gBAAe,CAAE,MAAM,KAAK;CACnE,OAAO,SAAS,IAAI;EAClB,QAAQ,GAAG,eAAe,QAAO,CAAE,IAAI;GACrC,GAAG;GACH;EACF,CAAC;CACH;AACF"}
|
|
@@ -3,7 +3,9 @@ import { getIcon } from "./getIcon.mjs";
|
|
|
3
3
|
import { useCurrentColor } from "./useCurrentColor.mjs";
|
|
4
4
|
|
|
5
5
|
const getThemedIconSize = (size, scaleIcon = 1) => {
|
|
6
|
-
|
|
6
|
+
if (typeof size === "number") return size * scaleIcon;
|
|
7
|
+
if (typeof size === "string") return getFontSize(size) * scaleIcon;
|
|
8
|
+
return 16 * scaleIcon;
|
|
7
9
|
};
|
|
8
10
|
const useGetThemedIcon = (props) => {
|
|
9
11
|
const color = useCurrentColor(props.color);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetThemedIcon.js","names":[],"sources":["esm/useGetThemedIcon.js"],"sourcesContent":["import { getFontSize } from \"@tamagui/font-size\";\nimport { getIcon } from \"./getIcon\";\nimport { useCurrentColor } from \"./useCurrentColor\";\nconst getThemedIconSize = (size, scaleIcon = 1) => {\n
|
|
1
|
+
{"version":3,"file":"useGetThemedIcon.js","names":[],"sources":["esm/useGetThemedIcon.js"],"sourcesContent":["import { getFontSize } from \"@tamagui/font-size\";\nimport { getIcon } from \"./getIcon\";\nimport { useCurrentColor } from \"./useCurrentColor\";\nconst getThemedIconSize = (size, scaleIcon = 1) => {\n if (typeof size === \"number\") return size * scaleIcon;\n if (typeof size === \"string\") return getFontSize(size) * scaleIcon;\n return 16 * scaleIcon;\n};\nconst useGetThemedIcon = (props) => {\n const color = useCurrentColor(props.color);\n return (el) => {\n return getIcon(el, {\n ...props,\n color\n });\n };\n};\nexport {\n getThemedIconSize,\n useGetThemedIcon\n};\n//# sourceMappingURL=useGetThemedIcon.js.map\n"],"mappings":";;;;;AAGA,MAAM,qBAAqB,MAAM,YAAY,MAAM;CACjD,IAAI,OAAO,SAAS,UAAU,OAAO,OAAO;CAC5C,IAAI,OAAO,SAAS,UAAU,OAAO,YAAY,IAAI,IAAI;CACzD,OAAO,KAAK;AACd;AACA,MAAM,oBAAoB,UAAU;CAClC,MAAM,QAAQ,gBAAgB,MAAM,KAAK;CACzC,QAAQ,OAAO;EACb,OAAO,QAAQ,IAAI;GACjB,GAAG;GACH;EACF,CAAC;CACH;AACF"}
|
|
@@ -4,7 +4,9 @@ import { useCurrentColor } from "./useCurrentColor.native.js";
|
|
|
4
4
|
|
|
5
5
|
var getThemedIconSize = function(size) {
|
|
6
6
|
var scaleIcon = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
|
|
7
|
-
|
|
7
|
+
if (typeof size === "number") return size * scaleIcon;
|
|
8
|
+
if (typeof size === "string") return getFontSize(size) * scaleIcon;
|
|
9
|
+
return 16 * scaleIcon;
|
|
8
10
|
};
|
|
9
11
|
var useGetThemedIcon = function(props) {
|
|
10
12
|
var color = useCurrentColor(props.color);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetThemedIcon.native.js","names":[],"sources":["esm/useGetThemedIcon.native.js"],"sourcesContent":["import { getFontSize } from \"@tamagui/font-size\";\nimport { getIcon } from \"./getIcon\";\nimport { useCurrentColor } from \"./useCurrentColor\";\nvar getThemedIconSize = function(size) {\n var scaleIcon = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;\n
|
|
1
|
+
{"version":3,"file":"useGetThemedIcon.native.js","names":[],"sources":["esm/useGetThemedIcon.native.js"],"sourcesContent":["import { getFontSize } from \"@tamagui/font-size\";\nimport { getIcon } from \"./getIcon\";\nimport { useCurrentColor } from \"./useCurrentColor\";\nvar getThemedIconSize = function(size) {\n var scaleIcon = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;\n if (typeof size === \"number\") return size * scaleIcon;\n if (typeof size === \"string\") return getFontSize(size) * scaleIcon;\n return 16 * scaleIcon;\n};\nvar useGetThemedIcon = function(props) {\n var color = useCurrentColor(props.color);\n return function(el) {\n return getIcon(el, {\n ...props,\n color\n });\n };\n};\nexport {\n getThemedIconSize,\n useGetThemedIcon\n};\n//# sourceMappingURL=useGetThemedIcon.js.map\n"],"mappings":";;;;;AAGA,IAAI,oBAAoB,SAAS,MAAM;CACrC,IAAI,YAAY,UAAU,SAAS,KAAK,UAAU,OAAO,KAAK,IAAI,UAAU,KAAK;CACjF,IAAI,OAAO,SAAS,UAAU,OAAO,OAAO;CAC5C,IAAI,OAAO,SAAS,UAAU,OAAO,YAAY,IAAI,IAAI;CACzD,OAAO,KAAK;AACd;AACA,IAAI,mBAAmB,SAAS,OAAO;CACrC,IAAI,QAAQ,gBAAgB,MAAM,KAAK;CACvC,OAAO,SAAS,IAAI;EAClB,OAAO,QAAQ,IAAI;GACjB,GAAG;GACH;EACF,CAAC;CACH;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/helpers-tamagui",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"license": "MIT",
|
|
4
5
|
"source": "src/index.ts",
|
|
5
6
|
"files": [
|
|
6
7
|
"src",
|
|
@@ -34,14 +35,15 @@
|
|
|
34
35
|
"clean:build": "tamagui-build clean:build"
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
|
-
"@tamagui/
|
|
38
|
-
"@tamagui/
|
|
39
|
-
"@tamagui/web": "3.0.0
|
|
38
|
+
"@tamagui/helpers": "3.0.0",
|
|
39
|
+
"@tamagui/react-native-types": "3.0.0",
|
|
40
|
+
"@tamagui/web": "3.0.0",
|
|
41
|
+
"@tamagui/font-size": "3.0.0"
|
|
40
42
|
},
|
|
41
43
|
"devDependencies": {
|
|
42
|
-
"@tamagui/build": "3.0.0
|
|
44
|
+
"@tamagui/build": "3.0.0",
|
|
43
45
|
"react": "19.2.3",
|
|
44
|
-
"react-native": "0.
|
|
46
|
+
"react-native": "0.87.1",
|
|
45
47
|
"vitest": "4.1.0"
|
|
46
48
|
},
|
|
47
49
|
"peerDependencies": {
|
|
@@ -51,5 +53,6 @@
|
|
|
51
53
|
"type": "git",
|
|
52
54
|
"url": "git+https://github.com/tamagui/tamagui.git",
|
|
53
55
|
"directory": "code/core/helpers-tamagui"
|
|
54
|
-
}
|
|
56
|
+
},
|
|
57
|
+
"releaseSourceCommit": "15fbca480b143f876f6975601e23a17d3f90d2ee"
|
|
55
58
|
}
|
package/src/useCurrentColor.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ColorTokens, UnionableString, Variable } from '@tamagui/web'
|
|
2
2
|
import { getVariable, useTheme } from '@tamagui/web'
|
|
3
|
-
import type { TextStyle } from 'react-native'
|
|
3
|
+
import type { TextStyle } from '@tamagui/react-native-types'
|
|
4
4
|
|
|
5
5
|
export const useCurrentColor = (colorProp: ColorProp) => {
|
|
6
6
|
const theme = useTheme()
|
package/src/useGetThemedIcon.tsx
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { getFontSize } from '@tamagui/font-size'
|
|
2
|
-
import type { SizeTokens, Token } from '@tamagui/web'
|
|
3
2
|
|
|
4
3
|
import { getIcon } from './getIcon'
|
|
5
4
|
import type { ColorProp } from './useCurrentColor'
|
|
6
5
|
import { useCurrentColor } from './useCurrentColor'
|
|
7
6
|
|
|
7
|
+
/** icon px for a size: numbers are px, strings are font size keys, else the 16px default */
|
|
8
8
|
export const getThemedIconSize = (
|
|
9
|
-
size:
|
|
9
|
+
size: string | number | boolean | null | undefined,
|
|
10
10
|
scaleIcon = 1
|
|
11
11
|
) => {
|
|
12
|
-
|
|
12
|
+
if (typeof size === 'number') return size * scaleIcon
|
|
13
|
+
if (typeof size === 'string') return getFontSize(size as any) * scaleIcon
|
|
14
|
+
return 16 * scaleIcon
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
export const useGetThemedIcon = (props: { color: ColorProp; size?: number }) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ColorTokens, UnionableString, Variable } from '@tamagui/web';
|
|
2
|
-
import type { TextStyle } from 'react-native';
|
|
2
|
+
import type { TextStyle } from '@tamagui/react-native-types';
|
|
3
3
|
export declare const useCurrentColor: (colorProp: ColorProp) => any;
|
|
4
4
|
export type ColorProp = UnionableString | Variable | ColorTokens | TextStyle['color'] | undefined;
|
|
5
5
|
//# sourceMappingURL=useCurrentColor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCurrentColor.d.ts","sourceRoot":"","sources":["../src/useCurrentColor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useCurrentColor.d.ts","sourceRoot":"","sources":["../src/useCurrentColor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAE5D,eAAO,MAAM,eAAe,cAAe,SAAS,QAMnD,CAAA;AAED,MAAM,MAAM,SAAS,GACjB,eAAe,GACf,QAAQ,GACR,WAAW,GACX,SAAS,CAAC,OAAO,CAAC,GAClB,SAAS,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { SizeTokens } from '@tamagui/web';
|
|
2
1
|
import type { ColorProp } from './useCurrentColor';
|
|
3
|
-
|
|
2
|
+
/** icon px for a size: numbers are px, strings are font size keys, else the 16px default */
|
|
3
|
+
export declare const getThemedIconSize: (size: string | number | boolean | null | undefined, scaleIcon?: number) => number;
|
|
4
4
|
export declare const useGetThemedIcon: (props: {
|
|
5
5
|
color: ColorProp;
|
|
6
6
|
size?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetThemedIcon.d.ts","sourceRoot":"","sources":["../src/useGetThemedIcon.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useGetThemedIcon.d.ts","sourceRoot":"","sources":["../src/useGetThemedIcon.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAGlD,4FAA4F;AAC5F,eAAO,MAAM,iBAAiB,SACtB,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,+BAMnD,CAAA;AAED,eAAO,MAAM,gBAAgB,UAAW;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,UAE7D,GAAG,QAMhB,CAAA"}
|