@dxos/react-ui-searchlist 0.8.4-main.84f28bd → 0.8.4-main.ae835ea
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/lib/browser/index.mjs +285 -139
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +285 -139
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Combobox/Combobox.d.ts +44 -0
- package/dist/types/src/components/Combobox/Combobox.d.ts.map +1 -0
- package/dist/types/src/components/Combobox/Combobox.stories.d.ts +21 -0
- package/dist/types/src/components/Combobox/Combobox.stories.d.ts.map +1 -0
- package/dist/types/src/components/Combobox/index.d.ts +2 -0
- package/dist/types/src/components/Combobox/index.d.ts.map +1 -0
- package/dist/types/src/components/Listbox/Listbox.d.ts +31 -0
- package/dist/types/src/components/Listbox/Listbox.d.ts.map +1 -0
- package/dist/types/src/components/Listbox/Listbox.stories.d.ts +21 -0
- package/dist/types/src/components/Listbox/Listbox.stories.d.ts.map +1 -0
- package/dist/types/src/components/Listbox/index.d.ts +2 -0
- package/dist/types/src/components/Listbox/index.d.ts.map +1 -0
- package/dist/types/src/components/{SearchList.d.ts → SearchList/SearchList.d.ts} +7 -27
- package/dist/types/src/components/SearchList/SearchList.d.ts.map +1 -0
- package/dist/types/src/components/SearchList/SearchList.stories.d.ts +25 -0
- package/dist/types/src/components/SearchList/SearchList.stories.d.ts.map +1 -0
- package/dist/types/src/components/SearchList/index.d.ts +2 -0
- package/dist/types/src/components/SearchList/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -16
- package/src/components/Combobox/Combobox.stories.tsx +57 -0
- package/src/components/Combobox/Combobox.tsx +335 -0
- package/src/components/Combobox/index.ts +5 -0
- package/src/components/Listbox/Listbox.stories.tsx +53 -0
- package/src/components/Listbox/Listbox.tsx +209 -0
- package/src/components/Listbox/index.ts +5 -0
- package/src/components/SearchList/SearchList.stories.tsx +64 -0
- package/src/components/SearchList/SearchList.tsx +163 -0
- package/src/components/SearchList/index.ts +5 -0
- package/src/components/index.ts +2 -0
- package/src/index.ts +0 -1
- package/src/translations.ts +3 -1
- package/dist/types/src/components/SearchList.d.ts.map +0 -1
- package/dist/types/src/components/SearchList.stories.d.ts +0 -15
- package/dist/types/src/components/SearchList.stories.d.ts.map +0 -1
- package/dist/types/src/composites/PopoverCombobox.d.ts +0 -32
- package/dist/types/src/composites/PopoverCombobox.d.ts.map +0 -1
- package/dist/types/src/composites/PopoverCombobox.stories.d.ts +0 -28
- package/dist/types/src/composites/PopoverCombobox.stories.d.ts.map +0 -1
- package/dist/types/src/composites/index.d.ts +0 -2
- package/dist/types/src/composites/index.d.ts.map +0 -1
- package/src/components/SearchList.stories.tsx +0 -47
- package/src/components/SearchList.tsx +0 -250
- package/src/composites/PopoverCombobox.stories.tsx +0 -44
- package/src/composites/PopoverCombobox.tsx +0 -186
- package/src/composites/index.ts +0 -5
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { CaretDown } from '@phosphor-icons/react';
|
|
6
|
-
import { createContext } from '@radix-ui/react-context';
|
|
7
|
-
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
8
|
-
import { CommandEmpty, CommandInput, CommandItem, CommandList, CommandRoot } from 'cmdk';
|
|
9
|
-
import React, { type ComponentPropsWithRef, forwardRef, type PropsWithChildren, useCallback } from 'react';
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
Button,
|
|
13
|
-
type ButtonProps,
|
|
14
|
-
type TextInputProps,
|
|
15
|
-
type ThemedClassName,
|
|
16
|
-
useDensityContext,
|
|
17
|
-
useElevationContext,
|
|
18
|
-
useId,
|
|
19
|
-
useThemeContext,
|
|
20
|
-
} from '@dxos/react-ui';
|
|
21
|
-
import { getSize, mx, staticPlaceholderText } from '@dxos/react-ui-theme';
|
|
22
|
-
|
|
23
|
-
type SearchListVariant = 'list' | 'menu' | 'listbox';
|
|
24
|
-
|
|
25
|
-
type SearchListRootProps = ThemedClassName<ComponentPropsWithRef<typeof CommandRoot>> & {
|
|
26
|
-
variant?: SearchListVariant;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
type ComboboxContextValue = {
|
|
30
|
-
isCombobox: true;
|
|
31
|
-
modalId: string;
|
|
32
|
-
open: boolean;
|
|
33
|
-
onOpenChange: (nextOpen: boolean) => void;
|
|
34
|
-
value: string;
|
|
35
|
-
onValueChange: (nextValue: string) => void;
|
|
36
|
-
placeholder?: string;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const COMBOBOX_NAME = 'Combobox';
|
|
40
|
-
const COMBOBOX_TRIGGER_NAME = 'ComboboxTrigger';
|
|
41
|
-
const SEARCHLIST_NAME = 'SearchList';
|
|
42
|
-
const SEARCHLIST_ITEM_NAME = 'SearchListItem';
|
|
43
|
-
|
|
44
|
-
const [ComboboxProvider, useComboboxContext] = createContext<Partial<ComboboxContextValue>>(COMBOBOX_NAME, {});
|
|
45
|
-
|
|
46
|
-
type ComboboxRootProps = PropsWithChildren<
|
|
47
|
-
Partial<ComboboxContextValue & { defaultOpen: boolean; defaultValue: string; placeholder: string }>
|
|
48
|
-
>;
|
|
49
|
-
|
|
50
|
-
const SearchListRoot = forwardRef<HTMLDivElement, SearchListRootProps>(
|
|
51
|
-
({ children, classNames, ...props }, forwardedRef) => {
|
|
52
|
-
return (
|
|
53
|
-
<CommandRoot {...props} className={mx('', classNames)} ref={forwardedRef}>
|
|
54
|
-
{children}
|
|
55
|
-
</CommandRoot>
|
|
56
|
-
);
|
|
57
|
-
},
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
SearchListRoot.displayName = SEARCHLIST_NAME;
|
|
61
|
-
|
|
62
|
-
type CommandInputPrimitiveProps = ComponentPropsWithRef<typeof CommandInput>;
|
|
63
|
-
|
|
64
|
-
// TODO: Harmonize with other inputs’ `onChange` prop.
|
|
65
|
-
type SearchListInputProps = Omit<TextInputProps, 'value' | 'defaultValue' | 'onChange'> &
|
|
66
|
-
Pick<CommandInputPrimitiveProps, 'value' | 'onValueChange' | 'defaultValue'>;
|
|
67
|
-
|
|
68
|
-
const SearchListInput = forwardRef<HTMLInputElement, SearchListInputProps>(
|
|
69
|
-
({ children, classNames, density: propsDensity, elevation: propsElevation, variant, ...props }, forwardedRef) => {
|
|
70
|
-
// CHORE(thure): Keep this in-sync with `TextInput`, or submit a PR for `cmdk` to support `asChild` so we don’t have to.
|
|
71
|
-
const { hasIosKeyboard } = useThemeContext();
|
|
72
|
-
const { tx } = useThemeContext();
|
|
73
|
-
const density = useDensityContext(propsDensity);
|
|
74
|
-
const elevation = useElevationContext(propsElevation);
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<CommandInput
|
|
78
|
-
{...props}
|
|
79
|
-
className={tx(
|
|
80
|
-
'input.input',
|
|
81
|
-
'input',
|
|
82
|
-
{
|
|
83
|
-
variant,
|
|
84
|
-
disabled: props.disabled,
|
|
85
|
-
density,
|
|
86
|
-
elevation,
|
|
87
|
-
},
|
|
88
|
-
'mbe-cardSpacingBlock',
|
|
89
|
-
classNames,
|
|
90
|
-
)}
|
|
91
|
-
{...(props.autoFocus && !hasIosKeyboard && { autoFocus: true })}
|
|
92
|
-
ref={forwardedRef}
|
|
93
|
-
/>
|
|
94
|
-
);
|
|
95
|
-
},
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
type SearchListContentProps = ThemedClassName<ComponentPropsWithRef<typeof CommandList>>;
|
|
99
|
-
|
|
100
|
-
const SearchListContent = forwardRef<HTMLDivElement, SearchListContentProps>(
|
|
101
|
-
({ children, classNames, ...props }, forwardedRef) => {
|
|
102
|
-
return (
|
|
103
|
-
<CommandList {...props} className={mx(classNames)} ref={forwardedRef}>
|
|
104
|
-
{children}
|
|
105
|
-
</CommandList>
|
|
106
|
-
);
|
|
107
|
-
},
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
type SearchListEmptyProps = ThemedClassName<ComponentPropsWithRef<typeof CommandEmpty>>;
|
|
111
|
-
|
|
112
|
-
const SearchListEmpty = forwardRef<HTMLDivElement, SearchListEmptyProps>(
|
|
113
|
-
({ children, classNames, ...props }, forwardedRef) => {
|
|
114
|
-
return (
|
|
115
|
-
<CommandEmpty {...props} className={mx(classNames)} ref={forwardedRef}>
|
|
116
|
-
{children}
|
|
117
|
-
</CommandEmpty>
|
|
118
|
-
);
|
|
119
|
-
},
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
type SearchListItemProps = ThemedClassName<ComponentPropsWithRef<typeof CommandItem>>;
|
|
123
|
-
|
|
124
|
-
const SearchListItem = forwardRef<HTMLDivElement, SearchListItemProps>(
|
|
125
|
-
({ children, classNames, onSelect, ...props }, forwardedRef) => {
|
|
126
|
-
const { onValueChange, onOpenChange } = useComboboxContext(SEARCHLIST_ITEM_NAME);
|
|
127
|
-
const handleSelect = useCallback(
|
|
128
|
-
(nextValue: string) => {
|
|
129
|
-
onValueChange?.(nextValue);
|
|
130
|
-
onOpenChange?.(false);
|
|
131
|
-
onSelect?.(nextValue);
|
|
132
|
-
},
|
|
133
|
-
[onValueChange, onOpenChange, onSelect],
|
|
134
|
-
);
|
|
135
|
-
return (
|
|
136
|
-
<CommandItem
|
|
137
|
-
{...props}
|
|
138
|
-
onSelect={handleSelect}
|
|
139
|
-
className={mx('p-1 rounded select-none cursor-pointer data-[selected]:bg-hoverOverlay', classNames)}
|
|
140
|
-
ref={forwardedRef}
|
|
141
|
-
>
|
|
142
|
-
{children}
|
|
143
|
-
</CommandItem>
|
|
144
|
-
);
|
|
145
|
-
},
|
|
146
|
-
);
|
|
147
|
-
|
|
148
|
-
SearchListItem.displayName = SEARCHLIST_ITEM_NAME;
|
|
149
|
-
|
|
150
|
-
const ComboboxRoot = ({
|
|
151
|
-
modalId: propsModalId,
|
|
152
|
-
open: propsOpen,
|
|
153
|
-
defaultOpen,
|
|
154
|
-
onOpenChange: propsOnOpenChange,
|
|
155
|
-
value: propsValue,
|
|
156
|
-
defaultValue,
|
|
157
|
-
onValueChange: propsOnValueChange,
|
|
158
|
-
placeholder,
|
|
159
|
-
children,
|
|
160
|
-
}: ComboboxRootProps) => {
|
|
161
|
-
const modalId = useId(COMBOBOX_NAME, propsModalId);
|
|
162
|
-
const [open = false, onOpenChange] = useControllableState({
|
|
163
|
-
prop: propsOpen,
|
|
164
|
-
onChange: propsOnOpenChange,
|
|
165
|
-
defaultProp: defaultOpen,
|
|
166
|
-
});
|
|
167
|
-
const [value = '', onValueChange] = useControllableState({
|
|
168
|
-
prop: propsValue,
|
|
169
|
-
onChange: propsOnValueChange,
|
|
170
|
-
defaultProp: defaultValue,
|
|
171
|
-
});
|
|
172
|
-
return (
|
|
173
|
-
<ComboboxProvider
|
|
174
|
-
isCombobox
|
|
175
|
-
modalId={modalId}
|
|
176
|
-
open={open}
|
|
177
|
-
onOpenChange={onOpenChange}
|
|
178
|
-
value={value}
|
|
179
|
-
onValueChange={onValueChange}
|
|
180
|
-
placeholder={placeholder}
|
|
181
|
-
>
|
|
182
|
-
{children}
|
|
183
|
-
</ComboboxProvider>
|
|
184
|
-
);
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
ComboboxRoot.displayName = COMBOBOX_NAME;
|
|
188
|
-
|
|
189
|
-
type ComboboxTriggerProps = ButtonProps;
|
|
190
|
-
|
|
191
|
-
const ComboboxTrigger = forwardRef<HTMLButtonElement, ComboboxTriggerProps>(
|
|
192
|
-
({ children, onClick, ...props }, forwardedRef) => {
|
|
193
|
-
const { modalId, open, onOpenChange, placeholder, value } = useComboboxContext(COMBOBOX_TRIGGER_NAME);
|
|
194
|
-
const handleClick = useCallback(
|
|
195
|
-
(event: Parameters<Exclude<ButtonProps['onClick'], undefined>>[0]) => {
|
|
196
|
-
onClick?.(event);
|
|
197
|
-
onOpenChange?.(true);
|
|
198
|
-
},
|
|
199
|
-
[onClick, onOpenChange],
|
|
200
|
-
);
|
|
201
|
-
return (
|
|
202
|
-
<Button
|
|
203
|
-
{...props}
|
|
204
|
-
role='combobox'
|
|
205
|
-
aria-expanded={open}
|
|
206
|
-
aria-controls={modalId}
|
|
207
|
-
aria-haspopup='dialog'
|
|
208
|
-
onClick={handleClick}
|
|
209
|
-
ref={forwardedRef}
|
|
210
|
-
>
|
|
211
|
-
{children ?? (
|
|
212
|
-
<>
|
|
213
|
-
<span
|
|
214
|
-
className={mx('font-normal text-start flex-1 min-is-0 truncate mie-2', !value && staticPlaceholderText)}
|
|
215
|
-
>
|
|
216
|
-
{value || placeholder}
|
|
217
|
-
</span>
|
|
218
|
-
<CaretDown weight='bold' className={getSize(3)} />
|
|
219
|
-
</>
|
|
220
|
-
)}
|
|
221
|
-
</Button>
|
|
222
|
-
);
|
|
223
|
-
},
|
|
224
|
-
);
|
|
225
|
-
|
|
226
|
-
ComboboxTrigger.displayName = COMBOBOX_TRIGGER_NAME;
|
|
227
|
-
|
|
228
|
-
export const SearchList = {
|
|
229
|
-
Root: SearchListRoot,
|
|
230
|
-
Input: SearchListInput,
|
|
231
|
-
Content: SearchListContent,
|
|
232
|
-
Empty: SearchListEmpty,
|
|
233
|
-
Item: SearchListItem,
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
export const Combobox = {
|
|
237
|
-
Root: ComboboxRoot,
|
|
238
|
-
Trigger: ComboboxTrigger,
|
|
239
|
-
useComboboxContext,
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
export type {
|
|
243
|
-
SearchListRootProps,
|
|
244
|
-
SearchListInputProps,
|
|
245
|
-
SearchListContentProps,
|
|
246
|
-
SearchListEmptyProps,
|
|
247
|
-
SearchListItemProps,
|
|
248
|
-
ComboboxRootProps,
|
|
249
|
-
ComboboxTriggerProps,
|
|
250
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
|
|
9
|
-
import { faker } from '@dxos/random';
|
|
10
|
-
import { withTheme } from '@dxos/storybook-utils';
|
|
11
|
-
|
|
12
|
-
import { PopoverCombobox } from './PopoverCombobox';
|
|
13
|
-
|
|
14
|
-
faker.seed(1234);
|
|
15
|
-
|
|
16
|
-
const storybookItems = faker.helpers.uniqueArray(faker.commerce.productName, 16);
|
|
17
|
-
|
|
18
|
-
const DefaultStory = () => {
|
|
19
|
-
return (
|
|
20
|
-
<PopoverCombobox.Root placeholder='Nothing selected'>
|
|
21
|
-
<PopoverCombobox.Trigger />
|
|
22
|
-
<PopoverCombobox.Content filter={(value, search) => (value.includes(search) ? 1 : 0)}>
|
|
23
|
-
<PopoverCombobox.Input placeholder='Search...' />
|
|
24
|
-
<PopoverCombobox.List>
|
|
25
|
-
{storybookItems.map((value) => (
|
|
26
|
-
<PopoverCombobox.Item key={value}>{value}</PopoverCombobox.Item>
|
|
27
|
-
))}
|
|
28
|
-
</PopoverCombobox.List>
|
|
29
|
-
<PopoverCombobox.Arrow />
|
|
30
|
-
</PopoverCombobox.Content>
|
|
31
|
-
</PopoverCombobox.Root>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default {
|
|
36
|
-
title: 'ui/react-ui-searchlist/PopoverCombobox',
|
|
37
|
-
component: PopoverCombobox,
|
|
38
|
-
render: DefaultStory,
|
|
39
|
-
decorators: [withTheme],
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export const Default = {
|
|
43
|
-
args: {},
|
|
44
|
-
};
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
6
|
-
import React, { forwardRef } from 'react';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
Popover,
|
|
10
|
-
type PopoverArrowProps,
|
|
11
|
-
type PopoverContentProps,
|
|
12
|
-
type PopoverViewportProps,
|
|
13
|
-
type PopoverVirtualTriggerProps,
|
|
14
|
-
} from '@dxos/react-ui';
|
|
15
|
-
|
|
16
|
-
import {
|
|
17
|
-
Combobox,
|
|
18
|
-
type ComboboxRootProps,
|
|
19
|
-
type ComboboxTriggerProps,
|
|
20
|
-
SearchList,
|
|
21
|
-
type SearchListContentProps,
|
|
22
|
-
type SearchListEmptyProps,
|
|
23
|
-
type SearchListInputProps,
|
|
24
|
-
type SearchListItemProps,
|
|
25
|
-
type SearchListRootProps,
|
|
26
|
-
} from '../components';
|
|
27
|
-
|
|
28
|
-
type PopoverComboboxRootProps = ComboboxRootProps & { modal?: boolean };
|
|
29
|
-
|
|
30
|
-
const PopoverComboboxRoot = ({
|
|
31
|
-
modal,
|
|
32
|
-
children,
|
|
33
|
-
open: propsOpen,
|
|
34
|
-
onOpenChange: propsOnOpenChange,
|
|
35
|
-
defaultOpen,
|
|
36
|
-
...props
|
|
37
|
-
}: PopoverComboboxRootProps) => {
|
|
38
|
-
const [open, onOpenChange] = useControllableState({
|
|
39
|
-
prop: propsOpen,
|
|
40
|
-
onChange: propsOnOpenChange,
|
|
41
|
-
defaultProp: defaultOpen,
|
|
42
|
-
});
|
|
43
|
-
return (
|
|
44
|
-
<Combobox.Root open={open} onOpenChange={onOpenChange} {...props}>
|
|
45
|
-
<Popover.Root open={open} onOpenChange={onOpenChange} modal={modal}>
|
|
46
|
-
{children}
|
|
47
|
-
</Popover.Root>
|
|
48
|
-
</Combobox.Root>
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
type PopoverComboboxContentProps = SearchListRootProps & PopoverContentProps;
|
|
53
|
-
|
|
54
|
-
const POPOVER_COMBOBOX_CONTENT_NAME = 'PopoverComboboxContent';
|
|
55
|
-
|
|
56
|
-
const PopoverComboboxContent = forwardRef<HTMLDivElement, PopoverComboboxContentProps>(
|
|
57
|
-
(
|
|
58
|
-
{
|
|
59
|
-
side = 'bottom',
|
|
60
|
-
collisionPadding = 48,
|
|
61
|
-
sideOffset,
|
|
62
|
-
align,
|
|
63
|
-
alignOffset,
|
|
64
|
-
avoidCollisions,
|
|
65
|
-
collisionBoundary,
|
|
66
|
-
arrowPadding,
|
|
67
|
-
sticky,
|
|
68
|
-
hideWhenDetached,
|
|
69
|
-
onOpenAutoFocus,
|
|
70
|
-
onCloseAutoFocus,
|
|
71
|
-
onEscapeKeyDown,
|
|
72
|
-
onPointerDownOutside,
|
|
73
|
-
onFocusOutside,
|
|
74
|
-
onInteractOutside,
|
|
75
|
-
forceMount,
|
|
76
|
-
children,
|
|
77
|
-
classNames,
|
|
78
|
-
...props
|
|
79
|
-
},
|
|
80
|
-
forwardedRef,
|
|
81
|
-
) => {
|
|
82
|
-
const { modalId } = Combobox.useComboboxContext(POPOVER_COMBOBOX_CONTENT_NAME);
|
|
83
|
-
return (
|
|
84
|
-
<Popover.Content
|
|
85
|
-
{...{
|
|
86
|
-
side,
|
|
87
|
-
sideOffset,
|
|
88
|
-
align,
|
|
89
|
-
alignOffset,
|
|
90
|
-
avoidCollisions,
|
|
91
|
-
collisionBoundary,
|
|
92
|
-
collisionPadding,
|
|
93
|
-
arrowPadding,
|
|
94
|
-
sticky,
|
|
95
|
-
hideWhenDetached,
|
|
96
|
-
onOpenAutoFocus,
|
|
97
|
-
onCloseAutoFocus,
|
|
98
|
-
onEscapeKeyDown,
|
|
99
|
-
onPointerDownOutside,
|
|
100
|
-
onFocusOutside,
|
|
101
|
-
onInteractOutside,
|
|
102
|
-
forceMount,
|
|
103
|
-
classNames,
|
|
104
|
-
}}
|
|
105
|
-
id={modalId}
|
|
106
|
-
ref={forwardedRef}
|
|
107
|
-
>
|
|
108
|
-
<Popover.Viewport>
|
|
109
|
-
{/* TODO(thure): This skips over `Command`’s root component, which renders a DOM node probably unnecessarily without supporting `asChild`. */}
|
|
110
|
-
<SearchList.Root {...props} classNames='contents' role='none'>
|
|
111
|
-
{children}
|
|
112
|
-
</SearchList.Root>
|
|
113
|
-
</Popover.Viewport>
|
|
114
|
-
</Popover.Content>
|
|
115
|
-
);
|
|
116
|
-
},
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
PopoverComboboxContent.displayName = POPOVER_COMBOBOX_CONTENT_NAME;
|
|
120
|
-
|
|
121
|
-
type PopoverComboboxTriggerProps = ComboboxTriggerProps;
|
|
122
|
-
|
|
123
|
-
const PopoverComboboxTrigger = forwardRef<HTMLButtonElement, PopoverComboboxTriggerProps>((props, forwardedRef) => {
|
|
124
|
-
return (
|
|
125
|
-
<Popover.Trigger asChild>
|
|
126
|
-
<Combobox.Trigger {...props} ref={forwardedRef} />
|
|
127
|
-
</Popover.Trigger>
|
|
128
|
-
);
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
type PopoverComboboxVirtualTriggerProps = PopoverVirtualTriggerProps;
|
|
132
|
-
|
|
133
|
-
const PopoverComboboxVirtualTrigger = Popover.VirtualTrigger;
|
|
134
|
-
|
|
135
|
-
type PopoverComboboxInputProps = SearchListInputProps;
|
|
136
|
-
|
|
137
|
-
const PopoverComboboxInput = SearchList.Input;
|
|
138
|
-
|
|
139
|
-
type PopoverComboboxListProps = SearchListContentProps &
|
|
140
|
-
Pick<PopoverViewportProps, 'constrainBlock' | 'constrainInline'>;
|
|
141
|
-
|
|
142
|
-
const PopoverComboboxList = forwardRef<HTMLDivElement, PopoverComboboxListProps>(
|
|
143
|
-
({ constrainInline, constrainBlock, ...props }, forwardedRef) => {
|
|
144
|
-
return (
|
|
145
|
-
<Popover.Viewport {...{ constrainInline, constrainBlock }}>
|
|
146
|
-
<SearchList.Content {...props} ref={forwardedRef} />
|
|
147
|
-
</Popover.Viewport>
|
|
148
|
-
);
|
|
149
|
-
},
|
|
150
|
-
);
|
|
151
|
-
|
|
152
|
-
type PopoverComboboxItemProps = SearchListItemProps;
|
|
153
|
-
|
|
154
|
-
const PopoverComboboxItem = SearchList.Item;
|
|
155
|
-
|
|
156
|
-
type PopoverComboboxArrowProps = PopoverArrowProps;
|
|
157
|
-
|
|
158
|
-
const PopoverComboboxArrow = Popover.Arrow;
|
|
159
|
-
|
|
160
|
-
type PopoverComboboxEmptyProps = SearchListEmptyProps;
|
|
161
|
-
|
|
162
|
-
const PopoverComboboxEmpty = SearchList.Empty;
|
|
163
|
-
|
|
164
|
-
export const PopoverCombobox = {
|
|
165
|
-
Root: PopoverComboboxRoot,
|
|
166
|
-
Content: PopoverComboboxContent,
|
|
167
|
-
Trigger: PopoverComboboxTrigger,
|
|
168
|
-
VirtualTrigger: PopoverComboboxVirtualTrigger,
|
|
169
|
-
Input: PopoverComboboxInput,
|
|
170
|
-
List: PopoverComboboxList,
|
|
171
|
-
Item: PopoverComboboxItem,
|
|
172
|
-
Arrow: PopoverComboboxArrow,
|
|
173
|
-
Empty: PopoverComboboxEmpty,
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
export type {
|
|
177
|
-
PopoverComboboxRootProps,
|
|
178
|
-
PopoverComboboxContentProps,
|
|
179
|
-
PopoverComboboxTriggerProps,
|
|
180
|
-
PopoverComboboxVirtualTriggerProps,
|
|
181
|
-
PopoverComboboxInputProps,
|
|
182
|
-
PopoverComboboxListProps,
|
|
183
|
-
PopoverComboboxItemProps,
|
|
184
|
-
PopoverComboboxArrowProps,
|
|
185
|
-
PopoverComboboxEmptyProps,
|
|
186
|
-
};
|