@dust-tt/sparkle 0.2.61-alpha-2 → 0.2.61-alpha-4
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/components/AssistantPreview.d.ts +8 -1
- package/dist/cjs/index.js +28 -20
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/AssistantPreview.d.ts +8 -1
- package/dist/esm/index.js +28 -20
- package/dist/esm/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
type AssistantPreviewVariant = "sm" | "md" | "lg" | "list";
|
|
3
3
|
interface AssistantPreviewProps {
|
|
4
|
-
allowAddAction
|
|
4
|
+
allowAddAction?: boolean;
|
|
5
|
+
allowRemoveAction?: boolean;
|
|
5
6
|
description: string;
|
|
6
7
|
isAdded: boolean;
|
|
7
8
|
isUpdatingList: boolean;
|
|
@@ -15,4 +16,10 @@ interface AssistantPreviewProps {
|
|
|
15
16
|
onUpdate: (action: "added" | "removed") => Promise<void> | void;
|
|
16
17
|
}
|
|
17
18
|
export declare function AssistantPreview(props: AssistantPreviewProps): React.JSX.Element;
|
|
19
|
+
export declare namespace AssistantPreview {
|
|
20
|
+
var defaultProps: {
|
|
21
|
+
allowAddAction: boolean;
|
|
22
|
+
allowRemoveAction: boolean;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
18
25
|
export {};
|
package/dist/cjs/index.js
CHANGED
|
@@ -32235,7 +32235,12 @@ Chip.List = function (_a) {
|
|
|
32235
32235
|
React.createElement("div", { className: classNames("s-flex s-flex-row s-gap-2", isWrapping ? "s-flex-wrap" : "") }, children)));
|
|
32236
32236
|
};
|
|
32237
32237
|
|
|
32238
|
-
|
|
32238
|
+
// Define defaultProps for the AssistantPreview component.
|
|
32239
|
+
AssistantPreview.defaultProps = {
|
|
32240
|
+
allowAddAction: false,
|
|
32241
|
+
allowRemoveAction: false,
|
|
32242
|
+
};
|
|
32243
|
+
function renderVariantContent(variant, props) {
|
|
32239
32244
|
switch (variant) {
|
|
32240
32245
|
case "sm":
|
|
32241
32246
|
return React.createElement(SmallVariantContent, null);
|
|
@@ -32257,24 +32262,28 @@ var SmallVariantContent = function () {
|
|
|
32257
32262
|
var MediumVariantContent = function () {
|
|
32258
32263
|
throw new Error("Not yet implemented!");
|
|
32259
32264
|
};
|
|
32265
|
+
var GalleryChip = function (_a) {
|
|
32266
|
+
var allowAddAction = _a.allowAddAction, allowRemoveAction = _a.allowRemoveAction, isAdded = _a.isAdded, isUpdatingList = _a.isUpdatingList, onUpdate = _a.onUpdate;
|
|
32267
|
+
if (!isAdded || !allowAddAction)
|
|
32268
|
+
return null;
|
|
32269
|
+
return (allowAddAction && (React.createElement("div", { className: "s-group" },
|
|
32270
|
+
React.createElement(Chip, { color: "emerald", size: "xs", label: "Added", className: allowRemoveAction ? "group-hover:s-hidden" : "" }),
|
|
32271
|
+
allowRemoveAction && (React.createElement("div", { className: "s-hidden group-hover:s-block" },
|
|
32272
|
+
React.createElement(Button.List, { isWrapping: true },
|
|
32273
|
+
React.createElement(Button, { key: "remove", variant: "tertiary", icon: SvgDash$1, disabled: isUpdatingList, size: "xs", label: "Remove", onClick: function () { return onUpdate("removed"); } })))))));
|
|
32274
|
+
};
|
|
32275
|
+
var ButtonsGroup = function (_a) {
|
|
32276
|
+
var allowAddAction = _a.allowAddAction, isAdded = _a.isAdded, isUpdatingList = _a.isUpdatingList, isWorkspace = _a.isWorkspace, onShowDetailsClick = _a.onShowDetailsClick, onTestClick = _a.onTestClick, onUpdate = _a.onUpdate;
|
|
32277
|
+
return (React.createElement(Button.List, { isWrapping: true },
|
|
32278
|
+
!isAdded && allowAddAction && (React.createElement(Button, { key: "add", variant: "tertiary", icon: SvgPlus$1, disabled: isUpdatingList, size: "xs", label: isWorkspace ? "Add to Workspace" : "Add", onClick: function () { return onUpdate("added"); } })),
|
|
32279
|
+
onTestClick && (React.createElement(Button, { key: "test", variant: "tertiary", icon: SvgPlay$1, size: "xs", label: "Test", onClick: onTestClick })),
|
|
32280
|
+
onShowDetailsClick && (React.createElement(Button, { key: "show_details", icon: SvgMore$1, label: "View Assistant", labelVisible: false, size: "xs", variant: "tertiary", onClick: onShowDetailsClick }))));
|
|
32281
|
+
};
|
|
32260
32282
|
var LargeVariantContent = function (_a) {
|
|
32261
|
-
var _b;
|
|
32262
32283
|
var props = _a.props;
|
|
32263
|
-
var
|
|
32264
|
-
var galleryChip = isAdded && (React.createElement("div", { className: "s-group" },
|
|
32265
|
-
React.createElement(Chip, { color: "emerald", size: "xs", label: "Added", className: "group-hover:s-hidden" }),
|
|
32266
|
-
allowAddAction && (React.createElement("div", { className: "s-hidden group-hover:s-block" },
|
|
32267
|
-
React.createElement(Button.List, { isWrapping: true },
|
|
32268
|
-
React.createElement(Button, { key: "remove", variant: "tertiary", icon: SvgDash$1, disabled: isUpdatingList, size: "xs", label: "Remove", onClick: function () { return onUpdate("removed"); } }))))));
|
|
32269
|
-
var addButton = !isAdded && allowAddAction && (React.createElement(Button, { key: "add", variant: "tertiary", icon: SvgPlus$1, disabled: isUpdatingList, size: "xs", label: isWorkspace ? "Add to Workspace" : "Add", onClick: function () { return onUpdate("added"); } }));
|
|
32270
|
-
var testButton = null;
|
|
32271
|
-
if (onTestClick) {
|
|
32272
|
-
testButton = (React.createElement(Button, { key: "test", variant: "tertiary", icon: SvgPlay$1, size: "xs", label: "Test", onClick: onTestClick }));
|
|
32273
|
-
}
|
|
32274
|
-
var showAssistantButton = (React.createElement(Button, { key: "show_details", icon: SvgMore$1, label: "View Assistant", labelVisible: false, size: "xs", variant: "tertiary", onClick: onShowDetailsClick }));
|
|
32275
|
-
var buttonsToRender = (_b = [addButton, testButton, showAssistantButton].filter(Boolean)) !== null && _b !== void 0 ? _b : [];
|
|
32284
|
+
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;
|
|
32276
32285
|
return (React.createElement("div", { className: "s-flex s-flex-row s-gap-2 s-py-2" },
|
|
32277
|
-
React.createElement(Avatar, { visual: React.createElement("img", { src: pictureUrl, alt: "
|
|
32286
|
+
React.createElement(Avatar, { visual: React.createElement("img", { src: pictureUrl, alt: "Avatar of ".concat(name) }), size: "md" }),
|
|
32278
32287
|
React.createElement("div", { className: "s-flex s-flex-col s-gap-2" },
|
|
32279
32288
|
React.createElement("div", null,
|
|
32280
32289
|
React.createElement("div", { className: "s-text-sm s-font-medium s-text-element-900" },
|
|
@@ -32282,8 +32291,8 @@ var LargeVariantContent = function (_a) {
|
|
|
32282
32291
|
name),
|
|
32283
32292
|
React.createElement("div", { className: "s-text-sm s-font-normal s-text-element-700" }, subtitle)),
|
|
32284
32293
|
React.createElement("div", { className: "s-flex s-flex-row s-gap-2" },
|
|
32285
|
-
|
|
32286
|
-
React.createElement(
|
|
32294
|
+
React.createElement(GalleryChip, { allowAddAction: allowAddAction, allowRemoveAction: allowRemoveAction, isAdded: isAdded, isUpdatingList: isUpdatingList, onUpdate: onUpdate }),
|
|
32295
|
+
React.createElement(ButtonsGroup, { allowAddAction: allowAddAction, isAdded: isAdded, isUpdatingList: isUpdatingList, isWorkspace: isWorkspace, onShowDetailsClick: onShowDetailsClick, onTestClick: onTestClick, onUpdate: onUpdate })),
|
|
32287
32296
|
React.createElement("div", { className: "s-text-sm s-font-normal s-text-element-800" }, description))));
|
|
32288
32297
|
};
|
|
32289
32298
|
// TODO:
|
|
@@ -32291,8 +32300,7 @@ var ListVariantContent = function () {
|
|
|
32291
32300
|
throw new Error("Not yet implemented!");
|
|
32292
32301
|
};
|
|
32293
32302
|
function AssistantPreview(props) {
|
|
32294
|
-
|
|
32295
|
-
var VariantContent = getVariantContent(props.variant, props);
|
|
32303
|
+
var VariantContent = renderVariantContent(props.variant, props);
|
|
32296
32304
|
return React.createElement("div", null, VariantContent);
|
|
32297
32305
|
}
|
|
32298
32306
|
|