@agentero/design-system 0.23.4 → 0.23.5
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/mcp/manifests/components.html +31 -4
- package/mcp/manifests/components.json +1 -1
- package/package.json +1 -1
- package/src/modal/modal.d.ts +28 -1
- package/src/modal/modal.js +68 -54
package/package.json
CHANGED
package/src/modal/modal.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { VariantProps } from 'tailwind-variants';
|
|
|
3
3
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
4
4
|
type RootProps = ComponentProps<typeof DialogPrimitive.Root>;
|
|
5
5
|
type TriggerProps = ComponentProps<typeof DialogPrimitive.Trigger>;
|
|
6
|
+
type ModalVariant = 'dialog' | 'alert';
|
|
6
7
|
export declare const modalRecipe: import('tailwind-variants').TVReturnType<{
|
|
7
8
|
size: {
|
|
8
9
|
md: {
|
|
@@ -56,6 +57,14 @@ type ContentProps = ComponentProps<typeof DialogPrimitive.Content> & {
|
|
|
56
57
|
* Both shrink to the viewport on small screens.
|
|
57
58
|
*/
|
|
58
59
|
size?: ModalVariants['size'];
|
|
60
|
+
/**
|
|
61
|
+
* `'dialog'` (default) is dismissable: `Escape`, an overlay click, and the
|
|
62
|
+
* X button in `Modal.Title` all close it. `'alert'` removes all three, so
|
|
63
|
+
* the only way out is one of the buttons in `Modal.Footer`, and exposes
|
|
64
|
+
* `role="alertdialog"` to assistive technology. Use it when dismissing
|
|
65
|
+
* without choosing would leave the user stuck or lose their work.
|
|
66
|
+
*/
|
|
67
|
+
variant?: ModalVariant;
|
|
59
68
|
};
|
|
60
69
|
type TitleProps = ComponentProps<typeof DialogPrimitive.Title>;
|
|
61
70
|
type BodyProps = ComponentProps<'div'>;
|
|
@@ -72,6 +81,10 @@ type CloseProps = ComponentProps<typeof DialogPrimitive.Close>;
|
|
|
72
81
|
* (right-aligned actions). Open it controlled (`open`/`onOpenChange`) or via
|
|
73
82
|
* `Trigger`; close from inside with `Close asChild` around your cancel button.
|
|
74
83
|
*
|
|
84
|
+
* For a modal the user has to answer, pass `variant="alert"` to `Content`:
|
|
85
|
+
* `Escape`, the overlay click and the X button all stop closing it, and it is
|
|
86
|
+
* announced as an `alertdialog`.
|
|
87
|
+
*
|
|
75
88
|
* @summary Compound modal dialog over a dimmed overlay
|
|
76
89
|
*
|
|
77
90
|
* @example
|
|
@@ -90,6 +103,20 @@ type CloseProps = ComponentProps<typeof DialogPrimitive.Close>;
|
|
|
90
103
|
* </Modal.Root>
|
|
91
104
|
* ```
|
|
92
105
|
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```tsx
|
|
108
|
+
* // Alert: no Escape, no overlay click, no X — the user must answer.
|
|
109
|
+
* <Modal.Root open={isOpen}>
|
|
110
|
+
* <Modal.Content variant="alert">
|
|
111
|
+
* <Modal.Title>Complete your Docusign integration</Modal.Title>
|
|
112
|
+
* <Modal.Body>Authorize access to finish connecting your account.</Modal.Body>
|
|
113
|
+
* <Modal.Footer>
|
|
114
|
+
* <Button onClick={handleAuthorize}>Authorize</Button>
|
|
115
|
+
* </Modal.Footer>
|
|
116
|
+
* </Modal.Content>
|
|
117
|
+
* </Modal.Root>
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
93
120
|
* @component
|
|
94
121
|
* @namespace Modal
|
|
95
122
|
*/
|
|
@@ -103,7 +130,7 @@ export declare const Modal: {
|
|
|
103
130
|
displayName: string;
|
|
104
131
|
};
|
|
105
132
|
Content: {
|
|
106
|
-
({ className, size, children, ...props }: ContentProps): import("react/jsx-runtime").JSX.Element;
|
|
133
|
+
({ className, size, variant, children, onEscapeKeyDown, onPointerDownOutside, ...props }: ContentProps): import("react/jsx-runtime").JSX.Element;
|
|
107
134
|
displayName: string;
|
|
108
135
|
};
|
|
109
136
|
Title: {
|
package/src/modal/modal.js
CHANGED
|
@@ -4,19 +4,20 @@ import { Button as t } from "../button/button.js";
|
|
|
4
4
|
import { IconClose as n } from "./icons.js";
|
|
5
5
|
import { tv as r } from "tailwind-variants";
|
|
6
6
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
|
-
import
|
|
7
|
+
import { createContext as o, useContext as s } from "react";
|
|
8
|
+
import * as c from "@radix-ui/react-dialog";
|
|
8
9
|
//#region src/modal/modal.tsx
|
|
9
|
-
var
|
|
10
|
+
var l = (e) => /* @__PURE__ */ i(c.Root, {
|
|
10
11
|
"data-slot": "modal-root",
|
|
11
12
|
...e
|
|
12
13
|
});
|
|
13
|
-
|
|
14
|
-
var
|
|
14
|
+
l.displayName = "Modal.Root";
|
|
15
|
+
var u = (e) => /* @__PURE__ */ i(c.Trigger, {
|
|
15
16
|
"data-slot": "modal-trigger",
|
|
16
17
|
...e
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
var
|
|
19
|
+
u.displayName = "Modal.Trigger";
|
|
20
|
+
var d = o("dialog"), f = r({
|
|
20
21
|
slots: {
|
|
21
22
|
overlay: [
|
|
22
23
|
"fixed inset-0 z-(--z-index-overlay) bg-overlay-dark-300",
|
|
@@ -39,64 +40,77 @@ var l = r({
|
|
|
39
40
|
lg: { content: "max-w-[45rem]" }
|
|
40
41
|
} },
|
|
41
42
|
defaultVariants: { size: "md" }
|
|
42
|
-
}),
|
|
43
|
-
let
|
|
44
|
-
return /* @__PURE__ */
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
}), p = f(), m = ({ className: t, size: n, variant: r = "dialog", children: o, onEscapeKeyDown: s, onPointerDownOutside: l, ...u }) => {
|
|
44
|
+
let p = f({ size: n }), m = r === "alert";
|
|
45
|
+
return /* @__PURE__ */ i(d.Provider, {
|
|
46
|
+
value: r,
|
|
47
|
+
children: /* @__PURE__ */ a(c.Portal, { children: [/* @__PURE__ */ i(c.Overlay, {
|
|
48
|
+
"data-slot": "modal-overlay",
|
|
49
|
+
className: p.overlay()
|
|
50
|
+
}), /* @__PURE__ */ i(c.Content, {
|
|
51
|
+
"data-slot": "modal-content",
|
|
52
|
+
role: m ? "alertdialog" : "dialog",
|
|
53
|
+
"aria-describedby": void 0,
|
|
54
|
+
className: e(p.content(), t),
|
|
55
|
+
onEscapeKeyDown: (e) => {
|
|
56
|
+
s?.(e), m && e.preventDefault();
|
|
57
|
+
},
|
|
58
|
+
onPointerDownOutside: (e) => {
|
|
59
|
+
l?.(e), m && e.preventDefault();
|
|
60
|
+
},
|
|
61
|
+
...u,
|
|
62
|
+
children: o
|
|
63
|
+
})] })
|
|
64
|
+
});
|
|
54
65
|
};
|
|
55
|
-
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
children:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
m.displayName = "Modal.Content";
|
|
67
|
+
var h = ({ className: e, children: r, ...o }) => {
|
|
68
|
+
let l = s(d);
|
|
69
|
+
return /* @__PURE__ */ a("div", {
|
|
70
|
+
"data-slot": "modal-title",
|
|
71
|
+
className: p.title({ className: e }),
|
|
72
|
+
children: [/* @__PURE__ */ i(c.Title, {
|
|
73
|
+
...o,
|
|
74
|
+
children: r
|
|
75
|
+
}), l === "dialog" && /* @__PURE__ */ i(c.Close, {
|
|
76
|
+
asChild: !0,
|
|
77
|
+
children: /* @__PURE__ */ i(t, {
|
|
78
|
+
variant: "ghost",
|
|
79
|
+
size: "sm",
|
|
80
|
+
"aria-label": "Close",
|
|
81
|
+
className: "-my-2 -mr-6 shrink-0",
|
|
82
|
+
children: /* @__PURE__ */ i(n, {})
|
|
83
|
+
})
|
|
84
|
+
})]
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
h.displayName = "Modal.Title";
|
|
88
|
+
var g = ({ className: e, ...t }) => /* @__PURE__ */ i("div", {
|
|
75
89
|
"data-slot": "modal-body",
|
|
76
90
|
tabIndex: 0,
|
|
77
|
-
className:
|
|
91
|
+
className: p.body({ className: e }),
|
|
78
92
|
...t
|
|
79
93
|
});
|
|
80
|
-
|
|
81
|
-
var
|
|
94
|
+
g.displayName = "Modal.Body";
|
|
95
|
+
var _ = ({ className: e, ...t }) => /* @__PURE__ */ i("div", {
|
|
82
96
|
"data-slot": "modal-footer",
|
|
83
|
-
className:
|
|
97
|
+
className: p.footer({ className: e }),
|
|
84
98
|
...t
|
|
85
99
|
});
|
|
86
|
-
|
|
87
|
-
var
|
|
100
|
+
_.displayName = "Modal.Footer";
|
|
101
|
+
var v = (e) => /* @__PURE__ */ i(c.Close, {
|
|
88
102
|
"data-slot": "modal-close",
|
|
89
103
|
...e
|
|
90
104
|
});
|
|
91
|
-
|
|
92
|
-
var
|
|
93
|
-
Root:
|
|
94
|
-
Trigger:
|
|
95
|
-
Content:
|
|
96
|
-
Title:
|
|
97
|
-
Body:
|
|
98
|
-
Footer:
|
|
99
|
-
Close:
|
|
105
|
+
v.displayName = "Modal.Close";
|
|
106
|
+
var y = {
|
|
107
|
+
Root: l,
|
|
108
|
+
Trigger: u,
|
|
109
|
+
Content: m,
|
|
110
|
+
Title: h,
|
|
111
|
+
Body: g,
|
|
112
|
+
Footer: _,
|
|
113
|
+
Close: v
|
|
100
114
|
};
|
|
101
115
|
//#endregion
|
|
102
|
-
export {
|
|
116
|
+
export { y as Modal, f as modalRecipe };
|