@oxy.so/bloom 2.2.0 → 2.4.0

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.
Files changed (144) hide show
  1. package/docs/popover.mdx +73 -19
  2. package/docs/sidebar.mdx +20 -0
  3. package/lib/commonjs/calendar/CalendarViewInboxMenu.js +4 -13
  4. package/lib/commonjs/calendar/CalendarViewInboxMenu.js.map +1 -1
  5. package/lib/commonjs/calendar/CalendarViewMonthGrid.js +6 -10
  6. package/lib/commonjs/calendar/CalendarViewMonthGrid.js.map +1 -1
  7. package/lib/commonjs/dialog/DialogHeader.js +1 -7
  8. package/lib/commonjs/dialog/DialogHeader.js.map +1 -1
  9. package/lib/commonjs/floating/FloatingPanel.js +19 -22
  10. package/lib/commonjs/floating/FloatingPanel.js.map +1 -1
  11. package/lib/commonjs/floating/constants.js +12 -56
  12. package/lib/commonjs/floating/constants.js.map +1 -1
  13. package/lib/commonjs/floating/menu-sub-flyout.js +3 -3
  14. package/lib/commonjs/popover/Popover.js +23 -3
  15. package/lib/commonjs/popover/Popover.js.map +1 -1
  16. package/lib/commonjs/popover/Popover.web.js +21 -16
  17. package/lib/commonjs/popover/Popover.web.js.map +1 -1
  18. package/lib/commonjs/popover/index.js +31 -0
  19. package/lib/commonjs/popover/index.js.map +1 -1
  20. package/lib/commonjs/popover/index.web.js +31 -0
  21. package/lib/commonjs/popover/index.web.js.map +1 -1
  22. package/lib/commonjs/popover/parts.js +164 -0
  23. package/lib/commonjs/popover/parts.js.map +1 -0
  24. package/lib/commonjs/popover/surface.js +102 -0
  25. package/lib/commonjs/popover/surface.js.map +1 -0
  26. package/lib/commonjs/sidebar/Sidebar.js +15 -2
  27. package/lib/commonjs/sidebar/Sidebar.js.map +1 -1
  28. package/lib/commonjs/sidebar/SidebarModeSwitcher.js +193 -0
  29. package/lib/commonjs/sidebar/SidebarModeSwitcher.js.map +1 -0
  30. package/lib/commonjs/sidebar/index.js +7 -0
  31. package/lib/commonjs/sidebar/index.js.map +1 -1
  32. package/lib/commonjs/sidebar/parts.js +9 -11
  33. package/lib/commonjs/sidebar/parts.js.map +1 -1
  34. package/lib/module/calendar/CalendarViewInboxMenu.js +4 -13
  35. package/lib/module/calendar/CalendarViewInboxMenu.js.map +1 -1
  36. package/lib/module/calendar/CalendarViewMonthGrid.js +6 -10
  37. package/lib/module/calendar/CalendarViewMonthGrid.js.map +1 -1
  38. package/lib/module/dialog/DialogHeader.js +1 -7
  39. package/lib/module/dialog/DialogHeader.js.map +1 -1
  40. package/lib/module/floating/FloatingPanel.js +20 -23
  41. package/lib/module/floating/FloatingPanel.js.map +1 -1
  42. package/lib/module/floating/constants.js +11 -55
  43. package/lib/module/floating/constants.js.map +1 -1
  44. package/lib/module/floating/menu-sub-flyout.js +3 -3
  45. package/lib/module/popover/Popover.js +23 -3
  46. package/lib/module/popover/Popover.js.map +1 -1
  47. package/lib/module/popover/Popover.web.js +22 -17
  48. package/lib/module/popover/Popover.web.js.map +1 -1
  49. package/lib/module/popover/index.js +1 -0
  50. package/lib/module/popover/index.js.map +1 -1
  51. package/lib/module/popover/index.web.js +1 -0
  52. package/lib/module/popover/index.web.js.map +1 -1
  53. package/lib/module/popover/parts.js +154 -0
  54. package/lib/module/popover/parts.js.map +1 -0
  55. package/lib/module/popover/surface.js +96 -0
  56. package/lib/module/popover/surface.js.map +1 -0
  57. package/lib/module/sidebar/Sidebar.js +15 -2
  58. package/lib/module/sidebar/Sidebar.js.map +1 -1
  59. package/lib/module/sidebar/SidebarModeSwitcher.js +188 -0
  60. package/lib/module/sidebar/SidebarModeSwitcher.js.map +1 -0
  61. package/lib/module/sidebar/index.js +1 -0
  62. package/lib/module/sidebar/index.js.map +1 -1
  63. package/lib/module/sidebar/parts.js +9 -11
  64. package/lib/module/sidebar/parts.js.map +1 -1
  65. package/lib/typescript/commonjs/calendar/CalendarViewInboxMenu.d.ts.map +1 -1
  66. package/lib/typescript/commonjs/calendar/CalendarViewMonthGrid.d.ts.map +1 -1
  67. package/lib/typescript/commonjs/dialog/DialogHeader.d.ts.map +1 -1
  68. package/lib/typescript/commonjs/floating/FloatingPanel.d.ts.map +1 -1
  69. package/lib/typescript/commonjs/floating/constants.d.ts +11 -50
  70. package/lib/typescript/commonjs/floating/constants.d.ts.map +1 -1
  71. package/lib/typescript/commonjs/floating/types.d.ts +5 -4
  72. package/lib/typescript/commonjs/floating/types.d.ts.map +1 -1
  73. package/lib/typescript/commonjs/popover/Popover.d.ts +1 -1
  74. package/lib/typescript/commonjs/popover/Popover.d.ts.map +1 -1
  75. package/lib/typescript/commonjs/popover/Popover.web.d.ts.map +1 -1
  76. package/lib/typescript/commonjs/popover/index.d.ts +2 -1
  77. package/lib/typescript/commonjs/popover/index.d.ts.map +1 -1
  78. package/lib/typescript/commonjs/popover/index.web.d.ts +2 -1
  79. package/lib/typescript/commonjs/popover/index.web.d.ts.map +1 -1
  80. package/lib/typescript/commonjs/popover/parts.d.ts +7 -0
  81. package/lib/typescript/commonjs/popover/parts.d.ts.map +1 -0
  82. package/lib/typescript/commonjs/popover/surface.d.ts +58 -0
  83. package/lib/typescript/commonjs/popover/surface.d.ts.map +1 -0
  84. package/lib/typescript/commonjs/popover/types.d.ts +50 -0
  85. package/lib/typescript/commonjs/popover/types.d.ts.map +1 -1
  86. package/lib/typescript/commonjs/sidebar/Sidebar.d.ts.map +1 -1
  87. package/lib/typescript/commonjs/sidebar/SidebarModeSwitcher.d.ts +4 -0
  88. package/lib/typescript/commonjs/sidebar/SidebarModeSwitcher.d.ts.map +1 -0
  89. package/lib/typescript/commonjs/sidebar/index.d.ts +2 -1
  90. package/lib/typescript/commonjs/sidebar/index.d.ts.map +1 -1
  91. package/lib/typescript/commonjs/sidebar/parts.d.ts +2 -2
  92. package/lib/typescript/commonjs/sidebar/parts.d.ts.map +1 -1
  93. package/lib/typescript/commonjs/sidebar/types.d.ts +30 -0
  94. package/lib/typescript/commonjs/sidebar/types.d.ts.map +1 -1
  95. package/lib/typescript/module/calendar/CalendarViewInboxMenu.d.ts.map +1 -1
  96. package/lib/typescript/module/calendar/CalendarViewMonthGrid.d.ts.map +1 -1
  97. package/lib/typescript/module/dialog/DialogHeader.d.ts.map +1 -1
  98. package/lib/typescript/module/floating/FloatingPanel.d.ts.map +1 -1
  99. package/lib/typescript/module/floating/constants.d.ts +11 -50
  100. package/lib/typescript/module/floating/constants.d.ts.map +1 -1
  101. package/lib/typescript/module/floating/types.d.ts +5 -4
  102. package/lib/typescript/module/floating/types.d.ts.map +1 -1
  103. package/lib/typescript/module/popover/Popover.d.ts +1 -1
  104. package/lib/typescript/module/popover/Popover.d.ts.map +1 -1
  105. package/lib/typescript/module/popover/Popover.web.d.ts.map +1 -1
  106. package/lib/typescript/module/popover/index.d.ts +2 -1
  107. package/lib/typescript/module/popover/index.d.ts.map +1 -1
  108. package/lib/typescript/module/popover/index.web.d.ts +2 -1
  109. package/lib/typescript/module/popover/index.web.d.ts.map +1 -1
  110. package/lib/typescript/module/popover/parts.d.ts +7 -0
  111. package/lib/typescript/module/popover/parts.d.ts.map +1 -0
  112. package/lib/typescript/module/popover/surface.d.ts +58 -0
  113. package/lib/typescript/module/popover/surface.d.ts.map +1 -0
  114. package/lib/typescript/module/popover/types.d.ts +50 -0
  115. package/lib/typescript/module/popover/types.d.ts.map +1 -1
  116. package/lib/typescript/module/sidebar/Sidebar.d.ts.map +1 -1
  117. package/lib/typescript/module/sidebar/SidebarModeSwitcher.d.ts +4 -0
  118. package/lib/typescript/module/sidebar/SidebarModeSwitcher.d.ts.map +1 -0
  119. package/lib/typescript/module/sidebar/index.d.ts +2 -1
  120. package/lib/typescript/module/sidebar/index.d.ts.map +1 -1
  121. package/lib/typescript/module/sidebar/parts.d.ts +2 -2
  122. package/lib/typescript/module/sidebar/parts.d.ts.map +1 -1
  123. package/lib/typescript/module/sidebar/types.d.ts +30 -0
  124. package/lib/typescript/module/sidebar/types.d.ts.map +1 -1
  125. package/package.json +1 -1
  126. package/src/calendar/CalendarViewInboxMenu.tsx +3 -12
  127. package/src/calendar/CalendarViewMonthGrid.tsx +5 -9
  128. package/src/dialog/DialogHeader.tsx +1 -6
  129. package/src/floating/FloatingPanel.tsx +19 -27
  130. package/src/floating/constants.ts +11 -56
  131. package/src/floating/menu-sub-flyout.tsx +3 -3
  132. package/src/floating/types.ts +5 -4
  133. package/src/popover/Popover.tsx +32 -4
  134. package/src/popover/Popover.web.tsx +31 -17
  135. package/src/popover/index.ts +17 -1
  136. package/src/popover/index.web.ts +17 -1
  137. package/src/popover/parts.tsx +141 -0
  138. package/src/popover/surface.ts +119 -0
  139. package/src/popover/types.ts +56 -0
  140. package/src/sidebar/Sidebar.tsx +19 -0
  141. package/src/sidebar/SidebarModeSwitcher.tsx +183 -0
  142. package/src/sidebar/index.ts +3 -0
  143. package/src/sidebar/parts.tsx +8 -11
  144. package/src/sidebar/types.ts +32 -0
