kr-elements 0.0.1-alpha.2 → 0.0.1-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/combobox/Boolean.attribute.value.normalizer.js +2 -2
- package/dist/cjs/combobox/Combobox.markup.js +22 -5
- package/dist/cjs/combobox/HTML.combobox.element.js +35 -23
- package/dist/cjs/combobox/HTML.combobox.option.element.js +42 -37
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/esm/combobox/Boolean.attribute.value.normalizer.js +1 -0
- package/dist/esm/combobox/Combobox.markup.js +22 -5
- package/dist/esm/combobox/HTML.combobox.element.js +21 -11
- package/dist/esm/combobox/HTML.combobox.option.element.js +34 -31
- package/dist/esm/index.js +3 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/types/combobox/Boolean.attribute.value.normalizer.d.ts +2 -0
- package/dist/types/combobox/Boolean.attribute.value.normalizer.d.ts.map +1 -0
- package/dist/types/combobox/Combobox.markup.d.ts +2 -0
- package/dist/types/combobox/Combobox.markup.d.ts.map +1 -0
- package/dist/types/combobox/HTML.combobox.element.d.ts +1 -0
- package/dist/types/combobox/HTML.combobox.element.d.ts.map +1 -0
- package/dist/types/combobox/HTML.combobox.option.element.d.ts +1 -0
- package/dist/types/combobox/HTML.combobox.option.element.d.ts.map +1 -0
- package/dist/types/combobox/HTML.combobox.tag.element.d.ts +1 -0
- package/dist/types/combobox/HTML.combobox.tag.element.d.ts.map +1 -0
- package/dist/types/combobox/index.d.ts +1 -0
- package/dist/types/combobox/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +174 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -0
- package/dist/types/types.d.ts +198 -0
- package/package.json +13 -14
- package/dist/cjs/Boolean.attribute.value.normalizer.js +0 -11
- package/dist/cjs/Combobox.markup.js +0 -315
- package/dist/cjs/HTML.combobox.element.js +0 -317
- package/dist/cjs/HTML.combobox.option.element.js +0 -95
- package/dist/cjs/HTML.combobox.tag.element.js +0 -22
- package/dist/esm/Boolean.attribute.value.normalizer.js +0 -7
- package/dist/esm/Combobox.markup.js +0 -311
- package/dist/esm/HTML.combobox.element.js +0 -313
- package/dist/esm/HTML.combobox.option.element.js +0 -91
- package/dist/esm/HTML.combobox.tag.element.js +0 -18
- package/dist/types/Boolean.attribute.value.normalizer.d.ts +0 -2
- package/dist/types/Boolean.attribute.value.normalizer.d.ts.map +0 -1
- package/dist/types/Combobox.markup.d.ts +0 -26
- package/dist/types/Combobox.markup.d.ts.map +0 -1
- package/dist/types/HTML.combobox.element.d.ts +0 -50
- package/dist/types/HTML.combobox.element.d.ts.map +0 -1
- package/dist/types/HTML.combobox.option.element.d.ts +0 -15
- package/dist/types/HTML.combobox.option.element.d.ts.map +0 -1
- package/dist/types/HTML.combobox.tag.element.d.ts +0 -4
- package/dist/types/HTML.combobox.tag.element.d.ts.map +0 -1
|
@@ -22,6 +22,7 @@ export class HTMLComboboxElement extends HTMLElement {
|
|
|
22
22
|
this.shadowRoot.adoptedStyleSheets = HTMLComboboxElement.styleSheet;
|
|
23
23
|
this.#observer = new MutationObserver(this.#onOptionsChanges);
|
|
24
24
|
}
|
|
25
|
+
// Lifecycle callbacks
|
|
25
26
|
connectedCallback() {
|
|
26
27
|
this.#markup.connect();
|
|
27
28
|
this.#initialAttributesSynchronization();
|
|
@@ -44,6 +45,8 @@ export class HTMLComboboxElement extends HTMLElement {
|
|
|
44
45
|
formDisabledCallback(isDisabled) {
|
|
45
46
|
this.disabled = isDisabled;
|
|
46
47
|
}
|
|
48
|
+
// Instance properties
|
|
49
|
+
// readonly
|
|
47
50
|
get valueAsArray() {
|
|
48
51
|
return Array.from(this.#values);
|
|
49
52
|
}
|
|
@@ -56,6 +59,7 @@ export class HTMLComboboxElement extends HTMLElement {
|
|
|
56
59
|
get willValidate() {
|
|
57
60
|
return this.internals.willValidate;
|
|
58
61
|
}
|
|
62
|
+
// configurable
|
|
59
63
|
get value() {
|
|
60
64
|
return this.valueAsArray.join(',');
|
|
61
65
|
}
|
|
@@ -93,60 +97,65 @@ export class HTMLComboboxElement extends HTMLElement {
|
|
|
93
97
|
});
|
|
94
98
|
}
|
|
95
99
|
get query() {
|
|
96
|
-
return this
|
|
100
|
+
return this.getAttribute('query');
|
|
97
101
|
}
|
|
98
102
|
set query(value) {
|
|
99
103
|
if (value === this.query)
|
|
100
104
|
return;
|
|
101
|
-
this.#markup.searchInput.value = value;
|
|
102
105
|
super.setAttribute('query', value);
|
|
106
|
+
if (this.#markup.connected) {
|
|
107
|
+
this.#markup.searchInput.value = value;
|
|
108
|
+
}
|
|
103
109
|
}
|
|
104
110
|
get clearable() {
|
|
105
111
|
return this.hasAttribute('clearable');
|
|
106
112
|
}
|
|
107
113
|
set clearable(value) {
|
|
108
|
-
super.toggleAttribute('clearable', value);
|
|
114
|
+
super.toggleAttribute('clearable', toBoolean(value));
|
|
109
115
|
}
|
|
110
116
|
get multiple() {
|
|
111
117
|
return this.hasAttribute('multiple');
|
|
112
118
|
}
|
|
113
119
|
set multiple(value) {
|
|
114
|
-
super.toggleAttribute('multiple', value);
|
|
120
|
+
super.toggleAttribute('multiple', toBoolean(value));
|
|
115
121
|
}
|
|
116
122
|
get filterable() {
|
|
117
123
|
return this.hasAttribute('filterable');
|
|
118
124
|
}
|
|
119
125
|
set filterable(value) {
|
|
120
|
-
super.toggleAttribute('filterable', value);
|
|
126
|
+
super.toggleAttribute('filterable', toBoolean(value));
|
|
121
127
|
}
|
|
122
128
|
get searchable() {
|
|
123
129
|
return this.hasAttribute('searchable');
|
|
124
130
|
}
|
|
125
131
|
set searchable(value) {
|
|
126
|
-
super.toggleAttribute('searchable', value);
|
|
132
|
+
super.toggleAttribute('searchable', toBoolean(value));
|
|
127
133
|
}
|
|
128
134
|
get disabled() {
|
|
129
135
|
return this.hasAttribute('disabled');
|
|
130
136
|
}
|
|
131
137
|
set disabled(value) {
|
|
132
138
|
this.internals.ariaDisabled = String(value);
|
|
133
|
-
super.toggleAttribute('disabled', value);
|
|
139
|
+
super.toggleAttribute('disabled', toBoolean(value));
|
|
134
140
|
}
|
|
135
141
|
get required() {
|
|
136
142
|
return this.hasAttribute('required');
|
|
137
143
|
}
|
|
138
144
|
set required(value) {
|
|
139
145
|
this.internals.ariaRequired = String(value);
|
|
140
|
-
super.toggleAttribute('required', value);
|
|
146
|
+
super.toggleAttribute('required', toBoolean(value));
|
|
141
147
|
}
|
|
142
148
|
get placeholder() {
|
|
143
|
-
return this
|
|
149
|
+
return this.getAttribute('placeholder');
|
|
144
150
|
}
|
|
145
151
|
set placeholder(value) {
|
|
146
|
-
this.#markup.placeholder.innerText = value;
|
|
147
|
-
this.#markup.searchInput.placeholder = value;
|
|
148
152
|
super.setAttribute('placeholder', value);
|
|
153
|
+
if (this.#markup.connected) {
|
|
154
|
+
this.#markup.placeholder.innerText = value;
|
|
155
|
+
this.#markup.searchInput.placeholder = value;
|
|
156
|
+
}
|
|
149
157
|
}
|
|
158
|
+
// Instance methods
|
|
150
159
|
setAttribute(name, value) {
|
|
151
160
|
if (HTMLComboboxElement.booleanAttributes.has(name)) {
|
|
152
161
|
Reflect.set(this, name, toBoolean(value));
|
|
@@ -182,6 +191,7 @@ export class HTMLComboboxElement extends HTMLElement {
|
|
|
182
191
|
this.internals.setValidity({ customError: true }, message);
|
|
183
192
|
}
|
|
184
193
|
}
|
|
194
|
+
// Internal
|
|
185
195
|
#onInput = (event) => {
|
|
186
196
|
if (this.filterable) {
|
|
187
197
|
if (event.target && event.target instanceof HTMLInputElement) {
|
|
@@ -7,23 +7,48 @@ export class HTMLComboboxOptionElement extends HTMLElement {
|
|
|
7
7
|
super.setAttribute('part', 'box-option');
|
|
8
8
|
super.setAttribute('tabindex', "0");
|
|
9
9
|
super.setAttribute('role', "option");
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const value = this.value;
|
|
11
|
+
const label = this.label;
|
|
12
|
+
const hasNoMarkup = this.children.length === 0;
|
|
13
|
+
const text = this.textContent.trim();
|
|
14
|
+
const hasText = text.length > 0;
|
|
15
|
+
if (!value && !label) {
|
|
16
|
+
console.log('!value && !label');
|
|
17
|
+
if (hasNoMarkup && hasText) {
|
|
18
|
+
this.value = text;
|
|
19
|
+
this.label = text;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
throw new Error('box-option must have value and label attributes');
|
|
23
|
+
}
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (value && !label) {
|
|
27
|
+
if (hasNoMarkup && hasText) {
|
|
28
|
+
this.label = text;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
this.label = value;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (!value && label) {
|
|
35
|
+
this.value = label;
|
|
36
|
+
}
|
|
37
|
+
if (hasNoMarkup && !hasText) {
|
|
38
|
+
this.textContent = label || value;
|
|
12
39
|
}
|
|
13
40
|
}
|
|
14
41
|
get value() {
|
|
15
42
|
return this.getAttribute('value');
|
|
16
43
|
}
|
|
17
44
|
set value(value) {
|
|
18
|
-
|
|
19
|
-
super.setAttribute('value', value);
|
|
45
|
+
super.setAttribute('value', String(value));
|
|
20
46
|
}
|
|
21
47
|
get label() {
|
|
22
|
-
return this.getAttribute('
|
|
48
|
+
return this.getAttribute('label');
|
|
23
49
|
}
|
|
24
50
|
set label(value) {
|
|
25
|
-
|
|
26
|
-
super.setAttribute('label', value);
|
|
51
|
+
super.setAttribute('label', String(value));
|
|
27
52
|
}
|
|
28
53
|
get selected() {
|
|
29
54
|
return this.hasAttribute('selected');
|
|
@@ -37,32 +62,10 @@ export class HTMLComboboxOptionElement extends HTMLElement {
|
|
|
37
62
|
Reflect.set(this, key, value);
|
|
38
63
|
}
|
|
39
64
|
for (const key of HTMLComboboxOptionElement.stringAttributes) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
get #optionHasOnlyTextNode() {
|
|
44
|
-
return this.children.length === 0 && this.textContent.length > 0;
|
|
45
|
-
}
|
|
46
|
-
#getOrExtractValue(value, name) {
|
|
47
|
-
if (typeof value === 'string')
|
|
48
|
-
return value;
|
|
49
|
-
if (value == null) {
|
|
50
|
-
const opposite = name === 'label' ? 'value' : 'label';
|
|
51
|
-
const oppositeValue = this.getAttribute(opposite);
|
|
52
|
-
if (oppositeValue) {
|
|
53
|
-
value = oppositeValue;
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
if (this.#optionHasOnlyTextNode) {
|
|
57
|
-
value = this.textContent;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
throw new TypeError('No value, or label or textContent found');
|
|
61
|
-
}
|
|
65
|
+
if (this.hasAttribute(key)) {
|
|
66
|
+
Reflect.set(this, key, this.getAttribute(key));
|
|
62
67
|
}
|
|
63
|
-
return value;
|
|
64
68
|
}
|
|
65
|
-
throw new TypeError('Invalid value');
|
|
66
69
|
}
|
|
67
70
|
setAttribute(name, value) {
|
|
68
71
|
if (HTMLComboboxOptionElement.booleanAttributes.has(name)) {
|
package/dist/esm/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../../src/index.ts","../../src/combobox/boolean.attribute.value.normalizer.ts","../../src/combobox/combobox.markup.ts","../../src/combobox/html.combobox.element.ts","../../src/combobox/html.combobox.option.element.ts","../../src/combobox/html.combobox.tag.element.ts","../../src/combobox/index.ts"],"version":"5.9.3"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Boolean.attribute.value.normalizer.d.ts","sourceRoot":"","sources":["../../../src/combobox/Boolean.attribute.value.normalizer.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,WAInC"}
|
|
@@ -8,6 +8,7 @@ export declare class ComboboxMarkup {
|
|
|
8
8
|
dropdown: HTMLDivElement | null;
|
|
9
9
|
placeholder: HTMLDivElement | null;
|
|
10
10
|
searchInput: HTMLInputElement | null;
|
|
11
|
+
connected: boolean;
|
|
11
12
|
constructor(shadowRoot: ShadowRoot, internals: ElementInternals);
|
|
12
13
|
connect(): void;
|
|
13
14
|
sort(query: string): void;
|
|
@@ -23,3 +24,4 @@ export declare class ComboboxMarkup {
|
|
|
23
24
|
get selectedOptions(): NodeListOf<HTMLComboboxOptionElement>;
|
|
24
25
|
static get template(): string;
|
|
25
26
|
}
|
|
27
|
+
//# sourceMappingURL=Combobox.markup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Combobox.markup.d.ts","sourceRoot":"","sources":["../../../src/combobox/Combobox.markup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E,qBAAa,cAAc;;IAGzB,aAAa,EAAE,cAAc,GAAG,IAAI,CAAQ;IAC5C,gBAAgB,EAAE,cAAc,GAAG,IAAI,CAAQ;IAC/C,cAAc,EAAE,iBAAiB,GAAG,IAAI,CAAQ;IAChD,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAQ;IACvC,WAAW,EAAE,cAAc,GAAG,IAAI,CAAQ;IAC1C,WAAW,EAAE,gBAAgB,GAAG,IAAI,CAAQ;IAE5C,SAAS,UAAS;gBAEN,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB;IAU/D,OAAO;IAcP,IAAI,CAAC,KAAK,EAAE,MAAM;IAiBlB,UAAU;IASV,YAAY,aAIX;IAED,mBAAmB,CAAC,IAAI,EAAE,OAAO;IAmBjC,YAAY,aAUX;IAED,YAAY,GAAI,OAAO,KAAK,UAU3B;IAED,kBAAkB,CAAC,MAAM,EAAE,yBAAyB;IAqBpD,aAAa,CAAC,KAAK,EAAE,MAAM;IAI3B,gBAAgB,CAAC,KAAK,EAAE,MAAM;IAI9B,IAAI,WA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D,IAAI,QAAQ,CAAC,KAAK,SAAA,EAGjB;IAED,IAAI,WAAW,WAEd;IACD,IAAI,WAAW,CAAC,KAAK,QAAA,EAMpB;IAID,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAYrC,eAAe,CAAC,IAAI,EAAE,MAAM;IAW5B,cAAc;IAId,aAAa;IAIb,iBAAiB,CAAC,OAAO,EAAE,MAAM;IAgHjC,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE;IAIzC,MAAM,CAAC,8BAA8B;CAoBtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HTML.combobox.option.element.d.ts","sourceRoot":"","sources":["../../../src/combobox/HTML.combobox.option.element.ts"],"names":[],"mappings":"AAEA,qBAAa,yBAA0B,SAAQ,WAAW;;IACxD,MAAM,CAAC,iBAAiB,cAAyB;IACjD,MAAM,CAAC,gBAAgB,cAA+B;IAEtD,iBAAiB;IA2CjB,IAAI,KAAK,WAER;IACD,IAAI,KAAK,CAAC,KAAK,QAAA,EAEd;IAED,IAAI,KAAK,WAER;IACD,IAAI,KAAK,CAAC,KAAK,QAAA,EAEd;IAED,IAAI,QAAQ,YAEX;IACD,IAAI,QAAQ,CAAC,KAAK,SAAA,EAEjB;IAcD,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAYxC,eAAe,CAAC,IAAI,EAAE,MAAM;CAU7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HTML.combobox.tag.element.d.ts","sourceRoot":"","sources":["../../../src/combobox/HTML.combobox.tag.element.ts"],"names":[],"mappings":"AAAA,qBAAa,sBAAuB,SAAQ,WAAW;IACrD,iBAAiB;CAalB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/combobox/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,175 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './combobox/index.js';
|
|
2
|
+
interface HTMLComboboxTagElement extends HTMLElement {
|
|
3
|
+
}
|
|
4
|
+
interface HTMLComboboxOptionElement extends HTMLOptionElement {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
interface HTMLComboboxElement extends HTMLSelectElement {
|
|
9
|
+
/** List of selected options value attribute */
|
|
10
|
+
valueAsArray: string[];
|
|
11
|
+
multiple: boolean;
|
|
12
|
+
/** The value of internal input
|
|
13
|
+
*
|
|
14
|
+
* Internal input is visible when either "searchable" or "filterable" attribute is presented */
|
|
15
|
+
query: string;
|
|
16
|
+
/** The placeholder of internal input
|
|
17
|
+
*
|
|
18
|
+
* Internal input is visible when either "searchable" or "filterable" attribute is presented
|
|
19
|
+
*
|
|
20
|
+
* When <combo-box> is empty, this value is also shown as <combo-box> placeholder itself
|
|
21
|
+
* */
|
|
22
|
+
placeholder: string;
|
|
23
|
+
/** When is true, the clear-all-button is shown in the <combo-box> itself,
|
|
24
|
+
* and the clear-button is shown for each selected tag.
|
|
25
|
+
*
|
|
26
|
+
* If multiple attribute is set to "true", this is also enabled.
|
|
27
|
+
*
|
|
28
|
+
* If multiple attribute is set to "false", i.e. the <combo-box> is used as a <select>,
|
|
29
|
+
* then setting this attribute to "true" will make the clear-button of selected tag visible
|
|
30
|
+
* */
|
|
31
|
+
clearable: boolean;
|
|
32
|
+
/** When is true, the internal input is shown.
|
|
33
|
+
*
|
|
34
|
+
* When user type something, available options are not filtered by this query.
|
|
35
|
+
* You have to set an "input" listener to the <combo-box> and filter options by yourself
|
|
36
|
+
*
|
|
37
|
+
* Setting both "searchable" and "filterable" make no sense, the "searchable" will have priority
|
|
38
|
+
* */
|
|
39
|
+
searchable: boolean;
|
|
40
|
+
/** When is true, the internal input is shown.
|
|
41
|
+
*
|
|
42
|
+
* When user type something, available options are filtered by this query.
|
|
43
|
+
*
|
|
44
|
+
* Setting both "filterable" and "searchable" make no sense, the "searchable" will have priority
|
|
45
|
+
* */
|
|
46
|
+
filterable: boolean;
|
|
47
|
+
selectedOptions: HTMLCollectionOf<HTMLComboboxOptionElement>;
|
|
48
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLComboboxElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
49
|
+
addEventListener<K extends keyof ComboboxEventMap>(type: K, listener: (this: HTMLComboboxElement, ev: ComboboxEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
50
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
51
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLComboboxElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
52
|
+
removeEventListener<K extends keyof ComboboxEventMap>(type: K, listener: (this: HTMLComboboxElement, ev: ComboboxEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
53
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
54
|
+
}
|
|
55
|
+
interface ComboboxEvent extends Event {
|
|
56
|
+
readonly target: HTMLComboboxElement;
|
|
57
|
+
readonly currentTarget: HTMLComboboxElement;
|
|
58
|
+
}
|
|
59
|
+
interface ComboboxInputEvent extends InputEvent {
|
|
60
|
+
readonly target: HTMLComboboxElement;
|
|
61
|
+
readonly currentTarget: HTMLComboboxElement;
|
|
62
|
+
}
|
|
63
|
+
interface ComboboxFocusEvent extends FocusEvent {
|
|
64
|
+
readonly target: HTMLComboboxElement;
|
|
65
|
+
}
|
|
66
|
+
interface ComboboxEventMap extends HTMLElementEventMap {
|
|
67
|
+
"change": ComboboxEvent;
|
|
68
|
+
"blur": ComboboxFocusEvent;
|
|
69
|
+
"focus": ComboboxFocusEvent;
|
|
70
|
+
"focusin": ComboboxFocusEvent;
|
|
71
|
+
"focusout": ComboboxFocusEvent;
|
|
72
|
+
"input": ComboboxInputEvent;
|
|
73
|
+
"invalid": ComboboxEvent;
|
|
74
|
+
"selectionchange": ComboboxEvent;
|
|
75
|
+
"selectstart": ComboboxEvent;
|
|
76
|
+
}
|
|
77
|
+
interface ComboboxJsxAttributes {
|
|
78
|
+
/** The value of the internal input.
|
|
79
|
+
*
|
|
80
|
+
* The internal input is visible when either the `searchable` or `filterable` attribute is present.
|
|
81
|
+
*
|
|
82
|
+
* Setting ""
|
|
83
|
+
* */
|
|
84
|
+
query?: string;
|
|
85
|
+
/** A comma-separated list of descendant `<box-option>` value attributes to be selected by default.
|
|
86
|
+
*
|
|
87
|
+
* When the `multiple` attribute is present, only the first option will be selected.
|
|
88
|
+
*
|
|
89
|
+
* Alternatively, you can set default selections by adding the `selected` attribute directly to individual `<box-option>` elements. */
|
|
90
|
+
value?: string;
|
|
91
|
+
/** This Boolean attribute indicates that multiple options can be selected.
|
|
92
|
+
*
|
|
93
|
+
* When present, users can select multiple options. When absent, only one option can be selected at a time (the `<combo-box>` behaves like a `<select>`). */
|
|
94
|
+
multiple?: boolean;
|
|
95
|
+
/** The placeholder for the internal input.
|
|
96
|
+
*
|
|
97
|
+
* The internal input is visible when either the `searchable` or `filterable` attribute is present.
|
|
98
|
+
*
|
|
99
|
+
* When the `<combo-box>` is empty, this value is also shown as the `<combo-box>` placeholder itself. */
|
|
100
|
+
placeholder?: string;
|
|
101
|
+
/** When present, the clear-all button is shown in the `<combo-box>` itself, and the clear button is shown for each selected tag.
|
|
102
|
+
*
|
|
103
|
+
* This attribute is automatically enabled when the `multiple` attribute is present.
|
|
104
|
+
*
|
|
105
|
+
* When the `multiple` attribute is absent (single-select mode), setting `clearable` makes the clear button visible on the selected tag. */
|
|
106
|
+
clearable?: boolean;
|
|
107
|
+
/** When present, the internal input is shown.
|
|
108
|
+
*
|
|
109
|
+
* As the user types, available options are **not** filtered by the query. You must attach an `input` listener to the `<combo-box>` and filter options manually.
|
|
110
|
+
*
|
|
111
|
+
* Setting both `searchable` and `filterable` is not recommended—`searchable` takes precedence. */
|
|
112
|
+
searchable?: boolean;
|
|
113
|
+
/** When present, the internal input is shown.
|
|
114
|
+
*
|
|
115
|
+
* As the user types, available options are filtered by the query automatically.
|
|
116
|
+
*
|
|
117
|
+
* Setting both `filterable` and `searchable` is not recommended—`searchable` takes precedence. */
|
|
118
|
+
filterable?: boolean;
|
|
119
|
+
/** A Boolean attribute indicating that at least one option must be selected. */
|
|
120
|
+
required?: boolean;
|
|
121
|
+
disabled?: boolean;
|
|
122
|
+
}
|
|
123
|
+
interface ComboboxOptionJsxAttributes {
|
|
124
|
+
value: string;
|
|
125
|
+
label?: string;
|
|
126
|
+
selected?: boolean;
|
|
127
|
+
}
|
|
128
|
+
declare global {
|
|
129
|
+
namespace React {
|
|
130
|
+
namespace JSX {
|
|
131
|
+
interface IntrinsicElements {
|
|
132
|
+
'combo-box': React.DetailedHTMLProps<Omit<React.HTMLAttributes<HTMLComboboxElement>, 'defaultValue'>, HTMLComboboxElement> & ComboboxJsxAttributes;
|
|
133
|
+
'box-option': React.DetailedHTMLProps<React.HTMLAttributes<HTMLComboboxOptionElement>, HTMLComboboxOptionElement> & ComboboxOptionJsxAttributes;
|
|
134
|
+
'box-tag': React.DetailedHTMLProps<React.HTMLAttributes<HTMLComboboxTagElement>, HTMLComboboxTagElement>;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
namespace preact {
|
|
139
|
+
namespace JSX {
|
|
140
|
+
interface IntrinsicElements {
|
|
141
|
+
'combo-box': preact.HTMLAttributes<HTMLComboboxElement> & ComboboxJsxAttributes;
|
|
142
|
+
'box-option': preact.HTMLAttributes<HTMLComboboxOptionElement> & ComboboxOptionJsxAttributes;
|
|
143
|
+
'box-tag': preact.HTMLAttributes<HTMLComboboxTagElement>;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
declare module 'preact' {
|
|
149
|
+
namespace JSX {
|
|
150
|
+
interface IntrinsicElements {
|
|
151
|
+
'combo-box': preact.HTMLAttributes<HTMLComboboxElement> & ComboboxJsxAttributes;
|
|
152
|
+
'box-option': preact.HTMLAttributes<HTMLComboboxOptionElement> & ComboboxOptionJsxAttributes;
|
|
153
|
+
'box-tag': preact.HTMLAttributes<HTMLComboboxTagElement>;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
declare module 'solid-js' {
|
|
158
|
+
namespace JSX {
|
|
159
|
+
interface IntrinsicElements {
|
|
160
|
+
'combo-box': HTMLAttributes<HTMLComboboxElement> & ComboboxJsxAttributes;
|
|
161
|
+
'box-option': HTMLAttributes<HTMLComboboxOptionElement> & ComboboxOptionJsxAttributes;
|
|
162
|
+
'box-tag': HTMLAttributes<HTMLElement>;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
declare global {
|
|
167
|
+
namespace JSX {
|
|
168
|
+
interface IntrinsicElements {
|
|
169
|
+
'combo-box': ComboboxJsxAttributes;
|
|
170
|
+
'box-option': ComboboxOptionJsxAttributes;
|
|
171
|
+
'box-tag': HTMLElement;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
2
175
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,qBAAqB,CAAC;AAEpC,UAAU,sBAAuB,SAAQ,WAAW;CAAG;AAEvD,UAAU,yBAA0B,SAAQ,iBAAiB;IAC3D,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,UAAU,mBAAoB,SAAQ,iBAAiB;IACrD,+CAA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AAED,OAAO,QAAQ,QAAQ,CAAC;IACtB,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB,WAAW,EAAE,MAAM,CAAC,cAAc,CAAC,mBAAmB,CAAC,GAAG,qBAAqB,CAAC;YAChF,YAAY,EAAE,MAAM,CAAC,cAAc,CAAC,yBAAyB,CAAC,GAAG,2BAA2B,CAAC;YAC7F,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,sBAAsB,CAAC,CAAC;SAC1D;KACF;CACF;AAGD,OAAO,QAAQ,UAAU,CAAC;IACxB,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB,WAAW,EAAE,cAAc,CAAC,mBAAmB,CAAC,GAAG,qBAAqB,CAAA;YACxE,YAAY,EAAE,cAAc,CAAC,yBAAyB,CAAC,GAAG,2BAA2B,CAAA;YACrF,SAAS,EAAE,cAAc,CAAC,WAAW,CAAC,CAAA;SACvC;KACF;CACF;AAGD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB,WAAW,EAAE,qBAAqB,CAAC;YACnC,YAAY,EAAE,2BAA2B,CAAC;YAC1C,SAAS,EAAE,WAAW,CAAC;SACxB;KACF;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../../src/index.ts","../../src/combobox/boolean.attribute.value.normalizer.ts","../../src/combobox/combobox.markup.ts","../../src/combobox/html.combobox.element.ts","../../src/combobox/html.combobox.option.element.ts","../../src/combobox/html.combobox.tag.element.ts","../../src/combobox/index.ts"],"version":"5.9.3"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
interface HTMLComboboxTagElement extends HTMLElement {}
|
|
2
|
+
|
|
3
|
+
interface HTMLComboboxOptionElement extends HTMLOptionElement {
|
|
4
|
+
value: string
|
|
5
|
+
label: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface HTMLComboboxElement extends HTMLSelectElement {
|
|
9
|
+
/** List of selected options value attribute */
|
|
10
|
+
valueAsArray: string[];
|
|
11
|
+
|
|
12
|
+
multiple: boolean;
|
|
13
|
+
|
|
14
|
+
/** The value of internal input
|
|
15
|
+
*
|
|
16
|
+
* Internal input is visible when either "searchable" or "filterable" attribute is presented */
|
|
17
|
+
query: string;
|
|
18
|
+
|
|
19
|
+
/** The placeholder of internal input
|
|
20
|
+
*
|
|
21
|
+
* Internal input is visible when either "searchable" or "filterable" attribute is presented
|
|
22
|
+
*
|
|
23
|
+
* When <combo-box> is empty, this value is also shown as <combo-box> placeholder itself
|
|
24
|
+
* */
|
|
25
|
+
placeholder: string;
|
|
26
|
+
|
|
27
|
+
/** When is true, the clear-all-button is shown in the <combo-box> itself,
|
|
28
|
+
* and the clear-button is shown for each selected tag.
|
|
29
|
+
*
|
|
30
|
+
* If multiple attribute is set to "true", this is also enabled.
|
|
31
|
+
*
|
|
32
|
+
* If multiple attribute is set to "false", i.e. the <combo-box> is used as a <select>,
|
|
33
|
+
* then setting this attribute to "true" will make the clear-button of selected tag visible
|
|
34
|
+
* */
|
|
35
|
+
clearable: boolean;
|
|
36
|
+
|
|
37
|
+
/** When is true, the internal input is shown.
|
|
38
|
+
*
|
|
39
|
+
* When user type something, available options are not filtered by this query.
|
|
40
|
+
* You have to set an "input" listener to the <combo-box> and filter options by yourself
|
|
41
|
+
*
|
|
42
|
+
* Setting both "searchable" and "filterable" make no sense, the "searchable" will have priority
|
|
43
|
+
* */
|
|
44
|
+
searchable: boolean;
|
|
45
|
+
|
|
46
|
+
/** When is true, the internal input is shown.
|
|
47
|
+
*
|
|
48
|
+
* When user type something, available options are filtered by this query.
|
|
49
|
+
*
|
|
50
|
+
* Setting both "filterable" and "searchable" make no sense, the "searchable" will have priority
|
|
51
|
+
* */
|
|
52
|
+
filterable: boolean;
|
|
53
|
+
|
|
54
|
+
selectedOptions: HTMLCollectionOf<HTMLComboboxOptionElement>;
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
// For standard events - let TypeScript infer correctly
|
|
58
|
+
addEventListener<K extends keyof HTMLElementEventMap>(
|
|
59
|
+
type: K,
|
|
60
|
+
listener: (this: HTMLComboboxElement, ev: HTMLElementEventMap[K]) => any,
|
|
61
|
+
options?: boolean | AddEventListenerOptions
|
|
62
|
+
): void;
|
|
63
|
+
|
|
64
|
+
// For your custom events
|
|
65
|
+
addEventListener<K extends keyof ComboboxEventMap>(
|
|
66
|
+
type: K,
|
|
67
|
+
listener: (this: HTMLComboboxElement, ev: ComboboxEventMap[K]) => any,
|
|
68
|
+
options?: boolean | AddEventListenerOptions
|
|
69
|
+
): void;
|
|
70
|
+
|
|
71
|
+
// Fallback
|
|
72
|
+
addEventListener(
|
|
73
|
+
type: string,
|
|
74
|
+
listener: EventListenerOrEventListenerObject,
|
|
75
|
+
options?: boolean | AddEventListenerOptions
|
|
76
|
+
): void;
|
|
77
|
+
|
|
78
|
+
// Similar for removeEventListener
|
|
79
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(
|
|
80
|
+
type: K,
|
|
81
|
+
listener: (this: HTMLComboboxElement, ev: HTMLElementEventMap[K]) => any,
|
|
82
|
+
options?: boolean | EventListenerOptions
|
|
83
|
+
): void;
|
|
84
|
+
|
|
85
|
+
removeEventListener<K extends keyof ComboboxEventMap>(
|
|
86
|
+
type: K,
|
|
87
|
+
listener: (this: HTMLComboboxElement, ev: ComboboxEventMap[K]) => any,
|
|
88
|
+
options?: boolean | EventListenerOptions
|
|
89
|
+
): void;
|
|
90
|
+
|
|
91
|
+
removeEventListener(
|
|
92
|
+
type: string,
|
|
93
|
+
listener: EventListenerOrEventListenerObject,
|
|
94
|
+
options?: boolean | EventListenerOptions
|
|
95
|
+
): void;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
interface ComboboxEvent extends Event {
|
|
99
|
+
readonly target: HTMLComboboxElement;
|
|
100
|
+
readonly currentTarget: HTMLComboboxElement;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface ComboboxInputEvent extends InputEvent {
|
|
104
|
+
readonly target: HTMLComboboxElement;
|
|
105
|
+
readonly currentTarget: HTMLComboboxElement;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
interface ComboboxFocusEvent extends FocusEvent {
|
|
109
|
+
readonly target: HTMLComboboxElement;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
interface ComboboxEventMap extends HTMLElementEventMap {
|
|
113
|
+
"change": ComboboxEvent;
|
|
114
|
+
"blur": ComboboxFocusEvent;
|
|
115
|
+
"focus": ComboboxFocusEvent;
|
|
116
|
+
"focusin": ComboboxFocusEvent;
|
|
117
|
+
"focusout": ComboboxFocusEvent;
|
|
118
|
+
"input": ComboboxInputEvent;
|
|
119
|
+
"invalid": ComboboxEvent;
|
|
120
|
+
// "select": ComboboxEvent;
|
|
121
|
+
"selectionchange": ComboboxEvent;
|
|
122
|
+
"selectstart": ComboboxEvent;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface HTMLElementTagNameMap {
|
|
126
|
+
'combo-box': HTMLComboboxElement;
|
|
127
|
+
'box-option': HTMLComboboxOptionElement;
|
|
128
|
+
'box-tag': HTMLComboboxTagElement;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
interface ComboboxJsxAttributes {
|
|
132
|
+
/** The value of the internal input.
|
|
133
|
+
*
|
|
134
|
+
* The internal input is visible when either the `searchable` or `filterable` attribute is present.
|
|
135
|
+
*
|
|
136
|
+
* Setting ""
|
|
137
|
+
* */
|
|
138
|
+
query?: string;
|
|
139
|
+
|
|
140
|
+
/** A comma-separated list of descendant `<box-option>` value attributes to be selected by default.
|
|
141
|
+
*
|
|
142
|
+
* When the `multiple` attribute is present, only the first option will be selected.
|
|
143
|
+
*
|
|
144
|
+
* Alternatively, you can set default selections by adding the `selected` attribute directly to individual `<box-option>` elements. */
|
|
145
|
+
value?: string;
|
|
146
|
+
|
|
147
|
+
/** This Boolean attribute indicates that multiple options can be selected.
|
|
148
|
+
*
|
|
149
|
+
* When present, users can select multiple options. When absent, only one option can be selected at a time (the `<combo-box>` behaves like a `<select>`). */
|
|
150
|
+
multiple?: boolean;
|
|
151
|
+
|
|
152
|
+
/** The placeholder for the internal input.
|
|
153
|
+
*
|
|
154
|
+
* The internal input is visible when either the `searchable` or `filterable` attribute is present.
|
|
155
|
+
*
|
|
156
|
+
* When the `<combo-box>` is empty, this value is also shown as the `<combo-box>` placeholder itself. */
|
|
157
|
+
placeholder?: string;
|
|
158
|
+
|
|
159
|
+
/** When present, the clear-all button is shown in the `<combo-box>` itself, and the clear button is shown for each selected tag.
|
|
160
|
+
*
|
|
161
|
+
* This attribute is automatically enabled when the `multiple` attribute is present.
|
|
162
|
+
*
|
|
163
|
+
* When the `multiple` attribute is absent (single-select mode), setting `clearable` makes the clear button visible on the selected tag. */
|
|
164
|
+
clearable?: boolean;
|
|
165
|
+
|
|
166
|
+
/** When present, the internal input is shown.
|
|
167
|
+
*
|
|
168
|
+
* As the user types, available options are **not** filtered by the query. You must attach an `input` listener to the `<combo-box>` and filter options manually.
|
|
169
|
+
*
|
|
170
|
+
* Setting both `searchable` and `filterable` is not recommended—`searchable` takes precedence. */
|
|
171
|
+
searchable?: boolean;
|
|
172
|
+
|
|
173
|
+
/** When present, the internal input is shown.
|
|
174
|
+
*
|
|
175
|
+
* As the user types, available options are filtered by the query automatically.
|
|
176
|
+
*
|
|
177
|
+
* Setting both `filterable` and `searchable` is not recommended—`searchable` takes precedence. */
|
|
178
|
+
filterable?: boolean;
|
|
179
|
+
|
|
180
|
+
/** A Boolean attribute indicating that at least one option must be selected. */
|
|
181
|
+
required?: boolean;
|
|
182
|
+
|
|
183
|
+
disabled?: boolean;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
declare namespace React {
|
|
187
|
+
namespace JSX {
|
|
188
|
+
interface IntrinsicElements {
|
|
189
|
+
// @ts-ignore
|
|
190
|
+
'combo-box': React.DetailedHTMLProps<Omit<React.HTMLAttributes<HTMLComboboxElement>, 'defaultValue'>,
|
|
191
|
+
HTMLComboboxElement
|
|
192
|
+
> & ComboboxJsxAttributes;
|
|
193
|
+
|
|
194
|
+
'box-option': HTMLComboboxOptionElement;
|
|
195
|
+
'box-tag': HTMLComboboxTagElement;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|