@scripso-homepad/ui 0.4.8 → 0.4.10

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.
Files changed (39) hide show
  1. package/dist/{chunk-DAOLVE64.js → chunk-YSDLHEJ7.js} +204 -14
  2. package/dist/chunk-YSDLHEJ7.js.map +1 -0
  3. package/dist/index.cjs +130 -87
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +2 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.js +176 -323
  8. package/dist/index.js.map +1 -1
  9. package/dist/web/index.cjs +882 -30
  10. package/dist/web/index.cjs.map +1 -1
  11. package/dist/web/index.css +161 -0
  12. package/dist/web/index.css.map +1 -1
  13. package/dist/web/index.d.cts +90 -3
  14. package/dist/web/index.d.ts +90 -3
  15. package/dist/web/index.js +645 -19
  16. package/dist/web/index.js.map +1 -1
  17. package/package.json +9 -3
  18. package/src/components/Button.tsx +10 -3
  19. package/src/components/DatePicker.tsx +37 -3
  20. package/src/components/Select.tsx +1 -1
  21. package/src/web/components/ConfirmModal.stories.tsx +55 -0
  22. package/src/web/components/ConfirmModal.tsx +116 -0
  23. package/src/web/components/Drawer.stories.tsx +234 -0
  24. package/src/web/components/Drawer.tsx +169 -0
  25. package/src/web/components/HistoryTimeline.tsx +46 -0
  26. package/src/web/components/Modal.stories.tsx +130 -0
  27. package/src/web/components/Modal.tsx +162 -0
  28. package/src/web/components/TableActionButton.tsx +9 -4
  29. package/src/web/components/Toaster.stories.tsx +106 -0
  30. package/src/web/components/Toaster.tsx +92 -0
  31. package/src/web/components/ToasterProvider.tsx +6 -0
  32. package/src/web/components/drawer-scroll.css +41 -0
  33. package/src/web/components/sonner-toast.css +141 -0
  34. package/src/web/icons/TimelineCheckIcon.tsx +24 -0
  35. package/src/web/icons/ToastIcons.tsx +119 -0
  36. package/src/web/index.ts +26 -0
  37. package/src/web/mutation-toast.ts +33 -0
  38. package/src/web/toast.ts +1 -0
  39. package/dist/chunk-DAOLVE64.js.map +0 -1
package/dist/web/index.js CHANGED
@@ -1,10 +1,13 @@
1
- import { __commonJS, __require, __toESM, Input } from '../chunk-DAOLVE64.js';
1
+ import { __commonJS, __require, __toESM, Input, Button } from '../chunk-YSDLHEJ7.js';
2
2
  import { ChevronsUpDown, Search, LogOut, PanelLeftClose, PanelLeftOpen, X, Menu, ChevronLeft, ChevronRight } from 'lucide-react';
3
3
  import { clsx } from 'clsx';
4
4
  import { twMerge } from 'tailwind-merge';
5
5
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
6
6
  import { createContext, forwardRef, useRef, useEffect, useState, useId, useCallback, useMemo, useContext, useLayoutEffect } from 'react';
7
7
  import { NavLink, useLocation } from 'react-router-dom';
8
+ import { Toaster as Toaster$1, toast } from 'sonner';
9
+ export { toast } from 'sonner';
10
+ import 'sonner/dist/styles.css';
8
11
 
9
12
  // node_modules/react-dom/node_modules/scheduler/cjs/scheduler.production.min.js
