@aquera/nile-elements 1.7.1 → 1.7.2

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 (75) hide show
  1. package/README.md +3 -0
  2. package/dist/index.cjs.js +1 -1
  3. package/dist/index.esm.js +1 -1
  4. package/dist/index.js +1396 -413
  5. package/dist/nile-combobox/index.cjs.js +2 -0
  6. package/dist/nile-combobox/index.cjs.js.map +1 -0
  7. package/dist/nile-combobox/index.esm.js +1 -0
  8. package/dist/nile-combobox/nile-combobox.cjs.js +2 -0
  9. package/dist/nile-combobox/nile-combobox.cjs.js.map +1 -0
  10. package/dist/nile-combobox/nile-combobox.css.cjs.js +2 -0
  11. package/dist/nile-combobox/nile-combobox.css.cjs.js.map +1 -0
  12. package/dist/nile-combobox/nile-combobox.css.esm.js +642 -0
  13. package/dist/nile-combobox/nile-combobox.esm.js +233 -0
  14. package/dist/nile-combobox/portal-manager.cjs.js +2 -0
  15. package/dist/nile-combobox/portal-manager.cjs.js.map +1 -0
  16. package/dist/nile-combobox/portal-manager.esm.js +1 -0
  17. package/dist/nile-combobox/renderer.cjs.js +2 -0
  18. package/dist/nile-combobox/renderer.cjs.js.map +1 -0
  19. package/dist/nile-combobox/renderer.esm.js +105 -0
  20. package/dist/nile-combobox/search-manager.cjs.js +2 -0
  21. package/dist/nile-combobox/search-manager.cjs.js.map +1 -0
  22. package/dist/nile-combobox/search-manager.esm.js +1 -0
  23. package/dist/nile-combobox/selection-manager.cjs.js +2 -0
  24. package/dist/nile-combobox/selection-manager.cjs.js.map +1 -0
  25. package/dist/nile-combobox/selection-manager.esm.js +1 -0
  26. package/dist/nile-combobox/types.cjs.js +2 -0
  27. package/dist/nile-combobox/types.cjs.js.map +1 -0
  28. package/dist/nile-combobox/types.esm.js +1 -0
  29. package/dist/src/index.d.ts +1 -0
  30. package/dist/src/index.js +1 -0
  31. package/dist/src/index.js.map +1 -1
  32. package/dist/src/nile-combobox/index.d.ts +1 -0
  33. package/dist/src/nile-combobox/index.js +2 -0
  34. package/dist/src/nile-combobox/index.js.map +1 -0
  35. package/dist/src/nile-combobox/nile-combobox.css.d.ts +9 -0
  36. package/dist/src/nile-combobox/nile-combobox.css.js +651 -0
  37. package/dist/src/nile-combobox/nile-combobox.css.js.map +1 -0
  38. package/dist/src/nile-combobox/nile-combobox.d.ts +287 -0
  39. package/dist/src/nile-combobox/nile-combobox.js +1602 -0
  40. package/dist/src/nile-combobox/nile-combobox.js.map +1 -0
  41. package/dist/src/nile-combobox/nile-combobox.test.d.ts +1 -0
  42. package/dist/src/nile-combobox/nile-combobox.test.js +551 -0
  43. package/dist/src/nile-combobox/nile-combobox.test.js.map +1 -0
  44. package/dist/src/nile-combobox/portal-manager.d.ts +26 -0
  45. package/dist/src/nile-combobox/portal-manager.js +218 -0
  46. package/dist/src/nile-combobox/portal-manager.js.map +1 -0
  47. package/dist/src/nile-combobox/renderer.d.ts +20 -0
  48. package/dist/src/nile-combobox/renderer.js +210 -0
  49. package/dist/src/nile-combobox/renderer.js.map +1 -0
  50. package/dist/src/nile-combobox/search-manager.d.ts +15 -0
  51. package/dist/src/nile-combobox/search-manager.js +41 -0
  52. package/dist/src/nile-combobox/search-manager.js.map +1 -0
  53. package/dist/src/nile-combobox/selection-manager.d.ts +12 -0
  54. package/dist/src/nile-combobox/selection-manager.js +44 -0
  55. package/dist/src/nile-combobox/selection-manager.js.map +1 -0
  56. package/dist/src/nile-combobox/types.d.ts +23 -0
  57. package/dist/src/nile-combobox/types.js +8 -0
  58. package/dist/src/nile-combobox/types.js.map +1 -0
  59. package/dist/src/version.js +1 -1
  60. package/dist/src/version.js.map +1 -1
  61. package/dist/tsconfig.tsbuildinfo +1 -1
  62. package/package.json +3 -1
  63. package/src/index.ts +1 -0
  64. package/src/nile-combobox/index.ts +1 -0
  65. package/src/nile-combobox/nile-combobox.css.ts +653 -0
  66. package/src/nile-combobox/nile-combobox.test.ts +704 -0
  67. package/src/nile-combobox/nile-combobox.ts +1663 -0
  68. package/src/nile-combobox/portal-manager.ts +263 -0
  69. package/src/nile-combobox/renderer.ts +349 -0
  70. package/src/nile-combobox/search-manager.ts +53 -0
  71. package/src/nile-combobox/selection-manager.ts +57 -0
  72. package/src/nile-combobox/types.ts +27 -0
  73. package/vscode-html-custom-data.json +306 -4
  74. package/web-dev-server.config.mjs +9 -0
  75. package/web-test-runner.config.mjs +11 -0
