first commit

This commit is contained in:
Stefan Hacker
2026-04-03 09:38:48 +02:00
commit 37ad745546
47450 changed files with 3120798 additions and 0 deletions
@@ -0,0 +1,39 @@
import * as React from 'react';
import { AnimationDirection } from '../Calendar/Calendar.types';
import type { IWeeklyDayPickerProps } from './WeeklyDayPicker.types';
import type { JSXElement } from '@fluentui/utilities';
export interface IWeeklyDayPickerState {
/** The currently focused date in the week picker, but not necessarily selected */
navigatedDate: Date;
/** The currently selected date in the calendar */
selectedDate: Date;
/** Tracking whether we just toggled showFullMonth */
previousShowFullMonth: boolean;
/** Whether to animate veritcally or horizontally */
animationDirection: AnimationDirection;
}
export declare class WeeklyDayPickerBase extends React.Component<IWeeklyDayPickerProps, IWeeklyDayPickerState> {
static defaultProps: IWeeklyDayPickerProps;
private _dayGrid;
private _focusOnUpdate;
private _initialTouchX;
static getDerivedStateFromProps(nextProps: Readonly<IWeeklyDayPickerProps>, prevState: Readonly<IWeeklyDayPickerState>): Partial<IWeeklyDayPickerState> | null;
constructor(props: IWeeklyDayPickerProps);
focus(): void;
render(): JSXElement;
componentDidUpdate(): void;
private _onSelectDate;
private _onNavigateDate;
private _renderPreviousWeekNavigationButton;
private _renderNextWeekNavigationButton;
private _onSelectPrevDateRange;
private _onSelectNextDateRange;
private _navigateDate;
private _onWrapperKeyDown;
private _onButtonKeyDown;
private _onTouchStart;
private _onTouchMove;
private _createPreviousWeekAriaLabel;
private _createNextWeekAriaLabel;
private _formatDateRange;
}
@@ -0,0 +1,229 @@
define(["require", "exports", "tslib", "react", "@fluentui/utilities", "../Calendar/Calendar.types", "../CalendarDayGrid/CalendarDayGrid", "@fluentui/date-time-utilities", "../../Icon", "./defaults"], function (require, exports, tslib_1, React, utilities_1, Calendar_types_1, CalendarDayGrid_1, date_time_utilities_1, Icon_1, defaults_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WeeklyDayPickerBase = void 0;
var getClassNames = (0, utilities_1.classNamesFunction)();
var WeeklyDayPickerBase = /** @class */ (function (_super) {
tslib_1.__extends(WeeklyDayPickerBase, _super);
function WeeklyDayPickerBase(props) {
var _this = _super.call(this, props) || this;
_this._dayGrid = React.createRef();
_this._onSelectDate = function (date) {
var onSelectDate = _this.props.onSelectDate;
// don't set the navigated date on selection because selection never causes navigation
_this.setState({
selectedDate: date,
});
_this._focusOnUpdate = true;
if (onSelectDate) {
onSelectDate(date);
}
};
_this._onNavigateDate = function (date, focusOnNavigatedDay) {
var onNavigateDate = _this.props.onNavigateDate;
_this.setState({
navigatedDate: date,
});
_this._focusOnUpdate = focusOnNavigatedDay;
if (onNavigateDate) {
onNavigateDate(date);
}
};
_this._renderPreviousWeekNavigationButton = function (classNames) {
var _a;
var _b = _this.props, minDate = _b.minDate, firstDayOfWeek = _b.firstDayOfWeek, navigationIcons = _b.navigationIcons;
var navigatedDate = _this.state.navigatedDate;
var leftNavigationIcon = (0, utilities_1.getRTL)() ? navigationIcons.rightNavigation : navigationIcons.leftNavigation;
// determine if previous week in bounds
var prevWeekInBounds = minDate
? (0, date_time_utilities_1.compareDatePart)(minDate, (0, date_time_utilities_1.getStartDateOfWeek)(navigatedDate, firstDayOfWeek)) < 0
: true;
return (React.createElement("button", { className: (0, utilities_1.css)(classNames.navigationIconButton, (_a = {},
_a[classNames.disabledStyle] = !prevWeekInBounds,
_a)), disabled: !prevWeekInBounds, "aria-disabled": !prevWeekInBounds, onClick: prevWeekInBounds ? _this._onSelectPrevDateRange : undefined, onKeyDown: prevWeekInBounds ? _this._onButtonKeyDown(_this._onSelectPrevDateRange) : undefined, title: _this._createPreviousWeekAriaLabel(), type: "button" },
React.createElement(Icon_1.Icon, { iconName: leftNavigationIcon })));
};
_this._renderNextWeekNavigationButton = function (classNames) {
var _a;
var _b = _this.props, maxDate = _b.maxDate, firstDayOfWeek = _b.firstDayOfWeek, navigationIcons = _b.navigationIcons;
var navigatedDate = _this.state.navigatedDate;
var rightNavigationIcon = (0, utilities_1.getRTL)() ? navigationIcons.leftNavigation : navigationIcons.rightNavigation;
// determine if next week in bounds
var nextWeekInBounds = maxDate
? (0, date_time_utilities_1.compareDatePart)((0, date_time_utilities_1.addDays)((0, date_time_utilities_1.getStartDateOfWeek)(navigatedDate, firstDayOfWeek), 7), maxDate) < 0
: true;
return (React.createElement("button", { className: (0, utilities_1.css)(classNames.navigationIconButton, (_a = {},
_a[classNames.disabledStyle] = !nextWeekInBounds,
_a)), disabled: !nextWeekInBounds, "aria-disabled": !nextWeekInBounds, onClick: nextWeekInBounds ? _this._onSelectNextDateRange : undefined, onKeyDown: nextWeekInBounds ? _this._onButtonKeyDown(_this._onSelectNextDateRange) : undefined, title: _this._createNextWeekAriaLabel(), type: "button" },
React.createElement(Icon_1.Icon, { iconName: rightNavigationIcon })));
};
_this._onSelectPrevDateRange = function () {
if (_this.props.showFullMonth) {
_this._navigateDate((0, date_time_utilities_1.addMonths)(_this.state.navigatedDate, -1));
}
else {
_this._navigateDate((0, date_time_utilities_1.addDays)(_this.state.navigatedDate, -7));
}
};
_this._onSelectNextDateRange = function () {
if (_this.props.showFullMonth) {
_this._navigateDate((0, date_time_utilities_1.addMonths)(_this.state.navigatedDate, 1));
}
else {
_this._navigateDate((0, date_time_utilities_1.addDays)(_this.state.navigatedDate, 7));
}
};
_this._navigateDate = function (date) {
_this.setState({
navigatedDate: date,
});
if (_this.props.onNavigateDate) {
_this.props.onNavigateDate(date);
}
};
_this._onWrapperKeyDown = function (ev) {
// eslint-disable-next-line @typescript-eslint/no-deprecated
switch (ev.which) {
case utilities_1.KeyCodes.enter:
ev.preventDefault();
break;
case utilities_1.KeyCodes.backspace:
ev.preventDefault();
break;
default:
break;
}
};
_this._onButtonKeyDown = function (callback) {
return function (ev) {
// eslint-disable-next-line @typescript-eslint/no-deprecated
switch (ev.which) {
case utilities_1.KeyCodes.enter:
callback();
break;
}
};
};
_this._onTouchStart = function (ev) {
var touch = ev.touches[0];
if (touch) {
_this._initialTouchX = touch.clientX;
}
};
_this._onTouchMove = function (ev) {
var isRtl = (0, utilities_1.getRTL)();
var 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;
}
};
_this._createPreviousWeekAriaLabel = function () {
var _a = _this.props, strings = _a.strings, showFullMonth = _a.showFullMonth, firstDayOfWeek = _a.firstDayOfWeek;
var navigatedDate = _this.state.navigatedDate;
var ariaLabel = undefined;
if (showFullMonth && strings.prevMonthAriaLabel) {
ariaLabel = strings.prevMonthAriaLabel + ' ' + strings.months[(0, date_time_utilities_1.addMonths)(navigatedDate, -1).getMonth()];
}
else if (!showFullMonth && strings.prevWeekAriaLabel) {
var firstDayOfPreviousWeek = (0, date_time_utilities_1.getStartDateOfWeek)((0, date_time_utilities_1.addDays)(navigatedDate, -7), firstDayOfWeek);
var lastDayOfPreviousWeek = (0, date_time_utilities_1.addDays)(firstDayOfPreviousWeek, 6);
ariaLabel =
strings.prevWeekAriaLabel + ' ' + _this._formatDateRange(firstDayOfPreviousWeek, lastDayOfPreviousWeek);
}
return ariaLabel;
};
_this._createNextWeekAriaLabel = function () {
var _a = _this.props, strings = _a.strings, showFullMonth = _a.showFullMonth, firstDayOfWeek = _a.firstDayOfWeek;
var navigatedDate = _this.state.navigatedDate;
var ariaLabel = undefined;
if (showFullMonth && strings.nextMonthAriaLabel) {
ariaLabel = strings.nextMonthAriaLabel + ' ' + strings.months[(0, date_time_utilities_1.addMonths)(navigatedDate, 1).getMonth()];
}
else if (!showFullMonth && strings.nextWeekAriaLabel) {
var firstDayOfNextWeek = (0, date_time_utilities_1.getStartDateOfWeek)((0, date_time_utilities_1.addDays)(navigatedDate, 7), firstDayOfWeek);
var lastDayOfNextWeek = (0, date_time_utilities_1.addDays)(firstDayOfNextWeek, 6);
ariaLabel = strings.nextWeekAriaLabel + ' ' + _this._formatDateRange(firstDayOfNextWeek, lastDayOfNextWeek);
}
return ariaLabel;
};
_this._formatDateRange = function (startDate, endDate) {
var _a = _this.props, dateTimeFormatter = _a.dateTimeFormatter, strings = _a.strings;
return "".concat(dateTimeFormatter === null || dateTimeFormatter === void 0 ? void 0 : dateTimeFormatter.formatMonthDayYear(startDate, strings), " - ").concat(dateTimeFormatter === null || dateTimeFormatter === void 0 ? void 0 : dateTimeFormatter.formatMonthDayYear(endDate, strings));
};
(0, utilities_1.initializeComponentRef)(_this);
var currentDate = props.initialDate && !isNaN(props.initialDate.getTime()) ? props.initialDate : props.today || new Date();
_this.state = {
selectedDate: currentDate,
navigatedDate: currentDate,
previousShowFullMonth: !!props.showFullMonth,
animationDirection: props.animationDirection,
};
_this._focusOnUpdate = false;
return _this;
}
WeeklyDayPickerBase.getDerivedStateFromProps = function (nextProps, prevState) {
var currentDate = nextProps.initialDate && !isNaN(nextProps.initialDate.getTime())
? nextProps.initialDate
: nextProps.today || new Date();
var showFullMonth = !!nextProps.showFullMonth;
var newAnimationDirection = showFullMonth !== prevState.previousShowFullMonth ? Calendar_types_1.AnimationDirection.Vertical : Calendar_types_1.AnimationDirection.Horizontal;
if (!(0, date_time_utilities_1.compareDates)(currentDate, prevState.selectedDate)) {
return {
selectedDate: currentDate,
navigatedDate: currentDate,
previousShowFullMonth: showFullMonth,
animationDirection: newAnimationDirection,
};
}
return {
selectedDate: currentDate,
navigatedDate: prevState.navigatedDate,
previousShowFullMonth: showFullMonth,
animationDirection: newAnimationDirection,
};
};
WeeklyDayPickerBase.prototype.focus = function () {
if (this._dayGrid && this._dayGrid.current) {
this._dayGrid.current.focus();
}
};
WeeklyDayPickerBase.prototype.render = function () {
var _a = this.props, strings = _a.strings, dateTimeFormatter = _a.dateTimeFormatter, firstDayOfWeek = _a.firstDayOfWeek, minDate = _a.minDate, maxDate = _a.maxDate, restrictedDates = _a.restrictedDates, today = _a.today, styles = _a.styles, theme = _a.theme, className = _a.className, showFullMonth = _a.showFullMonth, weeksToShow = _a.weeksToShow, calendarDayGridProps = tslib_1.__rest(_a, ["strings", "dateTimeFormatter", "firstDayOfWeek", "minDate", "maxDate", "restrictedDates", "today", "styles", "theme", "className", "showFullMonth", "weeksToShow"]);
var classNames = getClassNames(styles, {
theme: theme,
className: className,
});
return (React.createElement("div", { className: classNames.root, onKeyDown: this._onWrapperKeyDown, onTouchStart: this._onTouchStart, onTouchMove: this._onTouchMove, "aria-expanded": showFullMonth },
this._renderPreviousWeekNavigationButton(classNames),
React.createElement(CalendarDayGrid_1.CalendarDayGrid, tslib_1.__assign({ styles: styles, componentRef: this._dayGrid, strings: strings, selectedDate: this.state.selectedDate, navigatedDate: this.state.navigatedDate, firstDayOfWeek: firstDayOfWeek, firstWeekOfYear: date_time_utilities_1.FirstWeekOfYear.FirstDay, dateRangeType: date_time_utilities_1.DateRangeType.Day, weeksToShow: showFullMonth ? weeksToShow : 1, dateTimeFormatter: dateTimeFormatter, minDate: minDate, maxDate: maxDate, restrictedDates: restrictedDates, onSelectDate: this._onSelectDate, onNavigateDate: this._onNavigateDate, today: today, lightenDaysOutsideNavigatedMonth: showFullMonth, animationDirection: this.state.animationDirection }, calendarDayGridProps)),
this._renderNextWeekNavigationButton(classNames)));
};
WeeklyDayPickerBase.prototype.componentDidUpdate = function () {
if (this._focusOnUpdate) {
this.focus();
this._focusOnUpdate = false;
}
};
WeeklyDayPickerBase.defaultProps = {
onSelectDate: undefined,
initialDate: undefined,
today: new Date(),
firstDayOfWeek: date_time_utilities_1.DayOfWeek.Sunday,
strings: defaults_1.defaultWeeklyDayPickerStrings,
navigationIcons: defaults_1.defaultWeeklyDayPickerNavigationIcons,
dateTimeFormatter: date_time_utilities_1.DEFAULT_DATE_FORMATTING,
animationDirection: Calendar_types_1.AnimationDirection.Horizontal,
};
return WeeklyDayPickerBase;
}(React.Component));
exports.WeeklyDayPickerBase = WeeklyDayPickerBase;
});
//# sourceMappingURL=WeeklyDayPicker.base.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,3 @@
import * as React from 'react';
import type { IWeeklyDayPickerProps } from './WeeklyDayPicker.types';
export declare const WeeklyDayPicker: React.FunctionComponent<IWeeklyDayPickerProps>;
@@ -0,0 +1,7 @@
define(["require", "exports", "./WeeklyDayPicker.base", "./WeeklyDayPicker.styles", "../../Utilities"], function (require, exports, WeeklyDayPicker_base_1, WeeklyDayPicker_styles_1, Utilities_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WeeklyDayPicker = void 0;
exports.WeeklyDayPicker = (0, Utilities_1.styled)(WeeklyDayPicker_base_1.WeeklyDayPickerBase, WeeklyDayPicker_styles_1.styles, undefined, { scope: 'WeeklyDayPicker' });
});
//# sourceMappingURL=WeeklyDayPicker.js.map
@@ -0,0 +1 @@
{"version":3,"file":"WeeklyDayPicker.js","sourceRoot":"../src/","sources":["components/WeeklyDayPicker/WeeklyDayPicker.tsx"],"names":[],"mappings":";;;;IAMa,QAAA,eAAe,GAAmD,IAAA,kBAAM,EACnF,0CAAmB,EACnB,+BAAM,EACN,SAAS,EACT,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAC7B,CAAC","sourcesContent":["import * as React from 'react';\nimport { WeeklyDayPickerBase } from './WeeklyDayPicker.base';\nimport { styles } from './WeeklyDayPicker.styles';\nimport { styled } from '../../Utilities';\nimport type { IWeeklyDayPickerProps } from './WeeklyDayPicker.types';\n\nexport const WeeklyDayPicker: React.FunctionComponent<IWeeklyDayPickerProps> = styled(\n WeeklyDayPickerBase,\n styles,\n undefined,\n { scope: 'WeeklyDayPicker' },\n);\n"]}
@@ -0,0 +1,2 @@
import type { IWeeklyDayPickerStyleProps, IWeeklyDayPickerStyles } from './WeeklyDayPicker.types';
export declare const styles: (props: IWeeklyDayPickerStyleProps) => IWeeklyDayPickerStyles;
@@ -0,0 +1,87 @@
define(["require", "exports", "@fluentui/style-utilities", "@fluentui/utilities"], function (require, exports, style_utilities_1, utilities_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.styles = void 0;
var GlobalClassNames = {
root: 'ms-WeeklyDayPicker-root',
};
var styles = function (props) {
var _a;
var className = props.className, theme = props.theme;
var palette = theme.palette;
var classNames = (0, style_utilities_1.getGlobalClassNames)(GlobalClassNames, theme);
return {
root: [
classNames.root,
style_utilities_1.normalize,
{
width: 220,
padding: 12,
boxSizing: 'content-box',
display: 'flex',
alignItems: 'center',
flexDirection: 'row',
},
className,
],
dayButton: {
borderRadius: '100%',
},
dayIsToday: {},
dayCell: {
borderRadius: '100%!important',
},
daySelected: {},
navigationIconButton: [
(0, style_utilities_1.getFocusStyle)(theme, { inset: 0 }),
{
width: 12,
minWidth: 12,
height: 0,
overflow: 'hidden',
padding: 0,
margin: 0,
border: 'none',
display: 'flex',
alignItems: 'center',
backgroundColor: palette.neutralLighter,
fontSize: style_utilities_1.FontSizes.small,
fontFamily: 'inherit',
selectors: (_a = {},
// eslint-disable-next-line @fluentui/max-len
_a[".".concat(classNames.root, ":hover &, .").concat(utilities_1.IsFocusVisibleClassName, " .").concat(classNames.root, ":focus &, :host(.").concat(utilities_1.IsFocusVisibleClassName, ") .").concat(classNames.root, ":focus &, ") +
".".concat(utilities_1.IsFocusVisibleClassName, " &:focus, :host(.").concat(utilities_1.IsFocusVisibleClassName, ") &:focus")] = {
height: 53,
minHeight: 12,
overflow: 'initial',
},
// eslint-disable-next-line @fluentui/max-len
_a[".".concat(utilities_1.IsFocusVisibleClassName, " .").concat(classNames.root, ":focus-within &, :host(.").concat(utilities_1.IsFocusVisibleClassName, ") .").concat(classNames.root, ":focus-within &")] = {
// edge does not recognize focus-within, so separate it out
height: 53,
minHeight: 12,
overflow: 'initial',
},
_a['&:hover'] = {
cursor: 'pointer',
backgroundColor: palette.neutralLight,
},
_a['&:active'] = {
backgroundColor: palette.neutralTertiary,
},
_a),
},
],
disabledStyle: {
selectors: {
'&, &:disabled, & button': {
color: palette.neutralTertiaryAlt,
pointerEvents: 'none',
},
},
},
};
};
exports.styles = styles;
});
//# sourceMappingURL=WeeklyDayPicker.styles.js.map
@@ -0,0 +1 @@
{"version":3,"file":"WeeklyDayPicker.styles.js","sourceRoot":"../src/","sources":["components/WeeklyDayPicker/WeeklyDayPicker.styles.ts"],"names":[],"mappings":";;;;IAIA,IAAM,gBAAgB,GAAG;QACvB,IAAI,EAAE,yBAAyB;KAChC,CAAC;IAEK,IAAM,MAAM,GAAG,UAAC,KAAiC;;QAC9C,IAAA,SAAS,GAAY,KAAK,UAAjB,EAAE,KAAK,GAAK,KAAK,MAAV,CAAW;QAC3B,IAAA,OAAO,GAAK,KAAK,QAAV,CAAW;QAE1B,IAAM,UAAU,GAAG,IAAA,qCAAmB,EAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;QAEhE,OAAO;YACL,IAAI,EAAE;gBACJ,UAAU,CAAC,IAAI;gBACf,2BAAS;gBACT;oBACE,KAAK,EAAE,GAAG;oBACV,OAAO,EAAE,EAAE;oBACX,SAAS,EAAE,aAAa;oBACxB,OAAO,EAAE,MAAM;oBACf,UAAU,EAAE,QAAQ;oBACpB,aAAa,EAAE,KAAK;iBACrB;gBACD,SAAS;aACV;YACD,SAAS,EAAE;gBACT,YAAY,EAAE,MAAM;aACrB;YACD,UAAU,EAAE,EAAE;YACd,OAAO,EAAE;gBACP,YAAY,EAAE,gBAAgB;aAC/B;YACD,WAAW,EAAE,EAAE;YACf,oBAAoB,EAAE;gBACpB,IAAA,+BAAa,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;gBAClC;oBACE,KAAK,EAAE,EAAE;oBACT,QAAQ,EAAE,EAAE;oBACZ,MAAM,EAAE,CAAC;oBACT,QAAQ,EAAE,QAAQ;oBAClB,OAAO,EAAE,CAAC;oBACV,MAAM,EAAE,CAAC;oBACT,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE,MAAM;oBACf,UAAU,EAAE,QAAQ;oBACpB,eAAe,EAAE,OAAO,CAAC,cAAc;oBACvC,QAAQ,EAAE,2BAAS,CAAC,KAAK;oBACzB,UAAU,EAAE,SAAS;oBACrB,SAAS;wBACP,6CAA6C;wBAC7C,GAAC,WAAI,UAAU,CAAC,IAAI,wBAAc,mCAAuB,eAAK,UAAU,CAAC,IAAI,8BAAoB,mCAAuB,gBAAM,UAAU,CAAC,IAAI,eAAY;4BACzJ,WAAI,mCAAuB,8BAAoB,mCAAuB,cAAW,IAAG;4BAClF,MAAM,EAAE,EAAE;4BACV,SAAS,EAAE,EAAE;4BACb,QAAQ,EAAE,SAAS;yBACpB;wBACD,6CAA6C;wBAC7C,GAAC,WAAI,mCAAuB,eAAK,UAAU,CAAC,IAAI,qCAA2B,mCAAuB,gBAAM,UAAU,CAAC,IAAI,oBAAiB,IACtI;4BACE,2DAA2D;4BAC3D,MAAM,EAAE,EAAE;4BACV,SAAS,EAAE,EAAE;4BACb,QAAQ,EAAE,SAAS;yBACpB;wBACH,aAAS,GAAE;4BACT,MAAM,EAAE,SAAS;4BACjB,eAAe,EAAE,OAAO,CAAC,YAAY;yBACtC;wBACD,cAAU,GAAE;4BACV,eAAe,EAAE,OAAO,CAAC,eAAe;yBACzC;2BACF;iBACF;aACF;YACD,aAAa,EAAE;gBACb,SAAS,EAAE;oBACT,yBAAyB,EAAE;wBACzB,KAAK,EAAE,OAAO,CAAC,kBAAkB;wBACjC,aAAa,EAAE,MAAM;qBACtB;iBACF;aACF;SACF,CAAC;IACJ,CAAC,CAAC;IA9EW,QAAA,MAAM,UA8EjB","sourcesContent":["import { normalize, FontSizes, getFocusStyle, getGlobalClassNames } from '@fluentui/style-utilities';\nimport { IsFocusVisibleClassName } from '@fluentui/utilities';\nimport type { IWeeklyDayPickerStyleProps, IWeeklyDayPickerStyles } from './WeeklyDayPicker.types';\n\nconst GlobalClassNames = {\n root: 'ms-WeeklyDayPicker-root',\n};\n\nexport const styles = (props: IWeeklyDayPickerStyleProps): IWeeklyDayPickerStyles => {\n const { className, theme } = props;\n const { palette } = theme;\n\n const classNames = getGlobalClassNames(GlobalClassNames, theme);\n\n return {\n root: [\n classNames.root,\n normalize,\n {\n width: 220,\n padding: 12,\n boxSizing: 'content-box',\n display: 'flex',\n alignItems: 'center',\n flexDirection: 'row',\n },\n className,\n ],\n dayButton: {\n borderRadius: '100%',\n },\n dayIsToday: {},\n dayCell: {\n borderRadius: '100%!important',\n },\n daySelected: {},\n navigationIconButton: [\n getFocusStyle(theme, { inset: 0 }),\n {\n width: 12,\n minWidth: 12,\n height: 0,\n overflow: 'hidden',\n padding: 0,\n margin: 0,\n border: 'none',\n display: 'flex',\n alignItems: 'center',\n backgroundColor: palette.neutralLighter,\n fontSize: FontSizes.small,\n fontFamily: 'inherit',\n selectors: {\n // eslint-disable-next-line @fluentui/max-len\n [`.${classNames.root}:hover &, .${IsFocusVisibleClassName} .${classNames.root}:focus &, :host(.${IsFocusVisibleClassName}) .${classNames.root}:focus &, ` +\n `.${IsFocusVisibleClassName} &:focus, :host(.${IsFocusVisibleClassName}) &:focus`]: {\n height: 53,\n minHeight: 12,\n overflow: 'initial',\n },\n // eslint-disable-next-line @fluentui/max-len\n [`.${IsFocusVisibleClassName} .${classNames.root}:focus-within &, :host(.${IsFocusVisibleClassName}) .${classNames.root}:focus-within &`]:\n {\n // edge does not recognize focus-within, so separate it out\n height: 53,\n minHeight: 12,\n overflow: 'initial',\n },\n '&:hover': {\n cursor: 'pointer',\n backgroundColor: palette.neutralLight,\n },\n '&:active': {\n backgroundColor: palette.neutralTertiary,\n },\n },\n },\n ],\n disabledStyle: {\n selectors: {\n '&, &:disabled, & button': {\n color: palette.neutralTertiaryAlt,\n pointerEvents: 'none',\n },\n },\n },\n };\n};\n"]}
@@ -0,0 +1,145 @@
import { AnimationDirection } from '../Calendar/Calendar.types';
import { DayOfWeek } from '@fluentui/date-time-utilities';
import type { IBaseProps, IRefObject, IStyleFunctionOrObject } from '@fluentui/utilities';
import type { ICalendarNavigationIcons } from '../Calendar/Calendar.types';
import type { ICalendarStrings, IDateFormatting } from '@fluentui/date-time-utilities';
import type { IStyle, ITheme } from '@fluentui/style-utilities';
import type { ICalendarDayGridProps, ICalendarDayGridStyleProps, ICalendarDayGridStyles } from '../CalendarDayGrid/CalendarDayGrid.types';
/**
* {@docCategory WeeklyDayPicker}
*/
export interface IWeeklyDayPicker {
focus(): void;
}
/**
* {@docCategory WeeklyDayPicker}
*/
export interface IWeeklyDayPickerProps extends IBaseProps<IWeeklyDayPicker>, Partial<ICalendarDayGridProps> {
/**
* Optional callback to access the IWeeklyDayPicker interface. Use this instead of ref for accessing
* the public methods and properties of the component.
*/
componentRef?: IRefObject<IWeeklyDayPicker>;
/**
* Customized styles for the component.
*/
styles?: IStyleFunctionOrObject<IWeeklyDayPickerStyleProps, IWeeklyDayPickerStyles>;
/**
* Theme (provided through customization).
*/
theme?: ITheme;
/**
* Additional CSS class(es) to apply to the WeeklyDayPicker.
*/
className?: string;
/**
* Localized strings to use in the WeeklyDayPicker
*/
strings: IWeeklyDayPickerStrings;
/**
* Customize navigation icons.
*/
navigationIcons?: IWeeklyDayPickerNavigationIcons;
/**
* The initially selected date.
* @default Today's date (`new Date()`)
*/
initialDate?: Date;
/**
* Callback issued when a date is selected
* @param date - The date the user selected
*/
onSelectDate?: (date: Date) => void;
/**
* Callback issued when a date in the calendar is navigated
* @param date - The date that is navigated to
*/
onNavigateDate?: (date: Date) => void;
/**
* The first day of the week for your locale.
* @defaultvalue DayOfWeek.Sunday
*/
firstDayOfWeek?: DayOfWeek;
/**
* Value of today. If unspecified, current time in client machine will be used.
*/
today?: Date;
/**
* Apply additional formatting to dates, for example localized date formatting.
*/
dateTimeFormatter?: IDateFormatting;
/**
* If set the Calendar will not allow navigation to or selection of a date earlier than this value.
*/
minDate?: Date;
/**
* If set the Calendar will not allow navigation to or selection of a date later than this value.
*/
maxDate?: Date;
/**
* If set the Calendar will not allow selection of dates in this array.
*/
restrictedDates?: Date[];
/**
* The cardinal directions for animation to occur during transitions, either horizontal or veritcal
*/
animationDirection?: AnimationDirection;
/**
* Whether to show as a month picker. If false, shows only one week
* @defaultvalue false
*/
showFullMonth?: boolean;
/**
* How many weeks to show if showFullMonth=true. If not provided, will show enough weeks to display the current
* month, between 4 and 6 depending
* @defaultvalue undefined
*/
weeksToShow?: number;
}
/**
* {@docCategory WeeklyDayPicker}
*/
export type IWeeklyDayPickerNavigationIcons = Pick<ICalendarNavigationIcons, 'leftNavigation' | 'rightNavigation'>;
/**
* {@docCategory WeeklyDayPicker}
*/
export interface IWeeklyDayPickerStrings extends ICalendarStrings {
/**
* Aria-label for the "previous week" button in picker.
*/
prevWeekAriaLabel?: string;
/**
* Aria-label for the "next week" button in picker.
*/
nextWeekAriaLabel?: string;
}
/**
* {@docCategory WeeklyDayPicker}
*/
export interface IWeeklyDayPickerStyleProps extends ICalendarDayGridStyleProps {
/**
* Theme provided by High-Order Component.
*/
theme: ITheme;
/**
* Accept custom classNames
*/
className?: string;
}
/**
* {@docCategory WeeklyDayPicker}
*/
export interface IWeeklyDayPickerStyles extends Partial<ICalendarDayGridStyles> {
/**
* Style for the root element.
*/
root: IStyle;
/**
* Style for navigation icon button.
*/
navigationIconButton: IStyle;
/**
* Style for disabled element
*/
disabledStyle: IStyle;
}
@@ -0,0 +1,5 @@
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
});
//# sourceMappingURL=WeeklyDayPicker.types.js.map
@@ -0,0 +1 @@
{"version":3,"file":"WeeklyDayPicker.types.js","sourceRoot":"../src/","sources":["components/WeeklyDayPicker/WeeklyDayPicker.types.ts"],"names":[],"mappings":"","sourcesContent":["import { AnimationDirection } from '../Calendar/Calendar.types';\nimport { DayOfWeek } from '@fluentui/date-time-utilities';\nimport type { IBaseProps, IRefObject, IStyleFunctionOrObject } from '@fluentui/utilities';\nimport type { ICalendarNavigationIcons } from '../Calendar/Calendar.types';\nimport type { ICalendarStrings, IDateFormatting } from '@fluentui/date-time-utilities';\nimport type { IStyle, ITheme } from '@fluentui/style-utilities';\nimport type {\n ICalendarDayGridProps,\n ICalendarDayGridStyleProps,\n ICalendarDayGridStyles,\n} from '../CalendarDayGrid/CalendarDayGrid.types';\n\n/**\n * {@docCategory WeeklyDayPicker}\n */\nexport interface IWeeklyDayPicker {\n focus(): void;\n}\n\n/**\n * {@docCategory WeeklyDayPicker}\n */\nexport interface IWeeklyDayPickerProps extends IBaseProps<IWeeklyDayPicker>, Partial<ICalendarDayGridProps> {\n /**\n * Optional callback to access the IWeeklyDayPicker interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: IRefObject<IWeeklyDayPicker>;\n\n /**\n * Customized styles for the component.\n */\n styles?: IStyleFunctionOrObject<IWeeklyDayPickerStyleProps, IWeeklyDayPickerStyles>;\n\n /**\n * Theme (provided through customization).\n */\n theme?: ITheme;\n\n /**\n * Additional CSS class(es) to apply to the WeeklyDayPicker.\n */\n className?: string;\n\n /**\n * Localized strings to use in the WeeklyDayPicker\n */\n strings: IWeeklyDayPickerStrings;\n\n /**\n * Customize navigation icons.\n */\n navigationIcons?: IWeeklyDayPickerNavigationIcons;\n\n /**\n * The initially selected date.\n * @default Today's date (`new Date()`)\n */\n initialDate?: Date;\n\n /**\n * Callback issued when a date is selected\n * @param date - The date the user selected\n */\n onSelectDate?: (date: Date) => void;\n\n /**\n * Callback issued when a date in the calendar is navigated\n * @param date - The date that is navigated to\n */\n onNavigateDate?: (date: Date) => void;\n\n /**\n * The first day of the week for your locale.\n * @defaultvalue DayOfWeek.Sunday\n */\n firstDayOfWeek?: DayOfWeek;\n\n /**\n * Value of today. If unspecified, current time in client machine will be used.\n */\n today?: Date;\n\n /**\n * Apply additional formatting to dates, for example localized date formatting.\n */\n dateTimeFormatter?: IDateFormatting;\n\n /**\n * If set the Calendar will not allow navigation to or selection of a date earlier than this value.\n */\n minDate?: Date;\n\n /**\n * If set the Calendar will not allow navigation to or selection of a date later than this value.\n */\n maxDate?: Date;\n\n /**\n * If set the Calendar will not allow selection of dates in this array.\n */\n restrictedDates?: Date[];\n\n /**\n * The cardinal directions for animation to occur during transitions, either horizontal or veritcal\n */\n animationDirection?: AnimationDirection;\n\n /**\n * Whether to show as a month picker. If false, shows only one week\n * @defaultvalue false\n */\n showFullMonth?: boolean;\n\n /**\n * How many weeks to show if showFullMonth=true. If not provided, will show enough weeks to display the current\n * month, between 4 and 6 depending\n * @defaultvalue undefined\n */\n weeksToShow?: number;\n}\n\n/**\n * {@docCategory WeeklyDayPicker}\n */\nexport type IWeeklyDayPickerNavigationIcons = Pick<ICalendarNavigationIcons, 'leftNavigation' | 'rightNavigation'>;\n\n/**\n * {@docCategory WeeklyDayPicker}\n */\nexport interface IWeeklyDayPickerStrings extends ICalendarStrings {\n /**\n * Aria-label for the \"previous week\" button in picker.\n */\n prevWeekAriaLabel?: string;\n\n /**\n * Aria-label for the \"next week\" button in picker.\n */\n nextWeekAriaLabel?: string;\n}\n\n/**\n * {@docCategory WeeklyDayPicker}\n */\nexport interface IWeeklyDayPickerStyleProps extends ICalendarDayGridStyleProps {\n /**\n * Theme provided by High-Order Component.\n */\n theme: ITheme;\n\n /**\n * Accept custom classNames\n */\n className?: string;\n}\n\n/**\n * {@docCategory WeeklyDayPicker}\n */\nexport interface IWeeklyDayPickerStyles extends Partial<ICalendarDayGridStyles> {\n /**\n * Style for the root element.\n */\n root: IStyle;\n\n /**\n * Style for navigation icon button.\n */\n navigationIconButton: IStyle;\n\n /**\n * Style for disabled element\n */\n disabledStyle: IStyle;\n}\n"]}
@@ -0,0 +1,3 @@
import type { IWeeklyDayPickerStrings, IWeeklyDayPickerNavigationIcons } from './WeeklyDayPicker.types';
export declare const defaultWeeklyDayPickerStrings: IWeeklyDayPickerStrings;
export declare const defaultWeeklyDayPickerNavigationIcons: IWeeklyDayPickerNavigationIcons;
@@ -0,0 +1,11 @@
define(["require", "exports", "tslib", "@fluentui/date-time-utilities"], function (require, exports, tslib_1, date_time_utilities_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultWeeklyDayPickerNavigationIcons = exports.defaultWeeklyDayPickerStrings = void 0;
exports.defaultWeeklyDayPickerStrings = tslib_1.__assign(tslib_1.__assign({}, date_time_utilities_1.DEFAULT_CALENDAR_STRINGS), { prevWeekAriaLabel: 'Previous week', nextWeekAriaLabel: 'Next week', prevMonthAriaLabel: 'Go to previous month', nextMonthAriaLabel: 'Go to next month', prevYearAriaLabel: 'Go to previous year', nextYearAriaLabel: 'Go to next year', closeButtonAriaLabel: 'Close date picker' });
exports.defaultWeeklyDayPickerNavigationIcons = {
leftNavigation: 'ChevronLeft',
rightNavigation: 'ChevronRight',
};
});
//# sourceMappingURL=defaults.js.map
@@ -0,0 +1 @@
{"version":3,"file":"defaults.js","sourceRoot":"../src/","sources":["components/WeeklyDayPicker/defaults.ts"],"names":[],"mappings":";;;;IAGa,QAAA,6BAA6B,yCACrC,8CAAwB,KAC3B,iBAAiB,EAAE,eAAe,EAClC,iBAAiB,EAAE,WAAW,EAC9B,kBAAkB,EAAE,sBAAsB,EAC1C,kBAAkB,EAAE,kBAAkB,EACtC,iBAAiB,EAAE,qBAAqB,EACxC,iBAAiB,EAAE,iBAAiB,EACpC,oBAAoB,EAAE,mBAAmB,IACzC;IAEW,QAAA,qCAAqC,GAAoC;QACpF,cAAc,EAAE,aAAa;QAC7B,eAAe,EAAE,cAAc;KAChC,CAAC","sourcesContent":["import { DEFAULT_CALENDAR_STRINGS } from '@fluentui/date-time-utilities';\nimport type { IWeeklyDayPickerStrings, IWeeklyDayPickerNavigationIcons } from './WeeklyDayPicker.types';\n\nexport const defaultWeeklyDayPickerStrings: IWeeklyDayPickerStrings = {\n ...DEFAULT_CALENDAR_STRINGS,\n prevWeekAriaLabel: 'Previous week',\n nextWeekAriaLabel: 'Next week',\n prevMonthAriaLabel: 'Go to previous month',\n nextMonthAriaLabel: 'Go to next month',\n prevYearAriaLabel: 'Go to previous year',\n nextYearAriaLabel: 'Go to next year',\n closeButtonAriaLabel: 'Close date picker',\n};\n\nexport const defaultWeeklyDayPickerNavigationIcons: IWeeklyDayPickerNavigationIcons = {\n leftNavigation: 'ChevronLeft',\n rightNavigation: 'ChevronRight',\n};\n"]}
@@ -0,0 +1,3 @@
export * from './WeeklyDayPicker';
export * from './WeeklyDayPicker.types';
export * from './defaults';
@@ -0,0 +1,8 @@
define(["require", "exports", "tslib", "./WeeklyDayPicker", "./WeeklyDayPicker.types", "./defaults"], function (require, exports, tslib_1, WeeklyDayPicker_1, WeeklyDayPicker_types_1, defaults_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
tslib_1.__exportStar(WeeklyDayPicker_1, exports);
tslib_1.__exportStar(WeeklyDayPicker_types_1, exports);
tslib_1.__exportStar(defaults_1, exports);
});
//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/WeeklyDayPicker/index.ts"],"names":[],"mappings":";;;IAAA,iDAAkC;IAClC,uDAAwC;IACxC,0CAA2B","sourcesContent":["export * from './WeeklyDayPicker';\nexport * from './WeeklyDayPicker.types';\nexport * from './defaults';\n"]}