@plexui/react-native 0.2.23 → 0.2.24
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/es/components/BottomActions/BottomActions.js +6 -1
- package/dist/es/components/BottomSheet/BottomSheet.js +5 -0
- package/dist/es/components/List/List.js +12 -3
- package/dist/es/components/Toast/Toast.js +4 -3
- package/package.json +1 -1
- package/src/components/BottomActions/BottomActions.tsx +9 -1
- package/src/components/BottomSheet/BottomSheet.tsx +5 -0
- package/src/components/List/List.tsx +12 -3
- package/src/components/Toast/Toast.tsx +8 -3
|
@@ -33,12 +33,17 @@ export function BottomActions({ children, floating = false, background = "soft",
|
|
|
33
33
|
? { variant: "ghost", color: props.color ?? "secondary" }
|
|
34
34
|
: { variant: "soft", color: props.color ?? "secondary", mobileMaterial: props.mobileMaterial ?? "glass" }
|
|
35
35
|
: null;
|
|
36
|
-
|
|
36
|
+
const button = cloneElement(child, {
|
|
37
37
|
...second,
|
|
38
38
|
block: props.block ?? true,
|
|
39
39
|
size: props.size ?? "3xl",
|
|
40
40
|
style: [{ minHeight: height, borderRadius: height / 2 }, props.style],
|
|
41
41
|
});
|
|
42
|
+
// A disabled button's fill is see-through (the gray of iOS's disabled button): floating over the content it stands
|
|
43
|
+
// on the screen's color, so the rows under it do not show through
|
|
44
|
+
if (!floating || !props.disabled || android)
|
|
45
|
+
return button;
|
|
46
|
+
return (_jsx(View, { style: { borderRadius: height / 2, backgroundColor: canvas, alignSelf: (props.block ?? true) ? "stretch" : "flex-start" }, children: button }, child.key ?? index));
|
|
42
47
|
});
|
|
43
48
|
return (_jsxs(View, { testID: testID, pointerEvents: "box-none", style: [styles.bar, { paddingHorizontal: side, paddingTop, paddingBottom: bottom, gap: 8 }, floating ? styles.floating : null, style], children: [floating ? (android ? (_jsx(SoftBottomEdge, { fill: withAlpha(canvas, ANDROID_FADE_ALPHA), top: paddingTop - 13 + 60, tail: 60, blur: 0, stops: ANDROID_FADE_STOPS })) : background === "fade" ? (_jsx(TabBarFade, { fill: canvas, top: paddingTop })) : (_jsx(SoftBottomEdge, { fill: canvas, top: paddingTop, tail: 27, blur: theme.length("--toolbar-edge-blur-small", 3) }))) : null, actions] }));
|
|
44
49
|
}
|
|
@@ -175,6 +175,8 @@ export function BottomSheetBase({ open, onOpenChange, title, children, dismissib
|
|
|
175
175
|
const [drag] = useState(() => new Animated.Value(0));
|
|
176
176
|
const close = () => onOpenChange(false);
|
|
177
177
|
const android = theme.isAndroid;
|
|
178
|
+
// Android's content and actions 12 from the sheet's sides, as a page's groups; a token for a screen at another gutter
|
|
179
|
+
const androidInline = theme.length("--bottom-sheet-android-padding-inline", 12);
|
|
178
180
|
const reduced = theme.reducedMotion;
|
|
179
181
|
// One responder for the sheet's life, told the latest props after each render: a responder made again mid-drag
|
|
180
182
|
// would lose the drag
|
|
@@ -278,6 +280,8 @@ export function BottomSheetBase({ open, onOpenChange, title, children, dismissib
|
|
|
278
280
|
android
|
|
279
281
|
? [
|
|
280
282
|
styles.androidContent,
|
|
283
|
+
// A screen whose gutter is Material's compact 16 sets it with --bottom-sheet-android-padding-inline
|
|
284
|
+
{ paddingHorizontal: androidInline },
|
|
281
285
|
title != null ? styles.androidContentUnderBar : null,
|
|
282
286
|
// Over a footer: 8 above its height, which reaches over the sheet's bottom padding
|
|
283
287
|
footer ? { paddingBottom: 8 + Math.max(0, footerHeight - insets.bottom - keyboard) } : null,
|
|
@@ -288,6 +292,7 @@ export function BottomSheetBase({ open, onOpenChange, title, children, dismissib
|
|
|
288
292
|
android
|
|
289
293
|
? [
|
|
290
294
|
styles.androidFooter,
|
|
295
|
+
{ paddingHorizontal: androidInline },
|
|
291
296
|
// Over the sheet's color at 80%, faded in over its top 24dp, down over the gesture bar
|
|
292
297
|
{ paddingBottom: 12 + insets.bottom + keyboard, backgroundImage: `linear-gradient(to bottom, ${withAlpha(background, 0)}, ${withAlpha(background, 0.8)} 24px)` },
|
|
293
298
|
]
|
|
@@ -62,6 +62,8 @@ export function List({ children, header, description, footer, error, surface = "
|
|
|
62
62
|
.map((row) => (row.type === Button ? _jsx(ActionRow, { children: row }, row.key ?? undefined) : row));
|
|
63
63
|
const options = useMemo(() => ({ columns }), [columns]);
|
|
64
64
|
const increased = headerProminence === "increased";
|
|
65
|
+
// Android's footer 13 into the card's width, as the Settings app; a token for a screen that keeps text at its gutter
|
|
66
|
+
const footerInset = theme.length("--list-android-footer-inset", 13);
|
|
65
67
|
const fill = surface === "plain" ? theme.color("--field-group-background", theme.colors.surfaceSecondary) : theme.colors.groupedSurface;
|
|
66
68
|
// The card's corners: Android's 16dp card (a header or description inside it stands over the first row), iOS's group
|
|
67
69
|
const corner = surface === "plain" && theme.isAndroid ? 0 : theme.isAndroid ? ANDROID_CARD_RADIUS : theme.length("--field-group-radius", 26);
|
|
@@ -78,7 +80,7 @@ export function List({ children, header, description, footer, error, surface = "
|
|
|
78
80
|
// too), and its header is a band of the grouped canvas across them, 14sp Medium in the secondary label 16 in
|
|
79
81
|
const plain = surface === "plain";
|
|
80
82
|
const band = theme.colors.groupedBackground;
|
|
81
|
-
return (_jsxs(View, { testID: testID, style: style, children: [_jsxs(View, { style: plain ? { backgroundColor: theme.colors.groupedSurface } : [styles.androidCard, { backgroundColor: fill }], children: [header == null && action == null ? null : plain ? (_jsxs(View, { style: [styles.androidBand, action != null ? styles.androidBandRow : null, { backgroundColor: band }], children: [header != null ? (_jsx(Text, { accessibilityRole: "header", color: theme.colors.labelSecondary, weight: "medium", numberOfLines: 1, style: [styles.androidBandText, action != null ? styles.grow : null], children: header })) : (_jsx(View, { style: styles.grow })), action != null ? _jsx(ListActionContext.Provider, { value: "header", children: headerAction(action, styles.androidBandText, theme.colors.labelSecondary) }) : null] })) : action != null ? (_jsxs(View, { style: styles.androidHeaderRow, children: [header != null ? (_jsx(Text, { accessibilityRole: "header", color: increased ? theme.colors.text : accentText(theme), weight: "medium", style: [styles.androidHeaderTitle, increased ? styles.androidHeaderIncreased : null], children: header })) : (_jsx(View, { style: styles.grow })), _jsx(ListActionContext.Provider, { value: "header", children: headerAction(action, styles.androidHeaderTitleType, theme.colors.labelSecondary) })] })) : (_jsx(Text, { accessibilityRole: "header", color: increased ? theme.colors.text : accentText(theme), weight: "medium", style: [styles.androidHeader, increased ? styles.androidHeaderIncreased : null], children: header })), description != null ? (_jsx(Text, { color: theme.colors.labelSecondary, style: [styles.androidDescriptionLine, plain ? styles.androidDescriptionPlain : header == null ? styles.androidDescriptionAlone : null], children: description })) : null, _jsx(View, { accessibilityRole: "list", "aria-label": label, children: _jsx(ListOptionsContext.Provider, { value: options, children: body }) })] }), error != null ? (_jsx(Text, { color: dangerText(theme), accessibilityLiveRegion: "polite", style: [styles.androidFooter, plain ? [styles.androidFooterPlain, { backgroundColor: band }] : null], children: error })) : footer != null ? (_jsx(Text, { color: theme.colors.labelSecondary, style: [styles.androidFooter, plain ? [styles.androidFooterPlain, { backgroundColor: band }] : null], children: footer })) : null] }));
|
|
83
|
+
return (_jsxs(View, { testID: testID, style: style, children: [_jsxs(View, { style: plain ? { backgroundColor: theme.colors.groupedSurface } : [styles.androidCard, { backgroundColor: fill }], children: [header == null && action == null ? null : plain ? (_jsxs(View, { style: [styles.androidBand, action != null ? styles.androidBandRow : null, { backgroundColor: band }], children: [header != null ? (_jsx(Text, { accessibilityRole: "header", color: theme.colors.labelSecondary, weight: "medium", numberOfLines: 1, style: [styles.androidBandText, action != null ? styles.grow : null], children: header })) : (_jsx(View, { style: styles.grow })), action != null ? _jsx(ListActionContext.Provider, { value: "header", children: headerAction(action, styles.androidBandText, theme.colors.labelSecondary) }) : null] })) : action != null ? (_jsxs(View, { style: styles.androidHeaderRow, children: [header != null ? (_jsx(Text, { accessibilityRole: "header", color: increased ? theme.colors.text : accentText(theme), weight: "medium", style: [styles.androidHeaderTitle, increased ? styles.androidHeaderIncreased : null], children: header })) : (_jsx(View, { style: styles.grow })), _jsx(ListActionContext.Provider, { value: "header", children: headerAction(action, styles.androidHeaderTitleType, theme.colors.labelSecondary) })] })) : (_jsx(Text, { accessibilityRole: "header", color: increased ? theme.colors.text : accentText(theme), weight: "medium", style: [styles.androidHeader, increased ? styles.androidHeaderIncreased : null], children: header })), description != null ? (_jsx(Text, { color: theme.colors.labelSecondary, style: [styles.androidDescriptionLine, plain ? styles.androidDescriptionPlain : header == null ? styles.androidDescriptionAlone : null], children: description })) : null, _jsx(View, { accessibilityRole: "list", "aria-label": label, children: _jsx(ListOptionsContext.Provider, { value: options, children: body }) })] }), error != null ? (_jsx(Text, { color: dangerText(theme), accessibilityLiveRegion: "polite", style: [styles.androidFooter, { paddingHorizontal: footerInset }, plain ? [styles.androidFooterPlain, { backgroundColor: band }] : null], children: error })) : footer != null ? (_jsx(Text, { color: theme.colors.labelSecondary, style: [styles.androidFooter, { paddingHorizontal: footerInset }, plain ? [styles.androidFooterPlain, { backgroundColor: band }] : null], children: footer })) : null] }));
|
|
82
84
|
}
|
|
83
85
|
const inset = theme.length("--list-row-inset", 20);
|
|
84
86
|
const footerBox = cssBox(theme, "--field-group-footer-padding", [8, inset, 6, inset]);
|
|
@@ -371,6 +373,9 @@ function IOSContent({ handPress, valueColor, theme, label, description, descript
|
|
|
371
373
|
: Math.max(description != null ? descriptionPadding : theme.length("--field-row-text-padding-block", 12), (iosMinHeight(theme, description != null) - labelType.lineHeight - (description != null ? descriptionLine : 0)) / 2);
|
|
372
374
|
// A field at the end fills the room after the label (`RowEnd.fill`)
|
|
373
375
|
const [fill, setFill] = useState(false);
|
|
376
|
+
// A picture wider than the tile (a photo, an avatar) keeps its own size: it starts at the row's inset, where the
|
|
377
|
+
// header and the footer stand, and the text follows 14 past it, as UIKit's image to text padding
|
|
378
|
+
const [wide, setWide] = useState(false);
|
|
374
379
|
// In a List with `columns` a field's value starts at one column, 40% into the row (`--field-row-column-width`)
|
|
375
380
|
// A switch, a checkbox and a radio stay at the row's edge
|
|
376
381
|
const columns = useContext(ListOptionsContext)?.columns === true && trailing != null;
|
|
@@ -388,9 +393,13 @@ function IOSContent({ handPress, valueColor, theme, label, description, descript
|
|
|
388
393
|
});
|
|
389
394
|
return (_jsxs(_Fragment, { children: [leading != null ? (_jsx(View, { style: [
|
|
390
395
|
styles.tile,
|
|
391
|
-
{
|
|
396
|
+
{ minWidth: tile, minHeight: tile, marginStart: wide ? 0 : theme.length("--field-row-icon-offset", -2), marginEnd: theme.length("--field-row-icon-gap", 14) },
|
|
392
397
|
leadingColor ? { backgroundColor: leadingColor, borderRadius: theme.length("--field-row-icon-radius", 7) } : null,
|
|
393
|
-
],
|
|
398
|
+
], onLayout: (event) => {
|
|
399
|
+
const next = event.nativeEvent.layout.width > tile + 0.5;
|
|
400
|
+
if (next !== wide)
|
|
401
|
+
setWide(next);
|
|
402
|
+
}, children: _jsx(IconDefaultsProvider, { size: leadingColor ? 20 : theme.length("--field-row-icon-symbol-size", 24), color: leadingColor ? "#ffffff" : disabled ? theme.colors.labelTertiary : theme.colors.accent, children: leading }) })) : null, _jsxs(View, { ref: ref, onLayout: onRowLayout, style: [
|
|
394
403
|
error != null ? styles.iosColumn : styles.iosMain,
|
|
395
404
|
{ minHeight: iosMinHeight(theme, description != null || error != null), paddingEnd: inset },
|
|
396
405
|
error != null
|
|
@@ -361,9 +361,9 @@ function ToastView({ item, theme, hidden, replaced = false }) {
|
|
|
361
361
|
const titleWeight = Platform.OS === "web" ? fontWeight(theme.token(described ? "--font-weight-semibold" : "--font-weight-medium")) : undefined;
|
|
362
362
|
return (_jsx(Animated.View, { ...responder.panHandlers, accessibilityRole: "alert", pointerEvents: touches,
|
|
363
363
|
// An offset, not a transform: a transform would stop the glass's blur on the web
|
|
364
|
-
style: [styles.iosWrap, { top: Animated.add(progress.interpolate({ inputRange: [0, 1], outputRange: [-24, 0] }), drag), display, opacity: glassOpacity(progress, !leaving) }], children: _jsxs(Glass, { radius: described ? 24 : 21.5, elevation: "raised", fillToken: "--toast-mobile-background", style: styles.iosToast, children: [icon != null && icon !== false ? _jsx(View, { style: styles.iosIcon, children: icon }) : null, _jsxs(View, { style: [styles.iosText, item.action ? { minWidth: 8 * 15 } : null], children: [_jsx(Text, { weight: described ? "semibold" : "medium", style: { fontSize: 15, lineHeight: 17, fontWeight: titleWeight }, children: item.title }), described ? (
|
|
365
|
-
|
|
366
|
-
|
|
364
|
+
style: [styles.iosWrap, { top: Animated.add(progress.interpolate({ inputRange: [0, 1], outputRange: [-24, 0] }), drag), display, opacity: glassOpacity(progress, !leaving) }], children: _jsxs(Glass, { radius: described ? 24 : 21.5, elevation: "raised", fillToken: "--toast-mobile-background", style: styles.iosToast, children: [_jsxs(View, { style: styles.iosMessage, children: [icon != null && icon !== false ? _jsx(View, { style: styles.iosIcon, children: icon }) : null, _jsxs(View, { style: [styles.iosText, item.action ? { minWidth: 8 * 15 } : null], children: [_jsx(Text, { weight: described ? "semibold" : "medium", style: { fontSize: 15, lineHeight: 17, fontWeight: titleWeight }, children: item.title }), described ? (
|
|
365
|
+
// The web toast's description is the opaque secondary gray, not the phone's 50% label
|
|
366
|
+
_jsx(Text, { color: theme.colors.textSecondary, style: { fontSize: 15, lineHeight: 18 }, children: item.description })) : null] })] }), item.action ? (_jsx(Pressable, { accessibilityRole: "button", disabled: leaving, onPress: act,
|
|
367
367
|
// A 34pt capsule in a 44pt target
|
|
368
368
|
hitSlop: 5, style: ({ pressed }) => [styles.iosAction, { backgroundColor: theme.color("--color-background-primary-solid"), opacity: pressed ? 0.7 : 1 }], children: _jsx(Text, { weight: "regular", color: theme.color("--color-text-primary-solid"), style: { fontSize: 15, lineHeight: 20 }, children: item.action.label }) })) : null] }) }));
|
|
369
369
|
}
|
|
@@ -378,6 +378,7 @@ const styles = StyleSheet.create({
|
|
|
378
378
|
// 12/14 of padding inside sonner's 1px border, transparent on a phone
|
|
379
379
|
iosToast: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 10, paddingVertical: 13, paddingHorizontal: 15 },
|
|
380
380
|
iosIcon: { width: 16, height: 16, marginStart: -3, marginEnd: 4, justifyContent: "center", alignItems: "flex-start" },
|
|
381
|
+
iosMessage: { flexDirection: "row", alignItems: "center", gap: 10, flexShrink: 1, minWidth: 0 },
|
|
381
382
|
iosText: { flexShrink: 1, minWidth: 0 },
|
|
382
383
|
iosAction: { minHeight: 34, paddingVertical: 7, paddingHorizontal: 14, borderRadius: 9999, alignItems: "center", justifyContent: "center" },
|
|
383
384
|
// Android's toast card: a 16dp-cornered card at least 48 tall, the text 16 in (56 past a 24dp icon at 16)
|
package/package.json
CHANGED
|
@@ -62,12 +62,20 @@ export function BottomActions({ children, floating = false, background = "soft",
|
|
|
62
62
|
? { variant: "ghost" as const, color: props.color ?? ("secondary" as const) }
|
|
63
63
|
: { variant: "soft" as const, color: props.color ?? ("secondary" as const), mobileMaterial: props.mobileMaterial ?? ("glass" as const) }
|
|
64
64
|
: null
|
|
65
|
-
|
|
65
|
+
const button = cloneElement(child as ReactElement<ButtonProps>, {
|
|
66
66
|
...second,
|
|
67
67
|
block: props.block ?? true,
|
|
68
68
|
size: props.size ?? "3xl",
|
|
69
69
|
style: [{ minHeight: height, borderRadius: height / 2 }, props.style],
|
|
70
70
|
})
|
|
71
|
+
// A disabled button's fill is see-through (the gray of iOS's disabled button): floating over the content it stands
|
|
72
|
+
// on the screen's color, so the rows under it do not show through
|
|
73
|
+
if (!floating || !props.disabled || android) return button
|
|
74
|
+
return (
|
|
75
|
+
<View key={child.key ?? index} style={{ borderRadius: height / 2, backgroundColor: canvas, alignSelf: (props.block ?? true) ? "stretch" : "flex-start" }}>
|
|
76
|
+
{button}
|
|
77
|
+
</View>
|
|
78
|
+
)
|
|
71
79
|
})
|
|
72
80
|
return (
|
|
73
81
|
<View
|
|
@@ -230,6 +230,8 @@ export function BottomSheetBase({
|
|
|
230
230
|
const [drag] = useState(() => new Animated.Value(0))
|
|
231
231
|
const close = () => onOpenChange(false)
|
|
232
232
|
const android = theme.isAndroid
|
|
233
|
+
// Android's content and actions 12 from the sheet's sides, as a page's groups; a token for a screen at another gutter
|
|
234
|
+
const androidInline = theme.length("--bottom-sheet-android-padding-inline", 12)
|
|
233
235
|
const reduced = theme.reducedMotion
|
|
234
236
|
// One responder for the sheet's life, told the latest props after each render: a responder made again mid-drag
|
|
235
237
|
// would lose the drag
|
|
@@ -395,6 +397,8 @@ export function BottomSheetBase({
|
|
|
395
397
|
android
|
|
396
398
|
? [
|
|
397
399
|
styles.androidContent,
|
|
400
|
+
// A screen whose gutter is Material's compact 16 sets it with --bottom-sheet-android-padding-inline
|
|
401
|
+
{ paddingHorizontal: androidInline },
|
|
398
402
|
title != null ? styles.androidContentUnderBar : null,
|
|
399
403
|
// Over a footer: 8 above its height, which reaches over the sheet's bottom padding
|
|
400
404
|
footer ? { paddingBottom: 8 + Math.max(0, footerHeight - insets.bottom - keyboard) } : null,
|
|
@@ -417,6 +421,7 @@ export function BottomSheetBase({
|
|
|
417
421
|
android
|
|
418
422
|
? [
|
|
419
423
|
styles.androidFooter,
|
|
424
|
+
{ paddingHorizontal: androidInline },
|
|
420
425
|
// Over the sheet's color at 80%, faded in over its top 24dp, down over the gesture bar
|
|
421
426
|
{ paddingBottom: 12 + insets.bottom + keyboard, backgroundImage: `linear-gradient(to bottom, ${withAlpha(background, 0)}, ${withAlpha(background, 0.8)} 24px)` } as ViewStyle,
|
|
422
427
|
]
|
|
@@ -130,6 +130,8 @@ export function List({
|
|
|
130
130
|
.map((row) => (row.type === Button ? <ActionRow key={row.key ?? undefined}>{row}</ActionRow> : row))
|
|
131
131
|
const options = useMemo(() => ({ columns }), [columns])
|
|
132
132
|
const increased = headerProminence === "increased"
|
|
133
|
+
// Android's footer 13 into the card's width, as the Settings app; a token for a screen that keeps text at its gutter
|
|
134
|
+
const footerInset = theme.length("--list-android-footer-inset", 13)
|
|
133
135
|
const fill = surface === "plain" ? theme.color("--field-group-background", theme.colors.surfaceSecondary) : theme.colors.groupedSurface
|
|
134
136
|
// The card's corners: Android's 16dp card (a header or description inside it stands over the first row), iOS's group
|
|
135
137
|
const corner = surface === "plain" && theme.isAndroid ? 0 : theme.isAndroid ? ANDROID_CARD_RADIUS : theme.length("--field-group-radius", 26)
|
|
@@ -196,11 +198,11 @@ export function List({
|
|
|
196
198
|
</View>
|
|
197
199
|
</View>
|
|
198
200
|
{error != null ? (
|
|
199
|
-
<Text color={dangerText(theme)} accessibilityLiveRegion="polite" style={[styles.androidFooter, plain ? [styles.androidFooterPlain, { backgroundColor: band }] : null]}>
|
|
201
|
+
<Text color={dangerText(theme)} accessibilityLiveRegion="polite" style={[styles.androidFooter, { paddingHorizontal: footerInset }, plain ? [styles.androidFooterPlain, { backgroundColor: band }] : null]}>
|
|
200
202
|
{error}
|
|
201
203
|
</Text>
|
|
202
204
|
) : footer != null ? (
|
|
203
|
-
<Text color={theme.colors.labelSecondary} style={[styles.androidFooter, plain ? [styles.androidFooterPlain, { backgroundColor: band }] : null]}>
|
|
205
|
+
<Text color={theme.colors.labelSecondary} style={[styles.androidFooter, { paddingHorizontal: footerInset }, plain ? [styles.androidFooterPlain, { backgroundColor: band }] : null]}>
|
|
204
206
|
{footer}
|
|
205
207
|
</Text>
|
|
206
208
|
) : null}
|
|
@@ -801,6 +803,9 @@ function IOSContent({ handPress, valueColor, theme, label, description, descript
|
|
|
801
803
|
)
|
|
802
804
|
// A field at the end fills the room after the label (`RowEnd.fill`)
|
|
803
805
|
const [fill, setFill] = useState(false)
|
|
806
|
+
// A picture wider than the tile (a photo, an avatar) keeps its own size: it starts at the row's inset, where the
|
|
807
|
+
// header and the footer stand, and the text follows 14 past it, as UIKit's image to text padding
|
|
808
|
+
const [wide, setWide] = useState(false)
|
|
804
809
|
// In a List with `columns` a field's value starts at one column, 40% into the row (`--field-row-column-width`)
|
|
805
810
|
// A switch, a checkbox and a radio stay at the row's edge
|
|
806
811
|
const columns = useContext(ListOptionsContext)?.columns === true && trailing != null
|
|
@@ -822,9 +827,13 @@ function IOSContent({ handPress, valueColor, theme, label, description, descript
|
|
|
822
827
|
<View
|
|
823
828
|
style={[
|
|
824
829
|
styles.tile,
|
|
825
|
-
{
|
|
830
|
+
{ minWidth: tile, minHeight: tile, marginStart: wide ? 0 : theme.length("--field-row-icon-offset", -2), marginEnd: theme.length("--field-row-icon-gap", 14) },
|
|
826
831
|
leadingColor ? { backgroundColor: leadingColor, borderRadius: theme.length("--field-row-icon-radius", 7) } : null,
|
|
827
832
|
]}
|
|
833
|
+
onLayout={(event) => {
|
|
834
|
+
const next = event.nativeEvent.layout.width > tile + 0.5
|
|
835
|
+
if (next !== wide) setWide(next)
|
|
836
|
+
}}
|
|
828
837
|
>
|
|
829
838
|
<IconDefaultsProvider size={leadingColor ? 20 : theme.length("--field-row-icon-symbol-size", 24)} color={leadingColor ? "#ffffff" : disabled ? theme.colors.labelTertiary : theme.colors.accent}>
|
|
830
839
|
{leading}
|
|
@@ -460,9 +460,12 @@ function ToastView({ item, theme, hidden, replaced = false }: { item: ToastT; th
|
|
|
460
460
|
<Glass radius={described ? 24 : 21.5} elevation="raised" fillToken="--toast-mobile-background" style={styles.iosToast}>
|
|
461
461
|
{/* sonner's 16pt icon box, 3 into the padding and 4 before the gap, holds the 20pt symbol over its edges: the
|
|
462
462
|
message starts 42 from the toast's edge, and a line of text alone keeps the toast 43 high */}
|
|
463
|
-
{
|
|
464
|
-
|
|
465
|
-
<View style={
|
|
463
|
+
{/* The symbol and the message are one piece of the row, so a long message wraps its own lines beside the
|
|
464
|
+
symbol, as the web's; only a button wraps, under them */}
|
|
465
|
+
<View style={styles.iosMessage}>
|
|
466
|
+
{icon != null && icon !== false ? <View style={styles.iosIcon}>{icon}</View> : null}
|
|
467
|
+
{/* Beside a button the message keeps 8em, and a button that would leave it less wraps under it */}
|
|
468
|
+
<View style={[styles.iosText, item.action ? { minWidth: 8 * 15 } : null]}>
|
|
466
469
|
<Text weight={described ? "semibold" : "medium"} style={{ fontSize: 15, lineHeight: 17, fontWeight: titleWeight }}>
|
|
467
470
|
{item.title}
|
|
468
471
|
</Text>
|
|
@@ -472,6 +475,7 @@ function ToastView({ item, theme, hidden, replaced = false }: { item: ToastT; th
|
|
|
472
475
|
{item.description}
|
|
473
476
|
</Text>
|
|
474
477
|
) : null}
|
|
478
|
+
</View>
|
|
475
479
|
</View>
|
|
476
480
|
{item.action ? (
|
|
477
481
|
<Pressable
|
|
@@ -504,6 +508,7 @@ const styles = StyleSheet.create({
|
|
|
504
508
|
// 12/14 of padding inside sonner's 1px border, transparent on a phone
|
|
505
509
|
iosToast: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 10, paddingVertical: 13, paddingHorizontal: 15 },
|
|
506
510
|
iosIcon: { width: 16, height: 16, marginStart: -3, marginEnd: 4, justifyContent: "center", alignItems: "flex-start" },
|
|
511
|
+
iosMessage: { flexDirection: "row", alignItems: "center", gap: 10, flexShrink: 1, minWidth: 0 },
|
|
507
512
|
iosText: { flexShrink: 1, minWidth: 0 },
|
|
508
513
|
iosAction: { minHeight: 34, paddingVertical: 7, paddingHorizontal: 14, borderRadius: 9999, alignItems: "center", justifyContent: "center" },
|
|
509
514
|
// Android's toast card: a 16dp-cornered card at least 48 tall, the text 16 in (56 past a 24dp icon at 16)
|