@joralvmel/cosmos-core 0.2.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 (157) hide show
  1. package/dist/catalog.d.ts +3 -3
  2. package/dist/catalog.d.ts.map +1 -1
  3. package/dist/catalog.js +25 -6
  4. package/dist/catalog.js.map +1 -1
  5. package/dist/codegen.d.ts +16 -0
  6. package/dist/codegen.d.ts.map +1 -1
  7. package/dist/codegen.js +396 -57
  8. package/dist/codegen.js.map +1 -1
  9. package/dist/headless/calendar.d.ts +32 -0
  10. package/dist/headless/calendar.d.ts.map +1 -0
  11. package/dist/headless/calendar.js +242 -0
  12. package/dist/headless/calendar.js.map +1 -0
  13. package/dist/headless/listbox.d.ts +9 -0
  14. package/dist/headless/listbox.d.ts.map +1 -0
  15. package/dist/headless/listbox.js +103 -0
  16. package/dist/headless/listbox.js.map +1 -0
  17. package/dist/headless/pagination.d.ts +34 -0
  18. package/dist/headless/pagination.d.ts.map +1 -0
  19. package/dist/headless/pagination.js +92 -0
  20. package/dist/headless/pagination.js.map +1 -0
  21. package/dist/headless/radio-group.d.ts +10 -0
  22. package/dist/headless/radio-group.d.ts.map +1 -0
  23. package/dist/headless/radio-group.js +59 -0
  24. package/dist/headless/radio-group.js.map +1 -0
  25. package/dist/headless/select.d.ts +4 -0
  26. package/dist/headless/select.d.ts.map +1 -0
  27. package/dist/headless/select.js +7 -0
  28. package/dist/headless/select.js.map +1 -0
  29. package/dist/headless/size.d.ts +3 -0
  30. package/dist/headless/size.d.ts.map +1 -0
  31. package/dist/headless/size.js +7 -0
  32. package/dist/headless/size.js.map +1 -0
  33. package/dist/headless/text-field.d.ts +25 -0
  34. package/dist/headless/text-field.d.ts.map +1 -0
  35. package/dist/headless/text-field.js +12 -0
  36. package/dist/headless/text-field.js.map +1 -0
  37. package/dist/index.d.ts +1709 -19
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +60 -1
  40. package/dist/index.js.map +1 -1
  41. package/dist/markdown.d.ts.map +1 -1
  42. package/dist/markdown.js +7 -3
  43. package/dist/markdown.js.map +1 -1
  44. package/dist/specs/badge.d.ts +65 -0
  45. package/dist/specs/badge.d.ts.map +1 -0
  46. package/dist/specs/badge.js +64 -0
  47. package/dist/specs/badge.js.map +1 -0
  48. package/dist/specs/badge.scenarios.d.ts +21 -0
  49. package/dist/specs/badge.scenarios.d.ts.map +1 -0
  50. package/dist/specs/badge.scenarios.js +35 -0
  51. package/dist/specs/badge.scenarios.js.map +1 -0
  52. package/dist/specs/calendar.d.ts +120 -0
  53. package/dist/specs/calendar.d.ts.map +1 -0
  54. package/dist/specs/calendar.js +121 -0
  55. package/dist/specs/calendar.js.map +1 -0
  56. package/dist/specs/calendar.scenarios.d.ts +39 -0
  57. package/dist/specs/calendar.scenarios.d.ts.map +1 -0
  58. package/dist/specs/calendar.scenarios.js +139 -0
  59. package/dist/specs/calendar.scenarios.js.map +1 -0
  60. package/dist/specs/checkbox.d.ts +139 -0
  61. package/dist/specs/checkbox.d.ts.map +1 -0
  62. package/dist/specs/checkbox.js +129 -0
  63. package/dist/specs/checkbox.js.map +1 -0
  64. package/dist/specs/checkbox.scenarios.d.ts +28 -0
  65. package/dist/specs/checkbox.scenarios.d.ts.map +1 -0
  66. package/dist/specs/checkbox.scenarios.js +54 -0
  67. package/dist/specs/checkbox.scenarios.js.map +1 -0
  68. package/dist/specs/dialog.d.ts +167 -0
  69. package/dist/specs/dialog.d.ts.map +1 -0
  70. package/dist/specs/dialog.js +136 -0
  71. package/dist/specs/dialog.js.map +1 -0
  72. package/dist/specs/dialog.scenarios.d.ts +42 -0
  73. package/dist/specs/dialog.scenarios.d.ts.map +1 -0
  74. package/dist/specs/dialog.scenarios.js +129 -0
  75. package/dist/specs/dialog.scenarios.js.map +1 -0
  76. package/dist/specs/icon-button.d.ts +136 -0
  77. package/dist/specs/icon-button.d.ts.map +1 -0
  78. package/dist/specs/icon-button.js +119 -0
  79. package/dist/specs/icon-button.js.map +1 -0
  80. package/dist/specs/icon-button.scenarios.d.ts +28 -0
  81. package/dist/specs/icon-button.scenarios.d.ts.map +1 -0
  82. package/dist/specs/icon-button.scenarios.js +95 -0
  83. package/dist/specs/icon-button.scenarios.js.map +1 -0
  84. package/dist/specs/icon.d.ts +11 -20
  85. package/dist/specs/icon.d.ts.map +1 -1
  86. package/dist/specs/icon.js +11 -20
  87. package/dist/specs/icon.js.map +1 -1
  88. package/dist/specs/icon.scenarios.d.ts +9 -1
  89. package/dist/specs/icon.scenarios.d.ts.map +1 -1
  90. package/dist/specs/icon.scenarios.js +70 -6
  91. package/dist/specs/icon.scenarios.js.map +1 -1
  92. package/dist/specs/listbox.d.ts +157 -0
  93. package/dist/specs/listbox.d.ts.map +1 -0
  94. package/dist/specs/listbox.js +144 -0
  95. package/dist/specs/listbox.js.map +1 -0
  96. package/dist/specs/listbox.scenarios.d.ts +37 -0
  97. package/dist/specs/listbox.scenarios.d.ts.map +1 -0
  98. package/dist/specs/listbox.scenarios.js +110 -0
  99. package/dist/specs/listbox.scenarios.js.map +1 -0
  100. package/dist/specs/pagination.d.ts +147 -0
  101. package/dist/specs/pagination.d.ts.map +1 -0
  102. package/dist/specs/pagination.js +122 -0
  103. package/dist/specs/pagination.js.map +1 -0
  104. package/dist/specs/pagination.scenarios.d.ts +15 -0
  105. package/dist/specs/pagination.scenarios.d.ts.map +1 -0
  106. package/dist/specs/pagination.scenarios.js +29 -0
  107. package/dist/specs/pagination.scenarios.js.map +1 -0
  108. package/dist/specs/popover.d.ts +201 -0
  109. package/dist/specs/popover.d.ts.map +1 -0
  110. package/dist/specs/popover.js +169 -0
  111. package/dist/specs/popover.js.map +1 -0
  112. package/dist/specs/popover.scenarios.d.ts +83 -0
  113. package/dist/specs/popover.scenarios.d.ts.map +1 -0
  114. package/dist/specs/popover.scenarios.js +368 -0
  115. package/dist/specs/popover.scenarios.js.map +1 -0
  116. package/dist/specs/radio-group.d.ts +154 -0
  117. package/dist/specs/radio-group.d.ts.map +1 -0
  118. package/dist/specs/radio-group.js +133 -0
  119. package/dist/specs/radio-group.js.map +1 -0
  120. package/dist/specs/radio-group.scenarios.d.ts +35 -0
  121. package/dist/specs/radio-group.scenarios.d.ts.map +1 -0
  122. package/dist/specs/radio-group.scenarios.js +67 -0
  123. package/dist/specs/radio-group.scenarios.js.map +1 -0
  124. package/dist/specs/select.d.ts +167 -0
  125. package/dist/specs/select.d.ts.map +1 -0
  126. package/dist/specs/select.js +148 -0
  127. package/dist/specs/select.js.map +1 -0
  128. package/dist/specs/select.scenarios.d.ts +37 -0
  129. package/dist/specs/select.scenarios.d.ts.map +1 -0
  130. package/dist/specs/select.scenarios.js +77 -0
  131. package/dist/specs/select.scenarios.js.map +1 -0
  132. package/dist/specs/switch.d.ts +123 -0
  133. package/dist/specs/switch.d.ts.map +1 -0
  134. package/dist/specs/switch.js +113 -0
  135. package/dist/specs/switch.js.map +1 -0
  136. package/dist/specs/switch.scenarios.d.ts +27 -0
  137. package/dist/specs/switch.scenarios.d.ts.map +1 -0
  138. package/dist/specs/switch.scenarios.js +54 -0
  139. package/dist/specs/switch.scenarios.js.map +1 -0
  140. package/dist/specs/text-field.d.ts +232 -0
  141. package/dist/specs/text-field.d.ts.map +1 -0
  142. package/dist/specs/text-field.js +220 -0
  143. package/dist/specs/text-field.js.map +1 -0
  144. package/dist/specs/text-field.scenarios.d.ts +52 -0
  145. package/dist/specs/text-field.scenarios.d.ts.map +1 -0
  146. package/dist/specs/text-field.scenarios.js +106 -0
  147. package/dist/specs/text-field.scenarios.js.map +1 -0
  148. package/dist/specs/textarea.d.ts +144 -0
  149. package/dist/specs/textarea.d.ts.map +1 -0
  150. package/dist/specs/textarea.js +134 -0
  151. package/dist/specs/textarea.js.map +1 -0
  152. package/dist/specs/textarea.scenarios.d.ts +33 -0
  153. package/dist/specs/textarea.scenarios.d.ts.map +1 -0
  154. package/dist/specs/textarea.scenarios.js +82 -0
  155. package/dist/specs/textarea.scenarios.js.map +1 -0
  156. package/llms.md +797 -6
  157. package/package.json +1 -1
