@joralvmel/cosmos-angular 0.3.0 → 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.
Files changed (45) hide show
  1. package/README.md +7 -4
  2. package/dist/components/badge.component.d.ts +20 -0
  3. package/dist/components/badge.component.js +46 -0
  4. package/dist/components/badge.component.js.map +1 -0
  5. package/dist/components/button.component.js +3 -3
  6. package/dist/components/calendar.component.d.ts +28 -0
  7. package/dist/components/calendar.component.js +65 -0
  8. package/dist/components/calendar.component.js.map +1 -0
  9. package/dist/components/checkbox.component.d.ts +52 -0
  10. package/dist/components/checkbox.component.js +152 -0
  11. package/dist/components/checkbox.component.js.map +1 -0
  12. package/dist/components/dialog.component.d.ts +44 -0
  13. package/dist/components/dialog.component.js +106 -0
  14. package/dist/components/dialog.component.js.map +1 -0
  15. package/dist/components/icon-button.component.js +3 -3
  16. package/dist/components/icon.component.d.ts +6 -8
  17. package/dist/components/icon.component.js +12 -22
  18. package/dist/components/icon.component.js.map +1 -1
  19. package/dist/components/listbox.component.js +3 -3
  20. package/dist/components/pagination.component.d.ts +36 -0
  21. package/dist/components/pagination.component.js +129 -0
  22. package/dist/components/pagination.component.js.map +1 -0
  23. package/dist/components/popover.component.d.ts +1 -10
  24. package/dist/components/popover.component.js +3 -32
  25. package/dist/components/popover.component.js.map +1 -1
  26. package/dist/components/radio-group.component.d.ts +49 -0
  27. package/dist/components/radio-group.component.js +146 -0
  28. package/dist/components/radio-group.component.js.map +1 -0
  29. package/dist/components/select.component.d.ts +49 -0
  30. package/dist/components/select.component.js +147 -0
  31. package/dist/components/select.component.js.map +1 -0
  32. package/dist/components/switch.component.d.ts +47 -0
  33. package/dist/components/switch.component.js +135 -0
  34. package/dist/components/switch.component.js.map +1 -0
  35. package/dist/components/text-field.component.d.ts +3 -4
  36. package/dist/components/text-field.component.js +9 -14
  37. package/dist/components/text-field.component.js.map +1 -1
  38. package/dist/components/textarea.component.d.ts +54 -0
  39. package/dist/components/textarea.component.js +168 -0
  40. package/dist/components/textarea.component.js.map +1 -0
  41. package/dist/index.d.ts +20 -2
  42. package/dist/index.js +27 -0
  43. package/dist/index.js.map +1 -1
  44. package/llms.md +350 -20
  45. package/package.json +10 -10
