@oxyhq/bloom 0.4.0 → 0.5.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.
- package/README.md +105 -90
- package/lib/commonjs/bottom-sheet/index.js +2 -2
- package/lib/commonjs/context-menu/index.js +18 -19
- package/lib/commonjs/context-menu/index.js.map +1 -1
- package/lib/commonjs/dialog/BloomDialogProvider.js +61 -0
- package/lib/commonjs/dialog/BloomDialogProvider.js.map +1 -0
- package/lib/commonjs/dialog/BloomDialogProvider.web.js +45 -0
- package/lib/commonjs/dialog/BloomDialogProvider.web.js.map +1 -0
- package/lib/commonjs/dialog/Dialog.js +197 -100
- package/lib/commonjs/dialog/Dialog.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.web.js +194 -84
- package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
- package/lib/commonjs/dialog/SheetShell.js +149 -0
- package/lib/commonjs/dialog/SheetShell.js.map +1 -0
- package/lib/commonjs/dialog/alert-store.js +116 -0
- package/lib/commonjs/dialog/alert-store.js.map +1 -0
- package/lib/commonjs/dialog/alert.js +38 -0
- package/lib/commonjs/dialog/alert.js.map +1 -0
- package/lib/commonjs/dialog/context.js +10 -2
- package/lib/commonjs/dialog/context.js.map +1 -1
- package/lib/commonjs/dialog/index.js +8 -24
- package/lib/commonjs/dialog/index.js.map +1 -1
- package/lib/commonjs/dialog/index.web.js +10 -20
- package/lib/commonjs/dialog/index.web.js.map +1 -1
- package/lib/commonjs/index.js +101 -66
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +101 -66
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/menu/index.js +21 -23
- package/lib/commonjs/menu/index.js.map +1 -1
- package/lib/commonjs/select/index.js +26 -27
- package/lib/commonjs/select/index.js.map +1 -1
- package/lib/commonjs/toast/index.js +42 -13
- package/lib/commonjs/toast/index.js.map +1 -1
- package/lib/commonjs/toast/index.web.js +19 -15
- package/lib/commonjs/toast/index.web.js.map +1 -1
- package/lib/module/bottom-sheet/index.js +2 -2
- package/lib/module/context-menu/index.js +15 -16
- package/lib/module/context-menu/index.js.map +1 -1
- package/lib/module/dialog/BloomDialogProvider.js +57 -0
- package/lib/module/dialog/BloomDialogProvider.js.map +1 -0
- package/lib/module/dialog/BloomDialogProvider.web.js +41 -0
- package/lib/module/dialog/BloomDialogProvider.web.js.map +1 -0
- package/lib/module/dialog/Dialog.js +199 -87
- package/lib/module/dialog/Dialog.js.map +1 -1
- package/lib/module/dialog/Dialog.web.js +195 -70
- package/lib/module/dialog/Dialog.web.js.map +1 -1
- package/lib/module/dialog/SheetShell.js +143 -0
- package/lib/module/dialog/SheetShell.js.map +1 -0
- package/lib/module/dialog/alert-store.js +107 -0
- package/lib/module/dialog/alert-store.js.map +1 -0
- package/lib/module/dialog/alert.js +35 -0
- package/lib/module/dialog/alert.js.map +1 -0
- package/lib/module/dialog/context.js +10 -2
- package/lib/module/dialog/context.js.map +1 -1
- package/lib/module/dialog/index.js +3 -1
- package/lib/module/dialog/index.js.map +1 -1
- package/lib/module/dialog/index.web.js +9 -7
- package/lib/module/dialog/index.web.js.map +1 -1
- package/lib/module/index.js +2 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +2 -3
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/menu/index.js +11 -13
- package/lib/module/menu/index.js.map +1 -1
- package/lib/module/select/index.js +27 -28
- package/lib/module/select/index.js.map +1 -1
- package/lib/module/toast/index.js +41 -11
- package/lib/module/toast/index.js.map +1 -1
- package/lib/module/toast/index.web.js +18 -13
- package/lib/module/toast/index.web.js.map +1 -1
- package/lib/typescript/commonjs/__tests__/Dialog.test.d.ts +2 -0
- package/lib/typescript/commonjs/__tests__/Dialog.test.d.ts.map +1 -0
- package/lib/typescript/commonjs/bottom-sheet/index.d.ts +1 -1
- package/lib/typescript/commonjs/context-menu/index.d.ts +4 -3
- package/lib/typescript/commonjs/context-menu/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/BloomDialogProvider.d.ts +27 -0
- package/lib/typescript/commonjs/dialog/BloomDialogProvider.d.ts.map +1 -0
- package/lib/typescript/commonjs/dialog/BloomDialogProvider.web.d.ts +15 -0
- package/lib/typescript/commonjs/dialog/BloomDialogProvider.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/dialog/Dialog.d.ts +37 -10
- package/lib/typescript/commonjs/dialog/Dialog.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts +26 -10
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/SheetShell.d.ts +31 -0
- package/lib/typescript/commonjs/dialog/SheetShell.d.ts.map +1 -0
- package/lib/typescript/commonjs/dialog/alert-store.d.ts +70 -0
- package/lib/typescript/commonjs/dialog/alert-store.d.ts.map +1 -0
- package/lib/typescript/commonjs/dialog/alert.d.ts +27 -0
- package/lib/typescript/commonjs/dialog/alert.d.ts.map +1 -0
- package/lib/typescript/commonjs/dialog/context.d.ts +7 -0
- package/lib/typescript/commonjs/dialog/context.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/index.d.ts +5 -2
- package/lib/typescript/commonjs/dialog/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/index.web.d.ts +5 -2
- package/lib/typescript/commonjs/dialog/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/types.d.ts +70 -15
- package/lib/typescript/commonjs/dialog/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +3 -3
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +3 -3
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/menu/index.d.ts +4 -4
- package/lib/typescript/commonjs/menu/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/select/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/toast/index.d.ts +32 -3
- package/lib/typescript/commonjs/toast/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/toast/index.web.d.ts +14 -7
- package/lib/typescript/commonjs/toast/index.web.d.ts.map +1 -1
- package/lib/typescript/module/__tests__/Dialog.test.d.ts +2 -0
- package/lib/typescript/module/__tests__/Dialog.test.d.ts.map +1 -0
- package/lib/typescript/module/bottom-sheet/index.d.ts +1 -1
- package/lib/typescript/module/context-menu/index.d.ts +4 -3
- package/lib/typescript/module/context-menu/index.d.ts.map +1 -1
- package/lib/typescript/module/dialog/BloomDialogProvider.d.ts +27 -0
- package/lib/typescript/module/dialog/BloomDialogProvider.d.ts.map +1 -0
- package/lib/typescript/module/dialog/BloomDialogProvider.web.d.ts +15 -0
- package/lib/typescript/module/dialog/BloomDialogProvider.web.d.ts.map +1 -0
- package/lib/typescript/module/dialog/Dialog.d.ts +37 -10
- package/lib/typescript/module/dialog/Dialog.d.ts.map +1 -1
- package/lib/typescript/module/dialog/Dialog.web.d.ts +26 -10
- package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/module/dialog/SheetShell.d.ts +31 -0
- package/lib/typescript/module/dialog/SheetShell.d.ts.map +1 -0
- package/lib/typescript/module/dialog/alert-store.d.ts +70 -0
- package/lib/typescript/module/dialog/alert-store.d.ts.map +1 -0
- package/lib/typescript/module/dialog/alert.d.ts +27 -0
- package/lib/typescript/module/dialog/alert.d.ts.map +1 -0
- package/lib/typescript/module/dialog/context.d.ts +7 -0
- package/lib/typescript/module/dialog/context.d.ts.map +1 -1
- package/lib/typescript/module/dialog/index.d.ts +5 -2
- package/lib/typescript/module/dialog/index.d.ts.map +1 -1
- package/lib/typescript/module/dialog/index.web.d.ts +5 -2
- package/lib/typescript/module/dialog/index.web.d.ts.map +1 -1
- package/lib/typescript/module/dialog/types.d.ts +70 -15
- package/lib/typescript/module/dialog/types.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +3 -3
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts +3 -3
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/lib/typescript/module/menu/index.d.ts +4 -4
- package/lib/typescript/module/menu/index.d.ts.map +1 -1
- package/lib/typescript/module/select/index.d.ts.map +1 -1
- package/lib/typescript/module/toast/index.d.ts +32 -3
- package/lib/typescript/module/toast/index.d.ts.map +1 -1
- package/lib/typescript/module/toast/index.web.d.ts +14 -7
- package/lib/typescript/module/toast/index.web.d.ts.map +1 -1
- package/package.json +3 -14
- package/src/__tests__/Dialog.test.tsx +177 -0
- package/src/bottom-sheet/index.tsx +3 -3
- package/src/context-menu/index.tsx +12 -12
- package/src/dialog/BloomDialogProvider.tsx +61 -0
- package/src/dialog/BloomDialogProvider.web.tsx +46 -0
- package/src/dialog/Dialog.tsx +217 -64
- package/src/dialog/Dialog.web.tsx +240 -75
- package/src/dialog/SheetShell.tsx +154 -0
- package/src/dialog/alert-store.ts +126 -0
- package/src/dialog/alert.ts +42 -0
- package/src/dialog/context.ts +14 -3
- package/src/dialog/index.ts +14 -2
- package/src/dialog/index.web.ts +20 -8
- package/src/dialog/types.ts +73 -16
- package/src/index.ts +17 -3
- package/src/index.web.ts +17 -3
- package/src/menu/index.tsx +13 -17
- package/src/select/index.tsx +30 -30
- package/src/toast/index.tsx +55 -11
- package/src/toast/index.web.tsx +33 -13
- package/lib/commonjs/prompt/Prompt.js +0 -267
- package/lib/commonjs/prompt/Prompt.js.map +0 -1
- package/lib/commonjs/prompt/index.js +0 -61
- package/lib/commonjs/prompt/index.js.map +0 -1
- package/lib/module/prompt/Prompt.js +0 -250
- package/lib/module/prompt/Prompt.js.map +0 -1
- package/lib/module/prompt/index.js +0 -4
- package/lib/module/prompt/index.js.map +0 -1
- package/lib/typescript/commonjs/prompt/Prompt.d.ts +0 -42
- package/lib/typescript/commonjs/prompt/Prompt.d.ts.map +0 -1
- package/lib/typescript/commonjs/prompt/index.d.ts +0 -3
- package/lib/typescript/commonjs/prompt/index.d.ts.map +0 -1
- package/lib/typescript/module/prompt/Prompt.d.ts +0 -42
- package/lib/typescript/module/prompt/Prompt.d.ts.map +0 -1
- package/lib/typescript/module/prompt/index.d.ts +0 -3
- package/lib/typescript/module/prompt/index.d.ts.map +0 -1
- package/src/prompt/Prompt.tsx +0 -247
- package/src/prompt/index.ts +0 -13
|
@@ -9,8 +9,8 @@ export { useThrottledValue } from './hooks/useThrottledValue';
|
|
|
9
9
|
export * as Icons from './icons';
|
|
10
10
|
export { type Props as IconProps, sizes as iconSizes, useCommonSVGProps } from './icons/common';
|
|
11
11
|
export * from './portal';
|
|
12
|
-
export
|
|
13
|
-
export
|
|
12
|
+
export { Dialog, BloomDialogProvider, alert, useDialogContext, useDialogControl, } from './dialog';
|
|
13
|
+
export type { AlertButton, AlertButtonStyle, DialogAction, DialogActionColor, DialogContextProps, DialogControlProps, DialogProps, } from './dialog';
|
|
14
14
|
export * from './button';
|
|
15
15
|
export * from './grouped-buttons';
|
|
16
16
|
export * from './divider';
|
|
@@ -22,7 +22,7 @@ export * from './avatar';
|
|
|
22
22
|
export * from './loading';
|
|
23
23
|
export * as PromptInput from './prompt-input';
|
|
24
24
|
export * from './switch';
|
|
25
|
-
export
|
|
25
|
+
export { toast, type Toast } from './toast';
|
|
26
26
|
export * as Typography from './typography';
|
|
27
27
|
export * as Skeleton from './skeleton';
|
|
28
28
|
export * as Grid from './grid';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1C,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,mBAAm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AAC;AAC3C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAG/B,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC"}
|
|
@@ -9,8 +9,8 @@ export { useThrottledValue } from './hooks/useThrottledValue';
|
|
|
9
9
|
export * as Icons from './icons';
|
|
10
10
|
export { type Props as IconProps, sizes as iconSizes, useCommonSVGProps } from './icons/common';
|
|
11
11
|
export * from './portal/index.web';
|
|
12
|
-
export
|
|
13
|
-
export
|
|
12
|
+
export { Dialog, BloomDialogProvider, alert, useDialogContext, useDialogControl, } from './dialog/index.web';
|
|
13
|
+
export type { AlertButton, AlertButtonStyle, DialogAction, DialogActionColor, DialogContextProps, DialogControlProps, DialogProps, } from './dialog/index.web';
|
|
14
14
|
export * from './button';
|
|
15
15
|
export * from './grouped-buttons';
|
|
16
16
|
export * from './divider';
|
|
@@ -22,7 +22,7 @@ export * from './avatar';
|
|
|
22
22
|
export * from './loading';
|
|
23
23
|
export * as PromptInput from './prompt-input';
|
|
24
24
|
export * from './switch';
|
|
25
|
-
export
|
|
25
|
+
export { toast, type Toast } from './toast/index.web';
|
|
26
26
|
export * as Typography from './typography';
|
|
27
27
|
export * as Skeleton from './skeleton';
|
|
28
28
|
export * as Grid from './grid';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAMA,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1C,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,KAAK,MAAM,MAAM,iBAAiB,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/B,cAAc,YAAY,CAAC;AAC3B,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAGzC,cAAc,iBAAiB,CAAC;AAGhC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,WAAW,MAAM,0BAA0B,CAAC;AAGxD,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAG/B,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
-
import
|
|
3
|
+
import type { DialogControlProps } from '../dialog/types';
|
|
4
4
|
import { useMenuContext } from './context';
|
|
5
5
|
import type { GroupProps, ItemIconProps, ItemProps, ItemTextProps, TriggerProps } from './types';
|
|
6
|
-
export type { DialogControlProps as MenuControlProps } from '../dialog';
|
|
7
|
-
export { useDialogControl as useMenuControl } from '../dialog';
|
|
6
|
+
export type { DialogControlProps as MenuControlProps } from '../dialog/types';
|
|
7
|
+
export { useDialogControl as useMenuControl } from '../dialog/context';
|
|
8
8
|
export { useMenuContext };
|
|
9
9
|
export declare function Root({ children, control, }: React.PropsWithChildren<{
|
|
10
|
-
control?:
|
|
10
|
+
control?: DialogControlProps;
|
|
11
11
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export declare function Trigger({ children, label, role, hint, }: TriggerProps): React.ReactNode;
|
|
13
13
|
export declare function Outer({ children, showCancel, }: React.PropsWithChildren<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/menu/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiF,MAAM,OAAO,CAAC;AACtG,OAAO,EA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AE,KAAK,EAAE,EAAE,aAAa,2CAiB1D;AAED,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,aAAa,2CAgB3D;AAED,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,UAAU,2CAsCpD;AAED,wBAAgB,OAAO,SAEtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/select/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/select/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAcf,OAAO,EAA0C,cAAc,EAAE,MAAM,UAAU,CAAC;AAClF,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,kBAAkB,EAClB,SAAS,EACT,aAAa,EACb,SAAS,EAET,YAAY,EACZ,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,cAAc,EAAE,CAAC;AA8B1B,wBAAgB,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,SAAS,2CAgB3E;AAMD,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,YAAY,yTAqCxD;AAMD,wBAAgB,SAAS,CAAC,EACxB,WAAW,EACX,QAAQ,EAAE,YAAkC,EAC5C,KAAK,GACN,EAAE,cAAc,2CAkBhB;AAaD,wBAAgB,IAAI,CAAC,MAAM,EAAE,SAAS,2CAGrC;AAMD,wBAAgB,OAAO,CAAC,CAAC,EAAE,EACzB,KAAK,EACL,cAA0C,EAC1C,GAAG,KAAK,EACT,EAAE,YAAY,CAAC,CAAC,CAAC,2CAwBjB;AAkED,wBAAgB,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,SAAS,2CA2ChE;AAMD,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,aAAa,2CAc1D;AAMD,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,kBAAkB,2CAYxE;AAMD,wBAAgB,SAAS,4CAWxB"}
|
|
@@ -9,7 +9,8 @@ export type { ToastType, BaseToastOptions } from './types';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function ToastOutlet(): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Direct access to the Sonner API. Use sparingly — `toast()` covers the
|
|
13
|
+
* common case and keeps the surface tied to bloom's themed look.
|
|
13
14
|
*/
|
|
14
15
|
export declare const api: ((message: string, data?: Omit<import("sonner-native").ToastProps, "title" | "id" | "type" | "variant" | "jsx" | "promise"> & {
|
|
15
16
|
id?: string | number;
|
|
@@ -49,7 +50,35 @@ export declare const api: ((message: string, data?: Omit<import("sonner-native")
|
|
|
49
50
|
/**
|
|
50
51
|
* Show a toast notification.
|
|
51
52
|
*
|
|
52
|
-
* Pass a string for a simple text toast, or a React element for a custom
|
|
53
|
+
* Pass a string for a simple text toast, or a React element for a custom
|
|
54
|
+
* toast. The optional `options` argument accepts the standard Sonner
|
|
55
|
+
* options plus a bloom `type` (defaults to `'default'`).
|
|
56
|
+
*
|
|
57
|
+
* ```ts
|
|
58
|
+
* toast('Saved');
|
|
59
|
+
* toast.success('Profile updated');
|
|
60
|
+
* toast.error('Network error', { duration: 5000 });
|
|
61
|
+
* toast.dismiss(id);
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* Pre-typed variants (`toast.success`, `toast.error`, `toast.warning`,
|
|
65
|
+
* `toast.info`) are aliases for the corresponding `type`.
|
|
66
|
+
*/
|
|
67
|
+
export interface ToastFn {
|
|
68
|
+
(content: React.ReactNode, options?: BaseToastOptions): void;
|
|
69
|
+
success: (content: React.ReactNode, options?: Omit<BaseToastOptions, 'type'>) => void;
|
|
70
|
+
error: (content: React.ReactNode, options?: Omit<BaseToastOptions, 'type'>) => void;
|
|
71
|
+
warning: (content: React.ReactNode, options?: Omit<BaseToastOptions, 'type'>) => void;
|
|
72
|
+
info: (content: React.ReactNode, options?: Omit<BaseToastOptions, 'type'>) => void;
|
|
73
|
+
dismiss: (id?: string | number) => void;
|
|
74
|
+
}
|
|
75
|
+
export declare const toast: ToastFn;
|
|
76
|
+
/**
|
|
77
|
+
* Alias of `toast` kept for compatibility with the original 0.4.x surface
|
|
78
|
+
* where `show()` was the documented entry point. New code should prefer
|
|
79
|
+
* `toast()` directly.
|
|
53
80
|
*/
|
|
54
|
-
export declare
|
|
81
|
+
export declare const show: ToastFn;
|
|
82
|
+
/** Re-export the Toast function type so callers can refer to it. */
|
|
83
|
+
export type Toast = ToastFn;
|
|
55
84
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/toast/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyB,MAAM,OAAO,CAAC;AAY9C,OAAO,KAAK,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/toast/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyB,MAAM,OAAO,CAAC;AAY9C,OAAO,KAAK,EAAE,gBAAgB,EAAa,MAAM,SAAS,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACzE,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3D;;;GAGG;AACH,wBAAgB,WAAW,4CAE1B;AAUD;;;GAGG;AACH,eAAO,MAAM,GAA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function ToastOutlet(): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
/**
|
|
13
|
-
* Access the full Sonner API
|
|
14
|
-
*/
|
|
12
|
+
/** Direct access to the underlying Sonner API. Use sparingly. */
|
|
15
13
|
export declare const api: typeof sonner;
|
|
16
14
|
/**
|
|
17
|
-
* Show a toast notification.
|
|
18
|
-
*
|
|
19
|
-
* Pass a string for a simple text toast, or a React element for a custom toast.
|
|
15
|
+
* Show a toast notification. Identical API to the native variant — see
|
|
16
|
+
* `./index.tsx` for the full usage docs.
|
|
20
17
|
*/
|
|
21
|
-
export
|
|
18
|
+
export interface ToastFn {
|
|
19
|
+
(content: React.ReactNode, options?: BaseToastOptions): void;
|
|
20
|
+
success: (content: React.ReactNode, options?: Omit<BaseToastOptions, 'type'>) => void;
|
|
21
|
+
error: (content: React.ReactNode, options?: Omit<BaseToastOptions, 'type'>) => void;
|
|
22
|
+
warning: (content: React.ReactNode, options?: Omit<BaseToastOptions, 'type'>) => void;
|
|
23
|
+
info: (content: React.ReactNode, options?: Omit<BaseToastOptions, 'type'>) => void;
|
|
24
|
+
dismiss: (id?: string | number) => void;
|
|
25
|
+
}
|
|
26
|
+
export declare const toast: ToastFn;
|
|
27
|
+
export declare const show: ToastFn;
|
|
28
|
+
export type Toast = ToastFn;
|
|
22
29
|
//# sourceMappingURL=index.web.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../src/toast/index.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyB,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,KAAK,IAAI,MAAM,EAAW,MAAM,QAAQ,CAAC;AASlD,OAAO,KAAK,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../../src/toast/index.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyB,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,KAAK,IAAI,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E,OAAmB,CAAC;AACvC,MAAM,MAAM,KAAK,GAAG,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxyhq/bloom",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Bloom UI — Oxy ecosystem component library for React Native + Expo + Web",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -93,17 +93,6 @@
|
|
|
93
93
|
"default": "./lib/commonjs/dialog/index.js"
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
|
-
"./prompt": {
|
|
97
|
-
"react-native": "./src/prompt/index.ts",
|
|
98
|
-
"import": {
|
|
99
|
-
"types": "./lib/typescript/module/prompt/index.d.ts",
|
|
100
|
-
"default": "./lib/module/prompt/index.js"
|
|
101
|
-
},
|
|
102
|
-
"require": {
|
|
103
|
-
"types": "./lib/typescript/commonjs/prompt/index.d.ts",
|
|
104
|
-
"default": "./lib/commonjs/prompt/index.js"
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
96
|
"./button": {
|
|
108
97
|
"react-native": "./src/button/index.ts",
|
|
109
98
|
"import": {
|
|
@@ -553,7 +542,8 @@
|
|
|
553
542
|
"ui",
|
|
554
543
|
"components",
|
|
555
544
|
"dialog",
|
|
556
|
-
"
|
|
545
|
+
"alert",
|
|
546
|
+
"toast",
|
|
557
547
|
"button",
|
|
558
548
|
"theme",
|
|
559
549
|
"avatar",
|
|
@@ -562,7 +552,6 @@
|
|
|
562
552
|
"collapsible",
|
|
563
553
|
"error-boundary",
|
|
564
554
|
"prompt-input",
|
|
565
|
-
"toast",
|
|
566
555
|
"icons",
|
|
567
556
|
"typography",
|
|
568
557
|
"skeleton",
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
|
+
import { act, fireEvent, render } from '@testing-library/react-native';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
alert,
|
|
7
|
+
BloomDialogProvider,
|
|
8
|
+
Dialog,
|
|
9
|
+
useDialogControl,
|
|
10
|
+
} from '../dialog';
|
|
11
|
+
import { dismissAlert, getAlertQueue } from '../dialog/alert-store';
|
|
12
|
+
import { BloomThemeProvider } from '../theme/BloomThemeProvider';
|
|
13
|
+
|
|
14
|
+
function renderWithTheme(ui: React.ReactElement) {
|
|
15
|
+
return render(
|
|
16
|
+
<BloomThemeProvider mode="light" colorPreset="teal">
|
|
17
|
+
{ui}
|
|
18
|
+
</BloomThemeProvider>,
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function Harness({
|
|
23
|
+
children,
|
|
24
|
+
onControl,
|
|
25
|
+
}: {
|
|
26
|
+
children?: (control: ReturnType<typeof useDialogControl>) => React.ReactNode;
|
|
27
|
+
onControl?: (control: ReturnType<typeof useDialogControl>) => void;
|
|
28
|
+
}) {
|
|
29
|
+
const control = useDialogControl();
|
|
30
|
+
React.useEffect(() => {
|
|
31
|
+
onControl?.(control);
|
|
32
|
+
}, [control, onControl]);
|
|
33
|
+
return <>{children?.(control)}</>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
describe('Dialog (unified API)', () => {
|
|
37
|
+
it('does not render content until control.open() is called', () => {
|
|
38
|
+
const { queryByText } = renderWithTheme(
|
|
39
|
+
<Harness>
|
|
40
|
+
{(control) => (
|
|
41
|
+
<Dialog control={control} title="Hidden until opened">
|
|
42
|
+
<Text>Body</Text>
|
|
43
|
+
</Dialog>
|
|
44
|
+
)}
|
|
45
|
+
</Harness>,
|
|
46
|
+
);
|
|
47
|
+
expect(queryByText('Hidden until opened')).toBeNull();
|
|
48
|
+
expect(queryByText('Body')).toBeNull();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('renders declarative title + description + actions when opened', () => {
|
|
52
|
+
let control: ReturnType<typeof useDialogControl> | undefined;
|
|
53
|
+
const onDelete = jest.fn();
|
|
54
|
+
const { getByText } = renderWithTheme(
|
|
55
|
+
<Harness onControl={(c) => { control = c; }}>
|
|
56
|
+
{(c) => (
|
|
57
|
+
<Dialog
|
|
58
|
+
control={c}
|
|
59
|
+
title="Delete item?"
|
|
60
|
+
description="This action cannot be undone."
|
|
61
|
+
actions={[
|
|
62
|
+
{ label: 'Delete', color: 'destructive', onPress: onDelete },
|
|
63
|
+
{ label: 'Cancel', color: 'cancel' },
|
|
64
|
+
]}
|
|
65
|
+
/>
|
|
66
|
+
)}
|
|
67
|
+
</Harness>,
|
|
68
|
+
);
|
|
69
|
+
act(() => { control?.open(); });
|
|
70
|
+
expect(getByText('Delete item?')).toBeTruthy();
|
|
71
|
+
expect(getByText('This action cannot be undone.')).toBeTruthy();
|
|
72
|
+
expect(getByText('Delete')).toBeTruthy();
|
|
73
|
+
expect(getByText('Cancel')).toBeTruthy();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('renders custom children alongside the declarative header', () => {
|
|
77
|
+
let control: ReturnType<typeof useDialogControl> | undefined;
|
|
78
|
+
const { getByText } = renderWithTheme(
|
|
79
|
+
<Harness onControl={(c) => { control = c; }}>
|
|
80
|
+
{(c) => (
|
|
81
|
+
<Dialog control={c} title="Pick a tag">
|
|
82
|
+
<Text>Custom body content</Text>
|
|
83
|
+
</Dialog>
|
|
84
|
+
)}
|
|
85
|
+
</Harness>,
|
|
86
|
+
);
|
|
87
|
+
act(() => { control?.open(); });
|
|
88
|
+
expect(getByText('Pick a tag')).toBeTruthy();
|
|
89
|
+
expect(getByText('Custom body content')).toBeTruthy();
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('fires the action onPress after the dialog finishes closing', () => {
|
|
93
|
+
let control: ReturnType<typeof useDialogControl> | undefined;
|
|
94
|
+
const onConfirm = jest.fn();
|
|
95
|
+
const { getByText } = renderWithTheme(
|
|
96
|
+
<Harness onControl={(c) => { control = c; }}>
|
|
97
|
+
{(c) => (
|
|
98
|
+
<Dialog
|
|
99
|
+
control={c}
|
|
100
|
+
title="Confirm?"
|
|
101
|
+
actions={[
|
|
102
|
+
{ label: 'Confirm', onPress: onConfirm },
|
|
103
|
+
]}
|
|
104
|
+
/>
|
|
105
|
+
)}
|
|
106
|
+
</Harness>,
|
|
107
|
+
);
|
|
108
|
+
act(() => { control?.open(); });
|
|
109
|
+
act(() => {
|
|
110
|
+
fireEvent.press(getByText('Confirm'));
|
|
111
|
+
});
|
|
112
|
+
expect(onConfirm).toHaveBeenCalledTimes(1);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
describe('alert() helper', () => {
|
|
117
|
+
// The alert store is module-scope; ensure no cross-test contamination by
|
|
118
|
+
// draining anything left over from prior tests before each new run.
|
|
119
|
+
beforeEach(() => {
|
|
120
|
+
while (getAlertQueue().length > 0) {
|
|
121
|
+
const head = getAlertQueue()[0];
|
|
122
|
+
if (head) dismissAlert(head.id);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('queues alerts before any provider mounts and drains them on subscribe', () => {
|
|
127
|
+
// Call alert() *before* the provider mounts — entry should sit in the
|
|
128
|
+
// queue until a subscriber attaches, at which point the head is
|
|
129
|
+
// rendered.
|
|
130
|
+
alert('Pending', 'Was queued before provider', [
|
|
131
|
+
{ text: 'OK' },
|
|
132
|
+
]);
|
|
133
|
+
expect(getAlertQueue().length).toBe(1);
|
|
134
|
+
|
|
135
|
+
const { getByText } = renderWithTheme(
|
|
136
|
+
<BloomDialogProvider>
|
|
137
|
+
<Text>app body</Text>
|
|
138
|
+
</BloomDialogProvider>,
|
|
139
|
+
);
|
|
140
|
+
// The queued entry now renders inside the provider.
|
|
141
|
+
expect(getByText('Pending')).toBeTruthy();
|
|
142
|
+
expect(getByText('Was queued before provider')).toBeTruthy();
|
|
143
|
+
expect(getByText('OK')).toBeTruthy();
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it('defaults to a single OK button when no buttons are passed', () => {
|
|
147
|
+
const { getByText } = renderWithTheme(
|
|
148
|
+
<BloomDialogProvider>
|
|
149
|
+
<Text>app</Text>
|
|
150
|
+
</BloomDialogProvider>,
|
|
151
|
+
);
|
|
152
|
+
act(() => {
|
|
153
|
+
alert('Hello');
|
|
154
|
+
});
|
|
155
|
+
expect(getByText('Hello')).toBeTruthy();
|
|
156
|
+
expect(getByText('OK')).toBeTruthy();
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('invokes the button onPress when tapped', () => {
|
|
160
|
+
const onPress = jest.fn();
|
|
161
|
+
const { getByText } = renderWithTheme(
|
|
162
|
+
<BloomDialogProvider>
|
|
163
|
+
<Text>app</Text>
|
|
164
|
+
</BloomDialogProvider>,
|
|
165
|
+
);
|
|
166
|
+
act(() => {
|
|
167
|
+
alert('Sign out?', undefined, [
|
|
168
|
+
{ text: 'Cancel', style: 'cancel' },
|
|
169
|
+
{ text: 'Sign out', style: 'destructive', onPress },
|
|
170
|
+
]);
|
|
171
|
+
});
|
|
172
|
+
act(() => {
|
|
173
|
+
fireEvent.press(getByText('Sign out'));
|
|
174
|
+
});
|
|
175
|
+
expect(onPress).toHaveBeenCalledTimes(1);
|
|
176
|
+
});
|
|
177
|
+
});
|
|
@@ -89,7 +89,7 @@ export interface BottomSheetProps {
|
|
|
89
89
|
/**
|
|
90
90
|
* Opacity of the dimming backdrop behind the sheet (0–1). Defaults to `0.5`.
|
|
91
91
|
* Set to a higher value (e.g. `0.7`) when the sheet is presented over another
|
|
92
|
-
* bottom sheet (Dialog
|
|
92
|
+
* bottom sheet (Dialog cases) so the underlying handle/content does not
|
|
93
93
|
* bleed through.
|
|
94
94
|
*/
|
|
95
95
|
backdropOpacity?: number;
|
|
@@ -300,8 +300,8 @@ const BottomSheet = forwardRef((props: BottomSheetProps, ref: React.ForwardedRef
|
|
|
300
300
|
|
|
301
301
|
// On unmount: ensure pending close callbacks (e.g. consumer's `onDismiss`)
|
|
302
302
|
// still fire if the BS is yanked mid-animation by a parent re-render.
|
|
303
|
-
// Without this, `Dialog
|
|
304
|
-
// callbacks
|
|
303
|
+
// Without this, `Dialog`'s `handleDismiss` never runs and queued
|
|
304
|
+
// callbacks (post-close handlers) are silently lost.
|
|
305
305
|
// Only fires when the sheet was actually rendered (open or closing) to
|
|
306
306
|
// avoid spuriously calling onDismiss on bare unmount of a never-opened
|
|
307
307
|
// sheet. Refs are read inside the cleanup, so latest values are captured.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ContextMenu — Native implementation
|
|
3
3
|
*
|
|
4
|
-
* Opens a bottom-sheet menu
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Opens a bottom-sheet menu when the user long-presses the trigger. The
|
|
5
|
+
* menu body uses bloom's internal `SheetShell` (a `BottomSheet`
|
|
6
|
+
* presentation primitive with the same drag-handle + close-on-tap
|
|
7
|
+
* semantics shared by `Menu` and `Select`).
|
|
7
8
|
*/
|
|
8
9
|
import React, {
|
|
9
10
|
createContext,
|
|
@@ -15,7 +16,9 @@ import { Pressable, StyleSheet, View } from 'react-native';
|
|
|
15
16
|
|
|
16
17
|
import { useTheme } from '../theme/use-theme';
|
|
17
18
|
import { Text } from '../typography';
|
|
18
|
-
import
|
|
19
|
+
import { useDialogControl } from '../dialog/context';
|
|
20
|
+
import { SheetShell } from '../dialog/SheetShell';
|
|
21
|
+
import type { DialogControlProps } from '../dialog/types';
|
|
19
22
|
import { useInteractionState } from '../hooks/useInteractionState';
|
|
20
23
|
import { ItemCtx, useItemContext } from './context';
|
|
21
24
|
import type {
|
|
@@ -34,7 +37,7 @@ import type {
|
|
|
34
37
|
// ---------------------------------------------------------------------------
|
|
35
38
|
|
|
36
39
|
type NativeContextMenuContextValue = ContextMenuContextValue & {
|
|
37
|
-
control:
|
|
40
|
+
control: DialogControlProps;
|
|
38
41
|
};
|
|
39
42
|
|
|
40
43
|
const NativeContextMenuContext = createContext<NativeContextMenuContextValue | null>(null);
|
|
@@ -55,7 +58,7 @@ function useNativeContextMenuContext(): NativeContextMenuContextValue {
|
|
|
55
58
|
// ---------------------------------------------------------------------------
|
|
56
59
|
|
|
57
60
|
export function Root({ children }: { children: React.ReactNode }) {
|
|
58
|
-
const control =
|
|
61
|
+
const control = useDialogControl();
|
|
59
62
|
|
|
60
63
|
const ctx = useMemo(
|
|
61
64
|
() => ({
|
|
@@ -112,8 +115,7 @@ export function Outer({ children, style }: OuterProps) {
|
|
|
112
115
|
const { control } = useNativeContextMenuContext();
|
|
113
116
|
|
|
114
117
|
return (
|
|
115
|
-
<
|
|
116
|
-
<Dialog.Handle />
|
|
118
|
+
<SheetShell control={control} label="Context menu">
|
|
117
119
|
<NativeContextMenuContext.Provider
|
|
118
120
|
value={{
|
|
119
121
|
isOpen: true,
|
|
@@ -122,11 +124,9 @@ export function Outer({ children, style }: OuterProps) {
|
|
|
122
124
|
control,
|
|
123
125
|
}}
|
|
124
126
|
>
|
|
125
|
-
<
|
|
126
|
-
<View style={[styles.outerContent, style]}>{children}</View>
|
|
127
|
-
</Dialog.ScrollableInner>
|
|
127
|
+
<View style={[styles.outerContent, style]}>{children}</View>
|
|
128
128
|
</NativeContextMenuContext.Provider>
|
|
129
|
-
</
|
|
129
|
+
</SheetShell>
|
|
130
130
|
);
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { AutoMountedDialog } from './Dialog';
|
|
4
|
+
import {
|
|
5
|
+
buttonToAction,
|
|
6
|
+
dismissAlert,
|
|
7
|
+
subscribeAlerts,
|
|
8
|
+
type AlertEntry,
|
|
9
|
+
} from './alert-store';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Mounts the imperative `alert()` host inside your app.
|
|
13
|
+
*
|
|
14
|
+
* Wrap your app root once (after `BloomThemeProvider`, so the dialog's
|
|
15
|
+
* colours come from the active theme) and you can call `alert()` from
|
|
16
|
+
* anywhere — including from code that runs before the provider mounts
|
|
17
|
+
* (alerts are queued and drained on subscribe).
|
|
18
|
+
*
|
|
19
|
+
* ```tsx
|
|
20
|
+
* import { BloomDialogProvider } from '@oxyhq/bloom';
|
|
21
|
+
*
|
|
22
|
+
* <BloomThemeProvider mode="system" colorPreset="oxy">
|
|
23
|
+
* <BloomDialogProvider>
|
|
24
|
+
* <App />
|
|
25
|
+
* </BloomDialogProvider>
|
|
26
|
+
* </BloomThemeProvider>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* Alerts are presented one at a time. While one is on screen, subsequent
|
|
30
|
+
* `alert()` calls enqueue and present in FIFO order once their predecessor
|
|
31
|
+
* has finished closing.
|
|
32
|
+
*/
|
|
33
|
+
export function BloomDialogProvider({ children }: { children: React.ReactNode }) {
|
|
34
|
+
const [queue, setQueue] = useState<readonly AlertEntry[]>([]);
|
|
35
|
+
|
|
36
|
+
useEffect(() => subscribeAlerts(setQueue), []);
|
|
37
|
+
|
|
38
|
+
// Only the head of the queue is presented; this keeps the bottom-sheet
|
|
39
|
+
// exit/enter animations clean and matches the platform `Alert.alert`
|
|
40
|
+
// behaviour our consumers expect.
|
|
41
|
+
const head = queue[0];
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
{children}
|
|
46
|
+
{head ? <AlertHost key={head.id} entry={head} /> : null}
|
|
47
|
+
</>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function AlertHost({ entry }: { entry: AlertEntry }) {
|
|
52
|
+
const actions = entry.buttons.map(buttonToAction);
|
|
53
|
+
return (
|
|
54
|
+
<AutoMountedDialog
|
|
55
|
+
title={entry.title}
|
|
56
|
+
description={entry.message}
|
|
57
|
+
actions={actions}
|
|
58
|
+
onResolve={() => dismissAlert(entry.id)}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { AutoMountedDialog } from './Dialog.web';
|
|
4
|
+
import {
|
|
5
|
+
buttonToAction,
|
|
6
|
+
dismissAlert,
|
|
7
|
+
subscribeAlerts,
|
|
8
|
+
type AlertEntry,
|
|
9
|
+
} from './alert-store';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Web variant of `BloomDialogProvider`. Identical surface area to the
|
|
13
|
+
* native version — it just uses the web-fork `Dialog` (`Dialog.web.tsx`)
|
|
14
|
+
* underneath instead of the bottom-sheet variant.
|
|
15
|
+
*
|
|
16
|
+
* See the native file (`./BloomDialogProvider.tsx`) for the full design
|
|
17
|
+
* notes; this fork exists purely so the bundler's `browser` condition can
|
|
18
|
+
* resolve to a `Dialog` that doesn't pull in the native gesture-handler /
|
|
19
|
+
* reanimated stack.
|
|
20
|
+
*/
|
|
21
|
+
export function BloomDialogProvider({ children }: { children: React.ReactNode }) {
|
|
22
|
+
const [queue, setQueue] = useState<readonly AlertEntry[]>([]);
|
|
23
|
+
|
|
24
|
+
useEffect(() => subscribeAlerts(setQueue), []);
|
|
25
|
+
|
|
26
|
+
const head = queue[0];
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<>
|
|
30
|
+
{children}
|
|
31
|
+
{head ? <AlertHost key={head.id} entry={head} /> : null}
|
|
32
|
+
</>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function AlertHost({ entry }: { entry: AlertEntry }) {
|
|
37
|
+
const actions = entry.buttons.map(buttonToAction);
|
|
38
|
+
return (
|
|
39
|
+
<AutoMountedDialog
|
|
40
|
+
title={entry.title}
|
|
41
|
+
description={entry.message}
|
|
42
|
+
actions={actions}
|
|
43
|
+
onResolve={() => dismissAlert(entry.id)}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
}
|