@dust-tt/sparkle 0.2.278 → 0.2.279

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.
@@ -1,4 +1,9 @@
1
1
  import React from "react";
2
+ export type NotificationType = {
3
+ title?: string;
4
+ description?: string;
5
+ type: "success" | "error";
6
+ };
2
7
  export interface NotificationProps {
3
8
  className?: string;
4
9
  description?: string;
@@ -7,4 +12,10 @@ export interface NotificationProps {
7
12
  onClick?: () => void;
8
13
  }
9
14
  export declare function Notification({ description, title, variant, onClick, className, }: NotificationProps): React.JSX.Element;
15
+ export declare namespace Notification {
16
+ var Area: ({ children }: {
17
+ children: React.ReactNode;
18
+ }) => React.JSX.Element;
19
+ }
20
+ export declare const useSendNotification: () => (n: NotificationType) => void;
10
21
  //# sourceMappingURL=Notification.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Notification.d.ts","sourceRoot":"","sources":["../../../src/components/Notification.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,YAAY,CAAC,EAC3B,WAAW,EACX,KAAK,EACL,OAAO,EACP,OAAO,EACP,SAAc,GACf,EAAE,iBAAiB,qBAiDnB"}
1
+ {"version":3,"file":"Notification.d.ts","sourceRoot":"","sources":["../../../src/components/Notification.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAWzC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;CAC3B,CAAC;AAKF,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,YAAY,CAAC,EAC3B,WAAW,EACX,KAAK,EACL,OAAO,EACP,OAAO,EACP,SAAc,GACf,EAAE,iBAAiB,qBAiDnB;yBAvDe,YAAY;;;;;AAoJ5B,eAAO,MAAM,mBAAmB,YA/JqB,gBAAgB,KAAK,IA+JK,CAAC"}
@@ -1,8 +1,13 @@
1
- import React from "react";
1
+ import { __assign, __read, __spreadArray } from "tslib";
2
+ import { Transition } from "@headlessui/react";
3
+ import React, { useEffect } from "react";
4
+ import { createPortal } from "react-dom";
2
5
  import { IconButton } from "../components/IconButton";
3
6
  import { CheckCircleIcon, XCircleIcon, XMarkIcon } from "../icons";
4
7
  import { classNames } from "../lib/utils";
5
8
  import { Icon } from "./Icon";
9
+ var NOTIFICATION_DELAY = 5000;
10
+ var NotificationsContext = React.createContext(function (n) { return n; });
6
11
  export function Notification(_a) {
7
12
  var description = _a.description, title = _a.title, variant = _a.variant, onClick = _a.onClick, _b = _a.className, className = _b === void 0 ? "" : _b;
8
13
  return (React.createElement("div", { className: classNames("s-pointer-events-auto s-flex s-max-w-[400px] s-flex-row s-items-center s-gap-2 s-rounded-xl s-border s-border-structure-100 s-bg-structure-0 s-p-4 s-shadow-xl", className) },
@@ -15,4 +20,44 @@ export function Notification(_a) {
15
20
  React.createElement(IconButton, { icon: XMarkIcon, size: "sm", variant: "ghost", onClick: onClick })),
16
21
  description && (React.createElement("div", { className: "s-line-clamp-3 s-pr-2 s-text-sm s-font-normal s-text-element-700" }, description)))));
17
22
  }
23
+ function NotificationWithTransition(_a) {
24
+ var title = _a.title, description = _a.description, type = _a.type;
25
+ var _b = __read(React.useState(true), 2), showNotification = _b[0], setShowNotification = _b[1];
26
+ useEffect(function () {
27
+ setTimeout(function () {
28
+ setShowNotification(false);
29
+ }, NOTIFICATION_DELAY);
30
+ }, []);
31
+ return (React.createElement(Transition, { show: showNotification, appear: true, enter: "s-transition s-ease-in-out s-duration-300 s-transform", enterFrom: "s-translate-y-16 s-opacity-0", enterTo: "s-translate-y-0 s-opacity-100", leave: "s-transition s-ease-in-out s-duration-300 s-transform", leaveFrom: "s-translate-y-0 s-opacity-100", leaveTo: "s-translate-y-16 s-opacity-0" },
32
+ React.createElement(Notification, { variant: type, description: description, title: title, onClick: function () { return setShowNotification(false); } })));
33
+ }
34
+ function NotificationsList(_a) {
35
+ var notifications = _a.notifications;
36
+ return (React.createElement("div", { className: "s-pointer-events-none s-fixed s-bottom-0 s-right-0 s-z-60 s-w-96" },
37
+ React.createElement("div", { className: "s-flex s-flex-col s-items-center s-justify-center s-gap-4 s-p-4" }, notifications.map(function (n) {
38
+ return (React.createElement(NotificationWithTransition, { key: n.id, title: n.title, description: n.description, type: n.type }));
39
+ }))));
40
+ }
41
+ Notification.Area = function (_a) {
42
+ var children = _a.children;
43
+ var _b = __read(React.useState([]), 2), notifications = _b[0], setNotifications = _b[1];
44
+ function sendNotification(n) {
45
+ var id = Math.random().toString();
46
+ setNotifications(function (notifications) { return __spreadArray(__spreadArray([], __read(notifications), false), [__assign(__assign({}, n), { id: id })], false); });
47
+ /* After a delay allowing for the notification exit animation, remove the
48
+ notification from the list */
49
+ setTimeout(function () {
50
+ setNotifications(function (notifications) {
51
+ return notifications.filter(function (n) { return n.id !== id; });
52
+ });
53
+ }, NOTIFICATION_DELAY + 1000);
54
+ }
55
+ return (React.createElement(NotificationsContext.Provider, { value: sendNotification },
56
+ children,
57
+ /** Notifications are created at DOM root via a Portal. This is to avoid
58
+ * them being made inert by headlessUI modals */
59
+ typeof window === "object" ? (createPortal(React.createElement(NotificationsList, { notifications: notifications }), document.body)) : (React.createElement(NotificationsList, { notifications: notifications })) // SSR (otherwise hydration issues)
60
+ ));
61
+ };
62
+ export var useSendNotification = function () { return React.useContext(NotificationsContext); };
18
63
  //# sourceMappingURL=Notification.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Notification.js","sourceRoot":"","sources":["../../../src/components/Notification.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAU9B,MAAM,UAAU,YAAY,CAAC,EAMT;QALlB,WAAW,iBAAA,EACX,KAAK,WAAA,EACL,OAAO,aAAA,EACP,OAAO,aAAA,EACP,iBAAc,EAAd,SAAS,mBAAG,EAAE,KAAA;IAEd,OAAO,CACL,6BACE,SAAS,EAAE,UAAU,CACnB,gKAAgK,EAChK,SAAS,CACV;QAEA,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CACvB,oBAAC,IAAI,IACH,IAAI,EAAC,IAAI,EACT,MAAM,EAAE,eAAe,EACvB,SAAS,EAAC,6BAA6B,GACvC,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,IAAI,IACH,IAAI,EAAC,IAAI,EACT,MAAM,EAAE,WAAW,EACnB,SAAS,EAAC,6BAA6B,GACvC,CACH;QAED,6BAAK,SAAS,EAAC,mBAAmB;YAChC,6BAAK,SAAS,EAAC,kCAAkC;gBAC/C,6BACE,SAAS,EAAE,UAAU,CACnB,iDAAiD,EACjD,OAAO,KAAK,SAAS;wBACnB,CAAC,CAAC,oBAAoB;wBACtB,CAAC,CAAC,oBAAoB,CACzB,IAEA,KAAK,IAAI,OAAO,CACb;gBACN,oBAAC,UAAU,IACT,IAAI,EAAE,SAAS,EACf,IAAI,EAAC,IAAI,EACT,OAAO,EAAC,OAAO,EACf,OAAO,EAAE,OAAO,GAChB,CACE;YACL,WAAW,IAAI,CACd,6BAAK,SAAS,EAAC,kEAAkE,IAC9E,WAAW,CACR,CACP,CACG,CACF,CACP,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"Notification.js","sourceRoot":"","sources":["../../../src/components/Notification.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,IAAM,kBAAkB,GAAG,IAAI,CAAC;AAQhC,IAAM,oBAAoB,GAAG,KAAK,CAAC,aAAa,CAC9C,UAAC,CAAC,IAAK,OAAA,CAAC,EAAD,CAAC,CACT,CAAC;AASF,MAAM,UAAU,YAAY,CAAC,EAMT;QALlB,WAAW,iBAAA,EACX,KAAK,WAAA,EACL,OAAO,aAAA,EACP,OAAO,aAAA,EACP,iBAAc,EAAd,SAAS,mBAAG,EAAE,KAAA;IAEd,OAAO,CACL,6BACE,SAAS,EAAE,UAAU,CACnB,gKAAgK,EAChK,SAAS,CACV;QAEA,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CACvB,oBAAC,IAAI,IACH,IAAI,EAAC,IAAI,EACT,MAAM,EAAE,eAAe,EACvB,SAAS,EAAC,6BAA6B,GACvC,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,IAAI,IACH,IAAI,EAAC,IAAI,EACT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;wDACgD;QAChD,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,CAC3B,YAAY,CACV,oBAAC,iBAAiB,IAAC,aAAa,EAAE,aAAa,GAAI,EACnD,QAAQ,CAAC,IAAI,CACd,CACF,CAAC,CAAC,CAAC,CACF,oBAAC,iBAAiB,IAAC,aAAa,EAAE,aAAa,GAAI,CACpD,CAAC,mCAAmC;KAET,CACjC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,mBAAmB,GAAG,cAAM,OAAA,KAAK,CAAC,UAAU,CAAC,oBAAoB,CAAC,EAAtC,CAAsC,CAAC"}
@@ -42,7 +42,8 @@ export { Markdown } from "./Markdown";
42
42
  export { Modal } from "./Modal";
43
43
  export { NavigationList, NavigationListItem, NavigationListLabel, } from "./NavigationList";
44
44
  export { NewDropdownMenu, NewDropdownMenuCheckboxItem, NewDropdownMenuContent, NewDropdownMenuGroup, NewDropdownMenuItem, NewDropdownMenuLabel, NewDropdownMenuPortal, NewDropdownMenuRadioGroup, NewDropdownMenuRadioItem, NewDropdownMenuSeparator, NewDropdownMenuShortcut, NewDropdownMenuSub, NewDropdownMenuSubContent, NewDropdownMenuSubTrigger, NewDropdownMenuTrigger, } from "./NewDropdown";
45
- export { Notification } from "./Notification";
45
+ export type { NotificationType } from "./Notification";
46
+ export { Notification, useSendNotification } from "./Notification";
46
47
  export { Page } from "./Page";
47
48
  export { PaginatedCitationsGrid } from "./PaginatedCitationsGrid";
48
49
  export { Pagination } from "./Pagination";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,E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O,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EACL,OAAO,EACP,cAAc,EACd,WAAW,EACX,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EACL,OAAO,EACP,cAAc,EACd,eAAe,EACf,WAAW,EACX,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC"}
@@ -38,7 +38,7 @@ export { Markdown } from "./Markdown";
38
38
  export { Modal } from "./Modal";
39
39
  export { NavigationList, NavigationListItem, NavigationListLabel, } from "./NavigationList";
40
40
  export { NewDropdownMenu, NewDropdownMenuCheckboxItem, NewDropdownMenuContent, NewDropdownMenuGroup, NewDropdownMenuItem, NewDropdownMenuLabel, NewDropdownMenuPortal, NewDropdownMenuRadioGroup, NewDropdownMenuRadioItem, NewDropdownMenuSeparator, NewDropdownMenuShortcut, NewDropdownMenuSub, NewDropdownMenuSubContent, NewDropdownMenuSubTrigger, NewDropdownMenuTrigger, } from "./NewDropdown";
41
- export { Notification } from "./Notification";
41
+ export { Notification, useSendNotification } from "./Notification";
42
42
  export { Page } from "./Page";
43
43
  export { PaginatedCitationsGrid } from "./PaginatedCitationsGrid";
44
44
  export { Pagination } from "./Pagination";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,8BAA8B,GAC/B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;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Ac,CAAC;AAC1C,OAAO,EACL,OAAO,EACP,cAAc,EACd,WAAW,EACX,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EACL,OAAO,EACP,cAAc,EACd,eAAe,EACf,WAAW,EACX,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC"}
@@ -1,9 +1,8 @@
1
+ import type { Meta } from "@storybook/react";
1
2
  import React from "react";
2
3
  import { Notification } from "../index_with_tw_base";
3
- declare const meta: {
4
- title: string;
5
- component: typeof Notification;
6
- };
4
+ declare const meta: Meta<typeof Notification>;
7
5
  export default meta;
8
6
  export declare const NotificationExample: () => React.JSX.Element;
7
+ export declare const NotificationAreaExample: () => React.JSX.Element;
9
8
  //# sourceMappingURL=Notification.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Notification.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/Notification.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,QAAA,MAAM,IAAI;;;CAG2B,CAAC;AAEtC,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,mBAAmB,yBAyB/B,CAAC"}
1
+ {"version":3,"file":"Notification.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/Notification.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAU,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE7D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAUC,CAAC;AAEtC,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,mBAAmB,yBAyB/B,CAAC;AAEF,eAAO,MAAM,uBAAuB,yBAcnC,CAAC"}
@@ -1,8 +1,13 @@
1
1
  import React from "react";
2
- import { Notification } from "../index_with_tw_base";
2
+ import { useSendNotification } from "../components/Notification";
3
+ import { Button, Notification } from "../index_with_tw_base";
3
4
  var meta = {
4
5
  title: "Modules/Notification",
5
6
  component: Notification,
7
+ decorators: [
8
+ function (Story) { return (React.createElement(Notification.Area, null,
9
+ React.createElement(Story, null))); },
10
+ ],
6
11
  };
7
12
  export default meta;
8
13
  export var NotificationExample = function () {
@@ -14,4 +19,14 @@ export var NotificationExample = function () {
14
19
  React.createElement(Notification, { title: "Failure", variant: "error" })),
15
20
  React.createElement(Notification, { title: "Failure with a very long title clamped on one line.", description: 'Got: {"error":{"type":"invalid_request_error","message":"Invalid request body: Expecting string at name but instead got: undefined"}}', variant: "error" }))));
