@oxy.so/bloom 4.15.0 → 4.16.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.
- package/docs/app-shell.mdx +74 -6
- package/docs/bottom-bar.mdx +9 -1
- package/docs/hooks.mdx +23 -0
- package/docs/sidebar.mdx +15 -2
- package/lib/commonjs/app-shell/AppShell.js +3 -1
- package/lib/commonjs/app-shell/AppShell.js.map +1 -1
- package/lib/commonjs/app-shell/AppShellEngine.js +54 -28
- package/lib/commonjs/app-shell/AppShellEngine.js.map +1 -1
- package/lib/commonjs/app-shell/AppShellHeader.js +4 -3
- package/lib/commonjs/app-shell/AppShellHeader.js.map +1 -1
- package/lib/commonjs/app-shell/NotificationBell.js +8 -4
- package/lib/commonjs/app-shell/NotificationBell.js.map +1 -1
- package/lib/commonjs/app-shell/ProOfferCard.js +19 -11
- package/lib/commonjs/app-shell/ProOfferCard.js.map +1 -1
- package/lib/commonjs/bottom-bar/BottomBarBase.js +9 -2
- package/lib/commonjs/bottom-bar/BottomBarBase.js.map +1 -1
- package/lib/commonjs/hooks/index.js +7 -0
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/use-is-rtl.js +104 -0
- package/lib/commonjs/hooks/use-is-rtl.js.map +1 -0
- package/lib/commonjs/sidebar/Sidebar.js +41 -22
- package/lib/commonjs/sidebar/Sidebar.js.map +1 -1
- package/lib/commonjs/sidebar/SidebarFolder.js +11 -5
- package/lib/commonjs/sidebar/SidebarFolder.js.map +1 -1
- package/lib/commonjs/sidebar/SidebarLogoView.js +2 -2
- package/lib/commonjs/sidebar/SidebarLogoView.js.map +1 -1
- package/lib/commonjs/sidebar/SidebarModeSwitcher.js +1 -1
- package/lib/commonjs/sidebar/SidebarModeSwitcher.js.map +1 -1
- package/lib/commonjs/sidebar/SidebarPlanCard.js +3 -3
- package/lib/commonjs/sidebar/SidebarPlanCard.js.map +1 -1
- package/lib/commonjs/sidebar/SidebarRail.js +7 -1
- package/lib/commonjs/sidebar/SidebarRail.js.map +1 -1
- package/lib/commonjs/sidebar/SidebarRailItem.js +2 -2
- package/lib/commonjs/sidebar/SidebarRailItem.js.map +1 -1
- package/lib/commonjs/sidebar/SidebarTeamMenu.js +12 -7
- package/lib/commonjs/sidebar/SidebarTeamMenu.js.map +1 -1
- package/lib/commonjs/sidebar/SidebarUserMenu.js +9 -5
- package/lib/commonjs/sidebar/SidebarUserMenu.js.map +1 -1
- package/lib/commonjs/tab-bar/TabBarBase.js +19 -5
- package/lib/commonjs/tab-bar/TabBarBase.js.map +1 -1
- package/lib/module/app-shell/AppShell.js +3 -1
- package/lib/module/app-shell/AppShell.js.map +1 -1
- package/lib/module/app-shell/AppShellEngine.js +54 -28
- package/lib/module/app-shell/AppShellEngine.js.map +1 -1
- package/lib/module/app-shell/AppShellHeader.js +4 -3
- package/lib/module/app-shell/AppShellHeader.js.map +1 -1
- package/lib/module/app-shell/NotificationBell.js +8 -4
- package/lib/module/app-shell/NotificationBell.js.map +1 -1
- package/lib/module/app-shell/ProOfferCard.js +19 -11
- package/lib/module/app-shell/ProOfferCard.js.map +1 -1
- package/lib/module/bottom-bar/BottomBarBase.js +9 -2
- package/lib/module/bottom-bar/BottomBarBase.js.map +1 -1
- package/lib/module/hooks/index.js +1 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/use-is-rtl.js +97 -0
- package/lib/module/hooks/use-is-rtl.js.map +1 -0
- package/lib/module/sidebar/Sidebar.js +41 -22
- package/lib/module/sidebar/Sidebar.js.map +1 -1
- package/lib/module/sidebar/SidebarFolder.js +11 -5
- package/lib/module/sidebar/SidebarFolder.js.map +1 -1
- package/lib/module/sidebar/SidebarLogoView.js +2 -2
- package/lib/module/sidebar/SidebarLogoView.js.map +1 -1
- package/lib/module/sidebar/SidebarModeSwitcher.js +1 -1
- package/lib/module/sidebar/SidebarModeSwitcher.js.map +1 -1
- package/lib/module/sidebar/SidebarPlanCard.js +3 -3
- package/lib/module/sidebar/SidebarPlanCard.js.map +1 -1
- package/lib/module/sidebar/SidebarRail.js +7 -1
- package/lib/module/sidebar/SidebarRail.js.map +1 -1
- package/lib/module/sidebar/SidebarRailItem.js +2 -2
- package/lib/module/sidebar/SidebarRailItem.js.map +1 -1
- package/lib/module/sidebar/SidebarTeamMenu.js +12 -7
- package/lib/module/sidebar/SidebarTeamMenu.js.map +1 -1
- package/lib/module/sidebar/SidebarUserMenu.js +9 -5
- package/lib/module/sidebar/SidebarUserMenu.js.map +1 -1
- package/lib/module/tab-bar/TabBarBase.js +19 -5
- package/lib/module/tab-bar/TabBarBase.js.map +1 -1
- package/lib/typescript/commonjs/app-shell/AppShellEngine.d.ts.map +1 -1
- package/lib/typescript/commonjs/app-shell/AppShellHeader.d.ts.map +1 -1
- package/lib/typescript/commonjs/app-shell/NotificationBell.d.ts.map +1 -1
- package/lib/typescript/commonjs/app-shell/ProOfferCard.d.ts.map +1 -1
- package/lib/typescript/commonjs/app-shell/types.d.ts +16 -5
- package/lib/typescript/commonjs/app-shell/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/bottom-bar/BottomBarBase.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/index.d.ts +1 -0
- package/lib/typescript/commonjs/hooks/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/use-is-rtl.d.ts +53 -0
- package/lib/typescript/commonjs/hooks/use-is-rtl.d.ts.map +1 -0
- package/lib/typescript/commonjs/icons/shared.d.ts +10 -10
- package/lib/typescript/commonjs/sidebar/Sidebar.d.ts.map +1 -1
- package/lib/typescript/commonjs/sidebar/SidebarFolder.d.ts.map +1 -1
- package/lib/typescript/commonjs/sidebar/SidebarRail.d.ts +1 -1
- package/lib/typescript/commonjs/sidebar/SidebarRail.d.ts.map +1 -1
- package/lib/typescript/commonjs/sidebar/SidebarTeamMenu.d.ts.map +1 -1
- package/lib/typescript/commonjs/sidebar/SidebarUserMenu.d.ts.map +1 -1
- package/lib/typescript/commonjs/sidebar/types.d.ts +24 -3
- package/lib/typescript/commonjs/sidebar/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/tab-bar/TabBarBase.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/AppShellEngine.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/AppShellHeader.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/NotificationBell.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/ProOfferCard.d.ts.map +1 -1
- package/lib/typescript/module/app-shell/types.d.ts +16 -5
- package/lib/typescript/module/app-shell/types.d.ts.map +1 -1
- package/lib/typescript/module/bottom-bar/BottomBarBase.d.ts.map +1 -1
- package/lib/typescript/module/hooks/index.d.ts +1 -0
- package/lib/typescript/module/hooks/index.d.ts.map +1 -1
- package/lib/typescript/module/hooks/use-is-rtl.d.ts +53 -0
- package/lib/typescript/module/hooks/use-is-rtl.d.ts.map +1 -0
- package/lib/typescript/module/icons/shared.d.ts +10 -10
- package/lib/typescript/module/sidebar/Sidebar.d.ts.map +1 -1
- package/lib/typescript/module/sidebar/SidebarFolder.d.ts.map +1 -1
- package/lib/typescript/module/sidebar/SidebarRail.d.ts +1 -1
- package/lib/typescript/module/sidebar/SidebarRail.d.ts.map +1 -1
- package/lib/typescript/module/sidebar/SidebarTeamMenu.d.ts.map +1 -1
- package/lib/typescript/module/sidebar/SidebarUserMenu.d.ts.map +1 -1
- package/lib/typescript/module/sidebar/types.d.ts +24 -3
- package/lib/typescript/module/sidebar/types.d.ts.map +1 -1
- package/lib/typescript/module/tab-bar/TabBarBase.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/app-shell/AppShell.tsx +1 -1
- package/src/app-shell/AppShellEngine.tsx +45 -24
- package/src/app-shell/AppShellHeader.tsx +4 -3
- package/src/app-shell/NotificationBell.tsx +8 -4
- package/src/app-shell/ProOfferCard.tsx +18 -10
- package/src/app-shell/types.ts +16 -5
- package/src/bottom-bar/BottomBarBase.tsx +9 -3
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-is-rtl.ts +102 -0
- package/src/sidebar/Sidebar.tsx +41 -21
- package/src/sidebar/SidebarFolder.tsx +7 -4
- package/src/sidebar/SidebarLogoView.tsx +2 -2
- package/src/sidebar/SidebarModeSwitcher.tsx +1 -1
- package/src/sidebar/SidebarPlanCard.tsx +3 -3
- package/src/sidebar/SidebarRail.tsx +7 -1
- package/src/sidebar/SidebarRailItem.tsx +2 -2
- package/src/sidebar/SidebarTeamMenu.tsx +10 -6
- package/src/sidebar/SidebarUserMenu.tsx +8 -5
- package/src/sidebar/types.ts +25 -3
- package/src/tab-bar/TabBarBase.tsx +19 -5
|
@@ -31,8 +31,8 @@ function SidebarPlanCardComponent({ plan, collapsed = false, style, testID }: Si
|
|
|
31
31
|
const geometry = useAnimatedStyle(() => ({
|
|
32
32
|
width: inSidebar ? '100%' : naturalWidth.value > 0 ? naturalWidth.value + (36 - naturalWidth.value) * progress.value : progress.value === 1 ? 36 : '100%',
|
|
33
33
|
height: 56 - 20 * progress.value,
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
paddingInlineStart: 10 + (compactPadding - 10) * progress.value,
|
|
35
|
+
paddingInlineEnd: 12 + (compactPadding - 12) * progress.value,
|
|
36
36
|
}), [progress, inSidebar, naturalWidth, compactPadding]);
|
|
37
37
|
const fill = useAnimatedStyle(() => ({ opacity: 1 - progress.value }), [progress]);
|
|
38
38
|
const avatar = plan.avatar ?? { initials: plan.name.slice(0, 1).toUpperCase(), color: 'blue' as const };
|
|
@@ -87,7 +87,7 @@ function SidebarPlanCardComponent({ plan, collapsed = false, style, testID }: Si
|
|
|
87
87
|
<View style={{ minWidth: 0, flexShrink: 1, flexDirection: 'row', alignItems: 'center' }}>
|
|
88
88
|
{avatarNode}
|
|
89
89
|
<Collapsible collapsed={collapsed}>
|
|
90
|
-
<View style={{
|
|
90
|
+
<View style={{ paddingInlineStart: 8, minWidth: 0, flexShrink: 1, flexDirection: 'column', alignItems: 'flex-start', justifyContent: 'center' }}>
|
|
91
91
|
<Text variant="body-medium" numberOfLines={1} style={{ color: palette.text }}>
|
|
92
92
|
{plan.name}
|
|
93
93
|
</Text>
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { Badge } from '../badge';
|
|
5
|
+
import { useDirectionProps } from '../hooks/use-is-rtl';
|
|
5
6
|
import { useSidebarPalette } from './palette';
|
|
6
7
|
import { IS_WEB } from './parts';
|
|
7
8
|
import { SidebarPrimaryAction } from './SidebarPrimaryAction';
|
|
@@ -34,10 +35,14 @@ export function SidebarRail({
|
|
|
34
35
|
secondaryItems = [],
|
|
35
36
|
selected,
|
|
36
37
|
onNavigate,
|
|
38
|
+
accessibilityLabel = 'Sidebar',
|
|
37
39
|
style,
|
|
38
40
|
testID,
|
|
39
41
|
}: SidebarProps) {
|
|
40
42
|
const palette = useSidebarPalette();
|
|
43
|
+
// The badges sit on logical insets; react-native-web resolves those against a
|
|
44
|
+
// `dir` prop, not `<html dir>` (see `useDirectionProps`).
|
|
45
|
+
const dirProps = useDirectionProps();
|
|
41
46
|
|
|
42
47
|
const renderItem = (item: SidebarNavItem) => {
|
|
43
48
|
const isSelected = selected === item.key;
|
|
@@ -68,8 +73,9 @@ export function SidebarRail({
|
|
|
68
73
|
|
|
69
74
|
return (
|
|
70
75
|
<View
|
|
76
|
+
{...dirProps}
|
|
71
77
|
role="complementary"
|
|
72
|
-
accessibilityLabel=
|
|
78
|
+
accessibilityLabel={accessibilityLabel}
|
|
73
79
|
testID={testID}
|
|
74
80
|
style={[
|
|
75
81
|
{
|
|
@@ -26,7 +26,7 @@ const SELECTION_DURATION = 220;
|
|
|
26
26
|
* glyph), background-secondary-hover on hover
|
|
27
27
|
* label 10px, centred, one line; text-primary medium while selected,
|
|
28
28
|
* text-secondary otherwise
|
|
29
|
-
* badge over the indicator's top-right
|
|
29
|
+
* badge over the indicator's top-end corner (top-right in LTR)
|
|
30
30
|
*
|
|
31
31
|
* With `href` the item is a link (a real anchor on web).
|
|
32
32
|
*/
|
|
@@ -111,7 +111,7 @@ const SidebarRailItemComponent: React.FC<SidebarRailItemProps> = ({
|
|
|
111
111
|
<SelectedGlyph width={ICON_SIZE} height={ICON_SIZE} fill={palette.selectedForeground} />
|
|
112
112
|
</Animated.View>
|
|
113
113
|
{badge != null ? (
|
|
114
|
-
<View pointerEvents="none" style={{ position: 'absolute', top: -6,
|
|
114
|
+
<View pointerEvents="none" style={{ position: 'absolute', top: -6, insetInlineStart: INDICATOR_WIDTH - 16 }}>
|
|
115
115
|
{badge}
|
|
116
116
|
</View>
|
|
117
117
|
) : null}
|
|
@@ -10,6 +10,7 @@ import Animated, {
|
|
|
10
10
|
|
|
11
11
|
import { Badge } from '../badge';
|
|
12
12
|
import { useInteractionState } from '../hooks/use-interaction-state';
|
|
13
|
+
import { mirrorAlign, mirrorSide, useIsRtl } from '../hooks/use-is-rtl';
|
|
13
14
|
import { Popover, PopoverContent, PopoverTrigger } from '../popover';
|
|
14
15
|
import { BREAKPOINTS } from '../styles/breakpoints';
|
|
15
16
|
import { borderRadius } from '../styles/tokens';
|
|
@@ -43,7 +44,7 @@ const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
|
|
|
43
44
|
* tertiary-hover) that turns over while open (200ms)
|
|
44
45
|
* card (collapsed) 36px circle, transparent, just the avatar
|
|
45
46
|
* menu 265 wide, radius 16, 1px border, p10, shadow-dropdown,
|
|
46
|
-
* beside the rail (
|
|
47
|
+
* beside the rail (end side, bottom-aligned), below it under
|
|
47
48
|
* `sm`; header, grouped rows with full-bleed dividers
|
|
48
49
|
* (10px either side), footer with a version chip
|
|
49
50
|
* row p8 radius 10 gap 10, icon 20 secondary, body-medium
|
|
@@ -149,6 +150,7 @@ const SidebarTeamMenuComponent: React.FC<SidebarTeamMenuProps> = ({ team, collap
|
|
|
149
150
|
const narrow = width < BREAKPOINTS.sm;
|
|
150
151
|
const { state: hovered, onIn, onOut } = useInteractionState();
|
|
151
152
|
const reducedMotion = useReducedMotion();
|
|
153
|
+
const rtl = useIsRtl();
|
|
152
154
|
|
|
153
155
|
const turn = useSharedValue(0);
|
|
154
156
|
useEffect(() => {
|
|
@@ -168,7 +170,7 @@ const SidebarTeamMenuComponent: React.FC<SidebarTeamMenuProps> = ({ team, collap
|
|
|
168
170
|
const height = expandedHeight + (36 - expandedHeight) * p;
|
|
169
171
|
return { width: inSidebar ? '100%' : naturalWidth.value > 0 ? naturalWidth.value + (36 - naturalWidth.value) * p : p === 1 ? 36 : '100%',
|
|
170
172
|
height,
|
|
171
|
-
borderRadius: height / 2,
|
|
173
|
+
borderRadius: height / 2, paddingInlineStart: 10 + (compactPadding - 10) * p, paddingInlineEnd: 16 + (compactPadding - 16) * p };
|
|
172
174
|
}, [progress, expandedHeight, inSidebar, naturalWidth, compactPadding]);
|
|
173
175
|
const fill = useAnimatedStyle(() => ({ opacity: 1 - progress.value }), [progress]);
|
|
174
176
|
const cardStyle: WebCssStyle = {
|
|
@@ -209,7 +211,7 @@ const SidebarTeamMenuComponent: React.FC<SidebarTeamMenuProps> = ({ team, collap
|
|
|
209
211
|
<View style={{ flexDirection: 'row', alignItems: 'center', minWidth: 0, flexShrink: 1 }}>
|
|
210
212
|
<SidebarAvatarView avatar={team.avatar} size="md" palette={palette} />
|
|
211
213
|
<Collapsible collapsed={collapsed}>
|
|
212
|
-
<View style={{
|
|
214
|
+
<View style={{ paddingInlineStart: 8, justifyContent: 'center', alignItems: 'flex-start' }}>
|
|
213
215
|
<Text variant="body-medium" numberOfLines={1} style={{ color: palette.text }}>
|
|
214
216
|
{team.name}
|
|
215
217
|
</Text>
|
|
@@ -241,9 +243,11 @@ const SidebarTeamMenuComponent: React.FC<SidebarTeamMenuProps> = ({ team, collap
|
|
|
241
243
|
</AnimatedPressable>
|
|
242
244
|
</PopoverTrigger>
|
|
243
245
|
<PopoverContent
|
|
244
|
-
label={`${team.name} menu`}
|
|
245
|
-
|
|
246
|
-
|
|
246
|
+
label={team.menuLabel ?? `${team.name} menu`}
|
|
247
|
+
// Beside the rail's trailing edge: floating sides are physical, so
|
|
248
|
+
// they are mirrored here rather than by the layout.
|
|
249
|
+
side={mirrorSide(narrow ? 'bottom' : 'right', rtl)}
|
|
250
|
+
align={mirrorAlign(narrow ? 'start' : 'end', narrow ? 'bottom' : 'right', rtl)}
|
|
247
251
|
sideOffset={8}
|
|
248
252
|
maxWidth={width - 32}
|
|
249
253
|
style={SIDEBAR_MENU_PANEL}
|
|
@@ -4,6 +4,7 @@ import Animated, { useAnimatedStyle } from 'react-native-reanimated';
|
|
|
4
4
|
|
|
5
5
|
import { Button } from '../button';
|
|
6
6
|
import { useInteractionState } from '../hooks/use-interaction-state';
|
|
7
|
+
import { mirrorAlign, mirrorSide, useIsRtl } from '../hooks/use-is-rtl';
|
|
7
8
|
import { RiAddFill } from '../icons/remix/RiAddFill';
|
|
8
9
|
import { RiEqualizer3Line } from '../icons/remix/RiEqualizer3Line';
|
|
9
10
|
import { Popover, PopoverContent, PopoverTrigger } from '../popover';
|
|
@@ -36,7 +37,7 @@ const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
|
|
|
36
37
|
* without moving layout. Collapsed: the rail's 36px column, the
|
|
37
38
|
* pill squared to 42×42 (3px sides).
|
|
38
39
|
* menu 265 wide, radius 16, border, p10, shadow-dropdown, beside the
|
|
39
|
-
* rail (right
|
|
40
|
+
* rail (its end side — right in LTR — top-aligned), below it under `sm`: "Users with
|
|
40
41
|
* access" (pt5, gap 6), rows px8 py6 radius 10 (20px avatar +
|
|
41
42
|
* body-medium), a full-bleed divider 14px either side, then two
|
|
42
43
|
* small secondary buttons 12 apart, pb8 so the inset reads 18
|
|
@@ -158,6 +159,7 @@ const SidebarUserMenuComponent: React.FC<SidebarUserMenuProps> = ({
|
|
|
158
159
|
const [open, setOpen] = useState(false);
|
|
159
160
|
const { width } = useWindowDimensions();
|
|
160
161
|
const narrow = width < BREAKPOINTS.sm;
|
|
162
|
+
const rtl = useIsRtl();
|
|
161
163
|
const { state: hovered, onIn, onOut } = useInteractionState();
|
|
162
164
|
|
|
163
165
|
const progress = useSidebarCollapseProgress(collapsed);
|
|
@@ -208,7 +210,7 @@ const SidebarUserMenuComponent: React.FC<SidebarUserMenuProps> = ({
|
|
|
208
210
|
/>
|
|
209
211
|
<SidebarAvatarView avatar={account.avatar} size="md" palette={palette} background={avatarBackground} />
|
|
210
212
|
<Collapsible collapsed={collapsed}>
|
|
211
|
-
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 2,
|
|
213
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 2, paddingInlineStart: 8 }}>
|
|
212
214
|
<Text variant="body-medium" numberOfLines={1} style={{ color: palette.text }}>
|
|
213
215
|
{account.name}
|
|
214
216
|
</Text>
|
|
@@ -218,9 +220,10 @@ const SidebarUserMenuComponent: React.FC<SidebarUserMenuProps> = ({
|
|
|
218
220
|
</AnimatedPressable>
|
|
219
221
|
</PopoverTrigger>
|
|
220
222
|
<PopoverContent
|
|
221
|
-
label=
|
|
222
|
-
|
|
223
|
-
|
|
223
|
+
label={account.menuLabel ?? 'Account menu'}
|
|
224
|
+
// Beside the rail's trailing edge; floating sides are physical.
|
|
225
|
+
side={mirrorSide(narrow ? 'bottom' : 'right', rtl)}
|
|
226
|
+
align={mirrorAlign('start', narrow ? 'bottom' : 'right', rtl)}
|
|
224
227
|
sideOffset={8}
|
|
225
228
|
maxWidth={width - 32}
|
|
226
229
|
style={SIDEBAR_MENU_PANEL}
|
package/src/sidebar/types.ts
CHANGED
|
@@ -28,7 +28,7 @@ export interface SidebarNavItem {
|
|
|
28
28
|
activeIcon?: SidebarIcon;
|
|
29
29
|
/** Link target. On web the row renders a real anchor. */
|
|
30
30
|
href?: string;
|
|
31
|
-
/** Counter badge
|
|
31
|
+
/** Counter badge at the row's end (the right in LTR); primary-tinted when the row is selected. */
|
|
32
32
|
badge?: string | number;
|
|
33
33
|
/**
|
|
34
34
|
* An ACTION row (Settings → a modal): intercepts the navigation. When set,
|
|
@@ -87,7 +87,7 @@ export interface SidebarRailItemProps {
|
|
|
87
87
|
activeIcon?: SidebarIcon;
|
|
88
88
|
label: string;
|
|
89
89
|
href?: string;
|
|
90
|
-
/** Sits over the indicator's top-right
|
|
90
|
+
/** Sits over the indicator's top-end corner (top-right in LTR). */
|
|
91
91
|
badge?: ReactNode;
|
|
92
92
|
selected?: boolean;
|
|
93
93
|
onPress?: () => void;
|
|
@@ -158,6 +158,8 @@ export interface SidebarTeam {
|
|
|
158
158
|
groups?: SidebarMenuGroup[];
|
|
159
159
|
/** Footer line: product name and an optional version chip. */
|
|
160
160
|
footer?: { label: string; version?: string };
|
|
161
|
+
/** Names the menu the card opens. Default `` `${name} menu` ``. */
|
|
162
|
+
menuLabel?: string;
|
|
161
163
|
}
|
|
162
164
|
|
|
163
165
|
export interface SidebarAccountUser {
|
|
@@ -210,6 +212,8 @@ export interface SidebarAccount {
|
|
|
210
212
|
onManage?: () => void;
|
|
211
213
|
addUserLabel?: string;
|
|
212
214
|
manageLabel?: string;
|
|
215
|
+
/** Names the menu the switcher opens. Default `"Account menu"`. */
|
|
216
|
+
menuLabel?: string;
|
|
213
217
|
}
|
|
214
218
|
|
|
215
219
|
export interface SidebarTeamMenuProps {
|
|
@@ -289,6 +293,15 @@ export interface SidebarProps {
|
|
|
289
293
|
/** Rendered inside a mobile drawer: always expanded, close button instead of collapse. */
|
|
290
294
|
mobile?: boolean;
|
|
291
295
|
onClose?: () => void;
|
|
296
|
+
|
|
297
|
+
/** The landmark's accessible name. Default `"Sidebar"`. */
|
|
298
|
+
accessibilityLabel?: string;
|
|
299
|
+
/** Names the collapse control while expanded. Default `"Collapse sidebar"`. */
|
|
300
|
+
collapseLabel?: string;
|
|
301
|
+
/** Names the same control while collapsed. Default `"Expand sidebar"`. */
|
|
302
|
+
expandLabel?: string;
|
|
303
|
+
/** Names the `mobile` close button. Default `"Close sidebar"`. */
|
|
304
|
+
closeLabel?: string;
|
|
292
305
|
/** Expanded width fills the container instead of the size's own width. */
|
|
293
306
|
fluid?: boolean;
|
|
294
307
|
/** The panel's edge. Defaults to `card`. */
|
|
@@ -307,8 +320,17 @@ export interface SidebarProps {
|
|
|
307
320
|
searchShortcutLabel?: string;
|
|
308
321
|
/** Binds ⌘L / Ctrl+L on web. Defaults to true. */
|
|
309
322
|
searchShortcut?: boolean;
|
|
323
|
+
/** Names the quick-search button. Default `"Quick Search"`. */
|
|
310
324
|
searchLabel?: string;
|
|
325
|
+
/** Names the search button in a flat `mobile` header. Default `"Search"`. */
|
|
326
|
+
searchButtonLabel?: string;
|
|
327
|
+
/** Placeholder. Defaults `"Search navigation…"`, or `"Search..."` in a flat `mobile` header. */
|
|
311
328
|
searchPlaceholder?: string;
|
|
329
|
+
/** Names the search field. Default `"Filter navigation"`. */
|
|
330
|
+
filterLabel?: string;
|
|
331
|
+
/** Names the button that clears and closes the search. Default `"Clear navigation search"`. */
|
|
332
|
+
clearSearchLabel?: string;
|
|
333
|
+
/** Default `"No results"`. */
|
|
312
334
|
noResultsLabel?: string;
|
|
313
335
|
|
|
314
336
|
/**
|
|
@@ -346,7 +368,7 @@ export interface SidebarTreeItem {
|
|
|
346
368
|
onLongPress?: () => void;
|
|
347
369
|
key: string;
|
|
348
370
|
label: string;
|
|
349
|
-
/** A short chip
|
|
371
|
+
/** A short chip at the row's end (the right in LTR), e.g. a relative time (`34m`, `now`). */
|
|
350
372
|
meta?: string;
|
|
351
373
|
/** Link target (a real anchor on web). */
|
|
352
374
|
href?: string;
|
|
@@ -48,6 +48,7 @@ import Animated, {
|
|
|
48
48
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
49
49
|
|
|
50
50
|
import { useHaptics } from '../hooks/use-haptics';
|
|
51
|
+
import { useDirectionProps, useIsRtl } from '../hooks/use-is-rtl';
|
|
51
52
|
import { useClaimBottomEdge } from '../layout/bottom-edge';
|
|
52
53
|
import { windowEdgeGap } from '../layout/edge';
|
|
53
54
|
import type { ProgressiveBlurProps } from '../progressive-blur/types';
|
|
@@ -178,6 +179,14 @@ function TabBarBody({
|
|
|
178
179
|
const isDragging = useSharedValue(false);
|
|
179
180
|
const lastTicked = useSharedValue(-1);
|
|
180
181
|
const { colors } = useTheme();
|
|
182
|
+
// The tabs are a flex row, so they mirror under RTL by themselves; the
|
|
183
|
+
// highlight is a `translateX` from the start edge and the scrub reads a
|
|
184
|
+
// PHYSICAL `event.x`, so both take the direction explicitly.
|
|
185
|
+
const rtl = useIsRtl();
|
|
186
|
+
const dir = rtl ? -1 : 1;
|
|
187
|
+
// The capsule's `insetInlineStart` must resolve on the same side the row
|
|
188
|
+
// mirrors to; react-native-web reads that from a `dir` prop, not `<html>`.
|
|
189
|
+
const dirProps = useDirectionProps();
|
|
181
190
|
const theme = useTabBarTheme(material === 'solid' ? { ...themeOverrides, solidFallback: themeOverrides?.solidFallback ?? colors.backgroundSecondary } : themeOverrides);
|
|
182
191
|
const impact = useHaptics();
|
|
183
192
|
|
|
@@ -310,7 +319,10 @@ function TabBarBody({
|
|
|
310
319
|
// border edge either way.)
|
|
311
320
|
const barWidth = barOuterWidth - sideInset * 2;
|
|
312
321
|
const itemWidth = (barWidth - ROW_PAD_H * 2) / tabCount;
|
|
313
|
-
|
|
322
|
+
// Under RTL the first tab is at the right edge, so distance is measured
|
|
323
|
+
// from there instead.
|
|
324
|
+
const fromStart = rtl ? barWidth - x : x;
|
|
325
|
+
const raw = (fromStart - ROW_PAD_H) / itemWidth - 0.5;
|
|
314
326
|
return Math.min(Math.max(raw, 0), tabCount - 1);
|
|
315
327
|
};
|
|
316
328
|
|
|
@@ -413,6 +425,7 @@ function TabBarBody({
|
|
|
413
425
|
highlightOpacity,
|
|
414
426
|
minimized,
|
|
415
427
|
progress,
|
|
428
|
+
rtl,
|
|
416
429
|
]);
|
|
417
430
|
|
|
418
431
|
// CRITICAL — every shared value and every scalar a mapper READS must appear
|
|
@@ -497,9 +510,9 @@ function TabBarBody({
|
|
|
497
510
|
// out-of-range one is a real place — one item-width to the LEFT of the
|
|
498
511
|
// first tab, i.e. half outside the pill — not an absence.
|
|
499
512
|
opacity: highlightOpacity.value,
|
|
500
|
-
transform: [{ translateX: ROW_PAD_H + itemWidth * slideIndex.value }],
|
|
513
|
+
transform: [{ translateX: dir * (ROW_PAD_H + itemWidth * slideIndex.value) }],
|
|
501
514
|
};
|
|
502
|
-
}, [progress, slideIndex, highlightOpacity, barOuterWidth, tabCount, minimizeInset]);
|
|
515
|
+
}, [progress, slideIndex, highlightOpacity, barOuterWidth, tabCount, minimizeInset, dir]);
|
|
503
516
|
|
|
504
517
|
// Shared with `useTabBarFootprint`, so a consumer accounting for the bar in
|
|
505
518
|
// its own layout can never drift from where the bar actually sits.
|
|
@@ -534,7 +547,7 @@ function TabBarBody({
|
|
|
534
547
|
|
|
535
548
|
const ResolvedSurface = material === 'solid' ? SolidTabBarSurface : Surface;
|
|
536
549
|
return (
|
|
537
|
-
<View {...viewProps} onLayout={(event) => { setContainerWidth(event.nativeEvent.layout.width); onLayout?.(event); }} pointerEvents="box-none" style={[embedded ? { width: '100%' } : styles.root, style]}>
|
|
550
|
+
<View {...viewProps} {...dirProps} onLayout={(event) => { setContainerWidth(event.nativeEvent.layout.width); onLayout?.(event); }} pointerEvents="box-none" style={[embedded ? { width: '100%' } : styles.root, style]}>
|
|
538
551
|
{/* Progressive blur rising from the screen's bottom edge behind the pill.
|
|
539
552
|
Rendered CONDITIONALLY, and as nothing at all when off: the band is
|
|
540
553
|
full-bleed and 114pt tall at a zero bottom inset, so it blurs whatever
|
|
@@ -784,7 +797,8 @@ const styles = StyleSheet.create({
|
|
|
784
797
|
},
|
|
785
798
|
highlight: {
|
|
786
799
|
position: 'absolute',
|
|
787
|
-
|
|
800
|
+
// The START edge: the translate above runs from it, signed by direction.
|
|
801
|
+
insetInlineStart: 0,
|
|
788
802
|
borderCurve: 'continuous',
|
|
789
803
|
},
|
|
790
804
|
itemRow: {
|