@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/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { buildOrder, type CatalogEntry, type ComponentCategory, type ComponentStatus, catalog, catalogEntry, } from './catalog.js';
|
|
2
|
-
export { type ActiveProp, activeProps, type ControlValue, type ControlValues, generateSnippets, pascalCase, type SnippetTarget, snippetTargets, supportsTarget, toAttribute, } from './codegen.js';
|
|
2
|
+
export { type ActiveProp, activeProps, type ControlValue, type ControlValues, generateComposedSnippets, generateSnippets, listboxItemExamples, listboxValueExamples, pascalCase, type SnippetChild, type SnippetTarget, snippetTargets, supportsTarget, toAttribute, } from './codegen.js';
|
|
3
3
|
export { type ComponentContract, type ContractProps, defaults, defineContract, type EventSpec, eventNames, type KeyboardSpec, type Platform, type PropSpec, platforms, propNames, type StateSpec, supports, } from './contract.js';
|
|
4
|
+
export { findListboxMatch, getListboxInitialActive, getListboxOptions, getListboxSelection, moveListboxActive, validateListboxSize, validateListboxValues, } from './headless/listbox.js';
|
|
4
5
|
export { getPressableState, type PressableInput, type PressableState, } from './headless/pressable.js';
|
|
6
|
+
export { getTextFieldState, type TextFieldState, type TextFieldStateInput, } from './headless/text-field.js';
|
|
5
7
|
export { componentReference, contractMarkdown, eventsMarkdown, propsMarkdown, propType, snippetsMarkdown, snippetTitles, } from './markdown.js';
|
|
6
8
|
export { aiRules, DOCS_URL, isStack, type SetupGuide, type SetupStep, type Stack, setupGuide, setupMarkdown, stacks, } from './setup.js';
|
|
7
9
|
export { type ButtonPressDetail, buttonContract, type PressSource } from './specs/button.js';
|
|
@@ -99,5 +101,704 @@ export declare const contracts: {
|
|
|
99
101
|
readonly action: "Activates the button.";
|
|
100
102
|
}];
|
|
101
103
|
};
|
|
104
|
+
readonly icon: {
|
|
105
|
+
readonly name: "icon";
|
|
106
|
+
readonly tag: "cosm-icon";
|
|
107
|
+
readonly description: "Renders a structured SVG icon. Decorative icons are hidden from assistive technology; informative icons require a text label.";
|
|
108
|
+
readonly role: "img";
|
|
109
|
+
readonly pattern: "https://www.w3.org/WAI/WCAG22/Techniques/aria/ARIA24";
|
|
110
|
+
readonly props: {
|
|
111
|
+
readonly icon: {
|
|
112
|
+
readonly type: "reference";
|
|
113
|
+
readonly reference: "IconDefinition";
|
|
114
|
+
readonly required: true;
|
|
115
|
+
readonly options: readonly ["house", "heart", "search", "star"];
|
|
116
|
+
readonly example: "house";
|
|
117
|
+
readonly description: "Structured icon definition, commonly imported from @joralvmel/cosmos-icons.";
|
|
118
|
+
};
|
|
119
|
+
readonly size: {
|
|
120
|
+
readonly type: "union";
|
|
121
|
+
readonly variants: readonly [{
|
|
122
|
+
readonly type: "enum";
|
|
123
|
+
readonly values: readonly ["sm", "md", "lg"];
|
|
124
|
+
}, {
|
|
125
|
+
readonly type: "number";
|
|
126
|
+
}];
|
|
127
|
+
readonly default: "md";
|
|
128
|
+
readonly reflect: true;
|
|
129
|
+
readonly description: "Semantic size (16, 20 or 24) or a positive finite number in pixels / native units.";
|
|
130
|
+
};
|
|
131
|
+
readonly stroke: {
|
|
132
|
+
readonly type: "string";
|
|
133
|
+
readonly default: "currentColor";
|
|
134
|
+
readonly description: "Stroke paint; currentColor inherits on web and resolves to the theme foreground on native.";
|
|
135
|
+
};
|
|
136
|
+
readonly fill: {
|
|
137
|
+
readonly type: "string";
|
|
138
|
+
readonly default: "none";
|
|
139
|
+
readonly description: "Root fill paint. Explicit node fills take precedence.";
|
|
140
|
+
};
|
|
141
|
+
readonly strokeWidth: {
|
|
142
|
+
readonly type: "number";
|
|
143
|
+
readonly default: 2;
|
|
144
|
+
readonly description: "Finite nonnegative stroke width in SVG viewBox units.";
|
|
145
|
+
};
|
|
146
|
+
readonly label: {
|
|
147
|
+
readonly type: "string";
|
|
148
|
+
readonly description: "Accessible name required when decorative is false.";
|
|
149
|
+
};
|
|
150
|
+
readonly decorative: {
|
|
151
|
+
readonly type: "boolean";
|
|
152
|
+
readonly default: true;
|
|
153
|
+
readonly reflect: true;
|
|
154
|
+
readonly description: "Hides the icon from assistive technology when true.";
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
readonly events: {};
|
|
158
|
+
readonly states: readonly [];
|
|
159
|
+
readonly slots: {};
|
|
160
|
+
readonly parts: {
|
|
161
|
+
readonly icon: "Rendered SVG image.";
|
|
162
|
+
};
|
|
163
|
+
readonly cssProperties: {
|
|
164
|
+
readonly '--cosm-icon-size': "Override the rendered icon width and height.";
|
|
165
|
+
};
|
|
166
|
+
readonly keyboard: readonly [];
|
|
167
|
+
};
|
|
168
|
+
readonly 'text-field': {
|
|
169
|
+
readonly name: "text-field";
|
|
170
|
+
readonly tag: "cosm-text-field";
|
|
171
|
+
readonly description: "Accepts a single line of text with an accessible label, optional help and error text, and native form validation on the web.";
|
|
172
|
+
readonly role: "textbox";
|
|
173
|
+
readonly pattern: "https://html.spec.whatwg.org/multipage/input.html";
|
|
174
|
+
readonly props: {
|
|
175
|
+
readonly label: {
|
|
176
|
+
readonly type: "string";
|
|
177
|
+
readonly required: true;
|
|
178
|
+
readonly description: "Accessible name for the editable control. It is rendered above the control unless visually hidden.";
|
|
179
|
+
};
|
|
180
|
+
readonly labelHidden: {
|
|
181
|
+
readonly type: "boolean";
|
|
182
|
+
readonly default: false;
|
|
183
|
+
readonly reflect: true;
|
|
184
|
+
readonly description: "Visually hides the label while keeping it available to assistive technology.";
|
|
185
|
+
};
|
|
186
|
+
readonly value: {
|
|
187
|
+
readonly type: "string";
|
|
188
|
+
readonly description: "Current text. When bound, edits are proposals and the component waits for the owner to supply the accepted value.";
|
|
189
|
+
};
|
|
190
|
+
readonly defaultValue: {
|
|
191
|
+
readonly type: "string";
|
|
192
|
+
readonly default: "";
|
|
193
|
+
readonly description: "Initial value for autonomous use. Web form reset restores this value; it does not control subsequent edits.";
|
|
194
|
+
};
|
|
195
|
+
readonly type: {
|
|
196
|
+
readonly type: "enum";
|
|
197
|
+
readonly values: readonly ["text", "email", "password", "tel", "url", "search"];
|
|
198
|
+
readonly default: "text";
|
|
199
|
+
readonly reflect: true;
|
|
200
|
+
readonly description: "Single-line input type. Native maps it to supported keyboard, autofill and secure-entry behavior.";
|
|
201
|
+
};
|
|
202
|
+
readonly variant: {
|
|
203
|
+
readonly type: "enum";
|
|
204
|
+
readonly values: readonly ["outlined", "filled"];
|
|
205
|
+
readonly default: "outlined";
|
|
206
|
+
readonly reflect: true;
|
|
207
|
+
readonly description: "Visual treatment of the editable control.";
|
|
208
|
+
};
|
|
209
|
+
readonly size: {
|
|
210
|
+
readonly type: "union";
|
|
211
|
+
readonly variants: readonly [{
|
|
212
|
+
readonly type: "enum";
|
|
213
|
+
readonly values: readonly ["sm", "md", "lg"];
|
|
214
|
+
}, {
|
|
215
|
+
readonly type: "number";
|
|
216
|
+
}];
|
|
217
|
+
readonly default: "md";
|
|
218
|
+
readonly reflect: true;
|
|
219
|
+
readonly description: "Semantic size or a positive finite minimum editable-control height in CSS pixels on web and logical units on native.";
|
|
220
|
+
};
|
|
221
|
+
readonly placeholder: {
|
|
222
|
+
readonly type: "string";
|
|
223
|
+
readonly description: "Short input hint; it never replaces the accessible label.";
|
|
224
|
+
};
|
|
225
|
+
readonly helpText: {
|
|
226
|
+
readonly type: "string";
|
|
227
|
+
readonly description: "Optional supporting text associated with the editable control.";
|
|
228
|
+
};
|
|
229
|
+
readonly error: {
|
|
230
|
+
readonly type: "string";
|
|
231
|
+
readonly description: "Optional externally supplied error text associated with the editable control.";
|
|
232
|
+
};
|
|
233
|
+
readonly invalid: {
|
|
234
|
+
readonly type: "boolean";
|
|
235
|
+
readonly default: false;
|
|
236
|
+
readonly reflect: true;
|
|
237
|
+
readonly description: "External invalid state, independent of browser constraints or consumer business validation.";
|
|
238
|
+
};
|
|
239
|
+
readonly required: {
|
|
240
|
+
readonly type: "boolean";
|
|
241
|
+
readonly default: false;
|
|
242
|
+
readonly reflect: true;
|
|
243
|
+
readonly description: "Exposes required semantics. On web, participates in native HTML constraint validation.";
|
|
244
|
+
};
|
|
245
|
+
readonly disabled: {
|
|
246
|
+
readonly type: "boolean";
|
|
247
|
+
readonly default: false;
|
|
248
|
+
readonly reflect: true;
|
|
249
|
+
readonly description: "Disables editing and interaction. On web, follows disabled fieldsets and excludes the value from form submission.";
|
|
250
|
+
};
|
|
251
|
+
readonly readOnly: {
|
|
252
|
+
readonly type: "boolean";
|
|
253
|
+
readonly default: false;
|
|
254
|
+
readonly reflect: true;
|
|
255
|
+
readonly description: "Prevents editing while remaining focusable and form-submittable on web; distinct from disabled.";
|
|
256
|
+
};
|
|
257
|
+
readonly minLength: {
|
|
258
|
+
readonly type: "number";
|
|
259
|
+
readonly description: "Minimum number of characters. Web uses native HTML validity; native business validation remains the consumer’s responsibility.";
|
|
260
|
+
};
|
|
261
|
+
readonly maxLength: {
|
|
262
|
+
readonly type: "number";
|
|
263
|
+
readonly description: "Maximum number of characters. Web uses native HTML validity and native applies supported input limits.";
|
|
264
|
+
};
|
|
265
|
+
readonly pattern: {
|
|
266
|
+
readonly type: "string";
|
|
267
|
+
readonly platforms: readonly ["web", "react", "angular"];
|
|
268
|
+
readonly description: "Web-only HTML pattern constraint. Native does not emulate HTML regular-expression validation.";
|
|
269
|
+
};
|
|
270
|
+
readonly name: {
|
|
271
|
+
readonly type: "string";
|
|
272
|
+
readonly reflect: true;
|
|
273
|
+
readonly platforms: readonly ["web", "react", "angular"];
|
|
274
|
+
readonly description: "Form field name on web. React Native has no HTML form association or name-based submission.";
|
|
275
|
+
};
|
|
276
|
+
readonly autoComplete: {
|
|
277
|
+
readonly type: "string";
|
|
278
|
+
readonly description: "Consumer-provided completion/autofill hint, mapped to attributes supported by each platform.";
|
|
279
|
+
};
|
|
280
|
+
readonly inputMode: {
|
|
281
|
+
readonly type: "union";
|
|
282
|
+
readonly variants: readonly [{
|
|
283
|
+
readonly type: "enum";
|
|
284
|
+
readonly values: readonly ["none", "text", "decimal", "numeric", "tel", "search", "email", "url"];
|
|
285
|
+
}];
|
|
286
|
+
readonly description: "Input or keyboard hint (none, text, decimal, numeric, tel, search, email or url); it does not add numeric or multiline field behavior.";
|
|
287
|
+
};
|
|
288
|
+
readonly startIcon: {
|
|
289
|
+
readonly type: "reference";
|
|
290
|
+
readonly reference: "IconDefinition";
|
|
291
|
+
readonly options: readonly ["search", "house", "heart", "star"];
|
|
292
|
+
readonly example: "search";
|
|
293
|
+
readonly description: "Optional structured decorative icon before the editable text.";
|
|
294
|
+
};
|
|
295
|
+
readonly endIcon: {
|
|
296
|
+
readonly type: "reference";
|
|
297
|
+
readonly reference: "IconDefinition";
|
|
298
|
+
readonly options: readonly ["search", "house", "heart", "star"];
|
|
299
|
+
readonly example: "search";
|
|
300
|
+
readonly description: "Optional structured decorative icon after the editable text.";
|
|
301
|
+
};
|
|
302
|
+
readonly iconFocusScope: {
|
|
303
|
+
readonly type: "enum";
|
|
304
|
+
readonly values: readonly ["control", "input"];
|
|
305
|
+
readonly default: "control";
|
|
306
|
+
readonly reflect: true;
|
|
307
|
+
readonly description: "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.";
|
|
308
|
+
};
|
|
309
|
+
readonly prefix: {
|
|
310
|
+
readonly type: "string";
|
|
311
|
+
readonly description: "Optional non-interactive text decoration before the editable text.";
|
|
312
|
+
};
|
|
313
|
+
readonly suffix: {
|
|
314
|
+
readonly type: "string";
|
|
315
|
+
readonly description: "Optional non-interactive text decoration after the editable text.";
|
|
316
|
+
};
|
|
317
|
+
readonly clearable: {
|
|
318
|
+
readonly type: "boolean";
|
|
319
|
+
readonly default: false;
|
|
320
|
+
readonly reflect: true;
|
|
321
|
+
readonly description: "Shows a clear action for non-empty editable fields. Supply clearLabel when enabled.";
|
|
322
|
+
};
|
|
323
|
+
readonly clearLabel: {
|
|
324
|
+
readonly type: "string";
|
|
325
|
+
readonly description: "Consumer-supplied localized accessible name for the clear action.";
|
|
326
|
+
};
|
|
327
|
+
readonly passwordReveal: {
|
|
328
|
+
readonly type: "boolean";
|
|
329
|
+
readonly default: false;
|
|
330
|
+
readonly reflect: true;
|
|
331
|
+
readonly description: "Opts into a reveal action for password fields. Supply both revealPasswordLabel and hidePasswordLabel when enabled.";
|
|
332
|
+
};
|
|
333
|
+
readonly revealPasswordLabel: {
|
|
334
|
+
readonly type: "string";
|
|
335
|
+
readonly description: "Consumer-supplied localized accessible name while the password is concealed.";
|
|
336
|
+
};
|
|
337
|
+
readonly hidePasswordLabel: {
|
|
338
|
+
readonly type: "string";
|
|
339
|
+
readonly description: "Consumer-supplied localized accessible name while the password is revealed.";
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
readonly events: {
|
|
343
|
+
readonly change: {
|
|
344
|
+
readonly description: "Proposes the current text after each user edit, including clear; this is not a blur/commit event.";
|
|
345
|
+
readonly detail: "TextFieldChangeDetail";
|
|
346
|
+
readonly names: {
|
|
347
|
+
readonly dom: "cosm-change";
|
|
348
|
+
readonly react: "onChange";
|
|
349
|
+
readonly angular: "valueChange";
|
|
350
|
+
readonly native: "onValueChange";
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
readonly submit: {
|
|
354
|
+
readonly description: "Reports the current text when the user invokes the field submit action (Enter/return).";
|
|
355
|
+
readonly detail: "TextFieldSubmitDetail";
|
|
356
|
+
readonly names: {
|
|
357
|
+
readonly dom: "cosm-submit";
|
|
358
|
+
readonly react: "onSubmit";
|
|
359
|
+
readonly angular: "submit";
|
|
360
|
+
readonly native: "onSubmitEditing";
|
|
361
|
+
};
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
readonly states: readonly [{
|
|
365
|
+
readonly prop: "value";
|
|
366
|
+
readonly event: "change";
|
|
367
|
+
readonly defaultProp: "defaultValue";
|
|
368
|
+
}];
|
|
369
|
+
readonly slots: {};
|
|
370
|
+
readonly parts: {
|
|
371
|
+
readonly label: "Accessible label above the control.";
|
|
372
|
+
readonly control: "Visual control containing the editable input and decorations.";
|
|
373
|
+
readonly input: "The single-line editable input.";
|
|
374
|
+
readonly start: "Start icon or prefix decoration.";
|
|
375
|
+
readonly end: "End icon, suffix decoration or clear/reveal action.";
|
|
376
|
+
readonly help: "Supporting text associated with the editable input.";
|
|
377
|
+
readonly error: "External or native-validity error text associated with the editable input.";
|
|
378
|
+
readonly 'clear-button': "Optional accessible clear action.";
|
|
379
|
+
readonly 'reveal-button': "Optional accessible password visibility action.";
|
|
380
|
+
};
|
|
381
|
+
readonly cssProperties: {
|
|
382
|
+
readonly '--cosm-text-field-background': "Editable control background.";
|
|
383
|
+
readonly '--cosm-text-field-color': "Editable and decoration text color.";
|
|
384
|
+
readonly '--cosm-text-field-placeholder': "Placeholder text color.";
|
|
385
|
+
readonly '--cosm-text-field-border': "Editable control boundary color.";
|
|
386
|
+
readonly '--cosm-text-field-focus': "Visible focus indicator color.";
|
|
387
|
+
readonly '--cosm-text-field-radius': "Editable control corner radius.";
|
|
388
|
+
readonly '--cosm-text-field-start-icon-color': "Start icon color, independent of text and affixes.";
|
|
389
|
+
readonly '--cosm-text-field-start-icon-focus-color': "Start icon color within iconFocusScope; falls back to its normal color.";
|
|
390
|
+
readonly '--cosm-text-field-end-icon-color': "End icon color, independent of text and affixes.";
|
|
391
|
+
readonly '--cosm-text-field-end-icon-focus-color': "End icon color within iconFocusScope; falls back to its normal color.";
|
|
392
|
+
};
|
|
393
|
+
readonly keyboard: readonly [{
|
|
394
|
+
readonly keys: readonly ["Tab", "Shift+Tab"];
|
|
395
|
+
readonly action: "Moves focus to or from the enabled editable control.";
|
|
396
|
+
}, {
|
|
397
|
+
readonly keys: readonly ["Enter"];
|
|
398
|
+
readonly action: "Invokes the submit action; web form behavior remains native.";
|
|
399
|
+
}];
|
|
400
|
+
};
|
|
401
|
+
readonly 'icon-button': {
|
|
402
|
+
readonly name: "icon-button";
|
|
403
|
+
readonly tag: "cosm-icon-button";
|
|
404
|
+
readonly description: "Activates an action or toggles a boolean state using a labeled icon.";
|
|
405
|
+
readonly role: "button";
|
|
406
|
+
readonly pattern: "https://www.w3.org/WAI/ARIA/apg/patterns/button/";
|
|
407
|
+
readonly props: {
|
|
408
|
+
readonly label: {
|
|
409
|
+
readonly type: "string";
|
|
410
|
+
readonly required: true;
|
|
411
|
+
readonly description: "Required localized accessible name. Missing, empty or whitespace-only labels are rejected.";
|
|
412
|
+
};
|
|
413
|
+
readonly mode: {
|
|
414
|
+
readonly type: "enum";
|
|
415
|
+
readonly values: readonly ["action", "toggle"];
|
|
416
|
+
readonly default: "action";
|
|
417
|
+
readonly reflect: true;
|
|
418
|
+
readonly description: "Action activates without toggle state; toggle exposes and changes pressed state.";
|
|
419
|
+
};
|
|
420
|
+
readonly variant: {
|
|
421
|
+
readonly type: "enum";
|
|
422
|
+
readonly values: readonly ["solid", "soft", "outline", "ghost"];
|
|
423
|
+
readonly default: "solid";
|
|
424
|
+
readonly reflect: true;
|
|
425
|
+
readonly description: "Visual emphasis, from highest (solid) to lowest (ghost).";
|
|
426
|
+
};
|
|
427
|
+
readonly tone: {
|
|
428
|
+
readonly type: "enum";
|
|
429
|
+
readonly values: readonly ["primary", "neutral", "danger"];
|
|
430
|
+
readonly default: "primary";
|
|
431
|
+
readonly reflect: true;
|
|
432
|
+
readonly description: "Color role. Use danger for destructive actions.";
|
|
433
|
+
};
|
|
434
|
+
readonly size: {
|
|
435
|
+
readonly type: "enum";
|
|
436
|
+
readonly values: readonly ["sm", "md", "lg"];
|
|
437
|
+
readonly default: "md";
|
|
438
|
+
readonly reflect: true;
|
|
439
|
+
readonly description: "Size of the square visual control.";
|
|
440
|
+
};
|
|
441
|
+
readonly disabled: {
|
|
442
|
+
readonly type: "boolean";
|
|
443
|
+
readonly default: false;
|
|
444
|
+
readonly reflect: true;
|
|
445
|
+
readonly description: "Prevents activation and removes the web button from the tab order.";
|
|
446
|
+
};
|
|
447
|
+
readonly type: {
|
|
448
|
+
readonly type: "enum";
|
|
449
|
+
readonly values: readonly ["button", "submit", "reset"];
|
|
450
|
+
readonly default: "button";
|
|
451
|
+
readonly platforms: readonly ["web", "react", "angular"];
|
|
452
|
+
readonly description: "Native web button form behavior.";
|
|
453
|
+
};
|
|
454
|
+
readonly pressed: {
|
|
455
|
+
readonly type: "boolean";
|
|
456
|
+
readonly default: false;
|
|
457
|
+
readonly description: "Toggle state. If supplied, including false, activation proposes changes without committing them until the owner updates this prop.";
|
|
458
|
+
};
|
|
459
|
+
readonly defaultPressed: {
|
|
460
|
+
readonly type: "boolean";
|
|
461
|
+
readonly default: false;
|
|
462
|
+
readonly description: "Initial toggle state when pressed is not supplied; it does not control later changes.";
|
|
463
|
+
};
|
|
464
|
+
};
|
|
465
|
+
readonly events: {
|
|
466
|
+
readonly press: {
|
|
467
|
+
readonly description: "Reports each enabled activation by pointer, keyboard or programmatically.";
|
|
468
|
+
readonly detail: "IconButtonPressDetail";
|
|
469
|
+
readonly names: {
|
|
470
|
+
readonly dom: "cosm-press";
|
|
471
|
+
readonly react: "onPress";
|
|
472
|
+
readonly angular: "press";
|
|
473
|
+
readonly native: "onPress";
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
readonly pressedChange: {
|
|
477
|
+
readonly description: "Reports the proposed next pressed state on toggle activation; controlled state waits for the owner.";
|
|
478
|
+
readonly detail: "IconButtonPressedChangeDetail";
|
|
479
|
+
readonly names: {
|
|
480
|
+
readonly dom: "cosm-pressed-change";
|
|
481
|
+
readonly react: "onPressedChange";
|
|
482
|
+
readonly angular: "pressedChange";
|
|
483
|
+
readonly native: "onPressedChange";
|
|
484
|
+
};
|
|
485
|
+
};
|
|
486
|
+
};
|
|
487
|
+
readonly states: readonly [{
|
|
488
|
+
readonly prop: "pressed";
|
|
489
|
+
readonly event: "pressedChange";
|
|
490
|
+
readonly defaultProp: "defaultPressed";
|
|
491
|
+
}];
|
|
492
|
+
readonly slots: {
|
|
493
|
+
readonly '': "Decorative icon content; the label supplies the accessible name.";
|
|
494
|
+
};
|
|
495
|
+
readonly parts: {
|
|
496
|
+
readonly base: "The native button element.";
|
|
497
|
+
};
|
|
498
|
+
readonly cssProperties: {
|
|
499
|
+
readonly '--cosm-icon-button-background': "Control background.";
|
|
500
|
+
readonly '--cosm-icon-button-color': "Icon foreground color.";
|
|
501
|
+
readonly '--cosm-icon-button-border': "Control border color.";
|
|
502
|
+
readonly '--cosm-icon-button-radius': "Control corner radius.";
|
|
503
|
+
readonly '--cosm-icon-button-focus': "Visible focus indicator color.";
|
|
504
|
+
};
|
|
505
|
+
readonly keyboard: readonly [{
|
|
506
|
+
readonly keys: readonly ["Tab", "Shift+Tab"];
|
|
507
|
+
readonly action: "Moves focus to or from the enabled button.";
|
|
508
|
+
}, {
|
|
509
|
+
readonly keys: readonly ["Enter", "Space"];
|
|
510
|
+
readonly action: "Activates the button; toggle mode also proposes a change.";
|
|
511
|
+
}];
|
|
512
|
+
};
|
|
513
|
+
readonly popover: {
|
|
514
|
+
readonly name: "popover";
|
|
515
|
+
readonly tag: "cosm-popover";
|
|
516
|
+
readonly description: "Non-modal content anchored to a consumer trigger, with cancelable close requests and no imposed panel semantics.";
|
|
517
|
+
readonly role: "";
|
|
518
|
+
readonly pattern: "https://html.spec.whatwg.org/multipage/popover.html";
|
|
519
|
+
readonly props: {
|
|
520
|
+
readonly open: {
|
|
521
|
+
readonly type: "boolean";
|
|
522
|
+
readonly default: false;
|
|
523
|
+
readonly reflect: true;
|
|
524
|
+
readonly description: "Committed visibility. Supplying this prop, including false, controls state; its metadata default does not establish a binding.";
|
|
525
|
+
};
|
|
526
|
+
readonly defaultOpen: {
|
|
527
|
+
readonly type: "boolean";
|
|
528
|
+
readonly default: false;
|
|
529
|
+
readonly description: "Initial autonomous visibility only; ignored when open is supplied. Later updates do not reset state.";
|
|
530
|
+
};
|
|
531
|
+
readonly triggerMode: {
|
|
532
|
+
readonly type: "enum";
|
|
533
|
+
readonly values: readonly ["press", "hover"];
|
|
534
|
+
readonly default: "press";
|
|
535
|
+
readonly description: "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.";
|
|
536
|
+
};
|
|
537
|
+
readonly closable: {
|
|
538
|
+
readonly type: "boolean";
|
|
539
|
+
readonly default: false;
|
|
540
|
+
readonly description: "Shows a built-in IconButton with an X. Requests a cancelable close with reason close-button.";
|
|
541
|
+
};
|
|
542
|
+
readonly closeLabel: {
|
|
543
|
+
readonly type: "string";
|
|
544
|
+
readonly default: "Close";
|
|
545
|
+
readonly description: "Localized accessible name of the close button. Must be non-empty when closable is true.";
|
|
546
|
+
};
|
|
547
|
+
readonly gap: {
|
|
548
|
+
readonly type: "number";
|
|
549
|
+
readonly default: 8;
|
|
550
|
+
readonly description: "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.";
|
|
551
|
+
};
|
|
552
|
+
readonly arrow: {
|
|
553
|
+
readonly type: "boolean";
|
|
554
|
+
readonly default: false;
|
|
555
|
+
readonly description: "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.";
|
|
556
|
+
};
|
|
557
|
+
readonly closeOnEscape: {
|
|
558
|
+
readonly type: "boolean";
|
|
559
|
+
readonly default: true;
|
|
560
|
+
readonly description: "Requests closure on unhandled Escape on web and React Native Web. Native Android and iOS hardware Escape is not supported.";
|
|
561
|
+
};
|
|
562
|
+
readonly closeOnOutsidePress: {
|
|
563
|
+
readonly type: "boolean";
|
|
564
|
+
readonly default: true;
|
|
565
|
+
readonly description: "Requests closure on an outside press without preventing its interaction or restoring trigger focus.";
|
|
566
|
+
};
|
|
567
|
+
readonly initialFocus: {
|
|
568
|
+
readonly type: "boolean";
|
|
569
|
+
readonly default: false;
|
|
570
|
+
readonly description: "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.";
|
|
571
|
+
};
|
|
572
|
+
readonly restoreFocus: {
|
|
573
|
+
readonly type: "boolean";
|
|
574
|
+
readonly default: true;
|
|
575
|
+
readonly description: "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.";
|
|
576
|
+
};
|
|
577
|
+
readonly side: {
|
|
578
|
+
readonly type: "enum";
|
|
579
|
+
readonly values: readonly ["top", "right", "bottom", "left"];
|
|
580
|
+
readonly default: "bottom";
|
|
581
|
+
readonly reflect: true;
|
|
582
|
+
readonly description: "Requested physical side; actual placement may flip. Recompute for trigger/panel size, viewport/safe-area, scrolling and orientation changes.";
|
|
583
|
+
};
|
|
584
|
+
readonly align: {
|
|
585
|
+
readonly type: "enum";
|
|
586
|
+
readonly values: readonly ["start", "center", "end"];
|
|
587
|
+
readonly default: "center";
|
|
588
|
+
readonly reflect: true;
|
|
589
|
+
readonly description: "Cross-axis alignment. On top/bottom, start/end follow inline direction (RTL reverses them); on left/right they mean top/bottom.";
|
|
590
|
+
};
|
|
591
|
+
readonly flip: {
|
|
592
|
+
readonly type: "boolean";
|
|
593
|
+
readonly default: true;
|
|
594
|
+
readonly description: "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.";
|
|
595
|
+
};
|
|
596
|
+
readonly shift: {
|
|
597
|
+
readonly type: "boolean";
|
|
598
|
+
readonly default: true;
|
|
599
|
+
readonly description: "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.";
|
|
600
|
+
};
|
|
601
|
+
};
|
|
602
|
+
readonly events: {
|
|
603
|
+
readonly openChange: {
|
|
604
|
+
readonly description: "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.";
|
|
605
|
+
readonly detail: "PopoverOpenChangeDetail";
|
|
606
|
+
readonly cancelable: true;
|
|
607
|
+
readonly names: {
|
|
608
|
+
readonly dom: "cosm-open-change";
|
|
609
|
+
readonly react: "onOpenChange";
|
|
610
|
+
readonly angular: "openChange";
|
|
611
|
+
readonly native: "onOpenChange";
|
|
612
|
+
};
|
|
613
|
+
};
|
|
614
|
+
};
|
|
615
|
+
readonly states: readonly [{
|
|
616
|
+
readonly prop: "open";
|
|
617
|
+
readonly event: "openChange";
|
|
618
|
+
readonly defaultProp: "defaultOpen";
|
|
619
|
+
}];
|
|
620
|
+
readonly slots: {
|
|
621
|
+
readonly 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.";
|
|
622
|
+
readonly '': "Consumer-supplied panel content and semantics. Native maps this content to children.";
|
|
623
|
+
};
|
|
624
|
+
readonly parts: {
|
|
625
|
+
readonly trigger: "Trigger container.";
|
|
626
|
+
readonly panel: "Non-modal anchored surface.";
|
|
627
|
+
readonly body: "Scrollable consumer content.";
|
|
628
|
+
readonly close: "Optional close IconButton.";
|
|
629
|
+
readonly arrow: "Decorative pointer; follows panel colors.";
|
|
630
|
+
};
|
|
631
|
+
readonly cssProperties: {
|
|
632
|
+
readonly '--cosm-popover-z-index': "Panel stacking level.";
|
|
633
|
+
readonly '--cosm-popover-padding': "Panel padding.";
|
|
634
|
+
readonly '--cosm-popover-radius': "Panel corner radius.";
|
|
635
|
+
readonly '--cosm-popover-shadow': "Panel shadow.";
|
|
636
|
+
};
|
|
637
|
+
readonly keyboard: readonly [{
|
|
638
|
+
readonly keys: readonly ["Enter", "Space"];
|
|
639
|
+
readonly action: "The focused trigger activates once and toggles open.";
|
|
640
|
+
}, {
|
|
641
|
+
readonly keys: readonly ["Escape"];
|
|
642
|
+
readonly action: "On web and React Native Web, requests close when open and closeOnEscape is true, unless a child already handled the key.";
|
|
643
|
+
}, {
|
|
644
|
+
readonly keys: readonly ["Tab", "Shift+Tab"];
|
|
645
|
+
readonly action: "Moves focus normally without a focus trap or automatic dismissal.";
|
|
646
|
+
}, {
|
|
647
|
+
readonly keys: readonly ["Android Back"];
|
|
648
|
+
readonly action: "Requests close while open on Android only.";
|
|
649
|
+
}];
|
|
650
|
+
};
|
|
651
|
+
readonly listbox: {
|
|
652
|
+
readonly name: "listbox";
|
|
653
|
+
readonly tag: "cosm-listbox";
|
|
654
|
+
readonly description: "Selects one or more values from a named vertical collection, with groups, descriptions, icons and independent keyboard focus.";
|
|
655
|
+
readonly role: "listbox";
|
|
656
|
+
readonly pattern: "https://www.w3.org/WAI/ARIA/apg/patterns/listbox/";
|
|
657
|
+
readonly props: {
|
|
658
|
+
readonly label: {
|
|
659
|
+
readonly type: "string";
|
|
660
|
+
readonly required: true;
|
|
661
|
+
readonly description: "Required nonempty accessible label, visible unless labelHidden is true.";
|
|
662
|
+
};
|
|
663
|
+
readonly labelHidden: {
|
|
664
|
+
readonly type: "boolean";
|
|
665
|
+
readonly default: false;
|
|
666
|
+
readonly reflect: true;
|
|
667
|
+
readonly description: "Visually hides the label without removing its accessible name.";
|
|
668
|
+
};
|
|
669
|
+
readonly items: {
|
|
670
|
+
readonly type: "reference";
|
|
671
|
+
readonly reference: "ListboxItems";
|
|
672
|
+
readonly required: true;
|
|
673
|
+
readonly options: readonly ["flat", "grouped"];
|
|
674
|
+
readonly example: "grouped";
|
|
675
|
+
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.";
|
|
676
|
+
};
|
|
677
|
+
readonly selectionMode: {
|
|
678
|
+
readonly type: "enum";
|
|
679
|
+
readonly values: readonly ["single", "multiple"];
|
|
680
|
+
readonly default: "single";
|
|
681
|
+
readonly reflect: true;
|
|
682
|
+
readonly description: "Single permits at most one selected value; multiple toggles each activation.";
|
|
683
|
+
};
|
|
684
|
+
readonly selectedValues: {
|
|
685
|
+
readonly type: "reference";
|
|
686
|
+
readonly reference: "ListboxValues";
|
|
687
|
+
readonly options: readonly ["empty", "apple", "cherry", "apple-cherry"];
|
|
688
|
+
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.";
|
|
689
|
+
};
|
|
690
|
+
readonly defaultSelectedValues: {
|
|
691
|
+
readonly type: "reference";
|
|
692
|
+
readonly reference: "ListboxValues";
|
|
693
|
+
readonly options: readonly ["empty", "apple", "cherry", "apple-cherry"];
|
|
694
|
+
readonly example: "empty";
|
|
695
|
+
readonly description: "Initial autonomous selected values (empty by default). Later changes do not reset selection.";
|
|
696
|
+
};
|
|
697
|
+
readonly variant: {
|
|
698
|
+
readonly type: "enum";
|
|
699
|
+
readonly values: readonly ["plain", "outlined"];
|
|
700
|
+
readonly default: "plain";
|
|
701
|
+
readonly reflect: true;
|
|
702
|
+
readonly description: "Plain composes inside a panel; outlined adds a standalone container boundary.";
|
|
703
|
+
};
|
|
704
|
+
readonly size: {
|
|
705
|
+
readonly type: "union";
|
|
706
|
+
readonly variants: readonly [{
|
|
707
|
+
readonly type: "enum";
|
|
708
|
+
readonly values: readonly ["sm", "md", "lg"];
|
|
709
|
+
}, {
|
|
710
|
+
readonly type: "number";
|
|
711
|
+
}];
|
|
712
|
+
readonly default: "md";
|
|
713
|
+
readonly reflect: true;
|
|
714
|
+
readonly description: "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.";
|
|
715
|
+
};
|
|
716
|
+
readonly disabled: {
|
|
717
|
+
readonly type: "boolean";
|
|
718
|
+
readonly default: false;
|
|
719
|
+
readonly reflect: true;
|
|
720
|
+
readonly description: "Prevents interaction and removes the list from keyboard navigation.";
|
|
721
|
+
};
|
|
722
|
+
readonly readOnly: {
|
|
723
|
+
readonly type: "boolean";
|
|
724
|
+
readonly default: false;
|
|
725
|
+
readonly reflect: true;
|
|
726
|
+
readonly description: "Allows exploring options without proposing or committing selection changes.";
|
|
727
|
+
};
|
|
728
|
+
readonly locale: {
|
|
729
|
+
readonly type: "string";
|
|
730
|
+
readonly description: "BCP 47 locale for typeahead. Web inherits the nearest language; native uses the runtime locale when omitted. Invalid locale identifiers are rejected.";
|
|
731
|
+
};
|
|
732
|
+
};
|
|
733
|
+
readonly events: {
|
|
734
|
+
readonly selectionChange: {
|
|
735
|
+
readonly description: "Proposes the next selectedValues for an enabled activation. Autonomous selection commits; controlled selection waits for the owner. Arrows and typeahead never select.";
|
|
736
|
+
readonly detail: "ListboxSelectionChangeDetail";
|
|
737
|
+
readonly names: {
|
|
738
|
+
readonly dom: "cosm-selection-change";
|
|
739
|
+
readonly react: "onSelectionChange";
|
|
740
|
+
readonly angular: "selectionChange";
|
|
741
|
+
readonly native: "onSelectionChange";
|
|
742
|
+
};
|
|
743
|
+
};
|
|
744
|
+
};
|
|
745
|
+
readonly states: readonly [{
|
|
746
|
+
readonly prop: "selectedValues";
|
|
747
|
+
readonly event: "selectionChange";
|
|
748
|
+
readonly defaultProp: "defaultSelectedValues";
|
|
749
|
+
}];
|
|
750
|
+
readonly slots: {};
|
|
751
|
+
readonly parts: {
|
|
752
|
+
readonly base: "Outer container.";
|
|
753
|
+
readonly label: "Visible or visually hidden accessible label.";
|
|
754
|
+
readonly list: "Scrollable listbox.";
|
|
755
|
+
readonly group: "Named option group.";
|
|
756
|
+
readonly 'group-label': "Noninteractive group heading.";
|
|
757
|
+
readonly option: "Selectable row; selected, disabled and active states are exposed on the row.";
|
|
758
|
+
readonly icon: "Decorative option icon.";
|
|
759
|
+
readonly content: "Text content wrapper.";
|
|
760
|
+
readonly 'option-label': "Primary option text.";
|
|
761
|
+
readonly description: "Optional supporting text.";
|
|
762
|
+
readonly indicator: "Decorative selected-state indicator.";
|
|
763
|
+
};
|
|
764
|
+
readonly cssProperties: {
|
|
765
|
+
readonly '--cosm-listbox-background': "Container background.";
|
|
766
|
+
readonly '--cosm-listbox-color': "Primary foreground.";
|
|
767
|
+
readonly '--cosm-listbox-border': "Outlined container border color.";
|
|
768
|
+
readonly '--cosm-listbox-radius': "Container and option corner radius.";
|
|
769
|
+
readonly '--cosm-listbox-option-height': "Minimum option height.";
|
|
770
|
+
readonly '--cosm-listbox-option-padding': "Option padding.";
|
|
771
|
+
readonly '--cosm-listbox-gap': "Space between icon, content and selection indicator.";
|
|
772
|
+
readonly '--cosm-listbox-font-size': "Primary option text size.";
|
|
773
|
+
readonly '--cosm-listbox-description-color': "Supporting text color.";
|
|
774
|
+
readonly '--cosm-listbox-selected-background': "Selected option background.";
|
|
775
|
+
readonly '--cosm-listbox-selected-color': "Selected option foreground.";
|
|
776
|
+
readonly '--cosm-listbox-focus': "Visible keyboard focus outline color.";
|
|
777
|
+
readonly '--cosm-listbox-max-height': "Maximum scrollable list height.";
|
|
778
|
+
};
|
|
779
|
+
readonly keyboard: readonly [{
|
|
780
|
+
readonly keys: readonly ["Tab", "Shift+Tab"];
|
|
781
|
+
readonly action: "Enters or leaves the list as one Tab stop.";
|
|
782
|
+
}, {
|
|
783
|
+
readonly keys: readonly ["ArrowDown", "ArrowUp", "Home", "End"];
|
|
784
|
+
readonly action: "Moves focus among enabled options without changing selection; stops at the ends.";
|
|
785
|
+
}, {
|
|
786
|
+
readonly keys: readonly ["Enter", "Space"];
|
|
787
|
+
readonly action: "Selects the focused option; multiple mode toggles it. Read-only never changes selection.";
|
|
788
|
+
}, {
|
|
789
|
+
readonly keys: readonly ["Printable characters"];
|
|
790
|
+
readonly action: "Moves focus to a matching option using locale-aware typeahead without filtering.";
|
|
791
|
+
}];
|
|
792
|
+
};
|
|
102
793
|
};
|
|
794
|
+
export { iconContract } from './specs/icon.js';
|
|
795
|
+
export { type IconScenario, iconScenarios, iconScenariosFor, } from './specs/icon.scenarios.js';
|
|
796
|
+
export { type IconButtonPressDetail, type IconButtonPressedChangeDetail, iconButtonContract, } from './specs/icon-button.js';
|
|
797
|
+
export { type IconButtonAction, type IconButtonScenario, iconButtonScenarios, iconButtonScenariosFor, } from './specs/icon-button.scenarios.js';
|
|
798
|
+
export { type ListboxGroup, type ListboxItem, type ListboxOption, type ListboxSelectionChangeDetail, type ListboxSelectionMode, listboxContract, } from './specs/listbox.js';
|
|
799
|
+
export { type ListboxAction, type ListboxScenario, listboxScenarioItems, listboxScenarios, listboxScenariosFor, } from './specs/listbox.scenarios.js';
|
|
800
|
+
export { type PopoverAlign, type PopoverCloseReason, type PopoverHandle, type PopoverOpenChangeDetail, type PopoverSide, popoverContract, } from './specs/popover.js';
|
|
801
|
+
export { type PopoverAction, type PopoverChangeExpectation, type PopoverScenario, popoverScenarios, popoverScenariosFor, } from './specs/popover.scenarios.js';
|
|
802
|
+
export { type TextFieldChangeDetail, type TextFieldSubmitDetail, textFieldContract, } from './specs/text-field.js';
|
|
803
|
+
export { type TextFieldAction, type TextFieldScenario, textFieldScenarios, textFieldScenariosFor, } from './specs/text-field.scenarios.js';
|
|
103
804
|
//# sourceMappingURL=index.d.ts.map
|