Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
de04c2b
Change Coachmark to doNotLayer={false} so component scrolls with targ…
edwlmsft Apr 24, 2018
7fa91be
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
edwlmsft Apr 25, 2018
8392717
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
edwlmsft May 4, 2018
d38c04f
Test changes
edwlmsft May 4, 2018
bf9032e
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
edwlmsft May 5, 2018
97b3d82
TODO add parameter for setting rectangle out of bounds in positioning…
edwlmsft May 7, 2018
74580e4
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
edwlmsft May 7, 2018
14aefc3
Merge branch 'coachmarkFixes' of https://github.com/leddie24/office-u…
edwlmsft May 8, 2018
c1e9671
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
edwlmsft May 8, 2018
d5de226
Work in progress. Adding Beak direction and adding positioningContai…
edwlmsft May 8, 2018
f7713f5
export BEAK_HEIGHT/WIDTH, add smart positioning to beak. Reposition …
edwlmsft May 9, 2018
9b94977
Fix coachmark positioning for collapsed/open states
edwlmsft May 9, 2018
1663d7d
Remove props for width/height for coachmark dimensions and beak dimen…
edwlmsft May 10, 2018
a44d082
Fix linting errors. Reset positioning back to origin master.
edwlmsft May 10, 2018
45b4f1a
Add allowOutOfBounds parameter for positioning
edwlmsft May 10, 2018
20032e9
Set mouse proximity default to 10. Fix mouse proximity check. Remove…
edwlmsft May 10, 2018
630606c
Change collapsed --> isCollasped. Fix onmousemove triggering when co…
edwlmsft May 10, 2018
e380113
Fix lint
edwlmsft May 11, 2018
f1f370c
Fix finalHeight set state bug. Set positions to undefined if DOM doe…
edwlmsft May 11, 2018
17e9355
Move allowOutsideOfBounds to PositioningContainer. Add comments for …
edwlmsft May 11, 2018
804a49f
Set _targetElementRect in Coachmark. Fix isMouseInProximity
edwlmsft May 11, 2018
bc54099
Only update components if state/prop changes. Fix onPosition in Coac…
edwlmsft May 21, 2018
257f8fb
Fix TeachingBubble footer
edwlmsft May 22, 2018
dac3f0f
Remove allowOutOfBounds prop. Add in bounds logic to Coachmark. Fix…
edwlmsft May 23, 2018
0ac7ef4
Reduce throttle frequency
edwlmsft May 23, 2018
ecf2a06
Fix animation end event. Change opacity to 1.
edwlmsft May 23, 2018
35b7d0b
Fix _openCoachmark animation open
edwlmsft May 24, 2018
8e18abf
Deprecate props. Fix specificity for TeachingBubble.
edwlmsft May 24, 2018
cf7e03c
Remove isScrollable prop on CoachmarkPage. Fix import order in Beak …
edwlmsft May 24, 2018
959cb80
Tidy up imports in Coachmark
edwlmsft May 24, 2018
af50d09
Make collapsed style prop optional. Add comment for distanceAdjustme…
edwlmsft May 25, 2018
67ac0ef
Fix css selector on TeachingBubble closeButton
edwlmsft May 25, 2018
16fe050
Fix calculation for beak direction bottom
edwlmsft May 25, 2018
13f66ef
Remove unused updatePosition. Remove shouldComponentUpdate from Posi…
edwlmsft May 25, 2018
8c0a78e
Revert basic example
edwlmsft May 25, 2018
3d49ddd
Add dropdown for coachmark position in example
edwlmsft May 25, 2018
592e6c8
Remove console log
edwlmsft May 25, 2018
19315eb
Add max width to dropdown
edwlmsft May 25, 2018
2c04bce
Remove unneeded css rule
edwlmsft May 25, 2018
ec399b0
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
edwlmsft May 25, 2018
d475f50
Add dropdownContainer to ICoachmarkBasicExampleStyles
edwlmsft May 25, 2018
c952a2c
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
edwlmsft May 30, 2018
b8ac188
Remove BeakDirection enum. Add getOppositeEdge function to positioni…
edwlmsft May 30, 2018
1b06b3f
Deprecate dismiss
edwlmsft May 30, 2018
f15504c
Add change file
edwlmsft May 30, 2018
c72ddcd
Update Do's
edwlmsft May 30, 2018
4ff1c48
Add comments to props. Fix auto edge positioning. Fix color prop fo…
edwlmsft Jun 1, 2018
3e21c86
Add more comments
edwlmsft Jun 1, 2018
3dd8303
Remove color prop in example
edwlmsft Jun 1, 2018
d702ed8
Undeprecate color prop in Beak
edwlmsft Jun 1, 2018
c8222a3
Comment change
edwlmsft Jun 1, 2018
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "Coachmark: Fix positioning bugs and add in support for different Coachmark directions.",
"type": "minor"
}
],
"packageName": "office-ui-fabric-react",
"email": "edwl@microsoft.com"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IStyle, DefaultPalette } from '../../../Styling';
import { IStyle } from '../../../Styling';
import { IBeakStylesProps } from './Beak.types';

