@dust-tt/sparkle 0.2.64 → 0.2.65

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,20 +1,28 @@
1
1
  import React from "react";
2
2
  type AssistantPreviewVariant = "sm" | "md" | "lg" | "list";
3
- interface AssistantPreviewProps {
4
- allowAddAction?: boolean;
5
- allowRemoveAction?: boolean;
3
+ interface BaseAssistantPreviewProps {
6
4
  description: string;
7
- isAdded: boolean;
8
- isUpdatingList: boolean;
9
- isWorkspace: boolean;
10
5
  name: string;
11
6
  pictureUrl: string;
12
7
  subtitle: string;
13
8
  variant: AssistantPreviewVariant;
9
+ }
10
+ type LargeVariantAssistantPreviewProps = BaseAssistantPreviewProps & {
11
+ variant: "lg";
12
+ allowAddAction?: boolean;
13
+ allowRemoveAction?: boolean;
14
+ isAdded: boolean;
15
+ isUpdatingList: boolean;
16
+ isWorkspace: boolean;
14
17
  onShowDetailsClick?: () => void;
15
18
  onTestClick?: () => void;
16
19
  onUpdate: (action: "added" | "removed") => Promise<void> | void;
17
- }
20
+ };
21
+ type SmallVariantAssistantPreviewProps = BaseAssistantPreviewProps & {
22
+ variant: "sm";
23
+ onClick: () => void;
24
+ };
25
+ type AssistantPreviewProps = SmallVariantAssistantPreviewProps | LargeVariantAssistantPreviewProps;
18
26
  export declare function AssistantPreview(props: AssistantPreviewProps): React.JSX.Element;
