@isoline-ui/react-native 0.0.0-stage → 1.0.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/LICENSE +22 -0
- package/NOTICE.md +12 -0
- package/README.md +104 -3
- package/dist/amount.d.ts +3 -0
- package/dist/calendar.d.ts +7 -0
- package/dist/components/action-chip.d.ts +9 -0
- package/dist/components/amount-field.d.ts +12 -0
- package/dist/components/avatar.d.ts +17 -0
- package/dist/components/back-button.d.ts +12 -0
- package/dist/components/back-icon.d.ts +3 -0
- package/dist/components/badge.d.ts +13 -0
- package/dist/components/banner.d.ts +14 -0
- package/dist/components/bottom-sheet-native.d.ts +11 -0
- package/dist/components/bottom-sheet-web.d.ts +18 -0
- package/dist/components/bottom-sheet.d.ts +3 -0
- package/dist/components/button-group.d.ts +26 -0
- package/dist/components/button.d.ts +48 -0
- package/dist/components/checkbox.d.ts +12 -0
- package/dist/components/color-picker.d.ts +21 -0
- package/dist/components/context-menu.d.ts +26 -0
- package/dist/components/date-picker.d.ts +64 -0
- package/dist/components/dialog-context.d.ts +2 -0
- package/dist/components/dialog.d.ts +20 -0
- package/dist/components/empty-state.d.ts +15 -0
- package/dist/components/expand-indicator.d.ts +27 -0
- package/dist/components/expressive-shape.d.ts +18 -0
- package/dist/components/fab-menu-legacy.d.ts +31 -0
- package/dist/components/fab-menu.d.ts +21 -0
- package/dist/components/filter-chip.d.ts +69 -0
- package/dist/components/floating-action-button.d.ts +15 -0
- package/dist/components/icon-button.d.ts +40 -0
- package/dist/components/icons.d.ts +18 -0
- package/dist/components/input.d.ts +9 -0
- package/dist/components/keyboard-inset-view.d.ts +15 -0
- package/dist/components/list-controls.d.ts +38 -0
- package/dist/components/loading-indicator.d.ts +9 -0
- package/dist/components/menu-sheet.d.ts +36 -0
- package/dist/components/panel-sheet.d.ts +8 -0
- package/dist/components/password-visibility.d.ts +5 -0
- package/dist/components/popover-layout.d.ts +25 -0
- package/dist/components/popover.d.ts +20 -0
- package/dist/components/pressable.d.ts +12 -0
- package/dist/components/radio-navigation.d.ts +11 -0
- package/dist/components/refresh-control.d.ts +16 -0
- package/dist/components/row-gap.d.ts +9 -0
- package/dist/components/search-field.d.ts +22 -0
- package/dist/components/select-field.d.ts +16 -0
- package/dist/components/settings-list.d.ts +98 -0
- package/dist/components/settings-row.d.ts +13 -0
- package/dist/components/sheet-frame.d.ts +27 -0
- package/dist/components/sheet-lifecycle.d.ts +36 -0
- package/dist/components/sheet-transition.d.ts +36 -0
- package/dist/components/slider.d.ts +21 -0
- package/dist/components/snackbar.d.ts +10 -0
- package/dist/components/split-button.d.ts +38 -0
- package/dist/components/squish.d.ts +20 -0
- package/dist/components/swipeable-row.d.ts +20 -0
- package/dist/components/switch.d.ts +8 -0
- package/dist/components/tab-bar.d.ts +20 -0
- package/dist/components/text-field.d.ts +31 -0
- package/dist/components/text.d.ts +9 -0
- package/dist/components/time-picker.d.ts +40 -0
- package/dist/components/toolbar.d.ts +77 -0
- package/dist/components/top-bar.d.ts +27 -0
- package/dist/components/undo-bar.d.ts +23 -0
- package/dist/components/wavy-progress.d.ts +21 -0
- package/dist/components/zoomable-image.d.ts +18 -0
- package/dist/expressive-shapes.d.ts +8 -0
- package/dist/index.d.ts +62 -0
- package/dist/keyboard.d.ts +2 -0
- package/dist/material.d.ts +11 -0
- package/dist/media.d.ts +11 -0
- package/dist/motion.d.ts +96 -0
- package/dist/platform.d.ts +3 -0
- package/dist/preset-tokens.d.ts +264 -0
- package/dist/provider.d.ts +59 -0
- package/dist/reduced-motion.d.ts +45 -0
- package/dist/selection.d.ts +2 -0
- package/dist/shape.d.ts +99 -0
- package/dist/sheet-physics.d.ts +37 -0
- package/dist/theme.d.ts +103 -0
- package/dist/tokens.d.ts +2 -0
- package/dist/use-keyboard-height.d.ts +10 -0
- package/dist/utils.d.ts +3 -0
- package/nativewind.cjs +68 -0
- package/package.json +63 -6
- package/src/amount.ts +53 -0
- package/src/calendar.ts +42 -0
- package/src/components/action-chip.tsx +64 -0
- package/src/components/amount-field.tsx +49 -0
- package/src/components/avatar.tsx +91 -0
- package/src/components/back-button.tsx +39 -0
- package/src/components/back-icon.tsx +25 -0
- package/src/components/badge.tsx +41 -0
- package/src/components/banner.tsx +63 -0
- package/src/components/bottom-sheet-native.tsx +52 -0
- package/src/components/bottom-sheet-web.tsx +193 -0
- package/src/components/bottom-sheet.tsx +5 -0
- package/src/components/button-group.tsx +326 -0
- package/src/components/button.tsx +337 -0
- package/src/components/checkbox.tsx +71 -0
- package/src/components/color-picker.tsx +115 -0
- package/src/components/context-menu.tsx +149 -0
- package/src/components/date-picker.tsx +466 -0
- package/src/components/dialog-context.ts +3 -0
- package/src/components/dialog.tsx +210 -0
- package/src/components/empty-state.tsx +49 -0
- package/src/components/expand-indicator.tsx +60 -0
- package/src/components/expressive-shape.tsx +37 -0
- package/src/components/fab-menu-legacy.tsx +181 -0
- package/src/components/fab-menu.tsx +90 -0
- package/src/components/filter-chip.tsx +136 -0
- package/src/components/floating-action-button.tsx +79 -0
- package/src/components/icon-button.tsx +127 -0
- package/src/components/icons.tsx +43 -0
- package/src/components/input.tsx +80 -0
- package/src/components/keyboard-inset-view.tsx +28 -0
- package/src/components/list-controls.tsx +134 -0
- package/src/components/loading-indicator.tsx +183 -0
- package/src/components/menu-sheet.tsx +133 -0
- package/src/components/panel-sheet.tsx +90 -0
- package/src/components/password-visibility.tsx +39 -0
- package/src/components/popover-layout.ts +47 -0
- package/src/components/popover.tsx +139 -0
- package/src/components/pressable.tsx +108 -0
- package/src/components/radio-navigation.ts +52 -0
- package/src/components/refresh-control.tsx +39 -0
- package/src/components/row-gap.tsx +13 -0
- package/src/components/search-field.tsx +92 -0
- package/src/components/select-field.tsx +105 -0
- package/src/components/settings-list.tsx +302 -0
- package/src/components/settings-row.tsx +61 -0
- package/src/components/sheet-frame.tsx +250 -0
- package/src/components/sheet-lifecycle.ts +233 -0
- package/src/components/sheet-transition.ts +105 -0
- package/src/components/slider.tsx +185 -0
- package/src/components/snackbar.tsx +97 -0
- package/src/components/split-button.tsx +212 -0
- package/src/components/squish.ts +41 -0
- package/src/components/swipeable-row.tsx +109 -0
- package/src/components/switch.tsx +77 -0
- package/src/components/tab-bar.tsx +195 -0
- package/src/components/text-field.tsx +264 -0
- package/src/components/text.tsx +58 -0
- package/src/components/time-picker.tsx +277 -0
- package/src/components/toolbar.tsx +406 -0
- package/src/components/top-bar.tsx +91 -0
- package/src/components/undo-bar.tsx +137 -0
- package/src/components/wavy-progress.tsx +150 -0
- package/src/components/zoomable-image.tsx +240 -0
- package/src/expressive-shapes.ts +25 -0
- package/src/index.ts +62 -0
- package/src/keyboard.ts +5 -0
- package/src/material.ts +16 -0
- package/src/media.ts +51 -0
- package/src/motion.ts +96 -0
- package/src/platform.ts +13 -0
- package/src/preset-tokens.ts +265 -0
- package/src/provider.tsx +201 -0
- package/src/reduced-motion.ts +50 -0
- package/src/selection.ts +11 -0
- package/src/shape.ts +217 -0
- package/src/sheet-physics.ts +73 -0
- package/src/theme.ts +180 -0
- package/src/tokens.ts +2 -0
- package/src/use-keyboard-height.ts +64 -0
- package/src/utils.ts +7 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
export interface SliderProps {
|
|
4
|
+
value: number;
|
|
5
|
+
onValueChange: (value: number) => void;
|
|
6
|
+
onSlidingComplete?: (value: number) => void;
|
|
7
|
+
minimumValue?: number;
|
|
8
|
+
maximumValue?: number;
|
|
9
|
+
step?: number;
|
|
10
|
+
hapticStep?: number;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
accessibilityLabel: string;
|
|
13
|
+
valueLabel?: string;
|
|
14
|
+
leadingLabel?: string;
|
|
15
|
+
trailingLabel?: string;
|
|
16
|
+
style?: StyleProp<ViewStyle>;
|
|
17
|
+
activeColor?: string;
|
|
18
|
+
trackColor?: string;
|
|
19
|
+
thumbColor?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function Slider({ value, onValueChange, onSlidingComplete, minimumValue, maximumValue, step, hapticStep, disabled, accessibilityLabel, valueLabel, leadingLabel, trailingLabel, style, activeColor, trackColor, thumbColor, }: SliderProps): React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type MaterialOptions } from '../provider.tsx';
|
|
3
|
+
export interface SnackbarProps extends MaterialOptions {
|
|
4
|
+
message: string;
|
|
5
|
+
bottom?: number;
|
|
6
|
+
actionLabel?: string;
|
|
7
|
+
onAction?: () => void;
|
|
8
|
+
}
|
|
9
|
+
/** Visibility, duration and undo state belong to the caller. Solid is the reading-safe default. */
|
|
10
|
+
export declare function Snackbar({ message, bottom, actionLabel, onAction, material, glassStyle, tintColor, fallbackColor, interactive, }: SnackbarProps): React.JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type MaterialOptions } from '../provider.tsx';
|
|
3
|
+
/**
|
|
4
|
+
* Material 3 Expressive split button.
|
|
5
|
+
*
|
|
6
|
+
* One control holding a primary action and the variations on it: tapping the
|
|
7
|
+
* leading half does the obvious thing, tapping the trailing half offers the
|
|
8
|
+
* alternatives. It exists so the common case stays one tap while the rarer
|
|
9
|
+
* ones stop needing a separate button each.
|
|
10
|
+
*
|
|
11
|
+
* The trailing half is where the Expressive part lives — on activation its
|
|
12
|
+
* chevron spins and its outer corners morph from a pill to a small radius, so
|
|
13
|
+
* the button visibly *becomes* the open menu's anchor rather than just
|
|
14
|
+
* toggling a highlight.
|
|
15
|
+
*/
|
|
16
|
+
export interface SplitButtonAction {
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
destructive?: boolean;
|
|
19
|
+
id: string;
|
|
20
|
+
label: string;
|
|
21
|
+
icon: React.ComponentType<{
|
|
22
|
+
size?: number;
|
|
23
|
+
color?: string;
|
|
24
|
+
}>;
|
|
25
|
+
onPress: () => void;
|
|
26
|
+
}
|
|
27
|
+
export interface SplitButtonProps extends MaterialOptions {
|
|
28
|
+
menuMaterial?: MaterialOptions['material'];
|
|
29
|
+
label: string;
|
|
30
|
+
icon: React.ComponentType<{
|
|
31
|
+
size?: number;
|
|
32
|
+
color?: string;
|
|
33
|
+
}>;
|
|
34
|
+
onPress: () => void;
|
|
35
|
+
actions: SplitButtonAction[];
|
|
36
|
+
optionsLabel?: string;
|
|
37
|
+
}
|
|
38
|
+
export declare function SplitButton({ label, icon: Icon, onPress, actions, optionsLabel, material, menuMaterial, glassStyle, tintColor, fallbackColor, interactive, }: SplitButtonProps): React.JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type AnimatedStyle } from 'react-native-reanimated';
|
|
2
|
+
/**
|
|
3
|
+
* A card or tile giving a little under the finger and springing back on
|
|
4
|
+
* release, as Material 3 Expressive's components do — on top of the ripple,
|
|
5
|
+
* which only colours. Spread `handlers` on the Pressable and put `style` on
|
|
6
|
+
* the animated view around it. Under "Remove animations" the spring is
|
|
7
|
+
* Reanimated's, so the system's setting already stills it.
|
|
8
|
+
*/
|
|
9
|
+
export interface SquishFeedback {
|
|
10
|
+
style: AnimatedStyle<{
|
|
11
|
+
transform: {
|
|
12
|
+
scale: number;
|
|
13
|
+
}[];
|
|
14
|
+
}>;
|
|
15
|
+
handlers: {
|
|
16
|
+
onPressIn: () => void;
|
|
17
|
+
onPressOut: () => void;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare function useSquish(): SquishFeedback;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface SwipeAction {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
onPress: () => void;
|
|
6
|
+
destructive?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface SwipeableRowProps {
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
accessibilityLabel: string;
|
|
12
|
+
actionsLabel: string;
|
|
13
|
+
startActions?: SwipeAction[];
|
|
14
|
+
endActions?: SwipeAction[];
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
showActionsButton?: boolean;
|
|
17
|
+
onSwipeStart?: () => void;
|
|
18
|
+
onSwipeEnd?: () => void;
|
|
19
|
+
}
|
|
20
|
+
export declare function SwipeableRow({ children, accessibilityLabel, actionsLabel, startActions, endActions, disabled, showActionsButton, onSwipeStart, onSwipeEnd, }: SwipeableRowProps): React.JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface SwitchProps {
|
|
2
|
+
value: boolean;
|
|
3
|
+
onValueChange: (value: boolean) => void;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
accessibilityLabel?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Native switch geometry on each OS, with the app's shared colour roles. */
|
|
8
|
+
export declare function Switch({ value, onValueChange, disabled, accessibilityLabel }: SwitchProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import { type MaterialOptions } from '../provider.tsx';
|
|
4
|
+
import type { IconProps } from './icons.tsx';
|
|
5
|
+
export interface TabBarItem<T extends string> {
|
|
6
|
+
id: T;
|
|
7
|
+
label: string;
|
|
8
|
+
icon?: React.ComponentType<IconProps>;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
badge?: string | number;
|
|
11
|
+
}
|
|
12
|
+
export interface TabBarProps<T extends string> extends MaterialOptions {
|
|
13
|
+
items: TabBarItem<T>[];
|
|
14
|
+
value: T;
|
|
15
|
+
onChange: (value: T) => void;
|
|
16
|
+
accessibilityLabel?: string;
|
|
17
|
+
style?: StyleProp<ViewStyle>;
|
|
18
|
+
}
|
|
19
|
+
/** Controlled navigation UI: route handling belongs to the consuming app. */
|
|
20
|
+
export declare function TabBar<T extends string>({ items, value, onChange, accessibilityLabel, style, material, glassStyle, tintColor, fallbackColor, interactive, }: TabBarProps<T>): React.JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TextInput } from 'react-native';
|
|
3
|
+
type TextInputInstance = React.ElementRef<typeof TextInput>;
|
|
4
|
+
export type TextFieldProps = React.ComponentProps<typeof TextInput> & {
|
|
5
|
+
label: string;
|
|
6
|
+
/** Shown below the field in the error colour, which the border and label pick up too. */
|
|
7
|
+
error?: string | null;
|
|
8
|
+
/**
|
|
9
|
+
* The `bg-*` class of whatever surface the field sits on. The floated
|
|
10
|
+
* label needs an opaque patch behind it to mask the border line it
|
|
11
|
+
* overlaps, and that patch has to match the surface underneath — it
|
|
12
|
+
* defaults to the app's popover surface because every field so far lives
|
|
13
|
+
* in a dialog or sheet.
|
|
14
|
+
*/
|
|
15
|
+
notchClassName?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Material 3 Expressive outlined text field.
|
|
19
|
+
*
|
|
20
|
+
* The label rests inside the field, where a placeholder would sit, until
|
|
21
|
+
* there is a reason to move it — focus, or a value — at which point it
|
|
22
|
+
* floats up to overlap the border. Painting an opaque patch behind it there
|
|
23
|
+
* is the cheap way to get the M3 "notch": the alternative is clipping the
|
|
24
|
+
* border into two arcs, which this does not need.
|
|
25
|
+
*
|
|
26
|
+
* A placeholder is a hint for the empty field the reader is typing into, so
|
|
27
|
+
* it only shows once the label has floated out of its way; while the label
|
|
28
|
+
* rests inside the field the two would sit on top of each other.
|
|
29
|
+
*/
|
|
30
|
+
export declare const TextField: React.ForwardRefExoticComponent<TextFieldProps & React.RefAttributes<TextInputInstance>>;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Text as RNText } from 'react-native';
|
|
4
|
+
declare const textVariants: (props?: ({
|
|
5
|
+
variant?: "default" | "display" | "title" | "heading" | "subject" | "body" | "reader" | "muted" | "caption" | "labelLarge" | "label" | "mono" | "value" | "valueLarge" | "meta" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export type TextProps = React.ComponentProps<typeof RNText> & VariantProps<typeof textVariants>;
|
|
8
|
+
export declare function Text({ className, variant, style, ...props }: TextProps): React.JSX.Element;
|
|
9
|
+
export { textVariants };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type MaterialOptions } from '../provider.tsx';
|
|
3
|
+
export interface TimeOption {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface TimeChipsProps {
|
|
9
|
+
value: string | null;
|
|
10
|
+
onChange: (time: string) => void;
|
|
11
|
+
options: TimeOption[];
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function TimeChips({ value, onChange, options, disabled }: TimeChipsProps): React.JSX.Element;
|
|
15
|
+
export interface TimeGridProps {
|
|
16
|
+
value: string | null;
|
|
17
|
+
onChange: (time: string) => void;
|
|
18
|
+
hourLabel: string;
|
|
19
|
+
minuteLabel: string;
|
|
20
|
+
minuteStep?: number;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare function TimeGrid({ value, onChange, hourLabel, minuteLabel, minuteStep, disabled, }: TimeGridProps): React.JSX.Element;
|
|
24
|
+
export interface TimePickerSheetProps extends TimeGridProps, MaterialOptions {
|
|
25
|
+
visible: boolean;
|
|
26
|
+
onClose: () => void;
|
|
27
|
+
title: string;
|
|
28
|
+
confirmLabel: string;
|
|
29
|
+
clearLabel?: string;
|
|
30
|
+
onClear?: () => void;
|
|
31
|
+
presets?: TimeOption[];
|
|
32
|
+
onConfirm?: (time: string) => void;
|
|
33
|
+
}
|
|
34
|
+
export declare function TimePickerSheet({ visible, onClose, title, confirmLabel, clearLabel, onClear, presets, onConfirm, material, glassStyle, tintColor, fallbackColor, interactive, ...grid }: TimePickerSheetProps): React.JSX.Element;
|
|
35
|
+
export interface TimeFieldProps extends Omit<TimePickerSheetProps, 'visible' | 'onClose' | 'title' | 'onChange' | 'onClear'> {
|
|
36
|
+
label: string;
|
|
37
|
+
emptyLabel: string;
|
|
38
|
+
onChange: (time: string | null) => void;
|
|
39
|
+
}
|
|
40
|
+
export declare function TimeField({ label, emptyLabel, onChange, ...props }: TimeFieldProps): React.JSX.Element;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ViewProps, type ViewStyle, type NativeScrollEvent, type NativeSyntheticEvent } from 'react-native';
|
|
3
|
+
import Animated, { type AnimatedStyle } from 'react-native-reanimated';
|
|
4
|
+
import type { IconProps } from './icons.tsx';
|
|
5
|
+
import { type MaterialOptions } from '../provider.tsx';
|
|
6
|
+
export interface ToolbarItem {
|
|
7
|
+
id: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
icon: React.ComponentType<IconProps>;
|
|
10
|
+
label: string;
|
|
11
|
+
onPress: () => void;
|
|
12
|
+
/** Overrides the icon colour, for a state like "starred". */
|
|
13
|
+
color?: string;
|
|
14
|
+
/** Filled icons read as "on" for toggles. */
|
|
15
|
+
fill?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Marks the item as the one currently in charge — a tool whose own panel is
|
|
18
|
+
* open, rather than a value that is set. It takes the container tone and
|
|
19
|
+
* squares its corners off, which is how M3 separates a selected toggle from
|
|
20
|
+
* its neighbours without adding a second row of chrome.
|
|
21
|
+
*/
|
|
22
|
+
active?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Colours the rule the icon already draws — the bar under the A, under the
|
|
25
|
+
* pen — with the colour the item would apply. Only symbols that carry one
|
|
26
|
+
* have anything to colour.
|
|
27
|
+
*/
|
|
28
|
+
rule?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Renders the item as the toolbar's primary action: a filled pill that
|
|
31
|
+
* shows its label instead of relying on the icon alone. At most one.
|
|
32
|
+
*/
|
|
33
|
+
prominent?: boolean;
|
|
34
|
+
/** A count to overlay on the icon. Zero and below draw nothing. */
|
|
35
|
+
badge?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface ToolbarProps extends MaterialOptions {
|
|
38
|
+
items: ToolbarItem[];
|
|
39
|
+
children?: React.ReactNode;
|
|
40
|
+
material?: 'auto' | 'glass' | 'solid';
|
|
41
|
+
className?: string;
|
|
42
|
+
/** Motion from `useToolbarAutoHide`, when the toolbar scrolls away. */
|
|
43
|
+
style?: React.ComponentProps<typeof Animated.View>['style'];
|
|
44
|
+
/** Slims the pill down around the same targets — see `COMPACT_TOOLBAR_HEIGHT`. */
|
|
45
|
+
compact?: boolean;
|
|
46
|
+
}
|
|
47
|
+
export declare function Toolbar(props: ToolbarProps | ToolbarContainerProps): React.JSX.Element;
|
|
48
|
+
/**
|
|
49
|
+
* Scrolls the toolbar away downwards, and brings it back on the way up.
|
|
50
|
+
*
|
|
51
|
+
* The point of a floating toolbar is that it is a layer over the content
|
|
52
|
+
* rather than a permanent border around it — so it gets out of the way while
|
|
53
|
+
* the user is reading, and returns the moment they reverse, without having to
|
|
54
|
+
* reach the top of the list first.
|
|
55
|
+
*
|
|
56
|
+
* The scroll handler is a plain JS one on purpose: it only writes shared
|
|
57
|
+
* values, so it never re-renders the screen, and it works on `FlashList`
|
|
58
|
+
* without wrapping the list in `Animated.createAnimatedComponent`.
|
|
59
|
+
*
|
|
60
|
+
* @param travel How far down to send it — far enough to clear the screen edge,
|
|
61
|
+
* so a hidden toolbar cannot be tapped.
|
|
62
|
+
*/
|
|
63
|
+
export interface ToolbarAutoHide {
|
|
64
|
+
onScroll: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
65
|
+
style: AnimatedStyle<ViewStyle>;
|
|
66
|
+
}
|
|
67
|
+
export declare function useToolbarAutoHide(travel: number): ToolbarAutoHide;
|
|
68
|
+
export interface ToolbarContainerProps extends ViewProps, MaterialOptions {
|
|
69
|
+
/** Floating navigation uses glass on supported iOS when a surface adapter is supplied. */
|
|
70
|
+
material?: 'auto' | 'glass' | 'solid';
|
|
71
|
+
}
|
|
72
|
+
export interface NavigationBarProps extends ToolbarContainerProps {
|
|
73
|
+
title: string;
|
|
74
|
+
leading?: React.ReactNode;
|
|
75
|
+
trailing?: React.ReactNode;
|
|
76
|
+
}
|
|
77
|
+
export declare function NavigationBar({ title, leading, trailing, ...props }: NavigationBarProps): React.JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type MaterialOptions } from '../provider.tsx';
|
|
3
|
+
/**
|
|
4
|
+
* The bar every screen below the tabs opens with: the back arrow 8 from the
|
|
5
|
+
* edge, the screen's own buttons at the other end, and, when a screen wants
|
|
6
|
+
* one, something small in between (a position, a step). One height, one
|
|
7
|
+
* inset, so moving between screens moves nothing at the top. The status
|
|
8
|
+
* bar's room is the screen's: it knows whether it draws under it.
|
|
9
|
+
*/
|
|
10
|
+
export interface TopBarProps extends MaterialOptions {
|
|
11
|
+
onBack: () => void;
|
|
12
|
+
backLabel?: string;
|
|
13
|
+
center?: React.ReactNode;
|
|
14
|
+
actions?: React.ReactNode;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function TopBar({ onBack, center, actions, backLabel, className, material, glassStyle, tintColor, fallbackColor, interactive, }: TopBarProps): React.JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* A screen's name under its bar: the emphasized title, 16 from the edge, and
|
|
20
|
+
* a line about it. The same on every screen, so a title is where the eye
|
|
21
|
+
* expects it.
|
|
22
|
+
*/
|
|
23
|
+
export declare function ScreenTitle({ title, caption, className, }: {
|
|
24
|
+
title: string;
|
|
25
|
+
caption?: React.ReactNode;
|
|
26
|
+
className?: string;
|
|
27
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type MaterialOptions } from '../provider.tsx';
|
|
3
|
+
import { type WavyProgressProps } from './wavy-progress.tsx';
|
|
4
|
+
export interface UndoBarProps extends MaterialOptions {
|
|
5
|
+
message: string;
|
|
6
|
+
actionLabel: string;
|
|
7
|
+
dismissLabel: string;
|
|
8
|
+
onUndo: () => void;
|
|
9
|
+
onDismiss: () => void;
|
|
10
|
+
/** Time supplied by the app's undo clock. This component never executes/expiries undo entries. */
|
|
11
|
+
remainingMs: number;
|
|
12
|
+
totalMs: number;
|
|
13
|
+
progress?: WavyProgressProps['progress'];
|
|
14
|
+
paused?: boolean;
|
|
15
|
+
onPause?: () => void;
|
|
16
|
+
onResume?: () => void;
|
|
17
|
+
collapsed?: boolean;
|
|
18
|
+
onExpand?: () => void;
|
|
19
|
+
countLabel?: string;
|
|
20
|
+
showDismissButton?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** A feedback surface only; queue, expiry, collapse policy and screen clearance belong to the app. */
|
|
23
|
+
export declare function UndoBar({ message, actionLabel, dismissLabel, onUndo, onDismiss, remainingMs, totalMs, progress: suppliedProgress, paused, onPause, onResume, collapsed, onExpand, countLabel, showDismissButton, material, glassStyle, tintColor, fallbackColor, interactive, }: UndoBarProps): React.JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type SharedValue } from 'react-native-reanimated';
|
|
3
|
+
/**
|
|
4
|
+
* The Expressive determinate progress indicator: the part done is a wave,
|
|
5
|
+
* the part left a flat track, with a gap between them.
|
|
6
|
+
*
|
|
7
|
+
* The wave calms down towards either end — it is flat at nothing done and
|
|
8
|
+
* flat again at all done, so a finished list reads as finished, not busy.
|
|
9
|
+
* While something is underway the wave travels slowly; under "Remove
|
|
10
|
+
* animations" it stands still, and a change of progress arrives at once.
|
|
11
|
+
*/
|
|
12
|
+
export interface WavyProgressProps {
|
|
13
|
+
/** 0 to 1. */
|
|
14
|
+
progress: number | SharedValue<number>;
|
|
15
|
+
height?: number;
|
|
16
|
+
color?: string;
|
|
17
|
+
trackColor?: string;
|
|
18
|
+
/** A still wave, for small previews where motion would only distract. */
|
|
19
|
+
animated?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function WavyProgress({ progress, color, trackColor, animated, height, }: WavyProgressProps): React.JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MaterialOptions } from '../provider.tsx';
|
|
3
|
+
/** Material options apply to the floating zoom controls, never the image. */
|
|
4
|
+
export interface ZoomableImageProps extends MaterialOptions {
|
|
5
|
+
uri: string;
|
|
6
|
+
accessibilityLabel: string;
|
|
7
|
+
onTap?: () => void;
|
|
8
|
+
onDismiss?: () => void;
|
|
9
|
+
maximumScale?: number;
|
|
10
|
+
labels: {
|
|
11
|
+
zoomIn: string;
|
|
12
|
+
zoomOut: string;
|
|
13
|
+
reset: string;
|
|
14
|
+
error?: string;
|
|
15
|
+
};
|
|
16
|
+
renderImage?: (onLoad: (width: number, height: number) => void, onError: () => void) => React.ReactNode;
|
|
17
|
+
}
|
|
18
|
+
export declare function ZoomableImage({ uri, accessibilityLabel, onTap, onDismiss, maximumScale, labels, renderImage, material, glassStyle, tintColor, fallbackColor, interactive, }: ZoomableImageProps): React.JSX.Element;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export * from './provider.tsx';
|
|
2
|
+
export * from './theme.ts';
|
|
3
|
+
export * from './tokens.ts';
|
|
4
|
+
export type { IconProps } from './components/icons.tsx';
|
|
5
|
+
export * from './components/button.tsx';
|
|
6
|
+
export * from './components/button-group.tsx';
|
|
7
|
+
export * from './components/filter-chip.tsx';
|
|
8
|
+
export * from './components/icon-button.tsx';
|
|
9
|
+
export * from './components/loading-indicator.tsx';
|
|
10
|
+
export * from './components/text-field.tsx';
|
|
11
|
+
export * from './components/wavy-progress.tsx';
|
|
12
|
+
export * from './components/menu-sheet.tsx';
|
|
13
|
+
export * from './components/select-field.tsx';
|
|
14
|
+
export * from './components/expressive-shape.tsx';
|
|
15
|
+
export * from './components/squish.ts';
|
|
16
|
+
export * from './components/row-gap.tsx';
|
|
17
|
+
export * from './components/back-icon.tsx';
|
|
18
|
+
export * from './components/pressable.tsx';
|
|
19
|
+
export * from './components/switch.tsx';
|
|
20
|
+
export * from './components/dialog.tsx';
|
|
21
|
+
export * from './components/bottom-sheet.tsx';
|
|
22
|
+
export * from './components/sheet-transition.ts';
|
|
23
|
+
export * from './components/search-field.tsx';
|
|
24
|
+
export * from './components/text.tsx';
|
|
25
|
+
export * from './components/badge.tsx';
|
|
26
|
+
export * from './components/expand-indicator.tsx';
|
|
27
|
+
export * from './components/refresh-control.tsx';
|
|
28
|
+
export * from './components/keyboard-inset-view.tsx';
|
|
29
|
+
export * from './components/back-button.tsx';
|
|
30
|
+
export * from './components/input.tsx';
|
|
31
|
+
export * from './components/toolbar.tsx';
|
|
32
|
+
export * from './components/split-button.tsx';
|
|
33
|
+
export * from './components/top-bar.tsx';
|
|
34
|
+
export * from './components/sheet-frame.tsx';
|
|
35
|
+
export * from './components/panel-sheet.tsx';
|
|
36
|
+
export * from './components/settings-list.tsx';
|
|
37
|
+
export * from './components/empty-state.tsx';
|
|
38
|
+
export * from './components/snackbar.tsx';
|
|
39
|
+
export * from './components/settings-row.tsx';
|
|
40
|
+
export * from './components/fab-menu.tsx';
|
|
41
|
+
export { usesPlatformMaterial } from './material.ts';
|
|
42
|
+
export * from './components/tab-bar.tsx';
|
|
43
|
+
export * from './components/popover.tsx';
|
|
44
|
+
export * from './components/context-menu.tsx';
|
|
45
|
+
export * from './components/floating-action-button.tsx';
|
|
46
|
+
export { spatial } from './motion.ts';
|
|
47
|
+
export { useReducedMotion } from './reduced-motion.ts';
|
|
48
|
+
export * from './components/checkbox.tsx';
|
|
49
|
+
export * from './components/avatar.tsx';
|
|
50
|
+
export * from './components/slider.tsx';
|
|
51
|
+
export * from './components/action-chip.tsx';
|
|
52
|
+
export * from './components/color-picker.tsx';
|
|
53
|
+
export * from './components/amount-field.tsx';
|
|
54
|
+
export * from './components/date-picker.tsx';
|
|
55
|
+
export * from './components/time-picker.tsx';
|
|
56
|
+
export * from './components/banner.tsx';
|
|
57
|
+
export * from './components/undo-bar.tsx';
|
|
58
|
+
export * from './components/list-controls.tsx';
|
|
59
|
+
export * from './components/swipeable-row.tsx';
|
|
60
|
+
export * from './components/zoomable-image.tsx';
|
|
61
|
+
export { parseLocalizedAmount, formatLocalizedAmount } from './amount.ts';
|
|
62
|
+
export { validDate, validTime, addDays, addMonths, monthDays, formatCalendarDate } from './calendar.ts';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Shared across core controls and the optional native material adapter. */
|
|
2
|
+
export interface MaterialOptions {
|
|
3
|
+
material?: 'auto' | 'glass' | 'solid';
|
|
4
|
+
glassStyle?: 'regular' | 'clear';
|
|
5
|
+
tintColor?: string;
|
|
6
|
+
fallbackColor?: string;
|
|
7
|
+
/** Enables material interaction, not an action handler. */
|
|
8
|
+
interactive?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** Surface requests are platform-aware; explicit solid always wins. */
|
|
11
|
+
export declare function usesPlatformMaterial(platform: string, material?: MaterialOptions['material']): boolean;
|
package/dist/media.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function clampZoom(value: number, maximum?: number): number;
|
|
2
|
+
/** Pan limits for a contained image, rather than the larger bounds of a cover image. */
|
|
3
|
+
export declare function imagePanBounds(width: number, height: number, aspect: number, scale: number): {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
};
|
|
7
|
+
/** RN uses source dimensions; React Native Web forwards the DOM image load event. */
|
|
8
|
+
export declare function imageDimensions(event: unknown): {
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
} | null;
|
package/dist/motion.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Material 3 Expressive motion physics.
|
|
3
|
+
*
|
|
4
|
+
* Expressive replaced M3's duration-and-easing curves with springs. A spring
|
|
5
|
+
* has no fixed duration: it is described by how hard it pulls (stiffness) and
|
|
6
|
+
* how quickly it stops wobbling (damping ratio), and it re-targets mid-flight
|
|
7
|
+
* instead of restarting. That is what makes an interrupted gesture feel like
|
|
8
|
+
* an object being redirected rather than an animation being cancelled.
|
|
9
|
+
*
|
|
10
|
+
* Two families, and they are not interchangeable:
|
|
11
|
+
*
|
|
12
|
+
* - **Spatial** springs move things — position, size, shape, rotation. They
|
|
13
|
+
* are under-damped (ratio < 1) so they overshoot slightly and settle back.
|
|
14
|
+
* - **Effects** springs change appearance — color, opacity, elevation. They
|
|
15
|
+
* are critically damped (ratio = 1), because a colour that overshoots reads
|
|
16
|
+
* as a flicker, not as weight.
|
|
17
|
+
*
|
|
18
|
+
* The values below are the *expressive* motion scheme. The standard scheme is
|
|
19
|
+
* stiffer and flatter; expressive trades a few milliseconds of settle time for
|
|
20
|
+
* motion you can actually feel. This app uses it everywhere.
|
|
21
|
+
*/
|
|
22
|
+
export interface SpringToken {
|
|
23
|
+
/** 1 = critically damped (no overshoot); below 1 overshoots and settles. */
|
|
24
|
+
dampingRatio: number;
|
|
25
|
+
stiffness: number;
|
|
26
|
+
}
|
|
27
|
+
/** Movement: bounds, offset, scale, shape. Slightly under-damped. */
|
|
28
|
+
export declare const spatialTokens: {
|
|
29
|
+
readonly fast: {
|
|
30
|
+
readonly dampingRatio: 0.6;
|
|
31
|
+
readonly stiffness: 800;
|
|
32
|
+
};
|
|
33
|
+
readonly default: {
|
|
34
|
+
readonly dampingRatio: 0.8;
|
|
35
|
+
readonly stiffness: 380;
|
|
36
|
+
};
|
|
37
|
+
readonly slow: {
|
|
38
|
+
readonly dampingRatio: 0.8;
|
|
39
|
+
readonly stiffness: 200;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
/** Appearance: color, opacity, elevation. Critically damped. */
|
|
43
|
+
export declare const effectsTokens: {
|
|
44
|
+
readonly fast: {
|
|
45
|
+
readonly dampingRatio: 1;
|
|
46
|
+
readonly stiffness: 3800;
|
|
47
|
+
};
|
|
48
|
+
readonly default: {
|
|
49
|
+
readonly dampingRatio: 1;
|
|
50
|
+
readonly stiffness: 1600;
|
|
51
|
+
};
|
|
52
|
+
readonly slow: {
|
|
53
|
+
readonly dampingRatio: 1;
|
|
54
|
+
readonly stiffness: 800;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export interface SpringConfig {
|
|
58
|
+
mass: number;
|
|
59
|
+
stiffness: number;
|
|
60
|
+
damping: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Converts an M3 spring token to the physical constants Reanimated wants.
|
|
64
|
+
*
|
|
65
|
+
* M3 specifies a damping *ratio* — dimensionless, and therefore stable across
|
|
66
|
+
* stiffness changes — while Reanimated's physics springs take an absolute
|
|
67
|
+
* damping coefficient. The two are related by `c = 2ζ√(km)`, so a token can be
|
|
68
|
+
* retuned by stiffness alone without accidentally changing its bounciness.
|
|
69
|
+
*/
|
|
70
|
+
export declare function springConfig(token: SpringToken, mass?: number): SpringConfig;
|
|
71
|
+
/** Ready-made configs, so call sites read as `spatial.fast` not as numbers. */
|
|
72
|
+
export declare const spatial: {
|
|
73
|
+
readonly fast: SpringConfig;
|
|
74
|
+
readonly default: SpringConfig;
|
|
75
|
+
readonly slow: SpringConfig;
|
|
76
|
+
};
|
|
77
|
+
export declare const effects: {
|
|
78
|
+
readonly fast: SpringConfig;
|
|
79
|
+
readonly default: SpringConfig;
|
|
80
|
+
readonly slow: SpringConfig;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Stagger between items in a group that animates in together (FAB menu items,
|
|
84
|
+
* toolbar contents). Expressive sequences items rather than moving them as one
|
|
85
|
+
* block — the offset is what makes a menu feel unfolded instead of pasted on.
|
|
86
|
+
*/
|
|
87
|
+
export declare const STAGGER_MS = 28;
|
|
88
|
+
/**
|
|
89
|
+
* The stagger to actually use, given the reader's motion preference.
|
|
90
|
+
*
|
|
91
|
+
* Collapses to zero under "Remove animations": a sequence unfolding is the
|
|
92
|
+
* effect itself, and with nothing moving, a delay is only a row arriving late
|
|
93
|
+
* for no visible reason. Here rather than in `~/lib/reduced-motion` so it
|
|
94
|
+
* stays free of Reanimated and testable under `node --test`.
|
|
95
|
+
*/
|
|
96
|
+
export declare function staggerFor(reduced: boolean, stagger?: number): number;
|