16
21
  };
22
+ export var NotificationAreaExample = function () {
23
+ var sendNotification = useSendNotification();
24
+ return (React.createElement(Button, { onClick: function () {
25
+ return sendNotification({
26
+ title: "Success",
27
+ description: "it works",
28
+ type: "success",
29
+ });
30
+ }, label: "click" }));
31
+ };
17
32
  //# sourceMappingURL=Notification.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Notification.stories.js","sourceRoot":"","sources":["../../../src/stories/Notification.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,IAAM,IAAI,GAAG;IACX,KAAK,EAAE,sBAAsB;IAC7B,SAAS,EAAE,YAAY;CACY,CAAC;AAEtC,eAAe,IAAI,CAAC;AAEpB,MAAM,CAAC,IAAM,mBAAmB,GAAG;IACjC,OAAO,CACL;QACE,6BAAK,SAAS,EAAC,gBAAgB;YAC7B,oBAAC,YAAY,IACX,KAAK,EAAC,SAAS,EACf,WAAW,EAAC,gCAAgC,EAC5C,OAAO,EAAC,SAAS,GACjB;YACF,oBAAC,YAAY,IACX,KAAK,EAAC,SAAS,EACf,WAAW,EAAC,gCAAgC,EAC5C,OAAO,EAAC,OAAO,GACf;YACF;gBACE,oBAAC,YAAY,IAAC,KAAK,EAAC,SAAS,EAAC,OAAO,EAAC,OAAO,GAAG,CAC5C;YACN,oBAAC,YAAY,IACX,KAAK,EAAC,qDAAqD,EAC3D,WAAW,EAAC,uIAAuI,EACnJ,OAAO,EAAC,OAAO,GACf,CACE,CACL,CACJ,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"Notification.stories.js","sourceRoot":"","sources":["../../../src/stories/Notification.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE7D,IAAM,IAAI,GAA8B;IACtC,KAAK,EAAE,sBAAsB;IAC7B,SAAS,EAAE,YAAY;IACvB,UAAU,EAAE;QACV,UAAC,KAAK,IAAK,OAAA,CACT,oBAAC,YAAY,CAAC,IAAI;YAChB,oBAAC,KAAK,OAAG,CACS,CACrB,EAJU,CAIV;KACF;CACkC,CAAC;AAEtC,eAAe,IAAI,CAAC;AAEpB,MAAM,CAAC,IAAM,mBAAmB,GAAG;IACjC,OAAO,CACL;QACE,6BAAK,SAAS,EAAC,gBAAgB;YAC7B,oBAAC,YAAY,IACX,KAAK,EAAC,SAAS,EACf,WAAW,EAAC,gCAAgC,EAC5C,OAAO,EAAC,SAAS,GACjB;YACF,oBAAC,YAAY,IACX,KAAK,EAAC,SAAS,EACf,WAAW,EAAC,gCAAgC,EAC5C,OAAO,EAAC,OAAO,GACf;YACF;gBACE,oBAAC,YAAY,IAAC,KAAK,EAAC,SAAS,EAAC,OAAO,EAAC,OAAO,GAAG,CAC5C;YACN,oBAAC,YAAY,IACX,KAAK,EAAC,qDAAqD,EAC3D,WAAW,EAAC,uIAAuI,EACnJ,OAAO,EAAC,OAAO,GACf,CACE,CACL,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,uBAAuB,GAAG;IACrC,IAAM,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;IAC/C,OAAO,CACL,oBAAC,MAAM,IACL,OAAO,EAAE;YACP,OAAA,gBAAgB,CAAC;gBACf,KAAK,EAAE,SAAS;gBAChB,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;aAChB,CAAC;QAJF,CAIE,EAEJ,KAAK,EAAC,OAAO,GACb,CACH,CAAC;AACJ,CAAC,CAAC"}
