Skip to content

Commit

Permalink
Carousel: Stable Release (#32883)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitch-At-Work authored Oct 7, 2024
1 parent e414490 commit 4da01b9
Show file tree
Hide file tree
Showing 149 changed files with 597 additions and 191 deletions.
6 changes: 3 additions & 3 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,9 @@ packages/react-components/react-icons-compat/stories @microsoft/cxe-red @tomi-ms
packages/react-components/react-tag-picker @microsoft/teams-prg
packages/react-components/react-tag-picker/library @microsoft/teams-prg
packages/react-components/react-tag-picker/stories @microsoft/teams-prg
packages/react-components/react-carousel-preview @microsoft/xc-uxe @microsoft/teams-prg @Mitch-At-Work
packages/react-components/react-carousel-preview/library @microsoft/xc-uxe @microsoft/teams-prg @Mitch-At-Work
packages/react-components/react-carousel-preview/stories @microsoft/xc-uxe @microsoft/teams-prg @Mitch-At-Work
packages/react-components/react-carousel @microsoft/xc-uxe @microsoft/teams-prg @Mitch-At-Work
packages/react-components/react-carousel/library @microsoft/xc-uxe @microsoft/teams-prg @Mitch-At-Work
packages/react-components/react-carousel/stories @microsoft/xc-uxe @microsoft/teams-prg @Mitch-At-Work
packages/react-components/recipes @microsoft/fluentui-react @sopranopillow
packages/react-components/react-motion-components-preview/library @microsoft/teams-prg
packages/react-components/react-motion-components-preview/stories @microsoft/teams-prg
Expand Down
3 changes: 1 addition & 2 deletions apps/public-docsite-v9/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"react-hook-form": "^5.7.2",
"@fluentui/react-nav-preview": "*",
"@fluentui/react-motion-components-preview": "*",
"@fluentui/react-icons-compat": "*",
"@fluentui/react-carousel-preview": "*"
"@fluentui/react-icons-compat": "*"
}
}
3 changes: 2 additions & 1 deletion apps/vr-tests-react-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"@fluentui/react-rating": "*",
"@fluentui/react-search": "*",
"@fluentui/react-teaching-popover": "*",
"@fluentui/react-tag-picker": "*"
"@fluentui/react-tag-picker": "*",
"@fluentui/react-carousel": "*"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "feat: Stable release react-carousel",
"packageName": "@fluentui/react-carousel",
"email": "mifraser@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "feat: Stable release of react-carousel",
"packageName": "@fluentui/react-components",
"email": "mifraser@microsoft.com",
"dependentChangeType": "patch"
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@
"doctrine": "3.0.0",
"dotparser": "1.1.1",
"ejs": "3.1.10",
"embla-carousel": "8.1.8",
"embla-carousel-autoplay": "8.1.8",
"embla-carousel": "8.3.0",
"embla-carousel-autoplay": "8.3.0",
"enquirer": "2.3.6",
"enzyme": "3.10.0",
"enzyme-to-json": "3.6.2",
Expand Down

This file was deleted.

106 changes: 0 additions & 106 deletions packages/react-components/react-carousel-preview/library/docs/Spec.md

This file was deleted.

17 changes: 0 additions & 17 deletions packages/react-components/react-carousel-preview/stories/README.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This log was last generated on Thu, 26 Sep 2024 14:15:27 GMT and should not be m

## [0.6.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-carousel-preview_v0.6.0)

Thu, 26 Sep 2024 14:15:27 GMT
Thu, 26 Sep 2024 14:15:27 GMT
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-carousel-preview_v0.5.0..@fluentui/react-carousel-preview_v0.6.0)

### Minor changes
Expand All @@ -16,7 +16,7 @@ Thu, 26 Sep 2024 14:15:27 GMT

## [0.5.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-carousel-preview_v0.5.0)

Mon, 23 Sep 2024 12:40:12 GMT
Mon, 23 Sep 2024 12:40:12 GMT
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-carousel-preview_v0.4.0..@fluentui/react-carousel-preview_v0.5.0)

### Minor changes
Expand All @@ -33,7 +33,7 @@ Mon, 23 Sep 2024 12:40:12 GMT

## [0.4.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-carousel-preview_v0.4.0)

Fri, 13 Sep 2024 00:49:24 GMT
Fri, 13 Sep 2024 00:49:24 GMT
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-carousel-preview_v0.3.0..@fluentui/react-carousel-preview_v0.4.0)

### Minor changes
Expand All @@ -46,7 +46,7 @@ Fri, 13 Sep 2024 00:49:24 GMT

## [0.3.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-carousel-preview_v0.3.0)

