html-combobox-element 0.0.1

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.
Files changed (34) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/combobox/Boolean.attribute.value.normalizer.js +11 -0
  3. package/dist/cjs/combobox/Combobox.markup.js +371 -0
  4. package/dist/cjs/combobox/HTML.combobox.element.js +365 -0
  5. package/dist/cjs/combobox/HTML.combobox.option.element.js +65 -0
  6. package/dist/cjs/combobox/HTML.combobox.tag.element.js +22 -0
  7. package/dist/cjs/combobox/index.js +17 -0
  8. package/dist/cjs/index.js +83 -0
  9. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -0
  10. package/dist/esm/combobox/Boolean.attribute.value.normalizer.js +8 -0
  11. package/dist/esm/combobox/Combobox.markup.js +367 -0
  12. package/dist/esm/combobox/HTML.combobox.element.js +359 -0
  13. package/dist/esm/combobox/HTML.combobox.option.element.js +59 -0
  14. package/dist/esm/combobox/HTML.combobox.tag.element.js +18 -0
  15. package/dist/esm/combobox/index.js +1 -0
  16. package/dist/esm/index.js +67 -0
  17. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -0
  18. package/dist/types/combobox/Boolean.attribute.value.normalizer.d.ts +3 -0
  19. package/dist/types/combobox/Boolean.attribute.value.normalizer.d.ts.map +1 -0
  20. package/dist/types/combobox/Combobox.markup.d.ts +31 -0
  21. package/dist/types/combobox/Combobox.markup.d.ts.map +1 -0
  22. package/dist/types/combobox/HTML.combobox.element.d.ts +55 -0
  23. package/dist/types/combobox/HTML.combobox.element.d.ts.map +1 -0
  24. package/dist/types/combobox/HTML.combobox.option.element.d.ts +14 -0
  25. package/dist/types/combobox/HTML.combobox.option.element.d.ts.map +1 -0
  26. package/dist/types/combobox/HTML.combobox.tag.element.d.ts +5 -0
  27. package/dist/types/combobox/HTML.combobox.tag.element.d.ts.map +1 -0
  28. package/dist/types/combobox/index.d.ts +2 -0
  29. package/dist/types/combobox/index.d.ts.map +1 -0
  30. package/dist/types/index.d.ts +214 -0
  31. package/dist/types/index.d.ts.map +1 -0
  32. package/dist/types/tsconfig.types.tsbuildinfo +1 -0
  33. package/dist/types/types.d.ts +198 -0
  34. package/package.json +45 -0
