forked from microsoft/fluentui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating SpinButton to a function component within React-Next (micros…
…oft#13689) * moving files and updating imports * Change files * api update * updates * quick changes * update * update * api update * update * update * update * updating styles * updates * updates * update * update * bug fix * bug fixes * import correction * updates * import change * quick fix * Removing commented code * Change files * change * Update packages/react-next/src/components/SpinButton/SpinButton.base.tsx Co-authored-by: Makoto Morimoto <Humberto.Morimoto@microsoft.com> * Update packages/react-next/src/components/SpinButton/SpinButton.styles.ts Co-authored-by: Makoto Morimoto <Humberto.Morimoto@microsoft.com> * Update change/@fluentui-react-next-2020-04-30-15-57-11-feat-spin-button.json Co-authored-by: Makoto Morimoto <Humberto.Morimoto@microsoft.com> * pr feedback * update * Delete @uifabric-file-type-icons-2020-06-22-11-41-59-caperez-filetype_cortex_and_shortcut.json * quick fix * pr feedback * pr feedback * quick fix * Change files * Delete DateMath.test.ts * Delete DateValues.ts * Delete DateMath.ts * fix * Rename TimeConstants.ts to timeConstants.ts * Updates to styles prop. Co-authored-by: Makoto Morimoto <Humberto.Morimoto@microsoft.com>
- Loading branch information
Showing
18 changed files
with
888 additions
and
851 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import * as React from 'react'; | ||
import { SpinButton } from 'office-ui-fabric-react'; | ||
|
||
const Scenario = () => ( | ||
<SpinButton | ||
defaultValue="0" | ||
label={'Basic SpinButton:'} | ||
min={0} | ||
max={100} | ||
step={1} | ||
incrementButtonAriaLabel={'Increase value by 1'} | ||
decrementButtonAriaLabel={'Decrease value by 1'} | ||
/> | ||
); | ||
|
||
export default Scenario; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import * as React from 'react'; | ||
import { SpinButton } from '@fluentui/react-next'; | ||
|
||
const Scenario = () => ( | ||
<SpinButton | ||
defaultValue="0" | ||
label={'Basic SpinButton:'} | ||
min={0} | ||
max={100} | ||
step={1} | ||
incrementButtonAriaLabel={'Increase value by 1'} | ||
decrementButtonAriaLabel={'Decrease value by 1'} | ||
/> | ||
); | ||
|
||
export default Scenario; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
/*! Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. */ | ||
import * as React from 'react'; | ||
import Screener from 'screener-storybook/src/screener'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { FabricDecoratorFixedWidth, FabricDecorator } from '../utilities'; | ||
import { | ||
Fabric, | ||
SpinButton, | ||
TextField, | ||
ISpinButtonProps, | ||
ISpinButtonStyles, | ||
ITextFieldStyles, | ||
} from '@fluentui/react-next'; | ||
import { Position } from 'office-ui-fabric-react/lib/utilities/positioning'; | ||
|
||
const props: ISpinButtonProps = { | ||
defaultValue: '0', | ||
label: 'Basic SpinButton:', | ||
min: 0, | ||
max: 0, | ||
step: 1, | ||
}; | ||
const styles: Partial<ISpinButtonStyles> = { root: { width: 300 } }; | ||
const textFieldStyles: Partial<ITextFieldStyles> = { | ||
root: { width: 250, display: 'inline-block' }, | ||
}; | ||
const iconProps = { iconName: 'IncreaseIndentLegacy' }; | ||
|
||
storiesOf('SpinButton Next', module) | ||
.addDecorator(FabricDecoratorFixedWidth) | ||
.addDecorator(story => ( | ||
<Screener | ||
steps={new Screener.Steps() | ||
.snapshot('default', { cropTo: '.testWrapper' }) | ||
.hover('.ms-spinButton-input') | ||
.snapshot('hover input', { cropTo: '.testWrapper' }) | ||
.click('.ms-spinButton-input') | ||
.hover('.ms-spinButton-input') | ||
.snapshot('click input', { cropTo: '.testWrapper' }) | ||
.hover('.ms-Button-flexContainer') | ||
.snapshot('hover arrow', { cropTo: '.testWrapper' }) | ||
.mouseDown('.ms-Button-flexContainer') | ||
.snapshot('mouseDown arrow', { cropTo: '.testWrapper' }) | ||
.end()} | ||
> | ||
{story()} | ||
</Screener> | ||
)) | ||
.addStory('Root', () => ( | ||
<Fabric> | ||
<SpinButton {...props} /> | ||
</Fabric> | ||
)) | ||
.addStory('Disabled', () => ( | ||
<Fabric> | ||
<SpinButton {...props} disabled /> | ||
</Fabric> | ||
)) | ||
.addStory( | ||
'With icon', | ||
() => ( | ||
<Fabric> | ||
<SpinButton {...props} iconProps={iconProps} /> | ||
</Fabric> | ||
), | ||
{ rtl: true }, | ||
); | ||
|
||
// The stories for label placement are separate since they don't need to include hover/click states | ||
storiesOf('SpinButton', module) | ||
.addDecorator(FabricDecorator) | ||
.addDecorator(story => ( | ||
<Screener steps={new Screener.Steps().snapshot('default', { cropTo: '.testWrapper' }).end()}> | ||
{story()} | ||
</Screener> | ||
)) | ||
.addStory( | ||
'Label at end', | ||
() => ( | ||
<Fabric> | ||
<SpinButton {...props} styles={styles} labelPosition={Position.end} /> | ||
</Fabric> | ||
), | ||
{ rtl: true }, | ||
) | ||
.addStory( | ||
'Label at end with icon', | ||
() => ( | ||
<Fabric> | ||
<SpinButton {...props} styles={styles} labelPosition={Position.end} iconProps={iconProps} /> | ||
</Fabric> | ||
), | ||
{ rtl: true }, | ||
) | ||
.addStory('Label on top', () => ( | ||
<Fabric> | ||
<SpinButton | ||
{...props} | ||
styles={{ root: { width: 120, display: 'inline-block' } }} | ||
labelPosition={Position.top} | ||
/> | ||
{/* DO NOT delete this TextField! It's here to verify that the SpinButton's field and label | ||
vertically align with other form components (this positioning can get messed up since | ||
SpinButton's optional icon is 1px larger than the label line height). */} | ||
<TextField | ||
label="Should vertically align with SpinButton" | ||
placeholder="(verify field and label alignment)" | ||
styles={textFieldStyles} | ||
/> | ||
</Fabric> | ||
)) | ||
.addStory('Label on top with icon', () => ( | ||
<Fabric> | ||
<SpinButton | ||
{...props} | ||
styles={{ root: { width: 150, display: 'inline-block' } }} | ||
labelPosition={Position.top} | ||
iconProps={iconProps} | ||
/> | ||
{/* DO NOT delete this TextField! It's here to verify that the SpinButton's field and label | ||
vertically align with other form components (this positioning can get messed up since | ||
SpinButton's optional icon is 1px larger than the label line height). */} | ||
<TextField | ||
label="Should vertically align with SpinButton" | ||
placeholder="(verify field and label alignment)" | ||
styles={textFieldStyles} | ||
/> | ||
</Fabric> | ||
)) | ||
.addStory('Label on bottom', () => ( | ||
<Fabric> | ||
<SpinButton {...props} styles={styles} labelPosition={Position.bottom} /> | ||
</Fabric> | ||
)) | ||
.addStory('Label on bottom with icon', () => ( | ||
<Fabric> | ||
<SpinButton | ||
{...props} | ||
styles={styles} | ||
labelPosition={Position.bottom} | ||
iconProps={iconProps} | ||
/> | ||
</Fabric> | ||
)); |
8 changes: 8 additions & 0 deletions
8
change/@fluentui-react-next-2020-04-30-15-57-11-feat-spin-button.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "SpinButton: Updating to a function component within react-next.", | ||
"packageName": "@fluentui/react-next", | ||
"email": "czearing@outlook.com", | ||
"dependentChangeType": "patch", | ||
"date": "2020-04-30T22:57:11.130Z" | ||
} |
8 changes: 8 additions & 0 deletions
8
change/@fluentui-react-next-2020-06-23-09-20-26-react-conformance.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"type": "none", | ||
"comment": "disabling kebab-cased aria test for now since oufr and react-next aren't following the rule", | ||
"packageName": "@fluentui/react-next", | ||
"email": "esteban.230@hotmail.com", | ||
"dependentChangeType": "none", | ||
"date": "2020-06-23T15:20:26.173Z" | ||
} |
8 changes: 8 additions & 0 deletions
8
change/@uifabric-react-hooks-2020-06-18-12-27-30-feat-updating-spin-button.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Adding useSetTimeOut hook.", | ||
"packageName": "@uifabric/react-hooks", | ||
"email": "czearing@outlook.com", | ||
"dependentChangeType": "patch", | ||
"date": "2020-06-18T19:27:30.967Z" | ||
} |
8 changes: 8 additions & 0 deletions
8
change/office-ui-fabric-react-2020-06-23-09-20-26-react-conformance.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"type": "none", | ||
"comment": "disabling kebab-cased aria test for now since oufr and react-next aren't following the rule", | ||
"packageName": "office-ui-fabric-react", | ||
"email": "esteban.230@hotmail.com", | ||
"dependentChangeType": "none", | ||
"date": "2020-06-23T15:20:22.020Z" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.