@dxos/react-ui-searchlist 0.7.2 → 0.7.3-staging.971cd8d

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.
@@ -0,0 +1,267 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var node_exports = {};
30
+ __export(node_exports, {
31
+ Combobox: () => Combobox,
32
+ PopoverCombobox: () => PopoverCombobox,
33
+ SearchList: () => SearchList,
34
+ translations: () => translations_default
35
+ });
36
+ module.exports = __toCommonJS(node_exports);
37
+ var import_react = require("@phosphor-icons/react");
38
+ var import_react_context = require("@radix-ui/react-context");
39
+ var import_react_use_controllable_state = require("@radix-ui/react-use-controllable-state");
40
+ var import_cmdk = require("cmdk");
41
+ var import_react2 = __toESM(require("react"));
42
+ var import_react_ui = require("@dxos/react-ui");
43
+ var import_react_ui_theme = require("@dxos/react-ui-theme");
44
+ var import_react_use_controllable_state2 = require("@radix-ui/react-use-controllable-state");
45
+ var import_react3 = __toESM(require("react"));
46
+ var import_react_ui2 = require("@dxos/react-ui");
47
+ var COMBOBOX_NAME = "Combobox";
48
+ var COMBOBOX_TRIGGER_NAME = "ComboboxTrigger";
49
+ var SEARCHLIST_NAME = "SearchList";
50
+ var SEARCHLIST_ITEM_NAME = "SearchListItem";
51
+ var [ComboboxProvider, useComboboxContext] = (0, import_react_context.createContext)(COMBOBOX_NAME, {});
52
+ var SearchListRoot = /* @__PURE__ */ (0, import_react2.forwardRef)(({ children, classNames, ...props }, forwardedRef) => {
53
+ return /* @__PURE__ */ import_react2.default.createElement(import_cmdk.CommandRoot, {
54
+ ...props,
55
+ className: (0, import_react_ui_theme.mx)("", classNames),
56
+ ref: forwardedRef
57
+ }, children);
58
+ });
59
+ SearchListRoot.displayName = SEARCHLIST_NAME;
60
+ var SearchListInput = /* @__PURE__ */ (0, import_react2.forwardRef)(({ children, classNames, density: propsDensity, elevation: propsElevation, variant = "subdued", ...props }, forwardedRef) => {
61
+ const { hasIosKeyboard } = (0, import_react_ui.useThemeContext)();
62
+ const { tx } = (0, import_react_ui.useThemeContext)();
63
+ const density = (0, import_react_ui.useDensityContext)(propsDensity);
64
+ const elevation = (0, import_react_ui.useElevationContext)(propsElevation);
65
+ return /* @__PURE__ */ import_react2.default.createElement(import_cmdk.CommandInput, {
66
+ ...props,
67
+ className: tx("input.input", "input", {
68
+ variant,
69
+ disabled: props.disabled,
70
+ density,
71
+ elevation
72
+ }, classNames),
73
+ ...props.autoFocus && !hasIosKeyboard && {
74
+ autoFocus: true
75
+ },
76
+ ref: forwardedRef
77
+ });
78
+ });
79
+ var SearchListContent = /* @__PURE__ */ (0, import_react2.forwardRef)(({ children, classNames, ...props }, forwardedRef) => {
80
+ return /* @__PURE__ */ import_react2.default.createElement(import_cmdk.CommandList, {
81
+ ...props,
82
+ className: (0, import_react_ui_theme.mx)(classNames),
83
+ ref: forwardedRef
84
+ }, children);
85
+ });
86
+ var SearchListEmpty = /* @__PURE__ */ (0, import_react2.forwardRef)(({ children, classNames, ...props }, forwardedRef) => {
87
+ return /* @__PURE__ */ import_react2.default.createElement(import_cmdk.CommandEmpty, {
88
+ ...props,
89
+ className: (0, import_react_ui_theme.mx)(classNames),
90
+ ref: forwardedRef
91
+ }, children);
92
+ });
93
+ var SearchListItem = /* @__PURE__ */ (0, import_react2.forwardRef)(({ children, classNames, onSelect, ...props }, forwardedRef) => {
94
+ const { onValueChange, onOpenChange } = useComboboxContext(SEARCHLIST_ITEM_NAME);
95
+ const handleSelect = (0, import_react2.useCallback)((nextValue) => {
96
+ onValueChange?.(nextValue);
97
+ onOpenChange?.(false);
98
+ onSelect?.(nextValue);
99
+ }, [
100
+ onValueChange,
101
+ onOpenChange,
102
+ onSelect
103
+ ]);
104
+ return /* @__PURE__ */ import_react2.default.createElement(import_cmdk.CommandItem, {
105
+ ...props,
106
+ onSelect: handleSelect,
107
+ className: (0, import_react_ui_theme.mx)("p-1 rounded select-none cursor-pointer data-[selected]:bg-hoverOverlay", classNames),
108
+ ref: forwardedRef
109
+ }, children);
110
+ });
111
+ SearchListItem.displayName = SEARCHLIST_ITEM_NAME;
112
+ var ComboboxRoot = ({ modalId: propsModalId, open: propsOpen, defaultOpen, onOpenChange: propsOnOpenChange, value: propsValue, defaultValue, onValueChange: propsOnValueChange, placeholder, children }) => {
113
+ const modalId = (0, import_react_ui.useId)(COMBOBOX_NAME, propsModalId);
114
+ const [open = false, onOpenChange] = (0, import_react_use_controllable_state.useControllableState)({
115
+ prop: propsOpen,
116
+ onChange: propsOnOpenChange,
117
+ defaultProp: defaultOpen
118
+ });
119
+ const [value = "", onValueChange] = (0, import_react_use_controllable_state.useControllableState)({
120
+ prop: propsValue,
121
+ onChange: propsOnValueChange,
122
+ defaultProp: defaultValue
123
+ });
124
+ return /* @__PURE__ */ import_react2.default.createElement(ComboboxProvider, {
125
+ isCombobox: true,
126
+ modalId,
127
+ open,
128
+ onOpenChange,
129
+ value,
130
+ onValueChange,
131
+ placeholder
132
+ }, children);
133
+ };
134
+ ComboboxRoot.displayName = COMBOBOX_NAME;
135
+ var ComboboxTrigger = /* @__PURE__ */ (0, import_react2.forwardRef)(({ children, onClick, ...props }, forwardedRef) => {
136
+ const { modalId, open, onOpenChange, placeholder, value } = useComboboxContext(COMBOBOX_TRIGGER_NAME);
137
+ const handleClick = (0, import_react2.useCallback)((event) => {
138
+ onClick?.(event);
139
+ onOpenChange?.(true);
140
+ }, [
141
+ onClick,
142
+ onOpenChange
143
+ ]);
144
+ return /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Button, {
145
+ ...props,
146
+ role: "combobox",
147
+ "aria-expanded": open,
148
+ "aria-controls": modalId,
149
+ "aria-haspopup": "dialog",
150
+ onClick: handleClick,
151
+ ref: forwardedRef
152
+ }, children ?? /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement("span", {
153
+ className: (0, import_react_ui_theme.mx)("font-normal text-start flex-1 min-is-0 truncate mie-2", !value && import_react_ui_theme.staticPlaceholderText)
154
+ }, value || placeholder), /* @__PURE__ */ import_react2.default.createElement(import_react.CaretDown, {
155
+ weight: "bold",
156
+ className: (0, import_react_ui_theme.getSize)(3)
157
+ })));
158
+ });
159
+ ComboboxTrigger.displayName = COMBOBOX_TRIGGER_NAME;
160
+ var SearchList = {
161
+ Root: SearchListRoot,
162
+ Input: SearchListInput,
163
+ Content: SearchListContent,
164
+ Empty: SearchListEmpty,
165
+ Item: SearchListItem
166
+ };
167
+ var Combobox = {
168
+ Root: ComboboxRoot,
169
+ Trigger: ComboboxTrigger,
170
+ useComboboxContext
171
+ };
172
+ var PopoverComboboxRoot = ({ modal, children, open: propsOpen, onOpenChange: propsOnOpenChange, defaultOpen, ...props }) => {
173
+ const [open, onOpenChange] = (0, import_react_use_controllable_state2.useControllableState)({
174
+ prop: propsOpen,
175
+ onChange: propsOnOpenChange,
176
+ defaultProp: defaultOpen
177
+ });
178
+ return /* @__PURE__ */ import_react3.default.createElement(Combobox.Root, {
179
+ open,
180
+ onOpenChange,
181
+ ...props
182
+ }, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Popover.Root, {
183
+ open,
184
+ onOpenChange,
185
+ modal
186
+ }, children));
187
+ };
188
+ var POPOVER_COMBOBOX_CONTENT_NAME = "PopoverComboboxContent";
189
+ var PopoverComboboxContent = /* @__PURE__ */ (0, import_react3.forwardRef)(({ side = "bottom", collisionPadding = 48, sideOffset, align, alignOffset, avoidCollisions, collisionBoundary, arrowPadding, sticky, hideWhenDetached, onOpenAutoFocus, onCloseAutoFocus, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, forceMount, children, classNames, ...props }, forwardedRef) => {
190
+ const { modalId } = Combobox.useComboboxContext(POPOVER_COMBOBOX_CONTENT_NAME);
191
+ return /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Popover.Content, {
192
+ side,
193
+ sideOffset,
194
+ align,
195
+ alignOffset,
196
+ avoidCollisions,
197
+ collisionBoundary,
198
+ collisionPadding,
199
+ arrowPadding,
200
+ sticky,
201
+ hideWhenDetached,
202
+ onOpenAutoFocus,
203
+ onCloseAutoFocus,
204
+ onEscapeKeyDown,
205
+ onPointerDownOutside,
206
+ onFocusOutside,
207
+ onInteractOutside,
208
+ forceMount,
209
+ classNames,
210
+ id: modalId,
211
+ ref: forwardedRef
212
+ }, /* @__PURE__ */ import_react3.default.createElement(SearchList.Root, {
213
+ ...props,
214
+ classNames: "contents",
215
+ role: "none"
216
+ }, children));
217
+ });
218
+ PopoverComboboxContent.displayName = POPOVER_COMBOBOX_CONTENT_NAME;
219
+ var PopoverComboboxTrigger = /* @__PURE__ */ (0, import_react3.forwardRef)((props, forwardedRef) => {
220
+ return /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Popover.Trigger, {
221
+ asChild: true
222
+ }, /* @__PURE__ */ import_react3.default.createElement(Combobox.Trigger, {
223
+ ...props,
224
+ ref: forwardedRef
225
+ }));
226
+ });
227
+ var PopoverComboboxVirtualTrigger = import_react_ui2.Popover.VirtualTrigger;
228
+ var PopoverComboboxInput = SearchList.Input;
229
+ var PopoverComboboxList = /* @__PURE__ */ (0, import_react3.forwardRef)(({ constrainInline, constrainBlock, ...props }, forwardedRef) => {
230
+ return /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Popover.Viewport, {
231
+ constrainInline,
232
+ constrainBlock
233
+ }, /* @__PURE__ */ import_react3.default.createElement(SearchList.Content, {
234
+ ...props,
235
+ ref: forwardedRef
236
+ }));
237
+ });
238
+ var PopoverComboboxItem = SearchList.Item;
239
+ var PopoverComboboxArrow = import_react_ui2.Popover.Arrow;
240
+ var PopoverComboboxEmpty = SearchList.Empty;
241
+ var PopoverCombobox = {
242
+ Root: PopoverComboboxRoot,
243
+ Content: PopoverComboboxContent,
244
+ Trigger: PopoverComboboxTrigger,
245
+ VirtualTrigger: PopoverComboboxVirtualTrigger,
246
+ Input: PopoverComboboxInput,
247
+ List: PopoverComboboxList,
248
+ Item: PopoverComboboxItem,
249
+ Arrow: PopoverComboboxArrow,
250
+ Empty: PopoverComboboxEmpty
251
+ };
252
+ var translationKey = "searchlist";
253
+ var translations_default = [
254
+ {
255
+ "en-US": {
256
+ [translationKey]: {}
257
+ }
258
+ }
259
+ ];
260
+ // Annotate the CommonJS export names for ESM import in node:
261
+ 0 && (module.exports = {
262
+ Combobox,
263
+ PopoverCombobox,
264
+ SearchList,
265
+ translations
266
+ });
267
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/SearchList.tsx", "../../../src/composites/PopoverCombobox.tsx", "../../../src/translations.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { CaretDown } from '@phosphor-icons/react';\nimport { createContext } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { CommandEmpty, CommandInput, CommandItem, CommandList, CommandRoot } from 'cmdk';\nimport React, { type ComponentPropsWithRef, forwardRef, type PropsWithChildren, useCallback } from 'react';\n\nimport {\n Button,\n type ButtonProps,\n type TextInputProps,\n type ThemedClassName,\n useDensityContext,\n useElevationContext,\n useId,\n useThemeContext,\n} from '@dxos/react-ui';\nimport { getSize, mx, staticPlaceholderText } from '@dxos/react-ui-theme';\n\ntype SearchListVariant = 'list' | 'menu' | 'listbox';\n\ntype SearchListRootProps = ThemedClassName<ComponentPropsWithRef<typeof CommandRoot>> & {\n variant?: SearchListVariant;\n};\n\ntype ComboboxContextValue = {\n isCombobox: true;\n modalId: string;\n open: boolean;\n onOpenChange: (nextOpen: boolean) => void;\n value: string;\n onValueChange: (nextValue: string) => void;\n placeholder?: string;\n};\n\nconst COMBOBOX_NAME = 'Combobox';\nconst COMBOBOX_TRIGGER_NAME = 'ComboboxTrigger';\nconst SEARCHLIST_NAME = 'SearchList';\nconst SEARCHLIST_ITEM_NAME = 'SearchListItem';\n\nconst [ComboboxProvider, useComboboxContext] = createContext<Partial<ComboboxContextValue>>(COMBOBOX_NAME, {});\n\ntype ComboboxRootProps = PropsWithChildren<\n Partial<ComboboxContextValue & { defaultOpen: boolean; defaultValue: string; placeholder: string }>\n>;\n\nconst SearchListRoot = forwardRef<HTMLDivElement, SearchListRootProps>(\n ({ children, classNames, ...props }, forwardedRef) => {\n return (\n <CommandRoot {...props} className={mx('', classNames)} ref={forwardedRef}>\n {children}\n </CommandRoot>\n );\n },\n);\n\nSearchListRoot.displayName = SEARCHLIST_NAME;\n\ntype CommandInputPrimitiveProps = ComponentPropsWithRef<typeof CommandInput>;\n\n// TODO: Harmonize with other inputs’ `onChange` prop.\ntype SearchListInputProps = Omit<TextInputProps, 'value' | 'defaultValue' | 'onChange'> &\n Pick<CommandInputPrimitiveProps, 'value' | 'onValueChange' | 'defaultValue'>;\n\nconst SearchListInput = forwardRef<HTMLInputElement, SearchListInputProps>(\n (\n { children, classNames, density: propsDensity, elevation: propsElevation, variant = 'subdued', ...props },\n forwardedRef,\n ) => {\n // CHORE(thure): Keep this in-sync with `TextInput`, or submit a PR for `cmdk` to support `asChild` so we don’t have to.\n const { hasIosKeyboard } = useThemeContext();\n const { tx } = useThemeContext();\n const density = useDensityContext(propsDensity);\n const elevation = useElevationContext(propsElevation);\n\n return (\n <CommandInput\n {...props}\n className={tx(\n 'input.input',\n 'input',\n {\n variant,\n disabled: props.disabled,\n density,\n elevation,\n },\n classNames,\n )}\n {...(props.autoFocus && !hasIosKeyboard && { autoFocus: true })}\n ref={forwardedRef}\n />\n );\n },\n);\n\ntype SearchListContentProps = ThemedClassName<ComponentPropsWithRef<typeof CommandList>>;\n\nconst SearchListContent = forwardRef<HTMLDivElement, SearchListContentProps>(\n ({ children, classNames, ...props }, forwardedRef) => {\n return (\n <CommandList {...props} className={mx(classNames)} ref={forwardedRef}>\n {children}\n </CommandList>\n );\n },\n);\n\ntype SearchListEmptyProps = ThemedClassName<ComponentPropsWithRef<typeof CommandEmpty>>;\n\nconst SearchListEmpty = forwardRef<HTMLDivElement, SearchListEmptyProps>(\n ({ children, classNames, ...props }, forwardedRef) => {\n return (\n <CommandEmpty {...props} className={mx(classNames)} ref={forwardedRef}>\n {children}\n </CommandEmpty>\n );\n },\n);\n\ntype SearchListItemProps = ThemedClassName<ComponentPropsWithRef<typeof CommandItem>>;\n\nconst SearchListItem = forwardRef<HTMLDivElement, SearchListItemProps>(\n ({ children, classNames, onSelect, ...props }, forwardedRef) => {\n const { onValueChange, onOpenChange } = useComboboxContext(SEARCHLIST_ITEM_NAME);\n const handleSelect = useCallback(\n (nextValue: string) => {\n onValueChange?.(nextValue);\n onOpenChange?.(false);\n onSelect?.(nextValue);\n },\n [onValueChange, onOpenChange, onSelect],\n );\n return (\n <CommandItem\n {...props}\n onSelect={handleSelect}\n className={mx('p-1 rounded select-none cursor-pointer data-[selected]:bg-hoverOverlay', classNames)}\n ref={forwardedRef}\n >\n {children}\n </CommandItem>\n );\n },\n);\n\nSearchListItem.displayName = SEARCHLIST_ITEM_NAME;\n\nconst ComboboxRoot = ({\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 return (\n <ComboboxProvider\n isCombobox\n modalId={modalId}\n open={open}\n onOpenChange={onOpenChange}\n value={value}\n onValueChange={onValueChange}\n placeholder={placeholder}\n >\n {children}\n </ComboboxProvider>\n );\n};\n\nComboboxRoot.displayName = COMBOBOX_NAME;\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 return (\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 <CaretDown weight='bold' className={getSize(3)} />\n </>\n )}\n </Button>\n );\n },\n);\n\nComboboxTrigger.displayName = COMBOBOX_TRIGGER_NAME;\n\nexport const SearchList = {\n Root: SearchListRoot,\n Input: SearchListInput,\n Content: SearchListContent,\n Empty: SearchListEmpty,\n Item: SearchListItem,\n};\n\nexport const Combobox = {\n Root: ComboboxRoot,\n Trigger: ComboboxTrigger,\n useComboboxContext,\n};\n\nexport type {\n SearchListRootProps,\n SearchListInputProps,\n SearchListContentProps,\n SearchListEmptyProps,\n SearchListItemProps,\n ComboboxRootProps,\n ComboboxTriggerProps,\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, { forwardRef } from 'react';\n\nimport {\n Popover,\n type PopoverArrowProps,\n type PopoverContentProps,\n type PopoverViewportProps,\n type PopoverVirtualTriggerProps,\n} from '@dxos/react-ui';\n\nimport {\n Combobox,\n type ComboboxRootProps,\n type ComboboxTriggerProps,\n SearchList,\n type SearchListContentProps,\n type SearchListEmptyProps,\n type SearchListInputProps,\n type SearchListItemProps,\n type SearchListRootProps,\n} from '../components';\n\ntype PopoverComboboxRootProps = ComboboxRootProps & { modal?: boolean };\n\nconst PopoverComboboxRoot = ({\n modal,\n children,\n open: propsOpen,\n onOpenChange: propsOnOpenChange,\n defaultOpen,\n ...props\n}: PopoverComboboxRootProps) => {\n const [open, onOpenChange] = useControllableState({\n prop: propsOpen,\n onChange: propsOnOpenChange,\n defaultProp: defaultOpen,\n });\n return (\n <Combobox.Root open={open} onOpenChange={onOpenChange} {...props}>\n <Popover.Root open={open} onOpenChange={onOpenChange} modal={modal}>\n {children}\n </Popover.Root>\n </Combobox.Root>\n );\n};\n\ntype PopoverComboboxContentProps = SearchListRootProps & PopoverContentProps;\n\nconst POPOVER_COMBOBOX_CONTENT_NAME = 'PopoverComboboxContent';\n\nconst PopoverComboboxContent = forwardRef<HTMLDivElement, PopoverComboboxContentProps>(\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 ...props\n },\n forwardedRef,\n ) => {\n const { modalId } = Combobox.useComboboxContext(POPOVER_COMBOBOX_CONTENT_NAME);\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 classNames,\n }}\n id={modalId}\n ref={forwardedRef}\n >\n {/* TODO(thure): This skips over `Command`’s root component, which renders a DOM node probably unnecessarily without supporting `asChild`. */}\n <SearchList.Root {...props} classNames='contents' role='none'>\n {children}\n </SearchList.Root>\n </Popover.Content>\n );\n },\n);\n\nPopoverComboboxContent.displayName = POPOVER_COMBOBOX_CONTENT_NAME;\n\ntype PopoverComboboxTriggerProps = ComboboxTriggerProps;\n\nconst PopoverComboboxTrigger = forwardRef<HTMLButtonElement, PopoverComboboxTriggerProps>((props, forwardedRef) => {\n return (\n <Popover.Trigger asChild>\n <Combobox.Trigger {...props} ref={forwardedRef} />\n </Popover.Trigger>\n );\n});\n\ntype PopoverComboboxVirtualTriggerProps = PopoverVirtualTriggerProps;\n\nconst PopoverComboboxVirtualTrigger = Popover.VirtualTrigger;\n\ntype PopoverComboboxInputProps = SearchListInputProps;\n\nconst PopoverComboboxInput = SearchList.Input;\n\ntype PopoverComboboxListProps = SearchListContentProps &\n Pick<PopoverViewportProps, 'constrainBlock' | 'constrainInline'>;\n\nconst PopoverComboboxList = forwardRef<HTMLDivElement, PopoverComboboxListProps>(\n ({ constrainInline, constrainBlock, ...props }, forwardedRef) => {\n return (\n <Popover.Viewport {...{ constrainInline, constrainBlock }}>\n <SearchList.Content {...props} ref={forwardedRef} />\n </Popover.Viewport>\n );\n },\n);\n\ntype PopoverComboboxItemProps = SearchListItemProps;\n\nconst PopoverComboboxItem = SearchList.Item;\n\ntype PopoverComboboxArrowProps = PopoverArrowProps;\n\nconst PopoverComboboxArrow = Popover.Arrow;\n\ntype PopoverComboboxEmptyProps = SearchListEmptyProps;\n\nconst PopoverComboboxEmpty = SearchList.Empty;\n\nexport const PopoverCombobox = {\n Root: PopoverComboboxRoot,\n Content: PopoverComboboxContent,\n Trigger: PopoverComboboxTrigger,\n VirtualTrigger: PopoverComboboxVirtualTrigger,\n Input: PopoverComboboxInput,\n List: PopoverComboboxList,\n Item: PopoverComboboxItem,\n Arrow: PopoverComboboxArrow,\n Empty: PopoverComboboxEmpty,\n};\n\nexport type {\n PopoverComboboxRootProps,\n PopoverComboboxContentProps,\n PopoverComboboxTriggerProps,\n PopoverComboboxVirtualTriggerProps,\n PopoverComboboxInputProps,\n PopoverComboboxListProps,\n PopoverComboboxItemProps,\n PopoverComboboxArrowProps,\n PopoverComboboxEmptyProps,\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport const translationKey = 'searchlist';\n\nexport default [\n {\n 'en-US': {\n [translationKey]: {},\n },\n },\n];\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAA0B;AAC1B,2BAA8B;AAC9B,0CAAqC;AACrC,kBAAkF;AAClF,IAAAA,gBAAmG;AAEnG,sBASO;AACP,4BAAmD;AChBnD,IAAAC,uCAAqC;AACrC,IAAAD,gBAAkC;AAElC,IAAAE,mBAMO;ADyBP,IAAMC,gBAAgB;AACtB,IAAMC,wBAAwB;AAC9B,IAAMC,kBAAkB;AACxB,IAAMC,uBAAuB;AAE7B,IAAM,CAACC,kBAAkBC,kBAAAA,QAAsBC,oCAA6CN,eAAe,CAAC,CAAA;AAM5G,IAAMO,iBAAiBC,8CACrB,CAAC,EAAEC,UAAUC,YAAY,GAAGC,MAAAA,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AAS;MACP,CAACA,cAAAA,GAAiB,CAAC;IACrB;EACF;;",
6
+ "names": ["import_react", "import_react_use_controllable_state", "import_react_ui", "COMBOBOX_NAME", "COMBOBOX_TRIGGER_NAME", "SEARCHLIST_NAME", "SEARCHLIST_ITEM_NAME", "ComboboxProvider", "useComboboxContext", "createContext", "SearchListRoot", "forwardRef", "children", "classNames", "props", "forwardedRef", "React", "CommandRoot", "className", "mx", "ref", "displayName", "SearchListInput", "density", "propsDensity", "elevation", "propsElevation", "variant", "hasIosKeyboard", "useThemeContext", "tx", "useDensityContext", "useElevationContext", "CommandInput", "disabled", "autoFocus", "SearchListContent", "CommandList", "SearchListEmpty", "CommandEmpty", "SearchListItem", "onSelect", "onValueChange", "onOpenChange", "handleSelect", "useCallback", "nextValue", "CommandItem", "ComboboxRoot", "modalId", "propsModalId", "open", "propsOpen", "defaultOpen", "propsOnOpenChange", "value", "propsValue", "defaultValue", "propsOnValueChange", "placeholder", "useId", "useControllableState", "prop", "onChange", "defaultProp", "isCombobox", "ComboboxTrigger", "onClick", "handleClick", "event", "Button", "role", "aria-expanded", "aria-controls", "aria-haspopup", "span", "staticPlaceholderText", "CaretDown", "weight", "getSize", "SearchList", "Root", "Input", "Content", "Empty", "Item", "Combobox", "Trigger", "PopoverComboboxRoot", "modal", "Popover", "POPOVER_COMBOBOX_CONTENT_NAME", "PopoverComboboxContent", "side", "collisionPadding", "sideOffset", "align", "alignOffset", "avoidCollisions", "collisionBoundary", "arrowPadding", "sticky", "hideWhenDetached", "onOpenAutoFocus", "onCloseAutoFocus", "onEscapeKeyDown", "onPointerDownOutside", "onFocusOutside", "onInteractOutside", "forceMount", "id", "PopoverComboboxTrigger", "asChild", "PopoverComboboxVirtualTrigger", "VirtualTrigger", "PopoverComboboxInput", "PopoverComboboxList", "constrainInline", "constrainBlock", "Viewport", "PopoverComboboxItem", "PopoverComboboxArrow", "Arrow", "PopoverComboboxEmpty", "PopoverCombobox", "List", "translationKey"]
7
+ }
@@ -0,0 +1 @@
1
+ {"inputs":{"packages/ui/react-ui-searchlist/src/components/SearchList.tsx":{"bytes":21589,"imports":[{"path":"@phosphor-icons/react","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":"cmdk","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-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-searchlist/src/components/index.ts":{"bytes":520,"imports":[{"path":"packages/ui/react-ui-searchlist/src/components/SearchList.tsx","kind":"import-statement","original":"./SearchList"}],"format":"esm"},"packages/ui/react-ui-searchlist/src/composites/PopoverCombobox.tsx":{"bytes":14165,"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":"packages/ui/react-ui-searchlist/src/components/index.ts","kind":"import-statement","original":"../components"}],"format":"esm"},"packages/ui/react-ui-searchlist/src/composites/index.ts":{"bytes":533,"imports":[{"path":"packages/ui/react-ui-searchlist/src/composites/PopoverCombobox.tsx","kind":"import-statement","original":"./PopoverCombobox"}],"format":"esm"},"packages/ui/react-ui-searchlist/src/translations.ts":{"bytes":912,"imports":[],"format":"esm"},"packages/ui/react-ui-searchlist/src/index.ts":{"bytes":817,"imports":[{"path":"packages/ui/react-ui-searchlist/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/ui/react-ui-searchlist/src/composites/index.ts","kind":"import-statement","original":"./composites"},{"path":"packages/ui/react-ui-searchlist/src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-searchlist/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":20226},"packages/ui/react-ui-searchlist/dist/lib/node/index.cjs":{"imports":[{"path":"@phosphor-icons/react","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":"cmdk","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-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}],"exports":["Combobox","PopoverCombobox","SearchList","translations"],"entryPoint":"packages/ui/react-ui-searchlist/src/index.ts","inputs":{"packages/ui/react-ui-searchlist/src/components/SearchList.tsx":{"bytesInOutput":4982},"packages/ui/react-ui-searchlist/src/components/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-searchlist/src/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-searchlist/src/composites/PopoverCombobox.tsx":{"bytesInOutput":3045},"packages/ui/react-ui-searchlist/src/composites/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-searchlist/src/translations.ts":{"bytesInOutput":123}},"bytes":8473}}}
@@ -0,0 +1,237 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+
3
+ // packages/ui/react-ui-searchlist/src/components/SearchList.tsx
4
+ import { CaretDown } from "@phosphor-icons/react";
5
+ import { createContext } from "@radix-ui/react-context";
6
+ import { useControllableState } from "@radix-ui/react-use-controllable-state";
7
+ import { CommandEmpty, CommandInput, CommandItem, CommandList, CommandRoot } from "cmdk";
8
+ import React, { forwardRef, useCallback } from "react";
9
+ import { Button, useDensityContext, useElevationContext, useId, useThemeContext } from "@dxos/react-ui";
10
+ import { getSize, mx, staticPlaceholderText } from "@dxos/react-ui-theme";
11
+ var COMBOBOX_NAME = "Combobox";
12
+ var COMBOBOX_TRIGGER_NAME = "ComboboxTrigger";
13
+ var SEARCHLIST_NAME = "SearchList";
14
+ var SEARCHLIST_ITEM_NAME = "SearchListItem";
15
+ var [ComboboxProvider, useComboboxContext] = createContext(COMBOBOX_NAME, {});
16
+ var SearchListRoot = /* @__PURE__ */ forwardRef(({ children, classNames, ...props }, forwardedRef) => {
17
+ return /* @__PURE__ */ React.createElement(CommandRoot, {
18
+ ...props,
19
+ className: mx("", classNames),
20
+ ref: forwardedRef
21
+ }, children);
22
+ });
23
+ SearchListRoot.displayName = SEARCHLIST_NAME;
24
+ var SearchListInput = /* @__PURE__ */ forwardRef(({ children, classNames, density: propsDensity, elevation: propsElevation, variant = "subdued", ...props }, forwardedRef) => {
25
+ const { hasIosKeyboard } = useThemeContext();
26
+ const { tx } = useThemeContext();
27
+ const density = useDensityContext(propsDensity);
28
+ const elevation = useElevationContext(propsElevation);
29
+ return /* @__PURE__ */ React.createElement(CommandInput, {
30
+ ...props,
31
+ className: tx("input.input", "input", {
32
+ variant,
33
+ disabled: props.disabled,
34
+ density,
35
+ elevation
36
+ }, classNames),
37
+ ...props.autoFocus && !hasIosKeyboard && {
38
+ autoFocus: true
39
+ },
40
+ ref: forwardedRef
41
+ });
42
+ });
43
+ var SearchListContent = /* @__PURE__ */ forwardRef(({ children, classNames, ...props }, forwardedRef) => {
44
+ return /* @__PURE__ */ React.createElement(CommandList, {
45
+ ...props,
46
+ className: mx(classNames),
47
+ ref: forwardedRef
48
+ }, children);
49
+ });
50
+ var SearchListEmpty = /* @__PURE__ */ forwardRef(({ children, classNames, ...props }, forwardedRef) => {
51
+ return /* @__PURE__ */ React.createElement(CommandEmpty, {
52
+ ...props,
53
+ className: mx(classNames),
54
+ ref: forwardedRef
55
+ }, children);
56
+ });
57
+ var SearchListItem = /* @__PURE__ */ forwardRef(({ children, classNames, onSelect, ...props }, forwardedRef) => {
58
+ const { onValueChange, onOpenChange } = useComboboxContext(SEARCHLIST_ITEM_NAME);
59
+ const handleSelect = useCallback((nextValue) => {
60
+ onValueChange?.(nextValue);
61
+ onOpenChange?.(false);
62
+ onSelect?.(nextValue);
63
+ }, [
64
+ onValueChange,
65
+ onOpenChange,
66
+ onSelect
67
+ ]);
68
+ return /* @__PURE__ */ React.createElement(CommandItem, {
69
+ ...props,
70
+ onSelect: handleSelect,
71
+ className: mx("p-1 rounded select-none cursor-pointer data-[selected]:bg-hoverOverlay", classNames),
72
+ ref: forwardedRef
73
+ }, children);
74
+ });
75
+ SearchListItem.displayName = SEARCHLIST_ITEM_NAME;
76
+ var ComboboxRoot = ({ modalId: propsModalId, open: propsOpen, defaultOpen, onOpenChange: propsOnOpenChange, value: propsValue, defaultValue, onValueChange: propsOnValueChange, placeholder, children }) => {
77
+ const modalId = useId(COMBOBOX_NAME, propsModalId);
78
+ const [open = false, onOpenChange] = useControllableState({
79
+ prop: propsOpen,
80
+ onChange: propsOnOpenChange,
81
+ defaultProp: defaultOpen
82
+ });
83
+ const [value = "", onValueChange] = useControllableState({
84
+ prop: propsValue,
85
+ onChange: propsOnValueChange,
86
+ defaultProp: defaultValue
87
+ });
88
+ return /* @__PURE__ */ React.createElement(ComboboxProvider, {
89
+ isCombobox: true,
90
+ modalId,
91
+ open,
92
+ onOpenChange,
93
+ value,
94
+ onValueChange,
95
+ placeholder
96
+ }, children);
97
+ };
98
+ ComboboxRoot.displayName = COMBOBOX_NAME;
99
+ var ComboboxTrigger = /* @__PURE__ */ forwardRef(({ children, onClick, ...props }, forwardedRef) => {
100
+ const { modalId, open, onOpenChange, placeholder, value } = useComboboxContext(COMBOBOX_TRIGGER_NAME);
101
+ const handleClick = useCallback((event) => {
102
+ onClick?.(event);
103
+ onOpenChange?.(true);
104
+ }, [
105
+ onClick,
106
+ onOpenChange
107
+ ]);
108
+ return /* @__PURE__ */ React.createElement(Button, {
109
+ ...props,
110
+ role: "combobox",
111
+ "aria-expanded": open,
112
+ "aria-controls": modalId,
113
+ "aria-haspopup": "dialog",
114
+ onClick: handleClick,
115
+ ref: forwardedRef
116
+ }, children ?? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", {
117
+ className: mx("font-normal text-start flex-1 min-is-0 truncate mie-2", !value && staticPlaceholderText)
118
+ }, value || placeholder), /* @__PURE__ */ React.createElement(CaretDown, {
119
+ weight: "bold",
120
+ className: getSize(3)
121
+ })));
122
+ });
123
+ ComboboxTrigger.displayName = COMBOBOX_TRIGGER_NAME;
124
+ var SearchList = {
125
+ Root: SearchListRoot,
126
+ Input: SearchListInput,
127
+ Content: SearchListContent,
128
+ Empty: SearchListEmpty,
129
+ Item: SearchListItem
130
+ };
131
+ var Combobox = {
132
+ Root: ComboboxRoot,
133
+ Trigger: ComboboxTrigger,
134
+ useComboboxContext
135
+ };
136
+
137
+ // packages/ui/react-ui-searchlist/src/composites/PopoverCombobox.tsx
138
+ import { useControllableState as useControllableState2 } from "@radix-ui/react-use-controllable-state";
139
+ import React2, { forwardRef as forwardRef2 } from "react";
140
+ import { Popover } from "@dxos/react-ui";
141
+ var PopoverComboboxRoot = ({ modal, children, open: propsOpen, onOpenChange: propsOnOpenChange, defaultOpen, ...props }) => {
142
+ const [open, onOpenChange] = useControllableState2({
143
+ prop: propsOpen,
144
+ onChange: propsOnOpenChange,
145
+ defaultProp: defaultOpen
146
+ });
147
+ return /* @__PURE__ */ React2.createElement(Combobox.Root, {
148
+ open,
149
+ onOpenChange,
150
+ ...props
151
+ }, /* @__PURE__ */ React2.createElement(Popover.Root, {
152
+ open,
153
+ onOpenChange,
154
+ modal
155
+ }, children));
156
+ };
157
+ var POPOVER_COMBOBOX_CONTENT_NAME = "PopoverComboboxContent";
158
+ var PopoverComboboxContent = /* @__PURE__ */ forwardRef2(({ side = "bottom", collisionPadding = 48, sideOffset, align, alignOffset, avoidCollisions, collisionBoundary, arrowPadding, sticky, hideWhenDetached, onOpenAutoFocus, onCloseAutoFocus, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, forceMount, children, classNames, ...props }, forwardedRef) => {
159
+ const { modalId } = Combobox.useComboboxContext(POPOVER_COMBOBOX_CONTENT_NAME);
160
+ return /* @__PURE__ */ React2.createElement(Popover.Content, {
161
+ side,
162
+ sideOffset,
163
+ align,
164
+ alignOffset,
165
+ avoidCollisions,
166
+ collisionBoundary,
167
+ collisionPadding,
168
+ arrowPadding,
169
+ sticky,
170
+ hideWhenDetached,
171
+ onOpenAutoFocus,
172
+ onCloseAutoFocus,
173
+ onEscapeKeyDown,
174
+ onPointerDownOutside,
175
+ onFocusOutside,
176
+ onInteractOutside,
177
+ forceMount,
178
+ classNames,
179
+ id: modalId,
180
+ ref: forwardedRef
181
+ }, /* @__PURE__ */ React2.createElement(SearchList.Root, {
182
+ ...props,
183
+ classNames: "contents",
184
+ role: "none"
185
+ }, children));
186
+ });
187
+ PopoverComboboxContent.displayName = POPOVER_COMBOBOX_CONTENT_NAME;
188
+ var PopoverComboboxTrigger = /* @__PURE__ */ forwardRef2((props, forwardedRef) => {
189
+ return /* @__PURE__ */ React2.createElement(Popover.Trigger, {
190
+ asChild: true
191
+ }, /* @__PURE__ */ React2.createElement(Combobox.Trigger, {
192
+ ...props,
193
+ ref: forwardedRef
194
+ }));
195
+ });
196
+ var PopoverComboboxVirtualTrigger = Popover.VirtualTrigger;
197
+ var PopoverComboboxInput = SearchList.Input;
198
+ var PopoverComboboxList = /* @__PURE__ */ forwardRef2(({ constrainInline, constrainBlock, ...props }, forwardedRef) => {
199
+ return /* @__PURE__ */ React2.createElement(Popover.Viewport, {
200
+ constrainInline,
201
+ constrainBlock
202
+ }, /* @__PURE__ */ React2.createElement(SearchList.Content, {
203
+ ...props,
204
+ ref: forwardedRef
205
+ }));
206
+ });
207
+ var PopoverComboboxItem = SearchList.Item;
208
+ var PopoverComboboxArrow = Popover.Arrow;
209
+ var PopoverComboboxEmpty = SearchList.Empty;
210
+ var PopoverCombobox = {
211
+ Root: PopoverComboboxRoot,
212
+ Content: PopoverComboboxContent,
213
+ Trigger: PopoverComboboxTrigger,
214
+ VirtualTrigger: PopoverComboboxVirtualTrigger,
215
+ Input: PopoverComboboxInput,
216
+ List: PopoverComboboxList,
217
+ Item: PopoverComboboxItem,
218
+ Arrow: PopoverComboboxArrow,
219
+ Empty: PopoverComboboxEmpty
220
+ };
221
+
222
+ // packages/ui/react-ui-searchlist/src/translations.ts
223
+ var translationKey = "searchlist";
224
+ var translations_default = [
225
+ {
226
+ "en-US": {
227
+ [translationKey]: {}
228
+ }
229
+ }
230
+ ];
231
+ export {
232
+ Combobox,
233
+ PopoverCombobox,
234
+ SearchList,
235
+ translations_default as translations
236
+ };
237
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/SearchList.tsx", "../../../src/composites/PopoverCombobox.tsx", "../../../src/translations.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { CaretDown } from '@phosphor-icons/react';\nimport { createContext } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { CommandEmpty, CommandInput, CommandItem, CommandList, CommandRoot } from 'cmdk';\nimport React, { type ComponentPropsWithRef, forwardRef, type PropsWithChildren, useCallback } from 'react';\n\nimport {\n Button,\n type ButtonProps,\n type TextInputProps,\n type ThemedClassName,\n useDensityContext,\n useElevationContext,\n useId,\n useThemeContext,\n} from '@dxos/react-ui';\nimport { getSize, mx, staticPlaceholderText } from '@dxos/react-ui-theme';\n\ntype SearchListVariant = 'list' | 'menu' | 'listbox';\n\ntype SearchListRootProps = ThemedClassName<ComponentPropsWithRef<typeof CommandRoot>> & {\n variant?: SearchListVariant;\n};\n\ntype ComboboxContextValue = {\n isCombobox: true;\n modalId: string;\n open: boolean;\n onOpenChange: (nextOpen: boolean) => void;\n value: string;\n onValueChange: (nextValue: string) => void;\n placeholder?: string;\n};\n\nconst COMBOBOX_NAME = 'Combobox';\nconst COMBOBOX_TRIGGER_NAME = 'ComboboxTrigger';\nconst SEARCHLIST_NAME = 'SearchList';\nconst SEARCHLIST_ITEM_NAME = 'SearchListItem';\n\nconst [ComboboxProvider, useComboboxContext] = createContext<Partial<ComboboxContextValue>>(COMBOBOX_NAME, {});\n\ntype ComboboxRootProps = PropsWithChildren<\n Partial<ComboboxContextValue & { defaultOpen: boolean; defaultValue: string; placeholder: string }>\n>;\n\nconst SearchListRoot = forwardRef<HTMLDivElement, SearchListRootProps>(\n ({ children, classNames, ...props }, forwardedRef) => {\n return (\n <CommandRoot {...props} className={mx('', classNames)} ref={forwardedRef}>\n {children}\n </CommandRoot>\n );\n },\n);\n\nSearchListRoot.displayName = SEARCHLIST_NAME;\n\ntype CommandInputPrimitiveProps = ComponentPropsWithRef<typeof CommandInput>;\n\n// TODO: Harmonize with other inputs’ `onChange` prop.\ntype SearchListInputProps = Omit<TextInputProps, 'value' | 'defaultValue' | 'onChange'> &\n Pick<CommandInputPrimitiveProps, 'value' | 'onValueChange' | 'defaultValue'>;\n\nconst SearchListInput = forwardRef<HTMLInputElement, SearchListInputProps>(\n (\n { children, classNames, density: propsDensity, elevation: propsElevation, variant = 'subdued', ...props },\n forwardedRef,\n ) => {\n // CHORE(thure): Keep this in-sync with `TextInput`, or submit a PR for `cmdk` to support `asChild` so we don’t have to.\n const { hasIosKeyboard } = useThemeContext();\n const { tx } = useThemeContext();\n const density = useDensityContext(propsDensity);\n const elevation = useElevationContext(propsElevation);\n\n return (\n <CommandInput\n {...props}\n className={tx(\n 'input.input',\n 'input',\n {\n variant,\n disabled: props.disabled,\n density,\n elevation,\n },\n classNames,\n )}\n {...(props.autoFocus && !hasIosKeyboard && { autoFocus: true })}\n ref={forwardedRef}\n />\n );\n },\n);\n\ntype SearchListContentProps = ThemedClassName<ComponentPropsWithRef<typeof CommandList>>;\n\nconst SearchListContent = forwardRef<HTMLDivElement, SearchListContentProps>(\n ({ children, classNames, ...props }, forwardedRef) => {\n return (\n <CommandList {...props} className={mx(classNames)} ref={forwardedRef}>\n {children}\n </CommandList>\n );\n },\n);\n\ntype SearchListEmptyProps = ThemedClassName<ComponentPropsWithRef<typeof CommandEmpty>>;\n\nconst SearchListEmpty = forwardRef<HTMLDivElement, SearchListEmptyProps>(\n ({ children, classNames, ...props }, forwardedRef) => {\n return (\n <CommandEmpty {...props} className={mx(classNames)} ref={forwardedRef}>\n {children}\n </CommandEmpty>\n );\n },\n);\n\ntype SearchListItemProps = ThemedClassName<ComponentPropsWithRef<typeof CommandItem>>;\n\nconst SearchListItem = forwardRef<HTMLDivElement, SearchListItemProps>(\n ({ children, classNames, onSelect, ...props }, forwardedRef) => {\n const { onValueChange, onOpenChange } = useComboboxContext(SEARCHLIST_ITEM_NAME);\n const handleSelect = useCallback(\n (nextValue: string) => {\n onValueChange?.(nextValue);\n onOpenChange?.(false);\n onSelect?.(nextValue);\n },\n [onValueChange, onOpenChange, onSelect],\n );\n return (\n <CommandItem\n {...props}\n onSelect={handleSelect}\n className={mx('p-1 rounded select-none cursor-pointer data-[selected]:bg-hoverOverlay', classNames)}\n ref={forwardedRef}\n >\n {children}\n </CommandItem>\n );\n },\n);\n\nSearchListItem.displayName = SEARCHLIST_ITEM_NAME;\n\nconst ComboboxRoot = ({\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 return (\n <ComboboxProvider\n isCombobox\n modalId={modalId}\n open={open}\n onOpenChange={onOpenChange}\n value={value}\n onValueChange={onValueChange}\n placeholder={placeholder}\n >\n {children}\n </ComboboxProvider>\n );\n};\n\nComboboxRoot.displayName = COMBOBOX_NAME;\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 return (\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 <CaretDown weight='bold' className={getSize(3)} />\n </>\n )}\n </Button>\n );\n },\n);\n\nComboboxTrigger.displayName = COMBOBOX_TRIGGER_NAME;\n\nexport const SearchList = {\n Root: SearchListRoot,\n Input: SearchListInput,\n Content: SearchListContent,\n Empty: SearchListEmpty,\n Item: SearchListItem,\n};\n\nexport const Combobox = {\n Root: ComboboxRoot,\n Trigger: ComboboxTrigger,\n useComboboxContext,\n};\n\nexport type {\n SearchListRootProps,\n SearchListInputProps,\n SearchListContentProps,\n SearchListEmptyProps,\n SearchListItemProps,\n ComboboxRootProps,\n ComboboxTriggerProps,\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, { forwardRef } from 'react';\n\nimport {\n Popover,\n type PopoverArrowProps,\n type PopoverContentProps,\n type PopoverViewportProps,\n type PopoverVirtualTriggerProps,\n} from '@dxos/react-ui';\n\nimport {\n Combobox,\n type ComboboxRootProps,\n type ComboboxTriggerProps,\n SearchList,\n type SearchListContentProps,\n type SearchListEmptyProps,\n type SearchListInputProps,\n type SearchListItemProps,\n type SearchListRootProps,\n} from '../components';\n\ntype PopoverComboboxRootProps = ComboboxRootProps & { modal?: boolean };\n\nconst PopoverComboboxRoot = ({\n modal,\n children,\n open: propsOpen,\n onOpenChange: propsOnOpenChange,\n defaultOpen,\n ...props\n}: PopoverComboboxRootProps) => {\n const [open, onOpenChange] = useControllableState({\n prop: propsOpen,\n onChange: propsOnOpenChange,\n defaultProp: defaultOpen,\n });\n return (\n <Combobox.Root open={open} onOpenChange={onOpenChange} {...props}>\n <Popover.Root open={open} onOpenChange={onOpenChange} modal={modal}>\n {children}\n </Popover.Root>\n </Combobox.Root>\n );\n};\n\ntype PopoverComboboxContentProps = SearchListRootProps & PopoverContentProps;\n\nconst POPOVER_COMBOBOX_CONTENT_NAME = 'PopoverComboboxContent';\n\nconst PopoverComboboxContent = forwardRef<HTMLDivElement, PopoverComboboxContentProps>(\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 ...props\n },\n forwardedRef,\n ) => {\n const { modalId } = Combobox.useComboboxContext(POPOVER_COMBOBOX_CONTENT_NAME);\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 classNames,\n }}\n id={modalId}\n ref={forwardedRef}\n >\n {/* TODO(thure): This skips over `Command`’s root component, which renders a DOM node probably unnecessarily without supporting `asChild`. */}\n <SearchList.Root {...props} classNames='contents' role='none'>\n {children}\n </SearchList.Root>\n </Popover.Content>\n );\n },\n);\n\nPopoverComboboxContent.displayName = POPOVER_COMBOBOX_CONTENT_NAME;\n\ntype PopoverComboboxTriggerProps = ComboboxTriggerProps;\n\nconst PopoverComboboxTrigger = forwardRef<HTMLButtonElement, PopoverComboboxTriggerProps>((props, forwardedRef) => {\n return (\n <Popover.Trigger asChild>\n <Combobox.Trigger {...props} ref={forwardedRef} />\n </Popover.Trigger>\n );\n});\n\ntype PopoverComboboxVirtualTriggerProps = PopoverVirtualTriggerProps;\n\nconst PopoverComboboxVirtualTrigger = Popover.VirtualTrigger;\n\ntype PopoverComboboxInputProps = SearchListInputProps;\n\nconst PopoverComboboxInput = SearchList.Input;\n\ntype PopoverComboboxListProps = SearchListContentProps &\n Pick<PopoverViewportProps, 'constrainBlock' | 'constrainInline'>;\n\nconst PopoverComboboxList = forwardRef<HTMLDivElement, PopoverComboboxListProps>(\n ({ constrainInline, constrainBlock, ...props }, forwardedRef) => {\n return (\n <Popover.Viewport {...{ constrainInline, constrainBlock }}>\n <SearchList.Content {...props} ref={forwardedRef} />\n </Popover.Viewport>\n );\n },\n);\n\ntype PopoverComboboxItemProps = SearchListItemProps;\n\nconst PopoverComboboxItem = SearchList.Item;\n\ntype PopoverComboboxArrowProps = PopoverArrowProps;\n\nconst PopoverComboboxArrow = Popover.Arrow;\n\ntype PopoverComboboxEmptyProps = SearchListEmptyProps;\n\nconst PopoverComboboxEmpty = SearchList.Empty;\n\nexport const PopoverCombobox = {\n Root: PopoverComboboxRoot,\n Content: PopoverComboboxContent,\n Trigger: PopoverComboboxTrigger,\n VirtualTrigger: PopoverComboboxVirtualTrigger,\n Input: PopoverComboboxInput,\n List: PopoverComboboxList,\n Item: PopoverComboboxItem,\n Arrow: PopoverComboboxArrow,\n Empty: PopoverComboboxEmpty,\n};\n\nexport type {\n PopoverComboboxRootProps,\n PopoverComboboxContentProps,\n PopoverComboboxTriggerProps,\n PopoverComboboxVirtualTriggerProps,\n PopoverComboboxInputProps,\n PopoverComboboxListProps,\n PopoverComboboxItemProps,\n PopoverComboboxArrowProps,\n PopoverComboboxEmptyProps,\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport const translationKey = 'searchlist';\n\nexport default [\n {\n 'en-US': {\n [translationKey]: {},\n },\n },\n];\n"],
5
+ "mappings": ";;;AAIA,SAASA,i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3C,OAAA,cAAC+B,WAAWH,SAAO;IAAE,GAAGjC;IAAOmC,KAAKL;;AAG1C,CAAA;AAKF,IAAMoB,sBAAsBd,WAAWe;AAIvC,IAAMC,uBAAuB5C,QAAQ6C;AAIrC,IAAMC,uBAAuBlB,WAAWmB;AAEjC,IAAMC,kBAAkB;EAC7BjD,MAAMf;EACNyC,SAASvB;EACT8B,SAASD;EACTI,gBAAgBD;EAChBG,OAAOD;EACPa,MAAMX;EACNK,MAAMD;EACNG,OAAOD;EACPG,OAAOD;AACT;;;ACvKO,IAAMI,iBAAiB;AAE9B,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACA,cAAAA,GAAiB,CAAC;IACrB;EACF;;",
6
+ "names": ["CaretDown", "createContext", "useControllableState", "CommandEmpty", "CommandInput", "CommandItem", "CommandList", "CommandRoot", "React", "forwardRef", "useCallback", "Button", "useDensityContext", "useElevationContext", "useId", "useThemeContext", "getSize", "mx", "staticPlaceholderText", "COMBOBOX_NAME", "COMBOBOX_TRIGGER_NAME", "SEARCHLIST_NAME", "SEARCHLIST_ITEM_NAME", "ComboboxProvider", "useComboboxContext", "createContext", "SearchListRoot", "forwardRef", "children", "classNames", "props", "forwardedRef", "CommandRoot", "className", "mx", "ref", "displayName", "SearchListInput", "density", "propsDensity", "elevation", "propsElevation", "variant", "hasIosKeyboard", "useThemeContext", "tx", "useDensityContext", "useElevationContext", "CommandInput", "disabled", "autoFocus", "SearchListContent", "CommandList", "SearchListEmpty", "CommandEmpty", "SearchListItem", "onSelect", "onValueChange", "onOpenChange", "handleSelect", "useCallback", "nextValue", "CommandItem", "ComboboxRoot", "modalId", "propsModalId", "open", "propsOpen", "defaultOpen", "propsOnOpenChange", "value", "propsValue", "defaultValue", "propsOnValueChange", "placeholder", "useId", "useControllableState", "prop", "onChange", "defaultProp", "isCombobox", "ComboboxTrigger", "onClick", "handleClick", "event", "Button", "role", "aria-expanded", "aria-controls", "aria-haspopup", "span", "staticPlaceholderText", "CaretDown", "weight", "getSize", "SearchList", "Root", "Input", "Content", "Empty", "Item", "Combobox", "Trigger", "useControllableState", "React", "forwardRef", "Popover", "PopoverComboboxRoot", "modal", "children", "open", "propsOpen", "onOpenChange", "propsOnOpenChange", "defaultOpen", "props", "useControllableState", "prop", "onChange", "defaultProp", "React", "Combobox", "Root", "Popover", "POPOVER_COMBOBOX_CONTENT_NAME", "PopoverComboboxContent", "forwardRef", "side", "collisionPadding", "sideOffset", "align", "alignOffset", "avoidCollisions", "collisionBoundary", "arrowPadding", "sticky", "hideWhenDetached", "onOpenAutoFocus", "onCloseAutoFocus", "onEscapeKeyDown", "onPointerDownOutside", "onFocusOutside", "onInteractOutside", "forceMount", "classNames", "forwardedRef", "modalId", "useComboboxContext", "Content", "id", "ref", "SearchList", "role", "displayName", "PopoverComboboxTrigger", "Trigger", "asChild", "PopoverComboboxVirtualTrigger", "VirtualTrigger", "PopoverComboboxInput", "Input", "PopoverComboboxList", "constrainInline", "constrainBlock", "Viewport", "PopoverComboboxItem", "Item", "PopoverComboboxArrow", "Arrow", "PopoverComboboxEmpty", "Empty", "PopoverCombobox", "List", "translationKey"]
7
+ }
@@ -0,0 +1 @@
1
+ {"inputs":{"packages/ui/react-ui-searchlist/src/components/SearchList.tsx":{"bytes":21589,"imports":[{"path":"@phosphor-icons/react","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":"cmdk","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-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-searchlist/src/components/index.ts":{"bytes":520,"imports":[{"path":"packages/ui/react-ui-searchlist/src/components/SearchList.tsx","kind":"import-statement","original":"./SearchList"}],"format":"esm"},"packages/ui/react-ui-searchlist/src/composites/PopoverCombobox.tsx":{"bytes":14165,"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":"packages/ui/react-ui-searchlist/src/components/index.ts","kind":"import-statement","original":"../components"}],"format":"esm"},"packages/ui/react-ui-searchlist/src/composites/index.ts":{"bytes":533,"imports":[{"path":"packages/ui/react-ui-searchlist/src/composites/PopoverCombobox.tsx","kind":"import-statement","original":"./PopoverCombobox"}],"format":"esm"},"packages/ui/react-ui-searchlist/src/translations.ts":{"bytes":912,"imports":[],"format":"esm"},"packages/ui/react-ui-searchlist/src/index.ts":{"bytes":817,"imports":[{"path":"packages/ui/react-ui-searchlist/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/ui/react-ui-searchlist/src/composites/index.ts","kind":"import-statement","original":"./composites"},{"path":"packages/ui/react-ui-searchlist/src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-searchlist/dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":20228},"packages/ui/react-ui-searchlist/dist/lib/node-esm/index.mjs":{"imports":[{"path":"@phosphor-icons/react","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":"cmdk","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-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}],"exports":["Combobox","PopoverCombobox","SearchList","translations"],"entryPoint":"packages/ui/react-ui-searchlist/src/index.ts","inputs":{"packages/ui/react-ui-searchlist/src/components/SearchList.tsx":{"bytesInOutput":4982},"packages/ui/react-ui-searchlist/src/components/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-searchlist/src/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-searchlist/src/composites/PopoverCombobox.tsx":{"bytesInOutput":3045},"packages/ui/react-ui-searchlist/src/composites/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-searchlist/src/translations.ts":{"bytesInOutput":123}},"bytes":8566}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-searchlist",
3
- "version": "0.7.2",
3
+ "version": "0.7.3-staging.971cd8d",
4
4
  "description": "A themed ⌘K-style combobox component, triggered by a button (or keyboard shortcut), where values are queried only within the invoked modal.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -10,7 +10,8 @@
10
10
  "exports": {
11
11
  ".": {
12
12
  "types": "./dist/types/src/index.d.ts",
13
- "browser": "./dist/lib/browser/index.mjs"
13
+ "browser": "./dist/lib/browser/index.mjs",
14
+ "node": "./dist/lib/browser/index.mjs"
14
15
  }
15
16
  },
16
17
  "types": "dist/types/src/index.d.ts",
@@ -33,17 +34,17 @@
33
34
  "react": "~18.2.0",
34
35
  "react-dom": "~18.2.0",
35
36
  "vite": "5.4.7",
36
- "@dxos/random": "0.7.2",
37
- "@dxos/react-ui": "0.7.2",
38
- "@dxos/storybook-utils": "0.7.2",
39
- "@dxos/react-ui-theme": "0.7.2"
37
+ "@dxos/random": "0.7.3-staging.971cd8d",
38
+ "@dxos/storybook-utils": "0.7.3-staging.971cd8d",
39
+ "@dxos/react-ui-theme": "0.7.3-staging.971cd8d",
40
+ "@dxos/react-ui": "0.7.3-staging.971cd8d"
40
41
  },
41
42
  "peerDependencies": {
42
43
  "@phosphor-icons/react": "^2.1.5",
43
44
  "react": "~18.2.0",
44
45
  "react-dom": "~18.2.0",
45
- "@dxos/react-ui": "0.7.2",
46
- "@dxos/react-ui-theme": "0.7.2"
46
+ "@dxos/react-ui": "0.7.3-staging.971cd8d",
47
+ "@dxos/react-ui-theme": "0.7.3-staging.971cd8d"
47
48
  },
48
49
  "publishConfig": {
49
50
  "access": "public"