@dxos/react-ui-searchlist 0.8.4-main.bc674ce → 0.8.4-main.c351d160a8
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/README.md +1 -1
- package/dist/lib/browser/index.mjs +36 -37
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +36 -37
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Combobox/Combobox.d.ts +6 -3
- package/dist/types/src/components/Combobox/Combobox.d.ts.map +1 -1
- package/dist/types/src/components/SearchList/SearchList.d.ts +12 -9
- package/dist/types/src/components/SearchList/SearchList.d.ts.map +1 -1
- package/dist/types/src/components/SearchList/SearchList.stories.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/src/components/Combobox/Combobox.stories.tsx +1 -1
- package/src/components/Combobox/Combobox.tsx +9 -22
- package/src/components/Listbox/Listbox.stories.tsx +1 -1
- package/src/components/Listbox/Listbox.tsx +2 -2
- package/src/components/SearchList/SearchList.stories.tsx +33 -35
- package/src/components/SearchList/SearchList.tsx +39 -44
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
# @dxos/react-ui-searchlist
|
|
2
2
|
|
|
3
|
-
A themed ⌘K-style searchable list. When used with the included trigger and variant is set to `'listbox'`, this conforms to one definition of ARIA’s `combobox`.
|
|
3
|
+
A themed ⌘K-style searchable list. When used with the included trigger and variant is set to `'listbox'`, this conforms to one definition of ARIA’s `combobox`.
|
|
@@ -4,13 +4,13 @@ import { useControllableState as useControllableState2 } from "@radix-ui/react-u
|
|
|
4
4
|
import React3, { forwardRef as forwardRef2, useCallback as useCallback3 } from "react";
|
|
5
5
|
import { Button, Icon as Icon2, Popover } from "@dxos/react-ui";
|
|
6
6
|
import { useId } from "@dxos/react-ui";
|
|
7
|
-
import { mx as mx2
|
|
7
|
+
import { mx as mx2 } from "@dxos/ui-theme";
|
|
8
8
|
|
|
9
9
|
// src/components/SearchList/SearchList.tsx
|
|
10
10
|
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
11
11
|
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
12
|
-
import { Icon, useDensityContext, useElevationContext, useThemeContext, useTranslation } from "@dxos/react-ui";
|
|
13
|
-
import {
|
|
12
|
+
import { Icon, ScrollArea, useDensityContext, useElevationContext, useThemeContext, useTranslation } from "@dxos/react-ui";
|
|
13
|
+
import { mx } from "@dxos/ui-theme";
|
|
14
14
|
|
|
15
15
|
// src/translations.ts
|
|
16
16
|
var translationKey = "@dxos/react-ui-searchlist";
|
|
@@ -155,18 +155,12 @@ var SearchListRoot = ({ children, value: valueProp, defaultValue = "", debounceM
|
|
|
155
155
|
}, children));
|
|
156
156
|
};
|
|
157
157
|
SearchListRoot.displayName = "SearchList.Root";
|
|
158
|
-
var
|
|
158
|
+
var SearchListContent = /* @__PURE__ */ forwardRef(({ classNames, children, ...props }, forwardedRef) => {
|
|
159
159
|
return /* @__PURE__ */ React.createElement("div", {
|
|
160
160
|
role: "none",
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
SearchListViewport.displayName = "SearchList.Viewport";
|
|
165
|
-
var SearchListContent = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => {
|
|
166
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
167
|
-
ref: forwardedRef,
|
|
168
|
-
role: "listbox",
|
|
169
|
-
className: mx("flex flex-col is-full min-bs-0 grow overflow-hidden", classNames)
|
|
161
|
+
...props,
|
|
162
|
+
className: mx("dx-container flex flex-col gap-3", classNames),
|
|
163
|
+
ref: forwardedRef
|
|
170
164
|
}, children);
|
|
171
165
|
});
|
|
172
166
|
SearchListContent.displayName = "SearchList.Content";
|
|
@@ -258,21 +252,30 @@ var SearchListInput = /* @__PURE__ */ forwardRef(({ classNames, density: propsDe
|
|
|
258
252
|
autoFocus: true
|
|
259
253
|
},
|
|
260
254
|
type: "text",
|
|
261
|
-
value: query,
|
|
262
255
|
placeholder: placeholder ?? defaultPlaceholder,
|
|
263
|
-
className: tx("input.input",
|
|
256
|
+
className: tx("input.input", {
|
|
264
257
|
variant,
|
|
265
258
|
disabled: props.disabled,
|
|
266
259
|
density,
|
|
267
260
|
elevation
|
|
268
261
|
}, classNames),
|
|
262
|
+
value: query,
|
|
269
263
|
onChange: handleChange,
|
|
270
264
|
onKeyDown: handleKeyDown,
|
|
271
265
|
ref: forwardedRef
|
|
272
266
|
});
|
|
273
267
|
});
|
|
274
268
|
SearchListInput.displayName = "SearchList.Input";
|
|
275
|
-
var
|
|
269
|
+
var SearchListViewport = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => {
|
|
270
|
+
return /* @__PURE__ */ React.createElement(ScrollArea.Root, {
|
|
271
|
+
role: "listbox",
|
|
272
|
+
classNames: mx(classNames),
|
|
273
|
+
ref: forwardedRef,
|
|
274
|
+
thin: true
|
|
275
|
+
}, /* @__PURE__ */ React.createElement(ScrollArea.Viewport, null, children));
|
|
276
|
+
});
|
|
277
|
+
SearchListViewport.displayName = "SearchList.Viewport";
|
|
278
|
+
var SearchListItem = /* @__PURE__ */ forwardRef(({ classNames, value, label, icon, iconClassNames, checked, suffix, onSelect, disabled }, forwardedRef) => {
|
|
276
279
|
const { selectedValue, registerItem, unregisterItem } = useSearchListItemContext("SearchList.Item");
|
|
277
280
|
const internalRef = useRef(null);
|
|
278
281
|
const isSelected = selectedValue === value && !disabled;
|
|
@@ -323,15 +326,16 @@ var SearchListItem = /* @__PURE__ */ forwardRef(({ classNames, value, label, ico
|
|
|
323
326
|
"data-disabled": disabled,
|
|
324
327
|
"data-value": value,
|
|
325
328
|
tabIndex: -1,
|
|
326
|
-
className: mx("flex gap-2 items-center", "
|
|
329
|
+
className: mx("flex gap-2 items-center", "py-1 px-2 rounded-xs select-none cursor-pointer data-[selected=true]:bg-hover-overlay hover:bg-hover-overlay", disabled && "opacity-50 cursor-not-allowed hover:bg-transparent data-[selected=true]:bg-transparent", classNames),
|
|
327
330
|
onClick: handleClick
|
|
328
331
|
}, icon && /* @__PURE__ */ React.createElement(Icon, {
|
|
329
332
|
icon,
|
|
330
|
-
size: 5
|
|
333
|
+
size: 5,
|
|
334
|
+
classNames: iconClassNames
|
|
331
335
|
}), /* @__PURE__ */ React.createElement("span", {
|
|
332
|
-
className: "
|
|
336
|
+
className: "w-0 grow truncate"
|
|
333
337
|
}, label), suffix && /* @__PURE__ */ React.createElement("span", {
|
|
334
|
-
className:
|
|
338
|
+
className: "shrink-0 text-description"
|
|
335
339
|
}, suffix), checked && /* @__PURE__ */ React.createElement(Icon, {
|
|
336
340
|
icon: "ph--check--regular",
|
|
337
341
|
size: 5
|
|
@@ -341,7 +345,7 @@ SearchListItem.displayName = "SearchList.Item";
|
|
|
341
345
|
var SearchListEmpty = ({ classNames, children }) => {
|
|
342
346
|
return /* @__PURE__ */ React.createElement("div", {
|
|
343
347
|
role: "status",
|
|
344
|
-
className: mx("flex flex-col
|
|
348
|
+
className: mx("flex flex-col w-full px-2 py-1", classNames)
|
|
345
349
|
}, children);
|
|
346
350
|
};
|
|
347
351
|
SearchListEmpty.displayName = "SearchList.Empty";
|
|
@@ -352,14 +356,14 @@ var SearchListGroup = /* @__PURE__ */ forwardRef(({ classNames, heading, childre
|
|
|
352
356
|
className: mx("flex flex-col", classNames)
|
|
353
357
|
}, heading && /* @__PURE__ */ React.createElement("div", {
|
|
354
358
|
role: "presentation",
|
|
355
|
-
className: "
|
|
359
|
+
className: "px-2 py-1 text-xs font-medium text-description"
|
|
356
360
|
}, heading), children);
|
|
357
361
|
});
|
|
358
362
|
SearchListGroup.displayName = "SearchList.Group";
|
|
359
363
|
var SearchList = {
|
|
360
364
|
Root: SearchListRoot,
|
|
361
|
-
Viewport: SearchListViewport,
|
|
362
365
|
Content: SearchListContent,
|
|
366
|
+
Viewport: SearchListViewport,
|
|
363
367
|
Input: SearchListInput,
|
|
364
368
|
Item: SearchListItem,
|
|
365
369
|
Empty: SearchListEmpty,
|
|
@@ -532,7 +536,7 @@ var ComboboxContent = /* @__PURE__ */ forwardRef2(({ side = "bottom", collisionP
|
|
|
532
536
|
onInteractOutside,
|
|
533
537
|
forceMount,
|
|
534
538
|
classNames: [
|
|
535
|
-
"
|
|
539
|
+
"w-(--radix-popover-trigger-width) max-h-(--radix-popover-content-available-height) grid grid-rows-[min-content_1fr]",
|
|
536
540
|
classNames
|
|
537
541
|
],
|
|
538
542
|
id: modalId,
|
|
@@ -542,12 +546,7 @@ var ComboboxContent = /* @__PURE__ */ forwardRef2(({ side = "bottom", collisionP
|
|
|
542
546
|
value,
|
|
543
547
|
defaultValue,
|
|
544
548
|
debounceMs
|
|
545
|
-
}, /* @__PURE__ */ React3.createElement(
|
|
546
|
-
className: "contents density-fine",
|
|
547
|
-
"aria-label": label,
|
|
548
|
-
role: "combobox",
|
|
549
|
-
"aria-expanded": "true"
|
|
550
|
-
}, children)));
|
|
549
|
+
}, /* @__PURE__ */ React3.createElement(SearchList.Content, null, children)));
|
|
551
550
|
});
|
|
552
551
|
ComboboxContent.displayName = COMBOBOX_CONTENT_NAME;
|
|
553
552
|
var ComboboxTrigger = /* @__PURE__ */ forwardRef2(({ children, onClick, ...props }, forwardedRef) => {
|
|
@@ -570,7 +569,7 @@ var ComboboxTrigger = /* @__PURE__ */ forwardRef2(({ children, onClick, ...props
|
|
|
570
569
|
onClick: handleClick,
|
|
571
570
|
ref: forwardedRef
|
|
572
571
|
}, children ?? /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement("span", {
|
|
573
|
-
className: mx2("font-normal text-start flex-1 min-
|
|
572
|
+
className: mx2("font-normal text-start flex-1 min-w-0 truncate me-2", !value && "text-subdued")
|
|
574
573
|
}, value || placeholder), /* @__PURE__ */ React3.createElement(Icon2, {
|
|
575
574
|
icon: "ph--caret-down--bold",
|
|
576
575
|
size: 3
|
|
@@ -582,17 +581,17 @@ var ComboboxInput = /* @__PURE__ */ forwardRef2(({ classNames, ...props }, forwa
|
|
|
582
581
|
return /* @__PURE__ */ React3.createElement(SearchList.Input, {
|
|
583
582
|
...props,
|
|
584
583
|
classNames: [
|
|
585
|
-
"
|
|
584
|
+
"m-form-chrome mb-0 w-[calc(100%-2*var(--spacing-form-chrome))]",
|
|
586
585
|
classNames
|
|
587
586
|
],
|
|
588
587
|
ref: forwardedRef
|
|
589
588
|
});
|
|
590
589
|
});
|
|
591
590
|
var ComboboxList = /* @__PURE__ */ forwardRef2(({ classNames, ...props }, forwardedRef) => {
|
|
592
|
-
return /* @__PURE__ */ React3.createElement(SearchList.
|
|
591
|
+
return /* @__PURE__ */ React3.createElement(SearchList.Viewport, {
|
|
593
592
|
...props,
|
|
594
593
|
classNames: [
|
|
595
|
-
"
|
|
594
|
+
"py-form-chrome",
|
|
596
595
|
classNames
|
|
597
596
|
],
|
|
598
597
|
ref: forwardedRef
|
|
@@ -619,7 +618,7 @@ var ComboboxItem = /* @__PURE__ */ forwardRef2(({ classNames, onSelect, value, c
|
|
|
619
618
|
...props,
|
|
620
619
|
value,
|
|
621
620
|
classNames: [
|
|
622
|
-
"
|
|
621
|
+
"mx-form-chrome px-form-chrome",
|
|
623
622
|
classNames
|
|
624
623
|
],
|
|
625
624
|
onSelect: handleSelect,
|
|
@@ -689,7 +688,7 @@ var ListboxRoot = /* @__PURE__ */ forwardRef3((props, forwardedRef) => {
|
|
|
689
688
|
}, /* @__PURE__ */ React4.createElement("ul", {
|
|
690
689
|
role: "listbox",
|
|
691
690
|
...rootProps,
|
|
692
|
-
className: mx3("
|
|
691
|
+
className: mx3("w-full p-form-chrome", classNames),
|
|
693
692
|
ref: rootRef,
|
|
694
693
|
...arrowGroup
|
|
695
694
|
}, children));
|
|
@@ -714,7 +713,7 @@ var ListboxOption = /* @__PURE__ */ forwardRef3((props, forwardedRef) => {
|
|
|
714
713
|
...rootProps,
|
|
715
714
|
"aria-selected": isSelected,
|
|
716
715
|
tabIndex: 0,
|
|
717
|
-
className: mx3("dx-focus-ring", "
|
|
716
|
+
className: mx3("dx-focus-ring", "py-1 px-2 rounded-xs select-none cursor-pointer data-[selected=true]:bg-hover-overlay hover:bg-hover-overlay", commandItem, classNames),
|
|
718
717
|
onClick: handleSelect,
|
|
719
718
|
onKeyDown: ({ key }) => {
|
|
720
719
|
if ([
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/Combobox/Combobox.tsx", "../../../src/components/SearchList/SearchList.tsx", "../../../src/translations.ts", "../../../src/components/SearchList/context.ts", "../../../src/components/SearchList/hooks/useGlobalFilter.tsx", "../../../src/components/SearchList/hooks/useSearchListInput.ts", "../../../src/components/SearchList/hooks/useSearchListItem.ts", "../../../src/components/SearchList/hooks/useSearchListResults.ts", "../../../src/components/Listbox/Listbox.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { createContext } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, { type PropsWithChildren, forwardRef, useCallback } from 'react';\n\nimport {\n Button,\n type ButtonProps,\n Icon,\n Popover,\n type PopoverArrowProps,\n type PopoverContentProps,\n type PopoverVirtualTriggerProps,\n} from '@dxos/react-ui';\nimport { useId } from '@dxos/react-ui';\nimport { mx, staticPlaceholderText } from '@dxos/ui-theme';\n\nimport {\n SearchList,\n type SearchListContentProps,\n type SearchListEmptyProps,\n type SearchListInputProps,\n type SearchListItemProps,\n type SearchListRootProps,\n} from '../SearchList';\n\nconst COMBOBOX_NAME = 'Combobox';\nconst COMBOBOX_CONTENT_NAME = 'ComboboxContent';\nconst COMBOBOX_ITEM_NAME = 'ComboboxItem';\nconst COMBOBOX_TRIGGER_NAME = 'ComboboxTrigger';\n\n//\n// Context\n//\n\ntype ComboboxContextValue = {\n modalId: string;\n isCombobox: true;\n placeholder?: string;\n open: boolean;\n onOpenChange: (nextOpen: boolean) => void;\n value: string;\n onValueChange: (nextValue: string) => void;\n};\n\nconst [ComboboxProvider, useComboboxContext] = createContext<Partial<ComboboxContextValue>>(COMBOBOX_NAME, {});\n\n//\n// Root\n//\n\ntype ComboboxRootProps = PropsWithChildren<\n Partial<ComboboxContextValue & { modal: boolean; defaultOpen: boolean; defaultValue: string; placeholder: string }>\n>;\n\nconst ComboboxRoot = ({\n modal,\n modalId: propsModalId,\n open: propsOpen,\n defaultOpen,\n onOpenChange: propsOnOpenChange,\n value: propsValue,\n defaultValue,\n onValueChange: propsOnValueChange,\n placeholder,\n children,\n}: ComboboxRootProps) => {\n const modalId = useId(COMBOBOX_NAME, propsModalId);\n const [open = false, onOpenChange] = useControllableState({\n prop: propsOpen,\n onChange: propsOnOpenChange,\n defaultProp: defaultOpen,\n });\n const [value = '', onValueChange] = useControllableState({\n prop: propsValue,\n onChange: propsOnValueChange,\n defaultProp: defaultValue,\n });\n\n return (\n <Popover.Root open={open} onOpenChange={onOpenChange} modal={modal}>\n <ComboboxProvider\n isCombobox\n modalId={modalId}\n placeholder={placeholder}\n open={open}\n onOpenChange={onOpenChange}\n value={value}\n onValueChange={onValueChange}\n >\n {children}\n </ComboboxProvider>\n </Popover.Root>\n );\n};\n\n//\n// ContentProps\n//\n\ntype ComboboxContentProps = SearchListRootProps & PopoverContentProps & { label?: string };\n\nconst ComboboxContent = forwardRef<HTMLDivElement, ComboboxContentProps>(\n (\n {\n side = 'bottom',\n collisionPadding = 48,\n sideOffset,\n align,\n alignOffset,\n avoidCollisions,\n collisionBoundary,\n arrowPadding,\n sticky,\n hideWhenDetached,\n onOpenAutoFocus,\n onCloseAutoFocus,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n forceMount,\n children,\n classNames,\n onSearch,\n value,\n defaultValue,\n debounceMs,\n label,\n },\n forwardedRef,\n ) => {\n const { modalId } = useComboboxContext(COMBOBOX_CONTENT_NAME);\n\n return (\n <Popover.Content\n {...{\n side,\n sideOffset,\n align,\n alignOffset,\n avoidCollisions,\n collisionBoundary,\n collisionPadding,\n arrowPadding,\n sticky,\n hideWhenDetached,\n onOpenAutoFocus,\n onCloseAutoFocus,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n forceMount,\n }}\n classNames={[\n 'is-[--radix-popover-trigger-width] max-bs-[--radix-popover-content-available-height] grid grid-rows-[min-content_1fr]',\n classNames,\n ]}\n id={modalId}\n ref={forwardedRef}\n >\n <SearchList.Root onSearch={onSearch} value={value} defaultValue={defaultValue} debounceMs={debounceMs}>\n <div className='contents density-fine' aria-label={label} role='combobox' aria-expanded='true'>\n {children}\n </div>\n </SearchList.Root>\n </Popover.Content>\n );\n },\n);\n\nComboboxContent.displayName = COMBOBOX_CONTENT_NAME;\n\n//\n// Trigger\n//\n\ntype ComboboxTriggerProps = ButtonProps;\n\nconst ComboboxTrigger = forwardRef<HTMLButtonElement, ComboboxTriggerProps>(\n ({ children, onClick, ...props }, forwardedRef) => {\n const { modalId, open, onOpenChange, placeholder, value } = useComboboxContext(COMBOBOX_TRIGGER_NAME);\n const handleClick = useCallback(\n (event: Parameters<Exclude<ButtonProps['onClick'], undefined>>[0]) => {\n onClick?.(event);\n onOpenChange?.(true);\n },\n [onClick, onOpenChange],\n );\n\n return (\n <Popover.Trigger asChild>\n <Button\n {...props}\n role='combobox'\n aria-expanded={open}\n aria-controls={modalId}\n aria-haspopup='dialog'\n onClick={handleClick}\n ref={forwardedRef}\n >\n {children ?? (\n <>\n <span\n className={mx('font-normal text-start flex-1 min-is-0 truncate mie-2', !value && staticPlaceholderText)}\n >\n {value || placeholder}\n </span>\n <Icon icon='ph--caret-down--bold' size={3} />\n </>\n )}\n </Button>\n </Popover.Trigger>\n );\n },\n);\n\nComboboxTrigger.displayName = COMBOBOX_TRIGGER_NAME;\n\n//\n// VirtualTrigger\n//\n\ntype ComboboxVirtualTriggerProps = PopoverVirtualTriggerProps;\n\nconst ComboboxVirtualTrigger = Popover.VirtualTrigger;\n\n//\n// Input\n//\n\ntype ComboboxInputProps = SearchListInputProps;\n\nconst ComboboxInput = forwardRef<HTMLInputElement, ComboboxInputProps>(({ classNames, ...props }, forwardedRef) => {\n return (\n <SearchList.Input\n {...props}\n classNames={[\n 'mli-cardSpacingChrome mbs-cardSpacingChrome mbe-0 is-[calc(100%-2*var(--dx-cardSpacingChrome))]',\n classNames,\n ]}\n ref={forwardedRef}\n />\n );\n});\n\n//\n// List\n//\n\ntype ComboboxListProps = SearchListContentProps;\n\nconst ComboboxList = forwardRef<HTMLDivElement, ComboboxListProps>(({ classNames, ...props }, forwardedRef) => {\n return (\n <SearchList.Content\n {...props}\n classNames={['min-bs-0 overflow-y-auto plb-cardSpacingChrome', classNames]}\n ref={forwardedRef}\n />\n );\n});\n\n//\n// Item\n//\n\ntype ComboboxItemProps = SearchListItemProps & {\n /** Whether to close the popover when this item is selected. Defaults to true. */\n closeOnSelect?: boolean;\n};\n\nconst ComboboxItem = forwardRef<HTMLDivElement, ComboboxItemProps>(\n ({ classNames, onSelect, value, closeOnSelect = true, ...props }, forwardedRef) => {\n const { onValueChange, onOpenChange } = useComboboxContext(COMBOBOX_ITEM_NAME);\n const handleSelect = useCallback<NonNullable<SearchListItemProps['onSelect']>>(() => {\n onSelect?.();\n if (value !== undefined) {\n onValueChange?.(value);\n }\n if (closeOnSelect) {\n onOpenChange?.(false);\n }\n }, [onSelect, onValueChange, onOpenChange, value, closeOnSelect]);\n\n return (\n <SearchList.Item\n {...props}\n value={value}\n classNames={['mli-cardSpacingChrome pli-cardSpacingChrome', classNames]}\n onSelect={handleSelect}\n ref={forwardedRef}\n />\n );\n },\n);\n\nComboboxItem.displayName = COMBOBOX_ITEM_NAME;\n\n//\n// Arrow\n//\n\ntype ComboboxArrowProps = PopoverArrowProps;\n\nconst ComboboxArrow = Popover.Arrow;\n\n//\n// Empty\n//\n\ntype ComboboxEmptyProps = SearchListEmptyProps;\n\nconst ComboboxEmpty = SearchList.Empty;\n\n//\n// Combobox\n// https://www.w3.org/WAI/ARIA/apg/patterns/combobox\n//\n\n//\n// Portal\n//\n\ntype ComboboxPortalProps = React.ComponentPropsWithoutRef<typeof Popover.Portal>;\n\nconst ComboboxPortal = Popover.Portal;\n\nexport const Combobox = {\n Root: ComboboxRoot,\n Portal: ComboboxPortal,\n Content: ComboboxContent,\n Trigger: ComboboxTrigger,\n VirtualTrigger: ComboboxVirtualTrigger,\n Input: ComboboxInput,\n List: ComboboxList,\n Item: ComboboxItem,\n Arrow: ComboboxArrow,\n Empty: ComboboxEmpty,\n};\n\nexport type {\n ComboboxRootProps,\n ComboboxPortalProps,\n ComboboxContentProps,\n ComboboxTriggerProps,\n ComboboxVirtualTriggerProps,\n ComboboxInputProps,\n ComboboxListProps,\n ComboboxItemProps,\n ComboboxArrowProps,\n ComboboxEmptyProps,\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, {\n type ChangeEvent,\n type ComponentPropsWithRef,\n type KeyboardEvent,\n type PropsWithChildren,\n type ReactNode,\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport {\n type Density,\n type Elevation,\n Icon,\n type ThemedClassName,\n useDensityContext,\n useElevationContext,\n useThemeContext,\n useTranslation,\n} from '@dxos/react-ui';\nimport { descriptionText, mx } from '@dxos/ui-theme';\n\nimport { translationKey } from '../../translations';\n\nimport {\n SearchListInputContextProvider,\n SearchListItemContextProvider,\n useSearchListInputContext,\n useSearchListItemContext,\n} from './context';\n\n//\n// Internal types\n//\n\ntype ItemData = {\n element: HTMLElement;\n disabled?: boolean;\n onSelect?: () => void;\n};\n\n//\n// Root\n//\n\ntype SearchListRootProps = PropsWithChildren<{\n /** Controlled query value. */\n value?: string;\n /** Default query value for uncontrolled mode. */\n defaultValue?: string;\n /** Debounce delay in milliseconds. */\n debounceMs?: number;\n /** Callback when search query changes (debounced). */\n onSearch?: (query: string) => void;\n}>;\n\nconst SearchListRoot = ({\n children,\n value: valueProp,\n defaultValue = '',\n debounceMs = 200,\n onSearch,\n}: SearchListRootProps) => {\n const [query = '', setQuery] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue,\n onChange: undefined,\n });\n\n const [selectedValue, setSelectedValue] = useState<string | undefined>(undefined);\n\n // Track registered items: value -> { element, onSelect, disabled }.\n const itemsRef = useRef<Map<string, ItemData>>(new Map());\n\n const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const handleQueryChange = useCallback(\n (newQuery: string) => {\n setQuery(newQuery);\n // Don't update selectedValue here - let the effect handle it when items actually change.\n // This prevents unnecessary re-renders of items when query changes.\n\n // Debounce onSearch callback.\n if (debounceRef.current) {\n clearTimeout(debounceRef.current);\n }\n debounceRef.current = setTimeout(() => {\n onSearch?.(newQuery);\n }, debounceMs);\n },\n [setQuery, onSearch, debounceMs],\n );\n\n // Track when items change to trigger first-item selection.\n const [itemVersion, setItemVersion] = useState(0);\n\n // Cleanup debounce on unmount.\n useEffect(() => {\n return () => {\n if (debounceRef.current) {\n clearTimeout(debounceRef.current);\n }\n };\n }, []);\n\n // Auto-select first non-disabled item when items change and no valid selection exists.\n useEffect(() => {\n // Check if current selection is still valid (exists and not disabled).\n const currentItem = selectedValue !== undefined ? itemsRef.current.get(selectedValue) : undefined;\n const isSelectionValid = currentItem !== undefined && !currentItem.disabled;\n if (!isSelectionValid && itemsRef.current.size > 0) {\n // Get first non-disabled item in DOM order.\n const entries = Array.from(itemsRef.current.entries()).filter(([, data]) => !data.disabled);\n if (entries.length > 0) {\n entries.sort(([, a], [, b]) => {\n const position = a.element.compareDocumentPosition(b.element);\n if (position & Node.DOCUMENT_POSITION_FOLLOWING) {\n return -1;\n }\n if (position & Node.DOCUMENT_POSITION_PRECEDING) {\n return 1;\n }\n return 0;\n });\n const firstValue = entries[0]?.[0];\n if (firstValue !== undefined && firstValue !== selectedValue) {\n setSelectedValue(firstValue);\n }\n } else if (selectedValue !== undefined) {\n // No valid items available, clear selection\n setSelectedValue(undefined);\n }\n }\n }, [itemVersion, selectedValue]);\n\n const registerItem = useCallback(\n (value: string, element: HTMLElement | null, onSelect: (() => void) | undefined, disabled?: boolean) => {\n if (element) {\n itemsRef.current.set(value, { element, onSelect, disabled });\n setItemVersion((v) => v + 1);\n }\n },\n [],\n );\n\n const unregisterItem = useCallback((value: string) => {\n itemsRef.current.delete(value);\n setItemVersion((v) => v + 1);\n }, []);\n\n // Get item values in DOM order by sorting registered elements (excludes disabled items).\n const getItemValues = useCallback(() => {\n return Array.from(itemsRef.current.entries())\n .filter(([, data]) => !data.disabled)\n .sort(([, a], [, b]) => {\n // Sort by DOM position using compareDocumentPosition.\n const position = a.element.compareDocumentPosition(b.element);\n return position & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : position & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;\n })\n .map(([value]) => value);\n }, []);\n\n const triggerSelect = useCallback(() => {\n if (selectedValue !== undefined) {\n const item = itemsRef.current.get(selectedValue);\n item?.onSelect?.();\n }\n }, [selectedValue]);\n\n // Item context; stable, doesn't change when query changes.\n const itemContextValue = useMemo(\n () => ({\n selectedValue,\n onSelectedValueChange: setSelectedValue,\n registerItem,\n unregisterItem,\n }),\n [selectedValue, registerItem, unregisterItem],\n );\n\n const inputContextValue = useMemo(\n () => ({\n query,\n onQueryChange: handleQueryChange,\n selectedValue,\n onSelectedValueChange: setSelectedValue,\n getItemValues,\n triggerSelect,\n }),\n [query, handleQueryChange, selectedValue, getItemValues, triggerSelect],\n );\n\n // NOTE: Separate contexts for items and input to avoid unnecessary re-renders of items when query changes.\n return (\n <SearchListInputContextProvider\n query={inputContextValue.query}\n onQueryChange={inputContextValue.onQueryChange}\n selectedValue={inputContextValue.selectedValue}\n onSelectedValueChange={inputContextValue.onSelectedValueChange}\n getItemValues={inputContextValue.getItemValues}\n triggerSelect={inputContextValue.triggerSelect}\n >\n <SearchListItemContextProvider\n selectedValue={itemContextValue.selectedValue}\n onSelectedValueChange={itemContextValue.onSelectedValueChange}\n registerItem={itemContextValue.registerItem}\n unregisterItem={itemContextValue.unregisterItem}\n >\n {children}\n </SearchListItemContextProvider>\n </SearchListInputContextProvider>\n );\n};\n\nSearchListRoot.displayName = 'SearchList.Root';\n\n//\n// Viewport\n//\n\ntype SearchListViewportProps = ThemedClassName<PropsWithChildren<{}>>;\n\n/**\n * Scrollable viewport wrapper for Content.\n * Only Content wrapped in Viewport will be scrollable.\n */\n// TODO(burdon): Reconcile with Mosaic.Viewport.\nconst SearchListViewport = ({ classNames, children }: SearchListViewportProps) => {\n return (\n <div role='none' className={mx('is-full min-bs-0 grow overflow-y-auto', classNames)}>\n {children}\n </div>\n );\n};\n\nSearchListViewport.displayName = 'SearchList.Viewport';\n\n//\n// Content\n//\n\ntype SearchListContentProps = ThemedClassName<PropsWithChildren<{}>>;\n\n/**\n * Container for search results. Does not scroll by default.\n * Wrap in Viewport for scrollable content.\n */\nconst SearchListContent = forwardRef<HTMLDivElement, SearchListContentProps>(\n ({ classNames, children }, forwardedRef) => {\n return (\n <div\n ref={forwardedRef}\n role='listbox'\n className={mx('flex flex-col is-full min-bs-0 grow overflow-hidden', classNames)}\n >\n {children}\n </div>\n );\n },\n);\n\nSearchListContent.displayName = 'SearchList.Content';\n\n//\n// Input\n//\n\ntype InputVariant = 'default' | 'subdued';\n\ntype SearchListInputProps = ThemedClassName<\n Omit<ComponentPropsWithRef<'input'>, 'value'> & {\n density?: Density;\n elevation?: Elevation;\n variant?: InputVariant;\n }\n>;\n\nconst SearchListInput = forwardRef<HTMLInputElement, SearchListInputProps>(\n (\n { classNames, density: propsDensity, elevation: propsElevation, variant, placeholder, onChange, ...props },\n forwardedRef,\n ) => {\n const { query, onQueryChange, selectedValue, onSelectedValueChange, getItemValues, triggerSelect } =\n useSearchListInputContext('SearchList.Input');\n const { t } = useTranslation(translationKey);\n const { hasIosKeyboard, tx } = useThemeContext();\n const density = useDensityContext(propsDensity);\n const elevation = useElevationContext(propsElevation);\n const defaultPlaceholder = t('search.placeholder');\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n onQueryChange(event.target.value);\n onChange?.(event);\n },\n [onQueryChange, onChange],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLInputElement>) => {\n const values = getItemValues();\n if (values.length === 0) {\n if (event.key === 'Escape') {\n onQueryChange('');\n }\n return;\n }\n\n const currentIndex = selectedValue !== undefined ? values.indexOf(selectedValue) : -1;\n\n switch (event.key) {\n case 'ArrowDown': {\n event.preventDefault();\n const nextIndex = currentIndex === -1 ? 0 : Math.min(currentIndex + 1, values.length - 1);\n const nextValue = values[nextIndex];\n if (nextValue !== undefined) {\n onSelectedValueChange(nextValue);\n }\n break;\n }\n case 'ArrowUp': {\n event.preventDefault();\n const prevIndex = currentIndex === -1 ? values.length - 1 : Math.max(currentIndex - 1, 0);\n const prevValue = values[prevIndex];\n if (prevValue !== undefined) {\n onSelectedValueChange(prevValue);\n }\n break;\n }\n case 'Enter': {\n if (selectedValue !== undefined) {\n event.preventDefault();\n triggerSelect();\n }\n break;\n }\n case 'Home': {\n event.preventDefault();\n const firstValue = values[0];\n if (firstValue !== undefined) {\n onSelectedValueChange(firstValue);\n }\n break;\n }\n case 'End': {\n event.preventDefault();\n const lastValue = values[values.length - 1];\n if (lastValue !== undefined) {\n onSelectedValueChange(lastValue);\n }\n break;\n }\n case 'Escape': {\n event.preventDefault();\n if (selectedValue !== undefined) {\n onSelectedValueChange(undefined);\n } else {\n onQueryChange('');\n }\n break;\n }\n }\n },\n [selectedValue, onSelectedValueChange, getItemValues, triggerSelect, onQueryChange],\n );\n\n return (\n <input\n {...props}\n {...(props.autoFocus && !hasIosKeyboard && { autoFocus: true })}\n type='text'\n value={query}\n placeholder={placeholder ?? defaultPlaceholder}\n className={tx(\n 'input.input',\n 'input',\n {\n variant,\n disabled: props.disabled,\n density,\n elevation,\n },\n classNames,\n )}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n ref={forwardedRef}\n />\n );\n },\n);\n\nSearchListInput.displayName = 'SearchList.Input';\n\n//\n// Item\n//\n\ntype SearchListItemProps = ThemedClassName<{\n /** Unique identifier for the item. */\n value: string;\n /** Display label for the item. */\n label: string;\n /** Icon to display (string identifier for Icon component). */\n icon?: string;\n /** Whether to show a check icon. */\n checked?: boolean;\n /** Suffix text to display after the label. */\n suffix?: string;\n /** Callback when item is selected. */\n onSelect?: () => void;\n /** Whether the item is disabled. */\n disabled?: boolean;\n}>;\n\nconst SearchListItem = forwardRef<HTMLDivElement, SearchListItemProps>(\n ({ classNames, value, label, icon, checked, suffix, onSelect, disabled }, forwardedRef) => {\n const { selectedValue, registerItem, unregisterItem } = useSearchListItemContext('SearchList.Item');\n const internalRef = useRef<HTMLDivElement>(null);\n\n const isSelected = selectedValue === value && !disabled;\n\n // Register this item.\n useEffect(() => {\n const element = internalRef.current;\n if (element) {\n registerItem(value, element, onSelect, disabled);\n }\n return () => unregisterItem(value);\n }, [value, onSelect, disabled, registerItem, unregisterItem]);\n\n // Scroll into view when selected.\n useEffect(() => {\n if (isSelected && internalRef.current) {\n internalRef.current.scrollIntoView({ block: 'nearest', behavior: 'smooth' });\n }\n }, [isSelected]);\n\n const handleClick = useCallback(() => {\n if (!disabled) {\n onSelect?.();\n }\n }, [onSelect, disabled]);\n\n return (\n <div\n ref={(node) => {\n internalRef.current = node;\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n }}\n role='option'\n aria-selected={isSelected}\n aria-disabled={disabled}\n data-selected={isSelected}\n data-disabled={disabled}\n data-value={value}\n tabIndex={-1}\n className={mx(\n 'flex gap-2 items-center',\n 'plb-1 pli-2 rounded-sm select-none cursor-pointer data-[selected=true]:bg-hoverOverlay hover:bg-hoverOverlay',\n disabled && 'opacity-50 cursor-not-allowed hover:bg-transparent data-[selected=true]:bg-transparent',\n classNames,\n )}\n onClick={handleClick}\n >\n {icon && <Icon icon={icon} size={5} />}\n <span className='is-0 grow truncate'>{label}</span>\n {suffix && <span className={mx('shrink-0', descriptionText)}>{suffix}</span>}\n {checked && <Icon icon='ph--check--regular' size={5} />}\n </div>\n );\n },\n);\n\nSearchListItem.displayName = 'SearchList.Item';\n\n//\n// Empty\n//\n\ntype SearchListEmptyProps = ThemedClassName<PropsWithChildren<{}>>;\n\nconst SearchListEmpty = ({ classNames, children }: SearchListEmptyProps) => {\n return (\n <div role='status' className={mx('flex flex-col is-full pli-2 plb-1', classNames)}>\n {children}\n </div>\n );\n};\n\nSearchListEmpty.displayName = 'SearchList.Empty';\n\n//\n// Group\n//\n\ntype SearchListGroupProps = ThemedClassName<\n PropsWithChildren<{\n /** Heading for the group. */\n heading?: ReactNode;\n }>\n>;\n\n/**\n * Groups related search items with an optional heading.\n */\nconst SearchListGroup = forwardRef<HTMLDivElement, SearchListGroupProps>(\n ({ classNames, heading, children }, forwardedRef) => {\n return (\n <div ref={forwardedRef} role='group' className={mx('flex flex-col', classNames)}>\n {heading && (\n <div role='presentation' className='pli-2 plb-1 text-xs font-medium text-description'>\n {heading}\n </div>\n )}\n {children}\n </div>\n );\n },\n);\n\nSearchListGroup.displayName = 'SearchList.Group';\n\n//\n// SearchList\n//\n\nexport const SearchList = {\n Root: SearchListRoot,\n Viewport: SearchListViewport,\n Content: SearchListContent,\n Input: SearchListInput,\n Item: SearchListItem,\n Empty: SearchListEmpty,\n Group: SearchListGroup,\n};\n\nexport type {\n SearchListRootProps,\n SearchListViewportProps,\n SearchListContentProps,\n SearchListInputProps,\n SearchListItemProps,\n SearchListEmptyProps,\n SearchListGroupProps,\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Resource } from '@dxos/react-ui';\n\nexport const translationKey = '@dxos/react-ui-searchlist';\n\nexport const translations = [\n {\n 'en-US': {\n [translationKey]: {\n 'search.placeholder': 'Search...',\n },\n },\n },\n] as const satisfies Resource[];\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@radix-ui/react-context';\n\n/** Context for items - stable, doesn't change when query changes */\nexport type SearchListItemContextValue = {\n /** Currently selected item value for keyboard navigation. */\n selectedValue: string | undefined;\n /** Update the selected value. */\n onSelectedValueChange: (value: string | undefined) => void;\n /** Register an item for keyboard navigation. */\n registerItem: (\n value: string,\n element: HTMLElement | null,\n onSelect: (() => void) | undefined,\n disabled?: boolean,\n ) => void;\n /** Unregister an item. */\n unregisterItem: (value: string) => void;\n};\n\n/** Context for input - can change frequently with query */\nexport type SearchListInputContextValue = {\n /** Current search query. */\n query: string;\n /** Update the query value. */\n onQueryChange: (query: string) => void;\n /** Currently selected item value for keyboard navigation. */\n selectedValue: string | undefined;\n /** Update the selected value. */\n onSelectedValueChange: (value: string | undefined) => void;\n /** Get ordered list of registered item values (excludes disabled items). */\n getItemValues: () => string[];\n /** Trigger selection of the currently highlighted item. */\n triggerSelect: () => void;\n};\n\nexport const [SearchListItemContextProvider, useSearchListItemContext] =\n createContext<SearchListItemContextValue>('SearchListItem');\nexport const [SearchListInputContextProvider, useSearchListInputContext] =\n createContext<SearchListInputContextValue>('SearchListInput');\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { type PropsWithChildren, createContext, useContext, useMemo } from 'react';\n\n/**\n * Type for a filter function that filters an array of objects.\n */\nexport type FilterFunction<T = any> = (objects: T[]) => T[];\n\ntype GlobalFilterContextType = {\n /** The current filter function. */\n filter?: FilterFunction;\n};\n\nconst GlobalFilterContext = createContext<GlobalFilterContextType>({});\n\nexport type GlobalFilterProviderProps = PropsWithChildren<{\n /** The filter function to apply globally. */\n filter?: FilterFunction;\n}>;\n\n/**\n * Provider that makes a filter function available globally.\n * Used by plugin-search to provide its regex-based filtering.\n */\nexport const GlobalFilterProvider = ({ children, filter }: GlobalFilterProviderProps) => {\n const value = useMemo(() => ({ filter }), [filter]);\n return <GlobalFilterContext.Provider value={value}>{children}</GlobalFilterContext.Provider>;\n};\n\n/**\n * Hook to access the global filter context.\n * Returns the filter function if one is provided.\n */\nexport const useGlobalFilter = () => {\n return useContext(GlobalFilterContext);\n};\n\n/**\n * Hook that applies the global filter to an array of objects.\n * If no filter is set, returns the original objects unchanged.\n *\n * @example\n * const objects = useQuery(db, Filter.everything());\n * const filteredObjects = useGlobalFilteredObjects(objects);\n */\nexport const useGlobalFilteredObjects = <T extends Record<string, any>>(objects?: T[]): T[] => {\n const { filter } = useGlobalFilter();\n\n return useMemo(() => {\n if (!objects) {\n return [];\n }\n if (!filter) {\n return objects;\n }\n return filter(objects);\n }, [objects, filter]);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useSearchListInputContext } from '../context';\n\n/**\n * Hook to access the search context for custom input implementations.\n */\nexport const useSearchListInput = () => {\n const { query, onQueryChange, selectedValue, onSelectedValueChange, getItemValues, triggerSelect } =\n useSearchListInputContext('useSearchListInput');\n return { query, onQueryChange, selectedValue, onSelectedValueChange, getItemValues, triggerSelect };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useSearchListItemContext } from '../context';\n\n/**\n * Hook to access selection state for custom item renderers.\n * Returns the current selected value and registration functions.\n */\nexport const useSearchListItem = () => {\n const { selectedValue, registerItem, unregisterItem } = useSearchListItemContext('useSearchListItem');\n return { selectedValue, registerItem, unregisterItem };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport commandScore from 'command-score';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nexport type UseSearchListResultsOptions<T> = {\n /** Items to filter. */\n items: T[];\n /** Custom filter function. Defaults to filtering by extracted string. */\n filter?: (item: T, query: string) => boolean;\n /** Enable fuzzy filtering using command-score algorithm. Defaults to true. */\n fuzzy?: boolean;\n /** Custom function to extract the searchable string from an item. Defaults to accessing 'label' property if it exists. */\n extract?: (item: T) => string;\n /** Minimum score threshold for fuzzy matches (0-1). Defaults to 0. */\n minScore?: number;\n};\n\n/**\n * Hook to manage search results with fuzzy filtering (enabled by default).\n * Returns filtered results and a handleSearch function to pass to SearchList.Root.\n *\n * @example\n * // Default fuzzy filtering using command-score (tries to extract from 'label' property)\n * const { results, handleSearch } = useSearchListResults({ items });\n *\n * @example\n * // Disable fuzzy for basic case-insensitive substring match\n * const { results, handleSearch } = useSearchListResults({ items, fuzzy: false });\n *\n * @example\n * // Custom extraction for fuzzy filtering\n * const { results, handleSearch } = useSearchListResults({\n * items,\n * extract: (item) => `${item.name} ${item.description}`,\n * });\n */\nexport const useSearchListResults = <T = unknown>({\n items,\n filter,\n fuzzy = true,\n extract,\n minScore = 0,\n}: UseSearchListResultsOptions<T>) => {\n const [query, setQuery] = useState<string>('');\n const queryRef = useRef<string>('');\n\n // Update results when items change.\n useEffect(() => {\n queryRef.current = '';\n setQuery('');\n }, [items]);\n\n const defaultExtract = useCallback((item: T) => {\n // If item is a string, return it directly\n if (typeof item === 'string') {\n return item;\n }\n // Otherwise, try to access 'label' property\n return (item as any)?.label ?? '';\n }, []);\n const extractFn = extract ?? defaultExtract;\n\n const defaultFilter = useCallback(\n (item: T, query: string) => {\n const searchable = extractFn(item);\n return searchable.toLowerCase().includes(query.toLowerCase());\n },\n [extractFn],\n );\n\n const filterFn = filter ?? defaultFilter;\n\n const handleSearch = useCallback((searchQuery: string) => {\n queryRef.current = searchQuery;\n setQuery(searchQuery);\n }, []);\n\n const results = useMemo(() => {\n const currentQuery = queryRef.current;\n if (!currentQuery) {\n return items;\n }\n\n if (fuzzy) {\n // Score and filter items using command-score.\n const scored = items\n .map((item) => ({\n item,\n score: commandScore(extractFn(item), currentQuery) as number,\n }))\n .filter(({ score }) => score > minScore)\n .sort((a, b) => b.score - a.score);\n\n return scored.map(({ item }) => item);\n } else {\n return items.filter((item) => filterFn(item, currentQuery));\n }\n }, [items, query, filterFn, fuzzy, extractFn, minScore]);\n\n return { results, handleSearch };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { type Scope, createContextScope } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, { type ComponentPropsWithRef, forwardRef, useCallback, useEffect, useRef } from 'react';\n\nimport { Icon, type IconProps, type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\n\nconst commandItem = 'flex items-center overflow-hidden';\n\nconst LISTBOX_NAME = 'Listbox';\nconst LISTBOX_OPTION_NAME = 'ListboxOption';\nconst LISTBOX_OPTION_LABEL_NAME = 'ListboxOptionLabel';\nconst LISTBOX_OPTION_INDICATOR_NAME = 'ListboxOptionIndicator';\n\n//\n// Context\n//\n\ntype ListboxScopedProps<P> = P & { __listboxScope?: Scope };\ntype ListboxOptionScopedProps<P> = P & { __listboxOptionScope?: Scope };\n\ntype ListboxOptionProps = ThemedClassName<ComponentPropsWithRef<'li'>> & {\n value: string;\n};\n\nconst [createListboxContext, createListboxScope] = createContextScope(LISTBOX_NAME, []);\nconst [createListboxOptionContext, createListboxOptionScope] = createContextScope(LISTBOX_OPTION_NAME, [\n createListboxScope,\n]);\n\ntype ListboxContextValue = {\n selectedValue: string | undefined;\n onValueChange: (value: string) => void;\n};\n\ntype ListboxOptionContextValue = {\n value: string;\n isSelected: boolean;\n};\n\nconst [ListboxProvider, useListboxContext] = createListboxContext<ListboxContextValue>(LISTBOX_NAME);\nconst [ListboxOptionProvider, useListboxOptionContext] =\n createListboxOptionContext<ListboxOptionContextValue>(LISTBOX_OPTION_NAME);\n\n//\n// Root\n//\n\ntype ListboxRootProps = ThemedClassName<ComponentPropsWithRef<'ul'>> & {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n autoFocus?: boolean;\n};\n\n// TODO(thure): Note that this overlaps significantly with the the `SelectableListbox` story of `List.tsx` in `react-ui`,\n// making this an exemplar of `List` specifying standard `role=\"listbox\"` interactivity, though it is here because it\n// coheres with SearchList’s styles and norms. This can be promoted to `react-ui`, but doing so should involve clearing\n// the technical- and design-debt in its `List` component.\nconst ListboxRoot = forwardRef<HTMLUListElement, ListboxRootProps>(\n (props: ListboxScopedProps<ListboxRootProps>, forwardedRef) => {\n const {\n __listboxScope,\n children,\n classNames,\n value: propsValue,\n defaultValue,\n onValueChange,\n autoFocus,\n ...rootProps\n } = props;\n\n const arrowGroup = useArrowNavigationGroup({ axis: 'vertical' });\n const ref = useRef<HTMLUListElement | null>(null);\n const rootRef = useComposedRefs<HTMLUListElement>(ref, forwardedRef);\n\n const [selectedValue, setSelectedValue] = useControllableState({\n prop: propsValue,\n defaultProp: defaultValue,\n onChange: onValueChange,\n });\n\n const handleValueChange = (value: string) => {\n setSelectedValue(value);\n };\n\n useEffect(() => {\n // Autofocus the selected option on mount using querySelector\n (ref.current?.querySelector('[aria-selected=\"true\"]') as HTMLLIElement)?.focus();\n }, [autoFocus]);\n\n return (\n <ListboxProvider scope={__listboxScope} selectedValue={selectedValue} onValueChange={handleValueChange}>\n <ul\n role='listbox'\n {...rootProps}\n className={mx('is-full p-cardSpacingChrome', classNames)}\n ref={rootRef}\n {...arrowGroup}\n >\n {children}\n </ul>\n </ListboxProvider>\n );\n },\n);\n\nListboxRoot.displayName = LISTBOX_NAME;\n\n//\n// Option\n//\n\nconst ListboxOption = forwardRef<HTMLLIElement, ListboxOptionProps>(\n (props: ListboxScopedProps<ListboxOptionProps>, forwardedRef) => {\n const { __listboxScope, children, classNames, value, ...rootProps } = props;\n const { selectedValue, onValueChange } = useListboxContext(LISTBOX_OPTION_NAME, __listboxScope);\n\n const isSelected = selectedValue === value;\n\n const handleSelect = useCallback(() => {\n onValueChange(value);\n }, [value, onValueChange]);\n\n return (\n <ListboxOptionProvider scope={__listboxScope} value={value} isSelected={isSelected}>\n <li\n role='option'\n {...rootProps}\n aria-selected={isSelected}\n tabIndex={0}\n className={mx(\n 'dx-focus-ring',\n 'plb-1 pli-2 rounded-sm select-none cursor-pointer data-[selected=true]:bg-hoverOverlay hover:bg-hoverOverlay',\n commandItem,\n classNames,\n )}\n onClick={handleSelect}\n onKeyDown={({ key }) => {\n if (['Enter', ' '].includes(key)) {\n handleSelect();\n }\n }}\n ref={forwardedRef}\n >\n {children}\n </li>\n </ListboxOptionProvider>\n );\n },\n);\n\nListboxOption.displayName = LISTBOX_OPTION_NAME;\n\n//\n// OptionLabel\n//\n\nconst ListboxOptionLabel = forwardRef<HTMLDivElement, ThemedClassName<ComponentPropsWithRef<'div'>>>(\n ({ children, classNames, ...rootProps }, forwardedRef) => {\n return (\n <span {...rootProps} className={mx('grow truncate', classNames)} ref={forwardedRef}>\n {children}\n </span>\n );\n },\n);\n\nListboxOptionLabel.displayName = LISTBOX_OPTION_LABEL_NAME;\n\ntype ListboxOptionIndicatorProps = Omit<IconProps, 'icon'> & Partial<Pick<IconProps, 'icon'>>;\n\n//\n// OptionIndicator\n//\n\nconst ListboxOptionIndicator = forwardRef<SVGSVGElement, ListboxOptionIndicatorProps>(\n (props: ListboxOptionScopedProps<ListboxOptionIndicatorProps>, forwardedRef) => {\n const { __listboxOptionScope, classNames, ...rootProps } = props;\n const { isSelected } = useListboxOptionContext(LISTBOX_OPTION_INDICATOR_NAME, __listboxOptionScope);\n\n return (\n <Icon\n icon='ph--check--regular'\n {...rootProps}\n classNames={mx(!isSelected && 'invisible', classNames)}\n ref={forwardedRef}\n />\n );\n },\n);\n\nListboxOptionIndicator.displayName = LISTBOX_OPTION_INDICATOR_NAME;\n\n//\n// Listbox\n//\n\nexport const Listbox = {\n Root: ListboxRoot,\n Option: ListboxOption,\n OptionLabel: ListboxOptionLabel,\n OptionIndicator: ListboxOptionIndicator,\n};\n\nexport { createListboxScope, useListboxContext };\n\nexport type { ListboxRootProps, ListboxOptionProps, ListboxScopedProps };\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,iBAAAA,sBAAqB;AAC9B,SAASC,wBAAAA,6BAA4B;AACrC,OAAOC,UAAiCC,cAAAA,aAAYC,eAAAA,oBAAmB;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CAAA;AAGFgD,uBAAuBd,cAAc/C;AAM9B,IAAMiE,UAAU;EACrBC,MAAMxD;EACNyD,QAAQnB;EACRoB,aAAaT;EACbU,iBAAiBR;AACnB;",
|
|
6
|
-
"names": ["createContext", "useControllableState", "React", "forwardRef", "useCallback", "Button", "Icon", "Popover", "useId", "mx", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { createContext } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, { type PropsWithChildren, forwardRef, useCallback } from 'react';\n\nimport {\n Button,\n type ButtonProps,\n Icon,\n Popover,\n type PopoverArrowProps,\n type PopoverContentProps,\n type PopoverVirtualTriggerProps,\n} from '@dxos/react-ui';\nimport { useId } from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\n\nimport {\n SearchList,\n type SearchListEmptyProps,\n type SearchListInputProps,\n type SearchListItemProps,\n type SearchListRootProps,\n type SearchListViewportProps,\n} from '../SearchList';\n\nconst COMBOBOX_NAME = 'Combobox';\nconst COMBOBOX_CONTENT_NAME = 'ComboboxContent';\nconst COMBOBOX_ITEM_NAME = 'ComboboxItem';\nconst COMBOBOX_TRIGGER_NAME = 'ComboboxTrigger';\n\n//\n// Context\n//\n\ntype ComboboxContextValue = {\n modalId: string;\n isCombobox: true;\n placeholder?: string;\n open: boolean;\n onOpenChange: (nextOpen: boolean) => void;\n value: string;\n onValueChange: (nextValue: string) => void;\n};\n\nconst [ComboboxProvider, useComboboxContext] = createContext<Partial<ComboboxContextValue>>(COMBOBOX_NAME, {});\n\n//\n// Root\n//\n\ntype ComboboxRootProps = PropsWithChildren<\n Partial<ComboboxContextValue & { modal: boolean; defaultOpen: boolean; defaultValue: string; placeholder: string }>\n>;\n\nconst ComboboxRoot = ({\n modal,\n modalId: propsModalId,\n open: propsOpen,\n defaultOpen,\n onOpenChange: propsOnOpenChange,\n value: propsValue,\n defaultValue,\n onValueChange: propsOnValueChange,\n placeholder,\n children,\n}: ComboboxRootProps) => {\n const modalId = useId(COMBOBOX_NAME, propsModalId);\n const [open = false, onOpenChange] = useControllableState({\n prop: propsOpen,\n onChange: propsOnOpenChange,\n defaultProp: defaultOpen,\n });\n const [value = '', onValueChange] = useControllableState({\n prop: propsValue,\n onChange: propsOnValueChange,\n defaultProp: defaultValue,\n });\n\n return (\n <Popover.Root open={open} onOpenChange={onOpenChange} modal={modal}>\n <ComboboxProvider\n isCombobox\n modalId={modalId}\n placeholder={placeholder}\n open={open}\n onOpenChange={onOpenChange}\n value={value}\n onValueChange={onValueChange}\n >\n {children}\n </ComboboxProvider>\n </Popover.Root>\n );\n};\n\n//\n// ContentProps\n//\n\ntype ComboboxContentProps = SearchListRootProps & PopoverContentProps & { label?: string };\n\nconst ComboboxContent = forwardRef<HTMLDivElement, ComboboxContentProps>(\n (\n {\n side = 'bottom',\n collisionPadding = 48,\n sideOffset,\n align,\n alignOffset,\n avoidCollisions,\n collisionBoundary,\n arrowPadding,\n sticky,\n hideWhenDetached,\n onOpenAutoFocus,\n onCloseAutoFocus,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n forceMount,\n children,\n classNames,\n onSearch,\n value,\n defaultValue,\n debounceMs,\n label,\n },\n forwardedRef,\n ) => {\n const { modalId } = useComboboxContext(COMBOBOX_CONTENT_NAME);\n\n return (\n <Popover.Content\n {...{\n side,\n sideOffset,\n align,\n alignOffset,\n avoidCollisions,\n collisionBoundary,\n collisionPadding,\n arrowPadding,\n sticky,\n hideWhenDetached,\n onOpenAutoFocus,\n onCloseAutoFocus,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n forceMount,\n }}\n classNames={[\n 'w-(--radix-popover-trigger-width) max-h-(--radix-popover-content-available-height) grid grid-rows-[min-content_1fr]',\n classNames,\n ]}\n id={modalId}\n ref={forwardedRef}\n >\n <SearchList.Root onSearch={onSearch} value={value} defaultValue={defaultValue} debounceMs={debounceMs}>\n <SearchList.Content>{children}</SearchList.Content>\n </SearchList.Root>\n </Popover.Content>\n );\n },\n);\n\nComboboxContent.displayName = COMBOBOX_CONTENT_NAME;\n\n//\n// Trigger\n//\n\ntype ComboboxTriggerProps = ButtonProps;\n\nconst ComboboxTrigger = forwardRef<HTMLButtonElement, ComboboxTriggerProps>(\n ({ children, onClick, ...props }, forwardedRef) => {\n const { modalId, open, onOpenChange, placeholder, value } = useComboboxContext(COMBOBOX_TRIGGER_NAME);\n const handleClick = useCallback(\n (event: Parameters<Exclude<ButtonProps['onClick'], undefined>>[0]) => {\n onClick?.(event);\n onOpenChange?.(true);\n },\n [onClick, onOpenChange],\n );\n\n return (\n <Popover.Trigger asChild>\n <Button\n {...props}\n role='combobox'\n aria-expanded={open}\n aria-controls={modalId}\n aria-haspopup='dialog'\n onClick={handleClick}\n ref={forwardedRef}\n >\n {children ?? (\n <>\n <span className={mx('font-normal text-start flex-1 min-w-0 truncate me-2', !value && 'text-subdued')}>\n {value || placeholder}\n </span>\n <Icon icon='ph--caret-down--bold' size={3} />\n </>\n )}\n </Button>\n </Popover.Trigger>\n );\n },\n);\n\nComboboxTrigger.displayName = COMBOBOX_TRIGGER_NAME;\n\n//\n// VirtualTrigger\n//\n\ntype ComboboxVirtualTriggerProps = PopoverVirtualTriggerProps;\n\nconst ComboboxVirtualTrigger = Popover.VirtualTrigger;\n\n//\n// Input\n//\n\ntype ComboboxInputProps = SearchListInputProps;\n\nconst ComboboxInput = forwardRef<HTMLInputElement, ComboboxInputProps>(({ classNames, ...props }, forwardedRef) => {\n return (\n <SearchList.Input\n {...props}\n classNames={['m-form-chrome mb-0 w-[calc(100%-2*var(--spacing-form-chrome))]', classNames]}\n ref={forwardedRef}\n />\n );\n});\n\n//\n// List\n//\n\ntype ComboboxListProps = SearchListViewportProps;\n\nconst ComboboxList = forwardRef<HTMLDivElement, ComboboxListProps>(({ classNames, ...props }, forwardedRef) => {\n return <SearchList.Viewport {...props} classNames={['py-form-chrome', classNames]} ref={forwardedRef} />;\n});\n\n//\n// Item\n//\n\ntype ComboboxItemProps = SearchListItemProps & {\n /** Whether to close the popover when this item is selected. Defaults to true. */\n closeOnSelect?: boolean;\n};\n\nconst ComboboxItem = forwardRef<HTMLDivElement, ComboboxItemProps>(\n ({ classNames, onSelect, value, closeOnSelect = true, ...props }, forwardedRef) => {\n const { onValueChange, onOpenChange } = useComboboxContext(COMBOBOX_ITEM_NAME);\n const handleSelect = useCallback<NonNullable<SearchListItemProps['onSelect']>>(() => {\n onSelect?.();\n if (value !== undefined) {\n onValueChange?.(value);\n }\n if (closeOnSelect) {\n onOpenChange?.(false);\n }\n }, [onSelect, onValueChange, onOpenChange, value, closeOnSelect]);\n\n return (\n <SearchList.Item\n {...props}\n value={value}\n classNames={['mx-form-chrome px-form-chrome', classNames]}\n onSelect={handleSelect}\n ref={forwardedRef}\n />\n );\n },\n);\n\nComboboxItem.displayName = COMBOBOX_ITEM_NAME;\n\n//\n// Arrow\n//\n\ntype ComboboxArrowProps = PopoverArrowProps;\n\nconst ComboboxArrow = Popover.Arrow;\n\n//\n// Empty\n//\n\ntype ComboboxEmptyProps = SearchListEmptyProps;\n\nconst ComboboxEmpty = SearchList.Empty;\n\n//\n// Combobox\n// https://www.w3.org/WAI/ARIA/apg/patterns/combobox\n//\n\n//\n// Portal\n//\n\ntype ComboboxPortalProps = React.ComponentPropsWithoutRef<typeof Popover.Portal>;\n\nconst ComboboxPortal = Popover.Portal;\n\nexport const Combobox = {\n Root: ComboboxRoot,\n Portal: ComboboxPortal,\n Content: ComboboxContent,\n Trigger: ComboboxTrigger,\n VirtualTrigger: ComboboxVirtualTrigger,\n Input: ComboboxInput,\n List: ComboboxList,\n Item: ComboboxItem,\n Arrow: ComboboxArrow,\n Empty: ComboboxEmpty,\n};\n\nexport type {\n ComboboxRootProps,\n ComboboxPortalProps,\n ComboboxContentProps,\n ComboboxTriggerProps,\n ComboboxVirtualTriggerProps,\n ComboboxInputProps,\n ComboboxListProps,\n ComboboxItemProps,\n ComboboxArrowProps,\n ComboboxEmptyProps,\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, {\n type ChangeEvent,\n type ComponentPropsWithRef,\n type ComponentPropsWithoutRef,\n type KeyboardEvent,\n type PropsWithChildren,\n type ReactNode,\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport {\n type Density,\n type Elevation,\n Icon,\n ScrollArea,\n type ThemedClassName,\n useDensityContext,\n useElevationContext,\n useThemeContext,\n useTranslation,\n} from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\n\nimport { translationKey } from '../../translations';\n\nimport {\n SearchListInputContextProvider,\n SearchListItemContextProvider,\n useSearchListInputContext,\n useSearchListItemContext,\n} from './context';\n\n//\n// Internal types\n//\n\ntype ItemData = {\n element: HTMLElement;\n disabled?: boolean;\n onSelect?: () => void;\n};\n\n//\n// Root\n//\n\ntype SearchListRootProps = PropsWithChildren<{\n /** Controlled query value. */\n value?: string;\n\n /** Default query value for uncontrolled mode. */\n defaultValue?: string;\n\n /** Debounce delay in milliseconds. */\n debounceMs?: number;\n\n /** Callback when search query changes (debounced). */\n onSearch?: (query: string) => void;\n}>;\n\nconst SearchListRoot = ({\n children,\n value: valueProp,\n defaultValue = '',\n debounceMs = 200,\n onSearch,\n}: SearchListRootProps) => {\n const [query = '', setQuery] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue,\n onChange: undefined,\n });\n\n const [selectedValue, setSelectedValue] = useState<string | undefined>(undefined);\n\n // Track registered items: value -> { element, onSelect, disabled }.\n const itemsRef = useRef<Map<string, ItemData>>(new Map());\n\n const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const handleQueryChange = useCallback(\n (newQuery: string) => {\n setQuery(newQuery);\n // Don't update selectedValue here - let the effect handle it when items actually change.\n // This prevents unnecessary re-renders of items when query changes.\n\n // Debounce onSearch callback.\n if (debounceRef.current) {\n clearTimeout(debounceRef.current);\n }\n debounceRef.current = setTimeout(() => {\n onSearch?.(newQuery);\n }, debounceMs);\n },\n [setQuery, onSearch, debounceMs],\n );\n\n // Track when items change to trigger first-item selection.\n const [itemVersion, setItemVersion] = useState(0);\n\n // Cleanup debounce on unmount.\n useEffect(() => {\n return () => {\n if (debounceRef.current) {\n clearTimeout(debounceRef.current);\n }\n };\n }, []);\n\n // Auto-select first non-disabled item when items change and no valid selection exists.\n useEffect(() => {\n // Check if current selection is still valid (exists and not disabled).\n const currentItem = selectedValue !== undefined ? itemsRef.current.get(selectedValue) : undefined;\n const isSelectionValid = currentItem !== undefined && !currentItem.disabled;\n if (!isSelectionValid && itemsRef.current.size > 0) {\n // Get first non-disabled item in DOM order.\n const entries = Array.from(itemsRef.current.entries()).filter(([, data]) => !data.disabled);\n if (entries.length > 0) {\n entries.sort(([, a], [, b]) => {\n const position = a.element.compareDocumentPosition(b.element);\n if (position & Node.DOCUMENT_POSITION_FOLLOWING) {\n return -1;\n }\n if (position & Node.DOCUMENT_POSITION_PRECEDING) {\n return 1;\n }\n return 0;\n });\n const firstValue = entries[0]?.[0];\n if (firstValue !== undefined && firstValue !== selectedValue) {\n setSelectedValue(firstValue);\n }\n } else if (selectedValue !== undefined) {\n // No valid items available, clear selection\n setSelectedValue(undefined);\n }\n }\n }, [itemVersion, selectedValue]);\n\n const registerItem = useCallback(\n (value: string, element: HTMLElement | null, onSelect: (() => void) | undefined, disabled?: boolean) => {\n if (element) {\n itemsRef.current.set(value, { element, onSelect, disabled });\n setItemVersion((v) => v + 1);\n }\n },\n [],\n );\n\n const unregisterItem = useCallback((value: string) => {\n itemsRef.current.delete(value);\n setItemVersion((v) => v + 1);\n }, []);\n\n // Get item values in DOM order by sorting registered elements (excludes disabled items).\n const getItemValues = useCallback(() => {\n return Array.from(itemsRef.current.entries())\n .filter(([, data]) => !data.disabled)\n .sort(([, a], [, b]) => {\n // Sort by DOM position using compareDocumentPosition.\n const position = a.element.compareDocumentPosition(b.element);\n return position & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : position & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;\n })\n .map(([value]) => value);\n }, []);\n\n const triggerSelect = useCallback(() => {\n if (selectedValue !== undefined) {\n const item = itemsRef.current.get(selectedValue);\n item?.onSelect?.();\n }\n }, [selectedValue]);\n\n // Item context; stable, doesn't change when query changes.\n const itemContextValue = useMemo(\n () => ({\n selectedValue,\n onSelectedValueChange: setSelectedValue,\n registerItem,\n unregisterItem,\n }),\n [selectedValue, registerItem, unregisterItem],\n );\n\n const inputContextValue = useMemo(\n () => ({\n query,\n onQueryChange: handleQueryChange,\n selectedValue,\n onSelectedValueChange: setSelectedValue,\n getItemValues,\n triggerSelect,\n }),\n [query, handleQueryChange, selectedValue, getItemValues, triggerSelect],\n );\n\n // NOTE: Separate contexts for items and input to avoid unnecessary re-renders of items when query changes.\n return (\n <SearchListInputContextProvider\n query={inputContextValue.query}\n onQueryChange={inputContextValue.onQueryChange}\n selectedValue={inputContextValue.selectedValue}\n onSelectedValueChange={inputContextValue.onSelectedValueChange}\n getItemValues={inputContextValue.getItemValues}\n triggerSelect={inputContextValue.triggerSelect}\n >\n <SearchListItemContextProvider\n selectedValue={itemContextValue.selectedValue}\n onSelectedValueChange={itemContextValue.onSelectedValueChange}\n registerItem={itemContextValue.registerItem}\n unregisterItem={itemContextValue.unregisterItem}\n >\n {children}\n </SearchListItemContextProvider>\n </SearchListInputContextProvider>\n );\n};\n\nSearchListRoot.displayName = 'SearchList.Root';\n\n//\n// Content\n//\n\ntype SearchListContentProps = ThemedClassName<ComponentPropsWithoutRef<'div'>>;\n\nconst SearchListContent = forwardRef<HTMLDivElement, SearchListContentProps>(\n ({ classNames, children, ...props }, forwardedRef) => {\n return (\n <div role='none' {...props} className={mx('dx-container flex flex-col gap-3', classNames)} ref={forwardedRef}>\n {children}\n </div>\n );\n },\n);\n\nSearchListContent.displayName = 'SearchList.Content';\n\n//\n// Input\n//\n\ntype InputVariant = 'default' | 'subdued';\n\ntype SearchListInputProps = ThemedClassName<\n Omit<ComponentPropsWithRef<'input'>, 'value'> & {\n density?: Density;\n elevation?: Elevation;\n variant?: InputVariant;\n }\n>;\n\nconst SearchListInput = forwardRef<HTMLInputElement, SearchListInputProps>(\n (\n { classNames, density: propsDensity, elevation: propsElevation, variant, placeholder, onChange, ...props },\n forwardedRef,\n ) => {\n const { query, onQueryChange, selectedValue, onSelectedValueChange, getItemValues, triggerSelect } =\n useSearchListInputContext('SearchList.Input');\n const { t } = useTranslation(translationKey);\n const { hasIosKeyboard, tx } = useThemeContext();\n const density = useDensityContext(propsDensity);\n const elevation = useElevationContext(propsElevation);\n const defaultPlaceholder = t('search.placeholder');\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n onQueryChange(event.target.value);\n onChange?.(event);\n },\n [onQueryChange, onChange],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLInputElement>) => {\n const values = getItemValues();\n if (values.length === 0) {\n if (event.key === 'Escape') {\n onQueryChange('');\n }\n return;\n }\n\n const currentIndex = selectedValue !== undefined ? values.indexOf(selectedValue) : -1;\n\n switch (event.key) {\n case 'ArrowDown': {\n event.preventDefault();\n const nextIndex = currentIndex === -1 ? 0 : Math.min(currentIndex + 1, values.length - 1);\n const nextValue = values[nextIndex];\n if (nextValue !== undefined) {\n onSelectedValueChange(nextValue);\n }\n break;\n }\n case 'ArrowUp': {\n event.preventDefault();\n const prevIndex = currentIndex === -1 ? values.length - 1 : Math.max(currentIndex - 1, 0);\n const prevValue = values[prevIndex];\n if (prevValue !== undefined) {\n onSelectedValueChange(prevValue);\n }\n break;\n }\n case 'Enter': {\n if (selectedValue !== undefined) {\n event.preventDefault();\n triggerSelect();\n }\n break;\n }\n case 'Home': {\n event.preventDefault();\n const firstValue = values[0];\n if (firstValue !== undefined) {\n onSelectedValueChange(firstValue);\n }\n break;\n }\n case 'End': {\n event.preventDefault();\n const lastValue = values[values.length - 1];\n if (lastValue !== undefined) {\n onSelectedValueChange(lastValue);\n }\n break;\n }\n case 'Escape': {\n event.preventDefault();\n if (selectedValue !== undefined) {\n onSelectedValueChange(undefined);\n } else {\n onQueryChange('');\n }\n break;\n }\n }\n },\n [selectedValue, onSelectedValueChange, getItemValues, triggerSelect, onQueryChange],\n );\n\n return (\n <input\n {...props}\n {...(props.autoFocus && !hasIosKeyboard && { autoFocus: true })}\n type='text'\n placeholder={placeholder ?? defaultPlaceholder}\n className={tx(\n 'input.input',\n {\n variant,\n disabled: props.disabled,\n density,\n elevation,\n },\n classNames,\n )}\n value={query}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n ref={forwardedRef}\n />\n );\n },\n);\n\nSearchListInput.displayName = 'SearchList.Input';\n\n//\n// Viewport\n//\n\ntype SearchListViewportProps = ThemedClassName<PropsWithChildren>;\n\nconst SearchListViewport = forwardRef<HTMLDivElement, SearchListViewportProps>(\n ({ classNames, children }, forwardedRef) => {\n return (\n <ScrollArea.Root role='listbox' classNames={mx(classNames)} ref={forwardedRef} thin>\n <ScrollArea.Viewport>{children}</ScrollArea.Viewport>\n </ScrollArea.Root>\n );\n },\n);\n\nSearchListViewport.displayName = 'SearchList.Viewport';\n\n//\n// Item\n//\n\ntype SearchListItemProps = ThemedClassName<{\n /** Unique identifier for the item. */\n value: string;\n /** Display label for the item. */\n label: string;\n /** Icon to display (string identifier for Icon component). */\n icon?: string;\n /** Additional class names for the icon element. */\n iconClassNames?: string;\n /** Whether to show a check icon. */\n checked?: boolean;\n /** Suffix text to display after the label. */\n suffix?: string;\n /** Callback when item is selected. */\n onSelect?: () => void;\n /** Whether the item is disabled. */\n disabled?: boolean;\n}>;\n\nconst SearchListItem = forwardRef<HTMLDivElement, SearchListItemProps>(\n ({ classNames, value, label, icon, iconClassNames, checked, suffix, onSelect, disabled }, forwardedRef) => {\n const { selectedValue, registerItem, unregisterItem } = useSearchListItemContext('SearchList.Item');\n const internalRef = useRef<HTMLDivElement>(null);\n\n const isSelected = selectedValue === value && !disabled;\n\n // Register this item.\n useEffect(() => {\n const element = internalRef.current;\n if (element) {\n registerItem(value, element, onSelect, disabled);\n }\n return () => unregisterItem(value);\n }, [value, onSelect, disabled, registerItem, unregisterItem]);\n\n // Scroll into view when selected.\n useEffect(() => {\n if (isSelected && internalRef.current) {\n internalRef.current.scrollIntoView({ block: 'nearest', behavior: 'smooth' });\n }\n }, [isSelected]);\n\n const handleClick = useCallback(() => {\n if (!disabled) {\n onSelect?.();\n }\n }, [onSelect, disabled]);\n\n return (\n <div\n ref={(node) => {\n internalRef.current = node;\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n }}\n role='option'\n aria-selected={isSelected}\n aria-disabled={disabled}\n data-selected={isSelected}\n data-disabled={disabled}\n data-value={value}\n tabIndex={-1}\n className={mx(\n 'flex gap-2 items-center',\n 'py-1 px-2 rounded-xs select-none cursor-pointer data-[selected=true]:bg-hover-overlay hover:bg-hover-overlay',\n disabled && 'opacity-50 cursor-not-allowed hover:bg-transparent data-[selected=true]:bg-transparent',\n classNames,\n )}\n onClick={handleClick}\n >\n {icon && <Icon icon={icon} size={5} classNames={iconClassNames} />}\n <span className='w-0 grow truncate'>{label}</span>\n {suffix && <span className='shrink-0 text-description'>{suffix}</span>}\n {checked && <Icon icon='ph--check--regular' size={5} />}\n </div>\n );\n },\n);\n\nSearchListItem.displayName = 'SearchList.Item';\n\n//\n// Empty\n//\n\ntype SearchListEmptyProps = ThemedClassName<PropsWithChildren<{}>>;\n\nconst SearchListEmpty = ({ classNames, children }: SearchListEmptyProps) => {\n return (\n <div role='status' className={mx('flex flex-col w-full px-2 py-1', classNames)}>\n {children}\n </div>\n );\n};\n\nSearchListEmpty.displayName = 'SearchList.Empty';\n\n//\n// Group\n//\n\ntype SearchListGroupProps = ThemedClassName<\n PropsWithChildren<{\n /** Heading for the group. */\n heading?: ReactNode;\n }>\n>;\n\n/**\n * Groups related search items with an optional heading.\n */\nconst SearchListGroup = forwardRef<HTMLDivElement, SearchListGroupProps>(\n ({ classNames, heading, children }, forwardedRef) => {\n return (\n <div ref={forwardedRef} role='group' className={mx('flex flex-col', classNames)}>\n {heading && (\n <div role='presentation' className='px-2 py-1 text-xs font-medium text-description'>\n {heading}\n </div>\n )}\n {children}\n </div>\n );\n },\n);\n\nSearchListGroup.displayName = 'SearchList.Group';\n\n//\n// SearchList\n//\n\nexport const SearchList = {\n Root: SearchListRoot,\n Content: SearchListContent,\n Viewport: SearchListViewport,\n Input: SearchListInput,\n Item: SearchListItem,\n Empty: SearchListEmpty,\n Group: SearchListGroup,\n};\n\nexport type {\n SearchListRootProps,\n SearchListContentProps,\n SearchListViewportProps,\n SearchListInputProps,\n SearchListItemProps,\n SearchListEmptyProps,\n SearchListGroupProps,\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Resource } from '@dxos/react-ui';\n\nexport const translationKey = '@dxos/react-ui-searchlist';\n\nexport const translations = [\n {\n 'en-US': {\n [translationKey]: {\n 'search.placeholder': 'Search...',\n },\n },\n },\n] as const satisfies Resource[];\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@radix-ui/react-context';\n\n/** Context for items - stable, doesn't change when query changes */\nexport type SearchListItemContextValue = {\n /** Currently selected item value for keyboard navigation. */\n selectedValue: string | undefined;\n /** Update the selected value. */\n onSelectedValueChange: (value: string | undefined) => void;\n /** Register an item for keyboard navigation. */\n registerItem: (\n value: string,\n element: HTMLElement | null,\n onSelect: (() => void) | undefined,\n disabled?: boolean,\n ) => void;\n /** Unregister an item. */\n unregisterItem: (value: string) => void;\n};\n\n/** Context for input - can change frequently with query */\nexport type SearchListInputContextValue = {\n /** Current search query. */\n query: string;\n /** Update the query value. */\n onQueryChange: (query: string) => void;\n /** Currently selected item value for keyboard navigation. */\n selectedValue: string | undefined;\n /** Update the selected value. */\n onSelectedValueChange: (value: string | undefined) => void;\n /** Get ordered list of registered item values (excludes disabled items). */\n getItemValues: () => string[];\n /** Trigger selection of the currently highlighted item. */\n triggerSelect: () => void;\n};\n\nexport const [SearchListItemContextProvider, useSearchListItemContext] =\n createContext<SearchListItemContextValue>('SearchListItem');\nexport const [SearchListInputContextProvider, useSearchListInputContext] =\n createContext<SearchListInputContextValue>('SearchListInput');\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { type PropsWithChildren, createContext, useContext, useMemo } from 'react';\n\n/**\n * Type for a filter function that filters an array of objects.\n */\nexport type FilterFunction<T = any> = (objects: T[]) => T[];\n\ntype GlobalFilterContextType = {\n /** The current filter function. */\n filter?: FilterFunction;\n};\n\nconst GlobalFilterContext = createContext<GlobalFilterContextType>({});\n\nexport type GlobalFilterProviderProps = PropsWithChildren<{\n /** The filter function to apply globally. */\n filter?: FilterFunction;\n}>;\n\n/**\n * Provider that makes a filter function available globally.\n * Used by plugin-search to provide its regex-based filtering.\n */\nexport const GlobalFilterProvider = ({ children, filter }: GlobalFilterProviderProps) => {\n const value = useMemo(() => ({ filter }), [filter]);\n return <GlobalFilterContext.Provider value={value}>{children}</GlobalFilterContext.Provider>;\n};\n\n/**\n * Hook to access the global filter context.\n * Returns the filter function if one is provided.\n */\nexport const useGlobalFilter = () => {\n return useContext(GlobalFilterContext);\n};\n\n/**\n * Hook that applies the global filter to an array of objects.\n * If no filter is set, returns the original objects unchanged.\n *\n * @example\n * const objects = useQuery(db, Filter.everything());\n * const filteredObjects = useGlobalFilteredObjects(objects);\n */\nexport const useGlobalFilteredObjects = <T extends Record<string, any>>(objects?: T[]): T[] => {\n const { filter } = useGlobalFilter();\n\n return useMemo(() => {\n if (!objects) {\n return [];\n }\n if (!filter) {\n return objects;\n }\n return filter(objects);\n }, [objects, filter]);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useSearchListInputContext } from '../context';\n\n/**\n * Hook to access the search context for custom input implementations.\n */\nexport const useSearchListInput = () => {\n const { query, onQueryChange, selectedValue, onSelectedValueChange, getItemValues, triggerSelect } =\n useSearchListInputContext('useSearchListInput');\n return { query, onQueryChange, selectedValue, onSelectedValueChange, getItemValues, triggerSelect };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useSearchListItemContext } from '../context';\n\n/**\n * Hook to access selection state for custom item renderers.\n * Returns the current selected value and registration functions.\n */\nexport const useSearchListItem = () => {\n const { selectedValue, registerItem, unregisterItem } = useSearchListItemContext('useSearchListItem');\n return { selectedValue, registerItem, unregisterItem };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport commandScore from 'command-score';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nexport type UseSearchListResultsOptions<T> = {\n /** Items to filter. */\n items: T[];\n /** Custom filter function. Defaults to filtering by extracted string. */\n filter?: (item: T, query: string) => boolean;\n /** Enable fuzzy filtering using command-score algorithm. Defaults to true. */\n fuzzy?: boolean;\n /** Custom function to extract the searchable string from an item. Defaults to accessing 'label' property if it exists. */\n extract?: (item: T) => string;\n /** Minimum score threshold for fuzzy matches (0-1). Defaults to 0. */\n minScore?: number;\n};\n\n/**\n * Hook to manage search results with fuzzy filtering (enabled by default).\n * Returns filtered results and a handleSearch function to pass to SearchList.Root.\n *\n * @example\n * // Default fuzzy filtering using command-score (tries to extract from 'label' property)\n * const { results, handleSearch } = useSearchListResults({ items });\n *\n * @example\n * // Disable fuzzy for basic case-insensitive substring match\n * const { results, handleSearch } = useSearchListResults({ items, fuzzy: false });\n *\n * @example\n * // Custom extraction for fuzzy filtering\n * const { results, handleSearch } = useSearchListResults({\n * items,\n * extract: (item) => `${item.name} ${item.description}`,\n * });\n */\nexport const useSearchListResults = <T = unknown>({\n items,\n filter,\n fuzzy = true,\n extract,\n minScore = 0,\n}: UseSearchListResultsOptions<T>) => {\n const [query, setQuery] = useState<string>('');\n const queryRef = useRef<string>('');\n\n // Update results when items change.\n useEffect(() => {\n queryRef.current = '';\n setQuery('');\n }, [items]);\n\n const defaultExtract = useCallback((item: T) => {\n // If item is a string, return it directly\n if (typeof item === 'string') {\n return item;\n }\n // Otherwise, try to access 'label' property\n return (item as any)?.label ?? '';\n }, []);\n const extractFn = extract ?? defaultExtract;\n\n const defaultFilter = useCallback(\n (item: T, query: string) => {\n const searchable = extractFn(item);\n return searchable.toLowerCase().includes(query.toLowerCase());\n },\n [extractFn],\n );\n\n const filterFn = filter ?? defaultFilter;\n\n const handleSearch = useCallback((searchQuery: string) => {\n queryRef.current = searchQuery;\n setQuery(searchQuery);\n }, []);\n\n const results = useMemo(() => {\n const currentQuery = queryRef.current;\n if (!currentQuery) {\n return items;\n }\n\n if (fuzzy) {\n // Score and filter items using command-score.\n const scored = items\n .map((item) => ({\n item,\n score: commandScore(extractFn(item), currentQuery) as number,\n }))\n .filter(({ score }) => score > minScore)\n .sort((a, b) => b.score - a.score);\n\n return scored.map(({ item }) => item);\n } else {\n return items.filter((item) => filterFn(item, currentQuery));\n }\n }, [items, query, filterFn, fuzzy, extractFn, minScore]);\n\n return { results, handleSearch };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { type Scope, createContextScope } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, { type ComponentPropsWithRef, forwardRef, useCallback, useEffect, useRef } from 'react';\n\nimport { Icon, type IconProps, type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\n\nconst commandItem = 'flex items-center overflow-hidden';\n\nconst LISTBOX_NAME = 'Listbox';\nconst LISTBOX_OPTION_NAME = 'ListboxOption';\nconst LISTBOX_OPTION_LABEL_NAME = 'ListboxOptionLabel';\nconst LISTBOX_OPTION_INDICATOR_NAME = 'ListboxOptionIndicator';\n\n//\n// Context\n//\n\ntype ListboxScopedProps<P> = P & { __listboxScope?: Scope };\ntype ListboxOptionScopedProps<P> = P & { __listboxOptionScope?: Scope };\n\ntype ListboxOptionProps = ThemedClassName<ComponentPropsWithRef<'li'>> & {\n value: string;\n};\n\nconst [createListboxContext, createListboxScope] = createContextScope(LISTBOX_NAME, []);\nconst [createListboxOptionContext, createListboxOptionScope] = createContextScope(LISTBOX_OPTION_NAME, [\n createListboxScope,\n]);\n\ntype ListboxContextValue = {\n selectedValue: string | undefined;\n onValueChange: (value: string) => void;\n};\n\ntype ListboxOptionContextValue = {\n value: string;\n isSelected: boolean;\n};\n\nconst [ListboxProvider, useListboxContext] = createListboxContext<ListboxContextValue>(LISTBOX_NAME);\nconst [ListboxOptionProvider, useListboxOptionContext] =\n createListboxOptionContext<ListboxOptionContextValue>(LISTBOX_OPTION_NAME);\n\n//\n// Root\n//\n\ntype ListboxRootProps = ThemedClassName<ComponentPropsWithRef<'ul'>> & {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n autoFocus?: boolean;\n};\n\n// TODO(thure): Note that this overlaps significantly with the the `SelectableListbox` story of `List.tsx` in `react-ui`,\n// making this an exemplar of `List` specifying standard `role=\"listbox\"` interactivity, though it is here because it\n// coheres with SearchList’s styles and norms. This can be promoted to `react-ui`, but doing so should involve clearing\n// the technical- and design-debt in its `List` component.\nconst ListboxRoot = forwardRef<HTMLUListElement, ListboxRootProps>(\n (props: ListboxScopedProps<ListboxRootProps>, forwardedRef) => {\n const {\n __listboxScope,\n children,\n classNames,\n value: propsValue,\n defaultValue,\n onValueChange,\n autoFocus,\n ...rootProps\n } = props;\n\n const arrowGroup = useArrowNavigationGroup({ axis: 'vertical' });\n const ref = useRef<HTMLUListElement | null>(null);\n const rootRef = useComposedRefs<HTMLUListElement>(ref, forwardedRef);\n\n const [selectedValue, setSelectedValue] = useControllableState({\n prop: propsValue,\n defaultProp: defaultValue,\n onChange: onValueChange,\n });\n\n const handleValueChange = (value: string) => {\n setSelectedValue(value);\n };\n\n useEffect(() => {\n // Autofocus the selected option on mount using querySelector\n (ref.current?.querySelector('[aria-selected=\"true\"]') as HTMLLIElement)?.focus();\n }, [autoFocus]);\n\n return (\n <ListboxProvider scope={__listboxScope} selectedValue={selectedValue} onValueChange={handleValueChange}>\n <ul\n role='listbox'\n {...rootProps}\n className={mx('w-full p-form-chrome', classNames)}\n ref={rootRef}\n {...arrowGroup}\n >\n {children}\n </ul>\n </ListboxProvider>\n );\n },\n);\n\nListboxRoot.displayName = LISTBOX_NAME;\n\n//\n// Option\n//\n\nconst ListboxOption = forwardRef<HTMLLIElement, ListboxOptionProps>(\n (props: ListboxScopedProps<ListboxOptionProps>, forwardedRef) => {\n const { __listboxScope, children, classNames, value, ...rootProps } = props;\n const { selectedValue, onValueChange } = useListboxContext(LISTBOX_OPTION_NAME, __listboxScope);\n\n const isSelected = selectedValue === value;\n\n const handleSelect = useCallback(() => {\n onValueChange(value);\n }, [value, onValueChange]);\n\n return (\n <ListboxOptionProvider scope={__listboxScope} value={value} isSelected={isSelected}>\n <li\n role='option'\n {...rootProps}\n aria-selected={isSelected}\n tabIndex={0}\n className={mx(\n 'dx-focus-ring',\n 'py-1 px-2 rounded-xs select-none cursor-pointer data-[selected=true]:bg-hover-overlay hover:bg-hover-overlay',\n commandItem,\n classNames,\n )}\n onClick={handleSelect}\n onKeyDown={({ key }) => {\n if (['Enter', ' '].includes(key)) {\n handleSelect();\n }\n }}\n ref={forwardedRef}\n >\n {children}\n </li>\n </ListboxOptionProvider>\n );\n },\n);\n\nListboxOption.displayName = LISTBOX_OPTION_NAME;\n\n//\n// OptionLabel\n//\n\nconst ListboxOptionLabel = forwardRef<HTMLDivElement, ThemedClassName<ComponentPropsWithRef<'div'>>>(\n ({ children, classNames, ...rootProps }, forwardedRef) => {\n return (\n <span {...rootProps} className={mx('grow truncate', classNames)} ref={forwardedRef}>\n {children}\n </span>\n );\n },\n);\n\nListboxOptionLabel.displayName = LISTBOX_OPTION_LABEL_NAME;\n\ntype ListboxOptionIndicatorProps = Omit<IconProps, 'icon'> & Partial<Pick<IconProps, 'icon'>>;\n\n//\n// OptionIndicator\n//\n\nconst ListboxOptionIndicator = forwardRef<SVGSVGElement, ListboxOptionIndicatorProps>(\n (props: ListboxOptionScopedProps<ListboxOptionIndicatorProps>, forwardedRef) => {\n const { __listboxOptionScope, classNames, ...rootProps } = props;\n const { isSelected } = useListboxOptionContext(LISTBOX_OPTION_INDICATOR_NAME, __listboxOptionScope);\n\n return (\n <Icon\n icon='ph--check--regular'\n {...rootProps}\n classNames={mx(!isSelected && 'invisible', classNames)}\n ref={forwardedRef}\n />\n );\n },\n);\n\nListboxOptionIndicator.displayName = LISTBOX_OPTION_INDICATOR_NAME;\n\n//\n// Listbox\n//\n\nexport const Listbox = {\n Root: ListboxRoot,\n Option: ListboxOption,\n OptionLabel: ListboxOptionLabel,\n OptionIndicator: ListboxOptionIndicator,\n};\n\nexport { createListboxScope, useListboxContext };\n\nexport type { ListboxRootProps, ListboxOptionProps, ListboxScopedProps };\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,iBAAAA,sBAAqB;AAC9B,SAASC,wBAAAA,6BAA4B;AACrC,OAAOC,UAAiCC,cAAAA,aAAYC,eAAAA,oBAAmB;AAEvE,SACEC,QAEAC,QAAAA,OACAC,eAIK;AACP,SAASC,aAAa;AACtB,SAASC,MAAAA,WAAU;;;ACdnB,SAASC,4BAA4B;AACrC,OAAOC,SAOLC,YACAC,aACAC,WACAC,SACAC,QACAC,gBACK;AAEP,SAGEC,MACAC,YAEAC,mBACAC,qBACAC,iBACAC,sBACK;AACP,SAASC,UAAU;;;ACzBZ,IAAMC,iBAAiB;AAEvB,IAAMC,eAAe;EAC1B;IACE,SAAS;MACP,CAACD,cAAAA,GAAiB;QAChB,sBAAsB;MACxB;IACF;EACF;;;;ACXF,SAASE,qBAAqB;AAmCvB,IAAM,CAACC,+BAA+BC,wBAAAA,IAC3CC,cAA0C,gBAAA;AACrC,IAAM,CAACC,gCAAgCC,yBAAAA,IAC5CF,cAA2C,iBAAA;;;AF4B7C,IAAMG,iBAAiB,CAAC,EACtBC,UACAC,OAAOC,WACPC,eAAe,IACfC,aAAa,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AI;QAAC;QAAS;QAAKC,SAASD,GAAAA,GAAM;AAChCP,qBAAAA;MACF;IACF;IACAxB,KAAKb;KAEJE,QAAAA,CAAAA;AAIT,CAAA;AAGFiC,cAAcD,cAAcjD;AAM5B,IAAM6D,qBAAqBhD,gBAAAA,YACzB,CAAC,EAAEI,UAAUC,YAAY,GAAGM,UAAAA,GAAaT,iBAAAA;AACvC,SACE,gBAAA4B,OAAA,cAACmB,QAAAA;IAAM,GAAGtC;IAAWuB,WAAWC,IAAG,iBAAiB9B,UAAAA;IAAaU,KAAKb;KACnEE,QAAAA;AAGP,CAAA;AAGF4C,mBAAmBZ,cAAchD;AAQjC,IAAM8D,yBAAyBlD,gBAAAA,YAC7B,CAACC,OAA8DC,iBAAAA;AAC7D,QAAM,EAAEiD,sBAAsB9C,YAAY,GAAGM,UAAAA,IAAcV;AAC3D,QAAM,EAAEqC,WAAU,IAAKxC,wBAAwBT,+BAA+B8D,oBAAAA;AAE9E,SACE,gBAAArB,OAAA,cAACsB,OAAAA;IACCC,MAAK;IACJ,GAAG1C;IACJN,YAAY8B,IAAG,CAACG,cAAc,aAAajC,UAAAA;IAC3CU,KAAKb;;AAGX,CAAA;AAGFgD,uBAAuBd,cAAc/C;AAM9B,IAAMiE,UAAU;EACrBC,MAAMxD;EACNyD,QAAQnB;EACRoB,aAAaT;EACbU,iBAAiBR;AACnB;",
|
|
6
|
+
"names": ["createContext", "useControllableState", "React", "forwardRef", "useCallback", "Button", "Icon", "Popover", "useId", "mx", "useControllableState", "React", "forwardRef", "useCallback", "useEffect", "useMemo", "useRef", "useState", "Icon", "ScrollArea", "useDensityContext", "useElevationContext", "useThemeContext", "useTranslation", "mx", "translationKey", "translations", "createContext", "SearchListItemContextProvider", "useSearchListItemContext", "createContext", "SearchListInputContextProvider", "useSearchListInputContext", "SearchListRoot", "children", "value", "valueProp", "defaultValue", "debounceMs", "onSearch", "query", "setQuery", "useControllableState", "prop", "defaultProp", "onChange", "undefined", "selectedValue", "setSelectedValue", "useState", "itemsRef", "useRef", "Map", "debounceRef", "handleQueryChange", "useCallback", "newQuery", "current", "clearTimeout", "setTimeout", "itemVersion", "setItemVersion", "useEffect", "currentItem", "get", "isSelectionValid", "disabled", "size", "entries", "Array", "from", "filter", "data", "length", "sort", "a", "b", "position", "element", "compareDocumentPosition", "Node", "DOCUMENT_POSITION_FOLLOWING", "DOCUMENT_POSITION_PRECEDING", "firstValue", "registerItem", "onSelect", "set", "v", "unregisterItem", "delete", "getItemValues", "map", "triggerSelect", "item", "itemContextValue", "useMemo", "onSelectedValueChange", "inputContextValue", "onQueryChange", "SearchListInputContextProvider", "SearchListItemContextProvider", "displayName", "SearchListContent", "forwardRef", "classNames", "props", "forwardedRef", "div", "role", "className", "mx", "ref", "SearchListInput", "density", "propsDensity", "elevation", "propsElevation", "variant", "placeholder", "useSearchListInputContext", "t", "useTranslation", "translationKey", "hasIosKeyboard", "tx", "useThemeContext", "useDensityContext", "useElevationContext", "defaultPlaceholder", "handleChange", "event", "target", "handleKeyDown", "values", "key", "currentIndex", "indexOf", "preventDefault", "nextIndex", "Math", "min", "nextValue", "prevIndex", "max", "prevValue", "lastValue", "input", "autoFocus", "type", "onKeyDown", "SearchListViewport", "ScrollArea", "Root", "thin", "Viewport", "SearchListItem", "label", "icon", "iconClassNames", "checked", "suffix", "useSearchListItemContext", "internalRef", "isSelected", "scrollIntoView", "block", "behavior", "handleClick", "node", "aria-selected", "aria-disabled", "data-selected", "data-disabled", "data-value", "tabIndex", "onClick", "Icon", "span", "SearchListEmpty", "SearchListGroup", "heading", "SearchList", "Content", "Input", "Item", "Empty", "Group", "React", "createContext", "useContext", "useMemo", "GlobalFilterContext", "createContext", "GlobalFilterProvider", "children", "filter", "value", "useMemo", "React", "Provider", "useGlobalFilter", "useContext", "useGlobalFilteredObjects", "objects", "useSearchListInput", "query", "onQueryChange", "selectedValue", "onSelectedValueChange", "getItemValues", "triggerSelect", "useSearchListInputContext", "useSearchListItem", "selectedValue", "registerItem", "unregisterItem", "useSearchListItemContext", "commandScore", "useCallback", "useEffect", "useMemo", "useRef", "useState", "useSearchListResults", "items", "filter", "fuzzy", "extract", "minScore", "query", "setQuery", "useState", "queryRef", "useRef", "useEffect", "current", "defaultExtract", "useCallback", "item", "label", "extractFn", "defaultFilter", "searchable", "toLowerCase", "includes", "filterFn", "handleSearch", "searchQuery", "results", "useMemo", "currentQuery", "scored", "map", "score", "commandScore", "sort", "a", "b", "COMBOBOX_NAME", "COMBOBOX_CONTENT_NAME", "COMBOBOX_ITEM_NAME", "COMBOBOX_TRIGGER_NAME", "ComboboxProvider", "useComboboxContext", "createContext", "ComboboxRoot", "modal", "modalId", "propsModalId", "open", "propsOpen", "defaultOpen", "onOpenChange", "propsOnOpenChange", "value", "propsValue", "defaultValue", "onValueChange", "propsOnValueChange", "placeholder", "children", "useId", "useControllableState", "prop", "onChange", "defaultProp", "React", "Popover", "Root", "isCombobox", "ComboboxContent", "forwardRef", "side", "collisionPadding", "sideOffset", "align", "alignOffset", "avoidCollisions", "collisionBoundary", "arrowPadding", "sticky", "hideWhenDetached", "onOpenAutoFocus", "onCloseAutoFocus", "onEscapeKeyDown", "onPointerDownOutside", "onFocusOutside", "onInteractOutside", "forceMount", "classNames", "onSearch", "debounceMs", "label", "forwardedRef", "Content", "id", "ref", "SearchList", "displayName", "ComboboxTrigger", "onClick", "props", "handleClick", "useCallback", "event", "Trigger", "asChild", "Button", "role", "aria-expanded", "aria-controls", "aria-haspopup", "span", "className", "mx", "Icon", "icon", "size", "ComboboxVirtualTrigger", "VirtualTrigger", "ComboboxInput", "Input", "ComboboxList", "Viewport", "ComboboxItem", "onSelect", "closeOnSelect", "handleSelect", "undefined", "Item", "ComboboxArrow", "Arrow", "ComboboxEmpty", "Empty", "ComboboxPortal", "Portal", "Combobox", "List", "useArrowNavigationGroup", "useComposedRefs", "createContextScope", "useControllableState", "React", "forwardRef", "useCallback", "useEffect", "useRef", "Icon", "mx", "commandItem", "LISTBOX_NAME", "LISTBOX_OPTION_NAME", "LISTBOX_OPTION_LABEL_NAME", "LISTBOX_OPTION_INDICATOR_NAME", "createListboxContext", "createListboxScope", "createContextScope", "createListboxOptionContext", "createListboxOptionScope", "ListboxProvider", "useListboxContext", "ListboxOptionProvider", "useListboxOptionContext", "ListboxRoot", "forwardRef", "props", "forwardedRef", "__listboxScope", "children", "classNames", "value", "propsValue", "defaultValue", "onValueChange", "autoFocus", "rootProps", "arrowGroup", "useArrowNavigationGroup", "axis", "ref", "useRef", "rootRef", "useComposedRefs", "selectedValue", "setSelectedValue", "useControllableState", "prop", "defaultProp", "onChange", "handleValueChange", "useEffect", "current", "querySelector", "focus", "React", "scope", "ul", "role", "className", "mx", "displayName", "ListboxOption", "isSelected", "handleSelect", "useCallback", "li", "aria-selected", "tabIndex", "onClick", "onKeyDown", "key", "includes", "ListboxOptionLabel", "span", "ListboxOptionIndicator", "__listboxOptionScope", "Icon", "icon", "Listbox", "Root", "Option", "OptionLabel", "OptionIndicator"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/translations.ts":{"bytes":1226,"imports":[],"format":"esm"},"src/components/SearchList/context.ts":{"bytes":3162,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true}],"format":"esm"},"src/components/SearchList/SearchList.tsx":{"bytes":
|
|
1
|
+
{"inputs":{"src/translations.ts":{"bytes":1226,"imports":[],"format":"esm"},"src/components/SearchList/context.ts":{"bytes":3162,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true}],"format":"esm"},"src/components/SearchList/SearchList.tsx":{"bytes":49632,"imports":[{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"src/translations.ts","kind":"import-statement","original":"../../translations"},{"path":"src/components/SearchList/context.ts","kind":"import-statement","original":"./context"}],"format":"esm"},"src/components/SearchList/hooks/useGlobalFilter.tsx":{"bytes":5067,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/components/SearchList/hooks/useSearchListInput.ts":{"bytes":2012,"imports":[{"path":"src/components/SearchList/context.ts","kind":"import-statement","original":"../context"}],"format":"esm"},"src/components/SearchList/hooks/useSearchListItem.ts":{"bytes":1753,"imports":[{"path":"src/components/SearchList/context.ts","kind":"import-statement","original":"../context"}],"format":"esm"},"src/components/SearchList/hooks/useSearchListResults.ts":{"bytes":9665,"imports":[{"path":"command-score","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/components/SearchList/hooks/index.ts":{"bytes":852,"imports":[{"path":"src/components/SearchList/hooks/useGlobalFilter.tsx","kind":"import-statement","original":"./useGlobalFilter"},{"path":"src/components/SearchList/hooks/useSearchListInput.ts","kind":"import-statement","original":"./useSearchListInput"},{"path":"src/components/SearchList/hooks/useSearchListItem.ts","kind":"import-statement","original":"./useSearchListItem"},{"path":"src/components/SearchList/hooks/useSearchListResults.ts","kind":"import-statement","original":"./useSearchListResults"}],"format":"esm"},"src/components/SearchList/index.ts":{"bytes":567,"imports":[{"path":"src/components/SearchList/SearchList.tsx","kind":"import-statement","original":"./SearchList"},{"path":"src/components/SearchList/hooks/index.ts","kind":"import-statement","original":"./hooks"}],"format":"esm"},"src/components/Combobox/Combobox.tsx":{"bytes":24183,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"src/components/SearchList/index.ts","kind":"import-statement","original":"../SearchList"}],"format":"esm"},"src/components/Combobox/index.ts":{"bytes":478,"imports":[{"path":"src/components/Combobox/Combobox.tsx","kind":"import-statement","original":"./Combobox"}],"format":"esm"},"src/components/Listbox/Listbox.tsx":{"bytes":19292,"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@radix-ui/react-compose-refs","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"format":"esm"},"src/components/Listbox/index.ts":{"bytes":476,"imports":[{"path":"src/components/Listbox/Listbox.tsx","kind":"import-statement","original":"./Listbox"}],"format":"esm"},"src/components/index.ts":{"bytes":650,"imports":[{"path":"src/components/Combobox/index.ts","kind":"import-statement","original":"./Combobox"},{"path":"src/components/Listbox/index.ts","kind":"import-statement","original":"./Listbox"},{"path":"src/components/SearchList/index.ts","kind":"import-statement","original":"./SearchList"}],"format":"esm"},"src/index.ts":{"bytes":564,"imports":[{"path":"src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":61736},"dist/lib/browser/index.mjs":{"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"command-score","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@radix-ui/react-compose-refs","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/ui-theme","kind":"import-statement","external":true}],"exports":["Combobox","GlobalFilterProvider","Listbox","SearchList","createListboxScope","translationKey","translations","useGlobalFilter","useGlobalFilteredObjects","useListboxContext","useSearchListInput","useSearchListItem","useSearchListResults"],"entryPoint":"src/index.ts","inputs":{"src/components/Combobox/Combobox.tsx":{"bytesInOutput":5729},"src/components/SearchList/SearchList.tsx":{"bytesInOutput":11488},"src/translations.ts":{"bytesInOutput":179},"src/components/SearchList/context.ts":{"bytesInOutput":254},"src/components/SearchList/hooks/useGlobalFilter.tsx":{"bytesInOutput":737},"src/components/SearchList/hooks/useSearchListInput.ts":{"bytesInOutput":317},"src/components/SearchList/hooks/useSearchListItem.ts":{"bytesInOutput":212},"src/components/SearchList/hooks/useSearchListResults.ts":{"bytesInOutput":1614},"src/components/Listbox/Listbox.tsx":{"bytesInOutput":4361},"src/index.ts":{"bytesInOutput":0}},"bytes":25695}}}
|