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

Migrate Calendar components to function components #12928

Closed
wants to merge 53 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
42e75e0
Add new hooks used in migrating Fabric components to functional compo…
MLoughry Apr 9, 2020
ee05549
Change files
MLoughry Apr 9, 2020
9733ebd
Cherry pick revision from MLoughry:functional/checkbox
MLoughry Apr 9, 2020
abb37ef
Fix lint error
MLoughry Apr 9, 2020
09d9402
Merge branch 'master' of github.com:microsoft/fluentui into functiona…
MLoughry Apr 9, 2020
b84a0a8
Merge branch 'master' of github.com:microsoft/fluentui into functiona…
MLoughry Apr 13, 2020
92bd1a1
Address comments from dzearing
MLoughry Apr 13, 2020
9d94139
Fix launch.json for debugging tests
MLoughry Apr 13, 2020
3e0c282
Use common onChange call signature
MLoughry Apr 13, 2020
8f8bb37
Fix useControllableValue types in case with no onChange handler
MLoughry Apr 13, 2020
8fcb759
Merge branch 'master' of github.com:microsoft/fluentui into functiona…
MLoughry Apr 14, 2020
8e1e936
Merge branch 'master' of github.com:microsoft/fluentui into functiona…
MLoughry Apr 16, 2020
cf76ce0
Export ChangeCallback type
MLoughry Apr 16, 2020
68c226b
Persist the controlled vs uncontrolled state
MLoughry Apr 16, 2020
a1679ca
Update packages/react-hooks/src/useMergedRefs.ts
MLoughry Apr 16, 2020
a940f05
Update README
MLoughry Apr 16, 2020
8284656
Allow for undefined events in the onChange callback
MLoughry Apr 16, 2020
acebfde
Merge branch 'functional/hooks' of github.com:MLoughry/office-ui-fabr…
MLoughry Apr 16, 2020
a8c5d07
Fix error in isControlled value
MLoughry Apr 16, 2020
d6e3f6b
Delete test for deprecated behavior
MLoughry Apr 16, 2020
4fbb3e2
Update packages/react-hooks/README.md
MLoughry Apr 16, 2020
a7d0e42
Update packages/react-hooks/README.md
MLoughry Apr 16, 2020
6ab7714
Make CalendarDay strict-mode compliant
MLoughry Apr 20, 2020
2392110
Migrate Calendar to a function component
MLoughry Apr 21, 2020
8164f4a
Remove extraneous TSLint disable comment
MLoughry Apr 21, 2020
2221c6a
Refactor getPropsWithDefaults to utilities
MLoughry Apr 21, 2020
f5a11fb
Fix lint error in test
MLoughry Apr 21, 2020
634436e
Refactor into more local hooks to fix shadowing lint errors
MLoughry Apr 21, 2020
2a527e2
Refactor out new subcomponent CalendarMonthButton
MLoughry Apr 21, 2020
e7c1714
Migrate calendarMonth to function component
MLoughry Apr 21, 2020
37010d8
Migrate CalendarMonth to function component
MLoughry Apr 21, 2020
71d6189
Merge branch 'functional/hooks' into concurrent/calendar
MLoughry Apr 21, 2020
2648b2e
Merge branch 'master' of github.com:microsoft/fluentui into concurren…
MLoughry Apr 21, 2020
2152c5b
Migrate CalendarYear to function component
MLoughry Apr 21, 2020
db4da26
Moderate refactoring in CalendarDay before migrating to FC
MLoughry Apr 22, 2020
867d359
Migrate CalendarDay to function component
MLoughry Apr 22, 2020
5553c2c
Update API
MLoughry Apr 22, 2020
deb0997
Move code changes to react-next
MLoughry Apr 29, 2020
c291965
Merge branch 'master' of github.com:microsoft/fluentui into concurren…
MLoughry Apr 29, 2020
244ea2f
Get react-next changes to build
MLoughry Apr 29, 2020
9b1354d
Copy tslint from OUFR
MLoughry Apr 29, 2020
b2713a7
Add display names
MLoughry Apr 29, 2020
b937840
Change files
MLoughry Apr 29, 2020
578268f
Remove extraneous change file
MLoughry Apr 29, 2020
5287930
Merge from master
MLoughry Apr 29, 2020
5eb1a05
Merge branch 'master' of github.com:microsoft/fluentui into concurren…
MLoughry Apr 29, 2020
7b28f4a
Try to revert meaningless changes
MLoughry Apr 29, 2020
76b379f
Merge branch 'master' of github.com:microsoft/fluentui into concurren…
MLoughry May 4, 2020
1e8aef3
Merge branch 'master' of github.com:microsoft/fluentui into concurren…
MLoughry May 5, 2020
f0d0de4
Merge branch 'master' of github.com:microsoft/fluentui into concurren…
MLoughry May 14, 2020
8de1017
Delete extraneous change file
MLoughry May 14, 2020
f337d16
Merge branch 'master' of github.com:microsoft/fluentui into concurren…
MLoughry May 18, 2020
87c3cfd
Fix duplicate exports
MLoughry May 18, 2020
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "prerelease",
"comment": "Migrate Calendar components to function components",
"packageName": "@fluentui/react-next",
"email": "[email protected]",
"dependentChangeType": "patch",
"date": "2020-04-29T18:25:01.883Z"
}
130 changes: 128 additions & 2 deletions packages/react-next/etc/react-next.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

