@plexui/react-native 0.2.26 → 0.2.28
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/Button/Button.js +9 -5
- package/dist/es/components/Chip/Chip.js +19 -11
- package/dist/es/components/Dialog/Dialog.js +18 -6
- package/dist/es/components/EmptyMessage/EmptyMessage.js +2 -2
- package/dist/es/components/Input/Input.js +17 -2
- package/dist/es/components/List/List.js +35 -2
- package/dist/es/components/ScrollEdge/ScrollEdge.js +12 -6
- package/dist/es/components/TabBar/TabBar.js +15 -0
- package/dist/es/components/TextLink/TextLink.js +18 -3
- package/dist/es/index.js +2 -2
- package/dist/types/components/Chip/Chip.d.ts +9 -3
- package/dist/types/components/Dialog/Dialog.d.ts +7 -1
- package/dist/types/components/EmptyMessage/EmptyMessage.d.ts +4 -2
- package/dist/types/components/Input/Input.d.ts +8 -1
- package/dist/types/components/List/List.d.ts +26 -1
- package/dist/types/components/ScrollEdge/ScrollEdge.d.ts +7 -1
- package/dist/types/components/TabBar/TabBar.d.ts +13 -0
- package/dist/types/components/TextLink/TextLink.d.ts +7 -1
- package/dist/types/index.d.ts +2 -2
- package/package.json +2 -2
- package/src/components/Button/Button.tsx +10 -5
- package/src/components/Chip/Chip.tsx +28 -9
- package/src/components/Dialog/Dialog.tsx +30 -6
- package/src/components/EmptyMessage/EmptyMessage.tsx +12 -3
- package/src/components/Input/Input.tsx +43 -3
- package/src/components/List/List.tsx +70 -2
- package/src/components/ScrollEdge/ScrollEdge.tsx +19 -6
- package/src/components/TabBar/TabBar.tsx +15 -0
- package/src/components/TextLink/TextLink.tsx +46 -3
- package/src/index.ts +2 -2
|
@@ -81,6 +81,10 @@ function iosPress(theme, variant, colors) {
|
|
|
81
81
|
const pressed = variant === "solid" ? lighten(theme, colors.background) : variant === "ghost" ? colors.background : withAlpha(colors.background, 0.7);
|
|
82
82
|
return { ...colors, pressed, pressedText: lighten(theme, colors.text) };
|
|
83
83
|
}
|
|
84
|
+
/** iOS: a disabled button's label, the tertiary label unless a brand sets its own (`--button-mobile-disabled-color`). */
|
|
85
|
+
function disabledLabel(theme) {
|
|
86
|
+
return theme.color("--button-mobile-disabled-color", theme.colors.labelTertiary);
|
|
87
|
+
}
|
|
84
88
|
export function buttonColors(theme, color, variant, disabled, selected) {
|
|
85
89
|
const c = (name) => theme.color(`--color-${name}`);
|
|
86
90
|
if (disabled) {
|
|
@@ -93,13 +97,13 @@ export function buttonColors(theme, color, variant, disabled, selected) {
|
|
|
93
97
|
const flat = variant === "ghost" || variant === "outline";
|
|
94
98
|
return { background: flat ? "transparent" : veil, pressed: flat ? "transparent" : veil, text: withAlpha(onSurface, 0.38), border: variant === "outline" ? veil : undefined };
|
|
95
99
|
}
|
|
96
|
-
// The phone CSS: the tertiary label in every style (iOS 27's disabled content-area button),
|
|
97
|
-
// button behind a solid or soft one
|
|
100
|
+
// The phone CSS: the tertiary label in every style (iOS 27's disabled content-area button), or a brand's own
|
|
101
|
+
// disabled label (`--button-mobile-disabled-color`); the fill of a gray button behind a solid or soft one
|
|
98
102
|
// An outline button is iOS's Gray (below): disabled, the gray fill as the others
|
|
99
103
|
return {
|
|
100
104
|
background: variant === "ghost" ? "transparent" : theme.color("--button-mobile-disabled-background"),
|
|
101
105
|
pressed: "transparent",
|
|
102
|
-
text: theme
|
|
106
|
+
text: disabledLabel(theme),
|
|
103
107
|
};
|
|
104
108
|
}
|
|
105
109
|
const colors = (() => {
|
|
@@ -170,7 +174,7 @@ function barColors(theme, colors, { bar, prominent, neutral, disabled, selected,
|
|
|
170
174
|
// replace the fill
|
|
171
175
|
if (neutral && !selected && (bar.inGroup || !flat)) {
|
|
172
176
|
const pressed = bar.inGroup ? theme.color("--toolbar-group-item-active") : theme.color("--mobile-glass-background-active");
|
|
173
|
-
return { background: "transparent", pressed, text: disabled ? theme
|
|
177
|
+
return { background: "transparent", pressed, text: disabled ? disabledLabel(theme) : colors.text };
|
|
174
178
|
}
|
|
175
179
|
return colors;
|
|
176
180
|
}
|
|
@@ -294,7 +298,7 @@ function ListActionButton({ place, color = "primary", disabled = false, loading
|
|
|
294
298
|
: // The web's phone rows tint an action with the info text (#0169cc, blue-200 in the dark)
|
|
295
299
|
theme.color("--color-text-info", theme.colors.accent)
|
|
296
300
|
: buttonColors(theme, color, "ghost", false, false).text;
|
|
297
|
-
const ink = disabled ? (android ? withAlpha(base, 0.5) : theme
|
|
301
|
+
const ink = disabled ? (android ? withAlpha(base, 0.5) : disabledLabel(theme)) : !row && pressed && !android ? lighten(theme, base) : base;
|
|
298
302
|
// Android: a row's words 16/20, a header's 15/20 Medium (the web's FieldGroup header action)
|
|
299
303
|
const type = android
|
|
300
304
|
? row
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { holdProps } from "../../internal/row";
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
4
|
import { Animated, Easing, Platform, StyleSheet, View } from "react-native";
|
|
5
|
+
import { useAndroidGlass } from "../../internal/BarBackdrop";
|
|
5
6
|
import { Pressable } from "../../internal/Pressable";
|
|
6
7
|
import ChevronDownSm from "../../icons/plex/ChevronDownSm";
|
|
7
8
|
import CloseBold from "../../icons/plex/CloseBold";
|
|
@@ -22,7 +23,7 @@ import { Text, textStyle } from "../Text/Text";
|
|
|
22
23
|
*/
|
|
23
24
|
/** The chosen token's way to let go, so that choosing another lets it go */
|
|
24
25
|
let disarmToken = null;
|
|
25
|
-
export function Chip({ children, selected: selectedProp, defaultSelected, onSelectedChange, onPress, icon, trailingIcon, menu, expanded, accessibilityLabel, appearance = "tag", onRemove, removeLabel = "Remove", removeStyle = "token", onLongPress, longPressLabel, disabled = false, testID, style, }) {
|
|
26
|
+
export function Chip({ children, selected: selectedProp, defaultSelected, onSelectedChange, onPress, icon, trailingIcon, menu, expanded, accessibilityLabel, appearance = "tag", size = "md", onRemove, removeLabel = "Remove", removeStyle = "token", onLongPress, longPressLabel, disabled = false, testID, style, }) {
|
|
26
27
|
const theme = useTheme();
|
|
27
28
|
const [own, setOwn] = useState(defaultSelected ?? false);
|
|
28
29
|
// iOS's token: an input chip with no cross, chosen by a first press and removed by a second (or by Delete); it is
|
|
@@ -110,13 +111,14 @@ export function Chip({ children, selected: selectedProp, defaultSelected, onSele
|
|
|
110
111
|
}, [blend, blends, selected]);
|
|
111
112
|
const fillPaint = blends ? blend.interpolate({ inputRange: [0, 1], outputRange: [androidFill.off, androidFill.on] }) : fill;
|
|
112
113
|
const labelPaint = blends ? blend.interpolate({ inputRange: [0, 1], outputRange: [androidColor.off, androidColor.on] }) : color;
|
|
113
|
-
const
|
|
114
|
-
const
|
|
114
|
+
const small = !android && size === "sm";
|
|
115
|
+
const height = android ? 32 : small ? 36 : glass ? 44 : 40;
|
|
116
|
+
const label = android ? { fontSize: 14, lineHeight: 18 } : small ? { fontSize: 15, lineHeight: 20 } : { fontSize: 17, lineHeight: 22 };
|
|
115
117
|
const leading = icon;
|
|
116
|
-
// iOS: a 17pt symbol draws about 20 (the label's size)
|
|
117
|
-
const iconSize = android ? 18 : 20;
|
|
118
|
+
// iOS: a 17pt symbol draws about 20 (the label's size), a 15pt one about 17
|
|
119
|
+
const iconSize = android ? 18 : small ? 17 : 20;
|
|
118
120
|
// A menu chip's chevron: Material's 18dp arrow_drop_down, iOS's small chevron.down at the label's weight
|
|
119
|
-
const trailing = trailingIcon ?? (menu ? android ? _jsx(MaterialArrowDropDown, { size: 18 }) : _jsx(ChevronDownSm, { size: 16 }) : null);
|
|
121
|
+
const trailing = trailingIcon ?? (menu ? android ? _jsx(MaterialArrowDropDown, { size: 18 }) : _jsx(ChevronDownSm, { size: small ? 14 : 16 }) : null);
|
|
120
122
|
const leadingColor = color;
|
|
121
123
|
// A symbol alone (Maps' filter button before its chips): a circle as tall as the chip, named by accessibilityLabel
|
|
122
124
|
const symbolOnly = leading != null && (children == null || children === "") && trailing == null && !onRemove;
|
|
@@ -132,6 +134,10 @@ export function Chip({ children, selected: selectedProp, defaultSelected, onSele
|
|
|
132
134
|
const [pressed, setPressed] = useState(false);
|
|
133
135
|
// iOS's glass filter: a glass capsule (its rim and sheen), filled with the accent once chosen
|
|
134
136
|
const glassLayer = glass && !selected ? _jsx(Glass, { pointerEvents: "none", radius: radius, style: [StyleSheet.absoluteFill, { top: inset, bottom: inset }] }) : null;
|
|
137
|
+
// Android's chip over content (`glass`): it stands on a glass of its size, the Android bar circles' (a see-through
|
|
138
|
+
// card with a rim and a soft shadow), Material's fill and label over it
|
|
139
|
+
const androidGlass = useAndroidGlass("bar");
|
|
140
|
+
const androidBacking = android && appearance === "glass" ? _jsx(View, { pointerEvents: "none", style: [StyleSheet.absoluteFill, androidGlass, { top: inset, bottom: inset, borderRadius: radius }] }) : null;
|
|
135
141
|
const layer = glassLayer ?? (_jsx(Animated.View, { pointerEvents: "none", style: [StyleSheet.absoluteFill, { top: inset, bottom: inset, borderRadius: radius, backgroundColor: fillPaint, borderCurve: "continuous" }], children: android && pressed && !disabled ? (_jsx(View, { style: [StyleSheet.absoluteFill, { borderRadius: radius, backgroundColor: selected ? withAlpha(color, 0.12) : theme.scheme === "dark" ? "rgba(255, 255, 255, 0.05)" : "rgba(0, 0, 0, 0.06)" }] })) : null }));
|
|
136
142
|
const box = {
|
|
137
143
|
// The label's own air inside the chip, then the target's outside it: 48 (44) at the regular size, and taller
|
|
@@ -139,9 +145,9 @@ export function Chip({ children, selected: selectedProp, defaultSelected, onSele
|
|
|
139
145
|
minHeight: target,
|
|
140
146
|
paddingVertical: inset + (height - label.lineHeight) / 2,
|
|
141
147
|
// Android: 12 at the sides, 8 before an icon and 6 after it
|
|
142
|
-
paddingLeft: symbolOnly ? (height - iconSize) / 2 : leading != null ? (android ? 8 : 12) : android ? 12 : 16,
|
|
148
|
+
paddingLeft: symbolOnly ? (height - iconSize) / 2 : leading != null ? (android ? 8 : small ? 10 : 12) : android ? 12 : small ? 14 : 16,
|
|
143
149
|
// Android: 8 after a trailing icon (Compose's FilterChip), iOS 12
|
|
144
|
-
paddingRight: symbolOnly ? (height - iconSize) / 2 : cross ? 0 : trailing != null ? (android ? 8 : 12) : android ? 12 : 16,
|
|
150
|
+
paddingRight: symbolOnly ? (height - iconSize) / 2 : cross ? 0 : trailing != null ? (android ? 8 : small ? 10 : 12) : android ? 12 : small ? 14 : 16,
|
|
145
151
|
gap: 6,
|
|
146
152
|
opacity: !android && pressed ? 0.7 : 1,
|
|
147
153
|
};
|
|
@@ -152,6 +158,8 @@ export function Chip({ children, selected: selectedProp, defaultSelected, onSele
|
|
|
152
158
|
// Android dims a disabled chip, its fill with it, to half (as its other disabled controls)
|
|
153
159
|
const dim = android && disabled ? styles.dim : null;
|
|
154
160
|
const handlers = {
|
|
161
|
+
// A symbol alone keeps the target's width past its circle (36 on iOS's small chip, 32 on Android's)
|
|
162
|
+
hitSlop: symbolOnly && height < target ? { left: (target - height) / 2, right: (target - height) / 2 } : undefined,
|
|
155
163
|
...(filter ? spaceToggles(press) : {}),
|
|
156
164
|
// A menu chip is a button that opens its menu, even when it shows a chosen filter
|
|
157
165
|
accessibilityRole: filter && !menu ? "checkbox" : "button",
|
|
@@ -192,12 +200,12 @@ export function Chip({ children, selected: selectedProp, defaultSelected, onSele
|
|
|
192
200
|
// An input chip holds its cross beside the chip's own press, never a button inside a button; each takes the
|
|
193
201
|
// target's full height
|
|
194
202
|
if (cross) {
|
|
195
|
-
return (_jsxs(View, { testID: testID, style: [styles.chip, { minHeight: target }, dim, style], children: [layer, interactive ? (_jsx(Pressable, { ...handlers, style: [styles.part, box], children: body })) : (_jsx(View, { style: [styles.part, box], children: body })), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: removeLabel, disabled: disabled, onPress: onRemove, style: [styles.part, android ? { paddingLeft: 4, paddingRight: 8 } : { width: 44, justifyContent: "center" }], children: android ? _jsx(CloseBold, { size: 18, color: color }) : _jsx(XCircleFilled, { size: clearSize, color: theme.color("--mobile-label-tertiary") }) })] }));
|
|
203
|
+
return (_jsxs(View, { testID: testID, style: [styles.chip, { minHeight: target }, dim, style], children: [androidBacking, layer, interactive ? (_jsx(Pressable, { ...handlers, style: [styles.part, box], children: body })) : (_jsx(View, { style: [styles.part, box], children: body })), _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: removeLabel, disabled: disabled, onPress: onRemove, style: [styles.part, android ? { paddingLeft: 4, paddingRight: 8 } : { width: 44, justifyContent: "center" }], children: android ? _jsx(CloseBold, { size: 18, color: color }) : _jsx(XCircleFilled, { size: clearSize, color: theme.color("--mobile-label-tertiary") }) })] }));
|
|
196
204
|
}
|
|
197
205
|
if (!interactive) {
|
|
198
|
-
return (_jsxs(View, { testID: testID, style: [styles.chip, styles.part, box, dim, style], children: [layer, body] }));
|
|
206
|
+
return (_jsxs(View, { testID: testID, style: [styles.chip, styles.part, box, dim, style], children: [androidBacking, layer, body] }));
|
|
199
207
|
}
|
|
200
|
-
return (_jsxs(Pressable, { ...handlers, testID: testID, style: [styles.chip, styles.part, box, dim, style], children: [layer, body] }));
|
|
208
|
+
return (_jsxs(Pressable, { ...handlers, testID: testID, style: [styles.chip, styles.part, box, dim, style], children: [androidBacking, layer, body] }));
|
|
201
209
|
}
|
|
202
210
|
const styles = StyleSheet.create({
|
|
203
211
|
chip: { flexDirection: "row", alignItems: "stretch", alignSelf: "flex-start" },
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useId, useState } from "react";
|
|
2
|
+
import { createContext, useContext, useId, useState } from "react";
|
|
3
3
|
import { Animated, KeyboardAvoidingView, Platform, ScrollView, StyleSheet, View, useWindowDimensions } from "react-native";
|
|
4
4
|
import { Pressable } from "../../internal/Pressable";
|
|
5
5
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
6
6
|
import { Glass } from "../../internal/Glass";
|
|
7
7
|
import { useRipple } from "../../internal/ripple";
|
|
8
|
+
import { buttonColors } from "../Button/Button";
|
|
8
9
|
import { useKeyboardHeight } from "../../internal/keyboard";
|
|
9
10
|
import { androidDialogMotion, canTransformGlass, glassOpacity, iosDim, Overlay, ANDROID_DIALOG, ANDROID_DIM } from "../../internal/Overlay";
|
|
10
11
|
import { withAlpha, dangerText } from "../../theme/material";
|
|
11
12
|
import { ThemeProvider, useTheme } from "../../theme/ThemeProvider";
|
|
12
13
|
import { Text } from "../Text/Text";
|
|
14
|
+
/** The dialog's `actionColor`, for its action buttons. */
|
|
15
|
+
const ActionColorContext = createContext("accent");
|
|
13
16
|
/**
|
|
14
17
|
* A dialog that asks for a decision: on iOS the alert of iOS 26 (UIAlertController `.alert`: 320 wide, glass, radius
|
|
15
18
|
* 34, capsule actions 48 tall, `--dialog-alert-*`, Dialog.module.css), on Android a flat alert (at most 356 wide,
|
|
16
19
|
* radius 21, a Medium 20 title over 16 text, text buttons in the accent at the end, Android's dialog animation). The
|
|
17
20
|
* web Dialog's `mobileVariant="alert"` as one call; a sheet is `BottomSheet`.
|
|
18
21
|
*/
|
|
19
|
-
export function Dialog({
|
|
22
|
+
export function Dialog({ actionColor = "accent", ...props }) {
|
|
23
|
+
return (_jsx(ActionColorContext.Provider, { value: actionColor, children: _jsx(DialogView, { ...props }) }));
|
|
24
|
+
}
|
|
25
|
+
function DialogView({ open, onOpenChange, title, description, actions = [], children, mobileLayout, dismissible, testID }) {
|
|
20
26
|
const theme = useTheme();
|
|
21
27
|
const close = () => onOpenChange(false);
|
|
22
28
|
const run = (action) => {
|
|
@@ -169,18 +175,23 @@ function IOSAction({ theme, action, run, type, grow }) {
|
|
|
169
175
|
// a preferredAction (iOS 27.2: 0082f7 on every row); disabled, the phone's disabled fill (Button.module.css). A
|
|
170
176
|
// destructive one keeps the alert's fill and its red label
|
|
171
177
|
const accent = action.preferred && action.variant !== "destructive";
|
|
178
|
+
const primary = useContext(ActionColorContext) === "primary";
|
|
172
179
|
const height = theme.length("--dialog-alert-action-height", 48);
|
|
173
180
|
const fill = accent
|
|
174
181
|
? action.disabled
|
|
175
182
|
? theme.color("--button-mobile-disabled-background", theme.color("--color-background-disabled"))
|
|
176
|
-
:
|
|
183
|
+
: primary
|
|
184
|
+
? theme.color("--color-background-primary-solid")
|
|
185
|
+
: theme.color("--toolbar-prominent-background")
|
|
177
186
|
: theme.color("--dialog-alert-fill");
|
|
178
187
|
const text = action.disabled
|
|
179
188
|
? theme.color("--mobile-label-tertiary")
|
|
180
189
|
: action.variant === "destructive"
|
|
181
190
|
? theme.color("--color-text-danger")
|
|
182
191
|
: accent
|
|
183
|
-
?
|
|
192
|
+
? primary
|
|
193
|
+
? theme.color("--color-text-primary-solid")
|
|
194
|
+
: theme.color("--toolbar-prominent-color")
|
|
184
195
|
: theme.colors.text;
|
|
185
196
|
const lit = accent && !action.disabled;
|
|
186
197
|
return (_jsx(Pressable, { accessibilityRole: "button", accessibilityState: { disabled: !!action.disabled }, disabled: action.disabled, onPress: () => run(action), testID: action.testID, style: ({ pressed }) => [
|
|
@@ -188,7 +199,7 @@ function IOSAction({ theme, action, run, type, grow }) {
|
|
|
188
199
|
{
|
|
189
200
|
minHeight: height,
|
|
190
201
|
borderRadius: height / 2,
|
|
191
|
-
backgroundColor: lit && pressed ? theme.color("--toolbar-prominent-background-active") : fill,
|
|
202
|
+
backgroundColor: lit && pressed ? theme.color(primary ? "--color-background-primary-solid-active" : "--toolbar-prominent-background-active") : fill,
|
|
192
203
|
opacity: pressed && !lit ? 0.7 : 1,
|
|
193
204
|
},
|
|
194
205
|
grow ? styles.grow : null,
|
|
@@ -234,7 +245,8 @@ function AndroidDialog({ theme, title, description, actions, run, ids, children,
|
|
|
234
245
|
* ripple of the label's color at 10% from the touch point, clipped to its 20dp pill (the platform's on a device).
|
|
235
246
|
*/
|
|
236
247
|
function AndroidDialogButton({ theme, action, run, onWidth }) {
|
|
237
|
-
const
|
|
248
|
+
const primary = useContext(ActionColorContext) === "primary";
|
|
249
|
+
const color = action.variant === "destructive" ? dangerText(theme) : primary ? buttonColors(theme, "primary", "ghost", false, false).text : theme.material.primary;
|
|
238
250
|
const press = withAlpha(color, 0.1);
|
|
239
251
|
const nativeRipple = Platform.OS === "android";
|
|
240
252
|
const ripple = useRipple(press, !nativeRipple, theme.reducedMotion);
|
|
@@ -45,7 +45,7 @@ function EmptyMessageIcon({ children, color = "secondary", size }) {
|
|
|
45
45
|
return (_jsx(View, { accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: { marginBottom: gap }, children: _jsx(IconDefaultsProvider, { size: theme.length("--empty-message-icon-size", 48), color: toneColor(theme, color), children: children }) }));
|
|
46
46
|
}
|
|
47
47
|
EmptyMessageIcon.displayName = "EmptyMessage.Icon";
|
|
48
|
-
function EmptyMessageTitle({ children, color }) {
|
|
48
|
+
function EmptyMessageTitle({ children, color, style, }) {
|
|
49
49
|
const { theme, size, align } = useEmpty("EmptyMessage.Title");
|
|
50
50
|
const compact = size === "sm";
|
|
51
51
|
// Android's empty view: the title Medium 20 (16 in the compact message)
|
|
@@ -59,7 +59,7 @@ function EmptyMessageTitle({ children, color }) {
|
|
|
59
59
|
return (_jsx(Text, { accessibilityRole: "header", weight: theme.isAndroid ? "medium" : compact ? "semibold" : "bold", color: color && color !== "secondary" ? toneColor(theme, color) : undefined,
|
|
60
60
|
// `left` is the start: React Native turns it to the right in a right-to-left layout. `auto` took the alignment of
|
|
61
61
|
// the page around it on the web, where a centered page left a start-aligned message centered
|
|
62
|
-
style: { fontSize: type.fontSize, lineHeight: type.lineHeight, textAlign: align === "center" ? "center" : "left", marginBottom: compact ? space(theme, 1) : 0 }, children: children }));
|
|
62
|
+
style: [{ fontSize: type.fontSize, lineHeight: type.lineHeight, textAlign: align === "center" ? "center" : "left", marginBottom: compact ? space(theme, 1) : 0 }, style], children: children }));
|
|
63
63
|
}
|
|
64
64
|
EmptyMessageTitle.displayName = "EmptyMessage.Title";
|
|
65
65
|
function EmptyMessageDescription({ children }) {
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { createContext, useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { Animated, Easing, PixelRatio, Platform, StyleSheet, Text as NativeText, TextInput, View, processColor } from "react-native";
|
|
4
4
|
import { Pressable } from "../../internal/Pressable";
|
|
5
|
+
import { Text } from "../Text/Text";
|
|
5
6
|
import XCircleFilled from "../../icons/plex/XCircleFilled";
|
|
6
7
|
import { useAndroidGlass } from "../../internal/BarBackdrop";
|
|
7
8
|
import { FieldStack, FloatLabelContext } from "../../internal/fieldStack";
|
|
@@ -574,15 +575,29 @@ function FieldBox({ glass, raised, radius, shift, style, ...rest }) {
|
|
|
574
575
|
* description or error under it (15/20, 4pt below, `--mobile-field-error-*`); Android is the outlined field with its
|
|
575
576
|
* floating label (on the line of an outlined field) and the help under it (14, 14dp in).
|
|
576
577
|
*/
|
|
577
|
-
export function TextField({ label, description, errorMessage, required, invalid, ...input }) {
|
|
578
|
+
export function TextField({ label, description, errorMessage, required, invalid, labelAction, counter = false, ...input }) {
|
|
578
579
|
const theme = useTheme();
|
|
579
|
-
|
|
580
|
+
const [typed, setTyped] = useState((input.defaultValue ?? "").length);
|
|
581
|
+
const count = input.value != null ? input.value.length : typed;
|
|
582
|
+
const counterText = counter && input.maxLength != null ? (_jsxs(Text, { color: "secondary", accessibilityLabel: `${count} of ${input.maxLength}`, style: [
|
|
583
|
+
theme.isAndroid ? styles.androidCounter : styles.iosCounter,
|
|
584
|
+
{ opacity: input.disabled ? 0.5 : 1 },
|
|
585
|
+
theme.isAndroid ? { color: theme.colors.textSecondary } : null,
|
|
586
|
+
], children: [count, "/", input.maxLength] })) : null;
|
|
587
|
+
const end = labelAction != null && counterText != null ? (_jsxs(View, { style: styles.endRow, children: [labelAction, counterText] })) : (labelAction ?? counterText);
|
|
588
|
+
// The count follows every edit, so a counter shown later reads the text as it is
|
|
589
|
+
const field = { ...input, onChangeText: (next) => (setTyped(next.length), input.onChangeText?.(next)) };
|
|
590
|
+
return (_jsx(FieldStack, { label: label, labelAction: end ?? undefined, required: required, description: description, errorMessage: errorMessage, invalid: invalid, disabled: input.disabled, floating: theme.isAndroid, describedBy: input["aria-describedby"], hint: input.accessibilityHint, children: ({ described, invalid: bad, shake }) => theme.isAndroid ? (_jsx(InputField, { ...field, ...described, label: label, required: required, invalid: bad, shift: shake })) : (_jsx(InputField, { ...field, ...described, accessibilityLabel: input.accessibilityLabel ?? (typeof label === "string" ? label : undefined), required: required, invalid: bad })) }));
|
|
580
591
|
}
|
|
581
592
|
const FIELD_START = { side: "start", row: false };
|
|
582
593
|
const FIELD_END = { side: "end", row: false };
|
|
583
594
|
const ROW_START = { side: "start", row: true };
|
|
584
595
|
const ROW_END = { side: "end", row: true };
|
|
585
596
|
const styles = StyleSheet.create({
|
|
597
|
+
// Material's counter: the help's type, at the end of its line, 16 from the help and 14 in from the field's end
|
|
598
|
+
androidCounter: { fontSize: 14, lineHeight: 18, paddingStart: 16, paddingEnd: 14, paddingTop: 6, fontVariant: ["tabular-nums"] },
|
|
599
|
+
iosCounter: { fontSize: 15, lineHeight: 20, fontVariant: ["tabular-nums"] },
|
|
600
|
+
endRow: { flexDirection: "row", alignItems: "center", gap: 8 },
|
|
586
601
|
adornmentButton: { alignItems: "center", justifyContent: "center" },
|
|
587
602
|
// Centered in the 48dp target
|
|
588
603
|
adornmentPressed: { position: "absolute", top: 4, start: 4, width: 40, height: 40, borderRadius: 20 },
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { Animated, Easing, Platform, StyleSheet, View } from "react-native";
|
|
4
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
5
|
import { Pressable } from "../../internal/Pressable";
|
|
6
|
+
import CheckMd from "../../icons/plex/CheckMd";
|
|
5
7
|
import Disclosure from "../../icons/plex/Disclosure";
|
|
6
8
|
import ExclamationMarkCircle from "../../icons/plex/ExclamationMarkCircle";
|
|
7
9
|
import { describedBy, spaceToggles, useDescription, useHint } from "../../internal/a11y";
|
|
@@ -129,6 +131,30 @@ export function List({ children, header, description, footer, error, surface = "
|
|
|
129
131
|
paddingStart: footerBox.left,
|
|
130
132
|
}, children: error ?? footer })) : null] }));
|
|
131
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Sections one under another, as SwiftUI's Form and the web's stacked FieldGroups space them: on iOS 35 rows to rows,
|
|
136
|
+
* less what a footer's block (17.33) and a header's (18.67, a prominent one 18, after a footer 11.33) take; on Android
|
|
137
|
+
* 12 apart, none after a footer. Blocks that are not sections keep `gap`; the stack ends with the last section's room.
|
|
138
|
+
*/
|
|
139
|
+
export function ListStack({ children, gap = 0, end = true, style, testID }) {
|
|
140
|
+
const theme = useTheme();
|
|
141
|
+
const insets = useSafeAreaInsets();
|
|
142
|
+
const items = flattenChildren(children);
|
|
143
|
+
const section = (node) => (isValidElement(node) && node.type === List ? node.props : null);
|
|
144
|
+
const space = (before, after) => {
|
|
145
|
+
if (before == null || after == null)
|
|
146
|
+
return gap;
|
|
147
|
+
const footer = before.footer != null || before.error != null;
|
|
148
|
+
const header = after.header != null || after.description != null || after.action != null;
|
|
149
|
+
if (theme.isAndroid)
|
|
150
|
+
return footer ? 0 : 12;
|
|
151
|
+
const prominent = after.headerProminence === "increased";
|
|
152
|
+
return 35 - (footer ? 17.33 : 0) - (header ? (prominent ? 18 : footer ? 11.33 : 18.67) : 0);
|
|
153
|
+
};
|
|
154
|
+
const last = section(items[items.length - 1]);
|
|
155
|
+
const bottom = !end ? 0 : theme.isAndroid ? Math.max(16, insets.bottom) : last != null ? 35 + insets.bottom : insets.bottom;
|
|
156
|
+
return (_jsx(View, { style: [{ paddingBottom: bottom }, style], testID: testID, children: items.map((child, index) => (_jsx(View, { style: index > 0 ? { marginTop: space(section(items[index - 1]), section(child)) } : null, children: child }, isValidElement(child) && child.key != null ? child.key : index))) }));
|
|
157
|
+
}
|
|
132
158
|
/**
|
|
133
159
|
* A row of a List: the label (17/22, `--field-row-*`: 52 tall, 62 with a description, 12 above and below the text at
|
|
134
160
|
* least) with a description, a leading symbol, a value (wrapping within 60% of the row, or under the label: `valuePlacement`) or a control, and the chevron
|
|
@@ -141,12 +167,13 @@ export function List({ children, header, description, footer, error, surface = "
|
|
|
141
167
|
* in (a multi-select list); a 1px divider from the text's start to the card's end, none under a row with a tile (a
|
|
142
168
|
* tiled row draws none).
|
|
143
169
|
*/
|
|
144
|
-
export function ListItem({ label, description, leading, leadingColor, value, valuePlacement = "end", valueColor, trailing, error, checked: checkedProp, defaultChecked, onCheckedChange, disclosure, onPress, onLongPress, longPressLabel, disabled = false, destructive = false, accessibilityLabel, accessibilityHint, testID, }) {
|
|
170
|
+
export function ListItem({ label, description, leading, leadingColor, value, valuePlacement = "end", valueColor, trailing: trailingProp, selected, error, checked: checkedProp, defaultChecked, onCheckedChange, disclosure, onPress, onLongPress, longPressLabel, disabled = false, destructive = false, accessibilityLabel, accessibilityHint, testID, }) {
|
|
145
171
|
const theme = useTheme();
|
|
146
172
|
const { last, top, bottom } = useContext(PlaceContext);
|
|
147
173
|
// A menu opened from the row finds the row (Android lights it over the dim of the screen)
|
|
148
174
|
const frameNode = useRef(null);
|
|
149
175
|
const frame = useMemo(() => ({ node: frameNode, radius: { top, bottom } }), [top, bottom]);
|
|
176
|
+
const trailing = trailingProp ?? (selected === undefined ? undefined : _jsx(CheckSlot, { selected: selected }));
|
|
150
177
|
const switchRow = checkedProp !== undefined || defaultChecked !== undefined || onCheckedChange !== undefined;
|
|
151
178
|
const [own, setOwn] = useState(defaultChecked ?? false);
|
|
152
179
|
const checked = checkedProp ?? own;
|
|
@@ -235,13 +262,19 @@ export function ListItem({ label, description, leading, leadingColor, value, val
|
|
|
235
262
|
? { "aria-describedby": describedBy(described.id, hinted.id) }
|
|
236
263
|
: hinted.props), ...(switchRow ? spaceToggles(toggle) : null),
|
|
237
264
|
// A row that toggles its control is not a second element for a screen reader or a Tab stop: the control is
|
|
238
|
-
accessible: endOwnsFocus ? false : undefined, focusable: endOwnsFocus ? false : undefined, tabIndex: endOwnsFocus ? -1 : undefined, accessibilityRole: endOwnsFocus ? undefined : switchRow ? "switch" : "button", accessibilityLabel: endOwnsFocus ? undefined : name, accessibilityState: endOwnsFocus ? undefined : switchRow ? { checked, disabled } : { disabled }, "aria-checked": switchRow ? checked : undefined, disabled: disabled || (press == null && onLongPress == null), onPress: press, ...holdProps({ run: onLongPress, label: longPressLabel }, null), onPressIn: drawn ? ripple.start : undefined, onPressOut: drawn ? ripple.end : undefined, android_ripple: nativeRipple ? { color: highlight, foreground: true } : undefined, testID: testID, style: row, children: ({ pressed }) => (_jsx(RowHoldContext.Provider, { value: disabled ? null : theme.isAndroid ? hold : setHeld, children: _jsxs(RowActionContext.Provider, { value: rowAction, children: [hintNode, ripple.layer, theme.isAndroid ? null : _jsx(RowHighlight, { on: (pressed || held) && lit, last: last }), content(pressed || held)] }) })) }));
|
|
265
|
+
accessible: endOwnsFocus ? false : undefined, focusable: endOwnsFocus ? false : undefined, tabIndex: endOwnsFocus ? -1 : undefined, accessibilityRole: endOwnsFocus ? undefined : switchRow ? "switch" : "button", accessibilityLabel: endOwnsFocus ? undefined : name, accessibilityState: endOwnsFocus ? undefined : switchRow ? { checked, disabled } : { disabled, ...(selected !== undefined ? { selected } : null) }, "aria-checked": switchRow ? checked : undefined, ...(Platform.OS === "web" && !endOwnsFocus && !switchRow && selected !== undefined ? { "aria-pressed": selected } : null), disabled: disabled || (press == null && onLongPress == null), onPress: press, ...holdProps({ run: onLongPress, label: longPressLabel }, null), onPressIn: drawn ? ripple.start : undefined, onPressOut: drawn ? ripple.end : undefined, android_ripple: nativeRipple ? { color: highlight, foreground: true } : undefined, testID: testID, style: row, children: ({ pressed }) => (_jsx(RowHoldContext.Provider, { value: disabled ? null : theme.isAndroid ? hold : setHeld, children: _jsxs(RowActionContext.Provider, { value: rowAction, children: [hintNode, ripple.layer, theme.isAndroid ? null : _jsx(RowHighlight, { on: (pressed || held) && lit, last: last }), content(pressed || held)] }) })) }));
|
|
239
266
|
}
|
|
240
267
|
// A row that only shows (a detail, a value) is one element named by `accessibilityLabel` when it has one; with a
|
|
241
268
|
// control at its end it stays a group, so the control is still reached
|
|
242
269
|
const named = accessibilityLabel != null && trailing == null && found == null;
|
|
243
270
|
return (_jsxs(View, { ref: frameNode, collapsable: false, testID: testID, accessible: named || undefined, accessibilityLabel: accessibilityLabel, ...(named ? hinted.props : null), accessibilityRole: named && Platform.OS !== "web" ? "text" : undefined, role: named && Platform.OS === "web" ? "group" : undefined, style: row, children: [named ? hintNode : null, content(false)] }));
|
|
244
271
|
}
|
|
272
|
+
/** The check of a choice row, or its empty room: the accent's checkmark, 20 on iOS (a 17pt symbol), 24 on Android. */
|
|
273
|
+
function CheckSlot({ selected }) {
|
|
274
|
+
const theme = useTheme();
|
|
275
|
+
const size = theme.isAndroid ? 24 : 20;
|
|
276
|
+
return (_jsx(View, { style: { width: size, height: size }, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", children: selected ? _jsx(CheckMd, { size: size, color: theme.isAndroid ? theme.material.primary : theme.colors.accent }) : null }));
|
|
277
|
+
}
|
|
245
278
|
/** A Button among a List's rows: the row is the button (`ListActionContext`), the hairline under it from the text's start. */
|
|
246
279
|
function ActionRow({ children }) {
|
|
247
280
|
const theme = useTheme();
|
|
@@ -10,23 +10,29 @@ import { useTheme } from "../../theme/ThemeProvider";
|
|
|
10
10
|
* the screen's color that grows to 46% at the screen's edge. On Android the top edge is the soft edge of its top bar
|
|
11
11
|
* over the status bar alone, the bottom one draws nothing. Lay it over the screen, after the scroll view.
|
|
12
12
|
*/
|
|
13
|
-
export function ScrollEdge({ edge = "top", scrolled = false, canvasColor, testID, style }) {
|
|
13
|
+
export function ScrollEdge({ edge = "top", scrolled = false, canvasColor, fadeEnd, testID, style }) {
|
|
14
14
|
const theme = useTheme();
|
|
15
15
|
const insets = useSafeAreaInsets();
|
|
16
16
|
const canvas = canvasColor ?? theme.colors.background;
|
|
17
17
|
const top = edge === "top";
|
|
18
18
|
if (top && !scrolled)
|
|
19
19
|
return null;
|
|
20
|
-
|
|
20
|
+
const height = StyleSheet.flatten(style)?.height;
|
|
21
|
+
// A row under the status bar (a height or a fade's end given): Android takes iOS's edge for it, as a row over
|
|
22
|
+
// content reads on neither platform under the status bar's edge alone
|
|
23
|
+
const row = top && (fadeEnd != null || typeof height === "number");
|
|
24
|
+
if (theme.isAndroid && !row) {
|
|
21
25
|
if (!top)
|
|
22
26
|
return null;
|
|
23
27
|
return (_jsx(View, { pointerEvents: "none", testID: testID, style: [{ position: "absolute", top: 0, left: 0, right: 0, height: insets.top }, style], children: _jsx(SoftTopEdge, { fill: canvas, blur: Platform.OS === "web" ? 6 : 0 }) }));
|
|
24
28
|
}
|
|
25
29
|
// The safe area at that edge, or the height the style gives the top edge (a bar's row of buttons under the status
|
|
26
|
-
// bar): the content is blurred in full down to it, and the veil and the blur ease out over the 34 past it
|
|
27
|
-
|
|
28
|
-
const reach = top && typeof height === "number" ? height + FULL_BLUR_SHORTFALL : insets.top;
|
|
29
|
-
return (_jsx(View, { pointerEvents: "none", testID: testID, style: [{ position: "absolute", left: 0, right: 0 }, top ? { top: 0, height: insets.top } : { bottom: 0, height: insets.bottom }, style], children: top ? _jsx(SoftBottomVeil, { fill: canvas, bottom: reach }) : _jsx(SoftBottomVeil, { fill: canvas, top: 0 }) }));
|
|
30
|
+
// bar): the content is blurred in full down to it, and the veil and the blur ease out over the 34 past it. A fade's
|
|
31
|
+
// end is where the veil's 34 end, so the content under it shows clear
|
|
32
|
+
const reach = top && fadeEnd != null ? fadeEnd - FADE_PAST - FULL_BLUR_SHORTFALL : top && typeof height === "number" ? height + FULL_BLUR_SHORTFALL : insets.top;
|
|
33
|
+
return (_jsx(View, { pointerEvents: "none", testID: testID, style: [{ position: "absolute", left: 0, right: 0 }, top ? { top: 0, height: fadeEnd ?? insets.top } : { bottom: 0, height: insets.bottom }, style], children: top ? _jsx(SoftBottomVeil, { fill: canvas, bottom: reach }) : _jsx(SoftBottomVeil, { fill: canvas, top: 0 }) }));
|
|
30
34
|
}
|
|
31
35
|
/** The veil's blur is full 6 short of the edge it is turned over at (12 to 40 into its 34): a given height adds them. */
|
|
32
36
|
const FULL_BLUR_SHORTFALL = 6;
|
|
37
|
+
/** From the height where the blur is whole, the fade runs on 28 more (the 34 of the veil less its shortfall). */
|
|
38
|
+
const FADE_PAST = 28;
|
|
@@ -459,6 +459,21 @@ TabBarRoot.displayName = "TabBar";
|
|
|
459
459
|
export const TabBar = Object.assign(TabBarRoot, { Item: TabBarItem });
|
|
460
460
|
/** A scroll of at least this many points in one direction minimizes or expands the bar, as on the web. */
|
|
461
461
|
const MINIMIZE_AFTER = 8;
|
|
462
|
+
/**
|
|
463
|
+
* Where the tab bar's capsule stands, for what floats over it (a screen's floating buttons a set gap above it, a
|
|
464
|
+
* scroll that ends over it): `capsuleHeight`, and `bottom`, from the screen's bottom edge to the capsule's. iOS 26: the
|
|
465
|
+
* 54pt tabs in a capsule 4 above and below (62), 21 over the screen's bottom (or over the home indicator); Android:
|
|
466
|
+
* 56dp, 8 over the gesture bar. The bar itself (its soft edge) reaches higher. Pass the bar's `safeArea`.
|
|
467
|
+
*/
|
|
468
|
+
export function useTabBarMetrics({ safeArea = true, minimized = false } = {}) {
|
|
469
|
+
const theme = useTheme();
|
|
470
|
+
const insets = useSafeAreaInsets();
|
|
471
|
+
if (theme.isAndroid)
|
|
472
|
+
return { capsuleHeight: 56, bottom: 8 + (safeArea ? insets.bottom : 0) };
|
|
473
|
+
const padBottom = minimized ? theme.length("--tab-bar-minimized-padding-bottom", 28) : theme.length("--tab-bar-padding-bottom", 21);
|
|
474
|
+
const capsuleHeight = minimized ? theme.length("--tab-bar-minimized-size", 48) : theme.length("--tab-bar-item-height", 54) + 2 * theme.length("--tab-bar-capsule-padding-block", 4);
|
|
475
|
+
return { capsuleHeight, bottom: safeArea ? Math.max(padBottom, insets.bottom - 13) : padBottom };
|
|
476
|
+
}
|
|
462
477
|
/**
|
|
463
478
|
* Minimizes a TabBar while the screen scrolls down and expands it when it scrolls back up, as iOS 26
|
|
464
479
|
* `tabBarMinimizeBehavior(.onScrollDown)`: pass `onScroll` to the ScrollView and `minimized` and
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
-
import { Linking, Platform, Text as RNText } from "react-native";
|
|
3
|
+
import { Linking, Platform, Pressable, Text as RNText } from "react-native";
|
|
4
4
|
import { controlHighlight } from "../../theme/material";
|
|
5
5
|
import { useTheme } from "../../theme/ThemeProvider";
|
|
6
|
+
import { Button, buttonColors } from "../Button/Button";
|
|
7
|
+
import { Text } from "../Text/Text";
|
|
6
8
|
const EXTERNAL = /^https?:\/\//;
|
|
7
9
|
/** The underline's distance under the letters on the web: the token, else a tenth of the type. */
|
|
8
10
|
const underlineOffset = (value) => (typeof value === "number" ? value : typeof value === "string" && value !== "" ? value : "0.1em");
|
|
@@ -13,20 +15,33 @@ const underlineOffset = (value) => (typeof value === "number" ? value : typeof v
|
|
|
13
15
|
* row in the Plex Android look (the text's ink at 11%, white at 5% at night). With `href` it is a `link` and opens the
|
|
14
16
|
* URL (an `<a>` on the web, a new tab for an external one); with only `onPress` it is a `button`.
|
|
15
17
|
*/
|
|
16
|
-
export function TextLink({ children, href, primary = false, underline = !primary, forceExternal, onPress, weight, accessibilityLabel, testID, style }) {
|
|
18
|
+
export function TextLink({ children, href, primary = false, underline = !primary, forceExternal, onPress, weight, standalone = false, accessibilityLabel, testID, style }) {
|
|
17
19
|
const theme = useTheme();
|
|
18
20
|
const [pressed, setPressed] = useState(false);
|
|
19
21
|
const external = forceExternal ?? EXTERNAL.test(href ?? "");
|
|
20
22
|
const web = Platform.OS === "web";
|
|
21
23
|
const press = (event) => {
|
|
22
24
|
onPress?.(event);
|
|
25
|
+
// On the web the link is an anchor the browser opens (a new tab for an external one)
|
|
23
26
|
if (!href || web || prevented(event))
|
|
24
27
|
return;
|
|
25
28
|
void Linking.openURL(href).catch(() => { });
|
|
26
29
|
};
|
|
27
|
-
const actionable = href != null || onPress != null;
|
|
28
30
|
// react-native-web draws a Text with `href` as an anchor: the browser opens it, a new tab for an external one
|
|
29
31
|
const anchor = web && href ? { href, hrefAttrs: external ? { target: "_blank", rel: "noopener noreferrer" } : undefined } : null;
|
|
32
|
+
if (standalone) {
|
|
33
|
+
const role = href ? "link" : "button";
|
|
34
|
+
// A pressable is a View, which react-native-web draws as an anchor with the same `href`
|
|
35
|
+
const link = anchor;
|
|
36
|
+
if (theme.isAndroid)
|
|
37
|
+
return (_jsx(Button, { ...link, variant: "ghost", color: "primary", size: "sm", onPress: press, accessibilityRole: role, accessibilityLabel: accessibilityLabel, testID: testID, children: weight != null || style != null ? (
|
|
38
|
+
// A caller's face or type over the button's label (14/20 Medium in the primary)
|
|
39
|
+
_jsx(Text, { weight: weight ?? "medium", color: buttonColors(theme, "primary", "ghost", false, false).text, style: [{ fontSize: 14, lineHeight: 20 }, style], children: children })) : (children) }));
|
|
40
|
+
return (
|
|
41
|
+
// UIButton's plain style: no frame, the text faded while held, the target 44 tall
|
|
42
|
+
_jsx(Pressable, { ...link, onPress: press, accessibilityRole: role, accessibilityLabel: accessibilityLabel, testID: testID, hitSlop: { left: 8, right: 8 }, style: ({ pressed: held }) => ({ minHeight: 44, justifyContent: "center", alignSelf: "flex-start", opacity: held ? 0.35 : 1 }), children: _jsx(Text, { weight: weight ?? "regular", color: theme.color("--link-primary-text-color", theme.colors.textAccent), style: [{ fontSize: 15, lineHeight: 20 }, style], children: children }) }));
|
|
43
|
+
}
|
|
44
|
+
const actionable = href != null || onPress != null;
|
|
30
45
|
// iOS's own Text highlights a press (as UITextView's links); elsewhere the press layer of a row
|
|
31
46
|
const highlight = theme.isIOS && !web ? null : pressed ? { backgroundColor: controlHighlight(theme.scheme) } : null;
|
|
32
47
|
return (_jsx(RNText, { ...anchor, accessibilityRole: href ? "link" : onPress ? "button" : undefined, accessibilityLabel: accessibilityLabel, testID: testID, onPress: actionable ? press : undefined, onPressIn: actionable ? () => setPressed(true) : undefined, onPressOut: actionable ? () => setPressed(false) : undefined, style: [
|
package/dist/es/index.js
CHANGED
|
@@ -11,7 +11,7 @@ export { Glass } from "./internal/Glass";
|
|
|
11
11
|
export { BarItemContext } from "./components/Button/Button";
|
|
12
12
|
export { NavigationButton } from "./components/NavigationButton/NavigationButton";
|
|
13
13
|
export { Toolbar, } from "./components/Toolbar/Toolbar";
|
|
14
|
-
export { TabBar, useTabBarMinimize, } from "./components/TabBar/TabBar";
|
|
14
|
+
export { TabBar, useTabBarMetrics, useTabBarMinimize, } from "./components/TabBar/TabBar";
|
|
15
15
|
export { SegmentedControl, } from "./components/SegmentedControl/SegmentedControl";
|
|
16
16
|
export { Switch } from "./components/Switch/Switch";
|
|
17
17
|
export { Checkbox } from "./components/Checkbox/Checkbox";
|
|
@@ -38,7 +38,7 @@ export { Badge } from "./components/Badge/Badge";
|
|
|
38
38
|
export { BottomActions } from "./components/BottomActions/BottomActions";
|
|
39
39
|
export { IntroHeader } from "./components/IntroHeader/IntroHeader";
|
|
40
40
|
export { Card, cardColors } from "./components/Card/Card";
|
|
41
|
-
export { List, ListItem, useListMetrics } from "./components/List/List";
|
|
41
|
+
export { List, ListItem, ListStack, useListMetrics } from "./components/List/List";
|
|
42
42
|
export { Chip } from "./components/Chip/Chip";
|
|
43
43
|
export { Skeleton } from "./components/Skeleton/Skeleton";
|
|
44
44
|
export { Progress, progressSegments } from "./components/Progress/Progress";
|
|
@@ -24,10 +24,16 @@ export type ChipProps = {
|
|
|
24
24
|
accessibilityLabel?: string;
|
|
25
25
|
/**
|
|
26
26
|
* iOS: `tag`, a capsule of the gray fill 40pt tall (a tag cloud in a sheet, as Maps' Filters), or `glass`, a glass
|
|
27
|
-
* capsule 44pt tall (a filter in a row over content, as Maps' filters under its search). Android draws
|
|
28
|
-
* either
|
|
27
|
+
* capsule 44pt tall (a filter in a row over content, as Maps' filters under its search). Android draws Material's
|
|
28
|
+
* chip with either; with `glass` it stands on a glass of its size (the bar circles'), readable over content.
|
|
29
|
+
* @default "tag"
|
|
29
30
|
*/
|
|
30
31
|
appearance?: "tag" | "glass";
|
|
32
|
+
/**
|
|
33
|
+
* iOS: `sm`, a step under the regular chip, as a filter row a step under Maps' 44: 36pt tall, the label 15/20, the
|
|
34
|
+
* insides in proportion, the target still 44. Android keeps Material's 32dp chip. @default "md"
|
|
35
|
+
*/
|
|
36
|
+
size?: "md" | "sm";
|
|
31
37
|
/** An input chip: called when the reader takes the value back (a cross on Android; see `removeStyle` on iOS). */
|
|
32
38
|
onRemove?: () => void;
|
|
33
39
|
/** The remove action's name, for screen readers. @default "Remove" */
|
|
@@ -49,4 +55,4 @@ export type ChipProps = {
|
|
|
49
55
|
testID?: string;
|
|
50
56
|
style?: StyleProp<ViewStyle>;
|
|
51
57
|
};
|
|
52
|
-
export declare function Chip({ children, selected: selectedProp, defaultSelected, onSelectedChange, onPress, icon, trailingIcon, menu, expanded, accessibilityLabel, appearance, onRemove, removeLabel, removeStyle, onLongPress, longPressLabel, disabled, testID, style, }: ChipProps): import("react").JSX.Element;
|
|
58
|
+
export declare function Chip({ children, selected: selectedProp, defaultSelected, onSelectedChange, onPress, icon, trailingIcon, menu, expanded, accessibilityLabel, appearance, size, onRemove, removeLabel, removeStyle, onLongPress, longPressLabel, disabled, testID, style, }: ChipProps): import("react").JSX.Element;
|
|
@@ -29,6 +29,12 @@ export type DialogProps = {
|
|
|
29
29
|
mobileLayout?: "inline" | "stacked";
|
|
30
30
|
/** A tap outside, Android's back and Escape close it: Android's dialogs do, an iOS alert does not. @default Android true, iOS false */
|
|
31
31
|
dismissible?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The colors of the main action: `accent`, as iOS fills an alert's preferred action and Android writes its dialog
|
|
34
|
+
* buttons; `primary`, the main button's own (the solid primary button's fill and label on iOS, the primary ghost
|
|
35
|
+
* button's text on Android), for an app whose main actions are in its ink. @default "accent"
|
|
36
|
+
*/
|
|
37
|
+
actionColor?: "accent" | "primary";
|
|
32
38
|
testID?: string;
|
|
33
39
|
};
|
|
34
40
|
/**
|
|
@@ -37,7 +43,7 @@ export type DialogProps = {
|
|
|
37
43
|
* radius 21, a Medium 20 title over 16 text, text buttons in the accent at the end, Android's dialog animation). The
|
|
38
44
|
* web Dialog's `mobileVariant="alert"` as one call; a sheet is `BottomSheet`.
|
|
39
45
|
*/
|
|
40
|
-
export declare function Dialog({
|
|
46
|
+
export declare function Dialog({ actionColor, ...props }: DialogProps): import("react").JSX.Element;
|
|
41
47
|
export type ChoiceDialogProps = {
|
|
42
48
|
open: boolean;
|
|
43
49
|
onClose: () => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import { type StyleProp, type ViewStyle } from "react-native";
|
|
2
|
+
import { type StyleProp, type TextStyle, type ViewStyle } from "react-native";
|
|
3
3
|
type Tone = "secondary" | "danger" | "warning";
|
|
4
4
|
export type EmptyMessageProps = {
|
|
5
5
|
children: ReactNode;
|
|
@@ -36,9 +36,11 @@ declare function EmptyMessageIcon({ children, color, size }: {
|
|
|
36
36
|
declare namespace EmptyMessageIcon {
|
|
37
37
|
var displayName: string;
|
|
38
38
|
}
|
|
39
|
-
declare function EmptyMessageTitle({ children, color }: {
|
|
39
|
+
declare function EmptyMessageTitle({ children, color, style, }: {
|
|
40
40
|
children: ReactNode;
|
|
41
41
|
color?: Tone;
|
|
42
|
+
/** Over the title's own type: a brand's display face at its size and line (`fontFamily`, `fontSize`, `lineHeight`). */
|
|
43
|
+
style?: StyleProp<TextStyle>;
|
|
42
44
|
}): import("react").JSX.Element;
|
|
43
45
|
declare namespace EmptyMessageTitle {
|
|
44
46
|
var displayName: string;
|
|
@@ -149,11 +149,18 @@ export type TextFieldProps = InputProps & {
|
|
|
149
149
|
/** Shown under the field in place of the description, and marks it invalid. */
|
|
150
150
|
errorMessage?: ReactNode;
|
|
151
151
|
required?: boolean;
|
|
152
|
+
/** Content at the end of the label's line on iOS, or of the help's line on Android (where the label floats). */
|
|
153
|
+
labelAction?: ReactNode;
|
|
154
|
+
/**
|
|
155
|
+
* Shows the count of characters against `maxLength` (`3/15`): Material's counter at the end of the help's line on
|
|
156
|
+
* Android, at the end of the label's line on iOS.
|
|
157
|
+
*/
|
|
158
|
+
counter?: boolean;
|
|
152
159
|
};
|
|
153
160
|
/**
|
|
154
161
|
* A labelled text field: Plex UI's Field around an Input. iOS sets the label over the field (15/20 medium) and the
|
|
155
162
|
* description or error under it (15/20, 4pt below, `--mobile-field-error-*`); Android is the outlined field with its
|
|
156
163
|
* floating label (on the line of an outlined field) and the help under it (14, 14dp in).
|
|
157
164
|
*/
|
|
158
|
-
export declare function TextField({ label, description, errorMessage, required, invalid, ...input }: TextFieldProps): import("react").JSX.Element;
|
|
165
|
+
export declare function TextField({ label, description, errorMessage, required, invalid, labelAction, counter, ...input }: TextFieldProps): import("react").JSX.Element;
|
|
159
166
|
export {};
|