@ankhorage/surface 3.4.5 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -6
  3. package/dist/components/radio/Radio.d.ts +3 -0
  4. package/dist/components/radio/Radio.d.ts.map +1 -1
  5. package/dist/components/radio/Radio.js +8 -2
  6. package/dist/components/radio/Radio.js.map +1 -1
  7. package/dist/components/radio/isRadioTextContent.d.ts +6 -0
  8. package/dist/components/radio/isRadioTextContent.d.ts.map +1 -0
  9. package/dist/components/radio/isRadioTextContent.js +7 -0
  10. package/dist/components/radio/isRadioTextContent.js.map +1 -0
  11. package/dist/examples/DocsExamples.d.ts.map +1 -1
  12. package/dist/examples/DocsExamples.js +0 -6
  13. package/dist/examples/DocsExamples.js.map +1 -1
  14. package/dist/index.d.ts +0 -6
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +0 -3
  17. package/dist/index.js.map +1 -1
  18. package/package.json +2 -2
  19. package/src/components/radio/Radio.test.ts +20 -0
  20. package/src/components/radio/Radio.tsx +9 -3
  21. package/src/components/radio/isRadioTextContent.ts +8 -0
  22. package/src/examples/DocsExamples.tsx +0 -6
  23. package/src/index.test.ts +24 -13
  24. package/src/index.ts +0 -22
  25. package/dist/components/action-sheet/ActionSheet.d.ts +0 -4
  26. package/dist/components/action-sheet/ActionSheet.d.ts.map +0 -1
  27. package/dist/components/action-sheet/ActionSheet.js +0 -77
  28. package/dist/components/action-sheet/ActionSheet.js.map +0 -1
  29. package/dist/components/action-sheet/ActionSheetItem.d.ts +0 -4
  30. package/dist/components/action-sheet/ActionSheetItem.d.ts.map +0 -1
  31. package/dist/components/action-sheet/ActionSheetItem.js +0 -27
  32. package/dist/components/action-sheet/ActionSheetItem.js.map +0 -1
  33. package/dist/components/action-sheet/index.d.ts +0 -4
  34. package/dist/components/action-sheet/index.d.ts.map +0 -1
  35. package/dist/components/action-sheet/index.js +0 -3
  36. package/dist/components/action-sheet/index.js.map +0 -1
  37. package/dist/components/action-sheet/types.d.ts +0 -27
  38. package/dist/components/action-sheet/types.d.ts.map +0 -1
  39. package/dist/components/action-sheet/types.js +0 -2
  40. package/dist/components/action-sheet/types.js.map +0 -1
  41. package/dist/components/drawer/Drawer.d.ts +0 -4
  42. package/dist/components/drawer/Drawer.d.ts.map +0 -1
  43. package/dist/components/drawer/Drawer.js +0 -62
  44. package/dist/components/drawer/Drawer.js.map +0 -1
  45. package/dist/components/drawer/index.d.ts +0 -3
  46. package/dist/components/drawer/index.d.ts.map +0 -1
  47. package/dist/components/drawer/index.js +0 -2
  48. package/dist/components/drawer/index.js.map +0 -1
  49. package/dist/components/drawer/types.d.ts +0 -12
  50. package/dist/components/drawer/types.d.ts.map +0 -1
  51. package/dist/components/drawer/types.js +0 -2
  52. package/dist/components/drawer/types.js.map +0 -1
  53. package/dist/components/navigation/DrawerNavigation.d.ts +0 -4
  54. package/dist/components/navigation/DrawerNavigation.d.ts.map +0 -1
  55. package/dist/components/navigation/DrawerNavigation.js +0 -13
  56. package/dist/components/navigation/DrawerNavigation.js.map +0 -1
  57. package/dist/components/navigation/DrawerNavigationItem.d.ts +0 -4
  58. package/dist/components/navigation/DrawerNavigationItem.d.ts.map +0 -1
  59. package/dist/components/navigation/DrawerNavigationItem.js +0 -9
  60. package/dist/components/navigation/DrawerNavigationItem.js.map +0 -1
  61. package/dist/components/navigation/NavigationItem.d.ts +0 -4
  62. package/dist/components/navigation/NavigationItem.d.ts.map +0 -1
  63. package/dist/components/navigation/NavigationItem.js +0 -41
  64. package/dist/components/navigation/NavigationItem.js.map +0 -1
  65. package/dist/components/navigation/NavigationList.d.ts +0 -4
  66. package/dist/components/navigation/NavigationList.d.ts.map +0 -1
  67. package/dist/components/navigation/NavigationList.js +0 -9
  68. package/dist/components/navigation/NavigationList.js.map +0 -1
  69. package/dist/components/navigation/TabBar.d.ts +0 -4
  70. package/dist/components/navigation/TabBar.d.ts.map +0 -1
  71. package/dist/components/navigation/TabBar.js +0 -15
  72. package/dist/components/navigation/TabBar.js.map +0 -1
  73. package/dist/components/navigation/TabBarItem.d.ts +0 -4
  74. package/dist/components/navigation/TabBarItem.d.ts.map +0 -1
  75. package/dist/components/navigation/TabBarItem.js +0 -44
  76. package/dist/components/navigation/TabBarItem.js.map +0 -1
  77. package/dist/components/navigation/helpers.d.ts +0 -15
  78. package/dist/components/navigation/helpers.d.ts.map +0 -1
  79. package/dist/components/navigation/helpers.js +0 -48
  80. package/dist/components/navigation/helpers.js.map +0 -1
  81. package/dist/components/navigation/index.d.ts +0 -8
  82. package/dist/components/navigation/index.d.ts.map +0 -1
  83. package/dist/components/navigation/index.js +0 -7
  84. package/dist/components/navigation/index.js.map +0 -1
  85. package/dist/components/navigation/types.d.ts +0 -58
  86. package/dist/components/navigation/types.d.ts.map +0 -1
  87. package/dist/components/navigation/types.js +0 -2
  88. package/dist/components/navigation/types.js.map +0 -1
  89. package/src/components/action-sheet/ActionSheet.tsx +0 -130
  90. package/src/components/action-sheet/ActionSheetItem.tsx +0 -59
  91. package/src/components/action-sheet/index.ts +0 -3
  92. package/src/components/action-sheet/types.ts +0 -29
  93. package/src/components/drawer/Drawer.tsx +0 -100
  94. package/src/components/drawer/index.ts +0 -2
  95. package/src/components/drawer/types.ts +0 -13
  96. package/src/components/navigation/DrawerNavigation.tsx +0 -32
  97. package/src/components/navigation/DrawerNavigationItem.tsx +0 -23
  98. package/src/components/navigation/NavigationItem.tsx +0 -79
  99. package/src/components/navigation/NavigationList.tsx +0 -31
  100. package/src/components/navigation/TabBar.tsx +0 -31
  101. package/src/components/navigation/TabBarItem.tsx +0 -79
  102. package/src/components/navigation/helpers.test.ts +0 -74
  103. package/src/components/navigation/helpers.ts +0 -81
  104. package/src/components/navigation/index.ts +0 -16
  105. package/src/components/navigation/policy.test.ts +0 -140
  106. package/src/components/navigation/types.ts +0 -66
