diff --git a/src/DatePicker/index.tsx b/src/DatePicker/index.tsx index feee1602..91b99f54 100644 --- a/src/DatePicker/index.tsx +++ b/src/DatePicker/index.tsx @@ -5,7 +5,7 @@ import { codes } from "keycode"; import AddBlurEvent from "../common/AddBlurEvent"; import Separator from "../Separator"; import IconButton from "../IconButton"; -import ElementState from "../ElementState"; +import PseudoClasses from "../PseudoClasses"; import ListView from "../ListView"; import scrollToYEasing from "../common/browser/scrollToYEasing"; import { dayList, monthList, getLastDayOfMonth } from "../common/date.utils"; @@ -65,7 +65,7 @@ export class DatePicker extends React.Component { this.setState({ showPicker: false @@ -153,6 +153,7 @@ export class DatePicker extends React.Component; @@ -176,19 +181,22 @@ export class DatePicker extends React.Component this.elementState = elementState} + const normalRender = ( +
{ + if (!theme.useInlineStyle) { + this.pseudoClasses = { rootElm } as any; + } + }} > -
-
-
+
+
this.monthListView = monthListView} - style={styles.listView} + style={inlineStyles.listView} listItemStyle={styles.listItem} defaultFocusListIndex={currMonth} listSource={monthArray} @@ -198,7 +206,7 @@ export class DatePicker extends React.Component this.dateListView = dateListView} - style={styles.listView} + style={inlineStyles.listView} listItemStyle={styles.listItem} defaultFocusListIndex={this.dateIndex} listSource={dateArray} @@ -208,7 +216,7 @@ export class DatePicker extends React.Component this.yearListView = yearListView} - style={styles.listView} + style={inlineStyles.listView} listItemStyle={styles.listItem} defaultFocusListIndex={this.yearIndex} listSource={yearArray} @@ -219,7 +227,7 @@ export class DatePicker extends React.Component
{ onChangeDate(currDate); @@ -229,7 +237,7 @@ export class DatePicker extends React.Component { this.setState({ currDate: this.prevDate, showPicker: false }); @@ -240,28 +248,36 @@ export class DatePicker extends React.Component
{monthList[currMonth]} {separator} {currDateNumb} {separator} {currYear}
- ); + return theme.useInlineStyle ? ( + this.pseudoClasses = pseudoClasses} + > + {normalRender} + + ) : normalRender; } } @@ -303,6 +319,9 @@ function getStyles(datePicker: DatePicker): { lineHeight: `${inputItemHeight}px`, position: "relative", transition: "all .25s ease-in-out", + "&:hover": { + boxShadow: `inset 0 0 0 2px ${theme.baseMediumHigh}` + }, ...style }), pickerModal: prefixStyle({ diff --git a/src/PseudoClasses.tsx b/src/PseudoClasses.tsx index bc9191fa..309b5302 100644 --- a/src/PseudoClasses.tsx +++ b/src/PseudoClasses.tsx @@ -10,6 +10,8 @@ export class PseudoClasses extends React.Component { static contextTypes = { theme: PropTypes.object }; context: { theme: ReactUWP.ThemeType }; + rootElm: HTMLElement; + render () { const { style, children, ...attributes } = this.props; @@ -18,6 +20,7 @@ export class PseudoClasses extends React.Component { return ( this.rootElm = elementState.rootElm} style={primaryObject} {...{ hoverStyle: secondaryObject["&:hover"],