@radix-solid-js/alert-dialog 0.1.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/dist/index.cjs +165 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +84 -0
- package/dist/index.d.ts +84 -0
- package/dist/index.js +126 -0
- package/dist/index.js.map +1 -0
- package/package.json +57 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var solidJs = require('solid-js');
|
|
4
|
+
var context = require('@radix-solid-js/context');
|
|
5
|
+
var composeRefs = require('@radix-solid-js/compose-refs');
|
|
6
|
+
var primitive = require('@radix-solid-js/primitive');
|
|
7
|
+
var DialogPrimitive = require('@radix-solid-js/dialog');
|
|
8
|
+
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n.default = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive);
|
|
28
|
+
|
|
29
|
+
// src/alert-dialog.tsx
|
|
30
|
+
var ROOT_NAME = "AlertDialog";
|
|
31
|
+
var [createAlertDialogContext, createAlertDialogScope] = context.createContextScope(ROOT_NAME, [
|
|
32
|
+
DialogPrimitive.createDialogScope
|
|
33
|
+
]);
|
|
34
|
+
var useDialogScope = DialogPrimitive.createDialogScope();
|
|
35
|
+
function AlertDialog(props) {
|
|
36
|
+
const [local, rest] = solidJs.splitProps(props, ["__scopeAlertDialog"]);
|
|
37
|
+
const dialogScope = useDialogScope(local.__scopeAlertDialog);
|
|
38
|
+
return /* @__PURE__ */ React.createElement(DialogPrimitive__namespace.Dialog, { ...dialogScope, ...rest, modal: true });
|
|
39
|
+
}
|
|
40
|
+
AlertDialog.displayName = ROOT_NAME;
|
|
41
|
+
var TRIGGER_NAME = "AlertDialogTrigger";
|
|
42
|
+
function AlertDialogTrigger(inProps) {
|
|
43
|
+
const [local, rest] = solidJs.splitProps(inProps, ["__scopeAlertDialog", "ref"]);
|
|
44
|
+
const dialogScope = useDialogScope(local.__scopeAlertDialog);
|
|
45
|
+
return /* @__PURE__ */ React.createElement(DialogPrimitive__namespace.DialogTrigger, { ...dialogScope, ...rest, ref: local.ref });
|
|
46
|
+
}
|
|
47
|
+
AlertDialogTrigger.displayName = TRIGGER_NAME;
|
|
48
|
+
var PORTAL_NAME = "AlertDialogPortal";
|
|
49
|
+
function AlertDialogPortal(props) {
|
|
50
|
+
const [local, rest] = solidJs.splitProps(props, ["__scopeAlertDialog"]);
|
|
51
|
+
const dialogScope = useDialogScope(local.__scopeAlertDialog);
|
|
52
|
+
return /* @__PURE__ */ React.createElement(DialogPrimitive__namespace.DialogPortal, { ...dialogScope, ...rest });
|
|
53
|
+
}
|
|
54
|
+
AlertDialogPortal.displayName = PORTAL_NAME;
|
|
55
|
+
var OVERLAY_NAME = "AlertDialogOverlay";
|
|
56
|
+
function AlertDialogOverlay(inProps) {
|
|
57
|
+
const [local, rest] = solidJs.splitProps(inProps, ["__scopeAlertDialog", "ref"]);
|
|
58
|
+
const dialogScope = useDialogScope(local.__scopeAlertDialog);
|
|
59
|
+
return /* @__PURE__ */ React.createElement(DialogPrimitive__namespace.DialogOverlay, { ...dialogScope, ...rest, ref: local.ref });
|
|
60
|
+
}
|
|
61
|
+
AlertDialogOverlay.displayName = OVERLAY_NAME;
|
|
62
|
+
var CONTENT_NAME = "AlertDialogContent";
|
|
63
|
+
var [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME);
|
|
64
|
+
function AlertDialogContent(inProps) {
|
|
65
|
+
const [local, rest] = solidJs.splitProps(inProps, [
|
|
66
|
+
"__scopeAlertDialog",
|
|
67
|
+
"ref",
|
|
68
|
+
"children",
|
|
69
|
+
"onOpenAutoFocus"
|
|
70
|
+
]);
|
|
71
|
+
const dialogScope = useDialogScope(local.__scopeAlertDialog);
|
|
72
|
+
const [cancelRef, setCancelRef] = solidJs.createSignal(null);
|
|
73
|
+
return /* @__PURE__ */ React.createElement(
|
|
74
|
+
AlertDialogContentProvider,
|
|
75
|
+
{
|
|
76
|
+
scope: local.__scopeAlertDialog,
|
|
77
|
+
cancelRef: cancelRef(),
|
|
78
|
+
onCancelRefChange: setCancelRef
|
|
79
|
+
},
|
|
80
|
+
/* @__PURE__ */ React.createElement(
|
|
81
|
+
DialogPrimitive__namespace.DialogContent,
|
|
82
|
+
{
|
|
83
|
+
role: "alertdialog",
|
|
84
|
+
...dialogScope,
|
|
85
|
+
...rest,
|
|
86
|
+
ref: local.ref,
|
|
87
|
+
onOpenAutoFocus: primitive.composeEventHandlers(local.onOpenAutoFocus, (event) => {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
cancelRef()?.focus({ preventScroll: true });
|
|
90
|
+
}),
|
|
91
|
+
onPointerDownOutside: (event) => event.preventDefault(),
|
|
92
|
+
onInteractOutside: (event) => event.preventDefault()
|
|
93
|
+
},
|
|
94
|
+
local.children
|
|
95
|
+
)
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
AlertDialogContent.displayName = CONTENT_NAME;
|
|
99
|
+
var TITLE_NAME = "AlertDialogTitle";
|
|
100
|
+
function AlertDialogTitle(inProps) {
|
|
101
|
+
const [local, rest] = solidJs.splitProps(inProps, ["__scopeAlertDialog", "ref"]);
|
|
102
|
+
const dialogScope = useDialogScope(local.__scopeAlertDialog);
|
|
103
|
+
return /* @__PURE__ */ React.createElement(DialogPrimitive__namespace.DialogTitle, { ...dialogScope, ...rest, ref: local.ref });
|
|
104
|
+
}
|
|
105
|
+
AlertDialogTitle.displayName = TITLE_NAME;
|
|
106
|
+
var DESCRIPTION_NAME = "AlertDialogDescription";
|
|
107
|
+
function AlertDialogDescription(inProps) {
|
|
108
|
+
const [local, rest] = solidJs.splitProps(inProps, ["__scopeAlertDialog", "ref"]);
|
|
109
|
+
const dialogScope = useDialogScope(local.__scopeAlertDialog);
|
|
110
|
+
return /* @__PURE__ */ React.createElement(DialogPrimitive__namespace.DialogDescription, { ...dialogScope, ...rest, ref: local.ref });
|
|
111
|
+
}
|
|
112
|
+
AlertDialogDescription.displayName = DESCRIPTION_NAME;
|
|
113
|
+
var ACTION_NAME = "AlertDialogAction";
|
|
114
|
+
function AlertDialogAction(inProps) {
|
|
115
|
+
const [local, rest] = solidJs.splitProps(inProps, ["__scopeAlertDialog", "ref"]);
|
|
116
|
+
const dialogScope = useDialogScope(local.__scopeAlertDialog);
|
|
117
|
+
return /* @__PURE__ */ React.createElement(DialogPrimitive__namespace.DialogClose, { ...dialogScope, ...rest, ref: local.ref });
|
|
118
|
+
}
|
|
119
|
+
AlertDialogAction.displayName = ACTION_NAME;
|
|
120
|
+
var CANCEL_NAME = "AlertDialogCancel";
|
|
121
|
+
function AlertDialogCancel(inProps) {
|
|
122
|
+
const [local, rest] = solidJs.splitProps(inProps, ["__scopeAlertDialog", "ref"]);
|
|
123
|
+
const { onCancelRefChange } = useAlertDialogContentContext(CANCEL_NAME, local.__scopeAlertDialog);
|
|
124
|
+
const dialogScope = useDialogScope(local.__scopeAlertDialog);
|
|
125
|
+
return /* @__PURE__ */ React.createElement(
|
|
126
|
+
DialogPrimitive__namespace.DialogClose,
|
|
127
|
+
{
|
|
128
|
+
...dialogScope,
|
|
129
|
+
...rest,
|
|
130
|
+
ref: composeRefs.mergeRefs(local.ref, (el) => onCancelRefChange(el))
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
AlertDialogCancel.displayName = CANCEL_NAME;
|
|
135
|
+
var Root = AlertDialog;
|
|
136
|
+
var Trigger = AlertDialogTrigger;
|
|
137
|
+
var Portal = AlertDialogPortal;
|
|
138
|
+
var Overlay = AlertDialogOverlay;
|
|
139
|
+
var Content = AlertDialogContent;
|
|
140
|
+
var Action = AlertDialogAction;
|
|
141
|
+
var Cancel = AlertDialogCancel;
|
|
142
|
+
var Title = AlertDialogTitle;
|
|
143
|
+
var Description = AlertDialogDescription;
|
|
144
|
+
|
|
145
|
+
exports.Action = Action;
|
|
146
|
+
exports.AlertDialog = AlertDialog;
|
|
147
|
+
exports.AlertDialogAction = AlertDialogAction;
|
|
148
|
+
exports.AlertDialogCancel = AlertDialogCancel;
|
|
149
|
+
exports.AlertDialogContent = AlertDialogContent;
|
|
150
|
+
exports.AlertDialogDescription = AlertDialogDescription;
|
|
151
|
+
exports.AlertDialogOverlay = AlertDialogOverlay;
|
|
152
|
+
exports.AlertDialogPortal = AlertDialogPortal;
|
|
153
|
+
exports.AlertDialogTitle = AlertDialogTitle;
|
|
154
|
+
exports.AlertDialogTrigger = AlertDialogTrigger;
|
|
155
|
+
exports.Cancel = Cancel;
|
|
156
|
+
exports.Content = Content;
|
|
157
|
+
exports.Description = Description;
|
|
158
|
+
exports.Overlay = Overlay;
|
|
159
|
+
exports.Portal = Portal;
|
|
160
|
+
exports.Root = Root;
|
|
161
|
+
exports.Title = Title;
|
|
162
|
+
exports.Trigger = Trigger;
|
|
163
|
+
exports.createAlertDialogScope = createAlertDialogScope;
|
|
164
|
+
//# sourceMappingURL=index.cjs.map
|
|
165
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/alert-dialog.tsx"],"names":["createContextScope","createDialogScope","splitProps","DialogPrimitive","createSignal","composeEventHandlers","mergeRefs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;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AAM,OAAA,GAAU;AAChB,IAAM,MAAA,GAAS;AACf,IAAM,OAAA,GAAU;AAChB,IAAM,OAAA,GAAU;AAChB,IAAM,MAAA,GAAS;AACf,IAAM,MAAA,GAAS;AACf,IAAM,KAAA,GAAQ;AACd,IAAM,WAAA,GAAc","file":"index.cjs","sourcesContent":["import { type JSX, splitProps, createSignal } from 'solid-js';\nimport { createContextScope, type Scope } from '@radix-solid-js/context';\nimport { mergeRefs } from '@radix-solid-js/compose-refs';\nimport { composeEventHandlers } from '@radix-solid-js/primitive';\nimport * as DialogPrimitive from '@radix-solid-js/dialog';\nimport { createDialogScope } from '@radix-solid-js/dialog';\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst ROOT_NAME = 'AlertDialog';\n\ntype ScopedProps<P> = P & { __scopeAlertDialog?: Scope };\nconst [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [\n createDialogScope,\n]);\nconst useDialogScope = createDialogScope();\n\ntype DialogProps = DialogPrimitive.DialogProps;\ninterface AlertDialogProps extends Omit<DialogProps, 'modal'> {}\n\nfunction AlertDialog(props: ScopedProps<AlertDialogProps>) {\n const [local, rest] = splitProps(props, ['__scopeAlertDialog']);\n const dialogScope = useDialogScope(local.__scopeAlertDialog);\n return <DialogPrimitive.Dialog {...dialogScope} {...rest} modal={true} />;\n}\n\nAlertDialog.displayName = ROOT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'AlertDialogTrigger';\n\ninterface AlertDialogTriggerProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {\n ref?: (el: HTMLElement) => void;\n}\n\nfunction AlertDialogTrigger(inProps: ScopedProps<AlertDialogTriggerProps>) {\n const [local, rest] = splitProps(inProps, ['__scopeAlertDialog', 'ref']);\n const dialogScope = useDialogScope(local.__scopeAlertDialog);\n return <DialogPrimitive.DialogTrigger {...dialogScope} {...rest} ref={local.ref} />;\n}\n\nAlertDialogTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'AlertDialogPortal';\n\ninterface AlertDialogPortalProps extends DialogPrimitive.DialogPortalProps {}\n\nfunction AlertDialogPortal(props: ScopedProps<AlertDialogPortalProps>) {\n const [local, rest] = splitProps(props, ['__scopeAlertDialog']);\n const dialogScope = useDialogScope(local.__scopeAlertDialog);\n return <DialogPrimitive.DialogPortal {...dialogScope} {...rest} />;\n}\n\nAlertDialogPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'AlertDialogOverlay';\n\ninterface AlertDialogOverlayProps extends JSX.HTMLAttributes<HTMLDivElement> {\n forceMount?: true;\n ref?: (el: HTMLElement) => void;\n}\n\nfunction AlertDialogOverlay(inProps: ScopedProps<AlertDialogOverlayProps>) {\n const [local, rest] = splitProps(inProps, ['__scopeAlertDialog', 'ref']);\n const dialogScope = useDialogScope(local.__scopeAlertDialog);\n return <DialogPrimitive.DialogOverlay {...dialogScope} {...rest} ref={local.ref} />;\n}\n\nAlertDialogOverlay.displayName = OVERLAY_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AlertDialogContent';\n\ntype AlertDialogContentContextValue = {\n cancelRef: HTMLButtonElement | null;\n onCancelRefChange: (el: HTMLButtonElement | null) => void;\n};\n\nconst [AlertDialogContentProvider, useAlertDialogContentContext] =\n createAlertDialogContext<AlertDialogContentContextValue>(CONTENT_NAME);\n\ntype DialogContentProps = DialogPrimitive.DialogContentProps;\ninterface AlertDialogContentProps\n extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {\n ref?: (el: HTMLElement) => void;\n}\n\nfunction AlertDialogContent(inProps: ScopedProps<AlertDialogContentProps>) {\n const [local, rest] = splitProps(inProps, [\n '__scopeAlertDialog',\n 'ref',\n 'children',\n 'onOpenAutoFocus',\n ]);\n const dialogScope = useDialogScope(local.__scopeAlertDialog);\n const [cancelRef, setCancelRef] = createSignal<HTMLButtonElement | null>(null);\n\n return (\n <AlertDialogContentProvider\n scope={local.__scopeAlertDialog}\n cancelRef={cancelRef()}\n onCancelRefChange={setCancelRef}\n >\n <DialogPrimitive.DialogContent\n role=\"alertdialog\"\n {...dialogScope}\n {...rest}\n ref={local.ref}\n onOpenAutoFocus={composeEventHandlers(local.onOpenAutoFocus, (event: Event) => {\n event.preventDefault();\n cancelRef()?.focus({ preventScroll: true });\n })}\n onPointerDownOutside={(event: any) => event.preventDefault()}\n onInteractOutside={(event: any) => event.preventDefault()}\n >\n {local.children}\n </DialogPrimitive.DialogContent>\n </AlertDialogContentProvider>\n );\n}\n\nAlertDialogContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'AlertDialogTitle';\n\ninterface AlertDialogTitleProps extends JSX.HTMLAttributes<HTMLHeadingElement> {\n ref?: (el: HTMLElement) => void;\n}\n\nfunction AlertDialogTitle(inProps: ScopedProps<AlertDialogTitleProps>) {\n const [local, rest] = splitProps(inProps, ['__scopeAlertDialog', 'ref']);\n const dialogScope = useDialogScope(local.__scopeAlertDialog);\n return <DialogPrimitive.DialogTitle {...dialogScope} {...rest} ref={local.ref} />;\n}\n\nAlertDialogTitle.displayName = TITLE_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'AlertDialogDescription';\n\ninterface AlertDialogDescriptionProps extends JSX.HTMLAttributes<HTMLParagraphElement> {\n ref?: (el: HTMLElement) => void;\n}\n\nfunction AlertDialogDescription(inProps: ScopedProps<AlertDialogDescriptionProps>) {\n const [local, rest] = splitProps(inProps, ['__scopeAlertDialog', 'ref']);\n const dialogScope = useDialogScope(local.__scopeAlertDialog);\n return <DialogPrimitive.DialogDescription {...dialogScope} {...rest} ref={local.ref} />;\n}\n\nAlertDialogDescription.displayName = DESCRIPTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACTION_NAME = 'AlertDialogAction';\n\ninterface AlertDialogActionProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {\n ref?: (el: HTMLElement) => void;\n}\n\nfunction AlertDialogAction(inProps: ScopedProps<AlertDialogActionProps>) {\n const [local, rest] = splitProps(inProps, ['__scopeAlertDialog', 'ref']);\n const dialogScope = useDialogScope(local.__scopeAlertDialog);\n return <DialogPrimitive.DialogClose {...dialogScope} {...rest} ref={local.ref} />;\n}\n\nAlertDialogAction.displayName = ACTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogCancel\n * -----------------------------------------------------------------------------------------------*/\n\nconst CANCEL_NAME = 'AlertDialogCancel';\n\ninterface AlertDialogCancelProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {\n ref?: (el: HTMLElement) => void;\n}\n\nfunction AlertDialogCancel(inProps: ScopedProps<AlertDialogCancelProps>) {\n const [local, rest] = splitProps(inProps, ['__scopeAlertDialog', 'ref']);\n const { onCancelRefChange } = useAlertDialogContentContext(CANCEL_NAME, local.__scopeAlertDialog);\n const dialogScope = useDialogScope(local.__scopeAlertDialog);\n return (\n <DialogPrimitive.DialogClose\n {...dialogScope}\n {...rest}\n ref={mergeRefs(local.ref, (el: HTMLElement) => onCancelRefChange(el as HTMLButtonElement))}\n />\n );\n}\n\nAlertDialogCancel.displayName = CANCEL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * Exports\n * -----------------------------------------------------------------------------------------------*/\n\nconst Root = AlertDialog;\nconst Trigger = AlertDialogTrigger;\nconst Portal = AlertDialogPortal;\nconst Overlay = AlertDialogOverlay;\nconst Content = AlertDialogContent;\nconst Action = AlertDialogAction;\nconst Cancel = AlertDialogCancel;\nconst Title = AlertDialogTitle;\nconst Description = AlertDialogDescription;\n\nexport {\n createAlertDialogScope,\n //\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogTitle,\n AlertDialogDescription,\n //\n Root,\n Trigger,\n Portal,\n Overlay,\n Content,\n Action,\n Cancel,\n Title,\n Description,\n};\nexport type {\n AlertDialogProps,\n AlertDialogTriggerProps,\n AlertDialogPortalProps,\n AlertDialogOverlayProps,\n AlertDialogContentProps,\n AlertDialogActionProps,\n AlertDialogCancelProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n};\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import * as _radix_solid_js_context from '@radix-solid-js/context';
|
|
2
|
+
import { Scope } from '@radix-solid-js/context';
|
|
3
|
+
import { JSX } from 'solid-js';
|
|
4
|
+
import * as DialogPrimitive from '@radix-solid-js/dialog';
|
|
5
|
+
|
|
6
|
+
type ScopedProps<P> = P & {
|
|
7
|
+
__scopeAlertDialog?: Scope;
|
|
8
|
+
};
|
|
9
|
+
declare const createAlertDialogScope: _radix_solid_js_context.CreateScope;
|
|
10
|
+
type DialogProps = DialogPrimitive.DialogProps;
|
|
11
|
+
interface AlertDialogProps extends Omit<DialogProps, 'modal'> {
|
|
12
|
+
}
|
|
13
|
+
declare function AlertDialog(props: ScopedProps<AlertDialogProps>): JSX.Element;
|
|
14
|
+
declare namespace AlertDialog {
|
|
15
|
+
var displayName: string;
|
|
16
|
+
}
|
|
17
|
+
interface AlertDialogTriggerProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
18
|
+
ref?: (el: HTMLElement) => void;
|
|
19
|
+
}
|
|
20
|
+
declare function AlertDialogTrigger(inProps: ScopedProps<AlertDialogTriggerProps>): JSX.Element;
|
|
21
|
+
declare namespace AlertDialogTrigger {
|
|
22
|
+
var displayName: string;
|
|
23
|
+
}
|
|
24
|
+
interface AlertDialogPortalProps extends DialogPrimitive.DialogPortalProps {
|
|
25
|
+
}
|
|
26
|
+
declare function AlertDialogPortal(props: ScopedProps<AlertDialogPortalProps>): JSX.Element;
|
|
27
|
+
declare namespace AlertDialogPortal {
|
|
28
|
+
var displayName: string;
|
|
29
|
+
}
|
|
30
|
+
interface AlertDialogOverlayProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
31
|
+
forceMount?: true;
|
|
32
|
+
ref?: (el: HTMLElement) => void;
|
|
33
|
+
}
|
|
34
|
+
declare function AlertDialogOverlay(inProps: ScopedProps<AlertDialogOverlayProps>): JSX.Element;
|
|
35
|
+
declare namespace AlertDialogOverlay {
|
|
36
|
+
var displayName: string;
|
|
37
|
+
}
|
|
38
|
+
type DialogContentProps = DialogPrimitive.DialogContentProps;
|
|
39
|
+
interface AlertDialogContentProps extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {
|
|
40
|
+
ref?: (el: HTMLElement) => void;
|
|
41
|
+
}
|
|
42
|
+
declare function AlertDialogContent(inProps: ScopedProps<AlertDialogContentProps>): JSX.Element;
|
|
43
|
+
declare namespace AlertDialogContent {
|
|
44
|
+
var displayName: string;
|
|
45
|
+
}
|
|
46
|
+
interface AlertDialogTitleProps extends JSX.HTMLAttributes<HTMLHeadingElement> {
|
|
47
|
+
ref?: (el: HTMLElement) => void;
|
|
48
|
+
}
|
|
49
|
+
declare function AlertDialogTitle(inProps: ScopedProps<AlertDialogTitleProps>): JSX.Element;
|
|
50
|
+
declare namespace AlertDialogTitle {
|
|
51
|
+
var displayName: string;
|
|
52
|
+
}
|
|
53
|
+
interface AlertDialogDescriptionProps extends JSX.HTMLAttributes<HTMLParagraphElement> {
|
|
54
|
+
ref?: (el: HTMLElement) => void;
|
|
55
|
+
}
|
|
56
|
+
declare function AlertDialogDescription(inProps: ScopedProps<AlertDialogDescriptionProps>): JSX.Element;
|
|
57
|
+
declare namespace AlertDialogDescription {
|
|
58
|
+
var displayName: string;
|
|
59
|
+
}
|
|
60
|
+
interface AlertDialogActionProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
61
|
+
ref?: (el: HTMLElement) => void;
|
|
62
|
+
}
|
|
63
|
+
declare function AlertDialogAction(inProps: ScopedProps<AlertDialogActionProps>): JSX.Element;
|
|
64
|
+
declare namespace AlertDialogAction {
|
|
65
|
+
var displayName: string;
|
|
66
|
+
}
|
|
67
|
+
interface AlertDialogCancelProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
68
|
+
ref?: (el: HTMLElement) => void;
|
|
69
|
+
}
|
|
70
|
+
declare function AlertDialogCancel(inProps: ScopedProps<AlertDialogCancelProps>): JSX.Element;
|
|
71
|
+
declare namespace AlertDialogCancel {
|
|
72
|
+
var displayName: string;
|
|
73
|
+
}
|
|
74
|
+
declare const Root: typeof AlertDialog;
|
|
75
|
+
declare const Trigger: typeof AlertDialogTrigger;
|
|
76
|
+
declare const Portal: typeof AlertDialogPortal;
|
|
77
|
+
declare const Overlay: typeof AlertDialogOverlay;
|
|
78
|
+
declare const Content: typeof AlertDialogContent;
|
|
79
|
+
declare const Action: typeof AlertDialogAction;
|
|
80
|
+
declare const Cancel: typeof AlertDialogCancel;
|
|
81
|
+
declare const Title: typeof AlertDialogTitle;
|
|
82
|
+
declare const Description: typeof AlertDialogDescription;
|
|
83
|
+
|
|
84
|
+
export { Action, AlertDialog, AlertDialogAction, type AlertDialogActionProps, AlertDialogCancel, type AlertDialogCancelProps, AlertDialogContent, type AlertDialogContentProps, AlertDialogDescription, type AlertDialogDescriptionProps, AlertDialogOverlay, type AlertDialogOverlayProps, AlertDialogPortal, type AlertDialogPortalProps, type AlertDialogProps, AlertDialogTitle, type AlertDialogTitleProps, AlertDialogTrigger, type AlertDialogTriggerProps, Cancel, Content, Description, Overlay, Portal, Root, Title, Trigger, createAlertDialogScope };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import * as _radix_solid_js_context from '@radix-solid-js/context';
|
|
2
|
+
import { Scope } from '@radix-solid-js/context';
|
|
3
|
+
import { JSX } from 'solid-js';
|
|
4
|
+
import * as DialogPrimitive from '@radix-solid-js/dialog';
|
|
5
|
+
|
|
6
|
+
type ScopedProps<P> = P & {
|
|
7
|
+
__scopeAlertDialog?: Scope;
|
|
8
|
+
};
|
|
9
|
+
declare const createAlertDialogScope: _radix_solid_js_context.CreateScope;
|
|
10
|
+
type DialogProps = DialogPrimitive.DialogProps;
|
|
11
|
+
interface AlertDialogProps extends Omit<DialogProps, 'modal'> {
|
|
12
|
+
}
|
|
13
|
+
declare function AlertDialog(props: ScopedProps<AlertDialogProps>): JSX.Element;
|
|
14
|
+
declare namespace AlertDialog {
|
|
15
|
+
var displayName: string;
|
|
16
|
+
}
|
|
17
|
+
interface AlertDialogTriggerProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
18
|
+
ref?: (el: HTMLElement) => void;
|
|
19
|
+
}
|
|
20
|
+
declare function AlertDialogTrigger(inProps: ScopedProps<AlertDialogTriggerProps>): JSX.Element;
|
|
21
|
+
declare namespace AlertDialogTrigger {
|
|
22
|
+
var displayName: string;
|
|
23
|
+
}
|
|
24
|
+
interface AlertDialogPortalProps extends DialogPrimitive.DialogPortalProps {
|
|
25
|
+
}
|
|
26
|
+
declare function AlertDialogPortal(props: ScopedProps<AlertDialogPortalProps>): JSX.Element;
|
|
27
|
+
declare namespace AlertDialogPortal {
|
|
28
|
+
var displayName: string;
|
|
29
|
+
}
|
|
30
|
+
interface AlertDialogOverlayProps extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
31
|
+
forceMount?: true;
|
|
32
|
+
ref?: (el: HTMLElement) => void;
|
|
33
|
+
}
|
|
34
|
+
declare function AlertDialogOverlay(inProps: ScopedProps<AlertDialogOverlayProps>): JSX.Element;
|
|
35
|
+
declare namespace AlertDialogOverlay {
|
|
36
|
+
var displayName: string;
|
|
37
|
+
}
|
|
38
|
+
type DialogContentProps = DialogPrimitive.DialogContentProps;
|
|
39
|
+
interface AlertDialogContentProps extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {
|
|
40
|
+
ref?: (el: HTMLElement) => void;
|
|
41
|
+
}
|
|
42
|
+
declare function AlertDialogContent(inProps: ScopedProps<AlertDialogContentProps>): JSX.Element;
|
|
43
|
+
declare namespace AlertDialogContent {
|
|
44
|
+
var displayName: string;
|
|
45
|
+
}
|
|
46
|
+
interface AlertDialogTitleProps extends JSX.HTMLAttributes<HTMLHeadingElement> {
|
|
47
|
+
ref?: (el: HTMLElement) => void;
|
|
48
|
+
}
|
|
49
|
+
declare function AlertDialogTitle(inProps: ScopedProps<AlertDialogTitleProps>): JSX.Element;
|
|
50
|
+
declare namespace AlertDialogTitle {
|
|
51
|
+
var displayName: string;
|
|
52
|
+
}
|
|
53
|
+
interface AlertDialogDescriptionProps extends JSX.HTMLAttributes<HTMLParagraphElement> {
|
|
54
|
+
ref?: (el: HTMLElement) => void;
|
|
55
|
+
}
|
|
56
|
+
declare function AlertDialogDescription(inProps: ScopedProps<AlertDialogDescriptionProps>): JSX.Element;
|
|
57
|
+
declare namespace AlertDialogDescription {
|
|
58
|
+
var displayName: string;
|
|
59
|
+
}
|
|
60
|
+
interface AlertDialogActionProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
61
|
+
ref?: (el: HTMLElement) => void;
|
|
62
|
+
}
|
|
63
|
+
declare function AlertDialogAction(inProps: ScopedProps<AlertDialogActionProps>): JSX.Element;
|
|
64
|
+
declare namespace AlertDialogAction {
|
|
65
|
+
var displayName: string;
|
|
66
|
+
}
|
|
67
|
+
interface AlertDialogCancelProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
68
|
+
ref?: (el: HTMLElement) => void;
|
|
69
|
+
}
|
|
70
|
+
declare function AlertDialogCancel(inProps: ScopedProps<AlertDialogCancelProps>): JSX.Element;
|
|
71
|
+
declare namespace AlertDialogCancel {
|
|
72
|
+
var displayName: string;
|
|
73
|
+
}
|
|
74
|
+
declare const Root: typeof AlertDialog;
|
|
75
|
+
declare const Trigger: typeof AlertDialogTrigger;
|
|
76
|
+
declare const Portal: typeof AlertDialogPortal;
|
|
77
|
+
declare const Overlay: typeof AlertDialogOverlay;
|
|
78
|
+
declare const Content: typeof AlertDialogContent;
|
|
79
|
+
declare const Action: typeof AlertDialogAction;
|
|
80
|
+
declare const Cancel: typeof AlertDialogCancel;
|
|
81
|
+
declare const Title: typeof AlertDialogTitle;
|
|
82
|
+
declare const Description: typeof AlertDialogDescription;
|
|
83
|
+
|
|
84
|
+
export { Action, AlertDialog, AlertDialogAction, type AlertDialogActionProps, AlertDialogCancel, type AlertDialogCancelProps, AlertDialogContent, type AlertDialogContentProps, AlertDialogDescription, type AlertDialogDescriptionProps, AlertDialogOverlay, type AlertDialogOverlayProps, AlertDialogPortal, type AlertDialogPortalProps, type AlertDialogProps, AlertDialogTitle, type AlertDialogTitleProps, AlertDialogTrigger, type AlertDialogTriggerProps, Cancel, Content, Description, Overlay, Portal, Root, Title, Trigger, createAlertDialogScope };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { splitProps, createSignal } from 'solid-js';
|
|
2
|
+
import { createContextScope } from '@radix-solid-js/context';
|
|
3
|
+
import { mergeRefs } from '@radix-solid-js/compose-refs';
|
|
4
|
+
import { composeEventHandlers } from '@radix-solid-js/primitive';
|
|
5
|
+
import * as DialogPrimitive from '@radix-solid-js/dialog';
|
|
6
|
+
import { createDialogScope } from '@radix-solid-js/dialog';
|
|
7
|
+
|
|
8
|
+
// src/alert-dialog.tsx
|
|
9
|
+
var ROOT_NAME = "AlertDialog";
|
|
10
|
+
var [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [
|
|
11
|
+
createDialogScope
|
|
12
|
+
]);
|
|
13
|
+
var useDialogScope = createDialogScope();
|
|
14
|
+
function AlertDialog(props) {
|
|
15
|
+
const [local, rest] = splitProps(props, ["__scopeAlertDialog"]);
|
|
16
|
+
const dialogScope = useDialogScope(local.__scopeAlertDialog);
|
|
17
|
+
return /* @__PURE__ */ React.createElement(DialogPrimitive.Dialog, { ...dialogScope, ...rest, modal: true });
|
|
18
|
+
}
|
|
19
|
+
AlertDialog.displayName = ROOT_NAME;
|
|
20
|
+
var TRIGGER_NAME = "AlertDialogTrigger";
|
|
21
|
+
function AlertDialogTrigger(inProps) {
|
|
22
|
+
const [local, rest] = splitProps(inProps, ["__scopeAlertDialog", "ref"]);
|
|
23
|
+
const dialogScope = useDialogScope(local.__scopeAlertDialog);
|
|
24
|
+
return /* @__PURE__ */ React.createElement(DialogPrimitive.DialogTrigger, { ...dialogScope, ...rest, ref: local.ref });
|
|
25
|
+
}
|
|
26
|
+
AlertDialogTrigger.displayName = TRIGGER_NAME;
|
|
27
|
+
var PORTAL_NAME = "AlertDialogPortal";
|
|
28
|
+
function AlertDialogPortal(props) {
|
|
29
|
+
const [local, rest] = splitProps(props, ["__scopeAlertDialog"]);
|
|
30
|
+
const dialogScope = useDialogScope(local.__scopeAlertDialog);
|
|
31
|
+
return /* @__PURE__ */ React.createElement(DialogPrimitive.DialogPortal, { ...dialogScope, ...rest });
|
|
32
|
+
}
|
|
33
|
+
AlertDialogPortal.displayName = PORTAL_NAME;
|
|
34
|
+
var OVERLAY_NAME = "AlertDialogOverlay";
|
|
35
|
+
function AlertDialogOverlay(inProps) {
|
|
36
|
+
const [local, rest] = splitProps(inProps, ["__scopeAlertDialog", "ref"]);
|
|
37
|
+
const dialogScope = useDialogScope(local.__scopeAlertDialog);
|
|
38
|
+
return /* @__PURE__ */ React.createElement(DialogPrimitive.DialogOverlay, { ...dialogScope, ...rest, ref: local.ref });
|
|
39
|
+
}
|
|
40
|
+
AlertDialogOverlay.displayName = OVERLAY_NAME;
|
|
41
|
+
var CONTENT_NAME = "AlertDialogContent";
|
|
42
|
+
var [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext(CONTENT_NAME);
|
|
43
|
+
function AlertDialogContent(inProps) {
|
|
44
|
+
const [local, rest] = splitProps(inProps, [
|
|
45
|
+
"__scopeAlertDialog",
|
|
46
|
+
"ref",
|
|
47
|
+
"children",
|
|
48
|
+
"onOpenAutoFocus"
|
|
49
|
+
]);
|
|
50
|
+
const dialogScope = useDialogScope(local.__scopeAlertDialog);
|
|
51
|
+
const [cancelRef, setCancelRef] = createSignal(null);
|
|
52
|
+
return /* @__PURE__ */ React.createElement(
|
|
53
|
+
AlertDialogContentProvider,
|
|
54
|
+
{
|
|
55
|
+
scope: local.__scopeAlertDialog,
|
|
56
|
+
cancelRef: cancelRef(),
|
|
57
|
+
onCancelRefChange: setCancelRef
|
|
58
|
+
},
|
|
59
|
+
/* @__PURE__ */ React.createElement(
|
|
60
|
+
DialogPrimitive.DialogContent,
|
|
61
|
+
{
|
|
62
|
+
role: "alertdialog",
|
|
63
|
+
...dialogScope,
|
|
64
|
+
...rest,
|
|
65
|
+
ref: local.ref,
|
|
66
|
+
onOpenAutoFocus: composeEventHandlers(local.onOpenAutoFocus, (event) => {
|
|
67
|
+
event.preventDefault();
|
|
68
|
+
cancelRef()?.focus({ preventScroll: true });
|
|
69
|
+
}),
|
|
70
|
+
onPointerDownOutside: (event) => event.preventDefault(),
|
|
71
|
+
onInteractOutside: (event) => event.preventDefault()
|
|
72
|
+
},
|
|
73
|
+
local.children
|
|
74
|
+
)
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
AlertDialogContent.displayName = CONTENT_NAME;
|
|
78
|
+
var TITLE_NAME = "AlertDialogTitle";
|
|
79
|
+
function AlertDialogTitle(inProps) {
|
|
80
|
+
const [local, rest] = splitProps(inProps, ["__scopeAlertDialog", "ref"]);
|
|
81
|
+
const dialogScope = useDialogScope(local.__scopeAlertDialog);
|
|
82
|
+
return /* @__PURE__ */ React.createElement(DialogPrimitive.DialogTitle, { ...dialogScope, ...rest, ref: local.ref });
|
|
83
|
+
}
|
|
84
|
+
AlertDialogTitle.displayName = TITLE_NAME;
|
|
85
|
+
var DESCRIPTION_NAME = "AlertDialogDescription";
|
|
86
|
+
function AlertDialogDescription(inProps) {
|
|
87
|
+
const [local, rest] = splitProps(inProps, ["__scopeAlertDialog", "ref"]);
|
|
88
|
+
const dialogScope = useDialogScope(local.__scopeAlertDialog);
|
|
89
|
+
return /* @__PURE__ */ React.createElement(DialogPrimitive.DialogDescription, { ...dialogScope, ...rest, ref: local.ref });
|
|
90
|
+
}
|
|
91
|
+
AlertDialogDescription.displayName = DESCRIPTION_NAME;
|
|
92
|
+
var ACTION_NAME = "AlertDialogAction";
|
|
93
|
+
function AlertDialogAction(inProps) {
|
|
94
|
+
const [local, rest] = splitProps(inProps, ["__scopeAlertDialog", "ref"]);
|
|
95
|
+
const dialogScope = useDialogScope(local.__scopeAlertDialog);
|
|
96
|
+
return /* @__PURE__ */ React.createElement(DialogPrimitive.DialogClose, { ...dialogScope, ...rest, ref: local.ref });
|
|
97
|
+
}
|
|
98
|
+
AlertDialogAction.displayName = ACTION_NAME;
|
|
99
|
+
var CANCEL_NAME = "AlertDialogCancel";
|
|
100
|
+
function AlertDialogCancel(inProps) {
|
|
101
|
+
const [local, rest] = splitProps(inProps, ["__scopeAlertDialog", "ref"]);
|
|
102
|
+
const { onCancelRefChange } = useAlertDialogContentContext(CANCEL_NAME, local.__scopeAlertDialog);
|
|
103
|
+
const dialogScope = useDialogScope(local.__scopeAlertDialog);
|
|
104
|
+
return /* @__PURE__ */ React.createElement(
|
|
105
|
+
DialogPrimitive.DialogClose,
|
|
106
|
+
{
|
|
107
|
+
...dialogScope,
|
|
108
|
+
...rest,
|
|
109
|
+
ref: mergeRefs(local.ref, (el) => onCancelRefChange(el))
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
AlertDialogCancel.displayName = CANCEL_NAME;
|
|
114
|
+
var Root = AlertDialog;
|
|
115
|
+
var Trigger = AlertDialogTrigger;
|
|
116
|
+
var Portal = AlertDialogPortal;
|
|
117
|
+
var Overlay = AlertDialogOverlay;
|
|
118
|
+
var Content = AlertDialogContent;
|
|
119
|
+
var Action = AlertDialogAction;
|
|
120
|
+
var Cancel = AlertDialogCancel;
|
|
121
|
+
var Title = AlertDialogTitle;
|
|
122
|
+
var Description = AlertDialogDescription;
|
|
123
|
+
|
|
124
|
+
export { Action, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Cancel, Content, Description, Overlay, Portal, Root, Title, Trigger, createAlertDialogScope };
|
|
125
|
+
//# sourceMappingURL=index.js.map
|
|
126
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/alert-dialog.tsx"],"names":[],"mappings":";;;;;;;;AAWA,IAAM,SAAA,GAAY,aAAA;AAGlB,IAAM,CAAC,wBAAA,EAA0B,sBAAsB,CAAA,GAAI,mBAAmB,SAAA,EAAW;AAAA,EACvF;AACF,CAAC;AACD,IAAM,iBAAiB,iBAAA,EAAkB;AAKzC,SAAS,YAAY,KAAA,EAAsC;AACzD,EAAA,MAAM,CAAC,OAAO,IAAI,CAAA,GAAI,WAAW,KAAA,EAAO,CAAC,oBAAoB,CAAC,CAAA;AAC9D,EAAA,MAAM,WAAA,GAAc,cAAA,CAAe,KAAA,CAAM,kBAAkB,CAAA;AAC3D,EAAA,uBAAO,KAAA,CAAA,aAAA,CAAiB,wBAAhB,EAAwB,GAAG,aAAc,GAAG,IAAA,EAAM,OAAO,IAAA,EAAM,CAAA;AACzE;AAEA,WAAA,CAAY,WAAA,GAAc,SAAA;AAM1B,IAAM,YAAA,GAAe,oBAAA;AAMrB,SAAS,mBAAmB,OAAA,EAA+C;AACz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,OAAA,EAA8C;AACvE,EAAA,MAAM,CAAC,OAAO,IAAI,CAAA,GAAI,WAAW,OAAA,EAAS,CAAC,oBAAA,EAAsB,KAAK,CAAC,CAAA;AACvE,EAAA,MAAM,EAAE,iBAAA,EAAkB,GAAI,4BAAA,CAA6B,WAAA,EAAa,MAAM,kBAAkB,CAAA;AAChG,EAAA,MAAM,WAAA,GAAc,cAAA,CAAe,KAAA,CAAM,kBAAkB,CAAA;AAC3D,EAAA,uBACE,KAAA,CAAA,aAAA;AAAA,IAAiB,eAAA,CAAA,WAAA;AAAA,IAAhB;AAAA,MACE,GAAG,WAAA;AAAA,MACH,GAAG,IAAA;AAAA,MACJ,GAAA,EAAK,UAAU,KAAA,CAAM,GAAA,EAAK,CAAC,EAAA,KAAoB,iBAAA,CAAkB,EAAuB,CAAC;AAAA;AAAA,GAC3F;AAEJ;AAEA,iBAAA,CAAkB,WAAA,GAAc,WAAA;AAMhC,IAAM,IAAA,GAAO;AACb,IAAM,OAAA,GAAU;AAChB,IAAM,MAAA,GAAS;AACf,IAAM,OAAA,GAAU;AAChB,IAAM,OAAA,GAAU;AAChB,IAAM,MAAA,GAAS;AACf,IAAM,MAAA,GAAS;AACf,IAAM,KAAA,GAAQ;AACd,IAAM,WAAA,GAAc","file":"index.js","sourcesContent":["import { type JSX, splitProps, createSignal } from 'solid-js';\nimport { createContextScope, type Scope } from '@radix-solid-js/context';\nimport { mergeRefs } from '@radix-solid-js/compose-refs';\nimport { composeEventHandlers } from '@radix-solid-js/primitive';\nimport * as DialogPrimitive from '@radix-solid-js/dialog';\nimport { createDialogScope } from '@radix-solid-js/dialog';\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialog\n * -----------------------------------------------------------------------------------------------*/\n\nconst ROOT_NAME = 'AlertDialog';\n\ntype ScopedProps<P> = P & { __scopeAlertDialog?: Scope };\nconst [createAlertDialogContext, createAlertDialogScope] = createContextScope(ROOT_NAME, [\n createDialogScope,\n]);\nconst useDialogScope = createDialogScope();\n\ntype DialogProps = DialogPrimitive.DialogProps;\ninterface AlertDialogProps extends Omit<DialogProps, 'modal'> {}\n\nfunction AlertDialog(props: ScopedProps<AlertDialogProps>) {\n const [local, rest] = splitProps(props, ['__scopeAlertDialog']);\n const dialogScope = useDialogScope(local.__scopeAlertDialog);\n return <DialogPrimitive.Dialog {...dialogScope} {...rest} modal={true} />;\n}\n\nAlertDialog.displayName = ROOT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'AlertDialogTrigger';\n\ninterface AlertDialogTriggerProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {\n ref?: (el: HTMLElement) => void;\n}\n\nfunction AlertDialogTrigger(inProps: ScopedProps<AlertDialogTriggerProps>) {\n const [local, rest] = splitProps(inProps, ['__scopeAlertDialog', 'ref']);\n const dialogScope = useDialogScope(local.__scopeAlertDialog);\n return <DialogPrimitive.DialogTrigger {...dialogScope} {...rest} ref={local.ref} />;\n}\n\nAlertDialogTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'AlertDialogPortal';\n\ninterface AlertDialogPortalProps extends DialogPrimitive.DialogPortalProps {}\n\nfunction AlertDialogPortal(props: ScopedProps<AlertDialogPortalProps>) {\n const [local, rest] = splitProps(props, ['__scopeAlertDialog']);\n const dialogScope = useDialogScope(local.__scopeAlertDialog);\n return <DialogPrimitive.DialogPortal {...dialogScope} {...rest} />;\n}\n\nAlertDialogPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogOverlay\n * -----------------------------------------------------------------------------------------------*/\n\nconst OVERLAY_NAME = 'AlertDialogOverlay';\n\ninterface AlertDialogOverlayProps extends JSX.HTMLAttributes<HTMLDivElement> {\n forceMount?: true;\n ref?: (el: HTMLElement) => void;\n}\n\nfunction AlertDialogOverlay(inProps: ScopedProps<AlertDialogOverlayProps>) {\n const [local, rest] = splitProps(inProps, ['__scopeAlertDialog', 'ref']);\n const dialogScope = useDialogScope(local.__scopeAlertDialog);\n return <DialogPrimitive.DialogOverlay {...dialogScope} {...rest} ref={local.ref} />;\n}\n\nAlertDialogOverlay.displayName = OVERLAY_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'AlertDialogContent';\n\ntype AlertDialogContentContextValue = {\n cancelRef: HTMLButtonElement | null;\n onCancelRefChange: (el: HTMLButtonElement | null) => void;\n};\n\nconst [AlertDialogContentProvider, useAlertDialogContentContext] =\n createAlertDialogContext<AlertDialogContentContextValue>(CONTENT_NAME);\n\ntype DialogContentProps = DialogPrimitive.DialogContentProps;\ninterface AlertDialogContentProps\n extends Omit<DialogContentProps, 'onPointerDownOutside' | 'onInteractOutside'> {\n ref?: (el: HTMLElement) => void;\n}\n\nfunction AlertDialogContent(inProps: ScopedProps<AlertDialogContentProps>) {\n const [local, rest] = splitProps(inProps, [\n '__scopeAlertDialog',\n 'ref',\n 'children',\n 'onOpenAutoFocus',\n ]);\n const dialogScope = useDialogScope(local.__scopeAlertDialog);\n const [cancelRef, setCancelRef] = createSignal<HTMLButtonElement | null>(null);\n\n return (\n <AlertDialogContentProvider\n scope={local.__scopeAlertDialog}\n cancelRef={cancelRef()}\n onCancelRefChange={setCancelRef}\n >\n <DialogPrimitive.DialogContent\n role=\"alertdialog\"\n {...dialogScope}\n {...rest}\n ref={local.ref}\n onOpenAutoFocus={composeEventHandlers(local.onOpenAutoFocus, (event: Event) => {\n event.preventDefault();\n cancelRef()?.focus({ preventScroll: true });\n })}\n onPointerDownOutside={(event: any) => event.preventDefault()}\n onInteractOutside={(event: any) => event.preventDefault()}\n >\n {local.children}\n </DialogPrimitive.DialogContent>\n </AlertDialogContentProvider>\n );\n}\n\nAlertDialogContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'AlertDialogTitle';\n\ninterface AlertDialogTitleProps extends JSX.HTMLAttributes<HTMLHeadingElement> {\n ref?: (el: HTMLElement) => void;\n}\n\nfunction AlertDialogTitle(inProps: ScopedProps<AlertDialogTitleProps>) {\n const [local, rest] = splitProps(inProps, ['__scopeAlertDialog', 'ref']);\n const dialogScope = useDialogScope(local.__scopeAlertDialog);\n return <DialogPrimitive.DialogTitle {...dialogScope} {...rest} ref={local.ref} />;\n}\n\nAlertDialogTitle.displayName = TITLE_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'AlertDialogDescription';\n\ninterface AlertDialogDescriptionProps extends JSX.HTMLAttributes<HTMLParagraphElement> {\n ref?: (el: HTMLElement) => void;\n}\n\nfunction AlertDialogDescription(inProps: ScopedProps<AlertDialogDescriptionProps>) {\n const [local, rest] = splitProps(inProps, ['__scopeAlertDialog', 'ref']);\n const dialogScope = useDialogScope(local.__scopeAlertDialog);\n return <DialogPrimitive.DialogDescription {...dialogScope} {...rest} ref={local.ref} />;\n}\n\nAlertDialogDescription.displayName = DESCRIPTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACTION_NAME = 'AlertDialogAction';\n\ninterface AlertDialogActionProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {\n ref?: (el: HTMLElement) => void;\n}\n\nfunction AlertDialogAction(inProps: ScopedProps<AlertDialogActionProps>) {\n const [local, rest] = splitProps(inProps, ['__scopeAlertDialog', 'ref']);\n const dialogScope = useDialogScope(local.__scopeAlertDialog);\n return <DialogPrimitive.DialogClose {...dialogScope} {...rest} ref={local.ref} />;\n}\n\nAlertDialogAction.displayName = ACTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * AlertDialogCancel\n * -----------------------------------------------------------------------------------------------*/\n\nconst CANCEL_NAME = 'AlertDialogCancel';\n\ninterface AlertDialogCancelProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {\n ref?: (el: HTMLElement) => void;\n}\n\nfunction AlertDialogCancel(inProps: ScopedProps<AlertDialogCancelProps>) {\n const [local, rest] = splitProps(inProps, ['__scopeAlertDialog', 'ref']);\n const { onCancelRefChange } = useAlertDialogContentContext(CANCEL_NAME, local.__scopeAlertDialog);\n const dialogScope = useDialogScope(local.__scopeAlertDialog);\n return (\n <DialogPrimitive.DialogClose\n {...dialogScope}\n {...rest}\n ref={mergeRefs(local.ref, (el: HTMLElement) => onCancelRefChange(el as HTMLButtonElement))}\n />\n );\n}\n\nAlertDialogCancel.displayName = CANCEL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * Exports\n * -----------------------------------------------------------------------------------------------*/\n\nconst Root = AlertDialog;\nconst Trigger = AlertDialogTrigger;\nconst Portal = AlertDialogPortal;\nconst Overlay = AlertDialogOverlay;\nconst Content = AlertDialogContent;\nconst Action = AlertDialogAction;\nconst Cancel = AlertDialogCancel;\nconst Title = AlertDialogTitle;\nconst Description = AlertDialogDescription;\n\nexport {\n createAlertDialogScope,\n //\n AlertDialog,\n AlertDialogTrigger,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogContent,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogTitle,\n AlertDialogDescription,\n //\n Root,\n Trigger,\n Portal,\n Overlay,\n Content,\n Action,\n Cancel,\n Title,\n Description,\n};\nexport type {\n AlertDialogProps,\n AlertDialogTriggerProps,\n AlertDialogPortalProps,\n AlertDialogOverlayProps,\n AlertDialogContentProps,\n AlertDialogActionProps,\n AlertDialogCancelProps,\n AlertDialogTitleProps,\n AlertDialogDescriptionProps,\n};\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@radix-solid-js/alert-dialog",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/index.d.cts",
|
|
17
|
+
"default": "./dist/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"sideEffects": false,
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsup",
|
|
27
|
+
"clean": "rm -rf dist",
|
|
28
|
+
"typecheck": "tsc --noEmit",
|
|
29
|
+
"test": "vitest run"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@radix-solid-js/primitive": "workspace:*",
|
|
33
|
+
"@radix-solid-js/compose-refs": "workspace:*",
|
|
34
|
+
"@radix-solid-js/context": "workspace:*",
|
|
35
|
+
"@radix-solid-js/dialog": "workspace:*",
|
|
36
|
+
"@radix-solid-js/primitive-component": "workspace:*",
|
|
37
|
+
"@radix-solid-js/slot": "workspace:*"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"solid-js": "^1.8.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@repo/tsconfig": "workspace:*",
|
|
44
|
+
"tsup": "^8.3.6",
|
|
45
|
+
"typescript": "^5.7.3",
|
|
46
|
+
"solid-js": "^1.9.3",
|
|
47
|
+
"vitest": "^2.1.8"
|
|
48
|
+
},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
},
|
|
52
|
+
"repository": {
|
|
53
|
+
"type": "git",
|
|
54
|
+
"url": "https://github.com/ljho01/shadcn-solid-js.git",
|
|
55
|
+
"directory": "packages/solid/alert-dialog"
|
|
56
|
+
}
|
|
57
|
+
}
|