@plexui/react-native 0.1.1 → 0.2.0
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/README.md +34 -0
- package/dist/es/components/ActionSheet/ActionSheet.js +53 -19
- package/dist/es/components/Alert/Alert.js +163 -0
- package/dist/es/components/Avatar/Avatar.js +20 -8
- package/dist/es/components/BottomActions/BottomActions.js +34 -0
- package/dist/es/components/BottomSheet/BottomSheet.js +85 -17
- package/dist/es/components/Button/Button.js +108 -28
- package/dist/es/components/Card/Card.js +16 -8
- package/dist/es/components/Checkbox/Checkbox.js +67 -99
- package/dist/es/components/Chip/Chip.js +16 -7
- package/dist/es/components/Dialog/Dialog.js +38 -24
- package/dist/es/components/Field/Field.js +91 -0
- package/dist/es/components/FloatingLabelInput/FloatingLabelInput.js +59 -0
- package/dist/es/components/Icon/createIcon.js +13 -2
- package/dist/es/components/Indicator/CircularProgress.js +80 -0
- package/dist/es/components/Indicator/LoadingDots.js +46 -0
- package/dist/es/components/Indicator/LoadingIndicator.js +101 -0
- package/dist/es/components/Indicator/index.js +3 -0
- package/dist/es/components/Input/Input.js +69 -60
- package/dist/es/components/InputGroup/InputGroup.js +130 -0
- package/dist/es/components/List/List.js +175 -59
- package/dist/es/components/Menu/Menu.js +69 -40
- package/dist/es/components/NavigationButton/NavigationButton.js +20 -4
- package/dist/es/components/OTPInput/OTPInput.js +9 -3
- package/dist/es/components/PageControl/PageControl.js +13 -7
- package/dist/es/components/Popover/Popover.js +128 -0
- package/dist/es/components/Progress/Progress.js +142 -0
- package/dist/es/components/ProgressSteps/ProgressSteps.js +207 -0
- package/dist/es/components/RollingNumber/RollingNumber.js +125 -0
- package/dist/es/components/Select/Select.js +97 -34
- package/dist/es/components/Separator/Separator.js +31 -0
- package/dist/es/components/ShimmerText/ShimmerText.js +98 -0
- package/dist/es/components/Stepper/Stepper.js +219 -0
- package/dist/es/components/Switch/Switch.js +26 -12
- package/dist/es/components/TagInput/TagInput.js +121 -0
- package/dist/es/components/Text/Text.js +7 -4
- package/dist/es/components/TextLink/TextLink.js +42 -0
- package/dist/es/components/Textarea/Textarea.js +12 -0
- package/dist/es/components/Tip/Tip.js +193 -0
- package/dist/es/components/Toolbar/Toolbar.js +6 -2
- package/dist/es/components/Tooltip/Tooltip.js +272 -0
- package/dist/es/index.js +20 -2
- package/dist/es/internal/FloatingPanel.js +111 -0
- package/dist/es/internal/fieldStack.js +73 -0
- package/dist/es/internal/floating.js +97 -0
- package/dist/es/internal/ripple.js +119 -0
- package/dist/es/internal/row.js +2 -1
- package/dist/es/internal/transition.js +113 -0
- package/dist/es/theme/ThemeProvider.js +41 -9
- package/dist/es/theme/material.js +37 -7
- package/dist/types/components/ActionSheet/ActionSheet.d.ts +15 -7
- package/dist/types/components/Alert/Alert.d.ts +51 -0
- package/dist/types/components/Avatar/Avatar.d.ts +4 -2
- package/dist/types/components/BottomActions/BottomActions.d.ts +18 -0
- package/dist/types/components/BottomSheet/BottomSheet.d.ts +4 -2
- package/dist/types/components/Button/Button.d.ts +20 -5
- package/dist/types/components/Card/Card.d.ts +14 -1
- package/dist/types/components/Checkbox/Checkbox.d.ts +4 -3
- package/dist/types/components/Chip/Chip.d.ts +12 -1
- package/dist/types/components/Dialog/Dialog.d.ts +9 -5
- package/dist/types/components/Field/Field.d.ts +64 -0
- package/dist/types/components/FloatingLabelInput/FloatingLabelInput.d.ts +42 -0
- package/dist/types/components/Indicator/CircularProgress.d.ts +34 -0
- package/dist/types/components/Indicator/LoadingDots.d.ts +17 -0
- package/dist/types/components/Indicator/LoadingIndicator.d.ts +46 -0
- package/dist/types/components/Indicator/index.d.ts +3 -0
- package/dist/types/components/Input/Input.d.ts +13 -3
- package/dist/types/components/InputGroup/InputGroup.d.ts +71 -0
- package/dist/types/components/List/List.d.ts +57 -14
- package/dist/types/components/Menu/Menu.d.ts +4 -0
- package/dist/types/components/NavigationButton/NavigationButton.d.ts +11 -3
- package/dist/types/components/OTPInput/OTPInput.d.ts +10 -1
- package/dist/types/components/PageControl/PageControl.d.ts +11 -1
- package/dist/types/components/Popover/Popover.d.ts +86 -0
- package/dist/types/components/Progress/Progress.d.ts +56 -0
- package/dist/types/components/ProgressSteps/ProgressSteps.d.ts +61 -0
- package/dist/types/components/RollingNumber/RollingNumber.d.ts +36 -0
- package/dist/types/components/Select/Select.d.ts +36 -8
- package/dist/types/components/Separator/Separator.d.ts +19 -0
- package/dist/types/components/ShimmerText/ShimmerText.d.ts +28 -0
- package/dist/types/components/Stepper/Stepper.d.ts +61 -0
- package/dist/types/components/Switch/Switch.d.ts +5 -5
- package/dist/types/components/TagInput/TagInput.d.ts +44 -0
- package/dist/types/components/TextLink/TextLink.d.ts +30 -0
- package/dist/types/components/Textarea/Textarea.d.ts +19 -0
- package/dist/types/components/Tip/Tip.d.ts +71 -0
- package/dist/types/components/Toolbar/Toolbar.d.ts +9 -1
- package/dist/types/components/Tooltip/Tooltip.d.ts +84 -0
- package/dist/types/index.d.ts +20 -2
- package/dist/types/internal/FloatingPanel.d.ts +70 -0
- package/dist/types/internal/fieldStack.d.ts +48 -0
- package/dist/types/internal/floating.d.ts +71 -0
- package/dist/types/internal/ripple.d.ts +17 -0
- package/dist/types/internal/row.d.ts +15 -3
- package/dist/types/internal/transition.d.ts +37 -0
- package/dist/types/theme/ThemeProvider.d.ts +28 -4
- package/dist/types/theme/material.d.ts +20 -6
- package/dist/types/theme/types.d.ts +8 -0
- package/package.json +2 -2
- package/src/components/ActionSheet/ActionSheet.tsx +107 -38
- package/src/components/Alert/Alert.tsx +279 -0
- package/src/components/Avatar/Avatar.tsx +21 -9
- package/src/components/BottomActions/BottomActions.tsx +54 -0
- package/src/components/BottomSheet/BottomSheet.tsx +111 -25
- package/src/components/Button/Button.tsx +170 -35
- package/src/components/Card/Card.tsx +33 -9
- package/src/components/Checkbox/Checkbox.tsx +89 -124
- package/src/components/Chip/Chip.tsx +49 -6
- package/src/components/Dialog/Dialog.tsx +68 -37
- package/src/components/Field/Field.tsx +227 -0
- package/src/components/FloatingLabelInput/FloatingLabelInput.tsx +144 -0
- package/src/components/Icon/createIcon.tsx +16 -6
- package/src/components/Indicator/CircularProgress.tsx +141 -0
- package/src/components/Indicator/LoadingDots.tsx +79 -0
- package/src/components/Indicator/LoadingIndicator.tsx +166 -0
- package/src/components/Indicator/index.ts +3 -0
- package/src/components/Input/Input.tsx +126 -97
- package/src/components/InputGroup/InputGroup.tsx +261 -0
- package/src/components/List/List.tsx +345 -88
- package/src/components/Menu/Menu.tsx +83 -41
- package/src/components/NavigationButton/NavigationButton.tsx +35 -5
- package/src/components/OTPInput/OTPInput.tsx +21 -2
- package/src/components/PageControl/PageControl.tsx +36 -8
- package/src/components/Popover/Popover.tsx +261 -0
- package/src/components/Progress/Progress.tsx +255 -0
- package/src/components/ProgressSteps/ProgressSteps.tsx +415 -0
- package/src/components/RollingNumber/RollingNumber.tsx +189 -0
- package/src/components/Select/Select.tsx +175 -71
- package/src/components/Separator/Separator.tsx +51 -0
- package/src/components/ShimmerText/ShimmerText.tsx +144 -0
- package/src/components/Stepper/Stepper.tsx +386 -0
- package/src/components/Switch/Switch.tsx +26 -12
- package/src/components/TagInput/TagInput.tsx +227 -0
- package/src/components/Text/Text.tsx +8 -4
- package/src/components/TextLink/TextLink.tsx +77 -0
- package/src/components/Textarea/Textarea.tsx +23 -0
- package/src/components/Tip/Tip.tsx +410 -0
- package/src/components/Toolbar/Toolbar.tsx +27 -2
- package/src/components/Tooltip/Tooltip.tsx +478 -0
- package/src/index.ts +36 -2
- package/src/internal/FloatingPanel.tsx +199 -0
- package/src/internal/fieldStack.tsx +179 -0
- package/src/internal/floating.ts +131 -0
- package/src/internal/ripple.tsx +132 -0
- package/src/internal/row.ts +16 -3
- package/src/internal/transition.ts +124 -0
- package/src/theme/ThemeProvider.tsx +65 -15
- package/src/theme/material.ts +39 -7
- package/src/theme/types.ts +8 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
2
|
+
import { type GestureResponderEvent, type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
+
import { type CollisionPadding } from "../../internal/FloatingPanel";
|
|
4
|
+
import { type FloatingAlign, type FloatingSide } from "../../internal/floating";
|
|
5
|
+
export type PopoverProps = {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/** Controlled open state; uncontrolled when omitted. */
|
|
8
|
+
open?: boolean;
|
|
9
|
+
/** Called when the popover opens or closes. */
|
|
10
|
+
onOpenChange?: (open: boolean) => void;
|
|
11
|
+
};
|
|
12
|
+
export type PopoverController = {
|
|
13
|
+
/** Closes the popover. */
|
|
14
|
+
close: () => void;
|
|
15
|
+
/** Shakes the panel side to side, as a form that cannot be sent yet. */
|
|
16
|
+
shake: () => void;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A floating panel for contextual UI at its trigger, as @plexui/ui's Popover on a phone: a tap on the trigger opens it,
|
|
20
|
+
* a tap anywhere else closes it. On iOS it is the compact glass panel an iPhone presents a popover as (the menus'
|
|
21
|
+
* glass, `--popover-radius` 34, `--menu-shadow`), placed under its trigger and centered by default; on Android a
|
|
22
|
+
* popup of the Plex Android look (its surface, 12dp corners, level 2 shadow) that pops from the trigger. Parts:
|
|
23
|
+
* `Popover.Trigger` and `Popover.Content`; `usePopoverController()` inside the content closes or shakes it.
|
|
24
|
+
*/
|
|
25
|
+
export declare function Popover({ children, open: openProp, onOpenChange }: PopoverProps): import("react").JSX.Element;
|
|
26
|
+
export declare namespace Popover {
|
|
27
|
+
var displayName: string;
|
|
28
|
+
var Trigger: typeof PopoverTrigger;
|
|
29
|
+
var Content: typeof PopoverContent;
|
|
30
|
+
}
|
|
31
|
+
type TriggerChildProps = {
|
|
32
|
+
onPress?: (event: GestureResponderEvent) => void;
|
|
33
|
+
ref?: unknown;
|
|
34
|
+
onLayout?: (event: never) => void;
|
|
35
|
+
};
|
|
36
|
+
export type PopoverTriggerProps = {
|
|
37
|
+
/**
|
|
38
|
+
* The element that toggles the popover: a Button or anything with `onPress` that hands its native view to `ref`
|
|
39
|
+
* (Pressable, View, Text). It keeps its own place in the layout; the panel stands at it.
|
|
40
|
+
*/
|
|
41
|
+
children: ReactElement<TriggerChildProps>;
|
|
42
|
+
};
|
|
43
|
+
/** The element that toggles the popover; the panel opens at it, and follows it when it moves. */
|
|
44
|
+
declare function PopoverTrigger({ children }: PopoverTriggerProps): ReactElement<TriggerChildProps, string | import("react").JSXElementConstructor<any>>;
|
|
45
|
+
declare namespace PopoverTrigger {
|
|
46
|
+
var displayName: string;
|
|
47
|
+
}
|
|
48
|
+
export type PopoverContentProps = {
|
|
49
|
+
children: ReactNode;
|
|
50
|
+
/** The panel's width; `"auto"` fits its content between `minWidth` and `maxWidth`. @default "auto" */
|
|
51
|
+
width?: number | "auto";
|
|
52
|
+
/** @default 300 */
|
|
53
|
+
minWidth?: number | "auto";
|
|
54
|
+
/** Capped by the room inside the window. @default 700 */
|
|
55
|
+
maxWidth?: number;
|
|
56
|
+
/** The side of the trigger; it turns when it does not fit. @default "bottom" */
|
|
57
|
+
side?: FloatingSide;
|
|
58
|
+
/** @default "center" */
|
|
59
|
+
align?: FloatingAlign;
|
|
60
|
+
/** From the trigger's edge, negative to overlap it. @default 8 */
|
|
61
|
+
sideOffset?: number;
|
|
62
|
+
/** From the start or end alignment. @default -5 for `start` and `end`, 0 for `center` */
|
|
63
|
+
alignOffset?: number;
|
|
64
|
+
/** Turns and moves to stay inside the window. @default true */
|
|
65
|
+
avoidCollisions?: boolean;
|
|
66
|
+
/** Kept free at the window's edges (the safe area at least); an object leaves 0 at a side it does not name. @default 20 */
|
|
67
|
+
collisionPadding?: CollisionPadding;
|
|
68
|
+
/** A translucent, blurred surface (a light frosted gradient) in place of the glass, with its own shadow. iOS and the web. @default false */
|
|
69
|
+
translucent?: boolean;
|
|
70
|
+
/** Moves focus to the panel as it opens (the web). @default true */
|
|
71
|
+
autoFocus?: boolean;
|
|
72
|
+
/** The id of the element that names the panel (the web). */
|
|
73
|
+
"aria-labelledby"?: string;
|
|
74
|
+
"aria-label"?: string;
|
|
75
|
+
testID?: string;
|
|
76
|
+
/** The panel's own style (padding, a fixed height). */
|
|
77
|
+
style?: StyleProp<ViewStyle>;
|
|
78
|
+
};
|
|
79
|
+
/** The panel: on iOS the glass of an iPhone popover, on Android the popup surface of the Plex Android look. */
|
|
80
|
+
declare function PopoverContent({ children, width, minWidth, maxWidth, side, align, sideOffset, alignOffset, avoidCollisions, collisionPadding, translucent, autoFocus, "aria-labelledby": ariaLabelledBy, "aria-label": ariaLabel, testID, style, }: PopoverContentProps): import("react").JSX.Element;
|
|
81
|
+
declare namespace PopoverContent {
|
|
82
|
+
var displayName: string;
|
|
83
|
+
}
|
|
84
|
+
/** `close()` and `shake()` of the popover around: for the content of `Popover.Content`. */
|
|
85
|
+
export declare function usePopoverController(): PopoverController;
|
|
86
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type StyleProp, type ViewStyle } from "react-native";
|
|
2
|
+
export type ProgressSize = "sm" | "md" | "lg";
|
|
3
|
+
export type ProgressColor = "primary" | "secondary" | "success" | "warning" | "caution" | "danger" | "info" | "discovery";
|
|
4
|
+
/** A part of a segmented bar: its share of `max`, its color, and the name it is read with. */
|
|
5
|
+
export type ProgressSegment = {
|
|
6
|
+
value: number;
|
|
7
|
+
/** @default "primary" */
|
|
8
|
+
color?: ProgressColor;
|
|
9
|
+
/** Read out with its share, such as "Paid 60%" */
|
|
10
|
+
label?: string;
|
|
11
|
+
};
|
|
12
|
+
export type ProgressProps = {
|
|
13
|
+
/** Current progress value, between `0` and `max`. Omit (or pass `null`) for an indeterminate state. */
|
|
14
|
+
value?: number | null;
|
|
15
|
+
/** @default 100 */
|
|
16
|
+
max?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Parts of one bar, side by side in their colors, such as paid, pending and due. The value is their sum; they take
|
|
19
|
+
* `value`'s place. A part's share is clamped so the bar never passes `max`.
|
|
20
|
+
*/
|
|
21
|
+
segments?: ProgressSegment[];
|
|
22
|
+
/** The bar's thickness: `sm` 4 (iOS's progress view), `md` 6, `lg` 8 (a bar in a stats card). @default "sm" */
|
|
23
|
+
size?: ProgressSize;
|
|
24
|
+
/** The color of the filled part. A segmented bar's parts take their own colors. @default "primary" */
|
|
25
|
+
color?: ProgressColor;
|
|
26
|
+
/** The value read out; the rounded percentage by default, such as "67%". */
|
|
27
|
+
getValueLabel?: (value: number, max: number) => string;
|
|
28
|
+
/** The name read out, when no visible label names the bar. */
|
|
29
|
+
"aria-label"?: string;
|
|
30
|
+
/** The `nativeID` of the visible label that names the bar (Android and the web). */
|
|
31
|
+
"aria-labelledby"?: string;
|
|
32
|
+
accessibilityLabel?: string;
|
|
33
|
+
testID?: string;
|
|
34
|
+
style?: StyleProp<ViewStyle>;
|
|
35
|
+
};
|
|
36
|
+
/** The parts of a segmented bar, each clamped so their sum stays within `max`, and their sum. */
|
|
37
|
+
export declare const progressSegments: (segments: ProgressSegment[], max: number) => {
|
|
38
|
+
parts: {
|
|
39
|
+
value: number;
|
|
40
|
+
/** @default "primary" */
|
|
41
|
+
color?: ProgressColor;
|
|
42
|
+
/** Read out with its share, such as "Paid 60%" */
|
|
43
|
+
label?: string;
|
|
44
|
+
}[];
|
|
45
|
+
total: number;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* A horizontal bar of a task's progress, or a sweep while its length is unknown, as @plexui/ui's Progress. iOS:
|
|
49
|
+
* the phone layer's tokens (`--progress-height` 4, 6, 8; `--progress-track-color`; the ink fill); a new value moves
|
|
50
|
+
* the fill in `--progress-transition-duration` (120ms, ease); the indeterminate sweep is 40% of the track, there and
|
|
51
|
+
* back in `--progress-indeterminate-duration` (1.5s, ease-in-out). Android: the Plex Android look's line progress,
|
|
52
|
+
* the accent on the ink at 8%, a new value in 300ms decelerating, and Material's indeterminate pair of lines (1750ms).
|
|
53
|
+
* A segmented bar puts its parts side by side with `--progress-segment-gap` (2) of track between them. With reduced
|
|
54
|
+
* motion a value lands at once and the sweep stands still in the middle.
|
|
55
|
+
*/
|
|
56
|
+
export declare function Progress({ value, max, segments, size, color, getValueLabel, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, accessibilityLabel, testID, style, }: ProgressProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
+
type Orientation = "horizontal" | "vertical";
|
|
4
|
+
type ConnectorStyle = "solid" | "dashed";
|
|
5
|
+
type Variant = "default" | "minimal";
|
|
6
|
+
type Color = "default" | "success";
|
|
7
|
+
export type ProgressStepsSize = "sm" | "md" | "lg";
|
|
8
|
+
export type ProgressStepsProps = {
|
|
9
|
+
/** Current active step (1-indexed, starts from 1) */
|
|
10
|
+
current: number;
|
|
11
|
+
/** Total number of steps (required for the minimal variant) */
|
|
12
|
+
total?: number;
|
|
13
|
+
/** @default "default" */
|
|
14
|
+
variant?: Variant;
|
|
15
|
+
/** The color of completed and active steps. @default "default" */
|
|
16
|
+
color?: Color;
|
|
17
|
+
/** @default "horizontal" */
|
|
18
|
+
orientation?: Orientation;
|
|
19
|
+
/** The size of the step indicators. @default "md" */
|
|
20
|
+
size?: ProgressStepsSize;
|
|
21
|
+
/** @default "solid" */
|
|
22
|
+
connectorStyle?: ConnectorStyle;
|
|
23
|
+
testID?: string;
|
|
24
|
+
style?: StyleProp<ViewStyle>;
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
};
|
|
27
|
+
export type StepProps = {
|
|
28
|
+
/** A custom icon instead of the step's number */
|
|
29
|
+
icon?: ReactNode;
|
|
30
|
+
/** The step's content: a Title and/or a Description */
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
};
|
|
33
|
+
export type StepTitleProps = {
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Hides the title from view and keeps it for screen readers, for steps that show their indicators alone: an icon
|
|
37
|
+
* or a check has no name. The step then takes no room under its indicator.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
visuallyHidden?: boolean;
|
|
41
|
+
};
|
|
42
|
+
export type StepDescriptionProps = {
|
|
43
|
+
children: ReactNode;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The steps of a multi-step flow, such as a checkout or onboarding, and the current one, as @plexui/ui's
|
|
47
|
+
* ProgressSteps: a numbered indicator per step (a check once completed), the connectors between them and each step's
|
|
48
|
+
* title and description, in a row or a column; or, with `variant="minimal"`, a bar of short segments. Neither
|
|
49
|
+
* platform has a control of its own, so both draw the Plex steps: iOS in the tokens (indicators 24, 32, 40; the ink
|
|
50
|
+
* for completed and active steps), Android in the Plex Android look's accent. A change of step fades the colors in
|
|
51
|
+
* `--transition-duration-basic` (120ms, ease), at once with reduced motion.
|
|
52
|
+
*/
|
|
53
|
+
export declare function ProgressSteps({ current, total, variant, color, orientation, size, connectorStyle, testID, style, children, }: ProgressStepsProps): import("react").JSX.Element;
|
|
54
|
+
export declare namespace ProgressSteps {
|
|
55
|
+
var Step: ({ icon, children, _index }: StepProps & {
|
|
56
|
+
_index?: number;
|
|
57
|
+
}) => import("react").JSX.Element;
|
|
58
|
+
var Title: ({ children, visuallyHidden }: StepTitleProps) => import("react").JSX.Element | null;
|
|
59
|
+
var Description: ({ children }: StepDescriptionProps) => import("react").JSX.Element;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type StyleProp, type ViewStyle } from "react-native";
|
|
2
|
+
import { type TextProps } from "../Text/Text";
|
|
3
|
+
export type RollingNumberProps = Omit<TextProps, "children"> & {
|
|
4
|
+
/** The number shown. A new value rolls each changed digit to it. */
|
|
5
|
+
value: number;
|
|
6
|
+
/** The locale the number is written in, as `Intl.NumberFormat` takes it. @default "en-US" */
|
|
7
|
+
locales?: Intl.LocalesArgument;
|
|
8
|
+
/** How the number is written: currency, percent, fraction digits, grouping, as `Intl.NumberFormat` takes it. */
|
|
9
|
+
format?: Intl.NumberFormatOptions;
|
|
10
|
+
/** The style of the row of characters. */
|
|
11
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
12
|
+
};
|
|
13
|
+
type Character = {
|
|
14
|
+
character: string;
|
|
15
|
+
digit: number | null;
|
|
16
|
+
key: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A written number's characters, each keyed by its place around the decimal separator, so a digit keeps its reel
|
|
20
|
+
* when the number grows or its fraction gets longer; digits are the locale's own (Arabic-Indic, Bengali…).
|
|
21
|
+
*/
|
|
22
|
+
export declare const rollingNumberParts: (value: number, locales?: Intl.LocalesArgument, format?: Intl.NumberFormatOptions) => {
|
|
23
|
+
text: string;
|
|
24
|
+
glyphs: string[];
|
|
25
|
+
characters: Character[];
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* A number whose digits roll to a new value, as an odometer, and @plexui/ui's RollingNumber: for a total, a balance, a
|
|
29
|
+
* count or a KPI that changes while it is watched. It takes the props of `Text` for its type and color, in tabular
|
|
30
|
+
* figures. iOS, as the web: each changed digit's reel of 0 to 9 turns to it in `--rolling-number-duration` (600ms) on
|
|
31
|
+
* `--rolling-number-ease`. Android, the Plex Android look's animated text: a changed character fades out and away by
|
|
32
|
+
* 0.3 of the font size while the new one comes in, in 320ms (ease-out quint), up for a larger number. With reduced
|
|
33
|
+
* motion it changes at once. A screen reader reads the written number.
|
|
34
|
+
*/
|
|
35
|
+
export declare function RollingNumber({ value, locales, format, containerStyle, style, size, variant, weight, mono, testID, accessibilityLabel, ...text }: RollingNumberProps): import("react").JSX.Element;
|
|
36
|
+
export {};
|
|
@@ -8,13 +8,25 @@ export type SelectOption<V extends string = string> = {
|
|
|
8
8
|
description?: ReactNode;
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
|
|
11
|
+
type SingleSelectProps<T extends SelectOption> = {
|
|
12
|
+
/** Several options can be chosen. @default false */
|
|
13
|
+
multiple?: false;
|
|
14
14
|
/** The value of the chosen option. */
|
|
15
15
|
value: T["value"] | null | undefined;
|
|
16
16
|
/** Called with the option a person chooses, as on the web. */
|
|
17
17
|
onChange: (option: T) => void;
|
|
18
|
+
};
|
|
19
|
+
type MultipleSelectProps<T extends SelectOption> = {
|
|
20
|
+
/** Several options can be chosen. @default false */
|
|
21
|
+
multiple: true;
|
|
22
|
+
/** The values of the chosen options. */
|
|
23
|
+
value: readonly T["value"][];
|
|
24
|
+
/** Called with the options chosen, in the options' order, as on the web. */
|
|
25
|
+
onChange: (options: T[]) => void;
|
|
26
|
+
};
|
|
27
|
+
export type SelectProps<T extends SelectOption> = (SingleSelectProps<T> | MultipleSelectProps<T>) & {
|
|
28
|
+
/** The options, as @plexui/ui's `options`. */
|
|
29
|
+
options: readonly T[];
|
|
18
30
|
/** @default "Select…" */
|
|
19
31
|
placeholder?: string;
|
|
20
32
|
disabled?: boolean;
|
|
@@ -26,20 +38,36 @@ export type SelectProps<T extends SelectOption> = {
|
|
|
26
38
|
/** Fill the width. @default true on a phone */
|
|
27
39
|
block?: boolean;
|
|
28
40
|
"aria-label"?: string;
|
|
29
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Android: what a press opens. `dialog`, Android's choice dialog: the setting's name over a row for each option, and
|
|
43
|
+
* Cancel; with one choice a row has a radio and a press on it chooses it and closes the dialog, a `multiple` select's
|
|
44
|
+
* rows have a checkbox and OK applies the rows checked. `menu`, the popup of the options from the field (in a List
|
|
45
|
+
* row, the row's menu, as the web's), a check at the end of each chosen one. iOS always opens its menu.
|
|
46
|
+
* @default "dialog", or "menu" for a `multiple` select
|
|
47
|
+
*/
|
|
48
|
+
picker?: "dialog" | "menu";
|
|
49
|
+
/** Android: the title of the picker dialog (`picker="dialog"`), the setting's name. @default the `aria-label` */
|
|
30
50
|
title?: string;
|
|
31
|
-
/** Android: the button that closes the picker dialog. @default "Cancel" */
|
|
51
|
+
/** Android: the button that closes the picker dialog (`picker="dialog"`) with no change. @default "Cancel" */
|
|
32
52
|
cancelLabel?: string;
|
|
53
|
+
/** Android: the button of a `multiple` select's picker dialog (`picker="dialog"`) that applies the rows checked. @default "OK" */
|
|
54
|
+
okLabel?: string;
|
|
55
|
+
/** The field's text when a `multiple` select has every option chosen. @default "All selected" */
|
|
56
|
+
allSelectedLabel?: string;
|
|
33
57
|
testID?: string;
|
|
34
58
|
style?: StyleProp<ViewStyle>;
|
|
35
59
|
};
|
|
36
60
|
/**
|
|
37
|
-
* A choice of one option: the field of an Input with the chosen label and a chevron. iOS 26: UIKit's pop-up button
|
|
61
|
+
* A choice of one option (or several, `multiple`): the field of an Input with the chosen label and a chevron. iOS 26: UIKit's pop-up button
|
|
38
62
|
* field with `chevron.up.chevron.down`, opening the glass menu of the options with a checkmark at the chosen one; at
|
|
39
63
|
* the end of an iOS List row it is the row's pop-up, as the web's in a phone row: the value in the row's type (the
|
|
40
64
|
* secondary label, the placeholder in the tertiary), the menu picker's chevrons after it, and the menu opening over it
|
|
41
65
|
* at its end. Android: the field with Material's dropdown arrow (at a List row's end, the row's value in the accent,
|
|
42
66
|
* as an Android value row), opening Android's single-choice dialog: the setting's name over 50dp rows with a radio,
|
|
43
|
-
* and Cancel. Choosing a row closes it.
|
|
67
|
+
* and Cancel. Choosing a row closes it. With `picker="menu"` Android opens the popup of the options instead: under the
|
|
68
|
+
* field, or from a List row the row's menu (the screen dimmed around the lit row), its chosen row checked at the end.
|
|
69
|
+
* A `multiple` select opens the menu, where each press checks or unchecks an option and the menu stays open; on
|
|
70
|
+
* Android `picker="dialog"` opens the dialog of checkbox rows instead, whose OK applies them.
|
|
44
71
|
*/
|
|
45
|
-
export declare function Select<T extends SelectOption>(
|
|
72
|
+
export declare function Select<T extends SelectOption>(props: SelectProps<T>): import("react").JSX.Element;
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type StyleProp, type ViewStyle } from "react-native";
|
|
2
|
+
export type SeparatorProps = {
|
|
3
|
+
/** A line across (between rows) or standing up (between inline items, as tall as its row). @default "horizontal" */
|
|
4
|
+
orientation?: "horizontal" | "vertical";
|
|
5
|
+
/**
|
|
6
|
+
* Hidden from screen readers, as a line that only draws. `false` makes it a `separator` element, for a line that
|
|
7
|
+
* marks a real grouping. @default true
|
|
8
|
+
*/
|
|
9
|
+
decorative?: boolean;
|
|
10
|
+
testID?: string;
|
|
11
|
+
style?: StyleProp<ViewStyle>;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A thin line that divides content, as @plexui/ui's Separator: `--separator-color` (`--color-border`) at
|
|
15
|
+
* `--separator-thickness` (1) on iOS, as the web draws it on a phone. On Android the line between the rows of a card
|
|
16
|
+
* in the Plex Android look: one device pixel of the divider gray (a light gray over a light card, the darkest gray at
|
|
17
|
+
* night). A vertical one stretches to the height of its row, at least a line of text.
|
|
18
|
+
*/
|
|
19
|
+
export declare function Separator({ orientation, decorative, testID, style }: SeparatorProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
+
import { type TextProps } from "../Text/Text";
|
|
4
|
+
type Element = "p" | "span" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div";
|
|
5
|
+
export type ShimmerTextProps = Omit<TextProps, "children" | "style"> & {
|
|
6
|
+
/** The element it stands for: `h1` to `h6` are read as a heading of that level. @default "div" */
|
|
7
|
+
as?: Element;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/** The style of the text. */
|
|
10
|
+
style?: TextProps["style"];
|
|
11
|
+
/** The style of the box around the text. */
|
|
12
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
13
|
+
};
|
|
14
|
+
export type ShimmerableTextProps = ShimmerTextProps & {
|
|
15
|
+
/** Whether the shimmer animation is active. Turned off, it finishes its sweep and stops. @default false */
|
|
16
|
+
shimmer?: boolean;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Text with a shimmer for loading and in-progress states, as @plexui/ui's ShimmerText: a light band sweeps across it,
|
|
20
|
+
* over and over. It takes the props of `Text` for its type and color. With reduced motion it is plain text.
|
|
21
|
+
*/
|
|
22
|
+
export declare function ShimmerText(props: ShimmerTextProps): import("react").JSX.Element;
|
|
23
|
+
/**
|
|
24
|
+
* Text whose shimmer turns on and off, as @plexui/ui's ShimmerableText: with `shimmer` on it sweeps as ShimmerText;
|
|
25
|
+
* turned off, it finishes the current sweep and then stops, with no abrupt cut.
|
|
26
|
+
*/
|
|
27
|
+
export declare function ShimmerableText({ as, shimmer, children, style, containerStyle, ...text }: ShimmerableTextProps): import("react").JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type StyleProp, type ViewStyle } from "react-native";
|
|
2
|
+
export type StepperProps = {
|
|
3
|
+
/** The controlled value. Use with `onChange`. */
|
|
4
|
+
value?: number;
|
|
5
|
+
/** The value when it is initially rendered. Use when you do not need to control the value. @default min */
|
|
6
|
+
defaultValue?: number;
|
|
7
|
+
/** Called with the next value after a step. */
|
|
8
|
+
onChange?: (value: number) => void;
|
|
9
|
+
/** The lowest value. @default 0 */
|
|
10
|
+
min?: number;
|
|
11
|
+
/** The highest value. @default 100 */
|
|
12
|
+
max?: number;
|
|
13
|
+
/** The amount each step adds or removes. @default 1 */
|
|
14
|
+
step?: number;
|
|
15
|
+
/** A step past `max` continues from `min`, and one below `min` from `max`. @default false */
|
|
16
|
+
wrap?: boolean;
|
|
17
|
+
/** Holding a segment keeps stepping, as a native stepper does. @default true */
|
|
18
|
+
autoRepeat?: boolean;
|
|
19
|
+
/** When `true`, prevents the user from interacting with the stepper. */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/** Fully rounded ends. @default true */
|
|
22
|
+
pill?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Shows the value between the minus and the plus on one fill, as a cart's quantity: round segments and no
|
|
25
|
+
* separator. Without it the stepper shows no value, as the native one. @default false
|
|
26
|
+
*/
|
|
27
|
+
showValue?: boolean;
|
|
28
|
+
/** Accessible name of the decrement segment. @default "Decrease" */
|
|
29
|
+
decrementLabel?: string;
|
|
30
|
+
/** Accessible name of the increment segment. @default "Increase" */
|
|
31
|
+
incrementLabel?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Called when the decrement segment is pressed at `min`. With it, the segment shows a trash can there and removes
|
|
34
|
+
* the item, as a cart's stepper does at a quantity of one (without `wrap`).
|
|
35
|
+
*/
|
|
36
|
+
onRemove?: () => void;
|
|
37
|
+
/** Accessible name of the decrement segment when it removes. @default "Remove" */
|
|
38
|
+
removeLabel?: string;
|
|
39
|
+
/** Accessible name of the value the stepper changes, when no visible label names it. */
|
|
40
|
+
"aria-label"?: string;
|
|
41
|
+
/** The `nativeID` of the visible label of the value the stepper changes (Android and the web). */
|
|
42
|
+
"aria-labelledby"?: string;
|
|
43
|
+
accessibilityLabel?: string;
|
|
44
|
+
testID?: string;
|
|
45
|
+
style?: StyleProp<ViewStyle>;
|
|
46
|
+
};
|
|
47
|
+
/** The value one step away, clamped to the range or wrapped, without floating point drift. */
|
|
48
|
+
export declare const stepValue: (current: number, direction: 1 | -1, { min, max, step, wrap }: {
|
|
49
|
+
min: number;
|
|
50
|
+
max: number;
|
|
51
|
+
step: number;
|
|
52
|
+
wrap: boolean;
|
|
53
|
+
}) => number;
|
|
54
|
+
/**
|
|
55
|
+
* Two segments that decrease and increase a number, as the iOS 26 stepper (UIStepper) does, and @plexui/ui's
|
|
56
|
+
* Stepper. It shows no value of its own (`showValue` puts it between the segments, as a cart's quantity): name it
|
|
57
|
+
* with `aria-label`. A press steps at once; held, it repeats after 400ms every 100ms. For a screen reader it is one
|
|
58
|
+
* adjustable element: swipe up or down to step (Android: the increment and decrement actions). On the web it is a
|
|
59
|
+
* spin button: Up and Down step, Page Up and Page Down step ten times, Home and End go to the range ends.
|
|
60
|
+
*/
|
|
61
|
+
export declare function Stepper({ value: valueProp, defaultValue, onChange, min, max, step, wrap, autoRepeat, disabled, pill, showValue, decrementLabel, incrementLabel, onRemove, removeLabel, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, accessibilityLabel, testID, style, }: StepperProps): import("react").JSX.Element;
|
|
@@ -30,17 +30,17 @@ export declare function selectionColor(theme: Theme, color?: SelectionColor): st
|
|
|
30
30
|
*/
|
|
31
31
|
export declare function iosCheckmarkColor(theme: Theme): string;
|
|
32
32
|
/**
|
|
33
|
-
* The gray of an Android off switch and of the dots past the choice of a stepped slider: #
|
|
34
|
-
*
|
|
33
|
+
* The gray of an Android off switch and of the dots past the choice of a stepped slider: #A7ADB2 on white, --gray-500
|
|
34
|
+
* (#5D5D5D) at night, as the web's `--android-switch-off`.
|
|
35
35
|
*/
|
|
36
36
|
export declare function androidSwitchOff(theme: Theme): string;
|
|
37
37
|
/** Android's default ease-in-out (AccelerateDecelerateInterpolator), which an ObjectAnimator runs by default. */
|
|
38
38
|
export declare const androidEaseInOut: import("react-native").EasingFunction;
|
|
39
|
-
/** A List row on Android ends
|
|
40
|
-
export declare const ANDROID_ROW_END =
|
|
39
|
+
/** A List row on Android ends 21dp in from the card's edge (`--list-row-inset`): a control at its end moves in from there. */
|
|
40
|
+
export declare const ANDROID_ROW_END = 21;
|
|
41
41
|
/**
|
|
42
42
|
* A switch: the iOS 26 switch of the phone layer (a 63x28 track, a 37x24 capsule thumb, `--switch-*`), or Android's
|
|
43
|
-
* (a 31x14dp track and a
|
|
43
|
+
* (a 31x14dp track and a 20.6dp thumb over it, a 2dp ring of the track's color around a knob of the card's color, the
|
|
44
44
|
* track's color changing as the thumb moves; a 50dp switch row, the label 11dp from the switch). Props follow
|
|
45
45
|
* @plexui/ui.
|
|
46
46
|
*/
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type StyleProp, type ViewStyle } from "react-native";
|
|
2
|
+
export type Tag = {
|
|
3
|
+
value: string;
|
|
4
|
+
/** What the `validator` said when the tag was made. */
|
|
5
|
+
valid: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type TagInputProps = {
|
|
8
|
+
/** The tags it starts with, when it holds its own. */
|
|
9
|
+
defaultValue?: Tag[];
|
|
10
|
+
/** The tags, when the caller holds them (with `onChange`). */
|
|
11
|
+
value?: Tag[];
|
|
12
|
+
/** @default "xl" */
|
|
13
|
+
size?: "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
|
|
14
|
+
/** `ghost` has no frame (the value of a List row). @default "outline" */
|
|
15
|
+
variant?: "outline" | "ghost";
|
|
16
|
+
onChange?: (tags: Tag[]) => void;
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
/** Judges each new tag: an invalid one stands in the danger color. Read only when a tag is made. */
|
|
19
|
+
validator?: (value: string) => boolean;
|
|
20
|
+
/** The most tags it takes; the field goes at that count. */
|
|
21
|
+
maxTags?: number;
|
|
22
|
+
/** @default false */
|
|
23
|
+
autoFocus?: boolean;
|
|
24
|
+
/** The least height, in lines of tags. @default 1 */
|
|
25
|
+
rows?: number;
|
|
26
|
+
/** The characters that end a tag as they are typed (and split a paste). @default [",", " "] */
|
|
27
|
+
delimiters?: string[];
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
/** A capsule frame. @default false */
|
|
30
|
+
pill?: boolean;
|
|
31
|
+
/** The field's name. */
|
|
32
|
+
accessibilityLabel?: string;
|
|
33
|
+
style?: StyleProp<ViewStyle>;
|
|
34
|
+
testID?: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* A field that turns what is typed into tags: Plex UI's TagInput. A delimiter (a comma, a space) or Return makes the
|
|
38
|
+
* text a tag; Backspace in an empty field takes the last one; each tag's × removes it. iOS: the web's phone tags, a
|
|
39
|
+
* 44pt line for each with a 32pt gray pill (`--color-background-secondary-soft-alpha`), its 17pt words 8 in and the ×
|
|
40
|
+
* in a 44pt target after them, 8 apart; an invalid tag in the danger color. Android: 32dp chips, 16 round, filled with
|
|
41
|
+
* the text color at 5%, their words 14sp, the × in a 32dp target, 8 apart. In a List row (`Field row`, vertical) it is
|
|
42
|
+
* the row's bare value; elsewhere it has the frame of an outlined field.
|
|
43
|
+
*/
|
|
44
|
+
export declare function TagInput({ defaultValue, value, size, variant, onChange, placeholder, validator, maxTags, autoFocus, rows, delimiters, disabled, pill, accessibilityLabel, style, testID, }: TagInputProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type GestureResponderEvent, type StyleProp, type TextStyle } from "react-native";
|
|
3
|
+
import type { FontWeightName } from "../../theme/types";
|
|
4
|
+
export type TextLinkProps = {
|
|
5
|
+
/** The link's text; an icon after it (an external link's arrow) stands on the text's line. */
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/** Where the link goes: opened with `Linking`, a link of the page on the web. An http:// or https:// URL is external. */
|
|
8
|
+
href?: string;
|
|
9
|
+
/** The primary link color in place of the text's own, with no underline unless `underline` asks for one. @default false */
|
|
10
|
+
primary?: boolean;
|
|
11
|
+
/** Underlines the link. @default true, false for a `primary` link */
|
|
12
|
+
underline?: boolean;
|
|
13
|
+
/** External link behavior (a new tab on the web) whatever the URL. Detected from the URL by default. */
|
|
14
|
+
forceExternal?: boolean;
|
|
15
|
+
/** Called when the link is pressed, before it opens `href`; `event.preventDefault()` keeps it from opening. */
|
|
16
|
+
onPress?: (event: GestureResponderEvent) => void;
|
|
17
|
+
/** The weight of the link's text; it takes the text's own around it by default (`--link-font-weight: inherit`). */
|
|
18
|
+
weight?: FontWeightName;
|
|
19
|
+
accessibilityLabel?: string;
|
|
20
|
+
testID?: string;
|
|
21
|
+
style?: StyleProp<TextStyle>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A link in running text, as @plexui/ui's TextLink: put it inside a `Text`, whose face, size and color it takes
|
|
25
|
+
* (the web's `currentcolor`), underlined; `primary` colors it with `--link-primary-text-color` and drops the underline.
|
|
26
|
+
* iOS highlights a pressed link as its text views do (a gray behind the text); Android and the web draw the press of a
|
|
27
|
+
* 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
|
|
28
|
+
* URL (an `<a>` on the web, a new tab for an external one); with only `onPress` it is a `button`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function TextLink({ children, href, primary, underline, forceExternal, onPress, weight, accessibilityLabel, testID, style }: TextLinkProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type InputProps } from "../Input/Input";
|
|
2
|
+
export type TextareaProps = Omit<InputProps, "multiline" | "onClear" | "startAdornment" | "endAdornment" | "pill" | "selectTextOnFocus"> & {
|
|
3
|
+
/** The lines it shows. @default 3 */
|
|
4
|
+
rows?: number;
|
|
5
|
+
/** It grows with what is typed, from `rows` lines up to `maxRows`. @default false */
|
|
6
|
+
autoResize?: boolean;
|
|
7
|
+
/** The most lines it grows to with `autoResize`, then it scrolls. @default Math.max(rows, 10) */
|
|
8
|
+
maxRows?: number;
|
|
9
|
+
/** Selects all its text when it takes focus (TextInput's `selectTextOnFocus`). @default false */
|
|
10
|
+
autoSelect?: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* A text field of several lines: Plex UI's Textarea. It is the Input's field with `multiline` (the same variants, sizes
|
|
14
|
+
* and states, the same frames on both platforms), `rows` lines tall, its text from the top. In a List row (a `Field
|
|
15
|
+
* row`) it is the row's bare value: under its label, or alone, from the row's text start, as the web's on a phone.
|
|
16
|
+
* iOS: the field's 17/22 lines, 11 above and below them in a frame; Android: the outlined field's 17/20 lines, a
|
|
17
|
+
* label floating in its frame inside a Field.
|
|
18
|
+
*/
|
|
19
|
+
export declare function Textarea({ rows, autoResize, maxRows, autoSelect, ...rest }: TextareaProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
2
|
+
import { type StyleProp, type ViewStyle } from "react-native";
|
|
3
|
+
import { type FloatingAlign, type FloatingSide } from "../../internal/floating";
|
|
4
|
+
/** The edge of an inline tip that points at what it explains. */
|
|
5
|
+
export type TipArrowEdge = "top" | "bottom" | "left" | "right";
|
|
6
|
+
/** How a tip's actions show on a phone. */
|
|
7
|
+
export type TipMobileActions = "rows" | "buttons";
|
|
8
|
+
type TipContentProps = {
|
|
9
|
+
/** The tip's title: what the feature is. */
|
|
10
|
+
title: ReactNode;
|
|
11
|
+
/** One or two sentences on how to use it. */
|
|
12
|
+
description?: ReactNode;
|
|
13
|
+
/** A symbol that leads the message, as a TipKit tip's image. */
|
|
14
|
+
icon?: ReactNode;
|
|
15
|
+
/** Buttons for the tip's actions, below the message. */
|
|
16
|
+
actions?: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* `rows`: each action a row of text in its button's color under a separator, as iOS tips show them (text buttons on
|
|
19
|
+
* Android); `buttons`: each Button as given, a full-width capsule under the message, as an iOS card that asks for a
|
|
20
|
+
* permission. @default "rows"
|
|
21
|
+
*/
|
|
22
|
+
mobileActions?: TipMobileActions;
|
|
23
|
+
};
|
|
24
|
+
export type TipProps = TipContentProps & {
|
|
25
|
+
/** Shows the Close button; called when it is pressed. */
|
|
26
|
+
onClose?: () => void;
|
|
27
|
+
/** The Close button's label. @default "Close tip" */
|
|
28
|
+
closeLabel?: string;
|
|
29
|
+
/** Draws an arrow at this edge, pointing at what the tip explains (TipKit's annotation). */
|
|
30
|
+
arrowEdge?: TipArrowEdge;
|
|
31
|
+
testID?: string;
|
|
32
|
+
style?: StyleProp<ViewStyle>;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* A tip inside the page, as @plexui/ui's Tip on a phone (TipKit's inline tip): a title, a description, an optional
|
|
36
|
+
* symbol, actions and Close, on the card of a grouped list; `arrowEdge` adds TipKit's annotation arrow. On Android the
|
|
37
|
+
* same card in the Plex Android look, laid out as Material 3's rich tooltip.
|
|
38
|
+
*/
|
|
39
|
+
export declare function Tip({ onClose, closeLabel, arrowEdge, testID, style, ...content }: TipProps): import("react").JSX.Element;
|
|
40
|
+
export declare namespace Tip {
|
|
41
|
+
var Popover: typeof TipPopover;
|
|
42
|
+
}
|
|
43
|
+
export type TipPopoverProps = TipContentProps & {
|
|
44
|
+
/** Shows the tip (controlled). */
|
|
45
|
+
open?: boolean;
|
|
46
|
+
/** Shows the tip at first (uncontrolled). @default false */
|
|
47
|
+
defaultOpen?: boolean;
|
|
48
|
+
/** Called when the tip opens or closes: Close, a tap outside, Android's back or the web's Escape closes it. */
|
|
49
|
+
onOpenChange?: (open: boolean) => void;
|
|
50
|
+
/** The control the tip explains: an element that hands its native view to `ref` (a Button, Pressable, View). */
|
|
51
|
+
children: ReactElement;
|
|
52
|
+
/** The side of the control the tip shows on. Turned when it does not fit. @default "bottom" */
|
|
53
|
+
side?: FloatingSide;
|
|
54
|
+
/** The alignment against the control. @default "center" */
|
|
55
|
+
align?: FloatingAlign;
|
|
56
|
+
/** The distance from the control to the arrow's point. @default 4 */
|
|
57
|
+
sideOffset?: number;
|
|
58
|
+
/** Shows the Close button. @default true */
|
|
59
|
+
closeButton?: boolean;
|
|
60
|
+
/** The Close button's label. @default "Close tip" */
|
|
61
|
+
closeLabel?: string;
|
|
62
|
+
testID?: string;
|
|
63
|
+
style?: StyleProp<ViewStyle>;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* A tip anchored to a control, as @plexui/ui's Tip.Popover on a phone (TipKit's popover tip): the tip's content on the
|
|
67
|
+
* iOS 27 alert's glass with the kit's popover shadow, 300 wide, its arrow pointing at the control; on Android the
|
|
68
|
+
* popup surface of the Plex Android look with Material's caret. It does not take the focus.
|
|
69
|
+
*/
|
|
70
|
+
declare function TipPopover({ open: controlledOpen, defaultOpen, onOpenChange, children, side, align, sideOffset, closeButton, closeLabel, testID, style, ...content }: TipPopoverProps): import("react").JSX.Element;
|
|
71
|
+
export {};
|
|
@@ -60,9 +60,17 @@ declare namespace ToolbarGroup {
|
|
|
60
60
|
var displayName: string;
|
|
61
61
|
}
|
|
62
62
|
export type ToolbarTitleProps = {
|
|
63
|
-
|
|
63
|
+
/** The title's text. With `image` it may be left out. */
|
|
64
|
+
children?: ReactNode;
|
|
64
65
|
subtitle?: ReactNode;
|
|
65
66
|
numberOfLines?: number;
|
|
67
|
+
/**
|
|
68
|
+
* A picture in the title's place: a logo (an Image, an svg). It stays the bar's header for a screen reader, named by
|
|
69
|
+
* `accessibilityLabel` (or the text in `children`, which is then not drawn).
|
|
70
|
+
*/
|
|
71
|
+
image?: ReactNode;
|
|
72
|
+
/** The header's name, for an `image` title. */
|
|
73
|
+
accessibilityLabel?: string;
|
|
66
74
|
};
|
|
67
75
|
/** The title of the bar, and an optional subtitle under it. Announced as a header. */
|
|
68
76
|
declare function ToolbarTitle(_: ToolbarTitleProps): ReactElement | null;
|