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,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 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="email"
|
|
17
|
-
label={label || $t("input.email.label")}
|
|
18
|
-
placeholder={placeholder || $t("input.email.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 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="email"
|
|
17
|
+
label={label || $t("input.email.label")}
|
|
18
|
+
placeholder={placeholder || $t("input.email.placeholder")}
|
|
19
|
+
isLabel
|
|
20
|
+
isIcon
|
|
21
|
+
bind:value
|
|
22
|
+
{...restProps}
|
|
23
|
+
/>
|
|
@@ -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
|
-
/** Password confirmation 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="password"
|
|
17
|
-
label={label || $t("input.password-confirm.label")}
|
|
18
|
-
placeholder={placeholder || $t("input.password-confirm.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
|
+
/** Password confirmation 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="password"
|
|
17
|
+
label={label || $t("input.password-confirm.label")}
|
|
18
|
+
placeholder={placeholder || $t("input.password-confirm.placeholder")}
|
|
19
|
+
isLabel
|
|
20
|
+
isIcon
|
|
21
|
+
bind:value
|
|
22
|
+
{...restProps}
|
|
23
|
+
/>
|
|
@@ -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
|
-
/** Password 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="password"
|
|
17
|
-
label={label || $t("input.password.label")}
|
|
18
|
-
placeholder={placeholder || $t("input.password.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
|
+
/** Password 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="password"
|
|
17
|
+
label={label || $t("input.password.label")}
|
|
18
|
+
placeholder={placeholder || $t("input.password.placeholder")}
|
|
19
|
+
isLabel
|
|
20
|
+
isIcon
|
|
21
|
+
bind:value
|
|
22
|
+
{...restProps}
|
|
23
|
+
/>
|
|
@@ -1,33 +1,37 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { PhoneInput } from "../../phone-input";
|
|
3
|
-
import type { InputLabelProps } from "../data/InputLabel.svelte.js";
|
|
4
|
-
import { Label } from "../../label";
|
|
5
|
-
import { t } from "../../../../i18n";
|
|
6
|
-
|
|
7
|
-
/** Phone input field with icon and label. */
|
|
8
|
-
let {
|
|
9
|
-
label,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
{
|
|
21
|
-
<Label>{
|
|
22
|
-
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
{
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { PhoneInput } from "../../phone-input";
|
|
3
|
+
import type { InputLabelProps } from "../data/InputLabel.svelte.js";
|
|
4
|
+
import { Label } from "../../label";
|
|
5
|
+
import { t } from "../../../../i18n";
|
|
6
|
+
|
|
7
|
+
/** Phone input field with icon and label. */
|
|
8
|
+
let {
|
|
9
|
+
label,
|
|
10
|
+
labelClass,
|
|
11
|
+
inputClass,
|
|
12
|
+
isLabel,
|
|
13
|
+
placeholder,
|
|
14
|
+
value = $bindable(""),
|
|
15
|
+
}: InputLabelProps = $props();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
{#if isLabel}
|
|
19
|
+
<div class="flex flex-col gap-3 w-full">
|
|
20
|
+
{#if label}
|
|
21
|
+
<Label class={labelClass}>{label}</Label>
|
|
22
|
+
{:else}
|
|
23
|
+
<Label class={labelClass}>{$t("input.phone.label")}</Label>
|
|
24
|
+
{/if}
|
|
25
|
+
<PhoneInput
|
|
26
|
+
class={inputClass}
|
|
27
|
+
placeholder={placeholder || $t("input.phone.placeholder")}
|
|
28
|
+
bind:value
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
31
|
+
{:else}
|
|
32
|
+
<PhoneInput
|
|
33
|
+
class={inputClass}
|
|
34
|
+
placeholder={placeholder || $t("input.phone.placeholder")}
|
|
35
|
+
bind:value
|
|
36
|
+
/>
|
|
37
|
+
{/if}
|
|
@@ -1,195 +1,247 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { InputLabelProps } from "../data/InputLabel.svelte.js";
|
|
2
3
|
import { Label } from "../../label";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
4
|
+
import { HugeiconsIcon } from "@hugeicons/svelte";
|
|
5
|
+
import { ChevronDownIcon, Search01Icon, Cancel01Icon } from "@hugeicons/core-free-icons";
|
|
6
|
+
import { cn } from "../../../../utils.js";
|
|
5
7
|
|
|
6
8
|
type SelectOption = { value: string; label: string };
|
|
9
|
+
type SelectOptions = SelectOption[] | Record<string, string>;
|
|
10
|
+
|
|
11
|
+
type Props = InputLabelProps & {
|
|
12
|
+
options?: SelectOptions;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
};
|
|
7
15
|
|
|
8
16
|
let {
|
|
9
17
|
label,
|
|
10
|
-
|
|
18
|
+
labelClass,
|
|
19
|
+
inputClass,
|
|
20
|
+
isLabel = true,
|
|
21
|
+
isIcon = false,
|
|
22
|
+
placeholder,
|
|
23
|
+
options = {},
|
|
11
24
|
value = $bindable(""),
|
|
12
25
|
disabled = false,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
value = option.value;
|
|
43
|
-
isOpen = false;
|
|
44
|
-
}
|
|
26
|
+
}: Props = $props();
|
|
27
|
+
|
|
28
|
+
const optionList = $derived(
|
|
29
|
+
Array.isArray(options)
|
|
30
|
+
? options.map((o) => (typeof o === "string" ? { value: o, label: o } : o))
|
|
31
|
+
: Object.entries(options).map(([value, label]) => ({ value, label })),
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
let query = $state("");
|
|
35
|
+
let open = $state(false);
|
|
36
|
+
|
|
37
|
+
const selectedLabel = $derived(
|
|
38
|
+
optionList.find((o) => o.value === value)?.label ?? "",
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const filteredOptions = $derived.by(() => {
|
|
42
|
+
const q = query.trim().toLocaleLowerCase();
|
|
43
|
+
if (!q) return optionList;
|
|
44
|
+
return optionList.filter(
|
|
45
|
+
(o) =>
|
|
46
|
+
o.label.toLocaleLowerCase().includes(q) ||
|
|
47
|
+
o.value.toLocaleLowerCase().includes(q),
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
function handleFocus() {
|
|
52
|
+
if (disabled) return;
|
|
53
|
+
open = true;
|
|
54
|
+
query = selectedLabel;
|
|
45
55
|
}
|
|
46
56
|
|
|
47
|
-
function
|
|
48
|
-
|
|
49
|
-
return Array.isArray(value) && value.includes(option.value);
|
|
50
|
-
}
|
|
51
|
-
return value === option.value;
|
|
57
|
+
function handleInput() {
|
|
58
|
+
open = true;
|
|
52
59
|
}
|
|
53
60
|
|
|
54
|
-
function
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return arr
|
|
59
|
-
.map((v) => options.find((o) => o.value === v)?.label ?? v)
|
|
60
|
-
.join(", ");
|
|
61
|
-
}
|
|
62
|
-
return options.find((o) => o.value === value)?.label ?? placeholder;
|
|
61
|
+
function selectOption(option: SelectOption) {
|
|
62
|
+
value = option.value;
|
|
63
|
+
query = option.label;
|
|
64
|
+
open = false;
|
|
63
65
|
}
|
|
64
66
|
|
|
65
|
-
function
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
function clearSelection() {
|
|
68
|
+
value = "";
|
|
69
|
+
query = "";
|
|
70
|
+
open = false;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function handleBlur(e: FocusEvent) {
|
|
74
|
+
query = selectedLabel;
|
|
69
75
|
}
|
|
70
|
-
</script>
|
|
71
76
|
|
|
72
|
-
|
|
77
|
+
const inputClasses = $derived(
|
|
78
|
+
cn(
|
|
79
|
+
"h-9 w-full min-w-0 rounded-md border bg-transparent py-1 text-base shadow-xs",
|
|
80
|
+
"transition-colors outline-none md:text-sm cursor-text",
|
|
81
|
+
"border-input dark:bg-input/30 text-foreground placeholder:text-muted-foreground",
|
|
82
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3",
|
|
83
|
+
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
84
|
+
"pr-9",
|
|
85
|
+
isIcon ? "pl-9" : "pl-2.5",
|
|
86
|
+
inputClass,
|
|
87
|
+
),
|
|
88
|
+
);
|
|
89
|
+
</script>
|
|
73
90
|
|
|
74
91
|
{#if isLabel}
|
|
75
|
-
<div class="flex
|
|
92
|
+
<div class="flex flex-col gap-3 w-full">
|
|
76
93
|
{#if label}
|
|
77
|
-
<Label>{label}</Label>
|
|
94
|
+
<Label class={labelClass}>{label}</Label>
|
|
78
95
|
{/if}
|
|
79
|
-
|
|
96
|
+
|
|
97
|
+
<div class="relative">
|
|
98
|
+
{#if isIcon && !disabled}
|
|
99
|
+
<span
|
|
100
|
+
class="absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none text-slate-400"
|
|
101
|
+
>
|
|
102
|
+
<HugeiconsIcon icon={Search01Icon} size={16} strokeWidth={1.5} />
|
|
103
|
+
</span>
|
|
104
|
+
{/if}
|
|
105
|
+
|
|
106
|
+
{#if !disabled && value}
|
|
107
|
+
<button
|
|
108
|
+
type="button"
|
|
109
|
+
aria-label="clear"
|
|
110
|
+
class="absolute right-3 top-1/2 -translate-y-1/2 flex items-center cursor-pointer z-10 text-slate-400 hover:text-slate-600"
|
|
111
|
+
onmousedown={(e) => e.preventDefault()}
|
|
112
|
+
onclick={clearSelection}
|
|
113
|
+
>
|
|
114
|
+
<HugeiconsIcon icon={Cancel01Icon} size={16} strokeWidth={1.5} />
|
|
115
|
+
</button>
|
|
116
|
+
{:else}
|
|
117
|
+
<span
|
|
118
|
+
class="absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-slate-400"
|
|
119
|
+
>
|
|
120
|
+
<HugeiconsIcon icon={ChevronDownIcon} size={16} strokeWidth={1.5} />
|
|
121
|
+
</span>
|
|
122
|
+
{/if}
|
|
123
|
+
|
|
124
|
+
<input
|
|
125
|
+
type="text"
|
|
126
|
+
class={inputClasses}
|
|
127
|
+
placeholder={placeholder}
|
|
128
|
+
{disabled}
|
|
129
|
+
bind:value={query}
|
|
130
|
+
onfocus={handleFocus}
|
|
131
|
+
oninput={handleInput}
|
|
132
|
+
onblur={handleBlur}
|
|
133
|
+
onkeydown={(e) => {
|
|
134
|
+
if (e.key === "Escape") open = false;
|
|
135
|
+
if (e.key === "Enter") open = false;
|
|
136
|
+
}}
|
|
137
|
+
/>
|
|
138
|
+
|
|
139
|
+
{#if open && !disabled}
|
|
140
|
+
<div
|
|
141
|
+
role="listbox"
|
|
142
|
+
tabindex="-1"
|
|
143
|
+
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"
|
|
144
|
+
onmousedown={(e) => e.preventDefault()}
|
|
145
|
+
>
|
|
146
|
+
{#if filteredOptions.length === 0}
|
|
147
|
+
<div class="px-2 py-1.5 text-center text-xs text-muted-foreground">
|
|
148
|
+
{placeholder}
|
|
149
|
+
</div>
|
|
150
|
+
{:else}
|
|
151
|
+
{#each filteredOptions as option, i (option.value)}
|
|
152
|
+
<button
|
|
153
|
+
type="button"
|
|
154
|
+
role="option"
|
|
155
|
+
aria-selected={option.value === value}
|
|
156
|
+
class={cn(
|
|
157
|
+
"block w-full rounded px-2 py-1.5 text-left text-sm transition-colors hover:bg-muted",
|
|
158
|
+
option.value === value
|
|
159
|
+
? "bg-primary font-medium text-primary-foreground hover:bg-primary"
|
|
160
|
+
: "text-foreground",
|
|
161
|
+
)}
|
|
162
|
+
onclick={() => selectOption(option)}
|
|
163
|
+
>
|
|
164
|
+
{option.label}
|
|
165
|
+
</button>
|
|
166
|
+
{/each}
|
|
167
|
+
{/if}
|
|
168
|
+
</div>
|
|
169
|
+
{/if}
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
{:else}
|
|
173
|
+
<div class="relative">
|
|
174
|
+
{#if isIcon && !disabled}
|
|
175
|
+
<span
|
|
176
|
+
class="absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none text-slate-400"
|
|
177
|
+
>
|
|
178
|
+
<HugeiconsIcon icon={Search01Icon} size={16} strokeWidth={1.5} />
|
|
179
|
+
</span>
|
|
180
|
+
{/if}
|
|
181
|
+
|
|
182
|
+
{#if !disabled && value}
|
|
80
183
|
<button
|
|
81
184
|
type="button"
|
|
82
|
-
|
|
83
|
-
class="
|
|
84
|
-
|
|
185
|
+
aria-label="clear"
|
|
186
|
+
class="absolute right-3 top-1/2 -translate-y-1/2 flex items-center cursor-pointer z-10 text-slate-400 hover:text-slate-600"
|
|
187
|
+
onmousedown={(e) => e.preventDefault()}
|
|
188
|
+
onclick={clearSelection}
|
|
85
189
|
>
|
|
86
|
-
<
|
|
87
|
-
{getDisplayText()}
|
|
88
|
-
</span>
|
|
89
|
-
<svg
|
|
90
|
-
class={cn("size-4 shrink-0 opacity-50 transition-transform", isOpen && "rotate-180")}
|
|
91
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
92
|
-
viewBox="0 0 24 24"
|
|
93
|
-
fill="none"
|
|
94
|
-
stroke="currentColor"
|
|
95
|
-
stroke-width="2"
|
|
96
|
-
stroke-linecap="round"
|
|
97
|
-
stroke-linejoin="round"
|
|
98
|
-
>
|
|
99
|
-
<path d="m6 9 6 6 6-6" />
|
|
100
|
-
</svg>
|
|
190
|
+
<HugeiconsIcon icon={Cancel01Icon} size={16} strokeWidth={1.5} />
|
|
101
191
|
</button>
|
|
192
|
+
{:else}
|
|
193
|
+
<span
|
|
194
|
+
class="absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-slate-400"
|
|
195
|
+
>
|
|
196
|
+
<HugeiconsIcon icon={ChevronDownIcon} size={16} strokeWidth={1.5} />
|
|
197
|
+
</span>
|
|
198
|
+
{/if}
|
|
102
199
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
200
|
+
<input
|
|
201
|
+
type="text"
|
|
202
|
+
class={inputClasses}
|
|
203
|
+
placeholder={placeholder}
|
|
204
|
+
{disabled}
|
|
205
|
+
bind:value={query}
|
|
206
|
+
onfocus={handleFocus}
|
|
207
|
+
oninput={handleInput}
|
|
208
|
+
onblur={handleBlur}
|
|
209
|
+
onkeydown={(e) => {
|
|
210
|
+
if (e.key === "Escape") open = false;
|
|
211
|
+
if (e.key === "Enter") open = false;
|
|
212
|
+
}}
|
|
213
|
+
/>
|
|
214
|
+
|
|
215
|
+
{#if open && !disabled}
|
|
216
|
+
<div
|
|
217
|
+
role="listbox"
|
|
218
|
+
tabindex="-1"
|
|
219
|
+
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"
|
|
220
|
+
onmousedown={(e) => e.preventDefault()}
|
|
221
|
+
>
|
|
222
|
+
{#if filteredOptions.length === 0}
|
|
223
|
+
<div class="px-2 py-1.5 text-center text-xs text-muted-foreground">
|
|
224
|
+
{placeholder}
|
|
225
|
+
</div>
|
|
226
|
+
{:else}
|
|
227
|
+
{#each filteredOptions as option, i (option.value)}
|
|
106
228
|
<button
|
|
107
229
|
type="button"
|
|
230
|
+
role="option"
|
|
231
|
+
aria-selected={option.value === value}
|
|
108
232
|
class={cn(
|
|
109
|
-
"
|
|
110
|
-
|
|
233
|
+
"block w-full rounded px-2 py-1.5 text-left text-sm transition-colors hover:bg-muted",
|
|
234
|
+
option.value === value
|
|
235
|
+
? "bg-primary font-medium text-primary-foreground hover:bg-primary"
|
|
236
|
+
: "text-foreground",
|
|
111
237
|
)}
|
|
112
|
-
onclick={() =>
|
|
238
|
+
onclick={() => selectOption(option)}
|
|
113
239
|
>
|
|
114
|
-
{#if multiple}
|
|
115
|
-
<span
|
|
116
|
-
class={cn(
|
|
117
|
-
"mr-2 flex size-4 items-center justify-center rounded border",
|
|
118
|
-
isSelected(option)
|
|
119
|
-
? "border-primary bg-primary text-primary-foreground"
|
|
120
|
-
: "border-input"
|
|
121
|
-
)}
|
|
122
|
-
>
|
|
123
|
-
{#if isSelected(option)}
|
|
124
|
-
<svg class="size-3" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3">
|
|
125
|
-
<path d="M20 6 9 17l-5-5" />
|
|
126
|
-
</svg>
|
|
127
|
-
{/if}
|
|
128
|
-
</span>
|
|
129
|
-
{/if}
|
|
130
240
|
{option.label}
|
|
131
241
|
</button>
|
|
132
242
|
{/each}
|
|
133
|
-
|
|
134
|
-
{/if}
|
|
135
|
-
</div>
|
|
136
|
-
</div>
|
|
137
|
-
{:else}
|
|
138
|
-
<div bind:this={selectRef} class={cn("relative", className)}>
|
|
139
|
-
<button
|
|
140
|
-
type="button"
|
|
141
|
-
{disabled}
|
|
142
|
-
class="flex h-10 w-full items-center justify-between rounded-md border border-input bg-card px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
|
|
143
|
-
onclick={() => (isOpen = !isOpen)}
|
|
144
|
-
>
|
|
145
|
-
<span class={cn(!value && "text-muted-foreground")}>
|
|
146
|
-
{getDisplayText()}
|
|
147
|
-
</span>
|
|
148
|
-
<svg
|
|
149
|
-
class={cn("size-4 shrink-0 opacity-50 transition-transform", isOpen && "rotate-180")}
|
|
150
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
151
|
-
viewBox="0 0 24 24"
|
|
152
|
-
fill="none"
|
|
153
|
-
stroke="currentColor"
|
|
154
|
-
stroke-width="2"
|
|
155
|
-
stroke-linecap="round"
|
|
156
|
-
stroke-linejoin="round"
|
|
157
|
-
>
|
|
158
|
-
<path d="m6 9 6 6 6-6" />
|
|
159
|
-
</svg>
|
|
160
|
-
</button>
|
|
161
|
-
|
|
162
|
-
{#if isOpen}
|
|
163
|
-
<div class="absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-md border border-border bg-card shadow-md">
|
|
164
|
-
{#each options as option (option.value)}
|
|
165
|
-
<button
|
|
166
|
-
type="button"
|
|
167
|
-
class={cn(
|
|
168
|
-
"flex w-full items-center px-3 py-2 text-sm transition-colors hover:bg-muted",
|
|
169
|
-
isSelected(option) && "bg-muted font-medium"
|
|
170
|
-
)}
|
|
171
|
-
onclick={() => handleSelect(option)}
|
|
172
|
-
>
|
|
173
|
-
{#if multiple}
|
|
174
|
-
<span
|
|
175
|
-
class={cn(
|
|
176
|
-
"mr-2 flex size-4 items-center justify-center rounded border",
|
|
177
|
-
isSelected(option)
|
|
178
|
-
? "border-primary bg-primary text-primary-foreground"
|
|
179
|
-
: "border-input"
|
|
180
|
-
)}
|
|
181
|
-
>
|
|
182
|
-
{#if isSelected(option)}
|
|
183
|
-
<svg class="size-3" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3">
|
|
184
|
-
<path d="M20 6 9 17l-5-5" />
|
|
185
|
-
</svg>
|
|
186
|
-
{/if}
|
|
187
|
-
</span>
|
|
188
|
-
{/if}
|
|
189
|
-
{option.label}
|
|
190
|
-
</button>
|
|
191
|
-
{/each}
|
|
243
|
+
{/if}
|
|
192
244
|
</div>
|
|
193
245
|
{/if}
|
|
194
246
|
</div>
|
|
195
|
-
{/if}
|
|
247
|
+
{/if}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import type { InputLabelProps } from "../data/InputLabel.svelte";
|
|
1
|
+
import type { InputLabelProps } from "../data/InputLabel.svelte.ts";
|
|
2
2
|
type SelectOption = {
|
|
3
3
|
value: string;
|
|
4
4
|
label: string;
|
|
5
5
|
};
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
options?:
|
|
9
|
-
multiple?: boolean;
|
|
10
|
-
placeholder?: string;
|
|
6
|
+
type SelectOptions = SelectOption[] | Record<string, string>;
|
|
7
|
+
type Props = InputLabelProps & {
|
|
8
|
+
options?: SelectOptions;
|
|
11
9
|
disabled?: boolean;
|
|
12
|
-
required?: boolean;
|
|
13
|
-
class?: string;
|
|
14
10
|
};
|
|
15
|
-
declare const InputSelect: import("svelte").Component
|
|
11
|
+
declare const InputSelect: import("svelte").Component<Props, {}, "value">;
|
|
16
12
|
type InputSelect = ReturnType<typeof InputSelect>;
|
|
17
13
|
export default InputSelect;
|