@ankhorage/surface 5.0.1 → 6.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 +6 -0
- package/README.md +1 -2
- package/dist/components/field/Field.d.ts +1 -0
- package/dist/components/field/Field.d.ts.map +1 -1
- package/dist/components/field/Field.js +5 -4
- package/dist/components/field/Field.js.map +1 -1
- package/dist/components/list-item/ListItem.d.ts +1 -0
- package/dist/components/list-item/ListItem.d.ts.map +1 -1
- package/dist/components/list-item/ListItem.js +13 -12
- package/dist/components/list-item/ListItem.js.map +1 -1
- package/dist/components/switch/Switch.d.ts +1 -0
- package/dist/components/switch/Switch.d.ts.map +1 -1
- package/dist/components/switch/Switch.js +10 -13
- package/dist/components/switch/Switch.js.map +1 -1
- package/dist/{layout → core/responsive}/Show.d.ts +2 -1
- package/dist/core/responsive/Show.d.ts.map +1 -0
- package/dist/{layout → core/responsive}/Show.js +3 -1
- package/dist/core/responsive/Show.js.map +1 -0
- package/dist/core/responsive/index.d.ts +1 -0
- package/dist/core/responsive/index.d.ts.map +1 -1
- package/dist/core/responsive/index.js +1 -0
- package/dist/core/responsive/index.js.map +1 -1
- package/dist/features/app-bar/adapters/inbound/AppBar.d.ts +5 -0
- package/dist/features/app-bar/adapters/inbound/AppBar.d.ts.map +1 -0
- package/dist/features/app-bar/adapters/inbound/AppBar.js +40 -0
- package/dist/features/app-bar/adapters/inbound/AppBar.js.map +1 -0
- package/dist/features/app-bar/public.d.ts +3 -0
- package/dist/features/app-bar/public.d.ts.map +1 -0
- package/dist/features/app-bar/public.js +2 -0
- package/dist/features/app-bar/public.js.map +1 -0
- package/dist/features/badge/adapters/inbound/Badge.js +3 -3
- package/dist/features/badge/adapters/inbound/Badge.js.map +1 -1
- package/dist/features/button/adapters/inbound/Button.js +8 -8
- package/dist/features/button/adapters/inbound/Button.js.map +1 -1
- package/dist/features/button/adapters/inbound/IconButton.js +3 -3
- package/dist/features/button/adapters/inbound/IconButton.js.map +1 -1
- package/dist/features/form/checkbox/adapters/inbound/Checkbox.js +7 -7
- package/dist/features/form/checkbox/adapters/inbound/Checkbox.js.map +1 -1
- package/dist/features/form/radio/adapters/inbound/Radio.js +8 -8
- package/dist/features/form/radio/adapters/inbound/Radio.js.map +1 -1
- package/dist/features/layout/adapters/inbound/Divider.js +2 -2
- package/dist/features/layout/adapters/inbound/Divider.js.map +1 -1
- package/dist/features/layout/adapters/inbound/Grid.d.ts.map +1 -1
- package/dist/features/layout/adapters/inbound/Grid.js +7 -9
- package/dist/features/layout/adapters/inbound/Grid.js.map +1 -1
- package/dist/features/layout/adapters/inbound/ScrollView.d.ts +5 -0
- package/dist/features/layout/adapters/inbound/ScrollView.d.ts.map +1 -0
- package/dist/features/layout/adapters/inbound/ScrollView.js +69 -0
- package/dist/features/layout/adapters/inbound/ScrollView.js.map +1 -0
- package/dist/features/layout/adapters/inbound/View.d.ts +5 -0
- package/dist/features/layout/adapters/inbound/View.d.ts.map +1 -0
- package/dist/features/layout/adapters/inbound/View.js +17 -0
- package/dist/features/layout/adapters/inbound/View.js.map +1 -0
- package/dist/features/layout/public.d.ts +3 -4
- package/dist/features/layout/public.d.ts.map +1 -1
- package/dist/features/layout/public.js +2 -3
- package/dist/features/layout/public.js.map +1 -1
- package/dist/features/modal/adapters/inbound/Modal.d.ts.map +1 -1
- package/dist/features/modal/adapters/inbound/Modal.js +8 -8
- package/dist/features/modal/adapters/inbound/Modal.js.map +1 -1
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.d.ts.map +1 -1
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.js +11 -12
- package/dist/features/popover-menu/adapters/inbound/PopoverMenu.js.map +1 -1
- package/dist/features/surface/adapters/inbound/Surface.d.ts +1 -1
- package/dist/features/surface/adapters/inbound/Surface.d.ts.map +1 -1
- package/dist/features/surface/adapters/inbound/Surface.js +3 -3
- package/dist/features/surface/adapters/inbound/Surface.js.map +1 -1
- package/dist/features/tabs/adapters/inbound/Tab.js +3 -3
- package/dist/features/tabs/adapters/inbound/Tab.js.map +1 -1
- package/dist/features/tabs/adapters/inbound/TabList.d.ts.map +1 -1
- package/dist/features/tabs/adapters/inbound/TabList.js +3 -5
- package/dist/features/tabs/adapters/inbound/TabList.js.map +1 -1
- package/dist/features/tabs/adapters/inbound/Tabs.js +2 -2
- package/dist/features/tabs/adapters/inbound/Tabs.js.map +1 -1
- package/dist/features/toast/adapters/inbound/Toast.js +5 -5
- package/dist/features/toast/adapters/inbound/Toast.js.map +1 -1
- package/dist/features/toast/adapters/inbound/ToastProvider.js +3 -3
- package/dist/features/toast/adapters/inbound/ToastProvider.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/primitives/button-base/ButtonBase.d.ts +1 -0
- package/dist/primitives/button-base/ButtonBase.d.ts.map +1 -1
- package/dist/primitives/button-base/ButtonBase.js +6 -5
- package/dist/primitives/button-base/ButtonBase.js.map +1 -1
- package/dist/primitives/button-base/types.d.ts +2 -2
- package/dist/primitives/button-base/types.d.ts.map +1 -1
- package/dist/primitives/button-base/types.js.map +1 -1
- package/dist/types/app-bar.d.ts +12 -0
- package/dist/types/app-bar.d.ts.map +1 -0
- package/dist/types/app-bar.js +2 -0
- package/dist/types/app-bar.js.map +1 -0
- package/dist/types/layout.d.ts +15 -17
- package/dist/types/layout.d.ts.map +1 -1
- package/dist/types/layout.js.map +1 -1
- package/dist/types/surface.d.ts +2 -2
- package/dist/types/surface.d.ts.map +1 -1
- package/dist/types/surface.js.map +1 -1
- package/dist/utils/resolveViewStyles.d.ts +7 -0
- package/dist/utils/resolveViewStyles.d.ts.map +1 -0
- package/dist/utils/{resolveBoxStyles.js → resolveViewStyles.js} +11 -4
- package/dist/utils/resolveViewStyles.js.map +1 -0
- package/package.json +1 -1
- package/src/components/field/Field.tsx +5 -4
- package/src/components/list-item/ListItem.tsx +17 -13
- package/src/components/switch/Switch.tsx +10 -15
- package/src/{layout → core/responsive}/Show.tsx +4 -1
- package/src/core/responsive/index.ts +1 -0
- package/src/features/app-bar/adapters/inbound/AppBar.tsx +69 -0
- package/src/features/app-bar/public.ts +2 -0
- package/src/features/badge/adapters/inbound/Badge.tsx +3 -3
- package/src/features/button/adapters/inbound/Button.tsx +8 -8
- package/src/features/button/adapters/inbound/IconButton.tsx +3 -3
- package/src/features/form/checkbox/adapters/inbound/Checkbox.tsx +7 -7
- package/src/features/form/radio/adapters/inbound/Radio.tsx +8 -8
- package/src/features/layout/adapters/inbound/Divider.tsx +2 -2
- package/src/features/layout/adapters/inbound/Grid.tsx +12 -14
- package/src/features/layout/adapters/inbound/ScrollView.tsx +102 -0
- package/src/features/layout/adapters/inbound/{Box.tsx → View.tsx} +9 -9
- package/src/features/layout/public.ts +3 -10
- package/src/features/modal/adapters/inbound/Modal.tsx +11 -8
- package/src/features/popover-menu/adapters/inbound/PopoverMenu.tsx +11 -14
- package/src/features/surface/adapters/inbound/Surface.tsx +3 -3
- package/src/features/tabs/adapters/inbound/Tab.tsx +3 -3
- package/src/features/tabs/adapters/inbound/TabList.tsx +3 -6
- package/src/features/tabs/adapters/inbound/Tabs.tsx +2 -2
- package/src/features/toast/adapters/inbound/Toast.tsx +5 -5
- package/src/features/toast/adapters/inbound/ToastProvider.tsx +3 -3
- package/src/index.test.ts +12 -38
- package/src/index.ts +4 -9
- package/src/primitives/button-base/ButtonBase.tsx +6 -8
- package/src/primitives/button-base/types.ts +2 -2
- package/src/types/app-bar.ts +13 -0
- package/src/types/layout.ts +25 -20
- package/src/types/surface.ts +2 -2
- package/src/utils/resolveViewStyles.test.ts +71 -0
- package/src/utils/{resolveBoxStyles.ts → resolveViewStyles.ts} +16 -9
- package/src/webAcceptance.test.tsx +8 -9
- package/dist/features/layout/adapters/inbound/Box.d.ts +0 -5
- package/dist/features/layout/adapters/inbound/Box.d.ts.map +0 -1
- package/dist/features/layout/adapters/inbound/Box.js +0 -17
- package/dist/features/layout/adapters/inbound/Box.js.map +0 -1
- package/dist/features/layout/adapters/inbound/Container.d.ts +0 -5
- package/dist/features/layout/adapters/inbound/Container.d.ts.map +0 -1
- package/dist/features/layout/adapters/inbound/Container.js +0 -28
- package/dist/features/layout/adapters/inbound/Container.js.map +0 -1
- package/dist/features/layout/adapters/inbound/Stack.d.ts +0 -5
- package/dist/features/layout/adapters/inbound/Stack.d.ts.map +0 -1
- package/dist/features/layout/adapters/inbound/Stack.js +0 -27
- package/dist/features/layout/adapters/inbound/Stack.js.map +0 -1
- package/dist/layout/AppBar.d.ts +0 -13
- package/dist/layout/AppBar.d.ts.map +0 -1
- package/dist/layout/AppBar.js +0 -30
- package/dist/layout/AppBar.js.map +0 -1
- package/dist/layout/Center.d.ts +0 -7
- package/dist/layout/Center.d.ts.map +0 -1
- package/dist/layout/Center.js +0 -12
- package/dist/layout/Center.js.map +0 -1
- package/dist/layout/Inline.d.ts +0 -5
- package/dist/layout/Inline.d.ts.map +0 -1
- package/dist/layout/Inline.js +0 -6
- package/dist/layout/Inline.js.map +0 -1
- package/dist/layout/ScrollArea.d.ts +0 -9
- package/dist/layout/ScrollArea.d.ts.map +0 -1
- package/dist/layout/ScrollArea.js +0 -52
- package/dist/layout/ScrollArea.js.map +0 -1
- package/dist/layout/Show.d.ts.map +0 -1
- package/dist/layout/Show.js.map +0 -1
- package/dist/layout/Spacer.d.ts +0 -9
- package/dist/layout/Spacer.d.ts.map +0 -1
- package/dist/layout/Spacer.js +0 -12
- package/dist/layout/Spacer.js.map +0 -1
- package/dist/layout/Template.d.ts +0 -18
- package/dist/layout/Template.d.ts.map +0 -1
- package/dist/layout/Template.js +0 -36
- package/dist/layout/Template.js.map +0 -1
- package/dist/layout/index.d.ts +0 -15
- package/dist/layout/index.d.ts.map +0 -1
- package/dist/layout/index.js +0 -8
- package/dist/layout/index.js.map +0 -1
- package/dist/utils/resolveBoxStyles.d.ts +0 -7
- package/dist/utils/resolveBoxStyles.d.ts.map +0 -1
- package/dist/utils/resolveBoxStyles.js.map +0 -1
- package/src/features/layout/adapters/inbound/Container.tsx +0 -43
- package/src/features/layout/adapters/inbound/Stack.test.ts +0 -13
- package/src/features/layout/adapters/inbound/Stack.tsx +0 -44
- package/src/layout/AppBar.tsx +0 -60
- package/src/layout/Center.tsx +0 -22
- package/src/layout/Inline.tsx +0 -9
- package/src/layout/ScrollArea.tsx +0 -116
- package/src/layout/Spacer.tsx +0 -22
- package/src/layout/Template.tsx +0 -86
- package/src/layout/index.ts +0 -14
- package/src/utils/resolveBoxStyles.test.ts +0 -54
|
@@ -2,9 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { Pressable } from 'react-native';
|
|
3
3
|
import { FocusScope } from '../../../../internal/focus/FocusScope';
|
|
4
4
|
import { useFocusManager } from '../../../../internal/focus/useFocusManager';
|
|
5
|
-
import { Inline } from '../../../../layout';
|
|
6
5
|
import { useTheme } from '../../../../theme/ThemeContext';
|
|
7
|
-
import {
|
|
6
|
+
import { View } from '../../../layout/public';
|
|
8
7
|
import { Popover } from '../../../popover/public';
|
|
9
8
|
import { Surface } from '../../../surface/public';
|
|
10
9
|
import { Text } from '../../../typography/public';
|
|
@@ -59,27 +58,27 @@ function PopoverMenuItem({ action, active, activateAction, passive, testID, }) {
|
|
|
59
58
|
const { theme } = useTheme();
|
|
60
59
|
const selected = action.selected ?? active;
|
|
61
60
|
return (<Pressable accessibilityRole="menuitem" accessibilityState={{ disabled: action.disabled, selected }} disabled={action.disabled} onPress={passive ? undefined : () => activateAction(action)} testID={testID ? `${testID}-item-${action.id}` : undefined}>
|
|
62
|
-
<
|
|
61
|
+
<View bg={selected ? theme.semantics.action.neutral.softBg : 'transparent'} opacity={action.disabled ? 0.56 : 1} px="m" py="s" radius="s">
|
|
63
62
|
<PopoverMenuItemContent action={action} active={active}/>
|
|
64
|
-
</
|
|
63
|
+
</View>
|
|
65
64
|
</Pressable>);
|
|
66
65
|
}
|
|
67
66
|
/*** Renders the leading, textual, and trailing content of one menu action. */
|
|
68
67
|
function PopoverMenuItemContent({ action, active, }) {
|
|
69
68
|
const titleColor = action.intent === 'danger' ? 'danger' : active || action.selected ? 'neutral' : undefined;
|
|
70
|
-
return (<
|
|
71
|
-
{action.leading ? <
|
|
72
|
-
<
|
|
73
|
-
<
|
|
69
|
+
return (<View align="center" direction="row" gap="s" justify="space-between" wrap="nowrap">
|
|
70
|
+
{action.leading ? <View>{action.leading}</View> : null}
|
|
71
|
+
<View flex={1}>
|
|
72
|
+
<View gap="xxs">
|
|
74
73
|
<Text color={titleColor} variant="bodySmall" weight={action.selected ? 'semiBold' : 'medium'}>
|
|
75
74
|
{action.title}
|
|
76
75
|
</Text>
|
|
77
76
|
{action.description ? (<Text emphasis="muted" variant="caption">
|
|
78
77
|
{action.description}
|
|
79
78
|
</Text>) : null}
|
|
80
|
-
</
|
|
81
|
-
</
|
|
82
|
-
{action.trailing ? <
|
|
83
|
-
</
|
|
79
|
+
</View>
|
|
80
|
+
</View>
|
|
81
|
+
{action.trailing ? <View>{action.trailing}</View> : null}
|
|
82
|
+
</View>);
|
|
84
83
|
}
|
|
85
84
|
//# sourceMappingURL=PopoverMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopoverMenu.js","sourceRoot":"","sources":["../../../../../src/features/popover-menu/adapters/inbound/PopoverMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,OAAO,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CAAC,CAAC,IAAI,CACpD;MAAA,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CACX;QAAA,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CACd;UAAA,CAAC,IAAI,CACH,KAAK,CAAC,CAAC,UAAU,CAAC,CAClB,OAAO,CAAC,WAAW,CACnB,MAAM,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAEhD;YAAA,CAAC,MAAM,CAAC,KAAK,CACf;UAAA,EAAE,IAAI,CACN;UAAA,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CACpB,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CACtC;cAAA,CAAC,MAAM,CAAC,WAAW,CACrB;YAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,IAAI,CACV;QAAA,EAAE,KAAK,CACT;MAAA,EAAE,GAAG,CACL;MAAA,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CACxD;IAAA,EAAE,MAAM,CAAC,CACV,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { Pressable } from 'react-native';\n\nimport { FocusScope } from '../../../../internal/focus/FocusScope';\nimport { useFocusManager } from '../../../../internal/focus/useFocusManager';\nimport { Inline } from '../../../../layout';\nimport { useTheme } from '../../../../theme/ThemeContext';\nimport type { PopoverMenuAction, PopoverMenuProps } from '../../../../types/popoverMenu';\nimport { Box, Stack } from '../../../layout/public';\nimport { Popover } from '../../../popover/public';\nimport { Surface } from '../../../surface/public';\nimport { Text } from '../../../typography/public';\nimport { usePopoverMenuController } from '../../composition/usePopoverMenuController';\nimport { resolveNextMenuIndex } from '../../utils/resolveNextMenuIndex';\n\n/*** Presents an anchored action menu using the shared Popover capability. */\nexport function PopoverMenu({\n trigger,\n actions,\n dismiss,\n closeOnSelect = true,\n interactionPolicy = 'enabled',\n testID,\n}: PopoverMenuProps) {\n const passive = interactionPolicy === 'passive';\n const controller = usePopoverMenuController({ actions, closeOnSelect, dismiss, passive });\n\n return (\n <Popover\n anchor={trigger}\n closeOnOutsidePress\n interactionPolicy={interactionPolicy}\n onOpenChange={controller.handleOpenChange}\n open={controller.open}\n placement=\"bottom-start\"\n testID={testID}\n >\n <PopoverMenuContent\n actions={actions}\n activeIndex={controller.activeIndex}\n activateAction={controller.activateAction}\n close={controller.close}\n passive={passive}\n setActiveIndex={controller.setActiveIndex}\n testID={testID}\n />\n </Popover>\n );\n}\n\ninterface PopoverMenuContentProps {\n actions: readonly PopoverMenuAction[];\n activeIndex: number;\n activateAction: (action: PopoverMenuAction) => void;\n close: () => void;\n passive: boolean;\n setActiveIndex: React.Dispatch<React.SetStateAction<number>>;\n testID?: string;\n}\n\n/*** Renders menu semantics and keyboard navigation inside an open Popover. */\nfunction PopoverMenuContent({\n actions,\n activeIndex,\n activateAction,\n close,\n passive,\n setActiveIndex,\n testID,\n}: PopoverMenuContentProps) {\n usePopoverMenuKeyboard({ actions, activeIndex, activateAction, close, passive, setActiveIndex });\n\n return (\n <FocusScope active onEscape={passive ? undefined : close}>\n <Surface accessibilityRole=\"menu\" p=\"xs\" testID={testID} variant=\"raised\">\n {actions.map((action, index) => (\n <PopoverMenuItem\n action={action}\n active={index === activeIndex}\n activateAction={activateAction}\n key={action.id}\n passive={passive}\n testID={testID}\n />\n ))}\n </Surface>\n </FocusScope>\n );\n}\n\n/*** Subscribes an open PopoverMenu to standard menu keyboard controls. */\nfunction usePopoverMenuKeyboard({\n actions,\n activeIndex,\n activateAction,\n close,\n passive,\n setActiveIndex,\n}: Omit<PopoverMenuContentProps, 'testID'>) {\n const { bindKeydown } = useFocusManager();\n\n React.useEffect(\n () =>\n bindKeydown((event) => {\n if (passive) return;\n\n const { key } = event;\n if (key === undefined) return;\n\n if (['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(key)) {\n event.preventDefault();\n setActiveIndex((current) => resolveNextMenuIndex(actions, current, key));\n return;\n }\n if (key === 'Enter') {\n event.preventDefault();\n const action = actions.at(activeIndex);\n if (action) activateAction(action);\n return;\n }\n if (key === 'Escape') {\n event.preventDefault();\n close();\n }\n }),\n [actions, activeIndex, activateAction, bindKeydown, close, passive, setActiveIndex],\n );\n}\n\n/*** Renders one accessible PopoverMenu action row. */\nfunction PopoverMenuItem({\n action,\n active,\n activateAction,\n passive,\n testID,\n}: {\n action: PopoverMenuAction;\n active: boolean;\n activateAction: (action: PopoverMenuAction) => void;\n passive: boolean;\n testID?: string;\n}) {\n const { theme } = useTheme();\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 onPress={passive ? undefined : () => activateAction(action)}\n testID={testID ? `${testID}-item-${action.id}` : undefined}\n >\n <Box\n bg={selected ? theme.semantics.action.neutral.softBg : 'transparent'}\n opacity={action.disabled ? 0.56 : 1}\n px=\"m\"\n py=\"s\"\n radius=\"s\"\n >\n <PopoverMenuItemContent action={action} active={active} />\n </Box>\n </Pressable>\n );\n}\n\n/*** Renders the leading, textual, and trailing content of one menu action. */\nfunction PopoverMenuItemContent({\n action,\n active,\n}: {\n action: PopoverMenuAction;\n active: boolean;\n}) {\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"]}
|
|
1
|
+
{"version":3,"file":"PopoverMenu.js","sourceRoot":"","sources":["../../../../../src/features/popover-menu/adapters/inbound/PopoverMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE,6EAA6E;AAC7E,MAAM,UAAU,WAAW,CAAC,EAC1B,OAAO,EACP,OAAO,EACP,OAAO,EACP,aAAa,GAAG,IAAI,EACpB,iBAAiB,GAAG,SAAS,EAC7B,MAAM,GACW;IACjB,MAAM,OAAO,GAAG,iBAAiB,KAAK,SAAS,CAAC;IAChD,MAAM,UAAU,GAAG,wBAAwB,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAE1F,OAAO,CACL,CAAC,OAAO,CACN,MAAM,CAAC,CAAC,OAAO,CAAC,CAChB,mBAAmB,CACnB,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,YAAY,CAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAC1C,IAAI,CAAC,CAAC,UAAU,CAAC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AQ,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAC1D;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { Pressable } from 'react-native';\n\nimport { FocusScope } from '../../../../internal/focus/FocusScope';\nimport { useFocusManager } from '../../../../internal/focus/useFocusManager';\nimport { useTheme } from '../../../../theme/ThemeContext';\nimport type { PopoverMenuAction, PopoverMenuProps } from '../../../../types/popoverMenu';\nimport { View } from '../../../layout/public';\nimport { Popover } from '../../../popover/public';\nimport { Surface } from '../../../surface/public';\nimport { Text } from '../../../typography/public';\nimport { usePopoverMenuController } from '../../composition/usePopoverMenuController';\nimport { resolveNextMenuIndex } from '../../utils/resolveNextMenuIndex';\n\n/*** Presents an anchored action menu using the shared Popover capability. */\nexport function PopoverMenu({\n trigger,\n actions,\n dismiss,\n closeOnSelect = true,\n interactionPolicy = 'enabled',\n testID,\n}: PopoverMenuProps) {\n const passive = interactionPolicy === 'passive';\n const controller = usePopoverMenuController({ actions, closeOnSelect, dismiss, passive });\n\n return (\n <Popover\n anchor={trigger}\n closeOnOutsidePress\n interactionPolicy={interactionPolicy}\n onOpenChange={controller.handleOpenChange}\n open={controller.open}\n placement=\"bottom-start\"\n testID={testID}\n >\n <PopoverMenuContent\n actions={actions}\n activeIndex={controller.activeIndex}\n activateAction={controller.activateAction}\n close={controller.close}\n passive={passive}\n setActiveIndex={controller.setActiveIndex}\n testID={testID}\n />\n </Popover>\n );\n}\n\ninterface PopoverMenuContentProps {\n actions: readonly PopoverMenuAction[];\n activeIndex: number;\n activateAction: (action: PopoverMenuAction) => void;\n close: () => void;\n passive: boolean;\n setActiveIndex: React.Dispatch<React.SetStateAction<number>>;\n testID?: string;\n}\n\n/*** Renders menu semantics and keyboard navigation inside an open Popover. */\nfunction PopoverMenuContent({\n actions,\n activeIndex,\n activateAction,\n close,\n passive,\n setActiveIndex,\n testID,\n}: PopoverMenuContentProps) {\n usePopoverMenuKeyboard({ actions, activeIndex, activateAction, close, passive, setActiveIndex });\n\n return (\n <FocusScope active onEscape={passive ? undefined : close}>\n <Surface accessibilityRole=\"menu\" p=\"xs\" testID={testID} variant=\"raised\">\n {actions.map((action, index) => (\n <PopoverMenuItem\n action={action}\n active={index === activeIndex}\n activateAction={activateAction}\n key={action.id}\n passive={passive}\n testID={testID}\n />\n ))}\n </Surface>\n </FocusScope>\n );\n}\n\n/*** Subscribes an open PopoverMenu to standard menu keyboard controls. */\nfunction usePopoverMenuKeyboard({\n actions,\n activeIndex,\n activateAction,\n close,\n passive,\n setActiveIndex,\n}: Omit<PopoverMenuContentProps, 'testID'>) {\n const { bindKeydown } = useFocusManager();\n\n React.useEffect(\n () =>\n bindKeydown((event) => {\n if (passive) return;\n const { key } = event;\n if (key === undefined) return;\n if (['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(key)) {\n event.preventDefault();\n setActiveIndex((current) => resolveNextMenuIndex(actions, current, key));\n return;\n }\n if (key === 'Enter') {\n event.preventDefault();\n const action = actions.at(activeIndex);\n if (action) activateAction(action);\n return;\n }\n if (key === 'Escape') {\n event.preventDefault();\n close();\n }\n }),\n [actions, activeIndex, activateAction, bindKeydown, close, passive, setActiveIndex],\n );\n}\n\n/*** Renders one accessible PopoverMenu action row. */\nfunction PopoverMenuItem({\n action,\n active,\n activateAction,\n passive,\n testID,\n}: {\n action: PopoverMenuAction;\n active: boolean;\n activateAction: (action: PopoverMenuAction) => void;\n passive: boolean;\n testID?: string;\n}) {\n const { theme } = useTheme();\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 onPress={passive ? undefined : () => activateAction(action)}\n testID={testID ? `${testID}-item-${action.id}` : undefined}\n >\n <View\n bg={selected ? theme.semantics.action.neutral.softBg : 'transparent'}\n opacity={action.disabled ? 0.56 : 1}\n px=\"m\"\n py=\"s\"\n radius=\"s\"\n >\n <PopoverMenuItemContent action={action} active={active} />\n </View>\n </Pressable>\n );\n}\n\n/*** Renders the leading, textual, and trailing content of one menu action. */\nfunction PopoverMenuItemContent({\n action,\n active,\n}: {\n action: PopoverMenuAction;\n active: boolean;\n}) {\n const titleColor =\n action.intent === 'danger' ? 'danger' : active || action.selected ? 'neutral' : undefined;\n\n return (\n <View align=\"center\" direction=\"row\" gap=\"s\" justify=\"space-between\" wrap=\"nowrap\">\n {action.leading ? <View>{action.leading}</View> : null}\n <View flex={1}>\n <View 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 </View>\n </View>\n {action.trailing ? <View>{action.trailing}</View> : null}\n </View>\n );\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SurfaceProps } from '../../../../types/surface';
|
|
3
|
-
/*** Renders a themed
|
|
3
|
+
/*** Renders a themed content surface with semantic elevation and border variants. */
|
|
4
4
|
export declare function Surface({ variant, radius, style, ...props }: SurfaceProps): React.JSX.Element;
|
|
5
5
|
//# sourceMappingURL=Surface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Surface.d.ts","sourceRoot":"","sources":["../../../../../src/features/surface/adapters/inbound/Surface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,2BAA2B,CAAC;AAG9E,
|
|
1
|
+
{"version":3,"file":"Surface.d.ts","sourceRoot":"","sources":["../../../../../src/features/surface/adapters/inbound/Surface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,2BAA2B,CAAC;AAG9E,qFAAqF;AACrF,wBAAgB,OAAO,CAAC,EAAE,OAAmB,EAAE,MAAY,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY,qBAiB3F"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useTheme } from '../../../../theme/ThemeContext';
|
|
3
|
-
import {
|
|
4
|
-
/*** Renders a themed
|
|
3
|
+
import { View } from '../../../layout/public';
|
|
4
|
+
/*** Renders a themed content surface with semantic elevation and border variants. */
|
|
5
5
|
export function Surface({ variant = 'default', radius = 'm', style, ...props }) {
|
|
6
6
|
const { theme } = useTheme();
|
|
7
7
|
const backgroundColor = variant === 'subtle'
|
|
@@ -10,7 +10,7 @@ export function Surface({ variant = 'default', radius = 'm', style, ...props })
|
|
|
10
10
|
? theme.semantics.surface.raised
|
|
11
11
|
: theme.semantics.surface.default;
|
|
12
12
|
const borderColor = theme.semantics.border.default;
|
|
13
|
-
return (<
|
|
13
|
+
return (<View {...props} radius={radius} style={[resolveSurfaceVariantStyles(variant, borderColor, backgroundColor), style]}/>);
|
|
14
14
|
}
|
|
15
15
|
/*** Resolves the semantic visual treatment for one Surface variant. */
|
|
16
16
|
function resolveSurfaceVariantStyles(variant, borderColor, backgroundColor) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Surface.js","sourceRoot":"","sources":["../../../../../src/features/surface/adapters/inbound/Surface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Surface.js","sourceRoot":"","sources":["../../../../../src/features/surface/adapters/inbound/Surface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE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ACJ,KAAK,SAAS;YACZ,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;QACzE,KAAK,SAAS;YACZ,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;IAC5D,CAAC;AACH,CAAC","sourcesContent":["import React from 'react';\nimport type { ViewStyle } from 'react-native';\n\nimport { useTheme } from '../../../../theme/ThemeContext';\nimport type { SurfaceProps, SurfaceVariant } from '../../../../types/surface';\nimport { View } from '../../../layout/public';\n\n/*** Renders a themed content surface with semantic elevation and border variants. */\nexport function Surface({ variant = 'default', radius = 'm', style, ...props }: SurfaceProps) {\n const { theme } = useTheme();\n const backgroundColor =\n variant === 'subtle'\n ? theme.semantics.surface.subtle\n : variant === 'raised'\n ? theme.semantics.surface.raised\n : theme.semantics.surface.default;\n const borderColor = theme.semantics.border.default;\n\n return (\n <View\n {...props}\n radius={radius}\n style={[resolveSurfaceVariantStyles(variant, borderColor, backgroundColor), style]}\n />\n );\n}\n\n/*** Resolves the semantic visual treatment for one Surface variant. */\nfunction resolveSurfaceVariantStyles(\n variant: SurfaceVariant,\n borderColor: string,\n backgroundColor: string,\n): ViewStyle {\n switch (variant) {\n case 'subtle':\n return { backgroundColor, borderColor: 'transparent', borderWidth: 0 };\n case 'raised':\n return {\n backgroundColor,\n borderColor: 'transparent',\n borderWidth: 0,\n elevation: 2,\n shadowColor: '#000000',\n shadowOpacity: 0.08,\n shadowOffset: { width: 0, height: 2 },\n shadowRadius: 8,\n };\n case 'outline':\n return { backgroundColor: 'transparent', borderColor, borderWidth: 1 };\n case 'default':\n return { backgroundColor, borderColor, borderWidth: 1 };\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Pressable } from 'react-native';
|
|
3
3
|
import { useTheme } from '../../../../theme/ThemeContext';
|
|
4
|
-
import {
|
|
4
|
+
import { View } from '../../../layout/public';
|
|
5
5
|
import { Text } from '../../../typography/public';
|
|
6
6
|
import { useTabRegistration } from '../../composition/useTabRegistration';
|
|
7
7
|
import { useTabsContext } from '../../composition/useTabsContext';
|
|
@@ -14,7 +14,7 @@ export function Tab({ value, children, disabled = false, interactionPolicy = 'en
|
|
|
14
14
|
const passive = interactionPolicy === 'passive';
|
|
15
15
|
const onPress = passive || disabled ? undefined : () => setActiveValue(value);
|
|
16
16
|
return (<Pressable accessibilityLabel={undefined} accessibilityRole="tab" accessibilityState={{ disabled, selected }} aria-controls={getPanelId(value)} disabled={disabled} nativeID={getTabId(value)} onBlur={() => setFocusedValue(undefined)} onFocus={() => setFocusedValue(value)} onPress={onPress} ref={pressableRef} testID={testID}>
|
|
17
|
-
<
|
|
17
|
+
<View px="m" py="s" style={resolveTabStyle({
|
|
18
18
|
borderColor: selected
|
|
19
19
|
? theme.semantics.action.primary.base
|
|
20
20
|
: theme.semantics.border.default,
|
|
@@ -23,7 +23,7 @@ export function Tab({ value, children, disabled = false, interactionPolicy = 'en
|
|
|
23
23
|
<Text color={selected ? 'primary' : undefined} variant="label" weight="medium">
|
|
24
24
|
{children}
|
|
25
25
|
</Text>
|
|
26
|
-
</
|
|
26
|
+
</View>
|
|
27
27
|
</Pressable>);
|
|
28
28
|
}
|
|
29
29
|
/*** Resolves active and disabled visual state without inline JSX styles. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.js","sourceRoot":"","sources":["../../../../../src/features/tabs/adapters/inbound/Tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAkB,MAAM,cAAc,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Tab.js","sourceRoot":"","sources":["../../../../../src/features/tabs/adapters/inbound/Tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,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C,KAAK,CAAC,CAAC,CAC1B,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CACzC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CACtC,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,GAAG,CAAC,CAAC,YAAY,CAAC,CAClB,MAAM,CAAC,CAAC,MAAM,CAAC,CAEf;MAAA,CAAC,IAAI,CACH,EAAE,CAAC,GAAG,CACN,EAAE,CAAC,GAAG,CACN,KAAK,CAAC,CAAC,eAAe,CAAC;YACrB,WAAW,EAAE,QAAQ;gBACnB,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI;gBACrC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO;YAClC,QAAQ;SACT,CAAC,CAAC,CAEH;QAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAC5E;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,SAAS,CAAC,CACb,CAAC;AACJ,CAAC;AAED,4EAA4E;AAC5E,SAAS,eAAe,CAAC,EACvB,WAAW,EACX,QAAQ,GAIT;IACC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAChG,CAAC","sourcesContent":["import React from 'react';\nimport { Pressable, type ViewStyle } from 'react-native';\n\nimport { useTheme } from '../../../../theme/ThemeContext';\nimport type { TabProps } from '../../../../types/tabs';\nimport { View } from '../../../layout/public';\nimport { Text } from '../../../typography/public';\nimport { useTabRegistration } from '../../composition/useTabRegistration';\nimport { useTabsContext } from '../../composition/useTabsContext';\n\n/*** Renders one accessible selectable tab inside a Tabs context. */\nexport function Tab({\n value,\n children,\n disabled = false,\n interactionPolicy = 'enabled',\n testID,\n}: TabProps) {\n const { theme } = useTheme();\n const { activeValue, getPanelId, getTabId, setActiveValue, setFocusedValue } = useTabsContext();\n const pressableRef = useTabRegistration({ disabled, value });\n const selected = activeValue === value;\n const passive = interactionPolicy === 'passive';\n const onPress = passive || disabled ? undefined : () => setActiveValue(value);\n\n return (\n <Pressable\n accessibilityLabel={undefined}\n accessibilityRole=\"tab\"\n accessibilityState={{ disabled, selected }}\n aria-controls={getPanelId(value)}\n disabled={disabled}\n nativeID={getTabId(value)}\n onBlur={() => setFocusedValue(undefined)}\n onFocus={() => setFocusedValue(value)}\n onPress={onPress}\n ref={pressableRef}\n testID={testID}\n >\n <View\n px=\"m\"\n py=\"s\"\n style={resolveTabStyle({\n borderColor: selected\n ? theme.semantics.action.primary.base\n : theme.semantics.border.default,\n disabled,\n })}\n >\n <Text color={selected ? 'primary' : undefined} variant=\"label\" weight=\"medium\">\n {children}\n </Text>\n </View>\n </Pressable>\n );\n}\n\n/*** Resolves active and disabled visual state without inline JSX styles. */\nfunction resolveTabStyle({\n borderColor,\n disabled,\n}: {\n borderColor: string;\n disabled: boolean;\n}): ViewStyle {\n return { borderBottomColor: borderColor, borderBottomWidth: 2, opacity: disabled ? 0.64 : 1 };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabList.d.ts","sourceRoot":"","sources":["../../../../../src/features/tabs/adapters/inbound/TabList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TabList.d.ts","sourceRoot":"","sources":["../../../../../src/features/tabs/adapters/inbound/TabList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,wBAAwB,CAAC;AAc7E,2EAA2E;AAC3E,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,YAAY,qBAuBzD"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { StyleSheet } from 'react-native';
|
|
3
2
|
import { useFocusManager } from '../../../../internal/focus/useFocusManager';
|
|
4
|
-
import {
|
|
3
|
+
import { View } from '../../../layout/public';
|
|
5
4
|
import { useTabsContext } from '../../composition/useTabsContext';
|
|
6
5
|
import { resolveNextTabValue } from '../../utils/resolveNextTabValue';
|
|
7
6
|
const navigationKeys = [
|
|
@@ -30,13 +29,12 @@ export function TabList({ children, testID }) {
|
|
|
30
29
|
setActiveValue(nextValue);
|
|
31
30
|
});
|
|
32
31
|
}, [bindKeydown, focusedValue, setActiveValue, tabs]);
|
|
33
|
-
return (<
|
|
32
|
+
return (<View accessibilityRole="tablist" direction="row" testID={testID}>
|
|
34
33
|
{children}
|
|
35
|
-
</
|
|
34
|
+
</View>);
|
|
36
35
|
}
|
|
37
36
|
/*** Narrows keyboard event keys to the tab navigation key contract. */
|
|
38
37
|
function isTabNavigationKey(key) {
|
|
39
38
|
return key !== undefined && navigationKeys.includes(key);
|
|
40
39
|
}
|
|
41
|
-
const styles = StyleSheet.create({ list: { flexDirection: 'row' } });
|
|
42
40
|
//# sourceMappingURL=TabList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabList.js","sourceRoot":"","sources":["../../../../../src/features/tabs/adapters/inbound/TabList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TabList.js","sourceRoot":"","sources":["../../../../../src/features/tabs/adapters/inbound/TabList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,C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,CAAC,CAC/D;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC;AAED,uEAAuE;AACvE,SAAS,kBAAkB,CAAC,GAAuB;IACjD,OAAO,GAAG,KAAK,SAAS,IAAI,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["import React from 'react';\n\nimport { useFocusManager } from '../../../../internal/focus/useFocusManager';\nimport type { TabListProps, TabNavigationKey } from '../../../../types/tabs';\nimport { View } from '../../../layout/public';\nimport { useTabsContext } from '../../composition/useTabsContext';\nimport { resolveNextTabValue } from '../../utils/resolveNextTabValue';\n\nconst navigationKeys: readonly string[] = [\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowDown',\n 'Home',\n 'End',\n];\n\n/*** Renders the accessible tab list and owns keyboard focus navigation. */\nexport function TabList({ children, testID }: TabListProps) {\n const { bindKeydown } = useFocusManager();\n const { focusedValue, setActiveValue, tabs } = useTabsContext();\n\n React.useEffect(() => {\n if (!focusedValue) return undefined;\n\n return bindKeydown((event) => {\n if (!isTabNavigationKey(event.key)) return;\n const nextValue = resolveNextTabValue(tabs, focusedValue, event.key);\n if (!nextValue) return;\n\n event.preventDefault();\n tabs.find((tab) => tab.value === nextValue)?.focus();\n setActiveValue(nextValue);\n });\n }, [bindKeydown, focusedValue, setActiveValue, tabs]);\n\n return (\n <View accessibilityRole=\"tablist\" direction=\"row\" testID={testID}>\n {children}\n </View>\n );\n}\n\n/*** Narrows keyboard event keys to the tab navigation key contract. */\nfunction isTabNavigationKey(key: string | undefined): key is TabNavigationKey {\n return key !== undefined && navigationKeys.includes(key);\n}\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { View } from '../../../layout/public';
|
|
3
3
|
import { TabsContext } from '../../composition/TabsContext';
|
|
4
4
|
import { useTabsController } from '../../composition/useTabsController';
|
|
5
5
|
/*** Provides accessible tab selection state to TabList, Tab, and TabPanel children. */
|
|
6
6
|
export function Tabs({ children, ...props }) {
|
|
7
7
|
const contextValue = useTabsController(props);
|
|
8
8
|
return (<TabsContext value={contextValue}>
|
|
9
|
-
<
|
|
9
|
+
<View testID={props.testID}>{children}</View>
|
|
10
10
|
</TabsContext>);
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=Tabs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../../../../src/features/tabs/adapters/inbound/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../../../../src/features/tabs/adapters/inbound/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAExE,uFAAuF;AACvF,MAAM,UAAU,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAa;IACpD,MAAM,YAAY,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAE9C,OAAO,CACL,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAC/B;MAAA,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,CAC9C;IAAA,EAAE,WAAW,CAAC,CACf,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport type { TabsProps } from '../../../../types/tabs';\nimport { View } from '../../../layout/public';\nimport { TabsContext } from '../../composition/TabsContext';\nimport { useTabsController } from '../../composition/useTabsController';\n\n/*** Provides accessible tab selection state to TabList, Tab, and TabPanel children. */\nexport function Tabs({ children, ...props }: TabsProps) {\n const contextValue = useTabsController(props);\n\n return (\n <TabsContext value={contextValue}>\n <View testID={props.testID}>{children}</View>\n </TabsContext>\n );\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Pressable, StyleSheet } from 'react-native';
|
|
3
3
|
import { useTheme } from '../../../../theme/ThemeContext';
|
|
4
|
-
import {
|
|
4
|
+
import { View } from '../../../layout/public';
|
|
5
5
|
import { Surface } from '../../../surface/public';
|
|
6
6
|
import { Text } from '../../../typography/public';
|
|
7
7
|
/*** Renders one transient toast notification. */
|
|
@@ -12,17 +12,17 @@ export function Toast({ title, description, status = 'default', onDismiss, inter
|
|
|
12
12
|
const passive = interactionPolicy === 'passive';
|
|
13
13
|
const statusStyle = React.useMemo(() => ({ borderLeftColor: statusColor }), [statusColor]);
|
|
14
14
|
return (<Surface p="m" style={[styles.root, statusStyle]} testID={testID} variant="raised">
|
|
15
|
-
<
|
|
16
|
-
<
|
|
15
|
+
<View align="center" direction="row" justify="space-between">
|
|
16
|
+
<View flex={1}>
|
|
17
17
|
{title ? (<Text variant="label" weight="medium">
|
|
18
18
|
{title}
|
|
19
19
|
</Text>) : null}
|
|
20
20
|
{description ? <Text emphasis="muted">{description}</Text> : null}
|
|
21
|
-
</
|
|
21
|
+
</View>
|
|
22
22
|
{onDismiss ? (<Pressable accessibilityLabel="Dismiss notification" accessibilityRole="button" onPress={passive ? undefined : onDismiss} testID={testID ? `${testID}-dismiss` : undefined}>
|
|
23
23
|
<Text color={statusTextColor}>×</Text>
|
|
24
24
|
</Pressable>) : null}
|
|
25
|
-
</
|
|
25
|
+
</View>
|
|
26
26
|
</Surface>);
|
|
27
27
|
}
|
|
28
28
|
/*** Resolves the border color representing a toast status. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.js","sourceRoot":"","sources":["../../../../../src/features/toast/adapters/inbound/Toast.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAC;AAGrE,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAG1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Toast.js","sourceRoot":"","sources":["../../../../../src/features/toast/adapters/inbound/Toast.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAC;AAGrE,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAG1D,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,iDAAiD;AACjD,MAAM,UAAU,KAAK,CAAC,EACpB,KAAK,EACL,WAAW,EACX,MAAM,GAAG,SAAS,EAClB,SAAS,EACT,iBAAiB,GAAG,SAAS,EAC7B,MAAM,GACK;IACX,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,WAAW,GAAG,uBAAuB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC3D,MAAM,eAAe,GAAG,2BAA2B,CAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,iBAAiB,KAAK,SAAS,CAAC;IAChD,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAC/B,GAAG,EAAE,CAAC,CAAC,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC,EACxC,CAAC,WAAW,CAAC,CACd,CAAC;IAEF,OAAO,CACL,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAA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,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC;QACtC,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC;QACtC,KAAK,OAAO;YACV,OAAO,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC;QACpC,KAAK,MAAM;YACT,OAAO,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;QACnC;YACE,OAAO,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;IAC/C,CAAC;AACH,CAAC;AAED,qEAAqE;AACrE,SAAS,2BAA2B,CAAC,MAA4B;IAC/D,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,OAAO;YACV,OAAO,OAAO,CAAC;QACjB,KAAK,MAAM;YACT,OAAO,MAAM,CAAC;QAChB;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,eAAe,EAAE,CAAC;QAClB,QAAQ,EAAE,GAAG;QACb,YAAY,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE;QACrC,aAAa,EAAE,IAAI;QACnB,YAAY,EAAE,EAAE;KACjB;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { Pressable, StyleSheet, type ViewStyle } from 'react-native';\n\nimport type { SurfaceColor } from '../../../../surfaceColor';\nimport { useTheme } from '../../../../theme/ThemeContext';\nimport type { SurfaceTheme } from '../../../../theme/types';\nimport type { ToastProps } from '../../../../types/toast';\nimport { View } from '../../../layout/public';\nimport { Surface } from '../../../surface/public';\nimport { Text } from '../../../typography/public';\n\n/*** Renders one transient toast notification. */\nexport function Toast({\n title,\n description,\n status = 'default',\n onDismiss,\n interactionPolicy = 'enabled',\n testID,\n}: ToastProps) {\n const { theme } = useTheme();\n const statusColor = resolveToastStatusColor(theme, status);\n const statusTextColor = resolveToastStatusTextColor(status);\n const passive = interactionPolicy === 'passive';\n const statusStyle = React.useMemo<ViewStyle>(\n () => ({ borderLeftColor: statusColor }),\n [statusColor],\n );\n\n return (\n <Surface p=\"m\" style={[styles.root, statusStyle]} testID={testID} variant=\"raised\">\n <View align=\"center\" direction=\"row\" justify=\"space-between\">\n <View flex={1}>\n {title ? (\n <Text variant=\"label\" weight=\"medium\">\n {title}\n </Text>\n ) : null}\n {description ? <Text emphasis=\"muted\">{description}</Text> : null}\n </View>\n {onDismiss ? (\n <Pressable\n accessibilityLabel=\"Dismiss notification\"\n accessibilityRole=\"button\"\n onPress={passive ? undefined : onDismiss}\n testID={testID ? `${testID}-dismiss` : undefined}\n >\n <Text color={statusTextColor}>×</Text>\n </Pressable>\n ) : null}\n </View>\n </Surface>\n );\n}\n\n/*** Resolves the border color representing a toast status. */\nfunction resolveToastStatusColor(theme: SurfaceTheme, status: ToastProps['status']) {\n switch (status) {\n case 'success':\n return theme.semantics.success.base;\n case 'warning':\n return theme.semantics.warning.base;\n case 'error':\n return theme.semantics.error.base;\n case 'info':\n return theme.semantics.info.base;\n default:\n return theme.semantics.action.primary.base;\n }\n}\n\n/*** Resolves the semantic text color representing a toast status. */\nfunction resolveToastStatusTextColor(status: ToastProps['status']): SurfaceColor {\n switch (status) {\n case 'success':\n return 'success';\n case 'warning':\n return 'warning';\n case 'error':\n return 'error';\n case 'info':\n return 'info';\n default:\n return 'primary';\n }\n}\n\nconst styles = StyleSheet.create({\n root: {\n borderLeftWidth: 3,\n minWidth: 280,\n shadowOffset: { height: 6, width: 0 },\n shadowOpacity: 0.14,\n shadowRadius: 12,\n },\n});\n"]}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { StyleSheet } from 'react-native';
|
|
3
3
|
import { Portal } from '../../../../internal/overlay/Portal';
|
|
4
4
|
import { resolveOverlayAnimation } from '../../../../internal/resolvers';
|
|
5
|
-
import {
|
|
5
|
+
import { View } from '../../../layout/public';
|
|
6
6
|
import { ToastContext } from '../../composition/ToastContext';
|
|
7
7
|
import { useToastRuntime } from '../../composition/useToastRuntime';
|
|
8
8
|
import { Toast } from './Toast';
|
|
@@ -14,9 +14,9 @@ export function ToastProvider({ children, defaultDuration = 4000 }) {
|
|
|
14
14
|
return (<ToastContext value={controller}>
|
|
15
15
|
{children}
|
|
16
16
|
<Portal layer="toast" visible={toasts.length > 0}>
|
|
17
|
-
<
|
|
17
|
+
<View gap="s" pointerEvents="box-none" style={[styles.container, animationStyle]}>
|
|
18
18
|
{toasts.map((toast) => (<Toast description={toast.description} key={toast.id} onDismiss={() => controller.dismissToast(toast.id)} status={toast.status} testID={toast.testID} title={toast.title}/>))}
|
|
19
|
-
</
|
|
19
|
+
</View>
|
|
20
20
|
</Portal>
|
|
21
21
|
</ToastContext>);
|
|
22
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastProvider.js","sourceRoot":"","sources":["../../../../../src/features/toast/adapters/inbound/ToastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ToastProvider.js","sourceRoot":"","sources":["../../../../../src/features/toast/adapters/inbound/ToastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,uB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AY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CACnD,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CACrB,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CACrB,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EACnB,CACH,CAAC,CACJ;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,MAAM,CACV;IAAA,EAAE,YAAY,CAAC,CAChB,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,UAAU,EAAE,UAAU;QACtB,OAAO,EAAE,EAAE;KACZ;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { StyleSheet, type ViewStyle } from 'react-native';\n\nimport { Portal } from '../../../../internal/overlay/Portal';\nimport { resolveOverlayAnimation } from '../../../../internal/resolvers';\nimport type { ToastProviderProps } from '../../../../types/toast';\nimport { View } from '../../../layout/public';\nimport { ToastContext } from '../../composition/ToastContext';\nimport { useToastRuntime } from '../../composition/useToastRuntime';\nimport { Toast } from './Toast';\n\n/*** Provides the toast runtime context and renders its shared portal host. */\nexport function ToastProvider({ children, defaultDuration = 4000 }: ToastProviderProps) {\n const animation = resolveOverlayAnimation('toast');\n const { controller, toasts } = useToastRuntime(defaultDuration);\n const animationStyle = React.useMemo<ViewStyle>(\n () => ({ paddingTop: 16 + animation.offset }),\n [animation.offset],\n );\n\n return (\n <ToastContext value={controller}>\n {children}\n <Portal layer=\"toast\" visible={toasts.length > 0}>\n <View gap=\"s\" pointerEvents=\"box-none\" style={[styles.container, animationStyle]}>\n {toasts.map((toast) => (\n <Toast\n description={toast.description}\n key={toast.id}\n onDismiss={() => controller.dismissToast(toast.id)}\n status={toast.status}\n testID={toast.testID}\n title={toast.title}\n />\n ))}\n </View>\n </Portal>\n </ToastContext>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n alignItems: 'flex-end',\n padding: 16,\n },\n});\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export { TranslationProvider, useTranslationContext } from './context/Translatio
|
|
|
17
17
|
export * from './core/responsive';
|
|
18
18
|
export type { AccordionContentProps, AccordionItemProps, AccordionMode, AccordionMultipleProps, AccordionProps, AccordionSingleProps, AccordionTriggerProps, } from './features/accordion/public';
|
|
19
19
|
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, } from './features/accordion/public';
|
|
20
|
+
export type { AppBarProps } from './features/app-bar/public';
|
|
21
|
+
export { AppBar } from './features/app-bar/public';
|
|
20
22
|
export type { BadgeProps } from './features/badge/public';
|
|
21
23
|
export { Badge } from './features/badge/public';
|
|
22
24
|
export type { ButtonIconSpec, ButtonProps, IconButtonProps } from './features/button/public';
|
|
@@ -35,8 +37,8 @@ export type { ImageFit, ImageProps, SurfaceImageSource } from './features/image/
|
|
|
35
37
|
export { Image } from './features/image/public';
|
|
36
38
|
export type { KeyboardAvoidingViewBehavior, KeyboardAvoidingViewProps, } from './features/keyboard-avoiding-view/public';
|
|
37
39
|
export { KeyboardAvoidingView } from './features/keyboard-avoiding-view/public';
|
|
38
|
-
export type {
|
|
39
|
-
export {
|
|
40
|
+
export type { DividerProps, GridProps, ScrollViewProps, ViewProps } from './features/layout/public';
|
|
41
|
+
export { Divider, Grid, ScrollView, View } from './features/layout/public';
|
|
40
42
|
export type { ModalProps } from './features/modal/public';
|
|
41
43
|
export { Modal } from './features/modal/public';
|
|
42
44
|
export type { PopoverAnchorRenderProps, PopoverPlacement, PopoverProps, } from './features/popover/public';
|
|
@@ -54,7 +56,6 @@ export { Tooltip } from './features/tooltip/public';
|
|
|
54
56
|
export type { HeadingLevel, HeadingProps, TextProps } from './features/typography/public';
|
|
55
57
|
export { Heading, Text } from './features/typography/public';
|
|
56
58
|
export type { InteractionPolicy, InteractionPolicyProps } from './interactionPolicy';
|
|
57
|
-
export * from './layout';
|
|
58
59
|
export type { ButtonBaseProps } from './primitives/button-base';
|
|
59
60
|
export { ButtonBase } from './primitives/button-base';
|
|
60
61
|
export type { SurfaceColor, SurfaceEmphasis, SurfacePaletteColor, SurfaceStatusColor, } from './surfaceColor';
|
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,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACrE,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AACjG,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,cAAc,mBAAmB,CAAC;AAClC,YAAY,EACV,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,oBAAoB,EACpB,qBAAqB,GACtB,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,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,YAAY,EACV,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,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"}
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export { FontProvider, useFontContext } from './context/FontContext';
|
|
|
8
8
|
export { TranslationProvider, useTranslationContext } from './context/TranslationContext';
|
|
9
9
|
export * from './core/responsive';
|
|
10
10
|
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, } from './features/accordion/public';
|
|
11
|
+
export { AppBar } from './features/app-bar/public';
|
|
11
12
|
export { Badge } from './features/badge/public';
|
|
12
13
|
export { Button, IconButton } from './features/button/public';
|
|
13
14
|
export { Card } from './features/card/public';
|
|
@@ -17,7 +18,7 @@ export { TextInput } from './features/form/text-input/public';
|
|
|
17
18
|
export { Icon, SUPPORTED_ICON_PROVIDERS } from './features/icon/public';
|
|
18
19
|
export { Image } from './features/image/public';
|
|
19
20
|
export { KeyboardAvoidingView } from './features/keyboard-avoiding-view/public';
|
|
20
|
-
export {
|
|
21
|
+
export { Divider, Grid, ScrollView, View } from './features/layout/public';
|
|
21
22
|
export { Modal } from './features/modal/public';
|
|
22
23
|
export { Popover } from './features/popover/public';
|
|
23
24
|
export { PopoverMenu } from './features/popover-menu/public';
|
|
@@ -26,7 +27,6 @@ export { Tab, TabList, TabPanel, Tabs } from './features/tabs/public';
|
|
|
26
27
|
export { Toast, ToastProvider, useToast } from './features/toast/public';
|
|
27
28
|
export { Tooltip } from './features/tooltip/public';
|
|
28
29
|
export { Heading, Text } from './features/typography/public';
|
|
29
|
-
export * from './layout';
|
|
30
30
|
export { ButtonBase } from './primitives/button-base';
|
|
31
31
|
export { SURFACE_COLORS, SURFACE_EMPHASES, SURFACE_PALETTE_COLORS, SURFACE_STATUS_COLORS, } from './surfaceColor';
|
|
32
32
|
export * from './theme';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,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,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,cAAc,mBAAmB,CAAC;AAUlC,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAS9D,OAAO,EAAE,IAAI,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAExE,OAAO,EAA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,EAAE,MAAM,0CAA0C,CAAC;AAEhF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAMhD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAMpD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEpD,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAQtE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEzE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAG7D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAOtD,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 { FieldProps } from './components/field';\nexport { Field } from './components/field';\nexport type { HelperTextProps } from './components/helper-text';\nexport { HelperText } from './components/helper-text';\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 { SwitchProps } from './components/switch';\nexport { Switch } from './components/switch';\nexport type { TextareaProps } from './components/textarea';\nexport { Textarea } from './components/textarea';\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 type {\n AccordionContentProps,\n AccordionItemProps,\n AccordionMode,\n AccordionMultipleProps,\n AccordionProps,\n AccordionSingleProps,\n AccordionTriggerProps,\n} from './features/accordion/public';\nexport {\n Accordion,\n AccordionContent,\n AccordionItem,\n AccordionTrigger,\n} from './features/accordion/public';\nexport type { AppBarProps } from './features/app-bar/public';\nexport { AppBar } from './features/app-bar/public';\nexport type { BadgeProps } from './features/badge/public';\nexport { Badge } from './features/badge/public';\nexport type { ButtonIconSpec, ButtonProps, IconButtonProps } from './features/button/public';\nexport { Button, IconButton } from './features/button/public';\nexport type { CardProps } from './features/card/public';\nexport { Card } from './features/card/public';\nexport type { CheckboxProps } from './features/form/checkbox/public';\nexport { Checkbox } from './features/form/checkbox/public';\nexport type { RadioProps } from './features/form/radio/public';\nexport { Radio } from './features/form/radio/public';\nexport type { TextInputProps } from './features/form/text-input/public';\nexport { TextInput } from './features/form/text-input/public';\nexport type {\n FontIconSource,\n IconProps,\n IconProvider,\n IconSource,\n IconVariant,\n SvgIconSource,\n} from './features/icon/public';\nexport { Icon, SUPPORTED_ICON_PROVIDERS } from './features/icon/public';\nexport type { ImageFit, ImageProps, SurfaceImageSource } from './features/image/public';\nexport { Image } from './features/image/public';\nexport type {\n KeyboardAvoidingViewBehavior,\n KeyboardAvoidingViewProps,\n} from './features/keyboard-avoiding-view/public';\nexport { KeyboardAvoidingView } from './features/keyboard-avoiding-view/public';\nexport type { DividerProps, GridProps, ScrollViewProps, ViewProps } from './features/layout/public';\nexport { Divider, Grid, ScrollView, View } from './features/layout/public';\nexport type { ModalProps } from './features/modal/public';\nexport { Modal } from './features/modal/public';\nexport type {\n PopoverAnchorRenderProps,\n PopoverPlacement,\n PopoverProps,\n} from './features/popover/public';\nexport { Popover } from './features/popover/public';\nexport type {\n PopoverMenuAction,\n PopoverMenuActionIntent,\n PopoverMenuProps,\n} from './features/popover-menu/public';\nexport { PopoverMenu } from './features/popover-menu/public';\nexport type { SurfaceProps, SurfaceVariant } from './features/surface/public';\nexport { Surface } from './features/surface/public';\nexport type { TabListProps, TabPanelProps, TabProps, TabsProps } from './features/tabs/public';\nexport { Tab, TabList, TabPanel, Tabs } from './features/tabs/public';\nexport type {\n ToastController,\n ToastOptions,\n ToastProps,\n ToastProviderProps,\n ToastStatus,\n} from './features/toast/public';\nexport { Toast, ToastProvider, useToast } from './features/toast/public';\nexport type { TooltipProps } from './features/tooltip/public';\nexport { Tooltip } from './features/tooltip/public';\nexport type { HeadingLevel, HeadingProps, TextProps } from './features/typography/public';\nexport { Heading, Text } from './features/typography/public';\nexport type { InteractionPolicy, InteractionPolicyProps } from './interactionPolicy';\nexport type { ButtonBaseProps } from './primitives/button-base';\nexport { ButtonBase } from './primitives/button-base';\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,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ButtonBaseProps } from './types';
|
|
3
|
+
/*** Renders the low-level token-aware Pressable boundary shared by Surface controls. */
|
|
3
4
|
export declare function ButtonBase({ children, disabled, interactionPolicy, onPress, onLongPress, accessibilityLabel, accessibilityRole, accessibilityState, style, testID, ...props }: ButtonBaseProps): React.JSX.Element;
|
|
4
5
|
//# sourceMappingURL=ButtonBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.d.ts","sourceRoot":"","sources":["../../../src/primitives/button-base/ButtonBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"ButtonBase.d.ts","sourceRoot":"","sources":["../../../src/primitives/button-base/ButtonBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAiB/C,wFAAwF;AACxF,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,QAAgB,EAChB,iBAA6B,EAC7B,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,iBAA4B,EAC5B,kBAAkB,EAClB,KAAK,EACL,MAAM,EACN,GAAG,KAAK,EACT,EAAE,eAAe,qBAuCjB"}
|
|
@@ -3,7 +3,8 @@ import { Platform, Pressable } from 'react-native';
|
|
|
3
3
|
import { useResponsiveRuntime } from '../../core/responsive';
|
|
4
4
|
import { resolveFocusRingStyles, resolveInteractiveState, } from '../../internal/resolvers';
|
|
5
5
|
import { useTheme } from '../../theme/ThemeContext';
|
|
6
|
-
import {
|
|
6
|
+
import { resolveViewStyles } from '../../utils/resolveViewStyles';
|
|
7
|
+
/*** Resolves one Pressable state into the canonical Surface interaction state. */
|
|
7
8
|
function getInteractionState(pressableState, hovered, focused, disabled) {
|
|
8
9
|
return resolveInteractiveState({
|
|
9
10
|
pressed: pressableState.pressed,
|
|
@@ -12,22 +13,22 @@ function getInteractionState(pressableState, hovered, focused, disabled) {
|
|
|
12
13
|
disabled,
|
|
13
14
|
});
|
|
14
15
|
}
|
|
16
|
+
/*** Renders the low-level token-aware Pressable boundary shared by Surface controls. */
|
|
15
17
|
export function ButtonBase({ children, disabled = false, interactionPolicy = 'enabled', onPress, onLongPress, accessibilityLabel, accessibilityRole = 'button', accessibilityState, style, testID, ...props }) {
|
|
16
18
|
const { theme } = useTheme();
|
|
17
19
|
const { breakpoint } = useResponsiveRuntime();
|
|
18
20
|
const [hovered, setHovered] = React.useState(false);
|
|
19
21
|
const [focused, setFocused] = React.useState(false);
|
|
20
22
|
const isWeb = Platform.OS === 'web';
|
|
21
|
-
const
|
|
23
|
+
const resolvedViewStyles = resolveViewStyles(theme, breakpoint, props);
|
|
22
24
|
const passive = interactionPolicy === 'passive';
|
|
23
25
|
return (<Pressable accessibilityLabel={accessibilityLabel} accessibilityRole={accessibilityRole} accessibilityState={{ ...accessibilityState, disabled }} disabled={disabled} onBlur={() => setFocused(false)} onFocus={() => {
|
|
24
|
-
if (isWeb)
|
|
26
|
+
if (isWeb)
|
|
25
27
|
setFocused(true);
|
|
26
|
-
}
|
|
27
28
|
}} onHoverIn={isWeb ? () => setHovered(true) : undefined} onHoverOut={isWeb ? () => setHovered(false) : undefined} onLongPress={passive ? undefined : onLongPress} onPress={passive ? undefined : onPress} style={(pressableState) => {
|
|
28
29
|
const state = getInteractionState(pressableState, hovered, focused, disabled);
|
|
29
30
|
return [
|
|
30
|
-
|
|
31
|
+
resolvedViewStyles,
|
|
31
32
|
resolveFocusRingStyles(theme.semantics.border.focus, state.focused, isWeb),
|
|
32
33
|
style,
|
|
33
34
|
];
|