19
27
  export declare namespace AssistantPreview {
20
28
  var defaultProps: {
package/dist/cjs/index.js CHANGED
@@ -32240,27 +32240,27 @@ AssistantPreview.defaultProps = {
32240
32240
  allowAddAction: false,
32241
32241
  allowRemoveAction: false,
32242
32242
  };
32243
- function renderVariantContent(variant, props) {
32244
- switch (variant) {
32243
+ function renderVariantContent(props) {
32244
+ switch (props.variant) {
32245
32245
  case "sm":
32246
- return React.createElement(SmallVariantContent, null);
32247
- case "md":
32248
- return React.createElement(MediumVariantContent, null);
32246
+ return React.createElement(SmallVariantContent, __assign({}, props));
32249
32247
  case "lg":
32250
- return React.createElement(LargeVariantContent, { props: props });
32251
- case "list":
32252
- return React.createElement(ListVariantContent, null);
32248
+ return React.createElement(LargeVariantContent, __assign({}, props));
32253
32249
  default:
32254
32250
  return React.createElement(React.Fragment, null);
32255
32251
  }
32256
32252
  }
32257
- // TODO:
32258
- var SmallVariantContent = function () {
32259
- throw new Error("Not yet implemented!");
32260
- };
32261
- // TODO:
32262
- var MediumVariantContent = function () {
32263
- throw new Error("Not yet implemented!");
32253
+ var SmallVariantContent = function (props) {
32254
+ var description = props.description, name = props.name, onClick = props.onClick, pictureUrl = props.pictureUrl;
32255
+ return (React.createElement("div", { className: "s-flex s-flex-col s-py-2" },
32256
+ React.createElement("div", { className: "s-flex s-flex-row s-gap-2" },
32257
+ React.createElement(Avatar, { visual: React.createElement("img", { src: pictureUrl, alt: "Avatar of ".concat(name) }), size: "md" }),
32258
+ React.createElement("div", { className: "s-flex s-flex-col s-gap-2" },
32259
+ React.createElement("div", { className: "s-text-sm s-font-medium s-text-element-900" },
32260
+ "@",
32261
+ name),
32262
+ React.createElement(Button, { key: "start", variant: "tertiary", icon: SvgChatBubbleBottomCenterText$1, size: "xs", label: "Start", onClick: onClick }))),
32263
+ React.createElement("div", { className: "s-py-1.5 s-text-sm s-font-normal s-text-element-700" }, description)));
32264
32264
  };
32265
32265
  var GalleryChip = function (_a) {
32266
32266
  var allowAddAction = _a.allowAddAction, allowRemoveAction = _a.allowRemoveAction, isAdded = _a.isAdded, isUpdatingList = _a.isUpdatingList, onUpdate = _a.onUpdate;
@@ -32279,8 +32279,7 @@ var ButtonsGroup = function (_a) {
32279
32279
  onTestClick && (React.createElement(Button, { key: "test", variant: "tertiary", icon: SvgPlay$1, size: "xs", label: "Test", onClick: onTestClick })),
32280
32280
  onShowDetailsClick && (React.createElement(Button, { key: "show_details", icon: SvgMore$1, label: "View Assistant", labelVisible: false, size: "xs", variant: "tertiary", onClick: onShowDetailsClick }))));
32281
32281
  };
32282
- var LargeVariantContent = function (_a) {
32283
- var props = _a.props;
32282
+ var LargeVariantContent = function (props) {
32284
32283
  var allowAddAction = props.allowAddAction, allowRemoveAction = props.allowRemoveAction, description = props.description, isAdded = props.isAdded, isUpdatingList = props.isUpdatingList, isWorkspace = props.isWorkspace, name = props.name, onShowDetailsClick = props.onShowDetailsClick, onTestClick = props.onTestClick, onUpdate = props.onUpdate, pictureUrl = props.pictureUrl, subtitle = props.subtitle;
32285
32284
  return (React.createElement("div", { className: "s-flex s-flex-row s-gap-2 s-py-2" },
32286
32285
  React.createElement(Avatar, { visual: React.createElement("img", { src: pictureUrl, alt: "Avatar of ".concat(name) }), size: "md" }),
@@ -32295,12 +32294,8 @@ var LargeVariantContent = function (_a) {
32295
32294
  React.createElement(ButtonsGroup, { allowAddAction: allowAddAction, isAdded: isAdded, isUpdatingList: isUpdatingList, isWorkspace: isWorkspace, onShowDetailsClick: onShowDetailsClick, onTestClick: onTestClick, onUpdate: onUpdate })),
32296
32295
  React.createElement("div", { className: "s-text-sm s-font-normal s-text-element-800" }, description))));
32297
32296
  };
32298
- // TODO:
32299
- var ListVariantContent = function () {
32300
- throw new Error("Not yet implemented!");
32301
- };
32302
32297
  function AssistantPreview(props) {
32303
- var VariantContent = renderVariantContent(props.variant, props);
32298
+ var VariantContent = renderVariantContent(props);
32304
32299
  return React.createElement("div", null, VariantContent);
32305
32300
  }
32306
32301
 
@@ -33453,7 +33448,7 @@ var sizeInputClasses = {
33453
33448
  };
33454
33449
  function Input(_a) {
33455
33450
  var placeholder = _a.placeholder, value = _a.value, _b = _a.size, size = _b === void 0 ? "sm" : _b, onChange = _a.onChange, error = _a.error, _c = _a.showErrorLabel, showErrorLabel = _c === void 0 ? false : _c, name = _a.name, _d = _a.isPassword, isPassword = _d === void 0 ? false : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.className, className = _f === void 0 ? "" : _f;
33456
- return (React.createElement("div", { className: "s-m-px s-flex s-flex-col s-gap-1 s-p-px" },
33451
+ return (React.createElement("div", { className: "s-flex s-flex-col s-gap-1 s-p-px" },
33457
33452
  React.createElement("input", { type: isPassword ? "password" : "text", name: name, id: name, className: classNames("s-w-full s-border-0 s-outline-none s-ring-1 focus:s-outline-none focus:s-ring-2", "s-bg-structure-50 s-text-element-900 s-placeholder-element-600", "dark:s-bg-structure-50-dark dark:s-text-element-800-dark dark:s-placeholder-element-600-dark", sizeInputClasses[size], "s-transition-all s-duration-300 s-ease-out", className !== null && className !== void 0 ? className : "", !error
33458
33453
  ? classNames("s-ring-structure-200 focus:s-ring-action-300", "dark:s-ring-structure-300-dark dark:focus:s-ring-action-300-dark")
33459
33454
  : classNames("s-ring-warning-200 focus:s-ring-warning-300", "dark:s-ring-warning-200-dark dark:focus:s-ring-warning-300-dark")), placeholder: placeholder, value: value !== null && value !== void 0 ? value : "", onChange: function (e) {