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

Update upstream #16

Merged
merged 41 commits into from
Nov 23, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
9f89f66
[DateInput] Add support for datepicker clearButtonText and todayButto…
rfbotto Oct 15, 2018
dac7bc2
include integrity hashes in yarn lock (#3035)
rgbkrk Oct 17, 2018
b91ea52
Publish
Oct 19, 2018
dbf9a98
Publish
Oct 19, 2018
9145edd
Fix reset of active item when query hasn't changed (#3072)
jscheiny Oct 25, 2018
df5d488
[DateInput] close on tab key press (#3038)
cetra3 Oct 25, 2018
15f8a82
Publish
Oct 25, 2018
2783834
Correct Table reference to HTMLTable (#3075)
marcrocny Oct 25, 2018
df02b5c
🔧 fix dependencies (#3078)
giladgray Oct 25, 2018
945b7f1
fix icons alignment (#3102)
giladgray Oct 30, 2018
a0279ac
[Breadcrumb] Add current prop (#3104)
invliD Oct 31, 2018
55ca38c
Render breadcrumb children (#3105)
invliD Oct 31, 2018
484cb76
fix checkbox indicator display (#3113)
giladgray Nov 1, 2018
4e93d2f
Only set default font-family on body selector (#3115)
adidahiya Nov 1, 2018
4b8aa49
[FormGroup] add contentClassName and style props (#3120)
giladgray Nov 1, 2018
e4905b3
[Portal] add container prop (#3045)
KochiyaOcean Nov 1, 2018
567dd08
add isotest for className prop (#3119)
giladgray Nov 1, 2018
f8c0b73
[Tag] fix line-height for centering (#3117)
giladgray Nov 1, 2018
be77356
fix label documentation example (#3087)
mattacus Nov 1, 2018
31a7d0c
added new icon (#3052)
pkwi Nov 1, 2018
dcad422
[table] Perf improvements with selections (#2005)
mcintyret Nov 2, 2018
91d88e5
remove unused logo styles from navbar (#3123)
giladgray Nov 2, 2018
b40b5a1
[Breadcrumbs] Add new component (#3106)
invliD Nov 2, 2018
0b1fc29
Publish
Nov 2, 2018
8cf3542
fix disappearing caret on focus of HTMLSelect in ControlGroup (fixes …
jbach Nov 15, 2018
3139c0f
Single Month Only Prop in DateRangePicker (#3142)
nileshr Nov 15, 2018
110deb8
Allow users to browse omnibar options without query (#3130)
gnestor Nov 15, 2018
aae9532
Using tagName JSX variable for MenuItem (#3061)
barkermn01 Nov 15, 2018
2711eb2
[Overlay] add portalClassName to IOverlayableProps (#3148)
giladgray Nov 15, 2018
650c2f7
fix HTML_TABLE_CONDENSED name (reverts 3.x break) (#3147)
giladgray Nov 15, 2018
412f0e3
Don't clear TagInput inputValue state if controlled (#3137)
ericjeney Nov 15, 2018
8ee44a7
remove margin on heading-only callouts (#3157)
giladgray Nov 15, 2018
20c7897
PopoverPosition = Position + auto values (#3156)
giladgray Nov 15, 2018
12d1729
[Select] Flag to optionally scroll to active item for select componen…
jscheiny Nov 15, 2018
1a724f5
docs edits (#3161)
giladgray Nov 16, 2018
6fc03f3
[tslint] blueprint-html-components fixer! (#3162)
giladgray Nov 16, 2018
708cd04
ts-lint --fix (#3159)
giladgray Nov 16, 2018
ca4ea58
relaxed typings for optional JSX.Elements (#3118)
giladgray Nov 16, 2018
64c76fc
[Popover] add boundary prop for easier modifiers (#3149)
giladgray Nov 16, 2018
2dc2d1f
Publish
Nov 16, 2018
0d95aa2
Merge branch 'develop' of github.com:palantir/blueprint into updateUp…
crispamares Nov 23, 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
Prev Previous commit
Next Next commit
Single Month Only Prop in DateRangePicker (palantir#3142)
* allow singleMonthlyOnly in DateRangePicker

* updated docs comment

* added singleMonthOnly props in DateRangeInput

* added DateRangeInput test to ensure prop is passed

* updated documentation and example labels
  • Loading branch information
nileshr authored and giladgray committed Nov 15, 2018
commit 3139c0f3d550c46fba84087c3b157d2bb0f8e97a
7 changes: 7 additions & 0 deletions packages/datetime/src/dateRangeInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ export interface IDateRangeInputProps extends IDatePickerBaseProps, IDateFormatP
*/
shortcuts?: boolean | IDateRangeShortcut[];

/**
* Whether to show only a single month calendar.
* @default false
*/
singleMonthOnly?: boolean;

/**
* Props to pass to the start-date [input group](#core/components/text-inputs.input-group).
* `disabled` and `value` will be ignored in favor of the top-level props on this component.
Expand Down Expand Up @@ -202,6 +208,7 @@ export class DateRangeInput extends AbstractPureComponent<IDateRangeInputProps,
popoverProps: {},
selectAllOnFocus: false,
shortcuts: true,
singleMonthOnly: false,
startInputProps: {},
};

Expand Down
11 changes: 9 additions & 2 deletions packages/datetime/src/dateRangePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ export interface IDateRangePickerProps extends IDatePickerBaseProps, IProps {
*/
shortcuts?: boolean | IDateRangeShortcut[];

/**
* Whether to show only a single month calendar.
* @default false
*/
singleMonthOnly?: boolean;

/**
* The currently selected `DateRange`.
* If this prop is provided, the component acts in a controlled manner.
Expand All @@ -125,6 +131,7 @@ export class DateRangePicker extends AbstractPureComponent<IDateRangePickerProps
minDate: getDefaultMinDate(),
reverseMonthAndYearMenus: false,
shortcuts: true,
singleMonthOnly: false,
timePickerProps: {},
};

Expand Down Expand Up @@ -194,8 +201,8 @@ export class DateRangePicker extends AbstractPureComponent<IDateRangePickerProps
}

public render() {
const { className, contiguousCalendarMonths } = this.props;
const isShowingOneMonth = DateUtils.areSameMonth(this.props.minDate, this.props.maxDate);
const { className, contiguousCalendarMonths, singleMonthOnly } = this.props;
const isShowingOneMonth = singleMonthOnly || DateUtils.areSameMonth(this.props.minDate, this.props.maxDate);

const classes = classNames(DateClasses.DATEPICKER, DateClasses.DATERANGEPICKER, className, {
[DateClasses.DATERANGEPICKER_CONTIGUOUS]: contiguousCalendarMonths,
Expand Down
6 changes: 6 additions & 0 deletions packages/datetime/test/dateRangeInputTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,12 @@ describe("<DateRangeInput>", () => {
expect(root.find(DateRangePicker).prop("contiguousCalendarMonths")).to.be.false;
});

it("accepts singleMonthOnly prop and passes it to the date range picker", () => {
const { root } = wrap(<DateRangeInput {...DATE_FORMAT} singleMonthOnly={false} />);
root.setState({ isOpen: true });
expect(root.find(DateRangePicker).prop("singleMonthOnly")).to.be.false;
});

it("accepts shortcuts prop and passes it to the date range picker", () => {
const { root } = wrap(<DateRangeInput {...DATE_FORMAT} shortcuts={false} />);
root.setState({ isOpen: true });
Expand Down
5 changes: 5 additions & 0 deletions packages/datetime/test/dateRangePickerTests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@ describe("<DateRangePicker>", () => {
assert.isTrue(wrapper.find(Button).every({ disabled: true }));
});

it("only shows one calendar when singleMonthOnly is set", () => {
const { right } = render({ singleMonthOnly: true });
assert.isFalse(right.wrapper.exists());
});

it("left calendar is bound between minDate and (maxDate - 1 month)", () => {
const minDate = new Date(2015, Months.JANUARY, 1);
const maxDate = new Date(2015, Months.DECEMBER, 15);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export interface IDateRangeInputExampleState {
range: DateRange;
reverseMonthAndYearMenus: boolean;
selectAllOnFocus: boolean;
shortcuts: boolean;
singleMonthOnly: boolean;
}

export class DateRangeInputExample extends React.PureComponent<IExampleProps, IDateRangeInputExampleState> {
Expand All @@ -33,6 +35,8 @@ export class DateRangeInputExample extends React.PureComponent<IExampleProps, ID
range: [null, null],
reverseMonthAndYearMenus: false,
selectAllOnFocus: false,
shortcuts: true,
singleMonthOnly: false,
};

private toggleContiguous = handleBooleanChange(contiguous => {
Expand All @@ -45,6 +49,8 @@ export class DateRangeInputExample extends React.PureComponent<IExampleProps, ID
private toggleSelection = handleBooleanChange(closeOnSelection => this.setState({ closeOnSelection }));
private toggleSelectAllOnFocus = handleBooleanChange(selectAllOnFocus => this.setState({ selectAllOnFocus }));
private toggleSingleDay = handleBooleanChange(allowSingleDayRange => this.setState({ allowSingleDayRange }));
private toggleSingleMonth = handleBooleanChange(singleMonthOnly => this.setState({ singleMonthOnly }));
private toggleShortcuts = handleBooleanChange(shortcuts => this.setState({ shortcuts }));

public render() {
const { format, range, ...spreadProps } = this.state;
Expand All @@ -65,6 +71,12 @@ export class DateRangeInputExample extends React.PureComponent<IExampleProps, ID
label="Allow single day range"
onChange={this.toggleSingleDay}
/>
<Switch
checked={this.state.singleMonthOnly}
label="Single month only"
onChange={this.toggleSingleMonth}
/>
<Switch checked={this.state.shortcuts} label="Show shortcuts" onChange={this.toggleShortcuts} />
<Switch
checked={this.state.closeOnSelection}
label="Close on selection"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { PrecisionSelect } from "./common/precisionSelect";

export interface IDateRangePickerExampleState {
allowSingleDayRange?: boolean;
singleMonthOnly?: boolean;
contiguousCalendarMonths?: boolean;
dateRange?: DateRange;
maxDateIndex?: number;
Expand Down Expand Up @@ -70,6 +71,7 @@ export class DateRangePickerExample extends React.PureComponent<IExampleProps, I
minDateIndex: 0,
reverseMonthAndYearMenus: false,
shortcuts: true,
singleMonthOnly: false,
};

private handleMaxDateIndexChange = handleNumberChange(maxDateIndex => this.setState({ maxDateIndex }));
Expand All @@ -82,6 +84,7 @@ export class DateRangePickerExample extends React.PureComponent<IExampleProps, I
this.setState({ reverseMonthAndYearMenus }),
);
private toggleSingleDay = handleBooleanChange(allowSingleDayRange => this.setState({ allowSingleDayRange }));
private toggleSingleMonth = handleBooleanChange(singleMonthOnly => this.setState({ singleMonthOnly }));
private toggleShortcuts = handleBooleanChange(shortcuts => this.setState({ shortcuts }));
private toggleContiguousCalendarMonths = handleBooleanChange(contiguousCalendarMonths => {
this.setState({ contiguousCalendarMonths });
Expand Down Expand Up @@ -115,6 +118,11 @@ export class DateRangePickerExample extends React.PureComponent<IExampleProps, I
label="Allow single day range"
onChange={this.toggleSingleDay}
/>
<Switch
checked={this.state.singleMonthOnly}
label="Single month only"
onChange={this.toggleSingleMonth}
/>
<Switch
checked={this.state.contiguousCalendarMonths}
label="Constrain to contiguous months"
Expand Down