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,20 +1,20 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { cn, type WithElementRef } from "../../../utils.js";
|
|
3
|
-
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
-
|
|
5
|
-
let {
|
|
6
|
-
ref = $bindable(null),
|
|
7
|
-
class: className,
|
|
8
|
-
children,
|
|
9
|
-
...restProps
|
|
10
|
-
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<div
|
|
14
|
-
bind:this={ref}
|
|
15
|
-
data-slot="empty"
|
|
16
|
-
class={cn("flex flex-col items-center justify-center text-center", className)}
|
|
17
|
-
{...restProps}
|
|
18
|
-
>
|
|
19
|
-
{@render children?.()}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from "../../../utils.js";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="empty"
|
|
16
|
+
class={cn("flex flex-col items-center justify-center text-center", className)}
|
|
17
|
+
{...restProps}
|
|
18
|
+
>
|
|
19
|
+
{@render children?.()}
|
|
20
20
|
</div>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import Footer01 from "./01/Footer01.svelte";
|
|
3
|
-
import Footer02 from "./02/Footer02.svelte";
|
|
4
|
-
import type { FooterProps } from "../types";
|
|
5
|
-
|
|
6
|
-
let {
|
|
7
|
-
variant = 1,
|
|
8
|
-
...restProps
|
|
9
|
-
}: FooterProps & {
|
|
10
|
-
variant?: 1 | 2;
|
|
11
|
-
} = $props();
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
{#if variant === 2}
|
|
15
|
-
<Footer02 {...restProps} />
|
|
16
|
-
{:else}
|
|
17
|
-
<Footer01 {...restProps} />
|
|
18
|
-
{/if}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Footer01 from "./01/Footer01.svelte";
|
|
3
|
+
import Footer02 from "./02/Footer02.svelte";
|
|
4
|
+
import type { FooterProps } from "../types";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
variant = 1,
|
|
8
|
+
...restProps
|
|
9
|
+
}: FooterProps & {
|
|
10
|
+
variant?: 1 | 2;
|
|
11
|
+
} = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
{#if variant === 2}
|
|
15
|
+
<Footer02 {...restProps} />
|
|
16
|
+
{:else}
|
|
17
|
+
<Footer01 {...restProps} />
|
|
18
|
+
{/if}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Mail01Icon, LockPasswordIcon, Search01Icon, SmartPhone01Icon, File01Icon, Url, } from "@hugeicons/core-free-icons";
|
|
1
|
+
import { Mail01Icon, LockPasswordIcon, Search01Icon, SmartPhone01Icon, File01Icon, Calendar01Icon, Url, } from "@hugeicons/core-free-icons";
|
|
2
2
|
export const inputIconMap = {
|
|
3
3
|
email: Mail01Icon,
|
|
4
4
|
password: LockPasswordIcon,
|
|
@@ -6,4 +6,5 @@ export const inputIconMap = {
|
|
|
6
6
|
tel: SmartPhone01Icon,
|
|
7
7
|
url: Url,
|
|
8
8
|
file: File01Icon,
|
|
9
|
+
date: Calendar01Icon,
|
|
9
10
|
};
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { locale } from "../../../../../i18n";
|
|
3
|
+
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
4
|
+
import { ChevronLeftIcon, ChevronRightIcon } from "@hugeicons/core-free-icons";
|
|
5
|
+
import { cn } from "../../../../../utils.js";
|
|
6
|
+
import MonthSelect from "./MonthSelect.svelte";
|
|
7
|
+
import YearSelect from "./YearSelect.svelte";
|
|
8
|
+
import DaysGrid from "./DaysGrid.svelte";
|
|
9
|
+
import {
|
|
10
|
+
currentToday,
|
|
11
|
+
getMonthNames,
|
|
12
|
+
getWeekdays,
|
|
13
|
+
filterYears,
|
|
14
|
+
buildWeeks,
|
|
15
|
+
parseCommittedYear,
|
|
16
|
+
} from "./utils.js";
|
|
17
|
+
|
|
18
|
+
type Props = {
|
|
19
|
+
value?: Date;
|
|
20
|
+
rangeStart?: Date;
|
|
21
|
+
rangeEnd?: Date;
|
|
22
|
+
min?: Date;
|
|
23
|
+
max?: Date;
|
|
24
|
+
month?: number;
|
|
25
|
+
year?: number;
|
|
26
|
+
locale?: string;
|
|
27
|
+
onselect?: (date: Date) => void;
|
|
28
|
+
class?: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
let {
|
|
32
|
+
value,
|
|
33
|
+
rangeStart,
|
|
34
|
+
rangeEnd,
|
|
35
|
+
min,
|
|
36
|
+
max,
|
|
37
|
+
month: monthProp,
|
|
38
|
+
year: yearProp,
|
|
39
|
+
locale: propLocale,
|
|
40
|
+
onselect,
|
|
41
|
+
class: className,
|
|
42
|
+
}: Props = $props();
|
|
43
|
+
|
|
44
|
+
const localeValue = $derived(
|
|
45
|
+
propLocale ?? ($locale === "pt" ? "pt-PT" : "en-US"),
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const today = currentToday();
|
|
49
|
+
|
|
50
|
+
// svelte-ignore state_referenced_locally
|
|
51
|
+
let currentYear = $state(yearProp ?? today.year);
|
|
52
|
+
// svelte-ignore state_referenced_locally
|
|
53
|
+
let currentMonth = $state(monthProp ?? today.month);
|
|
54
|
+
|
|
55
|
+
$effect(() => {
|
|
56
|
+
if (monthProp !== undefined) currentMonth = monthProp;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
$effect(() => {
|
|
60
|
+
if (yearProp !== undefined) currentYear = yearProp;
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
let showMonthPicker = $state(false);
|
|
64
|
+
let showYearPicker = $state(false);
|
|
65
|
+
let yearQuery = $state(String(today.year));
|
|
66
|
+
|
|
67
|
+
const monthNames = $derived(getMonthNames(localeValue));
|
|
68
|
+
const weekdays = $derived(getWeekdays(localeValue));
|
|
69
|
+
const weeks = $derived(buildWeeks(currentYear, currentMonth));
|
|
70
|
+
const filteredYears = $derived(
|
|
71
|
+
filterYears(yearQuery, currentYear, today.year),
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
function prevMonth() {
|
|
75
|
+
if (currentMonth === 0) {
|
|
76
|
+
currentYear -= 1;
|
|
77
|
+
currentMonth = 11;
|
|
78
|
+
} else {
|
|
79
|
+
currentMonth -= 1;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function nextMonth() {
|
|
84
|
+
if (currentMonth === 11) {
|
|
85
|
+
currentYear += 1;
|
|
86
|
+
currentMonth = 0;
|
|
87
|
+
} else {
|
|
88
|
+
currentMonth += 1;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function selectMonth(m: number) {
|
|
93
|
+
currentMonth = m;
|
|
94
|
+
showMonthPicker = false;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function selectYear(y: number) {
|
|
98
|
+
currentYear = y;
|
|
99
|
+
showYearPicker = false;
|
|
100
|
+
yearQuery = String(y);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function toggleMonthPicker() {
|
|
104
|
+
showYearPicker = false;
|
|
105
|
+
showMonthPicker = !showMonthPicker;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function toggleYearPicker() {
|
|
109
|
+
showMonthPicker = false;
|
|
110
|
+
const next = !showYearPicker;
|
|
111
|
+
showYearPicker = next;
|
|
112
|
+
if (next) {
|
|
113
|
+
yearQuery = String(currentYear);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function handleYearInput() {
|
|
118
|
+
showMonthPicker = false;
|
|
119
|
+
showYearPicker = true;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function commitYear() {
|
|
123
|
+
const parsed = parseCommittedYear(yearQuery, today.year);
|
|
124
|
+
if (parsed !== null) {
|
|
125
|
+
selectYear(parsed);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function cancelYear() {
|
|
130
|
+
showYearPicker = false;
|
|
131
|
+
yearQuery = String(currentYear);
|
|
132
|
+
}
|
|
133
|
+
</script>
|
|
134
|
+
|
|
135
|
+
<div class={cn("flex w-72 flex-col gap-1 p-2 select-none", className)}>
|
|
136
|
+
<div class="mb-1 flex items-center gap-1">
|
|
137
|
+
<button
|
|
138
|
+
type="button"
|
|
139
|
+
aria-label="previous-month"
|
|
140
|
+
class="rounded p-1.5 transition-colors hover:bg-muted"
|
|
141
|
+
onclick={prevMonth}
|
|
142
|
+
>
|
|
143
|
+
<HugeiconsIcon icon={ChevronLeftIcon} size={16} strokeWidth={1.5} />
|
|
144
|
+
</button>
|
|
145
|
+
|
|
146
|
+
<div class="relative flex-1">
|
|
147
|
+
<MonthSelect
|
|
148
|
+
months={monthNames}
|
|
149
|
+
month={currentMonth}
|
|
150
|
+
open={showMonthPicker}
|
|
151
|
+
onToggle={toggleMonthPicker}
|
|
152
|
+
onSelect={selectMonth}
|
|
153
|
+
/>
|
|
154
|
+
</div>
|
|
155
|
+
|
|
156
|
+
<div class="relative flex-1">
|
|
157
|
+
<YearSelect
|
|
158
|
+
years={filteredYears}
|
|
159
|
+
year={currentYear}
|
|
160
|
+
query={yearQuery}
|
|
161
|
+
open={showYearPicker}
|
|
162
|
+
onQueryChange={(q) => (yearQuery = q)}
|
|
163
|
+
onFocus={handleYearInput}
|
|
164
|
+
onToggle={toggleYearPicker}
|
|
165
|
+
onCommit={commitYear}
|
|
166
|
+
onCancel={cancelYear}
|
|
167
|
+
onSelect={selectYear}
|
|
168
|
+
/>
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
<button
|
|
172
|
+
type="button"
|
|
173
|
+
aria-label="next-month"
|
|
174
|
+
class="rounded p-1.5 transition-colors hover:bg-muted"
|
|
175
|
+
onclick={nextMonth}
|
|
176
|
+
>
|
|
177
|
+
<HugeiconsIcon icon={ChevronRightIcon} size={16} strokeWidth={1.5} />
|
|
178
|
+
</button>
|
|
179
|
+
</div>
|
|
180
|
+
|
|
181
|
+
<DaysGrid
|
|
182
|
+
year={currentYear}
|
|
183
|
+
month={currentMonth}
|
|
184
|
+
weeks={weeks}
|
|
185
|
+
weekdays={weekdays}
|
|
186
|
+
today={today}
|
|
187
|
+
{value}
|
|
188
|
+
{rangeStart}
|
|
189
|
+
{rangeEnd}
|
|
190
|
+
{min}
|
|
191
|
+
{max}
|
|
192
|
+
{onselect}
|
|
193
|
+
/>
|
|
194
|
+
</div>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
value?: Date;
|
|
3
|
+
rangeStart?: Date;
|
|
4
|
+
rangeEnd?: Date;
|
|
5
|
+
min?: Date;
|
|
6
|
+
max?: Date;
|
|
7
|
+
month?: number;
|
|
8
|
+
year?: number;
|
|
9
|
+
locale?: string;
|
|
10
|
+
onselect?: (date: Date) => void;
|
|
11
|
+
class?: string;
|
|
12
|
+
};
|
|
13
|
+
declare const Calendar: import("svelte").Component<Props, {}, "">;
|
|
14
|
+
type Calendar = ReturnType<typeof Calendar>;
|
|
15
|
+
export default Calendar;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { IconSvgElement } from "@hugeicons/svelte";
|
|
3
|
+
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
4
|
+
import { Calendar01Icon } from "@hugeicons/core-free-icons";
|
|
5
|
+
import type { Snippet } from "svelte";
|
|
6
|
+
import { Popover, PopoverTrigger, PopoverContent } from "../../../popover";
|
|
7
|
+
import Calendar from "./Calendar.svelte";
|
|
8
|
+
import { cn } from "../../../../../utils.js";
|
|
9
|
+
|
|
10
|
+
type Props = {
|
|
11
|
+
open?: boolean;
|
|
12
|
+
value?: Date;
|
|
13
|
+
rangeStart?: Date;
|
|
14
|
+
rangeEnd?: Date;
|
|
15
|
+
min?: Date;
|
|
16
|
+
max?: Date;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
isIcon?: boolean;
|
|
19
|
+
icon?: IconSvgElement;
|
|
20
|
+
inputClass?: string;
|
|
21
|
+
onselect?: (date: Date) => void;
|
|
22
|
+
children?: Snippet;
|
|
23
|
+
content?: Snippet;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
let {
|
|
27
|
+
open = $bindable(false),
|
|
28
|
+
value,
|
|
29
|
+
rangeStart,
|
|
30
|
+
rangeEnd,
|
|
31
|
+
min,
|
|
32
|
+
max,
|
|
33
|
+
disabled = false,
|
|
34
|
+
isIcon = true,
|
|
35
|
+
icon = Calendar01Icon,
|
|
36
|
+
inputClass,
|
|
37
|
+
onselect,
|
|
38
|
+
children,
|
|
39
|
+
content,
|
|
40
|
+
}: Props = $props();
|
|
41
|
+
|
|
42
|
+
const triggerClass = $derived(
|
|
43
|
+
cn(
|
|
44
|
+
"h-9 w-full min-w-0 rounded-md border bg-transparent py-1 text-base shadow-xs",
|
|
45
|
+
"transition-colors outline-none md:text-sm cursor-pointer",
|
|
46
|
+
"border-input dark:bg-input/30 text-foreground",
|
|
47
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3",
|
|
48
|
+
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
49
|
+
"flex items-center text-left",
|
|
50
|
+
isIcon ? "pl-9" : "pl-2.5",
|
|
51
|
+
"pr-9",
|
|
52
|
+
inputClass,
|
|
53
|
+
),
|
|
54
|
+
);
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<Popover bind:open>
|
|
58
|
+
{#if isIcon}
|
|
59
|
+
<span
|
|
60
|
+
class="absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none text-slate-400"
|
|
61
|
+
>
|
|
62
|
+
<HugeiconsIcon icon={icon} size={16} strokeWidth={1.5} />
|
|
63
|
+
</span>
|
|
64
|
+
{/if}
|
|
65
|
+
|
|
66
|
+
<PopoverTrigger class={triggerClass} {disabled}>
|
|
67
|
+
{@render children?.()}
|
|
68
|
+
</PopoverTrigger>
|
|
69
|
+
|
|
70
|
+
<span
|
|
71
|
+
class="absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-slate-400"
|
|
72
|
+
>
|
|
73
|
+
<HugeiconsIcon icon={Calendar01Icon} size={16} strokeWidth={1.5} />
|
|
74
|
+
</span>
|
|
75
|
+
|
|
76
|
+
<PopoverContent align="start" side="bottom" class="w-auto p-0">
|
|
77
|
+
{#if content}
|
|
78
|
+
{@render content()}
|
|
79
|
+
{:else}
|
|
80
|
+
<Calendar
|
|
81
|
+
{value}
|
|
82
|
+
{rangeStart}
|
|
83
|
+
{rangeEnd}
|
|
84
|
+
{min}
|
|
85
|
+
{max}
|
|
86
|
+
{onselect}
|
|
87
|
+
/>
|
|
88
|
+
{/if}
|
|
89
|
+
</PopoverContent>
|
|
90
|
+
</Popover>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { IconSvgElement } from "@hugeicons/svelte";
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
type Props = {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
value?: Date;
|
|
6
|
+
rangeStart?: Date;
|
|
7
|
+
rangeEnd?: Date;
|
|
8
|
+
min?: Date;
|
|
9
|
+
max?: Date;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
isIcon?: boolean;
|
|
12
|
+
icon?: IconSvgElement;
|
|
13
|
+
inputClass?: string;
|
|
14
|
+
onselect?: (date: Date) => void;
|
|
15
|
+
children?: Snippet;
|
|
16
|
+
content?: Snippet;
|
|
17
|
+
};
|
|
18
|
+
declare const CalendarCard: import("svelte").Component<Props, {}, "open">;
|
|
19
|
+
type CalendarCard = ReturnType<typeof CalendarCard>;
|
|
20
|
+
export default CalendarCard;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from "../../../../../utils.js";
|
|
3
|
+
import {
|
|
4
|
+
isToday,
|
|
5
|
+
isSelected,
|
|
6
|
+
isInRange,
|
|
7
|
+
isOutsideMonth,
|
|
8
|
+
isDisabled,
|
|
9
|
+
type CalendarToday,
|
|
10
|
+
} from "./utils.js";
|
|
11
|
+
|
|
12
|
+
type Props = {
|
|
13
|
+
year: number;
|
|
14
|
+
month: number;
|
|
15
|
+
weeks: Date[][];
|
|
16
|
+
weekdays: string[];
|
|
17
|
+
today: CalendarToday;
|
|
18
|
+
value?: Date;
|
|
19
|
+
rangeStart?: Date;
|
|
20
|
+
rangeEnd?: Date;
|
|
21
|
+
min?: Date;
|
|
22
|
+
max?: Date;
|
|
23
|
+
onselect?: (date: Date) => void;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
let {
|
|
27
|
+
year,
|
|
28
|
+
month,
|
|
29
|
+
weeks,
|
|
30
|
+
weekdays,
|
|
31
|
+
today,
|
|
32
|
+
value,
|
|
33
|
+
rangeStart,
|
|
34
|
+
rangeEnd,
|
|
35
|
+
min,
|
|
36
|
+
max,
|
|
37
|
+
onselect,
|
|
38
|
+
}: Props = $props();
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<div class="grid grid-cols-7">
|
|
42
|
+
{#each weekdays as day, i (i)}
|
|
43
|
+
<div class="py-1 text-center text-xs font-medium text-muted-foreground">
|
|
44
|
+
{day}
|
|
45
|
+
</div>
|
|
46
|
+
{/each}
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div class="grid grid-cols-7 gap-y-0.5">
|
|
50
|
+
{#each weeks as week, wi (wi)}
|
|
51
|
+
{#each week as day, di (`${wi}-${di}`)}
|
|
52
|
+
{@const outside = isOutsideMonth(day, year, month)}
|
|
53
|
+
{@const disabled = isDisabled(day, min, max)}
|
|
54
|
+
{@const today_ = isToday(day, today)}
|
|
55
|
+
{@const selected = isSelected(day, { value, rangeStart, rangeEnd })}
|
|
56
|
+
{@const inRange = isInRange(day, rangeStart, rangeEnd)}
|
|
57
|
+
<button
|
|
58
|
+
type="button"
|
|
59
|
+
{disabled}
|
|
60
|
+
class={cn(
|
|
61
|
+
"flex h-8 w-full items-center justify-center rounded-md text-sm transition-colors",
|
|
62
|
+
"hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
63
|
+
outside && "text-muted-foreground/40",
|
|
64
|
+
!outside && !disabled && !selected && !inRange && "text-foreground",
|
|
65
|
+
disabled && "cursor-not-allowed opacity-30",
|
|
66
|
+
today_ && !selected && "ring-1 ring-ring",
|
|
67
|
+
inRange && !selected && "bg-primary/20 text-primary font-medium",
|
|
68
|
+
selected && "bg-primary text-primary-foreground",
|
|
69
|
+
)}
|
|
70
|
+
onclick={() => onselect?.(day)}
|
|
71
|
+
>
|
|
72
|
+
{day.getDate()}
|
|
73
|
+
</button>
|
|
74
|
+
{/each}
|
|
75
|
+
{/each}
|
|
76
|
+
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type CalendarToday } from "./utils.ts";
|
|
2
|
+
type Props = {
|
|
3
|
+
year: number;
|
|
4
|
+
month: number;
|
|
5
|
+
weeks: Date[][];
|
|
6
|
+
weekdays: string[];
|
|
7
|
+
today: CalendarToday;
|
|
8
|
+
value?: Date;
|
|
9
|
+
rangeStart?: Date;
|
|
10
|
+
rangeEnd?: Date;
|
|
11
|
+
min?: Date;
|
|
12
|
+
max?: Date;
|
|
13
|
+
onselect?: (date: Date) => void;
|
|
14
|
+
};
|
|
15
|
+
declare const DaysGrid: import("svelte").Component<Props, {}, "">;
|
|
16
|
+
type DaysGrid = ReturnType<typeof DaysGrid>;
|
|
17
|
+
export default DaysGrid;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
3
|
+
import { ChevronDownIcon } from "@hugeicons/core-free-icons";
|
|
4
|
+
import { cn } from "../../../../../utils.js";
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
months: string[];
|
|
8
|
+
month: number;
|
|
9
|
+
open: boolean;
|
|
10
|
+
onToggle: () => void;
|
|
11
|
+
onSelect: (month: number) => void;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
let { months, month, open, onToggle, onSelect }: Props = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<button
|
|
18
|
+
type="button"
|
|
19
|
+
data-month-picker
|
|
20
|
+
class="flex h-8 w-full items-center justify-between gap-1 rounded px-2 text-sm font-medium capitalize transition-colors hover:bg-muted"
|
|
21
|
+
onclick={onToggle}
|
|
22
|
+
>
|
|
23
|
+
<span>{months[month]}</span>
|
|
24
|
+
<HugeiconsIcon icon={ChevronDownIcon} size={14} strokeWidth={1.5} />
|
|
25
|
+
</button>
|
|
26
|
+
|
|
27
|
+
{#if open}
|
|
28
|
+
<div
|
|
29
|
+
role="listbox"
|
|
30
|
+
aria-label="select-month"
|
|
31
|
+
tabindex="-1"
|
|
32
|
+
class="absolute left-0 right-0 top-full z-10 mt-1 grid max-h-48 grid-cols-1 gap-0.5 overflow-y-auto rounded-md border bg-popover p-1 shadow-md"
|
|
33
|
+
onmousedown={(e) => e.preventDefault()}
|
|
34
|
+
>
|
|
35
|
+
{#each months as name, i (i)}
|
|
36
|
+
<button
|
|
37
|
+
type="button"
|
|
38
|
+
class={cn(
|
|
39
|
+
"rounded px-1 py-1 text-xs capitalize transition-colors hover:bg-muted",
|
|
40
|
+
i === month
|
|
41
|
+
? "bg-primary font-medium text-primary-foreground"
|
|
42
|
+
: "text-foreground",
|
|
43
|
+
)}
|
|
44
|
+
onclick={() => onSelect(i)}
|
|
45
|
+
>
|
|
46
|
+
{name}
|
|
47
|
+
</button>
|
|
48
|
+
{/each}
|
|
49
|
+
</div>
|
|
50
|
+
{/if}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
months: string[];
|
|
3
|
+
month: number;
|
|
4
|
+
open: boolean;
|
|
5
|
+
onToggle: () => void;
|
|
6
|
+
onSelect: (month: number) => void;
|
|
7
|
+
};
|
|
8
|
+
declare const MonthSelect: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type MonthSelect = ReturnType<typeof MonthSelect>;
|
|
10
|
+
export default MonthSelect;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
3
|
+
import { ChevronDownIcon } from "@hugeicons/core-free-icons";
|
|
4
|
+
import { cn } from "../../../../../utils.js";
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
years: number[];
|
|
8
|
+
year: number;
|
|
9
|
+
query: string;
|
|
10
|
+
open: boolean;
|
|
11
|
+
onQueryChange: (query: string) => void;
|
|
12
|
+
onFocus: () => void;
|
|
13
|
+
onToggle: () => void;
|
|
14
|
+
onCommit: () => void;
|
|
15
|
+
onCancel: () => void;
|
|
16
|
+
onSelect: (year: number) => void;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
let {
|
|
20
|
+
years,
|
|
21
|
+
year,
|
|
22
|
+
query,
|
|
23
|
+
open,
|
|
24
|
+
onQueryChange,
|
|
25
|
+
onFocus,
|
|
26
|
+
onToggle,
|
|
27
|
+
onCommit,
|
|
28
|
+
onCancel,
|
|
29
|
+
onSelect,
|
|
30
|
+
}: Props = $props();
|
|
31
|
+
|
|
32
|
+
let yearListRef = $state<HTMLDivElement | null>(null);
|
|
33
|
+
let yearInputRef = $state<HTMLInputElement | null>(null);
|
|
34
|
+
|
|
35
|
+
function commitYear() {
|
|
36
|
+
onCommit();
|
|
37
|
+
yearInputRef?.blur();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function handleKeydown(e: KeyboardEvent) {
|
|
41
|
+
if (e.key === "Enter") {
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
commitYear();
|
|
44
|
+
} else if (e.key === "Escape") {
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
onCancel();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
$effect(() => {
|
|
51
|
+
if (!open) return;
|
|
52
|
+
const el = yearListRef;
|
|
53
|
+
const selected = el?.querySelector<HTMLElement>(
|
|
54
|
+
`[data-year="${year}"]`,
|
|
55
|
+
);
|
|
56
|
+
selected?.scrollIntoView({ block: "nearest" });
|
|
57
|
+
});
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<div class="flex h-8 items-center rounded px-1">
|
|
61
|
+
<input
|
|
62
|
+
bind:this={yearInputRef}
|
|
63
|
+
type="text"
|
|
64
|
+
inputmode="numeric"
|
|
65
|
+
pattern="[0-9]*"
|
|
66
|
+
bind:value={query}
|
|
67
|
+
onfocus={onFocus}
|
|
68
|
+
oninput={onFocus}
|
|
69
|
+
onkeydown={handleKeydown}
|
|
70
|
+
onblur={() => {
|
|
71
|
+
if (!open) {
|
|
72
|
+
onCancel();
|
|
73
|
+
}
|
|
74
|
+
}}
|
|
75
|
+
class="w-full min-w-0 rounded-md border border-transparent bg-transparent px-1 py-1 text-center text-sm font-medium outline-none transition-colors focus:border-ring focus:ring-2 focus:ring-ring/50"
|
|
76
|
+
/>
|
|
77
|
+
<button
|
|
78
|
+
type="button"
|
|
79
|
+
class="rounded p-0.5 transition-colors hover:bg-muted"
|
|
80
|
+
onclick={onToggle}
|
|
81
|
+
>
|
|
82
|
+
<HugeiconsIcon icon={ChevronDownIcon} size={14} strokeWidth={1.5} />
|
|
83
|
+
</button>
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
{#if open}
|
|
87
|
+
<div
|
|
88
|
+
bind:this={yearListRef}
|
|
89
|
+
role="listbox"
|
|
90
|
+
aria-label="select-year"
|
|
91
|
+
tabindex="-1"
|
|
92
|
+
class="absolute left-0 right-0 top-full z-10 mt-1 max-h-56 overflow-y-auto rounded-md border bg-popover p-1 shadow-md"
|
|
93
|
+
onmousedown={(e) => e.preventDefault()}
|
|
94
|
+
>
|
|
95
|
+
{#if years.length === 0}
|
|
96
|
+
<div class="px-2 py-1 text-center text-xs text-muted-foreground">
|
|
97
|
+
{query}
|
|
98
|
+
</div>
|
|
99
|
+
{:else}
|
|
100
|
+
{#each years as yearItem, i (yearItem)}
|
|
101
|
+
<button
|
|
102
|
+
type="button"
|
|
103
|
+
data-year={yearItem}
|
|
104
|
+
class={cn(
|
|
105
|
+
"block w-full rounded px-2 py-1 text-left text-sm transition-colors hover:bg-muted",
|
|
106
|
+
yearItem === year
|
|
107
|
+
? "bg-primary font-medium text-primary-foreground hover:bg-primary"
|
|
108
|
+
: "text-foreground",
|
|
109
|
+
)}
|
|
110
|
+
onclick={() => onSelect(yearItem)}
|
|
111
|
+
>
|
|
112
|
+
{yearItem}
|
|
113
|
+
</button>
|
|
114
|
+
{/each}
|
|
115
|
+
{/if}
|
|
116
|
+
</div>
|
|
117
|
+
{/if}
|