@dust-tt/sparkle 0.2.464 → 0.2.465-rc-1
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/cjs/index.js +1 -1
- package/dist/esm/components/Dialog.d.ts +9 -2
- package/dist/esm/components/Dialog.d.ts.map +1 -1
- package/dist/esm/components/Dialog.js +24 -17
- package/dist/esm/components/Dialog.js.map +1 -1
- package/dist/esm/stories/Dialog.stories.d.ts +1 -0
- package/dist/esm/stories/Dialog.stories.d.ts.map +1 -1
- package/dist/esm/stories/Dialog.stories.js +49 -15
- package/dist/esm/stories/Dialog.stories.js.map +1 -1
- package/dist/sparkle.css +4 -4
- package/package.json +1 -1
- package/src/components/Dialog.tsx +65 -38
- package/src/stories/Dialog.stories.tsx +75 -25
|
@@ -29,12 +29,19 @@ interface DialogFooterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
29
29
|
leftButtonProps?: React.ComponentProps<typeof Button>;
|
|
30
30
|
rightButtonProps?: React.ComponentProps<typeof Button>;
|
|
31
31
|
dialogCloseClassName?: string;
|
|
32
|
+
permanentValidation?: {
|
|
33
|
+
label: string;
|
|
34
|
+
checked: boolean;
|
|
35
|
+
onChange: (event: React.FormEvent<HTMLButtonElement>) => void;
|
|
36
|
+
};
|
|
32
37
|
}
|
|
33
38
|
declare const DialogFooter: {
|
|
34
|
-
({ className, children, leftButtonProps, rightButtonProps, dialogCloseClassName, ...props }: DialogFooterProps): React.JSX.Element;
|
|
39
|
+
({ className, children, leftButtonProps, rightButtonProps, dialogCloseClassName, permanentValidation, ...props }: DialogFooterProps): React.JSX.Element;
|
|
35
40
|
displayName: string;
|
|
36
41
|
};
|
|
37
|
-
declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> &
|
|
42
|
+
declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & {
|
|
43
|
+
visual?: React.ReactNode;
|
|
44
|
+
} & React.RefAttributes<HTMLHeadingElement>>;
|
|
38
45
|
declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
39
46
|
export { Dialog, DialogClose, DialogContainer, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
40
47
|
//# sourceMappingURL=Dialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAG1D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAG1D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAwB,MAAM,qBAAqB,CAAC;AAInE,QAAA,MAAM,MAAM,uCAAuB,CAAC;AACpC,QAAA,MAAM,aAAa,8GAA0B,CAAC;AAC9C,QAAA,MAAM,WAAW,4GAAwB,CAAC;AAC1C,QAAA,MAAM,YAAY,6CAAyB,CAAC;AAE5C,QAAA,MAAM,aAAa,8JAajB,CAAC;AAGH,QAAA,MAAM,YAAY,6BAA8B,CAAC;AACjD,KAAK,cAAc,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAyBpD,UAAU,kBACR,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC;IACtE,IAAI,CAAC,EAAE,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va } from "class-variance-authority";
|
|
5
5
|
import * as React from "react";
|
|
6
|
-
import { Button, ScrollArea } from "../components";
|
|
6
|
+
import { Button, Checkbox, ScrollArea } from "../components";
|
|
7
7
|
import { XMarkIcon } from "../icons/app";
|
|
8
8
|
import { cn } from "../lib/utils";
|
|
9
9
|
var Dialog = DialogPrimitive.Root;
|
|
@@ -21,7 +21,7 @@ var sizeClasses = {
|
|
|
21
21
|
lg: "sm:s-max-w-xl",
|
|
22
22
|
xl: "sm:s-max-w-3xl",
|
|
23
23
|
};
|
|
24
|
-
var dialogVariants = cva(cn("s-fixed s-left-[50%] s-top-[50%] s-z-50 s-
|
|
24
|
+
var dialogVariants = cva(cn("s-fixed s-left-[50%] s-top-[50%] s-z-50 s-overflow-hidden s-translate-x-[-50%] s-translate-y-[-50%] s-duration-200 data-[state=open]:s-animate-in data-[state=closed]:s-animate-out data-[state=closed]:s-fade-out-0 data-[state=open]:s-fade-in-0 data-[state=closed]:s-zoom-out-95 data-[state=open]:s-zoom-in-95 data-[state=closed]:s-slide-out-to-left-1/2 data-[state=closed]:s-slide-out-to-top-[48%] data-[state=open]:s-slide-in-from-left-1/2 data-[state=open]:s-slide-in-from-top-[48%]", "s-rounded-2xl s-grid s-w-full s-border s-border s-shadow-lg s-sm:rounded-lg", "s-bg-background dark:s-bg-background-night", "s-border-border dark:s-border-border-night"), {
|
|
25
25
|
variants: {
|
|
26
26
|
size: sizeClasses,
|
|
27
27
|
},
|
|
@@ -39,37 +39,44 @@ var DialogContent = React.forwardRef(function (_a, ref) {
|
|
|
39
39
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
40
40
|
var DialogHeader = function (_a) {
|
|
41
41
|
var className = _a.className, children = _a.children, _b = _a.hideButton, hideButton = _b === void 0 ? false : _b, props = __rest(_a, ["className", "children", "hideButton"]);
|
|
42
|
-
return (React.createElement("div", __assign({ className: cn("s-z-50 s-flex s-flex-none s-flex-col s-gap-0 s-
|
|
42
|
+
return (React.createElement("div", __assign({ className: cn("s-z-50 s-flex s-flex-none s-flex-col s-gap-0 s-px-5 s-py-4 s-text-left", className) }, props),
|
|
43
43
|
children,
|
|
44
|
-
React.createElement(DialogClose, { asChild: true, className: "s-absolute s-right-3 s-top-3" }, !hideButton && React.createElement(Button, { icon: XMarkIcon, variant: "ghost", size: "
|
|
44
|
+
React.createElement(DialogClose, { asChild: true, className: "s-absolute s-right-3 s-top-3" }, !hideButton && React.createElement(Button, { icon: XMarkIcon, variant: "ghost", size: "mini" }))));
|
|
45
45
|
};
|
|
46
46
|
DialogHeader.displayName = "DialogHeader";
|
|
47
47
|
var DialogContainer = function (_a) {
|
|
48
48
|
var children = _a.children;
|
|
49
49
|
return (React.createElement(ScrollArea, { className: "s-w-full s-flex-grow" },
|
|
50
|
-
React.createElement("div", { className: cn("s-relative s-flex s-flex-col s-gap-2 s-
|
|
50
|
+
React.createElement("div", { className: cn("s-copy-base s-relative s-flex s-flex-col s-gap-2 s-px-5 s-py-4 s-text-left", "s-text-foreground dark:s-text-foreground-night") }, children)));
|
|
51
51
|
};
|
|
52
52
|
DialogContainer.displayName = "DialogContainer";
|
|
53
53
|
var DialogFooter = function (_a) {
|
|
54
|
-
var className = _a.className, children = _a.children, leftButtonProps = _a.leftButtonProps, rightButtonProps = _a.rightButtonProps, dialogCloseClassName = _a.dialogCloseClassName, props = __rest(_a, ["className", "children", "leftButtonProps", "rightButtonProps", "dialogCloseClassName"]);
|
|
55
|
-
return (React.createElement("div",
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
var className = _a.className, children = _a.children, leftButtonProps = _a.leftButtonProps, rightButtonProps = _a.rightButtonProps, dialogCloseClassName = _a.dialogCloseClassName, permanentValidation = _a.permanentValidation, props = __rest(_a, ["className", "children", "leftButtonProps", "rightButtonProps", "dialogCloseClassName", "permanentValidation"]);
|
|
55
|
+
return (React.createElement("div", { className: "s-flex s-flex-col s-gap-0" },
|
|
56
|
+
permanentValidation && (React.createElement("div", { className: "s-flex s-flex-row s-items-center s-gap-2 s-px-5 s-pt-3" },
|
|
57
|
+
React.createElement(Checkbox, { checked: permanentValidation.checked, onChange: permanentValidation.onChange }),
|
|
58
|
+
React.createElement("label", { className: "s-copy-sm s-text-foreground dark:s-text-foreground-night" },
|
|
59
|
+
React.createElement("strong", null, permanentValidation.label)))),
|
|
60
|
+
React.createElement("div", __assign({ className: cn("s-flex s-flex-none s-flex-row s-justify-end s-gap-2 s-px-3 s-py-3", className) }, props),
|
|
61
|
+
leftButtonProps &&
|
|
62
|
+
(leftButtonProps.disabled ? (React.createElement(Button, __assign({}, leftButtonProps))) : (React.createElement(DialogClose, { className: dialogCloseClassName, asChild: true },
|
|
63
|
+
React.createElement(Button, __assign({}, leftButtonProps))))),
|
|
64
|
+
rightButtonProps &&
|
|
65
|
+
(rightButtonProps.disabled ? (React.createElement(Button, __assign({}, rightButtonProps))) : (React.createElement(DialogClose, { className: dialogCloseClassName, asChild: true },
|
|
66
|
+
React.createElement(Button, __assign({}, rightButtonProps))))),
|
|
67
|
+
children)));
|
|
63
68
|
};
|
|
64
69
|
DialogFooter.displayName = "DialogFooter";
|
|
65
70
|
var DialogTitle = React.forwardRef(function (_a, ref) {
|
|
66
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
67
|
-
return (React.createElement(
|
|
71
|
+
var className = _a.className, visual = _a.visual, children = _a.children, props = __rest(_a, ["className", "visual", "children"]);
|
|
72
|
+
return (React.createElement("div", { className: "s-flex s-flex-row s-items-center s-gap-2 s-pt-1" },
|
|
73
|
+
visual,
|
|
74
|
+
React.createElement(DialogPrimitive.Title, __assign({ ref: ref, className: cn("s-heading-lg", "s-text-foreground dark:s-text-foreground-night", className) }, props), children)));
|
|
68
75
|
});
|
|
69
76
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
70
77
|
var DialogDescription = React.forwardRef(function (_a, ref) {
|
|
71
78
|
var className = _a.className, props = __rest(_a, ["className"]);
|
|
72
|
-
return (React.createElement(DialogPrimitive.Description, __assign({ ref: ref, className: cn("s-
|
|
79
|
+
return (React.createElement(DialogPrimitive.Description, __assign({ ref: ref, className: cn("s-copy-sm", "s-text-muted-foreground dark:s-text-muted-foreground-night", className) }, props)));
|
|
73
80
|
});
|
|
74
81
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
75
82
|
export { Dialog, DialogClose, DialogContainer, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../src/components/Dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../src/components/Dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC,IAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC;AACpC,IAAM,aAAa,GAAG,eAAe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AyC,CAAF;IAAY,OAAA,CACpD,6BAAK,SAAS,EAAC,iDAAiD;QAC7D,MAAM;QACP,oBAAC,eAAe,CAAC,KAAK,aACpB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,cAAc,EACd,gDAAgD,EAChD,SAAS,CACV,IACG,KAAK,GAER,QAAQ,CACa,CACpB,CACP,CAAA;CAAA,CAAC,CAAC;AACH,WAAW,CAAC,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC,WAAW,CAAC;AAE5D,IAAM,iBAAiB,GAAG,KAAK,CAAC,UAAU,CAGxC,UAAC,EAAuB,EAAE,GAAG;IAA1B,IAAA,SAAS,eAAA,EAAK,KAAK,cAArB,aAAuB,CAAF;IAAY,OAAA,CAClC,oBAAC,eAAe,CAAC,WAAW,aAC1B,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,WAAW,EACX,4DAA4D,EAC5D,SAAS,CACV,IACG,KAAK,EACT,CACH,CAAA;CAAA,CAAC,CAAC;AACH,iBAAiB,CAAC,WAAW,GAAG,eAAe,CAAC,WAAW,CAAC,WAAW,CAAC;AAExE,OAAO,EACL,MAAM,EACN,WAAW,EACX,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAC"}
|
|
@@ -4,6 +4,7 @@ declare const meta: Meta<typeof Dialog>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof Dialog>;
|
|
6
6
|
export declare const Basic: Story;
|
|
7
|
+
export declare const ToolValidation: Story;
|
|
7
8
|
export declare const WithForm: Story;
|
|
8
9
|
export declare const AlertDialog: Story;
|
|
9
10
|
export declare const LargeContent: Story;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/Dialog.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAKvD,OAAO,EACL,MAAM,
|
|
1
|
+
{"version":3,"file":"Dialog.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/Dialog.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAKvD,OAAO,EACL,MAAM,EASP,MAAM,uBAAuB,CAAC;AAE/B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CAI7B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,MAAM,CAAC,CAAC;AAErC,eAAO,MAAM,KAAK,EAAE,KAmCnB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KA6C5B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAkCtB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAgCzB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAmC1B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Button } from "../components";
|
|
3
|
-
import { Dialog, DialogContainer, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "../index_with_tw_base";
|
|
2
|
+
import { Avatar, Button, Input } from "../components";
|
|
3
|
+
import { Dialog, DialogContainer, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, SlackLogo, } from "../index_with_tw_base";
|
|
4
4
|
var meta = {
|
|
5
5
|
title: "Components/Dialog",
|
|
6
6
|
component: Dialog,
|
|
@@ -22,29 +22,59 @@ export var Basic = {
|
|
|
22
22
|
}, rightButtonProps: {
|
|
23
23
|
label: "Save Changes",
|
|
24
24
|
variant: "highlight",
|
|
25
|
+
}, permanentValidation: {
|
|
26
|
+
label: "Don't ask again",
|
|
27
|
+
checked: false,
|
|
28
|
+
onChange: function () { },
|
|
29
|
+
} })))); },
|
|
30
|
+
};
|
|
31
|
+
export var ToolValidation = {
|
|
32
|
+
render: function () { return (React.createElement(Dialog, null,
|
|
33
|
+
React.createElement(DialogTrigger, { asChild: true },
|
|
34
|
+
React.createElement(Button, { label: "Open Dialog" })),
|
|
35
|
+
React.createElement(DialogContent, null,
|
|
36
|
+
React.createElement(DialogHeader, null,
|
|
37
|
+
React.createElement(DialogTitle, { visual: React.createElement(Avatar, { size: "xs", icon: SlackLogo, hexBgColor: "#421D51" }) }, "Confirm tool usage")),
|
|
38
|
+
React.createElement(DialogContainer, null,
|
|
39
|
+
React.createElement("div", null,
|
|
40
|
+
"Allow [Agent_name] to use the tool (",
|
|
41
|
+
React.createElement("span", { className: "s-mono s-text-muted-foreground dark:s-text-muted-foreground-night" }, "[toolset_name]"),
|
|
42
|
+
",",
|
|
43
|
+
React.createElement("span", { className: "s-mono s-text-muted-foreground dark:s-text-muted-foreground-night" }, "[tool_name]"),
|
|
44
|
+
")?")),
|
|
45
|
+
React.createElement(DialogFooter, { leftButtonProps: {
|
|
46
|
+
label: "Cancel",
|
|
47
|
+
variant: "outline",
|
|
48
|
+
}, rightButtonProps: {
|
|
49
|
+
label: "Save Changes",
|
|
50
|
+
variant: "highlight",
|
|
51
|
+
}, permanentValidation: {
|
|
52
|
+
label: "Always allow",
|
|
53
|
+
checked: false,
|
|
54
|
+
onChange: function () { },
|
|
25
55
|
} })))); },
|
|
26
56
|
};
|
|
27
57
|
export var WithForm = {
|
|
28
58
|
render: function () { return (React.createElement(Dialog, null,
|
|
29
59
|
React.createElement(DialogTrigger, { asChild: true },
|
|
30
60
|
React.createElement(Button, { label: "Edit User" })),
|
|
31
|
-
React.createElement(DialogContent,
|
|
61
|
+
React.createElement(DialogContent, null,
|
|
32
62
|
React.createElement(DialogHeader, null,
|
|
33
63
|
React.createElement(DialogTitle, null, "Edit User Settings")),
|
|
34
64
|
React.createElement(DialogContainer, null,
|
|
35
|
-
React.createElement("div", { className: "s-grid s-gap-4
|
|
36
|
-
React.createElement(
|
|
37
|
-
|
|
38
|
-
React.createElement("input", { className: "s-border-input s-rounded-md s-border s-bg-transparent s-px-3 s-py-1 s-text-sm", placeholder: "Enter name..." })),
|
|
39
|
-
React.createElement("div", { className: "s-grid s-gap-2" },
|
|
40
|
-
React.createElement("label", { className: "s-text-sm s-font-semibold" }, "Email"),
|
|
41
|
-
React.createElement("input", { className: "s-border-input s-rounded-md s-border s-bg-transparent s-px-3 s-py-1 s-text-sm", placeholder: "Enter email...", type: "email" })))),
|
|
65
|
+
React.createElement("div", { className: "s-grid s-gap-4" },
|
|
66
|
+
React.createElement(Input, { label: "Email", placeholder: "Email" }),
|
|
67
|
+
React.createElement(Input, { label: "Username", placeholder: "Username" }))),
|
|
42
68
|
React.createElement(DialogFooter, { leftButtonProps: {
|
|
43
69
|
label: "Cancel",
|
|
44
|
-
variant: "
|
|
70
|
+
variant: "outline",
|
|
45
71
|
}, rightButtonProps: {
|
|
46
72
|
label: "Save",
|
|
47
|
-
variant: "
|
|
73
|
+
variant: "highlight",
|
|
74
|
+
}, permanentValidation: {
|
|
75
|
+
label: "Don't ask again",
|
|
76
|
+
checked: false,
|
|
77
|
+
onChange: function () { },
|
|
48
78
|
} })))); },
|
|
49
79
|
};
|
|
50
80
|
export var AlertDialog = {
|
|
@@ -53,14 +83,18 @@ export var AlertDialog = {
|
|
|
53
83
|
React.createElement(Button, { variant: "warning", label: "Delete Account" })),
|
|
54
84
|
React.createElement(DialogContent, { size: "md" },
|
|
55
85
|
React.createElement(DialogHeader, null,
|
|
56
|
-
React.createElement(DialogTitle, null, "Are you absolutely sure?"),
|
|
57
|
-
|
|
86
|
+
React.createElement(DialogTitle, null, "Are you absolutely sure?")),
|
|
87
|
+
React.createElement(DialogContainer, null, "This action cannot be undone. This will permanently delete your account and remove your data from our servers."),
|
|
58
88
|
React.createElement(DialogFooter, { leftButtonProps: {
|
|
59
89
|
label: "Cancel",
|
|
60
|
-
variant: "
|
|
90
|
+
variant: "outline",
|
|
61
91
|
}, rightButtonProps: {
|
|
62
92
|
label: "Delete Account",
|
|
63
93
|
variant: "warning",
|
|
94
|
+
}, permanentValidation: {
|
|
95
|
+
label: "Don't ask again",
|
|
96
|
+
checked: false,
|
|
97
|
+
onChange: function () { },
|
|
64
98
|
} })))); },
|
|
65
99
|
};
|
|
66
100
|
export var LargeContent = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.stories.js","sourceRoot":"","sources":["../../../src/stories/Dialog.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"Dialog.stories.js","sourceRoot":"","sources":["../../../src/stories/Dialog.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EACL,MAAM,EACN,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,aAAa,EACb,SAAS,GACV,MAAM,uBAAuB,CAAC;AAE/B,IAAM,IAAI,GAAwB;IAChC,KAAK,EAAE,mBAAmB;IAC1B,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,CAAC,UAAU,CAAC;CACnB,CAAC;AAEF,eAAe,IAAI,CAAC;AAGpB,MAAM,CAAC,IAAM,KAAK,GAAU;IAC1B,MAAM,EAAE,cAAM,OAAA,CACZ,oBAAC,MAAM;QACL,oBAAC,aAAa,IAAC,OAAO;YACpB,oBAAC,MAAM,IAAC,KAAK,EAAC,aAAa,GAAG,CAChB;QAChB,oBAAC,aAAa;YACZ,oBAAC,YAAY;gBACX,oBAAC,WAAW,uBAA2B;gBACvC,oBAAC,iBAAiB,qDAEE,CACP;YACf,oBAAC,eAAe,qF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EAAE,KAAK;oBACd,QAAQ,EAAE,cAAO,CAAC;iBACnB,GACD,CACY,CACT,CACV,EA9Ba,CA8Bb;CACF,CAAC;AAEF,MAAM,CAAC,IAAM,YAAY,GAAU;IACjC,MAAM,EAAE,cAAM,OAAA,CACZ,oBAAC,MAAM;QACL,oBAAC,aAAa,IAAC,OAAO;YACpB,oBAAC,MAAM,IAAC,KAAK,EAAC,YAAY,GAAG,CACf;QAChB,oBAAC,aAAa,IAAC,IAAI,EAAC,IAAI;YACtB,oBAAC,YAAY;gBACX,oBAAC,WAAW,2BAA+B,CAC9B;YACf,oBAAC,eAAe;gBACd,6BAAK,SAAS,EAAC,aAAa;oBAC1B,4BAAI,SAAS,EAAC,iBAAiB,sBAAqB;oBACpD,2BAAG,SAAS,EAAC,mCAAmC,4JAI5C;oBACJ,4BAAI,SAAS,EAAC,iBAAiB,sBAAqB;oBACpD,2BAAG,SAAS,EAAC,mCAAmC,4JAI5C;oBACJ,4BAAI,SAAS,EAAC,iBAAiB,wBAAuB;oBACtD,2BAAG,SAAS,EAAC,mCAAmC,4JAI5C,CACA,CACU,CACJ,CACT,CACV,EAjCa,CAiCb;CACF,CAAC"}
|
package/dist/sparkle.css
CHANGED
|
@@ -3528,10 +3528,6 @@ select {
|
|
|
3528
3528
|
background-color: rgb(169 184 169 / var(--tw-bg-opacity));
|
|
3529
3529
|
}
|
|
3530
3530
|
|
|
3531
|
-
.s-bg-transparent {
|
|
3532
|
-
background-color: transparent;
|
|
3533
|
-
}
|
|
3534
|
-
|
|
3535
3531
|
.s-bg-violet-100 {
|
|
3536
3532
|
--tw-bg-opacity: 1;
|
|
3537
3533
|
background-color: rgb(237 233 254 / var(--tw-bg-opacity));
|
|
@@ -4114,6 +4110,10 @@ select {
|
|
|
4114
4110
|
padding-top: 0.125rem;
|
|
4115
4111
|
}
|
|
4116
4112
|
|
|
4113
|
+
.s-pt-1 {
|
|
4114
|
+
padding-top: 0.25rem;
|
|
4115
|
+
}
|
|
4116
|
+
|
|
4117
4117
|
.s-pt-2 {
|
|
4118
4118
|
padding-top: 0.5rem;
|
|
4119
4119
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import { FocusScope } from "@radix-ui/react-focus-scope";
|
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
|
|
6
|
-
import { Button, ScrollArea } from "@sparkle/components";
|
|
6
|
+
import { Button, Checkbox, ScrollArea } from "@sparkle/components";
|
|
7
7
|
import { XMarkIcon } from "@sparkle/icons/app";
|
|
8
8
|
import { cn } from "@sparkle/lib/utils";
|
|
9
9
|
|
|
@@ -39,7 +39,8 @@ const sizeClasses: Record<DialogSizeType, string> = {
|
|
|
39
39
|
|
|
40
40
|
const dialogVariants = cva(
|
|
41
41
|
cn(
|
|
42
|
-
"s-fixed s-left-[50%] s-top-[50%] s-z-50 s-
|
|
42
|
+
"s-fixed s-left-[50%] s-top-[50%] s-z-50 s-overflow-hidden s-translate-x-[-50%] s-translate-y-[-50%] s-duration-200 data-[state=open]:s-animate-in data-[state=closed]:s-animate-out data-[state=closed]:s-fade-out-0 data-[state=open]:s-fade-in-0 data-[state=closed]:s-zoom-out-95 data-[state=open]:s-zoom-in-95 data-[state=closed]:s-slide-out-to-left-1/2 data-[state=closed]:s-slide-out-to-top-[48%] data-[state=open]:s-slide-in-from-left-1/2 data-[state=open]:s-slide-in-from-top-[48%]",
|
|
43
|
+
"s-rounded-2xl s-grid s-w-full s-border s-border s-shadow-lg s-sm:rounded-lg",
|
|
43
44
|
"s-bg-background dark:s-bg-background-night",
|
|
44
45
|
"s-border-border dark:s-border-border-night"
|
|
45
46
|
),
|
|
@@ -99,14 +100,14 @@ const DialogHeader = ({
|
|
|
99
100
|
}: NewDialogHeaderProps) => (
|
|
100
101
|
<div
|
|
101
102
|
className={cn(
|
|
102
|
-
"s-z-50 s-flex s-flex-none s-flex-col s-gap-0 s-
|
|
103
|
+
"s-z-50 s-flex s-flex-none s-flex-col s-gap-0 s-px-5 s-py-4 s-text-left",
|
|
103
104
|
className
|
|
104
105
|
)}
|
|
105
106
|
{...props}
|
|
106
107
|
>
|
|
107
108
|
{children}
|
|
108
109
|
<DialogClose asChild className="s-absolute s-right-3 s-top-3">
|
|
109
|
-
{!hideButton && <Button icon={XMarkIcon} variant="ghost" size="
|
|
110
|
+
{!hideButton && <Button icon={XMarkIcon} variant="ghost" size="mini" />}
|
|
110
111
|
</DialogClose>
|
|
111
112
|
</div>
|
|
112
113
|
);
|
|
@@ -118,7 +119,7 @@ const DialogContainer = ({
|
|
|
118
119
|
<ScrollArea className="s-w-full s-flex-grow">
|
|
119
120
|
<div
|
|
120
121
|
className={cn(
|
|
121
|
-
"s-relative s-flex s-flex-col s-gap-2 s-
|
|
122
|
+
"s-copy-base s-relative s-flex s-flex-col s-gap-2 s-px-5 s-py-4 s-text-left",
|
|
122
123
|
"s-text-foreground dark:s-text-foreground-night"
|
|
123
124
|
)}
|
|
124
125
|
>
|
|
@@ -132,6 +133,11 @@ interface DialogFooterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
132
133
|
leftButtonProps?: React.ComponentProps<typeof Button>;
|
|
133
134
|
rightButtonProps?: React.ComponentProps<typeof Button>;
|
|
134
135
|
dialogCloseClassName?: string;
|
|
136
|
+
permanentValidation?: {
|
|
137
|
+
label: string;
|
|
138
|
+
checked: boolean;
|
|
139
|
+
onChange: (event: React.FormEvent<HTMLButtonElement>) => void;
|
|
140
|
+
};
|
|
135
141
|
}
|
|
136
142
|
|
|
137
143
|
const DialogFooter = ({
|
|
@@ -140,49 +146,70 @@ const DialogFooter = ({
|
|
|
140
146
|
leftButtonProps,
|
|
141
147
|
rightButtonProps,
|
|
142
148
|
dialogCloseClassName,
|
|
149
|
+
permanentValidation,
|
|
143
150
|
...props
|
|
144
151
|
}: DialogFooterProps) => (
|
|
145
|
-
<div
|
|
146
|
-
|
|
147
|
-
"s-flex s-flex-
|
|
148
|
-
|
|
152
|
+
<div className="s-flex s-flex-col s-gap-0">
|
|
153
|
+
{permanentValidation && (
|
|
154
|
+
<div className="s-flex s-flex-row s-items-center s-gap-2 s-px-5 s-pt-3">
|
|
155
|
+
<Checkbox
|
|
156
|
+
checked={permanentValidation.checked}
|
|
157
|
+
onChange={permanentValidation.onChange}
|
|
158
|
+
/>
|
|
159
|
+
<label className="s-copy-sm s-text-foreground dark:s-text-foreground-night">
|
|
160
|
+
<strong>{permanentValidation.label}</strong>
|
|
161
|
+
</label>
|
|
162
|
+
</div>
|
|
149
163
|
)}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
164
|
+
<div
|
|
165
|
+
className={cn(
|
|
166
|
+
"s-flex s-flex-none s-flex-row s-justify-end s-gap-2 s-px-3 s-py-3",
|
|
167
|
+
className
|
|
168
|
+
)}
|
|
169
|
+
{...props}
|
|
170
|
+
>
|
|
171
|
+
{leftButtonProps &&
|
|
172
|
+
(leftButtonProps.disabled ? (
|
|
157
173
|
<Button {...leftButtonProps} />
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
174
|
+
) : (
|
|
175
|
+
<DialogClose className={dialogCloseClassName} asChild>
|
|
176
|
+
<Button {...leftButtonProps} />
|
|
177
|
+
</DialogClose>
|
|
178
|
+
))}
|
|
179
|
+
{rightButtonProps &&
|
|
180
|
+
(rightButtonProps.disabled ? (
|
|
165
181
|
<Button {...rightButtonProps} />
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
182
|
+
) : (
|
|
183
|
+
<DialogClose className={dialogCloseClassName} asChild>
|
|
184
|
+
<Button {...rightButtonProps} />
|
|
185
|
+
</DialogClose>
|
|
186
|
+
))}
|
|
187
|
+
{children}
|
|
188
|
+
</div>
|
|
169
189
|
</div>
|
|
170
190
|
);
|
|
171
191
|
DialogFooter.displayName = "DialogFooter";
|
|
172
192
|
|
|
173
193
|
const DialogTitle = React.forwardRef<
|
|
174
194
|
React.ElementRef<typeof DialogPrimitive.Title>,
|
|
175
|
-
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
195
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title> & {
|
|
196
|
+
visual?: React.ReactNode;
|
|
197
|
+
}
|
|
198
|
+
>(({ className, visual, children, ...props }, ref) => (
|
|
199
|
+
<div className="s-flex s-flex-row s-items-center s-gap-2 s-pt-1">
|
|
200
|
+
{visual}
|
|
201
|
+
<DialogPrimitive.Title
|
|
202
|
+
ref={ref}
|
|
203
|
+
className={cn(
|
|
204
|
+
"s-heading-lg",
|
|
205
|
+
"s-text-foreground dark:s-text-foreground-night",
|
|
206
|
+
className
|
|
207
|
+
)}
|
|
208
|
+
{...props}
|
|
209
|
+
>
|
|
210
|
+
{children}
|
|
211
|
+
</DialogPrimitive.Title>
|
|
212
|
+
</div>
|
|
186
213
|
));
|
|
187
214
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
188
215
|
|
|
@@ -193,7 +220,7 @@ const DialogDescription = React.forwardRef<
|
|
|
193
220
|
<DialogPrimitive.Description
|
|
194
221
|
ref={ref}
|
|
195
222
|
className={cn(
|
|
196
|
-
"s-
|
|
223
|
+
"s-copy-sm",
|
|
197
224
|
"s-text-muted-foreground dark:s-text-muted-foreground-night",
|
|
198
225
|
className
|
|
199
226
|
)}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
|
-
import { Button } from "@sparkle/components";
|
|
4
|
+
import { Avatar, Button, Input } from "@sparkle/components";
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
Dialog,
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
DialogHeader,
|
|
13
13
|
DialogTitle,
|
|
14
14
|
DialogTrigger,
|
|
15
|
+
SlackLogo,
|
|
15
16
|
} from "../index_with_tw_base";
|
|
16
17
|
|
|
17
18
|
const meta: Meta<typeof Dialog> = {
|
|
@@ -49,6 +50,58 @@ export const Basic: Story = {
|
|
|
49
50
|
label: "Save Changes",
|
|
50
51
|
variant: "highlight",
|
|
51
52
|
}}
|
|
53
|
+
permanentValidation={{
|
|
54
|
+
label: "Don't ask again",
|
|
55
|
+
checked: false,
|
|
56
|
+
onChange: () => {},
|
|
57
|
+
}}
|
|
58
|
+
/>
|
|
59
|
+
</DialogContent>
|
|
60
|
+
</Dialog>
|
|
61
|
+
),
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const ToolValidation: Story = {
|
|
65
|
+
render: () => (
|
|
66
|
+
<Dialog>
|
|
67
|
+
<DialogTrigger asChild>
|
|
68
|
+
<Button label="Open Dialog" />
|
|
69
|
+
</DialogTrigger>
|
|
70
|
+
<DialogContent>
|
|
71
|
+
<DialogHeader>
|
|
72
|
+
<DialogTitle
|
|
73
|
+
visual={<Avatar size="xs" icon={SlackLogo} hexBgColor="#421D51" />}
|
|
74
|
+
>
|
|
75
|
+
Confirm tool usage
|
|
76
|
+
</DialogTitle>
|
|
77
|
+
</DialogHeader>
|
|
78
|
+
<DialogContainer>
|
|
79
|
+
<div>
|
|
80
|
+
Allow [Agent_name] to use the tool (
|
|
81
|
+
<span className="s-mono s-text-muted-foreground dark:s-text-muted-foreground-night">
|
|
82
|
+
[toolset_name]
|
|
83
|
+
</span>
|
|
84
|
+
,
|
|
85
|
+
<span className="s-mono s-text-muted-foreground dark:s-text-muted-foreground-night">
|
|
86
|
+
[tool_name]
|
|
87
|
+
</span>
|
|
88
|
+
)?
|
|
89
|
+
</div>
|
|
90
|
+
</DialogContainer>
|
|
91
|
+
<DialogFooter
|
|
92
|
+
leftButtonProps={{
|
|
93
|
+
label: "Cancel",
|
|
94
|
+
variant: "outline",
|
|
95
|
+
}}
|
|
96
|
+
rightButtonProps={{
|
|
97
|
+
label: "Save Changes",
|
|
98
|
+
variant: "highlight",
|
|
99
|
+
}}
|
|
100
|
+
permanentValidation={{
|
|
101
|
+
label: "Always allow",
|
|
102
|
+
checked: false,
|
|
103
|
+
onChange: () => {},
|
|
104
|
+
}}
|
|
52
105
|
/>
|
|
53
106
|
</DialogContent>
|
|
54
107
|
</Dialog>
|
|
@@ -61,37 +114,29 @@ export const WithForm: Story = {
|
|
|
61
114
|
<DialogTrigger asChild>
|
|
62
115
|
<Button label="Edit User" />
|
|
63
116
|
</DialogTrigger>
|
|
64
|
-
<DialogContent
|
|
117
|
+
<DialogContent>
|
|
65
118
|
<DialogHeader>
|
|
66
119
|
<DialogTitle>Edit User Settings</DialogTitle>
|
|
67
120
|
</DialogHeader>
|
|
68
121
|
<DialogContainer>
|
|
69
|
-
<div className="s-grid s-gap-4
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
<input
|
|
73
|
-
className="s-border-input s-rounded-md s-border s-bg-transparent s-px-3 s-py-1 s-text-sm"
|
|
74
|
-
placeholder="Enter name..."
|
|
75
|
-
/>
|
|
76
|
-
</div>
|
|
77
|
-
<div className="s-grid s-gap-2">
|
|
78
|
-
<label className="s-text-sm s-font-semibold">Email</label>
|
|
79
|
-
<input
|
|
80
|
-
className="s-border-input s-rounded-md s-border s-bg-transparent s-px-3 s-py-1 s-text-sm"
|
|
81
|
-
placeholder="Enter email..."
|
|
82
|
-
type="email"
|
|
83
|
-
/>
|
|
84
|
-
</div>
|
|
122
|
+
<div className="s-grid s-gap-4">
|
|
123
|
+
<Input label="Email" placeholder="Email" />
|
|
124
|
+
<Input label="Username" placeholder="Username" />
|
|
85
125
|
</div>
|
|
86
126
|
</DialogContainer>
|
|
87
127
|
<DialogFooter
|
|
88
128
|
leftButtonProps={{
|
|
89
129
|
label: "Cancel",
|
|
90
|
-
variant: "
|
|
130
|
+
variant: "outline",
|
|
91
131
|
}}
|
|
92
132
|
rightButtonProps={{
|
|
93
133
|
label: "Save",
|
|
94
|
-
variant: "
|
|
134
|
+
variant: "highlight",
|
|
135
|
+
}}
|
|
136
|
+
permanentValidation={{
|
|
137
|
+
label: "Don't ask again",
|
|
138
|
+
checked: false,
|
|
139
|
+
onChange: () => {},
|
|
95
140
|
}}
|
|
96
141
|
/>
|
|
97
142
|
</DialogContent>
|
|
@@ -108,20 +153,25 @@ export const AlertDialog: Story = {
|
|
|
108
153
|
<DialogContent size="md">
|
|
109
154
|
<DialogHeader>
|
|
110
155
|
<DialogTitle>Are you absolutely sure?</DialogTitle>
|
|
111
|
-
<DialogDescription>
|
|
112
|
-
This action cannot be undone. This will permanently delete your
|
|
113
|
-
account and remove your data from our servers.
|
|
114
|
-
</DialogDescription>
|
|
115
156
|
</DialogHeader>
|
|
157
|
+
<DialogContainer>
|
|
158
|
+
This action cannot be undone. This will permanently delete your
|
|
159
|
+
account and remove your data from our servers.
|
|
160
|
+
</DialogContainer>
|
|
116
161
|
<DialogFooter
|
|
117
162
|
leftButtonProps={{
|
|
118
163
|
label: "Cancel",
|
|
119
|
-
variant: "
|
|
164
|
+
variant: "outline",
|
|
120
165
|
}}
|
|
121
166
|
rightButtonProps={{
|
|
122
167
|
label: "Delete Account",
|
|
123
168
|
variant: "warning",
|
|
124
169
|
}}
|
|
170
|
+
permanentValidation={{
|
|
171
|
+
label: "Don't ask again",
|
|
172
|
+
checked: false,
|
|
173
|
+
onChange: () => {},
|
|
174
|
+
}}
|
|
125
175
|
/>
|
|
126
176
|
</DialogContent>
|
|
127
177
|
</Dialog>
|