+
+
+
},
{
title: 'Nesting FocusZones in list rows',
code: FocusZoneListExampleCode,
+ codepenJS: FocusZoneListExampleCodepen,
view:
},
{
title: 'Disabled FocusZone',
code: FocusZoneDisabledExampleCode,
+ codepenJS: FocusZoneDisabledExampleCodepen,
view:
},
{
title: 'Tabbable FocusZone',
code: FocusZoneTabbableCode,
+ codepenJS: FocusZoneTabbableCodepen,
view:
}
],
diff --git a/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Disabled.Example.scss b/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Disabled.Example.scss
deleted file mode 100644
index 6becb7b58d132..0000000000000
--- a/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Disabled.Example.scss
+++ /dev/null
@@ -1,11 +0,0 @@
-:global {
- .ms-FocusZoneDisabledExample .ms-Row {
- display: block;
- margin: 5px;
- }
-
- .ms-FocusZoneDisabledExample-textField {
- display: inline-block;
- width: 300px;
- }
-}
diff --git a/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Disabled.Example.tsx b/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Disabled.Example.tsx
index d42336afa27b9..06dc91f8df1b7 100644
--- a/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Disabled.Example.tsx
+++ b/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Disabled.Example.tsx
@@ -3,31 +3,27 @@ import * as React from 'react';
import { DefaultButton } from 'office-ui-fabric-react/lib/Button';
import { FocusZone, FocusZoneDirection } from 'office-ui-fabric-react/lib/FocusZone';
import { TextField } from 'office-ui-fabric-react/lib/TextField';
-import './FocusZone.Disabled.Example.scss';
+import { Stack } from 'office-ui-fabric-react/lib/Stack';
-export const FocusZoneDisabledExample = () => (
-
-
-
+export const FocusZoneDisabledExample: React.StatelessComponent = () => (
+
+
+
Enabled FocusZone:
Button 1
Button 2
-
+
Button 3
-
-
-
- Tabbable Element 1
-
-
-
+
+
+ Tabbable Element 1
+
+
Disabled FocusZone:
Button 1
Button 2
-
-
-
-
-
-
+
+
+
+
);
diff --git a/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.List.Example.scss b/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.List.Example.scss
deleted file mode 100644
index d8e4831f222a0..0000000000000
--- a/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.List.Example.scss
+++ /dev/null
@@ -1,5 +0,0 @@
-:global {
- .ms-FocusZoneListExample .ms-DetailsRow {
- display: block;
- }
-}
diff --git a/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.List.Example.tsx b/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.List.Example.tsx
index 8271391058893..4a4f0dba58dfd 100644
--- a/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.List.Example.tsx
+++ b/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.List.Example.tsx
@@ -4,7 +4,6 @@ import { DefaultButton } from 'office-ui-fabric-react/lib/Button';
import { Link } from 'office-ui-fabric-react/lib/Link';
import { FocusZone, FocusZoneDirection } from 'office-ui-fabric-react/lib/FocusZone';
import { DetailsRow, IColumn, Selection, SelectionMode } from 'office-ui-fabric-react/lib/DetailsList';
-import './FocusZone.List.Example.scss';
const ITEMS = createArray(10, index => ({
key: index.toString(),
@@ -35,7 +34,7 @@ const COLUMNS: IColumn[] = [
}
];
-export class FocusZoneListExample extends React.Component {
+export class FocusZoneListExample extends React.PureComponent {
private _selection: Selection;
constructor(props: {}) {
@@ -47,27 +46,23 @@ export class FocusZoneListExample extends React.Component {
public render(): JSX.Element {
return (
-
+
{ITEMS.map((item, index) => (
))}
);
}
- private _isInnerZoneKeystroke(ev: React.KeyboardEvent): boolean {
+ private _isInnerZoneKeystroke = (ev: React.KeyboardEvent): boolean => {
return ev.which === getRTLSafeKeyCode(KeyCodes.right);
- }
+ };
}
diff --git a/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Photos.Example.scss b/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Photos.Example.scss
deleted file mode 100644
index dcd9ced87a791..0000000000000
--- a/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Photos.Example.scss
+++ /dev/null
@@ -1,33 +0,0 @@
-@import '../../../common/common';
-
-:global {
- .ms-FocusZoneExamples-photoList {
- display: inline-block;
- border: 1px solid $ms-color-neutralTertiary;
- padding: 10px;
- line-height: 0;
- overflow: hidden;
- }
-
- .ms-FocusZoneExamples-photoCell {
- position: relative;
- display: inline-block;
- padding: 2px;
- box-sizing: border-box;
-
- &:focus {
- outline: none;
-
- &:after {
- content: '';
- position: absolute;
- right: 4px;
- left: 4px;
- top: 4px;
- bottom: 4px;
- border: 1px solid white;
- outline: 2px solid $ms-color-themePrimary;
- }
- }
- }
-}
diff --git a/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Photos.Example.tsx b/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Photos.Example.tsx
index fc61de1f8180b..d1461f5fd89ca 100644
--- a/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Photos.Example.tsx
+++ b/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Photos.Example.tsx
@@ -1,37 +1,69 @@
import * as React from 'react';
import { FocusZone } from 'office-ui-fabric-react/lib/FocusZone';
import { Image } from 'office-ui-fabric-react/lib/Image';
-import './FocusZone.Photos.Example.scss';
+import { getId } from 'office-ui-fabric-react/lib/Utilities';
+import { mergeStyleSets, getTheme } from 'office-ui-fabric-react/lib/Styling';
+
+const theme = getTheme();
+const classNames = mergeStyleSets({
+ photoList: {
+ display: 'inline-block',
+ border: '1px solid ' + theme.palette.neutralTertiary,
+ padding: 10,
+ lineHeight: 0,
+ overflow: 'hidden'
+ },
+ photoCell: {
+ position: 'relative',
+ display: 'inline-block',
+ padding: 2,
+ boxSizing: 'border-box',
+ selectors: {
+ '&:focus': {
+ outline: 'none',
+ selectors: {
+ '&:after': {
+ content: '',
+ position: 'absolute',
+ right: 4,
+ left: 4,
+ top: 4,
+ bottom: 4,
+ border: '1px solid ' + theme.palette.white,
+ outline: '2px solid ' + theme.palette.themePrimary
+ }
+ }
+ }
+ }
+ }
+});
const MAX_COUNT = 20;
-let _counter = 0;
-export interface IPhoto {
- id: number;
+interface IPhoto {
+ id: string;
url: string;
width: number;
height: number;
}
-export class FocusZonePhotosExample extends React.Component<{}, { items: IPhoto[] }> {
+export class FocusZonePhotosExample extends React.PureComponent<{}> {
+ private _items: IPhoto[];
+
constructor(props: {}) {
super(props);
- this.state = {
- items: this._getInitialItems()
- };
+ this._items = this._getItems();
}
public render() {
- const { items } = this.state;
-
return (
-
- {items.map((item: IPhoto, index) => (
+
+ {this._items.map((item: IPhoto, index) => (
@@ -42,25 +74,20 @@ export class FocusZonePhotosExample extends React.Component<{}, { items: IPhoto[
);
}
- private _getInitialItems(): IPhoto[] {
+ private _getItems(): IPhoto[] {
const items: IPhoto[] = [];
for (let i = 0; i < MAX_COUNT; i++) {
- items.push(this._createItem());
+ const randomWidth = 50 + Math.floor(Math.random() * 150);
+
+ items.push({
+ id: getId('photo'),
+ url: `http://placehold.it/${randomWidth}x100`,
+ width: randomWidth,
+ height: 100
+ });
}
return items;
}
-
- private _createItem(): IPhoto {
- const randomWidth = 50 + Math.floor(Math.random() * 150);
- const id = _counter++;
-
- return {
- id,
- url: `http://placehold.it/${randomWidth}x100`,
- width: randomWidth,
- height: 100
- };
- }
}
diff --git a/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Tabbable.Example.scss b/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Tabbable.Example.scss
deleted file mode 100644
index 5dd6ad148d8a0..0000000000000
--- a/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Tabbable.Example.scss
+++ /dev/null
@@ -1,11 +0,0 @@
-:global {
- .ms-FocusZoneTabbableExample .ms-Row {
- display: block;
- margin: 5px;
- }
-
- .ms-FocusZoneTabbableExample-textField {
- display: inline-block;
- width: 300px;
- }
-}
diff --git a/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Tabbable.Example.tsx b/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Tabbable.Example.tsx
index b42e37dbbedae..30ec0e6c100c8 100644
--- a/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Tabbable.Example.tsx
+++ b/packages/office-ui-fabric-react/src/components/FocusZone/examples/FocusZone.Tabbable.Example.tsx
@@ -2,26 +2,26 @@ import * as React from 'react';
import { DefaultButton } from 'office-ui-fabric-react/lib/Button';
import { FocusZone, FocusZoneDirection, FocusZoneTabbableElements } from 'office-ui-fabric-react/lib/FocusZone';
import { TextField } from 'office-ui-fabric-react/lib/TextField';
-import './FocusZone.Tabbable.Example.scss';
+import { Stack } from 'office-ui-fabric-react/lib/Stack';
const alertClicked = (): void => {
alert('Clicked');
};
-export const FocusZoneTabbableExample = () => (
-
-
-
+export const FocusZoneTabbableExample: React.StatelessComponent = () => (
+
+
+
Circular Tabbable FocusZone:
Button 1
Button 2
-
+
Button 3
(
]
}}
/>
-
-
-
-
+
+
+
+
Input Only FocusZone:
Button 1
Button 2
-
+
Button 3
-
-
-
+
+
+
);
diff --git a/packages/office-ui-fabric-react/src/components/__snapshots__/FocusTrapZone.Box.Click.Example.tsx.shot b/packages/office-ui-fabric-react/src/components/__snapshots__/FocusTrapZone.Box.Click.Example.tsx.shot
index 9789a5e095892..6b06e99b85a77 100644
--- a/packages/office-ui-fabric-react/src/components/__snapshots__/FocusTrapZone.Box.Click.Example.tsx.shot
+++ b/packages/office-ui-fabric-react/src/components/__snapshots__/FocusTrapZone.Box.Click.Example.tsx.shot
@@ -120,7 +120,11 @@ exports[`Component Examples renders FocusTrapZone.Box.Click.Example.tsx correctl