10
13
  var require_scheduler_production_min = __commonJS({
@@ -5342,7 +5345,7 @@ var require_react_dom_production_min = __commonJS({
5342
5345
  if (5 === d || 6 === d) a = a.stateNode, b ? c.insertBefore(a, b) : c.appendChild(a);
5343
5346
  else if (4 !== d && (a = a.child, null !== a)) for (Wj(a, b, c), a = a.sibling; null !== a; ) Wj(a, b, c), a = a.sibling;
5344
5347
  }
5345
- var X2 = null;
5348
+ var X3 = null;
5346
5349
  var Xj = false;
5347
5350
  function Yj(a, b, c) {
5348
5351
  for (c = c.child; null !== c; ) Zj(a, b, c), c = c.sibling;
@@ -5356,23 +5359,23 @@ var require_react_dom_production_min = __commonJS({
5356
5359
  case 5:
5357
5360
  U || Lj(c, b);
5358
5361
  case 6:
5359
- var d = X2, e = Xj;
5360
- X2 = null;
5362
+ var d = X3, e = Xj;
5363
+ X3 = null;
5361
5364
  Yj(a, b, c);
5362
- X2 = d;
5365
+ X3 = d;
5363
5366
  Xj = e;
5364
- null !== X2 && (Xj ? (a = X2, c = c.stateNode, 8 === a.nodeType ? a.parentNode.removeChild(c) : a.removeChild(c)) : X2.removeChild(c.stateNode));
5367
+ null !== X3 && (Xj ? (a = X3, c = c.stateNode, 8 === a.nodeType ? a.parentNode.removeChild(c) : a.removeChild(c)) : X3.removeChild(c.stateNode));
5365
5368
  break;
5366
5369
  case 18:
5367
- null !== X2 && (Xj ? (a = X2, c = c.stateNode, 8 === a.nodeType ? Kf(a.parentNode, c) : 1 === a.nodeType && Kf(a, c), bd(a)) : Kf(X2, c.stateNode));
5370
+ null !== X3 && (Xj ? (a = X3, c = c.stateNode, 8 === a.nodeType ? Kf(a.parentNode, c) : 1 === a.nodeType && Kf(a, c), bd(a)) : Kf(X3, c.stateNode));
5368
5371
  break;
5369
5372
  case 4:
5370
- d = X2;
5373
+ d = X3;
5371
5374
  e = Xj;
5372
- X2 = c.stateNode.containerInfo;
5375
+ X3 = c.stateNode.containerInfo;
5373
5376
  Xj = true;
5374
5377
  Yj(a, b, c);
5375
- X2 = d;
5378
+ X3 = d;
5376
5379
  Xj = e;
5377
5380
  break;
5378
5381
  case 0:
@@ -5429,23 +5432,23 @@ var require_react_dom_production_min = __commonJS({
5429
5432
  a: for (; null !== h; ) {
5430
5433
  switch (h.tag) {
5431
5434
  case 5:
5432
- X2 = h.stateNode;
5435
+ X3 = h.stateNode;
5433
5436
  Xj = false;
5434
5437
  break a;
5435
5438
  case 3:
5436
- X2 = h.stateNode.containerInfo;
5439
+ X3 = h.stateNode.containerInfo;
5437
5440
  Xj = true;
5438
5441
  break a;
5439
5442
  case 4:
5440
- X2 = h.stateNode.containerInfo;
5443
+ X3 = h.stateNode.containerInfo;
5441
5444
  Xj = true;
5442
5445
  break a;
5443
5446
  }
5444
5447
  h = h.return;
5445
5448
  }
5446
- if (null === X2) throw Error(p(160));
5449
+ if (null === X3) throw Error(p(160));
5447
5450
  Zj(f, g, e);
5448
- X2 = null;
5451
+ X3 = null;
5449
5452
  Xj = false;
5450
5453
  var k = e.alternate;
5451
5454
  null !== k && (k.return = null);
@@ -29835,10 +29838,10 @@ function TableActionsCell({ className, children, ...props }) {
29835
29838
 
29836
29839
  // src/web/components/TableActionsMenu.tsx
29837
29840
  var import_react_dom = __toESM(require_react_dom(), 1);
29838
- var actionButtonClassName = "inline-flex cursor-pointer items-center gap-1 rounded-lg border border-storm-gray-50 bg-white px-3 py-2 font-sans text-xs font-medium leading-none text-storm-gray-900 transition-colors hover:bg-storm-gray-0";
29841
+ var inlineActionClassName = "inline-flex cursor-pointer items-center gap-1 rounded-lg border border-storm-gray-50 bg-white px-3 py-2 font-sans text-xs font-medium leading-none text-storm-gray-900 transition-colors hover:bg-storm-gray-0";
29839
29842
  var variantClasses = {
29840
- approve: actionButtonClassName,
29841
- reject: actionButtonClassName,
29843
+ approve: inlineActionClassName,
29844
+ reject: inlineActionClassName,
29842
29845
  menu: "inline-flex size-7 cursor-pointer items-center justify-center rounded-lg text-storm-gray-500 transition-colors hover:bg-storm-gray-0 hover:text-storm-gray-900"
29843
29846
  };
29844
29847
  var inlineActionIconClassName = "inline-flex size-4 shrink-0 items-center justify-center [&_svg]:size-4";
@@ -29854,6 +29857,7 @@ var TableActionButton = forwardRef(
29854
29857
  ...props
29855
29858
  }, ref) {
29856
29859
  const isInlineAction = variant === "approve" || variant === "reject";
29860
+ const hasLabel = Boolean(children);
29857
29861
  return /* @__PURE__ */ jsxs(
29858
29862
  "button",
29859
29863
  {
@@ -29864,6 +29868,7 @@ var TableActionButton = forwardRef(
29864
29868
  "aria-label": ariaLabel,
29865
29869
  className: cn(
29866
29870
  variantClasses[variant],
29871
+ isInlineAction && !hasLabel && "px-2",
29867
29872
  disabled && "cursor-not-allowed opacity-50",
29868
29873
  className
29869
29874
  ),
@@ -30252,6 +30257,627 @@ function TableIconText({ icon, children, className }) {
30252
30257
  }
30253
30258
  );
30254
30259
  }
30260
+ var footerAlignClasses = {
30261
+ left: "justify-start",
30262
+ center: "justify-center",
30263
+ right: "justify-end"
30264
+ };
30265
+ function Modal({
30266
+ open,
30267
+ title,
30268
+ subtitle,
30269
+ icon,
30270
+ iconContainerClassName,
30271
+ children,
30272
+ cancelText,
30273
+ confirmText,
30274
+ onCancel,
30275
+ onConfirm,
30276
+ footerAlign = "right",
30277
+ footerLayout = "inline",
30278
+ cancelDisabled = false,
30279
+ confirmDisabled = false,
30280
+ closeOnBackdrop = true,
30281
+ containerClassName,
30282
+ contentClassName,
30283
+ buttonClassName
30284
+ }) {
30285
+ useEffect(() => {
30286
+ if (!open) {
30287
+ return;
30288
+ }
30289
+ const handleKeyDown = (event) => {
30290
+ if (event.key === "Escape") {
30291
+ onCancel();
30292
+ }
30293
+ };
30294
+ window.addEventListener("keydown", handleKeyDown);
30295
+ return () => {
30296
+ window.removeEventListener("keydown", handleKeyDown);
30297
+ };
30298
+ }, [open, onCancel]);
30299
+ if (!open) {
30300
+ return null;
30301
+ }
30302
+ const sharedButtonClassName = cn(
30303
+ "btn h-13 justify-center!",
30304
+ footerLayout === "split" && "min-w-0 flex-1 basis-0",
30305
+ footerLayout !== "split" && buttonClassName
30306
+ );
30307
+ return /* @__PURE__ */ jsx(
30308
+ "div",
30309
+ {
30310
+ className: "fixed inset-0 z-50 flex items-center justify-center p-4 backdrop-blur-[12px] bg-storm-gray-850/40",
30311
+ onClick: closeOnBackdrop ? onCancel : void 0,
30312
+ role: "presentation",
30313
+ children: /* @__PURE__ */ jsxs(
30314
+ "div",
30315
+ {
30316
+ role: "dialog",
30317
+ "aria-modal": "true",
30318
+ "aria-labelledby": "homepad-modal-title",
30319
+ ...subtitle ? { "aria-describedby": "homepad-modal-subtitle" } : {},
30320
+ className: cn(
30321
+ "flex w-full max-w-2xl flex-col gap-6 rounded-2xl bg-white p-4 opacity-100 md:p-6",
30322
+ containerClassName
30323
+ ),
30324
+ onClick: (event) => {
30325
+ event.stopPropagation();
30326
+ },
30327
+ children: [
30328
+ /* @__PURE__ */ jsxs("header", { className: cn("flex", icon ? "items-center gap-2.5" : void 0), children: [
30329
+ icon ? /* @__PURE__ */ jsx(
30330
+ "div",
30331
+ {
30332
+ className: cn(
30333
+ "flex size-11 shrink-0 items-center justify-center rounded-lg bg-storm-gray-50 p-3 opacity-100",
30334
+ iconContainerClassName
30335
+ ),
30336
+ children: /* @__PURE__ */ jsx("div", { className: "flex size-5 shrink-0 items-center justify-center [&>*]:size-5 [&_svg]:size-5", children: icon })
30337
+ }
30338
+ ) : null,
30339
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-2", children: [
30340
+ /* @__PURE__ */ jsx(
30341
+ "h2",
30342
+ {
30343
+ id: "homepad-modal-title",
30344
+ className: "font-sans text-lg font-bold leading-6 tracking-normal text-black",
30345
+ children: title
30346
+ }
30347
+ ),
30348
+ subtitle ? /* @__PURE__ */ jsx(
30349
+ "p",
30350
+ {
30351
+ id: "homepad-modal-subtitle",
30352
+ className: "font-sans text-xs font-normal leading-4 tracking-normal text-storm-gray-400",
30353
+ children: subtitle
30354
+ }
30355
+ ) : null
30356
+ ] })
30357
+ ] }),
30358
+ /* @__PURE__ */ jsx("div", { className: cn("min-w-0", contentClassName), children }),
30359
+ /* @__PURE__ */ jsxs(
30360
+ "footer",
30361
+ {
30362
+ className: cn(
30363
+ "flex shrink-0 gap-4",
30364
+ footerLayout === "split" ? "w-full" : footerAlignClasses[footerAlign]
30365
+ ),
30366
+ children: [
30367
+ /* @__PURE__ */ jsx(
30368
+ Button,
30369
+ {
30370
+ title: cancelText,
30371
+ onPress: onCancel,
30372
+ variant: "gray",
30373
+ disabled: cancelDisabled,
30374
+ className: sharedButtonClassName,
30375
+ textClassName: "text-center!"
30376
+ }
30377
+ ),
30378
+ /* @__PURE__ */ jsx(
30379
+ Button,
30380
+ {
30381
+ title: confirmText,
30382
+ onPress: onConfirm,
30383
+ variant: "primary",
30384
+ disabled: confirmDisabled,
30385
+ className: sharedButtonClassName,
30386
+ textClassName: "text-center!"
30387
+ }
30388
+ )
30389
+ ]
30390
+ }
30391
+ )
30392
+ ]
30393
+ }
30394
+ )
30395
+ }
30396
+ );
30397
+ }
30398
+ var DRAWER_TRANSITION_MS = 300;
30399
+ function Drawer({
30400
+ open,
30401
+ title,
30402
+ subtitle,
30403
+ children,
30404
+ footer,
30405
+ onClose,
30406
+ closeAriaLabel = "Close",
30407
+ widthClassName = "w-full md:w-[464px]",
30408
+ className,
30409
+ headerClassName,
30410
+ contentClassName,
30411
+ footerClassName
30412
+ }) {
30413
+ const [isPresent, setIsPresent] = useState(open);
30414
+ const [isAnimatedIn, setIsAnimatedIn] = useState(false);
30415
+ useEffect(() => {
30416
+ if (open) {
30417
+ setIsPresent(true);
30418
+ const frame = window.requestAnimationFrame(() => {
30419
+ window.requestAnimationFrame(() => {
30420
+ setIsAnimatedIn(true);
30421
+ });
30422
+ });
30423
+ return () => {
30424
+ window.cancelAnimationFrame(frame);
30425
+ };
30426
+ }
30427
+ setIsAnimatedIn(false);
30428
+ const timeout = window.setTimeout(() => {
30429
+ setIsPresent(false);
30430
+ }, DRAWER_TRANSITION_MS);
30431
+ return () => {
30432
+ window.clearTimeout(timeout);
30433
+ };
30434
+ }, [open]);
30435
+ useEffect(() => {
30436
+ if (!isPresent) {
30437
+ return;
30438
+ }
30439
+ const previousOverflow = document.body.style.overflow;
30440
+ document.body.style.overflow = "hidden";
30441
+ const handleKeyDown = (event) => {
30442
+ if (event.key === "Escape") {
30443
+ onClose();
30444
+ }
30445
+ };
30446
+ window.addEventListener("keydown", handleKeyDown);
30447
+ return () => {
30448
+ document.body.style.overflow = previousOverflow;
30449
+ window.removeEventListener("keydown", handleKeyDown);
30450
+ };
30451
+ }, [isPresent, onClose]);
30452
+ if (!isPresent) {
30453
+ return null;
30454
+ }
30455
+ return /* @__PURE__ */ jsxs(
30456
+ "div",
30457
+ {
30458
+ className: "fixed inset-0 z-50 flex justify-end p-2 max-md:p-0",
30459
+ role: "presentation",
30460
+ children: [
30461
+ /* @__PURE__ */ jsx(
30462
+ "button",
30463
+ {
30464
+ type: "button",
30465
+ "aria-label": closeAriaLabel,
30466
+ className: cn(
30467
+ "absolute inset-0 bg-storm-gray-850/40 backdrop-blur-[12px] transition-opacity duration-300 ease-in-out",
30468
+ isAnimatedIn ? "opacity-100" : "opacity-0"
30469
+ ),
30470
+ onClick: onClose
30471
+ }
30472
+ ),
30473
+ /* @__PURE__ */ jsxs(
30474
+ "aside",
30475
+ {
30476
+ role: "dialog",
30477
+ "aria-modal": "true",
30478
+ "aria-labelledby": "homepad-drawer-title",
30479
+ ...subtitle ? { "aria-describedby": "homepad-drawer-subtitle" } : {},
30480
+ className: cn(
30481
+ "relative z-10 flex h-[calc(100dvh-16px)] min-h-0 flex-col overflow-hidden rounded-[16px] bg-white shadow-2xl transition-transform duration-300 ease-in-out will-change-transform max-md:h-dvh max-md:rounded-none",
30482
+ isAnimatedIn ? "translate-x-0" : "translate-x-full",
30483
+ widthClassName,
30484
+ className
30485
+ ),
30486
+ children: [
30487
+ /* @__PURE__ */ jsxs(
30488
+ "header",
30489
+ {
30490
+ className: cn(
30491
+ "flex h-[87px] shrink-0 items-start justify-between border-b border-storm-gray-50 pt-6 pr-6 pb-4 pl-6",
30492
+ headerClassName
30493
+ ),
30494
+ children: [
30495
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex flex-col gap-1", children: [
30496
+ /* @__PURE__ */ jsx(
30497
+ "h2",
30498
+ {
30499
+ id: "homepad-drawer-title",
30500
+ className: "font-sans text-[18px] font-bold leading-6 tracking-normal text-black",
30501
+ children: title
30502
+ }
30503
+ ),
30504
+ subtitle ? /* @__PURE__ */ jsx(
30505
+ "p",
30506
+ {
30507
+ id: "homepad-drawer-subtitle",
30508
+ className: "font-sans text-sm font-normal leading-[19px] tracking-normal text-storm-gray-400",
30509
+ children: subtitle
30510
+ }
30511
+ ) : null
30512
+ ] }),
30513
+ /* @__PURE__ */ jsx(
30514
+ "button",
30515
+ {
30516
+ type: "button",
30517
+ "aria-label": closeAriaLabel,
30518
+ className: "flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-lg text-storm-gray-400 transition-colors hover:bg-storm-gray-50 hover:text-storm-gray-600",
30519
+ onClick: onClose,
30520
+ children: /* @__PURE__ */ jsx(X, { className: "size-5", strokeWidth: 1.75 })
30521
+ }
30522
+ )
30523
+ ]
30524
+ }
30525
+ ),
30526
+ /* @__PURE__ */ jsx(
30527
+ "div",
30528
+ {
30529
+ className: cn(
30530
+ "drawer-scroll-area min-h-0 flex-1 overflow-y-auto px-6 pt-6 pb-0",
30531
+ contentClassName
30532
+ ),
30533
+ children
30534
+ }
30535
+ ),
30536
+ footer ? /* @__PURE__ */ jsx("footer", { className: cn("shrink-0 px-6 py-5", footerClassName), children: footer }) : null
30537
+ ]
30538
+ }
30539
+ )
30540
+ ]
30541
+ }
30542
+ );
30543
+ }
30544
+ function TimelineCheckIcon({ className, ...props }) {
30545
+ return /* @__PURE__ */ jsx(
30546
+ "svg",
30547
+ {
30548
+ width: "16",
30549
+ height: "16",
30550
+ viewBox: "0 0 16 16",
30551
+ fill: "none",
30552
+ xmlns: "http://www.w3.org/2000/svg",
30553
+ className,
30554
+ "aria-hidden": true,
30555
+ ...props,
30556
+ children: /* @__PURE__ */ jsx(
30557
+ "path",
30558
+ {
30559
+ d: "M13.3346 4L6.0013 11.3333L2.66797 8",
30560
+ stroke: "#279D54",
30561
+ strokeWidth: "1.5",
30562
+ strokeLinecap: "round",
30563
+ strokeLinejoin: "round"
30564
+ }
30565
+ )
30566
+ }
30567
+ );
30568
+ }
30569
+ function HistoryTimeline({ events }) {
30570
+ return /* @__PURE__ */ jsx("ol", { className: "m-0 flex list-none flex-col gap-1 p-0", children: events.map((event, index) => {
30571
+ const isLast = index === events.length - 1;
30572
+ return /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-3", children: [
30573
+ /* @__PURE__ */ jsxs("div", { className: "flex w-8 shrink-0 flex-col items-center", children: [
30574
+ /* @__PURE__ */ jsx("div", { className: "flex size-8 shrink-0 items-center justify-center rounded-[28px] border border-storm-gray-50 bg-white", children: /* @__PURE__ */ jsx(TimelineCheckIcon, { className: "size-4 shrink-0" }) }),
30575
+ !isLast ? /* @__PURE__ */ jsx(
30576
+ "div",
30577
+ {
30578
+ "aria-hidden": true,
30579
+ className: "mt-1 h-[31px] w-px shrink-0 border-l border-dashed border-storm-gray-100"
30580
+ }
30581
+ ) : null
30582
+ ] }),
30583
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-2 pt-1.5", children: [
30584
+ /* @__PURE__ */ jsx("p", { className: "font-sans text-sm font-medium leading-[19px] tracking-normal text-slate-blue", children: event.title }),
30585
+ /* @__PURE__ */ jsx("p", { className: "font-sans text-xs font-normal leading-4 tracking-normal text-storm-gray-300", children: event.timestamp })
30586
+ ] })
30587
+ ] }, event.id);
30588
+ }) });
30589
+ }
30590
+ function ToastCloseIcon(props) {
30591
+ return /* @__PURE__ */ jsx(
30592
+ "svg",
30593
+ {
30594
+ width: "20",
30595
+ height: "20",
30596
+ viewBox: "0 0 20 20",
30597
+ fill: "none",
30598
+ xmlns: "http://www.w3.org/2000/svg",
30599
+ "aria-hidden": true,
30600
+ ...props,
30601
+ children: /* @__PURE__ */ jsx(
30602
+ "path",
30603
+ {
30604
+ d: "M15 5L5 15M5 5L15 15",
30605
+ stroke: "#B5BCC1",
30606
+ strokeWidth: "2",
30607
+ strokeLinecap: "round",
30608
+ strokeLinejoin: "round"
30609
+ }
30610
+ )
30611
+ }
30612
+ );
30613
+ }
30614
+ function ToastSuccessIcon(props) {
30615
+ return /* @__PURE__ */ jsx(
30616
+ "svg",
30617
+ {
30618
+ width: "24",
30619
+ height: "24",
30620
+ viewBox: "0 0 24 24",
30621
+ fill: "none",
30622
+ xmlns: "http://www.w3.org/2000/svg",
30623
+ "aria-hidden": true,
30624
+ ...props,
30625
+ children: /* @__PURE__ */ jsx(
30626
+ "path",
30627
+ {
30628
+ d: "M20 6L9 17L4 12",
30629
+ stroke: "#279D54",
30630
+ strokeWidth: "2",
30631
+ strokeLinecap: "round",
30632
+ strokeLinejoin: "round"
30633
+ }
30634
+ )
30635
+ }
30636
+ );
30637
+ }
30638
+ function ToastErrorIcon(props) {
30639
+ return /* @__PURE__ */ jsx(
30640
+ "svg",
30641
+ {
30642
+ width: "24",
30643
+ height: "24",
30644
+ viewBox: "0 0 24 24",
30645
+ fill: "none",
30646
+ xmlns: "http://www.w3.org/2000/svg",
30647
+ "aria-hidden": true,
30648
+ ...props,
30649
+ children: /* @__PURE__ */ jsx(
30650
+ "path",
30651
+ {
30652
+ d: "M18 6L6 18M6 6L18 18",
30653
+ stroke: "#AE0011",
30654
+ strokeWidth: "2",
30655
+ strokeLinecap: "round",
30656
+ strokeLinejoin: "round"
30657
+ }
30658
+ )
30659
+ }
30660
+ );
30661
+ }
30662
+ function ToastWarningIcon(props) {
30663
+ return /* @__PURE__ */ jsx(
30664
+ "svg",
30665
+ {
30666
+ width: "24",
30667
+ height: "24",
30668
+ viewBox: "0 0 24 24",
30669
+ fill: "none",
30670
+ xmlns: "http://www.w3.org/2000/svg",
30671
+ "aria-hidden": true,
30672
+ ...props,
30673
+ children: /* @__PURE__ */ jsx(
30674
+ "path",
30675
+ {
30676
+ d: "M12.0001 9.00022V13.0002M12.0001 17.0002H12.0101M21.7301 18.0002L13.7301 4.00022C13.5556 3.69243 13.3027 3.43641 12.997 3.25829C12.6913 3.08017 12.3438 2.98633 11.9901 2.98633C11.6363 2.98633 11.2888 3.08017 10.9831 3.25829C10.6774 3.43641 10.4245 3.69243 10.2501 4.00022L2.25005 18.0002C2.07373 18.3056 1.98128 18.6521 1.98206 19.0047C1.98284 19.3573 2.07683 19.7035 2.2545 20.008C2.43217 20.3126 2.6872 20.5648 2.99375 20.7391C3.30029 20.9133 3.64746 21.0034 4.00005 21.0002H20.0001C20.351 20.9999 20.6956 20.9072 20.9993 20.7315C21.3031 20.5558 21.5553 20.3033 21.7306 19.9993C21.9059 19.6954 21.9981 19.3506 21.998 18.9997C21.9979 18.6488 21.9055 18.3041 21.7301 18.0002Z",
30677
+ stroke: "#F2A800",
30678
+ strokeWidth: "2",
30679
+ strokeLinecap: "round",
30680
+ strokeLinejoin: "round"
30681
+ }
30682
+ )
30683
+ }
30684
+ );
30685
+ }
30686
+ function ToastInfoIcon(props) {
30687
+ return /* @__PURE__ */ jsx(
30688
+ "svg",
30689
+ {
30690
+ width: "24",
30691
+ height: "24",
30692
+ viewBox: "0 0 24 24",
30693
+ fill: "none",
30694
+ xmlns: "http://www.w3.org/2000/svg",
30695
+ "aria-hidden": true,
30696
+ ...props,
30697
+ children: /* @__PURE__ */ jsx(
30698
+ "path",
30699
+ {
30700
+ d: "M12 16V12M12 8H12.01M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z",
30701
+ stroke: "#0F52C7",
30702
+ strokeWidth: "2",
30703
+ strokeLinecap: "round",
30704
+ strokeLinejoin: "round"
30705
+ }
30706
+ )
30707
+ }
30708
+ );
30709
+ }
30710
+ function ToastIconBadge({
30711
+ tone,
30712
+ children
30713
+ }) {
30714
+ return /* @__PURE__ */ jsx("div", { className: `homepad-toast__icon-badge homepad-toast__icon-badge--${tone}`, children });
30715
+ }
30716
+ var homepadToastIcons = {
30717
+ success: /* @__PURE__ */ jsx(ToastIconBadge, { tone: "success", children: /* @__PURE__ */ jsx(ToastSuccessIcon, {}) }),
30718
+ error: /* @__PURE__ */ jsx(ToastIconBadge, { tone: "error", children: /* @__PURE__ */ jsx(ToastErrorIcon, {}) }),
30719
+ warning: /* @__PURE__ */ jsx(ToastIconBadge, { tone: "warning", children: /* @__PURE__ */ jsx(ToastWarningIcon, {}) }),
30720
+ info: /* @__PURE__ */ jsx(ToastIconBadge, { tone: "info", children: /* @__PURE__ */ jsx(ToastInfoIcon, {}) }),
30721
+ close: /* @__PURE__ */ jsx(ToastCloseIcon, {})
30722
+ };
30723
+ function Toaster({
30724
+ className,
30725
+ position = "bottom-right",
30726
+ theme = "light",
30727
+ closeButton = true,
30728
+ gap = 12,
30729
+ offset = 20,
30730
+ toastOptions,
30731
+ icons,
30732
+ ...props
30733
+ }) {
30734
+ return /* @__PURE__ */ jsx(
30735
+ Toaster$1,
30736
+ {
30737
+ className: ["homepad-toaster", className].filter(Boolean).join(" "),
30738
+ theme,
30739
+ position,
30740
+ closeButton,
30741
+ gap,
30742
+ offset,
30743
+ mobileOffset: 8,
30744
+ icons: { ...homepadToastIcons, ...icons },
30745
+ toastOptions: {
30746
+ duration: 4e3,
30747
+ classNames: {
30748
+ toast: "homepad-toast",
30749
+ title: "homepad-toast__title",
30750
+ description: "homepad-toast__description",
30751
+ content: "homepad-toast__content",
30752
+ icon: "homepad-toast__icon",
30753
+ closeButton: "homepad-toast__close",
30754
+ ...toastOptions?.classNames
30755
+ },
30756
+ ...toastOptions
30757
+ },
30758
+ ...props
30759
+ }
30760
+ );
30761
+ }
30762
+ function ToasterProvider() {
30763
+ return /* @__PURE__ */ jsx(Toaster, {});
30764
+ }
30765
+
30766
+ // src/web/mutation-toast.ts
30767
+ async function runMutationWithToast(action, messages, options) {
30768
+ try {
30769
+ await action();
30770
+ toast.success(messages.success);
30771
+ return { success: true };
30772
+ } catch (error) {
30773
+ const errorMessage = options?.getErrorMessage?.(error) ?? messages.error;
30774
+ toast.error(errorMessage);
30775
+ return { success: false, errorMessage };
30776
+ }
30777
+ }
30778
+ function ConfirmModal({
30779
+ open,
30780
+ title,
30781
+ description,
30782
+ cancelText,
30783
+ confirmText,
30784
+ onCancel,
30785
+ onConfirm,
30786
+ cancelDisabled = false,
30787
+ confirmDisabled = false,
30788
+ closeOnBackdrop = true,
30789
+ containerClassName,
30790
+ buttonClassName
30791
+ }) {
30792
+ useEffect(() => {
30793
+ if (!open) {
30794
+ return;
30795
+ }
30796
+ const handleKeyDown = (event) => {
30797
+ if (event.key === "Escape") {
30798
+ onCancel();
30799
+ }
30800
+ };
30801
+ window.addEventListener("keydown", handleKeyDown);
30802
+ return () => {
30803
+ window.removeEventListener("keydown", handleKeyDown);
30804
+ };
30805
+ }, [open, onCancel]);
30806
+ if (!open) {
30807
+ return null;
30808
+ }
30809
+ const sharedButtonClassName = cn("btn h-10 min-w-0 flex-1 justify-center!", buttonClassName);
30810
+ return /* @__PURE__ */ jsx(
30811
+ "div",
30812
+ {
30813
+ className: "fixed inset-0 z-50 flex items-center justify-center p-4 backdrop-blur-md bg-storm-gray-850/40",
30814
+ onClick: closeOnBackdrop ? onCancel : void 0,
30815
+ role: "presentation",
30816
+ children: /* @__PURE__ */ jsxs(
30817
+ "div",
30818
+ {
30819
+ role: "dialog",
30820
+ "aria-modal": "true",
30821
+ "aria-labelledby": "homepad-confirm-modal-title",
30822
+ "aria-describedby": "homepad-confirm-modal-description",
30823
+ className: cn(
30824
+ "flex w-full max-w-md flex-col gap-8 rounded-2xl bg-white p-4 opacity-100 md:p-6",
30825
+ containerClassName
30826
+ ),
30827
+ onClick: (event) => {
30828
+ event.stopPropagation();
30829
+ },
30830
+ children: [
30831
+ /* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3 text-center", children: [
30832
+ /* @__PURE__ */ jsx(
30833
+ "h2",
30834
+ {
30835
+ id: "homepad-confirm-modal-title",
30836
+ className: "font-sans text-xl font-bold leading-6.75 tracking-normal text-black",
30837
+ children: title
30838
+ }
30839
+ ),
30840
+ /* @__PURE__ */ jsx(
30841
+ "div",
30842
+ {
30843
+ id: "homepad-confirm-modal-description",
30844
+ className: "text-center font-sans text-sm font-normal leading-4.75 tracking-normal text-storm-gray-400",
30845
+ children: description
30846
+ }
30847
+ )
30848
+ ] }),
30849
+ /* @__PURE__ */ jsxs("footer", { className: "flex w-full gap-4", children: [
30850
+ /* @__PURE__ */ jsx(
30851
+ Button,
30852
+ {
30853
+ title: cancelText,
30854
+ onPress: onCancel,
30855
+ variant: "gray",
30856
+ size: "sm",
30857
+ disabled: cancelDisabled,
30858
+ className: sharedButtonClassName,
30859
+ textClassName: "text-center!"
30860
+ }
30861
+ ),
30862
+ /* @__PURE__ */ jsx(
30863
+ Button,
30864
+ {
30865
+ title: confirmText,
30866
+ onPress: onConfirm,
30867
+ variant: "primary",
30868
+ size: "sm",
30869
+ disabled: confirmDisabled,
30870
+ className: sharedButtonClassName,
30871
+ textClassName: "text-center!"
30872
+ }
30873
+ )
30874
+ ] })
30875
+ ]
30876
+ }
30877
+ )
30878
+ }
30879
+ );
30880
+ }
30255
30881
  /*! Bundled license information:
30256
30882
 
30257
30883
  scheduler/cjs/scheduler.production.min.js:
@@ -30312,6 +30938,6 @@ react-dom/cjs/react-dom.development.js:
30312
30938
  *)
30313
30939
  */
