@ankhorage/surface 2.2.1 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -2
- package/dist/components/action-sheet/ActionSheet.d.ts.map +1 -1
- package/dist/components/action-sheet/ActionSheet.js +12 -7
- package/dist/components/action-sheet/ActionSheet.js.map +1 -1
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/button/Button.js +5 -7
- package/dist/components/button/Button.js.map +1 -1
- package/dist/components/button/types.d.ts +2 -5
- package/dist/components/button/types.d.ts.map +1 -1
- package/dist/components/button/types.js.map +1 -1
- package/dist/components/drawer/Drawer.d.ts.map +1 -1
- package/dist/components/drawer/Drawer.js +12 -7
- package/dist/components/drawer/Drawer.js.map +1 -1
- package/dist/components/icon-button/IconButton.d.ts.map +1 -1
- package/dist/components/icon-button/IconButton.js +1 -1
- package/dist/components/icon-button/IconButton.js.map +1 -1
- package/dist/components/icon-button/types.d.ts +2 -5
- package/dist/components/icon-button/types.d.ts.map +1 -1
- package/dist/components/icon-button/types.js.map +1 -1
- package/dist/components/menu/Menu.d.ts.map +1 -1
- package/dist/components/menu/Menu.js +12 -7
- package/dist/components/menu/Menu.js.map +1 -1
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/modal/Modal.js +12 -7
- package/dist/components/modal/Modal.js.map +1 -1
- package/dist/components/navigation/NavigationItem.d.ts.map +1 -1
- package/dist/components/navigation/NavigationItem.js +1 -1
- package/dist/components/navigation/NavigationItem.js.map +1 -1
- package/dist/components/navigation/TabBarItem.d.ts.map +1 -1
- package/dist/components/navigation/TabBarItem.js +1 -1
- package/dist/components/navigation/TabBarItem.js.map +1 -1
- package/dist/components/navigation/types.d.ts +2 -2
- package/dist/components/navigation/types.d.ts.map +1 -1
- package/dist/components/navigation/types.js.map +1 -1
- package/dist/components/toast/ToastProvider.d.ts.map +1 -1
- package/dist/components/toast/ToastProvider.js +3 -2
- package/dist/components/toast/ToastProvider.js.map +1 -1
- package/dist/components/tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/Tooltip.js +10 -5
- package/dist/components/tooltip/Tooltip.js.map +1 -1
- package/dist/context/TranslationContext.d.ts.map +1 -1
- package/dist/context/TranslationContext.js +3 -3
- package/dist/context/TranslationContext.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/overlay/OverlayProvider.d.ts.map +1 -1
- package/dist/internal/overlay/OverlayProvider.js +17 -16
- package/dist/internal/overlay/OverlayProvider.js.map +1 -1
- package/dist/internal/overlay/Portal.d.ts.map +1 -1
- package/dist/internal/overlay/Portal.js +2 -1
- package/dist/internal/overlay/Portal.js.map +1 -1
- package/dist/internal/resolvePointerEvents.d.ts +9 -0
- package/dist/internal/resolvePointerEvents.d.ts.map +1 -0
- package/dist/internal/resolvePointerEvents.js +17 -0
- package/dist/internal/resolvePointerEvents.js.map +1 -0
- package/dist/layout/AppBar.js +1 -1
- package/dist/layout/AppBar.js.map +1 -1
- package/dist/layout/Box.d.ts.map +1 -1
- package/dist/layout/Box.js +4 -22
- package/dist/layout/Box.js.map +1 -1
- package/dist/layout/Grid.js.map +1 -1
- package/dist/primitives/icon/Icon.d.ts +5 -12
- package/dist/primitives/icon/Icon.d.ts.map +1 -1
- package/dist/primitives/icon/Icon.js +5 -11
- package/dist/primitives/icon/Icon.js.map +1 -1
- package/dist/primitives/icon/PortableIcon.d.ts +51 -0
- package/dist/primitives/icon/PortableIcon.d.ts.map +1 -0
- package/dist/primitives/icon/PortableIcon.js +64 -0
- package/dist/primitives/icon/PortableIcon.js.map +1 -0
- package/dist/primitives/icon/index.d.ts +2 -1
- package/dist/primitives/icon/index.d.ts.map +1 -1
- package/dist/primitives/icon/index.js +1 -0
- package/dist/primitives/icon/index.js.map +1 -1
- package/dist/primitives/image/Image.d.ts.map +1 -1
- package/dist/primitives/image/Image.js +3 -5
- package/dist/primitives/image/Image.js.map +1 -1
- package/package.json +30 -27
- package/src/components/action-sheet/ActionSheet.tsx +14 -8
- package/src/components/button/Button.tsx +5 -17
- package/src/components/button/types.ts +2 -5
- package/src/components/drawer/Drawer.tsx +14 -8
- package/src/components/icon-button/IconButton.tsx +1 -6
- package/src/components/icon-button/types.ts +2 -5
- package/src/components/menu/Menu.tsx +14 -8
- package/src/components/modal/Modal.tsx +14 -8
- package/src/components/navigation/NavigationItem.tsx +1 -6
- package/src/components/navigation/TabBarItem.tsx +1 -6
- package/src/components/navigation/types.ts +2 -2
- package/src/components/toast/ToastProvider.tsx +3 -2
- package/src/components/tooltip/Tooltip.tsx +12 -6
- package/src/context/TranslationContext.tsx +12 -15
- package/src/index.test.ts +8 -0
- package/src/index.ts +2 -2
- package/src/internal/overlay/OverlayProvider.tsx +20 -20
- package/src/internal/overlay/Portal.tsx +2 -1
- package/src/internal/resolvePointerEvents.test.ts +19 -0
- package/src/internal/resolvePointerEvents.ts +29 -0
- package/src/layout/AppBar.tsx +1 -1
- package/src/layout/Box.tsx +5 -36
- package/src/layout/Grid.tsx +3 -3
- package/src/primitives/icon/Icon.tsx +9 -22
- package/src/primitives/icon/PortableIcon.tsx +112 -0
- package/src/primitives/icon/PortableIcon.web.test.tsx +119 -0
- package/src/primitives/icon/index.ts +2 -1
- package/src/primitives/image/Image.tsx +3 -6
- package/src/theme/colorEngine.test.ts +2 -2
- package/src/webAcceptance.test.tsx +84 -0
- package/dist/primitives/icon/resolveExpoIconComponent.d.ts +0 -11
- package/dist/primitives/icon/resolveExpoIconComponent.d.ts.map +0 -1
- package/dist/primitives/icon/resolveExpoIconComponent.js +0 -20
- package/dist/primitives/icon/resolveExpoIconComponent.js.map +0 -1
- package/src/primitives/icon/resolveExpoIconComponent.test.ts +0 -45
- package/src/primitives/icon/resolveExpoIconComponent.ts +0 -33
package/dist/layout/Box.js
CHANGED
|
@@ -1,33 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { View } from 'react-native';
|
|
3
3
|
import { useResponsiveRuntime } from '../core/responsive';
|
|
4
|
+
import { resolvePointerEvents } from '../internal/resolvePointerEvents';
|
|
4
5
|
import { useTheme } from '../theme/ThemeContext';
|
|
5
6
|
import { resolveBoxStyles } from './helpers';
|
|
6
|
-
function resolvePointerEventsStyle(pointerEvents) {
|
|
7
|
-
if (Platform.OS !== 'web' || pointerEvents === undefined)
|
|
8
|
-
return null;
|
|
9
|
-
if (pointerEvents === 'auto' || pointerEvents === 'none') {
|
|
10
|
-
return { pointerEvents };
|
|
11
|
-
}
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
function resolveViewPointerEvents(pointerEvents) {
|
|
15
|
-
if (pointerEvents === undefined)
|
|
16
|
-
return undefined;
|
|
17
|
-
if (Platform.OS !== 'web')
|
|
18
|
-
return pointerEvents;
|
|
19
|
-
if (pointerEvents === 'box-none' || pointerEvents === 'box-only') {
|
|
20
|
-
return pointerEvents;
|
|
21
|
-
}
|
|
22
|
-
return undefined;
|
|
23
|
-
}
|
|
24
7
|
export function Box({ accessible, accessibilityLabel, accessibilityRole, accessibilityState, children, pointerEvents, style, testID, ...props }) {
|
|
25
8
|
const { theme } = useTheme();
|
|
26
9
|
const { breakpoint } = useResponsiveRuntime();
|
|
27
10
|
const resolved = resolveBoxStyles(theme, breakpoint, props);
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
return (<View accessible={accessible} accessibilityLabel={accessibilityLabel} accessibilityRole={accessibilityRole} accessibilityState={accessibilityState} pointerEvents={viewPointerEvents} testID={testID} style={[resolved, pointerEventsStyle, style]}>
|
|
11
|
+
const resolvedPointerEvents = pointerEvents ? resolvePointerEvents(pointerEvents) : null;
|
|
12
|
+
return (<View {...resolvedPointerEvents?.props} accessible={accessible} accessibilityLabel={accessibilityLabel} accessibilityRole={accessibilityRole} accessibilityState={accessibilityState} testID={testID} style={[resolved, resolvedPointerEvents?.style, style]}>
|
|
31
13
|
{children}
|
|
32
14
|
</View>);
|
|
33
15
|
}
|
package/dist/layout/Box.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.js","sourceRoot":"","sources":["../../src/layout/Box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"Box.js","sourceRoot":"","sources":["../../src/layout/Box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAA0C,MAAM,cAAc,CAAC;AAE5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAsB,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAYjE,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, type ViewProps as ReactNativeViewProps } from 'react-native';\n\nimport { useResponsiveRuntime } from '../core/responsive';\nimport { resolvePointerEvents } from '../internal/resolvePointerEvents';\nimport { useTheme } from '../theme/ThemeContext';\nimport { type BoxStyleProps, resolveBoxStyles } from './helpers';\n\nexport interface BoxProps extends BoxStyleProps {\n accessibilityLabel?: ReactNativeViewProps['accessibilityLabel'];\n accessibilityRole?: ReactNativeViewProps['accessibilityRole'];\n accessibilityState?: ReactNativeViewProps['accessibilityState'];\n accessible?: ReactNativeViewProps['accessible'];\n children?: React.ReactNode;\n pointerEvents?: ReactNativeViewProps['pointerEvents'];\n testID?: string;\n}\n\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"]}
|
package/dist/layout/Grid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grid.js","sourceRoot":"","sources":["../../src/layout/Grid.tsx"],"names":[],"mappings":"AAAA,O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,CACP,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { View, type ViewStyle } from 'react-native';\n\nimport { resolveResponsive, type Responsive, useResponsiveRuntime } from '../core/responsive';\nimport { useTheme } from '../theme/ThemeContext';\nimport { Box, type BoxProps } from './Box';\nimport { resolveSpacing, type SpaceValue } from './helpers';\n\nexport interface GridProps extends Omit<BoxProps, 'children'> {\n children?: React.ReactNode;\n cols: Responsive<number>;\n gap?: Responsive<SpaceValue>;\n rowGap?: Responsive<SpaceValue>;\n colGap?: Responsive<SpaceValue>;\n minItemWidth?: Responsive<number>;\n}\n\nexport function Grid({\n children,\n cols,\n gap = 0,\n rowGap,\n colGap,\n minItemWidth,\n ...props\n}: GridProps) {\n const { theme } = useTheme();\n const { breakpoint } = useResponsiveRuntime();\n\n const activeCols = Math.max(1, Math.floor(resolveResponsive(cols, breakpoint) ?? 1));\n const defaultGap = resolveResponsive(gap, breakpoint) ?? 0;\n const activeRowGap = resolveResponsive(rowGap, breakpoint) ?? defaultGap;\n const activeColGap = resolveResponsive(colGap, breakpoint) ?? defaultGap;\n const rowSpacing = Number(resolveSpacing(theme, activeRowGap) ?? 0);\n const colSpacing = Number(resolveSpacing(theme, activeColGap) ?? 0);\n const activeMinItemWidth = resolveResponsive(minItemWidth, breakpoint);\n\n const basisPercent: `${number}%` = `${100 / activeCols}%`;\n const nodes = React.Children.toArray(children);\n\n return (\n <Box {...props}>\n <View\n style={{\n flexDirection: 'row',\n flexWrap: 'wrap',\n marginTop: -rowSpacing / 2,\n marginLeft: -colSpacing / 2,\n marginRight: -colSpacing / 2,\n }}\n >\n {nodes.map((node, index) => {\n const itemStyle: ViewStyle =\n activeMinItemWidth !== undefined\n ? {\n minWidth: activeMinItemWidth,\n flexBasis: activeMinItemWidth,\n flexGrow: 1,\n }\n : {\n width: basisPercent,\n flexBasis: basisPercent,\n };\n\n return (\n <View\n key={String(index)}\n style={{\n paddingTop: rowSpacing / 2,\n paddingBottom: rowSpacing / 2,\n paddingLeft: colSpacing / 2,\n paddingRight: colSpacing / 2,\n ...itemStyle,\n }}\n >\n {node}\n </View>\n );\n })}\n </View>\n </Box>\n );\n}\n"]}
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { type StyleProp, type TextStyle } from 'react-native';
|
|
3
2
|
import type { SurfaceTheme } from '../../theme/types';
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
provider?: IconProvider;
|
|
3
|
+
import { type IconSource } from './PortableIcon';
|
|
4
|
+
export type { IconProvider, IconSource, IconVariant } from './PortableIcon';
|
|
5
|
+
interface IconPresentationProps {
|
|
8
6
|
size?: keyof SurfaceTheme['spacing'] | number;
|
|
9
7
|
color?: keyof SurfaceTheme['colors'] | string;
|
|
10
8
|
style?: StyleProp<TextStyle>;
|
|
11
9
|
testID?: string;
|
|
12
10
|
}
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
name?: string;
|
|
16
|
-
size?: number;
|
|
17
|
-
style?: StyleProp<TextStyle>;
|
|
18
|
-
testID?: string;
|
|
19
|
-
}, string | React.JSXElementConstructor<any>>;
|
|
11
|
+
export type IconProps = IconSource & IconPresentationProps;
|
|
12
|
+
export declare function Icon(props: IconProps): import("react").JSX.Element;
|
|
20
13
|
//# sourceMappingURL=Icon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/primitives/icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/primitives/icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,KAAK,UAAU,EAAgB,MAAM,gBAAgB,CAAC;AAE/D,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE5E,UAAU,qBAAqB;IAC7B,IAAI,CAAC,EAAE,MAAM,YAAY,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,YAAY,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;IAC9C,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,qBAAqB,CAAC;AAE3D,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,+BAQpC"}
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import {} from 'react-native';
|
|
3
2
|
import { resolveToken } from '../../theme/resolveToken';
|
|
4
3
|
import { useTheme } from '../../theme/ThemeContext';
|
|
5
|
-
import {
|
|
6
|
-
export function Icon(
|
|
4
|
+
import { PortableIcon } from './PortableIcon';
|
|
5
|
+
export function Icon(props) {
|
|
7
6
|
const { theme } = useTheme();
|
|
8
|
-
const
|
|
7
|
+
const size = props.size ?? 'm';
|
|
8
|
+
const color = props.color ?? 'text';
|
|
9
9
|
const resolvedSize = typeof size === 'number' ? size : resolveToken(theme.spacing, size);
|
|
10
10
|
const resolvedColor = resolveToken(theme.colors, color);
|
|
11
|
-
return
|
|
12
|
-
color: resolvedColor,
|
|
13
|
-
name,
|
|
14
|
-
size: resolvedSize,
|
|
15
|
-
style,
|
|
16
|
-
testID,
|
|
17
|
-
});
|
|
11
|
+
return <PortableIcon {...props} color={resolvedColor} size={resolvedSize}/>;
|
|
18
12
|
}
|
|
19
13
|
//# sourceMappingURL=Icon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../src/primitives/icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../src/primitives/icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkC,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAmB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAa/D,MAAM,UAAU,IAAI,CAAC,KAAgB;IACnC,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,GAAG,CAAC;IAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,MAAM,CAAC;IACpC,MAAM,YAAY,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACzF,MAAM,aAAa,GAAG,YAAY,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAExD,OAAO,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,EAAG,CAAC;AAC/E,CAAC","sourcesContent":["import { type StyleProp, type TextStyle } from 'react-native';\n\nimport { resolveToken } from '../../theme/resolveToken';\nimport { useTheme } from '../../theme/ThemeContext';\nimport type { SurfaceTheme } from '../../theme/types';\nimport { type IconSource, PortableIcon } from './PortableIcon';\n\nexport type { IconProvider, IconSource, IconVariant } from './PortableIcon';\n\ninterface IconPresentationProps {\n size?: keyof SurfaceTheme['spacing'] | number;\n color?: keyof SurfaceTheme['colors'] | string;\n style?: StyleProp<TextStyle>;\n testID?: string;\n}\n\nexport type IconProps = IconSource & IconPresentationProps;\n\nexport function Icon(props: IconProps) {\n const { theme } = useTheme();\n const size = props.size ?? 'm';\n const color = props.color ?? 'text';\n const resolvedSize = typeof size === 'number' ? size : resolveToken(theme.spacing, size);\n const resolvedColor = resolveToken(theme.colors, color);\n\n return <PortableIcon {...props} color={resolvedColor} size={resolvedSize} />;\n}\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type FontAwesomeIconName } from '@react-native-vector-icons/fontawesome/static';
|
|
2
|
+
import { type FontAwesome5BrandIconName, type FontAwesome5RegularIconName, type FontAwesome5SolidIconName } from '@react-native-vector-icons/fontawesome5/static';
|
|
3
|
+
import { type FontAwesome6BrandIconName, type FontAwesome6RegularIconName, type FontAwesome6SolidIconName } from '@react-native-vector-icons/fontawesome6/static';
|
|
4
|
+
import { type IoniconsIconName } from '@react-native-vector-icons/ionicons/static';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { type StyleProp, type TextStyle } from 'react-native';
|
|
7
|
+
export declare const SUPPORTED_ICON_PROVIDERS: readonly ["Ionicons", "FontAwesome", "FontAwesome5", "FontAwesome6"];
|
|
8
|
+
export type IconProvider = (typeof SUPPORTED_ICON_PROVIDERS)[number];
|
|
9
|
+
export type IconVariant = 'regular' | 'solid' | 'brand';
|
|
10
|
+
export type IconSource = {
|
|
11
|
+
name: IoniconsIconName;
|
|
12
|
+
provider?: 'Ionicons';
|
|
13
|
+
variant?: never;
|
|
14
|
+
} | {
|
|
15
|
+
name: FontAwesomeIconName;
|
|
16
|
+
provider: 'FontAwesome';
|
|
17
|
+
variant?: never;
|
|
18
|
+
} | {
|
|
19
|
+
name: FontAwesome5RegularIconName;
|
|
20
|
+
provider: 'FontAwesome5';
|
|
21
|
+
variant: 'regular';
|
|
22
|
+
} | {
|
|
23
|
+
name: FontAwesome5SolidIconName;
|
|
24
|
+
provider: 'FontAwesome5';
|
|
25
|
+
variant: 'solid';
|
|
26
|
+
} | {
|
|
27
|
+
name: FontAwesome5BrandIconName;
|
|
28
|
+
provider: 'FontAwesome5';
|
|
29
|
+
variant: 'brand';
|
|
30
|
+
} | {
|
|
31
|
+
name: FontAwesome6RegularIconName;
|
|
32
|
+
provider: 'FontAwesome6';
|
|
33
|
+
variant: 'regular';
|
|
34
|
+
} | {
|
|
35
|
+
name: FontAwesome6SolidIconName;
|
|
36
|
+
provider: 'FontAwesome6';
|
|
37
|
+
variant: 'solid';
|
|
38
|
+
} | {
|
|
39
|
+
name: FontAwesome6BrandIconName;
|
|
40
|
+
provider: 'FontAwesome6';
|
|
41
|
+
variant: 'brand';
|
|
42
|
+
};
|
|
43
|
+
type PortableIconProps = IconSource & {
|
|
44
|
+
color: string;
|
|
45
|
+
size: number;
|
|
46
|
+
style?: StyleProp<TextStyle>;
|
|
47
|
+
testID?: string;
|
|
48
|
+
};
|
|
49
|
+
export declare function PortableIcon(props: PortableIconProps): React.JSX.Element;
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=PortableIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortableIcon.d.ts","sourceRoot":"","sources":["../../../src/primitives/icon/PortableIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC/B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAC/B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAY,KAAK,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC7F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9D,eAAO,MAAM,wBAAwB,sEAK3B,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,wBAAwB,C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E,iBAAiB,qBAsBpD"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { FontAwesome, } from '@react-native-vector-icons/fontawesome/static';
|
|
2
|
+
import { FontAwesome5, } from '@react-native-vector-icons/fontawesome5/static';
|
|
3
|
+
import { FontAwesome6, } from '@react-native-vector-icons/fontawesome6/static';
|
|
4
|
+
import { Ionicons } from '@react-native-vector-icons/ionicons/static';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import {} from 'react-native';
|
|
7
|
+
export const SUPPORTED_ICON_PROVIDERS = [
|
|
8
|
+
'Ionicons',
|
|
9
|
+
'FontAwesome',
|
|
10
|
+
'FontAwesome5',
|
|
11
|
+
'FontAwesome6',
|
|
12
|
+
];
|
|
13
|
+
function assertNever(value, configuration) {
|
|
14
|
+
throw new Error(`Unsupported icon ${configuration}: ${String(value)}`);
|
|
15
|
+
}
|
|
16
|
+
function renderFontAwesome5(props, sharedProps) {
|
|
17
|
+
const { variant } = props;
|
|
18
|
+
switch (variant) {
|
|
19
|
+
case 'brand':
|
|
20
|
+
return <FontAwesome5 {...sharedProps} iconStyle="brand" name={props.name}/>;
|
|
21
|
+
case 'regular':
|
|
22
|
+
return <FontAwesome5 {...sharedProps} iconStyle="regular" name={props.name}/>;
|
|
23
|
+
case 'solid':
|
|
24
|
+
return <FontAwesome5 {...sharedProps} iconStyle="solid" name={props.name}/>;
|
|
25
|
+
default:
|
|
26
|
+
return assertNever(variant, 'FontAwesome5 variant');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function renderFontAwesome6(props, sharedProps) {
|
|
30
|
+
const { variant } = props;
|
|
31
|
+
switch (variant) {
|
|
32
|
+
case 'brand':
|
|
33
|
+
return <FontAwesome6 {...sharedProps} iconStyle="brand" name={props.name}/>;
|
|
34
|
+
case 'regular':
|
|
35
|
+
return <FontAwesome6 {...sharedProps} iconStyle="regular" name={props.name}/>;
|
|
36
|
+
case 'solid':
|
|
37
|
+
return <FontAwesome6 {...sharedProps} iconStyle="solid" name={props.name}/>;
|
|
38
|
+
default:
|
|
39
|
+
return assertNever(variant, 'FontAwesome6 variant');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export function PortableIcon(props) {
|
|
43
|
+
const { provider } = props;
|
|
44
|
+
const sharedProps = {
|
|
45
|
+
color: props.color,
|
|
46
|
+
size: props.size,
|
|
47
|
+
style: props.style,
|
|
48
|
+
testID: props.testID,
|
|
49
|
+
};
|
|
50
|
+
switch (provider) {
|
|
51
|
+
case undefined:
|
|
52
|
+
case 'Ionicons':
|
|
53
|
+
return <Ionicons {...sharedProps} name={props.name}/>;
|
|
54
|
+
case 'FontAwesome':
|
|
55
|
+
return <FontAwesome {...sharedProps} name={props.name}/>;
|
|
56
|
+
case 'FontAwesome5':
|
|
57
|
+
return renderFontAwesome5(props, sharedProps);
|
|
58
|
+
case 'FontAwesome6':
|
|
59
|
+
return renderFontAwesome6(props, sharedProps);
|
|
60
|
+
default:
|
|
61
|
+
return assertNever(provider, 'provider');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=PortableIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PortableIcon.js","sourceRoot":"","sources":["../../../src/primitives/icon/PortableIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,GAEZ,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACL,YAAY,GAIb,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,YAAY,GAIb,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAyB,MAAM,4CAA4C,CAAC;AAC7F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAkC,MAAM,cAAc,CAAC;AAE9D,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,UAAU;IACV,aAAa;IACb,cAAc;IACd,cAAc;CACN,CAAC;AAwBX,SAAS,WAAW,CAAC,KAAY,EAAE,aAAqB;IACtD,MAA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,IAAI,WAAW,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAG,CAAC;QAC/E;YACE,OAAO,WAAW,CAAC,OAAO,EAAE,sBAAsB,CAAC,CAAC;IACxD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC3B,MAAM,WAAW,GAAG;QAClB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,MAAM,EAAE,KAAK,CAAC,MAAM;KACrB,CAAC;IAEF,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,SAAS,CAAC;QACf,KAAK,UAAU;YACb,OAAO,CAAC,QAAQ,CAAC,IAAI,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAG,CAAC;QACzD,KAAK,aAAa;YAChB,OAAO,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAG,CAAC;QAC5D,KAAK,cAAc;YACjB,OAAO,kBAAkB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAChD,KAAK,cAAc;YACjB,OAAO,kBAAkB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAChD;YACE,OAAO,WAAW,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC","sourcesContent":["import {\n FontAwesome,\n type FontAwesomeIconName,\n} from '@react-native-vector-icons/fontawesome/static';\nimport {\n FontAwesome5,\n type FontAwesome5BrandIconName,\n type FontAwesome5RegularIconName,\n type FontAwesome5SolidIconName,\n} from '@react-native-vector-icons/fontawesome5/static';\nimport {\n FontAwesome6,\n type FontAwesome6BrandIconName,\n type FontAwesome6RegularIconName,\n type FontAwesome6SolidIconName,\n} from '@react-native-vector-icons/fontawesome6/static';\nimport { Ionicons, type IoniconsIconName } from '@react-native-vector-icons/ionicons/static';\nimport React from 'react';\nimport { type StyleProp, type TextStyle } from 'react-native';\n\nexport const SUPPORTED_ICON_PROVIDERS = [\n 'Ionicons',\n 'FontAwesome',\n 'FontAwesome5',\n 'FontAwesome6',\n] as const;\n\nexport type IconProvider = (typeof SUPPORTED_ICON_PROVIDERS)[number];\nexport type IconVariant = 'regular' | 'solid' | 'brand';\n\nexport type IconSource =\n | { name: IoniconsIconName; provider?: 'Ionicons'; variant?: never }\n | { name: FontAwesomeIconName; provider: 'FontAwesome'; variant?: never }\n | { name: FontAwesome5RegularIconName; provider: 'FontAwesome5'; variant: 'regular' }\n | { name: FontAwesome5SolidIconName; provider: 'FontAwesome5'; variant: 'solid' }\n | { name: FontAwesome5BrandIconName; provider: 'FontAwesome5'; variant: 'brand' }\n | { name: FontAwesome6RegularIconName; provider: 'FontAwesome6'; variant: 'regular' }\n | { name: FontAwesome6SolidIconName; provider: 'FontAwesome6'; variant: 'solid' }\n | { name: FontAwesome6BrandIconName; provider: 'FontAwesome6'; variant: 'brand' };\n\ntype PortableIconProps = IconSource & {\n color: string;\n size: number;\n style?: StyleProp<TextStyle>;\n testID?: string;\n};\n\ntype SharedIconProps = Pick<PortableIconProps, 'color' | 'size' | 'style' | 'testID'>;\n\nfunction assertNever(value: never, configuration: string): never {\n throw new Error(`Unsupported icon ${configuration}: ${String(value)}`);\n}\n\nfunction renderFontAwesome5(\n props: Extract<IconSource, { provider: 'FontAwesome5' }>,\n sharedProps: SharedIconProps,\n) {\n const { variant } = props;\n\n switch (variant) {\n case 'brand':\n return <FontAwesome5 {...sharedProps} iconStyle=\"brand\" name={props.name} />;\n case 'regular':\n return <FontAwesome5 {...sharedProps} iconStyle=\"regular\" name={props.name} />;\n case 'solid':\n return <FontAwesome5 {...sharedProps} iconStyle=\"solid\" name={props.name} />;\n default:\n return assertNever(variant, 'FontAwesome5 variant');\n }\n}\n\nfunction renderFontAwesome6(\n props: Extract<IconSource, { provider: 'FontAwesome6' }>,\n sharedProps: SharedIconProps,\n) {\n const { variant } = props;\n\n switch (variant) {\n case 'brand':\n return <FontAwesome6 {...sharedProps} iconStyle=\"brand\" name={props.name} />;\n case 'regular':\n return <FontAwesome6 {...sharedProps} iconStyle=\"regular\" name={props.name} />;\n case 'solid':\n return <FontAwesome6 {...sharedProps} iconStyle=\"solid\" name={props.name} />;\n default:\n return assertNever(variant, 'FontAwesome6 variant');\n }\n}\n\nexport function PortableIcon(props: PortableIconProps) {\n const { provider } = props;\n const sharedProps = {\n color: props.color,\n size: props.size,\n style: props.style,\n testID: props.testID,\n };\n\n switch (provider) {\n case undefined:\n case 'Ionicons':\n return <Ionicons {...sharedProps} name={props.name} />;\n case 'FontAwesome':\n return <FontAwesome {...sharedProps} name={props.name} />;\n case 'FontAwesome5':\n return renderFontAwesome5(props, sharedProps);\n case 'FontAwesome6':\n return renderFontAwesome6(props, sharedProps);\n default:\n return assertNever(provider, 'provider');\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/icon/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/icon/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/primitives/icon/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC","sourcesContent":["export type { IconProps, IconProvider } from './Icon';\nexport { Icon } from './Icon';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/primitives/icon/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export type { IconProps, IconProvider, IconSource, IconVariant } from './Icon';\nexport { Icon } from './Icon';\nexport { SUPPORTED_ICON_PROVIDERS } from './PortableIcon';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../src/primitives/image/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,KAAK,CAAC,EACpB,MAAM,EACN,cAAc,EACd,GAAG,EACH,kBAAkB,EAClB,KAAK,EACL,MAAM,EACN,WAAW,EACX,GAAG,EACH,UAAU,EACV,MAAM,EACN,KAAK,EACL,MAAM,EACN,OAAO,GACR,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../src/primitives/image/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,KAAK,CAAC,EACpB,MAAM,EACN,cAAc,EACd,GAAG,EACH,kBAAkB,EAClB,KAAK,EACL,MAAM,EACN,WAAW,EACX,GAAG,EACH,UAAU,EACV,MAAM,EACN,KAAK,EACL,MAAM,EACN,OAAO,GACR,EAAE,UAAU,4BAmCZ"}
|
|
@@ -4,11 +4,9 @@ import { useTheme } from '../../theme/ThemeContext';
|
|
|
4
4
|
import { getSourceKey, normalizeSource, resolveAccessibilityLabel, resolveAlt, resolveImageStyle, resolveRenderedSource, resolveResizeMode, } from './resolveImageProps';
|
|
5
5
|
export function Image({ source, fallbackSource, alt, accessibilityLabel, width, height, aspectRatio, fit, resizeMode, radius, style, testID, onError, }) {
|
|
6
6
|
const { theme } = useTheme();
|
|
7
|
-
const [showFallback, setShowFallback] = React.useState(false);
|
|
8
7
|
const primaryKey = React.useMemo(() => getSourceKey(source), [source]);
|
|
9
|
-
React.
|
|
10
|
-
|
|
11
|
-
}, [primaryKey]);
|
|
8
|
+
const [failedPrimaryKey, setFailedPrimaryKey] = React.useState(null);
|
|
9
|
+
const showFallback = primaryKey !== null && failedPrimaryKey === primaryKey;
|
|
12
10
|
const normalizedPrimary = normalizeSource(source);
|
|
13
11
|
const normalizedFallback = normalizeSource(fallbackSource);
|
|
14
12
|
const resolvedSource = resolveRenderedSource(normalizedPrimary, normalizedFallback, showFallback);
|
|
@@ -21,7 +19,7 @@ export function Image({ source, fallbackSource, alt, accessibilityLabel, width,
|
|
|
21
19
|
return (<RNImage accessibilityLabel={resolvedAccessibilityLabel} accessibilityRole="image" alt={resolvedAlt} onError={(event) => {
|
|
22
20
|
onError?.(event);
|
|
23
21
|
if (!showFallback && normalizedFallback) {
|
|
24
|
-
|
|
22
|
+
setFailedPrimaryKey(primaryKey);
|
|
25
23
|
}
|
|
26
24
|
}} resizeMode={resolvedResizeMode} source={resolvedSource} style={[resolvedStyle, style]} testID={testID}/>);
|
|
27
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.js","sourceRoot":"","sources":["../../../src/primitives/image/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EACL,YAAY,EACZ,eAAe,EACf,yBAAyB,EACzB,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAG7B,MAAM,UAAU,KAAK,CAAC,EACpB,MAAM,EACN,cAAc,EACd,GAAG,EACH,kBAAkB,EAClB,KAAK,EACL,MAAM,EACN,WAAW,EACX,GAAG,EACH,UAAU,EACV,MAAM,EACN,KAAK,EACL,MAAM,EACN,OAAO,GACI;IACX,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,
|
|
1
|
+
{"version":3,"file":"Image.js","sourceRoot":"","sources":["../../../src/primitives/image/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EACL,YAAY,EACZ,eAAe,EACf,yBAAyB,EACzB,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAG7B,MAAM,UAAU,KAAK,CAAC,EACpB,MAAM,EACN,cAAc,EACd,GAAG,EACH,kBAAkB,EAClB,KAAK,EACL,MAAM,EACN,WAAW,EACX,GAAG,EACH,UAAU,EACV,MAAM,EACN,KAAK,EACL,MAAM,EACN,OAAO,GACI;IACX,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IACvE,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACpF,MAAM,YAAY,GAAG,UAAU,KAAK,IAAI,IAAI,gBAAgB,KAAK,UAAU,CAAC;IAE5E,MAAM,iBAAiB,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,kBAAkB,GAAG,eAAe,CAAC,cAAc,CAAC,CAAC;IAC3D,MAAM,cAAc,GAAG,qBAAqB,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,YAAY,CAAC,CAAC;IAElG,IAAI,CAAC,cAAc;QAAE,OAAO,IAAI,CAAC;IAEjC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAC9D,MAAM,0BAA0B,GAAG,yBAAyB,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC;IACtF,MAAM,WAAW,GAAG,UAAU,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC;IACxD,MAAM,aAAa,GAAG,iBAAiB,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC;IAEvF,OAAO,CACL,CAAC,OAAO,CACN,kBAAkB,CAAC,CAAC,0BAA0B,CAAC,CAC/C,iBAAiB,CAAC,OAAO,CACzB,GAAG,CAAC,CAAC,WAAW,CAAC,CACjB,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;YACjB,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;YAEjB,IAAI,CAAC,YAAY,IAAI,kBAAkB,EAAE,CAAC;gBACxC,mBAAmB,CAAC,UAAU,CAAC,CAAC;YAClC,CAAC;QACH,CAAC,CAAC,CACF,UAAU,CAAC,CAAC,kBAAkB,CAAC,CAC/B,MAAM,CAAC,CAAC,cAAc,CAAC,CACvB,KAAK,CAAC,CAAC,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC,CAC9B,MAAM,CAAC,CAAC,MAAM,CAAC,EACf,CACH,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { Image as RNImage } from 'react-native';\n\nimport { useTheme } from '../../theme/ThemeContext';\nimport {\n getSourceKey,\n normalizeSource,\n resolveAccessibilityLabel,\n resolveAlt,\n resolveImageStyle,\n resolveRenderedSource,\n resolveResizeMode,\n} from './resolveImageProps';\nimport type { ImageProps } from './types';\n\nexport function Image({\n source,\n fallbackSource,\n alt,\n accessibilityLabel,\n width,\n height,\n aspectRatio,\n fit,\n resizeMode,\n radius,\n style,\n testID,\n onError,\n}: ImageProps) {\n const { theme } = useTheme();\n const primaryKey = React.useMemo(() => getSourceKey(source), [source]);\n const [failedPrimaryKey, setFailedPrimaryKey] = React.useState<string | null>(null);\n const showFallback = primaryKey !== null && failedPrimaryKey === primaryKey;\n\n const normalizedPrimary = normalizeSource(source);\n const normalizedFallback = normalizeSource(fallbackSource);\n const resolvedSource = resolveRenderedSource(normalizedPrimary, normalizedFallback, showFallback);\n\n if (!resolvedSource) return null;\n\n const resolvedResizeMode = resolveResizeMode(fit, resizeMode);\n const resolvedAccessibilityLabel = resolveAccessibilityLabel(alt, accessibilityLabel);\n const resolvedAlt = resolveAlt(alt, accessibilityLabel);\n const resolvedStyle = resolveImageStyle(theme, { width, height, aspectRatio, radius });\n\n return (\n <RNImage\n accessibilityLabel={resolvedAccessibilityLabel}\n accessibilityRole=\"image\"\n alt={resolvedAlt}\n onError={(event) => {\n onError?.(event);\n\n if (!showFallback && normalizedFallback) {\n setFailedPrimaryKey(primaryKey);\n }\n }}\n resizeMode={resolvedResizeMode}\n source={resolvedSource}\n style={[resolvedStyle, style]}\n testID={testID}\n />\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/surface",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.1",
|
|
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": {
|
|
@@ -27,23 +27,18 @@
|
|
|
27
27
|
"components"
|
|
28
28
|
],
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@
|
|
31
|
-
"
|
|
32
|
-
"react": "
|
|
33
|
-
"react-native": "
|
|
34
|
-
"react
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
"optional": true
|
|
39
|
-
},
|
|
40
|
-
"expo-font": {
|
|
41
|
-
"optional": true
|
|
42
|
-
}
|
|
30
|
+
"@react-native-vector-icons/fontawesome": "^13.1.3",
|
|
31
|
+
"@react-native-vector-icons/fontawesome5": "^13.1.3",
|
|
32
|
+
"@react-native-vector-icons/fontawesome6": "^13.1.3",
|
|
33
|
+
"@react-native-vector-icons/ionicons": "^13.1.3",
|
|
34
|
+
"react": "19.2.3",
|
|
35
|
+
"react-native": "0.86.x",
|
|
36
|
+
"react-native-safe-area-context": "~5.7.0",
|
|
37
|
+
"react-native-web": "~0.21.0"
|
|
43
38
|
},
|
|
44
39
|
"dependencies": {
|
|
45
40
|
"@ankhorage/color-theory": "^0.0.8",
|
|
46
|
-
"@ankhorage/contracts": "^
|
|
41
|
+
"@ankhorage/contracts": "^8.0.0"
|
|
47
42
|
},
|
|
48
43
|
"files": [
|
|
49
44
|
"dist",
|
|
@@ -66,10 +61,10 @@
|
|
|
66
61
|
"access": "public"
|
|
67
62
|
},
|
|
68
63
|
"scripts": {
|
|
69
|
-
"build": "rm -rf dist tsconfig.tsbuildinfo && bun x tsc -p tsconfig.json",
|
|
64
|
+
"build": "rm -rf dist tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo && bun x tsc -p tsconfig.build.json",
|
|
70
65
|
"changeset": "changeset",
|
|
71
66
|
"changeset:status": "changeset status --since=origin/main",
|
|
72
|
-
"docs": "paradox",
|
|
67
|
+
"docs": "paradox && ankhorage-prettier --write README.md paradox",
|
|
73
68
|
"knip": "ankhorage-knip",
|
|
74
69
|
"lint": "ankhorage-eslint . --max-warnings=0",
|
|
75
70
|
"lint:fix": "ankhorage-eslint . --fix --max-warnings=0",
|
|
@@ -81,17 +76,25 @@
|
|
|
81
76
|
"version-packages": "changeset version"
|
|
82
77
|
},
|
|
83
78
|
"devDependencies": {
|
|
84
|
-
"@ankhorage/devtools": "^1.0
|
|
79
|
+
"@ankhorage/devtools": "^1.6.0",
|
|
85
80
|
"@ankhorage/paradox": "^0.1.21",
|
|
81
|
+
"@react-native-vector-icons/fontawesome": "^13.1.3",
|
|
82
|
+
"@react-native-vector-icons/fontawesome5": "^13.1.3",
|
|
83
|
+
"@react-native-vector-icons/fontawesome6": "^13.1.3",
|
|
84
|
+
"@react-native-vector-icons/ionicons": "^13.1.3",
|
|
86
85
|
"@changesets/cli": "^2.31.0",
|
|
87
|
-
"@
|
|
88
|
-
"@types/
|
|
89
|
-
"@types/
|
|
90
|
-
"@types/react": "^19.2.
|
|
91
|
-
"react": "19.
|
|
92
|
-
"
|
|
93
|
-
"react
|
|
94
|
-
"
|
|
86
|
+
"@types/bun": "^1.3.14",
|
|
87
|
+
"@types/node": "^24.13.3",
|
|
88
|
+
"@types/react": "^19.2.18",
|
|
89
|
+
"@types/react-dom": "^19.2.4",
|
|
90
|
+
"@types/react-native-web": "^0.19.2",
|
|
91
|
+
"happy-dom": "^20.11.6",
|
|
92
|
+
"react": "19.2.3",
|
|
93
|
+
"react-dom": "19.2.3",
|
|
94
|
+
"react-native": "0.86.3",
|
|
95
|
+
"react-native-safe-area-context": "~5.7.0",
|
|
96
|
+
"react-native-web": "~0.21.0",
|
|
97
|
+
"typescript": "~6.0.3"
|
|
95
98
|
},
|
|
96
|
-
"packageManager": "bun@1.3.
|
|
99
|
+
"packageManager": "bun@1.3.14"
|
|
97
100
|
}
|
|
@@ -3,6 +3,7 @@ import { Pressable, View } from 'react-native';
|
|
|
3
3
|
|
|
4
4
|
import { FocusScope } from '../../internal/focus/FocusScope';
|
|
5
5
|
import { Portal } from '../../internal/overlay/Portal';
|
|
6
|
+
import { resolvePointerEvents } from '../../internal/resolvePointerEvents';
|
|
6
7
|
import { resolveOverlayAnimation } from '../../internal/resolvers';
|
|
7
8
|
import { Box, Stack, Surface } from '../../layout';
|
|
8
9
|
import { Text } from '../../primitives/text';
|
|
@@ -10,6 +11,8 @@ import { useTheme } from '../../theme/ThemeContext';
|
|
|
10
11
|
import { ActionSheetItem } from './ActionSheetItem';
|
|
11
12
|
import type { ActionSheetProps } from './types';
|
|
12
13
|
|
|
14
|
+
const boxNonePointerEvents = resolvePointerEvents('box-none');
|
|
15
|
+
|
|
13
16
|
export function ActionSheet({
|
|
14
17
|
visible,
|
|
15
18
|
onDismiss,
|
|
@@ -32,14 +35,17 @@ export function ActionSheet({
|
|
|
32
35
|
return (
|
|
33
36
|
<Portal layer="modal" visible={visible}>
|
|
34
37
|
<View
|
|
35
|
-
|
|
36
|
-
style={
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
{...boxNonePointerEvents.props}
|
|
39
|
+
style={[
|
|
40
|
+
boxNonePointerEvents.style,
|
|
41
|
+
{
|
|
42
|
+
bottom: 0,
|
|
43
|
+
left: 0,
|
|
44
|
+
position: 'absolute',
|
|
45
|
+
right: 0,
|
|
46
|
+
top: 0,
|
|
47
|
+
},
|
|
48
|
+
]}
|
|
43
49
|
>
|
|
44
50
|
<Pressable
|
|
45
51
|
onPress={passive ? undefined : closeOnBackdrop ? onDismiss : undefined}
|
|
@@ -31,11 +31,9 @@ export function Button({
|
|
|
31
31
|
{...props}
|
|
32
32
|
disabled={disabled || loading}
|
|
33
33
|
onPress={onPress}
|
|
34
|
-
style={
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
]}
|
|
34
|
+
style={{
|
|
35
|
+
alignSelf: fullWidth ? 'stretch' : 'flex-start',
|
|
36
|
+
}}
|
|
39
37
|
testID={testID}
|
|
40
38
|
>
|
|
41
39
|
{(state) => {
|
|
@@ -74,12 +72,7 @@ export function Button({
|
|
|
74
72
|
<>
|
|
75
73
|
{leadingIcon ? (
|
|
76
74
|
<View style={{ marginRight: theme.spacing.s }}>
|
|
77
|
-
<Icon
|
|
78
|
-
color={colors.contentColor}
|
|
79
|
-
name={leadingIcon.name}
|
|
80
|
-
provider={leadingIcon.provider}
|
|
81
|
-
size={iconSize}
|
|
82
|
-
/>
|
|
75
|
+
<Icon {...leadingIcon} color={colors.contentColor} size={iconSize} />
|
|
83
76
|
</View>
|
|
84
77
|
) : null}
|
|
85
78
|
<Text
|
|
@@ -92,12 +85,7 @@ export function Button({
|
|
|
92
85
|
</Text>
|
|
93
86
|
{trailingIcon ? (
|
|
94
87
|
<View style={{ marginLeft: theme.spacing.s }}>
|
|
95
|
-
<Icon
|
|
96
|
-
color={colors.contentColor}
|
|
97
|
-
name={trailingIcon.name}
|
|
98
|
-
provider={trailingIcon.provider}
|
|
99
|
-
size={iconSize}
|
|
100
|
-
/>
|
|
88
|
+
<Icon {...trailingIcon} color={colors.contentColor} size={iconSize} />
|
|
101
89
|
</View>
|
|
102
90
|
) : null}
|
|
103
91
|
</>
|
|
@@ -3,13 +3,10 @@ import type React from 'react';
|
|
|
3
3
|
import type { ControlSize } from '../../internal/resolvers/resolveControlSize';
|
|
4
4
|
import type { ButtonVariant } from '../../internal/resolvers/resolveInteractiveColors';
|
|
5
5
|
import type { ButtonBaseProps } from '../../primitives/button-base';
|
|
6
|
-
import type {
|
|
6
|
+
import type { IconSource } from '../../primitives/icon';
|
|
7
7
|
import type { SurfaceColor } from '../../surfaceColor';
|
|
8
8
|
|
|
9
|
-
export
|
|
10
|
-
name: IconProps['name'];
|
|
11
|
-
provider?: IconProps['provider'];
|
|
12
|
-
}
|
|
9
|
+
export type ButtonIconSpec = IconSource;
|
|
13
10
|
|
|
14
11
|
export interface ButtonProps extends Omit<
|
|
15
12
|
ButtonBaseProps,
|
|
@@ -3,11 +3,14 @@ import { Pressable, View } from 'react-native';
|
|
|
3
3
|
|
|
4
4
|
import { FocusScope } from '../../internal/focus/FocusScope';
|
|
5
5
|
import { Portal } from '../../internal/overlay/Portal';
|
|
6
|
+
import { resolvePointerEvents } from '../../internal/resolvePointerEvents';
|
|
6
7
|
import { resolveOverlayAnimation } from '../../internal/resolvers';
|
|
7
8
|
import { Box, Surface } from '../../layout';
|
|
8
9
|
import { useTheme } from '../../theme/ThemeContext';
|
|
9
10
|
import type { DrawerProps } from './types';
|
|
10
11
|
|
|
12
|
+
const boxNonePointerEvents = resolvePointerEvents('box-none');
|
|
13
|
+
|
|
11
14
|
export function Drawer({
|
|
12
15
|
visible,
|
|
13
16
|
onDismiss,
|
|
@@ -28,14 +31,17 @@ export function Drawer({
|
|
|
28
31
|
return (
|
|
29
32
|
<Portal layer="drawer" visible={visible}>
|
|
30
33
|
<View
|
|
31
|
-
|
|
32
|
-
style={
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
{...boxNonePointerEvents.props}
|
|
35
|
+
style={[
|
|
36
|
+
boxNonePointerEvents.style,
|
|
37
|
+
{
|
|
38
|
+
bottom: 0,
|
|
39
|
+
left: 0,
|
|
40
|
+
position: 'absolute',
|
|
41
|
+
right: 0,
|
|
42
|
+
top: 0,
|
|
43
|
+
},
|
|
44
|
+
]}
|
|
39
45
|
>
|
|
40
46
|
<Pressable
|
|
41
47
|
onPress={passive ? undefined : closeOnBackdrop ? onDismiss : undefined}
|