@ankhorage/surface 4.2.1 → 4.4.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 (185) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +4 -4
  3. package/dist/components/tabs/Tabs.js +2 -2
  4. package/dist/components/tabs/Tabs.js.map +1 -1
  5. package/dist/components/tabs/context.js +1 -1
  6. package/dist/components/tabs/context.js.map +1 -1
  7. package/dist/context/FontContext.d.ts.map +1 -1
  8. package/dist/context/FontContext.js +3 -3
  9. package/dist/context/FontContext.js.map +1 -1
  10. package/dist/context/TranslationContext.d.ts.map +1 -1
  11. package/dist/context/TranslationContext.js +3 -4
  12. package/dist/context/TranslationContext.js.map +1 -1
  13. package/dist/core/responsive/ResponsiveProvider.d.ts.map +1 -1
  14. package/dist/core/responsive/ResponsiveProvider.js +3 -3
  15. package/dist/core/responsive/ResponsiveProvider.js.map +1 -1
  16. package/dist/examples/DocsExamples.js +1 -1
  17. package/dist/examples/DocsExamples.js.map +1 -1
  18. package/dist/features/accordion/adapters/inbound/Accordion.d.ts +5 -0
  19. package/dist/features/accordion/adapters/inbound/Accordion.d.ts.map +1 -0
  20. package/dist/features/accordion/adapters/inbound/Accordion.js +46 -0
  21. package/dist/features/accordion/adapters/inbound/Accordion.js.map +1 -0
  22. package/dist/features/accordion/adapters/inbound/AccordionContent.d.ts +5 -0
  23. package/dist/features/accordion/adapters/inbound/AccordionContent.d.ts.map +1 -0
  24. package/dist/features/accordion/adapters/inbound/AccordionContent.js +16 -0
  25. package/dist/features/accordion/adapters/inbound/AccordionContent.js.map +1 -0
  26. package/dist/features/accordion/adapters/inbound/AccordionContext.d.ts +4 -0
  27. package/dist/features/accordion/adapters/inbound/AccordionContext.d.ts.map +1 -0
  28. package/dist/features/accordion/adapters/inbound/AccordionContext.js +3 -0
  29. package/dist/features/accordion/adapters/inbound/AccordionContext.js.map +1 -0
  30. package/dist/features/accordion/adapters/inbound/AccordionItem.d.ts +5 -0
  31. package/dist/features/accordion/adapters/inbound/AccordionItem.d.ts.map +1 -0
  32. package/dist/features/accordion/adapters/inbound/AccordionItem.js +28 -0
  33. package/dist/features/accordion/adapters/inbound/AccordionItem.js.map +1 -0
  34. package/dist/features/accordion/adapters/inbound/AccordionItemContext.d.ts +4 -0
  35. package/dist/features/accordion/adapters/inbound/AccordionItemContext.d.ts.map +1 -0
  36. package/dist/features/accordion/adapters/inbound/AccordionItemContext.js +3 -0
  37. package/dist/features/accordion/adapters/inbound/AccordionItemContext.js.map +1 -0
  38. package/dist/features/accordion/adapters/inbound/AccordionTrigger.d.ts +5 -0
  39. package/dist/features/accordion/adapters/inbound/AccordionTrigger.d.ts.map +1 -0
  40. package/dist/features/accordion/adapters/inbound/AccordionTrigger.js +17 -0
  41. package/dist/features/accordion/adapters/inbound/AccordionTrigger.js.map +1 -0
  42. package/dist/features/accordion/public.d.ts +6 -0
  43. package/dist/features/accordion/public.d.ts.map +1 -0
  44. package/dist/features/accordion/public.js +5 -0
  45. package/dist/features/accordion/public.js.map +1 -0
  46. package/dist/features/accordion/utils/resolveAccordionToggle.d.ts +11 -0
  47. package/dist/features/accordion/utils/resolveAccordionToggle.d.ts.map +1 -0
  48. package/dist/features/accordion/utils/resolveAccordionToggle.js +13 -0
  49. package/dist/features/accordion/utils/resolveAccordionToggle.js.map +1 -0
  50. package/dist/features/bottom-sheet/BottomSheetProvider.js +2 -2
  51. package/dist/features/bottom-sheet/BottomSheetProvider.js.map +1 -1
  52. package/dist/features/bottom-sheet/useBottomSheet.js +1 -1
  53. package/dist/features/bottom-sheet/useBottomSheet.js.map +1 -1
  54. package/dist/features/popover/adapters/inbound/Popover.d.ts +5 -0
  55. package/dist/features/popover/adapters/inbound/Popover.d.ts.map +1 -0
  56. package/dist/features/popover/adapters/inbound/Popover.js +31 -0
  57. package/dist/features/popover/adapters/inbound/Popover.js.map +1 -0
  58. package/dist/features/popover/adapters/inbound/PopoverOverlay.d.ts +17 -0
  59. package/dist/features/popover/adapters/inbound/PopoverOverlay.d.ts.map +1 -0
  60. package/dist/features/popover/adapters/inbound/PopoverOverlay.js +34 -0
  61. package/dist/features/popover/adapters/inbound/PopoverOverlay.js.map +1 -0
  62. package/dist/features/popover/adapters/inbound/usePopoverLayout.d.ts +21 -0
  63. package/dist/features/popover/adapters/inbound/usePopoverLayout.d.ts.map +1 -0
  64. package/dist/features/popover/adapters/inbound/usePopoverLayout.js +33 -0
  65. package/dist/features/popover/adapters/inbound/usePopoverLayout.js.map +1 -0
  66. package/dist/features/popover/public.d.ts +3 -0
  67. package/dist/features/popover/public.d.ts.map +1 -0
  68. package/dist/features/popover/public.js +2 -0
  69. package/dist/features/popover/public.js.map +1 -0
  70. package/dist/features/popover/utils/resolvePopoverPosition.d.ts +25 -0
  71. package/dist/features/popover/utils/resolvePopoverPosition.d.ts.map +1 -0
  72. package/dist/features/popover/utils/resolvePopoverPosition.js +23 -0
  73. package/dist/features/popover/utils/resolvePopoverPosition.js.map +1 -0
  74. package/dist/{components/toast → features/toast/adapters/inbound}/Toast.d.ts +2 -1
  75. package/dist/features/toast/adapters/inbound/Toast.d.ts.map +1 -0
  76. package/dist/{components/toast → features/toast/adapters/inbound}/Toast.js +37 -32
  77. package/dist/features/toast/adapters/inbound/Toast.js.map +1 -0
  78. package/dist/features/toast/adapters/inbound/ToastProvider.d.ts +5 -0
  79. package/dist/features/toast/adapters/inbound/ToastProvider.d.ts.map +1 -0
  80. package/dist/features/toast/adapters/inbound/ToastProvider.js +29 -0
  81. package/dist/features/toast/adapters/inbound/ToastProvider.js.map +1 -0
  82. package/dist/features/toast/adapters/inbound/useToast.d.ts +4 -0
  83. package/dist/features/toast/adapters/inbound/useToast.d.ts.map +1 -0
  84. package/dist/features/toast/adapters/inbound/useToast.js +11 -0
  85. package/dist/features/toast/adapters/inbound/useToast.js.map +1 -0
  86. package/dist/features/toast/composition/ToastContext.d.ts +4 -0
  87. package/dist/features/toast/composition/ToastContext.d.ts.map +1 -0
  88. package/dist/features/toast/composition/ToastContext.js +4 -0
  89. package/dist/features/toast/composition/ToastContext.js.map +1 -0
  90. package/dist/features/toast/composition/useToastRuntime.d.ts +11 -0
  91. package/dist/features/toast/composition/useToastRuntime.d.ts.map +1 -0
  92. package/dist/features/toast/composition/useToastRuntime.js +50 -0
  93. package/dist/features/toast/composition/useToastRuntime.js.map +1 -0
  94. package/dist/features/toast/public.d.ts +5 -0
  95. package/dist/features/toast/public.d.ts.map +1 -0
  96. package/dist/features/toast/public.js +4 -0
  97. package/dist/features/toast/public.js.map +1 -0
  98. package/dist/index.d.ts +6 -2
  99. package/dist/index.d.ts.map +1 -1
  100. package/dist/index.js +3 -1
  101. package/dist/index.js.map +1 -1
  102. package/dist/internal/overlay/OverlayProvider.d.ts +1 -0
  103. package/dist/internal/overlay/OverlayProvider.d.ts.map +1 -1
  104. package/dist/internal/overlay/OverlayProvider.js +9 -7
  105. package/dist/internal/overlay/OverlayProvider.js.map +1 -1
  106. package/dist/internal/overlay/useOverlayStack.js +1 -1
  107. package/dist/internal/overlay/useOverlayStack.js.map +1 -1
  108. package/dist/internal/resolvers/resolveOverlayZIndex.d.ts +1 -1
  109. package/dist/internal/resolvers/resolveOverlayZIndex.d.ts.map +1 -1
  110. package/dist/internal/resolvers/resolveOverlayZIndex.js +1 -0
  111. package/dist/internal/resolvers/resolveOverlayZIndex.js.map +1 -1
  112. package/dist/layout/AppBar.js +1 -1
  113. package/dist/layout/AppBar.js.map +1 -1
  114. package/dist/theme/ThemeContext.d.ts.map +1 -1
  115. package/dist/theme/ThemeContext.js +4 -5
  116. package/dist/theme/ThemeContext.js.map +1 -1
  117. package/dist/types/accordion.d.ts +54 -0
  118. package/dist/types/accordion.d.ts.map +1 -0
  119. package/dist/types/accordion.js +2 -0
  120. package/dist/types/accordion.js.map +1 -0
  121. package/dist/types/popover.d.ts +21 -0
  122. package/dist/types/popover.d.ts.map +1 -0
  123. package/dist/types/popover.js +2 -0
  124. package/dist/types/popover.js.map +1 -0
  125. package/dist/{components/toast/types.d.ts → types/toast.d.ts} +11 -3
  126. package/dist/types/toast.d.ts.map +1 -0
  127. package/dist/types/toast.js +2 -0
  128. package/dist/types/toast.js.map +1 -0
  129. package/package.json +1 -1
  130. package/src/components/tabs/Tabs.tsx +2 -2
  131. package/src/components/tabs/context.tsx +1 -1
  132. package/src/context/FontContext.tsx +3 -3
  133. package/src/context/TranslationContext.tsx +3 -4
  134. package/src/core/responsive/ResponsiveProvider.tsx +3 -3
  135. package/src/examples/DocsExamples.tsx +1 -1
  136. package/src/features/accordion/adapters/inbound/Accordion.tsx +83 -0
  137. package/src/features/accordion/adapters/inbound/AccordionContent.tsx +30 -0
  138. package/src/features/accordion/adapters/inbound/AccordionContext.ts +5 -0
  139. package/src/features/accordion/adapters/inbound/AccordionItem.tsx +42 -0
  140. package/src/features/accordion/adapters/inbound/AccordionItemContext.ts +5 -0
  141. package/src/features/accordion/adapters/inbound/AccordionTrigger.tsx +34 -0
  142. package/src/features/accordion/public.ts +13 -0
  143. package/src/features/accordion/utils/resolveAccordionToggle.test.ts +57 -0
  144. package/src/features/accordion/utils/resolveAccordionToggle.ts +28 -0
  145. package/src/features/bottom-sheet/BottomSheetProvider.tsx +2 -2
  146. package/src/features/bottom-sheet/useBottomSheet.ts +1 -1
  147. package/src/features/popover/adapters/inbound/Popover.tsx +49 -0
  148. package/src/features/popover/adapters/inbound/PopoverOverlay.tsx +72 -0
  149. package/src/features/popover/adapters/inbound/usePopoverLayout.ts +51 -0
  150. package/src/features/popover/public.ts +2 -0
  151. package/src/features/popover/utils/resolvePopoverPosition.test.ts +31 -0
  152. package/src/features/popover/utils/resolvePopoverPosition.ts +40 -0
  153. package/src/{components/toast → features/toast/adapters/inbound}/Toast.tsx +58 -54
  154. package/src/features/toast/adapters/inbound/ToastProvider.tsx +47 -0
  155. package/src/features/toast/adapters/inbound/useToast.test.tsx +18 -0
  156. package/src/features/toast/adapters/inbound/useToast.ts +15 -0
  157. package/src/features/toast/composition/ToastContext.ts +6 -0
  158. package/src/features/toast/composition/useToastRuntime.ts +76 -0
  159. package/src/features/toast/public.ts +10 -0
  160. package/src/index.test.ts +3 -1
  161. package/src/index.ts +29 -2
  162. package/src/internal/overlay/OverlayProvider.tsx +10 -8
  163. package/src/internal/overlay/useOverlayStack.ts +1 -1
  164. package/src/internal/resolvers/resolveOverlayZIndex.test.ts +2 -1
  165. package/src/internal/resolvers/resolveOverlayZIndex.ts +2 -1
  166. package/src/layout/AppBar.tsx +1 -1
  167. package/src/theme/ThemeContext.tsx +4 -5
  168. package/src/types/accordion.ts +69 -0
  169. package/src/types/popover.ts +25 -0
  170. package/src/{components/toast/types.ts → types/toast.ts} +12 -2
  171. package/dist/components/toast/Toast.d.ts.map +0 -1
  172. package/dist/components/toast/Toast.js.map +0 -1
  173. package/dist/components/toast/ToastProvider.d.ts +0 -13
  174. package/dist/components/toast/ToastProvider.d.ts.map +0 -1
  175. package/dist/components/toast/ToastProvider.js +0 -70
  176. package/dist/components/toast/ToastProvider.js.map +0 -1
  177. package/dist/components/toast/index.d.ts +0 -4
  178. package/dist/components/toast/index.d.ts.map +0 -1
  179. package/dist/components/toast/index.js +0 -3
  180. package/dist/components/toast/index.js.map +0 -1
  181. package/dist/components/toast/types.d.ts.map +0 -1
  182. package/dist/components/toast/types.js +0 -2
  183. package/dist/components/toast/types.js.map +0 -1
  184. package/src/components/toast/ToastProvider.tsx +0 -115
  185. package/src/components/toast/index.ts +0 -3
