negodesign 0.0.25 → 0.0.27

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 (129) hide show
  1. package/dist/assets/start.png +0 -0
  2. package/dist/components/core/breadcrumb/breadcrumb-list.svelte +31 -31
  3. package/dist/components/core/button/ButtonBack.svelte +18 -18
  4. package/dist/components/core/button/ButtonLogin.svelte +15 -15
  5. package/dist/components/core/button/ButtonLoginWith.svelte +57 -57
  6. package/dist/components/core/button/ButtonSend.svelte +15 -15
  7. package/dist/components/core/card/highlight/01/CardHighlight01.svelte +91 -0
  8. package/dist/components/core/card/highlight/01/CardHighlight01.svelte.d.ts +8 -0
  9. package/dist/components/core/card/highlight/02/CardHighlight02.svelte +93 -0
  10. package/dist/components/core/card/highlight/02/CardHighlight02.svelte.d.ts +8 -0
  11. package/dist/components/core/card/highlight/CardHighlight.svelte +22 -67
  12. package/dist/components/core/card/highlight/CardHighlight.svelte.d.ts +5 -2
  13. package/dist/components/core/card/highlight/data.js +32 -1
  14. package/dist/components/core/card/media/01/CardMedia01.svelte +111 -114
  15. package/dist/components/core/card/media/02/CardMedia02.svelte +110 -113
  16. package/dist/components/core/card/media/CardMedia.svelte +17 -17
  17. package/dist/components/core/card/profile/01/CardProfile01.svelte +98 -101
  18. package/dist/components/core/card/profile/02/CardProfile02.svelte +98 -97
  19. package/dist/components/core/card/profile/CardProfile.svelte +17 -17
  20. package/dist/components/core/card/promotion/CardPromotion.svelte +112 -102
  21. package/dist/components/core/card/promotion/data.js +31 -0
  22. package/dist/components/core/card/shared/CardButton.svelte +30 -30
  23. package/dist/components/core/card/shared/CardCart.svelte +36 -36
  24. package/dist/components/core/card/shared/CardDescription.svelte +38 -23
  25. package/dist/components/core/card/shared/CardDescription.svelte.d.ts +3 -0
  26. package/dist/components/core/card/shared/CardFavorite.svelte +33 -33
  27. package/dist/components/core/card/shared/CardStarRating.svelte +20 -20
  28. package/dist/components/core/card/shared/CardStartPrice.svelte +34 -0
  29. package/dist/components/core/card/shared/CardStartPrice.svelte.d.ts +8 -0
  30. package/dist/components/core/card/shared/CardTags.svelte +73 -56
  31. package/dist/components/core/card/shared/CardTags.svelte.d.ts +2 -1
  32. package/dist/components/core/card/shared/CardThumbnailVideo.svelte +169 -169
  33. package/dist/components/core/card/shared/TruncatableText.svelte +55 -55
  34. package/dist/components/core/card/types.d.ts +13 -1
  35. package/dist/components/core/carousel/badge/ui/CarouselBadge.svelte +82 -80
  36. package/dist/components/core/carousel/hero/CarouselHero.svelte +158 -158
  37. package/dist/components/core/carousel/highlights/types.d.ts +3 -0
  38. package/dist/components/core/carousel/highlights/ui/CarouselHighlights.svelte +63 -41
  39. package/dist/components/core/carousel/promotion/types.d.ts +2 -0
  40. package/dist/components/core/carousel/promotion/ui/CarouselPromotion.svelte +64 -41
  41. package/dist/components/core/carousel/shared/ui/CarouselHeader.svelte +55 -50
  42. package/dist/components/core/carousel/shared/ui/CarouselHeader.svelte.d.ts +6 -1
  43. package/dist/components/core/carousel/types.d.ts +1 -2
  44. package/dist/components/core/datatable/ui/DataTableActions.svelte +28 -28
  45. package/dist/components/core/datatable/ui/DataTableCheckbox.svelte +22 -22
  46. package/dist/components/core/datatable/ui/DataTableContent.svelte +59 -59
  47. package/dist/components/core/datatable/ui/DataTableCore.svelte +151 -151
  48. package/dist/components/core/datatable/ui/DataTableDragHandle.svelte +8 -8
  49. package/dist/components/core/datatable/ui/DataTableListFilter.svelte +59 -59
  50. package/dist/components/core/datatable/ui/DataTableListPagination.svelte +35 -35
  51. package/dist/components/core/form/ui/input-base.svelte +81 -81
  52. package/dist/components/core/form/ui/input-email-or-phone.svelte +23 -23
  53. package/dist/components/core/form/ui/input-email.svelte +23 -23
  54. package/dist/components/core/form/ui/input-password-confirm.svelte +23 -23
  55. package/dist/components/core/form/ui/input-password.svelte +23 -23
  56. package/dist/components/core/form/ui/input-phone.svelte +33 -33
  57. package/dist/components/core/form/ui/input-username.svelte +22 -22
  58. package/dist/components/core/hero/SimpleHero.svelte +65 -65
  59. package/dist/components/core/label/LabelOr.svelte +25 -25
  60. package/dist/components/core/link/link-forget-password.svelte +12 -12
  61. package/dist/components/core/link/link-privacy-polity.svelte +12 -12
  62. package/dist/components/core/link/link-terms-of-service.svelte +12 -12
  63. package/dist/components/core/nav/ui/menu-links.svelte +27 -27
  64. package/dist/components/core/nav/ui/mobile/nav-menu-drawer.svelte +85 -85
  65. package/dist/components/core/nav/ui/nav-menu-bottom-sidebar.svelte +33 -33
  66. package/dist/components/core/nav/ui/nav-menu-sidebar.svelte +97 -97
  67. package/dist/components/core/nav/ui/nav-menu-top-bar-sidebar.svelte +103 -103
  68. package/dist/components/core/nav/ui/nav-menu.svelte +106 -106
  69. package/dist/components/core/panel/CarouselSlot.svelte +63 -38
  70. package/dist/components/core/panel/CarouselSlot.svelte.d.ts +5 -2
  71. package/dist/components/core/panel/LeftHero.svelte +116 -116
  72. package/dist/components/core/search/SearchInput.svelte +32 -32
  73. package/dist/components/core/search/shared/SearchInputCore.svelte +66 -66
  74. package/dist/components/core/sidebar/MenuBarSidebar.svelte +70 -70
  75. package/dist/components/core/tabs/ui/tab-underline.svelte +43 -43
  76. package/dist/components/pages/admin/01/ui/AdminContent.svelte +14 -14
  77. package/dist/components/pages/admin/01/ui/AdminPanel.svelte +46 -46
  78. package/dist/components/pages/security/login/01/ui/FormRegister.svelte +28 -28
  79. package/dist/components/pages/security/login/01/ui/LoginCard.svelte +107 -107
  80. package/dist/components/pages/security/login/PageLogin.svelte +22 -22
  81. package/dist/components/ui/badge/badge.svelte +49 -49
  82. package/dist/components/ui/button/button.svelte +82 -82
  83. package/dist/components/ui/chart/chart-container.svelte +80 -80
  84. package/dist/components/ui/chart/chart-style.svelte +37 -37
  85. package/dist/components/ui/chart/chart-tooltip.svelte +184 -184
  86. package/dist/components/ui/checkbox/checkbox.svelte +40 -40
  87. package/dist/components/ui/data-table/flex-render.svelte +40 -40
  88. package/dist/components/ui/drawer/drawer-close.svelte +7 -7
  89. package/dist/components/ui/drawer/drawer-content.svelte +33 -33
  90. package/dist/components/ui/drawer/drawer-description.svelte +17 -17
  91. package/dist/components/ui/drawer/drawer-footer.svelte +20 -20
  92. package/dist/components/ui/drawer/drawer-header.svelte +20 -20
  93. package/dist/components/ui/drawer/drawer-nested.svelte +12 -12
  94. package/dist/components/ui/drawer/drawer-overlay.svelte +17 -17
  95. package/dist/components/ui/drawer/drawer-portal.svelte +7 -7
  96. package/dist/components/ui/drawer/drawer-title.svelte +17 -17
  97. package/dist/components/ui/drawer/drawer-trigger.svelte +7 -7
  98. package/dist/components/ui/drawer/drawer.svelte +12 -12
  99. package/dist/components/ui/select/select-content.svelte +45 -45
  100. package/dist/components/ui/select/select-group-heading.svelte +21 -21
  101. package/dist/components/ui/select/select-group.svelte +17 -17
  102. package/dist/components/ui/select/select-item.svelte +41 -41
  103. package/dist/components/ui/select/select-label.svelte +20 -20
  104. package/dist/components/ui/select/select-portal.svelte +7 -7
  105. package/dist/components/ui/select/select-scroll-down-button.svelte +21 -21
  106. package/dist/components/ui/select/select-scroll-up-button.svelte +21 -21
  107. package/dist/components/ui/select/select-separator.svelte +18 -18
  108. package/dist/components/ui/select/select-trigger.svelte +30 -30
  109. package/dist/components/ui/select/select.svelte +11 -11
  110. package/dist/components/ui/sidebar/sidebar-menu-sub-button.svelte +39 -39
  111. package/dist/components/ui/star-rating/star-rating-star.svelte +41 -41
  112. package/dist/components/ui/star-rating/star-rating.svelte +20 -20
  113. package/dist/components/ui/table/table-body.svelte +15 -15
  114. package/dist/components/ui/table/table-caption.svelte +20 -20
  115. package/dist/components/ui/table/table-cell.svelte +15 -15
  116. package/dist/components/ui/table/table-footer.svelte +20 -20
  117. package/dist/components/ui/table/table-head.svelte +15 -15
  118. package/dist/components/ui/table/table-header.svelte +20 -20
  119. package/dist/components/ui/table/table-row.svelte +15 -15
  120. package/dist/components/ui/table/table.svelte +17 -17
  121. package/dist/components/ui/tabs/tabs-content.svelte +17 -17
  122. package/dist/components/ui/tabs/tabs-list.svelte +40 -40
  123. package/dist/components/ui/tabs/tabs-trigger.svelte +23 -23
  124. package/dist/components/ui/tabs/tabs.svelte +19 -19
  125. package/dist/globals.css +142 -17
  126. package/dist/hooks/responsive.svelte.d.ts +1 -1
  127. package/dist/hooks/responsive.svelte.js +1 -1
  128. package/dist/styles/globals.css +149 -149
  129. package/package.json +113 -113
