@dust-tt/sparkle 0.2.91 → 0.2.92-pr

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.
@@ -56,6 +56,8 @@ import Spinner from "./components/Spinner";
56
56
  export { Spinner };
57
57
  import { Modal } from "./components/Modal";
58
58
  export { Modal };
59
+ import { ElementModal } from "./components/ElementModal";
60
+ export { ElementModal };
59
61
  import { Dialog } from "./components/Dialog";
60
62
  export { Dialog };
61
63
  import { Input } from "./components/Input";
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { ModalProps } from "./Modal";
3
+ type ElementModalProps<T> = Omit<ModalProps, "isOpen"> & {
4
+ openOnElement: T | null;
5
+ };
6
+ export declare function ElementModal<T>({ openOnElement, ...props }: ElementModalProps<T>): React.JSX.Element;
7
+ export {};
@@ -5,7 +5,7 @@ export declare enum ModalType {
5
5
  FullScreen = "full-screen",
6
6
  Side = "side"
7
7
  }
8
- type ModalProps = {
8
+ export type ModalProps = {
9
9
  isOpen: boolean;
10
10
  onClose: () => void;
11
11
  action?: ButtonProps;
@@ -19,4 +19,3 @@ type ModalProps = {
19
19
  variant?: "full-screen" | "side-sm" | "side-md" | "dialogue";
20
20
  };
21
21
  export declare function Modal({ isOpen, onClose, action, children, hasChanged, onSave, saveLabel, isSaving, savingLabel, title, variant, }: ModalProps): React.JSX.Element;
22
- export {};
package/dist/cjs/index.js CHANGED
@@ -33556,7 +33556,7 @@ var variantSize = {
33556
33556
  var modalStyles = (_a = {},
33557
33557
  _a[ModalType.Side] = {
33558
33558
  containerClasses: "s-h-full s-ml-auto",
33559
- panelClasses: "s-h-full s-max-h-full s-shadow-xl s-border s-border-structure-100",
33559
+ panelClasses: "s-h-full s-max-h-full s-shadow-xl s-border s-border-structure-100 s-w-full s-max-w-full",
33560
33560
  transitionEnterFrom: "s-opacity-0 s-translate-x-16",
33561
33561
  transitionEnterTo: "s-opacity-100 s-translate-x-0",
33562
33562
  transitionLeaveFrom: "s-opacity-100 s-translate-x-0",
@@ -33614,6 +33614,21 @@ function Modal(_a) {
33614
33614
  React.createElement("div", { className: classNames("s-pb-6 s-pt-16", innerContainerClasses) }, children)))))));
33615
33615
  }
33616
33616
 
33617
+ function ElementModal(_a) {
33618
+ var openOnElement = _a.openOnElement, props = __rest(_a, ["openOnElement"]);
33619
+ var onClose = props.onClose;
33620
+ var _b = __read(React.useState(false), 2), isClosingTransition = _b[0], setIsClosingTransition = _b[1];
33621
+ var realOnClose = function () {
33622
+ setIsClosingTransition(true);
33623
+ setTimeout(function () {
33624
+ onClose();
33625
+ setIsClosingTransition(false);
33626
+ }, 200);
33627
+ };
33628
+ props.onClose = realOnClose;
33629
+ return (React.createElement(Modal, __assign({ isOpen: openOnElement !== null && !isClosingTransition }, props)));
33630
+ }
33631
+
33617
33632
  function Dialog(_a) {
33618
33633
  var isOpen = _a.isOpen, children = _a.children, onCancel = _a.onCancel, onValidate = _a.onValidate, _b = _a.cancelLabel, cancelLabel = _b === void 0 ? "Cancel" : _b, _c = _a.validateLabel, validateLabel = _c === void 0 ? "Ok" : _c, _d = _a.validateVariant, validateVariant = _d === void 0 ? "primary" : _d, title = _a.title;
33619
33634
  return (React.createElement(tt, { show: isOpen, as: React.Fragment, appear: true },
@@ -33869,6 +33884,7 @@ exports.DriveLogo = SvgDrive;
33869
33884
  exports.DropdownMenu = DropdownMenu;
33870
33885
  exports.DustIcon = SvgDust$1;
33871
33886
  exports.DustStrokeIcon = SvgDust;
33887
+ exports.ElementModal = ElementModal;
33872
33888
  exports.EmotionLaughIcon = SvgEmotionLaugh$1;
33873
33889
  exports.EmotionLaughStrokeIcon = SvgEmotionLaugh;
33874
33890
  exports.EqualizerIcon = SvgEqualizer$1;