@komensal/ui 0.4.0 → 0.6.0
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/icons.d.ts +1 -0
- package/dist/icons.js +3 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +110 -103
- package/dist/index.js +115 -58
- package/dist/index.js.map +1 -1
- package/package.json +12 -8
package/dist/index.js
CHANGED
|
@@ -313,6 +313,7 @@ var Button = React2.forwardRef(
|
|
|
313
313
|
const buttonNode = /* @__PURE__ */ jsxs5(
|
|
314
314
|
Comp,
|
|
315
315
|
{
|
|
316
|
+
"aria-busy": isLoading || void 0,
|
|
316
317
|
className: cn(buttonVariants({ hoverStyle, size, variant }), isLoading && "relative opacity-40", className),
|
|
317
318
|
disabled: disabled === true || isLoading,
|
|
318
319
|
ref,
|
|
@@ -1345,21 +1346,76 @@ var SelectField = ({
|
|
|
1345
1346
|
);
|
|
1346
1347
|
};
|
|
1347
1348
|
|
|
1349
|
+
// src/components/image.tsx
|
|
1350
|
+
import { useEffect as useEffect3, useRef as useRef3, useState as useState4 } from "react";
|
|
1351
|
+
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1352
|
+
var Image = ({
|
|
1353
|
+
alt = "",
|
|
1354
|
+
aspectRatio,
|
|
1355
|
+
className,
|
|
1356
|
+
fallback,
|
|
1357
|
+
loading = "lazy",
|
|
1358
|
+
onError,
|
|
1359
|
+
onLoad,
|
|
1360
|
+
wrapperClassName,
|
|
1361
|
+
...props
|
|
1362
|
+
}) => {
|
|
1363
|
+
const ref = useRef3(null);
|
|
1364
|
+
const [loaded, setLoaded] = useState4(false);
|
|
1365
|
+
const [errored, setErrored] = useState4(false);
|
|
1366
|
+
useEffect3(() => {
|
|
1367
|
+
if (ref.current?.complete && ref.current.naturalWidth > 0) setLoaded(true);
|
|
1368
|
+
}, []);
|
|
1369
|
+
return /* @__PURE__ */ jsxs16(
|
|
1370
|
+
"div",
|
|
1371
|
+
{
|
|
1372
|
+
className: cn("bg-inactive relative overflow-hidden", wrapperClassName),
|
|
1373
|
+
style: aspectRatio ? { aspectRatio } : void 0,
|
|
1374
|
+
children: [
|
|
1375
|
+
!loaded && !errored && /* @__PURE__ */ jsx20("div", { className: "absolute inset-0 animate-pulse" }),
|
|
1376
|
+
errored ? fallback ?? null : /* @__PURE__ */ jsx20(
|
|
1377
|
+
"img",
|
|
1378
|
+
{
|
|
1379
|
+
alt,
|
|
1380
|
+
className: cn(
|
|
1381
|
+
"h-full w-full object-cover transition-opacity duration-300",
|
|
1382
|
+
loaded ? "opacity-100" : "opacity-0",
|
|
1383
|
+
className
|
|
1384
|
+
),
|
|
1385
|
+
decoding: "async",
|
|
1386
|
+
loading,
|
|
1387
|
+
onError: (e) => {
|
|
1388
|
+
setErrored(true);
|
|
1389
|
+
onError?.(e);
|
|
1390
|
+
},
|
|
1391
|
+
onLoad: (e) => {
|
|
1392
|
+
setLoaded(true);
|
|
1393
|
+
onLoad?.(e);
|
|
1394
|
+
},
|
|
1395
|
+
ref,
|
|
1396
|
+
...props
|
|
1397
|
+
}
|
|
1398
|
+
)
|
|
1399
|
+
]
|
|
1400
|
+
}
|
|
1401
|
+
);
|
|
1402
|
+
};
|
|
1403
|
+
|
|
1348
1404
|
// src/components/loading.tsx
|
|
1349
|
-
import { jsx as
|
|
1405
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1350
1406
|
function Loading({ className = "", isSpinner = true }) {
|
|
1351
|
-
return /* @__PURE__ */
|
|
1407
|
+
return /* @__PURE__ */ jsx21("div", { className: cn("relative flex min-h-screen items-center justify-center gap-6", className), children: isSpinner && /* @__PURE__ */ jsx21("div", { className: "absolute right-0 bottom-0 m-10", children: /* @__PURE__ */ jsx21(Spinner, {}) }) });
|
|
1352
1408
|
}
|
|
1353
1409
|
|
|
1354
1410
|
// src/components/password-checklist.tsx
|
|
1355
1411
|
import { IoMdCheckmarkCircle, IoMdCloseCircle } from "react-icons/io";
|
|
1356
|
-
import { jsx as
|
|
1412
|
+
import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1357
1413
|
var PasswordChecklist = ({ className, rules, value }) => {
|
|
1358
1414
|
if (rules.length === 0) return null;
|
|
1359
|
-
return /* @__PURE__ */
|
|
1415
|
+
return /* @__PURE__ */ jsx22("ul", { className: cn("flex flex-col gap-1", className), children: rules.map((rule) => {
|
|
1360
1416
|
const isMet = rule.test(value);
|
|
1361
1417
|
const Icon2 = isMet ? IoMdCheckmarkCircle : IoMdCloseCircle;
|
|
1362
|
-
return /* @__PURE__ */
|
|
1418
|
+
return /* @__PURE__ */ jsxs17(
|
|
1363
1419
|
"li",
|
|
1364
1420
|
{
|
|
1365
1421
|
className: cn(
|
|
@@ -1367,8 +1423,8 @@ var PasswordChecklist = ({ className, rules, value }) => {
|
|
|
1367
1423
|
isMet ? "text-success" : "text-inactive-text"
|
|
1368
1424
|
),
|
|
1369
1425
|
children: [
|
|
1370
|
-
/* @__PURE__ */
|
|
1371
|
-
/* @__PURE__ */
|
|
1426
|
+
/* @__PURE__ */ jsx22(Icon2, { "aria-hidden": "true", className: "h-4 w-4 shrink-0" }),
|
|
1427
|
+
/* @__PURE__ */ jsx22("span", { children: rule.label })
|
|
1372
1428
|
]
|
|
1373
1429
|
},
|
|
1374
1430
|
rule.key
|
|
@@ -1380,11 +1436,11 @@ var PasswordChecklist = ({ className, rules, value }) => {
|
|
|
1380
1436
|
import { CaretSortIcon, CheckIcon, ChevronDownIcon, ChevronUpIcon } from "@radix-ui/react-icons";
|
|
1381
1437
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
1382
1438
|
import * as React11 from "react";
|
|
1383
|
-
import { jsx as
|
|
1439
|
+
import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1384
1440
|
var Select = SelectPrimitive.Root;
|
|
1385
1441
|
var SelectGroup = SelectPrimitive.Group;
|
|
1386
1442
|
var SelectValue = SelectPrimitive.Value;
|
|
1387
|
-
var SelectTrigger = React11.forwardRef(({ children, className, ...props }, ref) => /* @__PURE__ */
|
|
1443
|
+
var SelectTrigger = React11.forwardRef(({ children, className, ...props }, ref) => /* @__PURE__ */ jsxs18(
|
|
1388
1444
|
SelectPrimitive.Trigger,
|
|
1389
1445
|
{
|
|
1390
1446
|
className: cn(
|
|
@@ -1395,32 +1451,32 @@ var SelectTrigger = React11.forwardRef(({ children, className, ...props }, ref)
|
|
|
1395
1451
|
...props,
|
|
1396
1452
|
children: [
|
|
1397
1453
|
children,
|
|
1398
|
-
/* @__PURE__ */
|
|
1454
|
+
/* @__PURE__ */ jsx23(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx23(CaretSortIcon, { className: "h-4 w-4 opacity-50" }) })
|
|
1399
1455
|
]
|
|
1400
1456
|
}
|
|
1401
1457
|
));
|
|
1402
1458
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
1403
|
-
var SelectScrollUpButton = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
1459
|
+
var SelectScrollUpButton = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx23(
|
|
1404
1460
|
SelectPrimitive.ScrollUpButton,
|
|
1405
1461
|
{
|
|
1406
1462
|
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
1407
1463
|
ref,
|
|
1408
1464
|
...props,
|
|
1409
|
-
children: /* @__PURE__ */
|
|
1465
|
+
children: /* @__PURE__ */ jsx23(ChevronUpIcon, {})
|
|
1410
1466
|
}
|
|
1411
1467
|
));
|
|
1412
1468
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
1413
|
-
var SelectScrollDownButton = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
1469
|
+
var SelectScrollDownButton = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx23(
|
|
1414
1470
|
SelectPrimitive.ScrollDownButton,
|
|
1415
1471
|
{
|
|
1416
1472
|
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
1417
1473
|
ref,
|
|
1418
1474
|
...props,
|
|
1419
|
-
children: /* @__PURE__ */
|
|
1475
|
+
children: /* @__PURE__ */ jsx23(ChevronDownIcon, {})
|
|
1420
1476
|
}
|
|
1421
1477
|
));
|
|
1422
1478
|
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
1423
|
-
var SelectContent = React11.forwardRef(({ children, className, position = "popper", ...props }, ref) => /* @__PURE__ */
|
|
1479
|
+
var SelectContent = React11.forwardRef(({ children, className, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx23(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs18(
|
|
1424
1480
|
SelectPrimitive.Content,
|
|
1425
1481
|
{
|
|
1426
1482
|
className: cn(
|
|
@@ -1432,8 +1488,8 @@ var SelectContent = React11.forwardRef(({ children, className, position = "poppe
|
|
|
1432
1488
|
ref,
|
|
1433
1489
|
...props,
|
|
1434
1490
|
children: [
|
|
1435
|
-
/* @__PURE__ */
|
|
1436
|
-
/* @__PURE__ */
|
|
1491
|
+
/* @__PURE__ */ jsx23(SelectScrollUpButton, {}),
|
|
1492
|
+
/* @__PURE__ */ jsx23(
|
|
1437
1493
|
SelectPrimitive.Viewport,
|
|
1438
1494
|
{
|
|
1439
1495
|
className: cn(
|
|
@@ -1443,14 +1499,14 @@ var SelectContent = React11.forwardRef(({ children, className, position = "poppe
|
|
|
1443
1499
|
children
|
|
1444
1500
|
}
|
|
1445
1501
|
),
|
|
1446
|
-
/* @__PURE__ */
|
|
1502
|
+
/* @__PURE__ */ jsx23(SelectScrollDownButton, {})
|
|
1447
1503
|
]
|
|
1448
1504
|
}
|
|
1449
1505
|
) }));
|
|
1450
1506
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
1451
|
-
var SelectLabel = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
1507
|
+
var SelectLabel = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx23(SelectPrimitive.Label, { className: cn("px-2 py-1.5 text-sm font-semibold", className), ref, ...props }));
|
|
1452
1508
|
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
1453
|
-
var SelectItem = React11.forwardRef(({ children, className, ...props }, ref) => /* @__PURE__ */
|
|
1509
|
+
var SelectItem = React11.forwardRef(({ children, className, ...props }, ref) => /* @__PURE__ */ jsxs18(
|
|
1454
1510
|
SelectPrimitive.Item,
|
|
1455
1511
|
{
|
|
1456
1512
|
className: cn(
|
|
@@ -1460,32 +1516,32 @@ var SelectItem = React11.forwardRef(({ children, className, ...props }, ref) =>
|
|
|
1460
1516
|
ref,
|
|
1461
1517
|
...props,
|
|
1462
1518
|
children: [
|
|
1463
|
-
/* @__PURE__ */
|
|
1464
|
-
/* @__PURE__ */
|
|
1519
|
+
/* @__PURE__ */ jsx23("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx23(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx23(CheckIcon, { className: "h-4 w-4" }) }) }),
|
|
1520
|
+
/* @__PURE__ */ jsx23(SelectPrimitive.ItemText, { children: /* @__PURE__ */ jsx23("span", { children }) })
|
|
1465
1521
|
]
|
|
1466
1522
|
}
|
|
1467
1523
|
));
|
|
1468
1524
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
1469
|
-
var SelectSeparator = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
1525
|
+
var SelectSeparator = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx23(SelectPrimitive.Separator, { className: cn("bg-border -mx-1 my-1 h-px", className), ref, ...props }));
|
|
1470
1526
|
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
1471
1527
|
|
|
1472
1528
|
// src/components/step-header.tsx
|
|
1473
|
-
import { jsx as
|
|
1474
|
-
var StepHeader = ({ subtitle, subtitleClassName, title }) => /* @__PURE__ */
|
|
1475
|
-
/* @__PURE__ */
|
|
1476
|
-
subtitle !== void 0 && /* @__PURE__ */
|
|
1529
|
+
import { jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1530
|
+
var StepHeader = ({ subtitle, subtitleClassName, title }) => /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-1", children: [
|
|
1531
|
+
/* @__PURE__ */ jsx24("h1", { className: "text-title text-2xl font-bold", children: title }),
|
|
1532
|
+
subtitle !== void 0 && /* @__PURE__ */ jsx24("p", { className: cn("text-subtitle text-sm", subtitleClassName), children: subtitle })
|
|
1477
1533
|
] });
|
|
1478
1534
|
|
|
1479
1535
|
// src/components/stepper.tsx
|
|
1480
1536
|
import { CheckIcon as CheckIcon2 } from "lucide-react";
|
|
1481
|
-
import { jsx as
|
|
1537
|
+
import { jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1482
1538
|
var Stepper = ({ activeIndex, className, intermediate = false, steps }) => {
|
|
1483
|
-
return /* @__PURE__ */
|
|
1539
|
+
return /* @__PURE__ */ jsx25("div", { className: cn("flex w-full items-start", className), children: steps.map((step, index) => {
|
|
1484
1540
|
const isCompleted = intermediate ? index <= activeIndex : index < activeIndex;
|
|
1485
1541
|
const isActive = !intermediate && index === activeIndex;
|
|
1486
|
-
return /* @__PURE__ */
|
|
1487
|
-
/* @__PURE__ */
|
|
1488
|
-
/* @__PURE__ */
|
|
1542
|
+
return /* @__PURE__ */ jsxs20("div", { className: "flex flex-1 flex-col items-center", children: [
|
|
1543
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex w-full items-center", children: [
|
|
1544
|
+
/* @__PURE__ */ jsx25(
|
|
1489
1545
|
"div",
|
|
1490
1546
|
{
|
|
1491
1547
|
className: cn(
|
|
@@ -1495,7 +1551,7 @@ var Stepper = ({ activeIndex, className, intermediate = false, steps }) => {
|
|
|
1495
1551
|
)
|
|
1496
1552
|
}
|
|
1497
1553
|
),
|
|
1498
|
-
/* @__PURE__ */
|
|
1554
|
+
/* @__PURE__ */ jsx25(
|
|
1499
1555
|
"div",
|
|
1500
1556
|
{
|
|
1501
1557
|
"aria-current": isActive ? "step" : void 0,
|
|
@@ -1505,10 +1561,10 @@ var Stepper = ({ activeIndex, className, intermediate = false, steps }) => {
|
|
|
1505
1561
|
isActive && "bg-primary border-primary text-inverse",
|
|
1506
1562
|
!isCompleted && !isActive && "bg-inactive border-inactive text-surface"
|
|
1507
1563
|
),
|
|
1508
|
-
children: isCompleted ? /* @__PURE__ */
|
|
1564
|
+
children: isCompleted ? /* @__PURE__ */ jsx25(CheckIcon2, { className: "h-4 w-4" }) : index + 1
|
|
1509
1565
|
}
|
|
1510
1566
|
),
|
|
1511
|
-
/* @__PURE__ */
|
|
1567
|
+
/* @__PURE__ */ jsx25(
|
|
1512
1568
|
"div",
|
|
1513
1569
|
{
|
|
1514
1570
|
className: cn(
|
|
@@ -1516,7 +1572,7 @@ var Stepper = ({ activeIndex, className, intermediate = false, steps }) => {
|
|
|
1516
1572
|
isCompleted ? "bg-primary" : "bg-inactive",
|
|
1517
1573
|
index === steps.length - 1 && "rounded-r-full"
|
|
1518
1574
|
),
|
|
1519
|
-
children: index === 0 && /* @__PURE__ */
|
|
1575
|
+
children: index === 0 && /* @__PURE__ */ jsx25(
|
|
1520
1576
|
"div",
|
|
1521
1577
|
{
|
|
1522
1578
|
className: cn(
|
|
@@ -1528,22 +1584,22 @@ var Stepper = ({ activeIndex, className, intermediate = false, steps }) => {
|
|
|
1528
1584
|
}
|
|
1529
1585
|
)
|
|
1530
1586
|
] }),
|
|
1531
|
-
/* @__PURE__ */
|
|
1587
|
+
/* @__PURE__ */ jsx25("span", { className: cn("mt-1 text-xs font-normal", isCompleted || isActive ? "text-primary" : "text-muted"), children: step.label })
|
|
1532
1588
|
] }, step.label);
|
|
1533
1589
|
}) });
|
|
1534
1590
|
};
|
|
1535
1591
|
|
|
1536
1592
|
// src/components/toast/toast.tsx
|
|
1537
1593
|
import { AlertTriangle, Check, X } from "lucide-react";
|
|
1538
|
-
import { useEffect as
|
|
1594
|
+
import { useEffect as useEffect4, useMemo as useMemo3, useRef as useRef4, useState as useState5 } from "react";
|
|
1539
1595
|
import { IoDocumentLockOutline, IoInformationCircle } from "react-icons/io5";
|
|
1540
|
-
import { jsx as
|
|
1596
|
+
import { jsx as jsx26, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1541
1597
|
var EXIT_ANIMATION_MS = 200;
|
|
1542
1598
|
function Toast({ duration = 2500, id, onClose, subtitle, title, type }) {
|
|
1543
|
-
const [leaving, setLeaving] =
|
|
1544
|
-
const startedAtRef =
|
|
1545
|
-
const timeoutRef =
|
|
1546
|
-
const exitRef =
|
|
1599
|
+
const [leaving, setLeaving] = useState5(false);
|
|
1600
|
+
const startedAtRef = useRef4(Date.now());
|
|
1601
|
+
const timeoutRef = useRef4(null);
|
|
1602
|
+
const exitRef = useRef4(null);
|
|
1547
1603
|
const Icon2 = useMemo3(() => {
|
|
1548
1604
|
if (type === "success") return Check;
|
|
1549
1605
|
if (type === "error") return X;
|
|
@@ -1566,7 +1622,7 @@ function Toast({ duration = 2500, id, onClose, subtitle, title, type }) {
|
|
|
1566
1622
|
}
|
|
1567
1623
|
return { border: "border-wait", icon: "text-wait", iconBorder: "border-wait" };
|
|
1568
1624
|
}, [type]);
|
|
1569
|
-
|
|
1625
|
+
useEffect4(() => {
|
|
1570
1626
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
1571
1627
|
if (exitRef.current) clearTimeout(exitRef.current);
|
|
1572
1628
|
const elapsed = Date.now() - startedAtRef.current;
|
|
@@ -1580,7 +1636,7 @@ function Toast({ duration = 2500, id, onClose, subtitle, title, type }) {
|
|
|
1580
1636
|
if (exitRef.current) clearTimeout(exitRef.current);
|
|
1581
1637
|
};
|
|
1582
1638
|
}, [id, duration, onClose]);
|
|
1583
|
-
return /* @__PURE__ */
|
|
1639
|
+
return /* @__PURE__ */ jsxs21(
|
|
1584
1640
|
"div",
|
|
1585
1641
|
{
|
|
1586
1642
|
"aria-live": "polite",
|
|
@@ -1598,9 +1654,9 @@ function Toast({ duration = 2500, id, onClose, subtitle, title, type }) {
|
|
|
1598
1654
|
].join(" "),
|
|
1599
1655
|
role: "status",
|
|
1600
1656
|
children: [
|
|
1601
|
-
/* @__PURE__ */
|
|
1602
|
-
subtitle ? /* @__PURE__ */
|
|
1603
|
-
/* @__PURE__ */
|
|
1657
|
+
/* @__PURE__ */ jsx26("div", { className: "min-w-0 pr-4", children: /* @__PURE__ */ jsx26("h4", { className: ["text-[16px] leading-normal font-semibold", "text-foreground", "line-clamp-2"].join(" "), children: title }) }),
|
|
1658
|
+
subtitle ? /* @__PURE__ */ jsx26("div", { className: "shrink-0 pr-4 text-left", children: /* @__PURE__ */ jsx26("div", { className: ["max-w-28 text-[14px] leading-[19.5px] font-normal", "text-body"].join(" "), children: subtitle }) }) : null,
|
|
1659
|
+
/* @__PURE__ */ jsx26(
|
|
1604
1660
|
"div",
|
|
1605
1661
|
{
|
|
1606
1662
|
className: [
|
|
@@ -1608,7 +1664,7 @@ function Toast({ duration = 2500, id, onClose, subtitle, title, type }) {
|
|
|
1608
1664
|
"flex h-8 w-8 min-w-8 items-center justify-center rounded-full border-2",
|
|
1609
1665
|
styles.iconBorder
|
|
1610
1666
|
].join(" "),
|
|
1611
|
-
children: /* @__PURE__ */
|
|
1667
|
+
children: /* @__PURE__ */ jsx26(Icon2, { className: ["h-5 w-5", styles.icon].join(" ") })
|
|
1612
1668
|
}
|
|
1613
1669
|
)
|
|
1614
1670
|
]
|
|
@@ -1617,12 +1673,12 @@ function Toast({ duration = 2500, id, onClose, subtitle, title, type }) {
|
|
|
1617
1673
|
}
|
|
1618
1674
|
|
|
1619
1675
|
// src/components/toast/toast-provider.tsx
|
|
1620
|
-
import { useCallback as useCallback3, useEffect as
|
|
1621
|
-
import { Fragment as Fragment4, jsx as
|
|
1676
|
+
import { useCallback as useCallback3, useEffect as useEffect5, useLayoutEffect, useMemo as useMemo4, useRef as useRef5, useState as useState6 } from "react";
|
|
1677
|
+
import { Fragment as Fragment4, jsx as jsx27 } from "react/jsx-runtime";
|
|
1622
1678
|
function ToastProvider() {
|
|
1623
|
-
const [toasts, setToasts] =
|
|
1624
|
-
const itemRefs =
|
|
1625
|
-
const prevRects =
|
|
1679
|
+
const [toasts, setToasts] = useState6([]);
|
|
1680
|
+
const itemRefs = useRef5(/* @__PURE__ */ new Map());
|
|
1681
|
+
const prevRects = useRef5(/* @__PURE__ */ new Map());
|
|
1626
1682
|
const showToast = useCallback3((type, options) => {
|
|
1627
1683
|
setToasts((prev) => [
|
|
1628
1684
|
...prev,
|
|
@@ -1638,7 +1694,7 @@ function ToastProvider() {
|
|
|
1638
1694
|
const removeToast = useCallback3((id) => {
|
|
1639
1695
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
1640
1696
|
}, []);
|
|
1641
|
-
|
|
1697
|
+
useEffect5(() => {
|
|
1642
1698
|
registerToastEmitter(showToast);
|
|
1643
1699
|
return () => registerToastEmitter(null);
|
|
1644
1700
|
}, [showToast]);
|
|
@@ -1679,7 +1735,7 @@ function ToastProvider() {
|
|
|
1679
1735
|
itemRefs.current.set(id, el);
|
|
1680
1736
|
};
|
|
1681
1737
|
}, []);
|
|
1682
|
-
return /* @__PURE__ */
|
|
1738
|
+
return /* @__PURE__ */ jsx27(Fragment4, { children: Object.entries(grouped).map(([position, list]) => /* @__PURE__ */ jsx27("div", { className: `fixed z-4000 ${getPositionClass(position)}`, children: /* @__PURE__ */ jsx27("div", { className: "relative flex flex-col gap-3", children: list.map((toast2) => /* @__PURE__ */ jsx27("div", { ref: setItemRef(toast2.id), children: /* @__PURE__ */ jsx27(
|
|
1683
1739
|
Toast,
|
|
1684
1740
|
{
|
|
1685
1741
|
duration: toast2.duration,
|
|
@@ -1707,9 +1763,9 @@ function getPositionClass(position) {
|
|
|
1707
1763
|
}
|
|
1708
1764
|
|
|
1709
1765
|
// src/components/wrapper.tsx
|
|
1710
|
-
import { jsx as
|
|
1766
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
1711
1767
|
var Wrapper = ({ children, className }) => {
|
|
1712
|
-
return /* @__PURE__ */
|
|
1768
|
+
return /* @__PURE__ */ jsx28("div", { className: cn("mx-auto h-full w-full", className), children });
|
|
1713
1769
|
};
|
|
1714
1770
|
export {
|
|
1715
1771
|
Alert,
|
|
@@ -1742,6 +1798,7 @@ export {
|
|
|
1742
1798
|
FormLabel,
|
|
1743
1799
|
FormMessage,
|
|
1744
1800
|
GoogleMapPicker,
|
|
1801
|
+
Image,
|
|
1745
1802
|
Input,
|
|
1746
1803
|
InputField,
|
|
1747
1804
|
InputOTP,
|