@tangible/ui 0.2.8 → 0.2.9
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/components/Combobox/Combobox.d.ts +16 -11
- package/components/Combobox/Combobox.js +42 -196
- package/components/Combobox/types.d.ts +3 -7
- package/components/MultiCombobox/MultiCombobox.d.ts +16 -11
- package/components/MultiCombobox/MultiCombobox.js +42 -154
- package/components/MultiCombobox/types.d.ts +4 -7
- package/components/MultiSelect/MultiSelect.d.ts +16 -11
- package/components/MultiSelect/MultiSelect.js +70 -207
- package/components/MultiSelect/types.d.ts +5 -8
- package/components/SearchSelect/SearchSelect.d.ts +34 -0
- package/components/SearchSelect/SearchSelect.js +444 -0
- package/components/SearchSelect/SearchSelectContext.d.ts +7 -0
- package/components/SearchSelect/SearchSelectContext.js +21 -0
- package/components/SearchSelect/index.d.ts +2 -0
- package/components/SearchSelect/index.js +1 -0
- package/components/SearchSelect/types.d.ts +134 -0
- package/components/SearchSelect/types.js +5 -0
- package/components/Select/Select.d.ts +16 -11
- package/components/Select/Select.js +78 -237
- package/components/Select/types.d.ts +5 -8
- package/components/index.d.ts +2 -0
- package/components/index.js +1 -0
- package/package.json +5 -1
- package/styles/all.css +1 -1
- package/styles/all.expanded.css +180 -0
- package/styles/all.expanded.unlayered.css +180 -0
- package/styles/all.unlayered.css +1 -1
- package/styles/components/_bundle.scss +8 -4
- package/styles/components/search-select.scss +244 -0
- package/tui-manifest.json +74 -2
- package/utils/listbox/blur.d.ts +14 -0
- package/utils/listbox/blur.js +51 -0
- package/utils/listbox/filter-active-index.d.ts +16 -0
- package/utils/listbox/filter-active-index.js +72 -0
- package/utils/listbox/floating.d.ts +7 -0
- package/utils/listbox/floating.js +34 -0
- package/utils/listbox/group.d.ts +26 -0
- package/utils/listbox/group.js +40 -0
- package/utils/listbox/ids.d.ts +9 -0
- package/utils/listbox/ids.js +31 -0
- package/utils/listbox/index.d.ts +9 -0
- package/utils/listbox/index.js +11 -0
- package/utils/listbox/navigation.d.ts +27 -0
- package/utils/listbox/navigation.js +53 -0
- package/utils/listbox/registry.d.ts +61 -0
- package/utils/listbox/registry.js +121 -0
- package/utils/listbox/scroll.d.ts +7 -0
- package/utils/listbox/scroll.js +15 -0
- package/utils/listbox/trigger.d.ts +16 -0
- package/utils/listbox/trigger.js +35 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComboboxProps, ComboboxContentProps, ComboboxOptionProps
|
|
1
|
+
import type { ComboboxProps, ComboboxContentProps, ComboboxOptionProps } from './types';
|
|
2
2
|
declare function ComboboxRoot({ value: controlledValue, defaultValue, onValueChange, inputValue: controlledInputValue, onInputChange, open: controlledOpen, defaultOpen, onOpenChange, disabled, placeholder, size, openOnFocus, filterMode, onQueryChange, clearable, id: inputIdProp, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, 'aria-required': ariaRequired, inputClassName, labels: labelsProp, children, }: ComboboxProps): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
declare namespace ComboboxRoot {
|
|
4
4
|
var displayName: string;
|
|
@@ -11,14 +11,13 @@ declare function ComboboxOptionComponent({ value: optionValue, disabled, textVal
|
|
|
11
11
|
declare namespace ComboboxOptionComponent {
|
|
12
12
|
var displayName: string;
|
|
13
13
|
}
|
|
14
|
-
declare
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
14
|
+
declare const ComboboxGroupComponent: {
|
|
15
|
+
({ className, children }: import("..").SearchSelectGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
displayName: string;
|
|
17
|
+
}, ComboboxLabelComponent: {
|
|
18
|
+
({ className, children }: import("..").SearchSelectLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
displayName: string;
|
|
20
|
+
};
|
|
22
21
|
type ComboboxCompound = typeof ComboboxRoot & {
|
|
23
22
|
Content: typeof ComboboxContentComponent;
|
|
24
23
|
Option: typeof ComboboxOptionComponent;
|
|
@@ -28,6 +27,12 @@ type ComboboxCompound = typeof ComboboxRoot & {
|
|
|
28
27
|
export declare const Combobox: ComboboxCompound;
|
|
29
28
|
export declare const ComboboxContent: typeof ComboboxContentComponent;
|
|
30
29
|
export declare const ComboboxOption: typeof ComboboxOptionComponent;
|
|
31
|
-
export declare const ComboboxGroup:
|
|
32
|
-
|
|
30
|
+
export declare const ComboboxGroup: {
|
|
31
|
+
({ className, children }: import("..").SearchSelectGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
displayName: string;
|
|
33
|
+
};
|
|
34
|
+
export declare const ComboboxLabel: {
|
|
35
|
+
({ className, children }: import("..").SearchSelectLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
displayName: string;
|
|
37
|
+
};
|
|
33
38
|
export { useComboboxContext as useCombobox } from './ComboboxContext';
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import React, { useCallback, useEffect,
|
|
3
|
-
import {
|
|
4
|
-
import { useFloating, offset, flip, shift, size as sizeMiddleware, autoUpdate, FloatingPortal, useDismiss, useInteractions, useListNavigation, useRole, } from '@floating-ui/react';
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
3
|
+
import { FloatingPortal } from '@floating-ui/react';
|
|
5
4
|
import { cx } from '../../utils/cx.js';
|
|
6
5
|
import { toKey } from '../../utils/value-key.js';
|
|
7
6
|
import { getPortalRootFor } from '../../utils/portal.js';
|
|
8
|
-
import {
|
|
7
|
+
import { useOptionRegistry, useOptionRegistration, useListboxIds, useListboxFloating, useListboxNavigation, useListboxBlurGuard, useFilterStableActiveIndex, useActiveOptionScroll, optionIdForValue, createListboxGroupComponents, } from '../../utils/listbox/index.js';
|
|
9
8
|
import { composeEventHandlers } from '../../utils/compose-events.js';
|
|
10
9
|
import { Icon } from '../Icon/index.js';
|
|
11
10
|
import { ComboboxActionsContext, ComboboxStateContext, ComboboxContentContext, useComboboxContext, useComboboxContentContext, } from './ComboboxContext.js';
|
|
@@ -40,23 +39,15 @@ function ComboboxRoot({ value: controlledValue, defaultValue, onValueChange, inp
|
|
|
40
39
|
onQueryChange?.(query);
|
|
41
40
|
}
|
|
42
41
|
}, [query, onQueryChange]);
|
|
43
|
-
//
|
|
44
|
-
const
|
|
45
|
-
const [registryVersion, setRegistryVersion] = useState(0);
|
|
46
|
-
// Track open state via ref so unregisterOption can check synchronously
|
|
47
|
-
const openRef = useRef(false);
|
|
48
|
-
openRef.current = open;
|
|
42
|
+
// Shared option registry (listbox engine)
|
|
43
|
+
const { registerOption, unregisterOption, orderedOptions } = useOptionRegistry({ open });
|
|
49
44
|
// IDs
|
|
50
|
-
const
|
|
51
|
-
const inputId = inputIdProp ?? `${baseId}-input`;
|
|
52
|
-
const listboxId = `${baseId}-listbox`;
|
|
45
|
+
const { controlId: inputId, listboxId } = useListboxIds(inputIdProp, 'input');
|
|
53
46
|
// Refs
|
|
54
47
|
const inputRef = useRef(null);
|
|
55
48
|
const listRef = useRef([]);
|
|
56
49
|
// Active index for navigation (-1 means no active option)
|
|
57
50
|
const [activeIndex, setActiveIndex] = useState(-1);
|
|
58
|
-
// Track previous highlighted value to maintain selection across filter changes
|
|
59
|
-
const prevHighlightedValueRef = useRef(null);
|
|
60
51
|
// Set open state
|
|
61
52
|
const setOpen = useCallback((nextOpen) => {
|
|
62
53
|
if (disabled)
|
|
@@ -90,25 +81,6 @@ function ComboboxRoot({ value: controlledValue, defaultValue, onValueChange, inp
|
|
|
90
81
|
onValueChange?.(undefined);
|
|
91
82
|
setSearching(false); // End searching mode on clear
|
|
92
83
|
}, [onValueChange]);
|
|
93
|
-
// Get ordered options
|
|
94
|
-
const getOrderedOptions = useCallback(() => {
|
|
95
|
-
const options = Array.from(optionsRef.current.values());
|
|
96
|
-
return options.sort((a, b) => {
|
|
97
|
-
if (!a.ref.current || !b.ref.current)
|
|
98
|
-
return 0;
|
|
99
|
-
const position = a.ref.current.compareDocumentPosition(b.ref.current);
|
|
100
|
-
if (position & Node.DOCUMENT_POSITION_FOLLOWING)
|
|
101
|
-
return -1;
|
|
102
|
-
if (position & Node.DOCUMENT_POSITION_PRECEDING)
|
|
103
|
-
return 1;
|
|
104
|
-
return 0;
|
|
105
|
-
});
|
|
106
|
-
}, []);
|
|
107
|
-
// Memoized ordered options
|
|
108
|
-
const orderedOptions = useMemo(() => {
|
|
109
|
-
return getOrderedOptions();
|
|
110
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
111
|
-
}, [registryVersion]);
|
|
112
84
|
// Compute disabled indices for keyboard navigation
|
|
113
85
|
const disabledIndices = useMemo(() => orderedOptions.reduce((acc, opt, i) => {
|
|
114
86
|
if (opt.disabled)
|
|
@@ -116,116 +88,27 @@ function ComboboxRoot({ value: controlledValue, defaultValue, onValueChange, inp
|
|
|
116
88
|
return acc;
|
|
117
89
|
}, []), [orderedOptions]);
|
|
118
90
|
// Floating UI setup
|
|
119
|
-
const { refs, floatingStyles, context } =
|
|
120
|
-
placement: 'bottom-start',
|
|
91
|
+
const { refs, floatingStyles, context } = useListboxFloating({
|
|
121
92
|
open,
|
|
122
93
|
onOpenChange: setOpen,
|
|
123
|
-
middleware: [
|
|
124
|
-
offset(4),
|
|
125
|
-
flip({ padding: 8 }),
|
|
126
|
-
shift({ padding: 8 }),
|
|
127
|
-
sizeMiddleware({
|
|
128
|
-
apply({ availableHeight, rects, elements }) {
|
|
129
|
-
Object.assign(elements.floating.style, {
|
|
130
|
-
maxHeight: `${Math.min(availableHeight - 16, 300)}px`,
|
|
131
|
-
minWidth: `${rects.reference.width}px`,
|
|
132
|
-
});
|
|
133
|
-
},
|
|
134
|
-
padding: 8,
|
|
135
|
-
}),
|
|
136
|
-
],
|
|
137
|
-
whileElementsMounted: autoUpdate,
|
|
138
94
|
});
|
|
139
|
-
//
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
const listNavigation = useListNavigation(context, {
|
|
95
|
+
// Shared interaction stack (listbox engine) — no click/typeahead: the input
|
|
96
|
+
// opens itself and typing IS the search.
|
|
97
|
+
const { getReferenceProps, getFloatingProps, getItemProps } = useListboxNavigation(context, {
|
|
143
98
|
listRef,
|
|
144
99
|
activeIndex: activeIndex >= 0 ? activeIndex : null,
|
|
145
100
|
onNavigate: (index) => setActiveIndex(index ?? -1),
|
|
146
|
-
loop: true,
|
|
147
|
-
virtual: true,
|
|
148
101
|
disabledIndices,
|
|
102
|
+
withClick: false,
|
|
149
103
|
});
|
|
150
|
-
const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([
|
|
151
|
-
dismiss,
|
|
152
|
-
role,
|
|
153
|
-
listNavigation,
|
|
154
|
-
]);
|
|
155
|
-
// Flag: first registerOption call after open clears stale entries.
|
|
156
|
-
const prevOpenForFlush = useRef(open);
|
|
157
|
-
const needsFlushRef = useRef(false);
|
|
158
|
-
if (open && !prevOpenForFlush.current)
|
|
159
|
-
needsFlushRef.current = true;
|
|
160
|
-
prevOpenForFlush.current = open;
|
|
161
|
-
// Register option
|
|
162
|
-
const registerOption = useCallback((option) => {
|
|
163
|
-
if (needsFlushRef.current) {
|
|
164
|
-
optionsRef.current.clear();
|
|
165
|
-
needsFlushRef.current = false;
|
|
166
|
-
}
|
|
167
|
-
optionsRef.current.set(toKey(option.value), option);
|
|
168
|
-
setRegistryVersion((v) => v + 1);
|
|
169
|
-
}, []);
|
|
170
|
-
const unregisterOption = useCallback((optionValue) => {
|
|
171
|
-
// When the dropdown closes, options unmount and call unregister in cleanup.
|
|
172
|
-
// Skip the delete to preserve the registry — filtering and input display
|
|
173
|
-
// depend on it while closed. Options re-register on next open (same keys).
|
|
174
|
-
if (!openRef.current)
|
|
175
|
-
return;
|
|
176
|
-
optionsRef.current.delete(toKey(optionValue));
|
|
177
|
-
setRegistryVersion((v) => v + 1);
|
|
178
|
-
}, []);
|
|
179
104
|
// Active option ID for aria-activedescendant (hash-based for stability during filtering)
|
|
180
105
|
const activeOptionId = activeIndex >= 0 && orderedOptions[activeIndex]
|
|
181
|
-
?
|
|
106
|
+
? optionIdForValue(listboxId, orderedOptions[activeIndex].value)
|
|
182
107
|
: undefined;
|
|
183
|
-
//
|
|
184
|
-
|
|
185
|
-
useEffect(() => {
|
|
186
|
-
if (!open)
|
|
187
|
-
return;
|
|
188
|
-
const prevValue = prevHighlightedValueRef.current;
|
|
189
|
-
const enabledOptions = orderedOptions.filter((opt) => !opt.disabled);
|
|
190
|
-
if (enabledOptions.length === 0) {
|
|
191
|
-
setActiveIndex(-1);
|
|
192
|
-
prevHighlightedValueRef.current = null;
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
// If previously highlighted value still exists and is enabled, keep it
|
|
196
|
-
if (prevValue !== null) {
|
|
197
|
-
const prevIndex = orderedOptions.findIndex((opt) => toKey(opt.value) === toKey(prevValue) && !opt.disabled);
|
|
198
|
-
if (prevIndex >= 0) {
|
|
199
|
-
setActiveIndex(prevIndex);
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
// Otherwise, set to first enabled option
|
|
204
|
-
const firstEnabledIndex = orderedOptions.findIndex((opt) => !opt.disabled);
|
|
205
|
-
setActiveIndex(firstEnabledIndex >= 0 ? firstEnabledIndex : -1);
|
|
206
|
-
if (firstEnabledIndex >= 0) {
|
|
207
|
-
prevHighlightedValueRef.current = orderedOptions[firstEnabledIndex].value;
|
|
208
|
-
}
|
|
209
|
-
}, [open, orderedOptions]);
|
|
210
|
-
// Track highlighted value when activeIndex changes
|
|
211
|
-
useEffect(() => {
|
|
212
|
-
if (activeIndex >= 0 && orderedOptions[activeIndex]) {
|
|
213
|
-
prevHighlightedValueRef.current = orderedOptions[activeIndex].value;
|
|
214
|
-
}
|
|
215
|
-
}, [activeIndex, orderedOptions]);
|
|
216
|
-
// Reset activeIndex when closing
|
|
217
|
-
useEffect(() => {
|
|
218
|
-
if (!open) {
|
|
219
|
-
setActiveIndex(-1);
|
|
220
|
-
prevHighlightedValueRef.current = null;
|
|
221
|
-
}
|
|
222
|
-
}, [open]);
|
|
108
|
+
// Keep the highlighted OPTION stable as filtering shifts indices (engine)
|
|
109
|
+
useFilterStableActiveIndex({ open, orderedOptions, activeIndex, setActiveIndex, listRef });
|
|
223
110
|
// Scroll active option into view
|
|
224
|
-
|
|
225
|
-
if (open && activeIndex >= 0 && listRef.current[activeIndex]) {
|
|
226
|
-
listRef.current[activeIndex]?.scrollIntoView({ block: 'nearest' });
|
|
227
|
-
}
|
|
228
|
-
}, [open, activeIndex]);
|
|
111
|
+
useActiveOptionScroll(open, activeIndex, listRef);
|
|
229
112
|
// Handle input change (user typing)
|
|
230
113
|
const handleInputChange = useCallback((e) => {
|
|
231
114
|
const newValue = e.target.value;
|
|
@@ -290,24 +173,15 @@ function ComboboxRoot({ value: controlledValue, defaultValue, onValueChange, inp
|
|
|
290
173
|
}
|
|
291
174
|
}, [disabled, open, setOpen, activeIndex, orderedOptions, selectOption]);
|
|
292
175
|
// Handle input blur with blur guard
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
// Check if focus moved to floating content
|
|
304
|
-
const floating = refs.floating.current;
|
|
305
|
-
if (floating && relatedTarget && floating.contains(relatedTarget)) {
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
setSearching(false); // End searching mode on blur
|
|
309
|
-
setOpen(false);
|
|
310
|
-
}, [open, setOpen, refs.floating]);
|
|
176
|
+
// Shared three-branch focus-loss guard (listbox engine); searching mode ends
|
|
177
|
+
// on every close path.
|
|
178
|
+
const endSearchingOnClose = useCallback(() => setSearching(false), []);
|
|
179
|
+
const handleInputBlur = useListboxBlurGuard({
|
|
180
|
+
open,
|
|
181
|
+
setOpen,
|
|
182
|
+
floatingRef: refs.floating,
|
|
183
|
+
onBeforeClose: endSearchingOnClose,
|
|
184
|
+
});
|
|
311
185
|
// Handle clear button - clears both input text and selected value
|
|
312
186
|
const handleClear = useCallback((e) => {
|
|
313
187
|
e.preventDefault(); // Keep focus in input
|
|
@@ -421,20 +295,17 @@ function ComboboxOptionComponent({ value: optionValue, disabled = false, textVal
|
|
|
421
295
|
const { value: selectedValue, selectOption, listboxId, registerOption, unregisterOption, getItemProps, } = useComboboxContext();
|
|
422
296
|
const { listRef, activeIndex, orderedOptions } = useComboboxContentContext();
|
|
423
297
|
const ref = useRef(null);
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
registerOption({ value: optionValue, ref, disabled, textValue });
|
|
436
|
-
return () => unregisterOption(optionValue);
|
|
437
|
-
}, [optionValue, disabled, textValue, registerOption, unregisterOption]);
|
|
298
|
+
// Shared registration: textValue derivation, dev warn, layout-effect register
|
|
299
|
+
useOptionRegistration({
|
|
300
|
+
value: optionValue,
|
|
301
|
+
disabled,
|
|
302
|
+
textValue: explicitTextValue,
|
|
303
|
+
children,
|
|
304
|
+
componentName: 'Combobox.Option',
|
|
305
|
+
elementRef: ref,
|
|
306
|
+
registerOption,
|
|
307
|
+
unregisterOption,
|
|
308
|
+
});
|
|
438
309
|
// Find this option's index
|
|
439
310
|
const index = orderedOptions.findIndex((opt) => toKey(opt.value) === toKey(optionValue));
|
|
440
311
|
// Assign ref to listRef for navigation
|
|
@@ -455,8 +326,7 @@ function ComboboxOptionComponent({ value: optionValue, disabled = false, textVal
|
|
|
455
326
|
e.preventDefault();
|
|
456
327
|
}, []);
|
|
457
328
|
// Hash-based ID for stability during filtering (aria-activedescendant references this)
|
|
458
|
-
|
|
459
|
-
const optionId = `${listboxId}-opt-${hashForId(toKey(optionValue))}`;
|
|
329
|
+
const optionId = optionIdForValue(listboxId, optionValue);
|
|
460
330
|
// Get item props and compose our pointerdown handler with any from Floating UI
|
|
461
331
|
const itemProps = getItemProps({
|
|
462
332
|
onClick: handleClick,
|
|
@@ -467,36 +337,12 @@ ComboboxOptionComponent.displayName = 'Combobox.Option';
|
|
|
467
337
|
// =============================================================================
|
|
468
338
|
// Combobox.Group
|
|
469
339
|
// =============================================================================
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
if (groupRef.current) {
|
|
477
|
-
const labelEl = groupRef.current.querySelector(`#${CSS.escape(`${groupId}-label`)}`);
|
|
478
|
-
setHasLabel(!!labelEl);
|
|
479
|
-
}
|
|
480
|
-
}, [groupId, children]);
|
|
481
|
-
return (_jsx("div", { ref: groupRef, role: "group", "aria-labelledby": hasLabel ? `${groupId}-label` : undefined, className: cx('tui-combobox__group', className), children: _jsx(ComboboxGroupContext.Provider, { value: { groupId }, children: children }) }));
|
|
482
|
-
}
|
|
483
|
-
ComboboxGroupComponent.displayName = 'Combobox.Group';
|
|
484
|
-
const ComboboxGroupContext = React.createContext(null);
|
|
485
|
-
// =============================================================================
|
|
486
|
-
// Combobox.Label
|
|
487
|
-
// =============================================================================
|
|
488
|
-
function ComboboxLabelComponent({ className, children }) {
|
|
489
|
-
const groupContext = React.useContext(ComboboxGroupContext);
|
|
490
|
-
const warnedRef = useRef(false);
|
|
491
|
-
useEffect(() => {
|
|
492
|
-
if (isDev() && !groupContext && !warnedRef.current) {
|
|
493
|
-
warnedRef.current = true;
|
|
494
|
-
console.warn('Combobox.Label should be used inside Combobox.Group for accessibility.');
|
|
495
|
-
}
|
|
496
|
-
}, [groupContext]);
|
|
497
|
-
return (_jsx("div", { id: groupContext ? `${groupContext.groupId}-label` : undefined, className: cx('tui-combobox__label', className), children: children }));
|
|
498
|
-
}
|
|
499
|
-
ComboboxLabelComponent.displayName = 'Combobox.Label';
|
|
340
|
+
// Shared Group/Label pair from the listbox engine.
|
|
341
|
+
const { Group: ComboboxGroupComponent, Label: ComboboxLabelComponent } = createListboxGroupComponents({
|
|
342
|
+
componentName: 'Combobox',
|
|
343
|
+
groupClass: 'tui-combobox__group',
|
|
344
|
+
labelClass: 'tui-combobox__label',
|
|
345
|
+
});
|
|
500
346
|
export const Combobox = ComboboxRoot;
|
|
501
347
|
Combobox.Content = ComboboxContentComponent;
|
|
502
348
|
Combobox.Option = ComboboxOptionComponent;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FloatingContext, ReferenceType } from '@floating-ui/react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CSSProperties, MutableRefObject, RefObject } from 'react';
|
|
3
3
|
import type { SizeStandard } from '../../types/sizes';
|
|
4
4
|
import type { OptionValue } from '../../utils/value-key';
|
|
5
5
|
export type ComboboxLabels = {
|
|
@@ -172,12 +172,8 @@ export type ComboboxLabelProps = {
|
|
|
172
172
|
/**
|
|
173
173
|
* Registration record for an option.
|
|
174
174
|
*/
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
ref: RefObject<HTMLElement | null>;
|
|
178
|
-
disabled: boolean;
|
|
179
|
-
textValue: string;
|
|
180
|
-
};
|
|
175
|
+
import type { RegisteredOption } from '../../utils/listbox';
|
|
176
|
+
export type { RegisteredOption };
|
|
181
177
|
/**
|
|
182
178
|
* Stable context: config, IDs, refs, and stable callbacks.
|
|
183
179
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MultiComboboxProps, MultiComboboxContentProps, MultiComboboxOptionProps
|
|
1
|
+
import type { MultiComboboxProps, MultiComboboxContentProps, MultiComboboxOptionProps } from './types';
|
|
2
2
|
declare function MultiComboboxRoot({ value: controlledValue, defaultValue, onValueChange, inputValue: controlledInputValue, onInputChange, open: controlledOpen, defaultOpen, onOpenChange, disabled, placeholder, size, overflow, openOnFocus, filterMode, onQueryChange, max, onMaxReached, clearable, 'aria-label': ariaLabel, id: inputIdProp, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, 'aria-required': ariaRequired, inputClassName, labels: labelsProp, children, }: MultiComboboxProps): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
declare namespace MultiComboboxRoot {
|
|
4
4
|
var displayName: string;
|
|
@@ -11,14 +11,13 @@ declare function MultiComboboxOptionComponent({ value: optionValue, disabled, te
|
|
|
11
11
|
declare namespace MultiComboboxOptionComponent {
|
|
12
12
|
var displayName: string;
|
|
13
13
|
}
|
|
14
|
-
declare
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
14
|
+
declare const MultiComboboxGroupComponent: {
|
|
15
|
+
({ className, children }: import("..").SearchSelectGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
displayName: string;
|
|
17
|
+
}, MultiComboboxLabelComponent: {
|
|
18
|
+
({ className, children }: import("..").SearchSelectLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
displayName: string;
|
|
20
|
+
};
|
|
22
21
|
type MultiComboboxCompound = typeof MultiComboboxRoot & {
|
|
23
22
|
Content: typeof MultiComboboxContentComponent;
|
|
24
23
|
Option: typeof MultiComboboxOptionComponent;
|
|
@@ -28,6 +27,12 @@ type MultiComboboxCompound = typeof MultiComboboxRoot & {
|
|
|
28
27
|
export declare const MultiCombobox: MultiComboboxCompound;
|
|
29
28
|
export declare const MultiComboboxContent: typeof MultiComboboxContentComponent;
|
|
30
29
|
export declare const MultiComboboxOption: typeof MultiComboboxOptionComponent;
|
|
31
|
-
export declare const MultiComboboxGroup:
|
|
32
|
-
|
|
30
|
+
export declare const MultiComboboxGroup: {
|
|
31
|
+
({ className, children }: import("..").SearchSelectGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
displayName: string;
|
|
33
|
+
};
|
|
34
|
+
export declare const MultiComboboxLabel: {
|
|
35
|
+
({ className, children }: import("..").SearchSelectLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
displayName: string;
|
|
37
|
+
};
|
|
33
38
|
export { useMultiComboboxContext as useMultiCombobox } from './MultiComboboxContext';
|