@@ -0,0 +1,157 @@
1
+ export interface ListboxOption<Icon = unknown> {
2
+ value: string;
3
+ label: string;
4
+ description?: string;
5
+ icon?: Icon;
6
+ disabled?: boolean;
7
+ }
8
+ export interface ListboxGroup<Icon = unknown> {
9
+ label: string;
10
+ options: readonly ListboxOption<Icon>[];
11
+ }
12
+ export type ListboxItem<Icon = unknown> = ListboxOption<Icon> | ListboxGroup<Icon>;
13
+ export type ListboxSelectionMode = 'single' | 'multiple';
14
+ export interface ListboxSelectionChangeDetail {
15
+ selectedValues: readonly string[];
16
+ value: string;
17
+ source: 'pointer' | 'keyboard';
18
+ }
19
+ /** Vertical selection with independent active focus and controlled or autonomous selected values. */
20
+ export declare const listboxContract: {
21
+ readonly name: "listbox";
22
+ readonly tag: "cosm-listbox";
23
+ readonly description: "Selects one or more values from a named vertical collection, with groups, descriptions, icons and independent keyboard focus.";
24
+ readonly role: "listbox";
25
+ readonly pattern: "https://www.w3.org/WAI/ARIA/apg/patterns/listbox/";
26
+ readonly props: {
27
+ readonly label: {
28
+ readonly type: "string";
29
+ readonly required: true;
30
+ readonly description: "Required nonempty accessible label, visible unless labelHidden is true.";
31
+ };
32
+ readonly labelHidden: {
33
+ readonly type: "boolean";
34
+ readonly default: false;
35
+ readonly reflect: true;
36
+ readonly description: "Visually hides the label without removing its accessible name.";
37
+ };
38
+ readonly items: {
39
+ readonly type: "reference";
40
+ readonly reference: "ListboxItems";
41
+ readonly required: true;
42
+ readonly options: readonly ["flat", "grouped"];
43
+ readonly example: "grouped";
44
+ readonly description: "Readonly collection of options or named groups. Options have globally unique nonempty value and label strings, optional description, decorative IconDefinition and disabled. Groups have a nonempty label and options array.";
45
+ };
46
+ readonly selectionMode: {
47
+ readonly type: "enum";
48
+ readonly values: readonly ["single", "multiple"];
49
+ readonly default: "single";
50
+ readonly reflect: true;
51
+ readonly description: "Single permits at most one selected value; multiple toggles each activation.";
52
+ };
53
+ readonly selectedValues: {
54
+ readonly type: "reference";
55
+ readonly reference: "ListboxValues";
56
+ readonly options: readonly ["empty", "apple", "cherry", "apple-cherry"];
57
+ readonly description: "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.";
58
+ };
59
+ readonly defaultSelectedValues: {
60
+ readonly type: "reference";
61
+ readonly reference: "ListboxValues";
62
+ readonly options: readonly ["empty", "apple", "cherry", "apple-cherry"];
63
+ readonly example: "empty";
64
+ readonly description: "Initial autonomous selected values (empty by default). Later changes do not reset selection.";
65
+ };
66
+ readonly variant: {
67
+ readonly type: "enum";
68
+ readonly values: readonly ["plain", "outlined"];
69
+ readonly default: "plain";
70
+ readonly reflect: true;
71
+ readonly description: "Plain composes inside a panel; outlined adds a standalone container boundary.";
72
+ };
73
+ readonly size: {
74
+ readonly type: "enum";
75
+ readonly values: readonly ["sm", "md", "lg"];
76
+ readonly default: "md";
77
+ readonly reflect: true;
78
+ readonly description: "Small, medium or large option rows. Content may grow; native touch targets remain at least 44.";
79
+ };
80
+ readonly disabled: {
81
+ readonly type: "boolean";
82
+ readonly default: false;
83
+ readonly reflect: true;
84
+ readonly description: "Prevents interaction and removes the list from keyboard navigation.";
85
+ };
86
+ readonly readOnly: {
87
+ readonly type: "boolean";
88
+ readonly default: false;
89
+ readonly reflect: true;
90
+ readonly description: "Allows exploring options without proposing or committing selection changes.";
91
+ };
92
+ readonly locale: {
93
+ readonly type: "string";
94
+ readonly description: "BCP 47 locale for typeahead. Web inherits the nearest language; native uses the runtime locale when omitted. Invalid locale identifiers are rejected.";
95
+ };
96
+ };
97
+ readonly events: {
98
+ readonly selectionChange: {
99
+ readonly description: "Proposes the next selectedValues for an enabled activation. Autonomous selection commits; controlled selection waits for the owner. Arrows and typeahead never select.";
100
+ readonly detail: "ListboxSelectionChangeDetail";
101
+ readonly names: {
102
+ readonly dom: "cosm-selection-change";
103
+ readonly react: "onSelectionChange";
104
+ readonly angular: "selectionChange";
105
+ readonly native: "onSelectionChange";
106
+ };
107
+ };
108
+ };
109
+ readonly states: readonly [{
110
+ readonly prop: "selectedValues";
111
+ readonly event: "selectionChange";
112
+ readonly defaultProp: "defaultSelectedValues";
113
+ }];
114
+ readonly slots: {};
115
+ readonly parts: {
116
+ readonly base: "Outer container.";
117
+ readonly label: "Visible or visually hidden accessible label.";
118
+ readonly list: "Scrollable listbox.";
119
+ readonly group: "Named option group.";
120
+ readonly 'group-label': "Noninteractive group heading.";
121
+ readonly option: "Selectable row; selected, disabled and active states are exposed on the row.";
122
+ readonly icon: "Decorative option icon.";
123
+ readonly content: "Text content wrapper.";
124
+ readonly 'option-label': "Primary option text.";
125
+ readonly description: "Optional supporting text.";
126
+ readonly indicator: "Decorative selected-state indicator.";
127
+ };
128
+ readonly cssProperties: {
129
+ readonly '--cosm-listbox-background': "Container background.";
130
+ readonly '--cosm-listbox-color': "Primary foreground.";
131
+ readonly '--cosm-listbox-border': "Outlined container border color.";
132
+ readonly '--cosm-listbox-radius': "Container and option corner radius.";
133
+ readonly '--cosm-listbox-option-height': "Minimum option height.";
134
+ readonly '--cosm-listbox-option-padding': "Option padding.";
135
+ readonly '--cosm-listbox-gap': "Space between icon, content and selection indicator.";
136
+ readonly '--cosm-listbox-font-size': "Primary option text size.";
137
+ readonly '--cosm-listbox-description-color': "Supporting text color.";
138
+ readonly '--cosm-listbox-selected-background': "Selected option background.";
139
+ readonly '--cosm-listbox-selected-color': "Selected option foreground.";
140
+ readonly '--cosm-listbox-focus': "Visible keyboard focus outline color.";
141
+ readonly '--cosm-listbox-max-height': "Maximum scrollable list height.";
142
+ };
143
+ readonly keyboard: readonly [{
144
+ readonly keys: readonly ["Tab", "Shift+Tab"];
145
+ readonly action: "Enters or leaves the list as one Tab stop.";
146
+ }, {
147
+ readonly keys: readonly ["ArrowDown", "ArrowUp", "Home", "End"];
148
+ readonly action: "Moves focus among enabled options without changing selection; stops at the ends.";
149
+ }, {
150
+ readonly keys: readonly ["Enter", "Space"];
151
+ readonly action: "Selects the focused option; multiple mode toggles it. Read-only never changes selection.";
152
+ }, {
153
+ readonly keys: readonly ["Printable characters"];
154
+ readonly action: "Moves focus to a matching option using locale-aware typeahead without filtering.";
155
+ }];
156
+ };
157
+ //# sourceMappingURL=listbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listbox.d.ts","sourceRoot":"","sources":["../../src/specs/listbox.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa,CAAC,IAAI,GAAG,OAAO;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,YAAY,CAAC,IAAI,GAAG,OAAO;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;CACzC;AAED,MAAM,MAAM,WAAW,CAAC,IAAI,GAAG,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;AACnF,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEzD,MAAM,WAAW,4BAA4B;IAC3C,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,SAAS,GAAG,UAAU,CAAC;CAChC;AAED,qGAAqG;AACrG,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoJ1B,CAAC"}
@@ -0,0 +1,144 @@
1
+ import { defineContract } from '../contract.js';
2
+ /** Vertical selection with independent active focus and controlled or autonomous selected values. */
3
+ export const listboxContract = defineContract({
4
+ name: 'listbox',
5
+ tag: 'cosm-listbox',
6
+ description: 'Selects one or more values from a named vertical collection, with groups, descriptions, icons and independent keyboard focus.',
7
+ role: 'listbox',
8
+ pattern: 'https://www.w3.org/WAI/ARIA/apg/patterns/listbox/',
9
+ props: {
10
+ label: {
11
+ type: 'string',
12
+ required: true,
13
+ description: 'Required nonempty accessible label, visible unless labelHidden is true.',
14
+ },
15
+ labelHidden: {
16
+ type: 'boolean',
17
+ default: false,
18
+ reflect: true,
19
+ description: 'Visually hides the label without removing its accessible name.',
20
+ },
21
+ items: {
22
+ type: 'reference',
23
+ reference: 'ListboxItems',
24
+ required: true,
25
+ options: ['flat', 'grouped'],
26
+ example: 'grouped',
27
+ description: 'Readonly collection of options or named groups. Options have globally unique nonempty value and label strings, optional description, decorative IconDefinition and disabled. Groups have a nonempty label and options array.',
28
+ },
29
+ selectionMode: {
30
+ type: 'enum',
31
+ values: ['single', 'multiple'],
32
+ default: 'single',
33
+ reflect: true,
34
+ description: 'Single permits at most one selected value; multiple toggles each activation.',
35
+ },
36
+ selectedValues: {
37
+ type: 'reference',
38
+ reference: 'ListboxValues',
39
+ options: ['empty', 'apple', 'cherry', 'apple-cherry'],
40
+ description: '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.',
41
+ },
42
+ defaultSelectedValues: {
43
+ type: 'reference',
44
+ reference: 'ListboxValues',
45
+ options: ['empty', 'apple', 'cherry', 'apple-cherry'],
46
+ example: 'empty',
47
+ description: 'Initial autonomous selected values (empty by default). Later changes do not reset selection.',
48
+ },
49
+ variant: {
50
+ type: 'enum',
51
+ values: ['plain', 'outlined'],
52
+ default: 'plain',
53
+ reflect: true,
54
+ description: 'Plain composes inside a panel; outlined adds a standalone container boundary.',
55
+ },
56
+ size: {
57
+ type: 'enum',
58
+ values: ['sm', 'md', 'lg'],
59
+ default: 'md',
60
+ reflect: true,
61
+ description: 'Small, medium or large option rows. Content may grow; native touch targets remain at least 44.',
62
+ },
63
+ disabled: {
64
+ type: 'boolean',
65
+ default: false,
66
+ reflect: true,
67
+ description: 'Prevents interaction and removes the list from keyboard navigation.',
68
+ },
69
+ readOnly: {
70
+ type: 'boolean',
71
+ default: false,
72
+ reflect: true,
73
+ description: 'Allows exploring options without proposing or committing selection changes.',
74
+ },
75
+ locale: {
76
+ type: 'string',
77
+ description: 'BCP 47 locale for typeahead. Web inherits the nearest language; native uses the runtime locale when omitted. Invalid locale identifiers are rejected.',
78
+ },
79
+ },
80
+ events: {
81
+ selectionChange: {
82
+ description: 'Proposes the next selectedValues for an enabled activation. Autonomous selection commits; controlled selection waits for the owner. Arrows and typeahead never select.',
83
+ detail: 'ListboxSelectionChangeDetail',
84
+ names: {
85
+ dom: 'cosm-selection-change',
86
+ react: 'onSelectionChange',
87
+ angular: 'selectionChange',
88
+ native: 'onSelectionChange',
89
+ },
90
+ },
91
+ },
92
+ states: [
93
+ {
94
+ prop: 'selectedValues',
95
+ event: 'selectionChange',
96
+ defaultProp: 'defaultSelectedValues',
97
+ },
98
+ ],
99
+ slots: {},
100
+ parts: {
101
+ base: 'Outer container.',
102
+ label: 'Visible or visually hidden accessible label.',
103
+ list: 'Scrollable listbox.',
104
+ group: 'Named option group.',
105
+ 'group-label': 'Noninteractive group heading.',
106
+ option: 'Selectable row; selected, disabled and active states are exposed on the row.',
107
+ icon: 'Decorative option icon.',
108
+ content: 'Text content wrapper.',
109
+ 'option-label': 'Primary option text.',
110
+ description: 'Optional supporting text.',
111
+ indicator: 'Decorative selected-state indicator.',
112
+ },
113
+ cssProperties: {
114
+ '--cosm-listbox-background': 'Container background.',
115
+ '--cosm-listbox-color': 'Primary foreground.',
116
+ '--cosm-listbox-border': 'Outlined container border color.',
117
+ '--cosm-listbox-radius': 'Container and option corner radius.',
118
+ '--cosm-listbox-option-height': 'Minimum option height.',
119
+ '--cosm-listbox-option-padding': 'Option padding.',
120
+ '--cosm-listbox-gap': 'Space between icon, content and selection indicator.',
121
+ '--cosm-listbox-font-size': 'Primary option text size.',
122
+ '--cosm-listbox-description-color': 'Supporting text color.',
123
+ '--cosm-listbox-selected-background': 'Selected option background.',
124
+ '--cosm-listbox-selected-color': 'Selected option foreground.',
125
+ '--cosm-listbox-focus': 'Visible keyboard focus outline color.',
126
+ '--cosm-listbox-max-height': 'Maximum scrollable list height.',
127
+ },
128
+ keyboard: [
129
+ { keys: ['Tab', 'Shift+Tab'], action: 'Enters or leaves the list as one Tab stop.' },
130
+ {
131
+ keys: ['ArrowDown', 'ArrowUp', 'Home', 'End'],
132
+ action: 'Moves focus among enabled options without changing selection; stops at the ends.',
133
+ },
134
+ {
135
+ keys: ['Enter', 'Space'],
136
+ action: 'Selects the focused option; multiple mode toggles it. Read-only never changes selection.',
137
+ },
138
+ {
139
+ keys: ['Printable characters'],
140
+ action: 'Moves focus to a matching option using locale-aware typeahead without filtering.',
141
+ },
142
+ ],
143
+ });
144
+ //# sourceMappingURL=listbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listbox.js","sourceRoot":"","sources":["../../src/specs/listbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAwBhD,qGAAqG;AACrG,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC;IAC5C,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,cAAc;IACnB,WAAW,EACT,+HAA+H;IACjI,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,mDAAmD;IAC5D,KAAK,EAAE;QACL,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,yEAAyE;SACvF;QACD,WAAW,EAAE;YACX,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,IAAI;YACb,WAAW,EAAE,gEAAgE;SAC9E;QACD,KAAK,EAAE;YACL,IAAI,EAAE,WAAW;YACjB,SAAS,EAAE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I,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,4CAA4C,EAAE;QACpF;YACE,IAAI,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC;YAC7C,MAAM,EAAE,kFAAkF;SAC3F;QACD;YACE,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;YACxB,MAAM,EACJ,0FAA0F;SAC7F;QACD;YACE,IAAI,EAAE,CAAC,sBAAsB,CAAC;YAC9B,MAAM,EAAE,kFAAkF;SAC3F;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { Platform } from '../contract.js';
2
+ import type { ListboxItem } from './listbox.js';
3
+ export type ListboxAction = {
4
+ type: 'activate';
5
+ value: string;
6
+ source: 'pointer' | 'keyboard';
7
+ } | {
8
+ type: 'sync';
9
+ selectedValues: readonly string[];
10
+ } | {
11
+ type: 'key';
12
+ key: string;
13
+ };
14
+ export interface ListboxScenario {
15
+ name: string;
16
+ props: {
17
+ label: string;
18
+ items: readonly ListboxItem<never>[];
19
+ selectionMode?: 'single' | 'multiple';
20
+ selectedValues?: readonly string[];
21
+ defaultSelectedValues?: readonly string[];
22
+ disabled?: boolean;
23
+ readOnly?: boolean;
24
+ };
25
+ actions: readonly ListboxAction[];
26
+ expected: {
27
+ selectedValues: readonly string[];
28
+ changes: readonly (readonly string[])[];
29
+ activeValue?: string;
30
+ };
31
+ platforms?: readonly Platform[];
32
+ }
33
+ export declare const listboxScenarioItems: readonly ListboxItem<never>[];
34
+ /** Normative selection cases shared by platform drivers; keyboard cases are browser-only. */
35
+ export declare const listboxScenarios: readonly ListboxScenario[];
36
+ export declare const listboxScenariosFor: (platform: Platform) => ListboxScenario[];
37
+ //# sourceMappingURL=listbox.scenarios.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listbox.scenarios.d.ts","sourceRoot":"","sources":["../../src/specs/listbox.scenarios.ts"],"names":[],"mappings":"AAAA,OAAO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MAAM,mBAAmB,GAAI,UAAU,QAAQ,sBAC6C,CAAC"}
@@ -0,0 +1,110 @@
1
+ export const listboxScenarioItems = [
2
+ {
3
+ label: 'Fruit',
4
+ options: [
5
+ { value: 'apple', label: 'Apple' },
6
+ { value: 'apricot', label: 'Apricot' },
7
+ { value: 'banana', label: 'Banana', disabled: true },
8
+ { value: 'cherry', label: 'Cherry', description: 'Seasonal' },
9
+ ],
10
+ },
11
+ ];
12
+ const fixture = { label: 'Choose fruit', items: listboxScenarioItems };
13
+ /** Normative selection cases shared by platform drivers; keyboard cases are browser-only. */
14
+ export const listboxScenarios = [
15
+ {
16
+ name: 'starts empty without a proposal',
17
+ props: fixture,
18
+ actions: [],
19
+ expected: { selectedValues: [], changes: [] },
20
+ },
21
+ {
22
+ name: 'single activation selects without toggling the selected value off',
23
+ props: fixture,
24
+ actions: [
25
+ { type: 'activate', value: 'apple', source: 'pointer' },
26
+ { type: 'activate', value: 'apple', source: 'pointer' },
27
+ ],
28
+ expected: { selectedValues: ['apple'], changes: [['apple']] },
29
+ },
30
+ {
31
+ name: 'multiple selection toggles individual values',
32
+ props: { ...fixture, selectionMode: 'multiple', defaultSelectedValues: ['apple'] },
33
+ actions: [
34
+ { type: 'activate', value: 'cherry', source: 'pointer' },
35
+ { type: 'activate', value: 'apple', source: 'pointer' },
36
+ ],
37
+ expected: { selectedValues: ['cherry'], changes: [['apple', 'cherry'], ['cherry']] },
38
+ },
39
+ ...['disabled', 'readOnly'].map((state) => ({
40
+ name: `${state} does not propose selection`,
41
+ props: { ...fixture, [state]: true, defaultSelectedValues: ['apple'] },
42
+ actions: [{ type: 'activate', value: 'cherry', source: 'pointer' }],
43
+ expected: { selectedValues: ['apple'], changes: [] },
44
+ })),
45
+ {
46
+ name: 'disabled options cannot be activated',
47
+ props: fixture,
48
+ actions: [{ type: 'activate', value: 'banana', source: 'pointer' }],
49
+ expected: { selectedValues: [], changes: [] },
50
+ },
51
+ {
52
+ name: 'a controlled empty array refuses proposals without self-committing',
53
+ props: { ...fixture, selectedValues: [] },
54
+ actions: [
55
+ { type: 'activate', value: 'apple', source: 'pointer' },
56
+ { type: 'activate', value: 'apple', source: 'pointer' },
57
+ ],
58
+ expected: { selectedValues: [], changes: [['apple'], ['apple']] },
59
+ },
60
+ {
61
+ name: 'controlled selection uses the value accepted by the owner',
62
+ props: { ...fixture, selectedValues: [] },
63
+ actions: [
64
+ { type: 'activate', value: 'apple', source: 'pointer' },
65
+ { type: 'sync', selectedValues: ['apple'] },
66
+ { type: 'activate', value: 'cherry', source: 'pointer' },
67
+ ],
68
+ expected: { selectedValues: ['apple'], changes: [['apple'], ['cherry']] },
69
+ },
70
+ {
71
+ name: 'arrows skip disabled options without selecting',
72
+ props: fixture,
73
+ actions: [
74
+ { type: 'key', key: 'Home' },
75
+ { type: 'key', key: 'ArrowDown' },
76
+ { type: 'key', key: 'ArrowDown' },
77
+ ],
78
+ expected: { selectedValues: [], changes: [], activeValue: 'cherry' },
79
+ platforms: ['web', 'react', 'angular'],
80
+ },
81
+ {
82
+ name: 'keyboard confirmation selects the focused option',
83
+ props: fixture,
84
+ actions: [
85
+ { type: 'key', key: 'End' },
86
+ { type: 'key', key: 'Enter' },
87
+ ],
88
+ expected: { selectedValues: ['cherry'], changes: [['cherry']], activeValue: 'cherry' },
89
+ platforms: ['web', 'react', 'angular'],
90
+ },
91
+ {
92
+ name: 'typeahead navigates without filtering or selecting',
93
+ props: fixture,
94
+ actions: [{ type: 'key', key: 'c' }],
95
+ expected: { selectedValues: [], changes: [], activeValue: 'cherry' },
96
+ platforms: ['web', 'react', 'angular'],
97
+ },
98
+ {
99
+ name: 'read-only still permits keyboard exploration',
100
+ props: { ...fixture, readOnly: true },
101
+ actions: [
102
+ { type: 'key', key: 'End' },
103
+ { type: 'key', key: ' ' },
104
+ ],
105
+ expected: { selectedValues: [], changes: [], activeValue: 'cherry' },
106
+ platforms: ['web', 'react', 'angular'],
107
+ },
108
+ ];
109
+ export const listboxScenariosFor = (platform) => listboxScenarios.filter(scenario => !scenario.platforms || scenario.platforms.includes(platform));
110
+ //# sourceMappingURL=listbox.scenarios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listbox.scenarios.js","sourceRoot":"","sources":["../../src/specs/listbox.scenarios.ts"],"names":[],"mappings":"AA4BA,MAAM,CAAC,MAAM,oBAAoB,GAAkC;IACjE;QACE,KAAK,EAAE,OAAO;QACd,OAAO,EAAE;YACP,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;YAClC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;YACtC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;YACpD,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE;SAC9D;KACF;CACF,CAAC;AAEF,MAAM,OAAO,GAAG,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC;AAEvE,6FAA6F;AAC7F,MAAM,CAAC,MAAM,gBAAgB,GAA+B;IAC1D;QACE,IAAI,EAAE,iCAAiC;QACvC,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;KAC9C;IACD;QACE,IAAI,EAAE,mEAAmE;QACzE,KAAK,EAAE,OAAO;QACd,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE;YACvD,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE;SACxD;QACD,QAAQ,EAAE,EAAE,cAAc,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,EA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AAG,CAAC,QAAkB,EAAE,EAAE,CACxD,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,SAAS,IAAI,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,147 @@
1
+ /** Proposed one-based page. */
2
+ export interface PaginationChangeDetail {
3
+ page: number;
4
+ }
5
+ /** A bounded button-based navigation landmark for a known number of pages. */
6
+ export declare const paginationContract: {
7
+ readonly name: "pagination";
8
+ readonly tag: "cosm-pagination";
9
+ readonly description: "Navigates a known number of pages using buttons.";
10
+ readonly role: "navigation";
11
+ readonly pattern: "https://www.w3.org/WAI/ARIA/apg/practices/landmark-regions/";
12
+ readonly props: {
13
+ readonly totalPages: {
14
+ readonly type: "number";
15
+ readonly required: true;
16
+ readonly description: "Required nonnegative safe integer page count.";
17
+ };
18
+ readonly page: {
19
+ readonly type: "number";
20
+ readonly description: "Controlled one-based safe integer page; out-of-range values are displayed clamped.";
21
+ };
22
+ readonly defaultPage: {
23
+ readonly type: "number";
24
+ readonly default: 1;
25
+ readonly description: "Initial one-based page for autonomous state.";
26
+ };
27
+ readonly label: {
28
+ readonly type: "string";
29
+ readonly required: true;
30
+ readonly description: "Required localized navigation landmark label.";
31
+ };
32
+ readonly previousLabel: {
33
+ readonly type: "string";
34
+ readonly default: "Previous page";
35
+ readonly description: "Previous button label.";
36
+ };
37
+ readonly nextLabel: {
38
+ readonly type: "string";
39
+ readonly default: "Next page";
40
+ readonly description: "Next button label.";
41
+ };
42
+ readonly firstLabel: {
43
+ readonly type: "string";
44
+ readonly default: "First page";
45
+ readonly description: "First button label.";
46
+ };
47
+ readonly lastLabel: {
48
+ readonly type: "string";
49
+ readonly default: "Last page";
50
+ readonly description: "Last button label.";
51
+ };
52
+ readonly pageLabel: {
53
+ readonly type: "string";
54
+ readonly default: "Page {page}";
55
+ readonly description: "Page button label template; {page} is replaced with the localized number.";
56
+ };
57
+ readonly summaryLabel: {
58
+ readonly type: "string";
59
+ readonly default: "Page {page} of {total}";
60
+ readonly description: "Compact summary template with {page} and {total} placeholders.";
61
+ };
62
+ readonly locale: {
63
+ readonly type: "string";
64
+ readonly description: "Locale for formatted page numbers.";
65
+ };
66
+ readonly direction: {
67
+ readonly type: "enum";
68
+ readonly values: readonly ["ltr", "rtl"];
69
+ readonly default: "ltr";
70
+ readonly description: "Layout and directional icon direction.";
71
+ };
72
+ readonly presentation: {
73
+ readonly type: "enum";
74
+ readonly values: readonly ["numbered", "compact"];
75
+ readonly default: "numbered";
76
+ readonly reflect: true;
77
+ readonly description: "Show up to seven fixed-width numbered positions or a compact summary.";
78
+ };
79
+ readonly variant: {
80
+ readonly type: "enum";
81
+ readonly values: readonly ["solid", "soft", "outline"];
82
+ readonly default: "solid";
83
+ readonly reflect: true;
84
+ readonly description: "Selected page emphasis.";
85
+ };
86
+ readonly size: {
87
+ readonly type: "enum";
88
+ readonly values: readonly ["sm", "md", "lg"];
89
+ readonly default: "md";
90
+ readonly reflect: true;
91
+ readonly description: "Control size.";
92
+ };
93
+ readonly showFirstLast: {
94
+ readonly type: "boolean";
95
+ readonly default: false;
96
+ readonly description: "Show first and last page controls.";
97
+ };
98
+ readonly disabled: {
99
+ readonly type: "boolean";
100
+ readonly default: false;
101
+ readonly reflect: true;
102
+ readonly description: "Disable all controls.";
103
+ };
104
+ };
105
+ readonly events: {
106
+ readonly change: {
107
+ readonly description: "Proposes a different page after enabled user activation.";
108
+ readonly detail: "PaginationChangeDetail";
109
+ readonly names: {
110
+ readonly dom: "cosm-change";
111
+ readonly react: "onChange";
112
+ readonly angular: "pageChange";
113
+ readonly native: "onPageChange";
114
+ };
115
+ };
116
+ };
117
+ readonly states: readonly [{
118
+ readonly prop: "page";
119
+ readonly event: "change";
120
+ readonly defaultProp: "defaultPage";
121
+ }];
122
+ readonly slots: {};
123
+ readonly parts: {
124
+ readonly base: "Navigation landmark.";
125
+ readonly control: "Navigation control.";
126
+ readonly page: "Page control.";
127
+ readonly current: "Current page control.";
128
+ readonly ellipsis: "Decorative omitted-page indicator.";
129
+ readonly summary: "Compact summary.";
130
+ };
131
+ readonly cssProperties: {
132
+ readonly '--cosm-pagination-gap': "Gap between controls.";
133
+ readonly '--cosm-pagination-min-height': "Minimum control height.";
134
+ readonly '--cosm-pagination-radius': "Control corner radius.";
135
+ readonly '--cosm-pagination-current-background': "Current page background.";
136
+ readonly '--cosm-pagination-current-color': "Current page foreground.";
137
+ readonly '--cosm-pagination-current-border': "Current page border color.";
138
+ };
139
+ readonly keyboard: readonly [{
140
+ readonly keys: readonly ["Tab", "Shift+Tab"];
141
+ readonly action: "Moves between enabled controls.";
142
+ }, {
143
+ readonly keys: readonly ["Enter", "Space"];
144
+ readonly action: "Activates the focused control.";
145
+ }];
146
+ };
147
+ //# sourceMappingURL=pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/specs/pagination.ts"],"names":[],"mappings":"AAEA,+BAA+B;AAC/B,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuH7B,CAAC"}