30314
30940
 
30315
- export { AppHeader, Badge, BellIcon, BuildingIcon, BuildingSelect, DEFAULT_TABLE_BODY_MIN_HEIGHT, DashboardLayout, DataTable, Pagination, Sidebar, SidebarMobileHeader, SidebarNavItem, SidebarUserCard, StatusBadge, Table, TableActionButton, TableActionsCell, TableActionsMenu, TableBody, TableCell, TableHead, TableHeader, TableIconText, TableMenuActivateIcon, TableMenuCheckIcon, TableMenuCloseIcon, TableMenuEditIcon, TableMenuInfoIcon, TableMenuRefreshIcon, TableMenuSuspendIcon, TableMenuTrashIcon, TableMoreIcon, TableRow, TableRowStatusActions, TableScrollArea, TableSortIcon, TableStatusActionsCell, cn, getPaginationRange, getTotalPages, getVisiblePageNumbers, tableRowDisabledCellClassName, useMediaQuery, useOnClickOutside };
30941
+ export { AppHeader, Badge, BellIcon, BuildingIcon, BuildingSelect, ConfirmModal, DEFAULT_TABLE_BODY_MIN_HEIGHT, DashboardLayout, DataTable, Drawer, HistoryTimeline, Modal, Pagination, Sidebar, SidebarMobileHeader, SidebarNavItem, SidebarUserCard, StatusBadge, Table, TableActionButton, TableActionsCell, TableActionsMenu, TableBody, TableCell, TableHead, TableHeader, TableIconText, TableMenuActivateIcon, TableMenuCheckIcon, TableMenuCloseIcon, TableMenuEditIcon, TableMenuInfoIcon, TableMenuRefreshIcon, TableMenuSuspendIcon, TableMenuTrashIcon, TableMoreIcon, TableRow, TableRowStatusActions, TableScrollArea, TableSortIcon, TableStatusActionsCell, Toaster, ToasterProvider, cn, getPaginationRange, getTotalPages, getVisiblePageNumbers, runMutationWithToast, tableRowDisabledCellClassName, useMediaQuery, useOnClickOutside };
30316
30942
  //# sourceMappingURL=index.js.map
30317
30943
  //# sourceMappingURL=index.js.map