@joralvmel/cosmos-elements 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -4
- package/dist/components/badge/cosm-badge.d.ts +64 -0
- package/dist/components/badge/cosm-badge.d.ts.map +1 -0
- package/dist/components/badge/cosm-badge.js +162 -0
- package/dist/components/badge/cosm-badge.js.map +1 -0
- package/dist/components/button/cosm-button.d.ts.map +1 -1
- package/dist/components/button/cosm-button.js +2 -0
- package/dist/components/button/cosm-button.js.map +1 -1
- package/dist/components/calendar/cosm-calendar.d.ts +77 -0
- package/dist/components/calendar/cosm-calendar.d.ts.map +1 -0
- package/dist/components/calendar/cosm-calendar.js +696 -0
- package/dist/components/calendar/cosm-calendar.js.map +1 -0
- package/dist/components/checkbox/cosm-checkbox.d.ts +122 -0
- package/dist/components/checkbox/cosm-checkbox.d.ts.map +1 -0
- package/dist/components/checkbox/cosm-checkbox.js +433 -0
- package/dist/components/checkbox/cosm-checkbox.js.map +1 -0
- package/dist/components/dialog/cosm-dialog.d.ts +103 -0
- package/dist/components/dialog/cosm-dialog.d.ts.map +1 -0
- package/dist/components/dialog/cosm-dialog.js +497 -0
- package/dist/components/dialog/cosm-dialog.js.map +1 -0
- package/dist/components/icon/cosm-icon.d.ts +7 -15
- package/dist/components/icon/cosm-icon.d.ts.map +1 -1
- package/dist/components/icon/cosm-icon.js +29 -30
- package/dist/components/icon/cosm-icon.js.map +1 -1
- package/dist/components/icon-button/cosm-icon-button.d.ts.map +1 -1
- package/dist/components/icon-button/cosm-icon-button.js +6 -0
- package/dist/components/icon-button/cosm-icon-button.js.map +1 -1
- package/dist/components/listbox/cosm-listbox.d.ts +1 -5
- package/dist/components/listbox/cosm-listbox.d.ts.map +1 -1
- package/dist/components/listbox/cosm-listbox.js +3 -18
- package/dist/components/listbox/cosm-listbox.js.map +1 -1
- package/dist/components/pagination/cosm-pagination.d.ts +118 -0
- package/dist/components/pagination/cosm-pagination.d.ts.map +1 -0
- package/dist/components/pagination/cosm-pagination.js +315 -0
- package/dist/components/pagination/cosm-pagination.js.map +1 -0
- package/dist/components/popover/cosm-popover.d.ts +0 -22
- package/dist/components/popover/cosm-popover.d.ts.map +1 -1
- package/dist/components/popover/cosm-popover.js +21 -54
- package/dist/components/popover/cosm-popover.js.map +1 -1
- package/dist/components/radio-group/cosm-radio-group.d.ts +111 -0
- package/dist/components/radio-group/cosm-radio-group.d.ts.map +1 -0
- package/dist/components/radio-group/cosm-radio-group.js +478 -0
- package/dist/components/radio-group/cosm-radio-group.js.map +1 -0
- package/dist/components/select/cosm-select.d.ts +126 -0
- package/dist/components/select/cosm-select.d.ts.map +1 -0
- package/dist/components/select/cosm-select.js +682 -0
- package/dist/components/select/cosm-select.js.map +1 -0
- package/dist/components/switch/cosm-switch.d.ts +103 -0
- package/dist/components/switch/cosm-switch.d.ts.map +1 -0
- package/dist/components/switch/cosm-switch.js +359 -0
- package/dist/components/switch/cosm-switch.js.map +1 -0
- package/dist/components/text-field/cosm-text-field.d.ts +8 -18
- package/dist/components/text-field/cosm-text-field.d.ts.map +1 -1
- package/dist/components/text-field/cosm-text-field.js +30 -67
- package/dist/components/text-field/cosm-text-field.js.map +1 -1
- package/dist/components/textarea/cosm-textarea.d.ts +131 -0
- package/dist/components/textarea/cosm-textarea.d.ts.map +1 -0
- package/dist/components/textarea/cosm-textarea.js +445 -0
- package/dist/components/textarea/cosm-textarea.js.map +1 -0
- package/dist/custom-elements.json +5915 -1330
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/current-page.d.ts +7 -0
- package/dist/internal/current-page.d.ts.map +1 -0
- package/dist/internal/current-page.js +18 -0
- package/dist/internal/current-page.js.map +1 -0
- package/llms.md +306 -20
- package/package.json +39 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
export type { ButtonPressDetail, ListboxSelectionChangeDetail, PressSource, TextFieldChangeDetail, TextFieldSubmitDetail, } from '@joralvmel/cosmos-core';
|
|
1
|
+
export type { ButtonPressDetail, ListboxSelectionChangeDetail, PressSource, SwitchCheckedChangeDetail, TextareaChangeDetail, TextFieldChangeDetail, TextFieldSubmitDetail, } from '@joralvmel/cosmos-core';
|
|
2
|
+
export { CosmBadge } from './components/badge/cosm-badge.js';
|
|
2
3
|
export { type ButtonSize, type ButtonTone, type ButtonType, type ButtonVariant, CosmButton, } from './components/button/cosm-button.js';
|
|
4
|
+
export { CosmCalendar } from './components/calendar/cosm-calendar.js';
|
|
5
|
+
export { CosmCheckbox } from './components/checkbox/cosm-checkbox.js';
|
|
6
|
+
export { CosmDialog } from './components/dialog/cosm-dialog.js';
|
|
3
7
|
export { CosmIcon, type CosmIconSize } from './components/icon/cosm-icon.js';
|
|
4
8
|
export { CosmIconButton } from './components/icon-button/cosm-icon-button.js';
|
|
5
9
|
export { CosmListbox, type ListboxSize, type ListboxVariant, } from './components/listbox/cosm-listbox.js';
|
|
10
|
+
export { CosmPagination } from './components/pagination/cosm-pagination.js';
|
|
6
11
|
export { CosmPopover } from './components/popover/cosm-popover.js';
|
|
12
|
+
export { CosmRadioGroup } from './components/radio-group/cosm-radio-group.js';
|
|
13
|
+
export { CosmSelect } from './components/select/cosm-select.js';
|
|
14
|
+
export { CosmSwitch, type SwitchSize } from './components/switch/cosm-switch.js';
|
|
7
15
|
export { CosmTextField, type TextFieldSize, type TextFieldType, type TextFieldVariant, } from './components/text-field/cosm-text-field.js';
|
|
16
|
+
export { CosmTextarea, type TextareaSize, type TextareaVariant, } from './components/textarea/cosm-textarea.js';
|
|
8
17
|
export { CosmElement, type EmitOptions } from './internal/cosm-element.js';
|
|
9
18
|
export { define } from './internal/define.js';
|
|
10
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,iBAAiB,EACjB,4BAA4B,EAC5B,WAAW,EACX,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,UAAU,GACX,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAC9E,OAAO,EACL,WAAW,EACX,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EACL,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,gBAAgB,GACtB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,iBAAiB,EACjB,4BAA4B,EAC5B,WAAW,EACX,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EACL,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,UAAU,GACX,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAC9E,OAAO,EACL,WAAW,EACX,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EACL,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,gBAAgB,GACtB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,YAAY,EACZ,KAAK,YAAY,EACjB,KAAK,eAAe,GACrB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
export { CosmBadge } from './components/badge/cosm-badge.js';
|
|
1
2
|
export { CosmButton, } from './components/button/cosm-button.js';
|
|
3
|
+
export { CosmCalendar } from './components/calendar/cosm-calendar.js';
|
|
4
|
+
export { CosmCheckbox } from './components/checkbox/cosm-checkbox.js';
|
|
5
|
+
export { CosmDialog } from './components/dialog/cosm-dialog.js';
|
|
2
6
|
export { CosmIcon } from './components/icon/cosm-icon.js';
|
|
3
7
|
export { CosmIconButton } from './components/icon-button/cosm-icon-button.js';
|
|
4
8
|
export { CosmListbox, } from './components/listbox/cosm-listbox.js';
|
|
9
|
+
export { CosmPagination } from './components/pagination/cosm-pagination.js';
|
|
5
10
|
export { CosmPopover } from './components/popover/cosm-popover.js';
|
|
11
|
+
export { CosmRadioGroup } from './components/radio-group/cosm-radio-group.js';
|
|
12
|
+
export { CosmSelect } from './components/select/cosm-select.js';
|
|
13
|
+
export { CosmSwitch } from './components/switch/cosm-switch.js';
|
|
6
14
|
export { CosmTextField, } from './components/text-field/cosm-text-field.js';
|
|
15
|
+
export { CosmTextarea, } from './components/textarea/cosm-textarea.js';
|
|
7
16
|
export { CosmElement } from './internal/cosm-element.js';
|
|
8
17
|
export { define } from './internal/define.js';
|
|
9
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAKL,UAAU,GACX,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAqB,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAC9E,OAAO,EACL,WAAW,GAGZ,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAmB,MAAM,oCAAoC,CAAC;AACjF,OAAO,EACL,aAAa,GAId,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,YAAY,GAGb,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,WAAW,EAAoB,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Whether a composed button represents the current page. */
|
|
2
|
+
export declare const isCurrentPage: (element: Element) => boolean;
|
|
3
|
+
/** Marks or unmarks a composed button as the current page and schedules its update. */
|
|
4
|
+
export declare function setCurrentPage(element: Element & {
|
|
5
|
+
requestUpdate(): void;
|
|
6
|
+
}, current: boolean): void;
|
|
7
|
+
//# sourceMappingURL=current-page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"current-page.d.ts","sourceRoot":"","sources":["../../src/internal/current-page.ts"],"names":[],"mappings":"AAMA,6DAA6D;AAC7D,eAAO,MAAM,aAAa,GAAI,SAAS,OAAO,KAAG,OAAoC,CAAC;AAEtF,uFAAuF;AACvF,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,GAAG;IAAE,aAAa,IAAI,IAAI,CAAA;CAAE,EAC5C,OAAO,EAAE,OAAO,GACf,IAAI,CAKN"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Private composition channel used by `cosm-pagination` to mark its current page button with
|
|
3
|
+
* `aria-current="page"`. It is not exported from the package: Button has no public current-page API.
|
|
4
|
+
*/
|
|
5
|
+
const currentPages = new WeakSet();
|
|
6
|
+
/** Whether a composed button represents the current page. */
|
|
7
|
+
export const isCurrentPage = (element) => currentPages.has(element);
|
|
8
|
+
/** Marks or unmarks a composed button as the current page and schedules its update. */
|
|
9
|
+
export function setCurrentPage(element, current) {
|
|
10
|
+
if (currentPages.has(element) === current)
|
|
11
|
+
return;
|
|
12
|
+
if (current)
|
|
13
|
+
currentPages.add(element);
|
|
14
|
+
else
|
|
15
|
+
currentPages.delete(element);
|
|
16
|
+
element.requestUpdate();
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=current-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"current-page.js","sourceRoot":"","sources":["../../src/internal/current-page.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,YAAY,GAAG,IAAI,OAAO,EAAW,CAAC;AAE5C,6DAA6D;AAC7D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAgB,EAAW,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAEtF,uFAAuF;AACvF,MAAM,UAAU,cAAc,CAC5B,OAA4C,EAC5C,OAAgB;IAEhB,IAAI,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,OAAO;QAAE,OAAO;IAClD,IAAI,OAAO;QAAE,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;;QAClC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAClC,OAAO,CAAC,aAAa,EAAE,CAAC;AAC1B,CAAC"}
|
package/llms.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Framework-agnostic Web Components (Lit) of Cosmos UI. Use them in plain HTML or any framework; React and Angular users should prefer `@joralvmel/cosmos-react` / `@joralvmel/cosmos-angular`.
|
|
4
4
|
|
|
5
|
+
Checkbox and Text Field use themed hover borders on enabled valid controls; checked/mixed
|
|
6
|
+
Checkbox uses `primary-hover`. Text Field adds `primary-subtle` while its input or actions have
|
|
7
|
+
focus. Existing component background/border/focus hooks retain priority over theme defaults.
|
|
8
|
+
Select uses a themed hover border, a persistent expanded appearance, and a rotating chevron while
|
|
9
|
+
open; enabled active options use the Listbox neutral surface. Disabled controls do not react to
|
|
10
|
+
hover; invalid hover borders retain danger. No new props or tokens.
|
|
11
|
+
|
|
5
12
|
<!-- generated:start (npm run llms, do not edit this block by hand) -->
|
|
6
13
|
|
|
7
14
|
## Setup: HTML / CDN
|
|
@@ -64,17 +71,15 @@ Events: `cosm-press` → `ButtonPressDetail`.
|
|
|
64
71
|
```
|
|
65
72
|
### `<cosm-icon>`
|
|
66
73
|
|
|
67
|
-
Renders a structured SVG icon.
|
|
74
|
+
Renders a structured SVG icon. Icons are decorative and hidden from assistive technology unless a nonempty label makes them informative.
|
|
68
75
|
|
|
69
76
|
| Prop | Type | Default | Description |
|
|
70
77
|
| --- | --- | --- | --- |
|
|
71
78
|
| `icon` | IconDefinition | Required | Structured icon definition, commonly imported from @joralvmel/cosmos-icons. |
|
|
72
79
|
| `size` | 'sm' \| 'md' \| 'lg' \| number | `md` | Semantic size (16, 20 or 24) or a positive finite number in pixels / native units. |
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
| `label` | string | — | Accessible name required when decorative is false. |
|
|
77
|
-
| `decorative` | boolean | `true` | Hides the icon from assistive technology when true. |
|
|
80
|
+
| `variant` | 'outline' \| 'filled' | `outline` | Appearance. outline draws only the stroke; filled also fills the shapes with the icon color (for example a favorite star or heart). Explicit node fills in the definition always win. |
|
|
81
|
+
| `color` | string | `currentColor` | Icon color (stroke, currentColor fills and the filled variant). currentColor inherits the surrounding text color on web and the parent control or theme foreground on native; otherwise a supported color without URLs. |
|
|
82
|
+
| `label` | string | — | Accessible name. A nonempty label makes the icon an informative image; without one the icon is decorative and hidden from assistive technology. |
|
|
78
83
|
|
|
79
84
|
Events: none.
|
|
80
85
|
|
|
@@ -91,7 +96,7 @@ Events: none.
|
|
|
91
96
|
```
|
|
92
97
|
### `<cosm-text-field>`
|
|
93
98
|
|
|
94
|
-
Accepts a single line of text with an accessible label, optional
|
|
99
|
+
Accepts a single line of text with an accessible label, optional helper and error text, and native form validation on the web.
|
|
95
100
|
|
|
96
101
|
| Prop | Type | Default | Description |
|
|
97
102
|
| --- | --- | --- | --- |
|
|
@@ -101,11 +106,11 @@ Accepts a single line of text with an accessible label, optional help and error
|
|
|
101
106
|
| `defaultValue` (`default-value`) | string | `` | Initial value for autonomous use. Web form reset restores this value; it does not control subsequent edits. |
|
|
102
107
|
| `type` | 'text' \| 'email' \| 'password' \| 'tel' \| 'url' \| 'search' | `text` | Single-line input type. Native maps it to supported keyboard, autofill and secure-entry behavior. |
|
|
103
108
|
| `variant` | 'outlined' \| 'filled' | `outlined` | Visual treatment of the editable control. |
|
|
104
|
-
| `size` | 'sm' \| 'md' \| 'lg'
|
|
109
|
+
| `size` | 'sm' \| 'md' \| 'lg' | `md` | Small, medium or large editable control. |
|
|
105
110
|
| `placeholder` | string | — | Short input hint; it never replaces the accessible label. |
|
|
106
|
-
| `
|
|
107
|
-
| `error` | string | — | Optional
|
|
108
|
-
| `invalid` | boolean | `false` | External invalid state, independent of browser constraints or consumer business validation. |
|
|
111
|
+
| `helperText` (`helper-text`) | string | — | Optional supporting text associated with the editable control. |
|
|
112
|
+
| `errorText` (`error-text`) | string | — | Optional consumer-localized error text associated with the editable control; a nonempty trimmed value also exposes invalid state. |
|
|
113
|
+
| `invalid` | boolean | `false` | External invalid state when the visible error is supplied elsewhere, independent of browser constraints or consumer business validation. |
|
|
109
114
|
| `required` | boolean | `false` | Exposes required semantics. On web, participates in native HTML constraint validation. |
|
|
110
115
|
| `disabled` | boolean | `false` | Disables editing and interaction. On web, follows disabled fieldsets and excludes the value from form submission. |
|
|
111
116
|
| `readOnly` (`read-only`) | boolean | `false` | Prevents editing while remaining focusable and form-submittable on web; distinct from disabled. |
|
|
@@ -117,7 +122,6 @@ Accepts a single line of text with an accessible label, optional help and error
|
|
|
117
122
|
| `inputMode` (`input-mode`) | '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. |
|
|
118
123
|
| `startIcon` (`start-icon`) | IconDefinition | — | Optional structured decorative icon before the editable text. |
|
|
119
124
|
| `endIcon` (`end-icon`) | IconDefinition | — | Optional structured decorative icon after the editable text. |
|
|
120
|
-
| `iconFocusScope` (`icon-focus-scope`) | '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. |
|
|
121
125
|
| `prefix` | string | — | Optional non-interactive text decoration before the editable text. |
|
|
122
126
|
| `suffix` | string | — | Optional non-interactive text decoration after the editable text. |
|
|
123
127
|
| `clearable` | boolean | `false` | Shows a clear action for non-empty editable fields. Supply clearLabel when enabled. |
|
|
@@ -187,16 +191,11 @@ Non-modal content anchored to a consumer trigger, with cancelable close requests
|
|
|
187
191
|
| `triggerMode` (`trigger-mode`) | '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. |
|
|
188
192
|
| `closable` | boolean | `false` | Shows a built-in IconButton with an X. Requests a cancelable close with reason close-button. |
|
|
189
193
|
| `closeLabel` (`close-label`) | string | `Close` | Localized accessible name of the close button. Must be non-empty when closable is true. |
|
|
190
|
-
| `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. |
|
|
191
194
|
| `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. |
|
|
192
195
|
| `closeOnEscape` (`close-on-escape`) | boolean | `true` | Requests closure on unhandled Escape on web and React Native Web. Native Android and iOS hardware Escape is not supported. |
|
|
193
196
|
| `closeOnOutsidePress` (`close-on-outside-press`) | boolean | `true` | Requests closure on an outside press without preventing its interaction or restoring trigger focus. |
|
|
194
|
-
| `
|
|
195
|
-
| `restoreFocus` (`restore-focus`) | 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. |
|
|
196
|
-
| `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. |
|
|
197
|
+
| `side` | 'top' \| 'right' \| 'bottom' \| 'left' | `bottom` | Requested physical side; actual placement flips to the opposite side when that reduces viewport/safe-area overflow, then shifts within bounds. |
|
|
197
198
|
| `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. |
|
|
198
|
-
| `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. |
|
|
199
|
-
| `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. |
|
|
200
199
|
|
|
201
200
|
Events: `cosm-open-change` → `PopoverOpenChangeDetail`.
|
|
202
201
|
|
|
@@ -225,7 +224,7 @@ Selects one or more values from a named vertical collection, with groups, descri
|
|
|
225
224
|
| `selectedValues` (`selected-values`) | 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. |
|
|
226
225
|
| `defaultSelectedValues` (`default-selected-values`) | ListboxValues | — | Initial autonomous selected values (empty by default). Later changes do not reset selection. |
|
|
227
226
|
| `variant` | 'plain' \| 'outlined' | `plain` | Plain composes inside a panel; outlined adds a standalone container boundary. |
|
|
228
|
-
| `size` | 'sm' \| 'md' \| 'lg'
|
|
227
|
+
| `size` | 'sm' \| 'md' \| 'lg' | `md` | Small, medium or large option rows. Content may grow; native touch targets remain at least 44. |
|
|
229
228
|
| `disabled` | boolean | `false` | Prevents interaction and removes the list from keyboard navigation. |
|
|
230
229
|
| `readOnly` (`read-only`) | boolean | `false` | Allows exploring options without proposing or committing selection changes. |
|
|
231
230
|
| `locale` | string | — | BCP 47 locale for typeahead. Web inherits the nearest language; native uses the runtime locale when omitted. Invalid locale identifiers are rejected. |
|
|
@@ -246,10 +245,297 @@ Events: `cosm-selection-change` → `ListboxSelectionChangeDetail`.
|
|
|
246
245
|
element.addEventListener('cosm-selection-change', event => console.log(event.detail));
|
|
247
246
|
</script>
|
|
248
247
|
```
|
|
248
|
+
### `<cosm-checkbox>`
|
|
249
|
+
|
|
250
|
+
Selects an independent boolean value with accessible labeling and native form behavior on the web.
|
|
251
|
+
|
|
252
|
+
| Prop | Type | Default | Description |
|
|
253
|
+
| --- | --- | --- | --- |
|
|
254
|
+
| `label` | string | Required | Required accessible name, visible unless labelHidden is true. |
|
|
255
|
+
| `labelHidden` (`label-hidden`) | boolean | `false` | Visually hides the label while keeping it available to assistive technology. |
|
|
256
|
+
| `checked` | boolean | `false` | Controlled checked value when supplied, including false; activation proposes changes without self-committing. |
|
|
257
|
+
| `defaultChecked` (`default-checked`) | boolean | `false` | Initial autonomous checked value; later changes do not reset it. |
|
|
258
|
+
| `indeterminate` | boolean | `false` | Presentation-only mixed state. Autonomous activation clears it; controlled use leaves it to the owner. |
|
|
259
|
+
| `size` | 'sm' \| 'md' \| 'lg' | `md` | Small, medium or large visual box. |
|
|
260
|
+
| `disabled` | boolean | `false` | Prevents user interaction and excludes the value from web form submission. |
|
|
261
|
+
| `required` | boolean | `false` | Exposes required semantics and participates in native web form validation. Native has no automatic validation. |
|
|
262
|
+
| `invalid` | boolean | `false` | Externally supplied invalid presentation state when the visible error is supplied elsewhere; web form validity remains based on required. |
|
|
263
|
+
| `helperText` (`helper-text`) | string | — | Optional consumer-localized supporting text associated with the checkbox. |
|
|
264
|
+
| `errorText` (`error-text`) | string | — | Optional consumer-localized error description; a nonempty trimmed value also exposes invalid state. |
|
|
265
|
+
| `name` | string | — | Web form field name; React Native has no HTML form association. |
|
|
266
|
+
| `value` | string | `on` | Web form value submitted when checked and enabled; defaults to on. Angular Forms uses checked as its boolean value. |
|
|
267
|
+
|
|
268
|
+
Events: `cosm-checked-change` → `CheckboxCheckedChangeDetail`.
|
|
269
|
+
|
|
270
|
+
```html
|
|
271
|
+
<cosm-checkbox label="Checkbox">Checkbox</cosm-checkbox>
|
|
272
|
+
|
|
273
|
+
<script type="module">
|
|
274
|
+
import '@joralvmel/cosmos-elements/checkbox';
|
|
275
|
+
|
|
276
|
+
const element = document.querySelector('cosm-checkbox');
|
|
277
|
+
element.addEventListener('cosm-checked-change', event => console.log(event.detail));
|
|
278
|
+
</script>
|
|
279
|
+
```
|
|
280
|
+
### `<cosm-switch>`
|
|
281
|
+
|
|
282
|
+
Toggles a binary setting immediately with a stable accessible name and form behavior on the web.
|
|
283
|
+
|
|
284
|
+
| Prop | Type | Default | Description |
|
|
285
|
+
| --- | --- | --- | --- |
|
|
286
|
+
| `label` | string | Required | Required nonempty accessible name; remains stable in both states. |
|
|
287
|
+
| `labelHidden` (`label-hidden`) | boolean | `false` | Visually hides the label while retaining its accessible name. |
|
|
288
|
+
| `checked` | boolean | `false` | Controlled checked value when supplied, including false; activation proposes changes without self-committing. |
|
|
289
|
+
| `defaultChecked` (`default-checked`) | boolean | `false` | Initial autonomous checked value; later changes do not reset it. |
|
|
290
|
+
| `size` | 'sm' \| 'md' \| 'lg' | `md` | Small, medium or large web switch. Native uses system Switch sizing. |
|
|
291
|
+
| `disabled` | boolean | `false` | Prevents user interaction and excludes the value from web form submission. |
|
|
292
|
+
| `invalid` | boolean | `false` | Externally supplied invalid presentation. Does not change checked state or form validity; native uses danger colors without an equivalent system invalid trait. |
|
|
293
|
+
| `helperText` (`helper-text`) | string | — | Optional consumer-localized supporting text associated with the switch. |
|
|
294
|
+
| `name` | string | — | Web form field name; React Native has no HTML form association. |
|
|
295
|
+
| `value` | string | `on` | Web form value submitted when checked and enabled; defaults to on. Angular Forms uses checked as its boolean value. |
|
|
296
|
+
|
|
297
|
+
Events: `cosm-checked-change` → `SwitchCheckedChangeDetail`.
|
|
298
|
+
|
|
299
|
+
```html
|
|
300
|
+
<cosm-switch label="Switch"></cosm-switch>
|
|
301
|
+
|
|
302
|
+
<script type="module">
|
|
303
|
+
import '@joralvmel/cosmos-elements/switch';
|
|
304
|
+
|
|
305
|
+
const element = document.querySelector('cosm-switch');
|
|
306
|
+
element.addEventListener('cosm-checked-change', event => console.log(event.detail));
|
|
307
|
+
</script>
|
|
308
|
+
```
|
|
309
|
+
### `<cosm-badge>`
|
|
310
|
+
|
|
311
|
+
Displays a noninteractive status or category label, or caller-formatted count, with an optional decorative leading icon.
|
|
312
|
+
|
|
313
|
+
| Prop | Type | Default | Description |
|
|
314
|
+
| --- | --- | --- | --- |
|
|
315
|
+
| `variant` | 'soft' \| 'solid' \| 'outline' | `soft` | Visual treatment of the static label. |
|
|
316
|
+
| `tone` | 'neutral' \| 'info' \| 'success' \| 'warning' \| 'danger' | `neutral` | Semantic color intent of the static label. |
|
|
317
|
+
| `size` | 'sm' \| 'md' \| 'lg' | `md` | Semantic label size. |
|
|
318
|
+
| `startIcon` (`start-icon`) | IconDefinition | — | Optional structured decorative icon before the label. |
|
|
319
|
+
|
|
320
|
+
Events: none.
|
|
321
|
+
|
|
322
|
+
```html
|
|
323
|
+
<cosm-badge>Badge</cosm-badge>
|
|
324
|
+
|
|
325
|
+
<script type="module">
|
|
326
|
+
import '@joralvmel/cosmos-elements/badge';
|
|
327
|
+
import { heart } from '@joralvmel/cosmos-icons/heart';
|
|
328
|
+
|
|
329
|
+
const element = document.querySelector('cosm-badge');
|
|
330
|
+
element.startIcon = heart;
|
|
331
|
+
</script>
|
|
332
|
+
```
|
|
333
|
+
### `<cosm-calendar>`
|
|
334
|
+
|
|
335
|
+
Selects one Gregorian date from an inline, localized calendar with keyboard navigation and optional bounds. Month and year can be selected directly.
|
|
336
|
+
|
|
337
|
+
| Prop | Type | Default | Description |
|
|
338
|
+
| --- | --- | --- | --- |
|
|
339
|
+
| `value` | string | — | Controlled selected date in YYYY-MM-DD format; when supplied, selection proposals wait for the owner to update this value. |
|
|
340
|
+
| `defaultValue` (`default-value`) | string | — | Initial autonomous selected date in YYYY-MM-DD format; later changes do not reset selection. |
|
|
341
|
+
| `min` | string | — | Earliest selectable date in YYYY-MM-DD format, inclusive. |
|
|
342
|
+
| `max` | string | — | Latest selectable date in YYYY-MM-DD format, inclusive. |
|
|
343
|
+
| `locale` | string | — | BCP 47 locale for month and weekday names, week start, and text direction; defaults to the environment locale. Invalid locale identifiers are rejected. |
|
|
344
|
+
| `disabled` | boolean | `false` | Disables date selection and calendar navigation. |
|
|
345
|
+
|
|
346
|
+
Events: `cosm-change` → `CalendarChangeDetail`.
|
|
347
|
+
|
|
348
|
+
```html
|
|
349
|
+
<cosm-calendar></cosm-calendar>
|
|
350
|
+
|
|
351
|
+
<script type="module">
|
|
352
|
+
import '@joralvmel/cosmos-elements/calendar';
|
|
353
|
+
|
|
354
|
+
const element = document.querySelector('cosm-calendar');
|
|
355
|
+
element.addEventListener('cosm-change', event => console.log(event.detail));
|
|
356
|
+
</script>
|
|
357
|
+
```
|
|
358
|
+
### `<cosm-textarea>`
|
|
359
|
+
|
|
360
|
+
Accepts multiline plain text with an accessible label, optional helper and error text, and native form behavior on the web.
|
|
361
|
+
|
|
362
|
+
| Prop | Type | Default | Description |
|
|
363
|
+
| --- | --- | --- | --- |
|
|
364
|
+
| `label` | string | Required | Accessible name for the editable control. It is rendered above the control unless visually hidden. |
|
|
365
|
+
| `labelHidden` (`label-hidden`) | boolean | `false` | Visually hides the label while keeping it available to assistive technology. |
|
|
366
|
+
| `value` | string | — | Current text. When bound, edits are proposals and the component waits for the owner to supply the accepted value. |
|
|
367
|
+
| `defaultValue` (`default-value`) | string | `` | Initial value for autonomous use. Web form reset restores this value; it does not control subsequent edits. |
|
|
368
|
+
| `rows` | number | `4` | Visible line count of the multiline editor. It is independent of the visual size. |
|
|
369
|
+
| `variant` | 'outlined' \| 'filled' | `outlined` | Visual treatment of the editable control. |
|
|
370
|
+
| `size` | 'sm' \| 'md' \| 'lg' | `md` | Visual size of the editable control, independent of rows. |
|
|
371
|
+
| `placeholder` | string | — | Short input hint; it never replaces the accessible label. |
|
|
372
|
+
| `helperText` (`helper-text`) | string | — | Optional supporting text associated with the editable control. |
|
|
373
|
+
| `errorText` (`error-text`) | string | — | Optional consumer-localized error text associated with the editable control; a nonempty trimmed value also exposes invalid state. |
|
|
374
|
+
| `invalid` | boolean | `false` | External invalid state when the visible error is supplied elsewhere, independent of browser constraints or consumer business validation. |
|
|
375
|
+
| `required` | boolean | `false` | Exposes required semantics. On web, participates in native HTML constraint validation. |
|
|
376
|
+
| `disabled` | boolean | `false` | Disables editing and interaction. On web, follows disabled fieldsets and excludes the value from form submission. |
|
|
377
|
+
| `readOnly` (`read-only`) | boolean | `false` | Prevents editing while remaining focusable and form-submittable on web; distinct from disabled. |
|
|
378
|
+
| `maxLength` (`max-length`) | number | — | Maximum number of characters. Web uses native HTML length constraints and native applies supported input limits. |
|
|
379
|
+
| `name` | string | — | Form field name on web. React Native has no HTML form association or name-based submission. |
|
|
380
|
+
|
|
381
|
+
Events: `cosm-change` → `TextareaChangeDetail`.
|
|
382
|
+
|
|
383
|
+
```html
|
|
384
|
+
<cosm-textarea label="Textarea"></cosm-textarea>
|
|
385
|
+
|
|
386
|
+
<script type="module">
|
|
387
|
+
import '@joralvmel/cosmos-elements/textarea';
|
|
388
|
+
|
|
389
|
+
const element = document.querySelector('cosm-textarea');
|
|
390
|
+
element.addEventListener('cosm-change', event => console.log(event.detail));
|
|
391
|
+
</script>
|
|
392
|
+
```
|
|
393
|
+
### `<cosm-radio-group>`
|
|
394
|
+
|
|
395
|
+
Selects one option from a labeled collection, with optional selection and native Web form behavior.
|
|
396
|
+
|
|
397
|
+
| Prop | Type | Default | Description |
|
|
398
|
+
| --- | --- | --- | --- |
|
|
399
|
+
| `label` | string | Required | Required visible accessible name for the group. |
|
|
400
|
+
| `options` | RadioGroupOptions | Required | Readonly flat options with unique nonempty values and labels, optional descriptions and disabled states. |
|
|
401
|
+
| `value` | RadioGroupValue | — | Controlled selected value; null means no selection, and a supplied null remains controlled. |
|
|
402
|
+
| `defaultValue` (`default-value`) | RadioGroupValue | — | Initial autonomous selection; null by default. |
|
|
403
|
+
| `size` | 'sm' \| 'md' \| 'lg' | `md` | Small, medium or large radio indicator. |
|
|
404
|
+
| `orientation` | 'vertical' \| 'horizontal' | `vertical` | Vertical list or wrapping horizontal options. |
|
|
405
|
+
| `disabled` | boolean | `false` | Prevents interaction and excludes the value from Web form submission. |
|
|
406
|
+
| `required` | boolean | `false` | Requires a selection in Web form validation; Native exposes descriptive semantics. |
|
|
407
|
+
| `invalid` | boolean | `false` | Externally supplied invalid presentation state when the visible error is supplied elsewhere. |
|
|
408
|
+
| `helperText` (`helper-text`) | string | — | Optional supporting text associated with the group. |
|
|
409
|
+
| `errorText` (`error-text`) | string | — | Optional consumer-localized error text; a nonempty trimmed value also exposes invalid state. |
|
|
410
|
+
| `name` | string | — | Web form field name; React Native has no HTML form association. |
|
|
411
|
+
|
|
412
|
+
Events: `cosm-change` → `RadioGroupChangeDetail`.
|
|
413
|
+
|
|
414
|
+
```html
|
|
415
|
+
<cosm-radio-group label="RadioGroup"></cosm-radio-group>
|
|
416
|
+
|
|
417
|
+
<script type="module">
|
|
418
|
+
import '@joralvmel/cosmos-elements/radio-group';
|
|
419
|
+
const contactMethods = [{"value":"email","label":"Email","description":"Receive updates by email."},{"value":"phone","label":"Phone","description":"Receive updates by text."},{"value":"mail","label":"Mail","disabled":true}];
|
|
420
|
+
|
|
421
|
+
const element = document.querySelector('cosm-radio-group');
|
|
422
|
+
element.options = contactMethods;
|
|
423
|
+
element.addEventListener('cosm-change', event => console.log(event.detail));
|
|
424
|
+
</script>
|
|
425
|
+
```
|
|
426
|
+
### `<cosm-select>`
|
|
427
|
+
|
|
428
|
+
Selects one option from an accessible collection, with native Web form behavior.
|
|
429
|
+
|
|
430
|
+
| Prop | Type | Default | Description |
|
|
431
|
+
| --- | --- | --- | --- |
|
|
432
|
+
| `label` | string | Required | Required visible accessible name for the control. |
|
|
433
|
+
| `items` | SelectItems | Required | Readonly flat options with unique nonempty values, nonempty labels, and optional disabled state. |
|
|
434
|
+
| `value` | SelectValue | — | Controlled selected value; null means no selection, and a supplied null remains controlled. |
|
|
435
|
+
| `defaultValue` (`default-value`) | SelectValue | — | Initial autonomous selection; null by default. |
|
|
436
|
+
| `placeholder` | string | Required | Consumer-localized text shown when no value is selected. |
|
|
437
|
+
| `variant` | 'outlined' \| 'filled' | `outlined` | Outlined or filled trigger appearance. |
|
|
438
|
+
| `size` | 'sm' \| 'md' \| 'lg' | `md` | Small, medium, or large control size. |
|
|
439
|
+
| `disabled` | boolean | `false` | Prevents interaction and excludes the value from Web form submission. |
|
|
440
|
+
| `required` | boolean | `false` | Requires a selection in Web form validation; Native exposes descriptive semantics. |
|
|
441
|
+
| `invalid` | boolean | `false` | Externally supplied invalid presentation state when the visible error is supplied elsewhere. |
|
|
442
|
+
| `helperText` (`helper-text`) | string | — | Optional supporting text associated with the control. |
|
|
443
|
+
| `errorText` (`error-text`) | string | — | Optional consumer-localized error text; a nonempty trimmed value also exposes invalid state. |
|
|
444
|
+
| `name` | string | — | Web form field name; React Native has no HTML form association. |
|
|
445
|
+
|
|
446
|
+
Events: `cosm-change` → `SelectChangeDetail`.
|
|
447
|
+
|
|
448
|
+
```html
|
|
449
|
+
<cosm-select label="Select" placeholder="Select"></cosm-select>
|
|
450
|
+
|
|
451
|
+
<script type="module">
|
|
452
|
+
import '@joralvmel/cosmos-elements/select';
|
|
453
|
+
const flat = [{"value":"apple","label":"Apple"},{"value":"cherry","label":"Cherry"},{"value":"lime","label":"Lime","disabled":true}];
|
|
454
|
+
const none = null;
|
|
455
|
+
|
|
456
|
+
const element = document.querySelector('cosm-select');
|
|
457
|
+
element.items = flat;
|
|
458
|
+
element.defaultValue = none;
|
|
459
|
+
element.addEventListener('cosm-change', event => console.log(event.detail));
|
|
460
|
+
</script>
|
|
461
|
+
```
|
|
462
|
+
### `<cosm-pagination>`
|
|
463
|
+
|
|
464
|
+
Navigates a known number of pages using buttons.
|
|
465
|
+
|
|
466
|
+
| Prop | Type | Default | Description |
|
|
467
|
+
| --- | --- | --- | --- |
|
|
468
|
+
| `totalPages` (`total-pages`) | number | Required | Required nonnegative safe integer page count. |
|
|
469
|
+
| `page` | number | — | Controlled one-based safe integer page; out-of-range values are displayed clamped. |
|
|
470
|
+
| `defaultPage` (`default-page`) | number | `1` | Initial one-based page for autonomous state. |
|
|
471
|
+
| `label` | string | Required | Required localized navigation landmark label. |
|
|
472
|
+
| `previousLabel` (`previous-label`) | string | `Previous page` | Previous button label. |
|
|
473
|
+
| `nextLabel` (`next-label`) | string | `Next page` | Next button label. |
|
|
474
|
+
| `firstLabel` (`first-label`) | string | `First page` | First button label. |
|
|
475
|
+
| `lastLabel` (`last-label`) | string | `Last page` | Last button label. |
|
|
476
|
+
| `pageLabel` (`page-label`) | string | `Page {page}` | Page button label template; {page} is replaced with the localized number. |
|
|
477
|
+
| `summaryLabel` (`summary-label`) | string | `Page {page} of {total}` | Compact summary template with {page} and {total} placeholders. |
|
|
478
|
+
| `locale` | string | — | Locale for formatted page numbers. |
|
|
479
|
+
| `direction` | 'ltr' \| 'rtl' | `ltr` | Layout and directional icon direction. |
|
|
480
|
+
| `presentation` | 'numbered' \| 'compact' | `numbered` | Show up to seven fixed-width numbered positions or a compact summary. |
|
|
481
|
+
| `variant` | 'solid' \| 'soft' \| 'outline' | `solid` | Selected page emphasis. |
|
|
482
|
+
| `size` | 'sm' \| 'md' \| 'lg' | `md` | Control size. |
|
|
483
|
+
| `showFirstLast` (`show-first-last`) | boolean | `false` | Show first and last page controls. |
|
|
484
|
+
| `disabled` | boolean | `false` | Disable all controls. |
|
|
485
|
+
|
|
486
|
+
Events: `cosm-change` → `PaginationChangeDetail`.
|
|
487
|
+
|
|
488
|
+
```html
|
|
489
|
+
<cosm-pagination label="Pagination"></cosm-pagination>
|
|
490
|
+
|
|
491
|
+
<script type="module">
|
|
492
|
+
import '@joralvmel/cosmos-elements/pagination';
|
|
493
|
+
|
|
494
|
+
const element = document.querySelector('cosm-pagination');
|
|
495
|
+
element.addEventListener('cosm-change', event => console.log(event.detail));
|
|
496
|
+
</script>
|
|
497
|
+
```
|
|
498
|
+
### `<cosm-dialog>`
|
|
499
|
+
|
|
500
|
+
Modal content with a title, actions and cancelable close requests.
|
|
501
|
+
|
|
502
|
+
| Prop | Type | Default | Description |
|
|
503
|
+
| --- | --- | --- | --- |
|
|
504
|
+
| `open` | boolean | `false` | Committed visibility; supplying this prop, including false, controls state. |
|
|
505
|
+
| `defaultOpen` (`default-open`) | boolean | `false` | Initial autonomous visibility; subsequent changes do not reset state. |
|
|
506
|
+
| `presentation` | 'standard' \| 'fullscreen' | `standard` | Centered standard surface or fullscreen surface. |
|
|
507
|
+
| `size` | 'sm' \| 'md' \| 'lg' | `md` | Maximum standard width: sm 400, md 640, lg 960 pixels or logical points. |
|
|
508
|
+
| `responsiveFullscreen` (`responsive-fullscreen`) | boolean | `false` | Use fullscreen when available viewport width is below 640 pixels or logical points. |
|
|
509
|
+
| `closeLabel` (`close-label`) | string | `Close` | Non-empty localized accessible name of the built-in close button. |
|
|
510
|
+
| `closeOnEscape` (`close-on-escape`) | boolean | `true` | Request closure on unhandled Escape on web. |
|
|
511
|
+
| `closeOnBackdropPress` (`close-on-backdrop-press`) | boolean | `false` | Request closure when the backdrop itself is pressed. |
|
|
512
|
+
| `initialFocusTarget` (`initial-focus-target`) | DialogFocusTarget | — | Optional platform focus target used on committed opening; it must be inside the dialog. |
|
|
513
|
+
| `returnFocusTarget` (`return-focus-target`) | DialogFocusTarget | — | Optional platform focus target used after committed closure. |
|
|
514
|
+
|
|
515
|
+
Events: `cosm-open-change` → `DialogOpenChangeDetail`.
|
|
516
|
+
|
|
517
|
+
```html
|
|
518
|
+
<cosm-button type="button" id="open-dialog">Open dialog</cosm-button>
|
|
519
|
+
<cosm-dialog>
|
|
520
|
+
<h2 slot="title">Review details</h2>
|
|
521
|
+
<p>Dialog</p>
|
|
522
|
+
<cosm-button slot="actions" type="button" id="done">Done</cosm-button>
|
|
523
|
+
</cosm-dialog>
|
|
524
|
+
<script type="module">
|
|
525
|
+
import '@joralvmel/cosmos-elements/dialog';
|
|
526
|
+
import '@joralvmel/cosmos-elements/button';
|
|
527
|
+
const dialog = document.querySelector('cosm-dialog');
|
|
528
|
+
document.querySelector('#open-dialog').addEventListener('cosm-press', () => dialog.requestOpen());
|
|
529
|
+
document.querySelector('#done').addEventListener('cosm-press', () => dialog.requestClose());
|
|
530
|
+
dialog.addEventListener('cosm-open-change', event => {
|
|
531
|
+
console.log(event.detail);
|
|
532
|
+
});
|
|
533
|
+
</script>
|
|
534
|
+
```
|
|
249
535
|
|
|
250
536
|
## Themes
|
|
251
537
|
|
|
252
|
-
Built-in themes: `cosmos`, `nebula` (default `cosmos`), each with `light` and `dark` modes; `system` follows the OS.
|
|
538
|
+
Built-in themes: `cosmos`, `nebula`, `terra`, `supernova`, `aurora`, `solstice` (default `cosmos`), each with `light` and `dark` modes; `system` follows the OS.
|
|
253
539
|
|
|
254
540
|
```html
|
|
255
541
|
<html data-theme="nebula" data-mode="system">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joralvmel/cosmos-elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Cosmos UI Web Components built with Lit: framework-agnostic, themeable and accessible.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
@@ -60,6 +60,42 @@
|
|
|
60
60
|
"types": "./dist/components/listbox/cosm-listbox.d.ts",
|
|
61
61
|
"default": "./dist/components/listbox/cosm-listbox.js"
|
|
62
62
|
},
|
|
63
|
+
"./checkbox": {
|
|
64
|
+
"types": "./dist/components/checkbox/cosm-checkbox.d.ts",
|
|
65
|
+
"default": "./dist/components/checkbox/cosm-checkbox.js"
|
|
66
|
+
},
|
|
67
|
+
"./switch": {
|
|
68
|
+
"types": "./dist/components/switch/cosm-switch.d.ts",
|
|
69
|
+
"default": "./dist/components/switch/cosm-switch.js"
|
|
70
|
+
},
|
|
71
|
+
"./badge": {
|
|
72
|
+
"types": "./dist/components/badge/cosm-badge.d.ts",
|
|
73
|
+
"default": "./dist/components/badge/cosm-badge.js"
|
|
74
|
+
},
|
|
75
|
+
"./calendar": {
|
|
76
|
+
"types": "./dist/components/calendar/cosm-calendar.d.ts",
|
|
77
|
+
"default": "./dist/components/calendar/cosm-calendar.js"
|
|
78
|
+
},
|
|
79
|
+
"./textarea": {
|
|
80
|
+
"types": "./dist/components/textarea/cosm-textarea.d.ts",
|
|
81
|
+
"default": "./dist/components/textarea/cosm-textarea.js"
|
|
82
|
+
},
|
|
83
|
+
"./radio-group": {
|
|
84
|
+
"types": "./dist/components/radio-group/cosm-radio-group.d.ts",
|
|
85
|
+
"default": "./dist/components/radio-group/cosm-radio-group.js"
|
|
86
|
+
},
|
|
87
|
+
"./select": {
|
|
88
|
+
"types": "./dist/components/select/cosm-select.d.ts",
|
|
89
|
+
"default": "./dist/components/select/cosm-select.js"
|
|
90
|
+
},
|
|
91
|
+
"./pagination": {
|
|
92
|
+
"types": "./dist/components/pagination/cosm-pagination.d.ts",
|
|
93
|
+
"default": "./dist/components/pagination/cosm-pagination.js"
|
|
94
|
+
},
|
|
95
|
+
"./dialog": {
|
|
96
|
+
"types": "./dist/components/dialog/cosm-dialog.d.ts",
|
|
97
|
+
"default": "./dist/components/dialog/cosm-dialog.js"
|
|
98
|
+
},
|
|
63
99
|
"./custom-elements.json": "./dist/custom-elements.json",
|
|
64
100
|
"./llms.md": "./llms.md",
|
|
65
101
|
"./package.json": "./package.json"
|
|
@@ -72,8 +108,8 @@
|
|
|
72
108
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\""
|
|
73
109
|
},
|
|
74
110
|
"dependencies": {
|
|
75
|
-
"@joralvmel/cosmos-core": "^0.
|
|
76
|
-
"@joralvmel/cosmos-icons": "^0.
|
|
111
|
+
"@joralvmel/cosmos-core": "^0.4.0",
|
|
112
|
+
"@joralvmel/cosmos-icons": "^0.4.0",
|
|
77
113
|
"lit": "^3.3.3"
|
|
78
114
|
},
|
|
79
115
|
"devDependencies": {
|