@tamagui/list-item 1.27.2 → 1.27.3
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/package.json +7 -7
- package/dist/esm/ListItem.mjs +0 -187
- package/dist/esm/index.mjs +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/list-item",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.3",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -21,17 +21,17 @@
|
|
|
21
21
|
"watch": "tamagui-build --watch"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@tamagui/core": "1.27.
|
|
25
|
-
"@tamagui/font-size": "1.27.
|
|
26
|
-
"@tamagui/get-size": "1.27.
|
|
27
|
-
"@tamagui/helpers-tamagui": "1.27.
|
|
28
|
-
"@tamagui/text": "1.27.
|
|
24
|
+
"@tamagui/core": "1.27.3",
|
|
25
|
+
"@tamagui/font-size": "1.27.3",
|
|
26
|
+
"@tamagui/get-size": "1.27.3",
|
|
27
|
+
"@tamagui/helpers-tamagui": "1.27.3",
|
|
28
|
+
"@tamagui/text": "1.27.3"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": "*"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@tamagui/build": "1.27.
|
|
34
|
+
"@tamagui/build": "1.27.3",
|
|
35
35
|
"react": "^18.2.0"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
package/dist/esm/ListItem.mjs
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
Spacer,
|
|
4
|
-
getTokens,
|
|
5
|
-
getVariableValue,
|
|
6
|
-
styled,
|
|
7
|
-
useProps,
|
|
8
|
-
withStaticProperties
|
|
9
|
-
} from "@tamagui/core";
|
|
10
|
-
import { getFontSize } from "@tamagui/font-size";
|
|
11
|
-
import { getSpace, useGetThemedIcon } from "@tamagui/helpers-tamagui";
|
|
12
|
-
import { ThemeableStack, YStack } from "@tamagui/stacks";
|
|
13
|
-
import { SizableText, wrapChildrenInText } from "@tamagui/text";
|
|
14
|
-
const NAME = "ListItem";
|
|
15
|
-
const listItemVariants = {
|
|
16
|
-
unstyled: {
|
|
17
|
-
false: {
|
|
18
|
-
size: "$true",
|
|
19
|
-
alignItems: "center",
|
|
20
|
-
flexWrap: "nowrap",
|
|
21
|
-
width: "100%",
|
|
22
|
-
borderColor: "$borderColor",
|
|
23
|
-
maxWidth: "100%",
|
|
24
|
-
overflow: "hidden",
|
|
25
|
-
flexDirection: "row",
|
|
26
|
-
backgroundColor: "$background"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
size: {
|
|
30
|
-
"...size": (val, { tokens }) => {
|
|
31
|
-
return {
|
|
32
|
-
minHeight: tokens.size[val],
|
|
33
|
-
paddingHorizontal: tokens.space[val],
|
|
34
|
-
paddingVertical: getSpace(val, -2)
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
active: {
|
|
39
|
-
true: {
|
|
40
|
-
hoverStyle: {
|
|
41
|
-
backgroundColor: "$background"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
disabled: {
|
|
46
|
-
true: {
|
|
47
|
-
opacity: 0.5,
|
|
48
|
-
// TODO breaking types
|
|
49
|
-
pointerEvents: "none"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const ListItemFrame = styled(ThemeableStack, {
|
|
54
|
-
name: NAME,
|
|
55
|
-
tag: "li",
|
|
56
|
-
variants: listItemVariants,
|
|
57
|
-
defaultVariants: {
|
|
58
|
-
unstyled: false
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
const ListItemText = styled(SizableText, {
|
|
62
|
-
name: "ListItemText",
|
|
63
|
-
variants: {
|
|
64
|
-
unstyled: {
|
|
65
|
-
false: {
|
|
66
|
-
color: "$color",
|
|
67
|
-
flexGrow: 1,
|
|
68
|
-
flexShrink: 1,
|
|
69
|
-
ellipse: true,
|
|
70
|
-
cursor: "default"
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
defaultVariants: {
|
|
75
|
-
unstyled: false
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
const ListItemSubtitle = styled(ListItemText, {
|
|
79
|
-
name: "ListItemSubtitle",
|
|
80
|
-
variants: {
|
|
81
|
-
unstyled: {
|
|
82
|
-
false: {
|
|
83
|
-
opacity: 0.6,
|
|
84
|
-
maxWidth: "100%",
|
|
85
|
-
size: "$3",
|
|
86
|
-
color: "$color"
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
defaultVariants: {
|
|
91
|
-
unstyled: false
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
const ListItemTitle = styled(ListItemText, {
|
|
95
|
-
name: "ListItemTitle"
|
|
96
|
-
});
|
|
97
|
-
const useListItem = (props, {
|
|
98
|
-
Text = ListItemText,
|
|
99
|
-
Subtitle = ListItemSubtitle,
|
|
100
|
-
Title = ListItemTitle
|
|
101
|
-
} = { Text: ListItemText, Subtitle: ListItemSubtitle, Title: ListItemTitle }) => {
|
|
102
|
-
const {
|
|
103
|
-
children,
|
|
104
|
-
icon,
|
|
105
|
-
iconAfter,
|
|
106
|
-
noTextWrap,
|
|
107
|
-
theme: themeName,
|
|
108
|
-
space,
|
|
109
|
-
spaceFlex,
|
|
110
|
-
scaleIcon = 1,
|
|
111
|
-
scaleSpace = 1,
|
|
112
|
-
subTitle,
|
|
113
|
-
// text props
|
|
114
|
-
color,
|
|
115
|
-
fontWeight,
|
|
116
|
-
letterSpacing,
|
|
117
|
-
fontSize,
|
|
118
|
-
fontFamily,
|
|
119
|
-
textAlign,
|
|
120
|
-
textProps,
|
|
121
|
-
title,
|
|
122
|
-
...rest
|
|
123
|
-
} = props;
|
|
124
|
-
const mediaActiveProps = useProps(props);
|
|
125
|
-
const size = mediaActiveProps.size || "$true";
|
|
126
|
-
const subtitleSize = `$${+String(size).replace("$", "") - 1}`;
|
|
127
|
-
const iconSize = getFontSize(size) * scaleIcon;
|
|
128
|
-
const getThemedIcon = useGetThemedIcon({ size: iconSize, color });
|
|
129
|
-
const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon);
|
|
130
|
-
const spaceSize = getVariableValue(getTokens().space[mediaActiveProps.space] ?? iconSize) * scaleSpace;
|
|
131
|
-
const contents = wrapChildrenInText(Text, mediaActiveProps);
|
|
132
|
-
return {
|
|
133
|
-
props: {
|
|
134
|
-
fontFamily,
|
|
135
|
-
...rest,
|
|
136
|
-
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
137
|
-
themedIcon ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
138
|
-
themedIcon,
|
|
139
|
-
/* @__PURE__ */ jsx(Spacer, { size: spaceSize })
|
|
140
|
-
] }) : null,
|
|
141
|
-
title || subTitle ? /* @__PURE__ */ jsxs(YStack, { flex: 1, children: [
|
|
142
|
-
noTextWrap === "all" ? title : /* @__PURE__ */ jsx(Title, { size, children: title }),
|
|
143
|
-
subTitle ? /* @__PURE__ */ jsx(Fragment, { children: typeof subTitle === "string" && noTextWrap !== "all" ? (
|
|
144
|
-
// TODO can use theme but we need to standardize to alt themes
|
|
145
|
-
// or standardize on subtle colors in themes
|
|
146
|
-
/* @__PURE__ */ jsx(Subtitle, { size: subtitleSize, children: subTitle })
|
|
147
|
-
) : subTitle }) : null,
|
|
148
|
-
contents
|
|
149
|
-
] }) : contents,
|
|
150
|
-
themedIconAfter ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
151
|
-
/* @__PURE__ */ jsx(Spacer, { size: spaceSize }),
|
|
152
|
-
themedIconAfter
|
|
153
|
-
] }) : null
|
|
154
|
-
] })
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
};
|
|
158
|
-
const ListItemComponent = ListItemFrame.styleable(function ListItem(props, ref) {
|
|
159
|
-
const { props: listItemProps } = useListItem(props);
|
|
160
|
-
return /* @__PURE__ */ jsx(ListItemFrame, { ref, justifyContent: "space-between", ...listItemProps });
|
|
161
|
-
});
|
|
162
|
-
const listItemStaticConfig = {
|
|
163
|
-
inlineProps: /* @__PURE__ */ new Set([
|
|
164
|
-
// text props go here (can't really optimize them, but we never fully extract listItem anyway)
|
|
165
|
-
"color",
|
|
166
|
-
"fontWeight",
|
|
167
|
-
"fontSize",
|
|
168
|
-
"fontFamily",
|
|
169
|
-
"letterSpacing",
|
|
170
|
-
"textAlign"
|
|
171
|
-
])
|
|
172
|
-
};
|
|
173
|
-
const ListItem2 = withStaticProperties(ListItemComponent, {
|
|
174
|
-
Text: ListItemText,
|
|
175
|
-
Subtitle: ListItemSubtitle
|
|
176
|
-
});
|
|
177
|
-
export {
|
|
178
|
-
ListItem2 as ListItem,
|
|
179
|
-
ListItemFrame,
|
|
180
|
-
ListItemSubtitle,
|
|
181
|
-
ListItemText,
|
|
182
|
-
ListItemTitle,
|
|
183
|
-
listItemStaticConfig,
|
|
184
|
-
listItemVariants,
|
|
185
|
-
useListItem
|
|
186
|
-
};
|
|
187
|
-
//# sourceMappingURL=ListItem.mjs.map
|
package/dist/esm/index.mjs
DELETED