@@ -1,158 +1,158 @@
1
- <script lang="ts">
2
- import type { CarouselHeroItem, CarouselHeroProps } from "../types";
3
- import NavMenu from "../../nav/ui/nav-menu.svelte";
4
- import type { Snippet } from "svelte";
5
-
6
- let {
7
- items,
8
- navMenu,
9
- children,
10
- className,
11
- titleClass,
12
- descriptionClass,
13
- intervalMs = 5000,
14
- transitionMs = 1200,
15
- }: CarouselHeroProps & {
16
- children?: Snippet;
17
- intervalMs?: number;
18
- transitionMs?: number;
19
- } = $props();
20
-
21
- // Buffer duplo: duas camadas fixas, nunca desmontadas — só a opacidade muda.
22
- let layers = $state<[string, string]>([items?.[0]?.image ?? "", ""]);
23
- let active = $state<0 | 1>(0);
24
- let index = $state(0);
25
- let switching = false; // evita trocas sobrepostas se o intervalo disparar antes do preload acabar
26
-
27
- // eslint-disable-next-line svelte/prefer-svelte-reactivity
28
- const preloadCache = new Map<string, Promise<void>>();
29
-
30
- function preload(src: string): Promise<void> {
31
- if (!src) return Promise.resolve();
32
- const cached = preloadCache.get(src);
33
- if (cached) return cached;
34
-
35
- const promise = new Promise<void>((resolve) => {
36
- const img = new Image();
37
- img.onload = () => resolve();
38
- img.onerror = () => resolve(); // não bloqueia o carousel por uma imagem partida
39
- img.src = src;
40
- });
41
-
42
- preloadCache.set(src, promise);
43
- return promise;
44
- }
45
-
46
- // Pré-carrega todas as imagens uma vez, assim que os items ficam disponíveis.
47
- $effect(() => {
48
- items?.forEach((item) => void preload(item.image));
49
- });
50
-
51
- async function goTo(nextIndex: number) {
52
- if (!items || nextIndex === index || switching) return;
53
- switching = true;
54
-
55
- const nextSrc = items[nextIndex].image;
56
- await preload(nextSrc); // garante decode/cache antes de trocar a camada -> sem flash
57
-
58
- const nextLayer = active === 0 ? 1 : 0;
59
- layers[nextLayer] = nextSrc;
60
- active = nextLayer;
61
- index = nextIndex;
62
- switching = false;
63
- }
64
-
65
- $effect(() => {
66
- if (!items || items.length <= 1) return;
67
-
68
- const timer = setInterval(() => {
69
- goTo((index + 1) % items.length);
70
- }, intervalMs);
71
-
72
- return () => clearInterval(timer);
73
- });
74
-
75
- function fadeIn(node: HTMLElement) {
76
- requestAnimationFrame(() => {
77
- node.style.opacity = "1";
78
- });
79
- return {};
80
- }
81
-
82
- let selected = $derived<CarouselHeroItem | undefined>(items?.[index]);
83
- </script>
84
-
85
- {#if selected}
86
- <header
87
- class="w-full relative flex flex-col justify-center items-center h-75 md:h-100 overflow-hidden {className}"
88
- >
89
- {#each layers as bg, i (i)}
90
- <div
91
- style="
92
- position: absolute;
93
- inset: 0;
94
- will-change: opacity;
95
- background-image: {bg ? `url(${bg})` : 'none'};
96
- background-size: cover;
97
- background-position: center;
98
- background-repeat: no-repeat;
99
- opacity: {i === active ? 1 : 0};
100
- transition: opacity {transitionMs}ms ease-in-out;
101
- "
102
- ></div>
103
- {/each}
104
-
105
- <div
106
- style="position: absolute; inset: 0; height: 100%; background-color: rgba(0,0,0,0.4);"
107
- ></div>
108
-
109
- <div class="relative z-10 w-full flex flex-col items-center flex-1">
110
- <NavMenu {...navMenu} />
111
-
112
- <section
113
- class="flex flex-col justify-center items-center flex-1 w-full h-auto text-center px-4"
114
- >
115
- {#key selected.title}
116
- <div
117
- style="transition: opacity {transitionMs * 0.6}ms ease-in-out;"
118
- class="opacity-0 flex flex-col justify-center items-center text-center"
119
- use:fadeIn
120
- >
121
- <div>
122
- <h1
123
- class="text-white text-2xl md:text-4xl font-bold {titleClass}"
124
- >
125
- {selected.title}
126
- </h1>
127
- </div>
128
- <div class="flex flex-col justify-center items-center">
129
- <p class="text-white/90 mt-2 max-w-2xl {descriptionClass}">
130
- {selected.description}
131
- </p>
132
- </div>
133
- </div>
134
- {/key}
135
-
136
- {#if children}
137
- {@render children()}
138
- {/if}
139
- </section>
140
- </div>
141
-
142
- {#if items && items.length > 1}
143
- <div
144
- style="position: absolute; bottom: 0.75rem; z-index: 10; display: flex; gap: 0.5rem;"
145
- >
146
- {#each items as item, i (i)}
147
- <button
148
- aria-label={`Ir para o slide ${i + 1}: ${item.title}`}
149
- class="w-2 h-2 rounded-full transition-colors {i === index
150
- ? 'bg-white'
151
- : 'bg-white/40'}"
152
- onclick={() => goTo(i)}
153
- ></button>
154
- {/each}
155
- </div>
156
- {/if}
157
- </header>
158
- {/if}
1
+ <script lang="ts">
2
+ import type { CarouselHeroItem, CarouselHeroProps } from "../types";
3
+ import NavMenu from "../../nav/ui/nav-menu.svelte";
4
+ import type { Snippet } from "svelte";
5
+
6
+ let {
7
+ items,
8
+ navMenu,
9
+ children,
10
+ className,
11
+ titleClass,
12
+ descriptionClass,
13
+ intervalMs = 5000,
14
+ transitionMs = 1200,
15
+ }: CarouselHeroProps & {
16
+ children?: Snippet;
17
+ intervalMs?: number;
18
+ transitionMs?: number;
19
+ } = $props();
20
+
21
+ // Buffer duplo: duas camadas fixas, nunca desmontadas — só a opacidade muda.
22
+ let layers = $state<[string, string]>([items?.[0]?.image ?? "", ""]);
23
+ let active = $state<0 | 1>(0);
24
+ let index = $state(0);
25
+ let switching = false; // evita trocas sobrepostas se o intervalo disparar antes do preload acabar
26
+
27
+ // eslint-disable-next-line svelte/prefer-svelte-reactivity
28
+ const preloadCache = new Map<string, Promise<void>>();
29
+
30
+ function preload(src: string): Promise<void> {
31
+ if (!src) return Promise.resolve();
32
+ const cached = preloadCache.get(src);
33
+ if (cached) return cached;
34
+
35
+ const promise = new Promise<void>((resolve) => {
36
+ const img = new Image();
37
+ img.onload = () => resolve();
38
+ img.onerror = () => resolve(); // não bloqueia o carousel por uma imagem partida
39
+ img.src = src;
40
+ });
41
+
42
+ preloadCache.set(src, promise);
43
+ return promise;
44
+ }
45
+
46
+ // Pré-carrega todas as imagens uma vez, assim que os items ficam disponíveis.
47
+ $effect(() => {
48
+ items?.forEach((item) => void preload(item.image));
49
+ });
50
+
51
+ async function goTo(nextIndex: number) {
52
+ if (!items || nextIndex === index || switching) return;
53
+ switching = true;
54
+
55
+ const nextSrc = items[nextIndex].image;
56
+ await preload(nextSrc); // garante decode/cache antes de trocar a camada -> sem flash
57
+
58
+ const nextLayer = active === 0 ? 1 : 0;
59
+ layers[nextLayer] = nextSrc;
60
+ active = nextLayer;
61
+ index = nextIndex;
62
+ switching = false;
63
+ }
64
+
65
+ $effect(() => {
66
+ if (!items || items.length <= 1) return;
67
+
68
+ const timer = setInterval(() => {
69
+ goTo((index + 1) % items.length);
70
+ }, intervalMs);
71
+
72
+ return () => clearInterval(timer);
73
+ });
74
+
75
+ function fadeIn(node: HTMLElement) {
76
+ requestAnimationFrame(() => {
77
+ node.style.opacity = "1";
78
+ });
79
+ return {};
80
+ }
81
+
82
+ let selected = $derived<CarouselHeroItem | undefined>(items?.[index]);
83
+ </script>
84
+
85
+ {#if selected}
86
+ <header
87
+ class="w-full relative flex flex-col justify-center items-center h-75 md:h-100 overflow-hidden {className}"
88
+ >
89
+ {#each layers as bg, i (`layer-${i}`)}
90
+ <div
91
+ style="
92
+ position: absolute;
93
+ inset: 0;
94
+ will-change: opacity;
95
+ background-image: {bg ? `url(${bg})` : 'none'};
96
+ background-size: cover;
97
+ background-position: center;
98
+ background-repeat: no-repeat;
99
+ opacity: {i === active ? 1 : 0};
100
+ transition: opacity {transitionMs}ms ease-in-out;
101
+ "
102
+ ></div>
103
+ {/each}
104
+
105
+ <div
106
+ style="position: absolute; inset: 0; height: 100%; background-color: rgba(0,0,0,0.4);"
107
+ ></div>
108
+
109
+ <div class="relative z-10 w-full flex flex-col items-center flex-1">
110
+ <NavMenu {...navMenu} />
111
+
112
+ <section
113
+ class="flex flex-col justify-center items-center flex-1 w-full h-auto text-center px-4"
114
+ >
115
+ {#key selected.title}
116
+ <div
117
+ style="transition: opacity {transitionMs * 0.6}ms ease-in-out;"
118
+ class="opacity-0 flex flex-col justify-center items-center text-center"
119
+ use:fadeIn
120
+ >
121
+ <div>
122
+ <h1
123
+ class="text-white text-2xl md:text-4xl font-bold {titleClass}"
124
+ >
125
+ {selected.title}
126
+ </h1>
127
+ </div>
128
+ <div class="flex flex-col justify-center items-center">
129
+ <p class="text-white/90 mt-2 max-w-2xl {descriptionClass}">
130
+ {selected.description}
131
+ </p>
132
+ </div>
133
+ </div>
134
+ {/key}
135
+
136
+ {#if children}
137
+ {@render children()}
138
+ {/if}
139
+ </section>
140
+ </div>
141
+
142
+ {#if items && items.length > 1}
143
+ <div
144
+ style="position: absolute; bottom: 0.75rem; z-index: 10; display: flex; gap: 0.5rem;"
145
+ >
146
+ {#each items as item, i (`hero-dot-${i}`)}
147
+ <button
148
+ aria-label={`Ir para o slide ${i + 1}: ${item.title}`}
149
+ class="w-2 h-2 rounded-full transition-colors {i === index
150
+ ? 'bg-white'
151
+ : 'bg-white/40'}"
152
+ onclick={() => goTo(i)}
153
+ ></button>
154
+ {/each}
155
+ </div>
156
+ {/if}
157
+ </header>
158
+ {/if}
@@ -2,8 +2,11 @@ import type { CardHighlightProps } from "../../card/types";
2
2
  import type { CarouselHeaderProps } from "../types";
3
3
  export interface CarouselHighlightsProps extends CarouselHeaderProps {
4
4
  items: CardHighlightProps[];
5
+ varient?: 1 | 2;
5
6
  isBorderBottom?: boolean;
6
7
  isLoading?: boolean;
8
+ isDescriptionIcon?: boolean;
9
+ isDescriptionLabel?: boolean;
7
10
  isButtonPreviousAndNext?: boolean;
8
11
  buttonPreviousAndNextClass?: string;
9
12
  }
@@ -1,41 +1,63 @@
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 type { CarouselHighlightsProps } from "../types";
6
-
7
- const {
8
- title,
9
- items,
10
- description,
11
- titleClass,
12
- descriptionClass,
13
- isButtonPreviousAndNext = true,
14
- buttonPreviousAndNextClass = "",
15
- containerClass = "",
16
- isLoading = false,
17
- onButtonViewAll,
18
- }: CarouselHighlightsProps = $props();
19
- </script>
20
-
21
- <CarouselHeader
22
- {title}
23
- {description}
24
- {titleClass}
25
- {descriptionClass}
26
- {containerClass}
27
- {onButtonViewAll}
28
- >
29
- <CarouselSlot
30
- isBorderBottom={false}
31
- {isButtonPreviousAndNext}
32
- {buttonPreviousAndNextClass}
33
- containerClass="w-full"
34
- >
35
- {#each items as item (item.id)}
36
- <div class="mx-2">
37
- <CardHighlight {...item} {isLoading} />
38
- </div>
39
- {/each}
40
- </CarouselSlot>
41
- </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 * 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
+ title,
12
+ items,
13
+ description,
14
+ titleClass,
15
+ descriptionClass,
16
+ isButtonPreviousAndNext = true,
17
+ buttonPreviousAndNextClass = "",
18
+ containerClass = "",
19
+ isLoading = false,
20
+ varient = 1,
21
+ isDescriptionIcon,
22
+ isDescriptionLabel,
23
+ onButtonViewAll,
24
+ }: CarouselHighlightsProps = $props();
25
+
26
+ const responsive = useDevice();
27
+ </script>
28
+
29
+ <CarouselHeader
30
+ {title}
31
+ {description}
32
+ {titleClass}
33
+ {descriptionClass}
34
+ {containerClass}
35
+ {onButtonViewAll}
36
+ >
37
+ <CarouselSlot
38
+ isBorderBottom={false}
39
+ {isButtonPreviousAndNext}
40
+ {buttonPreviousAndNextClass}
41
+ containerClass="w-full"
42
+ plugins={[Autoplay({ delay: 4000, stopOnInteraction: true })]}
43
+ >
44
+ {#if isLoading}
45
+ {#each Array.from( { length: responsive.isMobile ? 5 : 10 }, ) as _, i (`loading-${i}`)}
46
+ <Carousel.Item class="pl-2 md:basis-1/2 lg:basis-auto">
47
+ <CardHighlight id={i} {isLoading} {varient} />
48
+ </Carousel.Item>
49
+ {/each}
50
+ {:else}
51
+ {#each items as item, i (`highlight-${item.id ?? i}`)}
52
+ <Carousel.Item class="pl-2 md:basis-1/2 lg:basis-1/3">
53
+ <CardHighlight
54
+ {...item}
55
+ {varient}
56
+ {isDescriptionIcon}
57
+ {isDescriptionLabel}
58
+ />
59
+ </Carousel.Item>
60
+ {/each}
61
+ {/if}
62
+ </CarouselSlot>
63
+ </CarouselHeader>
@@ -6,4 +6,6 @@ export interface CarouselPromotionProps extends CarouselHeaderProps {
6
6
  isLoading?: boolean;
7
7
  isButtonPreviousAndNext?: boolean;
8
8
  buttonPreviousAndNextClass?: string;
9
+ isDescriptionIcon?: boolean;
10
+ isDescriptionLabel?: boolean;
9
11
  }
@@ -1,41 +1,64 @@
1
- <script lang="ts">
2
- import CardPromotion from "../../../card/promotion/CardPromotion.svelte";
3
- import CarouselSlot from "../../../panel/CarouselSlot.svelte";
4
- import type { CarouselPromotionProps } from "../types";
5
- import CarouselHeader from "../../shared/ui/CarouselHeader.svelte";
6
-
7
- const {
8
- title,
9
- items,
10
- description,
11
- titleClass,
12
- descriptionClass,
13
- isButtonPreviousAndNext = true,
14
- isLoading = false,
15
- buttonPreviousAndNextClass = "",
16
- containerClass = "",
17
- onButtonViewAll,
18
- }: CarouselPromotionProps = $props();
19
- </script>
20
-
21
- <CarouselHeader
22
- {title}
23
- {description}
24
- {titleClass}
25
- {descriptionClass}
26
- {containerClass}
27
- {onButtonViewAll}
28
- >
29
- <CarouselSlot
30
- isBorderBottom={false}
31
- {isButtonPreviousAndNext}
32
- {buttonPreviousAndNextClass}
33
- containerClass="w-full"
34
- >
35
- {#each items as item (item.id)}
36
- <div class="mx-2">
37
- <CardPromotion {...item} {isLoading} />
38
- </div>
39
- {/each}
40
- </CarouselSlot>
41
- </CarouselHeader>
1
+ <script lang="ts">
2
+ import CardPromotion from "../../../card/promotion/CardPromotion.svelte";
3
+ import CarouselSlot from "../../../panel/CarouselSlot.svelte";
4
+ import * as Carousel from "../../../../ui/carousel/index.js";
5
+ import type { CarouselPromotionProps } from "../types";
6
+ import CarouselHeader from "../../shared/ui/CarouselHeader.svelte";
7
+ import { useDevice } from "../../../../../hooks/responsive.svelte";
8
+ import Autoplay from "embla-carousel-autoplay";
9
+
10
+ const {
11
+ title,
12
+ items,
13
+ description,
14
+ titleClass,
15
+ descriptionClass,
16
+ isButtonPreviousAndNext = true,
17
+ isLoading = false,
18
+ buttonPreviousAndNextClass = "",
19
+ containerClass = "",
20
+ positionButtonPreviousAndNext,
21
+ isDescriptionIcon,
22
+ isDescriptionLabel,
23
+ onButtonViewAll,
24
+ }: CarouselPromotionProps = $props();
25
+
26
+ const responsive = useDevice();
27
+ </script>
28
+
29
+ <CarouselHeader
30
+ {title}
31
+ {description}
32
+ {titleClass}
33
+ {descriptionClass}
34
+ {containerClass}
35
+ {onButtonViewAll}
36
+ >
37
+ <CarouselSlot
38
+ isBorderBottom={false}
39
+ {isButtonPreviousAndNext}
40
+ {buttonPreviousAndNextClass}
41
+ {positionButtonPreviousAndNext}
42
+ containerClass="w-full"
43
+ plugins={[Autoplay({ delay: 4000, stopOnInteraction: true })]}
44
+ >
45
+ {#if isLoading}
46
+ {#each Array.from( { length: responsive.isMobile ? 5 : 10 }, ) as _, i (`loading-${i}`)}
47
+ <Carousel.Item class="pl-2 md:basis-1/2 lg:basis-1/4">
48
+ <CardPromotion
49
+ id={i}
50
+ {isLoading}
51
+ {isDescriptionIcon}
52
+ {isDescriptionLabel}
53
+ />
54
+ </Carousel.Item>
55
+ {/each}
56
+ {:else}
57
+ {#each items as item, i (`promotion-${item.id ?? i}`)}
58
+ <Carousel.Item class="pl-2 md:basis-1/2 lg:basis-1/3">
59
+ <CardPromotion {...item} {isDescriptionIcon} {isDescriptionLabel} />
60
+ </Carousel.Item>
61
+ {/each}
62
+ {/if}
63
+ </CarouselSlot>
64
+ </CarouselHeader>
@@ -1,50 +1,55 @@
1
- <script lang="ts">
2
- import Button from "../../../../ui/button/button.svelte";
3
- import { t } from "../../../../../i18n";
4
- import { HugeiconsIcon } from "@hugeicons/svelte";
5
- import { ArrowRight02Icon } from "@hugeicons/core-free-icons";
6
- import type { CarouselHeaderProps } from "../../types";
7
-
8
- const {
9
- title,
10
- description,
11
- titleClass,
12
- descriptionClass,
13
- containerClass = "",
14
- onButtonViewAll,
15
- children,
16
- }: CarouselHeaderProps = $props();
17
- </script>
18
-
19
- <div class="w-full flex justify-center">
20
- <div class="w-[95%] p-2 rounded-xl {containerClass}">
21
- <div class="ml-10 flex flex-col gap-1">
22
- <div class="flex justify-between">
23
- <div>
24
- {#if title}
25
- <h1 class={`text-xl ${titleClass}`}>{title}</h1>
26
- {/if}
27
- {#if description}
28
- <div class={`mt-3 w-11/12 ${descriptionClass}`}>
29
- {description}
30
- </div>
31
- {/if}
32
- </div>
33
- {#if onButtonViewAll}
34
- <div>
35
- <Button
36
- variant="ghost"
37
- size="sm"
38
- class="flex items-center gap-0.5"
39
- onclick={onButtonViewAll}
40
- >
41
- {$t("label.view.full")}
42
- <HugeiconsIcon icon={ArrowRight02Icon} />
43
- </Button>
44
- </div>
45
- {/if}
46
- </div>
47
- </div>
48
- </div>
49
- <div>{@render children()}</div>
50
- </div>
1
+ <script lang="ts">
2
+ import Button from "../../../../ui/button/button.svelte";
3
+ import { t } from "../../../../../i18n";
4
+ import { HugeiconsIcon } from "@hugeicons/svelte";
5
+ import { ArrowRight02Icon } from "@hugeicons/core-free-icons";
6
+ import type { CarouselHeaderProps } from "../../types";
7
+ import type { Snippet } from "svelte";
8
+
9
+ type Props = {
10
+ children: Snippet;
11
+ };
12
+
13
+ const {
14
+ title,
15
+ description,
16
+ titleClass,
17
+ descriptionClass,
18
+ containerClass = "",
19
+ onButtonViewAll,
20
+ children,
21
+ }: CarouselHeaderProps & Props = $props();
22
+ </script>
23
+
24
+ <div class="w-full flex justify-center">
25
+ <div class="w-[95%] p-2 rounded-xl border {containerClass}">
26
+ <div class="flex flex-col gap-1">
27
+ <div class="flex justify-between">
28
+ <div>
29
+ {#if title}
30
+ <h1 class={`text-xl ${titleClass}`}>{title}</h1>
31
+ {/if}
32
+ {#if description}
33
+ <div class={`mt-3 ${descriptionClass}`}>
34
+ {description}
35
+ </div>
36
+ {/if}
37
+ </div>
38
+ {#if onButtonViewAll}
39
+ <div>
40
+ <Button
41
+ variant="ghost"
42
+ size="sm"
43
+ class="flex items-center gap-0.5"
44
+ onclick={onButtonViewAll}
45
+ >
46
+ {$t("label.view.full")}
47
+ <HugeiconsIcon icon={ArrowRight02Icon} />
48
+ </Button>
49
+ </div>
50
+ {/if}
51
+ </div>
52
+ </div>
53
+ <div>{@render children()}</div>
54
+ </div>
55
+ </div>
@@ -1,4 +1,9 @@
1
1
  import type { CarouselHeaderProps } from "../../types";
2
- declare const CarouselHeader: import("svelte").Component<CarouselHeaderProps, {}, "">;
2
+ import type { Snippet } from "svelte";
3
+ type Props = {
4
+ children: Snippet;
5
+ };
6
+ type $$ComponentProps = CarouselHeaderProps & Props;
7
+ declare const CarouselHeader: import("svelte").Component<$$ComponentProps, {}, "">;
3
8
  type CarouselHeader = ReturnType<typeof CarouselHeader>;
4
9
  export default CarouselHeader;