package/dist/sparkle.css CHANGED
@@ -789,6 +789,10 @@ select {
789
789
  z-index: 50;
790
790
  }
791
791
 
792
+ .s-z-60 {
793
+ z-index: 60;
794
+ }
795
+
792
796
  .s-col-span-2 {
793
797
  grid-column: span 2 / span 2;
794
798
  }
@@ -1421,6 +1425,11 @@ select {
1421
1425
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
1422
1426
  }
1423
1427
 
1428
+ .s-translate-y-16 {
1429
+ --tw-translate-y: 4rem;
1430
+ transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
1431
+ }
1432
+
1424
1433
  .s-translate-y-4 {
1425
1434
  --tw-translate-y: 1rem;
1426
1435
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
@@ -4408,6 +4417,10 @@ select {
4408
4417
  transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
4409
4418
  }
4410
4419
 
4420
+ .s-ease-in-out {
4421
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
4422
+ }
4423
+
4411
4424
  .s-ease-out {
4412
4425
  transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
4413
4426
  }
@@ -4477,6 +4490,10 @@ select {
4477
4490
  animation-timing-function: cubic-bezier(0.4, 0, 1, 1);
4478
4491
  }
4479
4492
 
4493
+ .s-ease-in-out {
4494
+ animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
4495
+ }
4496
+
4480
4497
  .s-ease-out {
4481
4498
  animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
4482
4499
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dust-tt/sparkle",
3
- "version": "0.2.278",
3
+ "version": "0.2.279",
4
4
  "scripts": {
5
5
  "build": "rm -rf dist && npm run tailwind && npm run build:esm && npm run build:cjs",
6
6
  "tailwind": "tailwindcss -i ./src/styles/tailwind.css -o dist/sparkle.css",
@@ -45,7 +45,8 @@
45
45
  "@storybook/testing-library": "^0.2.2",
46
46
  "@svgr/cli": "^8.0.1",
47
47
  "@tailwindcss/forms": "^0.5.3",
48
- "@types/react": "^18.0.28",
48
+ "@types/react": "^18.2.0",
49
+ "@types/react-dom": "^18.2.0",
49
50
  "@types/uuid": "^9.0.6",
50
51
  "@typescript-eslint/eslint-plugin": "^7.9.0",
51
52
  "@typescript-eslint/parser": "^7.9.0",
@@ -77,7 +78,8 @@
77
78
  "uuid": "^9.0.1"
78
79
  },
79
80
  "peerDependencies": {
80
- "react": "^18.2.0"
81
+ "react": "^18.2.0",
82
+ "react-dom": "^18.2.0"
81
83
  },
82
84
  "description": "Sparkle is Dust's Design System",
83
85
  "repository": {
@@ -1,4 +1,6 @@
1
- import React from "react";
1
+ import { Transition } from "@headlessui/react";
2
+ import React, { useEffect } from "react";
3
+ import { createPortal } from "react-dom";
2
4
 
3
5
  import { IconButton } from "@sparkle/components/IconButton";
4
6
  import { CheckCircleIcon, XCircleIcon, XMarkIcon } from "@sparkle/icons";
@@ -6,6 +8,17 @@ import { classNames } from "@sparkle/lib/utils";
6
8
 
7
9
  import { Icon } from "./Icon";
8
10
 
11
+ const NOTIFICATION_DELAY = 5000;
12
+
13
+ export type NotificationType = {
14
+ title?: string;
15
+ description?: string;
16
+ type: "success" | "error";
17
+ };
18
+
19
+ const NotificationsContext = React.createContext<(n: NotificationType) => void>(
20
+ (n) => n
21
+ );
9
22
  export interface NotificationProps {
10
23
  className?: string;
11
24
  description?: string;
@@ -70,3 +83,96 @@ export function Notification({
70
83
  </div>
71
84
  );
72
85
  }
86
+
87
+ function NotificationWithTransition({
88
+ title,
89
+ description,
90
+ type,
91
+ }: NotificationType) {
92
+ const [showNotification, setShowNotification] = React.useState(true);
93
+ useEffect(() => {
94
+ setTimeout(() => {
95
+ setShowNotification(false);
96
+ }, NOTIFICATION_DELAY);
97
+ }, []);
98
+ return (
99
+ <Transition
100
+ show={showNotification}
101
+ appear={true}
102
+ enter="s-transition s-ease-in-out s-duration-300 s-transform"
103
+ enterFrom="s-translate-y-16 s-opacity-0"
104
+ enterTo="s-translate-y-0 s-opacity-100"
105
+ leave="s-transition s-ease-in-out s-duration-300 s-transform"
106
+ leaveFrom="s-translate-y-0 s-opacity-100"
107
+ leaveTo="s-translate-y-16 s-opacity-0"
108
+ >
109
+ <Notification
110
+ variant={type}
111
+ description={description}
112
+ title={title}
113
+ onClick={() => setShowNotification(false)}
114
+ />
115
+ </Transition>
116
+ );
117
+ }
118
+
119
+ function NotificationsList({
120
+ notifications,
121
+ }: {
122
+ notifications: (NotificationType & { id: string })[];
123
+ }) {
124
+ return (
125
+ <div className="s-pointer-events-none s-fixed s-bottom-0 s-right-0 s-z-60 s-w-96">
126
+ <div className="s-flex s-flex-col s-items-center s-justify-center s-gap-4 s-p-4">
127
+ {notifications.map((n) => {
128
+ return (
129
+ <NotificationWithTransition
130
+ key={n.id}
131
+ title={n.title}
132
+ description={n.description}
133
+ type={n.type}
134
+ />
135
+ );
136
+ })}
137
+ </div>
138
+ </div>
139
+ );
140
+ }
141
+
142
+ Notification.Area = ({ children }: { children: React.ReactNode }) => {
143
+ const [notifications, setNotifications] = React.useState<
144
+ (NotificationType & { id: string })[]
145
+ >([]);
146
+
147
+ function sendNotification(n: NotificationType) {
148
+ const id = Math.random().toString();
149
+ setNotifications((notifications) => [...notifications, { ...n, id }]);
150
+ /* After a delay allowing for the notification exit animation, remove the
151
+ notification from the list */
152
+ setTimeout(() => {
153
+ setNotifications((notifications) =>
154
+ notifications.filter((n) => n.id !== id)
155
+ );
156
+ }, NOTIFICATION_DELAY + 1000);
157
+ }
158
+
159
+ return (
160
+ <NotificationsContext.Provider value={sendNotification}>
161
+ {children}
162
+ {
163
+ /** Notifications are created at DOM root via a Portal. This is to avoid
164
+ * them being made inert by headlessUI modals */
165
+ typeof window === "object" ? (
166
+ createPortal(
167
+ <NotificationsList notifications={notifications} />,
168
+ document.body
169
+ )
170
+ ) : (
171
+ <NotificationsList notifications={notifications} />
172
+ ) // SSR (otherwise hydration issues)
173
+ }
174
+ </NotificationsContext.Provider>
175
+ );
176
+ };
177
+
178
+ export const useSendNotification = () => React.useContext(NotificationsContext);
@@ -66,7 +66,8 @@ export {
66
66
  NewDropdownMenuSubTrigger,
67
67
  NewDropdownMenuTrigger,
68
68
  } from "./NewDropdown";
69
- export { Notification } from "./Notification";
69
+ export type { NotificationType } from "./Notification";
70
+ export { Notification, useSendNotification } from "./Notification";
70
71
  export { Page } from "./Page";
71
72
  export { PaginatedCitationsGrid } from "./PaginatedCitationsGrid";
72
73
  export { Pagination } from "./Pagination";
@@ -1,11 +1,20 @@
1
1
  import type { Meta } from "@storybook/react";
2
2
  import React from "react";
3
3
 
4
- import { Notification } from "../index_with_tw_base";
4
+ import { useSendNotification } from "@sparkle/components/Notification";
5
5
 
6
- const meta = {
6
+ import { Button, Notification } from "../index_with_tw_base";
7
+
8
+ const meta: Meta<typeof Notification> = {
7
9
  title: "Modules/Notification",
8
10
  component: Notification,
11
+ decorators: [
12
+ (Story) => (
13
+ <Notification.Area>
14
+ <Story />
15
+ </Notification.Area>
16
+ ),
17
+ ],
9
18
  } satisfies Meta<typeof Notification>;
10
19
 
11
20
  export default meta;
@@ -36,3 +45,19 @@ export const NotificationExample = () => {
36
45
  </>
37
46
  );
38
47
  };
48
+
49
+ export const NotificationAreaExample = () => {
50
+ const sendNotification = useSendNotification();
51
+ return (
52
+ <Button
53
+ onClick={() =>
54
+ sendNotification({
55
+ title: "Success",
56
+ description: "it works",
57
+ type: "success",
58
+ })
59
+ }
60
+ label="click"
61
+ />
62
+ );
63
+ };