@ankhorage/surface 2.0.0 → 2.0.1
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 +6 -0
- package/dist/components/action-sheet/ActionSheet.d.ts +4 -0
- package/dist/components/action-sheet/ActionSheet.d.ts.map +1 -0
- package/dist/components/action-sheet/ActionSheet.js +71 -0
- package/dist/components/action-sheet/ActionSheet.js.map +1 -0
- package/dist/components/action-sheet/ActionSheetItem.d.ts +4 -0
- package/dist/components/action-sheet/ActionSheetItem.d.ts.map +1 -0
- package/dist/components/action-sheet/ActionSheetItem.js +27 -0
- package/dist/components/action-sheet/ActionSheetItem.js.map +1 -0
- package/dist/components/action-sheet/index.d.ts +4 -0
- package/dist/components/action-sheet/index.d.ts.map +1 -0
- package/dist/components/action-sheet/index.js +3 -0
- package/dist/components/action-sheet/index.js.map +1 -0
- package/dist/components/action-sheet/types.d.ts +24 -0
- package/dist/components/action-sheet/types.d.ts.map +1 -0
- package/dist/components/action-sheet/types.js +2 -0
- package/dist/components/action-sheet/types.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/action-sheet/ActionSheet.tsx +121 -0
- package/src/components/action-sheet/ActionSheetItem.tsx +57 -0
- package/src/components/action-sheet/index.ts +3 -0
- package/src/components/action-sheet/types.ts +26 -0
- package/src/index.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ActionSheetProps } from './types';
|
|
3
|
+
export declare function ActionSheet({ visible, onDismiss, title, description, children, cancelLabel, closeOnBackdrop, testID, }: ActionSheetProps): React.JSX.Element | null;
|
|
4
|
+
//# sourceMappingURL=ActionSheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionSheet.d.ts","sourceRoot":"","sources":["../../../src/components/action-sheet/ActionSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,SAAS,EACT,KAAK,EACL,WAAW,EACX,QAAQ,EACR,WAAsB,EACtB,eAAsB,EACtB,MAAM,GACP,EAAE,gBAAgB,4BAmGlB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
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 { resolveOverlayAnimation } from '../../internal/resolvers';
|
|
6
|
+
import { Box, Stack, Surface } from '../../layout';
|
|
7
|
+
import { Text } from '../../primitives/text';
|
|
8
|
+
import { useTheme } from '../../theme/ThemeContext';
|
|
9
|
+
import { ActionSheetItem } from './ActionSheetItem';
|
|
10
|
+
export function ActionSheet({ visible, onDismiss, title, description, children, cancelLabel = 'Cancel', closeOnBackdrop = true, testID, }) {
|
|
11
|
+
const { theme } = useTheme();
|
|
12
|
+
const animation = resolveOverlayAnimation('modal');
|
|
13
|
+
if (!visible) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
return (<Portal layer="modal" visible={visible}>
|
|
17
|
+
<View pointerEvents="box-none" style={{
|
|
18
|
+
bottom: 0,
|
|
19
|
+
left: 0,
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
right: 0,
|
|
22
|
+
top: 0,
|
|
23
|
+
}}>
|
|
24
|
+
<Pressable onPress={closeOnBackdrop ? onDismiss : undefined} style={{
|
|
25
|
+
backgroundColor: theme.semantics.neutral.text,
|
|
26
|
+
bottom: 0,
|
|
27
|
+
left: 0,
|
|
28
|
+
opacity: animation.backdropOpacity,
|
|
29
|
+
position: 'absolute',
|
|
30
|
+
right: 0,
|
|
31
|
+
top: 0,
|
|
32
|
+
}} testID={testID ? `${testID}-backdrop` : undefined}/>
|
|
33
|
+
<FocusScope active={visible} onEscape={onDismiss} testID={testID ? `${testID}-focus` : undefined}>
|
|
34
|
+
<Box pointerEvents="box-none" style={{
|
|
35
|
+
flex: 1,
|
|
36
|
+
justifyContent: 'flex-end',
|
|
37
|
+
}}>
|
|
38
|
+
<View accessible accessibilityViewIsModal style={{
|
|
39
|
+
alignSelf: 'center',
|
|
40
|
+
maxWidth: 560,
|
|
41
|
+
padding: 16,
|
|
42
|
+
width: '100%',
|
|
43
|
+
}}>
|
|
44
|
+
<Surface p="m" style={{
|
|
45
|
+
borderRadius: 24,
|
|
46
|
+
shadowOpacity: 0.16,
|
|
47
|
+
shadowRadius: 18,
|
|
48
|
+
shadowOffset: { width: 0, height: -8 },
|
|
49
|
+
}} testID={testID} variant="raised">
|
|
50
|
+
<Stack gap="s">
|
|
51
|
+
{title || description ? (<Box px="m" py="s">
|
|
52
|
+
<Stack gap="xxs">
|
|
53
|
+
{title ? (<Text align="center" variant="label" weight="semiBold">
|
|
54
|
+
{title}
|
|
55
|
+
</Text>) : null}
|
|
56
|
+
{description ? (<Text align="center" emphasis="muted" variant="bodySmall">
|
|
57
|
+
{description}
|
|
58
|
+
</Text>) : null}
|
|
59
|
+
</Stack>
|
|
60
|
+
</Box>) : null}
|
|
61
|
+
<Stack gap="xxs">{children}</Stack>
|
|
62
|
+
{onDismiss ? (<ActionSheetItem label={cancelLabel} onPress={onDismiss} testID={testID ? `${testID}-cancel` : undefined}/>) : null}
|
|
63
|
+
</Stack>
|
|
64
|
+
</Surface>
|
|
65
|
+
</View>
|
|
66
|
+
</Box>
|
|
67
|
+
</FocusScope>
|
|
68
|
+
</View>
|
|
69
|
+
</Portal>);
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=ActionSheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionSheet.js","sourceR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react';\nimport { Pressable, View } from 'react-native';\n\nimport { FocusScope } from '../../internal/focus/FocusScope';\nimport { Portal } from '../../internal/overlay/Portal';\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\nexport function ActionSheet({\n visible,\n onDismiss,\n title,\n description,\n children,\n cancelLabel = 'Cancel',\n closeOnBackdrop = true,\n testID,\n}: ActionSheetProps) {\n const { theme } = useTheme();\n const animation = resolveOverlayAnimation('modal');\n\n if (!visible) {\n return null;\n }\n\n return (\n <Portal layer=\"modal\" visible={visible}>\n <View\n pointerEvents=\"box-none\"\n style={{\n bottom: 0,\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n }}\n >\n <Pressable\n onPress={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={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 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"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ActionSheetItemProps } from './types';
|
|
3
|
+
export declare function ActionSheetItem({ label, description, leading, trailing, color, disabled, selected, onPress, testID, }: ActionSheetItemProps): React.JSX.Element;
|
|
4
|
+
//# sourceMappingURL=ActionSheetItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,OAAO,EACP,MAAM,GACP,EAAE,oBAAoB,qBAuCtB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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, onPress, testID, }) {
|
|
6
|
+
return (<ButtonBase accessibilityRole="button" accessibilityState={{ disabled, selected }} disabled={disabled} 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
|
|
@@ -0,0 +1 @@
|
|
|
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,EACR,KAAK,EACL,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,KAAK,EAChB,OAAO,EACP,MAAM,GACe;IACrB,OAAO,CACL,CAAC,UAAU,CACT,iBAAiB,CAAC,QAAQ,CAC1B,kBAAkB,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAC3C,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,OAAO,CAAC,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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 onPress,\n testID,\n}: ActionSheetItemProps) {\n return (\n <ButtonBase\n accessibilityRole=\"button\"\n accessibilityState={{ disabled, selected }}\n disabled={disabled}\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { SurfaceColor } from '../../surfaceColor';
|
|
3
|
+
export interface ActionSheetProps {
|
|
4
|
+
visible: boolean;
|
|
5
|
+
onDismiss?: (() => void) | undefined;
|
|
6
|
+
title?: React.ReactNode;
|
|
7
|
+
description?: React.ReactNode;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
cancelLabel?: React.ReactNode;
|
|
10
|
+
closeOnBackdrop?: boolean;
|
|
11
|
+
testID?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ActionSheetItemProps {
|
|
14
|
+
label: React.ReactNode;
|
|
15
|
+
description?: React.ReactNode;
|
|
16
|
+
leading?: React.ReactNode;
|
|
17
|
+
trailing?: React.ReactNode;
|
|
18
|
+
color?: SurfaceColor;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
selected?: boolean;
|
|
21
|
+
onPress?: (() => void) | undefined;
|
|
22
|
+
testID?: string;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,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,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,OAAO,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
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 { 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 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 onPress?: (() => void) | undefined;\n testID?: string;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export type { ActionSheetItemProps, ActionSheetProps } from './components/action-sheet';
|
|
2
|
+
export { ActionSheet, ActionSheetItem } from './components/action-sheet';
|
|
1
3
|
export type { BadgeProps } from './components/badge';
|
|
2
4
|
export { Badge } from './components/badge';
|
|
3
5
|
export type { ButtonIconSpec, ButtonProps } from './components/button';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,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AAM,mBAAmB,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEpE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAOzC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export type { BadgeProps } from './components/badge';\nexport { Badge } from './components/badge';\nexport type { ButtonIconSpec, ButtonProps } from './components/button';\nexport { Button } from './components/button';\nexport type { CardProps } from './components/card';\nexport { Card } from './components/card';\nexport type { CheckboxProps } from './components/checkbox';\nexport { Checkbox } from './components/checkbox';\nexport type { DrawerProps } from './components/drawer';\nexport { Drawer } from './components/drawer';\nexport type { FieldProps } from './components/field';\nexport { Field } from './components/field';\nexport type { HelperTextProps } from './components/helper-text';\nexport { HelperText } from './components/helper-text';\nexport type { IconButtonProps } from './components/icon-button';\nexport { IconButton } from './components/icon-button';\nexport type { LabelProps } from './components/label';\nexport { Label } from './components/label';\nexport type { ListItemProps } from './components/list-item';\nexport { ListItem } from './components/list-item';\nexport type { MenuItem, MenuProps } from './components/menu';\nexport { Menu } from './components/menu';\nexport type { ModalProps } from './components/modal';\nexport { Modal } from './components/modal';\nexport type {\n DrawerNavigationItemProps,\n DrawerNavigationProps,\n NavigationItemIcon,\n NavigationItemProps,\n NavigationItemSpec,\n NavigationListProps,\n TabBarItemProps,\n TabBarProps,\n} from './components/navigation';\nexport {\n DrawerNavigation,\n DrawerNavigationItem,\n NavigationItem,\n NavigationList,\n TabBar,\n TabBarItem,\n} from './components/navigation';\nexport type { RadioProps } from './components/radio';\nexport { Radio } from './components/radio';\nexport type { SwitchProps } from './components/switch';\nexport { Switch } from './components/switch';\nexport type { TabListProps, TabPanelProps, TabProps, TabsProps } from './components/tabs';\nexport { Tab, TabList, TabPanel, Tabs } from './components/tabs';\nexport type { TextInputProps } from './components/text-input';\nexport { TextInput } from './components/text-input';\nexport type { TextareaProps } from './components/textarea';\nexport { Textarea } from './components/textarea';\nexport type { ToastOptions, ToastProps, ToastStatus } from './components/toast';\nexport { Toast, ToastProvider, useToast } from './components/toast';\nexport type { TooltipProps } from './components/tooltip';\nexport { Tooltip } from './components/tooltip';\nexport type { FontRuntime } from './context/FontContext';\nexport { FontProvider, useFontContext } from './context/FontContext';\nexport type { I18nInstance, TranslationRuntime, Translator } from './context/TranslationContext';\nexport { TranslationProvider, useTranslationContext } from './context/TranslationContext';\nexport * from './core/responsive';\nexport * from './layout';\nexport type { ButtonBaseProps } from './primitives/button-base';\nexport { ButtonBase } from './primitives/button-base';\nexport type { HeadingLevel, HeadingProps } from './primitives/heading';\nexport { Heading } from './primitives/heading';\nexport type { IconProps, IconProvider } from './primitives/icon';\nexport { Icon } from './primitives/icon';\nexport type { ImageFit, ImageProps, SurfaceImageSource } from './primitives/image';\nexport { Image } from './primitives/image';\nexport type { TextProps } from './primitives/text';\nexport { Text } from './primitives/text';\nexport type {\n SurfaceColor,\n SurfaceEmphasis,\n SurfacePaletteColor,\n SurfaceStatusColor,\n} from './surfaceColor';\nexport {\n SURFACE_COLORS,\n SURFACE_EMPHASES,\n SURFACE_PALETTE_COLORS,\n SURFACE_STATUS_COLORS,\n} from './surfaceColor';\nexport * from './theme';\nexport { isDeepEqual } from './utils/deepEqual';\nexport { deepMerge } from './utils/deepMerge';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEzE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAW3C,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,MAAM,EACN,UAAU,GACX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEpE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAOzC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export type { ActionSheetItemProps, ActionSheetProps } from './components/action-sheet';\nexport { ActionSheet, ActionSheetItem } from './components/action-sheet';\nexport type { BadgeProps } from './components/badge';\nexport { Badge } from './components/badge';\nexport type { ButtonIconSpec, ButtonProps } from './components/button';\nexport { Button } from './components/button';\nexport type { CardProps } from './components/card';\nexport { Card } from './components/card';\nexport type { CheckboxProps } from './components/checkbox';\nexport { Checkbox } from './components/checkbox';\nexport type { DrawerProps } from './components/drawer';\nexport { Drawer } from './components/drawer';\nexport type { FieldProps } from './components/field';\nexport { Field } from './components/field';\nexport type { HelperTextProps } from './components/helper-text';\nexport { HelperText } from './components/helper-text';\nexport type { IconButtonProps } from './components/icon-button';\nexport { IconButton } from './components/icon-button';\nexport type { LabelProps } from './components/label';\nexport { Label } from './components/label';\nexport type { ListItemProps } from './components/list-item';\nexport { ListItem } from './components/list-item';\nexport type { MenuItem, MenuProps } from './components/menu';\nexport { Menu } from './components/menu';\nexport type { ModalProps } from './components/modal';\nexport { Modal } from './components/modal';\nexport type {\n DrawerNavigationItemProps,\n DrawerNavigationProps,\n NavigationItemIcon,\n NavigationItemProps,\n NavigationItemSpec,\n NavigationListProps,\n TabBarItemProps,\n TabBarProps,\n} from './components/navigation';\nexport {\n DrawerNavigation,\n DrawerNavigationItem,\n NavigationItem,\n NavigationList,\n TabBar,\n TabBarItem,\n} from './components/navigation';\nexport type { RadioProps } from './components/radio';\nexport { Radio } from './components/radio';\nexport type { SwitchProps } from './components/switch';\nexport { Switch } from './components/switch';\nexport type { TabListProps, TabPanelProps, TabProps, TabsProps } from './components/tabs';\nexport { Tab, TabList, TabPanel, Tabs } from './components/tabs';\nexport type { TextInputProps } from './components/text-input';\nexport { TextInput } from './components/text-input';\nexport type { TextareaProps } from './components/textarea';\nexport { Textarea } from './components/textarea';\nexport type { ToastOptions, ToastProps, ToastStatus } from './components/toast';\nexport { Toast, ToastProvider, useToast } from './components/toast';\nexport type { TooltipProps } from './components/tooltip';\nexport { Tooltip } from './components/tooltip';\nexport type { FontRuntime } from './context/FontContext';\nexport { FontProvider, useFontContext } from './context/FontContext';\nexport type { I18nInstance, TranslationRuntime, Translator } from './context/TranslationContext';\nexport { TranslationProvider, useTranslationContext } from './context/TranslationContext';\nexport * from './core/responsive';\nexport * from './layout';\nexport type { ButtonBaseProps } from './primitives/button-base';\nexport { ButtonBase } from './primitives/button-base';\nexport type { HeadingLevel, HeadingProps } from './primitives/heading';\nexport { Heading } from './primitives/heading';\nexport type { IconProps, IconProvider } from './primitives/icon';\nexport { Icon } from './primitives/icon';\nexport type { ImageFit, ImageProps, SurfaceImageSource } from './primitives/image';\nexport { Image } from './primitives/image';\nexport type { TextProps } from './primitives/text';\nexport { Text } from './primitives/text';\nexport type {\n SurfaceColor,\n SurfaceEmphasis,\n SurfacePaletteColor,\n SurfaceStatusColor,\n} from './surfaceColor';\nexport {\n SURFACE_COLORS,\n SURFACE_EMPHASES,\n SURFACE_PALETTE_COLORS,\n SURFACE_STATUS_COLORS,\n} from './surfaceColor';\nexport * from './theme';\nexport { isDeepEqual } from './utils/deepEqual';\nexport { deepMerge } from './utils/deepMerge';\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/surface",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.1",
|
|
5
5
|
"description": "Stable UI foundation for React Native and React Native Web.",
|
|
6
6
|
"homepage": "https://github.com/ankhorage/surface#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@ankhorage/color-theory": "^0.0.7",
|
|
46
|
-
"@ankhorage/contracts": "^1.
|
|
46
|
+
"@ankhorage/contracts": "^1.7.0"
|
|
47
47
|
},
|
|
48
48
|
"files": [
|
|
49
49
|
"dist",
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pressable, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { FocusScope } from '../../internal/focus/FocusScope';
|
|
5
|
+
import { Portal } from '../../internal/overlay/Portal';
|
|
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
|
+
import type { ActionSheetProps } from './types';
|
|
12
|
+
|
|
13
|
+
export function ActionSheet({
|
|
14
|
+
visible,
|
|
15
|
+
onDismiss,
|
|
16
|
+
title,
|
|
17
|
+
description,
|
|
18
|
+
children,
|
|
19
|
+
cancelLabel = 'Cancel',
|
|
20
|
+
closeOnBackdrop = true,
|
|
21
|
+
testID,
|
|
22
|
+
}: ActionSheetProps) {
|
|
23
|
+
const { theme } = useTheme();
|
|
24
|
+
const animation = resolveOverlayAnimation('modal');
|
|
25
|
+
|
|
26
|
+
if (!visible) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Portal layer="modal" visible={visible}>
|
|
32
|
+
<View
|
|
33
|
+
pointerEvents="box-none"
|
|
34
|
+
style={{
|
|
35
|
+
bottom: 0,
|
|
36
|
+
left: 0,
|
|
37
|
+
position: 'absolute',
|
|
38
|
+
right: 0,
|
|
39
|
+
top: 0,
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
<Pressable
|
|
43
|
+
onPress={closeOnBackdrop ? onDismiss : undefined}
|
|
44
|
+
style={{
|
|
45
|
+
backgroundColor: theme.semantics.neutral.text,
|
|
46
|
+
bottom: 0,
|
|
47
|
+
left: 0,
|
|
48
|
+
opacity: animation.backdropOpacity,
|
|
49
|
+
position: 'absolute',
|
|
50
|
+
right: 0,
|
|
51
|
+
top: 0,
|
|
52
|
+
}}
|
|
53
|
+
testID={testID ? `${testID}-backdrop` : undefined}
|
|
54
|
+
/>
|
|
55
|
+
<FocusScope
|
|
56
|
+
active={visible}
|
|
57
|
+
onEscape={onDismiss}
|
|
58
|
+
testID={testID ? `${testID}-focus` : undefined}
|
|
59
|
+
>
|
|
60
|
+
<Box
|
|
61
|
+
pointerEvents="box-none"
|
|
62
|
+
style={{
|
|
63
|
+
flex: 1,
|
|
64
|
+
justifyContent: 'flex-end',
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
<View
|
|
68
|
+
accessible
|
|
69
|
+
accessibilityViewIsModal
|
|
70
|
+
style={{
|
|
71
|
+
alignSelf: 'center',
|
|
72
|
+
maxWidth: 560,
|
|
73
|
+
padding: 16,
|
|
74
|
+
width: '100%',
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
<Surface
|
|
78
|
+
p="m"
|
|
79
|
+
style={{
|
|
80
|
+
borderRadius: 24,
|
|
81
|
+
shadowOpacity: 0.16,
|
|
82
|
+
shadowRadius: 18,
|
|
83
|
+
shadowOffset: { width: 0, height: -8 },
|
|
84
|
+
}}
|
|
85
|
+
testID={testID}
|
|
86
|
+
variant="raised"
|
|
87
|
+
>
|
|
88
|
+
<Stack gap="s">
|
|
89
|
+
{title || description ? (
|
|
90
|
+
<Box px="m" py="s">
|
|
91
|
+
<Stack gap="xxs">
|
|
92
|
+
{title ? (
|
|
93
|
+
<Text align="center" variant="label" weight="semiBold">
|
|
94
|
+
{title}
|
|
95
|
+
</Text>
|
|
96
|
+
) : null}
|
|
97
|
+
{description ? (
|
|
98
|
+
<Text align="center" emphasis="muted" variant="bodySmall">
|
|
99
|
+
{description}
|
|
100
|
+
</Text>
|
|
101
|
+
) : null}
|
|
102
|
+
</Stack>
|
|
103
|
+
</Box>
|
|
104
|
+
) : null}
|
|
105
|
+
<Stack gap="xxs">{children}</Stack>
|
|
106
|
+
{onDismiss ? (
|
|
107
|
+
<ActionSheetItem
|
|
108
|
+
label={cancelLabel}
|
|
109
|
+
onPress={onDismiss}
|
|
110
|
+
testID={testID ? `${testID}-cancel` : undefined}
|
|
111
|
+
/>
|
|
112
|
+
) : null}
|
|
113
|
+
</Stack>
|
|
114
|
+
</Surface>
|
|
115
|
+
</View>
|
|
116
|
+
</Box>
|
|
117
|
+
</FocusScope>
|
|
118
|
+
</View>
|
|
119
|
+
</Portal>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Box, Inline, Stack } from '../../layout';
|
|
4
|
+
import { ButtonBase } from '../../primitives/button-base';
|
|
5
|
+
import { Text } from '../../primitives/text';
|
|
6
|
+
import type { ActionSheetItemProps } from './types';
|
|
7
|
+
|
|
8
|
+
export function ActionSheetItem({
|
|
9
|
+
label,
|
|
10
|
+
description,
|
|
11
|
+
leading,
|
|
12
|
+
trailing,
|
|
13
|
+
color,
|
|
14
|
+
disabled = false,
|
|
15
|
+
selected = false,
|
|
16
|
+
onPress,
|
|
17
|
+
testID,
|
|
18
|
+
}: ActionSheetItemProps) {
|
|
19
|
+
return (
|
|
20
|
+
<ButtonBase
|
|
21
|
+
accessibilityRole="button"
|
|
22
|
+
accessibilityState={{ disabled, selected }}
|
|
23
|
+
disabled={disabled}
|
|
24
|
+
onPress={onPress}
|
|
25
|
+
radius="m"
|
|
26
|
+
testID={testID}
|
|
27
|
+
>
|
|
28
|
+
{(state) => (
|
|
29
|
+
<Box
|
|
30
|
+
px="m"
|
|
31
|
+
py="m"
|
|
32
|
+
radius="m"
|
|
33
|
+
style={{
|
|
34
|
+
opacity: state.disabled ? 0.56 : 1,
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
<Inline align="center" gap="m" justify="space-between" wrap="nowrap">
|
|
38
|
+
{leading ? <Box>{leading}</Box> : null}
|
|
39
|
+
<Box flex={1}>
|
|
40
|
+
<Stack gap="xxs">
|
|
41
|
+
<Text color={color} variant="body" weight={selected ? 'semiBold' : 'medium'}>
|
|
42
|
+
{label}
|
|
43
|
+
</Text>
|
|
44
|
+
{description ? (
|
|
45
|
+
<Text emphasis="muted" variant="bodySmall">
|
|
46
|
+
{description}
|
|
47
|
+
</Text>
|
|
48
|
+
) : null}
|
|
49
|
+
</Stack>
|
|
50
|
+
</Box>
|
|
51
|
+
{trailing ? <Box>{trailing}</Box> : null}
|
|
52
|
+
</Inline>
|
|
53
|
+
</Box>
|
|
54
|
+
)}
|
|
55
|
+
</ButtonBase>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
|
|
3
|
+
import type { SurfaceColor } from '../../surfaceColor';
|
|
4
|
+
|
|
5
|
+
export interface ActionSheetProps {
|
|
6
|
+
visible: boolean;
|
|
7
|
+
onDismiss?: (() => void) | undefined;
|
|
8
|
+
title?: React.ReactNode;
|
|
9
|
+
description?: React.ReactNode;
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
cancelLabel?: React.ReactNode;
|
|
12
|
+
closeOnBackdrop?: boolean;
|
|
13
|
+
testID?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ActionSheetItemProps {
|
|
17
|
+
label: React.ReactNode;
|
|
18
|
+
description?: React.ReactNode;
|
|
19
|
+
leading?: React.ReactNode;
|
|
20
|
+
trailing?: React.ReactNode;
|
|
21
|
+
color?: SurfaceColor;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
selected?: boolean;
|
|
24
|
+
onPress?: (() => void) | undefined;
|
|
25
|
+
testID?: string;
|
|
26
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export type { ActionSheetItemProps, ActionSheetProps } from './components/action-sheet';
|
|
2
|
+
export { ActionSheet, ActionSheetItem } from './components/action-sheet';
|
|
1
3
|
export type { BadgeProps } from './components/badge';
|
|
2
4
|
export { Badge } from './components/badge';
|
|
3
5
|
export type { ButtonIconSpec, ButtonProps } from './components/button';
|