radix-native 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +51 -0
  3. package/dist/index.cjs +4323 -0
  4. package/dist/index.d.cts +861 -0
  5. package/dist/index.d.mts +861 -0
  6. package/dist/index.d.ts +861 -0
  7. package/dist/index.mjs +4285 -0
  8. package/package.json +51 -0
  9. package/src/components/actions/Button.tsx +337 -0
  10. package/src/components/actions/Checkbox.tsx +216 -0
  11. package/src/components/actions/CheckboxCards.tsx +257 -0
  12. package/src/components/actions/CheckboxGroup.tsx +249 -0
  13. package/src/components/actions/index.ts +4 -0
  14. package/src/components/layout/Box.tsx +108 -0
  15. package/src/components/layout/Flex.tsx +149 -0
  16. package/src/components/layout/Grid.tsx +224 -0
  17. package/src/components/layout/index.ts +9 -0
  18. package/src/components/playground/ThemeControls.tsx +456 -0
  19. package/src/components/playground/index.ts +1 -0
  20. package/src/components/typography/Blockquote.tsx +137 -0
  21. package/src/components/typography/Code.tsx +164 -0
  22. package/src/components/typography/Em.tsx +68 -0
  23. package/src/components/typography/Heading.tsx +136 -0
  24. package/src/components/typography/Kbd.tsx +162 -0
  25. package/src/components/typography/Link.tsx +173 -0
  26. package/src/components/typography/Quote.tsx +71 -0
  27. package/src/components/typography/Strong.tsx +70 -0
  28. package/src/components/typography/Text.tsx +140 -0
  29. package/src/components/typography/index.ts +9 -0
  30. package/src/hooks/useResolveColor.ts +24 -0
  31. package/src/hooks/useThemeContext.ts +11 -0
  32. package/src/index.ts +63 -0
  33. package/src/theme/Theme.tsx +12 -0
  34. package/src/theme/ThemeContext.ts +4 -0
  35. package/src/theme/ThemeImpl.tsx +54 -0
  36. package/src/theme/ThemeRoot.tsx +65 -0
  37. package/src/theme/createTheme.tsx +17 -0
  38. package/src/theme/resolveGrayColor.ts +38 -0
  39. package/src/theme/theme.types.ts +95 -0
  40. package/src/tokens/colors/amber.ts +28 -0
  41. package/src/tokens/colors/blue.ts +28 -0
  42. package/src/tokens/colors/bronze.ts +28 -0
  43. package/src/tokens/colors/brown.ts +28 -0
  44. package/src/tokens/colors/crimson.ts +28 -0
  45. package/src/tokens/colors/cyan.ts +28 -0
  46. package/src/tokens/colors/gold.ts +28 -0
  47. package/src/tokens/colors/grass.ts +28 -0
  48. package/src/tokens/colors/gray.ts +28 -0
  49. package/src/tokens/colors/green.ts +28 -0
  50. package/src/tokens/colors/index.ts +36 -0
  51. package/src/tokens/colors/indigo.ts +28 -0
  52. package/src/tokens/colors/iris.ts +28 -0
  53. package/src/tokens/colors/jade.ts +28 -0
  54. package/src/tokens/colors/lime.ts +28 -0
  55. package/src/tokens/colors/mauve.ts +28 -0
  56. package/src/tokens/colors/mint.ts +28 -0
  57. package/src/tokens/colors/olive.ts +28 -0
  58. package/src/tokens/colors/orange.ts +28 -0
  59. package/src/tokens/colors/pink.ts +28 -0
  60. package/src/tokens/colors/plum.ts +28 -0
  61. package/src/tokens/colors/purple.ts +28 -0
  62. package/src/tokens/colors/red.ts +28 -0
  63. package/src/tokens/colors/ruby.ts +28 -0
  64. package/src/tokens/colors/sage.ts +28 -0
  65. package/src/tokens/colors/sand.ts +28 -0
  66. package/src/tokens/colors/sky.ts +28 -0
  67. package/src/tokens/colors/slate.ts +28 -0
  68. package/src/tokens/colors/teal.ts +28 -0
  69. package/src/tokens/colors/tomato.ts +28 -0
  70. package/src/tokens/colors/types.ts +69 -0
  71. package/src/tokens/colors/violet.ts +28 -0
  72. package/src/tokens/colors/yellow.ts +28 -0
  73. package/src/tokens/index.ts +5 -0
  74. package/src/tokens/radius.ts +56 -0
  75. package/src/tokens/scaling.ts +10 -0
  76. package/src/tokens/spacing.ts +21 -0
  77. package/src/tokens/typography.ts +60 -0
  78. package/src/utils/applyScaling.ts +6 -0
  79. package/src/utils/classicEffect.ts +46 -0
  80. package/src/utils/resolveColor.ts +69 -0
  81. package/src/utils/resolveSpace.ts +13 -0
