@joralvmel/cosmos-mcp 0.1.2 → 0.4.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.
@@ -6,11 +6,15 @@ On React Native Web, TextField draws its focus indicator on the outer control, w
6
6
  browser outline around the editable input.
7
7
  Icons do not take focus independently of their owning controls. TextField reserves at least
8
8
  44 units of editable width when long affixes and actions compete for space.
9
- Its `appearance` accepts `startIconColor`, `startIconFocusColor`, `endIconColor` and
10
- `endIconFocusColor` (native colors). Focus overrides are optional and fall back per icon.
11
- `iconFocusScope` is `control` (input and action buttons, default) or `input`; action icons,
9
+ Its `appearance` accepts `startIconColor` and `endIconColor` (native colors); action icons,
12
10
  affixes and editable text retain their own colors.
13
11
 
12
+ Checkbox, TextField and Select highlight enabled valid controls on pointer hover without simulating
13
+ touch hover. Checked/mixed Checkbox uses `primary-hover`; invalid borders keep danger. TextField
14
+ input or action focus adds `primary-subtle`. Select keeps its trigger active and rotates its
15
+ chevron while expanded. Disabled controls do not react, and existing appearance/style customization
16
+ keeps priority.
17
+
14
18
  <!-- generated:start (npm run llms, do not edit this block by hand) -->
15
19
 
16
20
  ## Setup: React Native (Expo)
