@plexui/react-native 0.2.7 → 0.2.8
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/ActionSheet/ActionSheet.js +2 -1
- package/dist/es/components/Alert/Alert.js +2 -1
- package/dist/es/components/Avatar/Avatar.js +2 -1
- package/dist/es/components/Badge/Badge.js +2 -1
- package/dist/es/components/BottomActions/BottomActions.js +3 -3
- package/dist/es/components/BottomSheet/BottomSheet.js +2 -1
- package/dist/es/components/Button/Button.js +2 -1
- package/dist/es/components/Card/Card.js +2 -1
- package/dist/es/components/Checkbox/Checkbox.js +2 -1
- package/dist/es/components/Chip/Chip.js +2 -1
- package/dist/es/components/DatePicker/Calendar.js +2 -1
- package/dist/es/components/DatePicker/DatePicker.js +2 -1
- package/dist/es/components/DatePicker/TimeDial.js +2 -1
- package/dist/es/components/DatePicker/Wheel.js +2 -1
- package/dist/es/components/Dialog/Dialog.js +2 -1
- package/dist/es/components/Input/Input.js +2 -1
- package/dist/es/components/InputGroup/InputGroup.js +2 -1
- package/dist/es/components/List/List.js +31 -8
- package/dist/es/components/Menu/Menu.js +2 -1
- package/dist/es/components/RadioGroup/RadioGroup.js +2 -1
- package/dist/es/components/SegmentedControl/SegmentedControl.js +52 -54
- package/dist/es/components/Select/Select.js +2 -1
- package/dist/es/components/Stepper/Stepper.js +2 -1
- package/dist/es/components/Switch/Switch.js +2 -1
- package/dist/es/components/TabBar/TabBar.js +2 -1
- package/dist/es/components/TagInput/TagInput.js +2 -1
- package/dist/es/components/Tip/Tip.js +2 -1
- package/dist/es/components/Toast/Toast.js +2 -1
- package/dist/es/internal/Pressable.js +10 -0
- package/dist/es/theme/material.js +11 -2
- package/dist/types/components/BottomActions/BottomActions.d.ts +10 -1
- package/dist/types/components/SegmentedControl/SegmentedControl.d.ts +11 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/internal/Pressable.d.ts +3 -0
- package/package.json +1 -1
- package/src/components/ActionSheet/ActionSheet.tsx +2 -1
- package/src/components/Alert/Alert.tsx +2 -1
- package/src/components/Avatar/Avatar.tsx +2 -1
- package/src/components/Badge/Badge.tsx +2 -1
- package/src/components/BottomActions/BottomActions.tsx +14 -2
- package/src/components/BottomSheet/BottomSheet.tsx +2 -1
- package/src/components/Button/Button.tsx +2 -13
- package/src/components/Card/Card.tsx +2 -1
- package/src/components/Checkbox/Checkbox.tsx +2 -1
- package/src/components/Chip/Chip.tsx +2 -1
- package/src/components/DatePicker/Calendar.tsx +2 -1
- package/src/components/DatePicker/DatePicker.tsx +2 -1
- package/src/components/DatePicker/TimeDial.tsx +2 -1
- package/src/components/DatePicker/Wheel.tsx +2 -1
- package/src/components/Dialog/Dialog.tsx +2 -1
- package/src/components/Input/Input.tsx +2 -17
- package/src/components/InputGroup/InputGroup.tsx +2 -1
- package/src/components/List/List.tsx +39 -9
- package/src/components/Menu/Menu.tsx +2 -1
- package/src/components/RadioGroup/RadioGroup.tsx +2 -1
- package/src/components/SegmentedControl/SegmentedControl.tsx +68 -48
- package/src/components/Select/Select.tsx +2 -1
- package/src/components/Stepper/Stepper.tsx +2 -1
- package/src/components/Switch/Switch.tsx +2 -1
- package/src/components/TabBar/TabBar.tsx +2 -13
- package/src/components/TagInput/TagInput.tsx +2 -1
- package/src/components/Tip/Tip.tsx +2 -1
- package/src/components/Toast/Toast.tsx +2 -1
- package/src/index.ts +1 -1
- package/src/internal/Pressable.tsx +17 -0
- package/src/theme/material.ts +9 -2
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import { type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
+
/** What stands between floating actions and the content under them */
|
|
4
|
+
export type BottomActionsBackground = "soft" | "fade";
|
|
3
5
|
export type BottomActionsProps = {
|
|
4
6
|
/**
|
|
5
7
|
* The screen's main action, a Button, and an optional second Button under it ("Not now", "Skip"). A second Button
|
|
@@ -13,6 +15,13 @@ export type BottomActionsProps = {
|
|
|
13
15
|
* in. Off, they take their room at the end of the screen. @default false
|
|
14
16
|
*/
|
|
15
17
|
floating?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The edge under floating actions. `soft`: the screen's color in over 27pt above the actions, over a light blur.
|
|
20
|
+
* `fade`: TabBar's fade, the content running on under the actions, crisp: from the top action's top the screen's
|
|
21
|
+
* color comes in over 60pt to 85% and holds to the screen's edge; no blur. Android draws its soft edge for both, as
|
|
22
|
+
* TabBar does. @default "soft"
|
|
23
|
+
*/
|
|
24
|
+
background?: BottomActionsBackground;
|
|
16
25
|
/** The color the floating edge fades into: the screen's (a grouped screen's gray). @default the theme's background */
|
|
17
26
|
canvasColor?: string;
|
|
18
27
|
testID?: string;
|
|
@@ -25,4 +34,4 @@ export type BottomActionsProps = {
|
|
|
25
34
|
* action stands under it, 8 apart. Android: the Plex Android look's 48dp full-width button, 16dp from the sides and
|
|
26
35
|
* 16 above the gesture bar. Each Button inside is a block of the size `3xl` unless it sets its own.
|
|
27
36
|
*/
|
|
28
|
-
export declare function BottomActions({ children, floating, canvasColor, testID, style }: BottomActionsProps): import("react").JSX.Element;
|
|
37
|
+
export declare function BottomActions({ children, floating, background, canvasColor, testID, style }: BottomActionsProps): import("react").JSX.Element;
|
|
@@ -34,6 +34,12 @@ export type SegmentedControlProps<T extends string> = {
|
|
|
34
34
|
* @default "equal"
|
|
35
35
|
*/
|
|
36
36
|
mobileSegmentWidth?: "equal" | "content";
|
|
37
|
+
/**
|
|
38
|
+
* Draws each tab's `badge`: a count in a small capsule after its label, as a messenger's folder tabs set their
|
|
39
|
+
* unread counts; each segment then takes its own width (`mobileSegmentWidth` content), 10 beside its label and
|
|
40
|
+
* count. Off, the count is only read with the segment's name, as the native controls draw none. @default false
|
|
41
|
+
*/
|
|
42
|
+
showBadges?: boolean;
|
|
37
43
|
style?: StyleProp<ViewStyle>;
|
|
38
44
|
testID?: string;
|
|
39
45
|
/** `SegmentedControl.Tab` elements. */
|
|
@@ -50,7 +56,10 @@ export type SegmentedControlOptionProps = {
|
|
|
50
56
|
children?: ReactNode;
|
|
51
57
|
/** A symbol before the label; with a label, iOS shows the symbol alone, as UISegmentedControl. */
|
|
52
58
|
icon?: ReactNode;
|
|
53
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* A count. Read with the segment's name; drawn only with the control's `showBadges`, as the native controls (iOS and
|
|
61
|
+
* Material alike) draw none.
|
|
62
|
+
*/
|
|
54
63
|
badge?: SegmentedControlBadgeProp;
|
|
55
64
|
disabled?: boolean;
|
|
56
65
|
testID?: string;
|
|
@@ -69,7 +78,7 @@ declare namespace SegmentedControlTab {
|
|
|
69
78
|
* iOS 26 apps (48pt; 40 in a Toolbar.Row), its thumb sliding to the selection; on Android a segmented capsule, white
|
|
70
79
|
* with a sliding pill of the accent. Props follow @plexui/ui (`SegmentedControl` and `SegmentedControl.Tab`).
|
|
71
80
|
*/
|
|
72
|
-
declare function SegmentedControlRoot<T extends string>({ value, onChange, onClick, "aria-label": ariaLabel, size, disabled, block, mobileMaterial, mobileSegmentWidth, style, testID, children, }: SegmentedControlProps<T>): import("react").JSX.Element;
|
|
81
|
+
declare function SegmentedControlRoot<T extends string>({ value, onChange, onClick, "aria-label": ariaLabel, size, disabled, block, mobileMaterial, mobileSegmentWidth, showBadges, style, testID, children, }: SegmentedControlProps<T>): import("react").JSX.Element;
|
|
73
82
|
declare namespace SegmentedControlRoot {
|
|
74
83
|
var displayName: string;
|
|
75
84
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export { Dialog, type DialogAction, type DialogProps } from "./components/Dialog
|
|
|
33
33
|
export { Toaster, toast, type ToasterProps, type ToastId, type ToastOptions, type ToastT, type ToastType } from "./components/Toast/Toast";
|
|
34
34
|
export { Avatar, AvatarGroup, type AvatarColor, type AvatarGroupProps, type AvatarProps, type AvatarVariant } from "./components/Avatar/Avatar";
|
|
35
35
|
export { Badge, type BadgeColor, type BadgeProps, type BadgeSize, type BadgeVariant } from "./components/Badge/Badge";
|
|
36
|
-
export { BottomActions, type BottomActionsProps } from "./components/BottomActions/BottomActions";
|
|
36
|
+
export { BottomActions, type BottomActionsBackground, type BottomActionsProps } from "./components/BottomActions/BottomActions";
|
|
37
37
|
export { Card, cardColors, type CardColor, type CardMediaProps, type CardProps, type CardSize, type CardVariant } from "./components/Card/Card";
|
|
38
38
|
export { List, ListItem, type ListItemProps, type ListProps } from "./components/List/List";
|
|
39
39
|
export { Chip, type ChipProps } from "./components/Chip/Chip";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type PressableProps } from "react-native";
|
|
2
|
+
/** react-native's Pressable that selects no text on the web; every pressable control of the kit is drawn with it. */
|
|
3
|
+
export declare const Pressable: import("react").ForwardRefExoticComponent<PressableProps & import("react").RefAttributes<import("react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeElement").default>>;
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useId, useRef, useState, type ReactNode, type RefObject } from "react"
|
|
2
|
-
import { Animated, Platform,
|
|
2
|
+
import { Animated, Platform, ScrollView, StyleSheet, View, useWindowDimensions } from "react-native"
|
|
3
|
+
import { Pressable } from "../../internal/Pressable"
|
|
3
4
|
import { useSafeAreaInsets } from "react-native-safe-area-context"
|
|
4
5
|
import { FloatingPanel } from "../../internal/FloatingPanel"
|
|
5
6
|
import { Glass } from "../../internal/Glass"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { cloneElement, isValidElement, useState, type ReactElement, type ReactNode } from "react"
|
|
2
|
-
import {
|
|
2
|
+
import { StyleSheet, View, type StyleProp, type ViewStyle } from "react-native"
|
|
3
|
+
import { Pressable } from "../../internal/Pressable"
|
|
3
4
|
import CheckCircle from "../../icons/plex/CheckCircle"
|
|
4
5
|
import InfoCircle from "../../icons/plex/InfoCircle"
|
|
5
6
|
import Warning from "../../icons/plex/Warning"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Children, isValidElement, useId, useState, type ComponentType, type ReactNode } from "react"
|
|
2
|
-
import { Animated, Easing, Platform,
|
|
2
|
+
import { Animated, Easing, Platform, StyleSheet, View, type ImageSourcePropType, type StyleProp, type ViewStyle } from "react-native"
|
|
3
|
+
import { Pressable } from "../../internal/Pressable"
|
|
3
4
|
import Svg, { Circle, Defs, LinearGradient, Stop } from "react-native-svg"
|
|
4
5
|
import { useTheme } from "../../theme/ThemeProvider"
|
|
5
6
|
import type { Theme } from "../../theme/types"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useLayoutEffect, useRef, useState, type ReactNode } from "react"
|
|
2
|
-
import { Animated,
|
|
2
|
+
import { Animated, StyleSheet, Text as NativeText, View, type LayoutChangeEvent, type StyleProp, type ViewStyle } from "react-native"
|
|
3
|
+
import { Pressable } from "../../internal/Pressable"
|
|
3
4
|
import CloseBold from "../../icons/plex/CloseBold"
|
|
4
5
|
import { flattenChildren } from "../../internal/children"
|
|
5
6
|
import { curves } from "../../internal/motion"
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { Children, cloneElement, isValidElement, type ReactElement, type ReactNode } from "react"
|
|
2
2
|
import { StyleSheet, View, type StyleProp, type ViewStyle } from "react-native"
|
|
3
3
|
import { useSafeAreaInsets } from "react-native-safe-area-context"
|
|
4
|
-
import { ANDROID_FADE_ALPHA, ANDROID_FADE_STOPS, SoftBottomEdge } from "../../internal/BarBackdrop"
|
|
4
|
+
import { ANDROID_FADE_ALPHA, ANDROID_FADE_STOPS, SoftBottomEdge, TabBarFade } from "../../internal/BarBackdrop"
|
|
5
5
|
import { withAlpha } from "../../theme/material"
|
|
6
6
|
import { useTheme } from "../../theme/ThemeProvider"
|
|
7
7
|
import { Button, type ButtonProps } from "../Button/Button"
|
|
8
8
|
|
|
9
|
+
/** What stands between floating actions and the content under them */
|
|
10
|
+
export type BottomActionsBackground = "soft" | "fade"
|
|
11
|
+
|
|
9
12
|
export type BottomActionsProps = {
|
|
10
13
|
/**
|
|
11
14
|
* The screen's main action, a Button, and an optional second Button under it ("Not now", "Skip"). A second Button
|
|
@@ -19,6 +22,13 @@ export type BottomActionsProps = {
|
|
|
19
22
|
* in. Off, they take their room at the end of the screen. @default false
|
|
20
23
|
*/
|
|
21
24
|
floating?: boolean
|
|
25
|
+
/**
|
|
26
|
+
* The edge under floating actions. `soft`: the screen's color in over 27pt above the actions, over a light blur.
|
|
27
|
+
* `fade`: TabBar's fade, the content running on under the actions, crisp: from the top action's top the screen's
|
|
28
|
+
* color comes in over 60pt to 85% and holds to the screen's edge; no blur. Android draws its soft edge for both, as
|
|
29
|
+
* TabBar does. @default "soft"
|
|
30
|
+
*/
|
|
31
|
+
background?: BottomActionsBackground
|
|
22
32
|
/** The color the floating edge fades into: the screen's (a grouped screen's gray). @default the theme's background */
|
|
23
33
|
canvasColor?: string
|
|
24
34
|
testID?: string
|
|
@@ -32,7 +42,7 @@ export type BottomActionsProps = {
|
|
|
32
42
|
* action stands under it, 8 apart. Android: the Plex Android look's 48dp full-width button, 16dp from the sides and
|
|
33
43
|
* 16 above the gesture bar. Each Button inside is a block of the size `3xl` unless it sets its own.
|
|
34
44
|
*/
|
|
35
|
-
export function BottomActions({ children, floating = false, canvasColor, testID, style }: BottomActionsProps) {
|
|
45
|
+
export function BottomActions({ children, floating = false, background = "soft", canvasColor, testID, style }: BottomActionsProps) {
|
|
36
46
|
const theme = useTheme()
|
|
37
47
|
const insets = useSafeAreaInsets()
|
|
38
48
|
const android = theme.isAndroid
|
|
@@ -68,6 +78,8 @@ export function BottomActions({ children, floating = false, canvasColor, testID,
|
|
|
68
78
|
{floating ? (
|
|
69
79
|
android ? (
|
|
70
80
|
<SoftBottomEdge fill={withAlpha(canvas, ANDROID_FADE_ALPHA)} top={paddingTop - 13 + 60} tail={60} blur={0} stops={ANDROID_FADE_STOPS} />
|
|
81
|
+
) : background === "fade" ? (
|
|
82
|
+
<TabBarFade fill={canvas} top={paddingTop} />
|
|
71
83
|
) : (
|
|
72
84
|
<SoftBottomEdge fill={canvas} top={paddingTop} tail={27} blur={theme.length("--toolbar-edge-blur-small", 3)} />
|
|
73
85
|
)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isValidElement, useId, useLayoutEffect, useMemo, useState, type ReactNode } from "react"
|
|
2
|
-
import { Animated, Easing, PanResponder, Platform,
|
|
2
|
+
import { Animated, Easing, PanResponder, Platform, ScrollView, StyleSheet, View, useWindowDimensions, type LayoutChangeEvent, type NativeScrollEvent, type NativeSyntheticEvent, type StyleProp, type ViewStyle } from "react-native"
|
|
3
|
+
import { Pressable } from "../../internal/Pressable"
|
|
3
4
|
import { useSafeAreaInsets } from "react-native-safe-area-context"
|
|
4
5
|
import { childrenOfType, flattenChildren } from "../../internal/children"
|
|
5
6
|
import { useKeyboardHeight } from "../../internal/keyboard"
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import { createContext, Fragment, isValidElement, useContext, useEffect, useState, type ComponentRef, type ReactNode, type Ref } from "react"
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
Animated,
|
|
5
|
-
Easing,
|
|
6
|
-
Platform,
|
|
7
|
-
Pressable,
|
|
8
|
-
StyleSheet,
|
|
9
|
-
View,
|
|
10
|
-
type GestureResponderEvent,
|
|
11
|
-
type PressableProps,
|
|
12
|
-
type StyleProp,
|
|
13
|
-
type ViewStyle,
|
|
14
|
-
} from "react-native"
|
|
2
|
+
import { ActivityIndicator, Animated, Easing, Platform, StyleSheet, View, type GestureResponderEvent, type PressableProps, type StyleProp, type ViewStyle } from "react-native"
|
|
3
|
+
import { Pressable } from "../../internal/Pressable"
|
|
15
4
|
import Svg, { Circle } from "react-native-svg"
|
|
16
5
|
import { flattenChildren } from "../../internal/children"
|
|
17
6
|
import { Glass } from "../../internal/Glass"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { cloneElement, createContext, isValidElement, useContext, type ReactElement, type ReactNode } from "react"
|
|
2
|
-
import { Image, Platform,
|
|
2
|
+
import { Image, Platform, StyleSheet, View, type ImageSourcePropType, type StyleProp, type ViewStyle } from "react-native"
|
|
3
|
+
import { Pressable } from "../../internal/Pressable"
|
|
3
4
|
import { flattenChildren } from "../../internal/children"
|
|
4
5
|
import { space } from "../../internal/spacing"
|
|
5
6
|
import { controlHighlight, withAlpha } from "../../theme/material"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useContext, useEffect, useState, type ReactNode } from "react"
|
|
2
|
-
import { Animated, Easing,
|
|
2
|
+
import { Animated, Easing, StyleSheet, View, type StyleProp, type ViewStyle } from "react-native"
|
|
3
|
+
import { Pressable } from "../../internal/Pressable"
|
|
3
4
|
import Svg, { Path } from "react-native-svg"
|
|
4
5
|
import CheckMd from "../../icons/plex/CheckMd"
|
|
5
6
|
import Minus from "../../icons/plex/Minus"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEffect, useState, type ReactNode } from "react"
|
|
2
|
-
import { Animated, Easing, Platform,
|
|
2
|
+
import { Animated, Easing, Platform, StyleSheet, View, type StyleProp, type ViewStyle } from "react-native"
|
|
3
|
+
import { Pressable } from "../../internal/Pressable"
|
|
3
4
|
import ChevronDownSm from "../../icons/plex/ChevronDownSm"
|
|
4
5
|
import CloseBold from "../../icons/plex/CloseBold"
|
|
5
6
|
import XCircleFilled from "../../icons/plex/XCircleFilled"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useMemo, useState } from "react"
|
|
2
|
-
import { Platform,
|
|
2
|
+
import { Platform, StyleSheet, View } from "react-native"
|
|
3
|
+
import { Pressable } from "../../internal/Pressable"
|
|
3
4
|
import ChevronLeftLg from "../../icons/plex/ChevronLeftLg"
|
|
4
5
|
import ChevronRightLg from "../../icons/plex/ChevronRightLg"
|
|
5
6
|
import { isRTL } from "../../internal/direction"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useContext, useEffect, useRef, useState, type ReactNode } from "react"
|
|
2
|
-
import {
|
|
2
|
+
import { StyleSheet, View, useWindowDimensions, type StyleProp, type ViewStyle } from "react-native"
|
|
3
|
+
import { Pressable } from "../../internal/Pressable"
|
|
3
4
|
import { RowEndContext, RowHoldContext, rowHold } from "../../internal/row"
|
|
4
5
|
import { withAlpha } from "../../theme/material"
|
|
5
6
|
import { useTheme } from "../../theme/ThemeProvider"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useRef, useState } from "react"
|
|
2
|
-
import { Platform,
|
|
2
|
+
import { Platform, StyleSheet, View, type GestureResponderEvent } from "react-native"
|
|
3
|
+
import { Pressable } from "../../internal/Pressable"
|
|
3
4
|
import Svg, { Circle, Line } from "react-native-svg"
|
|
4
5
|
import { useTheme } from "../../theme/ThemeProvider"
|
|
5
6
|
import { Text } from "../Text/Text"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from "react"
|
|
2
|
-
import { Animated, Platform,
|
|
2
|
+
import { Animated, Platform, ScrollView, StyleSheet, View, type NativeScrollEvent, type NativeSyntheticEvent } from "react-native"
|
|
3
|
+
import { Pressable } from "../../internal/Pressable"
|
|
3
4
|
import { withAlpha } from "../../theme/material"
|
|
4
5
|
import { useTheme } from "../../theme/ThemeProvider"
|
|
5
6
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useId, useState, type ReactNode } from "react"
|
|
2
|
-
import { Animated, KeyboardAvoidingView, Platform,
|
|
2
|
+
import { Animated, KeyboardAvoidingView, Platform, ScrollView, StyleSheet, View, useWindowDimensions } from "react-native"
|
|
3
|
+
import { Pressable } from "../../internal/Pressable"
|
|
3
4
|
import { useSafeAreaInsets } from "react-native-safe-area-context"
|
|
4
5
|
import { Glass } from "../../internal/Glass"
|
|
5
6
|
import { useRipple } from "../../internal/ripple"
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import { createContext, useCallback, useContext, useEffect, useRef, useState, type ComponentRef, type ReactNode, type Ref } from "react"
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
Easing,
|
|
5
|
-
PixelRatio,
|
|
6
|
-
Platform,
|
|
7
|
-
Pressable,
|
|
8
|
-
StyleSheet,
|
|
9
|
-
Text as NativeText,
|
|
10
|
-
TextInput,
|
|
11
|
-
View,
|
|
12
|
-
processColor,
|
|
13
|
-
type PressableProps,
|
|
14
|
-
type StyleProp,
|
|
15
|
-
type TextInputProps,
|
|
16
|
-
type ViewProps,
|
|
17
|
-
type ViewStyle,
|
|
18
|
-
} from "react-native"
|
|
2
|
+
import { Animated, Easing, PixelRatio, Platform, StyleSheet, Text as NativeText, TextInput, View, processColor, type PressableProps, type StyleProp, type TextInputProps, type ViewProps, type ViewStyle } from "react-native"
|
|
3
|
+
import { Pressable } from "../../internal/Pressable"
|
|
19
4
|
import XCircleFilled from "../../icons/plex/XCircleFilled"
|
|
20
5
|
import { useAndroidGlass } from "../../internal/BarBackdrop"
|
|
21
6
|
import { FieldStack, FloatLabelContext } from "../../internal/fieldStack"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createContext, isValidElement, useContext, type ReactElement, type ReactNode } from "react"
|
|
2
|
-
import {
|
|
2
|
+
import { StyleSheet, View, type StyleProp, type ViewStyle } from "react-native"
|
|
3
|
+
import { Pressable } from "../../internal/Pressable"
|
|
3
4
|
import { flattenChildren } from "../../internal/children"
|
|
4
5
|
import { RowEndContext } from "../../internal/row"
|
|
5
6
|
import { useTheme } from "../../theme/ThemeProvider"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { cloneElement, createContext, isValidElement, useCallback, useContext, useMemo, useRef, useState, type ComponentRef, type ReactElement, type ReactNode } from "react"
|
|
2
|
-
import {
|
|
1
|
+
import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useMemo, useRef, useState, type ComponentRef, type ReactElement, type ReactNode } from "react"
|
|
2
|
+
import { Animated, Easing, Platform, StyleSheet, View, type GestureResponderEvent, type LayoutChangeEvent, type StyleProp, type TextStyle, type ViewStyle } from "react-native"
|
|
3
|
+
import { Pressable } from "../../internal/Pressable"
|
|
3
4
|
import Disclosure from "../../icons/plex/Disclosure"
|
|
4
5
|
import ExclamationMarkCircle from "../../icons/plex/ExclamationMarkCircle"
|
|
5
6
|
import { spaceToggles, useDescription } from "../../internal/a11y"
|
|
@@ -417,8 +418,8 @@ export function ListItem({
|
|
|
417
418
|
const nativeRipple = theme.isAndroid && Platform.OS === "android"
|
|
418
419
|
// iOS lights a held choice row, not a switch row, as the web's phone rows
|
|
419
420
|
const lit = !switchRow && control?.kind !== "switch"
|
|
420
|
-
const row =
|
|
421
|
-
theme.isAndroid ? styles.androidRow : iosRow(theme,
|
|
421
|
+
const row =
|
|
422
|
+
theme.isAndroid ? styles.androidRow : iosRow(theme, last, description != null || error != null)
|
|
422
423
|
// A finger on the control at the end holds the row, as one on the row's text does
|
|
423
424
|
const [held, setHeld] = useState(false)
|
|
424
425
|
// Android's press is the list selector's ripple from the touch point, clipped to the row (and the card's corners):
|
|
@@ -483,11 +484,12 @@ export function ListItem({
|
|
|
483
484
|
onPressOut={drawn ? ripple.end : undefined}
|
|
484
485
|
android_ripple={nativeRipple ? { color: highlight, foreground: true } : undefined}
|
|
485
486
|
testID={testID}
|
|
486
|
-
style={
|
|
487
|
+
style={row}
|
|
487
488
|
>
|
|
488
489
|
{({ pressed }) => (
|
|
489
490
|
<RowHoldContext.Provider value={disabled ? null : theme.isAndroid ? hold : setHeld}>
|
|
490
491
|
{ripple.layer}
|
|
492
|
+
{theme.isAndroid ? null : <RowHighlight on={(pressed || held) && lit} last={last} />}
|
|
491
493
|
{content(pressed || held)}
|
|
492
494
|
</RowHoldContext.Provider>
|
|
493
495
|
)}
|
|
@@ -506,7 +508,7 @@ export function ListItem({
|
|
|
506
508
|
accessibilityLabel={accessibilityLabel}
|
|
507
509
|
accessibilityRole={named && Platform.OS !== "web" ? "text" : undefined}
|
|
508
510
|
role={named && Platform.OS === "web" ? "group" : undefined}
|
|
509
|
-
style={row
|
|
511
|
+
style={row}
|
|
510
512
|
>
|
|
511
513
|
{content(false)}
|
|
512
514
|
</View>
|
|
@@ -669,20 +671,48 @@ function endControl(found: Exclude<FoundControl, { kind: "radio" }>, own: boolea
|
|
|
669
671
|
const iosMinHeight = (theme: Theme, described: boolean) =>
|
|
670
672
|
described ? theme.length("--field-row-description-min-height", 70) : theme.length("--field-row-min-height", 52)
|
|
671
673
|
|
|
672
|
-
function iosRow(theme: Theme,
|
|
674
|
+
function iosRow(theme: Theme, last: boolean, described: boolean): ViewStyle {
|
|
673
675
|
const inset = theme.length("--list-row-inset", 20)
|
|
674
676
|
return {
|
|
675
677
|
flexDirection: "row",
|
|
676
678
|
alignItems: "center",
|
|
677
679
|
minHeight: iosMinHeight(theme, described),
|
|
678
680
|
paddingStart: inset,
|
|
679
|
-
|
|
680
|
-
// The press fills the row to the group's rounded ends
|
|
681
|
+
// The press is RowHighlight's, under the content; the row's rounded end clips it to the group's
|
|
681
682
|
borderBottomLeftRadius: last ? theme.length("--field-group-radius", 26) : 0,
|
|
682
683
|
borderBottomRightRadius: last ? theme.length("--field-group-radius", 26) : 0,
|
|
683
684
|
}
|
|
684
685
|
}
|
|
685
686
|
|
|
687
|
+
/**
|
|
688
|
+
* iOS's press on a row: the row lights at once under a finger and, when it lifts, the light fades out over 0.3s, as
|
|
689
|
+
* UIKit deselects a cell (the system gray 4 of `--field-row-press-background`); at once with reduced motion.
|
|
690
|
+
*/
|
|
691
|
+
function RowHighlight({ on, last }: { on: boolean; last: boolean }) {
|
|
692
|
+
const theme = useTheme()
|
|
693
|
+
const opacity = useRef(new Animated.Value(0)).current
|
|
694
|
+
useEffect(() => {
|
|
695
|
+
if (on || theme.reducedMotion) {
|
|
696
|
+
opacity.stopAnimation()
|
|
697
|
+
opacity.setValue(on ? 1 : 0)
|
|
698
|
+
return
|
|
699
|
+
}
|
|
700
|
+
const fade = Animated.timing(opacity, { toValue: 0, duration: 300, easing: Easing.out(Easing.quad), useNativeDriver: Platform.OS !== "web" })
|
|
701
|
+
fade.start()
|
|
702
|
+
return () => fade.stop()
|
|
703
|
+
}, [on, opacity, theme.reducedMotion])
|
|
704
|
+
const radius = last ? theme.length("--field-group-radius", 26) : 0
|
|
705
|
+
return (
|
|
706
|
+
<Animated.View
|
|
707
|
+
pointerEvents="none"
|
|
708
|
+
style={[
|
|
709
|
+
StyleSheet.absoluteFill,
|
|
710
|
+
{ opacity, backgroundColor: theme.color("--field-row-press-background"), borderBottomLeftRadius: radius, borderBottomRightRadius: radius },
|
|
711
|
+
]}
|
|
712
|
+
/>
|
|
713
|
+
)
|
|
714
|
+
}
|
|
715
|
+
|
|
686
716
|
type ContentProps = Pick<ListItemProps, "label" | "description" | "leading" | "value" | "trailing" | "error"> & {
|
|
687
717
|
theme: Theme
|
|
688
718
|
/** The end is a switch, a checkbox or a radio: with `columns` it stays at the row's edge. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Children, cloneElement, createContext, Fragment, isValidElement, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactElement, type ReactNode } from "react"
|
|
2
|
-
import { Animated, Easing, I18nManager, PanResponder, Platform,
|
|
2
|
+
import { Animated, Easing, I18nManager, PanResponder, Platform, ScrollView, StyleSheet, View, useWindowDimensions, type GestureResponderEvent, type StyleProp, type ViewStyle } from "react-native"
|
|
3
|
+
import { Pressable } from "../../internal/Pressable"
|
|
3
4
|
import { useSafeAreaInsets } from "react-native-safe-area-context"
|
|
4
5
|
import Svg, { Path } from "react-native-svg"
|
|
5
6
|
import ArrowLeftLg from "../../icons/plex/ArrowLeftLg"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createContext, useContext, useEffect, useState, type ReactNode } from "react"
|
|
2
|
-
import { Animated, Platform,
|
|
2
|
+
import { Animated, Platform, StyleSheet, View, type StyleProp, type ViewStyle } from "react-native"
|
|
3
|
+
import { Pressable } from "../../internal/Pressable"
|
|
3
4
|
import CheckMd from "../../icons/plex/CheckMd"
|
|
4
5
|
import { useDescription } from "../../internal/a11y"
|
|
5
6
|
import { ControlLabel } from "../../internal/ControlLabel"
|