@glob-ui/alert-dialog 0.0.0-stage → 0.2.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kevin Martínez E
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 CHANGED
@@ -1,3 +1,17 @@
1
- # Temporary Holding Version
1
+ # @glob-ui/alert-dialog
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A modal that asks the user to confirm a decision. The backdrop does not close it; the user answers with Cancel or the action.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add @glob-ui/alert-dialog
9
+ ```
10
+
11
+ ## Documentation
12
+
13
+ Full docs, examples and the accessibility table: [Alert dialog](https://github.com/kevin-martineze/GlobUI/tree/main/apps/docs/content/docs/components/alert-dialog.mdx).
14
+
15
+ ## License
16
+
17
+ MIT. See [LICENSE](./LICENSE).
@@ -0,0 +1,40 @@
1
+ import * as react from 'react';
2
+ import * as _glob_ui_dialog from '@glob-ui/dialog';
3
+ import { DialogProps, DialogCloseProps, DialogContentBaseProps, DialogDescription, DialogFooterProps, DialogHeader, DialogTitle, DialogTrigger } from '@glob-ui/dialog';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
+
6
+ type AlertDialogProps = Omit<DialogProps, "closeOnOutsideClick">;
7
+ /**
8
+ * A Dialog for a decision the user must make. The backdrop does not close it, so the user answers
9
+ * with Cancel or the action (Escape still closes it, as the WAI-ARIA alertdialog pattern allows).
10
+ */
11
+ declare function AlertDialog(props: AlertDialogProps): react_jsx_runtime.JSX.Element;
12
+ declare namespace AlertDialog {
13
+ var displayName: string;
14
+ }
15
+ declare const AlertDialogTrigger: react.ForwardRefExoticComponent<_glob_ui_dialog.DialogTriggerProps & react.RefAttributes<HTMLButtonElement>>;
16
+ declare const AlertDialogHeader: react.ForwardRefExoticComponent<_glob_ui_dialog.DialogHeaderProps & react.RefAttributes<HTMLDivElement>>;
17
+ declare const AlertDialogTitle: react.ForwardRefExoticComponent<_glob_ui_dialog.DialogTitleProps & react.RefAttributes<HTMLHeadingElement>>;
18
+ declare const AlertDialogDescription: react.ForwardRefExoticComponent<_glob_ui_dialog.DialogDescriptionProps & react.RefAttributes<HTMLParagraphElement>>;
19
+ type AlertDialogTriggerProps = React.ComponentProps<typeof DialogTrigger>;
20
+ type AlertDialogHeaderProps = React.ComponentProps<typeof DialogHeader>;
21
+ type AlertDialogTitleProps = React.ComponentProps<typeof DialogTitle>;
22
+ type AlertDialogDescriptionProps = React.ComponentProps<typeof DialogDescription>;
23
+ type AlertDialogFooterProps = DialogFooterProps;
24
+ type AlertDialogContentProps = DialogContentBaseProps;
25
+ declare const AlertDialogContent: react.ForwardRefExoticComponent<DialogContentBaseProps & react.RefAttributes<HTMLDialogElement>>;
26
+ declare const AlertDialogFooter: react.ForwardRefExoticComponent<DialogFooterProps & react.RefAttributes<HTMLDivElement>>;
27
+ type AlertDialogCancelProps = DialogCloseProps;
28
+ /** The safe option. It takes the initial focus. */
29
+ declare const AlertDialogCancel: react.ForwardRefExoticComponent<DialogCloseProps & react.RefAttributes<HTMLButtonElement>>;
30
+ interface AlertDialogActionProps extends DialogCloseProps {
31
+ /** `danger` for destructive actions (delete, remove, revoke). */
32
+ variant?: "primary" | "danger";
33
+ }
34
+ /**
35
+ * Confirms the decision and closes the dialog. Call `event.preventDefault()` in `onClick` to keep it
36
+ * open, for example while an async action runs.
37
+ */
38
+ declare const AlertDialogAction: react.ForwardRefExoticComponent<AlertDialogActionProps & react.RefAttributes<HTMLButtonElement>>;
39
+
40
+ export { AlertDialog, AlertDialogAction, type AlertDialogActionProps, AlertDialogCancel, type AlertDialogCancelProps, AlertDialogContent, type AlertDialogContentProps, AlertDialogDescription, type AlertDialogDescriptionProps, AlertDialogFooter, type AlertDialogFooterProps, AlertDialogHeader, type AlertDialogHeaderProps, type AlertDialogProps, AlertDialogTitle, type AlertDialogTitleProps, AlertDialogTrigger, type AlertDialogTriggerProps };
@@ -0,0 +1,40 @@
1
+ import * as react from 'react';
2
+ import * as _glob_ui_dialog from '@glob-ui/dialog';
3
+ import { DialogProps, DialogCloseProps, DialogContentBaseProps, DialogDescription, DialogFooterProps, DialogHeader, DialogTitle, DialogTrigger } from '@glob-ui/dialog';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
+
6
+ type AlertDialogProps = Omit<DialogProps, "closeOnOutsideClick">;
7
+ /**
8
+ * A Dialog for a decision the user must make. The backdrop does not close it, so the user answers
9
+ * with Cancel or the action (Escape still closes it, as the WAI-ARIA alertdialog pattern allows).
10
+ */
11
+ declare function AlertDialog(props: AlertDialogProps): react_jsx_runtime.JSX.Element;
12
+ declare namespace AlertDialog {
13
+ var displayName: string;
14
+ }
15
+ declare const AlertDialogTrigger: react.ForwardRefExoticComponent<_glob_ui_dialog.DialogTriggerProps & react.RefAttributes<HTMLButtonElement>>;
16
+ declare const AlertDialogHeader: react.ForwardRefExoticComponent<_glob_ui_dialog.DialogHeaderProps & react.RefAttributes<HTMLDivElement>>;
17
+ declare const AlertDialogTitle: react.ForwardRefExoticComponent<_glob_ui_dialog.DialogTitleProps & react.RefAttributes<HTMLHeadingElement>>;
18
+ declare const AlertDialogDescription: react.ForwardRefExoticComponent<_glob_ui_dialog.DialogDescriptionProps & react.RefAttributes<HTMLParagraphElement>>;
19
+ type AlertDialogTriggerProps = React.ComponentProps<typeof DialogTrigger>;
20
+ type AlertDialogHeaderProps = React.ComponentProps<typeof DialogHeader>;
21
+ type AlertDialogTitleProps = React.ComponentProps<typeof DialogTitle>;
22
+ type AlertDialogDescriptionProps = React.ComponentProps<typeof DialogDescription>;
23
+ type AlertDialogFooterProps = DialogFooterProps;
24
+ type AlertDialogContentProps = DialogContentBaseProps;
25
+ declare const AlertDialogContent: react.ForwardRefExoticComponent<DialogContentBaseProps & react.RefAttributes<HTMLDialogElement>>;
26
+ declare const AlertDialogFooter: react.ForwardRefExoticComponent<DialogFooterProps & react.RefAttributes<HTMLDivElement>>;
27
+ type AlertDialogCancelProps = DialogCloseProps;
28
+ /** The safe option. It takes the initial focus. */
29
+ declare const AlertDialogCancel: react.ForwardRefExoticComponent<DialogCloseProps & react.RefAttributes<HTMLButtonElement>>;
30
+ interface AlertDialogActionProps extends DialogCloseProps {
31
+ /** `danger` for destructive actions (delete, remove, revoke). */
32
+ variant?: "primary" | "danger";
33
+ }
34
+ /**
35
+ * Confirms the decision and closes the dialog. Call `event.preventDefault()` in `onClick` to keep it
36
+ * open, for example while an async action runs.
37
+ */
38
+ declare const AlertDialogAction: react.ForwardRefExoticComponent<AlertDialogActionProps & react.RefAttributes<HTMLButtonElement>>;
39
+
40
+ export { AlertDialog, AlertDialogAction, type AlertDialogActionProps, AlertDialogCancel, type AlertDialogCancelProps, AlertDialogContent, type AlertDialogContentProps, AlertDialogDescription, type AlertDialogDescriptionProps, AlertDialogFooter, type AlertDialogFooterProps, AlertDialogHeader, type AlertDialogHeaderProps, type AlertDialogProps, AlertDialogTitle, type AlertDialogTitleProps, AlertDialogTrigger, type AlertDialogTriggerProps };
package/dist/index.js ADDED
@@ -0,0 +1,137 @@
1
+ "use client"
2
+ "use strict";
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __objRest = (source, exclude) => {
25
+ var target = {};
26
+ for (var prop in source)
27
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
28
+ target[prop] = source[prop];
29
+ if (source != null && __getOwnPropSymbols)
30
+ for (var prop of __getOwnPropSymbols(source)) {
31
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
32
+ target[prop] = source[prop];
33
+ }
34
+ return target;
35
+ };
36
+ var __export = (target, all) => {
37
+ for (var name in all)
38
+ __defProp(target, name, { get: all[name], enumerable: true });
39
+ };
40
+ var __copyProps = (to, from, except, desc) => {
41
+ if (from && typeof from === "object" || typeof from === "function") {
42
+ for (let key of __getOwnPropNames(from))
43
+ if (!__hasOwnProp.call(to, key) && key !== except)
44
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
45
+ }
46
+ return to;
47
+ };
48
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
49
+
50
+ // src/index.ts
51
+ var index_exports = {};
52
+ __export(index_exports, {
53
+ AlertDialog: () => AlertDialog,
54
+ AlertDialogAction: () => AlertDialogAction,
55
+ AlertDialogCancel: () => AlertDialogCancel,
56
+ AlertDialogContent: () => AlertDialogContent,
57
+ AlertDialogDescription: () => AlertDialogDescription,
58
+ AlertDialogFooter: () => AlertDialogFooter,
59
+ AlertDialogHeader: () => AlertDialogHeader,
60
+ AlertDialogTitle: () => AlertDialogTitle,
61
+ AlertDialogTrigger: () => AlertDialogTrigger
62
+ });
63
+ module.exports = __toCommonJS(index_exports);
64
+
65
+ // src/alert-dialog.tsx
66
+ var import_react = require("react");
67
+ var import_utils = require("@glob-ui/utils");
68
+ var import_button = require("@glob-ui/button");
69
+ var import_dialog = require("@glob-ui/dialog");
70
+ var import_jsx_runtime = require("react/jsx-runtime");
71
+ function AlertDialog(props) {
72
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.Dialog, __spreadProps(__spreadValues({}, props), { closeOnOutsideClick: false }));
73
+ }
74
+ AlertDialog.displayName = "AlertDialog";
75
+ var AlertDialogTrigger = import_dialog.DialogTrigger;
76
+ var AlertDialogHeader = import_dialog.DialogHeader;
77
+ var AlertDialogTitle = import_dialog.DialogTitle;
78
+ var AlertDialogDescription = import_dialog.DialogDescription;
79
+ var AlertDialogContent = (0, import_react.forwardRef)(
80
+ (_a, ref) => {
81
+ var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
82
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
83
+ import_dialog.DialogContentBase,
84
+ __spreadProps(__spreadValues({
85
+ ref,
86
+ role: "alertdialog",
87
+ className: (0, import_utils.cn)((0, import_dialog.dialogVariants)({ size: "sm", className }))
88
+ }, props), {
89
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "relative flex max-h-[calc(100dvh-2rem)] flex-col gap-4 overflow-y-auto p-6", children })
90
+ })
91
+ );
92
+ }
93
+ );
94
+ AlertDialogContent.displayName = "AlertDialogContent";
95
+ var AlertDialogFooter = (0, import_react.forwardRef)((_a, ref) => {
96
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
97
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogFooter, __spreadValues({ ref, className }, props));
98
+ });
99
+ AlertDialogFooter.displayName = "AlertDialogFooter";
100
+ var AlertDialogCancel = (0, import_react.forwardRef)((_a, ref) => {
101
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
102
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
103
+ import_dialog.DialogClose,
104
+ __spreadValues({
105
+ ref,
106
+ autoFocus: true,
107
+ className: (0, import_utils.cn)((0, import_button.buttonVariants)({ variant: "outline" }), className)
108
+ }, props)
109
+ );
110
+ });
111
+ AlertDialogCancel.displayName = "AlertDialogCancel";
112
+ var AlertDialogAction = (0, import_react.forwardRef)(
113
+ (_a, ref) => {
114
+ var _b = _a, { className, variant = "primary" } = _b, props = __objRest(_b, ["className", "variant"]);
115
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
116
+ import_dialog.DialogClose,
117
+ __spreadValues({
118
+ ref,
119
+ className: (0, import_utils.cn)((0, import_button.buttonVariants)({ variant }), className)
120
+ }, props)
121
+ );
122
+ }
123
+ );
124
+ AlertDialogAction.displayName = "AlertDialogAction";
125
+ // Annotate the CommonJS export names for ESM import in node:
126
+ 0 && (module.exports = {
127
+ AlertDialog,
128
+ AlertDialogAction,
129
+ AlertDialogCancel,
130
+ AlertDialogContent,
131
+ AlertDialogDescription,
132
+ AlertDialogFooter,
133
+ AlertDialogHeader,
134
+ AlertDialogTitle,
135
+ AlertDialogTrigger
136
+ });
137
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/alert-dialog.tsx"],"sourcesContent":["export {\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogContent,\n AlertDialogHeader,\n AlertDialogTitle,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogCancel,\n AlertDialogAction,\n} from \"./alert-dialog\"\nexport type {\n AlertDialogProps,\n AlertDialogTriggerProps,\n AlertDialogContentProps,\n AlertDialogHeaderProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n AlertDialogFooterProps,\n AlertDialogCancelProps,\n AlertDialogActionProps,\n} from \"./alert-dialog\"\n","\"use client\"\n\nimport { forwardRef } from \"react\"\nimport { cn } from \"@glob-ui/utils\"\nimport { buttonVariants } from \"@glob-ui/button\"\nimport {\n Dialog,\n DialogTrigger,\n DialogClose,\n DialogHeader,\n DialogTitle,\n DialogDescription,\n DialogFooter,\n DialogContentBase,\n dialogVariants,\n type DialogContentBaseProps,\n type DialogProps,\n type DialogCloseProps,\n type DialogFooterProps,\n} from \"@glob-ui/dialog\"\n\nexport type AlertDialogProps = Omit<DialogProps, \"closeOnOutsideClick\">\n\n/**\n * A Dialog for a decision the user must make. The backdrop does not close it, so the user answers\n * with Cancel or the action (Escape still closes it, as the WAI-ARIA alertdialog pattern allows).\n */\nfunction AlertDialog(props: AlertDialogProps) {\n return <Dialog {...props} closeOnOutsideClick={false} />\n}\nAlertDialog.displayName = \"AlertDialog\"\n\nexport const AlertDialogTrigger = DialogTrigger\nexport const AlertDialogHeader = DialogHeader\nexport const AlertDialogTitle = DialogTitle\nexport const AlertDialogDescription = DialogDescription\n\nexport type AlertDialogTriggerProps = React.ComponentProps<typeof DialogTrigger>\nexport type AlertDialogHeaderProps = React.ComponentProps<typeof DialogHeader>\nexport type AlertDialogTitleProps = React.ComponentProps<typeof DialogTitle>\nexport type AlertDialogDescriptionProps = React.ComponentProps<typeof DialogDescription>\nexport type AlertDialogFooterProps = DialogFooterProps\n\nexport type AlertDialogContentProps = DialogContentBaseProps\n\nconst AlertDialogContent = forwardRef<HTMLDialogElement, AlertDialogContentProps>(\n ({ className, children, ...props }, ref) => (\n <DialogContentBase\n ref={ref}\n role=\"alertdialog\"\n className={cn(dialogVariants({ size: \"sm\", className }))}\n {...props}\n >\n <div className=\"relative flex max-h-[calc(100dvh-2rem)] flex-col gap-4 overflow-y-auto p-6\">{children}</div>\n </DialogContentBase>\n )\n)\nAlertDialogContent.displayName = \"AlertDialogContent\"\n\nconst AlertDialogFooter = forwardRef<HTMLDivElement, AlertDialogFooterProps>(({ className, ...props }, ref) => (\n <DialogFooter ref={ref} className={className} {...props} />\n))\nAlertDialogFooter.displayName = \"AlertDialogFooter\"\n\nexport type AlertDialogCancelProps = DialogCloseProps\n\n/** The safe option. It takes the initial focus. */\nconst AlertDialogCancel = forwardRef<HTMLButtonElement, AlertDialogCancelProps>(({ className, ...props }, ref) => (\n <DialogClose\n ref={ref}\n autoFocus\n className={cn(buttonVariants({ variant: \"outline\" }), className)}\n {...props}\n />\n))\nAlertDialogCancel.displayName = \"AlertDialogCancel\"\n\nexport interface AlertDialogActionProps extends DialogCloseProps {\n /** `danger` for destructive actions (delete, remove, revoke). */\n variant?: \"primary\" | \"danger\"\n}\n\n/**\n * Confirms the decision and closes the dialog. Call `event.preventDefault()` in `onClick` to keep it\n * open, for example while an async action runs.\n */\nconst AlertDialogAction = forwardRef<HTMLButtonElement, AlertDialogActionProps>(\n ({ className, variant = \"primary\", ...props }, ref) => (\n <DialogClose\n ref={ref}\n className={cn(buttonVariants({ variant }), className)}\n {...props}\n />\n )\n)\nAlertDialogAction.displayName = \"AlertDialogAction\"\n\nexport { AlertDialog, AlertDialogContent, AlertDialogFooter, AlertDialogCancel, AlertDialogAction }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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iBAAE,aAAW,UAAU,UAvF1B,IAuFG,IAAqC,kBAArC,IAAqC,CAAnC,aAAW;AACZ;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,eAAW,qBAAG,8BAAe,EAAE,QAAQ,CAAC,GAAG,SAAS;AAAA,SAChD;AAAA,IACN;AAAA;AAEJ;AACA,kBAAkB,cAAc;","names":[]}
package/dist/index.mjs ADDED
@@ -0,0 +1,115 @@
1
+ "use client"
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
+ var __objRest = (source, exclude) => {
22
+ var target = {};
23
+ for (var prop in source)
24
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
+ target[prop] = source[prop];
26
+ if (source != null && __getOwnPropSymbols)
27
+ for (var prop of __getOwnPropSymbols(source)) {
28
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
+ target[prop] = source[prop];
30
+ }
31
+ return target;
32
+ };
33
+
34
+ // src/alert-dialog.tsx
35
+ import { forwardRef } from "react";
36
+ import { cn } from "@glob-ui/utils";
37
+ import { buttonVariants } from "@glob-ui/button";
38
+ import {
39
+ Dialog,
40
+ DialogTrigger,
41
+ DialogClose,
42
+ DialogHeader,
43
+ DialogTitle,
44
+ DialogDescription,
45
+ DialogFooter,
46
+ DialogContentBase,
47
+ dialogVariants
48
+ } from "@glob-ui/dialog";
49
+ import { jsx } from "react/jsx-runtime";
50
+ function AlertDialog(props) {
51
+ return /* @__PURE__ */ jsx(Dialog, __spreadProps(__spreadValues({}, props), { closeOnOutsideClick: false }));
52
+ }
53
+ AlertDialog.displayName = "AlertDialog";
54
+ var AlertDialogTrigger = DialogTrigger;
55
+ var AlertDialogHeader = DialogHeader;
56
+ var AlertDialogTitle = DialogTitle;
57
+ var AlertDialogDescription = DialogDescription;
58
+ var AlertDialogContent = forwardRef(
59
+ (_a, ref) => {
60
+ var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
61
+ return /* @__PURE__ */ jsx(
62
+ DialogContentBase,
63
+ __spreadProps(__spreadValues({
64
+ ref,
65
+ role: "alertdialog",
66
+ className: cn(dialogVariants({ size: "sm", className }))
67
+ }, props), {
68
+ children: /* @__PURE__ */ jsx("div", { className: "relative flex max-h-[calc(100dvh-2rem)] flex-col gap-4 overflow-y-auto p-6", children })
69
+ })
70
+ );
71
+ }
72
+ );
73
+ AlertDialogContent.displayName = "AlertDialogContent";
74
+ var AlertDialogFooter = forwardRef((_a, ref) => {
75
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
76
+ return /* @__PURE__ */ jsx(DialogFooter, __spreadValues({ ref, className }, props));
77
+ });
78
+ AlertDialogFooter.displayName = "AlertDialogFooter";
79
+ var AlertDialogCancel = forwardRef((_a, ref) => {
80
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
81
+ return /* @__PURE__ */ jsx(
82
+ DialogClose,
83
+ __spreadValues({
84
+ ref,
85
+ autoFocus: true,
86
+ className: cn(buttonVariants({ variant: "outline" }), className)
87
+ }, props)
88
+ );
89
+ });
90
+ AlertDialogCancel.displayName = "AlertDialogCancel";
91
+ var AlertDialogAction = forwardRef(
92
+ (_a, ref) => {
93
+ var _b = _a, { className, variant = "primary" } = _b, props = __objRest(_b, ["className", "variant"]);
94
+ return /* @__PURE__ */ jsx(
95
+ DialogClose,
96
+ __spreadValues({
97
+ ref,
98
+ className: cn(buttonVariants({ variant }), className)
99
+ }, props)
100
+ );
101
+ }
102
+ );
103
+ AlertDialogAction.displayName = "AlertDialogAction";
104
+ export {
105
+ AlertDialog,
106
+ AlertDialogAction,
107
+ AlertDialogCancel,
108
+ AlertDialogContent,
109
+ AlertDialogDescription,
110
+ AlertDialogFooter,
111
+ AlertDialogHeader,
112
+ AlertDialogTitle,
113
+ AlertDialogTrigger
114
+ };
115
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/alert-dialog.tsx"],"sourcesContent":["\"use client\"\n\nimport { forwardRef } from \"react\"\nimport { cn } from \"@glob-ui/utils\"\nimport { buttonVariants } from \"@glob-ui/button\"\nimport {\n Dialog,\n DialogTrigger,\n DialogClose,\n DialogHeader,\n DialogTitle,\n DialogDescription,\n DialogFooter,\n DialogContentBase,\n dialogVariants,\n type DialogContentBaseProps,\n type DialogProps,\n type DialogCloseProps,\n type DialogFooterProps,\n} from \"@glob-ui/dialog\"\n\nexport type AlertDialogProps = Omit<DialogProps, \"closeOnOutsideClick\">\n\n/**\n * A Dialog for a decision the user must make. The backdrop does not close it, so the user answers\n * with Cancel or the action (Escape still closes it, as the WAI-ARIA alertdialog pattern allows).\n */\nfunction AlertDialog(props: AlertDialogProps) {\n return <Dialog {...props} closeOnOutsideClick={false} />\n}\nAlertDialog.displayName = \"AlertDialog\"\n\nexport const AlertDialogTrigger = DialogTrigger\nexport const AlertDialogHeader = DialogHeader\nexport const AlertDialogTitle = DialogTitle\nexport const AlertDialogDescription = DialogDescription\n\nexport type AlertDialogTriggerProps = React.ComponentProps<typeof DialogTrigger>\nexport type AlertDialogHeaderProps = React.ComponentProps<typeof DialogHeader>\nexport type AlertDialogTitleProps = React.ComponentProps<typeof DialogTitle>\nexport type AlertDialogDescriptionProps = React.ComponentProps<typeof DialogDescription>\nexport type AlertDialogFooterProps = DialogFooterProps\n\nexport type AlertDialogContentProps = DialogContentBaseProps\n\nconst AlertDialogContent = forwardRef<HTMLDialogElement, AlertDialogContentProps>(\n ({ className, children, ...props }, ref) => (\n <DialogContentBase\n ref={ref}\n role=\"alertdialog\"\n className={cn(dialogVariants({ size: \"sm\", className }))}\n {...props}\n >\n <div className=\"relative flex max-h-[calc(100dvh-2rem)] flex-col gap-4 overflow-y-auto p-6\">{children}</div>\n </DialogContentBase>\n )\n)\nAlertDialogContent.displayName = \"AlertDialogContent\"\n\nconst AlertDialogFooter = forwardRef<HTMLDivElement, AlertDialogFooterProps>(({ className, ...props }, ref) => (\n <DialogFooter ref={ref} className={className} {...props} />\n))\nAlertDialogFooter.displayName = \"AlertDialogFooter\"\n\nexport type AlertDialogCancelProps = DialogCloseProps\n\n/** The safe option. It takes the initial focus. */\nconst AlertDialogCancel = forwardRef<HTMLButtonElement, AlertDialogCancelProps>(({ className, ...props }, ref) => (\n <DialogClose\n ref={ref}\n autoFocus\n className={cn(buttonVariants({ variant: \"outline\" }), className)}\n {...props}\n />\n))\nAlertDialogCancel.displayName = \"AlertDialogCancel\"\n\nexport interface AlertDialogActionProps extends DialogCloseProps {\n /** `danger` for destructive actions (delete, remove, revoke). */\n variant?: \"primary\" | \"danger\"\n}\n\n/**\n * Confirms the decision and closes the dialog. Call `event.preventDefault()` in `onClick` to keep it\n * open, for example while an async action runs.\n */\nconst AlertDialogAction = forwardRef<HTMLButtonElement, AlertDialogActionProps>(\n ({ className, variant = \"primary\", ...props }, ref) => (\n <DialogClose\n ref={ref}\n className={cn(buttonVariants({ variant }), className)}\n {...props}\n />\n )\n)\nAlertDialogAction.displayName = \"AlertDialogAction\"\n\nexport { AlertDialog, AlertDialogContent, AlertDialogFooter, AlertDialogCancel, AlertDialogAction }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;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,CAAC,IAA8C,QAAK;AAAnD,iBAAE,aAAW,UAAU,UAvF1B,IAuFG,IAAqC,kBAArC,IAAqC,CAAnC,aAAW;AACZ;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,eAAe,EAAE,QAAQ,CAAC,GAAG,SAAS;AAAA,SAChD;AAAA,IACN;AAAA;AAEJ;AACA,kBAAkB,cAAc;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,70 @@
1
1
  {
2
2
  "name": "@glob-ui/alert-dialog",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "main": "./dist/index.js",
5
+ "module": "./dist/index.mjs",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": {
10
+ "types": "./dist/index.d.mts",
11
+ "default": "./dist/index.mjs"
12
+ },
13
+ "require": {
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.js"
16
+ }
17
+ },
18
+ "./package.json": "./package.json"
19
+ },
20
+ "files": [
21
+ "dist/",
22
+ "LICENSE",
23
+ "README.md"
24
+ ],
25
+ "peerDependencies": {
26
+ "react": "^19"
27
+ },
28
+ "dependencies": {
29
+ "@glob-ui/button": "0.2.0",
30
+ "@glob-ui/dialog": "0.2.0",
31
+ "@glob-ui/utils": "0.2.0",
32
+ "class-variance-authority": "^0.7.1"
33
+ },
34
+ "devDependencies": {
35
+ "tsup": "^8.5.1"
36
+ },
37
+ "description": "A modal that asks the user to confirm a decision. The backdrop does not close it; the user answers with Cancel or the action.",
38
+ "keywords": [
39
+ "react",
40
+ "glob-ui",
41
+ "components",
42
+ "accessible",
43
+ "tailwind",
44
+ "alert-dialog"
45
+ ],
46
+ "license": "MIT",
47
+ "author": "Kevin Martínez E",
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/kevin-martineze/GlobUI.git",
51
+ "directory": "packages/alert-dialog"
52
+ },
53
+ "homepage": "https://github.com/kevin-martineze/GlobUI#readme",
54
+ "bugs": {
55
+ "url": "https://github.com/kevin-martineze/GlobUI/issues"
56
+ },
57
+ "publishConfig": {
58
+ "access": "public",
59
+ "provenance": true
60
+ },
61
+ "sideEffects": false,
62
+ "type": "commonjs",
63
+ "engines": {
64
+ "node": ">=18.18"
65
+ },
66
+ "scripts": {
67
+ "build": "tsup",
68
+ "dev": "tsup --watch --no-clean"
69
+ }
6
70
  }