@@ -0,0 +1,287 @@
1
+ /**
2
+ * Copyright Aquera Inc 2025
3
+ *
4
+ * This source code is licensed under the BSD-3-Clause license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import '../nile-icon';
8
+ import '../nile-popup/nile-popup';
9
+ import '../nile-tag/nile-tag';
10
+ import '../nile-option/nile-option';
11
+ import '../nile-checkbox/nile-checkbox';
12
+ import '../nile-loader/nile-loader';
13
+ import NileElement from '../internal/nile-element';
14
+ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
15
+ import type { NileFormControl } from '../internal/nile-element';
16
+ import type NilePopup from '../nile-popup/nile-popup';
17
+ import type { ComboboxOption, ComboboxRenderItemConfig, ComboboxTagLayout, ComboboxSize, ComboboxPlacement } from './types.js';
18
+ /**
19
+ * @summary A data-driven combobox with virtualized options, inline search, multi-select tags,
20
+ * custom value creation, and full WAI-ARIA Combobox keyboard navigation.
21
+ *
22
+ * @tag nile-combobox
23
+ * @status stable
24
+ * @since 2.0
25
+ *
26
+ * @dependency nile-icon
27
+ * @dependency nile-popup
28
+ * @dependency nile-tag
29
+ * @dependency nile-checkbox
30
+ * @dependency nile-loader
31
+ *
32
+ * @slot label - The input's label.
33
+ * @slot prefix - Prepend a presentational icon or element before the input.
34
+ * @slot clear-icon - An icon to use in lieu of the default clear icon.
35
+ * @slot expand-icon - The icon to show when the control is expanded/collapsed.
36
+ * @slot help-text - Text that describes how to use the input.
37
+ * @slot footer - Custom footer content (overrides default footer in multi-select mode).
38
+ * @slot no-results - Custom no-results content.
39
+ *
40
+ * @event nile-change - Emitted when the control's value changes.
41
+ * @event nile-clear - Emitted when the control's value is cleared.
42
+ * @event nile-input - Emitted when the control receives input.
43
+ * @event nile-focus - Emitted when the control gains focus.
44
+ * @event nile-blur - Emitted when the control loses focus.
45
+ * @event nile-show - Emitted when the dropdown opens.
46
+ * @event nile-after-show - Emitted after the dropdown opens and all animations complete.
47
+ * @event nile-hide - Emitted when the dropdown closes.
48
+ * @event nile-after-hide - Emitted after the dropdown closes and all animations complete.
49
+ * @event nile-search - Emitted (debounced) when the user types. Useful for API-driven filtering.
50
+ * @event nile-tag-remove - Emitted when a tag is removed in multi-select mode.
51
+ * @event nile-tag-add - Emitted when a custom value is added via allowCustomValue.
52
+ * @event nile-scroll-end - Emitted when scrolled to the bottom (for infinite loading).
53
+ * @event nile-invalid - Emitted when form validation constraints aren't satisfied.
54
+ * @event nile-select-all - Emitted when the Select all / Deselect all control toggles. Detail: { value, name, action: 'select-all' | 'deselect-all' }.
55
+ *
56
+ * @csspart form-control - The form control wrapper.
57
+ * @csspart form-control-label - The label wrapper.
58
+ * @csspart form-control-input - The input area wrapper.
59
+ * @csspart combobox - The combobox trigger (input + tags + icons).
60
+ * @csspart input - The text input element.
61
+ * @csspart listbox - The dropdown listbox.
62
+ * @csspart tags - The tags container in multi-select mode.
63
+ * @csspart tag - Each individual tag.
64
+ * @csspart clear-button - The clear button.
65
+ * @csspart expand-icon - The expand/collapse icon.
66
+ * @csspart top-actions - The sticky row above the option list that contains the Select all checkbox and the Selected / Show all filter toggle. Rendered only when multiple && selectAllEnabled.
67
+ * @csspart select-all - The Select all / Deselect all checkbox wrapper inside top-actions.
68
+ * @csspart show-toggle - The "Selected / Show all" filter button inside top-actions.
69
+ * @csspart no-results - The empty-state container shown when a search/filter returns no items. Contains no-results-title and no-results-subtitle.
70
+ * @csspart no-results-title - The title row of the no-results empty state.
71
+ * @csspart no-results-subtitle - The subtitle row of the no-results empty state.
72
+ * @csspart no-data - The empty-state container shown when the dataset is empty (no active search/filter).
73
+ * @csspart footer - The footer with "Show Selected" / "Clear All".
74
+ * @csspart no-results - The no-results message.
75
+ */
76
+ export declare class NileCombobox extends NileElement implements NileFormControl {
77
+ static styles: CSSResultGroup;
78
+ private readonly formControlController;
79
+ private readonly hasSlotController;
80
+ private readonly portalManager;
81
+ private readonly searchManager;
82
+ private scrollElementRef;
83
+ private virtualizerCtrl;
84
+ private hScrollElementRef;
85
+ private hVirtualizerCtrl;
86
+ private scrollTimeout;
87
+ private scrolling;
88
+ private visibilityManager?;
89
+ private keyboardActiveIndex;
90
+ popup: NilePopup;
91
+ combobox: HTMLElement;
92
+ inputElement: HTMLInputElement;
93
+ valueInput: HTMLInputElement;
94
+ private hasFocus;
95
+ displayLabel: string;
96
+ selectedOptions: ComboboxOption[];
97
+ /** The items displayed after filtering. Renderer reads from this. */
98
+ filteredData: any[];
99
+ /** The complete unfiltered dataset (preserved for re-filtering). */
100
+ private originalData;
101
+ showNoResults: boolean;
102
+ showListbox: boolean;
103
+ searchValue: string;
104
+ private showSelectedOnly;
105
+ private selectAllChecked;
106
+ private selectAllIndeterminate;
107
+ name: string;
108
+ data: any[];
109
+ value: string | string[];
110
+ defaultValue: string | string[];
111
+ size: ComboboxSize;
112
+ placeholder: string;
113
+ multiple: boolean;
114
+ label: string;
115
+ required: boolean;
116
+ disabled: boolean;
117
+ open: boolean;
118
+ clearable: boolean;
119
+ loading: boolean;
120
+ optionsLoading: boolean;
121
+ /** When true, skip local filtering and rely solely on the `nile-search` event for API-driven results. */
122
+ disableLocalSearch: boolean;
123
+ /** When true, displays a "+ Add [value]" option for values not in the data. */
124
+ allowCustomValue: boolean;
125
+ /** When true, typing free text and pressing Enter/Tab adds it as a tag (like nile-chip's acceptUserInput). */
126
+ acceptUserInput: boolean;
127
+ /** When true, custom values added via allowCustomValue or acceptUserInput are also appended to the suggestions list. */
128
+ addToSuggestions: boolean;
129
+ /** When true, value must match an option. On blur, reverts to the last valid value if text doesn't match. */
130
+ strict: boolean;
131
+ /** Max tags visible before showing "+N more" (0 = no limit). */
132
+ maxTagsVisible: number;
133
+ /** Controls how tags wrap in multi-select mode. */
134
+ tagLayout: ComboboxTagLayout;
135
+ /**
136
+ * Show footer with "Show Selected" and "Clear All" in multi-select mode.
137
+ * Automatically suppressed when `selectAllEnabled` is true, since the top
138
+ * actions row already provides the same controls.
139
+ */
140
+ showFooter: boolean;
141
+ /**
142
+ * When true (and `multiple` is true), renders a "Select all" / "Deselect all"
143
+ * checkbox at the top of the listbox. Operates on the currently visible,
144
+ * non-disabled options (respects the active search filter).
145
+ */
146
+ selectAllEnabled: boolean;
147
+ portal: boolean;
148
+ hoist: boolean;
149
+ placement: ComboboxPlacement;
150
+ form: string;
151
+ helpText: string;
152
+ errorMessage: string;
153
+ warning: boolean;
154
+ error: boolean;
155
+ success: boolean;
156
+ filled: boolean;
157
+ pill: boolean;
158
+ noResultsMessage: string;
159
+ noResultsSubtitle: string;
160
+ noDataMessage: string;
161
+ /**
162
+ * Pre-defined autocomplete suggestions. Accepts a JSON array string attribute
163
+ * or a JS array property (like nile-chip). When `addToSuggestions` is true,
164
+ * custom values added by the user are appended to this list and persisted.
165
+ */
166
+ autoCompleteOptions: any[];
167
+ /** Debounce interval (ms) for the nile-search event. */
168
+ debounceMs: number;
169
+ renderItemConfig?: ComboboxRenderItemConfig;
170
+ allowHtmlLabel: boolean;
171
+ enableVisibilityEffect: boolean;
172
+ enableTabClose: boolean;
173
+ noWidthSync: boolean;
174
+ /** Number of columns in the dropdown grid (vertical scroll). When > 1, options render in a multi-column grid layout. */
175
+ gridColumns: number;
176
+ /** Number of visible rows in horizontal grid mode. When > 0, enables horizontal virtual scroll with columns scrolling left/right. */
177
+ gridRows: number;
178
+ /** Width of each column in horizontal grid mode (px). */
179
+ gridColumnWidth: number;
180
+ get validity(): ValidityState;
181
+ get validationMessage(): string;
182
+ connectedCallback(): void;
183
+ disconnectedCallback(): void;
184
+ protected firstUpdated(_changed: PropertyValues): void;
185
+ protected updated(changedProperties: PropertyValues): void;
186
+ private get isHorizontalGrid();
187
+ private get hasActiveFilter();
188
+ private renderEmptyState;
189
+ private get isBidirectionalGrid();
190
+ private get virtualRowCount();
191
+ private get virtualColumnCount();
192
+ private updateVirtualizerCount;
193
+ private getDisplayText;
194
+ private getItemValue;
195
+ private getSearchText;
196
+ private getItemDescription;
197
+ private getItemPrefix;
198
+ private getItemSuffix;
199
+ private syncSelection;
200
+ /**
201
+ * Returns the options eligible for Select All — the currently filtered data
202
+ * (so the active search/filter is respected) minus any `disabled` items.
203
+ * Mirrors nile-select's `getSelectableOptions()` contract.
204
+ */
205
+ private getSelectableData;
206
+ /**
207
+ * Derives `selectAllChecked` + `selectAllIndeterminate` from the current
208
+ * selection vs. the selectable set. No-op when `multiple` is false.
209
+ *
210
+ * options=0 → both false (nothing to select, e.g. empty search)
211
+ * selected=0 → checked=false, indeterminate=false
212
+ * selected=options → checked=true, indeterminate=false
213
+ * otherwise (partial) → checked=false, indeterminate=true
214
+ */
215
+ private updateSelectAllState;
216
+ /**
217
+ * Toggles all selectable, visible options. Indeterminate → clears selection
218
+ * (matches the "Deselect All" label flip), empty → selects all,
219
+ * fully-selected → clears.
220
+ */
221
+ private handleSelectAllToggle;
222
+ private handleDocumentFocusIn;
223
+ private handleDocumentKeyDown;
224
+ private handleDocumentMouseDown;
225
+ private handleWindowError;
226
+ private handleWindowResize;
227
+ private handleWindowScroll;
228
+ private setupBoundHandlers;
229
+ private addOpenListeners;
230
+ private removeOpenListeners;
231
+ private onInputKeyDown;
232
+ private onGlobalKeyDown;
233
+ private getVisibleOptions;
234
+ private moveActiveOption;
235
+ private setActiveOption;
236
+ private selectActiveOption;
237
+ private onInputChange;
238
+ private onInputHandler;
239
+ private filterOptions;
240
+ private onFocusIn;
241
+ private onFocusOut;
242
+ private onTriggerMouseDown;
243
+ private onOptionClick;
244
+ private handleOptionSelection;
245
+ private addCustomValue;
246
+ private onClearClick;
247
+ private removeTag;
248
+ private onFooterClick;
249
+ private toggleShowSelected;
250
+ private clearAll;
251
+ private onScroll;
252
+ show(): Promise<unknown>;
253
+ hide(): Promise<unknown>;
254
+ handleOpenChange(): Promise<void>;
255
+ private doOpen;
256
+ private doClose;
257
+ handleDisabledChange(): void;
258
+ handleValueChange(): void;
259
+ handleDataChange(): void;
260
+ handleAutoCompleteOptionsChange(): void;
261
+ handleSelectAllConfigChange(): void;
262
+ handlePortalChange(): void;
263
+ checkValidity(): boolean;
264
+ getForm(): HTMLFormElement | null;
265
+ reportValidity(): boolean;
266
+ setCustomValidity(message: string): void;
267
+ focus(options?: FocusOptions): void;
268
+ blur(): void;
269
+ private handleInvalid;
270
+ private updateValidity;
271
+ private resetScrollPosition;
272
+ render(): TemplateResult;
273
+ private renderTrigger;
274
+ private renderInlineTags;
275
+ private renderClearButton;
276
+ private renderListbox;
277
+ private renderHorizontalListbox;
278
+ private renderLoader;
279
+ private renderSelectAll;
280
+ private renderFooter;
281
+ }
282
+ export default NileCombobox;
283
+ declare global {
284
+ interface HTMLElementTagNameMap {
285
+ 'nile-combobox': NileCombobox;
286
+ }
287
+ }