@hotelcard/ui 0.0.6 → 0.0.7
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.
Potentially problematic release.
This version of @hotelcard/ui might be problematic. Click here for more details.
- package/dist/index.cjs +53 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +93 -1
- package/dist/index.d.ts +93 -1
- package/dist/index.js +47 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
package/dist/index.d.cts
CHANGED
|
@@ -536,4 +536,96 @@ declare const PinIcon: {
|
|
|
536
536
|
displayName: string;
|
|
537
537
|
};
|
|
538
538
|
|
|
539
|
-
|
|
539
|
+
declare const useDebounce: <T>(value: T, delay: number) => T;
|
|
540
|
+
|
|
541
|
+
declare const formatPrice: (amount: number, currency?: string, locale?: string) => string;
|
|
542
|
+
|
|
543
|
+
declare const formatDate: (date: string | Date, formatStr?: string, locale?: string) => string;
|
|
544
|
+
declare const formatDateRange: (checkIn: string | Date, checkOut: string | Date, locale?: string) => string;
|
|
545
|
+
|
|
546
|
+
declare const calculateDiscount: (originalPrice: number, discountedPrice: number) => number;
|
|
547
|
+
|
|
548
|
+
interface Hotel {
|
|
549
|
+
id: number;
|
|
550
|
+
name: string;
|
|
551
|
+
location: string;
|
|
552
|
+
region?: string;
|
|
553
|
+
country?: string;
|
|
554
|
+
stars: number;
|
|
555
|
+
rating?: number;
|
|
556
|
+
reviewCount?: number;
|
|
557
|
+
imageUrl: string;
|
|
558
|
+
images?: string[];
|
|
559
|
+
priceFrom: number;
|
|
560
|
+
originalPrice?: number;
|
|
561
|
+
currency: string;
|
|
562
|
+
discountPercent?: number;
|
|
563
|
+
isFavourited?: boolean;
|
|
564
|
+
isNew?: boolean;
|
|
565
|
+
benefits?: string[];
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
interface Booking {
|
|
569
|
+
id: number;
|
|
570
|
+
confirmationNumber: string;
|
|
571
|
+
status: 'confirmed' | 'cancelled' | 'completed';
|
|
572
|
+
hotel: {
|
|
573
|
+
id: number;
|
|
574
|
+
name: string;
|
|
575
|
+
location: string;
|
|
576
|
+
imageUrl: string;
|
|
577
|
+
};
|
|
578
|
+
checkIn: string;
|
|
579
|
+
checkOut: string;
|
|
580
|
+
guests: number;
|
|
581
|
+
roomType: string;
|
|
582
|
+
totalPrice: number;
|
|
583
|
+
currency: string;
|
|
584
|
+
createdAt: string;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
interface Address {
|
|
588
|
+
id?: number;
|
|
589
|
+
line1: string;
|
|
590
|
+
line2?: string;
|
|
591
|
+
zip: string;
|
|
592
|
+
city: string;
|
|
593
|
+
countryCode: string;
|
|
594
|
+
}
|
|
595
|
+
interface Membership {
|
|
596
|
+
cardNumber: string;
|
|
597
|
+
validFrom: string;
|
|
598
|
+
validUntil: string;
|
|
599
|
+
}
|
|
600
|
+
interface User {
|
|
601
|
+
id: number;
|
|
602
|
+
firstName: string;
|
|
603
|
+
lastName: string;
|
|
604
|
+
email: string;
|
|
605
|
+
phone?: string;
|
|
606
|
+
locale: string;
|
|
607
|
+
currency: string;
|
|
608
|
+
activeAddress?: Address;
|
|
609
|
+
membership?: Membership;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
interface SearchParams {
|
|
613
|
+
destination?: string;
|
|
614
|
+
checkIn?: string;
|
|
615
|
+
checkOut?: string;
|
|
616
|
+
adults?: number;
|
|
617
|
+
children?: number;
|
|
618
|
+
flexibleDates?: boolean;
|
|
619
|
+
flexibleMonth?: string;
|
|
620
|
+
}
|
|
621
|
+
interface SearchFilters {
|
|
622
|
+
priceMin?: number;
|
|
623
|
+
priceMax?: number;
|
|
624
|
+
stars?: number[];
|
|
625
|
+
rating?: number;
|
|
626
|
+
amenities?: string[];
|
|
627
|
+
experiences?: string[];
|
|
628
|
+
regions?: string[];
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
export { type Address, Badge, type BadgeProps, type BenefitItem, Benefits, type BenefitsProps, Block, type BlockProps, type Booking, Button, type ButtonProps, Card, type CardBadge, type CardProps, type CardRatingInfo, Checkbox, type CheckboxProps, type CheckboxSize, ChevronLeftIcon, ChevronRightIcon, Chip, type ChipProps, type ChipSize, type ChipState, CompactCard, type CompactCardBadge, type CompactCardProps, Divider, type DividerProps, Dropdown, type DropdownOption, type DropdownProps, FAQ, type FAQItem, type FAQProps, HeartIcon, type Hotel, Input, type InputProps, type InputType, type Membership, Modal, type ModalProps, Pin, PinIcon, type PinProps, RadioButton, type RadioButtonProps, Rating, type RatingProps, ReviewCard, type ReviewCardProps, type SearchFilters, type SearchParams, SectionHeader, type SectionHeaderProps, StarIcon, type User, calculateDiscount, formatDate, formatDateRange, formatPrice, useDebounce };
|
package/dist/index.d.ts
CHANGED
|
@@ -536,4 +536,96 @@ declare const PinIcon: {
|
|
|
536
536
|
displayName: string;
|
|
537
537
|
};
|
|
538
538
|
|
|
539
|
-
|
|
539
|
+
declare const useDebounce: <T>(value: T, delay: number) => T;
|
|
540
|
+
|
|
541
|
+
declare const formatPrice: (amount: number, currency?: string, locale?: string) => string;
|
|
542
|
+
|
|
543
|
+
declare const formatDate: (date: string | Date, formatStr?: string, locale?: string) => string;
|
|
544
|
+
declare const formatDateRange: (checkIn: string | Date, checkOut: string | Date, locale?: string) => string;
|
|
545
|
+
|
|
546
|
+
declare const calculateDiscount: (originalPrice: number, discountedPrice: number) => number;
|
|
547
|
+
|
|
548
|
+
interface Hotel {
|
|
549
|
+
id: number;
|
|
550
|
+
name: string;
|
|
551
|
+
location: string;
|
|
552
|
+
region?: string;
|
|
553
|
+
country?: string;
|
|
554
|
+
stars: number;
|
|
555
|
+
rating?: number;
|
|
556
|
+
reviewCount?: number;
|
|
557
|
+
imageUrl: string;
|
|
558
|
+
images?: string[];
|
|
559
|
+
priceFrom: number;
|
|
560
|
+
originalPrice?: number;
|
|
561
|
+
currency: string;
|
|
562
|
+
discountPercent?: number;
|
|
563
|
+
isFavourited?: boolean;
|
|
564
|
+
isNew?: boolean;
|
|
565
|
+
benefits?: string[];
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
interface Booking {
|
|
569
|
+
id: number;
|
|
570
|
+
confirmationNumber: string;
|
|
571
|
+
status: 'confirmed' | 'cancelled' | 'completed';
|
|
572
|
+
hotel: {
|
|
573
|
+
id: number;
|
|
574
|
+
name: string;
|
|
575
|
+
location: string;
|
|
576
|
+
imageUrl: string;
|
|
577
|
+
};
|
|
578
|
+
checkIn: string;
|
|
579
|
+
checkOut: string;
|
|
580
|
+
guests: number;
|
|
581
|
+
roomType: string;
|
|
582
|
+
totalPrice: number;
|
|
583
|
+
currency: string;
|
|
584
|
+
createdAt: string;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
interface Address {
|
|
588
|
+
id?: number;
|
|
589
|
+
line1: string;
|
|
590
|
+
line2?: string;
|
|
591
|
+
zip: string;
|
|
592
|
+
city: string;
|
|
593
|
+
countryCode: string;
|
|
594
|
+
}
|
|
595
|
+
interface Membership {
|
|
596
|
+
cardNumber: string;
|
|
597
|
+
validFrom: string;
|
|
598
|
+
validUntil: string;
|
|
599
|
+
}
|
|
600
|
+
interface User {
|
|
601
|
+
id: number;
|
|
602
|
+
firstName: string;
|
|
603
|
+
lastName: string;
|
|
604
|
+
email: string;
|
|
605
|
+
phone?: string;
|
|
606
|
+
locale: string;
|
|
607
|
+
currency: string;
|
|
608
|
+
activeAddress?: Address;
|
|
609
|
+
membership?: Membership;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
interface SearchParams {
|
|
613
|
+
destination?: string;
|
|
614
|
+
checkIn?: string;
|
|
615
|
+
checkOut?: string;
|
|
616
|
+
adults?: number;
|
|
617
|
+
children?: number;
|
|
618
|
+
flexibleDates?: boolean;
|
|
619
|
+
flexibleMonth?: string;
|
|
620
|
+
}
|
|
621
|
+
interface SearchFilters {
|
|
622
|
+
priceMin?: number;
|
|
623
|
+
priceMax?: number;
|
|
624
|
+
stars?: number[];
|
|
625
|
+
rating?: number;
|
|
626
|
+
amenities?: string[];
|
|
627
|
+
experiences?: string[];
|
|
628
|
+
regions?: string[];
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
export { type Address, Badge, type BadgeProps, type BenefitItem, Benefits, type BenefitsProps, Block, type BlockProps, type Booking, Button, type ButtonProps, Card, type CardBadge, type CardProps, type CardRatingInfo, Checkbox, type CheckboxProps, type CheckboxSize, ChevronLeftIcon, ChevronRightIcon, Chip, type ChipProps, type ChipSize, type ChipState, CompactCard, type CompactCardBadge, type CompactCardProps, Divider, type DividerProps, Dropdown, type DropdownOption, type DropdownProps, FAQ, type FAQItem, type FAQProps, HeartIcon, type Hotel, Input, type InputProps, type InputType, type Membership, Modal, type ModalProps, Pin, PinIcon, type PinProps, RadioButton, type RadioButtonProps, Rating, type RatingProps, ReviewCard, type ReviewCardProps, type SearchFilters, type SearchParams, SectionHeader, type SectionHeaderProps, StarIcon, type User, calculateDiscount, formatDate, formatDateRange, formatPrice, useDebounce };
|
package/dist/index.js
CHANGED
|
@@ -1434,6 +1434,47 @@ var PinIcon = ({ className = "", size = 16 }) => /* @__PURE__ */ jsxs20(
|
|
|
1434
1434
|
}
|
|
1435
1435
|
);
|
|
1436
1436
|
PinIcon.displayName = "PinIcon";
|
|
1437
|
+
|
|
1438
|
+
// src/hooks/useDebounce.ts
|
|
1439
|
+
import { useState as useState5, useEffect as useEffect3 } from "react";
|
|
1440
|
+
var useDebounce = (value, delay) => {
|
|
1441
|
+
const [debouncedValue, setDebouncedValue] = useState5(value);
|
|
1442
|
+
useEffect3(() => {
|
|
1443
|
+
const timer = setTimeout(() => setDebouncedValue(value), delay);
|
|
1444
|
+
return () => clearTimeout(timer);
|
|
1445
|
+
}, [value, delay]);
|
|
1446
|
+
return debouncedValue;
|
|
1447
|
+
};
|
|
1448
|
+
|
|
1449
|
+
// src/utils/formatPrice.ts
|
|
1450
|
+
var formatPrice = (amount, currency = "CHF", locale = "de-CH") => {
|
|
1451
|
+
return new Intl.NumberFormat(locale, {
|
|
1452
|
+
style: "currency",
|
|
1453
|
+
currency,
|
|
1454
|
+
minimumFractionDigits: 0,
|
|
1455
|
+
maximumFractionDigits: 0
|
|
1456
|
+
}).format(amount);
|
|
1457
|
+
};
|
|
1458
|
+
|
|
1459
|
+
// src/utils/formatDate.ts
|
|
1460
|
+
import { format, parseISO } from "date-fns";
|
|
1461
|
+
import { de, enUS, fr, it } from "date-fns/locale";
|
|
1462
|
+
var locales = { de, en: enUS, fr, it };
|
|
1463
|
+
var formatDate = (date, formatStr = "dd. MMM yyyy", locale = "de") => {
|
|
1464
|
+
const d = typeof date === "string" ? parseISO(date) : date;
|
|
1465
|
+
return format(d, formatStr, { locale: locales[locale] || de });
|
|
1466
|
+
};
|
|
1467
|
+
var formatDateRange = (checkIn, checkOut, locale = "de") => {
|
|
1468
|
+
const start = formatDate(checkIn, "dd.", locale);
|
|
1469
|
+
const end = formatDate(checkOut, "dd. MMM yyyy", locale);
|
|
1470
|
+
return `${start} - ${end}`;
|
|
1471
|
+
};
|
|
1472
|
+
|
|
1473
|
+
// src/utils/calculateDiscount.ts
|
|
1474
|
+
var calculateDiscount = (originalPrice, discountedPrice) => {
|
|
1475
|
+
if (originalPrice <= 0) return 0;
|
|
1476
|
+
return Math.round((originalPrice - discountedPrice) / originalPrice * 100);
|
|
1477
|
+
};
|
|
1437
1478
|
export {
|
|
1438
1479
|
Badge,
|
|
1439
1480
|
Benefits,
|
|
@@ -1457,6 +1498,11 @@ export {
|
|
|
1457
1498
|
Rating,
|
|
1458
1499
|
ReviewCard,
|
|
1459
1500
|
SectionHeader,
|
|
1460
|
-
StarIcon4 as StarIcon
|
|
1501
|
+
StarIcon4 as StarIcon,
|
|
1502
|
+
calculateDiscount,
|
|
1503
|
+
formatDate,
|
|
1504
|
+
formatDateRange,
|
|
1505
|
+
formatPrice,
|
|
1506
|
+
useDebounce
|
|
1461
1507
|
};
|
|
1462
1508
|
//# sourceMappingURL=index.js.map
|