@ankhorage/surface 2.0.1 → 2.0.3
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 +692 -47
- package/dist/components/menu/Menu.d.ts +1 -1
- package/dist/components/menu/Menu.d.ts.map +1 -1
- package/dist/components/menu/Menu.js +50 -32
- package/dist/components/menu/Menu.js.map +1 -1
- package/dist/components/menu/index.d.ts +1 -1
- package/dist/components/menu/index.d.ts.map +1 -1
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/menu/navigation.d.ts +1 -1
- package/dist/components/menu/navigation.d.ts.map +1 -1
- package/dist/components/menu/navigation.js.map +1 -1
- package/dist/components/menu/types.d.ts +11 -5
- package/dist/components/menu/types.d.ts.map +1 -1
- package/dist/components/menu/types.js.map +1 -1
- package/dist/components/tooltip/Tooltip.js +1 -1
- package/dist/components/tooltip/Tooltip.js.map +1 -1
- package/dist/examples/DocsExamples.d.ts +3 -2
- package/dist/examples/DocsExamples.d.ts.map +1 -1
- package/dist/examples/DocsExamples.js +61 -37
- package/dist/examples/DocsExamples.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/theme/colorEngine.d.ts.map +1 -1
- package/dist/theme/colorEngine.js +4 -1
- package/dist/theme/colorEngine.js.map +1 -1
- package/dist/theme/types.d.ts +1 -0
- package/dist/theme/types.d.ts.map +1 -1
- package/dist/theme/types.js.map +1 -1
- package/package.json +5 -2
- package/src/components/menu/Menu.tsx +71 -36
- package/src/components/menu/index.ts +1 -1
- package/src/components/menu/navigation.ts +1 -1
- package/src/components/menu/types.ts +12 -5
- package/src/components/tooltip/Tooltip.tsx +1 -1
- package/src/examples/DocsExamples.tsx +74 -60
- package/src/index.ts +1 -1
- package/src/theme/colorEngine.test.ts +3 -2
- package/src/theme/colorEngine.ts +4 -2
- package/src/theme/inverseSemantics.test.ts +48 -0
- package/src/theme/types.ts +1 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { MenuProps } from './types';
|
|
3
|
-
export declare function Menu({ trigger,
|
|
3
|
+
export declare function Menu({ trigger, actions, dismiss, closeOnSelect, testID }: MenuProps): React.JSX.Element;
|
|
4
4
|
//# sourceMappingURL=Menu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../src/components/menu/Menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../src/components/menu/Menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,SAAS,CAAC;AA2CrD,wBAAgB,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,aAAoB,EAAE,MAAM,EAAE,EAAE,SAAS,qBAwJ1F"}
|
|
@@ -4,7 +4,7 @@ import { FocusScope } from '../../internal/focus/FocusScope';
|
|
|
4
4
|
import { useFocusManager } from '../../internal/focus/useFocusManager';
|
|
5
5
|
import { Portal } from '../../internal/overlay/Portal';
|
|
6
6
|
import { resolveOverlayAnimation } from '../../internal/resolvers';
|
|
7
|
-
import { Box, Surface } from '../../layout';
|
|
7
|
+
import { Box, Inline, Stack, Surface } from '../../layout';
|
|
8
8
|
import { ButtonBase } from '../../primitives/button-base';
|
|
9
9
|
import { Text } from '../../primitives/text';
|
|
10
10
|
import { useTheme } from '../../theme/ThemeContext';
|
|
@@ -15,7 +15,24 @@ function measureNode(node, callback) {
|
|
|
15
15
|
callback({ height, width, x, y });
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
function renderActionContent(action, active) {
|
|
19
|
+
const titleColor = action.intent === 'danger' ? 'danger' : active || action.selected ? 'neutral' : undefined;
|
|
20
|
+
return (<Inline align="center" gap="s" justify="space-between" wrap="nowrap">
|
|
21
|
+
{action.leading ? <Box>{action.leading}</Box> : null}
|
|
22
|
+
<Box flex={1}>
|
|
23
|
+
<Stack gap="xxs">
|
|
24
|
+
<Text color={titleColor} variant="bodySmall" weight={action.selected ? 'semiBold' : 'medium'}>
|
|
25
|
+
{action.title}
|
|
26
|
+
</Text>
|
|
27
|
+
{action.description ? (<Text emphasis="muted" variant="caption">
|
|
28
|
+
{action.description}
|
|
29
|
+
</Text>) : null}
|
|
30
|
+
</Stack>
|
|
31
|
+
</Box>
|
|
32
|
+
{action.trailing ? <Box>{action.trailing}</Box> : null}
|
|
33
|
+
</Inline>);
|
|
34
|
+
}
|
|
35
|
+
export function Menu({ trigger, actions, dismiss, closeOnSelect = true, testID }) {
|
|
19
36
|
const { theme } = useTheme();
|
|
20
37
|
const { bindKeydown } = useFocusManager();
|
|
21
38
|
const animation = resolveOverlayAnimation('menu');
|
|
@@ -25,14 +42,27 @@ export function Menu({ trigger, items, onDismiss, closeOnSelect = true, testID }
|
|
|
25
42
|
const [activeIndex, setActiveIndex] = React.useState(0);
|
|
26
43
|
const closeMenu = React.useCallback(() => {
|
|
27
44
|
setOpen(false);
|
|
28
|
-
|
|
29
|
-
|
|
45
|
+
if (dismiss) {
|
|
46
|
+
dismiss();
|
|
47
|
+
}
|
|
48
|
+
}, [dismiss]);
|
|
49
|
+
const activateAction = React.useCallback((action) => {
|
|
50
|
+
if (action.disabled) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (action.activate) {
|
|
54
|
+
action.activate();
|
|
55
|
+
}
|
|
56
|
+
if (closeOnSelect) {
|
|
57
|
+
closeMenu();
|
|
58
|
+
}
|
|
59
|
+
}, [closeMenu, closeOnSelect]);
|
|
30
60
|
const openMenu = React.useCallback(() => {
|
|
31
61
|
measureNode(anchorRef.current, setLayout);
|
|
32
|
-
const firstEnabledIndex =
|
|
62
|
+
const firstEnabledIndex = actions.findIndex((action) => !action.disabled);
|
|
33
63
|
setActiveIndex(firstEnabledIndex === -1 ? 0 : firstEnabledIndex);
|
|
34
64
|
setOpen(true);
|
|
35
|
-
}, [
|
|
65
|
+
}, [actions]);
|
|
36
66
|
React.useEffect(() => {
|
|
37
67
|
if (!open) {
|
|
38
68
|
return undefined;
|
|
@@ -41,16 +71,13 @@ export function Menu({ trigger, items, onDismiss, closeOnSelect = true, testID }
|
|
|
41
71
|
const { key } = event;
|
|
42
72
|
if (key === 'ArrowDown' || key === 'ArrowUp' || key === 'Home' || key === 'End') {
|
|
43
73
|
event.preventDefault();
|
|
44
|
-
setActiveIndex((current) => resolveNextMenuIndex(
|
|
74
|
+
setActiveIndex((current) => resolveNextMenuIndex(actions, current, key));
|
|
45
75
|
}
|
|
46
76
|
if (event.key === 'Enter') {
|
|
47
77
|
event.preventDefault();
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
-
if (closeOnSelect) {
|
|
52
|
-
closeMenu();
|
|
53
|
-
}
|
|
78
|
+
const activeAction = actions[activeIndex];
|
|
79
|
+
if (activeAction) {
|
|
80
|
+
activateAction(activeAction);
|
|
54
81
|
}
|
|
55
82
|
}
|
|
56
83
|
if (event.key === 'Escape') {
|
|
@@ -58,7 +85,7 @@ export function Menu({ trigger, items, onDismiss, closeOnSelect = true, testID }
|
|
|
58
85
|
closeMenu();
|
|
59
86
|
}
|
|
60
87
|
});
|
|
61
|
-
}, [
|
|
88
|
+
}, [activateAction, actions, activeIndex, bindKeydown, closeMenu, open]);
|
|
62
89
|
return (<View collapsable={false} ref={anchorRef}>
|
|
63
90
|
<ButtonBase onPress={open ? closeMenu : openMenu} testID={testID ? `${testID}-trigger` : undefined}>
|
|
64
91
|
{trigger}
|
|
@@ -85,31 +112,22 @@ export function Menu({ trigger, items, onDismiss, closeOnSelect = true, testID }
|
|
|
85
112
|
top: (layout?.y ?? 0) + (layout?.height ?? 0) + animation.offset,
|
|
86
113
|
}}>
|
|
87
114
|
<Surface accessibilityRole="menu" p="xs" style={{
|
|
88
|
-
minWidth: Math.max(layout?.width ?? 0,
|
|
115
|
+
minWidth: Math.max(layout?.width ?? 0, 220),
|
|
89
116
|
shadowOpacity: 0.12,
|
|
90
117
|
shadowRadius: 12,
|
|
91
118
|
shadowOffset: { width: 0, height: 6 },
|
|
92
119
|
}} testID={testID} variant="raised">
|
|
93
|
-
{
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
item.onPress?.();
|
|
100
|
-
if (closeOnSelect) {
|
|
101
|
-
closeMenu();
|
|
102
|
-
}
|
|
103
|
-
}}>
|
|
104
|
-
<Box px="m" py="s" style={{
|
|
120
|
+
{actions.map((action, index) => {
|
|
121
|
+
const active = index === activeIndex;
|
|
122
|
+
const selected = action.selected ?? active;
|
|
123
|
+
return (<Pressable accessibilityRole="menuitem" accessibilityState={{ disabled: action.disabled, selected }} disabled={action.disabled} key={action.id} onPress={() => activateAction(action)}>
|
|
124
|
+
<Box px="m" py="s" radius="s" style={{
|
|
105
125
|
backgroundColor: selected
|
|
106
126
|
? theme.semantics.action.neutral.softBg
|
|
107
127
|
: 'transparent',
|
|
108
|
-
opacity:
|
|
109
|
-
}} testID={testID ? `${testID}-item-${
|
|
110
|
-
|
|
111
|
-
{item.label}
|
|
112
|
-
</Text>
|
|
128
|
+
opacity: action.disabled ? 0.56 : 1,
|
|
129
|
+
}} testID={testID ? `${testID}-item-${action.id}` : undefined}>
|
|
130
|
+
{renderActionContent(action, active)}
|
|
113
131
|
</Box>
|
|
114
132
|
</Pressable>);
|
|
115
133
|
})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../../src/components/menu/Menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAwB,SAAS,EAAE,IAAI,EAAE,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MAAM,CACV;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { type LayoutRectangle, Pressable, View } from 'react-native';\n\nimport { FocusScope } from '../../internal/focus/FocusScope';\nimport { useFocusManager } from '../../internal/focus/useFocusManager';\nimport { Portal } from '../../internal/overlay/Portal';\nimport { resolveOverlayAnimation } from '../../internal/resolvers';\nimport { Box, Surface } from '../../layout';\nimport { ButtonBase } from '../../primitives/button-base';\nimport { Text } from '../../primitives/text';\nimport { useTheme } from '../../theme/ThemeContext';\nimport { resolveNextMenuIndex } from './navigation';\nimport type { MenuProps } from './types';\n\ninterface MeasurableNode {\n measureInWindow?: (\n callback: (x: number, y: number, width: number, height: number) => void,\n ) => void;\n}\n\nfunction measureNode(node: unknown, callback: (layout: LayoutRectangle) => void) {\n const measurableNode = node as MeasurableNode | null;\n measurableNode?.measureInWindow?.((x, y, width, height) => {\n callback({ height, width, x, y });\n });\n}\n\nexport function Menu({ trigger, items, onDismiss, closeOnSelect = true, testID }: MenuProps) {\n const { theme } = useTheme();\n const { bindKeydown } = useFocusManager();\n const animation = resolveOverlayAnimation('menu');\n const anchorRef = React.useRef<View | null>(null);\n const [open, setOpen] = React.useState(false);\n const [layout, setLayout] = React.useState<LayoutRectangle | null>(null);\n const [activeIndex, setActiveIndex] = React.useState(0);\n\n const closeMenu = React.useCallback(() => {\n setOpen(false);\n onDismiss?.();\n }, [onDismiss]);\n\n const openMenu = React.useCallback(() => {\n measureNode(anchorRef.current, setLayout);\n const firstEnabledIndex = items.findIndex((item) => !item.disabled);\n setActiveIndex(firstEnabledIndex === -1 ? 0 : firstEnabledIndex);\n setOpen(true);\n }, [items]);\n\n React.useEffect(() => {\n if (!open) {\n return undefined;\n }\n\n return bindKeydown((event) => {\n const { key } = event;\n if (key === 'ArrowDown' || key === 'ArrowUp' || key === 'Home' || key === 'End') {\n event.preventDefault();\n setActiveIndex((current) => resolveNextMenuIndex(items, current, key));\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n const activeItem = items[activeIndex];\n if (activeItem && !activeItem.disabled) {\n activeItem.onPress?.();\n if (closeOnSelect) {\n closeMenu();\n }\n }\n }\n\n if (event.key === 'Escape') {\n event.preventDefault();\n closeMenu();\n }\n });\n }, [activeIndex, bindKeydown, closeMenu, closeOnSelect, items, open]);\n\n return (\n <View collapsable={false} ref={anchorRef}>\n <ButtonBase\n onPress={open ? closeMenu : openMenu}\n testID={testID ? `${testID}-trigger` : undefined}\n >\n {trigger}\n </ButtonBase>\n <Portal layer=\"menu\" visible={open && Boolean(layout)}>\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={closeMenu}\n style={{\n bottom: 0,\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n }}\n />\n <FocusScope active={open} onEscape={closeMenu}>\n <View\n style={{\n left: layout?.x ?? 0,\n position: 'absolute',\n top: (layout?.y ?? 0) + (layout?.height ?? 0) + animation.offset,\n }}\n >\n <Surface\n accessibilityRole=\"menu\"\n p=\"xs\"\n style={{\n minWidth: Math.max(layout?.width ?? 0, 180),\n shadowOpacity: 0.12,\n shadowRadius: 12,\n shadowOffset: { width: 0, height: 6 },\n }}\n testID={testID}\n variant=\"raised\"\n >\n {items.map((item, index) => {\n const selected = index === activeIndex;\n\n return (\n <Pressable\n accessibilityRole=\"menuitem\"\n accessibilityState={{ disabled: item.disabled, selected }}\n disabled={item.disabled}\n key={item.id}\n onPress={() => {\n if (item.disabled) {\n return;\n }\n\n item.onPress?.();\n if (closeOnSelect) {\n closeMenu();\n }\n }}\n >\n <Box\n px=\"m\"\n py=\"s\"\n style={{\n backgroundColor: selected\n ? theme.semantics.action.neutral.softBg\n : 'transparent',\n opacity: item.disabled ? 0.56 : 1,\n }}\n testID={testID ? `${testID}-item-${item.id}` : undefined}\n >\n <Text color={selected ? 'neutral' : undefined} variant=\"bodySmall\">\n {item.label}\n </Text>\n </Box>\n </Pressable>\n );\n })}\n </Surface>\n </View>\n </FocusScope>\n </View>\n </Portal>\n </View>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../../src/components/menu/Menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAwB,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAErE,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AASpD,SAAS,WAAW,CAAC,IAAa,EAAE,QAA2C;IAC7E,MAAM,cAAc,GAAG,IAA6B,CAAC;IACrD,cAAc,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACxD,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,mBAAmB,CAAC,MAAkB,EAAE,MAAe;IAC9D,MAAM,UAAU,GACd,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,IAAI,MAAM,C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AAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iBACpC,CAAC,CACF,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,SAAS,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAE3D;wBAAA,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,CACtC;sBAAA,EAAE,GAAG,CACP;oBAAA,EAAE,SAAS,CAAC,CACb,CAAC;QACJ,CAAC,CAAC,CACJ;cAAA,EAAE,OAAO,CACX;YAAA,EAAE,IAAI,CACR;UAAA,EAAE,UAAU,CACd;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,MAAM,CACV;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { type LayoutRectangle, Pressable, View } from 'react-native';\n\nimport { FocusScope } from '../../internal/focus/FocusScope';\nimport { useFocusManager } from '../../internal/focus/useFocusManager';\nimport { Portal } from '../../internal/overlay/Portal';\nimport { resolveOverlayAnimation } from '../../internal/resolvers';\nimport { Box, Inline, Stack, Surface } from '../../layout';\nimport { ButtonBase } from '../../primitives/button-base';\nimport { Text } from '../../primitives/text';\nimport { useTheme } from '../../theme/ThemeContext';\nimport { resolveNextMenuIndex } from './navigation';\nimport type { MenuAction, MenuProps } from './types';\n\ninterface MeasurableNode {\n measureInWindow?: (\n callback: (x: number, y: number, width: number, height: number) => void,\n ) => void;\n}\n\nfunction measureNode(node: unknown, callback: (layout: LayoutRectangle) => void) {\n const measurableNode = node as MeasurableNode | null;\n measurableNode?.measureInWindow?.((x, y, width, height) => {\n callback({ height, width, x, y });\n });\n}\n\nfunction renderActionContent(action: MenuAction, active: boolean) {\n const titleColor =\n action.intent === 'danger' ? 'danger' : active || action.selected ? 'neutral' : undefined;\n\n return (\n <Inline align=\"center\" gap=\"s\" justify=\"space-between\" wrap=\"nowrap\">\n {action.leading ? <Box>{action.leading}</Box> : null}\n <Box flex={1}>\n <Stack gap=\"xxs\">\n <Text\n color={titleColor}\n variant=\"bodySmall\"\n weight={action.selected ? 'semiBold' : 'medium'}\n >\n {action.title}\n </Text>\n {action.description ? (\n <Text emphasis=\"muted\" variant=\"caption\">\n {action.description}\n </Text>\n ) : null}\n </Stack>\n </Box>\n {action.trailing ? <Box>{action.trailing}</Box> : null}\n </Inline>\n );\n}\n\nexport function Menu({ trigger, actions, dismiss, closeOnSelect = true, testID }: MenuProps) {\n const { theme } = useTheme();\n const { bindKeydown } = useFocusManager();\n const animation = resolveOverlayAnimation('menu');\n const anchorRef = React.useRef<View | null>(null);\n const [open, setOpen] = React.useState(false);\n const [layout, setLayout] = React.useState<LayoutRectangle | null>(null);\n const [activeIndex, setActiveIndex] = React.useState(0);\n\n const closeMenu = React.useCallback(() => {\n setOpen(false);\n if (dismiss) {\n dismiss();\n }\n }, [dismiss]);\n\n const activateAction = React.useCallback(\n (action: MenuAction) => {\n if (action.disabled) {\n return;\n }\n\n if (action.activate) {\n action.activate();\n }\n\n if (closeOnSelect) {\n closeMenu();\n }\n },\n [closeMenu, closeOnSelect],\n );\n\n const openMenu = React.useCallback(() => {\n measureNode(anchorRef.current, setLayout);\n const firstEnabledIndex = actions.findIndex((action) => !action.disabled);\n setActiveIndex(firstEnabledIndex === -1 ? 0 : firstEnabledIndex);\n setOpen(true);\n }, [actions]);\n\n React.useEffect(() => {\n if (!open) {\n return undefined;\n }\n\n return bindKeydown((event) => {\n const { key } = event;\n if (key === 'ArrowDown' || key === 'ArrowUp' || key === 'Home' || key === 'End') {\n event.preventDefault();\n setActiveIndex((current) => resolveNextMenuIndex(actions, current, key));\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n const activeAction = actions[activeIndex];\n if (activeAction) {\n activateAction(activeAction);\n }\n }\n\n if (event.key === 'Escape') {\n event.preventDefault();\n closeMenu();\n }\n });\n }, [activateAction, actions, activeIndex, bindKeydown, closeMenu, open]);\n\n return (\n <View collapsable={false} ref={anchorRef}>\n <ButtonBase\n onPress={open ? closeMenu : openMenu}\n testID={testID ? `${testID}-trigger` : undefined}\n >\n {trigger}\n </ButtonBase>\n <Portal layer=\"menu\" visible={open && Boolean(layout)}>\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={closeMenu}\n style={{\n bottom: 0,\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n }}\n />\n <FocusScope active={open} onEscape={closeMenu}>\n <View\n style={{\n left: layout?.x ?? 0,\n position: 'absolute',\n top: (layout?.y ?? 0) + (layout?.height ?? 0) + animation.offset,\n }}\n >\n <Surface\n accessibilityRole=\"menu\"\n p=\"xs\"\n style={{\n minWidth: Math.max(layout?.width ?? 0, 220),\n shadowOpacity: 0.12,\n shadowRadius: 12,\n shadowOffset: { width: 0, height: 6 },\n }}\n testID={testID}\n variant=\"raised\"\n >\n {actions.map((action, index) => {\n const active = index === activeIndex;\n const selected = action.selected ?? active;\n\n return (\n <Pressable\n accessibilityRole=\"menuitem\"\n accessibilityState={{ disabled: action.disabled, selected }}\n disabled={action.disabled}\n key={action.id}\n onPress={() => activateAction(action)}\n >\n <Box\n px=\"m\"\n py=\"s\"\n radius=\"s\"\n style={{\n backgroundColor: selected\n ? theme.semantics.action.neutral.softBg\n : 'transparent',\n opacity: action.disabled ? 0.56 : 1,\n }}\n testID={testID ? `${testID}-item-${action.id}` : undefined}\n >\n {renderActionContent(action, active)}\n </Box>\n </Pressable>\n );\n })}\n </Surface>\n </View>\n </FocusScope>\n </View>\n </Portal>\n </View>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,IAAI,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC","sourcesContent":["export { Menu } from './Menu';\nexport type { MenuItem, MenuProps } from './types';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC","sourcesContent":["export { Menu } from './Menu';\nexport type { MenuAction, MenuActionIntent, MenuAction as MenuItem, MenuProps } from './types';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../src/components/menu/navigation.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAClC,KAAK,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../src/components/menu/navigation.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,EACxC,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,KAAK,GAC5C,MAAM,CA6BR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../../src/components/menu/navigation.ts"],"names":[],"m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C","sourcesContent":["export function resolveNextMenuIndex(\n items: readonly { disabled?: boolean }[],\n currentIndex: number,\n key: 'ArrowDown' | 'ArrowUp' | 'Home' | 'End',\n): number {\n const enabledIndexes = items.reduce<number[]>((indexes, item, index) => {\n if (!item.disabled) {\n indexes.push(index);\n }\n return indexes;\n }, []);\n\n if (enabledIndexes.length === 0) {\n return -1;\n }\n\n if (key === 'Home') {\n return enabledIndexes[0] ?? -1;\n }\n\n if (key === 'End') {\n return enabledIndexes[enabledIndexes.length - 1] ?? -1;\n }\n\n const activeEnabledIndex = enabledIndexes.indexOf(currentIndex);\n const nextEnabledIndex =\n activeEnabledIndex === -1\n ? 0\n : key === 'ArrowUp'\n ? (activeEnabledIndex - 1 + enabledIndexes.length) % enabledIndexes.length\n : (activeEnabledIndex + 1) % enabledIndexes.length;\n\n return enabledIndexes[nextEnabledIndex] ?? -1;\n}\n"]}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
export
|
|
2
|
+
export type MenuActionIntent = 'default' | 'danger';
|
|
3
|
+
export interface MenuAction {
|
|
3
4
|
id: string;
|
|
4
|
-
|
|
5
|
+
title: React.ReactNode;
|
|
6
|
+
description?: React.ReactNode;
|
|
7
|
+
leading?: React.ReactNode;
|
|
8
|
+
trailing?: React.ReactNode;
|
|
9
|
+
intent?: MenuActionIntent;
|
|
5
10
|
disabled?: boolean;
|
|
6
|
-
|
|
11
|
+
selected?: boolean;
|
|
12
|
+
activate?: () => void;
|
|
7
13
|
}
|
|
8
14
|
export interface MenuProps {
|
|
9
15
|
trigger?: React.ReactNode;
|
|
10
|
-
|
|
11
|
-
|
|
16
|
+
actions: readonly MenuAction[];
|
|
17
|
+
dismiss?: () => void;
|
|
12
18
|
closeOnSelect?: boolean;
|
|
13
19
|
testID?: string;
|
|
14
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/menu/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/menu/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEpD,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,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,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/menu/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nexport interface
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/menu/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nexport type MenuActionIntent = 'default' | 'danger';\n\nexport interface MenuAction {\n id: string;\n title: React.ReactNode;\n description?: React.ReactNode;\n leading?: React.ReactNode;\n trailing?: React.ReactNode;\n intent?: MenuActionIntent;\n disabled?: boolean;\n selected?: boolean;\n activate?: () => void;\n}\n\nexport interface MenuProps {\n trigger?: React.ReactNode;\n actions: readonly MenuAction[];\n dismiss?: () => void;\n closeOnSelect?: boolean;\n testID?: string;\n}\n"]}
|
|
@@ -56,7 +56,7 @@ export function Tooltip({ children, content, delay = 150, placement = 'top', tes
|
|
|
56
56
|
top: tooltipTop,
|
|
57
57
|
}}>
|
|
58
58
|
<Surface p="s" style={{
|
|
59
|
-
backgroundColor: theme.semantics.
|
|
59
|
+
backgroundColor: theme.semantics.surface.inverse,
|
|
60
60
|
}} testID={testID} variant="raised">
|
|
61
61
|
<Text emphasis="inverse" variant="caption">
|
|
62
62
|
{content}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../src/components/tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAwB,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE/E,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AASpD,SAAS,WAAW,CAAC,IAAa,EAAE,QAA2C;IAC7E,MAAM,cAAc,GAAG,IAA6B,CAAC;IACrD,cAAc,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACxD,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC;A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AC,SAAS,CAAC,OAAO,CAAC,OAAO;SACjD,CAAC,CACF,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,OAAO,CAAC,QAAQ,CAEhB;YAAA,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CACxC;cAAA,CAAC,OAAO,CACV;YAAA,EAAE,IAAI,CACR;UAAA,EAAE,OAAO,CACX;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,MAAM,CACV;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { type LayoutRectangle, Platform, Pressable, View } from 'react-native';\n\nimport { Portal } from '../../internal/overlay/Portal';\nimport { resolveOverlayAnimation } from '../../internal/resolvers';\nimport { Surface } from '../../layout';\nimport { Text } from '../../primitives/text';\nimport { useTheme } from '../../theme/ThemeContext';\nimport type { TooltipProps } from './types';\n\ninterface MeasurableNode {\n measureInWindow?: (\n callback: (x: number, y: number, width: number, height: number) => void,\n ) => void;\n}\n\nfunction measureNode(node: unknown, callback: (layout: LayoutRectangle) => void) {\n const measurableNode = node as MeasurableNode | null;\n measurableNode?.measureInWindow?.((x, y, width, height) => {\n callback({ height, width, x, y });\n });\n}\n\nexport function Tooltip({\n children,\n content,\n delay = 150,\n placement = 'top',\n testID,\n}: TooltipProps) {\n const { theme } = useTheme();\n const animation = resolveOverlayAnimation('tooltip');\n const anchorRef = React.useRef<View | null>(null);\n const timeoutRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n const [visible, setVisible] = React.useState(false);\n const [layout, setLayout] = React.useState<LayoutRectangle | null>(null);\n\n const show = React.useCallback(() => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n\n timeoutRef.current = setTimeout(() => {\n measureNode(anchorRef.current, setLayout);\n setVisible(true);\n }, delay);\n }, [delay]);\n\n const hide = React.useCallback(() => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = null;\n }\n setVisible(false);\n }, []);\n\n React.useEffect(\n () => () => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n },\n [],\n );\n\n const tooltipLeft = layout ? layout.x : 0;\n const tooltipTop =\n layout && placement === 'top'\n ? layout.y - animation.offset\n : layout\n ? layout.y + layout.height + animation.offset\n : 0;\n\n return (\n <View collapsable={false} ref={anchorRef} testID={testID ? `${testID}-anchor` : undefined}>\n <Pressable\n onBlur={hide}\n onFocus={show}\n onHoverIn={Platform.OS === 'web' ? show : undefined}\n onHoverOut={Platform.OS === 'web' ? hide : undefined}\n >\n {children}\n </Pressable>\n <Portal layer=\"tooltip\" visible={visible && Boolean(layout)}>\n <View\n pointerEvents=\"none\"\n style={{\n left: tooltipLeft,\n position: 'absolute',\n top: tooltipTop,\n }}\n >\n <Surface\n p=\"s\"\n style={{\n backgroundColor: theme.semantics.surface.inverse,\n }}\n testID={testID}\n variant=\"raised\"\n >\n <Text emphasis=\"inverse\" variant=\"caption\">\n {content}\n </Text>\n </Surface>\n </View>\n </Portal>\n </View>\n );\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function
|
|
2
|
+
export declare function FormExample(): React.JSX.Element;
|
|
3
|
+
export declare function FeedbackExample(): React.JSX.Element;
|
|
4
|
+
export declare function OverlayExample(): React.JSX.Element;
|
|
4
5
|
export declare function NavigationExample(): React.JSX.Element;
|
|
5
6
|
//# sourceMappingURL=DocsExamples.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocsExamples.d.ts","sourceRoot":"","sources":["../../src/examples/DocsExamples.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DocsExamples.d.ts","sourceRoot":"","sources":["../../src/examples/DocsExamples.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AA0B1B,wBAAgB,WAAW,sBAY1B;AAeD,wBAAgB,eAAe,sBAa9B;AAED,wBAAgB,cAAc,sBAyB7B;AAED,wBAAgB,iBAAiB,sBAgChC"}
|
|
@@ -1,48 +1,72 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Button } from '../components/button';
|
|
3
|
+
import { Card } from '../components/card';
|
|
4
|
+
import { Checkbox } from '../components/checkbox';
|
|
5
|
+
import { Drawer } from '../components/drawer';
|
|
6
|
+
import { Field } from '../components/field';
|
|
7
|
+
import { HelperText } from '../components/helper-text';
|
|
8
|
+
import { Menu } from '../components/menu';
|
|
9
|
+
import { Modal } from '../components/modal';
|
|
10
|
+
import { Tab, TabList, TabPanel, Tabs } from '../components/tabs';
|
|
11
|
+
import { TextInput } from '../components/text-input';
|
|
12
|
+
import { ToastProvider, useToast } from '../components/toast';
|
|
13
|
+
import { Tooltip } from '../components/tooltip';
|
|
14
|
+
import { Box, Stack } from '../layout';
|
|
15
|
+
import { Text } from '../primitives/text';
|
|
16
|
+
import { ThemeProvider } from '../theme';
|
|
3
17
|
const docsThemeConfig = {
|
|
4
|
-
id: 'docs
|
|
5
|
-
name: 'Docs
|
|
6
|
-
light: {
|
|
7
|
-
|
|
8
|
-
primaryColor: '#2563eb',
|
|
9
|
-
},
|
|
10
|
-
dark: {
|
|
11
|
-
harmony: 'monochromatic',
|
|
12
|
-
primaryColor: '#2563eb',
|
|
13
|
-
},
|
|
18
|
+
id: 'docs',
|
|
19
|
+
name: 'Docs',
|
|
20
|
+
light: { primaryColor: '#2563EB', harmony: 'analogous' },
|
|
21
|
+
dark: { primaryColor: '#60A5FA', harmony: 'analogous' },
|
|
14
22
|
};
|
|
15
|
-
export function
|
|
23
|
+
export function FormExample() {
|
|
16
24
|
return (<ThemeProvider initialConfig={docsThemeConfig}>
|
|
17
25
|
<Stack gap="m" p="l">
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
<Field helperText="Use your work email." label="Email" required>
|
|
27
|
+
<TextInput placeholder="you@example.com"/>
|
|
28
|
+
</Field>
|
|
29
|
+
<Checkbox checked>Accept terms</Checkbox>
|
|
30
|
+
<HelperText emphasis="muted">Looks good.</HelperText>
|
|
23
31
|
</Stack>
|
|
24
32
|
</ThemeProvider>);
|
|
25
33
|
}
|
|
26
|
-
|
|
34
|
+
function ToastButton() {
|
|
35
|
+
const { showToast } = useToast();
|
|
36
|
+
return (<Button onPress={() => showToast({ description: 'Your changes were saved.', status: 'success', title: 'Saved' })}>
|
|
37
|
+
Show toast
|
|
38
|
+
</Button>);
|
|
39
|
+
}
|
|
40
|
+
export function FeedbackExample() {
|
|
27
41
|
return (<ThemeProvider initialConfig={docsThemeConfig}>
|
|
28
|
-
<
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<
|
|
34
|
-
</Field>
|
|
35
|
-
<Stack gap="s">
|
|
36
|
-
<Label required>Preferences</Label>
|
|
37
|
-
<Checkbox defaultChecked>Weekly updates</Checkbox>
|
|
38
|
-
<Radio>Product announcements</Radio>
|
|
39
|
-
<Switch readOnly>Read-only setting</Switch>
|
|
40
|
-
<HelperText color="error">Invalid fields should reuse the same error color.</HelperText>
|
|
42
|
+
<ToastProvider>
|
|
43
|
+
<Stack gap="m" p="l">
|
|
44
|
+
<Tooltip content="Helpful contextual information">
|
|
45
|
+
<Text>Hover for tooltip</Text>
|
|
46
|
+
</Tooltip>
|
|
47
|
+
<ToastButton />
|
|
41
48
|
</Stack>
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
</ToastProvider>
|
|
50
|
+
</ThemeProvider>);
|
|
51
|
+
}
|
|
52
|
+
export function OverlayExample() {
|
|
53
|
+
const [modalVisible, setModalVisible] = React.useState(false);
|
|
54
|
+
const [drawerVisible, setDrawerVisible] = React.useState(false);
|
|
55
|
+
return (<ThemeProvider initialConfig={docsThemeConfig}>
|
|
56
|
+
<Stack gap="m" p="l">
|
|
57
|
+
<Button onPress={() => setModalVisible(true)}>Open modal</Button>
|
|
58
|
+
<Button onPress={() => setDrawerVisible(true)}>Open drawer</Button>
|
|
59
|
+
<Modal onDismiss={() => setModalVisible(false)} visible={modalVisible}>
|
|
60
|
+
<Card>
|
|
61
|
+
<Stack gap="s">
|
|
62
|
+
<Text variant="label" weight="semiBold">
|
|
63
|
+
Modal title
|
|
64
|
+
</Text>
|
|
65
|
+
<Text>Modal content</Text>
|
|
66
|
+
</Stack>
|
|
67
|
+
</Card>
|
|
44
68
|
</Modal>
|
|
45
|
-
<Drawer
|
|
69
|
+
<Drawer onDismiss={() => setDrawerVisible(false)} visible={drawerVisible}>
|
|
46
70
|
<Text>Drawer content</Text>
|
|
47
71
|
</Drawer>
|
|
48
72
|
</Stack>
|
|
@@ -66,9 +90,9 @@ export function NavigationExample() {
|
|
|
66
90
|
<Text>Billing settings</Text>
|
|
67
91
|
</TabPanel>
|
|
68
92
|
</Tabs>
|
|
69
|
-
<Menu
|
|
70
|
-
{ id: 'edit',
|
|
71
|
-
{ disabled: true, id: 'archive',
|
|
93
|
+
<Menu actions={[
|
|
94
|
+
{ id: 'edit', title: 'Edit' },
|
|
95
|
+
{ disabled: true, id: 'archive', title: 'Archive' },
|
|
72
96
|
]} trigger={<Text>Open menu</Text>}/>
|
|
73
97
|
<Box>
|
|
74
98
|
<Text color="success">Theme overrides can stay semantic.</Text>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocsExamples.js","sourceRoot":"","sources":["../../src/examples/DocsExamples.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,
|
|
1
|
+
{"version":3,"file":"DocsExamples.js","sourceRoot":"","sources":["../../src/examples/DocsExamples.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,I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AAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAClB;QAAA,CAAC,IAAI,CAAC,YAAY,CAAC,SAAS,CAC1B;UAAA,CAAC,OAAO,CACN;YAAA,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,CACjC;YAAA,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAC5B;;YACF,EAAE,GAAG,CACL;YAAA,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,CACnC;UAAA,EAAE,OAAO,CACT;UAAA,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CACvB;YAAA,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAC9B;UAAA,EAAE,QAAQ,CACV;UAAA,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CACvB;YAAA,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAC9B;UAAA,EAAE,QAAQ,CACZ;QAAA,EAAE,IAAI,CACN;QAAA,CAAC,IAAI,CACH,OAAO,CAAC,CAAC;YACP,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;YAC7B,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;SACpD,CAAC,CACF,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,EAElC;QAAA,CAAC,GAAG,CACF;UAAA,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,kCAAkC,EAAE,IAAI,CAChE;QAAA,EAAE,GAAG,CACP;MAAA,EAAE,KAAK,CACT;IAAA,EAAE,aAAa,CAAC,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport { Button } from '../components/button';\nimport { Card } from '../components/card';\nimport { Checkbox } from '../components/checkbox';\nimport { Drawer } from '../components/drawer';\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 { TextInput } from '../components/text-input';\nimport { ToastProvider, useToast } from '../components/toast';\nimport { Tooltip } from '../components/tooltip';\nimport { Box, Stack } from '../layout';\nimport { Text } from '../primitives/text';\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 const [drawerVisible, setDrawerVisible] = 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 <Button onPress={() => setDrawerVisible(true)}>Open drawer</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 <Drawer onDismiss={() => setDrawerVisible(false)} visible={drawerVisible}>\n <Text>Drawer content</Text>\n </Drawer>\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"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type { LabelProps } from './components/label';
|
|
|
20
20
|
export { Label } from './components/label';
|
|
21
21
|
export type { ListItemProps } from './components/list-item';
|
|
22
22
|
export { ListItem } from './components/list-item';
|
|
23
|
-
export type { MenuItem, MenuProps } from './components/menu';
|
|
23
|
+
export type { MenuAction, MenuActionIntent, MenuItem, MenuProps } from './components/menu';
|
|
24
24
|
export { Menu } from './components/menu';
|
|
25
25
|
export type { ModalProps } from './components/modal';
|
|
26
26
|
export { Modal } from './components/modal';
|
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,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACxF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,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"]}
|
|
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 { MenuAction, MenuActionIntent, 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colorEngine.d.ts","sourceRoot":"","sources":["../../src/theme/colorEngine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,wBAAwB,EACxB,sBAAsB,EACtB,QAAQ,EACR,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAOjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAOV,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;AAEzE,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,wBAAwB,EACnC,UAAU,EAAE,yBAAyB,GACpC,qBAAqB,CAUvB;AA8DD,wBAAgB,eAAe,CAC7B,MAAM,EAAE,WAAW,EACnB,IAAI,GAAE,OAAO,GAAG,MAAgB,GAC/B;IACD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,QAAQ,EAAE,sBAAsB,CAAC;IACjC,SAAS,EAAE,cAAc,CAAC;CAC3B,
|
|
1
|
+
{"version":3,"file":"colorEngine.d.ts","sourceRoot":"","sources":["../../src/theme/colorE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