@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.
Files changed (213) hide show
  1. package/CHANGELOG.md +26 -2
  2. package/dist/index.d.ts +47 -1
  3. package/lib/Carousel.js.map +1 -1
  4. package/lib/CarouselAutoplayButton.js.map +1 -1
  5. package/lib/CarouselButton.js.map +1 -1
  6. package/lib/CarouselCard.js.map +1 -1
  7. package/lib/CarouselContext.js.map +1 -1
  8. package/lib/CarouselNav.js.map +1 -1
  9. package/lib/CarouselNavButton.js.map +1 -1
  10. package/lib/CarouselNavContainer.js.map +1 -1
  11. package/lib/CarouselNavImageButton.js.map +1 -1
  12. package/lib/CarouselSlider.js.map +1 -1
  13. package/lib/CarouselViewport.js +1 -0
  14. package/lib/CarouselViewport.js.map +1 -0
  15. package/lib/components/Carousel/Carousel.js +2 -3
  16. package/lib/components/Carousel/Carousel.js.map +1 -1
  17. package/lib/components/Carousel/Carousel.types.js.map +1 -1
  18. package/lib/components/Carousel/index.js.map +1 -1
  19. package/lib/components/Carousel/renderCarousel.js.map +1 -1
  20. package/lib/components/Carousel/useCarousel.js +7 -5
  21. package/lib/components/Carousel/useCarousel.js.map +1 -1
  22. package/lib/components/Carousel/useCarouselContextValues.js +5 -3
  23. package/lib/components/Carousel/useCarouselContextValues.js.map +1 -1
  24. package/lib/components/Carousel/useCarouselStyles.styles.js +3 -10
  25. package/lib/components/Carousel/useCarouselStyles.styles.js.map +1 -1
  26. package/lib/components/CarouselAutoplayButton/CarouselAutoplayButton.js +2 -3
  27. package/lib/components/CarouselAutoplayButton/CarouselAutoplayButton.js.map +1 -1
  28. package/lib/components/CarouselAutoplayButton/CarouselAutoplayButton.types.js.map +1 -1
  29. package/lib/components/CarouselAutoplayButton/index.js.map +1 -1
  30. package/lib/components/CarouselAutoplayButton/renderCarouselAutoplayButton.js +1 -1
  31. package/lib/components/CarouselAutoplayButton/renderCarouselAutoplayButton.js.map +1 -1
  32. package/lib/components/CarouselAutoplayButton/useCarouselAutoplayButton.js.map +1 -1
  33. package/lib/components/CarouselAutoplayButton/useCarouselAutoplayButtonStyles.styles.js +1 -2
  34. package/lib/components/CarouselButton/CarouselButton.js +2 -3
  35. package/lib/components/CarouselButton/CarouselButton.js.map +1 -1
  36. package/lib/components/CarouselButton/CarouselButton.types.js.map +1 -1
  37. package/lib/components/CarouselButton/index.js.map +1 -1
  38. package/lib/components/CarouselButton/renderCarouselButton.js +1 -1
  39. package/lib/components/CarouselButton/renderCarouselButton.js.map +1 -1
  40. package/lib/components/CarouselButton/useCarouselButton.js.map +1 -1
  41. package/lib/components/CarouselButton/useCarouselButtonStyles.styles.js +1 -2
  42. package/lib/components/CarouselCard/CarouselCard.js +2 -3
  43. package/lib/components/CarouselCard/CarouselCard.js.map +1 -1
  44. package/lib/components/CarouselCard/CarouselCard.types.js.map +1 -1
  45. package/lib/components/CarouselCard/index.js.map +1 -1
  46. package/lib/components/CarouselCard/renderCarouselCard.js.map +1 -1
  47. package/lib/components/CarouselCard/useCarouselCard.js +10 -8
  48. package/lib/components/CarouselCard/useCarouselCard.js.map +1 -1
  49. package/lib/components/CarouselCard/useCarouselCardStyles.styles.js +1 -2
  50. package/lib/components/CarouselContext.js +2 -1
  51. package/lib/components/CarouselContext.js.map +1 -1
  52. package/lib/components/CarouselContext.types.js.map +1 -1
  53. package/lib/components/CarouselNav/CarouselNav.js +2 -3
  54. package/lib/components/CarouselNav/CarouselNav.js.map +1 -1
  55. package/lib/components/CarouselNav/CarouselNav.types.js.map +1 -1
  56. package/lib/components/CarouselNav/CarouselNavContext.js.map +1 -1
  57. package/lib/components/CarouselNav/CarouselNavIndexContext.js.map +1 -1
  58. package/lib/components/CarouselNav/index.js.map +1 -1
  59. package/lib/components/CarouselNav/renderCarouselNav.js.map +1 -1
  60. package/lib/components/CarouselNav/useCarouselNav.js.map +1 -1
  61. package/lib/components/CarouselNav/useCarouselNavStyles.styles.js +1 -2
  62. package/lib/components/CarouselNavButton/CarouselNavButton.js +2 -3
  63. package/lib/components/CarouselNavButton/CarouselNavButton.js.map +1 -1
  64. package/lib/components/CarouselNavButton/CarouselNavButton.types.js.map +1 -1
  65. package/lib/components/CarouselNavButton/index.js.map +1 -1
  66. package/lib/components/CarouselNavButton/renderCarouselNavButton.js.map +1 -1
  67. package/lib/components/CarouselNavButton/useCarouselNavButton.js.map +1 -1
  68. package/lib/components/CarouselNavButton/useCarouselNavButtonStyles.styles.js +1 -2
  69. package/lib/components/CarouselNavContainer/CarouselNavContainer.js +2 -8
  70. package/lib/components/CarouselNavContainer/CarouselNavContainer.js.map +1 -1
  71. package/lib/components/CarouselNavContainer/CarouselNavContainer.types.js.map +1 -1
  72. package/lib/components/CarouselNavContainer/index.js.map +1 -1
  73. package/lib/components/CarouselNavContainer/renderCarouselNavContainer.js.map +1 -1
  74. package/lib/components/CarouselNavContainer/useCarouselNavContainer.js.map +1 -1
  75. package/lib/components/CarouselNavContainer/useCarouselNavContainerStyles.styles.js +1 -2
  76. package/lib/components/CarouselNavImageButton/CarouselNavImageButton.js +2 -3
  77. package/lib/components/CarouselNavImageButton/CarouselNavImageButton.js.map +1 -1
  78. package/lib/components/CarouselNavImageButton/CarouselNavImageButton.types.js.map +1 -1
  79. package/lib/components/CarouselNavImageButton/index.js.map +1 -1
  80. package/lib/components/CarouselNavImageButton/renderCarouselNavImageButton.js.map +1 -1
  81. package/lib/components/CarouselNavImageButton/useCarouselNavImageButton.js.map +1 -1
  82. package/lib/components/CarouselNavImageButton/useCarouselNavImageButtonStyles.styles.js +1 -2
  83. package/lib/components/CarouselSlider/CarouselSlider.js +2 -3
  84. package/lib/components/CarouselSlider/CarouselSlider.js.map +1 -1
  85. package/lib/components/CarouselSlider/CarouselSlider.types.js.map +1 -1
  86. package/lib/components/CarouselSlider/CarouselSliderContext.js.map +1 -1
  87. package/lib/components/CarouselSlider/index.js.map +1 -1
  88. package/lib/components/CarouselSlider/renderCarouselSlider.js.map +1 -1
  89. package/lib/components/CarouselSlider/useCarouselSlider.js.map +1 -1
  90. package/lib/components/CarouselSlider/useCarouselSliderStyles.styles.js +1 -2
  91. package/lib/components/CarouselViewport/CarouselViewport.js +16 -0
  92. package/lib/components/CarouselViewport/CarouselViewport.js.map +1 -0
  93. package/lib/components/CarouselViewport/CarouselViewport.types.js +3 -0
  94. package/lib/components/CarouselViewport/CarouselViewport.types.js.map +1 -0
  95. package/lib/components/CarouselViewport/index.js +5 -0
  96. package/lib/components/CarouselViewport/index.js.map +1 -0
  97. package/lib/components/CarouselViewport/renderCarouselViewport.js +12 -0
  98. package/lib/components/CarouselViewport/renderCarouselViewport.js.map +1 -0
  99. package/lib/components/CarouselViewport/useCarouselViewport.js +28 -0
  100. package/lib/components/CarouselViewport/useCarouselViewport.js.map +1 -0
  101. package/lib/components/CarouselViewport/useCarouselViewportStyles.styles.js +25 -0
  102. package/lib/components/CarouselViewport/useCarouselViewportStyles.styles.js.map +1 -0
  103. package/lib/components/pointerEvents.js +58 -0
  104. package/lib/components/pointerEvents.js.map +1 -0
  105. package/lib/components/useEmblaCarousel.js +30 -11
  106. package/lib/components/useEmblaCarousel.js.map +1 -1
  107. package/lib/index.js +1 -0
  108. package/lib/index.js.map +1 -1
  109. package/lib-commonjs/Carousel.js.map +1 -1
  110. package/lib-commonjs/CarouselAutoplayButton.js.map +1 -1
  111. package/lib-commonjs/CarouselButton.js.map +1 -1
  112. package/lib-commonjs/CarouselCard.js.map +1 -1
  113. package/lib-commonjs/CarouselContext.js.map +1 -1
  114. package/lib-commonjs/CarouselNav.js.map +1 -1
  115. package/lib-commonjs/CarouselNavButton.js.map +1 -1
  116. package/lib-commonjs/CarouselNavContainer.js.map +1 -1
  117. package/lib-commonjs/CarouselNavImageButton.js.map +1 -1
  118. package/lib-commonjs/CarouselSlider.js.map +1 -1
  119. package/lib-commonjs/CarouselViewport.js +6 -0
  120. package/lib-commonjs/CarouselViewport.js.map +1 -0
  121. package/lib-commonjs/components/Carousel/Carousel.js +2 -3
  122. package/lib-commonjs/components/Carousel/Carousel.js.map +1 -1
  123. package/lib-commonjs/components/Carousel/Carousel.types.js.map +1 -1
  124. package/lib-commonjs/components/Carousel/index.js.map +1 -1
  125. package/lib-commonjs/components/Carousel/renderCarousel.js.map +1 -1
  126. package/lib-commonjs/components/Carousel/useCarousel.js +7 -5
  127. package/lib-commonjs/components/Carousel/useCarousel.js.map +1 -1
  128. package/lib-commonjs/components/Carousel/useCarouselContextValues.js +5 -3
  129. package/lib-commonjs/components/Carousel/useCarouselContextValues.js.map +1 -1
  130. package/lib-commonjs/components/Carousel/useCarouselStyles.styles.js +3 -12
  131. package/lib-commonjs/components/Carousel/useCarouselStyles.styles.js.map +1 -1
  132. package/lib-commonjs/components/CarouselAutoplayButton/CarouselAutoplayButton.js +2 -3
  133. package/lib-commonjs/components/CarouselAutoplayButton/CarouselAutoplayButton.js.map +1 -1
  134. package/lib-commonjs/components/CarouselAutoplayButton/CarouselAutoplayButton.types.js.map +1 -1
  135. package/lib-commonjs/components/CarouselAutoplayButton/index.js.map +1 -1
  136. package/lib-commonjs/components/CarouselAutoplayButton/renderCarouselAutoplayButton.js.map +1 -1
  137. package/lib-commonjs/components/CarouselAutoplayButton/useCarouselAutoplayButton.js.map +1 -1
  138. package/lib-commonjs/components/CarouselAutoplayButton/useCarouselAutoplayButtonStyles.styles.js +1 -1
  139. package/lib-commonjs/components/CarouselButton/CarouselButton.js +2 -3
  140. package/lib-commonjs/components/CarouselButton/CarouselButton.js.map +1 -1
  141. package/lib-commonjs/components/CarouselButton/CarouselButton.types.js.map +1 -1
  142. package/lib-commonjs/components/CarouselButton/index.js.map +1 -1
  143. package/lib-commonjs/components/CarouselButton/renderCarouselButton.js.map +1 -1
  144. package/lib-commonjs/components/CarouselButton/useCarouselButton.js.map +1 -1
  145. package/lib-commonjs/components/CarouselButton/useCarouselButtonStyles.styles.js +1 -1
  146. package/lib-commonjs/components/CarouselCard/CarouselCard.js +2 -3
  147. package/lib-commonjs/components/CarouselCard/CarouselCard.js.map +1 -1
  148. package/lib-commonjs/components/CarouselCard/CarouselCard.types.js.map +1 -1
  149. package/lib-commonjs/components/CarouselCard/index.js.map +1 -1
  150. package/lib-commonjs/components/CarouselCard/renderCarouselCard.js.map +1 -1
  151. package/lib-commonjs/components/CarouselCard/useCarouselCard.js +10 -8
  152. package/lib-commonjs/components/CarouselCard/useCarouselCard.js.map +1 -1
  153. package/lib-commonjs/components/CarouselCard/useCarouselCardStyles.styles.js +1 -1
  154. package/lib-commonjs/components/CarouselContext.js +2 -1
  155. package/lib-commonjs/components/CarouselContext.js.map +1 -1
  156. package/lib-commonjs/components/CarouselContext.types.js.map +1 -1
  157. package/lib-commonjs/components/CarouselNav/CarouselNav.js +2 -3
  158. package/lib-commonjs/components/CarouselNav/CarouselNav.js.map +1 -1
  159. package/lib-commonjs/components/CarouselNav/CarouselNav.types.js.map +1 -1
  160. package/lib-commonjs/components/CarouselNav/CarouselNavContext.js.map +1 -1
  161. package/lib-commonjs/components/CarouselNav/CarouselNavIndexContext.js.map +1 -1
  162. package/lib-commonjs/components/CarouselNav/index.js.map +1 -1
  163. package/lib-commonjs/components/CarouselNav/renderCarouselNav.js.map +1 -1
  164. package/lib-commonjs/components/CarouselNav/useCarouselNav.js.map +1 -1
  165. package/lib-commonjs/components/CarouselNav/useCarouselNavStyles.styles.js +1 -1
  166. package/lib-commonjs/components/CarouselNavButton/CarouselNavButton.js +2 -3
  167. package/lib-commonjs/components/CarouselNavButton/CarouselNavButton.js.map +1 -1
  168. package/lib-commonjs/components/CarouselNavButton/CarouselNavButton.types.js.map +1 -1
  169. package/lib-commonjs/components/CarouselNavButton/index.js.map +1 -1
  170. package/lib-commonjs/components/CarouselNavButton/renderCarouselNavButton.js.map +1 -1
  171. package/lib-commonjs/components/CarouselNavButton/useCarouselNavButton.js.map +1 -1
  172. package/lib-commonjs/components/CarouselNavButton/useCarouselNavButtonStyles.styles.js +1 -1
  173. package/lib-commonjs/components/CarouselNavContainer/CarouselNavContainer.js +2 -8
  174. package/lib-commonjs/components/CarouselNavContainer/CarouselNavContainer.js.map +1 -1
  175. package/lib-commonjs/components/CarouselNavContainer/CarouselNavContainer.types.js.map +1 -1
  176. package/lib-commonjs/components/CarouselNavContainer/index.js.map +1 -1
  177. package/lib-commonjs/components/CarouselNavContainer/renderCarouselNavContainer.js.map +1 -1
  178. package/lib-commonjs/components/CarouselNavContainer/useCarouselNavContainer.js.map +1 -1
  179. package/lib-commonjs/components/CarouselNavContainer/useCarouselNavContainerStyles.styles.js +1 -1
  180. package/lib-commonjs/components/CarouselNavImageButton/CarouselNavImageButton.js +2 -3
  181. package/lib-commonjs/components/CarouselNavImageButton/CarouselNavImageButton.js.map +1 -1
  182. package/lib-commonjs/components/CarouselNavImageButton/CarouselNavImageButton.types.js.map +1 -1
  183. package/lib-commonjs/components/CarouselNavImageButton/index.js.map +1 -1
  184. package/lib-commonjs/components/CarouselNavImageButton/renderCarouselNavImageButton.js.map +1 -1
  185. package/lib-commonjs/components/CarouselNavImageButton/useCarouselNavImageButton.js.map +1 -1
  186. package/lib-commonjs/components/CarouselNavImageButton/useCarouselNavImageButtonStyles.styles.js +1 -1
  187. package/lib-commonjs/components/CarouselSlider/CarouselSlider.js +2 -3
  188. package/lib-commonjs/components/CarouselSlider/CarouselSlider.js.map +1 -1
  189. package/lib-commonjs/components/CarouselSlider/CarouselSlider.types.js.map +1 -1
  190. package/lib-commonjs/components/CarouselSlider/CarouselSliderContext.js.map +1 -1
  191. package/lib-commonjs/components/CarouselSlider/index.js.map +1 -1
  192. package/lib-commonjs/components/CarouselSlider/renderCarouselSlider.js.map +1 -1
  193. package/lib-commonjs/components/CarouselSlider/useCarouselSlider.js.map +1 -1
  194. package/lib-commonjs/components/CarouselSlider/useCarouselSliderStyles.styles.js +1 -1
  195. package/lib-commonjs/components/CarouselViewport/CarouselViewport.js +25 -0
  196. package/lib-commonjs/components/CarouselViewport/CarouselViewport.js.map +1 -0
  197. package/lib-commonjs/components/CarouselViewport/CarouselViewport.types.js +6 -0
  198. package/lib-commonjs/components/CarouselViewport/CarouselViewport.types.js.map +1 -0
  199. package/lib-commonjs/components/CarouselViewport/index.js +10 -0
  200. package/lib-commonjs/components/CarouselViewport/index.js.map +1 -0
  201. package/lib-commonjs/components/CarouselViewport/renderCarouselViewport.js +20 -0
  202. package/lib-commonjs/components/CarouselViewport/renderCarouselViewport.js.map +1 -0
  203. package/lib-commonjs/components/CarouselViewport/useCarouselViewport.js +31 -0
  204. package/lib-commonjs/components/CarouselViewport/useCarouselViewport.js.map +1 -0
  205. package/lib-commonjs/components/CarouselViewport/useCarouselViewportStyles.styles.js +41 -0
  206. package/lib-commonjs/components/CarouselViewport/useCarouselViewportStyles.styles.js.map +1 -0
  207. package/lib-commonjs/components/pointerEvents.js +68 -0
  208. package/lib-commonjs/components/pointerEvents.js.map +1 -0
  209. package/lib-commonjs/components/useEmblaCarousel.js +29 -10
  210. package/lib-commonjs/components/useEmblaCarousel.js.map +1 -1
  211. package/lib-commonjs/index.js +16 -0
  212. package/lib-commonjs/index.js.map +1 -1
  213. 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 Tue, 15 Oct 2024 17:13:31 GMT and should not be manually modified.
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:13:31 GMT
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 | React_2.MouseEvent<HTMLButtonElement | HTMLAnchorElement>> & {
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 { }
@@ -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"}
@@ -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"}
@@ -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 // 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"}
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 mergedRefs = useMergedRefs(ref, containerRef);
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: mergedRefs,
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: mergedRefs,
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 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","motion","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,EACZC,SAAS,OAAO,EACjB,GAAGT;IAEJ,MAAM,EAAEU,GAAG,EAAE,GAAGpB;IAChB,MAAM,EAAEqB,WAAW,EAAEC,WAAW,EAAEC,YAAY,EAAEC,kBAAkB,EAAEC,cAAc,EAAEC,aAAa,EAAE,GACjGnB,iBAAiB;QACfK;QACAe,WAAWP;QACXQ,MAAMf;QACNgB,gBAAgBd;QAChBe,oBAAoBpB,MAAMoB,kBAAkB;QAC5CT,aAAaX,MAAMW,WAAW;QAC9BU,WAAWf;QACXgB,eAAef,aAAa,QAAQ;QACpCE;IACF;IAEF,MAAMc,sBAAmE9B,iBAAiB,CAAC+B,OAAOC,SAASC;QACzG,MAAMC,aAAaf,YAAYgB,eAAe,CAACH,SAASC;QACxDtB,gCAAAA,0CAAAA,oBAAsBoB,OAAO;YAAEA;YAAOK,MAAM;YAASC,OAAOH;QAAW;QAEvE,OAAOA;IACT;IAEA,MAAMI,oBAA+DtC,iBAAiB,CAAC+B,OAAOM,OAAOJ;QACnGd,YAAYoB,aAAa,CAACF,OAAOJ;QAEjCtB,gCAAAA,0CAAAA,oBAAsBoB,OAAO;YAAEA;YAAOK,MAAM;YAASC;QAAM;IAC7D;IAEA,MAAMG,wBAAuExC,iBAAiB,CAAC+B,OAAOP;QACpG,MAAMiB,gBAAgBtB,YAAYuB,iBAAiB,CAAClB;QACpDb,gCAAAA,0CAAAA,oBAAsBoB,OAAO;YAAEA;YAAOK,MAAM;YAASC,OAAOI;QAAc;QAE1E,OAAOA;IACT;IAEA,MAAME,aAAazC,cAAcM,KAAKY;IAEtC,4BAA4B;IAC5B,MAAMwB,sBAAsBzC,MAAM0C,MAAM,CAAS;IACjD,MAAMC,iBAAiB3C,MAAM0C,MAAM,CAAS;IAC5C,MAAME,cAAc5C,MAAM0C,MAAM,CAAa,EAAE;IAE/C,MAAM,EAAEG,QAAQ,EAAE,GAAG3C;IAErB,MAAM4C,qBAAqBjD,iBAAiB;QAC1C,IAAI8C,eAAeI,OAAO,IAAI,KAAK,CAACnC,cAAc;YAChD,+CAA+C;YAC/C;QACF;QAEA,MAAMoC,mBAAmBpC,aAAaG,aAAa4B,eAAeI,OAAO,EAAEH,YAAYG,OAAO;QAE9F,IAAIC,qBAAqBP,oBAAoBM,OAAO,EAAE;YACpDN,oBAAoBM,OAAO,GAAGC;YAC9BH,SAASG,kBAAkB;gBAAEC,QAAQ;YAAK;QAC5C;IACF;IAEAnD,0BAA0B;QACxB,oDAAoD;QACpD,OAAOoB,mBAAmBgC,CAAAA;YACxB,IAAIP,eAAeI,OAAO,IAAI,KAAKG,KAAKC,aAAa,GAAG,KAAKvC,cAAc;gBACzE,MAAMoC,mBAAmBpC,aAAasC,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;QAAoBlC;KAAa;IAEzDd,0BAA0B;QACxBgD;IACF,GAAG;QAAC/B;QAAa+B;KAAmB;IAEpC,OAAO;QACLO,YAAY;YACVC,MAAM;QACR;QACAA,MAAM1D,KAAK2D,MAAM,CACf5D,yBAAyB,OAAO;YAC9BU,KAAKmC;YACLgB,MAAM;YACN,GAAGpD,KAAK;QACV,IACA;YAAEqD,aAAa;QAAM;QAGvB1C;QACAR;QACAU,cAAcuB;QACdb;QACAU;QACAF;QACAjB;QACAC;QACAC;IACF;AACF"}
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":"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"}
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;","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"}
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
- z8tnut: "fr4fn7s",
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: [".fr4fn7s{padding-top:var(--strokeWidthThick);}", [".f1a3p1vp{overflow:hidden;}", {
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","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":[]}
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
- // 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);
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 // 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"}
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,4 +1,4 @@
1
- import { assertSlots } from '@fluentui/react-utilities';
1
+ import { assertSlots } from '@fluentui/react-utilities';
2
2
  import { renderToggleButton_unstable } from '@fluentui/react-button';
3
3
  /**
4
4
  * Render the final JSX of CarouselAutoplayButton
@@ -1 +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"}
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
- // 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);
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 // 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"}
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"}
@@ -1,4 +1,4 @@
1
- import { assertSlots } from '@fluentui/react-utilities';
1
+ import { assertSlots } from '@fluentui/react-utilities';
2
2
  import { renderButton_unstable } from '@fluentui/react-button';
3
3
  /**
4
4
  * Render the final JSX of CarouselButton