Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _onTouchMove = (ev: React.TouchEvent) => {
const isRtl = getRTL();
const touch = ev.touches[0];
if (touch && this._initialTouchX !== undefined && touch.clientX !== this._initialTouchX) {
if ((touch.clientX - this._initialTouchX) * (isRtl ? -1 : 1) < 0) {
// swipe right
this._onSelectNextDateRange();
} else {
// swipe left
this._onSelectPrevDateRange();
}
this._initialTouchX = undefined;
}
};
}
<button type="button" title="{" disabled="{!allFocusable">
</button>
<div role="grid">
{rowIndexes.map((rowNum: number) => {
const monthsForRow = strings.shortMonths.slice(rowNum * MONTHS_PER_ROW, (rowNum + 1) * MONTHS_PER_ROW);
return (
<div role="row">
{monthsForRow.map((month: string, index: number) => {
const monthIndex = rowNum * MONTHS_PER_ROW + index;
const indexedMonth = setMonth(navigatedDate, monthIndex);
const isCurrentMonth = this._isCurrentMonth(monthIndex, navigatedDate.getFullYear(), today!);
const isNavigatedMonth = navigatedDate.getMonth() === monthIndex;
const isSelectedMonth = selectedDate.getMonth() === monthIndex;
const isSelectedYear = selectedDate.getFullYear() === navigatedDate.getFullYear();</div></div>
const roundedTopLeft = !above && !left;
const roundedTopRight = !above && !right;
const roundedBottomLeft = !below && !left;
const roundedBottomRight = !below && !right;
if (roundedTopLeft) {
style = getRTL() ? style.concat(classNames.topRightCornerDate + ' ') : style.concat(classNames.topLeftCornerDate + ' ');
}
if (roundedTopRight) {
style = getRTL() ? style.concat(classNames.topLeftCornerDate + ' ') : style.concat(classNames.topRightCornerDate + ' ');
}
if (roundedBottomLeft) {
style = getRTL() ? style.concat(classNames.bottomRightCornerDate + ' ') : style.concat(classNames.bottomLeftCornerDate + ' ');
}
if (roundedBottomRight) {
style = getRTL() ? style.concat(classNames.bottomLeftCornerDate + ' ') : style.concat(classNames.bottomRightCornerDate + ' ');
}
return style;
}
private moveFocusRight(): boolean {
const shouldWrap = this.shouldWrapFocus(this._activeElement as HTMLElement, NO_HORIZONTAL_WRAP)
if (
this.moveFocus(
!getRTL(),
(activeRect: ClientRect, targetRect: ClientRect) => {
let distance = -1
if (
targetRect.top < activeRect.bottom &&
targetRect.left >= activeRect.left &&
this.props.direction !== FocusZoneDirection.vertical
) {
distance = targetRect.left - activeRect.left
} else if (!shouldWrap) {
distance = LARGE_NEGATIVE_DISTANCE_FROM_CENTER
}
return distance
},
undefined /*ev*/,
private moveFocusLeft(): boolean {
const shouldWrap = this.shouldWrapFocus(this._activeElement as HTMLElement, NO_HORIZONTAL_WRAP)
if (
this.moveFocus(
getRTL(),
(activeRect: ClientRect, targetRect: ClientRect) => {
let distance = -1
if (
targetRect.bottom > activeRect.top &&
targetRect.right <= activeRect.right &&
this.props.direction !== FocusZoneDirection.vertical
) {
distance = activeRect.right - targetRect.right
} else {
if (!shouldWrap) {
distance = LARGE_NEGATIVE_DISTANCE_FROM_CENTER
}
}
return distance
boxSizing: 'border-box',
background: thumbBackgroundColor,
display: 'block',
width: 16,
height: 16,
position: 'absolute'
},
vertical
? {
left: -6,
margin: '0 auto',
transform: 'translateY(8px)'
}
: {
top: -6,
transform: getRTL(theme) ? 'translateX(50%)' : 'translateX(-50%)'
},
showTransitions && {
transition: `left ${AnimationVariables.durationValue3} ${AnimationVariables.easeFunction1}`
},
disabled && {
borderColor: thumbDisabledBorderColor,
selectors: {
[HighContrastSelector]: {
borderColor: 'GrayText'
}
}
}
],
line: [
classNames.line,
{