@pittorica/alert-dialog-react 0.22.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/LICENSE +21 -0
- package/README.md +72 -0
- package/dist/AlertDialog.d.ts +3 -0
- package/dist/AlertDialog.d.ts.map +1 -0
- package/dist/AlertDialog.stories.d.ts +8 -0
- package/dist/AlertDialog.stories.d.ts.map +1 -0
- package/dist/AlertDialog.test.d.ts +5 -0
- package/dist/AlertDialog.test.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1790 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Davide Di Criscito
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# @pittorica/alert-dialog-react
|
|
2
|
+
|
|
3
|
+
The `AlertDialog` component is used to interrupt the user with a mandatory confirmation or action. It is built on top of the `Dialog` component.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @pittorica/alert-dialog-react
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
You will also need to install the core `pittorica` package which contains the CSS, and its dependencies.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install pittorica @pittorica/dialog-react @pittorica/button-react
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```jsx
|
|
20
|
+
import { useState } from 'react';
|
|
21
|
+
import { AlertDialog } from '@pittorica/alert-dialog-react';
|
|
22
|
+
import {
|
|
23
|
+
DialogActions,
|
|
24
|
+
DialogDescription,
|
|
25
|
+
DialogTitle,
|
|
26
|
+
} from '@pittorica/dialog-react';
|
|
27
|
+
import { Button } from '@pittorica/button-react';
|
|
28
|
+
import 'pittorica/reset';
|
|
29
|
+
import 'pittorica/tokens';
|
|
30
|
+
|
|
31
|
+
function DeleteAccount() {
|
|
32
|
+
const [open, setOpen] = useState(false);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<>
|
|
36
|
+
<Button variant="tonal" color="red" onClick={() => setOpen(true)}>
|
|
37
|
+
Delete Account
|
|
38
|
+
</Button>
|
|
39
|
+
|
|
40
|
+
<AlertDialog open={open} onClose={() => setOpen(false)}>
|
|
41
|
+
<DialogTitle color="red">Are you absolutely sure?</DialogTitle>
|
|
42
|
+
<DialogDescription>
|
|
43
|
+
This action cannot be undone. This will permanently delete your
|
|
44
|
+
account and remove your data from our servers.
|
|
45
|
+
</DialogDescription>
|
|
46
|
+
<DialogActions>
|
|
47
|
+
<Button variant="text" color="slate" onClick={() => setOpen(false)}>
|
|
48
|
+
Cancel
|
|
49
|
+
</Button>
|
|
50
|
+
<Button variant="filled" color="red" onClick={() => setOpen(false)}>
|
|
51
|
+
Yes, delete account
|
|
52
|
+
</Button>
|
|
53
|
+
</DialogActions>
|
|
54
|
+
</AlertDialog>
|
|
55
|
+
</>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## API Reference
|
|
61
|
+
|
|
62
|
+
The `AlertDialog` component is a wrapper around the `Dialog` component. By default, it sets `closeOnOverlayClick` and `closeOnEsc` to `false` to enforce user interaction.
|
|
63
|
+
|
|
64
|
+
It accepts all the same props as the `Dialog` component. For a full list of available props, see the [`@pittorica/dialog-react` documentation](../dialog/README.md).
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
68
|
+
This project is licensed under the MIT License.
|
|
69
|
+
|
|
70
|
+
**Copyright (c) 2025 Davide Di Criscito**
|
|
71
|
+
|
|
72
|
+
For the full details, see the [LICENSE](LICENSE) file.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type DialogProps } from '@pittorica/dialog-react';
|
|
2
|
+
export declare const AlertDialog: ({ open, onClose, children, className, appearance, closeOnOverlayClick, closeOnEsc, }: DialogProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=AlertDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlertDialog.d.ts","sourceRoot":"","sources":["../src/AlertDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEnE,eAAO,MAAM,WAAW,GAAI,sFAQzB,WAAW,4CAwBb,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { AlertDialog } from './AlertDialog.js';
|
|
3
|
+
declare const meta: Meta<typeof AlertDialog>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof AlertDialog>;
|
|
6
|
+
export declare const Destructive: Story;
|
|
7
|
+
export declare const ForcedInteraction: Story;
|
|
8
|
+
//# sourceMappingURL=AlertDialog.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlertDialog.stories.d.ts","sourceRoot":"","sources":["../src/AlertDialog.stories.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,WAAW,CAalC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAC;AAE1C,eAAO,MAAM,WAAW,EAAE,KAiCzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAiC/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlertDialog.test.d.ts","sourceRoot":"","sources":["../src/AlertDialog.test.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,2BAA2B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|