@oxyhq/bloom 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/fonts/FontLoader.js +6 -5
- package/lib/commonjs/fonts/FontLoader.js.map +1 -1
- package/lib/commonjs/fonts/apply-font-faces.js +4 -4
- package/lib/commonjs/fonts/apply-font-faces.web.js +13 -12
- package/lib/commonjs/fonts/apply-font-faces.web.js.map +1 -1
- package/lib/commonjs/fonts/font-assets.js +2 -2
- package/lib/commonjs/fonts/font-data.web.js +22 -0
- package/lib/commonjs/fonts/font-data.web.js.map +1 -0
- 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/fonts/FontLoader.js +6 -5
- package/lib/module/fonts/FontLoader.js.map +1 -1
- package/lib/module/fonts/apply-font-faces.js +4 -4
- package/lib/module/fonts/apply-font-faces.web.js +13 -10
- package/lib/module/fonts/apply-font-faces.web.js.map +1 -1
- package/lib/module/fonts/font-assets.js +2 -2
- package/lib/module/fonts/font-data.web.js +18 -0
- package/lib/module/fonts/font-data.web.js.map +1 -0
- package/lib/module/fonts/index.web.js +4 -4
- 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/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/fonts/FontLoader.d.ts.map +1 -1
- package/lib/typescript/commonjs/fonts/apply-font-faces.web.d.ts +8 -1
- package/lib/typescript/commonjs/fonts/apply-font-faces.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/fonts/font-data.web.d.ts +5 -0
- package/lib/typescript/commonjs/fonts/font-data.web.d.ts.map +1 -0
- 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/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/fonts/FontLoader.d.ts.map +1 -1
- package/lib/typescript/module/fonts/apply-font-faces.web.d.ts +8 -1
- package/lib/typescript/module/fonts/apply-font-faces.web.d.ts.map +1 -1
- package/lib/typescript/module/fonts/font-data.web.d.ts +5 -0
- package/lib/typescript/module/fonts/font-data.web.d.ts.map +1 -0
- 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 +38 -18
- package/src/__tests__/Dialog.test.tsx +177 -0
- package/src/avatar/Avatar.stories.tsx +69 -0
- package/src/bottom-sheet/BottomSheet.stories.tsx +92 -0
- package/src/bottom-sheet/index.tsx +3 -3
- package/src/button/Button.stories.tsx +94 -0
- package/src/context-menu/ContextMenu.stories.tsx +71 -0
- 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.stories.tsx +112 -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/fonts/FontLoader.tsx +6 -5
- package/src/fonts/apply-font-faces.ts +4 -4
- package/src/fonts/apply-font-faces.web.ts +18 -10
- package/src/fonts/font-assets.ts +2 -2
- package/src/fonts/font-data.web.ts +15 -0
- package/src/fonts/index.web.ts +4 -4
- package/src/index.ts +17 -3
- package/src/index.web.ts +17 -3
- package/src/loading/Loading.stories.tsx +60 -0
- package/src/menu/Menu.stories.tsx +79 -0
- package/src/menu/index.tsx +13 -17
- package/src/prompt-input/PromptInput.stories.tsx +82 -0
- package/src/select/Select.stories.tsx +84 -0
- package/src/select/index.tsx +30 -30
- package/src/settings-list/SettingsList.stories.tsx +106 -0
- package/src/text-field/TextField.stories.tsx +90 -0
- package/src/toast/Toast.stories.tsx +109 -0
- package/src/toast/index.tsx +55 -11
- package/src/toast/index.web.tsx +33 -13
- package/lib/commonjs/fonts/assets/BlomusModernus-Bold.woff2 +0 -0
- package/lib/commonjs/fonts/assets/BlomusModernus-Regular.woff2 +0 -0
- package/lib/commonjs/fonts/assets/GeistMono-Variable.woff2 +0 -0
- package/lib/commonjs/fonts/assets/InterVariable.woff2 +0 -0
- 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/fonts/assets/BlomusModernus-Bold.woff2 +0 -0
- package/lib/module/fonts/assets/BlomusModernus-Regular.woff2 +0 -0
- package/lib/module/fonts/assets/GeistMono-Variable.woff2 +0 -0
- package/lib/module/fonts/assets/InterVariable.woff2 +0 -0
- 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/__tests__/BloomThemeProvider.fonts-web.test.d.ts +0 -5
- package/lib/typescript/commonjs/__tests__/BloomThemeProvider.fonts-web.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/BloomThemeProvider.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/BloomThemeProvider.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/BottomSheet.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/BottomSheet.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/Button.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/Button.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/Code.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/Code.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/FontLoader.native.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/FontLoader.native.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/Pre.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/Pre.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/SettingsList.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/SettingsList.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/apply-font-faces.test.d.ts +0 -5
- package/lib/typescript/commonjs/__tests__/apply-font-faces.test.d.ts.map +0 -1
- package/lib/typescript/commonjs/__tests__/theme.test.d.ts +0 -2
- package/lib/typescript/commonjs/__tests__/theme.test.d.ts.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/__tests__/BloomThemeProvider.fonts-web.test.d.ts +0 -5
- package/lib/typescript/module/__tests__/BloomThemeProvider.fonts-web.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/BloomThemeProvider.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/BloomThemeProvider.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/BottomSheet.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/BottomSheet.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/Button.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/Button.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/Code.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/Code.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/FontLoader.native.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/FontLoader.native.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/Pre.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/Pre.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/SettingsList.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/SettingsList.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/apply-font-faces.test.d.ts +0 -5
- package/lib/typescript/module/__tests__/apply-font-faces.test.d.ts.map +0 -1
- package/lib/typescript/module/__tests__/theme.test.d.ts +0 -2
- package/lib/typescript/module/__tests__/theme.test.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
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
|
+
|
|
5
|
+
import * as TextField from './index';
|
|
6
|
+
|
|
7
|
+
const meta: Meta = {
|
|
8
|
+
title: 'Components/TextField',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj;
|
|
14
|
+
|
|
15
|
+
function ControlledField({
|
|
16
|
+
label,
|
|
17
|
+
placeholder,
|
|
18
|
+
initial = '',
|
|
19
|
+
isInvalid,
|
|
20
|
+
editable = true,
|
|
21
|
+
}: {
|
|
22
|
+
label: string;
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
initial?: string;
|
|
25
|
+
isInvalid?: boolean;
|
|
26
|
+
editable?: boolean;
|
|
27
|
+
}) {
|
|
28
|
+
const [value, setValue] = useState(initial);
|
|
29
|
+
return (
|
|
30
|
+
<View style={{ width: 320 }}>
|
|
31
|
+
<TextField.LabelText>{label}</TextField.LabelText>
|
|
32
|
+
<TextField.Root isInvalid={isInvalid}>
|
|
33
|
+
<TextField.Input
|
|
34
|
+
label={label}
|
|
35
|
+
placeholder={placeholder}
|
|
36
|
+
value={value}
|
|
37
|
+
onChangeText={setValue}
|
|
38
|
+
editable={editable}
|
|
39
|
+
isInvalid={isInvalid}
|
|
40
|
+
/>
|
|
41
|
+
</TextField.Root>
|
|
42
|
+
</View>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const Basic: Story = {
|
|
47
|
+
render: () => (
|
|
48
|
+
<ControlledField label="Username" placeholder="oxylander" />
|
|
49
|
+
),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const WithValue: Story = {
|
|
53
|
+
render: () => (
|
|
54
|
+
<ControlledField label="Email" initial="nate@oxy.so" />
|
|
55
|
+
),
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const Error: Story = {
|
|
59
|
+
render: () => (
|
|
60
|
+
<ControlledField
|
|
61
|
+
label="Email"
|
|
62
|
+
initial="not-an-email"
|
|
63
|
+
isInvalid
|
|
64
|
+
/>
|
|
65
|
+
),
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const Disabled: Story = {
|
|
69
|
+
render: () => (
|
|
70
|
+
<ControlledField
|
|
71
|
+
label="Username"
|
|
72
|
+
initial="oxylander"
|
|
73
|
+
editable={false}
|
|
74
|
+
/>
|
|
75
|
+
),
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const Composition: Story = {
|
|
79
|
+
render: () => (
|
|
80
|
+
<View style={{ gap: 16 }}>
|
|
81
|
+
<ControlledField label="First name" placeholder="Ada" />
|
|
82
|
+
<ControlledField label="Last name" placeholder="Lovelace" />
|
|
83
|
+
<ControlledField
|
|
84
|
+
label="Email"
|
|
85
|
+
initial="invalid-email"
|
|
86
|
+
isInvalid
|
|
87
|
+
/>
|
|
88
|
+
</View>
|
|
89
|
+
),
|
|
90
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
|
+
|
|
5
|
+
import { Button } from '../button';
|
|
6
|
+
import { toast, ToastOutlet } from './index';
|
|
7
|
+
|
|
8
|
+
const meta: Meta = {
|
|
9
|
+
title: 'Components/Toast',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
|
|
14
|
+
type Story = StoryObj;
|
|
15
|
+
|
|
16
|
+
function ToastDemo({
|
|
17
|
+
variant,
|
|
18
|
+
message,
|
|
19
|
+
}: {
|
|
20
|
+
variant: 'default' | 'success' | 'error' | 'warning' | 'info';
|
|
21
|
+
message: string;
|
|
22
|
+
}) {
|
|
23
|
+
const fire = () => {
|
|
24
|
+
switch (variant) {
|
|
25
|
+
case 'success':
|
|
26
|
+
toast.success(message);
|
|
27
|
+
return;
|
|
28
|
+
case 'error':
|
|
29
|
+
toast.error(message);
|
|
30
|
+
return;
|
|
31
|
+
case 'warning':
|
|
32
|
+
toast.warning(message);
|
|
33
|
+
return;
|
|
34
|
+
case 'info':
|
|
35
|
+
toast.info(message);
|
|
36
|
+
return;
|
|
37
|
+
case 'default':
|
|
38
|
+
default:
|
|
39
|
+
toast(message);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Button onPress={fire}>{`Show ${variant}`}</Button>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function Outlet() {
|
|
49
|
+
return <ToastOutlet />;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const Basic: Story = {
|
|
53
|
+
render: () => (
|
|
54
|
+
<View style={{ gap: 12, alignItems: 'flex-start' }}>
|
|
55
|
+
<ToastDemo variant="default" message="Saved" />
|
|
56
|
+
<Outlet />
|
|
57
|
+
</View>
|
|
58
|
+
),
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const Success: Story = {
|
|
62
|
+
render: () => (
|
|
63
|
+
<View style={{ gap: 12, alignItems: 'flex-start' }}>
|
|
64
|
+
<ToastDemo variant="success" message="Profile updated" />
|
|
65
|
+
<Outlet />
|
|
66
|
+
</View>
|
|
67
|
+
),
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const ErrorToast: Story = {
|
|
71
|
+
name: 'Error',
|
|
72
|
+
render: () => (
|
|
73
|
+
<View style={{ gap: 12, alignItems: 'flex-start' }}>
|
|
74
|
+
<ToastDemo variant="error" message="Network error" />
|
|
75
|
+
<Outlet />
|
|
76
|
+
</View>
|
|
77
|
+
),
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const Warning: Story = {
|
|
81
|
+
render: () => (
|
|
82
|
+
<View style={{ gap: 12, alignItems: 'flex-start' }}>
|
|
83
|
+
<ToastDemo variant="warning" message="Storage almost full" />
|
|
84
|
+
<Outlet />
|
|
85
|
+
</View>
|
|
86
|
+
),
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const Info: Story = {
|
|
90
|
+
render: () => (
|
|
91
|
+
<View style={{ gap: 12, alignItems: 'flex-start' }}>
|
|
92
|
+
<ToastDemo variant="info" message="New version available" />
|
|
93
|
+
<Outlet />
|
|
94
|
+
</View>
|
|
95
|
+
),
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const Composition: Story = {
|
|
99
|
+
render: () => (
|
|
100
|
+
<View style={{ gap: 12, alignItems: 'flex-start' }}>
|
|
101
|
+
<ToastDemo variant="default" message="Default" />
|
|
102
|
+
<ToastDemo variant="success" message="Success" />
|
|
103
|
+
<ToastDemo variant="error" message="Error" />
|
|
104
|
+
<ToastDemo variant="warning" message="Warning" />
|
|
105
|
+
<ToastDemo variant="info" message="Info" />
|
|
106
|
+
<Outlet />
|
|
107
|
+
</View>
|
|
108
|
+
),
|
|
109
|
+
};
|
package/src/toast/index.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
Text as ToastText,
|
|
11
11
|
ToastConfigProvider,
|
|
12
12
|
} from './Toast';
|
|
13
|
-
import type { BaseToastOptions } from './types';
|
|
13
|
+
import type { BaseToastOptions, ToastType } from './types';
|
|
14
14
|
|
|
15
15
|
export { DURATION } from './const';
|
|
16
16
|
export { Action, Icon, Outer, Text, ToastConfigProvider } from './Toast';
|
|
@@ -33,21 +33,17 @@ function OuterWrapper({ children }: { children: React.ReactNode }) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Direct access to the Sonner API. Use sparingly — `toast()` covers the
|
|
37
|
+
* common case and keeps the surface tied to bloom's themed look.
|
|
37
38
|
*/
|
|
38
39
|
export const api = sonner;
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
* Show a toast notification.
|
|
42
|
-
*
|
|
43
|
-
* Pass a string for a simple text toast, or a React element for a custom toast.
|
|
44
|
-
*/
|
|
45
|
-
export function show(
|
|
41
|
+
function dispatch(
|
|
46
42
|
content: React.ReactNode,
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
type: ToastType,
|
|
44
|
+
options: BaseToastOptions = {},
|
|
45
|
+
): void {
|
|
49
46
|
const id = nanoid();
|
|
50
|
-
|
|
51
47
|
if (typeof content === 'string') {
|
|
52
48
|
sonner.custom(
|
|
53
49
|
<ToastConfigProvider id={id} type={type}>
|
|
@@ -80,6 +76,54 @@ export function show(
|
|
|
80
76
|
}
|
|
81
77
|
}
|
|
82
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Show a toast notification.
|
|
81
|
+
*
|
|
82
|
+
* Pass a string for a simple text toast, or a React element for a custom
|
|
83
|
+
* toast. The optional `options` argument accepts the standard Sonner
|
|
84
|
+
* options plus a bloom `type` (defaults to `'default'`).
|
|
85
|
+
*
|
|
86
|
+
* ```ts
|
|
87
|
+
* toast('Saved');
|
|
88
|
+
* toast.success('Profile updated');
|
|
89
|
+
* toast.error('Network error', { duration: 5000 });
|
|
90
|
+
* toast.dismiss(id);
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* Pre-typed variants (`toast.success`, `toast.error`, `toast.warning`,
|
|
94
|
+
* `toast.info`) are aliases for the corresponding `type`.
|
|
95
|
+
*/
|
|
96
|
+
export interface ToastFn {
|
|
97
|
+
(content: React.ReactNode, options?: BaseToastOptions): void;
|
|
98
|
+
success: (content: React.ReactNode, options?: Omit<BaseToastOptions, 'type'>) => void;
|
|
99
|
+
error: (content: React.ReactNode, options?: Omit<BaseToastOptions, 'type'>) => void;
|
|
100
|
+
warning: (content: React.ReactNode, options?: Omit<BaseToastOptions, 'type'>) => void;
|
|
101
|
+
info: (content: React.ReactNode, options?: Omit<BaseToastOptions, 'type'>) => void;
|
|
102
|
+
dismiss: (id?: string | number) => void;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const toastImpl = ((content: React.ReactNode, options: BaseToastOptions = {}) => {
|
|
106
|
+
dispatch(content, options.type ?? 'default', options);
|
|
107
|
+
}) as ToastFn;
|
|
108
|
+
|
|
109
|
+
toastImpl.success = (content, options) => dispatch(content, 'success', options ?? {});
|
|
110
|
+
toastImpl.error = (content, options) => dispatch(content, 'error', options ?? {});
|
|
111
|
+
toastImpl.warning = (content, options) => dispatch(content, 'warning', options ?? {});
|
|
112
|
+
toastImpl.info = (content, options) => dispatch(content, 'info', options ?? {});
|
|
113
|
+
toastImpl.dismiss = (id) => sonner.dismiss(id);
|
|
114
|
+
|
|
115
|
+
export const toast: ToastFn = toastImpl;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Alias of `toast` kept for compatibility with the original 0.4.x surface
|
|
119
|
+
* where `show()` was the documented entry point. New code should prefer
|
|
120
|
+
* `toast()` directly.
|
|
121
|
+
*/
|
|
122
|
+
export const show: ToastFn = toastImpl;
|
|
123
|
+
|
|
124
|
+
/** Re-export the Toast function type so callers can refer to it. */
|
|
125
|
+
export type Toast = ToastFn;
|
|
126
|
+
|
|
83
127
|
const wrapperStyles = StyleSheet.create({
|
|
84
128
|
container: {
|
|
85
129
|
paddingHorizontal: 20,
|
package/src/toast/index.web.tsx
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
Text as ToastText,
|
|
10
10
|
ToastConfigProvider,
|
|
11
11
|
} from './Toast';
|
|
12
|
-
import type { BaseToastOptions } from './types';
|
|
12
|
+
import type { BaseToastOptions, ToastType } from './types';
|
|
13
13
|
|
|
14
14
|
export { DURATION } from './const';
|
|
15
15
|
export { Action, Icon, Outer, Text, ToastConfigProvider } from './Toast';
|
|
@@ -30,22 +30,15 @@ export function ToastOutlet() {
|
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
/**
|
|
34
|
-
* Access the full Sonner API
|
|
35
|
-
*/
|
|
33
|
+
/** Direct access to the underlying Sonner API. Use sparingly. */
|
|
36
34
|
export const api: typeof sonner = sonner;
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
* Show a toast notification.
|
|
40
|
-
*
|
|
41
|
-
* Pass a string for a simple text toast, or a React element for a custom toast.
|
|
42
|
-
*/
|
|
43
|
-
export function show(
|
|
36
|
+
function dispatch(
|
|
44
37
|
content: React.ReactNode,
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
type: ToastType,
|
|
39
|
+
options: BaseToastOptions = {},
|
|
40
|
+
): void {
|
|
47
41
|
const id = nanoid();
|
|
48
|
-
|
|
49
42
|
if (typeof content === 'string') {
|
|
50
43
|
sonner(
|
|
51
44
|
<ToastConfigProvider id={id} type={type}>
|
|
@@ -79,3 +72,30 @@ export function show(
|
|
|
79
72
|
);
|
|
80
73
|
}
|
|
81
74
|
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Show a toast notification. Identical API to the native variant — see
|
|
78
|
+
* `./index.tsx` for the full usage docs.
|
|
79
|
+
*/
|
|
80
|
+
export interface ToastFn {
|
|
81
|
+
(content: React.ReactNode, options?: BaseToastOptions): void;
|
|
82
|
+
success: (content: React.ReactNode, options?: Omit<BaseToastOptions, 'type'>) => void;
|
|
83
|
+
error: (content: React.ReactNode, options?: Omit<BaseToastOptions, 'type'>) => void;
|
|
84
|
+
warning: (content: React.ReactNode, options?: Omit<BaseToastOptions, 'type'>) => void;
|
|
85
|
+
info: (content: React.ReactNode, options?: Omit<BaseToastOptions, 'type'>) => void;
|
|
86
|
+
dismiss: (id?: string | number) => void;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const toastImpl = ((content: React.ReactNode, options: BaseToastOptions = {}) => {
|
|
90
|
+
dispatch(content, options.type ?? 'default', options);
|
|
91
|
+
}) as ToastFn;
|
|
92
|
+
|
|
93
|
+
toastImpl.success = (content, options) => dispatch(content, 'success', options ?? {});
|
|
94
|
+
toastImpl.error = (content, options) => dispatch(content, 'error', options ?? {});
|
|
95
|
+
toastImpl.warning = (content, options) => dispatch(content, 'warning', options ?? {});
|
|
96
|
+
toastImpl.info = (content, options) => dispatch(content, 'info', options ?? {});
|
|
97
|
+
toastImpl.dismiss = (id) => sonner.dismiss(id);
|
|
98
|
+
|
|
99
|
+
export const toast: ToastFn = toastImpl;
|
|
100
|
+
export const show: ToastFn = toastImpl;
|
|
101
|
+
export type Toast = ToastFn;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Action = Action;
|
|
7
|
-
exports.Actions = Actions;
|
|
8
|
-
exports.Basic = Basic;
|
|
9
|
-
exports.Cancel = Cancel;
|
|
10
|
-
exports.Content = Content;
|
|
11
|
-
exports.DescriptionText = DescriptionText;
|
|
12
|
-
exports.Outer = Outer;
|
|
13
|
-
exports.TitleText = TitleText;
|
|
14
|
-
Object.defineProperty(exports, "usePromptControl", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function () {
|
|
17
|
-
return Dialog.useDialogControl;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
-
var _reactNative = require("react-native");
|
|
22
|
-
var _useTheme = require("../theme/use-theme.js");
|
|
23
|
-
var Dialog = _interopRequireWildcard(require("../dialog"));
|
|
24
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
26
|
-
const PromptContext = /*#__PURE__*/(0, _react.createContext)({
|
|
27
|
-
titleId: '',
|
|
28
|
-
descriptionId: ''
|
|
29
|
-
});
|
|
30
|
-
PromptContext.displayName = 'BloomPromptContext';
|
|
31
|
-
function Outer({
|
|
32
|
-
children,
|
|
33
|
-
control,
|
|
34
|
-
testID,
|
|
35
|
-
onClose
|
|
36
|
-
}) {
|
|
37
|
-
const titleId = (0, _react.useId)();
|
|
38
|
-
const descriptionId = (0, _react.useId)();
|
|
39
|
-
const context = (0, _react.useMemo)(() => ({
|
|
40
|
-
titleId,
|
|
41
|
-
descriptionId
|
|
42
|
-
}), [titleId, descriptionId]);
|
|
43
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Dialog.Outer, {
|
|
44
|
-
control: control,
|
|
45
|
-
testID: testID,
|
|
46
|
-
onClose: onClose,
|
|
47
|
-
webOptions: {
|
|
48
|
-
alignCenter: true
|
|
49
|
-
},
|
|
50
|
-
preventExpansion: true,
|
|
51
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PromptContext.Provider, {
|
|
52
|
-
value: context,
|
|
53
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Dialog.ScrollableInner, {
|
|
54
|
-
label: "",
|
|
55
|
-
style: _reactNative.Platform.select({
|
|
56
|
-
web: {
|
|
57
|
-
maxWidth: 320,
|
|
58
|
-
borderRadius: 36
|
|
59
|
-
},
|
|
60
|
-
default: undefined
|
|
61
|
-
}),
|
|
62
|
-
children: children
|
|
63
|
-
})
|
|
64
|
-
})
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
function TitleText({
|
|
68
|
-
children
|
|
69
|
-
}) {
|
|
70
|
-
const {
|
|
71
|
-
titleId
|
|
72
|
-
} = (0, _react.useContext)(PromptContext);
|
|
73
|
-
const theme = (0, _useTheme.useTheme)();
|
|
74
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
75
|
-
nativeID: titleId,
|
|
76
|
-
style: {
|
|
77
|
-
fontSize: 22,
|
|
78
|
-
fontWeight: '600',
|
|
79
|
-
color: theme.colors.text,
|
|
80
|
-
paddingBottom: 4,
|
|
81
|
-
lineHeight: 30
|
|
82
|
-
},
|
|
83
|
-
children: children
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
function DescriptionText({
|
|
87
|
-
children,
|
|
88
|
-
selectable
|
|
89
|
-
}) {
|
|
90
|
-
const {
|
|
91
|
-
descriptionId
|
|
92
|
-
} = (0, _react.useContext)(PromptContext);
|
|
93
|
-
const theme = (0, _useTheme.useTheme)();
|
|
94
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
95
|
-
nativeID: descriptionId,
|
|
96
|
-
selectable: selectable,
|
|
97
|
-
style: {
|
|
98
|
-
fontSize: 16,
|
|
99
|
-
color: theme.colors.textSecondary,
|
|
100
|
-
paddingBottom: 16,
|
|
101
|
-
lineHeight: 22
|
|
102
|
-
},
|
|
103
|
-
children: children
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
function Actions({
|
|
107
|
-
children
|
|
108
|
-
}) {
|
|
109
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
110
|
-
style: {
|
|
111
|
-
width: '100%',
|
|
112
|
-
gap: 8,
|
|
113
|
-
justifyContent: 'flex-end'
|
|
114
|
-
},
|
|
115
|
-
children: children
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
function Content({
|
|
119
|
-
children
|
|
120
|
-
}) {
|
|
121
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
122
|
-
style: {
|
|
123
|
-
paddingBottom: 8
|
|
124
|
-
},
|
|
125
|
-
children: children
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
function getActionColors(color, colors) {
|
|
129
|
-
switch (color) {
|
|
130
|
-
case 'negative':
|
|
131
|
-
return {
|
|
132
|
-
background: colors.negative,
|
|
133
|
-
foreground: colors.negativeForeground
|
|
134
|
-
};
|
|
135
|
-
case 'negative_subtle':
|
|
136
|
-
return {
|
|
137
|
-
background: colors.negativeSubtle,
|
|
138
|
-
foreground: colors.negativeSubtleForeground
|
|
139
|
-
};
|
|
140
|
-
case 'primary_subtle':
|
|
141
|
-
return {
|
|
142
|
-
background: colors.primarySubtle,
|
|
143
|
-
foreground: colors.primarySubtleForeground
|
|
144
|
-
};
|
|
145
|
-
case 'secondary':
|
|
146
|
-
return {
|
|
147
|
-
background: colors.contrast50,
|
|
148
|
-
foreground: colors.text
|
|
149
|
-
};
|
|
150
|
-
case 'primary':
|
|
151
|
-
default:
|
|
152
|
-
return {
|
|
153
|
-
background: colors.primary,
|
|
154
|
-
foreground: '#FFFFFF'
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
function Cancel({
|
|
159
|
-
cta
|
|
160
|
-
}) {
|
|
161
|
-
const {
|
|
162
|
-
close
|
|
163
|
-
} = Dialog.useDialogContext();
|
|
164
|
-
const theme = (0, _useTheme.useTheme)();
|
|
165
|
-
const {
|
|
166
|
-
background
|
|
167
|
-
} = getActionColors('secondary', theme.colors);
|
|
168
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
169
|
-
style: {
|
|
170
|
-
borderRadius: 9999,
|
|
171
|
-
alignItems: 'center',
|
|
172
|
-
justifyContent: 'center',
|
|
173
|
-
backgroundColor: background,
|
|
174
|
-
paddingVertical: 12,
|
|
175
|
-
paddingHorizontal: 24
|
|
176
|
-
},
|
|
177
|
-
onPress: () => close(),
|
|
178
|
-
activeOpacity: 0.7,
|
|
179
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
180
|
-
style: {
|
|
181
|
-
fontSize: 16,
|
|
182
|
-
fontWeight: '500',
|
|
183
|
-
color: theme.colors.text
|
|
184
|
-
},
|
|
185
|
-
children: cta ?? 'Cancel'
|
|
186
|
-
})
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
function Action({
|
|
190
|
-
onPress,
|
|
191
|
-
color = 'primary',
|
|
192
|
-
cta,
|
|
193
|
-
disabled = false,
|
|
194
|
-
shouldCloseOnPress = true,
|
|
195
|
-
testID
|
|
196
|
-
}) {
|
|
197
|
-
const {
|
|
198
|
-
close
|
|
199
|
-
} = Dialog.useDialogContext();
|
|
200
|
-
const theme = (0, _useTheme.useTheme)();
|
|
201
|
-
const handleOnPress = (0, _react.useCallback)(e => {
|
|
202
|
-
if (shouldCloseOnPress) {
|
|
203
|
-
close(() => onPress(e));
|
|
204
|
-
} else {
|
|
205
|
-
onPress(e);
|
|
206
|
-
}
|
|
207
|
-
}, [close, onPress, shouldCloseOnPress]);
|
|
208
|
-
const {
|
|
209
|
-
background,
|
|
210
|
-
foreground
|
|
211
|
-
} = getActionColors(color, theme.colors);
|
|
212
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
213
|
-
style: {
|
|
214
|
-
borderRadius: 9999,
|
|
215
|
-
alignItems: 'center',
|
|
216
|
-
justifyContent: 'center',
|
|
217
|
-
backgroundColor: background,
|
|
218
|
-
opacity: disabled ? 0.5 : 1,
|
|
219
|
-
paddingVertical: 12,
|
|
220
|
-
paddingHorizontal: 24
|
|
221
|
-
},
|
|
222
|
-
onPress: handleOnPress,
|
|
223
|
-
disabled: disabled,
|
|
224
|
-
activeOpacity: 0.7,
|
|
225
|
-
testID: testID,
|
|
226
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
227
|
-
style: {
|
|
228
|
-
fontSize: 16,
|
|
229
|
-
fontWeight: '500',
|
|
230
|
-
color: foreground
|
|
231
|
-
},
|
|
232
|
-
children: cta ?? 'Confirm'
|
|
233
|
-
})
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
function Basic({
|
|
237
|
-
control,
|
|
238
|
-
title,
|
|
239
|
-
description,
|
|
240
|
-
cancelButtonCta,
|
|
241
|
-
confirmButtonCta,
|
|
242
|
-
onConfirm,
|
|
243
|
-
confirmButtonColor,
|
|
244
|
-
showCancel = true
|
|
245
|
-
}) {
|
|
246
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Outer, {
|
|
247
|
-
control: control,
|
|
248
|
-
testID: "confirmModal",
|
|
249
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(Content, {
|
|
250
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(TitleText, {
|
|
251
|
-
children: title
|
|
252
|
-
}), description && /*#__PURE__*/(0, _jsxRuntime.jsx)(DescriptionText, {
|
|
253
|
-
children: description
|
|
254
|
-
})]
|
|
255
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(Actions, {
|
|
256
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Action, {
|
|
257
|
-
cta: confirmButtonCta,
|
|
258
|
-
onPress: onConfirm,
|
|
259
|
-
color: confirmButtonColor,
|
|
260
|
-
testID: "confirmBtn"
|
|
261
|
-
}), showCancel && /*#__PURE__*/(0, _jsxRuntime.jsx)(Cancel, {
|
|
262
|
-
cta: cancelButtonCta
|
|
263
|
-
})]
|
|
264
|
-
})]
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
//# sourceMappingURL=Prompt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_useTheme","Dialog","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","PromptContext","createContext","titleId","descriptionId","displayName","Outer","children","control","testID","onClose","useId","context","useMemo","jsx","webOptions","alignCenter","preventExpansion","Provider","value","ScrollableInner","label","style","Platform","select","web","maxWidth","borderRadius","undefined","TitleText","useContext","theme","useTheme","Text","nativeID","fontSize","fontWeight","color","colors","text","paddingBottom","lineHeight","DescriptionText","selectable","textSecondary","Actions","View","width","gap","justifyContent","Content","getActionColors","background","negative","foreground","negativeForeground","negativeSubtle","negativeSubtleForeground","primarySubtle","primarySubtleForeground","contrast50","primary","Cancel","cta","close","useDialogContext","TouchableOpacity","alignItems","backgroundColor","paddingVertical","paddingHorizontal","onPress","activeOpacity","Action","disabled","shouldCloseOnPress","handleOnPress","useCallback","opacity","Basic","title","description","cancelButtonCta","confirmButtonCta","onConfirm","confirmButtonColor","showCancel","jsxs"],"sourceRoot":"../../../src","sources":["prompt/Prompt.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAJ,uBAAA,CAAAC,OAAA;AAAoC,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAD,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,CAAAM,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAA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