@ankhorage/surface 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +10 -1
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +1 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/internal/overlay/useOverlayStack.d.ts +0 -1
  8. package/dist/internal/overlay/useOverlayStack.d.ts.map +1 -1
  9. package/dist/internal/overlay/useOverlayStack.js +0 -3
  10. package/dist/internal/overlay/useOverlayStack.js.map +1 -1
  11. package/dist/internal/resolvers/resolveFieldState.d.ts +2 -1
  12. package/dist/internal/resolvers/resolveFieldState.d.ts.map +1 -1
  13. package/dist/internal/resolvers/resolveFieldState.js.map +1 -1
  14. package/dist/layout/AppBar.d.ts +13 -0
  15. package/dist/layout/AppBar.d.ts.map +1 -0
  16. package/dist/layout/AppBar.js +31 -0
  17. package/dist/layout/AppBar.js.map +1 -0
  18. package/dist/layout/helpers.d.ts +1 -4
  19. package/dist/layout/helpers.d.ts.map +1 -1
  20. package/dist/layout/helpers.js +3 -3
  21. package/dist/layout/helpers.js.map +1 -1
  22. package/dist/layout/index.d.ts +2 -0
  23. package/dist/layout/index.d.ts.map +1 -1
  24. package/dist/layout/index.js +1 -0
  25. package/dist/layout/index.js.map +1 -1
  26. package/dist/primitives/image/Image.d.ts +4 -0
  27. package/dist/primitives/image/Image.d.ts.map +1 -0
  28. package/dist/primitives/image/Image.js +28 -0
  29. package/dist/primitives/image/Image.js.map +1 -0
  30. package/dist/primitives/image/index.d.ts +3 -0
  31. package/dist/primitives/image/index.d.ts.map +1 -0
  32. package/dist/primitives/image/index.js +2 -0
  33. package/dist/primitives/image/index.js.map +1 -0
  34. package/dist/primitives/image/resolveImageProps.d.ts +12 -0
  35. package/dist/primitives/image/resolveImageProps.d.ts.map +1 -0
  36. package/dist/primitives/image/resolveImageProps.js +67 -0
  37. package/dist/primitives/image/resolveImageProps.js.map +1 -0
  38. package/dist/primitives/image/types.d.ts +21 -0
  39. package/dist/primitives/image/types.d.ts.map +1 -0
  40. package/dist/primitives/image/types.js +2 -0
  41. package/dist/primitives/image/types.js.map +1 -0
  42. package/package.json +11 -8
  43. package/src/index.test.ts +1 -0
  44. package/src/index.ts +2 -0
  45. package/src/internal/overlay/useOverlayStack.ts +0 -4
  46. package/src/internal/resolvers/resolveFieldState.ts +1 -1
  47. package/src/layout/AppBar.tsx +61 -0
  48. package/src/layout/helpers.ts +4 -10
  49. package/src/layout/index.ts +2 -0
  50. package/src/primitives/image/Image.tsx +68 -0
  51. package/src/primitives/image/index.ts +2 -0
  52. package/src/primitives/image/resolveImageProps.test.ts +81 -0
  53. package/src/primitives/image/resolveImageProps.ts +92 -0
  54. package/src/primitives/image/types.ts +28 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @ankhorage/surface
2
2
 
3
+ ## 1.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 4e168c9: Add a low-level `AppBar` layout primitive with leading, center, and trailing slots.
8
+
9
+ The new primitive is navigator-agnostic, supports optional safe-area top padding via `react-native-safe-area-context`, and keeps visual styling minimal with an optional divider. It is intended as the Surface foundation for future product-facing AppBar components in ZORA.
10
+
11
+ ## 1.2.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 73fd969: Add a render-only Image primitive.
16
+
17
+ This introduces a Surface `Image` component with string and React Native image source support, token-aware sizing and radius props, `fit`/`resizeMode` behavior, accessibility label mapping, and provider-neutral `fallbackSource` handling for load errors.
18
+
3
19
  ## 1.1.0
4
20
 
5
21
  ### Minor Changes
package/README.md CHANGED
@@ -23,9 +23,18 @@ bun add @ankhorage/surface
23
23
  ## 📦 Usage
24
24
 
