@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
|
@@ -5,7 +5,7 @@ import type { SurfaceColor } from '../../../../surfaceColor';
|
|
|
5
5
|
import { useTheme } from '../../../../theme/ThemeContext';
|
|
6
6
|
import type { SurfaceTheme } from '../../../../theme/types';
|
|
7
7
|
import type { ToastProps } from '../../../../types/toast';
|
|
8
|
-
import {
|
|
8
|
+
import { View } from '../../../layout/public';
|
|
9
9
|
import { Surface } from '../../../surface/public';
|
|
10
10
|
import { Text } from '../../../typography/public';
|
|
11
11
|
|
|
@@ -29,15 +29,15 @@ export function Toast({
|
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
31
|
<Surface p="m" style={[styles.root, statusStyle]} testID={testID} variant="raised">
|
|
32
|
-
<
|
|
33
|
-
<
|
|
32
|
+
<View align="center" direction="row" justify="space-between">
|
|
33
|
+
<View flex={1}>
|
|
34
34
|
{title ? (
|
|
35
35
|
<Text variant="label" weight="medium">
|
|
36
36
|
{title}
|
|
37
37
|
</Text>
|
|
38
38
|
) : null}
|
|
39
39
|
{description ? <Text emphasis="muted">{description}</Text> : null}
|
|
40
|
-
</
|
|
40
|
+
</View>
|
|
41
41
|
{onDismiss ? (
|
|
42
42
|
<Pressable
|
|
43
43
|
accessibilityLabel="Dismiss notification"
|
|
@@ -48,7 +48,7 @@ export function Toast({
|
|
|
48
48
|
<Text color={statusTextColor}>×</Text>
|
|
49
49
|
</Pressable>
|
|
50
50
|
) : null}
|
|
51
|
-
</
|
|
51
|
+
</View>
|
|
52
52
|
</Surface>
|
|
53
53
|
);
|
|
54
54
|
}
|
|
@@ -4,7 +4,7 @@ import { StyleSheet, type ViewStyle } from 'react-native';
|
|
|
4
4
|
import { Portal } from '../../../../internal/overlay/Portal';
|
|
5
5
|
import { resolveOverlayAnimation } from '../../../../internal/resolvers';
|
|
6
6
|
import type { ToastProviderProps } from '../../../../types/toast';
|
|
7
|
-
import {
|
|
7
|
+
import { View } from '../../../layout/public';
|
|
8
8
|
import { ToastContext } from '../../composition/ToastContext';
|
|
9
9
|
import { useToastRuntime } from '../../composition/useToastRuntime';
|
|
10
10
|
import { Toast } from './Toast';
|
|
@@ -22,7 +22,7 @@ export function ToastProvider({ children, defaultDuration = 4000 }: ToastProvide
|
|
|
22
22
|
<ToastContext value={controller}>
|
|
23
23
|
{children}
|
|
24
24
|
<Portal layer="toast" visible={toasts.length > 0}>
|
|
25
|
-
<
|
|
25
|
+
<View gap="s" pointerEvents="box-none" style={[styles.container, animationStyle]}>
|
|
26
26
|
{toasts.map((toast) => (
|
|
27
27
|
<Toast
|
|
28
28
|
description={toast.description}
|
|
@@ -33,7 +33,7 @@ export function ToastProvider({ children, defaultDuration = 4000 }: ToastProvide
|
|
|
33
33
|
title={toast.title}
|
|
34
34
|
/>
|
|
35
35
|
))}
|
|
36
|
-
</
|
|
36
|
+
</View>
|
|
37
37
|
</Portal>
|
|
38
38
|
</ToastContext>
|
|
39
39
|
);
|
package/src/index.test.ts
CHANGED
|
@@ -6,7 +6,6 @@ import type { SelectionSemantics, SurfaceColorDiagnostics } from './index';
|
|
|
6
6
|
import { createTheme } from './theme/createTheme';
|
|
7
7
|
|
|
8
8
|
const indexSource = readFileSync(new URL('./index.ts', import.meta.url), 'utf8');
|
|
9
|
-
const layoutIndexSource = readFileSync(new URL('./layout/index.ts', import.meta.url), 'utf8');
|
|
10
9
|
const packageJson = JSON.parse(
|
|
11
10
|
readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
|
|
12
11
|
) as {
|
|
@@ -18,6 +17,7 @@ const packageJson = JSON.parse(
|
|
|
18
17
|
};
|
|
19
18
|
|
|
20
19
|
const expectedFeatureRootExports = [
|
|
20
|
+
"export { AppBar } from './features/app-bar/public';",
|
|
21
21
|
"export { Badge } from './features/badge/public';",
|
|
22
22
|
"export { Button, IconButton } from './features/button/public';",
|
|
23
23
|
"export { Card } from './features/card/public';",
|
|
@@ -27,7 +27,7 @@ const expectedFeatureRootExports = [
|
|
|
27
27
|
"export { Icon, SUPPORTED_ICON_PROVIDERS } from './features/icon/public';",
|
|
28
28
|
"export { Image } from './features/image/public';",
|
|
29
29
|
"export { KeyboardAvoidingView } from './features/keyboard-avoiding-view/public';",
|
|
30
|
-
"export {
|
|
30
|
+
"export { Divider, Grid, ScrollView, View } from './features/layout/public';",
|
|
31
31
|
"export { Modal } from './features/modal/public';",
|
|
32
32
|
"export { PopoverMenu } from './features/popover-menu/public';",
|
|
33
33
|
"export { Popover } from './features/popover/public';",
|
|
@@ -47,7 +47,6 @@ const expectedLegacyRootExports = [
|
|
|
47
47
|
"export { Textarea } from './components/textarea';",
|
|
48
48
|
"export type { InteractionPolicy, InteractionPolicyProps } from './interactionPolicy';",
|
|
49
49
|
"export * from './core/responsive';",
|
|
50
|
-
"export * from './layout';",
|
|
51
50
|
] as const;
|
|
52
51
|
|
|
53
52
|
describe('feature-owned root barrel contract', () => {
|
|
@@ -55,41 +54,16 @@ describe('feature-owned root barrel contract', () => {
|
|
|
55
54
|
expectedFeatureRootExports.forEach((line) => expect(indexSource).toContain(line));
|
|
56
55
|
});
|
|
57
56
|
|
|
58
|
-
it('does not retain
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
'./components/tabs',
|
|
69
|
-
'./components/text-input',
|
|
70
|
-
'./components/toast',
|
|
71
|
-
'./components/tooltip',
|
|
72
|
-
'./primitives/heading',
|
|
73
|
-
'./primitives/icon',
|
|
74
|
-
'./primitives/image',
|
|
75
|
-
'./primitives/text',
|
|
76
|
-
]) {
|
|
77
|
-
expect(indexSource).not.toContain(legacyPath);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('removes migrated elements from the legacy layout facade', () => {
|
|
82
|
-
for (const name of [
|
|
83
|
-
'Box',
|
|
84
|
-
'Container',
|
|
85
|
-
'Divider',
|
|
86
|
-
'Grid',
|
|
87
|
-
'KeyboardAvoidingView',
|
|
88
|
-
'Stack',
|
|
89
|
-
'Surface',
|
|
90
|
-
]) {
|
|
91
|
-
expect(layoutIndexSource).not.toContain(`./${name}`);
|
|
92
|
-
}
|
|
57
|
+
it('does not retain removed layout aliases or a legacy layout facade', () => {
|
|
58
|
+
expect(indexSource).not.toContain("'./layout");
|
|
59
|
+
expect(indexSource).not.toMatch(/\bBoxProps\b/u);
|
|
60
|
+
expect(indexSource).not.toMatch(/\bContainerProps\b/u);
|
|
61
|
+
expect(indexSource).not.toMatch(/\bStackProps\b/u);
|
|
62
|
+
expect(indexSource).not.toMatch(/\bScrollAreaProps\b/u);
|
|
63
|
+
expect(indexSource).not.toMatch(/export\s*\{[^}]*\bBox\b/u);
|
|
64
|
+
expect(indexSource).not.toMatch(/export\s*\{[^}]*\bContainer\b/u);
|
|
65
|
+
expect(indexSource).not.toMatch(/export\s*\{[^}]*\bStack\b/u);
|
|
66
|
+
expect(indexSource).not.toMatch(/export\s*\{[^}]*\bScrollArea\b/u);
|
|
93
67
|
});
|
|
94
68
|
});
|
|
95
69
|
|
package/src/index.ts
CHANGED
|
@@ -30,6 +30,8 @@ export {
|
|
|
30
30
|
AccordionItem,
|
|
31
31
|
AccordionTrigger,
|
|
32
32
|
} from './features/accordion/public';
|
|
33
|
+
export type { AppBarProps } from './features/app-bar/public';
|
|
34
|
+
export { AppBar } from './features/app-bar/public';
|
|
33
35
|
export type { BadgeProps } from './features/badge/public';
|
|
34
36
|
export { Badge } from './features/badge/public';
|
|
35
37
|
export type { ButtonIconSpec, ButtonProps, IconButtonProps } from './features/button/public';
|
|
@@ -58,14 +60,8 @@ export type {
|
|
|
58
60
|
KeyboardAvoidingViewProps,
|
|
59
61
|
} from './features/keyboard-avoiding-view/public';
|
|
60
62
|
export { KeyboardAvoidingView } from './features/keyboard-avoiding-view/public';
|
|
61
|
-
export type {
|
|
62
|
-
|
|
63
|
-
ContainerProps,
|
|
64
|
-
DividerProps,
|
|
65
|
-
GridProps,
|
|
66
|
-
StackProps,
|
|
67
|
-
} from './features/layout/public';
|
|
68
|
-
export { Box, Container, Divider, Grid, Stack } from './features/layout/public';
|
|
63
|
+
export type { DividerProps, GridProps, ScrollViewProps, ViewProps } from './features/layout/public';
|
|
64
|
+
export { Divider, Grid, ScrollView, View } from './features/layout/public';
|
|
69
65
|
export type { ModalProps } from './features/modal/public';
|
|
70
66
|
export { Modal } from './features/modal/public';
|
|
71
67
|
export type {
|
|
@@ -97,7 +93,6 @@ export { Tooltip } from './features/tooltip/public';
|
|
|
97
93
|
export type { HeadingLevel, HeadingProps, TextProps } from './features/typography/public';
|
|
98
94
|
export { Heading, Text } from './features/typography/public';
|
|
99
95
|
export type { InteractionPolicy, InteractionPolicyProps } from './interactionPolicy';
|
|
100
|
-
export * from './layout';
|
|
101
96
|
export type { ButtonBaseProps } from './primitives/button-base';
|
|
102
97
|
export { ButtonBase } from './primitives/button-base';
|
|
103
98
|
export type {
|
|
@@ -8,9 +8,10 @@ import {
|
|
|
8
8
|
resolveInteractiveState,
|
|
9
9
|
} from '../../internal/resolvers';
|
|
10
10
|
import { useTheme } from '../../theme/ThemeContext';
|
|
11
|
-
import {
|
|
11
|
+
import { resolveViewStyles } from '../../utils/resolveViewStyles';
|
|
12
12
|
import type { ButtonBaseProps } from './types';
|
|
13
13
|
|
|
14
|
+
/*** Resolves one Pressable state into the canonical Surface interaction state. */
|
|
14
15
|
function getInteractionState(
|
|
15
16
|
pressableState: PressableStateCallbackType,
|
|
16
17
|
hovered: boolean,
|
|
@@ -25,6 +26,7 @@ function getInteractionState(
|
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
28
|
|
|
29
|
+
/*** Renders the low-level token-aware Pressable boundary shared by Surface controls. */
|
|
28
30
|
export function ButtonBase({
|
|
29
31
|
children,
|
|
30
32
|
disabled = false,
|
|
@@ -43,7 +45,7 @@ export function ButtonBase({
|
|
|
43
45
|
const [hovered, setHovered] = React.useState(false);
|
|
44
46
|
const [focused, setFocused] = React.useState(false);
|
|
45
47
|
const isWeb = Platform.OS === 'web';
|
|
46
|
-
const
|
|
48
|
+
const resolvedViewStyles = resolveViewStyles(theme, breakpoint, props);
|
|
47
49
|
const passive = interactionPolicy === 'passive';
|
|
48
50
|
|
|
49
51
|
return (
|
|
@@ -54,9 +56,7 @@ export function ButtonBase({
|
|
|
54
56
|
disabled={disabled}
|
|
55
57
|
onBlur={() => setFocused(false)}
|
|
56
58
|
onFocus={() => {
|
|
57
|
-
if (isWeb)
|
|
58
|
-
setFocused(true);
|
|
59
|
-
}
|
|
59
|
+
if (isWeb) setFocused(true);
|
|
60
60
|
}}
|
|
61
61
|
onHoverIn={isWeb ? () => setHovered(true) : undefined}
|
|
62
62
|
onHoverOut={isWeb ? () => setHovered(false) : undefined}
|
|
@@ -64,9 +64,8 @@ export function ButtonBase({
|
|
|
64
64
|
onPress={passive ? undefined : onPress}
|
|
65
65
|
style={(pressableState) => {
|
|
66
66
|
const state = getInteractionState(pressableState, hovered, focused, disabled);
|
|
67
|
-
|
|
68
67
|
return [
|
|
69
|
-
|
|
68
|
+
resolvedViewStyles,
|
|
70
69
|
resolveFocusRingStyles(theme.semantics.border.focus, state.focused, isWeb),
|
|
71
70
|
style,
|
|
72
71
|
];
|
|
@@ -75,7 +74,6 @@ export function ButtonBase({
|
|
|
75
74
|
>
|
|
76
75
|
{(pressableState) => {
|
|
77
76
|
const state = getInteractionState(pressableState, hovered, focused, disabled);
|
|
78
|
-
|
|
79
77
|
return typeof children === 'function' ? children(state) : children;
|
|
80
78
|
}}
|
|
81
79
|
</Pressable>
|
|
@@ -3,10 +3,10 @@ import type { AccessibilityRole, AccessibilityState, GestureResponderEvent } fro
|
|
|
3
3
|
|
|
4
4
|
import type { InteractionPolicyProps } from '../../interactionPolicy';
|
|
5
5
|
import type { InteractionState } from '../../internal/resolvers/resolveInteractiveState';
|
|
6
|
-
import type {
|
|
6
|
+
import type { ViewProps } from '../../types/layout';
|
|
7
7
|
|
|
8
8
|
export interface ButtonBaseProps
|
|
9
|
-
extends Omit<
|
|
9
|
+
extends Omit<ViewProps, 'children' | 'pointerEvents'>, InteractionPolicyProps {
|
|
10
10
|
children?: React.ReactNode | ((state: InteractionState) => React.ReactNode);
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
onPress?: ((event: GestureResponderEvent) => void) | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import type { ViewProps } from './layout';
|
|
5
|
+
|
|
6
|
+
export interface AppBarProps extends Omit<ViewProps, 'children'> {
|
|
7
|
+
leading?: React.ReactNode;
|
|
8
|
+
trailing?: React.ReactNode;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
safeAreaTop?: boolean;
|
|
11
|
+
divider?: boolean;
|
|
12
|
+
contentStyle?: StyleProp<ViewStyle>;
|
|
13
|
+
}
|
package/src/types/layout.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
ScrollViewProps as ReactNativeScrollViewProps,
|
|
4
|
+
StyleProp,
|
|
5
|
+
ViewProps as ReactNativeViewProps,
|
|
6
|
+
ViewStyle,
|
|
7
|
+
} from 'react-native';
|
|
3
8
|
|
|
4
9
|
import type { Responsive } from '../core/responsive';
|
|
5
10
|
import type { SurfaceTheme } from '../theme/types';
|
|
@@ -12,7 +17,7 @@ type RadiusValue = number | RadiusToken;
|
|
|
12
17
|
export type SpaceValue = number | SpaceToken;
|
|
13
18
|
export type ColorValue = string | ColorToken;
|
|
14
19
|
|
|
15
|
-
export interface
|
|
20
|
+
export interface ViewStyleProps {
|
|
16
21
|
p?: Responsive<SpaceValue>;
|
|
17
22
|
px?: Responsive<SpaceValue>;
|
|
18
23
|
py?: Responsive<SpaceValue>;
|
|
@@ -27,6 +32,9 @@ export interface BoxStyleProps {
|
|
|
27
32
|
mb?: Responsive<SpaceValue>;
|
|
28
33
|
ml?: Responsive<SpaceValue>;
|
|
29
34
|
mr?: Responsive<SpaceValue>;
|
|
35
|
+
gap?: Responsive<SpaceValue>;
|
|
36
|
+
rowGap?: Responsive<SpaceValue>;
|
|
37
|
+
columnGap?: Responsive<SpaceValue>;
|
|
30
38
|
bg?: Responsive<ColorValue>;
|
|
31
39
|
radius?: Responsive<RadiusValue>;
|
|
32
40
|
borderWidth?: Responsive<number>;
|
|
@@ -41,6 +49,12 @@ export interface BoxStyleProps {
|
|
|
41
49
|
flexGrow?: Responsive<number>;
|
|
42
50
|
flexShrink?: Responsive<number>;
|
|
43
51
|
flexBasis?: Responsive<number | string>;
|
|
52
|
+
direction?: Responsive<'row' | 'column'>;
|
|
53
|
+
align?: Responsive<'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline'>;
|
|
54
|
+
justify?: Responsive<
|
|
55
|
+
'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly'
|
|
56
|
+
>;
|
|
57
|
+
wrap?: Responsive<'nowrap' | 'wrap'>;
|
|
44
58
|
alignSelf?: Responsive<ViewStyle['alignSelf']>;
|
|
45
59
|
position?: Responsive<ViewStyle['position']>;
|
|
46
60
|
top?: Responsive<number>;
|
|
@@ -53,7 +67,7 @@ export interface BoxStyleProps {
|
|
|
53
67
|
style?: StyleProp<ViewStyle>;
|
|
54
68
|
}
|
|
55
69
|
|
|
56
|
-
export interface
|
|
70
|
+
export interface ViewProps extends ViewStyleProps {
|
|
57
71
|
accessibilityLabel?: ReactNativeViewProps['accessibilityLabel'];
|
|
58
72
|
accessibilityRole?: ReactNativeViewProps['accessibilityRole'];
|
|
59
73
|
accessibilityState?: ReactNativeViewProps['accessibilityState'];
|
|
@@ -63,34 +77,25 @@ export interface BoxProps extends BoxStyleProps {
|
|
|
63
77
|
testID?: string;
|
|
64
78
|
}
|
|
65
79
|
|
|
66
|
-
export interface
|
|
67
|
-
children?: React.ReactNode;
|
|
68
|
-
maxWidth?: Responsive<number>;
|
|
69
|
-
px?: Responsive<number | keyof SurfaceTheme['spacing']>;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface DividerProps extends Omit<BoxProps, 'bg' | 'height' | 'width'> {
|
|
80
|
+
export interface DividerProps extends Omit<ViewProps, 'bg' | 'height' | 'width'> {
|
|
73
81
|
orientation?: 'horizontal' | 'vertical';
|
|
74
82
|
color?: ColorValue;
|
|
75
83
|
thickness?: number;
|
|
76
84
|
}
|
|
77
85
|
|
|
78
|
-
export interface GridProps extends Omit<
|
|
86
|
+
export interface GridProps extends Omit<ViewProps, 'children'> {
|
|
79
87
|
children?: React.ReactNode;
|
|
80
|
-
cols
|
|
88
|
+
cols?: Responsive<number>;
|
|
81
89
|
gap?: Responsive<SpaceValue>;
|
|
82
90
|
rowGap?: Responsive<SpaceValue>;
|
|
83
91
|
colGap?: Responsive<SpaceValue>;
|
|
84
92
|
minItemWidth?: Responsive<number>;
|
|
85
93
|
}
|
|
86
94
|
|
|
87
|
-
export interface
|
|
95
|
+
export interface ScrollViewProps
|
|
96
|
+
extends
|
|
97
|
+
ViewStyleProps,
|
|
98
|
+
Omit<ReactNativeScrollViewProps, 'children' | 'contentContainerStyle' | 'style'> {
|
|
88
99
|
children?: React.ReactNode;
|
|
89
|
-
|
|
90
|
-
gap?: Responsive<SpaceValue>;
|
|
91
|
-
align?: Responsive<'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline'>;
|
|
92
|
-
justify?: Responsive<
|
|
93
|
-
'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly'
|
|
94
|
-
>;
|
|
95
|
-
wrap?: Responsive<'nowrap' | 'wrap'>;
|
|
100
|
+
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
96
101
|
}
|
package/src/types/surface.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ViewProps } from './layout';
|
|
2
2
|
|
|
3
3
|
export type SurfaceVariant = 'default' | 'subtle' | 'raised' | 'outline';
|
|
4
4
|
|
|
5
|
-
export interface SurfaceProps extends Omit<
|
|
5
|
+
export interface SurfaceProps extends Omit<ViewProps, 'bg' | 'borderColor' | 'borderWidth'> {
|
|
6
6
|
variant?: SurfaceVariant;
|
|
7
7
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
import type { SurfaceTheme } from '../theme/types';
|
|
4
|
+
import { resolveViewStyles } from './resolveViewStyles';
|
|
5
|
+
|
|
6
|
+
const mockTheme = {
|
|
7
|
+
spacing: { s: 4, m: 8, l: 16 },
|
|
8
|
+
radii: { m: 8 },
|
|
9
|
+
colors: { primary: '#007AFF', surface: '#FFFFFF' },
|
|
10
|
+
} as unknown as SurfaceTheme;
|
|
11
|
+
|
|
12
|
+
describe('resolveViewStyles spacing and responsive layout', () => {
|
|
13
|
+
test('resolves padding and margins correctly', () => {
|
|
14
|
+
const styles = resolveViewStyles(mockTheme, 'base', { p: 's', m: 8 });
|
|
15
|
+
expect(styles.padding).toBe(4);
|
|
16
|
+
expect(styles.margin).toBe(8);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('resolves responsive properties', () => {
|
|
20
|
+
const props = { p: { base: 's', lg: 'l' }, direction: { base: 'column', lg: 'row' } } as const;
|
|
21
|
+
expect(resolveViewStyles(mockTheme, 'base', props).padding).toBe(4);
|
|
22
|
+
expect(resolveViewStyles(mockTheme, 'base', props).flexDirection).toBe('column');
|
|
23
|
+
expect(resolveViewStyles(mockTheme, 'lg', props).padding).toBe(16);
|
|
24
|
+
expect(resolveViewStyles(mockTheme, 'lg', props).flexDirection).toBe('row');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('resolves gap tokens with native flex layout props', () => {
|
|
28
|
+
const styles = resolveViewStyles(mockTheme, 'base', {
|
|
29
|
+
align: 'center',
|
|
30
|
+
gap: 'm',
|
|
31
|
+
justify: 'space-between',
|
|
32
|
+
wrap: 'wrap',
|
|
33
|
+
});
|
|
34
|
+
expect(styles.alignItems).toBe('center');
|
|
35
|
+
expect(styles.gap).toBe(8);
|
|
36
|
+
expect(styles.justifyContent).toBe('space-between');
|
|
37
|
+
expect(styles.flexWrap).toBe('wrap');
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
describe('resolveViewStyles visual and dimension styles', () => {
|
|
42
|
+
test('resolves colors and border styles', () => {
|
|
43
|
+
const styles = resolveViewStyles(mockTheme, 'base', {
|
|
44
|
+
bg: 'primary',
|
|
45
|
+
radius: 'm',
|
|
46
|
+
borderWidth: 1,
|
|
47
|
+
borderColor: 'surface',
|
|
48
|
+
});
|
|
49
|
+
expect(styles.backgroundColor).toBe('#007AFF');
|
|
50
|
+
expect(styles.borderRadius).toBe(8);
|
|
51
|
+
expect(styles.borderWidth).toBe(1);
|
|
52
|
+
expect(styles.borderColor).toBe('#FFFFFF');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('resolves spacing tokens for dimension props and preserves raw strings', () => {
|
|
56
|
+
const styles = resolveViewStyles(mockTheme, 'base', {
|
|
57
|
+
width: 'm',
|
|
58
|
+
minHeight: 'l',
|
|
59
|
+
maxWidth: '50%',
|
|
60
|
+
});
|
|
61
|
+
expect(styles.width).toBe(8);
|
|
62
|
+
expect(styles.minHeight).toBe(16);
|
|
63
|
+
expect(styles.maxWidth).toBe('50%');
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test('handles undefined props gracefully', () => {
|
|
67
|
+
const styles = resolveViewStyles(mockTheme, 'base', {});
|
|
68
|
+
expect(styles.padding).toBeUndefined();
|
|
69
|
+
expect(styles.margin).toBeUndefined();
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -4,14 +4,14 @@ import { resolveResponsive } from '../core/responsive/resolve';
|
|
|
4
4
|
import type { Breakpoint } from '../core/responsive/types';
|
|
5
5
|
import { resolveToken } from '../theme/resolveToken';
|
|
6
6
|
import type { SurfaceTheme } from '../theme/types';
|
|
7
|
-
import type {
|
|
7
|
+
import type { ColorValue, ViewStyleProps } from '../types/layout';
|
|
8
8
|
import { resolveSpacing } from './resolveSpacing';
|
|
9
9
|
|
|
10
|
-
/*** Resolves responsive
|
|
11
|
-
export function
|
|
10
|
+
/*** Resolves responsive Surface View style props into one React Native view style. */
|
|
11
|
+
export function resolveViewStyles(
|
|
12
12
|
theme: SurfaceTheme,
|
|
13
13
|
breakpoint: Breakpoint,
|
|
14
|
-
props:
|
|
14
|
+
props: ViewStyleProps,
|
|
15
15
|
): ViewStyle {
|
|
16
16
|
return {
|
|
17
17
|
elevation: 0,
|
|
@@ -22,11 +22,11 @@ export function resolveBoxStyles(
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
/*** Resolves padding and
|
|
25
|
+
/*** Resolves padding, margin, and gap styles from responsive spacing props. */
|
|
26
26
|
function resolveSpacingStyles(
|
|
27
27
|
theme: SurfaceTheme,
|
|
28
28
|
breakpoint: Breakpoint,
|
|
29
|
-
props:
|
|
29
|
+
props: ViewStyleProps,
|
|
30
30
|
): ViewStyle {
|
|
31
31
|
return {
|
|
32
32
|
padding: resolveSpacing(theme, resolveResponsive(props.p, breakpoint)),
|
|
@@ -43,6 +43,9 @@ function resolveSpacingStyles(
|
|
|
43
43
|
marginBottom: resolveSpacing(theme, resolveResponsive(props.mb, breakpoint)),
|
|
44
44
|
marginLeft: resolveSpacing(theme, resolveResponsive(props.ml, breakpoint)),
|
|
45
45
|
marginRight: resolveSpacing(theme, resolveResponsive(props.mr, breakpoint)),
|
|
46
|
+
gap: resolveSpacing(theme, resolveResponsive(props.gap, breakpoint)),
|
|
47
|
+
rowGap: resolveSpacing(theme, resolveResponsive(props.rowGap, breakpoint)),
|
|
48
|
+
columnGap: resolveSpacing(theme, resolveResponsive(props.columnGap, breakpoint)),
|
|
46
49
|
};
|
|
47
50
|
}
|
|
48
51
|
|
|
@@ -50,7 +53,7 @@ function resolveSpacingStyles(
|
|
|
50
53
|
function resolveVisualStyles(
|
|
51
54
|
theme: SurfaceTheme,
|
|
52
55
|
breakpoint: Breakpoint,
|
|
53
|
-
props:
|
|
56
|
+
props: ViewStyleProps,
|
|
54
57
|
): ViewStyle {
|
|
55
58
|
return {
|
|
56
59
|
backgroundColor: resolveColor(theme, resolveResponsive(props.bg, breakpoint)),
|
|
@@ -64,7 +67,7 @@ function resolveVisualStyles(
|
|
|
64
67
|
function resolveDimensionStyles(
|
|
65
68
|
theme: SurfaceTheme,
|
|
66
69
|
breakpoint: Breakpoint,
|
|
67
|
-
props:
|
|
70
|
+
props: ViewStyleProps,
|
|
68
71
|
): ViewStyle {
|
|
69
72
|
return {
|
|
70
73
|
width: resolveDimension(
|
|
@@ -95,12 +98,16 @@ function resolveDimensionStyles(
|
|
|
95
98
|
}
|
|
96
99
|
|
|
97
100
|
/*** Resolves responsive flex, positioning, and visibility styles. */
|
|
98
|
-
function resolveLayoutStyles(breakpoint: Breakpoint, props:
|
|
101
|
+
function resolveLayoutStyles(breakpoint: Breakpoint, props: ViewStyleProps): ViewStyle {
|
|
99
102
|
return {
|
|
100
103
|
flex: resolveResponsive(props.flex, breakpoint),
|
|
101
104
|
flexGrow: resolveResponsive(props.flexGrow, breakpoint),
|
|
102
105
|
flexShrink: resolveResponsive(props.flexShrink, breakpoint),
|
|
103
106
|
flexBasis: resolveResponsive(props.flexBasis, breakpoint) as ViewStyle['flexBasis'],
|
|
107
|
+
flexDirection: resolveResponsive(props.direction, breakpoint),
|
|
108
|
+
alignItems: resolveResponsive(props.align, breakpoint),
|
|
109
|
+
justifyContent: resolveResponsive(props.justify, breakpoint),
|
|
110
|
+
flexWrap: resolveResponsive(props.wrap, breakpoint),
|
|
104
111
|
alignSelf: resolveResponsive(props.alignSelf, breakpoint),
|
|
105
112
|
position: resolveResponsive(props.position, breakpoint),
|
|
106
113
|
top: resolveResponsive(props.top, breakpoint),
|
|
@@ -8,18 +8,17 @@ await mock.module('react-native', () => ReactNativeWeb);
|
|
|
8
8
|
|
|
9
9
|
const scrollContentStyle = { padding: 4 };
|
|
10
10
|
|
|
11
|
-
const {
|
|
11
|
+
const { Grid, ScrollView, View } = await import('./features/layout/public');
|
|
12
12
|
const { KeyboardAvoidingView } = await import('./features/keyboard-avoiding-view/public');
|
|
13
|
-
const {
|
|
14
|
-
const { Show } = await import('./layout/Show');
|
|
13
|
+
const { Show } = await import('./core/responsive/Show');
|
|
15
14
|
const { OverlayProvider } = await import('./internal/overlay/OverlayProvider');
|
|
16
15
|
const { ThemeProvider } = await import('./theme/ThemeContext');
|
|
17
16
|
|
|
18
17
|
function ResponsiveAcceptanceTree() {
|
|
19
18
|
return (
|
|
20
19
|
<ThemeProvider>
|
|
21
|
-
<
|
|
22
|
-
<
|
|
20
|
+
<View maxWidth={{ base: 640, md: 960 }} px={{ base: 12, md: 24 }} testID="container">
|
|
21
|
+
<ScrollView contentContainerStyle={scrollContentStyle} testID="scroll-view">
|
|
23
22
|
<Grid cols={{ base: 1, md: 2 }} gap={{ base: 8, md: 16 }} testID="grid">
|
|
24
23
|
<ReactNativeWeb.View testID="grid-first" />
|
|
25
24
|
<ReactNativeWeb.View testID="grid-second" />
|
|
@@ -30,8 +29,8 @@ function ResponsiveAcceptanceTree() {
|
|
|
30
29
|
>
|
|
31
30
|
<ReactNativeWeb.Text>wide-content</ReactNativeWeb.Text>
|
|
32
31
|
</Show>
|
|
33
|
-
</
|
|
34
|
-
</
|
|
32
|
+
</ScrollView>
|
|
33
|
+
</View>
|
|
35
34
|
</ThemeProvider>
|
|
36
35
|
);
|
|
37
36
|
}
|
|
@@ -40,7 +39,7 @@ test('RN Web 0.21 statically renders and hydrates representative responsive prim
|
|
|
40
39
|
const markup = renderToString(<ResponsiveAcceptanceTree />);
|
|
41
40
|
|
|
42
41
|
expect(markup).toContain('data-testid="container"');
|
|
43
|
-
expect(markup).toContain('data-testid="scroll-
|
|
42
|
+
expect(markup).toContain('data-testid="scroll-view"');
|
|
44
43
|
expect(markup).toContain('data-testid="grid"');
|
|
45
44
|
expect(markup).toContain('static-fallback');
|
|
46
45
|
expect(markup).not.toContain('wide-content');
|
|
@@ -68,7 +67,7 @@ test('RN Web 0.21 statically renders and hydrates representative responsive prim
|
|
|
68
67
|
await act(async () => Promise.resolve());
|
|
69
68
|
|
|
70
69
|
expect(container.querySelector('[data-testid="container"]')).not.toBeNull();
|
|
71
|
-
expect(container.querySelector('[data-testid="scroll-
|
|
70
|
+
expect(container.querySelector('[data-testid="scroll-view"]')).not.toBeNull();
|
|
72
71
|
expect(container.querySelectorAll('[data-testid^="grid-"]')).toHaveLength(2);
|
|
73
72
|
expect(hydrationErrors).toEqual([]);
|
|
74
73
|
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { BoxProps } from '../../../../types/layout';
|
|
3
|
-
/*** Renders the responsive foundational layout box. */
|
|
4
|
-
export declare function Box({ accessible, accessibilityLabel, accessibilityRole, accessibilityState, children, pointerEvents, style, testID, ...props }: BoxProps): React.JSX.Element;
|
|
5
|
-
//# sourceMappingURL=Box.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../../../src/features/layout/adapters/inbound/Box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD,uDAAuD;AACvD,wBAAgB,GAAG,CAAC,EAClB,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,QAAQ,EACR,aAAa,EACb,KAAK,EACL,MAAM,EACN,GAAG,KAAK,EACT,EAAE,QAAQ,qBAmBV"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
import { useResponsiveRuntime } from '../../../../core/responsive';
|
|
4
|
-
import { resolvePointerEvents } from '../../../../internal/resolvePointerEvents';
|
|
5
|
-
import { useTheme } from '../../../../theme/ThemeContext';
|
|
6
|
-
import { resolveBoxStyles } from '../../../../utils/resolveBoxStyles';
|
|
7
|
-
/*** Renders the responsive foundational layout box. */
|
|
8
|
-
export function Box({ accessible, accessibilityLabel, accessibilityRole, accessibilityState, children, pointerEvents, style, testID, ...props }) {
|
|
9
|
-
const { theme } = useTheme();
|
|
10
|
-
const { breakpoint } = useResponsiveRuntime();
|
|
11
|
-
const resolved = resolveBoxStyles(theme, breakpoint, props);
|
|
12
|
-
const resolvedPointerEvents = pointerEvents ? resolvePointerEvents(pointerEvents) : null;
|
|
13
|
-
return (<View {...resolvedPointerEvents?.props} accessible={accessible} accessibilityLabel={accessibilityLabel} accessibilityRole={accessibilityRole} accessibilityState={accessibilityState} testID={testID} style={[resolved, resolvedPointerEvents?.style, style]}>
|
|
14
|
-
{children}
|
|
15
|
-
</View>);
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=Box.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Box.js","sourceRoot":"","sources":["../../../../../src/features/layout/adapters/inbound/Box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEtE,uDAAuD;AACvD,MAAM,UAAU,GAAG,CAAC,EAClB,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,QAAQ,EACR,aAAa,EACb,KAAK,EACL,MAAM,EACN,GAAG,KAAK,EACC;IACT,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,EAAE,UAAU,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC9C,MAAM,QAAQ,GAAG,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IAC5D,MAAM,qBAAqB,GAAG,aAAa,CAAC,CAAC,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAEzF,OAAO,CACL,CAAC,IAAI,CACH,IAAI,qBAAqB,EAAE,KAAK,CAAC,CACjC,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,kBAAkB,CAAC,CAAC,kBAAkB,CAAC,CACvC,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,kBAAkB,CAAC,CAAC,kBAAkB,CAAC,CACvC,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,qBAAqB,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAEvD;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\n\nimport { useResponsiveRuntime } from '../../../../core/responsive';\nimport { resolvePointerEvents } from '../../../../internal/resolvePointerEvents';\nimport { useTheme } from '../../../../theme/ThemeContext';\nimport type { BoxProps } from '../../../../types/layout';\nimport { resolveBoxStyles } from '../../../../utils/resolveBoxStyles';\n\n/*** Renders the responsive foundational layout box. */\nexport function Box({\n accessible,\n accessibilityLabel,\n accessibilityRole,\n accessibilityState,\n children,\n pointerEvents,\n style,\n testID,\n ...props\n}: BoxProps) {\n const { theme } = useTheme();\n const { breakpoint } = useResponsiveRuntime();\n const resolved = resolveBoxStyles(theme, breakpoint, props);\n const resolvedPointerEvents = pointerEvents ? resolvePointerEvents(pointerEvents) : null;\n\n return (\n <View\n {...resolvedPointerEvents?.props}\n accessible={accessible}\n accessibilityLabel={accessibilityLabel}\n accessibilityRole={accessibilityRole}\n accessibilityState={accessibilityState}\n testID={testID}\n style={[resolved, resolvedPointerEvents?.style, style]}\n >\n {children}\n </View>\n );\n}\n"]}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ContainerProps } from '../../../../types/layout';
|
|
3
|
-
/*** Centers responsive content inside a configurable maximum width. */
|
|
4
|
-
export declare function Container({ children, maxWidth, px, ...props }: ContainerProps): React.JSX.Element;
|
|
5
|
-
//# sourceMappingURL=Container.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../../../src/features/layout/adapters/inbound/Container.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI/D,uEAAuE;AACvE,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,QAAsD,EACtD,EAAiC,EACjC,GAAG,KAAK,EACT,EAAE,cAAc,qBAWhB"}
|