@@ -0,0 +1,13 @@
1
+ /*** Resolves the next immutable set of open accordion item values. */
2
+ export function resolveAccordionToggle({ collapsible, mode, openValues, value, }) {
3
+ if (mode === 'multiple') {
4
+ return openValues.includes(value)
5
+ ? openValues.filter((openValue) => openValue !== value)
6
+ : [...openValues, value];
7
+ }
8
+ if (openValues.includes(value)) {
9
+ return collapsible ? [] : openValues;
10
+ }
11
+ return [value];
12
+ }
13
+ //# sourceMappingURL=resolveAccordionToggle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveAccordionToggle.js","sourceRoot":"","sources":["../../../../src/features/accordion/utils/resolveAccordionToggle.ts"],"names":[],"mappings":"AAEA,sEAAsE;AACtE,MAAM,UAAU,sBAAsB,CAAC,EACrC,WAAW,EACX,IAAI,EACJ,UAAU,EACV,KAAK,GACuB;IAC5B,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;QACxB,OAAO,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC;YAC/B,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,KAAK,CAAC;YACvD,CAAC,CAAC,CAAC,GAAG,UAAU,EAAE,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;IACvC,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,CAAC;AACjB,CAAC","sourcesContent":["import type { AccordionMode } from '../../../types/accordion';\n\n/*** Resolves the next immutable set of open accordion item values. */\nexport function resolveAccordionToggle({\n collapsible,\n mode,\n openValues,\n value,\n}: ResolveAccordionToggleInput): readonly string[] {\n if (mode === 'multiple') {\n return openValues.includes(value)\n ? openValues.filter((openValue) => openValue !== value)\n : [...openValues, value];\n }\n\n if (openValues.includes(value)) {\n return collapsible ? [] : openValues;\n }\n\n return [value];\n}\n\ninterface ResolveAccordionToggleInput {\n collapsible: boolean;\n mode: AccordionMode;\n openValues: readonly string[];\n value: string;\n}\n"]}
@@ -29,12 +29,12 @@ export function BottomSheetProvider({ children }) {
29
29
  request?.onDismiss?.();
30
30
  }, []);
31
31
  const controller = React.useMemo(() => ({ dismiss, present }), [dismiss, present]);
32
- return (<BottomSheetContext.Provider value={controller}>
32
+ return (<BottomSheetContext value={controller}>
33
33
  <BottomSheetModalProvider>
34
34
  {children}
35
35
  <BottomSheetHost activeRequest={activeRequest} handleDismiss={handleDismiss} modalRef={modalRef} presentedRef={presentedRef}/>
36
36
  </BottomSheetModalProvider>
37
- </BottomSheetContext.Provider>);
37
+ </BottomSheetContext>);
38
38
  }
39
39
  /*** Renders and presents the single Gorhom modal owned by the provider. */
