@ankhorage/surface 4.1.0 → 4.2.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ankhorage/surface
2
2
 
3
+ ## 4.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - aab8831: Add a stable KeyboardAvoidingView layout primitive backed directly by React Native.
8
+
3
9
  ## 4.1.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # @ankhorage/surface
5
5
 
6
- ![license: MIT](././paradox/badges/license.svg) ![npm: v4.0.0](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![docs: paradox](././paradox/badges/docs.svg)
6
+ ![license: MIT](././paradox/badges/license.svg) ![npm: v4.1.0](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![docs: paradox](././paradox/badges/docs.svg)
7
7
 
8
8
  Cross-platform UI foundation for React Native and React Native Web. Provides theming, layout primitives, and core building blocks for modern apps.
9
9
 
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { type KeyboardAvoidingViewProps as ReactNativeKeyboardAvoidingViewProps } from 'react-native';
3
+ /*** Preserve React Native keyboard avoidance behind the stable Surface layout boundary. */
4
+ export declare function KeyboardAvoidingView(props: KeyboardAvoidingViewProps): React.JSX.Element;
5
+ export type KeyboardAvoidingViewBehavior = NonNullable<ReactNativeKeyboardAvoidingViewProps['behavior']>;
6
+ export type KeyboardAvoidingViewProps = ReactNativeKeyboardAvoidingViewProps;
7
+ //# sourceMappingURL=KeyboardAvoidingView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyboardAvoidingView.d.ts","sourceRoot":"","sources":["../../src/layout/KeyboardAvoidingView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,KAAK,yBAAyB,IAAI,oCAAoC,EACvE,MAAM,cAAc,CAAC;AAEtB,2FAA2F;AAC3F,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,qBAEpE;AAED,MAAM,MAAM,4BAA4B,GAAG,WAAW,CACpD,oCAAoC,CAAC,UAAU,CAAC,CACjD,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,oCAAoC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { KeyboardAvoidingView as ReactNativeKeyboardAvoidingView, } from 'react-native';
3
+ /*** Preserve React Native keyboard avoidance behind the stable Surface layout boundary. */
4
+ export function KeyboardAvoidingView(props) {
5
+ return <ReactNativeKeyboardAvoidingView {...props}/>;
6
+ }
7
+ //# sourceMappingURL=KeyboardAvoidingView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyboardAvoidingView.js","sourceRoot":"","sources":["../../src/layout/KeyboardAvoidingView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,oBAAoB,IAAI,+BAA+B,GAExD,MAAM,cAAc,CAAC;AAEtB,2FAA2F;AAC3F,MAAM,UAAU,oBAAoB,CAAC,KAAgC;IACnE,OAAO,CAAC,+BAA+B,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AACxD,CAAC","sourcesContent":["import React from 'react';\nimport {\n KeyboardAvoidingView as ReactNativeKeyboardAvoidingView,\n type KeyboardAvoidingViewProps as ReactNativeKeyboardAvoidingViewProps,\n} from 'react-native';\n\n/*** Preserve React Native keyboard avoidance behind the stable Surface layout boundary. */\nexport function KeyboardAvoidingView(props: KeyboardAvoidingViewProps) {\n return <ReactNativeKeyboardAvoidingView {...props} />;\n}\n\nexport type KeyboardAvoidingViewBehavior = NonNullable<\n ReactNativeKeyboardAvoidingViewProps['behavior']\n>;\n\nexport type KeyboardAvoidingViewProps = ReactNativeKeyboardAvoidingViewProps;\n"]}
@@ -12,6 +12,8 @@ export type { GridProps } from './Grid';
12
12
  export { Grid } from './Grid';
13
13
  export type { InlineProps } from './Inline';
14
14
  export { Inline } from './Inline';
15
+ export type { KeyboardAvoidingViewBehavior, KeyboardAvoidingViewProps, } from './KeyboardAvoidingView';
16
+ export { KeyboardAvoidingView } from './KeyboardAvoidingView';
15
17
  export type { ScrollAreaProps } from './ScrollArea';
16
18
  export { ScrollArea } from './ScrollArea';
17
19
  export type { ShowProps } from './Show';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAA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W,CAAC;AACpC,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EACV,4BAA4B,EAC5B,yBAAyB,GAC1B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
@@ -5,6 +5,7 @@ export { Container } from './Container';
5
5
  export { Divider } from './Divider';
6
6
  export { Grid } from './Grid';
7
7
  export { Inline } from './Inline';
8
+ export { KeyboardAvoidingView } from './KeyboardAvoidingView';
8
9
  export { ScrollArea } from './ScrollArea';
9
10
  export { Show } from './Show';
10
11
  export { Spacer } from './Spacer';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export type { AppBarProps } from './AppBar';\nexport { AppBar } from './AppBar';\nexport type { BoxProps } from './Box';\nexport { Box } from './Box';\nexport type { CenterProps } from './Center';\nexport { Center } from './Center';\nexport type { ContainerProps } from './Container';\nexport { Container } from './Container';\nexport type { DividerProps } from './Divider';\nexport { Divider } from './Divider';\nexport type { GridProps } from './Grid';\nexport { Grid } from './Grid';\nexport type { InlineProps } from './Inline';\nexport { Inline } from './Inline';\nexport type { ScrollAreaProps } from './ScrollArea';\nexport { ScrollArea } from './ScrollArea';\nexport type { ShowProps } from './Show';\nexport { Show } from './Show';\nexport type { SpacerProps } from './Spacer';\nexport { Spacer } from './Spacer';\nexport type { StackProps } from './Stack';\nexport { Stack } from './Stack';\nexport type { SurfaceProps, SurfaceVariant } from './Surface';\nexport { Surface } from './Surface';\nexport type { TemplateProps } from './Template';\nexport { Template } from './Template';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAKlC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export type { AppBarProps } from './AppBar';\nexport { AppBar } from './AppBar';\nexport type { BoxProps } from './Box';\nexport { Box } from './Box';\nexport type { CenterProps } from './Center';\nexport { Center } from './Center';\nexport type { ContainerProps } from './Container';\nexport { Container } from './Container';\nexport type { DividerProps } from './Divider';\nexport { Divider } from './Divider';\nexport type { GridProps } from './Grid';\nexport { Grid } from './Grid';\nexport type { InlineProps } from './Inline';\nexport { Inline } from './Inline';\nexport type {\n KeyboardAvoidingViewBehavior,\n KeyboardAvoidingViewProps,\n} from './KeyboardAvoidingView';\nexport { KeyboardAvoidingView } from './KeyboardAvoidingView';\nexport type { ScrollAreaProps } from './ScrollArea';\nexport { ScrollArea } from './ScrollArea';\nexport type { ShowProps } from './Show';\nexport { Show } from './Show';\nexport type { SpacerProps } from './Spacer';\nexport { Spacer } from './Spacer';\nexport type { StackProps } from './Stack';\nexport { Stack } from './Stack';\nexport type { SurfaceProps, SurfaceVariant } from './Surface';\nexport { Surface } from './Surface';\nexport type { TemplateProps } from './Template';\nexport { Template } from './Template';\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/surface",
3
3
  "type": "module",
4
- "version": "4.1.0",
4
+ "version": "4.2.0",
5
5
  "description": "Stable UI foundation for React Native and React Native Web.",
6
6
  "homepage": "https://github.com/ankhorage/surface#readme",
7
7
  "bugs": {
package/src/index.test.ts CHANGED
@@ -6,6 +6,7 @@ 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');
9
10
  const packageJson = JSON.parse(
10
11
  readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
11
12
  ) as {
@@ -78,6 +79,15 @@ describe('public root barrel contract', () => {
78
79
  expect(selection.background).toBeDefined();
79
80
  expect(diagnostics.generated.swatches).toBe(theme.swatches);
80
81
  });
82
+
83
+ it('publishes KeyboardAvoidingView through the root layout facade', () => {
84
+ expect(indexSource).toContain("export * from './layout';");
85
+ expect(layoutIndexSource).toContain(
86
+ "export { KeyboardAvoidingView } from './KeyboardAvoidingView';",
87
+ );
88
+ expect(layoutIndexSource).toContain('KeyboardAvoidingViewProps');
89
+ expect(layoutIndexSource).toContain('KeyboardAvoidingViewBehavior');
90
+ });
81
91
  });
82
92
 
83
93
  describe('public package metadata contract', () => {
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import {
3
+ KeyboardAvoidingView as ReactNativeKeyboardAvoidingView,
4
+ type KeyboardAvoidingViewProps as ReactNativeKeyboardAvoidingViewProps,
5
+ } from 'react-native';
6
+
7
+ /*** Preserve React Native keyboard avoidance behind the stable Surface layout boundary. */
8
+ export function KeyboardAvoidingView(props: KeyboardAvoidingViewProps) {
9
+ return <ReactNativeKeyboardAvoidingView {...props} />;
10
+ }
11
+
12
+ export type KeyboardAvoidingViewBehavior = NonNullable<
13
+ ReactNativeKeyboardAvoidingViewProps['behavior']
14
+ >;
15
+
16
+ export type KeyboardAvoidingViewProps = ReactNativeKeyboardAvoidingViewProps;
@@ -12,6 +12,11 @@ export type { GridProps } from './Grid';
12
12
  export { Grid } from './Grid';
13
13
  export type { InlineProps } from './Inline';
14
14
  export { Inline } from './Inline';
15
+ export type {
16
+ KeyboardAvoidingViewBehavior,
17
+ KeyboardAvoidingViewProps,
18
+ } from './KeyboardAvoidingView';
19
+ export { KeyboardAvoidingView } from './KeyboardAvoidingView';
15
20
  export type { ScrollAreaProps } from './ScrollArea';
16
21
  export { ScrollArea } from './ScrollArea';
17
22
  export type { ShowProps } from './Show';
@@ -10,6 +10,7 @@ const scrollContentStyle = { padding: 4 };
10
10
 
11
11
  const { Container } = await import('./layout/Container');
12
12
  const { Grid } = await import('./layout/Grid');
13
+ const { KeyboardAvoidingView } = await import('./layout/KeyboardAvoidingView');
13
14
  const { ScrollArea } = await import('./layout/ScrollArea');
14
15
  const { Show } = await import('./layout/Show');
15
16
  const { OverlayProvider } = await import('./internal/overlay/OverlayProvider');
@@ -94,3 +95,19 @@ test('RN Web 0.21 compiles box-none overlay pointer events into a hit-test-safe
94
95
  expect(markup).toContain('data-testid="interactive-content"');
95
96
  expect(markup).toContain('r-pointerEvents-');
96
97
  });
98
+
99
+ test('RN Web 0.21 renders keyboard-safe content through the Surface layout boundary', () => {
100
+ const markup = renderToString(
101
+ <KeyboardAvoidingView
102
+ behavior="padding"
103
+ enabled
104
+ keyboardVerticalOffset={24}
105
+ testID="keyboard-safe"
106
+ >
107
+ <ReactNativeWeb.Text>Keyboard-safe content</ReactNativeWeb.Text>
108
+ </KeyboardAvoidingView>,
109
+ );
110
+
111
+ expect(markup).toContain('data-testid="keyboard-safe"');
112
+ expect(markup).toContain('Keyboard-safe content');
113
+ });