@langchain/macaw-components 1.7.15 → 1.7.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalog.json +803 -761
- package/dist/components/ChatComposer/ChatComposerModelSelect.d.ts +19 -3
- package/dist/components/ChatComposer/ChatComposerModelSelect.js +115 -30
- package/dist/components/ChatComposer/ChatComposerModelSelect.js.map +1 -1
- package/dist/components/ChatComposer/index.d.ts +1 -1
- package/dist/components/ChatComposer/stories/modelOptions.d.ts +2 -0
- package/dist/components/Command/Command.js +1 -0
- package/dist/components/Command/Command.js.map +1 -1
- package/dist/components/Command/CommandMenu.d.ts +1 -1
- package/dist/components/Command/CommandMenu.js +38 -26
- package/dist/components/Command/CommandMenu.js.map +1 -1
- package/dist/components/ProviderLogo/index.d.ts +4 -0
- package/dist/components/ProviderLogo/index.js +76 -0
- package/dist/components/ProviderLogo/index.js.map +1 -0
- package/dist/components/Select/Select.d.ts +4 -0
- package/dist/components/Select/Select.js +15 -8
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/utilities.css +1 -1
- package/docs/CHAT.md +35 -0
- package/docs/DESIGN.md +3 -2
- package/package.json +6 -2
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
export
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { SelectOption, SelectProps } from '../Select/index.js';
|
|
3
|
+
export interface ChatComposerModelOption<T extends string = string> extends SelectOption<T> {
|
|
4
|
+
/** Group's display label; groups follow their first appearance in the options. */
|
|
5
|
+
group?: string;
|
|
6
|
+
/** Host-supplied provider or tier mark, also shown in the trigger. */
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
/** Short status beside the label, such as a `Badge` reading "Default". */
|
|
9
|
+
badge?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export type ChatComposerModelSelectProps<T extends string = string> = Omit<SelectProps<T>, 'options' | 'groups' | 'renderValue' | 'renderOption' | 'hideSearch'> & {
|
|
12
|
+
/** The model catalog, including the selected model; group labels live on each option. */
|
|
13
|
+
options: ChatComposerModelOption<T>[];
|
|
14
|
+
/** Minimum option count for search (default: 8). Use 0 to always show it.
|
|
15
|
+
* Host-filtered lists always show search, even while results are empty. */
|
|
16
|
+
searchThreshold?: number;
|
|
17
|
+
};
|
|
18
|
+
/** Shared model selection for composer toolbars and standalone controls. The host owns the selected value. */
|
|
19
|
+
export declare function ChatComposerModelSelect<T extends string>({ options, value, onChange, open: controlledOpen, onOpenChange, disabled, searchThreshold, disableFilter, triggerClassName, contentClassName, placeholder, searchPlaceholder, size, variant, onCloseAutoFocus, 'aria-label': ariaLabel, ...props }: ChatComposerModelSelectProps<T>): import("react").JSX.Element;
|
|
@@ -1,51 +1,136 @@
|
|
|
1
|
+
import { CheckIcon } from "../../icons/PaddedPhosphorIcons.js";
|
|
1
2
|
import { cn } from "../../utils/cn.js";
|
|
2
3
|
import { Text } from "../Text/Text.js";
|
|
3
|
-
import {
|
|
4
|
+
import { Icon } from "../Icon/Icon.js";
|
|
5
|
+
import { ChatComposerContext } from "./ChatComposerContext.js";
|
|
4
6
|
import { Select } from "../Select/Select.js";
|
|
5
|
-
import { useRef } from "react";
|
|
7
|
+
import { useContext, useMemo, useRef, useState } from "react";
|
|
6
8
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
9
|
//#region packages/components/src/components/ChatComposer/ChatComposerModelSelect.tsx
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
+
function ModelOptionRow({ option, selected }) {
|
|
11
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
12
|
+
option.icon != null && /* @__PURE__ */ jsx("span", {
|
|
13
|
+
"aria-hidden": true,
|
|
14
|
+
className: "flex size-4 shrink-0 items-center justify-center",
|
|
15
|
+
children: option.icon
|
|
16
|
+
}),
|
|
17
|
+
/* @__PURE__ */ jsxs("span", {
|
|
18
|
+
className: "flex min-w-0 flex-1 flex-col gap-space-1",
|
|
19
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
20
|
+
className: "flex min-w-0 flex-wrap items-center gap-space-2",
|
|
21
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
22
|
+
as: "span",
|
|
23
|
+
variant: "sm",
|
|
24
|
+
className: "[overflow-wrap:anywhere]",
|
|
25
|
+
children: option.label ?? option.value
|
|
26
|
+
}), option.badge != null && /* @__PURE__ */ jsx("span", {
|
|
27
|
+
className: "flex shrink-0 items-center",
|
|
28
|
+
children: option.badge
|
|
29
|
+
})]
|
|
30
|
+
}), option.description && /* @__PURE__ */ jsx(Text, {
|
|
31
|
+
as: "span",
|
|
32
|
+
variant: "xs",
|
|
33
|
+
className: "whitespace-normal text-tertiary [overflow-wrap:anywhere]",
|
|
34
|
+
children: option.description
|
|
35
|
+
})]
|
|
36
|
+
}),
|
|
37
|
+
option.rightDecorator != null && /* @__PURE__ */ jsx("span", {
|
|
38
|
+
className: "ml-auto flex shrink-0 items-center",
|
|
39
|
+
children: option.rightDecorator
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
42
|
+
"aria-hidden": true,
|
|
43
|
+
icon: CheckIcon,
|
|
44
|
+
size: "md",
|
|
45
|
+
className: cn("shrink-0", selected ? "opacity-100" : "opacity-0")
|
|
46
|
+
})
|
|
47
|
+
] });
|
|
48
|
+
}
|
|
49
|
+
/** Shared model selection for composer toolbars and standalone controls. The host owns the selected value. */
|
|
50
|
+
function ChatComposerModelSelect({ options, value, onChange, open: controlledOpen, onOpenChange, disabled, searchThreshold = 8, disableFilter, triggerClassName, contentClassName, placeholder = "Select a model", searchPlaceholder = "Search models…", size = "sm", variant = "plain", onCloseAutoFocus, "aria-label": ariaLabel = "Model", ...props }) {
|
|
51
|
+
const composer = useContext(ChatComposerContext);
|
|
52
|
+
const inComposer = composer != null;
|
|
53
|
+
const isDisabled = Boolean(composer?.disabled || disabled);
|
|
10
54
|
const choseModel = useRef(false);
|
|
55
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
|
|
56
|
+
const open = controlledOpen ?? uncontrolledOpen;
|
|
57
|
+
const setOpen = (next) => {
|
|
58
|
+
if (controlledOpen === void 0) setUncontrolledOpen(next);
|
|
59
|
+
onOpenChange?.(next);
|
|
60
|
+
};
|
|
61
|
+
const searchGroups = useMemo(() => {
|
|
62
|
+
const optionsByGroup = /* @__PURE__ */ new Map();
|
|
63
|
+
for (const option of options) {
|
|
64
|
+
const items = optionsByGroup.get(option.group) ?? [];
|
|
65
|
+
items.push(option);
|
|
66
|
+
optionsByGroup.set(option.group, items);
|
|
67
|
+
}
|
|
68
|
+
return Array.from(optionsByGroup, ([heading, options]) => ({
|
|
69
|
+
heading,
|
|
70
|
+
options
|
|
71
|
+
})).map(({ heading, options: groupOptions }) => ({
|
|
72
|
+
heading,
|
|
73
|
+
options: groupOptions.map((option) => ({
|
|
74
|
+
...option,
|
|
75
|
+
keywords: heading ? [...option.keywords ?? [], heading] : option.keywords
|
|
76
|
+
}))
|
|
77
|
+
}));
|
|
78
|
+
}, [options]);
|
|
79
|
+
const optionCount = searchGroups.reduce((count, group) => count + group.options.length, 0);
|
|
80
|
+
const hideSearch = !disableFilter && optionCount < searchThreshold;
|
|
81
|
+
const transparentDisabledTrigger = isDisabled && variant === "plain";
|
|
11
82
|
return /* @__PURE__ */ jsx("div", {
|
|
12
83
|
className: "flex min-w-0 max-w-full items-center",
|
|
13
84
|
children: /* @__PURE__ */ jsx(Select, {
|
|
14
|
-
"aria-label": "Model",
|
|
15
|
-
size,
|
|
16
|
-
side: "top",
|
|
17
|
-
hideSearch: false,
|
|
18
|
-
searchPlaceholder: "Search models…",
|
|
19
85
|
...props,
|
|
86
|
+
groups: searchGroups,
|
|
87
|
+
value,
|
|
88
|
+
open: open && !isDisabled,
|
|
89
|
+
onOpenChange: setOpen,
|
|
90
|
+
variant,
|
|
91
|
+
size,
|
|
92
|
+
"aria-label": ariaLabel,
|
|
20
93
|
placeholder,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
94
|
+
searchPlaceholder,
|
|
95
|
+
hideSearch,
|
|
96
|
+
disableFilter,
|
|
97
|
+
disabled: isDisabled,
|
|
98
|
+
contentClassName: cn("min-w-56", contentClassName),
|
|
99
|
+
triggerClassName: cn("px-space-2", transparentDisabledTrigger && "bg-transparent dark:bg-transparent", triggerClassName),
|
|
100
|
+
renderValue: (option) => {
|
|
101
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
102
|
+
className: "flex min-w-0 items-center gap-space-2",
|
|
103
|
+
title: option.label ?? option.value,
|
|
104
|
+
children: [option.icon != null && /* @__PURE__ */ jsx("span", {
|
|
105
|
+
"aria-hidden": true,
|
|
106
|
+
className: "flex size-4 shrink-0 items-center justify-center",
|
|
107
|
+
children: option.icon
|
|
108
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
109
|
+
className: cn("min-w-0 truncate text-left", inComposer && "max-w-32 @[440px]/composer:max-w-56"),
|
|
110
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
111
|
+
as: "span",
|
|
112
|
+
variant: "sm",
|
|
113
|
+
weight: "normal",
|
|
114
|
+
children: option.label ?? option.value
|
|
115
|
+
})
|
|
116
|
+
})]
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
renderOption: (option, isSelected) => /* @__PURE__ */ jsx(ModelOptionRow, {
|
|
120
|
+
option,
|
|
121
|
+
selected: isSelected
|
|
122
|
+
}),
|
|
123
|
+
onChange: (next) => {
|
|
124
|
+
if (isDisabled) return;
|
|
40
125
|
choseModel.current = true;
|
|
41
|
-
onChange(
|
|
126
|
+
onChange(next);
|
|
42
127
|
},
|
|
43
128
|
onCloseAutoFocus: (event) => {
|
|
44
129
|
const continueInInput = choseModel.current;
|
|
45
130
|
choseModel.current = false;
|
|
46
131
|
onCloseAutoFocus?.(event);
|
|
47
132
|
if (event.defaultPrevented) return;
|
|
48
|
-
if (continueInInput && composer
|
|
133
|
+
if (continueInInput && composer?.inputFocusRef?.current?.()) event.preventDefault();
|
|
49
134
|
}
|
|
50
135
|
})
|
|
51
136
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatComposerModelSelect.js","names":[],"sources":["../../../src/components/ChatComposer/ChatComposerModelSelect.tsx"],"sourcesContent":["import { useRef } from 'react';\n\nimport { cn } from '../../utils/cn';\nimport { Select } from '../Select';\nimport type { SelectProps } from '../Select';\nimport { Text } from '../Text';\nimport {
|
|
1
|
+
{"version":3,"file":"ChatComposerModelSelect.js","names":[],"sources":["../../../src/components/ChatComposer/ChatComposerModelSelect.tsx"],"sourcesContent":["import { useContext, useMemo, useRef, useState, type ReactNode } from 'react';\n\nimport { CheckIcon } from '../../icons/PaddedPhosphorIcons';\nimport { cn } from '../../utils/cn';\nimport { Icon } from '../Icon';\nimport { Select } from '../Select';\nimport type { SelectOption, SelectProps } from '../Select';\nimport { Text } from '../Text';\nimport { ChatComposerContext } from './ChatComposerContext';\n\nexport interface ChatComposerModelOption<\n T extends string = string,\n> extends SelectOption<T> {\n /** Group's display label; groups follow their first appearance in the options. */\n group?: string;\n /** Host-supplied provider or tier mark, also shown in the trigger. */\n icon?: ReactNode;\n /** Short status beside the label, such as a `Badge` reading \"Default\". */\n badge?: ReactNode;\n}\n\nexport type ChatComposerModelSelectProps<T extends string = string> = Omit<\n SelectProps<T>,\n 'options' | 'groups' | 'renderValue' | 'renderOption' | 'hideSearch'\n> & {\n /** The model catalog, including the selected model; group labels live on each option. */\n options: ChatComposerModelOption<T>[];\n /** Minimum option count for search (default: 8). Use 0 to always show it.\n * Host-filtered lists always show search, even while results are empty. */\n searchThreshold?: number;\n};\n\nfunction ModelOptionRow({\n option,\n selected,\n}: {\n option: ChatComposerModelOption;\n selected: boolean;\n}) {\n return (\n <>\n {option.icon != null && (\n <span\n aria-hidden\n className=\"flex size-4 shrink-0 items-center justify-center\"\n >\n {option.icon}\n </span>\n )}\n <span className=\"flex min-w-0 flex-1 flex-col gap-space-1\">\n <span className=\"flex min-w-0 flex-wrap items-center gap-space-2\">\n <Text as=\"span\" variant=\"sm\" className=\"[overflow-wrap:anywhere]\">\n {option.label ?? option.value}\n </Text>\n {option.badge != null && (\n <span className=\"flex shrink-0 items-center\">{option.badge}</span>\n )}\n </span>\n {option.description && (\n <Text\n as=\"span\"\n variant=\"xs\"\n className=\"whitespace-normal text-tertiary [overflow-wrap:anywhere]\"\n >\n {option.description}\n </Text>\n )}\n </span>\n {option.rightDecorator != null && (\n <span className=\"ml-auto flex shrink-0 items-center\">\n {option.rightDecorator}\n </span>\n )}\n <Icon\n aria-hidden\n icon={CheckIcon}\n size=\"md\"\n className={cn('shrink-0', selected ? 'opacity-100' : 'opacity-0')}\n />\n </>\n );\n}\n\n/** Shared model selection for composer toolbars and standalone controls. The host owns the selected value. */\nexport function ChatComposerModelSelect<T extends string>({\n options,\n value,\n onChange,\n open: controlledOpen,\n onOpenChange,\n disabled,\n searchThreshold = 8,\n disableFilter,\n triggerClassName,\n contentClassName,\n placeholder = 'Select a model',\n searchPlaceholder = 'Search models…',\n size = 'sm',\n variant = 'plain',\n onCloseAutoFocus,\n 'aria-label': ariaLabel = 'Model',\n ...props\n}: ChatComposerModelSelectProps<T>) {\n const composer = useContext(ChatComposerContext);\n const inComposer = composer != null;\n const isDisabled = Boolean(composer?.disabled || disabled);\n const choseModel = useRef(false);\n const [uncontrolledOpen, setUncontrolledOpen] = useState(false);\n const open = controlledOpen ?? uncontrolledOpen;\n const setOpen = (next: boolean) => {\n if (controlledOpen === undefined) setUncontrolledOpen(next);\n onOpenChange?.(next);\n };\n\n const searchGroups = useMemo(() => {\n const optionsByGroup = new Map<\n string | undefined,\n ChatComposerModelOption<T>[]\n >();\n for (const option of options) {\n const items = optionsByGroup.get(option.group) ?? [];\n items.push(option);\n optionsByGroup.set(option.group, items);\n }\n const modelGroups = Array.from(optionsByGroup, ([heading, options]) => ({\n heading,\n options,\n }));\n return modelGroups.map(({ heading, options: groupOptions }) => ({\n heading,\n options: groupOptions.map((option) => ({\n ...option,\n keywords: heading\n ? [...(option.keywords ?? []), heading]\n : option.keywords,\n })),\n }));\n }, [options]);\n const optionCount = searchGroups.reduce(\n (count, group) => count + group.options.length,\n 0\n );\n const hideSearch = !disableFilter && optionCount < searchThreshold;\n const transparentDisabledTrigger = isDisabled && variant === 'plain';\n\n return (\n <div className=\"flex min-w-0 max-w-full items-center\">\n <Select<T>\n {...props}\n groups={searchGroups}\n value={value}\n open={open && !isDisabled}\n onOpenChange={setOpen}\n variant={variant}\n size={size}\n aria-label={ariaLabel}\n placeholder={placeholder}\n searchPlaceholder={searchPlaceholder}\n hideSearch={hideSearch}\n disableFilter={disableFilter}\n disabled={isDisabled}\n contentClassName={cn('min-w-56', contentClassName)}\n triggerClassName={cn(\n 'px-space-2',\n transparentDisabledTrigger && 'bg-transparent dark:bg-transparent',\n triggerClassName\n )}\n renderValue={(option: ChatComposerModelOption<T>) => {\n return (\n <span\n className=\"flex min-w-0 items-center gap-space-2\"\n title={option.label ?? option.value}\n >\n {option.icon != null && (\n <span\n aria-hidden\n className=\"flex size-4 shrink-0 items-center justify-center\"\n >\n {option.icon}\n </span>\n )}\n <span\n className={cn(\n 'min-w-0 truncate text-left',\n inComposer && 'max-w-32 @[440px]/composer:max-w-56'\n )}\n >\n <Text as=\"span\" variant=\"sm\" weight=\"normal\">\n {option.label ?? option.value}\n </Text>\n </span>\n </span>\n );\n }}\n renderOption={(option: ChatComposerModelOption<T>, isSelected) => (\n <ModelOptionRow option={option} selected={isSelected} />\n )}\n onChange={(next) => {\n if (isDisabled) return;\n choseModel.current = true;\n onChange(next);\n }}\n onCloseAutoFocus={(event) => {\n const continueInInput = choseModel.current;\n choseModel.current = false;\n onCloseAutoFocus?.(event);\n if (event.defaultPrevented) return;\n if (continueInInput && composer?.inputFocusRef?.current?.())\n event.preventDefault();\n }}\n />\n </div>\n );\n}\n"],"mappings":"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"}
|
|
@@ -7,6 +7,6 @@ export type { ChatComposerTextareaProps } from './ChatComposerTextarea.js';
|
|
|
7
7
|
export { ChatComposerAttachmentMenu, ChatComposerAttachments, ChatComposerAttachment, } from './ChatComposerAttachments.js';
|
|
8
8
|
export type { ChatComposerAttachmentMenuProps, ChatComposerAttachmentsProps, ChatComposerAttachmentProps, } from './ChatComposerAttachments.js';
|
|
9
9
|
export { ChatComposerModelSelect } from './ChatComposerModelSelect.js';
|
|
10
|
-
export type { ChatComposerModelSelectProps } from './ChatComposerModelSelect.js';
|
|
10
|
+
export type { ChatComposerModelOption, ChatComposerModelSelectProps, } from './ChatComposerModelSelect.js';
|
|
11
11
|
export { ChatComposerContext } from './ChatComposerContext.js';
|
|
12
12
|
export type { ChatComposerContextValue } from './ChatComposerContext.js';
|
|
@@ -63,6 +63,7 @@ var CommandGroup = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
63
63
|
CommandGroup.displayName = Command$1.Group.displayName;
|
|
64
64
|
var CommandSeparator = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Command$1.Separator, {
|
|
65
65
|
ref,
|
|
66
|
+
"aria-hidden": true,
|
|
66
67
|
className: cn("bg-border -mx-space-1 h-px", className),
|
|
67
68
|
...props
|
|
68
69
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Command.js","names":[],"sources":["../../../src/components/Command/Command.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef, ElementRef, ReactNode } from 'react';\nimport { forwardRef } from 'react';\n\nimport { Command as CommandPrimitive } from 'cmdk';\n\nimport { cn } from '../../utils/cn';\nimport {\n OPTION_ROW_SIZES,\n type OptionRowSize,\n} from '../../utils/componentSizes';\nimport {\n DECORATOR_CLASSES,\n getInputContainerClasses,\n getInputElementClasses,\n} from '../Input/inputStyles';\nimport type { InputSize, InputVariant } from '../Input/inputStyles';\n\nexport const Command = forwardRef<\n ElementRef<typeof CommandPrimitive>,\n ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn(\n 'flex h-full w-full flex-col overflow-hidden rounded-md bg-popover',\n className\n )}\n {...props}\n />\n));\nCommand.displayName = CommandPrimitive.displayName;\n\nexport interface CommandInputProps extends Omit<\n ComponentPropsWithoutRef<typeof CommandPrimitive.Input>,\n 'size'\n> {\n /** Left side decorator (icon or element) */\n leftDecorator?: ReactNode;\n /** Right side decorator (icon or element) */\n rightDecorator?: ReactNode;\n /** Size variant — uses shared Input styling */\n size?: InputSize;\n /** Visual variant — uses shared Input styling */\n variant?: InputVariant;\n}\n\nexport const CommandInput = forwardRef<\n ElementRef<typeof CommandPrimitive.Input>,\n CommandInputProps\n>(\n (\n {\n className,\n leftDecorator,\n rightDecorator,\n size = 'lg',\n variant = 'outlined',\n ...props\n },\n ref\n ) => {\n const containerClasses = getInputContainerClasses({\n size,\n variant,\n disabled: props.disabled,\n className,\n });\n\n const inputClasses = getInputElementClasses({\n size,\n disabled: props.disabled,\n });\n\n return (\n <div className={containerClasses} {...{ 'cmdk-input-wrapper': '' }}>\n {leftDecorator && (\n <div className={DECORATOR_CLASSES}>{leftDecorator}</div>\n )}\n <CommandPrimitive.Input ref={ref} className={inputClasses} {...props} />\n {rightDecorator && (\n <div className={DECORATOR_CLASSES}>{rightDecorator}</div>\n )}\n </div>\n );\n }\n);\n\nCommandInput.displayName = CommandPrimitive.Input.displayName;\n\nexport const CommandList = forwardRef<\n ElementRef<typeof CommandPrimitive.List>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n className={cn('max-h-[300px] overflow-y-auto overflow-x-hidden', className)}\n {...props}\n />\n));\n\nCommandList.displayName = CommandPrimitive.List.displayName;\n\nexport const CommandEmpty = forwardRef<\n ElementRef<typeof CommandPrimitive.Empty>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>((props, ref) => (\n <CommandPrimitive.Empty\n ref={ref}\n className=\"py-space-5 text-center\"\n {...props}\n />\n));\n\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName;\n\nexport const CommandGroup = forwardRef<\n ElementRef<typeof CommandPrimitive.Group>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\n className={cn(\n 'overflow-hidden',\n '[&_[cmdk-group-heading]]:px-space-2 [&_[cmdk-group-heading]]:py-space-2 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:text-tertiary',\n className\n )}\n {...props}\n />\n));\n\nCommandGroup.displayName = CommandPrimitive.Group.displayName;\n\nexport const CommandSeparator = forwardRef<\n ElementRef<typeof CommandPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Separator\n ref={ref}\n className={cn('bg-border -mx-space-1 h-px', className)}\n {...props}\n />\n));\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName;\n\ninterface CommandItemProps extends ComponentPropsWithoutRef<\n typeof CommandPrimitive.Item\n> {\n /**\n * Controls minimum row height and default label typography.\n * Rich or multiline content grows intrinsically.\n */\n size?: OptionRowSize;\n}\n\nconst COMMAND_ITEM_SIZE_CLASSES = {\n sm: 'py-space-1 text-xs leading-4',\n md: 'py-space-1 text-sm',\n} satisfies Record<OptionRowSize, string>;\n\nexport const CommandItem = forwardRef<\n ElementRef<typeof CommandPrimitive.Item>,\n CommandItemProps\n>(({ className, size = 'md', ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n 'relative flex cursor-pointer select-none items-center rounded-sm px-space-2 outline-hidden hover:bg-elevated-hover aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-selected:bg-elevated-hover',\n OPTION_ROW_SIZES[size].minHeightClassName,\n COMMAND_ITEM_SIZE_CLASSES[size],\n className\n )}\n {...props}\n />\n));\n\nCommandItem.displayName = CommandPrimitive.Item.displayName;\n"],"mappings":";;;;;;;AAiBA,IAAa,UAAU,YAGpB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,WAAD;CACO;CACL,WAAW,GACT,qEACA,SACF;CACA,GAAI;AACL,CAAA,CACF;AACD,QAAQ,cAAc,UAAiB;AAgBvC,IAAa,eAAe,YAKxB,EACE,WACA,eACA,gBACA,OAAO,MACP,UAAU,YACV,GAAG,SAEL,QACG;CACH,MAAM,mBAAmB,yBAAyB;EAChD;EACA;EACA,UAAU,MAAM;EAChB;CACF,CAAC;CAED,MAAM,eAAe,uBAAuB;EAC1C;EACA,UAAU,MAAM;CAClB,CAAC;CAED,OACE,qBAAC,OAAD;EAAK,WAAW;EAAwB,sBAAsB;EAA9D,UAAA;GACG,iBACC,oBAAC,OAAD;IAAK,WAAA;IAA+B,UAAA;GAAmB,CAAA;GAEzD,oBAAC,UAAiB,OAAlB;IAA6B;IAAK,WAAW;IAAc,GAAI;GAAQ,CAAA;GACtE,kBACC,oBAAC,OAAD;IAAK,WAAA;IAA+B,UAAA;GAAoB,CAAA;EAEvD;;AAET,CACF;AAEA,aAAa,cAAc,UAAiB,MAAM;AAElD,IAAa,cAAc,YAGxB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,UAAiB,MAAlB;CACO;CACL,WAAW,GAAG,mDAAmD,SAAS;CAC1E,GAAI;AACL,CAAA,CACF;AAED,YAAY,cAAc,UAAiB,KAAK;AAEhD,IAAa,eAAe,YAGzB,OAAO,QACR,oBAAC,UAAiB,OAAlB;CACO;CACL,WAAU;CACV,GAAI;AACL,CAAA,CACF;AAED,aAAa,cAAc,UAAiB,MAAM;AAElD,IAAa,eAAe,YAGzB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,UAAiB,OAAlB;CACO;CACL,WAAW,GACT,mBACA,6NACA,SACF;CACA,GAAI;AACL,CAAA,CACF;AAED,aAAa,cAAc,UAAiB,MAAM;AAElD,IAAa,mBAAmB,YAG7B,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,UAAiB,WAAlB;CACO;CACL,WAAW,GAAG,8BAA8B,SAAS;CACrD,GAAI;AACL,CAAA,CACF;AACD,iBAAiB,cAAc,UAAiB,UAAU;AAY1D,IAAM,4BAA4B;CAChC,IAAI;CACJ,IAAI;AACN;AAEA,IAAa,cAAc,YAGxB,EAAE,WAAW,OAAO,MAAM,GAAG,SAAS,QACvC,oBAAC,UAAiB,MAAlB;CACO;CACL,WAAW,GACT,iNACA,iBAAiB,KAAK,CAAC,oBACvB,0BAA0B,OAC1B,SACF;CACA,GAAI;AACL,CAAA,CACF;AAED,YAAY,cAAc,UAAiB,KAAK"}
|
|
1
|
+
{"version":3,"file":"Command.js","names":[],"sources":["../../../src/components/Command/Command.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef, ElementRef, ReactNode } from 'react';\nimport { forwardRef } from 'react';\n\nimport { Command as CommandPrimitive } from 'cmdk';\n\nimport { cn } from '../../utils/cn';\nimport {\n OPTION_ROW_SIZES,\n type OptionRowSize,\n} from '../../utils/componentSizes';\nimport {\n DECORATOR_CLASSES,\n getInputContainerClasses,\n getInputElementClasses,\n} from '../Input/inputStyles';\nimport type { InputSize, InputVariant } from '../Input/inputStyles';\n\nexport const Command = forwardRef<\n ElementRef<typeof CommandPrimitive>,\n ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn(\n 'flex h-full w-full flex-col overflow-hidden rounded-md bg-popover',\n className\n )}\n {...props}\n />\n));\nCommand.displayName = CommandPrimitive.displayName;\n\nexport interface CommandInputProps extends Omit<\n ComponentPropsWithoutRef<typeof CommandPrimitive.Input>,\n 'size'\n> {\n /** Left side decorator (icon or element) */\n leftDecorator?: ReactNode;\n /** Right side decorator (icon or element) */\n rightDecorator?: ReactNode;\n /** Size variant — uses shared Input styling */\n size?: InputSize;\n /** Visual variant — uses shared Input styling */\n variant?: InputVariant;\n}\n\nexport const CommandInput = forwardRef<\n ElementRef<typeof CommandPrimitive.Input>,\n CommandInputProps\n>(\n (\n {\n className,\n leftDecorator,\n rightDecorator,\n size = 'lg',\n variant = 'outlined',\n ...props\n },\n ref\n ) => {\n const containerClasses = getInputContainerClasses({\n size,\n variant,\n disabled: props.disabled,\n className,\n });\n\n const inputClasses = getInputElementClasses({\n size,\n disabled: props.disabled,\n });\n\n return (\n <div className={containerClasses} {...{ 'cmdk-input-wrapper': '' }}>\n {leftDecorator && (\n <div className={DECORATOR_CLASSES}>{leftDecorator}</div>\n )}\n <CommandPrimitive.Input ref={ref} className={inputClasses} {...props} />\n {rightDecorator && (\n <div className={DECORATOR_CLASSES}>{rightDecorator}</div>\n )}\n </div>\n );\n }\n);\n\nCommandInput.displayName = CommandPrimitive.Input.displayName;\n\nexport const CommandList = forwardRef<\n ElementRef<typeof CommandPrimitive.List>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n className={cn('max-h-[300px] overflow-y-auto overflow-x-hidden', className)}\n {...props}\n />\n));\n\nCommandList.displayName = CommandPrimitive.List.displayName;\n\nexport const CommandEmpty = forwardRef<\n ElementRef<typeof CommandPrimitive.Empty>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>((props, ref) => (\n <CommandPrimitive.Empty\n ref={ref}\n className=\"py-space-5 text-center\"\n {...props}\n />\n));\n\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName;\n\nexport const CommandGroup = forwardRef<\n ElementRef<typeof CommandPrimitive.Group>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\n className={cn(\n 'overflow-hidden',\n '[&_[cmdk-group-heading]]:px-space-2 [&_[cmdk-group-heading]]:py-space-2 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-semibold [&_[cmdk-group-heading]]:uppercase [&_[cmdk-group-heading]]:text-tertiary',\n className\n )}\n {...props}\n />\n));\n\nCommandGroup.displayName = CommandPrimitive.Group.displayName;\n\nexport const CommandSeparator = forwardRef<\n ElementRef<typeof CommandPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Separator\n ref={ref}\n aria-hidden\n className={cn('bg-border -mx-space-1 h-px', className)}\n {...props}\n />\n));\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName;\n\ninterface CommandItemProps extends ComponentPropsWithoutRef<\n typeof CommandPrimitive.Item\n> {\n /**\n * Controls minimum row height and default label typography.\n * Rich or multiline content grows intrinsically.\n */\n size?: OptionRowSize;\n}\n\nconst COMMAND_ITEM_SIZE_CLASSES = {\n sm: 'py-space-1 text-xs leading-4',\n md: 'py-space-1 text-sm',\n} satisfies Record<OptionRowSize, string>;\n\nexport const CommandItem = forwardRef<\n ElementRef<typeof CommandPrimitive.Item>,\n CommandItemProps\n>(({ className, size = 'md', ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n 'relative flex cursor-pointer select-none items-center rounded-sm px-space-2 outline-hidden hover:bg-elevated-hover aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-selected:bg-elevated-hover',\n OPTION_ROW_SIZES[size].minHeightClassName,\n COMMAND_ITEM_SIZE_CLASSES[size],\n className\n )}\n {...props}\n />\n));\n\nCommandItem.displayName = CommandPrimitive.Item.displayName;\n"],"mappings":";;;;;;;AAiBA,IAAa,UAAU,YAGpB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,WAAD;CACO;CACL,WAAW,GACT,qEACA,SACF;CACA,GAAI;AACL,CAAA,CACF;AACD,QAAQ,cAAc,UAAiB;AAgBvC,IAAa,eAAe,YAKxB,EACE,WACA,eACA,gBACA,OAAO,MACP,UAAU,YACV,GAAG,SAEL,QACG;CACH,MAAM,mBAAmB,yBAAyB;EAChD;EACA;EACA,UAAU,MAAM;EAChB;CACF,CAAC;CAED,MAAM,eAAe,uBAAuB;EAC1C;EACA,UAAU,MAAM;CAClB,CAAC;CAED,OACE,qBAAC,OAAD;EAAK,WAAW;EAAwB,sBAAsB;EAA9D,UAAA;GACG,iBACC,oBAAC,OAAD;IAAK,WAAA;IAA+B,UAAA;GAAmB,CAAA;GAEzD,oBAAC,UAAiB,OAAlB;IAA6B;IAAK,WAAW;IAAc,GAAI;GAAQ,CAAA;GACtE,kBACC,oBAAC,OAAD;IAAK,WAAA;IAA+B,UAAA;GAAoB,CAAA;EAEvD;;AAET,CACF;AAEA,aAAa,cAAc,UAAiB,MAAM;AAElD,IAAa,cAAc,YAGxB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,UAAiB,MAAlB;CACO;CACL,WAAW,GAAG,mDAAmD,SAAS;CAC1E,GAAI;AACL,CAAA,CACF;AAED,YAAY,cAAc,UAAiB,KAAK;AAEhD,IAAa,eAAe,YAGzB,OAAO,QACR,oBAAC,UAAiB,OAAlB;CACO;CACL,WAAU;CACV,GAAI;AACL,CAAA,CACF;AAED,aAAa,cAAc,UAAiB,MAAM;AAElD,IAAa,eAAe,YAGzB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,UAAiB,OAAlB;CACO;CACL,WAAW,GACT,mBACA,6NACA,SACF;CACA,GAAI;AACL,CAAA,CACF;AAED,aAAa,cAAc,UAAiB,MAAM;AAElD,IAAa,mBAAmB,YAG7B,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,UAAiB,WAAlB;CACO;CACL,eAAA;CACA,WAAW,GAAG,8BAA8B,SAAS;CACrD,GAAI;AACL,CAAA,CACF;AACD,iBAAiB,cAAc,UAAiB,UAAU;AAY1D,IAAM,4BAA4B;CAChC,IAAI;CACJ,IAAI;AACN;AAEA,IAAa,cAAc,YAGxB,EAAE,WAAW,OAAO,MAAM,GAAG,SAAS,QACvC,oBAAC,UAAiB,MAAlB;CACO;CACL,WAAW,GACT,iNACA,iBAAiB,KAAK,CAAC,oBACvB,0BAA0B,OAC1B,SACF;CACA,GAAI;AACL,CAAA,CACF;AAED,YAAY,cAAc,UAAiB,KAAK"}
|
|
@@ -24,7 +24,7 @@ export interface CommandMenuGroup {
|
|
|
24
24
|
interface CommandMenuBaseProps {
|
|
25
25
|
/** Callback when an item is selected */
|
|
26
26
|
onSelect: (value: string) => void;
|
|
27
|
-
/** The currently selected value. When set, a check icon is shown next to the selected item. */
|
|
27
|
+
/** The currently selected value. When set, a check icon is shown next to the selected item, and a menu without search opens with it highlighted. */
|
|
28
28
|
value?: string;
|
|
29
29
|
/** Placeholder text for the search input */
|
|
30
30
|
placeholder?: string;
|
|
@@ -28,6 +28,8 @@ function TruncatedLabel({ text, size }) {
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
function CommandMenu({ items, groups, onSelect, value, placeholder = "Search...", emptyText = "No results found.", hideSearch, showSelectedIndicator = true, disableFilter, onSearchChange, renderItem, inputSize = "sm", itemRowSize = "md", inputVariant = "plain", className, loading = false, loadingRows = 5, onEndReached, endReachedThresholdPx = 50 }) {
|
|
31
|
+
const menuItems = items ?? groups?.flatMap((group) => group.items) ?? [];
|
|
32
|
+
const canHighlightSelection = hideSearch && menuItems.some((item) => item.value === value && !item.disabled);
|
|
31
33
|
const handleScroll = useCallback((e) => {
|
|
32
34
|
if (!onEndReached) return;
|
|
33
35
|
const { scrollTop, scrollHeight, clientHeight } = e.currentTarget;
|
|
@@ -69,38 +71,48 @@ function CommandMenu({ items, groups, onSelect, value, placeholder = "Search..."
|
|
|
69
71
|
}, item.value);
|
|
70
72
|
});
|
|
71
73
|
return /* @__PURE__ */ jsxs(Command, {
|
|
72
|
-
className: cn("flex flex-col gap-1.5 p-space-1 outline-hidden", className),
|
|
74
|
+
className: cn("flex min-h-0 flex-col gap-1.5 p-space-1 outline-hidden", className),
|
|
73
75
|
shouldFilter: disableFilter ? false : void 0,
|
|
76
|
+
defaultValue: canHighlightSelection ? value : void 0,
|
|
77
|
+
label: placeholder,
|
|
74
78
|
tabIndex: hideSearch ? 0 : -1,
|
|
75
|
-
children: [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
children: [
|
|
80
|
+
!hideSearch && /* @__PURE__ */ jsx(CommandInput, {
|
|
81
|
+
placeholder,
|
|
82
|
+
size: inputSize,
|
|
83
|
+
variant: inputVariant,
|
|
84
|
+
leftDecorator: /* @__PURE__ */ jsx(MagnifyingGlassIcon, {
|
|
85
|
+
"aria-hidden": true,
|
|
86
|
+
size: 16,
|
|
87
|
+
weight: "regular"
|
|
88
|
+
}),
|
|
89
|
+
onValueChange: onSearchChange
|
|
83
90
|
}),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
onScroll: handleScroll,
|
|
88
|
-
children: [
|
|
89
|
-
!loading && /* @__PURE__ */ jsx(CommandEmpty, { children: /* @__PURE__ */ jsx(Text, {
|
|
91
|
+
!loading && /* @__PURE__ */ jsx(CommandEmpty, {
|
|
92
|
+
role: "status",
|
|
93
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
90
94
|
variant: "sm",
|
|
91
95
|
children: emptyText
|
|
92
|
-
}) }),
|
|
93
|
-
items && renderItems(items),
|
|
94
|
-
groups?.map((group, i) => /* @__PURE__ */ jsxs(Fragment, { children: [i > 0 && /* @__PURE__ */ jsx(CommandSeparator, {}), /* @__PURE__ */ jsx(CommandGroup, {
|
|
95
|
-
heading: group.heading,
|
|
96
|
-
children: renderItems(group.items)
|
|
97
|
-
})] }, group.heading ?? i)),
|
|
98
|
-
loading && /* @__PURE__ */ jsx("div", {
|
|
99
|
-
className: "flex flex-col gap-space-1 px-space-2 py-space-1",
|
|
100
|
-
children: Array.from({ length: loadingRows }, (_, i) => /* @__PURE__ */ jsx("div", { className: cn("animate-pulse rounded-md bg-tertiary", OPTION_ROW_SIZES[itemRowSize].minHeightClassName) }, i))
|
|
101
96
|
})
|
|
102
|
-
|
|
103
|
-
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ jsxs(CommandList, {
|
|
99
|
+
className: "outline-hidden",
|
|
100
|
+
onScroll: handleScroll,
|
|
101
|
+
"aria-busy": loading || void 0,
|
|
102
|
+
children: [
|
|
103
|
+
items && renderItems(items),
|
|
104
|
+
groups?.map((group, i) => /* @__PURE__ */ jsxs(Fragment, { children: [i > 0 && /* @__PURE__ */ jsx(CommandSeparator, {}), /* @__PURE__ */ jsx(CommandGroup, {
|
|
105
|
+
heading: group.heading,
|
|
106
|
+
children: renderItems(group.items)
|
|
107
|
+
})] }, group.heading ?? i)),
|
|
108
|
+
loading && /* @__PURE__ */ jsx("div", {
|
|
109
|
+
"aria-hidden": true,
|
|
110
|
+
className: "flex flex-col gap-space-1 px-space-2 py-space-1",
|
|
111
|
+
children: Array.from({ length: loadingRows }, (_, i) => /* @__PURE__ */ jsx("div", { className: cn("animate-pulse rounded-md bg-tertiary", OPTION_ROW_SIZES[itemRowSize].minHeightClassName) }, i))
|
|
112
|
+
})
|
|
113
|
+
]
|
|
114
|
+
})
|
|
115
|
+
]
|
|
104
116
|
});
|
|
105
117
|
}
|
|
106
118
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandMenu.js","names":[],"sources":["../../../src/components/Command/CommandMenu.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { Fragment, useCallback, useEffect, useRef, useState } from 'react';\n\nimport { MagnifyingGlassIcon } from '@phosphor-icons/react/dist/ssr/MagnifyingGlass';\n\nimport { CheckIcon } from '../../icons/PaddedPhosphorIcons';\nimport { cn } from '../../utils/cn';\nimport {\n OPTION_ROW_SIZES,\n type OptionRowSize,\n} from '../../utils/componentSizes';\nimport { Icon } from '../Icon';\nimport type { InputSize, InputVariant } from '../Input/inputStyles';\nimport { Text } from '../Text';\nimport { Tooltip } from '../Tooltip';\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n} from './Command';\n\nexport interface CommandMenuItem {\n /** Unique value used for selection and filtering */\n value: string;\n /** Display label (defaults to value if not provided) */\n label?: string;\n /** Secondary description text displayed below the label */\n description?: string;\n /** Element displayed on the right side of the item (e.g. badge, shortcut) */\n rightDecorator?: ReactNode;\n /** Whether this item is disabled */\n disabled?: boolean;\n /** Extra search terms for filtering */\n keywords?: string[];\n}\n\nexport interface CommandMenuGroup {\n /** Optional heading displayed above the group */\n heading?: string;\n /** Items in this group */\n items: CommandMenuItem[];\n}\n\ninterface CommandMenuBaseProps {\n /** Callback when an item is selected */\n onSelect: (value: string) => void;\n /** The currently selected value. When set, a check icon is shown next to the selected item. */\n value?: string;\n /** Placeholder text for the search input */\n placeholder?: string;\n /** Text shown when no items match the search */\n emptyText?: string;\n /** Hide the search input (default: false, search is visible) */\n hideSearch?: boolean;\n /** Show the leading selected-indicator slot in the default item layout (default: true). Set false for action menus that track no selection so labels sit flush-left. */\n showSelectedIndicator?: boolean;\n /** Disable client-side filtering by cmdk (default: false). Set true for server-side filtering. */\n disableFilter?: boolean;\n /** Callback when the search input value changes. Useful for server-side filtering. */\n onSearchChange?: (query: string) => void;\n /** Custom render function for each item */\n renderItem?: (item: CommandMenuItem, isSelected: boolean) => ReactNode;\n /** Size variant for the search input */\n inputSize?: InputSize;\n /**\n * Controls minimum row height and default label typography.\n * Descriptions and custom content may grow beyond the minimum height.\n */\n itemRowSize?: OptionRowSize;\n /** Visual variant for the search input */\n inputVariant?: InputVariant;\n /** Additional class name for the Command root */\n className?: string;\n /** Whether more items are currently being loaded */\n loading?: boolean;\n /** Number of skeleton rows to show while loading (default: 5) */\n loadingRows?: number;\n /** Callback when the user scrolls near the end of the list. Use for infinite loading. */\n onEndReached?: () => void;\n /** Distance in pixels from the bottom to trigger onEndReached (default: 50) */\n endReachedThresholdPx?: number;\n}\n\nexport type CommandMenuProps = CommandMenuBaseProps &\n (\n | { /** Flat list of items */ items: CommandMenuItem[]; groups?: never }\n | {\n /** Grouped items with optional headings */ groups: CommandMenuGroup[];\n items?: never;\n }\n );\n\nfunction TruncatedLabel({ text, size }: { text: string; size: OptionRowSize }) {\n const textRef = useRef<HTMLElement>(null);\n const [isTruncated, setIsTruncated] = useState(false);\n\n useEffect(() => {\n const el = textRef.current;\n if (el) {\n setIsTruncated(el.scrollWidth > el.clientWidth);\n }\n }, [text, size]);\n\n return (\n <Tooltip title={isTruncated ? text : undefined}>\n <Text\n ref={textRef}\n as=\"span\"\n variant={size}\n className={cn(\n 'truncate tracking-normal',\n size === 'sm' ? 'leading-4' : 'leading-5'\n )}\n >\n {text}\n </Text>\n </Tooltip>\n );\n}\n\nexport function CommandMenu({\n items,\n groups,\n onSelect,\n value,\n placeholder = 'Search...',\n emptyText = 'No results found.',\n hideSearch,\n showSelectedIndicator = true,\n disableFilter,\n onSearchChange,\n renderItem,\n inputSize = 'sm',\n itemRowSize = 'md',\n inputVariant = 'plain',\n className,\n loading = false,\n loadingRows = 5,\n onEndReached,\n endReachedThresholdPx = 50,\n}: CommandMenuProps) {\n const handleScroll = useCallback(\n (e: React.UIEvent<HTMLDivElement>) => {\n if (!onEndReached) return;\n const { scrollTop, scrollHeight, clientHeight } = e.currentTarget;\n if (scrollHeight - scrollTop - clientHeight <= endReachedThresholdPx) {\n onEndReached();\n }\n },\n [onEndReached, endReachedThresholdPx]\n );\n\n const renderItems = (menuItems: CommandMenuItem[]) =>\n menuItems.map((item) => {\n const isSelected = item.value === value;\n const label = item.label ?? item.value;\n return (\n <CommandItem\n key={item.value}\n value={item.value}\n keywords={\n item.label ? [item.label, ...(item.keywords ?? [])] : item.keywords\n }\n disabled={item.disabled}\n onSelect={() => onSelect(item.value)}\n size={itemRowSize}\n className={cn(\n 'gap-space-2',\n hideSearch &&\n 'after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] aria-selected:after:border-2 aria-selected:after:border-focus'\n )}\n >\n {renderItem ? (\n renderItem(item, isSelected)\n ) : (\n <>\n {showSelectedIndicator && (\n <Icon\n icon={CheckIcon}\n size=\"md\"\n className={cn(\n 'shrink-0',\n isSelected ? 'opacity-100' : 'opacity-0'\n )}\n />\n )}\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <TruncatedLabel text={label} size={itemRowSize} />\n {item.description && (\n <Text\n as=\"span\"\n variant=\"xs\"\n className=\"truncate text-tertiary\"\n >\n {item.description}\n </Text>\n )}\n </div>\n {item.rightDecorator && (\n <div className=\"ml-auto shrink-0\">{item.rightDecorator}</div>\n )}\n </>\n )}\n </CommandItem>\n );\n });\n\n return (\n <Command\n className={cn(\n 'flex flex-col gap-1.5 p-space-1 outline-hidden',\n className\n )}\n shouldFilter={disableFilter ? false : undefined}\n tabIndex={hideSearch ? 0 : -1}\n >\n {!hideSearch && (\n <CommandInput\n placeholder={placeholder}\n size={inputSize}\n variant={inputVariant}\n leftDecorator={\n <MagnifyingGlassIcon aria-hidden size={16} weight=\"regular\" />\n }\n onValueChange={onSearchChange}\n />\n )}\n <CommandList className=\"outline-hidden\" onScroll={handleScroll}>\n {!loading && (\n <CommandEmpty>\n <Text variant=\"sm\">{emptyText}</Text>\n </CommandEmpty>\n )}\n {items && renderItems(items)}\n {groups?.map((group, i) => (\n <Fragment key={group.heading ?? i}>\n {i > 0 && <CommandSeparator />}\n <CommandGroup heading={group.heading}>\n {renderItems(group.items)}\n </CommandGroup>\n </Fragment>\n ))}\n {loading && (\n <div className=\"flex flex-col gap-space-1 px-space-2 py-space-1\">\n {Array.from({ length: loadingRows }, (_, i) => (\n <div\n key={i}\n className={cn(\n 'animate-pulse rounded-md bg-tertiary',\n OPTION_ROW_SIZES[itemRowSize].minHeightClassName\n )}\n />\n ))}\n </div>\n )}\n </CommandList>\n </Command>\n );\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"CommandMenu.js","names":[],"sources":["../../../src/components/Command/CommandMenu.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { Fragment, useCallback, useEffect, useRef, useState } from 'react';\n\nimport { MagnifyingGlassIcon } from '@phosphor-icons/react/dist/ssr/MagnifyingGlass';\n\nimport { CheckIcon } from '../../icons/PaddedPhosphorIcons';\nimport { cn } from '../../utils/cn';\nimport {\n OPTION_ROW_SIZES,\n type OptionRowSize,\n} from '../../utils/componentSizes';\nimport { Icon } from '../Icon';\nimport type { InputSize, InputVariant } from '../Input/inputStyles';\nimport { Text } from '../Text';\nimport { Tooltip } from '../Tooltip';\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n} from './Command';\n\nexport interface CommandMenuItem {\n /** Unique value used for selection and filtering */\n value: string;\n /** Display label (defaults to value if not provided) */\n label?: string;\n /** Secondary description text displayed below the label */\n description?: string;\n /** Element displayed on the right side of the item (e.g. badge, shortcut) */\n rightDecorator?: ReactNode;\n /** Whether this item is disabled */\n disabled?: boolean;\n /** Extra search terms for filtering */\n keywords?: string[];\n}\n\nexport interface CommandMenuGroup {\n /** Optional heading displayed above the group */\n heading?: string;\n /** Items in this group */\n items: CommandMenuItem[];\n}\n\ninterface CommandMenuBaseProps {\n /** Callback when an item is selected */\n onSelect: (value: string) => void;\n /** The currently selected value. When set, a check icon is shown next to the selected item, and a menu without search opens with it highlighted. */\n value?: string;\n /** Placeholder text for the search input */\n placeholder?: string;\n /** Text shown when no items match the search */\n emptyText?: string;\n /** Hide the search input (default: false, search is visible) */\n hideSearch?: boolean;\n /** Show the leading selected-indicator slot in the default item layout (default: true). Set false for action menus that track no selection so labels sit flush-left. */\n showSelectedIndicator?: boolean;\n /** Disable client-side filtering by cmdk (default: false). Set true for server-side filtering. */\n disableFilter?: boolean;\n /** Callback when the search input value changes. Useful for server-side filtering. */\n onSearchChange?: (query: string) => void;\n /** Custom render function for each item */\n renderItem?: (item: CommandMenuItem, isSelected: boolean) => ReactNode;\n /** Size variant for the search input */\n inputSize?: InputSize;\n /**\n * Controls minimum row height and default label typography.\n * Descriptions and custom content may grow beyond the minimum height.\n */\n itemRowSize?: OptionRowSize;\n /** Visual variant for the search input */\n inputVariant?: InputVariant;\n /** Additional class name for the Command root */\n className?: string;\n /** Whether more items are currently being loaded */\n loading?: boolean;\n /** Number of skeleton rows to show while loading (default: 5) */\n loadingRows?: number;\n /** Callback when the user scrolls near the end of the list. Use for infinite loading. */\n onEndReached?: () => void;\n /** Distance in pixels from the bottom to trigger onEndReached (default: 50) */\n endReachedThresholdPx?: number;\n}\n\nexport type CommandMenuProps = CommandMenuBaseProps &\n (\n | { /** Flat list of items */ items: CommandMenuItem[]; groups?: never }\n | {\n /** Grouped items with optional headings */ groups: CommandMenuGroup[];\n items?: never;\n }\n );\n\nfunction TruncatedLabel({ text, size }: { text: string; size: OptionRowSize }) {\n const textRef = useRef<HTMLElement>(null);\n const [isTruncated, setIsTruncated] = useState(false);\n\n useEffect(() => {\n const el = textRef.current;\n if (el) {\n setIsTruncated(el.scrollWidth > el.clientWidth);\n }\n }, [text, size]);\n\n return (\n <Tooltip title={isTruncated ? text : undefined}>\n <Text\n ref={textRef}\n as=\"span\"\n variant={size}\n className={cn(\n 'truncate tracking-normal',\n size === 'sm' ? 'leading-4' : 'leading-5'\n )}\n >\n {text}\n </Text>\n </Tooltip>\n );\n}\n\nexport function CommandMenu({\n items,\n groups,\n onSelect,\n value,\n placeholder = 'Search...',\n emptyText = 'No results found.',\n hideSearch,\n showSelectedIndicator = true,\n disableFilter,\n onSearchChange,\n renderItem,\n inputSize = 'sm',\n itemRowSize = 'md',\n inputVariant = 'plain',\n className,\n loading = false,\n loadingRows = 5,\n onEndReached,\n endReachedThresholdPx = 50,\n}: CommandMenuProps) {\n // A disabled or missing selection must not prevent cmdk from choosing the first enabled row.\n const menuItems = items ?? groups?.flatMap((group) => group.items) ?? [];\n const canHighlightSelection =\n hideSearch &&\n menuItems.some((item) => item.value === value && !item.disabled);\n\n const handleScroll = useCallback(\n (e: React.UIEvent<HTMLDivElement>) => {\n if (!onEndReached) return;\n const { scrollTop, scrollHeight, clientHeight } = e.currentTarget;\n if (scrollHeight - scrollTop - clientHeight <= endReachedThresholdPx) {\n onEndReached();\n }\n },\n [onEndReached, endReachedThresholdPx]\n );\n\n const renderItems = (menuItems: CommandMenuItem[]) =>\n menuItems.map((item) => {\n const isSelected = item.value === value;\n const label = item.label ?? item.value;\n return (\n <CommandItem\n key={item.value}\n value={item.value}\n keywords={\n item.label ? [item.label, ...(item.keywords ?? [])] : item.keywords\n }\n disabled={item.disabled}\n onSelect={() => onSelect(item.value)}\n size={itemRowSize}\n className={cn(\n 'gap-space-2',\n hideSearch &&\n 'after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] aria-selected:after:border-2 aria-selected:after:border-focus'\n )}\n >\n {renderItem ? (\n renderItem(item, isSelected)\n ) : (\n <>\n {showSelectedIndicator && (\n <Icon\n icon={CheckIcon}\n size=\"md\"\n className={cn(\n 'shrink-0',\n isSelected ? 'opacity-100' : 'opacity-0'\n )}\n />\n )}\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <TruncatedLabel text={label} size={itemRowSize} />\n {item.description && (\n <Text\n as=\"span\"\n variant=\"xs\"\n className=\"truncate text-tertiary\"\n >\n {item.description}\n </Text>\n )}\n </div>\n {item.rightDecorator && (\n <div className=\"ml-auto shrink-0\">{item.rightDecorator}</div>\n )}\n </>\n )}\n </CommandItem>\n );\n });\n\n return (\n <Command\n className={cn(\n 'flex min-h-0 flex-col gap-1.5 p-space-1 outline-hidden',\n className\n )}\n shouldFilter={disableFilter ? false : undefined}\n defaultValue={canHighlightSelection ? value : undefined}\n label={placeholder}\n tabIndex={hideSearch ? 0 : -1}\n >\n {!hideSearch && (\n <CommandInput\n placeholder={placeholder}\n size={inputSize}\n variant={inputVariant}\n leftDecorator={\n <MagnifyingGlassIcon aria-hidden size={16} weight=\"regular\" />\n }\n onValueChange={onSearchChange}\n />\n )}\n {!loading && (\n <CommandEmpty role=\"status\">\n <Text variant=\"sm\">{emptyText}</Text>\n </CommandEmpty>\n )}\n <CommandList\n className=\"outline-hidden\"\n onScroll={handleScroll}\n aria-busy={loading || undefined}\n >\n {items && renderItems(items)}\n {groups?.map((group, i) => (\n <Fragment key={group.heading ?? i}>\n {i > 0 && <CommandSeparator />}\n <CommandGroup heading={group.heading}>\n {renderItems(group.items)}\n </CommandGroup>\n </Fragment>\n ))}\n {loading && (\n <div\n aria-hidden\n className=\"flex flex-col gap-space-1 px-space-2 py-space-1\"\n >\n {Array.from({ length: loadingRows }, (_, i) => (\n <div\n key={i}\n className={cn(\n 'animate-pulse rounded-md bg-tertiary',\n OPTION_ROW_SIZES[itemRowSize].minHeightClassName\n )}\n />\n ))}\n </div>\n )}\n </CommandList>\n </Command>\n );\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SVGProps } from 'react';
|
|
2
|
+
export declare function AnthropicLogo(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
|
|
3
|
+
export declare function GeminiLogo(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
|
|
4
|
+
export declare function OpenAILogo(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//#region packages/components/src/components/ProviderLogo/AnthropicLogo.svg?react
|
|
4
|
+
var SvgAnthropicLogo = (props) => /* @__PURE__ */ jsx("svg", {
|
|
5
|
+
width: 24,
|
|
6
|
+
height: 24,
|
|
7
|
+
viewBox: "0 0 24 24",
|
|
8
|
+
fill: "none",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
...props,
|
|
11
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
12
|
+
d: "M16.865 4H13.3925L19.725 20H23.1975L16.865 4ZM6.8325 4L0.5 20H4.041L5.336 16.64H11.961L13.256 20H16.797L10.4645 4H6.8325ZM6.4815 13.6685L8.6485 8.0455L10.8155 13.6685H6.4815Z",
|
|
13
|
+
fill: "currentColor"
|
|
14
|
+
})
|
|
15
|
+
});
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region packages/components/src/components/ProviderLogo/GeminiLogo.svg?react
|
|
18
|
+
var SvgGeminiLogo = (props) => /* @__PURE__ */ jsxs("svg", {
|
|
19
|
+
width: 18,
|
|
20
|
+
height: 18,
|
|
21
|
+
viewBox: "0 0 18 18",
|
|
22
|
+
fill: "none",
|
|
23
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
24
|
+
...props,
|
|
25
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
26
|
+
d: "M9 16.5C8.71413 14.613 7.8319 12.8671 6.48241 11.5176C5.13288 10.1681 3.38695 9.28587 1.5 9C3.38695 8.71413 5.13288 7.8319 6.48241 6.48241C7.8319 5.13288 8.71413 3.38695 9 1.5C9.28599 3.38691 10.1682 5.1328 11.5177 6.48229C12.8672 7.83178 14.6131 8.71401 16.5 9C14.6131 9.28599 12.8672 10.1682 11.5177 11.5177C10.1682 12.8672 9.28599 14.6131 9 16.5Z",
|
|
27
|
+
fill: "url(#paint0_linear_19414_7666)"
|
|
28
|
+
}), /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", {
|
|
29
|
+
id: "paint0_linear_19414_7666",
|
|
30
|
+
x1: 1.4999,
|
|
31
|
+
y1: 1501.5,
|
|
32
|
+
x2: 1032.45,
|
|
33
|
+
y2: 457.425,
|
|
34
|
+
gradientUnits: "userSpaceOnUse",
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#1C7DFF" }),
|
|
37
|
+
/* @__PURE__ */ jsx("stop", {
|
|
38
|
+
offset: .52021,
|
|
39
|
+
stopColor: "#1C69FF"
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ jsx("stop", {
|
|
42
|
+
offset: 1,
|
|
43
|
+
stopColor: "#F0DCD6"
|
|
44
|
+
})
|
|
45
|
+
]
|
|
46
|
+
}) })]
|
|
47
|
+
});
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region packages/components/src/components/ProviderLogo/OpenAILogo.svg?react
|
|
50
|
+
var SvgOpenAiLogo = (props) => /* @__PURE__ */ jsx("svg", {
|
|
51
|
+
width: 24,
|
|
52
|
+
height: 24,
|
|
53
|
+
viewBox: "0 0 24 24",
|
|
54
|
+
fill: "none",
|
|
55
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
56
|
+
...props,
|
|
57
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
58
|
+
d: "M10.728 6.87187e-05C8.06697 6.87187e-05 5.70284 1.69053 4.8788 4.18561C4.03313 4.35759 3.23429 4.70528 2.53544 5.20556C1.83659 5.70584 1.25375 6.34722 0.825717 7.08703C-0.508866 9.36267 -0.204119 12.2235 1.58379 14.174C1.0318 15.8077 1.22125 17.5955 2.10279 19.0749C3.4292 21.3586 6.09808 22.5289 8.70974 21.9844C9.28156 22.621 9.98439 23.1301 10.7714 23.4777C11.5584 23.8253 12.4114 24.0033 13.2736 24C15.9346 24 18.2988 22.3095 19.1228 19.8144C20.8363 19.4648 22.311 18.4082 23.1677 16.913C24.5105 14.6374 24.2057 11.7765 22.4181 9.82603V9.81797C22.6908 9.01043 22.7855 8.15476 22.696 7.30819C22.6065 6.46162 22.3348 5.64366 21.8991 4.90902C20.5724 2.63338 17.9032 1.46273 15.3 2.00731C14.7256 1.37228 14.0209 0.864934 13.2327 0.518889C12.4445 0.172844 11.5907 -0.00400221 10.728 6.87187e-05ZM10.728 1.56065L10.7198 1.56871C11.7908 1.56871 12.8206 1.93445 13.6444 2.60919C13.6114 2.62532 13.5454 2.66592 13.4961 2.6904L8.65223 5.44553C8.40499 5.58376 8.2567 5.84381 8.2567 6.12834V12.5976L6.17251 11.4111V6.06325C6.17205 4.87037 6.65157 3.72608 7.50573 2.88177C8.35989 2.03746 9.51883 1.56248 10.728 1.56065ZM16.5631 3.44405C17.3658 3.44253 18.1547 3.6501 18.85 4.04579C19.5454 4.44147 20.1225 5.01125 20.5231 5.69752C21.0502 6.60783 21.2479 7.6725 21.0666 8.70463C21.0336 8.68015 20.9679 8.6479 20.9265 8.62342L16.0826 5.85994C15.9608 5.79195 15.8232 5.75622 15.6832 5.75622C15.5432 5.75622 15.4056 5.79195 15.2837 5.85994L9.60763 9.09456V6.72129L14.295 4.04738C14.9842 3.65318 15.7665 3.44499 16.5631 3.44376V3.44405ZM4.58251 5.90054V11.5816C4.58251 11.8661 4.7308 12.1181 4.97804 12.2644L10.6456 15.4909L8.55299 16.6855L3.87377 14.0196C2.82807 13.4217 2.06556 12.4389 1.75362 11.287C1.44167 10.135 1.60578 8.90796 2.20992 7.87524C2.74287 6.96387 3.58222 6.26546 4.58251 5.90054ZM15.4402 7.30647L20.1275 9.97233C22.3107 11.2158 23.0518 13.9629 21.7914 16.1167L21.7996 16.1248C21.2642 17.0351 20.4238 17.734 19.427 18.0917V12.4104C19.427 12.1259 19.2787 11.8658 19.0314 11.7279L13.3557 8.49296L15.4402 7.30647ZM11.9966 9.26533L14.3858 10.6307V13.3532L11.9966 14.7186L9.60763 13.3532V10.6307L11.9966 9.26533ZM15.7531 11.4111L17.8373 12.5976V17.9373C17.8373 20.4244 15.7942 22.44 13.2818 22.44V22.4319C12.219 22.4319 11.181 22.0662 10.3654 21.3917C10.3984 21.3756 10.4725 21.3347 10.5137 21.3102L15.3575 18.5551C15.6048 18.4168 15.7613 18.1568 15.7528 17.8723L15.7531 11.4111ZM14.3937 14.9058V17.2787L9.7063 19.9446C7.52315 21.18 4.73868 20.4486 3.47824 18.3028H3.48642C2.95107 17.4005 2.76133 16.3278 2.9426 15.2957C2.97559 15.3202 3.04156 15.3524 3.08271 15.3769L7.92656 18.1404C8.04842 18.2084 8.18603 18.2441 8.32603 18.2441C8.46603 18.2441 8.60364 18.2084 8.7255 18.1404L14.3937 14.9058Z",
|
|
59
|
+
fill: "currentColor"
|
|
60
|
+
})
|
|
61
|
+
});
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region packages/components/src/components/ProviderLogo/index.tsx
|
|
64
|
+
function AnthropicLogo(props) {
|
|
65
|
+
return /* @__PURE__ */ jsx(SvgAnthropicLogo, { ...props });
|
|
66
|
+
}
|
|
67
|
+
function GeminiLogo(props) {
|
|
68
|
+
return /* @__PURE__ */ jsx(SvgGeminiLogo, { ...props });
|
|
69
|
+
}
|
|
70
|
+
function OpenAILogo(props) {
|
|
71
|
+
return /* @__PURE__ */ jsx(SvgOpenAiLogo, { ...props });
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { AnthropicLogo, GeminiLogo, OpenAILogo };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/ProviderLogo/AnthropicLogo.svg?react","../../../src/components/ProviderLogo/GeminiLogo.svg?react","../../../src/components/ProviderLogo/OpenAILogo.svg?react","../../../src/components/ProviderLogo/index.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst SvgAnthropicLogo = (props) => /* @__PURE__ */ _jsx(\"svg\", {\n\twidth: 24,\n\theight: 24,\n\tviewBox: \"0 0 24 24\",\n\tfill: \"none\",\n\txmlns: \"http://www.w3.org/2000/svg\",\n\t...props,\n\tchildren: /* @__PURE__ */ _jsx(\"path\", {\n\t\td: \"M16.865 4H13.3925L19.725 20H23.1975L16.865 4ZM6.8325 4L0.5 20H4.041L5.336 16.64H11.961L13.256 20H16.797L10.4645 4H6.8325ZM6.4815 13.6685L8.6485 8.0455L10.8155 13.6685H6.4815Z\",\n\t\tfill: \"currentColor\"\n\t})\n});\nexport default SvgAnthropicLogo;\n","import * as React from \"react\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst SvgGeminiLogo = (props) => /* @__PURE__ */ _jsxs(\"svg\", {\n\twidth: 18,\n\theight: 18,\n\tviewBox: \"0 0 18 18\",\n\tfill: \"none\",\n\txmlns: \"http://www.w3.org/2000/svg\",\n\t...props,\n\tchildren: [/* @__PURE__ */ _jsx(\"path\", {\n\t\td: \"M9 16.5C8.71413 14.613 7.8319 12.8671 6.48241 11.5176C5.13288 10.1681 3.38695 9.28587 1.5 9C3.38695 8.71413 5.13288 7.8319 6.48241 6.48241C7.8319 5.13288 8.71413 3.38695 9 1.5C9.28599 3.38691 10.1682 5.1328 11.5177 6.48229C12.8672 7.83178 14.6131 8.71401 16.5 9C14.6131 9.28599 12.8672 10.1682 11.5177 11.5177C10.1682 12.8672 9.28599 14.6131 9 16.5Z\",\n\t\tfill: \"url(#paint0_linear_19414_7666)\"\n\t}), /* @__PURE__ */ _jsx(\"defs\", { children: /* @__PURE__ */ _jsxs(\"linearGradient\", {\n\t\tid: \"paint0_linear_19414_7666\",\n\t\tx1: 1.4999,\n\t\ty1: 1501.5,\n\t\tx2: 1032.45,\n\t\ty2: 457.425,\n\t\tgradientUnits: \"userSpaceOnUse\",\n\t\tchildren: [\n\t\t\t/* @__PURE__ */ _jsx(\"stop\", { stopColor: \"#1C7DFF\" }),\n\t\t\t/* @__PURE__ */ _jsx(\"stop\", {\n\t\t\t\toffset: .52021,\n\t\t\t\tstopColor: \"#1C69FF\"\n\t\t\t}),\n\t\t\t/* @__PURE__ */ _jsx(\"stop\", {\n\t\t\t\toffset: 1,\n\t\t\t\tstopColor: \"#F0DCD6\"\n\t\t\t})\n\t\t]\n\t}) })]\n});\nexport default SvgGeminiLogo;\n","import * as React from \"react\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst SvgOpenAiLogo = (props) => /* @__PURE__ */ _jsx(\"svg\", {\n\twidth: 24,\n\theight: 24,\n\tviewBox: \"0 0 24 24\",\n\tfill: \"none\",\n\txmlns: \"http://www.w3.org/2000/svg\",\n\t...props,\n\tchildren: /* @__PURE__ */ _jsx(\"path\", {\n\t\td: \"M10.728 6.87187e-05C8.06697 6.87187e-05 5.70284 1.69053 4.8788 4.18561C4.03313 4.35759 3.23429 4.70528 2.53544 5.20556C1.83659 5.70584 1.25375 6.34722 0.825717 7.08703C-0.508866 9.36267 -0.204119 12.2235 1.58379 14.174C1.0318 15.8077 1.22125 17.5955 2.10279 19.0749C3.4292 21.3586 6.09808 22.5289 8.70974 21.9844C9.28156 22.621 9.98439 23.1301 10.7714 23.4777C11.5584 23.8253 12.4114 24.0033 13.2736 24C15.9346 24 18.2988 22.3095 19.1228 19.8144C20.8363 19.4648 22.311 18.4082 23.1677 16.913C24.5105 14.6374 24.2057 11.7765 22.4181 9.82603V9.81797C22.6908 9.01043 22.7855 8.15476 22.696 7.30819C22.6065 6.46162 22.3348 5.64366 21.8991 4.90902C20.5724 2.63338 17.9032 1.46273 15.3 2.00731C14.7256 1.37228 14.0209 0.864934 13.2327 0.518889C12.4445 0.172844 11.5907 -0.00400221 10.728 6.87187e-05ZM10.728 1.56065L10.7198 1.56871C11.7908 1.56871 12.8206 1.93445 13.6444 2.60919C13.6114 2.62532 13.5454 2.66592 13.4961 2.6904L8.65223 5.44553C8.40499 5.58376 8.2567 5.84381 8.2567 6.12834V12.5976L6.17251 11.4111V6.06325C6.17205 4.87037 6.65157 3.72608 7.50573 2.88177C8.35989 2.03746 9.51883 1.56248 10.728 1.56065ZM16.5631 3.44405C17.3658 3.44253 18.1547 3.6501 18.85 4.04579C19.5454 4.44147 20.1225 5.01125 20.5231 5.69752C21.0502 6.60783 21.2479 7.6725 21.0666 8.70463C21.0336 8.68015 20.9679 8.6479 20.9265 8.62342L16.0826 5.85994C15.9608 5.79195 15.8232 5.75622 15.6832 5.75622C15.5432 5.75622 15.4056 5.79195 15.2837 5.85994L9.60763 9.09456V6.72129L14.295 4.04738C14.9842 3.65318 15.7665 3.44499 16.5631 3.44376V3.44405ZM4.58251 5.90054V11.5816C4.58251 11.8661 4.7308 12.1181 4.97804 12.2644L10.6456 15.4909L8.55299 16.6855L3.87377 14.0196C2.82807 13.4217 2.06556 12.4389 1.75362 11.287C1.44167 10.135 1.60578 8.90796 2.20992 7.87524C2.74287 6.96387 3.58222 6.26546 4.58251 5.90054ZM15.4402 7.30647L20.1275 9.97233C22.3107 11.2158 23.0518 13.9629 21.7914 16.1167L21.7996 16.1248C21.2642 17.0351 20.4238 17.734 19.427 18.0917V12.4104C19.427 12.1259 19.2787 11.8658 19.0314 11.7279L13.3557 8.49296L15.4402 7.30647ZM11.9966 9.26533L14.3858 10.6307V13.3532L11.9966 14.7186L9.60763 13.3532V10.6307L11.9966 9.26533ZM15.7531 11.4111L17.8373 12.5976V17.9373C17.8373 20.4244 15.7942 22.44 13.2818 22.44V22.4319C12.219 22.4319 11.181 22.0662 10.3654 21.3917C10.3984 21.3756 10.4725 21.3347 10.5137 21.3102L15.3575 18.5551C15.6048 18.4168 15.7613 18.1568 15.7528 17.8723L15.7531 11.4111ZM14.3937 14.9058V17.2787L9.7063 19.9446C7.52315 21.18 4.73868 20.4486 3.47824 18.3028H3.48642C2.95107 17.4005 2.76133 16.3278 2.9426 15.2957C2.97559 15.3202 3.04156 15.3524 3.08271 15.3769L7.92656 18.1404C8.04842 18.2084 8.18603 18.2441 8.32603 18.2441C8.46603 18.2441 8.60364 18.2084 8.7255 18.1404L14.3937 14.9058Z\",\n\t\tfill: \"currentColor\"\n\t})\n});\nexport default SvgOpenAiLogo;\n","import type { SVGProps } from 'react';\n\nimport Anthropic from './AnthropicLogo.svg?react';\nimport Gemini from './GeminiLogo.svg?react';\nimport OpenAI from './OpenAILogo.svg?react';\n\n// Provider marks shared with LangSmith's model selector.\nexport function AnthropicLogo(props: SVGProps<SVGSVGElement>) {\n return <Anthropic {...props} />;\n}\n\nexport function GeminiLogo(props: SVGProps<SVGSVGElement>) {\n return <Gemini {...props} />;\n}\n\nexport function OpenAILogo(props: SVGProps<SVGSVGElement>) {\n return <OpenAI {...props} />;\n}\n"],"mappings":";;;AAEA,IAAM,oBAAoB,UAA0B,oBAAK,OAAO;CAC/D,OAAO;CACP,QAAQ;CACR,SAAS;CACT,MAAM;CACN,OAAO;CACP,GAAG;CACH,UAA0B,oBAAK,QAAQ;EACtC,GAAG;EACH,MAAM;CACP,CAAC;AACF,CAAC;;;ACXD,IAAM,iBAAiB,UAA0B,qBAAM,OAAO;CAC7D,OAAO;CACP,QAAQ;CACR,SAAS;CACT,MAAM;CACN,OAAO;CACP,GAAG;CACH,UAAU,CAAiB,oBAAK,QAAQ;EACvC,GAAG;EACH,MAAM;CACP,CAAC,GAAmB,oBAAK,QAAQ,EAAE,UAA0B,qBAAM,kBAAkB;EACpF,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,eAAe;EACf,UAAU;GACO,oBAAK,QAAQ,EAAE,WAAW,UAAU,CAAC;GACrC,oBAAK,QAAQ;IAC5B,QAAQ;IACR,WAAW;GACZ,CAAC;GACe,oBAAK,QAAQ;IAC5B,QAAQ;IACR,WAAW;GACZ,CAAC;EACF;CACD,CAAC,EAAE,CAAC,CAAC;AACN,CAAC;;;AC7BD,IAAM,iBAAiB,UAA0B,oBAAK,OAAO;CAC5D,OAAO;CACP,QAAQ;CACR,SAAS;CACT,MAAM;CACN,OAAO;CACP,GAAG;CACH,UAA0B,oBAAK,QAAQ;EACtC,GAAG;EACH,MAAM;CACP,CAAC;AACF,CAAC;;;ACND,SAAgB,cAAc,OAAgC;CAC5D,OAAO,oBAAC,kBAAD,EAAW,GAAI,MAAQ,CAAA;AAChC;AAEA,SAAgB,WAAW,OAAgC;CACzD,OAAO,oBAAC,eAAD,EAAQ,GAAI,MAAQ,CAAA;AAC7B;AAEA,SAAgB,WAAW,OAAgC;CACzD,OAAO,oBAAC,eAAD,EAAQ,GAAI,MAAQ,CAAA;AAC7B"}
|
|
@@ -12,6 +12,8 @@ export interface SelectOption<T extends string = string> {
|
|
|
12
12
|
rightDecorator?: ReactNode;
|
|
13
13
|
/** Whether this option is disabled */
|
|
14
14
|
disabled?: boolean;
|
|
15
|
+
/** Extra search terms, such as a provider name */
|
|
16
|
+
keywords?: string[];
|
|
15
17
|
}
|
|
16
18
|
export interface SelectGroup<T extends string = string> {
|
|
17
19
|
heading?: string;
|
|
@@ -61,6 +63,8 @@ interface SelectBaseProps<T extends string = string> extends DataAttributes {
|
|
|
61
63
|
variant?: SelectVariant;
|
|
62
64
|
/** Additional class name for the popover content */
|
|
63
65
|
contentClassName?: string;
|
|
66
|
+
/** Content below the list, such as a link to manage the options */
|
|
67
|
+
footer?: ReactNode;
|
|
64
68
|
/** Custom render function for the selected value in the trigger */
|
|
65
69
|
renderValue?: (option: SelectOption<T>) => ReactNode;
|
|
66
70
|
/** Custom render function for each option in the list */
|