@plexui/react-native 0.1.0 → 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.
Files changed (149) hide show
  1. package/README.md +34 -0
  2. package/dist/es/components/ActionSheet/ActionSheet.js +53 -19
  3. package/dist/es/components/Alert/Alert.js +163 -0
  4. package/dist/es/components/Avatar/Avatar.js +20 -8
  5. package/dist/es/components/BottomActions/BottomActions.js +34 -0
  6. package/dist/es/components/BottomSheet/BottomSheet.js +85 -17
  7. package/dist/es/components/Button/Button.js +108 -28
  8. package/dist/es/components/Card/Card.js +16 -8
  9. package/dist/es/components/Checkbox/Checkbox.js +67 -99
  10. package/dist/es/components/Chip/Chip.js +16 -7
  11. package/dist/es/components/Dialog/Dialog.js +38 -24
  12. package/dist/es/components/Field/Field.js +91 -0
  13. package/dist/es/components/FloatingLabelInput/FloatingLabelInput.js +59 -0
  14. package/dist/es/components/Icon/createIcon.js +13 -2
  15. package/dist/es/components/Indicator/CircularProgress.js +80 -0
  16. package/dist/es/components/Indicator/LoadingDots.js +46 -0
  17. package/dist/es/components/Indicator/LoadingIndicator.js +101 -0
  18. package/dist/es/components/Indicator/index.js +3 -0
  19. package/dist/es/components/Input/Input.js +69 -60
  20. package/dist/es/components/InputGroup/InputGroup.js +130 -0
  21. package/dist/es/components/List/List.js +175 -59
  22. package/dist/es/components/Menu/Menu.js +69 -40
  23. package/dist/es/components/NavigationButton/NavigationButton.js +20 -4
  24. package/dist/es/components/OTPInput/OTPInput.js +9 -3
  25. package/dist/es/components/PageControl/PageControl.js +13 -7
  26. package/dist/es/components/Popover/Popover.js +128 -0
  27. package/dist/es/components/Progress/Progress.js +142 -0
  28. package/dist/es/components/ProgressSteps/ProgressSteps.js +207 -0
  29. package/dist/es/components/RollingNumber/RollingNumber.js +125 -0
  30. package/dist/es/components/Select/Select.js +97 -34
  31. package/dist/es/components/Separator/Separator.js +31 -0
  32. package/dist/es/components/ShimmerText/ShimmerText.js +98 -0
  33. package/dist/es/components/Stepper/Stepper.js +219 -0
  34. package/dist/es/components/Switch/Switch.js +26 -12
  35. package/dist/es/components/TagInput/TagInput.js +121 -0
  36. package/dist/es/components/Text/Text.js +7 -4
  37. package/dist/es/components/TextLink/TextLink.js +42 -0
  38. package/dist/es/components/Textarea/Textarea.js +12 -0
  39. package/dist/es/components/Tip/Tip.js +193 -0
  40. package/dist/es/components/Toolbar/Toolbar.js +6 -2
  41. package/dist/es/components/Tooltip/Tooltip.js +272 -0
  42. package/dist/es/index.js +20 -2
  43. package/dist/es/internal/FloatingPanel.js +111 -0
  44. package/dist/es/internal/fieldStack.js +73 -0
  45. package/dist/es/internal/floating.js +97 -0
  46. package/dist/es/internal/ripple.js +119 -0
  47. package/dist/es/internal/row.js +2 -1
  48. package/dist/es/internal/transition.js +113 -0
  49. package/dist/es/theme/ThemeProvider.js +41 -9
  50. package/dist/es/theme/material.js +37 -7
  51. package/dist/types/components/ActionSheet/ActionSheet.d.ts +15 -7
  52. package/dist/types/components/Alert/Alert.d.ts +51 -0
  53. package/dist/types/components/Avatar/Avatar.d.ts +4 -2
  54. package/dist/types/components/BottomActions/BottomActions.d.ts +18 -0
  55. package/dist/types/components/BottomSheet/BottomSheet.d.ts +4 -2
  56. package/dist/types/components/Button/Button.d.ts +20 -5
  57. package/dist/types/components/Card/Card.d.ts +14 -1
  58. package/dist/types/components/Checkbox/Checkbox.d.ts +4 -3
  59. package/dist/types/components/Chip/Chip.d.ts +12 -1
  60. package/dist/types/components/Dialog/Dialog.d.ts +9 -5
  61. package/dist/types/components/Field/Field.d.ts +64 -0
  62. package/dist/types/components/FloatingLabelInput/FloatingLabelInput.d.ts +42 -0
  63. package/dist/types/components/Indicator/CircularProgress.d.ts +34 -0
  64. package/dist/types/components/Indicator/LoadingDots.d.ts +17 -0
  65. package/dist/types/components/Indicator/LoadingIndicator.d.ts +46 -0
  66. package/dist/types/components/Indicator/index.d.ts +3 -0
  67. package/dist/types/components/Input/Input.d.ts +13 -3
  68. package/dist/types/components/InputGroup/InputGroup.d.ts +71 -0
  69. package/dist/types/components/List/List.d.ts +57 -14
  70. package/dist/types/components/Menu/Menu.d.ts +4 -0
  71. package/dist/types/components/NavigationButton/NavigationButton.d.ts +11 -3
  72. package/dist/types/components/OTPInput/OTPInput.d.ts +10 -1
  73. package/dist/types/components/PageControl/PageControl.d.ts +11 -1
  74. package/dist/types/components/Popover/Popover.d.ts +86 -0
  75. package/dist/types/components/Progress/Progress.d.ts +56 -0
  76. package/dist/types/components/ProgressSteps/ProgressSteps.d.ts +61 -0
  77. package/dist/types/components/RollingNumber/RollingNumber.d.ts +36 -0
  78. package/dist/types/components/Select/Select.d.ts +36 -8
  79. package/dist/types/components/Separator/Separator.d.ts +19 -0
  80. package/dist/types/components/ShimmerText/ShimmerText.d.ts +28 -0
  81. package/dist/types/components/Stepper/Stepper.d.ts +61 -0
  82. package/dist/types/components/Switch/Switch.d.ts +5 -5
  83. package/dist/types/components/TagInput/TagInput.d.ts +44 -0
  84. package/dist/types/components/TextLink/TextLink.d.ts +30 -0
  85. package/dist/types/components/Textarea/Textarea.d.ts +19 -0
  86. package/dist/types/components/Tip/Tip.d.ts +71 -0
  87. package/dist/types/components/Toolbar/Toolbar.d.ts +9 -1
  88. package/dist/types/components/Tooltip/Tooltip.d.ts +84 -0
  89. package/dist/types/index.d.ts +20 -2
  90. package/dist/types/internal/FloatingPanel.d.ts +70 -0
  91. package/dist/types/internal/fieldStack.d.ts +48 -0
  92. package/dist/types/internal/floating.d.ts +71 -0
  93. package/dist/types/internal/ripple.d.ts +17 -0
  94. package/dist/types/internal/row.d.ts +15 -3
  95. package/dist/types/internal/transition.d.ts +37 -0
  96. package/dist/types/theme/ThemeProvider.d.ts +28 -4
  97. package/dist/types/theme/material.d.ts +20 -6
  98. package/dist/types/theme/types.d.ts +8 -0
  99. package/package.json +2 -2
  100. package/src/components/ActionSheet/ActionSheet.tsx +107 -38
  101. package/src/components/Alert/Alert.tsx +279 -0
  102. package/src/components/Avatar/Avatar.tsx +21 -9
  103. package/src/components/BottomActions/BottomActions.tsx +54 -0
  104. package/src/components/BottomSheet/BottomSheet.tsx +111 -25
  105. package/src/components/Button/Button.tsx +170 -35
  106. package/src/components/Card/Card.tsx +33 -9
  107. package/src/components/Checkbox/Checkbox.tsx +89 -124
  108. package/src/components/Chip/Chip.tsx +49 -6
  109. package/src/components/Dialog/Dialog.tsx +68 -37
  110. package/src/components/Field/Field.tsx +227 -0
  111. package/src/components/FloatingLabelInput/FloatingLabelInput.tsx +144 -0
  112. package/src/components/Icon/createIcon.tsx +16 -6
  113. package/src/components/Indicator/CircularProgress.tsx +141 -0
  114. package/src/components/Indicator/LoadingDots.tsx +79 -0
  115. package/src/components/Indicator/LoadingIndicator.tsx +166 -0
  116. package/src/components/Indicator/index.ts +3 -0
  117. package/src/components/Input/Input.tsx +126 -97
  118. package/src/components/InputGroup/InputGroup.tsx +261 -0
  119. package/src/components/List/List.tsx +345 -88
  120. package/src/components/Menu/Menu.tsx +83 -41
  121. package/src/components/NavigationButton/NavigationButton.tsx +35 -5
  122. package/src/components/OTPInput/OTPInput.tsx +21 -2
  123. package/src/components/PageControl/PageControl.tsx +36 -8
  124. package/src/components/Popover/Popover.tsx +261 -0
  125. package/src/components/Progress/Progress.tsx +255 -0
  126. package/src/components/ProgressSteps/ProgressSteps.tsx +415 -0
  127. package/src/components/RollingNumber/RollingNumber.tsx +189 -0
  128. package/src/components/Select/Select.tsx +175 -71
  129. package/src/components/Separator/Separator.tsx +51 -0
  130. package/src/components/ShimmerText/ShimmerText.tsx +144 -0
  131. package/src/components/Stepper/Stepper.tsx +386 -0
  132. package/src/components/Switch/Switch.tsx +26 -12
  133. package/src/components/TagInput/TagInput.tsx +227 -0
  134. package/src/components/Text/Text.tsx +8 -4
  135. package/src/components/TextLink/TextLink.tsx +77 -0
  136. package/src/components/Textarea/Textarea.tsx +23 -0
  137. package/src/components/Tip/Tip.tsx +410 -0
  138. package/src/components/Toolbar/Toolbar.tsx +27 -2
  139. package/src/components/Tooltip/Tooltip.tsx +478 -0
  140. package/src/index.ts +36 -2
  141. package/src/internal/FloatingPanel.tsx +199 -0
  142. package/src/internal/fieldStack.tsx +179 -0
  143. package/src/internal/floating.ts +131 -0
  144. package/src/internal/ripple.tsx +132 -0
  145. package/src/internal/row.ts +16 -3
  146. package/src/internal/transition.ts +124 -0
  147. package/src/theme/ThemeProvider.tsx +65 -15
  148. package/src/theme/material.ts +39 -7
  149. package/src/theme/types.ts +8 -0
