@fluentui/react-datepicker-compat 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +151 -1
- package/CHANGELOG.md +40 -2
- package/dist/index.d.ts +4 -1
- package/lib/components/DatePicker/DatePicker.types.js.map +1 -1
- package/lib/components/DatePicker/useDatePicker.js +7 -7
- package/lib/components/DatePicker/useDatePicker.js.map +1 -1
- package/lib-commonjs/components/DatePicker/useDatePicker.js +6 -6
- package/lib-commonjs/components/DatePicker/useDatePicker.js.map +1 -1
- package/package.json +13 -13
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,157 @@
|
|
|
2
2
|
"name": "@fluentui/react-datepicker-compat",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Mon, 26 Jun 2023 09:51:06 GMT",
|
|
6
|
+
"tag": "@fluentui/react-datepicker-compat_v0.1.7",
|
|
7
|
+
"version": "0.1.7",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "beachball",
|
|
12
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
13
|
+
"comment": "Bump @fluentui/react-field to v9.1.8",
|
|
14
|
+
"commit": "025ea2c9c6fb2184e67505081a7a307e95c6c009"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
19
|
+
"comment": "Bump @fluentui/react-input to v9.4.18",
|
|
20
|
+
"commit": "025ea2c9c6fb2184e67505081a7a307e95c6c009"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
25
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.8",
|
|
26
|
+
"commit": "025ea2c9c6fb2184e67505081a7a307e95c6c009"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
31
|
+
"comment": "Bump @fluentui/react-popover to v9.7.1",
|
|
32
|
+
"commit": "025ea2c9c6fb2184e67505081a7a307e95c6c009"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "beachball",
|
|
36
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
37
|
+
"comment": "Bump @fluentui/react-portal to v9.2.14",
|
|
38
|
+
"commit": "025ea2c9c6fb2184e67505081a7a307e95c6c009"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"author": "beachball",
|
|
42
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
43
|
+
"comment": "Bump @fluentui/react-positioning to v9.7.1",
|
|
44
|
+
"commit": "025ea2c9c6fb2184e67505081a7a307e95c6c009"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"author": "beachball",
|
|
48
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
49
|
+
"comment": "Bump @fluentui/react-tabster to v9.8.1",
|
|
50
|
+
"commit": "025ea2c9c6fb2184e67505081a7a307e95c6c009"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"author": "beachball",
|
|
54
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
55
|
+
"comment": "Bump @fluentui/react-utilities to v9.9.4",
|
|
56
|
+
"commit": "025ea2c9c6fb2184e67505081a7a307e95c6c009"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"date": "Tue, 20 Jun 2023 12:38:57 GMT",
|
|
63
|
+
"tag": "@fluentui/react-datepicker-compat_v0.1.6",
|
|
64
|
+
"version": "0.1.6",
|
|
65
|
+
"comments": {
|
|
66
|
+
"patch": [
|
|
67
|
+
{
|
|
68
|
+
"author": "esteban.230@hotmail.com",
|
|
69
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
70
|
+
"commit": "723e89b9ca9b064375045bd61c8d7e04fd1af46e",
|
|
71
|
+
"comment": "fix: Do not move focus to the input on first render."
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"author": "esteban.230@hotmail.com",
|
|
75
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
76
|
+
"commit": "16a263106a6f81408d394432ffefc89f53b43efa",
|
|
77
|
+
"comment": "feat: Add null to value prop for controlled cases to work correctly."
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"author": "ololubek@microsoft.com",
|
|
81
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
82
|
+
"commit": "8a5ae3aa00faa327c58887a99a5698b18f2930ee",
|
|
83
|
+
"comment": "chore: update @fluentui/react-icons to 2.0.203"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"author": "beachball",
|
|
87
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
88
|
+
"comment": "Bump @fluentui/react-field to v9.1.7",
|
|
89
|
+
"commit": "81c9b35e0830297b2aca2cece2ae67b3899c4647"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"author": "beachball",
|
|
93
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
94
|
+
"comment": "Bump @fluentui/react-input to v9.4.17",
|
|
95
|
+
"commit": "81c9b35e0830297b2aca2cece2ae67b3899c4647"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"author": "beachball",
|
|
99
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
100
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.7",
|
|
101
|
+
"commit": "81c9b35e0830297b2aca2cece2ae67b3899c4647"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"author": "beachball",
|
|
105
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
106
|
+
"comment": "Bump @fluentui/react-popover to v9.7.0",
|
|
107
|
+
"commit": "81c9b35e0830297b2aca2cece2ae67b3899c4647"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"author": "beachball",
|
|
111
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
112
|
+
"comment": "Bump @fluentui/react-portal to v9.2.13",
|
|
113
|
+
"commit": "81c9b35e0830297b2aca2cece2ae67b3899c4647"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"author": "beachball",
|
|
117
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
118
|
+
"comment": "Bump @fluentui/react-positioning to v9.7.0",
|
|
119
|
+
"commit": "81c9b35e0830297b2aca2cece2ae67b3899c4647"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"author": "beachball",
|
|
123
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
124
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.5.1",
|
|
125
|
+
"commit": "81c9b35e0830297b2aca2cece2ae67b3899c4647"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"author": "beachball",
|
|
129
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
130
|
+
"comment": "Bump @fluentui/react-tabster to v9.8.0",
|
|
131
|
+
"commit": "81c9b35e0830297b2aca2cece2ae67b3899c4647"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"author": "beachball",
|
|
135
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
136
|
+
"comment": "Bump @fluentui/react-theme to v9.1.9",
|
|
137
|
+
"commit": "81c9b35e0830297b2aca2cece2ae67b3899c4647"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"author": "beachball",
|
|
141
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
142
|
+
"comment": "Bump @fluentui/react-utilities to v9.9.3",
|
|
143
|
+
"commit": "81c9b35e0830297b2aca2cece2ae67b3899c4647"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"author": "beachball",
|
|
147
|
+
"package": "@fluentui/react-datepicker-compat",
|
|
148
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.23",
|
|
149
|
+
"commit": "81c9b35e0830297b2aca2cece2ae67b3899c4647"
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"date": "Wed, 31 May 2023 06:46:12 GMT",
|
|
6
156
|
"tag": "@fluentui/react-datepicker-compat_v0.1.5",
|
|
7
157
|
"version": "0.1.5",
|
|
8
158
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,50 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-datepicker-compat
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 26 Jun 2023 09:51:06 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [0.1.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-datepicker-compat_v0.1.7)
|
|
8
|
+
|
|
9
|
+
Mon, 26 Jun 2023 09:51:06 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-datepicker-compat_v0.1.6..@fluentui/react-datepicker-compat_v0.1.7)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- Bump @fluentui/react-field to v9.1.8 ([PR #28307](https://github.com/microsoft/fluentui/pull/28307) by beachball)
|
|
15
|
+
- Bump @fluentui/react-input to v9.4.18 ([PR #28307](https://github.com/microsoft/fluentui/pull/28307) by beachball)
|
|
16
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.8 ([PR #28307](https://github.com/microsoft/fluentui/pull/28307) by beachball)
|
|
17
|
+
- Bump @fluentui/react-popover to v9.7.1 ([PR #28307](https://github.com/microsoft/fluentui/pull/28307) by beachball)
|
|
18
|
+
- Bump @fluentui/react-portal to v9.2.14 ([PR #28307](https://github.com/microsoft/fluentui/pull/28307) by beachball)
|
|
19
|
+
- Bump @fluentui/react-positioning to v9.7.1 ([PR #28307](https://github.com/microsoft/fluentui/pull/28307) by beachball)
|
|
20
|
+
- Bump @fluentui/react-tabster to v9.8.1 ([PR #28307](https://github.com/microsoft/fluentui/pull/28307) by beachball)
|
|
21
|
+
- Bump @fluentui/react-utilities to v9.9.4 ([PR #28307](https://github.com/microsoft/fluentui/pull/28307) by beachball)
|
|
22
|
+
|
|
23
|
+
## [0.1.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-datepicker-compat_v0.1.6)
|
|
24
|
+
|
|
25
|
+
Tue, 20 Jun 2023 12:38:57 GMT
|
|
26
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-datepicker-compat_v0.1.5..@fluentui/react-datepicker-compat_v0.1.6)
|
|
27
|
+
|
|
28
|
+
### Patches
|
|
29
|
+
|
|
30
|
+
- fix: Do not move focus to the input on first render. ([PR #28188](https://github.com/microsoft/fluentui/pull/28188) by esteban.230@hotmail.com)
|
|
31
|
+
- feat: Add null to value prop for controlled cases to work correctly. ([PR #28056](https://github.com/microsoft/fluentui/pull/28056) by esteban.230@hotmail.com)
|
|
32
|
+
- chore: update @fluentui/react-icons to 2.0.203 ([PR #28203](https://github.com/microsoft/fluentui/pull/28203) by ololubek@microsoft.com)
|
|
33
|
+
- Bump @fluentui/react-field to v9.1.7 ([PR #28229](https://github.com/microsoft/fluentui/pull/28229) by beachball)
|
|
34
|
+
- Bump @fluentui/react-input to v9.4.17 ([PR #28229](https://github.com/microsoft/fluentui/pull/28229) by beachball)
|
|
35
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.7 ([PR #28229](https://github.com/microsoft/fluentui/pull/28229) by beachball)
|
|
36
|
+
- Bump @fluentui/react-popover to v9.7.0 ([PR #28229](https://github.com/microsoft/fluentui/pull/28229) by beachball)
|
|
37
|
+
- Bump @fluentui/react-portal to v9.2.13 ([PR #28229](https://github.com/microsoft/fluentui/pull/28229) by beachball)
|
|
38
|
+
- Bump @fluentui/react-positioning to v9.7.0 ([PR #28229](https://github.com/microsoft/fluentui/pull/28229) by beachball)
|
|
39
|
+
- Bump @fluentui/react-shared-contexts to v9.5.1 ([PR #28229](https://github.com/microsoft/fluentui/pull/28229) by beachball)
|
|
40
|
+
- Bump @fluentui/react-tabster to v9.8.0 ([PR #28229](https://github.com/microsoft/fluentui/pull/28229) by beachball)
|
|
41
|
+
- Bump @fluentui/react-theme to v9.1.9 ([PR #28229](https://github.com/microsoft/fluentui/pull/28229) by beachball)
|
|
42
|
+
- Bump @fluentui/react-utilities to v9.9.3 ([PR #28229](https://github.com/microsoft/fluentui/pull/28229) by beachball)
|
|
43
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.23 ([PR #28229](https://github.com/microsoft/fluentui/pull/28229) by beachball)
|
|
44
|
+
|
|
7
45
|
## [0.1.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-datepicker-compat_v0.1.5)
|
|
8
46
|
|
|
9
|
-
Wed, 31 May 2023 06:
|
|
47
|
+
Wed, 31 May 2023 06:46:12 GMT
|
|
10
48
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-datepicker-compat_v0.1.4..@fluentui/react-datepicker-compat_v0.1.5)
|
|
11
49
|
|
|
12
50
|
### Patches
|
package/dist/index.d.ts
CHANGED
|
@@ -766,8 +766,11 @@ export declare type DatePickerProps = Omit<ComponentProps<Partial<DatePickerSlot
|
|
|
766
766
|
today?: Date;
|
|
767
767
|
/**
|
|
768
768
|
* Default value of the DatePicker, if any
|
|
769
|
+
*
|
|
770
|
+
* When the component is controlled, `null` should be used instead of `undefined` to avoid controlled vs. uncontrolled
|
|
771
|
+
* ambiguity.
|
|
769
772
|
*/
|
|
770
|
-
value?: Date;
|
|
773
|
+
value?: Date | null;
|
|
771
774
|
/**
|
|
772
775
|
* Optional method to format the chosen date to a string to display in the DatePicker
|
|
773
776
|
* @default date.toString()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DatePicker.types.ts"],"sourcesContent":["import * as React from 'react';\nimport { DayOfWeek, FirstWeekOfYear } from '../../utils';\nimport { Input } from '@fluentui/react-input';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { CalendarProps } from '../Calendar/Calendar.types';\nimport type { CalendarStrings, DateFormatting } from '../../utils';\nimport type { PositioningProps } from '@fluentui/react-positioning';\n\nexport type DatePickerSlots = {\n root: NonNullable<Slot<typeof Input>>;\n calendar: NonNullable<Slot<Partial<CalendarProps>>>;\n popupSurface?: Slot<'div'>;\n};\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface IDatePicker {\n /** Sets focus to the input */\n focus(): void;\n\n /** Reset the state of the picker to the default */\n reset(): void;\n\n /** Open the datepicker popup */\n showDatePickerPopup(): void;\n}\n\nexport type DatePickerProps = Omit<ComponentProps<Partial<DatePickerSlots>>, 'defaultValue' | 'value'> & {\n /**\n * Optional callback to access the IDatePicker interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<IDatePicker>;\n\n /**\n * Callback issued when a date is selected\n */\n onSelectDate?: (date: Date | null | undefined) => void;\n\n /**\n * Whether the DatePicker is a required field or not. When using `<Field>`, this prop is automatically set.\n * @default false\n */\n required?: boolean;\n\n /**\n * Disabled state of the DatePicker.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Whether or not the Input of the DatePicker is underlined.\n * @default false\n */\n underlined?: boolean;\n\n /**\n * Whether the month picker is shown beside the day picker or hidden.\n * @default true\n */\n isMonthPickerVisible?: boolean;\n\n /**\n * Show month picker on top of date picker when visible.\n * @default false\n */\n showMonthPickerAsOverlay?: boolean;\n\n /**\n * Whether the DatePicker allows input a date string directly or not\n * @default false\n */\n allowTextInput?: boolean;\n\n /**\n * Whether the DatePicker should open automatically when the control is focused\n * WARNING: setting this to false creates an accessibility violation and is not recommended\n * @default true\n */\n disableAutoFocus?: boolean;\n\n /**\n * Whether the DatePicker should open when the input is clicked\n * @default true\n */\n openOnClick?: boolean;\n\n /**\n * Whether the DatePicker should be open by default\n *\n * @default false\n */\n defaultOpen?: boolean;\n\n /**\n * Whether the DatePicker is open or not\n *\n * @default false\n */\n open?: boolean;\n\n /**\n * Callback to run when the DatePicker's open state changes\n */\n onOpenChange?: (open: boolean) => void;\n\n /**\n * Callback to run after the DatePicker's input has been validated\n */\n onValidationResult?: (data: DatePickerValidationResultData) => void;\n\n /**\n * Whether the DatePicker should render the popup as inline or in a portal\n *\n * @default false\n */\n inlinePopup?: boolean;\n\n /**\n * Configure the positioning of the DatePicker dialog\n *\n * @default below\n */\n positioning?: PositioningProps;\n\n /**\n * Placeholder text for the DatePicker\n */\n placeholder?: string;\n\n /**\n * Value of today. If unspecified, current time in client machine will be used.\n */\n today?: Date;\n\n /**\n * Default value of the DatePicker, if any\n */\n value?: Date;\n\n /**\n * Optional method to format the chosen date to a string to display in the DatePicker\n * @default date.toString()\n */\n formatDate?: (date?: Date) => string;\n\n /**\n * Optional method to parse the text input value to date, it is only useful when allowTextInput is set to true\n * @default new Date(Date.parse(dateStr))\n */\n parseDateFromString?: (dateStr: string) => Date | null;\n\n /**\n * The first day of the week for your locale.\n * @default DayOfWeek.Sunday\n */\n firstDayOfWeek?: DayOfWeek;\n\n /**\n * Localized strings to use in the Calendar\n */\n strings?: CalendarStrings;\n\n /**\n * Whether the month picker should highlight the current month\n * @default false\n */\n highlightCurrentMonth?: boolean;\n\n /**\n * Whether the month picker should highlight the selected month\n * @default false\n */\n highlightSelectedMonth?: boolean;\n\n /**\n * Whether the calendar should show the week number (weeks 1 to 53) before each week row\n * @default false\n */\n showWeekNumbers?: boolean;\n\n /**\n * Defines when the first week of the year should start, FirstWeekOfYear.FirstDay,\n * FirstWeekOfYear.FirstFullWeek or FirstWeekOfYear.FirstFourDayWeek are the possible values\n * @default FirstWeekOfYear.FirstFullWeek\n */\n firstWeekOfYear?: FirstWeekOfYear;\n\n /**\n * Whether the \"Go to today\" link should be shown or not\n */\n showGoToToday?: boolean;\n\n /**\n * Determines if the DatePicker has a border.\n * @default false\n */\n borderless?: boolean;\n\n /**\n * Apply additional formatting to dates, for example localized date formatting.\n */\n dateTimeFormatter?: DateFormatting;\n\n /**\n * The minimum allowable date.\n */\n minDate?: Date;\n\n /**\n * The maximum allowable date.\n */\n maxDate?: Date;\n\n /**\n * The initially highlighted date.\n */\n initialPickerDate?: Date;\n\n /**\n * Allows all elements to be focused, including disabled ones\n * @default false\n */\n allFocusable?: boolean;\n\n /**\n * Whether the CalendarDay close button should be shown or not.\n */\n showCloseButton?: boolean;\n};\n\n/**\n * State used in rendering DatePicker.\n */\nexport type DatePickerState = ComponentState<DatePickerSlots> & {\n disabled: boolean;\n inlinePopup: boolean;\n};\n\n/**\n * Data passed to the `onValidationResult` callback.\n */\nexport type DatePickerValidationResultData = {\n /** The error found when validating the input. */\n error?: DatePickerErrorType;\n};\n\n/**\n * Error types returned by the `onValidationResult` callback.\n */\nexport type DatePickerErrorType = 'invalid-input' | 'out-of-bounds' | 'required-input';\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
1
|
+
{"version":3,"sources":["DatePicker.types.ts"],"sourcesContent":["import * as React from 'react';\nimport { DayOfWeek, FirstWeekOfYear } from '../../utils';\nimport { Input } from '@fluentui/react-input';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { CalendarProps } from '../Calendar/Calendar.types';\nimport type { CalendarStrings, DateFormatting } from '../../utils';\nimport type { PositioningProps } from '@fluentui/react-positioning';\n\nexport type DatePickerSlots = {\n root: NonNullable<Slot<typeof Input>>;\n calendar: NonNullable<Slot<Partial<CalendarProps>>>;\n popupSurface?: Slot<'div'>;\n};\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface IDatePicker {\n /** Sets focus to the input */\n focus(): void;\n\n /** Reset the state of the picker to the default */\n reset(): void;\n\n /** Open the datepicker popup */\n showDatePickerPopup(): void;\n}\n\nexport type DatePickerProps = Omit<ComponentProps<Partial<DatePickerSlots>>, 'defaultValue' | 'value'> & {\n /**\n * Optional callback to access the IDatePicker interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<IDatePicker>;\n\n /**\n * Callback issued when a date is selected\n */\n onSelectDate?: (date: Date | null | undefined) => void;\n\n /**\n * Whether the DatePicker is a required field or not. When using `<Field>`, this prop is automatically set.\n * @default false\n */\n required?: boolean;\n\n /**\n * Disabled state of the DatePicker.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Whether or not the Input of the DatePicker is underlined.\n * @default false\n */\n underlined?: boolean;\n\n /**\n * Whether the month picker is shown beside the day picker or hidden.\n * @default true\n */\n isMonthPickerVisible?: boolean;\n\n /**\n * Show month picker on top of date picker when visible.\n * @default false\n */\n showMonthPickerAsOverlay?: boolean;\n\n /**\n * Whether the DatePicker allows input a date string directly or not\n * @default false\n */\n allowTextInput?: boolean;\n\n /**\n * Whether the DatePicker should open automatically when the control is focused\n * WARNING: setting this to false creates an accessibility violation and is not recommended\n * @default true\n */\n disableAutoFocus?: boolean;\n\n /**\n * Whether the DatePicker should open when the input is clicked\n * @default true\n */\n openOnClick?: boolean;\n\n /**\n * Whether the DatePicker should be open by default\n *\n * @default false\n */\n defaultOpen?: boolean;\n\n /**\n * Whether the DatePicker is open or not\n *\n * @default false\n */\n open?: boolean;\n\n /**\n * Callback to run when the DatePicker's open state changes\n */\n onOpenChange?: (open: boolean) => void;\n\n /**\n * Callback to run after the DatePicker's input has been validated\n */\n onValidationResult?: (data: DatePickerValidationResultData) => void;\n\n /**\n * Whether the DatePicker should render the popup as inline or in a portal\n *\n * @default false\n */\n inlinePopup?: boolean;\n\n /**\n * Configure the positioning of the DatePicker dialog\n *\n * @default below\n */\n positioning?: PositioningProps;\n\n /**\n * Placeholder text for the DatePicker\n */\n placeholder?: string;\n\n /**\n * Value of today. If unspecified, current time in client machine will be used.\n */\n today?: Date;\n\n /**\n * Default value of the DatePicker, if any\n *\n * When the component is controlled, `null` should be used instead of `undefined` to avoid controlled vs. uncontrolled\n * ambiguity.\n */\n value?: Date | null;\n\n /**\n * Optional method to format the chosen date to a string to display in the DatePicker\n * @default date.toString()\n */\n formatDate?: (date?: Date) => string;\n\n /**\n * Optional method to parse the text input value to date, it is only useful when allowTextInput is set to true\n * @default new Date(Date.parse(dateStr))\n */\n parseDateFromString?: (dateStr: string) => Date | null;\n\n /**\n * The first day of the week for your locale.\n * @default DayOfWeek.Sunday\n */\n firstDayOfWeek?: DayOfWeek;\n\n /**\n * Localized strings to use in the Calendar\n */\n strings?: CalendarStrings;\n\n /**\n * Whether the month picker should highlight the current month\n * @default false\n */\n highlightCurrentMonth?: boolean;\n\n /**\n * Whether the month picker should highlight the selected month\n * @default false\n */\n highlightSelectedMonth?: boolean;\n\n /**\n * Whether the calendar should show the week number (weeks 1 to 53) before each week row\n * @default false\n */\n showWeekNumbers?: boolean;\n\n /**\n * Defines when the first week of the year should start, FirstWeekOfYear.FirstDay,\n * FirstWeekOfYear.FirstFullWeek or FirstWeekOfYear.FirstFourDayWeek are the possible values\n * @default FirstWeekOfYear.FirstFullWeek\n */\n firstWeekOfYear?: FirstWeekOfYear;\n\n /**\n * Whether the \"Go to today\" link should be shown or not\n */\n showGoToToday?: boolean;\n\n /**\n * Determines if the DatePicker has a border.\n * @default false\n */\n borderless?: boolean;\n\n /**\n * Apply additional formatting to dates, for example localized date formatting.\n */\n dateTimeFormatter?: DateFormatting;\n\n /**\n * The minimum allowable date.\n */\n minDate?: Date;\n\n /**\n * The maximum allowable date.\n */\n maxDate?: Date;\n\n /**\n * The initially highlighted date.\n */\n initialPickerDate?: Date;\n\n /**\n * Allows all elements to be focused, including disabled ones\n * @default false\n */\n allFocusable?: boolean;\n\n /**\n * Whether the CalendarDay close button should be shown or not.\n */\n showCloseButton?: boolean;\n};\n\n/**\n * State used in rendering DatePicker.\n */\nexport type DatePickerState = ComponentState<DatePickerSlots> & {\n disabled: boolean;\n inlinePopup: boolean;\n};\n\n/**\n * Data passed to the `onValidationResult` callback.\n */\nexport type DatePickerValidationResultData = {\n /** The error found when validating the input. */\n error?: DatePickerErrorType;\n};\n\n/**\n * Error types returned by the `onValidationResult` callback.\n */\nexport type DatePickerErrorType = 'invalid-input' | 'out-of-bounds' | 'required-input';\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
@@ -5,7 +5,7 @@ import { CalendarMonthRegular } from '@fluentui/react-icons';
|
|
|
5
5
|
import { compareDatePart, DayOfWeek, FirstWeekOfYear } from '../../utils';
|
|
6
6
|
import { defaultDatePickerStrings } from './defaults';
|
|
7
7
|
import { Input } from '@fluentui/react-input';
|
|
8
|
-
import { mergeCallbacks, resolveShorthand, useControllableState, useId, useMergedRefs, useOnClickOutside, useOnScrollOutside } from '@fluentui/react-utilities';
|
|
8
|
+
import { mergeCallbacks, resolveShorthand, useControllableState, useFirstMount, useId, useMergedRefs, useOnClickOutside, useOnScrollOutside } from '@fluentui/react-utilities';
|
|
9
9
|
import { useFieldContext_unstable as useFieldContext } from '@fluentui/react-field';
|
|
10
10
|
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
|
|
11
11
|
import { useModalAttributes } from '@fluentui/react-tabster';
|
|
@@ -57,14 +57,12 @@ function usePopupVisibility(props) {
|
|
|
57
57
|
}
|
|
58
58
|
function useSelectedDate({ formatDate , onSelectDate , value }) {
|
|
59
59
|
const [selectedDate, setSelectedDateState] = useControllableState({
|
|
60
|
-
initialState:
|
|
60
|
+
initialState: null,
|
|
61
61
|
state: value
|
|
62
62
|
});
|
|
63
63
|
const [formattedDate, setFormattedDate] = React.useState(()=>value && formatDate ? formatDate(value) : '');
|
|
64
64
|
const setSelectedDate = (newDate)=>{
|
|
65
|
-
|
|
66
|
-
onSelectDate === null || onSelectDate === void 0 ? void 0 : onSelectDate(newDate);
|
|
67
|
-
}
|
|
65
|
+
onSelectDate === null || onSelectDate === void 0 ? void 0 : onSelectDate(newDate);
|
|
68
66
|
setSelectedDateState(newDate);
|
|
69
67
|
setFormattedDate(newDate && formatDate ? formatDate(newDate) : '');
|
|
70
68
|
};
|
|
@@ -373,14 +371,16 @@ const defaultParseDateFromString = (dateStr)=>{
|
|
|
373
371
|
open,
|
|
374
372
|
props.disabled
|
|
375
373
|
]);
|
|
374
|
+
const isFirstMount = useFirstMount();
|
|
376
375
|
// When the popup is closed, focus should go back to the input.
|
|
377
376
|
React.useEffect(()=>{
|
|
378
|
-
if (!open && !props.disabled) {
|
|
377
|
+
if (!open && !props.disabled && !isFirstMount) {
|
|
379
378
|
focus();
|
|
380
379
|
}
|
|
381
380
|
// Focus function keeps changing, so we need to skip it in the deps
|
|
382
381
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
383
382
|
}, [
|
|
383
|
+
isFirstMount,
|
|
384
384
|
open,
|
|
385
385
|
props.disabled
|
|
386
386
|
]);
|
|
@@ -412,7 +412,7 @@ const defaultParseDateFromString = (dateStr)=>{
|
|
|
412
412
|
focus,
|
|
413
413
|
reset () {
|
|
414
414
|
setOpen(false);
|
|
415
|
-
setSelectedDate(
|
|
415
|
+
setSelectedDate(null);
|
|
416
416
|
},
|
|
417
417
|
showDatePickerPopup
|
|
418
418
|
}), [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDatePicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ArrowDown, Enter, Escape } from '@fluentui/keyboard-keys';\nimport { Calendar } from '../Calendar/Calendar';\nimport { CalendarMonthRegular } from '@fluentui/react-icons';\nimport { compareDatePart, DayOfWeek, FirstWeekOfYear } from '../../utils';\nimport { defaultDatePickerStrings } from './defaults';\nimport { Input } from '@fluentui/react-input';\nimport {\n mergeCallbacks,\n resolveShorthand,\n useControllableState,\n useId,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n} from '@fluentui/react-utilities';\nimport { useFieldContext_unstable as useFieldContext } from '@fluentui/react-field';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopupPositioning } from '../../utils/usePopupPositioning';\nimport type { CalendarProps, ICalendar } from '../Calendar/Calendar.types';\nimport type { DatePickerProps, DatePickerState, DatePickerValidationResultData } from './DatePicker.types';\nimport type { InputProps, InputOnChangeData } from '@fluentui/react-input';\n\nfunction isDateOutOfBounds(date: Date, minDate?: Date, maxDate?: Date): boolean {\n return (!!minDate && compareDatePart(minDate!, date) > 0) || (!!maxDate && compareDatePart(maxDate!, date) < 0);\n}\n\nfunction useFocusLogic() {\n const inputRef = React.useRef<HTMLInputElement>(null);\n const preventFocusOpeningPicker = React.useRef(false);\n\n const focus = () => {\n inputRef.current?.focus?.();\n };\n\n const preventNextFocusOpeningPicker = () => {\n preventFocusOpeningPicker.current = true;\n };\n\n return [focus, inputRef, preventFocusOpeningPicker, preventNextFocusOpeningPicker] as const;\n}\n\nfunction usePopupVisibility(props: DatePickerProps) {\n const [open, setOpen] = useControllableState({\n initialState: false,\n defaultState: props.defaultOpen,\n state: props.open,\n });\n const isMounted = React.useRef(false);\n\n React.useEffect(\n () => {\n if (isMounted.current && !open) {\n // If DatePicker's menu (Calendar) is closed, run onAfterMenuDismiss\n props.onOpenChange?.(false);\n }\n isMounted.current = true;\n },\n // Should only run on allowTextInput or open change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [props.allowTextInput, open],\n );\n\n return [open, setOpen] as const;\n}\n\nfunction useSelectedDate({ formatDate, onSelectDate, value }: DatePickerProps) {\n const [selectedDate, setSelectedDateState] = useControllableState({\n initialState: undefined,\n state: value,\n });\n const [formattedDate, setFormattedDate] = React.useState(() => (value && formatDate ? formatDate(value) : ''));\n\n const setSelectedDate = (newDate: Date | undefined) => {\n if (\n (selectedDate === undefined && newDate !== undefined) ||\n (selectedDate !== undefined && newDate === undefined) ||\n (newDate && selectedDate && (newDate > selectedDate || newDate < selectedDate))\n ) {\n onSelectDate?.(newDate);\n }\n\n setSelectedDateState(newDate);\n setFormattedDate(newDate && formatDate ? formatDate(newDate) : '');\n };\n\n React.useEffect(() => {\n setFormattedDate(value && formatDate ? formatDate(value) : '');\n }, [formatDate, value]);\n\n return [selectedDate, formattedDate, setSelectedDate, setFormattedDate] as const;\n}\n\nconst defaultFormatDate = (date?: Date) => (date ? date.toDateString() : '');\nconst defaultParseDateFromString = (dateStr: string) => {\n const date = Date.parse(dateStr);\n return date ? new Date(date) : null;\n};\n\n/**\n * Create the state required to render DatePicker.\n *\n * The returned state can be modified with hooks such as useDatePickerStyles_unstable,\n * before being passed to renderDatePicker_unstable.\n *\n * @param props - props from this instance of DatePicker\n * @param ref - reference to root Input slot\n */\nexport const useDatePicker_unstable = (props: DatePickerProps, ref: React.Ref<HTMLElement>): DatePickerState => {\n const {\n allowTextInput = false,\n allFocusable = false,\n borderless = false,\n dateTimeFormatter,\n defaultOpen = false,\n disableAutoFocus = true,\n firstDayOfWeek = DayOfWeek.Sunday,\n firstWeekOfYear = FirstWeekOfYear.FirstDay,\n formatDate = defaultFormatDate,\n highlightCurrentMonth = false,\n highlightSelectedMonth = false,\n initialPickerDate = new Date(),\n inlinePopup = false,\n isMonthPickerVisible = true,\n maxDate,\n minDate,\n onOpenChange,\n onSelectDate: onUserSelectDate,\n openOnClick = true,\n onValidationResult,\n parseDateFromString = defaultParseDateFromString,\n showCloseButton = false,\n showGoToToday = true,\n showMonthPickerAsOverlay = false,\n showWeekNumbers = false,\n strings = defaultDatePickerStrings,\n today,\n underlined = false,\n value,\n ...restOfProps\n } = props;\n const calendar = React.useRef<ICalendar>(null);\n const [focus, rootRef, preventFocusOpeningPicker, preventNextFocusOpeningPicker] = useFocusLogic();\n const [selectedDate, formattedDate, setSelectedDate, setFormattedDate] = useSelectedDate({\n formatDate,\n onSelectDate: onUserSelectDate,\n value,\n });\n const [open, setOpenState] = usePopupVisibility(props);\n const fieldContext = useFieldContext();\n const required = fieldContext?.required ?? props.required;\n const popupSurfaceId = useId('datePicker-popupSurface');\n\n const validateTextInput = React.useCallback(\n (date: Date | null = null): void => {\n let error: DatePickerValidationResultData['error'];\n\n if (allowTextInput) {\n if (formattedDate || date) {\n // Don't parse if the selected date has the same formatted string as what we're about to parse.\n // The formatted string might be ambiguous (ex: \"1/2/3\" or \"New Year Eve\") and the parser might\n // not be able to come up with the exact same date.\n if (selectedDate && formatDate && formatDate(date ?? selectedDate) === formattedDate) {\n return;\n }\n date = date || parseDateFromString!(formattedDate);\n\n // Check if date is null or date is an invalid date\n if (!date || isNaN(date.getTime())) {\n // Reset input if formatting is available\n setSelectedDate(selectedDate);\n error = 'invalid-input';\n } else {\n if (isDateOutOfBounds(date, minDate, maxDate)) {\n error = 'out-of-bounds';\n } else {\n setSelectedDate(date);\n }\n }\n } else {\n if (required) {\n error = 'required-input';\n }\n\n onUserSelectDate?.(date);\n }\n } else if (required && !formattedDate) {\n error = 'required-input';\n }\n\n onValidationResult?.({ error });\n },\n [\n allowTextInput,\n formatDate,\n formattedDate,\n maxDate,\n minDate,\n onUserSelectDate,\n onValidationResult,\n parseDateFromString,\n required,\n selectedDate,\n setSelectedDate,\n ],\n );\n\n const setOpen = React.useCallback(\n (newState: boolean) => {\n onOpenChange?.(newState);\n setOpenState(newState);\n },\n [onOpenChange, setOpenState],\n );\n\n const dismissDatePickerPopup = React.useCallback(\n (newlySelectedDate?: Date): void => {\n if (open) {\n setOpen(false);\n\n validateTextInput(newlySelectedDate);\n if (!allowTextInput && newlySelectedDate) {\n setSelectedDate(newlySelectedDate);\n }\n }\n },\n [allowTextInput, open, setOpen, setSelectedDate, validateTextInput],\n );\n\n const showDatePickerPopup = React.useCallback((): void => {\n if (!open) {\n preventNextFocusOpeningPicker();\n setOpen(true);\n }\n }, [open, preventNextFocusOpeningPicker, setOpen]);\n\n /**\n * Callback for closing the calendar callout\n */\n const calendarDismissed = React.useCallback(\n (newlySelectedDate?: Date): void => {\n preventNextFocusOpeningPicker();\n dismissDatePickerPopup(newlySelectedDate);\n },\n [dismissDatePickerPopup, preventNextFocusOpeningPicker],\n );\n\n const onInputChange = React.useCallback(\n (ev: React.ChangeEvent<HTMLInputElement>, data: InputOnChangeData) => {\n const { value: newValue } = data;\n\n if (allowTextInput) {\n if (open) {\n dismissDatePickerPopup();\n }\n\n setFormattedDate(newValue);\n }\n },\n [allowTextInput, dismissDatePickerPopup, open, setFormattedDate],\n );\n\n const onInputBlur: React.FocusEventHandler<HTMLInputElement> = React.useCallback((): void => {\n validateTextInput();\n }, [validateTextInput]);\n\n const onInputKeyDown = React.useCallback(\n (ev: React.KeyboardEvent<HTMLElement>): void => {\n switch (ev.key) {\n case Enter:\n ev.preventDefault();\n ev.stopPropagation();\n if (!open) {\n validateTextInput();\n showDatePickerPopup();\n } else {\n // When DatePicker allows input date string directly,\n // it is expected to hit another enter to close the popup\n if (props.allowTextInput) {\n dismissDatePickerPopup();\n }\n }\n break;\n\n case Escape:\n ev.stopPropagation();\n ev.preventDefault();\n if (open) {\n calendarDismissed();\n }\n break;\n\n case ArrowDown:\n ev.preventDefault();\n if (ev.altKey && !open) {\n showDatePickerPopup();\n }\n break;\n\n default:\n break;\n }\n },\n [calendarDismissed, dismissDatePickerPopup, open, props.allowTextInput, showDatePickerPopup, validateTextInput],\n );\n\n const onInputFocus: React.FocusEventHandler<HTMLInputElement> = React.useCallback((): void => {\n if (disableAutoFocus) {\n return;\n }\n\n if (!allowTextInput) {\n if (!preventFocusOpeningPicker.current) {\n showDatePickerPopup();\n }\n preventFocusOpeningPicker.current = false;\n }\n }, [allowTextInput, disableAutoFocus, preventFocusOpeningPicker, showDatePickerPopup]);\n\n const onInputClick: React.MouseEventHandler<HTMLInputElement> = React.useCallback((): void => {\n // default openOnClick to !props.disableAutoFocus for legacy support of disableAutoFocus behavior\n if ((props.openOnClick || !props.disableAutoFocus) && !open && !props.disabled) {\n showDatePickerPopup();\n return;\n }\n\n if (allowTextInput) {\n dismissDatePickerPopup();\n }\n }, [\n allowTextInput,\n dismissDatePickerPopup,\n open,\n props.disabled,\n props.disableAutoFocus,\n props.openOnClick,\n showDatePickerPopup,\n ]);\n\n const onIconClick = (ev: React.MouseEvent<HTMLElement>): void => {\n ev.stopPropagation();\n if (!open && !props.disabled) {\n showDatePickerPopup();\n } else if (props.allowTextInput) {\n dismissDatePickerPopup();\n }\n };\n\n const inputAppearance: InputProps['appearance'] = underlined\n ? 'underline'\n : borderless\n ? 'filled-lighter'\n : 'outline';\n\n const [triggerWrapperRef, popupRef] = usePopupPositioning(props);\n const rootShorthand = resolveShorthand(restOfProps, {\n required: true,\n defaultProps: {\n appearance: inputAppearance,\n 'aria-controls': open ? popupSurfaceId : undefined,\n 'aria-expanded': open,\n 'aria-haspopup': 'dialog',\n contentAfter: <CalendarMonthRegular onClick={onIconClick as unknown as React.MouseEventHandler<SVGElement>} />,\n readOnly: !allowTextInput,\n role: 'combobox',\n root: {\n 'aria-owns': open ? popupSurfaceId : undefined,\n ref: useMergedRefs(triggerWrapperRef, ref),\n },\n input: {\n ref: rootRef,\n },\n },\n });\n\n rootShorthand.onChange = mergeCallbacks(rootShorthand.onChange, onInputChange);\n rootShorthand.onBlur = mergeCallbacks(rootShorthand.onBlur, onInputBlur);\n rootShorthand.onKeyDown = mergeCallbacks(rootShorthand.onKeyDown, onInputKeyDown);\n rootShorthand.onFocus = mergeCallbacks(rootShorthand.onFocus, onInputFocus);\n rootShorthand.onClick = mergeCallbacks(rootShorthand.onClick, onInputClick);\n\n const { modalAttributes } = useModalAttributes({ trapFocus: true, alwaysFocusable: true, legacyTrapFocus: false });\n const popupSurfaceShorthand = open\n ? resolveShorthand(props.popupSurface, {\n required: true,\n defaultProps: {\n 'aria-label': 'Calendar',\n 'aria-modal': true,\n id: popupSurfaceId,\n role: 'dialog',\n ref: popupRef,\n ...modalAttributes,\n },\n })\n : undefined;\n\n const { targetDocument } = useFluent();\n useOnClickOutside({\n element: targetDocument,\n callback: ev => dismissDatePickerPopup(),\n refs: [triggerWrapperRef, popupRef],\n disabled: !open,\n });\n\n useOnScrollOutside({\n element: targetDocument,\n callback: ev => dismissDatePickerPopup(),\n refs: [triggerWrapperRef, popupRef],\n disabled: !open,\n });\n\n // When the popup is opened, focus should go to the calendar.\n // In v8 this was done by focusing after the callout was positioned, but in v9 this can be simulated by using a\n // useEffect hook.\n React.useEffect(() => {\n if (open && !props.disabled && calendar.current) {\n calendar.current.focus();\n }\n }, [disableAutoFocus, open, props.disabled]);\n\n // When the popup is closed, focus should go back to the input.\n React.useEffect(() => {\n if (!open && !props.disabled) {\n focus();\n }\n // Focus function keeps changing, so we need to skip it in the deps\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, props.disabled]);\n\n const calendarShorthand = resolveShorthand(props.calendar, {\n required: true,\n defaultProps: {\n allFocusable,\n componentRef: calendar,\n dateTimeFormatter,\n firstDayOfWeek,\n firstWeekOfYear,\n highlightCurrentMonth,\n highlightSelectedMonth,\n isMonthPickerVisible,\n maxDate,\n minDate,\n showCloseButton,\n showGoToToday,\n showMonthPickerAsOverlay,\n showWeekNumbers,\n strings,\n today,\n value: selectedDate || initialPickerDate,\n },\n });\n\n calendarShorthand.onDismiss = mergeCallbacks(calendarShorthand.onDismiss, calendarDismissed);\n calendarShorthand.onSelectDate = mergeCallbacks(calendarShorthand.onSelectDate, calendarDismissed);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n focus,\n reset() {\n setOpen(false);\n setSelectedDate(undefined);\n },\n showDatePickerPopup,\n }),\n [focus, setOpen, setSelectedDate, showDatePickerPopup],\n );\n\n const state: DatePickerState = {\n disabled: !!props.disabled,\n inlinePopup,\n\n components: {\n root: Input,\n calendar: Calendar as React.FC<Partial<CalendarProps>>,\n popupSurface: 'div',\n },\n\n calendar: calendarShorthand,\n root: rootShorthand,\n popupSurface: popupSurfaceShorthand,\n };\n\n state.root.value = formattedDate;\n\n return state;\n};\n"],"names":["React","ArrowDown","Enter","Escape","Calendar","CalendarMonthRegular","compareDatePart","DayOfWeek","FirstWeekOfYear","defaultDatePickerStrings","Input","mergeCallbacks","resolveShorthand","useControllableState","useId","useMergedRefs","useOnClickOutside","useOnScrollOutside","useFieldContext_unstable","useFieldContext","useFluent_unstable","useFluent","useModalAttributes","usePopupPositioning","isDateOutOfBounds","date","minDate","maxDate","useFocusLogic","inputRef","useRef","preventFocusOpeningPicker","focus","current","preventNextFocusOpeningPicker","usePopupVisibility","props","open","setOpen","initialState","defaultState","defaultOpen","state","isMounted","useEffect","onOpenChange","allowTextInput","useSelectedDate","formatDate","onSelectDate","value","selectedDate","setSelectedDateState","undefined","formattedDate","setFormattedDate","useState","setSelectedDate","newDate","defaultFormatDate","toDateString","defaultParseDateFromString","dateStr","Date","parse","useDatePicker_unstable","ref","allFocusable","borderless","dateTimeFormatter","disableAutoFocus","firstDayOfWeek","Sunday","firstWeekOfYear","FirstDay","highlightCurrentMonth","highlightSelectedMonth","initialPickerDate","inlinePopup","isMonthPickerVisible","onUserSelectDate","openOnClick","onValidationResult","parseDateFromString","showCloseButton","showGoToToday","showMonthPickerAsOverlay","showWeekNumbers","strings","today","underlined","restOfProps","calendar","rootRef","setOpenState","fieldContext","required","popupSurfaceId","validateTextInput","useCallback","error","isNaN","getTime","newState","dismissDatePickerPopup","newlySelectedDate","showDatePickerPopup","calendarDismissed","onInputChange","ev","data","newValue","onInputBlur","onInputKeyDown","key","preventDefault","stopPropagation","altKey","onInputFocus","onInputClick","disabled","onIconClick","inputAppearance","triggerWrapperRef","popupRef","rootShorthand","defaultProps","appearance","contentAfter","onClick","readOnly","role","root","input","onChange","onBlur","onKeyDown","onFocus","modalAttributes","trapFocus","alwaysFocusable","legacyTrapFocus","popupSurfaceShorthand","popupSurface","id","targetDocument","element","callback","refs","calendarShorthand","componentRef","onDismiss","useImperativeHandle","reset","components"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,SAAS,EAAEC,KAAK,EAAEC,MAAM,QAAQ,0BAA0B;AACnE,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,e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IAEApG,MAAM0F,IAAI,CAAClF,KAAK,GAAGI;IAEnB,OAAOZ;AACT,EAAE"}
|
|
1
|
+
{"version":3,"sources":["useDatePicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ArrowDown, Enter, Escape } from '@fluentui/keyboard-keys';\nimport { Calendar } from '../Calendar/Calendar';\nimport { CalendarMonthRegular } from '@fluentui/react-icons';\nimport { compareDatePart, DayOfWeek, FirstWeekOfYear } from '../../utils';\nimport { defaultDatePickerStrings } from './defaults';\nimport { Input } from '@fluentui/react-input';\nimport {\n mergeCallbacks,\n resolveShorthand,\n useControllableState,\n useFirstMount,\n useId,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n} from '@fluentui/react-utilities';\nimport { useFieldContext_unstable as useFieldContext } from '@fluentui/react-field';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopupPositioning } from '../../utils/usePopupPositioning';\nimport type { CalendarProps, ICalendar } from '../Calendar/Calendar.types';\nimport type { DatePickerProps, DatePickerState, DatePickerValidationResultData } from './DatePicker.types';\nimport type { InputProps, InputOnChangeData } from '@fluentui/react-input';\n\nfunction isDateOutOfBounds(date: Date, minDate?: Date, maxDate?: Date): boolean {\n return (!!minDate && compareDatePart(minDate!, date) > 0) || (!!maxDate && compareDatePart(maxDate!, date) < 0);\n}\n\nfunction useFocusLogic() {\n const inputRef = React.useRef<HTMLInputElement>(null);\n const preventFocusOpeningPicker = React.useRef(false);\n\n const focus = () => {\n inputRef.current?.focus?.();\n };\n\n const preventNextFocusOpeningPicker = () => {\n preventFocusOpeningPicker.current = true;\n };\n\n return [focus, inputRef, preventFocusOpeningPicker, preventNextFocusOpeningPicker] as const;\n}\n\nfunction usePopupVisibility(props: DatePickerProps) {\n const [open, setOpen] = useControllableState({\n initialState: false,\n defaultState: props.defaultOpen,\n state: props.open,\n });\n const isMounted = React.useRef(false);\n\n React.useEffect(\n () => {\n if (isMounted.current && !open) {\n // If DatePicker's menu (Calendar) is closed, run onAfterMenuDismiss\n props.onOpenChange?.(false);\n }\n isMounted.current = true;\n },\n // Should only run on allowTextInput or open change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [props.allowTextInput, open],\n );\n\n return [open, setOpen] as const;\n}\n\nfunction useSelectedDate({ formatDate, onSelectDate, value }: DatePickerProps) {\n const [selectedDate, setSelectedDateState] = useControllableState<Date | null | undefined>({\n initialState: null,\n state: value,\n });\n const [formattedDate, setFormattedDate] = React.useState(() => (value && formatDate ? formatDate(value) : ''));\n\n const setSelectedDate = (newDate: Date | null | undefined) => {\n onSelectDate?.(newDate);\n setSelectedDateState(newDate);\n setFormattedDate(newDate && formatDate ? formatDate(newDate) : '');\n };\n\n React.useEffect(() => {\n setFormattedDate(value && formatDate ? formatDate(value) : '');\n }, [formatDate, value]);\n\n return [selectedDate, formattedDate, setSelectedDate, setFormattedDate] as const;\n}\n\nconst defaultFormatDate = (date?: Date) => (date ? date.toDateString() : '');\nconst defaultParseDateFromString = (dateStr: string) => {\n const date = Date.parse(dateStr);\n return date ? new Date(date) : null;\n};\n\n/**\n * Create the state required to render DatePicker.\n *\n * The returned state can be modified with hooks such as useDatePickerStyles_unstable,\n * before being passed to renderDatePicker_unstable.\n *\n * @param props - props from this instance of DatePicker\n * @param ref - reference to root Input slot\n */\nexport const useDatePicker_unstable = (props: DatePickerProps, ref: React.Ref<HTMLElement>): DatePickerState => {\n const {\n allowTextInput = false,\n allFocusable = false,\n borderless = false,\n dateTimeFormatter,\n defaultOpen = false,\n disableAutoFocus = true,\n firstDayOfWeek = DayOfWeek.Sunday,\n firstWeekOfYear = FirstWeekOfYear.FirstDay,\n formatDate = defaultFormatDate,\n highlightCurrentMonth = false,\n highlightSelectedMonth = false,\n initialPickerDate = new Date(),\n inlinePopup = false,\n isMonthPickerVisible = true,\n maxDate,\n minDate,\n onOpenChange,\n onSelectDate: onUserSelectDate,\n openOnClick = true,\n onValidationResult,\n parseDateFromString = defaultParseDateFromString,\n showCloseButton = false,\n showGoToToday = true,\n showMonthPickerAsOverlay = false,\n showWeekNumbers = false,\n strings = defaultDatePickerStrings,\n today,\n underlined = false,\n value,\n ...restOfProps\n } = props;\n const calendar = React.useRef<ICalendar>(null);\n const [focus, rootRef, preventFocusOpeningPicker, preventNextFocusOpeningPicker] = useFocusLogic();\n const [selectedDate, formattedDate, setSelectedDate, setFormattedDate] = useSelectedDate({\n formatDate,\n onSelectDate: onUserSelectDate,\n value,\n });\n const [open, setOpenState] = usePopupVisibility(props);\n const fieldContext = useFieldContext();\n const required = fieldContext?.required ?? props.required;\n const popupSurfaceId = useId('datePicker-popupSurface');\n\n const validateTextInput = React.useCallback(\n (date: Date | null = null): void => {\n let error: DatePickerValidationResultData['error'];\n\n if (allowTextInput) {\n if (formattedDate || date) {\n // Don't parse if the selected date has the same formatted string as what we're about to parse.\n // The formatted string might be ambiguous (ex: \"1/2/3\" or \"New Year Eve\") and the parser might\n // not be able to come up with the exact same date.\n if (selectedDate && formatDate && formatDate(date ?? selectedDate) === formattedDate) {\n return;\n }\n date = date || parseDateFromString!(formattedDate);\n\n // Check if date is null or date is an invalid date\n if (!date || isNaN(date.getTime())) {\n // Reset input if formatting is available\n setSelectedDate(selectedDate);\n error = 'invalid-input';\n } else {\n if (isDateOutOfBounds(date, minDate, maxDate)) {\n error = 'out-of-bounds';\n } else {\n setSelectedDate(date);\n }\n }\n } else {\n if (required) {\n error = 'required-input';\n }\n\n onUserSelectDate?.(date);\n }\n } else if (required && !formattedDate) {\n error = 'required-input';\n }\n\n onValidationResult?.({ error });\n },\n [\n allowTextInput,\n formatDate,\n formattedDate,\n maxDate,\n minDate,\n onUserSelectDate,\n onValidationResult,\n parseDateFromString,\n required,\n selectedDate,\n setSelectedDate,\n ],\n );\n\n const setOpen = React.useCallback(\n (newState: boolean) => {\n onOpenChange?.(newState);\n setOpenState(newState);\n },\n [onOpenChange, setOpenState],\n );\n\n const dismissDatePickerPopup = React.useCallback(\n (newlySelectedDate?: Date | null): void => {\n if (open) {\n setOpen(false);\n\n validateTextInput(newlySelectedDate);\n if (!allowTextInput && newlySelectedDate) {\n setSelectedDate(newlySelectedDate);\n }\n }\n },\n [allowTextInput, open, setOpen, setSelectedDate, validateTextInput],\n );\n\n const showDatePickerPopup = React.useCallback((): void => {\n if (!open) {\n preventNextFocusOpeningPicker();\n setOpen(true);\n }\n }, [open, preventNextFocusOpeningPicker, setOpen]);\n\n /**\n * Callback for closing the calendar callout\n */\n const calendarDismissed = React.useCallback(\n (newlySelectedDate?: Date): void => {\n preventNextFocusOpeningPicker();\n dismissDatePickerPopup(newlySelectedDate);\n },\n [dismissDatePickerPopup, preventNextFocusOpeningPicker],\n );\n\n const onInputChange = React.useCallback(\n (ev: React.ChangeEvent<HTMLInputElement>, data: InputOnChangeData) => {\n const { value: newValue } = data;\n\n if (allowTextInput) {\n if (open) {\n dismissDatePickerPopup();\n }\n\n setFormattedDate(newValue);\n }\n },\n [allowTextInput, dismissDatePickerPopup, open, setFormattedDate],\n );\n\n const onInputBlur: React.FocusEventHandler<HTMLInputElement> = React.useCallback((): void => {\n validateTextInput();\n }, [validateTextInput]);\n\n const onInputKeyDown = React.useCallback(\n (ev: React.KeyboardEvent<HTMLElement>): void => {\n switch (ev.key) {\n case Enter:\n ev.preventDefault();\n ev.stopPropagation();\n if (!open) {\n validateTextInput();\n showDatePickerPopup();\n } else {\n // When DatePicker allows input date string directly,\n // it is expected to hit another enter to close the popup\n if (props.allowTextInput) {\n dismissDatePickerPopup();\n }\n }\n break;\n\n case Escape:\n ev.stopPropagation();\n ev.preventDefault();\n if (open) {\n calendarDismissed();\n }\n break;\n\n case ArrowDown:\n ev.preventDefault();\n if (ev.altKey && !open) {\n showDatePickerPopup();\n }\n break;\n\n default:\n break;\n }\n },\n [calendarDismissed, dismissDatePickerPopup, open, props.allowTextInput, showDatePickerPopup, validateTextInput],\n );\n\n const onInputFocus: React.FocusEventHandler<HTMLInputElement> = React.useCallback((): void => {\n if (disableAutoFocus) {\n return;\n }\n\n if (!allowTextInput) {\n if (!preventFocusOpeningPicker.current) {\n showDatePickerPopup();\n }\n preventFocusOpeningPicker.current = false;\n }\n }, [allowTextInput, disableAutoFocus, preventFocusOpeningPicker, showDatePickerPopup]);\n\n const onInputClick: React.MouseEventHandler<HTMLInputElement> = React.useCallback((): void => {\n // default openOnClick to !props.disableAutoFocus for legacy support of disableAutoFocus behavior\n if ((props.openOnClick || !props.disableAutoFocus) && !open && !props.disabled) {\n showDatePickerPopup();\n return;\n }\n\n if (allowTextInput) {\n dismissDatePickerPopup();\n }\n }, [\n allowTextInput,\n dismissDatePickerPopup,\n open,\n props.disabled,\n props.disableAutoFocus,\n props.openOnClick,\n showDatePickerPopup,\n ]);\n\n const onIconClick = (ev: React.MouseEvent<HTMLElement>): void => {\n ev.stopPropagation();\n if (!open && !props.disabled) {\n showDatePickerPopup();\n } else if (props.allowTextInput) {\n dismissDatePickerPopup();\n }\n };\n\n const inputAppearance: InputProps['appearance'] = underlined\n ? 'underline'\n : borderless\n ? 'filled-lighter'\n : 'outline';\n\n const [triggerWrapperRef, popupRef] = usePopupPositioning(props);\n const rootShorthand = resolveShorthand(restOfProps, {\n required: true,\n defaultProps: {\n appearance: inputAppearance,\n 'aria-controls': open ? popupSurfaceId : undefined,\n 'aria-expanded': open,\n 'aria-haspopup': 'dialog',\n contentAfter: <CalendarMonthRegular onClick={onIconClick as unknown as React.MouseEventHandler<SVGElement>} />,\n readOnly: !allowTextInput,\n role: 'combobox',\n root: {\n 'aria-owns': open ? popupSurfaceId : undefined,\n ref: useMergedRefs(triggerWrapperRef, ref),\n },\n input: {\n ref: rootRef,\n },\n },\n });\n\n rootShorthand.onChange = mergeCallbacks(rootShorthand.onChange, onInputChange);\n rootShorthand.onBlur = mergeCallbacks(rootShorthand.onBlur, onInputBlur);\n rootShorthand.onKeyDown = mergeCallbacks(rootShorthand.onKeyDown, onInputKeyDown);\n rootShorthand.onFocus = mergeCallbacks(rootShorthand.onFocus, onInputFocus);\n rootShorthand.onClick = mergeCallbacks(rootShorthand.onClick, onInputClick);\n\n const { modalAttributes } = useModalAttributes({ trapFocus: true, alwaysFocusable: true, legacyTrapFocus: false });\n const popupSurfaceShorthand = open\n ? resolveShorthand(props.popupSurface, {\n required: true,\n defaultProps: {\n 'aria-label': 'Calendar',\n 'aria-modal': true,\n id: popupSurfaceId,\n role: 'dialog',\n ref: popupRef,\n ...modalAttributes,\n },\n })\n : undefined;\n\n const { targetDocument } = useFluent();\n useOnClickOutside({\n element: targetDocument,\n callback: ev => dismissDatePickerPopup(),\n refs: [triggerWrapperRef, popupRef],\n disabled: !open,\n });\n\n useOnScrollOutside({\n element: targetDocument,\n callback: ev => dismissDatePickerPopup(),\n refs: [triggerWrapperRef, popupRef],\n disabled: !open,\n });\n\n // When the popup is opened, focus should go to the calendar.\n // In v8 this was done by focusing after the callout was positioned, but in v9 this can be simulated by using a\n // useEffect hook.\n React.useEffect(() => {\n if (open && !props.disabled && calendar.current) {\n calendar.current.focus();\n }\n }, [disableAutoFocus, open, props.disabled]);\n\n const isFirstMount = useFirstMount();\n // When the popup is closed, focus should go back to the input.\n React.useEffect(() => {\n if (!open && !props.disabled && !isFirstMount) {\n focus();\n }\n // Focus function keeps changing, so we need to skip it in the deps\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isFirstMount, open, props.disabled]);\n\n const calendarShorthand = resolveShorthand(props.calendar, {\n required: true,\n defaultProps: {\n allFocusable,\n componentRef: calendar,\n dateTimeFormatter,\n firstDayOfWeek,\n firstWeekOfYear,\n highlightCurrentMonth,\n highlightSelectedMonth,\n isMonthPickerVisible,\n maxDate,\n minDate,\n showCloseButton,\n showGoToToday,\n showMonthPickerAsOverlay,\n showWeekNumbers,\n strings,\n today,\n value: selectedDate || initialPickerDate,\n },\n });\n\n calendarShorthand.onDismiss = mergeCallbacks(calendarShorthand.onDismiss, calendarDismissed);\n calendarShorthand.onSelectDate = mergeCallbacks(calendarShorthand.onSelectDate, calendarDismissed);\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n focus,\n reset() {\n setOpen(false);\n setSelectedDate(null);\n },\n showDatePickerPopup,\n }),\n [focus, setOpen, setSelectedDate, showDatePickerPopup],\n );\n\n const state: DatePickerState = {\n disabled: !!props.disabled,\n inlinePopup,\n\n components: {\n root: Input,\n calendar: Calendar as React.FC<Partial<CalendarProps>>,\n popupSurface: 'div',\n },\n\n calendar: calendarShorthand,\n root: rootShorthand,\n popupSurface: popupSurfaceShorthand,\n };\n\n state.root.value = formattedDate;\n\n return state;\n};\n"],"names":["React","ArrowDown","Enter","Escape","Calendar","CalendarMonthRegular","compareDatePart","DayOfWeek","FirstWeekOfYear","defaultDatePickerStrings","Input","mergeCallbacks","resolveShorthand","useControllableState","useFirstMount","useId","useMergedRefs","useOnClickOutside","useOnScrollOutside","useFieldContext_unstable","useFieldContext","useFluent_unstable","useFluent","useModalAttributes","usePopupPositioning","isDateOutOfBounds","date","minDate","maxDate","useFocusLogic","inputRef","useRef","preventFocusOpeningPicker","focus","current","preventNextFocusOpeningPicker","usePopupVisibility","props","open","setOpen","initialState","defaultState","defaultOpen","state","isMounted","useEffect","onOpenChange","allowTextInput","useSelectedDate","formatDate","onSelectDate","value","selectedDate","setSelectedDateState","formattedDate","setFormattedDate","useState","setSelectedDate","newDate","defaultFormatDate","toDateString","defaultParseDateFromString","dateStr","Date","parse","useDatePicker_unstable","ref","allFocusable","borderless","dateTimeFormatter","disableAutoFocus","firstDayOfWeek","Sunday","firstWeekOfYear","FirstDay","highlightCurrentMonth","highlightSelectedMonth","initialPickerDate","inlinePopup","isMonthPickerVisible","onUserSelectDate","openOnClick","onValidationResult","parseDateFromString","showCloseButton","showGoToToday","showMonthPickerAsOverlay","showWeekNumbers","strings","today","underlined","restOfProps","calendar","rootRef","setOpenState","fieldContext","required","popupSurfaceId","validateTextInput","useCallback","error","isNaN","getTime","newState","dismissDatePickerPopup","newlySelectedDate","showDatePickerPopup","calendarDismissed","onInputChange","ev","data","newValue","onInputBlur","onInputKeyDown","key","preventDefault","stopPropagation","altKey","onInputFocus","onInputClick","disabled","onIconClick","inputAppearance","triggerWrapperRef","popupRef","rootShorthand","defaultProps","appearance","undefined","contentAfter","onClick","readOnly","role","root","input","onChange","onBlur","onKeyDown","onFocus","modalAttributes","trapFocus","alwaysFocusable","legacyTrapFocus","popupSurfaceShorthand","popupSurface","id","targetDocument","element","callback","refs","isFirstMount","calendarShorthand","componentRef","onDismiss","useImperativeHandle","reset","components"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,SAAS,EAAEC,KAAK,EAAEC,MAAM,QAAQ,0BAA0B;AACnE,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,eAAe,EAAEC,SAAS,EAAEC,eAAe,QAAQ,cAAc;AAC1E,SAASC,wBAAwB,QAAQ,aAAa;AACtD,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SACEC,cAAc,EACdC,gBAAgB,EAChBC,oBAAoB,EACpBC,aAAa,EACbC,KAAK,EACLC,aAAa,EACbC,iBAAiB,EACjBC,kBAAkB,QACb,4BAA4B;AACnC,SAASC,4BAA4BC,eAAe,QAAQ,wBAAwB;AACpF,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,mBAAmB,QAAQ,kCAAkC;AAKtE,SAASC,kBAAkBC,IAAU,EAAEC,OAAc,EAAEC,OAAc,EAAW;IAC9E,OAAO,AAAC,CAAC,CAACD,WAAWrB,gBAAgBqB,SAAUD,QAAQ,KAAO,CAAC,CAACE,WAAWtB,gBAAgBsB,SAAUF,QAAQ;AAC/G;AAEA,SAASG,gBAAgB;IACvB,MAAMC,WAAW9B,MAAM+B,MAAM,CAAmB,IAAI;IACpD,MAAMC,4BAA4BhC,MAAM+B,MAAM,CAAC,KAAK;IAEpD,MAAME,QAAQ,IAAM;YAClB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AEhF3G,MAAM0J,mBAAmB,CACvBrH,MAAMmH,YAAY,EAClB,IAAO,CAAA;YACLvH;YACA0H,SAAQ;gBACNpH,QAAQ,KAAK;gBACbkB,gBAAgB,IAAI;YACtB;YACAiD;QACF,CAAA,GACA;QAACzE;QAAOM;QAASkB;QAAiBiD;KAAoB;IAGxD,MAAM/D,QAAyB;QAC7B6E,UAAU,CAAC,CAACnF,MAAMmF,QAAQ;QAC1B1C;QAEA8E,YAAY;YACVvB,MAAM3H;YACNkF,UAAUxF;YACV4I,cAAc;QAChB;QAEApD,UAAU2D;QACVlB,MAAMR;QACNmB,cAAcD;IAChB;IAEApG,MAAM0F,IAAI,CAAClF,KAAK,GAAGG;IAEnB,OAAOX;AACT,EAAE"}
|
|
@@ -64,14 +64,12 @@ function usePopupVisibility(props) {
|
|
|
64
64
|
}
|
|
65
65
|
function useSelectedDate({ formatDate , onSelectDate , value }) {
|
|
66
66
|
const [selectedDate, setSelectedDateState] = (0, _reactUtilities.useControllableState)({
|
|
67
|
-
initialState:
|
|
67
|
+
initialState: null,
|
|
68
68
|
state: value
|
|
69
69
|
});
|
|
70
70
|
const [formattedDate, setFormattedDate] = _react.useState(()=>value && formatDate ? formatDate(value) : '');
|
|
71
71
|
const setSelectedDate = (newDate)=>{
|
|
72
|
-
|
|
73
|
-
onSelectDate === null || onSelectDate === void 0 ? void 0 : onSelectDate(newDate);
|
|
74
|
-
}
|
|
72
|
+
onSelectDate === null || onSelectDate === void 0 ? void 0 : onSelectDate(newDate);
|
|
75
73
|
setSelectedDateState(newDate);
|
|
76
74
|
setFormattedDate(newDate && formatDate ? formatDate(newDate) : '');
|
|
77
75
|
};
|
|
@@ -372,14 +370,16 @@ const useDatePicker_unstable = (props, ref)=>{
|
|
|
372
370
|
open,
|
|
373
371
|
props.disabled
|
|
374
372
|
]);
|
|
373
|
+
const isFirstMount = (0, _reactUtilities.useFirstMount)();
|
|
375
374
|
// When the popup is closed, focus should go back to the input.
|
|
376
375
|
_react.useEffect(()=>{
|
|
377
|
-
if (!open && !props.disabled) {
|
|
376
|
+
if (!open && !props.disabled && !isFirstMount) {
|
|
378
377
|
focus();
|
|
379
378
|
}
|
|
380
379
|
// Focus function keeps changing, so we need to skip it in the deps
|
|
381
380
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
382
381
|
}, [
|
|
382
|
+
isFirstMount,
|
|
383
383
|
open,
|
|
384
384
|
props.disabled
|
|
385
385
|
]);
|
|
@@ -411,7 +411,7 @@ const useDatePicker_unstable = (props, ref)=>{
|
|
|
411
411
|
focus,
|
|
412
412
|
reset () {
|
|
413
413
|
setOpen(false);
|
|
414
|
-
setSelectedDate(
|
|
414
|
+
setSelectedDate(null);
|
|
415
415
|
},
|
|
416
416
|
showDatePickerPopup
|
|
417
417
|
}), [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDatePicker.js"],"sourcesContent":["import * as React from 'react';\nimport { ArrowDown, Enter, Escape } from '@fluentui/keyboard-keys';\nimport { Calendar } from '../Calendar/Calendar';\nimport { CalendarMonthRegular } from '@fluentui/react-icons';\nimport { compareDatePart, DayOfWeek, FirstWeekOfYear } from '../../utils';\nimport { defaultDatePickerStrings } from './defaults';\nimport { Input } from '@fluentui/react-input';\nimport { mergeCallbacks, resolveShorthand, useControllableState, useId, useMergedRefs, useOnClickOutside, useOnScrollOutside } from '@fluentui/react-utilities';\nimport { useFieldContext_unstable as useFieldContext } from '@fluentui/react-field';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopupPositioning } from '../../utils/usePopupPositioning';\nfunction isDateOutOfBounds(date, minDate, maxDate) {\n return !!minDate && compareDatePart(minDate, date) > 0 || !!maxDate && compareDatePart(maxDate, date) < 0;\n}\nfunction useFocusLogic() {\n const inputRef = React.useRef(null);\n const preventFocusOpeningPicker = React.useRef(false);\n const focus = ()=>{\n var _inputRef_current, _inputRef_current_focus;\n (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : (_inputRef_current_focus = _inputRef_current.focus) === null || _inputRef_current_focus === void 0 ? void 0 : _inputRef_current_focus.call(_inputRef_current);\n };\n const preventNextFocusOpeningPicker = ()=>{\n preventFocusOpeningPicker.current = true;\n };\n return [\n focus,\n inputRef,\n preventFocusOpeningPicker,\n preventNextFocusOpeningPicker\n ];\n}\nfunction usePopupVisibility(props) {\n const [open, setOpen] = useControllableState({\n initialState: false,\n defaultState: props.defaultOpen,\n state: props.open\n });\n const isMounted = React.useRef(false);\n React.useEffect(()=>{\n if (isMounted.current && !open) {\n var // If DatePicker's menu (Calendar) is closed, run onAfterMenuDismiss\n _props_onOpenChange;\n (_props_onOpenChange = props.onOpenChange) === null || _props_onOpenChange === void 0 ? void 0 : _props_onOpenChange.call(props, false);\n }\n isMounted.current = true;\n }, // Should only run on allowTextInput or open change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n props.allowTextInput,\n open\n ]);\n return [\n open,\n setOpen\n ];\n}\nfunction useSelectedDate({ formatDate , onSelectDate , value }) {\n const [selectedDate, setSelectedDateState] = useControllableState({\n initialState: undefined,\n state: value\n });\n const [formattedDate, setFormattedDate] = React.useState(()=>value && formatDate ? formatDate(value) : '');\n const setSelectedDate = (newDate)=>{\n if (selectedDate === undefined && newDate !== undefined || selectedDate !== undefined && newDate === undefined || newDate && selectedDate && (newDate > selectedDate || newDate < selectedDate)) {\n onSelectDate === null || onSelectDate === void 0 ? void 0 : onSelectDate(newDate);\n }\n setSelectedDateState(newDate);\n setFormattedDate(newDate && formatDate ? formatDate(newDate) : '');\n };\n React.useEffect(()=>{\n setFormattedDate(value && formatDate ? formatDate(value) : '');\n }, [\n formatDate,\n value\n ]);\n return [\n selectedDate,\n formattedDate,\n setSelectedDate,\n setFormattedDate\n ];\n}\nconst defaultFormatDate = (date)=>date ? date.toDateString() : '';\nconst defaultParseDateFromString = (dateStr)=>{\n const date = Date.parse(dateStr);\n return date ? new Date(date) : null;\n};\n/**\n * Create the state required to render DatePicker.\n *\n * The returned state can be modified with hooks such as useDatePickerStyles_unstable,\n * before being passed to renderDatePicker_unstable.\n *\n * @param props - props from this instance of DatePicker\n * @param ref - reference to root Input slot\n */ export const useDatePicker_unstable = (props, ref)=>{\n const { allowTextInput =false , allFocusable =false , borderless =false , dateTimeFormatter , defaultOpen =false , disableAutoFocus =true , firstDayOfWeek =DayOfWeek.Sunday , firstWeekOfYear =FirstWeekOfYear.FirstDay , formatDate =defaultFormatDate , highlightCurrentMonth =false , highlightSelectedMonth =false , initialPickerDate =new Date() , inlinePopup =false , isMonthPickerVisible =true , maxDate , minDate , onOpenChange , onSelectDate: onUserSelectDate , openOnClick =true , onValidationResult , parseDateFromString =defaultParseDateFromString , showCloseButton =false , showGoToToday =true , showMonthPickerAsOverlay =false , showWeekNumbers =false , strings =defaultDatePickerStrings , today , underlined =false , value , ...restOfProps } = props;\n const calendar = React.useRef(null);\n const [focus, rootRef, preventFocusOpeningPicker, preventNextFocusOpeningPicker] = useFocusLogic();\n const [selectedDate, formattedDate, setSelectedDate, setFormattedDate] = useSelectedDate({\n formatDate,\n onSelectDate: onUserSelectDate,\n value\n });\n const [open, setOpenState] = usePopupVisibility(props);\n const fieldContext = useFieldContext();\n var _fieldContext_required;\n const required = (_fieldContext_required = fieldContext === null || fieldContext === void 0 ? void 0 : fieldContext.required) !== null && _fieldContext_required !== void 0 ? _fieldContext_required : props.required;\n const popupSurfaceId = useId('datePicker-popupSurface');\n const validateTextInput = React.useCallback((date = null)=>{\n let error;\n if (allowTextInput) {\n if (formattedDate || date) {\n // Don't parse if the selected date has the same formatted string as what we're about to parse.\n // The formatted string might be ambiguous (ex: \"1/2/3\" or \"New Year Eve\") and the parser might\n // not be able to come up with the exact same date.\n if (selectedDate && formatDate && formatDate(date !== null && date !== void 0 ? date : selectedDate) === formattedDate) {\n return;\n }\n date = date || parseDateFromString(formattedDate);\n // Check if date is null or date is an invalid date\n if (!date || isNaN(date.getTime())) {\n // Reset input if formatting is available\n setSelectedDate(selectedDate);\n error = 'invalid-input';\n } else {\n if (isDateOutOfBounds(date, minDate, maxDate)) {\n error = 'out-of-bounds';\n } else {\n setSelectedDate(date);\n }\n }\n } else {\n if (required) {\n error = 'required-input';\n }\n onUserSelectDate === null || onUserSelectDate === void 0 ? void 0 : onUserSelectDate(date);\n }\n } else if (required && !formattedDate) {\n error = 'required-input';\n }\n onValidationResult === null || onValidationResult === void 0 ? void 0 : onValidationResult({\n error\n });\n }, [\n allowTextInput,\n formatDate,\n formattedDate,\n maxDate,\n minDate,\n onUserSelectDate,\n onValidationResult,\n parseDateFromString,\n required,\n selectedDate,\n setSelectedDate\n ]);\n const setOpen = React.useCallback((newState)=>{\n onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(newState);\n setOpenState(newState);\n }, [\n onOpenChange,\n setOpenState\n ]);\n const dismissDatePickerPopup = React.useCallback((newlySelectedDate)=>{\n if (open) {\n setOpen(false);\n validateTextInput(newlySelectedDate);\n if (!allowTextInput && newlySelectedDate) {\n setSelectedDate(newlySelectedDate);\n }\n }\n }, [\n allowTextInput,\n open,\n setOpen,\n setSelectedDate,\n validateTextInput\n ]);\n const showDatePickerPopup = React.useCallback(()=>{\n if (!open) {\n preventNextFocusOpeningPicker();\n setOpen(true);\n }\n }, [\n open,\n preventNextFocusOpeningPicker,\n setOpen\n ]);\n /**\n * Callback for closing the calendar callout\n */ const calendarDismissed = React.useCallback((newlySelectedDate)=>{\n preventNextFocusOpeningPicker();\n dismissDatePickerPopup(newlySelectedDate);\n }, [\n dismissDatePickerPopup,\n preventNextFocusOpeningPicker\n ]);\n const onInputChange = React.useCallback((ev, data)=>{\n const { value: newValue } = data;\n if (allowTextInput) {\n if (open) {\n dismissDatePickerPopup();\n }\n setFormattedDate(newValue);\n }\n }, [\n allowTextInput,\n dismissDatePickerPopup,\n open,\n setFormattedDate\n ]);\n const onInputBlur = React.useCallback(()=>{\n validateTextInput();\n }, [\n validateTextInput\n ]);\n const onInputKeyDown = React.useCallback((ev)=>{\n switch(ev.key){\n case Enter:\n ev.preventDefault();\n ev.stopPropagation();\n if (!open) {\n validateTextInput();\n showDatePickerPopup();\n } else {\n // When DatePicker allows input date string directly,\n // it is expected to hit another enter to close the popup\n if (props.allowTextInput) {\n dismissDatePickerPopup();\n }\n }\n break;\n case Escape:\n ev.stopPropagation();\n ev.preventDefault();\n if (open) {\n calendarDismissed();\n }\n break;\n case ArrowDown:\n ev.preventDefault();\n if (ev.altKey && !open) {\n showDatePickerPopup();\n }\n break;\n default:\n break;\n }\n }, [\n calendarDismissed,\n dismissDatePickerPopup,\n open,\n props.allowTextInput,\n showDatePickerPopup,\n validateTextInput\n ]);\n const onInputFocus = React.useCallback(()=>{\n if (disableAutoFocus) {\n return;\n }\n if (!allowTextInput) {\n if (!preventFocusOpeningPicker.current) {\n showDatePickerPopup();\n }\n preventFocusOpeningPicker.current = false;\n }\n }, [\n allowTextInput,\n disableAutoFocus,\n preventFocusOpeningPicker,\n showDatePickerPopup\n ]);\n const onInputClick = React.useCallback(()=>{\n // default openOnClick to !props.disableAutoFocus for legacy support of disableAutoFocus behavior\n if ((props.openOnClick || !props.disableAutoFocus) && !open && !props.disabled) {\n showDatePickerPopup();\n return;\n }\n if (allowTextInput) {\n dismissDatePickerPopup();\n }\n }, [\n allowTextInput,\n dismissDatePickerPopup,\n open,\n props.disabled,\n props.disableAutoFocus,\n props.openOnClick,\n showDatePickerPopup\n ]);\n const onIconClick = (ev)=>{\n ev.stopPropagation();\n if (!open && !props.disabled) {\n showDatePickerPopup();\n } else if (props.allowTextInput) {\n dismissDatePickerPopup();\n }\n };\n const inputAppearance = underlined ? 'underline' : borderless ? 'filled-lighter' : 'outline';\n const [triggerWrapperRef, popupRef] = usePopupPositioning(props);\n const rootShorthand = resolveShorthand(restOfProps, {\n required: true,\n defaultProps: {\n appearance: inputAppearance,\n 'aria-controls': open ? popupSurfaceId : undefined,\n 'aria-expanded': open,\n 'aria-haspopup': 'dialog',\n contentAfter: /*#__PURE__*/ React.createElement(CalendarMonthRegular, {\n onClick: onIconClick\n }),\n readOnly: !allowTextInput,\n role: 'combobox',\n root: {\n 'aria-owns': open ? popupSurfaceId : undefined,\n ref: useMergedRefs(triggerWrapperRef, ref)\n },\n input: {\n ref: rootRef\n }\n }\n });\n rootShorthand.onChange = mergeCallbacks(rootShorthand.onChange, onInputChange);\n rootShorthand.onBlur = mergeCallbacks(rootShorthand.onBlur, onInputBlur);\n rootShorthand.onKeyDown = mergeCallbacks(rootShorthand.onKeyDown, onInputKeyDown);\n rootShorthand.onFocus = mergeCallbacks(rootShorthand.onFocus, onInputFocus);\n rootShorthand.onClick = mergeCallbacks(rootShorthand.onClick, onInputClick);\n const { modalAttributes } = useModalAttributes({\n trapFocus: true,\n alwaysFocusable: true,\n legacyTrapFocus: false\n });\n const popupSurfaceShorthand = open ? resolveShorthand(props.popupSurface, {\n required: true,\n defaultProps: {\n 'aria-label': 'Calendar',\n 'aria-modal': true,\n id: popupSurfaceId,\n role: 'dialog',\n ref: popupRef,\n ...modalAttributes\n }\n }) : undefined;\n const { targetDocument } = useFluent();\n useOnClickOutside({\n element: targetDocument,\n callback: (ev)=>dismissDatePickerPopup(),\n refs: [\n triggerWrapperRef,\n popupRef\n ],\n disabled: !open\n });\n useOnScrollOutside({\n element: targetDocument,\n callback: (ev)=>dismissDatePickerPopup(),\n refs: [\n triggerWrapperRef,\n popupRef\n ],\n disabled: !open\n });\n // When the popup is opened, focus should go to the calendar.\n // In v8 this was done by focusing after the callout was positioned, but in v9 this can be simulated by using a\n // useEffect hook.\n React.useEffect(()=>{\n if (open && !props.disabled && calendar.current) {\n calendar.current.focus();\n }\n }, [\n disableAutoFocus,\n open,\n props.disabled\n ]);\n // When the popup is closed, focus should go back to the input.\n React.useEffect(()=>{\n if (!open && !props.disabled) {\n focus();\n }\n // Focus function keeps changing, so we need to skip it in the deps\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n open,\n props.disabled\n ]);\n const calendarShorthand = resolveShorthand(props.calendar, {\n required: true,\n defaultProps: {\n allFocusable,\n componentRef: calendar,\n dateTimeFormatter,\n firstDayOfWeek,\n firstWeekOfYear,\n highlightCurrentMonth,\n highlightSelectedMonth,\n isMonthPickerVisible,\n maxDate,\n minDate,\n showCloseButton,\n showGoToToday,\n showMonthPickerAsOverlay,\n showWeekNumbers,\n strings,\n today,\n value: selectedDate || initialPickerDate\n }\n });\n calendarShorthand.onDismiss = mergeCallbacks(calendarShorthand.onDismiss, calendarDismissed);\n calendarShorthand.onSelectDate = mergeCallbacks(calendarShorthand.onSelectDate, calendarDismissed);\n React.useImperativeHandle(props.componentRef, ()=>({\n focus,\n reset () {\n setOpen(false);\n setSelectedDate(undefined);\n },\n showDatePickerPopup\n }), [\n focus,\n setOpen,\n setSelectedDate,\n showDatePickerPopup\n ]);\n const state = {\n disabled: !!props.disabled,\n inlinePopup,\n components: {\n root: Input,\n calendar: Calendar,\n popupSurface: 'div'\n },\n calendar: calendarShorthand,\n root: rootShorthand,\n popupSurface: popupSurfaceShorthand\n };\n state.root.value = formattedDate;\n return state;\n};\n"],"names":["useDatePicker_unstable","isDateOutOfBounds","date","minDate","maxDate","compareDatePart","useFocusLogic","inputRef","React","useRef","preventFocusOpeningPicker","focus","_inputRef_current","_inputRef_current_focus","current","call","preventNextFocusOpeningPicker","usePopupVisibility","props","open","setOpen","useControllableState","initialState","defaultState","defaultOpen","state","isMounted","useEffect","_props_onOpenChange","onOpenChange","allowTextInput","useSelectedDate","formatDate","onSelectDate","value","selectedDate","setSelectedDateState","undefined","formattedDate","setFormattedDate","useState","setSelectedDate","newDate","defaultFormatDate","toDateString","defaultParseDateFromString","dateStr","Date","parse","ref","allFocusable","borderless","dateTimeFormatter","disableAutoFocus","firstDayOfWeek","DayOfWeek","Sunday","firstWeekOfYear","FirstWeekOfYear","FirstDay","highlightCurrentMonth","highlightSelectedMonth","initialPickerDate","inlinePopup","isMonthPickerVisible","onUserSelectDate","openOnClick","onValidationResult","parseDateFromString","showCloseButton","showGoToToday","showMonthPickerAsOverlay","showWeekNumbers","strings","defaultDatePickerStrings","today","underlined","restOfProps","calendar","rootRef","setOpenState","fieldContext","useFieldContext","_fieldContext_required","required","popupSurfaceId","useId","validateTextInput","useCallback","error","isNaN","getTime","newState","dismissDatePickerPopup","newlySelectedDate","showDatePickerPopup","calendarDismissed","onInputChange","ev","data","newValue","onInputBlur","onInputKeyDown","key","Enter","preventDefault","stopPropagation","Escape","ArrowDown","altKey","onInputFocus","onInputClick","disabled","onIconClick","inputAppearance","triggerWrapperRef","popupRef","usePopupPositioning","rootShorthand","resolveShorthand","defaultProps","appearance","contentAfter","createElement","CalendarMonthRegular","onClick","readOnly","role","root","useMergedRefs","input","onChange","mergeCallbacks","onBlur","onKeyDown","onFocus","modalAttributes","useModalAttributes","trapFocus","alwaysFocusable","legacyTrapFocus","popupSurfaceShorthand","popupSurface","id","targetDocument","useFluent","useOnClickOutside","element","callback","refs","useOnScrollOutside","calendarShorthand","componentRef","onDismiss","useImperativeHandle","reset","components","Input","Calendar"],"mappings":";;;;+BAgGiBA;;aAAAA;;;6DAhGM;8BACkB;0BAChB;4BACY;uBACuB;0BACnB;4BACnB;gCAC8G;4BACxE;qCACZ;8BACb;qCACC;AACpC,SAASC,kBAAkBC,IAAI,EAAEC,OAAO,EAAEC,OAAO,EAAE;IAC/C,OAAO,CAAC,CAACD,WAAWE,IAAAA,sBAAe,EAACF,SAASD,QAAQ,KAAK,CAAC,CAACE,WAAWC,IAAAA,sBAAe,EAACD,SAASF,QAAQ;AAC5G;AACA,SAASI,gBAAgB;IACrB,MAAMC,WAAWC,OAAMC,MAAM,CAAC,IAAI;IAClC,MAAMC,4BAA4BF,OAAMC,MAAM,CAAC,KAAK;IACpD,MAAME,QAAQ,IAAI;QACd,IAAIC,mBAAmBC;QACtBD,CAAAA,oBAAoBL,SAASO,OAAO,AAAD,MAAO,IAAI,IAAIF,sBAAsB,KAAK,IAAI,KAAK,IAAI,AAACC,CA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uD;IACvD,GAAG;QACCQ;QACAD,MAAM8F,QAAQ;KACjB;IACD,MAAMuC,oBAAoBhC,IAAAA,gCAAgB,EAACrG,MAAM4D,QAAQ,EAAE;QACvDM,UAAU,IAAI;QACdoC,cAAc;YACVtE;YACAsG,cAAc1E;YACd1B;YACAE;YACAG;YACAG;YACAC;YACAG;YACA5D;YACAD;YACAkE;YACAC;YACAC;YACAC;YACAC;YACAE;YACAzC,OAAOC,gBAAgB2B;QAC3B;IACJ;IACAyF,kBAAkBE,SAAS,GAAGrB,IAAAA,8BAAc,EAACmB,kBAAkBE,SAAS,EAAEzD;IAC1EuD,kBAAkBtH,YAAY,GAAGmG,IAAAA,8BAAc,EAACmB,kBAAkBtH,YAAY,EAAE+D;IAChFxF,OAAMkJ,mBAAmB,CAACxI,MAAMsI,YAAY,EAAE,IAAK,CAAA;YAC3C7I;YACAgJ,SAAS;gBACLvI,QAAQ,KAAK;gBACbqB,gBAAgBJ;YACpB;YACA0D;QACJ,CAAA,GAAI;QACJpF;QACAS;QACAqB;QACAsD;KACH;IACD,MAAMtE,QAAQ;QACVuF,UAAU,CAAC,CAAC9F,MAAM8F,QAAQ;QAC1BjD;QACA6F,YAAY;YACR5B,MAAM6B,iBAAK;YACX/E,UAAUgF,kBAAQ;YAClBhB,cAAc;QAClB;QACAhE,UAAUyE;QACVvB,MAAMV;QACNwB,cAAcD;IAClB;IACApH,MAAMuG,IAAI,CAAC9F,KAAK,GAAGI;IACnB,OAAOb;AACX"}
|
|
1
|
+
{"version":3,"sources":["useDatePicker.js"],"sourcesContent":["import * as React from 'react';\nimport { ArrowDown, Enter, Escape } from '@fluentui/keyboard-keys';\nimport { Calendar } from '../Calendar/Calendar';\nimport { CalendarMonthRegular } from '@fluentui/react-icons';\nimport { compareDatePart, DayOfWeek, FirstWeekOfYear } from '../../utils';\nimport { defaultDatePickerStrings } from './defaults';\nimport { Input } from '@fluentui/react-input';\nimport { mergeCallbacks, resolveShorthand, useControllableState, useFirstMount, useId, useMergedRefs, useOnClickOutside, useOnScrollOutside } from '@fluentui/react-utilities';\nimport { useFieldContext_unstable as useFieldContext } from '@fluentui/react-field';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopupPositioning } from '../../utils/usePopupPositioning';\nfunction isDateOutOfBounds(date, minDate, maxDate) {\n return !!minDate && compareDatePart(minDate, date) > 0 || !!maxDate && compareDatePart(maxDate, date) < 0;\n}\nfunction useFocusLogic() {\n const inputRef = React.useRef(null);\n const preventFocusOpeningPicker = React.useRef(false);\n const focus = ()=>{\n var _inputRef_current, _inputRef_current_focus;\n (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : (_inputRef_current_focus = _inputRef_current.focus) === null || _inputRef_current_focus === void 0 ? void 0 : _inputRef_current_focus.call(_inputRef_current);\n };\n const preventNextFocusOpeningPicker = ()=>{\n preventFocusOpeningPicker.current = true;\n };\n return [\n focus,\n inputRef,\n preventFocusOpeningPicker,\n preventNextFocusOpeningPicker\n ];\n}\nfunction usePopupVisibility(props) {\n const [open, setOpen] = useControllableState({\n initialState: false,\n defaultState: props.defaultOpen,\n state: props.open\n });\n const isMounted = React.useRef(false);\n React.useEffect(()=>{\n if (isMounted.current && !open) {\n var // If DatePicker's menu (Calendar) is closed, run onAfterMenuDismiss\n _props_onOpenChange;\n (_props_onOpenChange = props.onOpenChange) === null || _props_onOpenChange === void 0 ? void 0 : _props_onOpenChange.call(props, false);\n }\n isMounted.current = true;\n }, // Should only run on allowTextInput or open change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n props.allowTextInput,\n open\n ]);\n return [\n open,\n setOpen\n ];\n}\nfunction useSelectedDate({ formatDate , onSelectDate , value }) {\n const [selectedDate, setSelectedDateState] = useControllableState({\n initialState: null,\n state: value\n });\n const [formattedDate, setFormattedDate] = React.useState(()=>value && formatDate ? formatDate(value) : '');\n const setSelectedDate = (newDate)=>{\n onSelectDate === null || onSelectDate === void 0 ? void 0 : onSelectDate(newDate);\n setSelectedDateState(newDate);\n setFormattedDate(newDate && formatDate ? formatDate(newDate) : '');\n };\n React.useEffect(()=>{\n setFormattedDate(value && formatDate ? formatDate(value) : '');\n }, [\n formatDate,\n value\n ]);\n return [\n selectedDate,\n formattedDate,\n setSelectedDate,\n setFormattedDate\n ];\n}\nconst defaultFormatDate = (date)=>date ? date.toDateString() : '';\nconst defaultParseDateFromString = (dateStr)=>{\n const date = Date.parse(dateStr);\n return date ? new Date(date) : null;\n};\n/**\n * Create the state required to render DatePicker.\n *\n * The returned state can be modified with hooks such as useDatePickerStyles_unstable,\n * before being passed to renderDatePicker_unstable.\n *\n * @param props - props from this instance of DatePicker\n * @param ref - reference to root Input slot\n */ export const useDatePicker_unstable = (props, ref)=>{\n const { allowTextInput =false , allFocusable =false , borderless =false , dateTimeFormatter , defaultOpen =false , disableAutoFocus =true , firstDayOfWeek =DayOfWeek.Sunday , firstWeekOfYear =FirstWeekOfYear.FirstDay , formatDate =defaultFormatDate , highlightCurrentMonth =false , highlightSelectedMonth =false , initialPickerDate =new Date() , inlinePopup =false , isMonthPickerVisible =true , maxDate , minDate , onOpenChange , onSelectDate: onUserSelectDate , openOnClick =true , onValidationResult , parseDateFromString =defaultParseDateFromString , showCloseButton =false , showGoToToday =true , showMonthPickerAsOverlay =false , showWeekNumbers =false , strings =defaultDatePickerStrings , today , underlined =false , value , ...restOfProps } = props;\n const calendar = React.useRef(null);\n const [focus, rootRef, preventFocusOpeningPicker, preventNextFocusOpeningPicker] = useFocusLogic();\n const [selectedDate, formattedDate, setSelectedDate, setFormattedDate] = useSelectedDate({\n formatDate,\n onSelectDate: onUserSelectDate,\n value\n });\n const [open, setOpenState] = usePopupVisibility(props);\n const fieldContext = useFieldContext();\n var _fieldContext_required;\n const required = (_fieldContext_required = fieldContext === null || fieldContext === void 0 ? void 0 : fieldContext.required) !== null && _fieldContext_required !== void 0 ? _fieldContext_required : props.required;\n const popupSurfaceId = useId('datePicker-popupSurface');\n const validateTextInput = React.useCallback((date = null)=>{\n let error;\n if (allowTextInput) {\n if (formattedDate || date) {\n // Don't parse if the selected date has the same formatted string as what we're about to parse.\n // The formatted string might be ambiguous (ex: \"1/2/3\" or \"New Year Eve\") and the parser might\n // not be able to come up with the exact same date.\n if (selectedDate && formatDate && formatDate(date !== null && date !== void 0 ? date : selectedDate) === formattedDate) {\n return;\n }\n date = date || parseDateFromString(formattedDate);\n // Check if date is null or date is an invalid date\n if (!date || isNaN(date.getTime())) {\n // Reset input if formatting is available\n setSelectedDate(selectedDate);\n error = 'invalid-input';\n } else {\n if (isDateOutOfBounds(date, minDate, maxDate)) {\n error = 'out-of-bounds';\n } else {\n setSelectedDate(date);\n }\n }\n } else {\n if (required) {\n error = 'required-input';\n }\n onUserSelectDate === null || onUserSelectDate === void 0 ? void 0 : onUserSelectDate(date);\n }\n } else if (required && !formattedDate) {\n error = 'required-input';\n }\n onValidationResult === null || onValidationResult === void 0 ? void 0 : onValidationResult({\n error\n });\n }, [\n allowTextInput,\n formatDate,\n formattedDate,\n maxDate,\n minDate,\n onUserSelectDate,\n onValidationResult,\n parseDateFromString,\n required,\n selectedDate,\n setSelectedDate\n ]);\n const setOpen = React.useCallback((newState)=>{\n onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(newState);\n setOpenState(newState);\n }, [\n onOpenChange,\n setOpenState\n ]);\n const dismissDatePickerPopup = React.useCallback((newlySelectedDate)=>{\n if (open) {\n setOpen(false);\n validateTextInput(newlySelectedDate);\n if (!allowTextInput && newlySelectedDate) {\n setSelectedDate(newlySelectedDate);\n }\n }\n }, [\n allowTextInput,\n open,\n setOpen,\n setSelectedDate,\n validateTextInput\n ]);\n const showDatePickerPopup = React.useCallback(()=>{\n if (!open) {\n preventNextFocusOpeningPicker();\n setOpen(true);\n }\n }, [\n open,\n preventNextFocusOpeningPicker,\n setOpen\n ]);\n /**\n * Callback for closing the calendar callout\n */ const calendarDismissed = React.useCallback((newlySelectedDate)=>{\n preventNextFocusOpeningPicker();\n dismissDatePickerPopup(newlySelectedDate);\n }, [\n dismissDatePickerPopup,\n preventNextFocusOpeningPicker\n ]);\n const onInputChange = React.useCallback((ev, data)=>{\n const { value: newValue } = data;\n if (allowTextInput) {\n if (open) {\n dismissDatePickerPopup();\n }\n setFormattedDate(newValue);\n }\n }, [\n allowTextInput,\n dismissDatePickerPopup,\n open,\n setFormattedDate\n ]);\n const onInputBlur = React.useCallback(()=>{\n validateTextInput();\n }, [\n validateTextInput\n ]);\n const onInputKeyDown = React.useCallback((ev)=>{\n switch(ev.key){\n case Enter:\n ev.preventDefault();\n ev.stopPropagation();\n if (!open) {\n validateTextInput();\n showDatePickerPopup();\n } else {\n // When DatePicker allows input date string directly,\n // it is expected to hit another enter to close the popup\n if (props.allowTextInput) {\n dismissDatePickerPopup();\n }\n }\n break;\n case Escape:\n ev.stopPropagation();\n ev.preventDefault();\n if (open) {\n calendarDismissed();\n }\n break;\n case ArrowDown:\n ev.preventDefault();\n if (ev.altKey && !open) {\n showDatePickerPopup();\n }\n break;\n default:\n break;\n }\n }, [\n calendarDismissed,\n dismissDatePickerPopup,\n open,\n props.allowTextInput,\n showDatePickerPopup,\n validateTextInput\n ]);\n const onInputFocus = React.useCallback(()=>{\n if (disableAutoFocus) {\n return;\n }\n if (!allowTextInput) {\n if (!preventFocusOpeningPicker.current) {\n showDatePickerPopup();\n }\n preventFocusOpeningPicker.current = false;\n }\n }, [\n allowTextInput,\n disableAutoFocus,\n preventFocusOpeningPicker,\n showDatePickerPopup\n ]);\n const onInputClick = React.useCallback(()=>{\n // default openOnClick to !props.disableAutoFocus for legacy support of disableAutoFocus behavior\n if ((props.openOnClick || !props.disableAutoFocus) && !open && !props.disabled) {\n showDatePickerPopup();\n return;\n }\n if (allowTextInput) {\n dismissDatePickerPopup();\n }\n }, [\n allowTextInput,\n dismissDatePickerPopup,\n open,\n props.disabled,\n props.disableAutoFocus,\n props.openOnClick,\n showDatePickerPopup\n ]);\n const onIconClick = (ev)=>{\n ev.stopPropagation();\n if (!open && !props.disabled) {\n showDatePickerPopup();\n } else if (props.allowTextInput) {\n dismissDatePickerPopup();\n }\n };\n const inputAppearance = underlined ? 'underline' : borderless ? 'filled-lighter' : 'outline';\n const [triggerWrapperRef, popupRef] = usePopupPositioning(props);\n const rootShorthand = resolveShorthand(restOfProps, {\n required: true,\n defaultProps: {\n appearance: inputAppearance,\n 'aria-controls': open ? popupSurfaceId : undefined,\n 'aria-expanded': open,\n 'aria-haspopup': 'dialog',\n contentAfter: /*#__PURE__*/ React.createElement(CalendarMonthRegular, {\n onClick: onIconClick\n }),\n readOnly: !allowTextInput,\n role: 'combobox',\n root: {\n 'aria-owns': open ? popupSurfaceId : undefined,\n ref: useMergedRefs(triggerWrapperRef, ref)\n },\n input: {\n ref: rootRef\n }\n }\n });\n rootShorthand.onChange = mergeCallbacks(rootShorthand.onChange, onInputChange);\n rootShorthand.onBlur = mergeCallbacks(rootShorthand.onBlur, onInputBlur);\n rootShorthand.onKeyDown = mergeCallbacks(rootShorthand.onKeyDown, onInputKeyDown);\n rootShorthand.onFocus = mergeCallbacks(rootShorthand.onFocus, onInputFocus);\n rootShorthand.onClick = mergeCallbacks(rootShorthand.onClick, onInputClick);\n const { modalAttributes } = useModalAttributes({\n trapFocus: true,\n alwaysFocusable: true,\n legacyTrapFocus: false\n });\n const popupSurfaceShorthand = open ? resolveShorthand(props.popupSurface, {\n required: true,\n defaultProps: {\n 'aria-label': 'Calendar',\n 'aria-modal': true,\n id: popupSurfaceId,\n role: 'dialog',\n ref: popupRef,\n ...modalAttributes\n }\n }) : undefined;\n const { targetDocument } = useFluent();\n useOnClickOutside({\n element: targetDocument,\n callback: (ev)=>dismissDatePickerPopup(),\n refs: [\n triggerWrapperRef,\n popupRef\n ],\n disabled: !open\n });\n useOnScrollOutside({\n element: targetDocument,\n callback: (ev)=>dismissDatePickerPopup(),\n refs: [\n triggerWrapperRef,\n popupRef\n ],\n disabled: !open\n });\n // When the popup is opened, focus should go to the calendar.\n // In v8 this was done by focusing after the callout was positioned, but in v9 this can be simulated by using a\n // useEffect hook.\n React.useEffect(()=>{\n if (open && !props.disabled && calendar.current) {\n calendar.current.focus();\n }\n }, [\n disableAutoFocus,\n open,\n props.disabled\n ]);\n const isFirstMount = useFirstMount();\n // When the popup is closed, focus should go back to the input.\n React.useEffect(()=>{\n if (!open && !props.disabled && !isFirstMount) {\n focus();\n }\n // Focus function keeps changing, so we need to skip it in the deps\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n isFirstMount,\n open,\n props.disabled\n ]);\n const calendarShorthand = resolveShorthand(props.calendar, {\n required: true,\n defaultProps: {\n allFocusable,\n componentRef: calendar,\n dateTimeFormatter,\n firstDayOfWeek,\n firstWeekOfYear,\n highlightCurrentMonth,\n highlightSelectedMonth,\n isMonthPickerVisible,\n maxDate,\n minDate,\n showCloseButton,\n showGoToToday,\n showMonthPickerAsOverlay,\n showWeekNumbers,\n strings,\n today,\n value: selectedDate || initialPickerDate\n }\n });\n calendarShorthand.onDismiss = mergeCallbacks(calendarShorthand.onDismiss, calendarDismissed);\n calendarShorthand.onSelectDate = mergeCallbacks(calendarShorthand.onSelectDate, calendarDismissed);\n React.useImperativeHandle(props.componentRef, ()=>({\n focus,\n reset () {\n setOpen(false);\n setSelectedDate(null);\n },\n showDatePickerPopup\n }), [\n focus,\n setOpen,\n setSelectedDate,\n showDatePickerPopup\n ]);\n const state = {\n disabled: !!props.disabled,\n inlinePopup,\n components: {\n root: Input,\n calendar: Calendar,\n popupSurface: 'div'\n },\n calendar: calendarShorthand,\n root: rootShorthand,\n popupSurface: popupSurfaceShorthand\n };\n state.root.value = formattedDate;\n return state;\n};\n"],"names":["useDatePicker_unstable","isDateOutOfBounds","date","minDate","maxDate","compareDatePart","useFocusLogic","inputRef","React","useRef","preventFocusOpeningPicker","focus","_inputRef_current","_inputRef_current_focus","current","call","preventNextFocusOpeningPicker","usePopupVisibility","props","open","setOpen","useControllableState","initialState","defaultState","defaultOpen","state","isMounted","useEffect","_props_onOpenChange","onOpenChange","allowTextInput","useSelectedDate","formatDate","onSelectDate","value","selectedDate","setSelectedDateState","formattedDate","setFormattedDate","useState","setSelectedDate","newDate","defaultFormatDate","toDateString","defaultParseDateFromString","dateStr","Date","parse","ref","allFocusable","borderless","dateTimeFormatter","disableAutoFocus","firstDayOfWeek","DayOfWeek","Sunday","firstWeekOfYear","FirstWeekOfYear","FirstDay","highlightCurrentMonth","highlightSelectedMonth","initialPickerDate","inlinePopup","isMonthPickerVisible","onUserSelectDate","openOnClick","onValidationResult","parseDateFromString","showCloseButton","showGoToToday","showMonthPickerAsOverlay","showWeekNumbers","strings","defaultDatePickerStrings","today","underlined","restOfProps","calendar","rootRef","setOpenState","fieldContext","useFieldContext","_fieldContext_required","required","popupSurfaceId","useId","validateTextInput","useCallback","error","isNaN","getTime","newState","dismissDatePickerPopup","newlySelectedDate","showDatePickerPopup","calendarDismissed","onInputChange","ev","data","newValue","onInputBlur","onInputKeyDown","key","Enter","preventDefault","stopPropagation","Escape","ArrowDown","altKey","onInputFocus","onInputClick","disabled","onIconClick","inputAppearance","triggerWrapperRef","popupRef","usePopupPositioning","rootShorthand","resolveShorthand","defaultProps","appearance","undefined","contentAfter","createElement","CalendarMonthRegular","onClick","readOnly","role","root","useMergedRefs","input","onChange","mergeCallbacks","onBlur","onKeyDown","onFocus","modalAttributes","useModalAttributes","trapFocus","alwaysFocusable","legacyTrapFocus","popupSurfaceShorthand","popupSurface","id","targetDocument","useFluent","useOnClickOutside","element","callback","refs","useOnScrollOutside","isFirstMount","useFirstMount","calendarShorthand","componentRef","onDismiss","useImperativeHandle","reset","components","Input","Calendar"],"mappings":";;;;+BA8FiBA;;aAAAA;;;6DA9FM;8BACkB;0BAChB;4BACY;uBACuB;0BACnB;4BACnB;gCAC6H;4BACvF;qCACZ;8BACb;qCACC;AACpC,SAASC,kBAAkBC,IAAI,EAAEC,OAAO,EAAEC,OAAO,EAAE;IAC/C,OAAO,CAAC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package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-datepicker-compat",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "React components for building web experiences",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -30,23 +30,23 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@fluentui/eslint-plugin": "*",
|
|
32
32
|
"@fluentui/react-conformance": "*",
|
|
33
|
-
"@fluentui/react-conformance-griffel": "9.0.0-beta.
|
|
33
|
+
"@fluentui/react-conformance-griffel": "9.0.0-beta.23",
|
|
34
34
|
"@fluentui/scripts-api-extractor": "*",
|
|
35
35
|
"@fluentui/scripts-tasks": "*"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@fluentui/keyboard-keys": "^9.0.3",
|
|
39
|
-
"@fluentui/react-field": "^9.1.
|
|
40
|
-
"@fluentui/react-icons": "^2.0.
|
|
41
|
-
"@fluentui/react-input": "^9.4.
|
|
42
|
-
"@fluentui/react-jsx-runtime": "9.0.0-alpha.
|
|
43
|
-
"@fluentui/react-popover": "^9.
|
|
44
|
-
"@fluentui/react-portal": "^9.2.
|
|
45
|
-
"@fluentui/react-positioning": "^9.
|
|
46
|
-
"@fluentui/react-shared-contexts": "^9.5.
|
|
47
|
-
"@fluentui/react-tabster": "^9.
|
|
48
|
-
"@fluentui/react-theme": "^9.1.
|
|
49
|
-
"@fluentui/react-utilities": "^9.9.
|
|
39
|
+
"@fluentui/react-field": "^9.1.8",
|
|
40
|
+
"@fluentui/react-icons": "^2.0.203",
|
|
41
|
+
"@fluentui/react-input": "^9.4.18",
|
|
42
|
+
"@fluentui/react-jsx-runtime": "9.0.0-alpha.8",
|
|
43
|
+
"@fluentui/react-popover": "^9.7.1",
|
|
44
|
+
"@fluentui/react-portal": "^9.2.14",
|
|
45
|
+
"@fluentui/react-positioning": "^9.7.1",
|
|
46
|
+
"@fluentui/react-shared-contexts": "^9.5.1",
|
|
47
|
+
"@fluentui/react-tabster": "^9.8.1",
|
|
48
|
+
"@fluentui/react-theme": "^9.1.9",
|
|
49
|
+
"@fluentui/react-utilities": "^9.9.4",
|
|
50
50
|
"@griffel/react": "^1.5.7",
|
|
51
51
|
"@swc/helpers": "^0.4.14"
|
|
52
52
|
},
|