@dust-tt/sparkle 0.2.20 → 0.2.22

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.
@@ -23,6 +23,7 @@ type BarHeaderButtonBarValidateProps = {
23
23
  onSave?: () => void;
24
24
  saveLabel?: string;
25
25
  isSaving?: boolean;
26
+ savingLabel?: string;
26
27
  };
27
28
  type BarHeaderButtonBarConversationProps = {
28
29
  variant: "conversation";
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- interface CheckboxProps {
2
+ export interface CheckboxProps {
3
3
  variant?: "selectable" | "checkable";
4
4
  checked: boolean;
5
5
  disabled?: boolean;
@@ -8,4 +8,3 @@ interface CheckboxProps {
8
8
  className?: string;
9
9
  }
10
10
  export declare function Checkbox({ variant, checked, onChange, className, disabled, partialChecked, }: CheckboxProps): React.JSX.Element;
11
- export {};
@@ -7,9 +7,11 @@ interface ModalProps {
7
7
  children: React.ReactNode;
8
8
  hasChanged: boolean;
9
9
  onSave?: () => void;
10
+ saveLabel?: string;
11
+ isSaving?: boolean;
12
+ savingLabel?: string;
10
13
  title?: string;
11
14
  type?: "full-screen" | "right-side" | "default";
12
- saveLabel?: string;
13
15
  }
14
- export declare function Modal({ isOpen, onClose, action, children, hasChanged, onSave, title, type, saveLabel, }: ModalProps): React.JSX.Element;
16
+ export declare function Modal({ isOpen, onClose, action, children, hasChanged, onSave, saveLabel, isSaving, savingLabel, title, type, }: ModalProps): React.JSX.Element;
15
17
  export {};
@@ -1,16 +1,20 @@
1
1
  import React from "react";
2
+ import { CheckboxProps } from "./Checkbox";
2
3
  export interface TreeProps {
3
4
  children?: React.ReactNode;
4
5
  isLoading?: boolean;
5
6
  }
6
7
  export declare function Tree({ children, isLoading }: TreeProps): React.JSX.Element;
7
8
  export declare namespace Tree {
8
- var Item: ({ label, type, className, variant, children, }: TreeItemProps) => React.JSX.Element;
9
+ var Item: ({ label, type, className, variant, checkbox, onChevronClick, collapsed, children, }: TreeItemProps) => React.JSX.Element;
9
10
  }
10
11
  export interface TreeItemProps {
11
12
  label?: string;
12
- type?: "node" | "item";
13
+ type?: "node" | "item" | "leaf";
13
14
  variant?: "file" | "folder" | "database" | "channel";
15
+ checkbox?: CheckboxProps;
16
+ onChevronClick?: () => void;
17
+ collapsed?: boolean;
14
18
  className?: string;
15
19
  children?: React.ReactNode;
16
20
  }
package/dist/cjs/index.js CHANGED
@@ -32704,7 +32704,9 @@ BarHeader.ButtonBar = function (props) {
32704
32704
  case "validate":
32705
32705
  return (React.createElement(React.Fragment, null,
32706
32706
  React.createElement(Button, { size: "sm", label: "Cancel", variant: "secondaryWarning", onClick: props.onCancel, disabled: !props.onCancel || props.isSaving }),
32707
- React.createElement(Button, { size: "sm", label: props.isSaving ? "Processing..." : props.saveLabel || "Save", variant: "primary", onClick: props.onSave, disabled: !props.onSave || props.isSaving })));
32707
+ React.createElement(Button, { size: "sm", label: props.isSaving
32708
+ ? props.savingLabel || "Processing..."
32709
+ : props.saveLabel || "Save", variant: "primary", onClick: props.onSave, disabled: !props.onSave || props.isSaving })));
32708
32710
  case "conversation":
32709
32711
  return (React.createElement(React.Fragment, null,
32710
32712
  React.createElement(Button, { size: "sm", label: "Delete", icon: SvgTrash$1, variant: "secondaryWarning", labelVisible: false, tooltipPosition: "below", onClick: props.onDelete }),
@@ -32911,16 +32913,16 @@ var visualTable = {
32911
32913
  channel: SvgChatBubbleBottomCenterText,
32912
32914
  };
32913
32915
  Tree.Item = function (_a) {
32914
- var label = _a.label, _b = _a.type, type = _b === void 0 ? "node" : _b, _c = _a.className, className = _c === void 0 ? "" : _c, _d = _a.variant, variant = _d === void 0 ? "file" : _d, children = _a.children;
32916
+ var label = _a.label, _b = _a.type, type = _b === void 0 ? "node" : _b, _c = _a.className, className = _c === void 0 ? "" : _c, _d = _a.variant, variant = _d === void 0 ? "file" : _d, checkbox = _a.checkbox, onChevronClick = _a.onChevronClick, collapsed = _a.collapsed, children = _a.children;
32915
32917
  return (React.createElement(React.Fragment, null,
32916
32918
  React.createElement("div", { className: classNames(className ? className : "", "s-flex s-flex-row s-items-center s-gap-4 s-py-1") },
32917
- type === "node" && (React.createElement(IconButton, { icon: children ? SvgChevronDown : SvgChevronRight, size: "sm", variant: "secondary" })),
32918
- React.createElement(Checkbox, { variant: "checkable", checked: false, onChange: function () { return console.log("click"); } }),
32919
+ type === "node" && (React.createElement(IconButton, { icon: children && !collapsed ? SvgChevronDown : SvgChevronRight, size: "sm", variant: "secondary", onClick: onChevronClick })),
32920
+ type === "leaf" && React.createElement("div", { className: "s-w-5" }),
32921
+ checkbox && React.createElement(Checkbox, __assign({}, checkbox)),
32919
32922
  React.createElement("div", { className: "s-flex s-items-center s-gap-1.5 s-text-sm s-font-medium s-text-element-900" },
32920
32923
  React.createElement(Icon, { visual: visualTable[variant], size: "sm", className: "s-text-element-700" }),
32921
32924
  label)),
32922
- React.Children.count(children) > 0 && (React.createElement("div", { className: "s-flex s-pl-5" },
32923
- React.createElement(Tree, null, children)))));
32925
+ React.Children.count(children) > 0 && (React.createElement("div", { className: "s-flex s-pl-5" }, !collapsed && children))));
32924
32926
  };
32925
32927
 
32926
32928
  var baseClasses = "s-transition-all s-ease-out s-duration-300 s-cursor-pointer hover:s-scale-110";
@@ -32975,13 +32977,15 @@ function IconToggleButton(_a) {
32975
32977
  }
32976
32978
 
32977
32979
  function Modal(_a) {
32978
- var isOpen = _a.isOpen, onClose = _a.onClose, action = _a.action, children = _a.children, hasChanged = _a.hasChanged, onSave = _a.onSave, title = _a.title, _b = _a.type, type = _b === void 0 ? "default" : _b, _c = _a.saveLabel, saveLabel = _c === void 0 ? "Save" : _c;
32980
+ var isOpen = _a.isOpen, onClose = _a.onClose, action = _a.action, children = _a.children, hasChanged = _a.hasChanged, onSave = _a.onSave, _b = _a.saveLabel, saveLabel = _b === void 0 ? "Save" : _b, isSaving = _a.isSaving, savingLabel = _a.savingLabel, title = _a.title, _c = _a.type, type = _c === void 0 ? "default" : _c;
32979
32981
  var buttonBarProps = hasChanged
32980
32982
  ? {
32981
32983
  variant: "validate",
32982
32984
  onCancel: onClose,
32983
32985
  onSave: onSave,
32984
32986
  saveLabel: saveLabel,
32987
+ isSaving: isSaving,
32988
+ savingLabel: savingLabel,
32985
32989
  }
32986
32990
  : {
32987
32991
  variant: "close",