negodesign 0.0.36 → 0.0.38

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.
Files changed (39) hide show
  1. package/dist/components/core/card/shared/CardDescription.svelte +1 -1
  2. package/dist/components/core/carousel/grid/media/ui/CarouselGridMedia.svelte +38 -28
  3. package/dist/components/core/carousel/grid/product/ui/CarouselGridProduct.svelte +48 -38
  4. package/dist/components/core/carousel/grid/profile/ui/CarouselGridProfile.svelte +56 -46
  5. package/dist/components/core/carousel/grid/promotion/ui/CarouselGridPromotion.svelte +46 -28
  6. package/dist/components/core/carousel/highlights/ui/CarouselHighlights.svelte +57 -47
  7. package/dist/components/core/carousel/product/ui/CarouselProduct.svelte +57 -47
  8. package/dist/components/core/carousel/promotion/types.d.ts +5 -0
  9. package/dist/components/core/carousel/promotion/ui/CarouselPromotion.svelte +67 -47
  10. package/dist/components/core/panel/NotFoundEmpty.svelte +76 -0
  11. package/dist/components/core/panel/NotFoundEmpty.svelte.d.ts +16 -0
  12. package/dist/components/pages/company-profile/CompanyProfile.svelte +13 -9
  13. package/dist/components/pages/company-profile/data.js +47 -0
  14. package/dist/components/pages/company-profile/shared/ProfileBanner.svelte +136 -60
  15. package/dist/components/pages/company-profile/shared/ProfileProducts.svelte +62 -0
  16. package/dist/components/pages/company-profile/shared/ProfileProducts.svelte.d.ts +9 -0
  17. package/dist/components/pages/company-profile/shared/ProfileSidebar.svelte +1 -1
  18. package/dist/components/pages/company-profile/types.d.ts +25 -5
  19. package/dist/components/ui/empty/empty-content.svelte +23 -0
  20. package/dist/components/ui/empty/empty-content.svelte.d.ts +5 -0
  21. package/dist/components/ui/empty/empty-description.svelte +23 -0
  22. package/dist/components/ui/empty/empty-description.svelte.d.ts +5 -0
  23. package/dist/components/ui/empty/empty-header.svelte +20 -0
  24. package/dist/components/ui/empty/empty-header.svelte.d.ts +5 -0
  25. package/dist/components/ui/empty/empty-media.svelte +41 -0
  26. package/dist/components/ui/empty/empty-media.svelte.d.ts +26 -0
  27. package/dist/components/ui/empty/empty-title.svelte +20 -0
  28. package/dist/components/ui/empty/empty-title.svelte.d.ts +5 -0
  29. package/dist/components/ui/empty/empty.svelte +23 -0
  30. package/dist/components/ui/empty/empty.svelte.d.ts +5 -0
  31. package/dist/components/ui/empty/index.d.ts +7 -0
  32. package/dist/components/ui/empty/index.js +9 -0
  33. package/dist/globals.css +60 -0
  34. package/dist/i18n/langs/en.d.ts +15 -0
  35. package/dist/i18n/langs/en.js +15 -0
  36. package/dist/i18n/langs/pt.d.ts +15 -0
  37. package/dist/i18n/langs/pt.js +15 -0
  38. package/dist/i18n/translations.d.ts +30 -0
  39. package/package.json +1 -1
@@ -36,6 +36,6 @@
36
36
  <TruncatableText
37
37
  text={content}
38
38
  {lines}
39
- class="text-justify text-[13px] md:text-[14px] text-gray-800 dark:text-gray-50 mt-3 my-2"
39
+ class="text-justify text-[13px] md:text-[14px] text-gray-800 dark:text-gray-50 mt-3 my-2 h-[65px] mb-1"
40
40
  />
41
41
  {/if}
@@ -1,8 +1,10 @@
1
1
  <script lang="ts">
2
2
  import CarouselGridSlot from "../../shared/ui/CarouselGridSlot.svelte";
3
- import * as Carousel from "../../../../../ui/carousel/index.js";
4
3
  import CarouselHeader from "../../../shared/ui/CarouselHeader.svelte";