@@ -0,0 +1,84 @@
1
+ import { type ReactNode } from "react";
2
+ import { type StyleProp, type ViewStyle } from "react-native";
3
+ import { type FloatingAlign, type FloatingSide } from "../../internal/floating";
4
+ import { type TextProps } from "../Text/Text";
5
+ export type TooltipGutterSize = "sm" | "md" | "lg";
6
+ type TooltipPlacementProps = {
7
+ /** The preferred side of the trigger; it turns when there is no room. @default "top" */
8
+ side?: FloatingSide;
9
+ /** The preferred alignment against the trigger. @default "center" */
10
+ align?: FloatingAlign;
11
+ /** An offset from the `start` or `end` alignment. @default 0 */
12
+ alignOffset?: number;
13
+ /** The distance from the trigger. @default 5 */
14
+ sideOffset?: number;
15
+ };
16
+ export type TooltipProps = TooltipPlacementProps & {
17
+ /** The trigger: a single element. Wrap plain text in `Tooltip.TriggerDecorator`. */
18
+ children: ReactNode;
19
+ /** The tooltip's content; `null` shows no tooltip. */
20
+ content: ReactNode;
21
+ /** The tooltip's max width; `"none"` keeps it on one line at its natural width. @default 300 */
22
+ maxWidth?: number | "none";
23
+ /** Keeps the tooltip open (`true`) or closed (`false`). */
24
+ forceOpen?: boolean;
25
+ /** Short tooltips of one to three words, in inverted colors. @default false */
26
+ compact?: boolean;
27
+ /** The padding inside the tooltip. @default "md" */
28
+ gutterSize?: TooltipGutterSize;
29
+ /** The style of the tooltip's panel. */
30
+ contentStyle?: StyleProp<ViewStyle>;
31
+ testID?: string;
32
+ };
33
+ /**
34
+ * Brief text that explains a control, as @plexui/ui's Tooltip. A phone has no hover: a long press on the trigger
35
+ * shows it for 1.5 seconds, as Android shows a tooltip, and a tap anywhere hides it; `forceOpen` keeps it shown. A
36
+ * screen reader reads the content as the trigger's description. On iOS (which has no tooltips) and the web it is the
37
+ * web's tooltip (the elevated surface with its shadow, `--radius-md`, 14/20 text; `compact` inverted, 2 by 8); on
38
+ * Android Material 3's tooltips: `compact` the plain tooltip (inverse surface, Body S, 4dp corners), otherwise the
39
+ * rich tooltip's surface (12dp corners, Body M, level 2 shadow). A disabled trigger shows its tooltip too.
40
+ */
41
+ export declare function Tooltip({ children, content, maxWidth, forceOpen, compact, side, align, alignOffset, sideOffset, gutterSize, contentStyle, testID, }: TooltipProps): import("react").JSX.Element;
42
+ export declare namespace Tooltip {
43
+ var displayName: string;
44
+ var TriggerDecorator: typeof import("./Tooltip").TriggerDecorator;
45
+ }
46
+ type DescribedProps = {
47
+ accessibilityHint?: string;
48
+ "aria-describedby"?: string;
49
+ };
50
+ export type TriggerDecoratorProps = Pick<TextProps, "variant" | "size" | "weight" | "color" | "style"> & {
51
+ /** Text that the tooltip explains. */
52
+ children: ReactNode;
53
+ /** Makes the text a stop of the keyboard (the web). @default true */
54
+ focusable?: boolean;
55
+ testID?: string;
56
+ };
57
+ /**
58
+ * Makes text a tooltip's trigger, as @plexui/ui's Tooltip.TriggerDecorator: a tap or a long press shows the tooltip,
59
+ * and the text gets the dotted underline of an open tooltip (the tertiary text color; Android draws it solid).
60
+ */
61
+ export declare function TriggerDecorator({ children, focusable, testID, variant, size, weight, color, style, ...described }: TriggerDecoratorProps & DescribedProps): import("react").JSX.Element;
62
+ export declare namespace TriggerDecorator {
63
+ var displayName: string;
64
+ }
65
+ export type CopyTooltipProps = TooltipPlacementProps & {
66
+ /** The trigger element (a Button, or text in `Tooltip.TriggerDecorator`). */
67
+ children: ReactNode;
68
+ /** The text copied to the clipboard. */
69
+ copyValue: string;
70
+ /** Called once the clipboard write settles, with whether it succeeded; Copied! shows only after a successful write. */
71
+ onCopy?: (copied: boolean) => void;
72
+ /**
73
+ * Writes the text to the clipboard, in place of the default: the web's Clipboard API, React Native's clipboard
74
+ * module elsewhere. Pass one that uses your app's clipboard library (`expo-clipboard`'s `setStringAsync`).
75
+ */
76
+ copy?: (value: string) => Promise<boolean | void> | boolean | void;
77
+ testID?: string;
78
+ };
79
+ /**
80
+ * A trigger that copies a value, as @plexui/ui's CopyTooltip on a phone: a tap copies it and says Copied! with a check
81
+ * in a compact tooltip for a second; a long press shows Copy.
82
+ */
83
+ export declare function CopyTooltip({ children, copyValue, onCopy, copy, side, align, alignOffset, sideOffset, testID }: CopyTooltipProps): import("react").JSX.Element;
84
+ export {};
@@ -1,4 +1,4 @@
1
- export { ThemeProvider, createTheme, defaultPlatform, interFonts, useTheme, type ThemeProviderProps } from "./theme/ThemeProvider";
1
+ export { ThemeProvider, createTheme, defaultPlatform, interFonts, robotoFonts, useTheme, type PlatformFonts, type ThemeProviderProps } from "./theme/ThemeProvider";
2
2
  export type { BrandTheme, ColorScheme, FontFamilies, FontWeightName, MaterialColors, PlatformStyle, RadiusName, SelectionColor, Theme, ThemeColors, TokenValue, } from "./theme/types";
