Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
8e1b55a
First step at stepper implementation.
Mar 30, 2017
d54e9f4
Add first implementation of stepper.
Mar 30, 2017
4369f67
Add functionality to stepper
jspurlin Apr 3, 2017
41ac16a
Refine the Stepper class and add tests
jspurlin Apr 5, 2017
0d1412f
let's make sure to put focus back on the text field when submitting v…
jspurlin Apr 5, 2017
8570e56
Added documentation to Stepper.
Apr 5, 2017
f78f686
Add flexibility to current stepper implementation.
Apr 13, 2017
8e28b99
Modified example implementations.
Apr 13, 2017
4ccaf1d
Add aria-valuemax.
Apr 13, 2017
4e2f418
Change Stepper to SpinButton.
Apr 13, 2017
d699fc0
Add example with unit.
Apr 13, 2017
4f830cd
Implement color scheme in the ContextualMenu control to enable altern…
desun-ms Apr 13, 2017
ffa948d
Improvements to SpinButton.
Apr 14, 2017
40c6f64
Fix increment function calls.
Apr 14, 2017
f002ceb
Add new width optional parameter.
Apr 14, 2017
486fc93
Add label direction.
Apr 15, 2017
68e4c1f
Fix border.
Apr 18, 2017
e6fbc48
Merge branch 'master' of https://github.com/Boris-Em/office-ui-fabric…
Apr 19, 2017
25cf2cf
Add Position enum.
Apr 19, 2017
0fe58fe
`defaultValue` is now the deciding prop for using the default impleme…
Apr 19, 2017
9241663
onBlur is now onValidate.
Apr 19, 2017
21453e3
Fix tests.
Apr 20, 2017
629d21d
Fix warnings.
Apr 20, 2017
8475fc4
Add implementation for labelGap.
Apr 21, 2017
94d2adc
Put some polish on the styling, added some icon support, and added so…
jspurlin Apr 22, 2017
fdaadbd
Implement the bar and unit tests and component page
desun Apr 22, 2017
6b9716d
Add the ability for the spinButton buttons to look pressed when spinn…
jspurlin Apr 24, 2017
238ad26
Revert "Implement color scheme in the ContextualMenu control to enabl…
desun-ms Apr 24, 2017
0436c11
Don't render an empty icon for an icon-less header menu item.
desun-ms Apr 24, 2017
590d005
Merge pull request #1 from Boris-Em/feature/documentTitleThingy
desun-ms Apr 24, 2017
ee4b3d0
Revert "Implement Document Title Bar"
desun-ms Apr 24, 2017
a74f950
Merge pull request #2 from Boris-Em/revert-1-feature/documentTitleThingy
desun-ms Apr 24, 2017
107af4d
Merge remote-tracking branch 'upstream/master'
desun-ms May 2, 2017
f5c7bb3
update some CSS for high contrast in ff and use css utility instead o…
jspurlin May 10, 2017
9fbfc1c
Fix quotation issue
May 11, 2017
d309a83
Fix Spin Button properties table.
May 11, 2017
c9a3dc7
Fix Spin Button example code
May 11, 2017
e3b3962
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
May 11, 2017
be816b6
Merge branch 'master' of https://github.com/Boris-Em/office-ui-fabric…
May 11, 2017
4e7b615
Use iconProps instead of string
May 11, 2017
4348ca5
Extracted `spinning` out of state
May 11, 2017
89976f7
Add autobind instead of manually binding private functions to this
May 11, 2017
c4ac999
Change `+` syntax for more explicit `Number()`
May 11, 2017
5720c2d
Remove unnecessary cast
May 11, 2017
a65634d
Fix typos
May 11, 2017
7b6061f
`incrementButtonIcon` and `decrementButtonIcon` are now IIconProps
May 15, 2017
a9564ee
Add KeyboardSpinDirection enum
May 15, 2017
8112bac
Fix test description
May 15, 2017
5c641eb
Fix SpinButton tests
May 15, 2017
e33deba
Remove unused onChange callback from SpinButton
May 15, 2017
0d56702
Revert onChange
May 15, 2017
b822c98
Remove old Stepper.ts file
May 15, 2017
3cfc49a
Use module css instead of global
May 16, 2017
b948cae
Fix missing word in comment
May 16, 2017
b089ade
Callback functions now allow for void return (state to be updated out…
May 17, 2017
c385ca2
Use `_async` instead of window
May 17, 2017
a6d4c80
Fix minor rendering issue with browser zoom
May 17, 2017
ff61822
Rename `_spinning` to `_spinningByMouse` for clarity
May 17, 2017
bd53c5a
Fix tests
May 17, 2017
c711744
Fix extra space before label
May 17, 2017
16ee4d2
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
May 18, 2017
b70c862
Remove width outside of SpinButton component and fix styling
May 22, 2017
ec02de3
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
May 22, 2017
a5aac7c
Merge branch 'master' of https://github.com/Boris-Em/office-ui-fabric…
May 22, 2017
fbccd1b
Add more tests to SpinButton
May 25, 2017
0f3561f
Fix SpinButton documentation
May 25, 2017
faa7700
Fix typo
May 25, 2017
f359b37
Fix AppDefinition for SpinButton and Spinner
May 26, 2017
a82c296
Add missing documentation to SpinButton title prop
May 26, 2017
1c56b5e
Various SpinButton fixes
May 26, 2017
70edd03
Fix SpinButton path for properties
May 30, 2017
8d5f70c
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
May 30, 2017
717f233
Merge branch 'master' of https://github.com/Boris-Em/office-ui-fabric…
May 30, 2017
297d56d
Fix SpinButton styling issues
Jun 6, 2017
102a1b7
Merge branch 'master' into feature/stepper
Boris-Em Jun 6, 2017
482e785
Merge branch 'master' into feature/stepper
micahgodbolt Jun 7, 2017
58562b3
Merge branch 'master' into feature/stepper
christiango Jun 8, 2017
0604770
Remove labelGap property from SpinButton
Jun 8, 2017
f4d96b4
Merge branch 'master' into feature/stepper
Boris-Em Jun 8, 2017
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
6 changes: 6 additions & 0 deletions apps/fabric-website/src/components/App/AppState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,12 @@ export const AppState: IAppState = {
component: () => <LoadingComponent title='Spinner' />,
getComponent: cb => require.ensure([], (require) => cb(require<any>('../../pages/Components/SpinnerComponentPage').SpinnerComponentPage))
},
{
title: 'SpinButton',
url: '#/components/spinbutton',
component: () => <LoadingComponent title='SpinButton' />,
getComponent: cb => require.ensure([], (require) => cb(require<any>('../../pages/Components/SpinButtonComponentPage').SpinButtonComponentPage))
},
{
title: 'TextField',
url: '#/components/textfield',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import * as React from 'react';
import { SpinButtonPage } from 'office-ui-fabric-react/lib/components/SpinButton/SpinButtonPage';
import { PageHeader } from '../../components/PageHeader/PageHeader';
import { ComponentPage } from '../../components/ComponentPage/ComponentPage';

export class SpinButtonComponentPage extends React.Component<any, any> {
public render() {
return (
<div ref='pageElement'>
<ComponentPage>
<PageHeader pageTitle='SpinButton' backgroundColor='#038387'
links={
[
{
'text': 'Overview',
'location': 'Overview'
},
{
'text': 'Best Practices',
'location': 'Best Practices'
},
{
'text': 'Variants',
'location': 'Variants'
},
{
'text': 'Implementation',
'location': 'Implementation'
}
]
} />
<SpinButtonPage isHeaderVisible={ false } />
</ComponentPage>
</div>
);
}
}
1 change: 1 addition & 0 deletions packages/office-ui-fabric-react/src/SpinButton.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './components/SpinButton/index';
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import { Position } from '../../utilities/positioning';
import { IIconProps } from '../../Icon';

export interface ISpinButtonProps {

/**
* The initial value of the SpinButton. Use this if you intend for the SpinButton to be an uncontrolled component.
* This value is mutually exclusive to value. Use one or the other.
* @default 0
*/
defaultValue?: string;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also missing _warnMutuallyExclusive for defaultValue and value in the component constructor


/**
* The value of the SpinButton. Use this if you intend to pass in a new value as a result of onChange events.
* This value is mutually exclusive to defaultValue. Use one or the other.
*/
value?: string;

/**
* The min value of the SpinButton.
* @default 0
*/
min?: number;

/**
* The max value of the SpinButton.
* @default 10
*/
max?: number;

/**
* The difference between the two adjacent values of the SpinButton.
* @default 1
*/
step?: number;

/**
* A description of the SpinButton for the benefit of screen readers.
*/
ariaLabel?: string;

/**
* A title for the SpinButton used for a more descriptive name that's also visible on its tooltip.
*/
title?: string;

/**
* Whether or not the SpinButton is disabled.
*/
disabled?: boolean;

/**
* Optional className for SpinButton.
*/
className?: string;

/**
* Descriptive label for the SpinButton.
*/
label: string;

/**
* @default: Left
*/
labelPosition?: Position;

/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here regarding styling, is this normal to provide as props?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@christiango, how exactly would that work with styling? Is it related to the new styling work you've been doing?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's usually done with className, but yeah it will be possible to do this more cleanly with glamor styling. Are there other components that provide things like label gap space as a prop?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just changed it to be styled via css.

* Icon that goes along with the label for the whole SpinButton
*/
iconProps?: IIconProps;

/**
* This callback is triggered when the value inside the SpinButton should be validated.
* @return {string | void} If a string is returned, it will be used as the value of the SpinButton.
*/
onValidate?: (value: string) => string | void;

/**
* This callback is triggered when the increment button is pressed or if the user presses up arrow with focus on the input of the spinButton
* @return {string | void} If a string is returned, it will be used as the value of the SpinButton.
*/
onIncrement?: (value: string) => string | void;

/**
* This callback is triggered when the decrement button is pressed or if the user presses down arrow with focus on the input of the spinButton
* @return {string | void} If a string is returned, it will be used as the value of the SpinButton.
*/
onDecrement?: (value: string) => string | void;

/**
* Icon for the increment button of the spinButton
*/
incrementButtonIcon?: IIconProps;

/**
* Icon for the decrement button of the spinButton
*/
decrementButtonIcon?: IIconProps;
}

export interface ISpinButton {
/**
* The value of the SpinButton. Use this if you intend to pass in a new value as a result of onChange events.
* This value is mutually exclusive to defaultValue. Use one or the other.
*/
value?: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
@import '../../common/common';
@import '../Label/LabelMixins.scss';

.ArrowBox, .Input,
.UpButton, .DownButton, .SpinButtonContainer {
outline: none;
font-size: 12px;
}

.SpinButtonLabel {
pointer-events: none;
padding: 2px 0px;
}

.SpinButtonContainer {
width: 100%;
min-width: 86px;
padding: 2px;
}

.ArrowBox {
display: block;
float: left;
height: 100%;
border: 1px solid $ms-color-neutralTertiaryAlt;
border-left-width: 0px;
cursor: default;
padding: 0px;
box-sizing: border-box;
}

.SpinButtonWrapper:hover .ArrowBox, .SpinButtonWrapper:hover .Input {
border-color: $ms-color-neutralSecondaryAlt;
outline: 2px dashed transparent;

@media screen and (-ms-high-contrast: active) {
border-color: $ms-color-contrastBlackSelected;
}

@media screen and (-ms-high-contrast: black-on-white) {
border-color: $ms-color-contrastWhiteSelected;
}
}

.labelWrapper {
display: inline-flex;

&.start {
float: left;
margin-right: 10px;
}

&.end {
float: right;
margin-left: 10px;
}

&.top {
margin-bottom: 10px;
}

&.bottom {
margin-top: 10px;
}
}

.SpinButtonIcon {
padding: 2px 5px;
font-size: 20px;
}

.SpinButtonWrapper {
display: flex;
height: 26px;
min-width: 86px;
}

.SpinButtonWrapper.topBottom {
width: 100%;
}

.Input:focus + .ArrowBox {
border-color: $ms-color-themePrimary;
outline: 2px dashed transparent;

@media screen and (-ms-high-contrast: active) {
border-color: $ms-color-contrastBlackSelected;
}

@media screen and (-ms-high-contrast: black-on-white) {
border-color: $ms-color-contrastWhiteSelected;
}
}

.Input.disabled + .ArrowBox {
background-color: $ms-color-neutralLighter;
border-color: $ms-color-neutralLighter;
pointer-events: none;
cursor: default;

@media screen and (-ms-high-contrast: active) {
color: $ms-color-contrastBlackDisabled;
}

@media screen and (-ms-high-contrast: black-on-white) {
color: $ms-color-contrastWhiteDisabled;
}
}

.SpinButtonWrapper:hover .Input:focus {
border-color: $ms-color-themePrimary;
}

.Input {
@include ms-normalize;
border: 1px solid $ms-color-neutralTertiaryAlt;
border-radius: 0;
font-weight: $ms-font-weight-regular;
font-size: $ms-font-size-m;
color: $ms-color-neutralPrimary;
height: 100%;
@include padding(3px, 3px, 4px, 4px);
outline: 0;
text-overflow: ellipsis;
display: block;
float: left;
width: calc(100% - 14px);
min-width: 72px;
border-right-width: 0px;
overflow: hidden;
cursor: text;
user-select: text;

&:focus {
border-color: $ms-color-themePrimary;
outline: 2px dashed transparent;

@media screen and (-ms-high-contrast: active) {
border-color: $ms-color-contrastBlackSelected;
}

@media screen and (-ms-high-contrast: black-on-white) {
border-color: $ms-color-contrastWhiteSelected;
}
}

&::selection {
background-color: $ms-color-themePrimary;
color: $ms-color-white;
}
}

.SpinButtonWrapper:hover .Input.disabled,
.Input.disabled {
background-color: $ms-color-neutralLighter;
border-color: $ms-color-neutralLighter;
pointer-events: none;
cursor: default;
color: $ms-color-neutralTertiaryAlt;

@media screen and (-ms-high-contrast: active) {
color: $ms-color-contrastBlackDisabled;
}

@media screen and (-ms-high-contrast: black-on-white) {
color: $ms-color-contrastWhiteDisabled;
}
}

.Input:hover .UpButton, .Input:hover .DownButton {
background-color: $ms-color-neutralLighter;
}

.SpinButtonWrapper .UpButton, .SpinButtonWrapper .DownButton {
display: block;
height: 50%;
width: 12px;
padding: 0px;
background-color: transparent;
text-align: center;
cursor: default;
font-size: 6px;
color: $ms-color-neutralPrimary;

&:hover {
background-color: $ms-color-neutralLight;
}

&:active {
background-color: $ms-color-themePrimary;
color: $ms-color-white;

@media screen and (-ms-high-contrast: active) {
background-color: $ms-color-contrastBlackSelected;
}

@media screen and (-ms-high-contrast: black-on-white) {
background-color: $ms-color-contrastWhiteSelected;
}
}
}

.UpButton:disabled, .DownButton:disabled {
opacity: 0;

@media screen and (-ms-high-contrast: active) {
color: $ms-color-contrastBlackDisabled;
}

@media screen and (-ms-high-contrast: black-on-white) {
color: $ms-color-contrastWhiteDisabled;
}
}

.SpinButtonWrapper .UpButton.active, .SpinButtonWrapper .DownButton.active {
background-color: $ms-color-themePrimary;
color: $ms-color-white;

@media screen and (-ms-high-contrast: active) {
background-color: $ms-color-contrastBlackSelected;
}

@media screen and (-ms-high-contrast: black-on-white) {
background-color: $ms-color-contrastWhiteSelected;
}
}
Loading