export interface IBeakStyles {
Expand All @@ -17,18 +17,18 @@ export function getStyles(props: IBeakStylesProps): IBeakStyles {
boxShadow: 'inherit',
border: 'none',
boxSizing: 'border-box',
transform: 'translateY(-50%)',
left: '50%',
transform: props.transform,
width: props.width,
height: props.height
},
(props.left && props.top) && {
height: props.height,
left: props.left,
top: props.top
top: props.top,
right: props.right,
bottom: props.bottom,

}
],
beak: {
fill: DefaultPalette.themePrimary,
fill: props.color,
display: 'block'
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,89 @@ import {
import { IBeakProps } from './Beak.types';
import { getStyles, IBeakStyles } from './Beak.styles';
import { IBeakStylesProps } from './Beak.types';
import { RectangleEdge } from 'office-ui-fabric-react/lib/utilities/positioning';

export interface IBeakState {
left: string | null;
top: string | null;
}
export const BEAK_HEIGHT = 10;
export const BEAK_WIDTH = 18;

export class Beak extends BaseComponent<IBeakProps, IBeakState> {
export class Beak extends BaseComponent<IBeakProps, {}> {
constructor(props: IBeakProps) {
super(props);
}

public render(): JSX.Element {
const {
height = 18,
width = 18,
left,
top
top,
bottom,
right,
color,
direction = RectangleEdge.top
} = this.props;

let svgHeight: number;
let svgWidth: number;

if (direction === RectangleEdge.top || direction === RectangleEdge.bottom) {
svgHeight = BEAK_HEIGHT;
svgWidth = BEAK_WIDTH;
} else {
svgHeight = BEAK_WIDTH;
svgWidth = BEAK_HEIGHT;
}

let pointOne: string;
let pointTwo: string;
let pointThree: string;
let transform: string;

switch (direction) {
case RectangleEdge.top:
default:
pointOne = `${BEAK_WIDTH / 2}, 0`;
pointTwo = `${BEAK_WIDTH}, ${BEAK_HEIGHT}`;
pointThree = `0, ${BEAK_HEIGHT}`;
transform = 'translateY(-100%)';
break;
case RectangleEdge.right:
pointOne = `0, 0`;
pointTwo = `${BEAK_HEIGHT}, ${BEAK_HEIGHT}`;
pointThree = `0, ${BEAK_WIDTH}`;
transform = 'translateX(100%)';
break;
case RectangleEdge.bottom:
pointOne = `0, 0`;
pointTwo = `${BEAK_WIDTH}, 0`;
pointThree = `${BEAK_WIDTH / 2}, ${BEAK_HEIGHT}`;
transform = 'translateY(100%)';
break;
case RectangleEdge.left:
pointOne = `${BEAK_HEIGHT}, 0`;
pointTwo = `0, ${BEAK_HEIGHT}`;
pointThree = `${BEAK_HEIGHT}, ${BEAK_WIDTH}`;
transform = 'translateX(-100%)';
break;
}

const getClassNames = classNamesFunction<IBeakStylesProps, IBeakStyles>();
const classNames = getClassNames(getStyles, {
left,
top,
height: height + 'px',
width: width + 'px'
bottom,
right,
height: `${svgHeight}px`,
width: `${svgWidth}px`,
transform: transform,
color
});

const pointOne = width / 2 + ',' + 0;
const pointTwo = width + ',' + height;
const pointThree = 0 + ',' + height;

return (
<div
className={ css('ms-Beak', classNames.root) }
>
<svg
height={ height }
width={ width }
height={ svgHeight }
width={ svgWidth }
className={ classNames.beak }
>
<polygon points={ pointOne + ' ' + pointTwo + ' ' + pointThree } />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import { Beak } from './Beak';
import { RectangleEdge } from 'office-ui-fabric-react/lib/utilities/positioning';

export interface IBeak { }

Expand All @@ -12,12 +13,14 @@ export interface IBeakProps extends React.Props<Beak> {
/**
* Beak width.
* @default 18
* @deprecated
*/
width?: number;

/**
* Beak height.
* @default 18
* @deprecated
*/
height?: number;

Expand All @@ -29,17 +32,36 @@ export interface IBeakProps extends React.Props<Beak> {
/**
* Left position of the beak
*/
left?: string | null;
left?: string;

/**
* Top position of the beak
*/
top?: string | null;
top?: string;

/**
* Right position of the beak
*/
right?: string;

/**
* Bottom position of the beak
*/
bottom?: string;

/**
* Direction of beak
*/
direction?: RectangleEdge;
}

export interface IBeakStylesProps {
left?: string | null;
top?: string | null;
left?: string | undefined;
top?: string | undefined;
bottom?: string | undefined;
right?: string | undefined;
width?: string;
height?: string;
transform?: string;
color?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,20 @@ import {
getTheme
} from '../../Styling';

export const COACHMARK_WIDTH = 32;
export const COACHMARK_HEIGHT = 32;

export interface ICoachmarkStyleProps {
/**
* Is the Coachmark collapsed. Deprecated: use isCollapsed instead.
* @deprecated
*/
collapsed?: boolean;

/**
* Is the Coachmark collapsed
*/
collapsed: boolean;
isCollapsed: boolean;

/**
* Is the beacon currently animating.
Expand Down Expand Up @@ -57,6 +66,11 @@ export interface ICoachmarkStyleProps {
* Beacon color two
*/
beaconColorTwo?: string;

/**
* Transform origin for teaching bubble content
*/
transformOrigin?: string;
}

export interface ICoachmarkStyles {
Expand Down Expand Up @@ -252,15 +266,15 @@ export function getStyles(props: ICoachmarkStyleProps, theme: ITheme = getTheme(
borderStyle: 'solid',
opacity: '0'
},
(props.collapsed && props.isBeaconAnimating) && ContinuousPulseAnimation
(props.isCollapsed && props.isBeaconAnimating) && ContinuousPulseAnimation
],
// Translate Animation Layer
translateAnimationContainer: [
{
width: '100%',
height: '100%'
},
props.collapsed && {
props.isCollapsed && {
animationDuration: '14s',
animationTimingFunction: 'linear',
animationDirection: 'normal',
Expand All @@ -270,7 +284,7 @@ export function getStyles(props: ICoachmarkStyleProps, theme: ITheme = getTheme(
animationName: translateOne,
transition: 'opacity 0.5s ease-in-out'
},
(!props.collapsed) && {
(!props.isCollapsed) && {
opacity: '1'
}
],
Expand All @@ -280,7 +294,7 @@ export function getStyles(props: ICoachmarkStyleProps, theme: ITheme = getTheme(
width: '100%',
height: '100%'
},
props.collapsed && {
props.isCollapsed && {
animationDuration: '14s',
animationTimingFunction: 'linear',
animationDirection: 'normal',
Expand All @@ -294,10 +308,9 @@ export function getStyles(props: ICoachmarkStyleProps, theme: ITheme = getTheme(
rotateAnimationLayer: [
{
width: '100%',
height: '100%',
opacity: '0.8'
height: '100%'
},
props.collapsed && {
props.isCollapsed && {
animationDuration: '14s',
animationTimingFunction: 'linear',
animationDirection: 'normal',
Expand All @@ -306,7 +319,7 @@ export function getStyles(props: ICoachmarkStyleProps, theme: ITheme = getTheme(
animationFillMode: 'forwards',
animationName: rotateOne
},
!props.collapsed && {
!props.isCollapsed && {
opacity: '1'
}
],
Expand All @@ -317,16 +330,16 @@ export function getStyles(props: ICoachmarkStyleProps, theme: ITheme = getTheme(
outline: 'none',
overflow: 'hidden',
backgroundColor: props.color,
borderRadius: props.width,
borderRadius: COACHMARK_WIDTH,
transition: 'border-radius 250ms, width 500ms, height 500ms cubic-bezier(0.5, 0, 0, 1)',
visibility: 'hidden'
},
!props.isMeasuring && {
width: props.width,
height: props.height,
width: COACHMARK_WIDTH,
height: COACHMARK_HEIGHT,
visibility: 'visible'
},
!props.collapsed && {
!props.isCollapsed && {
borderRadius: '1px',
opacity: '1',
width: props.entityHostWidth,
Expand All @@ -336,10 +349,10 @@ export function getStyles(props: ICoachmarkStyleProps, theme: ITheme = getTheme(
entityInnerHost: [
{
transition: 'transform 500ms cubic-bezier(0.5, 0, 0, 1)',
transformOrigin: 'top left',
transformOrigin: props.transformOrigin,
transform: 'scale(0)'
},
(!props.collapsed) && {
(!props.isCollapsed) && {
width: props.entityHostWidth,
height: props.entityHostHeight,
transform: 'scale(1)'
Expand Down
Loading