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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
years: number[];
|
|
3
|
+
year: number;
|
|
4
|
+
query: string;
|
|
5
|
+
open: boolean;
|
|
6
|
+
onQueryChange: (query: string) => void;
|
|
7
|
+
onFocus: () => void;
|
|
8
|
+
onToggle: () => void;
|
|
9
|
+
onCommit: () => void;
|
|
10
|
+
onCancel: () => void;
|
|
11
|
+
onSelect: (year: number) => void;
|
|
12
|
+
};
|
|
13
|
+
declare const YearSelect: import("svelte").Component<Props, {}, "">;
|
|
14
|
+
type YearSelect = ReturnType<typeof YearSelect>;
|
|
15
|
+
export default YearSelect;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as Calendar } from "./Calendar.svelte";
|
|
2
|
+
export { default as CalendarCard } from "./CalendarCard.svelte";
|
|
3
|
+
export { default as MonthSelect } from "./MonthSelect.svelte";
|
|
4
|
+
export { default as YearSelect } from "./YearSelect.svelte";
|
|
5
|
+
export { default as DaysGrid } from "./DaysGrid.svelte";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as Calendar } from "./Calendar.svelte";
|
|
2
|
+
export { default as CalendarCard } from "./CalendarCard.svelte";
|
|
3
|
+
export { default as MonthSelect } from "./MonthSelect.svelte";
|
|
4
|
+
export { default as YearSelect } from "./YearSelect.svelte";
|
|
5
|
+
export { default as DaysGrid } from "./DaysGrid.svelte";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const YEARS_RANGE = 100;
|
|
2
|
+
export interface CalendarToday {
|
|
3
|
+
year: number;
|
|
4
|
+
month: number;
|
|
5
|
+
day: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function currentToday(): CalendarToday;
|
|
8
|
+
export declare function getMonthNames(locale: string): string[];
|
|
9
|
+
export declare function getWeekdays(locale: string): string[];
|
|
10
|
+
export declare function allYears(todayYear: number): number[];
|
|
11
|
+
export declare function filterYears(query: string, currentYear: number, todayYear: number): number[];
|
|
12
|
+
export declare function parseCommittedYear(query: string, todayYear: number): number | null;
|
|
13
|
+
export declare function startOfMonth(year: number, month: number): Date;
|
|
14
|
+
export declare function addDays(date: Date, n: number): Date;
|
|
15
|
+
export declare function isSameDay(a: Date, b: Date): boolean;
|
|
16
|
+
export declare function isBeforeDay(a: Date, b: Date): boolean;
|
|
17
|
+
export declare function buildWeeks(year: number, month: number): Date[][];
|
|
18
|
+
export declare function isToday(d: Date, today: CalendarToday): boolean;
|
|
19
|
+
export declare function isOutsideMonth(d: Date, year: number, month: number): boolean;
|
|
20
|
+
export declare function isSelected(d: Date, opts: {
|
|
21
|
+
value?: Date;
|
|
22
|
+
rangeStart?: Date;
|
|
23
|
+
rangeEnd?: Date;
|
|
24
|
+
}): boolean;
|
|
25
|
+
export declare function isInRange(d: Date, rangeStart?: Date, rangeEnd?: Date): boolean;
|
|
26
|
+
export declare function isDisabled(d: Date, min?: Date, max?: Date): boolean;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export const YEARS_RANGE = 100;
|
|
2
|
+
export function currentToday() {
|
|
3
|
+
const now = new Date();
|
|
4
|
+
return { year: now.getFullYear(), month: now.getMonth(), day: now.getDate() };
|
|
5
|
+
}
|
|
6
|
+
export function getMonthNames(locale) {
|
|
7
|
+
return Array.from({ length: 12 }, (_, i) => new Intl.DateTimeFormat(locale, { month: "long" }).format(new Date(2025, i, 1)));
|
|
8
|
+
}
|
|
9
|
+
export function getWeekdays(locale) {
|
|
10
|
+
return Array.from({ length: 7 }, (_, i) => {
|
|
11
|
+
const d = new Date(2025, 0, 5 + i);
|
|
12
|
+
return new Intl.DateTimeFormat(locale, { weekday: "short" }).format(d);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export function allYears(todayYear) {
|
|
16
|
+
return Array.from({ length: YEARS_RANGE + 1 }, (_, i) => todayYear - i);
|
|
17
|
+
}
|
|
18
|
+
export function filterYears(query, currentYear, todayYear) {
|
|
19
|
+
const q = query.trim();
|
|
20
|
+
if (!q || q === String(currentYear))
|
|
21
|
+
return allYears(todayYear);
|
|
22
|
+
return allYears(todayYear).filter((y) => String(y).startsWith(q));
|
|
23
|
+
}
|
|
24
|
+
export function parseCommittedYear(query, todayYear) {
|
|
25
|
+
const parsed = Number.parseInt(query.trim(), 10);
|
|
26
|
+
if (Number.isNaN(parsed))
|
|
27
|
+
return null;
|
|
28
|
+
return Math.min(todayYear, Math.max(todayYear - YEARS_RANGE, parsed));
|
|
29
|
+
}
|
|
30
|
+
export function startOfMonth(year, month) {
|
|
31
|
+
return new Date(year, month, 1);
|
|
32
|
+
}
|
|
33
|
+
export function addDays(date, n) {
|
|
34
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate() + n);
|
|
35
|
+
}
|
|
36
|
+
export function isSameDay(a, b) {
|
|
37
|
+
return (a.getFullYear() === b.getFullYear() &&
|
|
38
|
+
a.getMonth() === b.getMonth() &&
|
|
39
|
+
a.getDate() === b.getDate());
|
|
40
|
+
}
|
|
41
|
+
export function isBeforeDay(a, b) {
|
|
42
|
+
return (a.getFullYear() < b.getFullYear() ||
|
|
43
|
+
(a.getFullYear() === b.getFullYear() && a.getMonth() < b.getMonth()) ||
|
|
44
|
+
(a.getFullYear() === b.getFullYear() &&
|
|
45
|
+
a.getMonth() === b.getMonth() &&
|
|
46
|
+
a.getDate() < b.getDate()));
|
|
47
|
+
}
|
|
48
|
+
export function buildWeeks(year, month) {
|
|
49
|
+
const first = startOfMonth(year, month);
|
|
50
|
+
const firstDay = first.getDay();
|
|
51
|
+
const result = [];
|
|
52
|
+
let current = addDays(first, -firstDay);
|
|
53
|
+
for (let w = 0; w < 6; w++) {
|
|
54
|
+
const week = [];
|
|
55
|
+
for (let d = 0; d < 7; d++) {
|
|
56
|
+
week.push(current);
|
|
57
|
+
current = addDays(current, 1);
|
|
58
|
+
}
|
|
59
|
+
result.push(week);
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
export function isToday(d, today) {
|
|
64
|
+
return (d.getFullYear() === today.year &&
|
|
65
|
+
d.getMonth() === today.month &&
|
|
66
|
+
d.getDate() === today.day);
|
|
67
|
+
}
|
|
68
|
+
export function isOutsideMonth(d, year, month) {
|
|
69
|
+
return d.getMonth() !== month || d.getFullYear() !== year;
|
|
70
|
+
}
|
|
71
|
+
export function isSelected(d, opts) {
|
|
72
|
+
if (opts.rangeStart && isSameDay(d, opts.rangeStart))
|
|
73
|
+
return true;
|
|
74
|
+
if (opts.rangeEnd && isSameDay(d, opts.rangeEnd))
|
|
75
|
+
return true;
|
|
76
|
+
return opts.value ? isSameDay(d, opts.value) : false;
|
|
77
|
+
}
|
|
78
|
+
export function isInRange(d, rangeStart, rangeEnd) {
|
|
79
|
+
if (!rangeStart || !rangeEnd)
|
|
80
|
+
return false;
|
|
81
|
+
return !isBeforeDay(d, rangeStart) && !isBeforeDay(rangeEnd, d);
|
|
82
|
+
}
|
|
83
|
+
export function isDisabled(d, min, max) {
|
|
84
|
+
if (min && isBeforeDay(d, min))
|
|
85
|
+
return true;
|
|
86
|
+
if (max && isBeforeDay(max, d))
|
|
87
|
+
return true;
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
@@ -1,81 +1,83 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import Input from "../../input/input.svelte";
|
|
3
|
-
import { Label } from "../../label";
|
|
4
|
-
import { EyeIcon, EyeOffIcon } from "@hugeicons/core-free-icons";
|
|
5
|
-
import { inputIconMap } from "../data/InputIconDefault.svelte.js";
|
|
6
|
-
import type { InputLabelProps } from "../data/InputLabel.svelte.js";
|
|
7
|
-
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
8
|
-
|
|
9
|
-
let {
|
|
10
|
-
label,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
{/
|
|
71
|
-
|
|
72
|
-
{
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
{
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
{
|
|
80
|
-
|
|
81
|
-
{
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Input from "../../input/input.svelte";
|
|
3
|
+
import { Label } from "../../label";
|
|
4
|
+
import { EyeIcon, EyeOffIcon } from "@hugeicons/core-free-icons";
|
|
5
|
+
import { inputIconMap } from "../data/InputIconDefault.svelte.js";
|
|
6
|
+
import type { InputLabelProps } from "../data/InputLabel.svelte.js";
|
|
7
|
+
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
label,
|
|
11
|
+
labelClass,
|
|
12
|
+
inputClass,
|
|
13
|
+
isIcon,
|
|
14
|
+
isLabel,
|
|
15
|
+
value = $bindable(""),
|
|
16
|
+
...restProps
|
|
17
|
+
}: InputLabelProps = $props();
|
|
18
|
+
|
|
19
|
+
let showPassword = $state(false);
|
|
20
|
+
|
|
21
|
+
const isPassword = $derived(restProps.type == "password");
|
|
22
|
+
|
|
23
|
+
const inputType = $derived(
|
|
24
|
+
isPassword && showPassword ? "text" : restProps.type,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const currentIcon = $derived(
|
|
28
|
+
restProps.type ? inputIconMap[restProps.type] : undefined,
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
function togglePasswordVisibility() {
|
|
32
|
+
showPassword = !showPassword;
|
|
33
|
+
}
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
{#snippet renderInput()}
|
|
37
|
+
<div class="flex items-center relative w-full">
|
|
38
|
+
{#if isIcon && currentIcon}
|
|
39
|
+
<span class="absolute left-3 flex items-center pointer-events-none">
|
|
40
|
+
<HugeiconsIcon
|
|
41
|
+
icon={currentIcon}
|
|
42
|
+
size={16}
|
|
43
|
+
color="#94a3b8"
|
|
44
|
+
strokeWidth={1.5}
|
|
45
|
+
/>
|
|
46
|
+
</span>
|
|
47
|
+
{/if}
|
|
48
|
+
|
|
49
|
+
<Input
|
|
50
|
+
class="{isIcon && currentIcon ? 'pl-9' : ''} {isPassword ? 'pr-9' : ''} {inputClass ?? ''}"
|
|
51
|
+
bind:value
|
|
52
|
+
{...restProps}
|
|
53
|
+
type={inputType}
|
|
54
|
+
/>
|
|
55
|
+
|
|
56
|
+
{#if isPassword}
|
|
57
|
+
<button
|
|
58
|
+
type="button"
|
|
59
|
+
onclick={togglePasswordVisibility}
|
|
60
|
+
class="absolute right-3 flex items-center cursor-pointer z-10 text-slate-400 hover:text-slate-600 focus:outline-none"
|
|
61
|
+
aria-label={showPassword ? "Ocultar senha" : "Ver senha"}
|
|
62
|
+
>
|
|
63
|
+
<HugeiconsIcon
|
|
64
|
+
icon={showPassword ? EyeOffIcon : EyeIcon}
|
|
65
|
+
size={16}
|
|
66
|
+
color="#94a3b8"
|
|
67
|
+
strokeWidth={1.5}
|
|
68
|
+
/>
|
|
69
|
+
</button>
|
|
70
|
+
{/if}
|
|
71
|
+
</div>
|
|
72
|
+
{/snippet}
|
|
73
|
+
|
|
74
|
+
{#if isLabel}
|
|
75
|
+
<div class="flex flex-col gap-3 w-full">
|
|
76
|
+
{#if label}
|
|
77
|
+
<Label class={labelClass}>{label}</Label>
|
|
78
|
+
{/if}
|
|
79
|
+
{@render renderInput()}
|
|
80
|
+
</div>
|
|
81
|
+
{:else}
|
|
82
|
+
{@render renderInput()}
|
|
83
|
+
{/if}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Label } from "../../label";
|
|
3
|
+
import { Calendar, CalendarCard } from "./calendar";
|
|
4
|
+
import { t, locale } from "../../../../i18n";
|
|
5
|
+
import { cn } from "../../../../utils.js";
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
label?: string;
|
|
9
|
+
isLabel?: boolean;
|
|
10
|
+
isIcon?: boolean;
|
|
11
|
+
labelClass?: string;
|
|
12
|
+
inputClass?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
startValue?: string;
|
|
16
|
+
endValue?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
let {
|
|
20
|
+
label,
|
|
21
|
+
isLabel = true,
|
|
22
|
+
isIcon = true,
|
|
23
|
+
labelClass,
|
|
24
|
+
inputClass,
|
|
25
|
+
disabled = false,
|
|
26
|
+
placeholder,
|
|
27
|
+
startValue = $bindable(""),
|
|
28
|
+
endValue = $bindable(""),
|
|
29
|
+
}: Props = $props();
|
|
30
|
+
|
|
31
|
+
let open = $state(false);
|
|
32
|
+
|
|
33
|
+
const i18nLocale = $derived($locale === "pt" ? "pt-PT" : "en-US");
|
|
34
|
+
|
|
35
|
+
function parseISO(dateStr: string): Date | undefined {
|
|
36
|
+
const match = dateStr.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
37
|
+
if (!match) return undefined;
|
|
38
|
+
return new Date(+match[1], +match[2] - 1, +match[3]);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function formatDateISO(date: Date): string {
|
|
42
|
+
const y = date.getFullYear();
|
|
43
|
+
const m = String(date.getMonth() + 1).padStart(2, "0");
|
|
44
|
+
const d = String(date.getDate()).padStart(2, "0");
|
|
45
|
+
return `${y}-${m}-${d}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function isBeforeDay(a: Date, b: Date): boolean {
|
|
49
|
+
return (
|
|
50
|
+
a.getFullYear() < b.getFullYear() ||
|
|
51
|
+
(a.getFullYear() === b.getFullYear() && a.getMonth() < b.getMonth()) ||
|
|
52
|
+
(a.getFullYear() === b.getFullYear() &&
|
|
53
|
+
a.getMonth() === b.getMonth() &&
|
|
54
|
+
a.getDate() < b.getDate())
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let startDate = $derived(startValue ? parseISO(startValue) : undefined);
|
|
59
|
+
let endDate = $derived(endValue ? parseISO(endValue) : undefined);
|
|
60
|
+
|
|
61
|
+
const today = new Date();
|
|
62
|
+
|
|
63
|
+
function selectStart(date: Date) {
|
|
64
|
+
if (endDate && isBeforeDay(endDate, date)) {
|
|
65
|
+
endValue = "";
|
|
66
|
+
}
|
|
67
|
+
startValue = formatDateISO(date);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function selectEnd(date: Date) {
|
|
71
|
+
if (!startDate || isBeforeDay(date, startDate)) {
|
|
72
|
+
startValue = formatDateISO(date);
|
|
73
|
+
} else {
|
|
74
|
+
endValue = formatDateISO(date);
|
|
75
|
+
open = false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
$effect(() => {
|
|
80
|
+
if (startDate && endDate && isBeforeDay(endDate, startDate)) {
|
|
81
|
+
startValue = formatDateISO(endDate);
|
|
82
|
+
endValue = formatDateISO(startDate);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const displayStart = $derived(
|
|
87
|
+
startDate
|
|
88
|
+
? new Intl.DateTimeFormat(i18nLocale, {
|
|
89
|
+
day: "2-digit",
|
|
90
|
+
month: "2-digit",
|
|
91
|
+
year: "numeric",
|
|
92
|
+
}).format(startDate)
|
|
93
|
+
: "",
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const displayEnd = $derived(
|
|
97
|
+
endDate
|
|
98
|
+
? new Intl.DateTimeFormat(i18nLocale, {
|
|
99
|
+
day: "2-digit",
|
|
100
|
+
month: "2-digit",
|
|
101
|
+
year: "numeric",
|
|
102
|
+
}).format(endDate)
|
|
103
|
+
: "",
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
const startYear = $derived(startDate?.getFullYear());
|
|
107
|
+
const startMonth = $derived(startDate?.getMonth());
|
|
108
|
+
const endYear = $derived(endDate?.getFullYear() ?? startYear ?? today.getFullYear());
|
|
109
|
+
const endMonth = $derived(endDate?.getMonth() ?? startMonth ?? today.getMonth());
|
|
110
|
+
|
|
111
|
+
const placeholderClasses = $derived(
|
|
112
|
+
cn("truncate", !startDate && !endDate && "text-muted-foreground"),
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
const calendarLabelClass = $derived(
|
|
116
|
+
cn("px-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground"),
|
|
117
|
+
);
|
|
118
|
+
</script>
|
|
119
|
+
|
|
120
|
+
<div class="flex w-full flex-col gap-3">
|
|
121
|
+
{#if isLabel}
|
|
122
|
+
{#if label}
|
|
123
|
+
<Label class={labelClass}>{label}</Label>
|
|
124
|
+
{:else}
|
|
125
|
+
<Label class={labelClass}>{$t("input.date.interval.label")}</Label>
|
|
126
|
+
{/if}
|
|
127
|
+
{/if}
|
|
128
|
+
|
|
129
|
+
<CalendarCard
|
|
130
|
+
bind:open
|
|
131
|
+
rangeStart={startDate}
|
|
132
|
+
rangeEnd={endDate}
|
|
133
|
+
{isIcon}
|
|
134
|
+
{inputClass}
|
|
135
|
+
{disabled}
|
|
136
|
+
>
|
|
137
|
+
{#snippet content()}
|
|
138
|
+
<div
|
|
139
|
+
class="grid max-h-[26rem] gap-2 overflow-y-auto p-2 md:max-h-none md:grid-cols-2 md:overflow-visible"
|
|
140
|
+
>
|
|
141
|
+
<div class="flex flex-col gap-1">
|
|
142
|
+
<span class={calendarLabelClass}>
|
|
143
|
+
{$t("input.date.start.label")}
|
|
144
|
+
</span>
|
|
145
|
+
<Calendar
|
|
146
|
+
value={startDate}
|
|
147
|
+
rangeStart={startDate}
|
|
148
|
+
rangeEnd={endDate}
|
|
149
|
+
month={startMonth}
|
|
150
|
+
year={startYear}
|
|
151
|
+
onselect={selectStart}
|
|
152
|
+
/>
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
<div class="flex flex-col gap-1">
|
|
156
|
+
<span class={calendarLabelClass}>
|
|
157
|
+
{$t("input.date.end.label")}
|
|
158
|
+
</span>
|
|
159
|
+
<Calendar
|
|
160
|
+
value={endDate}
|
|
161
|
+
rangeStart={startDate}
|
|
162
|
+
rangeEnd={endDate}
|
|
163
|
+
month={endMonth}
|
|
164
|
+
year={endYear}
|
|
165
|
+
onselect={selectEnd}
|
|
166
|
+
/>
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
{/snippet}
|
|
170
|
+
<span class={placeholderClasses}>
|
|
171
|
+
{#if displayStart}
|
|
172
|
+
{displayStart}
|
|
173
|
+
{#if displayEnd}– {displayEnd}{/if}
|
|
174
|
+
{:else}
|
|
175
|
+
{placeholder || $t("input.date.interval.label")}
|
|
176
|
+
{/if}
|
|
177
|
+
</span>
|
|
178
|
+
</CalendarCard>
|
|
179
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
label?: string;
|
|
3
|
+
isLabel?: boolean;
|
|
4
|
+
isIcon?: boolean;
|
|
5
|
+
labelClass?: string;
|
|
6
|
+
inputClass?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
startValue?: string;
|
|
10
|
+
endValue?: string;
|
|
11
|
+
};
|
|
12
|
+
declare const InputCalendarInterval: import("svelte").Component<Props, {}, "startValue" | "endValue">;
|
|
13
|
+
type InputCalendarInterval = ReturnType<typeof InputCalendarInterval>;
|
|
14
|
+
export default InputCalendarInterval;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { InputLabelProps } from "../data/InputLabel.svelte.js";
|
|
3
|
+
import { Label } from "../../label";
|
|
4
|
+
import { CalendarCard } from "./calendar";
|
|
5
|
+
import { t, locale } from "../../../../i18n";
|
|
6
|
+
import { cn } from "../../../../utils.js";
|
|
7
|
+
|
|
8
|
+
type Props = InputLabelProps & {
|
|
9
|
+
min?: string;
|
|
10
|
+
max?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
label,
|
|
16
|
+
labelClass,
|
|
17
|
+
inputClass,
|
|
18
|
+
isLabel = true,
|
|
19
|
+
isIcon = true,
|
|
20
|
+
value = $bindable(""),
|
|
21
|
+
min,
|
|
22
|
+
max,
|
|
23
|
+
disabled = false,
|
|
24
|
+
placeholder,
|
|
25
|
+
placeholderClass,
|
|
26
|
+
}: Props = $props();
|
|
27
|
+
|
|
28
|
+
let open = $state(false);
|
|
29
|
+
|
|
30
|
+
const i18nLocale = $derived($locale === "pt" ? "pt-PT" : "en-US");
|
|
31
|
+
|
|
32
|
+
function parseISO(dateStr: string): Date | undefined {
|
|
33
|
+
const match = dateStr.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
34
|
+
if (!match) return undefined;
|
|
35
|
+
return new Date(+match[1], +match[2] - 1, +match[3]);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function formatDateISO(date: Date): string {
|
|
39
|
+
const y = date.getFullYear();
|
|
40
|
+
const m = String(date.getMonth() + 1).padStart(2, "0");
|
|
41
|
+
const d = String(date.getDate()).padStart(2, "0");
|
|
42
|
+
return `${y}-${m}-${d}`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const selectedDate = $derived(value ? parseISO(value) : undefined);
|
|
46
|
+
|
|
47
|
+
const displayValue = $derived(
|
|
48
|
+
selectedDate
|
|
49
|
+
? new Intl.DateTimeFormat(i18nLocale, {
|
|
50
|
+
day: "2-digit",
|
|
51
|
+
month: "2-digit",
|
|
52
|
+
year: "numeric",
|
|
53
|
+
}).format(selectedDate)
|
|
54
|
+
: "",
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const minDate = $derived(min ? parseISO(min) : undefined);
|
|
58
|
+
const maxDate = $derived(max ? parseISO(max) : undefined);
|
|
59
|
+
|
|
60
|
+
function handleSelect(date: Date) {
|
|
61
|
+
value = formatDateISO(date);
|
|
62
|
+
open = false;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const placeholderClasses = $derived(
|
|
66
|
+
cn(
|
|
67
|
+
"truncate",
|
|
68
|
+
!displayValue && "text-muted-foreground",
|
|
69
|
+
`${placeholderClass}`,
|
|
70
|
+
),
|
|
71
|
+
);
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
{#if isLabel}
|
|
75
|
+
<div class="flex flex-col gap-3 w-full">
|
|
76
|
+
{#if label}
|
|
77
|
+
<Label class={labelClass}>{label}</Label>
|
|
78
|
+
{/if}
|
|
79
|
+
|
|
80
|
+
<CalendarCard
|
|
81
|
+
bind:open
|
|
82
|
+
value={selectedDate}
|
|
83
|
+
min={minDate}
|
|
84
|
+
max={maxDate}
|
|
85
|
+
{isIcon}
|
|
86
|
+
{inputClass}
|
|
87
|
+
{disabled}
|
|
88
|
+
onselect={handleSelect}
|
|
89
|
+
>
|
|
90
|
+
<span class={placeholderClasses}>
|
|
91
|
+
{displayValue || placeholder || $t("input.date.placeholder")}
|
|
92
|
+
</span>
|
|
93
|
+
</CalendarCard>
|
|
94
|
+
</div>
|
|
95
|
+
{:else}
|
|
96
|
+
<CalendarCard
|
|
97
|
+
bind:open
|
|
98
|
+
value={selectedDate}
|
|
99
|
+
min={minDate}
|
|
100
|
+
max={maxDate}
|
|
101
|
+
{isIcon}
|
|
102
|
+
{inputClass}
|
|
103
|
+
{disabled}
|
|
104
|
+
onselect={handleSelect}
|
|
105
|
+
>
|
|
106
|
+
<span class={placeholderClasses}>
|
|
107
|
+
{displayValue || placeholder || $t("input.date.placeholder")}
|
|
108
|
+
</span>
|
|
109
|
+
</CalendarCard>
|
|
110
|
+
{/if}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { InputLabelProps } from "../data/InputLabel.svelte.ts";
|
|
2
|
+
type Props = InputLabelProps & {
|
|
3
|
+
min?: string;
|
|
4
|
+
max?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const InputCalendar: import("svelte").Component<Props, {}, "value">;
|
|
8
|
+
type InputCalendar = ReturnType<typeof InputCalendar>;
|
|
9
|
+
export default InputCalendar;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { InputLabelProps } from "../data/InputLabel.svelte.js";
|
|
3
|
-
import InputBase from "./input-base.svelte";
|
|
4
|
-
import { t } from "../../../../i18n";
|
|
5
|
-
|
|
6
|
-
/** Email or phone input field with icon and label. */
|
|
7
|
-
let {
|
|
8
|
-
label,
|
|
9
|
-
placeholder,
|
|
10
|
-
value = $bindable(""),
|
|
11
|
-
...restProps
|
|
12
|
-
}: InputLabelProps = $props();
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<InputBase
|
|
16
|
-
type="text"
|
|
17
|
-
label={label || $t("input.email-or-phone.label")}
|
|
18
|
-
placeholder={placeholder || $t("input.email-or-phone.placeholder")}
|
|
19
|
-
isLabel
|
|
20
|
-
isIcon
|
|
21
|
-
bind:value
|
|
22
|
-
{...restProps}
|
|
23
|
-
/>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { InputLabelProps } from "../data/InputLabel.svelte.js";
|
|
3
|
+
import InputBase from "./input-base.svelte";
|
|
4
|
+
import { t } from "../../../../i18n";
|
|
5
|
+
|
|
6
|
+
/** Email or phone input field with icon and label. */
|
|
7
|
+
let {
|
|
8
|
+
label,
|
|
9
|
+
placeholder,
|
|
10
|
+
value = $bindable(""),
|
|
11
|
+
...restProps
|
|
12
|
+
}: InputLabelProps = $props();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<InputBase
|
|
16
|
+
type="text"
|
|
17
|
+
label={label || $t("input.email-or-phone.label")}
|
|
18
|
+
placeholder={placeholder || $t("input.email-or-phone.placeholder")}
|
|
19
|
+
isLabel
|
|
20
|
+
isIcon
|
|
21
|
+
bind:value
|
|
22
|
+
{...restProps}
|
|
23
|
+
/>
|