@@ -80,17 +84,15 @@ export function Example() {
80
84
  ```
81
85
  ### `Icon`
82
86
 
83
- Renders a structured SVG icon. Decorative icons are hidden from assistive technology; informative icons require a text label.
87
+ Renders a structured SVG icon. Icons are decorative and hidden from assistive technology unless a nonempty label makes them informative.
84
88
 
85
89
  | Prop | Type | Default | Description |
86
90
  | --- | --- | --- | --- |
87
91
  | `icon` | IconDefinition | Required | Structured icon definition, commonly imported from @joralvmel/cosmos-icons. |
88
92
  | `size` | 'sm' \| 'md' \| 'lg' \| number | `md` | Semantic size (16, 20 or 24) or a positive finite number in pixels / native units. |
89
- | `stroke` | string | `currentColor` | Stroke paint; currentColor inherits on web and resolves to the theme foreground on native. |
90
- | `fill` | string | `none` | Root fill paint. Explicit node fills take precedence. |
91
- | `strokeWidth` | number | `2` | Finite nonnegative stroke width in SVG viewBox units. |
92
- | `label` | string | — | Accessible name required when decorative is false. |
93
- | `decorative` | boolean | `true` | Hides the icon from assistive technology when true. |
93
+ | `variant` | 'outline' \| 'filled' | `outline` | Appearance. outline draws only the stroke; filled also fills the shapes with the icon color (for example a favorite star or heart). Explicit node fills in the definition always win. |
94
+ | `color` | string | `currentColor` | Icon color (stroke, currentColor fills and the filled variant). currentColor inherits the surrounding text color on web and the parent control or theme foreground on native; otherwise a supported color without URLs. |
95
+ | `label` | string | — | Accessible name. A nonempty label makes the icon an informative image; without one the icon is decorative and hidden from assistive technology. |
94
96
 
95
97
  Events: none.
96
98
 
@@ -106,7 +108,7 @@ export function Example() {
106
108
  ```
107
109
  ### `TextField`
108
110
 
109
- Accepts a single line of text with an accessible label, optional help and error text, and native form validation on the web.
111
+ Accepts a single line of text with an accessible label, optional helper and error text, and native form validation on the web.
110
112
 
111
113
  | Prop | Type | Default | Description |
112
114
  | --- | --- | --- | --- |
@@ -116,11 +118,11 @@ Accepts a single line of text with an accessible label, optional help and error
116
118
  | `defaultValue` | string | `` | Initial value for autonomous use. Web form reset restores this value; it does not control subsequent edits. |
117
119
  | `type` | 'text' \| 'email' \| 'password' \| 'tel' \| 'url' \| 'search' | `text` | Single-line input type. Native maps it to supported keyboard, autofill and secure-entry behavior. |
118
120
  | `variant` | 'outlined' \| 'filled' | `outlined` | Visual treatment of the editable control. |
119
- | `size` | 'sm' \| 'md' \| 'lg' \| number | `md` | Semantic size or a positive finite minimum editable-control height in CSS pixels on web and logical units on native. |
121
+ | `size` | 'sm' \| 'md' \| 'lg' | `md` | Small, medium or large editable control. |
120
122
  | `placeholder` | string | — | Short input hint; it never replaces the accessible label. |
121
- | `helpText` | string | — | Optional supporting text associated with the editable control. |
122
- | `error` | string | — | Optional externally supplied error text associated with the editable control. |
123
- | `invalid` | boolean | `false` | External invalid state, independent of browser constraints or consumer business validation. |
123
+ | `helperText` | string | — | Optional supporting text associated with the editable control. |
124
+ | `errorText` | string | — | Optional consumer-localized error text associated with the editable control; a nonempty trimmed value also exposes invalid state. |
125
+ | `invalid` | boolean | `false` | External invalid state when the visible error is supplied elsewhere, independent of browser constraints or consumer business validation. |
124
126
  | `required` | boolean | `false` | Exposes required semantics. On web, participates in native HTML constraint validation. |
125
127
  | `disabled` | boolean | `false` | Disables editing and interaction. On web, follows disabled fieldsets and excludes the value from form submission. |
126
128
  | `readOnly` | boolean | `false` | Prevents editing while remaining focusable and form-submittable on web; distinct from disabled. |
@@ -130,7 +132,6 @@ Accepts a single line of text with an accessible label, optional help and error
130
132
  | `inputMode` | 'none' \| 'text' \| 'decimal' \| 'numeric' \| 'tel' \| 'search' \| 'email' \| 'url' | — | Input or keyboard hint (none, text, decimal, numeric, tel, search, email or url); it does not add numeric or multiline field behavior. |
131
133
  | `startIcon` | IconDefinition | — | Optional structured decorative icon before the editable text. |
132
134
  | `endIcon` | IconDefinition | — | Optional structured decorative icon after the editable text. |
133
- | `iconFocusScope` | 'control' \| 'input' | `control` | When configured icon focus colors apply: control includes the input and clear/reveal buttons; input includes only the editable input. Does not change icons without a focus-color override. |
134
135
  | `prefix` | string | — | Optional non-interactive text decoration before the editable text. |
135
136
  | `suffix` | string | — | Optional non-interactive text decoration after the editable text. |
136
137
  | `clearable` | boolean | `false` | Shows a clear action for non-empty editable fields. Supply clearLabel when enabled. |
@@ -202,16 +203,11 @@ Non-modal content anchored to a consumer trigger, with cancelable close requests
202
203
  | `triggerMode` | 'press' \| 'hover' | `press` | Hover adds pointer and keyboard-focus opening on web and React Native Web, while keeping press activation. Android/iOS use press. Does not change panel semantics. |
203
204
  | `closable` | boolean | `false` | Shows a built-in IconButton with an X. Requests a cancelable close with reason close-button. |
204
205
  | `closeLabel` | string | `Close` | Localized accessible name of the close button. Must be non-empty when closable is true. |
205
- | `gap` | number | `8` | Non-negative finite distance from trigger to panel, or to the arrow tip. CSS pixels on web, logical units on native. Viewport/safe-area collision handling takes priority. |
206
206
  | `arrow` | boolean | `false` | Shows a decorative triangular pointer (16 wide, 8 deep), following the actual side, panel background and border. Hidden if it cannot point to the trigger without crossing a corner or viewport edge. |
207
207
  | `closeOnEscape` | boolean | `true` | Requests closure on unhandled Escape on web and React Native Web. Native Android and iOS hardware Escape is not supported. |
208
208
  | `closeOnOutsidePress` | boolean | `true` | Requests closure on an outside press without preventing its interaction or restoring trigger focus. |
209
- | `initialFocus` | boolean | `false` | On committed opening (including initially open), focus the first focusable panel descendant, falling back to the panel without adding semantics. False leaves focus unchanged. Native moves accessible/input focus where supported. |
210
- | `restoreFocus` | boolean | `true` | After committed trigger, Escape, action or Back closure, restore focus only if still inside the panel and the trigger is connected and focusable. Never steal outside focus, restore after outside press, or restore for unsolicited prop closure. |
211
- | `side` | 'top' \| 'right' \| 'bottom' \| 'left' | `bottom` | Requested physical side; actual placement may flip. Recompute for trigger/panel size, viewport/safe-area, scrolling and orientation changes. |
209
+ | `side` | 'top' \| 'right' \| 'bottom' \| 'left' | `bottom` | Requested physical side; actual placement flips to the opposite side when that reduces viewport/safe-area overflow, then shifts within bounds. |
212
210
  | `align` | 'start' \| 'center' \| 'end' | `center` | Cross-axis alignment. On top/bottom, start/end follow inline direction (RTL reverses them); on left/right they mean top/bottom. |
213
- | `flip` | boolean | `true` | Try the opposite side when the requested side overflows the available viewport/safe area; flip only if it reduces main-axis overflow. Ties keep the requested side. Runs before shift. |
214
- | `shift` | boolean | `true` | After flip, translate within available viewport/safe-area bounds to reduce overflow. Constrain oversized panels to that region regardless of collision flags; flags never change requested props. |
215
211
 
216
212
  Events: `onOpenChange` → `PopoverOpenChangeDetail`.
217
213
 
@@ -246,7 +242,7 @@ Selects one or more values from a named vertical collection, with groups, descri
246
242
  | `selectedValues` | ListboxValues | — | Controlled selected values, including an empty array. Activation only proposes changes until the owner updates this prop. Missing collection values are retained, not automatically selected or removed. |
247
243
  | `defaultSelectedValues` | ListboxValues | — | Initial autonomous selected values (empty by default). Later changes do not reset selection. |
248
244
  | `variant` | 'plain' \| 'outlined' | `plain` | Plain composes inside a panel; outlined adds a standalone container boundary. |
249
- | `size` | 'sm' \| 'md' \| 'lg' \| number | `md` | Semantic size or a positive finite minimum option height in CSS pixels/native logical units. Content may grow; native touch targets remain at least 44. |
245
+ | `size` | 'sm' \| 'md' \| 'lg' | `md` | Small, medium or large option rows. Content may grow; native touch targets remain at least 44. |
250
246
  | `disabled` | boolean | `false` | Prevents interaction and removes the list from keyboard navigation. |
251
247
  | `readOnly` | boolean | `false` | Allows exploring options without proposing or committing selection changes. |
252
248
  | `locale` | string | — | BCP 47 locale for typeahead. Web inherits the nearest language; native uses the runtime locale when omitted. Invalid locale identifiers are rejected. |
@@ -270,10 +266,315 @@ export function Example() {
270
266
  );
271
267
  }
