negodesign 0.0.77 → 0.0.79
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 +133 -133
- package/dist/components/NegoDesign.svelte +21 -21
- package/dist/components/pages/admin/01/ui/AdminContent.svelte +14 -14
- package/dist/components/pages/admin/01/ui/AdminPanel.svelte +46 -46
- package/dist/components/pages/product-details/shared/ProductDetailFilesVertical.svelte +103 -103
- package/dist/components/pages/profile-user/shared/ProfileUserAddress.svelte +83 -83
- package/dist/components/pages/profile-user/shared/ProfileUserTabs.svelte +80 -80
- package/dist/components/pages/security/auth/PageAuth01.svelte +21 -24
- package/dist/components/pages/security/auth/PageAuth02.svelte +11 -16
- package/dist/components/pages/security/auth/PageAuth03.svelte +11 -16
- package/dist/components/pages/security/login/01/ui/FormLogin.svelte +7 -5
- package/dist/components/pages/security/login/01/ui/FormLogin.svelte.d.ts +2 -0
- package/dist/components/pages/security/login/01/ui/FormLoginEmailPassword.svelte +4 -2
- package/dist/components/pages/security/login/01/ui/FormLoginEmailPassword.svelte.d.ts +2 -0
- package/dist/components/pages/security/login/01/ui/FormLoginPhonePassword.svelte +4 -2
- package/dist/components/pages/security/login/01/ui/FormLoginPhonePassword.svelte.d.ts +2 -0
- package/dist/components/pages/security/login/01/ui/FormLoginUsernamePassword.svelte +4 -2
- package/dist/components/pages/security/login/01/ui/FormLoginUsernamePassword.svelte.d.ts +2 -0
- package/dist/components/pages/security/login/01/ui/{LoginCard.svelte → LoginCard01.svelte} +132 -109
- package/dist/components/pages/security/login/01/ui/{LoginCard.svelte.d.ts → LoginCard01.svelte.d.ts} +3 -3
- package/dist/components/pages/security/login/01/ui/PageLogin01.svelte +2 -2
- package/dist/components/pages/security/login/02/ui/FormLogin02.svelte +7 -5
- package/dist/components/pages/security/login/02/ui/FormLogin02.svelte.d.ts +2 -0
- package/dist/components/pages/security/login/02/ui/FormLoginEmailPassword02.svelte +4 -2
- package/dist/components/pages/security/login/02/ui/FormLoginEmailPassword02.svelte.d.ts +2 -0
- package/dist/components/pages/security/login/02/ui/FormLoginPhonePassword02.svelte +4 -2
- package/dist/components/pages/security/login/02/ui/FormLoginPhonePassword02.svelte.d.ts +2 -0
- package/dist/components/pages/security/login/02/ui/FormLoginUsernamePassword02.svelte +4 -2
- package/dist/components/pages/security/login/02/ui/FormLoginUsernamePassword02.svelte.d.ts +2 -0
- package/dist/components/pages/security/login/03/ui/FormLogin03.svelte +8 -4
- package/dist/components/pages/security/login/03/ui/FormLogin03.svelte.d.ts +2 -0
- package/dist/components/pages/security/login/03/ui/FormLoginEmailPassword03.svelte +4 -2
- package/dist/components/pages/security/login/03/ui/FormLoginEmailPassword03.svelte.d.ts +2 -0
- package/dist/components/pages/security/login/03/ui/FormLoginPhonePassword03.svelte +4 -2
- package/dist/components/pages/security/login/03/ui/FormLoginPhonePassword03.svelte.d.ts +2 -0
- package/dist/components/pages/security/login/03/ui/FormLoginUsernamePassword03.svelte +4 -2
- package/dist/components/pages/security/login/03/ui/FormLoginUsernamePassword03.svelte.d.ts +2 -0
- package/dist/components/pages/security/login/PageLogin.svelte +30 -30
- package/dist/components/pages/security/register/01/ui/PageRegister01.svelte +21 -9
- package/dist/components/pages/security/register/01/ui/PageRegister01.svelte.d.ts +1 -0
- package/dist/components/pages/security/register/01/ui/{RegisterCard.svelte → RegisterCard01.svelte} +26 -22
- package/dist/components/pages/security/register/01/ui/{RegisterCard.svelte.d.ts → RegisterCard01.svelte.d.ts} +3 -3
- package/dist/components/pages/security/register/FormRegister.svelte +40 -14
- package/dist/components/pages/security/register/FormRegister.svelte.d.ts +3 -0
- package/dist/components/ui/avatar/avatar-fallback.svelte +29 -29
- package/dist/components/ui/avatar/avatar-image.svelte +38 -38
- package/dist/components/ui/avatar/avatar.svelte +39 -39
- package/dist/components/ui/badge/badge.svelte +46 -46
- package/dist/components/ui/banner/AdCardBanner.svelte +74 -74
- package/dist/components/ui/banner/CtaCardBanner.svelte +118 -118
- package/dist/components/ui/banner/CtaCardImageBanner.svelte +94 -94
- package/dist/components/ui/breadcrumb/core/breadcrumb-list.svelte +31 -31
- package/dist/components/ui/button/ButtonBack.svelte +18 -18
- package/dist/components/ui/button/ButtonLogin.svelte +15 -15
- package/dist/components/ui/button/ButtonLoginWith.svelte +57 -57
- package/dist/components/ui/button/ButtonSend.svelte +15 -15
- package/dist/components/ui/button/button.svelte +85 -85
- package/dist/components/ui/card/core/highlight/01/CardHighlight01.svelte +103 -103
- package/dist/components/ui/card/core/highlight/02/CardHighlight02.svelte +99 -99
- package/dist/components/ui/card/core/highlight/CardHighlight.svelte +22 -22
- package/dist/components/ui/card/core/media/01/CardMedia01.svelte +133 -133
- package/dist/components/ui/card/core/media/02/CardMedia02.svelte +127 -127
- package/dist/components/ui/card/core/media/CardMedia.svelte +18 -18
- package/dist/components/ui/card/core/product/01/CardProduct01.svelte +136 -136
- package/dist/components/ui/card/core/product/02/CardProduct02.svelte +124 -124
- package/dist/components/ui/card/core/product/CardProduct.svelte +22 -22
- package/dist/components/ui/card/core/profile/01/CardProfile01.svelte +134 -134
- package/dist/components/ui/card/core/profile/02/CardProfile02.svelte +132 -132
- package/dist/components/ui/card/core/profile/CardProfile.svelte +18 -18
- package/dist/components/ui/card/core/promotion/CardPromotion.svelte +139 -139
- package/dist/components/ui/card/core/promotion/CardPromotionPrice.svelte +32 -32
- package/dist/components/ui/card/core/shared/CardButton.svelte +42 -42
- package/dist/components/ui/card/core/shared/CardCart.svelte +36 -36
- package/dist/components/ui/card/core/shared/CardDescription.svelte +41 -41
- package/dist/components/ui/card/core/shared/CardFavorite.svelte +33 -33
- package/dist/components/ui/card/core/shared/CardLogo.svelte +19 -19
- package/dist/components/ui/card/core/shared/CardPhoneOrWhatsapp.svelte +45 -45
- package/dist/components/ui/card/core/shared/CardStarRating.svelte +24 -24
- package/dist/components/ui/card/core/shared/CardTags.svelte +95 -95
- package/dist/components/ui/card/core/shared/CardThumbnailVideo.svelte +232 -232
- package/dist/components/ui/card/core/shared/CardTitlePrice.svelte +24 -24
- package/dist/components/ui/card/core/shared/TruncatableText.svelte +49 -49
- package/dist/components/ui/carousel/carousel-content.svelte +56 -56
- package/dist/components/ui/carousel/carousel-item.svelte +29 -29
- package/dist/components/ui/carousel/carousel-next.svelte +40 -40
- package/dist/components/ui/carousel/carousel-previous.svelte +40 -40
- package/dist/components/ui/carousel/carousel.svelte +225 -225
- package/dist/components/ui/carousel/core/badge/ui/CarouselBadge.svelte +108 -108
- package/dist/components/ui/carousel/core/grid/shared/ui/CarouselGridSlot.svelte +38 -38
- package/dist/components/ui/carousel/core/hero/ui/CarouselHero.svelte +181 -181
- package/dist/components/ui/carousel/core/highlights/ui/CarouselHighlights.svelte +67 -67
- package/dist/components/ui/carousel/core/product/ui/CarouselProduct.svelte +57 -57
- package/dist/components/ui/carousel/core/promotion/ui/CarouselPromotion.svelte +67 -67
- package/dist/components/ui/carousel/core/shared/ui/CarouselHeader.svelte +59 -59
- package/dist/components/ui/checkbox/checkbox.svelte +96 -96
- package/dist/components/ui/collapsible/collapsible-content.svelte +30 -30
- package/dist/components/ui/collapsible/collapsible-trigger.svelte +51 -51
- package/dist/components/ui/collapsible/collapsible.svelte +66 -66
- package/dist/components/ui/data-table/flex-render.svelte +40 -40
- package/dist/components/ui/datatable/ui/DataTableActions.svelte +28 -28
- package/dist/components/ui/datatable/ui/DataTableCheckbox.svelte +22 -22
- package/dist/components/ui/datatable/ui/DataTableContent.svelte +59 -59
- package/dist/components/ui/datatable/ui/DataTableCore.svelte +148 -148
- package/dist/components/ui/datatable/ui/DataTableDragHandle.svelte +8 -8
- package/dist/components/ui/datatable/ui/DataTableListFilter.svelte +60 -60
- package/dist/components/ui/datatable/ui/DataTableListPagination.svelte +35 -35
- package/dist/components/ui/drawer/drawer-close.svelte +41 -41
- package/dist/components/ui/drawer/drawer-content.svelte +81 -81
- package/dist/components/ui/drawer/drawer-description.svelte +19 -19
- package/dist/components/ui/drawer/drawer-footer.svelte +20 -20
- package/dist/components/ui/drawer/drawer-header.svelte +20 -20
- package/dist/components/ui/drawer/drawer-nested.svelte +34 -34
- package/dist/components/ui/drawer/drawer-overlay.svelte +25 -25
- package/dist/components/ui/drawer/drawer-portal.svelte +19 -19
- package/dist/components/ui/drawer/drawer-title.svelte +19 -19
- package/dist/components/ui/drawer/drawer-trigger.svelte +42 -42
- package/dist/components/ui/drawer/drawer.svelte +74 -74
- package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-group.svelte +25 -25
- package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +69 -69
- package/dist/components/ui/dropdown-menu/dropdown-menu-content.svelte +106 -106
- package/dist/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte +27 -27
- package/dist/components/ui/dropdown-menu/dropdown-menu-group.svelte +21 -21
- package/dist/components/ui/dropdown-menu/dropdown-menu-item.svelte +60 -60
- package/dist/components/ui/dropdown-menu/dropdown-menu-label.svelte +27 -27
- package/dist/components/ui/dropdown-menu/dropdown-menu-portal.svelte +6 -6
- package/dist/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte +43 -43
- package/dist/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +70 -70
- package/dist/components/ui/dropdown-menu/dropdown-menu-separator.svelte +20 -20
- package/dist/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +33 -33
- package/dist/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +57 -57
- package/dist/components/ui/dropdown-menu/dropdown-menu-sub.svelte +76 -76
- package/dist/components/ui/dropdown-menu/dropdown-menu-trigger.svelte +68 -68
- package/dist/components/ui/dropdown-menu/dropdown-menu.svelte +53 -53
- package/dist/components/ui/empty/empty-content.svelte +19 -19
- package/dist/components/ui/empty/empty-description.svelte +19 -19
- package/dist/components/ui/empty/empty-header.svelte +19 -19
- package/dist/components/ui/empty/empty-media.svelte +41 -41
- package/dist/components/ui/empty/empty-title.svelte +19 -19
- package/dist/components/ui/empty/empty.svelte +19 -19
- package/dist/components/ui/footer/ui/Footer.svelte +18 -18
- package/dist/components/ui/form/data/InputIconDefault.svelte.js +2 -1
- package/dist/components/ui/form/data/InputLabel.svelte.d.ts +3 -0
- package/dist/components/ui/form/ui/calendar/Calendar.svelte +194 -0
- package/dist/components/ui/form/ui/calendar/Calendar.svelte.d.ts +15 -0
- package/dist/components/ui/form/ui/calendar/CalendarCard.svelte +90 -0
- package/dist/components/ui/form/ui/calendar/CalendarCard.svelte.d.ts +20 -0
- package/dist/components/ui/form/ui/calendar/DaysGrid.svelte +76 -0
- package/dist/components/ui/form/ui/calendar/DaysGrid.svelte.d.ts +17 -0
- package/dist/components/ui/form/ui/calendar/MonthSelect.svelte +50 -0
- package/dist/components/ui/form/ui/calendar/MonthSelect.svelte.d.ts +10 -0
- package/dist/components/ui/form/ui/calendar/YearSelect.svelte +117 -0
- package/dist/components/ui/form/ui/calendar/YearSelect.svelte.d.ts +15 -0
- package/dist/components/ui/form/ui/calendar/index.d.ts +5 -0
- package/dist/components/ui/form/ui/calendar/index.js +5 -0
- package/dist/components/ui/form/ui/calendar/utils.d.ts +26 -0
- package/dist/components/ui/form/ui/calendar/utils.js +89 -0
- package/dist/components/ui/form/ui/input-base.svelte +83 -81
- package/dist/components/ui/form/ui/input-calendar-interval.svelte +179 -0
- package/dist/components/ui/form/ui/input-calendar-interval.svelte.d.ts +14 -0
- package/dist/components/ui/form/ui/input-calendar.svelte +110 -0
- package/dist/components/ui/form/ui/input-calendar.svelte.d.ts +9 -0
- package/dist/components/ui/form/ui/input-email-or-phone.svelte +23 -23
- package/dist/components/ui/form/ui/input-email.svelte +23 -23
- package/dist/components/ui/form/ui/input-password-confirm.svelte +23 -23
- package/dist/components/ui/form/ui/input-password.svelte +23 -23
- package/dist/components/ui/form/ui/input-phone.svelte +37 -33
- package/dist/components/ui/form/ui/input-select.svelte +210 -158
- package/dist/components/ui/form/ui/input-select.svelte.d.ts +5 -9
- package/dist/components/ui/form/ui/input-username.svelte +22 -22
- package/dist/components/ui/grid/core/ui/01/Grid01.svelte +30 -30
- package/dist/components/ui/grid/core/ui/02/Grid02.svelte +30 -30
- package/dist/components/ui/grid/core/ui/ItemsPanel.svelte +26 -26
- package/dist/components/ui/grid/core/ui/ItemsPanelCarousel.svelte +37 -37
- package/dist/components/ui/grid/core/ui/ItemsPanelGrid.svelte +43 -43
- package/dist/components/ui/grid/core/ui/ItemsSimpleGrid.svelte +45 -45
- package/dist/components/ui/grid/core/ui/shared/DescriptionGrid.svelte +23 -23
- package/dist/components/ui/grid/core/ui/shared/IconRenderGrid.svelte +23 -23
- package/dist/components/ui/grid/core/ui/shared/TitleGrid.svelte +19 -19
- package/dist/components/ui/hero/SimpleHero.svelte +65 -65
- package/dist/components/ui/input-otp/input-otp-group.svelte +22 -22
- package/dist/components/ui/input-otp/input-otp-separator.svelte +27 -27
- package/dist/components/ui/input-otp/input-otp-slot.svelte +63 -63
- package/dist/components/ui/input-otp/input-otp.svelte +181 -181
- package/dist/components/ui/label/core/LabelOr.svelte +25 -25
- package/dist/components/ui/label/label.svelte +19 -19
- package/dist/components/ui/language-switcher/language-switcher.svelte +48 -48
- package/dist/components/ui/light-switch/light-switch.svelte +48 -48
- package/dist/components/ui/link/link-forget-password.svelte +12 -12
- package/dist/components/ui/link/link-privacy-polity.svelte +12 -12
- package/dist/components/ui/link/link-terms-of-service.svelte +12 -12
- package/dist/components/ui/modal/core/index.d.ts +1 -1
- package/dist/components/ui/modal/core/types.d.ts +2 -1
- package/dist/components/ui/modal/core/ui/ModalCore.svelte +132 -132
- package/dist/components/ui/modal/grid/types.d.ts +6 -5
- package/dist/components/ui/modal/grid/ui/02/ModalGridSelection02.svelte +146 -146
- package/dist/components/ui/modal/share/ui/ModalShareSelection.svelte +156 -156
- package/dist/components/ui/nav/ui/ComplexMenu.svelte +51 -51
- package/dist/components/ui/nav/ui/Menu.svelte +72 -72
- package/dist/components/ui/nav/ui/SimpleMenu.svelte +14 -14
- package/dist/components/ui/nav/ui/mobile/ComplexMenuMobile.svelte +125 -125
- package/dist/components/ui/nav/ui/mobile/MenuMobile.svelte +54 -54
- package/dist/components/ui/nav/ui/shared/MenuButton.svelte +51 -51
- package/dist/components/ui/nav/ui/shared/MenuLinks.svelte +40 -40
- package/dist/components/ui/nav/ui/shared/MenuListItem.svelte +44 -44
- package/dist/components/ui/nav/ui/shared/MenuLogo.svelte +13 -13
- package/dist/components/ui/nav/ui/shared/dropdown/DropdownNavigationMenuItemGrid.svelte +30 -30
- package/dist/components/ui/nav/ui/shared/navigation/NavDropdown.svelte +87 -87
- package/dist/components/ui/nav/ui/shared/navigation/NavigationMenuItem.svelte +17 -17
- package/dist/components/ui/nav/ui/shared/navigation/NavigationMenuItemCard.svelte +53 -53
- package/dist/components/ui/nav/ui/shared/navigation/NavigationMenuItemGrid.svelte +36 -36
- package/dist/components/ui/nav/ui/shared/navigation/NavigationMenuItemList.svelte +24 -24
- package/dist/components/ui/nav/ui/shared/navigation/NavigationMenuItems.svelte +21 -21
- package/dist/components/ui/panel/CarouselSlot.svelte +57 -57
- package/dist/components/ui/panel/LeftHero.svelte +114 -114
- package/dist/components/ui/panel/NotFoundEmpty.svelte +66 -66
- package/dist/components/ui/phone-input/country-selector.svelte +87 -87
- package/dist/components/ui/phone-input/country-selector.svelte.d.ts +2 -2
- package/dist/components/ui/phone-input/flag.svelte +11 -11
- package/dist/components/ui/phone-input/phone-input.svelte +163 -148
- package/dist/components/ui/phone-input/phone-input.svelte.d.ts +2 -2
- package/dist/components/ui/popover/popover-close.svelte +25 -25
- package/dist/components/ui/popover/popover-content.svelte +92 -92
- package/dist/components/ui/popover/popover-portal.svelte +6 -6
- package/dist/components/ui/popover/popover-trigger.svelte +68 -68
- package/dist/components/ui/popover/popover.svelte +53 -53
- package/dist/components/ui/search/SearchInput.svelte +32 -32
- package/dist/components/ui/search/shared/SearchInputCore.svelte +66 -66
- package/dist/components/ui/separator/separator.svelte +28 -28
- package/dist/components/ui/sidebar/core/MenuBarSidebar.svelte +70 -70
- package/dist/components/ui/sidebar/core/ui/navbar/NavMenuBarSidebar.svelte +97 -97
- package/dist/components/ui/sidebar/core/ui/navbar/NavMenuBottomSidebar.svelte +33 -33
- package/dist/components/ui/sidebar/core/ui/navbar/NavMenuTopBarSidebar.svelte +101 -101
- package/dist/components/ui/sidebar/core/ui/navbar/nav-menu-header-sidebar.svelte +77 -77
- package/dist/components/ui/sidebar/sidebar-content.svelte +24 -24
- package/dist/components/ui/sidebar/sidebar-footer.svelte +21 -21
- package/dist/components/ui/sidebar/sidebar-group-content.svelte +21 -21
- package/dist/components/ui/sidebar/sidebar-menu-action.svelte +38 -38
- package/dist/components/ui/sidebar/sidebar-menu-button.svelte +70 -70
- package/dist/components/ui/sidebar/sidebar-menu-sub-button.svelte +39 -39
- package/dist/components/ui/sidebar/sidebar-provider.svelte +62 -62
- package/dist/components/ui/sidebar/sidebar-rail.svelte +36 -36
- package/dist/components/ui/sidebar/sidebar-separator.svelte +21 -21
- package/dist/components/ui/sidebar/sidebar-trigger.svelte +36 -36
- package/dist/components/ui/sidebar/sidebar.svelte +118 -118
- package/dist/components/ui/skeleton/skeleton.svelte +19 -19
- package/dist/components/ui/star-rating/star-rating-star.svelte +66 -66
- package/dist/components/ui/star-rating/star-rating.svelte +149 -149
- package/dist/components/ui/table/table-body.svelte +15 -15
- package/dist/components/ui/table/table-caption.svelte +20 -20
- package/dist/components/ui/table/table-cell.svelte +15 -15
- package/dist/components/ui/table/table-footer.svelte +20 -20
- package/dist/components/ui/table/table-head.svelte +15 -15
- package/dist/components/ui/table/table-header.svelte +20 -20
- package/dist/components/ui/table/table-row.svelte +15 -15
- package/dist/components/ui/table/table.svelte +17 -17
- package/dist/components/ui/tabs/ui/tab-underline.svelte +43 -43
- package/dist/components/ui/underline-tabs/underline-tabs-content.svelte +33 -33
- package/dist/components/ui/underline-tabs/underline-tabs-list.svelte +40 -40
- package/dist/components/ui/underline-tabs/underline-tabs-trigger.svelte +91 -91
- package/dist/components/ui/underline-tabs/underline-tabs.svelte +61 -61
- package/dist/docs/ApiTable.svelte +42 -42
- package/dist/docs/CodeBlock.svelte +26 -26
- package/dist/docs/DocsHeader.svelte +25 -25
- package/dist/docs/DocsSidebar.svelte +108 -156
- package/dist/docs/components.js +638 -563
- package/dist/globals.css +68 -10
- package/dist/i18n/langs/en.d.ts +7 -0
- package/dist/i18n/langs/en.js +7 -0
- package/dist/i18n/langs/pt.d.ts +7 -0
- package/dist/i18n/langs/pt.js +7 -0
- package/dist/i18n/translations.d.ts +14 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +23 -0
- package/dist/styles/globals.css +283 -283
- package/dist/types/index.d.ts +3 -1
- package/package.json +81 -81
- package/dist/components/pages/security/login/01/ui/FormRegister.svelte +0 -28
- package/dist/components/pages/security/login/01/ui/FormRegister.svelte.d.ts +0 -3
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
3
|
-
import type { CardTagsProps } from "../types";
|
|
4
|
-
import Skeleton from "../../../skeleton/skeleton.svelte";
|
|
5
|
-
import * as Popover from "../../../popover"; // adjust path to your setup
|
|
6
|
-
|
|
7
|
-
type Props = {
|
|
8
|
-
className?: string;
|
|
9
|
-
tags?: CardTagsProps[];
|
|
10
|
-
isTagBorderBottom?: boolean;
|
|
11
|
-
isWrap?: boolean;
|
|
12
|
-
isLoading?: boolean;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const {
|
|
16
|
-
tags = [],
|
|
17
|
-
className,
|
|
18
|
-
isTagBorderBottom,
|
|
19
|
-
isWrap = false,
|
|
20
|
-
isLoading = false,
|
|
21
|
-
}: Props = $props();
|
|
22
|
-
|
|
23
|
-
let isJustify = $derived(tags?.length == 2 || tags?.length == 3);
|
|
24
|
-
let open = $state(false);
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
{#snippet createBadge(tag: CardTagsProps, clasName?: string)}
|
|
28
|
-
<div
|
|
29
|
-
class="flex items-center h-5 shrink-0 {isTagBorderBottom
|
|
30
|
-
? 'border border-gray-200 rounded-full px-2 py-1'
|
|
31
|
-
: ''} {clasName}"
|
|
32
|
-
>
|
|
33
|
-
{#if tag.icon}
|
|
34
|
-
<HugeiconsIcon icon={tag.icon} class="mr-0.5 h-3.75 w-3.75 shrink-0" />
|
|
35
|
-
{/if}
|
|
36
|
-
<div class="whitespace-nowrap">{tag.text}</div>
|
|
37
|
-
</div>
|
|
38
|
-
{/snippet}
|
|
39
|
-
|
|
40
|
-
{#snippet skeletonTag()}
|
|
41
|
-
<div class="my-2 flex gap-5">
|
|
42
|
-
{#each Array.from({ length: 3 }) as it, i (i)}
|
|
43
|
-
<Skeleton class="h-5 w-25 bg-black/50" />
|
|
44
|
-
{/each}
|
|
45
|
-
</div>
|
|
46
|
-
{/snippet}
|
|
47
|
-
|
|
48
|
-
{#snippet tagsRow()}
|
|
49
|
-
{#if isWrap}
|
|
50
|
-
<div class="flex flex-wrap gap-2 md:gap-5 {className}">
|
|
51
|
-
{#if isLoading}
|
|
52
|
-
{@render skeletonTag()}
|
|
53
|
-
{:else if tags && tags.length > 0}
|
|
54
|
-
{#each tags as tag, i (i)}
|
|
55
|
-
{@render createBadge(tag)}
|
|
56
|
-
{/each}
|
|
57
|
-
{/if}
|
|
58
|
-
</div>
|
|
59
|
-
{:else}
|
|
60
|
-
<div
|
|
61
|
-
class="flex overflow-x-auto no-scrollbar w-full min-w-0
|
|
62
|
-
{isJustify ? 'justify-between gap-3' : 'gap-4 md:gap-5 lg:gap-10'}
|
|
63
|
-
{className}"
|
|
64
|
-
>
|
|
65
|
-
{#if isLoading}
|
|
66
|
-
{@render skeletonTag()}
|
|
67
|
-
{:else if tags && tags.length > 0}
|
|
68
|
-
{#each tags as tag, i (i)}
|
|
69
|
-
{@render createBadge(tag)}
|
|
70
|
-
{/each}
|
|
71
|
-
{/if}
|
|
72
|
-
</div>
|
|
73
|
-
{/if}
|
|
74
|
-
{/snippet}
|
|
75
|
-
|
|
76
|
-
<Popover.Root bind:open>
|
|
77
|
-
<Popover.Trigger
|
|
78
|
-
onmouseenter={() => (open = true)}
|
|
79
|
-
onmouseleave={() => (open = false)}
|
|
80
|
-
class="block w-full text-left h-8"
|
|
81
|
-
>
|
|
82
|
-
{@render tagsRow()}
|
|
83
|
-
</Popover.Trigger>
|
|
84
|
-
<Popover.Content
|
|
85
|
-
class="w-auto max-w-xs p-3"
|
|
86
|
-
onmouseenter={() => (open = true)}
|
|
87
|
-
onmouseleave={() => (open = false)}
|
|
88
|
-
>
|
|
89
|
-
<div class="flex flex-col gap-2">
|
|
90
|
-
{#each tags as tag, i (i)}
|
|
91
|
-
{@render createBadge(tag, "gap-2")}
|
|
92
|
-
{/each}
|
|
93
|
-
</div>
|
|
94
|
-
</Popover.Content>
|
|
95
|
-
</Popover.Root>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
3
|
+
import type { CardTagsProps } from "../types";
|
|
4
|
+
import Skeleton from "../../../skeleton/skeleton.svelte";
|
|
5
|
+
import * as Popover from "../../../popover"; // adjust path to your setup
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
className?: string;
|
|
9
|
+
tags?: CardTagsProps[];
|
|
10
|
+
isTagBorderBottom?: boolean;
|
|
11
|
+
isWrap?: boolean;
|
|
12
|
+
isLoading?: boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
tags = [],
|
|
17
|
+
className,
|
|
18
|
+
isTagBorderBottom,
|
|
19
|
+
isWrap = false,
|
|
20
|
+
isLoading = false,
|
|
21
|
+
}: Props = $props();
|
|
22
|
+
|
|
23
|
+
let isJustify = $derived(tags?.length == 2 || tags?.length == 3);
|
|
24
|
+
let open = $state(false);
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
{#snippet createBadge(tag: CardTagsProps, clasName?: string)}
|
|
28
|
+
<div
|
|
29
|
+
class="flex items-center h-5 shrink-0 {isTagBorderBottom
|
|
30
|
+
? 'border border-gray-200 rounded-full px-2 py-1'
|
|
31
|
+
: ''} {clasName}"
|
|
32
|
+
>
|
|
33
|
+
{#if tag.icon}
|
|
34
|
+
<HugeiconsIcon icon={tag.icon} class="mr-0.5 h-3.75 w-3.75 shrink-0" />
|
|
35
|
+
{/if}
|
|
36
|
+
<div class="whitespace-nowrap">{tag.text}</div>
|
|
37
|
+
</div>
|
|
38
|
+
{/snippet}
|
|
39
|
+
|
|
40
|
+
{#snippet skeletonTag()}
|
|
41
|
+
<div class="my-2 flex gap-5">
|
|
42
|
+
{#each Array.from({ length: 3 }) as it, i (i)}
|
|
43
|
+
<Skeleton class="h-5 w-25 bg-black/50" />
|
|
44
|
+
{/each}
|
|
45
|
+
</div>
|
|
46
|
+
{/snippet}
|
|
47
|
+
|
|
48
|
+
{#snippet tagsRow()}
|
|
49
|
+
{#if isWrap}
|
|
50
|
+
<div class="flex flex-wrap gap-2 md:gap-5 {className}">
|
|
51
|
+
{#if isLoading}
|
|
52
|
+
{@render skeletonTag()}
|
|
53
|
+
{:else if tags && tags.length > 0}
|
|
54
|
+
{#each tags as tag, i (i)}
|
|
55
|
+
{@render createBadge(tag)}
|
|
56
|
+
{/each}
|
|
57
|
+
{/if}
|
|
58
|
+
</div>
|
|
59
|
+
{:else}
|
|
60
|
+
<div
|
|
61
|
+
class="flex overflow-x-auto no-scrollbar w-full min-w-0
|
|
62
|
+
{isJustify ? 'justify-between gap-3' : 'gap-4 md:gap-5 lg:gap-10'}
|
|
63
|
+
{className}"
|
|
64
|
+
>
|
|
65
|
+
{#if isLoading}
|
|
66
|
+
{@render skeletonTag()}
|
|
67
|
+
{:else if tags && tags.length > 0}
|
|
68
|
+
{#each tags as tag, i (i)}
|
|
69
|
+
{@render createBadge(tag)}
|
|
70
|
+
{/each}
|
|
71
|
+
{/if}
|
|
72
|
+
</div>
|
|
73
|
+
{/if}
|
|
74
|
+
{/snippet}
|
|
75
|
+
|
|
76
|
+
<Popover.Root bind:open>
|
|
77
|
+
<Popover.Trigger
|
|
78
|
+
onmouseenter={() => (open = true)}
|
|
79
|
+
onmouseleave={() => (open = false)}
|
|
80
|
+
class="block w-full text-left h-8"
|
|
81
|
+
>
|
|
82
|
+
{@render tagsRow()}
|
|
83
|
+
</Popover.Trigger>
|
|
84
|
+
<Popover.Content
|
|
85
|
+
class="w-auto max-w-xs p-3"
|
|
86
|
+
onmouseenter={() => (open = true)}
|
|
87
|
+
onmouseleave={() => (open = false)}
|
|
88
|
+
>
|
|
89
|
+
<div class="flex flex-col gap-2">
|
|
90
|
+
{#each tags as tag, i (i)}
|
|
91
|
+
{@render createBadge(tag, "gap-2")}
|
|
92
|
+
{/each}
|
|
93
|
+
</div>
|
|
94
|
+
</Popover.Content>
|
|
95
|
+
</Popover.Root>
|
|
@@ -1,232 +1,232 @@
|
|
|
1
|
-
<!-- CardMedia.svelte -->
|
|
2
|
-
<script lang="ts">
|
|
3
|
-
/**
|
|
4
|
-
* Image thumbnail with hover-to-play video, lazy loading,
|
|
5
|
-
* duration badge, video indicator, and optional maximize overlay.
|
|
6
|
-
* @component
|
|
7
|
-
*/
|
|
8
|
-
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
9
|
-
import {
|
|
10
|
-
Maximize01Icon,
|
|
11
|
-
Cancel01Icon,
|
|
12
|
-
VideoReplayIcon,
|
|
13
|
-
} from "@hugeicons/core-free-icons";
|
|
14
|
-
import Skeleton from "../../../skeleton/skeleton.svelte";
|
|
15
|
-
import ImgPlaceholder from "../../../../../assets/placeholder-image.png";
|
|
16
|
-
import VideoPlaceholder from "../../../../../assets/lonely-404.mp4";
|
|
17
|
-
|
|
18
|
-
type Props = {
|
|
19
|
-
imageUrl?: string;
|
|
20
|
-
videoUrl?: string;
|
|
21
|
-
class?: string;
|
|
22
|
-
isImageButtonMaximized?: boolean;
|
|
23
|
-
isVideoButtonMaximized?: boolean;
|
|
24
|
-
isLoading?: boolean;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
let {
|
|
28
|
-
imageUrl,
|
|
29
|
-
videoUrl,
|
|
30
|
-
class: className = "h-32 w-full md:h-64",
|
|
31
|
-
isImageButtonMaximized = false,
|
|
32
|
-
isVideoButtonMaximized = false,
|
|
33
|
-
isLoading = false,
|
|
34
|
-
}: Props = $props();
|
|
35
|
-
|
|
36
|
-
let containerEl: HTMLDivElement | undefined = $state();
|
|
37
|
-
let videoEl: HTMLVideoElement | undefined = $state();
|
|
38
|
-
|
|
39
|
-
let isHovering = $state(false);
|
|
40
|
-
let isVisible = $state(false);
|
|
41
|
-
let isMaximized = $state(false);
|
|
42
|
-
let duration = $state("");
|
|
43
|
-
|
|
44
|
-
let showVideo = $derived(!imageUrl || isHovering);
|
|
45
|
-
let showMaximize = $derived(
|
|
46
|
-
(imageUrl && isImageButtonMaximized) ||
|
|
47
|
-
(videoUrl && isVideoButtonMaximized),
|
|
48
|
-
);
|
|
49
|
-
let showVideoBadge = $derived(!!imageUrl && !!videoUrl && !isHovering);
|
|
50
|
-
|
|
51
|
-
function onLoadedMetadata() {
|
|
52
|
-
if (!videoEl) return;
|
|
53
|
-
const m = Math.floor(videoEl.duration / 60);
|
|
54
|
-
const s = Math.floor(videoEl.duration % 60);
|
|
55
|
-
duration = `${m}:${s.toString().padStart(2, "0")}`;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function toggleHover(state: boolean) {
|
|
59
|
-
if (!videoUrl) return;
|
|
60
|
-
isHovering = state;
|
|
61
|
-
if (state) videoEl?.play();
|
|
62
|
-
else {
|
|
63
|
-
videoEl?.pause();
|
|
64
|
-
if (imageUrl && videoEl) videoEl.currentTime = 0;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
$effect(() => {
|
|
69
|
-
if (!containerEl) return;
|
|
70
|
-
const observer = new IntersectionObserver(
|
|
71
|
-
([entry]) => {
|
|
72
|
-
if (entry.isIntersecting) {
|
|
73
|
-
isVisible = true;
|
|
74
|
-
observer.disconnect();
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
{ rootMargin: "100px" },
|
|
78
|
-
);
|
|
79
|
-
observer.observe(containerEl);
|
|
80
|
-
return () => observer.disconnect();
|
|
81
|
-
});
|
|
82
|
-
</script>
|
|
83
|
-
|
|
84
|
-
<svelte:window
|
|
85
|
-
onkeydown={isMaximized
|
|
86
|
-
? (e) => e.key === "Escape" && (isMaximized = false)
|
|
87
|
-
: undefined}
|
|
88
|
-
/>
|
|
89
|
-
|
|
90
|
-
{#snippet maximizeButton()}
|
|
91
|
-
<button
|
|
92
|
-
type="button"
|
|
93
|
-
class="absolute top-2 right-2 z-10 rounded-full bg-black/50 p-1.5 text-white transition-colors hover:bg-black/70"
|
|
94
|
-
onclick={(e) => {
|
|
95
|
-
e.stopPropagation();
|
|
96
|
-
isMaximized = true;
|
|
97
|
-
videoEl?.pause();
|
|
98
|
-
}}
|
|
99
|
-
aria-label="Maximizar"
|
|
100
|
-
>
|
|
101
|
-
<HugeiconsIcon
|
|
102
|
-
icon={Maximize01Icon}
|
|
103
|
-
size={16}
|
|
104
|
-
color="currentColor"
|
|
105
|
-
strokeWidth={1.5}
|
|
106
|
-
/>
|
|
107
|
-
</button>
|
|
108
|
-
{/snippet}
|
|
109
|
-
|
|
110
|
-
{#if isLoading}
|
|
111
|
-
<Skeleton class="w-full h-12.5 md:h-50 bg-gray-500/90" />
|
|
112
|
-
{:else}
|
|
113
|
-
{#if imageUrl || videoUrl}
|
|
114
|
-
<div
|
|
115
|
-
bind:this={containerEl}
|
|
116
|
-
class="relative w-full {className}"
|
|
117
|
-
role="button"
|
|
118
|
-
tabindex="0"
|
|
119
|
-
onmouseenter={() => toggleHover(true)}
|
|
120
|
-
onmouseleave={() => toggleHover(false)}
|
|
121
|
-
onfocus={() => toggleHover(true)}
|
|
122
|
-
onblur={() => toggleHover(false)}
|
|
123
|
-
onkeydown={(e) =>
|
|
124
|
-
(e.key === "Enter" || e.key === " ") &&
|
|
125
|
-
(e.preventDefault(), toggleHover(!isHovering))}
|
|
126
|
-
>
|
|
127
|
-
{#if imageUrl}
|
|
128
|
-
<img
|
|
129
|
-
src={isVisible ? imageUrl : undefined}
|
|
130
|
-
loading="lazy"
|
|
131
|
-
decoding="async"
|
|
132
|
-
alt={imageUrl}
|
|
133
|
-
class="absolute inset-0 h-full w-full rounded-md object-cover transition-opacity duration-500"
|
|
134
|
-
class:opacity-0={videoUrl && showVideo}
|
|
135
|
-
onerror={(e) => ((e.target as HTMLImageElement).src = ImgPlaceholder)}
|
|
136
|
-
/>
|
|
137
|
-
{/if}
|
|
138
|
-
|
|
139
|
-
{#if videoUrl && isVisible}
|
|
140
|
-
<video
|
|
141
|
-
bind:this={videoEl}
|
|
142
|
-
src={videoUrl}
|
|
143
|
-
preload="metadata"
|
|
144
|
-
onloadedmetadata={onLoadedMetadata}
|
|
145
|
-
class="absolute inset-0 h-full w-full rounded-md object-cover transition-opacity duration-500"
|
|
146
|
-
class:opacity-0={imageUrl && !showVideo}
|
|
147
|
-
muted
|
|
148
|
-
loop
|
|
149
|
-
playsinline
|
|
150
|
-
onerror={(e) =>
|
|
151
|
-
((e.target as HTMLImageElement).src = VideoPlaceholder)}
|
|
152
|
-
></video>
|
|
153
|
-
{/if}
|
|
154
|
-
|
|
155
|
-
{#if showVideoBadge}
|
|
156
|
-
<div
|
|
157
|
-
class="pointer-events-none absolute inset-0 flex items-center justify-center transition-opacity duration-300"
|
|
158
|
-
>
|
|
159
|
-
<div
|
|
160
|
-
class="flex h-11 w-11 items-center justify-center rounded-full bg-black/50 backdrop-blur-sm"
|
|
161
|
-
>
|
|
162
|
-
<HugeiconsIcon
|
|
163
|
-
icon={VideoReplayIcon}
|
|
164
|
-
size={22}
|
|
165
|
-
color="white"
|
|
166
|
-
strokeWidth={1.5}
|
|
167
|
-
/>
|
|
168
|
-
</div>
|
|
169
|
-
</div>
|
|
170
|
-
{#if duration}
|
|
171
|
-
<span
|
|
172
|
-
class="absolute bottom-2 right-2 z-10 rounded bg-black/60 px-1.5 py-0.5 text-xs font-medium text-white"
|
|
173
|
-
>
|
|
174
|
-
{duration}
|
|
175
|
-
</span>
|
|
176
|
-
{/if}
|
|
177
|
-
{/if}
|
|
178
|
-
|
|
179
|
-
{#if showMaximize}
|
|
180
|
-
{@render maximizeButton()}
|
|
181
|
-
{/if}
|
|
182
|
-
</div>
|
|
183
|
-
{/if}
|
|
184
|
-
|
|
185
|
-
{#if isMaximized}
|
|
186
|
-
<div class="fixed inset-0 z-50">
|
|
187
|
-
<button
|
|
188
|
-
type="button"
|
|
189
|
-
class="absolute inset-0 h-full w-full cursor-default bg-black/80"
|
|
190
|
-
onclick={() => (isMaximized = false)}
|
|
191
|
-
aria-label="Fechar modal"
|
|
192
|
-
></button>
|
|
193
|
-
|
|
194
|
-
<div
|
|
195
|
-
class="pointer-events-none fixed inset-0 z-50 flex items-center justify-center p-4"
|
|
196
|
-
>
|
|
197
|
-
<div class="pointer-events-auto relative max-h-[90vh] max-w-4xl">
|
|
198
|
-
<button
|
|
199
|
-
type="button"
|
|
200
|
-
class="absolute top-3 right-3 rounded-full bg-red-900/50 p-2 text-white hover:bg-black/70"
|
|
201
|
-
onclick={() => (isMaximized = false)}
|
|
202
|
-
aria-label="Fechar"
|
|
203
|
-
>
|
|
204
|
-
<HugeiconsIcon
|
|
205
|
-
icon={Cancel01Icon}
|
|
206
|
-
size={20}
|
|
207
|
-
color="currentColor"
|
|
208
|
-
strokeWidth={1.5}
|
|
209
|
-
/>
|
|
210
|
-
</button>
|
|
211
|
-
|
|
212
|
-
{#if videoUrl && showVideo}
|
|
213
|
-
<!-- svelte-ignore a11y_media_has_caption -->
|
|
214
|
-
<video
|
|
215
|
-
src={videoUrl}
|
|
216
|
-
class="max-h-[90vh] max-w-full rounded-md"
|
|
217
|
-
controls
|
|
218
|
-
autoplay
|
|
219
|
-
playsinline
|
|
220
|
-
></video>
|
|
221
|
-
{:else if imageUrl}
|
|
222
|
-
<img
|
|
223
|
-
src={imageUrl}
|
|
224
|
-
alt={imageUrl}
|
|
225
|
-
class="max-h-[90vh] max-w-full rounded-md object-contain"
|
|
226
|
-
/>
|
|
227
|
-
{/if}
|
|
228
|
-
</div>
|
|
229
|
-
</div>
|
|
230
|
-
</div>
|
|
231
|
-
{/if}
|
|
232
|
-
{/if}
|
|
1
|
+
<!-- CardMedia.svelte -->
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
/**
|
|
4
|
+
* Image thumbnail with hover-to-play video, lazy loading,
|
|
5
|
+
* duration badge, video indicator, and optional maximize overlay.
|
|
6
|
+
* @component
|
|
7
|
+
*/
|
|
8
|
+
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
9
|
+
import {
|
|
10
|
+
Maximize01Icon,
|
|
11
|
+
Cancel01Icon,
|
|
12
|
+
VideoReplayIcon,
|
|
13
|
+
} from "@hugeicons/core-free-icons";
|
|
14
|
+
import Skeleton from "../../../skeleton/skeleton.svelte";
|
|
15
|
+
import ImgPlaceholder from "../../../../../assets/placeholder-image.png";
|
|
16
|
+
import VideoPlaceholder from "../../../../../assets/lonely-404.mp4";
|
|
17
|
+
|
|
18
|
+
type Props = {
|
|
19
|
+
imageUrl?: string;
|
|
20
|
+
videoUrl?: string;
|
|
21
|
+
class?: string;
|
|
22
|
+
isImageButtonMaximized?: boolean;
|
|
23
|
+
isVideoButtonMaximized?: boolean;
|
|
24
|
+
isLoading?: boolean;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
let {
|
|
28
|
+
imageUrl,
|
|
29
|
+
videoUrl,
|
|
30
|
+
class: className = "h-32 w-full md:h-64",
|
|
31
|
+
isImageButtonMaximized = false,
|
|
32
|
+
isVideoButtonMaximized = false,
|
|
33
|
+
isLoading = false,
|
|
34
|
+
}: Props = $props();
|
|
35
|
+
|
|
36
|
+
let containerEl: HTMLDivElement | undefined = $state();
|
|
37
|
+
let videoEl: HTMLVideoElement | undefined = $state();
|
|
38
|
+
|
|
39
|
+
let isHovering = $state(false);
|
|
40
|
+
let isVisible = $state(false);
|
|
41
|
+
let isMaximized = $state(false);
|
|
42
|
+
let duration = $state("");
|
|
43
|
+
|
|
44
|
+
let showVideo = $derived(!imageUrl || isHovering);
|
|
45
|
+
let showMaximize = $derived(
|
|
46
|
+
(imageUrl && isImageButtonMaximized) ||
|
|
47
|
+
(videoUrl && isVideoButtonMaximized),
|
|
48
|
+
);
|
|
49
|
+
let showVideoBadge = $derived(!!imageUrl && !!videoUrl && !isHovering);
|
|
50
|
+
|
|
51
|
+
function onLoadedMetadata() {
|
|
52
|
+
if (!videoEl) return;
|
|
53
|
+
const m = Math.floor(videoEl.duration / 60);
|
|
54
|
+
const s = Math.floor(videoEl.duration % 60);
|
|
55
|
+
duration = `${m}:${s.toString().padStart(2, "0")}`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function toggleHover(state: boolean) {
|
|
59
|
+
if (!videoUrl) return;
|
|
60
|
+
isHovering = state;
|
|
61
|
+
if (state) videoEl?.play();
|
|
62
|
+
else {
|
|
63
|
+
videoEl?.pause();
|
|
64
|
+
if (imageUrl && videoEl) videoEl.currentTime = 0;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
$effect(() => {
|
|
69
|
+
if (!containerEl) return;
|
|
70
|
+
const observer = new IntersectionObserver(
|
|
71
|
+
([entry]) => {
|
|
72
|
+
if (entry.isIntersecting) {
|
|
73
|
+
isVisible = true;
|
|
74
|
+
observer.disconnect();
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{ rootMargin: "100px" },
|
|
78
|
+
);
|
|
79
|
+
observer.observe(containerEl);
|
|
80
|
+
return () => observer.disconnect();
|
|
81
|
+
});
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<svelte:window
|
|
85
|
+
onkeydown={isMaximized
|
|
86
|
+
? (e) => e.key === "Escape" && (isMaximized = false)
|
|
87
|
+
: undefined}
|
|
88
|
+
/>
|
|
89
|
+
|
|
90
|
+
{#snippet maximizeButton()}
|
|
91
|
+
<button
|
|
92
|
+
type="button"
|
|
93
|
+
class="absolute top-2 right-2 z-10 rounded-full bg-black/50 p-1.5 text-white transition-colors hover:bg-black/70"
|
|
94
|
+
onclick={(e) => {
|
|
95
|
+
e.stopPropagation();
|
|
96
|
+
isMaximized = true;
|
|
97
|
+
videoEl?.pause();
|
|
98
|
+
}}
|
|
99
|
+
aria-label="Maximizar"
|
|
100
|
+
>
|
|
101
|
+
<HugeiconsIcon
|
|
102
|
+
icon={Maximize01Icon}
|
|
103
|
+
size={16}
|
|
104
|
+
color="currentColor"
|
|
105
|
+
strokeWidth={1.5}
|
|
106
|
+
/>
|
|
107
|
+
</button>
|
|
108
|
+
{/snippet}
|
|
109
|
+
|
|
110
|
+
{#if isLoading}
|
|
111
|
+
<Skeleton class="w-full h-12.5 md:h-50 bg-gray-500/90" />
|
|
112
|
+
{:else}
|
|
113
|
+
{#if imageUrl || videoUrl}
|
|
114
|
+
<div
|
|
115
|
+
bind:this={containerEl}
|
|
116
|
+
class="relative w-full {className}"
|
|
117
|
+
role="button"
|
|
118
|
+
tabindex="0"
|
|
119
|
+
onmouseenter={() => toggleHover(true)}
|
|
120
|
+
onmouseleave={() => toggleHover(false)}
|
|
121
|
+
onfocus={() => toggleHover(true)}
|
|
122
|
+
onblur={() => toggleHover(false)}
|
|
123
|
+
onkeydown={(e) =>
|
|
124
|
+
(e.key === "Enter" || e.key === " ") &&
|
|
125
|
+
(e.preventDefault(), toggleHover(!isHovering))}
|
|
126
|
+
>
|
|
127
|
+
{#if imageUrl}
|
|
128
|
+
<img
|
|
129
|
+
src={isVisible ? imageUrl : undefined}
|
|
130
|
+
loading="lazy"
|
|
131
|
+
decoding="async"
|
|
132
|
+
alt={imageUrl}
|
|
133
|
+
class="absolute inset-0 h-full w-full rounded-md object-cover transition-opacity duration-500"
|
|
134
|
+
class:opacity-0={videoUrl && showVideo}
|
|
135
|
+
onerror={(e) => ((e.target as HTMLImageElement).src = ImgPlaceholder)}
|
|
136
|
+
/>
|
|
137
|
+
{/if}
|
|
138
|
+
|
|
139
|
+
{#if videoUrl && isVisible}
|
|
140
|
+
<video
|
|
141
|
+
bind:this={videoEl}
|
|
142
|
+
src={videoUrl}
|
|
143
|
+
preload="metadata"
|
|
144
|
+
onloadedmetadata={onLoadedMetadata}
|
|
145
|
+
class="absolute inset-0 h-full w-full rounded-md object-cover transition-opacity duration-500"
|
|
146
|
+
class:opacity-0={imageUrl && !showVideo}
|
|
147
|
+
muted
|
|
148
|
+
loop
|
|
149
|
+
playsinline
|
|
150
|
+
onerror={(e) =>
|
|
151
|
+
((e.target as HTMLImageElement).src = VideoPlaceholder)}
|
|
152
|
+
></video>
|
|
153
|
+
{/if}
|
|
154
|
+
|
|
155
|
+
{#if showVideoBadge}
|
|
156
|
+
<div
|
|
157
|
+
class="pointer-events-none absolute inset-0 flex items-center justify-center transition-opacity duration-300"
|
|
158
|
+
>
|
|
159
|
+
<div
|
|
160
|
+
class="flex h-11 w-11 items-center justify-center rounded-full bg-black/50 backdrop-blur-sm"
|
|
161
|
+
>
|
|
162
|
+
<HugeiconsIcon
|
|
163
|
+
icon={VideoReplayIcon}
|
|
164
|
+
size={22}
|
|
165
|
+
color="white"
|
|
166
|
+
strokeWidth={1.5}
|
|
167
|
+
/>
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
{#if duration}
|
|
171
|
+
<span
|
|
172
|
+
class="absolute bottom-2 right-2 z-10 rounded bg-black/60 px-1.5 py-0.5 text-xs font-medium text-white"
|
|
173
|
+
>
|
|
174
|
+
{duration}
|
|
175
|
+
</span>
|
|
176
|
+
{/if}
|
|
177
|
+
{/if}
|
|
178
|
+
|
|
179
|
+
{#if showMaximize}
|
|
180
|
+
{@render maximizeButton()}
|
|
181
|
+
{/if}
|
|
182
|
+
</div>
|
|
183
|
+
{/if}
|
|
184
|
+
|
|
185
|
+
{#if isMaximized}
|
|
186
|
+
<div class="fixed inset-0 z-50">
|
|
187
|
+
<button
|
|
188
|
+
type="button"
|
|
189
|
+
class="absolute inset-0 h-full w-full cursor-default bg-black/80"
|
|
190
|
+
onclick={() => (isMaximized = false)}
|
|
191
|
+
aria-label="Fechar modal"
|
|
192
|
+
></button>
|
|
193
|
+
|
|
194
|
+
<div
|
|
195
|
+
class="pointer-events-none fixed inset-0 z-50 flex items-center justify-center p-4"
|
|
196
|
+
>
|
|
197
|
+
<div class="pointer-events-auto relative max-h-[90vh] max-w-4xl">
|
|
198
|
+
<button
|
|
199
|
+
type="button"
|
|
200
|
+
class="absolute top-3 right-3 rounded-full bg-red-900/50 p-2 text-white hover:bg-black/70"
|
|
201
|
+
onclick={() => (isMaximized = false)}
|
|
202
|
+
aria-label="Fechar"
|
|
203
|
+
>
|
|
204
|
+
<HugeiconsIcon
|
|
205
|
+
icon={Cancel01Icon}
|
|
206
|
+
size={20}
|
|
207
|
+
color="currentColor"
|
|
208
|
+
strokeWidth={1.5}
|
|
209
|
+
/>
|
|
210
|
+
</button>
|
|
211
|
+
|
|
212
|
+
{#if videoUrl && showVideo}
|
|
213
|
+
<!-- svelte-ignore a11y_media_has_caption -->
|
|
214
|
+
<video
|
|
215
|
+
src={videoUrl}
|
|
216
|
+
class="max-h-[90vh] max-w-full rounded-md"
|
|
217
|
+
controls
|
|
218
|
+
autoplay
|
|
219
|
+
playsinline
|
|
220
|
+
></video>
|
|
221
|
+
{:else if imageUrl}
|
|
222
|
+
<img
|
|
223
|
+
src={imageUrl}
|
|
224
|
+
alt={imageUrl}
|
|
225
|
+
class="max-h-[90vh] max-w-full rounded-md object-contain"
|
|
226
|
+
/>
|
|
227
|
+
{/if}
|
|
228
|
+
</div>
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
{/if}
|
|
232
|
+
{/if}
|