@tamagui/list-item 1.0.1-beta.52 → 1.0.1-beta.55

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.
@@ -72,8 +72,8 @@ const ListItemFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
72
72
  size: {
73
73
  "...size": (val, { tokens }) => {
74
74
  return {
75
- paddingVertical: (0, import_core.getSize)(val, -2),
76
- paddingHorizontal: tokens.size[val]
75
+ minHeight: tokens.size[val],
76
+ paddingHorizontal: tokens.space[val]
77
77
  };
78
78
  }
79
79
  },
@@ -125,7 +125,8 @@ const ListItemComponent = (0, import_react.forwardRef)((props, ref) => {
125
125
  fontSize,
126
126
  fontFamily,
127
127
  textAlign,
128
- textProps
128
+ textProps,
129
+ title
129
130
  } = _a, rest = __objRest(_a, [
130
131
  "children",
131
132
  "icon",
@@ -143,7 +144,8 @@ const ListItemComponent = (0, import_react.forwardRef)((props, ref) => {
143
144
  "fontSize",
144
145
  "fontFamily",
145
146
  "textAlign",
146
- "textProps"
147
+ "textProps",
148
+ "title"
147
149
  ]);
148
150
  const size = props.size || "$4";
149
151
  const subtitleSizeToken = (0, import_core.getSize)(size, -2);
@@ -158,15 +160,17 @@ const ListItemComponent = (0, import_react.forwardRef)((props, ref) => {
158
160
  ref
159
161
  }, rest), themedIcon || themedIconAfter ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, themedIcon ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, themedIcon, /* @__PURE__ */ import_react.default.createElement(import_core.Spacer, {
160
162
  size: spaceSize
161
- })) : null, /* @__PURE__ */ import_react.default.createElement(import_stacks.YStack, null, contents, subTitle ? typeof subTitle === "string" ? /* @__PURE__ */ import_react.default.createElement(ListItemSubtitle, {
163
+ })) : null, !!(title || subTitle) && /* @__PURE__ */ import_react.default.createElement(import_stacks.YStack, {
164
+ flex: 1
165
+ }, /* @__PURE__ */ import_react.default.createElement(ListItemText, null, title), subTitle ? typeof subTitle === "string" ? /* @__PURE__ */ import_react.default.createElement(ListItemSubtitle, {
162
166
  opacity: 0.65,
163
167
  size: subtitleSize
164
- }, subTitle) : subTitle : null), themedIconAfter ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_core.Spacer, {
168
+ }, subTitle) : subTitle : null), contents, themedIconAfter ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_core.Spacer, {
165
169
  flex: true,
166
170
  size: spaceSize
167
171
  }), themedIconAfter) : null) : contents);
168
172
  });
