Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/datepicker #644

Merged
merged 42 commits into from
Apr 12, 2018
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
0049577
start of datepicker
snide Mar 29, 2018
85602b3
update datepicker, now works with form controls
snide Apr 5, 2018
f2e0602
more styling
snide Apr 5, 2018
ee79117
better timebox
snide Apr 6, 2018
f17a930
shadows are optional, inline works
snide Apr 9, 2018
307f523
ranges work
snide Apr 9, 2018
fbd5b8c
blacklist certain react-datepicker props, set defaults for others
snide Apr 10, 2018
e4b27d0
more props alignment
snide Apr 10, 2018
d2fc347
cleanup css / prop layer
snide Apr 10, 2018
8391215
docs for states and locale
snide Apr 10, 2018
231dfc7
time selection docs
snide Apr 10, 2018
7b2ce38
validation examples
snide Apr 10, 2018
59b67ff
min and max times
snide Apr 10, 2018
a44b912
excluding date / time docs
snide Apr 10, 2018
5858ca6
cleaning up examples
snide Apr 11, 2018
cd6ea5b
more documentation
snide Apr 11, 2018
5ce2f64
custom inputs
snide Apr 11, 2018
84086fc
some responsive adjustments for mobile
snide Apr 11, 2018
96516eb
cleanup sass, fix errors
snide Apr 11, 2018
bebacf0
fix some bad vars
snide Apr 11, 2018
781854f
utc offset docs
snide Apr 11, 2018
4878220
cleanup
snide Apr 11, 2018
6989e70
filter dates and ranges
snide Apr 11, 2018
a85b32e
clean up date range
snide Apr 11, 2018
194d9ce
alphabatize props
snide Apr 11, 2018
86944e1
fix stupid selector bug
snide Apr 12, 2018
aab86a4
remove form mixins
snide Apr 12, 2018
a072962
comments
snide Apr 12, 2018
1740893
address design feedback
snide Apr 12, 2018
f0eb713
fix goofy border with a box shadow
snide Apr 12, 2018
19e67ba
use clock icon if only time select, format date properly
snide Apr 12, 2018
968e1b6
clean up some more styling, address feedback
snide Apr 12, 2018
96fd063
make time picker dropdown look similar to combo box
snide Apr 12, 2018
aef7b8d
more time only styling
snide Apr 12, 2018
1e53815
update to react-datepicker@1.4.1
snide Apr 12, 2018
cab7fb4
remove constructor, address feedback
snide Apr 12, 2018
1ec01ac
clean up the way errors are returned
snide Apr 12, 2018
3ffc72b
fix props doc error, add props docs
snide Apr 12, 2018
d68e2f6
changelog
snide Apr 12, 2018
43826fc
address feedback
snide Apr 12, 2018
ca03480
pesky outline
snide Apr 12, 2018
9d22f33
docs and borders
snide Apr 12, 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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"prop-types": "^15.6.0",
"react-ace": "^5.5.0",
"react-color": "^2.13.8",
"react-datepicker": "v1.4.1",
"react-input-autosize": "^2.2.1",
"serve": "^6.3.1",
"tabbable": "^1.1.0",
Expand Down
16 changes: 16 additions & 0 deletions src-docs/src/components/guide_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,22 @@ $guideZLevelHighest: $euiZLevel9 + 1000;
}
}

.dpTest__purpleCal {
background: purple;
}

.dpTest__purpleInput {
outline: solid 2px purple;
}

.dpTest__purpleDay {
background: purple;
}

.dpTest__purplePopper {
outline: solid 2px purple;
}


@import "../views/guidelines/index";
@import "guide_section/index";
Expand Down
4 changes: 4 additions & 0 deletions src-docs/src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ import { ComboBoxExample }
import { ContextMenuExample }
from './views/context_menu/context_menu_example';

import { DatePickerExample }
from './views/date_picker/date_picker_example';

import { DelayHideExample }
from './views/delay_hide/delay_hide_example';

Expand Down Expand Up @@ -314,6 +317,7 @@ const navigation = [{
ComboBoxExample,
ColorPickerExample,
CodeEditorExample,
DatePickerExample,
ExpressionExample,
FilterGroupExample,
SearchBarExample,
Expand Down
79 changes: 79 additions & 0 deletions src-docs/src/views/date_picker/classes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import React, {
Component,
} from 'react';

import moment from 'moment';

import {
EuiDatePicker,
EuiFormRow,
EuiSpacer,
} from '../../../../src/components';

export default class extends Component {

constructor(props) {
super(props);

this.state = {
startDate: moment()
};

this.handleChange = this.handleChange.bind(this);
}

handleChange(date) {
this.setState({
startDate: date
});
}

render() {
return (
<div>
<EuiFormRow label="className example">
<EuiDatePicker
selected={this.state.startDate}
showTimeSelect
onChange={this.handleChange}
className="dpTest__purpleInput"
/>
</EuiFormRow>

<EuiSpacer size="m" />

<EuiFormRow label="calendarClassName example">
<EuiDatePicker
selected={this.state.startDate}
showTimeSelect
onChange={this.handleChange}
calendarClassName="dpTest__purpleCal"
/>
</EuiFormRow>

<EuiSpacer size="m" />

<EuiFormRow label="dayClassName example">
<EuiDatePicker
selected={this.state.startDate}
showTimeSelect
onChange={this.handleChange}
dayClassName={date => date.date() < Math.random() * 31 ? 'dpTest__purpleDay' : undefined}
/>
</EuiFormRow>

<EuiSpacer size="m" />

<EuiFormRow label="popperClassName example">
<EuiDatePicker
selected={this.state.startDate}
showTimeSelect
onChange={this.handleChange}
popperClassName="dpTest__purplePopper"
/>
</EuiFormRow>

</div>
);
}
}
63 changes: 63 additions & 0 deletions src-docs/src/views/date_picker/custom_input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import React, {
Component,
} from 'react';

import PropTypes from 'prop-types';

import moment from 'moment';

import {
EuiDatePicker,
EuiButton,
} from '../../../../src/components';

// Should be a component because the datepicker does some ref stuff behind the scenes
// eslint-disable-next-line react/prefer-stateless-function
class ExampleCustomInput extends React.Component {

render () {
return (
<EuiButton
className="example-custom-input"
onClick={this.props.onClick}
>
{this.props.value}
</EuiButton>
)
}
}

ExampleCustomInput.propTypes = {
onClick: PropTypes.func,
value: PropTypes.string
};

// eslint-disable-next-line react/no-multi-comp
export default class extends Component {

constructor(props) {
super(props);

this.state = {
startDate: moment()
};

this.handleChange = this.handleChange.bind(this);
}

handleChange(date) {
this.setState({
startDate: date
});
}

render() {
return (
<EuiDatePicker
selected={this.state.startDate}
onChange={this.handleChange}
customInput={<ExampleCustomInput />}
/>
);
}
}
40 changes: 40 additions & 0 deletions src-docs/src/views/date_picker/date_picker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React, {
Component,
} from 'react';

import moment from 'moment';

import {
EuiDatePicker,
EuiFormRow,
} from '../../../../src/components';

export default class extends Component {

constructor(props) {
super(props);

this.state = {
startDate: moment()
};

this.handleChange = this.handleChange.bind(this);
}

handleChange(date) {
this.setState({
startDate: date
});
}

render() {
return (
<EuiFormRow label="Select a date">
<EuiDatePicker
selected={this.state.startDate}
onChange={this.handleChange}
/>
</EuiFormRow>
);
}
}
Loading