@semcore/carousel 3.47.1 → 16.0.0-prerelease.2

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/src/Carousel.tsx CHANGED
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
- import createComponent, { Component, sstyled, Root } from '@semcore/core';
2
+ import { createComponent, Component, sstyled, Root } from '@semcore/core';
3
3
  import Button from '@semcore/button';
4
4
  import Modal from '@semcore/modal';
5
5
  import { Box, Flex } from '@semcore/flex-box';
6
6
  import ChevronRight from '@semcore/icon/ChevronRight/l';
7
7
  import ChevronLeft from '@semcore/icon/ChevronLeft/l';
8
- import uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';
9
- import i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';
8
+ import uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';
9
+ import i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';
10
10
  import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
11
- import logger from '@semcore/utils/lib/logger';
11
+ import logger from '@semcore/core/lib/utils/logger';
12
12
  import style from './style/carousel.shadow.css';
13
13
  import CarouselType, {
14
14
  CarouselProps,
@@ -21,9 +21,9 @@ import CarouselType, {
21
21
  CarouselIndicatorProps,
22
22
  } from './Carousel.types';
23
23
  import { BoxProps } from '@semcore/flex-box';
24
- import { findAllComponents } from '@semcore/utils/lib/findComponent';
24
+ import { findAllComponents } from '@semcore/core/lib/utils/findComponent';
25
25
  import { createBreakpoints } from '@semcore/breakpoints';
26
- import keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
26
+ import keyboardFocusEnhance from '@semcore/core/lib/utils/enhances/keyboardFocusEnhance';
27
27
 
28
28
  const MAP_TRANSFORM: Record<string, 'left' | 'right'> = {
29
29
  ArrowLeft: 'left',
@@ -33,7 +33,7 @@ const MAP_TRANSFORM: Record<string, 'left' | 'right'> = {
33
33
  const enhance = [uniqueIDEnhancement(), i18nEnhance(localizedMessages)] as const;
34
34
  const media = ['(min-width: 481px)', '(max-width: 480px)'];
35
35
  const BreakPoints = createBreakpoints(media);
36
- const isSmallScreen = (index: number) => index === 1;
36
+ const isSmallScreen = (index?: number) => index === 1;
37
37
 
38
38
  class CarouselRoot extends Component<
39
39
  CarouselProps,
@@ -406,6 +406,7 @@ class CarouselRoot extends Component<
406
406
  key,
407
407
  })),
408
408
  role: 'tablist',
409
+ tabIndex: 0,
409
410
  'aria-label': getI18nText('slides'),
410
411
  };
411
412
  }
@@ -696,6 +697,7 @@ const Prev = (props: CarouselButtonProps) => {
696
697
  theme={inverted ? 'invert' : 'muted'}
697
698
  use={'tertiary'}
698
699
  size={'l'}
700
+ innerOutline
699
701
  />
700
702
  )}
701
703
  </SPrev>,
@@ -718,6 +720,7 @@ const Next = (props: CarouselButtonProps) => {
718
720
  theme={inverted ? 'invert' : 'muted'}
719
721
  use={'tertiary'}
720
722
  size={'l'}
723
+ innerOutline
721
724
  />
722
725
  )}
723
726
  </SNext>,
@@ -735,13 +738,12 @@ const Indicators = ({ items, styles, Children, inverted }: CarouselIndicatorsPro
735
738
  }
736
739
  return sstyled(styles)(
737
740
  <SIndicators render={Box}>
738
- {items?.map((item, index) => (
741
+ {items?.map((item: CarouselItem, index: number) => (
739
742
  <Carousel.Indicator key={index} {...item} inverted={inverted} />
740
743
  ))}
741
744
  </SIndicators>,
742
745
  );
743
746
  };
744
- Indicators.enhance = [keyboardFocusEnhance()];
745
747
 
746
748
  const Indicator = ({ styles, Children }: CarouselIndicatorProps) => {
747
749
  const SIndicator = Root;
@@ -54,23 +54,11 @@ SItem[zoomOut] {
54
54
  SIndicators {
55
55
  display: flex;
56
56
  justify-content: center;
57
- margin-top: var(--intergalactic-spacing-4x, 16px);
57
+ margin: var(--intergalactic-spacing-4x, 16px) 3px 3px 3px;
58
58
  outline: none;
59
59
  position: relative;
60
60
  }
61
61
 
62
- SIndicators[keyboardFocused]:after {
63
- content: '';
64
- display: block;
65
- position: absolute;
66
- box-shadow: var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));
67
- z-index: 1;
68
- width: calc(100% - 3px * 2);
69
- height: calc(100% - 3px);
70
- top: 0;
71
- left: 3px;
72
- }
73
-
74
62
  SIndicator {
75
63
  margin: 0 calc(0.5 * var(--intergalactic-spacing-3x, 12px));
76
64
  cursor: pointer;
@@ -110,24 +98,6 @@ SNext {
110
98
  }
111
99
  }
112
100
 
113
- SPrevButton, SNextButton {
114
- &:focus-visible {
115
- box-shadow: none;
116
- &:after {
117
- content: '';
118
- display: block;
119
- position: absolute;
120
- box-shadow: var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));
121
- z-index: 1;
122
- width: calc(100% - 3px * 2);
123
- height: calc(100% - 3px * 2);
124
- top: 3px;
125
- left: 3px;
126
- border-radius: var(--intergalactic-control-rounded, 6px);
127
- }
128
- }
129
- }
130
-
131
101
  SPrev {
132
102
  margin-right: var(--intergalactic-spacing-2x, 8px);
133
103
  }