169
- const ListItem = ListItemFrame.extractable((0, import_core.themeable)(ListItemComponent), {
173
+ const ListItemInner = ListItemFrame.extractable((0, import_core.themeable)(ListItemComponent), {
170
174
  inlineProps: /* @__PURE__ */ new Set([
171
175
  "color",
172
176
  "fontWeight",
@@ -176,6 +180,10 @@ const ListItem = ListItemFrame.extractable((0, import_core.themeable)(ListItemCo
176
180
  "textAlign"
177
181
  ])
178
182
  });
183
+ const ListItem = (0, import_core.withStaticProperties)(ListItemInner, {
184
+ Text: ListItemText,
185
+ Subtitle: ListItemSubtitle
186
+ });
179
187
  // Annotate the CommonJS export names for ESM import in node:
180
188
  0 && (module.exports = {
181
189
  ListItem,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ListItem.tsx"],
4
- "sourcesContent": ["import {\n FontSizeTokens,\n GetProps,\n ReactComponentWithRef,\n Spacer,\n ThemeableProps,\n getSize,\n getVariableValue,\n styled,\n themeable,\n} from '@tamagui/core'\nimport { getFontSize } from '@tamagui/font-size'\nimport {\n TextParentStyles,\n useGetThemedIcon,\n wrapStringChildrenInText,\n} from '@tamagui/helpers-tamagui'\nimport { ThemeableStack, YStack } from '@tamagui/stacks'\nimport { SizableText } from '@tamagui/text'\nimport React, { FunctionComponent, forwardRef } from 'react'\nimport { View } from 'react-native'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\ntype ListItemIconProps = { color?: string; size?: number }\ntype IconProp = JSX.Element | FunctionComponent<ListItemIconProps> | null\n\nexport type ListItemProps = Omit<TextParentStyles, 'TextComponent'> &\n GetProps<typeof ListItemFrame> &\n ThemeableProps & {\n // add icon before, passes color and size automatically if Component\n icon?: IconProp\n // add icon after, passes color and size automatically if Component\n iconAfter?: IconProp\n // adjust icon relative to size\n // default: -1\n scaleIcon?: number\n // make the spacing elements flex\n spaceFlex?: number | boolean\n // adjust internal space relative to icon size\n scaleSpace?: number\n\n // subtitle\n subTitle?: React.ReactNode\n }\n\nconst ListItemFrame = styled(ThemeableStack, {\n name: 'ListItem',\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 paddingVertical: getSize(val, -2),\n paddingHorizontal: tokens.size[val],\n }\n },\n },\n\n active: {\n true: {\n hoverStyle: {\n backgroundColor: '$background',\n },\n },\n false: {},\n },\n\n disabled: {\n true: {\n opacity: 0.5,\n // TODO breaking types\n pointerEvents: 'none' as any,\n },\n false: {},\n },\n },\n\n defaultVariants: {\n size: '$4',\n },\n})\n\nexport const ListItemText = styled(SizableText, {\n color: '$color',\n selectable: false,\n flexGrow: 1,\n flexShrink: 1,\n ellipse: true,\n})\n\nexport const ListItemSubtitle = styled(ListItemText, {\n color: '$colorPress',\n})\n\nconst ListItemComponent = forwardRef((props: ListItemProps, ref) => {\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 ...rest\n } = props as ListItemProps\n\n const size = props.size || '$4'\n const subtitleSizeToken = getSize(size, -2)\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 const contents = wrapStringChildrenInText(ListItemText, props)\n\n return (\n <ListItemFrame fontFamily={fontFamily} ref={ref as any} {...rest}>\n {themedIcon || themedIconAfter ? (\n <>\n {themedIcon ? (\n <>\n {themedIcon}\n <Spacer size={spaceSize} />\n </>\n ) : null}\n <YStack>\n {contents}\n {subTitle ? (\n typeof subTitle === 'string' ? (\n // TODO can use theme but we need to standardize to alt themes\n // or standardize on subtle colors in themes\n <ListItemSubtitle opacity={0.65} size={subtitleSize}>\n {subTitle}\n </ListItemSubtitle>\n ) : (\n subTitle\n )\n ) : null}\n </YStack>\n {themedIconAfter ? (\n <>\n <Spacer flex size={spaceSize} />\n {themedIconAfter}\n </>\n ) : null}\n </>\n ) : (\n contents\n )}\n </ListItemFrame>\n )\n})\n\nexport const ListItem: ReactComponentWithRef<ListItemProps, HTMLLIElement | View> =\n ListItemFrame.extractable(themeable(ListItemComponent as any) as any, {\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"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAUO;AACP,uBAA4B;AAC5B,6BAIO;AACP,oBAAuC;AACvC,kBAA4B;AAC5B,mBAAqD;AAIrD,qBAAM;AAwBN,MAAM,gBAAgB,wBAAO,8BAAgB;AAAA,EAC3C,MAAM;AAAA,EACN,KAAK;AAAA,EACL,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,OAAO;AAAA,EACP,aAAa;AA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ACA;AAAA;AAIF,QAAM,OAAO,MAAM,QAAQ;AAC3B,QAAM,oBAAoB,yBAAQ,MAAM,EAAE;AAC1C,QAAM,eAAe,IAAI,kBAAkB;AAC3C,QAAM,WAAW,kCAAY,IAAI,IAAI;AACrC,QAAM,gBAAgB,6CAAiB,EAAE,MAAM,UAAU,MAAM,CAAC;AAChE,QAAM,CAAC,YAAY,mBAAmB,CAAC,MAAM,SAAS,EAAE,IAAI,aAAa;AACzE,QAAM,YAAY,kCAAiB,QAAQ,IAAI;AAC/C,QAAM,WAAW,qDAAyB,cAAc,KAAK;AAE7D,SACE,mDAAC;AAAA,IAAc;AAAA,IAAwB;AAAA,KAAqB,OACzD,cAAc,kBACb,wFACG,aACC,wFACG,YACD,mDAAC;AAAA,IAAO,MAAM;AAAA,GAAW,CAC3B,IACE,MACJ,mDAAC,4BACE,UACA,WACC,OAAO,aAAa,WAGlB,mDAAC;AAAA,IAAiB,SAAS;AAAA,IAAM,MAAM;AAAA,KACpC,QACH,IAEA,WAEA,IACN,GACC,kBACC,wFACE,mDAAC;AAAA,IAAO,MAAI;AAAA,IAAC,MAAM;AAAA,GAAW,GAC7B,eACH,IACE,IACN,IAEA,QAEJ;AAEJ,CAAC;AAEM,MAAM,WACX,cAAc,YAAY,2BAAU,iBAAwB,GAAU;AAAA,EACpE,aAAa,oBAAI,IAAI;AAAA,IAEnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH,CAAC;",
4
+ "sourcesContent": ["import {\n FontSizeTokens,\n GetProps,\n ReactComponentWithRef,\n Spacer,\n ThemeableProps,\n getSize,\n getVariableValue,\n styled,\n themeable,\n withStaticProperties,\n} from '@tamagui/core'\nimport { getFontSize } from '@tamagui/font-size'\nimport {\n TextParentStyles,\n useGetThemedIcon,\n wrapStringChildrenInText,\n} from '@tamagui/helpers-tamagui'\nimport { ThemeableStack, YStack } from '@tamagui/stacks'\nimport { SizableText } from '@tamagui/text'\nimport React, { FunctionComponent, forwardRef } from 'react'\nimport { View } from 'react-native'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\ntype ListItemIconProps = { color?: string; size?: number }\ntype IconProp = JSX.Element | FunctionComponent<ListItemIconProps> | null\n\nexport type ListItemProps = Omit<TextParentStyles, 'TextComponent'> &\n GetProps<typeof ListItemFrame> &\n ThemeableProps & {\n // add icon before, passes color and size automatically if Component\n icon?: IconProp\n // add icon after, passes color and size automatically if Component\n iconAfter?: IconProp\n // adjust icon relative to size\n // default: -1\n scaleIcon?: number\n // make the spacing elements flex\n spaceFlex?: number | boolean\n // adjust internal space relative to icon size\n scaleSpace?: number\n // title\n title?: React.ReactNode\n // subtitle\n subTitle?: React.ReactNode\n }\n\nconst ListItemFrame = styled(ThemeableStack, {\n name: 'ListItem',\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 }\n },\n },\n\n active: {\n true: {\n hoverStyle: {\n backgroundColor: '$background',\n },\n },\n false: {},\n },\n\n disabled: {\n true: {\n opacity: 0.5,\n // TODO breaking types\n pointerEvents: 'none' as any,\n },\n false: {},\n },\n },\n\n defaultVariants: {\n size: '$4',\n },\n})\n\nexport const ListItemText = styled(SizableText, {\n color: '$color',\n selectable: false,\n flexGrow: 1,\n flexShrink: 1,\n ellipse: true,\n})\n\nexport const ListItemSubtitle = styled(ListItemText, {\n color: '$colorPress',\n})\n\nconst ListItemComponent = forwardRef((props: ListItemProps, ref) => {\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 as ListItemProps\n\n const size = props.size || '$4'\n const subtitleSizeToken = getSize(size, -2)\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 const contents = wrapStringChildrenInText(ListItemText, props)\n\n return (\n <ListItemFrame fontFamily={fontFamily} ref={ref as any} {...rest}>\n {themedIcon || themedIconAfter ? (\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 <ListItemText>{title}</ListItemText>\n {subTitle ? (\n typeof subTitle === 'string' ? (\n // TODO can use theme but we need to standardize to alt themes\n // or standardize on subtle colors in themes\n <ListItemSubtitle opacity={0.65} size={subtitleSize}>\n {subTitle}\n </ListItemSubtitle>\n ) : (\n subTitle\n )\n ) : null}\n </YStack>\n )}\n {contents}\n {themedIconAfter ? (\n <>\n <Spacer flex size={spaceSize} />\n {themedIconAfter}\n </>\n ) : null}\n </>\n ) : (\n contents\n )}\n </ListItemFrame>\n )\n})\n\nconst ListItemInner: ReactComponentWithRef<ListItemProps, HTMLLIElement | View> =\n ListItemFrame.extractable(themeable(ListItemComponent as any) as any, {\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(ListItemInner, {\n Text: ListItemText,\n Subtitle: ListItemSubtitle,\n})\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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AAA,EACF,CAAC;AACH,CAAC;AAEI,MAAM,WAAW,sCAAqB,eAAe;AAAA,EAC1D,MAAM;AAAA,EACN,UAAU;AACZ,CAAC;",
6
6
  "names": []
7
7
  }
@@ -3,7 +3,8 @@ import {
3
3
  getSize,
4
4
  getVariableValue,
5
5
  styled,
6
- themeable
6
+ themeable,
7
+ withStaticProperties
7
8
  } from "@tamagui/core";
8
9
  import { getFontSize } from "@tamagui/font-size";
9
10
  import {
@@ -28,8 +29,8 @@ const ListItemFrame = styled(ThemeableStack, {
28
29
  size: {
29
30
  "...size": (val, { tokens }) => {
30
31
  return {
31
- paddingVertical: getSize(val, -2),
32
- paddingHorizontal: tokens.size[val]
32
+ minHeight: tokens.size[val],
33
+ paddingHorizontal: tokens.space[val]
33
34
  };
34
35
  }
35
36
  },
@@ -82,6 +83,7 @@ const ListItemComponent = forwardRef((props, ref) => {
82
83
  fontFamily,
83
84
  textAlign,
84
85
  textProps,
86
+ title,
85
87
  ...rest
86
88
  } = props;
87
89
  const size = props.size || "$4";
@@ -98,15 +100,17 @@ const ListItemComponent = forwardRef((props, ref) => {
98
100
  ...rest
99
101
  }, themedIcon || themedIconAfter ? /* @__PURE__ */ React.createElement(React.Fragment, null, themedIcon ? /* @__PURE__ */ React.createElement(React.Fragment, null, themedIcon, /* @__PURE__ */ React.createElement(Spacer, {
100
102
  size: spaceSize
101
- })) : null, /* @__PURE__ */ React.createElement(YStack, null, contents, subTitle ? typeof subTitle === "string" ? /* @__PURE__ */ React.createElement(ListItemSubtitle, {
103
+ })) : null, !!(title || subTitle) && /* @__PURE__ */ React.createElement(YStack, {
104
+ flex: 1
105
+ }, /* @__PURE__ */ React.createElement(ListItemText, null, title), subTitle ? typeof subTitle === "string" ? /* @__PURE__ */ React.createElement(ListItemSubtitle, {
102
106
  opacity: 0.65,
103
107
  size: subtitleSize
104
- }, subTitle) : subTitle : null), themedIconAfter ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Spacer, {
108
+ }, subTitle) : subTitle : null), contents, themedIconAfter ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Spacer, {
105
109
  flex: true,
106
110
  size: spaceSize
107
111
  }), themedIconAfter) : null) : contents);
108
112
  });
109
- const ListItem = ListItemFrame.extractable(themeable(ListItemComponent), {
113
+ const ListItemInner = ListItemFrame.extractable(themeable(ListItemComponent), {
110
114
  inlineProps: /* @__PURE__ */ new Set([
111
115
  "color",
112
116
  "fontWeight",
@@ -116,6 +120,10 @@ const ListItem = ListItemFrame.extractable(themeable(ListItemComponent), {
116
120
  "textAlign"
117
121
  ])
118
122
  });
123
+ const ListItem = withStaticProperties(ListItemInner, {
124
+ Text: ListItemText,
125
+ Subtitle: ListItemSubtitle
126
+ });
119
127
  export {
120
128
  ListItem,
121
129
  ListItemSubtitle,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/ListItem.tsx"],
4
- "sourcesContent": ["import {\n FontSizeTokens,\n GetProps,\n ReactComponentWithRef,\n Spacer,\n ThemeableProps,\n getSize,\n getVariableValue,\n styled,\n themeable,\n} from '@tamagui/core'\nimport { getFontSize } from '@tamagui/font-size'\nimport {\n TextParentStyles,\n useGetThemedIcon,\n wrapStringChildrenInText,\n} from '@tamagui/helpers-tamagui'\nimport { ThemeableStack, YStack } from '@tamagui/stacks'\nimport { SizableText } from '@tamagui/text'\nimport React, { FunctionComponent, forwardRef } from 'react'\nimport { View } from 'react-native'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\ntype ListItemIconProps = { color?: string; size?: number }\ntype IconProp = JSX.Element | FunctionComponent<ListItemIconProps> | null\n\nexport type ListItemProps = Omit<TextParentStyles, 'TextComponent'> &\n GetProps<typeof ListItemFrame> &\n ThemeableProps & {\n // add icon before, passes color and size automatically if Component\n icon?: IconProp\n // add icon after, passes color and size automatically if Component\n iconAfter?: IconProp\n // adjust icon relative to size\n // default: -1\n scaleIcon?: number\n // make the spacing elements flex\n spaceFlex?: number | boolean\n // adjust internal space relative to icon size\n scaleSpace?: number\n\n // subtitle\n subTitle?: React.ReactNode\n }\n\nconst ListItemFrame = styled(ThemeableStack, {\n name: 'ListItem',\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 paddingVertical: getSize(val, -2),\n paddingHorizontal: tokens.size[val],\n }\n },\n },\n\n active: {\n true: {\n hoverStyle: {\n backgroundColor: '$background',\n },\n },\n false: {},\n },\n\n disabled: {\n true: {\n opacity: 0.5,\n // TODO breaking types\n pointerEvents: 'none' as any,\n },\n false: {},\n },\n },\n\n defaultVariants: {\n size: '$4',\n },\n})\n\nexport const ListItemText = styled(SizableText, {\n color: '$color',\n selectable: false,\n flexGrow: 1,\n flexShrink: 1,\n ellipse: true,\n})\n\nexport const ListItemSubtitle = styled(ListItemText, {\n color: '$colorPress',\n})\n\nconst ListItemComponent = forwardRef((props: ListItemProps, ref) => {\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 ...rest\n } = props as ListItemProps\n\n const size = props.size || '$4'\n const subtitleSizeToken = getSize(size, -2)\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 const contents = wrapStringChildrenInText(ListItemText, props)\n\n return (\n <ListItemFrame fontFamily={fontFamily} ref={ref as any} {...rest}>\n {themedIcon || themedIconAfter ? (\n <>\n {themedIcon ? (\n <>\n {themedIcon}\n <Spacer size={spaceSize} />\n </>\n ) : null}\n <YStack>\n {contents}\n {subTitle ? (\n typeof subTitle === 'string' ? (\n // TODO can use theme but we need to standardize to alt themes\n // or standardize on subtle colors in themes\n <ListItemSubtitle opacity={0.65} size={subtitleSize}>\n {subTitle}\n </ListItemSubtitle>\n ) : (\n subTitle\n )\n ) : null}\n </YStack>\n {themedIconAfter ? (\n <>\n <Spacer flex size={spaceSize} />\n {themedIconAfter}\n </>\n ) : null}\n </>\n ) : (\n contents\n )}\n </ListItemFrame>\n )\n})\n\nexport const ListItem: ReactComponentWithRef<ListItemProps, HTMLLIElement | View> =\n ListItemFrame.extractable(themeable(ListItemComponent as any) as any, {\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"],
5
- "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA;AACA;AAAA;AAAA;AAAA;AAKA;AACA;AACA;AAIA,MAAM;AAwBN,MAAM,gBAAgB,OAAO,gBAAgB;AAAA,EAC3C,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,aAAa;AAC9B,eAAO;AAAA,UACL,iBAAiB,QAAQ,KAAK,EAAE;AAAA,UAChC,mBAAmB,OAAO,KAAK;AAAA,QACjC;AAAA,MACF;AAAA,IACF;AAAA,IAEA,QAAQ;AAAA,MACN,MAAM;AAAA,QACJ,YAAY;AAAA,UACV,iBAAiB;AAAA,QACnB;AAAA,MACF;AAAA,MACA,OAAO,CAAC;AAAA,IACV;A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AAiB,SAAS;AAAA,IAAM,MAAM;AAAA,KACpC,QACH,IAEA,WAEA,IACN,GACC,kBACC,0DACE,oCAAC;AAAA,IAAO,MAAI;AAAA,IAAC,MAAM;AAAA,GAAW,GAC7B,eACH,IACE,IACN,IAEA,QAEJ;AAEJ,CAAC;AAEM,MAAM,WACX,cAAc,YAAY,UAAU,iBAAwB,GAAU;AAAA,EACpE,aAAa,oBAAI,IAAI;AAAA,IAEnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH,CAAC;",
4
+ "sourcesContent": ["import {\n FontSizeTokens,\n GetProps,\n ReactComponentWithRef,\n Spacer,\n ThemeableProps,\n getSize,\n getVariableValue,\n styled,\n themeable,\n withStaticProperties,\n} from '@tamagui/core'\nimport { getFontSize } from '@tamagui/font-size'\nimport {\n TextParentStyles,\n useGetThemedIcon,\n wrapStringChildrenInText,\n} from '@tamagui/helpers-tamagui'\nimport { ThemeableStack, YStack } from '@tamagui/stacks'\nimport { SizableText } from '@tamagui/text'\nimport React, { FunctionComponent, forwardRef } from 'react'\nimport { View } from 'react-native'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\ntype ListItemIconProps = { color?: string; size?: number }\ntype IconProp = JSX.Element | FunctionComponent<ListItemIconProps> | null\n\nexport type ListItemProps = Omit<TextParentStyles, 'TextComponent'> &\n GetProps<typeof ListItemFrame> &\n ThemeableProps & {\n // add icon before, passes color and size automatically if Component\n icon?: IconProp\n // add icon after, passes color and size automatically if Component\n iconAfter?: IconProp\n // adjust icon relative to size\n // default: -1\n scaleIcon?: number\n // make the spacing elements flex\n spaceFlex?: number | boolean\n // adjust internal space relative to icon size\n scaleSpace?: number\n // title\n title?: React.ReactNode\n // subtitle\n subTitle?: React.ReactNode\n }\n\nconst ListItemFrame = styled(ThemeableStack, {\n name: 'ListItem',\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 }\n },\n },\n\n active: {\n true: {\n hoverStyle: {\n backgroundColor: '$background',\n },\n },\n false: {},\n },\n\n disabled: {\n true: {\n opacity: 0.5,\n // TODO breaking types\n pointerEvents: 'none' as any,\n },\n false: {},\n },\n },\n\n defaultVariants: {\n size: '$4',\n },\n})\n\nexport const ListItemText = styled(SizableText, {\n color: '$color',\n selectable: false,\n flexGrow: 1,\n flexShrink: 1,\n ellipse: true,\n})\n\nexport const ListItemSubtitle = styled(ListItemText, {\n color: '$colorPress',\n})\n\nconst ListItemComponent = forwardRef((props: ListItemProps, ref) => {\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 as ListItemProps\n\n const size = props.size || '$4'\n const subtitleSizeToken = getSize(size, -2)\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 const contents = wrapStringChildrenInText(ListItemText, props)\n\n return (\n <ListItemFrame fontFamily={fontFamily} ref={ref as any} {...rest}>\n {themedIcon || themedIconAfter ? (\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 <ListItemText>{title}</ListItemText>\n {subTitle ? (\n typeof subTitle === 'string' ? (\n // TODO can use theme but we need to standardize to alt themes\n // or standardize on subtle colors in themes\n <ListItemSubtitle opacity={0.65} size={subtitleSize}>\n {subTitle}\n </ListItemSubtitle>\n ) : (\n subTitle\n )\n ) : null}\n </YStack>\n )}\n {contents}\n {themedIconAfter ? (\n <>\n <Spacer flex size={spaceSize} />\n {themedIconAfter}\n </>\n ) : null}\n </>\n ) : (\n contents\n )}\n </ListItemFrame>\n )\n})\n\nconst ListItemInner: ReactComponentWithRef<ListItemProps, HTMLLIElement | View> =\n ListItemFrame.extractable(themeable(ListItemComponent as any) as any, {\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(ListItemInner, {\n Text: ListItemText,\n Subtitle: ListItemSubtitle,\n})\n"],
5
+ "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA;AACA;AAAA;AAAA;AAAA;AAKA;AACA;AACA;AAIA,MAAM;AAyBN,MAAM,gBAAgB,OAAO,gBAAgB;AAAA,EAC3C,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,aAAa;AAC9B,eAAO;AAAA,UACL,WAAW,OAAO,KAAK;AAAA,UACvB,mBAAmB,OAAO,MAAM;AAAA,QAClC;AAAA,MACF;AAAA,IACF;AAAA,IAEA,QAAQ;AAAA,MACN,MAAM;AAAA,QACJ,YAAY;AAAA,UACV,iBAAiB;AAAA,QACnB;AAAA,MACF;AAAA,MACA,OAAO,CAAC;AAAA,IACV;AAAA,IAEA,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,SAAS;AAAA,Q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WAGlB,oCAAC;AAAA,IAAiB,SAAS;AAAA,IAAM,MAAM;AAAA,KACpC,QACH,IAEA,WAEA,IACN,GAED,UACA,kBACC,0DACE,oCAAC;AAAA,IAAO,MAAI;AAAA,IAAC,MAAM;AAAA,GAAW,GAC7B,eACH,IACE,IACN,IAEA,QAEJ;AAEJ,CAAC;AAED,MAAM,gBACJ,cAAc,YAAY,UAAU,iBAAwB,GAAU;AAAA,EACpE,aAAa,oBAAI,IAAI;AAAA,IAEnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH,CAAC;AAEI,MAAM,WAAW,qBAAqB,eAAe;AAAA,EAC1D,MAAM;AAAA,EACN,UAAU;AACZ,CAAC;",
6
6
  "names": []
7
7
  }
@@ -3,7 +3,8 @@ import {
3
3
  getSize,
4
4
  getVariableValue,
5
5
  styled,
6
- themeable
6
+ themeable,
7
+ withStaticProperties
7
8
  } from "@tamagui/core";
8
9
  import { getFontSize } from "@tamagui/font-size";
9
10
  import {
@@ -28,8 +29,8 @@ const ListItemFrame = styled(ThemeableStack, {
28
29
  size: {
29
30
  "...size": (val, { tokens }) => {
30
31
  return {
31
- paddingVertical: getSize(val, -2),
32
- paddingHorizontal: tokens.size[val]
32
+ minHeight: tokens.size[val],
33
+ paddingHorizontal: tokens.space[val]
33
34
  };
34
35
  }
35
36
  },
@@ -82,6 +83,7 @@ const ListItemComponent = forwardRef((props, ref) => {
82
83
  fontFamily,
83
84
  textAlign,
84
85
  textProps,
86
+ title,
85
87
  ...rest
86
88
  } = props;
87
89
  const size = props.size || "$4";
@@ -97,17 +99,18 @@ const ListItemComponent = forwardRef((props, ref) => {
97
99
  {themedIcon}
98
100
  <Spacer size={spaceSize} />
99
101
  </> : null}
100
- <YStack>
101
- {contents}
102
+ {!!(title || subTitle) && <YStack flex={1}>
103
+ <ListItemText>{title}</ListItemText>
102
104
  {subTitle ? typeof subTitle === "string" ? <ListItemSubtitle opacity={0.65} size={subtitleSize}>{subTitle}</ListItemSubtitle> : subTitle : null}
103
- </YStack>
105
+ </YStack>}
106
+ {contents}
104
107
  {themedIconAfter ? <>
105
108
  <Spacer flex size={spaceSize} />
106
109
  {themedIconAfter}
107
110
  </> : null}
108
111
  </> : contents}</ListItemFrame>;
109
112
  });
110
- const ListItem = ListItemFrame.extractable(themeable(ListItemComponent), {
113
+ const ListItemInner = ListItemFrame.extractable(themeable(ListItemComponent), {
111
114
  inlineProps: /* @__PURE__ */ new Set([
112
115
  "color",
113
116
  "fontWeight",
@@ -117,6 +120,10 @@ const ListItem = ListItemFrame.extractable(themeable(ListItemComponent), {
117
120
  "textAlign"
118
121
  ])
119
122
  });
123
+ const ListItem = withStaticProperties(ListItemInner, {
124
+ Text: ListItemText,
125
+ Subtitle: ListItemSubtitle
126
+ });
120
127
  export {
121
128
  ListItem,
122
129
  ListItemSubtitle,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/list-item",
3
- "version": "1.0.1-beta.52",
3
+ "version": "1.0.1-beta.55",
4
4
  "sideEffects": false,
5
5
  "source": "src/index.ts",
6
6
  "types": "./types/index.d.ts",
@@ -16,16 +16,16 @@
16
16
  "watch": "tamagui-build --watch"
17
17
  },
18
18
  "dependencies": {
19
- "@tamagui/core": "^1.0.1-beta.52",
20
- "@tamagui/font-size": "^1.0.1-beta.52",
21
- "@tamagui/helpers-tamagui": "^1.0.1-beta.52"
19
+ "@tamagui/core": "^1.0.1-beta.55",
20
+ "@tamagui/font-size": "^1.0.1-beta.55",
21
+ "@tamagui/helpers-tamagui": "^1.0.1-beta.55"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": "*",
25
25
  "react-dom": "*"
26
26
  },
27
27
  "devDependencies": {
28
- "@tamagui/build": "^1.0.1-beta.52",
28
+ "@tamagui/build": "^1.0.1-beta.55",
29
29
  "react": "*",
30
30
  "react-dom": "*"
31
31
  },
@@ -13,6 +13,7 @@ export declare type ListItemProps = Omit<TextParentStyles, 'TextComponent'> & Ge
13
13
  scaleIcon?: number;
14
14
  spaceFlex?: number | boolean;
15
15
  scaleSpace?: number;
16
+ title?: React.ReactNode;
16
17
  subTitle?: React.ReactNode;
17
18
  };
18
19
  declare const ListItemFrame: import("@tamagui/core").TamaguiComponent<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
@@ -182,6 +183,93 @@ export declare const ListItemSubtitle: import("@tamagui/core").TamaguiComponent<
182
183
  } | {
183
184
  [x: string]: undefined;
184
185
  })>;
185
- export declare const ListItem: ReactComponentWithRef<ListItemProps, HTMLLIElement | View>;
186
+ export declare const ListItem: ReactComponentWithRef<ListItemProps, View | HTMLLIElement> & {
187
+ 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"> & {
188
+ size?: FontSizeTokens | undefined;
189
+ } & 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"> & {
190
+ size?: FontSizeTokens | undefined;
191
+ }>> & 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"> & {
192
+ size?: FontSizeTokens | undefined;
193
+ }>>) | (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<{
194
+ size?: FontSizeTokens | undefined;
195
+ }, string | number> & {
196
+ [x: string]: undefined;
197
+ } & 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<{
198
+ size?: FontSizeTokens | undefined;
199
+ }, string | number> & {
200
+ [x: string]: undefined;
201
+ }>> & 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<{
202
+ size?: FontSizeTokens | undefined;
203
+ }, string | number> & {
204
+ [x: string]: undefined;
205
+ }>>), any, import("@tamagui/core").TextPropsBase, {
206
+ size?: FontSizeTokens | undefined;
207
+ } & ({} | {
208
+ [x: string]: undefined;
209
+ })>;
210
+ 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"> & {
211
+ size?: FontSizeTokens | undefined;
212
+ } & 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"> & {
213
+ size?: FontSizeTokens | undefined;
214
+ }>> & 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"> & {
215
+ size?: FontSizeTokens | undefined;
216
+ }>>) | (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<{
217
+ size?: FontSizeTokens | undefined;
218
+ }, string | number> & {
219
+ [x: string]: undefined;
220
+ } & 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<{
221
+ size?: FontSizeTokens | undefined;
222
+ }, string | number> & {
223
+ [x: string]: undefined;
224
+ }>> & 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<{
225
+ size?: FontSizeTokens | undefined;
226
+ }, string | number> & {
227
+ [x: string]: undefined;
228
+ }>>) | (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<{
229
+ size?: FontSizeTokens | undefined;
230
+ } & ({} | {
231
+ [x: string]: undefined;
232
+ }), string | number> & {
233
+ [x: string]: undefined;
234
+ } & 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<{
235
+ size?: FontSizeTokens | undefined;
236
+ } & ({} | {
237
+ [x: string]: undefined;
238
+ }), string | number> & {
239
+ [x: string]: undefined;
240
+ }>> & 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<{
241
+ size?: FontSizeTokens | undefined;
242
+ } & ({} | {
243
+ [x: string]: undefined;
244
+ }), string | number> & {
245
+ [x: string]: undefined;
246
+ }>>) | (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<{
247
+ size?: FontSizeTokens | undefined;
248
+ } & ({} | {
249
+ [x: string]: undefined;
250
+ }), string | number> & {
251
+ [x: string]: undefined;
252
+ } & 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<{
253
+ size?: FontSizeTokens | undefined;
254
+ } & ({} | {
255
+ [x: string]: undefined;
256
+ }), string | number> & {
257
+ [x: string]: undefined;
258
+ }>> & 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<{
259
+ size?: FontSizeTokens | undefined;
260
+ } & ({} | {
261
+ [x: string]: undefined;
262
+ }), string | number> & {
263
+ [x: string]: undefined;
264
+ }>>), any, import("@tamagui/core").TextPropsBase, ({
265
+ size?: FontSizeTokens | undefined;
266
+ } & ({} | {
267
+ [x: string]: undefined;
268
+ })) & ({} | {
269
+ [x: string]: undefined;
270
+ } | {
271
+ [x: string]: undefined;
272
+ })>;
273
+ };
186
274
  export {};
187
275
  //# sourceMappingURL=ListItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../src/ListItem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