Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
f4ef66f
add chevron icons
silviuaavram Sep 26, 2019
64f46cd
add Carousel component
silviuaavram Sep 26, 2019
4349207
add Carousel example
silviuaavram Sep 26, 2019
2e1de27
add buttons and styles
silviuaavram Sep 27, 2019
8e71ed0
add state and css transition
silviuaavram Sep 27, 2019
7e50cdf
css perf and buttons hide
silviuaavram Sep 27, 2019
a7924e8
add Item and Content to Carousel
silviuaavram Oct 1, 2019
3fa6b65
rename content prop to slide
silviuaavram Oct 1, 2019
54d8fd3
rename content to slide
silviuaavram Oct 1, 2019
1d4e6d8
add navigation
silviuaavram Oct 1, 2019
38ddb41
add keys to example items
silviuaavram Oct 1, 2019
fce955e
add pagination example
silviuaavram Oct 1, 2019
2acbc7c
weird cast to pass build
silviuaavram Oct 2, 2019
37e3f61
behaviors, focus handle and arrows
silviuaavram Oct 2, 2019
1867df0
fix set focus on keys
silviuaavram Oct 2, 2019
1449527
add alt attributes to slides in examples
silviuaavram Oct 2, 2019
a6b37e8
add a couple of comments
silviuaavram Oct 2, 2019
e080dd8
behavior changes after rebase
silviuaavram Oct 4, 2019
3cf3a33
remove previous behavior files
silviuaavram Oct 4, 2019
747b629
roles and aria-live
silviuaavram Oct 7, 2019
1f75c21
buttons are not tabbable anymore
silviuaavram Oct 7, 2019
53b1c03
fix aria announcements
silviuaavram Oct 7, 2019
279e2a4
focus container after tab click
silviuaavram Oct 7, 2019
060708b
add aria-label to tablist
silviuaavram Oct 7, 2019
d383144
announce position and alt attribute
silviuaavram Oct 7, 2019
8656881
general adjustments
silviuaavram Oct 7, 2019
b868f19
remove status role from message div
silviuaavram Oct 7, 2019
785affc
make buttons tabbable if not tabList
silviuaavram Oct 8, 2019
67bd362
add cyclical prop and example
silviuaavram Oct 8, 2019
c7b69d7
fix focus going on body in specific case
silviuaavram Oct 8, 2019
eff77be
fix navigation issue with last item
silviuaavram Oct 9, 2019
359b902
add roledescription and tab labels
silviuaavram Oct 9, 2019
d2c9ace
fix another issue with navigation
silviuaavram Oct 9, 2019
d700974
add aria-hidden to buttons when tablist
silviuaavram Oct 9, 2019
eb3509b
remove not needed anymore test
silviuaavram Oct 9, 2019
2ead224
remove aria-atomic=true
silviuaavram Oct 9, 2019
963feb8
add position cleanup
silviuaavram Oct 14, 2019
94c7deb
add aria-controls to tabs
silviuaavram Oct 15, 2019
0977bb6
move roledescription to slides container
silviuaavram Oct 15, 2019
68c57a3
add aria-labelledby to itemsContainer
silviuaavram Oct 16, 2019
629068e
fix ariaLive on/off cases
silviuaavram Oct 16, 2019
18ff97f
Merge branch 'master' into feat/carousel-component
silviuaavram Oct 16, 2019
d8121a5
revert aria-labelledby
silviuaavram Oct 16, 2019
6457e56
Merge branch 'feat/carousel-component' of https://github.com/stardust…
silviuaavram Oct 16, 2019
b7167d8
test with individual focus
silviuaavram Oct 18, 2019
5121e46
individual focus on slides
silviuaavram Oct 18, 2019
fbf01b0
fix cyclical navigation
silviuaavram Oct 18, 2019
ab425fd
Merge branch 'master' into feat/carousel-component
silviuaavram Oct 21, 2019
2fc3a09
set arialive on when focus is on buttons
silviuaavram Oct 21, 2019
4e7221c
fix behavior tests
silviuaavram Oct 21, 2019
791e6df
rename buttons to paddles
silviuaavram Oct 21, 2019
6192f88
add more props for API
silviuaavram Oct 21, 2019
147a626
remove previous ariaLive logic
silviuaavram Oct 21, 2019
6f16b27
Merge branch 'master' into feat/carousel-component
silviuaavram Oct 25, 2019
84b0063
remove slide and use content
silviuaavram Oct 29, 2019
48c976e
progress in implementing navigation
silviuaavram Oct 30, 2019
5e5bc42
add props for styles
silviuaavram Oct 31, 2019
cd4c033
behavior and styles
silviuaavram Oct 31, 2019
1a9c680
merge variables in navigation item
silviuaavram Oct 31, 2019
ee95fe2
add perform click to navi item
silviuaavram Oct 31, 2019
b865080
Merge branch 'master' into feat/carousel-component
silviuaavram Oct 31, 2019
046d1a3
some renames
silviuaavram Nov 1, 2019
3fbad42
removed styles that are not needed
silviuaavram Nov 1, 2019
cc5cc87
code improvements and tests
silviuaavram Nov 1, 2019
ea79855
Merge branch 'master' into feat/carousel-component
silviuaavram Nov 7, 2019
52c1c21
code improvements Carousel
silviuaavram Nov 7, 2019
d639743
more code improvements
silviuaavram Nov 7, 2019
1593121
add more tests
silviuaavram Nov 7, 2019
bd32304
fix keys
silviuaavram Nov 8, 2019
3a01d59
Merge branch 'master' into feat/carousel-component
silviuaavram Nov 8, 2019
ef00f5a
changelog
silviuaavram Nov 8, 2019
a1fac68
Merge branch 'master' into feat/carousel-component
silviuaavram Nov 11, 2019
31394c1
adapt defaultProps to master
silviuaavram Nov 11, 2019
f6c1d1b
more defaultProps change
silviuaavram Nov 11, 2019
6135fee
test improvements
silviuaavram Nov 11, 2019
e57c4fc
add 2 more tests
silviuaavram Nov 11, 2019
2b0d4ab
tests for item
silviuaavram Nov 11, 2019
174031f
Merge branch 'master' into feat/carousel-component
silviuaavram Nov 12, 2019
a3f9730
tests for ids
silviuaavram Nov 12, 2019
0dd645c
remove navi item wrapper and add more tests
silviuaavram Nov 12, 2019
9aa9058
Merge branch 'master' into feat/carousel-component
silviuaavram Nov 13, 2019
fab41f7
Merge branch 'feat/carousel-component' of https://github.com/stardust…
silviuaavram Nov 13, 2019
46129d5
tab behavior applies perform click on root
silviuaavram Nov 13, 2019
bb84fdf
navi item is li instead on achor
silviuaavram Nov 13, 2019
4feaed4
cleanup styles after wrapper removal
silviuaavram Nov 13, 2019
481a1cf
Merge branch 'master' into feat/carousel-component
silviuaavram Nov 15, 2019
c3afa1e
adress code review
silviuaavram Nov 18, 2019
a02e5db
Merge branch 'feat/carousel-component' of https://github.com/stardust…
silviuaavram Nov 18, 2019
723e4e2
fix accessibility
silviuaavram Nov 18, 2019
2a28b31
fix import
silviuaavram Nov 18, 2019
5d429c8
Merge branch 'master' into feat/carousel-component
silviuaavram Nov 19, 2019
6d6508b
Merge branch 'feat/carousel-component' of https://github.com/stardust…
silviuaavram Nov 19, 2019
bb1736d
properly add icons
silviuaavram Nov 19, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Add bounce animation to button clicks in Teams theme @notandrew ([#1724](https://github.com/stardust-ui/react/pull/1724))
- Update Silver color scheme, adding `foregroundHover`, `foregroundPressed` and `background` definitions @pompomon ([#2078](https://github.com/microsoft/fluent-ui-react/pull/2078))
- Expanding experimental accessibility schema to more components @mshoho ([#2052](https://github.com/stardust-ui/react/pull/2052))
- Add base `Carousel` component @silviuavram ([#1979](https://github.com/microsoft/fluent-ui-react/pull/1979))

### Documentation
- Add usage example for `Tooltip` on disabled elements @mnajdova ([#2091](https://github.com/microsoft/fluent-ui-react/pull/2091))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const unsupportedComponents = [
'Accordion',
'Animation',
'Box',
'Carousel',
'Chat',
'Dropdown',
'Flex',
Expand Down
49 changes: 49 additions & 0 deletions docs/src/examples/components/Carousel/Types/CarouselExample.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import * as React from 'react'
import { Carousel, Image } from '@stardust-ui/react'

const imageAltTags = {
ade: 'Portrait of Ade',
elliot: 'Portrait of Elliot',
kristy: 'Portrait of Kristy',
nan: 'Portrait of Nan',
}
const carouselItems = [
{
key: 'ade',
id: 'ade',
content: <Image src="public/images/avatar/large/ade.jpg" fluid alt={imageAltTags.ade} />,
},
{
key: 'elliot',
id: 'elliot',
content: <Image src="public/images/avatar/large/elliot.jpg" fluid alt={imageAltTags.elliot} />,
},
{
key: 'kristy',
id: 'kristy',
content: <Image src="public/images/avatar/large/kristy.png" fluid alt={imageAltTags.kristy} />,
},
{
key: 'nan',
id: 'nan',
content: <Image src="public/images/avatar/large/nan.jpg" fluid alt={imageAltTags.nan} />,
},
]

const CarouselExample = () => (
<Carousel
ariaRoleDescription="carousel"
navigation={{
'aria-label': 'people portraits',
items: carouselItems.map((item, index) => ({
key: item.id,
'aria-label': imageAltTags[item.id],
'aria-controls': item.id,
})),
}}
items={carouselItems}
getItemPositionText={(index: number, size: number) => `${index + 1} of ${size}`}
/>
)

export default CarouselExample
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import * as React from 'react'
import { Carousel, Image } from '@stardust-ui/react'

const carouselItems = [
{
key: 'ade',
content: <Image src="public/images/avatar/large/ade.jpg" fluid alt={'Portrait of Ade'} />,
},
{
key: 'elliot',
content: <Image src="public/images/avatar/large/elliot.jpg" fluid alt={'Portrait of Elliot'} />,
},
{
key: 'kristy',
content: <Image src="public/images/avatar/large/kristy.png" fluid alt={'Portrait of Kristy'} />,
},
{
key: 'nan',
content: <Image src="public/images/avatar/large/nan.jpg" fluid alt={'Portrait of Nan'} />,
},
]

const CarouselExample = () => (
<Carousel
ariaRoleDescription="carousel"
items={carouselItems}
paddleNext={{ 'aria-label': 'go to next slide' }}
paddlePrevious={{ 'aria-label': 'go to previous slide' }}
getItemPositionText={(index: number, size: number) => `${index + 1} of ${size}`}
/>
)

export default CarouselExample
21 changes: 21 additions & 0 deletions docs/src/examples/components/Carousel/Types/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as React from 'react'

import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'

const Types = () => (
<ExampleSection title="Types">
<ComponentExample
title="Carousel"
description="A carousel can display images."
examplePath="components/Carousel/Types/CarouselExample"
/>
<ComponentExample
title="Carousel with Pagination"
description="A carousel can have pagination instead of navigation."
examplePath="components/Carousel/Types/CarouselPaginationExample"
/>
</ExampleSection>
)

export default Types
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import * as React from 'react'
import { Carousel, Image } from '@stardust-ui/react'

const imageAltTags = {
ade: 'Portrait of Ade',
elliot: 'Portrait of Elliot',
kristy: 'Portrait of Kristy',
nan: 'Portrait of Nan',
}
const carouselItems = [
{
key: 'ade',
id: 'ade',
content: <Image src="public/images/avatar/large/ade.jpg" fluid alt={imageAltTags.ade} />,
},
{
key: 'elliot',
id: 'elliot',
content: <Image src="public/images/avatar/large/elliot.jpg" fluid alt={imageAltTags.elliot} />,
},
{
key: 'kristy',
id: 'kristy',
content: <Image src="public/images/avatar/large/kristy.png" fluid alt={imageAltTags.kristy} />,
},
{
key: 'nan',
id: 'nan',
content: <Image src="public/images/avatar/large/nan.jpg" fluid alt={imageAltTags.nan} />,
},
]

const CarouselExample = () => (
<Carousel
circular
ariaRoleDescription="carousel"
navigation={{
'aria-label': 'people portraits',
items: carouselItems.map((item, index) => ({
key: index,
'aria-controls': item.id,
'aria-label': imageAltTags[item.id],
})),
}}
items={carouselItems}
getItemPositionText={(index: number, size: number) => `${index + 1} of ${size}`}
/>
)

export default CarouselExample
15 changes: 15 additions & 0 deletions docs/src/examples/components/Carousel/Variations/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as React from 'react'
import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'

const Variations = () => (
<ExampleSection title="Variations">
<ComponentExample
title="Circular"
description="A Carousel's items navigation can be circular."
examplePath="components/Carousel/Variations/CarouselCircularExample"
/>
</ExampleSection>
)

export default Variations
13 changes: 13 additions & 0 deletions docs/src/examples/components/Carousel/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as React from 'react'

import Types from './Types'
import Variations from './Variations'

const CarouselExamples = () => (
<>
<Types />
<Variations />
</>
)

export default CarouselExamples
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { Accessibility } from '../../types'
import * as keyboardKey from 'keyboard-key'

/**
* @specification
* Adds attribute 'role=region' to 'root' slot.
* Adds attribute 'aria-live=polite' to 'itemsContainerWrapper' slot if 'ariaLiveOn' property is true. Sets the attribute to 'off' otherwise.
* Adds attribute 'aria-hidden=true' to 'paddleNext' slot if 'navigation' property is true. Does not set the attribute otherwise.
* Adds attribute 'aria-hidden=true' to 'paddlePrevious' slot if 'navigation' property is true. Does not set the attribute otherwise.
* Adds attribute 'tabIndex=-1' to 'paddlePrevious' slot if 'navigation' property is true. Does not set the attribute otherwise.
* Adds attribute 'tabIndex=-1' to 'paddlePrevious' slot if 'navigation' property is true. Does not set the attribute otherwise.
* Triggers 'showNextSlideByKeyboardNavigation' action with 'ArrowRight' on 'itemsContainer'.
* Triggers 'showPreviousSlideByKeyboardNavigation' action with 'ArrowLeft' on 'itemsContainer'.
* Triggers 'showNextSlideByPaddlePress' action with 'Enter' or 'Spacebar' on 'paddleNext'.
* Triggers 'showPreviousSlideByPaddlePress' action with 'Enter' or 'Spacebar' on 'paddlePrevious'.
*/
const carouselBehavior: Accessibility<CarouselBehaviorProps> = props => ({
attributes: {
root: {
role: 'region',
},
itemsContainerWrapper: {
'aria-live': props.ariaLiveOn ? 'polite' : 'off',
},

paddleNext: {
...(props.navigation && {
tabIndex: -1,
'aria-hidden': 'true',
}),
},
paddlePrevious: {
...(props.navigation && {
tabIndex: -1,
'aria-hidden': 'true',
}),
},
},

keyActions: {
itemsContainer: {
showNextSlideByKeyboardNavigation: {
keyCombinations: [{ keyCode: keyboardKey.ArrowRight }],
},
showPreviousSlideByKeyboardNavigation: {
keyCombinations: [{ keyCode: keyboardKey.ArrowLeft }],
},
},
paddleNext: {
showNextSlideByPaddlePress: {
keyCombinations: [{ keyCode: keyboardKey.Enter }, { keyCode: keyboardKey.Spacebar }],
},
},
paddlePrevious: {
showPreviousSlideByPaddlePress: {
keyCombinations: [{ keyCode: keyboardKey.Enter }, { keyCode: keyboardKey.Spacebar }],
},
},
},
})

export type CarouselBehaviorProps = {
/** Element type. */
navigation: Object | Object[]
ariaLiveOn: boolean
}

export default carouselBehavior
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Accessibility } from '../../types'

/**
* @specification
* Adds attribute 'role=tabpanel' to 'root' slot.
* Adds attribute 'aria-hidden=false' to 'root' slot if 'active' property is true. Sets the attribute to 'true' otherwise.
* Adds attribute 'tabIndex=0' to 'root' slot if 'active' property is true. Sets the attribute to '-1' otherwise.
*/
const carouselItemBehavior: Accessibility<CarouselItemProps> = props => ({
attributes: {
root: {
role: 'tabpanel',
'aria-hidden': props.active ? 'false' : 'true',
tabIndex: props.active ? 0 : -1,
},
},

keyActions: {
root: {},
},
})

export default carouselItemBehavior

export type CarouselItemProps = {
/** If item is visible in the carousel. */
active?: boolean
}
4 changes: 2 additions & 2 deletions packages/accessibility/src/behaviors/Tab/tabBehavior.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { Accessibility, AccessibilityAttributes } from '../../types'
* Adds attribute 'aria-describedby' based on the property 'aria-describedby' to 'root' slot.
* Adds attribute 'aria-controls' based on the property 'aria-controls' to 'root' slot.
* Adds attribute 'aria-disabled=true' to 'root' slot based on the property 'disabled'. This can be overriden by providing 'aria-disabled' property directly to the component.
* Triggers 'performClick' action with 'Enter' or 'Spacebar' on 'wrapper'.
* Triggers 'performClick' action with 'Enter' or 'Spacebar' on 'root'.
*/
const tabBehavior: Accessibility<TabBehaviorProps> = props => ({
attributes: {
Expand All @@ -36,7 +36,7 @@ const tabBehavior: Accessibility<TabBehaviorProps> = props => ({
},

keyActions: {
wrapper: {
root: {
performClick: {
keyCombinations: [{ keyCode: keyboardKey.Enter }, { keyCode: keyboardKey.Spacebar }],
},
Expand Down
2 changes: 2 additions & 0 deletions packages/accessibility/src/behaviors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ export { default as treeItemAsListItemBehavior } from './Tree/treeItemAsListItem
export {
default as treeTitleAsListItemTitleBehavior,
} from './Tree/treeTitleAsListItemTitleBehavior'
export { default as carouselBehavior } from './Carousel/carouselBehavior'
export { default as carouselItemBehavior } from './Carousel/carouselItemBehavior'
export { default as tableBehavior } from './Table/tableBehavior'
export { default as tableRowBehavior } from './Table/tableRowBehavior'
export { default as tableCellBehavior } from './Table/tableCellBehavior'
Expand Down
1 change: 1 addition & 0 deletions packages/accessibility/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export interface AriaWidgetAttributes {
'aria-invalid'?: boolean | 'false' | 'true' | 'grammar' | 'spelling'
'aria-label'?: string
'aria-level'?: number
'aria-live'?: 'polite' | 'off' | 'assertive'
'aria-modal'?: boolean
'aria-multiline'?: boolean | 'false' | 'true'
'aria-multiselectable'?: boolean | 'false' | 'true'
Expand Down
4 changes: 4 additions & 0 deletions packages/accessibility/test/behaviors/behavior-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ import {
treeAsListBehavior,
treeItemAsListItemBehavior,
treeTitleAsListItemTitleBehavior,
carouselItemBehavior,
carouselBehavior,
tableBehavior,
tableCellBehavior,
tableHeaderCellBehavior,
Expand Down Expand Up @@ -140,6 +142,8 @@ testHelper.addBehavior('textAreaBehavior', textAreaBehavior)
testHelper.addBehavior('treeAsListBehavior', treeAsListBehavior)
testHelper.addBehavior('treeItemAsListItemBehavior', treeItemAsListItemBehavior)
testHelper.addBehavior('treeTitleAsListItemTitleBehavior', treeTitleAsListItemTitleBehavior)
testHelper.addBehavior('carouselItemBehavior', carouselItemBehavior)
testHelper.addBehavior('carouselBehavior', carouselBehavior)
testHelper.addBehavior('tableBehavior', tableBehavior)
testHelper.addBehavior('tableCellBehavior', tableCellBehavior)
testHelper.addBehavior('tableHeaderCellBehavior', tableHeaderCellBehavior)
Expand Down
2 changes: 1 addition & 1 deletion packages/accessibility/test/behaviors/testDefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ definitions.push({

// Example: Adds attribute 'aria-disabled=true' to 'trigger' slot if 'disabled' property is true. Sets the attribute to 'false' otherwise.
definitions.push({
regexp: /Adds attribute '([\w-]+)=([\w\d]+)' to '([\w-]+)' slot if '([\w-]+)' property is true\. Sets the attribute to '([\w\d]+)' otherwise\./g,
regexp: /Adds attribute '([\w-]+)=([\w\d]+)' to '([\w-]+)' slot if '([\w-]+)' property is true\. Sets the attribute to '([\w\d-]+)' otherwise\./g,
testMethod: (parameters: TestMethod) => {
const [
attributeToBeAdded,
Expand Down
Loading