@joralvmel/cosmos-elements 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- 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 +79 -0
- package/dist/components/icon-button/cosm-icon-button.d.ts.map +1 -0
- package/dist/components/icon-button/cosm-icon-button.js +212 -0
- package/dist/components/icon-button/cosm-icon-button.js.map +1 -0
- package/dist/components/listbox/cosm-listbox.d.ts +136 -0
- package/dist/components/listbox/cosm-listbox.d.ts.map +1 -0
- package/dist/components/listbox/cosm-listbox.js +565 -0
- package/dist/components/listbox/cosm-listbox.js.map +1 -0
- 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 +100 -0
- package/dist/components/popover/cosm-popover.d.ts.map +1 -0
- package/dist/components/popover/cosm-popover.js +776 -0
- package/dist/components/popover/cosm-popover.js.map +1 -0
- 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 +193 -0
- package/dist/components/text-field/cosm-text-field.d.ts.map +1 -0
- package/dist/components/text-field/cosm-text-field.js +642 -0
- package/dist/components/text-field/cosm-text-field.js.map +1 -0
- 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 +7605 -78
- package/dist/index.d.ts +14 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -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 +455 -7
- package/package.json +55 -3
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
import { findListboxMatch, getListboxInitialActive, getListboxOptions, getListboxSelection, listboxContract, moveListboxActive, validateListboxSize, validateListboxValues, } from '@joralvmel/cosmos-core';
|
|
2
|
+
import { isIconDefinition } from '@joralvmel/cosmos-icons';
|
|
3
|
+
import { check } from '@joralvmel/cosmos-icons/check';
|
|
4
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
5
|
+
import { CosmElement } from '../../internal/cosm-element.js';
|
|
6
|
+
import { define } from '../../internal/define.js';
|
|
7
|
+
import { boxSizing, focusRing } from '../../internal/styles.js';
|
|
8
|
+
import '../icon/cosm-icon.js';
|
|
9
|
+
let instance = 0;
|
|
10
|
+
const styles = css `
|
|
11
|
+
:host {
|
|
12
|
+
display: block;
|
|
13
|
+
min-width: 0;
|
|
14
|
+
color: var(--cosm-listbox-color, var(--cosm-fg, oklch(0.24 0.01 268)));
|
|
15
|
+
font-family: var(--cosm-font-sans, system-ui, sans-serif);
|
|
16
|
+
--_minimum-height: var(--cosm-control-md, 2.5rem);
|
|
17
|
+
--_font-size: var(--cosm-text-sm, 0.875rem);
|
|
18
|
+
}
|
|
19
|
+
:host([size='sm']) {
|
|
20
|
+
--_minimum-height: var(--cosm-control-sm, 2rem);
|
|
21
|
+
--_font-size: var(--cosm-text-xs, 0.75rem);
|
|
22
|
+
}
|
|
23
|
+
:host([size='lg']) {
|
|
24
|
+
--_minimum-height: var(--cosm-control-lg, 3rem);
|
|
25
|
+
--_font-size: var(--cosm-text-md, 1rem);
|
|
26
|
+
}
|
|
27
|
+
.base {
|
|
28
|
+
min-width: 0;
|
|
29
|
+
border: 1px solid transparent;
|
|
30
|
+
border-radius: var(--cosm-listbox-radius, var(--cosm-radius-md, 0.5rem));
|
|
31
|
+
background: var(--cosm-listbox-background, var(--cosm-bg, oklch(0.985 0.007 268)));
|
|
32
|
+
}
|
|
33
|
+
:host([variant='outlined']) .base {
|
|
34
|
+
border-color: var(
|
|
35
|
+
--cosm-listbox-border,
|
|
36
|
+
var(--cosm-border-strong, oklch(0.64 0.01 268))
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
.label {
|
|
40
|
+
display: block;
|
|
41
|
+
margin-block-end: var(--cosm-space-xs, 0.25rem);
|
|
42
|
+
font-size: var(--cosm-text-sm, 0.875rem);
|
|
43
|
+
font-weight: var(--cosm-weight-medium, 500);
|
|
44
|
+
}
|
|
45
|
+
.label-hidden {
|
|
46
|
+
position: absolute;
|
|
47
|
+
width: 1px;
|
|
48
|
+
height: 1px;
|
|
49
|
+
padding: 0;
|
|
50
|
+
margin: -1px;
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
clip: rect(0, 0, 0, 0);
|
|
53
|
+
white-space: nowrap;
|
|
54
|
+
border: 0;
|
|
55
|
+
}
|
|
56
|
+
.list {
|
|
57
|
+
max-height: var(--cosm-listbox-max-height, 20rem);
|
|
58
|
+
overflow: auto;
|
|
59
|
+
overscroll-behavior: contain;
|
|
60
|
+
padding: var(--cosm-space-2xs, 0.125rem);
|
|
61
|
+
outline: none;
|
|
62
|
+
}
|
|
63
|
+
.group + .group,
|
|
64
|
+
.group + .option,
|
|
65
|
+
.option + .group {
|
|
66
|
+
margin-block-start: var(--cosm-space-2xs, 0.125rem);
|
|
67
|
+
}
|
|
68
|
+
.group-label {
|
|
69
|
+
padding: var(--cosm-space-xs, 0.25rem) var(--cosm-listbox-option-padding, 0.75rem);
|
|
70
|
+
color: var(--cosm-fg-muted, oklch(0.48 0.01 268));
|
|
71
|
+
font-size: var(--cosm-text-xs, 0.75rem);
|
|
72
|
+
font-weight: var(--cosm-weight-medium, 500);
|
|
73
|
+
}
|
|
74
|
+
.option {
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
gap: var(--cosm-listbox-gap, var(--cosm-space-sm, 0.5rem));
|
|
78
|
+
width: 100%;
|
|
79
|
+
min-height: var(--cosm-listbox-option-height, var(--_minimum-height));
|
|
80
|
+
padding: var(--cosm-listbox-option-padding, var(--cosm-space-sm, 0.5rem))
|
|
81
|
+
var(--cosm-listbox-option-padding, var(--cosm-space-md, 0.75rem));
|
|
82
|
+
border: 0;
|
|
83
|
+
border-radius: var(--cosm-listbox-radius, var(--cosm-radius-sm, 0.25rem));
|
|
84
|
+
color: inherit;
|
|
85
|
+
background: transparent;
|
|
86
|
+
text-align: start;
|
|
87
|
+
font: inherit;
|
|
88
|
+
font-size: var(--cosm-listbox-font-size, var(--_font-size));
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
}
|
|
91
|
+
.option[data-active='true']:not([aria-disabled='true']):not([data-selected='true']) {
|
|
92
|
+
background: var(--cosm-neutral-2, oklch(0.96 0.008 268));
|
|
93
|
+
}
|
|
94
|
+
.option[data-selected='true'] {
|
|
95
|
+
color: var(--cosm-listbox-selected-color, var(--cosm-primary-text, oklch(0.45 0.17 268)));
|
|
96
|
+
background: var(--cosm-listbox-selected-background, var(--cosm-primary-subtle, oklch(0.93 0.03 268)));
|
|
97
|
+
}
|
|
98
|
+
.option[data-selected='true'][data-active='true'] {
|
|
99
|
+
background: var(--cosm-listbox-selected-background, var(--cosm-primary-subtle, oklch(0.93 0.03 268)));
|
|
100
|
+
}
|
|
101
|
+
.option:focus-visible {
|
|
102
|
+
position: relative;
|
|
103
|
+
z-index: 1;
|
|
104
|
+
outline: 2px solid var(--cosm-listbox-focus, var(--cosm-focus-ring, oklch(0.55 0.2 268)));
|
|
105
|
+
outline-offset: -2px;
|
|
106
|
+
}
|
|
107
|
+
.option[aria-disabled='true'] {
|
|
108
|
+
color: var(--cosm-fg-muted, oklch(0.48 0.01 268));
|
|
109
|
+
cursor: not-allowed;
|
|
110
|
+
}
|
|
111
|
+
:host([disabled]) .option {
|
|
112
|
+
cursor: not-allowed;
|
|
113
|
+
}
|
|
114
|
+
.icon {
|
|
115
|
+
flex: none;
|
|
116
|
+
}
|
|
117
|
+
.content {
|
|
118
|
+
display: grid;
|
|
119
|
+
min-width: 0;
|
|
120
|
+
flex: 1;
|
|
121
|
+
gap: var(--cosm-space-3xs, 0.125rem);
|
|
122
|
+
}
|
|
123
|
+
.option-label,
|
|
124
|
+
.description {
|
|
125
|
+
overflow-wrap: anywhere;
|
|
126
|
+
}
|
|
127
|
+
.option-label {
|
|
128
|
+
font-size: inherit;
|
|
129
|
+
}
|
|
130
|
+
.description {
|
|
131
|
+
color: var(--cosm-listbox-description-color, var(--cosm-fg-muted, oklch(0.48 0.01 268)));
|
|
132
|
+
font-size: var(--cosm-text-xs, 0.75rem);
|
|
133
|
+
}
|
|
134
|
+
.indicator {
|
|
135
|
+
display: grid;
|
|
136
|
+
width: 1.25rem;
|
|
137
|
+
height: 1.25rem;
|
|
138
|
+
flex: none;
|
|
139
|
+
place-items: center;
|
|
140
|
+
}
|
|
141
|
+
.indicator cosm-icon {
|
|
142
|
+
width: 1rem;
|
|
143
|
+
height: 1rem;
|
|
144
|
+
}
|
|
145
|
+
@media (prefers-reduced-motion: reduce) {
|
|
146
|
+
*,
|
|
147
|
+
*::before,
|
|
148
|
+
*::after {
|
|
149
|
+
scroll-behavior: auto !important;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
`;
|
|
153
|
+
/**
|
|
154
|
+
* Renders a named, keyboard-navigable single- or multiple-selection listbox.
|
|
155
|
+
*
|
|
156
|
+
* @tag cosm-listbox
|
|
157
|
+
* @slot - No content slot; options are supplied through the `items` property.
|
|
158
|
+
* @csspart base - Outer listbox container.
|
|
159
|
+
* @csspart label - Visible or visually hidden accessible label.
|
|
160
|
+
* @csspart list - Scrollable listbox element.
|
|
161
|
+
* @csspart group - Named, noninteractive option group.
|
|
162
|
+
* @csspart group-label - Noninteractive group heading.
|
|
163
|
+
* @csspart option - Selectable row with data-active, data-selected and data-disabled states.
|
|
164
|
+
* @csspart icon - Decorative option icon.
|
|
165
|
+
* @csspart content - Option text content wrapper.
|
|
166
|
+
* @csspart option-label - Primary option text.
|
|
167
|
+
* @csspart description - Supporting option text.
|
|
168
|
+
* @csspart indicator - Decorative selected-state indicator.
|
|
169
|
+
* @fires {CustomEvent<ListboxSelectionChangeDetail>} cosm-selection-change - Proposes a selection update.
|
|
170
|
+
* @cssprop --cosm-listbox-background - Container background.
|
|
171
|
+
* @cssprop --cosm-listbox-color - Primary foreground.
|
|
172
|
+
* @cssprop --cosm-listbox-border - Outlined container border color.
|
|
173
|
+
* @cssprop --cosm-listbox-radius - Container and option corner radius.
|
|
174
|
+
* @cssprop --cosm-listbox-option-height - Minimum option height.
|
|
175
|
+
* @cssprop --cosm-listbox-option-padding - Option padding.
|
|
176
|
+
* @cssprop --cosm-listbox-gap - Space between icon, content and selection indicator.
|
|
177
|
+
* @cssprop --cosm-listbox-font-size - Primary option text size.
|
|
178
|
+
* @cssprop --cosm-listbox-description-color - Supporting text color.
|
|
179
|
+
* @cssprop --cosm-listbox-selected-background - Selected option background.
|
|
180
|
+
* @cssprop --cosm-listbox-selected-color - Selected option foreground.
|
|
181
|
+
* @cssprop --cosm-listbox-focus - Visible keyboard focus outline color.
|
|
182
|
+
* @cssprop --cosm-listbox-max-height - Maximum scrollable list height.
|
|
183
|
+
*/
|
|
184
|
+
export class CosmListbox extends CosmElement {
|
|
185
|
+
static shadowRootOptions = {
|
|
186
|
+
...LitElement.shadowRootOptions,
|
|
187
|
+
delegatesFocus: true,
|
|
188
|
+
};
|
|
189
|
+
static properties = {
|
|
190
|
+
label: { type: String },
|
|
191
|
+
labelHidden: { type: Boolean, reflect: true, attribute: 'label-hidden' },
|
|
192
|
+
items: { attribute: false },
|
|
193
|
+
selectionMode: { reflect: true, attribute: 'selection-mode' },
|
|
194
|
+
selectedValues: { attribute: false, noAccessor: true },
|
|
195
|
+
defaultSelectedValues: { attribute: false },
|
|
196
|
+
variant: { reflect: true },
|
|
197
|
+
size: { reflect: true },
|
|
198
|
+
disabled: { type: Boolean, reflect: true },
|
|
199
|
+
readOnly: { type: Boolean, reflect: true, attribute: 'read-only' },
|
|
200
|
+
locale: { type: String },
|
|
201
|
+
};
|
|
202
|
+
static styles = [boxSizing, focusRing, styles];
|
|
203
|
+
/** Set by adapters or imperative callers to override binding inference for `selectedValues`. */
|
|
204
|
+
get selectedValuesControlled() {
|
|
205
|
+
return this.#selectedValuesControlled;
|
|
206
|
+
}
|
|
207
|
+
set selectedValuesControlled(value) {
|
|
208
|
+
const previous = this.#selectedValuesControlled;
|
|
209
|
+
this.#selectedValuesControlled = Boolean(value);
|
|
210
|
+
if (previous !== this.#selectedValuesControlled)
|
|
211
|
+
this.requestUpdate();
|
|
212
|
+
}
|
|
213
|
+
#selectedValues;
|
|
214
|
+
#selectedValuesControlled = false;
|
|
215
|
+
#selection = [];
|
|
216
|
+
#activeValue = null;
|
|
217
|
+
#initialized = false;
|
|
218
|
+
#restoreFocusAfterUpdate = false;
|
|
219
|
+
#pointerEntry = false;
|
|
220
|
+
#typeahead = '';
|
|
221
|
+
#id = `cosm-listbox-${++instance}`;
|
|
222
|
+
/** Controlled selected values; setting a defined array marks the state controlled. */
|
|
223
|
+
get selectedValues() {
|
|
224
|
+
return this.#selectedValues;
|
|
225
|
+
}
|
|
226
|
+
set selectedValues(value) {
|
|
227
|
+
const previous = this.#selectedValues;
|
|
228
|
+
this.#selectedValues = value;
|
|
229
|
+
if (value === undefined)
|
|
230
|
+
this.selectedValuesControlled = false;
|
|
231
|
+
else
|
|
232
|
+
this.selectedValuesControlled = true;
|
|
233
|
+
this.requestUpdate('selectedValues', previous);
|
|
234
|
+
}
|
|
235
|
+
/** The current committed selection, regardless of whether it is autonomous or controlled. */
|
|
236
|
+
get currentSelectedValues() {
|
|
237
|
+
return this.selectedValuesControlled ? (this.#selectedValues ?? []) : this.#selection;
|
|
238
|
+
}
|
|
239
|
+
/** The current roving option value, or `null` when every option is disabled or absent. */
|
|
240
|
+
get activeValue() {
|
|
241
|
+
return this.#activeValue;
|
|
242
|
+
}
|
|
243
|
+
constructor() {
|
|
244
|
+
super();
|
|
245
|
+
const props = listboxContract.props;
|
|
246
|
+
this.label = '';
|
|
247
|
+
this.labelHidden = props.labelHidden.default;
|
|
248
|
+
this.items = [];
|
|
249
|
+
this.selectionMode = props.selectionMode.default;
|
|
250
|
+
this.#selectedValues = undefined;
|
|
251
|
+
this.defaultSelectedValues = [];
|
|
252
|
+
this.variant = props.variant.default;
|
|
253
|
+
this.size = props.size.default;
|
|
254
|
+
this.disabled = props.disabled.default;
|
|
255
|
+
this.readOnly = props.readOnly.default;
|
|
256
|
+
this.locale = undefined;
|
|
257
|
+
}
|
|
258
|
+
connectedCallback() {
|
|
259
|
+
super.connectedCallback();
|
|
260
|
+
this.addEventListener('focusin', this.#onFocusIn);
|
|
261
|
+
this.addEventListener('focusout', this.#onFocusOut);
|
|
262
|
+
}
|
|
263
|
+
disconnectedCallback() {
|
|
264
|
+
this.removeEventListener('focusin', this.#onFocusIn);
|
|
265
|
+
this.removeEventListener('focusout', this.#onFocusOut);
|
|
266
|
+
super.disconnectedCallback();
|
|
267
|
+
}
|
|
268
|
+
/** Focuses the active enabled option, or the initially selected enabled option. */
|
|
269
|
+
focus(options) {
|
|
270
|
+
if (this.disabled)
|
|
271
|
+
return;
|
|
272
|
+
const flattened = this.#getOptions();
|
|
273
|
+
const active = getListboxInitialActive(flattened, this.currentSelectedValues) ?? this.#activeValue;
|
|
274
|
+
if (active)
|
|
275
|
+
this.#focusOption(active, options);
|
|
276
|
+
}
|
|
277
|
+
willUpdate(changed) {
|
|
278
|
+
this.#restoreFocusAfterUpdate =
|
|
279
|
+
this.hasUpdated &&
|
|
280
|
+
changed.has('items') &&
|
|
281
|
+
this.shadowRoot?.activeElement?.getAttribute('role') === 'option';
|
|
282
|
+
if (typeof this.label !== 'string' || !this.label.trim()) {
|
|
283
|
+
throw new TypeError('Listbox requires a non-empty label.');
|
|
284
|
+
}
|
|
285
|
+
if (this.selectionMode !== 'single' && this.selectionMode !== 'multiple') {
|
|
286
|
+
throw new TypeError('Listbox selectionMode must be single or multiple.');
|
|
287
|
+
}
|
|
288
|
+
if (this.variant !== 'plain' && this.variant !== 'outlined') {
|
|
289
|
+
throw new TypeError('Listbox variant must be plain or outlined.');
|
|
290
|
+
}
|
|
291
|
+
validateListboxSize(this.size);
|
|
292
|
+
const options = this.#getOptions();
|
|
293
|
+
if (this.#selectedValues !== undefined) {
|
|
294
|
+
validateListboxValues(this.#selectedValues, this.selectionMode);
|
|
295
|
+
}
|
|
296
|
+
if (this.defaultSelectedValues !== undefined) {
|
|
297
|
+
validateListboxValues(this.defaultSelectedValues, this.selectionMode);
|
|
298
|
+
}
|
|
299
|
+
if (!this.#initialized) {
|
|
300
|
+
this.#selection = [...(this.defaultSelectedValues ?? [])];
|
|
301
|
+
this.#initialized = true;
|
|
302
|
+
}
|
|
303
|
+
const values = this.currentSelectedValues;
|
|
304
|
+
validateListboxValues(values, this.selectionMode);
|
|
305
|
+
for (const option of options) {
|
|
306
|
+
if (option.icon !== undefined && !isIconDefinition(option.icon)) {
|
|
307
|
+
throw new TypeError('Listbox option icon requires a valid IconDefinition.');
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
const locale = this.#getLocale();
|
|
311
|
+
try {
|
|
312
|
+
new Intl.Collator(locale);
|
|
313
|
+
}
|
|
314
|
+
catch {
|
|
315
|
+
throw new TypeError('Listbox locale must be a valid BCP 47 identifier.');
|
|
316
|
+
}
|
|
317
|
+
if (!this.#activeValue ||
|
|
318
|
+
!options.some(option => option.value === this.#activeValue && !option.disabled)) {
|
|
319
|
+
this.#activeValue = getListboxInitialActive(options, values);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
updated() {
|
|
323
|
+
if (!this.#restoreFocusAfterUpdate)
|
|
324
|
+
return;
|
|
325
|
+
this.#restoreFocusAfterUpdate = false;
|
|
326
|
+
if (this.#activeValue)
|
|
327
|
+
this.#focusOption(this.#activeValue);
|
|
328
|
+
}
|
|
329
|
+
#getOptions() {
|
|
330
|
+
return getListboxOptions(this.items);
|
|
331
|
+
}
|
|
332
|
+
#getLocale() {
|
|
333
|
+
if (this.locale !== undefined) {
|
|
334
|
+
if (typeof this.locale !== 'string' || !this.locale.trim()) {
|
|
335
|
+
throw new TypeError('Listbox locale must be a valid BCP 47 identifier.');
|
|
336
|
+
}
|
|
337
|
+
return this.locale;
|
|
338
|
+
}
|
|
339
|
+
return this.closest('[lang]')?.getAttribute('lang')?.trim() || undefined;
|
|
340
|
+
}
|
|
341
|
+
#onFocusIn = (event) => {
|
|
342
|
+
if (this.#pointerEntry)
|
|
343
|
+
return;
|
|
344
|
+
if (this.disabled || !this.#isEnteringFromOutside(event.relatedTarget))
|
|
345
|
+
return;
|
|
346
|
+
const focused = getListboxInitialActive(this.#getOptions(), this.currentSelectedValues);
|
|
347
|
+
if (focused && focused !== this.#activeValue)
|
|
348
|
+
this.#focusOption(focused);
|
|
349
|
+
};
|
|
350
|
+
#onFocusOut = (event) => {
|
|
351
|
+
if (event.relatedTarget && !this.#isEnteringFromOutside(event.relatedTarget))
|
|
352
|
+
return;
|
|
353
|
+
const resetEntry = () => {
|
|
354
|
+
if (!this.isConnected)
|
|
355
|
+
return;
|
|
356
|
+
if (this.shadowRoot?.activeElement)
|
|
357
|
+
return;
|
|
358
|
+
this.#typeahead = '';
|
|
359
|
+
this.#setActive(getListboxInitialActive(this.#getOptions(), this.currentSelectedValues));
|
|
360
|
+
};
|
|
361
|
+
if (event.relatedTarget) {
|
|
362
|
+
this.#typeahead = '';
|
|
363
|
+
this.#setActive(getListboxInitialActive(this.#getOptions(), this.currentSelectedValues));
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
queueMicrotask(resetEntry);
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
#isEnteringFromOutside(target) {
|
|
370
|
+
if (!(target instanceof Node))
|
|
371
|
+
return true;
|
|
372
|
+
return target !== this && !this.contains(target) && !this.renderRoot.contains(target);
|
|
373
|
+
}
|
|
374
|
+
#onKeyDown = (event) => {
|
|
375
|
+
if (this.disabled || event.altKey || event.ctrlKey || event.metaKey)
|
|
376
|
+
return;
|
|
377
|
+
const options = this.#getOptions();
|
|
378
|
+
if (event.key === 'ArrowDown' ||
|
|
379
|
+
event.key === 'ArrowUp' ||
|
|
380
|
+
event.key === 'Home' ||
|
|
381
|
+
event.key === 'End') {
|
|
382
|
+
event.preventDefault();
|
|
383
|
+
this.#focusOption(moveListboxActive(options, this.#activeValue, event.key));
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
387
|
+
event.preventDefault();
|
|
388
|
+
if (!this.readOnly && this.#activeValue)
|
|
389
|
+
this.#activate(this.#activeValue, 'keyboard');
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
if (event.key.length === 1 && event.key !== ' ' && event.key.trim().length > 0) {
|
|
393
|
+
const locale = this.#getLocale();
|
|
394
|
+
this.#typeahead += event.key;
|
|
395
|
+
const match = findListboxMatch(options, this.#activeValue, this.#typeahead, locale);
|
|
396
|
+
if (match)
|
|
397
|
+
this.#focusOption(match);
|
|
398
|
+
event.preventDefault();
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
this.#typeahead = '';
|
|
402
|
+
};
|
|
403
|
+
#onOptionClick = (event) => {
|
|
404
|
+
const target = event.currentTarget;
|
|
405
|
+
if (!(target instanceof HTMLElement))
|
|
406
|
+
return;
|
|
407
|
+
const option = this.#getOptions().find(item => item.value === target.dataset.value);
|
|
408
|
+
if (!option || option.disabled || this.disabled)
|
|
409
|
+
return;
|
|
410
|
+
this.#focusFromPointer(option.value);
|
|
411
|
+
if (!this.readOnly)
|
|
412
|
+
this.#activate(option.value, 'pointer');
|
|
413
|
+
};
|
|
414
|
+
#onOptionPointerDown = (event) => {
|
|
415
|
+
if (event.button !== 0 || this.disabled)
|
|
416
|
+
return;
|
|
417
|
+
const target = event.currentTarget;
|
|
418
|
+
if (!(target instanceof HTMLElement))
|
|
419
|
+
return;
|
|
420
|
+
const option = this.#getOptions().find(item => item.value === target.dataset.value);
|
|
421
|
+
if (!option || option.disabled)
|
|
422
|
+
return;
|
|
423
|
+
event.preventDefault();
|
|
424
|
+
this.#focusFromPointer(option.value);
|
|
425
|
+
};
|
|
426
|
+
#focusFromPointer(value) {
|
|
427
|
+
this.#pointerEntry = true;
|
|
428
|
+
try {
|
|
429
|
+
this.#focusOption(value);
|
|
430
|
+
}
|
|
431
|
+
finally {
|
|
432
|
+
this.#pointerEntry = false;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
#focusOption(value, options) {
|
|
436
|
+
this.#setActive(value);
|
|
437
|
+
if (!value)
|
|
438
|
+
return;
|
|
439
|
+
const option = [...this.renderRoot.querySelectorAll('[role="option"]')].find(element => element.dataset.value === value);
|
|
440
|
+
if (!option)
|
|
441
|
+
return;
|
|
442
|
+
option.focus(options);
|
|
443
|
+
try {
|
|
444
|
+
option.scrollIntoView?.({ block: 'nearest' });
|
|
445
|
+
}
|
|
446
|
+
catch {
|
|
447
|
+
// Some DOM implementations expose scrollIntoView but do not implement its options.
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
#setActive(value) {
|
|
451
|
+
if (this.#activeValue === value)
|
|
452
|
+
return;
|
|
453
|
+
this.#activeValue = value;
|
|
454
|
+
for (const option of this.renderRoot.querySelectorAll('[role="option"]')) {
|
|
455
|
+
option.tabIndex = option.dataset.value === value ? 0 : -1;
|
|
456
|
+
option.dataset.active = String(option.dataset.value === value);
|
|
457
|
+
}
|
|
458
|
+
this.requestUpdate();
|
|
459
|
+
}
|
|
460
|
+
#activate(value, source) {
|
|
461
|
+
const option = this.#getOptions().find(item => item.value === value);
|
|
462
|
+
if (!option || option.disabled || this.disabled || this.readOnly)
|
|
463
|
+
return;
|
|
464
|
+
const mode = this.selectionMode;
|
|
465
|
+
if (mode !== 'single' && mode !== 'multiple') {
|
|
466
|
+
throw new TypeError('Listbox selectionMode must be single or multiple.');
|
|
467
|
+
}
|
|
468
|
+
const selected = this.currentSelectedValues;
|
|
469
|
+
if (mode === 'single' && selected.includes(value))
|
|
470
|
+
return;
|
|
471
|
+
const next = getListboxSelection(selected, value, mode);
|
|
472
|
+
this.emit('cosm-selection-change', {
|
|
473
|
+
selectedValues: next,
|
|
474
|
+
value,
|
|
475
|
+
source,
|
|
476
|
+
});
|
|
477
|
+
if (!this.selectedValuesControlled) {
|
|
478
|
+
this.#selection = [...next];
|
|
479
|
+
this.requestUpdate();
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
render() {
|
|
483
|
+
const items = this.items;
|
|
484
|
+
const selected = new Set(this.currentSelectedValues);
|
|
485
|
+
const locale = this.#getLocale();
|
|
486
|
+
let optionIndex = 0;
|
|
487
|
+
const renderOption = (option) => {
|
|
488
|
+
const index = optionIndex++;
|
|
489
|
+
const isSelected = selected.has(option.value);
|
|
490
|
+
const isActive = this.#activeValue === option.value;
|
|
491
|
+
const isDisabled = this.disabled || Boolean(option.disabled);
|
|
492
|
+
const descriptionId = option.description ? `${this.#id}-description-${index}` : undefined;
|
|
493
|
+
const optionLabelId = `${this.#id}-option-label-${index}`;
|
|
494
|
+
return html `<div
|
|
495
|
+
part="option"
|
|
496
|
+
class="option"
|
|
497
|
+
id=${`${this.#id}-option-${index}`}
|
|
498
|
+
role="option"
|
|
499
|
+
data-value=${option.value}
|
|
500
|
+
data-active=${String(isActive)}
|
|
501
|
+
data-selected=${String(isSelected)}
|
|
502
|
+
data-disabled=${String(isDisabled)}
|
|
503
|
+
aria-selected=${String(isSelected)}
|
|
504
|
+
aria-disabled=${String(isDisabled)}
|
|
505
|
+
aria-labelledby=${optionLabelId}
|
|
506
|
+
aria-describedby=${descriptionId ?? nothing}
|
|
507
|
+
tabindex=${isActive && !isDisabled ? 0 : -1}
|
|
508
|
+
@pointerdown=${this.#onOptionPointerDown}
|
|
509
|
+
@click=${this.#onOptionClick}
|
|
510
|
+
>
|
|
511
|
+
${option.icon
|
|
512
|
+
? html `<cosm-icon part="icon" class="icon" .icon=${option.icon} size="sm"></cosm-icon>`
|
|
513
|
+
: nothing}
|
|
514
|
+
<span part="content" class="content">
|
|
515
|
+
<span part="option-label" class="option-label" id=${optionLabelId}>${option.label}</span>
|
|
516
|
+
${option.description
|
|
517
|
+
? html `<span part="description" class="description" id=${descriptionId}>${option.description}</span>`
|
|
518
|
+
: nothing}
|
|
519
|
+
</span>
|
|
520
|
+
<span part="indicator" class="indicator" aria-hidden="true">
|
|
521
|
+
${isSelected ? html `<cosm-icon .icon=${check} size="sm"></cosm-icon>` : nothing}
|
|
522
|
+
</span>
|
|
523
|
+
</div>`;
|
|
524
|
+
};
|
|
525
|
+
const listDisabled = this.disabled;
|
|
526
|
+
return html `
|
|
527
|
+
<div part="base" class="base">
|
|
528
|
+
<span
|
|
529
|
+
part="label"
|
|
530
|
+
class=${this.labelHidden ? 'label label-hidden' : 'label'}
|
|
531
|
+
id=${`${this.#id}-label`}
|
|
532
|
+
>${this.label}</span>
|
|
533
|
+
<div
|
|
534
|
+
part="list"
|
|
535
|
+
class="list"
|
|
536
|
+
role="listbox"
|
|
537
|
+
aria-labelledby=${`${this.#id}-label`}
|
|
538
|
+
aria-multiselectable=${this.selectionMode === 'multiple' ? 'true' : nothing}
|
|
539
|
+
aria-disabled=${String(listDisabled)}
|
|
540
|
+
aria-readonly=${this.readOnly ? 'true' : nothing}
|
|
541
|
+
lang=${locale ?? nothing}
|
|
542
|
+
@keydown=${this.#onKeyDown}
|
|
543
|
+
>
|
|
544
|
+
${items.map((item, index) => 'options' in item
|
|
545
|
+
? html `<div
|
|
546
|
+
part="group"
|
|
547
|
+
class="group"
|
|
548
|
+
role="group"
|
|
549
|
+
aria-labelledby=${`${this.#id}-group-${index}-label`}
|
|
550
|
+
>
|
|
551
|
+
<div
|
|
552
|
+
part="group-label"
|
|
553
|
+
class="group-label"
|
|
554
|
+
id=${`${this.#id}-group-${index}-label`}
|
|
555
|
+
>${item.label}</div>
|
|
556
|
+
${item.options.map(renderOption)}
|
|
557
|
+
</div>`
|
|
558
|
+
: renderOption(item))}
|
|
559
|
+
</div>
|
|
560
|
+
</div>
|
|
561
|
+
`;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
define('cosm-listbox', CosmListbox);
|
|
565
|
+
//# sourceMappingURL=cosm-listbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cosm-listbox.js","sourceRoot":"","sources":["../../../src/components/listbox/cosm-listbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,EAInB,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAuB,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,sBAAsB,CAAC;AAU9B,IAAI,QAAQ,GAAG,CAAC,CAAC;AAEjB,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8IjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C,MAAM,CAAU,iBAAiB,GAAmB;QAClD,GAAG,UAAU,CAAC,iBAAiB;QAC/B,cAAc,EAAE,IAAI;KACrB,CAAC;IAEF,MAAM,CAAU,UAAU,GAAG;QA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