@ankhorage/surface 3.4.5 → 4.0.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/CHANGELOG.md +12 -0
- package/README.md +1 -6
- package/dist/components/radio/Radio.d.ts +3 -0
- package/dist/components/radio/Radio.d.ts.map +1 -1
- package/dist/components/radio/Radio.js +8 -2
- package/dist/components/radio/Radio.js.map +1 -1
- package/dist/components/radio/isRadioTextContent.d.ts +6 -0
- package/dist/components/radio/isRadioTextContent.d.ts.map +1 -0
- package/dist/components/radio/isRadioTextContent.js +7 -0
- package/dist/components/radio/isRadioTextContent.js.map +1 -0
- package/dist/examples/DocsExamples.d.ts.map +1 -1
- package/dist/examples/DocsExamples.js +0 -6
- package/dist/examples/DocsExamples.js.map +1 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/radio/Radio.test.ts +20 -0
- package/src/components/radio/Radio.tsx +9 -3
- package/src/components/radio/isRadioTextContent.ts +8 -0
- package/src/examples/DocsExamples.tsx +0 -6
- package/src/index.test.ts +24 -13
- package/src/index.ts +0 -22
- package/dist/components/action-sheet/ActionSheet.d.ts +0 -4
- package/dist/components/action-sheet/ActionSheet.d.ts.map +0 -1
- package/dist/components/action-sheet/ActionSheet.js +0 -77
- package/dist/components/action-sheet/ActionSheet.js.map +0 -1
- package/dist/components/action-sheet/ActionSheetItem.d.ts +0 -4
- package/dist/components/action-sheet/ActionSheetItem.d.ts.map +0 -1
- package/dist/components/action-sheet/ActionSheetItem.js +0 -27
- package/dist/components/action-sheet/ActionSheetItem.js.map +0 -1
- package/dist/components/action-sheet/index.d.ts +0 -4
- package/dist/components/action-sheet/index.d.ts.map +0 -1
- package/dist/components/action-sheet/index.js +0 -3
- package/dist/components/action-sheet/index.js.map +0 -1
- package/dist/components/action-sheet/types.d.ts +0 -27
- package/dist/components/action-sheet/types.d.ts.map +0 -1
- package/dist/components/action-sheet/types.js +0 -2
- package/dist/components/action-sheet/types.js.map +0 -1
- package/dist/components/drawer/Drawer.d.ts +0 -4
- package/dist/components/drawer/Drawer.d.ts.map +0 -1
- package/dist/components/drawer/Drawer.js +0 -62
- package/dist/components/drawer/Drawer.js.map +0 -1
- package/dist/components/drawer/index.d.ts +0 -3
- package/dist/components/drawer/index.d.ts.map +0 -1
- package/dist/components/drawer/index.js +0 -2
- package/dist/components/drawer/index.js.map +0 -1
- package/dist/components/drawer/types.d.ts +0 -12
- package/dist/components/drawer/types.d.ts.map +0 -1
- package/dist/components/drawer/types.js +0 -2
- package/dist/components/drawer/types.js.map +0 -1
- package/dist/components/navigation/DrawerNavigation.d.ts +0 -4
- package/dist/components/navigation/DrawerNavigation.d.ts.map +0 -1
- package/dist/components/navigation/DrawerNavigation.js +0 -13
- package/dist/components/navigation/DrawerNavigation.js.map +0 -1
- package/dist/components/navigation/DrawerNavigationItem.d.ts +0 -4
- package/dist/components/navigation/DrawerNavigationItem.d.ts.map +0 -1
- package/dist/components/navigation/DrawerNavigationItem.js +0 -9
- package/dist/components/navigation/DrawerNavigationItem.js.map +0 -1
- package/dist/components/navigation/NavigationItem.d.ts +0 -4
- package/dist/components/navigation/NavigationItem.d.ts.map +0 -1
- package/dist/components/navigation/NavigationItem.js +0 -41
- package/dist/components/navigation/NavigationItem.js.map +0 -1
- package/dist/components/navigation/NavigationList.d.ts +0 -4
- package/dist/components/navigation/NavigationList.d.ts.map +0 -1
- package/dist/components/navigation/NavigationList.js +0 -9
- package/dist/components/navigation/NavigationList.js.map +0 -1
- package/dist/components/navigation/TabBar.d.ts +0 -4
- package/dist/components/navigation/TabBar.d.ts.map +0 -1
- package/dist/components/navigation/TabBar.js +0 -15
- package/dist/components/navigation/TabBar.js.map +0 -1
- package/dist/components/navigation/TabBarItem.d.ts +0 -4
- package/dist/components/navigation/TabBarItem.d.ts.map +0 -1
- package/dist/components/navigation/TabBarItem.js +0 -44
- package/dist/components/navigation/TabBarItem.js.map +0 -1
- package/dist/components/navigation/helpers.d.ts +0 -15
- package/dist/components/navigation/helpers.d.ts.map +0 -1
- package/dist/components/navigation/helpers.js +0 -48
- package/dist/components/navigation/helpers.js.map +0 -1
- package/dist/components/navigation/index.d.ts +0 -8
- package/dist/components/navigation/index.d.ts.map +0 -1
- package/dist/components/navigation/index.js +0 -7
- package/dist/components/navigation/index.js.map +0 -1
- package/dist/components/navigation/types.d.ts +0 -58
- package/dist/components/navigation/types.d.ts.map +0 -1
- package/dist/components/navigation/types.js +0 -2
- package/dist/components/navigation/types.js.map +0 -1
- package/src/components/action-sheet/ActionSheet.tsx +0 -130
- package/src/components/action-sheet/ActionSheetItem.tsx +0 -59
- package/src/components/action-sheet/index.ts +0 -3
- package/src/components/action-sheet/types.ts +0 -29
- package/src/components/drawer/Drawer.tsx +0 -100
- package/src/components/drawer/index.ts +0 -2
- package/src/components/drawer/types.ts +0 -13
- package/src/components/navigation/DrawerNavigation.tsx +0 -32
- package/src/components/navigation/DrawerNavigationItem.tsx +0 -23
- package/src/components/navigation/NavigationItem.tsx +0 -79
- package/src/components/navigation/NavigationList.tsx +0 -31
- package/src/components/navigation/TabBar.tsx +0 -31
- package/src/components/navigation/TabBarItem.tsx +0 -79
- package/src/components/navigation/helpers.test.ts +0 -74
- package/src/components/navigation/helpers.ts +0 -81
- package/src/components/navigation/index.ts +0 -16
- package/src/components/navigation/policy.test.ts +0 -140
- package/src/components/navigation/types.ts +0 -66
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Pressable, View } from 'react-native';
|
|
3
|
-
import { FocusScope } from '../../internal/focus/FocusScope';
|
|
4
|
-
import { Portal } from '../../internal/overlay/Portal';
|
|
5
|
-
import { resolvePointerEvents } from '../../internal/resolvePointerEvents';
|
|
6
|
-
import { resolveOverlayAnimation } from '../../internal/resolvers';
|
|
7
|
-
import { Box, Stack, Surface } from '../../layout';
|
|
8
|
-
import { Text } from '../../primitives/text';
|
|
9
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
10
|
-
import { ActionSheetItem } from './ActionSheetItem';
|
|
11
|
-
const boxNonePointerEvents = resolvePointerEvents('box-none');
|
|
12
|
-
export function ActionSheet({ visible, onDismiss, title, description, children, cancelLabel = 'Cancel', closeOnBackdrop = true, interactionPolicy = 'enabled', testID, }) {
|
|
13
|
-
const { theme } = useTheme();
|
|
14
|
-
const animation = resolveOverlayAnimation('modal');
|
|
15
|
-
const passive = interactionPolicy === 'passive';
|
|
16
|
-
if (!visible) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
return (<Portal layer="modal" visible={visible}>
|
|
20
|
-
<View {...boxNonePointerEvents.props} style={[
|
|
21
|
-
boxNonePointerEvents.style,
|
|
22
|
-
{
|
|
23
|
-
bottom: 0,
|
|
24
|
-
left: 0,
|
|
25
|
-
position: 'absolute',
|
|
26
|
-
right: 0,
|
|
27
|
-
top: 0,
|
|
28
|
-
},
|
|
29
|
-
]}>
|
|
30
|
-
<Pressable onPress={passive ? undefined : closeOnBackdrop ? onDismiss : undefined} style={{
|
|
31
|
-
backgroundColor: theme.semantics.neutral.text,
|
|
32
|
-
bottom: 0,
|
|
33
|
-
left: 0,
|
|
34
|
-
opacity: animation.backdropOpacity,
|
|
35
|
-
position: 'absolute',
|
|
36
|
-
right: 0,
|
|
37
|
-
top: 0,
|
|
38
|
-
}} testID={testID ? `${testID}-backdrop` : undefined}/>
|
|
39
|
-
<FocusScope active={visible} onEscape={passive ? undefined : onDismiss} testID={testID ? `${testID}-focus` : undefined}>
|
|
40
|
-
<Box pointerEvents="box-none" style={{
|
|
41
|
-
flex: 1,
|
|
42
|
-
justifyContent: 'flex-end',
|
|
43
|
-
}}>
|
|
44
|
-
<View accessible accessibilityViewIsModal style={{
|
|
45
|
-
alignSelf: 'center',
|
|
46
|
-
maxWidth: 560,
|
|
47
|
-
padding: 16,
|
|
48
|
-
width: '100%',
|
|
49
|
-
}}>
|
|
50
|
-
<Surface p="m" style={{
|
|
51
|
-
borderRadius: 24,
|
|
52
|
-
shadowOpacity: 0.16,
|
|
53
|
-
shadowRadius: 18,
|
|
54
|
-
shadowOffset: { width: 0, height: -8 },
|
|
55
|
-
}} testID={testID} variant="raised">
|
|
56
|
-
<Stack gap="s">
|
|
57
|
-
{title || description ? (<Box px="m" py="s">
|
|
58
|
-
<Stack gap="xxs">
|
|
59
|
-
{title ? (<Text align="center" variant="label" weight="semiBold">
|
|
60
|
-
{title}
|
|
61
|
-
</Text>) : null}
|
|
62
|
-
{description ? (<Text align="center" emphasis="muted" variant="bodySmall">
|
|
63
|
-
{description}
|
|
64
|
-
</Text>) : null}
|
|
65
|
-
</Stack>
|
|
66
|
-
</Box>) : null}
|
|
67
|
-
<Stack gap="xxs">{children}</Stack>
|
|
68
|
-
{onDismiss ? (<ActionSheetItem label={cancelLabel} interactionPolicy={interactionPolicy} onPress={onDismiss} testID={testID ? `${testID}-cancel` : undefined}/>) : null}
|
|
69
|
-
</Stack>
|
|
70
|
-
</Surface>
|
|
71
|
-
</View>
|
|
72
|
-
</Box>
|
|
73
|
-
</FocusScope>
|
|
74
|
-
</View>
|
|
75
|
-
</Portal>);
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=ActionSheet.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ActionSheet.js","sourceRoot":"","sources":["../../../src/components/action-sheet/ActionSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,O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AAC","sourcesContent":["import React from 'react';\nimport { Pressable, View } from 'react-native';\n\nimport { FocusScope } from '../../internal/focus/FocusScope';\nimport { Portal } from '../../internal/overlay/Portal';\nimport { resolvePointerEvents } from '../../internal/resolvePointerEvents';\nimport { resolveOverlayAnimation } from '../../internal/resolvers';\nimport { Box, Stack, Surface } from '../../layout';\nimport { Text } from '../../primitives/text';\nimport { useTheme } from '../../theme/ThemeContext';\nimport { ActionSheetItem } from './ActionSheetItem';\nimport type { ActionSheetProps } from './types';\n\nconst boxNonePointerEvents = resolvePointerEvents('box-none');\n\nexport function ActionSheet({\n visible,\n onDismiss,\n title,\n description,\n children,\n cancelLabel = 'Cancel',\n closeOnBackdrop = true,\n interactionPolicy = 'enabled',\n testID,\n}: ActionSheetProps) {\n const { theme } = useTheme();\n const animation = resolveOverlayAnimation('modal');\n const passive = interactionPolicy === 'passive';\n\n if (!visible) {\n return null;\n }\n\n return (\n <Portal layer=\"modal\" visible={visible}>\n <View\n {...boxNonePointerEvents.props}\n style={[\n boxNonePointerEvents.style,\n {\n bottom: 0,\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n },\n ]}\n >\n <Pressable\n onPress={passive ? undefined : closeOnBackdrop ? onDismiss : undefined}\n style={{\n backgroundColor: theme.semantics.neutral.text,\n bottom: 0,\n left: 0,\n opacity: animation.backdropOpacity,\n position: 'absolute',\n right: 0,\n top: 0,\n }}\n testID={testID ? `${testID}-backdrop` : undefined}\n />\n <FocusScope\n active={visible}\n onEscape={passive ? undefined : onDismiss}\n testID={testID ? `${testID}-focus` : undefined}\n >\n <Box\n pointerEvents=\"box-none\"\n style={{\n flex: 1,\n justifyContent: 'flex-end',\n }}\n >\n <View\n accessible\n accessibilityViewIsModal\n style={{\n alignSelf: 'center',\n maxWidth: 560,\n padding: 16,\n width: '100%',\n }}\n >\n <Surface\n p=\"m\"\n style={{\n borderRadius: 24,\n shadowOpacity: 0.16,\n shadowRadius: 18,\n shadowOffset: { width: 0, height: -8 },\n }}\n testID={testID}\n variant=\"raised\"\n >\n <Stack gap=\"s\">\n {title || description ? (\n <Box px=\"m\" py=\"s\">\n <Stack gap=\"xxs\">\n {title ? (\n <Text align=\"center\" variant=\"label\" weight=\"semiBold\">\n {title}\n </Text>\n ) : null}\n {description ? (\n <Text align=\"center\" emphasis=\"muted\" variant=\"bodySmall\">\n {description}\n </Text>\n ) : null}\n </Stack>\n </Box>\n ) : null}\n <Stack gap=\"xxs\">{children}</Stack>\n {onDismiss ? (\n <ActionSheetItem\n label={cancelLabel}\n interactionPolicy={interactionPolicy}\n onPress={onDismiss}\n testID={testID ? `${testID}-cancel` : undefined}\n />\n ) : null}\n </Stack>\n </Surface>\n </View>\n </Box>\n </FocusScope>\n </View>\n </Portal>\n );\n}\n"]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ActionSheetItemProps } from './types';
|
|
3
|
-
export declare function ActionSheetItem({ label, description, leading, trailing, color, disabled, selected, interactionPolicy, onPress, testID, }: ActionSheetItemProps): React.JSX.Element;
|
|
4
|
-
//# sourceMappingURL=ActionSheetItem.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ActionSheetItem.d.ts","sourceRoot":"","sources":["../../../src/components/action-sheet/ActionSheetItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,WAAW,EACX,OAAO,EACP,QAAQ,EACR,KAAK,EACL,QAAgB,EAChB,QAAgB,EAChB,iBAA6B,EAC7B,OAAO,EACP,MAAM,GACP,EAAE,oBAAoB,qBAwCtB"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Box, Inline, Stack } from '../../layout';
|
|
3
|
-
import { ButtonBase } from '../../primitives/button-base';
|
|
4
|
-
import { Text } from '../../primitives/text';
|
|
5
|
-
export function ActionSheetItem({ label, description, leading, trailing, color, disabled = false, selected = false, interactionPolicy = 'enabled', onPress, testID, }) {
|
|
6
|
-
return (<ButtonBase accessibilityRole="button" accessibilityState={{ disabled, selected }} disabled={disabled} interactionPolicy={interactionPolicy} onPress={onPress} radius="m" testID={testID}>
|
|
7
|
-
{(state) => (<Box px="m" py="m" radius="m" style={{
|
|
8
|
-
opacity: state.disabled ? 0.56 : 1,
|
|
9
|
-
}}>
|
|
10
|
-
<Inline align="center" gap="m" justify="space-between" wrap="nowrap">
|
|
11
|
-
{leading ? <Box>{leading}</Box> : null}
|
|
12
|
-
<Box flex={1}>
|
|
13
|
-
<Stack gap="xxs">
|
|
14
|
-
<Text color={color} variant="body" weight={selected ? 'semiBold' : 'medium'}>
|
|
15
|
-
{label}
|
|
16
|
-
</Text>
|
|
17
|
-
{description ? (<Text emphasis="muted" variant="bodySmall">
|
|
18
|
-
{description}
|
|
19
|
-
</Text>) : null}
|
|
20
|
-
</Stack>
|
|
21
|
-
</Box>
|
|
22
|
-
{trailing ? <Box>{trailing}</Box> : null}
|
|
23
|
-
</Inline>
|
|
24
|
-
</Box>)}
|
|
25
|
-
</ButtonBase>);
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=ActionSheetItem.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ActionSheetItem.js","sourceRoot":"","sources":["../../../src/components/action-sheet/ActionSheetItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAG7C,MAAM,UAAU,eAAe,CAAC,EAC9B,KAAK,EACL,WAAW,EACX,OAAO,EACP,QAAQ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,IAAI,CACN;gBAAA,CAAC,WAAW,CAAC,CAAC,CAAC,CACb,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CACxC;oBAAA,CAAC,WAAW,CACd;kBAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,IAAI,CACV;cAAA,EAAE,KAAK,CACT;YAAA,EAAE,GAAG,CACL;YAAA,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAC1C;UAAA,EAAE,MAAM,CACV;QAAA,EAAE,GAAG,CAAC,CACP,CACH;IAAA,EAAE,UAAU,CAAC,CACd,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport { Box, Inline, Stack } from '../../layout';\nimport { ButtonBase } from '../../primitives/button-base';\nimport { Text } from '../../primitives/text';\nimport type { ActionSheetItemProps } from './types';\n\nexport function ActionSheetItem({\n label,\n description,\n leading,\n trailing,\n color,\n disabled = false,\n selected = false,\n interactionPolicy = 'enabled',\n onPress,\n testID,\n}: ActionSheetItemProps) {\n return (\n <ButtonBase\n accessibilityRole=\"button\"\n accessibilityState={{ disabled, selected }}\n disabled={disabled}\n interactionPolicy={interactionPolicy}\n onPress={onPress}\n radius=\"m\"\n testID={testID}\n >\n {(state) => (\n <Box\n px=\"m\"\n py=\"m\"\n radius=\"m\"\n style={{\n opacity: state.disabled ? 0.56 : 1,\n }}\n >\n <Inline align=\"center\" gap=\"m\" justify=\"space-between\" wrap=\"nowrap\">\n {leading ? <Box>{leading}</Box> : null}\n <Box flex={1}>\n <Stack gap=\"xxs\">\n <Text color={color} variant=\"body\" weight={selected ? 'semiBold' : 'medium'}>\n {label}\n </Text>\n {description ? (\n <Text emphasis=\"muted\" variant=\"bodySmall\">\n {description}\n </Text>\n ) : null}\n </Stack>\n </Box>\n {trailing ? <Box>{trailing}</Box> : null}\n </Inline>\n </Box>\n )}\n </ButtonBase>\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/action-sheet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/action-sheet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export { ActionSheet } from './ActionSheet';\nexport { ActionSheetItem } from './ActionSheetItem';\nexport type { ActionSheetItemProps, ActionSheetProps } from './types';\n"]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { InteractionPolicy } from '../../interactionPolicy';
|
|
3
|
-
import type { SurfaceColor } from '../../surfaceColor';
|
|
4
|
-
export interface ActionSheetProps {
|
|
5
|
-
visible: boolean;
|
|
6
|
-
onDismiss?: (() => void) | undefined;
|
|
7
|
-
title?: React.ReactNode;
|
|
8
|
-
description?: React.ReactNode;
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
cancelLabel?: React.ReactNode;
|
|
11
|
-
closeOnBackdrop?: boolean;
|
|
12
|
-
interactionPolicy?: InteractionPolicy;
|
|
13
|
-
testID?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface ActionSheetItemProps {
|
|
16
|
-
label: React.ReactNode;
|
|
17
|
-
description?: React.ReactNode;
|
|
18
|
-
leading?: React.ReactNode;
|
|
19
|
-
trailing?: React.ReactNode;
|
|
20
|
-
color?: SurfaceColor;
|
|
21
|
-
disabled?: boolean;
|
|
22
|
-
selected?: boolean;
|
|
23
|
-
interactionPolicy?: InteractionPolicy;
|
|
24
|
-
onPress?: (() => void) | undefined;
|
|
25
|
-
testID?: string;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/action-sheet/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACrC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,OAAO,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/action-sheet/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { InteractionPolicy } from '../../interactionPolicy';\nimport type { SurfaceColor } from '../../surfaceColor';\n\nexport interface ActionSheetProps {\n visible: boolean;\n onDismiss?: (() => void) | undefined;\n title?: React.ReactNode;\n description?: React.ReactNode;\n children?: React.ReactNode;\n cancelLabel?: React.ReactNode;\n closeOnBackdrop?: boolean;\n interactionPolicy?: InteractionPolicy;\n testID?: string;\n}\n\nexport interface ActionSheetItemProps {\n label: React.ReactNode;\n description?: React.ReactNode;\n leading?: React.ReactNode;\n trailing?: React.ReactNode;\n color?: SurfaceColor;\n disabled?: boolean;\n selected?: boolean;\n interactionPolicy?: InteractionPolicy;\n onPress?: (() => void) | undefined;\n testID?: string;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAI3C,wBAAgB,MAAM,CAAC,EACrB,OAAO,EACP,SAAS,EACT,QAAkB,EAClB,QAAQ,EACR,eAAsB,EACtB,iBAA6B,EAC7B,MAAM,GACP,EAAE,WAAW,4BA8Eb"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Pressable, View } from 'react-native';
|
|
3
|
-
import { FocusScope } from '../../internal/focus/FocusScope';
|
|
4
|
-
import { Portal } from '../../internal/overlay/Portal';
|
|
5
|
-
import { resolvePointerEvents } from '../../internal/resolvePointerEvents';
|
|
6
|
-
import { resolveOverlayAnimation } from '../../internal/resolvers';
|
|
7
|
-
import { Box, Surface } from '../../layout';
|
|
8
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
9
|
-
const boxNonePointerEvents = resolvePointerEvents('box-none');
|
|
10
|
-
export function Drawer({ visible, onDismiss, position = 'right', children, closeOnBackdrop = true, interactionPolicy = 'enabled', testID, }) {
|
|
11
|
-
const { theme } = useTheme();
|
|
12
|
-
const animation = resolveOverlayAnimation('drawer');
|
|
13
|
-
const passive = interactionPolicy === 'passive';
|
|
14
|
-
if (!visible) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
return (<Portal layer="drawer" visible={visible}>
|
|
18
|
-
<View {...boxNonePointerEvents.props} style={[
|
|
19
|
-
boxNonePointerEvents.style,
|
|
20
|
-
{
|
|
21
|
-
bottom: 0,
|
|
22
|
-
left: 0,
|
|
23
|
-
position: 'absolute',
|
|
24
|
-
right: 0,
|
|
25
|
-
top: 0,
|
|
26
|
-
},
|
|
27
|
-
]}>
|
|
28
|
-
<Pressable onPress={passive ? undefined : closeOnBackdrop ? onDismiss : undefined} style={{
|
|
29
|
-
backgroundColor: theme.semantics.neutral.text,
|
|
30
|
-
bottom: 0,
|
|
31
|
-
left: 0,
|
|
32
|
-
opacity: animation.backdropOpacity,
|
|
33
|
-
position: 'absolute',
|
|
34
|
-
right: 0,
|
|
35
|
-
top: 0,
|
|
36
|
-
}} testID={testID ? `${testID}-backdrop` : undefined}/>
|
|
37
|
-
<FocusScope active={visible} onEscape={passive ? undefined : onDismiss} testID={testID ? `${testID}-focus` : undefined}>
|
|
38
|
-
<Box pointerEvents="box-none" style={{
|
|
39
|
-
flex: 1,
|
|
40
|
-
justifyContent: 'flex-start',
|
|
41
|
-
}}>
|
|
42
|
-
<View accessible accessibilityViewIsModal style={{
|
|
43
|
-
alignSelf: position === 'left' ? 'flex-start' : 'flex-end',
|
|
44
|
-
height: '100%',
|
|
45
|
-
maxWidth: 420,
|
|
46
|
-
width: '88%',
|
|
47
|
-
}}>
|
|
48
|
-
<Surface p="l" style={{
|
|
49
|
-
height: '100%',
|
|
50
|
-
shadowOpacity: 0.14,
|
|
51
|
-
shadowRadius: 14,
|
|
52
|
-
shadowOffset: { width: position === 'left' ? 4 : -4, height: 0 },
|
|
53
|
-
}} testID={testID} variant="raised">
|
|
54
|
-
{children}
|
|
55
|
-
</Surface>
|
|
56
|
-
</View>
|
|
57
|
-
</Box>
|
|
58
|
-
</FocusScope>
|
|
59
|
-
</View>
|
|
60
|
-
</Portal>);
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=Drawer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../../src/components/drawer/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;AAE9D,MAAM,UAAU,MAAM,CAAC,EACrB,OAAO,EACP,SAAS,EACT,QAAQ,GAAG,OAAO,EAClB,QAAQ,EACR,eAAe,GAAG,IAAI,EACtB,iBAAiB,GAAG,SAAS,EAC7B,MAAM,GACM;IACZ,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAG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C,SAAS,CAAC,CAE/C;UAAA,CAAC,GAAG,CACF,aAAa,CAAC,UAAU,CACxB,KAAK,CAAC,CAAC;YACL,IAAI,EAAE,CAAC;YACP,cAAc,EAAE,YAAY;SAC7B,CAAC,CAEF;YAAA,CAAC,IAAI,CACH,UAAU,CACV,wBAAwB,CACxB,KAAK,CAAC,CAAC;YACL,SAAS,EAAE,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU;YAC1D,MAAM,EAAE,MAAM;YACd,QAAQ,EAAE,GAAG;YACb,KAAK,EAAE,KAAK;SACb,CAAC,CAEF;cAAA,CAAC,OAAO,CACN,CAAC,CAAC,GAAG,CACL,KAAK,CAAC,CAAC;YACL,MAAM,EAAE,MAAM;YACd,aAAa,EAAE,IAAI;YACnB,YAAY,EAAE,EAAE;YAChB,YAAY,EAAE,EAAE,KAAK,EAAE,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;SACjE,CAAC,CACF,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,OAAO,CAAC,QAAQ,CAEhB;gBAAA,CAAC,QAAQ,CACX;cAAA,EAAE,OAAO,CACX;YAAA,EAAE,IAAI,CACR;UAAA,EAAE,GAAG,CACP;QAAA,EAAE,UAAU,CACd;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,MAAM,CAAC,CACV,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { Pressable, View } from 'react-native';\n\nimport { FocusScope } from '../../internal/focus/FocusScope';\nimport { Portal } from '../../internal/overlay/Portal';\nimport { resolvePointerEvents } from '../../internal/resolvePointerEvents';\nimport { resolveOverlayAnimation } from '../../internal/resolvers';\nimport { Box, Surface } from '../../layout';\nimport { useTheme } from '../../theme/ThemeContext';\nimport type { DrawerProps } from './types';\n\nconst boxNonePointerEvents = resolvePointerEvents('box-none');\n\nexport function Drawer({\n visible,\n onDismiss,\n position = 'right',\n children,\n closeOnBackdrop = true,\n interactionPolicy = 'enabled',\n testID,\n}: DrawerProps) {\n const { theme } = useTheme();\n const animation = resolveOverlayAnimation('drawer');\n const passive = interactionPolicy === 'passive';\n\n if (!visible) {\n return null;\n }\n\n return (\n <Portal layer=\"drawer\" visible={visible}>\n <View\n {...boxNonePointerEvents.props}\n style={[\n boxNonePointerEvents.style,\n {\n bottom: 0,\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n },\n ]}\n >\n <Pressable\n onPress={passive ? undefined : closeOnBackdrop ? onDismiss : undefined}\n style={{\n backgroundColor: theme.semantics.neutral.text,\n bottom: 0,\n left: 0,\n opacity: animation.backdropOpacity,\n position: 'absolute',\n right: 0,\n top: 0,\n }}\n testID={testID ? `${testID}-backdrop` : undefined}\n />\n <FocusScope\n active={visible}\n onEscape={passive ? undefined : onDismiss}\n testID={testID ? `${testID}-focus` : undefined}\n >\n <Box\n pointerEvents=\"box-none\"\n style={{\n flex: 1,\n justifyContent: 'flex-start',\n }}\n >\n <View\n accessible\n accessibilityViewIsModal\n style={{\n alignSelf: position === 'left' ? 'flex-start' : 'flex-end',\n height: '100%',\n maxWidth: 420,\n width: '88%',\n }}\n >\n <Surface\n p=\"l\"\n style={{\n height: '100%',\n shadowOpacity: 0.14,\n shadowRadius: 14,\n shadowOffset: { width: position === 'left' ? 4 : -4, height: 0 },\n }}\n testID={testID}\n variant=\"raised\"\n >\n {children}\n </Surface>\n </View>\n </Box>\n </FocusScope>\n </View>\n </Portal>\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/drawer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export { Drawer } from './Drawer';\nexport type { DrawerProps } from './types';\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { InteractionPolicy } from '../../interactionPolicy';
|
|
3
|
-
export interface DrawerProps {
|
|
4
|
-
visible: boolean;
|
|
5
|
-
onDismiss?: (() => void) | undefined;
|
|
6
|
-
position?: 'left' | 'right';
|
|
7
|
-
children?: React.ReactNode;
|
|
8
|
-
closeOnBackdrop?: boolean;
|
|
9
|
-
interactionPolicy?: InteractionPolicy;
|
|
10
|
-
testID?: string;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/drawer/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { InteractionPolicy } from '../../interactionPolicy';\n\nexport interface DrawerProps {\n visible: boolean;\n onDismiss?: (() => void) | undefined;\n position?: 'left' | 'right';\n children?: React.ReactNode;\n closeOnBackdrop?: boolean;\n interactionPolicy?: InteractionPolicy;\n testID?: string;\n}\n"]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { DrawerNavigationProps } from './types';
|
|
3
|
-
export declare function DrawerNavigation({ items, header, footer, compact, testID, interactionPolicy, }: DrawerNavigationProps): React.JSX.Element;
|
|
4
|
-
//# sourceMappingURL=DrawerNavigation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerNavigation.d.ts","sourceRoot":"","sources":["../../../src/components/navigation/DrawerNavigation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAe,EACf,MAAM,EACN,iBAAiB,GAClB,EAAE,qBAAqB,qBAkBvB"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Stack } from '../../layout';
|
|
3
|
-
import { DrawerNavigationItem } from './DrawerNavigationItem';
|
|
4
|
-
export function DrawerNavigation({ items, header, footer, compact = false, testID, interactionPolicy, }) {
|
|
5
|
-
return (<Stack gap={compact ? 's' : 'm'} testID={testID}>
|
|
6
|
-
{header}
|
|
7
|
-
<Stack gap={compact ? 'xs' : 's'}>
|
|
8
|
-
{items.map((item) => (<DrawerNavigationItem compact={compact} interactionPolicy={interactionPolicy} item={item} key={item.id} testID={testID}/>))}
|
|
9
|
-
</Stack>
|
|
10
|
-
{footer}
|
|
11
|
-
</Stack>);
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=DrawerNavigation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerNavigation.js","sourceRoot":"","sources":["../../../src/components/navigation/DrawerNavigation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,MAAM,UAAU,gBAAgB,CAAC,EAC/B,KAAK,EACL,MAAM,EACN,MAAM,EACN,OAAO,GAAG,KAAK,EACf,MAAM,EACN,iBAAiB,GACK;IACtB,OAAO,CACL,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAC9C;MAAA,CAAC,MAAM,CACP;MAAA,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAC/B;QAAA,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,CAAC,oBAAoB,CACnB,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,IAAI,CAAC,CAAC,IAAI,CAAC,CACX,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CACb,MAAM,CAAC,CAAC,MAAM,CAAC,EACf,CACH,CAAC,CACJ;MAAA,EAAE,KAAK,CACP;MAAA,CAAC,MAAM,CACT;IAAA,EAAE,KAAK,CAAC,CACT,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport { Stack } from '../../layout';\nimport { DrawerNavigationItem } from './DrawerNavigationItem';\nimport type { DrawerNavigationProps } from './types';\n\nexport function DrawerNavigation({\n items,\n header,\n footer,\n compact = false,\n testID,\n interactionPolicy,\n}: DrawerNavigationProps) {\n return (\n <Stack gap={compact ? 's' : 'm'} testID={testID}>\n {header}\n <Stack gap={compact ? 'xs' : 's'}>\n {items.map((item) => (\n <DrawerNavigationItem\n compact={compact}\n interactionPolicy={interactionPolicy}\n item={item}\n key={item.id}\n testID={testID}\n />\n ))}\n </Stack>\n {footer}\n </Stack>\n );\n}\n"]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { DrawerNavigationItemProps } from './types';
|
|
3
|
-
export declare function DrawerNavigationItem({ item, compact, testID, interactionPolicy, }: DrawerNavigationItemProps): React.JSX.Element;
|
|
4
|
-
//# sourceMappingURL=DrawerNavigationItem.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerNavigationItem.d.ts","sourceRoot":"","sources":["../../../src/components/navigation/DrawerNavigationItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAEzD,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EACJ,OAAe,EACf,MAAM,EACN,iBAAiB,GAClB,EAAE,yBAAyB,qBAY3B"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { NavigationItem } from './NavigationItem';
|
|
3
|
-
export function DrawerNavigationItem({ item, compact = false, testID, interactionPolicy, }) {
|
|
4
|
-
return (<NavigationItem compact={compact} interactionPolicy={interactionPolicy} item={{
|
|
5
|
-
...item,
|
|
6
|
-
accessibilityRole: item.accessibilityRole ?? 'button',
|
|
7
|
-
}} testID={testID}/>);
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=DrawerNavigationItem.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerNavigationItem.js","sourceRoot":"","sources":["../../../src/components/navigation/DrawerNavigationItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,MAAM,UAAU,oBAAoB,CAAC,EACnC,IAAI,EACJ,OAAO,GAAG,KAAK,EACf,MAAM,EACN,iBAAiB,GACS;IAC1B,OAAO,CACL,CAAC,cAAc,CACb,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,IAAI,CAAC,CAAC;YACJ,GAAG,IAAI;YACP,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,IAAI,QAAQ;SACtD,CAAC,CACF,MAAM,CAAC,CAAC,MAAM,CAAC,EACf,CACH,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport { NavigationItem } from './NavigationItem';\nimport type { DrawerNavigationItemProps } from './types';\n\nexport function DrawerNavigationItem({\n item,\n compact = false,\n testID,\n interactionPolicy,\n}: DrawerNavigationItemProps) {\n return (\n <NavigationItem\n compact={compact}\n interactionPolicy={interactionPolicy}\n item={{\n ...item,\n accessibilityRole: item.accessibilityRole ?? 'button',\n }}\n testID={testID}\n />\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationItem.d.ts","sourceRoot":"","sources":["../../../src/components/navigation/NavigationItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,OAAe,EACf,MAAM,EACN,iBAAiB,GAClB,EAAE,mBAAmB,qBA8DrB"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
import { Box } from '../../layout';
|
|
4
|
-
import { ButtonBase } from '../../primitives/button-base';
|
|
5
|
-
import { Icon } from '../../primitives/icon';
|
|
6
|
-
import { Text } from '../../primitives/text';
|
|
7
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
8
|
-
import { resolveNavigationAccessibilityState, resolveNavigationItemPresentation } from './helpers';
|
|
9
|
-
export function NavigationItem({ item, compact = false, testID, interactionPolicy, }) {
|
|
10
|
-
const { theme } = useTheme();
|
|
11
|
-
const active = Boolean(item.active);
|
|
12
|
-
const disabled = Boolean(item.disabled);
|
|
13
|
-
const resolvedTestID = item.testID ?? (testID ? `${testID}-item-${item.id}` : undefined);
|
|
14
|
-
const resolvedAccessibilityState = resolveNavigationAccessibilityState(active, disabled, item.accessibilityState);
|
|
15
|
-
return (<ButtonBase accessibilityLabel={item.accessibilityLabel} accessibilityRole={item.accessibilityRole ?? 'button'} accessibilityState={resolvedAccessibilityState} disabled={disabled} interactionPolicy={interactionPolicy} onPress={item.onPress} testID={resolvedTestID}>
|
|
16
|
-
{(state) => {
|
|
17
|
-
const presentation = resolveNavigationItemPresentation(theme, {
|
|
18
|
-
active,
|
|
19
|
-
disabled,
|
|
20
|
-
state,
|
|
21
|
-
});
|
|
22
|
-
return (<Box px="m" py={compact ? 's' : 'm'} radius="m" style={{
|
|
23
|
-
backgroundColor: presentation.backgroundColor,
|
|
24
|
-
flexDirection: 'row',
|
|
25
|
-
alignItems: 'center',
|
|
26
|
-
opacity: presentation.opacity,
|
|
27
|
-
}}>
|
|
28
|
-
{item.icon ? (<View style={{ marginRight: theme.spacing.s }}>
|
|
29
|
-
<Icon {...item.icon} color={presentation.contentColor} size={compact ? 's' : 'm'}/>
|
|
30
|
-
</View>) : null}
|
|
31
|
-
<Box flex={1}>
|
|
32
|
-
<Text color={active && !disabled ? 'primary' : undefined} emphasis={disabled ? 'muted' : 'default'} numberOfLines={1} variant={compact ? 'bodySmall' : 'body'} weight="medium">
|
|
33
|
-
{item.label}
|
|
34
|
-
</Text>
|
|
35
|
-
</Box>
|
|
36
|
-
{item.badge ? <View style={{ marginLeft: theme.spacing.s }}>{item.badge}</View> : null}
|
|
37
|
-
</Box>);
|
|
38
|
-
}}
|
|
39
|
-
</ButtonBase>);
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=NavigationItem.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationItem.js","sourceRoot":"","sources":["../../../src/components/navigation/NavigationItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,mCAAmC,EAAE,iCAAiC,EAAE,MAAM,WAAW,CAAC;AAGnG,MAAM,UAAU,cAAc,CAAC,EAC7B,IAAI,EACJ,OAAO,GAAG,KAAK,EACf,MAAM,EACN,iBAAiB,GACG;IACpB,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,SAAS,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACzF,MAAM,0BAA0B,GAAG,mCAAmC,CACpE,MAAM,EACN,QAAQ,EACR,IAAI,CAAC,kBAAkB,CACxB,CAAC;IAEF,OAAO,CACL,CAAC,UAAU,CACT,kBAAkB,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAC5C,iBAAiB,CAAC,CAA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,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CACnD,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CACzC,aAAa,CAAC,CAAC,CAAC,CAAC,CACjB,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CACxC,MAAM,CAAC,QAAQ,CAEf;gBAAA,CAAC,IAAI,CAAC,KAAK,CACb;cAAA,EAAE,IAAI,CACR;YAAA,EAAE,GAAG,CACL;YAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CACxF;UAAA,EAAE,GAAG,CAAC,CACP,CAAC;QACJ,CAAC,CACH;IAAA,EAAE,UAAU,CAAC,CACd,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\n\nimport { Box } from '../../layout';\nimport { ButtonBase } from '../../primitives/button-base';\nimport { Icon } from '../../primitives/icon';\nimport { Text } from '../../primitives/text';\nimport { useTheme } from '../../theme/ThemeContext';\nimport { resolveNavigationAccessibilityState, resolveNavigationItemPresentation } from './helpers';\nimport type { NavigationItemProps } from './types';\n\nexport function NavigationItem({\n item,\n compact = false,\n testID,\n interactionPolicy,\n}: NavigationItemProps) {\n const { theme } = useTheme();\n const active = Boolean(item.active);\n const disabled = Boolean(item.disabled);\n const resolvedTestID = item.testID ?? (testID ? `${testID}-item-${item.id}` : undefined);\n const resolvedAccessibilityState = resolveNavigationAccessibilityState(\n active,\n disabled,\n item.accessibilityState,\n );\n\n return (\n <ButtonBase\n accessibilityLabel={item.accessibilityLabel}\n accessibilityRole={item.accessibilityRole ?? 'button'}\n accessibilityState={resolvedAccessibilityState}\n disabled={disabled}\n interactionPolicy={interactionPolicy}\n onPress={item.onPress}\n testID={resolvedTestID}\n >\n {(state) => {\n const presentation = resolveNavigationItemPresentation(theme, {\n active,\n disabled,\n state,\n });\n\n return (\n <Box\n px=\"m\"\n py={compact ? 's' : 'm'}\n radius=\"m\"\n style={{\n backgroundColor: presentation.backgroundColor,\n flexDirection: 'row',\n alignItems: 'center',\n opacity: presentation.opacity,\n }}\n >\n {item.icon ? (\n <View style={{ marginRight: theme.spacing.s }}>\n <Icon {...item.icon} color={presentation.contentColor} size={compact ? 's' : 'm'} />\n </View>\n ) : null}\n <Box flex={1}>\n <Text\n color={active && !disabled ? 'primary' : undefined}\n emphasis={disabled ? 'muted' : 'default'}\n numberOfLines={1}\n variant={compact ? 'bodySmall' : 'body'}\n weight=\"medium\"\n >\n {item.label}\n </Text>\n </Box>\n {item.badge ? <View style={{ marginLeft: theme.spacing.s }}>{item.badge}</View> : null}\n </Box>\n );\n }}\n </ButtonBase>\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationList.d.ts","sourceRoot":"","sources":["../../../src/components/navigation/NavigationList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,WAAwB,EACxB,OAAe,EACf,MAAM,EACN,iBAAiB,GAClB,EAAE,mBAAmB,qBAkBrB"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Stack } from '../../layout';
|
|
3
|
-
import { NavigationItem } from './NavigationItem';
|
|
4
|
-
export function NavigationList({ items, orientation = 'vertical', compact = false, testID, interactionPolicy, }) {
|
|
5
|
-
return (<Stack direction={orientation === 'horizontal' ? 'row' : 'column'} gap={compact ? 'xs' : 's'} testID={testID}>
|
|
6
|
-
{items.map((item) => (<NavigationItem compact={compact} interactionPolicy={interactionPolicy} item={item} key={item.id} testID={testID}/>))}
|
|
7
|
-
</Stack>);
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=NavigationList.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationList.js","sourceRoot":"","sources":["../../../src/components/navigation/NavigationList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,MAAM,UAAU,cAAc,CAAC,EAC7B,KAAK,EACL,WAAW,GAAG,UAAU,EACxB,OAAO,GAAG,KAAK,EACf,MAAM,EACN,iBAAiB,GACG;IACpB,OAAO,CACL,CAAC,KAAK,CACJ,SAAS,CAAC,CAAC,WAAW,KAAK,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAC3D,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAC1B,MAAM,CAAC,CAAC,MAAM,CAAC,CAEf;MAAA,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,CAAC,cAAc,CACb,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,IAAI,CAAC,CAAC,IAAI,CAAC,CACX,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CACb,MAAM,CAAC,CAAC,MAAM,CAAC,EACf,CACH,CAAC,CACJ;IAAA,EAAE,KAAK,CAAC,CACT,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport { Stack } from '../../layout';\nimport { NavigationItem } from './NavigationItem';\nimport type { NavigationListProps } from './types';\n\nexport function NavigationList({\n items,\n orientation = 'vertical',\n compact = false,\n testID,\n interactionPolicy,\n}: NavigationListProps) {\n return (\n <Stack\n direction={orientation === 'horizontal' ? 'row' : 'column'}\n gap={compact ? 'xs' : 's'}\n testID={testID}\n >\n {items.map((item) => (\n <NavigationItem\n compact={compact}\n interactionPolicy={interactionPolicy}\n item={item}\n key={item.id}\n testID={testID}\n />\n ))}\n </Stack>\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TabBar.d.ts","sourceRoot":"","sources":["../../../src/components/navigation/TabBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,OAAe,EAAE,MAAM,EAAE,iBAAiB,EAAE,EAAE,WAAW,qBAuBxF"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Box } from '../../layout';
|
|
3
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
4
|
-
import { TabBarItem } from './TabBarItem';
|
|
5
|
-
export function TabBar({ items, compact = false, testID, interactionPolicy }) {
|
|
6
|
-
const { theme } = useTheme();
|
|
7
|
-
return (<Box style={{
|
|
8
|
-
flexDirection: 'row',
|
|
9
|
-
borderTopColor: theme.semantics.border.default,
|
|
10
|
-
borderTopWidth: 1,
|
|
11
|
-
}} testID={testID}>
|
|
12
|
-
{items.map((item) => (<TabBarItem compact={compact} interactionPolicy={interactionPolicy} item={item} key={item.id} testID={testID}/>))}
|
|
13
|
-
</Box>);
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=TabBar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TabBar.js","sourceRoot":"","sources":["../../../src/components/navigation/TabBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,MAAM,UAAU,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAe;IACvF,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAE7B,OAAO,CACL,CAAC,GAAG,CACF,KAAK,CAAC,CAAC;YACL,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO;YAC9C,cAAc,EAAE,CAAC;SAClB,CAAC,CACF,MAAM,CAAC,CAAC,MAAM,CAAC,CAEf;MAAA,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,CAAC,UAAU,CACT,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,IAAI,CAAC,CAAC,IAAI,CAAC,CACX,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CACb,MAAM,CAAC,CAAC,MAAM,CAAC,EACf,CACH,CAAC,CACJ;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport { Box } from '../../layout';\nimport { useTheme } from '../../theme/ThemeContext';\nimport { TabBarItem } from './TabBarItem';\nimport type { TabBarProps } from './types';\n\nexport function TabBar({ items, compact = false, testID, interactionPolicy }: TabBarProps) {\n const { theme } = useTheme();\n\n return (\n <Box\n style={{\n flexDirection: 'row',\n borderTopColor: theme.semantics.border.default,\n borderTopWidth: 1,\n }}\n testID={testID}\n >\n {items.map((item) => (\n <TabBarItem\n compact={compact}\n interactionPolicy={interactionPolicy}\n item={item}\n key={item.id}\n testID={testID}\n />\n ))}\n </Box>\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TabBarItem.d.ts","sourceRoot":"","sources":["../../../src/components/navigation/TabBarItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,OAAe,EAAE,MAAM,EAAE,iBAAiB,EAAE,EAAE,eAAe,qBAmE/F"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
import { Box } from '../../layout';
|
|
4
|
-
import { ButtonBase } from '../../primitives/button-base';
|
|
5
|
-
import { Icon } from '../../primitives/icon';
|
|
6
|
-
import { Text } from '../../primitives/text';
|
|
7
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
8
|
-
import { resolveNavigationAccessibilityState, resolveNavigationItemPresentation } from './helpers';
|
|
9
|
-
export function TabBarItem({ item, compact = false, testID, interactionPolicy }) {
|
|
10
|
-
const { theme } = useTheme();
|
|
11
|
-
const active = Boolean(item.active);
|
|
12
|
-
const disabled = Boolean(item.disabled);
|
|
13
|
-
const resolvedTestID = item.testID ?? (testID ? `${testID}-item-${item.id}` : undefined);
|
|
14
|
-
const resolvedAccessibilityState = resolveNavigationAccessibilityState(active, disabled, item.accessibilityState);
|
|
15
|
-
return (<ButtonBase accessibilityLabel={item.accessibilityLabel} accessibilityRole={item.accessibilityRole ?? 'tab'} accessibilityState={resolvedAccessibilityState} disabled={disabled} interactionPolicy={interactionPolicy} onPress={item.onPress} style={{ flex: 1 }} testID={resolvedTestID}>
|
|
16
|
-
{(state) => {
|
|
17
|
-
const presentation = resolveNavigationItemPresentation(theme, {
|
|
18
|
-
active,
|
|
19
|
-
disabled,
|
|
20
|
-
state,
|
|
21
|
-
});
|
|
22
|
-
const contentColor = disabled
|
|
23
|
-
? theme.semantics.content.muted
|
|
24
|
-
: active
|
|
25
|
-
? theme.semantics.action.primary.base
|
|
26
|
-
: theme.semantics.content.muted;
|
|
27
|
-
return (<Box px="m" py={compact ? 's' : 'm'} style={{
|
|
28
|
-
flex: 1,
|
|
29
|
-
alignItems: 'center',
|
|
30
|
-
justifyContent: 'center',
|
|
31
|
-
backgroundColor: presentation.backgroundColor,
|
|
32
|
-
opacity: presentation.opacity,
|
|
33
|
-
}}>
|
|
34
|
-
{item.icon ? (<View style={{ marginBottom: item.label ? theme.spacing.xs : 0 }}>
|
|
35
|
-
<Icon {...item.icon} color={contentColor} size={compact ? 's' : 'm'}/>
|
|
36
|
-
</View>) : null}
|
|
37
|
-
{item.label ? (<Text color={active && !disabled ? 'primary' : undefined} emphasis={active && !disabled ? 'default' : 'muted'} numberOfLines={1} variant={compact ? 'bodySmall' : 'label'} weight="medium">
|
|
38
|
-
{item.label}
|
|
39
|
-
</Text>) : null}
|
|
40
|
-
</Box>);
|
|
41
|
-
}}
|
|
42
|
-
</ButtonBase>);
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=TabBarItem.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TabBarItem.js","sourceRoot":"","sources":["../../../src/components/navigation/TabBarItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,mCAAmC,EAAE,iCAAiC,EAAE,M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AAC,CAAC,CAAC,CACjB,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CACzC,MAAM,CAAC,QAAQ,CAEf;gBAAA,CAAC,IAAI,CAAC,KAAK,CACb;cAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,IAAI,CACV;UAAA,EAAE,GAAG,CAAC,CACP,CAAC;QACJ,CAAC,CACH;IAAA,EAAE,UAAU,CAAC,CACd,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\n\nimport { Box } from '../../layout';\nimport { ButtonBase } from '../../primitives/button-base';\nimport { Icon } from '../../primitives/icon';\nimport { Text } from '../../primitives/text';\nimport { useTheme } from '../../theme/ThemeContext';\nimport { resolveNavigationAccessibilityState, resolveNavigationItemPresentation } from './helpers';\nimport type { TabBarItemProps } from './types';\n\nexport function TabBarItem({ item, compact = false, testID, interactionPolicy }: TabBarItemProps) {\n const { theme } = useTheme();\n const active = Boolean(item.active);\n const disabled = Boolean(item.disabled);\n const resolvedTestID = item.testID ?? (testID ? `${testID}-item-${item.id}` : undefined);\n const resolvedAccessibilityState = resolveNavigationAccessibilityState(\n active,\n disabled,\n item.accessibilityState,\n );\n\n return (\n <ButtonBase\n accessibilityLabel={item.accessibilityLabel}\n accessibilityRole={item.accessibilityRole ?? 'tab'}\n accessibilityState={resolvedAccessibilityState}\n disabled={disabled}\n interactionPolicy={interactionPolicy}\n onPress={item.onPress}\n style={{ flex: 1 }}\n testID={resolvedTestID}\n >\n {(state) => {\n const presentation = resolveNavigationItemPresentation(theme, {\n active,\n disabled,\n state,\n });\n const contentColor = disabled\n ? theme.semantics.content.muted\n : active\n ? theme.semantics.action.primary.base\n : theme.semantics.content.muted;\n\n return (\n <Box\n px=\"m\"\n py={compact ? 's' : 'm'}\n style={{\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: presentation.backgroundColor,\n opacity: presentation.opacity,\n }}\n >\n {item.icon ? (\n <View style={{ marginBottom: item.label ? theme.spacing.xs : 0 }}>\n <Icon {...item.icon} color={contentColor} size={compact ? 's' : 'm'} />\n </View>\n ) : null}\n {item.label ? (\n <Text\n color={active && !disabled ? 'primary' : undefined}\n emphasis={active && !disabled ? 'default' : 'muted'}\n numberOfLines={1}\n variant={compact ? 'bodySmall' : 'label'}\n weight=\"medium\"\n >\n {item.label}\n </Text>\n ) : null}\n </Box>\n );\n }}\n </ButtonBase>\n );\n}\n"]}
|