@@ -0,0 +1,861 @@
1
+ import React$1 from 'react';
2
+ import { ViewStyle, ViewProps, TextProps as TextProps$1, StyleProp, TextStyle, PressableProps } from 'react-native';
3
+
4
+ type AccentColor = 'gray' | 'gold' | 'bronze' | 'brown' | 'yellow' | 'amber' | 'orange' | 'tomato' | 'red' | 'ruby' | 'crimson' | 'pink' | 'plum' | 'purple' | 'violet' | 'iris' | 'indigo' | 'blue' | 'cyan' | 'teal' | 'jade' | 'green' | 'grass' | 'lime' | 'mint' | 'sky';
5
+ type GrayColor = 'gray' | 'mauve' | 'slate' | 'sage' | 'olive' | 'sand';
6
+
7
+ type RadiusToken = 'none' | 'small' | 'medium' | 'large' | 'full';
8
+ /** Radius level (1–6) — components choose the level that fits their visual size. */
9
+ type RadiusLevel = 1 | 2 | 3 | 4 | 5 | 6;
10
+ /**
11
+ * Returns the border radius in pixels for a given token and level.
12
+ * Each component picks the level that matches its visual size.
13
+ */
14
+ declare function getRadius(token: RadiusToken, level: RadiusLevel): number;
15
+ /**
16
+ * Returns the full (pill) radius for a given token.
17
+ * Use this for components that should be fully rounded when token='full'.
18
+ */
19
+ declare function getFullRadius(token: RadiusToken): number;
20
+
21
+ type ScalingMode = '90%' | '95%' | '100%' | '105%' | '110%';
22
+ /** Multiplier applied to space, fontSize and lineHeight */
23
+ declare const scalingMap: Record<ScalingMode, number>;
24
+
25
+ type ThemeAppearance = 'inherit' | 'light' | 'dark';
26
+ type ThemeColor = `accent-${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}` | `accent-a${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}` | `gray-${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}` | `gray-a${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}` | `${AccentColor}-${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}` | (string & {});
27
+ interface ThemeFonts {
28
+ /** fontWeight 300 — falls back to regular */
29
+ light?: string;
30
+ /** fontWeight 400 — base body font */
31
+ regular?: string;
32
+ /** fontWeight 500 — falls back to regular */
33
+ medium?: string;
34
+ /** fontWeight 700 — falls back to regular */
35
+ bold?: string;
36
+ /** Heading component — falls back to bold → regular */
37
+ heading?: string;
38
+ /** Code / Kbd — monospace font, falls back to system monospace */
39
+ code?: string;
40
+ }
41
+ /**
42
+ * Partial override of individual color steps within a scale.
43
+ * Only the steps you specify are overridden; the rest fall back to the built-in scale.
44
+ */
45
+ type ColorScaleOverride = Partial<Record<1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 'a1' | 'a2' | 'a3' | 'a4' | 'a5' | 'a6' | 'a7' | 'a8' | 'a9' | 'a10' | 'a11' | 'a12' | 'contrast' | 'surface', string>>;
46
+ /**
47
+ * Override any color scale with light/dark variants — like overriding CSS custom
48
+ * properties in Radix web (e.g. `--red-9: #custom`).
49
+ *
50
+ * @example
51
+ * colorOverrides={{
52
+ * red: {
53
+ * light: { 9: '#e54666', 10: '#dc3b5d' },
54
+ * dark: { 9: '#e5484d', 10: '#ec5d5e' },
55
+ * },
56
+ * }}
57
+ */
58
+ type ColorOverrides = Partial<Record<AccentColor | GrayColor, {
59
+ light?: ColorScaleOverride;
60
+ dark?: ColorScaleOverride;
61
+ }>>;
62
+ interface ThemeChangeHandlers {
63
+ onAppearanceChange: (value: 'light' | 'dark') => void;
64
+ onAccentColorChange: (value: AccentColor) => void;
65
+ onGrayColorChange: (value: GrayColor | 'auto') => void;
66
+ onRadiusChange: (value: RadiusToken) => void;
67
+ onScalingChange: (value: ScalingMode) => void;
68
+ }
69
+ interface ThemeContextValue extends ThemeChangeHandlers {
70
+ /** Resolved appearance — always 'light' | 'dark', never 'inherit' */
71
+ appearance: 'light' | 'dark';
72
+ accentColor: AccentColor;
73
+ grayColor: GrayColor | 'auto';
74
+ /** Resolved gray when grayColor is 'auto' */
75
+ resolvedGrayColor: GrayColor;
76
+ radius: RadiusToken;
77
+ scaling: ScalingMode;
78
+ /** RN-only: custom font family names */
79
+ fonts: ThemeFonts;
80
+ /** RN-only: override individual color steps */
81
+ colorOverrides: ColorOverrides;
82
+ }
83
+ interface ThemeProps {
84
+ appearance?: ThemeAppearance;
85
+ accentColor?: AccentColor;
86
+ grayColor?: GrayColor | 'auto';
87
+ radius?: RadiusToken;
88
+ scaling?: ScalingMode;
89
+ /** RN-only */
90
+ fonts?: ThemeFonts;
91
+ /** RN-only */
92
+ colorOverrides?: ColorOverrides;
93
+ children: React.ReactNode;
94
+ }
95
+
96
+ declare function Theme(props: ThemeProps): React$1.JSX.Element;
97
+ declare namespace Theme {
98
+ var displayName: string;
99
+ }
100
+
101
+ /**
102
+ * Factory that creates a pre-configured Theme component.
103
+ * Useful for white-label or multi-brand applications.
104
+ */
105
+ declare function createTheme(config: Omit<ThemeProps, 'children'>): (props: {
106
+ children: React$1.ReactNode;
107
+ }) => React$1.JSX.Element;
108
+
109
+ declare function useThemeContext(): ThemeContextValue;
110
+
111
+ /**
112
+ * Returns a resolver function bound to the current theme context.
113
+ * Use this to resolve ThemeColor tokens to hex strings inside components.
114
+ *
115
+ * @example
116
+ * const rc = useResolveColor()
117
+ * const bg = rc('gray-1')
118
+ * const accent = rc('accent-9')
119
+ * const blue = rc('blue-5')
120
+ */
121
+ declare function useResolveColor(): (color: ThemeColor) => string;
122
+
123
+ /** Applies the scaling multiplier to a base pixel value and rounds to nearest integer. */
124
+ declare function applyScaling(value: number, scaling: ScalingMode): number;
125
+
126
+ type SpaceToken = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
127
+ /**
128
+ * Margin token — superset of SpaceToken that includes negative values.
129
+ * Matches Radix's marginValues which include '-1' through '-9'.
130
+ */
131
+ type MarginToken = -9 | -8 | -7 | -6 | -5 | -4 | -3 | -2 | -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
132
+ /** Base space scale in pixels (before scaling is applied) */
133
+ declare const space: Record<SpaceToken, number>;
134
+
135
+ /**
136
+ * Returns the resolved pixel value for a SpaceToken or MarginToken with scaling applied.
137
+ * Negative margin tokens return a negative pixel value using the absolute space scale.
138
+ */
139
+ declare function resolveSpace(token: MarginToken, scaling: ScalingMode): number;
140
+
141
+ /**
142
+ * Resolves a ThemeColor token to a hex string.
143
+ *
144
+ * - `'accent-9'` → step 9 of the active accent color
145
+ * - `'accent-a9'` → alpha step a9 of the active accent color
146
+ * - `'accent-contrast'` → contrast color (text over step 9 background)
147
+ * - `'accent-surface'` → translucent tinted surface
148
+ * - `'gray-9'` → step 9 of the resolved gray color
149
+ * - `'blue-9'` → step 9 of the blue scale (exact, not aliased)
150
+ * - `'#ff0000'` → returned as-is (escape hatch)
151
+ */
152
+ declare function resolveColor(color: ThemeColor, appearance: 'light' | 'dark', accentColor: AccentColor, resolvedGrayColor: GrayColor, colorOverrides?: ColorOverrides): string;
153
+
154
+ /**
155
+ * Returns ViewStyle that approximates the Radix "classic" 3D effect
156
+ * using only native RN shadow capabilities.
157
+ *
158
+ * Radix CSS uses linear-gradient overlays + inset box-shadows which
159
+ * are not available in RN. We approximate with an outer drop shadow
160
+ * and pressed state removal (simulates "pushed in").
161
+ */
162
+ declare function getClassicEffect(appearance: 'light' | 'dark', options?: {
163
+ pressed?: boolean;
164
+ disabled?: boolean;
165
+ }): ViewStyle;
166
+
167
+ interface BoxProps extends ViewProps {
168
+ p?: SpaceToken;
169
+ px?: SpaceToken;
170
+ py?: SpaceToken;
171
+ pt?: SpaceToken;
172
+ pr?: SpaceToken;
173
+ pb?: SpaceToken;
174
+ pl?: SpaceToken;
175
+ m?: MarginToken;
176
+ mx?: MarginToken;
177
+ my?: MarginToken;
178
+ mt?: MarginToken;
179
+ mr?: MarginToken;
180
+ mb?: MarginToken;
181
+ ml?: MarginToken;
182
+ width?: number | string;
183
+ minWidth?: number | string;
184
+ maxWidth?: number | string;
185
+ height?: number | string;
186
+ minHeight?: number | string;
187
+ maxHeight?: number | string;
188
+ position?: 'relative' | 'absolute';
189
+ top?: number | string;
190
+ right?: number | string;
191
+ bottom?: number | string;
192
+ left?: number | string;
193
+ overflow?: 'hidden' | 'visible' | 'scroll';
194
+ flexBasis?: number | string;
195
+ flexShrink?: number;
196
+ flexGrow?: number;
197
+ /** Background color from the theme token system */
198
+ bg?: ThemeColor;
199
+ /** Border radius using the theme radius token (level 4 — card-sized) */
200
+ radius?: RadiusToken;
201
+ }
202
+ /** Fundamental layout primitive backed by a View. */
203
+ declare function Box({ p, px, py, pt, pr, pb, pl, m, mx, my, mt, mr, mb, ml, width, minWidth, maxWidth, height, minHeight, maxHeight, position, top, right, bottom, left, overflow, flexBasis, flexShrink, flexGrow, bg, radius, style, ...rest }: BoxProps): React$1.JSX.Element;
204
+ declare namespace Box {
205
+ var displayName: string;
206
+ }
207
+
208
+ type FlexDirection = 'row' | 'column' | 'row-reverse' | 'column-reverse';
209
+ type FlexAlign = 'start' | 'center' | 'end' | 'baseline' | 'stretch';
210
+ type FlexJustify = 'start' | 'center' | 'end' | 'between';
211
+ type FlexWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
212
+ interface FlexProps extends ViewProps {
213
+ direction?: FlexDirection;
214
+ align?: FlexAlign;
215
+ justify?: FlexJustify;
216
+ wrap?: FlexWrap;
217
+ gap?: SpaceToken;
218
+ gapX?: SpaceToken;
219
+ gapY?: SpaceToken;
220
+ p?: SpaceToken;
221
+ px?: SpaceToken;
222
+ py?: SpaceToken;
223
+ pt?: SpaceToken;
224
+ pr?: SpaceToken;
225
+ pb?: SpaceToken;
226
+ pl?: SpaceToken;
227
+ m?: MarginToken;
228
+ mx?: MarginToken;
229
+ my?: MarginToken;
230
+ mt?: MarginToken;
231
+ mr?: MarginToken;
232
+ mb?: MarginToken;
233
+ ml?: MarginToken;
234
+ width?: number | string;
235
+ minWidth?: number | string;
236
+ maxWidth?: number | string;
237
+ height?: number | string;
238
+ minHeight?: number | string;
239
+ maxHeight?: number | string;
240
+ position?: 'relative' | 'absolute';
241
+ top?: number | string;
242
+ right?: number | string;
243
+ bottom?: number | string;
244
+ left?: number | string;
245
+ overflow?: 'hidden' | 'visible' | 'scroll';
246
+ flexBasis?: number | string;
247
+ flexShrink?: number;
248
+ flexGrow?: number;
249
+ bg?: ThemeColor;
250
+ radius?: RadiusToken;
251
+ }
252
+ /** Flexbox layout primitive. Renders as a View with display: flex (the RN default). */
253
+ declare function Flex({ direction, align, justify, wrap, gap, gapX, gapY, p, px, py, pt, pr, pb, pl, m, mx, my, mt, mr, mb, ml, width, minWidth, maxWidth, height, minHeight, maxHeight, position, top, right, bottom, left, overflow, flexBasis, flexShrink, flexGrow, bg, radius, style, ...rest }: FlexProps): React$1.JSX.Element;
254
+ declare namespace Flex {
255
+ var displayName: string;
256
+ }
257
+
258
+ /**
259
+ * Grid — CSS-Grid-inspired layout component for React Native.
260
+ *
261
+ * Renders a plain View with `flexDirection: 'row'` and `flexWrap: 'wrap'`.
262
+ * Each direct child is automatically wrapped in a cell whose width is
263
+ * calculated from the number of `columns` so items flow into a uniform grid.
264
+ *
265
+ * ─── What it CAN do ────────────────────────────────────────────────────────────
266
+ * - Equal-width column grids: `<Grid columns={3} gap={3}>…</Grid>`
267
+ * - Theme-aware gap, padding, margin, background, and radius tokens
268
+ * - Consistent spacing via `gap` / `gapX` / `gapY` (mapped to space tokens)
269
+ * - Alignment of items within the grid via `align` / `justify`
270
+ *
271
+ * ─── What it CANNOT do (CSS Grid limitations in RN) ────────────────────────────
272
+ * - Mixed-width column templates (e.g. `"1fr 2fr"`, `"200px 1fr"`)
273
+ * - Row templates (`grid-template-rows`)
274
+ * - `grid-auto-flow: column`
275
+ * - Children spanning multiple columns/rows (`grid-column: span 2`)
276
+ * - Named grid areas (`grid-template-areas`)
277
+ * - Responsive breakpoint objects — use platform-specific logic instead
278
+ *
279
+ * ─── For scrolling & virtualization ────────────────────────────────────────────
280
+ * Grid is a layout container (View), NOT a scrollable list.
281
+ * If you need scrolling or virtualized rendering, use one of:
282
+ * - `<FlatList numColumns={N} />` (React Native built-in)
283
+ * - `<FlashList numColumns={N} />` (@shopify/flash-list)
284
+ * - `<LegendList numColumns={N} />` (@legendapp/list)
285
+ * These support virtualization out of the box and are the right choice for
286
+ * long or dynamic lists rendered in a grid.
287
+ */
288
+
289
+ type GridAlign = 'start' | 'center' | 'end' | 'stretch';
290
+ type GridJustify = 'start' | 'center' | 'end' | 'between';
291
+ interface GridProps extends Omit<ViewProps, 'style'> {
292
+ /** Number of equal-width columns. Default: 1. */
293
+ columns?: number;
294
+ /** Space token applied to both row and column gaps. */
295
+ gap?: SpaceToken;
296
+ /** Space token for column (horizontal) gaps only. Overrides `gap`. */
297
+ gapX?: SpaceToken;
298
+ /** Space token for row (vertical) gaps only. Overrides `gap`. */
299
+ gapY?: SpaceToken;
300
+ /** Cross-axis alignment of items within their cells. */
301
+ align?: GridAlign;
302
+ /** Main-axis justification of items within their cells. */
303
+ justify?: GridJustify;
304
+ p?: SpaceToken;
305
+ px?: SpaceToken;
306
+ py?: SpaceToken;
307
+ pt?: SpaceToken;
308
+ pr?: SpaceToken;
309
+ pb?: SpaceToken;
310
+ pl?: SpaceToken;
311
+ m?: MarginToken;
312
+ mx?: MarginToken;
313
+ my?: MarginToken;
314
+ mt?: MarginToken;
315
+ mr?: MarginToken;
316
+ mb?: MarginToken;
317
+ ml?: MarginToken;
318
+ width?: number | string;
319
+ minWidth?: number | string;
320
+ maxWidth?: number | string;
321
+ height?: number | string;
322
+ minHeight?: number | string;
323
+ maxHeight?: number | string;
324
+ position?: 'relative' | 'absolute';
325
+ top?: number | string;
326
+ right?: number | string;
327
+ bottom?: number | string;
328
+ left?: number | string;
329
+ overflow?: 'hidden' | 'visible' | 'scroll';
330
+ flexBasis?: number | string;
331
+ flexShrink?: number;
332
+ flexGrow?: number;
333
+ bg?: ThemeColor;
334
+ radius?: RadiusToken;
335
+ style?: ViewProps['style'];
336
+ }
337
+ declare function Grid({ columns, gap, gapX, gapY, align, justify, p, px, py, pt, pr, pb, pl, m, mx, my, mt, mr, mb, ml, width, minWidth, maxWidth, height, minHeight, maxHeight, position, top, right, bottom, left, overflow, flexBasis, flexShrink, flexGrow, bg, radius, style, children, onLayout: onLayoutProp, ...rest }: GridProps): React$1.JSX.Element;
338
+ declare namespace Grid {
339
+ var displayName: string;
340
+ }
341
+
342
+ type FontSizeToken = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
343
+ /** Base font size scale in pixels (before scaling is applied) */
344
+ declare const fontSize: Record<FontSizeToken, number>;
345
+ /** Base line height scale in pixels (before scaling is applied) */
346
+ declare const lineHeight: Record<FontSizeToken, number>;
347
+ /**
348
+ * Heading line heights in pixels (before scaling).
349
+ * Tighter than body line heights for sizes 2–5.
350
+ */
351
+ declare const headingLineHeight: Record<FontSizeToken, number>;
352
+ /**
353
+ * Letter spacing as em multipliers per size token.
354
+ * In RN, letterSpacing is in pixels — multiply by the resolved fontSize:
355
+ * letterSpacing = letterSpacingEm[size] * resolvedFontSize
356
+ */
357
+ declare const letterSpacingEm: Record<FontSizeToken, number>;
358
+
359
+ type TextSize = FontSizeToken;
360
+ type TextWeight = 'light' | 'regular' | 'medium' | 'bold';
361
+ type TextAlign = 'left' | 'center' | 'right';
362
+ /** 'pretty' and 'balance' are not supported in React Native and have no effect. */
363
+ type TextWrap = 'wrap' | 'nowrap' | 'pretty' | 'balance';
364
+ interface TextProps extends Omit<TextProps$1, 'style'> {
365
+ /** Text size token (1–9). Default: 3 (16px). */
366
+ size?: TextSize;
367
+ /** Font weight. Each weight maps to its own fontFamily when configured in ThemeFonts. */
368
+ weight?: TextWeight;
369
+ /** Text alignment. */
370
+ align?: TextAlign;
371
+ /** Truncates text with an ellipsis when it overflows its container. */
372
+ truncate?: boolean;
373
+ /**
374
+ * Controls text wrapping.
375
+ * 'nowrap' → single line with clip (no ellipsis).
376
+ * 'pretty' / 'balance' → not supported in React Native, no-op.
377
+ */
378
+ wrap?: TextWrap;
379
+ /**
380
+ * Text color from the theme palette.
381
+ * When set: uses alpha step a11 (accessible foreground).
382
+ * When not set: uses gray-12 (standard body text color).
383
+ */
384
+ color?: AccentColor;
385
+ /**
386
+ * Increases color contrast when `color` is set: switches from a11 → solid 12.
387
+ * Has no effect when `color` is not set (gray-12 is already maximum contrast).
388
+ */
389
+ highContrast?: boolean;
390
+ m?: MarginToken;
391
+ mx?: MarginToken;
392
+ my?: MarginToken;
393
+ mt?: MarginToken;
394
+ mr?: MarginToken;
395
+ mb?: MarginToken;
396
+ ml?: MarginToken;
397
+ style?: StyleProp<TextStyle>;
398
+ }
399
+ declare function Text({ size, weight, align, truncate, wrap, color, highContrast, m, mx, my, mt, mr, mb, ml, style, ...rest }: TextProps): React$1.JSX.Element;
400
+ declare namespace Text {
401
+ var displayName: string;
402
+ }
403
+
404
+ type HeadingSize = FontSizeToken;
405
+ interface HeadingProps {
406
+ /** Heading size token (1–9). Default: 6 (24px). */
407
+ size?: HeadingSize;
408
+ /** Font weight. Default: 'bold'. */
409
+ weight?: TextWeight;
410
+ /** Text alignment. */
411
+ align?: TextAlign;
412
+ /** Truncates text with an ellipsis when it overflows its container. */
413
+ truncate?: boolean;
414
+ /**
415
+ * Controls text wrapping.
416
+ * 'nowrap' → single line with clip. 'pretty'/'balance' → not supported in React Native, no-op.
417
+ */
418
+ wrap?: TextWrap;
419
+ /**
420
+ * Text color from the theme palette.
421
+ * No color → gray-12; color → {color}-a11; color + highContrast → {color}-12.
422
+ */
423
+ color?: AccentColor;
424
+ /** Increases color contrast when `color` is set (a11 → solid 12). */
425
+ highContrast?: boolean;
426
+ m?: MarginToken;
427
+ mx?: MarginToken;
428
+ my?: MarginToken;
429
+ mt?: MarginToken;
430
+ mr?: MarginToken;
431
+ mb?: MarginToken;
432
+ ml?: MarginToken;
433
+ style?: StyleProp<TextStyle>;
434
+ children?: React$1.ReactNode;
435
+ accessibilityLabel?: string;
436
+ }
437
+ declare function Heading({ size, weight, align, truncate, wrap, color, highContrast, m, mx, my, mt, mr, mb, ml, style, children, ...rest }: HeadingProps): React$1.JSX.Element;
438
+ declare namespace Heading {
439
+ var displayName: string;
440
+ }
441
+
442
+ /**
443
+ * Controls underline visibility.
444
+ * 'auto' → no underline by default (Radix shows on hover; RN has no hover).
445
+ * highContrast forces underline visible (matches Radix .rt-high-contrast).
446
+ * 'always' → underline always visible
447
+ * 'hover' → no underline (hover never fires in RN)
448
+ * 'none' → no underline
449
+ */
450
+ type LinkUnderline = 'auto' | 'always' | 'hover' | 'none';
451
+ interface LinkProps extends Omit<TextProps$1, 'style'> {
452
+ /** Text size token (1–9). Default: inherits — set to 3 (16px) if no parent. */
453
+ size?: FontSizeToken;
454
+ weight?: TextWeight;
455
+ /** Truncates text with an ellipsis when it overflows. */
456
+ truncate?: boolean;
457
+ /** Controls text wrapping. 'pretty'/'balance' are not supported in React Native, no-op. */
458
+ wrap?: TextWrap;
459
+ /**
460
+ * Underline visibility. Default: 'auto'.
461
+ * 'auto' → no underline, unless highContrast is set.
462
+ * 'hover' → no underline (hover does not exist on mobile).
463
+ */
464
+ underline?: LinkUnderline;
465
+ /** Accent color for the link. Default: theme accent (accent-11). */
466
+ color?: AccentColor;
467
+ /** Switches color to step 12 and forces underline visible in 'auto' mode. */
468
+ highContrast?: boolean;
469
+ /**
470
+ * RN-only: URL opened via Linking.openURL when pressed.
471
+ * If both `href` and `onPress` are provided, `onPress` takes precedence.
472
+ */
473
+ href?: string;
474
+ m?: MarginToken;
475
+ mx?: MarginToken;
476
+ my?: MarginToken;
477
+ mt?: MarginToken;
478
+ mr?: MarginToken;
479
+ mb?: MarginToken;
480
+ ml?: MarginToken;
481
+ style?: StyleProp<TextStyle>;
482
+ }
483
+ declare function Link({ size, weight, truncate, wrap, underline, color, highContrast, href, onPress, m, mx, my, mt, mr, mb, ml, style, ...rest }: LinkProps): React$1.JSX.Element;
484
+ declare namespace Link {
485
+ var displayName: string;
486
+ }
487
+
488
+ interface BlockquoteProps {
489
+ /** Text size token (1–9). Default: 3 (16px). */
490
+ size?: FontSizeToken;
491
+ /** Font weight. Default: 'regular'. */
492
+ weight?: TextWeight;
493
+ /** Text color. When not set: uses gray-12. */
494
+ color?: AccentColor;
495
+ /** Increases color contrast when `color` is set (a11 → 12). */
496
+ highContrast?: boolean;
497
+ /** Truncates text with an ellipsis when it overflows. */
498
+ truncate?: boolean;
499
+ /** Controls text wrapping. 'pretty'/'balance' are not supported in React Native, no-op. */
500
+ wrap?: TextWrap;
501
+ m?: MarginToken;
502
+ mx?: MarginToken;
503
+ my?: MarginToken;
504
+ mt?: MarginToken;
505
+ mr?: MarginToken;
506
+ mb?: MarginToken;
507
+ ml?: MarginToken;
508
+ style?: StyleProp<ViewStyle>;
509
+ children?: React$1.ReactNode;
510
+ }
511
+ declare function Blockquote({ size, weight, color, highContrast, truncate, wrap, m, mx, my, mt, mr, mb, ml, style, children, }: BlockquoteProps): React$1.JSX.Element;
512
+ declare namespace Blockquote {
513
+ var displayName: string;
514
+ }
515
+
516
+ interface EmProps extends Omit<TextProps$1, 'style'> {
517
+ /** Truncates text with an ellipsis when it overflows. */
518
+ truncate?: boolean;
519
+ /** Controls text wrapping. 'pretty'/'balance' are not supported in React Native, no-op. */
520
+ wrap?: TextWrap;
521
+ m?: MarginToken;
522
+ mx?: MarginToken;
523
+ my?: MarginToken;
524
+ mt?: MarginToken;
525
+ mr?: MarginToken;
526
+ mb?: MarginToken;
527
+ ml?: MarginToken;
528
+ style?: StyleProp<TextStyle>;
529
+ }
530
+ /**
531
+ * Inline italic text. Can be nested inside `<Text>` for inline use.
532
+ * Can be nested inside `<Text>` for inline use.
533
+ */
534
+ declare function Em({ truncate, wrap, m, mx, my, mt, mr, mb, ml, style, ...rest }: EmProps): React$1.JSX.Element;
535
+ declare namespace Em {
536
+ var displayName: string;
537
+ }
538
+
539
+ interface StrongProps extends Omit<TextProps$1, 'style'> {
540
+ /** Truncates text with an ellipsis when it overflows. */
541
+ truncate?: boolean;
542
+ /** Controls text wrapping. 'pretty'/'balance' are not supported in React Native, no-op. */
543
+ wrap?: TextWrap;
544
+ m?: MarginToken;
545
+ mx?: MarginToken;
546
+ my?: MarginToken;
547
+ mt?: MarginToken;
548
+ mr?: MarginToken;
549
+ mb?: MarginToken;
550
+ ml?: MarginToken;
551
+ style?: StyleProp<TextStyle>;
552
+ }
553
+ /**
554
+ * Inline bold text. Can be nested inside `<Text>` for inline use.
555
+ * Can be nested inside `<Text>` for inline use.
556
+ * Uses `fonts.bold` when provided, otherwise `fontWeight: '700'`.
557
+ */
558
+ declare function Strong({ truncate, wrap, m, mx, my, mt, mr, mb, ml, style, ...rest }: StrongProps): React$1.JSX.Element;
559
+ declare namespace Strong {
560
+ var displayName: string;
561
+ }
562
+
563
+ type CodeVariant = 'solid' | 'soft' | 'outline' | 'ghost';
564
+ interface CodeProps extends Omit<TextProps$1, 'style'> {
565
+ /** Text size token (1–9). Default: inherits context — set to 3 (16px) if no parent. */
566
+ size?: FontSizeToken;
567
+ /**
568
+ * Visual style.
569
+ * 'soft' → light accent background, accent-a11 text (default)
570
+ * 'solid' → filled accent-9 background, contrast text
571
+ * 'outline' → transparent background with accent border
572
+ * 'ghost' → no background, no border
573
+ */
574
+ variant?: CodeVariant;
575
+ weight?: TextWeight;
576
+ /** Accent color. Default: theme accent. */
577
+ color?: AccentColor;
578
+ /** Increases color contrast (a11 → 12 for text in soft/outline/ghost). */
579
+ highContrast?: boolean;
580
+ /** Truncates text with an ellipsis when it overflows. */
581
+ truncate?: boolean;
582
+ /** Controls text wrapping. 'pretty'/'balance' are not supported in React Native, no-op. */
583
+ wrap?: TextWrap;
584
+ m?: MarginToken;
585
+ mx?: MarginToken;
586
+ my?: MarginToken;
587
+ mt?: MarginToken;
588
+ mr?: MarginToken;
589
+ mb?: MarginToken;
590
+ ml?: MarginToken;
591
+ style?: StyleProp<TextStyle>;
592
+ }
593
+ /**
594
+ * Inline code. Can be nested inside `<Text>` for inline use.
595
+ * Can be nested inside `<Text>` for inline use.
596
+ *
597
+ * Note: In RN, `backgroundColor` on inline Text fills the tight text bounds
598
+ * without padding/borderRadius support when nested. For block-level code with
599
+ * full visual fidelity, wrap in a `<Box>` with explicit styling.
600
+ */
601
+ declare function Code({ size, variant, weight, color, highContrast, truncate, wrap, m, mx, my, mt, mr, mb, ml, style, ...rest }: CodeProps): React$1.JSX.Element;
602
+ declare namespace Code {
603
+ var displayName: string;
604
+ }
605
+
606
+ type KbdVariant = 'classic' | 'soft';
607
+ interface KbdProps {
608
+ /**
609
+ * Text size token (1–9).
610
+ *
611
+ * In Radix web, Kbd uses `0.75em` to inherit from the parent.
612
+ * In RN there are no relative units, so `size` sets the *parent* text size
613
+ * and the Kbd font is derived as `fontSize[size] * 0.8` (matching Radix).
614
+ */
615
+ size?: FontSizeToken;
616
+ /** Visual variant. Default: `'classic'`. */
617
+ variant?: KbdVariant;
618
+ m?: MarginToken;
619
+ mx?: MarginToken;
620
+ my?: MarginToken;
621
+ mt?: MarginToken;
622
+ mr?: MarginToken;
623
+ mb?: MarginToken;
624
+ ml?: MarginToken;
625
+ style?: StyleProp<ViewStyle>;
626
+ children?: React$1.ReactNode;
627
+ }
628
+ /**
629
+ * Keyboard key indicator — styled to look like a physical key.
630
+ *
631
+ * Follows the Radix Themes Kbd API:
632
+ * - `size` 1-9 (default 2)
633
+ * - `variant` 'classic' (raised key with shadow) | 'soft' (flat tinted bg)
634
+ * - Margin props: m, mx, my, mt, mr, mb, ml
635
+ *
636
+ * When nested inline inside `<Text>`, RN places the View's bottom at the
637
+ * text baseline. We use `transform: translateY` to shift it into alignment
638
+ * (marginBottom is ignored for inline Views in Text).
639
+ */
640
+ declare function Kbd({ size, variant, m, mx, my, mt, mr, mb, ml, style, children, }: KbdProps): React$1.JSX.Element;
641
+ declare namespace Kbd {
642
+ var displayName: string;
643
+ }
644
+
645
+ interface QuoteProps extends Omit<TextProps$1, 'style'> {
646
+ /** Truncates text with an ellipsis when it overflows. */
647
+ truncate?: boolean;
648
+ /** Controls text wrapping. 'pretty'/'balance' are not supported in React Native, no-op. */
649
+ wrap?: TextWrap;
650
+ m?: MarginToken;
651
+ mx?: MarginToken;
652
+ my?: MarginToken;
653
+ mt?: MarginToken;
654
+ mr?: MarginToken;
655
+ mb?: MarginToken;
656
+ ml?: MarginToken;
657
+ style?: StyleProp<TextStyle>;
658
+ }
659
+ /**
660
+ * Inline quoted text. Wraps children with typographic curly quotes (" ").
661
+ * Can be nested inside `<Text>` for inline use.
662
+ */
663
+ declare function Quote({ truncate, wrap, m, mx, my, mt, mr, mb, ml, style, children, ...rest }: QuoteProps): React$1.JSX.Element;
664
+ declare namespace Quote {
665
+ var displayName: string;
666
+ }
667
+
668
+ type ButtonSize = 1 | 2 | 3 | 4;
669
+ type ButtonVariant = 'classic' | 'solid' | 'soft' | 'surface' | 'outline' | 'ghost';
670
+ interface ButtonProps extends Omit<PressableProps, 'style' | 'children'> {
671
+ /** Button size (1–4). Default: 2. */
672
+ size?: ButtonSize;
673
+ /** Visual variant. Default: 'solid'. */
674
+ variant?: ButtonVariant;
675
+ /** Accent color. Default: theme accent. */
676
+ color?: AccentColor;
677
+ /** Increases color contrast with the background. */
678
+ highContrast?: boolean;
679
+ /** Override the theme radius for this button. */
680
+ radius?: RadiusToken;
681
+ /** Shows a loading spinner and disables the button. */
682
+ loading?: boolean;
683
+ /** Disables the button. */
684
+ disabled?: boolean;
685
+ /** Button content (usually a string). */
686
+ children?: React$1.ReactNode;
687
+ m?: MarginToken;
688
+ mx?: MarginToken;
689
+ my?: MarginToken;
690
+ mt?: MarginToken;
691
+ mr?: MarginToken;
692
+ mb?: MarginToken;
693
+ ml?: MarginToken;
694
+ style?: StyleProp<ViewStyle>;
695
+ }
696
+ declare function Button({ size, variant, color, highContrast, radius: radiusProp, loading, disabled, children, m, mx, my, mt, mr, mb, ml, style, onPress, ...rest }: ButtonProps): React$1.JSX.Element;
697
+ declare namespace Button {
698
+ var displayName: string;
699
+ }
700
+
701
+ type CheckboxSize = 1 | 2 | 3;
702
+ type CheckboxVariant = 'classic' | 'surface' | 'soft';
703
+ type CheckedState = boolean | 'indeterminate';
704
+ interface CheckboxProps extends Omit<PressableProps, 'style' | 'children'> {
705
+ /** Checkbox size (1–3). Default: 2. */
706
+ size?: CheckboxSize;
707
+ /** Visual variant. Default: 'surface'. */
708
+ variant?: CheckboxVariant;
709
+ /** Accent color. Default: theme accent. */
710
+ color?: AccentColor;
711
+ /** Increases color contrast with the background. */
712
+ highContrast?: boolean;
713
+ /** Controlled checked state. */
714
+ checked?: CheckedState;
715
+ /** Uncontrolled default checked state. */
716
+ defaultChecked?: CheckedState;
717
+ /** Called when the checked state changes. */
718
+ onCheckedChange?: (checked: CheckedState) => void;
719
+ /** Disables the checkbox. */
720
+ disabled?: boolean;
721
+ m?: MarginToken;
722
+ mx?: MarginToken;
723
+ my?: MarginToken;
724
+ mt?: MarginToken;
725
+ mr?: MarginToken;
726
+ mb?: MarginToken;
727
+ ml?: MarginToken;
728
+ style?: StyleProp<ViewStyle>;
729
+ }
730
+ declare function Checkbox({ size, variant, color, highContrast, checked: checkedProp, defaultChecked, onCheckedChange, disabled, m, mx, my, mt, mr, mb, ml, style, ...rest }: CheckboxProps): React$1.JSX.Element;
731
+ declare namespace Checkbox {
732
+ var displayName: string;
733
+ }
734
+
735
+ interface CheckboxGroupProps {
736
+ /** Checkbox size (1–3). Default: 2. */
737
+ size?: CheckboxSize;
738
+ /** Visual variant. Default: 'surface'. */
739
+ variant?: CheckboxVariant;
740
+ /** Accent color. Default: theme accent. */
741
+ color?: AccentColor;
742
+ /** Increases color contrast with the background. */
743
+ highContrast?: boolean;
744
+ /** Controlled selected values. */
745
+ value?: string[];
746
+ /** Uncontrolled default selected values. */
747
+ defaultValue?: string[];
748
+ /** Called when selected values change. */
749
+ onValueChange?: (value: string[]) => void;
750
+ /** Disables all checkboxes in the group. */
751
+ disabled?: boolean;
752
+ /** Group children (CheckboxGroup.Item). */
753
+ children?: React$1.ReactNode;
754
+ m?: MarginToken;
755
+ mx?: MarginToken;
756
+ my?: MarginToken;
757
+ mt?: MarginToken;
758
+ mr?: MarginToken;
759
+ mb?: MarginToken;
760
+ ml?: MarginToken;
761
+ style?: StyleProp<ViewStyle>;
762
+ }
763
+ interface CheckboxGroupItemProps {
764
+ /** Unique value identifying this item. */
765
+ value: string;
766
+ /** Disables this individual item. */
767
+ disabled?: boolean;
768
+ /** Label text or custom content. */
769
+ children?: React$1.ReactNode;
770
+ m?: MarginToken;
771
+ mx?: MarginToken;
772
+ my?: MarginToken;
773
+ mt?: MarginToken;
774
+ mr?: MarginToken;
775
+ mb?: MarginToken;
776
+ ml?: MarginToken;
777
+ style?: StyleProp<ViewStyle>;
778
+ }
779
+ declare function CheckboxGroupRoot({ size, variant, color, highContrast, value: valueProp, defaultValue, onValueChange, disabled, children, m, mx, my, mt, mr, mb, ml, style, }: CheckboxGroupProps): React$1.JSX.Element;
780
+ declare namespace CheckboxGroupRoot {
781
+ var displayName: string;
782
+ }
783
+ declare function CheckboxGroupItem({ value: itemValue, disabled: disabledProp, children, m, mx, my, mt, mr, mb, ml, style, }: CheckboxGroupItemProps): React$1.JSX.Element;
784
+ declare namespace CheckboxGroupItem {
785
+ var displayName: string;
786
+ }
787
+ declare const CheckboxGroup: typeof CheckboxGroupRoot & {
788
+ Root: typeof CheckboxGroupRoot;
789
+ Item: typeof CheckboxGroupItem;
790
+ };
791
+
792
+ type CheckboxCardsVariant = 'surface' | 'classic';
793
+ interface CheckboxCardsProps {
794
+ /** Card size (1–3). Default: 2. */
795
+ size?: CheckboxSize;
796
+ /** Visual variant. Default: 'surface'. */
797
+ variant?: CheckboxCardsVariant;
798
+ /** Accent color. Default: theme accent. */
799
+ color?: AccentColor;
800
+ /** Increases color contrast with the background. */
801
+ highContrast?: boolean;
802
+ /** Number of columns. Default: 1. */
803
+ columns?: number;
804
+ /** Gap between cards as space token. Default: 4. */
805
+ gap?: SpaceToken;
806
+ /** Controlled selected values. */
807
+ value?: string[];
808
+ /** Uncontrolled default selected values. */
809
+ defaultValue?: string[];
810
+ /** Called when selected values change. */
811
+ onValueChange?: (value: string[]) => void;
812
+ /** Disables all cards. */
813
+ disabled?: boolean;
814
+ /** Card items. */
815
+ children?: React$1.ReactNode;
816
+ m?: MarginToken;
817
+ mx?: MarginToken;
818
+ my?: MarginToken;
819
+ mt?: MarginToken;
820
+ mr?: MarginToken;
821
+ mb?: MarginToken;
822
+ ml?: MarginToken;
823
+ style?: StyleProp<ViewStyle>;
824
+ }
825
+ interface CheckboxCardsItemProps {
826
+ /** Unique value identifying this card. */
827
+ value: string;
828
+ /** Disables this individual card. */
829
+ disabled?: boolean;
830
+ /** Card content. */
831
+ children?: React$1.ReactNode;
832
+ style?: StyleProp<ViewStyle>;
833
+ }
834
+ declare function CheckboxCardsRoot({ size, variant, color, highContrast, columns, gap: gapProp, value: valueProp, defaultValue, onValueChange, disabled, children, m, mx, my, mt, mr, mb, ml, style, }: CheckboxCardsProps): React$1.JSX.Element;
835
+ declare namespace CheckboxCardsRoot {
836
+ var displayName: string;
837
+ }
838
+ declare function CheckboxCardsItem({ value: itemValue, disabled: disabledProp, children, style, }: CheckboxCardsItemProps): React$1.JSX.Element;
839
+ declare namespace CheckboxCardsItem {
840
+ var displayName: string;
841
+ }
842
+ declare const CheckboxCards: typeof CheckboxCardsRoot & {
843
+ Root: typeof CheckboxCardsRoot;
844
+ Item: typeof CheckboxCardsItem;
845
+ };
846
+
847
+ interface ThemeControlsProps {
848
+ /** Show the "Copy Theme" button at the bottom */
849
+ showCopyTheme?: boolean;
850
+ /** Callback when "Copy Theme" is pressed — receives the config string */
851
+ onCopyTheme?: (config: string) => void;
852
+ /** Start with the panel open */
853
+ defaultOpen?: boolean;
854
+ }
855
+ declare function ThemeControls({ showCopyTheme, onCopyTheme, defaultOpen }?: ThemeControlsProps): React$1.JSX.Element;
856
+ declare namespace ThemeControls {
857
+ var displayName: string;
858
+ }
859
+
860
+ export { Blockquote, Box, Button, Checkbox, CheckboxCards, CheckboxGroup, Code, Em, Flex, Grid, Heading, Kbd, Link, Quote, Strong, Text, Theme, ThemeControls, applyScaling, createTheme, fontSize, getClassicEffect, getFullRadius, getRadius, headingLineHeight, letterSpacingEm, lineHeight, resolveColor, resolveSpace, scalingMap, space, useResolveColor, useThemeContext };
861
+ export type { AccentColor, BlockquoteProps, BoxProps, ButtonProps, ButtonSize, ButtonVariant, CheckboxCardsItemProps, CheckboxCardsProps, CheckboxCardsVariant, CheckboxGroupItemProps, CheckboxGroupProps, CheckboxProps, CheckboxSize, CheckboxVariant, CheckedState, CodeProps, CodeVariant, ColorOverrides, ColorScaleOverride, EmProps, FlexAlign, FlexDirection, FlexJustify, FlexProps, FlexWrap, FontSizeToken, GrayColor, GridAlign, GridJustify, GridProps, HeadingProps, HeadingSize, KbdProps, KbdVariant, LinkProps, LinkUnderline, MarginToken, QuoteProps, RadiusLevel, RadiusToken, ScalingMode, SpaceToken, StrongProps, TextAlign, TextProps, TextSize, TextWeight, TextWrap, ThemeAppearance, ThemeColor, ThemeContextValue, ThemeControlsProps, ThemeFonts, ThemeProps };