kr-elements 0.0.1-alpha.11 → 0.0.1-alpha.13
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 +5 -0
- package/dist/cjs/combobox/HTML.combobox.element.js +20 -12
- package/dist/cjs/combobox/HTML.combobox.option.element.js +8 -6
- package/dist/cjs/index.js +17 -0
- 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 +5 -0
- package/dist/esm/combobox/HTML.combobox.element.js +6 -0
- package/dist/esm/index.js +1 -0
- 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 +1 -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 -60
- package/dist/types/combobox/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +134 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -0
- package/dist/types/types.d.ts +198 -0
- package/package.json +6 -14
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toBoolean =
|
|
3
|
+
exports.toBoolean = toBoolean;
|
|
4
|
+
/** Transform invalid (nullish or stringed) values to correct boolean value */
|
|
4
5
|
function toBoolean(value) {
|
|
5
6
|
if (value == null || value === 'false' || value === false)
|
|
6
7
|
value = false;
|
|
@@ -8,4 +9,3 @@ function toBoolean(value) {
|
|
|
8
9
|
value = true;
|
|
9
10
|
return Boolean(value);
|
|
10
11
|
}
|
|
11
|
-
exports.toBoolean = toBoolean;
|
|
@@ -39,12 +39,15 @@ class ComboboxMarkup {
|
|
|
39
39
|
this.optionsContainer.querySelectorAll('box-option')
|
|
40
40
|
.forEach(option => {
|
|
41
41
|
if (query === '') {
|
|
42
|
+
// option.style.order = "unset";
|
|
42
43
|
option.style.display = "initial";
|
|
43
44
|
}
|
|
44
45
|
else if (!regex.test(option.label)) {
|
|
46
|
+
// option.style.order = "-1";
|
|
45
47
|
option.style.display = "none";
|
|
46
48
|
}
|
|
47
49
|
else {
|
|
50
|
+
// option.style.order = "unset";
|
|
48
51
|
option.style.order = "initial";
|
|
49
52
|
}
|
|
50
53
|
});
|
|
@@ -85,6 +88,7 @@ class ComboboxMarkup {
|
|
|
85
88
|
try {
|
|
86
89
|
this.setDropdownPosition(this.#shadowRoot.host.getBoundingClientRect());
|
|
87
90
|
this.dropdown.style.display = 'flex';
|
|
91
|
+
// @ts-ignore
|
|
88
92
|
this.dropdown.showPopover();
|
|
89
93
|
this.#internals.ariaExpanded = "true";
|
|
90
94
|
}
|
|
@@ -96,6 +100,7 @@ class ComboboxMarkup {
|
|
|
96
100
|
if (event.composedPath().includes(this.#shadowRoot.host))
|
|
97
101
|
return;
|
|
98
102
|
try {
|
|
103
|
+
// @ts-ignore
|
|
99
104
|
this.dropdown.hidePopover();
|
|
100
105
|
this.dropdown.style.display = 'none';
|
|
101
106
|
this.#internals.ariaExpanded = "false";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var _a;
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.HTMLComboboxElement = void 0;
|
|
4
5
|
const Combobox_markup_js_1 = require("./Combobox.markup.js");
|
|
@@ -22,14 +23,15 @@ class HTMLComboboxElement extends HTMLElement {
|
|
|
22
23
|
this.shadowRoot = this.attachShadow({ mode: 'closed', delegatesFocus: true });
|
|
23
24
|
this.#markup = new Combobox_markup_js_1.ComboboxMarkup(this.shadowRoot, this.internals);
|
|
24
25
|
this.shadowRoot.innerHTML = Combobox_markup_js_1.ComboboxMarkup.template;
|
|
25
|
-
this.shadowRoot.adoptedStyleSheets =
|
|
26
|
+
this.shadowRoot.adoptedStyleSheets = _a.styleSheet;
|
|
26
27
|
this.#observer = new MutationObserver(this.#onOptionsChanges);
|
|
27
28
|
}
|
|
29
|
+
// Lifecycle callbacks
|
|
28
30
|
connectedCallback() {
|
|
29
31
|
this.#markup.connect();
|
|
30
32
|
this.#initialAttributesSynchronization();
|
|
31
33
|
this.#onOptionsChanges([{ addedNodes: Array.from(this.children) }]);
|
|
32
|
-
this.#observer.observe(this,
|
|
34
|
+
this.#observer.observe(this, _a.observerOptions);
|
|
33
35
|
this.#markup.clearAllButton.addEventListener('click', this.#onClickClearAllButton);
|
|
34
36
|
this.#markup.searchInput.addEventListener('input', this.#onInput);
|
|
35
37
|
}
|
|
@@ -47,6 +49,8 @@ class HTMLComboboxElement extends HTMLElement {
|
|
|
47
49
|
formDisabledCallback(isDisabled) {
|
|
48
50
|
this.disabled = isDisabled;
|
|
49
51
|
}
|
|
52
|
+
// Instance properties
|
|
53
|
+
// readonly
|
|
50
54
|
get valueAsArray() {
|
|
51
55
|
return Array.from(this.#values);
|
|
52
56
|
}
|
|
@@ -59,6 +63,7 @@ class HTMLComboboxElement extends HTMLElement {
|
|
|
59
63
|
get willValidate() {
|
|
60
64
|
return this.internals.willValidate;
|
|
61
65
|
}
|
|
66
|
+
// configurable
|
|
62
67
|
get value() {
|
|
63
68
|
return this.valueAsArray.join(',');
|
|
64
69
|
}
|
|
@@ -154,23 +159,24 @@ class HTMLComboboxElement extends HTMLElement {
|
|
|
154
159
|
this.#markup.searchInput.placeholder = value;
|
|
155
160
|
}
|
|
156
161
|
}
|
|
162
|
+
// Instance methods
|
|
157
163
|
setAttribute(name, value) {
|
|
158
|
-
if (
|
|
164
|
+
if (_a.booleanAttributes.has(name)) {
|
|
159
165
|
Reflect.set(this, name, (0, Boolean_attribute_value_normalizer_js_1.toBoolean)(value));
|
|
160
166
|
return;
|
|
161
167
|
}
|
|
162
|
-
if (
|
|
168
|
+
if (_a.stringAttributes.has(name)) {
|
|
163
169
|
Reflect.set(this, name, value);
|
|
164
170
|
return;
|
|
165
171
|
}
|
|
166
172
|
super.setAttribute(name, value);
|
|
167
173
|
}
|
|
168
174
|
removeAttribute(name) {
|
|
169
|
-
if (
|
|
175
|
+
if (_a.booleanAttributes.has(name)) {
|
|
170
176
|
Reflect.set(this, name, false);
|
|
171
177
|
return;
|
|
172
178
|
}
|
|
173
|
-
if (
|
|
179
|
+
if (_a.stringAttributes.has(name)) {
|
|
174
180
|
return;
|
|
175
181
|
}
|
|
176
182
|
super.removeAttribute(name);
|
|
@@ -189,6 +195,7 @@ class HTMLComboboxElement extends HTMLElement {
|
|
|
189
195
|
this.internals.setValidity({ customError: true }, message);
|
|
190
196
|
}
|
|
191
197
|
}
|
|
198
|
+
// Internal
|
|
192
199
|
#onInput = (event) => {
|
|
193
200
|
if (this.filterable) {
|
|
194
201
|
if (event.target && event.target instanceof HTMLInputElement) {
|
|
@@ -276,11 +283,11 @@ class HTMLComboboxElement extends HTMLElement {
|
|
|
276
283
|
}
|
|
277
284
|
}
|
|
278
285
|
#initialAttributesSynchronization() {
|
|
279
|
-
for (const key of
|
|
286
|
+
for (const key of _a.booleanAttributes) {
|
|
280
287
|
const value = (0, Boolean_attribute_value_normalizer_js_1.toBoolean)(this.getAttribute(key));
|
|
281
288
|
Reflect.set(this, key, value);
|
|
282
289
|
}
|
|
283
|
-
for (const key of
|
|
290
|
+
for (const key of _a.stringAttributes) {
|
|
284
291
|
if (this.hasAttribute(key)) {
|
|
285
292
|
Reflect.set(this, key, this.getAttribute(key));
|
|
286
293
|
}
|
|
@@ -290,17 +297,17 @@ class HTMLComboboxElement extends HTMLElement {
|
|
|
290
297
|
}
|
|
291
298
|
static loadCssFromDocumentStyleSheets() {
|
|
292
299
|
if (document.readyState === 'complete') {
|
|
293
|
-
|
|
300
|
+
_a.#loadDocumentStyleSheets();
|
|
294
301
|
}
|
|
295
302
|
if (document.readyState === 'loading') {
|
|
296
|
-
document.addEventListener('DOMContentLoaded',
|
|
303
|
+
document.addEventListener('DOMContentLoaded', _a.#loadDocumentStyleSheets);
|
|
297
304
|
}
|
|
298
305
|
if (document.readyState === 'interactive') {
|
|
299
|
-
queueMicrotask(
|
|
306
|
+
queueMicrotask(_a.#loadDocumentStyleSheets);
|
|
300
307
|
}
|
|
301
308
|
}
|
|
302
309
|
static #loadDocumentStyleSheets() {
|
|
303
|
-
const [innerSheet] =
|
|
310
|
+
const [innerSheet] = _a.styleSheet;
|
|
304
311
|
for (const outerSheet of document.styleSheets) {
|
|
305
312
|
for (const rule of outerSheet.cssRules) {
|
|
306
313
|
innerSheet.insertRule(rule.cssText, innerSheet.cssRules.length);
|
|
@@ -309,6 +316,7 @@ class HTMLComboboxElement extends HTMLElement {
|
|
|
309
316
|
}
|
|
310
317
|
}
|
|
311
318
|
exports.HTMLComboboxElement = HTMLComboboxElement;
|
|
319
|
+
_a = HTMLComboboxElement;
|
|
312
320
|
document.addEventListener('keypress', (event) => {
|
|
313
321
|
if (document.activeElement instanceof HTMLComboboxElement) {
|
|
314
322
|
if (document.activeElement.shadowRoot.activeElement instanceof HTML_combobox_option_element_js_1.HTMLComboboxOptionElement) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var _a;
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.HTMLComboboxOptionElement = void 0;
|
|
4
5
|
const Boolean_attribute_value_normalizer_js_1 = require("./Boolean.attribute.value.normalizer.js");
|
|
@@ -35,11 +36,11 @@ class HTMLComboboxOptionElement extends HTMLElement {
|
|
|
35
36
|
super.toggleAttribute('selected', (0, Boolean_attribute_value_normalizer_js_1.toBoolean)(value));
|
|
36
37
|
}
|
|
37
38
|
#initialAttributesSynchronization() {
|
|
38
|
-
for (const key of
|
|
39
|
+
for (const key of _a.booleanAttributes) {
|
|
39
40
|
const value = (0, Boolean_attribute_value_normalizer_js_1.toBoolean)(this.getAttribute(key));
|
|
40
41
|
Reflect.set(this, key, value);
|
|
41
42
|
}
|
|
42
|
-
for (const key of
|
|
43
|
+
for (const key of _a.stringAttributes) {
|
|
43
44
|
Reflect.set(this, key, this.getAttribute(key));
|
|
44
45
|
}
|
|
45
46
|
}
|
|
@@ -68,28 +69,29 @@ class HTMLComboboxOptionElement extends HTMLElement {
|
|
|
68
69
|
throw new TypeError('Invalid value');
|
|
69
70
|
}
|
|
70
71
|
setAttribute(name, value) {
|
|
71
|
-
if (
|
|
72
|
+
if (_a.booleanAttributes.has(name)) {
|
|
72
73
|
Reflect.set(this, name, (0, Boolean_attribute_value_normalizer_js_1.toBoolean)(value));
|
|
73
74
|
return;
|
|
74
75
|
}
|
|
75
|
-
if (
|
|
76
|
+
if (_a.stringAttributes.has(name)) {
|
|
76
77
|
Reflect.set(this, name, value);
|
|
77
78
|
return;
|
|
78
79
|
}
|
|
79
80
|
super.setAttribute(name, value);
|
|
80
81
|
}
|
|
81
82
|
removeAttribute(name) {
|
|
82
|
-
if (
|
|
83
|
+
if (_a.stringAttributes.has(name)) {
|
|
83
84
|
Reflect.set(this, name, false);
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
86
|
-
if (
|
|
87
|
+
if (_a.stringAttributes.has(name)) {
|
|
87
88
|
return;
|
|
88
89
|
}
|
|
89
90
|
super.removeAttribute(name);
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
exports.HTMLComboboxOptionElement = HTMLComboboxOptionElement;
|
|
94
|
+
_a = HTMLComboboxOptionElement;
|
|
93
95
|
if (!window.customElements.get('box-option')) {
|
|
94
96
|
window.customElements.define('box-option', HTMLComboboxOptionElement);
|
|
95
97
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./combobox/index.js"), exports);
|
|
@@ -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"}
|
|
@@ -36,12 +36,15 @@ export class ComboboxMarkup {
|
|
|
36
36
|
this.optionsContainer.querySelectorAll('box-option')
|
|
37
37
|
.forEach(option => {
|
|
38
38
|
if (query === '') {
|
|
39
|
+
// option.style.order = "unset";
|
|
39
40
|
option.style.display = "initial";
|
|
40
41
|
}
|
|
41
42
|
else if (!regex.test(option.label)) {
|
|
43
|
+
// option.style.order = "-1";
|
|
42
44
|
option.style.display = "none";
|
|
43
45
|
}
|
|
44
46
|
else {
|
|
47
|
+
// option.style.order = "unset";
|
|
45
48
|
option.style.order = "initial";
|
|
46
49
|
}
|
|
47
50
|
});
|
|
@@ -82,6 +85,7 @@ export class ComboboxMarkup {
|
|
|
82
85
|
try {
|
|
83
86
|
this.setDropdownPosition(this.#shadowRoot.host.getBoundingClientRect());
|
|
84
87
|
this.dropdown.style.display = 'flex';
|
|
88
|
+
// @ts-ignore
|
|
85
89
|
this.dropdown.showPopover();
|
|
86
90
|
this.#internals.ariaExpanded = "true";
|
|
87
91
|
}
|
|
@@ -93,6 +97,7 @@ export class ComboboxMarkup {
|
|
|
93
97
|
if (event.composedPath().includes(this.#shadowRoot.host))
|
|
94
98
|
return;
|
|
95
99
|
try {
|
|
100
|
+
// @ts-ignore
|
|
96
101
|
this.dropdown.hidePopover();
|
|
97
102
|
this.dropdown.style.display = 'none';
|
|
98
103
|
this.#internals.ariaExpanded = "false";
|
|
@@ -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
|
}
|
|
@@ -151,6 +155,7 @@ export class HTMLComboboxElement extends HTMLElement {
|
|
|
151
155
|
this.#markup.searchInput.placeholder = value;
|
|
152
156
|
}
|
|
153
157
|
}
|
|
158
|
+
// Instance methods
|
|
154
159
|
setAttribute(name, value) {
|
|
155
160
|
if (HTMLComboboxElement.booleanAttributes.has(name)) {
|
|
156
161
|
Reflect.set(this, name, toBoolean(value));
|
|
@@ -186,6 +191,7 @@ export class HTMLComboboxElement extends HTMLElement {
|
|
|
186
191
|
this.internals.setValidity({ customError: true }, message);
|
|
187
192
|
}
|
|
188
193
|
}
|
|
194
|
+
// Internal
|
|
189
195
|
#onInput = (event) => {
|
|
190
196
|
if (this.filterable) {
|
|
191
197
|
if (event.target && event.target instanceof HTMLInputElement) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './combobox/index.js';
|
|
@@ -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"}
|
|
@@ -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,EAA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B;IASjB,oBAAoB;IAKpB,iBAAiB;IAQjB,oBAAoB,CAAC,UAAU,EAAE,OAAO;IAMxC,IAAI,YAAY,aAEf;IACD,IAAI,eAAe,0CAElB;IACD,IAAI,QAAQ,kBAEX;IACD,IAAI,YAAY,YAEf;IAGD,IAAI,KAAK,IAGQ,MAAM,CADtB;IACD,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAgCtB;IAED,IAAI,KAAK,IAGQ,MAAM,CADtB;IACD,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAMtB;IAED,IAAI,SAAS,YAEZ;IACD,IAAI,SAAS,CAAC,KAAK,SAAA,EAElB;IAED,IAAI,QAAQ,YAEX;IACD,IAAI,QAAQ,CAAC,KAAK,SAAA,EAEjB;IAED,IAAI,UAAU,YAEb;IACD,IAAI,UAAU,CAAC,KAAK,SAAA,EAEnB;IAED,IAAI,UAAU,YAEb;IACD,IAAI,UAAU,CAAC,KAAK,SAAA,EAEnB;IAED,IAAI,QAAQ,YAEX;IACD,IAAI,QAAQ,CAAC,KAAK,SAAA,EAGjB;IAED,IAAI,QAAQ,YAEX;IACD,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;IAUjB,IAAI,KAAK,WAER;IACD,IAAI,KAAK,CAAC,KAAK,QAAA,EAGd;IAED,IAAI,KAAK,WAER;IACD,IAAI,KAAK,CAAC,KAAK,QAAA,EAGd;IAED,IAAI,QAAQ,YAEX;IACD,IAAI,QAAQ,CAAC,KAAK,SAAA,EAEjB;IAoCD,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"}
|
|
@@ -1,61 +1,2 @@
|
|
|
1
|
-
interface HTMLComboboxTagElement extends HTMLElement {
|
|
2
|
-
}
|
|
3
|
-
interface HTMLComboboxOptionElement extends HTMLOptionElement {
|
|
4
|
-
value: string;
|
|
5
|
-
label: string;
|
|
6
|
-
}
|
|
7
|
-
interface HTMLComboboxElement extends HTMLSelectElement {
|
|
8
|
-
query: string;
|
|
9
|
-
valueAsArray: string[];
|
|
10
|
-
placeholder: string;
|
|
11
|
-
clearable?: boolean;
|
|
12
|
-
searchable?: boolean;
|
|
13
|
-
filterable?: boolean;
|
|
14
|
-
selectedOptions: HTMLCollectionOf<HTMLComboboxOptionElement>;
|
|
15
|
-
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLComboboxElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
16
|
-
addEventListener<K extends keyof ComboboxEventMap>(type: K, listener: (this: HTMLComboboxElement, ev: ComboboxEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
17
|
-
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
18
|
-
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLComboboxElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
19
|
-
removeEventListener<K extends keyof ComboboxEventMap>(type: K, listener: (this: HTMLComboboxElement, ev: ComboboxEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
20
|
-
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
21
|
-
onchange: ((this: HTMLComboboxElement, ev: ComboboxEvent) => any) | null;
|
|
22
|
-
oninput: ((this: HTMLComboboxElement, ev: ComboboxInputEvent) => any) | null;
|
|
23
|
-
oninvalid: ((this: HTMLComboboxElement, ev: ComboboxEvent) => any) | null;
|
|
24
|
-
}
|
|
25
|
-
interface ComboboxEvent extends Event {
|
|
26
|
-
readonly target: HTMLComboboxElement;
|
|
27
|
-
readonly currentTarget: HTMLComboboxElement;
|
|
28
|
-
}
|
|
29
|
-
interface ComboboxInputEvent extends InputEvent {
|
|
30
|
-
readonly target: HTMLComboboxElement;
|
|
31
|
-
readonly currentTarget: HTMLComboboxElement;
|
|
32
|
-
}
|
|
33
|
-
interface ComboboxFocusEvent extends FocusEvent {
|
|
34
|
-
readonly target: HTMLComboboxElement;
|
|
35
|
-
}
|
|
36
|
-
interface ComboboxEventMap extends HTMLElementEventMap {
|
|
37
|
-
"change": ComboboxEvent;
|
|
38
|
-
"blur": ComboboxFocusEvent;
|
|
39
|
-
"focus": ComboboxFocusEvent;
|
|
40
|
-
"focusin": ComboboxFocusEvent;
|
|
41
|
-
"focusout": ComboboxFocusEvent;
|
|
42
|
-
"input": ComboboxInputEvent;
|
|
43
|
-
"invalid": ComboboxEvent;
|
|
44
|
-
"selectionchange": ComboboxEvent;
|
|
45
|
-
"selectstart": ComboboxEvent;
|
|
46
|
-
}
|
|
47
|
-
declare global {
|
|
48
|
-
interface HTMLElementTagNameMap {
|
|
49
|
-
'combo-box': HTMLComboboxElement;
|
|
50
|
-
'box-option': HTMLComboboxOptionElement;
|
|
51
|
-
'box-tag': HTMLComboboxTagElement;
|
|
52
|
-
}
|
|
53
|
-
namespace JSX {
|
|
54
|
-
interface IntrinsicElements {
|
|
55
|
-
'combo-box': HTMLComboboxElement;
|
|
56
|
-
'box-option': HTMLComboboxOptionElement;
|
|
57
|
-
'box-tag': HTMLComboboxTagElement;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
1
|
export * from './HTML.combobox.element.js';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/combobox/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
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
|
+
declare global {
|
|
124
|
+
namespace React {
|
|
125
|
+
namespace JSX {
|
|
126
|
+
interface IntrinsicElements {
|
|
127
|
+
'combo-box': React.DetailedHTMLProps<Omit<React.HTMLAttributes<HTMLComboboxElement>, 'defaultValue'>, HTMLComboboxElement> & ComboboxJsxAttributes;
|
|
128
|
+
'box-option': HTMLComboboxOptionElement;
|
|
129
|
+
'box-tag': HTMLComboboxTagElement;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
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,OAAO,EAAE,kBAAkB,CAAC;IAC5B,SAAS,EAAE,aAAa,CAAC;IAEzB,iBAAiB,EAAE,aAAa,CAAC;IACjC,aAAa,EAAE,aAAa,CAAC;CAC9B;AAQD,UAAU,qBAAqB;IAC7B;;;;;SAKK;IACL,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;0IAIsI;IACtI,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;gKAE4J;IAC5J,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;4GAIwG;IACxG,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;+IAI2I;IAC3I,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;sGAIkG;IAClG,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;sGAIkG;IAClG,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,gFAAgF;IAChF,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,UAAU,GAAG,CAAC;YACZ,UAAU,iBAAiB;gBACzB,WAAW,EAAE,KAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,mBAAmB,CAAC,EAAE,cAAc,CAAC,EAClG,mBAAmB,CACpB,GAAG,qBAAqB,CAAC;gBAE1B,YAAY,EAAE,yBAAyB,CAAC;gBACxC,SAAS,EAAE,sBAAsB,CAAC;aACnC;SACF;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
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kr-elements",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.13",
|
|
4
4
|
"description": "Custom elements",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepare": "husky",
|
|
8
8
|
"clean": "rm -rf dist",
|
|
9
|
-
"build:combobox": "tsc -b configs/
|
|
9
|
+
"build:combobox": "tsc -b configs/tsconfig.cjs.json configs/tsconfig.esm.json configs/tsconfig.types.json",
|
|
10
10
|
"generate": "node --import tsx ./scripts/genPackageFiles.ts",
|
|
11
11
|
"build": "npm-run-all clean build:combobox generate",
|
|
12
12
|
"check-types": "tsc --noEmit"
|
|
@@ -30,22 +30,14 @@
|
|
|
30
30
|
"react": "^19.2.4",
|
|
31
31
|
"solid": "^0.2.1",
|
|
32
32
|
"tsx": "^4.19.2",
|
|
33
|
-
"typescript": "
|
|
33
|
+
"typescript": "5.9.3",
|
|
34
34
|
"xml-splitter": "1.2.1"
|
|
35
35
|
},
|
|
36
36
|
"sideEffect": false,
|
|
37
37
|
"files": [
|
|
38
38
|
"dist"
|
|
39
39
|
],
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"require": "./dist/cjs/combobox/index.js",
|
|
44
|
-
"import": "./dist/esm/combobox/index.js"
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"main": "dist/cjs/combobox/index.js",
|
|
48
|
-
"module": "dist/esm/combobox/index.js",
|
|
49
|
-
"types": "dist/types/combobox/index.d.ts",
|
|
50
|
-
"combobox": "dist/cjs/combobox/index.js"
|
|
40
|
+
"main": "dist/cjs/index.js",
|
|
41
|
+
"module": "dist/esm/index.js",
|
|
42
|
+
"types": "dist/index.d.ts"
|
|
51
43
|
}
|