@@ -1,3 +1,5 @@
1
+ import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
2
+
1
3
  import type {
2
4
  OverlayOpenProps,
3
5
  OverlaySurfaceProps,
@@ -7,3 +9,57 @@ import type {
7
9
  export type PopoverProps = React.PropsWithChildren<OverlayOpenProps>;
8
10
  export type PopoverTriggerProps = OverlayTriggerProps;
9
11
  export type PopoverContentProps = OverlaySurfaceProps;
12
+
13
+ /** Shared by the panel's layout parts. */
14
+ interface PopoverPartProps {
15
+ children?: React.ReactNode;
16
+ /** Utility classes on the part's own node. */
17
+ className?: string;
18
+ style?: StyleProp<ViewStyle>;
19
+ testID?: string;
20
+ }
21
+
22
+ /**
23
+ * The panel's heading row — `flex items-center gap-2 px-2 pt-1`:
24
+ * an optional `leading` (avatar, icon) beside a column of
25
+ * `PopoverTitle` / `PopoverDescription`.
26
+ */
27
+ export interface PopoverHeaderProps extends PopoverPartProps {
28
+ leading?: React.ReactNode;
29
+ }
30
+
31
+ /** `text-body-medium text-text-primary`, or `text-secondary` for a group label. */
32
+ export interface PopoverTitleProps {
33
+ children?: React.ReactNode;
34
+ /**
35
+ * `'secondary'` is the group-label colour panels use above a list
36
+ * ("Users with access", "Local Folders"). Defaults to `'primary'`.
37
+ */
38
+ tone?: 'primary' | 'secondary';
39
+ numberOfLines?: number;
40
+ className?: string;
41
+ style?: StyleProp<TextStyle>;
42
+ testID?: string;
43
+ }
44
+
45
+ /** `text-body-regular text-text-secondary`. */
46
+ export interface PopoverDescriptionProps {
47
+ children?: React.ReactNode;
48
+ numberOfLines?: number;
49
+ className?: string;
50
+ style?: StyleProp<TextStyle>;
51
+ testID?: string;
52
+ }
53
+
54
+ /** The panel's closing row — `flex items-center gap-3 px-2 pb-2`. */
55
+ export type PopoverFooterProps = PopoverPartProps;
56
+
57
+ /**
58
+ * The full-bleed rule between a panel's sections —
59
+ * `-mx-2.5 my-2.5 h-px bg-border-button-default`.
60
+ */
61
+ export interface PopoverSeparatorProps {
62
+ className?: string;
63
+ style?: StyleProp<ViewStyle>;
64
+ testID?: string;
65
+ }
@@ -29,6 +29,7 @@ import { useSidebarPalette, type SidebarPalette } from './palette';
29
29
  import { Collapsible, CollapseProvider, IS_WEB, MORPH_MS, useSidebarWebCss } from './parts';
30
30
  import { SidebarFolder } from './SidebarFolder';
31
31
  import { SidebarItem } from './SidebarItem';
32
+ import { SidebarModeSwitcher } from './SidebarModeSwitcher';
32
33
  import { SidebarPlanCard } from './SidebarPlanCard';
33
34
  import { SidebarRail } from './SidebarRail';
34
35
  import { SidebarTeamMenu } from './SidebarTeamMenu';
@@ -132,6 +133,10 @@ function SearchField({
132
133
  const SidebarPanel: React.FC<SidebarProps> = ({
133
134
  items = [],
134
135
  secondaryItems = [],
136
+ modes,
137
+ mode,
138
+ onModeChange,
139
+ modesLabel,
135
140
  selected,
136
141
  onNavigate,
137
142
  collapsed: collapsedProp,
@@ -459,6 +464,18 @@ const SidebarPanel: React.FC<SidebarProps> = ({
459
464
  shownItems.length === 0 && shownSecondary.length === 0 && shownFolders.length === 0 && !collapsed;
460
465
  const hasTree = !!tree;
461
466
 
467
+ const modeSwitcher =
468
+ modes && modes.length > 0 ? (
469
+ <SidebarModeSwitcher
470
+ modes={modes}
471
+ value={mode ?? modes[0]!.key}
472
+ onValueChange={(key) => onModeChange?.(key)}
473
+ collapsed={collapsed}
474
+ accessibilityLabel={modesLabel}
475
+ testID={testID ? `${testID}-modes` : 'sidebar-modes'}
476
+ />
477
+ ) : null;
478
+
462
479
  const headerRow = (
463
480
  <View
464
481
  style={
@@ -521,6 +538,7 @@ const SidebarPanel: React.FC<SidebarProps> = ({
521
538
  // 24 between the primary rows and the tree section.
522
539
  <View style={{ width: '100%', minHeight: 0, flexShrink: 1, gap: 12 }}>
523
540
  {headerRow}
541
+ {modeSwitcher}
524
542
  {showSearch && !flat ? searchButton : null}
525
543
  <ScrollView
526
544
  {...(IS_WEB ? { dataSet: { bloomSidebarScroll: 'none' } } : {})}
@@ -569,6 +587,7 @@ const SidebarPanel: React.FC<SidebarProps> = ({
569
587
  showsVerticalScrollIndicator={false}
570
588
  >
571
589
  {headerRow}
590
+ {modeSwitcher}
572
591
 
573
592
  <View style={{ width: '100%', gap: 12 }}>
574
593
  {showSearch && !flat ? searchButton : null}
@@ -0,0 +1,183 @@
1
+ import React, { memo, useEffect } from 'react';
2
+ import { Pressable, View } from 'react-native';
3
+ import Animated, {
4
+ Easing,
5
+ useAnimatedStyle,
6
+ useReducedMotion,
7
+ useSharedValue,
8
+ withTiming,
9
+ } from 'react-native-reanimated';
10
+
11
+ import { BUTTON_SHADOW, resolveButtonRamps } from '../button/shared';
12
+ import { useInteractionState } from '../hooks/use-interaction-state';
13
+ import { borderRadius } from '../styles/tokens';
14
+ import type { WebCssStyle } from '../styles/web-view-style';
15
+ import { useTheme } from '../theme/use-theme';
16
+ import { Text } from '../typography';
17
+ import { useSidebarPalette } from './palette';
18
+ import { Collapsible, IS_WEB, useSidebarWebCss } from './parts';
19
+ import type { SidebarMode, SidebarModeSwitcherProps } from './types';
20
+
21
+ /**
22
+ * `SidebarModeSwitcher`: a vertical segmented control for the modes a sidebar
23
+ * switches between (Search / Computer, Chat / Agents), each an icon and label.
24
+ *
25
+ * track p4, radius 20, background-tertiary (neutral-200 / neutral-800)
26
+ * row 32 tall, 4 apart; icon 18 in a 32 box, 4 gap, body-2-medium
27
+ * thumb the selected row's 32px pill: card / neutral-700 with shadow-xs,
28
+ * sliding 200ms ease between rows (instant under reduced motion)
29
+ * rest icon and label text-secondary; selected text-primary
30
+ * shortcut web only, on hover: a caption-2 hint at the row's end
31
+ * collapsed labels and hints collapse; the icons stay pinned
32
+ *
33
+ * Its colours are the sidebar ThemeToggle's segmented track and thumb, so the
34
+ * two read as one family. A `radiogroup`: each row is a `radio`.
35
+ */
36
+
37
+ const ROW_HEIGHT = 32;
38
+ const ROW_GAP = 4;
39
+ const PADDING = 4;
40
+ const THUMB_MS = 200;
41
+ const EASE = Easing.bezier(0.25, 0.1, 0.25, 1);
42
+
43
+ function ModeRow({
44
+ mode,
45
+ selected,
46
+ collapsed,
47
+ onSelect,
48
+ testID,
49
+ }: {
50
+ mode: SidebarMode;
51
+ selected: boolean;
52
+ collapsed: boolean;
53
+ onSelect: (key: string) => void;
54
+ testID?: string;
55
+ }) {
56
+ const palette = useSidebarPalette();
57
+ const { state: hovered, onIn, onOut } = useInteractionState();
58
+ const Icon = mode.icon;
59
+ const foreground = selected ? palette.text : palette.textSecondary;
60
+
61
+ const rowStyle: WebCssStyle = {
62
+ flexDirection: 'row',
63
+ alignItems: 'center',
64
+ gap: 4,
65
+ height: ROW_HEIGHT,
66
+ borderRadius: borderRadius.full,
67
+ '--bloom-sidebar-ring': palette.ring,
68
+ };
69
+
70
+ return (
71
+ <Pressable
72
+ {...(IS_WEB ? { dataSet: { bloomSidebar: 'ring' }, ...(collapsed ? { title: mode.label } : null) } : {})}
73
+ role="radio"
74
+ aria-checked={selected}
75
+ accessibilityState={{ checked: selected }}
76
+ accessibilityLabel={mode.label}
77
+ onHoverIn={onIn}
78
+ onHoverOut={onOut}
79
+ onPress={() => onSelect(mode.key)}
80
+ style={rowStyle}
81
+ testID={testID}
82
+ >
83
+ <View style={{ width: ROW_HEIGHT, height: ROW_HEIGHT, alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>
84
+ <Icon width={18} height={18} fill={foreground} />
85
+ </View>
86
+ <Collapsible collapsed={collapsed} style={{ flex: 1, minWidth: 0 }}>
87
+ <Text variant="body-2-medium" numberOfLines={1} style={{ color: foreground }}>
88
+ {mode.label}
89
+ </Text>
90
+ </Collapsible>
91
+ {IS_WEB && mode.shortcut ? (
92
+ <Collapsible collapsed={collapsed}>
93
+ <Text
94
+ variant="caption-2-regular"
95
+ numberOfLines={1}
96
+ style={{ color: palette.textTertiary, paddingRight: 12, opacity: hovered ? 1 : 0 }}
97
+ >
98
+ {mode.shortcut}
99
+ </Text>
100
+ </Collapsible>
101
+ ) : null}
102
+ </Pressable>
103
+ );
104
+ }
105
+
106
+ const SidebarModeSwitcherComponent: React.FC<SidebarModeSwitcherProps> = ({
107
+ modes,
108
+ value,
109
+ onValueChange,
110
+ collapsed = false,
111
+ accessibilityLabel = 'Mode',
112
+ style,
113
+ testID,
114
+ }) => {
115
+ const theme = useTheme();
116
+ const palette = useSidebarPalette();
117
+ useSidebarWebCss();
118
+ const reducedMotion = useReducedMotion();
119
+ const { neutral: n } = resolveButtonRamps(theme);
120
+
121
+ const index = Math.max(0, modes.findIndex((mode) => mode.key === value));
122
+ const offset = useSharedValue(index * (ROW_HEIGHT + ROW_GAP));
123
+ useEffect(() => {
124
+ const target = index * (ROW_HEIGHT + ROW_GAP);
125
+ offset.value = reducedMotion ? target : withTiming(target, { duration: THUMB_MS, easing: EASE });
126
+ }, [index, reducedMotion, offset]);
127
+ const thumbStyle = useAnimatedStyle(() => ({ transform: [{ translateY: offset.value }] }), [offset]);
128
+
129
+ const selectedKnown = modes.some((mode) => mode.key === value);
130
+
131
+ return (
132
+ <View
133
+ role="radiogroup"
134
+ accessibilityLabel={accessibilityLabel}
135
+ testID={testID}
136
+ style={[
137
+ {
138
+ position: 'relative',
139
+ width: '100%',
140
+ padding: PADDING,
141
+ gap: ROW_GAP,
142
+ borderRadius: (ROW_HEIGHT + PADDING * 2) / 2,
143
+ backgroundColor: palette.tertiary,
144
+ },
145
+ style,
146
+ ]}
147
+ >
148
+ {selectedKnown ? (
149
+ <Animated.View
150
+ pointerEvents="none"
151
+ aria-hidden
152
+ testID={testID ? `${testID}-thumb` : undefined}
153
+ style={[
154
+ {
155
+ position: 'absolute',
156
+ top: PADDING,
157
+ left: PADDING,
158
+ right: PADDING,
159
+ height: ROW_HEIGHT,
160
+ borderRadius: borderRadius.full,
161
+ backgroundColor: theme.isDark ? n[700] : theme.colors.card,
162
+ boxShadow: theme.isDark ? BUTTON_SHADOW.dark : BUTTON_SHADOW.light,
163
+ },
164
+ thumbStyle,
165
+ ]}
166
+ />
167
+ ) : null}
168
+ {modes.map((mode) => (
169
+ <ModeRow
170
+ key={mode.key}
171
+ mode={mode}
172
+ selected={mode.key === value}
173
+ collapsed={collapsed}
174
+ onSelect={onValueChange}
175
+ testID={testID ? `${testID}-${mode.key}` : undefined}
176
+ />
177
+ ))}
178
+ </View>
179
+ );
180
+ };
181
+
182
+ export const SidebarModeSwitcher = memo(SidebarModeSwitcherComponent);
183
+ SidebarModeSwitcher.displayName = 'SidebarModeSwitcher';
@@ -1,6 +1,7 @@
1
1
  export { Sidebar } from './Sidebar';
2
2
  export { SidebarFolder } from './SidebarFolder';
3
3
  export { SidebarItem } from './SidebarItem';
4
+ export { SidebarModeSwitcher } from './SidebarModeSwitcher';
4
5
  export { SidebarPlanCard } from './SidebarPlanCard';
5
6
  export { SIDEBAR_RAIL_WIDTH } from './SidebarRail';
6
7
  export { SidebarRailItem } from './SidebarRailItem';
@@ -17,6 +18,8 @@ export type {
17
18
  SidebarItemProps,
18
19
  SidebarMenuGroup,
19
20
  SidebarMenuItem,
21
+ SidebarMode,
22
+ SidebarModeSwitcherProps,
20
23
  SidebarNavItem,
21
24
  SidebarPlan,
22
25
  SidebarPlanCardProps,
@@ -225,19 +225,16 @@ export function ChevronUpDownSmall({ color, size = 16 }: { color: string; size?:
225
225
  );
226
226
  }
227
227
 
228
- /** Popover chrome for both sidebar menus: `w-[265px] rounded-2xl border p-2.5 shadow-dropdown`. */
229
- export function menuPanelStyle(palette: SidebarPalette): ViewStyle {
230
- return {
231
- width: 265,
232
- padding: 10,
233
- borderRadius: 16,
234
- borderWidth: 1,
235
- borderColor: palette.menu.border,
236
- backgroundColor: palette.menu.surface,
237
- boxShadow: palette.menu.shadow,
238
- };
228
+ /** The width both sidebar menus give their popover: `w-[265px]`. */
229
+ export function menuPanelStyle(_palette?: SidebarPalette): ViewStyle {
230
+ // `w-[265px]` is the only thing these menus say differently from the popover
231
+ // panel itself — radius, border, surface, `p-2.5` and `shadow-dropdown` are
232
+ // `Popover`'s own defaults now (`popover/surface.ts`).
233
+ return MENU_PANEL;
239
234
  }
240
235
 
236
+ const MENU_PANEL: ViewStyle = { width: 265 };
237
+
241
238
  /** Full-bleed menu divider: `-mx-2.5 h-px bg-border-button-default`. */
242
239
  export function MenuDivider({ palette, spacing }: { palette: SidebarPalette; spacing: number }) {
243
240
  return (
@@ -35,6 +35,28 @@ export interface SidebarNavItem {
35
35
  onPress?: () => void;
36
36
  }
37
37
 
38
+ /** One mode of a {@link SidebarModeSwitcherProps.modes} switcher. */
39
+ export interface SidebarMode {
40
+ key: string;
41
+ label: string;
42
+ icon: SidebarIcon;
43
+ /** A shortcut hint shown on hover (web), e.g. `⌥⌃1`. */
44
+ shortcut?: string;
45
+ }
46
+
47
+ export interface SidebarModeSwitcherProps {
48
+ modes: ReadonlyArray<SidebarMode>;
49
+ /** Key of the selected mode. */
50
+ value: string;
51
+ onValueChange: (key: string) => void;
52
+ /** Collapses the labels and hints, leaving the icons. */
53
+ collapsed?: boolean;
54
+ /** The radio group's accessible name. Defaults to `"Mode"`. */
55
+ accessibilityLabel?: string;
56
+ style?: StyleProp<ViewStyle>;
57
+ testID?: string;
58
+ }
59
+
38
60
  export interface SidebarItemProps {
39
61
  icon: SidebarIcon;
40
62
  label: string;
@@ -143,6 +165,16 @@ export interface SidebarProps {
143
165
  variant?: SidebarVariant;
144
166
  /** Primary navigation rows. */
145
167
  items?: SidebarNavItem[];
168
+ /**
169
+ * A mode switcher under the header (Search / Computer): a vertical segmented
170
+ * control of icon + label rows. Rendered when given; see `SidebarModeSwitcher`.
171
+ */
172
+ modes?: ReadonlyArray<SidebarMode>;
173
+ /** Key of the selected mode. */
174
+ mode?: string;
175
+ onModeChange?: (key: string) => void;
176
+ /** The mode group's accessible name. Defaults to `"Mode"`. */
177
+ modesLabel?: string;
146
178
  /** Rows pinned to the bottom above the team card (Support, Settings). */
147
179
  secondaryItems?: SidebarNavItem[];
148
180
  /** Key of the selected row. */