@oneplatformdev/ui 0.0.1-beta.5 → 0.0.1-beta.7
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/AlertDialog/AlertDialog.mjs +58 -60
- package/package.json +1 -1
@@ -1,99 +1,97 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { cloneElement as a, useId as
|
3
|
-
import { AlertDialogRoot as
|
4
|
-
import {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
const { slotProps: e = {}, children: r } = n, o = e.trigger ?? {};
|
9
|
-
return l(r, f) ? a(
|
1
|
+
import { jsxs as g, jsx as t } from "react/jsx-runtime";
|
2
|
+
import { cloneElement as a, useId as j, Children as y } from "react";
|
3
|
+
import { AlertDialogRoot as E, AlertDialogContent as u, AlertDialogTrigger as v, AlertDialogHeader as f, AlertDialogTitle as B, AlertDialogDescription as R, AlertDialogFooter as A, AlertDialogAction as D, AlertDialogCancel as k } from "./AlertDialogRoot.mjs";
|
4
|
+
import { isValidReactElement as s } from "@oneplatformdev/utils";
|
5
|
+
const F = (o) => {
|
6
|
+
const { slotProps: e = {}, children: r } = o, i = e.trigger ?? {};
|
7
|
+
return s(r, v) ? a(
|
10
8
|
r,
|
11
9
|
{
|
12
10
|
...r.props || {},
|
13
|
-
...
|
11
|
+
...i
|
14
12
|
}
|
15
|
-
) :
|
16
|
-
},
|
13
|
+
) : /* @__PURE__ */ t(v, { asChild: !0, children: r });
|
14
|
+
}, H = (o) => {
|
17
15
|
const {
|
18
16
|
title: e = "",
|
19
17
|
description: r = "",
|
20
|
-
slotProps:
|
21
|
-
children:
|
22
|
-
} =
|
23
|
-
return
|
24
|
-
|
25
|
-
{ ...
|
26
|
-
) : /* @__PURE__ */ t(
|
27
|
-
e &&
|
18
|
+
slotProps: i = {},
|
19
|
+
children: l
|
20
|
+
} = o, n = i.header ?? {}, d = i.title ?? {}, c = i.description ?? {};
|
21
|
+
return l ? s(l, f) ? a(
|
22
|
+
l,
|
23
|
+
{ ...l.props || {}, ...n }
|
24
|
+
) : /* @__PURE__ */ t(f, { ...n, children: l }) : /* @__PURE__ */ g(f, { children: [
|
25
|
+
e && s(e, B) ? a(
|
28
26
|
e,
|
29
27
|
{ ...e.props || {}, ...d }
|
30
28
|
) : /* @__PURE__ */ t(B, { ...d, children: e }),
|
31
|
-
r &&
|
29
|
+
r && s(r, R) ? a(
|
32
30
|
r,
|
33
|
-
{ ...r.props || {}, ...
|
34
|
-
) : /* @__PURE__ */ t(R, { ...
|
31
|
+
{ ...r.props || {}, ...c }
|
32
|
+
) : /* @__PURE__ */ t(R, { ...c, children: r })
|
35
33
|
] });
|
36
|
-
},
|
34
|
+
}, I = (o) => {
|
37
35
|
const {
|
38
36
|
slotProps: e = {},
|
39
37
|
children: r,
|
40
|
-
onCancel:
|
41
|
-
onConfirm:
|
42
|
-
cancelLabel:
|
38
|
+
onCancel: i,
|
39
|
+
onConfirm: l,
|
40
|
+
cancelLabel: n = "Cancel",
|
43
41
|
actionLabel: d = "Continue",
|
44
|
-
variant:
|
45
|
-
} =
|
46
|
-
return r ?
|
42
|
+
variant: c = "confirm"
|
43
|
+
} = o, x = j(), m = e.footer ?? {}, T = e.cancelButton ?? {}, C = e.actionButton ?? {};
|
44
|
+
return r ? s(r, A) ? a(
|
47
45
|
r,
|
48
|
-
{ ...r.props || {}, ...
|
49
|
-
) : /* @__PURE__ */ t(A, { ...
|
50
|
-
if (!p || !
|
51
|
-
const
|
52
|
-
return
|
53
|
-
}) }) : /* @__PURE__ */
|
54
|
-
|
46
|
+
{ ...r.props || {}, ...m }
|
47
|
+
) : /* @__PURE__ */ t(A, { ...m, children: y.map(r, (p, b) => {
|
48
|
+
if (!p || !s(p)) return;
|
49
|
+
const h = p, P = a(h, { ...h.props || {}, key: h.key || `footer-${x}-action-${b}` });
|
50
|
+
return s(p, D) || s(p, k) ? P : /* @__PURE__ */ t(D, { asChild: !0, children: P });
|
51
|
+
}) }) : /* @__PURE__ */ g(A, { children: [
|
52
|
+
c !== "alert" && /* @__PURE__ */ t(
|
55
53
|
k,
|
56
54
|
{
|
57
55
|
variant: "ghost",
|
58
|
-
onClick:
|
59
|
-
...
|
60
|
-
children:
|
56
|
+
onClick: i,
|
57
|
+
...T,
|
58
|
+
children: n
|
61
59
|
}
|
62
60
|
),
|
63
61
|
/* @__PURE__ */ t(
|
64
|
-
|
62
|
+
D,
|
65
63
|
{
|
66
|
-
onClick:
|
67
|
-
...
|
68
|
-
variant:
|
64
|
+
onClick: l,
|
65
|
+
...C,
|
66
|
+
variant: C.variant || c === "destructive" ? "destructive" : "default",
|
69
67
|
children: d
|
70
68
|
}
|
71
69
|
)
|
72
70
|
] });
|
73
|
-
},
|
71
|
+
}, w = (o) => {
|
74
72
|
const {
|
75
73
|
trigger: e,
|
76
74
|
header: r,
|
77
|
-
footer:
|
78
|
-
slotProps:
|
79
|
-
children:
|
75
|
+
footer: i,
|
76
|
+
slotProps: l = {},
|
77
|
+
children: n,
|
80
78
|
...d
|
81
|
-
} =
|
82
|
-
return /* @__PURE__ */
|
83
|
-
/* @__PURE__ */ t(
|
84
|
-
|
85
|
-
|
79
|
+
} = o, c = l.content ?? {};
|
80
|
+
return /* @__PURE__ */ g(E, { ...d, children: [
|
81
|
+
/* @__PURE__ */ t(F, { ...o, children: e }),
|
82
|
+
n ? s(n, u) ? a(
|
83
|
+
n,
|
86
84
|
{
|
87
|
-
...
|
88
|
-
...
|
85
|
+
...n.props || {},
|
86
|
+
...c
|
89
87
|
}
|
90
|
-
) : /* @__PURE__ */ t(
|
91
|
-
/* @__PURE__ */ t(
|
92
|
-
/* @__PURE__ */ t(
|
88
|
+
) : /* @__PURE__ */ t(u, { ...c, children: n }) : /* @__PURE__ */ g(u, { ...c, children: [
|
89
|
+
/* @__PURE__ */ t(H, { ...o, children: r }),
|
90
|
+
/* @__PURE__ */ t(I, { ...o, children: i })
|
93
91
|
] })
|
94
92
|
] });
|
95
93
|
};
|
96
94
|
export {
|
97
|
-
|
98
|
-
|
95
|
+
w as AlertDialog,
|
96
|
+
w as default
|
99
97
|
};
|