wagtail-enap-designsystem 1.2.1.105__py3-none-any.whl → 1.2.1.107__py3-none-any.whl

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.

Potentially problematic release.


This version of wagtail-enap-designsystem might be problematic. Click here for more details.

Files changed (18) hide show
  1. enap_designsystem/blocks/__init__.py +6 -1
  2. enap_designsystem/static/enap_designsystem/blocks/bundle.css +0 -14
  3. enap_designsystem/static/enap_designsystem/blocks/cards.css +11 -1
  4. enap_designsystem/static/enap_designsystem/blocks/pages/template_homeI.css +0 -1
  5. enap_designsystem/static/enap_designsystem/blocks/pages/template_homeII.css +0 -1
  6. enap_designsystem/static/enap_designsystem/blocks/testimonials_carousel.css +19 -2
  7. enap_designsystem/templates/enap_designsystem/blocks/navbar/navbar_block.html +1 -1
  8. enap_designsystem/templates/enap_designsystem/blocks/page/pagenoticias_block.html +136 -168
  9. enap_designsystem/templates/enap_designsystem/blocks/preview_courses.html +47 -0
  10. enap_designsystem/templates/enap_designsystem/blocks/suap/suap_courses_block.html +40 -20
  11. enap_designsystem/templates/enap_designsystem/blocks/suap/suap_events_block.html +32 -36
  12. enap_designsystem/templates/enap_designsystem/blocks/team_carousel.html +58 -1
  13. enap_designsystem/templates/enap_designsystem/blocks/testimonials_carousel.html +143 -66
  14. {wagtail_enap_designsystem-1.2.1.105.dist-info → wagtail_enap_designsystem-1.2.1.107.dist-info}/METADATA +1 -1
  15. {wagtail_enap_designsystem-1.2.1.105.dist-info → wagtail_enap_designsystem-1.2.1.107.dist-info}/RECORD +18 -18
  16. {wagtail_enap_designsystem-1.2.1.105.dist-info → wagtail_enap_designsystem-1.2.1.107.dist-info}/WHEEL +0 -0
  17. {wagtail_enap_designsystem-1.2.1.105.dist-info → wagtail_enap_designsystem-1.2.1.107.dist-info}/licenses/LICENSE +0 -0
  18. {wagtail_enap_designsystem-1.2.1.105.dist-info → wagtail_enap_designsystem-1.2.1.107.dist-info}/top_level.txt +0 -0
@@ -176,35 +176,55 @@
176
176
  showSlide(currentIndex + moveBy);
177
177
  });
178
178
 
179
- // NOVA FUNCIONALIDADE: Scroll horizontal APENAS com trackpad
179
+
180
180
  carousel.addEventListener('wheel', function(e) {
181
- // Responder APENAS ao scroll horizontal (trackpad lateral)
182
- if (Math.abs(e.deltaX) > 0 && Math.abs(e.deltaX) > Math.abs(e.deltaY)) {
183
- e.preventDefault(); // Prevenir scroll da página
181
+ if (Math.abs(e.deltaX) > 0) {
182
+ e.preventDefault();
183
+
184
+ // Obter posição atual do transform
185
+ const currentTransform = carousel.style.transform;
186
+ const match = currentTransform.match(/translateX\((-?\d*\.?\d*)px\)/);
187
+ let currentOffset = match ? parseFloat(match[1]) : 0;
184
188
 
185
- // Evitar múltiplos scrolls muito rápidos
186
- if (isScrolling) return;
189
+ // Aplicar movimento proporcional (ajuste a velocidade aqui)
190
+ const scrollMultiplier = 1.2;
191
+ const newOffset = currentOffset - (e.deltaX * scrollMultiplier);
187
192
 
188
- isScrolling = true;
193
+ // Calcular limites
194
+ const maxOffset = 0;
195
+ const minOffset = -(maxIndex * (itemWidth + itemsGap));
189
196
 
190
- // Determinar direção do scroll
191
- if (e.deltaX > 0) {
192
- // Scroll para direita - próximo slide
193
- showSlide(currentIndex + 1);
194
- } else {
195
- // Scroll para esquerda - slide anterior
196
- showSlide(currentIndex - 1);
197
+ // Aplicar limites com resistência
198
+ let finalOffset = newOffset;
199
+
200
+ if (newOffset > maxOffset) {
201
+ const overscroll = newOffset - maxOffset;
202
+ finalOffset = maxOffset + (overscroll * 0.3);
203
+ } else if (newOffset < minOffset) {
204
+ const overscroll = newOffset - minOffset;
205
+ finalOffset = minOffset + (overscroll * 0.3);
197
206
  }
198
207
 
199
- // Resetar flag após um tempo
208
+ // Aplicar transform
209
+ carousel.style.transition = 'none';
210
+ carousel.style.transform = `translateX(${finalOffset}px)`;
211
+
212
+ // Atualizar currentIndex baseado na posição
213
+ const newIndex = Math.round(Math.abs(finalOffset) / (itemWidth + itemsGap));
214
+ currentIndex = Math.max(0, Math.min(newIndex, maxIndex));
215
+
216
+ // Atualizar botões
217
+ updateNavigationButtons();
218
+
219
+ // Snap suave quando parar
200
220
  clearTimeout(scrollTimeout);
201
221
  scrollTimeout = setTimeout(() => {
202
- isScrolling = false;
203
- }, 300);
222
+ carousel.style.transition = 'transform 0.3s ease-out';
223
+ showSlide(currentIndex);
224
+ }, 150);
204
225
  }
205
- // Para scroll vertical, não fazer nada - deixar comportamento normal da página
206
- }, { passive: false }); // passive: false para permitir preventDefault
207
-
226
+ }, { passive: false });
227
+
208
228
  // Touch events - sempre ativados (para dispositivos touch)