package/llms.md CHANGED
@@ -82,17 +82,15 @@ export class ExampleComponent {
82
82
  ```
83
83
  ### `CosmIconComponent` (`<cosm-icon>`)
84
84
 
85
- Renders a structured SVG icon. Decorative icons are hidden from assistive technology; informative icons require a text label.
85
+ Renders a structured SVG icon. Icons are decorative and hidden from assistive technology unless a nonempty label makes them informative.
86
86
 
87
87
  | Prop | Type | Default | Description |
88
88
  | --- | --- | --- | --- |
89
89
  | `icon` | IconDefinition | Required | Structured icon definition, commonly imported from @joralvmel/cosmos-icons. |
90
90
  | `size` | 'sm' \| 'md' \| 'lg' \| number | `md` | Semantic size (16, 20 or 24) or a positive finite number in pixels / native units. |
91
- | `stroke` | string | `currentColor` | Stroke paint; currentColor inherits on web and resolves to the theme foreground on native. |
92
- | `fill` | string | `none` | Root fill paint. Explicit node fills take precedence. |
93
- | `strokeWidth` | number | `2` | Finite nonnegative stroke width in SVG viewBox units. |
94
- | `label` | string | — | Accessible name required when decorative is false. |
95
- | `decorative` | boolean | `true` | Hides the icon from assistive technology when true. |
91
+ | `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. |
92
+ | `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. |
93
+ | `label` | string | — | Accessible name. A nonempty label makes the icon an informative image; without one the icon is decorative and hidden from assistive technology. |
96
94
 
97
95
  Events: none.
98
96
 
@@ -112,7 +110,7 @@ export class ExampleComponent {
112
110
  ```
113
111
  ### `CosmTextFieldComponent` (`<cosm-text-field>`)
114
112
 
115
- Accepts a single line of text with an accessible label, optional help and error text, and native form validation on the web.
113
+ Accepts a single line of text with an accessible label, optional helper and error text, and native form validation on the web.
116
114
 
117
115
  | Prop | Type | Default | Description |
118
116
  | --- | --- | --- | --- |
@@ -122,11 +120,11 @@ Accepts a single line of text with an accessible label, optional help and error
122
120
  | `defaultValue` | string | `` | Initial value for autonomous use. Web form reset restores this value; it does not control subsequent edits. |
123
121
  | `type` | 'text' \| 'email' \| 'password' \| 'tel' \| 'url' \| 'search' | `text` | Single-line input type. Native maps it to supported keyboard, autofill and secure-entry behavior. |
124
122
  | `variant` | 'outlined' \| 'filled' | `outlined` | Visual treatment of the editable control. |
125
- | `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. |
123
+ | `size` | 'sm' \| 'md' \| 'lg' | `md` | Small, medium or large editable control. |
126
124
  | `placeholder` | string | — | Short input hint; it never replaces the accessible label. |
127
- | `helpText` | string | — | Optional supporting text associated with the editable control. |
128
- | `error` | string | — | Optional externally supplied error text associated with the editable control. |
129
- | `invalid` | boolean | `false` | External invalid state, independent of browser constraints or consumer business validation. |
125
+ | `helperText` | string | — | Optional supporting text associated with the editable control. |
126
+ | `errorText` | string | — | Optional consumer-localized error text associated with the editable control; a nonempty trimmed value also exposes invalid state. |
127
+ | `invalid` | boolean | `false` | External invalid state when the visible error is supplied elsewhere, independent of browser constraints or consumer business validation. |
130
128
  | `required` | boolean | `false` | Exposes required semantics. On web, participates in native HTML constraint validation. |
131
129
  | `disabled` | boolean | `false` | Disables editing and interaction. On web, follows disabled fieldsets and excludes the value from form submission. |
132
130
  | `readOnly` | boolean | `false` | Prevents editing while remaining focusable and form-submittable on web; distinct from disabled. |
@@ -138,7 +136,6 @@ Accepts a single line of text with an accessible label, optional help and error
138
136
  | `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. |
139
137
  | `startIcon` | IconDefinition | — | Optional structured decorative icon before the editable text. |
140
138
  | `endIcon` | IconDefinition | — | Optional structured decorative icon after the editable text. |
141
- | `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. |
142
139
  | `prefix` | string | — | Optional non-interactive text decoration before the editable text. |
143
140
  | `suffix` | string | — | Optional non-interactive text decoration after the editable text. |
144
141
  | `clearable` | boolean | `false` | Shows a clear action for non-empty editable fields. Supply clearLabel when enabled. |
@@ -222,16 +219,11 @@ Non-modal content anchored to a consumer trigger, with cancelable close requests
222
219
  | `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. |
223
220
  | `closable` | boolean | `false` | Shows a built-in IconButton with an X. Requests a cancelable close with reason close-button. |
224
221
  | `closeLabel` | string | `Close` | Localized accessible name of the close button. Must be non-empty when closable is true. |
225
- | `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. |
226
222
  | `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. |
227
223
  | `closeOnEscape` | boolean | `true` | Requests closure on unhandled Escape on web and React Native Web. Native Android and iOS hardware Escape is not supported. |
228
224
  | `closeOnOutsidePress` | boolean | `true` | Requests closure on an outside press without preventing its interaction or restoring trigger focus. |
229
- | `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. |
230
- | `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. |
231
- | `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. |
225
+ | `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. |
232
226
  | `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. |
233
- | `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. |
234
- | `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. |
235
227
 
236
228
  Events: `(openChange)` → `PopoverOpenChangeDetail`.
237
229
 
@@ -266,7 +258,7 @@ Selects one or more values from a named vertical collection, with groups, descri
266
258
  | `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. |
267
259
  | `defaultSelectedValues` | ListboxValues | — | Initial autonomous selected values (empty by default). Later changes do not reset selection. |
268
260
  | `variant` | 'plain' \| 'outlined' | `plain` | Plain composes inside a panel; outlined adds a standalone container boundary. |
269
- | `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. |
261
+ | `size` | 'sm' \| 'md' \| 'lg' | `md` | Small, medium or large option rows. Content may grow; native touch targets remain at least 44. |
270
262
  | `disabled` | boolean | `false` | Prevents interaction and removes the list from keyboard navigation. |
271
263
  | `readOnly` | boolean | `false` | Allows exploring options without proposing or committing selection changes. |
272
264
  | `locale` | string | — | BCP 47 locale for typeahead. Web inherits the nearest language; native uses the runtime locale when omitted. Invalid locale identifiers are rejected. |
@@ -293,10 +285,348 @@ export class ExampleComponent {
293
285
  }
294
286
  }
295
287
  ```
288
+ ### `CosmCheckboxComponent` (`<cosm-checkbox>`)
289
+
290
+ Selects an independent boolean value with accessible labeling and native form behavior on the web.
291
+
292
+ | Prop | Type | Default | Description |
293
+ | --- | --- | --- | --- |
294
+ | `label` | string | Required | Required accessible name, visible unless labelHidden is true. |
295
+ | `labelHidden` | boolean | `false` | Visually hides the label while keeping it available to assistive technology. |
296
+ | `checked` | boolean | `false` | Controlled checked value when supplied, including false; activation proposes changes without self-committing. |
297
+ | `defaultChecked` | boolean | `false` | Initial autonomous checked value; later changes do not reset it. |
298
+ | `indeterminate` | boolean | `false` | Presentation-only mixed state. Autonomous activation clears it; controlled use leaves it to the owner. |
299
+ | `size` | 'sm' \| 'md' \| 'lg' | `md` | Small, medium or large visual box. |
300
+ | `disabled` | boolean | `false` | Prevents user interaction and excludes the value from web form submission. |
301
+ | `required` | boolean | `false` | Exposes required semantics and participates in native web form validation. Native has no automatic validation. |
302
+ | `invalid` | boolean | `false` | Externally supplied invalid presentation state when the visible error is supplied elsewhere; web form validity remains based on required. |
303
+ | `helperText` | string | — | Optional consumer-localized supporting text associated with the checkbox. |
304
+ | `errorText` | string | — | Optional consumer-localized error description; a nonempty trimmed value also exposes invalid state. |
305
+ | `name` | string | — | Web form field name; React Native has no HTML form association. |
306
+ | `value` | string | `on` | Web form value submitted when checked and enabled; defaults to on. Angular Forms uses checked as its boolean value. |
307
+
308
+ Events: `(checkedChange)` → `CheckboxCheckedChangeDetail`.
309
+
310
+ ```ts
311
+ import { Component } from '@angular/core';
312
+ import { CosmCheckboxComponent } from '@joralvmel/cosmos-angular';
313
+ import type { CheckboxCheckedChangeDetail } from '@joralvmel/cosmos-core';
314
+
315
+ @Component({
316
+ selector: 'app-example',
317
+ imports: [CosmCheckboxComponent],
318
+ template: `<cosm-checkbox label="Checkbox" (checkedChange)="onCheckedChange($event.detail)">Checkbox</cosm-checkbox>`,
319
+ })
320
+ export class ExampleComponent {
321
+ onCheckedChange(detail: CheckboxCheckedChangeDetail) {
322
+ console.log(detail);
323
+ }
324
+ }
325
+ ```
326
+ ### `CosmSwitchComponent` (`<cosm-switch>`)
327
+
328
+ Toggles a binary setting immediately with a stable accessible name and form behavior on the web.
329
+
330
+ | Prop | Type | Default | Description |
331
+ | --- | --- | --- | --- |
332
+ | `label` | string | Required | Required nonempty accessible name; remains stable in both states. |
333
+ | `labelHidden` | boolean | `false` | Visually hides the label while retaining its accessible name. |
334
+ | `checked` | boolean | `false` | Controlled checked value when supplied, including false; activation proposes changes without self-committing. |
335
+ | `defaultChecked` | boolean | `false` | Initial autonomous checked value; later changes do not reset it. |
336
+ | `size` | 'sm' \| 'md' \| 'lg' | `md` | Small, medium or large web switch. Native uses system Switch sizing. |
337
+ | `disabled` | boolean | `false` | Prevents user interaction and excludes the value from web form submission. |
338
+ | `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. |
339
+ | `helperText` | string | — | Optional consumer-localized supporting text associated with the switch. |
340
+ | `name` | string | — | Web form field name; React Native has no HTML form association. |
341
+ | `value` | string | `on` | Web form value submitted when checked and enabled; defaults to on. Angular Forms uses checked as its boolean value. |
342
+
343
+ Events: `(checkedChange)` → `SwitchCheckedChangeDetail`.
344
+
345
+ ```ts
346
+ import { Component } from '@angular/core';
347
+ import { CosmSwitchComponent } from '@joralvmel/cosmos-angular';
348
+ import type { SwitchCheckedChangeDetail } from '@joralvmel/cosmos-core';
349
+
350
+ @Component({
351
+ selector: 'app-example',
352
+ imports: [CosmSwitchComponent],
353
+ template: `<cosm-switch label="Switch" (checkedChange)="onCheckedChange($event.detail)"></cosm-switch>`,
354
+ })
355
+ export class ExampleComponent {
356
+ onCheckedChange(detail: SwitchCheckedChangeDetail) {
357
+ console.log(detail);
358
+ }
359
+ }
360
+ ```
361
+ ### `CosmBadgeComponent` (`<cosm-badge>`)
362
+
363
+ Displays a noninteractive status or category label, or caller-formatted count, with an optional decorative leading icon.
364
+
365
+ | Prop | Type | Default | Description |
366
+ | --- | --- | --- | --- |
367
+ | `variant` | 'soft' \| 'solid' \| 'outline' | `soft` | Visual treatment of the static label. |
368
+ | `tone` | 'neutral' \| 'info' \| 'success' \| 'warning' \| 'danger' | `neutral` | Semantic color intent of the static label. |
369
+ | `size` | 'sm' \| 'md' \| 'lg' | `md` | Semantic label size. |
370
+ | `startIcon` | IconDefinition | — | Optional structured decorative icon before the label. |
371
+
372
+ Events: none.
373
+
374
+ ```ts
375
+ import { Component } from '@angular/core';
376
+ import { CosmBadgeComponent } from '@joralvmel/cosmos-angular';
377
+ import { heart } from '@joralvmel/cosmos-icons/heart';
378
+
379
+ @Component({
380
+ selector: 'app-example',
381
+ imports: [CosmBadgeComponent],
382
+ template: `<cosm-badge [startIcon]="heart">Badge</cosm-badge>`,
383
+ })
384
+ export class ExampleComponent {
385
+ readonly heart = heart;
386
+ }
387
+ ```
388
+ ### `CosmCalendarComponent` (`<cosm-calendar>`)
389
+
390
+ Selects one Gregorian date from an inline, localized calendar with keyboard navigation and optional bounds. Month and year can be selected directly.
391
+
392
+ | Prop | Type | Default | Description |
393
+ | --- | --- | --- | --- |
394
+ | `value` | string | — | Controlled selected date in YYYY-MM-DD format; when supplied, selection proposals wait for the owner to update this value. |
395
+ | `defaultValue` | string | — | Initial autonomous selected date in YYYY-MM-DD format; later changes do not reset selection. |
396
+ | `min` | string | — | Earliest selectable date in YYYY-MM-DD format, inclusive. |
397
+ | `max` | string | — | Latest selectable date in YYYY-MM-DD format, inclusive. |
398
+ | `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. |
399
+ | `disabled` | boolean | `false` | Disables date selection and calendar navigation. |
400
+
401
+ Events: `(valueChange)` → `CalendarChangeDetail`.
402
+
403
+ ```ts
404
+ import { Component } from '@angular/core';
405
+ import { CosmCalendarComponent } from '@joralvmel/cosmos-angular';
406
+ import type { CalendarChangeDetail } from '@joralvmel/cosmos-core';
407
+
408
+ @Component({
409
+ selector: 'app-example',
410
+ imports: [CosmCalendarComponent],
411
+ template: `<cosm-calendar (valueChange)="onValueChange($event.detail)"></cosm-calendar>`,
412
+ })
413
+ export class ExampleComponent {
414
+ onValueChange(detail: CalendarChangeDetail) {
415
+ console.log(detail);
416
+ }
417
+ }
418
+ ```
419
+ ### `CosmTextareaComponent` (`<cosm-textarea>`)
420
+
421
+ Accepts multiline plain text with an accessible label, optional helper and error text, and native form behavior on the web.
422
+
423
+ | Prop | Type | Default | Description |
424
+ | --- | --- | --- | --- |
425
+ | `label` | string | Required | Accessible name for the editable control. It is rendered above the control unless visually hidden. |
426
+ | `labelHidden` | boolean | `false` | Visually hides the label while keeping it available to assistive technology. |
427
+ | `value` | string | — | Current text. When bound, edits are proposals and the component waits for the owner to supply the accepted value. |
428
+ | `defaultValue` | string | `` | Initial value for autonomous use. Web form reset restores this value; it does not control subsequent edits. |
429
+ | `rows` | number | `4` | Visible line count of the multiline editor. It is independent of the visual size. |
430
+ | `variant` | 'outlined' \| 'filled' | `outlined` | Visual treatment of the editable control. |
431
+ | `size` | 'sm' \| 'md' \| 'lg' | `md` | Visual size of the editable control, independent of rows. |
432
+ | `placeholder` | string | — | Short input hint; it never replaces the accessible label. |
433
+ | `helperText` | string | — | Optional supporting text associated with the editable control. |
434
+ | `errorText` | string | — | Optional consumer-localized error text associated with the editable control; a nonempty trimmed value also exposes invalid state. |
435
+ | `invalid` | boolean | `false` | External invalid state when the visible error is supplied elsewhere, independent of browser constraints or consumer business validation. |
436
+ | `required` | boolean | `false` | Exposes required semantics. On web, participates in native HTML constraint validation. |
437
+ | `disabled` | boolean | `false` | Disables editing and interaction. On web, follows disabled fieldsets and excludes the value from form submission. |
438
+ | `readOnly` | boolean | `false` | Prevents editing while remaining focusable and form-submittable on web; distinct from disabled. |
439
+ | `maxLength` | number | — | Maximum number of characters. Web uses native HTML length constraints and native applies supported input limits. |
440
+ | `name` | string | — | Form field name on web. React Native has no HTML form association or name-based submission. |
441
+
442
+ Events: `(valueChange)` → `TextareaChangeDetail`.
443
+
444
+ ```ts
445
+ import { Component } from '@angular/core';
446
+ import { CosmTextareaComponent } from '@joralvmel/cosmos-angular';
447
+ import type { TextareaChangeDetail } from '@joralvmel/cosmos-core';
448
+
449
+ @Component({
450
+ selector: 'app-example',
451
+ imports: [CosmTextareaComponent],
452
+ template: `<cosm-textarea label="Textarea" (valueChange)="onValueChange($event.detail)"></cosm-textarea>`,
453
+ })
454
+ export class ExampleComponent {
455
+ onValueChange(detail: TextareaChangeDetail) {
456
+ console.log(detail);
457
+ }
458
+ }
459
+ ```
460
+ ### `CosmRadioGroupComponent` (`<cosm-radio-group>`)
461
+
462
+ Selects one option from a labeled collection, with optional selection and native Web form behavior.
463
+
464
+ | Prop | Type | Default | Description |
465
+ | --- | --- | --- | --- |
466
+ | `label` | string | Required | Required visible accessible name for the group. |
467
+ | `options` | RadioGroupOptions | Required | Readonly flat options with unique nonempty values and labels, optional descriptions and disabled states. |
468
+ | `value` | RadioGroupValue | — | Controlled selected value; null means no selection, and a supplied null remains controlled. |
469
+ | `defaultValue` | RadioGroupValue | — | Initial autonomous selection; null by default. |
470
+ | `size` | 'sm' \| 'md' \| 'lg' | `md` | Small, medium or large radio indicator. |
471
+ | `orientation` | 'vertical' \| 'horizontal' | `vertical` | Vertical list or wrapping horizontal options. |
472
+ | `disabled` | boolean | `false` | Prevents interaction and excludes the value from Web form submission. |
473
+ | `required` | boolean | `false` | Requires a selection in Web form validation; Native exposes descriptive semantics. |
474
+ | `invalid` | boolean | `false` | Externally supplied invalid presentation state when the visible error is supplied elsewhere. |
475
+ | `helperText` | string | — | Optional supporting text associated with the group. |
476
+ | `errorText` | string | — | Optional consumer-localized error text; a nonempty trimmed value also exposes invalid state. |
477
+ | `name` | string | — | Web form field name; React Native has no HTML form association. |
478
+
479
+ Events: `(valueChange)` → `RadioGroupChangeDetail`.
480
+
481
+ ```ts
482
+ import { Component } from '@angular/core';
483
+ import { CosmRadioGroupComponent } from '@joralvmel/cosmos-angular';
484
+ 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;
485
+ import type { RadioGroupChangeDetail } from '@joralvmel/cosmos-core';
486
+
487
+ @Component({
488
+ selector: 'app-example',
489
+ imports: [CosmRadioGroupComponent],
490
+ template: `<cosm-radio-group label="RadioGroup" [options]="contactMethods" (valueChange)="onValueChange($event.detail)"></cosm-radio-group>`,
491
+ })
492
+ export class ExampleComponent {
493
+ readonly contactMethods = contactMethods;
494
+ onValueChange(detail: RadioGroupChangeDetail) {
495
+ console.log(detail);
496
+ }
497
+ }
498
+ ```
499
+ ### `CosmSelectComponent` (`<cosm-select>`)
500
+
501
+ Selects one option from an accessible collection, with native Web form behavior.
502
+
503
+ | Prop | Type | Default | Description |
504
+ | --- | --- | --- | --- |
505
+ | `label` | string | Required | Required visible accessible name for the control. |
506
+ | `items` | SelectItems | Required | Readonly flat options with unique nonempty values, nonempty labels, and optional disabled state. |
507
+ | `value` | SelectValue | — | Controlled selected value; null means no selection, and a supplied null remains controlled. |
508
+ | `defaultValue` | SelectValue | — | Initial autonomous selection; null by default. |
509
+ | `placeholder` | string | Required | Consumer-localized text shown when no value is selected. |
510
+ | `variant` | 'outlined' \| 'filled' | `outlined` | Outlined or filled trigger appearance. |
511
+ | `size` | 'sm' \| 'md' \| 'lg' | `md` | Small, medium, or large control size. |
512
+ | `disabled` | boolean | `false` | Prevents interaction and excludes the value from Web form submission. |
513
+ | `required` | boolean | `false` | Requires a selection in Web form validation; Native exposes descriptive semantics. |
514
+ | `invalid` | boolean | `false` | Externally supplied invalid presentation state when the visible error is supplied elsewhere. |
515
+ | `helperText` | string | — | Optional supporting text associated with the control. |
516
+ | `errorText` | string | — | Optional consumer-localized error text; a nonempty trimmed value also exposes invalid state. |
517
+ | `name` | string | — | Web form field name; React Native has no HTML form association. |
518
+
519
+ Events: `(valueChange)` → `SelectChangeDetail`.
520
+
521
+ ```ts
522
+ import { Component } from '@angular/core';
523
+ import { CosmSelectComponent } from '@joralvmel/cosmos-angular';
524
+ const flat = [{"value":"apple","label":"Apple"},{"value":"cherry","label":"Cherry"},{"value":"lime","label":"Lime","disabled":true}] as const;
525
+ const none = null as const;
526
+ import type { SelectChangeDetail } from '@joralvmel/cosmos-core';
527
+
528
+ @Component({
529
+ selector: 'app-example',
530
+ imports: [CosmSelectComponent],
531
+ template: `<cosm-select label="Select" [items]="flat" [defaultValue]="none" placeholder="Select" (valueChange)="onValueChange($event.detail)"></cosm-select>`,
532
+ })
533
+ export class ExampleComponent {
534
+ readonly flat = flat;
535
+ readonly none = none;
536
+ onValueChange(detail: SelectChangeDetail) {
537
+ console.log(detail);
538
+ }
539
+ }
540
+ ```
541
+ ### `CosmPaginationComponent` (`<cosm-pagination>`)
542
+
543
+ Navigates a known number of pages using buttons.
544
+
545
+ | Prop | Type | Default | Description |
546
+ | --- | --- | --- | --- |
547
+ | `totalPages` | number | Required | Required nonnegative safe integer page count. |
548
+ | `page` | number | — | Controlled one-based safe integer page; out-of-range values are displayed clamped. |
549
+ | `defaultPage` | number | `1` | Initial one-based page for autonomous state. |
550
+ | `label` | string | Required | Required localized navigation landmark label. |
551
+ | `previousLabel` | string | `Previous page` | Previous button label. |
552
+ | `nextLabel` | string | `Next page` | Next button label. |
553
+ | `firstLabel` | string | `First page` | First button label. |
554
+ | `lastLabel` | string | `Last page` | Last button label. |
555
+ | `pageLabel` | string | `Page {page}` | Page button label template; {page} is replaced with the localized number. |
556
+ | `summaryLabel` | string | `Page {page} of {total}` | Compact summary template with {page} and {total} placeholders. |
557
+ | `locale` | string | — | Locale for formatted page numbers. |
558
+ | `direction` | 'ltr' \| 'rtl' | `ltr` | Layout and directional icon direction. |
559
+ | `presentation` | 'numbered' \| 'compact' | `numbered` | Show up to seven fixed-width numbered positions or a compact summary. |
560
+ | `variant` | 'solid' \| 'soft' \| 'outline' | `solid` | Selected page emphasis. |
561
+ | `size` | 'sm' \| 'md' \| 'lg' | `md` | Control size. |
562
+ | `showFirstLast` | boolean | `false` | Show first and last page controls. |
563
+ | `disabled` | boolean | `false` | Disable all controls. |
564
+
565
+ Events: `(pageChange)` → `PaginationChangeDetail`.
566
+
567
+ ```ts
568
+ import { Component } from '@angular/core';
569
+ import { CosmPaginationComponent } from '@joralvmel/cosmos-angular';
570
+ import type { PaginationChangeDetail } from '@joralvmel/cosmos-core';
571
+
572
+ @Component({
573
+ selector: 'app-example',
574
+ imports: [CosmPaginationComponent],
575
+ template: `<cosm-pagination label="Pagination" (pageChange)="onPageChange($event.detail)"></cosm-pagination>`,
576
+ })
577
+ export class ExampleComponent {
578
+ onPageChange(detail: PaginationChangeDetail) {
579
+ console.log(detail);
580
+ }
581
+ }
582
+ ```
583
+ ### `CosmDialogComponent` (`<cosm-dialog>`)
584
+
585
+ Modal content with a title, actions and cancelable close requests.
586
+
587
+ | Prop | Type | Default | Description |
588
+ | --- | --- | --- | --- |
589
+ | `open` | boolean | `false` | Committed visibility; supplying this prop, including false, controls state. |
590
+ | `defaultOpen` | boolean | `false` | Initial autonomous visibility; subsequent changes do not reset state. |
591
+ | `presentation` | 'standard' \| 'fullscreen' | `standard` | Centered standard surface or fullscreen surface. |
592
+ | `size` | 'sm' \| 'md' \| 'lg' | `md` | Maximum standard width: sm 400, md 640, lg 960 pixels or logical points. |
593
+ | `responsiveFullscreen` | boolean | `false` | Use fullscreen when available viewport width is below 640 pixels or logical points. |
594
+ | `closeLabel` | string | `Close` | Non-empty localized accessible name of the built-in close button. |
595
+ | `closeOnEscape` | boolean | `true` | Request closure on unhandled Escape on web. |
596
+ | `closeOnBackdropPress` | boolean | `false` | Request closure when the backdrop itself is pressed. |
597
+ | `initialFocusTarget` | DialogFocusTarget | — | Optional platform focus target used on committed opening; it must be inside the dialog. |
598
+ | `returnFocusTarget` | DialogFocusTarget | — | Optional platform focus target used after committed closure. |
599
+
600
+ Events: `(openChange)` → `DialogOpenChangeDetail`.
601
+
602
+ ```ts
603
+ import { Component, ViewChild } from '@angular/core';
604
+ import { CosmButtonComponent, CosmDialogComponent } from '@joralvmel/cosmos-angular';
605
+ import type { DialogOpenChangeDetail } from '@joralvmel/cosmos-core';
606
+
607
+ @Component({
608
+ selector: 'app-example',
609
+ imports: [CosmButtonComponent, CosmDialogComponent],
610
+ template: `
611
+ <cosm-button type="button" (press)="dialog?.requestOpen()">Open dialog</cosm-button>
612
+ <cosm-dialog (openChange)="onOpenChange($event)">
613
+ <h2 slot="title">Review details</h2>
614
+ <p>Dialog</p>
615
+ <cosm-button slot="actions" type="button" (press)="dialog?.requestClose()">Done</cosm-button>
616
+ </cosm-dialog>
617
+ `,
618
+ })
619
+ export class ExampleComponent {
620
+ @ViewChild(CosmDialogComponent) dialog?: CosmDialogComponent;
621
+ onOpenChange(event: CustomEvent<DialogOpenChangeDetail>) {
622
+ console.log(event.detail);
623
+ }
624
+ }
625
+ ```
296
626
 
297
627
  ## Themes
298
628
 
299
- Built-in themes: `cosmos`, `nebula` (default `cosmos`), each with `light` and `dark` modes; `system` follows the OS.
629
+ Built-in themes: `cosmos`, `nebula`, `terra`, `supernova`, `aurora`, `solstice` (default `cosmos`), each with `light` and `dark` modes; `system` follows the OS.
300
630
 
301
631
  ```html
302
632
  <html data-theme="nebula" data-mode="system">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joralvmel/cosmos-angular",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Angular standalone components and forms integration for the Cosmos UI Web Components.",
5
5
  "keywords": [
6
6
  "angular",
@@ -42,9 +42,9 @@
42
42
  "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\""
43
43
  },
44
44
  "dependencies": {
45
- "@joralvmel/cosmos-core": "^0.3.0",
46
- "@joralvmel/cosmos-elements": "^0.3.0",
47
- "@joralvmel/cosmos-icons": "^0.2.0",
45
+ "@joralvmel/cosmos-core": "^0.4.0",
46
+ "@joralvmel/cosmos-elements": "^0.4.0",
47
+ "@joralvmel/cosmos-icons": "^0.4.0",
48
48
  "tslib": "^2.9.1"
49
49
  },
50
50
  "peerDependencies": {
@@ -52,12 +52,12 @@
52
52
  "@angular/forms": ">=21.0.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@angular/common": "^22.2.6",
56
- "@angular/compiler": "^22.2.5",
57
- "@angular/compiler-cli": "^22.2.6",
58
- "@angular/core": "^22.2.5",
59
- "@angular/forms": "^22.2.6",
60
- "@angular/platform-browser": "^22.2.5",
55
+ "@angular/common": "~22.3.0",
56
+ "@angular/compiler": "~22.3.0",
57
+ "@angular/compiler-cli": "~22.3.0",
58
+ "@angular/core": "~22.3.0",
59
+ "@angular/forms": "~22.3.0",
60
+ "@angular/platform-browser": "~22.3.0",
61
61
  "rxjs": "^7.8.2"
62
62
  }
63
63
  }