negodesign 0.0.10 → 0.0.12
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/dist/components/NegoDesign.svelte +1 -1
- package/dist/components/NegoDesign.svelte.d.ts +1 -1
- package/dist/components/core/button/ButtonBack.svelte +1 -1
- package/dist/components/core/button/ButtonLogin.svelte +1 -1
- package/dist/components/core/button/ButtonLoginWith.svelte +1 -1
- package/dist/components/core/button/ButtonSend.svelte +1 -1
- package/dist/components/core/card/media/01/CardMedia01.svelte +114 -0
- package/dist/components/core/card/media/01/CardMedia01.svelte.d.ts +4 -0
- package/dist/components/core/card/media/02/CardMedia02.svelte +113 -0
- package/dist/components/core/card/media/02/CardMedia02.svelte.d.ts +4 -0
- package/dist/components/core/card/media/CardMedia.svelte +17 -0
- package/dist/components/core/card/media/CardMedia.svelte.d.ts +8 -0
- package/dist/components/core/card/media/data.d.ts +3 -0
- package/dist/components/core/card/media/data.js +117 -0
- package/dist/components/core/card/profile/01/CardProfile01.svelte +101 -0
- package/dist/components/core/card/profile/01/CardProfile01.svelte.d.ts +4 -0
- package/dist/components/core/card/profile/02/CardProfile02.svelte +97 -0
- package/dist/components/core/card/profile/02/CardProfile02.svelte.d.ts +4 -0
- package/dist/components/core/card/profile/CardProfile.svelte +17 -0
- package/dist/components/core/card/profile/CardProfile.svelte.d.ts +8 -0
- package/dist/components/core/card/profile/data.d.ts +3 -0
- package/dist/components/core/card/profile/data.js +107 -0
- package/dist/components/core/card/shared/CardButton.svelte +30 -0
- package/dist/components/core/card/shared/CardButton.svelte.d.ts +12 -0
- package/dist/components/core/card/shared/CardDescription.svelte +23 -0
- package/dist/components/core/card/shared/CardDescription.svelte.d.ts +6 -0
- package/dist/components/core/card/shared/CardFavorite.svelte +28 -0
- package/dist/components/core/card/shared/CardFavorite.svelte.d.ts +7 -0
- package/dist/components/core/card/shared/CardStarRating.svelte +20 -0
- package/dist/components/core/card/shared/CardStarRating.svelte.d.ts +7 -0
- package/dist/components/core/card/shared/CardTags.svelte +56 -0
- package/dist/components/core/card/shared/CardTags.svelte.d.ts +10 -0
- package/dist/components/core/card/shared/CardThumbnailVideo.svelte +170 -0
- package/dist/components/core/card/shared/CardThumbnailVideo.svelte.d.ts +10 -0
- package/dist/components/core/card/shared/TruncatableText.svelte +56 -0
- package/dist/components/core/card/shared/TruncatableText.svelte.d.ts +8 -0
- package/dist/components/core/card/types.d.ts +44 -0
- package/dist/components/core/carousel/types.d.ts +23 -0
- package/dist/components/core/carousel/ui/SimpleCarousel.svelte +62 -0
- package/dist/components/core/carousel/ui/SimpleCarousel.svelte.d.ts +4 -0
- package/dist/components/core/datatable/ui/DataTableCore.svelte +5 -5
- package/dist/components/core/form/ui/input-code-otp.svelte +3 -3
- package/dist/components/core/form/ui/input-code-otp.svelte.d.ts +2 -2
- package/dist/components/core/form/ui/input-email-or-phone.svelte +1 -1
- package/dist/components/core/form/ui/input-email.svelte +1 -1
- package/dist/components/core/form/ui/input-password-confirm.svelte +1 -1
- package/dist/components/core/form/ui/input-password.svelte +1 -1
- package/dist/components/core/form/ui/input-phone.svelte +1 -1
- package/dist/components/core/form/ui/input-username.svelte +2 -2
- package/dist/components/core/nav/data/nav-menu-sidebar.d.ts +7 -7
- package/dist/components/core/nav/data/nav-menu.d.ts +31 -0
- package/dist/components/core/nav/data/nav-user-sidebar.d.ts +1 -1
- package/dist/components/core/nav/ui/menu-links.svelte +28 -0
- package/dist/components/core/nav/ui/menu-links.svelte.d.ts +10 -0
- package/dist/components/core/nav/ui/mobile/nav-menu-drawer.svelte +85 -0
- package/dist/components/core/nav/ui/mobile/nav-menu-drawer.svelte.d.ts +9 -0
- package/dist/components/core/nav/ui/{nav-menu-bottom-bar.svelte → nav-menu-bottom-sidebar.svelte} +2 -2
- package/dist/components/core/nav/ui/nav-menu-bottom-sidebar.svelte.d.ts +10 -0
- package/dist/components/core/nav/ui/nav-menu-header-sidebar.svelte.d.ts +10 -0
- package/dist/components/core/nav/ui/{nav-menu-bar.svelte → nav-menu-sidebar.svelte} +7 -7
- package/dist/components/core/nav/ui/nav-menu-sidebar.svelte.d.ts +7 -0
- package/dist/components/core/nav/ui/nav-menu-top-bar-sidebar.svelte.d.ts +4 -0
- package/dist/components/core/nav/ui/nav-menu.svelte +98 -0
- package/dist/components/core/nav/ui/nav-menu.svelte.d.ts +4 -0
- package/dist/components/core/nav/ui/nav-user-sidebar.svelte +2 -2
- package/dist/components/core/nav/ui/nav-user-sidebar.svelte.d.ts +2 -2
- package/dist/components/core/panel/LeftHero.svelte +3 -3
- package/dist/components/core/panel/LeftHero.svelte.d.ts +2 -2
- package/dist/components/core/search/01/Search01.svelte +15 -0
- package/dist/components/core/search/01/Search01.svelte.d.ts +4 -0
- package/dist/components/core/search/02/Search02.svelte +15 -0
- package/dist/components/core/search/02/Search02.svelte.d.ts +4 -0
- package/dist/components/core/search/SearchInput.svelte +32 -0
- package/dist/components/core/search/SearchInput.svelte.d.ts +4 -0
- package/dist/components/core/search/shared/SearchInputCore.svelte +66 -0
- package/dist/components/core/search/shared/SearchInputCore.svelte.d.ts +4 -0
- package/dist/components/core/search/types.d.ts +15 -0
- package/dist/components/core/sidebar/MenuBarSidebar.svelte +14 -14
- package/dist/components/core/sidebar/MenuBarSidebar.svelte.d.ts +8 -8
- package/dist/components/pages/admin/{ui → 01/ui}/AdminContent.svelte +1 -1
- package/dist/components/pages/admin/{ui → 01/ui}/AdminContent.svelte.d.ts +1 -1
- package/dist/components/pages/admin/{ui → 01/ui}/AdminPanel.svelte +8 -8
- package/dist/components/pages/admin/{ui → 01/ui}/AdminPanel.svelte.d.ts +4 -4
- package/dist/components/pages/privacy-policy-or-terms-of-use/01/DocsSidebar.svelte +69 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/01/DocsSidebar.svelte.d.ts +10 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/01/PrivacyPolicyOrTermsOfUse01.svelte +73 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/01/PrivacyPolicyOrTermsOfUse01.svelte.d.ts +7 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/01/TableOfContents.svelte +37 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/01/TableOfContents.svelte.d.ts +8 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/02/DocsPageHero.svelte +59 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/02/DocsPageHero.svelte.d.ts +10 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/02/PageHero.svelte +51 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/02/PageHero.svelte.d.ts +14 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/02/PrivacyPolicyOrTermsOfUse02.svelte +24 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/02/PrivacyPolicyOrTermsOfUse02.svelte.d.ts +7 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/PrivacyPolicyOrTermsOfUse.svelte +32 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/PrivacyPolicyOrTermsOfUse.svelte.d.ts +4 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/shared/ContentBlockView.svelte +26 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/shared/ContentBlockView.svelte.d.ts +7 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/shared/DocSectionView.svelte +44 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/shared/DocSectionView.svelte.d.ts +7 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/shared/PrivacyPolicyOrTermsOfUseBreadcrumb.svelte +34 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/shared/PrivacyPolicyOrTermsOfUseBreadcrumb.svelte.d.ts +7 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/shared/toc.d.ts +8 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/shared/toc.js +14 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/types.d.ts +62 -0
- package/dist/components/pages/privacy-policy-or-terms-of-use/types.js +5 -0
- package/dist/components/pages/{forget-password → security/forget-password}/01/ui/ForgetPasswordCard.svelte +15 -10
- package/dist/components/pages/{forget-password → security/forget-password}/01/ui/ForgetPasswordCard.svelte.d.ts +0 -5
- package/dist/components/pages/{forget-password → security/forget-password}/01/ui/FormForgetPassword.svelte +15 -5
- package/dist/components/pages/{forget-password → security/forget-password}/01/ui/PageForgetPassword01.svelte +6 -6
- package/dist/components/pages/{forget-password → security/forget-password}/PageForgetPassword.svelte +10 -7
- package/dist/components/pages/{forget-password → security/forget-password}/PageForgetPassword.svelte.d.ts +0 -7
- package/dist/components/pages/{forget-password → security/forget-password}/types.d.ts +3 -3
- package/dist/components/pages/{login → security/login}/01/ui/FormLogin.svelte +19 -15
- package/dist/components/pages/{login → security/login}/01/ui/FormLogin.svelte.d.ts +0 -6
- package/dist/components/pages/{login → security/login}/01/ui/FormLoginEmailPassword.svelte +10 -1
- package/dist/components/pages/{login → security/login}/01/ui/FormLoginEmailPassword.svelte.d.ts +0 -1
- package/dist/components/pages/{login → security/login}/01/ui/FormLoginPhonePassword.svelte +10 -1
- package/dist/components/pages/{login → security/login}/01/ui/FormLoginPhonePassword.svelte.d.ts +0 -1
- package/dist/components/pages/{login → security/login}/01/ui/FormLoginUsernamePassword.svelte +10 -1
- package/dist/components/pages/{login → security/login}/01/ui/FormLoginUsernamePassword.svelte.d.ts +0 -1
- package/dist/components/pages/{login → security/login}/01/ui/FormRegister.svelte +5 -5
- package/dist/components/pages/{login → security/login}/01/ui/LoginCard.svelte +28 -20
- package/dist/components/pages/security/login/01/ui/LoginCard.svelte.d.ts +13 -0
- package/dist/components/pages/{login → security/login}/01/ui/PageLogin01.svelte +12 -11
- package/dist/components/pages/security/login/PageLogin.svelte +22 -0
- package/dist/components/pages/security/login/PageLogin.svelte.d.ts +8 -0
- package/dist/components/pages/security/login/types.d.ts +33 -0
- package/dist/components/pages/security/login/types.js +1 -0
- package/dist/components/pages/{otp-verification → security/otp-verification}/01/ui/FormOtpVerification.svelte +13 -3
- package/dist/components/pages/{otp-verification → security/otp-verification}/01/ui/OtpVerificationCard.svelte +15 -10
- package/dist/components/pages/{otp-verification → security/otp-verification}/01/ui/OtpVerificationCard.svelte.d.ts +0 -5
- package/dist/components/pages/{otp-verification → security/otp-verification}/01/ui/PageOtpVerification01.svelte +12 -6
- package/dist/components/pages/{otp-verification → security/otp-verification}/PageOtpVerification.svelte +10 -4
- package/dist/components/pages/{otp-verification → security/otp-verification}/PageOtpVerification.svelte.d.ts +0 -4
- package/dist/components/pages/{otp-verification → security/otp-verification}/types.d.ts +3 -3
- package/dist/components/pages/security/otp-verification/types.js +1 -0
- package/dist/components/pages/{reset-password → security/reset-password}/01/ui/FormResetPassword.svelte +15 -5
- package/dist/components/pages/{reset-password → security/reset-password}/01/ui/PageResetPassword01.svelte +12 -6
- package/dist/components/pages/{reset-password → security/reset-password}/01/ui/ResetPasswordCard.svelte +15 -10
- package/dist/components/pages/{reset-password → security/reset-password}/01/ui/ResetPasswordCard.svelte.d.ts +0 -5
- package/dist/components/pages/{reset-password → security/reset-password}/PageResetPassword.svelte +10 -4
- package/dist/components/pages/{reset-password → security/reset-password}/PageResetPassword.svelte.d.ts +0 -4
- package/dist/components/pages/{reset-password → security/reset-password}/types.d.ts +3 -3
- package/dist/components/pages/security/reset-password/types.js +1 -0
- package/dist/components/ui/button/button.svelte +82 -101
- package/dist/components/ui/button/button.svelte.d.ts +36 -63
- package/dist/components/ui/button/index.d.ts +2 -2
- package/dist/components/ui/button/index.js +2 -2
- package/dist/components/ui/carousel/carousel-content.svelte +43 -0
- package/dist/components/ui/carousel/carousel-content.svelte.d.ts +5 -0
- package/dist/components/ui/carousel/carousel-item.svelte +30 -0
- package/dist/components/ui/carousel/carousel-item.svelte.d.ts +5 -0
- package/dist/components/ui/carousel/carousel-next.svelte +40 -0
- package/dist/components/ui/carousel/carousel-next.svelte.d.ts +4 -0
- package/dist/components/ui/carousel/carousel-previous.svelte +40 -0
- package/dist/components/ui/carousel/carousel-previous.svelte.d.ts +4 -0
- package/dist/components/ui/carousel/carousel.svelte +94 -0
- package/dist/components/ui/carousel/carousel.svelte.d.ts +5 -0
- package/dist/components/ui/carousel/context.d.ts +31 -0
- package/dist/components/ui/carousel/context.js +12 -0
- package/dist/components/ui/carousel/index.d.ts +6 -0
- package/dist/components/ui/carousel/index.js +8 -0
- package/dist/components/ui/input-group/input-group-addon.svelte +6 -0
- package/dist/components/ui/input-group/input-group-addon.svelte.d.ts +6 -0
- package/dist/components/ui/light-switch/light-switch.svelte +17 -6
- package/dist/components/ui/light-switch/light-switch.svelte.d.ts +2 -2
- package/dist/components/ui/star-rating/index.d.ts +2 -0
- package/dist/components/ui/star-rating/index.js +2 -0
- package/dist/components/ui/star-rating/star-rating-star.svelte +41 -0
- package/dist/components/ui/star-rating/star-rating-star.svelte.d.ts +4 -0
- package/dist/components/ui/star-rating/star-rating.svelte +20 -0
- package/dist/components/ui/star-rating/star-rating.svelte.d.ts +4 -0
- package/dist/components/ui/star-rating/types.d.ts +5 -0
- package/dist/components/ui/star-rating/types.js +1 -0
- package/dist/globals.css +602 -36
- package/dist/hooks/responsive.svelte.d.ts +3 -0
- package/dist/hooks/responsive.svelte.js +18 -0
- package/dist/i18n/index.d.ts +2 -2
- package/dist/i18n/index.js +2 -2
- package/dist/i18n/langs/en.d.ts +22 -8
- package/dist/i18n/langs/en.js +22 -8
- package/dist/i18n/langs/pt.d.ts +22 -8
- package/dist/i18n/langs/pt.js +22 -8
- package/dist/i18n/translations.d.ts +44 -16
- package/dist/index.d.ts +14 -9
- package/dist/index.js +14 -9
- package/dist/styles/globals.css +143 -141
- package/dist/types/index.d.ts +4 -4
- package/package.json +11 -8
- package/dist/components/core/carousel/data/CarouselModel.d.ts +0 -11
- package/dist/components/core/nav/ui/nav-menu-bar.svelte.d.ts +0 -7
- package/dist/components/core/nav/ui/nav-menu-bottom-bar.svelte.d.ts +0 -10
- package/dist/components/core/nav/ui/nav-menu-header.svelte.d.ts +0 -10
- package/dist/components/core/nav/ui/nav-menu-top-bar.svelte.d.ts +0 -4
- package/dist/components/pages/login/01/ui/LoginCard.svelte.d.ts +0 -21
- package/dist/components/pages/login/PageLogin.svelte +0 -21
- package/dist/components/pages/login/PageLogin.svelte.d.ts +0 -17
- package/dist/components/pages/login/types.d.ts +0 -23
- /package/dist/components/{pages/forget-password → core/card}/types.js +0 -0
- /package/dist/components/{pages/login → core/carousel}/types.js +0 -0
- /package/dist/components/core/{carousel/data/CarouselModel.js → nav/data/nav-menu.js} +0 -0
- /package/dist/components/core/nav/ui/{nav-menu-header.svelte → nav-menu-header-sidebar.svelte} +0 -0
- /package/dist/components/core/nav/ui/{nav-menu-top-bar.svelte → nav-menu-top-bar-sidebar.svelte} +0 -0
- /package/dist/components/{pages/otp-verification → core/search}/types.js +0 -0
- /package/dist/components/pages/{forget-password → security/forget-password}/01/ui/FormForgetPassword.svelte.d.ts +0 -0
- /package/dist/components/pages/{forget-password → security/forget-password}/01/ui/PageForgetPassword01.svelte.d.ts +0 -0
- /package/dist/components/pages/{reset-password → security/forget-password}/types.js +0 -0
- /package/dist/components/pages/{login → security/login}/01/ui/FormRegister.svelte.d.ts +0 -0
- /package/dist/components/pages/{login → security/login}/01/ui/PageLogin01.svelte.d.ts +0 -0
- /package/dist/components/pages/{otp-verification → security/otp-verification}/01/ui/FormOtpVerification.svelte.d.ts +0 -0
- /package/dist/components/pages/{otp-verification → security/otp-verification}/01/ui/PageOtpVerification01.svelte.d.ts +0 -0
- /package/dist/components/pages/{reset-password → security/reset-password}/01/ui/FormResetPassword.svelte.d.ts +0 -0
- /package/dist/components/pages/{reset-password → security/reset-password}/01/ui/PageResetPassword01.svelte.d.ts +0 -0
|
@@ -1,101 +1,82 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export const buttonVariants = tv({
|
|
7
|
-
base: "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:
|
|
8
|
-
variants: {
|
|
9
|
-
variant: {
|
|
10
|
-
default:
|
|
11
|
-
outline:
|
|
12
|
-
|
|
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
|
-
|
|
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
|
-
|
|
82
|
-
|
|
83
|
-
aria-disabled={disabled}
|
|
84
|
-
role={disabled ? 'link' : undefined}
|
|
85
|
-
tabindex={disabled ? -1 : undefined}
|
|
86
|
-
{...restProps}
|
|
87
|
-
>
|
|
88
|
-
{@render children?.()}
|
|
89
|
-
</a>
|
|
90
|
-
{:else}
|
|
91
|
-
<button
|
|
92
|
-
bind:this={ref}
|
|
93
|
-
data-slot="button"
|
|
94
|
-
class={cn(buttonVariants({ variant, size }), className)}
|
|
95
|
-
{type}
|
|
96
|
-
{disabled}
|
|
97
|
-
{...restProps}
|
|
98
|
-
>
|
|
99
|
-
{@render children?.()}
|
|
100
|
-
</button>
|
|
101
|
-
{/if}
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { type VariantProps, tv } from "tailwind-variants";
|
|
3
|
+
import { cn, type WithElementRef } from "../../../utils.js";
|
|
4
|
+
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from "svelte/elements";
|
|
5
|
+
|
|
6
|
+
export const buttonVariants = tv({
|
|
7
|
+
base: "rounded-sm border border-transparent bg-clip-padding text-sm font-medium focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px aria-invalid:border-destructive aria-invalid:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap transition-all outline-none select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
|
11
|
+
outline: "border-border bg-input/30 hover:bg-input/50 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground",
|
|
12
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
|
13
|
+
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
|
14
|
+
destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
|
15
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
16
|
+
},
|
|
17
|
+
size: {
|
|
18
|
+
default: "h-9 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5",
|
|
19
|
+
xs: "h-6 gap-1 px-2.5 text-xs has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3",
|
|
20
|
+
sm: "h-8 gap-1 px-3 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
|
21
|
+
lg: "h-10 gap-1.5 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",
|
|
22
|
+
icon: "size-9",
|
|
23
|
+
"icon-xs": "size-6 [&_svg:not([class*='size-'])]:size-3",
|
|
24
|
+
"icon-sm": "size-8",
|
|
25
|
+
"icon-lg": "size-10",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
variant: "default",
|
|
30
|
+
size: "default",
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export type ButtonVariant = VariantProps<typeof buttonVariants>["variant"];
|
|
35
|
+
export type ButtonSize = VariantProps<typeof buttonVariants>["size"];
|
|
36
|
+
|
|
37
|
+
export type ButtonProps = WithElementRef<HTMLButtonAttributes> &
|
|
38
|
+
WithElementRef<HTMLAnchorAttributes> & {
|
|
39
|
+
variant?: ButtonVariant;
|
|
40
|
+
size?: ButtonSize;
|
|
41
|
+
};
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<script lang="ts">
|
|
45
|
+
let {
|
|
46
|
+
class: className,
|
|
47
|
+
variant = "default",
|
|
48
|
+
size = "default",
|
|
49
|
+
ref = $bindable(null),
|
|
50
|
+
href = undefined,
|
|
51
|
+
type = "button",
|
|
52
|
+
disabled,
|
|
53
|
+
children,
|
|
54
|
+
...restProps
|
|
55
|
+
}: ButtonProps = $props();
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
{#if href}
|
|
59
|
+
<a
|
|
60
|
+
bind:this={ref}
|
|
61
|
+
data-slot="button"
|
|
62
|
+
class={cn(buttonVariants({ variant, size }), className)}
|
|
63
|
+
href={disabled ? undefined : href}
|
|
64
|
+
aria-disabled={disabled}
|
|
65
|
+
role={disabled ? "link" : undefined}
|
|
66
|
+
tabindex={disabled ? -1 : undefined}
|
|
67
|
+
{...restProps}
|
|
68
|
+
>
|
|
69
|
+
{@render children?.()}
|
|
70
|
+
</a>
|
|
71
|
+
{:else}
|
|
72
|
+
<button
|
|
73
|
+
bind:this={ref}
|
|
74
|
+
data-slot="button"
|
|
75
|
+
class={cn(buttonVariants({ variant, size }), className)}
|
|
76
|
+
{type}
|
|
77
|
+
{disabled}
|
|
78
|
+
{...restProps}
|
|
79
|
+
>
|
|
80
|
+
{@render children?.()}
|
|
81
|
+
</button>
|
|
82
|
+
{/if}
|
|
@@ -1,93 +1,66 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { type VariantProps } from "tailwind-variants";
|
|
2
|
+
import { type WithElementRef } from "../../../utils.js";
|
|
3
|
+
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from "svelte/elements";
|
|
4
4
|
export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
5
5
|
variant: {
|
|
6
6
|
default: "bg-primary text-primary-foreground hover:bg-primary/80";
|
|
7
|
-
outline: "border-border bg-
|
|
7
|
+
outline: "border-border bg-input/30 hover:bg-input/50 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground";
|
|
8
8
|
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground";
|
|
9
|
-
ghost: "hover:bg-muted hover:text-foreground
|
|
10
|
-
destructive: "bg-destructive/10 hover:bg-destructive/20 focus-visible:
|
|
9
|
+
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50";
|
|
10
|
+
destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40";
|
|
11
11
|
link: "text-primary underline-offset-4 hover:underline";
|
|
12
12
|
};
|
|
13
13
|
size: {
|
|
14
|
-
default: "h-9 gap-1.5 px-
|
|
15
|
-
xs: "h-6 gap-1
|
|
16
|
-
sm: "h-8 gap-1
|
|
17
|
-
lg: "h-10 gap-1.5 px-
|
|
14
|
+
default: "h-9 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5";
|
|
15
|
+
xs: "h-6 gap-1 px-2.5 text-xs has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3";
|
|
16
|
+
sm: "h-8 gap-1 px-3 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2";
|
|
17
|
+
lg: "h-10 gap-1.5 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3";
|
|
18
18
|
icon: "size-9";
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
"icon-xs": "size-6 [&_svg:not([class*='size-'])]:size-3";
|
|
20
|
+
"icon-sm": "size-8";
|
|
21
|
+
"icon-lg": "size-10";
|
|
22
22
|
};
|
|
23
|
-
}, undefined, "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:
|
|
23
|
+
}, undefined, "rounded-sm border border-transparent bg-clip-padding text-sm font-medium focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px aria-invalid:border-destructive aria-invalid:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 group/button inline-flex shrink-0 items-center justify-center whitespace-nowrap transition-all outline-none select-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", {
|
|
24
24
|
variant: {
|
|
25
25
|
default: "bg-primary text-primary-foreground hover:bg-primary/80";
|
|
26
|
-
outline: "border-border bg-
|
|
26
|
+
outline: "border-border bg-input/30 hover:bg-input/50 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground";
|
|
27
27
|
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground";
|
|
28
|
-
ghost: "hover:bg-muted hover:text-foreground
|
|
29
|
-
destructive: "bg-destructive/10 hover:bg-destructive/20 focus-visible:
|
|
28
|
+
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50";
|
|
29
|
+
destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40";
|
|
30
30
|
link: "text-primary underline-offset-4 hover:underline";
|
|
31
31
|
};
|
|
32
32
|
size: {
|
|
33
|
-
default: "h-9 gap-1.5 px-
|
|
34
|
-
xs: "h-6 gap-1
|
|
35
|
-
sm: "h-8 gap-1
|
|
36
|
-
lg: "h-10 gap-1.5 px-
|
|
33
|
+
default: "h-9 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5";
|
|
34
|
+
xs: "h-6 gap-1 px-2.5 text-xs has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3";
|
|
35
|
+
sm: "h-8 gap-1 px-3 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2";
|
|
36
|
+
lg: "h-10 gap-1.5 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3";
|
|
37
37
|
icon: "size-9";
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
"icon-xs": "size-6 [&_svg:not([class*='size-'])]:size-3";
|
|
39
|
+
"icon-sm": "size-8";
|
|
40
|
+
"icon-lg": "size-10";
|
|
41
41
|
};
|
|
42
42
|
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
43
43
|
variant: {
|
|
44
44
|
default: "bg-primary text-primary-foreground hover:bg-primary/80";
|
|
45
|
-
outline: "border-border bg-
|
|
45
|
+
outline: "border-border bg-input/30 hover:bg-input/50 hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground";
|
|
46
46
|
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground";
|
|
47
|
-
ghost: "hover:bg-muted hover:text-foreground
|
|
48
|
-
destructive: "bg-destructive/10 hover:bg-destructive/20 focus-visible:
|
|
47
|
+
ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50";
|
|
48
|
+
destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40";
|
|
49
49
|
link: "text-primary underline-offset-4 hover:underline";
|
|
50
50
|
};
|
|
51
51
|
size: {
|
|
52
|
-
default: "h-9 gap-1.5 px-
|
|
53
|
-
xs: "h-6 gap-1
|
|
54
|
-
sm: "h-8 gap-1
|
|
55
|
-
lg: "h-10 gap-1.5 px-
|
|
52
|
+
default: "h-9 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5";
|
|
53
|
+
xs: "h-6 gap-1 px-2.5 text-xs has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3";
|
|
54
|
+
sm: "h-8 gap-1 px-3 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2";
|
|
55
|
+
lg: "h-10 gap-1.5 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3";
|
|
56
56
|
icon: "size-9";
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
"icon-xs": "size-6 [&_svg:not([class*='size-'])]:size-3";
|
|
58
|
+
"icon-sm": "size-8";
|
|
59
|
+
"icon-lg": "size-10";
|
|
60
60
|
};
|
|
61
61
|
}, undefined>>;
|
|
62
|
-
export type ButtonVariant = VariantProps<typeof buttonVariants>[
|
|
63
|
-
export type ButtonSize =
|
|
64
|
-
export type Size = ButtonSize;
|
|
65
|
-
export declare const sizeMap: {
|
|
66
|
-
default: {
|
|
67
|
-
icon: ButtonSize;
|
|
68
|
-
};
|
|
69
|
-
xs: {
|
|
70
|
-
icon: ButtonSize;
|
|
71
|
-
};
|
|
72
|
-
sm: {
|
|
73
|
-
icon: ButtonSize;
|
|
74
|
-
};
|
|
75
|
-
lg: {
|
|
76
|
-
icon: ButtonSize;
|
|
77
|
-
};
|
|
78
|
-
icon: {
|
|
79
|
-
icon: ButtonSize;
|
|
80
|
-
};
|
|
81
|
-
"icon-xs": {
|
|
82
|
-
icon: ButtonSize;
|
|
83
|
-
};
|
|
84
|
-
"icon-sm": {
|
|
85
|
-
icon: ButtonSize;
|
|
86
|
-
};
|
|
87
|
-
"icon-lg": {
|
|
88
|
-
icon: ButtonSize;
|
|
89
|
-
};
|
|
90
|
-
};
|
|
62
|
+
export type ButtonVariant = VariantProps<typeof buttonVariants>["variant"];
|
|
63
|
+
export type ButtonSize = VariantProps<typeof buttonVariants>["size"];
|
|
91
64
|
export type ButtonProps = WithElementRef<HTMLButtonAttributes> & WithElementRef<HTMLAnchorAttributes> & {
|
|
92
65
|
variant?: ButtonVariant;
|
|
93
66
|
size?: ButtonSize;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import Root, { type ButtonProps, type ButtonSize, type ButtonVariant, buttonVariants } from
|
|
2
|
-
export { Root, type ButtonProps as Props, Root as Button, buttonVariants, type ButtonProps, type ButtonSize, type ButtonVariant };
|
|
1
|
+
import Root, { type ButtonProps, type ButtonSize, type ButtonVariant, buttonVariants } from "./button.svelte";
|
|
2
|
+
export { Root, type ButtonProps as Props, Root as Button, buttonVariants, type ButtonProps, type ButtonSize, type ButtonVariant, };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import emblaCarouselSvelte from "embla-carousel-svelte";
|
|
3
|
+
import { cn, type WithElementRef } from "../../../utils.js";
|
|
4
|
+
import { getEmblaContext } from "./context.js";
|
|
5
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
class: className,
|
|
10
|
+
children,
|
|
11
|
+
...restProps
|
|
12
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
|
|
13
|
+
|
|
14
|
+
const emblaCtx = getEmblaContext("<Carousel.Content/>");
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<div
|
|
18
|
+
data-slot="carousel-content"
|
|
19
|
+
class="overflow-hidden"
|
|
20
|
+
use:emblaCarouselSvelte={{
|
|
21
|
+
options: {
|
|
22
|
+
container: "[data-embla-container]",
|
|
23
|
+
slides: "[data-embla-slide]",
|
|
24
|
+
...emblaCtx.options,
|
|
25
|
+
axis: emblaCtx.orientation === "horizontal" ? "x" : "y",
|
|
26
|
+
},
|
|
27
|
+
plugins: emblaCtx.plugins,
|
|
28
|
+
}}
|
|
29
|
+
onemblaInit={emblaCtx.onInit}
|
|
30
|
+
>
|
|
31
|
+
<div
|
|
32
|
+
bind:this={ref}
|
|
33
|
+
class={cn(
|
|
34
|
+
"flex",
|
|
35
|
+
emblaCtx.orientation === "horizontal" ? "-ms-4" : "-mt-4 flex-col",
|
|
36
|
+
className
|
|
37
|
+
)}
|
|
38
|
+
data-embla-container=""
|
|
39
|
+
{...restProps}
|
|
40
|
+
>
|
|
41
|
+
{@render children?.()}
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type WithElementRef } from "../../../utils.js";
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
declare const CarouselContent: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLDivElement>>, {}, "ref">;
|
|
4
|
+
type CarouselContent = ReturnType<typeof CarouselContent>;
|
|
5
|
+
export default CarouselContent;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from "../../../utils.js";
|
|
3
|
+
import { getEmblaContext } from "./context.js";
|
|
4
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
children,
|
|
10
|
+
...restProps
|
|
11
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
|
|
12
|
+
|
|
13
|
+
const emblaCtx = getEmblaContext("<Carousel.Item/>");
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<div
|
|
17
|
+
bind:this={ref}
|
|
18
|
+
data-slot="carousel-item"
|
|
19
|
+
role="group"
|
|
20
|
+
aria-roledescription="slide"
|
|
21
|
+
class={cn(
|
|
22
|
+
"min-w-0 shrink-0 grow-0 basis-full",
|
|
23
|
+
emblaCtx.orientation === "horizontal" ? "ps-4" : "pt-4",
|
|
24
|
+
className
|
|
25
|
+
)}
|
|
26
|
+
data-embla-slide=""
|
|
27
|
+
{...restProps}
|
|
28
|
+
>
|
|
29
|
+
{@render children?.()}
|
|
30
|
+
</div>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type WithElementRef } from "../../../utils.js";
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
declare const CarouselItem: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLDivElement>>, {}, "ref">;
|
|
4
|
+
type CarouselItem = ReturnType<typeof CarouselItem>;
|
|
5
|
+
export default CarouselItem;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { HugeiconsIcon } from "@hugeicons/svelte"
|
|
3
|
+
import { ArrowRight01Icon } from '@hugeicons/core-free-icons';
|
|
4
|
+
import { Button, type Props } from "../button/index.js";
|
|
5
|
+
import { cn } from "../../../utils.js";
|
|
6
|
+
import { getEmblaContext } from "./context.js";
|
|
7
|
+
import type { WithoutChildren } from "bits-ui";
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
ref = $bindable(null),
|
|
11
|
+
class: className,
|
|
12
|
+
variant = "outline",
|
|
13
|
+
size = "icon-sm",
|
|
14
|
+
...restProps
|
|
15
|
+
}: WithoutChildren<Props> = $props();
|
|
16
|
+
|
|
17
|
+
const emblaCtx = getEmblaContext("<Carousel.Next/>");
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<Button
|
|
21
|
+
data-slot="carousel-next"
|
|
22
|
+
{variant}
|
|
23
|
+
{size}
|
|
24
|
+
aria-disabled={!emblaCtx.canScrollNext}
|
|
25
|
+
disabled={!emblaCtx.canScrollNext}
|
|
26
|
+
class={cn(
|
|
27
|
+
"rounded-full absolute touch-manipulation",
|
|
28
|
+
emblaCtx.orientation === "horizontal"
|
|
29
|
+
? "inset-y-0 -end-12 my-auto"
|
|
30
|
+
: "start-1/2 -bottom-12 -translate-x-1/2 rotate-90",
|
|
31
|
+
className
|
|
32
|
+
)}
|
|
33
|
+
onclick={emblaCtx.scrollNext}
|
|
34
|
+
onkeydown={emblaCtx.handleKeyDown}
|
|
35
|
+
bind:ref
|
|
36
|
+
{...restProps}
|
|
37
|
+
>
|
|
38
|
+
<HugeiconsIcon icon={ArrowRight01Icon} strokeWidth={2} />
|
|
39
|
+
<span class="sr-only">Next slide</span>
|
|
40
|
+
</Button>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { HugeiconsIcon } from "@hugeicons/svelte"
|
|
3
|
+
import { ArrowLeft01Icon } from '@hugeicons/core-free-icons';
|
|
4
|
+
import { Button, type Props } from "../button/index.js";
|
|
5
|
+
import { cn } from "../../../utils.js";
|
|
6
|
+
import { getEmblaContext } from "./context.js";
|
|
7
|
+
import type { WithoutChildren } from "bits-ui";
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
ref = $bindable(null),
|
|
11
|
+
class: className,
|
|
12
|
+
variant = "outline",
|
|
13
|
+
size = "icon-sm",
|
|
14
|
+
...restProps
|
|
15
|
+
}: WithoutChildren<Props> = $props();
|
|
16
|
+
|
|
17
|
+
const emblaCtx = getEmblaContext("<Carousel.Previous/>");
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<Button
|
|
21
|
+
data-slot="carousel-previous"
|
|
22
|
+
{variant}
|
|
23
|
+
{size}
|
|
24
|
+
aria-disabled={!emblaCtx.canScrollPrev}
|
|
25
|
+
disabled={!emblaCtx.canScrollPrev}
|
|
26
|
+
class={cn(
|
|
27
|
+
"rounded-full absolute touch-manipulation",
|
|
28
|
+
emblaCtx.orientation === "horizontal"
|
|
29
|
+
? "inset-y-0 -start-12 my-auto"
|
|
30
|
+
: "start-1/2 -top-12 -translate-x-1/2 rotate-90",
|
|
31
|
+
className
|
|
32
|
+
)}
|
|
33
|
+
onclick={emblaCtx.scrollPrev}
|
|
34
|
+
onkeydown={emblaCtx.handleKeyDown}
|
|
35
|
+
{...restProps}
|
|
36
|
+
bind:ref
|
|
37
|
+
>
|
|
38
|
+
<HugeiconsIcon icon={ArrowLeft01Icon} strokeWidth={2} />
|
|
39
|
+
<span class="sr-only">Previous slide</span>
|
|
40
|
+
</Button>
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from "../../../utils.js";
|
|
3
|
+
import {
|
|
4
|
+
type CarouselAPI,
|
|
5
|
+
type CarouselProps,
|
|
6
|
+
type EmblaContext,
|
|
7
|
+
setEmblaContext,
|
|
8
|
+
} from "./context.js";
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
ref = $bindable(null),
|
|
12
|
+
opts = {},
|
|
13
|
+
plugins = [],
|
|
14
|
+
setApi = () => {},
|
|
15
|
+
orientation = "horizontal",
|
|
16
|
+
class: className,
|
|
17
|
+
children,
|
|
18
|
+
...restProps
|
|
19
|
+
}: WithElementRef<CarouselProps> = $props();
|
|
20
|
+
|
|
21
|
+
// svelte-ignore state_referenced_locally
|
|
22
|
+
let carouselState = $state<EmblaContext>({
|
|
23
|
+
api: undefined,
|
|
24
|
+
scrollPrev,
|
|
25
|
+
scrollNext,
|
|
26
|
+
orientation,
|
|
27
|
+
canScrollNext: false,
|
|
28
|
+
canScrollPrev: false,
|
|
29
|
+
handleKeyDown,
|
|
30
|
+
options: opts,
|
|
31
|
+
plugins,
|
|
32
|
+
onInit,
|
|
33
|
+
scrollSnaps: [],
|
|
34
|
+
selectedIndex: 0,
|
|
35
|
+
scrollTo,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
setEmblaContext(carouselState);
|
|
39
|
+
|
|
40
|
+
function scrollPrev() {
|
|
41
|
+
carouselState.api?.scrollPrev();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function scrollNext() {
|
|
45
|
+
carouselState.api?.scrollNext();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function scrollTo(index: number, jump?: boolean) {
|
|
49
|
+
carouselState.api?.scrollTo(index, jump);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function onSelect() {
|
|
53
|
+
if (!carouselState.api) return;
|
|
54
|
+
carouselState.selectedIndex = carouselState.api.selectedScrollSnap();
|
|
55
|
+
carouselState.canScrollNext = carouselState.api.canScrollNext();
|
|
56
|
+
carouselState.canScrollPrev = carouselState.api.canScrollPrev();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function handleKeyDown(e: KeyboardEvent) {
|
|
60
|
+
if (e.key === "ArrowLeft") {
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
scrollPrev();
|
|
63
|
+
} else if (e.key === "ArrowRight") {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
scrollNext();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function onInit(event: CustomEvent<CarouselAPI>) {
|
|
70
|
+
carouselState.api = event.detail;
|
|
71
|
+
setApi(carouselState.api);
|
|
72
|
+
|
|
73
|
+
carouselState.scrollSnaps = carouselState.api.scrollSnapList();
|
|
74
|
+
carouselState.api.on("select", onSelect);
|
|
75
|
+
onSelect();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
$effect(() => {
|
|
79
|
+
return () => {
|
|
80
|
+
carouselState.api?.off("select", onSelect);
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<div
|
|
86
|
+
bind:this={ref}
|
|
87
|
+
data-slot="carousel"
|
|
88
|
+
class={cn("relative", className)}
|
|
89
|
+
role="region"
|
|
90
|
+
aria-roledescription="carousel"
|
|
91
|
+
{...restProps}
|
|
92
|
+
>
|
|
93
|
+
{@render children?.()}
|
|
94
|
+
</div>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type WithElementRef } from "../../../utils.js";
|
|
2
|
+
import { type CarouselProps } from "./context.js";
|
|
3
|
+
declare const Carousel: import("svelte").Component<WithElementRef<CarouselProps>, {}, "ref">;
|
|
4
|
+
type Carousel = ReturnType<typeof Carousel>;
|
|
5
|
+
export default Carousel;
|