40
40
  function BottomSheetHost({ activeRequest, handleDismiss, modalRef, presentedRef, }) {
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetProvider.js","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAEnB,gBAAgB,EAChB,wBAAwB,EACxB,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,4FAA4F;AAC5F,MAAM,UAAU,mBAAmB,CAAC,EAAE,QAAQ,EAAiC;IAC7E,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAmB,IAAI,CAAC,CAAC;IACtD,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAmC,IAAI,CAAC,CAAC;IAC9E,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACzC,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAmC,IAAI,CAAC,CAAC;IAEjG,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,OAAkC,EAAE,EAAE;QACvE,gBAAgB,CAAC,OAAO,GAAG,OAAO,CAAC;QACnC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACrC,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;YACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;YAC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AAC,EAAE,eAAe,CAC3D;IAAA,EAAE,gBAAgB,CAAC,CACpB,CAAC;AACJ,CAAC;AAED,0EAA0E;AAC1E,SAAS,sBAAsB,CAAC,sBAA2C;IACzE,OAAO,KAAK,CAAC,WAAW,CACtB,CAAC,KAA+B,EAAE,EAAE,CAAC,CACnC,CAAC,mBAAmB,CAClB,IAAI,KAAK,CAAC,CACV,cAAc,CAAC,CAAC,CAAC,CAAC,CAClB,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CACtB,aAAa,CAAC,CAAC,sBAAsB,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,EACnE,CACH,EACD,CAAC,sBAAsB,CAAC,CACzB,CAAC;AACJ,CAAC","sourcesContent":["import {\n BottomSheetBackdrop,\n type BottomSheetBackdropProps,\n BottomSheetModal,\n BottomSheetModalProvider,\n BottomSheetView,\n} from '@gorhom/bottom-sheet';\nimport React from 'react';\n\nimport type { BottomSheetController, BottomSheetPresentOptions } from '../../types/bottomSheet';\nimport { BottomSheetContext } from './BottomSheetContext';\n\n/*** Installs the shared bottom-sheet modal host and controller for descendant consumers. */\nexport function BottomSheetProvider({ children }: { children: React.ReactNode }) {\n const modalRef = React.useRef<BottomSheetModal>(null);\n const activeRequestRef = React.useRef<BottomSheetPresentOptions | null>(null);\n const presentedRef = React.useRef(false);\n const [activeRequest, setActiveRequest] = React.useState<BottomSheetPresentOptions | null>(null);\n\n const present = React.useCallback((options: BottomSheetPresentOptions) => {\n activeRequestRef.current = options;\n setActiveRequest(options);\n }, []);\n\n const dismiss = React.useCallback(() => {\n if (presentedRef.current) {\n modalRef.current?.dismiss();\n return;\n }\n\n const request = activeRequestRef.current;\n activeRequestRef.current = null;\n setActiveRequest(null);\n request?.onDismiss?.();\n }, []);\n\n const handleDismiss = React.useCallback(() => {\n const request = activeRequestRef.current;\n presentedRef.current = false;\n activeRequestRef.current = null;\n setActiveRequest(null);\n request?.onDismiss?.();\n }, []);\n\n const controller = React.useMemo<BottomSheetController>(\n () => ({ dismiss, present }),\n [dismiss, present],\n );\n\n return (\n <BottomSheetContext.Provider value={controller}>\n <BottomSheetModalProvider>\n {children}\n <BottomSheetHost\n activeRequest={activeRequest}\n handleDismiss={handleDismiss}\n modalRef={modalRef}\n presentedRef={presentedRef}\n />\n </BottomSheetModalProvider>\n </BottomSheetContext.Provider>\n );\n}\n\ninterface BottomSheetHostProps {\n readonly activeRequest: BottomSheetPresentOptions | null;\n readonly handleDismiss: () => void;\n readonly modalRef: React.RefObject<BottomSheetModal | null>;\n readonly presentedRef: React.RefObject<boolean>;\n}\n\n/*** Renders and presents the single Gorhom modal owned by the provider. */\nfunction BottomSheetHost({\n activeRequest,\n handleDismiss,\n modalRef,\n presentedRef,\n}: BottomSheetHostProps) {\n React.useEffect(() => {\n if (!activeRequest || presentedRef.current) {\n return;\n }\n\n presentedRef.current = true;\n modalRef.current?.present();\n }, [activeRequest, modalRef, presentedRef]);\n\n const renderBackdrop = useBottomSheetBackdrop(activeRequest?.dismissOnBackdropPress);\n const snapPoints = React.useMemo(\n () => (activeRequest?.snapPoints ? [...activeRequest.snapPoints] : undefined),\n [activeRequest?.snapPoints],\n );\n\n if (!activeRequest) {\n return null;\n }\n\n return (\n <BottomSheetModal\n ref={modalRef}\n backdropComponent={renderBackdrop}\n enableDynamicSizing={activeRequest.enableDynamicSizing ?? true}\n enablePanDownToClose={activeRequest.enablePanDownToClose ?? true}\n index={activeRequest.initialIndex ?? 0}\n keyboardBehavior={activeRequest.keyboardBehavior ?? 'interactive'}\n keyboardBlurBehavior={activeRequest.keyboardBlurBehavior ?? 'restore'}\n onChange={activeRequest.onIndexChange}\n onDismiss={handleDismiss}\n snapPoints={snapPoints}\n >\n <BottomSheetView>{activeRequest.content}</BottomSheetView>\n </BottomSheetModal>\n );\n}\n\n/*** Creates the backdrop renderer for the active bottom-sheet request. */\nfunction useBottomSheetBackdrop(dismissOnBackdropPress: boolean | undefined) {\n return React.useCallback(\n (props: BottomSheetBackdropProps) => (\n <BottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n pressBehavior={dismissOnBackdropPress === false ? 'none' : 'close'}\n />\n ),\n [dismissOnBackdropPress],\n );\n}\n"]}
1
+ {"version":3,"file":"BottomSheetProvider.js","sourceRoot":"","sources":["../../../src/features/bottom-sheet/BottomSheetProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAEnB,gBAAgB,EAChB,wBAAwB,EACxB,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,4FAA4F;AAC5F,MAAM,UAAU,mBAAmB,CAAC,EAAE,QAAQ,EAAiC;IAC7E,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAmB,IAAI,CAAC,CAAC;IACtD,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAmC,IAAI,CAAC,CAAC;IAC9E,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACzC,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAmC,IAAI,CAAC,CAAC;IAEjG,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,OAAkC,EAAE,EAAE;QACvE,gBAAgB,CAAC,OAAO,GAAG,OAAO,CAAC;QACnC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACrC,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;YACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;YAC5B,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAG,gBAAgB,CAAC,OAAO,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E,SAAS,sBAAsB,CAAC,sBAA2C;IACzE,OAAO,KAAK,CAAC,WAAW,CACtB,CAAC,KAA+B,EAAE,EAAE,CAAC,CACnC,CAAC,mBAAmB,CAClB,IAAI,KAAK,CAAC,CACV,cAAc,CAAC,CAAC,CAAC,CAAC,CAClB,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CACtB,aAAa,CAAC,CAAC,sBAAsB,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,EACnE,CACH,EACD,CAAC,sBAAsB,CAAC,CACzB,CAAC;AACJ,CAAC","sourcesContent":["import {\n BottomSheetBackdrop,\n type BottomSheetBackdropProps,\n BottomSheetModal,\n BottomSheetModalProvider,\n BottomSheetView,\n} from '@gorhom/bottom-sheet';\nimport React from 'react';\n\nimport type { BottomSheetController, BottomSheetPresentOptions } from '../../types/bottomSheet';\nimport { BottomSheetContext } from './BottomSheetContext';\n\n/*** Installs the shared bottom-sheet modal host and controller for descendant consumers. */\nexport function BottomSheetProvider({ children }: { children: React.ReactNode }) {\n const modalRef = React.useRef<BottomSheetModal>(null);\n const activeRequestRef = React.useRef<BottomSheetPresentOptions | null>(null);\n const presentedRef = React.useRef(false);\n const [activeRequest, setActiveRequest] = React.useState<BottomSheetPresentOptions | null>(null);\n\n const present = React.useCallback((options: BottomSheetPresentOptions) => {\n activeRequestRef.current = options;\n setActiveRequest(options);\n }, []);\n\n const dismiss = React.useCallback(() => {\n if (presentedRef.current) {\n modalRef.current?.dismiss();\n return;\n }\n\n const request = activeRequestRef.current;\n activeRequestRef.current = null;\n setActiveRequest(null);\n request?.onDismiss?.();\n }, []);\n\n const handleDismiss = React.useCallback(() => {\n const request = activeRequestRef.current;\n presentedRef.current = false;\n activeRequestRef.current = null;\n setActiveRequest(null);\n request?.onDismiss?.();\n }, []);\n\n const controller = React.useMemo<BottomSheetController>(\n () => ({ dismiss, present }),\n [dismiss, present],\n );\n\n return (\n <BottomSheetContext value={controller}>\n <BottomSheetModalProvider>\n {children}\n <BottomSheetHost\n activeRequest={activeRequest}\n handleDismiss={handleDismiss}\n modalRef={modalRef}\n presentedRef={presentedRef}\n />\n </BottomSheetModalProvider>\n </BottomSheetContext>\n );\n}\n\ninterface BottomSheetHostProps {\n readonly activeRequest: BottomSheetPresentOptions | null;\n readonly handleDismiss: () => void;\n readonly modalRef: React.RefObject<BottomSheetModal | null>;\n readonly presentedRef: React.RefObject<boolean>;\n}\n\n/*** Renders and presents the single Gorhom modal owned by the provider. */\nfunction BottomSheetHost({\n activeRequest,\n handleDismiss,\n modalRef,\n presentedRef,\n}: BottomSheetHostProps) {\n React.useEffect(() => {\n if (!activeRequest || presentedRef.current) {\n return;\n }\n\n presentedRef.current = true;\n modalRef.current?.present();\n }, [activeRequest, modalRef, presentedRef]);\n\n const renderBackdrop = useBottomSheetBackdrop(activeRequest?.dismissOnBackdropPress);\n const snapPoints = React.useMemo(\n () => (activeRequest?.snapPoints ? [...activeRequest.snapPoints] : undefined),\n [activeRequest?.snapPoints],\n );\n\n if (!activeRequest) {\n return null;\n }\n\n return (\n <BottomSheetModal\n ref={modalRef}\n backdropComponent={renderBackdrop}\n enableDynamicSizing={activeRequest.enableDynamicSizing ?? true}\n enablePanDownToClose={activeRequest.enablePanDownToClose ?? true}\n index={activeRequest.initialIndex ?? 0}\n keyboardBehavior={activeRequest.keyboardBehavior ?? 'interactive'}\n keyboardBlurBehavior={activeRequest.keyboardBlurBehavior ?? 'restore'}\n onChange={activeRequest.onIndexChange}\n onDismiss={handleDismiss}\n snapPoints={snapPoints}\n >\n <BottomSheetView>{activeRequest.content}</BottomSheetView>\n </BottomSheetModal>\n );\n}\n\n/*** Creates the backdrop renderer for the active bottom-sheet request. */\nfunction useBottomSheetBackdrop(dismissOnBackdropPress: boolean | undefined) {\n return React.useCallback(\n (props: BottomSheetBackdropProps) => (\n <BottomSheetBackdrop\n {...props}\n appearsOnIndex={0}\n disappearsOnIndex={-1}\n pressBehavior={dismissOnBackdropPress === false ? 'none' : 'close'}\n />\n ),\n [dismissOnBackdropPress],\n );\n}\n"]}
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { BottomSheetContext } from './BottomSheetContext';
3
3
  /*** Returns the shared bottom-sheet controller installed by BottomSheetProvider. */
4
4
  export function useBottomSheet() {
5
- const controller = React.useContext(BottomSheetContext);
5
+ const controller = React.use(BottomSheetContext);
6
6
  if (!controller) {
7
7
  throw new Error('useBottomSheet must be used within BottomSheetProvider.');
8
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useBottomSheet.js","sourceRoot":"","sources":["../../../src/features/bottom-sheet/useBottomSheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,oFAAoF;AACpF,MAAM,UAAU,cAAc;IAC5B,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAExD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import React from 'react';\n\nimport type { BottomSheetController } from '../../types/bottomSheet';\nimport { BottomSheetContext } from './BottomSheetContext';\n\n/*** Returns the shared bottom-sheet controller installed by BottomSheetProvider. */\nexport function useBottomSheet(): BottomSheetController {\n const controller = React.useContext(BottomSheetContext);\n\n if (!controller) {\n throw new Error('useBottomSheet must be used within BottomSheetProvider.');\n }\n\n return controller;\n}\n"]}
1
+ {"version":3,"file":"useBottomSheet.js","sourceRoot":"","sources":["../../../src/features/bottom-sheet/useBottomSheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,oFAAoF;AACpF,MAAM,UAAU,cAAc;IAC5B,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAEjD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import React from 'react';\n\nimport type { BottomSheetController } from '../../types/bottomSheet';\nimport { BottomSheetContext } from './BottomSheetContext';\n\n/*** Returns the shared bottom-sheet controller installed by BottomSheetProvider. */\nexport function useBottomSheet(): BottomSheetController {\n const controller = React.use(BottomSheetContext);\n\n if (!controller) {\n throw new Error('useBottomSheet must be used within BottomSheetProvider.');\n }\n\n return controller;\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { PopoverProps } from '../../../../types/popover';
3
+ /*** Renders anchored overlay content through the shared Surface overlay stack. */
4
+ export declare function Popover(props: PopoverProps): React.JSX.Element;
5
+ //# sourceMappingURL=Popover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../../../src/features/popover/adapters/inbound/Popover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG9D,kFAAkF;AAClF,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,qBAwC1C"}
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { View } from 'react-native';
3
+ import { useControllableState } from '../../../../internal/useControllableState';
4
+ import { PopoverOverlay } from './PopoverOverlay';
5
+ /*** Renders anchored overlay content through the shared Surface overlay stack. */
6
+ export function Popover(props) {
7
+ const anchorRef = React.useRef(null);
8
+ const [resolvedOpen, setResolvedOpen] = useControllableState({
9
+ defaultValue: props.defaultOpen ?? false,
10
+ onChange: props.onOpenChange,
11
+ value: props.open,
12
+ });
13
+ const passive = props.interactionPolicy === 'passive';
14
+ const close = React.useCallback(() => {
15
+ if (!passive)
16
+ setResolvedOpen(false);
17
+ }, [passive, setResolvedOpen]);
18
+ const toggle = React.useCallback(() => {
19
+ if (!passive)
20
+ setResolvedOpen(!resolvedOpen);
21
+ }, [passive, resolvedOpen, setResolvedOpen]);
22
+ return (<>
23
+ <View collapsable={false} ref={anchorRef} testID={props.testID ? `${props.testID}-anchor` : undefined}>
24
+ {props.anchor({ close, open: resolvedOpen, toggle })}
25
+ </View>
26
+ {resolvedOpen ? (<PopoverOverlay anchorRef={anchorRef} closeOnOutsidePress={props.closeOnOutsidePress ?? true} offset={props.offset ?? 8} onClose={close} passive={passive} placement={props.placement ?? 'bottom-start'} testID={props.testID}>
27
+ {props.children}
28
+ </PopoverOverlay>) : null}
29
+ </>);
30
+ }
31
+ //# sourceMappingURL=Popover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Popover.js","sourceRoot":"","sources":["../../../../../src/features/popover/adapters/inbound/Popover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,kFAAkF;AAClF,MAAM,UAAU,OAAO,CAAC,KAAmB;IACzC,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAc,IAAI,CAAC,CAAC;IAClD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,oBAAoB,CAAU;QACpE,YAAY,EAAE,KAAK,CAAC,WAAW,IAAI,KAAK;QACxC,QAAQ,EAAE,KAAK,CAAC,YAAY;QAC5B,KAAK,EAAE,KAAK,CAAC,IAAI;KAClB,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,KAAK,CAAC,iBAAiB,KAAK,SAAS,CAAC;IAEtD,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,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AC","sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\n\nimport { useControllableState } from '../../../../internal/useControllableState';\nimport type { PopoverProps } from '../../../../types/popover';\nimport { PopoverOverlay } from './PopoverOverlay';\n\n/*** Renders anchored overlay content through the shared Surface overlay stack. */\nexport function Popover(props: PopoverProps) {\n const anchorRef = React.useRef<View | null>(null);\n const [resolvedOpen, setResolvedOpen] = useControllableState<boolean>({\n defaultValue: props.defaultOpen ?? false,\n onChange: props.onOpenChange,\n value: props.open,\n });\n const passive = props.interactionPolicy === 'passive';\n\n const close = React.useCallback(() => {\n if (!passive) setResolvedOpen(false);\n }, [passive, setResolvedOpen]);\n const toggle = React.useCallback(() => {\n if (!passive) setResolvedOpen(!resolvedOpen);\n }, [passive, resolvedOpen, setResolvedOpen]);\n\n return (\n <>\n <View\n collapsable={false}\n ref={anchorRef}\n testID={props.testID ? `${props.testID}-anchor` : undefined}\n >\n {props.anchor({ close, open: resolvedOpen, toggle })}\n </View>\n {resolvedOpen ? (\n <PopoverOverlay\n anchorRef={anchorRef}\n closeOnOutsidePress={props.closeOnOutsidePress ?? true}\n offset={props.offset ?? 8}\n onClose={close}\n passive={passive}\n placement={props.placement ?? 'bottom-start'}\n testID={props.testID}\n >\n {props.children}\n </PopoverOverlay>\n ) : null}\n </>\n );\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { View } from 'react-native';
3
+ import type { PopoverPlacement } from '../../../../types/popover';
4
+ /*** Renders and positions one mounted popover overlay for an open anchor. */
5
+ export declare function PopoverOverlay({ anchorRef, children, closeOnOutsidePress, offset, onClose, passive, placement, testID, }: PopoverOverlayProps): React.JSX.Element;
6
+ interface PopoverOverlayProps {
7
+ anchorRef: React.RefObject<View | null>;
8
+ children?: React.ReactNode;
9
+ closeOnOutsidePress: boolean;
10
+ offset: number;
11
+ onClose: () => void;
12
+ passive: boolean;
13
+ placement: PopoverPlacement;
14
+ testID?: string;
15
+ }
16
+ export {};
17
+ //# sourceMappingURL=PopoverOverlay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PopoverOverlay.d.ts","sourceRoot":"","sources":["../../../../../src/features/popover/adapters/inbound/PopoverOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAyB,IAAI,EAAkB,MAAM,cAAc,CAAC;AAG3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAGlE,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,QAAQ,EACR,mBAAmB,EACnB,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,EACT,MAAM,GACP,EAAE,mBAAmB,qBA6BrB;AAED,UAAU,mBAAmB;IAC3B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,gBAAgB,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { Pressable, StyleSheet, View } from 'react-native';
3
+ import { Portal } from '../../../../internal/overlay/Portal';
4
+ import { usePopoverLayout } from './usePopoverLayout';
5
+ /*** Renders and positions one mounted popover overlay for an open anchor. */
6
+ export function PopoverOverlay({ anchorRef, children, closeOnOutsidePress, offset, onClose, passive, placement, testID, }) {
7
+ const { onContentLayout, position, ready } = usePopoverLayout({
8
+ anchorRef,
9
+ offset,
10
+ open: true,
11
+ placement,
12
+ });
13
+ return (<Portal layer="popover" visible={ready}>
14
+ <View pointerEvents="box-none" style={styles.overlay}>
15
+ {closeOnOutsidePress ? (<Pressable accessibilityLabel="Close popover" onPress={passive ? undefined : onClose} style={styles.backdrop} testID={testID ? `${testID}-backdrop` : undefined}/>) : null}
16
+ <View onLayout={onContentLayout} style={[styles.content, position]} testID={testID ? `${testID}-content` : undefined}>
17
+ {children}
18
+ </View>
19
+ </View>
20
+ </Portal>);
21
+ }
22
+ const absoluteFill = {
23
+ bottom: 0,
24
+ left: 0,
25
+ position: 'absolute',
26
+ right: 0,
27
+ top: 0,
28
+ };
29
+ const styles = StyleSheet.create({
30
+ backdrop: absoluteFill,
31
+ content: { position: 'absolute' },
32
+ overlay: absoluteFill,
33
+ });
34
+ //# sourceMappingURL=PopoverOverlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PopoverOverlay.js","sourceRoot":"","sources":["../../../../../src/features/popover/adapters/inbound/PopoverOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAC;AAE3E,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,6EAA6E;AAC7E,MAAM,UAAU,cAAc,CAAC,EAC7B,SAAS,EACT,QAAQ,EACR,mBAAmB,EACnB,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,EACT,MAAM,GACc;IACpB,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,gBAAgB,CAAC;QAC5D,SAAS;QACT,MAAM;QACN,IAAI,EAAE,IAAI;QACV,SAAS;KACV,CAAC,CAAC;IAEH,OAAO,CACL,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CACrC;MAAA,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CACnD;QAAA,CAAC,mBAAmB,CAAC,CAAC,CAAC,CACrB,CAAC,SAAS,CACR,kBAAkB,CAAC,eAAe,CAClC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CACvC,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CACvB,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,EAClD,CACH,CAAC,CAAC,CAAC,IAAI,CACR;QAAA,CAAC,IAAI,CACH,QAAQ,CAAC,CAAC,eAAe,CAAC,CAC1B,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAClC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAEjD;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,MAAM,CAAC,CACV,CAAC;AACJ,CAAC;AAaD,MAAM,YAAY,GAAc;IAC9B,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;IACP,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,CAAC;IACR,GAAG,EAAE,CAAC;CACP,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,QAAQ,EAAE,YAAY;IACtB,OAAO,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE;IACjC,OAAO,EAAE,YAAY;CACtB,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { Pressable, StyleSheet, View, type ViewStyle } from 'react-native';\n\nimport { Portal } from '../../../../internal/overlay/Portal';\nimport type { PopoverPlacement } from '../../../../types/popover';\nimport { usePopoverLayout } from './usePopoverLayout';\n\n/*** Renders and positions one mounted popover overlay for an open anchor. */\nexport function PopoverOverlay({\n anchorRef,\n children,\n closeOnOutsidePress,\n offset,\n onClose,\n passive,\n placement,\n testID,\n}: PopoverOverlayProps) {\n const { onContentLayout, position, ready } = usePopoverLayout({\n anchorRef,\n offset,\n open: true,\n placement,\n });\n\n return (\n <Portal layer=\"popover\" visible={ready}>\n <View pointerEvents=\"box-none\" style={styles.overlay}>\n {closeOnOutsidePress ? (\n <Pressable\n accessibilityLabel=\"Close popover\"\n onPress={passive ? undefined : onClose}\n style={styles.backdrop}\n testID={testID ? `${testID}-backdrop` : undefined}\n />\n ) : null}\n <View\n onLayout={onContentLayout}\n style={[styles.content, position]}\n testID={testID ? `${testID}-content` : undefined}\n >\n {children}\n </View>\n </View>\n </Portal>\n );\n}\n\ninterface PopoverOverlayProps {\n anchorRef: React.RefObject<View | null>;\n children?: React.ReactNode;\n closeOnOutsidePress: boolean;\n offset: number;\n onClose: () => void;\n passive: boolean;\n placement: PopoverPlacement;\n testID?: string;\n}\n\nconst absoluteFill: ViewStyle = {\n bottom: 0,\n left: 0,\n position: 'absolute',\n right: 0,\n top: 0,\n};\n\nconst styles = StyleSheet.create({\n backdrop: absoluteFill,\n content: { position: 'absolute' },\n overlay: absoluteFill,\n});\n"]}
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { type LayoutChangeEvent, type View } from 'react-native';
3
+ import type { PopoverPlacement } from '../../../../types/popover';
4
+ /*** Measures the anchor and resolves the current viewport-safe popover position. */
5
+ export declare function usePopoverLayout({ anchorRef, offset, open, placement }: UsePopoverLayoutInput): {
6
+ measureAnchor: () => void;
7
+ onContentLayout: (event: LayoutChangeEvent) => void;
8
+ position: {
9
+ left: number;
10
+ top: number;
11
+ } | undefined;
12
+ ready: boolean;
13
+ };
14
+ interface UsePopoverLayoutInput {
15
+ anchorRef: React.RefObject<View | null>;
16
+ offset: number;
17
+ open: boolean;
18
+ placement: PopoverPlacement;
19
+ }
20
+ export {};
21
+ //# sourceMappingURL=usePopoverLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePopoverLayout.d.ts","sourceRoot":"","sources":["../../../../../src/features/popover/adapters/inbound/usePopoverLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,KAAK,iBAAiB,EAGtB,KAAK,IAAI,EACV,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAGlE,oFAAoF;AACpF,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,qBAAqB;;6BAe1C,iBAAiB;;;;;;EAgBpE;AAED,UAAU,qBAAqB;IAC7B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,gBAAgB,CAAC;CAC7B"}
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { useWindowDimensions, } from 'react-native';
3
+ import { resolvePopoverPosition } from '../../utils/resolvePopoverPosition';
4
+ /*** Measures the anchor and resolves the current viewport-safe popover position. */
5
+ export function usePopoverLayout({ anchorRef, offset, open, placement }) {
6
+ const [anchorLayout, setAnchorLayout] = React.useState(null);
7
+ const [contentSize, setContentSize] = React.useState({ height: 0, width: 0 });
8
+ const { height: viewportHeight, width: viewportWidth } = useWindowDimensions();
9
+ const measureAnchor = React.useCallback(() => {
10
+ anchorRef.current?.measureInWindow((x, y, width, height) => {
11
+ setAnchorLayout({ height, width, x, y });
12
+ });
13
+ }, [anchorRef]);
14
+ React.useEffect(() => {
15
+ if (open)
16
+ measureAnchor();
17
+ }, [measureAnchor, open]);
18
+ const onContentLayout = React.useCallback((event) => {
19
+ setContentSize(event.nativeEvent.layout);
20
+ }, []);
21
+ const position = anchorLayout
22
+ ? resolvePopoverPosition({
23
+ anchor: anchorLayout,
24
+ contentSize,
25
+ offset,
26
+ placement,
27
+ viewport: { height: viewportHeight, width: viewportWidth },
28
+ viewportPadding: 8,
29
+ })
30
+ : undefined;
31
+ return { measureAnchor, onContentLayout, position, ready: Boolean(anchorLayout) };
32
+ }
33
+ //# sourceMappingURL=usePopoverLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePopoverLayout.js","sourceRoot":"","sources":["../../../../../src/features/popover/adapters/inbound/usePopoverLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAGL,mBAAmB,GAEpB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAE5E,oFAAoF;AACpF,MAAM,UAAU,gBAAgB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAyB;IAC5F,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAyB,IAAI,CAAC,CAAC;IACrF,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAC9E,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,mBAAmB,EAAE,CAAC;IAE/E,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAC3C,SAAS,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YACzD,eAAe,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,IAAI;YAAE,aAAa,EAAE,CAAC;IAC5B,CAAC,EAAE,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC;IAE1B,MAAM,eAAe,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,KAAwB,EAAE,EAAE;QACrE,cAAc,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,QAAQ,GAAG,YAAY;QAC3B,CAAC,CAAC,sBAAsB,CAAC;YACrB,MAAM,EAAE,YAAY;YACpB,WAAW;YACX,MAAM;YACN,SAAS;YACT,QAAQ,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,aAAa,EAAE;YAC1D,eAAe,EAAE,CAAC;SACnB,CAAC;QACJ,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;AACpF,CAAC","sourcesContent":["import React from 'react';\nimport {\n type LayoutChangeEvent,\n type LayoutRectangle,\n useWindowDimensions,\n type View,\n} from 'react-native';\n\nimport type { PopoverPlacement } from '../../../../types/popover';\nimport { resolvePopoverPosition } from '../../utils/resolvePopoverPosition';\n\n/*** Measures the anchor and resolves the current viewport-safe popover position. */\nexport function usePopoverLayout({ anchorRef, offset, open, placement }: UsePopoverLayoutInput) {\n const [anchorLayout, setAnchorLayout] = React.useState<LayoutRectangle | null>(null);\n const [contentSize, setContentSize] = React.useState({ height: 0, width: 0 });\n const { height: viewportHeight, width: viewportWidth } = useWindowDimensions();\n\n const measureAnchor = React.useCallback(() => {\n anchorRef.current?.measureInWindow((x, y, width, height) => {\n setAnchorLayout({ height, width, x, y });\n });\n }, [anchorRef]);\n\n React.useEffect(() => {\n if (open) measureAnchor();\n }, [measureAnchor, open]);\n\n const onContentLayout = React.useCallback((event: LayoutChangeEvent) => {\n setContentSize(event.nativeEvent.layout);\n }, []);\n\n const position = anchorLayout\n ? resolvePopoverPosition({\n anchor: anchorLayout,\n contentSize,\n offset,\n placement,\n viewport: { height: viewportHeight, width: viewportWidth },\n viewportPadding: 8,\n })\n : undefined;\n\n return { measureAnchor, onContentLayout, position, ready: Boolean(anchorLayout) };\n}\n\ninterface UsePopoverLayoutInput {\n anchorRef: React.RefObject<View | null>;\n offset: number;\n open: boolean;\n placement: PopoverPlacement;\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export type { PopoverAnchorRenderProps, PopoverPlacement, PopoverProps } from '../../types/popover';
2
+ export { Popover } from './adapters/inbound/Popover';
3
+ //# sourceMappingURL=public.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/popover/public.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACpG,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Popover } from './adapters/inbound/Popover';
2
+ //# sourceMappingURL=public.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/features/popover/public.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["export type { PopoverAnchorRenderProps, PopoverPlacement, PopoverProps } from '../../types/popover';\nexport { Popover } from './adapters/inbound/Popover';\n"]}
@@ -0,0 +1,25 @@
1
+ import type { PopoverPlacement } from '../../../types/popover';
2
+ /*** Resolves a viewport-clamped anchored position for popover content. */
3
+ export declare function resolvePopoverPosition({ anchor, contentSize, offset, placement, viewport, viewportPadding, }: {
4
+ anchor: {
5
+ height: number;
6
+ width: number;
7
+ x: number;
8
+ y: number;
9
+ };
10
+ contentSize: {
11
+ height: number;
12
+ width: number;
13
+ };
14
+ offset: number;
15
+ placement: PopoverPlacement;
16
+ viewport: {
17
+ height: number;
18
+ width: number;
19
+ };
20
+ viewportPadding: number;
21
+ }): {
22
+ left: number;
23
+ top: number;
24
+ };
25
+ //# sourceMappingURL=resolvePopoverPosition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolvePopoverPosition.d.ts","sourceRoot":"","sources":["../../../../src/features/popover/utils/resolvePopoverPosition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,0EAA0E;AAC1E,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,WAAW,EACX,MAAM,EACN,SAAS,EACT,QAAQ,EACR,eAAe,GAChB,EAAE;IACD,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChE,WAAW,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,gBAAgB,CAAC;IAC5B,QAAQ,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,eAAe,EAAE,MAAM,CAAC;CACzB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAiBhC"}
@@ -0,0 +1,23 @@
1
+ /*** Resolves a viewport-clamped anchored position for popover content. */
2
+ export function resolvePopoverPosition({ anchor, contentSize, offset, placement, viewport, viewportPadding, }) {
3
+ const anchorCenterX = anchor.x + anchor.width / 2;
4
+ const rawLeft = placement.endsWith('-start')
5
+ ? anchor.x
6
+ : placement.endsWith('-end')
7
+ ? anchor.x + anchor.width - contentSize.width
8
+ : anchorCenterX - contentSize.width / 2;
9
+ const rawTop = placement.startsWith('top')
10
+ ? anchor.y - contentSize.height - offset
11
+ : anchor.y + anchor.height + offset;
12
+ const maxLeft = Math.max(viewportPadding, viewport.width - contentSize.width - viewportPadding);
13
+ const maxTop = Math.max(viewportPadding, viewport.height - contentSize.height - viewportPadding);
14
+ return {
15
+ left: clamp(rawLeft, viewportPadding, maxLeft),
16
+ top: clamp(rawTop, viewportPadding, maxTop),
17
+ };
18
+ }
19
+ /*** Clamps one numeric position into the available viewport range. */
20
+ function clamp(value, minimum, maximum) {
21
+ return Math.min(Math.max(value, minimum), maximum);
22
+ }
23
+ //# sourceMappingURL=resolvePopoverPosition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolvePopoverPosition.js","sourceRoot":"","sources":["../../../../src/features/popover/utils/resolvePopoverPosition.ts"],"names":[],"mappings":"AAEA,0EAA0E;AAC1E,MAAM,UAAU,sBAAsB,CAAC,EACrC,MAAM,EACN,WAAW,EACX,MAAM,EACN,SAAS,EACT,QAAQ,EACR,eAAe,GAQhB;IACC,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC1C,CAAC,CAAC,MAAM,CAAC,CAAC;QACV,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC1B,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,WAAW,CAAC,KAAK;YAC7C,CAAC,CAAC,aAAa,GAAG,WAAW,CAAC,KAAK,GAAG,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC;QACxC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,WAAW,CAAC,MAAM,GAAG,MAAM;QACxC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IACtC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,QAAQ,CAAC,KAAK,GAAG,WAAW,CAAC,KAAK,GAAG,eAAe,CAAC,CAAC;IAChG,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,QAAQ,CAAC,MAAM,GAAG,WAAW,CAAC,MAAM,GAAG,eAAe,CAAC,CAAC;IAEjG,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,CAAC;QAC9C,GAAG,EAAE,KAAK,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,CAAC;KAC5C,CAAC;AACJ,CAAC;AAED,sEAAsE;AACtE,SAAS,KAAK,CAAC,KAAa,EAAE,OAAe,EAAE,OAAe;IAC5D,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import type { PopoverPlacement } from '../../../types/popover';\n\n/*** Resolves a viewport-clamped anchored position for popover content. */\nexport function resolvePopoverPosition({\n anchor,\n contentSize,\n offset,\n placement,\n viewport,\n viewportPadding,\n}: {\n anchor: { height: number; width: number; x: number; y: number };\n contentSize: { height: number; width: number };\n offset: number;\n placement: PopoverPlacement;\n viewport: { height: number; width: number };\n viewportPadding: number;\n}): { left: number; top: number } {\n const anchorCenterX = anchor.x + anchor.width / 2;\n const rawLeft = placement.endsWith('-start')\n ? anchor.x\n : placement.endsWith('-end')\n ? anchor.x + anchor.width - contentSize.width\n : anchorCenterX - contentSize.width / 2;\n const rawTop = placement.startsWith('top')\n ? anchor.y - contentSize.height - offset\n : anchor.y + anchor.height + offset;\n const maxLeft = Math.max(viewportPadding, viewport.width - contentSize.width - viewportPadding);\n const maxTop = Math.max(viewportPadding, viewport.height - contentSize.height - viewportPadding);\n\n return {\n left: clamp(rawLeft, viewportPadding, maxLeft),\n top: clamp(rawTop, viewportPadding, maxTop),\n };\n}\n\n/*** Clamps one numeric position into the available viewport range. */\nfunction clamp(value: number, minimum: number, maximum: number): number {\n return Math.min(Math.max(value, minimum), maximum);\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
- import type { ToastProps } from './types';
2
+ import type { ToastProps } from '../../../../types/toast';
3
+ /*** Renders one transient toast notification. */
3
4
  export declare function Toast({ title, description, status, onDismiss, interactionPolicy, testID, }: ToastProps): React.JSX.Element;
4
5
  //# sourceMappingURL=Toast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../../../src/features/toast/adapters/inbound/Toast.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAK1D,iDAAiD;AACjD,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,WAAW,EACX,MAAkB,EAClB,SAAS,EACT,iBAA6B,EAC7B,MAAM,GACP,EAAE,UAAU,qBAkCZ"}
@@ -1,10 +1,31 @@
1
1
  import React from 'react';
2
- import { Pressable } from 'react-native';
3
- import { Box } from '../../features/layout/public';
4
- import { Surface } from '../../features/surface/public';
5
- import { Text } from '../../features/typography/public';
6
- import { Inline } from '../../layout';
7
- import { useTheme } from '../../theme/ThemeContext';
2
+ import { Pressable, StyleSheet } from 'react-native';
3
+ import { useTheme } from '../../../../theme/ThemeContext';
4
+ import { Box, Stack } from '../../../layout/public';
5
+ import { Surface } from '../../../surface/public';
6
+ import { Text } from '../../../typography/public';
7
+ /*** Renders one transient toast notification. */
8
+ export function Toast({ title, description, status = 'default', onDismiss, interactionPolicy = 'enabled', testID, }) {
9
+ const { theme } = useTheme();
10
+ const statusColor = resolveToastStatusColor(theme, status);
11
+ const statusTextColor = resolveToastStatusTextColor(status);
12
+ const passive = interactionPolicy === 'passive';
13
+ const statusStyle = React.useMemo(() => ({ borderLeftColor: statusColor }), [statusColor]);
14
+ return (<Surface p="m" style={[styles.root, statusStyle]} testID={testID} variant="raised">
15
+ <Stack align="center" direction="row" justify="space-between">
16
+ <Box flex={1}>
17
+ {title ? (<Text variant="label" weight="medium">
18
+ {title}
19
+ </Text>) : null}
20
+ {description ? <Text emphasis="muted">{description}</Text> : null}
21
+ </Box>
22
+ {onDismiss ? (<Pressable accessibilityLabel="Dismiss notification" accessibilityRole="button" onPress={passive ? undefined : onDismiss} testID={testID ? `${testID}-dismiss` : undefined}>
23
+ <Text color={statusTextColor}>×</Text>
24
+ </Pressable>) : null}
25
+ </Stack>
26
+ </Surface>);
27
+ }
28
+ /*** Resolves the border color representing a toast status. */
8
29
  function resolveToastStatusColor(theme, status) {
9
30
  switch (status) {
10
31
  case 'success':
@@ -19,6 +40,7 @@ function resolveToastStatusColor(theme, status) {
19
40
  return theme.semantics.action.primary.base;
20
41
  }
21
42
  }
43
+ /*** Resolves the semantic text color representing a toast status. */
22
44
  function resolveToastStatusTextColor(status) {
23
45
  switch (status) {
24
46
  case 'success':
@@ -33,30 +55,13 @@ function resolveToastStatusTextColor(status) {
33
55
  return 'primary';
34
56
  }
35
57
  }
36
- export function Toast({ title, description, status = 'default', onDismiss, interactionPolicy = 'enabled', testID, }) {
37
- const { theme } = useTheme();
38
- const statusColor = resolveToastStatusColor(theme, status);
39
- const statusTextColor = resolveToastStatusTextColor(status);
40
- const passive = interactionPolicy === 'passive';
41
- return (<Surface p="m" style={{
42
- borderLeftColor: statusColor,
43
- borderLeftWidth: 3,
44
- minWidth: 280,
45
- shadowOpacity: 0.14,
46
- shadowRadius: 12,
47
- shadowOffset: { width: 0, height: 6 },
48
- }} testID={testID} variant="raised">
49
- <Inline align="center" justify="space-between">
50
- <Box flex={1}>
51
- {title ? (<Text variant="label" weight="medium">
52
- {title}
53
- </Text>) : null}
54
- {description ? <Text emphasis="muted">{description}</Text> : null}
55
- </Box>
56
- {onDismiss ? (<Pressable accessibilityLabel="Dismiss notification" accessibilityRole="button" onPress={passive ? undefined : onDismiss} testID={testID ? `${testID}-dismiss` : undefined}>
57
- <Text color={statusTextColor}>×</Text>
58
- </Pressable>) : null}
59
- </Inline>
60
- </Surface>);
61
- }
58
+ const styles = StyleSheet.create({
59
+ root: {
60
+ borderLeftWidth: 3,
61
+ minWidth: 280,
62
+ shadowOffset: { height: 6, width: 0 },
63
+ shadowOpacity: 0.14,
64
+ shadowRadius: 12,
65
+ },
66
+ });
62
67
  //# sourceMappingURL=Toast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toast.js","sourceRoot":"","sources":["../../../../../src/features/toast/adapters/inbound/Toast.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAC;AAGrE,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAG1D,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,iDAAiD;AACjD,MAAM,UAAU,KAAK,CAAC,EACpB,KAAK,EACL,WAAW,EACX,MAAM,GAAG,SAAS,EAClB,SAAS,EACT,iBAAiB,GAAG,SAAS,EAC7B,MAAM,GACK;IACX,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,WAAW,GAAG,uBAAuB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC3D,MAAM,eAAe,GAAG,2BAA2B,CAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,iBAAiB,KAAK,SAAS,CAAC;IAChD,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAC/B,GAAG,EAAE,CAAC,CAAC,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC,EACxC,CAAC,WAAW,CAAC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,8DAA8D;AAC9D,SAAS,uBAAuB,CAAC,KAAmB,EAAE,MAA4B;IAChF,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC;QACtC,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC;QACtC,KAAK,OAAO;YACV,OAAO,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC;QACpC,KAAK,MAAM;YACT,OAAO,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;QACnC;YACE,OAAO,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;IAC/C,CAAC;AACH,CAAC;AAED,qEAAqE;AACrE,SAAS,2BAA2B,CAAC,MAA4B;IAC/D,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,OAAO;YACV,OAAO,OAAO,CAAC;QACjB,KAAK,MAAM;YACT,OAAO,MAAM,CAAC;QAChB;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,eAAe,EAAE,CAAC;QAClB,QAAQ,EAAE,GAAG;QACb,YAAY,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE;QACrC,aAAa,EAAE,IAAI;QACnB,YAAY,EAAE,EAAE;KACjB;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { Pressable, StyleSheet, type ViewStyle } from 'react-native';\n\nimport type { SurfaceColor } from '../../../../surfaceColor';\nimport { useTheme } from '../../../../theme/ThemeContext';\nimport type { SurfaceTheme } from '../../../../theme/types';\nimport type { ToastProps } from '../../../../types/toast';\nimport { Box, Stack } from '../../../layout/public';\nimport { Surface } from '../../../surface/public';\nimport { Text } from '../../../typography/public';\n\n/*** Renders one transient toast notification. */\nexport function Toast({\n title,\n description,\n status = 'default',\n onDismiss,\n interactionPolicy = 'enabled',\n testID,\n}: ToastProps) {\n const { theme } = useTheme();\n const statusColor = resolveToastStatusColor(theme, status);\n const statusTextColor = resolveToastStatusTextColor(status);\n const passive = interactionPolicy === 'passive';\n const statusStyle = React.useMemo<ViewStyle>(\n () => ({ borderLeftColor: statusColor }),\n [statusColor],\n );\n\n return (\n <Surface p=\"m\" style={[styles.root, statusStyle]} testID={testID} variant=\"raised\">\n <Stack align=\"center\" direction=\"row\" justify=\"space-between\">\n <Box flex={1}>\n {title ? (\n <Text variant=\"label\" weight=\"medium\">\n {title}\n </Text>\n ) : null}\n {description ? <Text emphasis=\"muted\">{description}</Text> : null}\n </Box>\n {onDismiss ? (\n <Pressable\n accessibilityLabel=\"Dismiss notification\"\n accessibilityRole=\"button\"\n onPress={passive ? undefined : onDismiss}\n testID={testID ? `${testID}-dismiss` : undefined}\n >\n <Text color={statusTextColor}>×</Text>\n </Pressable>\n ) : null}\n </Stack>\n </Surface>\n );\n}\n\n/*** Resolves the border color representing a toast status. */\nfunction resolveToastStatusColor(theme: SurfaceTheme, status: ToastProps['status']) {\n switch (status) {\n case 'success':\n return theme.semantics.success.base;\n case 'warning':\n return theme.semantics.warning.base;\n case 'error':\n return theme.semantics.error.base;\n case 'info':\n return theme.semantics.info.base;\n default:\n return theme.semantics.action.primary.base;\n }\n}\n\n/*** Resolves the semantic text color representing a toast status. */\nfunction resolveToastStatusTextColor(status: ToastProps['status']): SurfaceColor {\n switch (status) {\n case 'success':\n return 'success';\n case 'warning':\n return 'warning';\n case 'error':\n return 'error';\n case 'info':\n return 'info';\n default:\n return 'primary';\n }\n}\n\nconst styles = StyleSheet.create({\n root: {\n borderLeftWidth: 3,\n minWidth: 280,\n shadowOffset: { height: 6, width: 0 },\n shadowOpacity: 0.14,\n shadowRadius: 12,\n },\n});\n"]}
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { ToastProviderProps } from '../../../../types/toast';
3
+ /*** Provides the toast runtime context and renders its shared portal host. */
4
+ export declare function ToastProvider({ children, defaultDuration }: ToastProviderProps): React.JSX.Element;
5
+ //# sourceMappingURL=ToastProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../../../../src/features/toast/adapters/inbound/ToastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAMlE,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,eAAsB,EAAE,EAAE,kBAAkB,qBA2BrF"}
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+ import { Portal } from '../../../../internal/overlay/Portal';
4
+ import { resolveOverlayAnimation } from '../../../../internal/resolvers';
5
+ import { Stack } from '../../../layout/public';
6
+ import { ToastContext } from '../../composition/ToastContext';
7
+ import { useToastRuntime } from '../../composition/useToastRuntime';
8
+ import { Toast } from './Toast';
9
+ /*** Provides the toast runtime context and renders its shared portal host. */
10
+ export function ToastProvider({ children, defaultDuration = 4000 }) {
11
+ const animation = resolveOverlayAnimation('toast');
12
+ const { controller, toasts } = useToastRuntime(defaultDuration);
13
+ const animationStyle = React.useMemo(() => ({ paddingTop: 16 + animation.offset }), [animation.offset]);
14
+ return (<ToastContext value={controller}>
15
+ {children}
16
+ <Portal layer="toast" visible={toasts.length > 0}>
17
+ <Stack gap="s" pointerEvents="box-none" style={[styles.container, animationStyle]}>
18
+ {toasts.map((toast) => (<Toast description={toast.description} key={toast.id} onDismiss={() => controller.dismissToast(toast.id)} status={toast.status} testID={toast.testID} title={toast.title}/>))}
19
+ </Stack>
20
+ </Portal>
21
+ </ToastContext>);
22
+ }
23
+ const styles = StyleSheet.create({
24
+ container: {
25
+ alignItems: 'flex-end',
26
+ padding: 16,
27
+ },
28
+ });
29
+ //# sourceMappingURL=ToastProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToastProvider.js","sourceRoot":"","sources":["../../../../../src/features/toast/adapters/inbound/ToastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,8EAA8E;AAC9E,MAAM,UAAU,aAAa,CAAC,EAAE,QAAQ,EAAE,eAAe,GAAG,IAAI,EAAsB;IACpF,MAAM,SAAS,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;IACnD,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,eAAe,CAAC,eAAe,CAAC,CAAC;IAChE,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAClC,GAAG,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAC7C,CAAC,SAAS,CAAC,MAAM,CAAC,CACnB,CAAC;IAEF,OAAO,CACL,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CAC9B;MAAA,CAAC,QAAQ,CACT;MAAA,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAC/C;QAAA,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,CAChF;UAAA,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACrB,CAAC,KAAK,CACJ,WAAW,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAC/B,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CACd,SAAS,CAAC,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CACnD,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CACrB,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CACrB,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EACnB,CACH,CAAC,CACJ;QAAA,EAAE,KAAK,CACT;MAAA,EAAE,MAAM,CACV;IAAA,EAAE,YAAY,CAAC,CAChB,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,UAAU,EAAE,UAAU;QACtB,OAAO,EAAE,EAAE;KACZ;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { StyleSheet, type ViewStyle } from 'react-native';\n\nimport { Portal } from '../../../../internal/overlay/Portal';\nimport { resolveOverlayAnimation } from '../../../../internal/resolvers';\nimport type { ToastProviderProps } from '../../../../types/toast';\nimport { Stack } from '../../../layout/public';\nimport { ToastContext } from '../../composition/ToastContext';\nimport { useToastRuntime } from '../../composition/useToastRuntime';\nimport { Toast } from './Toast';\n\n/*** Provides the toast runtime context and renders its shared portal host. */\nexport function ToastProvider({ children, defaultDuration = 4000 }: ToastProviderProps) {\n const animation = resolveOverlayAnimation('toast');\n const { controller, toasts } = useToastRuntime(defaultDuration);\n const animationStyle = React.useMemo<ViewStyle>(\n () => ({ paddingTop: 16 + animation.offset }),\n [animation.offset],\n );\n\n return (\n <ToastContext value={controller}>\n {children}\n <Portal layer=\"toast\" visible={toasts.length > 0}>\n <Stack gap=\"s\" pointerEvents=\"box-none\" style={[styles.container, animationStyle]}>\n {toasts.map((toast) => (\n <Toast\n description={toast.description}\n key={toast.id}\n onDismiss={() => controller.dismissToast(toast.id)}\n status={toast.status}\n testID={toast.testID}\n title={toast.title}\n />\n ))}\n </Stack>\n </Portal>\n </ToastContext>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n alignItems: 'flex-end',\n padding: 16,\n },\n});\n"]}
@@ -0,0 +1,4 @@
1
+ import type { ToastController } from '../../../../types/toast';
2
+ /*** Returns the toast controller installed by ToastProvider. */
3
+ export declare function useToast(): ToastController;
4
+ //# sourceMappingURL=useToast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToast.d.ts","sourceRoot":"","sources":["../../../../../src/features/toast/adapters/inbound/useToast.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,gEAAgE;AAChE,wBAAgB,QAAQ,IAAI,eAAe,CAQ1C"}
@@ -0,0 +1,11 @@
1
+ import { use } from 'react';
2
+ import { ToastContext } from '../../composition/ToastContext';
3
+ /*** Returns the toast controller installed by ToastProvider. */
4
+ export function useToast() {
5
+ const controller = use(ToastContext);
6
+ if (!controller) {
7
+ throw new Error('useToast must be used within <ToastProvider>.');
8
+ }
9
+ return controller;
10
+ }
11
+ //# sourceMappingURL=useToast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToast.js","sourceRoot":"","sources":["../../../../../src/features/toast/adapters/inbound/useToast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5B,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,gEAAgE;AAChE,MAAM,UAAU,QAAQ;IACtB,MAAM,UAAU,GAAG,GAAG,CAAC,YAAY,CAAC,CAAC;IAErC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import { use } from 'react';\n\nimport type { ToastController } from '../../../../types/toast';\nimport { ToastContext } from '../../composition/ToastContext';\n\n/*** Returns the toast controller installed by ToastProvider. */\nexport function useToast(): ToastController {\n const controller = use(ToastContext);\n\n if (!controller) {\n throw new Error('useToast must be used within <ToastProvider>.');\n }\n\n return controller;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { ToastController } from '../../../types/toast';
2
+ /*** Stores the toast controller shared by ToastProvider and useToast. */
3
+ export declare const ToastContext: import("react").Context<ToastController | null>;
4
+ //# sourceMappingURL=ToastContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToastContext.d.ts","sourceRoot":"","sources":["../../../../src/features/toast/composition/ToastContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,yEAAyE;AACzE,eAAO,MAAM,YAAY,iDAA8C,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { createContext } from 'react';
2
+ /*** Stores the toast controller shared by ToastProvider and useToast. */
3
+ export const ToastContext = createContext(null);
4
+ //# sourceMappingURL=ToastContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToastContext.js","sourceRoot":"","sources":["../../../../src/features/toast/composition/ToastContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItC,yEAAyE;AACzE,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAyB,IAAI,CAAC,CAAC","sourcesContent":["import { createContext } from 'react';\n\nimport type { ToastController } from '../../../types/toast';\n\n/*** Stores the toast controller shared by ToastProvider and useToast. */\nexport const ToastContext = createContext<ToastController | null>(null);\n"]}
@@ -0,0 +1,11 @@
1
+ import type { ToastController, ToastOptions } from '../../../types/toast';
2
+ /*** Owns the toast queue, dismissal timers, and imperative controller state. */
3
+ export declare function useToastRuntime(defaultDuration: number): {
4
+ controller: ToastController;
5
+ toasts: ToastEntry[];
6
+ };
7
+ interface ToastEntry extends ToastOptions {
8
+ id: string;
9
+ }
10
+ export {};
11
+ //# sourceMappingURL=useToastRuntime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToastRuntime.d.ts","sourceRoot":"","sources":["../../../../src/features/toast/composition/useToastRuntime.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE1E,gFAAgF;AAChF,wBAAgB,eAAe,CAAC,eAAe,EAAE,MAAM;;;EA4BtD;AAED,UAAU,UAAW,SAAQ,YAAY;IACvC,EAAE,EAAE,MAAM,CAAC;CACZ"}