Skip to content

Commit

Permalink
tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
ecraig12345 committed Mar 29, 2019
1 parent 00edd67 commit e947e2e
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export class FocusTrapZoneBoxClickExample extends React.Component<{}, IFocusTrap

return (
<Stack
gap={15}
horizontalAlign="start"
tokens={{ childrenGap: 15 }}
styles={{
root: { border: `2px dashed ${useTrapZone ? '#ababab' : 'transparent'}`, padding: 10 }
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export class FocusTrapZoneBoxExample extends React.Component<{}, IFocusTrapZoneB

return (
<Stack
gap={15}
horizontalAlign="start"
tokens={{ childrenGap: 15 }}
styles={{
root: { border: `2px solid ${useTrapZone ? '#ababab' : 'transparent'}`, padding: 10 }
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export class FocusTrapZoneBoxCustomElementExample extends React.Component<{}, IF

return (
<Stack
gap={15}
horizontalAlign="start"
tokens={{ childrenGap: 15 }}
styles={{
root: { border: `2px solid ${useTrapZone ? '#ababab' : 'transparent'}`, padding: 10 }
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DefaultButton } from 'office-ui-fabric-react/lib/Button';
import { FocusTrapZone } from 'office-ui-fabric-react/lib/FocusTrapZone';
import { FocusZone, FocusZoneDirection } from 'office-ui-fabric-react/lib/FocusZone';
import { Toggle, IToggle } from 'office-ui-fabric-react/lib/Toggle';
import { Stack } from 'office-ui-fabric-react/lib/Stack';
import { Stack, IStackTokens } from 'office-ui-fabric-react/lib/Stack';

export interface IFocusTrapZoneFocusZoneExampleState {
useTrapZone: boolean;
Expand Down Expand Up @@ -36,9 +36,10 @@ export class FocusTrapZoneFocusZoneExample extends React.Component<{}, IFocusTra
const padding = 10;
const border = '2px dashed #ababab';
const rootBorder = `2px solid ${useTrapZone ? '#ababab' : 'transparent'}`;
const tokens: IStackTokens = { childrenGap: 10 };

return (
<Stack gap={15} horizontalAlign="start" styles={{ root: { border: rootBorder, padding } }}>
<Stack tokens={tokens} horizontalAlign="start" styles={{ root: { border: rootBorder, padding } }}>
<Toggle
label="Use trap zone"
componentRef={this._toggle}
Expand All @@ -49,7 +50,7 @@ export class FocusTrapZoneFocusZoneExample extends React.Component<{}, IFocusTra
/>

<FocusZone direction={FocusZoneDirection.horizontal} data-is-visible={true}>
<Stack horizontal gap={10} styles={{ root: { border, padding } }}>
<Stack horizontal tokens={tokens} styles={{ root: { border, padding } }}>
<DefaultButton text="FZ1" />
<DefaultButton text="FZ1" />
<DefaultButton text="FZ1" />
Expand All @@ -59,7 +60,7 @@ export class FocusTrapZoneFocusZoneExample extends React.Component<{}, IFocusTra
<DefaultButton text="No FZ" />

<FocusZone direction={FocusZoneDirection.horizontal} data-is-visible={true}>
<Stack horizontal gap={10} styles={{ root: { border, padding } }}>
<Stack horizontal tokens={tokens} styles={{ root: { border, padding } }}>
<DefaultButton text="FZ2" />
<DefaultButton text="FZ2" />
<DefaultButton text="FZ2" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class FocusTrapComponent extends React.Component<IFocusTrapComponentProps> {
const { isActive, zoneNumber, children } = this.props;
const contents = (
<Stack
gap={10}
horizontal={zoneNumber === 2}
horizontalAlign="start"
tokens={{ childrenGap: 10 }}
styles={{
root: { border: `2px solid ${isActive ? '#ababab' : 'transparent'}`, padding: 10 }
}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';

import { DefaultButton } from 'office-ui-fabric-react/lib/Button';
import { FocusTrapZone } from 'office-ui-fabric-react/lib/FocusTrapZone';
import { TextField } from 'office-ui-fabric-react/lib/TextField';
import { Toggle, IToggle } from 'office-ui-fabric-react/lib/Toggle';
Expand Down Expand Up @@ -34,8 +33,8 @@ export class FocusTrapZoneNoTabbableExample extends React.Component<{}, IFocusTr

return (
<Stack
gap={15}
horizontalAlign="start"
tokens={{ childrenGap: 15 }}
styles={{
root: { border: `2px solid ${useTrapZone ? '#ababab' : 'transparent'}`, padding: 10 }
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,28 @@ import { FocusZone, FocusZoneDirection } from 'office-ui-fabric-react/lib/FocusZ
import { TextField } from 'office-ui-fabric-react/lib/TextField';
import { Stack } from 'office-ui-fabric-react/lib/Stack';

export const FocusZoneDisabledExample: React.StatelessComponent = () => (
<Stack gap={20} horizontalAlign="start">
<FocusZone direction={FocusZoneDirection.horizontal}>
<Stack gap={20} horizontal>
<span>Enabled FocusZone: </span>
<DefaultButton>Button 1</DefaultButton>
<DefaultButton>Button 2</DefaultButton>
<TextField value="FocusZone TextField" styles={{ root: { width: 200 } }} />
<DefaultButton>Button 3</DefaultButton>
</Stack>
</FocusZone>
<DefaultButton>Tabbable Element 1</DefaultButton>
<FocusZone disabled={true}>
<Stack gap={20} horizontal>
<span>Disabled FocusZone: </span>
<DefaultButton>Button 1</DefaultButton>
<DefaultButton>Button 2</DefaultButton>
</Stack>
</FocusZone>
<TextField value="Tabbable Element 2" />
</Stack>
);
export const FocusZoneDisabledExample: React.StatelessComponent = () => {
const tokens = { childrenGap: 20 };
return (
<Stack tokens={tokens} horizontalAlign="start">
<FocusZone direction={FocusZoneDirection.horizontal}>
<Stack tokens={tokens} horizontal>
<span>Enabled FocusZone: </span>
<DefaultButton>Button 1</DefaultButton>
<DefaultButton>Button 2</DefaultButton>
<TextField value="FocusZone TextField" styles={{ root: { width: 200 } }} />
<DefaultButton>Button 3</DefaultButton>
</Stack>
</FocusZone>
<DefaultButton>Tabbable Element 1</DefaultButton>
<FocusZone disabled={true}>
<Stack tokens={tokens} horizontal>
<span>Disabled FocusZone: </span>
<DefaultButton>Button 1</DefaultButton>
<DefaultButton>Button 2</DefaultButton>
</Stack>
</FocusZone>
<TextField value="Tabbable Element 2" />
</Stack>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,48 @@ const alertClicked = (): void => {
alert('Clicked');
};

export const FocusZoneTabbableExample: React.StatelessComponent = () => (
<Stack gap={20} horizontalAlign="start">
<FocusZone direction={FocusZoneDirection.horizontal} handleTabKey={FocusZoneTabbableElements.all} isCircularNavigation={true}>
<Stack gap={20} horizontal>
<span>Circular Tabbable FocusZone: </span>
<DefaultButton>Button 1</DefaultButton>
<DefaultButton>Button 2</DefaultButton>
<TextField value="FocusZone TextField" styles={{ root: { width: 200 } }} />
<DefaultButton>Button 3</DefaultButton>
<DefaultButton
text="Create account"
split={true}
onClick={alertClicked}
splitButtonAriaLabel="See 2 sample options"
menuProps={{
items: [
{
key: 'emailMessage',
text: 'Email message',
iconProps: { iconName: 'Mail' }
},
{
key: 'calendarEvent',
text: 'Calendar event',
iconProps: { iconName: 'Calendar' }
}
]
}}
/>
</Stack>
</FocusZone>
<FocusZone direction={FocusZoneDirection.horizontal} handleTabKey={FocusZoneTabbableElements.inputOnly} isCircularNavigation={false}>
<Stack gap={20} horizontal>
<span>Input Only FocusZone: </span>
<DefaultButton>Button 1</DefaultButton>
<DefaultButton>Button 2</DefaultButton>
<TextField value="FocusZone TextField" styles={{ root: { width: 200 } }} />
<DefaultButton>Button 3</DefaultButton>
</Stack>
</FocusZone>
</Stack>
);
export const FocusZoneTabbableExample: React.StatelessComponent = () => {
const tokens = { childrenGap: 20 };
return (
<Stack tokens={tokens} horizontalAlign="start">
<FocusZone direction={FocusZoneDirection.horizontal} handleTabKey={FocusZoneTabbableElements.all} isCircularNavigation={true}>
<Stack tokens={tokens} horizontal>
<span>Circular Tabbable FocusZone: </span>
<DefaultButton>Button 1</DefaultButton>
<DefaultButton>Button 2</DefaultButton>
<TextField value="FocusZone TextField" styles={{ root: { width: 200 } }} />
<DefaultButton>Button 3</DefaultButton>
<DefaultButton
text="Create account"
split={true}
onClick={alertClicked}
splitButtonAriaLabel="See 2 sample options"
menuProps={{
items: [
{
key: 'emailMessage',
text: 'Email message',
iconProps: { iconName: 'Mail' }
},
{
key: 'calendarEvent',
text: 'Calendar event',
iconProps: { iconName: 'Calendar' }
}
]
}}
/>
</Stack>
</FocusZone>
<FocusZone direction={FocusZoneDirection.horizontal} handleTabKey={FocusZoneTabbableElements.inputOnly} isCircularNavigation={false}>
<Stack tokens={tokens} horizontal>
<span>Input Only FocusZone: </span>
<DefaultButton>Button 1</DefaultButton>
<DefaultButton>Button 2</DefaultButton>
<TextField value="FocusZone TextField" styles={{ root: { width: 200 } }} />
<DefaultButton>Button 3</DefaultButton>
</Stack>
</FocusZone>
</Stack>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ exports[`Component Examples renders FocusTrapZone.FocusZone.Example.tsx correctl
text-overflow: ellipsis;
}
& > *:not(:first-child) {
margin-top: 15px;
margin-top: 10px;
}
& > *:not(.ms-StackItem) {
flex-shrink: 1;
Expand Down

0 comments on commit e947e2e

Please sign in to comment.