@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.
Files changed (195) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -2
  3. package/dist/components/field/Field.d.ts +1 -0
  4. package/dist/components/field/Field.d.ts.map +1 -1
  5. package/dist/components/field/Field.js +5 -4
  6. package/dist/components/field/Field.js.map +1 -1
  7. package/dist/components/list-item/ListItem.d.ts +1 -0
  8. package/dist/components/list-item/ListItem.d.ts.map +1 -1
  9. package/dist/components/list-item/ListItem.js +13 -12
  10. package/dist/components/list-item/ListItem.js.map +1 -1
  11. package/dist/components/switch/Switch.d.ts +1 -0
  12. package/dist/components/switch/Switch.d.ts.map +1 -1
  13. package/dist/components/switch/Switch.js +10 -13
  14. package/dist/components/switch/Switch.js.map +1 -1
  15. package/dist/{layout → core/responsive}/Show.d.ts +2 -1
  16. package/dist/core/responsive/Show.d.ts.map +1 -0
  17. package/dist/{layout → core/responsive}/Show.js +3 -1
  18. package/dist/core/responsive/Show.js.map +1 -0
  19. package/dist/core/responsive/index.d.ts +1 -0
  20. package/dist/core/responsive/index.d.ts.map +1 -1
  21. package/dist/core/responsive/index.js +1 -0
  22. package/dist/core/responsive/index.js.map +1 -1
  23. package/dist/features/app-bar/adapters/inbound/AppBar.d.ts +5 -0
  24. package/dist/features/app-bar/adapters/inbound/AppBar.d.ts.map +1 -0
  25. package/dist/features/app-bar/adapters/inbound/AppBar.js +40 -0
  26. package/dist/features/app-bar/adapters/inbound/AppBar.js.map +1 -0
  27. package/dist/features/app-bar/public.d.ts +3 -0
  28. package/dist/features/app-bar/public.d.ts.map +1 -0
  29. package/dist/features/app-bar/public.js +2 -0
  30. package/dist/features/app-bar/public.js.map +1 -0
  31. package/dist/features/badge/adapters/inbound/Badge.js +3 -3
  32. package/dist/features/badge/adapters/inbound/Badge.js.map +1 -1
  33. package/dist/features/button/adapters/inbound/Button.js +8 -8
  34. package/dist/features/button/adapters/inbound/Button.js.map +1 -1
  35. package/dist/features/button/adapters/inbound/IconButton.js +3 -3
  36. package/dist/features/button/adapters/inbound/IconButton.js.map +1 -1
  37. package/dist/features/form/checkbox/adapters/inbound/Checkbox.js +7 -7
  38. package/dist/features/form/checkbox/adapters/inbound/Checkbox.js.map +1 -1
  39. package/dist/features/form/radio/adapters/inbound/Radio.js +8 -8
  40. package/dist/features/form/radio/adapters/inbound/Radio.js.map +1 -1
  41. package/dist/features/layout/adapters/inbound/Divider.js +2 -2
  42. package/dist/features/layout/adapters/inbound/Divider.js.map +1 -1
  43. package/dist/features/layout/adapters/inbound/Grid.d.ts.map +1 -1
  44. package/dist/features/layout/adapters/inbound/Grid.js +7 -9
  45. package/dist/features/layout/adapters/inbound/Grid.js.map +1 -1
  46. package/dist/features/layout/adapters/inbound/ScrollView.d.ts +5 -0
  47. package/dist/features/layout/adapters/inbound/ScrollView.d.ts.map +1 -0
  48. package/dist/features/layout/adapters/inbound/ScrollView.js +69 -0
  49. package/dist/features/layout/adapters/inbound/ScrollView.js.map +1 -0
  50. package/dist/features/layout/adapters/inbound/View.d.ts +5 -0
  51. package/dist/features/layout/adapters/inbound/View.d.ts.map +1 -0
  52. package/dist/features/layout/adapters/inbound/View.js +17 -0
  53. package/dist/features/layout/adapters/inbound/View.js.map +1 -0
  54. package/dist/features/layout/public.d.ts +3 -4
  55. package/dist/features/layout/public.d.ts.map +1 -1
  56. package/dist/features/layout/public.js +2 -3
  57. package/dist/features/layout/public.js.map +1 -1
  58. package/dist/features/modal/adapters/inbound/Modal.d.ts.map +1 -1
  59. package/dist/features/modal/adapters/inbound/Modal.js +8 -8
  60. package/dist/features/modal/adapters/inbound/Modal.js.map +1 -1
  61. package/dist/features/popover-menu/adapters/inbound/PopoverMenu.d.ts.map +1 -1
  62. package/dist/features/popover-menu/adapters/inbound/PopoverMenu.js +11 -12
  63. package/dist/features/popover-menu/adapters/inbound/PopoverMenu.js.map +1 -1
  64. package/dist/features/surface/adapters/inbound/Surface.d.ts +1 -1
  65. package/dist/features/surface/adapters/inbound/Surface.d.ts.map +1 -1
  66. package/dist/features/surface/adapters/inbound/Surface.js +3 -3
  67. package/dist/features/surface/adapters/inbound/Surface.js.map +1 -1
  68. package/dist/features/tabs/adapters/inbound/Tab.js +3 -3
  69. package/dist/features/tabs/adapters/inbound/Tab.js.map +1 -1
  70. package/dist/features/tabs/adapters/inbound/TabList.d.ts.map +1 -1
  71. package/dist/features/tabs/adapters/inbound/TabList.js +3 -5
  72. package/dist/features/tabs/adapters/inbound/TabList.js.map +1 -1
  73. package/dist/features/tabs/adapters/inbound/Tabs.js +2 -2
  74. package/dist/features/tabs/adapters/inbound/Tabs.js.map +1 -1
  75. package/dist/features/toast/adapters/inbound/Toast.js +5 -5
  76. package/dist/features/toast/adapters/inbound/Toast.js.map +1 -1
  77. package/dist/features/toast/adapters/inbound/ToastProvider.js +3 -3
  78. package/dist/features/toast/adapters/inbound/ToastProvider.js.map +1 -1
  79. package/dist/index.d.ts +4 -3
  80. package/dist/index.d.ts.map +1 -1
  81. package/dist/index.js +2 -2
  82. package/dist/index.js.map +1 -1
  83. package/dist/primitives/button-base/ButtonBase.d.ts +1 -0
  84. package/dist/primitives/button-base/ButtonBase.d.ts.map +1 -1
  85. package/dist/primitives/button-base/ButtonBase.js +6 -5
  86. package/dist/primitives/button-base/ButtonBase.js.map +1 -1
  87. package/dist/primitives/button-base/types.d.ts +2 -2
  88. package/dist/primitives/button-base/types.d.ts.map +1 -1
  89. package/dist/primitives/button-base/types.js.map +1 -1
  90. package/dist/types/app-bar.d.ts +12 -0
  91. package/dist/types/app-bar.d.ts.map +1 -0
  92. package/dist/types/app-bar.js +2 -0
  93. package/dist/types/app-bar.js.map +1 -0
  94. package/dist/types/layout.d.ts +15 -17
  95. package/dist/types/layout.d.ts.map +1 -1
  96. package/dist/types/layout.js.map +1 -1
  97. package/dist/types/surface.d.ts +2 -2
  98. package/dist/types/surface.d.ts.map +1 -1
  99. package/dist/types/surface.js.map +1 -1
  100. package/dist/utils/resolveViewStyles.d.ts +7 -0
  101. package/dist/utils/resolveViewStyles.d.ts.map +1 -0
  102. package/dist/utils/{resolveBoxStyles.js → resolveViewStyles.js} +11 -4
  103. package/dist/utils/resolveViewStyles.js.map +1 -0
  104. package/package.json +1 -1
  105. package/src/components/field/Field.tsx +5 -4
  106. package/src/components/list-item/ListItem.tsx +17 -13
  107. package/src/components/switch/Switch.tsx +10 -15
  108. package/src/{layout → core/responsive}/Show.tsx +4 -1
  109. package/src/core/responsive/index.ts +1 -0
  110. package/src/features/app-bar/adapters/inbound/AppBar.tsx +69 -0
  111. package/src/features/app-bar/public.ts +2 -0
  112. package/src/features/badge/adapters/inbound/Badge.tsx +3 -3
  113. package/src/features/button/adapters/inbound/Button.tsx +8 -8
  114. package/src/features/button/adapters/inbound/IconButton.tsx +3 -3
  115. package/src/features/form/checkbox/adapters/inbound/Checkbox.tsx +7 -7
  116. package/src/features/form/radio/adapters/inbound/Radio.tsx +8 -8
  117. package/src/features/layout/adapters/inbound/Divider.tsx +2 -2
  118. package/src/features/layout/adapters/inbound/Grid.tsx +12 -14
  119. package/src/features/layout/adapters/inbound/ScrollView.tsx +102 -0
  120. package/src/features/layout/adapters/inbound/{Box.tsx → View.tsx} +9 -9
  121. package/src/features/layout/public.ts +3 -10
  122. package/src/features/modal/adapters/inbound/Modal.tsx +11 -8
  123. package/src/features/popover-menu/adapters/inbound/PopoverMenu.tsx +11 -14
  124. package/src/features/surface/adapters/inbound/Surface.tsx +3 -3
  125. package/src/features/tabs/adapters/inbound/Tab.tsx +3 -3
  126. package/src/features/tabs/adapters/inbound/TabList.tsx +3 -6
  127. package/src/features/tabs/adapters/inbound/Tabs.tsx +2 -2
  128. package/src/features/toast/adapters/inbound/Toast.tsx +5 -5
  129. package/src/features/toast/adapters/inbound/ToastProvider.tsx +3 -3
  130. package/src/index.test.ts +12 -38
  131. package/src/index.ts +4 -9
  132. package/src/primitives/button-base/ButtonBase.tsx +6 -8
  133. package/src/primitives/button-base/types.ts +2 -2
  134. package/src/types/app-bar.ts +13 -0
  135. package/src/types/layout.ts +25 -20
  136. package/src/types/surface.ts +2 -2
  137. package/src/utils/resolveViewStyles.test.ts +71 -0
  138. package/src/utils/{resolveBoxStyles.ts → resolveViewStyles.ts} +16 -9
  139. package/src/webAcceptance.test.tsx +8 -9
  140. package/dist/features/layout/adapters/inbound/Box.d.ts +0 -5
  141. package/dist/features/layout/adapters/inbound/Box.d.ts.map +0 -1
  142. package/dist/features/layout/adapters/inbound/Box.js +0 -17
  143. package/dist/features/layout/adapters/inbound/Box.js.map +0 -1
  144. package/dist/features/layout/adapters/inbound/Container.d.ts +0 -5
  145. package/dist/features/layout/adapters/inbound/Container.d.ts.map +0 -1
  146. package/dist/features/layout/adapters/inbound/Container.js +0 -28
  147. package/dist/features/layout/adapters/inbound/Container.js.map +0 -1
  148. package/dist/features/layout/adapters/inbound/Stack.d.ts +0 -5
  149. package/dist/features/layout/adapters/inbound/Stack.d.ts.map +0 -1
  150. package/dist/features/layout/adapters/inbound/Stack.js +0 -27
  151. package/dist/features/layout/adapters/inbound/Stack.js.map +0 -1
  152. package/dist/layout/AppBar.d.ts +0 -13
  153. package/dist/layout/AppBar.d.ts.map +0 -1
  154. package/dist/layout/AppBar.js +0 -30
  155. package/dist/layout/AppBar.js.map +0 -1
  156. package/dist/layout/Center.d.ts +0 -7
  157. package/dist/layout/Center.d.ts.map +0 -1
  158. package/dist/layout/Center.js +0 -12
  159. package/dist/layout/Center.js.map +0 -1
  160. package/dist/layout/Inline.d.ts +0 -5
  161. package/dist/layout/Inline.d.ts.map +0 -1
  162. package/dist/layout/Inline.js +0 -6
  163. package/dist/layout/Inline.js.map +0 -1
  164. package/dist/layout/ScrollArea.d.ts +0 -9
  165. package/dist/layout/ScrollArea.d.ts.map +0 -1
  166. package/dist/layout/ScrollArea.js +0 -52
  167. package/dist/layout/ScrollArea.js.map +0 -1
  168. package/dist/layout/Show.d.ts.map +0 -1
  169. package/dist/layout/Show.js.map +0 -1
  170. package/dist/layout/Spacer.d.ts +0 -9
  171. package/dist/layout/Spacer.d.ts.map +0 -1
  172. package/dist/layout/Spacer.js +0 -12
  173. package/dist/layout/Spacer.js.map +0 -1
  174. package/dist/layout/Template.d.ts +0 -18
  175. package/dist/layout/Template.d.ts.map +0 -1
  176. package/dist/layout/Template.js +0 -36
  177. package/dist/layout/Template.js.map +0 -1
  178. package/dist/layout/index.d.ts +0 -15
  179. package/dist/layout/index.d.ts.map +0 -1
  180. package/dist/layout/index.js +0 -8
  181. package/dist/layout/index.js.map +0 -1
  182. package/dist/utils/resolveBoxStyles.d.ts +0 -7
  183. package/dist/utils/resolveBoxStyles.d.ts.map +0 -1
  184. package/dist/utils/resolveBoxStyles.js.map +0 -1
  185. package/src/features/layout/adapters/inbound/Container.tsx +0 -43
  186. package/src/features/layout/adapters/inbound/Stack.test.ts +0 -13
  187. package/src/features/layout/adapters/inbound/Stack.tsx +0 -44
  188. package/src/layout/AppBar.tsx +0 -60
  189. package/src/layout/Center.tsx +0 -22
  190. package/src/layout/Inline.tsx +0 -9
  191. package/src/layout/ScrollArea.tsx +0 -116
  192. package/src/layout/Spacer.tsx +0 -22
  193. package/src/layout/Template.tsx +0 -86
  194. package/src/layout/index.ts +0 -14
  195. package/src/utils/resolveBoxStyles.test.ts +0 -54
