@semcore/carousel 16.0.0-prerelease.2 → 16.0.0-prerelease.21

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
@@ -23,7 +23,6 @@ import CarouselType, {
23
23
  import { BoxProps } from '@semcore/flex-box';
24
24
  import { findAllComponents } from '@semcore/core/lib/utils/findComponent';
25
25
  import { createBreakpoints } from '@semcore/breakpoints';
26
- import keyboardFocusEnhance from '@semcore/core/lib/utils/enhances/keyboardFocusEnhance';
27
26
 
28
27
  const MAP_TRANSFORM: Record<string, 'left' | 'right'> = {
29
28
  ArrowLeft: 'left',
@@ -350,7 +349,9 @@ class CarouselRoot extends Component<
350
349
  };
351
350
  },
352
351
  () => {
353
- this.state.isOpenZoom && this.transformContainer();
352
+ if (this.state.isOpenZoom) {
353
+ this.transformContainer();
354
+ }
354
355
  },
355
356
  );
356
357
  };
@@ -608,8 +609,6 @@ const ContentBox = (props: BoxProps) => {
608
609
 
609
610
  class Item extends Component<CarouselItemProps> {
610
611
  refItem = React.createRef<HTMLElement>();
611
- keepFocusTimeout: NodeJS.Timeout | undefined;
612
- static enhance = [keyboardFocusEnhance(false)];
613
612
 
614
613
  componentDidMount() {
615
614
  const { toggleItem, transform } = this.props;
@@ -627,38 +626,15 @@ class Item extends Component<CarouselItemProps> {
627
626
  const refItem = this.refItem.current;
628
627
 
629
628
  toggleItem && refItem && toggleItem({ node: refItem }, true);
630
- clearTimeout(this.keepFocusTimeout);
631
629
  }
632
630
 
633
631
  componentDidUpdate(prevProps: CarouselItemProps) {
634
- clearTimeout(this.keepFocusTimeout);
635
-
636
632
  const transform = this.props.transform;
637
633
  const refItem = this.refItem.current;
638
634
 
639
635
  if (prevProps.transform !== transform && refItem) {
640
636
  refItem.style.transform = `translateX(${transform}%)`;
641
637
  }
642
- if (this.props.current) {
643
- this.keepFocusTimeout = setTimeout(() => {
644
- if (
645
- document.activeElement !== refItem &&
646
- (document.activeElement as HTMLElement)?.dataset.carousel === refItem?.dataset.carousel
647
- ) {
648
- refItem?.focus();
649
- }
650
- }, 100);
651
- }
652
- if (
653
- prevProps.isOpenZoom === true &&
654
- this.props.isOpenZoom === false &&
655
- this.props.current &&
656
- !this.props.zoomOut
657
- ) {
658
- this.keepFocusTimeout = setTimeout(() => {
659
- this.refItem.current?.focus();
660
- }, 200);
661
- }
662
638
  }
663
639
 
664
640
  render() {
@@ -14,7 +14,7 @@ SContentBox, SModalBox {
14
14
  position: relative;
15
15
  overflow: hidden;
16
16
  border-radius: var(--intergalactic-surface-rounded, 6px);
17
- &:has(SItem[keyboardFocused]) {
17
+ &:has(SItem:focus-visible) {
18
18
  &:after {
19
19
  content: '';
20
20
  display: block;