@joralvmel/cosmos-core 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalog.d.ts +3 -3
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +15 -3
- package/dist/catalog.js.map +1 -1
- package/dist/codegen.d.ts +10 -0
- package/dist/codegen.d.ts.map +1 -1
- package/dist/codegen.js +259 -29
- package/dist/codegen.js.map +1 -1
- package/dist/contract.d.ts +33 -4
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +2 -2
- package/dist/contract.js.map +1 -1
- package/dist/headless/listbox.d.ts +9 -0
- package/dist/headless/listbox.d.ts.map +1 -0
- package/dist/headless/listbox.js +107 -0
- package/dist/headless/listbox.js.map +1 -0
- package/dist/headless/text-field.d.ts +25 -0
- package/dist/headless/text-field.d.ts.map +1 -0
- package/dist/headless/text-field.js +12 -0
- package/dist/headless/text-field.js.map +1 -0
- package/dist/index.d.ts +702 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -1
- package/dist/index.js.map +1 -1
- package/dist/markdown.d.ts.map +1 -1
- package/dist/markdown.js +24 -5
- package/dist/markdown.js.map +1 -1
- package/dist/specs/icon-button.d.ts +136 -0
- package/dist/specs/icon-button.d.ts.map +1 -0
- package/dist/specs/icon-button.js +119 -0
- package/dist/specs/icon-button.js.map +1 -0
- package/dist/specs/icon-button.scenarios.d.ts +28 -0
- package/dist/specs/icon-button.scenarios.d.ts.map +1 -0
- package/dist/specs/icon-button.scenarios.js +95 -0
- package/dist/specs/icon-button.scenarios.js.map +1 -0
- package/dist/specs/icon.d.ts +66 -0
- package/dist/specs/icon.d.ts.map +1 -0
- package/dist/specs/icon.js +58 -0
- package/dist/specs/icon.js.map +1 -0
- package/dist/specs/icon.scenarios.d.ts +19 -0
- package/dist/specs/icon.scenarios.d.ts.map +1 -0
- package/dist/specs/icon.scenarios.js +25 -0
- package/dist/specs/icon.scenarios.js.map +1 -0
- package/dist/specs/listbox.d.ts +162 -0
- package/dist/specs/listbox.d.ts.map +1 -0
- package/dist/specs/listbox.js +144 -0
- package/dist/specs/listbox.js.map +1 -0
- package/dist/specs/listbox.scenarios.d.ts +37 -0
- package/dist/specs/listbox.scenarios.d.ts.map +1 -0
- package/dist/specs/listbox.scenarios.js +110 -0
- package/dist/specs/listbox.scenarios.js.map +1 -0
- package/dist/specs/popover.d.ts +213 -0
- package/dist/specs/popover.d.ts.map +1 -0
- package/dist/specs/popover.js +181 -0
- package/dist/specs/popover.js.map +1 -0
- package/dist/specs/popover.scenarios.d.ts +77 -0
- package/dist/specs/popover.scenarios.d.ts.map +1 -0
- package/dist/specs/popover.scenarios.js +368 -0
- package/dist/specs/popover.scenarios.js.map +1 -0
- package/dist/specs/text-field.d.ts +246 -0
- package/dist/specs/text-field.d.ts.map +1 -0
- package/dist/specs/text-field.js +229 -0
- package/dist/specs/text-field.js.map +1 -0
- package/dist/specs/text-field.scenarios.d.ts +49 -0
- package/dist/specs/text-field.scenarios.d.ts.map +1 -0
- package/dist/specs/text-field.scenarios.js +88 -0
- package/dist/specs/text-field.scenarios.js.map +1 -0
- package/llms.md +292 -0
- package/package.json +1 -1
package/llms.md
CHANGED
|
@@ -65,6 +65,298 @@ Triggers an action or submits a form.
|
|
|
65
65
|
| --- | --- |
|
|
66
66
|
| `Enter`, `Space` | Activates the button. |
|
|
67
67
|
|
|
68
|
+
### `icon` (`<cosm-icon>`)
|
|
69
|
+
|
|
70
|
+
Renders a structured SVG icon. Decorative icons are hidden from assistive technology; informative icons require a text label.
|
|
71
|
+
|
|
72
|
+
| Prop | Type | Default | Description |
|
|
73
|
+
| --- | --- | --- | --- |
|
|
74
|
+
| `icon` | IconDefinition | Required | Structured icon definition, commonly imported from @joralvmel/cosmos-icons. |
|
|
75
|
+
| `size` | 'sm' \| 'md' \| 'lg' \| number | `md` | Semantic size (16, 20 or 24) or a positive finite number in pixels / native units. |
|
|
76
|
+
| `stroke` | string | `currentColor` | Stroke paint; currentColor inherits on web and resolves to the theme foreground on native. |
|
|
77
|
+
| `fill` | string | `none` | Root fill paint. Explicit node fills take precedence. |
|
|
78
|
+
| `strokeWidth` | number | `2` | Finite nonnegative stroke width in SVG viewBox units. |
|
|
79
|
+
| `label` | string | — | Accessible name required when decorative is false. |
|
|
80
|
+
| `decorative` | boolean | `true` | Hides the icon from assistive technology when true. |
|
|
81
|
+
|
|
82
|
+
**Events**
|
|
83
|
+
|
|
84
|
+
No events.
|
|
85
|
+
|
|
86
|
+
**CSS parts**
|
|
87
|
+
|
|
88
|
+
| Name | Description |
|
|
89
|
+
| --- | --- |
|
|
90
|
+
| `icon` | Rendered SVG image. |
|
|
91
|
+
|
|
92
|
+
**CSS custom properties**
|
|
93
|
+
|
|
94
|
+
| Name | Description |
|
|
95
|
+
| --- | --- |
|
|
96
|
+
| `--cosm-icon-size` | Override the rendered icon width and height. |
|
|
97
|
+
|
|
98
|
+
### `text-field` (`<cosm-text-field>`)
|
|
99
|
+
|
|
100
|
+
Accepts a single line of text with an accessible label, optional help and error text, and native form validation on the web.
|
|
101
|
+
|
|
102
|
+
| Prop | Type | Default | Description |
|
|
103
|
+
| --- | --- | --- | --- |
|
|
104
|
+
| `label` | string | Required | Accessible name for the editable control. It is rendered above the control unless visually hidden. |
|
|
105
|
+
| `labelHidden` | boolean | `false` | Visually hides the label while keeping it available to assistive technology. |
|
|
106
|
+
| `value` | string | — | Current text. When bound, edits are proposals and the component waits for the owner to supply the accepted value. |
|
|
107
|
+
| `defaultValue` | string | `` | Initial value for autonomous use. Web form reset restores this value; it does not control subsequent edits. |
|
|
108
|
+
| `type` | 'text' \| 'email' \| 'password' \| 'tel' \| 'url' \| 'search' | `text` | Single-line input type. Native maps it to supported keyboard, autofill and secure-entry behavior. |
|
|
109
|
+
| `variant` | 'outlined' \| 'filled' | `outlined` | Visual treatment of the editable control. |
|
|
110
|
+
| `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. |
|
|
111
|
+
| `placeholder` | string | — | Short input hint; it never replaces the accessible label. |
|
|
112
|
+
| `helpText` | string | — | Optional supporting text associated with the editable control. |
|
|
113
|
+
| `error` | string | — | Optional externally supplied error text associated with the editable control. |
|
|
114
|
+
| `invalid` | boolean | `false` | External invalid state, independent of browser constraints or consumer business validation. |
|
|
115
|
+
| `required` | boolean | `false` | Exposes required semantics. On web, participates in native HTML constraint validation. |
|
|
116
|
+
| `disabled` | boolean | `false` | Disables editing and interaction. On web, follows disabled fieldsets and excludes the value from form submission. |
|
|
117
|
+
| `readOnly` | boolean | `false` | Prevents editing while remaining focusable and form-submittable on web; distinct from disabled. |
|
|
118
|
+
| `minLength` | number | — | Minimum number of characters. Web uses native HTML validity; native business validation remains the consumer’s responsibility. |
|
|
119
|
+
| `maxLength` | number | — | Maximum number of characters. Web uses native HTML validity and native applies supported input limits. |
|
|
120
|
+
| `pattern` | string | — | Web-only HTML pattern constraint. Native does not emulate HTML regular-expression validation. |
|
|
121
|
+
| `name` | string | — | Form field name on web. React Native has no HTML form association or name-based submission. |
|
|
122
|
+
| `autoComplete` | string | — | Consumer-provided completion/autofill hint, mapped to attributes supported by each platform. |
|
|
123
|
+
| `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. |
|
|
124
|
+
| `startIcon` | IconDefinition | — | Optional structured decorative icon before the editable text. |
|
|
125
|
+
| `endIcon` | IconDefinition | — | Optional structured decorative icon after the editable text. |
|
|
126
|
+
| `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. |
|
|
127
|
+
| `prefix` | string | — | Optional non-interactive text decoration before the editable text. |
|
|
128
|
+
| `suffix` | string | — | Optional non-interactive text decoration after the editable text. |
|
|
129
|
+
| `clearable` | boolean | `false` | Shows a clear action for non-empty editable fields. Supply clearLabel when enabled. |
|
|
130
|
+
| `clearLabel` | string | — | Consumer-supplied localized accessible name for the clear action. |
|
|
131
|
+
| `passwordReveal` | boolean | `false` | Opts into a reveal action for password fields. Supply both revealPasswordLabel and hidePasswordLabel when enabled. |
|
|
132
|
+
| `revealPasswordLabel` | string | — | Consumer-supplied localized accessible name while the password is concealed. |
|
|
133
|
+
| `hidePasswordLabel` | string | — | Consumer-supplied localized accessible name while the password is revealed. |
|
|
134
|
+
|
|
135
|
+
**Events**
|
|
136
|
+
|
|
137
|
+
| DOM | React | Angular | React Native | Detail | Description |
|
|
138
|
+
| --- | --- | --- | --- | --- | --- |
|
|
139
|
+
| `cosm-change` | `onChange` | `(valueChange)` | `onValueChange` | `TextFieldChangeDetail` | Proposes the current text after each user edit, including clear; this is not a blur/commit event. |
|
|
140
|
+
| `cosm-submit` | `onSubmit` | `(submit)` | `onSubmitEditing` | `TextFieldSubmitDetail` | Reports the current text when the user invokes the field submit action (Enter/return). |
|
|
141
|
+
|
|
142
|
+
**CSS parts**
|
|
143
|
+
|
|
144
|
+
| Name | Description |
|
|
145
|
+
| --- | --- |
|
|
146
|
+
| `label` | Accessible label above the control. |
|
|
147
|
+
| `control` | Visual control containing the editable input and decorations. |
|
|
148
|
+
| `input` | The single-line editable input. |
|
|
149
|
+
| `start` | Start icon or prefix decoration. |
|
|
150
|
+
| `end` | End icon, suffix decoration or clear/reveal action. |
|
|
151
|
+
| `help` | Supporting text associated with the editable input. |
|
|
152
|
+
| `error` | External or native-validity error text associated with the editable input. |
|
|
153
|
+
| `clear-button` | Optional accessible clear action. |
|
|
154
|
+
| `reveal-button` | Optional accessible password visibility action. |
|
|
155
|
+
|
|
156
|
+
**CSS custom properties**
|
|
157
|
+
|
|
158
|
+
| Name | Description |
|
|
159
|
+
| --- | --- |
|
|
160
|
+
| `--cosm-text-field-background` | Editable control background. |
|
|
161
|
+
| `--cosm-text-field-color` | Editable and decoration text color. |
|
|
162
|
+
| `--cosm-text-field-placeholder` | Placeholder text color. |
|
|
163
|
+
| `--cosm-text-field-border` | Editable control boundary color. |
|
|
164
|
+
| `--cosm-text-field-focus` | Visible focus indicator color. |
|
|
165
|
+
| `--cosm-text-field-radius` | Editable control corner radius. |
|
|
166
|
+
| `--cosm-text-field-start-icon-color` | Start icon color, independent of text and affixes. |
|
|
167
|
+
| `--cosm-text-field-start-icon-focus-color` | Start icon color within iconFocusScope; falls back to its normal color. |
|
|
168
|
+
| `--cosm-text-field-end-icon-color` | End icon color, independent of text and affixes. |
|
|
169
|
+
| `--cosm-text-field-end-icon-focus-color` | End icon color within iconFocusScope; falls back to its normal color. |
|
|
170
|
+
|
|
171
|
+
**Keyboard**
|
|
172
|
+
|
|
173
|
+
| Keys | Action |
|
|
174
|
+
| --- | --- |
|
|
175
|
+
| `Tab`, `Shift+Tab` | Moves focus to or from the enabled editable control. |
|
|
176
|
+
| `Enter` | Invokes the submit action; web form behavior remains native. |
|
|
177
|
+
|
|
178
|
+
### `icon-button` (`<cosm-icon-button>`)
|
|
179
|
+
|
|
180
|
+
Activates an action or toggles a boolean state using a labeled icon.
|
|
181
|
+
|
|
182
|
+
| Prop | Type | Default | Description |
|
|
183
|
+
| --- | --- | --- | --- |
|
|
184
|
+
| `label` | string | Required | Required localized accessible name. Missing, empty or whitespace-only labels are rejected. |
|
|
185
|
+
| `mode` | 'action' \| 'toggle' | `action` | Action activates without toggle state; toggle exposes and changes pressed state. |
|
|
186
|
+
| `variant` | 'solid' \| 'soft' \| 'outline' \| 'ghost' | `solid` | Visual emphasis, from highest (solid) to lowest (ghost). |
|
|
187
|
+
| `tone` | 'primary' \| 'neutral' \| 'danger' | `primary` | Color role. Use danger for destructive actions. |
|
|
188
|
+
| `size` | 'sm' \| 'md' \| 'lg' | `md` | Size of the square visual control. |
|
|
189
|
+
| `disabled` | boolean | `false` | Prevents activation and removes the web button from the tab order. |
|
|
190
|
+
| `type` | 'button' \| 'submit' \| 'reset' | `button` | Native web button form behavior. |
|
|
191
|
+
| `pressed` | boolean | `false` | Toggle state. If supplied, including false, activation proposes changes without committing them until the owner updates this prop. |
|
|
192
|
+
| `defaultPressed` | boolean | `false` | Initial toggle state when pressed is not supplied; it does not control later changes. |
|
|
193
|
+
|
|
194
|
+
**Events**
|
|
195
|
+
|
|
196
|
+
| DOM | React | Angular | React Native | Detail | Description |
|
|
197
|
+
| --- | --- | --- | --- | --- | --- |
|
|
198
|
+
| `cosm-press` | `onPress` | `(press)` | `onPress` | `IconButtonPressDetail` | Reports each enabled activation by pointer, keyboard or programmatically. |
|
|
199
|
+
| `cosm-pressed-change` | `onPressedChange` | `(pressedChange)` | `onPressedChange` | `IconButtonPressedChangeDetail` | Reports the proposed next pressed state on toggle activation; controlled state waits for the owner. |
|
|
200
|
+
|
|
201
|
+
**Slots**
|
|
202
|
+
|
|
203
|
+
| Name | Description |
|
|
204
|
+
| --- | --- |
|
|
205
|
+
| `(default)` | Decorative icon content; the label supplies the accessible name. |
|
|
206
|
+
|
|
207
|
+
**CSS parts**
|
|
208
|
+
|
|
209
|
+
| Name | Description |
|
|
210
|
+
| --- | --- |
|
|
211
|
+
| `base` | The native button element. |
|
|
212
|
+
|
|
213
|
+
**CSS custom properties**
|
|
214
|
+
|
|
215
|
+
| Name | Description |
|
|
216
|
+
| --- | --- |
|
|
217
|
+
| `--cosm-icon-button-background` | Control background. |
|
|
218
|
+
| `--cosm-icon-button-color` | Icon foreground color. |
|
|
219
|
+
| `--cosm-icon-button-border` | Control border color. |
|
|
220
|
+
| `--cosm-icon-button-radius` | Control corner radius. |
|
|
221
|
+
| `--cosm-icon-button-focus` | Visible focus indicator color. |
|
|
222
|
+
|
|
223
|
+
**Keyboard**
|
|
224
|
+
|
|
225
|
+
| Keys | Action |
|
|
226
|
+
| --- | --- |
|
|
227
|
+
| `Tab`, `Shift+Tab` | Moves focus to or from the enabled button. |
|
|
228
|
+
| `Enter`, `Space` | Activates the button; toggle mode also proposes a change. |
|
|
229
|
+
|
|
230
|
+
### `popover` (`<cosm-popover>`)
|
|
231
|
+
|
|
232
|
+
Non-modal content anchored to a consumer trigger, with cancelable close requests and no imposed panel semantics.
|
|
233
|
+
|
|
234
|
+
| Prop | Type | Default | Description |
|
|
235
|
+
| --- | --- | --- | --- |
|
|
236
|
+
| `open` | boolean | `false` | Committed visibility. Supplying this prop, including false, controls state; its metadata default does not establish a binding. |
|
|
237
|
+
| `defaultOpen` | boolean | `false` | Initial autonomous visibility only; ignored when open is supplied. Later updates do not reset state. |
|
|
238
|
+
| `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. |
|
|
239
|
+
| `closable` | boolean | `false` | Shows a built-in IconButton with an X. Requests a cancelable close with reason close-button. |
|
|
240
|
+
| `closeLabel` | string | `Close` | Localized accessible name of the close button. Must be non-empty when closable is true. |
|
|
241
|
+
| `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. |
|
|
242
|
+
| `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. |
|
|
243
|
+
| `closeOnEscape` | boolean | `true` | Requests closure on unhandled Escape on web and React Native Web. Native Android and iOS hardware Escape is not supported. |
|
|
244
|
+
| `closeOnOutsidePress` | boolean | `true` | Requests closure on an outside press without preventing its interaction or restoring trigger focus. |
|
|
245
|
+
| `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. |
|
|
246
|
+
| `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. |
|
|
247
|
+
| `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. |
|
|
248
|
+
| `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. |
|
|
249
|
+
| `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. |
|
|
250
|
+
| `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. |
|
|
251
|
+
|
|
252
|
+
**Events**
|
|
253
|
+
|
|
254
|
+
| DOM | React | Angular | React Native | Detail | Description |
|
|
255
|
+
| --- | --- | --- | --- | --- | --- |
|
|
256
|
+
| `cosm-open-change` | `onOpenChange` | `(openChange)` | `onOpenChange` | `PopoverOpenChangeDetail` | Proposes visibility changes by trigger, hover or focus, or closure by Escape, outside press, panel action, close button or Android Back. Closing only is cancelable, synchronously via the web event or detail.preventDefault(); native uses detail.preventDefault(). Not a committed-state notification. (cancelable) |
|
|
257
|
+
|
|
258
|
+
**Slots**
|
|
259
|
+
|
|
260
|
+
| Name | Description |
|
|
261
|
+
| --- | --- |
|
|
262
|
+
| `trigger` | Consumer-supplied accessible trigger; its appearance and label belong to the consumer. Native accepts content or a render function receiving onPress, ref and accessibilityState for composing an IconButton without nested buttons. |
|
|
263
|
+
| `(default)` | Consumer-supplied panel content and semantics. Native maps this content to children. |
|
|
264
|
+
|
|
265
|
+
**CSS parts**
|
|
266
|
+
|
|
267
|
+
| Name | Description |
|
|
268
|
+
| --- | --- |
|
|
269
|
+
| `trigger` | Trigger container. |
|
|
270
|
+
| `panel` | Non-modal anchored surface. |
|
|
271
|
+
| `body` | Scrollable consumer content. |
|
|
272
|
+
| `close` | Optional close IconButton. |
|
|
273
|
+
| `arrow` | Decorative pointer; follows panel colors. |
|
|
274
|
+
|
|
275
|
+
**CSS custom properties**
|
|
276
|
+
|
|
277
|
+
| Name | Description |
|
|
278
|
+
| --- | --- |
|
|
279
|
+
| `--cosm-popover-z-index` | Panel stacking level. |
|
|
280
|
+
| `--cosm-popover-padding` | Panel padding. |
|
|
281
|
+
| `--cosm-popover-radius` | Panel corner radius. |
|
|
282
|
+
| `--cosm-popover-shadow` | Panel shadow. |
|
|
283
|
+
|
|
284
|
+
**Keyboard**
|
|
285
|
+
|
|
286
|
+
| Keys | Action |
|
|
287
|
+
| --- | --- |
|
|
288
|
+
| `Enter`, `Space` | The focused trigger activates once and toggles open. |
|
|
289
|
+
| `Escape` | On web and React Native Web, requests close when open and closeOnEscape is true, unless a child already handled the key. |
|
|
290
|
+
| `Tab`, `Shift+Tab` | Moves focus normally without a focus trap or automatic dismissal. |
|
|
291
|
+
| `Android Back` | Requests close while open on Android only. |
|
|
292
|
+
|
|
293
|
+
### `listbox` (`<cosm-listbox>`)
|
|
294
|
+
|
|
295
|
+
Selects one or more values from a named vertical collection, with groups, descriptions, icons and independent keyboard focus.
|
|
296
|
+
|
|
297
|
+
| Prop | Type | Default | Description |
|
|
298
|
+
| --- | --- | --- | --- |
|
|
299
|
+
| `label` | string | Required | Required nonempty accessible label, visible unless labelHidden is true. |
|
|
300
|
+
| `labelHidden` | boolean | `false` | Visually hides the label without removing its accessible name. |
|
|
301
|
+
| `items` | ListboxItems | Required | 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. |
|
|
302
|
+
| `selectionMode` | 'single' \| 'multiple' | `single` | Single permits at most one selected value; multiple toggles each activation. |
|
|
303
|
+
| `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. |
|
|
304
|
+
| `defaultSelectedValues` | ListboxValues | — | Initial autonomous selected values (empty by default). Later changes do not reset selection. |
|
|
305
|
+
| `variant` | 'plain' \| 'outlined' | `plain` | Plain composes inside a panel; outlined adds a standalone container boundary. |
|
|
306
|
+
| `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. |
|
|
307
|
+
| `disabled` | boolean | `false` | Prevents interaction and removes the list from keyboard navigation. |
|
|
308
|
+
| `readOnly` | boolean | `false` | Allows exploring options without proposing or committing selection changes. |
|
|
309
|
+
| `locale` | string | — | BCP 47 locale for typeahead. Web inherits the nearest language; native uses the runtime locale when omitted. Invalid locale identifiers are rejected. |
|
|
310
|
+
|
|
311
|
+
**Events**
|
|
312
|
+
|
|
313
|
+
| DOM | React | Angular | React Native | Detail | Description |
|
|
314
|
+
| --- | --- | --- | --- | --- | --- |
|
|
315
|
+
| `cosm-selection-change` | `onSelectionChange` | `(selectionChange)` | `onSelectionChange` | `ListboxSelectionChangeDetail` | Proposes the next selectedValues for an enabled activation. Autonomous selection commits; controlled selection waits for the owner. Arrows and typeahead never select. |
|
|
316
|
+
|
|
317
|
+
**CSS parts**
|
|
318
|
+
|
|
319
|
+
| Name | Description |
|
|
320
|
+
| --- | --- |
|
|
321
|
+
| `base` | Outer container. |
|
|
322
|
+
| `label` | Visible or visually hidden accessible label. |
|
|
323
|
+
| `list` | Scrollable listbox. |
|
|
324
|
+
| `group` | Named option group. |
|
|
325
|
+
| `group-label` | Noninteractive group heading. |
|
|
326
|
+
| `option` | Selectable row; selected, disabled and active states are exposed on the row. |
|
|
327
|
+
| `icon` | Decorative option icon. |
|
|
328
|
+
| `content` | Text content wrapper. |
|
|
329
|
+
| `option-label` | Primary option text. |
|
|
330
|
+
| `description` | Optional supporting text. |
|
|
331
|
+
| `indicator` | Decorative selected-state indicator. |
|
|
332
|
+
|
|
333
|
+
**CSS custom properties**
|
|
334
|
+
|
|
335
|
+
| Name | Description |
|
|
336
|
+
| --- | --- |
|
|
337
|
+
| `--cosm-listbox-background` | Container background. |
|
|
338
|
+
| `--cosm-listbox-color` | Primary foreground. |
|
|
339
|
+
| `--cosm-listbox-border` | Outlined container border color. |
|
|
340
|
+
| `--cosm-listbox-radius` | Container and option corner radius. |
|
|
341
|
+
| `--cosm-listbox-option-height` | Minimum option height. |
|
|
342
|
+
| `--cosm-listbox-option-padding` | Option padding. |
|
|
343
|
+
| `--cosm-listbox-gap` | Space between icon, content and selection indicator. |
|
|
344
|
+
| `--cosm-listbox-font-size` | Primary option text size. |
|
|
345
|
+
| `--cosm-listbox-description-color` | Supporting text color. |
|
|
346
|
+
| `--cosm-listbox-selected-background` | Selected option background. |
|
|
347
|
+
| `--cosm-listbox-selected-color` | Selected option foreground. |
|
|
348
|
+
| `--cosm-listbox-focus` | Visible keyboard focus outline color. |
|
|
349
|
+
| `--cosm-listbox-max-height` | Maximum scrollable list height. |
|
|
350
|
+
|
|
351
|
+
**Keyboard**
|
|
352
|
+
|
|
353
|
+
| Keys | Action |
|
|
354
|
+
| --- | --- |
|
|
355
|
+
| `Tab`, `Shift+Tab` | Enters or leaves the list as one Tab stop. |
|
|
356
|
+
| `ArrowDown`, `ArrowUp`, `Home`, `End` | Moves focus among enabled options without changing selection; stops at the ends. |
|
|
357
|
+
| `Enter`, `Space` | Selects the focused option; multiple mode toggles it. Read-only never changes selection. |
|
|
358
|
+
| `Printable characters` | Moves focus to a matching option using locale-aware typeahead without filtering. |
|
|
359
|
+
|
|
68
360
|
|
|
69
361
|
## Rules for AI assistants
|
|
70
362
|
|
package/package.json
CHANGED