3
3
  export { materialColors, stateLayer, withAlpha } from "./theme/material";
4
4
  export { materialType, typeStyle, type HeadingSize, type TextSize, type TextVariant, type TypeStyle } from "./theme/typography";
@@ -16,6 +16,11 @@ export { Switch, type SwitchProps } from "./components/Switch/Switch";
16
16
  export { Checkbox, type CheckboxProps } from "./components/Checkbox/Checkbox";
17
17
  export { RadioGroup, type RadioGroupItemProps, type RadioGroupProps } from "./components/RadioGroup/RadioGroup";
18
18
  export { Input, InputAdornmentButton, TextField, type InputAdornmentButtonProps, type InputProps, type InputVariant, type TextFieldProps } from "./components/Input/Input";
19
+ export { Field, FieldError, type FieldControlProps, type FieldErrorProps, type FieldProps } from "./components/Field/Field";
20
+ export { Textarea, type TextareaProps } from "./components/Textarea/Textarea";
21
+ export { FloatingLabelInput, type FloatingLabelInputProps } from "./components/FloatingLabelInput/FloatingLabelInput";
22
+ export { InputGroup, type InputGroupAddonAlign, type InputGroupAddonProps, type InputGroupButtonProps, type InputGroupInputProps, type InputGroupProps, type InputGroupTextareaProps, type InputGroupTextProps, } from "./components/InputGroup/InputGroup";
23
+ export { TagInput, type Tag, type TagInputProps } from "./components/TagInput/TagInput";
19
24
  export { OTPInput, type OTPInputProps } from "./components/OTPInput/OTPInput";
