@dust-tt/sparkle 0.2.252 → 0.2.253

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/index.js CHANGED
@@ -103569,6 +103569,35 @@ DataTable.CellContent = function CellContent(_a) {
103569
103569
  React.createElement("span", { className: "s-truncate s-text-sm s-text-element-800" }, children),
103570
103570
  description && (React.createElement("span", { className: "s-pl-2 s-text-sm s-text-element-600" }, description)))));
103571
103571
  };
103572
+ DataTable.CellContentWithCopy = function CellContentWithCopy(_a) {
103573
+ var _this = this;
103574
+ var children = _a.children, textToCopy = _a.textToCopy, className = _a.className;
103575
+ var _b = __read(useCopyToClipboard(), 2), isCopied = _b[0], copyToClipboard = _b[1];
103576
+ var handleCopy = function () { return __awaiter(_this, void 0, void 0, function () {
103577
+ return __generator(this, function (_a) {
103578
+ void copyToClipboard(new ClipboardItem({
103579
+ "text/plain": new Blob([textToCopy !== null && textToCopy !== void 0 ? textToCopy : String(children)], {
103580
+ type: "text/plain",
103581
+ }),
103582
+ }));
103583
+ return [2 /*return*/];
103584
+ });
103585
+ }); };
103586
+ return (React.createElement("div", { className: classNames("s-flex s-items-center s-space-x-2", className || "") },
103587
+ React.createElement("span", { className: "s-truncate" }, children),
103588
+ React.createElement(IconButton, { icon: isCopied ? SvgClipboardCheck$1 : SvgClipboard$1, variant: "tertiary", onClick: function (e) { return __awaiter(_this, void 0, void 0, function () {
103589
+ return __generator(this, function (_a) {
103590
+ switch (_a.label) {
103591
+ case 0:
103592
+ e.stopPropagation();
103593
+ return [4 /*yield*/, handleCopy()];
103594
+ case 1:
103595
+ _a.sent();
103596
+ return [2 /*return*/];
103597
+ }
103598
+ });
103599
+ }); }, size: "xs" })));
103600
+ };
103572
103601
  DataTable.Caption = function Caption(_a) {
103573
103602
  var children = _a.children, className = _a.className, props = __rest(_a, ["children", "className"]);
103574
103603
  return (React.createElement("caption", __assign({ className: className }, props), children));
@@ -104305,7 +104334,7 @@ var modalStyles = (_a = {},
104305
104334
  _a);
104306
104335
  var getModalClasses = function (type) { return modalStyles[type] || {}; };
104307
104336
  function Modal(_a) {
104308
- 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.variant, variant = _c === void 0 ? "side-sm" : _c, className = _a.className;
104337
+ var action = _a.action, alertModal = _a.alertModal, children = _a.children, className = _a.className, hasChanged = _a.hasChanged, isOpen = _a.isOpen, isSaving = _a.isSaving, onClose = _a.onClose, onSave = _a.onSave, _b = _a.saveLabel, saveLabel = _b === void 0 ? "Save" : _b, savingLabel = _a.savingLabel, title = _a.title, _c = _a.variant, variant = _c === void 0 ? "side-sm" : _c;
104309
104338
  var type = variantToType[variant];
104310
104339
  if (variant === "dialogue") {
104311
104340
  console.warn("Dialogue variant of Modal is deprecated. Please use either another variant of Modal or the Dialog component.");
@@ -104326,8 +104355,8 @@ function Modal(_a) {
104326
104355
  var _d = getModalClasses(type), containerClasses = _d.containerClasses, transitionEnterFrom = _d.transitionEnterFrom, transitionLeaveFrom = _d.transitionLeaveFrom, transitionEnterTo = _d.transitionEnterTo, transitionLeaveTo = _d.transitionLeaveTo, panelClasses = _d.panelClasses, innerContainerClasses = _d.innerContainerClasses;
104327
104356
  return (React.createElement(qe, { show: isOpen, as: React.Fragment, appear: true },
104328
104357
  React.createElement(_t, { as: "div", className: "s-fixed s-absolute s-inset-0 s-z-50 s-overflow-hidden", onClose: function () {
104329
- // We allow closing the modal by clicking outside of it only if there are no changes
104330
- if (!hasChanged) {
104358
+ // Close modal on outside click if no changes or not an alert.
104359
+ if (!hasChanged && !alertModal) {
104331
104360
  onClose();
104332
104361
  }
104333
104362
  } },
@@ -104336,7 +104365,7 @@ function Modal(_a) {
104336
104365
  React.createElement("div", { className: classNames(containerClasses, variantSize[variant]) },
104337
104366
  React.createElement(qe.Child, { as: React.Fragment, enter: "s-ease-out s-duration-300", enterFrom: transitionEnterFrom, enterTo: transitionEnterTo, leave: "s-ease-in s-duration-200", leaveFrom: transitionLeaveFrom, leaveTo: transitionLeaveTo },
104338
104367
  React.createElement(_t.Panel, { className: classNames("s-absolute s-transform s-bg-structure-0 s-px-3 s-transition-all sm:s-px-4", panelClasses, variantSize[variant]) },
104339
- React.createElement(BarHeader, { title: title || "", leftActions: action ? React.createElement(Button, __assign({}, action)) : undefined, rightActions: React.createElement(BarHeader.ButtonBar, __assign({}, buttonBarProps)) }),
104368
+ React.createElement(BarHeader, { title: title || "", leftActions: action ? React.createElement(Button, __assign({}, action)) : undefined, rightActions: alertModal ? undefined : (React.createElement(BarHeader.ButtonBar, __assign({}, buttonBarProps))) }),
104340
104369
  React.createElement("div", { className: classNames("s-pb-6 s-pt-16", innerContainerClasses, className !== null && className !== void 0 ? className : "") }, children)))))));
104341
104370
  }
104342
104371