@scripso-homepad/ui 0.4.9 → 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.
- package/dist/index.cjs +123 -84
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +123 -84
- package/dist/index.js.map +1 -1
- package/dist/web/index.cjs +413 -22
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.css +161 -0
- package/dist/web/index.css.map +1 -1
- package/dist/web/index.d.cts +48 -1
- package/dist/web/index.d.ts +48 -1
- package/dist/web/index.js +406 -23
- package/dist/web/index.js.map +1 -1
- package/package.json +9 -3
- package/src/components/DatePicker.tsx +37 -3
- package/src/web/components/Drawer.stories.tsx +234 -0
- package/src/web/components/Drawer.tsx +169 -0
- package/src/web/components/HistoryTimeline.tsx +46 -0
- package/src/web/components/Modal.tsx +5 -5
- package/src/web/components/TableActionButton.tsx +3 -3
- package/src/web/components/Toaster.stories.tsx +106 -0
- package/src/web/components/Toaster.tsx +92 -0
- package/src/web/components/ToasterProvider.tsx +6 -0
- package/src/web/components/drawer-scroll.css +41 -0
- package/src/web/components/sonner-toast.css +141 -0
- package/src/web/icons/TimelineCheckIcon.tsx +24 -0
- package/src/web/icons/ToastIcons.tsx +119 -0
- package/src/web/index.ts +20 -0
- package/src/web/mutation-toast.ts +33 -0
- package/src/web/toast.ts +1 -0
package/dist/web/index.js
CHANGED
|
@@ -5,6 +5,9 @@ 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
|
|
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 =
|
|
5360
|
-
|
|
5362
|
+
var d = X3, e = Xj;
|
|
5363
|
+
X3 = null;
|
|
5361
5364
|
Yj(a, b, c);
|
|
5362
|
-
|
|
5365
|
+
X3 = d;
|
|
5363
5366
|
Xj = e;
|
|
5364
|
-
null !==
|
|
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 !==
|
|
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 =
|
|
5373
|
+
d = X3;
|
|
5371
5374
|
e = Xj;
|
|
5372
|
-
|
|
5375
|
+
X3 = c.stateNode.containerInfo;
|
|
5373
5376
|
Xj = true;
|
|
5374
5377
|
Yj(a, b, c);
|
|
5375
|
-
|
|
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
|
-
|
|
5435
|
+
X3 = h.stateNode;
|
|
5433
5436
|
Xj = false;
|
|
5434
5437
|
break a;
|
|
5435
5438
|
case 3:
|
|
5436
|
-
|
|
5439
|
+
X3 = h.stateNode.containerInfo;
|
|
5437
5440
|
Xj = true;
|
|
5438
5441
|
break a;
|
|
5439
5442
|
case 4:
|
|
5440
|
-
|
|
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 ===
|
|
5449
|
+
if (null === X3) throw Error(p(160));
|
|
5447
5450
|
Zj(f, g, e);
|
|
5448
|
-
|
|
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
|
|
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:
|
|
29841
|
-
reject:
|
|
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";
|
|
@@ -30298,8 +30301,8 @@ function Modal({
|
|
|
30298
30301
|
}
|
|
30299
30302
|
const sharedButtonClassName = cn(
|
|
30300
30303
|
"btn h-13 justify-center!",
|
|
30301
|
-
footerLayout === "split" && "min-w-0 flex-1",
|
|
30302
|
-
buttonClassName
|
|
30304
|
+
footerLayout === "split" && "min-w-0 flex-1 basis-0",
|
|
30305
|
+
footerLayout !== "split" && buttonClassName
|
|
30303
30306
|
);
|
|
30304
30307
|
return /* @__PURE__ */ jsx(
|
|
30305
30308
|
"div",
|
|
@@ -30338,7 +30341,7 @@ function Modal({
|
|
|
30338
30341
|
"h2",
|
|
30339
30342
|
{
|
|
30340
30343
|
id: "homepad-modal-title",
|
|
30341
|
-
className: "font-sans text-lg font-bold leading-
|
|
30344
|
+
className: "font-sans text-lg font-bold leading-6 tracking-normal text-black",
|
|
30342
30345
|
children: title
|
|
30343
30346
|
}
|
|
30344
30347
|
),
|
|
@@ -30346,7 +30349,7 @@ function Modal({
|
|
|
30346
30349
|
"p",
|
|
30347
30350
|
{
|
|
30348
30351
|
id: "homepad-modal-subtitle",
|
|
30349
|
-
className: "font-sans text-xs font-normal leading-
|
|
30352
|
+
className: "font-sans text-xs font-normal leading-4 tracking-normal text-storm-gray-400",
|
|
30350
30353
|
children: subtitle
|
|
30351
30354
|
}
|
|
30352
30355
|
) : null
|
|
@@ -30357,7 +30360,7 @@ function Modal({
|
|
|
30357
30360
|
"footer",
|
|
30358
30361
|
{
|
|
30359
30362
|
className: cn(
|
|
30360
|
-
"flex gap-4",
|
|
30363
|
+
"flex shrink-0 gap-4",
|
|
30361
30364
|
footerLayout === "split" ? "w-full" : footerAlignClasses[footerAlign]
|
|
30362
30365
|
),
|
|
30363
30366
|
children: [
|
|
@@ -30392,6 +30395,386 @@ function Modal({
|
|
|
30392
30395
|
}
|
|
30393
30396
|
);
|
|
30394
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
|
+
}
|
|
30395
30778
|
function ConfirmModal({
|
|
30396
30779
|
open,
|
|
30397
30780
|
title,
|
|
@@ -30555,6 +30938,6 @@ react-dom/cjs/react-dom.development.js:
|
|
|
30555
30938
|
*)
|
|
30556
30939
|
*/
|
|
30557
30940
|
|
|
30558
|
-
export { AppHeader, Badge, BellIcon, BuildingIcon, BuildingSelect, ConfirmModal, DEFAULT_TABLE_BODY_MIN_HEIGHT, DashboardLayout, DataTable, 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, 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 };
|
|
30559
30942
|
//# sourceMappingURL=index.js.map
|
|
30560
30943
|
//# sourceMappingURL=index.js.map
|