20
25
  export { Select, type SelectOption, type SelectProps } from "./components/Select/Select";
21
26
  export { Menu, type MenuContentProps, type MenuItemProps, type MenuProps } from "./components/Menu/Menu";
@@ -25,10 +30,23 @@ export { Dialog, type DialogAction, type DialogProps } from "./components/Dialog
25
30
  export { Toaster, toast, type ToasterProps, type ToastId, type ToastOptions, type ToastT, type ToastType } from "./components/Toast/Toast";
26
31
  export { Avatar, AvatarGroup, type AvatarColor, type AvatarGroupProps, type AvatarProps, type AvatarVariant } from "./components/Avatar/Avatar";
27
32
  export { Badge, type BadgeColor, type BadgeProps, type BadgeSize, type BadgeVariant } from "./components/Badge/Badge";
28
- export { Card, type CardMediaProps, type CardProps, type CardSize, type CardVariant } from "./components/Card/Card";
33
+ export { BottomActions, type BottomActionsProps } from "./components/BottomActions/BottomActions";
34
+ export { Card, cardColors, type CardColor, type CardMediaProps, type CardProps, type CardSize, type CardVariant } from "./components/Card/Card";
29
35
  export { List, ListItem, type ListItemProps, type ListProps } from "./components/List/List";
30
36
  export { Chip, type ChipProps } from "./components/Chip/Chip";
31
37
  export { Skeleton, type SkeletonProps } from "./components/Skeleton/Skeleton";
38
+ export { Progress, progressSegments, type ProgressColor, type ProgressProps, type ProgressSegment, type ProgressSize } from "./components/Progress/Progress";
39
+ export { ProgressSteps, type ProgressStepsProps, type ProgressStepsSize, type StepDescriptionProps, type StepProps, type StepTitleProps } from "./components/ProgressSteps/ProgressSteps";
40
+ export { Stepper, stepValue, type StepperProps } from "./components/Stepper/Stepper";
41
+ export { CircularProgress, getSimulatedProgress, LoadingDots, LoadingIndicator, type CircularProgressProps, type LoadingDotsProps, type LoadingIndicatorProps } from "./components/Indicator";
42
+ export { ShimmerableText, ShimmerText, type ShimmerableTextProps, type ShimmerTextProps } from "./components/ShimmerText/ShimmerText";
43
+ export { RollingNumber, rollingNumberParts, type RollingNumberProps } from "./components/RollingNumber/RollingNumber";
32
44
  export { EmptyMessage, EmptyState, type EmptyMessageProps } from "./components/EmptyMessage/EmptyMessage";
33
45
  export { Slider, type SliderMark, type SliderProps } from "./components/Slider/Slider";
34
46
  export { PageControl, pageControlDots, type PageControlChangeDetails, type PageControlDotSize, type PageControlProps } from "./components/PageControl/PageControl";