25
25
  ```tsx
26
- import { Box, Text } from '@ankhorage/surface';
26
+ import { Box, Image, Text } from '@ankhorage/surface';
27
27
 
28
28
  <Box padding="lg" gap="md">
29
+ <Image
30
+ alt="Hero image"
31
+ fallbackSource="https://example.com/hero-fallback.jpg"
32
+ fit="cover"
33
+ height={240}
34
+ radius="l"
35
+ source="https://example.com/hero.jpg"
36
+ width="100%"
37
+ />
29
38
  <Text variant="title">Title</Text>
30
39
  <Text>Content</Text>
31
40
  </Box>;
package/dist/index.d.ts CHANGED
@@ -50,6 +50,8 @@ export type { HeadingLevel, HeadingProps } from './primitives/heading';
50
50
  export { Heading } from './primitives/heading';
51
51
  export type { IconProps, IconProvider } from './primitives/icon';
52
52
  export { Icon } from './primitives/icon';
53
+ export type { ImageFit, ImageProps, SurfaceImageSource } from './primitives/image';
54
+ export { Image } from './primitives/image';
53
55
  export type { TextProps } from './primitives/text';
54
56
  export { Text } from './primitives/text';
55
57
  export * from './theme';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,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,EAAE,MAAM,qBAAqB,CAAC;AAC7C,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,YAAY,EAAE,eAAe,EAAE,MAAM,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AAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACrE,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AACjG,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,YAAY,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ export * from './layout';
25
25
  export { ButtonBase } from './primitives/button-base';
26
26
  export { Heading } from './primitives/heading';
27
27
  export { Icon } from './primitives/icon';
28
+ export { Image } from './primitives/image';
28
29
  export { Text } from './primitives/text';
29
30
  export * from './theme';
30
31
  export { isD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,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;AAClC,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,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export 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 { 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, ToastTone } 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 * 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 } from './primitives/icon';\nexport { Icon } from './primitives/icon';\nexport type { TextProps } from './primitives/text';\nexport { Text } from './primitives/text';\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,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,EAA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,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export 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 { 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, ToastTone } 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 * 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 } from './primitives/icon';\nexport { Icon } 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 * from './theme';\nexport { isDeepEqual } from './utils/deepEqual';\nexport { deepMerge } from './utils/deepMerge';\n"]}
@@ -21,7 +21,6 @@ export interface OverlayStackRuntime extends OverlayStackActions {
21
21
  export declare function sortOverlayEntries(entries: OverlayEntry[]): OverlayEntry[];
22
22
  export declare const OverlayStackContext: React.Context<OverlayStackRuntime | null>;
23
23
  export declare const OverlayStackActionsContext: React.Context<OverlayStackActions | null>;
24
- export declare function useOverlayStack(): OverlayStackRuntime | null;
25
24
  export declare function useOverlayStackActions(): OverlayStackActions | null;
26
25
  export declare function createOverlayEntry(id: string, order: number, descriptor: OverlayDescriptor): OverlayEntry;
27
26
  //# sourceMappingURL=useOverlayStack.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useOverlayStack.d.ts","sourceRoot":"","sources":["../../../src/internal/overlay/useOverlayStack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,YA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EAAE,YAAY,CAAC;IACpB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,YAAY,CAAC;IACpB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC7D,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;IAC9D,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC1B;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CAiB1E;AAED,eAAO,MAAM,mBAAmB,2CAAwD,CAAC;AAEzF,eAAO,MAAM,0BAA0B,2CAAwD,CAAC;AAEhG,wBAAgB,sBAAsB,IAAI,mBAAmB,GAAG,IAAI,CAEnE;AAED,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,iBAAiB,GAC5B,YAAY,CAQd"}
@@ -16,9 +16,6 @@ export function sortOverlayEntries(entries) {
16
16
  }
17
17
  export const OverlayStackContext = React.createContext(null);
18
18
  export const OverlayStackActionsContext = React.createContext(null);
19
- export function useOverlayStack() {
20
- return React.useContext(OverlayStackContext);
21
- }
22
19
  export function useOverlayStackActions() {
23
20
  return React.useContext(OverlayStackActionsContext);
24
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useOverlayStack.js","sourceRoot":"","sources":["../../../src/internal/overlay/useOverlayStack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAqB,oBAAoB,EAAE,MAAM,mCAAm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EACV,KAAa,EACb,UAA6B;IAE7B,OAAO;QACL,EAAE;QACF,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,KAAK;QACL,MAAM,EAAE,oBAAoB,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;KAClD,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport { type OverlayLayer, resolveOverlayZIndex } from '../resolvers/resolveOverlayZIndex';\n\nexport interface OverlayEntry {\n id: string;\n layer: OverlayLayer;\n node: React.ReactNode;\n order: number;\n zIndex: number;\n}\n\nexport interface OverlayDescriptor {\n layer: OverlayLayer;\n node: React.ReactNode;\n}\n\nexport interface OverlayStackActions {\n setOverlay: (id: string, overlay: OverlayDescriptor) => void;\n removeOverlay: (id: string) => void;\n}\n\nexport interface OverlayStackRuntime extends OverlayStackActions {\n overlays: OverlayEntry[];\n}\n\nexport function sortOverlayEntries(entries: OverlayEntry[]): OverlayEntry[] {\n const perLayerCounts: Partial<Record<OverlayLayer, number>> = {};\n const normalizedEntries = [...entries]\n .sort((left, right) => left.order - right.order)\n .map((entry) => {\n const stackIndex = perLayerCounts[entry.layer] ?? 0;\n perLayerCounts[entry.layer] = stackIndex + 1;\n\n return {\n ...entry,\n zIndex: resolveOverlayZIndex(entry.layer, stackIndex),\n };\n });\n\n return normalizedEntries.sort((left, right) =>\n left.zIndex === right.zIndex ? left.order - right.order : left.zIndex - right.zIndex,\n );\n}\n\nexport const OverlayStackContext = React.createContext<OverlayStackRuntime | null>(null);\n\nexport const OverlayStackActionsContext = React.createContext<OverlayStackActions | null>(null);\n\nexport function useOverlayStack(): OverlayStackRuntime | null {\n return React.useContext(OverlayStackContext);\n}\n\nexport function useOverlayStackActions(): OverlayStackActions | null {\n return React.useContext(OverlayStackActionsContext);\n}\n\nexport function createOverlayEntry(\n id: string,\n order: number,\n descriptor: OverlayDescriptor,\n): OverlayEntry {\n return {\n id,\n layer: descriptor.layer,\n node: descriptor.node,\n order,\n zIndex: resolveOverlayZIndex(descriptor.layer, 0),\n };\n}\n"]}
1
+ {"version":3,"file":"useOverlayStack.js","sourceRoot":"","sources":["../../../src/internal/overlay/useOverlayStack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAqB,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAwB5F,MAAM,UAAU,kBAAkB,CAAC,OAAuB;IACxD,MAAM,cAAc,GAA0C,EAAE,CAAC;IACjE,MAAM,iBAAiB,GAAG,CAAC,GAAG,OAAO,CAAC;SACnC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;SAC/C,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACb,MAAM,UAAU,GAAG,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACpD,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,UAAU,GAAG,CAAC,CAAC;QAE7C,OAAO;YACL,GAAG,KAAK;YACR,MAAM,EAAE,oBAAoB,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC;SACtD,CAAC;IACJ,CAAC,CAAC,CAAC;IAEL,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAC5C,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CACrF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC,aAAa,CAA6B,IAAI,CAAC,CAAC;AAEzF,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAC,aAAa,CAA6B,IAAI,CAAC,CAAC;AAEhG,MAAM,UAAU,sBAAsB;IACpC,OAAO,KAAK,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,EAAU,EACV,KAAa,EACb,UAA6B;IAE7B,OAAO;QACL,EAAE;QACF,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,KAAK;QACL,MAAM,EAAE,oBAAoB,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;KAClD,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport { type OverlayLayer, resolveOverlayZIndex } from '../resolvers/resolveOverlayZIndex';\n\nexport interface OverlayEntry {\n id: string;\n layer: OverlayLayer;\n node: React.ReactNode;\n order: number;\n zIndex: number;\n}\n\nexport interface OverlayDescriptor {\n layer: OverlayLayer;\n node: React.ReactNode;\n}\n\nexport interface OverlayStackActions {\n setOverlay: (id: string, overlay: OverlayDescriptor) => void;\n removeOverlay: (id: string) => void;\n}\n\nexport interface OverlayStackRuntime extends OverlayStackActions {\n overlays: OverlayEntry[];\n}\n\nexport function sortOverlayEntries(entries: OverlayEntry[]): OverlayEntry[] {\n const perLayerCounts: Partial<Record<OverlayLayer, number>> = {};\n const normalizedEntries = [...entries]\n .sort((left, right) => left.order - right.order)\n .map((entry) => {\n const stackIndex = perLayerCounts[entry.layer] ?? 0;\n perLayerCounts[entry.layer] = stackIndex + 1;\n\n return {\n ...entry,\n zIndex: resolveOverlayZIndex(entry.layer, stackIndex),\n };\n });\n\n return normalizedEntries.sort((left, right) =>\n left.zIndex === right.zIndex ? left.order - right.order : left.zIndex - right.zIndex,\n );\n}\n\nexport const OverlayStackContext = React.createContext<OverlayStackRuntime | null>(null);\n\nexport const OverlayStackActionsContext = React.createContext<OverlayStackActions | null>(null);\n\nexport function useOverlayStackActions(): OverlayStackActions | null {\n return React.useContext(OverlayStackActionsContext);\n}\n\nexport function createOverlayEntry(\n id: string,\n order: number,\n descriptor: OverlayDescriptor,\n): OverlayEntry {\n return {\n id,\n layer: descriptor.layer,\n node: descriptor.node,\n order,\n zIndex: resolveOverlayZIndex(descriptor.layer, 0),\n };\n}\n"]}
@@ -1,4 +1,4 @@
1
- export type FieldStateName = 'default' | 'focused' | 'disabled' | 'invalid' | 'readOnly';
1
+ type FieldStateName = 'default' | 'focused' | 'disabled' | 'invalid' | 'readOnly';
2
2
  export interface FieldState {
3
3
  name: FieldStateName;
4
4
  focused: boolean;
@@ -7,4 +7,5 @@ export interface FieldState {
7
7
  readOnly: boolean;
8
8
  }
9
9
  export declare function resolveFieldState({ focused, disabled, invalid, readOnly, }: Partial<Omit<FieldState, 'name'>>): FieldState;
10
+ export {};
10
11
  //# sourceMappingURL=resolveFieldState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveFieldState.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveFieldState.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;AAEzF,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,OAAe,EACf,QAAgB,EAChB,OAAe,EACf,QAAgB,GACjB,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,GAAG,UAAU,CAoBhD"}
1
+ {"version":3,"file":"resolveFieldState.d.ts","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveFieldState.ts"],"names":[],"mappings":"AAAA,KAAK,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;AAElF,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,OAAe,EACf,QAAgB,EAChB,OAAe,EACf,QAAgB,GACjB,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,GAAG,UAAU,CAoBhD"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolveFieldState.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveFieldState.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,iBAAiB,CAAC,EAChC,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,GACkB;IAClC,IAAI,IAAI,GAAmB,SAAS,CAAC;IAErC,IAAI,QAAQ,EAAE,CAAC;QACb,IAAI,GAAG,UAAU,CAAC;IACpB,CAAC;SAAM,IAAI,OAAO,EAAE,CAAC;QACnB,IAAI,GAAG,SAAS,CAAC;IACnB,CAAC;SAAM,IAAI,OAAO,EAAE,CAAC;QACnB,IAAI,GAAG,SAAS,CAAC;IACnB,CAAC;SAAM,IAAI,QAAQ,EAAE,CAAC;QACpB,IAAI,GAAG,UAAU,CAAC;IACpB,CAAC;IAED,OAAO;QACL,IAAI;QACJ,OAAO;QACP,QAAQ;QACR,OAAO;QACP,QAAQ;KACT,CAAC;AACJ,CAAC","sourcesContent":["export type FieldStateName = 'default' | 'focused' | 'disabled' | 'invalid' | 'readOnly';\n\nexport interface FieldState {\n name: FieldStateName;\n focused: boolean;\n disabled: boolean;\n invalid: boolean;\n readOnly: boolean;\n}\n\nexport function resolveFieldState({\n focused = false,\n disabled = false,\n invalid = false,\n readOnly = false,\n}: Partial<Omit<FieldState, 'name'>>): FieldState {\n let name: FieldStateName = 'default';\n\n if (disabled) {\n name = 'disabled';\n } else if (invalid) {\n name = 'invalid';\n } else if (focused) {\n name = 'focused';\n } else if (readOnly) {\n name = 'readOnly';\n }\n\n return {\n name,\n focused,\n disabled,\n invalid,\n readOnly,\n };\n}\n"]}
1
+ {"version":3,"file":"resolveFieldState.js","sourceRoot":"","sources":["../../../src/internal/resolvers/resolveFieldState.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,iBAAiB,CAAC,EAChC,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,GACkB;IAClC,IAAI,IAAI,GAAmB,SAAS,CAAC;IAErC,IAAI,QAAQ,EAAE,CAAC;QACb,IAAI,GAAG,UAAU,CAAC;IACpB,CAAC;SAAM,IAAI,OAAO,EAAE,CAAC;QACnB,IAAI,GAAG,SAAS,CAAC;IACnB,CAAC;SAAM,IAAI,OAAO,EAAE,CAAC;QACnB,IAAI,GAAG,SAAS,CAAC;IACnB,CAAC;SAAM,IAAI,QAAQ,EAAE,CAAC;QACpB,IAAI,GAAG,UAAU,CAAC;IACpB,CAAC;IAED,OAAO;QACL,IAAI;QACJ,OAAO;QACP,QAAQ;QACR,OAAO;QACP,QAAQ;KACT,CAAC;AACJ,CAAC","sourcesContent":["type FieldStateName = 'default' | 'focused' | 'disabled' | 'invalid' | 'readOnly';\n\nexport interface FieldState {\n name: FieldStateName;\n focused: boolean;\n disabled: boolean;\n invalid: boolean;\n readOnly: boolean;\n}\n\nexport function resolveFieldState({\n focused = false,\n disabled = false,\n invalid = false,\n readOnly = false,\n}: Partial<Omit<FieldState, 'name'>>): FieldState {\n let name: FieldStateName = 'default';\n\n if (disabled) {\n name = 'disabled';\n } else if (invalid) {\n name = 'invalid';\n } else if (focused) {\n name = 'focused';\n } else if (readOnly) {\n name = 'readOnly';\n }\n\n return {\n name,\n focused,\n disabled,\n invalid,\n readOnly,\n };\n}\n"]}
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { type StyleProp, type ViewStyle } from 'react-native';
3
+ import { type BoxProps } from './Box';
4
+ export interface AppBarProps extends Omit<BoxProps, 'children'> {
5
+ leading?: React.ReactNode;
6
+ trailing?: React.ReactNode;
7
+ children?: React.ReactNode;
8
+ safeAreaTop?: boolean;
9
+ divider?: boolean;
10
+ contentStyle?: StyleProp<ViewStyle>;
11
+ }
12
+ export declare function AppBar({ leading, trailing, children, safeAreaTop, divider, contentStyle, bg, style, ...props }: AppBarProps): React.JSX.Element;
13
+ //# sourceMappingURL=AppBar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppBar.d.ts","sourceRoot":"","sources":["../../src/layout/AppBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,SAAS,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIpE,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG3C,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC7D,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACrC;AAED,wBAAgB,MAAM,CAAC,EACrB,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,WAAkB,EAClB,OAAe,EACf,YAAY,EACZ,EAAE,EACF,KAAK,EACL,GAAG,KAAK,EACT,EAAE,WAAW,qBAiCb"}
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { View } from 'react-native';
3
+ import { SafeAreaInsetsContext } from 'react-native-safe-area-context';
4
+ import { useTheme } from '../theme/ThemeContext';
5
+ import { Box } from './Box';
6
+ import { Divider } from './Divider';
7
+ export function AppBar({ leading, trailing, children, safeAreaTop = true, divider = false, contentStyle, bg, style, ...props }) {
8
+ const { theme } = useTheme();
9
+ const insets = React.useContext(SafeAreaInsetsContext);
10
+ const topInset = safeAreaTop ? (insets?.top ?? 0) : 0;
11
+ const safeAreaStyle = topInset === 0 ? undefined : { paddingTop: topInset };
12
+ return (<Box {...props} bg={bg ?? theme.semantics.surface.default} style={[style]}>
13
+ <View style={safeAreaStyle}>
14
+ <View style={[
15
+ {
16
+ minHeight: 56,
17
+ flexDirection: 'row',
18
+ alignItems: 'center',
19
+ paddingHorizontal: theme.spacing.m,
20
+ },
21
+ contentStyle,
22
+ ]}>
23
+ {leading ? (<View style={{ marginRight: theme.spacing.s, flexShrink: 0 }}>{leading}</View>) : null}
24
+ <View style={{ flex: 1, minWidth: 0 }}>{children}</View>
25
+ {trailing ? (<View style={{ marginLeft: theme.spacing.s, flexShrink: 0 }}>{trailing}</View>) : null}
26
+ </View>
27
+ {divider ? <Divider color={theme.semantics.neutral.divider} thickness={1}/> : null}
28
+ </View>
29
+ </Box>);
30
+ }
31
+ //# sourceMappingURL=AppBar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppBar.js","sourceRoot":"","sources":["../../src/layout/AppBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAkB,IAAI,EAAkB,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,GAAG,EAAiB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC,MAAM,UAAU,MAAM,CAAC,EACrB,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,WAAW,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AQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,CACvD;UAAA,CAAC,QAAQ,CAAC,CAAC,CAAC,CACV,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,CAC/E,CAAC,CAAC,CAAC,IAAI,CACV;QAAA,EAAE,IAAI,CACN;QAAA,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAG,CAAC,CAAC,CAAC,IAAI,CACrF;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\nimport { type StyleProp, View, type ViewStyle } from 'react-native';\nimport { SafeAreaInsetsContext } from 'react-native-safe-area-context';\n\nimport { useTheme } from '../theme/ThemeContext';\nimport { Box, type BoxProps } from './Box';\nimport { Divider } from './Divider';\n\nexport interface AppBarProps extends Omit<BoxProps, 'children'> {\n leading?: React.ReactNode;\n trailing?: React.ReactNode;\n children?: React.ReactNode;\n safeAreaTop?: boolean;\n divider?: boolean;\n contentStyle?: StyleProp<ViewStyle>;\n}\n\nexport function AppBar({\n leading,\n trailing,\n children,\n safeAreaTop = true,\n divider = false,\n contentStyle,\n bg,\n style,\n ...props\n}: AppBarProps) {\n const { theme } = useTheme();\n const insets = React.useContext(SafeAreaInsetsContext);\n const topInset = safeAreaTop ? (insets?.top ?? 0) : 0;\n const safeAreaStyle: ViewStyle | undefined =\n topInset === 0 ? undefined : { paddingTop: topInset };\n\n return (\n <Box {...props} bg={bg ?? theme.semantics.surface.default} style={[style]}>\n <View style={safeAreaStyle}>\n <View\n style={[\n {\n minHeight: 56,\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: theme.spacing.m,\n },\n contentStyle,\n ]}\n >\n {leading ? (\n <View style={{ marginRight: theme.spacing.s, flexShrink: 0 }}>{leading}</View>\n ) : null}\n <View style={{ flex: 1, minWidth: 0 }}>{children}</View>\n {trailing ? (\n <View style={{ marginLeft: theme.spacing.s, flexShrink: 0 }}>{trailing}</View>\n ) : null}\n </View>\n {divider ? <Divider color={theme.semantics.neutral.divider} thickness={1} /> : null}\n </View>\n </Box>\n );\n}\n"]}
@@ -4,8 +4,8 @@ import type { SurfaceTheme } from '../theme/types';
4
4
  type SpaceToken = keyof SurfaceTheme['spacing'];
5
5
  type RadiusToken = keyof SurfaceTheme['radii'];
6
6
  type ColorToken = keyof SurfaceTheme['colors'];
7
+ type RadiusValue = number | RadiusToken;
7
8
  export type SpaceValue = number | SpaceToken;
8
- export type RadiusValue = number | RadiusToken;
9
9
  export type ColorValue = string | ColorToken;
10
10
  export interface BoxStyleProps {
11
11
  p?: Responsive<SpaceValue>;
@@ -48,9 +48,6 @@ export interface BoxStyleProps {
48
48
  style?: StyleProp<ViewStyle>;
49
49
  }
50
50
  export declare function resolveSpacing(theme: SurfaceTheme, value: SpaceValue | undefined): number | undefined;
51
- export declare function resolveRadius(theme: SurfaceTheme, value: RadiusValue | undefined): number | undefined;
52
- export declare function resolveColor(theme: SurfaceTheme, value: ColorValue | undefined): string | undefined;
53
- export declare function resolveDimension(theme: SurfaceTheme, value: number | string | undefined): number | string | undefined;
54
51
  export declare function resolveBoxStyles(theme: SurfaceTheme, breakpoint: Breakpoint, props: BoxStyleProps): ViewStyle;
55
52
  export {};
56
53
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/layout/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzD,OAA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,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,UAAU,GAAG,SAAS,GAC5B,MAAM,GAAG,SAAS,CAIpB;AA4BD,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,aAAa,GACnB,SAAS,CA6GX"}
@@ -7,14 +7,14 @@ export function resolveSpacing(theme, value) {
7
7
  return value;
8
8
  return theme.spacing[value];
9
9
  }
10
- export function resolveRadius(theme, value) {
10
+ function resolveRadius(theme, value) {
11
11
  if (value === undefined)
12
12
  return undefined;
13
13
  if (typeof value === 'number')
14
14
  return value;
15
15
  return theme.radii[value];
16
16
  }
17
- export function resolveColor(theme, value) {
17
+ function resolveColor(theme, value) {
18
18
  if (value === undefined)
19
19
  return undefined;
20
20
  if (Object.prototype.hasOwnProperty.call(theme.colors, value)) {
@@ -22,7 +22,7 @@ export function resolveColor(theme, value) {
22
22
  }
23
23
  return value;
24
24
  }
25
- export function resolveDimension(theme, value) {
25
+ function resolveDimension(theme, value) {
26
26
  if (value === undefined || typeof value === 'number')
27
27
  return value;
28
28
  return resolveToken(theme.spacing, value);
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/layout/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAoDrD,MAAM,UAAU,cAAc,CAC5B,KAAmB,EACnB,KAA6B;IAE7B,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,KAAK,CAAC,OAAO,CAAC,KAAmB,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,aAA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M,CAAC;AAChB,CAAC","sourcesContent":["import type { StyleProp, ViewStyle } from 'react-native';\n\nimport { resolveResponsive } from '../core/responsive/resolve';\nimport type { Breakpoint, Responsive } from '../core/responsive/types';\nimport { resolveToken } from '../theme/resolveToken';\nimport type { SurfaceTheme } from '../theme/types';\n\ntype SpaceToken = keyof SurfaceTheme['spacing'];\ntype RadiusToken = keyof SurfaceTheme['radii'];\ntype ColorToken = keyof SurfaceTheme['colors'];\n\nexport type SpaceValue = number | SpaceToken;\nexport type RadiusValue = number | RadiusToken;\nexport type ColorValue = string | ColorToken;\n\nexport interface BoxStyleProps {\n p?: Responsive<SpaceValue>;\n px?: Responsive<SpaceValue>;\n py?: Responsive<SpaceValue>;\n pt?: Responsive<SpaceValue>;\n pb?: Responsive<SpaceValue>;\n pl?: Responsive<SpaceValue>;\n pr?: Responsive<SpaceValue>;\n m?: Responsive<SpaceValue>;\n mx?: Responsive<SpaceValue>;\n my?: Responsive<SpaceValue>;\n mt?: Responsive<SpaceValue>;\n mb?: Responsive<SpaceValue>;\n ml?: Responsive<SpaceValue>;\n mr?: Responsive<SpaceValue>;\n bg?: Responsive<ColorValue>;\n radius?: Responsive<RadiusValue>;\n borderWidth?: Responsive<number>;\n borderColor?: Responsive<ColorValue>;\n width?: Responsive<number | string>;\n height?: Responsive<number | string>;\n minWidth?: Responsive<number | string>;\n maxWidth?: Responsive<number | string>;\n minHeight?: Responsive<number | string>;\n maxHeight?: Responsive<number | string>;\n flex?: Responsive<number>;\n flexGrow?: Responsive<number>;\n flexShrink?: Responsive<number>;\n flexBasis?: Responsive<number | string>;\n alignSelf?: Responsive<ViewStyle['alignSelf']>;\n position?: Responsive<ViewStyle['position']>;\n top?: Responsive<number>;\n bottom?: Responsive<number>;\n left?: Responsive<number>;\n right?: Responsive<number>;\n overflow?: Responsive<ViewStyle['overflow']>;\n zIndex?: Responsive<number>;\n opacity?: Responsive<number>;\n style?: StyleProp<ViewStyle>;\n}\n\nexport function resolveSpacing(\n theme: SurfaceTheme,\n value: SpaceValue | undefined,\n): number | undefined {\n if (value === undefined) return undefined;\n if (typeof value === 'number') return value;\n return theme.spacing[value as SpaceToken];\n}\n\nexport function resolveRadius(\n theme: SurfaceTheme,\n value: RadiusValue | undefined,\n): number | undefined {\n if (value === undefined) return undefined;\n if (typeof value === 'number') return value;\n return theme.radii[value];\n}\n\nexport function resolveColor(\n theme: SurfaceTheme,\n value: ColorValue | undefined,\n): string | undefined {\n if (value === undefined) return undefined;\n if (Object.prototype.hasOwnProperty.call(theme.colors, value)) {\n return theme.colors[value];\n }\n return value as string;\n}\n\nexport function resolveDimension(\n theme: SurfaceTheme,\n value: number | string | undefined,\n): number | string | undefined {\n if (value === undefined || typeof value === 'number') return value;\n return resolveToken(theme.spacing, value);\n}\n\nfunction assignIfDefined<T, K extends keyof T>(target: T, key: K, value: T[K] | undefined) {\n if (value !== undefined) target[key] = value;\n}\n\nexport function resolveBoxStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: BoxStyleProps,\n): ViewStyle {\n const styles: ViewStyle = {\n elevation: 0,\n };\n\n const p = resolveSpacing(theme, resolveResponsive(props.p, breakpoint));\n const px = resolveSpacing(theme, resolveResponsive(props.px, breakpoint));\n const py = resolveSpacing(theme, resolveResponsive(props.py, breakpoint));\n const pt = resolveSpacing(theme, resolveResponsive(props.pt, breakpoint));\n const pb = resolveSpacing(theme, resolveResponsive(props.pb, breakpoint));\n const pl = resolveSpacing(theme, resolveResponsive(props.pl, breakpoint));\n const pr = resolveSpacing(theme, resolveResponsive(props.pr, breakpoint));\n const m = resolveSpacing(theme, resolveResponsive(props.m, breakpoint));\n const mx = resolveSpacing(theme, resolveResponsive(props.mx, breakpoint));\n const my = resolveSpacing(theme, resolveResponsive(props.my, breakpoint));\n const mt = resolveSpacing(theme, resolveResponsive(props.mt, breakpoint));\n const mb = resolveSpacing(theme, resolveResponsive(props.mb, breakpoint));\n const ml = resolveSpacing(theme, resolveResponsive(props.ml, breakpoint));\n const mr = resolveSpacing(theme, resolveResponsive(props.mr, breakpoint));\n\n assignIfDefined(styles, 'padding', p as ViewStyle['padding']);\n assignIfDefined(styles, 'paddingHorizontal', px as ViewStyle['paddingHorizontal']);\n assignIfDefined(styles, 'paddingVertical', py as ViewStyle['paddingVertical']);\n assignIfDefined(styles, 'paddingTop', pt as ViewStyle['paddingTop']);\n assignIfDefined(styles, 'paddingBottom', pb as ViewStyle['paddingBottom']);\n assignIfDefined(styles, 'paddingLeft', pl as ViewStyle['paddingLeft']);\n assignIfDefined(styles, 'paddingRight', pr as ViewStyle['paddingRight']);\n assignIfDefined(styles, 'margin', m as ViewStyle['margin']);\n assignIfDefined(styles, 'marginHorizontal', mx as ViewStyle['marginHorizontal']);\n assignIfDefined(styles, 'marginVertical', my as ViewStyle['marginVertical']);\n assignIfDefined(styles, 'marginTop', mt as ViewStyle['marginTop']);\n assignIfDefined(styles, 'marginBottom', mb as ViewStyle['marginBottom']);\n assignIfDefined(styles, 'marginLeft', ml as ViewStyle['marginLeft']);\n assignIfDefined(styles, 'marginRight', mr as ViewStyle['marginRight']);\n\n assignIfDefined(\n styles,\n 'backgroundColor',\n resolveColor(theme, resolveResponsive(props.bg, breakpoint)),\n );\n assignIfDefined(\n styles,\n 'borderRadius',\n resolveRadius(theme, resolveResponsive(props.radius, breakpoint)) as ViewStyle['borderRadius'],\n );\n assignIfDefined(styles, 'borderWidth', resolveResponsive(props.borderWidth, breakpoint));\n assignIfDefined(\n styles,\n 'borderColor',\n resolveColor(theme, resolveResponsive(props.borderColor, breakpoint)),\n );\n\n assignIfDefined(\n styles,\n 'width',\n resolveDimension(theme, resolveResponsive(props.width, breakpoint)) as ViewStyle['width'],\n );\n assignIfDefined(\n styles,\n 'height',\n resolveDimension(theme, resolveResponsive(props.height, breakpoint)) as ViewStyle['height'],\n );\n assignIfDefined(\n styles,\n 'minWidth',\n resolveDimension(theme, resolveResponsive(props.minWidth, breakpoint)) as ViewStyle['minWidth'],\n );\n assignIfDefined(\n styles,\n 'maxWidth',\n resolveDimension(theme, resolveResponsive(props.maxWidth, breakpoint)) as ViewStyle['maxWidth'],\n );\n assignIfDefined(\n styles,\n 'minHeight',\n resolveDimension(\n theme,\n resolveResponsive(props.minHeight, breakpoint),\n ) as ViewStyle['minHeight'],\n );\n assignIfDefined(\n styles,\n 'maxHeight',\n resolveDimension(\n theme,\n resolveResponsive(props.maxHeight, breakpoint),\n ) as ViewStyle['maxHeight'],\n );\n\n assignIfDefined(styles, 'flex', resolveResponsive(props.flex, breakpoint));\n assignIfDefined(styles, 'flexGrow', resolveResponsive(props.flexGrow, breakpoint));\n assignIfDefined(styles, 'flexShrink', resolveResponsive(props.flexShrink, breakpoint));\n assignIfDefined(\n styles,\n 'flexBasis',\n resolveResponsive(props.flexBasis, breakpoint) as ViewStyle['flexBasis'],\n );\n assignIfDefined(styles, 'alignSelf', resolveResponsive(props.alignSelf, breakpoint));\n\n assignIfDefined(styles, 'position', resolveResponsive(props.position, breakpoint));\n assignIfDefined(styles, 'top', resolveResponsive(props.top, breakpoint));\n assignIfDefined(styles, 'bottom', resolveResponsive(props.bottom, breakpoint));\n assignIfDefined(styles, 'left', resolveResponsive(props.left, breakpoint));\n assignIfDefined(styles, 'right', resolveResponsive(props.right, breakpoint));\n assignIfDefined(styles, 'overflow', resolveResponsive(props.overflow, breakpoint));\n assignIfDefined(styles, 'zIndex', resolveResponsive(props.zIndex, breakpoint));\n assignIfDefined(styles, 'opacity', resolveResponsive(props.opacity, breakpoint));\n\n return styles;\n}\n"]}
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/layout/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAoDrD,MAAM,UAAU,cAAc,CAC5B,KAAmB,EACnB,KAA6B;IAE7B,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,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AC/E,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,iBAAiB,CAAC,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;IAEjF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { StyleProp, ViewStyle } from 'react-native';\n\nimport { resolveResponsive } from '../core/responsive/resolve';\nimport type { Breakpoint, Responsive } from '../core/responsive/types';\nimport { resolveToken } from '../theme/resolveToken';\nimport type { SurfaceTheme } from '../theme/types';\n\ntype SpaceToken = keyof SurfaceTheme['spacing'];\ntype RadiusToken = keyof SurfaceTheme['radii'];\ntype ColorToken = keyof SurfaceTheme['colors'];\n\ntype RadiusValue = number | RadiusToken;\nexport type SpaceValue = number | SpaceToken;\nexport type ColorValue = string | ColorToken;\n\nexport interface BoxStyleProps {\n p?: Responsive<SpaceValue>;\n px?: Responsive<SpaceValue>;\n py?: Responsive<SpaceValue>;\n pt?: Responsive<SpaceValue>;\n pb?: Responsive<SpaceValue>;\n pl?: Responsive<SpaceValue>;\n pr?: Responsive<SpaceValue>;\n m?: Responsive<SpaceValue>;\n mx?: Responsive<SpaceValue>;\n my?: Responsive<SpaceValue>;\n mt?: Responsive<SpaceValue>;\n mb?: Responsive<SpaceValue>;\n ml?: Responsive<SpaceValue>;\n mr?: Responsive<SpaceValue>;\n bg?: Responsive<ColorValue>;\n radius?: Responsive<RadiusValue>;\n borderWidth?: Responsive<number>;\n borderColor?: Responsive<ColorValue>;\n width?: Responsive<number | string>;\n height?: Responsive<number | string>;\n minWidth?: Responsive<number | string>;\n maxWidth?: Responsive<number | string>;\n minHeight?: Responsive<number | string>;\n maxHeight?: Responsive<number | string>;\n flex?: Responsive<number>;\n flexGrow?: Responsive<number>;\n flexShrink?: Responsive<number>;\n flexBasis?: Responsive<number | string>;\n alignSelf?: Responsive<ViewStyle['alignSelf']>;\n position?: Responsive<ViewStyle['position']>;\n top?: Responsive<number>;\n bottom?: Responsive<number>;\n left?: Responsive<number>;\n right?: Responsive<number>;\n overflow?: Responsive<ViewStyle['overflow']>;\n zIndex?: Responsive<number>;\n opacity?: Responsive<number>;\n style?: StyleProp<ViewStyle>;\n}\n\nexport function resolveSpacing(\n theme: SurfaceTheme,\n value: SpaceValue | undefined,\n): number | undefined {\n if (value === undefined) return undefined;\n if (typeof value === 'number') return value;\n return theme.spacing[value as SpaceToken];\n}\n\nfunction resolveRadius(theme: SurfaceTheme, value: RadiusValue | undefined): number | undefined {\n if (value === undefined) return undefined;\n if (typeof value === 'number') return value;\n return theme.radii[value];\n}\n\nfunction resolveColor(theme: SurfaceTheme, value: ColorValue | undefined): string | undefined {\n if (value === undefined) return undefined;\n if (Object.prototype.hasOwnProperty.call(theme.colors, value)) {\n return theme.colors[value];\n }\n return value as string;\n}\n\nfunction resolveDimension(\n theme: SurfaceTheme,\n value: number | string | undefined,\n): number | string | undefined {\n if (value === undefined || typeof value === 'number') return value;\n return resolveToken(theme.spacing, value);\n}\n\nfunction assignIfDefined<T, K extends keyof T>(target: T, key: K, value: T[K] | undefined) {\n if (value !== undefined) target[key] = value;\n}\n\nexport function resolveBoxStyles(\n theme: SurfaceTheme,\n breakpoint: Breakpoint,\n props: BoxStyleProps,\n): ViewStyle {\n const styles: ViewStyle = {\n elevation: 0,\n };\n\n const p = resolveSpacing(theme, resolveResponsive(props.p, breakpoint));\n const px = resolveSpacing(theme, resolveResponsive(props.px, breakpoint));\n const py = resolveSpacing(theme, resolveResponsive(props.py, breakpoint));\n const pt = resolveSpacing(theme, resolveResponsive(props.pt, breakpoint));\n const pb = resolveSpacing(theme, resolveResponsive(props.pb, breakpoint));\n const pl = resolveSpacing(theme, resolveResponsive(props.pl, breakpoint));\n const pr = resolveSpacing(theme, resolveResponsive(props.pr, breakpoint));\n const m = resolveSpacing(theme, resolveResponsive(props.m, breakpoint));\n const mx = resolveSpacing(theme, resolveResponsive(props.mx, breakpoint));\n const my = resolveSpacing(theme, resolveResponsive(props.my, breakpoint));\n const mt = resolveSpacing(theme, resolveResponsive(props.mt, breakpoint));\n const mb = resolveSpacing(theme, resolveResponsive(props.mb, breakpoint));\n const ml = resolveSpacing(theme, resolveResponsive(props.ml, breakpoint));\n const mr = resolveSpacing(theme, resolveResponsive(props.mr, breakpoint));\n\n assignIfDefined(styles, 'padding', p as ViewStyle['padding']);\n assignIfDefined(styles, 'paddingHorizontal', px as ViewStyle['paddingHorizontal']);\n assignIfDefined(styles, 'paddingVertical', py as ViewStyle['paddingVertical']);\n assignIfDefined(styles, 'paddingTop', pt as ViewStyle['paddingTop']);\n assignIfDefined(styles, 'paddingBottom', pb as ViewStyle['paddingBottom']);\n assignIfDefined(styles, 'paddingLeft', pl as ViewStyle['paddingLeft']);\n assignIfDefined(styles, 'paddingRight', pr as ViewStyle['paddingRight']);\n assignIfDefined(styles, 'margin', m as ViewStyle['margin']);\n assignIfDefined(styles, 'marginHorizontal', mx as ViewStyle['marginHorizontal']);\n assignIfDefined(styles, 'marginVertical', my as ViewStyle['marginVertical']);\n assignIfDefined(styles, 'marginTop', mt as ViewStyle['marginTop']);\n assignIfDefined(styles, 'marginBottom', mb as ViewStyle['marginBottom']);\n assignIfDefined(styles, 'marginLeft', ml as ViewStyle['marginLeft']);\n assignIfDefined(styles, 'marginRight', mr as ViewStyle['marginRight']);\n\n assignIfDefined(\n styles,\n 'backgroundColor',\n resolveColor(theme, resolveResponsive(props.bg, breakpoint)),\n );\n assignIfDefined(\n styles,\n 'borderRadius',\n resolveRadius(theme, resolveResponsive(props.radius, breakpoint)) as ViewStyle['borderRadius'],\n );\n assignIfDefined(styles, 'borderWidth', resolveResponsive(props.borderWidth, breakpoint));\n assignIfDefined(\n styles,\n 'borderColor',\n resolveColor(theme, resolveResponsive(props.borderColor, breakpoint)),\n );\n\n assignIfDefined(\n styles,\n 'width',\n resolveDimension(theme, resolveResponsive(props.width, breakpoint)) as ViewStyle['width'],\n );\n assignIfDefined(\n styles,\n 'height',\n resolveDimension(theme, resolveResponsive(props.height, breakpoint)) as ViewStyle['height'],\n );\n assignIfDefined(\n styles,\n 'minWidth',\n resolveDimension(theme, resolveResponsive(props.minWidth, breakpoint)) as ViewStyle['minWidth'],\n );\n assignIfDefined(\n styles,\n 'maxWidth',\n resolveDimension(theme, resolveResponsive(props.maxWidth, breakpoint)) as ViewStyle['maxWidth'],\n );\n assignIfDefined(\n styles,\n 'minHeight',\n resolveDimension(\n theme,\n resolveResponsive(props.minHeight, breakpoint),\n ) as ViewStyle['minHeight'],\n );\n assignIfDefined(\n styles,\n 'maxHeight',\n resolveDimension(\n theme,\n resolveResponsive(props.maxHeight, breakpoint),\n ) as ViewStyle['maxHeight'],\n );\n\n assignIfDefined(styles, 'flex', resolveResponsive(props.flex, breakpoint));\n assignIfDefined(styles, 'flexGrow', resolveResponsive(props.flexGrow, breakpoint));\n assignIfDefined(styles, 'flexShrink', resolveResponsive(props.flexShrink, breakpoint));\n assignIfDefined(\n styles,\n 'flexBasis',\n resolveResponsive(props.flexBasis, breakpoint) as ViewStyle['flexBasis'],\n );\n assignIfDefined(styles, 'alignSelf', resolveResponsive(props.alignSelf, breakpoint));\n\n assignIfDefined(styles, 'position', resolveResponsive(props.position, breakpoint));\n assignIfDefined(styles, 'top', resolveResponsive(props.top, breakpoint));\n assignIfDefined(styles, 'bottom', resolveResponsive(props.bottom, breakpoint));\n assignIfDefined(styles, 'left', resolveResponsive(props.left, breakpoint));\n assignIfDefined(styles, 'right', resolveResponsive(props.right, breakpoint));\n assignIfDefined(styles, 'overflow', resolveResponsive(props.overflow, breakpoint));\n assignIfDefined(styles, 'zIndex', resolveResponsive(props.zIndex, breakpoint));\n assignIfDefined(styles, 'opacity', resolveResponsive(props.opacity, breakpoint));\n\n return styles;\n}\n"]}
@@ -1,3 +1,5 @@
1
+ export type { AppBarProps } from './AppBar';
2
+ export { AppBar } from './AppBar';
1
3
  export type { BoxProps } from './Box';
2
4
  export { Box } from './Box';
3
5
  export type { CenterProps } from './Center';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":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
  export { Container } from './Container';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AACA,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,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 { 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 { 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;AAElC,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 { 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"]}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { ImageProps } from './types';
3
+ export declare function Image({ source, fallbackSource, alt, accessibilityLabel, width, height, aspectRatio, fit, resizeMode, radius, style, testID, onError, }: ImageProps): React.JSX.Element | null;
4
+ //# sourceMappingURL=Image.d.ts.map
@@ -0,0 +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,4BAsCZ"}
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { Image as RNImage } from 'react-native';
3
+ import { useTheme } from '../../theme/ThemeContext';
4
+ import { getSourceKey, normalizeSource, resolveAccessibilityLabel, resolveAlt, resolveImageStyle, resolveRenderedSource, resolveResizeMode, } from './resolveImageProps';
5
+ export function Image({ source, fallbackSource, alt, accessibilityLabel, width, height, aspectRatio, fit, resizeMode, radius, style, testID, onError, }) {
6
+ const { theme } = useTheme();
7
+ const [showFallback, setShowFallback] = React.useState(false);
8
+ const primaryKey = React.useMemo(() => getSourceKey(source), [source]);
9
+ React.useEffect(() => {
10
+ setShowFallback(false);
11
+ }, [primaryKey]);
12
+ const normalizedPrimary = normalizeSource(source);
13
+ const normalizedFallback = normalizeSource(fallbackSource);
14
+ const resolvedSource = resolveRenderedSource(normalizedPrimary, normalizedFallback, showFallback);
15
+ if (!resolvedSource)
16
+ return null;
17
+ const resolvedResizeMode = resolveResizeMode(fit, resizeMode);
18
+ const resolvedAccessibilityLabel = resolveAccessibilityLabel(alt, accessibilityLabel);
19
+ const resolvedAlt = resolveAlt(alt, accessibilityLabel);
20
+ const resolvedStyle = resolveImageStyle(theme, { width, height, aspectRatio, radius });
21
+ return (<RNImage accessibilityLabel={resolvedAccessibilityLabel} accessibilityRole="image" alt={resolvedAlt} onError={(event) => {
22
+ onError?.(event);
23
+ if (!showFallback && normalizedFallback) {
24
+ setShowFallback(true);
25
+ }
26
+ }} resizeMode={resolvedResizeMode} source={resolvedSource} style={[resolvedStyle, style]} testID={testID}/>);
27
+ }
28
+ //# sourceMappingURL=Image.js.map
@@ -0,0 +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,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9D,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEvE,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,eAAe,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,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,eAAe,CAAC,IAAI,CAAC,CAAC;YACxB,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 [showFallback, setShowFallback] = React.useState(false);\n const primaryKey = React.useMemo(() => getSourceKey(source), [source]);\n\n React.useEffect(() => {\n setShowFallback(false);\n }, [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 setShowFallback(true);\n }\n }}\n resizeMode={resolvedResizeMode}\n source={resolvedSource}\n style={[resolvedStyle, style]}\n testID={testID}\n />\n );\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export { Image } from './Image';
2
+ export type { ImageFit, ImageProps, SurfaceImageSource } from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/image/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Image } from './Image';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/primitives/image/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC","sourcesContent":["export { Image } from './Image';\nexport type { ImageFit, ImageProps, SurfaceImageSource } from './types';\n"]}
@@ -0,0 +1,12 @@
1
+ import type { ImageResizeMode, ImageSourcePropType } from 'react-native';
2
+ import type { ImageStyle } from 'react-native';
3
+ import type { SurfaceTheme } from '../../theme/types';
4
+ import type { ImageProps, SurfaceImageSource } from './types';
5
+ export declare function normalizeSource(source: SurfaceImageSource | null | undefined): ImageSourcePropType | undefined;
6
+ export declare function resolveRenderedSource(normalizedPrimary: ImageSourcePropType | undefined, normalizedFallback: ImageSourcePropType | undefined, showFallback: boolean): ImageSourcePropType | undefined;
7
+ export declare function getSourceKey(source: SurfaceImageSource | null | undefined): string | null;
8
+ export declare function resolveResizeMode(fit: ImageProps['fit'], resizeMode: ImageProps['resizeMode']): ImageResizeMode;
9
+ export declare function resolveAccessibilityLabel(alt: ImageProps['alt'], accessibilityLabel: ImageProps['accessibilityLabel']): string | undefined;
10
+ export declare function resolveAlt(alt: ImageProps['alt'], accessibilityLabel: ImageProps['accessibilityLabel']): string | undefined;
11
+ export declare function resolveImageStyle(theme: SurfaceTheme, props: Pick<ImageProps, 'width' | 'height' | 'aspectRatio' | 'radius'>): ImageStyle;
12
+ //# sourceMappingURL=resolveImageProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveImageProps.d.ts","sourceRoot":"","sources":["../../../src/primitives/image/resolveImageProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE9D,wBAAgB,eAAe,CAC7B,MAAM,EAAE,kBAAkB,GAAG,IAAI,GAAG,SAAS,GAC5C,mBAAmB,GAAG,SAAS,CAIjC;AAED,wBAAgB,qBAAqB,CACnC,iBAAiB,EAAE,mBAAmB,GAAG,SAAS,EAClD,kBAAkB,EAAE,mBAAmB,GAAG,SAAS,EACnD,YAAY,EAAE,OAAO,GACpB,mBAAmB,GAAG,SAAS,CAGjC;AAYD,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAmBzF;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,UAAU,CAAC,KAAK,CAAC,EACtB,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,GACnC,eAAe,CAEjB;AAED,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,UAAU,CAAC,KAAK,CAAC,EACtB,kBAAkB,EAAE,UAAU,CAAC,oBAAoB,CAAC,GACnD,MAAM,GAAG,SAAS,CAEpB;AAED,wBAAgB,UAAU,CACxB,GAAG,EAAE,UAAU,CAAC,KAAK,CAAC,EACtB,kBAAkB,EAAE,UAAU,CAAC,oBAAoB,CAAC,GACnD,MAAM,GAAG,SAAS,CAEpB;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,GAAG,QAAQ,GAAG,aAAa,GAAG,QAAQ,CAAC,GACrE,UAAU,CAYZ"}
@@ -0,0 +1,67 @@
1
+ import { resolveToken } from '../../theme/resolveToken';
2
+ export function normalizeSource(source) {
3
+ if (source === null || source === undefined)
4
+ return undefined;
5
+ if (typeof source === 'string')
6
+ return { uri: source };
7
+ return source;
8
+ }
9
+ export function resolveRenderedSource(normalizedPrimary, normalizedFallback, showFallback) {
10
+ if (showFallback || !normalizedPrimary)
11
+ return normalizedFallback;
12
+ return normalizedPrimary;
13
+ }
14
+ function getUriFromSource(source) {
15
+ if (Array.isArray(source)) {
16
+ const [first] = source;
17
+ return first?.uri;
18
+ }
19
+ if (typeof source === 'number')
20
+ return undefined;
21
+ return source.uri;
22
+ }
23
+ export function getSourceKey(source) {
24
+ if (source === null || source === undefined)
25
+ return null;
26
+ if (typeof source === 'string')
27
+ return `uri:${source}`;
28
+ if (typeof source === 'number')
29
+ return `asset:${source}`;
30
+ if (Array.isArray(source)) {
31
+ const parts = source
32
+ .map((item) => item.uri)
33
+ .filter((value) => typeof value === 'string');
34
+ return `uri-set:${parts.join('|')}`;
35
+ }
36
+ const uri = getUriFromSource(source);
37
+ if (uri)
38
+ return `uri:${uri}`;
39
+ try {
40
+ return `src:${JSON.stringify(source)}`;
41
+ }
42
+ catch {
43
+ return 'src:unknown';
44
+ }
45
+ }
46
+ export function resolveResizeMode(fit, resizeMode) {
47
+ return fit ?? resizeMode ?? 'cover';
48
+ }
49
+ export function resolveAccessibilityLabel(alt, accessibilityLabel) {
50
+ return accessibilityLabel ?? alt;
51
+ }
52
+ export function resolveAlt(alt, accessibilityLabel) {
53
+ return alt ?? accessibilityLabel;
54
+ }
55
+ export function resolveImageStyle(theme, props) {
56
+ const width = resolveToken(theme.spacing, props.width);
57
+ const height = resolveToken(theme.spacing, props.height);
58
+ const borderRadius = resolveToken(theme.radii, props.radius);
59
+ return {
60
+ width,
61
+ height,
62
+ aspectRatio: props.aspectRatio,
63
+ borderRadius,
64
+ overflow: borderRadius !== undefined ? 'hidden' : undefined,
65
+ };
66
+ }
67
+ //# sourceMappingURL=resolveImageProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveImageProps.js","sourceRoot":"","sources":["../../../src/primitives/image/resolveImageProps.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIxD,MAAM,UAAU,eAAe,CAC7B,MAA6C;IAE7C,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC9D,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;IACvD,OAAO,MAAM,CAAC;AAChB,CA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,MAAM,CAAC,EAAE,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,aAAa,CAAC;IACvB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,GAAsB,EACtB,UAAoC;IAEpC,OAAO,GAAG,IAAI,UAAU,IAAI,OAAO,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,GAAsB,EACtB,kBAAoD;IAEpD,OAAO,kBAAkB,IAAI,GAAG,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,GAAsB,EACtB,kBAAoD;IAEpD,OAAO,GAAG,IAAI,kBAAkB,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,KAAmB,EACnB,KAAsE;IAEtE,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACvD,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzD,MAAM,YAAY,GAAG,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAE7D,OAAO;QACL,KAAK;QACL,MAAM;QACN,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,YAAY;QACZ,QAAQ,EAAE,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;KAC5D,CAAC;AACJ,CAAC","sourcesContent":["import type { ImageResizeMode, ImageSourcePropType } from 'react-native';\nimport type { ImageStyle } from 'react-native';\n\nimport { resolveToken } from '../../theme/resolveToken';\nimport type { SurfaceTheme } from '../../theme/types';\nimport type { ImageProps, SurfaceImageSource } from './types';\n\nexport function normalizeSource(\n source: SurfaceImageSource | null | undefined,\n): ImageSourcePropType | undefined {\n if (source === null || source === undefined) return undefined;\n if (typeof source === 'string') return { uri: source };\n return source;\n}\n\nexport function resolveRenderedSource(\n normalizedPrimary: ImageSourcePropType | undefined,\n normalizedFallback: ImageSourcePropType | undefined,\n showFallback: boolean,\n): ImageSourcePropType | undefined {\n if (showFallback || !normalizedPrimary) return normalizedFallback;\n return normalizedPrimary;\n}\n\nfunction getUriFromSource(source: ImageSourcePropType): string | undefined {\n if (Array.isArray(source)) {\n const [first] = source;\n return first?.uri;\n }\n\n if (typeof source === 'number') return undefined;\n return source.uri;\n}\n\nexport function getSourceKey(source: SurfaceImageSource | null | undefined): string | null {\n if (source === null || source === undefined) return null;\n if (typeof source === 'string') return `uri:${source}`;\n if (typeof source === 'number') return `asset:${source}`;\n if (Array.isArray(source)) {\n const parts = source\n .map((item) => item.uri)\n .filter((value): value is string => typeof value === 'string');\n return `uri-set:${parts.join('|')}`;\n }\n\n const uri = getUriFromSource(source);\n if (uri) return `uri:${uri}`;\n\n try {\n return `src:${JSON.stringify(source)}`;\n } catch {\n return 'src:unknown';\n }\n}\n\nexport function resolveResizeMode(\n fit: ImageProps['fit'],\n resizeMode: ImageProps['resizeMode'],\n): ImageResizeMode {\n return fit ?? resizeMode ?? 'cover';\n}\n\nexport function resolveAccessibilityLabel(\n alt: ImageProps['alt'],\n accessibilityLabel: ImageProps['accessibilityLabel'],\n): string | undefined {\n return accessibilityLabel ?? alt;\n}\n\nexport function resolveAlt(\n alt: ImageProps['alt'],\n accessibilityLabel: ImageProps['accessibilityLabel'],\n): string | undefined {\n return alt ?? accessibilityLabel;\n}\n\nexport function resolveImageStyle(\n theme: SurfaceTheme,\n props: Pick<ImageProps, 'width' | 'height' | 'aspectRatio' | 'radius'>,\n): ImageStyle {\n const width = resolveToken(theme.spacing, props.width);\n const height = resolveToken(theme.spacing, props.height);\n const borderRadius = resolveToken(theme.radii, props.radius);\n\n return {\n width,\n height,\n aspectRatio: props.aspectRatio,\n borderRadius,\n overflow: borderRadius !== undefined ? 'hidden' : undefined,\n };\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import type { ImageProps as ReactNativeImageProps, ImageResizeMode, ImageSourcePropType } from 'react-native';
2
+ import type { ImageStyle, StyleProp } from 'react-native';
3
+ import type { SurfaceTheme } from '../../theme/types';
4
+ export type SurfaceImageSource = string | ImageSourcePropType;
5
+ export type ImageFit = ImageResizeMode;
6
+ export interface ImageProps {
7
+ source?: SurfaceImageSource | null;
8
+ fallbackSource?: SurfaceImageSource | null;
9
+ alt?: string;
10
+ accessibilityLabel?: string;
11
+ width?: number | string;
12
+ height?: number | string;
13
+ aspectRatio?: number;
14
+ fit?: ImageFit;
15
+ resizeMode?: ImageResizeMode;
16
+ radius?: number | keyof SurfaceTheme['radii'];
17
+ style?: StyleProp<ImageStyle>;
18
+ testID?: string;
19
+ onError?: ReactNativeImageProps['onError'];
20
+ }
21
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/primitives/image/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,IAAI,qBAAqB,EACnC,eAAe,EACf,mBAAmB,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,mBAAmB,CAAC;AAE9D,MAAM,MAAM,QAAQ,GAAG,eAAe,CAAC;AAEvC,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACnC,cAAc,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC3C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;CAC5C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/primitives/image/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ImageProps as ReactNativeImageProps,\n ImageResizeMode,\n ImageSourcePropType,\n} from 'react-native';\nimport type { ImageStyle, StyleProp } from 'react-native';\n\nimport type { SurfaceTheme } from '../../theme/types';\n\nexport type SurfaceImageSource = string | ImageSourcePropType;\n\nexport type ImageFit = ImageResizeMode;\n\nexport interface ImageProps {\n source?: SurfaceImageSource | null;\n fallbackSource?: SurfaceImageSource | null;\n alt?: string;\n accessibilityLabel?: string;\n width?: number | string;\n height?: number | string;\n aspectRatio?: number;\n fit?: ImageFit;\n resizeMode?: ImageResizeMode;\n radius?: number | keyof SurfaceTheme['radii'];\n style?: StyleProp<ImageStyle>;\n testID?: string;\n onError?: ReactNativeImageProps['onError'];\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/surface",
3
3
  "type": "module",
4
- "version": "1.1.0",
4
+ "version": "1.3.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": {
@@ -30,7 +30,8 @@
30
30
  "@expo/vector-icons": ">=14.0.0",
31
31
  "expo-font": "^55.0.6",
32
32
  "react": ">=18.2.0",
33
- "react-native": ">=0.72.0"
33
+ "react-native": ">=0.72.0",
34
+ "react-native-safe-area-context": "^5.0.0"
34
35
  },
35
36
  "peerDependenciesMeta": {
36
37
  "@expo/vector-icons": {
@@ -42,7 +43,7 @@
42
43
  },
43
44
  "dependencies": {
44
45
  "@ankhorage/color-theory": "^0.0.4",
45
- "@ankhorage/contracts": "^1.1.0"
46
+ "@ankhorage/contracts": "^1.2.0"
46
47
  },
47
48
  "files": [
48
49
  "dist",
@@ -68,16 +69,17 @@
68
69
  "build": "rm -rf dist tsconfig.tsbuildinfo && bun x tsc -p tsconfig.json",
69
70
  "changeset": "changeset",
70
71
  "changeset:status": "changeset status --since=origin/main",
71
- "lint": "eslint . --max-warnings=0",
72
- "lint:fix": "eslint . --fix --max-warnings=0",
73
- "format": "prettier --write .",
74
- "format:check": "prettier --check .",
72
+ "knip": "ankhorage-knip",
73
+ "lint": "ankhorage-eslint . --max-warnings=0",
74
+ "lint:fix": "ankhorage-eslint . --fix --max-warnings=0",
75
+ "format": "ankhorage-prettier --write .",
76
+ "format:check": "ankhorage-prettier --check .",
75
77
  "prepack": "bun run build",
76
78
  "test": "bun test src",
77
79
  "version-packages": "changeset version"
78
80
  },
79
81
  "devDependencies": {
80
- "@ankhorage/devtools": "^1.0.1",
82
+ "@ankhorage/devtools": "^1.0.5",
81
83
  "@changesets/cli": "^2.31.0",
82
84
  "@expo/vector-icons": "^15.1.1",
83
85
  "@types/bun": "^1.3.13",
@@ -85,6 +87,7 @@
85
87
  "@types/react": "^19.2.14",
86
88
  "react": "19.1.0",
87
89
  "react-native": "0.81.5",
90
+ "react-native-safe-area-context": "^5.0.0",
88
91
  "typescript": "^5.9.3"
89
92
  },
90
93
  "packageManager": "bun@1.3.13"
package/src/index.test.ts CHANGED
@@ -33,6 +33,7 @@ const expectedRootExports = [
33
33
  "export { Tooltip } from './components/tooltip';",
34
34
  "export * from './core/responsive';",
35
35
  "export * from './layout';",
36
+ "export { Image } from './primitives/image';",
36
37
  "export * from './theme';",
37
38
  ] as const;
38
39
 
package/src/index.ts CHANGED
@@ -66,6 +66,8 @@ export type { HeadingLevel, HeadingProps } from './primitives/heading';
66
66
  export { Heading } from './primitives/heading';
67
67
  export type { IconProps, IconProvider } from './primitives/icon';
68
68
  export { Icon } from './primitives/icon';
69
+ export type { ImageFit, ImageProps, SurfaceImageSource } from './primitives/image';
70
+ export { Image } from './primitives/image';
69
71
  export type { TextProps } from './primitives/text';
70
72
  export { Text } from './primitives/text';
71
73
  export * from './theme';
@@ -47,10 +47,6 @@ export const OverlayStackContext = React.createContext<OverlayStackRuntime | nul
47
47
 
48
48
  export const OverlayStackActionsContext = React.createContext<OverlayStackActions | null>(null);
49
49
 
50
- export function useOverlayStack(): OverlayStackRuntime | null {
51
- return React.useContext(OverlayStackContext);
52
- }
53
-
54
50
  export function useOverlayStackActions(): OverlayStackActions | null {
55
51
  return React.useContext(OverlayStackActionsContext);
56
52
  }
@@ -1,4 +1,4 @@
1
- export type FieldStateName = 'default' | 'focused' | 'disabled' | 'invalid' | 'readOnly';
1
+ type FieldStateName = 'default' | 'focused' | 'disabled' | 'invalid' | 'readOnly';
2
2
 
3
3
  export interface FieldState {
4
4
  name: FieldStateName;
@@ -0,0 +1,61 @@
1
+ import React from 'react';
2
+ import { type StyleProp, View, type ViewStyle } from 'react-native';
3
+ import { SafeAreaInsetsContext } from 'react-native-safe-area-context';
4
+
5
+ import { useTheme } from '../theme/ThemeContext';
6
+ import { Box, type BoxProps } from './Box';
7
+ import { Divider } from './Divider';
8
+
9
+ export interface AppBarProps extends Omit<BoxProps, 'children'> {
10
+ leading?: React.ReactNode;
11
+ trailing?: React.ReactNode;
12
+ children?: React.ReactNode;
13
+ safeAreaTop?: boolean;
14
+ divider?: boolean;
15
+ contentStyle?: StyleProp<ViewStyle>;
16
+ }
17
+
18
+ export function AppBar({
19
+ leading,
20
+ trailing,
21
+ children,
22
+ safeAreaTop = true,
23
+ divider = false,
24
+ contentStyle,
25
+ bg,
26
+ style,
27
+ ...props
28
+ }: AppBarProps) {
29
+ const { theme } = useTheme();
30
+ const insets = React.useContext(SafeAreaInsetsContext);
31
+ const topInset = safeAreaTop ? (insets?.top ?? 0) : 0;
32
+ const safeAreaStyle: ViewStyle | undefined =
33
+ topInset === 0 ? undefined : { paddingTop: topInset };
34
+
35
+ return (
36
+ <Box {...props} bg={bg ?? theme.semantics.surface.default} style={[style]}>
37
+ <View style={safeAreaStyle}>
38
+ <View
39
+ style={[
40
+ {
41
+ minHeight: 56,
42
+ flexDirection: 'row',
43
+ alignItems: 'center',
44
+ paddingHorizontal: theme.spacing.m,
45
+ },
46
+ contentStyle,
47
+ ]}
48
+ >
49
+ {leading ? (
50
+ <View style={{ marginRight: theme.spacing.s, flexShrink: 0 }}>{leading}</View>
51
+ ) : null}
52
+ <View style={{ flex: 1, minWidth: 0 }}>{children}</View>
53
+ {trailing ? (
54
+ <View style={{ marginLeft: theme.spacing.s, flexShrink: 0 }}>{trailing}</View>
55
+ ) : null}
56
+ </View>
57
+ {divider ? <Divider color={theme.semantics.neutral.divider} thickness={1} /> : null}
58
+ </View>
59
+ </Box>
60
+ );
61
+ }
@@ -9,8 +9,8 @@ type SpaceToken = keyof SurfaceTheme['spacing'];
9
9
  type RadiusToken = keyof SurfaceTheme['radii'];
10
10
  type ColorToken = keyof SurfaceTheme['colors'];
11
11
 
12
+ type RadiusValue = number | RadiusToken;
12
13
  export type SpaceValue = number | SpaceToken;
13
- export type RadiusValue = number | RadiusToken;
14
14
  export type ColorValue = string | ColorToken;
15
15
 
16
16
  export interface BoxStyleProps {
@@ -63,19 +63,13 @@ export function resolveSpacing(
63
63
  return theme.spacing[value as SpaceToken];
64
64
  }
65
65
 
66
- export function resolveRadius(
67
- theme: SurfaceTheme,
68
- value: RadiusValue | undefined,
69
- ): number | undefined {
66
+ function resolveRadius(theme: SurfaceTheme, value: RadiusValue | undefined): number | undefined {
70
67
  if (value === undefined) return undefined;
71
68
  if (typeof value === 'number') return value;
72
69
  return theme.radii[value];
73
70
  }
74
71
 
75
- export function resolveColor(
76
- theme: SurfaceTheme,
77
- value: ColorValue | undefined,
78
- ): string | undefined {
72
+ function resolveColor(theme: SurfaceTheme, value: ColorValue | undefined): string | undefined {
79
73
  if (value === undefined) return undefined;
80
74
  if (Object.prototype.hasOwnProperty.call(theme.colors, value)) {
81
75
  return theme.colors[value];
@@ -83,7 +77,7 @@ export function resolveColor(
83
77
  return value as string;
84
78
  }
85
79
 
86
- export function resolveDimension(
80
+ function resolveDimension(
87
81
  theme: SurfaceTheme,
88
82
  value: number | string | undefined,
89
83
  ): number | string | undefined {
@@ -1,3 +1,5 @@
1
+ export type { AppBarProps } from './AppBar';
2
+ export { AppBar } from './AppBar';
1
3
  export type { BoxProps } from './Box';
2
4
  export { Box } from './Box';
3
5
  export type { CenterProps } from './Center';
@@ -0,0 +1,68 @@
1
+ import React from 'react';
2
+ import { Image as RNImage } from 'react-native';
3
+
4
+ import { useTheme } from '../../theme/ThemeContext';
5
+ import {
6
+ getSourceKey,
7
+ normalizeSource,
8
+ resolveAccessibilityLabel,
9
+ resolveAlt,
10
+ resolveImageStyle,
11
+ resolveRenderedSource,
12
+ resolveResizeMode,
13
+ } from './resolveImageProps';
14
+ import type { ImageProps } from './types';
15
+
16
+ export function Image({
17
+ source,
18
+ fallbackSource,
19
+ alt,
20
+ accessibilityLabel,
21
+ width,
22
+ height,
23
+ aspectRatio,
24
+ fit,
25
+ resizeMode,
26
+ radius,
27
+ style,
28
+ testID,
29
+ onError,
30
+ }: ImageProps) {
31
+ const { theme } = useTheme();
32
+ const [showFallback, setShowFallback] = React.useState(false);
33
+ const primaryKey = React.useMemo(() => getSourceKey(source), [source]);
34
+
35
+ React.useEffect(() => {
36
+ setShowFallback(false);
37
+ }, [primaryKey]);
38
+
39
+ const normalizedPrimary = normalizeSource(source);
40
+ const normalizedFallback = normalizeSource(fallbackSource);
41
+ const resolvedSource = resolveRenderedSource(normalizedPrimary, normalizedFallback, showFallback);
42
+
43
+ if (!resolvedSource) return null;
44
+
45
+ const resolvedResizeMode = resolveResizeMode(fit, resizeMode);
46
+ const resolvedAccessibilityLabel = resolveAccessibilityLabel(alt, accessibilityLabel);
47
+ const resolvedAlt = resolveAlt(alt, accessibilityLabel);
48
+ const resolvedStyle = resolveImageStyle(theme, { width, height, aspectRatio, radius });
49
+
50
+ return (
51
+ <RNImage
52
+ accessibilityLabel={resolvedAccessibilityLabel}
53
+ accessibilityRole="image"
54
+ alt={resolvedAlt}
55
+ onError={(event) => {
56
+ onError?.(event);
57
+
58
+ if (!showFallback && normalizedFallback) {
59
+ setShowFallback(true);
60
+ }
61
+ }}
62
+ resizeMode={resolvedResizeMode}
63
+ source={resolvedSource}
64
+ style={[resolvedStyle, style]}
65
+ testID={testID}
66
+ />
67
+ );
68
+ }
@@ -0,0 +1,2 @@
1
+ export { Image } from './Image';
2
+ export type { ImageFit, ImageProps, SurfaceImageSource } from './types';
@@ -0,0 +1,81 @@
1
+ import { describe, expect, it } from 'bun:test';
2
+
3
+ import { createTheme } from '../../theme/createTheme';
4
+ import {
5
+ getSourceKey,
6
+ normalizeSource,
7
+ resolveImageStyle,
8
+ resolveRenderedSource,
9
+ resolveResizeMode,
10
+ } from './resolveImageProps';
11
+
12
+ describe('normalizeSource', () => {
13
+ it('normalizes string sources into uri objects', () => {
14
+ expect(normalizeSource('https://example.com/image.png')).toEqual({
15
+ uri: 'https://example.com/image.png',
16
+ });
17
+ });
18
+
19
+ it('passes through react-native image sources', () => {
20
+ expect(normalizeSource({ uri: 'https://example.com/image.png' })).toEqual({
21
+ uri: 'https://example.com/image.png',
22
+ });
23
+ });
24
+
25
+ it('returns undefined for nullish sources', () => {
26
+ expect(normalizeSource(null)).toBeUndefined();
27
+ expect(normalizeSource(undefined)).toBeUndefined();
28
+ });
29
+ });
30
+
31
+ describe('resolveResizeMode', () => {
32
+ it('prefers fit over resizeMode', () => {
33
+ expect(resolveResizeMode('contain', 'cover')).toBe('contain');
34
+ });
35
+
36
+ it('defaults to cover when both are absent', () => {
37
+ expect(resolveResizeMode(undefined, undefined)).toBe('cover');
38
+ });
39
+ });
40
+
41
+ describe('resolveRenderedSource', () => {
42
+ it('renders fallback when the primary source is absent', () => {
43
+ const normalizedFallback = normalizeSource('https://example.com/fallback.png');
44
+ expect(resolveRenderedSource(undefined, normalizedFallback, false)).toEqual(normalizedFallback);
45
+ });
46
+ });
47
+
48
+ describe('getSourceKey', () => {
49
+ it('derives stable keys for string and uri sources', () => {
50
+ expect(getSourceKey('https://example.com/image.png')).toBe('uri:https://example.com/image.png');
51
+ expect(getSourceKey({ uri: 'https://example.com/image.png' })).toBe(
52
+ 'uri:https://example.com/image.png',
53
+ );
54
+ });
55
+
56
+ it('derives stable keys for asset sources', () => {
57
+ expect(getSourceKey(12)).toBe('asset:12');
58
+ });
59
+
60
+ it('derives stable keys for uri sets', () => {
61
+ expect(getSourceKey([{ uri: 'a' }, { uri: 'b' }])).toBe('uri-set:a|b');
62
+ });
63
+ });
64
+
65
+ describe('resolveImageStyle', () => {
66
+ it('resolves spacing tokens for width/height and preserves raw strings', () => {
67
+ const theme = createTheme();
68
+ const style = resolveImageStyle(theme, { width: 'm', height: '100%' });
69
+
70
+ expect(style.width).toBe(theme.spacing.m);
71
+ expect(style.height).toBe('100%');
72
+ });
73
+
74
+ it('resolves radius tokens for borderRadius', () => {
75
+ const theme = createTheme();
76
+ const style = resolveImageStyle(theme, { radius: 'full' });
77
+
78
+ expect(style.borderRadius).toBe(theme.radii.full);
79
+ expect(style.overflow).toBe('hidden');
80
+ });
81
+ });
@@ -0,0 +1,92 @@
1
+ import type { ImageResizeMode, ImageSourcePropType } from 'react-native';
2
+ import type { ImageStyle } from 'react-native';
3
+
4
+ import { resolveToken } from '../../theme/resolveToken';
5
+ import type { SurfaceTheme } from '../../theme/types';
6
+ import type { ImageProps, SurfaceImageSource } from './types';
7
+
8
+ export function normalizeSource(
9
+ source: SurfaceImageSource | null | undefined,
10
+ ): ImageSourcePropType | undefined {
11
+ if (source === null || source === undefined) return undefined;
12
+ if (typeof source === 'string') return { uri: source };
13
+ return source;
14
+ }
15
+
16
+ export function resolveRenderedSource(
17
+ normalizedPrimary: ImageSourcePropType | undefined,
18
+ normalizedFallback: ImageSourcePropType | undefined,
19
+ showFallback: boolean,
20
+ ): ImageSourcePropType | undefined {
21
+ if (showFallback || !normalizedPrimary) return normalizedFallback;
22
+ return normalizedPrimary;
23
+ }
24
+
25
+ function getUriFromSource(source: ImageSourcePropType): string | undefined {
26
+ if (Array.isArray(source)) {
27
+ const [first] = source;
28
+ return first?.uri;
29
+ }
30
+
31
+ if (typeof source === 'number') return undefined;
32
+ return source.uri;
33
+ }
34
+
35
+ export function getSourceKey(source: SurfaceImageSource | null | undefined): string | null {
36
+ if (source === null || source === undefined) return null;
37
+ if (typeof source === 'string') return `uri:${source}`;
38
+ if (typeof source === 'number') return `asset:${source}`;
39
+ if (Array.isArray(source)) {
40
+ const parts = source
41
+ .map((item) => item.uri)
42
+ .filter((value): value is string => typeof value === 'string');
43
+ return `uri-set:${parts.join('|')}`;
44
+ }
45
+
46
+ const uri = getUriFromSource(source);
47
+ if (uri) return `uri:${uri}`;
48
+
49
+ try {
50
+ return `src:${JSON.stringify(source)}`;
51
+ } catch {
52
+ return 'src:unknown';
53
+ }
54
+ }
55
+
56
+ export function resolveResizeMode(
57
+ fit: ImageProps['fit'],
58
+ resizeMode: ImageProps['resizeMode'],
59
+ ): ImageResizeMode {
60
+ return fit ?? resizeMode ?? 'cover';
61
+ }
62
+
63
+ export function resolveAccessibilityLabel(
64
+ alt: ImageProps['alt'],
65
+ accessibilityLabel: ImageProps['accessibilityLabel'],
66
+ ): string | undefined {
67
+ return accessibilityLabel ?? alt;
68
+ }
69
+
70
+ export function resolveAlt(
71
+ alt: ImageProps['alt'],
72
+ accessibilityLabel: ImageProps['accessibilityLabel'],
73
+ ): string | undefined {
74
+ return alt ?? accessibilityLabel;
75
+ }
76
+
77
+ export function resolveImageStyle(
78
+ theme: SurfaceTheme,
79
+ props: Pick<ImageProps, 'width' | 'height' | 'aspectRatio' | 'radius'>,
80
+ ): ImageStyle {
81
+ const width = resolveToken(theme.spacing, props.width);
82
+ const height = resolveToken(theme.spacing, props.height);
83
+ const borderRadius = resolveToken(theme.radii, props.radius);
84
+
85
+ return {
86
+ width,
87
+ height,
88
+ aspectRatio: props.aspectRatio,
89
+ borderRadius,
90
+ overflow: borderRadius !== undefined ? 'hidden' : undefined,
91
+ };
92
+ }
@@ -0,0 +1,28 @@
1
+ import type {
2
+ ImageProps as ReactNativeImageProps,
3
+ ImageResizeMode,
4
+ ImageSourcePropType,
5
+ } from 'react-native';
6
+ import type { ImageStyle, StyleProp } from 'react-native';
7
+
8
+ import type { SurfaceTheme } from '../../theme/types';
9
+
10
+ export type SurfaceImageSource = string | ImageSourcePropType;
11
+
12
+ export type ImageFit = ImageResizeMode;
13
+
14
+ export interface ImageProps {
15
+ source?: SurfaceImageSource | null;
16
+ fallbackSource?: SurfaceImageSource | null;
17
+ alt?: string;
18
+ accessibilityLabel?: string;
19
+ width?: number | string;
20
+ height?: number | string;
21
+ aspectRatio?: number;
22
+ fit?: ImageFit;
23
+ resizeMode?: ImageResizeMode;
24
+ radius?: number | keyof SurfaceTheme['radii'];
25
+ style?: StyleProp<ImageStyle>;
26
+ testID?: string;
27
+ onError?: ReactNativeImageProps['onError'];
28
+ }