@dust-tt/sparkle 0.2.91-pr → 0.2.91-pr2

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
@@ -33553,15 +33553,6 @@ var variantSize = {
33553
33553
  dialogue: "",
33554
33554
  "side-sm": "sm:s-w-[448px]",
33555
33555
  };
33556
- var styleKeys = [
33557
- "containerClasses",
33558
- "panelClasses",
33559
- "innerContainerClasses",
33560
- "transitionEnterFrom",
33561
- "transitionEnterTo",
33562
- "transitionLeaveFrom",
33563
- "transitionLeaveTo",
33564
- ];
33565
33556
  var modalStyles = (_a = {},
33566
33557
  _a[ModalType.Side] = {
33567
33558
  containerClasses: "s-h-full s-ml-auto",
@@ -33591,24 +33582,6 @@ var modalStyles = (_a = {},
33591
33582
  innerContainerClasses: "",
33592
33583
  },
33593
33584
  _a);
33594
- // RESPONSIVE: on mobile, display a side modal as a fullscren modal
33595
- /////////////
33596
- // function that appends "sm:" to every class in the string
33597
- var sm = function (classes) {
33598
- return classes
33599
- .split(" ")
33600
- .map(function (c) { return "sm:".concat(c); })
33601
- .join(" ");
33602
- };
33603
- // function that creates a new class that combines the classes from the full
33604
- // screen if mobile, and side modal if desktop
33605
- var newClass = function (key) {
33606
- return modalStyles[ModalType.FullScreen][key] +
33607
- " " +
33608
- sm(modalStyles[ModalType.Side][key]);
33609
- };
33610
- var sideModalResponsiveStyles = Object.fromEntries(styleKeys.map(function (key) { return [key, newClass(key)]; }));
33611
- modalStyles[ModalType.Side] = sideModalResponsiveStyles;
33612
33585
  var getModalClasses = function (type) { return modalStyles[type] || {}; };
33613
33586
  function Modal(_a) {
33614
33587
  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;
@@ -33616,6 +33589,11 @@ function Modal(_a) {
33616
33589
  if (variant === "dialogue") {
33617
33590
  console.warn("Dialogue variant of Modal is deprecated. Please use either another variant of Modal or the Dialog component.");
33618
33591
  }
33592
+ // checks whether we are on mobile or desktop
33593
+ var isMobile = window.innerWidth < 640;
33594
+ if (isMobile) {
33595
+ variant = "full-screen";
33596
+ }
33619
33597
  var buttonBarProps = hasChanged
33620
33598
  ? {
33621
33599
  variant: "validate",