47
+ export { Alert, type AlertColor, type AlertMobileActions, type AlertProps, type AlertVariant } from "./components/Alert/Alert";
48
+ export { Tip, type TipArrowEdge, type TipMobileActions, type TipPopoverProps, type TipProps } from "./components/Tip/Tip";
49
+ export { CopyTooltip, Tooltip, type CopyTooltipProps, type TooltipGutterSize, type TooltipProps, type TriggerDecoratorProps } from "./components/Tooltip/Tooltip";
50
+ export { Popover, usePopoverController, type PopoverContentProps, type PopoverController, type PopoverProps, type PopoverTriggerProps, } from "./components/Popover/Popover";
51
+ export { Separator, type SeparatorProps } from "./components/Separator/Separator";
52
+ export { TextLink, type TextLinkProps } from "./components/TextLink/TextLink";
@@ -0,0 +1,70 @@
1
+ import { type ReactNode } from "react";
2
+ import { Animated, type Role, type StyleProp, type ViewStyle } from "react-native";
3
+ import type { MenuAnchor } from "../components/Menu/Menu";
4
+ import { type FloatingAlign, type FloatingSide } from "./floating";
5
+ export type CollisionPadding = number | Partial<Record<"top" | "right" | "bottom" | "left", number>>;
6
+ export type FloatingPlacement = {
7
+ side: FloatingSide;
8
+ arrow: number;
9
+ size: {
10
+ width: number;
11
+ height: number;
12
+ } | null;
13
+ };
14
+ export type FloatingPanelProps = {
15
+ open: boolean;
16
+ onDismiss: () => void;
17
+ /** The trigger's box in the window (`measure`); the middle of the screen until it is measured. */
18
+ anchor: MenuAnchor | null;
19
+ side?: FloatingSide;
20
+ align?: FloatingAlign;
21
+ sideOffset?: number;
22
+ alignOffset?: number;
23
+ /** Kept free at the window's edges, the safe area at least; an object leaves 0 at a side it does not name. */
24
+ collisionPadding?: CollisionPadding;
25
+ /** Turns to the other side when it does not fit. @default true */
26
+ avoidCollisions?: boolean;
27
+ /** An arrow's length and the room it keeps from the panel's corners. */
28
+ arrow?: {
29
+ width: number;
30
+ padding: number;
31
+ };
32
+ /** The panel's glass appears at once and fades only as it leaves (`glassOpacity`). */
33
+ glass?: boolean;
34
+ /**
35
+ * `popup`: it grows from 0.95 (Android's pop on its own clock); `tooltip`: a tooltip's entrance, a fade on iOS (the
36
+ * web's 120ms on `--cubic-enter`, gone at once) and Material's on Android (a fade as it grows from 0.8 over 150ms
37
+ * on LinearOutSlowIn, a fade out over 75). @default "popup"
38
+ */
39
+ motion?: "popup" | "tooltip";
40
+ /** Touches go through the panel to the overlay under it, which closes it (a tooltip's text). */
41
+ passThrough?: boolean;
42
+ /** The panel takes the first focus on the web. @default true */
43
+ autoFocus?: boolean;
44
+ role?: Role;
45
+ "aria-label"?: string;
46
+ "aria-labelledby"?: string;
47
+ testID?: string;
48
+ /** The panel's size limits (its width and min and max width). */
49
+ style?: StyleProp<ViewStyle>;
50
+ /** Moves the panel along its own axis, as a shake. */
51
+ translateX?: Animated.Value | Animated.AnimatedInterpolation<number>;
52
+ children: (placement: FloatingPlacement) => ReactNode;
53
+ };
54
+ /** The collision padding of each side, as Radix reads it: a number for all four, an object's missing sides 0. */
55
+ export declare function paddingOf(padding?: CollisionPadding): {
56
+ top: number;
57
+ right: number;
58
+ bottom: number;
59
+ left: number;
60
+ };
61
+ /**
62
+ * A panel at its trigger, over the app in the overlay layer (a transparent Modal: a tap outside, Android's back and
63
+ * the web's Escape close it). It is measured off the screen first, then placed on its side of the trigger (turned
64
+ * when it does not fit, moved along to stay inside the window and the safe area), as Radix Popper places the web's
65
+ * popovers. It grows from the trigger's side: on iOS from 0.95 as it fades in on the overlay's time (`--motion-enter`
66
+ * on `--cubic-enter`), as the web's phone popover; on Android as a popup in the Plex Android look, a fade over 150ms
67
+ * (accelerate-decelerate) as it grows from 0.95 over 200 on an overshoot of tension 2. With reduced motion it only
68
+ * fades.
69
+ */
70
+ export declare function FloatingPanel({ open, onDismiss, anchor, side, align, sideOffset, alignOffset, collisionPadding, avoidCollisions, arrow, glass, motion, passThrough, autoFocus, role, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, testID, style, translateX, children, }: FloatingPanelProps): import("react").JSX.Element;
@@ -0,0 +1,48 @@
1
+ import { type ReactNode } from "react";
2
+ import { Animated, type StyleProp, type ViewStyle } from "react-native";
3
+ /**
4
+ * Android: the label a Field hands the outlined field it wraps (an Input, a Textarea), which floats it in its frame as
5
+ * TextField's does, with the asterisk of a required one and the shake of an error. Null elsewhere.
6
+ */
7
+ export declare const FloatLabelContext: import("react").Context<{
8
+ label: ReactNode;
9
+ required: boolean;
10
+ shift?: Animated.Value;
11
+ } | null>;
12
+ /** What a field's stack hands its control: the description's link, the invalid state and Android's shake. */
13
+ export type FieldStackControl = {
14
+ /** `aria-describedby` on the web, `accessibilityHint` on a phone, with a caller's own kept. */
15
+ described: Record<string, unknown>;
16
+ invalid: boolean;
17
+ /** Android: the field moves sideways by it when an error appears (InputField's `shift`). */
18
+ shake?: Animated.Value;
19
+ };
20
+ export type FieldStackProps = {
21
+ label: ReactNode;
22
+ /** The label is not drawn; the control still carries it as its name. */
23
+ hideLabel?: boolean;
24
+ required?: boolean;
25
+ description?: ReactNode;
26
+ errorMessage?: ReactNode;
27
+ /** Marks the control invalid without a message (the help turns the danger color). */
28
+ invalid?: boolean;
29
+ /** Content at the end of the label's line, such as a link that acts on the field. */
30
+ labelAction?: ReactNode;
31
+ disabled?: boolean;
32
+ /** Android: the control draws the label itself, floating in the field (an Input, a Textarea). */
33
+ floating: boolean;
34
+ /** The caller's own `aria-describedby` and `accessibilityHint`, kept with the stack's. */
35
+ describedBy?: string;
36
+ hint?: string;
37
+ style?: StyleProp<ViewStyle>;
38
+ testID?: string;
39
+ children: (control: FieldStackControl) => ReactNode;
40
+ };
41
+ /**
42
+ * A label, a control and the help or the error under it: the stacked field of TextField and Field. iOS sets the label
43
+ * over the control (15/20 medium; no phone token for a stacked field's label), 8 above it, and the description or the
44
+ * error 4pt under the control (15/20, `--mobile-field-error-*`). Android floats the label in a field that draws it
45
+ * (the outlined field), or sets it over any other control (14/18 medium in the secondary gray, 14 in, as the help),
46
+ * and the help under it (14/18, 14 in, 6 under), the field shaken when an error appears.
47
+ */
48
+ export declare function FieldStack({ label, hideLabel, required, description, errorMessage, invalid, labelAction, disabled, floating, describedBy: ownDescribedBy, hint, style, testID, children, }: FieldStackProps): import("react").JSX.Element;
@@ -0,0 +1,71 @@
1
+ import type { MenuAnchor } from "../components/Menu/Menu";
2
+ export type FloatingSide = "top" | "right" | "bottom" | "left";
3
+ export type FloatingAlign = "start" | "center" | "end";
4
+ export type FloatingInput = {
5
+ /** The trigger's box in the window (`measure`). */
6
+ anchor: MenuAnchor;
7
+ /** The panel's size, once measured. */
8
+ size: {
9
+ width: number;
10
+ height: number;
11
+ };
12
+ /** The window's size. */
13
+ window: {
14
+ width: number;
15
+ height: number;
16
+ };
17
+ side: FloatingSide;
18
+ align: FloatingAlign;
19
+ /** From the trigger's edge to the panel's (to an arrow's point when it has one). */
20
+ sideOffset: number;
21
+ /** Along the trigger's edge, from the aligned edge. */
22
+ alignOffset?: number;
23
+ /** Kept free at each edge of the window (the safe area included by the caller). */
24
+ padding: {
25
+ top: number;
26
+ right: number;
27
+ bottom: number;
28
+ left: number;
29
+ };
30
+ /** Turns to the opposite side when the panel does not fit on its own (Radix's `avoidCollisions`). @default true */
31
+ flip?: boolean;
32
+ /** An arrow's length along the panel's edge and the room it keeps from the corners (Radix's `arrowPadding`). */
33
+ arrow?: {
34
+ width: number;
35
+ padding: number;
36
+ };
37
+ /** A right-to-left layout: `start` is the right edge. */
38
+ rtl?: boolean;
39
+ };
40
+ export type FloatingPlace = {
41
+ left: number;
42
+ top: number;
43
+ /** The side it ended on, after a turn. */
44
+ side: FloatingSide;
45
+ /** Where the arrow's middle stands along the panel's edge, from its left or top. */
46
+ arrow: number;
47
+ };
48
+ /**
49
+ * Places a floating panel at its trigger as Radix Popper does on the web (floating-ui's `offset`, `flip`, `shift` and
50
+ * `arrow`): on its side, aligned to the trigger's start, center or end, turned to the other side when it does not fit
51
+ * there and the other side has more room, then moved along the edge to stay inside the window's padding; an arrow
52
+ * keeps pointing at the trigger's middle, clear of the panel's corners.
53
+ */
54
+ export declare function placeFloating({ anchor, size, window, side, align, sideOffset, alignOffset, padding, flip, arrow, rtl }: FloatingInput): FloatingPlace;
55
+ /** The origin a panel grows from: the middle of its edge at the trigger, as Radix's transform origin. */
56
+ export declare function floatingOrigin(side: FloatingSide, arrow: number, size: {
57
+ width: number;
58
+ height: number;
59
+ }): string;
60
+ /**
61
+ * Props for a trigger element that a floating panel stands at: its node as the panel's anchor (the element itself,
62
+ * so the trigger keeps its own place in the layout: a Button, a Pressable, a View or a Text hands its native view to
63
+ * `ref`), after its own ref, and its layout, after its own `onLayout`, to place the panel again as it moves.
64
+ */
65
+ export declare function anchorProps(props: {
66
+ ref?: unknown;
67
+ onLayout?: (event: never) => void;
68
+ }, setNode: (node: never) => void, onMove?: () => void): {
69
+ ref: (node: unknown) => void;
70
+ onLayout: (event: never) => void;
71
+ };
@@ -0,0 +1,17 @@
1
+ import { type ReactNode } from "react";
2
+ import { type GestureResponderEvent, type StyleProp, type ViewStyle } from "react-native";
3
+ export type Ripple = {
4
+ /** Starts a wave at the event's touch point (the middle when it has none, as a key's press). */
5
+ start: (event?: GestureResponderEvent) => void;
6
+ /** Lets the wave go: it fades once it has shown its 225ms. */
7
+ end: () => void;
8
+ /** The wave's layer: first inside the view that takes the press, which clips it to its corners. */
9
+ layer: ReactNode;
10
+ };
11
+ /**
12
+ * Android's ripple where the platform draws none: the web's Android look, and a List row held through the control at
13
+ * its end. A wave starts at the touch point, 60% of the view's larger side across, and grows to cover the view as its
14
+ * centre slides to the view's middle, as Android's bounded ripple does; no scale and no flat layer. `clip` places and
15
+ * sizes the layer (the 40dp circle of a bar's borderless icon); by default it fills the view.
16
+ */
17
+ export declare function useRipple(color: string, enabled: boolean, reduced: boolean, clip?: StyleProp<ViewStyle>): Ripple;
@@ -1,3 +1,4 @@
1
+ import type { GestureResponderEvent } from "react-native";
1
2
  /** The end of a List row, as its control sees it. */
