@fluentui/react-carousel 0.0.0-nightly-20241008-0405.1
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 +129 -0
- package/LICENSE +15 -0
- package/README.md +33 -0
- package/dist/index.d.ts +625 -0
- package/lib/Carousel.js +1 -0
- package/lib/Carousel.js.map +1 -0
- package/lib/CarouselAutoplayButton.js +1 -0
- package/lib/CarouselAutoplayButton.js.map +1 -0
- package/lib/CarouselButton.js +1 -0
- package/lib/CarouselButton.js.map +1 -0
- package/lib/CarouselCard.js +1 -0
- package/lib/CarouselCard.js.map +1 -0
- package/lib/CarouselContext.js +2 -0
- package/lib/CarouselContext.js.map +1 -0
- package/lib/CarouselNav.js +1 -0
- package/lib/CarouselNav.js.map +1 -0
- package/lib/CarouselNavButton.js +1 -0
- package/lib/CarouselNavButton.js.map +1 -0
- package/lib/CarouselNavContainer.js +1 -0
- package/lib/CarouselNavContainer.js.map +1 -0
- package/lib/CarouselNavImageButton.js +1 -0
- package/lib/CarouselNavImageButton.js.map +1 -0
- package/lib/CarouselSlider.js +1 -0
- package/lib/CarouselSlider.js.map +1 -0
- package/lib/components/Carousel/Carousel.js +20 -0
- package/lib/components/Carousel/Carousel.js.map +1 -0
- package/lib/components/Carousel/Carousel.types.js +3 -0
- package/lib/components/Carousel/Carousel.types.js.map +1 -0
- package/lib/components/Carousel/index.js +5 -0
- package/lib/components/Carousel/index.js.map +1 -0
- package/lib/components/Carousel/renderCarousel.js +12 -0
- package/lib/components/Carousel/renderCarousel.js.map +1 -0
- package/lib/components/Carousel/useCarousel.js +117 -0
- package/lib/components/Carousel/useCarousel.js.map +1 -0
- package/lib/components/Carousel/useCarouselContextValues.js +28 -0
- package/lib/components/Carousel/useCarouselContextValues.js.map +1 -0
- package/lib/components/Carousel/useCarouselStyles.styles.js +33 -0
- package/lib/components/Carousel/useCarouselStyles.styles.js.map +1 -0
- package/lib/components/CarouselAutoplayButton/CarouselAutoplayButton.js +18 -0
- package/lib/components/CarouselAutoplayButton/CarouselAutoplayButton.js.map +1 -0
- package/lib/components/CarouselAutoplayButton/CarouselAutoplayButton.types.js +1 -0
- package/lib/components/CarouselAutoplayButton/CarouselAutoplayButton.types.js.map +1 -0
- package/lib/components/CarouselAutoplayButton/index.js +5 -0
- package/lib/components/CarouselAutoplayButton/index.js.map +1 -0
- package/lib/components/CarouselAutoplayButton/renderCarouselAutoplayButton.js +9 -0
- package/lib/components/CarouselAutoplayButton/renderCarouselAutoplayButton.js.map +1 -0
- package/lib/components/CarouselAutoplayButton/useCarouselAutoplayButton.js +64 -0
- package/lib/components/CarouselAutoplayButton/useCarouselAutoplayButton.js.map +1 -0
- package/lib/components/CarouselAutoplayButton/useCarouselAutoplayButtonStyles.styles.js +42 -0
- package/lib/components/CarouselAutoplayButton/useCarouselAutoplayButtonStyles.styles.js.map +1 -0
- package/lib/components/CarouselButton/CarouselButton.js +16 -0
- package/lib/components/CarouselButton/CarouselButton.js.map +1 -0
- package/lib/components/CarouselButton/CarouselButton.types.js +3 -0
- package/lib/components/CarouselButton/CarouselButton.types.js.map +1 -0
- package/lib/components/CarouselButton/index.js +5 -0
- package/lib/components/CarouselButton/index.js.map +1 -0
- package/lib/components/CarouselButton/renderCarouselButton.js +9 -0
- package/lib/components/CarouselButton/renderCarouselButton.js.map +1 -0
- package/lib/components/CarouselButton/useCarouselButton.js +87 -0
- package/lib/components/CarouselButton/useCarouselButton.js.map +1 -0
- package/lib/components/CarouselButton/useCarouselButtonStyles.styles.js +41 -0
- package/lib/components/CarouselButton/useCarouselButtonStyles.styles.js.map +1 -0
- package/lib/components/CarouselCard/CarouselCard.js +20 -0
- package/lib/components/CarouselCard/CarouselCard.js.map +1 -0
- package/lib/components/CarouselCard/CarouselCard.types.js +3 -0
- package/lib/components/CarouselCard/CarouselCard.types.js.map +1 -0
- package/lib/components/CarouselCard/index.js +5 -0
- package/lib/components/CarouselCard/index.js.map +1 -0
- package/lib/components/CarouselCard/renderCarouselCard.js +8 -0
- package/lib/components/CarouselCard/renderCarouselCard.js.map +1 -0
- package/lib/components/CarouselCard/useCarouselCard.js +91 -0
- package/lib/components/CarouselCard/useCarouselCard.js.map +1 -0
- package/lib/components/CarouselCard/useCarouselCardStyles.styles.js +45 -0
- package/lib/components/CarouselCard/useCarouselCardStyles.styles.js.map +1 -0
- package/lib/components/CarouselContext.js +23 -0
- package/lib/components/CarouselContext.js.map +1 -0
- package/lib/components/CarouselContext.types.js +1 -0
- package/lib/components/CarouselContext.types.js.map +1 -0
- package/lib/components/CarouselNav/CarouselNav.js +20 -0
- package/lib/components/CarouselNav/CarouselNav.js.map +1 -0
- package/lib/components/CarouselNav/CarouselNav.types.js +1 -0
- package/lib/components/CarouselNav/CarouselNav.types.js.map +1 -0
- package/lib/components/CarouselNav/CarouselNavContext.js +21 -0
- package/lib/components/CarouselNav/CarouselNavContext.js.map +1 -0
- package/lib/components/CarouselNav/CarouselNavIndexContext.js +8 -0
- package/lib/components/CarouselNav/CarouselNavIndexContext.js.map +1 -0
- package/lib/components/CarouselNav/index.js +5 -0
- package/lib/components/CarouselNav/index.js.map +1 -0
- package/lib/components/CarouselNav/renderCarouselNav.js +19 -0
- package/lib/components/CarouselNav/renderCarouselNav.js.map +1 -0
- package/lib/components/CarouselNav/useCarouselNav.js +49 -0
- package/lib/components/CarouselNav/useCarouselNav.js.map +1 -0
- package/lib/components/CarouselNav/useCarouselNavStyles.styles.js +63 -0
- package/lib/components/CarouselNav/useCarouselNavStyles.styles.js.map +1 -0
- package/lib/components/CarouselNavButton/CarouselNavButton.js +15 -0
- package/lib/components/CarouselNavButton/CarouselNavButton.js.map +1 -0
- package/lib/components/CarouselNavButton/CarouselNavButton.types.js +3 -0
- package/lib/components/CarouselNavButton/CarouselNavButton.types.js.map +1 -0
- package/lib/components/CarouselNavButton/index.js +5 -0
- package/lib/components/CarouselNavButton/index.js.map +1 -0
- package/lib/components/CarouselNavButton/renderCarouselNavButton.js +9 -0
- package/lib/components/CarouselNavButton/renderCarouselNavButton.js.map +1 -0
- package/lib/components/CarouselNavButton/useCarouselNavButton.js +73 -0
- package/lib/components/CarouselNavButton/useCarouselNavButton.js.map +1 -0
- package/lib/components/CarouselNavButton/useCarouselNavButtonStyles.styles.js +196 -0
- package/lib/components/CarouselNavButton/useCarouselNavButtonStyles.styles.js.map +1 -0
- package/lib/components/CarouselNavContainer/CarouselNavContainer.js +20 -0
- package/lib/components/CarouselNavContainer/CarouselNavContainer.js.map +1 -0
- package/lib/components/CarouselNavContainer/CarouselNavContainer.types.js +3 -0
- package/lib/components/CarouselNavContainer/CarouselNavContainer.types.js.map +1 -0
- package/lib/components/CarouselNavContainer/index.js +5 -0
- package/lib/components/CarouselNavContainer/index.js.map +1 -0
- package/lib/components/CarouselNavContainer/renderCarouselNavContainer.js +15 -0
- package/lib/components/CarouselNavContainer/renderCarouselNavContainer.js.map +1 -0
- package/lib/components/CarouselNavContainer/useCarouselNavContainer.js +51 -0
- package/lib/components/CarouselNavContainer/useCarouselNavContainer.js.map +1 -0
- package/lib/components/CarouselNavContainer/useCarouselNavContainerStyles.styles.js +104 -0
- package/lib/components/CarouselNavContainer/useCarouselNavContainerStyles.styles.js.map +1 -0
- package/lib/components/CarouselNavImageButton/CarouselNavImageButton.js +16 -0
- package/lib/components/CarouselNavImageButton/CarouselNavImageButton.js.map +1 -0
- package/lib/components/CarouselNavImageButton/CarouselNavImageButton.types.js +3 -0
- package/lib/components/CarouselNavImageButton/CarouselNavImageButton.types.js.map +1 -0
- package/lib/components/CarouselNavImageButton/index.js +5 -0
- package/lib/components/CarouselNavImageButton/index.js.map +1 -0
- package/lib/components/CarouselNavImageButton/renderCarouselNavImageButton.js +10 -0
- package/lib/components/CarouselNavImageButton/renderCarouselNavImageButton.js.map +1 -0
- package/lib/components/CarouselNavImageButton/useCarouselNavImageButton.js +76 -0
- package/lib/components/CarouselNavImageButton/useCarouselNavImageButton.js.map +1 -0
- package/lib/components/CarouselNavImageButton/useCarouselNavImageButtonStyles.styles.js +85 -0
- package/lib/components/CarouselNavImageButton/useCarouselNavImageButtonStyles.styles.js.map +1 -0
- package/lib/components/CarouselSlider/CarouselSlider.js +18 -0
- package/lib/components/CarouselSlider/CarouselSlider.js.map +1 -0
- package/lib/components/CarouselSlider/CarouselSlider.types.js +1 -0
- package/lib/components/CarouselSlider/CarouselSlider.types.js.map +1 -0
- package/lib/components/CarouselSlider/CarouselSliderContext.js +21 -0
- package/lib/components/CarouselSlider/CarouselSliderContext.js.map +1 -0
- package/lib/components/CarouselSlider/index.js +5 -0
- package/lib/components/CarouselSlider/index.js.map +1 -0
- package/lib/components/CarouselSlider/renderCarouselSlider.js +12 -0
- package/lib/components/CarouselSlider/renderCarouselSlider.js.map +1 -0
- package/lib/components/CarouselSlider/useCarouselSlider.js +36 -0
- package/lib/components/CarouselSlider/useCarouselSlider.js.map +1 -0
- package/lib/components/CarouselSlider/useCarouselSliderStyles.styles.js +26 -0
- package/lib/components/CarouselSlider/useCarouselSliderStyles.styles.js.map +1 -0
- package/lib/components/useEmblaCarousel.js +239 -0
- package/lib/components/useEmblaCarousel.js.map +1 -0
- package/lib/index.js +10 -0
- package/lib/index.js.map +1 -0
- package/lib-commonjs/Carousel.js +6 -0
- package/lib-commonjs/Carousel.js.map +1 -0
- package/lib-commonjs/CarouselAutoplayButton.js +6 -0
- package/lib-commonjs/CarouselAutoplayButton.js.map +1 -0
- package/lib-commonjs/CarouselButton.js +6 -0
- package/lib-commonjs/CarouselButton.js.map +1 -0
- package/lib-commonjs/CarouselCard.js +6 -0
- package/lib-commonjs/CarouselCard.js.map +1 -0
- package/lib-commonjs/CarouselContext.js +7 -0
- package/lib-commonjs/CarouselContext.js.map +1 -0
- package/lib-commonjs/CarouselNav.js +6 -0
- package/lib-commonjs/CarouselNav.js.map +1 -0
- package/lib-commonjs/CarouselNavButton.js +6 -0
- package/lib-commonjs/CarouselNavButton.js.map +1 -0
- package/lib-commonjs/CarouselNavContainer.js +6 -0
- package/lib-commonjs/CarouselNavContainer.js.map +1 -0
- package/lib-commonjs/CarouselNavImageButton.js +6 -0
- package/lib-commonjs/CarouselNavImageButton.js.map +1 -0
- package/lib-commonjs/CarouselSlider.js +6 -0
- package/lib-commonjs/CarouselSlider.js.map +1 -0
- package/lib-commonjs/components/Carousel/Carousel.js +26 -0
- package/lib-commonjs/components/Carousel/Carousel.js.map +1 -0
- package/lib-commonjs/components/Carousel/Carousel.types.js +6 -0
- package/lib-commonjs/components/Carousel/Carousel.types.js.map +1 -0
- package/lib-commonjs/components/Carousel/index.js +10 -0
- package/lib-commonjs/components/Carousel/index.js.map +1 -0
- package/lib-commonjs/components/Carousel/renderCarousel.js +20 -0
- package/lib-commonjs/components/Carousel/renderCarousel.js.map +1 -0
- package/lib-commonjs/components/Carousel/useCarousel.js +119 -0
- package/lib-commonjs/components/Carousel/useCarousel.js.map +1 -0
- package/lib-commonjs/components/Carousel/useCarouselContextValues.js +39 -0
- package/lib-commonjs/components/Carousel/useCarouselContextValues.js.map +1 -0
- package/lib-commonjs/components/Carousel/useCarouselStyles.styles.js +52 -0
- package/lib-commonjs/components/Carousel/useCarouselStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CarouselAutoplayButton/CarouselAutoplayButton.js +24 -0
- package/lib-commonjs/components/CarouselAutoplayButton/CarouselAutoplayButton.js.map +1 -0
- package/lib-commonjs/components/CarouselAutoplayButton/CarouselAutoplayButton.types.js +6 -0
- package/lib-commonjs/components/CarouselAutoplayButton/CarouselAutoplayButton.types.js.map +1 -0
- package/lib-commonjs/components/CarouselAutoplayButton/index.js +10 -0
- package/lib-commonjs/components/CarouselAutoplayButton/index.js.map +1 -0
- package/lib-commonjs/components/CarouselAutoplayButton/renderCarouselAutoplayButton.js +17 -0
- package/lib-commonjs/components/CarouselAutoplayButton/renderCarouselAutoplayButton.js.map +1 -0
- package/lib-commonjs/components/CarouselAutoplayButton/useCarouselAutoplayButton.js +67 -0
- package/lib-commonjs/components/CarouselAutoplayButton/useCarouselAutoplayButton.js.map +1 -0
- package/lib-commonjs/components/CarouselAutoplayButton/useCarouselAutoplayButtonStyles.styles.js +71 -0
- package/lib-commonjs/components/CarouselAutoplayButton/useCarouselAutoplayButtonStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CarouselButton/CarouselButton.js +24 -0
- package/lib-commonjs/components/CarouselButton/CarouselButton.js.map +1 -0
- package/lib-commonjs/components/CarouselButton/CarouselButton.types.js +6 -0
- package/lib-commonjs/components/CarouselButton/CarouselButton.types.js.map +1 -0
- package/lib-commonjs/components/CarouselButton/index.js +10 -0
- package/lib-commonjs/components/CarouselButton/index.js.map +1 -0
- package/lib-commonjs/components/CarouselButton/renderCarouselButton.js +17 -0
- package/lib-commonjs/components/CarouselButton/renderCarouselButton.js.map +1 -0
- package/lib-commonjs/components/CarouselButton/useCarouselButton.js +89 -0
- package/lib-commonjs/components/CarouselButton/useCarouselButton.js.map +1 -0
- package/lib-commonjs/components/CarouselButton/useCarouselButtonStyles.styles.js +60 -0
- package/lib-commonjs/components/CarouselButton/useCarouselButtonStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CarouselCard/CarouselCard.js +24 -0
- package/lib-commonjs/components/CarouselCard/CarouselCard.js.map +1 -0
- package/lib-commonjs/components/CarouselCard/CarouselCard.types.js +6 -0
- package/lib-commonjs/components/CarouselCard/CarouselCard.types.js.map +1 -0
- package/lib-commonjs/components/CarouselCard/index.js +10 -0
- package/lib-commonjs/components/CarouselCard/index.js.map +1 -0
- package/lib-commonjs/components/CarouselCard/renderCarouselCard.js +16 -0
- package/lib-commonjs/components/CarouselCard/renderCarouselCard.js.map +1 -0
- package/lib-commonjs/components/CarouselCard/useCarouselCard.js +94 -0
- package/lib-commonjs/components/CarouselCard/useCarouselCard.js.map +1 -0
- package/lib-commonjs/components/CarouselCard/useCarouselCardStyles.styles.js +67 -0
- package/lib-commonjs/components/CarouselCard/useCarouselCardStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CarouselContext.js +44 -0
- package/lib-commonjs/components/CarouselContext.js.map +1 -0
- package/lib-commonjs/components/CarouselContext.types.js +6 -0
- package/lib-commonjs/components/CarouselContext.types.js.map +1 -0
- package/lib-commonjs/components/CarouselNav/CarouselNav.js +26 -0
- package/lib-commonjs/components/CarouselNav/CarouselNav.js.map +1 -0
- package/lib-commonjs/components/CarouselNav/CarouselNav.types.js +6 -0
- package/lib-commonjs/components/CarouselNav/CarouselNav.types.js.map +1 -0
- package/lib-commonjs/components/CarouselNav/CarouselNavContext.js +46 -0
- package/lib-commonjs/components/CarouselNav/CarouselNavContext.js.map +1 -0
- package/lib-commonjs/components/CarouselNav/CarouselNavIndexContext.js +30 -0
- package/lib-commonjs/components/CarouselNav/CarouselNavIndexContext.js.map +1 -0
- package/lib-commonjs/components/CarouselNav/index.js +10 -0
- package/lib-commonjs/components/CarouselNav/index.js.map +1 -0
- package/lib-commonjs/components/CarouselNav/renderCarouselNav.js +27 -0
- package/lib-commonjs/components/CarouselNav/renderCarouselNav.js.map +1 -0
- package/lib-commonjs/components/CarouselNav/useCarouselNav.js +52 -0
- package/lib-commonjs/components/CarouselNav/useCarouselNav.js.map +1 -0
- package/lib-commonjs/components/CarouselNav/useCarouselNavStyles.styles.js +106 -0
- package/lib-commonjs/components/CarouselNav/useCarouselNavStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CarouselNavButton/CarouselNavButton.js +24 -0
- package/lib-commonjs/components/CarouselNavButton/CarouselNavButton.js.map +1 -0
- package/lib-commonjs/components/CarouselNavButton/CarouselNavButton.types.js +6 -0
- package/lib-commonjs/components/CarouselNavButton/CarouselNavButton.types.js.map +1 -0
- package/lib-commonjs/components/CarouselNavButton/index.js +10 -0
- package/lib-commonjs/components/CarouselNavButton/index.js.map +1 -0
- package/lib-commonjs/components/CarouselNavButton/renderCarouselNavButton.js +17 -0
- package/lib-commonjs/components/CarouselNavButton/renderCarouselNavButton.js.map +1 -0
- package/lib-commonjs/components/CarouselNavButton/useCarouselNavButton.js +76 -0
- package/lib-commonjs/components/CarouselNavButton/useCarouselNavButton.js.map +1 -0
- package/lib-commonjs/components/CarouselNavButton/useCarouselNavButtonStyles.styles.js +293 -0
- package/lib-commonjs/components/CarouselNavButton/useCarouselNavButtonStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CarouselNavContainer/CarouselNavContainer.js +29 -0
- package/lib-commonjs/components/CarouselNavContainer/CarouselNavContainer.js.map +1 -0
- package/lib-commonjs/components/CarouselNavContainer/CarouselNavContainer.types.js +6 -0
- package/lib-commonjs/components/CarouselNavContainer/CarouselNavContainer.types.js.map +1 -0
- package/lib-commonjs/components/CarouselNavContainer/index.js +10 -0
- package/lib-commonjs/components/CarouselNavContainer/index.js.map +1 -0
- package/lib-commonjs/components/CarouselNavContainer/renderCarouselNavContainer.js +23 -0
- package/lib-commonjs/components/CarouselNavContainer/renderCarouselNavContainer.js.map +1 -0
- package/lib-commonjs/components/CarouselNavContainer/useCarouselNavContainer.js +54 -0
- package/lib-commonjs/components/CarouselNavContainer/useCarouselNavContainer.js.map +1 -0
- package/lib-commonjs/components/CarouselNavContainer/useCarouselNavContainerStyles.styles.js +163 -0
- package/lib-commonjs/components/CarouselNavContainer/useCarouselNavContainerStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CarouselNavImageButton/CarouselNavImageButton.js +24 -0
- package/lib-commonjs/components/CarouselNavImageButton/CarouselNavImageButton.js.map +1 -0
- package/lib-commonjs/components/CarouselNavImageButton/CarouselNavImageButton.types.js +6 -0
- package/lib-commonjs/components/CarouselNavImageButton/CarouselNavImageButton.types.js.map +1 -0
- package/lib-commonjs/components/CarouselNavImageButton/index.js +10 -0
- package/lib-commonjs/components/CarouselNavImageButton/index.js.map +1 -0
- package/lib-commonjs/components/CarouselNavImageButton/renderCarouselNavImageButton.js +18 -0
- package/lib-commonjs/components/CarouselNavImageButton/renderCarouselNavImageButton.js.map +1 -0
- package/lib-commonjs/components/CarouselNavImageButton/useCarouselNavImageButton.js +79 -0
- package/lib-commonjs/components/CarouselNavImageButton/useCarouselNavImageButton.js.map +1 -0
- package/lib-commonjs/components/CarouselNavImageButton/useCarouselNavImageButtonStyles.styles.js +132 -0
- package/lib-commonjs/components/CarouselNavImageButton/useCarouselNavImageButtonStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CarouselSlider/CarouselSlider.js +26 -0
- package/lib-commonjs/components/CarouselSlider/CarouselSlider.js.map +1 -0
- package/lib-commonjs/components/CarouselSlider/CarouselSlider.types.js +4 -0
- package/lib-commonjs/components/CarouselSlider/CarouselSlider.types.js.map +1 -0
- package/lib-commonjs/components/CarouselSlider/CarouselSliderContext.js +46 -0
- package/lib-commonjs/components/CarouselSlider/CarouselSliderContext.js.map +1 -0
- package/lib-commonjs/components/CarouselSlider/index.js +10 -0
- package/lib-commonjs/components/CarouselSlider/index.js.map +1 -0
- package/lib-commonjs/components/CarouselSlider/renderCarouselSlider.js +20 -0
- package/lib-commonjs/components/CarouselSlider/renderCarouselSlider.js.map +1 -0
- package/lib-commonjs/components/CarouselSlider/useCarouselSlider.js +39 -0
- package/lib-commonjs/components/CarouselSlider/useCarouselSlider.js.map +1 -0
- package/lib-commonjs/components/CarouselSlider/useCarouselSliderStyles.styles.js +41 -0
- package/lib-commonjs/components/CarouselSlider/useCarouselSliderStyles.styles.js.map +1 -0
- package/lib-commonjs/components/useEmblaCarousel.js +262 -0
- package/lib-commonjs/components/useEmblaCarousel.js.map +1 -0
- package/lib-commonjs/index.js +166 -0
- package/lib-commonjs/index.js.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/CarouselSlider/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["CarouselSlider.ts"],"sourcesContent":["export * from './components/CarouselSlider/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,oCAAoC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useCarousel_unstable } from './useCarousel';
|
|
3
|
+
import { renderCarousel_unstable } from './renderCarousel';
|
|
4
|
+
import { useCarouselStyles_unstable } from './useCarouselStyles.styles';
|
|
5
|
+
import { useCarouselContextValues_unstable } from './useCarouselContextValues';
|
|
6
|
+
/**
|
|
7
|
+
* Carousel is the context wrapper and container for all carousel content/controls,
|
|
8
|
+
* it has no direct style or slot opinions.
|
|
9
|
+
*
|
|
10
|
+
* Carousel also provides API interfaces for callbacks that will occur on navigation events.
|
|
11
|
+
*/ export const Carousel = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
12
|
+
const state = useCarousel_unstable(props, ref);
|
|
13
|
+
useCarouselStyles_unstable(state);
|
|
14
|
+
const contextValues = useCarouselContextValues_unstable(state);
|
|
15
|
+
// TODO update types in packages/react-components/react-shared-contexts/src/CustomStyleHooksContext/CustomStyleHooksContext.ts
|
|
16
|
+
// https://github.com/microsoft/fluentui/blob/master/rfcs/react-components/convergence/custom-styling.md
|
|
17
|
+
// useCustomStyleHook_unstable('useCarouselStyles_unstable')(state);
|
|
18
|
+
return renderCarousel_unstable(state, contextValues);
|
|
19
|
+
});
|
|
20
|
+
Carousel.displayName = 'Carousel';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Carousel.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCarousel_unstable } from './useCarousel';\nimport { renderCarousel_unstable } from './renderCarousel';\nimport { useCarouselStyles_unstable } from './useCarouselStyles.styles';\nimport type { CarouselProps } from './Carousel.types';\nimport { useCarouselContextValues_unstable } from './useCarouselContextValues';\n\n/**\n * Carousel is the context wrapper and container for all carousel content/controls,\n * it has no direct style or slot opinions.\n *\n * Carousel also provides API interfaces for callbacks that will occur on navigation events.\n */\nexport const Carousel: ForwardRefComponent<CarouselProps> = React.forwardRef((props, ref) => {\n const state = useCarousel_unstable(props, ref);\n\n useCarouselStyles_unstable(state);\n\n const contextValues = useCarouselContextValues_unstable(state);\n // TODO update types in packages/react-components/react-shared-contexts/src/CustomStyleHooksContext/CustomStyleHooksContext.ts\n // https://github.com/microsoft/fluentui/blob/master/rfcs/react-components/convergence/custom-styling.md\n // useCustomStyleHook_unstable('useCarouselStyles_unstable')(state);\n return renderCarousel_unstable(state, contextValues);\n});\n\nCarousel.displayName = 'Carousel';\n"],"names":["React","useCarousel_unstable","renderCarousel_unstable","useCarouselStyles_unstable","useCarouselContextValues_unstable","Carousel","forwardRef","props","ref","state","contextValues","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,oBAAoB,QAAQ,gBAAgB;AACrD,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,0BAA0B,QAAQ,6BAA6B;AAExE,SAASC,iCAAiC,QAAQ,6BAA6B;AAE/E;;;;;CAKC,GACD,OAAO,MAAMC,yBAA+CL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IACnF,MAAMC,QAAQR,qBAAqBM,OAAOC;IAE1CL,2BAA2BM;IAE3B,MAAMC,gBAAgBN,kCAAkCK;IACxD,8HAA8H;IAC9H,wGAAwG;IACxG,oEAAoE;IACpE,OAAOP,wBAAwBO,OAAOC;AACxC,GAAG;AAEHL,SAASM,WAAW,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Carousel.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, EventHandler, Slot } from '@fluentui/react-utilities';\nimport type { CarouselContextValue, CarouselIndexChangeData } from '../CarouselContext.types';\n\nexport type CarouselSlots = {\n root: Slot<'div'>;\n};\n\n/**\n * Children function replacement, passes through updated context index and carousel information for localization\n */\nexport type CarouselAnnouncerFunction = (index: number, totalSlides: number, slideGroupList: number[][]) => string;\n\n/**\n * Carousel Props\n */\nexport type CarouselProps = ComponentProps<CarouselSlots> & {\n /**\n * The initial page to display in uncontrolled mode.\n */\n defaultActiveIndex?: number;\n\n /**\n * The alignment of the carousel.\n */\n align?: 'center' | 'start' | 'end';\n\n /**\n * The value of the currently active page.\n */\n activeIndex?: number;\n\n /**\n * Callback to notify a page change.\n */\n onActiveIndexChange?: EventHandler<CarouselIndexChangeData>;\n\n /**\n * Circular enables the carousel to loop back around on navigation past trailing index.\n */\n circular?: boolean;\n\n /**\n * Controls the number of carousel cards per navigation element, will default to 'auto'\n * Recommended to set to '1' when using full page carousel cards.\n */\n groupSize?: number | 'auto';\n\n /**\n * Enables drag to scroll on carousel items.\n * Defaults to: False\n */\n draggable?: boolean;\n\n /**\n * Adds whitespace to start/end so that 'align' prop is always respected for current index\n * Defaults to: False\n */\n whitespace?: boolean;\n\n /**\n * Localizes the string used to announce carousel page changes\n * Defaults to: undefined\n */\n announcement?: CarouselAnnouncerFunction;\n};\n\n/**\n * State used in rendering Carousel\n */\nexport type CarouselState = ComponentState<CarouselSlots> & CarouselContextValue;\n\nexport interface CarouselVisibilityEventDetail {\n isVisible: boolean;\n}\n\nexport type CarouselVisibilityChangeEvent = CustomEvent<CarouselVisibilityEventDetail>;\n\n/**\n * @internal\n */\nexport interface CarouselUpdateData {\n /**\n * The current carousel index, a change in index will not trigger the callback (use context index instead).\n */\n activeIndex: number;\n /**\n * The total number of slides to be navigated, accounts for grouping.\n */\n navItemsCount: number;\n /**\n * A breakdown of the card indexes contained within each slide index.\n */\n groupIndexList: number[][];\n /**\n * An array of the card DOM elements after render\n */\n slideNodes: HTMLElement[];\n}\n"],"names":[],"rangeMappings":";;","mappings":"AA6EA;;CAEC,GACD,WAiBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Carousel';\nexport * from './Carousel.types';\nexport * from './renderCarousel';\nexport * from './useCarousel';\nexport * from './useCarouselStyles.styles';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,aAAa;AAC3B,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,gBAAgB;AAC9B,cAAc,6BAA6B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { assertSlots } from '@fluentui/react-utilities';
|
|
3
|
+
import { CarouselProvider } from '../CarouselContext';
|
|
4
|
+
/**
|
|
5
|
+
* Render the final JSX of Carousel
|
|
6
|
+
*/ export const renderCarousel_unstable = (state, contextValues)=>{
|
|
7
|
+
assertSlots(state);
|
|
8
|
+
return /*#__PURE__*/ _jsx(CarouselProvider, {
|
|
9
|
+
value: contextValues.carousel,
|
|
10
|
+
children: /*#__PURE__*/ _jsx(state.root, {})
|
|
11
|
+
});
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["renderCarousel.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { CarouselState, CarouselSlots } from './Carousel.types';\nimport { CarouselProvider } from '../CarouselContext';\nimport type { CarouselContextValues } from '../CarouselContext.types';\n\n/**\n * Render the final JSX of Carousel\n */\nexport const renderCarousel_unstable = (state: CarouselState, contextValues: CarouselContextValues) => {\n assertSlots<CarouselSlots>(state);\n\n return (\n <CarouselProvider value={contextValues.carousel}>\n <state.root />\n </CarouselProvider>\n );\n};\n"],"names":["assertSlots","CarouselProvider","renderCarousel_unstable","state","contextValues","value","carousel","root"],"rangeMappings":";;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAExD,SAASC,gBAAgB,QAAQ,qBAAqB;AAGtD;;CAEC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAsBC;IAC5DJ,YAA2BG;IAE3B,qBACE,KAACF;QAAiBI,OAAOD,cAAcE,QAAQ;kBAC7C,cAAA,KAACH,MAAMI,IAAI;;AAGjB,EAAE"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
|
|
2
|
+
import { getIntrinsicElementProps, slot, useEventCallback, useIsomorphicLayoutEffect, useMergedRefs } from '@fluentui/react-utilities';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useEmblaCarousel } from '../useEmblaCarousel';
|
|
5
|
+
import { useAnnounce } from '@fluentui/react-shared-contexts';
|
|
6
|
+
/**
|
|
7
|
+
* Create the state required to render Carousel.
|
|
8
|
+
*
|
|
9
|
+
* The returned state can be modified with hooks such as useCarouselStyles_unstable,
|
|
10
|
+
* before being passed to renderCarousel_unstable.
|
|
11
|
+
*
|
|
12
|
+
* @param props - props from this instance of Carousel
|
|
13
|
+
* @param ref - reference to root HTMLDivElement of Carousel
|
|
14
|
+
*/ export function useCarousel_unstable(props, ref) {
|
|
15
|
+
'use no memo';
|
|
16
|
+
const { align = 'center', circular = false, onActiveIndexChange, groupSize = 'auto', draggable = false, whitespace = false, announcement } = props;
|
|
17
|
+
const { dir } = useFluent();
|
|
18
|
+
const { activeIndex, carouselApi, containerRef, subscribeForValues, enableAutoplay, resetAutoplay } = useEmblaCarousel({
|
|
19
|
+
align,
|
|
20
|
+
direction: dir,
|
|
21
|
+
loop: circular,
|
|
22
|
+
slidesToScroll: groupSize,
|
|
23
|
+
defaultActiveIndex: props.defaultActiveIndex,
|
|
24
|
+
activeIndex: props.activeIndex,
|
|
25
|
+
watchDrag: draggable,
|
|
26
|
+
containScroll: whitespace ? false : 'keepSnaps'
|
|
27
|
+
});
|
|
28
|
+
const selectPageByElement = useEventCallback((event, element, jump)=>{
|
|
29
|
+
const foundIndex = carouselApi.scrollToElement(element, jump);
|
|
30
|
+
onActiveIndexChange === null || onActiveIndexChange === void 0 ? void 0 : onActiveIndexChange(event, {
|
|
31
|
+
event,
|
|
32
|
+
type: 'focus',
|
|
33
|
+
index: foundIndex
|
|
34
|
+
});
|
|
35
|
+
return foundIndex;
|
|
36
|
+
});
|
|
37
|
+
const selectPageByIndex = useEventCallback((event, index, jump)=>{
|
|
38
|
+
carouselApi.scrollToIndex(index, jump);
|
|
39
|
+
onActiveIndexChange === null || onActiveIndexChange === void 0 ? void 0 : onActiveIndexChange(event, {
|
|
40
|
+
event,
|
|
41
|
+
type: 'click',
|
|
42
|
+
index
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
const selectPageByDirection = useEventCallback((event, direction)=>{
|
|
46
|
+
const nextPageIndex = carouselApi.scrollInDirection(direction);
|
|
47
|
+
onActiveIndexChange === null || onActiveIndexChange === void 0 ? void 0 : onActiveIndexChange(event, {
|
|
48
|
+
event,
|
|
49
|
+
type: 'click',
|
|
50
|
+
index: nextPageIndex
|
|
51
|
+
});
|
|
52
|
+
return nextPageIndex;
|
|
53
|
+
});
|
|
54
|
+
const mergedRefs = useMergedRefs(ref, containerRef);
|
|
55
|
+
// Announce carousel updates
|
|
56
|
+
const announcementTextRef = React.useRef('');
|
|
57
|
+
const totalNavLength = React.useRef(0);
|
|
58
|
+
const navGroupRef = React.useRef([]);
|
|
59
|
+
const { announce } = useAnnounce();
|
|
60
|
+
const updateAnnouncement = useEventCallback(()=>{
|
|
61
|
+
if (totalNavLength.current <= 0 || !announcement) {
|
|
62
|
+
// Ignore announcements until slides discovered
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const announcementText = announcement(activeIndex, totalNavLength.current, navGroupRef.current);
|
|
66
|
+
if (announcementText !== announcementTextRef.current) {
|
|
67
|
+
announcementTextRef.current = announcementText;
|
|
68
|
+
announce(announcementText, {
|
|
69
|
+
polite: true
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
useIsomorphicLayoutEffect(()=>{
|
|
74
|
+
// Subscribe to any non-index carousel state changes
|
|
75
|
+
return subscribeForValues((data)=>{
|
|
76
|
+
if (totalNavLength.current <= 0 && data.navItemsCount > 0 && announcement) {
|
|
77
|
+
const announcementText = announcement(data.activeIndex, data.navItemsCount, data.groupIndexList);
|
|
78
|
+
// Initialize our string to prevent updateAnnouncement from reading an initial load
|
|
79
|
+
announcementTextRef.current = announcementText;
|
|
80
|
+
}
|
|
81
|
+
totalNavLength.current = data.navItemsCount;
|
|
82
|
+
navGroupRef.current = data.groupIndexList;
|
|
83
|
+
updateAnnouncement();
|
|
84
|
+
});
|
|
85
|
+
}, [
|
|
86
|
+
subscribeForValues,
|
|
87
|
+
updateAnnouncement,
|
|
88
|
+
announcement
|
|
89
|
+
]);
|
|
90
|
+
useIsomorphicLayoutEffect(()=>{
|
|
91
|
+
updateAnnouncement();
|
|
92
|
+
}, [
|
|
93
|
+
activeIndex,
|
|
94
|
+
updateAnnouncement
|
|
95
|
+
]);
|
|
96
|
+
return {
|
|
97
|
+
components: {
|
|
98
|
+
root: 'div'
|
|
99
|
+
},
|
|
100
|
+
root: slot.always(getIntrinsicElementProps('div', {
|
|
101
|
+
ref: mergedRefs,
|
|
102
|
+
role: 'region',
|
|
103
|
+
...props
|
|
104
|
+
}), {
|
|
105
|
+
elementType: 'div'
|
|
106
|
+
}),
|
|
107
|
+
activeIndex,
|
|
108
|
+
circular,
|
|
109
|
+
containerRef: mergedRefs,
|
|
110
|
+
selectPageByElement,
|
|
111
|
+
selectPageByDirection,
|
|
112
|
+
selectPageByIndex,
|
|
113
|
+
subscribeForValues,
|
|
114
|
+
enableAutoplay,
|
|
115
|
+
resetAutoplay
|
|
116
|
+
};
|
|
117
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useCarousel.ts"],"sourcesContent":["import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport {\n getIntrinsicElementProps,\n slot,\n useEventCallback,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nimport type { CarouselProps, CarouselState } from './Carousel.types';\nimport type { CarouselContextValue } from '../CarouselContext.types';\nimport { useEmblaCarousel } from '../useEmblaCarousel';\nimport { useAnnounce } from '@fluentui/react-shared-contexts';\n\n/**\n * Create the state required to render Carousel.\n *\n * The returned state can be modified with hooks such as useCarouselStyles_unstable,\n * before being passed to renderCarousel_unstable.\n *\n * @param props - props from this instance of Carousel\n * @param ref - reference to root HTMLDivElement of Carousel\n */\nexport function useCarousel_unstable(props: CarouselProps, ref: React.Ref<HTMLDivElement>): CarouselState {\n 'use no memo';\n\n const {\n align = 'center',\n circular = false,\n onActiveIndexChange,\n groupSize = 'auto',\n draggable = false,\n whitespace = false,\n announcement,\n } = props;\n\n const { dir } = useFluent();\n const { activeIndex, carouselApi, containerRef, subscribeForValues, enableAutoplay, resetAutoplay } =\n useEmblaCarousel({\n align,\n direction: dir,\n loop: circular,\n slidesToScroll: groupSize,\n defaultActiveIndex: props.defaultActiveIndex,\n activeIndex: props.activeIndex,\n watchDrag: draggable,\n containScroll: whitespace ? false : 'keepSnaps',\n });\n\n const selectPageByElement: CarouselContextValue['selectPageByElement'] = useEventCallback((event, element, jump) => {\n const foundIndex = carouselApi.scrollToElement(element, jump);\n onActiveIndexChange?.(event, { event, type: 'focus', index: foundIndex });\n\n return foundIndex;\n });\n\n const selectPageByIndex: CarouselContextValue['selectPageByIndex'] = useEventCallback((event, index, jump) => {\n carouselApi.scrollToIndex(index, jump);\n\n onActiveIndexChange?.(event, { event, type: 'click', index });\n });\n\n const selectPageByDirection: CarouselContextValue['selectPageByDirection'] = useEventCallback((event, direction) => {\n const nextPageIndex = carouselApi.scrollInDirection(direction);\n onActiveIndexChange?.(event, { event, type: 'click', index: nextPageIndex });\n\n return nextPageIndex;\n });\n\n const mergedRefs = useMergedRefs(ref, containerRef);\n\n // Announce carousel updates\n const announcementTextRef = React.useRef<string>('');\n const totalNavLength = React.useRef<number>(0);\n const navGroupRef = React.useRef<number[][]>([]);\n\n const { announce } = useAnnounce();\n\n const updateAnnouncement = useEventCallback(() => {\n if (totalNavLength.current <= 0 || !announcement) {\n // Ignore announcements until slides discovered\n return;\n }\n\n const announcementText = announcement(activeIndex, totalNavLength.current, navGroupRef.current);\n\n if (announcementText !== announcementTextRef.current) {\n announcementTextRef.current = announcementText;\n announce(announcementText, { polite: true });\n }\n });\n\n useIsomorphicLayoutEffect(() => {\n // Subscribe to any non-index carousel state changes\n return subscribeForValues(data => {\n if (totalNavLength.current <= 0 && data.navItemsCount > 0 && announcement) {\n const announcementText = announcement(data.activeIndex, data.navItemsCount, data.groupIndexList);\n // Initialize our string to prevent updateAnnouncement from reading an initial load\n announcementTextRef.current = announcementText;\n }\n totalNavLength.current = data.navItemsCount;\n navGroupRef.current = data.groupIndexList;\n updateAnnouncement();\n });\n }, [subscribeForValues, updateAnnouncement, announcement]);\n\n useIsomorphicLayoutEffect(() => {\n updateAnnouncement();\n }, [activeIndex, updateAnnouncement]);\n\n return {\n components: {\n root: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref: mergedRefs,\n role: 'region',\n ...props,\n }),\n { elementType: 'div' },\n ),\n\n activeIndex,\n circular,\n containerRef: mergedRefs,\n selectPageByElement,\n selectPageByDirection,\n selectPageByIndex,\n subscribeForValues,\n enableAutoplay,\n resetAutoplay,\n };\n}\n"],"names":["useFluent_unstable","useFluent","getIntrinsicElementProps","slot","useEventCallback","useIsomorphicLayoutEffect","useMergedRefs","React","useEmblaCarousel","useAnnounce","useCarousel_unstable","props","ref","align","circular","onActiveIndexChange","groupSize","draggable","whitespace","announcement","dir","activeIndex","carouselApi","containerRef","subscribeForValues","enableAutoplay","resetAutoplay","direction","loop","slidesToScroll","defaultActiveIndex","watchDrag","containScroll","selectPageByElement","event","element","jump","foundIndex","scrollToElement","type","index","selectPageByIndex","scrollToIndex","selectPageByDirection","nextPageIndex","scrollInDirection","mergedRefs","announcementTextRef","useRef","totalNavLength","navGroupRef","announce","updateAnnouncement","current","announcementText","polite","data","navItemsCount","groupIndexList","components","root","always","role","elementType"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SACEC,wBAAwB,EACxBC,IAAI,EACJC,gBAAgB,EAChBC,yBAAyB,EACzBC,aAAa,QACR,4BAA4B;AACnC,YAAYC,WAAW,QAAQ;AAI/B,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,WAAW,QAAQ,kCAAkC;AAE9D;;;;;;;;CAQC,GACD,OAAO,SAASC,qBAAqBC,KAAoB,EAAEC,GAA8B;IACvF;IAEA,MAAM,EACJC,QAAQ,QAAQ,EAChBC,WAAW,KAAK,EAChBC,mBAAmB,EACnBC,YAAY,MAAM,EAClBC,YAAY,KAAK,EACjBC,aAAa,KAAK,EAClBC,YAAY,EACb,GAAGR;IAEJ,MAAM,EAAES,GAAG,EAAE,GAAGnB;IAChB,MAAM,EAAEoB,WAAW,EAAEC,WAAW,EAAEC,YAAY,EAAEC,kBAAkB,EAAEC,cAAc,EAAEC,aAAa,EAAE,GACjGlB,iBAAiB;QACfK;QACAc,WAAWP;QACXQ,MAAMd;QACNe,gBAAgBb;QAChBc,oBAAoBnB,MAAMmB,kBAAkB;QAC5CT,aAAaV,MAAMU,WAAW;QAC9BU,WAAWd;QACXe,eAAed,aAAa,QAAQ;IACtC;IAEF,MAAMe,sBAAmE7B,iBAAiB,CAAC8B,OAAOC,SAASC;QACzG,MAAMC,aAAaf,YAAYgB,eAAe,CAACH,SAASC;QACxDrB,gCAAAA,0CAAAA,oBAAsBmB,OAAO;YAAEA;YAAOK,MAAM;YAASC,OAAOH;QAAW;QAEvE,OAAOA;IACT;IAEA,MAAMI,oBAA+DrC,iBAAiB,CAAC8B,OAAOM,OAAOJ;QACnGd,YAAYoB,aAAa,CAACF,OAAOJ;QAEjCrB,gCAAAA,0CAAAA,oBAAsBmB,OAAO;YAAEA;YAAOK,MAAM;YAASC;QAAM;IAC7D;IAEA,MAAMG,wBAAuEvC,iBAAiB,CAAC8B,OAAOP;QACpG,MAAMiB,gBAAgBtB,YAAYuB,iBAAiB,CAAClB;QACpDZ,gCAAAA,0CAAAA,oBAAsBmB,OAAO;YAAEA;YAAOK,MAAM;YAASC,OAAOI;QAAc;QAE1E,OAAOA;IACT;IAEA,MAAME,aAAaxC,cAAcM,KAAKW;IAEtC,4BAA4B;IAC5B,MAAMwB,sBAAsBxC,MAAMyC,MAAM,CAAS;IACjD,MAAMC,iBAAiB1C,MAAMyC,MAAM,CAAS;IAC5C,MAAME,cAAc3C,MAAMyC,MAAM,CAAa,EAAE;IAE/C,MAAM,EAAEG,QAAQ,EAAE,GAAG1C;IAErB,MAAM2C,qBAAqBhD,iBAAiB;QAC1C,IAAI6C,eAAeI,OAAO,IAAI,KAAK,CAAClC,cAAc;YAChD,+CAA+C;YAC/C;QACF;QAEA,MAAMmC,mBAAmBnC,aAAaE,aAAa4B,eAAeI,OAAO,EAAEH,YAAYG,OAAO;QAE9F,IAAIC,qBAAqBP,oBAAoBM,OAAO,EAAE;YACpDN,oBAAoBM,OAAO,GAAGC;YAC9BH,SAASG,kBAAkB;gBAAEC,QAAQ;YAAK;QAC5C;IACF;IAEAlD,0BAA0B;QACxB,oDAAoD;QACpD,OAAOmB,mBAAmBgC,CAAAA;YACxB,IAAIP,eAAeI,OAAO,IAAI,KAAKG,KAAKC,aAAa,GAAG,KAAKtC,cAAc;gBACzE,MAAMmC,mBAAmBnC,aAAaqC,KAAKnC,WAAW,EAAEmC,KAAKC,aAAa,EAAED,KAAKE,cAAc;gBAC/F,mFAAmF;gBACnFX,oBAAoBM,OAAO,GAAGC;YAChC;YACAL,eAAeI,OAAO,GAAGG,KAAKC,aAAa;YAC3CP,YAAYG,OAAO,GAAGG,KAAKE,cAAc;YACzCN;QACF;IACF,GAAG;QAAC5B;QAAoB4B;QAAoBjC;KAAa;IAEzDd,0BAA0B;QACxB+C;IACF,GAAG;QAAC/B;QAAa+B;KAAmB;IAEpC,OAAO;QACLO,YAAY;YACVC,MAAM;QACR;QACAA,MAAMzD,KAAK0D,MAAM,CACf3D,yBAAyB,OAAO;YAC9BU,KAAKkC;YACLgB,MAAM;YACN,GAAGnD,KAAK;QACV,IACA;YAAEoD,aAAa;QAAM;QAGvB1C;QACAP;QACAS,cAAcuB;QACdb;QACAU;QACAF;QACAjB;QACAC;QACAC;IACF;AACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export function useCarouselContextValues_unstable(state) {
|
|
3
|
+
const { activeIndex, selectPageByElement, selectPageByDirection, selectPageByIndex, subscribeForValues, enableAutoplay, resetAutoplay, circular, containerRef } = state;
|
|
4
|
+
const carousel = React.useMemo(()=>({
|
|
5
|
+
activeIndex,
|
|
6
|
+
selectPageByElement,
|
|
7
|
+
selectPageByDirection,
|
|
8
|
+
selectPageByIndex,
|
|
9
|
+
subscribeForValues,
|
|
10
|
+
enableAutoplay,
|
|
11
|
+
resetAutoplay,
|
|
12
|
+
circular,
|
|
13
|
+
containerRef
|
|
14
|
+
}), [
|
|
15
|
+
activeIndex,
|
|
16
|
+
selectPageByElement,
|
|
17
|
+
selectPageByDirection,
|
|
18
|
+
selectPageByIndex,
|
|
19
|
+
subscribeForValues,
|
|
20
|
+
enableAutoplay,
|
|
21
|
+
resetAutoplay,
|
|
22
|
+
circular,
|
|
23
|
+
containerRef
|
|
24
|
+
]);
|
|
25
|
+
return {
|
|
26
|
+
carousel
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useCarouselContextValues.ts"],"sourcesContent":["import * as React from 'react';\n\nimport type { CarouselContextValues } from '../CarouselContext.types';\nimport type { CarouselState } from './Carousel.types';\n\nexport function useCarouselContextValues_unstable(state: CarouselState): CarouselContextValues {\n const {\n activeIndex,\n selectPageByElement,\n selectPageByDirection,\n selectPageByIndex,\n subscribeForValues,\n enableAutoplay,\n resetAutoplay,\n circular,\n containerRef,\n } = state;\n\n const carousel = React.useMemo(\n () => ({\n activeIndex,\n selectPageByElement,\n selectPageByDirection,\n selectPageByIndex,\n subscribeForValues,\n enableAutoplay,\n resetAutoplay,\n circular,\n containerRef,\n }),\n [\n activeIndex,\n selectPageByElement,\n selectPageByDirection,\n selectPageByIndex,\n subscribeForValues,\n enableAutoplay,\n resetAutoplay,\n circular,\n containerRef,\n ],\n );\n\n return { carousel };\n}\n"],"names":["React","useCarouselContextValues_unstable","state","activeIndex","selectPageByElement","selectPageByDirection","selectPageByIndex","subscribeForValues","enableAutoplay","resetAutoplay","circular","containerRef","carousel","useMemo"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAK/B,OAAO,SAASC,kCAAkCC,KAAoB;IACpE,MAAM,EACJC,WAAW,EACXC,mBAAmB,EACnBC,qBAAqB,EACrBC,iBAAiB,EACjBC,kBAAkB,EAClBC,cAAc,EACdC,aAAa,EACbC,QAAQ,EACRC,YAAY,EACb,GAAGT;IAEJ,MAAMU,WAAWZ,MAAMa,OAAO,CAC5B,IAAO,CAAA;YACLV;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;QACF,CAAA,GACA;QACER;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;KACD;IAGH,OAAO;QAAEC;IAAS;AACpB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { __styles, mergeClasses } from '@griffel/react';
|
|
2
|
+
import { tokens } from '@fluentui/react-theme';
|
|
3
|
+
export const carouselClassNames = {
|
|
4
|
+
root: 'fui-Carousel'
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Styles for the root slot
|
|
8
|
+
*/
|
|
9
|
+
const useStyles = /*#__PURE__*/__styles({
|
|
10
|
+
root: {
|
|
11
|
+
z8tnut: "fr4fn7s",
|
|
12
|
+
B68tc82: 0,
|
|
13
|
+
Bmxbyg5: 0,
|
|
14
|
+
Bpg54ce: "f1a3p1vp",
|
|
15
|
+
Eiaeu8: "f1115ve7",
|
|
16
|
+
qhf8xq: "f10pi13n"
|
|
17
|
+
}
|
|
18
|
+
}, {
|
|
19
|
+
d: [".fr4fn7s{padding-top:var(--strokeWidthThick);}", [".f1a3p1vp{overflow:hidden;}", {
|
|
20
|
+
p: -1
|
|
21
|
+
}], ".f1115ve7{overflow-anchor:none;}", ".f10pi13n{position:relative;}"]
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Apply styling to the Carousel slots based on the state
|
|
25
|
+
*/
|
|
26
|
+
export const useCarouselStyles_unstable = state => {
|
|
27
|
+
'use no memo';
|
|
28
|
+
|
|
29
|
+
const styles = useStyles();
|
|
30
|
+
state.root.className = mergeClasses(carouselClassNames.root, styles.root, state.root.className);
|
|
31
|
+
return state;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=useCarouselStyles.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","tokens","carouselClassNames","root","useStyles","z8tnut","B68tc82","Bmxbyg5","Bpg54ce","Eiaeu8","qhf8xq","d","p","useCarouselStyles_unstable","state","styles","className"],"sources":["useCarouselStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const carouselClassNames = {\n root: 'fui-Carousel'\n};\n/**\n * Styles for the root slot\n */ const useStyles = makeStyles({\n root: {\n paddingTop: tokens.strokeWidthThick,\n overflow: 'hidden',\n overflowAnchor: 'none',\n position: 'relative'\n }\n});\n/**\n * Apply styling to the Carousel slots based on the state\n */ export const useCarouselStyles_unstable = (state)=>{\n 'use no memo';\n const styles = useStyles();\n state.root.className = mergeClasses(carouselClassNames.root, styles.root, state.root.className);\n return state;\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAqBC,YAAY,QAAQ,gBAAgB;AACzD,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,OAAO,MAAMC,kBAAkB,GAAG;EAC9BC,IAAI,EAAE;AACV,CAAC;AACD;AACA;AACA;AAAI,MAAMC,SAAS,gBAAGL,QAAA;EAAAI,IAAA;IAAAE,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;EAAA;AAAA;EAAAC,CAAA;IAAAC,CAAA;EAAA;AAAA,CAOrB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,0BAA0B,GAAIC,KAAK,IAAG;EACnD,aAAa;;EACb,MAAMC,MAAM,GAAGX,SAAS,CAAC,CAAC;EAC1BU,KAAK,CAACX,IAAI,CAACa,SAAS,GAAGhB,YAAY,CAACE,kBAAkB,CAACC,IAAI,EAAEY,MAAM,CAACZ,IAAI,EAAEW,KAAK,CAACX,IAAI,CAACa,SAAS,CAAC;EAC/F,OAAOF,KAAK;AAChB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useCarouselAutoplayButton_unstable } from './useCarouselAutoplayButton';
|
|
3
|
+
import { renderCarouselAutoplayButton_unstable } from './renderCarouselAutoplayButton';
|
|
4
|
+
import { useCarouselAutoplayButtonStyles_unstable } from './useCarouselAutoplayButtonStyles.styles';
|
|
5
|
+
/**
|
|
6
|
+
* If the Carousel is on auto-play, the user may opt into pausing the auto-play feature via the
|
|
7
|
+
* CarouselAutoplayButton which must be present for auto-play to be enabled.
|
|
8
|
+
*
|
|
9
|
+
* If CarouselAutoplayButton is present, auto-play will default to true on mount.
|
|
10
|
+
*/ export const CarouselAutoplayButton = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
11
|
+
const state = useCarouselAutoplayButton_unstable(props, ref);
|
|
12
|
+
useCarouselAutoplayButtonStyles_unstable(state);
|
|
13
|
+
// TODO update types in packages/react-components/react-shared-contexts/src/CustomStyleHooksContext/CustomStyleHooksContext.ts
|
|
14
|
+
// https://github.com/microsoft/fluentui/blob/master/rfcs/react-components/convergence/custom-styling.md
|
|
15
|
+
// useCustomStyleHook_unstable('useCarouselAutoplayButtonStyles_unstable')(state);
|
|
16
|
+
return renderCarouselAutoplayButton_unstable(state);
|
|
17
|
+
});
|
|
18
|
+
CarouselAutoplayButton.displayName = 'CarouselAutoplayButton';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["CarouselAutoplayButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCarouselAutoplayButton_unstable } from './useCarouselAutoplayButton';\nimport { renderCarouselAutoplayButton_unstable } from './renderCarouselAutoplayButton';\nimport { useCarouselAutoplayButtonStyles_unstable } from './useCarouselAutoplayButtonStyles.styles';\nimport type { CarouselAutoplayButtonProps } from './CarouselAutoplayButton.types';\n\n/**\n * If the Carousel is on auto-play, the user may opt into pausing the auto-play feature via the\n * CarouselAutoplayButton which must be present for auto-play to be enabled.\n *\n * If CarouselAutoplayButton is present, auto-play will default to true on mount.\n */\nexport const CarouselAutoplayButton: ForwardRefComponent<CarouselAutoplayButtonProps> = React.forwardRef(\n (props, ref) => {\n const state = useCarouselAutoplayButton_unstable(props, ref);\n\n useCarouselAutoplayButtonStyles_unstable(state);\n // TODO update types in packages/react-components/react-shared-contexts/src/CustomStyleHooksContext/CustomStyleHooksContext.ts\n // https://github.com/microsoft/fluentui/blob/master/rfcs/react-components/convergence/custom-styling.md\n // useCustomStyleHook_unstable('useCarouselAutoplayButtonStyles_unstable')(state);\n return renderCarouselAutoplayButton_unstable(state);\n },\n);\n\nCarouselAutoplayButton.displayName = 'CarouselAutoplayButton';\n"],"names":["React","useCarouselAutoplayButton_unstable","renderCarouselAutoplayButton_unstable","useCarouselAutoplayButtonStyles_unstable","CarouselAutoplayButton","forwardRef","props","ref","state","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,kCAAkC,QAAQ,8BAA8B;AACjF,SAASC,qCAAqC,QAAQ,iCAAiC;AACvF,SAASC,wCAAwC,QAAQ,2CAA2C;AAGpG;;;;;CAKC,GACD,OAAO,MAAMC,uCAA2EJ,MAAMK,UAAU,CACtG,CAACC,OAAOC;IACN,MAAMC,QAAQP,mCAAmCK,OAAOC;IAExDJ,yCAAyCK;IACzC,8HAA8H;IAC9H,wGAAwG;IACxG,kFAAkF;IAClF,OAAON,sCAAsCM;AAC/C,GACA;AAEFJ,uBAAuBK,WAAW,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["CarouselAutoplayButton.types.ts"],"sourcesContent":["import { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport { ButtonSlots, ToggleButtonProps, ToggleButtonState } from '@fluentui/react-button';\nimport type { ComponentProps, ComponentState, EventData, EventHandler, Slot } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nexport type CarouselAutoplayButtonSlots = ButtonSlots & {\n root: NonNullable<Slot<ARIAButtonSlotProps>>;\n};\n\nexport type CarouselAutoplayChangeData = EventData<'click', React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>> & {\n /**\n * The updated autoplay value.\n */\n checked: boolean;\n};\n\nexport type CarouselAutoplayAriaLabelFunction = (autoplay: boolean) => string;\n\n/**\n * CarouselAutoplayButton Props\n */\nexport type CarouselAutoplayButtonProps = ToggleButtonProps &\n ComponentProps<CarouselAutoplayButtonSlots> & {\n /**\n * Callback that informs the user when internal autoplay value has changed\n */\n onCheckedChange?: EventHandler<CarouselAutoplayChangeData>;\n };\n\n/**\n * State used in rendering CarouselAutoplayButton\n */\nexport type CarouselAutoplayButtonState = ToggleButtonState & ComponentState<CarouselAutoplayButtonSlots>;\n"],"names":["React"],"rangeMappings":"","mappings":"AAGA,YAAYA,WAAW,QAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './CarouselAutoplayButton';\nexport * from './CarouselAutoplayButton.types';\nexport * from './renderCarouselAutoplayButton';\nexport * from './useCarouselAutoplayButton';\nexport * from './useCarouselAutoplayButtonStyles.styles';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,2BAA2B;AACzC,cAAc,iCAAiC;AAC/C,cAAc,iCAAiC;AAC/C,cAAc,8BAA8B;AAC5C,cAAc,2CAA2C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { assertSlots } from '@fluentui/react-utilities';
|
|
2
|
+
import { renderToggleButton_unstable } from '@fluentui/react-button';
|
|
3
|
+
/**
|
|
4
|
+
* Render the final JSX of CarouselAutoplayButton
|
|
5
|
+
*/ export const renderCarouselAutoplayButton_unstable = (state)=>{
|
|
6
|
+
assertSlots(state);
|
|
7
|
+
// We render the underlying react-button with injected carousel functionality
|
|
8
|
+
return renderToggleButton_unstable(state);
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["renderCarouselAutoplayButton.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { CarouselAutoplayButtonState, CarouselAutoplayButtonSlots } from './CarouselAutoplayButton.types';\nimport { renderToggleButton_unstable } from '@fluentui/react-button';\n\n/**\n * Render the final JSX of CarouselAutoplayButton\n */\nexport const renderCarouselAutoplayButton_unstable = (state: CarouselAutoplayButtonState) => {\n assertSlots<CarouselAutoplayButtonSlots>(state);\n\n // We render the underlying react-button with injected carousel functionality\n return renderToggleButton_unstable(state);\n};\n"],"names":["assertSlots","renderToggleButton_unstable","renderCarouselAutoplayButton_unstable","state"],"rangeMappings":";;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD,GAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAExD,SAASC,2BAA2B,QAAQ,yBAAyB;AAErE;;CAEC,GACD,OAAO,MAAMC,wCAAwC,CAACC;IACpDH,YAAyCG;IAEzC,6EAA6E;IAC7E,OAAOF,4BAA4BE;AACrC,EAAE"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useToggleButton_unstable } from '@fluentui/react-button';
|
|
2
|
+
import { PlayCircleRegular, PauseCircleRegular } from '@fluentui/react-icons';
|
|
3
|
+
import { mergeCallbacks, slot, useControllableState, useEventCallback, useIsomorphicLayoutEffect } from '@fluentui/react-utilities';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { useCarouselContext_unstable as useCarouselContext } from '../CarouselContext';
|
|
6
|
+
/**
|
|
7
|
+
* Create the state required to render CarouselAutoplayButton.
|
|
8
|
+
*
|
|
9
|
+
* The returned state can be modified with hooks such as useCarouselAutoplayButtonStyles_unstable,
|
|
10
|
+
* before being passed to renderCarouselAutoplayButton_unstable.
|
|
11
|
+
*
|
|
12
|
+
* @param props - props from this instance of CarouselAutoplayButton
|
|
13
|
+
* @param ref - reference to root HTMLDivElement of CarouselAutoplayButton
|
|
14
|
+
*/ export const useCarouselAutoplayButton_unstable = (props, ref)=>{
|
|
15
|
+
const { onCheckedChange, checked, defaultChecked } = props;
|
|
16
|
+
const [autoplay, setAutoplay] = useControllableState({
|
|
17
|
+
state: checked,
|
|
18
|
+
defaultState: defaultChecked,
|
|
19
|
+
initialState: false
|
|
20
|
+
});
|
|
21
|
+
const enableAutoplay = useCarouselContext((ctx)=>ctx.enableAutoplay);
|
|
22
|
+
React.useEffect(()=>{
|
|
23
|
+
return ()=>{
|
|
24
|
+
// We disable autoplay if the button gets unmounted.
|
|
25
|
+
enableAutoplay(false);
|
|
26
|
+
};
|
|
27
|
+
}, [
|
|
28
|
+
enableAutoplay
|
|
29
|
+
]);
|
|
30
|
+
useIsomorphicLayoutEffect(()=>{
|
|
31
|
+
// Enable/disable autoplay on state change
|
|
32
|
+
enableAutoplay(autoplay);
|
|
33
|
+
}, [
|
|
34
|
+
autoplay,
|
|
35
|
+
enableAutoplay
|
|
36
|
+
]);
|
|
37
|
+
const handleClick = (event)=>{
|
|
38
|
+
if (event.isDefaultPrevented()) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const newValue = !autoplay;
|
|
42
|
+
setAutoplay(newValue);
|
|
43
|
+
onCheckedChange === null || onCheckedChange === void 0 ? void 0 : onCheckedChange(event, {
|
|
44
|
+
event,
|
|
45
|
+
type: 'click',
|
|
46
|
+
checked: newValue
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
// We lean on react-button class to handle styling and icon enhancements
|
|
51
|
+
...useToggleButton_unstable({
|
|
52
|
+
icon: slot.optional(props.icon, {
|
|
53
|
+
defaultProps: {
|
|
54
|
+
children: autoplay ? /*#__PURE__*/ React.createElement(PauseCircleRegular, null) : /*#__PURE__*/ React.createElement(PlayCircleRegular, null)
|
|
55
|
+
},
|
|
56
|
+
renderByDefault: true,
|
|
57
|
+
elementType: 'span'
|
|
58
|
+
}),
|
|
59
|
+
...props,
|
|
60
|
+
checked: autoplay,
|
|
61
|
+
onClick: useEventCallback(mergeCallbacks(handleClick, props.onClick))
|
|
62
|
+
}, ref)
|
|
63
|
+
};
|
|
64
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useCarouselAutoplayButton.tsx"],"sourcesContent":["import type { ARIAButtonElement } from '@fluentui/react-aria';\nimport { useToggleButton_unstable } from '@fluentui/react-button';\nimport { PlayCircleRegular, PauseCircleRegular } from '@fluentui/react-icons';\nimport {\n mergeCallbacks,\n slot,\n useControllableState,\n useEventCallback,\n useIsomorphicLayoutEffect,\n} from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nimport type { CarouselAutoplayButtonProps, CarouselAutoplayButtonState } from './CarouselAutoplayButton.types';\nimport { useCarouselContext_unstable as useCarouselContext } from '../CarouselContext';\n\n/**\n * Create the state required to render CarouselAutoplayButton.\n *\n * The returned state can be modified with hooks such as useCarouselAutoplayButtonStyles_unstable,\n * before being passed to renderCarouselAutoplayButton_unstable.\n *\n * @param props - props from this instance of CarouselAutoplayButton\n * @param ref - reference to root HTMLDivElement of CarouselAutoplayButton\n */\nexport const useCarouselAutoplayButton_unstable = (\n props: CarouselAutoplayButtonProps,\n ref: React.Ref<ARIAButtonElement>,\n): CarouselAutoplayButtonState => {\n const { onCheckedChange, checked, defaultChecked } = props;\n\n const [autoplay, setAutoplay] = useControllableState({\n state: checked,\n defaultState: defaultChecked,\n initialState: false,\n });\n const enableAutoplay = useCarouselContext(ctx => ctx.enableAutoplay);\n\n React.useEffect(() => {\n return () => {\n // We disable autoplay if the button gets unmounted.\n enableAutoplay(false);\n };\n }, [enableAutoplay]);\n\n useIsomorphicLayoutEffect(() => {\n // Enable/disable autoplay on state change\n enableAutoplay(autoplay);\n }, [autoplay, enableAutoplay]);\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement>) => {\n if (event.isDefaultPrevented()) {\n return;\n }\n\n const newValue = !autoplay;\n\n setAutoplay(newValue);\n onCheckedChange?.(event, { event, type: 'click', checked: newValue });\n };\n\n return {\n // We lean on react-button class to handle styling and icon enhancements\n ...useToggleButton_unstable(\n {\n icon: slot.optional(props.icon, {\n defaultProps: {\n children: autoplay ? <PauseCircleRegular /> : <PlayCircleRegular />,\n },\n renderByDefault: true,\n elementType: 'span',\n }),\n ...props,\n checked: autoplay,\n onClick: useEventCallback(mergeCallbacks(handleClick, props.onClick)),\n },\n ref as React.Ref<HTMLButtonElement>,\n ),\n };\n};\n"],"names":["useToggleButton_unstable","PlayCircleRegular","PauseCircleRegular","mergeCallbacks","slot","useControllableState","useEventCallback","useIsomorphicLayoutEffect","React","useCarouselContext_unstable","useCarouselContext","useCarouselAutoplayButton_unstable","props","ref","onCheckedChange","checked","defaultChecked","autoplay","setAutoplay","state","defaultState","initialState","enableAutoplay","ctx","useEffect","handleClick","event","isDefaultPrevented","newValue","type","icon","optional","defaultProps","children","renderByDefault","elementType","onClick"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AACA,SAASA,wBAAwB,QAAQ,yBAAyB;AAClE,SAASC,iBAAiB,EAAEC,kBAAkB,QAAQ,wBAAwB;AAC9E,SACEC,cAAc,EACdC,IAAI,EACJC,oBAAoB,EACpBC,gBAAgB,EAChBC,yBAAyB,QACpB,4BAA4B;AACnC,YAAYC,WAAW,QAAQ;AAG/B,SAASC,+BAA+BC,kBAAkB,QAAQ,qBAAqB;AAEvF;;;;;;;;CAQC,GACD,OAAO,MAAMC,qCAAqC,CAChDC,OACAC;IAEA,MAAM,EAAEC,eAAe,EAAEC,OAAO,EAAEC,cAAc,EAAE,GAAGJ;IAErD,MAAM,CAACK,UAAUC,YAAY,GAAGb,qBAAqB;QACnDc,OAAOJ;QACPK,cAAcJ;QACdK,cAAc;IAChB;IACA,MAAMC,iBAAiBZ,mBAAmBa,CAAAA,MAAOA,IAAID,cAAc;IAEnEd,MAAMgB,SAAS,CAAC;QACd,OAAO;YACL,oDAAoD;YACpDF,eAAe;QACjB;IACF,GAAG;QAACA;KAAe;IAEnBf,0BAA0B;QACxB,0CAA0C;QAC1Ce,eAAeL;IACjB,GAAG;QAACA;QAAUK;KAAe;IAE7B,MAAMG,cAAc,CAACC;QACnB,IAAIA,MAAMC,kBAAkB,IAAI;YAC9B;QACF;QAEA,MAAMC,WAAW,CAACX;QAElBC,YAAYU;QACZd,4BAAAA,sCAAAA,gBAAkBY,OAAO;YAAEA;YAAOG,MAAM;YAASd,SAASa;QAAS;IACrE;IAEA,OAAO;QACL,wEAAwE;QACxE,GAAG5B,yBACD;YACE8B,MAAM1B,KAAK2B,QAAQ,CAACnB,MAAMkB,IAAI,EAAE;gBAC9BE,cAAc;oBACZC,UAAUhB,yBAAW,oBAACf,0CAAwB,oBAACD;gBACjD;gBACAiC,iBAAiB;gBACjBC,aAAa;YACf;YACA,GAAGvB,KAAK;YACRG,SAASE;YACTmB,SAAS9B,iBAAiBH,eAAesB,aAAab,MAAMwB,OAAO;QACrE,GACAvB,IACD;IACH;AACF,EAAE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { __styles, mergeClasses, shorthands } from '@griffel/react';
|
|
2
|
+
import { useToggleButtonStyles_unstable } from '@fluentui/react-button';
|
|
3
|
+
import { tokens } from '@fluentui/react-theme';
|
|
4
|
+
export const carouselAutoplayButtonClassNames = {
|
|
5
|
+
root: 'fui-CarouselAutoplayButton',
|
|
6
|
+
icon: 'fui-CarouselAutoplayButton__icon'
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Styles for the root slot
|
|
10
|
+
*/
|
|
11
|
+
const useStyles = /*#__PURE__*/__styles({
|
|
12
|
+
root: {
|
|
13
|
+
Bkecrkj: "fc5wo7j",
|
|
14
|
+
B6of3ja: "fgr6219",
|
|
15
|
+
jrapky: "f10jk5vf",
|
|
16
|
+
g2u3we: "fghlq4f",
|
|
17
|
+
h3c5rm: ["f1gn591s", "fjscplz"],
|
|
18
|
+
B9xav0g: "fb073pr",
|
|
19
|
+
zhjwy3: ["fjscplz", "f1gn591s"],
|
|
20
|
+
sj55zd: "fkfq4zb",
|
|
21
|
+
De3pzq: "fkfdr9r",
|
|
22
|
+
eoavqd: "f8491dx"
|
|
23
|
+
}
|
|
24
|
+
}, {
|
|
25
|
+
d: [".fc5wo7j{pointer-events:all;}", ".fgr6219{margin-top:auto;}", ".f10jk5vf{margin-bottom:auto;}", ".fghlq4f{border-top-color:var(--colorTransparentStroke);}", ".f1gn591s{border-right-color:var(--colorTransparentStroke);}", ".fjscplz{border-left-color:var(--colorTransparentStroke);}", ".fb073pr{border-bottom-color:var(--colorTransparentStroke);}", ".fkfq4zb{color:var(--colorNeutralForeground2);}", ".fkfdr9r{background-color:var(--colorNeutralBackgroundAlpha);}"],
|
|
26
|
+
h: [".f8491dx:hover{cursor:pointer;}"]
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Apply styling to the CarouselAutoplayButton slots based on the state
|
|
30
|
+
*/
|
|
31
|
+
export const useCarouselAutoplayButtonStyles_unstable = state => {
|
|
32
|
+
'use no memo';
|
|
33
|
+
|
|
34
|
+
const styles = useStyles();
|
|
35
|
+
useToggleButtonStyles_unstable(state);
|
|
36
|
+
state.root.className = mergeClasses(carouselAutoplayButtonClassNames.root, styles.root, state.root.className);
|
|
37
|
+
if (state.icon) {
|
|
38
|
+
state.icon.className = mergeClasses(carouselAutoplayButtonClassNames.icon, state.icon.className);
|
|
39
|
+
}
|
|
40
|
+
return state;
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=useCarouselAutoplayButtonStyles.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","shorthands","useToggleButtonStyles_unstable","tokens","carouselAutoplayButtonClassNames","root","icon","useStyles","Bkecrkj","B6of3ja","jrapky","g2u3we","h3c5rm","B9xav0g","zhjwy3","sj55zd","De3pzq","eoavqd","d","h","useCarouselAutoplayButtonStyles_unstable","state","styles","className"],"sources":["useCarouselAutoplayButtonStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { useToggleButtonStyles_unstable } from '@fluentui/react-button';\nimport { tokens } from '@fluentui/react-theme';\nexport const carouselAutoplayButtonClassNames = {\n root: 'fui-CarouselAutoplayButton',\n icon: 'fui-CarouselAutoplayButton__icon'\n};\n/**\n * Styles for the root slot\n */ const useStyles = makeStyles({\n root: {\n pointerEvents: 'all',\n marginTop: 'auto',\n marginBottom: 'auto',\n ...shorthands.borderColor(tokens.colorTransparentStroke),\n color: tokens.colorNeutralForeground2,\n backgroundColor: tokens.colorNeutralBackgroundAlpha,\n ':hover': {\n cursor: 'pointer'\n }\n }\n});\n/**\n * Apply styling to the CarouselAutoplayButton slots based on the state\n */ export const useCarouselAutoplayButtonStyles_unstable = (state)=>{\n 'use no memo';\n const styles = useStyles();\n useToggleButtonStyles_unstable(state);\n state.root.className = mergeClasses(carouselAutoplayButtonClassNames.root, styles.root, state.root.className);\n if (state.icon) {\n state.icon.className = mergeClasses(carouselAutoplayButtonClassNames.icon, state.icon.className);\n }\n return state;\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAqBC,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AACrE,SAASC,8BAA8B,QAAQ,wBAAwB;AACvE,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,OAAO,MAAMC,gCAAgC,GAAG;EAC5CC,IAAI,EAAE,4BAA4B;EAClCC,IAAI,EAAE;AACV,CAAC;AACD;AACA;AACA;AAAI,MAAMC,SAAS,gBAAGR,QAAA;EAAAM,IAAA;IAAAG,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;EAAA;AAAA;EAAAC,CAAA;EAAAC,CAAA;AAAA,CAYrB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,wCAAwC,GAAIC,KAAK,IAAG;EACjE,aAAa;;EACb,MAAMC,MAAM,GAAGf,SAAS,CAAC,CAAC;EAC1BL,8BAA8B,CAACmB,KAAK,CAAC;EACrCA,KAAK,CAAChB,IAAI,CAACkB,SAAS,GAAGvB,YAAY,CAACI,gCAAgC,CAACC,IAAI,EAAEiB,MAAM,CAACjB,IAAI,EAAEgB,KAAK,CAAChB,IAAI,CAACkB,SAAS,CAAC;EAC7G,IAAIF,KAAK,CAACf,IAAI,EAAE;IACZe,KAAK,CAACf,IAAI,CAACiB,SAAS,GAAGvB,YAAY,CAACI,gCAAgC,CAACE,IAAI,EAAEe,KAAK,CAACf,IAAI,CAACiB,SAAS,CAAC;EACpG;EACA,OAAOF,KAAK;AAChB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useCarouselButton_unstable } from './useCarouselButton';
|
|
3
|
+
import { renderCarouselButton_unstable } from './renderCarouselButton';
|
|
4
|
+
import { useCarouselButtonStyles_unstable } from './useCarouselButtonStyles.styles';
|
|
5
|
+
/**
|
|
6
|
+
* A default navigation button that will set value to the next/previous page,
|
|
7
|
+
* driven by it's type 'next' or 'previous'.
|
|
8
|
+
*/ export const CarouselButton = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
9
|
+
const state = useCarouselButton_unstable(props, ref);
|
|
10
|
+
useCarouselButtonStyles_unstable(state);
|
|
11
|
+
// TODO update types in packages/react-components/react-shared-contexts/src/CustomStyleHooksContext/CustomStyleHooksContext.ts
|
|
12
|
+
// https://github.com/microsoft/fluentui/blob/master/rfcs/react-components/convergence/custom-styling.md
|
|
13
|
+
// useCustomStyleHook_unstable('useCarouselButtonStyles_unstable')(state);
|
|
14
|
+
return renderCarouselButton_unstable(state);
|
|
15
|
+
});
|
|
16
|
+
CarouselButton.displayName = 'CarouselButton';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["CarouselButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCarouselButton_unstable } from './useCarouselButton';\nimport { renderCarouselButton_unstable } from './renderCarouselButton';\nimport { useCarouselButtonStyles_unstable } from './useCarouselButtonStyles.styles';\nimport type { CarouselButtonProps } from './CarouselButton.types';\n\n/**\n * A default navigation button that will set value to the next/previous page,\n * driven by it's type 'next' or 'previous'.\n */\nexport const CarouselButton: ForwardRefComponent<CarouselButtonProps> = React.forwardRef((props, ref) => {\n const state = useCarouselButton_unstable(props, ref);\n\n useCarouselButtonStyles_unstable(state);\n // TODO update types in packages/react-components/react-shared-contexts/src/CustomStyleHooksContext/CustomStyleHooksContext.ts\n // https://github.com/microsoft/fluentui/blob/master/rfcs/react-components/convergence/custom-styling.md\n // useCustomStyleHook_unstable('useCarouselButtonStyles_unstable')(state);\n\n return renderCarouselButton_unstable(state);\n});\n\nCarouselButton.displayName = 'CarouselButton';\n"],"names":["React","useCarouselButton_unstable","renderCarouselButton_unstable","useCarouselButtonStyles_unstable","CarouselButton","forwardRef","props","ref","state","displayName"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,6BAA6B,QAAQ,yBAAyB;AACvE,SAASC,gCAAgC,QAAQ,mCAAmC;AAGpF;;;CAGC,GACD,OAAO,MAAMC,+BAA2DJ,MAAMK,UAAU,CAAC,CAACC,OAAOC;IAC/F,MAAMC,QAAQP,2BAA2BK,OAAOC;IAEhDJ,iCAAiCK;IACjC,8HAA8H;IAC9H,wGAAwG;IACxG,0EAA0E;IAE1E,OAAON,8BAA8BM;AACvC,GAAG;AAEHJ,eAAeK,WAAW,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["CarouselButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport { ButtonProps, ButtonSlots, ButtonState } from '@fluentui/react-button';\n\nexport type CarouselButtonSlots = ButtonSlots & {\n root: NonNullable<Slot<ARIAButtonSlotProps>>;\n};\n\n/**\n * CarouselButton Props\n */\nexport type CarouselButtonProps = Partial<ButtonProps> &\n ComponentProps<CarouselButtonSlots> & {\n /**\n * Dictates whether button will be of type go next or go previous\n * Default: 'next'\n */\n navType?: 'prev' | 'next';\n };\n\n/**\n * State used in rendering CarouselButton\n */\nexport type CarouselButtonState = ButtonState &\n ComponentState<CarouselButtonSlots> &\n Required<Pick<CarouselButtonProps, 'navType'>>;\n"],"names":[],"rangeMappings":";;","mappings":"AAoBA;;CAEC,GACD,WAEiD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './CarouselButton';\nexport * from './CarouselButton.types';\nexport * from './renderCarouselButton';\nexport * from './useCarouselButton';\nexport * from './useCarouselButtonStyles.styles';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,yBAAyB;AACvC,cAAc,yBAAyB;AACvC,cAAc,sBAAsB;AACpC,cAAc,mCAAmC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { assertSlots } from '@fluentui/react-utilities';
|
|
2
|
+
import { renderButton_unstable } from '@fluentui/react-button';
|
|
3
|
+
/**
|
|
4
|
+
* Render the final JSX of CarouselButton
|
|
5
|
+
*/ export const renderCarouselButton_unstable = (state)=>{
|
|
6
|
+
assertSlots(state);
|
|
7
|
+
// We render the underlying react-button with injected carousel functionality
|
|
8
|
+
return renderButton_unstable(state);
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["renderCarouselButton.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { CarouselButtonState, CarouselButtonSlots } from './CarouselButton.types';\nimport { renderButton_unstable } from '@fluentui/react-button';\n\n/**\n * Render the final JSX of CarouselButton\n */\nexport const renderCarouselButton_unstable = (state: CarouselButtonState) => {\n assertSlots<CarouselButtonSlots>(state);\n\n // We render the underlying react-button with injected carousel functionality\n return renderButton_unstable(state);\n};\n"],"names":["assertSlots","renderButton_unstable","renderCarouselButton_unstable","state"],"rangeMappings":";;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD,GAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAExD,SAASC,qBAAqB,QAAQ,yBAAyB;AAE/D;;CAEC,GACD,OAAO,MAAMC,gCAAgC,CAACC;IAC5CH,YAAiCG;IAEjC,6EAA6E;IAC7E,OAAOF,sBAAsBE;AAC/B,EAAE"}
|