@ankhorage/surface 4.4.0 → 5.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/dist/features/bottom-sheet/BottomSheetProvider.js +8 -6
- package/dist/features/bottom-sheet/BottomSheetProvider.js.map +1 -1
- package/dist/features/bottom-sheet/public.d.ts +2 -1
- package/dist/features/bottom-sheet/public.d.ts.map +1 -1
- package/dist/features/bottom-sheet/public.js +1 -0
- package/dist/features/bottom-sheet/public.js.map +1 -1
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.d.ts +5 -0
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.d.ts.map +1 -0
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.js +85 -0
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.js.map +1 -0
- package/dist/features/popover-menu/composition/usePopoverMenuController.d.ts +19 -0
- package/dist/features/popover-menu/composition/usePopoverMenuController.d.ts.map +1 -0
- package/dist/features/popover-menu/composition/usePopoverMenuController.js +35 -0
- package/dist/features/popover-menu/composition/usePopoverMenuController.js.map +1 -0
- package/dist/features/popover-menu/public.d.ts +3 -0
- package/dist/features/popover-menu/public.d.ts.map +1 -0
- package/dist/features/popover-menu/public.js +2 -0
- package/dist/features/popover-menu/public.js.map +1 -0
- package/dist/features/popover-menu/utils/resolveNextMenuIndex.d.ts +5 -0
- package/dist/features/popover-menu/utils/resolveNextMenuIndex.d.ts.map +1 -0
- package/dist/features/popover-menu/utils/resolveNextMenuIndex.js +18 -0
- package/dist/features/popover-menu/utils/resolveNextMenuIndex.js.map +1 -0
- package/dist/features/tooltip/adapters/inbound/Tooltip.d.ts +5 -0
- package/dist/features/tooltip/adapters/inbound/Tooltip.d.ts.map +1 -0
- package/dist/features/tooltip/adapters/inbound/Tooltip.js +25 -0
- package/dist/features/tooltip/adapters/inbound/Tooltip.js.map +1 -0
- package/dist/features/tooltip/composition/useTooltipVisibility.d.ts +9 -0
- package/dist/features/tooltip/composition/useTooltipVisibility.d.ts.map +1 -0
- package/dist/features/tooltip/composition/useTooltipVisibility.js +25 -0
- package/dist/features/tooltip/composition/useTooltipVisibility.js.map +1 -0
- package/dist/features/tooltip/public.d.ts +3 -0
- package/dist/features/tooltip/public.d.ts.map +1 -0
- package/dist/features/tooltip/public.js +2 -0
- package/dist/features/tooltip/public.js.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/types/bottomSheet.d.ts +3 -0
- package/dist/types/bottomSheet.d.ts.map +1 -1
- package/dist/types/bottomSheet.js.map +1 -1
- package/dist/types/popoverMenu.d.ts +24 -0
- package/dist/types/popoverMenu.d.ts.map +1 -0
- package/dist/types/popoverMenu.js +2 -0
- package/dist/types/popoverMenu.js.map +1 -0
- package/dist/{components/tooltip/types.d.ts → types/tooltip.d.ts} +2 -2
- package/dist/types/tooltip.d.ts.map +1 -0
- package/dist/types/tooltip.js +2 -0
- package/dist/types/tooltip.js.map +1 -0
- package/package.json +1 -1
- package/src/features/bottom-sheet/BottomSheetProvider.tsx +13 -8
- package/src/features/bottom-sheet/public.test.ts +23 -0
- package/src/features/bottom-sheet/public.ts +12 -1
- package/src/features/popover-menu/adapters/inbound/PopoverMenu.tsx +201 -0
- package/src/features/popover-menu/composition/usePopoverMenuController.ts +55 -0
- package/src/features/popover-menu/public.test.ts +13 -0
- package/src/features/popover-menu/public.ts +6 -0
- package/src/{components/menu/navigation.test.ts → features/popover-menu/utils/resolveNextMenuIndex.test.ts} +4 -4
- package/src/features/popover-menu/utils/resolveNextMenuIndex.ts +21 -0
- package/src/features/tooltip/adapters/inbound/Tooltip.tsx +56 -0
- package/src/features/tooltip/composition/useTooltipVisibility.ts +29 -0
- package/src/features/tooltip/public.test.ts +11 -0
- package/src/features/tooltip/public.ts +2 -0
- package/src/index.test.ts +8 -3
- package/src/index.ts +8 -4
- package/src/types/bottomSheet.ts +4 -0
- package/src/types/popoverMenu.ts +27 -0
- package/src/{components/tooltip/types.ts → types/tooltip.ts} +1 -1
- package/dist/components/menu/Menu.d.ts +0 -4
- package/dist/components/menu/Menu.d.ts.map +0 -1
- package/dist/components/menu/Menu.js +0 -152
- package/dist/components/menu/Menu.js.map +0 -1
- package/dist/components/menu/index.d.ts +0 -3
- package/dist/components/menu/index.d.ts.map +0 -1
- package/dist/components/menu/index.js +0 -2
- package/dist/components/menu/index.js.map +0 -1
- package/dist/components/menu/navigation.d.ts +0 -4
- package/dist/components/menu/navigation.d.ts.map +0 -1
- package/dist/components/menu/navigation.js +0 -25
- package/dist/components/menu/navigation.js.map +0 -1
- package/dist/components/menu/types.d.ts +0 -23
- package/dist/components/menu/types.d.ts.map +0 -1
- package/dist/components/menu/types.js +0 -2
- package/dist/components/menu/types.js.map +0 -1
- package/dist/components/tooltip/Tooltip.d.ts +0 -4
- package/dist/components/tooltip/Tooltip.d.ts.map +0 -1
- package/dist/components/tooltip/Tooltip.js +0 -75
- package/dist/components/tooltip/Tooltip.js.map +0 -1
- package/dist/components/tooltip/index.d.ts +0 -3
- package/dist/components/tooltip/index.d.ts.map +0 -1
- package/dist/components/tooltip/index.js +0 -2
- package/dist/components/tooltip/index.js.map +0 -1
- package/dist/components/tooltip/types.d.ts.map +0 -1
- package/dist/components/tooltip/types.js +0 -2
- package/dist/components/tooltip/types.js.map +0 -1
- package/dist/examples/DocsExamples.d.ts +0 -6
- package/dist/examples/DocsExamples.d.ts.map +0 -1
- package/dist/examples/DocsExamples.js +0 -97
- package/dist/examples/DocsExamples.js.map +0 -1
- package/src/components/menu/Menu.tsx +0 -228
- package/src/components/menu/index.ts +0 -2
- package/src/components/menu/navigation.ts +0 -34
- package/src/components/menu/types.ts +0 -26
- package/src/components/tooltip/Tooltip.tsx +0 -117
- package/src/components/tooltip/index.ts +0 -2
- package/src/examples/DocsExamples.tsx +0 -122
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Field } from '../components/field';
|
|
3
|
-
import { HelperText } from '../components/helper-text';
|
|
4
|
-
import { Menu } from '../components/menu';
|
|
5
|
-
import { Modal } from '../components/modal';
|
|
6
|
-
import { Tab, TabList, TabPanel, Tabs } from '../components/tabs';
|
|
7
|
-
import { Tooltip } from '../components/tooltip';
|
|
8
|
-
import { Button } from '../features/button/public';
|
|
9
|
-
import { Card } from '../features/card/public';
|
|
10
|
-
import { Checkbox } from '../features/form/checkbox/public';
|
|
11
|
-
import { TextInput } from '../features/form/text-input/public';
|
|
12
|
-
import { Box, Stack } from '../features/layout/public';
|
|
13
|
-
import { ToastProvider, useToast } from '../features/toast/public';
|
|
14
|
-
import { Text } from '../features/typography/public';
|
|
15
|
-
import { ThemeProvider } from '../theme';
|
|
16
|
-
const docsThemeConfig = {
|
|
17
|
-
id: 'docs',
|
|
18
|
-
name: 'Docs',
|
|
19
|
-
light: { primaryColor: '#2563EB', harmony: 'analogous' },
|
|
20
|
-
dark: { primaryColor: '#60A5FA', harmony: 'analogous' },
|
|
21
|
-
};
|
|
22
|
-
export function FormExample() {
|
|
23
|
-
return (<ThemeProvider initialConfig={docsThemeConfig}>
|
|
24
|
-
<Stack gap="m" p="l">
|
|
25
|
-
<Field helperText="Use your work email." label="Email" required>
|
|
26
|
-
<TextInput placeholder="you@example.com"/>
|
|
27
|
-
</Field>
|
|
28
|
-
<Checkbox checked>Accept terms</Checkbox>
|
|
29
|
-
<HelperText emphasis="muted">Looks good.</HelperText>
|
|
30
|
-
</Stack>
|
|
31
|
-
</ThemeProvider>);
|
|
32
|
-
}
|
|
33
|
-
function ToastButton() {
|
|
34
|
-
const { showToast } = useToast();
|
|
35
|
-
return (<Button onPress={() => showToast({ description: 'Your changes were saved.', status: 'success', title: 'Saved' })}>
|
|
36
|
-
Show toast
|
|
37
|
-
</Button>);
|
|
38
|
-
}
|
|
39
|
-
export function FeedbackExample() {
|
|
40
|
-
return (<ThemeProvider initialConfig={docsThemeConfig}>
|
|
41
|
-
<ToastProvider>
|
|
42
|
-
<Stack gap="m" p="l">
|
|
43
|
-
<Tooltip content="Helpful contextual information">
|
|
44
|
-
<Text>Hover for tooltip</Text>
|
|
45
|
-
</Tooltip>
|
|
46
|
-
<ToastButton />
|
|
47
|
-
</Stack>
|
|
48
|
-
</ToastProvider>
|
|
49
|
-
</ThemeProvider>);
|
|
50
|
-
}
|
|
51
|
-
export function OverlayExample() {
|
|
52
|
-
const [modalVisible, setModalVisible] = React.useState(false);
|
|
53
|
-
return (<ThemeProvider initialConfig={docsThemeConfig}>
|
|
54
|
-
<Stack gap="m" p="l">
|
|
55
|
-
<Button onPress={() => setModalVisible(true)}>Open modal</Button>
|
|
56
|
-
<Modal onDismiss={() => setModalVisible(false)} visible={modalVisible}>
|
|
57
|
-
<Card>
|
|
58
|
-
<Stack gap="s">
|
|
59
|
-
<Text variant="label" weight="semiBold">
|
|
60
|
-
Modal title
|
|
61
|
-
</Text>
|
|
62
|
-
<Text>Modal content</Text>
|
|
63
|
-
</Stack>
|
|
64
|
-
</Card>
|
|
65
|
-
</Modal>
|
|
66
|
-
</Stack>
|
|
67
|
-
</ThemeProvider>);
|
|
68
|
-
}
|
|
69
|
-
export function NavigationExample() {
|
|
70
|
-
return (<ThemeProvider initialConfig={docsThemeConfig}>
|
|
71
|
-
<Stack gap="m" p="l">
|
|
72
|
-
<Tabs defaultValue="account">
|
|
73
|
-
<TabList>
|
|
74
|
-
<Tab value="account">Account</Tab>
|
|
75
|
-
<Tab disabled value="security">
|
|
76
|
-
Security
|
|
77
|
-
</Tab>
|
|
78
|
-
<Tab value="billing">Billing</Tab>
|
|
79
|
-
</TabList>
|
|
80
|
-
<TabPanel value="account">
|
|
81
|
-
<Text>Account settings</Text>
|
|
82
|
-
</TabPanel>
|
|
83
|
-
<TabPanel value="billing">
|
|
84
|
-
<Text>Billing settings</Text>
|
|
85
|
-
</TabPanel>
|
|
86
|
-
</Tabs>
|
|
87
|
-
<Menu actions={[
|
|
88
|
-
{ id: 'edit', title: 'Edit' },
|
|
89
|
-
{ disabled: true, id: 'archive', title: 'Archive' },
|
|
90
|
-
]} trigger={<Text>Open menu</Text>}/>
|
|
91
|
-
<Box>
|
|
92
|
-
<Text color="success">Theme overrides can stay semantic.</Text>
|
|
93
|
-
</Box>
|
|
94
|
-
</Stack>
|
|
95
|
-
</ThemeProvider>);
|
|
96
|
-
}
|
|
97
|
-
//# sourceMappingURL=DocsExamples.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DocsExamples.js","sourceRoot":"","sources":["../../src/examples/DocsExamples.tsx"],"names":[],"mappings":"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","sourcesContent":["import React from 'react';\n\nimport { Field } from '../components/field';\nimport { HelperText } from '../components/helper-text';\nimport { Menu } from '../components/menu';\nimport { Modal } from '../components/modal';\nimport { Tab, TabList, TabPanel, Tabs } from '../components/tabs';\nimport { Tooltip } from '../components/tooltip';\nimport { Button } from '../features/button/public';\nimport { Card } from '../features/card/public';\nimport { Checkbox } from '../features/form/checkbox/public';\nimport { TextInput } from '../features/form/text-input/public';\nimport { Box, Stack } from '../features/layout/public';\nimport { ToastProvider, useToast } from '../features/toast/public';\nimport { Text } from '../features/typography/public';\nimport { ThemeProvider } from '../theme';\nimport type { ThemeConfig } from '../theme/types';\n\nconst docsThemeConfig: ThemeConfig = {\n id: 'docs',\n name: 'Docs',\n light: { primaryColor: '#2563EB', harmony: 'analogous' },\n dark: { primaryColor: '#60A5FA', harmony: 'analogous' },\n};\n\nexport function FormExample() {\n return (\n <ThemeProvider initialConfig={docsThemeConfig}>\n <Stack gap=\"m\" p=\"l\">\n <Field helperText=\"Use your work email.\" label=\"Email\" required>\n <TextInput placeholder=\"you@example.com\" />\n </Field>\n <Checkbox checked>Accept terms</Checkbox>\n <HelperText emphasis=\"muted\">Looks good.</HelperText>\n </Stack>\n </ThemeProvider>\n );\n}\n\nfunction ToastButton() {\n const { showToast } = useToast();\n return (\n <Button\n onPress={() =>\n showToast({ description: 'Your changes were saved.', status: 'success', title: 'Saved' })\n }\n >\n Show toast\n </Button>\n );\n}\n\nexport function FeedbackExample() {\n return (\n <ThemeProvider initialConfig={docsThemeConfig}>\n <ToastProvider>\n <Stack gap=\"m\" p=\"l\">\n <Tooltip content=\"Helpful contextual information\">\n <Text>Hover for tooltip</Text>\n </Tooltip>\n <ToastButton />\n </Stack>\n </ToastProvider>\n </ThemeProvider>\n );\n}\n\nexport function OverlayExample() {\n const [modalVisible, setModalVisible] = React.useState(false);\n\n return (\n <ThemeProvider initialConfig={docsThemeConfig}>\n <Stack gap=\"m\" p=\"l\">\n <Button onPress={() => setModalVisible(true)}>Open modal</Button>\n <Modal onDismiss={() => setModalVisible(false)} visible={modalVisible}>\n <Card>\n <Stack gap=\"s\">\n <Text variant=\"label\" weight=\"semiBold\">\n Modal title\n </Text>\n <Text>Modal content</Text>\n </Stack>\n </Card>\n </Modal>\n </Stack>\n </ThemeProvider>\n );\n}\n\nexport function NavigationExample() {\n return (\n <ThemeProvider initialConfig={docsThemeConfig}>\n <Stack gap=\"m\" p=\"l\">\n <Tabs defaultValue=\"account\">\n <TabList>\n <Tab value=\"account\">Account</Tab>\n <Tab disabled value=\"security\">\n Security\n </Tab>\n <Tab value=\"billing\">Billing</Tab>\n </TabList>\n <TabPanel value=\"account\">\n <Text>Account settings</Text>\n </TabPanel>\n <TabPanel value=\"billing\">\n <Text>Billing settings</Text>\n </TabPanel>\n </Tabs>\n <Menu\n actions={[\n { id: 'edit', title: 'Edit' },\n { disabled: true, id: 'archive', title: 'Archive' },\n ]}\n trigger={<Text>Open menu</Text>}\n />\n <Box>\n <Text color=\"success\">Theme overrides can stay semantic.</Text>\n </Box>\n </Stack>\n </ThemeProvider>\n );\n}\n"]}
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type LayoutRectangle, Pressable, View } from 'react-native';
|
|
3
|
-
|
|
4
|
-
import { Box, Stack } from '../../features/layout/public';
|
|
5
|
-
import { Surface } from '../../features/surface/public';
|
|
6
|
-
import { Text } from '../../features/typography/public';
|
|
7
|
-
import { FocusScope } from '../../internal/focus/FocusScope';
|
|
8
|
-
import { useFocusManager } from '../../internal/focus/useFocusManager';
|
|
9
|
-
import { Portal } from '../../internal/overlay/Portal';
|
|
10
|
-
import { resolvePointerEvents } from '../../internal/resolvePointerEvents';
|
|
11
|
-
import { resolveOverlayAnimation } from '../../internal/resolvers';
|
|
12
|
-
import { Inline } from '../../layout';
|
|
13
|
-
import { ButtonBase } from '../../primitives/button-base';
|
|
14
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
15
|
-
import { resolveNextMenuIndex } from './navigation';
|
|
16
|
-
import type { MenuAction, MenuProps } from './types';
|
|
17
|
-
|
|
18
|
-
const boxNonePointerEvents = resolvePointerEvents('box-none');
|
|
19
|
-
|
|
20
|
-
interface MeasurableNode {
|
|
21
|
-
measureInWindow?: (
|
|
22
|
-
callback: (x: number, y: number, width: number, height: number) => void,
|
|
23
|
-
) => void;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function measureNode(node: unknown, callback: (layout: LayoutRectangle) => void) {
|
|
27
|
-
const measurableNode = node as MeasurableNode | null;
|
|
28
|
-
measurableNode?.measureInWindow?.((x, y, width, height) => {
|
|
29
|
-
callback({ height, width, x, y });
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function renderActionContent(action: MenuAction, active: boolean) {
|
|
34
|
-
const titleColor =
|
|
35
|
-
action.intent === 'danger' ? 'danger' : active || action.selected ? 'neutral' : undefined;
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<Inline align="center" gap="s" justify="space-between" wrap="nowrap">
|
|
39
|
-
{action.leading ? <Box>{action.leading}</Box> : null}
|
|
40
|
-
<Box flex={1}>
|
|
41
|
-
<Stack gap="xxs">
|
|
42
|
-
<Text
|
|
43
|
-
color={titleColor}
|
|
44
|
-
variant="bodySmall"
|
|
45
|
-
weight={action.selected ? 'semiBold' : 'medium'}
|
|
46
|
-
>
|
|
47
|
-
{action.title}
|
|
48
|
-
</Text>
|
|
49
|
-
{action.description ? (
|
|
50
|
-
<Text emphasis="muted" variant="caption">
|
|
51
|
-
{action.description}
|
|
52
|
-
</Text>
|
|
53
|
-
) : null}
|
|
54
|
-
</Stack>
|
|
55
|
-
</Box>
|
|
56
|
-
{action.trailing ? <Box>{action.trailing}</Box> : null}
|
|
57
|
-
</Inline>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function Menu({
|
|
62
|
-
trigger,
|
|
63
|
-
actions,
|
|
64
|
-
dismiss,
|
|
65
|
-
closeOnSelect = true,
|
|
66
|
-
interactionPolicy = 'enabled',
|
|
67
|
-
testID,
|
|
68
|
-
}: MenuProps) {
|
|
69
|
-
const { theme } = useTheme();
|
|
70
|
-
const { bindKeydown } = useFocusManager();
|
|
71
|
-
const animation = resolveOverlayAnimation('menu');
|
|
72
|
-
const anchorRef = React.useRef<View | null>(null);
|
|
73
|
-
const [open, setOpen] = React.useState(false);
|
|
74
|
-
const [layout, setLayout] = React.useState<LayoutRectangle | null>(null);
|
|
75
|
-
const [activeIndex, setActiveIndex] = React.useState(0);
|
|
76
|
-
const passive = interactionPolicy === 'passive';
|
|
77
|
-
|
|
78
|
-
const closeMenu = React.useCallback(() => {
|
|
79
|
-
setOpen(false);
|
|
80
|
-
if (dismiss) {
|
|
81
|
-
dismiss();
|
|
82
|
-
}
|
|
83
|
-
}, [dismiss]);
|
|
84
|
-
|
|
85
|
-
const activateAction = React.useCallback(
|
|
86
|
-
(action: MenuAction) => {
|
|
87
|
-
if (action.disabled) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (action.activate) {
|
|
92
|
-
action.activate();
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (closeOnSelect) {
|
|
96
|
-
closeMenu();
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
[closeMenu, closeOnSelect],
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
const openMenu = React.useCallback(() => {
|
|
103
|
-
measureNode(anchorRef.current, setLayout);
|
|
104
|
-
const firstEnabledIndex = actions.findIndex((action) => !action.disabled);
|
|
105
|
-
setActiveIndex(firstEnabledIndex === -1 ? 0 : firstEnabledIndex);
|
|
106
|
-
setOpen(true);
|
|
107
|
-
}, [actions]);
|
|
108
|
-
|
|
109
|
-
React.useEffect(() => {
|
|
110
|
-
if (!open) {
|
|
111
|
-
return undefined;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return bindKeydown((event) => {
|
|
115
|
-
if (passive) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const { key } = event;
|
|
120
|
-
if (key === 'ArrowDown' || key === 'ArrowUp' || key === 'Home' || key === 'End') {
|
|
121
|
-
event.preventDefault();
|
|
122
|
-
setActiveIndex((current) => resolveNextMenuIndex(actions, current, key));
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (event.key === 'Enter') {
|
|
126
|
-
event.preventDefault();
|
|
127
|
-
const activeAction = actions[activeIndex];
|
|
128
|
-
if (activeAction) {
|
|
129
|
-
activateAction(activeAction);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (event.key === 'Escape') {
|
|
134
|
-
event.preventDefault();
|
|
135
|
-
closeMenu();
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
}, [activateAction, actions, activeIndex, bindKeydown, closeMenu, open, passive]);
|
|
139
|
-
|
|
140
|
-
return (
|
|
141
|
-
<View collapsable={false} ref={anchorRef}>
|
|
142
|
-
<ButtonBase
|
|
143
|
-
onPress={passive ? undefined : open ? closeMenu : openMenu}
|
|
144
|
-
testID={testID ? `${testID}-trigger` : undefined}
|
|
145
|
-
>
|
|
146
|
-
{trigger}
|
|
147
|
-
</ButtonBase>
|
|
148
|
-
<Portal layer="menu" visible={open && Boolean(layout)}>
|
|
149
|
-
<View
|
|
150
|
-
{...boxNonePointerEvents.props}
|
|
151
|
-
style={[
|
|
152
|
-
boxNonePointerEvents.style,
|
|
153
|
-
{
|
|
154
|
-
bottom: 0,
|
|
155
|
-
left: 0,
|
|
156
|
-
position: 'absolute',
|
|
157
|
-
right: 0,
|
|
158
|
-
top: 0,
|
|
159
|
-
},
|
|
160
|
-
]}
|
|
161
|
-
>
|
|
162
|
-
<Pressable
|
|
163
|
-
onPress={passive ? undefined : closeMenu}
|
|
164
|
-
style={{
|
|
165
|
-
bottom: 0,
|
|
166
|
-
left: 0,
|
|
167
|
-
position: 'absolute',
|
|
168
|
-
right: 0,
|
|
169
|
-
top: 0,
|
|
170
|
-
}}
|
|
171
|
-
/>
|
|
172
|
-
<FocusScope active={open} onEscape={passive ? undefined : closeMenu}>
|
|
173
|
-
<View
|
|
174
|
-
style={{
|
|
175
|
-
left: layout?.x ?? 0,
|
|
176
|
-
position: 'absolute',
|
|
177
|
-
top: (layout?.y ?? 0) + (layout?.height ?? 0) + animation.offset,
|
|
178
|
-
}}
|
|
179
|
-
>
|
|
180
|
-
<Surface
|
|
181
|
-
accessibilityRole="menu"
|
|
182
|
-
p="xs"
|
|
183
|
-
style={{
|
|
184
|
-
minWidth: Math.max(layout?.width ?? 0, 220),
|
|
185
|
-
shadowOpacity: 0.12,
|
|
186
|
-
shadowRadius: 12,
|
|
187
|
-
shadowOffset: { width: 0, height: 6 },
|
|
188
|
-
}}
|
|
189
|
-
testID={testID}
|
|
190
|
-
variant="raised"
|
|
191
|
-
>
|
|
192
|
-
{actions.map((action, index) => {
|
|
193
|
-
const active = index === activeIndex;
|
|
194
|
-
const selected = action.selected ?? active;
|
|
195
|
-
|
|
196
|
-
return (
|
|
197
|
-
<Pressable
|
|
198
|
-
accessibilityRole="menuitem"
|
|
199
|
-
accessibilityState={{ disabled: action.disabled, selected }}
|
|
200
|
-
disabled={action.disabled}
|
|
201
|
-
key={action.id}
|
|
202
|
-
onPress={passive ? undefined : () => activateAction(action)}
|
|
203
|
-
>
|
|
204
|
-
<Box
|
|
205
|
-
px="m"
|
|
206
|
-
py="s"
|
|
207
|
-
radius="s"
|
|
208
|
-
style={{
|
|
209
|
-
backgroundColor: selected
|
|
210
|
-
? theme.semantics.action.neutral.softBg
|
|
211
|
-
: 'transparent',
|
|
212
|
-
opacity: action.disabled ? 0.56 : 1,
|
|
213
|
-
}}
|
|
214
|
-
testID={testID ? `${testID}-item-${action.id}` : undefined}
|
|
215
|
-
>
|
|
216
|
-
{renderActionContent(action, active)}
|
|
217
|
-
</Box>
|
|
218
|
-
</Pressable>
|
|
219
|
-
);
|
|
220
|
-
})}
|
|
221
|
-
</Surface>
|
|
222
|
-
</View>
|
|
223
|
-
</FocusScope>
|
|
224
|
-
</View>
|
|
225
|
-
</Portal>
|
|
226
|
-
</View>
|
|
227
|
-
);
|
|
228
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export function resolveNextMenuIndex(
|
|
2
|
-
items: readonly { disabled?: boolean }[],
|
|
3
|
-
currentIndex: number,
|
|
4
|
-
key: 'ArrowDown' | 'ArrowUp' | 'Home' | 'End',
|
|
5
|
-
): number {
|
|
6
|
-
const enabledIndexes = items.reduce<number[]>((indexes, item, index) => {
|
|
7
|
-
if (!item.disabled) {
|
|
8
|
-
indexes.push(index);
|
|
9
|
-
}
|
|
10
|
-
return indexes;
|
|
11
|
-
}, []);
|
|
12
|
-
|
|
13
|
-
if (enabledIndexes.length === 0) {
|
|
14
|
-
return -1;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (key === 'Home') {
|
|
18
|
-
return enabledIndexes[0] ?? -1;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (key === 'End') {
|
|
22
|
-
return enabledIndexes[enabledIndexes.length - 1] ?? -1;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const activeEnabledIndex = enabledIndexes.indexOf(currentIndex);
|
|
26
|
-
const nextEnabledIndex =
|
|
27
|
-
activeEnabledIndex === -1
|
|
28
|
-
? 0
|
|
29
|
-
: key === 'ArrowUp'
|
|
30
|
-
? (activeEnabledIndex - 1 + enabledIndexes.length) % enabledIndexes.length
|
|
31
|
-
: (activeEnabledIndex + 1) % enabledIndexes.length;
|
|
32
|
-
|
|
33
|
-
return enabledIndexes[nextEnabledIndex] ?? -1;
|
|
34
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
|
|
3
|
-
import type { InteractionPolicy } from '../../interactionPolicy';
|
|
4
|
-
|
|
5
|
-
export type MenuActionIntent = 'default' | 'danger';
|
|
6
|
-
|
|
7
|
-
export interface MenuAction {
|
|
8
|
-
id: string;
|
|
9
|
-
title: React.ReactNode;
|
|
10
|
-
description?: React.ReactNode;
|
|
11
|
-
leading?: React.ReactNode;
|
|
12
|
-
trailing?: React.ReactNode;
|
|
13
|
-
intent?: MenuActionIntent;
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
selected?: boolean;
|
|
16
|
-
activate?: () => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface MenuProps {
|
|
20
|
-
trigger?: React.ReactNode;
|
|
21
|
-
actions: readonly MenuAction[];
|
|
22
|
-
dismiss?: () => void;
|
|
23
|
-
closeOnSelect?: boolean;
|
|
24
|
-
interactionPolicy?: InteractionPolicy;
|
|
25
|
-
testID?: string;
|
|
26
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type LayoutRectangle, Platform, Pressable, View } from 'react-native';
|
|
3
|
-
|
|
4
|
-
import { Surface } from '../../features/surface/public';
|
|
5
|
-
import { Text } from '../../features/typography/public';
|
|
6
|
-
import { Portal } from '../../internal/overlay/Portal';
|
|
7
|
-
import { resolvePointerEvents } from '../../internal/resolvePointerEvents';
|
|
8
|
-
import { resolveOverlayAnimation } from '../../internal/resolvers';
|
|
9
|
-
import { useTheme } from '../../theme/ThemeContext';
|
|
10
|
-
import type { TooltipProps } from './types';
|
|
11
|
-
|
|
12
|
-
const noPointerEvents = resolvePointerEvents('none');
|
|
13
|
-
|
|
14
|
-
interface MeasurableNode {
|
|
15
|
-
measureInWindow?: (
|
|
16
|
-
callback: (x: number, y: number, width: number, height: number) => void,
|
|
17
|
-
) => void;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function measureNode(node: unknown, callback: (layout: LayoutRectangle) => void) {
|
|
21
|
-
const measurableNode = node as MeasurableNode | null;
|
|
22
|
-
measurableNode?.measureInWindow?.((x, y, width, height) => {
|
|
23
|
-
callback({ height, width, x, y });
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function Tooltip({
|
|
28
|
-
children,
|
|
29
|
-
content,
|
|
30
|
-
delay = 150,
|
|
31
|
-
interactionPolicy = 'enabled',
|
|
32
|
-
placement = 'top',
|
|
33
|
-
testID,
|
|
34
|
-
}: TooltipProps) {
|
|
35
|
-
const { theme } = useTheme();
|
|
36
|
-
const animation = resolveOverlayAnimation('tooltip');
|
|
37
|
-
const anchorRef = React.useRef<View | null>(null);
|
|
38
|
-
const timeoutRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
39
|
-
const [visible, setVisible] = React.useState(false);
|
|
40
|
-
const [layout, setLayout] = React.useState<LayoutRectangle | null>(null);
|
|
41
|
-
const passive = interactionPolicy === 'passive';
|
|
42
|
-
|
|
43
|
-
const show = React.useCallback(() => {
|
|
44
|
-
if (timeoutRef.current) {
|
|
45
|
-
clearTimeout(timeoutRef.current);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
timeoutRef.current = setTimeout(() => {
|
|
49
|
-
measureNode(anchorRef.current, setLayout);
|
|
50
|
-
setVisible(true);
|
|
51
|
-
}, delay);
|
|
52
|
-
}, [delay]);
|
|
53
|
-
|
|
54
|
-
const hide = React.useCallback(() => {
|
|
55
|
-
if (timeoutRef.current) {
|
|
56
|
-
clearTimeout(timeoutRef.current);
|
|
57
|
-
timeoutRef.current = null;
|
|
58
|
-
}
|
|
59
|
-
setVisible(false);
|
|
60
|
-
}, []);
|
|
61
|
-
|
|
62
|
-
React.useEffect(
|
|
63
|
-
() => () => {
|
|
64
|
-
if (timeoutRef.current) {
|
|
65
|
-
clearTimeout(timeoutRef.current);
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
[],
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
const tooltipLeft = layout ? layout.x : 0;
|
|
72
|
-
const tooltipTop =
|
|
73
|
-
layout && placement === 'top'
|
|
74
|
-
? layout.y - animation.offset
|
|
75
|
-
: layout
|
|
76
|
-
? layout.y + layout.height + animation.offset
|
|
77
|
-
: 0;
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<View collapsable={false} ref={anchorRef} testID={testID ? `${testID}-anchor` : undefined}>
|
|
81
|
-
<Pressable
|
|
82
|
-
onBlur={passive ? undefined : hide}
|
|
83
|
-
onFocus={passive ? undefined : show}
|
|
84
|
-
onHoverIn={Platform.OS === 'web' && !passive ? show : undefined}
|
|
85
|
-
onHoverOut={Platform.OS === 'web' && !passive ? hide : undefined}
|
|
86
|
-
>
|
|
87
|
-
{children}
|
|
88
|
-
</Pressable>
|
|
89
|
-
<Portal layer="tooltip" visible={visible && Boolean(layout)}>
|
|
90
|
-
<View
|
|
91
|
-
{...noPointerEvents.props}
|
|
92
|
-
style={[
|
|
93
|
-
noPointerEvents.style,
|
|
94
|
-
{
|
|
95
|
-
left: tooltipLeft,
|
|
96
|
-
position: 'absolute',
|
|
97
|
-
top: tooltipTop,
|
|
98
|
-
},
|
|
99
|
-
]}
|
|
100
|
-
>
|
|
101
|
-
<Surface
|
|
102
|
-
p="s"
|
|
103
|
-
style={{
|
|
104
|
-
backgroundColor: theme.semantics.surface.inverse,
|
|
105
|
-
}}
|
|
106
|
-
testID={testID}
|
|
107
|
-
variant="raised"
|
|
108
|
-
>
|
|
109
|
-
<Text emphasis="inverse" variant="caption">
|
|
110
|
-
{content}
|
|
111
|
-
</Text>
|
|
112
|
-
</Surface>
|
|
113
|
-
</View>
|
|
114
|
-
</Portal>
|
|
115
|
-
</View>
|
|
116
|
-
);
|
|
117
|
-
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { Field } from '../components/field';
|
|
4
|
-
import { HelperText } from '../components/helper-text';
|
|
5
|
-
import { Menu } from '../components/menu';
|
|
6
|
-
import { Modal } from '../components/modal';
|
|
7
|
-
import { Tab, TabList, TabPanel, Tabs } from '../components/tabs';
|
|
8
|
-
import { Tooltip } from '../components/tooltip';
|
|
9
|
-
import { Button } from '../features/button/public';
|
|
10
|
-
import { Card } from '../features/card/public';
|
|
11
|
-
import { Checkbox } from '../features/form/checkbox/public';
|
|
12
|
-
import { TextInput } from '../features/form/text-input/public';
|
|
13
|
-
import { Box, Stack } from '../features/layout/public';
|
|
14
|
-
import { ToastProvider, useToast } from '../features/toast/public';
|
|
15
|
-
import { Text } from '../features/typography/public';
|
|
16
|
-
import { ThemeProvider } from '../theme';
|
|
17
|
-
import type { ThemeConfig } from '../theme/types';
|
|
18
|
-
|
|
19
|
-
const docsThemeConfig: ThemeConfig = {
|
|
20
|
-
id: 'docs',
|
|
21
|
-
name: 'Docs',
|
|
22
|
-
light: { primaryColor: '#2563EB', harmony: 'analogous' },
|
|
23
|
-
dark: { primaryColor: '#60A5FA', harmony: 'analogous' },
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export function FormExample() {
|
|
27
|
-
return (
|
|
28
|
-
<ThemeProvider initialConfig={docsThemeConfig}>
|
|
29
|
-
<Stack gap="m" p="l">
|
|
30
|
-
<Field helperText="Use your work email." label="Email" required>
|
|
31
|
-
<TextInput placeholder="you@example.com" />
|
|
32
|
-
</Field>
|
|
33
|
-
<Checkbox checked>Accept terms</Checkbox>
|
|
34
|
-
<HelperText emphasis="muted">Looks good.</HelperText>
|
|
35
|
-
</Stack>
|
|
36
|
-
</ThemeProvider>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function ToastButton() {
|
|
41
|
-
const { showToast } = useToast();
|
|
42
|
-
return (
|
|
43
|
-
<Button
|
|
44
|
-
onPress={() =>
|
|
45
|
-
showToast({ description: 'Your changes were saved.', status: 'success', title: 'Saved' })
|
|
46
|
-
}
|
|
47
|
-
>
|
|
48
|
-
Show toast
|
|
49
|
-
</Button>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function FeedbackExample() {
|
|
54
|
-
return (
|
|
55
|
-
<ThemeProvider initialConfig={docsThemeConfig}>
|
|
56
|
-
<ToastProvider>
|
|
57
|
-
<Stack gap="m" p="l">
|
|
58
|
-
<Tooltip content="Helpful contextual information">
|
|
59
|
-
<Text>Hover for tooltip</Text>
|
|
60
|
-
</Tooltip>
|
|
61
|
-
<ToastButton />
|
|
62
|
-
</Stack>
|
|
63
|
-
</ToastProvider>
|
|
64
|
-
</ThemeProvider>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export function OverlayExample() {
|
|
69
|
-
const [modalVisible, setModalVisible] = React.useState(false);
|
|
70
|
-
|
|
71
|
-
return (
|
|
72
|
-
<ThemeProvider initialConfig={docsThemeConfig}>
|
|
73
|
-
<Stack gap="m" p="l">
|
|
74
|
-
<Button onPress={() => setModalVisible(true)}>Open modal</Button>
|
|
75
|
-
<Modal onDismiss={() => setModalVisible(false)} visible={modalVisible}>
|
|
76
|
-
<Card>
|
|
77
|
-
<Stack gap="s">
|
|
78
|
-
<Text variant="label" weight="semiBold">
|
|
79
|
-
Modal title
|
|
80
|
-
</Text>
|
|
81
|
-
<Text>Modal content</Text>
|
|
82
|
-
</Stack>
|
|
83
|
-
</Card>
|
|
84
|
-
</Modal>
|
|
85
|
-
</Stack>
|
|
86
|
-
</ThemeProvider>
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export function NavigationExample() {
|
|
91
|
-
return (
|
|
92
|
-
<ThemeProvider initialConfig={docsThemeConfig}>
|
|
93
|
-
<Stack gap="m" p="l">
|
|
94
|
-
<Tabs defaultValue="account">
|
|
95
|
-
<TabList>
|
|
96
|
-
<Tab value="account">Account</Tab>
|
|
97
|
-
<Tab disabled value="security">
|
|
98
|
-
Security
|
|
99
|
-
</Tab>
|
|
100
|
-
<Tab value="billing">Billing</Tab>
|
|
101
|
-
</TabList>
|
|
102
|
-
<TabPanel value="account">
|
|
103
|
-
<Text>Account settings</Text>
|
|
104
|
-
</TabPanel>
|
|
105
|
-
<TabPanel value="billing">
|
|
106
|
-
<Text>Billing settings</Text>
|
|
107
|
-
</TabPanel>
|
|
108
|
-
</Tabs>
|
|
109
|
-
<Menu
|
|
110
|
-
actions={[
|
|
111
|
-
{ id: 'edit', title: 'Edit' },
|
|
112
|
-
{ disabled: true, id: 'archive', title: 'Archive' },
|
|
113
|
-
]}
|
|
114
|
-
trigger={<Text>Open menu</Text>}
|
|
115
|
-
/>
|
|
116
|
-
<Box>
|
|
117
|
-
<Text color="success">Theme overrides can stay semantic.</Text>
|
|
118
|
-
</Box>
|
|
119
|
-
</Stack>
|
|
120
|
-
</ThemeProvider>
|
|
121
|
-
);
|
|
122
|
-
}
|