@fluentui/react-carousel 9.2.0 → 9.3.0
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 +26 -2
- package/dist/index.d.ts +47 -1
- package/lib/Carousel.js.map +1 -1
- package/lib/CarouselAutoplayButton.js.map +1 -1
- package/lib/CarouselButton.js.map +1 -1
- package/lib/CarouselCard.js.map +1 -1
- package/lib/CarouselContext.js.map +1 -1
- package/lib/CarouselNav.js.map +1 -1
- package/lib/CarouselNavButton.js.map +1 -1
- package/lib/CarouselNavContainer.js.map +1 -1
- package/lib/CarouselNavImageButton.js.map +1 -1
- package/lib/CarouselSlider.js.map +1 -1
- package/lib/CarouselViewport.js +1 -0
- package/lib/CarouselViewport.js.map +1 -0
- package/lib/components/Carousel/Carousel.js +2 -3
- package/lib/components/Carousel/Carousel.js.map +1 -1
- package/lib/components/Carousel/Carousel.types.js.map +1 -1
- package/lib/components/Carousel/index.js.map +1 -1
- package/lib/components/Carousel/renderCarousel.js.map +1 -1
- package/lib/components/Carousel/useCarousel.js +7 -5
- package/lib/components/Carousel/useCarousel.js.map +1 -1
- package/lib/components/Carousel/useCarouselContextValues.js +5 -3
- package/lib/components/Carousel/useCarouselContextValues.js.map +1 -1
- package/lib/components/Carousel/useCarouselStyles.styles.js +3 -10
- package/lib/components/Carousel/useCarouselStyles.styles.js.map +1 -1
- package/lib/components/CarouselAutoplayButton/CarouselAutoplayButton.js +2 -3
- package/lib/components/CarouselAutoplayButton/CarouselAutoplayButton.js.map +1 -1
- package/lib/components/CarouselAutoplayButton/CarouselAutoplayButton.types.js.map +1 -1
- package/lib/components/CarouselAutoplayButton/index.js.map +1 -1
- package/lib/components/CarouselAutoplayButton/renderCarouselAutoplayButton.js +1 -1
- package/lib/components/CarouselAutoplayButton/renderCarouselAutoplayButton.js.map +1 -1
- package/lib/components/CarouselAutoplayButton/useCarouselAutoplayButton.js.map +1 -1
- package/lib/components/CarouselAutoplayButton/useCarouselAutoplayButtonStyles.styles.js +1 -2
- package/lib/components/CarouselButton/CarouselButton.js +2 -3
- package/lib/components/CarouselButton/CarouselButton.js.map +1 -1
- package/lib/components/CarouselButton/CarouselButton.types.js.map +1 -1
- package/lib/components/CarouselButton/index.js.map +1 -1
- package/lib/components/CarouselButton/renderCarouselButton.js +1 -1
- package/lib/components/CarouselButton/renderCarouselButton.js.map +1 -1
- package/lib/components/CarouselButton/useCarouselButton.js.map +1 -1
- package/lib/components/CarouselButton/useCarouselButtonStyles.styles.js +1 -2
- package/lib/components/CarouselCard/CarouselCard.js +2 -3
- package/lib/components/CarouselCard/CarouselCard.js.map +1 -1
- package/lib/components/CarouselCard/CarouselCard.types.js.map +1 -1
- package/lib/components/CarouselCard/index.js.map +1 -1
- package/lib/components/CarouselCard/renderCarouselCard.js.map +1 -1
- package/lib/components/CarouselCard/useCarouselCard.js +10 -8
- package/lib/components/CarouselCard/useCarouselCard.js.map +1 -1
- package/lib/components/CarouselCard/useCarouselCardStyles.styles.js +1 -2
- package/lib/components/CarouselContext.js +2 -1
- package/lib/components/CarouselContext.js.map +1 -1
- package/lib/components/CarouselContext.types.js.map +1 -1
- package/lib/components/CarouselNav/CarouselNav.js +2 -3
- package/lib/components/CarouselNav/CarouselNav.js.map +1 -1
- package/lib/components/CarouselNav/CarouselNav.types.js.map +1 -1
- package/lib/components/CarouselNav/CarouselNavContext.js.map +1 -1
- package/lib/components/CarouselNav/CarouselNavIndexContext.js.map +1 -1
- package/lib/components/CarouselNav/index.js.map +1 -1
- package/lib/components/CarouselNav/renderCarouselNav.js.map +1 -1
- package/lib/components/CarouselNav/useCarouselNav.js.map +1 -1
- package/lib/components/CarouselNav/useCarouselNavStyles.styles.js +1 -2
- package/lib/components/CarouselNavButton/CarouselNavButton.js +2 -3
- package/lib/components/CarouselNavButton/CarouselNavButton.js.map +1 -1
- package/lib/components/CarouselNavButton/CarouselNavButton.types.js.map +1 -1
- package/lib/components/CarouselNavButton/index.js.map +1 -1
- package/lib/components/CarouselNavButton/renderCarouselNavButton.js.map +1 -1
- package/lib/components/CarouselNavButton/useCarouselNavButton.js.map +1 -1
- package/lib/components/CarouselNavButton/useCarouselNavButtonStyles.styles.js +1 -2
- package/lib/components/CarouselNavContainer/CarouselNavContainer.js +2 -8
- package/lib/components/CarouselNavContainer/CarouselNavContainer.js.map +1 -1
- package/lib/components/CarouselNavContainer/CarouselNavContainer.types.js.map +1 -1
- package/lib/components/CarouselNavContainer/index.js.map +1 -1
- package/lib/components/CarouselNavContainer/renderCarouselNavContainer.js.map +1 -1
- package/lib/components/CarouselNavContainer/useCarouselNavContainer.js.map +1 -1
- package/lib/components/CarouselNavContainer/useCarouselNavContainerStyles.styles.js +1 -2
- package/lib/components/CarouselNavImageButton/CarouselNavImageButton.js +2 -3
- package/lib/components/CarouselNavImageButton/CarouselNavImageButton.js.map +1 -1
- package/lib/components/CarouselNavImageButton/CarouselNavImageButton.types.js.map +1 -1
- package/lib/components/CarouselNavImageButton/index.js.map +1 -1
- package/lib/components/CarouselNavImageButton/renderCarouselNavImageButton.js.map +1 -1
- package/lib/components/CarouselNavImageButton/useCarouselNavImageButton.js.map +1 -1
- package/lib/components/CarouselNavImageButton/useCarouselNavImageButtonStyles.styles.js +1 -2
- package/lib/components/CarouselSlider/CarouselSlider.js +2 -3
- package/lib/components/CarouselSlider/CarouselSlider.js.map +1 -1
- package/lib/components/CarouselSlider/CarouselSlider.types.js.map +1 -1
- package/lib/components/CarouselSlider/CarouselSliderContext.js.map +1 -1
- package/lib/components/CarouselSlider/index.js.map +1 -1
- package/lib/components/CarouselSlider/renderCarouselSlider.js.map +1 -1
- package/lib/components/CarouselSlider/useCarouselSlider.js.map +1 -1
- package/lib/components/CarouselSlider/useCarouselSliderStyles.styles.js +1 -2
- package/lib/components/CarouselViewport/CarouselViewport.js +16 -0
- package/lib/components/CarouselViewport/CarouselViewport.js.map +1 -0
- package/lib/components/CarouselViewport/CarouselViewport.types.js +3 -0
- package/lib/components/CarouselViewport/CarouselViewport.types.js.map +1 -0
- package/lib/components/CarouselViewport/index.js +5 -0
- package/lib/components/CarouselViewport/index.js.map +1 -0
- package/lib/components/CarouselViewport/renderCarouselViewport.js +12 -0
- package/lib/components/CarouselViewport/renderCarouselViewport.js.map +1 -0
- package/lib/components/CarouselViewport/useCarouselViewport.js +28 -0
- package/lib/components/CarouselViewport/useCarouselViewport.js.map +1 -0
- package/lib/components/CarouselViewport/useCarouselViewportStyles.styles.js +25 -0
- package/lib/components/CarouselViewport/useCarouselViewportStyles.styles.js.map +1 -0
- package/lib/components/pointerEvents.js +58 -0
- package/lib/components/pointerEvents.js.map +1 -0
- package/lib/components/useEmblaCarousel.js +30 -11
- package/lib/components/useEmblaCarousel.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Carousel.js.map +1 -1
- package/lib-commonjs/CarouselAutoplayButton.js.map +1 -1
- package/lib-commonjs/CarouselButton.js.map +1 -1
- package/lib-commonjs/CarouselCard.js.map +1 -1
- package/lib-commonjs/CarouselContext.js.map +1 -1
- package/lib-commonjs/CarouselNav.js.map +1 -1
- package/lib-commonjs/CarouselNavButton.js.map +1 -1
- package/lib-commonjs/CarouselNavContainer.js.map +1 -1
- package/lib-commonjs/CarouselNavImageButton.js.map +1 -1
- package/lib-commonjs/CarouselSlider.js.map +1 -1
- package/lib-commonjs/CarouselViewport.js +6 -0
- package/lib-commonjs/CarouselViewport.js.map +1 -0
- package/lib-commonjs/components/Carousel/Carousel.js +2 -3
- package/lib-commonjs/components/Carousel/Carousel.js.map +1 -1
- package/lib-commonjs/components/Carousel/Carousel.types.js.map +1 -1
- package/lib-commonjs/components/Carousel/index.js.map +1 -1
- package/lib-commonjs/components/Carousel/renderCarousel.js.map +1 -1
- package/lib-commonjs/components/Carousel/useCarousel.js +7 -5
- package/lib-commonjs/components/Carousel/useCarousel.js.map +1 -1
- package/lib-commonjs/components/Carousel/useCarouselContextValues.js +5 -3
- package/lib-commonjs/components/Carousel/useCarouselContextValues.js.map +1 -1
- package/lib-commonjs/components/Carousel/useCarouselStyles.styles.js +3 -12
- package/lib-commonjs/components/Carousel/useCarouselStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CarouselAutoplayButton/CarouselAutoplayButton.js +2 -3
- package/lib-commonjs/components/CarouselAutoplayButton/CarouselAutoplayButton.js.map +1 -1
- package/lib-commonjs/components/CarouselAutoplayButton/CarouselAutoplayButton.types.js.map +1 -1
- package/lib-commonjs/components/CarouselAutoplayButton/index.js.map +1 -1
- package/lib-commonjs/components/CarouselAutoplayButton/renderCarouselAutoplayButton.js.map +1 -1
- package/lib-commonjs/components/CarouselAutoplayButton/useCarouselAutoplayButton.js.map +1 -1
- package/lib-commonjs/components/CarouselAutoplayButton/useCarouselAutoplayButtonStyles.styles.js +1 -1
- package/lib-commonjs/components/CarouselButton/CarouselButton.js +2 -3
- package/lib-commonjs/components/CarouselButton/CarouselButton.js.map +1 -1
- package/lib-commonjs/components/CarouselButton/CarouselButton.types.js.map +1 -1
- package/lib-commonjs/components/CarouselButton/index.js.map +1 -1
- package/lib-commonjs/components/CarouselButton/renderCarouselButton.js.map +1 -1
- package/lib-commonjs/components/CarouselButton/useCarouselButton.js.map +1 -1
- package/lib-commonjs/components/CarouselButton/useCarouselButtonStyles.styles.js +1 -1
- package/lib-commonjs/components/CarouselCard/CarouselCard.js +2 -3
- package/lib-commonjs/components/CarouselCard/CarouselCard.js.map +1 -1
- package/lib-commonjs/components/CarouselCard/CarouselCard.types.js.map +1 -1
- package/lib-commonjs/components/CarouselCard/index.js.map +1 -1
- package/lib-commonjs/components/CarouselCard/renderCarouselCard.js.map +1 -1
- package/lib-commonjs/components/CarouselCard/useCarouselCard.js +10 -8
- package/lib-commonjs/components/CarouselCard/useCarouselCard.js.map +1 -1
- package/lib-commonjs/components/CarouselCard/useCarouselCardStyles.styles.js +1 -1
- package/lib-commonjs/components/CarouselContext.js +2 -1
- package/lib-commonjs/components/CarouselContext.js.map +1 -1
- package/lib-commonjs/components/CarouselContext.types.js.map +1 -1
- package/lib-commonjs/components/CarouselNav/CarouselNav.js +2 -3
- package/lib-commonjs/components/CarouselNav/CarouselNav.js.map +1 -1
- package/lib-commonjs/components/CarouselNav/CarouselNav.types.js.map +1 -1
- package/lib-commonjs/components/CarouselNav/CarouselNavContext.js.map +1 -1
- package/lib-commonjs/components/CarouselNav/CarouselNavIndexContext.js.map +1 -1
- package/lib-commonjs/components/CarouselNav/index.js.map +1 -1
- package/lib-commonjs/components/CarouselNav/renderCarouselNav.js.map +1 -1
- package/lib-commonjs/components/CarouselNav/useCarouselNav.js.map +1 -1
- package/lib-commonjs/components/CarouselNav/useCarouselNavStyles.styles.js +1 -1
- package/lib-commonjs/components/CarouselNavButton/CarouselNavButton.js +2 -3
- package/lib-commonjs/components/CarouselNavButton/CarouselNavButton.js.map +1 -1
- package/lib-commonjs/components/CarouselNavButton/CarouselNavButton.types.js.map +1 -1
- package/lib-commonjs/components/CarouselNavButton/index.js.map +1 -1
- package/lib-commonjs/components/CarouselNavButton/renderCarouselNavButton.js.map +1 -1
- package/lib-commonjs/components/CarouselNavButton/useCarouselNavButton.js.map +1 -1
- package/lib-commonjs/components/CarouselNavButton/useCarouselNavButtonStyles.styles.js +1 -1
- package/lib-commonjs/components/CarouselNavContainer/CarouselNavContainer.js +2 -8
- package/lib-commonjs/components/CarouselNavContainer/CarouselNavContainer.js.map +1 -1
- package/lib-commonjs/components/CarouselNavContainer/CarouselNavContainer.types.js.map +1 -1
- package/lib-commonjs/components/CarouselNavContainer/index.js.map +1 -1
- package/lib-commonjs/components/CarouselNavContainer/renderCarouselNavContainer.js.map +1 -1
- package/lib-commonjs/components/CarouselNavContainer/useCarouselNavContainer.js.map +1 -1
- package/lib-commonjs/components/CarouselNavContainer/useCarouselNavContainerStyles.styles.js +1 -1
- package/lib-commonjs/components/CarouselNavImageButton/CarouselNavImageButton.js +2 -3
- package/lib-commonjs/components/CarouselNavImageButton/CarouselNavImageButton.js.map +1 -1
- package/lib-commonjs/components/CarouselNavImageButton/CarouselNavImageButton.types.js.map +1 -1
- package/lib-commonjs/components/CarouselNavImageButton/index.js.map +1 -1
- package/lib-commonjs/components/CarouselNavImageButton/renderCarouselNavImageButton.js.map +1 -1
- package/lib-commonjs/components/CarouselNavImageButton/useCarouselNavImageButton.js.map +1 -1
- package/lib-commonjs/components/CarouselNavImageButton/useCarouselNavImageButtonStyles.styles.js +1 -1
- package/lib-commonjs/components/CarouselSlider/CarouselSlider.js +2 -3
- package/lib-commonjs/components/CarouselSlider/CarouselSlider.js.map +1 -1
- package/lib-commonjs/components/CarouselSlider/CarouselSlider.types.js.map +1 -1
- package/lib-commonjs/components/CarouselSlider/CarouselSliderContext.js.map +1 -1
- package/lib-commonjs/components/CarouselSlider/index.js.map +1 -1
- package/lib-commonjs/components/CarouselSlider/renderCarouselSlider.js.map +1 -1
- package/lib-commonjs/components/CarouselSlider/useCarouselSlider.js.map +1 -1
- package/lib-commonjs/components/CarouselSlider/useCarouselSliderStyles.styles.js +1 -1
- package/lib-commonjs/components/CarouselViewport/CarouselViewport.js +25 -0
- package/lib-commonjs/components/CarouselViewport/CarouselViewport.js.map +1 -0
- package/lib-commonjs/components/CarouselViewport/CarouselViewport.types.js +6 -0
- package/lib-commonjs/components/CarouselViewport/CarouselViewport.types.js.map +1 -0
- package/lib-commonjs/components/CarouselViewport/index.js +10 -0
- package/lib-commonjs/components/CarouselViewport/index.js.map +1 -0
- package/lib-commonjs/components/CarouselViewport/renderCarouselViewport.js +20 -0
- package/lib-commonjs/components/CarouselViewport/renderCarouselViewport.js.map +1 -0
- package/lib-commonjs/components/CarouselViewport/useCarouselViewport.js +31 -0
- package/lib-commonjs/components/CarouselViewport/useCarouselViewport.js.map +1 -0
- package/lib-commonjs/components/CarouselViewport/useCarouselViewportStyles.styles.js +41 -0
- package/lib-commonjs/components/CarouselViewport/useCarouselViewportStyles.styles.js.map +1 -0
- package/lib-commonjs/components/pointerEvents.js +68 -0
- package/lib-commonjs/components/pointerEvents.js.map +1 -0
- package/lib-commonjs/components/useEmblaCarousel.js +29 -10
- package/lib-commonjs/components/useEmblaCarousel.js.map +1 -1
- package/lib-commonjs/index.js +16 -0
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +10 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,36 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-carousel
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 11 Nov 2024 09:55:33 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.3.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-carousel_v9.3.0)
|
|
8
|
+
|
|
9
|
+
Mon, 11 Nov 2024 09:55:33 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-carousel_v9.2.0..@fluentui/react-carousel_v9.3.0)
|
|
11
|
+
|
|
12
|
+
### Minor changes
|
|
13
|
+
|
|
14
|
+
- fix: Drag events now trigger onActiveIndexChange with drag/touch event attached ([PR #33092](https://github.com/microsoft/fluentui/pull/33092) by mifraser@microsoft.com)
|
|
15
|
+
- feat: Add CarouselViewport to correctly define CarouselSlider within a static container ([PR #33155](https://github.com/microsoft/fluentui/pull/33155) by mifraser@microsoft.com)
|
|
16
|
+
- Bump @fluentui/react-aria to v9.13.9 ([PR #31887](https://github.com/microsoft/fluentui/pull/31887) by beachball)
|
|
17
|
+
- Bump @fluentui/react-button to v9.3.95 ([PR #31887](https://github.com/microsoft/fluentui/pull/31887) by beachball)
|
|
18
|
+
- Bump @fluentui/react-context-selector to v9.1.69 ([PR #31887](https://github.com/microsoft/fluentui/pull/31887) by beachball)
|
|
19
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.46 ([PR #31887](https://github.com/microsoft/fluentui/pull/31887) by beachball)
|
|
20
|
+
- Bump @fluentui/react-shared-contexts to v9.21.0 ([PR #31887](https://github.com/microsoft/fluentui/pull/31887) by beachball)
|
|
21
|
+
- Bump @fluentui/react-tabster to v9.23.0 ([PR #31887](https://github.com/microsoft/fluentui/pull/31887) by beachball)
|
|
22
|
+
- Bump @fluentui/react-theme to v9.1.22 ([PR #31887](https://github.com/microsoft/fluentui/pull/31887) by beachball)
|
|
23
|
+
- Bump @fluentui/react-utilities to v9.18.17 ([PR #31887](https://github.com/microsoft/fluentui/pull/31887) by beachball)
|
|
24
|
+
|
|
25
|
+
### Patches
|
|
26
|
+
|
|
27
|
+
- fix: Ensure pointer events do not block future focus index changes ([PR #33204](https://github.com/microsoft/fluentui/pull/33204) by mifraser@microsoft.com)
|
|
28
|
+
- chore: replace npm-scripts and just-scrtips with nx inferred tasks ([PR #33074](https://github.com/microsoft/fluentui/pull/33074) by martinhochel@microsoft.com)
|
|
29
|
+
- style: resolve exposed jsx pragma lint issues within monorepo ([PR #32975](https://github.com/microsoft/fluentui/pull/32975) by martinhochel@microsoft.com)
|
|
30
|
+
|
|
7
31
|
## [9.2.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-carousel_v9.2.0)
|
|
8
32
|
|
|
9
|
-
Tue, 15 Oct 2024 17:
|
|
33
|
+
Tue, 15 Oct 2024 17:17:52 GMT
|
|
10
34
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-carousel_v9.1.0..@fluentui/react-carousel_v9.2.0)
|
|
11
35
|
|
|
12
36
|
### Minor changes
|
package/dist/index.d.ts
CHANGED
|
@@ -142,6 +142,7 @@ export declare type CarouselContextValue = {
|
|
|
142
142
|
enableAutoplay: (autoplay: boolean) => void;
|
|
143
143
|
resetAutoplay: () => void;
|
|
144
144
|
containerRef?: React_2.RefObject<HTMLDivElement>;
|
|
145
|
+
viewportRef?: React_2.RefObject<HTMLDivElement>;
|
|
145
146
|
};
|
|
146
147
|
|
|
147
148
|
/**
|
|
@@ -151,7 +152,7 @@ export declare type CarouselContextValues = {
|
|
|
151
152
|
carousel: CarouselContextValue;
|
|
152
153
|
};
|
|
153
154
|
|
|
154
|
-
export declare type CarouselIndexChangeData = EventData<'click' | 'focus', React_2.FocusEvent |
|
|
155
|
+
export declare type CarouselIndexChangeData = (EventData<'click', React_2.MouseEvent<HTMLButtonElement | HTMLAnchorElement>> | EventData<'focus', React_2.FocusEvent> | EventData<'drag', PointerEvent | MouseEvent>) & {
|
|
155
156
|
/**
|
|
156
157
|
* The index to be set after event has occurred.
|
|
157
158
|
*/
|
|
@@ -439,6 +440,30 @@ declare interface CarouselUpdateData {
|
|
|
439
440
|
slideNodes: HTMLElement[];
|
|
440
441
|
}
|
|
441
442
|
|
|
443
|
+
/**
|
|
444
|
+
* CarouselViewport component - TODO: add more docs
|
|
445
|
+
*/
|
|
446
|
+
export declare const CarouselViewport: ForwardRefComponent<CarouselViewportProps>;
|
|
447
|
+
|
|
448
|
+
export declare const carouselViewportClassNames: SlotClassNames<CarouselViewportSlots>;
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* CarouselViewport Props
|
|
452
|
+
*/
|
|
453
|
+
export declare type CarouselViewportProps = ComponentProps<CarouselViewportSlots>;
|
|
454
|
+
|
|
455
|
+
export declare type CarouselViewportSlots = {
|
|
456
|
+
/**
|
|
457
|
+
* The viewport outer container, defining the size of the carousels visible and interactable area
|
|
458
|
+
*/
|
|
459
|
+
root: Slot<'div'>;
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* State used in rendering CarouselViewport
|
|
464
|
+
*/
|
|
465
|
+
export declare type CarouselViewportState = ComponentState<Required<CarouselViewportSlots>> & CarouselSliderContextValue;
|
|
466
|
+
|
|
442
467
|
export declare type NavButtonRenderFunction = (index: number) => React_2.ReactNode;
|
|
443
468
|
|
|
444
469
|
/**
|
|
@@ -486,6 +511,11 @@ export declare const renderCarouselNavImageButton_unstable: (state: CarouselNavI
|
|
|
486
511
|
*/
|
|
487
512
|
export declare const renderCarouselSlider_unstable: (state: CarouselSliderState, contextValues: CarouselSliderContextValues) => JSX.Element;
|
|
488
513
|
|
|
514
|
+
/**
|
|
515
|
+
* Render the final JSX of CarouselViewport
|
|
516
|
+
*/
|
|
517
|
+
export declare const renderCarouselViewport_unstable: (state: CarouselViewportState, contextValues: CarouselSliderContextValues) => JSX.Element;
|
|
518
|
+
|
|
489
519
|
/**
|
|
490
520
|
* Create the state required to render Carousel.
|
|
491
521
|
*
|
|
@@ -632,4 +662,20 @@ export declare const useCarouselSliderStyles_unstable: (state: CarouselSliderSta
|
|
|
632
662
|
*/
|
|
633
663
|
export declare const useCarouselStyles_unstable: (state: CarouselState) => CarouselState;
|
|
634
664
|
|
|
665
|
+
/**
|
|
666
|
+
* Create the state required to render CarouselViewport.
|
|
667
|
+
*
|
|
668
|
+
* The returned state can be modified with hooks such as useCarouselViewportStyles_unstable,
|
|
669
|
+
* before being passed to renderCarouselViewport_unstable.
|
|
670
|
+
*
|
|
671
|
+
* @param props - props from this instance of CarouselViewport
|
|
672
|
+
* @param ref - reference to root HTMLDivElement of CarouselViewport
|
|
673
|
+
*/
|
|
674
|
+
export declare const useCarouselViewport_unstable: (props: CarouselViewportProps, ref: React_2.Ref<HTMLDivElement>) => CarouselViewportState;
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Apply styling to the CarouselViewport slots based on the state
|
|
678
|
+
*/
|
|
679
|
+
export declare const useCarouselViewportStyles_unstable: (state: CarouselViewportState) => CarouselViewportState;
|
|
680
|
+
|
|
635
681
|
export { }
|
package/lib/Carousel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Carousel.ts"],"sourcesContent":["export * from './components/Carousel/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,8BAA8B"}
|
|
1
|
+
{"version":3,"sources":["../src/Carousel.ts"],"sourcesContent":["export * from './components/Carousel/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,8BAA8B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CarouselAutoplayButton.ts"],"sourcesContent":["export * from './components/CarouselAutoplayButton/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,4CAA4C"}
|
|
1
|
+
{"version":3,"sources":["../src/CarouselAutoplayButton.ts"],"sourcesContent":["export * from './components/CarouselAutoplayButton/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,4CAA4C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CarouselButton.ts"],"sourcesContent":["export * from './components/CarouselButton/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,oCAAoC"}
|
|
1
|
+
{"version":3,"sources":["../src/CarouselButton.ts"],"sourcesContent":["export * from './components/CarouselButton/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,oCAAoC"}
|
package/lib/CarouselCard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CarouselCard.ts"],"sourcesContent":["export * from './components/CarouselCard/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,kCAAkC"}
|
|
1
|
+
{"version":3,"sources":["../src/CarouselCard.ts"],"sourcesContent":["export * from './components/CarouselCard/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,kCAAkC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CarouselContext.ts"],"sourcesContent":["export * from './components/CarouselContext';\nexport * from './components/CarouselContext.types';\n"],"names":[],"rangeMappings":";","mappings":"AAAA,cAAc,+BAA+B;AAC7C,cAAc,qCAAqC"}
|
|
1
|
+
{"version":3,"sources":["../src/CarouselContext.ts"],"sourcesContent":["export * from './components/CarouselContext';\nexport * from './components/CarouselContext.types';\n"],"names":[],"rangeMappings":";","mappings":"AAAA,cAAc,+BAA+B;AAC7C,cAAc,qCAAqC"}
|
package/lib/CarouselNav.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CarouselNav.ts"],"sourcesContent":["export * from './components/CarouselNav/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,iCAAiC"}
|
|
1
|
+
{"version":3,"sources":["../src/CarouselNav.ts"],"sourcesContent":["export * from './components/CarouselNav/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,iCAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CarouselNavButton.ts"],"sourcesContent":["export * from './components/CarouselNavButton/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,uCAAuC"}
|
|
1
|
+
{"version":3,"sources":["../src/CarouselNavButton.ts"],"sourcesContent":["export * from './components/CarouselNavButton/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,uCAAuC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CarouselNavContainer.ts"],"sourcesContent":["export * from './components/CarouselNavContainer/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,0CAA0C"}
|
|
1
|
+
{"version":3,"sources":["../src/CarouselNavContainer.ts"],"sourcesContent":["export * from './components/CarouselNavContainer/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,0CAA0C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CarouselNavImageButton.ts"],"sourcesContent":["export * from './components/CarouselNavImageButton/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,4CAA4C"}
|
|
1
|
+
{"version":3,"sources":["../src/CarouselNavImageButton.ts"],"sourcesContent":["export * from './components/CarouselNavImageButton/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,4CAA4C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["CarouselSlider.ts"],"sourcesContent":["export * from './components/CarouselSlider/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,oCAAoC"}
|
|
1
|
+
{"version":3,"sources":["../src/CarouselSlider.ts"],"sourcesContent":["export * from './components/CarouselSlider/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,oCAAoC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/CarouselViewport/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/CarouselViewport.ts"],"sourcesContent":["export * from './components/CarouselViewport/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,sCAAsC"}
|
|
@@ -3,6 +3,7 @@ import { useCarousel_unstable } from './useCarousel';
|
|
|
3
3
|
import { renderCarousel_unstable } from './renderCarousel';
|
|
4
4
|
import { useCarouselStyles_unstable } from './useCarouselStyles.styles';
|
|
5
5
|
import { useCarouselContextValues_unstable } from './useCarouselContextValues';
|
|
6
|
+
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
|
|
6
7
|
/**
|
|
7
8
|
* Carousel is the context wrapper and container for all carousel content/controls,
|
|
8
9
|
* it has no direct style or slot opinions.
|
|
@@ -11,10 +12,8 @@ import { useCarouselContextValues_unstable } from './useCarouselContextValues';
|
|
|
11
12
|
*/ export const Carousel = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
12
13
|
const state = useCarousel_unstable(props, ref);
|
|
13
14
|
useCarouselStyles_unstable(state);
|
|
15
|
+
useCustomStyleHook_unstable('useCarouselStyles_unstable')(state);
|
|
14
16
|
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
17
|
return renderCarousel_unstable(state, contextValues);
|
|
19
18
|
});
|
|
20
19
|
Carousel.displayName = 'Carousel';
|
|
@@ -1 +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
|
|
1
|
+
{"version":3,"sources":["../src/components/Carousel/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';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\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 useCustomStyleHook_unstable('useCarouselStyles_unstable')(state);\n\n const contextValues = useCarouselContextValues_unstable(state);\n\n return renderCarousel_unstable(state, contextValues);\n});\n\nCarousel.displayName = 'Carousel';\n"],"names":["React","useCarousel_unstable","renderCarousel_unstable","useCarouselStyles_unstable","useCarouselContextValues_unstable","useCustomStyleHook_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;AAC/E,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;;;;CAKC,GACD,OAAO,MAAMC,yBAA+CN,MAAMO,UAAU,CAAC,CAACC,OAAOC;IACnF,MAAMC,QAAQT,qBAAqBO,OAAOC;IAE1CN,2BAA2BO;IAC3BL,4BAA4B,8BAA8BK;IAE1D,MAAMC,gBAAgBP,kCAAkCM;IAExD,OAAOR,wBAAwBQ,OAAOC;AACxC,GAAG;AAEHL,SAASM,WAAW,GAAG"}
|
|
@@ -1 +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 * List of integrated motion types\n */\nexport type CarouselMotion = 'slide' | 'fade';\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 * Sets motion to fade in/out style with minimal movement\n * Defaults: false\n */\n motion?: CarouselMotion;\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":"AAwFA;;CAEC,GACD,WAiBC"}
|
|
1
|
+
{"version":3,"sources":["../src/components/Carousel/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 * List of integrated motion types\n */\nexport type CarouselMotion = 'slide' | 'fade';\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 * Sets motion to fade in/out style with minimal movement\n * Defaults: false\n */\n motion?: CarouselMotion;\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":"AAwFA;;CAEC,GACD,WAiBC"}
|
|
@@ -1 +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"}
|
|
1
|
+
{"version":3,"sources":["../src/components/Carousel/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"}
|
|
@@ -1 +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"}
|
|
1
|
+
{"version":3,"sources":["../src/components/Carousel/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"}
|
|
@@ -15,7 +15,7 @@ import { useAnnounce } from '@fluentui/react-shared-contexts';
|
|
|
15
15
|
'use no memo';
|
|
16
16
|
const { align = 'center', circular = false, onActiveIndexChange, groupSize = 'auto', draggable = false, whitespace = false, announcement, motion = 'slide' } = props;
|
|
17
17
|
const { dir } = useFluent();
|
|
18
|
-
const { activeIndex, carouselApi, containerRef, subscribeForValues, enableAutoplay, resetAutoplay } = useEmblaCarousel({
|
|
18
|
+
const { activeIndex, carouselApi, containerRef, viewportRef, subscribeForValues, enableAutoplay, resetAutoplay } = useEmblaCarousel({
|
|
19
19
|
align,
|
|
20
20
|
direction: dir,
|
|
21
21
|
loop: circular,
|
|
@@ -24,7 +24,8 @@ import { useAnnounce } from '@fluentui/react-shared-contexts';
|
|
|
24
24
|
activeIndex: props.activeIndex,
|
|
25
25
|
watchDrag: draggable,
|
|
26
26
|
containScroll: whitespace ? false : 'keepSnaps',
|
|
27
|
-
motion
|
|
27
|
+
motion,
|
|
28
|
+
onDragIndexChange: onActiveIndexChange
|
|
28
29
|
});
|
|
29
30
|
const selectPageByElement = useEventCallback((event, element, jump)=>{
|
|
30
31
|
const foundIndex = carouselApi.scrollToElement(element, jump);
|
|
@@ -52,7 +53,7 @@ import { useAnnounce } from '@fluentui/react-shared-contexts';
|
|
|
52
53
|
});
|
|
53
54
|
return nextPageIndex;
|
|
54
55
|
});
|
|
55
|
-
const
|
|
56
|
+
const mergedContainerRef = useMergedRefs(ref, containerRef);
|
|
56
57
|
// Announce carousel updates
|
|
57
58
|
const announcementTextRef = React.useRef('');
|
|
58
59
|
const totalNavLength = React.useRef(0);
|
|
@@ -99,7 +100,7 @@ import { useAnnounce } from '@fluentui/react-shared-contexts';
|
|
|
99
100
|
root: 'div'
|
|
100
101
|
},
|
|
101
102
|
root: slot.always(getIntrinsicElementProps('div', {
|
|
102
|
-
ref:
|
|
103
|
+
ref: mergedContainerRef,
|
|
103
104
|
role: 'region',
|
|
104
105
|
...props
|
|
105
106
|
}), {
|
|
@@ -107,7 +108,8 @@ import { useAnnounce } from '@fluentui/react-shared-contexts';
|
|
|
107
108
|
}),
|
|
108
109
|
activeIndex,
|
|
109
110
|
circular,
|
|
110
|
-
containerRef:
|
|
111
|
+
containerRef: mergedContainerRef,
|
|
112
|
+
viewportRef,
|
|
111
113
|
selectPageByElement,
|
|
112
114
|
selectPageByDirection,
|
|
113
115
|
selectPageByIndex,
|
|
@@ -1 +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 motion = 'slide',\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 motion,\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
|
|
1
|
+
{"version":3,"sources":["../src/components/Carousel/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 motion = 'slide',\n } = props;\n\n const { dir } = useFluent();\n const { activeIndex, carouselApi, containerRef, viewportRef, 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 motion,\n onDragIndexChange: onActiveIndexChange,\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 mergedContainerRef = 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: mergedContainerRef,\n role: 'region',\n ...props,\n }),\n { elementType: 'div' },\n ),\n\n activeIndex,\n circular,\n containerRef: mergedContainerRef,\n viewportRef,\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","motion","dir","activeIndex","carouselApi","containerRef","viewportRef","subscribeForValues","enableAutoplay","resetAutoplay","direction","loop","slidesToScroll","defaultActiveIndex","watchDrag","containScroll","onDragIndexChange","selectPageByElement","event","element","jump","foundIndex","scrollToElement","type","index","selectPageByIndex","scrollToIndex","selectPageByDirection","nextPageIndex","scrollInDirection","mergedContainerRef","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,EACZC,SAAS,OAAO,EACjB,GAAGT;IAEJ,MAAM,EAAEU,GAAG,EAAE,GAAGpB;IAChB,MAAM,EAAEqB,WAAW,EAAEC,WAAW,EAAEC,YAAY,EAAEC,WAAW,EAAEC,kBAAkB,EAAEC,cAAc,EAAEC,aAAa,EAAE,GAC9GpB,iBAAiB;QACfK;QACAgB,WAAWR;QACXS,MAAMhB;QACNiB,gBAAgBf;QAChBgB,oBAAoBrB,MAAMqB,kBAAkB;QAC5CV,aAAaX,MAAMW,WAAW;QAC9BW,WAAWhB;QACXiB,eAAehB,aAAa,QAAQ;QACpCE;QACAe,mBAAmBpB;IACrB;IAEF,MAAMqB,sBAAmEhC,iBAAiB,CAACiC,OAAOC,SAASC;QACzG,MAAMC,aAAajB,YAAYkB,eAAe,CAACH,SAASC;QACxDxB,gCAAAA,0CAAAA,oBAAsBsB,OAAO;YAAEA;YAAOK,MAAM;YAASC,OAAOH;QAAW;QAEvE,OAAOA;IACT;IAEA,MAAMI,oBAA+DxC,iBAAiB,CAACiC,OAAOM,OAAOJ;QACnGhB,YAAYsB,aAAa,CAACF,OAAOJ;QAEjCxB,gCAAAA,0CAAAA,oBAAsBsB,OAAO;YAAEA;YAAOK,MAAM;YAASC;QAAM;IAC7D;IAEA,MAAMG,wBAAuE1C,iBAAiB,CAACiC,OAAOR;QACpG,MAAMkB,gBAAgBxB,YAAYyB,iBAAiB,CAACnB;QACpDd,gCAAAA,0CAAAA,oBAAsBsB,OAAO;YAAEA;YAAOK,MAAM;YAASC,OAAOI;QAAc;QAE1E,OAAOA;IACT;IAEA,MAAME,qBAAqB3C,cAAcM,KAAKY;IAE9C,4BAA4B;IAC5B,MAAM0B,sBAAsB3C,MAAM4C,MAAM,CAAS;IACjD,MAAMC,iBAAiB7C,MAAM4C,MAAM,CAAS;IAC5C,MAAME,cAAc9C,MAAM4C,MAAM,CAAa,EAAE;IAE/C,MAAM,EAAEG,QAAQ,EAAE,GAAG7C;IAErB,MAAM8C,qBAAqBnD,iBAAiB;QAC1C,IAAIgD,eAAeI,OAAO,IAAI,KAAK,CAACrC,cAAc;YAChD,+CAA+C;YAC/C;QACF;QAEA,MAAMsC,mBAAmBtC,aAAaG,aAAa8B,eAAeI,OAAO,EAAEH,YAAYG,OAAO;QAE9F,IAAIC,qBAAqBP,oBAAoBM,OAAO,EAAE;YACpDN,oBAAoBM,OAAO,GAAGC;YAC9BH,SAASG,kBAAkB;gBAAEC,QAAQ;YAAK;QAC5C;IACF;IAEArD,0BAA0B;QACxB,oDAAoD;QACpD,OAAOqB,mBAAmBiC,CAAAA;YACxB,IAAIP,eAAeI,OAAO,IAAI,KAAKG,KAAKC,aAAa,GAAG,KAAKzC,cAAc;gBACzE,MAAMsC,mBAAmBtC,aAAawC,KAAKrC,WAAW,EAAEqC,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;QAAC7B;QAAoB6B;QAAoBpC;KAAa;IAEzDd,0BAA0B;QACxBkD;IACF,GAAG;QAACjC;QAAaiC;KAAmB;IAEpC,OAAO;QACLO,YAAY;YACVC,MAAM;QACR;QACAA,MAAM5D,KAAK6D,MAAM,CACf9D,yBAAyB,OAAO;YAC9BU,KAAKqC;YACLgB,MAAM;YACN,GAAGtD,KAAK;QACV,IACA;YAAEuD,aAAa;QAAM;QAGvB5C;QACAR;QACAU,cAAcyB;QACdxB;QACAW;QACAU;QACAF;QACAlB;QACAC;QACAC;IACF;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export function useCarouselContextValues_unstable(state) {
|
|
3
|
-
const { activeIndex, selectPageByElement, selectPageByDirection, selectPageByIndex, subscribeForValues, enableAutoplay, resetAutoplay, circular, containerRef } = state;
|
|
3
|
+
const { activeIndex, selectPageByElement, selectPageByDirection, selectPageByIndex, subscribeForValues, enableAutoplay, resetAutoplay, circular, containerRef, viewportRef } = state;
|
|
4
4
|
const carousel = React.useMemo(()=>({
|
|
5
5
|
activeIndex,
|
|
6
6
|
selectPageByElement,
|
|
@@ -10,7 +10,8 @@ export function useCarouselContextValues_unstable(state) {
|
|
|
10
10
|
enableAutoplay,
|
|
11
11
|
resetAutoplay,
|
|
12
12
|
circular,
|
|
13
|
-
containerRef
|
|
13
|
+
containerRef,
|
|
14
|
+
viewportRef
|
|
14
15
|
}), [
|
|
15
16
|
activeIndex,
|
|
16
17
|
selectPageByElement,
|
|
@@ -20,7 +21,8 @@ export function useCarouselContextValues_unstable(state) {
|
|
|
20
21
|
enableAutoplay,
|
|
21
22
|
resetAutoplay,
|
|
22
23
|
circular,
|
|
23
|
-
containerRef
|
|
24
|
+
containerRef,
|
|
25
|
+
viewportRef
|
|
24
26
|
]);
|
|
25
27
|
return {
|
|
26
28
|
carousel
|
|
@@ -1 +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":"
|
|
1
|
+
{"version":3,"sources":["../src/components/Carousel/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 viewportRef,\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 viewportRef,\n }),\n [\n activeIndex,\n selectPageByElement,\n selectPageByDirection,\n selectPageByIndex,\n subscribeForValues,\n enableAutoplay,\n resetAutoplay,\n circular,\n containerRef,\n viewportRef,\n ],\n );\n\n return { carousel };\n}\n"],"names":["React","useCarouselContextValues_unstable","state","activeIndex","selectPageByElement","selectPageByDirection","selectPageByIndex","subscribeForValues","enableAutoplay","resetAutoplay","circular","containerRef","viewportRef","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,EACZC,WAAW,EACZ,GAAGV;IAEJ,MAAMW,WAAWb,MAAMc,OAAO,CAC5B,IAAO,CAAA;YACLX;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;QACF,CAAA,GACA;QACET;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;KACD;IAGH,OAAO;QAAEC;IAAS;AACpB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { __styles, mergeClasses } from '@griffel/react';
|
|
2
|
-
import { tokens } from '@fluentui/react-theme';
|
|
3
2
|
export const carouselClassNames = {
|
|
4
3
|
root: 'fui-Carousel'
|
|
5
4
|
};
|
|
@@ -8,17 +7,12 @@ export const carouselClassNames = {
|
|
|
8
7
|
*/
|
|
9
8
|
const useStyles = /*#__PURE__*/__styles({
|
|
10
9
|
root: {
|
|
11
|
-
|
|
12
|
-
B68tc82: 0,
|
|
13
|
-
Bmxbyg5: 0,
|
|
14
|
-
Bpg54ce: "f1a3p1vp",
|
|
10
|
+
B68tc82: "f1p9o1ba",
|
|
15
11
|
Eiaeu8: "f1115ve7",
|
|
16
12
|
qhf8xq: "f10pi13n"
|
|
17
13
|
}
|
|
18
14
|
}, {
|
|
19
|
-
d: [".
|
|
20
|
-
p: -1
|
|
21
|
-
}], ".f1115ve7{overflow-anchor:none;}", ".f10pi13n{position:relative;}"]
|
|
15
|
+
d: [".f1p9o1ba{overflow-x:hidden;}", ".f1115ve7{overflow-anchor:none;}", ".f10pi13n{position:relative;}"]
|
|
22
16
|
});
|
|
23
17
|
/**
|
|
24
18
|
* Apply styling to the Carousel slots based on the state
|
|
@@ -29,5 +23,4 @@ export const useCarouselStyles_unstable = state => {
|
|
|
29
23
|
const styles = useStyles();
|
|
30
24
|
state.root.className = mergeClasses(carouselClassNames.root, styles.root, state.root.className);
|
|
31
25
|
return state;
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=useCarouselStyles.styles.js.map
|
|
26
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__styles","mergeClasses","
|
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","carouselClassNames","root","useStyles","B68tc82","Eiaeu8","qhf8xq","d","useCarouselStyles_unstable","state","styles","className"],"sources":["useCarouselStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nexport const carouselClassNames = {\n root: 'fui-Carousel'\n};\n/**\n * Styles for the root slot\n */ const useStyles = makeStyles({\n root: {\n // Only hide horizontal overflow to enable focus border to bleed bounds vertically\n overflowX: '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,OAAO,MAAMC,kBAAkB,GAAG;EAC9BC,IAAI,EAAE;AACV,CAAC;AACD;AACA;AACA;AAAI,MAAMC,SAAS,gBAAGJ,QAAA;EAAAG,IAAA;IAAAE,OAAA;IAAAC,MAAA;IAAAC,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAOrB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,0BAA0B,GAAIC,KAAK,IAAG;EACnD,aAAa;;EACb,MAAMC,MAAM,GAAGP,SAAS,CAAC,CAAC;EAC1BM,KAAK,CAACP,IAAI,CAACS,SAAS,GAAGX,YAAY,CAACC,kBAAkB,CAACC,IAAI,EAAEQ,MAAM,CAACR,IAAI,EAAEO,KAAK,CAACP,IAAI,CAACS,SAAS,CAAC;EAC/F,OAAOF,KAAK;AAChB,CAAC","ignoreList":[]}
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { useCarouselAutoplayButton_unstable } from './useCarouselAutoplayButton';
|
|
3
3
|
import { renderCarouselAutoplayButton_unstable } from './renderCarouselAutoplayButton';
|
|
4
4
|
import { useCarouselAutoplayButtonStyles_unstable } from './useCarouselAutoplayButtonStyles.styles';
|
|
5
|
+
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
|
|
5
6
|
/**
|
|
6
7
|
* If the Carousel is on auto-play, the user may opt into pausing the auto-play feature via the
|
|
7
8
|
* CarouselAutoplayButton which must be present for auto-play to be enabled.
|
|
@@ -10,9 +11,7 @@ import { useCarouselAutoplayButtonStyles_unstable } from './useCarouselAutoplayB
|
|
|
10
11
|
*/ export const CarouselAutoplayButton = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
11
12
|
const state = useCarouselAutoplayButton_unstable(props, ref);
|
|
12
13
|
useCarouselAutoplayButtonStyles_unstable(state);
|
|
13
|
-
|
|
14
|
-
// https://github.com/microsoft/fluentui/blob/master/rfcs/react-components/convergence/custom-styling.md
|
|
15
|
-
// useCustomStyleHook_unstable('useCarouselAutoplayButtonStyles_unstable')(state);
|
|
14
|
+
useCustomStyleHook_unstable('useCarouselAutoplayButtonStyles_unstable')(state);
|
|
16
15
|
return renderCarouselAutoplayButton_unstable(state);
|
|
17
16
|
});
|
|
18
17
|
CarouselAutoplayButton.displayName = 'CarouselAutoplayButton';
|
|
@@ -1 +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
|
|
1
|
+
{"version":3,"sources":["../src/components/CarouselAutoplayButton/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';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\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 useCustomStyleHook_unstable('useCarouselAutoplayButtonStyles_unstable')(state);\n\n return renderCarouselAutoplayButton_unstable(state);\n },\n);\n\nCarouselAutoplayButton.displayName = 'CarouselAutoplayButton';\n"],"names":["React","useCarouselAutoplayButton_unstable","renderCarouselAutoplayButton_unstable","useCarouselAutoplayButtonStyles_unstable","useCustomStyleHook_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;AAEpG,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;;;;CAKC,GACD,OAAO,MAAMC,uCAA2EL,MAAMM,UAAU,CACtG,CAACC,OAAOC;IACN,MAAMC,QAAQR,mCAAmCM,OAAOC;IAExDL,yCAAyCM;IACzCL,4BAA4B,4CAA4CK;IAExE,OAAOP,sCAAsCO;AAC/C,GACA;AAEFJ,uBAAuBK,WAAW,GAAG"}
|
|
@@ -1 +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"}
|
|
1
|
+
{"version":3,"sources":["../src/components/CarouselAutoplayButton/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"}
|
|
@@ -1 +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"}
|
|
1
|
+
{"version":3,"sources":["../src/components/CarouselAutoplayButton/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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderCarouselAutoplayButton.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/components/CarouselAutoplayButton/renderCarouselAutoplayButton.tsx"],"sourcesContent":["import { 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,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"}
|
|
@@ -1 +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"}
|
|
1
|
+
{"version":3,"sources":["../src/components/CarouselAutoplayButton/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"}
|
|
@@ -38,5 +38,4 @@ export const useCarouselAutoplayButtonStyles_unstable = state => {
|
|
|
38
38
|
state.icon.className = mergeClasses(carouselAutoplayButtonClassNames.icon, state.icon.className);
|
|
39
39
|
}
|
|
40
40
|
return state;
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=useCarouselAutoplayButtonStyles.styles.js.map
|
|
41
|
+
};
|
|
@@ -2,15 +2,14 @@ import * as React from 'react';
|
|
|
2
2
|
import { useCarouselButton_unstable } from './useCarouselButton';
|
|
3
3
|
import { renderCarouselButton_unstable } from './renderCarouselButton';
|
|
4
4
|
import { useCarouselButtonStyles_unstable } from './useCarouselButtonStyles.styles';
|
|
5
|
+
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
|
|
5
6
|
/**
|
|
6
7
|
* A default navigation button that will set value to the next/previous page,
|
|
7
8
|
* driven by it's type 'next' or 'previous'.
|
|
8
9
|
*/ export const CarouselButton = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
9
10
|
const state = useCarouselButton_unstable(props, ref);
|
|
10
11
|
useCarouselButtonStyles_unstable(state);
|
|
11
|
-
|
|
12
|
-
// https://github.com/microsoft/fluentui/blob/master/rfcs/react-components/convergence/custom-styling.md
|
|
13
|
-
// useCustomStyleHook_unstable('useCarouselButtonStyles_unstable')(state);
|
|
12
|
+
useCustomStyleHook_unstable('useCarouselButtonStyles_unstable')(state);
|
|
14
13
|
return renderCarouselButton_unstable(state);
|
|
15
14
|
});
|
|
16
15
|
CarouselButton.displayName = 'CarouselButton';
|
|
@@ -1 +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
|
|
1
|
+
{"version":3,"sources":["../src/components/CarouselButton/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';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\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 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","useCustomStyleHook_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;AAEpF,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;;CAGC,GACD,OAAO,MAAMC,+BAA2DL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IAC/F,MAAMC,QAAQR,2BAA2BM,OAAOC;IAEhDL,iCAAiCM;IACjCL,4BAA4B,oCAAoCK;IAEhE,OAAOP,8BAA8BO;AACvC,GAAG;AAEHJ,eAAeK,WAAW,GAAG"}
|
|
@@ -1 +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"}
|
|
1
|
+
{"version":3,"sources":["../src/components/CarouselButton/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"}
|
|
@@ -1 +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"}
|
|
1
|
+
{"version":3,"sources":["../src/components/CarouselButton/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"}
|