@@ -4,7 +4,7 @@ import type { ViewStyle } from 'react-native';
4
4
  import { resolveButtonColors, resolveControlSize } from '../../../../internal/resolvers';
5
5
  import { useTheme } from '../../../../theme/ThemeContext';
6
6
  import type { BadgeProps } from '../../../../types/badge';
7
- import { Box } from '../../../layout/public';
7
+ import { View } from '../../../layout/public';
8
8
  import { Text } from '../../../typography/public';
9
9
 
10
10
  /*** Renders compact semantic status or metadata content. */
@@ -24,7 +24,7 @@ export function Badge({
24
24
  });
25
25
 
26
26
  return (
27
- <Box
27
+ <View
28
28
  px={Math.max(theme.spacing.xs, controlSize.paddingHorizontal - 4)}
29
29
  py={Math.max(4, controlSize.paddingVertical - 2)}
30
30
  radius={controlSize.borderRadius}
@@ -39,7 +39,7 @@ export function Badge({
39
39
  >
40
40
  {content}
41
41
  </Text>
42
- </Box>
42
+ </View>
43
43
  );
44
44
  }
45
45
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ActivityIndicator, View, type ViewStyle } from 'react-native';
2
+ import { ActivityIndicator, View as ReactNativeView, type ViewStyle } from 'react-native';
3
3
 