272
268
  ```
269
+ ### `Checkbox`
270
+
271
+ Selects an independent boolean value with accessible labeling and native form behavior on the web.
272
+
273
+ | Prop | Type | Default | Description |
274
+ | --- | --- | --- | --- |
275
+ | `label` | string | Required | Required accessible name, visible unless labelHidden is true. |
276
+ | `labelHidden` | boolean | `false` | Visually hides the label while keeping it available to assistive technology. |
277
+ | `checked` | boolean | `false` | Controlled checked value when supplied, including false; activation proposes changes without self-committing. |
278
+ | `defaultChecked` | boolean | `false` | Initial autonomous checked value; later changes do not reset it. |
279
+ | `indeterminate` | boolean | `false` | Presentation-only mixed state. Autonomous activation clears it; controlled use leaves it to the owner. |
280
+ | `size` | 'sm' \| 'md' \| 'lg' | `md` | Small, medium or large visual box. |
281
+ | `disabled` | boolean | `false` | Prevents user interaction and excludes the value from web form submission. |
282
+ | `required` | boolean | `false` | Exposes required semantics and participates in native web form validation. Native has no automatic validation. |
283
+ | `invalid` | boolean | `false` | Externally supplied invalid presentation state when the visible error is supplied elsewhere; web form validity remains based on required. |
284
+ | `helperText` | string | — | Optional consumer-localized supporting text associated with the checkbox. |
285
+ | `errorText` | string | — | Optional consumer-localized error description; a nonempty trimmed value also exposes invalid state. |
286
+
287
+ Events: `onCheckedChange` → `CheckboxCheckedChangeDetail`.
288
+
289
+ ```tsx
290
+ import { Checkbox } from '@joralvmel/cosmos-native';
291
+
292
+ export function Example() {
293
+ return (
294
+ <Checkbox
295
+ label="Checkbox"
296
+ onCheckedChange={detail => console.log(detail)}
297
+ >
298
+ Checkbox
299
+ </Checkbox>
300
+ );
301
+ }
302
+ ```
303
+ ### `Switch`
304
+
305
+ Toggles a binary setting immediately with a stable accessible name and form behavior on the web.
306
+
307
+ | Prop | Type | Default | Description |
308
+ | --- | --- | --- | --- |
309
+ | `label` | string | Required | Required nonempty accessible name; remains stable in both states. |
310
+ | `labelHidden` | boolean | `false` | Visually hides the label while retaining its accessible name. |
311
+ | `checked` | boolean | `false` | Controlled checked value when supplied, including false; activation proposes changes without self-committing. |
312
+ | `defaultChecked` | boolean | `false` | Initial autonomous checked value; later changes do not reset it. |
313
+ | `disabled` | boolean | `false` | Prevents user interaction and excludes the value from web form submission. |
314
+ | `invalid` | boolean | `false` | Externally supplied invalid presentation. Does not change checked state or form validity; native uses danger colors without an equivalent system invalid trait. |
315
+ | `helperText` | string | — | Optional consumer-localized supporting text associated with the switch. |
316
+
317
+ Events: `onCheckedChange` → `SwitchCheckedChangeDetail`.
318
+
319
+ ```tsx
320
+ import { Switch } from '@joralvmel/cosmos-native';
321
+
322
+ export function Example() {
323
+ return (
324
+ <Switch
325
+ label="Switch"
326
+ onCheckedChange={detail => console.log(detail)}
327
+ >
328
+ </Switch>
329
+ );
330
+ }
331
+ ```
332
+ ### `Badge`
333
+
334
+ Displays a noninteractive status or category label, or caller-formatted count, with an optional decorative leading icon.
335
+
336
+ | Prop | Type | Default | Description |
337
+ | --- | --- | --- | --- |
338
+ | `variant` | 'soft' \| 'solid' \| 'outline' | `soft` | Visual treatment of the static label. |
339
+ | `tone` | 'neutral' \| 'info' \| 'success' \| 'warning' \| 'danger' | `neutral` | Semantic color intent of the static label. |
340
+ | `size` | 'sm' \| 'md' \| 'lg' | `md` | Semantic label size. |
341
+ | `startIcon` | IconDefinition | — | Optional structured decorative icon before the label. |
342
+
343
+ Events: none.
344
+
345
+ ```tsx
346
+ import { Badge } from '@joralvmel/cosmos-native';
347
+ import { heart } from '@joralvmel/cosmos-icons/heart';
348
+
349
+ export function Example() {
350
+ return (
351
+ <Badge startIcon={heart}>Badge</Badge>
352
+ );
353
+ }
354
+ ```
355
+ ### `Calendar`
356
+
357
+ Selects one Gregorian date from an inline, localized calendar with keyboard navigation and optional bounds. Month and year can be selected directly.
358
+
359
+ | Prop | Type | Default | Description |
360
+ | --- | --- | --- | --- |
361
+ | `value` | string | — | Controlled selected date in YYYY-MM-DD format; when supplied, selection proposals wait for the owner to update this value. |
362
+ | `defaultValue` | string | — | Initial autonomous selected date in YYYY-MM-DD format; later changes do not reset selection. |
363
+ | `min` | string | — | Earliest selectable date in YYYY-MM-DD format, inclusive. |
364
+ | `max` | string | — | Latest selectable date in YYYY-MM-DD format, inclusive. |
365
+ | `locale` | string | — | BCP 47 locale for month and weekday names, week start, and text direction; defaults to the environment locale. Invalid locale identifiers are rejected. |
366
+ | `disabled` | boolean | `false` | Disables date selection and calendar navigation. |
367
+
368
+ Events: `onValueChange` → `CalendarChangeDetail`.
369
+
370
+ ```tsx
371
+ import { Calendar } from '@joralvmel/cosmos-native';
372
+
373
+ export function Example() {
374
+ return (
375
+ <Calendar onValueChange={detail => console.log(detail)}></Calendar>
376
+ );
377
+ }
378
+ ```
379
+ ### `Textarea`
380
+
381
+ Accepts multiline plain text with an accessible label, optional helper and error text, and native form behavior on the web.
382
+
383
+ | Prop | Type | Default | Description |
384
+ | --- | --- | --- | --- |
385
+ | `label` | string | Required | Accessible name for the editable control. It is rendered above the control unless visually hidden. |
386
+ | `labelHidden` | boolean | `false` | Visually hides the label while keeping it available to assistive technology. |
387
+ | `value` | string | — | Current text. When bound, edits are proposals and the component waits for the owner to supply the accepted value. |
388
+ | `defaultValue` | string | `` | Initial value for autonomous use. Web form reset restores this value; it does not control subsequent edits. |
389
+ | `rows` | number | `4` | Visible line count of the multiline editor. It is independent of the visual size. |
390
+ | `variant` | 'outlined' \| 'filled' | `outlined` | Visual treatment of the editable control. |
391
+ | `size` | 'sm' \| 'md' \| 'lg' | `md` | Visual size of the editable control, independent of rows. |
392
+ | `placeholder` | string | — | Short input hint; it never replaces the accessible label. |
393
+ | `helperText` | string | — | Optional supporting text associated with the editable control. |
394
+ | `errorText` | string | — | Optional consumer-localized error text associated with the editable control; a nonempty trimmed value also exposes invalid state. |
395
+ | `invalid` | boolean | `false` | External invalid state when the visible error is supplied elsewhere, independent of browser constraints or consumer business validation. |
396
+ | `required` | boolean | `false` | Exposes required semantics. On web, participates in native HTML constraint validation. |
397
+ | `disabled` | boolean | `false` | Disables editing and interaction. On web, follows disabled fieldsets and excludes the value from form submission. |
398
+ | `readOnly` | boolean | `false` | Prevents editing while remaining focusable and form-submittable on web; distinct from disabled. |
399
+ | `maxLength` | number | — | Maximum number of characters. Web uses native HTML length constraints and native applies supported input limits. |
400
+
401
+ Events: `onValueChange` → `TextareaChangeDetail`.
402
+
403
+ ```tsx
404
+ import { Textarea } from '@joralvmel/cosmos-native';
405
+
406
+ export function Example() {
407
+ return (
408
+ <Textarea
409
+ label="Textarea"
410
+ onValueChange={detail => console.log(detail)}
411
+ >
412
+ </Textarea>
413
+ );
414
+ }
415
+ ```
416
+ ### `RadioGroup`
417
+
418
+ Selects one option from a labeled collection, with optional selection and native Web form behavior.
419
+
420
+ | Prop | Type | Default | Description |
421
+ | --- | --- | --- | --- |
422
+ | `label` | string | Required | Required visible accessible name for the group. |
423
+ | `options` | RadioGroupOptions | Required | Readonly flat options with unique nonempty values and labels, optional descriptions and disabled states. |
424
+ | `value` | RadioGroupValue | — | Controlled selected value; null means no selection, and a supplied null remains controlled. |
425
+ | `defaultValue` | RadioGroupValue | — | Initial autonomous selection; null by default. |
426
+ | `size` | 'sm' \| 'md' \| 'lg' | `md` | Small, medium or large radio indicator. |
427
+ | `orientation` | 'vertical' \| 'horizontal' | `vertical` | Vertical list or wrapping horizontal options. |
428
+ | `disabled` | boolean | `false` | Prevents interaction and excludes the value from Web form submission. |
429
+ | `required` | boolean | `false` | Requires a selection in Web form validation; Native exposes descriptive semantics. |
430
+ | `invalid` | boolean | `false` | Externally supplied invalid presentation state when the visible error is supplied elsewhere. |
431
+ | `helperText` | string | — | Optional supporting text associated with the group. |
432
+ | `errorText` | string | — | Optional consumer-localized error text; a nonempty trimmed value also exposes invalid state. |
433
+
434
+ Events: `onValueChange` → `RadioGroupChangeDetail`.
435
+
436
+ ```tsx
437
+ import { RadioGroup } from '@joralvmel/cosmos-native';
438
+ const contactMethods = [{"value":"email","label":"Email","description":"Receive updates by email."},{"value":"phone","label":"Phone","description":"Receive updates by text."},{"value":"mail","label":"Mail","disabled":true}] as const;
439
+
440
+ export function Example() {
441
+ return (
442
+ <RadioGroup
443
+ label="RadioGroup"
444
+ options={contactMethods}
445
+ onValueChange={detail => console.log(detail)}
446
+ >
447
+ </RadioGroup>
448
+ );
449
+ }
450
+ ```
451
+ ### `Select`
452
+
453
+ Selects one option from an accessible collection, with native Web form behavior.
454
+
455
+ | Prop | Type | Default | Description |
456
+ | --- | --- | --- | --- |
457
+ | `label` | string | Required | Required visible accessible name for the control. |
458
+ | `items` | SelectItems | Required | Readonly flat options with unique nonempty values, nonempty labels, and optional disabled state. |
459
+ | `value` | SelectValue | — | Controlled selected value; null means no selection, and a supplied null remains controlled. |
460
+ | `defaultValue` | SelectValue | — | Initial autonomous selection; null by default. |
461
+ | `placeholder` | string | Required | Consumer-localized text shown when no value is selected. |
462
+ | `variant` | 'outlined' \| 'filled' | `outlined` | Outlined or filled trigger appearance. |
463
+ | `size` | 'sm' \| 'md' \| 'lg' | `md` | Small, medium, or large control size. |
464
+ | `disabled` | boolean | `false` | Prevents interaction and excludes the value from Web form submission. |
465
+ | `required` | boolean | `false` | Requires a selection in Web form validation; Native exposes descriptive semantics. |
466
+ | `invalid` | boolean | `false` | Externally supplied invalid presentation state when the visible error is supplied elsewhere. |
467
+ | `helperText` | string | — | Optional supporting text associated with the control. |
468
+ | `errorText` | string | — | Optional consumer-localized error text; a nonempty trimmed value also exposes invalid state. |
469
+
470
+ Events: `onValueChange` → `SelectChangeDetail`.
471
+
472
+ ```tsx
473
+ import { Select } from '@joralvmel/cosmos-native';
474
+ const flat = [{"value":"apple","label":"Apple"},{"value":"cherry","label":"Cherry"},{"value":"lime","label":"Lime","disabled":true}] as const;
475
+ const none = null as const;
476
+
477
+ export function Example() {
478
+ return (
479
+ <Select
480
+ label="Select"
481
+ items={flat}
482
+ defaultValue={none}
483
+ placeholder="Select"
484
+ onValueChange={detail => console.log(detail)}
485
+ >
486
+ </Select>
487
+ );
488
+ }
489
+ ```
490
+ ### `Pagination`
491
+
492
+ Navigates a known number of pages using buttons.
493
+
494
+ | Prop | Type | Default | Description |
495
+ | --- | --- | --- | --- |
496
+ | `totalPages` | number | Required | Required nonnegative safe integer page count. |
497
+ | `page` | number | — | Controlled one-based safe integer page; out-of-range values are displayed clamped. |
498
+ | `defaultPage` | number | `1` | Initial one-based page for autonomous state. |
499
+ | `label` | string | Required | Required localized navigation landmark label. |
500
+ | `previousLabel` | string | `Previous page` | Previous button label. |
501
+ | `nextLabel` | string | `Next page` | Next button label. |
502
+ | `firstLabel` | string | `First page` | First button label. |
503
+ | `lastLabel` | string | `Last page` | Last button label. |
504
+ | `pageLabel` | string | `Page {page}` | Page button label template; {page} is replaced with the localized number. |
505
+ | `summaryLabel` | string | `Page {page} of {total}` | Compact summary template with {page} and {total} placeholders. |
506
+ | `locale` | string | — | Locale for formatted page numbers. |
507
+ | `direction` | 'ltr' \| 'rtl' | `ltr` | Layout and directional icon direction. |
508
+ | `presentation` | 'numbered' \| 'compact' | `numbered` | Show up to seven fixed-width numbered positions or a compact summary. |
509
+ | `variant` | 'solid' \| 'soft' \| 'outline' | `solid` | Selected page emphasis. |
510
+ | `size` | 'sm' \| 'md' \| 'lg' | `md` | Control size. |
511
+ | `showFirstLast` | boolean | `false` | Show first and last page controls. |
512
+ | `disabled` | boolean | `false` | Disable all controls. |
513
+
514
+ Events: `onPageChange` → `PaginationChangeDetail`.
515
+
516
+ ```tsx
517
+ import { Pagination } from '@joralvmel/cosmos-native';
518
+
519
+ export function Example() {
520
+ return (
521
+ <Pagination
522
+ label="Pagination"
523
+ onPageChange={detail => console.log(detail)}
524
+ >
525
+ </Pagination>
526
+ );
527
+ }
528
+ ```
529
+ ### `Dialog`
530
+
531
+ Modal content with a title, actions and cancelable close requests.
532
+
533
+ | Prop | Type | Default | Description |
534
+ | --- | --- | --- | --- |
535
+ | `open` | boolean | `false` | Committed visibility; supplying this prop, including false, controls state. |
536
+ | `defaultOpen` | boolean | `false` | Initial autonomous visibility; subsequent changes do not reset state. |
537
+ | `presentation` | 'standard' \| 'fullscreen' | `standard` | Centered standard surface or fullscreen surface. |
538
+ | `size` | 'sm' \| 'md' \| 'lg' | `md` | Maximum standard width: sm 400, md 640, lg 960 pixels or logical points. |
539
+ | `responsiveFullscreen` | boolean | `false` | Use fullscreen when available viewport width is below 640 pixels or logical points. |
540
+ | `closeLabel` | string | `Close` | Non-empty localized accessible name of the built-in close button. |
541
+ | `closeOnAndroidBack` | boolean | `true` | Request closure on Android Back; consume Back even if the request is canceled. |
542
+ | `closeOnBackdropPress` | boolean | `false` | Request closure when the backdrop itself is pressed. |
543
+ | `initialFocusTarget` | DialogFocusTarget | — | Optional platform focus target used on committed opening; it must be inside the dialog. |
544
+ | `returnFocusTarget` | DialogFocusTarget | — | Optional platform focus target used after committed closure. |
545
+
546
+ Events: `onOpenChange` → `DialogOpenChangeDetail`.
547
+
548
+ ```tsx
549
+ import { type ComponentRef, useRef } from 'react';
550
+ import { Button, Dialog, type DialogHandle } from '@joralvmel/cosmos-native';
551
+ import { type Pressable, Text } from 'react-native';
552
+
553
+ export function Example() {
554
+ const dialog = useRef<DialogHandle>(null);
555
+ const opener = useRef<ComponentRef<typeof Pressable>>(null);
556
+ return (
557
+ <>
558
+ <Button ref={opener} onPress={() => dialog.current?.requestOpen()}>Open dialog</Button>
559
+ <Dialog
560
+ ref={dialog}
561
+ title="Review details"
562
+ returnFocusTarget={opener}
563
+ onOpenChange={detail => {
564
+ console.log(detail);
565
+ }}
566
+ actions={<Button onPress={() => dialog.current?.requestClose()}>Done</Button>}
567
+ >
568
+ <Text>Dialog</Text>
569
+ </Dialog>
570
+ </>
571
+ );
572
+ }
573
+ ```
273
574
 
274
575
  ## Themes
275
576
 
276
- Built-in themes: `cosmos`, `nebula` (default `cosmos`), each with `light` and `dark` modes; `system` follows the OS.
577
+ Built-in themes: `cosmos`, `nebula`, `terra`, `supernova`, `aurora`, `solstice` (default `cosmos`), each with `light` and `dark` modes; `system` follows the OS.
277
578
 
278
579
  ```tsx
279
580
  <CosmosThemeProvider theme="nebula" mode="system">{children}</CosmosThemeProvider>