@tamagui/list-item 2.7.7 → 3.0.0-beta.1091.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 +116 -228
- package/dist/cjs/ListItem.native.cjs +149 -0
- package/dist/cjs/ListItem.native.js +120 -230
- package/dist/cjs/ListItem.native.js.map +1 -1
- package/dist/cjs/index.cjs +9 -11
- package/dist/cjs/index.native.cjs +20 -0
- package/dist/cjs/index.native.js +9 -10
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/ListItem.mjs +102 -217
- package/dist/esm/ListItem.mjs.map +1 -1
- package/dist/esm/ListItem.native.js +106 -220
- package/dist/esm/ListItem.native.js.map +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.mjs +1 -2
- package/dist/esm/index.native.js +1 -2
- package/dist/jsx/ListItem.mjs +102 -217
- package/dist/jsx/ListItem.mjs.map +1 -1
- package/dist/jsx/ListItem.native.cjs +149 -0
- package/dist/jsx/ListItem.native.js +120 -230
- package/dist/jsx/ListItem.native.js.map +1 -1
- package/dist/jsx/index.js +1 -2
- package/dist/jsx/index.mjs +1 -2
- package/dist/jsx/index.native.cjs +20 -0
- package/dist/jsx/index.native.js +9 -10
- package/dist/jsx/index.native.js.map +1 -1
- package/package.json +13 -11
- package/src/ListItem.tsx +173 -248
- package/types/ListItem.d.ts +105 -78
- package/types/ListItem.d.ts.map +1 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs.map +0 -1
package/dist/cjs/ListItem.cjs
CHANGED
|
@@ -3,254 +3,142 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
5
|
var __export = (target, all) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
10
|
};
|
|
11
11
|
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: true
|
|
22
|
-
}), mod);
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
21
|
var ListItem_exports = {};
|
|
24
22
|
__export(ListItem_exports, {
|
|
25
|
-
|
|
23
|
+
ListItemContext: () => ListItemContext,
|
|
24
|
+
ListItemFrame: () => ListItemFrame,
|
|
25
|
+
ListItemIcon: () => ListItemIcon,
|
|
26
|
+
ListItemSubtitle: () => ListItemSubtitle,
|
|
27
|
+
ListItemText: () => ListItemText,
|
|
28
|
+
ListItemTitle: () => ListItemTitle,
|
|
29
|
+
listItemSizeVariant: () => listItemSizeVariant,
|
|
30
|
+
useListItem: () => useListItem
|
|
26
31
|
});
|
|
27
32
|
module.exports = __toCommonJS(ListItem_exports);
|
|
28
|
-
var import_font_size = require("@tamagui/font-size");
|
|
29
33
|
var import_get_font_sized = require("@tamagui/get-font-sized");
|
|
30
|
-
var import_get_token = require("@tamagui/get-token");
|
|
31
|
-
var import_helpers = require("@tamagui/helpers");
|
|
32
34
|
var import_helpers_tamagui = require("@tamagui/helpers-tamagui");
|
|
35
|
+
var import_size = require("@tamagui/size");
|
|
33
36
|
var import_stacks = require("@tamagui/stacks");
|
|
34
37
|
var import_text = require("@tamagui/text");
|
|
35
38
|
var import_web = require("@tamagui/web");
|
|
36
39
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
const ListItemContext = (0, import_web.createStyledContext)({
|
|
41
|
+
size: void 0,
|
|
42
|
+
variant: void 0,
|
|
43
|
+
color: void 0
|
|
44
|
+
});
|
|
45
|
+
const listItemSizeVariant = import_web.styled.dynamic((val, env) => {
|
|
46
|
+
const { frame } = (0, import_size.resolveSize)(val, env);
|
|
47
|
+
return {
|
|
48
|
+
minHeight: frame.minHeight,
|
|
49
|
+
paddingHorizontal: frame.paddingHorizontal,
|
|
50
|
+
paddingVertical: frame.paddingVertical,
|
|
51
|
+
gap: frame.gap
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
const listItemSubtitleSizeVariant = import_web.styled.dynamic((val, env) => {
|
|
55
|
+
return (0, import_get_font_sized.getFontSized)((0, import_size.oneSizeSmaller)(val, env.sizes), env);
|
|
42
56
|
});
|
|
43
57
|
const ListItemFrame = (0, import_web.styled)(import_web.View, {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
backgroundColor: "$background",
|
|
61
|
-
cursor: "default",
|
|
62
|
-
hoverStyle: {
|
|
63
|
-
backgroundColor: "$backgroundHover",
|
|
64
|
-
borderColor: "$borderColorHover"
|
|
65
|
-
},
|
|
66
|
-
pressStyle: {
|
|
67
|
-
backgroundColor: "$backgroundPress",
|
|
68
|
-
borderColor: "$borderColorPress"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
variant: {
|
|
73
|
-
outlined: process.env.TAMAGUI_HEADLESS === "1" ? {} : {
|
|
74
|
-
backgroundColor: "transparent",
|
|
75
|
-
borderWidth: 1,
|
|
76
|
-
borderColor: "$borderColor",
|
|
77
|
-
hoverStyle: {
|
|
78
|
-
backgroundColor: "transparent",
|
|
79
|
-
borderColor: "$borderColorHover"
|
|
80
|
-
},
|
|
81
|
-
pressStyle: {
|
|
82
|
-
backgroundColor: "transparent",
|
|
83
|
-
borderColor: "$borderColorPress"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
size: {
|
|
88
|
-
"...size": (val, {
|
|
89
|
-
tokens
|
|
90
|
-
}) => {
|
|
91
|
-
return {
|
|
92
|
-
minHeight: tokens.size[val],
|
|
93
|
-
paddingHorizontal: tokens.space[val],
|
|
94
|
-
paddingVertical: (0, import_get_token.getSpace)(tokens.space[val], {
|
|
95
|
-
shift: -4
|
|
96
|
-
})
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
active: {
|
|
101
|
-
true: {
|
|
102
|
-
hoverStyle: {
|
|
103
|
-
backgroundColor: "$background"
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
disabled: {
|
|
108
|
-
true: {
|
|
109
|
-
opacity: 0.5,
|
|
110
|
-
pointerEvents: "none"
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
defaultVariants: {
|
|
115
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
116
|
-
}
|
|
58
|
+
context: ListItemContext,
|
|
59
|
+
displayName: "ListItemFrame",
|
|
60
|
+
role: "listitem",
|
|
61
|
+
render: "li",
|
|
62
|
+
size: true,
|
|
63
|
+
alignItems: "center",
|
|
64
|
+
justifyContent: "space-between",
|
|
65
|
+
flexWrap: "nowrap",
|
|
66
|
+
width: "100%",
|
|
67
|
+
maxWidth: "100%",
|
|
68
|
+
overflow: "hidden",
|
|
69
|
+
flexDirection: "row",
|
|
70
|
+
variants: {
|
|
71
|
+
size: listItemSizeVariant,
|
|
72
|
+
disabled: { true: { pointerEvents: "none" } }
|
|
73
|
+
}
|
|
117
74
|
});
|
|
118
75
|
const ListItemText = (0, import_web.styled)(import_text.SizableText, {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
flexGrow: 1,
|
|
127
|
-
flexShrink: 1,
|
|
128
|
-
ellipsis: true,
|
|
129
|
-
cursor: "inherit"
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
defaultVariants: {
|
|
134
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
135
|
-
}
|
|
76
|
+
context: ListItemContext,
|
|
77
|
+
displayName: "ListItemText",
|
|
78
|
+
size: true,
|
|
79
|
+
flexGrow: 1,
|
|
80
|
+
flexShrink: 1,
|
|
81
|
+
ellipsis: true,
|
|
82
|
+
cursor: "inherit"
|
|
136
83
|
});
|
|
137
84
|
const ListItemSubtitle = (0, import_web.styled)(ListItemText, {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
opacity: 0.6,
|
|
144
|
-
maxWidth: "100%",
|
|
145
|
-
color: "$color"
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
size: {
|
|
149
|
-
"...size": (val, extras) => {
|
|
150
|
-
const oneSmaller = (0, import_get_token.getSize)(val, {
|
|
151
|
-
shift: -1,
|
|
152
|
-
excludeHalfSteps: true
|
|
153
|
-
});
|
|
154
|
-
const fontStyle = (0, import_get_font_sized.getFontSized)(oneSmaller.key, extras);
|
|
155
|
-
return fontStyle;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
defaultVariants: {
|
|
160
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
161
|
-
}
|
|
85
|
+
context: ListItemContext,
|
|
86
|
+
displayName: "ListItemSubtitle",
|
|
87
|
+
opacity: .6,
|
|
88
|
+
maxWidth: "100%",
|
|
89
|
+
variants: { size: listItemSubtitleSizeVariant }
|
|
162
90
|
});
|
|
163
91
|
const ListItemTitle = (0, import_web.styled)(ListItemText, {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
variants: {
|
|
167
|
-
unstyled: {
|
|
168
|
-
false: {}
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
defaultVariants: {
|
|
172
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
173
|
-
}
|
|
92
|
+
context: ListItemContext,
|
|
93
|
+
displayName: "ListItemTitle"
|
|
174
94
|
});
|
|
175
|
-
const ListItemIcon =
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
if (!styledContext) {
|
|
183
|
-
throw new Error("ListItem.Icon must be used within a ListItem");
|
|
184
|
-
}
|
|
185
|
-
const sizeToken = size ?? styledContext.size ?? "$true";
|
|
186
|
-
const iconColor = (0, import_helpers_tamagui.useCurrentColor)(styledContext.color);
|
|
187
|
-
const iconSize = (0, import_font_size.getFontSize)(sizeToken) * scaleIcon;
|
|
188
|
-
return (0, import_helpers_tamagui.getIcon)(children, {
|
|
189
|
-
size: iconSize,
|
|
190
|
-
color: iconColor
|
|
191
|
-
});
|
|
95
|
+
const ListItemIcon = ({ children, size, scaleIcon = 1 }) => {
|
|
96
|
+
const context = ListItemContext.useStyledContext();
|
|
97
|
+
const getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
98
|
+
size: (0, import_helpers_tamagui.getThemedIconSize)(size ?? context.size ?? true, scaleIcon),
|
|
99
|
+
color: context.color
|
|
100
|
+
});
|
|
101
|
+
return getThemedIcon(children);
|
|
192
102
|
};
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
children: [title ? typeof title === "string" ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(ListItemTitle, {
|
|
236
|
-
unstyled,
|
|
237
|
-
size,
|
|
238
|
-
children: title
|
|
239
|
-
}) : title : null, subTitle ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
240
|
-
children: typeof subTitle === "string" ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(ListItemSubtitle, {
|
|
241
|
-
unstyled,
|
|
242
|
-
size,
|
|
243
|
-
children: subTitle
|
|
244
|
-
}) : subTitle
|
|
245
|
-
}) : null, wrappedChildren]
|
|
246
|
-
}) : wrappedChildren, themedIconAfter]
|
|
247
|
-
});
|
|
248
|
-
});
|
|
249
|
-
const ListItem2 = (0, import_helpers.withStaticProperties)(ListItemComponent, {
|
|
250
|
-
Apply: context.Provider,
|
|
251
|
-
Frame: ListItemFrame,
|
|
252
|
-
Text: ListItemText,
|
|
253
|
-
Subtitle: ListItemSubtitle,
|
|
254
|
-
Icon: ListItemIcon,
|
|
255
|
-
Title: ListItemTitle
|
|
256
|
-
});
|
|
103
|
+
function useListItem(propsIn) {
|
|
104
|
+
const [wrappedTextProps, listItemProps] = (0, import_web.splitStyleProps)(propsIn, {
|
|
105
|
+
expandShorthands: true,
|
|
106
|
+
filter: import_text.textParentProps
|
|
107
|
+
});
|
|
108
|
+
const { children, icon, iconAfter, iconSize, scaleIcon = 1, subTitle, title, ...frameProps } = listItemProps;
|
|
109
|
+
const { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;
|
|
110
|
+
const context = ListItemContext.useStyledContext();
|
|
111
|
+
const getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
112
|
+
size: (0, import_helpers_tamagui.getThemedIconSize)(iconSize ?? propsIn.size ?? context.size ?? true, scaleIcon),
|
|
113
|
+
color: propsIn.color ?? context.color
|
|
114
|
+
});
|
|
115
|
+
const wrappedChildren = (0, import_text.wrapChildrenInText)(ListItemText, {
|
|
116
|
+
children,
|
|
117
|
+
noTextWrap,
|
|
118
|
+
textProps
|
|
119
|
+
}, textStyleProps);
|
|
120
|
+
return { props: {
|
|
121
|
+
...frameProps,
|
|
122
|
+
color: propsIn.color,
|
|
123
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
124
|
+
icon ? getThemedIcon(icon) : null,
|
|
125
|
+
title || subTitle ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stacks.YStack, {
|
|
126
|
+
flex: 1,
|
|
127
|
+
children: [
|
|
128
|
+
typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListItemTitle, {
|
|
129
|
+
...textStyleProps,
|
|
130
|
+
...textProps,
|
|
131
|
+
children: title
|
|
132
|
+
}) : title,
|
|
133
|
+
typeof subTitle === "string" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListItemSubtitle, {
|
|
134
|
+
...textStyleProps,
|
|
135
|
+
...textProps,
|
|
136
|
+
children: subTitle
|
|
137
|
+
}) : subTitle,
|
|
138
|
+
wrappedChildren
|
|
139
|
+
]
|
|
140
|
+
}) : wrappedChildren,
|
|
141
|
+
iconAfter ? getThemedIcon(iconAfter) : null
|
|
142
|
+
] })
|
|
143
|
+
} };
|
|
144
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
+
var ListItem_exports = {};
|
|
24
|
+
__export(ListItem_exports, {
|
|
25
|
+
ListItemContext: () => ListItemContext,
|
|
26
|
+
ListItemFrame: () => ListItemFrame,
|
|
27
|
+
ListItemIcon: () => ListItemIcon,
|
|
28
|
+
ListItemSubtitle: () => ListItemSubtitle,
|
|
29
|
+
ListItemText: () => ListItemText,
|
|
30
|
+
ListItemTitle: () => ListItemTitle,
|
|
31
|
+
listItemSizeVariant: () => listItemSizeVariant,
|
|
32
|
+
useListItem: () => useListItem
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(ListItem_exports);
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_get_font_sized = require("@tamagui/get-font-sized");
|
|
37
|
+
var import_helpers_tamagui = require("@tamagui/helpers-tamagui");
|
|
38
|
+
var import_size = require("@tamagui/size");
|
|
39
|
+
var import_stacks = require("@tamagui/stacks");
|
|
40
|
+
var import_text = require("@tamagui/text");
|
|
41
|
+
var import_web = require("@tamagui/web");
|
|
42
|
+
var ListItemContext = (0, import_web.createStyledContext)({
|
|
43
|
+
size: void 0,
|
|
44
|
+
variant: void 0,
|
|
45
|
+
color: void 0
|
|
46
|
+
});
|
|
47
|
+
var listItemSizeVariant = import_web.styled.dynamic(function(val, env) {
|
|
48
|
+
var { frame } = (0, import_size.resolveSize)(val, env);
|
|
49
|
+
return {
|
|
50
|
+
minHeight: frame.minHeight,
|
|
51
|
+
paddingHorizontal: frame.paddingHorizontal,
|
|
52
|
+
paddingVertical: frame.paddingVertical,
|
|
53
|
+
gap: frame.gap
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
var listItemSubtitleSizeVariant = import_web.styled.dynamic(function(val, env) {
|
|
57
|
+
return (0, import_get_font_sized.getFontSized)((0, import_size.oneSizeSmaller)(val, env.sizes), env);
|
|
58
|
+
});
|
|
59
|
+
var ListItemFrame = (0, import_web.styled)(import_web.View, {
|
|
60
|
+
context: ListItemContext,
|
|
61
|
+
displayName: "ListItemFrame",
|
|
62
|
+
role: "listitem",
|
|
63
|
+
render: "li",
|
|
64
|
+
size: true,
|
|
65
|
+
alignItems: "center",
|
|
66
|
+
justifyContent: "space-between",
|
|
67
|
+
flexWrap: "nowrap",
|
|
68
|
+
width: "100%",
|
|
69
|
+
maxWidth: "100%",
|
|
70
|
+
overflow: "hidden",
|
|
71
|
+
flexDirection: "row",
|
|
72
|
+
variants: {
|
|
73
|
+
size: listItemSizeVariant,
|
|
74
|
+
disabled: { true: { pointerEvents: "none" } }
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
var ListItemText = (0, import_web.styled)(import_text.SizableText, {
|
|
78
|
+
context: ListItemContext,
|
|
79
|
+
displayName: "ListItemText",
|
|
80
|
+
size: true,
|
|
81
|
+
flexGrow: 1,
|
|
82
|
+
flexShrink: 1,
|
|
83
|
+
ellipsis: true,
|
|
84
|
+
cursor: "inherit"
|
|
85
|
+
});
|
|
86
|
+
var ListItemSubtitle = (0, import_web.styled)(ListItemText, {
|
|
87
|
+
context: ListItemContext,
|
|
88
|
+
displayName: "ListItemSubtitle",
|
|
89
|
+
opacity: .6,
|
|
90
|
+
maxWidth: "100%",
|
|
91
|
+
variants: { size: listItemSubtitleSizeVariant }
|
|
92
|
+
});
|
|
93
|
+
var ListItemTitle = (0, import_web.styled)(ListItemText, {
|
|
94
|
+
context: ListItemContext,
|
|
95
|
+
displayName: "ListItemTitle"
|
|
96
|
+
});
|
|
97
|
+
var ListItemIcon = function(param) {
|
|
98
|
+
var { children, size, scaleIcon = 1 } = param;
|
|
99
|
+
var context = ListItemContext.useStyledContext();
|
|
100
|
+
var _ref;
|
|
101
|
+
var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
102
|
+
size: (0, import_helpers_tamagui.getThemedIconSize)((_ref = size !== null && size !== void 0 ? size : context.size) !== null && _ref !== void 0 ? _ref : true, scaleIcon),
|
|
103
|
+
color: context.color
|
|
104
|
+
});
|
|
105
|
+
return getThemedIcon(children);
|
|
106
|
+
};
|
|
107
|
+
function useListItem(propsIn) {
|
|
108
|
+
var [wrappedTextProps, listItemProps] = (0, import_web.splitStyleProps)(propsIn, {
|
|
109
|
+
expandShorthands: true,
|
|
110
|
+
filter: import_text.textParentProps
|
|
111
|
+
});
|
|
112
|
+
var { children, icon, iconAfter, iconSize, scaleIcon = 1, subTitle, title, ...frameProps } = listItemProps;
|
|
113
|
+
var { noTextWrap, textProps, ...textStyleProps } = wrappedTextProps;
|
|
114
|
+
var context = ListItemContext.useStyledContext();
|
|
115
|
+
var _ref, _ref1, _propsIn_color;
|
|
116
|
+
var getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
117
|
+
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),
|
|
118
|
+
color: (_propsIn_color = propsIn.color) !== null && _propsIn_color !== void 0 ? _propsIn_color : context.color
|
|
119
|
+
});
|
|
120
|
+
var wrappedChildren = (0, import_text.wrapChildrenInText)(ListItemText, {
|
|
121
|
+
children,
|
|
122
|
+
noTextWrap,
|
|
123
|
+
textProps
|
|
124
|
+
}, textStyleProps);
|
|
125
|
+
return { props: {
|
|
126
|
+
...frameProps,
|
|
127
|
+
color: propsIn.color,
|
|
128
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
129
|
+
icon ? getThemedIcon(icon) : null,
|
|
130
|
+
title || subTitle ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_stacks.YStack, {
|
|
131
|
+
flex: 1,
|
|
132
|
+
children: [
|
|
133
|
+
typeof title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListItemTitle, {
|
|
134
|
+
...textStyleProps,
|
|
135
|
+
...textProps,
|
|
136
|
+
children: title
|
|
137
|
+
}) : title,
|
|
138
|
+
typeof subTitle === "string" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListItemSubtitle, {
|
|
139
|
+
...textStyleProps,
|
|
140
|
+
...textProps,
|
|
141
|
+
children: subTitle
|
|
142
|
+
}) : subTitle,
|
|
143
|
+
wrappedChildren
|
|
144
|
+
]
|
|
145
|
+
}) : wrappedChildren,
|
|
146
|
+
iconAfter ? getThemedIcon(iconAfter) : null
|
|
147
|
+
] })
|
|
148
|
+
} };
|
|
149
|
+
}
|