209
229
  carousel.addEventListener('touchstart', handleStart, { passive: true });
210
230
  carousel.addEventListener('touchmove', handleMove, { passive: true });
@@ -479,52 +479,48 @@
479
479
  showSlide(currentIndex + moveBy);
480
480
  });
481
481
 
482
- // SCROLL FLUIDO com trackpad
482
+ // SCROLL FLUIDO dinâmico com trackpad
483
483
  carousel.addEventListener('wheel', function(e) {
484
- // Responder APENAS ao scroll horizontal (trackpad lateral)
485
- if (Math.abs(e.deltaX) > 0 && Math.abs(e.deltaX) > Math.abs(e.deltaY)) {
486
- e.preventDefault(); // Prevenir scroll da página
484
+ if (Math.abs(e.deltaX) > 0) {
485
+ e.preventDefault();
487
486
 
488
- // Acumular o scroll para movimento mais fluido
489
- scrollAccumulator += e.deltaX * 0.01; // Fator de sensibilidade
487
+ // Obter posição atual
488
+ const currentTransform = carousel.style.transform;
489
+ const match = currentTransform.match(/translateX\((-?\d*\.?\d*)px\)/);
490
+ let currentOffset = match ? parseFloat(match[1]) : 0;
490
491
 
491
- // Calcular nova posição baseada no acumulador
492
- const newPosition = currentIndex + scrollAccumulator;
492
+ // Movimento proporcional ao deltaX
493
+ const scrollMultiplier = 1.5;
494
+ const newOffset = currentOffset - (e.deltaX * scrollMultiplier);
493
495
 
494
- // Aplicar movimento fluido
495
- const clampedPosition = setCarouselPosition(newPosition);
496
+ // Limites
497
+ const maxOffset = 0;
498
+ const minOffset = -(maxIndex * (itemWidth + itemsGap));
496
499
 
497
- // Cancelar animação anterior se existir
498
- if (scrollAnimationFrame) {
499
- cancelAnimationFrame(scrollAnimationFrame);
500
+ // Resistência nas bordas
501
+ let finalOffset = newOffset;
502
+ if (newOffset > maxOffset) {
503
+ finalOffset = maxOffset + ((newOffset - maxOffset) * 0.3);
504
+ } else if (newOffset < minOffset) {
505
+ finalOffset = minOffset + ((newOffset - minOffset) * 0.3);
500
506
  }
501
507
 
502
- // Se parou de fazer scroll, fazer snap para o slide mais próximo
503
- isScrolling = true;
508
+ // Aplicar posição
509
+ carousel.style.transition = 'none';
510
+ carousel.style.transform = `translateX(${finalOffset}px)`;
511
+
512
+ // Atualizar currentIndex
513
+ const newIndex = Math.round(Math.abs(finalOffset) / (itemWidth + itemsGap));
514
+ currentIndex = Math.max(0, Math.min(newIndex, maxIndex));
515
+ updateNavigationButtons();
516
+
517
+ // Snap quando parar
504
518
  clearTimeout(scrollTimeout);
505
519
  scrollTimeout = setTimeout(() => {
506
- isScrolling = false;
507
-
508
- // Snap para o slide mais próximo
509
- const targetIndex = Math.round(clampedPosition);
510
- currentIndex = targetIndex;
511
-
512
- // Animação suave para o snap
513
- carousel.style.transition = 'transform 0.2s ease-out';
514
- setCarouselPosition(currentIndex);
515
- updateNavigationButtons();
516
-
517
- // Remover transição após a animação
518
- setTimeout(() => {
519
- carousel.style.transition = 'none';
520
- }, 200);
521
-
522
- // Resetar acumulador
523
- scrollAccumulator = 0;
524
- }, 150); // Tempo de espera antes do snap
525
-
520
+ carousel.style.transition = 'transform 0.3s ease-out';
521
+ showSlide(currentIndex);
522
+ }, 150);
526
523
  }
527
- // Para scroll vertical, não fazer nada - deixar comportamento normal da página
528
524
  }, { passive: false });
