@ankhorage/surface 3.3.0 → 3.4.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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @ankhorage/surface
2
2
 
3
+ ## 3.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 313476c: Type SVG Icon styles as view styles while keeping font Icon styles as text styles.
8
+
9
+ ## 3.4.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 2ceb0de: Render SVG assets through the existing `Icon` component by accepting a mutually exclusive
14
+ `source` prop backed by `react-native-svg`.
15
+
3
16
  ## 3.3.0
4
17
 
5
18
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -51,7 +51,7 @@ export type { ButtonBaseProps } from './primitives/button-base';
51
51
  export { ButtonBase } from './primitives/button-base';
52
52
  export type { HeadingLevel, HeadingProps } from './primitives/heading';
53
53
  export { Heading } from './primitives/heading';
54
- export type { IconProps, IconProvider, IconSource, IconVariant } from './primitives/icon';
54
+ export type { FontIconSource, IconProps, IconProvider, IconSource, IconVariant, SvgIconSource, } from './primitives/icon';
55
55
  export { Icon, SUPPORTED_ICON_PROVIDERS } from './primitives/icon';
56
56
  export type { ImageFit, ImageProps, SurfaceImageSource } from './primitives/image';
57
57
  export { Image } from './primitives/image';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACzE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,MAAM,EAA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AE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,cAAc,mBAAmB,CAAC;AAElC,cAAc,UAAU,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAOzC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export type { ActionSheetItemProps, ActionSheetProps } from './components/action-sheet';\nexport { ActionSheet, ActionSheetItem } from './components/action-sheet';\nexport type { BadgeProps } from './components/badge';\nexport { Badge } from './components/badge';\nexport type { ButtonIconSpec, ButtonProps } from './components/button';\nexport { Button } from './components/button';\nexport type { CardProps } from './components/card';\nexport { Card } from './components/card';\nexport type { CheckboxProps } from './components/checkbox';\nexport { Checkbox } from './components/checkbox';\nexport type { DrawerProps } from './components/drawer';\nexport { Drawer } from './components/drawer';\nexport type { FieldProps } from './components/field';\nexport { Field } from './components/field';\nexport type { HelperTextProps } from './components/helper-text';\nexport { HelperText } from './components/helper-text';\nexport type { IconButtonProps } from './components/icon-button';\nexport { IconButton } from './components/icon-button';\nexport type { LabelProps } from './components/label';\nexport { Label } from './components/label';\nexport type { ListItemProps } from './components/list-item';\nexport { ListItem } from './components/list-item';\nexport type { MenuAction, MenuActionIntent, MenuItem, MenuProps } from './components/menu';\nexport { Menu } from './components/menu';\nexport type { ModalProps } from './components/modal';\nexport { Modal } from './components/modal';\nexport type {\n DrawerNavigationItemProps,\n DrawerNavigationProps,\n NavigationItemIcon,\n NavigationItemProps,\n NavigationItemSpec,\n NavigationListProps,\n TabBarItemProps,\n TabBarProps,\n} from './components/navigation';\nexport {\n DrawerNavigation,\n DrawerNavigationItem,\n NavigationItem,\n NavigationList,\n TabBar,\n TabBarItem,\n} from './components/navigation';\nexport type { RadioProps } from './components/radio';\nexport { Radio } from './components/radio';\nexport type { SwitchProps } from './components/switch';\nexport { Switch } from './components/switch';\nexport type { TabListProps, TabPanelProps, TabProps, TabsProps } from './components/tabs';\nexport { Tab, TabList, TabPanel, Tabs } from './components/tabs';\nexport type { TextInputProps } from './components/text-input';\nexport { TextInput } from './components/text-input';\nexport type { TextareaProps } from './components/textarea';\nexport { Textarea } from './components/textarea';\nexport type { ToastOptions, ToastProps, ToastStatus } from './components/toast';\nexport { Toast, ToastProvider, useToast } from './components/toast';\nexport type { TooltipProps } from './components/tooltip';\nexport { Tooltip } from './components/tooltip';\nexport type { FontRuntime } from './context/FontContext';\nexport { FontProvider, useFontContext } from './context/FontContext';\nexport type { I18nInstance, TranslationRuntime, Translator } from './context/TranslationContext';\nexport { TranslationProvider, useTranslationContext } from './context/TranslationContext';\nexport * from './core/responsive';\nexport type { InteractionPolicy, InteractionPolicyProps } from './interactionPolicy';\nexport * from './layout';\nexport type { ButtonBaseProps } from './primitives/button-base';\nexport { ButtonBase } from './primitives/button-base';\nexport type { HeadingLevel, HeadingProps } from './primitives/heading';\nexport { Heading } from './primitives/heading';\nexport type { IconProps, IconProvider, IconSource, IconVariant } from './primitives/icon';\nexport { Icon, SUPPORTED_ICON_PROVIDERS } from './primitives/icon';\nexport type { ImageFit, ImageProps, SurfaceImageSource } from './primitives/image';\nexport { Image } from './primitives/image';\nexport type { TextProps } from './primitives/text';\nexport { Text } from './primitives/text';\nexport type {\n SurfaceColor,\n SurfaceEmphasis,\n SurfacePaletteColor,\n SurfaceStatusColor,\n} from './surfaceColor';\nexport {\n SURFACE_COLORS,\n SURFACE_EMPHASES,\n SURFACE_PALETTE_COLORS,\n SURFACE_STATUS_COLORS,\n} from './surfaceColor';\nexport * from './theme';\nexport { isDeepEqual } from './utils/deepEqual';\nexport { deepMerge } from './utils/deepMerge';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEzE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAW3C,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,MAAM,EACN,UAAU,GACX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEpE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,cAAc,mBAAmB,CAAC;AAElC,cAAc,UAAU,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAS/C,OAAO,EAAE,IAAI,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAOzC,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export type { ActionSheetItemProps, ActionSheetProps } from './components/action-sheet';\nexport { ActionSheet, ActionSheetItem } from './components/action-sheet';\nexport type { BadgeProps } from './components/badge';\nexport { Badge } from './components/badge';\nexport type { ButtonIconSpec, ButtonProps } from './components/button';\nexport { Button } from './components/button';\nexport type { CardProps } from './components/card';\nexport { Card } from './components/card';\nexport type { CheckboxProps } from './components/checkbox';\nexport { Checkbox } from './components/checkbox';\nexport type { DrawerProps } from './components/drawer';\nexport { Drawer } from './components/drawer';\nexport type { FieldProps } from './components/field';\nexport { Field } from './components/field';\nexport type { HelperTextProps } from './components/helper-text';\nexport { HelperText } from './components/helper-text';\nexport type { IconButtonProps } from './components/icon-button';\nexport { IconButton } from './components/icon-button';\nexport type { LabelProps } from './components/label';\nexport { Label } from './components/label';\nexport type { ListItemProps } from './components/list-item';\nexport { ListItem } from './components/list-item';\nexport type { MenuAction, MenuActionIntent, MenuItem, MenuProps } from './components/menu';\nexport { Menu } from './components/menu';\nexport type { ModalProps } from './components/modal';\nexport { Modal } from './components/modal';\nexport type {\n DrawerNavigationItemProps,\n DrawerNavigationProps,\n NavigationItemIcon,\n NavigationItemProps,\n NavigationItemSpec,\n NavigationListProps,\n TabBarItemProps,\n TabBarProps,\n} from './components/navigation';\nexport {\n DrawerNavigation,\n DrawerNavigationItem,\n NavigationItem,\n NavigationList,\n TabBar,\n TabBarItem,\n} from './components/navigation';\nexport type { RadioProps } from './components/radio';\nexport { Radio } from './components/radio';\nexport type { SwitchProps } from './components/switch';\nexport { Switch } from './components/switch';\nexport type { TabListProps, TabPanelProps, TabProps, TabsProps } from './components/tabs';\nexport { Tab, TabList, TabPanel, Tabs } from './components/tabs';\nexport type { TextInputProps } from './components/text-input';\nexport { TextInput } from './components/text-input';\nexport type { TextareaProps } from './components/textarea';\nexport { Textarea } from './components/textarea';\nexport type { ToastOptions, ToastProps, ToastStatus } from './components/toast';\nexport { Toast, ToastProvider, useToast } from './components/toast';\nexport type { TooltipProps } from './components/tooltip';\nexport { Tooltip } from './components/tooltip';\nexport type { FontRuntime } from './context/FontContext';\nexport { FontProvider, useFontContext } from './context/FontContext';\nexport type { I18nInstance, TranslationRuntime, Translator } from './context/TranslationContext';\nexport { TranslationProvider, useTranslationContext } from './context/TranslationContext';\nexport * from './core/responsive';\nexport type { InteractionPolicy, InteractionPolicyProps } from './interactionPolicy';\nexport * from './layout';\nexport type { ButtonBaseProps } from './primitives/button-base';\nexport { ButtonBase } from './primitives/button-base';\nexport type { HeadingLevel, HeadingProps } from './primitives/heading';\nexport { Heading } from './primitives/heading';\nexport type {\n FontIconSource,\n IconProps,\n IconProvider,\n IconSource,\n IconVariant,\n SvgIconSource,\n} from './primitives/icon';\nexport { Icon, SUPPORTED_ICON_PROVIDERS } from './primitives/icon';\nexport type { ImageFit, ImageProps, SurfaceImageSource } from './primitives/image';\nexport { Image } from './primitives/image';\nexport type { TextProps } from './primitives/text';\nexport { Text } from './primitives/text';\nexport type {\n SurfaceColor,\n SurfaceEmphasis,\n SurfacePaletteColor,\n SurfaceStatusColor,\n} from './surfaceColor';\nexport {\n SURFACE_COLORS,\n SURFACE_EMPHASES,\n SURFACE_PALETTE_COLORS,\n SURFACE_STATUS_COLORS,\n} from './surfaceColor';\nexport * from './theme';\nexport { isDeepEqual } from './utils/deepEqual';\nexport { deepMerge } from './utils/deepMerge';\n"]}