```ts

import { IBaseProps } from 'office-ui-fabric-react/lib/Utilities';
import { IButtonProps } from 'office-ui-fabric-react/lib/Button';
import { IButtonProps as IButtonProps_2 } from 'office-ui-fabric-react/lib/components/Button/Button.types';
import { IButtonStyles } from 'office-ui-fabric-react/lib/Button';
Expand All @@ -20,12 +21,45 @@ import { ITheme } from 'office-ui-fabric-react/lib/Styling';
import { Position } from 'office-ui-fabric-react/lib/utilities/positioning';
import * as React from 'react';

// @public (undocumented)
export const Calendar: React.MemoExoticComponent<React.ForwardRefExoticComponent<ICalendarProps & React.RefAttributes<HTMLDivElement>>>;

// @public (undocumented)
export const Checkbox: React.FunctionComponent<ICheckboxProps>;

// @public (undocumented)
export const CheckboxBase: React.ForwardRefExoticComponent<ICheckboxProps & React.RefAttributes<HTMLDivElement>>;

// @public
export enum DateRangeType {
// (undocumented)
Day = 0,
// (undocumented)
Month = 2,
// (undocumented)
Week = 1,
// (undocumented)
WorkWeek = 3
}

// @public
export enum DayOfWeek {
// (undocumented)
Friday = 5,
// (undocumented)
Monday = 1,
// (undocumented)
Saturday = 6,
// (undocumented)
Sunday = 0,
// (undocumented)
Thursday = 4,
// (undocumented)
Tuesday = 2,
// (undocumented)
Wednesday = 3
}

// @public (undocumented)
export const DEFAULT_MASK_CHAR = "_";

Expand All @@ -38,6 +72,16 @@ export const Fabric: React.FunctionComponent<IFabricProps>;
// @public (undocumented)
export const FabricBase: React.ForwardRefExoticComponent<IFabricProps & React.RefAttributes<HTMLDivElement>>;

// @public
export enum FirstWeekOfYear {
// (undocumented)
FirstDay = 0,
// (undocumented)
FirstFourDayWeek = 2,
// (undocumented)
FirstFullWeek = 1
}

// @public
export const getMeasurementCache: () => {
getCachedMeasurement: (data: any) => number | undefined;
Expand All @@ -54,6 +98,87 @@ export const getNextResizeGroupStateProvider: (measurementCache?: {
getInitialResizeGroupState: (data: any) => IResizeGroupState;
};

// @public (undocumented)
export interface ICalendar {
focus: () => void;
}

// @public (undocumented)
export interface ICalendarFormatDateCallbacks {
formatDay: (date: Date) => string;
formatMonthDayYear: (date: Date, strings?: ICalendarStrings) => string;
formatMonthYear: (date: Date, strings?: ICalendarStrings) => string;
formatYear: (date: Date) => string;
}

// @public (undocumented)
export interface ICalendarIconStrings {
closeIcon?: string;
leftNavigation?: string;
rightNavigation?: string;
}

// @public (undocumented)
export interface ICalendarProps extends IBaseProps<ICalendar>, React.HTMLAttributes<HTMLElement> {
allFocusable?: boolean;
autoNavigateOnSelection?: boolean;
className?: string;
componentRef?: IRefObject<ICalendar>;
dateRangeType?: DateRangeType;
dateTimeFormatter?: ICalendarFormatDateCallbacks;
firstDayOfWeek?: DayOfWeek;
firstWeekOfYear?: FirstWeekOfYear;
highlightCurrentMonth?: boolean;
highlightSelectedMonth?: boolean;
isDayPickerVisible?: boolean;
isMonthPickerVisible?: boolean;
maxDate?: Date;
minDate?: Date;
navigationIcons?: ICalendarIconStrings;
onDismiss?: () => void;
onSelectDate?: (date: Date, selectedDateRangeArray?: Date[]) => void;
restrictedDates?: Date[];
selectDateOnClick?: boolean;
// @deprecated
shouldFocusOnMount?: boolean;
showCloseButton?: boolean;
showGoToToday?: boolean;
showMonthPickerAsOverlay?: boolean;
showSixWeeksByDefault?: boolean;
showWeekNumbers?: boolean;
strings: ICalendarStrings | null;
today?: Date;
value?: Date;
workWeekDays?: DayOfWeek[];
yearPickerHidden?: boolean;
}

// @public (undocumented)
export interface ICalendarState {
isDayPickerVisible?: boolean;
isMonthPickerVisible?: boolean;
navigatedDayDate?: Date;
navigatedMonthDate?: Date;
selectedDate?: Date;
}

// @public (undocumented)
export interface ICalendarStrings {
closeButtonAriaLabel?: string;
days: string[];
goToToday: string;
months: string[];
nextMonthAriaLabel?: string;
nextYearAriaLabel?: string;
nextYearRangeAriaLabel?: string;
prevMonthAriaLabel?: string;
prevYearAriaLabel?: string;
prevYearRangeAriaLabel?: string;
shortDays: string[];
shortMonths: string[];
weekNumberFormatString?: string;
}

// @public
export interface ICheckbox {
checked: boolean;
Expand Down Expand Up @@ -1059,7 +1184,6 @@ export * from "office-ui-fabric-react/lib/Announced";
export * from "office-ui-fabric-react/lib/Autofill";
export * from "office-ui-fabric-react/lib/Breadcrumb";
export * from "office-ui-fabric-react/lib/Button";
export * from "office-ui-fabric-react/lib/Calendar";
export * from "office-ui-fabric-react/lib/Callout";
export * from "office-ui-fabric-react/lib/Check";
export * from "office-ui-fabric-react/lib/ChoiceGroup";
Expand All @@ -1069,7 +1193,6 @@ export * from "office-ui-fabric-react/lib/ColorPicker";
export * from "office-ui-fabric-react/lib/ComboBox";
export * from "office-ui-fabric-react/lib/CommandBar";
export * from "office-ui-fabric-react/lib/ContextualMenu";
export * from "office-ui-fabric-react/lib/DatePicker";
export * from "office-ui-fabric-react/lib/DetailsList";
export * from "office-ui-fabric-react/lib/Dialog";
export * from "office-ui-fabric-react/lib/Divider";
Expand Down Expand Up @@ -1119,6 +1242,9 @@ export * from "office-ui-fabric-react/lib/Text";
export * from "office-ui-fabric-react/lib/ThemeGenerator";
export * from "office-ui-fabric-react/lib/Tooltip";
export * from "office-ui-fabric-react/lib/Utilities";
export * from "office-ui-fabric-react/lib/components/DatePicker/DatePicker";
export * from "office-ui-fabric-react/lib/components/DatePicker/DatePicker.base";
export * from "office-ui-fabric-react/lib/components/DatePicker/DatePicker.types";

// (No @packageDocumentation comment for this package)

Expand Down
2 changes: 1 addition & 1 deletion packages/react-next/src/Calendar.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from 'office-ui-fabric-react/lib/Calendar';
export * from './components/Calendar';
4 changes: 3 additions & 1 deletion packages/react-next/src/DatePicker.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export * from 'office-ui-fabric-react/lib/DatePicker';
export * from 'office-ui-fabric-react/lib/components/DatePicker/DatePicker';
export * from 'office-ui-fabric-react/lib/components/DatePicker/DatePicker.base';
export * from 'office-ui-fabric-react/lib/components/DatePicker/DatePicker.types';
Loading