Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(settings): return settings to previous tab state, try a more standard settings position (#3424)

Seamus0d4685c1a026
diff --git a/js/app/packages/app/component/GlobalHotkeys.tsx b/js/app/packages/app/component/GlobalHotkeys.tsx
index ed9e2cf989..b1e02fdf51 100644
--- a/js/app/packages/app/component/GlobalHotkeys.tsx
+++ b/js/app/packages/app/component/GlobalHotkeys.tsx
@@ -5,7 +5,10 @@ import { useLogout } from '@core/auth/logout';
import { useOpenInstructionsMd } from '@core/component/AI/util/instructions';
import { toast } from '@core/component/Toast/Toast';
import { LOCAL_ONLY } from '@core/constant/featureFlags';
-import { useSettingsState } from '@core/constant/SettingsState';
+import {
+ type SettingsTab,
+ useSettingsState,
+} from '@core/constant/SettingsState';
import { TOKENS } from '@core/hotkey/tokens';
import {
handleFolderSelect,
@@ -95,7 +98,8 @@ export default function GlobalShortcuts() {
useHotkeyAnalytics();
- const { toggleSettings, openSettings } = useSettingsState();
+ const { openSettings, closeSettings, settingsOpen, setActiveTabId } =
+ useSettingsState();
const logout = useLogout();
const handleFileUpload = useHandleFileUpload();
@@ -176,13 +180,36 @@ export default function GlobalShortcuts() {
keyDownHandler: createNewSplit,
});
+ const openSettingsInNewSplit = (tab?: SettingsTab) => {
+ if (settingsOpen()) {
+ if (tab) setActiveTabId(tab);
+ return;
+ }
+ if (canFit()) {
+ if (tab) setActiveTabId(tab);
+ analytics.track('split_created', { from: 'global_hotkey' });
+ openWithSplit(
+ { type: 'component', id: 'settings' },
+ {
+ referredFrom: 'hotkey',
+ allowDuplicate: true,
+ preferNewSplit: true,
+ mergeHistory: false,
+ }
+ );
+ return;
+ }
+ openSettings(tab);
+ };
+
registerHotkey({
hotkeyToken: TOKENS.global.toggleSettings,
hotkey: 'cmd+;',
scopeId: 'global',
description: 'Toggle settings',
keyDownHandler: () => {
- toggleSettings();
+ if (settingsOpen()) closeSettings();
+ else openSettingsInNewSplit();
return true;
},
runWithInputFocused: true,
@@ -193,7 +220,7 @@ export default function GlobalShortcuts() {
description: 'Account',
icon: UserIcon,
keyDownHandler: () => {
- openSettings('Account & Team');
+ openSettingsInNewSplit('Account');
return true;
},
runWithInputFocused: true,
diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsx
index 05936d6c7b..c6d686d909 100644
--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx
+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx
@@ -14,25 +14,36 @@ import {
LIST_VIEW_PATHS,
type ListView,
} from '@app/constants/list-views';
+import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { useHotkeyInterceptor } from '@app/signal/hotkeyRoot';
import { clearSidebarBadge, hasSidebarBadge } from '@app/signal/sidebarBadges';
import { globalSplitManager } from '@app/signal/splitLayout';
import { InCallPanel } from '@channel/Call';
import { useCallContextOptional } from '@channel/Call/CallContext';
import { ContextMenuContent, MenuItem } from '@core/component/Menu';
-
-import { ENABLE_CALLS } from '@core/constant/featureFlags';
-import { useSettingsState } from '@core/constant/SettingsState';
+import { UserIcon } from '@core/component/UserIcon';
+import {
+ DEV_MODE_ENV,
+ ENABLE_APP_STORE_QR_CODE,
+ ENABLE_CALLS,
+ ENABLE_TEAMS_OVERRIDE,
+} from '@core/constant/featureFlags';
+import {
+ type SettingsTab,
+ useSettingsState,
+} from '@core/constant/SettingsState';
+import { useUserId } from '@core/context/user';
import { registerHotkey } from '@core/hotkey/hotkeys';
import { clearPressedKeys } from '@core/hotkey/state';
import { type HotkeyToken, TOKENS } from '@core/hotkey/tokens';
import type { ValidHotkey } from '@core/hotkey/types';
import { activateClosestDOMScope } from '@core/hotkey/utils';
+import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
import LogoIcon from '@icon/macro-logo.svg';
import SquareSidebarIcon from '@icon/square-sidebar.svg';
import { AnimatedCallIcon } from '@icon/wide-call';
import { AnimatedChannelIcon } from '@icon/wide-channel';
-import { AnimatedCommandIcon } from '@icon/wide-command';
import CommandKIcon from '@icon/wide-command-k.svg';
import { AnimatedEmailIcon } from '@icon/wide-email';
import { AnimatedFileMdIcon } from '@icon/wide-fileMd';
@@ -46,12 +57,16 @@ import { AnimatedTaskIcon } from '@icon/wide-task';
import { ContextMenu } from '@kobalte/core/context-menu';
import { useNotificationSettings } from '@notifications';
import BellIcon from '@phosphor/bell.svg';
+import CaretUpIcon from '@phosphor/caret-up.svg';
import DeviceMobileIcon from '@phosphor/device-mobile-speaker.svg';
+import KeyboardIcon from '@phosphor/keyboard.svg';
import PaintBucketIcon from '@phosphor/paint-bucket.svg';
+import PlugIcon from '@phosphor/plug.svg';
+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, Hotkey } from '@ui';
+import { Button, cn, Dropdown, Hotkey, Layer } from '@ui';
import {
type Component,
createEffect,
@@ -384,15 +399,123 @@ type SidebarActionButtonProps = {
label: string;
};
-const KeyboardShortcutsIcon = (props: { triggerAnimation?: boolean }) => (
- <AnimatedCommandIcon triggerAnimation={props.triggerAnimation} />
-);
+type SidebarShortcutLinkProps = {
+ label: string;
+ icon: Component<{ triggerAnimation?: boolean; class?: string }>;
+ onClick: () => void;
+ isSlim: () => boolean;
+};
+
+const SidebarShortcutLink = (props: SidebarShortcutLinkProps) => {
+ const [isHovering, setIsHovering] = createSignal(false);
+
+ return (
+ <Button
+ draggable={false}
+ variant="ghost"
+ class={cn(
+ 'flex items-center justify-start text-sm gap-2 cursor-default w-full rounded-md py-1 text-ink-extra-muted not-disabled:hover:bg-ink/3'
+ )}
+ tooltipPlacement="right"
+ label={props.isSlim() ? props.label : undefined}
+ onMouseEnter={() => setIsHovering(true)}
+ onMouseLeave={() => setIsHovering(false)}
+ onMouseDown={(e) => {
+ if (e.button !== 0) return;
+ e.preventDefault();
+ props.onClick();
+ }}
+ >
+ <div class="relative shrink-0 [&_svg]:size-4">
+ <Dynamic component={props.icon} triggerAnimation={isHovering()} />
+ </div>
+
+ <div class="flex items-center gap-1 group-data-[slim=true]/sidebar:hidden">
+ <span class="whitespace-nowrap">{props.label}</span>
+ </div>
+ </Button>
+ );
+};
+
+type SettingsMenuItem = {
+ tab: SettingsTab;
+ label: string;
+ description: string;
+ icon: Component<{ class?: string }>;
+};
+
+const SETTINGS_MENU_TOP_ITEMS: SettingsMenuItem[] = [
+ {
+ tab: 'Mobile App',
+ label: 'App',
+ description: 'Get the mobile app',
+ icon: DeviceMobileIcon,
+ },
+ {
+ tab: 'Agent',
+ label: 'MCPs',
+ description: 'Agent connectors and MCP servers',
+ icon: PlugIcon,
+ },
+ {
+ tab: 'Team',
+ label: 'Team',
+ description: 'Members and invites',
+ icon: UsersThreeIcon,
+ },
+];
-const AppearanceSettingsIcon = () => <PaintBucketIcon class="size-4" />;
+const SETTINGS_MENU_BOTTOM_ITEMS: SettingsMenuItem[] = [
+ {
+ tab: 'Shortcuts',
+ label: 'Shortcuts',
+ description: 'Keyboard shortcuts',
+ icon: KeyboardIcon,
+ },
+ {
+ tab: 'Appearance',
+ label: 'Appearance',
+ description: 'Theme and UI customization',
+ icon: PaintBucketIcon,
+ },
+ {
+ tab: 'Account',
+ label: 'Account',
+ description: 'Profile, email, and subscription',
+ icon: UserIconPhosphor,
+ },
+];
-const AccountTeamSettingsIcon = () => <UsersThreeIcon class="size-4" />;
+/**
+ * Mirrors the gating in `Settings.tsx`'s `settingsTabs()`. Use to filter the
+ * sidebar menu/shortcuts and to guard `setActiveTabId` callers so we never
+ * activate a tab that the settings panel won't render.
+ */
+const useIsSettingsTabAvailable = () => {
+ const teamsFlag = useFeatureFlag('enable-teams-settings', {
+ enabledOverride: ENABLE_TEAMS_OVERRIDE,
+ });
-const MobileMcpsSettingsIcon = () => <DeviceMobileIcon class="size-4" />;
+ return (tab: SettingsTab): boolean => {
+ switch (tab) {
+ case 'Appearance':
+ case 'Account':
+ return true;
+ case 'Team':
+ return teamsFlag().enabled;
+ case 'Shortcuts':
+ return !isTouchDevice();
+ case 'Mobile App':
+ return ENABLE_APP_STORE_QR_CODE && !isNativeMobilePlatform();
+ case 'Agent':
+ return !isNativeMobilePlatform();
+ case 'Mobile':
+ return isNativeMobilePlatform() && DEV_MODE_ENV;
+ default:
+ return false;
+ }
+ };
+};
/**
* A normalised action button for the sidebar footer area.
@@ -444,6 +567,115 @@ const SidebarActionButton = (props: SidebarActionButtonProps) => {
);
};
+type SidebarSettingsWidgetProps = {
+ isSlim: () => boolean;
+ onSelect: (tab: SettingsTab) => void;
+ isTabAvailable: (tab: SettingsTab) => boolean;
+};
+
+const SidebarSettingsWidget = (props: SidebarSettingsWidgetProps) => {
+ const userId = useUserId();
+
+ const topItems = createMemo(() =>
+ SETTINGS_MENU_TOP_ITEMS.filter((item) => props.isTabAvailable(item.tab))
+ );
+ const bottomItems = createMemo(() =>
+ SETTINGS_MENU_BOTTOM_ITEMS.filter((item) => props.isTabAvailable(item.tab))
+ );
+
+ 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',
+ 'justify-start gap-2 px-1.5 py-1',
+ 'group-data-[slim=true]/sidebar:justify-center group-data-[slim=true]/sidebar:gap-0'
+ )}
+ label={props.isSlim() ? 'Settings' : undefined}
+ tooltipPlacement="right"
+ onMouseDown={(e: MouseEvent) => {
+ if (e.button !== 0) return;
+ e.preventDefault();
+ }}
+ >
+ <Show
+ when={userId()}
+ fallback={<div class="size-5 shrink-0 rounded-full bg-ink/10" />}
+ >
+ {(id) => (
+ <div class="size-5">
+ <UserIcon
+ id={id()}
+ size="fill"
+ suppressClick
+ showTooltip={false}
+ // class="-m-1"
+ />
+ </div>
+ )}
+ </Show>
+ <span class="flex-1 min-w-0 text-left whitespace-nowrap text-sm truncate group-data-[slim=true]/sidebar:hidden">
+ Settings
+ </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"
+ />
+ </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"
+ />
+ </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>
+ </Dropdown>
+ );
+};
+
const CALLS_LINK: SidebarItem = {
id: 'calls',
label: 'Calls',
@@ -456,7 +688,8 @@ const CALLS_LINK: SidebarItem = {
export const AppSidebar = (props: AppSidebarProps) => {
const analytics = useAnalytics();
const layout = useSplitLayout();
- const { openSettings } = useSettingsState();
+ const { openSettings, setActiveTabId, settingsOpen } = useSettingsState();
+ const isTabAvailable = useIsSettingsTabAvailable();
const notificationSettings = useNotificationSettings();
const callCtx = useCallContextOptional();
@@ -527,16 +760,14 @@ export const AppSidebar = (props: AppSidebarProps) => {
});
};
- const openSettingsTab = (
- tab:
- | 'Keyboard Shortcuts'
- | 'Appearance'
- | 'Account & Team'
- | 'Mobile & MCPs',
- event?: MouseEvent
- ) => {
- if (event?.shiftKey) {
- if (!(globalSplitManager()?.canAppendSplit() ?? true)) return;
+ const openSettingsTab = (tab: SettingsTab) => {
+ if (!isTabAvailable(tab)) return;
+ if (settingsOpen()) {
+ setActiveTabId(tab);
+ return;
+ }
+ if (globalSplitManager()?.canAppendSplit() ?? true) {
+ setActiveTabId(tab);
analytics.track('split_created', { from: 'sidebar' });
layout.openWithSplit(
{ type: 'component', id: 'settings' },
@@ -696,30 +927,38 @@ export const AppSidebar = (props: AppSidebarProps) => {
<hr class="border-transparent mb-2" />
</div>
- <div class="w-full px-2 flex flex-col">
- <SidebarActionButton
- label="Shortcuts"
- isSlim={isSlim}
- onClick={(event) => openSettingsTab('Keyboard Shortcuts', event)}
- icon={KeyboardShortcutsIcon}
- />
- <SidebarActionButton
- label="Appearance"
- isSlim={isSlim}
- onClick={(event) => openSettingsTab('Appearance', event)}
- icon={AppearanceSettingsIcon}
- />
- <SidebarActionButton
- label="Account & Team"
- isSlim={isSlim}
- onClick={(event) => openSettingsTab('Account & Team', event)}
- icon={AccountTeamSettingsIcon}
- />
- <SidebarActionButton
- label="Mobile & MCPs"
+ <div class="w-full px-2 flex flex-col gap-1 mb-1">
+ <Show when={isTabAvailable('Mobile App')}>
+ <SidebarShortcutLink
+ label="App"
+ isSlim={isSlim}
+ onClick={() => openSettingsTab('Mobile App')}
+ icon={() => <DeviceMobileIcon class="size-4" />}
+ />
+ </Show>
+ <Show when={isTabAvailable('Agent')}>
+ <SidebarShortcutLink
+ label="MCPs"
+ isSlim={isSlim}
+ onClick={() => openSettingsTab('Agent')}
+ icon={() => <PlugIcon class="size-4" />}
+ />
+ </Show>
+ <Show when={isTabAvailable('Team')}>
+ <SidebarShortcutLink
+ label="Team"
+ isSlim={isSlim}
+ onClick={() => openSettingsTab('Team')}
+ icon={() => <UsersThreeIcon class="size-4" />}
+ />
+ </Show>
+ </div>
+
+ <div class="w-full px-2">
+ <SidebarSettingsWidget
isSlim={isSlim}
- onClick={(event) => openSettingsTab('Mobile & MCPs', event)}
- icon={MobileMcpsSettingsIcon}
+ onSelect={openSettingsTab}
+ isTabAvailable={isTabAvailable}
/>
</div>
<InviteModal />
diff --git a/js/app/packages/app/component/settings/Settings.tsx b/js/app/packages/app/component/settings/Settings.tsx
index f57bea69c8..911f8febca 100644
--- a/js/app/packages/app/component/settings/Settings.tsx
+++ b/js/app/packages/app/component/settings/Settings.tsx
@@ -8,12 +8,14 @@ import { MobileApp } from './MobileApp';
import { Agent } from './Agent';
import { Appearance } from './Appearance';
import { TabsInset } from '@core/component/TabsInset';
+import { TabsInsetDropdown } from '@core/component/TabsInsetDropdown';
import { Account } from './Account';
import { Shortcuts } from './Shortcuts';
import { Team } from './Team';
import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';
import type { ValidHotkey } from '@core/hotkey/types';
import { SplitHeaderLeft, SplitHeaderRight } from '../split-layout/components/SplitHeader';
+import { CollapsibleHeaderItem } from '../split-layout/components/CollapsibleHeaderItem';
import { SettingsButton } from './SettingsButton';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
@@ -56,10 +58,12 @@ function SettingsPanel(props: SettingsPanelProps) {
function settingsTabs() {
const tabs: { value: string; label: string }[] = [
{ value: 'Appearance', label: 'Appearance' },
- { value: 'Account & Team', label: 'Account & Team' },
+ { value: 'Account', label: 'Account' },
];
- if (!isTouchDevice()) { tabs.push({ value: 'Keyboard Shortcuts', label: 'Keyboard Shortcuts' }) }
- if (!isNativeMobilePlatform()) { tabs.push({ value: 'Mobile & MCPs', label: 'Mobile & MCPs' }) }
+ if (teamsFlag().enabled) { tabs.push({ value: 'Team', label: 'Team' }) }
+ if (!isTouchDevice()) { tabs.push({ value: 'Shortcuts', label: 'Shortcuts' }) }
+ if (ENABLE_APP_STORE_QR_CODE && !isNativeMobilePlatform()) { tabs.push({ value: 'Mobile App', label: 'App' }) }
+ if (!isNativeMobilePlatform()) { tabs.push({ value: 'Agent', label: 'MCPs' }) }
if (isNativeMobilePlatform() && DEV_MODE_ENV) { tabs.push({ value: 'Mobile', label: 'Mobile Dev Tools' }) }
return tabs;
}
@@ -178,36 +182,54 @@ function SettingsPanel(props: SettingsPanelProps) {
<h1 class="font-semibold text-ink select-none text-sm shrink-0">
Settings
</h1>
+ <Show when={!isMobile()}>
+ <CollapsibleHeaderItem
+ id="settings-tabs"
+ priority={1}
+ containerClass="h-full"
+ expanded={() => (
+ <TabsInset
+ list={settingsTabs()}
+ value={activeTabId()}
+ defaultValue="Appearance"
+ onChange={handleTabChange}
+ />
+ )}
+ collapsed={() => (
+ <TabsInsetDropdown
+ list={settingsTabs()}
+ value={activeTabId()}
+ defaultValue="Appearance"
+ onChange={handleTabChange}
+ />
+ )}
+ />
+ </Show>
</div>
</SplitHeaderLeft>
<div class="relative grow min-h-1 overflow-auto">
- <Show when={activeTabId() === 'Account & Team'}>
- <div class="grid size-full grid-cols-1 min-[900px]:grid-cols-2 overflow-hidden">
- <Suspense>
- <Account />
- </Suspense>
- <Show when={teamsFlag().enabled}>
- <Suspense>
- <Team />
- </Suspense>
- </Show>
- </div>
+ <Show when={activeTabId() === 'Account'}>
+ <Suspense>
+ <Account />
+ </Suspense>
</Show>
-
<Show when={activeTabId() === 'Appearance'}>
<Appearance />
</Show>
- <Show when={activeTabId() === 'Keyboard Shortcuts' && !isTouchDevice()}>
+ <Show when={activeTabId() === 'Shortcuts' && !isTouchDevice()}>
<Shortcuts />
</Show>
- <Show when={activeTabId() === 'Mobile & MCPs' && !isNativeMobilePlatform()}>
- <div class="grid size-full grid-cols-1 min-[900px]:grid-cols-2 overflow-hidden">
- <Show when={ENABLE_APP_STORE_QR_CODE}>
- <MobileApp />
- </Show>
- <Agent />
- </div>
+ <Show when={activeTabId() === 'Team' && teamsFlag().enabled}>
+ <Suspense>
+ <Team />
+ </Suspense>
+ </Show>
+ <Show when={activeTabId() === 'Mobile App' && ENABLE_APP_STORE_QR_CODE && !isNativeMobilePlatform()}>
+ <MobileApp />
+ </Show>
+ <Show when={activeTabId() === 'Agent' && !isNativeMobilePlatform()}>
+ <Agent />
</Show>
</div>
diff --git a/js/app/packages/core/constant/SettingsState.tsx b/js/app/packages/core/constant/SettingsState.tsx
index 5b9edca229..90c30474e5 100644
--- a/js/app/packages/core/constant/SettingsState.tsx
+++ b/js/app/packages/core/constant/SettingsState.tsx
@@ -3,6 +3,7 @@ import { globalSplitManager } from '@app/signal/splitLayout';
import { createMemo, createSignal } from 'solid-js';
export type SettingsTab =
+ | 'Account'
| 'Subscription'
| 'Organization'
| 'Appearance'
@@ -10,9 +11,9 @@ export type SettingsTab =
| 'AI Memory'
| 'Inbox'
| 'Shortcuts'
- | 'Keyboard Shortcuts'
- | 'Account & Team'
- | 'Mobile & MCPs';
+ | 'Mobile App'
+ | 'Agent'
+ | 'Team';
const [activeTabId, setActiveTabId] = createSignal<SettingsTab>('Appearance');
diff --git a/js/app/packages/ui/components/Dropdown.tsx b/js/app/packages/ui/components/Dropdown.tsx
index ae211af471..cafdcb3ed9 100644
--- a/js/app/packages/ui/components/Dropdown.tsx
+++ b/js/app/packages/ui/components/Dropdown.tsx
@@ -18,9 +18,11 @@ type DropdownTriggerProps = ComponentProps<typeof KobalteDropdownMenu.Trigger> &
type DropdownContentProps = ComponentProps<typeof KobalteDropdownMenu.Content>;
type DropdownSubContentProps = ComponentProps<typeof KobalteDropdownMenu.SubContent>;
type DropdownItemProps = ComponentProps<typeof KobalteDropdownMenu.Item>;
+type DropdownSeparatorProps = ComponentProps<typeof KobalteDropdownMenu.Separator>;
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';
function DropdownContent(props: DropdownContentProps) {
return <KobalteDropdownMenu.Content {...props} class={cn(DROPDOWN_CONTENT_CLASS, props.class)} />;
@@ -34,6 +36,10 @@ function DropdownItem(props: DropdownItemProps) {
return <KobalteDropdownMenu.Item {...props} class={cn(props.class, DROPDOWN_ITEM_CLASS)} />;
}
+function DropdownSeparator(props: DropdownSeparatorProps) {
+ return <KobalteDropdownMenu.Separator {...props} class={cn(DROPDOWN_SEPARATOR_CLASS, props.class)} />;
+}
+
function DropdownTrigger(props: DropdownTriggerProps) {
return (
<KobalteDropdownMenu.Trigger
@@ -59,6 +65,7 @@ export const Dropdown = Object.assign((props: ComponentProps<typeof KobalteDropd
Portal: KobalteDropdownMenu.Portal, /* todo */
Group: KobalteDropdownMenu.Group, /* todo */
Item: DropdownItem,
+ Separator: DropdownSeparator,
Icon: KobalteDropdownMenu.Icon, /* todo */
Sub: KobalteDropdownMenu.Sub, /* todo */
Trigger: DropdownTrigger,