glacia-native 0.4.0 → 0.5.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/lib/module/Bars.js +176 -0
- package/lib/module/Carousel.js +103 -0
- package/lib/module/Display.js +240 -0
- package/lib/module/Feedback.js +172 -0
- package/lib/module/Forms2.js +227 -0
- package/lib/module/Overlays.js +166 -0
- package/lib/module/Pickers.js +243 -0
- package/lib/module/Text.js +37 -0
- package/lib/module/index.js +58 -1
- package/lib/module/internal/GlassView.js +23 -7
- package/lib/module/internal/primitives.js +7 -2
- package/lib/module/internal/tokens.js +55 -1
- package/lib/typescript/Bars.d.ts +121 -0
- package/lib/typescript/Carousel.d.ts +47 -0
- package/lib/typescript/Display.d.ts +119 -0
- package/lib/typescript/Feedback.d.ts +138 -0
- package/lib/typescript/Forms2.d.ts +128 -0
- package/lib/typescript/Glass.d.ts +1 -1
- package/lib/typescript/Overlays.d.ts +105 -0
- package/lib/typescript/Pickers.d.ts +105 -0
- package/lib/typescript/Text.d.ts +28 -0
- package/lib/typescript/index.d.ts +9 -1
- package/lib/typescript/internal/GlassView.d.ts +10 -1
- package/lib/typescript/internal/tokens.d.ts +61 -0
- package/package.json +2 -2
- package/src/Bars.tsx +570 -0
- package/src/Carousel.tsx +233 -0
- package/src/Display.tsx +550 -0
- package/src/Feedback.tsx +579 -0
- package/src/Forms2.tsx +608 -0
- package/src/Overlays.tsx +474 -0
- package/src/Pickers.tsx +590 -0
- package/src/Text.tsx +83 -0
- package/src/index.ts +101 -1
- package/src/internal/GlassView.tsx +29 -7
- package/src/internal/primitives.ts +7 -2
- package/src/internal/tokens.ts +62 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
export interface CarouselProps {
|
|
4
|
+
/** One node per page. */
|
|
5
|
+
slides: ReactNode[];
|
|
6
|
+
/** Controlled page. Omit and the carousel tracks itself. */
|
|
7
|
+
index?: number;
|
|
8
|
+
defaultIndex?: number;
|
|
9
|
+
/** Fires when a swipe settles on a new page. */
|
|
10
|
+
onIndexChange?: (index: number) => void;
|
|
11
|
+
/** Gap between pages, so neighbours peek at the edges. */
|
|
12
|
+
gap?: number;
|
|
13
|
+
style?: StyleProp<ViewStyle>;
|
|
14
|
+
isDark?: boolean;
|
|
15
|
+
testID?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A horizontally paging swiper.
|
|
19
|
+
*
|
|
20
|
+
* It rides the resolver's ScrollView with `pagingEnabled`, so the paging feel is
|
|
21
|
+
* the platform's own and the pages are plain content the caller supplies. The
|
|
22
|
+
* active page is derived from the scroll offset, which is also what reports
|
|
23
|
+
* `onIndexChange`.
|
|
24
|
+
*/
|
|
25
|
+
export declare const Carousel: import("react").ForwardRefExoticComponent<CarouselProps & import("react").RefAttributes<any>>;
|
|
26
|
+
export interface PageControlProps {
|
|
27
|
+
count: number;
|
|
28
|
+
/** Controlled active page. Omit and the control keeps its own. */
|
|
29
|
+
activeIndex?: number;
|
|
30
|
+
defaultActiveIndex?: number;
|
|
31
|
+
/** Called when a dot is tapped. */
|
|
32
|
+
onChange?: (index: number) => void;
|
|
33
|
+
/** Tint the active dot; defaults to the theme accent. */
|
|
34
|
+
tint?: string;
|
|
35
|
+
/** Hide the dots when there is only one page. */
|
|
36
|
+
hidesForSinglePage?: boolean;
|
|
37
|
+
style?: StyleProp<ViewStyle>;
|
|
38
|
+
isDark?: boolean;
|
|
39
|
+
testID?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The page dots.
|
|
43
|
+
*
|
|
44
|
+
* The active dot elongates and the others stay narrow, which is how iOS reads
|
|
45
|
+
* "you are here". The width change runs on the springs token through Animated.
|
|
46
|
+
*/
|
|
47
|
+
export declare const PageControl: import("react").ForwardRefExoticComponent<PageControlProps & import("react").RefAttributes<any>>;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
export type AvatarSize = "sm" | "md" | "lg";
|
|
4
|
+
export interface AvatarProps {
|
|
5
|
+
/** Image to show. When absent, or when it fails to load, initials render. */
|
|
6
|
+
source?: {
|
|
7
|
+
uri: string;
|
|
8
|
+
} | number;
|
|
9
|
+
/** The person's name: initials are derived from it when no image loads. */
|
|
10
|
+
name?: string;
|
|
11
|
+
size?: AvatarSize;
|
|
12
|
+
/** Draws a status dot in the corner. */
|
|
13
|
+
status?: "online" | "offline" | "busy";
|
|
14
|
+
style?: StyleProp<ViewStyle>;
|
|
15
|
+
isDark?: boolean;
|
|
16
|
+
testID?: string;
|
|
17
|
+
}
|
|
18
|
+
/** First letters of the first and last word, as an avatar fallback. */
|
|
19
|
+
export declare function initialsOf(name: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* A person or entity: their picture, or their initials when there is none.
|
|
22
|
+
*
|
|
23
|
+
* The frame is Glacia's glass so it belongs to the same family as the rest of
|
|
24
|
+
* the library; the initials sit on it in the theme's foreground colour.
|
|
25
|
+
*/
|
|
26
|
+
export declare const Avatar: import("react").ForwardRefExoticComponent<AvatarProps & import("react").RefAttributes<any>>;
|
|
27
|
+
export interface BadgeProps {
|
|
28
|
+
/** The count or short label. Omit to render a plain dot. */
|
|
29
|
+
children?: ReactNode;
|
|
30
|
+
/** Draws the badge in the destructive tone (unread, errors). */
|
|
31
|
+
tone?: "fill" | "destructive" | "success" | "muted";
|
|
32
|
+
/** The element to overlay. Supplying it puts the badge in the corner. */
|
|
33
|
+
overlay?: ReactNode;
|
|
34
|
+
style?: StyleProp<ViewStyle>;
|
|
35
|
+
isDark?: boolean;
|
|
36
|
+
testID?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A small count or dot.
|
|
40
|
+
*
|
|
41
|
+
* Deliberately not glass: a badge is a micro-element, and a translucent 16pt
|
|
42
|
+
* chip loses its contrast against whatever it sits on. It uses the solid theme
|
|
43
|
+
* tint instead, which is what makes it legible in both themes.
|
|
44
|
+
*/
|
|
45
|
+
export declare const Badge: import("react").ForwardRefExoticComponent<BadgeProps & import("react").RefAttributes<any>>;
|
|
46
|
+
export interface SeparatorProps {
|
|
47
|
+
orientation?: "horizontal" | "vertical";
|
|
48
|
+
/** Inset from the leading edge, matching a list row's leading accessory. */
|
|
49
|
+
inset?: number;
|
|
50
|
+
style?: StyleProp<ViewStyle>;
|
|
51
|
+
isDark?: boolean;
|
|
52
|
+
testID?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A hairline divider in the theme's separator colour.
|
|
56
|
+
*
|
|
57
|
+
* A plain View rather than a Glass: a 1pt rule is not a surface, and glass on
|
|
58
|
+
* a line has nothing to refract.
|
|
59
|
+
*/
|
|
60
|
+
export declare const Separator: import("react").ForwardRefExoticComponent<SeparatorProps & import("react").RefAttributes<any>>;
|
|
61
|
+
export interface SkeletonProps {
|
|
62
|
+
/** Rectangles for cards and rows, circles for avatars, lines for a run of text. */
|
|
63
|
+
shape?: "rect" | "circle" | "line";
|
|
64
|
+
width?: number | string;
|
|
65
|
+
height?: number;
|
|
66
|
+
style?: StyleProp<ViewStyle>;
|
|
67
|
+
isDark?: boolean;
|
|
68
|
+
testID?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A loading placeholder.
|
|
72
|
+
*
|
|
73
|
+
* The pulse is opacity only and slow, on the gentle spring, so it reads as
|
|
74
|
+
* "loading" without motion that could bother someone sensitive to movement.
|
|
75
|
+
* Nothing about it is essential to understanding the screen, so it is hidden
|
|
76
|
+
* from screen readers rather than announced.
|
|
77
|
+
*/
|
|
78
|
+
export declare const Skeleton: import("react").ForwardRefExoticComponent<SkeletonProps & import("react").RefAttributes<any>>;
|
|
79
|
+
export type SpinnerSize = "sm" | "md" | "lg";
|
|
80
|
+
export interface SpinnerProps {
|
|
81
|
+
size?: SpinnerSize;
|
|
82
|
+
/** Spinner colour; defaults to the theme's muted foreground. */
|
|
83
|
+
tint?: string;
|
|
84
|
+
/** Announced to screen readers, since a spinner alone has no text. */
|
|
85
|
+
accessibilityLabel?: string;
|
|
86
|
+
style?: StyleProp<ViewStyle>;
|
|
87
|
+
isDark?: boolean;
|
|
88
|
+
testID?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A loading spinner, drawn by Glacia.
|
|
92
|
+
*
|
|
93
|
+
* An SVG arc that rotates on the gentle spring through Animated — not the
|
|
94
|
+
* platform's ActivityIndicator, so it looks the same on every platform and
|
|
95
|
+
* wears the theme's colour instead of inheriting the system tint.
|
|
96
|
+
*/
|
|
97
|
+
export declare const Spinner: import("react").ForwardRefExoticComponent<SpinnerProps & import("react").RefAttributes<any>>;
|
|
98
|
+
export type ProgressVariant = "bar" | "ring";
|
|
99
|
+
export interface ProgressProps {
|
|
100
|
+
/** 0–100. Values outside the range are clamped rather than drawn wrong. */
|
|
101
|
+
value: number;
|
|
102
|
+
variant?: ProgressVariant;
|
|
103
|
+
/** Overrides the fill colour; defaults to the theme accent. */
|
|
104
|
+
tint?: string;
|
|
105
|
+
/** Announced by screen readers, e.g. "Uploading photo". */
|
|
106
|
+
accessibilityLabel?: string;
|
|
107
|
+
style?: StyleProp<ViewStyle>;
|
|
108
|
+
isDark?: boolean;
|
|
109
|
+
testID?: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Progress, linear or circular.
|
|
113
|
+
*
|
|
114
|
+
* The track is a glass surface, so it refracts what it sits on exactly like the
|
|
115
|
+
* rest of the library; the fill is the theme accent. Both forms report
|
|
116
|
+
* `progressbar` with a value, which is the contract NativeTask relies on
|
|
117
|
+
* internally — this component generalises it.
|
|
118
|
+
*/
|
|
119
|
+
export declare const Progress: import("react").ForwardRefExoticComponent<ProgressProps & import("react").RefAttributes<any>>;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
import { type Tone } from "./internal/tokens";
|
|
4
|
+
export interface ToastAction {
|
|
5
|
+
label: string;
|
|
6
|
+
onPress: () => void;
|
|
7
|
+
}
|
|
8
|
+
export interface ToastProps {
|
|
9
|
+
/** Controlled visibility. Omit it and the toast keeps its own state. */
|
|
10
|
+
visible?: boolean;
|
|
11
|
+
defaultVisible?: boolean;
|
|
12
|
+
onDismiss?: () => void;
|
|
13
|
+
message: string;
|
|
14
|
+
/** One optional action, e.g. Undo. */
|
|
15
|
+
action?: ToastAction;
|
|
16
|
+
/** A leading icon (an SVG node the caller supplies). */
|
|
17
|
+
icon?: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Milliseconds before it dismisses itself. 0 keeps it until dismissed.
|
|
20
|
+
* The timer is cleared on unmount as well as on dismiss.
|
|
21
|
+
*/
|
|
22
|
+
duration?: number;
|
|
23
|
+
tone?: Tone | "neutral";
|
|
24
|
+
style?: StyleProp<ViewStyle>;
|
|
25
|
+
isDark?: boolean;
|
|
26
|
+
testID?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A transient message on a glass pill.
|
|
30
|
+
*
|
|
31
|
+
* A toast is not a dialog: it never blocks the screen, so it renders in place
|
|
32
|
+
* and lets touches through to what is underneath. It dismisses itself after
|
|
33
|
+
* `duration` unless it is controlled or `duration` is 0.
|
|
34
|
+
*/
|
|
35
|
+
export declare const Toast: import("react").ForwardRefExoticComponent<ToastProps & import("react").RefAttributes<any>>;
|
|
36
|
+
export interface BannerProps {
|
|
37
|
+
title?: string;
|
|
38
|
+
message: string;
|
|
39
|
+
tone?: Tone;
|
|
40
|
+
/** A leading icon node. */
|
|
41
|
+
icon?: ReactNode;
|
|
42
|
+
/** Shows a dismiss button when provided. */
|
|
43
|
+
onDismiss?: () => void;
|
|
44
|
+
/** A single inline action, e.g. Retry. */
|
|
45
|
+
action?: ToastAction;
|
|
46
|
+
style?: StyleProp<ViewStyle>;
|
|
47
|
+
isDark?: boolean;
|
|
48
|
+
testID?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* An inline alert.
|
|
52
|
+
*
|
|
53
|
+
* Unlike AlertDialog it is not modal and not an overlay: it sits in the layout
|
|
54
|
+
* and pushes the content below it down. The surface is glass with the tone's
|
|
55
|
+
* colour as its edge, so the tone reads at a glance without turning the whole
|
|
56
|
+
* panel into a solid block of colour.
|
|
57
|
+
*/
|
|
58
|
+
export declare const Banner: import("react").ForwardRefExoticComponent<BannerProps & import("react").RefAttributes<any>>;
|
|
59
|
+
export interface ListItemProps {
|
|
60
|
+
/** An avatar, icon or other leading node. */
|
|
61
|
+
leading?: ReactNode;
|
|
62
|
+
/** The row's main text. */
|
|
63
|
+
title: string;
|
|
64
|
+
/** Secondary line under the title. */
|
|
65
|
+
description?: string;
|
|
66
|
+
/** A value text, a control, or any trailing node. */
|
|
67
|
+
trailing?: ReactNode;
|
|
68
|
+
/** Draws a chevron when the row is tappable and nothing else trails it. */
|
|
69
|
+
chevron?: boolean;
|
|
70
|
+
onPress?: () => void;
|
|
71
|
+
disabled?: boolean;
|
|
72
|
+
selected?: boolean;
|
|
73
|
+
style?: StyleProp<ViewStyle>;
|
|
74
|
+
isDark?: boolean;
|
|
75
|
+
testID?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* One row of a List.
|
|
79
|
+
*
|
|
80
|
+
* The row is a Pressable when it has an `onPress`, and inert otherwise, which
|
|
81
|
+
* is what the platform expects: a row that does nothing should not announce
|
|
82
|
+
* itself as a button. The chevron is decoration and is hidden from screen
|
|
83
|
+
* readers, since the row's own role already says it is tappable.
|
|
84
|
+
*/
|
|
85
|
+
export declare const ListItem: import("react").ForwardRefExoticComponent<ListItemProps & import("react").RefAttributes<any>>;
|
|
86
|
+
export interface ListProps {
|
|
87
|
+
children?: ReactNode;
|
|
88
|
+
/** Renders the rows on one glass panel with separators between them. */
|
|
89
|
+
inset?: boolean;
|
|
90
|
+
style?: StyleProp<ViewStyle>;
|
|
91
|
+
isDark?: boolean;
|
|
92
|
+
testID?: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* A grouped list of rows — the backbone of settings and profile screens.
|
|
96
|
+
*
|
|
97
|
+
* With `inset`, the rows sit on one glass panel with hairline separators, which
|
|
98
|
+
* is the shape iOS settings screens use. The separators are drawn by the
|
|
99
|
+
* caller's ListItem spacing rather than by nesting glass inside glass.
|
|
100
|
+
*/
|
|
101
|
+
export declare const List: import("react").ForwardRefExoticComponent<ListProps & import("react").RefAttributes<any>>;
|
|
102
|
+
/** A titled group of rows, e.g. "Account" above its settings. */
|
|
103
|
+
export interface ListSectionProps {
|
|
104
|
+
header?: string;
|
|
105
|
+
children?: ReactNode;
|
|
106
|
+
style?: StyleProp<ViewStyle>;
|
|
107
|
+
isDark?: boolean;
|
|
108
|
+
testID?: string;
|
|
109
|
+
}
|
|
110
|
+
export declare const ListSection: import("react").ForwardRefExoticComponent<ListSectionProps & import("react").RefAttributes<any>>;
|
|
111
|
+
export interface AccordionSection {
|
|
112
|
+
/** Stable identity for the section. */
|
|
113
|
+
value: string;
|
|
114
|
+
title: string;
|
|
115
|
+
/** Optional second line in the header. */
|
|
116
|
+
description?: string;
|
|
117
|
+
content: ReactNode;
|
|
118
|
+
}
|
|
119
|
+
export interface AccordionProps {
|
|
120
|
+
sections: AccordionSection[];
|
|
121
|
+
/** Allow several sections open at once. */
|
|
122
|
+
multiple?: boolean;
|
|
123
|
+
/** Controlled open sections. Omit for uncontrolled. */
|
|
124
|
+
openSections?: string[];
|
|
125
|
+
defaultOpenSections?: string[];
|
|
126
|
+
onOpenSectionsChange?: (open: string[]) => void;
|
|
127
|
+
style?: StyleProp<ViewStyle>;
|
|
128
|
+
isDark?: boolean;
|
|
129
|
+
testID?: string;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Expandable sections.
|
|
133
|
+
*
|
|
134
|
+
* The header is a Pressable reporting `expanded`; the panel is measured with
|
|
135
|
+
* the height the content reports and animated on the springs token, so the
|
|
136
|
+
* reveal is a real transition rather than an instant jump.
|
|
137
|
+
*/
|
|
138
|
+
export declare const Accordion: import("react").ForwardRefExoticComponent<AccordionProps & import("react").RefAttributes<any>>;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
export interface StepperProps {
|
|
4
|
+
/** Controlled value. Omit and the stepper keeps its own. */
|
|
5
|
+
value?: number;
|
|
6
|
+
defaultValue?: number;
|
|
7
|
+
onValueChange?: (value: number) => void;
|
|
8
|
+
min?: number;
|
|
9
|
+
max?: number;
|
|
10
|
+
step?: number;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** Announced by screen readers, e.g. "Guests". */
|
|
13
|
+
accessibilityLabel: string;
|
|
14
|
+
/** Formats the middle readout; defaults to the plain number. */
|
|
15
|
+
formatValue?: (value: number) => string;
|
|
16
|
+
style?: StyleProp<ViewStyle>;
|
|
17
|
+
isDark?: boolean;
|
|
18
|
+
testID?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Minus / value / plus.
|
|
22
|
+
*
|
|
23
|
+
* The same interaction contract Slider established: `adjustable` with
|
|
24
|
+
* increment and decrement accessibility actions, and clamping at min and max
|
|
25
|
+
* rather than wrapping or drifting past the range.
|
|
26
|
+
*/
|
|
27
|
+
export declare const Stepper: import("react").ForwardRefExoticComponent<StepperProps & import("react").RefAttributes<any>>;
|
|
28
|
+
export interface ToggleProps {
|
|
29
|
+
/** Controlled pressed state. Omit and the toggle keeps its own. */
|
|
30
|
+
pressed?: boolean;
|
|
31
|
+
defaultPressed?: boolean;
|
|
32
|
+
onPressedChange?: (pressed: boolean) => void;
|
|
33
|
+
/** Equivalent to `pressed`, matching web's Toggle naming. */
|
|
34
|
+
selected?: boolean;
|
|
35
|
+
icon?: ReactNode;
|
|
36
|
+
children?: ReactNode;
|
|
37
|
+
variant?: "glass" | "ghost";
|
|
38
|
+
size?: "sm" | "md" | "lg";
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
/** Required when the toggle has no visible text. */
|
|
41
|
+
accessibilityLabel?: string;
|
|
42
|
+
style?: StyleProp<ViewStyle>;
|
|
43
|
+
isDark?: boolean;
|
|
44
|
+
testID?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A button that stays pressed.
|
|
48
|
+
*
|
|
49
|
+
* Distinct from Switch: this is a button with an on-state (bold, favourite,
|
|
50
|
+
* pinned), not a setting. It reports `selected`, which is what web's Toggle
|
|
51
|
+
* announces.
|
|
52
|
+
*/
|
|
53
|
+
export declare const Toggle: import("react").ForwardRefExoticComponent<ToggleProps & import("react").RefAttributes<any>>;
|
|
54
|
+
export interface ToggleGroupItem {
|
|
55
|
+
value: string;
|
|
56
|
+
label: string;
|
|
57
|
+
icon?: ReactNode;
|
|
58
|
+
}
|
|
59
|
+
export interface ToggleGroupProps {
|
|
60
|
+
items: ToggleGroupItem[];
|
|
61
|
+
/** Allow several items on at once. */
|
|
62
|
+
multiple?: boolean;
|
|
63
|
+
/** Controlled selection. A string for single mode, an array for multiple. */
|
|
64
|
+
value?: string | string[];
|
|
65
|
+
defaultValue?: string | string[];
|
|
66
|
+
onValueChange?: (value: string | string[]) => void;
|
|
67
|
+
size?: "sm" | "md" | "lg";
|
|
68
|
+
disabled?: boolean;
|
|
69
|
+
accessibilityLabel?: string;
|
|
70
|
+
style?: StyleProp<ViewStyle>;
|
|
71
|
+
isDark?: boolean;
|
|
72
|
+
testID?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A row of toggles acting as one choice.
|
|
76
|
+
*
|
|
77
|
+
* Built from the same pieces as SegmentedControl — one glass container, toggles
|
|
78
|
+
* inside it, `glassActive` marking the active ones — but each item carries the
|
|
79
|
+
* button styling of Toggle.
|
|
80
|
+
*/
|
|
81
|
+
export declare const ToggleGroup: import("react").ForwardRefExoticComponent<ToggleGroupProps & import("react").RefAttributes<any>>;
|
|
82
|
+
export interface InputOTPProps {
|
|
83
|
+
/** Controlled code. Omit and the field keeps its own. */
|
|
84
|
+
value?: string;
|
|
85
|
+
defaultValue?: string;
|
|
86
|
+
onChange?: (value: string) => void;
|
|
87
|
+
/** Fires once the code reaches `length` characters. */
|
|
88
|
+
onComplete?: (value: string) => void;
|
|
89
|
+
/** How many digits. */
|
|
90
|
+
length?: number;
|
|
91
|
+
disabled?: boolean;
|
|
92
|
+
accessibilityLabel?: string;
|
|
93
|
+
style?: StyleProp<ViewStyle>;
|
|
94
|
+
isDark?: boolean;
|
|
95
|
+
testID?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* A verification-code row.
|
|
99
|
+
*
|
|
100
|
+
* One real text field drives the boxes. Keeping a single field — rather than N
|
|
101
|
+
* inputs — is what makes paste and autofill fill every box in one go, and it is
|
|
102
|
+
* what keeps the caret and keyboard behaviour sane across platforms.
|
|
103
|
+
*/
|
|
104
|
+
export declare const InputOTP: import("react").ForwardRefExoticComponent<InputOTPProps & import("react").RefAttributes<any>>;
|
|
105
|
+
export interface ButtonGroupItem {
|
|
106
|
+
label: string;
|
|
107
|
+
onPress: () => void;
|
|
108
|
+
disabled?: boolean;
|
|
109
|
+
}
|
|
110
|
+
export interface ButtonGroupProps {
|
|
111
|
+
items: ButtonGroupItem[];
|
|
112
|
+
size?: "sm" | "md" | "lg";
|
|
113
|
+
/** `attached` shares edges; `segmented` leaves a gap between buttons. */
|
|
114
|
+
variant?: "attached" | "segmented";
|
|
115
|
+
/** A single handler instead of per-item `onPress`. */
|
|
116
|
+
onItemPress?: (item: ButtonGroupItem, index: number) => void;
|
|
117
|
+
accessibilityLabel?: string;
|
|
118
|
+
style?: StyleProp<ViewStyle>;
|
|
119
|
+
isDark?: boolean;
|
|
120
|
+
testID?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* A connected row of buttons.
|
|
124
|
+
*
|
|
125
|
+
* Stateless by design: it reports presses and holds no selection, which is what
|
|
126
|
+
* separates it from SegmentedControl (a stateful choice) and ToggleGroup.
|
|
127
|
+
*/
|
|
128
|
+
export declare const ButtonGroup: import("react").ForwardRefExoticComponent<ButtonGroupProps & import("react").RefAttributes<any>>;
|
|
@@ -11,4 +11,4 @@ export interface GlassProps extends NativeGlassProps {
|
|
|
11
11
|
* iOS 26+, Glacia's translucent fallback of identical shape on older iOS and
|
|
12
12
|
* Android. `testID` is passed to whichever surface renders.
|
|
13
13
|
*/
|
|
14
|
-
export declare const Glass: import("react").ForwardRefExoticComponent<GlassProps & import("react").RefAttributes<any>>;
|
|
14
|
+
export declare const Glass: import("react").ForwardRefExoticComponent<Omit<GlassProps, "ref"> & import("react").RefAttributes<any>>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
/**
|
|
4
|
+
* Keeps a popover inside the window.
|
|
5
|
+
*
|
|
6
|
+
* Called with the trigger's measured frame and the popover's own size; returns
|
|
7
|
+
* the offsets that bring it back on screen. A menu near the bottom edge flips
|
|
8
|
+
* above its trigger rather than hanging off the display.
|
|
9
|
+
*/
|
|
10
|
+
export declare function anchorPopover(trigger: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
}, popover: {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
}, viewport: {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
}, gap?: number): {
|
|
22
|
+
left: number;
|
|
23
|
+
top: number;
|
|
24
|
+
flipped: boolean;
|
|
25
|
+
};
|
|
26
|
+
export interface MenuItem {
|
|
27
|
+
label: string;
|
|
28
|
+
onPress: () => void;
|
|
29
|
+
icon?: ReactNode;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
/** Renders in the destructive tone, for delete-and-similar. */
|
|
32
|
+
destructive?: boolean;
|
|
33
|
+
accessibilityLabel?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface MenuProps {
|
|
36
|
+
/** The control that opens the menu. */
|
|
37
|
+
trigger: ReactNode;
|
|
38
|
+
items: MenuItem[];
|
|
39
|
+
/** Controlled open state. Omit and the menu keeps its own. */
|
|
40
|
+
open?: boolean;
|
|
41
|
+
onOpenChange?: (open: boolean) => void;
|
|
42
|
+
/** The menu's width. The list scrolls if the items exceed the screen. */
|
|
43
|
+
width?: number;
|
|
44
|
+
accessibilityLabel?: string;
|
|
45
|
+
style?: StyleProp<ViewStyle>;
|
|
46
|
+
isDark?: boolean;
|
|
47
|
+
testID?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* An anchored dropdown menu.
|
|
51
|
+
*
|
|
52
|
+
* A press outside or on an item closes it; Android's back button does too. The
|
|
53
|
+
* popover is a glass surface with `glassActive` rows, matching the way the
|
|
54
|
+
* library marks a tappable row rather than nesting another glass panel.
|
|
55
|
+
*/
|
|
56
|
+
export declare const Menu: import("react").ForwardRefExoticComponent<MenuProps & import("react").RefAttributes<any>>;
|
|
57
|
+
export interface SheetProps {
|
|
58
|
+
/** Controlled visibility. Omit and the sheet keeps its own. */
|
|
59
|
+
open?: boolean;
|
|
60
|
+
defaultOpen?: boolean;
|
|
61
|
+
onOpenChange?: (open: boolean) => void;
|
|
62
|
+
title?: string;
|
|
63
|
+
children?: ReactNode;
|
|
64
|
+
footer?: ReactNode;
|
|
65
|
+
/** Tapping the scrim dismisses. */
|
|
66
|
+
dismissOnBackdropPress?: boolean;
|
|
67
|
+
/** The drag handle at the top of the panel. */
|
|
68
|
+
showHandle?: boolean;
|
|
69
|
+
style?: StyleProp<ViewStyle>;
|
|
70
|
+
isDark?: boolean;
|
|
71
|
+
testID?: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A bottom sheet.
|
|
75
|
+
*
|
|
76
|
+
* The general-purpose container: it slides up on the springs token, dismisses
|
|
77
|
+
* on a scrim press and on Android back. ActionSheet remains the action-menu
|
|
78
|
+
* specialisation of this shape; Sheet is for arbitrary content — a form, a
|
|
79
|
+
* calendar, a detail panel.
|
|
80
|
+
*/
|
|
81
|
+
export declare const Sheet: import("react").ForwardRefExoticComponent<SheetProps & import("react").RefAttributes<any>>;
|
|
82
|
+
export interface DrawerProps {
|
|
83
|
+
/** Controlled visibility. Omit and the drawer keeps its own. */
|
|
84
|
+
open?: boolean;
|
|
85
|
+
defaultOpen?: boolean;
|
|
86
|
+
onOpenChange?: (open: boolean) => void;
|
|
87
|
+
/** The edge the panel slides in from. */
|
|
88
|
+
side?: "left" | "right";
|
|
89
|
+
/** Panel width. */
|
|
90
|
+
width?: number;
|
|
91
|
+
children?: ReactNode;
|
|
92
|
+
/** Tapping the scrim dismisses. */
|
|
93
|
+
dismissOnBackdropPress?: boolean;
|
|
94
|
+
style?: StyleProp<ViewStyle>;
|
|
95
|
+
isDark?: boolean;
|
|
96
|
+
testID?: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* A side navigation drawer.
|
|
100
|
+
*
|
|
101
|
+
* The same overlay discipline as Sheet — scrim, spring slide, Android back —
|
|
102
|
+
* but anchored to a side edge, with a square panel that runs the full height.
|
|
103
|
+
* The caller supplies the content, typically a List.
|
|
104
|
+
*/
|
|
105
|
+
export declare const Drawer: import("react").ForwardRefExoticComponent<DrawerProps & import("react").RefAttributes<any>>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { StyleProp, ViewStyle } from "react-native";
|
|
2
|
+
/** Midnight on the same calendar day, so two picks compare equal. */
|
|
3
|
+
export declare function startOfDay(date: Date): Date;
|
|
4
|
+
export declare function sameDay(a: Date | undefined, b: Date | undefined): boolean;
|
|
5
|
+
export interface CalendarCell {
|
|
6
|
+
date: Date;
|
|
7
|
+
/** True for days outside the displayed month, shown to fill the grid. */
|
|
8
|
+
outside: boolean;
|
|
9
|
+
key: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The six-row month grid.
|
|
13
|
+
*
|
|
14
|
+
* Always six rows so the calendar does not change height as months change,
|
|
15
|
+
* which would make the surrounding layout jump between February and March.
|
|
16
|
+
*/
|
|
17
|
+
export declare function monthGrid(year: number, month: number, weekStartsOn?: 0 | 1): CalendarCell[];
|
|
18
|
+
export declare const WEEKDAYS: string[];
|
|
19
|
+
export declare const MONTHS: string[];
|
|
20
|
+
export interface CalendarProps {
|
|
21
|
+
/** Controlled selection. */
|
|
22
|
+
value?: Date;
|
|
23
|
+
/** Fires when a day is tapped. */
|
|
24
|
+
onChange?: (date: Date) => void;
|
|
25
|
+
/** Days before this are dimmed and cannot be picked. */
|
|
26
|
+
minDate?: Date;
|
|
27
|
+
/** Days after this are dimmed and cannot be picked. */
|
|
28
|
+
maxDate?: Date;
|
|
29
|
+
/** Which month to open on when there is no value. */
|
|
30
|
+
initialMonth?: Date;
|
|
31
|
+
/** 0 starts the week on Sunday, 1 on Monday. */
|
|
32
|
+
weekStartsOn?: 0 | 1;
|
|
33
|
+
style?: StyleProp<ViewStyle>;
|
|
34
|
+
isDark?: boolean;
|
|
35
|
+
testID?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A month calendar, built from Glacia's own views.
|
|
39
|
+
*
|
|
40
|
+
* No native date picker anywhere: the grid, the weekday header and the month
|
|
41
|
+
* navigation are ours, so the calendar looks the same on iOS and Android and
|
|
42
|
+
* wears the library's tokens. The selected day is a `glassActive` fill, today
|
|
43
|
+
* carries a ring, and disabled days are dimmed.
|
|
44
|
+
*/
|
|
45
|
+
export declare const Calendar: import("react").ForwardRefExoticComponent<CalendarProps & import("react").RefAttributes<any>>;
|
|
46
|
+
export interface DatePickerProps {
|
|
47
|
+
/** Controlled visibility. Omit and the picker keeps its own. */
|
|
48
|
+
open?: boolean;
|
|
49
|
+
defaultOpen?: boolean;
|
|
50
|
+
onOpenChange?: (open: boolean) => void;
|
|
51
|
+
/** The committed date. */
|
|
52
|
+
value?: Date;
|
|
53
|
+
/** Fires only when the user confirms, never on a mere browse. */
|
|
54
|
+
onConfirm?: (date: Date) => void;
|
|
55
|
+
onCancel?: () => void;
|
|
56
|
+
title?: string;
|
|
57
|
+
confirmLabel?: string;
|
|
58
|
+
cancelLabel?: string;
|
|
59
|
+
minDate?: Date;
|
|
60
|
+
maxDate?: Date;
|
|
61
|
+
style?: StyleProp<ViewStyle>;
|
|
62
|
+
isDark?: boolean;
|
|
63
|
+
testID?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A date picker: the Calendar presented in a Sheet.
|
|
67
|
+
*
|
|
68
|
+
* Browsing months does not commit anything — the pending date is local until
|
|
69
|
+
* the user confirms, so an accidental swipe of the calendar cannot change a
|
|
70
|
+
* saved value.
|
|
71
|
+
*/
|
|
72
|
+
export declare const DatePicker: import("react").ForwardRefExoticComponent<DatePickerProps & import("react").RefAttributes<any>>;
|
|
73
|
+
export interface TimePickerProps {
|
|
74
|
+
open?: boolean;
|
|
75
|
+
defaultOpen?: boolean;
|
|
76
|
+
onOpenChange?: (open: boolean) => void;
|
|
77
|
+
/** The committed time, as "HH:MM" (24-hour). */
|
|
78
|
+
value?: string;
|
|
79
|
+
/** Fires only on confirm. */
|
|
80
|
+
onConfirm?: (time: string) => void;
|
|
81
|
+
onCancel?: () => void;
|
|
82
|
+
/** Show an AM/PM column and present times in 12-hour form. */
|
|
83
|
+
use12Hour?: boolean;
|
|
84
|
+
title?: string;
|
|
85
|
+
confirmLabel?: string;
|
|
86
|
+
cancelLabel?: string;
|
|
87
|
+
minuteStep?: number;
|
|
88
|
+
style?: StyleProp<ViewStyle>;
|
|
89
|
+
isDark?: boolean;
|
|
90
|
+
testID?: string;
|
|
91
|
+
}
|
|
92
|
+
/** Splits "HH:MM" into parts, falling back to a sane default. */
|
|
93
|
+
export declare function parseTime(value: string | undefined): {
|
|
94
|
+
hour: number;
|
|
95
|
+
minute: number;
|
|
96
|
+
};
|
|
97
|
+
/** Formats parts back to zero-padded "HH:MM". */
|
|
98
|
+
export declare function formatTime(hour: number, minute: number): string;
|
|
99
|
+
/**
|
|
100
|
+
* A time picker: tappable hour/minute drums inside a Sheet.
|
|
101
|
+
*
|
|
102
|
+
* The drums are ordinary Pressables drawn by Glacia — not a native picker
|
|
103
|
+
* widget. Tapping a value selects it; the whole column scrolls in the Sheet.
|
|
104
|
+
*/
|
|
105
|
+
export declare const TimePicker: import("react").ForwardRefExoticComponent<TimePickerProps & import("react").RefAttributes<any>>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { StyleProp, TextStyle } from "react-native";
|
|
3
|
+
export type TextVariant = "title" | "heading" | "body" | "caption" | "label";
|
|
4
|
+
export interface TextProps {
|
|
5
|
+
/**
|
|
6
|
+
* The type step. The names come from the package's type scale, so a title in
|
|
7
|
+
* one app reads the same as a title in another.
|
|
8
|
+
*/
|
|
9
|
+
variant?: TextVariant;
|
|
10
|
+
/** Secondary text: descriptions, hints, timestamps. */
|
|
11
|
+
muted?: boolean;
|
|
12
|
+
/** Renders the text in the destructive tone (errors, danger). */
|
|
13
|
+
destructive?: boolean;
|
|
14
|
+
/** Number of lines before truncating. */
|
|
15
|
+
numberOfLines?: number;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
style?: StyleProp<TextStyle>;
|
|
18
|
+
isDark?: boolean;
|
|
19
|
+
testID?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Themed text.
|
|
23
|
+
*
|
|
24
|
+
* Every Glacia component that renders words uses this, so type, colour and
|
|
25
|
+
* contrast come from one place. It wraps the resolver's `Text`, which is React
|
|
26
|
+
* Native's own on a device.
|
|
27
|
+
*/
|
|
28
|
+
export declare const Text: import("react").ForwardRefExoticComponent<TextProps & import("react").RefAttributes<any>>;
|