4
+ import NotFoundEmpty from "../../../../panel/NotFoundEmpty.svelte";
5
+ import * as Carousel from "../../../../../ui/carousel/index.js";
5
6
  import { useDevice } from "../../../../../../hooks/responsive.svelte";
7
+ import { t } from "../../../../../../i18n";
6
8
  import CardMedia from "../../../../card/media/CardMedia.svelte";
7
9
  import type { CarouselGridMediaProps } from "../../../../../../types";
8
10
 
@@ -16,34 +18,42 @@
16
18
  }: CarouselGridMediaProps = $props();
17
19
 
18
20
  const responsive = useDevice();
21
+ const isEmpty = $derived(!isLoading && (!items || items.length === 0));
19
22
  </script>
20
23
 
21
24
  <CarouselHeader {...headerProps}>
22
- <CarouselGridSlot {slotProps} {gridClass} totalItems={items.length}>
23
- {#if isLoading}
24
- {#each Array.from( { length: responsive.isMobile ? 3 : 6 }, ) as _, i (`loading-${i}`)}
25
- {#if responsive.isMobile}
26
- <Carousel.Item class="pl-2 basis-auto">
27
- <CardMedia id={i} {variant} isLoading />
28
- </Carousel.Item>
29
- {:else}
30
- <div>
31
- <CardMedia id={i} {variant} isLoading />
32
- </div>
33
- {/if}
34
- {/each}
35
- {:else}
36
- {#each items as item, i (`media-${item.id ?? i}`)}
37
- {#if responsive.isMobile}
38
- <Carousel.Item class="pl-2 basis-auto">
39
- <CardMedia {...item} {variant} />
40
- </Carousel.Item>
41
- {:else}
42
- <div>
43
- <CardMedia {...item} {variant} />
44
- </div>
45
- {/if}
46
- {/each}
47
- {/if}
48
- </CarouselGridSlot>
25
+ {#if isEmpty}
26
+ <NotFoundEmpty
27
+ title={$t("empty.media.title")}
28
+ description={$t("empty.media.description")}
29
+ />
30
+ {:else}
31
+ <CarouselGridSlot {slotProps} {gridClass} totalItems={items?.length ?? 0}>
32
+ {#if isLoading}
33
+ {#each Array.from( { length: responsive.isMobile ? 3 : 6 }, ) as _, i (`loading-${i}`)}
34
+ {#if responsive.isMobile}
35
+ <Carousel.Item class="pl-2 basis-auto">
36
+ <CardMedia id={i} {variant} isLoading />
37
+ </Carousel.Item>
38
+ {:else}
39
+ <div>
40
+ <CardMedia id={i} {variant} isLoading />
41
+ </div>
42
+ {/if}
43
+ {/each}
44
+ {:else}
45
+ {#each items as item, i (`media-${item.id ?? i}`)}
46
+ {#if responsive.isMobile}
47
+ <Carousel.Item class="pl-2 basis-auto">
48
+ <CardMedia {...item} {variant} />
49
+ </Carousel.Item>
50
+ {:else}
51
+ <div>
52
+ <CardMedia {...item} {variant} />
53
+ </div>
54
+ {/if}
55
+ {/each}
56
+ {/if}
57
+ </CarouselGridSlot>
58
+ {/if}
49
59
  </CarouselHeader>
@@ -1,8 +1,10 @@
1
1
  <script lang="ts">
2
2
  import CarouselGridSlot from "../../shared/ui/CarouselGridSlot.svelte";
3
- import * as Carousel from "../../../../../ui/carousel/index.js";
4
3
  import CarouselHeader from "../../../shared/ui/CarouselHeader.svelte";
4
+ import NotFoundEmpty from "../../../../panel/NotFoundEmpty.svelte";
5
+ import * as Carousel from "../../../../../ui/carousel/index.js";
5
6
  import { useDevice } from "../../../../../../hooks/responsive.svelte";
7
+ import { t } from "../../../../../../i18n";
6
8
  import CardProduct from "../../../../card/product/CardProduct.svelte";
7
9
  import type { CarouselGridProductProps } from "../types";
8
10
 
@@ -18,44 +20,52 @@
18
20
  }: CarouselGridProductProps = $props();
19
21
 
20
22
  const responsive = useDevice();
23
+ const isEmpty = $derived(!isLoading && (!items || items.length === 0));
21
24
  </script>
22
25
 
23
26
  <CarouselHeader {...headerProps}>
24
- <CarouselGridSlot {slotProps} {gridClass} totalItems={items.length}>
25
- {#if isLoading}
26
- {#each Array.from( { length: responsive.isMobile ? 3 : 6 }, ) as _, i (`loading-${i}`)}
27
- {#if responsive.isMobile}
28
- <Carousel.Item class="pl-2 basis-auto">
29
- <CardProduct id={i} {variant} isLoading />
30
- </Carousel.Item>
31
- {:else}
32
- <div>
33
- <CardProduct id={i} {variant} isLoading />
34
- </div>
35
- {/if}
36
- {/each}
37
- {:else}
38
- {#each items as item, i (`profile-${item.id ?? i}`)}
39
- {#if responsive.isMobile}
40
- <Carousel.Item class="pl-2 basis-auto">
41
- <CardProduct
42
- {...item}
43
- {variant}
44
- {isDescriptionIcon}
45
- {isDescriptionLabel}
46
- />
47
- </Carousel.Item>
48
- {:else}
49
- <div>
50
- <CardProduct
51
- {...item}
52
- {variant}
53
- {isDescriptionIcon}
54
- {isDescriptionLabel}
55
- />
56
- </div>
57
- {/if}
58
- {/each}
59
- {/if}
60
- </CarouselGridSlot>
27
+ {#if isEmpty}
28
+ <NotFoundEmpty
29
+ title={$t("empty.products.title")}
30
+ description={$t("empty.products.description")}
31
+ />
32
+ {:else}
33
+ <CarouselGridSlot {slotProps} {gridClass} totalItems={items?.length ?? 0}>
34
+ {#if isLoading}
35
+ {#each Array.from( { length: responsive.isMobile ? 3 : 6 }, ) as _, i (`loading-${i}`)}
36
+ {#if responsive.isMobile}
37
+ <Carousel.Item class="pl-2 basis-auto">
38
+ <CardProduct id={i} {variant} isLoading />
39
+ </Carousel.Item>
40
+ {:else}
41
+ <div>
42
+ <CardProduct id={i} {variant} isLoading />
43
+ </div>
44
+ {/if}
45
+ {/each}
46
+ {:else}
47
+ {#each items as item, i (`product-${item.id ?? i}`)}
48
+ {#if responsive.isMobile}
49
+ <Carousel.Item class="pl-2 basis-auto">
50
+ <CardProduct
51
+ {...item}
52
+ {variant}
53
+ {isDescriptionIcon}
54
+ {isDescriptionLabel}
55
+ />
56
+ </Carousel.Item>
57
+ {:else}
58
+ <div>
59
+ <CardProduct
60
+ {...item}
61
+ {variant}
62
+ {isDescriptionIcon}
63
+ {isDescriptionLabel}
64
+ />
65
+ </div>
66
+ {/if}
67
+ {/each}
68
+ {/if}
69
+ </CarouselGridSlot>
70
+ {/if}
61
71
  </CarouselHeader>
@@ -1,8 +1,10 @@
1
1
  <script lang="ts">
2
2
  import CarouselGridSlot from "../../shared/ui/CarouselGridSlot.svelte";
3
- import * as Carousel from "../../../../../ui/carousel/index.js";
4
3
  import CarouselHeader from "../../../shared/ui/CarouselHeader.svelte";
4
+ import NotFoundEmpty from "../../../../panel/NotFoundEmpty.svelte";
5
+ import * as Carousel from "../../../../../ui/carousel/index.js";
5
6
  import { useDevice } from "../../../../../../hooks/responsive.svelte";
7
+ import { t } from "../../../../../../i18n";
6
8
  import CardProfile from "../../../../card/profile/CardProfile.svelte";
7
9
  import type { CarouselGridProfileProps } from "../../../../../../types";
8
10
 
@@ -22,52 +24,60 @@
22
24
  }: CarouselGridProfileProps = $props();
23
25
 
24
26
  const responsive = useDevice();
27
+ const isEmpty = $derived(!isLoading && (!items || items.length === 0));
25
28
  </script>
26
29
 
27
30
  <CarouselHeader {...headerProps}>
28
- <CarouselGridSlot {slotProps} {gridClass} totalItems={items.length}>
29
- {#if isLoading}
30
- {#each Array.from( { length: responsive.isMobile ? 3 : 6 }, ) as _, i (`loading-${i}`)}
31
- {#if responsive.isMobile}
32
- <Carousel.Item class="pl-2 basis-auto">
33
- <CardProfile id={i} {variant} isLoading />
34
- </Carousel.Item>
35
- {:else}
36
- <div>
37
- <CardProfile id={i} {variant} isLoading />
38
- </div>
39
- {/if}
40
- {/each}
41
- {:else}
42
- {#each items as item, i (`profile-${item.id ?? i}`)}
43
- {#if responsive.isMobile}
44
- <Carousel.Item class="pl-2 basis-auto">
45
- <CardProfile
46
- {...item}
47
- {variant}
48
- {isDescriptionIcon}
49
- {isDescriptionLabel}
50
- {onEmailClick}
51
- {onWhatsappClick}
52
- {onButtonProfile}
53
- {onFavoriteClick}
54
- />
55
- </Carousel.Item>
56
- {:else}
57
- <div>
58
- <CardProfile
59
- {...item}
60
- {variant}
61
- {isDescriptionIcon}
62
- {isDescriptionLabel}
63
- {onEmailClick}
64
- {onWhatsappClick}
65
- {onButtonProfile}
66
- {onFavoriteClick}
67
- />
68
- </div>
69
- {/if}
70
- {/each}
71
- {/if}
72
- </CarouselGridSlot>
31
+ {#if isEmpty}
32
+ <NotFoundEmpty
33
+ title={$t("empty.profiles.title")}
34
+ description={$t("empty.profiles.description")}
35
+ />
36
+ {:else}
37
+ <CarouselGridSlot {slotProps} {gridClass} totalItems={items?.length ?? 0}>
38
+ {#if isLoading}
39
+ {#each Array.from( { length: responsive.isMobile ? 3 : 6 }, ) as _, i (`loading-${i}`)}
40
+ {#if responsive.isMobile}
41
+ <Carousel.Item class="pl-2 basis-auto">
42
+ <CardProfile id={i} {variant} isLoading />
43
+ </Carousel.Item>
44
+ {:else}
45
+ <div>
46
+ <CardProfile id={i} {variant} isLoading />
47
+ </div>
48
+ {/if}
49
+ {/each}
50
+ {:else}
51
+ {#each items as item, i (`profile-${item.id ?? i}`)}
52
+ {#if responsive.isMobile}
53
+ <Carousel.Item class="pl-2 basis-auto">
54
+ <CardProfile
55
+ {...item}
56
+ {variant}
57
+ {isDescriptionIcon}
58
+ {isDescriptionLabel}
59
+ {onEmailClick}
60
+ {onWhatsappClick}
61
+ {onButtonProfile}
62
+ {onFavoriteClick}
63
+ />
64
+ </Carousel.Item>
65
+ {:else}
66
+ <div>
67
+ <CardProfile
68
+ {...item}
69
+ {variant}
70
+ {isDescriptionIcon}
71
+ {isDescriptionLabel}
72
+ {onEmailClick}
73
+ {onWhatsappClick}
74
+ {onButtonProfile}
75
+ {onFavoriteClick}
76
+ />
77
+ </div>
78
+ {/if}
79
+ {/each}
80
+ {/if}
81
+ </CarouselGridSlot>
82
+ {/if}
73
83
  </CarouselHeader>
@@ -1,8 +1,10 @@
1
1
  <script lang="ts">
2
2
  import CarouselGridSlot from "../../shared/ui/CarouselGridSlot.svelte";
3
- import * as Carousel from "../../../../../ui/carousel/index.js";
4
3
  import CarouselHeader from "../../../shared/ui/CarouselHeader.svelte";
4
+ import NotFoundEmpty from "../../../../panel/NotFoundEmpty.svelte";
5
+ import * as Carousel from "../../../../../ui/carousel/index.js";
5
6
  import { useDevice } from "../../../../../../hooks/responsive.svelte";
7
+ import { t } from "../../../../../../i18n";
6
8
  import CardPromotion from "../../../../card/promotion/CardPromotion.svelte";
7
9
  import type { CarouselGridPromotionProps } from "../types";
8
10
 
@@ -17,34 +19,50 @@
17
19
  }: CarouselGridPromotionProps = $props();
18
20
 
19
21
  const responsive = useDevice();
22
+ const isEmpty = $derived(!isLoading && (!items || items.length === 0));
20
23
  </script>
21
24
 
22
25
  <CarouselHeader {...headerProps}>
23
- <CarouselGridSlot {slotProps} {gridClass} totalItems={items.length}>
24
- {#if isLoading}
25
- {#each Array.from( { length: responsive.isMobile ? 3 : 6 }, ) as _, i (`loading-${i}`)}
26
- {#if responsive.isMobile}
27
- <Carousel.Item class="pl-2 basis-auto">
28
- <CardPromotion id={i} isLoading />
29
- </Carousel.Item>
30
- {:else}
31
- <div>
32
- <CardPromotion id={i} isLoading />
33
- </div>
34
- {/if}
35
- {/each}
36
- {:else}
37
- {#each items as item, i (`promotion-${item.id ?? i}`)}
38
- {#if responsive.isMobile}
39
- <Carousel.Item class="pl-2 basis-auto">
40
- <CardPromotion {...item} {isDescriptionIcon} {isDescriptionLabel} />
41
- </Carousel.Item>
42
- {:else}
43
- <div>
44
- <CardPromotion {...item} {isDescriptionIcon} {isDescriptionLabel} />
45
- </div>
46
- {/if}
47
- {/each}
48
- {/if}
49
- </CarouselGridSlot>
26
+ {#if isEmpty}
27
+ <NotFoundEmpty
28
+ title={$t("empty.promotions.title")}
29
+ description={$t("empty.promotions.description")}
30
+ />
31
+ {:else}
32
+ <CarouselGridSlot {slotProps} {gridClass} totalItems={items?.length ?? 0}>
33
+ {#if isLoading}
34
+ {#each Array.from( { length: responsive.isMobile ? 3 : 6 }, ) as _, i (`loading-${i}`)}
35
+ {#if responsive.isMobile}
36
+ <Carousel.Item class="pl-2 basis-auto">
37
+ <CardPromotion id={i} isLoading />
38
+ </Carousel.Item>
39
+ {:else}
40
+ <div>
41
+ <CardPromotion id={i} isLoading />
42
+ </div>
43
+ {/if}
44
+ {/each}
45
+ {:else}
46
+ {#each items as item, i (`promotion-${item.id ?? i}`)}
47
+ {#if responsive.isMobile}
48
+ <Carousel.Item class="pl-2 basis-auto">
49
+ <CardPromotion
50
+ {...item}
51
+ {isDescriptionIcon}
52
+ {isDescriptionLabel}
53
+ />
54
+ </Carousel.Item>
55
+ {:else}
56
+ <div>
57
+ <CardPromotion
58
+ {...item}
59
+ {isDescriptionIcon}
60
+ {isDescriptionLabel}
61
+ />
62
+ </div>
63
+ {/if}
64
+ {/each}
65
+ {/if}
66
+ </CarouselGridSlot>
67
+ {/if}
50
68
  </CarouselHeader>
@@ -1,47 +1,57 @@
1
- <script lang="ts">
2
- import CardHighlight from "../../../card/highlight/CardHighlight.svelte";
3
- import CarouselHeader from "../../shared/ui/CarouselHeader.svelte";
4
- import CarouselSlot from "../../../panel/CarouselSlot.svelte";
5
- import * as Carousel from "../../../../ui/carousel/index.js";
6
- import type { CarouselHighlightsProps } from "../types";
7
- import { useDevice } from "../../../../../hooks/responsive.svelte";
8
- import Autoplay from "embla-carousel-autoplay";
9
-
10
- const {
11
- headerProps,
12
- slotProps,
13
- items,
14
- isLoading = false,
15
- varient = 1,
16
- isDescriptionIcon,
17
- isDescriptionLabel,
18
- }: CarouselHighlightsProps = $props();
19
-
20
- const responsive = useDevice();
21
- </script>
22
-
23
- <CarouselHeader {...headerProps}>
24
- <CarouselSlot
25
- {...slotProps}
26
- plugins={[Autoplay({ delay: 4000, stopOnInteraction: true })]}
27
- >
28
- {#if isLoading}
29
- {#each Array.from( { length: responsive.isMobile ? 5 : 10 }, ) as _, i (`loading-${i}`)}
30
- <Carousel.Item class="pl-2 basis-auto">
31
- <CardHighlight id={i} {isLoading} {varient} />
32
- </Carousel.Item>
33
- {/each}
34
- {:else}
35
- {#each items as item, i (`highlight-${item.id ?? i}`)}
36
- <Carousel.Item class="pl-2 basis-auto">
37
- <CardHighlight
38
- {...item}
39
- {varient}
40
- {isDescriptionIcon}
41
- {isDescriptionLabel}
42
- />
43
- </Carousel.Item>
44
- {/each}
45
- {/if}
46
- </CarouselSlot>
47
- </CarouselHeader>
1
+ <script lang="ts">
2
+ import CardHighlight from "../../../card/highlight/CardHighlight.svelte";
3
+ import CarouselHeader from "../../shared/ui/CarouselHeader.svelte";
4
+ import CarouselSlot from "../../../panel/CarouselSlot.svelte";
5
+ import NotFoundEmpty from "../../../panel/NotFoundEmpty.svelte";
6
+ import * as Carousel from "../../../../ui/carousel/index.js";
7
+ import type { CarouselHighlightsProps } from "../types";
8
+ import { useDevice } from "../../../../../hooks/responsive.svelte";
9
+ import { t } from "../../../../../i18n";
10
+ import Autoplay from "embla-carousel-autoplay";
11
+
12
+ const {
13
+ headerProps,
14
+ slotProps,
15
+ items,
16
+ isLoading = false,
17
+ varient = 1,
18
+ isDescriptionIcon,
19
+ isDescriptionLabel,
20
+ }: CarouselHighlightsProps = $props();
21
+
22
+ const responsive = useDevice();
23
+ const isEmpty = $derived(!isLoading && (!items || items.length === 0));
24
+ </script>
25
+
26
+ <CarouselHeader {...headerProps}>
27
+ {#if isEmpty}
28
+ <NotFoundEmpty
29
+ title={$t("empty.highlights.title")}
30
+ description={$t("empty.highlights.description")}
31
+ />
32
+ {:else}
33
+ <CarouselSlot
34
+ {...slotProps}
35
+ plugins={[Autoplay({ delay: 4000, stopOnInteraction: true })]}
36
+ >
37
+ {#if isLoading}
38
+ {#each Array.from( { length: responsive.isMobile ? 5 : 10 }, ) as _, i (`loading-${i}`)}
39
+ <Carousel.Item class="pl-2 basis-auto">
40
+ <CardHighlight id={i} {isLoading} {varient} />
41
+ </Carousel.Item>
42
+ {/each}
43
+ {:else}
44
+ {#each items as item, i (`highlight-${item.id ?? i}`)}
45
+ <Carousel.Item class="pl-2 basis-auto">
46
+ <CardHighlight
47
+ {...item}
48
+ {varient}
49
+ {isDescriptionIcon}
50
+ {isDescriptionLabel}
51
+ />
52
+ </Carousel.Item>
53
+ {/each}
54
+ {/if}
55
+ </CarouselSlot>
56
+ {/if}
57
+ </CarouselHeader>
@@ -1,47 +1,57 @@
1
- <script lang="ts">
2
- import CarouselSlot from "../../../panel/CarouselSlot.svelte";
3
- import * as Carousel from "../../../../ui/carousel/index.js";
4
- import type { CarouselProductProps } from "../types";
5
- import CarouselHeader from "../../shared/ui/CarouselHeader.svelte";
6
- import { useDevice } from "../../../../../hooks/responsive.svelte";
7
- import Autoplay from "embla-carousel-autoplay";
8
- import CardProduct from "../../../card/product/CardProduct.svelte";
9
-
10
- const {
11
- headerProps,
12
- slotProps,
13
- items,
14
- isLoading = false,
15
- isDescriptionIcon,
16
- isDescriptionLabel,
17
- }: CarouselProductProps = $props();
18
-
19
- const responsive = useDevice();
20
- </script>
21
-
22
- <CarouselHeader {...headerProps}>
23
- <CarouselSlot
24
- {...slotProps}
25
- containerClass="w-full"
26
- plugins={[Autoplay({ delay: 4000, stopOnInteraction: true })]}
27
- >
28
- {#if isLoading}
29
- {#each Array.from( { length: responsive.isMobile ? 5 : 10 }, ) as _, i (`loading-${i}`)}
30
- <Carousel.Item class="pl-5 w-75 basis-auto">
31
- <CardProduct
32
- id={i}
33
- {isLoading}
34
- {isDescriptionIcon}
35
- {isDescriptionLabel}
36
- />
37
- </Carousel.Item>
38
- {/each}
39
- {:else}
40
- {#each items as item, i (`product-${item.id ?? i}`)}
41
- <Carousel.Item class="pl-2 w-75 basis-auto">
42
- <CardProduct {...item} {isDescriptionIcon} {isDescriptionLabel} />
43
- </Carousel.Item>
44
- {/each}
45
- {/if}
46
- </CarouselSlot>
47
- </CarouselHeader>
1
+ <script lang="ts">
2
+ import CarouselSlot from "../../../panel/CarouselSlot.svelte";
3
+ import NotFoundEmpty from "../../../panel/NotFoundEmpty.svelte";
4
+ import * as Carousel from "../../../../ui/carousel/index.js";
5
+ import type { CarouselProductProps } from "../types";
6
+ import CarouselHeader from "../../shared/ui/CarouselHeader.svelte";
7
+ import { useDevice } from "../../../../../hooks/responsive.svelte";
8
+ import { t } from "../../../../../i18n";
9
+ import Autoplay from "embla-carousel-autoplay";
10
+ import CardProduct from "../../../card/product/CardProduct.svelte";
11
+
12
+ const {
13
+ headerProps,
14
+ slotProps,
15
+ items,
16
+ isLoading = false,
17
+ isDescriptionIcon,
18
+ isDescriptionLabel,
19
+ }: CarouselProductProps = $props();
20
+
21
+ const responsive = useDevice();
22
+ const isEmpty = $derived(!isLoading && (!items || items.length === 0));
23
+ </script>
24
+
25
+ <CarouselHeader {...headerProps}>
26
+ {#if isEmpty}
27
+ <NotFoundEmpty
28
+ title={$t("empty.products.title")}
29
+ description={$t("empty.products.description")}
30
+ />
31
+ {:else}
32
+ <CarouselSlot
33
+ {...slotProps}
34
+ containerClass="w-full"
35
+ plugins={[Autoplay({ delay: 4000, stopOnInteraction: true })]}
36
+ >
37
+ {#if isLoading}
38
+ {#each Array.from( { length: responsive.isMobile ? 5 : 10 }, ) as _, i (`loading-${i}`)}
39
+ <Carousel.Item class="pl-5 w-75 basis-auto">
40
+ <CardProduct
41
+ id={i}
42
+ {isLoading}
43
+ {isDescriptionIcon}
44
+ {isDescriptionLabel}
45
+ />
46
+ </Carousel.Item>
47
+ {/each}
48
+ {:else}
49
+ {#each items as item, i (`product-${item.id ?? i}`)}
50
+ <Carousel.Item class="pl-2 w-75 basis-auto">
51
+ <CardProduct {...item} {isDescriptionIcon} {isDescriptionLabel} />
52
+ </Carousel.Item>
53
+ {/each}
54
+ {/if}
55
+ </CarouselSlot>
56
+ {/if}
57
+ </CarouselHeader>
@@ -18,4 +18,9 @@ export interface CarouselPromotionProps {
18
18
  isDescriptionLabel?: boolean;
19
19
  /** Estado de carregamento (skeleton) */
20
20
  isLoading?: boolean;
21
+ onClickBuy?: (id: string | number) => void;
22
+ /** Callback ao clicar no botão carrinho */
23
+ onClickShop?: (id: string | number) => void;
24
+ /** Callback ao clicar no botão favorito */
25
+ onClickFavorite?: (id: string | number) => void;
21
26
  }