Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(ui): dropdown (#3447)
Fake-User7d55c9e7c121
diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsxindex d368ed7b39..15ef0f523b 100644--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx@@ -65,7 +65,7 @@ import UserIconPhosphor from '@phosphor/user.svg';import UsersThreeIcon from '@phosphor/users-three.svg';import { debounce } from '@solid-primitives/scheduled';import { useLocation } from '@solidjs/router';-import { Button, cn, Dropdown, Hotkey, Layer } from '@ui';+import { Button, cn, Dropdown, Hotkey } from '@ui';import {type Component,createMemo,@@ -584,7 +584,6 @@ const SidebarSettingsWidget = (props: SidebarSettingsWidgetProps) => {return (<Dropdown placement="top-start" gutter={6}><Dropdown.Trigger- as={Button}variant="ghost"class={cn('flex items-center w-full rounded-md cursor-default text-ink-extra-muted not-disabled:hover:bg-ink/3 h-9',@@ -619,57 +618,55 @@ const SidebarSettingsWidget = (props: SidebarSettingsWidgetProps) => {</span><CaretUpIcon class="size-3 text-ink-extra-muted shrink-0 group-data-[slim=true]/sidebar:hidden" /></Dropdown.Trigger>- <Dropdown.Portal>- <Layer depth={3}>- <Dropdown.Content class="min-w-56">- <For each={topItems()}>- {(item) => (- <Dropdown.Item- class="flex items-start gap-2 px-2.5 py-2.5 text-sm cursor-default outline-none text-ink-muted"- onSelect={() => props.onSelect(item.tab)}- >- <span class="size-5 flex items-center justify-center">- <Dynamic- component={item.icon}- class="size-4 shrink-0 text-ink-extra-muted"- />+ <Dropdown.Content depth={3} class="min-w-56">+ <Dropdown.Group>+ <For each={topItems()}>+ {(item) => (+ <Dropdown.Item+ class="flex items-start gap-2 px-2.5 py-2.5 text-sm cursor-default outline-none text-ink-muted"+ onSelect={() => props.onSelect(item.tab)}+ >+ <span class="size-5 flex items-center justify-center">+ <Dynamic+ component={item.icon}+ class="size-4 shrink-0 text-ink-extra-muted"+ />+ </span>+ <div class="flex flex-col min-w-0">+ <span class="text-ink">{item.label}</span>+ <span class="text-xxs text-ink-extra-muted leading-tight">+ {item.description}</span>- <div class="flex flex-col min-w-0">- <span class="text-ink">{item.label}</span>- <span class="text-xxs text-ink-extra-muted leading-tight">- {item.description}- </span>- </div>- </Dropdown.Item>- )}- </For>- <Show when={topItems().length > 0 && bottomItems().length > 0}>- <Dropdown.Separator />- </Show>- <For each={bottomItems()}>- {(item) => (- <Dropdown.Item- class="flex items-start gap-2 px-2.5 py-2.5 text-sm cursor-default outline-none text-ink-muted"- onSelect={() => props.onSelect(item.tab)}- >- <span class="size-5 flex items-center justify-center">- <Dynamic- component={item.icon}- class="size-4 shrink-0 text-ink-extra-muted"- />+ </div>+ </Dropdown.Item>+ )}+ </For>+ <Show when={topItems().length > 0 && bottomItems().length > 0}>+ <Dropdown.Separator />+ </Show>+ <For each={bottomItems()}>+ {(item) => (+ <Dropdown.Item+ class="flex items-start gap-2 px-2.5 py-2.5 text-sm cursor-default outline-none text-ink-muted"+ onSelect={() => props.onSelect(item.tab)}+ >+ <span class="size-5 flex items-center justify-center">+ <Dynamic+ component={item.icon}+ class="size-4 shrink-0 text-ink-extra-muted"+ />+ </span>+ <div class="flex flex-col min-w-0">+ <span class="text-ink">{item.label}</span>+ <span class="text-xxs text-ink-extra-muted leading-tight">+ {item.description}</span>- <div class="flex flex-col min-w-0">- <span class="text-ink">{item.label}</span>- <span class="text-xxs text-ink-extra-muted leading-tight">- {item.description}- </span>- </div>- </Dropdown.Item>- )}- </For>- </Dropdown.Content>- </Layer>- </Dropdown.Portal>+ </div>+ </Dropdown.Item>+ )}+ </For>+ </Dropdown.Group>+ </Dropdown.Content></Dropdown>);};diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/group-dropdown.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/group-dropdown.tsxindex d8b0a992a3..576bd02c93 100644--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/group-dropdown.tsx+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/group-dropdown.tsx@@ -4,7 +4,7 @@ import type {} from '@app/component/next-soup/soup-view/group-options';import CheckIcon from '@phosphor/check.svg';import StackSimpleIcon from '@phosphor/stack-simple.svg';-import { Dropdown, Layer, Tooltip } from '@ui';+import { Dropdown, Tooltip } from '@ui';import { type Component, For, Show } from 'solid-js';interface GroupDropdownProps {@@ -29,35 +29,30 @@ export const GroupDropdown: Component<GroupDropdownProps> = (props) => {<span>Group</span></Dropdown.Trigger></Tooltip>- <Dropdown.Portal>- <Layer depth={2}>- <Dropdown.Content class="min-w-35">- <For each={props.options}>- {(option) => (- <Dropdown.Item- class="w-full flex items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-ink/5 focus:bg-ink/5 outline-none cursor-default rounded-md"- onSelect={() => props.onChange(option.value)}+ <Dropdown.Content class="min-w-35">+ <Dropdown.Group>+ <For each={props.options}>+ {(option) => (+ <Dropdown.Item onSelect={() => props.onChange(option.value)}>+ <span+ class="flex-1 truncate"+ classList={{+ 'text-ink font-medium': props.value() === option.value,+ 'text-ink-muted': props.value() !== option.value,+ }}>- <span- class="flex-1 truncate"- classList={{- 'text-ink font-medium': props.value() === option.value,- 'text-ink-muted': props.value() !== option.value,- }}- >- {option.label}- </span>- <span class="size-3.5 flex items-center justify-center shrink-0">- <Show when={props.value() === option.value}>- <CheckIcon class="size-3 text-accent" />- </Show>- </span>- </Dropdown.Item>- )}- </For>- </Dropdown.Content>- </Layer>- </Dropdown.Portal>+ {option.label}+ </span>+ <span class="size-3.5 flex items-center justify-center shrink-0">+ <Show when={props.value() === option.value}>+ <CheckIcon class="size-3 text-accent" />+ </Show>+ </span>+ </Dropdown.Item>+ )}+ </For>+ </Dropdown.Group>+ </Dropdown.Content></Dropdown>);};diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/sort-dropdown.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/sort-dropdown.tsxindex 2d87b78d4f..fa26e62ffa 100644--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/sort-dropdown.tsx+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/sort-dropdown.tsx@@ -5,7 +5,7 @@ import type {import { TOKENS } from '@core/hotkey/tokens';import CheckIcon from '@phosphor/check.svg';import SortIcon from '@phosphor-icons/core/regular/funnel-simple.svg?component-solid';-import { Dropdown, Layer, Tooltip } from '@ui';+import { Dropdown, Tooltip } from '@ui';import { type Component, For, Show } from 'solid-js';interface SortDropdownProps {@@ -37,42 +37,37 @@ export const SortDropdown: Component<SortDropdownProps> = (props) => {<span>Sort</span></Dropdown.Trigger></Tooltip>- <Dropdown.Portal>- <Layer depth={2}>- <Dropdown.Content class="min-w-35">- <For each={options()}>- {(option) => (- <Dropdown.Item- class="w-full flex items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-ink/5 focus:bg-ink/5 outline-none cursor-default rounded-md"- onSelect={() => props.onChange(option.value)}+ <Dropdown.Content class="min-w-35">+ <Dropdown.Group>+ <For each={options()}>+ {(option) => (+ <Dropdown.Item onSelect={() => props.onChange(option.value)}>+ <Show when={option.icon}>+ {(icon) => (+ <span class="size-3.5 flex items-center justify-center shrink-0 text-ink-muted">+ {icon()()}+ </span>+ )}+ </Show>+ <span+ class="flex-1 truncate"+ classList={{+ 'text-ink font-medium': props.value() === option.value,+ 'text-ink-muted': props.value() !== option.value,+ }}>- <Show when={option.icon}>- {(icon) => (- <span class="size-3.5 flex items-center justify-center shrink-0 text-ink-muted">- {icon()()}- </span>- )}+ {option.label}+ </span>+ <span class="size-3.5 flex items-center justify-center shrink-0">+ <Show when={props.value() === option.value}>+ <CheckIcon class="size-3 text-accent" /></Show>- <span- class="flex-1 truncate"- classList={{- 'text-ink font-medium': props.value() === option.value,- 'text-ink-muted': props.value() !== option.value,- }}- >- {option.label}- </span>- <span class="size-3.5 flex items-center justify-center shrink-0">- <Show when={props.value() === option.value}>- <CheckIcon class="size-3 text-accent" />- </Show>- </span>- </Dropdown.Item>- )}- </For>- </Dropdown.Content>- </Layer>- </Dropdown.Portal>+ </span>+ </Dropdown.Item>+ )}+ </For>+ </Dropdown.Group>+ </Dropdown.Content></Dropdown>);};diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsxindex b4bdfea3d8..290a2dd095 100644--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx@@ -23,7 +23,7 @@ import CheckIcon from '@phosphor/check.svg';import CircleDashedIcon from '@phosphor/circle-dashed.svg';import SlidersHorizontalIcon from '@phosphor-icons/core/regular/sliders-horizontal.svg?component-solid';import { useContacts } from '@queries/contacts/contacts';-import { cn, Dropdown, Layer, Tooltip } from '@ui';+import { cn, Dropdown, Tooltip } from '@ui';import {type Accessor,batch,@@ -61,11 +61,9 @@ const TypeIndicator = (props: { active: boolean }) => (</span>);-const FILTER_MENU_ROW_CLASS =- 'w-full flex items-center gap-2.5 px-3 py-1.5 rounded-md text-left text-xs hover:bg-ink/5 outline-none data-highlighted:bg-ink/5 cursor-default';--const FILTER_MENU_SUBTRIGGER_CLASS =- 'w-full flex items-center justify-between gap-2 px-3 py-1.5 rounded-md text-left text-xs hover:bg-ink/5 outline-none data-highlighted:bg-ink/5 cursor-default';+// Sub-trigger rows differ from default Dropdown.Item only by+// distributing label + caret to the row ends.+// const FILTER_MENU_SUBTRIGGER_CLASS = 'justify-between gap-2';export type FilterOption = {id: FilterID;@@ -401,10 +399,9 @@ const SearchableFilterSubmenu = (props: {});return (- <Dropdown.Sub gutter={4} open={isOpen()} onOpenChange={setIsOpen}>+ <Dropdown.Sub open={isOpen()} onOpenChange={setIsOpen}><Dropdown.SubTrigger- class={cn(FILTER_MENU_SUBTRIGGER_CLASS, 'py-2')}- onPointerEnter={(e) => {+ onPointerEnter={(e: PointerEvent & { currentTarget: HTMLElement }) => {// Kobalte's "grace polygon" keeps an open sub alive when the// pointer crosses toward its content. For sibling In/From triggers,// that means moving between them leaves the prior sub stuck open@@ -420,20 +417,16 @@ const SearchableFilterSubmenu = (props: {<CaretRightIcon class="size-3 text-ink-muted" /></Dropdown.SubTrigger>- <Dropdown.Portal>- <Layer depth={2}>- <Dropdown.SubContent class="z-action-menu bg-surface ring-1 ring-edge-muted rounded-sm shadow-xl w-65 max-w-[90vw] overflow-hidden">- <SearchableMultiSelectInline- options={props.options}- activeIds={props.activeIds}- onChange={props.onChange}- placeholder={props.placeholder}- inputRef={setInputRef}- onRequestClose={() => setIsOpen(false)}- />- </Dropdown.SubContent>- </Layer>- </Dropdown.Portal>+ <Dropdown.SubContent class="w-65 max-w-[90vw]">+ <SearchableMultiSelectInline+ options={props.options}+ activeIds={props.activeIds}+ onChange={props.onChange}+ placeholder={props.placeholder}+ inputRef={setInputRef}+ onRequestClose={() => setIsOpen(false)}+ />+ </Dropdown.SubContent></Dropdown.Sub>);};@@ -446,39 +439,36 @@ function SingleValueSubmenu<T>(props: {onSelect: (value: T) => void;}) {return (- <Dropdown.Sub gutter={4}>- <Dropdown.SubTrigger class={FILTER_MENU_SUBTRIGGER_CLASS}>+ <Dropdown.Sub>+ <Dropdown.SubTrigger><span class="text-ink">{props.label}</span><CaretRightIcon class="size-3 text-ink-muted" /></Dropdown.SubTrigger>- <Dropdown.Portal>- <Layer depth={2}>- <Dropdown.SubContent class="z-action-menu bg-surface ring-1 ring-edge-muted rounded-sm shadow-xl min-w-40 p-1">- <For each={props.options}>- {(option) => {- const active = () => props.current() === option.value;- return (- <Dropdown.Item- class={FILTER_MENU_ROW_CLASS}- onSelect={() => props.onSelect(option.value)}- closeOnSelect+ <Dropdown.SubContent class="min-w-40">+ <Dropdown.Group>+ <For each={props.options}>+ {(option) => {+ const active = () => props.current() === option.value;+ return (+ <Dropdown.Item+ onSelect={() => props.onSelect(option.value)}+ closeOnSelect+ >+ <TypeIndicator active={active()} />+ <span+ class={cn(+ 'flex-1 truncate',+ active() ? 'text-ink' : 'text-ink-muted'+ )}>- <TypeIndicator active={active()} />- <span- class={cn(- 'flex-1 truncate',- active() ? 'text-ink' : 'text-ink-muted'- )}- >- {option.label}- </span>- </Dropdown.Item>- );- }}- </For>- </Dropdown.SubContent>- </Layer>- </Dropdown.Portal>+ {option.label}+ </span>+ </Dropdown.Item>+ );+ }}+ </For>+ </Dropdown.Group>+ </Dropdown.SubContent></Dropdown.Sub>);}@@ -613,11 +603,7 @@ const SearchIndexItem = (props: {active: Accessor<boolean>;onSelect: () => void;}) => (- <Dropdown.Item- class={FILTER_MENU_ROW_CLASS}- onSelect={props.onSelect}- closeOnSelect- >+ <Dropdown.Item onSelect={props.onSelect} closeOnSelect><SearchIndexRowLabel option={props.option} active={props.active} /></Dropdown.Item>);@@ -637,9 +623,8 @@ const SearchIndexSubRow = (props: {closeRoot: () => void;children: JSX.Element;}) => (- <Dropdown.Sub gutter={4}>+ <Dropdown.Sub><Dropdown.SubTrigger- class={FILTER_MENU_ROW_CLASS}onPointerDown={props.onSelect}onKeyDown={(e) => {if (e.key === 'Enter' || e.key === ' ') {@@ -653,13 +638,9 @@ const SearchIndexSubRow = (props: {<SearchIndexRowLabel option={props.option} active={props.active} /><CaretRightIcon class="size-3 text-ink-muted" /></Dropdown.SubTrigger>- <Dropdown.Portal>- <Layer depth={2}>- <Dropdown.SubContent class="z-action-menu bg-surface ring-1 ring-edge-muted rounded-sm shadow-xl min-w-45 p-1">- {props.children}- </Dropdown.SubContent>- </Layer>- </Dropdown.Portal>+ <Dropdown.SubContent class="min-w-45">+ <Dropdown.Group>{props.children}</Dropdown.Group>+ </Dropdown.SubContent></Dropdown.Sub>);@@ -814,199 +795,184 @@ export const UnifiedFilterDropdown = () => {</Dropdown.Trigger></Tooltip>- <Dropdown.Portal>- <Layer depth={2}>- <Dropdown.Content class="min-w-45">- <Show- when={- categories().length === 1 && !isTasksView() && !isSearchView()- }- fallback={- <>- <For each={categories()}>- {(category) => (- <Dropdown.Sub gutter={4}>- <Dropdown.SubTrigger- class={FILTER_MENU_SUBTRIGGER_CLASS}- >- <span class="text-ink">{category.label}</span>- <CaretRightIcon class="size-3 text-ink-muted" />- </Dropdown.SubTrigger>-- <Dropdown.Portal>- <Layer depth={2}>- <Dropdown.SubContent class="min-w-40">- <For each={category.options}>- {(option) => {- const active = () =>- isOptionActive(option.id);- return (- <Dropdown.Item- class={FILTER_MENU_ROW_CLASS}- onSelect={() => toggleFilter(option.id)}- closeOnSelect={!category.multiple}- >- <span- class={cn(- 'size-4 flex items-center justify-center shrink-0 rounded border',- active()- ? 'bg-accent border-accent'- : 'border-edge'- )}- >- <Show when={active()}>- <CheckIcon class="size-2.5 text-surface" />- </Show>- </span>-- <Show when={option.icon}>- {(icon) => (- <span class="size-4 flex items-center justify-center shrink-0">- {icon()()}- </span>- )}- </Show>-- <span- class={cn(- 'flex-1 truncate',- active()- ? 'text-ink'- : 'text-ink-muted'- )}- >- {option.label}+ <Dropdown.Content class="min-w-45">+ <Dropdown.Group>+ <Show+ when={+ categories().length === 1 && !isTasksView() && !isSearchView()+ }+ fallback={+ <>+ <For each={categories()}>+ {(category) => (+ <Dropdown.Sub>+ <Dropdown.SubTrigger>+ <span class="text-ink">{category.label}</span>+ <CaretRightIcon class="size-3 text-ink-muted" />+ </Dropdown.SubTrigger>++ <Dropdown.SubContent class="min-w-40">+ <Dropdown.Group>+ <For each={category.options}>+ {(option) => {+ const active = () => isOptionActive(option.id);+ return (+ <Dropdown.Item+ onSelect={() => toggleFilter(option.id)}+ closeOnSelect={!category.multiple}+ >+ <span+ class={cn(+ 'size-4 flex items-center justify-center shrink-0 rounded border',+ active()+ ? 'bg-accent border-accent'+ : 'border-edge'+ )}+ >+ <Show when={active()}>+ <CheckIcon class="size-2.5 text-surface" />+ </Show>+ </span>++ <Show when={option.icon}>+ {(icon) => (+ <span class="size-4 flex items-center justify-center shrink-0">+ {icon()()}</span>- </Dropdown.Item>- );- }}- </For>- </Dropdown.SubContent>- </Layer>- </Dropdown.Portal>- </Dropdown.Sub>- )}+ )}+ </Show>++ <span+ class={cn(+ 'flex-1 truncate',+ active() ? 'text-ink' : 'text-ink-muted'+ )}+ >+ {option.label}+ </span>+ </Dropdown.Item>+ );+ }}+ </For>+ </Dropdown.Group>+ </Dropdown.SubContent>+ </Dropdown.Sub>+ )}+ </For>++ {/* Assignee filter for tasks view */}+ <Show when={isTasksView()}>+ <SearchableFilterSubmenu+ label="Assignee"+ options={assigneeOptions}+ activeIds={assigneeFilter}+ onChange={handleAssigneeChange}+ placeholder="Search assignees..."+ />+ </Show>++ {/* Search view: 7 type rows (Channels/Email have nested submenus) */}+ <Show when={isSearchView()}>+ <For each={INDEX_OPTIONS}>+ {(option) => {+ const rowProps = {+ option,+ active: () => soup.predicates.isActive(option.value),+ onSelect: () => handleIndexChange(option.value),+ closeRoot: () => setOpen(false),+ };+ return (+ <Switch fallback={<SearchIndexItem {...rowProps} />}>+ <Match when={option.value === 'channels'}>+ <SearchIndexSubRow {...rowProps}>+ <ChannelSearchSubContent+ channel={channel}+ channelOptions={inChannelOptions}+ senderOptions={fromSenderOptions}+ />+ </SearchIndexSubRow>+ </Match>+ <Match when={option.value === 'email'}>+ <SearchIndexSubRow {...rowProps}>+ <EmailSearchSubContent email={email} />+ </SearchIndexSubRow>+ </Match>+ <Match when={option.value === 'calls'}>+ <SearchIndexSubRow {...rowProps}>+ <CallSearchSubContent+ call={call}+ channelOptions={inChannelOptions}+ senderOptions={fromSenderOptions}+ />+ </SearchIndexSubRow>+ </Match>+ </Switch>+ );+ }}</For>- {/* Assignee filter for tasks view */}- <Show when={isTasksView()}>- <SearchableFilterSubmenu- label="Assignee"- options={assigneeOptions}- activeIds={assigneeFilter}- onChange={handleAssigneeChange}- placeholder="Search assignees..."- />- </Show>-- {/* Search view: 7 type rows (Channels/Email have nested submenus) */}- <Show when={isSearchView()}>- <For each={INDEX_OPTIONS}>- {(option) => {- const rowProps = {- option,- active: () =>- soup.predicates.isActive(option.value),- onSelect: () => handleIndexChange(option.value),- closeRoot: () => setOpen(false),- };- return (- <Switch- fallback={<SearchIndexItem {...rowProps} />}- >- <Match when={option.value === 'channels'}>- <SearchIndexSubRow {...rowProps}>- <ChannelSearchSubContent- channel={channel}- channelOptions={inChannelOptions}- senderOptions={fromSenderOptions}- />- </SearchIndexSubRow>- </Match>- <Match when={option.value === 'email'}>- <SearchIndexSubRow {...rowProps}>- <EmailSearchSubContent email={email} />- </SearchIndexSubRow>- </Match>- <Match when={option.value === 'calls'}>- <SearchIndexSubRow {...rowProps}>- <CallSearchSubContent- call={call}- channelOptions={inChannelOptions}- senderOptions={fromSenderOptions}- />- </SearchIndexSubRow>- </Match>- </Switch>- );- }}- </For>-- {/* All row */}- <Dropdown.Item- class={FILTER_MENU_ROW_CLASS}- onSelect={() => handleIndexChange('all')}- closeOnSelect+ {/* All row */}+ <Dropdown.Item+ onSelect={() => handleIndexChange('all')}+ closeOnSelect+ >+ <TypeIndicator active={!hasActiveIndex()} />+ <span+ class={cn(+ 'flex-1 truncate',+ !hasActiveIndex() ? 'text-ink' : 'text-ink-muted'+ )}>- <TypeIndicator active={!hasActiveIndex()} />- <span- class={cn(- 'flex-1 truncate',- !hasActiveIndex() ? 'text-ink' : 'text-ink-muted'- )}- >- All- </span>- </Dropdown.Item>- </Show>- </>- }- >- {/* Single category: render options directly */}- <For each={categories()[0]!.options}>- {(option) => {- const active = () => isOptionActive(option.id);- return (- <Dropdown.Item- class={FILTER_MENU_ROW_CLASS}- onSelect={() => toggleFilter(option.id)}- closeOnSelect={!categories()[0]!.multiple}+ All+ </span>+ </Dropdown.Item>+ </Show>+ </>+ }+ >+ {/* Single category: render options directly */}+ <For each={categories()[0]!.options}>+ {(option) => {+ const active = () => isOptionActive(option.id);+ return (+ <Dropdown.Item+ onSelect={() => toggleFilter(option.id)}+ closeOnSelect={!categories()[0]!.multiple}+ >+ <span+ class={cn(+ 'size-4 flex items-center justify-center shrink-0 rounded border',+ active() ? 'bg-accent border-accent' : 'border-edge'+ )}>- <span- class={cn(- 'size-4 flex items-center justify-center shrink-0 rounded border',- active() ? 'bg-accent border-accent' : 'border-edge'- )}- >- <Show when={active()}>- <CheckIcon class="size-2.5 text-surface" />- </Show>- </span>-- <Show when={option.icon}>- {(icon) => (- <span class="size-4 flex items-center justify-center shrink-0">- {icon()()}- </span>- )}+ <Show when={active()}>+ <CheckIcon class="size-2.5 text-surface" /></Show>-- <span- class={cn(- 'flex-1 truncate',- active() ? 'text-ink' : 'text-ink-muted'- )}- >- {option.label}- </span>- </Dropdown.Item>- );- }}- </For>- </Show>- </Dropdown.Content>- </Layer>- </Dropdown.Portal>+ </span>++ <Show when={option.icon}>+ {(icon) => (+ <span class="size-4 flex items-center justify-center shrink-0">+ {icon()()}+ </span>+ )}+ </Show>++ <span+ class={cn(+ 'flex-1 truncate',+ active() ? 'text-ink' : 'text-ink-muted'+ )}+ >+ {option.label}+ </span>+ </Dropdown.Item>+ );+ }}+ </For>+ </Show>+ </Dropdown.Group>+ </Dropdown.Content></Dropdown></Show>);diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view-create-button.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view-create-button.tsxindex 7de498d4c0..5a90dabda7 100644--- a/js/app/packages/app/component/next-soup/soup-view/soup-view-create-button.tsx+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view-create-button.tsx@@ -13,7 +13,7 @@ import {import ChevronDownIcon from '@phosphor/caret-down.svg';import PlusCircleIcon from '@phosphor/plus.svg';import UploadIcon from '@phosphor/upload-simple.svg';-import { Button, cn, Dropdown, Layer } from '@ui';+import { Button, cn, Dropdown } from '@ui';import { createMemo, For, Show } from 'solid-js';import { NewCallButton } from './NewCallButton';@@ -169,27 +169,20 @@ export const SoupViewCreateButton = () => {</Show><ChevronDownIcon class="size-2.5" /></Dropdown.Trigger>- <Dropdown.Portal>- <Layer depth={2}>- <Dropdown.Content class="min-w-35">- <For each={options()}>- {(item) => (- <Dropdown.Item- class="w-full flex items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-ink/5 focus:bg-ink/5 outline-none cursor-default rounded-md"- onSelect={() => handleSelect(item)}- >- <span class="size-3.5 flex items-center justify-center shrink-0 text-ink-muted">- <CreateOptionIcon id={item.id} />- </span>- <span class="flex-1 truncate text-ink-muted">- {item.label}- </span>- </Dropdown.Item>- )}- </For>- </Dropdown.Content>- </Layer>- </Dropdown.Portal>+ <Dropdown.Content class="min-w-35">+ <Dropdown.Group>+ <For each={options()}>+ {(item) => (+ <Dropdown.Item onSelect={() => handleSelect(item)}>+ <span class="size-3.5 flex items-center justify-center shrink-0 text-ink-muted">+ <CreateOptionIcon id={item.id} />+ </span>+ <span class="flex-1 truncate text-ink-muted">{item.label}</span>+ </Dropdown.Item>+ )}+ </For>+ </Dropdown.Group>+ </Dropdown.Content></Dropdown>);diff --git a/js/app/packages/ui/components/Dropdown.tsx b/js/app/packages/ui/components/Dropdown.tsxindex cafdcb3ed9..5b3ce3a31f 100644--- a/js/app/packages/ui/components/Dropdown.tsx+++ b/js/app/packages/ui/components/Dropdown.tsx@@ -1,43 +1,126 @@import { DropdownMenu as KobalteDropdownMenu } from '@kobalte/core/dropdown-menu';import { Button, type ButtonProps } from './Button';+import { Surface, type SurfaceProps } from './Surface';import { cn } from '../utils/classname';-import type { ComponentProps } from 'solid-js';+import { splitProps, type ComponentProps } from 'solid-js';/*<Dropdown><Dropdown.Trigger>Filter</Dropdown.Trigger>- <Dropdown.Portal>- <Dropdown.Content>+ <Dropdown.Content>+ <Dropdown.Group><Dropdown.Item></Dropdown.Item>- </Dropdown.Content>- </Dropdown.Portal>+ </Dropdown.Group>+ </Dropdown.Content></Dropdown>*/-type DropdownTriggerProps = ComponentProps<typeof KobalteDropdownMenu.Trigger> & ButtonProps;-type DropdownContentProps = ComponentProps<typeof KobalteDropdownMenu.Content>;-type DropdownSubContentProps = ComponentProps<typeof KobalteDropdownMenu.SubContent>;-type DropdownItemProps = ComponentProps<typeof KobalteDropdownMenu.Item>;-type DropdownSeparatorProps = ComponentProps<typeof KobalteDropdownMenu.Separator>;+/*+// Kobalte's "grace polygon" keeps an open sub alive when the+// pointer crosses toward its content. For sibling In/From triggers,+// that means moving between them leaves the prior sub stuck open+// and the prior trigger stuck with data-highlighted. Force focus+// + open so Kobalte's parent selection manager updates to this+// trigger and the shared signal closes the sibling.+*/++// const DROPDOWN_CONTENT_CLASS = 'z-action-menu bg-surface rounded-xl ring-1 ring-edge shadow-[0_8px_24px_-16px_rgba(0,0,0,0.24),0_2px_8px_-6px_rgba(0,0,0,0.18)] p-1.5';+// const DROPDOWN_ITEM_CLASS = 'rounded-md hover:bg-ink/3 focus:bg-ink/3 data-[highlighted]:bg-ink/3';+// const DROPDOWN_SEPARATOR_CLASS = 'h-px bg-edge-muted border-0 -mx-1.5 my-1';-const DROPDOWN_CONTENT_CLASS = 'z-action-menu bg-surface rounded-xl ring-1 ring-edge shadow-[0_8px_24px_-16px_rgba(0,0,0,0.24),0_2px_8px_-6px_rgba(0,0,0,0.18)] p-1.5';-const DROPDOWN_ITEM_CLASS = 'rounded-md hover:bg-ink/3 focus:bg-ink/3 data-[highlighted]:bg-ink/3';-const DROPDOWN_SEPARATOR_CLASS = 'h-px bg-edge-muted border-0 -mx-1.5 my-1';+export type DropdownSubContentProps = ComponentProps<typeof KobalteDropdownMenu.SubContent> & { depth?: SurfaceProps['depth']; mount?: PortalMount; };+export type DropdownContentProps = ComponentProps<typeof KobalteDropdownMenu.Content> & { depth?: SurfaceProps['depth']; mount?: PortalMount; };+export type DropdownTriggerProps = ComponentProps<typeof KobalteDropdownMenu.Trigger> & ButtonProps;+export type DropdownItemIndicatorProps = ComponentProps<typeof KobalteDropdownMenu.ItemIndicator>;+export type DropdownSubTriggerProps = ComponentProps<typeof KobalteDropdownMenu.SubTrigger>;+export type DropdownRadioItemProps = ComponentProps<typeof KobalteDropdownMenu.RadioItem>;+export type DropdownGroupProps = ComponentProps<typeof KobalteDropdownMenu.Group>;+export type DropdownItemProps = ComponentProps<typeof KobalteDropdownMenu.Item>;+export type DropdownSubProps = ComponentProps<typeof KobalteDropdownMenu.Sub>;+type PortalMount = ComponentProps<typeof KobalteDropdownMenu.Portal>['mount'];++const ROW_CLASS = 'rounded-lg w-full flex items-center gap-2.5 px-2 h-8 text-left text-xs cursor-default outline-none hover:bg-ink/5 data-highlighted:bg-ink/5 data-disabled:opacity-50 data-disabled:cursor-not-allowed';+const CONTENT_CLASS ='rounded-xl flex flex-col size-auto z-action-menu gap-1 bg-edge-muted ';function DropdownContent(props: DropdownContentProps) {- return <KobalteDropdownMenu.Content {...props} class={cn(DROPDOWN_CONTENT_CLASS, props.class)} />;+ const [local, rest] = splitProps(props, ['depth', 'class', 'mount']);+ return (+ <KobalteDropdownMenu.Portal mount={local.mount}>+ <KobalteDropdownMenu.Content+ class={cn(CONTENT_CLASS, local.class)}+ depth={local.depth ?? 2}+ as={Surface}+ {...rest}+ />+ </KobalteDropdownMenu.Portal>+ );}function DropdownSubContent(props: DropdownSubContentProps) {- return <KobalteDropdownMenu.SubContent {...props} class={cn(DROPDOWN_CONTENT_CLASS, props.class)} />;+ const [local, rest] = splitProps(props, ['depth', 'class', 'mount']);+ return (+ <KobalteDropdownMenu.Portal mount={local.mount}>+ <KobalteDropdownMenu.SubContent+ class={cn(CONTENT_CLASS, local.class)}+ depth={local.depth ?? 2}+ as={Surface}+ {...rest}+ />+ </KobalteDropdownMenu.Portal>+ );}-function DropdownItem(props: DropdownItemProps) {- return <KobalteDropdownMenu.Item {...props} class={cn(props.class, DROPDOWN_ITEM_CLASS)} />;+function DropdownGroup(props: DropdownGroupProps) {+ const [local, rest] = splitProps(props, ['class']);+ return (+ <KobalteDropdownMenu.Group+ class={cn('flex flex-col p-1.5 gap-0.5 bg-surface', local.class)}+ {...rest}+ />+ );+}++function DropdownItemIndicator(props: DropdownItemIndicatorProps) {+ return <KobalteDropdownMenu.ItemIndicator {...props} />;+}++function DropdownSubTrigger(props: DropdownSubTriggerProps) {+ const [local, rest] = splitProps(props, ['class']);+ return (+ <KobalteDropdownMenu.SubTrigger+ class={cn(ROW_CLASS, 'justify-between', local.class)}+ {...rest}+ />+ );+}++function DropdownRadioItem(props: DropdownRadioItemProps) {+ const [local, rest] = splitProps(props, ['class']);+ return (+ <KobalteDropdownMenu.RadioItem+ class={cn(ROW_CLASS, local.class)}+ {...rest}+ />+ );+}++function DropdownSub(props: DropdownSubProps) {+ return (+ <KobalteDropdownMenu.Sub+ gutter={12}+ {...props}+ />+ );}-function DropdownSeparator(props: DropdownSeparatorProps) {- return <KobalteDropdownMenu.Separator {...props} class={cn(DROPDOWN_SEPARATOR_CLASS, props.class)} />;+function DropdownItem(props: DropdownItemProps) {+ const [local, rest] = splitProps(props, ['class']);+ return (+ <KobalteDropdownMenu.Item+ class={cn(ROW_CLASS, local.class)}+ {...rest}+ />+ );}function DropdownTrigger(props: DropdownTriggerProps) {@@ -52,21 +135,15 @@ function DropdownTrigger(props: DropdownTriggerProps) {}export const Dropdown = Object.assign((props: ComponentProps<typeof KobalteDropdownMenu>) => (<KobalteDropdownMenu {...props} />), {- ItemDescription: KobalteDropdownMenu.ItemDescription, /* todo */- ItemIndicator: KobalteDropdownMenu.ItemIndicator, /* todo */- CheckboxItem: KobalteDropdownMenu.CheckboxItem, /* todo */- RadioGroup: KobalteDropdownMenu.RadioGroup, /* todo */- GroupLabel: KobalteDropdownMenu.GroupLabel, /* todo */+ RadioGroup: KobalteDropdownMenu.RadioGroup, /* passthrough — pure logical wrapper */+ Separator: KobalteDropdownMenu.Separator, /* passthrough — styled via class at use sites */+ ItemIndicator: DropdownItemIndicator,SubContent: DropdownSubContent,- SubTrigger: KobalteDropdownMenu.SubTrigger, /* todo */- ItemLabel: KobalteDropdownMenu.ItemLabel, /* todo */- RadioItem: KobalteDropdownMenu.RadioItem, /* todo */+ SubTrigger: DropdownSubTrigger,+ RadioItem: DropdownRadioItem,Content: DropdownContent,- Portal: KobalteDropdownMenu.Portal, /* todo */- Group: KobalteDropdownMenu.Group, /* todo */- Item: DropdownItem,- Separator: DropdownSeparator,- Icon: KobalteDropdownMenu.Icon, /* todo */- Sub: KobalteDropdownMenu.Sub, /* todo */Trigger: DropdownTrigger,+ Group: DropdownGroup,+ Item: DropdownItem,+ Sub: DropdownSub,});diff --git a/js/app/packages/ui/components/Surface.tsx b/js/app/packages/ui/components/Surface.tsxindex eafd4148f8..c6433269b1 100644--- a/js/app/packages/ui/components/Surface.tsx+++ b/js/app/packages/ui/components/Surface.tsx@@ -31,8 +31,6 @@ export function Surface(props: SurfaceProps) {}}class={cn('relative rounded-md overflow-clip min-h-0 size-full',- "after:content-[''] after:absolute after:inset-0 after:pointer-events-none after:rounded-[inherit] after:z-10",- 'after:shadow-[inset_0_0_4px_var(--color-shadow)]',local.class,)}{...rest}@@ -42,3 +40,9 @@ export function Surface(props: SurfaceProps) {</Layer>);}++/*+shadow sudo element+"after:content-[''] after:absolute after:inset-0 after:pointer-events-none after:rounded-[inherit] after:z-10",+'after:shadow-[inset_0_0_4px_var(--color-shadow)]'"+*/