2
3
  export type RowEnd = {
3
4
  /**
@@ -10,6 +11,17 @@ export type RowEnd = {
10
11
  * an Android value row opens its choice from anywhere on the row). Rows that do not offer it leave it out.
11
12
  */
12
13
  press?: (open: (() => void) | null) => void;
14
+ /**
15
+ * Where a field's text stands: at the row's `end` (a row's value), or at the `start` of its own column (a List with
16
+ * `columns`, the web's `[data-field-columns]`). @default "end"
17
+ */
18
+ align?: "start" | "end";
19
+ /**
20
+ * The field is a line of its own under the row's label, or alone in the row (the web's `Field row` with
21
+ * `orientation="vertical"` or `hideLabel`): no frame on either platform, the text from the row's text start, as
22
+ * tall as its lines.
23
+ */
24
+ stacked?: boolean;
13
25
  };
14
26
  /**
15
27
  * Inside the end of a List row. On iOS a control there takes the row's look, as the web's controls in a `[data-row]` do.
@@ -23,7 +35,7 @@ export declare const RowEndContext: import("react").Context<RowEnd | null>;
23
35
  * checkbox's toggle) and tells the row while a finger is on it, so the row shows its press. iOS lights a held choice
24
36
  * row (a check or a radio), not a switch row; Android's list selector shows for a touch anywhere on the row.
25
37
  */
26
- export declare const RowHoldContext: import("react").Context<((held: boolean) => void) | null>;
38
+ export declare const RowHoldContext: import("react").Context<((held: boolean, event?: GestureResponderEvent) => void) | null>;
27
39
  /**
28
40
  * Inside the start of a List row: a RadioGroup option given as the row's `leading` (a list of choices with the mark
29
41
  * first, as a language list). The option draws its mark alone, taking no more room than the mark.
@@ -46,7 +58,7 @@ export type RowFrame = {
46
58
  };
47
59
  export declare const RowFrameContext: import("react").Context<RowFrame | null>;
48
60
  /** A control's press handlers that hold its row while a finger is on it (none outside a pressable row). */