529
525
 
530
526
  // Touch e arraste para mobile
@@ -7,7 +7,7 @@
7
7
  <div class="team-container">
8
8
  <div class="team-header">
9
9
  <h2 class="team-title">{{ value.title }}</h2>
10
- <h4 class="team-subtitle">{{ value.description }}</h4>
10
+ <h3 class="team-subtitle">{{ value.description }}</h3>
11
11
  </div>
12
12
 
13
13
  <div class="team-carousel-wrapper">
@@ -73,6 +73,7 @@
73
73
  let currentIndex = 0;
74
74
  let startX, moveX, initialPosition;
75
75
  let isDragging = false;
76
+ let snapTimeout; // Para o timeout do snap do trackpad
76
77
 
77
78
  // Verifica se é dispositivo mobile
78
79
  function isMobile() {
@@ -209,6 +210,62 @@
209
210
  }
210
211
  }
211
212
 
213
+ // FUNCIONALIDADE DE SCROLL COM TRACKPAD (APENAS HORIZONTAL)
214
+ carousel.addEventListener('wheel', function(e) {
215
+ // Verifica se há movimento horizontal (trackpad)
216
+ const hasHorizontalScroll = Math.abs(e.deltaX) > 0;
217
+
218
+ // No mobile, não intercepta o scroll para permitir scroll da página
219
+ if (isMobile()) return;
220
+
221
+ // Apenas intercepta se há movimento horizontal
222
+ if (hasHorizontalScroll) {
223
+ e.preventDefault();
224
+
225
+ // Usa apenas deltaX (movimento horizontal)
226
+ const deltaValue = e.deltaX;
227
+
228
+ // Obter posição atual do transform
229
+ const currentTransform = carousel.style.transform;
230
+ const match = currentTransform.match(/translateX\((-?\d*\.?\d*)px\)/);
231
+ let currentOffset = match ? parseFloat(match[1]) : 0;
232
+
233
+ // Movimento proporcional
234
+ const scrollMultiplier = 1.5;
235
+ const newOffset = currentOffset - (deltaValue * scrollMultiplier);
236
+
237
+ // Calcula os limites baseado nas funções existentes
238
+ const maxOffset = 0;
239
+ const itemWidth = getItemWidth();
240
+ const itemGap = getItemGap();
241
+ const minOffset = -(getMaxIndex() * (itemWidth + itemGap));
242
+
243
+ // Resistência nas bordas
244
+ let finalOffset = newOffset;
245
+ if (newOffset > maxOffset) {
246
+ finalOffset = maxOffset + ((newOffset - maxOffset) * 0.3);
247
+ } else if (newOffset < minOffset) {
248
+ finalOffset = minOffset + ((newOffset - minOffset) * 0.3);
249
+ }
250
+
251
+ // Aplicar posição
252
+ carousel.style.transition = 'none';
253
+ carousel.style.transform = `translateX(${finalOffset}px)`;
254
+
255
+ // Atualizar currentIndex baseado na posição
256
+ const newIndex = Math.round(Math.abs(finalOffset) / (itemWidth + itemGap));
257
+ currentIndex = Math.max(0, Math.min(newIndex, getMaxIndex()));
258
+ updateNavigationButtons();
259
+
260
+ // Snap quando parar de rolar
261
+ clearTimeout(snapTimeout);
262
+ snapTimeout = setTimeout(() => {
263
+ carousel.style.transition = 'transform 0.5s ease-in-out';
264
+ showSlide(currentIndex);
265
+ }, 150);
266
+ }
267
+ }, { passive: false });
268
+
212
269
  // Ajuste quando a tela é redimensionada
