@dust-tt/sparkle 0.2.180 → 0.2.181

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,17 +1,18 @@
1
1
  import React, { ReactNode } from "react";
2
2
  export type CitationType = "confluence" | "document" | "github" | "google_drive" | "image" | "intercom" | "microsoft" | "notion" | "slack";
3
3
  interface CitationProps {
4
- type?: CitationType;
5
- title: string;
4
+ avatarSrc?: string;
6
5
  description?: string;
6
+ href?: string;
7
+ imgSrc?: string;
7
8
  index?: ReactNode;
8
9
  isBlinking?: boolean;
9
- href?: string;
10
+ isLoading?: boolean;
11
+ onClose?: () => void;
10
12
  size?: "xs" | "sm";
11
13
  sizing?: "fixed" | "fluid";
12
- onClose?: () => void;
13
- avatarSrc?: string;
14
- imgSrc?: string;
14
+ title: string;
15
+ type?: CitationType;
15
16
  }
16
- export declare function Citation({ title, index, type, size, sizing, description, href, onClose, isBlinking, avatarSrc, imgSrc, }: CitationProps): React.JSX.Element;
17
+ export declare function Citation({ avatarSrc, description, href, imgSrc, index, isBlinking, isLoading, onClose, size, sizing, title, type, }: CitationProps): React.JSX.Element;
17
18
  export {};
package/dist/cjs/index.js CHANGED
@@ -75633,7 +75633,7 @@ var typeSizing = {
75633
75633
  fluid: "s-w-full",
75634
75634
  };
75635
75635
  function Citation(_a) {
75636
- var title = _a.title, index = _a.index, _b = _a.type, type = _b === void 0 ? "document" : _b, _c = _a.size, size = _c === void 0 ? "sm" : _c, _d = _a.sizing, sizing = _d === void 0 ? "fixed" : _d, description = _a.description, href = _a.href, onClose = _a.onClose, _e = _a.isBlinking, isBlinking = _e === void 0 ? false : _e, avatarSrc = _a.avatarSrc, imgSrc = _a.imgSrc;
75636
+ var avatarSrc = _a.avatarSrc, description = _a.description, href = _a.href, imgSrc = _a.imgSrc, index = _a.index, _b = _a.isBlinking, isBlinking = _b === void 0 ? false : _b, isLoading = _a.isLoading, onClose = _a.onClose, _c = _a.size, size = _c === void 0 ? "sm" : _c, _d = _a.sizing, sizing = _d === void 0 ? "fixed" : _d, title = _a.title, _e = _a.type, type = _e === void 0 ? "document" : _e;
75637
75637
  var cardContent = (React.createElement(React.Fragment, null,
75638
75638
  type === "image" && imgSrc && (React.createElement("div", { className: "s-absolute s-left-0 s-top-0 s-brightness-90 s-filter s-transition s-duration-200 s-ease-out hover:s-brightness-110 active:s-brightness-100 group-hover:s-brightness-110 group-hover:s-filter group-active:s-brightness-100", style: {
75639
75639
  backgroundImage: "url(".concat(imgSrc, ")"),
@@ -75645,7 +75645,7 @@ function Citation(_a) {
75645
75645
  React.createElement("div", { className: "s-flex s-items-center s-gap-2" },
75646
75646
  avatarSrc && React.createElement(Avatar, { visual: avatarSrc, size: "xs" }),
75647
75647
  index && (React.createElement("div", { className: classNames("s-flex s-items-center s-justify-center s-rounded-full s-border s-border-violet-200 s-bg-violet-100 s-text-xs s-font-semibold s-text-element-800", size === "sm" ? "s-h-5 s-w-5" : "s-h-4 s-w-4") }, index)),
75648
- React.createElement(Icon, { visual: typeIcons[type], className: "s-text-element-700" }),
75648
+ !isLoading && (React.createElement(Icon, { visual: typeIcons[type], className: "s-text-element-700" })),
75649
75649
  React.createElement("div", { className: "s-flex-grow s-text-xs" }),
75650
75650
  onClose && (React.createElement("div", { className: classNames(type === "image"
75651
75651
  ? "s-z-50 s-h-5 s-w-5 s-rounded-full s-bg-slate-950/30"
@@ -75654,12 +75654,10 @@ function Citation(_a) {
75654
75654
  React.createElement(Tooltip, { label: title, position: "above" },
75655
75655
  React.createElement("div", { className: classNames("s-line-clamp-1 s-text-sm s-text-element-800", size === "sm" ? "s-font-bold" : "s-font-semibold") }, title)),
75656
75656
  description && (React.createElement("div", { className: "s-line-clamp-2 s-text-xs s-font-normal s-text-element-700" }, description))));
75657
- if (href) {
75658
- return (React.createElement(CardButton, { variant: "secondary", size: "sm", href: href, target: "_blank", rel: "noopener noreferrer", className: classNames("s-relative s-flex s-w-48 s-flex-none s-flex-col s-gap-1", sizing === "fluid" ? typeSizing[sizing] : typeSizing[sizing][size], size === "sm" ? "sm:s-w-64" : "", isBlinking ? "s-animate-[bgblink_500ms_3]" : "", type === "image" ? "s-min-h-20" : "") }, cardContent));
75659
- }
75660
- else {
75661
- return (React.createElement(CardButton, { variant: "secondary", size: "sm", className: classNames("s-relative s-flex s-w-48 s-flex-none s-flex-col s-gap-1", sizing === "fluid" ? typeSizing[sizing] : typeSizing[sizing][size], size === "sm" ? "sm:s-w-64" : "", isBlinking ? "s-animate-[bgblink_500ms_3]" : "", type === "image" ? "s-min-h-20" : "") }, cardContent));
75662
- }
75657
+ return (React.createElement(CardButton, __assign({ variant: "secondary", size: "sm", className: classNames("s-relative s-flex s-w-48 s-flex-none s-flex-col s-gap-1", sizing === "fluid" ? typeSizing[sizing] : typeSizing[sizing][size], size === "sm" ? "sm:s-w-64" : "", isBlinking ? "s-animate-[bgblink_500ms_3]" : "", type === "image" ? "s-min-h-20" : "") }, (href && { href: href, target: "_blank", rel: "noopener noreferrer" })),
75658
+ isLoading && (React.createElement("div", { className: "s-absolute s-inset-0 s-flex s-items-center s-justify-center" },
75659
+ React.createElement(Spinner, { size: "xs", variant: "color" }))),
75660
+ React.createElement("div", { className: isLoading ? "s-opacity-50" : "" }, cardContent)));
75663
75661
  }
75664
75662
 
75665
75663
  function ZoomableImageCitationWrapper(_a) {