49
- export declare function rowHold(hold: ((held: boolean) => void) | null): {
50
- onPressIn: () => void;
61
+ export declare function rowHold(hold: ((held: boolean, event?: GestureResponderEvent) => void) | null): {
62
+ onPressIn: (event: GestureResponderEvent) => void;
51
63
  onPressOut: () => void;
52
64
  } | null;
@@ -0,0 +1,37 @@
1
+ import { Animated, type EasingFunction } from "react-native";
2
+ /** Transforms and opacity run on the native driver on a phone; react-native-web has none. */
3
+ export declare const nativeDriver: boolean;
4
+ /** CSS's `ease`, the default curve of a CSS transition and of each keyframe of a CSS animation. */
5
+ export declare const cssEase: EasingFunction;
6
+ /** A `cubic-bezier()` value (a motion token) as an easing; CSS's named curves too. Anything else is `fallback`. */
7
+ export declare function cssEasing(value: unknown, fallback?: EasingFunction): EasingFunction;
8
+ type TransitionOptions = {
9
+ duration: number;
10
+ easing: EasingFunction;
11
+ /** Runs on the native driver: only for transforms and opacity. */
12
+ native?: boolean;
13
+ /** With reduced motion the value is there at once. */
14
+ reducedMotion?: boolean;
15
+ };
16
+ /**
17
+ * A number that moves to `target` as a CSS transition does: from where it stands, over `duration` on `easing`; at
18
+ * once with reduced motion or a zero duration.
19
+ */
20
+ export declare function useTransitionValue(target: number, { duration, easing, native, reducedMotion }: TransitionOptions): Animated.Value;
21
+ /**
22
+ * A color that changes as a CSS `transition: background-color` does: from the color it showed to the new one over
23
+ * `duration`; at once with reduced motion or a zero duration (a pressed fill that lands at once).
24
+ */
25
+ export declare function useColorTransition(color: string, { duration, easing, reducedMotion }: Omit<TransitionOptions, "native">): string | Animated.Interpolation<string>;
26
+ /**
27
+ * A clock for a looping animation: 0 to `period` ms, linear, over and over while `running`, after `delay` ms (a CSS
28
+ * animation's delay: only before the first turn). Parts of the animation read it through `interpolate`, as a CSS
29
+ * animation's keyframes read its time.
30
+ */
31
+ export declare function useLoopClock(period: number, running: boolean, native: boolean, delay?: number): Animated.Value;
32
+ /**
33
+ * A number that moves to `target` as a CSS transition does, handed back as a plain number on each frame: for a value
34
+ * an animated prop cannot carry (an SVG stroke, which does not reach the element on the web).
35
+ */
36
+ export declare function useTweenedNumber(target: number, { duration, easing, reducedMotion }: Omit<TransitionOptions, "native">): number;
37
+ export {};
@@ -15,7 +15,7 @@ export type ThemeProviderProps = {
15
15
  * `"primary"` is the Plex primary, the ink, as on the web. `"accent"` is each platform's own: on iOS a switch turns
16
16
  * the system green and a checkbox or a checkmark the accent, the iOS tint; on Android all of them take the accent.
17
17
  * Pass `Platform.select` for a different one per platform. A nested ThemeProvider takes its parent's.
18
- * @default "primary"
18
+ * @default "primary" on iOS, "accent" on Android (as the web's Android look)
19
19
  */
20
20
  selectionColor?: SelectionColor;
21
21
  /**
@@ -23,8 +23,17 @@ export type ThemeProviderProps = {
23
23
  * parent's brand and lays its own over it.
24
24
  */
25
25
  brand?: BrandTheme;
26
- /** Faces of the kit (a nested ThemeProvider takes its parent's). Without them the platform's own face is used; see `interFonts`. */
27
- fonts?: FontFamilies;
26
+ /**
27
+ * Faces of the kit (a nested ThemeProvider takes its parent's). Without them the platform's own face is used; see
28
+ * `interFonts` and `robotoFonts`. Faces per drawn platform, `{ ios, android }`, take the one of `platform`: the
29
+ * Material 3 look in a browser on a Mac would otherwise draw in SF, the browser's system face, not Roboto.
30
+ */
31
+ fonts?: FontFamilies | PlatformFonts;
32
+ /**
33
+ * The width the phone layer is laid out for, in place of the window's: a phone drawn in a frame inside a wider window
34
+ * (a gallery, a review page) sets the frame's width, 402 for an iPhone 17 Pro.
35
+ */
36
+ viewportWidth?: number;
28
37
  children?: ReactNode;
29
38
  };
30
39
  /**
@@ -36,6 +45,21 @@ export type ThemeProviderProps = {
36
45
  * ```
37
46
  */
38
47
  export declare const interFonts: FontFamilies;
48
+ /**
49
+ * The family names `@expo-google-fonts/roboto` registers, for `fonts`: the face of Material 3. An Android device has
50
+ * Roboto as its system face already; the web needs it loaded, for the Android look in a browser.
51
+ *
52
+ * ```tsx
53
+ * const [loaded] = useFonts({ Roboto_400Regular, Roboto_500Medium, Roboto_600SemiBold, Roboto_700Bold })
54
+ * <ThemeProvider platform={platform} fonts={{ android: robotoFonts }}>
55
+ * ```
56
+ */
57
+ export declare const robotoFonts: FontFamilies;
58
+ /** Faces for each drawn platform: iOS (the system face when left out) and Android. */
59
+ export type PlatformFonts = {
60
+ ios?: FontFamilies;
61
+ android?: FontFamilies;
62
+ };
39
63
  /** The platform a ThemeProvider draws by default. */
40
64
  export declare function defaultPlatform(): PlatformStyle;
41
65
  /** Builds a theme for a scheme and a platform (ThemeProvider does it for its children). */
@@ -51,6 +75,6 @@ export declare function createTheme(options: {
51
75
  * Gives its children the Plex UI theme: tokens resolved from @plexui/styles for the scheme, the brand and a phone,
52
76
  * and the platform the components draw. Nest one to theme a part of a screen (a dark sheet on a light page).
53
77
  */
54
- export declare function ThemeProvider({ scheme, platform, selectionColor, brand, fonts, children }: ThemeProviderProps): import("react").JSX.Element;
78
+ export declare function ThemeProvider({ scheme, platform, selectionColor, brand, fonts: fontsProp, viewportWidth, children }: ThemeProviderProps): import("react").JSX.Element;
55
79
  /** The theme of the nearest ThemeProvider (the light default of the device's platform without one). */
56
80
  export declare function useTheme(): Theme;
@@ -19,10 +19,16 @@ export declare const stateLayer: {
19
19
  readonly dragged: 0.16;
20
20
  };
21
21
  /**
22
- * The press of a row in a section on Android: the settings list selector, a near-black at 11% (#1D000010) over a
23
- * light card, and the dark theme's list selector, white at 5%, over a dark one.
22
+ * The press of a row in a section on Android: black at 4.7% over a light card, as the reference's phone build draws a
23
+ * held card row (its public source's settings selector, #1D000010 at 11%, reads too dark beside it), and the dark
24
+ * theme's list selector, white at 5%, over a dark one.
24
25
  */
25
- export declare const controlHighlight: (scheme: "light" | "dark") => "rgba(255, 255, 255, 0.05)" | "rgba(0, 0, 16, 0.114)";
26
+ export declare const controlHighlight: (scheme: "light" | "dark") => "rgba(255, 255, 255, 0.05)" | "rgba(0, 0, 0, 0.047)";
27
+ /**
28
+ * Android's list selector outside a section, the ripple of a popup's item and of a dialog's row: black at 0x0F of
29
+ * 255 over a light surface, white at 0x0D at night.
30
+ */
31
+ export declare const androidSelector: (scheme: "light" | "dark") => "rgba(255, 255, 255, 0.051)" | "rgba(0, 0, 0, 0.059)";
26
32
  /**
27
33
  * Text in the accent on Android, as the blue text over a card (a section header, a row's value). Light: #298ACF,
28
34
  * which the bright Plex accent (`primary`) is closest to. At night the blues get lighter (#79C4FC in the dark theme):
@@ -36,11 +42,19 @@ export declare function accentText(theme: Theme): string;
36
42
  */
37
43
  export declare function dangerText(theme: Theme): string;
38
44
  /**
39
- * The divider between the rows of a card on Android: a light gray over a light card (#D9D9D9; the Plex `--gray-150`)
40
- * and darker than the card at night (#000000 under a #181819 card; the darkest Plex gray, `--gray-0`, the grouped
41
- * canvas).
45
+ * The divider between the rows of a card on Android: a light gray over a light card (#D9D9D9) and darker than the
46
+ * card at night (#000000 under a #181819 card; the darkest Plex gray, `--gray-0`, the grouped canvas), as the web's
47
+ * `--android-divider`.
42
48
  */
43
49
  export declare function divider(theme: Theme): string;
50
+ /**
51
+ * The fixed grays of the Plex Android look, each with its night pair, as the web's android.css sets them: an off
52
+ * switch's track (`--android-switch-off`: #A7ADB2, `--gray-500` at night), an empty checkbox's ring
53
+ * (`--android-checkbox-ring`: #B0B9C2, `--gray-500`), a field's idle line (`--android-field-line`: #DBDBDB, the text
54
+ * at 24%), a field's hint (`--android-hint`: #A8A8A8, #7D7D7D), the gap between a row menu's groups
55
+ * (`--android-popup-gap`: #F5F5F5, #262626) and a header menu's (`--android-menu-band`: the text at 6%).
56
+ */
57
+ export declare function androidGray(theme: Theme, role: "switchOff" | "checkboxRing" | "fieldLine" | "hint" | "popupGap" | "menuBand"): string;
44
58
  /**
45
59
  * Material's shadow elevations as CSS box shadows (the key and ambient shadows of the Material web components'
46
60
  * `--md-elevation-level`): level 2 is a menu, level 3 a snackbar.
@@ -75,7 +75,15 @@ export type ThemeColors = {
75
75
  textInverse: string;
76
76
  textAccent: string;
77
77
  textDanger: string;
78
+ /** The positive color as text: a "Verified" or "Saved" line (`--color-text-success`). */
79
+ textSuccess: string;
78
80
  accent: string;
81
+ /** The positive color as a fill or a glyph: a verified checkmark, a done state (`--color-background-success-solid`; iOS's systemGreen place). */
82
+ success: string;
83
+ /** The color of text and glyphs on `success`. */
84
+ onSuccess: string;
85
+ /** The destructive color as a fill (`--color-background-danger-solid`). */
86
+ danger: string;
79
87
  /** The canvas of a plain screen. */
80
88
  background: string;
81
89
  /** The canvas of a grouped screen (iOS grouped lists). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/react-native",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Plex UI components for React Native and Expo: iOS 26 and Material 3, on the shared @plexui/styles tokens",
5
5
  "license": "MIT",
6
6
  "homepage": "https://plexui.com",
@@ -84,7 +84,7 @@
84
84
  "test": "npm run typecheck && npm run lint && npm run test:web --prefix example"
85
85
  },
86
86
  "dependencies": {
87
- "@plexui/styles": "^0.16.7"
87
+ "@plexui/styles": "^0.17.1"
88
88
  },
89
89
  "peerDependencies": {
90
90
  "expo-blur": ">=15",