@@ -0,0 +1,365 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.HTMLComboboxElement = void 0;
5
+ const Combobox_markup_js_1 = require("./Combobox.markup.js");
6
+ const HTML_combobox_option_element_js_1 = require("./HTML.combobox.option.element.js");
7
+ const Boolean_attribute_value_normalizer_js_1 = require("./Boolean.attribute.value.normalizer.js");
8
+ class HTMLComboboxElement extends HTMLElement {
9
+ static OWN_IDL = new Set(['required', 'disabled', 'clearable', 'multiple', 'filterable', 'searchable', 'value', 'placeholder', 'query']);
10
+ static observerOptions = { childList: true, attributes: false, subtree: false };
11
+ static styleSheet = [new CSSStyleSheet];
12
+ static formAssociated = true;
13
+ shadowRoot;
14
+ #internals;
15
+ #observer;
16
+ #markup;
17
+ #values = new Set;
18
+ constructor() {
19
+ super();
20
+ this.#internals = this.attachInternals();
21
+ this.#internals.role = "combobox";
22
+ this.#internals.ariaHasPopup = "dialog";
23
+ this.shadowRoot = this.attachShadow({ mode: 'closed', delegatesFocus: true });
24
+ this.#markup = new Combobox_markup_js_1.ComboboxMarkup(this.shadowRoot, this.#internals);
25
+ this.shadowRoot.innerHTML = Combobox_markup_js_1.ComboboxMarkup.template;
26
+ this.shadowRoot.adoptedStyleSheets = _a.styleSheet;
27
+ this.#observer = new MutationObserver(this.#onOptionsChanges);
28
+ }
29
+ // Lifecycle callbacks
30
+ connectedCallback() {
31
+ this.#markup.connect();
32
+ this.#initialAttributesSynchronization();
33
+ this.#onOptionsChanges([{ addedNodes: Array.from(this.children) }]);
34
+ this.#observer.observe(this, _a.observerOptions);
35
+ this.#markup.clearAllButton.addEventListener('click', this.#onClear);
36
+ this.#markup.searchInput.addEventListener('input', this.#onInput);
37
+ }
38
+ disconnectedCallback() {
39
+ this.#observer.disconnect();
40
+ this.#markup.disconnect();
41
+ this.#markup.clearAllButton.removeEventListener('click', this.#onClear);
42
+ this.#markup.searchInput.removeEventListener('input', this.#onInput);
43
+ }
44
+ formResetCallback() {
45
+ this.#values = new Set;
46
+ this.selectedOptions.forEach(option => option.selected = false);
47
+ this.#markup.tagsContainer.replaceChildren();
48
+ this.#setValidityAndFormValue();
49
+ this.dispatchEvent(new Event('change'));
50
+ }
51
+ formDisabledCallback(isDisabled) {
52
+ this.disabled = isDisabled;
53
+ }
54
+ // Instance properties
55
+ // <combo-box> specific properties
56
+ get valueAsArray() {
57
+ return Array.from(this.#values);
58
+ }
59
+ get query() {
60
+ return this.getAttribute('query');
61
+ }
62
+ set query(value) {
63
+ if (value === this.query)
64
+ return;
65
+ if (value == null)
66
+ value = '';
67
+ value = String(value);
68
+ super.setAttribute('query', value);
69
+ if (this.#markup.connected) {
70
+ this.#markup.searchInput.value = value;
71
+ }
72
+ }
73
+ get placeholder() {
74
+ return this.getAttribute('placeholder');
75
+ }
76
+ set placeholder(value) {
77
+ if (value == null)
78
+ value = '';
79
+ value = String(value);
80
+ super.setAttribute('placeholder', value);
81
+ if (this.#markup.connected) {
82
+ this.#markup.placeholder.innerText = value;
83
+ this.#markup.searchInput.placeholder = value;
84
+ }
85
+ }
86
+ get clearable() {
87
+ return this.hasAttribute('clearable');
88
+ }
89
+ set clearable(value) {
90
+ super.toggleAttribute('clearable', (0, Boolean_attribute_value_normalizer_js_1.toBoolean)(value));
91
+ }
92
+ get filterable() {
93
+ return this.hasAttribute('filterable');
94
+ }
95
+ set filterable(value) {
96
+ super.toggleAttribute('filterable', (0, Boolean_attribute_value_normalizer_js_1.toBoolean)(value));
97
+ }
98
+ get searchable() {
99
+ return this.hasAttribute('searchable');
100
+ }
101
+ set searchable(value) {
102
+ super.toggleAttribute('searchable', (0, Boolean_attribute_value_normalizer_js_1.toBoolean)(value));
103
+ }
104
+ // <select> specific properties (implements HTMLSelectElement)
105
+ get disabled() {
106
+ return this.hasAttribute('disabled');
107
+ }
108
+ set disabled(value) {
109
+ this.#internals.ariaDisabled = String(value);
110
+ super.toggleAttribute('disabled', (0, Boolean_attribute_value_normalizer_js_1.toBoolean)(value));
111
+ }
112
+ get form() {
113
+ return this.#internals.form;
114
+ }
115
+ get labels() {
116
+ return this.#internals.labels;
117
+ }
118
+ get length() {
119
+ return this.#markup.options.length;
120
+ }
121
+ get multiple() {
122
+ return this.hasAttribute('multiple');
123
+ }
124
+ set multiple(value) {
125
+ super.toggleAttribute('multiple', (0, Boolean_attribute_value_normalizer_js_1.toBoolean)(value));
126
+ }
127
+ // get options
128
+ // (there is no constructor of HTMLOptionsCollection, need to implement)
129
+ get required() {
130
+ return this.hasAttribute('required');
131
+ }
132
+ set required(value) {
133
+ this.#internals.ariaRequired = String(value);
134
+ super.toggleAttribute('required', (0, Boolean_attribute_value_normalizer_js_1.toBoolean)(value));
135
+ }
136
+ // selected index is part of HTMLOptionsCollection, see option above
137
+ get selectedOptions() {
138
+ return this.#markup.selectedOptions;
139
+ }
140
+ // get/set size
141
+ // for the original select, this is the same as rowsCount of textarea
142
+ // probably, there are no reasons to this one, but it should be implemented for interface compatibility
143
+ get type() {
144
+ return this.multiple ? "select-multiple" : "select-one";
145
+ }
146
+ get validationMessage() {
147
+ return this.#internals.validationMessage;
148
+ }
149
+ get validity() {
150
+ return this.#internals.validity;
151
+ }
152
+ get willValidate() {
153
+ return this.#internals.willValidate;
154
+ }
155
+ get value() {
156
+ return this.valueAsArray.join(',');
157
+ }
158
+ set value(value) {
159
+ if (this.value === value || typeof value !== 'string')
160
+ return;
161
+ const prevValue = new Set(this.#values);
162
+ this.#values = new Set;
163
+ const values = value.split(',').filter(Boolean);
164
+ Promise.resolve(values)
165
+ .then(values => {
166
+ if (values.length) {
167
+ if (!this.multiple) {
168
+ if (this.#values.size === 0) {
169
+ values.length = 1;
170
+ }
171
+ else {
172
+ values.length = 0;
173
+ }
174
+ }
175
+ for (const key of values) {
176
+ const option = this.#markup.getOptionByValue(key);
177
+ if (option)
178
+ this.#selectOption(option);
179
+ }
180
+ }
181
+ for (const key of prevValue) {
182
+ if (this.#values.has(key))
183
+ continue;
184
+ const option = this.#markup.getOptionByValue(key);
185
+ const tag = this.#markup.getTagByValue(key);
186
+ tag?.remove();
187
+ option?.toggleAttribute('selected', false);
188
+ }
189
+ });
190
+ }
191
+ // Instance methods
192
+ // <select> specific methods (implements HTMLSelectElement)
193
+ // add()
194
+ checkValidity() {
195
+ this.#internals.checkValidity();
196
+ }
197
+ item(index) {
198
+ return this.#markup.options.item(index);
199
+ }
200
+ // namedItem()
201
+ // !!! Conflicts with node.remove()
202
+ // remove(index: number)
203
+ reportValidity() {
204
+ this.#internals.reportValidity();
205
+ }
206
+ setCustomValidity(message) {
207
+ if (message === '') {
208
+ this.#internals.setValidity({});
209
+ }
210
+ else {
211
+ this.#internals.setValidity({ customError: true }, message);
212
+ }
213
+ }
214
+ showPicker() {
215
+ this.#markup.showDropdown();
216
+ }
217
+ // Overwritten methods
218
+ setAttribute(name, value) {
219
+ if (_a.OWN_IDL.has(name)) {
220
+ Reflect.set(this, name, value);
221
+ }
222
+ else {
223
+ super.setAttribute(name, value);
224
+ }
225
+ }
226
+ removeAttribute(name) {
227
+ if (_a.OWN_IDL.has(name)) {
228
+ Reflect.set(this, name, false);
229
+ }
230
+ else {
231
+ super.removeAttribute(name);
232
+ }
233
+ }
234
+ // Internal
235
+ #onInput = (event) => {
236
+ if (!this.searchable && this.filterable) {
237
+ if (event.target && event.target instanceof HTMLInputElement) {
238
+ this.#markup.sort(event.target.value);
239
+ }
240
+ }
241
+ };
242
+ #onOptionsChanges = (records) => {
243
+ records.forEach(record => {
244
+ record.addedNodes.forEach(node => {
245
+ if (node instanceof HTML_combobox_option_element_js_1.HTMLComboboxOptionElement) {
246
+ node.addEventListener('click', this.#onSelectOption);
247
+ if (node.selected) {
248
+ if (this.multiple) {
249
+ this.#selectOption(node);
250
+ }
251
+ else if (this.#values.size === 0) {
252
+ this.#selectOption(node);
253
+ }
254
+ }
255
+ }
256
+ if (node instanceof HTML_combobox_option_element_js_1.HTMLComboboxOptionElement || node instanceof HTMLOptGroupElement) {
257
+ this.#markup.optionsContainer.append(node);
258
+ }
259
+ });
260
+ });
261
+ this.#markup.invalidateOptionsCache();
262
+ this.#setValidityAndFormValue();
263
+ };
264
+ #selectOption(option) {
265
+ if (this.#values.has(option.value))
266
+ return;
267
+ const value = option.value;
268
+ this.#values.add(value);
269
+ option.toggleAttribute('selected', true);
270
+ const control = this.#markup.createAndAppendTag(option);
271
+ control?.addEventListener('click', this.#onClearTag);
272
+ if (!this.multiple) {
273
+ this.#markup.closeDropdown();
274
+ }
275
+ }
276
+ #onSelectOption = (event) => {
277
+ const target = event.target;
278
+ if (target && target instanceof HTMLElement) {
279
+ const option = target.closest('box-option');
280
+ if (option) {
281
+ if (this.#values.has(option.value))
282
+ return;
283
+ if (!this.multiple) {
284
+ event.stopPropagation();
285
+ this.#values.forEach(value => {
286
+ this.#markup.getTagByValue(value)?.remove();
287
+ this.#markup.getOptionByValue(value)?.toggleAttribute('selected', false);
288
+ });
289
+ this.#values.clear();
290
+ this.#markup.tagsContainer.replaceChildren();
291
+ }
292
+ this.#selectOption(option);
293
+ this.#setValidityAndFormValue();
294
+ this.dispatchEvent(new Event('change'));
295
+ }
296
+ }
297
+ };
298
+ #onClearTag = (event) => {
299
+ const target = event.target;
300
+ if (target && target instanceof HTMLElement) {
301
+ const tag = target.closest('box-tag');
302
+ if (tag) {
303
+ const value = tag.getAttribute('value');
304
+ const option = this.#markup.getOptionByValue(value);
305
+ option.removeAttribute('selected');
306
+ this.#values.delete(value);
307
+ tag.remove();
308
+ this.#setValidityAndFormValue();
309
+ this.dispatchEvent(new Event('change'));
310
+ }
311
+ }
312
+ };
313
+ #onClear = () => {
314
+ this.formResetCallback();
315
+ };
316
+ #setValidityAndFormValue() {
317
+ this.#internals.setFormValue(this.value);
318
+ if (this.required && this.value === '') {
319
+ this.#internals.setValidity({ valueMissing: true });
320
+ }
321
+ else {
322
+ this.#internals.setValidity({});
323
+ }
324
+ }
325
+ #initialAttributesSynchronization() {
326
+ for (const key of _a.OWN_IDL) {
327
+ this[key] = this.getAttribute(key);
328
+ }
329
+ }
330
+ static loadCssFromUrls(urls) {
331
+ Combobox_markup_js_1.ComboboxMarkup.importCSS(urls);
332
+ }
333
+ static loadCssFromDocumentStyleSheets() {
334
+ if (document.readyState === 'complete') {
335
+ _a.#loadDocumentStyleSheets();
336
+ }
337
+ if (document.readyState === 'loading') {
338
+ document.addEventListener('DOMContentLoaded', _a.#loadDocumentStyleSheets);
339
+ }
340
+ if (document.readyState === 'interactive') {
341
+ queueMicrotask(_a.#loadDocumentStyleSheets);
342
+ }
343
+ }
344
+ static #loadDocumentStyleSheets() {
345
+ const [innerSheet] = _a.styleSheet;
346
+ for (const outerSheet of document.styleSheets) {
347
+ for (const rule of outerSheet.cssRules) {
348
+ innerSheet.insertRule(rule.cssText, innerSheet.cssRules.length);
349
+ }
350
+ }
351
+ }
352
+ }
353
+ exports.HTMLComboboxElement = HTMLComboboxElement;
354
+ _a = HTMLComboboxElement;
355
+ document.addEventListener('keypress', (event) => {
356
+ if (document.activeElement instanceof HTMLComboboxElement) {
357
+ const maybeHost = document.activeElement.shadowRoot.activeElement;
358
+ if (maybeHost instanceof HTML_combobox_option_element_js_1.HTMLComboboxOptionElement) {
359
+ maybeHost.click();
360
+ }
361
+ }
362
+ });
363
+ if (!window.customElements.get('combo-box')) {
364
+ window.customElements.define('combo-box', HTMLComboboxElement);
365
+ }
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.HTMLComboboxOptionElement = void 0;
5
+ const Boolean_attribute_value_normalizer_js_1 = require("./Boolean.attribute.value.normalizer.js");
6
+ class HTMLComboboxOptionElement extends HTMLElement {
7
+ static OWN_IDL = new Set(['value', 'label', 'selected']);
8
+ connectedCallback() {
9
+ this.#initialAttributesSynchronization();
10
+ this.part.add('option');
11
+ super.setAttribute('tabindex', "0");
12
+ super.setAttribute('role', "option");
13
+ if (!this.value) {
14
+ this.value = this.textContent;
15
+ }
16
+ }
17
+ get value() {
18
+ return this.getAttribute('value');
19
+ }
20
+ set value(value) {
21
+ if (value == null)
22
+ return;
23
+ super.setAttribute('value', String(value));
24
+ }
25
+ get label() {
26
+ return this.getAttribute('label');
27
+ }
28
+ set label(value) {
29
+ if (value == null)
30
+ return;
31
+ super.setAttribute('label', String(value));
32
+ }
33
+ get selected() {
34
+ return this.hasAttribute('selected');
35
+ }
36
+ set selected(value) {
37
+ super.toggleAttribute('selected', (0, Boolean_attribute_value_normalizer_js_1.toBoolean)(value));
38
+ }
39
+ #initialAttributesSynchronization() {
40
+ for (const key of _a.OWN_IDL) {
41
+ this[key] = this.getAttribute(key);
42
+ }
43
+ }
44
+ setAttribute(name, value) {
45
+ if (_a.OWN_IDL.has(name)) {
46
+ this[name] = value;
47
+ }
48
+ else {
49
+ super.setAttribute(name, value);
50
+ }
51
+ }
52
+ removeAttribute(name) {
53
+ if (_a.OWN_IDL.has(name)) {
54
+ this[name] = null;
55
+ }
56
+ else {
57
+ super.removeAttribute(name);
58
+ }
59
+ }
60
+ }
61
+ exports.HTMLComboboxOptionElement = HTMLComboboxOptionElement;
62
+ _a = HTMLComboboxOptionElement;
63
+ if (!window.customElements.get('box-option')) {
64
+ window.customElements.define('box-option', HTMLComboboxOptionElement);
65
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HTMLComboboxTagElement = void 0;
4
+ class HTMLComboboxTagElement extends HTMLElement {
5
+ constructor() {
6
+ super();
7
+ }
8
+ connectedCallback() {
9
+ this.part.add('tag');
10
+ if (this.parentElement) {
11
+ if (this.parentElement.hasAttribute('multiple')) {
12
+ if (!this.querySelector('[part*="clear-tag"]')) {
13
+ throw new Error(`A <button> with part="clear-tag" is required for <combo-box> with multiple attribute`);
14
+ }
15
+ }
16
+ }
17
+ }
18
+ }
19
+ exports.HTMLComboboxTagElement = HTMLComboboxTagElement;
20
+ if (!window.customElements.get('box-tag')) {
21
+ window.customElements.define('box-tag', HTMLComboboxTagElement);
22
+ }
@@ -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("./HTML.combobox.element.js"), exports);
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ /// <reference types="solid-js" />
3
+ /// <reference types="preact" />
4
+ /// <reference types="react" />
5
+ /// <reference types="vue" />
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ __exportStar(require("./combobox/index.js"), exports);
22
+ // declare global {
23
+ // namespace React {
24
+ // namespace JSX {
25
+ // interface IntrinsicElements {
26
+ // 'combo-box': React.DetailedHTMLProps<Omit<React.HTMLAttributes<HTMLComboboxElement>, 'defaultValue'>,
27
+ // HTMLComboboxElement
28
+ // > & ComboboxJsxAttributes;
29
+ //
30
+ // 'box-option': React.DetailedHTMLProps<
31
+ // React.HTMLAttributes<HTMLComboboxOptionElement>,
32
+ // HTMLComboboxOptionElement>
33
+ // & ComboboxOptionJsxAttributes;
34
+ //
35
+ // 'box-tag': React.DetailedHTMLProps<React.HTMLAttributes<HTMLComboboxTagElement>, HTMLComboboxTagElement>;
36
+ // }
37
+ // }
38
+ // }
39
+ //
40
+ //
41
+ // namespace preact {
42
+ // namespace JSX {
43
+ // interface IntrinsicElements {
44
+ // 'combo-box': preact.HTMLAttributes<HTMLComboboxElement> & ComboboxJsxAttributes;
45
+ // 'box-option': preact.HTMLAttributes<HTMLComboboxOptionElement> & ComboboxOptionJsxAttributes;
46
+ // 'box-tag': preact.HTMLAttributes<HTMLComboboxTagElement>;
47
+ // }
48
+ // }
49
+ // }
50
+ //
51
+ // }
52
+ //
53
+ // declare module 'preact' {
54
+ // namespace JSX {
55
+ // interface IntrinsicElements {
56
+ // 'combo-box': preact.HTMLAttributes<HTMLComboboxElement> & ComboboxJsxAttributes;
57
+ // 'box-option': preact.HTMLAttributes<HTMLComboboxOptionElement> & ComboboxOptionJsxAttributes;
58
+ // 'box-tag': preact.HTMLAttributes<HTMLComboboxTagElement>;
59
+ // }
60
+ // }
61
+ // }
62
+ //
63
+ // // Solid
64
+ // declare module 'solid-js' {
65
+ // namespace JSX {
66
+ // interface IntrinsicElements {
67
+ // 'combo-box': HTMLAttributes<HTMLComboboxElement> & ComboboxJsxAttributes
68
+ // 'box-option': HTMLAttributes<HTMLComboboxOptionElement> & ComboboxOptionJsxAttributes
69
+ // 'box-tag': HTMLAttributes<HTMLElement>
70
+ // }
71
+ // }
72
+ // }
73
+ //
74
+ //
75
+ // declare global {
76
+ // namespace JSX {
77
+ // interface IntrinsicElements {
78
+ // 'combo-box': ComboboxJsxAttributes;
79
+ // 'box-option': ComboboxOptionJsxAttributes;
80
+ // 'box-tag': HTMLElement;
81
+ // }
82
+ // }
83
+ // }
@@ -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,8 @@
1
+ /** Transform invalid (nullish or stringed) values to correct boolean value */
2
+ export function toBoolean(value) {
3
+ if (value == null || value === 'false' || value === false)
4
+ value = false;
5
+ if (value === true || value === 'true' || value === '')
6
+ value = true;
7
+ return Boolean(value);
8
+ }