@dust-tt/sparkle 0.2.6 → 0.2.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.
@@ -7,8 +7,9 @@ type AvatarProps = {
7
7
  onClick?: () => void;
8
8
  busy?: boolean;
9
9
  isRounded?: boolean;
10
+ backgroundColor?: string;
10
11
  };
11
- export declare function Avatar({ size, name, visual, onClick, clickable, busy, isRounded, }: AvatarProps): React.JSX.Element;
12
+ export declare function Avatar({ size, name, visual, onClick, clickable, busy, isRounded, backgroundColor, }: AvatarProps): React.JSX.Element;
12
13
  export declare namespace Avatar {
13
14
  var Stack: ({ children, nbMoreItems, size, isRounded, hasMagnifier, }: AvatarStackProps) => React.JSX.Element;
14
15
  }
@@ -5,7 +5,7 @@ interface CitationProps {
5
5
  description?: string;
6
6
  index?: ReactNode;
7
7
  isBlinking?: boolean;
8
- href: string;
8
+ href?: string;
9
9
  }
10
10
  export declare function Citation({ title, index, type, description, href, isBlinking, }: CitationProps): React.JSX.Element;
11
11
  export {};
package/dist/cjs/index.js CHANGED
@@ -413,7 +413,7 @@ var textSize = {
413
413
  auto: "s-text-xl",
414
414
  };
415
415
  function Avatar(_a) {
416
- var _b = _a.size, size = _b === void 0 ? "md" : _b, name = _a.name, visual = _a.visual, onClick = _a.onClick, _c = _a.clickable, clickable = _c === void 0 ? false : _c, _d = _a.busy, busy = _d === void 0 ? false : _d, _e = _a.isRounded, isRounded = _e === void 0 ? false : _e;
416
+ var _b = _a.size, size = _b === void 0 ? "md" : _b, name = _a.name, visual = _a.visual, onClick = _a.onClick, _c = _a.clickable, clickable = _c === void 0 ? false : _c, _d = _a.busy, busy = _d === void 0 ? false : _d, _e = _a.isRounded, isRounded = _e === void 0 ? false : _e, backgroundColor = _a.backgroundColor;
417
417
  var getColor = function (name) {
418
418
  if (/\+/.test(name)) {
419
419
  //find if there is a plus
@@ -439,7 +439,11 @@ function Avatar(_a) {
439
439
  ? "s-cursor-pointer hover:s-filter hover:s-brightness-110 active:s-brightness-90 s-transition s-duration-200 s-ease-out"
440
440
  : "";
441
441
  var busyStyles = busy ? "s-animate-breathing s-cursor-default" : "";
442
- var avatarClass = classNames(sizeClasses$4[size], isRounded ? "s-rounded-full" : roundedClasses[size], name ? getColor(name) : "s-bg-slate-200", "s-flex s-flex-shrink-0 s-items-center s-justify-center s-overflow-hidden", clickableStyles, busyStyles);
442
+ var avatarClass = classNames(sizeClasses$4[size], isRounded ? "s-rounded-full" : roundedClasses[size], backgroundColor
443
+ ? backgroundColor
444
+ : name
445
+ ? getColor(name)
446
+ : "s-bg-slate-200", "s-flex s-flex-shrink-0 s-items-center s-justify-center s-overflow-hidden", clickableStyles, busyStyles);
443
447
  return (React.createElement("div", { className: avatarClass },
444
448
  size === "auto" && React.createElement("div", { style: { paddingBottom: "100%" } }),
445
449
  typeof visual === "string" ? (React.createElement("img", { src: visual, alt: name, className: classNames(sizeClasses$4[size], "s-h-full s-w-full s-object-cover s-object-center") })) : visual ? (visual) : name ? (React.createElement("span", { className: classNames(getTextVariant(name), textSize[size], "s-select-none s-font-medium") }, /\+/.test(name) ? name : name[0].toUpperCase())) : (React.createElement(SvgUser$1, { className: "s-h-1/2 s-w-1/2 s-opacity-20" }))));
@@ -32450,13 +32454,13 @@ var typeIcons = {
32450
32454
  };
32451
32455
  function Citation(_a) {
32452
32456
  var title = _a.title, index = _a.index, _b = _a.type, type = _b === void 0 ? "document" : _b, description = _a.description, href = _a.href, _c = _a.isBlinking, isBlinking = _c === void 0 ? false : _c;
32453
- return (React.createElement("div", { className: classNames("w-48 s-flex s-flex-none s-flex-col s-gap-1 s-rounded-xl s-border s-border-structure-100 s-p-3 s-shadow-sm sm:s-w-64", isBlinking ? "animate-[bgblink_500ms_3]" : "") },
32457
+ return (React.createElement("div", { className: classNames("w-48 s-flex s-flex-none s-flex-col s-gap-1 s-rounded-xl s-border s-border-structure-100 s-bg-white s-p-3 s-shadow-sm sm:s-w-64", isBlinking ? "animate-[bgblink_500ms_3]" : "") },
32454
32458
  React.createElement("div", { className: "s-flex s-items-center s-gap-2" },
32455
32459
  index && (React.createElement("div", { className: "s-flex s-h-5 s-w-5 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" }, index)),
32456
32460
  React.createElement(Icon, { visual: typeIcons[type], size: "sm" }),
32457
32461
  React.createElement("div", { className: "s-flex-grow s-text-xs" }),
32458
- React.createElement("a", { target: "_blank", rel: "noopener noreferrer", href: href },
32459
- React.createElement(IconButton, { icon: SvgExternalLink$1, size: "sm", variant: "primary" }))),
32462
+ href && (React.createElement("a", { target: "_blank", rel: "noopener noreferrer", href: href },
32463
+ React.createElement(IconButton, { icon: SvgExternalLink$1, size: "sm", variant: "primary" })))),
32460
32464
  React.createElement("div", { className: "s-text-sm s-font-bold s-text-element-900" }, title),
32461
32465
  description && (React.createElement("div", { className: "s-text-xs s-font-normal s-text-element-700" }, description))));
32462
32466
  }