@tamagui/list-item 3.0.0-beta.1356.1 → 3.0.0-beta.1358.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/ListItem.cjs +7 -1
- package/dist/cjs/ListItem.native.cjs +9 -1
- package/dist/cjs/ListItem.native.js +9 -1
- package/dist/cjs/ListItem.native.js.map +1 -1
- package/dist/esm/ListItem.mjs +8 -2
- package/dist/esm/ListItem.mjs.map +1 -1
- package/dist/esm/ListItem.native.js +10 -2
- package/dist/esm/ListItem.native.js.map +1 -1
- package/dist/jsx/ListItem.mjs +8 -2
- package/dist/jsx/ListItem.mjs.map +1 -1
- package/dist/jsx/ListItem.native.cjs +9 -1
- package/dist/jsx/ListItem.native.js +9 -1
- package/dist/jsx/ListItem.native.js.map +1 -1
- package/package.json +10 -10
- package/src/ListItem.tsx +25 -3
- package/types/ListItem.d.ts +0 -6
- package/types/ListItem.d.ts.map +1 -1
package/dist/cjs/ListItem.cjs
CHANGED
|
@@ -71,6 +71,12 @@ const ListItemTitle = (0, import_web.styled)(ListItemText, {
|
|
|
71
71
|
context: ListItemContext,
|
|
72
72
|
displayName: "ListItemTitle"
|
|
73
73
|
});
|
|
74
|
+
const toIconFontKey = (size) => {
|
|
75
|
+
if (typeof size !== "string") return size;
|
|
76
|
+
const { sizing } = (0, import_web.getConfig)();
|
|
77
|
+
if (!sizing?.sizes?.[size]) return size;
|
|
78
|
+
return (0, import_web.resolveSizing)(size)?.fontSize ?? size;
|
|
79
|
+
};
|
|
74
80
|
function useListItem(propsIn) {
|
|
75
81
|
const [wrappedTextProps, listItemProps] = (0, import_web.splitStyleProps)(propsIn, {
|
|
76
82
|
expandShorthands: true,
|
|
@@ -80,7 +86,7 @@ function useListItem(propsIn) {
|
|
|
80
86
|
const { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;
|
|
81
87
|
const context = ListItemContext.useStyledContext();
|
|
82
88
|
const getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
83
|
-
size: (0, import_helpers_tamagui.getThemedIconSize)(iconSize ?? propsIn.size ?? context.size ?? true, scaleIcon),
|
|
89
|
+
size: (0, import_helpers_tamagui.getThemedIconSize)(toIconFontKey(iconSize ?? propsIn.size ?? context.size ?? true), scaleIcon),
|
|
84
90
|
color: propsIn.color ?? context.color
|
|
85
91
|
});
|
|
86
92
|
const wrappedChildren = (0, import_text.wrapChildrenInText)(ListItemText, {
|
|
@@ -73,6 +73,14 @@ var ListItemTitle = (0, import_web.styled)(ListItemText, {
|
|
|
73
73
|
context: ListItemContext,
|
|
74
74
|
displayName: "ListItemTitle"
|
|
75
75
|
});
|
|
76
|
+
var toIconFontKey = function(size) {
|
|
77
|
+
var _sizing_sizes, _resolveSizing;
|
|
78
|
+
if (typeof size !== "string") return size;
|
|
79
|
+
var { sizing } = (0, import_web.getConfig)();
|
|
80
|
+
if (!(sizing === null || sizing === void 0 ? void 0 : (_sizing_sizes = sizing.sizes) === null || _sizing_sizes === void 0 ? void 0 : _sizing_sizes[size])) return size;
|
|
81
|
+
var _resolveSizing_fontSize;
|
|
82
|
+
return (_resolveSizing_fontSize = (_resolveSizing = (0, import_web.resolveSizing)(size)) === null || _resolveSizing === void 0 ? void 0 : _resolveSizing.fontSize) !== null && _resolveSizing_fontSize !== void 0 ? _resolveSizing_fontSize : size;
|
|
83
|
+
};
|
|
76
84
|
function useListItem(propsIn) {
|
|
77
85
|
var [wrappedTextProps, listItemProps] = (0, import_web.splitStyleProps)(propsIn, {
|
|
78
86
|
expandShorthands: true,
|
|
@@ -83,7 +91,7 @@ function useListItem(propsIn) {
|
|
|
83
91
|
var context = ListItemContext.useStyledContext();
|
|
84
92
|
var _ref, _ref1, _propsIn_color;
|
|
85
93
|
var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
86
|
-
size: (0, import_helpers_tamagui.getThemedIconSize)((_ref1 = (_ref = iconSize !== null && iconSize !== void 0 ? iconSize : propsIn.size) !== null && _ref !== void 0 ? _ref : context.size) !== null && _ref1 !== void 0 ? _ref1 : true, scaleIcon),
|
|
94
|
+
size: (0, import_helpers_tamagui.getThemedIconSize)(toIconFontKey((_ref1 = (_ref = iconSize !== null && iconSize !== void 0 ? iconSize : propsIn.size) !== null && _ref !== void 0 ? _ref : context.size) !== null && _ref1 !== void 0 ? _ref1 : true), scaleIcon),
|
|
87
95
|
color: (_propsIn_color = propsIn.color) !== null && _propsIn_color !== void 0 ? _propsIn_color : context.color
|
|
88
96
|
});
|
|
89
97
|
var wrappedChildren = (0, import_text.wrapChildrenInText)(ListItemText, {
|
|
@@ -73,6 +73,14 @@ var ListItemTitle = (0, import_web.styled)(ListItemText, {
|
|
|
73
73
|
context: ListItemContext,
|
|
74
74
|
displayName: "ListItemTitle"
|
|
75
75
|
});
|
|
76
|
+
var toIconFontKey = function(size) {
|
|
77
|
+
var _sizing_sizes, _resolveSizing;
|
|
78
|
+
if (typeof size !== "string") return size;
|
|
79
|
+
var { sizing } = (0, import_web.getConfig)();
|
|
80
|
+
if (!(sizing === null || sizing === void 0 ? void 0 : (_sizing_sizes = sizing.sizes) === null || _sizing_sizes === void 0 ? void 0 : _sizing_sizes[size])) return size;
|
|
81
|
+
var _resolveSizing_fontSize;
|
|
82
|
+
return (_resolveSizing_fontSize = (_resolveSizing = (0, import_web.resolveSizing)(size)) === null || _resolveSizing === void 0 ? void 0 : _resolveSizing.fontSize) !== null && _resolveSizing_fontSize !== void 0 ? _resolveSizing_fontSize : size;
|
|
83
|
+
};
|
|
76
84
|
function useListItem(propsIn) {
|
|
77
85
|
var [wrappedTextProps, listItemProps] = (0, import_web.splitStyleProps)(propsIn, {
|
|
78
86
|
expandShorthands: true,
|
|
@@ -83,7 +91,7 @@ function useListItem(propsIn) {
|
|
|
83
91
|
var context = ListItemContext.useStyledContext();
|
|
84
92
|
var _ref, _ref1, _propsIn_color;
|
|
85
93
|
var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
86
|
-
size: (0, import_helpers_tamagui.getThemedIconSize)((_ref1 = (_ref = iconSize !== null && iconSize !== void 0 ? iconSize : propsIn.size) !== null && _ref !== void 0 ? _ref : context.size) !== null && _ref1 !== void 0 ? _ref1 : true, scaleIcon),
|
|
94
|
+
size: (0, import_helpers_tamagui.getThemedIconSize)(toIconFontKey((_ref1 = (_ref = iconSize !== null && iconSize !== void 0 ? iconSize : propsIn.size) !== null && _ref !== void 0 ? _ref : context.size) !== null && _ref1 !== void 0 ? _ref1 : true), scaleIcon),
|
|
87
95
|
color: (_propsIn_color = propsIn.color) !== null && _propsIn_color !== void 0 ? _propsIn_color : context.color
|
|
88
96
|
});
|
|
89
97
|
var wrappedChildren = (0, import_text.wrapChildrenInText)(ListItemText, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.native.js","names":[],"sources":["cjs/ListItem.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 ListItem_exports = {};\n__export(ListItem_exports, {\n ListItemContext: () => ListItemContext,\n ListItemFrame: () => ListItemFrame,\n ListItemSubtitle: () => ListItemSubtitle,\n ListItemText: () => ListItemText,\n ListItemTitle: () => ListItemTitle,\n useListItem: () => useListItem\n});\nmodule.exports = __toCommonJS(ListItem_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_helpers_tamagui = require(\"@tamagui/helpers-tamagui\");\nvar import_stacks = require(\"@tamagui/stacks\");\nvar import_text = require(\"@tamagui/text\");\nvar import_web = require(\"@tamagui/web\");\nvar ListItemContext = (0, import_web.createStyledContext)({\n size: void 0,\n variant: void 0,\n color: void 0\n});\nvar ListItemFrame = (0, import_web.styled)(import_web.View, {\n context: ListItemContext,\n displayName: \"ListItemFrame\",\n // role is the cross-platform one; render only lands on web\n role: \"listitem\",\n render: \"li\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n flexWrap: \"nowrap\",\n width: \"100%\",\n maxWidth: \"100%\",\n overflow: \"hidden\",\n flexDirection: \"row\",\n variants: {\n disabled: {\n true: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nvar ListItemText = (0, import_web.styled)(import_text.SizableText, {\n context: ListItemContext,\n displayName: \"ListItemText\",\n size: true,\n flexGrow: 1,\n flexShrink: 1,\n ellipsis: true,\n cursor: \"inherit\"\n});\nvar ListItemSubtitle = (0, import_web.styled)(ListItemText, {\n context: ListItemContext,\n displayName: \"ListItemSubtitle\",\n opacity: 0.6,\n maxWidth: \"100%\"\n});\nvar ListItemTitle = (0, import_web.styled)(ListItemText, {\n context: ListItemContext,\n displayName: \"ListItemTitle\"\n});\nfunction useListItem(propsIn) {\n var [wrappedTextProps, listItemProps] = (0, import_web.splitStyleProps)(propsIn, {\n expandShorthands: true,\n filter: import_text.textParentProps\n });\n var { children, icon, iconAfter, iconSize, scaleIcon = 1, subTitle, title, ...frameProps } = listItemProps;\n var { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;\n var context = ListItemContext.useStyledContext();\n var _ref, _ref1, _propsIn_color;\n var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({\n size: (0, import_helpers_tamagui.getThemedIconSize)((_ref1 = (_ref = iconSize !== null && iconSize !== void 0 ? iconSize : propsIn.size) !== null && _ref !== void 0 ? _ref : context.size) !== null && _ref1 !== void 0 ? _ref1 : true, scaleIcon),\n color: (_propsIn_color = propsIn.color) !== null && _propsIn_color !== void 0 ? _propsIn_color : context.color\n });\n var wrappedChildren = (0, import_text.wrapChildrenInText)(ListItemText, {\n children,\n noTextWrap,\n textProps\n }, textStyleProps);\n return {\n props: {\n ...frameProps,\n color: propsIn.color,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {\n children: [\n icon ? getThemedIcon(icon) : null,\n title || subTitle ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stacks.YStack, {\n flex: 1,\n children: [\n typeof title === \"string\" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListItemTitle, {\n ...textStyleProps,\n ...textProps,\n children: title\n }) : title,\n typeof subTitle === \"string\" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListItemSubtitle, {\n ...textStyleProps,\n ...textProps,\n children: subTitle\n }) : subTitle,\n wrappedChildren\n ]\n }) : wrappedChildren,\n iconAfter ? getThemedIcon(iconAfter) : null\n ]\n })\n }\n };\n}\n//# sourceMappingURL=ListItem.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,CAA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,WAAW,gBAAe,CAAE,SAAS;EAC/E,kBAAkB;EAClB,QAAQ,YAAY;CACtB,CAAC;CACD,IAAI,EAAE,UAAU,MAAM,WAAW,UAAU,YAAY,GAAG,UAAU,OAAO,GAAG,eAAe;CAC7F,IAAI,EAAE,YAAY,WAAW,GAAG,mBAAmB;CACnD,IAAI,UAAU,gBAAgB,iBAAiB;CAC/C,IAAI,MAAM,OAAO;CACjB,IAAI,iBAAiB,GAAG,uBAAuB,iBAAgB,CAAE;EAC/D,OAAO,GAAG,uBAAuB,kBAAiB,
|
|
1
|
+
{"version":3,"file":"ListItem.native.js","names":[],"sources":["cjs/ListItem.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 ListItem_exports = {};\n__export(ListItem_exports, {\n ListItemContext: () => ListItemContext,\n ListItemFrame: () => ListItemFrame,\n ListItemSubtitle: () => ListItemSubtitle,\n ListItemText: () => ListItemText,\n ListItemTitle: () => ListItemTitle,\n useListItem: () => useListItem\n});\nmodule.exports = __toCommonJS(ListItem_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_helpers_tamagui = require(\"@tamagui/helpers-tamagui\");\nvar import_stacks = require(\"@tamagui/stacks\");\nvar import_text = require(\"@tamagui/text\");\nvar import_web = require(\"@tamagui/web\");\nvar ListItemContext = (0, import_web.createStyledContext)({\n size: void 0,\n variant: void 0,\n color: void 0\n});\nvar ListItemFrame = (0, import_web.styled)(import_web.View, {\n context: ListItemContext,\n displayName: \"ListItemFrame\",\n // role is the cross-platform one; render only lands on web\n role: \"listitem\",\n render: \"li\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n flexWrap: \"nowrap\",\n width: \"100%\",\n maxWidth: \"100%\",\n overflow: \"hidden\",\n flexDirection: \"row\",\n variants: {\n disabled: {\n true: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nvar ListItemText = (0, import_web.styled)(import_text.SizableText, {\n context: ListItemContext,\n displayName: \"ListItemText\",\n size: true,\n flexGrow: 1,\n flexShrink: 1,\n ellipsis: true,\n cursor: \"inherit\"\n});\nvar ListItemSubtitle = (0, import_web.styled)(ListItemText, {\n context: ListItemContext,\n displayName: \"ListItemSubtitle\",\n opacity: 0.6,\n maxWidth: \"100%\"\n});\nvar ListItemTitle = (0, import_web.styled)(ListItemText, {\n context: ListItemContext,\n displayName: \"ListItemTitle\"\n});\nvar toIconFontKey = function(size) {\n var _sizing_sizes, _resolveSizing;\n if (typeof size !== \"string\") return size;\n var { sizing } = (0, import_web.getConfig)();\n if (!(sizing === null || sizing === void 0 ? void 0 : (_sizing_sizes = sizing.sizes) === null || _sizing_sizes === void 0 ? void 0 : _sizing_sizes[size])) return size;\n var _resolveSizing_fontSize;\n return (_resolveSizing_fontSize = (_resolveSizing = (0, import_web.resolveSizing)(size)) === null || _resolveSizing === void 0 ? void 0 : _resolveSizing.fontSize) !== null && _resolveSizing_fontSize !== void 0 ? _resolveSizing_fontSize : size;\n};\nfunction useListItem(propsIn) {\n var [wrappedTextProps, listItemProps] = (0, import_web.splitStyleProps)(propsIn, {\n expandShorthands: true,\n filter: import_text.textParentProps\n });\n var { children, icon, iconAfter, iconSize, scaleIcon = 1, subTitle, title, ...frameProps } = listItemProps;\n var { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;\n var context = ListItemContext.useStyledContext();\n var _ref, _ref1, _propsIn_color;\n var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({\n size: (0, import_helpers_tamagui.getThemedIconSize)(toIconFontKey((_ref1 = (_ref = iconSize !== null && iconSize !== void 0 ? iconSize : propsIn.size) !== null && _ref !== void 0 ? _ref : context.size) !== null && _ref1 !== void 0 ? _ref1 : true), scaleIcon),\n color: (_propsIn_color = propsIn.color) !== null && _propsIn_color !== void 0 ? _propsIn_color : context.color\n });\n var wrappedChildren = (0, import_text.wrapChildrenInText)(ListItemText, {\n children,\n noTextWrap,\n textProps\n }, textStyleProps);\n return {\n props: {\n ...frameProps,\n color: propsIn.color,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {\n children: [\n icon ? getThemedIcon(icon) : null,\n title || subTitle ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stacks.YStack, {\n flex: 1,\n children: [\n typeof title === \"string\" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListItemTitle, {\n ...textStyleProps,\n ...textProps,\n children: title\n }) : title,\n typeof subTitle === \"string\" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListItemSubtitle, {\n ...textStyleProps,\n ...textProps,\n children: subTitle\n }) : subTitle,\n wrappedChildren\n ]\n }) : wrappedChildren,\n iconAfter ? getThemedIcon(iconAfter) : null\n ]\n })\n }\n };\n}\n//# sourceMappingURL=ListItem.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,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AAK,IAAI,iBAAiB,QAAQ;CAC3G,CAAC;CACD,IAAI,mBAAmB,GAAG,YAAY,mBAAkB,CAAE,cAAc;EACtE;EACA;EACA;CACF,GAAG,cAAc;CACjB,OAAO,EACL,OAAO;EACL,GAAG;EACH,OAAO,QAAQ;EACf,UAA0B,iBAAC,GAAG,mBAAmB,KAAI,CAAE,mBAAmB,UAAU,EAClF,UAAU;GACR,OAAO,cAAc,IAAI,IAAI;GAC7B,SAAS,WAA2B,iBAAC,GAAG,mBAAmB,KAAI,CAAE,cAAc,QAAQ;IACrF,MAAM;IACN,UAAU;KACR,OAAO,UAAU,WAA2B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,eAAe;MACrF,GAAG;MACH,GAAG;MACH,UAAU;KACZ,CAAC,IAAI;KACL,OAAO,aAAa,WAA2B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,kBAAkB;MAC3F,GAAG;MACH,GAAG;MACH,UAAU;KACZ,CAAC,IAAI;KACL;IACF;GACF,CAAC,IAAI;GACL,YAAY,cAAc,SAAS,IAAI;EACzC,EACF,CAAC;CACH,EACF;AACF"}
|
package/dist/esm/ListItem.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getThemedIconSize, useGetThemedIcon } from "@tamagui/helpers-tamagui";
|
|
2
2
|
import { YStack } from "@tamagui/stacks";
|
|
3
3
|
import { SizableText, textParentProps, wrapChildrenInText } from "@tamagui/text";
|
|
4
|
-
import { View, createStyledContext, splitStyleProps, styled } from "@tamagui/web";
|
|
4
|
+
import { View, createStyledContext, getConfig, resolveSizing, splitStyleProps, styled } from "@tamagui/web";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
|
|
7
7
|
const ListItemContext = createStyledContext({
|
|
@@ -42,6 +42,12 @@ const ListItemTitle = styled(ListItemText, {
|
|
|
42
42
|
context: ListItemContext,
|
|
43
43
|
displayName: "ListItemTitle"
|
|
44
44
|
});
|
|
45
|
+
const toIconFontKey = (size) => {
|
|
46
|
+
if (typeof size !== "string") return size;
|
|
47
|
+
const { sizing } = getConfig();
|
|
48
|
+
if (!sizing?.sizes?.[size]) return size;
|
|
49
|
+
return resolveSizing(size)?.fontSize ?? size;
|
|
50
|
+
};
|
|
45
51
|
function useListItem(propsIn) {
|
|
46
52
|
const [wrappedTextProps, listItemProps] = splitStyleProps(propsIn, {
|
|
47
53
|
expandShorthands: true,
|
|
@@ -51,7 +57,7 @@ function useListItem(propsIn) {
|
|
|
51
57
|
const { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;
|
|
52
58
|
const context = ListItemContext.useStyledContext();
|
|
53
59
|
const getThemedIcon = useGetThemedIcon({
|
|
54
|
-
size: getThemedIconSize(iconSize ?? propsIn.size ?? context.size ?? true, scaleIcon),
|
|
60
|
+
size: getThemedIconSize(toIconFontKey(iconSize ?? propsIn.size ?? context.size ?? true), scaleIcon),
|
|
55
61
|
color: propsIn.color ?? context.color
|
|
56
62
|
});
|
|
57
63
|
const wrappedChildren = wrapChildrenInText(ListItemText, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.js","names":[],"sources":["esm/ListItem.js"],"sourcesContent":["import { getThemedIconSize, useGetThemedIcon } from \"@tamagui/helpers-tamagui\";\nimport { YStack } from \"@tamagui/stacks\";\nimport { SizableText, textParentProps, wrapChildrenInText } from \"@tamagui/text\";\nimport {
|
|
1
|
+
{"version":3,"file":"ListItem.js","names":[],"sources":["esm/ListItem.js"],"sourcesContent":["import { getThemedIconSize, useGetThemedIcon } from \"@tamagui/helpers-tamagui\";\nimport { YStack } from \"@tamagui/stacks\";\nimport { SizableText, textParentProps, wrapChildrenInText } from \"@tamagui/text\";\nimport {\n createStyledContext,\n getConfig,\n resolveSizing,\n splitStyleProps,\n styled,\n View\n} from \"@tamagui/web\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nconst ListItemContext = createStyledContext({\n size: void 0,\n variant: void 0,\n color: void 0\n});\nconst ListItemFrame = styled(View, {\n context: ListItemContext,\n displayName: \"ListItemFrame\",\n // role is the cross-platform one; render only lands on web\n role: \"listitem\",\n render: \"li\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n flexWrap: \"nowrap\",\n width: \"100%\",\n maxWidth: \"100%\",\n overflow: \"hidden\",\n flexDirection: \"row\",\n variants: {\n disabled: {\n true: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nconst ListItemText = styled(SizableText, {\n context: ListItemContext,\n displayName: \"ListItemText\",\n size: true,\n flexGrow: 1,\n flexShrink: 1,\n ellipsis: true,\n cursor: \"inherit\"\n});\nconst ListItemSubtitle = styled(ListItemText, {\n context: ListItemContext,\n displayName: \"ListItemSubtitle\",\n opacity: 0.6,\n maxWidth: \"100%\"\n});\nconst ListItemTitle = styled(ListItemText, {\n context: ListItemContext,\n displayName: \"ListItemTitle\"\n});\nconst toIconFontKey = (size) => {\n if (typeof size !== \"string\") return size;\n const { sizing } = getConfig();\n if (!sizing?.sizes?.[size]) return size;\n return resolveSizing(size)?.fontSize ?? size;\n};\nfunction useListItem(propsIn) {\n const [wrappedTextProps, listItemProps] = splitStyleProps(propsIn, {\n expandShorthands: true,\n filter: textParentProps\n });\n const {\n children,\n icon,\n iconAfter,\n iconSize,\n scaleIcon = 1,\n subTitle,\n title,\n ...frameProps\n } = listItemProps;\n const { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;\n const context = ListItemContext.useStyledContext();\n const getThemedIcon = useGetThemedIcon({\n size: getThemedIconSize(\n toIconFontKey(iconSize ?? propsIn.size ?? context.size ?? true),\n scaleIcon\n ),\n color: propsIn.color ?? context.color\n });\n const wrappedChildren = wrapChildrenInText(\n ListItemText,\n { children, noTextWrap, textProps },\n textStyleProps\n );\n return {\n props: {\n ...frameProps,\n color: propsIn.color,\n children: /* @__PURE__ */ jsxs(Fragment, { children: [\n icon ? getThemedIcon(icon) : null,\n title || subTitle ? /* @__PURE__ */ jsxs(YStack, { flex: 1, children: [\n typeof title === \"string\" ? /* @__PURE__ */ jsx(ListItemTitle, { ...textStyleProps, ...textProps, children: title }) : title,\n typeof subTitle === \"string\" ? /* @__PURE__ */ jsx(ListItemSubtitle, { ...textStyleProps, ...textProps, children: subTitle }) : subTitle,\n wrappedChildren\n ] }) : wrappedChildren,\n iconAfter ? getThemedIcon(iconAfter) : null\n ] })\n }\n };\n}\nexport {\n ListItemContext,\n ListItemFrame,\n ListItemSubtitle,\n ListItemText,\n ListItemTitle,\n useListItem\n};\n//# sourceMappingURL=ListItem.js.map\n"],"mappings":";;;;;;;AAYA,MAAM,kBAAkB,oBAAoB;CAC1C,MAAM,KAAK;CACX,SAAS,KAAK;CACd,OAAO,KAAK;AACd,CAAC;AACD,MAAM,gBAAgB,OAAO,MAAM;CACjC,SAAS;CACT,aAAa;CAEb,MAAM;CACN,QAAQ;CACR,YAAY;CACZ,gBAAgB;CAChB,UAAU;CACV,OAAO;CACP,UAAU;CACV,UAAU;CACV,eAAe;CACf,UAAU,EACR,UAAU,EACR,MAAM,EACJ,eAAe,OACjB,EACF,EACF;AACF,CAAC;AACD,MAAM,eAAe,OAAO,aAAa;CACvC,SAAS;CACT,aAAa;CACb,MAAM;CACN,UAAU;CACV,YAAY;CACZ,UAAU;CACV,QAAQ;AACV,CAAC;AACD,MAAM,mBAAmB,OAAO,cAAc;CAC5C,SAAS;CACT,aAAa;CACb,SAAS;CACT,UAAU;AACZ,CAAC;AACD,MAAM,gBAAgB,OAAO,cAAc;CACzC,SAAS;CACT,aAAa;AACf,CAAC;AACD,MAAM,iBAAiB,SAAS;CAC9B,IAAI,OAAO,SAAS,UAAU,OAAO;CACrC,MAAM,EAAE,WAAW,UAAU;CAC7B,IAAI,CAAC,QAAQ,QAAQ,OAAO,OAAO;CACnC,OAAO,cAAc,IAAI,CAAC,EAAE,YAAY;AAC1C;AACA,SAAS,YAAY,SAAS;CAC5B,MAAM,CAAC,kBAAkB,iBAAiB,gBAAgB,SAAS;EACjE,kBAAkB;EAClB,QAAQ;CACV,CAAC;CACD,MAAM,EACJ,UACA,MACA,WACA,UACA,YAAY,GACZ,UACA,OACA,GAAG,eACD;CACJ,MAAM,EAAE,YAAY,WAAW,GAAG,mBAAmB;CACrD,MAAM,UAAU,gBAAgB,iBAAiB;CACjD,MAAM,gBAAgB,iBAAiB;EACrC,MAAM,kBACJ,cAAc,YAAY,QAAQ,QAAQ,QAAQ,QAAQ,IAAI,GAC9D,SACF;EACA,OAAO,QAAQ,SAAS,QAAQ;CAClC,CAAC;CACD,MAAM,kBAAkB,mBACtB,cACA;EAAE;EAAU;EAAY;CAAU,GAClC,cACF;CACA,OAAO,EACL,OAAO;EACL,GAAG;EACH,OAAO,QAAQ;EACf,UAA0B,qBAAK,UAAU,EAAE,UAAU;GACnD,OAAO,cAAc,IAAI,IAAI;GAC7B,SAAS,WAA2B,qBAAK,QAAQ;IAAE,MAAM;IAAG,UAAU;KACpE,OAAO,UAAU,WAA2B,oBAAI,eAAe;MAAE,GAAG;MAAgB,GAAG;MAAW,UAAU;KAAM,CAAC,IAAI;KACvH,OAAO,aAAa,WAA2B,oBAAI,kBAAkB;MAAE,GAAG;MAAgB,GAAG;MAAW,UAAU;KAAS,CAAC,IAAI;KAChI;IACF;GAAE,CAAC,IAAI;GACP,YAAY,cAAc,SAAS,IAAI;EACzC,EAAE,CAAC;CACL,EACF;AACF"}
|
|
@@ -2,7 +2,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { getThemedIconSize, useGetThemedIcon } from "@tamagui/helpers-tamagui";
|
|
3
3
|
import { YStack } from "@tamagui/stacks";
|
|
4
4
|
import { SizableText, textParentProps, wrapChildrenInText } from "@tamagui/text";
|
|
5
|
-
import { View, createStyledContext, splitStyleProps, styled } from "@tamagui/web";
|
|
5
|
+
import { View, createStyledContext, getConfig, resolveSizing, splitStyleProps, styled } from "@tamagui/web";
|
|
6
6
|
|
|
7
7
|
var ListItemContext = createStyledContext({
|
|
8
8
|
size: void 0,
|
|
@@ -42,6 +42,14 @@ var ListItemTitle = styled(ListItemText, {
|
|
|
42
42
|
context: ListItemContext,
|
|
43
43
|
displayName: "ListItemTitle"
|
|
44
44
|
});
|
|
45
|
+
var toIconFontKey = function(size) {
|
|
46
|
+
var _sizing_sizes, _resolveSizing;
|
|
47
|
+
if (typeof size !== "string") return size;
|
|
48
|
+
var { sizing } = getConfig();
|
|
49
|
+
if (!(sizing === null || sizing === void 0 ? void 0 : (_sizing_sizes = sizing.sizes) === null || _sizing_sizes === void 0 ? void 0 : _sizing_sizes[size])) return size;
|
|
50
|
+
var _resolveSizing_fontSize;
|
|
51
|
+
return (_resolveSizing_fontSize = (_resolveSizing = resolveSizing(size)) === null || _resolveSizing === void 0 ? void 0 : _resolveSizing.fontSize) !== null && _resolveSizing_fontSize !== void 0 ? _resolveSizing_fontSize : size;
|
|
52
|
+
};
|
|
45
53
|
function useListItem(propsIn) {
|
|
46
54
|
var [wrappedTextProps, listItemProps] = splitStyleProps(propsIn, {
|
|
47
55
|
expandShorthands: true,
|
|
@@ -52,7 +60,7 @@ function useListItem(propsIn) {
|
|
|
52
60
|
var context = ListItemContext.useStyledContext();
|
|
53
61
|
var _ref, _ref1, _propsIn_color;
|
|
54
62
|
var getThemedIcon = useGetThemedIcon({
|
|
55
|
-
size: getThemedIconSize((_ref1 = (_ref = iconSize !== null && iconSize !== void 0 ? iconSize : propsIn.size) !== null && _ref !== void 0 ? _ref : context.size) !== null && _ref1 !== void 0 ? _ref1 : true, scaleIcon),
|
|
63
|
+
size: getThemedIconSize(toIconFontKey((_ref1 = (_ref = iconSize !== null && iconSize !== void 0 ? iconSize : propsIn.size) !== null && _ref !== void 0 ? _ref : context.size) !== null && _ref1 !== void 0 ? _ref1 : true), scaleIcon),
|
|
56
64
|
color: (_propsIn_color = propsIn.color) !== null && _propsIn_color !== void 0 ? _propsIn_color : context.color
|
|
57
65
|
});
|
|
58
66
|
var wrappedChildren = wrapChildrenInText(ListItemText, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.native.js","names":["_Fragment"],"sources":["esm/ListItem.native.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { getThemedIconSize, useGetThemedIcon } from \"@tamagui/helpers-tamagui\";\nimport { YStack } from \"@tamagui/stacks\";\nimport { SizableText, textParentProps, wrapChildrenInText } from \"@tamagui/text\";\nimport { createStyledContext, splitStyleProps, styled, View } from \"@tamagui/web\";\nvar ListItemContext = createStyledContext({\n size: void 0,\n variant: void 0,\n color: void 0\n});\nvar ListItemFrame = styled(View, {\n context: ListItemContext,\n displayName: \"ListItemFrame\",\n // role is the cross-platform one; render only lands on web\n role: \"listitem\",\n render: \"li\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n flexWrap: \"nowrap\",\n width: \"100%\",\n maxWidth: \"100%\",\n overflow: \"hidden\",\n flexDirection: \"row\",\n variants: {\n disabled: {\n true: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nvar ListItemText = styled(SizableText, {\n context: ListItemContext,\n displayName: \"ListItemText\",\n size: true,\n flexGrow: 1,\n flexShrink: 1,\n ellipsis: true,\n cursor: \"inherit\"\n});\nvar ListItemSubtitle = styled(ListItemText, {\n context: ListItemContext,\n displayName: \"ListItemSubtitle\",\n opacity: 0.6,\n maxWidth: \"100%\"\n});\nvar ListItemTitle = styled(ListItemText, {\n context: ListItemContext,\n displayName: \"ListItemTitle\"\n});\nfunction useListItem(propsIn) {\n var [wrappedTextProps, listItemProps] = splitStyleProps(propsIn, {\n expandShorthands: true,\n filter: textParentProps\n });\n var { children, icon, iconAfter, iconSize, scaleIcon = 1, subTitle, title, ...frameProps } = listItemProps;\n var { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;\n var context = ListItemContext.useStyledContext();\n var _ref, _ref1, _propsIn_color;\n var getThemedIcon = useGetThemedIcon({\n size: getThemedIconSize((_ref1 = (_ref = iconSize !== null && iconSize !== void 0 ? iconSize : propsIn.size) !== null && _ref !== void 0 ? _ref : context.size) !== null && _ref1 !== void 0 ? _ref1 : true, scaleIcon),\n color: (_propsIn_color = propsIn.color) !== null && _propsIn_color !== void 0 ? _propsIn_color : context.color\n });\n var wrappedChildren = wrapChildrenInText(ListItemText, {\n children,\n noTextWrap,\n textProps\n }, textStyleProps);\n return {\n props: {\n ...frameProps,\n color: propsIn.color,\n children: /* @__PURE__ */ _jsxs(_Fragment, {\n children: [\n icon ? getThemedIcon(icon) : null,\n title || subTitle ? /* @__PURE__ */ _jsxs(YStack, {\n flex: 1,\n children: [\n typeof title === \"string\" ? /* @__PURE__ */ _jsx(ListItemTitle, {\n ...textStyleProps,\n ...textProps,\n children: title\n }) : title,\n typeof subTitle === \"string\" ? /* @__PURE__ */ _jsx(ListItemSubtitle, {\n ...textStyleProps,\n ...textProps,\n children: subTitle\n }) : subTitle,\n wrappedChildren\n ]\n }) : wrappedChildren,\n iconAfter ? getThemedIcon(iconAfter) : null\n ]\n })\n }\n };\n}\nexport {\n ListItemContext,\n ListItemFrame,\n ListItemSubtitle,\n ListItemText,\n ListItemTitle,\n useListItem\n};\n//# sourceMappingURL=ListItem.js.map\n"],"mappings":";;;;;;;AAKA,IAAI,kBAAkB,oBAAoB;CACxC,MAAM,KAAK;CACX,SAAS,KAAK;CACd,OAAO,KAAK;AACd,CAAC;AACD,IAAI,gBAAgB,OAAO,MAAM;CAC/B,SAAS;CACT,aAAa;CAEb,MAAM;CACN,QAAQ;CACR,YAAY;CACZ,gBAAgB;CAChB,UAAU;CACV,OAAO;CACP,UAAU;CACV,UAAU;CACV,eAAe;CACf,UAAU,EACR,UAAU,EACR,MAAM,EACJ,eAAe,OACjB,EACF,EACF;AACF,CAAC;AACD,IAAI,eAAe,OAAO,aAAa;CACrC,SAAS;CACT,aAAa;CACb,MAAM;CACN,UAAU;CACV,YAAY;CACZ,UAAU;CACV,QAAQ;AACV,CAAC;AACD,IAAI,mBAAmB,OAAO,cAAc;CAC1C,SAAS;CACT,aAAa;CACb,SAAS;CACT,UAAU;AACZ,CAAC;AACD,IAAI,gBAAgB,OAAO,cAAc;CACvC,SAAS;CACT,aAAa;AACf,CAAC;AACD,SAAS,YAAY,SAAS;CAC5B,IAAI,CAAC,kBAAkB,iBAAiB,gBAAgB,SAAS;EAC/D,kBAAkB;EAClB,QAAQ;CACV,CAAC;CACD,IAAI,EAAE,UAAU,MAAM,WAAW,UAAU,YAAY,GAAG,UAAU,OAAO,GAAG,eAAe;CAC7F,IAAI,EAAE,YAAY,WAAW,GAAG,mBAAmB;CACnD,IAAI,UAAU,gBAAgB,iBAAiB;CAC/C,IAAI,MAAM,OAAO;CACjB,IAAI,gBAAgB,iBAAiB;EACnC,MAAM,
|
|
1
|
+
{"version":3,"file":"ListItem.native.js","names":["_Fragment"],"sources":["esm/ListItem.native.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { getThemedIconSize, useGetThemedIcon } from \"@tamagui/helpers-tamagui\";\nimport { YStack } from \"@tamagui/stacks\";\nimport { SizableText, textParentProps, wrapChildrenInText } from \"@tamagui/text\";\nimport { createStyledContext, getConfig, resolveSizing, splitStyleProps, styled, View } from \"@tamagui/web\";\nvar ListItemContext = createStyledContext({\n size: void 0,\n variant: void 0,\n color: void 0\n});\nvar ListItemFrame = styled(View, {\n context: ListItemContext,\n displayName: \"ListItemFrame\",\n // role is the cross-platform one; render only lands on web\n role: \"listitem\",\n render: \"li\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n flexWrap: \"nowrap\",\n width: \"100%\",\n maxWidth: \"100%\",\n overflow: \"hidden\",\n flexDirection: \"row\",\n variants: {\n disabled: {\n true: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nvar ListItemText = styled(SizableText, {\n context: ListItemContext,\n displayName: \"ListItemText\",\n size: true,\n flexGrow: 1,\n flexShrink: 1,\n ellipsis: true,\n cursor: \"inherit\"\n});\nvar ListItemSubtitle = styled(ListItemText, {\n context: ListItemContext,\n displayName: \"ListItemSubtitle\",\n opacity: 0.6,\n maxWidth: \"100%\"\n});\nvar ListItemTitle = styled(ListItemText, {\n context: ListItemContext,\n displayName: \"ListItemTitle\"\n});\nvar toIconFontKey = function(size) {\n var _sizing_sizes, _resolveSizing;\n if (typeof size !== \"string\") return size;\n var { sizing } = getConfig();\n if (!(sizing === null || sizing === void 0 ? void 0 : (_sizing_sizes = sizing.sizes) === null || _sizing_sizes === void 0 ? void 0 : _sizing_sizes[size])) return size;\n var _resolveSizing_fontSize;\n return (_resolveSizing_fontSize = (_resolveSizing = resolveSizing(size)) === null || _resolveSizing === void 0 ? void 0 : _resolveSizing.fontSize) !== null && _resolveSizing_fontSize !== void 0 ? _resolveSizing_fontSize : size;\n};\nfunction useListItem(propsIn) {\n var [wrappedTextProps, listItemProps] = splitStyleProps(propsIn, {\n expandShorthands: true,\n filter: textParentProps\n });\n var { children, icon, iconAfter, iconSize, scaleIcon = 1, subTitle, title, ...frameProps } = listItemProps;\n var { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;\n var context = ListItemContext.useStyledContext();\n var _ref, _ref1, _propsIn_color;\n var getThemedIcon = useGetThemedIcon({\n size: getThemedIconSize(toIconFontKey((_ref1 = (_ref = iconSize !== null && iconSize !== void 0 ? iconSize : propsIn.size) !== null && _ref !== void 0 ? _ref : context.size) !== null && _ref1 !== void 0 ? _ref1 : true), scaleIcon),\n color: (_propsIn_color = propsIn.color) !== null && _propsIn_color !== void 0 ? _propsIn_color : context.color\n });\n var wrappedChildren = wrapChildrenInText(ListItemText, {\n children,\n noTextWrap,\n textProps\n }, textStyleProps);\n return {\n props: {\n ...frameProps,\n color: propsIn.color,\n children: /* @__PURE__ */ _jsxs(_Fragment, {\n children: [\n icon ? getThemedIcon(icon) : null,\n title || subTitle ? /* @__PURE__ */ _jsxs(YStack, {\n flex: 1,\n children: [\n typeof title === \"string\" ? /* @__PURE__ */ _jsx(ListItemTitle, {\n ...textStyleProps,\n ...textProps,\n children: title\n }) : title,\n typeof subTitle === \"string\" ? /* @__PURE__ */ _jsx(ListItemSubtitle, {\n ...textStyleProps,\n ...textProps,\n children: subTitle\n }) : subTitle,\n wrappedChildren\n ]\n }) : wrappedChildren,\n iconAfter ? getThemedIcon(iconAfter) : null\n ]\n })\n }\n };\n}\nexport {\n ListItemContext,\n ListItemFrame,\n ListItemSubtitle,\n ListItemText,\n ListItemTitle,\n useListItem\n};\n//# sourceMappingURL=ListItem.js.map\n"],"mappings":";;;;;;;AAKA,IAAI,kBAAkB,oBAAoB;CACxC,MAAM,KAAK;CACX,SAAS,KAAK;CACd,OAAO,KAAK;AACd,CAAC;AACD,IAAI,gBAAgB,OAAO,MAAM;CAC/B,SAAS;CACT,aAAa;CAEb,MAAM;CACN,QAAQ;CACR,YAAY;CACZ,gBAAgB;CAChB,UAAU;CACV,OAAO;CACP,UAAU;CACV,UAAU;CACV,eAAe;CACf,UAAU,EACR,UAAU,EACR,MAAM,EACJ,eAAe,OACjB,EACF,EACF;AACF,CAAC;AACD,IAAI,eAAe,OAAO,aAAa;CACrC,SAAS;CACT,aAAa;CACb,MAAM;CACN,UAAU;CACV,YAAY;CACZ,UAAU;CACV,QAAQ;AACV,CAAC;AACD,IAAI,mBAAmB,OAAO,cAAc;CAC1C,SAAS;CACT,aAAa;CACb,SAAS;CACT,UAAU;AACZ,CAAC;AACD,IAAI,gBAAgB,OAAO,cAAc;CACvC,SAAS;CACT,aAAa;AACf,CAAC;AACD,IAAI,gBAAgB,SAAS,MAAM;CACjC,IAAI,eAAe;CACnB,IAAI,OAAO,SAAS,UAAU,OAAO;CACrC,IAAI,EAAE,WAAW,UAAU;CAC3B,IAAI,EAAE,WAAW,QAAQ,WAAW,KAAK,IAAI,KAAK,KAAK,gBAAgB,OAAO,WAAW,QAAQ,kBAAkB,KAAK,IAAI,KAAK,IAAI,cAAc,QAAQ,OAAO;CAClK,IAAI;CACJ,QAAQ,2BAA2B,iBAAiB,cAAc,IAAI,OAA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s
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getThemedIconSize, useGetThemedIcon } from "@tamagui/helpers-tamagui";
|
|
2
2
|
import { YStack } from "@tamagui/stacks";
|
|
3
3
|
import { SizableText, textParentProps, wrapChildrenInText } from "@tamagui/text";
|
|
4
|
-
import { View, createStyledContext, splitStyleProps, styled } from "@tamagui/web";
|
|
4
|
+
import { View, createStyledContext, getConfig, resolveSizing, splitStyleProps, styled } from "@tamagui/web";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
|
|
7
7
|
const ListItemContext = createStyledContext({
|
|
@@ -42,6 +42,12 @@ const ListItemTitle = styled(ListItemText, {
|
|
|
42
42
|
context: ListItemContext,
|
|
43
43
|
displayName: "ListItemTitle"
|
|
44
44
|
});
|
|
45
|
+
const toIconFontKey = (size) => {
|
|
46
|
+
if (typeof size !== "string") return size;
|
|
47
|
+
const { sizing } = getConfig();
|
|
48
|
+
if (!sizing?.sizes?.[size]) return size;
|
|
49
|
+
return resolveSizing(size)?.fontSize ?? size;
|
|
50
|
+
};
|
|
45
51
|
function useListItem(propsIn) {
|
|
46
52
|
const [wrappedTextProps, listItemProps] = splitStyleProps(propsIn, {
|
|
47
53
|
expandShorthands: true,
|
|
@@ -51,7 +57,7 @@ function useListItem(propsIn) {
|
|
|
51
57
|
const { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;
|
|
52
58
|
const context = ListItemContext.useStyledContext();
|
|
53
59
|
const getThemedIcon = useGetThemedIcon({
|
|
54
|
-
size: getThemedIconSize(iconSize ?? propsIn.size ?? context.size ?? true, scaleIcon),
|
|
60
|
+
size: getThemedIconSize(toIconFontKey(iconSize ?? propsIn.size ?? context.size ?? true), scaleIcon),
|
|
55
61
|
color: propsIn.color ?? context.color
|
|
56
62
|
});
|
|
57
63
|
const wrappedChildren = wrapChildrenInText(ListItemText, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.js","names":[],"sources":["jsx/ListItem.js"],"sourcesContent":["import { getThemedIconSize, useGetThemedIcon } from \"@tamagui/helpers-tamagui\";\nimport { YStack } from \"@tamagui/stacks\";\nimport { SizableText, textParentProps, wrapChildrenInText } from \"@tamagui/text\";\nimport {
|
|
1
|
+
{"version":3,"file":"ListItem.js","names":[],"sources":["jsx/ListItem.js"],"sourcesContent":["import { getThemedIconSize, useGetThemedIcon } from \"@tamagui/helpers-tamagui\";\nimport { YStack } from \"@tamagui/stacks\";\nimport { SizableText, textParentProps, wrapChildrenInText } from \"@tamagui/text\";\nimport {\n createStyledContext,\n getConfig,\n resolveSizing,\n splitStyleProps,\n styled,\n View\n} from \"@tamagui/web\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nconst ListItemContext = createStyledContext({\n size: void 0,\n variant: void 0,\n color: void 0\n});\nconst ListItemFrame = styled(View, {\n context: ListItemContext,\n displayName: \"ListItemFrame\",\n // role is the cross-platform one; render only lands on web\n role: \"listitem\",\n render: \"li\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n flexWrap: \"nowrap\",\n width: \"100%\",\n maxWidth: \"100%\",\n overflow: \"hidden\",\n flexDirection: \"row\",\n variants: {\n disabled: {\n true: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nconst ListItemText = styled(SizableText, {\n context: ListItemContext,\n displayName: \"ListItemText\",\n size: true,\n flexGrow: 1,\n flexShrink: 1,\n ellipsis: true,\n cursor: \"inherit\"\n});\nconst ListItemSubtitle = styled(ListItemText, {\n context: ListItemContext,\n displayName: \"ListItemSubtitle\",\n opacity: 0.6,\n maxWidth: \"100%\"\n});\nconst ListItemTitle = styled(ListItemText, {\n context: ListItemContext,\n displayName: \"ListItemTitle\"\n});\nconst toIconFontKey = (size) => {\n if (typeof size !== \"string\") return size;\n const { sizing } = getConfig();\n if (!sizing?.sizes?.[size]) return size;\n return resolveSizing(size)?.fontSize ?? size;\n};\nfunction useListItem(propsIn) {\n const [wrappedTextProps, listItemProps] = splitStyleProps(propsIn, {\n expandShorthands: true,\n filter: textParentProps\n });\n const {\n children,\n icon,\n iconAfter,\n iconSize,\n scaleIcon = 1,\n subTitle,\n title,\n ...frameProps\n } = listItemProps;\n const { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;\n const context = ListItemContext.useStyledContext();\n const getThemedIcon = useGetThemedIcon({\n size: getThemedIconSize(\n toIconFontKey(iconSize ?? propsIn.size ?? context.size ?? true),\n scaleIcon\n ),\n color: propsIn.color ?? context.color\n });\n const wrappedChildren = wrapChildrenInText(\n ListItemText,\n { children, noTextWrap, textProps },\n textStyleProps\n );\n return {\n props: {\n ...frameProps,\n color: propsIn.color,\n children: /* @__PURE__ */ jsxs(Fragment, { children: [\n icon ? getThemedIcon(icon) : null,\n title || subTitle ? /* @__PURE__ */ jsxs(YStack, { flex: 1, children: [\n typeof title === \"string\" ? /* @__PURE__ */ jsx(ListItemTitle, { ...textStyleProps, ...textProps, children: title }) : title,\n typeof subTitle === \"string\" ? /* @__PURE__ */ jsx(ListItemSubtitle, { ...textStyleProps, ...textProps, children: subTitle }) : subTitle,\n wrappedChildren\n ] }) : wrappedChildren,\n iconAfter ? getThemedIcon(iconAfter) : null\n ] })\n }\n };\n}\nexport {\n ListItemContext,\n ListItemFrame,\n ListItemSubtitle,\n ListItemText,\n ListItemTitle,\n useListItem\n};\n//# sourceMappingURL=ListItem.js.map\n"],"mappings":";;;;;;;AAYA,MAAM,kBAAkB,oBAAoB;CAC1C,MAAM,KAAK;CACX,SAAS,KAAK;CACd,OAAO,KAAK;AACd,CAAC;AACD,MAAM,gBAAgB,OAAO,MAAM;CACjC,SAAS;CACT,aAAa;CAEb,MAAM;CACN,QAAQ;CACR,YAAY;CACZ,gBAAgB;CAChB,UAAU;CACV,OAAO;CACP,UAAU;CACV,UAAU;CACV,eAAe;CACf,UAAU,EACR,UAAU,EACR,MAAM,EACJ,eAAe,OACjB,EACF,EACF;AACF,CAAC;AACD,MAAM,eAAe,OAAO,aAAa;CAC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AgB,GAAG;MAAW,UAAU;KAAS,CAAC,IAAI;KAChI;IACF;GAAE,CAAC,IAAI;GACP,YAAY,cAAc,SAAS,IAAI;EACzC,EAAE,CAAC;CACL,EACF;AACF"}
|
|
@@ -73,6 +73,14 @@ var ListItemTitle = (0, import_web.styled)(ListItemText, {
|
|
|
73
73
|
context: ListItemContext,
|
|
74
74
|
displayName: "ListItemTitle"
|
|
75
75
|
});
|
|
76
|
+
var toIconFontKey = function(size) {
|
|
77
|
+
var _sizing_sizes, _resolveSizing;
|
|
78
|
+
if (typeof size !== "string") return size;
|
|
79
|
+
var { sizing } = (0, import_web.getConfig)();
|
|
80
|
+
if (!(sizing === null || sizing === void 0 ? void 0 : (_sizing_sizes = sizing.sizes) === null || _sizing_sizes === void 0 ? void 0 : _sizing_sizes[size])) return size;
|
|
81
|
+
var _resolveSizing_fontSize;
|
|
82
|
+
return (_resolveSizing_fontSize = (_resolveSizing = (0, import_web.resolveSizing)(size)) === null || _resolveSizing === void 0 ? void 0 : _resolveSizing.fontSize) !== null && _resolveSizing_fontSize !== void 0 ? _resolveSizing_fontSize : size;
|
|
83
|
+
};
|
|
76
84
|
function useListItem(propsIn) {
|
|
77
85
|
var [wrappedTextProps, listItemProps] = (0, import_web.splitStyleProps)(propsIn, {
|
|
78
86
|
expandShorthands: true,
|
|
@@ -83,7 +91,7 @@ function useListItem(propsIn) {
|
|
|
83
91
|
var context = ListItemContext.useStyledContext();
|
|
84
92
|
var _ref, _ref1, _propsIn_color;
|
|
85
93
|
var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
86
|
-
size: (0, import_helpers_tamagui.getThemedIconSize)((_ref1 = (_ref = iconSize !== null && iconSize !== void 0 ? iconSize : propsIn.size) !== null && _ref !== void 0 ? _ref : context.size) !== null && _ref1 !== void 0 ? _ref1 : true, scaleIcon),
|
|
94
|
+
size: (0, import_helpers_tamagui.getThemedIconSize)(toIconFontKey((_ref1 = (_ref = iconSize !== null && iconSize !== void 0 ? iconSize : propsIn.size) !== null && _ref !== void 0 ? _ref : context.size) !== null && _ref1 !== void 0 ? _ref1 : true), scaleIcon),
|
|
87
95
|
color: (_propsIn_color = propsIn.color) !== null && _propsIn_color !== void 0 ? _propsIn_color : context.color
|
|
88
96
|
});
|
|
89
97
|
var wrappedChildren = (0, import_text.wrapChildrenInText)(ListItemText, {
|
|
@@ -73,6 +73,14 @@ var ListItemTitle = (0, import_web.styled)(ListItemText, {
|
|
|
73
73
|
context: ListItemContext,
|
|
74
74
|
displayName: "ListItemTitle"
|
|
75
75
|
});
|
|
76
|
+
var toIconFontKey = function(size) {
|
|
77
|
+
var _sizing_sizes, _resolveSizing;
|
|
78
|
+
if (typeof size !== "string") return size;
|
|
79
|
+
var { sizing } = (0, import_web.getConfig)();
|
|
80
|
+
if (!(sizing === null || sizing === void 0 ? void 0 : (_sizing_sizes = sizing.sizes) === null || _sizing_sizes === void 0 ? void 0 : _sizing_sizes[size])) return size;
|
|
81
|
+
var _resolveSizing_fontSize;
|
|
82
|
+
return (_resolveSizing_fontSize = (_resolveSizing = (0, import_web.resolveSizing)(size)) === null || _resolveSizing === void 0 ? void 0 : _resolveSizing.fontSize) !== null && _resolveSizing_fontSize !== void 0 ? _resolveSizing_fontSize : size;
|
|
83
|
+
};
|
|
76
84
|
function useListItem(propsIn) {
|
|
77
85
|
var [wrappedTextProps, listItemProps] = (0, import_web.splitStyleProps)(propsIn, {
|
|
78
86
|
expandShorthands: true,
|
|
@@ -83,7 +91,7 @@ function useListItem(propsIn) {
|
|
|
83
91
|
var context = ListItemContext.useStyledContext();
|
|
84
92
|
var _ref, _ref1, _propsIn_color;
|
|
85
93
|
var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
86
|
-
size: (0, import_helpers_tamagui.getThemedIconSize)((_ref1 = (_ref = iconSize !== null && iconSize !== void 0 ? iconSize : propsIn.size) !== null && _ref !== void 0 ? _ref : context.size) !== null && _ref1 !== void 0 ? _ref1 : true, scaleIcon),
|
|
94
|
+
size: (0, import_helpers_tamagui.getThemedIconSize)(toIconFontKey((_ref1 = (_ref = iconSize !== null && iconSize !== void 0 ? iconSize : propsIn.size) !== null && _ref !== void 0 ? _ref : context.size) !== null && _ref1 !== void 0 ? _ref1 : true), scaleIcon),
|
|
87
95
|
color: (_propsIn_color = propsIn.color) !== null && _propsIn_color !== void 0 ? _propsIn_color : context.color
|
|
88
96
|
});
|
|
89
97
|
var wrappedChildren = (0, import_text.wrapChildrenInText)(ListItemText, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.native.js","names":[],"sources":["jsx/ListItem.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 ListItem_exports = {};\n__export(ListItem_exports, {\n ListItemContext: () => ListItemContext,\n ListItemFrame: () => ListItemFrame,\n ListItemSubtitle: () => ListItemSubtitle,\n ListItemText: () => ListItemText,\n ListItemTitle: () => ListItemTitle,\n useListItem: () => useListItem\n});\nmodule.exports = __toCommonJS(ListItem_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_helpers_tamagui = require(\"@tamagui/helpers-tamagui\");\nvar import_stacks = require(\"@tamagui/stacks\");\nvar import_text = require(\"@tamagui/text\");\nvar import_web = require(\"@tamagui/web\");\nvar ListItemContext = (0, import_web.createStyledContext)({\n size: void 0,\n variant: void 0,\n color: void 0\n});\nvar ListItemFrame = (0, import_web.styled)(import_web.View, {\n context: ListItemContext,\n displayName: \"ListItemFrame\",\n // role is the cross-platform one; render only lands on web\n role: \"listitem\",\n render: \"li\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n flexWrap: \"nowrap\",\n width: \"100%\",\n maxWidth: \"100%\",\n overflow: \"hidden\",\n flexDirection: \"row\",\n variants: {\n disabled: {\n true: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nvar ListItemText = (0, import_web.styled)(import_text.SizableText, {\n context: ListItemContext,\n displayName: \"ListItemText\",\n size: true,\n flexGrow: 1,\n flexShrink: 1,\n ellipsis: true,\n cursor: \"inherit\"\n});\nvar ListItemSubtitle = (0, import_web.styled)(ListItemText, {\n context: ListItemContext,\n displayName: \"ListItemSubtitle\",\n opacity: 0.6,\n maxWidth: \"100%\"\n});\nvar ListItemTitle = (0, import_web.styled)(ListItemText, {\n context: ListItemContext,\n displayName: \"ListItemTitle\"\n});\nfunction useListItem(propsIn) {\n var [wrappedTextProps, listItemProps] = (0, import_web.splitStyleProps)(propsIn, {\n expandShorthands: true,\n filter: import_text.textParentProps\n });\n var { children, icon, iconAfter, iconSize, scaleIcon = 1, subTitle, title, ...frameProps } = listItemProps;\n var { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;\n var context = ListItemContext.useStyledContext();\n var _ref, _ref1, _propsIn_color;\n var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({\n size: (0, import_helpers_tamagui.getThemedIconSize)((_ref1 = (_ref = iconSize !== null && iconSize !== void 0 ? iconSize : propsIn.size) !== null && _ref !== void 0 ? _ref : context.size) !== null && _ref1 !== void 0 ? _ref1 : true, scaleIcon),\n color: (_propsIn_color = propsIn.color) !== null && _propsIn_color !== void 0 ? _propsIn_color : context.color\n });\n var wrappedChildren = (0, import_text.wrapChildrenInText)(ListItemText, {\n children,\n noTextWrap,\n textProps\n }, textStyleProps);\n return {\n props: {\n ...frameProps,\n color: propsIn.color,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {\n children: [\n icon ? getThemedIcon(icon) : null,\n title || subTitle ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stacks.YStack, {\n flex: 1,\n children: [\n typeof title === \"string\" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListItemTitle, {\n ...textStyleProps,\n ...textProps,\n children: title\n }) : title,\n typeof subTitle === \"string\" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListItemSubtitle, {\n ...textStyleProps,\n ...textProps,\n children: subTitle\n }) : subTitle,\n wrappedChildren\n ]\n }) : wrappedChildren,\n iconAfter ? getThemedIcon(iconAfter) : null\n ]\n })\n }\n };\n}\n//# sourceMappingURL=ListItem.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,mBAAmB,CAAC;AACxB,SAAS,kBA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AAI,EAAE,YAAY,WAAW,GAAG,mBAAmB;CACnD,IAAI,UAAU,gBAAgB,iBAAiB;CAC/C,IAAI,MAAM,OAAO;CACjB,IAAI,iBAAiB,GAAG,uBAAuB,iBAAgB,CAAE;EAC/D,OAAO,GAAG,uBAAuB,kBAAiB,
|
|
1
|
+
{"version":3,"file":"ListItem.native.js","names":[],"sources":["jsx/ListItem.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 ListItem_exports = {};\n__export(ListItem_exports, {\n ListItemContext: () => ListItemContext,\n ListItemFrame: () => ListItemFrame,\n ListItemSubtitle: () => ListItemSubtitle,\n ListItemText: () => ListItemText,\n ListItemTitle: () => ListItemTitle,\n useListItem: () => useListItem\n});\nmodule.exports = __toCommonJS(ListItem_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_helpers_tamagui = require(\"@tamagui/helpers-tamagui\");\nvar import_stacks = require(\"@tamagui/stacks\");\nvar import_text = require(\"@tamagui/text\");\nvar import_web = require(\"@tamagui/web\");\nvar ListItemContext = (0, import_web.createStyledContext)({\n size: void 0,\n variant: void 0,\n color: void 0\n});\nvar ListItemFrame = (0, import_web.styled)(import_web.View, {\n context: ListItemContext,\n displayName: \"ListItemFrame\",\n // role is the cross-platform one; render only lands on web\n role: \"listitem\",\n render: \"li\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n flexWrap: \"nowrap\",\n width: \"100%\",\n maxWidth: \"100%\",\n overflow: \"hidden\",\n flexDirection: \"row\",\n variants: {\n disabled: {\n true: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nvar ListItemText = (0, import_web.styled)(import_text.SizableText, {\n context: ListItemContext,\n displayName: \"ListItemText\",\n size: true,\n flexGrow: 1,\n flexShrink: 1,\n ellipsis: true,\n cursor: \"inherit\"\n});\nvar ListItemSubtitle = (0, import_web.styled)(ListItemText, {\n context: ListItemContext,\n displayName: \"ListItemSubtitle\",\n opacity: 0.6,\n maxWidth: \"100%\"\n});\nvar ListItemTitle = (0, import_web.styled)(ListItemText, {\n context: ListItemContext,\n displayName: \"ListItemTitle\"\n});\nvar toIconFontKey = function(size) {\n var _sizing_sizes, _resolveSizing;\n if (typeof size !== \"string\") return size;\n var { sizing } = (0, import_web.getConfig)();\n if (!(sizing === null || sizing === void 0 ? void 0 : (_sizing_sizes = sizing.sizes) === null || _sizing_sizes === void 0 ? void 0 : _sizing_sizes[size])) return size;\n var _resolveSizing_fontSize;\n return (_resolveSizing_fontSize = (_resolveSizing = (0, import_web.resolveSizing)(size)) === null || _resolveSizing === void 0 ? void 0 : _resolveSizing.fontSize) !== null && _resolveSizing_fontSize !== void 0 ? _resolveSizing_fontSize : size;\n};\nfunction useListItem(propsIn) {\n var [wrappedTextProps, listItemProps] = (0, import_web.splitStyleProps)(propsIn, {\n expandShorthands: true,\n filter: import_text.textParentProps\n });\n var { children, icon, iconAfter, iconSize, scaleIcon = 1, subTitle, title, ...frameProps } = listItemProps;\n var { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;\n var context = ListItemContext.useStyledContext();\n var _ref, _ref1, _propsIn_color;\n var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({\n size: (0, import_helpers_tamagui.getThemedIconSize)(toIconFontKey((_ref1 = (_ref = iconSize !== null && iconSize !== void 0 ? iconSize : propsIn.size) !== null && _ref !== void 0 ? _ref : context.size) !== null && _ref1 !== void 0 ? _ref1 : true), scaleIcon),\n color: (_propsIn_color = propsIn.color) !== null && _propsIn_color !== void 0 ? _propsIn_color : context.color\n });\n var wrappedChildren = (0, import_text.wrapChildrenInText)(ListItemText, {\n children,\n noTextWrap,\n textProps\n }, textStyleProps);\n return {\n props: {\n ...frameProps,\n color: propsIn.color,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {\n children: [\n icon ? getThemedIcon(icon) : null,\n title || subTitle ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stacks.YStack, {\n flex: 1,\n children: [\n typeof title === \"string\" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListItemTitle, {\n ...textStyleProps,\n ...textProps,\n children: title\n }) : title,\n typeof subTitle === \"string\" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListItemSubtitle, {\n ...textStyleProps,\n ...textProps,\n children: subTitle\n }) : subTitle,\n wrappedChildren\n ]\n }) : wrappedChildren,\n iconAfter ? getThemedIcon(iconAfter) : null\n ]\n })\n }\n };\n}\n//# sourceMappingURL=ListItem.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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ACH,OAAO,QAAQ;EACf,UAA0B,iBAAC,GAAG,mBAAmB,KAAI,CAAE,mBAAmB,UAAU,EAClF,UAAU;GACR,OAAO,cAAc,IAAI,IAAI;GAC7B,SAAS,WAA2B,iBAAC,GAAG,mBAAmB,KAAI,CAAE,cAAc,QAAQ;IACrF,MAAM;IACN,UAAU;KACR,OAAO,UAAU,WAA2B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,eAAe;MACrF,GAAG;MACH,GAAG;MACH,UAAU;KACZ,CAAC,IAAI;KACL,OAAO,aAAa,WAA2B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,kBAAkB;MAC3F,GAAG;MACH,GAAG;MACH,UAAU;KACZ,CAAC,IAAI;KACL;IACF;GACF,CAAC,IAAI;GACL,YAAY,cAAc,SAAS,IAAI;EACzC,EACF,CAAC;CACH,EACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/list-item",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.1358.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
"clean:build": "tamagui-build clean:build"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@tamagui/font-size": "3.0.0-beta.
|
|
40
|
-
"@tamagui/get-font-sized": "3.0.0-beta.
|
|
41
|
-
"@tamagui/get-token": "3.0.0-beta.
|
|
42
|
-
"@tamagui/helpers": "3.0.0-beta.
|
|
43
|
-
"@tamagui/helpers-tamagui": "3.0.0-beta.
|
|
44
|
-
"@tamagui/stacks": "3.0.0-beta.
|
|
45
|
-
"@tamagui/text": "3.0.0-beta.
|
|
46
|
-
"@tamagui/web": "3.0.0-beta.
|
|
39
|
+
"@tamagui/font-size": "3.0.0-beta.1358.1",
|
|
40
|
+
"@tamagui/get-font-sized": "3.0.0-beta.1358.1",
|
|
41
|
+
"@tamagui/get-token": "3.0.0-beta.1358.1",
|
|
42
|
+
"@tamagui/helpers": "3.0.0-beta.1358.1",
|
|
43
|
+
"@tamagui/helpers-tamagui": "3.0.0-beta.1358.1",
|
|
44
|
+
"@tamagui/stacks": "3.0.0-beta.1358.1",
|
|
45
|
+
"@tamagui/text": "3.0.0-beta.1358.1",
|
|
46
|
+
"@tamagui/web": "3.0.0-beta.1358.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@tamagui/build": "3.0.0-beta.
|
|
49
|
+
"@tamagui/build": "3.0.0-beta.1358.1",
|
|
50
50
|
"react": "19.2.3"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
package/src/ListItem.tsx
CHANGED
|
@@ -2,8 +2,15 @@ import { getThemedIconSize, useGetThemedIcon } from '@tamagui/helpers-tamagui'
|
|
|
2
2
|
import { YStack } from '@tamagui/stacks'
|
|
3
3
|
import type { TextParentStyles } from '@tamagui/text'
|
|
4
4
|
import { SizableText, textParentProps, wrapChildrenInText } from '@tamagui/text'
|
|
5
|
-
import type { ColorTokens, GetProps } from '@tamagui/web'
|
|
6
|
-
import {
|
|
5
|
+
import type { ColorTokens, ComponentSize, GetProps } from '@tamagui/web'
|
|
6
|
+
import {
|
|
7
|
+
createStyledContext,
|
|
8
|
+
getConfig,
|
|
9
|
+
resolveSizing,
|
|
10
|
+
splitStyleProps,
|
|
11
|
+
styled,
|
|
12
|
+
View,
|
|
13
|
+
} from '@tamagui/web'
|
|
7
14
|
import type { FunctionComponent, JSX, ReactNode } from 'react'
|
|
8
15
|
|
|
9
16
|
type IconProp = JSX.Element | FunctionComponent<{ color?: any; size?: any }> | null
|
|
@@ -117,6 +124,18 @@ export type UseListItemProps<Props extends ListItemBehaviorProps> = Omit<
|
|
|
117
124
|
* to generated text, while size and color still reach the parts through the
|
|
118
125
|
* styled context.
|
|
119
126
|
*/
|
|
127
|
+
// control names are not font keys ('md' is not on the type scale): translate
|
|
128
|
+
// through the ladder before measuring. Numbers, booleans, and anything the
|
|
129
|
+
// ladder does not name pass through to the font lookup as before.
|
|
130
|
+
type IconSizeInput = string | number | boolean | null | undefined
|
|
131
|
+
|
|
132
|
+
const toIconFontKey = (size: IconSizeInput): IconSizeInput => {
|
|
133
|
+
if (typeof size !== 'string') return size
|
|
134
|
+
const { sizing } = getConfig()
|
|
135
|
+
if (!sizing?.sizes?.[size]) return size
|
|
136
|
+
return resolveSizing(size as ComponentSize)?.fontSize ?? size
|
|
137
|
+
}
|
|
138
|
+
|
|
120
139
|
export function useListItem<Props extends ListItemBehaviorProps>(
|
|
121
140
|
propsIn: Props
|
|
122
141
|
): { props: UseListItemProps<Props> } {
|
|
@@ -140,7 +159,10 @@ export function useListItem<Props extends ListItemBehaviorProps>(
|
|
|
140
159
|
// prop is themed here, before the frame renders, so it reads them itself
|
|
141
160
|
const context = ListItemContext.useStyledContext()
|
|
142
161
|
const getThemedIcon = useGetThemedIcon({
|
|
143
|
-
size: getThemedIconSize(
|
|
162
|
+
size: getThemedIconSize(
|
|
163
|
+
toIconFontKey(iconSize ?? propsIn.size ?? context.size ?? true),
|
|
164
|
+
scaleIcon
|
|
165
|
+
),
|
|
144
166
|
color: propsIn.color ?? context.color,
|
|
145
167
|
})
|
|
146
168
|
|
package/types/ListItem.d.ts
CHANGED
|
@@ -106,12 +106,6 @@ export type UseListItemProps<Props extends ListItemBehaviorProps> = Omit<Omit<Pr
|
|
|
106
106
|
children: ReactNode;
|
|
107
107
|
color?: Props['color'];
|
|
108
108
|
};
|
|
109
|
-
/**
|
|
110
|
-
* ListItem behavior: theming the icon props and assembling title, subtitle, and
|
|
111
|
-
* children into the frame's single child. Flat text styles are handed directly
|
|
112
|
-
* to generated text, while size and color still reach the parts through the
|
|
113
|
-
* styled context.
|
|
114
|
-
*/
|
|
115
109
|
export declare function useListItem<Props extends ListItemBehaviorProps>(propsIn: Props): {
|
|
116
110
|
props: UseListItemProps<Props>;
|
|
117
111
|
};
|
package/types/ListItem.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../src/ListItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAe,eAAe,EAAsB,MAAM,eAAe,CAAA;AAChF,OAAO,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../src/ListItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAe,eAAe,EAAsB,MAAM,eAAe,CAAA;AAChF,OAAO,KAAK,EAAE,WAAW,EAAiB,QAAQ,EAAE,MAAM,cAAc,CAAA;AASxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAE9D,KAAK,QAAQ,GAAG,GAAG,CAAC,OAAO,GAAG,iBAAiB,CAAC;IAAE,KAAK,CAAC,EAAE,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,CAAA;CAAE,CAAC,GAAG,IAAI,CAAA;AAEnF;;;;;GAKG;AACH,eAAO,MAAM,eAAe;WACnB,MAAM,GAAG,OAAO;cACb,UAAU;YACZ,WAAW,GAAG,MAAM;gCAK5B,CAAA;AAIF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;CAqBxB,CAAA;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;CAQvB,CAAA;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;CAK3B,CAAA;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;CAGxB,CAAA;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,SAAS,CAAA;IACnB,IAAI,C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