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.
- package/LICENSE +21 -0
- package/dist/cjs/combobox/Boolean.attribute.value.normalizer.js +11 -0
- package/dist/cjs/combobox/Combobox.markup.js +371 -0
- package/dist/cjs/combobox/HTML.combobox.element.js +365 -0
- package/dist/cjs/combobox/HTML.combobox.option.element.js +65 -0
- package/dist/cjs/combobox/HTML.combobox.tag.element.js +22 -0
- package/dist/cjs/combobox/index.js +17 -0
- package/dist/cjs/index.js +83 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/esm/combobox/Boolean.attribute.value.normalizer.js +8 -0
- package/dist/esm/combobox/Combobox.markup.js +367 -0
- package/dist/esm/combobox/HTML.combobox.element.js +359 -0
- package/dist/esm/combobox/HTML.combobox.option.element.js +59 -0
- package/dist/esm/combobox/HTML.combobox.tag.element.js +18 -0
- package/dist/esm/combobox/index.js +1 -0
- package/dist/esm/index.js +67 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/types/combobox/Boolean.attribute.value.normalizer.d.ts +3 -0
- package/dist/types/combobox/Boolean.attribute.value.normalizer.d.ts.map +1 -0
- package/dist/types/combobox/Combobox.markup.d.ts +31 -0
- package/dist/types/combobox/Combobox.markup.d.ts.map +1 -0
- package/dist/types/combobox/HTML.combobox.element.d.ts +55 -0
- package/dist/types/combobox/HTML.combobox.element.d.ts.map +1 -0
- package/dist/types/combobox/HTML.combobox.option.element.d.ts +14 -0
- package/dist/types/combobox/HTML.combobox.option.element.d.ts.map +1 -0
- package/dist/types/combobox/HTML.combobox.tag.element.d.ts +5 -0
- package/dist/types/combobox/HTML.combobox.tag.element.d.ts.map +1 -0
- package/dist/types/combobox/index.d.ts +2 -0
- package/dist/types/combobox/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +214 -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 +45 -0
|
@@ -0,0 +1,214 @@
|
|
|
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 JSX {
|
|
130
|
+
interface IntrinsicElements {
|
|
131
|
+
'combo-box': React.DetailedHTMLProps<React.HTMLAttributes<HTMLComboboxElement> & ComboboxJsxAttributes, HTMLComboboxElement>;
|
|
132
|
+
'box-option': React.DetailedHTMLProps<React.HTMLAttributes<HTMLComboboxOptionElement> & ComboboxOptionJsxAttributes, HTMLComboboxOptionElement>;
|
|
133
|
+
'box-tag': React.DetailedHTMLProps<React.HTMLAttributes<HTMLComboboxTagElement>, HTMLComboboxTagElement>;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
namespace React {
|
|
137
|
+
namespace JSX {
|
|
138
|
+
interface IntrinsicElements {
|
|
139
|
+
'combo-box': React.DetailedHTMLProps<React.HTMLAttributes<HTMLComboboxElement> & ComboboxJsxAttributes, HTMLComboboxElement>;
|
|
140
|
+
'box-option': React.DetailedHTMLProps<React.HTMLAttributes<HTMLComboboxOptionElement> & ComboboxOptionJsxAttributes, HTMLComboboxOptionElement>;
|
|
141
|
+
'box-tag': React.DetailedHTMLProps<React.HTMLAttributes<HTMLComboboxTagElement>, HTMLComboboxTagElement>;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
namespace Solid {
|
|
146
|
+
namespace JSX {
|
|
147
|
+
interface IntrinsicElements {
|
|
148
|
+
'combo-box': any;
|
|
149
|
+
'box-option': any;
|
|
150
|
+
'box-tag': any;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
namespace Vue {
|
|
155
|
+
namespace JSX {
|
|
156
|
+
interface IntrinsicElements {
|
|
157
|
+
'combo-box': any;
|
|
158
|
+
'box-option': any;
|
|
159
|
+
'box-tag': any;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
namespace JSXInternal {
|
|
164
|
+
interface IntrinsicElements {
|
|
165
|
+
'combo-box': preact.HTMLAttributes<HTMLComboboxElement> & ComboboxJsxAttributes;
|
|
166
|
+
'box-option': preact.HTMLAttributes<HTMLComboboxElement> & ComboboxOptionJsxAttributes;
|
|
167
|
+
'box-tag': preact.HTMLAttributes<HTMLComboboxTagElement> & {};
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
declare module 'react' {
|
|
172
|
+
namespace JSX {
|
|
173
|
+
interface IntrinsicElements {
|
|
174
|
+
'combo-box': React.DetailedHTMLProps<React.HTMLAttributes<HTMLComboboxElement> & ComboboxJsxAttributes, HTMLComboboxElement>;
|
|
175
|
+
'box-option': React.DetailedHTMLProps<React.HTMLAttributes<HTMLComboboxOptionElement> & ComboboxOptionJsxAttributes, HTMLComboboxOptionElement>;
|
|
176
|
+
'box-tag': React.DetailedHTMLProps<React.HTMLAttributes<HTMLComboboxTagElement>, HTMLComboboxTagElement>;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
declare module 'preact' {
|
|
181
|
+
namespace JSX {
|
|
182
|
+
interface IntrinsicElements {
|
|
183
|
+
'combo-box': any;
|
|
184
|
+
'box-option': any;
|
|
185
|
+
'box-tag': any;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
namespace JSXInternal {
|
|
189
|
+
interface IntrinsicElements {
|
|
190
|
+
'combo-box': any;
|
|
191
|
+
'box-option': any;
|
|
192
|
+
'box-tag': any;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
declare module 'solid-js' {
|
|
197
|
+
namespace JSX {
|
|
198
|
+
interface IntrinsicElements {
|
|
199
|
+
'combo-box': any;
|
|
200
|
+
'box-option': any;
|
|
201
|
+
'box-tag': any;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
declare module 'vue' {
|
|
206
|
+
namespace JSX {
|
|
207
|
+
interface IntrinsicElements {
|
|
208
|
+
'combo-box': any;
|
|
209
|
+
'box-option': any;
|
|
210
|
+
'box-tag': any;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAKA,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+C;IAC/C,YAAY,EAAE,MAAM,EAAE,CAAC;IAEvB,QAAQ,EAAE,OAAO,CAAC;IAElB;;mGAE+F;IAC/F,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;SAKK;IACL,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;;;SAOK;IACL,SAAS,EAAE,OAAO,CAAC;IAEnB;;;;;;SAMK;IACL,UAAU,EAAE,OAAO,CAAC;IAEpB;;;;;SAKK;IACL,UAAU,EAAE,OAAO,CAAC;IAE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CAAC;QACZ,UAAU,iBAAiB;YACzB,WAAW,EAAE,GAAG,CAAC;YACjB,YAAY,EAAE,GAAG,CAAC;YAClB,SAAS,EAAE,GAAG,CAAC;SAChB;KACF;CACF;AAED,OAAO,QAAQ,KAAK,CAAC;IACnB,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB,WAAW,EAAE,GAAG,CAAC;YACjB,YAAY,EAAE,GAAG,CAAC;YAClB,SAAS,EAAE,GAAG,CAAC;SAChB;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
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "html-combobox-element",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "The combo-box web-component & customizable select polyfill",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"prepare": "husky",
|
|
8
|
+
"clean": "rm -rf dist",
|
|
9
|
+
"build:combobox": "tsc -b configs/tsconfig.cjs.json configs/tsconfig.esm.json configs/tsconfig.types.json",
|
|
10
|
+
"build": "npm-run-all clean build:combobox",
|
|
11
|
+
"check-types": "tsc --noEmit"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"web-components",
|
|
15
|
+
"custom elements",
|
|
16
|
+
"combo-box",
|
|
17
|
+
"combobox"
|
|
18
|
+
],
|
|
19
|
+
"author": "Roman Konstantin",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@espcom/eslint-config": "latest",
|
|
23
|
+
"@types/node": "22.8.6",
|
|
24
|
+
"@types/react": "^19.2.14",
|
|
25
|
+
"c8": "10.1.2",
|
|
26
|
+
"esbuild": "0.25.5",
|
|
27
|
+
"husky": "9.1.5",
|
|
28
|
+
"lint-staged": "15.2.9",
|
|
29
|
+
"npm-run-all": "^4.1.5",
|
|
30
|
+
"preact": "^10.28.4",
|
|
31
|
+
"react": "^19.2.4",
|
|
32
|
+
"solid-js": "^1.9.11",
|
|
33
|
+
"tsx": "^4.19.2",
|
|
34
|
+
"typescript": "5.9.3",
|
|
35
|
+
"vue": "^3.5.28",
|
|
36
|
+
"xml-splitter": "1.2.1"
|
|
37
|
+
},
|
|
38
|
+
"sideEffect": false,
|
|
39
|
+
"files": [
|
|
40
|
+
"dist"
|
|
41
|
+
],
|
|
42
|
+
"main": "dist/cjs/index.js",
|
|
43
|
+
"module": "dist/esm/index.js",
|
|
44
|
+
"types": "dist/types/index.d.ts"
|
|
45
|
+
}
|