@@ -1,15 +0,0 @@
1
- import type { AccessibilityState } from 'react-native';
2
- import type { InteractionState } from '../../internal/resolvers/resolveInteractiveState';
3
- import type { SurfaceTheme } from '../../theme/types';
4
- export declare function resolveNavigationAccessibilityState(active: boolean, disabled: boolean, accessibilityState?: AccessibilityState): AccessibilityState;
5
- export interface ResolvedNavigationItemPresentation {
6
- backgroundColor: string;
7
- contentColor: string;
8
- opacity: number;
9
- }
10
- export declare function resolveNavigationItemPresentation(theme: SurfaceTheme, { active, disabled, state, }: {
11
- active: boolean;
12
- disabled: boolean;
13
- state: InteractionState;
14
- }): ResolvedNavigationItemPresentation;
15
- //# sourceMappingURL=helpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/components/navigation/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AACzF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,wBAAgB,mCAAmC,CACjD,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,OAAO,EACjB,kBAAkB,CAAC,EAAE,kBAAkB,GACtC,kBAAkB,CAYpB;AAED,MAAM,WAAW,kCAAkC;IACjD,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,YAAY,EACnB,EACE,MAAM,EACN,QAAQ,EACR,KAAK,GACN,EAAE;IACD,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,gBAAgB,CAAC;CACzB,GACA,kCAAkC,CAwCpC"}
@@ -1,48 +0,0 @@
1
- export function resolveNavigationAccessibilityState(active, disabled, accessibilityState) {
2
- const resolved = { ...(accessibilityState ?? {}) };
3
- if (active) {
4
- resolved.selected = true;
5
- }
6
- if (disabled) {
7
- resolved.disabled = true;
8
- }
9
- return resolved;
10
- }
11
- export function resolveNavigationItemPresentation(theme, { active, disabled, state, }) {
12
- const interactionState = disabled ? { ...state, hovered: false, pressed: false } : state;
13
- if (disabled) {
14
- return {
15
- backgroundColor: theme.semantics.surface.disabled,
16
- contentColor: theme.semantics.content.disabled,
17
- opacity: 1,
18
- };
19
- }
20
- const contentColor = active
21
- ? interactionState.pressed
22
- ? theme.semantics.action.primary.onSoftActiveText
23
- : interactionState.hovered
24
- ? theme.semantics.action.primary.onSoftHoverText
25
- : theme.semantics.action.primary.onSoftText
26
- : theme.semantics.content.default;
27
- if (active) {
28
- return {
29
- backgroundColor: interactionState.pressed
30
- ? theme.semantics.action.primary.softActive
31
- : interactionState.hovered
32
- ? theme.semantics.action.primary.softHover
33
- : theme.semantics.action.primary.softBg,
34
- contentColor,
35
- opacity: 1,
36
- };
37
- }
38
- return {
39
- backgroundColor: interactionState.pressed
40
- ? theme.semantics.neutral.surfaceActive
41
- : interactionState.hovered
42
- ? theme.semantics.neutral.surfaceHover
43
- : 'transparent',
44
- contentColor,
45
- opacity: 1,
46
- };
47
- }
48
- //# sourceMappingURL=helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/components/navigation/helpers.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,mCAAmC,CACjD,MAAe,EACf,QAAiB,EACjB,kBAAuC;IAEvC,MAAM,QAAQ,GAAuB,EAAE,GAAG,CAAC,kBAAkB,IAAI,EAAE,CAAC,EAAE,CAAC;IAEvE,IAAI,MAAM,EAAE,CAAC;QACX,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC;IAC3B,CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACb,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC;IAC3B,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAQD,MAAM,UAAU,iCAAiC,CAC/C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eAAe,EAAE,gBAAgB,CAAC,OAAO;YACvC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,aAAa;YACvC,CAAC,CAAC,gBAAgB,CAAC,OAAO;gBACxB,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY;gBACtC,CAAC,CAAC,aAAa;QACnB,YAAY;QACZ,OAAO,EAAE,CAAC;KACX,CAAC;AACJ,CAAC","sourcesContent":["import type { AccessibilityState } from 'react-native';\n\nimport type { InteractionState } from '../../internal/resolvers/resolveInteractiveState';\nimport type { SurfaceTheme } from '../../theme/types';\n\nexport function resolveNavigationAccessibilityState(\n active: boolean,\n disabled: boolean,\n accessibilityState?: AccessibilityState,\n): AccessibilityState {\n const resolved: AccessibilityState = { ...(accessibilityState ?? {}) };\n\n if (active) {\n resolved.selected = true;\n }\n\n if (disabled) {\n resolved.disabled = true;\n }\n\n return resolved;\n}\n\nexport interface ResolvedNavigationItemPresentation {\n backgroundColor: string;\n contentColor: string;\n opacity: number;\n}\n\nexport function resolveNavigationItemPresentation(\n theme: SurfaceTheme,\n {\n active,\n disabled,\n state,\n }: {\n active: boolean;\n disabled: boolean;\n state: InteractionState;\n },\n): ResolvedNavigationItemPresentation {\n const interactionState = disabled ? { ...state, hovered: false, pressed: false } : state;\n\n if (disabled) {\n return {\n backgroundColor: theme.semantics.surface.disabled,\n contentColor: theme.semantics.content.disabled,\n opacity: 1,\n };\n }\n\n const contentColor = active\n ? interactionState.pressed\n ? theme.semantics.action.primary.onSoftActiveText\n : interactionState.hovered\n ? theme.semantics.action.primary.onSoftHoverText\n : theme.semantics.action.primary.onSoftText\n : theme.semantics.content.default;\n\n if (active) {\n return {\n backgroundColor: interactionState.pressed\n ? theme.semantics.action.primary.softActive\n : interactionState.hovered\n ? theme.semantics.action.primary.softHover\n : theme.semantics.action.primary.softBg,\n contentColor,\n opacity: 1,\n };\n }\n\n return {\n backgroundColor: interactionState.pressed\n ? theme.semantics.neutral.surfaceActive\n : interactionState.hovered\n ? theme.semantics.neutral.surfaceHover\n : 'transparent',\n contentColor,\n opacity: 1,\n };\n}\n"]}
@@ -1,8 +0,0 @@
1
- export { DrawerNavigation } from './DrawerNavigation';
2
- export { DrawerNavigationItem } from './DrawerNavigationItem';
3
- export { NavigationItem } from './NavigationItem';
4
- export { NavigationList } from './NavigationList';
5
- export { TabBar } from './TabBar';
6
- export { TabBarItem } from './TabBarItem';
7
- export type { DrawerNavigationItemProps, DrawerNavigationProps, NavigationItemIcon, NavigationItemProps, NavigationItemSpec, NavigationListProps, TabBarItemProps, TabBarProps, } from './types';
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/navigation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EACV,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,WAAW,GACZ,MAAM,SAAS,CAAC"}
@@ -1,7 +0,0 @@
1
- export { DrawerNavigation } from './DrawerNavigation';
2
- export { DrawerNavigationItem } from './DrawerNavigationItem';
3
- export { NavigationItem } from './NavigationItem';
4
- export { NavigationList } from './NavigationList';
5
- export { TabBar } from './TabBar';
6
- export { TabBarItem } from './TabBarItem';
7
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/navigation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export { DrawerNavigation } from './DrawerNavigation';\nexport { DrawerNavigationItem } from './DrawerNavigationItem';\nexport { NavigationItem } from './NavigationItem';\nexport { NavigationList } from './NavigationList';\nexport { TabBar } from './TabBar';\nexport { TabBarItem } from './TabBarItem';\nexport type {\n DrawerNavigationItemProps,\n DrawerNavigationProps,\n NavigationItemIcon,\n NavigationItemProps,\n NavigationItemSpec,\n NavigationListProps,\n TabBarItemProps,\n TabBarProps,\n} from './types';\n"]}
@@ -1,58 +0,0 @@
1
- import type React from 'react';
2
- import type { AccessibilityRole, AccessibilityState } from 'react-native';
3
- import type { InteractionPolicy } from '../../interactionPolicy';
4
- import type { IconSource } from '../../primitives/icon';
5
- export type NavigationItemIcon = IconSource;
6
- export interface NavigationItemSpec {
7
- id: string;
8
- label: React.ReactNode;
9
- icon?: NavigationItemIcon;
10
- badge?: React.ReactNode;
11
- active?: boolean;
12
- disabled?: boolean;
13
- onPress?: (() => void) | undefined;
14
- accessibilityLabel?: string;
15
- accessibilityRole?: AccessibilityRole;
16
- accessibilityState?: AccessibilityState;
17
- testID?: string;
18
- }
19
- export interface NavigationItemProps {
20
- item: NavigationItemSpec;
21
- compact?: boolean;
22
- testID?: string;
23
- interactionPolicy?: InteractionPolicy;
24
- }
25
- export interface NavigationListProps {
26
- items: readonly NavigationItemSpec[];
27
- orientation?: 'vertical' | 'horizontal';
28
- compact?: boolean;
29
- testID?: string;
30
- interactionPolicy?: InteractionPolicy;
31
- }
32
- export interface TabBarProps {
33
- items: readonly NavigationItemSpec[];
34
- compact?: boolean;
35
- testID?: string;
36
- interactionPolicy?: InteractionPolicy;
37
- }
38
- export interface TabBarItemProps {
39
- item: NavigationItemSpec;
40
- compact?: boolean;
41
- testID?: string;
42
- interactionPolicy?: InteractionPolicy;
43
- }
44
- export interface DrawerNavigationProps {
45
- items: readonly NavigationItemSpec[];
46
- header?: React.ReactNode;
47
- footer?: React.ReactNode;
48
- compact?: boolean;
49
- testID?: string;
50
- interactionPolicy?: InteractionPolicy;
51
- }
52
- export interface DrawerNavigationItemProps {
53
- item: NavigationItemSpec;
54
- compact?: boolean;
55
- testID?: string;
56
- interactionPolicy?: InteractionPolicy;
57
- }
58
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/navigation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAE5C,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACnC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,iBAAiB,C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OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/navigation/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type { AccessibilityRole, AccessibilityState } from 'react-native';\n\nimport type { InteractionPolicy } from '../../interactionPolicy';\nimport type { IconSource } from '../../primitives/icon';\n\nexport type NavigationItemIcon = IconSource;\n\nexport interface NavigationItemSpec {\n id: string;\n label: React.ReactNode;\n icon?: NavigationItemIcon;\n badge?: React.ReactNode;\n active?: boolean;\n disabled?: boolean;\n onPress?: (() => void) | undefined;\n accessibilityLabel?: string;\n accessibilityRole?: AccessibilityRole;\n accessibilityState?: AccessibilityState;\n testID?: string;\n}\n\nexport interface NavigationItemProps {\n item: NavigationItemSpec;\n compact?: boolean;\n testID?: string;\n interactionPolicy?: InteractionPolicy;\n}\n\nexport interface NavigationListProps {\n items: readonly NavigationItemSpec[];\n orientation?: 'vertical' | 'horizontal';\n compact?: boolean;\n testID?: string;\n interactionPolicy?: InteractionPolicy;\n}\n\nexport interface TabBarProps {\n items: readonly NavigationItemSpec[];\n compact?: boolean;\n testID?: string;\n interactionPolicy?: InteractionPolicy;\n}\n\nexport interface TabBarItemProps {\n item: NavigationItemSpec;\n compact?: boolean;\n testID?: string;\n interactionPolicy?: InteractionPolicy;\n}\n\nexport interface DrawerNavigationProps {\n items: readonly NavigationItemSpec[];\n header?: React.ReactNode;\n footer?: React.ReactNode;\n compact?: boolean;\n testID?: string;\n interactionPolicy?: InteractionPolicy;\n}\n\nexport interface DrawerNavigationItemProps {\n item: NavigationItemSpec;\n compact?: boolean;\n testID?: string;\n interactionPolicy?: InteractionPolicy;\n}\n"]}
@@ -1,130 +0,0 @@
1
- import React from 'react';
2
- import { Pressable, View } from 'react-native';
3
-
4
- import { FocusScope } from '../../internal/focus/FocusScope';
5
- import { Portal } from '../../internal/overlay/Portal';
6
- import { resolvePointerEvents } from '../../internal/resolvePointerEvents';
7
- import { resolveOverlayAnimation } from '../../internal/resolvers';
8
- import { Box, Stack, Surface } from '../../layout';
9
- import { Text } from '../../primitives/text';
10
- import { useTheme } from '../../theme/ThemeContext';
11
- import { ActionSheetItem } from './ActionSheetItem';
12
- import type { ActionSheetProps } from './types';
13
-
14
- const boxNonePointerEvents = resolvePointerEvents('box-none');
15
-
16
- export function ActionSheet({
17
- visible,
18
- onDismiss,
19
- title,
20
- description,
21
- children,
22
- cancelLabel = 'Cancel',
23
- closeOnBackdrop = true,
24
- interactionPolicy = 'enabled',
25
- testID,
26
- }: ActionSheetProps) {
27
- const { theme } = useTheme();
28
- const animation = resolveOverlayAnimation('modal');
29
- const passive = interactionPolicy === 'passive';
30
-
31
- if (!visible) {
32
- return null;
33
- }
34
-
35
- return (
36
- <Portal layer="modal" visible={visible}>
37
- <View
38
- {...boxNonePointerEvents.props}
39
- style={[
40
- boxNonePointerEvents.style,
41
- {
42
- bottom: 0,
43
- left: 0,
44
- position: 'absolute',
45
- right: 0,
46
- top: 0,
47
- },
48
- ]}
49
- >
50
- <Pressable
51
- onPress={passive ? undefined : closeOnBackdrop ? onDismiss : undefined}
52
- style={{
53
- backgroundColor: theme.semantics.neutral.text,
54
- bottom: 0,
55
- left: 0,
56
- opacity: animation.backdropOpacity,
57
- position: 'absolute',
58
- right: 0,
59
- top: 0,
60
- }}
61
- testID={testID ? `${testID}-backdrop` : undefined}
62
- />
63
- <FocusScope
64
- active={visible}
65
- onEscape={passive ? undefined : onDismiss}
66
- testID={testID ? `${testID}-focus` : undefined}
67
- >
68
- <Box
69
- pointerEvents="box-none"
70
- style={{
71
- flex: 1,
72
- justifyContent: 'flex-end',
73
- }}
74
- >
75
- <View
76
- accessible
77
- accessibilityViewIsModal
78
- style={{
79
- alignSelf: 'center',
80
- maxWidth: 560,
81
- padding: 16,
82
- width: '100%',
83
- }}
84
- >
85
- <Surface
86
- p="m"
87
- style={{
88
- borderRadius: 24,
89
- shadowOpacity: 0.16,
90
- shadowRadius: 18,
91
- shadowOffset: { width: 0, height: -8 },
92
- }}
93
- testID={testID}
94
- variant="raised"
95
- >
96
- <Stack gap="s">
97
- {title || description ? (
98
- <Box px="m" py="s">
99
- <Stack gap="xxs">
100
- {title ? (
101
- <Text align="center" variant="label" weight="semiBold">
102
- {title}
103
- </Text>
104
- ) : null}
105
- {description ? (
106
- <Text align="center" emphasis="muted" variant="bodySmall">
107
- {description}
108
- </Text>
109
- ) : null}
110
- </Stack>
111
- </Box>
112
- ) : null}
113
- <Stack gap="xxs">{children}</Stack>
114
- {onDismiss ? (
115
- <ActionSheetItem
116
- label={cancelLabel}
117
- interactionPolicy={interactionPolicy}
118
- onPress={onDismiss}
119
- testID={testID ? `${testID}-cancel` : undefined}
120
- />
121
- ) : null}
122
- </Stack>
123
- </Surface>
124
- </View>
125
- </Box>
126
- </FocusScope>
127
- </View>
128
- </Portal>
129
- );
130
- }
@@ -1,59 +0,0 @@
1
- import React from 'react';
2
-
3
- import { Box, Inline, Stack } from '../../layout';
4
- import { ButtonBase } from '../../primitives/button-base';
5
- import { Text } from '../../primitives/text';
6
- import type { ActionSheetItemProps } from './types';
7
-
8
- export function ActionSheetItem({
9
- label,
10
- description,
11
- leading,
12
- trailing,
13
- color,
14
- disabled = false,
15
- selected = false,
16
- interactionPolicy = 'enabled',
17
- onPress,
18
- testID,
19
- }: ActionSheetItemProps) {
20
- return (
21
- <ButtonBase
22
- accessibilityRole="button"
23
- accessibilityState={{ disabled, selected }}
24
- disabled={disabled}
25
- interactionPolicy={interactionPolicy}
26
- onPress={onPress}
27
- radius="m"
28
- testID={testID}
29
- >
30
- {(state) => (
31
- <Box
32
- px="m"
33
- py="m"
34
- radius="m"
35
- style={{
36
- opacity: state.disabled ? 0.56 : 1,
37
- }}
38
- >
39
- <Inline align="center" gap="m" justify="space-between" wrap="nowrap">
40
- {leading ? <Box>{leading}</Box> : null}
41
- <Box flex={1}>
42
- <Stack gap="xxs">
43
- <Text color={color} variant="body" weight={selected ? 'semiBold' : 'medium'}>
44
- {label}
45
- </Text>
46
- {description ? (
47
- <Text emphasis="muted" variant="bodySmall">
48
- {description}
49
- </Text>
50
- ) : null}
51
- </Stack>
52
- </Box>
53
- {trailing ? <Box>{trailing}</Box> : null}
54
- </Inline>
55
- </Box>
56
- )}
57
- </ButtonBase>
58
- );
59
- }
@@ -1,3 +0,0 @@
1
- export { ActionSheet } from './ActionSheet';
2
- export { ActionSheetItem } from './ActionSheetItem';
3
- export type { ActionSheetItemProps, ActionSheetProps } from './types';
@@ -1,29 +0,0 @@
1
- import type React from 'react';
2
-
3
- import type { InteractionPolicy } from '../../interactionPolicy';
4
- import type { SurfaceColor } from '../../surfaceColor';
5
-
6
- export interface ActionSheetProps {
7
- visible: boolean;
8
- onDismiss?: (() => void) | undefined;
9
- title?: React.ReactNode;
10
- description?: React.ReactNode;
11
- children?: React.ReactNode;
12
- cancelLabel?: React.ReactNode;
13
- closeOnBackdrop?: boolean;
14
- interactionPolicy?: InteractionPolicy;
15
- testID?: string;
16
- }
17
-
18
- export interface ActionSheetItemProps {
19
- label: React.ReactNode;
20
- description?: React.ReactNode;
21
- leading?: React.ReactNode;
22
- trailing?: React.ReactNode;
23
- color?: SurfaceColor;
24
- disabled?: boolean;
25
- selected?: boolean;
26
- interactionPolicy?: InteractionPolicy;
27
- onPress?: (() => void) | undefined;
28
- testID?: string;
29
- }
@@ -1,100 +0,0 @@
1
- import React from 'react';
2
- import { Pressable, View } from 'react-native';
3
-
4
- import { FocusScope } from '../../internal/focus/FocusScope';
5
- import { Portal } from '../../internal/overlay/Portal';
6
- import { resolvePointerEvents } from '../../internal/resolvePointerEvents';
7
- import { resolveOverlayAnimation } from '../../internal/resolvers';
8
- import { Box, Surface } from '../../layout';
9
- import { useTheme } from '../../theme/ThemeContext';
10
- import type { DrawerProps } from './types';
11
-
12
- const boxNonePointerEvents = resolvePointerEvents('box-none');
13
-
14
- export function Drawer({
15
- visible,
16
- onDismiss,
17
- position = 'right',
18
- children,
19
- closeOnBackdrop = true,
20
- interactionPolicy = 'enabled',
21
- testID,
22
- }: DrawerProps) {
23
- const { theme } = useTheme();
24
- const animation = resolveOverlayAnimation('drawer');
25
- const passive = interactionPolicy === 'passive';
26
-
27
- if (!visible) {
28
- return null;
29
- }
30
-
31
- return (
32
- <Portal layer="drawer" visible={visible}>
33
- <View
34
- {...boxNonePointerEvents.props}
35
- style={[
36
- boxNonePointerEvents.style,
37
- {
38
- bottom: 0,
39
- left: 0,
40
- position: 'absolute',
41
- right: 0,
42
- top: 0,
43
- },
44
- ]}
45
- >
46
- <Pressable
47
- onPress={passive ? undefined : closeOnBackdrop ? onDismiss : undefined}
48
- style={{
49
- backgroundColor: theme.semantics.neutral.text,
50
- bottom: 0,
51
- left: 0,
52
- opacity: animation.backdropOpacity,
53
- position: 'absolute',
54
- right: 0,
55
- top: 0,
56
- }}
57
- testID={testID ? `${testID}-backdrop` : undefined}
58
- />
59
- <FocusScope
60
- active={visible}
61
- onEscape={passive ? undefined : onDismiss}
62
- testID={testID ? `${testID}-focus` : undefined}
63
- >
64
- <Box
65
- pointerEvents="box-none"
66
- style={{
67
- flex: 1,
68
- justifyContent: 'flex-start',
69
- }}
70
- >
71
- <View
72
- accessible
73
- accessibilityViewIsModal
74
- style={{
75
- alignSelf: position === 'left' ? 'flex-start' : 'flex-end',
76
- height: '100%',
77
- maxWidth: 420,
78
- width: '88%',
79
- }}
80
- >
81
- <Surface
82
- p="l"
83
- style={{
84
- height: '100%',
85
- shadowOpacity: 0.14,
86
- shadowRadius: 14,
87
- shadowOffset: { width: position === 'left' ? 4 : -4, height: 0 },
88
- }}
89
- testID={testID}
90
- variant="raised"
91
- >
92
- {children}
93
- </Surface>
94
- </View>
95
- </Box>
96
- </FocusScope>
97
- </View>
98
- </Portal>
99
- );
100
- }
@@ -1,2 +0,0 @@
1
- export { Drawer } from './Drawer';
2
- export type { DrawerProps } from './types';
@@ -1,13 +0,0 @@
1
- import type React from 'react';
2
-
3
- import type { InteractionPolicy } from '../../interactionPolicy';
4
-
5
- export interface DrawerProps {
6
- visible: boolean;
7
- onDismiss?: (() => void) | undefined;
8
- position?: 'left' | 'right';
9
- children?: React.ReactNode;
10
- closeOnBackdrop?: boolean;
11
- interactionPolicy?: InteractionPolicy;
12
- testID?: string;
13
- }
@@ -1,32 +0,0 @@
1
- import React from 'react';
2
-
3
- import { Stack } from '../../layout';
4
- import { DrawerNavigationItem } from './DrawerNavigationItem';
5
- import type { DrawerNavigationProps } from './types';
6
-
7
- export function DrawerNavigation({
8
- items,
9
- header,
10
- footer,
11
- compact = false,
12
- testID,
13
- interactionPolicy,
14
- }: DrawerNavigationProps) {
15
- return (
16
- <Stack gap={compact ? 's' : 'm'} testID={testID}>
17
- {header}
18
- <Stack gap={compact ? 'xs' : 's'}>
19
- {items.map((item) => (
20
- <DrawerNavigationItem
21
- compact={compact}
22
- interactionPolicy={interactionPolicy}
23
- item={item}
24
- key={item.id}
25
- testID={testID}
26
- />
27
- ))}
28
- </Stack>
29
- {footer}
30
- </Stack>
31
- );
32
- }
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
-
3
- import { NavigationItem } from './NavigationItem';
4
- import type { DrawerNavigationItemProps } from './types';
5
-
6
- export function DrawerNavigationItem({
7
- item,
8
- compact = false,
9
- testID,
10
- interactionPolicy,
11
- }: DrawerNavigationItemProps) {
12
- return (
13
- <NavigationItem
14
- compact={compact}
15
- interactionPolicy={interactionPolicy}
16
- item={{
17
- ...item,
18
- accessibilityRole: item.accessibilityRole ?? 'button',
19
- }}
20
- testID={testID}
21
- />
22
- );
23
- }
@@ -1,79 +0,0 @@
1
- import React from 'react';
2
- import { View } from 'react-native';
3
-
4
- import { Box } from '../../layout';
5
- import { ButtonBase } from '../../primitives/button-base';
6
- import { Icon } from '../../primitives/icon';
7
- import { Text } from '../../primitives/text';
8
- import { useTheme } from '../../theme/ThemeContext';
9
- import { resolveNavigationAccessibilityState, resolveNavigationItemPresentation } from './helpers';
10
- import type { NavigationItemProps } from './types';
11
-
12
- export function NavigationItem({
13
- item,
14
- compact = false,
15
- testID,
16
- interactionPolicy,
17
- }: NavigationItemProps) {
18
- const { theme } = useTheme();
19
- const active = Boolean(item.active);
20
- const disabled = Boolean(item.disabled);
21
- const resolvedTestID = item.testID ?? (testID ? `${testID}-item-${item.id}` : undefined);
22
- const resolvedAccessibilityState = resolveNavigationAccessibilityState(
23
- active,
24
- disabled,
25
- item.accessibilityState,
26
- );
27
-
28
- return (
29
- <ButtonBase
30
- accessibilityLabel={item.accessibilityLabel}
31
- accessibilityRole={item.accessibilityRole ?? 'button'}
32
- accessibilityState={resolvedAccessibilityState}
33
- disabled={disabled}
34
- interactionPolicy={interactionPolicy}
35
- onPress={item.onPress}
36
- testID={resolvedTestID}
37
- >
38
- {(state) => {
39
- const presentation = resolveNavigationItemPresentation(theme, {
40
- active,
41
- disabled,
42
- state,
43
- });
44
-
45
- return (
46
- <Box
47
- px="m"
48
- py={compact ? 's' : 'm'}
49
- radius="m"
50
- style={{
51
- backgroundColor: presentation.backgroundColor,
52
- flexDirection: 'row',
53
- alignItems: 'center',
54
- opacity: presentation.opacity,
55
- }}
56
- >
57
- {item.icon ? (
58
- <View style={{ marginRight: theme.spacing.s }}>
59
- <Icon {...item.icon} color={presentation.contentColor} size={compact ? 's' : 'm'} />
60
- </View>
61
- ) : null}
62
- <Box flex={1}>
63
- <Text
64
- color={active && !disabled ? 'primary' : undefined}
65
- emphasis={disabled ? 'muted' : 'default'}
66
- numberOfLines={1}
67
- variant={compact ? 'bodySmall' : 'body'}
68
- weight="medium"
69
- >
70
- {item.label}
71
- </Text>
72
- </Box>
73
- {item.badge ? <View style={{ marginLeft: theme.spacing.s }}>{item.badge}</View> : null}
74
- </Box>
75
- );
76
- }}
77
- </ButtonBase>
78
- );
79
- }