@fluentui/react-datepicker-compat 0.0.0-nightly-20250423-0405.1 → 0.0.0-nightly-20250423-1415.1
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.md +19 -19
- package/dist/index.d.ts +245 -0
- package/lib/DatePicker.js +1 -0
- package/lib/DatePicker.js.map +1 -0
- package/lib/components/DatePicker/DatePicker.js +10 -0
- package/lib/components/DatePicker/DatePicker.js.map +1 -0
- package/lib/components/DatePicker/DatePicker.types.js +3 -0
- package/lib/components/DatePicker/DatePicker.types.js.map +1 -0
- package/lib/components/DatePicker/defaults.js +14 -0
- package/lib/components/DatePicker/defaults.js.map +1 -0
- package/lib/components/DatePicker/index.js +5 -0
- package/lib/components/DatePicker/index.js.map +1 -0
- package/lib/components/DatePicker/renderDatePicker.js +22 -0
- package/lib/components/DatePicker/renderDatePicker.js.map +1 -0
- package/lib/components/DatePicker/useDatePicker.js +451 -0
- package/lib/components/DatePicker/useDatePicker.js.map +1 -0
- package/lib/components/DatePicker/useDatePickerStyles.styles.js +43 -0
- package/lib/components/DatePicker/useDatePickerStyles.styles.js.map +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -0
- package/lib/utils/usePopupPositioning.js +21 -0
- package/lib/utils/usePopupPositioning.js.map +1 -0
- package/lib-commonjs/DatePicker.js +34 -0
- package/lib-commonjs/DatePicker.js.map +1 -0
- package/lib-commonjs/components/DatePicker/DatePicker.js +21 -0
- package/lib-commonjs/components/DatePicker/DatePicker.js.map +1 -0
- package/lib-commonjs/components/DatePicker/DatePicker.types.js +6 -0
- package/lib-commonjs/components/DatePicker/DatePicker.types.js.map +1 -0
- package/lib-commonjs/components/DatePicker/defaults.js +32 -0
- package/lib-commonjs/components/DatePicker/defaults.js.map +1 -0
- package/lib-commonjs/components/DatePicker/index.js +38 -0
- package/lib-commonjs/components/DatePicker/index.js.map +1 -0
- package/lib-commonjs/components/DatePicker/renderDatePicker.js +30 -0
- package/lib-commonjs/components/DatePicker/renderDatePicker.js.map +1 -0
- package/lib-commonjs/components/DatePicker/useDatePicker.js +451 -0
- package/lib-commonjs/components/DatePicker/useDatePicker.js.map +1 -0
- package/lib-commonjs/components/DatePicker/useDatePickerStyles.styles.js +62 -0
- package/lib-commonjs/components/DatePicker/useDatePickerStyles.styles.js.map +1 -0
- package/lib-commonjs/index.js +34 -0
- package/lib-commonjs/index.js.map +1 -0
- package/lib-commonjs/utils/usePopupPositioning.js +26 -0
- package/lib-commonjs/utils/usePopupPositioning.js.map +1 -0
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-datepicker-compat
|
|
2
2
|
|
|
3
|
-
This log was last generated on Wed, 23 Apr 2025
|
|
3
|
+
This log was last generated on Wed, 23 Apr 2025 14:31:23 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## [0.0.0-nightly-20250423-
|
|
7
|
+
## [0.0.0-nightly-20250423-1415.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-datepicker-compat_v0.0.0-nightly-20250423-1415.1)
|
|
8
8
|
|
|
9
|
-
Wed, 23 Apr 2025
|
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-datepicker-compat_v0.5.5..@fluentui/react-datepicker-compat_v0.0.0-nightly-20250423-
|
|
9
|
+
Wed, 23 Apr 2025 14:31:23 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-datepicker-compat_v0.5.5..@fluentui/react-datepicker-compat_v0.0.0-nightly-20250423-1415.1)
|
|
11
11
|
|
|
12
12
|
### Changes
|
|
13
13
|
|
|
14
14
|
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
|
|
15
|
-
- Bump @fluentui/keyboard-keys to v0.0.0-nightly-20250423-
|
|
16
|
-
- Bump @fluentui/react-calendar-compat to v0.0.0-nightly-20250423-
|
|
17
|
-
- Bump @fluentui/react-field to v0.0.0-nightly-20250423-
|
|
18
|
-
- Bump @fluentui/react-input to v0.0.0-nightly-20250423-
|
|
19
|
-
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20250423-
|
|
20
|
-
- Bump @fluentui/react-popover to v0.0.0-nightly-20250423-
|
|
21
|
-
- Bump @fluentui/react-portal to v0.0.0-nightly-20250423-
|
|
22
|
-
- Bump @fluentui/react-positioning to v0.0.0-nightly-20250423-
|
|
23
|
-
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20250423-
|
|
24
|
-
- Bump @fluentui/react-tabster to v0.0.0-nightly-20250423-
|
|
25
|
-
- Bump @fluentui/react-theme to v0.0.0-nightly-20250423-
|
|
26
|
-
- Bump @fluentui/react-utilities to v0.0.0-nightly-20250423-
|
|
27
|
-
- Bump @fluentui/react-provider to v0.0.0-nightly-20250423-
|
|
28
|
-
- Bump @fluentui/react-conformance to v0.0.0-nightly-20250423-
|
|
29
|
-
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20250423-
|
|
15
|
+
- Bump @fluentui/keyboard-keys to v0.0.0-nightly-20250423-1415.1 ([commit](https://github.com/microsoft/fluentui/commit/b656723ed77889fb88933f1af796b7643840dfa4) by beachball)
|
|
16
|
+
- Bump @fluentui/react-calendar-compat to v0.0.0-nightly-20250423-1415.1 ([commit](https://github.com/microsoft/fluentui/commit/b656723ed77889fb88933f1af796b7643840dfa4) by beachball)
|
|
17
|
+
- Bump @fluentui/react-field to v0.0.0-nightly-20250423-1415.1 ([commit](https://github.com/microsoft/fluentui/commit/b656723ed77889fb88933f1af796b7643840dfa4) by beachball)
|
|
18
|
+
- Bump @fluentui/react-input to v0.0.0-nightly-20250423-1415.1 ([commit](https://github.com/microsoft/fluentui/commit/b656723ed77889fb88933f1af796b7643840dfa4) by beachball)
|
|
19
|
+
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20250423-1415.1 ([commit](https://github.com/microsoft/fluentui/commit/b656723ed77889fb88933f1af796b7643840dfa4) by beachball)
|
|
20
|
+
- Bump @fluentui/react-popover to v0.0.0-nightly-20250423-1415.1 ([commit](https://github.com/microsoft/fluentui/commit/b656723ed77889fb88933f1af796b7643840dfa4) by beachball)
|
|
21
|
+
- Bump @fluentui/react-portal to v0.0.0-nightly-20250423-1415.1 ([commit](https://github.com/microsoft/fluentui/commit/b656723ed77889fb88933f1af796b7643840dfa4) by beachball)
|
|
22
|
+
- Bump @fluentui/react-positioning to v0.0.0-nightly-20250423-1415.1 ([commit](https://github.com/microsoft/fluentui/commit/b656723ed77889fb88933f1af796b7643840dfa4) by beachball)
|
|
23
|
+
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20250423-1415.1 ([commit](https://github.com/microsoft/fluentui/commit/b656723ed77889fb88933f1af796b7643840dfa4) by beachball)
|
|
24
|
+
- Bump @fluentui/react-tabster to v0.0.0-nightly-20250423-1415.1 ([commit](https://github.com/microsoft/fluentui/commit/b656723ed77889fb88933f1af796b7643840dfa4) by beachball)
|
|
25
|
+
- Bump @fluentui/react-theme to v0.0.0-nightly-20250423-1415.1 ([commit](https://github.com/microsoft/fluentui/commit/b656723ed77889fb88933f1af796b7643840dfa4) by beachball)
|
|
26
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightly-20250423-1415.1 ([commit](https://github.com/microsoft/fluentui/commit/b656723ed77889fb88933f1af796b7643840dfa4) by beachball)
|
|
27
|
+
- Bump @fluentui/react-provider to v0.0.0-nightly-20250423-1415.1 ([commit](https://github.com/microsoft/fluentui/commit/b656723ed77889fb88933f1af796b7643840dfa4) by beachball)
|
|
28
|
+
- Bump @fluentui/react-conformance to v0.0.0-nightly-20250423-1415.1 ([commit](https://github.com/microsoft/fluentui/commit/b656723ed77889fb88933f1af796b7643840dfa4) by beachball)
|
|
29
|
+
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20250423-1415.1 ([commit](https://github.com/microsoft/fluentui/commit/b656723ed77889fb88933f1af796b7643840dfa4) by beachball)
|
|
30
30
|
|
|
31
31
|
## [0.5.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-datepicker-compat_v0.5.5)
|
|
32
32
|
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
|
|
3
|
+
import type { CalendarProps } from '@fluentui/react-calendar-compat';
|
|
4
|
+
import { CalendarStrings } from '@fluentui/react-calendar-compat';
|
|
5
|
+
import type { ComponentProps } from '@fluentui/react-utilities';
|
|
6
|
+
import type { ComponentState } from '@fluentui/react-utilities';
|
|
7
|
+
import type { DateFormatting } from '@fluentui/react-calendar-compat';
|
|
8
|
+
import { DayOfWeek } from '@fluentui/react-calendar-compat';
|
|
9
|
+
import { FirstWeekOfYear } from '@fluentui/react-calendar-compat';
|
|
10
|
+
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
11
|
+
import { Input } from '@fluentui/react-input';
|
|
12
|
+
import type { PortalProps } from '@fluentui/react-portal';
|
|
13
|
+
import type { PositioningProps } from '@fluentui/react-positioning';
|
|
14
|
+
import * as React_2 from 'react';
|
|
15
|
+
import type { Slot } from '@fluentui/react-utilities';
|
|
16
|
+
import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
17
|
+
|
|
18
|
+
export { CalendarStrings }
|
|
19
|
+
|
|
20
|
+
export declare const DatePicker: ForwardRefComponent<DatePickerProps>;
|
|
21
|
+
|
|
22
|
+
export declare const datePickerClassNames: SlotClassNames<DatePickerSlots>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Error types returned by the `onValidationResult` callback.
|
|
26
|
+
*/
|
|
27
|
+
export declare type DatePickerErrorType = 'invalid-input' | 'out-of-bounds' | 'required-input';
|
|
28
|
+
|
|
29
|
+
export declare type DatePickerProps = Omit<ComponentProps<Partial<DatePickerSlots>>, 'defaultValue' | 'value'> & Pick<PortalProps, 'mountNode'> & {
|
|
30
|
+
/**
|
|
31
|
+
* Callback issued when a date is selected
|
|
32
|
+
*/
|
|
33
|
+
onSelectDate?: (date: Date | null | undefined) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the DatePicker is a required field or not. When using `<Field>`, this prop is automatically set.
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
required?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Disabled state of the DatePicker.
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Whether or not the Input of the DatePicker is underlined.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
underlined?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Whether the month picker is shown beside the day picker or hidden.
|
|
51
|
+
* @default true
|
|
52
|
+
*/
|
|
53
|
+
isMonthPickerVisible?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Show month picker on top of date picker when visible.
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
showMonthPickerAsOverlay?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Whether the DatePicker allows input a date string directly or not
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
allowTextInput?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Whether the DatePicker should open automatically when the control is focused
|
|
66
|
+
* WARNING: setting this to false creates an accessibility violation and is not recommended
|
|
67
|
+
* @default true
|
|
68
|
+
*/
|
|
69
|
+
disableAutoFocus?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Whether the DatePicker should open when the input is clicked
|
|
72
|
+
* @default true
|
|
73
|
+
*/
|
|
74
|
+
openOnClick?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Whether the DatePicker should be open by default
|
|
77
|
+
*
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
defaultOpen?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Whether the DatePicker is open or not
|
|
83
|
+
*
|
|
84
|
+
* @default false
|
|
85
|
+
*/
|
|
86
|
+
open?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Callback to run when the DatePicker's open state changes
|
|
89
|
+
*/
|
|
90
|
+
onOpenChange?: (open: boolean) => void;
|
|
91
|
+
/**
|
|
92
|
+
* Callback to run after the DatePicker's input has been validated
|
|
93
|
+
*/
|
|
94
|
+
onValidationResult?: (data: DatePickerValidationResultData) => void;
|
|
95
|
+
/**
|
|
96
|
+
* Whether the DatePicker should render the popup as inline or in a portal
|
|
97
|
+
*
|
|
98
|
+
* @default false
|
|
99
|
+
*/
|
|
100
|
+
inlinePopup?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Configure the positioning of the DatePicker dialog
|
|
103
|
+
*
|
|
104
|
+
* @default below
|
|
105
|
+
*/
|
|
106
|
+
positioning?: PositioningProps;
|
|
107
|
+
/**
|
|
108
|
+
* Placeholder text for the DatePicker
|
|
109
|
+
*/
|
|
110
|
+
placeholder?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Value of today. If unspecified, current time in client machine will be used.
|
|
113
|
+
*/
|
|
114
|
+
today?: Date;
|
|
115
|
+
/**
|
|
116
|
+
* Default value of the DatePicker, if any
|
|
117
|
+
*
|
|
118
|
+
* When the component is controlled, `null` should be used instead of `undefined` to avoid controlled vs. uncontrolled
|
|
119
|
+
* ambiguity.
|
|
120
|
+
*/
|
|
121
|
+
value?: Date | null;
|
|
122
|
+
/**
|
|
123
|
+
* Optional method to format the chosen date to a string to display in the DatePicker
|
|
124
|
+
* @default date.toString()
|
|
125
|
+
*/
|
|
126
|
+
formatDate?: (date?: Date) => string;
|
|
127
|
+
/**
|
|
128
|
+
* Optional method to parse the text input value to date, it is only useful when allowTextInput is set to true
|
|
129
|
+
* @default new Date(Date.parse(dateStr))
|
|
130
|
+
*/
|
|
131
|
+
parseDateFromString?: (dateStr: string) => Date | null;
|
|
132
|
+
/**
|
|
133
|
+
* The first day of the week for your locale.
|
|
134
|
+
* @default DayOfWeek.Sunday
|
|
135
|
+
*/
|
|
136
|
+
firstDayOfWeek?: DayOfWeek;
|
|
137
|
+
/**
|
|
138
|
+
* Localized strings to use in the Calendar
|
|
139
|
+
*/
|
|
140
|
+
strings?: CalendarStrings;
|
|
141
|
+
/**
|
|
142
|
+
* Whether the month picker should highlight the current month
|
|
143
|
+
* @default false
|
|
144
|
+
*/
|
|
145
|
+
highlightCurrentMonth?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Whether the month picker should highlight the selected month
|
|
148
|
+
* @default false
|
|
149
|
+
*/
|
|
150
|
+
highlightSelectedMonth?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Whether the calendar should show the week number (weeks 1 to 53) before each week row
|
|
153
|
+
* @default false
|
|
154
|
+
*/
|
|
155
|
+
showWeekNumbers?: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Defines when the first week of the year should start, FirstWeekOfYear.FirstDay,
|
|
158
|
+
* FirstWeekOfYear.FirstFullWeek or FirstWeekOfYear.FirstFourDayWeek are the possible values
|
|
159
|
+
* @default FirstWeekOfYear.FirstFullWeek
|
|
160
|
+
*/
|
|
161
|
+
firstWeekOfYear?: FirstWeekOfYear;
|
|
162
|
+
/**
|
|
163
|
+
* Whether the "Go to today" link should be shown or not
|
|
164
|
+
*/
|
|
165
|
+
showGoToToday?: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Determines if the DatePicker has a border.
|
|
168
|
+
* @default false
|
|
169
|
+
*/
|
|
170
|
+
borderless?: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Apply additional formatting to dates, for example localized date formatting.
|
|
173
|
+
*/
|
|
174
|
+
dateTimeFormatter?: DateFormatting;
|
|
175
|
+
/**
|
|
176
|
+
* The minimum allowable date.
|
|
177
|
+
*/
|
|
178
|
+
minDate?: Date;
|
|
179
|
+
/**
|
|
180
|
+
* The maximum allowable date.
|
|
181
|
+
*/
|
|
182
|
+
maxDate?: Date;
|
|
183
|
+
/**
|
|
184
|
+
* The initially highlighted date.
|
|
185
|
+
*/
|
|
186
|
+
initialPickerDate?: Date;
|
|
187
|
+
/**
|
|
188
|
+
* Allows all elements to be focused, including disabled ones
|
|
189
|
+
* @default false
|
|
190
|
+
*/
|
|
191
|
+
allFocusable?: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Whether the CalendarDay close button should be shown or not.
|
|
194
|
+
*/
|
|
195
|
+
showCloseButton?: boolean;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
declare type DatePickerSlots = {
|
|
199
|
+
root: NonNullable<Slot<typeof Input>>;
|
|
200
|
+
calendar: NonNullable<Slot<Partial<CalendarProps>>>;
|
|
201
|
+
popupSurface?: Slot<'div'>;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* State used in rendering DatePicker.
|
|
206
|
+
*/
|
|
207
|
+
declare type DatePickerState = ComponentState<DatePickerSlots> & Pick<DatePickerProps, 'mountNode'> & {
|
|
208
|
+
disabled: boolean;
|
|
209
|
+
inlinePopup: boolean;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Data passed to the `onValidationResult` callback.
|
|
214
|
+
*/
|
|
215
|
+
export declare type DatePickerValidationResultData = {
|
|
216
|
+
/** The error found when validating the input. */
|
|
217
|
+
error?: DatePickerErrorType;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
export declare const defaultDatePickerErrorStrings: Record<DatePickerErrorType, string>;
|
|
221
|
+
|
|
222
|
+
export declare const defaultDatePickerStrings: CalendarStrings;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Render the final JSX of DatePicker
|
|
226
|
+
*/
|
|
227
|
+
export declare const renderDatePicker_unstable: (state: DatePickerState) => JSX.Element;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Create the state required to render DatePicker.
|
|
231
|
+
*
|
|
232
|
+
* The returned state can be modified with hooks such as useDatePickerStyles_unstable,
|
|
233
|
+
* before being passed to renderDatePicker_unstable.
|
|
234
|
+
*
|
|
235
|
+
* @param props - props from this instance of DatePicker
|
|
236
|
+
* @param ref - reference to root Input slot
|
|
237
|
+
*/
|
|
238
|
+
export declare const useDatePicker_unstable: (props: DatePickerProps, ref: React_2.Ref<HTMLInputElement>) => DatePickerState;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Apply styling to the DatePicker slots based on the state
|
|
242
|
+
*/
|
|
243
|
+
export declare const useDatePickerStyles_unstable: (state: DatePickerState) => DatePickerState;
|
|
244
|
+
|
|
245
|
+
export { }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DatePicker, datePickerClassNames, defaultDatePickerErrorStrings, defaultDatePickerStrings, renderDatePicker_unstable, useDatePickerStyles_unstable, useDatePicker_unstable } from './components/DatePicker/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/DatePicker.ts"],"sourcesContent":["export type {\n DatePickerErrorType,\n DatePickerProps,\n DatePickerSlots,\n DatePickerState,\n DatePickerValidationResultData,\n} from './components/DatePicker/index';\nexport {\n DatePicker,\n datePickerClassNames,\n defaultDatePickerErrorStrings,\n defaultDatePickerStrings,\n renderDatePicker_unstable,\n useDatePickerStyles_unstable,\n useDatePicker_unstable,\n} from './components/DatePicker/index';\n"],"names":["DatePicker","datePickerClassNames","defaultDatePickerErrorStrings","defaultDatePickerStrings","renderDatePicker_unstable","useDatePickerStyles_unstable","useDatePicker_unstable"],"rangeMappings":"","mappings":"AAOA,SACEA,UAAU,EACVC,oBAAoB,EACpBC,6BAA6B,EAC7BC,wBAAwB,EACxBC,yBAAyB,EACzBC,4BAA4B,EAC5BC,sBAAsB,QACjB,gCAAgC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { renderDatePicker_unstable } from './renderDatePicker';
|
|
3
|
+
import { useDatePicker_unstable } from './useDatePicker';
|
|
4
|
+
import { useDatePickerStyles_unstable } from './useDatePickerStyles.styles';
|
|
5
|
+
export const DatePicker = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
6
|
+
const state = useDatePicker_unstable(props, ref);
|
|
7
|
+
useDatePickerStyles_unstable(state);
|
|
8
|
+
return renderDatePicker_unstable(state);
|
|
9
|
+
});
|
|
10
|
+
DatePicker.displayName = 'DatePicker';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport { renderDatePicker_unstable } from './renderDatePicker';\nimport { useDatePicker_unstable } from './useDatePicker';\nimport { useDatePickerStyles_unstable } from './useDatePickerStyles.styles';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { DatePickerProps } from './DatePicker.types';\n\nexport const DatePicker: ForwardRefComponent<DatePickerProps> = React.forwardRef((props, ref) => {\n const state = useDatePicker_unstable(props, ref);\n\n useDatePickerStyles_unstable(state);\n return renderDatePicker_unstable(state);\n}) as ForwardRefComponent<DatePickerProps>;\nDatePicker.displayName = 'DatePicker';\n"],"names":["React","renderDatePicker_unstable","useDatePicker_unstable","useDatePickerStyles_unstable","DatePicker","forwardRef","props","ref","state","displayName"],"rangeMappings":";;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,4BAA4B,QAAQ,+BAA+B;AAI5E,OAAO,MAAMC,2BAAmDJ,MAAMK,UAAU,CAAC,CAACC,OAAOC;IACvF,MAAMC,QAAQN,uBAAuBI,OAAOC;IAE5CJ,6BAA6BK;IAC7B,OAAOP,0BAA0BO;AACnC,GAA2C;AAC3CJ,WAAWK,WAAW,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/DatePicker/DatePicker.types.ts"],"sourcesContent":["import { DayOfWeek, FirstWeekOfYear } from '@fluentui/react-calendar-compat';\nimport { Input } from '@fluentui/react-input';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { CalendarProps, CalendarStrings, DateFormatting } from '@fluentui/react-calendar-compat';\nimport type { PortalProps } from '@fluentui/react-portal';\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\nexport type DatePickerProps = Omit<ComponentProps<Partial<DatePickerSlots>>, 'defaultValue' | 'value'> &\n Pick<PortalProps, 'mountNode'> & {\n /**\n * Callback issued when a date is selected\n */\n // eslint-disable-next-line @nx/workspace-consistent-callback-type -- can't change type of existing callback\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 // eslint-disable-next-line @nx/workspace-consistent-callback-type -- can't change type of existing callback\n onOpenChange?: (open: boolean) => void;\n\n /**\n * Callback to run after the DatePicker's input has been validated\n */\n // eslint-disable-next-line @nx/workspace-consistent-callback-type -- can't change type of existing callback\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 Pick<DatePickerProps, 'mountNode'> & {\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":[],"rangeMappings":";;","mappings":"AA4OA;;CAEC,GACD,WAAuF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defaultCalendarStrings } from '@fluentui/react-calendar-compat';
|
|
2
|
+
export const defaultDatePickerStrings = {
|
|
3
|
+
...defaultCalendarStrings,
|
|
4
|
+
prevMonthAriaLabel: 'Go to previous month',
|
|
5
|
+
nextMonthAriaLabel: 'Go to next month',
|
|
6
|
+
prevYearAriaLabel: 'Go to previous year',
|
|
7
|
+
nextYearAriaLabel: 'Go to next year',
|
|
8
|
+
closeButtonAriaLabel: 'Close date picker'
|
|
9
|
+
};
|
|
10
|
+
export const defaultDatePickerErrorStrings = {
|
|
11
|
+
'invalid-input': 'Invalid date format',
|
|
12
|
+
'out-of-bounds': 'Date is out of bounds',
|
|
13
|
+
'required-input': 'Field is required'
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/DatePicker/defaults.ts"],"sourcesContent":["import { defaultCalendarStrings } from '@fluentui/react-calendar-compat';\nimport type { CalendarStrings } from '@fluentui/react-calendar-compat';\nimport type { DatePickerErrorType } from './DatePicker.types';\n\nexport const defaultDatePickerStrings: CalendarStrings = {\n ...defaultCalendarStrings,\n prevMonthAriaLabel: 'Go to previous month',\n nextMonthAriaLabel: 'Go to next month',\n prevYearAriaLabel: 'Go to previous year',\n nextYearAriaLabel: 'Go to next year',\n closeButtonAriaLabel: 'Close date picker',\n};\n\nexport const defaultDatePickerErrorStrings: Record<DatePickerErrorType, string> = {\n 'invalid-input': 'Invalid date format',\n 'out-of-bounds': 'Date is out of bounds',\n 'required-input': 'Field is required',\n};\n"],"names":["defaultCalendarStrings","defaultDatePickerStrings","prevMonthAriaLabel","nextMonthAriaLabel","prevYearAriaLabel","nextYearAriaLabel","closeButtonAriaLabel","defaultDatePickerErrorStrings"],"rangeMappings":";;;;;;;;;;;;;","mappings":"AAAA,SAASA,sBAAsB,QAAQ,kCAAkC;AAIzE,OAAO,MAAMC,2BAA4C;IACvD,GAAGD,sBAAsB;IACzBE,oBAAoB;IACpBC,oBAAoB;IACpBC,mBAAmB;IACnBC,mBAAmB;IACnBC,sBAAsB;AACxB,EAAE;AAEF,OAAO,MAAMC,gCAAqE;IAChF,iBAAiB;IACjB,iBAAiB;IACjB,kBAAkB;AACpB,EAAE"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { defaultDatePickerErrorStrings, defaultDatePickerStrings } from './defaults';
|
|
2
|
+
export { DatePicker } from './DatePicker';
|
|
3
|
+
export { renderDatePicker_unstable } from './renderDatePicker';
|
|
4
|
+
export { useDatePicker_unstable } from './useDatePicker';
|
|
5
|
+
export { datePickerClassNames, useDatePickerStyles_unstable } from './useDatePickerStyles.styles';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/DatePicker/index.ts"],"sourcesContent":["export { defaultDatePickerErrorStrings, defaultDatePickerStrings } from './defaults';\nexport { DatePicker } from './DatePicker';\nexport type {\n DatePickerErrorType,\n DatePickerProps,\n DatePickerSlots,\n DatePickerState,\n DatePickerValidationResultData,\n} from './DatePicker.types';\nexport { renderDatePicker_unstable } from './renderDatePicker';\nexport { useDatePicker_unstable } from './useDatePicker';\nexport { datePickerClassNames, useDatePickerStyles_unstable } from './useDatePickerStyles.styles';\n"],"names":["defaultDatePickerErrorStrings","defaultDatePickerStrings","DatePicker","renderDatePicker_unstable","useDatePicker_unstable","datePickerClassNames","useDatePickerStyles_unstable"],"rangeMappings":";;;;","mappings":"AAAA,SAASA,6BAA6B,EAAEC,wBAAwB,QAAQ,aAAa;AACrF,SAASC,UAAU,QAAQ,eAAe;AAQ1C,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,oBAAoB,EAAEC,4BAA4B,QAAQ,+BAA+B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { Portal } from '@fluentui/react-portal';
|
|
3
|
+
import { assertSlots } from '@fluentui/react-utilities';
|
|
4
|
+
/**
|
|
5
|
+
* Render the final JSX of DatePicker
|
|
6
|
+
*/ export const renderDatePicker_unstable = (state)=>{
|
|
7
|
+
assertSlots(state);
|
|
8
|
+
const { inlinePopup } = state;
|
|
9
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
10
|
+
children: [
|
|
11
|
+
/*#__PURE__*/ _jsx(state.root, {}),
|
|
12
|
+
state.popupSurface && (inlinePopup ? /*#__PURE__*/ _jsx(state.popupSurface, {
|
|
13
|
+
children: /*#__PURE__*/ _jsx(state.calendar, {})
|
|
14
|
+
}) : /*#__PURE__*/ _jsx(Portal, {
|
|
15
|
+
mountNode: state.mountNode,
|
|
16
|
+
children: /*#__PURE__*/ _jsx(state.popupSurface, {
|
|
17
|
+
children: /*#__PURE__*/ _jsx(state.calendar, {})
|
|
18
|
+
})
|
|
19
|
+
}))
|
|
20
|
+
]
|
|
21
|
+
});
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/DatePicker/renderDatePicker.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { Portal } from '@fluentui/react-portal';\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { DatePickerSlots, DatePickerState } from './DatePicker.types';\n\n/**\n * Render the final JSX of DatePicker\n */\nexport const renderDatePicker_unstable = (state: DatePickerState) => {\n assertSlots<DatePickerSlots>(state);\n const { inlinePopup } = state;\n\n return (\n <>\n <state.root />\n {state.popupSurface &&\n (inlinePopup ? (\n <state.popupSurface>\n <state.calendar />\n </state.popupSurface>\n ) : (\n <Portal mountNode={state.mountNode}>\n <state.popupSurface>\n <state.calendar />\n </state.popupSurface>\n </Portal>\n ))}\n </>\n );\n};\n"],"names":["Portal","assertSlots","renderDatePicker_unstable","state","inlinePopup","root","popupSurface","calendar","mountNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,MAAM,QAAQ,yBAAyB;AAChD,SAASC,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,4BAA4B,CAACC;IACxCF,YAA6BE;IAC7B,MAAM,EAAEC,WAAW,EAAE,GAAGD;IAExB,qBACE;;0BACE,KAACA,MAAME,IAAI;YACVF,MAAMG,YAAY,IAChBF,CAAAA,4BACC,KAACD,MAAMG,YAAY;0BACjB,cAAA,KAACH,MAAMI,QAAQ;+BAGjB,KAACP;gBAAOQ,WAAWL,MAAMK,SAAS;0BAChC,cAAA,KAACL,MAAMG,YAAY;8BACjB,cAAA,KAACH,MAAMI,QAAQ;;cAGrB;;;AAGR,EAAE"}
|