@nwartz/design-system 0.1.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/components/Autocomplete.tsx +259 -0
- package/components/Badge.tsx +103 -0
- package/components/BottomNavBar.tsx +118 -0
- package/components/Box.tsx +99 -0
- package/components/Button.tsx +158 -0
- package/components/Card.tsx +60 -0
- package/components/Checkbox.tsx +151 -0
- package/components/DatePicker.tsx +410 -0
- package/components/DropdownSelect.tsx +158 -0
- package/components/Icon.tsx +131 -0
- package/components/InputField.tsx +202 -0
- package/components/LinkButton.tsx +69 -0
- package/components/ProgressBar.tsx +96 -0
- package/components/SearchBar.tsx +147 -0
- package/components/SegmentedTabs.tsx +88 -0
- package/components/Slider.tsx +159 -0
- package/components/TabMenu.tsx +86 -0
- package/components/TablePagination.tsx +176 -0
- package/components/Tag.tsx +128 -0
- package/components/Text.tsx +32 -0
- package/components/Toggle.tsx +112 -0
- package/components/index.ts +42 -0
- package/dist/index.d.mts +698 -0
- package/dist/index.d.ts +698 -0
- package/dist/index.js +2531 -0
- package/dist/index.mjs +2549 -0
- package/index.ts +89 -0
- package/package.json +63 -0
- package/theme/index.ts +2 -0
- package/theme/theme.tsx +61 -0
- package/tokens/colors.ts +55 -0
- package/tokens/elevation.ts +52 -0
- package/tokens/index.ts +11 -0
- package/tokens/mapping.ts +57 -0
- package/tokens/radius.ts +19 -0
- package/tokens/spacing.ts +36 -0
- package/tokens/typography.ts +53 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,698 @@
|
|
|
1
|
+
import { TextStyle, ViewProps, TextProps as TextProps$1, StyleProp, PressableProps, ViewStyle, TextInputProps } from 'react-native';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import * as phosphor_react_native from 'phosphor-react-native';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Nwartz DS — Dark Mode color tokens.
|
|
8
|
+
*
|
|
9
|
+
* Source: Figma "Nwartz DS | Foundations Dark Mode"
|
|
10
|
+
* These are the base neutrals; brand-specific colors (primary, accent)
|
|
11
|
+
* are supplied per-org via the theme provider.
|
|
12
|
+
*/
|
|
13
|
+
declare const darkColors: {
|
|
14
|
+
/** App background — the deepest layer. */
|
|
15
|
+
readonly backgroundScreen: "#131313";
|
|
16
|
+
/** Raised surfaces (cards, sheets, modals). */
|
|
17
|
+
readonly shapePrimary: "#1A1A1A";
|
|
18
|
+
/** Inset surfaces, secondary containers, chips. */
|
|
19
|
+
readonly shapeSecondary: "#2D2D2D";
|
|
20
|
+
/** Borders, dividers, disabled outlines. */
|
|
21
|
+
readonly shapeTertiary: "#404040";
|
|
22
|
+
/** Primary text on dark backgrounds. */
|
|
23
|
+
readonly textPrimary: "#FFFFFF";
|
|
24
|
+
/** Secondary / muted text. */
|
|
25
|
+
readonly textSecondary: "#E1E1E1";
|
|
26
|
+
/** Tertiary / placeholder text. */
|
|
27
|
+
readonly textTertiary: "#A0A0A0";
|
|
28
|
+
/** Brand primary — neon lime accent. */
|
|
29
|
+
readonly primaryPure: "#CEFE00";
|
|
30
|
+
/** Brand primary — darker shade for hover/pressed. */
|
|
31
|
+
readonly primaryMid: "#87AD00";
|
|
32
|
+
/** Destructive actions. */
|
|
33
|
+
readonly dangerMid: "#BB4355";
|
|
34
|
+
};
|
|
35
|
+
declare const lightColors: {
|
|
36
|
+
readonly backgroundScreen: "#F6F5F4";
|
|
37
|
+
readonly shapePrimary: "#FAF9F7";
|
|
38
|
+
readonly shapeSecondary: "#E9E8E7";
|
|
39
|
+
readonly shapeTertiary: "#D9D8D7";
|
|
40
|
+
readonly textPrimary: "#141414";
|
|
41
|
+
readonly textSecondary: "#737271";
|
|
42
|
+
readonly textTertiary: "#8E8D8B";
|
|
43
|
+
readonly primaryPure: "#CEFE00";
|
|
44
|
+
readonly primaryMid: "#87AD00";
|
|
45
|
+
readonly dangerMid: "#BB4355";
|
|
46
|
+
};
|
|
47
|
+
type ColorToken = keyof typeof darkColors;
|
|
48
|
+
/** Semantic color set resolved by the active color mode. */
|
|
49
|
+
type ResolvedColors = typeof darkColors;
|
|
50
|
+
/** Brand colors supplied per-org. */
|
|
51
|
+
interface BrandColors {
|
|
52
|
+
primaryPure: string;
|
|
53
|
+
primaryMid: string;
|
|
54
|
+
onPrimary?: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Base typography tokens as a plain object (safe to spread into StyleSheet). */
|
|
58
|
+
declare const typography: Record<string, TextStyle>;
|
|
59
|
+
type TypographyToken = keyof typeof typography;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Nwartz DS — Elevation (shadow) tokens.
|
|
63
|
+
*
|
|
64
|
+
* Each level maps to a named token used across the system. On Android the
|
|
65
|
+
* numeric `elevation` property is used; on iOS/web the shadow properties
|
|
66
|
+
* are applied.
|
|
67
|
+
*/
|
|
68
|
+
interface ElevationEntry {
|
|
69
|
+
elevation?: number;
|
|
70
|
+
shadowColor?: string;
|
|
71
|
+
shadowOffset?: {
|
|
72
|
+
width: number;
|
|
73
|
+
height: number;
|
|
74
|
+
};
|
|
75
|
+
shadowOpacity?: number;
|
|
76
|
+
shadowRadius?: number;
|
|
77
|
+
}
|
|
78
|
+
declare const elevation: Record<string, ElevationEntry>;
|
|
79
|
+
type ElevationToken = keyof typeof elevation;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Nwartz DS — Spacing scale.
|
|
83
|
+
*
|
|
84
|
+
* Based on a 4px base unit. Use these values for padding, margin, and gaps
|
|
85
|
+
* to maintain consistent rhythm across the UI.
|
|
86
|
+
*/
|
|
87
|
+
declare const spacing: {
|
|
88
|
+
/** 0px */
|
|
89
|
+
readonly none: 0;
|
|
90
|
+
/** 2px — hairline gaps. */
|
|
91
|
+
readonly xxs: 2;
|
|
92
|
+
/** 4px — tight inset (icon-to-label). */
|
|
93
|
+
readonly xs: 4;
|
|
94
|
+
/** 8px — compact gaps, small padding. */
|
|
95
|
+
readonly sm: 8;
|
|
96
|
+
/** 12px — default inner padding for small controls. */
|
|
97
|
+
readonly md: 12;
|
|
98
|
+
/** 16px — standard card padding, list row gaps. */
|
|
99
|
+
readonly lg: 16;
|
|
100
|
+
/** 20px — generous spacing. */
|
|
101
|
+
readonly xl: 20;
|
|
102
|
+
/** 24px — section gaps, card outer padding. */
|
|
103
|
+
readonly '2xl': 24;
|
|
104
|
+
/** 32px — large section spacing. */
|
|
105
|
+
readonly '3xl': 32;
|
|
106
|
+
/** 40px — page-level horizontal padding. */
|
|
107
|
+
readonly '4xl': 40;
|
|
108
|
+
/** 48px — hero spacing. */
|
|
109
|
+
readonly '5xl': 48;
|
|
110
|
+
/** 64px — page-level vertical spacing. */
|
|
111
|
+
readonly '6xl': 64;
|
|
112
|
+
/** 80px — maximum spacing. */
|
|
113
|
+
readonly '7xl': 80;
|
|
114
|
+
};
|
|
115
|
+
type SpacingToken = keyof typeof spacing;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Nwartz DS — Border radius tokens.
|
|
119
|
+
*/
|
|
120
|
+
declare const radius: {
|
|
121
|
+
/** 4px — tiny elements: badges, tags. */
|
|
122
|
+
readonly xs: 4;
|
|
123
|
+
/** 8px — small controls: inputs, chips. */
|
|
124
|
+
readonly sm: 8;
|
|
125
|
+
/** 12px — medium elements: tiles, list rows. */
|
|
126
|
+
readonly md: 12;
|
|
127
|
+
/** 16px — cards, panels. */
|
|
128
|
+
readonly lg: 16;
|
|
129
|
+
/** 24px — large cards, modals. */
|
|
130
|
+
readonly xl: 24;
|
|
131
|
+
/** Full circle / pill shape. */
|
|
132
|
+
readonly full: 9999;
|
|
133
|
+
};
|
|
134
|
+
type RadiusToken = keyof typeof radius;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Token mapping: bridges the mobile app's legacy color token names to the
|
|
138
|
+
* design system's semantic token keys. Used when migrating mobile components
|
|
139
|
+
* from the old `useTheme()` to `@nwartz/design-system`'s `useTheme()`.
|
|
140
|
+
*/
|
|
141
|
+
|
|
142
|
+
/** Mobile-app color key → design-system color key. */
|
|
143
|
+
declare const colorMap: Record<string, keyof ResolvedColors>;
|
|
144
|
+
/** Mobile-app spacing value → design-system spacing token. */
|
|
145
|
+
declare const spacingMap: Record<number, SpacingToken>;
|
|
146
|
+
/** Mobile-app radius value → design-system radius token. */
|
|
147
|
+
declare const radiusMap: Record<number, RadiusToken>;
|
|
148
|
+
|
|
149
|
+
type ThemeMode = 'light' | 'dark';
|
|
150
|
+
interface ThemeContextValue {
|
|
151
|
+
mode: ThemeMode;
|
|
152
|
+
colors: ResolvedColors;
|
|
153
|
+
/** Convenience: is the current mode dark? */
|
|
154
|
+
isDark: boolean;
|
|
155
|
+
}
|
|
156
|
+
interface ThemeProviderProps {
|
|
157
|
+
children: ReactNode;
|
|
158
|
+
/** Override the system color scheme. */
|
|
159
|
+
mode?: ThemeMode;
|
|
160
|
+
/** Override the full color set (e.g. from an org manifest). */
|
|
161
|
+
colors?: Partial<ResolvedColors>;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Wraps the app and provides the resolved color palette to all
|
|
165
|
+
* design-system components via `useTheme()`.
|
|
166
|
+
*/
|
|
167
|
+
declare function ThemeProvider({ children, mode: modeOverride, colors: colorOverrides }: ThemeProviderProps): react.JSX.Element;
|
|
168
|
+
/**
|
|
169
|
+
* Access the current theme. Must be used inside a `<ThemeProvider>`.
|
|
170
|
+
*
|
|
171
|
+
* ```tsx
|
|
172
|
+
* const { colors, mode } = useTheme();
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
declare function useTheme(): ThemeContextValue;
|
|
176
|
+
|
|
177
|
+
interface BoxProps extends ViewProps {
|
|
178
|
+
/** Background color token key from the resolved theme. */
|
|
179
|
+
bg?: 'backgroundScreen' | 'shapePrimary' | 'shapeSecondary';
|
|
180
|
+
/** Apply a named spacing token as padding. */
|
|
181
|
+
p?: SpacingToken;
|
|
182
|
+
/** Apply a named spacing token as horizontal padding. */
|
|
183
|
+
px?: SpacingToken;
|
|
184
|
+
/** Apply a named spacing token as vertical padding. */
|
|
185
|
+
py?: SpacingToken;
|
|
186
|
+
/** Apply a named spacing token as margin. */
|
|
187
|
+
m?: SpacingToken;
|
|
188
|
+
/** Apply a named spacing token as horizontal margin. */
|
|
189
|
+
mx?: SpacingToken;
|
|
190
|
+
/** Apply a named spacing token as vertical margin. */
|
|
191
|
+
my?: SpacingToken;
|
|
192
|
+
/** Apply a named radius token as border radius. */
|
|
193
|
+
rounded?: RadiusToken;
|
|
194
|
+
/** Apply a named elevation token as shadow. */
|
|
195
|
+
elevation?: ElevationToken;
|
|
196
|
+
/** Flex direction shortcut. */
|
|
197
|
+
direction?: 'row' | 'column';
|
|
198
|
+
/** Align items shortcut. */
|
|
199
|
+
align?: 'flex-start' | 'center' | 'flex-end' | 'stretch';
|
|
200
|
+
/** Justify content shortcut. */
|
|
201
|
+
justify?: 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around';
|
|
202
|
+
/** Gap between children. Raw pixel value. */
|
|
203
|
+
gap?: number;
|
|
204
|
+
/** Full width. */
|
|
205
|
+
fullWidth?: boolean;
|
|
206
|
+
/** Full height. */
|
|
207
|
+
fullHeight?: boolean;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Primitive layout component that maps design tokens to React Native styles.
|
|
211
|
+
*
|
|
212
|
+
* ```tsx
|
|
213
|
+
* <Box bg="shapePrimary" p="lg" rounded="xl" elevation="md">
|
|
214
|
+
* <Text>Hello</Text>
|
|
215
|
+
* </Box>
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
declare function Box({ bg, p, px, py, m, mx, my, rounded, elevation: elev, direction, align, justify, gap, fullWidth, fullHeight, style, children, ...rest }: BoxProps): react.JSX.Element;
|
|
219
|
+
|
|
220
|
+
interface TextProps extends TextProps$1 {
|
|
221
|
+
/** Preset typography token. Defaults to `body`. */
|
|
222
|
+
variant?: TypographyToken;
|
|
223
|
+
/** Override the text color from the resolved theme. */
|
|
224
|
+
color?: 'textPrimary' | 'textSecondary';
|
|
225
|
+
/** Additional style overrides. */
|
|
226
|
+
textStyle?: StyleProp<TextStyle>;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Theme-aware text component.
|
|
230
|
+
*
|
|
231
|
+
* ```tsx
|
|
232
|
+
* <Text variant="heading" color="textPrimary">Title</Text>
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
declare function Text({ variant, color, textStyle, style, children, ...rest }: TextProps): react.JSX.Element;
|
|
236
|
+
|
|
237
|
+
interface CardProps extends ViewProps {
|
|
238
|
+
/** Elevation level. Defaults to `sm`. */
|
|
239
|
+
level?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
240
|
+
/** Remove default padding. */
|
|
241
|
+
noPadding?: boolean;
|
|
242
|
+
/** Show a border around the card. */
|
|
243
|
+
bordered?: boolean;
|
|
244
|
+
/** Override the default border radius. */
|
|
245
|
+
radius?: RadiusToken;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Surface card component with design-system shadow and radius.
|
|
249
|
+
*
|
|
250
|
+
* ```tsx
|
|
251
|
+
* <Card level="md">
|
|
252
|
+
* <Text>Content</Text>
|
|
253
|
+
* </Card>
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
declare function Card({ level, noPadding, bordered, radius: radiusToken, style, children, ...rest }: CardProps): react.JSX.Element;
|
|
257
|
+
|
|
258
|
+
type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'danger' | 'ghost';
|
|
259
|
+
interface ButtonProps extends Omit<PressableProps, 'style'> {
|
|
260
|
+
label: string;
|
|
261
|
+
variant?: ButtonVariant;
|
|
262
|
+
loading?: boolean;
|
|
263
|
+
size?: 'md' | 'sm';
|
|
264
|
+
style?: StyleProp<ViewStyle>;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Design-system button with variants and loading state.
|
|
268
|
+
*
|
|
269
|
+
* ```tsx
|
|
270
|
+
* <Button label="Save" variant="primary" />
|
|
271
|
+
* <Button label="Cancel" variant="ghost" />
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
declare function Button({ label, variant, loading, size, style, disabled, ...rest }: ButtonProps): react.JSX.Element;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Icon name registry. Maps a string name to a Phosphor icon component.
|
|
278
|
+
* Add new icons here as they're needed across the design system.
|
|
279
|
+
*/
|
|
280
|
+
declare const iconMap: {
|
|
281
|
+
readonly "caret-down": phosphor_react_native.Icon;
|
|
282
|
+
readonly "caret-up": phosphor_react_native.Icon;
|
|
283
|
+
readonly "caret-right": phosphor_react_native.Icon;
|
|
284
|
+
readonly check: phosphor_react_native.Icon;
|
|
285
|
+
readonly "x-circle": phosphor_react_native.Icon;
|
|
286
|
+
readonly x: phosphor_react_native.Icon;
|
|
287
|
+
readonly "warning-circle": phosphor_react_native.Icon;
|
|
288
|
+
readonly "warning-octagon": phosphor_react_native.Icon;
|
|
289
|
+
readonly house: phosphor_react_native.Icon;
|
|
290
|
+
readonly bell: phosphor_react_native.Icon;
|
|
291
|
+
readonly broadcast: phosphor_react_native.Icon;
|
|
292
|
+
readonly "chat-circle": phosphor_react_native.Icon;
|
|
293
|
+
readonly "check-circle": phosphor_react_native.Icon;
|
|
294
|
+
readonly truck: phosphor_react_native.Icon;
|
|
295
|
+
readonly "credit-card": phosphor_react_native.Icon;
|
|
296
|
+
readonly crown: phosphor_react_native.Icon;
|
|
297
|
+
readonly "crosshair-simple": phosphor_react_native.Icon;
|
|
298
|
+
readonly gauge: phosphor_react_native.Icon;
|
|
299
|
+
readonly lightning: phosphor_react_native.Icon;
|
|
300
|
+
readonly "thumbs-up": phosphor_react_native.Icon;
|
|
301
|
+
readonly "map-trifold": phosphor_react_native.Icon;
|
|
302
|
+
readonly "map-pin": phosphor_react_native.Icon;
|
|
303
|
+
readonly medal: phosphor_react_native.Icon;
|
|
304
|
+
readonly microphone: phosphor_react_native.Icon;
|
|
305
|
+
readonly "speaker-simple-x": phosphor_react_native.Icon;
|
|
306
|
+
readonly play: phosphor_react_native.Icon;
|
|
307
|
+
readonly plus: phosphor_react_native.Icon;
|
|
308
|
+
readonly "radio-button": phosphor_react_native.Icon;
|
|
309
|
+
readonly radio: phosphor_react_native.Icon;
|
|
310
|
+
readonly "chart-bar": phosphor_react_native.Icon;
|
|
311
|
+
readonly receipt: phosphor_react_native.Icon;
|
|
312
|
+
readonly path: phosphor_react_native.Icon;
|
|
313
|
+
readonly "magnifying-glass": phosphor_react_native.Icon;
|
|
314
|
+
readonly "gear-six": phosphor_react_native.Icon;
|
|
315
|
+
readonly "share-network": phosphor_react_native.Icon;
|
|
316
|
+
readonly star: phosphor_react_native.Icon;
|
|
317
|
+
readonly "sign-out": phosphor_react_native.Icon;
|
|
318
|
+
readonly "steering-wheel": phosphor_react_native.Icon;
|
|
319
|
+
readonly timer: phosphor_react_native.Icon;
|
|
320
|
+
readonly pencil: phosphor_react_native.Icon;
|
|
321
|
+
readonly user: phosphor_react_native.Icon;
|
|
322
|
+
readonly "user-minus": phosphor_react_native.Icon;
|
|
323
|
+
readonly users: phosphor_react_native.Icon;
|
|
324
|
+
readonly globe: phosphor_react_native.Icon;
|
|
325
|
+
readonly wallet: phosphor_react_native.Icon;
|
|
326
|
+
readonly lock: phosphor_react_native.Icon;
|
|
327
|
+
};
|
|
328
|
+
type IconName = keyof typeof iconMap;
|
|
329
|
+
interface IconProps {
|
|
330
|
+
/** Icon name from the registry. */
|
|
331
|
+
name: IconName;
|
|
332
|
+
/** Icon size in pixels. Defaults to 16. */
|
|
333
|
+
size?: number;
|
|
334
|
+
/** Icon color. */
|
|
335
|
+
color?: string;
|
|
336
|
+
/** Icon weight / stroke thickness. */
|
|
337
|
+
weight?: "thin" | "light" | "regular" | "bold" | "fill" | "duotone";
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Design-system icon component backed by Phosphor.
|
|
341
|
+
*
|
|
342
|
+
* ```tsx
|
|
343
|
+
* <Icon name="caret-down" size={16} color="#737271" />
|
|
344
|
+
* ```
|
|
345
|
+
*/
|
|
346
|
+
declare function Icon({ name, size, color, weight }: IconProps): react.JSX.Element | null;
|
|
347
|
+
|
|
348
|
+
interface DropdownItem {
|
|
349
|
+
key: string;
|
|
350
|
+
label: string;
|
|
351
|
+
disabled?: boolean;
|
|
352
|
+
}
|
|
353
|
+
interface DropdownSelectProps extends ViewProps {
|
|
354
|
+
/** List of items to display. */
|
|
355
|
+
items: DropdownItem[];
|
|
356
|
+
/** Currently selected item key. */
|
|
357
|
+
value?: string | null;
|
|
358
|
+
/** Called when an item is selected. */
|
|
359
|
+
onSelect?: (item: DropdownItem) => void;
|
|
360
|
+
/** Show the dropdown list. */
|
|
361
|
+
open?: boolean;
|
|
362
|
+
/** Max visible items before scroll. */
|
|
363
|
+
maxVisible?: number;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Dropdown select list with check indicator and hover/focus states.
|
|
367
|
+
*
|
|
368
|
+
* ```tsx
|
|
369
|
+
* <DropdownSelect
|
|
370
|
+
* items={[{ key: '1', label: 'Option 1' }]}
|
|
371
|
+
* value="1"
|
|
372
|
+
* onSelect={handleSelect}
|
|
373
|
+
* />
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
declare function DropdownSelect({ items, value, onSelect, open, maxVisible, style, ...rest }: DropdownSelectProps): react.JSX.Element | null;
|
|
377
|
+
|
|
378
|
+
type AutocompleteSize = 'sm' | 'md';
|
|
379
|
+
type AutocompleteState = 'default' | 'hover' | 'focus' | 'typing' | 'selected' | 'filled' | 'error' | 'disabled';
|
|
380
|
+
interface AutocompleteProps extends Omit<TextInputProps, 'value' | 'onChangeText'> {
|
|
381
|
+
/** Label displayed above the input. */
|
|
382
|
+
label: string;
|
|
383
|
+
/** Current input value. */
|
|
384
|
+
value?: string;
|
|
385
|
+
/** Called when text changes. */
|
|
386
|
+
onChangeText?: (text: string) => void;
|
|
387
|
+
/** Input size. */
|
|
388
|
+
size?: AutocompleteSize;
|
|
389
|
+
/** Whether the input is disabled. */
|
|
390
|
+
disabled?: boolean;
|
|
391
|
+
/** Error message displayed below the input. */
|
|
392
|
+
errorMessage?: string;
|
|
393
|
+
/** Dropdown items. */
|
|
394
|
+
items?: DropdownItem[];
|
|
395
|
+
/** Selected item key. */
|
|
396
|
+
selectedItem?: string | null;
|
|
397
|
+
/** Called when a dropdown item is selected. */
|
|
398
|
+
onSelectItem?: (item: DropdownItem) => void;
|
|
399
|
+
/** Whether the dropdown is open. */
|
|
400
|
+
open?: boolean;
|
|
401
|
+
/** Called to toggle the dropdown. */
|
|
402
|
+
onToggle?: () => void;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Autocomplete input with dropdown, matching the Nwartz DS spec.
|
|
406
|
+
*
|
|
407
|
+
* Supports sizes (sm/md), states (default/hover/focus/typing/selected/filled/error/disabled),
|
|
408
|
+
* label, error message, and a dropdown list.
|
|
409
|
+
*
|
|
410
|
+
* ```tsx
|
|
411
|
+
* <Autocomplete
|
|
412
|
+
* label="Country"
|
|
413
|
+
* placeholder="Start typing..."
|
|
414
|
+
* items={countries}
|
|
415
|
+
* onSelectItem={handleSelect}
|
|
416
|
+
* />
|
|
417
|
+
* ```
|
|
418
|
+
*/
|
|
419
|
+
declare function Autocomplete({ label, value, onChangeText, size, disabled, errorMessage, items, selectedItem, onSelectItem, open, onToggle, placeholder, ...rest }: AutocompleteProps): react.JSX.Element;
|
|
420
|
+
|
|
421
|
+
type SegmentedTabItem = {
|
|
422
|
+
id: string;
|
|
423
|
+
label: string;
|
|
424
|
+
};
|
|
425
|
+
interface SegmentedTabsProps {
|
|
426
|
+
tabs: SegmentedTabItem[];
|
|
427
|
+
activeTabId: string;
|
|
428
|
+
onTabChange: (tabId: string) => void;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Horizontal segmented tab bar for switching between views.
|
|
432
|
+
*
|
|
433
|
+
* ```tsx
|
|
434
|
+
* <SegmentedTabs
|
|
435
|
+
* tabs={[{ id: 'feed', label: 'Feed' }, { id: 'radio', label: 'Radio PX' }]}
|
|
436
|
+
* activeTabId={activeTab}
|
|
437
|
+
* onTabChange={setActiveTab}
|
|
438
|
+
* />
|
|
439
|
+
* ```
|
|
440
|
+
*/
|
|
441
|
+
declare function SegmentedTabs({ tabs, activeTabId, onTabChange }: SegmentedTabsProps): react.JSX.Element;
|
|
442
|
+
|
|
443
|
+
type BadgeSize = 'sm' | 'md' | 'lg';
|
|
444
|
+
type BadgeColor = 'primary' | 'secondary' | 'info' | 'warning' | 'success' | 'error' | 'gray';
|
|
445
|
+
type BadgeMode = 'solid' | 'outline';
|
|
446
|
+
interface BadgeProps extends ViewProps {
|
|
447
|
+
label: string;
|
|
448
|
+
size?: BadgeSize;
|
|
449
|
+
color?: BadgeColor;
|
|
450
|
+
mode?: BadgeMode;
|
|
451
|
+
icon?: IconName;
|
|
452
|
+
trailingIcon?: IconName;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Inline badge for status indicators, counts, and labels.
|
|
456
|
+
*
|
|
457
|
+
* ```tsx
|
|
458
|
+
* <Badge label="Active" color="success" />
|
|
459
|
+
* <Badge label="3" color="error" size="sm" />
|
|
460
|
+
* <Badge label="Info" color="info" mode="outline" />
|
|
461
|
+
* ```
|
|
462
|
+
*/
|
|
463
|
+
declare function Badge({ label, size, color, mode, icon, trailingIcon, style, ...rest }: BadgeProps): react.JSX.Element;
|
|
464
|
+
|
|
465
|
+
type InputFieldSize = 'sm' | 'md';
|
|
466
|
+
interface InputFieldProps extends Omit<TextInputProps, 'value' | 'onChangeText'> {
|
|
467
|
+
label?: string;
|
|
468
|
+
value?: string;
|
|
469
|
+
onChangeText?: (text: string) => void;
|
|
470
|
+
size?: InputFieldSize;
|
|
471
|
+
disabled?: boolean;
|
|
472
|
+
errorMessage?: string;
|
|
473
|
+
leadingIcon?: IconName;
|
|
474
|
+
trailingIcon?: IconName;
|
|
475
|
+
onTrailingIconPress?: () => void;
|
|
476
|
+
secureTextEntry?: boolean;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Text input field with label, helper text, icons, and error state.
|
|
480
|
+
*
|
|
481
|
+
* ```tsx
|
|
482
|
+
* <InputField label="Email" placeholder="you@example.com" />
|
|
483
|
+
* <InputField label="Password" secureTextEntry errorMessage="Required" />
|
|
484
|
+
* ```
|
|
485
|
+
*/
|
|
486
|
+
declare function InputField({ label, value, onChangeText, size, disabled, errorMessage, leadingIcon, trailingIcon, onTrailingIconPress, placeholder, secureTextEntry, ...rest }: InputFieldProps): react.JSX.Element;
|
|
487
|
+
|
|
488
|
+
type TagSize = 'sm' | 'md' | 'lg';
|
|
489
|
+
interface TagProps extends ViewProps {
|
|
490
|
+
label: string;
|
|
491
|
+
size?: TagSize;
|
|
492
|
+
icon?: IconName;
|
|
493
|
+
trailingIcon?: IconName;
|
|
494
|
+
count?: number;
|
|
495
|
+
onPress?: () => void;
|
|
496
|
+
onTrailingPress?: () => void;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Inline tag for filters, categories, and removable labels.
|
|
500
|
+
*
|
|
501
|
+
* ```tsx
|
|
502
|
+
* <Tag label="Sport" icon="star" />
|
|
503
|
+
* <Tag label="Filter" trailingIcon="x" onTrailingPress={clear} count={3} />
|
|
504
|
+
* ```
|
|
505
|
+
*/
|
|
506
|
+
declare function Tag({ label, size, icon, trailingIcon, count, onPress, onTrailingPress, style, ...rest }: TagProps): react.JSX.Element;
|
|
507
|
+
|
|
508
|
+
type ToggleSize = 'sm' | 'md';
|
|
509
|
+
interface ToggleProps {
|
|
510
|
+
value: boolean;
|
|
511
|
+
onValueChange: (value: boolean) => void;
|
|
512
|
+
label?: string;
|
|
513
|
+
disabled?: boolean;
|
|
514
|
+
size?: ToggleSize;
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Toggle switch for boolean on/off state.
|
|
518
|
+
*
|
|
519
|
+
* ```tsx
|
|
520
|
+
* <Toggle value={enabled} onValueChange={setEnabled} label="Notifications" />
|
|
521
|
+
* <Toggle value={v} onValueChange={setV} size="sm" />
|
|
522
|
+
* ```
|
|
523
|
+
*/
|
|
524
|
+
declare function Toggle({ value, onValueChange, label, disabled, size }: ToggleProps): react.JSX.Element;
|
|
525
|
+
|
|
526
|
+
interface DatePickerProps {
|
|
527
|
+
label?: string;
|
|
528
|
+
startDate?: Date | null;
|
|
529
|
+
endDate?: Date | null;
|
|
530
|
+
onChange?: (start: Date | null, end: Date | null) => void;
|
|
531
|
+
disabled?: boolean;
|
|
532
|
+
errorMessage?: string;
|
|
533
|
+
placeholder?: string;
|
|
534
|
+
open?: boolean;
|
|
535
|
+
onToggle?: () => void;
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Date range picker with calendar grid, month navigation, input fields, and action buttons.
|
|
539
|
+
*
|
|
540
|
+
* ```tsx
|
|
541
|
+
* <DatePicker startDate={start} endDate={end} onChange={setDates} />
|
|
542
|
+
* ```
|
|
543
|
+
*/
|
|
544
|
+
declare function DatePicker({ startDate, endDate, onChange, disabled, errorMessage, placeholder, open, onToggle, }: DatePickerProps): react.JSX.Element;
|
|
545
|
+
|
|
546
|
+
type CheckboxType = 'checkbox' | 'radio';
|
|
547
|
+
type CheckboxSize = 'sm' | 'md';
|
|
548
|
+
interface CheckboxProps {
|
|
549
|
+
value: boolean;
|
|
550
|
+
onValueChange: (value: boolean) => void;
|
|
551
|
+
label?: string;
|
|
552
|
+
disabled?: boolean;
|
|
553
|
+
size?: CheckboxSize;
|
|
554
|
+
type?: CheckboxType;
|
|
555
|
+
indeterminate?: boolean;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Checkbox or radio button for selection with label.
|
|
559
|
+
*
|
|
560
|
+
* ```tsx
|
|
561
|
+
* <Checkbox value={selected} onValueChange={setSelected} label="I agree" />
|
|
562
|
+
* <Checkbox value={v} onValueChange={setV} type="radio" label="Option A" />
|
|
563
|
+
* <Checkbox value={partial} onValueChange={setPartial} indeterminate />
|
|
564
|
+
* ```
|
|
565
|
+
*/
|
|
566
|
+
declare function Checkbox({ value, onValueChange, label, disabled, size, type, indeterminate, }: CheckboxProps): react.JSX.Element;
|
|
567
|
+
|
|
568
|
+
interface TablePaginationProps {
|
|
569
|
+
currentPage: number;
|
|
570
|
+
totalPages: number;
|
|
571
|
+
onPageChange: (page: number) => void;
|
|
572
|
+
totalItems?: number;
|
|
573
|
+
pageSize?: number;
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Pagination control for tables with page numbers and navigation buttons.
|
|
577
|
+
*
|
|
578
|
+
* ```tsx
|
|
579
|
+
* <TablePagination currentPage={2} totalPages={10} onPageChange={setPage} />
|
|
580
|
+
* ```
|
|
581
|
+
*/
|
|
582
|
+
declare function TablePagination({ currentPage, totalPages, onPageChange, }: TablePaginationProps): react.JSX.Element;
|
|
583
|
+
|
|
584
|
+
interface LinkButtonProps extends Omit<PressableProps, 'style'> {
|
|
585
|
+
label: string;
|
|
586
|
+
icon?: IconName;
|
|
587
|
+
color?: 'primary' | 'secondary';
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Text-styled button that looks like a hyperlink, with optional icon.
|
|
591
|
+
*
|
|
592
|
+
* ```tsx
|
|
593
|
+
* <LinkButton label="Forgot password?" />
|
|
594
|
+
* <LinkButton label="View all" icon="caret-right" />
|
|
595
|
+
* ```
|
|
596
|
+
*/
|
|
597
|
+
declare function LinkButton({ label, icon, color, disabled, ...rest }: LinkButtonProps): react.JSX.Element;
|
|
598
|
+
|
|
599
|
+
type BottomNavBarItem = {
|
|
600
|
+
id: string;
|
|
601
|
+
icon: IconName;
|
|
602
|
+
badge?: number;
|
|
603
|
+
};
|
|
604
|
+
interface BottomNavBarProps {
|
|
605
|
+
items: BottomNavBarItem[];
|
|
606
|
+
activeItemId: string;
|
|
607
|
+
onItemPress: (itemId: string) => void;
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Bottom navigation bar with lime circle active item indicator.
|
|
611
|
+
*
|
|
612
|
+
* ```tsx
|
|
613
|
+
* <BottomNavBar
|
|
614
|
+
* items={[
|
|
615
|
+
* { id: 'home', icon: 'house' },
|
|
616
|
+
* { id: 'stats', icon: 'chart-bar' },
|
|
617
|
+
* { id: 'profile', icon: 'user' },
|
|
618
|
+
* ]}
|
|
619
|
+
* activeItemId="home"
|
|
620
|
+
* onItemPress={navigate}
|
|
621
|
+
* />
|
|
622
|
+
* ```
|
|
623
|
+
*/
|
|
624
|
+
declare function BottomNavBar({ items, activeItemId, onItemPress }: BottomNavBarProps): react.JSX.Element;
|
|
625
|
+
|
|
626
|
+
interface ProgressBarProps {
|
|
627
|
+
value: number;
|
|
628
|
+
showLabel?: boolean;
|
|
629
|
+
animated?: boolean;
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Progress bar with percentage label.
|
|
633
|
+
*
|
|
634
|
+
* ```tsx
|
|
635
|
+
* <ProgressBar value={0.7} showLabel />
|
|
636
|
+
* <ProgressBar value={0.3} />
|
|
637
|
+
* ```
|
|
638
|
+
*/
|
|
639
|
+
declare function ProgressBar({ value, showLabel, animated }: ProgressBarProps): react.JSX.Element;
|
|
640
|
+
|
|
641
|
+
interface SearchBarProps extends Omit<TextInputProps, 'value' | 'onChangeText'> {
|
|
642
|
+
label?: string;
|
|
643
|
+
value?: string;
|
|
644
|
+
onChangeText?: (text: string) => void;
|
|
645
|
+
placeholder?: string;
|
|
646
|
+
disabled?: boolean;
|
|
647
|
+
onClear?: () => void;
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* Search input with magnifying glass icon, label, and clear button.
|
|
651
|
+
*
|
|
652
|
+
* ```tsx
|
|
653
|
+
* <SearchBar label="Search" value={query} onChangeText={setQuery} />
|
|
654
|
+
* ```
|
|
655
|
+
*/
|
|
656
|
+
declare function SearchBar({ label, value, onChangeText, placeholder, disabled, onClear, ...rest }: SearchBarProps): react.JSX.Element;
|
|
657
|
+
|
|
658
|
+
interface SliderProps {
|
|
659
|
+
value: number;
|
|
660
|
+
minimumValue?: number;
|
|
661
|
+
maximumValue?: number;
|
|
662
|
+
step?: number;
|
|
663
|
+
onValueChange: (value: number) => void;
|
|
664
|
+
disabled?: boolean;
|
|
665
|
+
showValueLabel?: boolean;
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Horizontal slider with draggable thumb and value label.
|
|
669
|
+
*
|
|
670
|
+
* ```tsx
|
|
671
|
+
* <Slider value={50} onValueChange={setValue} showValueLabel />
|
|
672
|
+
* ```
|
|
673
|
+
*/
|
|
674
|
+
declare function Slider({ value, minimumValue, maximumValue, step, onValueChange, disabled, showValueLabel, }: SliderProps): react.JSX.Element;
|
|
675
|
+
|
|
676
|
+
type TabMenuItem = {
|
|
677
|
+
id: string;
|
|
678
|
+
label: string;
|
|
679
|
+
};
|
|
680
|
+
interface TabMenuProps {
|
|
681
|
+
tabs: TabMenuItem[];
|
|
682
|
+
activeTabId: string;
|
|
683
|
+
onTabChange: (tabId: string) => void;
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Tab menu with underline indicator.
|
|
687
|
+
*
|
|
688
|
+
* ```tsx
|
|
689
|
+
* <TabMenu
|
|
690
|
+
* tabs={[{ id: 'overview', label: 'Overview' }, { id: 'details', label: 'Details' }]}
|
|
691
|
+
* activeTabId="overview"
|
|
692
|
+
* onTabChange={setTab}
|
|
693
|
+
* />
|
|
694
|
+
* ```
|
|
695
|
+
*/
|
|
696
|
+
declare function TabMenu({ tabs, activeTabId, onTabChange }: TabMenuProps): react.JSX.Element;
|
|
697
|
+
|
|
698
|
+
export { Autocomplete, type AutocompleteProps, type AutocompleteSize, type AutocompleteState, Badge, type BadgeColor, type BadgeMode, type BadgeProps, type BadgeSize, BottomNavBar, type BottomNavBarItem, type BottomNavBarProps, Box, type BoxProps, type BrandColors, Button, type ButtonProps, type ButtonVariant, Card, type CardProps, Checkbox, type CheckboxProps, type CheckboxSize, type CheckboxType, type ColorToken, DatePicker, type DatePickerProps, type DropdownItem, DropdownSelect, type DropdownSelectProps, type ElevationToken, Icon, type IconName, type IconProps, InputField, type InputFieldProps, type InputFieldSize, LinkButton, type LinkButtonProps, ProgressBar, type ProgressBarProps, type RadiusToken, type ResolvedColors, SearchBar, type SearchBarProps, type SegmentedTabItem, SegmentedTabs, type SegmentedTabsProps, Slider, type SliderProps, type SpacingToken, TabMenu, type TabMenuItem, type TabMenuProps, TablePagination, type TablePaginationProps, Tag, type TagProps, type TagSize, Text, type TextProps, type ThemeContextValue, type ThemeMode, ThemeProvider, type ThemeProviderProps, Toggle, type ToggleProps, type ToggleSize, type TypographyToken, colorMap, darkColors, elevation, lightColors, radius, radiusMap, spacing, spacingMap, typography, useTheme };
|