@tamagui/list-item 1.0.2 → 1.0.4
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.js +3 -2
- package/dist/cjs/ListItem.js.map +2 -2
- package/dist/esm/ListItem.js +2 -2
- package/dist/esm/ListItem.js.map +2 -2
- package/dist/jsx/ListItem.js +2 -2
- package/dist/jsx/ListItem.js.map +2 -2
- package/package.json +6 -5
- package/src/ListItem.tsx +6 -8
- package/types/ListItem.d.ts +28 -11
package/dist/cjs/ListItem.js
CHANGED
|
@@ -30,6 +30,7 @@ module.exports = __toCommonJS(ListItem_exports);
|
|
|
30
30
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
31
|
var import_core = require("@tamagui/core");
|
|
32
32
|
var import_font_size = require("@tamagui/font-size");
|
|
33
|
+
var import_get_size = require("@tamagui/get-size");
|
|
33
34
|
var import_helpers_tamagui = require("@tamagui/helpers-tamagui");
|
|
34
35
|
var import_stacks = require("@tamagui/stacks");
|
|
35
36
|
var import_text = require("@tamagui/text");
|
|
@@ -70,7 +71,7 @@ const ListItemFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
|
70
71
|
}
|
|
71
72
|
},
|
|
72
73
|
defaultVariants: {
|
|
73
|
-
size: "$
|
|
74
|
+
size: "$true"
|
|
74
75
|
}
|
|
75
76
|
});
|
|
76
77
|
const ListItemText = (0, import_core.styled)(import_text.SizableText, {
|
|
@@ -121,7 +122,7 @@ const useListItem = (props, {
|
|
|
121
122
|
} = props;
|
|
122
123
|
const mediaActiveProps = (0, import_core.useMediaPropsActive)(props);
|
|
123
124
|
const size = mediaActiveProps.size || "$4";
|
|
124
|
-
const subtitleSizeToken = (0,
|
|
125
|
+
const subtitleSizeToken = (0, import_get_size.getSize)(size, -3);
|
|
125
126
|
const subtitleSize = `$${subtitleSizeToken.key}`;
|
|
126
127
|
const iconSize = (0, import_font_size.getFontSize)(size) * scaleIcon;
|
|
127
128
|
const getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({ size: iconSize, color });
|
package/dist/cjs/ListItem.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ListItem.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n FontSizeTokens,\n GetProps,\n Spacer,\n TamaguiElement,\n ThemeableProps,\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0LY;AA1LZ,
|
|
4
|
+
"sourcesContent": ["import {\n FontSizeTokens,\n GetProps,\n Spacer,\n TamaguiElement,\n ThemeableProps,\n getVariableValue,\n styled,\n themeable,\n useMediaPropsActive,\n withStaticProperties,\n} from '@tamagui/core'\nimport { getFontSize } from '@tamagui/font-size'\nimport { getSize } from '@tamagui/get-size'\nimport { getSpace, useGetThemedIcon } from '@tamagui/helpers-tamagui'\nimport { ThemeableStack, YStack } from '@tamagui/stacks'\nimport { SizableText, TextParentStyles, wrapChildrenInText } from '@tamagui/text'\nimport React, { FunctionComponent, forwardRef } from 'react'\n\ntype ListItemIconProps = { color?: string; size?: number }\ntype IconProp = JSX.Element | FunctionComponent<ListItemIconProps> | null\n\nexport type ListItemProps = Omit<TextParentStyles, 'TextComponent' | 'noTextWrap'> &\n GetProps<typeof ListItemFrame> &\n ThemeableProps & {\n /**\n * add icon before, passes color and size automatically if Component\n */\n icon?: IconProp\n /**\n * add icon after, passes color and size automatically if Component\n */\n iconAfter?: IconProp\n /**\n * adjust icon relative to size\n */\n /**\n * default: -1\n */\n scaleIcon?: number\n /**\n * make the spacing elements flex\n */\n spaceFlex?: number | boolean\n /**\n * adjust internal space relative to icon size\n */\n scaleSpace?: number\n /**\n * title\n */\n title?: React.ReactNode\n /**\n * subtitle\n */\n subTitle?: React.ReactNode\n /**\n * will not wrap text around `children` only, \"all\" will not wrap title or subTitle\n */\n noTextWrap?: boolean | 'all'\n }\n\nconst NAME = 'ListItem'\n\nexport const ListItemFrame = styled(ThemeableStack, {\n name: NAME,\n tag: 'li',\n alignItems: 'center',\n flexWrap: 'nowrap',\n width: '100%',\n borderColor: '$borderColor',\n maxWidth: '100%',\n overflow: 'hidden',\n flexDirection: 'row',\n\n variants: {\n size: {\n '...size': (val, { tokens }) => {\n return {\n minHeight: tokens.size[val],\n paddingHorizontal: tokens.space[val],\n paddingVertical: getSpace(val, -2),\n }\n },\n },\n\n active: {\n true: {\n hoverStyle: {\n backgroundColor: '$background',\n },\n },\n },\n\n disabled: {\n true: {\n opacity: 0.5,\n // TODO breaking types\n pointerEvents: 'none' as any,\n },\n },\n } as const,\n\n defaultVariants: {\n size: '$true',\n },\n})\n\nexport const ListItemText = styled(SizableText, {\n name: 'ListItemText',\n color: '$color',\n userSelect: 'none',\n flexGrow: 1,\n flexShrink: 1,\n ellipse: true,\n cursor: 'default',\n})\n\nexport const ListItemSubtitle = styled(ListItemText, {\n name: 'ListItemSubtitle',\n color: '$colorPress',\n marginTop: '$-2',\n opacity: 0.65,\n maxWidth: '100%',\n size: '$3',\n})\n\nexport const ListItemTitle = styled(ListItemText, {\n name: 'ListItemTitle',\n})\n\nexport const useListItem = (\n props: ListItemProps,\n {\n Text = ListItemText,\n Subtitle = ListItemSubtitle,\n Title = ListItemTitle,\n }: {\n Title?: any\n Subtitle?: any\n Text?: any\n } = { Text: ListItemText, Subtitle: ListItemSubtitle, Title: ListItemTitle }\n) => {\n // careful not to desctructure and re-order props, order is important\n const {\n children,\n icon,\n iconAfter,\n noTextWrap,\n theme: themeName,\n space,\n spaceFlex,\n scaleIcon = 1,\n scaleSpace = 1,\n subTitle,\n\n // text props\n color,\n fontWeight,\n letterSpacing,\n fontSize,\n fontFamily,\n textAlign,\n textProps,\n title,\n ...rest\n } = props\n\n const mediaActiveProps = useMediaPropsActive(props)\n const size = mediaActiveProps.size || '$4'\n const subtitleSizeToken = getSize(size, -3)\n const subtitleSize = `$${subtitleSizeToken.key}` as FontSizeTokens\n const iconSize = getFontSize(size) * scaleIcon\n const getThemedIcon = useGetThemedIcon({ size: iconSize, color })\n const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon)\n const spaceSize = getVariableValue(iconSize) * scaleSpace\n // @ts-ignore noTextWrap = all is ok\n const contents = wrapChildrenInText(Text, mediaActiveProps)\n\n return {\n props: {\n fontFamily,\n ...rest,\n children: (\n <>\n {themedIcon ? (\n <>\n {themedIcon}\n <Spacer size={spaceSize} />\n </>\n ) : null}\n {/* helper for common title/subtitle pttern */}\n {title || subTitle ? (\n <YStack flex={1}>\n {noTextWrap === 'all' ? title : <Title size={size}>{title}</Title>}\n {subTitle ? (\n <>\n <Spacer flex size={spaceSize * 0.333} />\n {typeof subTitle === 'string' && noTextWrap !== 'all' ? (\n // TODO can use theme but we need to standardize to alt themes\n // or standardize on subtle colors in themes\n <Subtitle size={subtitleSize}>{subTitle}</Subtitle>\n ) : (\n subTitle\n )}\n </>\n ) : null}\n {contents}\n </YStack>\n ) : (\n contents\n )}\n {themedIconAfter ? (\n <>\n <Spacer size={spaceSize} />\n {themedIconAfter}\n </>\n ) : null}\n </>\n ),\n },\n }\n}\n\nconst ListItemComponent = forwardRef<TamaguiElement, ListItemProps>((props, ref) => {\n const { props: listItemProps } = useListItem(props)\n return <ListItemFrame ref={ref} justifyContent=\"space-between\" {...listItemProps} />\n})\n\nexport const listItemStaticConfig = {\n inlineProps: new Set([\n // text props go here (can't really optimize them, but we never fully extract listItem anyway)\n 'color',\n 'fontWeight',\n 'fontSize',\n 'fontFamily',\n 'letterSpacing',\n 'textAlign',\n ]),\n}\n\nexport const ListItem = withStaticProperties(\n ListItemFrame.extractable(\n themeable(ListItemComponent, { componentName: NAME }),\n listItemStaticConfig\n ),\n {\n Text: ListItemText,\n Subtitle: ListItemSubtitle,\n }\n)\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA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A,mBAAO;AAAA,kBACrC,OAAO,aAAa,YAAY,eAAe,QAG9C,4CAAC;AAAA,oBAAS,MAAM;AAAA,oBAAe;AAAA,mBAAS,IAExC;AAAA;AAAA,eAEJ,IACE;AAAA,cACH;AAAA;AAAA,WACH,IAEA;AAAA,UAED,kBACC;AAAA,YACE;AAAA,0DAAC;AAAA,gBAAO,MAAM;AAAA,eAAW;AAAA,cACxB;AAAA;AAAA,WACH,IACE;AAAA;AAAA,OACN;AAAA,IAEJ;AAAA,EACF;AACF;AAEA,MAAM,wBAAoB,yBAA0C,CAAC,OAAO,QAAQ;AAClF,QAAM,EAAE,OAAO,cAAc,IAAI,YAAY,KAAK;AAClD,SAAO,4CAAC;AAAA,IAAc;AAAA,IAAU,gBAAe;AAAA,IAAiB,GAAG;AAAA,GAAe;AACpF,CAAC;AAEM,MAAM,uBAAuB;AAAA,EAClC,aAAa,oBAAI,IAAI;AAAA,IAEnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;AAEO,MAAM,eAAW;AAAA,EACtB,cAAc;AAAA,QACZ,uBAAU,mBAAmB,EAAE,eAAe,KAAK,CAAC;AAAA,IACpD;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/ListItem.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import {
|
|
3
3
|
Spacer,
|
|
4
|
-
getSize,
|
|
5
4
|
getVariableValue,
|
|
6
5
|
styled,
|
|
7
6
|
themeable,
|
|
@@ -9,6 +8,7 @@ import {
|
|
|
9
8
|
withStaticProperties
|
|
10
9
|
} from "@tamagui/core";
|
|
11
10
|
import { getFontSize } from "@tamagui/font-size";
|
|
11
|
+
import { getSize } from "@tamagui/get-size";
|
|
12
12
|
import { getSpace, useGetThemedIcon } from "@tamagui/helpers-tamagui";
|
|
13
13
|
import { ThemeableStack, YStack } from "@tamagui/stacks";
|
|
14
14
|
import { SizableText, wrapChildrenInText } from "@tamagui/text";
|
|
@@ -49,7 +49,7 @@ const ListItemFrame = styled(ThemeableStack, {
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
defaultVariants: {
|
|
52
|
-
size: "$
|
|
52
|
+
size: "$true"
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
const ListItemText = styled(SizableText, {
|
package/dist/esm/ListItem.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ListItem.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n FontSizeTokens,\n GetProps,\n Spacer,\n TamaguiElement,\n ThemeableProps,\n
|
|
5
|
-
"mappings": "AA0LY,mBAEE,KAFF;AA1LZ;AAAA,EAGE;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,
|
|
4
|
+
"sourcesContent": ["import {\n FontSizeTokens,\n GetProps,\n Spacer,\n TamaguiElement,\n ThemeableProps,\n getVariableValue,\n styled,\n themeable,\n useMediaPropsActive,\n withStaticProperties,\n} from '@tamagui/core'\nimport { getFontSize } from '@tamagui/font-size'\nimport { getSize } from '@tamagui/get-size'\nimport { getSpace, useGetThemedIcon } from '@tamagui/helpers-tamagui'\nimport { ThemeableStack, YStack } from '@tamagui/stacks'\nimport { SizableText, TextParentStyles, wrapChildrenInText } from '@tamagui/text'\nimport React, { FunctionComponent, forwardRef } from 'react'\n\ntype ListItemIconProps = { color?: string; size?: number }\ntype IconProp = JSX.Element | FunctionComponent<ListItemIconProps> | null\n\nexport type ListItemProps = Omit<TextParentStyles, 'TextComponent' | 'noTextWrap'> &\n GetProps<typeof ListItemFrame> &\n ThemeableProps & {\n /**\n * add icon before, passes color and size automatically if Component\n */\n icon?: IconProp\n /**\n * add icon after, passes color and size automatically if Component\n */\n iconAfter?: IconProp\n /**\n * adjust icon relative to size\n */\n /**\n * default: -1\n */\n scaleIcon?: number\n /**\n * make the spacing elements flex\n */\n spaceFlex?: number | boolean\n /**\n * adjust internal space relative to icon size\n */\n scaleSpace?: number\n /**\n * title\n */\n title?: React.ReactNode\n /**\n * subtitle\n */\n subTitle?: React.ReactNode\n /**\n * will not wrap text around `children` only, \"all\" will not wrap title or subTitle\n */\n noTextWrap?: boolean | 'all'\n }\n\nconst NAME = 'ListItem'\n\nexport const ListItemFrame = styled(ThemeableStack, {\n name: NAME,\n tag: 'li',\n alignItems: 'center',\n flexWrap: 'nowrap',\n width: '100%',\n borderColor: '$borderColor',\n maxWidth: '100%',\n overflow: 'hidden',\n flexDirection: 'row',\n\n variants: {\n size: {\n '...size': (val, { tokens }) => {\n return {\n minHeight: tokens.size[val],\n paddingHorizontal: tokens.space[val],\n paddingVertical: getSpace(val, -2),\n }\n },\n },\n\n active: {\n true: {\n hoverStyle: {\n backgroundColor: '$background',\n },\n },\n },\n\n disabled: {\n true: {\n opacity: 0.5,\n // TODO breaking types\n pointerEvents: 'none' as any,\n },\n },\n } as const,\n\n defaultVariants: {\n size: '$true',\n },\n})\n\nexport const ListItemText = styled(SizableText, {\n name: 'ListItemText',\n color: '$color',\n userSelect: 'none',\n flexGrow: 1,\n flexShrink: 1,\n ellipse: true,\n cursor: 'default',\n})\n\nexport const ListItemSubtitle = styled(ListItemText, {\n name: 'ListItemSubtitle',\n color: '$colorPress',\n marginTop: '$-2',\n opacity: 0.65,\n maxWidth: '100%',\n size: '$3',\n})\n\nexport const ListItemTitle = styled(ListItemText, {\n name: 'ListItemTitle',\n})\n\nexport const useListItem = (\n props: ListItemProps,\n {\n Text = ListItemText,\n Subtitle = ListItemSubtitle,\n Title = ListItemTitle,\n }: {\n Title?: any\n Subtitle?: any\n Text?: any\n } = { Text: ListItemText, Subtitle: ListItemSubtitle, Title: ListItemTitle }\n) => {\n // careful not to desctructure and re-order props, order is important\n const {\n children,\n icon,\n iconAfter,\n noTextWrap,\n theme: themeName,\n space,\n spaceFlex,\n scaleIcon = 1,\n scaleSpace = 1,\n subTitle,\n\n // text props\n color,\n fontWeight,\n letterSpacing,\n fontSize,\n fontFamily,\n textAlign,\n textProps,\n title,\n ...rest\n } = props\n\n const mediaActiveProps = useMediaPropsActive(props)\n const size = mediaActiveProps.size || '$4'\n const subtitleSizeToken = getSize(size, -3)\n const subtitleSize = `$${subtitleSizeToken.key}` as FontSizeTokens\n const iconSize = getFontSize(size) * scaleIcon\n const getThemedIcon = useGetThemedIcon({ size: iconSize, color })\n const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon)\n const spaceSize = getVariableValue(iconSize) * scaleSpace\n // @ts-ignore noTextWrap = all is ok\n const contents = wrapChildrenInText(Text, mediaActiveProps)\n\n return {\n props: {\n fontFamily,\n ...rest,\n children: (\n <>\n {themedIcon ? (\n <>\n {themedIcon}\n <Spacer size={spaceSize} />\n </>\n ) : null}\n {/* helper for common title/subtitle pttern */}\n {title || subTitle ? (\n <YStack flex={1}>\n {noTextWrap === 'all' ? title : <Title size={size}>{title}</Title>}\n {subTitle ? (\n <>\n <Spacer flex size={spaceSize * 0.333} />\n {typeof subTitle === 'string' && noTextWrap !== 'all' ? (\n // TODO can use theme but we need to standardize to alt themes\n // or standardize on subtle colors in themes\n <Subtitle size={subtitleSize}>{subTitle}</Subtitle>\n ) : (\n subTitle\n )}\n </>\n ) : null}\n {contents}\n </YStack>\n ) : (\n contents\n )}\n {themedIconAfter ? (\n <>\n <Spacer size={spaceSize} />\n {themedIconAfter}\n </>\n ) : null}\n </>\n ),\n },\n }\n}\n\nconst ListItemComponent = forwardRef<TamaguiElement, ListItemProps>((props, ref) => {\n const { props: listItemProps } = useListItem(props)\n return <ListItemFrame ref={ref} justifyContent=\"space-between\" {...listItemProps} />\n})\n\nexport const listItemStaticConfig = {\n inlineProps: new Set([\n // text props go here (can't really optimize them, but we never fully extract listItem anyway)\n 'color',\n 'fontWeight',\n 'fontSize',\n 'fontFamily',\n 'letterSpacing',\n 'textAlign',\n ]),\n}\n\nexport const ListItem = withStaticProperties(\n ListItemFrame.extractable(\n themeable(ListItemComponent, { componentName: NAME }),\n listItemStaticConfig\n ),\n {\n Text: ListItemText,\n Subtitle: ListItemSubtitle,\n }\n)\n"],
|
|
5
|
+
"mappings": "AA0LY,mBAEE,KAFF;AA1LZ;AAAA,EAGE;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,UAAU,wBAAwB;AAC3C,SAAS,gBAAgB,cAAc;AACvC,SAAS,aAA+B,0BAA0B;AAClE,SAAmC,kBAAkB;AA6CrD,MAAM,OAAO;AAEN,MAAM,gBAAgB,OAAO,gBAAgB;AAAA,EAClD,MAAM;AAAA,EACN,KAAK;AAAA,EACL,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,OAAO;AAAA,EACP,aAAa;AAAA,EACb,UAAU;AAAA,EACV,UAAU;AAAA,EACV,eAAe;AAAA,EAEf,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,WAAW,CAAC,KAAK,EAAE,OAAO,MAAM;AAC9B,eAAO;AAAA,UACL,WAAW,OAAO,KAAK;AAAA,UACvB,mBAAmB,OAAO,MAAM;AAAA,UAChC,iBAAiB,SAAS,KAAK,EAAE;AAAA,QACnC;AAAA,MACF;AAAA,IACF;AAAA,IAEA,QAAQ;AAAA,MACN,MAAM;AAAA,QACJ,YAAY;AAAA,UACV,iBAAiB;AAAA,QACnB;AAAA,MACF;AAAA,IACF;AAAA,IAEA,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,SAAS;AAAA,QAET,eAAe;AAAA,MACjB;AAAA,IACF;AAAA,EACF;AAAA,EAEA,iBAAiB;AAAA,IACf,MAAM;AAAA,EACR;AACF,CAAC;AAEM,MAAM,eAAe,OAAO,aAA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|
import {
|
|
2
2
|
Spacer,
|
|
3
|
-
getSize,
|
|
4
3
|
getVariableValue,
|
|
5
4
|
styled,
|
|
6
5
|
themeable,
|
|
@@ -8,6 +7,7 @@ import {
|
|
|
8
7
|
withStaticProperties
|
|
9
8
|
} from "@tamagui/core";
|
|
10
9
|
import { getFontSize } from "@tamagui/font-size";
|
|
10
|
+
import { getSize } from "@tamagui/get-size";
|
|
11
11
|
import { getSpace, useGetThemedIcon } from "@tamagui/helpers-tamagui";
|
|
12
12
|
import { ThemeableStack, YStack } from "@tamagui/stacks";
|
|
13
13
|
import { SizableText, wrapChildrenInText } from "@tamagui/text";
|
|
@@ -48,7 +48,7 @@ const ListItemFrame = styled(ThemeableStack, {
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
defaultVariants: {
|
|
51
|
-
size: "$
|
|
51
|
+
size: "$true"
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
const ListItemText = styled(SizableText, {
|
package/dist/jsx/ListItem.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ListItem.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n FontSizeTokens,\n GetProps,\n Spacer,\n TamaguiElement,\n ThemeableProps,\n
|
|
5
|
-
"mappings": "AAAA;AAAA,EAGE;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,
|
|
4
|
+
"sourcesContent": ["import {\n FontSizeTokens,\n GetProps,\n Spacer,\n TamaguiElement,\n ThemeableProps,\n getVariableValue,\n styled,\n themeable,\n useMediaPropsActive,\n withStaticProperties,\n} from '@tamagui/core'\nimport { getFontSize } from '@tamagui/font-size'\nimport { getSize } from '@tamagui/get-size'\nimport { getSpace, useGetThemedIcon } from '@tamagui/helpers-tamagui'\nimport { ThemeableStack, YStack } from '@tamagui/stacks'\nimport { SizableText, TextParentStyles, wrapChildrenInText } from '@tamagui/text'\nimport React, { FunctionComponent, forwardRef } from 'react'\n\ntype ListItemIconProps = { color?: string; size?: number }\ntype IconProp = JSX.Element | FunctionComponent<ListItemIconProps> | null\n\nexport type ListItemProps = Omit<TextParentStyles, 'TextComponent' | 'noTextWrap'> &\n GetProps<typeof ListItemFrame> &\n ThemeableProps & {\n /**\n * add icon before, passes color and size automatically if Component\n */\n icon?: IconProp\n /**\n * add icon after, passes color and size automatically if Component\n */\n iconAfter?: IconProp\n /**\n * adjust icon relative to size\n */\n /**\n * default: -1\n */\n scaleIcon?: number\n /**\n * make the spacing elements flex\n */\n spaceFlex?: number | boolean\n /**\n * adjust internal space relative to icon size\n */\n scaleSpace?: number\n /**\n * title\n */\n title?: React.ReactNode\n /**\n * subtitle\n */\n subTitle?: React.ReactNode\n /**\n * will not wrap text around `children` only, \"all\" will not wrap title or subTitle\n */\n noTextWrap?: boolean | 'all'\n }\n\nconst NAME = 'ListItem'\n\nexport const ListItemFrame = styled(ThemeableStack, {\n name: NAME,\n tag: 'li',\n alignItems: 'center',\n flexWrap: 'nowrap',\n width: '100%',\n borderColor: '$borderColor',\n maxWidth: '100%',\n overflow: 'hidden',\n flexDirection: 'row',\n\n variants: {\n size: {\n '...size': (val, { tokens }) => {\n return {\n minHeight: tokens.size[val],\n paddingHorizontal: tokens.space[val],\n paddingVertical: getSpace(val, -2),\n }\n },\n },\n\n active: {\n true: {\n hoverStyle: {\n backgroundColor: '$background',\n },\n },\n },\n\n disabled: {\n true: {\n opacity: 0.5,\n // TODO breaking types\n pointerEvents: 'none' as any,\n },\n },\n } as const,\n\n defaultVariants: {\n size: '$true',\n },\n})\n\nexport const ListItemText = styled(SizableText, {\n name: 'ListItemText',\n color: '$color',\n userSelect: 'none',\n flexGrow: 1,\n flexShrink: 1,\n ellipse: true,\n cursor: 'default',\n})\n\nexport const ListItemSubtitle = styled(ListItemText, {\n name: 'ListItemSubtitle',\n color: '$colorPress',\n marginTop: '$-2',\n opacity: 0.65,\n maxWidth: '100%',\n size: '$3',\n})\n\nexport const ListItemTitle = styled(ListItemText, {\n name: 'ListItemTitle',\n})\n\nexport const useListItem = (\n props: ListItemProps,\n {\n Text = ListItemText,\n Subtitle = ListItemSubtitle,\n Title = ListItemTitle,\n }: {\n Title?: any\n Subtitle?: any\n Text?: any\n } = { Text: ListItemText, Subtitle: ListItemSubtitle, Title: ListItemTitle }\n) => {\n // careful not to desctructure and re-order props, order is important\n const {\n children,\n icon,\n iconAfter,\n noTextWrap,\n theme: themeName,\n space,\n spaceFlex,\n scaleIcon = 1,\n scaleSpace = 1,\n subTitle,\n\n // text props\n color,\n fontWeight,\n letterSpacing,\n fontSize,\n fontFamily,\n textAlign,\n textProps,\n title,\n ...rest\n } = props\n\n const mediaActiveProps = useMediaPropsActive(props)\n const size = mediaActiveProps.size || '$4'\n const subtitleSizeToken = getSize(size, -3)\n const subtitleSize = `$${subtitleSizeToken.key}` as FontSizeTokens\n const iconSize = getFontSize(size) * scaleIcon\n const getThemedIcon = useGetThemedIcon({ size: iconSize, color })\n const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon)\n const spaceSize = getVariableValue(iconSize) * scaleSpace\n // @ts-ignore noTextWrap = all is ok\n const contents = wrapChildrenInText(Text, mediaActiveProps)\n\n return {\n props: {\n fontFamily,\n ...rest,\n children: (\n <>\n {themedIcon ? (\n <>\n {themedIcon}\n <Spacer size={spaceSize} />\n </>\n ) : null}\n {/* helper for common title/subtitle pttern */}\n {title || subTitle ? (\n <YStack flex={1}>\n {noTextWrap === 'all' ? title : <Title size={size}>{title}</Title>}\n {subTitle ? (\n <>\n <Spacer flex size={spaceSize * 0.333} />\n {typeof subTitle === 'string' && noTextWrap !== 'all' ? (\n // TODO can use theme but we need to standardize to alt themes\n // or standardize on subtle colors in themes\n <Subtitle size={subtitleSize}>{subTitle}</Subtitle>\n ) : (\n subTitle\n )}\n </>\n ) : null}\n {contents}\n </YStack>\n ) : (\n contents\n )}\n {themedIconAfter ? (\n <>\n <Spacer size={spaceSize} />\n {themedIconAfter}\n </>\n ) : null}\n </>\n ),\n },\n }\n}\n\nconst ListItemComponent = forwardRef<TamaguiElement, ListItemProps>((props, ref) => {\n const { props: listItemProps } = useListItem(props)\n return <ListItemFrame ref={ref} justifyContent=\"space-between\" {...listItemProps} />\n})\n\nexport const listItemStaticConfig = {\n inlineProps: new Set([\n // text props go here (can't really optimize them, but we never fully extract listItem anyway)\n 'color',\n 'fontWeight',\n 'fontSize',\n 'fontFamily',\n 'letterSpacing',\n 'textAlign',\n ]),\n}\n\nexport const ListItem = withStaticProperties(\n ListItemFrame.extractable(\n themeable(ListItemComponent, { componentName: NAME }),\n listItemStaticConfig\n ),\n {\n Text: ListItemText,\n Subtitle: ListItemSubtitle,\n }\n)\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EAGE;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,UAAU,wBAAwB;AAC3C,SAAS,gBAAgB,cAAc;AACvC,SAAS,aAA+B,0BAA0B;AAClE,SAAmC,kBAAkB;AA6CrD,MAAM,OAAO;AAEN,MAAM,gBAAgB,OAAO,gBAAgB;AAAA,EAClD,MAAM;AAAA,EACN,KAAK;AAAA,EACL,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,OAAO;AAAA,EACP,aAAa;AAAA,EACb,UAAU;AAAA,EACV,UAAU;AAAA,EACV,eAAe;AAAA,EAEf,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,WAAW,CAAC,KAAK,EAAE,OAAO,MAAM;AAC9B,eAAO;AAAA,UACL,WAAW,OAAO,KAAK;AAAA,UACvB,mBAAmB,OAAO,MAAM;AAAA,UAChC,iBAAiB,SAAS,KAAK,EAAE;AAAA,QACnC;AAAA,MACF;AAAA,IACF;AAAA,IAEA,QAAQ;AAAA,MACN,MAAM;AAAA,QACJ,YAAY;AAAA,UACV,iBAAiB;AAAA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|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/list-item",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -21,16 +21,17 @@
|
|
|
21
21
|
"watch": "tamagui-build --watch"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@tamagui/core": "^1.0.
|
|
25
|
-
"@tamagui/font-size": "^1.0.
|
|
26
|
-
"@tamagui/
|
|
24
|
+
"@tamagui/core": "^1.0.4",
|
|
25
|
+
"@tamagui/font-size": "^1.0.4",
|
|
26
|
+
"@tamagui/get-size": "^1.0.4",
|
|
27
|
+
"@tamagui/helpers-tamagui": "^1.0.4"
|
|
27
28
|
},
|
|
28
29
|
"peerDependencies": {
|
|
29
30
|
"react": "*",
|
|
30
31
|
"react-dom": "*"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
|
-
"@tamagui/build": "^1.0.
|
|
34
|
+
"@tamagui/build": "^1.0.4",
|
|
34
35
|
"react": "^18.2.0",
|
|
35
36
|
"react-dom": "^18.2.0"
|
|
36
37
|
},
|
package/src/ListItem.tsx
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
Spacer,
|
|
5
5
|
TamaguiElement,
|
|
6
6
|
ThemeableProps,
|
|
7
|
-
getSize,
|
|
8
7
|
getVariableValue,
|
|
9
8
|
styled,
|
|
10
9
|
themeable,
|
|
@@ -12,6 +11,7 @@ import {
|
|
|
12
11
|
withStaticProperties,
|
|
13
12
|
} from '@tamagui/core'
|
|
14
13
|
import { getFontSize } from '@tamagui/font-size'
|
|
14
|
+
import { getSize } from '@tamagui/get-size'
|
|
15
15
|
import { getSpace, useGetThemedIcon } from '@tamagui/helpers-tamagui'
|
|
16
16
|
import { ThemeableStack, YStack } from '@tamagui/stacks'
|
|
17
17
|
import { SizableText, TextParentStyles, wrapChildrenInText } from '@tamagui/text'
|
|
@@ -102,7 +102,7 @@ export const ListItemFrame = styled(ThemeableStack, {
|
|
|
102
102
|
} as const,
|
|
103
103
|
|
|
104
104
|
defaultVariants: {
|
|
105
|
-
size: '$
|
|
105
|
+
size: '$true',
|
|
106
106
|
},
|
|
107
107
|
})
|
|
108
108
|
|
|
@@ -139,7 +139,7 @@ export const useListItem = (
|
|
|
139
139
|
Title?: any
|
|
140
140
|
Subtitle?: any
|
|
141
141
|
Text?: any
|
|
142
|
-
} = { Text: ListItemText, Subtitle: ListItemSubtitle, Title: ListItemTitle }
|
|
142
|
+
} = { Text: ListItemText, Subtitle: ListItemSubtitle, Title: ListItemTitle }
|
|
143
143
|
) => {
|
|
144
144
|
// careful not to desctructure and re-order props, order is important
|
|
145
145
|
const {
|
|
@@ -224,9 +224,7 @@ export const useListItem = (
|
|
|
224
224
|
|
|
225
225
|
const ListItemComponent = forwardRef<TamaguiElement, ListItemProps>((props, ref) => {
|
|
226
226
|
const { props: listItemProps } = useListItem(props)
|
|
227
|
-
return
|
|
228
|
-
<ListItemFrame ref={ref} justifyContent="space-between" {...listItemProps} />
|
|
229
|
-
)
|
|
227
|
+
return <ListItemFrame ref={ref} justifyContent="space-between" {...listItemProps} />
|
|
230
228
|
})
|
|
231
229
|
|
|
232
230
|
export const listItemStaticConfig = {
|
|
@@ -244,10 +242,10 @@ export const listItemStaticConfig = {
|
|
|
244
242
|
export const ListItem = withStaticProperties(
|
|
245
243
|
ListItemFrame.extractable(
|
|
246
244
|
themeable(ListItemComponent, { componentName: NAME }),
|
|
247
|
-
listItemStaticConfig
|
|
245
|
+
listItemStaticConfig
|
|
248
246
|
),
|
|
249
247
|
{
|
|
250
248
|
Text: ListItemText,
|
|
251
249
|
Subtitle: ListItemSubtitle,
|
|
252
|
-
}
|
|
250
|
+
}
|
|
253
251
|
)
|
package/types/ListItem.d.ts
CHANGED
|
@@ -123,7 +123,9 @@ export declare const ListItemFrame: import("@tamagui/core").TamaguiComponent<Omi
|
|
|
123
123
|
export declare const ListItemText: import("@tamagui/core").TamaguiComponent<(Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
|
|
124
124
|
readonly size?: FontSizeTokens | undefined;
|
|
125
125
|
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
|
|
126
|
-
readonly size?: FontSizeTokens | undefined;
|
|
126
|
+
readonly size?: FontSizeTokens | undefined; /**
|
|
127
|
+
* adjust icon relative to size
|
|
128
|
+
*/
|
|
127
129
|
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
|
|
128
130
|
readonly size?: FontSizeTokens | undefined;
|
|
129
131
|
}>>) | (Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{
|
|
@@ -148,7 +150,9 @@ export declare const ListItemText: import("@tamagui/core").TamaguiComponent<(Omi
|
|
|
148
150
|
export declare const ListItemSubtitle: import("@tamagui/core").TamaguiComponent<(Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
|
|
149
151
|
readonly size?: FontSizeTokens | undefined;
|
|
150
152
|
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
|
|
151
|
-
readonly size?: FontSizeTokens | undefined;
|
|
153
|
+
readonly size?: FontSizeTokens | undefined; /**
|
|
154
|
+
* adjust icon relative to size
|
|
155
|
+
*/
|
|
152
156
|
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
|
|
153
157
|
readonly size?: FontSizeTokens | undefined;
|
|
154
158
|
}>>) | (Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{
|
|
@@ -225,7 +229,9 @@ export declare const ListItemSubtitle: import("@tamagui/core").TamaguiComponent<
|
|
|
225
229
|
export declare const ListItemTitle: import("@tamagui/core").TamaguiComponent<(Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
|
|
226
230
|
readonly size?: FontSizeTokens | undefined;
|
|
227
231
|
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
|
|
228
|
-
readonly size?: FontSizeTokens | undefined;
|
|
232
|
+
readonly size?: FontSizeTokens | undefined; /**
|
|
233
|
+
* adjust icon relative to size
|
|
234
|
+
*/
|
|
229
235
|
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
|
|
230
236
|
readonly size?: FontSizeTokens | undefined;
|
|
231
237
|
}>>) | (Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{
|
|
@@ -380,9 +386,17 @@ export declare const useListItem: (props: ListItemProps, { Text, Subtitle, Title
|
|
|
380
386
|
rel?: any;
|
|
381
387
|
download?: any;
|
|
382
388
|
href?: string | undefined;
|
|
389
|
+
/**
|
|
390
|
+
* adjust icon relative to size
|
|
391
|
+
*/
|
|
392
|
+
/**
|
|
393
|
+
* default: -1
|
|
394
|
+
*/
|
|
383
395
|
hrefAttrs?: {
|
|
384
396
|
target?: "top" | "_blank" | "_self" | "_top" | "blank" | "self" | undefined;
|
|
385
|
-
rel?: string | undefined;
|
|
397
|
+
rel?: string | undefined; /**
|
|
398
|
+
* make the spacing elements flex
|
|
399
|
+
*/
|
|
386
400
|
download?: boolean | undefined;
|
|
387
401
|
} | undefined;
|
|
388
402
|
onMouseDown?: (((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void) & React.MouseEventHandler<HTMLDivElement>) | undefined;
|
|
@@ -395,17 +409,16 @@ export declare const useListItem: (props: ListItemProps, { Text, Subtitle, Title
|
|
|
395
409
|
onScrollShouldSetResponderCapture?: unknown;
|
|
396
410
|
onSelectionChangeShouldSetResponder?: unknown;
|
|
397
411
|
onSelectionChangeShouldSetResponderCapture?: unknown;
|
|
398
|
-
asChild?: boolean | undefined;
|
|
399
|
-
|
|
412
|
+
asChild?: boolean | undefined;
|
|
413
|
+
/**
|
|
414
|
+
* default: -1
|
|
400
415
|
*/
|
|
401
416
|
spaceDirection?: import("@tamagui/core").SpaceDirection | undefined;
|
|
402
417
|
separator?: React.ReactNode;
|
|
403
418
|
dangerouslySetInnerHTML?: {
|
|
404
419
|
__html: string;
|
|
405
420
|
} | undefined;
|
|
406
|
-
animation?: import("@tamagui/core").AnimationProp | null | undefined;
|
|
407
|
-
* adjust internal space relative to icon size
|
|
408
|
-
*/
|
|
421
|
+
animation?: import("@tamagui/core").AnimationProp | null | undefined;
|
|
409
422
|
animateOnly?: string[] | undefined;
|
|
410
423
|
debug?: boolean | "verbose" | undefined;
|
|
411
424
|
disabled?: boolean | undefined;
|
|
@@ -747,7 +760,9 @@ export declare const ListItem: ((props: Omit<Omit<TextParentStyles, "TextCompone
|
|
|
747
760
|
Text: import("@tamagui/core").TamaguiComponent<(Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
|
|
748
761
|
readonly size?: FontSizeTokens | undefined;
|
|
749
762
|
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
|
|
750
|
-
readonly size?: FontSizeTokens | undefined;
|
|
763
|
+
readonly size?: FontSizeTokens | undefined; /**
|
|
764
|
+
* adjust icon relative to size
|
|
765
|
+
*/
|
|
751
766
|
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
|
|
752
767
|
readonly size?: FontSizeTokens | undefined;
|
|
753
768
|
}>>) | (Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{
|
|
@@ -772,7 +787,9 @@ export declare const ListItem: ((props: Omit<Omit<TextParentStyles, "TextCompone
|
|
|
772
787
|
Subtitle: import("@tamagui/core").TamaguiComponent<(Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
|
|
773
788
|
readonly size?: FontSizeTokens | undefined;
|
|
774
789
|
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
|
|
775
|
-
readonly size?: FontSizeTokens | undefined;
|
|
790
|
+
readonly size?: FontSizeTokens | undefined; /**
|
|
791
|
+
* adjust icon relative to size
|
|
792
|
+
*/
|
|
776
793
|
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
|
|
777
794
|
readonly size?: FontSizeTokens | undefined;
|
|
778
795
|
}>>) | (Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{
|