4
4
  import {
5
5
  type InteractionState,
@@ -12,7 +12,7 @@ import { useTheme } from '../../../../theme/ThemeContext';
12
12
  import type { SurfaceTheme } from '../../../../theme/types';
13
13
  import type { ButtonProps } from '../../../../types/button';
14
14
  import { Icon } from '../../../icon/public';
15
- import { Box } from '../../../layout/public';
15
+ import { View } from '../../../layout/public';
16
16
  import { Text } from '../../../typography/public';
17
17
 
18
18
  /*** Renders the primary Surface action control with semantic visual states. */
@@ -80,7 +80,7 @@ function ButtonContent({
80
80
  const iconSize = resolveIconSize(theme, size);
81
81
 
82
82
  return (
83
- <Box
83
+ <View
84
84
  px={controlSize.paddingHorizontal}
85
85
  py={controlSize.paddingVertical}
86
86
  radius={controlSize.borderRadius}
@@ -91,9 +91,9 @@ function ButtonContent({
91
91
  ) : (
92
92
  <>
93
93
  {leadingIcon ? (
94
- <View style={resolveAccessoryStyle(theme.spacing.s, 'leading')}>
94
+ <ReactNativeView style={resolveAccessoryStyle(theme.spacing.s, 'leading')}>
95
95
  <Icon {...leadingIcon} color={colors.contentColor} size={iconSize} />
96
- </View>
96
+ </ReactNativeView>
97
97
  ) : null}
98
98
  <Text
99
99
  color={muted ? undefined : color}
@@ -104,13 +104,13 @@ function ButtonContent({
104
104
  {children}
105
105
  </Text>
106
106
  {trailingIcon ? (
107
- <View style={resolveAccessoryStyle(theme.spacing.s, 'trailing')}>
107
+ <ReactNativeView style={resolveAccessoryStyle(theme.spacing.s, 'trailing')}>
108
108
  <Icon {...trailingIcon} color={colors.contentColor} size={iconSize} />
109
- </View>
109
+ </ReactNativeView>
110
110
  ) : null}
111
111
  </>
112
112
  )}
113
- </Box>
113
+ </View>
114
114
  );
115
115
  }
116
116
 
@@ -10,7 +10,7 @@ import { ButtonBase } from '../../../../primitives/button-base';
10
10
  import { useTheme } from '../../../../theme/ThemeContext';
11
11
  import type { IconButtonProps } from '../../../../types/button';
12
12
  import { Icon } from '../../../icon/public';
13
- import { Box } from '../../../layout/public';
13
+ import { View } from '../../../layout/public';
14
14
 
15
15
  /*** Renders a compact accessible icon-only action control. */
16
16
  export function IconButton({
@@ -38,12 +38,12 @@ export function IconButton({
38
38
  {(state) => {
39
39
  const colors = resolveButtonColors(theme, { color, state, variant });
40
40
  return (
41
- <Box
41
+ <View
42
42
  radius={controlSize.borderRadius}
43
43
  style={resolveIconButtonStyle(controlSize, colors, variant)}
44
44
  >
45
45
  <Icon {...icon} color={colors.contentColor} size={resolveIconSize(theme, size)} />
46
- </Box>
46
+ </View>
47
47
  );
48
48
  }}
49
49
  </ButtonBase>
@@ -14,7 +14,7 @@ import type { ButtonBaseProps } from '../../../../../primitives/button-base/type
14
14
  import { useTheme } from '../../../../../theme/ThemeContext';
15
15
  import type { SurfaceTheme } from '../../../../../theme/types';
16
16
  import type { CheckboxProps } from '../../../../../types/checkbox';
17
- import { Box } from '../../../../layout/public';
17
+ import { View } from '../../../../layout/public';
18
18
  import { Text } from '../../../../typography/public';
19
19
 
20
20
  /*** Renders a controlled or uncontrolled accessible checkbox. */
@@ -128,8 +128,8 @@ function renderCheckboxContent(input: CheckboxContentInput) {
128
128
  const indicatorColor = fieldState.invalid ? 'error' : input.color;
129
129
 
130
130
  return (
131
- <Box style={resolveSelectionRowStyle(colors.opacity)}>
132
- <Box
131
+ <View style={resolveSelectionRowStyle(colors.opacity)}>
132
+ <View
133
133
  radius="s"
134
134
  style={resolveCheckboxIndicatorStyle(
135
135
  colors.backgroundColor,
@@ -147,13 +147,13 @@ function renderCheckboxContent(input: CheckboxContentInput) {
147
147
  ✓
148
148
  </Text>
149
149
  ) : null}
150
- </Box>
150
+ </View>
151
151
  {input.children ? (
152
- <Box ml="s">
152
+ <View ml="s">
153
153
  <Text emphasis={labelEmphasis}>{input.children}</Text>
154
- </Box>
154
+ </View>
155
155
  ) : null}
156
- </Box>
156
+ </View>
157
157
  );
158
158
  }
159
159
 
@@ -14,7 +14,7 @@ import type { ButtonBaseProps } from '../../../../../primitives/button-base/type
14
14
  import { useTheme } from '../../../../../theme/ThemeContext';
15
15
  import type { SurfaceTheme } from '../../../../../theme/types';
16
16
  import type { RadioProps } from '../../../../../types/radio';
17
- import { Box } from '../../../../layout/public';
17
+ import { View } from '../../../../layout/public';
18
18
  import { Text } from '../../../../typography/public';
19
19
  import { isRadioTextContent } from '../../utils/isRadioTextContent';
20
20
 
@@ -130,8 +130,8 @@ function renderRadioContent(input: RadioContentInput) {
130
130
  input.children !== undefined && input.children !== null && input.children !== false;
131
131
 
132
132
  return (
133
- <Box style={resolveSelectionRowStyle(colors.opacity)}>
134
- <Box
133
+ <View style={resolveSelectionRowStyle(colors.opacity)}>
134
+ <View
135
135
  radius="full"
136
136
  style={resolveRadioIndicatorStyle(
137
137
  colors.backgroundColor,
@@ -140,22 +140,22 @@ function renderRadioContent(input: RadioContentInput) {
140
140
  )}
141
141
  >
142
142
  {input.isChecked ? (
143
- <Box
143
+ <View
144
144
  radius="full"
145
145
  style={resolveRadioDotStyle(colors.indicatorColor, indicatorSize.radioDot)}
146
146
  />
147
147
  ) : null}
148
- </Box>
148
+ </View>
149
149
  {hasContent ? (
150
- <Box flex={1} ml="s">
150
+ <View flex={1} ml="s">
151
151
  {isRadioTextContent(input.children) ? (
152
152
  <Text emphasis={labelEmphasis}>{input.children}</Text>
153
153
  ) : (
154
154
  input.children
155
155
  )}
156
- </Box>
156
+ </View>
157
157
  ) : null}
158
- </Box>
158
+ </View>
159
159
  );
160
160
  }
161
161
 
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
3
  import type { DividerProps } from '../../../../types/layout';
4
- import { Box } from './Box';
4
+ import { View } from './View';
5
5
 
6
6
  /*** Renders a horizontal or vertical separator using layout tokens. */
7
7
  export function Divider({
@@ -11,7 +11,7 @@ export function Divider({
11
11
  ...props
12
12
  }: DividerProps) {
13
13
  return (
14
- <Box
14
+ <View
15
15
  {...props}
16
16
  bg={color}
17
17
  height={orientation === 'horizontal' ? thickness : '100%'}
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import { View, type ViewStyle } from 'react-native';
2
+ import { View as ReactNativeView, type ViewStyle } from 'react-native';
3
3
 
4
4
  import { resolveResponsive, useResponsiveRuntime } from '../../../../core/responsive';
5
5
  import { useTheme } from '../../../../theme/ThemeContext';
6
6
  import type { GridProps } from '../../../../types/layout';
7
7
  import { resolveSpacing } from '../../../../utils/resolveSpacing';
8
- import { Box } from './Box';
8
+ import { View } from './View';
9
9
 
10
10
  /*** Lays out children in a responsive wrapping grid. */
11
11
  export function Grid({
@@ -31,18 +31,16 @@ export function Grid({
31
31
  const basisPercent: `${number}%` = `${100 / activeCols}%`;
32
32
 
33
33
  return (
34
- <Box {...props}>
35
- <View style={resolveGridStyle(rowSpacing, colSpacing)}>
36
- {React.Children.toArray(children).map((node, index) => (
37
- <View
38
- key={String(index)}
39
- style={resolveGridItemStyle(activeMinItemWidth, basisPercent, rowSpacing, colSpacing)}
40
- >
41
- {node}
42
- </View>
43
- ))}
44
- </View>
45
- </Box>
34
+ <View {...props} style={[resolveGridStyle(rowSpacing, colSpacing), props.style]}>
35
+ {React.Children.toArray(children).map((node, index) => (
36
+ <ReactNativeView
37
+ key={React.isValidElement(node) && node.key !== null ? String(node.key) : String(index)}
38
+ style={resolveGridItemStyle(activeMinItemWidth, basisPercent, rowSpacing, colSpacing)}
39
+ >
40
+ {node}
41
+ </ReactNativeView>
42
+ ))}
43
+ </View>
46
44
  );
47
45
  }
48
46
 
@@ -0,0 +1,102 @@
1
+ import React from 'react';
2
+ import { ScrollView as ReactNativeScrollView } from 'react-native';
3
+
4
+ import { useResponsiveRuntime } from '../../../../core/responsive';
5
+ import { useTheme } from '../../../../theme/ThemeContext';
6
+ import type { ScrollViewProps } from '../../../../types/layout';
7
+ import { resolveViewStyles } from '../../../../utils/resolveViewStyles';
8
+
9
+ /*** Renders the token-aware responsive Surface adapter for React Native ScrollView. */
10
+ export function ScrollView(props: ScrollViewProps) {
11
+ const { theme } = useTheme();
12
+ const { breakpoint } = useResponsiveRuntime();
13
+ const spacing = splitSpacingProps(props);
14
+ const visual = splitVisualProps(spacing.rest);
15
+ const dimensions = splitDimensionProps(visual.rest);
16
+ const layout = splitLayoutProps(dimensions.rest);
17
+ const { children, contentContainerStyle, style, ...scrollProps } = layout.rest;
18
+ const resolved = resolveViewStyles(theme, breakpoint, {
19
+ ...spacing.styleProps,
20
+ ...visual.styleProps,
21
+ ...dimensions.styleProps,
22
+ ...layout.styleProps,
23
+ });
24
+
25
+ return (
26
+ <ReactNativeScrollView
27
+ {...scrollProps}
28
+ contentContainerStyle={contentContainerStyle}
29
+ style={[resolved, style]}
30
+ >
31
+ {children}
32
+ </ReactNativeScrollView>
33
+ );
34
+ }
35
+
36
+ /*** Splits spacing-aware Surface props from native ScrollView props. */
37
+ function splitSpacingProps(props: ScrollViewProps) {
38
+ const { p, px, py, pt, pb, pl, pr, m, mx, my, mt, mb, ml, mr, gap, rowGap, columnGap, ...rest } =
39
+ props;
40
+ return {
41
+ rest,
42
+ styleProps: { p, px, py, pt, pb, pl, pr, m, mx, my, mt, mb, ml, mr, gap, rowGap, columnGap },
43
+ };
44
+ }
45
+
46
+ /*** Splits token-aware visual Surface props from native ScrollView props. */
47
+ function splitVisualProps(props: ReturnType<typeof splitSpacingProps>['rest']) {
48
+ const { bg, radius, borderWidth, borderColor, ...rest } = props;
49
+ return { rest, styleProps: { bg, radius, borderWidth, borderColor } };
50
+ }
51
+
52
+ /*** Splits responsive dimension Surface props from native ScrollView props. */
53
+ function splitDimensionProps(props: ReturnType<typeof splitVisualProps>['rest']) {
54
+ const { width, height, minWidth, maxWidth, minHeight, maxHeight, ...rest } = props;
55
+ return { rest, styleProps: { width, height, minWidth, maxWidth, minHeight, maxHeight } };
56
+ }
57
+
58
+ /*** Splits responsive flex and positioning Surface props from native ScrollView props. */
59
+ function splitLayoutProps(props: ReturnType<typeof splitDimensionProps>['rest']) {
60
+ const {
61
+ flex,
62
+ flexGrow,
63
+ flexShrink,
64
+ flexBasis,
65
+ direction,
66
+ align,
67
+ justify,
68
+ wrap,
69
+ alignSelf,
70
+ position,
71
+ top,
72
+ bottom,
73
+ left,
74
+ right,
75
+ overflow,
76
+ zIndex,
77
+ opacity,
78
+ ...rest
79
+ } = props;
80
+ return {
81
+ rest,
82
+ styleProps: {
83
+ flex,
84
+ flexGrow,
85
+ flexShrink,
86
+ flexBasis,
87
+ direction,
88
+ align,
89
+ justify,
90
+ wrap,
91
+ alignSelf,
92
+ position,
93
+ top,
94
+ bottom,
95
+ left,
96
+ right,
97
+ overflow,
98
+ zIndex,
99
+ opacity,
100
+ },
101
+ };
102
+ }
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
- import { View } from 'react-native';
2
+ import { View as ReactNativeView } from 'react-native';
3
3
 
4
4
  import { useResponsiveRuntime } from '../../../../core/responsive';
5
5
  import { resolvePointerEvents } from '../../../../internal/resolvePointerEvents';
6
6
  import { useTheme } from '../../../../theme/ThemeContext';
7
- import type { BoxProps } from '../../../../types/layout';
8
- import { resolveBoxStyles } from '../../../../utils/resolveBoxStyles';
7
+ import type { ViewProps } from '../../../../types/layout';
8
+ import { resolveViewStyles } from '../../../../utils/resolveViewStyles';
9
9
 
10
- /*** Renders the responsive foundational layout box. */
11
- export function Box({
10
+ /*** Renders the token-aware responsive Surface adapter for React Native View. */
11
+ export function View({
12
12
  accessible,
13
13
  accessibilityLabel,
14
14
  accessibilityRole,
@@ -18,14 +18,14 @@ export function Box({
18
18
  style,
19
19
  testID,
20
20
  ...props
21
- }: BoxProps) {
21
+ }: ViewProps) {
22
22
  const { theme } = useTheme();
23
23
  const { breakpoint } = useResponsiveRuntime();
24
- const resolved = resolveBoxStyles(theme, breakpoint, props);
24
+ const resolved = resolveViewStyles(theme, breakpoint, props);
25
25
  const resolvedPointerEvents = pointerEvents ? resolvePointerEvents(pointerEvents) : null;
26
26
 
27
27
  return (
28
- <View
28
+ <ReactNativeView
29
29
  {...resolvedPointerEvents?.props}
30
30
  accessible={accessible}
31
31
  accessibilityLabel={accessibilityLabel}
@@ -35,6 +35,6 @@ export function Box({
35
35
  style={[resolved, resolvedPointerEvents?.style, style]}
36
36
  >
37
37
  {children}
38
- </View>
38
+ </ReactNativeView>
39
39
  );
40
40
  }
@@ -1,12 +1,5 @@
1
- export type {
2
- BoxProps,
3
- ContainerProps,
4
- DividerProps,
5
- GridProps,
6
- StackProps,
7
- } from '../../types/layout';
8
- export { Box } from './adapters/inbound/Box';
9
- export { Container } from './adapters/inbound/Container';
1
+ export type { DividerProps, GridProps, ScrollViewProps, ViewProps } from '../../types/layout';
10
2
  export { Divider } from './adapters/inbound/Divider';
11
3
  export { Grid } from './adapters/inbound/Grid';
12
- export { Stack } from './adapters/inbound/Stack';
4
+ export { ScrollView } from './adapters/inbound/ScrollView';
5
+ export { View } from './adapters/inbound/View';
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
- import { Pressable, StyleSheet, View, type ViewStyle } from 'react-native';
2
+ import { Pressable, StyleSheet, View as ReactNativeView, type ViewStyle } from 'react-native';
3
3
 
4
4
  import { FocusScope } from '../../../../internal/focus/FocusScope';
5
5
  import { Portal } from '../../../../internal/overlay/Portal';
6
6
  import { resolvePointerEvents } from '../../../../internal/resolvePointerEvents';
7
7
  import { resolveOverlayAnimation } from '../../../../internal/resolvers';
8
- import { Center } from '../../../../layout';
9
8
  import { useTheme } from '../../../../theme/ThemeContext';
10
9
  import type { ModalProps } from '../../../../types/modal';
10
+ import { View } from '../../../layout/public';
11
11
  import { Surface } from '../../../surface/public';
12
12
 
13
13
  const boxNonePointerEvents = resolvePointerEvents('box-none');
@@ -30,7 +30,10 @@ export function Modal({
30
30
 
31
31
  return (
32
32
  <Portal layer="modal" visible={visible}>
33
- <View {...boxNonePointerEvents.props} style={[boxNonePointerEvents.style, styles.fill]}>
33
+ <ReactNativeView
34
+ {...boxNonePointerEvents.props}
35
+ style={[boxNonePointerEvents.style, styles.fill]}
36
+ >
34
37
  <Pressable
35
38
  onPress={backdropPress}
36
39
  style={[
@@ -44,15 +47,15 @@ export function Modal({
44
47
  onEscape={passive ? undefined : onDismiss}
45
48
  testID={testID ? `${testID}-focus` : undefined}
46
49
  >
47
- <Center p="l" style={styles.center}>
48
- <View accessible accessibilityViewIsModal style={styles.content}>
50
+ <View align="center" justify="center" p="l" style={styles.center}>
51
+ <ReactNativeView accessible accessibilityViewIsModal style={styles.content}>
49
52
  <Surface p="l" style={styles.surface} testID={testID} variant="raised">
50
53
  {children}
51
54
  </Surface>
52
- </View>
53
- </Center>
55
+ </ReactNativeView>
56
+ </View>
54
57
  </FocusScope>
55
- </View>
58
+ </ReactNativeView>
56
59
  </Portal>
57
60
  );
58
61
  }
@@ -3,10 +3,9 @@ import { Pressable } from 'react-native';
3
3
 
4
4
  import { FocusScope } from '../../../../internal/focus/FocusScope';
5
5
  import { useFocusManager } from '../../../../internal/focus/useFocusManager';
6
- import { Inline } from '../../../../layout';
7
6
  import { useTheme } from '../../../../theme/ThemeContext';
8
7
  import type { PopoverMenuAction, PopoverMenuProps } from '../../../../types/popoverMenu';
9
- import { Box, Stack } from '../../../layout/public';
8
+ import { View } from '../../../layout/public';
10
9
  import { Popover } from '../../../popover/public';
11
10
  import { Surface } from '../../../surface/public';
12
11
  import { Text } from '../../../typography/public';
@@ -103,10 +102,8 @@ function usePopoverMenuKeyboard({
103
102
  () =>
104
103
  bindKeydown((event) => {
105
104
  if (passive) return;
106
-
107
105
  const { key } = event;
108
106
  if (key === undefined) return;
109
-
110
107
  if (['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(key)) {
111
108
  event.preventDefault();
112
109
  setActiveIndex((current) => resolveNextMenuIndex(actions, current, key));
@@ -152,7 +149,7 @@ function PopoverMenuItem({
152
149
  onPress={passive ? undefined : () => activateAction(action)}
153
150
  testID={testID ? `${testID}-item-${action.id}` : undefined}
154
151
  >
155
- <Box
152
+ <View
156
153
  bg={selected ? theme.semantics.action.neutral.softBg : 'transparent'}
157
154
  opacity={action.disabled ? 0.56 : 1}
158
155
  px="m"
@@ -160,7 +157,7 @@ function PopoverMenuItem({
160
157
  radius="s"
161
158
  >
162
159
  <PopoverMenuItemContent action={action} active={active} />
163
- </Box>
160
+ </View>
164
161
  </Pressable>
165
162
  );
166
163
  }
@@ -177,10 +174,10 @@ function PopoverMenuItemContent({
177
174
  action.intent === 'danger' ? 'danger' : active || action.selected ? 'neutral' : undefined;
178
175
 
179
176
  return (
180
- <Inline align="center" gap="s" justify="space-between" wrap="nowrap">
181
- {action.leading ? <Box>{action.leading}</Box> : null}
182
- <Box flex={1}>
183
- <Stack gap="xxs">
177
+ <View align="center" direction="row" gap="s" justify="space-between" wrap="nowrap">
178
+ {action.leading ? <View>{action.leading}</View> : null}
179
+ <View flex={1}>
180
+ <View gap="xxs">
184
181
  <Text
185
182
  color={titleColor}
186
183
  variant="bodySmall"
@@ -193,9 +190,9 @@ function PopoverMenuItemContent({
193
190
  {action.description}
194
191
  </Text>
195
192
  ) : null}
196
- </Stack>
197
- </Box>
198
- {action.trailing ? <Box>{action.trailing}</Box> : null}
199
- </Inline>
193
+ </View>
194
+ </View>
195
+ {action.trailing ? <View>{action.trailing}</View> : null}
196
+ </View>
200
197
  );
201
198
  }
@@ -3,9 +3,9 @@ import type { ViewStyle } from 'react-native';
3
3
 
4
4
  import { useTheme } from '../../../../theme/ThemeContext';
5
5
  import type { SurfaceProps, SurfaceVariant } from '../../../../types/surface';
6
- import { Box } from '../../../layout/public';
6
+ import { View } from '../../../layout/public';
7
7
 
8
- /*** Renders a themed container surface with semantic elevation and border variants. */
8
+ /*** Renders a themed content surface with semantic elevation and border variants. */
9
9
  export function Surface({ variant = 'default', radius = 'm', style, ...props }: SurfaceProps) {
10
10
  const { theme } = useTheme();
11
11
  const backgroundColor =
@@ -17,7 +17,7 @@ export function Surface({ variant = 'default', radius = 'm', style, ...props }:
17
17
  const borderColor = theme.semantics.border.default;
18
18
 
19
19
  return (
20
- <Box
20
+ <View
21
21
  {...props}
22
22
  radius={radius}
23
23
  style={[resolveSurfaceVariantStyles(variant, borderColor, backgroundColor), style]}
@@ -3,7 +3,7 @@ import { Pressable, type ViewStyle } from 'react-native';
3
3
 
4
4
  import { useTheme } from '../../../../theme/ThemeContext';
5
5
  import type { TabProps } from '../../../../types/tabs';
6
- import { Box } from '../../../layout/public';
6
+ import { View } from '../../../layout/public';
7
7
  import { Text } from '../../../typography/public';
8
8
  import { useTabRegistration } from '../../composition/useTabRegistration';
9
9
  import { useTabsContext } from '../../composition/useTabsContext';
@@ -37,7 +37,7 @@ export function Tab({
37
37
  ref={pressableRef}
38
38
  testID={testID}
39
39
  >
40
- <Box
40
+ <View
41
41
  px="m"
42
42
  py="s"
43
43
  style={resolveTabStyle({
@@ -50,7 +50,7 @@ export function Tab({
50
50
  <Text color={selected ? 'primary' : undefined} variant="label" weight="medium">
51
51
  {children}
52
52
  </Text>
53
- </Box>
53
+ </View>
54
54
  </Pressable>
55
55
  );
56
56
  }
@@ -1,9 +1,8 @@
1
1
  import React from 'react';
2
- import { StyleSheet } from 'react-native';
3
2
 
4
3
  import { useFocusManager } from '../../../../internal/focus/useFocusManager';
5
4
  import type { TabListProps, TabNavigationKey } from '../../../../types/tabs';
6
- import { Box } from '../../../layout/public';
5
+ import { View } from '../../../layout/public';
7
6
  import { useTabsContext } from '../../composition/useTabsContext';
8
7
  import { resolveNextTabValue } from '../../utils/resolveNextTabValue';
9
8
 
@@ -36,9 +35,9 @@ export function TabList({ children, testID }: TabListProps) {
36
35
  }, [bindKeydown, focusedValue, setActiveValue, tabs]);
37
36
 
38
37
  return (
39
- <Box accessibilityRole="tablist" style={styles.list} testID={testID}>
38
+ <View accessibilityRole="tablist" direction="row" testID={testID}>
40
39
  {children}
41
- </Box>
40
+ </View>
42
41
  );
43
42
  }
44
43
 
@@ -46,5 +45,3 @@ export function TabList({ children, testID }: TabListProps) {
46
45
  function isTabNavigationKey(key: string | undefined): key is TabNavigationKey {
47
46
  return key !== undefined && navigationKeys.includes(key);
48
47
  }
49
-
50
- const styles = StyleSheet.create({ list: { flexDirection: 'row' } });
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
3
  import type { TabsProps } from '../../../../types/tabs';
4
- import { Box } from '../../../layout/public';
4
+ import { View } from '../../../layout/public';
5
5
  import { TabsContext } from '../../composition/TabsContext';
6
6
  import { useTabsController } from '../../composition/useTabsController';
7
7
 
@@ -11,7 +11,7 @@ export function Tabs({ children, ...props }: TabsProps) {
11
11
 
12
12
  return (
13
13
  <TabsContext value={contextValue}>
14
- <Box testID={props.testID}>{children}</Box>
14
+ <View testID={props.testID}>{children}</View>
15
15
  </TabsContext>
16
16
  );
17
17
  }