@triptease/tt-combobox 5.0.3

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.
@@ -0,0 +1,654 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/TtCombobox.ts",
8
+ "declarations": [
9
+ {
10
+ "kind": "class",
11
+ "description": "",
12
+ "name": "TtCombobox",
13
+ "members": [
14
+ {
15
+ "kind": "field",
16
+ "name": "formAssociated",
17
+ "type": {
18
+ "text": "boolean"
19
+ },
20
+ "static": true,
21
+ "default": "true"
22
+ },
23
+ {
24
+ "kind": "field",
25
+ "name": "shadowRootOptions",
26
+ "type": {
27
+ "text": "object"
28
+ },
29
+ "static": true,
30
+ "default": "{ ...LitElement.shadowRootOptions, delegatesFocus: true }"
31
+ },
32
+ {
33
+ "kind": "field",
34
+ "name": "multiselect",
35
+ "type": {
36
+ "text": "boolean"
37
+ },
38
+ "default": "false",
39
+ "attribute": "multiselect"
40
+ },
41
+ {
42
+ "kind": "field",
43
+ "name": "disabled",
44
+ "type": {
45
+ "text": "boolean"
46
+ },
47
+ "default": "false",
48
+ "attribute": "disabled"
49
+ },
50
+ {
51
+ "kind": "field",
52
+ "name": "invalid",
53
+ "type": {
54
+ "text": "boolean"
55
+ },
56
+ "default": "false",
57
+ "attribute": "invalid"
58
+ },
59
+ {
60
+ "kind": "field",
61
+ "name": "_extValue",
62
+ "type": {
63
+ "text": "string[]"
64
+ },
65
+ "default": "[]"
66
+ },
67
+ {
68
+ "kind": "field",
69
+ "name": "displaySelectAll",
70
+ "type": {
71
+ "text": "boolean"
72
+ },
73
+ "default": "false",
74
+ "attribute": "display-select-all"
75
+ },
76
+ {
77
+ "kind": "field",
78
+ "name": "required",
79
+ "type": {
80
+ "text": "boolean"
81
+ },
82
+ "default": "false",
83
+ "attribute": "required"
84
+ },
85
+ {
86
+ "kind": "field",
87
+ "name": "name",
88
+ "type": {
89
+ "text": "string"
90
+ },
91
+ "default": "''",
92
+ "attribute": "name"
93
+ },
94
+ {
95
+ "kind": "field",
96
+ "name": "ariaLabelledby",
97
+ "default": "nothing",
98
+ "attribute": "aria-labelledby"
99
+ },
100
+ {
101
+ "kind": "field",
102
+ "name": "hideCaret",
103
+ "type": {
104
+ "text": "boolean"
105
+ },
106
+ "default": "false",
107
+ "attribute": "hide-caret"
108
+ },
109
+ {
110
+ "kind": "field",
111
+ "name": "placeholder",
112
+ "type": {
113
+ "text": "string | undefined"
114
+ },
115
+ "attribute": "placeholder"
116
+ },
117
+ {
118
+ "kind": "field",
119
+ "name": "form",
120
+ "type": {
121
+ "text": "HTMLFormElement | null"
122
+ },
123
+ "readonly": true
124
+ },
125
+ {
126
+ "kind": "field",
127
+ "name": "_activeOption",
128
+ "type": {
129
+ "text": "number"
130
+ },
131
+ "privacy": "protected",
132
+ "default": "-1"
133
+ },
134
+ {
135
+ "kind": "field",
136
+ "name": "_expanded",
137
+ "type": {
138
+ "text": "boolean"
139
+ },
140
+ "privacy": "protected",
141
+ "default": "false"
142
+ },
143
+ {
144
+ "kind": "field",
145
+ "name": "_filter",
146
+ "type": {
147
+ "text": "string"
148
+ },
149
+ "privacy": "protected",
150
+ "default": "''"
151
+ },
152
+ {
153
+ "kind": "field",
154
+ "name": "options",
155
+ "type": {
156
+ "text": "Array<HTMLOptionElement>"
157
+ }
158
+ },
159
+ {
160
+ "kind": "field",
161
+ "name": "activeOptions",
162
+ "type": {
163
+ "text": "Array<HTMLOptionElement>"
164
+ }
165
+ },
166
+ {
167
+ "kind": "field",
168
+ "name": "errorElements",
169
+ "type": {
170
+ "text": "Array<HTMLElement>"
171
+ },
172
+ "privacy": "protected"
173
+ },
174
+ {
175
+ "kind": "field",
176
+ "name": "_visibleOptions",
177
+ "type": {
178
+ "text": "Array<HTMLOptionElement>"
179
+ },
180
+ "privacy": "protected"
181
+ },
182
+ {
183
+ "kind": "field",
184
+ "name": "_selectableOptions",
185
+ "type": {
186
+ "text": "Array<HTMLOptionElement>"
187
+ },
188
+ "privacy": "protected"
189
+ },
190
+ {
191
+ "kind": "field",
192
+ "name": "_selectableVisibleOptions",
193
+ "type": {
194
+ "text": "Array<HTMLOptionElement>"
195
+ },
196
+ "privacy": "protected"
197
+ },
198
+ {
199
+ "kind": "field",
200
+ "name": "_selectedOptions",
201
+ "type": {
202
+ "text": "Array<HTMLOptionElement>"
203
+ },
204
+ "privacy": "protected"
205
+ },
206
+ {
207
+ "kind": "field",
208
+ "name": "_selectedVisibleOptions",
209
+ "type": {
210
+ "text": "NodeListOf<HTMLOptionElement>"
211
+ },
212
+ "privacy": "protected"
213
+ },
214
+ {
215
+ "kind": "field",
216
+ "name": "_comboboxInput",
217
+ "type": {
218
+ "text": "HTMLInputElement"
219
+ },
220
+ "privacy": "protected"
221
+ },
222
+ {
223
+ "kind": "field",
224
+ "name": "_chevronButton",
225
+ "type": {
226
+ "text": "HTMLButtonElement"
227
+ },
228
+ "privacy": "protected"
229
+ },
230
+ {
231
+ "kind": "field",
232
+ "name": "internals",
233
+ "type": {
234
+ "text": "ReturnType<typeof this.attachInternals>"
235
+ },
236
+ "privacy": "public"
237
+ },
238
+ {
239
+ "kind": "field",
240
+ "name": "value",
241
+ "type": {
242
+ "text": "string[]"
243
+ },
244
+ "privacy": "public",
245
+ "attribute": "value"
246
+ },
247
+ {
248
+ "kind": "field",
249
+ "name": "_isAllSelected",
250
+ "type": {
251
+ "text": "boolean"
252
+ },
253
+ "privacy": "private",
254
+ "readonly": true
255
+ },
256
+ {
257
+ "kind": "field",
258
+ "name": "_slotObserver",
259
+ "type": {
260
+ "text": "MutationObserver"
261
+ },
262
+ "privacy": "private",
263
+ "default": "new MutationObserver((mutations) => { mutations.forEach(mutation => { if (mutation.type === 'attributes') { this.requestUpdate('options'); } }) })"
264
+ },
265
+ {
266
+ "kind": "method",
267
+ "name": "_handleFocusOut",
268
+ "privacy": "private",
269
+ "parameters": [
270
+ {
271
+ "name": "e",
272
+ "type": {
273
+ "text": "FocusEvent"
274
+ }
275
+ }
276
+ ]
277
+ },
278
+ {
279
+ "kind": "method",
280
+ "name": "_onFocus",
281
+ "privacy": "private"
282
+ },
283
+ {
284
+ "kind": "field",
285
+ "name": "_listenForOptionChange",
286
+ "privacy": "private"
287
+ },
288
+ {
289
+ "kind": "method",
290
+ "name": "reportValidity",
291
+ "privacy": "public"
292
+ },
293
+ {
294
+ "kind": "method",
295
+ "name": "_reportValidity",
296
+ "privacy": "private"
297
+ },
298
+ {
299
+ "kind": "field",
300
+ "name": "labels",
301
+ "type": {
302
+ "text": "Array<HTMLElement>"
303
+ },
304
+ "privacy": "private",
305
+ "readonly": true
306
+ },
307
+ {
308
+ "kind": "field",
309
+ "name": "labelContent",
310
+ "type": {
311
+ "text": "string"
312
+ },
313
+ "privacy": "private",
314
+ "readonly": true
315
+ },
316
+ {
317
+ "kind": "method",
318
+ "name": "_onKeyUp",
319
+ "privacy": "private",
320
+ "parameters": [
321
+ {
322
+ "name": "event",
323
+ "type": {
324
+ "text": "KeyboardEvent"
325
+ }
326
+ }
327
+ ]
328
+ },
329
+ {
330
+ "kind": "method",
331
+ "name": "_uncheckOption",
332
+ "privacy": "private",
333
+ "parameters": [
334
+ {
335
+ "name": "option",
336
+ "type": {
337
+ "text": "HTMLElement"
338
+ }
339
+ }
340
+ ]
341
+ },
342
+ {
343
+ "kind": "method",
344
+ "name": "_checkOption",
345
+ "privacy": "private",
346
+ "parameters": [
347
+ {
348
+ "name": "option",
349
+ "type": {
350
+ "text": "HTMLElement"
351
+ }
352
+ }
353
+ ]
354
+ },
355
+ {
356
+ "kind": "method",
357
+ "name": "_toggleOption",
358
+ "privacy": "private",
359
+ "parameters": [
360
+ {
361
+ "name": "option",
362
+ "type": {
363
+ "text": "HTMLElement"
364
+ }
365
+ }
366
+ ]
367
+ },
368
+ {
369
+ "kind": "method",
370
+ "name": "_getActiveOptionId",
371
+ "privacy": "private",
372
+ "return": {
373
+ "type": {
374
+ "text": "string | undefined"
375
+ }
376
+ }
377
+ },
378
+ {
379
+ "kind": "method",
380
+ "name": "_onClick",
381
+ "privacy": "private"
382
+ },
383
+ {
384
+ "kind": "method",
385
+ "name": "_onChevronClick",
386
+ "privacy": "private"
387
+ },
388
+ {
389
+ "kind": "method",
390
+ "name": "_onClickOption",
391
+ "privacy": "private",
392
+ "parameters": [
393
+ {
394
+ "name": "event",
395
+ "type": {
396
+ "text": "MouseEvent"
397
+ }
398
+ }
399
+ ]
400
+ },
401
+ {
402
+ "kind": "method",
403
+ "name": "_onInput",
404
+ "privacy": "private",
405
+ "parameters": [
406
+ {
407
+ "name": "event",
408
+ "type": {
409
+ "text": "Event"
410
+ }
411
+ }
412
+ ]
413
+ },
414
+ {
415
+ "kind": "method",
416
+ "name": "_dispatchSelectedOptions",
417
+ "privacy": "private"
418
+ },
419
+ {
420
+ "kind": "field",
421
+ "name": "_selectAll",
422
+ "privacy": "private"
423
+ },
424
+ {
425
+ "kind": "field",
426
+ "name": "_isValid",
427
+ "type": {
428
+ "text": "boolean"
429
+ },
430
+ "privacy": "private",
431
+ "readonly": true
432
+ },
433
+ {
434
+ "kind": "method",
435
+ "name": "_renderCombobox",
436
+ "privacy": "private"
437
+ },
438
+ {
439
+ "kind": "field",
440
+ "name": "_renderSelectAll",
441
+ "privacy": "private"
442
+ },
443
+ {
444
+ "kind": "method",
445
+ "name": "_renderOption",
446
+ "privacy": "private",
447
+ "parameters": [
448
+ {
449
+ "name": "option",
450
+ "type": {
451
+ "text": "HTMLOptionElement"
452
+ }
453
+ }
454
+ ]
455
+ },
456
+ {
457
+ "kind": "field",
458
+ "name": "_renderChevron",
459
+ "privacy": "private"
460
+ },
461
+ {
462
+ "kind": "method",
463
+ "name": "_hasErrorContent",
464
+ "privacy": "private",
465
+ "return": {
466
+ "type": {
467
+ "text": "boolean"
468
+ }
469
+ }
470
+ }
471
+ ],
472
+ "events": [
473
+ {
474
+ "name": "change",
475
+ "type": {
476
+ "text": "Event"
477
+ }
478
+ }
479
+ ],
480
+ "attributes": [
481
+ {
482
+ "name": "multiselect",
483
+ "type": {
484
+ "text": "boolean"
485
+ },
486
+ "default": "false",
487
+ "fieldName": "multiselect"
488
+ },
489
+ {
490
+ "name": "disabled",
491
+ "type": {
492
+ "text": "boolean"
493
+ },
494
+ "default": "false",
495
+ "fieldName": "disabled"
496
+ },
497
+ {
498
+ "name": "invalid",
499
+ "type": {
500
+ "text": "boolean"
501
+ },
502
+ "default": "false",
503
+ "fieldName": "invalid"
504
+ },
505
+ {
506
+ "name": "display-select-all",
507
+ "type": {
508
+ "text": "boolean"
509
+ },
510
+ "default": "false",
511
+ "fieldName": "displaySelectAll"
512
+ },
513
+ {
514
+ "name": "required",
515
+ "type": {
516
+ "text": "boolean"
517
+ },
518
+ "default": "false",
519
+ "fieldName": "required"
520
+ },
521
+ {
522
+ "name": "name",
523
+ "type": {
524
+ "text": "string"
525
+ },
526
+ "default": "''",
527
+ "fieldName": "name"
528
+ },
529
+ {
530
+ "name": "aria-labelledby",
531
+ "default": "nothing",
532
+ "fieldName": "ariaLabelledby"
533
+ },
534
+ {
535
+ "name": "hide-caret",
536
+ "type": {
537
+ "text": "boolean"
538
+ },
539
+ "default": "false",
540
+ "fieldName": "hideCaret"
541
+ },
542
+ {
543
+ "name": "placeholder",
544
+ "type": {
545
+ "text": "string | undefined"
546
+ },
547
+ "fieldName": "placeholder"
548
+ },
549
+ {
550
+ "name": "value",
551
+ "type": {
552
+ "text": "string[]"
553
+ },
554
+ "fieldName": "value"
555
+ }
556
+ ],
557
+ "superclass": {
558
+ "name": "LitElement",
559
+ "package": "lit"
560
+ },
561
+ "tagName": "tt-combobox",
562
+ "customElement": true
563
+ }
564
+ ],
565
+ "exports": [
566
+ {
567
+ "kind": "js",
568
+ "name": "TtCombobox",
569
+ "declaration": {
570
+ "name": "TtCombobox",
571
+ "module": "src/TtCombobox.ts"
572
+ }
573
+ }
574
+ ]
575
+ },
576
+ {
577
+ "kind": "javascript-module",
578
+ "path": "src/index.ts",
579
+ "declarations": [],
580
+ "exports": [
581
+ {
582
+ "kind": "js",
583
+ "name": "TtCombobox",
584
+ "declaration": {
585
+ "name": "TtCombobox",
586
+ "module": "./tt-combobox.js"
587
+ }
588
+ }
589
+ ]
590
+ },
591
+ {
592
+ "kind": "javascript-module",
593
+ "path": "src/styles.ts",
594
+ "declarations": [
595
+ {
596
+ "kind": "variable",
597
+ "name": "styles",
598
+ "default": "css` :host { display: flex; flex-direction: var(--tt-combobox-flex-direction, row); align-items: var(--tt-combobox-align-items, center); justify-content: var(--tt-combobox-justify-content, initial); align-content: var(--tt-combobox-align-content, initial); gap: var(--tt-combobox-gap, 0.5rem); font-size: var(--tt-combobox-font-size, var(--font-size-200)); color: var(--tt-combobox-color, var(--color-text-400)); } :host([disabled]) .tt-combobox-container { border-color: var(--tt-combobox-disabled-border-color, var(--color-border-200)); color: var(--tt-combobox-disabled-color, var(--color-text-200)); background-color: var(--tt-combobox-disabled-background-color, var(--color-surface-200)); pointer-events: none; } .tt-combobox-container:focus-within { outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color; } .tt-combobox-container:hover { background-color: var(--tt-combobox-hover-background-color, var(--color-surface-300)); } :host([invalid]) .tt-combobox-container, :host(:state(interacted):invalid) .tt-combobox-container { outline: 1px solid var(--color-alert-400,red); } .errormessage { visibility: hidden; display: flex; align-items: center; gap: var(--space-scale-0-5); color: var(--color-alert-400, red); &[data-hidden] { display: none; } } .errormessage svg path { fill: var(--color-alert-400, red); height: 20px; } .tt-combobox-container:has([role=\"combobox\"][aria-invalid=\"true\"]) ~ .errormessage { visibility: visible; } :has([role=\"combobox\"][aria-invalid=\"true\"]) ::slotted([slot=\"error\"]) { color: var(--color-alert-400,darkred); font-size: var(--font-size-100); margin: 0; font-weight: var(--font-weight-regular); line-height: 1.2; } slot[name=\"option\"]::slotted(*) { display: none; } * { box-sizing: border-box; font-family: var(--font-family-sans); cursor: inherit; } .tt-combobox-container { position: relative; max-width: var(--tt-combobox-max-width, 300px); min-width: var(--tt-combobox-min-width, 250px); display: flex; flex-direction: row; align-items: center; border-radius: var(--border-radius); border-color: var(--tt-combobox-border-color, var(--color-border-400)); border-style: solid; border-width: var(--tt-combobox-border-width, 1px); background-color: var(--tt-combobox-background-color, var(--color-surface-100)); padding: 0.5rem; gap: 0.25rem; //width: 100%; } [role=\"listbox\"] { display: none; } [role=\"combobox\"] { width: 100%; border-style: none; background-color: transparent; font-size: var(--tt-combobox-font-size, var(--font-size-200)); } .hide-caret { caret-color: transparent; } [role=\"combobox\"]::placeholder { color: var(--tt-combobox-placeholder-color, var(--color-text-300)); font-family: var(--font-family-inter); font-size: var(--tt-combobox-font-size, var(--font-size-200)); } :host([disabled]) [role=\"combobox\"]::placeholder { color: var(--tt-combobox-disabled-placeholder-color, var(--color-text-200)); } [role=\"combobox\"]:placeholder-shown { text-overflow: ellipsis; overflow: clip; } [role=\"combobox\"]:focus { outline: none; } [role=\"combobox\"] ~ button { appearance: none; padding: 0; border-width: 0; background-color: transparent; aspect-ratio: 1; } [role=\"combobox\"] ~ button svg { transition: transform 0.2s ease-in-out; color: var(--tt-combobox-dropdown-color, var(--color-text-400)); } [role=\"combobox\"][aria-expanded=\"true\"] ~ button svg { transform: rotate(180deg); } [role=\"combobox\"][aria-expanded=\"true\"] ~ [role=\"listbox\"] { display: block; width: max-content; max-width: var(--tt-combobox-list-max-width, 35ch); min-width: 100%; background-color: var(--color-surface-100); border: 1px solid var(--tt-combobox-border-color, var(--color-border-300)); border-radius: var(--border-radius); box-shadow: var(--box-shadow-lg); padding: 0; position: absolute; top: var(--tt-combobox-top, calc(100% + 0.5rem)); left: var(--tt-combobox-left, 0); right: var(--tt-combobox-right, unset); bottom: var(--tt-combobox-bottom, unset); z-index: 2; margin: 0; list-style: none; max-height: var(--tt-combobox-max-height, 400px); overflow-y: auto; li { display: flex; padding: 0.5rem; box-sizing: border-box; text-align: left; text-overflow: ellipsis; text-wrap: nowrap; align-items: center; gap: 0.25rem; max-width: 100%; width: 100%; overflow-y: visible; flex: 1; input[type=\"checkbox\"] { width: var(--checkbox-size, var(--space-scale-2)); aspect-ratio: 1; flex: 0 0 auto; } span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; line-height: 1.1; } &.no-results { display: none; } &[aria-hidden=\"true\"] { visibility: hidden; display: none; } } &:not(:has([role=\"option\"]:not([data-value=\"select-all\"]))) { .no-results { display: flex; } .select-all { display: none; } } } slot[name=\"icon\"] { display: inline-block; max-width: var(--tt-combobox-icon-size,1rem); aspect-ratio: 1; } [role=\"option\"].select-all { border-bottom: 1px solid var(--color-border-300); } [aria-multiselectable=\"false\"] [role=\"option\"][aria-selected=\"true\"] { color: var(--color-primary-400); font-weight: var(--font-weight-medium); } [role=\"option\"]:is(:hover, [data-active=\"true\"]) { background-color: var(--color-surface-300); &:first-child { border-top-left-radius: var(--border-radius); border-top-right-radius: var(--border-radius); } &:last-child { border-bottom-left-radius: var(--border-radius); border-bottom-right-radius: var(--border-radius); } } [role=\"option\"]:hover { cursor: pointer; } [role=\"option\"][aria-disabled=\"true\"] { pointer-events: none; opacity: 0.5; } [role=\"listbox\"][aria-multiselectable=\"true\"] [role=\"option\"] input[type=\"checkbox\"] { accent-color: var(--color-primary-400); width: var(--checkbox-size, var(--space-scale-2)); aspect-ratio: 1; pointer-events: none; } [role=\"listbox\"][aria-multiselectable=\"true\"] [role=\"option\"][aria-disabled=\"true\"] input[type=\"checkbox\"] { pointer-events: none; } label { font-size: var(--tt-combobox-label-font-size, inherit); color: var(--tt-combobox-label-color, inherit); font-weight: var(--tt-combobox-label-font-weight, inherit); &[data-hidden] { display: none; } } `"
599
+ }
600
+ ],
601
+ "exports": [
602
+ {
603
+ "kind": "js",
604
+ "name": "styles",
605
+ "declaration": {
606
+ "name": "styles",
607
+ "module": "src/styles.ts"
608
+ }
609
+ }
610
+ ]
611
+ },
612
+ {
613
+ "kind": "javascript-module",
614
+ "path": "src/tt-combobox.ts",
615
+ "declarations": [],
616
+ "exports": [
617
+ {
618
+ "kind": "custom-element-definition",
619
+ "name": "tt-combobox",
620
+ "declaration": {
621
+ "name": "TtCombobox",
622
+ "module": "/src/TtCombobox.js"
623
+ }
624
+ },
625
+ {
626
+ "kind": "js",
627
+ "name": "TtCombobox",
628
+ "declaration": {
629
+ "name": "TtCombobox",
630
+ "module": "src/tt-combobox.ts"
631
+ }
632
+ }
633
+ ]
634
+ },
635
+ {
636
+ "kind": "javascript-module",
637
+ "path": "coverage/lcov-report/block-navigation.js",
638
+ "declarations": [],
639
+ "exports": []
640
+ },
641
+ {
642
+ "kind": "javascript-module",
643
+ "path": "coverage/lcov-report/prettify.js",
644
+ "declarations": [],
645
+ "exports": []
646
+ },
647
+ {
648
+ "kind": "javascript-module",
649
+ "path": "coverage/lcov-report/sorter.js",
650
+ "declarations": [],
651
+ "exports": []
652
+ }
653
+ ]
654
+ }
@@ -0,0 +1,30 @@
1
+ <!doctype html>
2
+ <html lang="en-GB">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
6
+ <style>
7
+ body {
8
+ background: #fafafa;
9
+ }
10
+ </style>
11
+ </head>
12
+ <body>
13
+ <div id="demo"></div>
14
+
15
+ <script type="module">
16
+ import { html, render } from 'lit';
17
+ import '../dist/src/tt-combobox.js';
18
+
19
+ const header = 'Hello owc World!';
20
+ render(
21
+ html`
22
+ <tt-combobox .header=${header}>
23
+ some light-dom
24
+ </tt-combobox>
25
+ `,
26
+ document.querySelector('#demo')
27
+ );
28
+ </script>
29
+ </body>
30
+ </html>