@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/esm/index.js CHANGED
@@ -32684,7 +32684,9 @@ BarHeader.ButtonBar = function (props) {
32684
32684
  case "validate":
32685
32685
  return (React__default.createElement(React__default.Fragment, null,
32686
32686
  React__default.createElement(Button, { size: "sm", label: "Cancel", variant: "secondaryWarning", onClick: props.onCancel, disabled: !props.onCancel || props.isSaving }),
32687
- React__default.createElement(Button, { size: "sm", label: props.isSaving ? "Processing..." : props.saveLabel || "Save", variant: "primary", onClick: props.onSave, disabled: !props.onSave || props.isSaving })));
32687
+ React__default.createElement(Button, { size: "sm", label: props.isSaving
32688
+ ? props.savingLabel || "Processing..."
32689
+ : props.saveLabel || "Save", variant: "primary", onClick: props.onSave, disabled: !props.onSave || props.isSaving })));
32688
32690
  case "conversation":
32689
32691
  return (React__default.createElement(React__default.Fragment, null,
32690
32692
  React__default.createElement(Button, { size: "sm", label: "Delete", icon: SvgTrash$1, variant: "secondaryWarning", labelVisible: false, tooltipPosition: "below", onClick: props.onDelete }),
@@ -32891,16 +32893,16 @@ var visualTable = {
32891
32893
  channel: SvgChatBubbleBottomCenterText,
32892
32894
  };
32893
32895
  Tree.Item = function (_a) {
32894
- 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;
32896
+ 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;
32895
32897
  return (React__default.createElement(React__default.Fragment, null,
32896
32898
  React__default.createElement("div", { className: classNames(className ? className : "", "s-flex s-flex-row s-items-center s-gap-4 s-py-1") },
32897
- type === "node" && (React__default.createElement(IconButton, { icon: children ? SvgChevronDown : SvgChevronRight, size: "sm", variant: "secondary" })),
32898
- React__default.createElement(Checkbox, { variant: "checkable", checked: false, onChange: function () { return console.log("click"); } }),
32899
+ type === "node" && (React__default.createElement(IconButton, { icon: children && !collapsed ? SvgChevronDown : SvgChevronRight, size: "sm", variant: "secondary", onClick: onChevronClick })),
32900
+ type === "leaf" && React__default.createElement("div", { className: "s-w-5" }),
32901
+ checkbox && React__default.createElement(Checkbox, __assign({}, checkbox)),
32899
32902
  React__default.createElement("div", { className: "s-flex s-items-center s-gap-1.5 s-text-sm s-font-medium s-text-element-900" },
32900
32903
  React__default.createElement(Icon, { visual: visualTable[variant], size: "sm", className: "s-text-element-700" }),
32901
32904
  label)),
32902
- React__default.Children.count(children) > 0 && (React__default.createElement("div", { className: "s-flex s-pl-5" },
32903
- React__default.createElement(Tree, null, children)))));
32905
+ React__default.Children.count(children) > 0 && (React__default.createElement("div", { className: "s-flex s-pl-5" }, !collapsed && children))));
32904
32906
  };
32905
32907
 
32906
32908
  var baseClasses = "s-transition-all s-ease-out s-duration-300 s-cursor-pointer hover:s-scale-110";
@@ -32955,13 +32957,15 @@ function IconToggleButton(_a) {
32955
32957
  }
32956
32958
 
32957
32959
  function Modal(_a) {
32958
- 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;
32960
+ 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;
32959
32961
  var buttonBarProps = hasChanged
32960
32962
  ? {
32961
32963
  variant: "validate",
32962
32964
  onCancel: onClose,
32963
32965
  onSave: onSave,
32964
32966
  saveLabel: saveLabel,
32967
+ isSaving: isSaving,
32968
+ savingLabel: savingLabel,
32965
32969
  }
32966
32970
  : {
32967
32971
  variant: "close",