213
270
  let resizeTimeout;
214
271
  window.addEventListener('resize', function() {
@@ -62,6 +62,7 @@
62
62
  let currentIndex = 0;
63
63
  let startX, moveX, initialPosition;
64
64
  let isDragging = false;
65
+ let isScrolling = false;
65
66
 
66
67
  // Verifica se é dispositivo mobile
67
68
  function isMobile() {
@@ -75,27 +76,61 @@
75
76
  return 2;
76
77
  }
77
78
 
78
- // Verifica se deve mostrar as setas
79
+ // NOVA FUNÇÃO: Verifica se cards à esquerda
80
+ function hasCardsToLeft() {
81
+ return currentIndex > 0;
82
+ }
83
+
84
+ // NOVA FUNÇÃO: Verifica se há cards à direita
85
+ function hasCardsToRight() {
86
+ // Método mais simples e confiável
87
+ return currentIndex < getMaxIndex();
88
+ }
89
+
90
+ // Verifica se deve mostrar as setas (MELHORADO)
79
91
  function shouldShowArrows() {
80
- if (isMobile()) return false; // Sempre esconder no mobile
81
- return items.length > getVisibleItems(); // Só mostrar se há mais itens que o visível
92
+ if (isMobile()) return false;
93
+ return items.length > getVisibleItems();
82
94
  }
83
95
 
84
- // Esconde os botões quando necessário
85
- function hideButtonsWhenNeeded() {
96
+ // Esconde/mostra botões baseado na existência de cards (MELHORADO)
97
+ function updateArrowVisibility() {
86
98
  if (!shouldShowArrows()) {
87
99
  prevButton.style.setProperty('display', 'none', 'important');
88
100
  nextButton.style.setProperty('display', 'none', 'important');
89
- } else {
90
- // Mostrar os botões no desktop quando há mais itens
101
+ return;
102
+ }
103
+
104
+ // Debug: mostra valores no console
105
+ console.log('Current Index:', currentIndex);
106
+ console.log('Max Index:', getMaxIndex());
107
+ console.log('Has Cards Left:', hasCardsToLeft());
108
+ console.log('Has Cards Right:', hasCardsToRight());
109
+
110
+ // Mostrar/esconder botão anterior baseado se há cards à esquerda
111
+ if (hasCardsToLeft()) {
91
112
  prevButton.style.removeProperty('display');
113
+ prevButton.style.opacity = '1';
114
+ prevButton.style.pointerEvents = 'auto';
115
+ } else {
116
+ prevButton.style.opacity = '0';
117
+ prevButton.style.pointerEvents = 'none';
118
+ }
119
+
120
+ // Mostrar/esconder botão próximo baseado se há cards à direita
121
+ if (hasCardsToRight()) {
92
122
  nextButton.style.removeProperty('display');
123
+ nextButton.style.setProperty('opacity', '1', 'important');
124
+ nextButton.style.setProperty('display', 'flex', 'important');
125
+ nextButton.style.setProperty('pointer-events', 'auto', 'important');
126
+ } else {
127
+ nextButton.style.setProperty('opacity', '0', 'important');
128
+ nextButton.style.setProperty('pointer-events', 'none', 'important');
93
129
  }
94
130
  }
95
131
 
96
132
  // Obtém a largura de um item considerando a viewport
97
133
  function getItemWidth() {
98
- // Em telas muito pequenas, use a largura da viewport menos padding
99
134
  if (window.innerWidth < 480) {
100
135
  return Math.min(items[0].offsetWidth, window.innerWidth * 0.9);
101
136
  }
@@ -103,18 +138,16 @@
103
138
  }
104
139
 
105
140
  function getItemGap() {
106
- // Gap ajustável dependendo da tela
107
141
  return window.innerWidth < 768 ? 15 : 25;
108
142
  }
109
143
 
110
- // Calcula o índice máximo com base nos itens visíveis
111
144
  function getMaxIndex() {
112
- return Math.max(0, items.length - getVisibleItems());
145
+ const visibleItems = getVisibleItems();
146
+ return Math.max(0, items.length - visibleItems);
113
147
  }
114
148
 
115
- // Define quantos itens rolar por vez (1 no mobile, 1 no desktop)
116
149
  function getScrollAmount() {
117
- return 1; // Sempre 1 neste carrossel específico
150
+ return 1;
118
151
  }
119
152
 
120
153
  // Mostra os slides baseado no índice atual
@@ -125,47 +158,107 @@
125
158
  const offset = currentIndex * (itemWidth + itemGap);
126
159
 
127
160
  carousel.style.transform = `translateX(-${offset}px)`;
128
- updateNavigationButtons();
161
+ updateArrowVisibility(); // Atualizada para nova função
129
162
  }
130
163
 
131
- // Atualiza a visibilidade dos botões de navegação
132
- function updateNavigationButtons() {
133
- // Se não deve mostrar setas, esconder ambos os botões
134
- if (!shouldShowArrows()) {
135
- hideButtonsWhenNeeded();
136
- return;
137
- }
164
+ // NOVA FUNCIONALIDADE: Scroll dinâmico com trackpad/mouse wheel
165
+ function handleWheel(e) {
166
+ // Debug: mostra valores do evento
167
+ console.log('Wheel event:', { deltaX: e.deltaX, deltaY: e.deltaY, shiftKey: e.shiftKey });
138
168
 
139
- // No primeiro slide, ocultar o botão anterior
140
- if (currentIndex === 0) {
141
- prevButton.style.opacity = '0';
142
- prevButton.style.pointerEvents = 'none';
143
- } else {
144
- prevButton.style.opacity = '1';
145
- prevButton.style.pointerEvents = 'auto';
169
+ let deltaX = e.deltaX;
170
+
171
+ // Para mouse wheel: usar Shift + wheel (deltaY vira deltaX)
172
+ if (e.shiftKey && Math.abs(e.deltaY) > Math.abs(e.deltaX)) {
173
+ deltaX = e.deltaY;
146
174
  }
147
175
 
148
- // No último slide, ocultar o botão próximo
149
- if (currentIndex >= getMaxIndex()) {
150
- nextButton.style.setProperty('opacity', '0');
151
- nextButton.style.setProperty('pointer-events', 'none');
152
- } else {
153
- nextButton.style.setProperty('opacity', '1', 'important');
154
- nextButton.style.setProperty('display', 'flex', 'important');
155
- nextButton.style.setProperty('pointer-events', 'auto', 'important');
176
+ // Detectar qualquer scroll horizontal (sem threshold mínimo)
177
+ if (Math.abs(deltaX) > 0) {
178
+ e.preventDefault();
179
+ e.stopPropagation();
180
+
181
+ // Obter posição atual do transform
182
+ const currentTransform = carousel.style.transform;
183
+ const match = currentTransform.match(/translateX\((-?\d*\.?\d*)px\)/);
184
+ let currentOffset = match ? parseFloat(match[1]) : 0;
185
+
186
+ // Aplicar o movimento proporcional ao deltaX
187
+ // Multiplicador para controlar a velocidade (ajuste conforme necessário)
188
+ const scrollMultiplier = 1.5;
189
+ const newOffset = currentOffset - (deltaX * scrollMultiplier);
190
+
191
+ // Calcular limites
192
+ const maxOffset = 0; // Limite esquerdo
193
+ const itemWidth = getItemWidth();
194
+ const itemGap = getItemGap();
195
+ const totalItems = items.length;
196
+ const visibleItems = getVisibleItems();
197
+ const minOffset = -((totalItems - visibleItems) * (itemWidth + itemGap));
198
+
199
+ // Aplicar limites com efeito de "elastic" nas bordas
200
+ let finalOffset = newOffset;
201
+
202
+ if (newOffset > maxOffset) {
203
+ // Resistência ao puxar além do início
204
+ const overscroll = newOffset - maxOffset;
205
+ finalOffset = maxOffset + (overscroll * 0.3);
206
+ } else if (newOffset < minOffset) {
207
+ // Resistência ao puxar além do fim
208
+ const overscroll = newOffset - minOffset;
209
+ finalOffset = minOffset + (overscroll * 0.3);
210
+ }
211
+
212
+ // Aplicar o transform
213
+ carousel.style.transition = 'none';
214
+ carousel.style.transform = `translateX(${finalOffset}px)`;
215
+
216
+ // Atualizar currentIndex baseado na posição
217
+ const newIndex = Math.round(Math.abs(finalOffset) / (itemWidth + itemGap));
218
+ currentIndex = Math.max(0, Math.min(newIndex, getMaxIndex()));
219
+
220
+ // Atualizar setas baseado na nova posição
221
+ updateArrowVisibility();
222
+
223
+ // Aplicar snap suave quando parar de rolar
224
+ clearTimeout(window.snapTimeout);
225
+ window.snapTimeout = setTimeout(() => {
226
+ carousel.style.transition = 'transform 0.3s ease-out';
227
+ showSlide(currentIndex);
228
+ }, 150);
229
+
230
+ console.log('Smooth scroll:', {
231
+ deltaX,
232
+ currentOffset,
233
+ newOffset: finalOffset,
234
+ currentIndex
235
+ });
156
236
  }
157
237
  }
158
238
 
159
- // Eventos dos botões
239
+ // Eventos dos botões (mantidos)
160
240
  prevButton.addEventListener('click', function() {
161
- showSlide(currentIndex - getScrollAmount());
241
+ if (hasCardsToLeft()) {
242
+ showSlide(currentIndex - getScrollAmount());
243
+ }
162
244
  });
163
245
 
164
246
  nextButton.addEventListener('click', function() {
165
- showSlide(currentIndex + getScrollAmount());
247
+ if (hasCardsToRight()) {
248
+ showSlide(currentIndex + getScrollAmount());
249
+ }
166
250
  });
167
251
 
168
- // Eventos de arrastar
252
+ // NOVO: Adicionar evento de scroll do mouse/trackpad
253
+ carousel.addEventListener('wheel', handleWheel, { passive: false });
254
+
255
+ // Adicionar também no container para capturar melhor
256
+ const carouselContainer = carousel.parentElement;
257
+ if (carouselContainer) {
258
+ carouselContainer.addEventListener('wheel', handleWheel, { passive: false });
259
+ }
260
+
261
+ // Eventos de arrastar (mantidos com pequenos ajustes)
169
262
  carousel.addEventListener('mousedown', handleStart);
170
263
  carousel.addEventListener('touchstart', handleStart, { passive: true });
171
264
 
@@ -182,8 +275,6 @@
182
275
  initialPosition = currentIndex * (getItemWidth() + getItemGap());
183
276
  carousel.style.transition = 'none';
184
277
 
185
- // Prevenir comportamento padrão para evitar scrolling da página
186
- // mas apenas se for desktop
187
278
  if (e.type !== 'touchstart') {
188
279
  e.preventDefault();
189
280
  }
@@ -192,26 +283,21 @@
192
283
  function handleMove(e) {
193
284
  if (!isDragging) return;
194
285
 
195
- // Atualizar a posição atual do toque/mouse
196
286
  moveX = e.type === 'touchmove' ? e.touches[0].clientX : e.clientX;
197
287
  const diff = moveX - startX;
198
288
 
199
- // Limitar o arrasto para evitar exceder os limites
200
289
  const maxDrag = getItemWidth() * (items.length - getVisibleItems());
201
290
  let newPosition = diff - initialPosition;
202
291
 
203
- // Adicionar resistência ao arrastar além dos limites
204
292
  if (newPosition > 0) {
205
- newPosition = newPosition * 0.3; // Resistência ao puxar para a direita no início
293
+ newPosition = newPosition * 0.3;
206
294
  } else if (newPosition < -maxDrag) {
207
295
  const overDrag = newPosition + maxDrag;
208
- newPosition = -maxDrag + (overDrag * 0.3); // Resistência ao puxar para a esquerda no final
296
+ newPosition = -maxDrag + (overDrag * 0.3);
209
297
  }
210
298
 
211
299
  carousel.style.transform = `translateX(${newPosition}px)`;
212
300
 
213
- // Prevenir comportamento padrão para evitar scrolling da página
214
- // mas apenas se for desktop
215
301
  if (e.type !== 'touchmove') {
216
302
  e.preventDefault();
217
303
  }
@@ -224,17 +310,16 @@
224
310
  carousel.style.transition = 'transform 0.3s ease-in-out';
225
311
 
226
312
  if (!moveX) {
227
- // Se não houve movimento, apenas restore
228
313
  showSlide(currentIndex);
229
314
  return;
230
315
  }
231
316
 
232
317
  const diff = moveX - startX;
233
- const threshold = getItemWidth() / 3; // 1/3 da largura para mudar de slide
318
+ const threshold = getItemWidth() / 3;
234
319
 
235
- if (diff > threshold) {
320
+ if (diff > threshold && hasCardsToLeft()) {
236
321
  showSlide(currentIndex - getScrollAmount());
237
- } else if (diff < -threshold) {
322
+ } else if (diff < -threshold && hasCardsToRight()) {
238
323
  showSlide(currentIndex + getScrollAmount());
239
324
  } else {
240
325
  showSlide(currentIndex);
@@ -246,19 +331,15 @@
246
331
  window.addEventListener('resize', function() {
247
332
  clearTimeout(resizeTimeout);
248
333
  resizeTimeout = setTimeout(function() {
249
- // Atualiza a visibilidade dos botões com base no novo tamanho da tela
250
- hideButtonsWhenNeeded();
334
+ updateArrowVisibility(); // Usar nova função
251
335
 
252
- // Verifica se o índice atual ainda é válido com o novo tamanho
253
336
  if (currentIndex > getMaxIndex()) {
254
337
  currentIndex = getMaxIndex();
255
338
  }
256
339
 
257
- // Reajustar tamanhos baseados na nova largura da tela
258
- carousel.style.transition = 'none'; // Desativa transição para reposicionamento imediato
340
+ carousel.style.transition = 'none';
259
341
  showSlide(currentIndex);
260
342
 
261
- // Restaura a transição após o reposicionamento
262
343
  setTimeout(() => {
263
344
  carousel.style.transition = 'transform 0.3s ease-in-out';
264
345
  }, 50);
@@ -268,22 +349,18 @@
268
349
  // Inicializar o carrossel
269
350
  showSlide(0);
270
351
 
271
- // Adiciona uma verificação adicional após carregamento completo
352
+ // Verificação adicional após carregamento
272
353
  setTimeout(function() {
273
- // Garante que os botões estejam configurados corretamente
274
- hideButtonsWhenNeeded();
354
+ updateArrowVisibility();
275
355
 
276
- // Verificar se deve mostrar as setas e configurar adequadamente
277
356
  if (shouldShowArrows()) {
278
- updateNavigationButtons();
357
+ updateArrowVisibility(); // Usar nova função
279
358
  }
280
359
 
281
- // Verificar novamente se os elementos têm tamanho correto
282
360
  showSlide(currentIndex);
283
361
  }, 500);
284
362
  }
285
363
 
286
- // Iniciar carrossel com um pequeno atraso para garantir que todos os elementos estejam carregados
287
364
  setTimeout(initCarousel, 100);
288
365
  });
289
366
  </script>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wagtail-enap-designsystem
3
- Version: 1.2.1.105
3
+ Version: 1.2.1.107
4
4
  Summary: Módulo de componentes utilizado nos portais ENAP, desenvolvido com Wagtail + CodeRedCMS
5
5
  Author: Renan Campos
6
6
  Author-email: renan.oliveira@enap.gov.br