namps-native 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/README.md +127 -0
- package/dist/index.d.mts +591 -0
- package/dist/index.d.ts +591 -0
- package/dist/index.js +655 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +622 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +47 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,591 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle, TextStyle, GestureResponderEvent, TextProps as TextProps$1, ViewProps, TextInputProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Clay design tokens — the single source of truth for the whole library.
|
|
6
|
+
*
|
|
7
|
+
* Tokens are grouped by concern (color, space, radius, etc). No component may
|
|
8
|
+
* hardcode a raw value; everything reads from the resolved theme. This is what
|
|
9
|
+
* makes theming, dark mode, and custom brands work with zero component changes.
|
|
10
|
+
*
|
|
11
|
+
* Palette tokens are theme-independent primitives. Semantic color tokens
|
|
12
|
+
* (see `themes.ts`) map light/dark values onto meaning (`bg`, `text`, `accent`…).
|
|
13
|
+
*/
|
|
14
|
+
/** Raw color primitives. Never consumed directly by components — use semantic tokens. */
|
|
15
|
+
declare const palette: {
|
|
16
|
+
readonly sand50: "#FBFAF6";
|
|
17
|
+
readonly sand100: "#F3F0E8";
|
|
18
|
+
readonly sand200: "#EAE6DB";
|
|
19
|
+
readonly sand300: "#E5E0D4";
|
|
20
|
+
readonly sand400: "#D4CDBD";
|
|
21
|
+
readonly sand500: "#9C9482";
|
|
22
|
+
readonly sand600: "#6B6555";
|
|
23
|
+
readonly sand700: "#413C33";
|
|
24
|
+
readonly sand800: "#211E18";
|
|
25
|
+
readonly sand900: "#191712";
|
|
26
|
+
readonly ink: "#201E1A";
|
|
27
|
+
readonly paperWhite: "#FFFFFF";
|
|
28
|
+
readonly clay400: "#D6805C";
|
|
29
|
+
readonly clay500: "#C15F3C";
|
|
30
|
+
readonly clay600: "#A64E2E";
|
|
31
|
+
readonly clay100: "#F1E1D8";
|
|
32
|
+
readonly green500: "#47795B";
|
|
33
|
+
readonly green400: "#6EA687";
|
|
34
|
+
readonly amber500: "#9E6E1B";
|
|
35
|
+
readonly amber400: "#CDA052";
|
|
36
|
+
readonly red500: "#B0463B";
|
|
37
|
+
readonly red400: "#D67E71";
|
|
38
|
+
readonly blue500: "#3F6591";
|
|
39
|
+
readonly blue400: "#7FA4CF";
|
|
40
|
+
};
|
|
41
|
+
/** 4-point spacing scale. `space[4] === 16`. */
|
|
42
|
+
declare const space: {
|
|
43
|
+
readonly 0: 0;
|
|
44
|
+
readonly 1: 4;
|
|
45
|
+
readonly 2: 8;
|
|
46
|
+
readonly 3: 12;
|
|
47
|
+
readonly 4: 16;
|
|
48
|
+
readonly 5: 20;
|
|
49
|
+
readonly 6: 24;
|
|
50
|
+
readonly 8: 32;
|
|
51
|
+
readonly 10: 40;
|
|
52
|
+
readonly 12: 64;
|
|
53
|
+
};
|
|
54
|
+
/** Corner radius scale. */
|
|
55
|
+
declare const radius: {
|
|
56
|
+
readonly none: 0;
|
|
57
|
+
readonly sm: 6;
|
|
58
|
+
readonly md: 10;
|
|
59
|
+
readonly lg: 14;
|
|
60
|
+
readonly xl: 20;
|
|
61
|
+
readonly full: 999;
|
|
62
|
+
};
|
|
63
|
+
/** Type scale in px. Pair with `lineHeight` and `fontWeight`. */
|
|
64
|
+
declare const fontSize: {
|
|
65
|
+
readonly xs: 12;
|
|
66
|
+
readonly sm: 13;
|
|
67
|
+
readonly base: 15;
|
|
68
|
+
readonly md: 16;
|
|
69
|
+
readonly lg: 18;
|
|
70
|
+
readonly xl: 22;
|
|
71
|
+
readonly '2xl': 28;
|
|
72
|
+
readonly '3xl': 34;
|
|
73
|
+
readonly display: 46;
|
|
74
|
+
};
|
|
75
|
+
declare const lineHeight: {
|
|
76
|
+
readonly tight: 1.15;
|
|
77
|
+
readonly snug: 1.35;
|
|
78
|
+
readonly normal: 1.5;
|
|
79
|
+
readonly relaxed: 1.6;
|
|
80
|
+
};
|
|
81
|
+
declare const fontWeight: {
|
|
82
|
+
readonly regular: "400";
|
|
83
|
+
readonly medium: "500";
|
|
84
|
+
readonly semibold: "600";
|
|
85
|
+
readonly bold: "700";
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Font families. Map these to fonts loaded via expo-font / expo-google-fonts.
|
|
89
|
+
* `display` is a warm serif; `body` a neutral grotesque; `mono` for code/data.
|
|
90
|
+
*/
|
|
91
|
+
declare const fontFamily: {
|
|
92
|
+
readonly display: "Newsreader";
|
|
93
|
+
readonly body: "Geist";
|
|
94
|
+
readonly mono: "JetBrainsMono";
|
|
95
|
+
};
|
|
96
|
+
/** Motion tokens — durations in ms. Easing lives in `motion.easing`. */
|
|
97
|
+
declare const motion: {
|
|
98
|
+
readonly duration: {
|
|
99
|
+
readonly fast: 120;
|
|
100
|
+
readonly base: 220;
|
|
101
|
+
readonly slow: 340;
|
|
102
|
+
};
|
|
103
|
+
/** Reanimated: `Easing.bezier(...motion.easing.standard)`. */
|
|
104
|
+
readonly easing: {
|
|
105
|
+
readonly standard: readonly [0.2, 0, 0, 1];
|
|
106
|
+
readonly decelerate: readonly [0, 0, 0, 1];
|
|
107
|
+
readonly accelerate: readonly [0.4, 0, 1, 1];
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
/** Standard control sizes shared by Button, Input, IconButton, etc. */
|
|
111
|
+
declare const sizing: {
|
|
112
|
+
readonly sm: {
|
|
113
|
+
readonly height: 34;
|
|
114
|
+
readonly paddingX: 12;
|
|
115
|
+
readonly fontSize: 13;
|
|
116
|
+
readonly radius: 6;
|
|
117
|
+
readonly icon: 16;
|
|
118
|
+
};
|
|
119
|
+
readonly md: {
|
|
120
|
+
readonly height: 44;
|
|
121
|
+
readonly paddingX: 20;
|
|
122
|
+
readonly fontSize: 15;
|
|
123
|
+
readonly radius: 10;
|
|
124
|
+
readonly icon: 18;
|
|
125
|
+
};
|
|
126
|
+
readonly lg: {
|
|
127
|
+
readonly height: 54;
|
|
128
|
+
readonly paddingX: 24;
|
|
129
|
+
readonly fontSize: 16;
|
|
130
|
+
readonly radius: 14;
|
|
131
|
+
readonly icon: 20;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
type SpaceToken = keyof typeof space;
|
|
135
|
+
type RadiusToken = keyof typeof radius;
|
|
136
|
+
type FontSizeToken = keyof typeof fontSize;
|
|
137
|
+
type ComponentSize = keyof typeof sizing;
|
|
138
|
+
|
|
139
|
+
type tokens_ComponentSize = ComponentSize;
|
|
140
|
+
type tokens_FontSizeToken = FontSizeToken;
|
|
141
|
+
type tokens_RadiusToken = RadiusToken;
|
|
142
|
+
type tokens_SpaceToken = SpaceToken;
|
|
143
|
+
declare const tokens_fontFamily: typeof fontFamily;
|
|
144
|
+
declare const tokens_fontSize: typeof fontSize;
|
|
145
|
+
declare const tokens_fontWeight: typeof fontWeight;
|
|
146
|
+
declare const tokens_lineHeight: typeof lineHeight;
|
|
147
|
+
declare const tokens_motion: typeof motion;
|
|
148
|
+
declare const tokens_palette: typeof palette;
|
|
149
|
+
declare const tokens_radius: typeof radius;
|
|
150
|
+
declare const tokens_sizing: typeof sizing;
|
|
151
|
+
declare const tokens_space: typeof space;
|
|
152
|
+
declare namespace tokens {
|
|
153
|
+
export { type tokens_ComponentSize as ComponentSize, type tokens_FontSizeToken as FontSizeToken, type tokens_RadiusToken as RadiusToken, type tokens_SpaceToken as SpaceToken, tokens_fontFamily as fontFamily, tokens_fontSize as fontSize, tokens_fontWeight as fontWeight, tokens_lineHeight as lineHeight, tokens_motion as motion, tokens_palette as palette, tokens_radius as radius, tokens_sizing as sizing, tokens_space as space };
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Semantic color tokens — the names components actually use.
|
|
158
|
+
* Each theme maps meaning onto palette primitives, so switching themes (or
|
|
159
|
+
* providing a custom one) never touches component code.
|
|
160
|
+
*/
|
|
161
|
+
interface ColorTokens {
|
|
162
|
+
/** App canvas background. */
|
|
163
|
+
bg: string;
|
|
164
|
+
/** Card / sheet surface, one step above the canvas. */
|
|
165
|
+
surface: string;
|
|
166
|
+
/** Popovers, menus, modals — the highest surface. */
|
|
167
|
+
elevated: string;
|
|
168
|
+
/** Inset wells: inputs, tracks, code blocks. */
|
|
169
|
+
sunken: string;
|
|
170
|
+
/** Hairline borders. */
|
|
171
|
+
border: string;
|
|
172
|
+
/** Stronger borders and disabled fills. */
|
|
173
|
+
borderStrong: string;
|
|
174
|
+
/** Primary text. */
|
|
175
|
+
text: string;
|
|
176
|
+
/** Secondary text. */
|
|
177
|
+
textMuted: string;
|
|
178
|
+
/** Tertiary text, placeholders, captions. */
|
|
179
|
+
textSubtle: string;
|
|
180
|
+
/** Brand accent (clay). */
|
|
181
|
+
accent: string;
|
|
182
|
+
/** Accent pressed / hover. */
|
|
183
|
+
accentHover: string;
|
|
184
|
+
/** Tinted accent background for soft buttons, chips, selection. */
|
|
185
|
+
accentSoft: string;
|
|
186
|
+
/** Foreground on top of `accent`. */
|
|
187
|
+
onAccent: string;
|
|
188
|
+
success: string;
|
|
189
|
+
successSoft: string;
|
|
190
|
+
warning: string;
|
|
191
|
+
warningSoft: string;
|
|
192
|
+
danger: string;
|
|
193
|
+
dangerSoft: string;
|
|
194
|
+
info: string;
|
|
195
|
+
infoSoft: string;
|
|
196
|
+
}
|
|
197
|
+
interface ShadowToken {
|
|
198
|
+
shadowColor: string;
|
|
199
|
+
shadowOffset: {
|
|
200
|
+
width: number;
|
|
201
|
+
height: number;
|
|
202
|
+
};
|
|
203
|
+
shadowOpacity: number;
|
|
204
|
+
shadowRadius: number;
|
|
205
|
+
/** Android */
|
|
206
|
+
elevation: number;
|
|
207
|
+
}
|
|
208
|
+
interface Theme {
|
|
209
|
+
name: 'light' | 'dark' | (string & {});
|
|
210
|
+
colors: ColorTokens;
|
|
211
|
+
space: typeof space;
|
|
212
|
+
radius: typeof radius;
|
|
213
|
+
fontSize: typeof fontSize;
|
|
214
|
+
lineHeight: typeof lineHeight;
|
|
215
|
+
fontWeight: typeof fontWeight;
|
|
216
|
+
fontFamily: typeof fontFamily;
|
|
217
|
+
motion: typeof motion;
|
|
218
|
+
sizing: typeof sizing;
|
|
219
|
+
shadow: {
|
|
220
|
+
sm: ShadowToken;
|
|
221
|
+
md: ShadowToken;
|
|
222
|
+
lg: ShadowToken;
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
/** Default light theme. */
|
|
226
|
+
declare const lightTheme: Theme;
|
|
227
|
+
/** Default dark theme. */
|
|
228
|
+
declare const darkTheme: Theme;
|
|
229
|
+
type DeepPartial<T> = {
|
|
230
|
+
[K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* Merge a partial override onto a base theme to build a custom brand theme.
|
|
234
|
+
* Only the tokens you specify change; everything else inherits.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* const brand = createTheme(lightTheme, { colors: { accent: '#2A6FDB' } });
|
|
238
|
+
*/
|
|
239
|
+
declare function createTheme(base: Theme, overrides?: DeepPartial<Theme>): Theme;
|
|
240
|
+
|
|
241
|
+
type ColorSchemeName = 'light' | 'dark';
|
|
242
|
+
type ColorSchemePref = ColorSchemeName | 'system';
|
|
243
|
+
interface ThemeProviderProps {
|
|
244
|
+
children: React.ReactNode;
|
|
245
|
+
/** Override the light theme (e.g. a custom brand). Defaults to Clay's light theme. */
|
|
246
|
+
light?: Theme;
|
|
247
|
+
/** Override the dark theme. Defaults to Clay's dark theme. */
|
|
248
|
+
dark?: Theme;
|
|
249
|
+
/** Initial color-scheme preference. `system` follows the OS. Default: `system`. */
|
|
250
|
+
defaultPreference?: ColorSchemePref;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Provides the active theme to every Clay component. Wrap your app root once.
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* <ThemeProvider defaultPreference="system">
|
|
257
|
+
* <App />
|
|
258
|
+
* </ThemeProvider>
|
|
259
|
+
*/
|
|
260
|
+
declare function ThemeProvider({ children, light, dark, defaultPreference, }: ThemeProviderProps): React.JSX.Element;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Read the active theme (colors, spacing, radius, type, motion, shadow tokens).
|
|
264
|
+
* The primary API for consuming design tokens in your own components.
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* const theme = useTheme();
|
|
268
|
+
* <View style={{ backgroundColor: theme.colors.surface, padding: theme.space[4] }} />
|
|
269
|
+
*/
|
|
270
|
+
declare function useTheme(): Theme;
|
|
271
|
+
/**
|
|
272
|
+
* Access and control the color scheme.
|
|
273
|
+
* @example
|
|
274
|
+
* const { scheme, toggle } = useColorSchemeControl();
|
|
275
|
+
*/
|
|
276
|
+
declare function useColorSchemeControl(): {
|
|
277
|
+
scheme: ColorSchemeName;
|
|
278
|
+
preference: ColorSchemePref;
|
|
279
|
+
setPreference: (pref: ColorSchemePref) => void;
|
|
280
|
+
toggle: () => void;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Manage a value that can be either controlled (via `value` prop) or
|
|
285
|
+
* uncontrolled (internal state seeded by `defaultValue`). The standard Clay
|
|
286
|
+
* pattern for every stateful input (Switch, Checkbox, Tabs, Input…).
|
|
287
|
+
*
|
|
288
|
+
* @returns `[value, setValue]` where `setValue` calls `onChange` and, when
|
|
289
|
+
* uncontrolled, updates internal state.
|
|
290
|
+
*/
|
|
291
|
+
declare function useControllableState<T>(params: {
|
|
292
|
+
value?: T;
|
|
293
|
+
defaultValue: T;
|
|
294
|
+
onChange?: (value: T) => void;
|
|
295
|
+
}): [T, (next: T) => void];
|
|
296
|
+
|
|
297
|
+
interface Disclosure {
|
|
298
|
+
isOpen: boolean;
|
|
299
|
+
open: () => void;
|
|
300
|
+
close: () => void;
|
|
301
|
+
toggle: () => void;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Boolean open/close state for overlays (Modal, BottomSheet, Popover, Menu…).
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* const modal = useDisclosure();
|
|
308
|
+
* <Button onPress={modal.open}>Open</Button>
|
|
309
|
+
* <Modal visible={modal.isOpen} onClose={modal.close} />
|
|
310
|
+
*/
|
|
311
|
+
declare function useDisclosure(defaultOpen?: boolean): Disclosure;
|
|
312
|
+
|
|
313
|
+
/** Visual emphasis shared across interactive components. */
|
|
314
|
+
type Variant = 'primary' | 'secondary' | 'soft' | 'ghost' | 'danger';
|
|
315
|
+
/** Control size shared across Button, Input, IconButton, etc. */
|
|
316
|
+
type Size = 'sm' | 'md' | 'lg';
|
|
317
|
+
/** Semantic status shared across Alert, Badge, Banner, Toast, etc. */
|
|
318
|
+
type Status = 'info' | 'success' | 'warning' | 'danger' | 'neutral';
|
|
319
|
+
/**
|
|
320
|
+
* Every Clay component accepts these. Consistent overrides mean an agent that
|
|
321
|
+
* learns one component can style them all.
|
|
322
|
+
*/
|
|
323
|
+
interface StyleableProps {
|
|
324
|
+
/** Style override merged onto the root element. */
|
|
325
|
+
style?: StyleProp<ViewStyle>;
|
|
326
|
+
/** `testID` forwarded to the root for testing/automation. */
|
|
327
|
+
testID?: string;
|
|
328
|
+
}
|
|
329
|
+
interface TextStyleableProps {
|
|
330
|
+
style?: StyleProp<TextStyle>;
|
|
331
|
+
testID?: string;
|
|
332
|
+
}
|
|
333
|
+
/** Standard accessibility props surfaced consistently. */
|
|
334
|
+
interface A11yProps {
|
|
335
|
+
/** Accessible label. Required for icon-only controls. */
|
|
336
|
+
accessibilityLabel?: string;
|
|
337
|
+
/** Accessible hint describing the outcome of an action. */
|
|
338
|
+
accessibilityHint?: string;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/** Small color helpers used internally by components. */
|
|
342
|
+
/** Mix `hex` with white/black by `amount` (0–1) to lighten/darken. */
|
|
343
|
+
declare function shade(hex: string, amount: number): string;
|
|
344
|
+
/** Add an alpha channel to a hex color, returning `rgba(...)`. */
|
|
345
|
+
declare function withAlpha(hex: string, alpha: number): string;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Clay icon style: 24×24 grid, 1.7 stroke, round caps/joins, `currentColor`.
|
|
349
|
+
* Every icon takes `size` (default 22) and `color` (default `currentColor`),
|
|
350
|
+
* so it inherits text color and aligns with the type scale.
|
|
351
|
+
*
|
|
352
|
+
* These are a starter set — add more following the same signature.
|
|
353
|
+
*/
|
|
354
|
+
interface IconProps {
|
|
355
|
+
/** Square dimension in px. Default 22. */
|
|
356
|
+
size?: number;
|
|
357
|
+
/** Stroke color. Default `currentColor` (inherits from text). */
|
|
358
|
+
color?: string;
|
|
359
|
+
}
|
|
360
|
+
declare const SearchIcon: ({ size, color }: IconProps) => React.JSX.Element;
|
|
361
|
+
declare const PlusIcon: ({ size, color }: IconProps) => React.JSX.Element;
|
|
362
|
+
declare const CheckIcon: ({ size, color }: IconProps) => React.JSX.Element;
|
|
363
|
+
declare const ChevronRightIcon: ({ size, color }: IconProps) => React.JSX.Element;
|
|
364
|
+
declare const CloseIcon: ({ size, color }: IconProps) => React.JSX.Element;
|
|
365
|
+
declare const BellIcon: ({ size, color }: IconProps) => React.JSX.Element;
|
|
366
|
+
|
|
367
|
+
interface ButtonProps extends A11yProps, StyleableProps {
|
|
368
|
+
/** Button label. Ignored if `children` is provided. */
|
|
369
|
+
children?: React.ReactNode;
|
|
370
|
+
/**
|
|
371
|
+
* Visual emphasis. Default `"primary"`.
|
|
372
|
+
* - `primary` — solid accent, main call to action
|
|
373
|
+
* - `secondary` — outlined, neutral surface
|
|
374
|
+
* - `soft` — tinted accent background, low emphasis
|
|
375
|
+
* - `ghost` — text only, minimal
|
|
376
|
+
* - `danger` — destructive solid
|
|
377
|
+
*/
|
|
378
|
+
variant?: Variant;
|
|
379
|
+
/** Control height & padding. Default `"md"`. */
|
|
380
|
+
size?: Size;
|
|
381
|
+
/** Show a spinner and block presses. Default `false`. */
|
|
382
|
+
loading?: boolean;
|
|
383
|
+
/** Disable the button. Default `false`. */
|
|
384
|
+
disabled?: boolean;
|
|
385
|
+
/** Stretch to fill the parent's width. Default `false`. */
|
|
386
|
+
fullWidth?: boolean;
|
|
387
|
+
/** Element rendered before the label (usually an icon). */
|
|
388
|
+
leftIcon?: React.ReactNode;
|
|
389
|
+
/** Element rendered after the label. */
|
|
390
|
+
rightIcon?: React.ReactNode;
|
|
391
|
+
/** Press handler. */
|
|
392
|
+
onPress?: (e: GestureResponderEvent) => void;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* The primary action component.
|
|
396
|
+
*
|
|
397
|
+
* @remarks
|
|
398
|
+
* Do: use exactly one `primary` button per view for the main action.
|
|
399
|
+
* Don't: use `danger` for anything reversible — pair it with a confirm Dialog.
|
|
400
|
+
* Accessibility: `role="button"` is set automatically; provide
|
|
401
|
+
* `accessibilityLabel` when the label is an icon only (prefer `IconButton`).
|
|
402
|
+
* Related: {@link IconButton}, {@link Card}.
|
|
403
|
+
*
|
|
404
|
+
* @example Basic
|
|
405
|
+
* <Button onPress={save}>Save changes</Button>
|
|
406
|
+
*
|
|
407
|
+
* @example With icon + loading
|
|
408
|
+
* <Button variant="soft" leftIcon={<PlusIcon />} loading={saving}>New</Button>
|
|
409
|
+
*/
|
|
410
|
+
declare function Button({ children, variant, size, loading, disabled, fullWidth, leftIcon, rightIcon, onPress, style, accessibilityLabel, accessibilityHint, testID, }: ButtonProps): React.JSX.Element;
|
|
411
|
+
|
|
412
|
+
interface IconButtonProps extends A11yProps, StyleableProps {
|
|
413
|
+
/** The icon element. Rendered centered; sized to the control's icon token. */
|
|
414
|
+
icon: React.ReactNode;
|
|
415
|
+
/** Visual emphasis. Default `"ghost"`. */
|
|
416
|
+
variant?: Variant;
|
|
417
|
+
/** Control size. Default `"md"`. */
|
|
418
|
+
size?: Size;
|
|
419
|
+
/** Fully rounded (pill/circle) instead of the size radius. Default `false`. */
|
|
420
|
+
round?: boolean;
|
|
421
|
+
/** Disable the button. */
|
|
422
|
+
disabled?: boolean;
|
|
423
|
+
onPress?: (e: GestureResponderEvent) => void;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* A square, icon-only button. Same variants/sizes as {@link Button}.
|
|
427
|
+
*
|
|
428
|
+
* @remarks
|
|
429
|
+
* Accessibility: `accessibilityLabel` is REQUIRED — there is no visible text.
|
|
430
|
+
* Do: use for toolbar and inline actions. Don't: use for primary CTAs (use Button).
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
* <IconButton icon={<CloseIcon />} accessibilityLabel="Close" onPress={close} />
|
|
434
|
+
*/
|
|
435
|
+
declare function IconButton({ icon, variant, size, round, disabled, onPress, style, accessibilityLabel, accessibilityHint, testID, }: IconButtonProps): React.JSX.Element;
|
|
436
|
+
|
|
437
|
+
type TextVariant = 'body' | 'bodyLg' | 'label' | 'caption' | 'mono';
|
|
438
|
+
type TextTone = 'default' | 'muted' | 'subtle' | 'accent' | 'danger' | 'success' | 'onAccent';
|
|
439
|
+
interface TextProps extends TextStyleableProps, Pick<TextProps$1, 'numberOfLines' | 'onPress' | 'selectable' | 'accessibilityRole'> {
|
|
440
|
+
children: React.ReactNode;
|
|
441
|
+
/** Type role mapped to the scale. Default `"body"`. */
|
|
442
|
+
variant?: TextVariant;
|
|
443
|
+
/** Color token. Default `"default"`. */
|
|
444
|
+
tone?: TextTone;
|
|
445
|
+
/** Font weight override. */
|
|
446
|
+
weight?: 'regular' | 'medium' | 'semibold' | 'bold';
|
|
447
|
+
/** Text alignment. */
|
|
448
|
+
align?: 'auto' | 'left' | 'right' | 'center';
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* The typographic primitive for all non-heading text. Keeps every string on
|
|
452
|
+
* the scale and on a semantic color token.
|
|
453
|
+
*
|
|
454
|
+
* @remarks
|
|
455
|
+
* Do: use `variant`/`tone` instead of raw `style` colors. Related: {@link Heading}.
|
|
456
|
+
* @example
|
|
457
|
+
* <Text variant="caption" tone="muted">Updated 2h ago</Text>
|
|
458
|
+
*/
|
|
459
|
+
declare function Text({ children, variant, tone, weight, align, style, ...rest }: TextProps): React.JSX.Element;
|
|
460
|
+
|
|
461
|
+
type HeadingLevel = 1 | 2 | 3 | 4;
|
|
462
|
+
interface HeadingProps extends TextStyleableProps {
|
|
463
|
+
children: React.ReactNode;
|
|
464
|
+
/** Visual + semantic level. 1 = largest. Default `2`. */
|
|
465
|
+
level?: HeadingLevel;
|
|
466
|
+
align?: 'auto' | 'left' | 'right' | 'center';
|
|
467
|
+
/** Color tone. Default `"default"`. */
|
|
468
|
+
tone?: 'default' | 'accent' | 'onAccent';
|
|
469
|
+
numberOfLines?: number;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Display headings set in the serif display family.
|
|
473
|
+
*
|
|
474
|
+
* @remarks
|
|
475
|
+
* Do: keep one `level={1}` per screen. Related: {@link Text}.
|
|
476
|
+
* @example
|
|
477
|
+
* <Heading level={1}>Good morning</Heading>
|
|
478
|
+
*/
|
|
479
|
+
declare function Heading({ children, level, align, tone, numberOfLines, style }: HeadingProps): React.JSX.Element;
|
|
480
|
+
|
|
481
|
+
type CardVariant = 'outlined' | 'elevated' | 'filled';
|
|
482
|
+
interface CardProps extends StyleableProps, Pick<ViewProps, 'children'> {
|
|
483
|
+
/** Surface treatment. Default `"outlined"`. */
|
|
484
|
+
variant?: CardVariant;
|
|
485
|
+
/** Inner padding, using a space token key. Default `4` (16px). */
|
|
486
|
+
padding?: keyof ReturnType<typeof useTheme>['space'];
|
|
487
|
+
/** Makes the whole card pressable with a subtle feedback state. */
|
|
488
|
+
onPress?: (e: GestureResponderEvent) => void;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* The primary container surface. Maps its variant straight to elevation tokens.
|
|
492
|
+
*
|
|
493
|
+
* @remarks
|
|
494
|
+
* Do: nest {@link Heading}/{@link Text} for content. Don't: stack elevated cards
|
|
495
|
+
* on elevated cards — flatten to `outlined` inside. Related: {@link Card}, {@link List}.
|
|
496
|
+
* @example
|
|
497
|
+
* <Card variant="elevated" padding={5}>
|
|
498
|
+
* <Heading level={4}>Weekly digest</Heading>
|
|
499
|
+
* <Text tone="muted">Everything that changed.</Text>
|
|
500
|
+
* </Card>
|
|
501
|
+
*/
|
|
502
|
+
declare function Card({ variant, padding, onPress, style, children, testID }: CardProps): React.JSX.Element;
|
|
503
|
+
|
|
504
|
+
interface InputProps extends StyleableProps, Pick<TextInputProps, 'value' | 'onChangeText' | 'placeholder' | 'secureTextEntry' | 'keyboardType' | 'autoCapitalize' | 'autoFocus' | 'onBlur' | 'onFocus' | 'multiline'> {
|
|
505
|
+
/** Field label rendered above the control. */
|
|
506
|
+
label?: string;
|
|
507
|
+
/** Helper text below the control. Replaced by `error` when present. */
|
|
508
|
+
helperText?: string;
|
|
509
|
+
/** Error message. Sets the error visual state and replaces `helperText`. */
|
|
510
|
+
error?: string;
|
|
511
|
+
/** Control size. Default `"md"`. */
|
|
512
|
+
size?: Size;
|
|
513
|
+
/** Element rendered inside, before the text. */
|
|
514
|
+
leftAdornment?: React.ReactNode;
|
|
515
|
+
/** Element rendered inside, after the text. */
|
|
516
|
+
rightAdornment?: React.ReactNode;
|
|
517
|
+
disabled?: boolean;
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Single-line text field. Anatomy: label · control · helper/error.
|
|
521
|
+
*
|
|
522
|
+
* @remarks
|
|
523
|
+
* State: controlled via `value`/`onChangeText`. Error recolors border, ring,
|
|
524
|
+
* and helper together. Related: {@link TextArea}, {@link SearchBar}.
|
|
525
|
+
* @example
|
|
526
|
+
* <Input label="Email" value={email} onChangeText={setEmail} error={emailError} />
|
|
527
|
+
*/
|
|
528
|
+
declare function Input({ label, helperText, error, size, leftAdornment, rightAdornment, disabled, value, onChangeText, placeholder, style, testID, onFocus, onBlur, ...rest }: InputProps): React.JSX.Element;
|
|
529
|
+
|
|
530
|
+
interface SwitchProps extends A11yProps {
|
|
531
|
+
/** Controlled on/off value. */
|
|
532
|
+
value?: boolean;
|
|
533
|
+
/** Uncontrolled initial value. Default `false`. */
|
|
534
|
+
defaultValue?: boolean;
|
|
535
|
+
/** Called with the next value on toggle. */
|
|
536
|
+
onValueChange?: (value: boolean) => void;
|
|
537
|
+
disabled?: boolean;
|
|
538
|
+
testID?: string;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* A binary on/off toggle with a spring-free, calm slide (Reanimated).
|
|
542
|
+
*
|
|
543
|
+
* @remarks
|
|
544
|
+
* State: controlled (`value` + `onValueChange`) or uncontrolled (`defaultValue`).
|
|
545
|
+
* Tap target stays ≥44px even though the track is smaller.
|
|
546
|
+
* Related: {@link Checkbox}, {@link Radio}.
|
|
547
|
+
* @example
|
|
548
|
+
* <Switch value={wifi} onValueChange={setWifi} accessibilityLabel="Wi-Fi" />
|
|
549
|
+
*/
|
|
550
|
+
declare function Switch({ value, defaultValue, onValueChange, disabled, accessibilityLabel, testID }: SwitchProps): React.JSX.Element;
|
|
551
|
+
|
|
552
|
+
interface CheckboxProps extends A11yProps {
|
|
553
|
+
/** Controlled checked value. */
|
|
554
|
+
value?: boolean;
|
|
555
|
+
/** Uncontrolled initial value. Default `false`. */
|
|
556
|
+
defaultValue?: boolean;
|
|
557
|
+
onValueChange?: (value: boolean) => void;
|
|
558
|
+
/** Optional inline label rendered to the right. */
|
|
559
|
+
label?: string;
|
|
560
|
+
disabled?: boolean;
|
|
561
|
+
testID?: string;
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* A square checkbox with an optional label. Same controlled/uncontrolled API as
|
|
565
|
+
* {@link Switch} and {@link Radio}.
|
|
566
|
+
*
|
|
567
|
+
* @remarks
|
|
568
|
+
* Do: use for independent multi-select options. Use {@link Radio} for exclusive choice.
|
|
569
|
+
* @example
|
|
570
|
+
* <Checkbox label="Email me updates" value={on} onValueChange={setOn} />
|
|
571
|
+
*/
|
|
572
|
+
declare function Checkbox({ value, defaultValue, onValueChange, label, disabled, accessibilityLabel, testID }: CheckboxProps): React.JSX.Element;
|
|
573
|
+
|
|
574
|
+
interface BadgeProps extends StyleableProps {
|
|
575
|
+
children: React.ReactNode;
|
|
576
|
+
/** Semantic status → color. Default `"neutral"`. */
|
|
577
|
+
status?: Status;
|
|
578
|
+
/** Show a leading dot. Default `false`. */
|
|
579
|
+
dot?: boolean;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* A small, static status marker. Uses the shared {@link Status} color set.
|
|
583
|
+
*
|
|
584
|
+
* @remarks
|
|
585
|
+
* Do: use for state (Active, Pending, Beta). Use {@link Chip} for interactive filters.
|
|
586
|
+
* @example
|
|
587
|
+
* <Badge status="success" dot>Active</Badge>
|
|
588
|
+
*/
|
|
589
|
+
declare function Badge({ children, status, dot, style, testID }: BadgeProps): React.JSX.Element;
|
|
590
|
+
|
|
591
|
+
export { type A11yProps, Badge, type BadgeProps, BellIcon, Button, type ButtonProps, Card, type CardProps, type CardVariant, CheckIcon, Checkbox, type CheckboxProps, ChevronRightIcon, CloseIcon, type ColorSchemeName, type ColorSchemePref, type ColorTokens, type DeepPartial, type Disclosure, Heading, type HeadingLevel, type HeadingProps, IconButton, type IconButtonProps, type IconProps, Input, type InputProps, PlusIcon, SearchIcon, type ShadowToken, type Size, type Status, type StyleableProps, Switch, type SwitchProps, Text, type TextProps, type TextStyleableProps, type TextTone, type TextVariant, type Theme, ThemeProvider, type ThemeProviderProps, type Variant, createTheme, darkTheme, lightTheme, shade, tokens, useColorSchemeControl, useControllableState, useDisclosure, useTheme, withAlpha };
|