@plexui/react-native 0.2.2 → 0.2.4
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 +25 -11
- package/dist/es/components/ContextMenu/ContextMenu.js +128 -0
- package/dist/es/components/Dialog/Dialog.js +26 -24
- package/dist/es/components/Input/Input.js +20 -4
- package/dist/es/components/List/List.js +3 -3
- package/dist/es/components/Menu/Menu.js +50 -9
- package/dist/es/components/Toolbar/Toolbar.js +22 -0
- package/dist/es/index.js +1 -0
- package/dist/types/components/BottomActions/BottomActions.d.ts +13 -3
- package/dist/types/components/ContextMenu/ContextMenu.d.ts +57 -0
- package/dist/types/components/List/List.d.ts +3 -1
- package/dist/types/components/Menu/Menu.d.ts +15 -6
- package/dist/types/components/Toolbar/Toolbar.d.ts +14 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/BottomActions/BottomActions.tsx +43 -14
- package/src/components/ContextMenu/ContextMenu.tsx +164 -0
- package/src/components/Dialog/Dialog.tsx +39 -24
- package/src/components/Input/Input.tsx +23 -3
- package/src/components/List/List.tsx +8 -1
- package/src/components/Menu/Menu.tsx +67 -7
- package/src/components/Toolbar/Toolbar.tsx +50 -0
- package/src/index.ts +1 -0
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Children, cloneElement, isValidElement } from "react";
|
|
3
3
|
import { StyleSheet, View } from "react-native";
|
|
4
4
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
|
+
import { ANDROID_FADE_ALPHA, ANDROID_FADE_STOPS, SoftBottomEdge } from "../../internal/BarBackdrop";
|
|
6
|
+
import { withAlpha } from "../../theme/material";
|
|
5
7
|
import { useTheme } from "../../theme/ThemeProvider";
|
|
6
8
|
import { Button } from "../Button/Button";
|
|
7
9
|
/**
|
|
@@ -11,7 +13,7 @@ import { Button } from "../Button/Button";
|
|
|
11
13
|
* action stands under it, 8 apart. Android: the Plex Android look's 48dp full-width button, 16dp from the sides and
|
|
12
14
|
* 16 above the gesture bar. Each Button inside is a block of the size `3xl` unless it sets its own.
|
|
13
15
|
*/
|
|
14
|
-
export function BottomActions({ children, floating = false, testID, style }) {
|
|
16
|
+
export function BottomActions({ children, floating = false, canvasColor, testID, style }) {
|
|
15
17
|
const theme = useTheme();
|
|
16
18
|
const insets = useSafeAreaInsets();
|
|
17
19
|
const android = theme.isAndroid;
|
|
@@ -19,16 +21,28 @@ export function BottomActions({ children, floating = false, testID, style }) {
|
|
|
19
21
|
// iOS: 2pt over the safe area (34 on a Face ID iPhone); a phone with a home button has none, so 16 there
|
|
20
22
|
const bottom = android ? Math.max(insets.bottom, 0) + 16 : insets.bottom > 0 ? insets.bottom + 2 : 16;
|
|
21
23
|
const height = android ? 48 : 52;
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
:
|
|
29
|
-
|
|
24
|
+
const canvas = canvasColor ?? theme.colors.background;
|
|
25
|
+
const paddingTop = 8;
|
|
26
|
+
const actions = Children.toArray(children).map((child, index) => {
|
|
27
|
+
if (!isValidElement(child) || child.type !== Button)
|
|
28
|
+
return child;
|
|
29
|
+
const props = child.props;
|
|
30
|
+
// The second action: iOS 26's glass capsule of the main one's size, Android's ghost button
|
|
31
|
+
const second = index > 0 && props.variant === undefined
|
|
32
|
+
? android
|
|
33
|
+
? { variant: "ghost", color: props.color ?? "secondary" }
|
|
34
|
+
: { variant: "soft", color: props.color ?? "secondary", mobileMaterial: props.mobileMaterial ?? "glass" }
|
|
35
|
+
: null;
|
|
36
|
+
return cloneElement(child, {
|
|
37
|
+
...second,
|
|
38
|
+
block: props.block ?? true,
|
|
39
|
+
size: props.size ?? "3xl",
|
|
40
|
+
style: [{ minHeight: height, borderRadius: height / 2 }, props.style],
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
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 })) : (_jsx(SoftBottomEdge, { fill: canvas, top: paddingTop, tail: 27, blur: theme.length("--toolbar-edge-blur-small", 3) }))) : null, actions] }));
|
|
30
44
|
}
|
|
31
45
|
const styles = StyleSheet.create({
|
|
32
|
-
bar: { alignSelf: "stretch"
|
|
46
|
+
bar: { alignSelf: "stretch" },
|
|
33
47
|
floating: { position: "absolute", left: 0, right: 0, bottom: 0 },
|
|
34
48
|
});
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
3
|
+
import { Dimensions, Platform, View } from "react-native";
|
|
4
|
+
import { useTheme } from "../../theme/ThemeProvider";
|
|
5
|
+
import { Menu, MenuSurface, hasCheckedItems, measure } from "../Menu/Menu";
|
|
6
|
+
/** A touch and hold opens the menu after half a second, as the web's ContextMenu (CONTEXT_MENU_LONG_PRESS). */
|
|
7
|
+
export const CONTEXT_MENU_LONG_PRESS = 500;
|
|
8
|
+
const ContextMenuContext = createContext(null);
|
|
9
|
+
function useContextMenu(part) {
|
|
10
|
+
const context = useContext(ContextMenuContext);
|
|
11
|
+
if (!context)
|
|
12
|
+
throw new Error(`${part} must be inside a ContextMenu`);
|
|
13
|
+
return context;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A menu of actions for an element, opened by a touch and hold (and a right click on the web): on iOS 27 the screen
|
|
17
|
+
* dims and blurs, the element stays clear over it as a lifted preview, and the glass menu stands 16 from it by the
|
|
18
|
+
* third of the screen it is in, over it when it stands in the lower half; on Android Material's popup under the
|
|
19
|
+
* element, the screen dimmed around it. Parts as @plexui/ui: `ContextMenu.Trigger`, `ContextMenu.Content`, and the
|
|
20
|
+
* items of Menu (`ContextMenu.Item`, `ContextMenu.Separator`, `ContextMenu.Label`).
|
|
21
|
+
*/
|
|
22
|
+
function ContextMenuRoot({ children, open: openProp, onOpenChange }) {
|
|
23
|
+
const [own, setOwn] = useState(false);
|
|
24
|
+
const open = openProp ?? own;
|
|
25
|
+
const [anchor, setAnchor] = useState(null);
|
|
26
|
+
const target = useRef({ node: null, preview: null });
|
|
27
|
+
const [preview, setPreview] = useState(null);
|
|
28
|
+
const apply = useCallback((next) => {
|
|
29
|
+
if (openProp === undefined)
|
|
30
|
+
setOwn(next);
|
|
31
|
+
onOpenChange?.(next);
|
|
32
|
+
}, [openProp, onOpenChange]);
|
|
33
|
+
const setOpen = apply;
|
|
34
|
+
const applyRef = useRef(apply);
|
|
35
|
+
applyRef.current = apply;
|
|
36
|
+
// The element is measured as the menu opens, by a touch and hold or by `open`: the menu and its preview stand where
|
|
37
|
+
// it is. Until then nothing is drawn
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!open) {
|
|
40
|
+
setAnchor(null);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
let live = true;
|
|
44
|
+
measure(target.current.node, (box) => {
|
|
45
|
+
if (!live)
|
|
46
|
+
return;
|
|
47
|
+
setAnchor(box);
|
|
48
|
+
setPreview(target.current.preview);
|
|
49
|
+
});
|
|
50
|
+
// A turn of the screen moves the element: the menu closes, as iOS dismisses a context menu on rotation
|
|
51
|
+
const sub = Dimensions.addEventListener("change", () => applyRef.current(false));
|
|
52
|
+
return () => {
|
|
53
|
+
live = false;
|
|
54
|
+
sub.remove();
|
|
55
|
+
};
|
|
56
|
+
}, [open]);
|
|
57
|
+
const setTarget = useCallback((node, next) => {
|
|
58
|
+
target.current = { node, preview: next };
|
|
59
|
+
}, []);
|
|
60
|
+
return _jsx(ContextMenuContext.Provider, { value: { open, setOpen, anchor, preview, setTarget }, children: children });
|
|
61
|
+
}
|
|
62
|
+
ContextMenuRoot.displayName = "ContextMenu";
|
|
63
|
+
/**
|
|
64
|
+
* The element the menu is for: a ListItem, a Pressable, a Button, anything with `onLongPress`. Its own press still
|
|
65
|
+
* runs; a touch and hold opens the menu, and so does a right click on the web. The lifted preview on iOS is the
|
|
66
|
+
* element drawn again from its props, so state the element keeps inside itself is not in it.
|
|
67
|
+
*/
|
|
68
|
+
function ContextMenuTrigger({ children, style }) {
|
|
69
|
+
const theme = useTheme();
|
|
70
|
+
const { setOpen, setTarget, open, anchor } = useContextMenu("ContextMenu.Trigger");
|
|
71
|
+
const child = isValidElement(children) ? children : null;
|
|
72
|
+
const own = child?.props;
|
|
73
|
+
// The element's own long press gets its event, then the menu opens
|
|
74
|
+
const hold = (...args) => {
|
|
75
|
+
own?.onLongPress?.(...args);
|
|
76
|
+
setOpen(true);
|
|
77
|
+
};
|
|
78
|
+
// VoiceOver and TalkBack open it through the element's long-press action (ListItem names it itself)
|
|
79
|
+
const actions = own?.accessibilityActions ?? [];
|
|
80
|
+
const a11y = actions.some((action) => action.name === "longpress")
|
|
81
|
+
? null
|
|
82
|
+
: {
|
|
83
|
+
accessibilityActions: [...actions, { name: "longpress" }],
|
|
84
|
+
onAccessibilityAction: (event) => {
|
|
85
|
+
if (event.nativeEvent.actionName === "longpress")
|
|
86
|
+
hold();
|
|
87
|
+
else
|
|
88
|
+
own?.onAccessibilityAction?.(event);
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
// The preview is the element drawn again over the dimming, taking no presses
|
|
92
|
+
const preview = child ? cloneElement(child, { onLongPress: undefined, onPress: undefined }) : null;
|
|
93
|
+
const web = Platform.OS === "web";
|
|
94
|
+
return (_jsx(View, { ref: (next) => setTarget(next, preview), collapsable: false,
|
|
95
|
+
// On iOS the element hides under its lifted preview while the menu is open, so it is not drawn twice; Android
|
|
96
|
+
// keeps it lit in its place
|
|
97
|
+
style: [{ opacity: open && anchor && !theme.isAndroid ? 0 : 1 }, style], ...(web
|
|
98
|
+
? {
|
|
99
|
+
onContextMenu: (event) => {
|
|
100
|
+
event.preventDefault();
|
|
101
|
+
setOpen(true);
|
|
102
|
+
},
|
|
103
|
+
}
|
|
104
|
+
: null), children: child ? cloneElement(child, { onLongPress: hold, ...a11y }) : children }));
|
|
105
|
+
}
|
|
106
|
+
ContextMenuTrigger.displayName = "ContextMenu.Trigger";
|
|
107
|
+
/** The menu: Menu's items, 250 wide on iOS. */
|
|
108
|
+
function ContextMenuContent(props) {
|
|
109
|
+
const theme = useTheme();
|
|
110
|
+
const { open, setOpen, anchor, preview } = useContextMenu("ContextMenu.Content");
|
|
111
|
+
// The preview keeps a row's corners to half its height, else the kit's 30 (--context-menu-preview-radius)
|
|
112
|
+
// Items that say `checked` make a set of options, with the checkmark's column, as in Menu
|
|
113
|
+
const check = hasCheckedItems(props.children);
|
|
114
|
+
const radius = Math.min(theme.length("--context-menu-preview-radius", 30), (anchor?.height ?? 60) / 2);
|
|
115
|
+
if (theme.isAndroid) {
|
|
116
|
+
// Android: Material's popup under the element at its end, the screen dimmed around it
|
|
117
|
+
return _jsx(MenuSurface, { ...props, check: check, open: open && anchor != null, anchor: anchor, row: anchor ? { box: anchor, radius: { top: 0, bottom: 0 } } : null, cover: false, onClose: () => setOpen(false) });
|
|
118
|
+
}
|
|
119
|
+
return _jsx(MenuSurface, { ...props, check: check, open: open && anchor != null, anchor: anchor, context: { preview, radius }, onClose: () => setOpen(false) });
|
|
120
|
+
}
|
|
121
|
+
ContextMenuContent.displayName = "ContextMenu.Content";
|
|
122
|
+
export const ContextMenu = Object.assign(ContextMenuRoot, {
|
|
123
|
+
Trigger: ContextMenuTrigger,
|
|
124
|
+
Content: ContextMenuContent,
|
|
125
|
+
Item: Menu.Item,
|
|
126
|
+
Separator: Menu.Separator,
|
|
127
|
+
Label: Menu.Label,
|
|
128
|
+
});
|
|
@@ -107,31 +107,45 @@ export function ChoiceDialog({ open, onClose, title, cancelLabel, okLabel, onOk,
|
|
|
107
107
|
]
|
|
108
108
|
: [{ label: cancelLabel, testID: testID ? `${testID}-cancel` : undefined }], run: run, ids: ids, list: _jsx(View, { ...listProps, children: children }) }) }));
|
|
109
109
|
}
|
|
110
|
+
/** An iOS alert action's label inset from its capsule's ends. */
|
|
111
|
+
const IOS_ACTION_INSET = 16;
|
|
110
112
|
function IOSAlert({ theme, title, description, actions, run, ids, layout, children }) {
|
|
111
113
|
const { width: screen } = useWindowDimensions();
|
|
112
114
|
const width = Math.min(theme.length("--dialog-alert-width", 320), screen - 32);
|
|
113
115
|
const radius = theme.length("--dialog-alert-radius", 34);
|
|
114
|
-
const
|
|
116
|
+
const padding = theme.length("--dialog-alert-padding", 16);
|
|
117
|
+
const gap = theme.length("--dialog-alert-action-gap", 8);
|
|
118
|
+
// Two actions stand side by side while each label fits its half on one line; iOS never wraps an alert button's
|
|
119
|
+
// label, so a longer one stacks them at the full width (UIAlertController). Each label is measured on one line
|
|
120
|
+
const [labels, setLabels] = useState([]);
|
|
121
|
+
const half = (width - padding * 2 - gap) / 2 - IOS_ACTION_INSET * 2;
|
|
122
|
+
const fits = actions.every((_, index) => labels[index] == null || labels[index] <= half + 0.5);
|
|
123
|
+
const inline = layout === "inline" || (layout !== "stacked" && actions.length <= 2 && fits);
|
|
115
124
|
// The cancel action stands first of two side by side, as UIAlertController; a stack keeps the order written, as the
|
|
116
125
|
// web's alert footer does. Each keeps its place in `actions` as its key, since two actions may share a label
|
|
117
126
|
const indexed = actions.map((action, index) => ({ action, index }));
|
|
118
127
|
const cancel = indexed.filter(({ action }) => action.variant === "cancel");
|
|
119
128
|
const others = indexed.filter(({ action }) => action.variant !== "cancel");
|
|
120
|
-
|
|
121
|
-
const
|
|
129
|
+
// Two stacked because their labels do not fit: Cancel last, at the bottom, as UIAlertController stacks them
|
|
130
|
+
const autoStacked = !inline && layout == null && actions.length === 2;
|
|
131
|
+
const ordered = inline ? [...cancel, ...others] : autoStacked ? [...others, ...cancel] : indexed;
|
|
122
132
|
const type = { fontSize: theme.length("--dialog-mobile-type-size", 17), lineHeight: theme.length("--dialog-mobile-type-leading", 22) };
|
|
123
|
-
return (_jsxs(Glass, { radius: radius, elevation: "raised", fillToken: "--dialog-alert-background", style: { width, flexShrink: 1, padding
|
|
133
|
+
return (_jsxs(Glass, { radius: radius, elevation: "raised", fillToken: "--dialog-alert-background", style: { width, flexShrink: 1, padding, gap: 10 }, children: [layout == null && actions.length === 2 ? (
|
|
134
|
+
// The labels on one line, unseen, to tell whether two fit side by side
|
|
135
|
+
_jsx(View, { pointerEvents: "none", "aria-hidden": true, style: styles.measure, children: actions.map((action, index) => (_jsx(Text, { weight: action.preferred ? "semibold" : "medium", numberOfLines: 1, style: type, onLayout: (event) => {
|
|
136
|
+
const next = event.nativeEvent.layout.width;
|
|
137
|
+
setLabels((current) => (current[index] === next ? current : Object.assign([...current], { [index]: next })));
|
|
138
|
+
}, children: action.label }, index))) })) : null, _jsxs(ScrollView, { style: styles.scroll, contentContainerStyle: { gap: 10 }, bounces: false, children: [_jsxs(View, { style: { paddingTop: 5, paddingHorizontal: 15, paddingBottom: 5.5, gap: 5.67 }, children: [_jsx(Text, { nativeID: ids.title, weight: "semibold", style: [type, { textAlign: description == null ? "center" : "auto" }], accessibilityRole: "header", children: title }), description != null ? (_jsx(Text, { nativeID: ids.description, color: theme.color("--dialog-alert-message-color"), style: { fontSize: 15, lineHeight: 20 }, children: description })) : null] }), children != null ? (
|
|
124
139
|
// A field fills the alert as its actions do: the largest control size is the alert's 48 there
|
|
125
140
|
// (Dialog.module.css sets --control-size-3xl to --dialog-alert-field-height in the alert's body)
|
|
126
141
|
_jsx(ThemeProvider, { brand: { tokens: { "--control-size-3xl": `${theme.length("--dialog-alert-field-height", 48)}px` } }, children: _jsx(View, { style: { paddingBottom: 10, marginHorizontal: -1 }, children: children }) })) : null] }), ordered.length ? (_jsx(View, { style: [{ gap, marginTop: children != null ? 0 : 4 }, inline ? styles.row : null], children: ordered.map(({ action, index }) => (_jsx(IOSAction, { theme: theme, action: action, run: run, type: type, grow: inline }, index))) })) : null] }));
|
|
127
142
|
}
|
|
128
143
|
function IOSAction({ theme, action, run, type, grow }) {
|
|
129
|
-
// The preferred action is the accent with a white label,
|
|
130
|
-
// (
|
|
131
|
-
//
|
|
144
|
+
// The preferred action is the accent with a white label, one flat color with no sheen and no edge, as native draws
|
|
145
|
+
// a preferredAction (iOS 27.2: 0082f7 on every row); disabled, the phone's disabled fill (Button.module.css). A
|
|
146
|
+
// destructive one keeps the alert's fill and its red label
|
|
132
147
|
const accent = action.preferred && action.variant !== "destructive";
|
|
133
148
|
const height = theme.length("--dialog-alert-action-height", 48);
|
|
134
|
-
const [measured, setMeasured] = useState(height);
|
|
135
149
|
const fill = accent
|
|
136
150
|
? action.disabled
|
|
137
151
|
? theme.color("--button-mobile-disabled-background", theme.color("--color-background-disabled"))
|
|
@@ -145,29 +159,16 @@ function IOSAction({ theme, action, run, type, grow }) {
|
|
|
145
159
|
? theme.color("--toolbar-prominent-color")
|
|
146
160
|
: theme.colors.text;
|
|
147
161
|
const lit = accent && !action.disabled;
|
|
148
|
-
|
|
149
|
-
const sheen = lit ? sheenOf(theme, measured) : undefined;
|
|
150
|
-
return (_jsxs(Pressable, { accessibilityRole: "button", accessibilityState: { disabled: !!action.disabled }, disabled: action.disabled, onPress: () => run(action), onLayout: lit ? (event) => setMeasured(event.nativeEvent.layout.height) : undefined, testID: action.testID, style: ({ pressed }) => [
|
|
162
|
+
return (_jsx(Pressable, { accessibilityRole: "button", accessibilityState: { disabled: !!action.disabled }, disabled: action.disabled, onPress: () => run(action), testID: action.testID, style: ({ pressed }) => [
|
|
151
163
|
styles.iosAction,
|
|
152
164
|
{
|
|
153
165
|
minHeight: height,
|
|
154
166
|
borderRadius: height / 2,
|
|
155
167
|
backgroundColor: lit && pressed ? theme.color("--toolbar-prominent-background-active") : fill,
|
|
156
168
|
opacity: pressed && !lit ? 0.7 : 1,
|
|
157
|
-
boxShadow: typeof shadow === "string" ? shadow : undefined,
|
|
158
169
|
},
|
|
159
170
|
grow ? styles.grow : null,
|
|
160
|
-
], children:
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* `--toolbar-prominent-sheen`, lighter along the top and the bottom edge, for a face of a known height: its
|
|
164
|
-
* `calc(100% - 8px)` stop in pixels, since React Native's gradients take no calc().
|
|
165
|
-
*/
|
|
166
|
-
function sheenOf(theme, height) {
|
|
167
|
-
const value = theme.token("--toolbar-prominent-sheen");
|
|
168
|
-
if (typeof value !== "string" || !value.includes("gradient"))
|
|
169
|
-
return undefined;
|
|
170
|
-
return value.replace(/calc\(\s*100%\s*-\s*([\d.]+)px\s*\)/g, (_, px) => `${Math.max(0, height - Number(px))}px`);
|
|
171
|
+
], children: _jsx(Text, { color: text, weight: action.preferred ? "semibold" : "medium", style: [type, styles.centered], children: action.label }) }));
|
|
171
172
|
}
|
|
172
173
|
function AndroidDialog({ theme, title, description, actions, run, ids, children, list }) {
|
|
173
174
|
const m = theme.material;
|
|
@@ -219,7 +220,8 @@ const styles = StyleSheet.create({
|
|
|
219
220
|
row: { flexDirection: "row" },
|
|
220
221
|
grow: { flex: 1, flexBasis: 0 },
|
|
221
222
|
centered: { textAlign: "center" },
|
|
222
|
-
iosAction: { alignItems: "center", justifyContent: "center", paddingVertical: 13, paddingHorizontal:
|
|
223
|
+
iosAction: { alignItems: "center", justifyContent: "center", paddingVertical: 13, paddingHorizontal: IOS_ACTION_INSET, borderCurve: "continuous" },
|
|
224
|
+
measure: { position: "absolute", top: 0, left: 0, width: 2000, alignItems: "flex-start", opacity: 0 },
|
|
223
225
|
// Android's alert: 21dp corners (the catalog's); the text 24 in. Measured on the reference's alerts: the title's
|
|
224
226
|
// baseline 40 under the top, the message's first 33 under it in lines 18.75 apart (16sp Roboto's), its last 59
|
|
225
227
|
// over the buttons' (Roboto's font padding sets these 2 to 3 lower than the layout's 19, 10 and 20 would)
|
|
@@ -361,6 +361,9 @@ export function InputField({ variant = "outline", size = "md", disabled = false,
|
|
|
361
361
|
const required = ownRequired ?? floatLabel?.required;
|
|
362
362
|
const shift = ownShift ?? floatLabel?.shift;
|
|
363
363
|
const [focused, setFocused] = useState(false);
|
|
364
|
+
// A Tab to the iOS clear button blurs the field on the web: the button stays while it has focus (a press keeps the
|
|
365
|
+
// field's focus, below)
|
|
366
|
+
const [clearing, setClearing] = useState(false);
|
|
364
367
|
const [own, setOwn] = useState(defaultValue ?? "");
|
|
365
368
|
const text = value ?? own;
|
|
366
369
|
const filled = text.length > 0;
|
|
@@ -439,7 +442,13 @@ export function InputField({ variant = "outline", size = "md", disabled = false,
|
|
|
439
442
|
// Android's label is in the hint color at rest and in the accent while the field has focus, springing between them
|
|
440
443
|
const labelColor = invalid ? dangerText(theme) : focused ? focusAccent(theme) : look.placeholder;
|
|
441
444
|
const labelTint = useSpringColor(labelColor, FIELD_SPRING.stiffness, !floating || theme.reducedMotion);
|
|
442
|
-
|
|
445
|
+
// iOS shows a form field's clear button while it is edited (UITextField's whileEditing), a search field's while it
|
|
446
|
+
// has text; Android while the field has text
|
|
447
|
+
const searchField = rest.inputMode === "search" || barField != null;
|
|
448
|
+
// A value at a row's end has no clear button on iOS, as Settings' and Contacts' rows: only a value that starts its
|
|
449
|
+
// column or stands on its own line under the label takes one
|
|
450
|
+
const valueRight = !startAligned && (inRow || (fillsRow && valueAtEnd));
|
|
451
|
+
const showClear = !!onClear && filled && !disabled && !readOnly && (theme.isAndroid || ((focused || clearing || searchField) && !valueRight));
|
|
443
452
|
// Android's search fields keep their clear button in place and show it with the text
|
|
444
453
|
const androidClear = (search || barSearch) && !!onClear && !disabled && !readOnly;
|
|
445
454
|
// A 24dp icon stands 12 in, the text 12 past it (48 in); otherwise the text is 14 in (the outlined field), 21 in a
|
|
@@ -481,7 +490,11 @@ export function InputField({ variant = "outline", size = "md", disabled = false,
|
|
|
481
490
|
// round end (Input.module.css), or keeps its box beside an end adornment
|
|
482
491
|
const clearMargin = theme.isAndroid
|
|
483
492
|
? { marginHorizontal: -(look.clearTarget - look.clearSize) / 2 }
|
|
484
|
-
:
|
|
493
|
+
: bare
|
|
494
|
+
? // In a List row the target reaches over and under the row's line, so the row keeps its height, and its circle
|
|
495
|
+
// ends at the row's end inset, as a form row's clear button
|
|
496
|
+
{ marginVertical: -(look.clearTarget - look.text.lineHeight) / 2, marginEnd: -(look.clearTarget - look.clearSize) / 2 }
|
|
497
|
+
: { marginEnd: endAdornment ? theme.length("--input-clear-target-offset", 0) : look.height / 2 - look.clearTarget / 2 - look.gutter };
|
|
485
498
|
// An adornment stands in a View of its own, centered on the field: a Button in it keeps its own `alignSelf`
|
|
486
499
|
// ("flex-start", for a column) to that View, not to the field's row, where it would rise to the top of a field taller
|
|
487
500
|
// than itself (an IconButton's 40dp in a 50dp field)
|
|
@@ -523,7 +536,7 @@ export function InputField({ variant = "outline", size = "md", disabled = false,
|
|
|
523
536
|
theme.font("regular"),
|
|
524
537
|
// A label floated inside the field (8 to 24) sets the text under it
|
|
525
538
|
{ paddingTop: padding.top, paddingBottom: padding.bottom },
|
|
526
|
-
|
|
539
|
+
valueRight ? { textAlign: Platform.OS === "web" && rtl ? "left" : "right" } : null,
|
|
527
540
|
// A value in a row that the person cannot edit is the secondary label, as the web's phone rows (iOS's
|
|
528
541
|
// values of a row that only informs)
|
|
529
542
|
fillsRow && readOnly && !disabled ? { color: theme.colors.labelSecondary } : null,
|
|
@@ -536,7 +549,10 @@ export function InputField({ variant = "outline", size = "md", disabled = false,
|
|
|
536
549
|
}, onHiddenPress: () => {
|
|
537
550
|
if (!locked)
|
|
538
551
|
input.current?.focus();
|
|
539
|
-
} })) : showClear ? (_jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: "Clear", onPress: () => {
|
|
552
|
+
} })) : showClear ? (_jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: "Clear", onFocus: () => setClearing(true), onBlur: () => setClearing(false), ...(Platform.OS === "web" ? { onMouseDown: (event) => event.preventDefault() } : null), onPress: () => {
|
|
553
|
+
// As UIKit's clear button, the field keeps editing; first, so a caller's onClear may still move the focus
|
|
554
|
+
if (!theme.isAndroid && !searchField)
|
|
555
|
+
input.current?.focus();
|
|
540
556
|
if (value === undefined)
|
|
541
557
|
setOwn("");
|
|
542
558
|
onChangeText?.("");
|
|
@@ -115,7 +115,7 @@ export function List({ children, header, description, footer, error, surface = "
|
|
|
115
115
|
* 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
|
|
116
116
|
* tiled row draws none).
|
|
117
117
|
*/
|
|
118
|
-
export function ListItem({ label, description, leading, leadingColor, value, valuePlacement = "end", trailing, error, checked: checkedProp, defaultChecked, onCheckedChange, disclosure, onPress, disabled = false, destructive = false, accessibilityLabel, testID, }) {
|
|
118
|
+
export function ListItem({ label, description, leading, leadingColor, value, valuePlacement = "end", trailing, error, checked: checkedProp, defaultChecked, onCheckedChange, disclosure, onPress, onLongPress, disabled = false, destructive = false, accessibilityLabel, testID, }) {
|
|
119
119
|
const theme = useTheme();
|
|
120
120
|
const { last, top, bottom } = useContext(PlaceContext);
|
|
121
121
|
// A menu opened from the row finds the row (Android lights it over the dim of the screen)
|
|
@@ -185,13 +185,13 @@ export function ListItem({ label, description, leading, leadingColor, value, val
|
|
|
185
185
|
const startColor = atStart || checkLeads ? undefined : leadingColor;
|
|
186
186
|
return (_jsx(RowFrameContext.Provider, { value: frame, children: theme.isAndroid ? (_jsx(AndroidContent, { handPress: handPress, theme: theme, label: label, description: description, descriptionId: described.id, leading: start, leadingColor: startColor, leadingMark: atStart != null || checkLeads, value: value, valuePlacement: valuePlacement, trailing: end, edgeControl: found != null || switchRow, error: error, disabled: disabled, destructive: destructive, last: last })) : (_jsx(IOSContent, { theme: theme, label: label, description: description, descriptionId: described.id, leading: start, leadingColor: startColor, value: value, valuePlacement: valuePlacement, trailing: end, edgeControl: found != null || switchRow, error: error, chevron: chevron, disabled: disabled, destructive: destructive, last: last })) }));
|
|
187
187
|
};
|
|
188
|
-
if (press) {
|
|
188
|
+
if (press || onLongPress) {
|
|
189
189
|
// Android's rows press in the list selector: the native ripple on a device, the drawn one on the web
|
|
190
190
|
const highlight = controlHighlight(theme.scheme);
|
|
191
191
|
const drawn = theme.isAndroid && !nativeRipple;
|
|
192
192
|
return (_jsx(Pressable, { ref: frameNode, collapsable: false, ...described.props, ...(switchRow ? spaceToggles(toggle) : null),
|
|
193
193
|
// A row that toggles its control is not a second element for a screen reader or a Tab stop: the control is
|
|
194
|
-
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, onPress: press, onPressIn: drawn ? ripple.start : undefined, onPressOut: drawn ? ripple.end : undefined, android_ripple: nativeRipple ? { color: highlight, foreground: true } : undefined, testID: testID, style: ({ pressed }) => row(pressed || held), children: ({ pressed }) => (_jsxs(RowHoldContext.Provider, { value: disabled ? null : theme.isAndroid ? hold : setHeld, children: [ripple.layer, content(pressed || held)] })) }));
|
|
194
|
+
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, onPress: press, onLongPress: onLongPress, delayLongPress: onLongPress ? 500 : undefined, accessibilityActions: onLongPress ? [{ name: "longpress" }] : undefined, onAccessibilityAction: onLongPress ? (event) => event.nativeEvent.actionName === "longpress" && onLongPress() : undefined, onPressIn: drawn ? ripple.start : undefined, onPressOut: drawn ? ripple.end : undefined, android_ripple: nativeRipple ? { color: highlight, foreground: true } : undefined, testID: testID, style: ({ pressed }) => row(pressed || held), children: ({ pressed }) => (_jsxs(RowHoldContext.Provider, { value: disabled ? null : theme.isAndroid ? hold : setHeld, children: [ripple.layer, content(pressed || held)] })) }));
|
|
195
195
|
}
|
|
196
196
|
// A row that only shows (a detail, a value) is one element named by `accessibilityLabel` when it has one; with a
|
|
197
197
|
// control at its end it stays a group, so the control is still reached
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Children, cloneElement, createContext, Fragment, isValidElement, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { Animated, Easing, I18nManager, PanResponder, Platform, Pressable, ScrollView, StyleSheet, View, useWindowDimensions } from "react-native";
|
|
4
4
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
@@ -156,7 +156,7 @@ function MenuContent(props) {
|
|
|
156
156
|
// A menu whose items say `checked` (true or false) is a set of options: it keeps the checkmark's column, as Select's
|
|
157
157
|
return _jsx(MenuSurface, { ...props, check: hasCheckedItems(props.children), open: menu.open, anchor: menu.anchor, row: menu.row, header: menu.header, onClose: () => menu.setOpen(false) });
|
|
158
158
|
}
|
|
159
|
-
function hasCheckedItems(children) {
|
|
159
|
+
export function hasCheckedItems(children) {
|
|
160
160
|
return Children.toArray(children).some((child) => isValidElement(child) ? child.props.checked !== undefined || (child.type === Fragment && hasCheckedItems(child.props.children)) : false);
|
|
161
161
|
}
|
|
162
162
|
MenuContent.displayName = "Menu.Content";
|
|
@@ -166,7 +166,7 @@ export function MenuSurface(props) {
|
|
|
166
166
|
return theme.isAndroid ? _jsx(AndroidMenuSurface, { ...props }) : _jsx(IOSMenuSurface, { ...props });
|
|
167
167
|
}
|
|
168
168
|
/** iOS 26's pop-up menu: glass, a submenu over the menu at its row while the menu steps back. */
|
|
169
|
-
function IOSMenuSurface({ open, anchor, onClose, align = "start", width, check = false, multiple = false, cover, children, "aria-label": ariaLabel, testID }) {
|
|
169
|
+
function IOSMenuSurface({ open, anchor, onClose, align = "start", width, check = false, multiple = false, cover, context, children, "aria-label": ariaLabel, testID }) {
|
|
170
170
|
const theme = useTheme();
|
|
171
171
|
const insets = useSafeAreaInsets();
|
|
172
172
|
const window = useWindowDimensions();
|
|
@@ -207,9 +207,34 @@ function IOSMenuSurface({ open, anchor, onClose, align = "start", width, check =
|
|
|
207
207
|
const below = over ? box.y : box.y + box.height + gap;
|
|
208
208
|
const fitsBelow = below + height <= window.height - bottomEdge;
|
|
209
209
|
const above = over ? box.y + box.height - height : box.y - gap - height;
|
|
210
|
-
|
|
210
|
+
let top = size == null ? -window.height - 1000 : fitsBelow ? below : Math.max(topEdge, above);
|
|
211
|
+
let previewTop = box.y;
|
|
212
|
+
if (context) {
|
|
213
|
+
// iOS 27.2 places a context menu by where the element stands (ref-app menus-context): in the left third at its
|
|
214
|
+
// left edge, in the right third at its right edge, else at its centre; 16 under it, or over it when the element
|
|
215
|
+
// is in the lower half and the menu fits there (the web's ContextMenu, contextMenuPreview)
|
|
216
|
+
const centre = box.x + box.width / 2;
|
|
217
|
+
left = centre < window.width / 3 ? box.x : centre > (window.width * 2) / 3 ? box.x + box.width - measured : centre - measured / 2;
|
|
218
|
+
left = Math.max(margin, Math.min(left, window.width - measured - margin));
|
|
219
|
+
const lift = 16;
|
|
220
|
+
const overIt = box.y - lift - height;
|
|
221
|
+
const underIt = box.y + box.height + lift;
|
|
222
|
+
const lower = box.y + box.height / 2 > window.height / 2;
|
|
223
|
+
if (size != null) {
|
|
224
|
+
if (lower && overIt >= topEdge)
|
|
225
|
+
top = overIt;
|
|
226
|
+
else {
|
|
227
|
+
// Where the menu does not fit under the element it lifts the element up with it, as iOS moves the preview, so
|
|
228
|
+
// the menu never covers it
|
|
229
|
+
const overflow = underIt + height - (window.height - bottomEdge);
|
|
230
|
+
previewTop = overflow > 0 ? Math.max(topEdge, box.y - overflow) : box.y;
|
|
231
|
+
top = Math.max(topEdge, Math.min(previewTop + box.height + lift, window.height - bottomEdge - height));
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
211
235
|
// The measures are from the screen's left; a phone in a right-to-left layout reads `left` as the start edge
|
|
212
|
-
const
|
|
236
|
+
const swap = Platform.OS !== "web" && I18nManager.isRTL && I18nManager.doLeftAndRightSwapInRTL;
|
|
237
|
+
const horizontal = swap ? { right: left } : { left };
|
|
213
238
|
const maxHeight = window.height - topEdge - bottomEdge;
|
|
214
239
|
const timing = overlayTiming(theme, "menu");
|
|
215
240
|
const moveTo = (value, to, enter, done) => {
|
|
@@ -282,7 +307,22 @@ function IOSMenuSurface({ open, anchor, onClose, align = "start", width, check =
|
|
|
282
307
|
const subTop = sub == null || subHeight == null
|
|
283
308
|
? -window.height - 1000
|
|
284
309
|
: Math.max(topEdge, Math.min(sub.y - gutter, window.height - bottomEdge - subHeight));
|
|
285
|
-
return (_jsx(Overlay, { open: open, onDismiss: onClose, motion: "menu", testID: testID, children: (progress, opening) => (_jsxs(_Fragment, { children: [
|
|
310
|
+
return (_jsx(Overlay, { open: open, onDismiss: onClose, motion: "menu", testID: testID, children: (progress, opening) => (_jsxs(_Fragment, { children: [context ? (_jsxs(_Fragment, { children: [_jsx(Animated.View, { pointerEvents: "none", style: [
|
|
311
|
+
StyleSheet.absoluteFill,
|
|
312
|
+
{ backgroundColor: theme.color("--context-menu-dimming-background", theme.scheme === "dark" ? "rgba(0, 0, 0, 0.5)" : "rgba(0, 0, 0, 0.2)"), opacity: progress },
|
|
313
|
+
web ? { backdropFilter: "blur(30px)", WebkitBackdropFilter: "blur(30px)" } : null,
|
|
314
|
+
] }), _jsx(View, { pointerEvents: "none", style: [
|
|
315
|
+
styles.preview,
|
|
316
|
+
swap ? { right: box.x } : { left: box.x },
|
|
317
|
+
{
|
|
318
|
+
top: previewTop,
|
|
319
|
+
width: box.width,
|
|
320
|
+
height: box.height,
|
|
321
|
+
borderRadius: context.radius,
|
|
322
|
+
backgroundColor: theme.colors.groupedSurface,
|
|
323
|
+
boxShadow: String(theme.token("--context-menu-preview-shadow") ?? "0 0 32px rgba(0, 0, 0, 0.2)"),
|
|
324
|
+
},
|
|
325
|
+
], children: context.preview })] })) : null, _jsx(Animated.View, { ref: panel, ...(web ? { tabIndex: -1 } : null), accessibilityRole: "menu", "aria-label": ariaLabel, ...keysOf(panel), onLayout: (event) => setSize({ width: event.nativeEvent.layout.width, height: event.nativeEvent.layout.height }), style: [
|
|
286
326
|
styles.surface,
|
|
287
327
|
horizontal,
|
|
288
328
|
{
|
|
@@ -730,7 +770,7 @@ const focusVisible = (node) => {
|
|
|
730
770
|
function PopupCheck({ color }) {
|
|
731
771
|
return (_jsx(Svg, { width: 26, height: 26, viewBox: "0 0 26 26", children: _jsx(Path, { d: "M7.54 13.04 L11.5 17 L20.41 8.09", stroke: color, strokeWidth: 1.9, strokeLinecap: "round", strokeLinejoin: "round", fill: "none" }) }));
|
|
732
772
|
}
|
|
733
|
-
function MenuItem(props) {
|
|
773
|
+
export function MenuItem(props) {
|
|
734
774
|
return _jsx(MenuRow, { ...props });
|
|
735
775
|
}
|
|
736
776
|
MenuItem.displayName = "Menu.Item";
|
|
@@ -850,7 +890,7 @@ MenuSubTrigger.displayName = "Menu.SubTrigger";
|
|
|
850
890
|
/** The items of a submenu; they show in the menu's panel once its trigger is pressed. */
|
|
851
891
|
const MenuSubContent = () => null;
|
|
852
892
|
MenuSubContent.displayName = "Menu.SubContent";
|
|
853
|
-
function MenuSeparator() {
|
|
893
|
+
export function MenuSeparator() {
|
|
854
894
|
const theme = useTheme();
|
|
855
895
|
const surface = useContext(SurfaceContext);
|
|
856
896
|
// Android parts a popup's groups with an 8dp band: a light gray (#F5F5F5, #262626 at night) in a row's menu, the text
|
|
@@ -870,7 +910,7 @@ function MenuSeparator() {
|
|
|
870
910
|
}
|
|
871
911
|
MenuSeparator.displayName = "Menu.Separator";
|
|
872
912
|
/** A heading over a group of items. */
|
|
873
|
-
function MenuLabel({ children }) {
|
|
913
|
+
export function MenuLabel({ children }) {
|
|
874
914
|
const theme = useTheme();
|
|
875
915
|
const surface = useContext(SurfaceContext);
|
|
876
916
|
if (theme.isAndroid) {
|
|
@@ -905,6 +945,7 @@ export const Menu = Object.assign(MenuRoot, {
|
|
|
905
945
|
SubContent: MenuSubContent,
|
|
906
946
|
});
|
|
907
947
|
const styles = StyleSheet.create({
|
|
948
|
+
preview: { position: "absolute", overflow: "hidden" },
|
|
908
949
|
trigger: { alignSelf: "flex-start" },
|
|
909
950
|
surface: { position: "absolute", outlineWidth: 0, outlineStyle: "none" },
|
|
910
951
|
shrink: { flexShrink: 1 },
|
|
@@ -98,6 +98,26 @@ function ToolbarGroup({ children, style, ...rest }) {
|
|
|
98
98
|
], children: children }) }));
|
|
99
99
|
}
|
|
100
100
|
ToolbarGroup.displayName = "Toolbar.Group";
|
|
101
|
+
/**
|
|
102
|
+
* A text in the bar that is not a button: a step of a flow, a count, a status. On iOS it stands in a capsule of the
|
|
103
|
+
* bar's glass as a button would, as SwiftUI draws a Text in a toolbar (iOS 27.2 ref-app tb-status: 48pt in a bottom bar,
|
|
104
|
+
* 15pt Semibold, 8pt from its ends); on Android it is the bar's plain text, 14sp Medium. Read as text, not a control.
|
|
105
|
+
*/
|
|
106
|
+
function ToolbarLabel({ children, style, ...rest }) {
|
|
107
|
+
const theme = useTheme();
|
|
108
|
+
const item = useContext(BarItemContext);
|
|
109
|
+
const text = (_jsx(Text, { weight: theme.isAndroid ? "medium" : "semibold", tabularNums: true, numberOfLines: 1, style: theme.isAndroid ? { fontSize: 14, lineHeight: 20 } : { fontSize: theme.length("--toolbar-status-font-size", 15), lineHeight: theme.length("--toolbar-status-line-height", 20) }, children: children }));
|
|
110
|
+
if (theme.isAndroid || !item || item.inGroup) {
|
|
111
|
+
return (_jsx(View, { ...rest, style: [styles.slot, styles.label, item ? { minHeight: item.height, paddingHorizontal: theme.isAndroid ? 8 : 0 } : null, style], children: text }));
|
|
112
|
+
}
|
|
113
|
+
return (_jsx(Glass, { ...rest, elevation: item.raised ? "raised" : "regular", radius: item.height / 2, style: [
|
|
114
|
+
styles.slot,
|
|
115
|
+
styles.label,
|
|
116
|
+
{ height: item.height, minWidth: item.height, paddingHorizontal: theme.length("--toolbar-status-padding", 8) },
|
|
117
|
+
style,
|
|
118
|
+
], children: text }));
|
|
119
|
+
}
|
|
120
|
+
ToolbarLabel.displayName = "Toolbar.Label";
|
|
101
121
|
/** The title of the bar, and an optional subtitle under it. Announced as a header. */
|
|
102
122
|
function ToolbarTitle(_) {
|
|
103
123
|
// Drawn by Toolbar, which knows the title style
|
|
@@ -386,11 +406,13 @@ export const Toolbar = Object.assign(ToolbarRoot, {
|
|
|
386
406
|
Group: ToolbarGroup,
|
|
387
407
|
Trailing: ToolbarTrailing,
|
|
388
408
|
Row: ToolbarRow,
|
|
409
|
+
Label: ToolbarLabel,
|
|
389
410
|
});
|
|
390
411
|
const styles = StyleSheet.create({
|
|
391
412
|
titleImage: { flexDirection: "row", alignItems: "center" },
|
|
392
413
|
slot: { flexDirection: "row", alignItems: "center" },
|
|
393
414
|
trailing: { justifyContent: "flex-end" },
|
|
415
|
+
label: { justifyContent: "center" },
|
|
394
416
|
content: { justifyContent: "center" },
|
|
395
417
|
// A filling content stretches its control across (a search field, a block button), as a column would
|
|
396
418
|
fill: { flex: 1, flexDirection: "column", alignItems: "stretch" },
|
package/dist/es/index.js
CHANGED
|
@@ -25,6 +25,7 @@ export { TagInput } from "./components/TagInput/TagInput";
|
|
|
25
25
|
export { OTPInput } from "./components/OTPInput/OTPInput";
|
|
26
26
|
export { Select } from "./components/Select/Select";
|
|
27
27
|
export { Menu } from "./components/Menu/Menu";
|
|
28
|
+
export { ContextMenu } from "./components/ContextMenu/ContextMenu";
|
|
28
29
|
export { ActionSheet } from "./components/ActionSheet/ActionSheet";
|
|
29
30
|
export { BottomSheet } from "./components/BottomSheet/BottomSheet";
|
|
30
31
|
export { Dialog } from "./components/Dialog/Dialog";
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import { type StyleProp, type ViewStyle } from "react-native";
|
|
3
3
|
export type BottomActionsProps = {
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* The screen's main action, a Button, and an optional second Button under it ("Not now", "Skip"). A second Button
|
|
6
|
+
* with no `variant` of its own takes the platform's: on iOS 26 a glass capsule of the same size, as Apple's
|
|
7
|
+
* step-by-step sheets set "Skip"; on Android a ghost button.
|
|
8
|
+
*/
|
|
5
9
|
children: ReactNode;
|
|
6
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Puts the actions over the content (a scroll view under them), over a soft edge as a bottom Toolbar draws: on iOS
|
|
12
|
+
* the screen's color fading in over 27pt above the actions, over a light blur; on Android the screen's color fading
|
|
13
|
+
* in. Off, they take their room at the end of the screen. @default false
|
|
14
|
+
*/
|
|
7
15
|
floating?: boolean;
|
|
16
|
+
/** The color the floating edge fades into: the screen's (a grouped screen's gray). @default the theme's background */
|
|
17
|
+
canvasColor?: string;
|
|
8
18
|
testID?: string;
|
|
9
19
|
style?: StyleProp<ViewStyle>;
|
|
10
20
|
};
|
|
@@ -15,4 +25,4 @@ export type BottomActionsProps = {
|
|
|
15
25
|
* action stands under it, 8 apart. Android: the Plex Android look's 48dp full-width button, 16dp from the sides and
|
|
16
26
|
* 16 above the gesture bar. Each Button inside is a block of the size `3xl` unless it sets its own.
|
|
17
27
|
*/
|
|
18
|
-
export declare function BottomActions({ children, floating, testID, style }: BottomActionsProps): import("react").JSX.Element;
|
|
28
|
+
export declare function BottomActions({ children, floating, canvasColor, testID, style }: BottomActionsProps): import("react").JSX.Element;
|