@@ -1,13 +1,16 @@
1
- import { type StyleProp, type TextStyle } from 'react-native';
1
+ import { type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
2
2
  import type { SurfaceTheme } from '../../theme/types';
3
- import { type IconSource } from './PortableIcon';
4
- export type { IconProvider, IconSource, IconVariant } from './PortableIcon';
3
+ import { type FontIconSource, type SvgIconSource } from './PortableIcon';
4
+ export type { FontIconSource, IconProvider, IconSource, IconVariant, SvgIconSource, } from './PortableIcon';
5
5
  interface IconPresentationProps {
6
6
  size?: keyof SurfaceTheme['spacing'] | number;
7
7
  color?: keyof SurfaceTheme['colors'] | string;
8
- style?: StyleProp<TextStyle>;
9
8
  testID?: string;
10
9
  }
11
- export type IconProps = IconSource & IconPresentationProps;
10
+ export type IconProps = (FontIconSource & IconPresentationProps & {
11
+ style?: StyleProp<TextStyle>;
12
+ }) | (SvgIconSource & IconPresentationProps & {
13
+ style?: StyleProp<ViewStyle>;
14
+ });
12
15
  export declare function Icon(props: IconProps): import("react").JSX.Element;
13
16
  //# 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,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
+ {"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/primitives/icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,KAAK,cAAc,EAAgB,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEvF,YAAY,EACV,cAAc,EACd,YAAY,EACZ,UAAU,EACV,WAAW,EACX,aAAa,GACd,MAAM,gBAAgB,CAAC;AAExB,UAAU,qBAAqB;IAC7B,IAAI,CAAC,EAAE,MAAM,YAAY,CAAC,SAAS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AAC,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"]}
1
+ {"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../src/primitives/icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkD,MAAM,cAAc,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAuB,YAAY,EAAsB,MAAM,gBAAgB,CAAC;AAoBvF,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, type ViewStyle } from 'react-native';\n\nimport { resolveToken } from '../../theme/resolveToken';\nimport { useTheme } from '../../theme/ThemeContext';\nimport type { SurfaceTheme } from '../../theme/types';\nimport { type FontIconSource, PortableIcon, type SvgIconSource } from './PortableIcon';\n\nexport type {\n FontIconSource,\n IconProvider,\n IconSource,\n IconVariant,\n SvgIconSource,\n} from './PortableIcon';\n\ninterface IconPresentationProps {\n size?: keyof SurfaceTheme['spacing'] | number;\n color?: keyof SurfaceTheme['colors'] | string;\n testID?: string;\n}\n\nexport type IconProps =\n | (FontIconSource & IconPresentationProps & { style?: StyleProp<TextStyle> })\n | (SvgIconSource & IconPresentationProps & { style?: StyleProp<ViewStyle> });\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"]}
@@ -4,11 +4,12 @@ import { type FontAwesome6BrandIconName, type FontAwesome6RegularIconName, type
4
4
  import { type IoniconsIconName } from '@react-native-vector-icons/ionicons/static';
5
5
  import { type MaterialDesignIconsIconName } from '@react-native-vector-icons/material-design-icons/static';
6
6
  import React from 'react';
7
- import { type StyleProp, type TextStyle } from 'react-native';
7
+ import { type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
8
+ import type { SurfaceImageSource } from '../image';
8
9
  export declare const SUPPORTED_ICON_PROVIDERS: readonly ["Ionicons", "FontAwesome", "FontAwesome5", "FontAwesome6", "MaterialDesignIcons"];
9
10
  export type IconProvider = (typeof SUPPORTED_ICON_PROVIDERS)[number];
10
11
  export type IconVariant = 'regular' | 'solid' | 'brand';
11
- export type IconSource = {
12
+ export type FontIconSource = {
12
13
  name: IoniconsIconName;
13
14
  provider?: 'Ionicons';
14
15
  variant?: never;
@@ -45,12 +46,25 @@ export type IconSource = {
45
46
  provider: 'MaterialDesignIcons';
46
47
  variant?: never;
47
48
  };
48
- type PortableIconProps = IconSource & {
49
+ export interface SvgIconSource {
50
+ source: SurfaceImageSource;
51
+ name?: never;
52
+ provider?: never;
53
+ variant?: never;
54
+ }
55
+ export type IconSource = FontIconSource | SvgIconSource;
56
+ interface PortableIconPresentationProps {
49
57
  color: string;
50
58
  size: number;
51
- style?: StyleProp<TextStyle>;
52
59
  testID?: string;
60
+ }
61
+ type FontPortableIconProps = FontIconSource & PortableIconPresentationProps & {
62
+ style?: StyleProp<TextStyle>;
63
+ };
64
+ type SvgPortableIconProps = SvgIconSource & PortableIconPresentationProps & {
65
+ style?: StyleProp<ViewStyle>;
53
66
  };
67
+ type PortableIconProps = FontPortableIconProps | SvgPortableIconProps;
54
68
  export declare function PortableIcon(props: PortableIconProps): React.JSX.Element;
55
69
  export {};
56
70
  //# sourceMappingURL=PortableIcon.d.ts.map
@@ -1 +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,EA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,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,aAAa,CAAC;AAExD,UAAU,6BAA6B;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,KAAK,qBAAqB,GAAG,cAAc,GACzC,6BAA6B,GAAG;IAC9B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAEJ,KAAK,oBAAoB,GAAG,aAAa,GACvC,6BAA6B,GAAG;IAC9B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAEJ,KAAK,iBAAiB,GAAG,qBAAqB,GAAG,oBAAoB,CAAC;AAqDtE,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,qBAqCpD"}
@@ -4,7 +4,8 @@ import { FontAwesome6, } from '@react-native-vector-icons/fontawesome6/static';
4
4
  import { Ionicons } from '@react-native-vector-icons/ionicons/static';
5
5
  import { MaterialDesignIcons, } from '@react-native-vector-icons/material-design-icons/static';
6
6
  import React from 'react';
7
- import {} from 'react-native';
7
+ import { Image } from 'react-native';
8
+ import { SvgUri } from 'react-native-svg';
8
9
  export const SUPPORTED_ICON_PROVIDERS = [
9
10
  'Ionicons',
10
11
  'FontAwesome',
@@ -12,6 +13,12 @@ export const SUPPORTED_ICON_PROVIDERS = [
12
13
  'FontAwesome6',
13
14
  'MaterialDesignIcons',
14
15
  ];
16
+ /*** Resolve either a direct URI or a React Native bundled image module to its SVG URI. */
17
+ function resolveSvgIconUri(source) {
18
+ if (typeof source === 'string')
19
+ return source;
20
+ return Image.resolveAssetSource(source).uri;
21
+ }
15
22
  function assertNever(value, configuration) {
16
23
  throw new Error(`Unsupported icon ${configuration}: ${String(value)}`);
17
24
  }
@@ -42,6 +49,9 @@ function renderFontAwesome6(props, sharedProps) {
42
49
  }
43
50
  }
44
51
  export function PortableIcon(props) {
52
+ if ('source' in props) {
53
+ return (<SvgUri color={props.color} height={props.size} style={props.style} testID={props.testID} uri={resolveSvgIconUri(props.source)} width={props.size}/>);
54
+ }
45
55
  const { provider } = props;
46
56
  const sharedProps = {
47
57
  color: props.color,
@@ -1 +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,EACL,mBAAmB,GAEpB,MAAM,yDAAyD,CAAC;AACjE,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;IACd,qBAAqB;CACb,CAAC;AAyBX,SAAS,WAAW,CAAC,KAAY,EAAE,aAAqB;IACtD,MAAM,IAAI,KAAK,CAAC,oBAAoB,aAAa,KAAK,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACzE,CAAC;AAED,SAAS,kBAAkB,CACzB,KAAwD,EACxD,WAA4B;IAE5B,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAE1B,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,OAAO;YACV,OAAO,CAAC,YAAY,CAAC,IAAI,WAAW,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAG,CAAC;QAC/E,KAAK,SAAS;YACZ,OAAO,CAAC,YAAY,CAAC,IAAI,WAAW,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IA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AAS,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,KAAK,qBAAqB;YACxB,OAAO,CAAC,mBAAmB,CAAC,IAAI,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAG,CAAC;QACpE;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 {\n MaterialDesignIcons,\n type MaterialDesignIconsIconName,\n} from '@react-native-vector-icons/material-design-icons/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 'MaterialDesignIcons',\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 | { name: MaterialDesignIconsIconName; provider: 'MaterialDesignIcons'; variant?: never };\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 case 'MaterialDesignIcons':\n return <MaterialDesignIcons {...sharedProps} name={props.name} />;\n default:\n return assertNever(provider, 'provider');\n }\n}\n"]}
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,EACL,mBAAmB,GAEpB,MAAM,yDAAyD,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAkD,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAI1C,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,UAAU;IACV,aAAa;IACb,cAAc;IACd,cAAc;IACd,qBAAqB;CACb,CAAC;AA+CX,0FAA0F;AAC1F,SAAS,iBAAiB,CAAC,MAA0B;IACnD,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC;IAE9C,OAAO,KAAK,CAAC,kBAAkB,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AAC,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,KAAK,qBAAqB;YACxB,OAAO,CAAC,mBAAmB,CAAC,IAAI,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAG,CAAC;QACpE;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 {\n MaterialDesignIcons,\n type MaterialDesignIconsIconName,\n} from '@react-native-vector-icons/material-design-icons/static';\nimport React from 'react';\nimport { Image, type StyleProp, type TextStyle, type ViewStyle } from 'react-native';\nimport { SvgUri } from 'react-native-svg';\n\nimport type { SurfaceImageSource } from '../image';\n\nexport const SUPPORTED_ICON_PROVIDERS = [\n 'Ionicons',\n 'FontAwesome',\n 'FontAwesome5',\n 'FontAwesome6',\n 'MaterialDesignIcons',\n] as const;\n\nexport type IconProvider = (typeof SUPPORTED_ICON_PROVIDERS)[number];\nexport type IconVariant = 'regular' | 'solid' | 'brand';\n\nexport type FontIconSource =\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 | { name: MaterialDesignIconsIconName; provider: 'MaterialDesignIcons'; variant?: never };\n\nexport interface SvgIconSource {\n source: SurfaceImageSource;\n name?: never;\n provider?: never;\n variant?: never;\n}\n\nexport type IconSource = FontIconSource | SvgIconSource;\n\ninterface PortableIconPresentationProps {\n color: string;\n size: number;\n testID?: string;\n}\n\ntype FontPortableIconProps = FontIconSource &\n PortableIconPresentationProps & {\n style?: StyleProp<TextStyle>;\n };\n\ntype SvgPortableIconProps = SvgIconSource &\n PortableIconPresentationProps & {\n style?: StyleProp<ViewStyle>;\n };\n\ntype PortableIconProps = FontPortableIconProps | SvgPortableIconProps;\n\ntype SharedIconProps = PortableIconPresentationProps & {\n style?: StyleProp<TextStyle>;\n};\n\n/*** Resolve either a direct URI or a React Native bundled image module to its SVG URI. */\nfunction resolveSvgIconUri(source: SurfaceImageSource): string {\n if (typeof source === 'string') return source;\n\n return Image.resolveAssetSource(source).uri;\n}\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 if ('source' in props) {\n return (\n <SvgUri\n color={props.color}\n height={props.size}\n style={props.style}\n testID={props.testID}\n uri={resolveSvgIconUri(props.source)}\n width={props.size}\n />\n );\n }\n\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 case 'MaterialDesignIcons':\n return <MaterialDesignIcons {...sharedProps} name={props.name} />;\n default:\n return assertNever(provider, 'provider');\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- export type { IconProps, IconProvider, IconSource, IconVariant } from './Icon';
1
+ export type { FontIconSource, IconProps, IconProvider, IconSource, IconVariant, SvgIconSource, } from './Icon';
2
2
  export { Icon } from './Icon';
3
3
  export { SUPPORTED_ICON_PROVIDERS } from './PortableIcon';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -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,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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/icon/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,cAAc,EACd,SAAS,EACT,YAAY,EACZ,UAAU,EACV,WAAW,EACX,aAAa,GACd,MAAM,QAAQ,CAAC;AAChB,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;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
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/primitives/icon/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export type {\n FontIconSource,\n IconProps,\n IconProvider,\n IconSource,\n IconVariant,\n SvgIconSource,\n} from './Icon';\nexport { Icon } from './Icon';\nexport { SUPPORTED_ICON_PROVIDERS } from './PortableIcon';\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/surface",
3
3
  "type": "module",
4
- "version": "3.3.0",
4
+ "version": "3.4.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": {
@@ -35,6 +35,7 @@
35
35
  "react": "19.2.3",
36
36
  "react-native": "0.86.x",
37
37
  "react-native-safe-area-context": "~5.7.0",
38
+ "react-native-svg": "15.15.4",
38
39
  "react-native-web": "~0.21.0"
39
40
  },
40
41
  "dependencies": {
@@ -85,7 +86,7 @@
85
86
  "version-packages": "ankhorage-changeset version"
86
87
  },
87
88
  "devDependencies": {
88
- "@ankhorage/devtools": "^1.9.4",
89
+ "@ankhorage/devtools": "^1.10.2",
89
90
  "@ankhorage/paradox": "^0.1.24",
90
91
  "@react-native-vector-icons/fontawesome": "^13.1.3",
91
92
  "@react-native-vector-icons/fontawesome5": "^13.1.3",
@@ -102,6 +103,7 @@
102
103
  "react-dom": "19.2.3",
103
104
  "react-native": "0.86.3",
104
105
  "react-native-safe-area-context": "~5.7.0",
106
+ "react-native-svg": "15.15.4",
105
107
  "react-native-web": "~0.21.0",
106
108
  "typescript": "~6.0.3"
107
109
  },
package/src/index.test.ts CHANGED
@@ -85,6 +85,8 @@ describe('public package contract', () => {
85
85
  it('supports RN 0.86 patches while validating the canonical RN 0.86.3 baseline', () => {
86
86
  expect(packageJson.peerDependencies['react-native']).toBe('0.86.x');
87
87
  expect(packageJson.devDependencies['react-native']).toBe('0.86.3');
88
+ expect(packageJson.peerDependencies['react-native-svg']).toBe('15.15.4');
89
+ expect(packageJson.devDependencies['react-native-svg']).toBe('15.15.4');
88
90
  });
89
91
 
90
92
  it('exports the resolved semantic and diagnostic contracts from the public root', () => {
package/src/index.ts CHANGED
@@ -67,7 +67,14 @@ export type { ButtonBaseProps } from './primitives/button-base';
67
67
  export { ButtonBase } from './primitives/button-base';
68
68
  export type { HeadingLevel, HeadingProps } from './primitives/heading';
69
69
  export { Heading } from './primitives/heading';
70
- export type { IconProps, IconProvider, IconSource, IconVariant } from './primitives/icon';
70
+ export type {
71
+ FontIconSource,
72
+ IconProps,
73
+ IconProvider,
74
+ IconSource,
75
+ IconVariant,
76
+ SvgIconSource,
77
+ } from './primitives/icon';
71
78
  export { Icon, SUPPORTED_ICON_PROVIDERS } from './primitives/icon';
72
79
  export type { ImageFit, ImageProps, SurfaceImageSource } from './primitives/image';
73
80
  export { Image } from './primitives/image';
@@ -1,20 +1,27 @@
1
- import { type StyleProp, type TextStyle } from 'react-native';
1
+ import { type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
2
2
 
3
3
  import { resolveToken } from '../../theme/resolveToken';
4
4
  import { useTheme } from '../../theme/ThemeContext';
5
5
  import type { SurfaceTheme } from '../../theme/types';
6
- import { type IconSource, PortableIcon } from './PortableIcon';
6
+ import { type FontIconSource, PortableIcon, type SvgIconSource } from './PortableIcon';
7
7
 
8
- export type { IconProvider, IconSource, IconVariant } from './PortableIcon';
8
+ export type {
9
+ FontIconSource,
10
+ IconProvider,
11
+ IconSource,
12
+ IconVariant,
13
+ SvgIconSource,
14
+ } from './PortableIcon';
9
15
 
10
16
  interface IconPresentationProps {
11
17
  size?: keyof SurfaceTheme['spacing'] | number;
12
18
  color?: keyof SurfaceTheme['colors'] | string;
13
- style?: StyleProp<TextStyle>;
14
19
  testID?: string;
15
20
  }
16
21
 
17
- export type IconProps = IconSource & IconPresentationProps;
22
+ export type IconProps =
23
+ | (FontIconSource & IconPresentationProps & { style?: StyleProp<TextStyle> })
24
+ | (SvgIconSource & IconPresentationProps & { style?: StyleProp<ViewStyle> });
18
25
 
19
26
  export function Icon(props: IconProps) {
20
27
  const { theme } = useTheme();
@@ -20,7 +20,10 @@ import {
20
20
  type MaterialDesignIconsIconName,
21
21
  } from '@react-native-vector-icons/material-design-icons/static';
22
22
  import React from 'react';
23
- import { type StyleProp, type TextStyle } from 'react-native';
23
+ import { Image, type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
24
+ import { SvgUri } from 'react-native-svg';
25
+
26
+ import type { SurfaceImageSource } from '../image';
24
27
 
25
28
  export const SUPPORTED_ICON_PROVIDERS = [
26
29
  'Ionicons',
@@ -33,7 +36,7 @@ export const SUPPORTED_ICON_PROVIDERS = [
33
36
  export type IconProvider = (typeof SUPPORTED_ICON_PROVIDERS)[number];
34
37
  export type IconVariant = 'regular' | 'solid' | 'brand';
35
38
 
36
- export type IconSource =
39
+ export type FontIconSource =
37
40
  | { name: IoniconsIconName; provider?: 'Ionicons'; variant?: never }
38
41
  | { name: FontAwesomeIconName; provider: 'FontAwesome'; variant?: never }
39
42
  | { name: FontAwesome5RegularIconName; provider: 'FontAwesome5'; variant: 'regular' }
@@ -44,14 +47,43 @@ export type IconSource =
44
47
  | { name: FontAwesome6BrandIconName; provider: 'FontAwesome6'; variant: 'brand' }
45
48
  | { name: MaterialDesignIconsIconName; provider: 'MaterialDesignIcons'; variant?: never };
46
49
 
47
- type PortableIconProps = IconSource & {
50
+ export interface SvgIconSource {
51
+ source: SurfaceImageSource;
52
+ name?: never;
53
+ provider?: never;
54
+ variant?: never;
55
+ }
56
+
57
+ export type IconSource = FontIconSource | SvgIconSource;
58
+
59
+ interface PortableIconPresentationProps {
48
60
  color: string;
49
61
  size: number;
50
- style?: StyleProp<TextStyle>;
51
62
  testID?: string;
63
+ }
64
+
65
+ type FontPortableIconProps = FontIconSource &
66
+ PortableIconPresentationProps & {
67
+ style?: StyleProp<TextStyle>;
68
+ };
69
+
70
+ type SvgPortableIconProps = SvgIconSource &
71
+ PortableIconPresentationProps & {
72
+ style?: StyleProp<ViewStyle>;
73
+ };
74
+
75
+ type PortableIconProps = FontPortableIconProps | SvgPortableIconProps;
76
+
77
+ type SharedIconProps = PortableIconPresentationProps & {
78
+ style?: StyleProp<TextStyle>;
52
79
  };
53
80
 
54
- type SharedIconProps = Pick<PortableIconProps, 'color' | 'size' | 'style' | 'testID'>;
81
+ /*** Resolve either a direct URI or a React Native bundled image module to its SVG URI. */
82
+ function resolveSvgIconUri(source: SurfaceImageSource): string {
83
+ if (typeof source === 'string') return source;
84
+
85
+ return Image.resolveAssetSource(source).uri;
86
+ }
55
87
 
56
88
  function assertNever(value: never, configuration: string): never {
57
89
  throw new Error(`Unsupported icon ${configuration}: ${String(value)}`);
@@ -94,6 +126,19 @@ function renderFontAwesome6(
94
126
  }
95
127
 
96
128
  export function PortableIcon(props: PortableIconProps) {
129
+ if ('source' in props) {
130
+ return (
131
+ <SvgUri
132
+ color={props.color}
133
+ height={props.size}
134
+ style={props.style}
135
+ testID={props.testID}
136
+ uri={resolveSvgIconUri(props.source)}
137
+ width={props.size}
138
+ />
139
+ );
140
+ }
141
+
97
142
  const { provider } = props;
98
143
  const sharedProps = {
99
144
  color: props.color,
@@ -6,6 +6,15 @@ import { renderToStaticMarkup } from 'react-dom/server';
6
6
  import * as ReactNativeWeb from 'react-native-web';
7
7
 
8
8
  await mock.module('react-native', () => ReactNativeWeb);
9
+ await mock.module('react-native-svg', () => ({
10
+ SvgUri: ({ color, height, uri, width }: Record<string, unknown>) =>
11
+ React.createElement('svg', {
12
+ 'data-color': color,
13
+ 'data-uri': uri,
14
+ height,
15
+ width,
16
+ }),
17
+ }));
9
18
 
10
19
  const { Icon } = await import('./Icon');
11
20
  const { PortableIcon, SUPPORTED_ICON_PROVIDERS } = await import('./PortableIcon');
@@ -56,6 +65,17 @@ describe('portable icon rendering', () => {
56
65
 
57
66
  expect(markup).toContain('font-family:MaterialDesignIcons');
58
67
  });
68
+
69
+ test('renders an SVG URI through the same public Icon API', () => {
70
+ const markup = renderToStaticMarkup(
71
+ <Icon color="#123456" size={18} source="https://example.com/icons/home.svg" />,
72
+ );
73
+
74
+ expect(markup).toContain('data-uri="https://example.com/icons/home.svg"');
75
+ expect(markup).toContain('data-color="#123456"');
76
+ expect(markup).toContain('width="18"');
77
+ expect(markup).toContain('height="18"');
78
+ });
59
79
  });
60
80
 
61
81
  describe('portable icon contract', () => {
@@ -1,3 +1,10 @@
1
- export type { IconProps, IconProvider, IconSource, IconVariant } from './Icon';
1
+ export type {
2
+ FontIconSource,
3
+ IconProps,
4
+ IconProvider,
5
+ IconSource,
6
+ IconVariant,
7
+ SvgIconSource,
8
+ } from './Icon';
2
9
  export { Icon } from './Icon';
3
10
  export { SUPPORTED_ICON_PROVIDERS } from './PortableIcon';