Tue, 10 Sep 2024 10:19:05 GMT
Tue, 10 Sep 2024 10:19:05 GMT
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-carousel-preview_v0.2.2..@fluentui/react-carousel-preview_v0.3.0)

### Minor changes
Expand All @@ -67,7 +67,7 @@ Tue, 10 Sep 2024 10:19:05 GMT

## [0.2.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-carousel-preview_v0.2.2)

Thu, 15 Aug 2024 13:49:46 GMT
Thu, 15 Aug 2024 13:49:46 GMT
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-carousel-preview_v0.2.1..@fluentui/react-carousel-preview_v0.2.2)

### Patches
Expand All @@ -78,7 +78,7 @@ Thu, 15 Aug 2024 13:49:46 GMT

## [0.2.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-carousel-preview_v0.2.1)

Thu, 15 Aug 2024 08:22:08 GMT
Thu, 15 Aug 2024 08:22:08 GMT
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-carousel-preview_v0.2.0..@fluentui/react-carousel-preview_v0.2.1)

### Patches
Expand All @@ -90,7 +90,7 @@ Thu, 15 Aug 2024 08:22:08 GMT

## [0.2.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-carousel-preview_v0.2.0)

Mon, 05 Aug 2024 22:33:01 GMT
Mon, 05 Aug 2024 22:33:01 GMT
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-carousel-preview_v0.1.0..@fluentui/react-carousel-preview_v0.2.0)

### Minor changes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@fluentui/react-carousel-preview
@fluentui/react-carousel

Copyright (c) Microsoft Corporation

Expand Down
33 changes: 33 additions & 0 deletions packages/react-components/react-carousel/library/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# @fluentui/react-carousel

**React Carousel components for [Fluent UI React](https://react.fluentui.dev/)**

A Carousel is a sliding viewport that enables a list of tab panels to be hidden offscreen while still remaining accessible via rotating controls or keyboard interactions.

For full screen banners, hidden cards will be set to inert and can be accessed via the underlying nav controls (prev/next/pagination), while smaller responsive CarouselCards can be explored with keyboard navigation (left/right arrow keys) and group focus (Enter/Esc) to void lengthy tabIndex sequences.

The React Carousel uses direct DOM manipulation to ensure that state can be updated without driving a react render cycle of the CarouselCards themselves, users may subscribe to visibility event callbacks or activeIndex supplied via context for updating local state on carousel movement.

A CarouselAnnouncer class is provided that will announce page changes when context is updated for accessibility users.

## Sample Code

```jsx
<Carousel groupSize={1} circular>
<CarouselSlider>
{Cards.map((card, index) => (
<CarouselCard key={`image-${index}`} index={index}>
Card {index + 1}
</CarouselCard>
))}
</CarouselSlider>
<CarouselNavContainer next={{ 'aria-label': 'go to next' }} prev={{ 'aria-label': 'go to prev' }}>
<CarouselNav>{index => <CarouselNavButton aria-label={`Carousel Nav Button ${index}`} />}</CarouselNav>
</CarouselNavContainer>
<CarouselAnnouncer>
{(currentIndex, totalSlides, _slideGroupList) => {
return `Slide ${currentIndex + 1} of ${totalSlides}`;
}}
</CarouselAnnouncer>
</Carousel>
```
46 changes: 46 additions & 0 deletions packages/react-components/react-carousel/library/docs/Migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Carousel Migration Guide

## Migration from react-northstar

The northstar carousel utilized a single wrapper with data props, in v9, composable Carousel pieces can be used to fit together, the number, order and styles of CarouselCards within a CarouselSlider is what will drive the majority of Carousel logic, stored and accessed via context provided in the Carousel wrapper.

### Prop mapping

- `items` prop => CarouselCard elements
- `navigation` on the control => CarouselNav/CarouselNavButton/CarouselButton are utilized independently for carousel control, this can also be overwritten externally via the controlled index props - a CarouselNavContainer is provided to simplify this process.

### Example

#### northstar

```jsx
<Carousel
navigation={{
items: carouselItems.map((item, index) => ({
key: item.id,
})),
}}
items={carouselItems}
/>
```

#### v9

```jsx
<Carousel>
<CarouselSlider>
{Cards.map((_cardProps, index) => (
<CarouselCard>
Card {index + 1}
</BannerCard>
))}
</CarouselSlider>
<CarouselNavContainer>
<CarouselNav>{index => <CarouselNavButton/>}</CarouselNav>
</CarouselNavContainer>
</Carousel>
```

### Aria props

Aria props can be directly passed to their intended elements, or to sub-components via the slot props, a similar pattern to react-northstar aria should be implemented
Loading

0 comments on commit 4da01b9

Please sign in to comment.