@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.cjs
CHANGED
|
@@ -8,6 +8,8 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
8
8
|
var clsx = require('clsx');
|
|
9
9
|
var tailwindMerge = require('tailwind-merge');
|
|
10
10
|
var reactRouterDom = require('react-router-dom');
|
|
11
|
+
var sonner = require('sonner');
|
|
12
|
+
require('sonner/dist/styles.css');
|
|
11
13
|
|
|
12
14
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
15
|
|
|
@@ -5381,7 +5383,7 @@ var require_react_dom_production_min = __commonJS({
|
|
|
5381
5383
|
if (5 === d || 6 === d) a = a.stateNode, b ? c.insertBefore(a, b) : c.appendChild(a);
|
|
5382
5384
|
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;
|
|
5383
5385
|
}
|
|
5384
|
-
var
|
|
5386
|
+
var X3 = null;
|
|
5385
5387
|
var Xj = false;
|
|
5386
5388
|
function Yj(a, b, c) {
|
|
5387
5389
|
for (c = c.child; null !== c; ) Zj(a, b, c), c = c.sibling;
|
|
@@ -5395,23 +5397,23 @@ var require_react_dom_production_min = __commonJS({
|
|
|
5395
5397
|
case 5:
|
|
5396
5398
|
U || Lj(c, b);
|
|
5397
5399
|
case 6:
|
|
5398
|
-
var d =
|
|
5399
|
-
|
|
5400
|
+
var d = X3, e = Xj;
|
|
5401
|
+
X3 = null;
|
|
5400
5402
|
Yj(a, b, c);
|
|
5401
|
-
|
|
5403
|
+
X3 = d;
|
|
5402
5404
|
Xj = e;
|
|
5403
|
-
null !==
|
|
5405
|
+
null !== X3 && (Xj ? (a = X3, c = c.stateNode, 8 === a.nodeType ? a.parentNode.removeChild(c) : a.removeChild(c)) : X3.removeChild(c.stateNode));
|
|
5404
5406
|
break;
|
|
5405
5407
|
case 18:
|
|
5406
|
-
null !==
|
|
5408
|
+
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));
|
|
5407
5409
|
break;
|
|
5408
5410
|
case 4:
|
|
5409
|
-
d =
|
|
5411
|
+
d = X3;
|
|
5410
5412
|
e = Xj;
|
|
5411
|
-
|
|
5413
|
+
X3 = c.stateNode.containerInfo;
|
|
5412
5414
|
Xj = true;
|
|
5413
5415
|
Yj(a, b, c);
|
|
5414
|
-
|
|
5416
|
+
X3 = d;
|
|
5415
5417
|
Xj = e;
|
|
5416
5418
|
break;
|
|
5417
5419
|
case 0:
|
|
@@ -5468,23 +5470,23 @@ var require_react_dom_production_min = __commonJS({
|
|
|
5468
5470
|
a: for (; null !== h; ) {
|
|
5469
5471
|
switch (h.tag) {
|
|
5470
5472
|
case 5:
|
|
5471
|
-
|
|
5473
|
+
X3 = h.stateNode;
|
|
5472
5474
|
Xj = false;
|
|
5473
5475
|
break a;
|
|
5474
5476
|
case 3:
|
|
5475
|
-
|
|
5477
|
+
X3 = h.stateNode.containerInfo;
|
|
5476
5478
|
Xj = true;
|
|
5477
5479
|
break a;
|
|
5478
5480
|
case 4:
|
|
5479
|
-
|
|
5481
|
+
X3 = h.stateNode.containerInfo;
|
|
5480
5482
|
Xj = true;
|
|
5481
5483
|
break a;
|
|
5482
5484
|
}
|
|
5483
5485
|
h = h.return;
|
|
5484
5486
|
}
|
|
5485
|
-
if (null ===
|
|
5487
|
+
if (null === X3) throw Error(p(160));
|
|
5486
5488
|
Zj(f, g, e);
|
|
5487
|
-
|
|
5489
|
+
X3 = null;
|
|
5488
5490
|
Xj = false;
|
|
5489
5491
|
var k = e.alternate;
|
|
5490
5492
|
null !== k && (k.return = null);
|
|
@@ -30347,10 +30349,10 @@ function TableActionsCell({ className, children, ...props }) {
|
|
|
30347
30349
|
|
|
30348
30350
|
// src/web/components/TableActionsMenu.tsx
|
|
30349
30351
|
var import_react_dom = __toESM(require_react_dom());
|
|
30350
|
-
var
|
|
30352
|
+
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";
|
|
30351
30353
|
var variantClasses = {
|
|
30352
|
-
approve:
|
|
30353
|
-
reject:
|
|
30354
|
+
approve: inlineActionClassName,
|
|
30355
|
+
reject: inlineActionClassName,
|
|
30354
30356
|
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"
|
|
30355
30357
|
};
|
|
30356
30358
|
var inlineActionIconClassName = "inline-flex size-4 shrink-0 items-center justify-center [&_svg]:size-4";
|
|
@@ -31000,8 +31002,8 @@ function Modal({
|
|
|
31000
31002
|
}
|
|
31001
31003
|
const sharedButtonClassName = cn(
|
|
31002
31004
|
"btn h-13 justify-center!",
|
|
31003
|
-
footerLayout === "split" && "min-w-0 flex-1",
|
|
31004
|
-
buttonClassName
|
|
31005
|
+
footerLayout === "split" && "min-w-0 flex-1 basis-0",
|
|
31006
|
+
footerLayout !== "split" && buttonClassName
|
|
31005
31007
|
);
|
|
31006
31008
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
31007
31009
|
"div",
|
|
@@ -31040,7 +31042,7 @@ function Modal({
|
|
|
31040
31042
|
"h2",
|
|
31041
31043
|
{
|
|
31042
31044
|
id: "homepad-modal-title",
|
|
31043
|
-
className: "font-sans text-lg font-bold leading-
|
|
31045
|
+
className: "font-sans text-lg font-bold leading-6 tracking-normal text-black",
|
|
31044
31046
|
children: title
|
|
31045
31047
|
}
|
|
31046
31048
|
),
|
|
@@ -31048,7 +31050,7 @@ function Modal({
|
|
|
31048
31050
|
"p",
|
|
31049
31051
|
{
|
|
31050
31052
|
id: "homepad-modal-subtitle",
|
|
31051
|
-
className: "font-sans text-xs font-normal leading-
|
|
31053
|
+
className: "font-sans text-xs font-normal leading-4 tracking-normal text-storm-gray-400",
|
|
31052
31054
|
children: subtitle
|
|
31053
31055
|
}
|
|
31054
31056
|
) : null
|
|
@@ -31059,7 +31061,7 @@ function Modal({
|
|
|
31059
31061
|
"footer",
|
|
31060
31062
|
{
|
|
31061
31063
|
className: cn(
|
|
31062
|
-
"flex gap-4",
|
|
31064
|
+
"flex shrink-0 gap-4",
|
|
31063
31065
|
footerLayout === "split" ? "w-full" : footerAlignClasses[footerAlign]
|
|
31064
31066
|
),
|
|
31065
31067
|
children: [
|
|
@@ -31094,6 +31096,386 @@ function Modal({
|
|
|
31094
31096
|
}
|
|
31095
31097
|
);
|
|
31096
31098
|
}
|
|
31099
|
+
var DRAWER_TRANSITION_MS = 300;
|
|
31100
|
+
function Drawer({
|
|
31101
|
+
open,
|
|
31102
|
+
title,
|
|
31103
|
+
subtitle,
|
|
31104
|
+
children,
|
|
31105
|
+
footer,
|
|
31106
|
+
onClose,
|
|
31107
|
+
closeAriaLabel = "Close",
|
|
31108
|
+
widthClassName = "w-full md:w-[464px]",
|
|
31109
|
+
className,
|
|
31110
|
+
headerClassName,
|
|
31111
|
+
contentClassName,
|
|
31112
|
+
footerClassName
|
|
31113
|
+
}) {
|
|
31114
|
+
const [isPresent, setIsPresent] = react.useState(open);
|
|
31115
|
+
const [isAnimatedIn, setIsAnimatedIn] = react.useState(false);
|
|
31116
|
+
react.useEffect(() => {
|
|
31117
|
+
if (open) {
|
|
31118
|
+
setIsPresent(true);
|
|
31119
|
+
const frame = window.requestAnimationFrame(() => {
|
|
31120
|
+
window.requestAnimationFrame(() => {
|
|
31121
|
+
setIsAnimatedIn(true);
|
|
31122
|
+
});
|
|
31123
|
+
});
|
|
31124
|
+
return () => {
|
|
31125
|
+
window.cancelAnimationFrame(frame);
|
|
31126
|
+
};
|
|
31127
|
+
}
|
|
31128
|
+
setIsAnimatedIn(false);
|
|
31129
|
+
const timeout = window.setTimeout(() => {
|
|
31130
|
+
setIsPresent(false);
|
|
31131
|
+
}, DRAWER_TRANSITION_MS);
|
|
31132
|
+
return () => {
|
|
31133
|
+
window.clearTimeout(timeout);
|
|
31134
|
+
};
|
|
31135
|
+
}, [open]);
|
|
31136
|
+
react.useEffect(() => {
|
|
31137
|
+
if (!isPresent) {
|
|
31138
|
+
return;
|
|
31139
|
+
}
|
|
31140
|
+
const previousOverflow = document.body.style.overflow;
|
|
31141
|
+
document.body.style.overflow = "hidden";
|
|
31142
|
+
const handleKeyDown = (event) => {
|
|
31143
|
+
if (event.key === "Escape") {
|
|
31144
|
+
onClose();
|
|
31145
|
+
}
|
|
31146
|
+
};
|
|
31147
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
31148
|
+
return () => {
|
|
31149
|
+
document.body.style.overflow = previousOverflow;
|
|
31150
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
31151
|
+
};
|
|
31152
|
+
}, [isPresent, onClose]);
|
|
31153
|
+
if (!isPresent) {
|
|
31154
|
+
return null;
|
|
31155
|
+
}
|
|
31156
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
31157
|
+
"div",
|
|
31158
|
+
{
|
|
31159
|
+
className: "fixed inset-0 z-50 flex justify-end p-2 max-md:p-0",
|
|
31160
|
+
role: "presentation",
|
|
31161
|
+
children: [
|
|
31162
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
31163
|
+
"button",
|
|
31164
|
+
{
|
|
31165
|
+
type: "button",
|
|
31166
|
+
"aria-label": closeAriaLabel,
|
|
31167
|
+
className: cn(
|
|
31168
|
+
"absolute inset-0 bg-storm-gray-850/40 backdrop-blur-[12px] transition-opacity duration-300 ease-in-out",
|
|
31169
|
+
isAnimatedIn ? "opacity-100" : "opacity-0"
|
|
31170
|
+
),
|
|
31171
|
+
onClick: onClose
|
|
31172
|
+
}
|
|
31173
|
+
),
|
|
31174
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
31175
|
+
"aside",
|
|
31176
|
+
{
|
|
31177
|
+
role: "dialog",
|
|
31178
|
+
"aria-modal": "true",
|
|
31179
|
+
"aria-labelledby": "homepad-drawer-title",
|
|
31180
|
+
...subtitle ? { "aria-describedby": "homepad-drawer-subtitle" } : {},
|
|
31181
|
+
className: cn(
|
|
31182
|
+
"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",
|
|
31183
|
+
isAnimatedIn ? "translate-x-0" : "translate-x-full",
|
|
31184
|
+
widthClassName,
|
|
31185
|
+
className
|
|
31186
|
+
),
|
|
31187
|
+
children: [
|
|
31188
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
31189
|
+
"header",
|
|
31190
|
+
{
|
|
31191
|
+
className: cn(
|
|
31192
|
+
"flex h-[87px] shrink-0 items-start justify-between border-b border-storm-gray-50 pt-6 pr-6 pb-4 pl-6",
|
|
31193
|
+
headerClassName
|
|
31194
|
+
),
|
|
31195
|
+
children: [
|
|
31196
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex flex-col gap-1", children: [
|
|
31197
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
31198
|
+
"h2",
|
|
31199
|
+
{
|
|
31200
|
+
id: "homepad-drawer-title",
|
|
31201
|
+
className: "font-sans text-[18px] font-bold leading-6 tracking-normal text-black",
|
|
31202
|
+
children: title
|
|
31203
|
+
}
|
|
31204
|
+
),
|
|
31205
|
+
subtitle ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
31206
|
+
"p",
|
|
31207
|
+
{
|
|
31208
|
+
id: "homepad-drawer-subtitle",
|
|
31209
|
+
className: "font-sans text-sm font-normal leading-[19px] tracking-normal text-storm-gray-400",
|
|
31210
|
+
children: subtitle
|
|
31211
|
+
}
|
|
31212
|
+
) : null
|
|
31213
|
+
] }),
|
|
31214
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
31215
|
+
"button",
|
|
31216
|
+
{
|
|
31217
|
+
type: "button",
|
|
31218
|
+
"aria-label": closeAriaLabel,
|
|
31219
|
+
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",
|
|
31220
|
+
onClick: onClose,
|
|
31221
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-5", strokeWidth: 1.75 })
|
|
31222
|
+
}
|
|
31223
|
+
)
|
|
31224
|
+
]
|
|
31225
|
+
}
|
|
31226
|
+
),
|
|
31227
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
31228
|
+
"div",
|
|
31229
|
+
{
|
|
31230
|
+
className: cn(
|
|
31231
|
+
"drawer-scroll-area min-h-0 flex-1 overflow-y-auto px-6 pt-6 pb-0",
|
|
31232
|
+
contentClassName
|
|
31233
|
+
),
|
|
31234
|
+
children
|
|
31235
|
+
}
|
|
31236
|
+
),
|
|
31237
|
+
footer ? /* @__PURE__ */ jsxRuntime.jsx("footer", { className: cn("shrink-0 px-6 py-5", footerClassName), children: footer }) : null
|
|
31238
|
+
]
|
|
31239
|
+
}
|
|
31240
|
+
)
|
|
31241
|
+
]
|
|
31242
|
+
}
|
|
31243
|
+
);
|
|
31244
|
+
}
|
|
31245
|
+
function TimelineCheckIcon({ className, ...props }) {
|
|
31246
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
31247
|
+
"svg",
|
|
31248
|
+
{
|
|
31249
|
+
width: "16",
|
|
31250
|
+
height: "16",
|
|
31251
|
+
viewBox: "0 0 16 16",
|
|
31252
|
+
fill: "none",
|
|
31253
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
31254
|
+
className,
|
|
31255
|
+
"aria-hidden": true,
|
|
31256
|
+
...props,
|
|
31257
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
31258
|
+
"path",
|
|
31259
|
+
{
|
|
31260
|
+
d: "M13.3346 4L6.0013 11.3333L2.66797 8",
|
|
31261
|
+
stroke: "#279D54",
|
|
31262
|
+
strokeWidth: "1.5",
|
|
31263
|
+
strokeLinecap: "round",
|
|
31264
|
+
strokeLinejoin: "round"
|
|
31265
|
+
}
|
|
31266
|
+
)
|
|
31267
|
+
}
|
|
31268
|
+
);
|
|
31269
|
+
}
|
|
31270
|
+
function HistoryTimeline({ events }) {
|
|
31271
|
+
return /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "m-0 flex list-none flex-col gap-1 p-0", children: events.map((event, index) => {
|
|
31272
|
+
const isLast = index === events.length - 1;
|
|
31273
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "flex items-start gap-3", children: [
|
|
31274
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-8 shrink-0 flex-col items-center", children: [
|
|
31275
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-8 shrink-0 items-center justify-center rounded-[28px] border border-storm-gray-50 bg-white", children: /* @__PURE__ */ jsxRuntime.jsx(TimelineCheckIcon, { className: "size-4 shrink-0" }) }),
|
|
31276
|
+
!isLast ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
31277
|
+
"div",
|
|
31278
|
+
{
|
|
31279
|
+
"aria-hidden": true,
|
|
31280
|
+
className: "mt-1 h-[31px] w-px shrink-0 border-l border-dashed border-storm-gray-100"
|
|
31281
|
+
}
|
|
31282
|
+
) : null
|
|
31283
|
+
] }),
|
|
31284
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-2 pt-1.5", children: [
|
|
31285
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-sans text-sm font-medium leading-[19px] tracking-normal text-slate-blue", children: event.title }),
|
|
31286
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-sans text-xs font-normal leading-4 tracking-normal text-storm-gray-300", children: event.timestamp })
|
|
31287
|
+
] })
|
|
31288
|
+
] }, event.id);
|
|
31289
|
+
}) });
|
|
31290
|
+
}
|
|
31291
|
+
function ToastCloseIcon(props) {
|
|
31292
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
31293
|
+
"svg",
|
|
31294
|
+
{
|
|
31295
|
+
width: "20",
|
|
31296
|
+
height: "20",
|
|
31297
|
+
viewBox: "0 0 20 20",
|
|
31298
|
+
fill: "none",
|
|
31299
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
31300
|
+
"aria-hidden": true,
|
|
31301
|
+
...props,
|
|
31302
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
31303
|
+
"path",
|
|
31304
|
+
{
|
|
31305
|
+
d: "M15 5L5 15M5 5L15 15",
|
|
31306
|
+
stroke: "#B5BCC1",
|
|
31307
|
+
strokeWidth: "2",
|
|
31308
|
+
strokeLinecap: "round",
|
|
31309
|
+
strokeLinejoin: "round"
|
|
31310
|
+
}
|
|
31311
|
+
)
|
|
31312
|
+
}
|
|
31313
|
+
);
|
|
31314
|
+
}
|
|
31315
|
+
function ToastSuccessIcon(props) {
|
|
31316
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
31317
|
+
"svg",
|
|
31318
|
+
{
|
|
31319
|
+
width: "24",
|
|
31320
|
+
height: "24",
|
|
31321
|
+
viewBox: "0 0 24 24",
|
|
31322
|
+
fill: "none",
|
|
31323
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
31324
|
+
"aria-hidden": true,
|
|
31325
|
+
...props,
|
|
31326
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
31327
|
+
"path",
|
|
31328
|
+
{
|
|
31329
|
+
d: "M20 6L9 17L4 12",
|
|
31330
|
+
stroke: "#279D54",
|
|
31331
|
+
strokeWidth: "2",
|
|
31332
|
+
strokeLinecap: "round",
|
|
31333
|
+
strokeLinejoin: "round"
|
|
31334
|
+
}
|
|
31335
|
+
)
|
|
31336
|
+
}
|
|
31337
|
+
);
|
|
31338
|
+
}
|
|
31339
|
+
function ToastErrorIcon(props) {
|
|
31340
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
31341
|
+
"svg",
|
|
31342
|
+
{
|
|
31343
|
+
width: "24",
|
|
31344
|
+
height: "24",
|
|
31345
|
+
viewBox: "0 0 24 24",
|
|
31346
|
+
fill: "none",
|
|
31347
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
31348
|
+
"aria-hidden": true,
|
|
31349
|
+
...props,
|
|
31350
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
31351
|
+
"path",
|
|
31352
|
+
{
|
|
31353
|
+
d: "M18 6L6 18M6 6L18 18",
|
|
31354
|
+
stroke: "#AE0011",
|
|
31355
|
+
strokeWidth: "2",
|
|
31356
|
+
strokeLinecap: "round",
|
|
31357
|
+
strokeLinejoin: "round"
|
|
31358
|
+
}
|
|
31359
|
+
)
|
|
31360
|
+
}
|
|
31361
|
+
);
|
|
31362
|
+
}
|
|
31363
|
+
function ToastWarningIcon(props) {
|
|
31364
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
31365
|
+
"svg",
|
|
31366
|
+
{
|
|
31367
|
+
width: "24",
|
|
31368
|
+
height: "24",
|
|
31369
|
+
viewBox: "0 0 24 24",
|
|
31370
|
+
fill: "none",
|
|
31371
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
31372
|
+
"aria-hidden": true,
|
|
31373
|
+
...props,
|
|
31374
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
31375
|
+
"path",
|
|
31376
|
+
{
|
|
31377
|
+
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",
|
|
31378
|
+
stroke: "#F2A800",
|
|
31379
|
+
strokeWidth: "2",
|
|
31380
|
+
strokeLinecap: "round",
|
|
31381
|
+
strokeLinejoin: "round"
|
|
31382
|
+
}
|
|
31383
|
+
)
|
|
31384
|
+
}
|
|
31385
|
+
);
|
|
31386
|
+
}
|
|
31387
|
+
function ToastInfoIcon(props) {
|
|
31388
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
31389
|
+
"svg",
|
|
31390
|
+
{
|
|
31391
|
+
width: "24",
|
|
31392
|
+
height: "24",
|
|
31393
|
+
viewBox: "0 0 24 24",
|
|
31394
|
+
fill: "none",
|
|
31395
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
31396
|
+
"aria-hidden": true,
|
|
31397
|
+
...props,
|
|
31398
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
31399
|
+
"path",
|
|
31400
|
+
{
|
|
31401
|
+
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",
|
|
31402
|
+
stroke: "#0F52C7",
|
|
31403
|
+
strokeWidth: "2",
|
|
31404
|
+
strokeLinecap: "round",
|
|
31405
|
+
strokeLinejoin: "round"
|
|
31406
|
+
}
|
|
31407
|
+
)
|
|
31408
|
+
}
|
|
31409
|
+
);
|
|
31410
|
+
}
|
|
31411
|
+
function ToastIconBadge({
|
|
31412
|
+
tone,
|
|
31413
|
+
children
|
|
31414
|
+
}) {
|
|
31415
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `homepad-toast__icon-badge homepad-toast__icon-badge--${tone}`, children });
|
|
31416
|
+
}
|
|
31417
|
+
var homepadToastIcons = {
|
|
31418
|
+
success: /* @__PURE__ */ jsxRuntime.jsx(ToastIconBadge, { tone: "success", children: /* @__PURE__ */ jsxRuntime.jsx(ToastSuccessIcon, {}) }),
|
|
31419
|
+
error: /* @__PURE__ */ jsxRuntime.jsx(ToastIconBadge, { tone: "error", children: /* @__PURE__ */ jsxRuntime.jsx(ToastErrorIcon, {}) }),
|
|
31420
|
+
warning: /* @__PURE__ */ jsxRuntime.jsx(ToastIconBadge, { tone: "warning", children: /* @__PURE__ */ jsxRuntime.jsx(ToastWarningIcon, {}) }),
|
|
31421
|
+
info: /* @__PURE__ */ jsxRuntime.jsx(ToastIconBadge, { tone: "info", children: /* @__PURE__ */ jsxRuntime.jsx(ToastInfoIcon, {}) }),
|
|
31422
|
+
close: /* @__PURE__ */ jsxRuntime.jsx(ToastCloseIcon, {})
|
|
31423
|
+
};
|
|
31424
|
+
function Toaster({
|
|
31425
|
+
className,
|
|
31426
|
+
position = "bottom-right",
|
|
31427
|
+
theme = "light",
|
|
31428
|
+
closeButton = true,
|
|
31429
|
+
gap = 12,
|
|
31430
|
+
offset = 20,
|
|
31431
|
+
toastOptions,
|
|
31432
|
+
icons,
|
|
31433
|
+
...props
|
|
31434
|
+
}) {
|
|
31435
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
31436
|
+
sonner.Toaster,
|
|
31437
|
+
{
|
|
31438
|
+
className: ["homepad-toaster", className].filter(Boolean).join(" "),
|
|
31439
|
+
theme,
|
|
31440
|
+
position,
|
|
31441
|
+
closeButton,
|
|
31442
|
+
gap,
|
|
31443
|
+
offset,
|
|
31444
|
+
mobileOffset: 8,
|
|
31445
|
+
icons: { ...homepadToastIcons, ...icons },
|
|
31446
|
+
toastOptions: {
|
|
31447
|
+
duration: 4e3,
|
|
31448
|
+
classNames: {
|
|
31449
|
+
toast: "homepad-toast",
|
|
31450
|
+
title: "homepad-toast__title",
|
|
31451
|
+
description: "homepad-toast__description",
|
|
31452
|
+
content: "homepad-toast__content",
|
|
31453
|
+
icon: "homepad-toast__icon",
|
|
31454
|
+
closeButton: "homepad-toast__close",
|
|
31455
|
+
...toastOptions?.classNames
|
|
31456
|
+
},
|
|
31457
|
+
...toastOptions
|
|
31458
|
+
},
|
|
31459
|
+
...props
|
|
31460
|
+
}
|
|
31461
|
+
);
|
|
31462
|
+
}
|
|
31463
|
+
function ToasterProvider() {
|
|
31464
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Toaster, {});
|
|
31465
|
+
}
|
|
31466
|
+
|
|
31467
|
+
// src/web/mutation-toast.ts
|
|
31468
|
+
async function runMutationWithToast(action, messages, options) {
|
|
31469
|
+
try {
|
|
31470
|
+
await action();
|
|
31471
|
+
sonner.toast.success(messages.success);
|
|
31472
|
+
return { success: true };
|
|
31473
|
+
} catch (error) {
|
|
31474
|
+
const errorMessage = options?.getErrorMessage?.(error) ?? messages.error;
|
|
31475
|
+
sonner.toast.error(errorMessage);
|
|
31476
|
+
return { success: false, errorMessage };
|
|
31477
|
+
}
|
|
31478
|
+
}
|
|
31097
31479
|
function ConfirmModal({
|
|
31098
31480
|
open,
|
|
31099
31481
|
title,
|
|
@@ -31257,6 +31639,10 @@ react-dom/cjs/react-dom.development.js:
|
|
|
31257
31639
|
*)
|
|
31258
31640
|
*/
|
|
31259
31641
|
|
|
31642
|
+
Object.defineProperty(exports, "toast", {
|
|
31643
|
+
enumerable: true,
|
|
31644
|
+
get: function () { return sonner.toast; }
|
|
31645
|
+
});
|
|
31260
31646
|
exports.AppHeader = AppHeader;
|
|
31261
31647
|
exports.Badge = Badge;
|
|
31262
31648
|
exports.BellIcon = BellIcon;
|
|
@@ -31266,6 +31652,8 @@ exports.ConfirmModal = ConfirmModal;
|
|
|
31266
31652
|
exports.DEFAULT_TABLE_BODY_MIN_HEIGHT = DEFAULT_TABLE_BODY_MIN_HEIGHT;
|
|
31267
31653
|
exports.DashboardLayout = DashboardLayout;
|
|
31268
31654
|
exports.DataTable = DataTable;
|
|
31655
|
+
exports.Drawer = Drawer;
|
|
31656
|
+
exports.HistoryTimeline = HistoryTimeline;
|
|
31269
31657
|
exports.Modal = Modal;
|
|
31270
31658
|
exports.Pagination = Pagination;
|
|
31271
31659
|
exports.Sidebar = Sidebar;
|
|
@@ -31296,10 +31684,13 @@ exports.TableRowStatusActions = TableRowStatusActions;
|
|
|
31296
31684
|
exports.TableScrollArea = TableScrollArea;
|
|
31297
31685
|
exports.TableSortIcon = TableSortIcon;
|
|
31298
31686
|
exports.TableStatusActionsCell = TableStatusActionsCell;
|
|
31687
|
+
exports.Toaster = Toaster;
|
|
31688
|
+
exports.ToasterProvider = ToasterProvider;
|
|
31299
31689
|
exports.cn = cn;
|
|
31300
31690
|
exports.getPaginationRange = getPaginationRange;
|
|
31301
31691
|
exports.getTotalPages = getTotalPages;
|
|
31302
31692
|
exports.getVisiblePageNumbers = getVisiblePageNumbers;
|
|
31693
|
+
exports.runMutationWithToast = runMutationWithToast;
|
|
31303
31694
|
exports.tableRowDisabledCellClassName = tableRowDisabledCellClassName;
|
|
31304
31695
|
exports.useMediaQuery = useMediaQuery;
|
|
31305
31696
|
exports.useOnClickOutside = useOnClickOutside;
|