@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/CHANGELOG.md +31 -1
- package/lib/cjs/Carousel.js +26 -43
- package/lib/cjs/Carousel.js.map +1 -1
- package/lib/cjs/style/carousel.shadow.css +1 -1
- package/lib/es6/Carousel.js +26 -43
- package/lib/es6/Carousel.js.map +1 -1
- package/lib/es6/style/carousel.shadow.css +1 -1
- package/lib/esm/Carousel.mjs +514 -358
- package/lib/esm/index.mjs +2 -2
- package/lib/esm/style/carousel.shadow.css +119 -0
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +30 -30
- package/lib/esm/translations/de.json.mjs +14 -10
- package/lib/esm/translations/en.json.mjs +14 -10
- package/lib/esm/translations/es.json.mjs +14 -10
- package/lib/esm/translations/fr.json.mjs +14 -10
- package/lib/esm/translations/it.json.mjs +14 -10
- package/lib/esm/translations/ja.json.mjs +14 -10
- package/lib/esm/translations/ko.json.mjs +14 -10
- package/lib/esm/translations/nl.json.mjs +14 -10
- package/lib/esm/translations/pl.json.mjs +14 -10
- package/lib/esm/translations/pt.json.mjs +14 -10
- package/lib/esm/translations/sv.json.mjs +14 -10
- package/lib/esm/translations/tr.json.mjs +14 -10
- package/lib/esm/translations/vi.json.mjs +14 -10
- package/lib/esm/translations/zh.json.mjs +14 -10
- package/package.json +7 -7
- package/src/Carousel.tsx +3 -27
- package/src/style/carousel.shadow.css +1 -1
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
|
|
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() {
|