@komensal/ui 0.3.0 → 0.5.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/README.md +92 -0
- package/dist/index.d.ts +121 -103
- package/dist/index.js +146 -61
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
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,
|
|
@@ -743,13 +744,27 @@ var DEFAULT_CENTER = { lat: 4.711, lng: -74.0721 };
|
|
|
743
744
|
var PICKER_MAP_ID = "komensal-restaurant-map";
|
|
744
745
|
var SELECTED_ZOOM = 15;
|
|
745
746
|
var DEBOUNCE_MS = 300;
|
|
747
|
+
var parseComponents = (components) => {
|
|
748
|
+
const find = (type) => components.find((c) => c.types.includes(type));
|
|
749
|
+
const country = find("country");
|
|
750
|
+
const department = find("administrative_area_level_1");
|
|
751
|
+
const city = find("locality") ?? find("administrative_area_level_2");
|
|
752
|
+
return {
|
|
753
|
+
city: city?.long ?? null,
|
|
754
|
+
country: country?.short ?? null,
|
|
755
|
+
countryName: country?.long ?? null,
|
|
756
|
+
department: department?.long ?? null
|
|
757
|
+
};
|
|
758
|
+
};
|
|
746
759
|
var CITY_ZOOM = 12;
|
|
747
760
|
var MapPickerContent = ({
|
|
748
761
|
centerOn,
|
|
762
|
+
countryCode,
|
|
749
763
|
disabled,
|
|
750
764
|
hasError,
|
|
751
765
|
locationQuery,
|
|
752
766
|
locationZoom,
|
|
767
|
+
onAddressResolved,
|
|
753
768
|
onChange,
|
|
754
769
|
placeholder,
|
|
755
770
|
value
|
|
@@ -758,6 +773,7 @@ var MapPickerContent = ({
|
|
|
758
773
|
const geocodingLib = useMapsLibrary("geocoding");
|
|
759
774
|
const map = useMap(PICKER_MAP_ID);
|
|
760
775
|
const onChangeRef = useRef(onChange);
|
|
776
|
+
const onResolvedRef = useRef(onAddressResolved);
|
|
761
777
|
const geocoder = useMemo(
|
|
762
778
|
() => geocodingLib ? new geocodingLib.Geocoder() : null,
|
|
763
779
|
[geocodingLib]
|
|
@@ -770,6 +786,7 @@ var MapPickerContent = ({
|
|
|
770
786
|
const [position, setPosition] = useState2(null);
|
|
771
787
|
useEffect(() => {
|
|
772
788
|
onChangeRef.current = onChange;
|
|
789
|
+
onResolvedRef.current = onAddressResolved;
|
|
773
790
|
});
|
|
774
791
|
useEffect(() => {
|
|
775
792
|
setInputValue(value);
|
|
@@ -817,6 +834,7 @@ var MapPickerContent = ({
|
|
|
817
834
|
}
|
|
818
835
|
try {
|
|
819
836
|
const result = await placesLib.AutocompleteSuggestion.fetchAutocompleteSuggestions({
|
|
837
|
+
includedRegionCodes: countryCode ? [countryCode.toLowerCase()] : void 0,
|
|
820
838
|
input,
|
|
821
839
|
sessionToken
|
|
822
840
|
});
|
|
@@ -826,7 +844,7 @@ var MapPickerContent = ({
|
|
|
826
844
|
setSuggestions([]);
|
|
827
845
|
}
|
|
828
846
|
},
|
|
829
|
-
[placesLib, sessionToken]
|
|
847
|
+
[placesLib, sessionToken, countryCode]
|
|
830
848
|
);
|
|
831
849
|
const reverseGeocode = useCallback(
|
|
832
850
|
async (latLng) => {
|
|
@@ -834,9 +852,14 @@ var MapPickerContent = ({
|
|
|
834
852
|
try {
|
|
835
853
|
const { results } = await geocoder.geocode({ location: latLng });
|
|
836
854
|
if (results.length > 0) {
|
|
837
|
-
const
|
|
855
|
+
const result = results[0];
|
|
856
|
+
const address = result.formatted_address;
|
|
838
857
|
setInputValue(address);
|
|
839
858
|
onChangeRef.current(address);
|
|
859
|
+
const parts = parseComponents(
|
|
860
|
+
result.address_components.map((c) => ({ long: c.long_name, short: c.short_name, types: c.types }))
|
|
861
|
+
);
|
|
862
|
+
onResolvedRef.current?.({ address, lat: latLng.lat, lng: latLng.lng, ...parts });
|
|
840
863
|
}
|
|
841
864
|
} catch {
|
|
842
865
|
return;
|
|
@@ -855,15 +878,21 @@ var MapPickerContent = ({
|
|
|
855
878
|
const prediction = suggestion.placePrediction;
|
|
856
879
|
if (!prediction) return;
|
|
857
880
|
const place = prediction.toPlace();
|
|
858
|
-
await place.fetchFields({ fields: ["formattedAddress", "location"] });
|
|
881
|
+
await place.fetchFields({ fields: ["formattedAddress", "location", "addressComponents"] });
|
|
859
882
|
const address = place.formattedAddress ?? prediction.text.text;
|
|
860
883
|
setInputValue(address);
|
|
861
884
|
onChangeRef.current(address);
|
|
862
885
|
setSuggestions([]);
|
|
863
886
|
setShowDropdown(false);
|
|
887
|
+
const lat = place.location?.lat() ?? null;
|
|
888
|
+
const lng = place.location?.lng() ?? null;
|
|
864
889
|
if (place.location) {
|
|
865
890
|
setPosition({ lat: place.location.lat(), lng: place.location.lng() });
|
|
866
891
|
}
|
|
892
|
+
const parts = parseComponents(
|
|
893
|
+
(place.addressComponents ?? []).map((c) => ({ long: c.longText, short: c.shortText, types: c.types }))
|
|
894
|
+
);
|
|
895
|
+
onResolvedRef.current?.({ address, lat, lng, ...parts });
|
|
867
896
|
if (placesLib) setSessionToken(new placesLib.AutocompleteSessionToken());
|
|
868
897
|
};
|
|
869
898
|
const handleBlur = () => {
|
|
@@ -1317,21 +1346,76 @@ var SelectField = ({
|
|
|
1317
1346
|
);
|
|
1318
1347
|
};
|
|
1319
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
|
+
|
|
1320
1404
|
// src/components/loading.tsx
|
|
1321
|
-
import { jsx as
|
|
1405
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1322
1406
|
function Loading({ className = "", isSpinner = true }) {
|
|
1323
|
-
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, {}) }) });
|
|
1324
1408
|
}
|
|
1325
1409
|
|
|
1326
1410
|
// src/components/password-checklist.tsx
|
|
1327
1411
|
import { IoMdCheckmarkCircle, IoMdCloseCircle } from "react-icons/io";
|
|
1328
|
-
import { jsx as
|
|
1412
|
+
import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1329
1413
|
var PasswordChecklist = ({ className, rules, value }) => {
|
|
1330
1414
|
if (rules.length === 0) return null;
|
|
1331
|
-
return /* @__PURE__ */
|
|
1415
|
+
return /* @__PURE__ */ jsx22("ul", { className: cn("flex flex-col gap-1", className), children: rules.map((rule) => {
|
|
1332
1416
|
const isMet = rule.test(value);
|
|
1333
1417
|
const Icon2 = isMet ? IoMdCheckmarkCircle : IoMdCloseCircle;
|
|
1334
|
-
return /* @__PURE__ */
|
|
1418
|
+
return /* @__PURE__ */ jsxs17(
|
|
1335
1419
|
"li",
|
|
1336
1420
|
{
|
|
1337
1421
|
className: cn(
|
|
@@ -1339,8 +1423,8 @@ var PasswordChecklist = ({ className, rules, value }) => {
|
|
|
1339
1423
|
isMet ? "text-success" : "text-inactive-text"
|
|
1340
1424
|
),
|
|
1341
1425
|
children: [
|
|
1342
|
-
/* @__PURE__ */
|
|
1343
|
-
/* @__PURE__ */
|
|
1426
|
+
/* @__PURE__ */ jsx22(Icon2, { "aria-hidden": "true", className: "h-4 w-4 shrink-0" }),
|
|
1427
|
+
/* @__PURE__ */ jsx22("span", { children: rule.label })
|
|
1344
1428
|
]
|
|
1345
1429
|
},
|
|
1346
1430
|
rule.key
|
|
@@ -1352,11 +1436,11 @@ var PasswordChecklist = ({ className, rules, value }) => {
|
|
|
1352
1436
|
import { CaretSortIcon, CheckIcon, ChevronDownIcon, ChevronUpIcon } from "@radix-ui/react-icons";
|
|
1353
1437
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
1354
1438
|
import * as React11 from "react";
|
|
1355
|
-
import { jsx as
|
|
1439
|
+
import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1356
1440
|
var Select = SelectPrimitive.Root;
|
|
1357
1441
|
var SelectGroup = SelectPrimitive.Group;
|
|
1358
1442
|
var SelectValue = SelectPrimitive.Value;
|
|
1359
|
-
var SelectTrigger = React11.forwardRef(({ children, className, ...props }, ref) => /* @__PURE__ */
|
|
1443
|
+
var SelectTrigger = React11.forwardRef(({ children, className, ...props }, ref) => /* @__PURE__ */ jsxs18(
|
|
1360
1444
|
SelectPrimitive.Trigger,
|
|
1361
1445
|
{
|
|
1362
1446
|
className: cn(
|
|
@@ -1367,32 +1451,32 @@ var SelectTrigger = React11.forwardRef(({ children, className, ...props }, ref)
|
|
|
1367
1451
|
...props,
|
|
1368
1452
|
children: [
|
|
1369
1453
|
children,
|
|
1370
|
-
/* @__PURE__ */
|
|
1454
|
+
/* @__PURE__ */ jsx23(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx23(CaretSortIcon, { className: "h-4 w-4 opacity-50" }) })
|
|
1371
1455
|
]
|
|
1372
1456
|
}
|
|
1373
1457
|
));
|
|
1374
1458
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
1375
|
-
var SelectScrollUpButton = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
1459
|
+
var SelectScrollUpButton = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx23(
|
|
1376
1460
|
SelectPrimitive.ScrollUpButton,
|
|
1377
1461
|
{
|
|
1378
1462
|
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
1379
1463
|
ref,
|
|
1380
1464
|
...props,
|
|
1381
|
-
children: /* @__PURE__ */
|
|
1465
|
+
children: /* @__PURE__ */ jsx23(ChevronUpIcon, {})
|
|
1382
1466
|
}
|
|
1383
1467
|
));
|
|
1384
1468
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
1385
|
-
var SelectScrollDownButton = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
1469
|
+
var SelectScrollDownButton = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx23(
|
|
1386
1470
|
SelectPrimitive.ScrollDownButton,
|
|
1387
1471
|
{
|
|
1388
1472
|
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
1389
1473
|
ref,
|
|
1390
1474
|
...props,
|
|
1391
|
-
children: /* @__PURE__ */
|
|
1475
|
+
children: /* @__PURE__ */ jsx23(ChevronDownIcon, {})
|
|
1392
1476
|
}
|
|
1393
1477
|
));
|
|
1394
1478
|
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
1395
|
-
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(
|
|
1396
1480
|
SelectPrimitive.Content,
|
|
1397
1481
|
{
|
|
1398
1482
|
className: cn(
|
|
@@ -1404,8 +1488,8 @@ var SelectContent = React11.forwardRef(({ children, className, position = "poppe
|
|
|
1404
1488
|
ref,
|
|
1405
1489
|
...props,
|
|
1406
1490
|
children: [
|
|
1407
|
-
/* @__PURE__ */
|
|
1408
|
-
/* @__PURE__ */
|
|
1491
|
+
/* @__PURE__ */ jsx23(SelectScrollUpButton, {}),
|
|
1492
|
+
/* @__PURE__ */ jsx23(
|
|
1409
1493
|
SelectPrimitive.Viewport,
|
|
1410
1494
|
{
|
|
1411
1495
|
className: cn(
|
|
@@ -1415,14 +1499,14 @@ var SelectContent = React11.forwardRef(({ children, className, position = "poppe
|
|
|
1415
1499
|
children
|
|
1416
1500
|
}
|
|
1417
1501
|
),
|
|
1418
|
-
/* @__PURE__ */
|
|
1502
|
+
/* @__PURE__ */ jsx23(SelectScrollDownButton, {})
|
|
1419
1503
|
]
|
|
1420
1504
|
}
|
|
1421
1505
|
) }));
|
|
1422
1506
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
1423
|
-
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 }));
|
|
1424
1508
|
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
1425
|
-
var SelectItem = React11.forwardRef(({ children, className, ...props }, ref) => /* @__PURE__ */
|
|
1509
|
+
var SelectItem = React11.forwardRef(({ children, className, ...props }, ref) => /* @__PURE__ */ jsxs18(
|
|
1426
1510
|
SelectPrimitive.Item,
|
|
1427
1511
|
{
|
|
1428
1512
|
className: cn(
|
|
@@ -1432,32 +1516,32 @@ var SelectItem = React11.forwardRef(({ children, className, ...props }, ref) =>
|
|
|
1432
1516
|
ref,
|
|
1433
1517
|
...props,
|
|
1434
1518
|
children: [
|
|
1435
|
-
/* @__PURE__ */
|
|
1436
|
-
/* @__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 }) })
|
|
1437
1521
|
]
|
|
1438
1522
|
}
|
|
1439
1523
|
));
|
|
1440
1524
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
1441
|
-
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 }));
|
|
1442
1526
|
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
1443
1527
|
|
|
1444
1528
|
// src/components/step-header.tsx
|
|
1445
|
-
import { jsx as
|
|
1446
|
-
var StepHeader = ({ subtitle, subtitleClassName, title }) => /* @__PURE__ */
|
|
1447
|
-
/* @__PURE__ */
|
|
1448
|
-
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 })
|
|
1449
1533
|
] });
|
|
1450
1534
|
|
|
1451
1535
|
// src/components/stepper.tsx
|
|
1452
1536
|
import { CheckIcon as CheckIcon2 } from "lucide-react";
|
|
1453
|
-
import { jsx as
|
|
1537
|
+
import { jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1454
1538
|
var Stepper = ({ activeIndex, className, intermediate = false, steps }) => {
|
|
1455
|
-
return /* @__PURE__ */
|
|
1539
|
+
return /* @__PURE__ */ jsx25("div", { className: cn("flex w-full items-start", className), children: steps.map((step, index) => {
|
|
1456
1540
|
const isCompleted = intermediate ? index <= activeIndex : index < activeIndex;
|
|
1457
1541
|
const isActive = !intermediate && index === activeIndex;
|
|
1458
|
-
return /* @__PURE__ */
|
|
1459
|
-
/* @__PURE__ */
|
|
1460
|
-
/* @__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(
|
|
1461
1545
|
"div",
|
|
1462
1546
|
{
|
|
1463
1547
|
className: cn(
|
|
@@ -1467,7 +1551,7 @@ var Stepper = ({ activeIndex, className, intermediate = false, steps }) => {
|
|
|
1467
1551
|
)
|
|
1468
1552
|
}
|
|
1469
1553
|
),
|
|
1470
|
-
/* @__PURE__ */
|
|
1554
|
+
/* @__PURE__ */ jsx25(
|
|
1471
1555
|
"div",
|
|
1472
1556
|
{
|
|
1473
1557
|
"aria-current": isActive ? "step" : void 0,
|
|
@@ -1477,10 +1561,10 @@ var Stepper = ({ activeIndex, className, intermediate = false, steps }) => {
|
|
|
1477
1561
|
isActive && "bg-primary border-primary text-inverse",
|
|
1478
1562
|
!isCompleted && !isActive && "bg-inactive border-inactive text-surface"
|
|
1479
1563
|
),
|
|
1480
|
-
children: isCompleted ? /* @__PURE__ */
|
|
1564
|
+
children: isCompleted ? /* @__PURE__ */ jsx25(CheckIcon2, { className: "h-4 w-4" }) : index + 1
|
|
1481
1565
|
}
|
|
1482
1566
|
),
|
|
1483
|
-
/* @__PURE__ */
|
|
1567
|
+
/* @__PURE__ */ jsx25(
|
|
1484
1568
|
"div",
|
|
1485
1569
|
{
|
|
1486
1570
|
className: cn(
|
|
@@ -1488,7 +1572,7 @@ var Stepper = ({ activeIndex, className, intermediate = false, steps }) => {
|
|
|
1488
1572
|
isCompleted ? "bg-primary" : "bg-inactive",
|
|
1489
1573
|
index === steps.length - 1 && "rounded-r-full"
|
|
1490
1574
|
),
|
|
1491
|
-
children: index === 0 && /* @__PURE__ */
|
|
1575
|
+
children: index === 0 && /* @__PURE__ */ jsx25(
|
|
1492
1576
|
"div",
|
|
1493
1577
|
{
|
|
1494
1578
|
className: cn(
|
|
@@ -1500,22 +1584,22 @@ var Stepper = ({ activeIndex, className, intermediate = false, steps }) => {
|
|
|
1500
1584
|
}
|
|
1501
1585
|
)
|
|
1502
1586
|
] }),
|
|
1503
|
-
/* @__PURE__ */
|
|
1587
|
+
/* @__PURE__ */ jsx25("span", { className: cn("mt-1 text-xs font-normal", isCompleted || isActive ? "text-primary" : "text-muted"), children: step.label })
|
|
1504
1588
|
] }, step.label);
|
|
1505
1589
|
}) });
|
|
1506
1590
|
};
|
|
1507
1591
|
|
|
1508
1592
|
// src/components/toast/toast.tsx
|
|
1509
1593
|
import { AlertTriangle, Check, X } from "lucide-react";
|
|
1510
|
-
import { useEffect as
|
|
1594
|
+
import { useEffect as useEffect4, useMemo as useMemo3, useRef as useRef4, useState as useState5 } from "react";
|
|
1511
1595
|
import { IoDocumentLockOutline, IoInformationCircle } from "react-icons/io5";
|
|
1512
|
-
import { jsx as
|
|
1596
|
+
import { jsx as jsx26, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1513
1597
|
var EXIT_ANIMATION_MS = 200;
|
|
1514
1598
|
function Toast({ duration = 2500, id, onClose, subtitle, title, type }) {
|
|
1515
|
-
const [leaving, setLeaving] =
|
|
1516
|
-
const startedAtRef =
|
|
1517
|
-
const timeoutRef =
|
|
1518
|
-
const exitRef =
|
|
1599
|
+
const [leaving, setLeaving] = useState5(false);
|
|
1600
|
+
const startedAtRef = useRef4(Date.now());
|
|
1601
|
+
const timeoutRef = useRef4(null);
|
|
1602
|
+
const exitRef = useRef4(null);
|
|
1519
1603
|
const Icon2 = useMemo3(() => {
|
|
1520
1604
|
if (type === "success") return Check;
|
|
1521
1605
|
if (type === "error") return X;
|
|
@@ -1538,7 +1622,7 @@ function Toast({ duration = 2500, id, onClose, subtitle, title, type }) {
|
|
|
1538
1622
|
}
|
|
1539
1623
|
return { border: "border-wait", icon: "text-wait", iconBorder: "border-wait" };
|
|
1540
1624
|
}, [type]);
|
|
1541
|
-
|
|
1625
|
+
useEffect4(() => {
|
|
1542
1626
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
1543
1627
|
if (exitRef.current) clearTimeout(exitRef.current);
|
|
1544
1628
|
const elapsed = Date.now() - startedAtRef.current;
|
|
@@ -1552,7 +1636,7 @@ function Toast({ duration = 2500, id, onClose, subtitle, title, type }) {
|
|
|
1552
1636
|
if (exitRef.current) clearTimeout(exitRef.current);
|
|
1553
1637
|
};
|
|
1554
1638
|
}, [id, duration, onClose]);
|
|
1555
|
-
return /* @__PURE__ */
|
|
1639
|
+
return /* @__PURE__ */ jsxs21(
|
|
1556
1640
|
"div",
|
|
1557
1641
|
{
|
|
1558
1642
|
"aria-live": "polite",
|
|
@@ -1570,9 +1654,9 @@ function Toast({ duration = 2500, id, onClose, subtitle, title, type }) {
|
|
|
1570
1654
|
].join(" "),
|
|
1571
1655
|
role: "status",
|
|
1572
1656
|
children: [
|
|
1573
|
-
/* @__PURE__ */
|
|
1574
|
-
subtitle ? /* @__PURE__ */
|
|
1575
|
-
/* @__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(
|
|
1576
1660
|
"div",
|
|
1577
1661
|
{
|
|
1578
1662
|
className: [
|
|
@@ -1580,7 +1664,7 @@ function Toast({ duration = 2500, id, onClose, subtitle, title, type }) {
|
|
|
1580
1664
|
"flex h-8 w-8 min-w-8 items-center justify-center rounded-full border-2",
|
|
1581
1665
|
styles.iconBorder
|
|
1582
1666
|
].join(" "),
|
|
1583
|
-
children: /* @__PURE__ */
|
|
1667
|
+
children: /* @__PURE__ */ jsx26(Icon2, { className: ["h-5 w-5", styles.icon].join(" ") })
|
|
1584
1668
|
}
|
|
1585
1669
|
)
|
|
1586
1670
|
]
|
|
@@ -1589,12 +1673,12 @@ function Toast({ duration = 2500, id, onClose, subtitle, title, type }) {
|
|
|
1589
1673
|
}
|
|
1590
1674
|
|
|
1591
1675
|
// src/components/toast/toast-provider.tsx
|
|
1592
|
-
import { useCallback as useCallback3, useEffect as
|
|
1593
|
-
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";
|
|
1594
1678
|
function ToastProvider() {
|
|
1595
|
-
const [toasts, setToasts] =
|
|
1596
|
-
const itemRefs =
|
|
1597
|
-
const prevRects =
|
|
1679
|
+
const [toasts, setToasts] = useState6([]);
|
|
1680
|
+
const itemRefs = useRef5(/* @__PURE__ */ new Map());
|
|
1681
|
+
const prevRects = useRef5(/* @__PURE__ */ new Map());
|
|
1598
1682
|
const showToast = useCallback3((type, options) => {
|
|
1599
1683
|
setToasts((prev) => [
|
|
1600
1684
|
...prev,
|
|
@@ -1610,7 +1694,7 @@ function ToastProvider() {
|
|
|
1610
1694
|
const removeToast = useCallback3((id) => {
|
|
1611
1695
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
1612
1696
|
}, []);
|
|
1613
|
-
|
|
1697
|
+
useEffect5(() => {
|
|
1614
1698
|
registerToastEmitter(showToast);
|
|
1615
1699
|
return () => registerToastEmitter(null);
|
|
1616
1700
|
}, [showToast]);
|
|
@@ -1651,7 +1735,7 @@ function ToastProvider() {
|
|
|
1651
1735
|
itemRefs.current.set(id, el);
|
|
1652
1736
|
};
|
|
1653
1737
|
}, []);
|
|
1654
|
-
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(
|
|
1655
1739
|
Toast,
|
|
1656
1740
|
{
|
|
1657
1741
|
duration: toast2.duration,
|
|
@@ -1679,9 +1763,9 @@ function getPositionClass(position) {
|
|
|
1679
1763
|
}
|
|
1680
1764
|
|
|
1681
1765
|
// src/components/wrapper.tsx
|
|
1682
|
-
import { jsx as
|
|
1766
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
1683
1767
|
var Wrapper = ({ children, className }) => {
|
|
1684
|
-
return /* @__PURE__ */
|
|
1768
|
+
return /* @__PURE__ */ jsx28("div", { className: cn("mx-auto h-full w-full", className), children });
|
|
1685
1769
|
};
|
|
1686
1770
|
export {
|
|
1687
1771
|
Alert,
|
|
@@ -1714,6 +1798,7 @@ export {
|
|
|
1714
1798
|
FormLabel,
|
|
1715
1799
|
FormMessage,
|
|
1716
1800
|
GoogleMapPicker,
|
|
1801
|
+
Image,
|
|
1717
1802
|
Input,
|
|
1718
1803
|
InputField,
|
|
1719
1804
|
InputOTP,
|