@fluentui/react-datepicker-compat 9.74.7-experimental.cli-api.20261006-ccaa611d58.0 → 9.75.0-experimental.css-modules.20261031-810ab07afb.0
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 +62 -17
- package/README.md +12 -0
- package/lib/components/DatePicker/DatePicker.js.map +1 -1
- package/lib/components/DatePicker/DatePicker.module.css +32 -0
- package/lib/components/DatePicker/DatePicker.types.js.map +1 -1
- package/lib/components/DatePicker/defaults.js.map +1 -1
- package/lib/components/DatePicker/index.js.map +1 -1
- package/lib/components/DatePicker/renderDatePicker.js +2 -2
- package/lib/components/DatePicker/renderDatePicker.js.map +1 -1
- package/lib/components/DatePicker/useDatePicker.js +2 -3
- package/lib/components/DatePicker/useDatePicker.js.map +1 -1
- package/lib/components/DatePicker/useDatePickerStyles.styles.css.js +15 -0
- package/lib/components/DatePicker/useDatePickerStyles.styles.css.js.map +1 -0
- package/lib/components/DatePicker/useDatePickerStyles.styles.raw.css.js +15 -0
- package/lib/components/DatePicker/useDatePickerStyles.styles.raw.css.js.map +1 -0
- package/lib/components/DatePicker/useDatePickerStyles.styles.raw.js.map +1 -1
- package/lib/utils/usePopupPositioning.js.map +1 -1
- package/lib-commonjs/DatePicker.cjs +8 -8
- package/lib-commonjs/components/DatePicker/DatePicker.cjs.map +1 -1
- package/lib-commonjs/components/DatePicker/DatePicker.module.css +32 -0
- package/lib-commonjs/components/DatePicker/DatePicker.types.cjs.map +1 -1
- package/lib-commonjs/components/DatePicker/defaults.cjs +3 -3
- package/lib-commonjs/components/DatePicker/defaults.cjs.map +1 -1
- package/lib-commonjs/components/DatePicker/index.cjs +8 -8
- package/lib-commonjs/components/DatePicker/index.cjs.map +1 -1
- package/lib-commonjs/components/DatePicker/renderDatePicker.cjs.map +1 -1
- package/lib-commonjs/components/DatePicker/useDatePicker.cjs +2 -3
- package/lib-commonjs/components/DatePicker/useDatePicker.cjs.map +1 -1
- package/lib-commonjs/components/DatePicker/useDatePickerStyles.styles.cjs +3 -3
- package/lib-commonjs/components/DatePicker/useDatePickerStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/DatePicker/useDatePickerStyles.styles.css.cjs +34 -0
- package/lib-commonjs/components/DatePicker/useDatePickerStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/DatePicker/useDatePickerStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/DatePicker/useDatePickerStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/DatePicker/useDatePickerStyles.styles.raw.css.cjs +34 -0
- package/lib-commonjs/components/DatePicker/useDatePickerStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/index.cjs +8 -8
- package/lib-commonjs/utils/usePopupPositioning.cjs.map +1 -1
- package/package.json +20 -20
- package/dist/metadata/api/api-root.json +0 -1
- package/dist/metadata/index.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,29 +1,74 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-datepicker-compat
|
|
2
2
|
|
|
3
|
-
<!-- This log was last generated on
|
|
3
|
+
<!-- This log was last generated on Sat, 31 Oct 2026 11:08:43 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## [9.
|
|
7
|
+
## [9.75.0-experimental.css-modules.20261031-810ab07afb.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-datepicker-compat_v9.75.0-experimental.css-modules.20261031-810ab07afb.0)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-datepicker-compat_v0.6.37..@fluentui/react-datepicker-compat_v9.74.7-experimental.cli-api.20261006-ccaa611d58.0)
|
|
9
|
+
Sat, 31 Oct 2026 11:08:43 GMT
|
|
11
10
|
|
|
12
11
|
### Changes
|
|
13
12
|
|
|
14
|
-
- Release 9.
|
|
15
|
-
- Bump @fluentui/keyboard-keys to v9.
|
|
16
|
-
- Bump @fluentui/react-calendar-compat to v9.
|
|
17
|
-
- Bump @fluentui/react-field to v9.
|
|
18
|
-
- Bump @fluentui/react-input to v9.
|
|
19
|
-
- Bump @fluentui/react-jsx-runtime to v9.
|
|
20
|
-
- Bump @fluentui/react-popover to v9.
|
|
21
|
-
- Bump @fluentui/react-portal to v9.
|
|
22
|
-
- Bump @fluentui/react-positioning to v9.
|
|
23
|
-
- Bump @fluentui/react-shared-contexts to v9.
|
|
24
|
-
- Bump @fluentui/react-tabster to v9.
|
|
25
|
-
- Bump @fluentui/react-theme to v9.
|
|
26
|
-
- Bump @fluentui/react-utilities to v9.
|
|
13
|
+
- Release 9.75.0-experimental.css-modules.20261031-810ab07afb ([commit](https://github.com/microsoft/fluentui/commit/undefined) by 257645319+office-ogx-auth-helper[bot]@users.noreply.github.com)
|
|
14
|
+
- Bump @fluentui/keyboard-keys to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
15
|
+
- Bump @fluentui/react-calendar-compat to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
16
|
+
- Bump @fluentui/react-field to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
17
|
+
- Bump @fluentui/react-input to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
18
|
+
- Bump @fluentui/react-jsx-runtime to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
19
|
+
- Bump @fluentui/react-popover to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
20
|
+
- Bump @fluentui/react-portal to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
21
|
+
- Bump @fluentui/react-positioning to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
22
|
+
- Bump @fluentui/react-shared-contexts to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
23
|
+
- Bump @fluentui/react-tabster to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
24
|
+
- Bump @fluentui/react-theme to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
25
|
+
- Bump @fluentui/react-utilities to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
26
|
+
|
|
27
|
+
## [0.6.40](https://github.com/microsoft/fluentui/tree/@fluentui/react-datepicker-compat_v0.6.40)
|
|
28
|
+
|
|
29
|
+
Mon, 19 Oct 2026 16:49:01 GMT
|
|
30
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-datepicker-compat_v0.6.39..@fluentui/react-datepicker-compat_v0.6.40)
|
|
31
|
+
|
|
32
|
+
### Patches
|
|
33
|
+
|
|
34
|
+
- Bump @fluentui/react-calendar-compat to v0.4.8 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
35
|
+
- Bump @fluentui/react-field to v9.5.6 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
36
|
+
- Bump @fluentui/react-input to v9.8.8 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
37
|
+
- Bump @fluentui/react-jsx-runtime to v9.4.7 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
38
|
+
- Bump @fluentui/react-popover to v9.14.10 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
39
|
+
- Bump @fluentui/react-portal to v9.8.17 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
40
|
+
- Bump @fluentui/react-positioning to v9.23.4 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
41
|
+
- Bump @fluentui/react-tabster to v9.26.19 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
42
|
+
- Bump @fluentui/react-utilities to v9.27.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
43
|
+
|
|
44
|
+
## [0.6.39](https://github.com/microsoft/fluentui/tree/@fluentui/react-datepicker-compat_v0.6.39)
|
|
45
|
+
|
|
46
|
+
Wed, 23 Sep 2026 09:04:33 GMT
|
|
47
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-datepicker-compat_v0.6.38..@fluentui/react-datepicker-compat_v0.6.39)
|
|
48
|
+
|
|
49
|
+
### Patches
|
|
50
|
+
|
|
51
|
+
- Bump @fluentui/react-popover to v9.14.9 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
52
|
+
- Bump @fluentui/react-positioning to v9.23.3 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
53
|
+
|
|
54
|
+
## [0.6.38](https://github.com/microsoft/fluentui/tree/@fluentui/react-datepicker-compat_v0.6.38)
|
|
55
|
+
|
|
56
|
+
Tue, 22 Sep 2026 11:25:39 GMT
|
|
57
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-datepicker-compat_v0.6.37..@fluentui/react-datepicker-compat_v0.6.38)
|
|
58
|
+
|
|
59
|
+
### Patches
|
|
60
|
+
|
|
61
|
+
- fix: remove unused react-dom and @types/react-dom peer dependencies, mark @types/react as optional ([PR #36559](https://github.com/microsoft/fluentui/pull/36559) by martinhochel@microsoft.com)
|
|
62
|
+
- Bump @fluentui/react-calendar-compat to v0.4.7 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
63
|
+
- Bump @fluentui/react-field to v9.5.5 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
64
|
+
- Bump @fluentui/react-input to v9.8.7 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
65
|
+
- Bump @fluentui/react-jsx-runtime to v9.4.6 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
66
|
+
- Bump @fluentui/react-popover to v9.14.8 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
67
|
+
- Bump @fluentui/react-portal to v9.8.16 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
68
|
+
- Bump @fluentui/react-positioning to v9.23.2 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
69
|
+
- Bump @fluentui/react-shared-contexts to v9.26.4 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
70
|
+
- Bump @fluentui/react-tabster to v9.26.18 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
71
|
+
- Bump @fluentui/react-utilities to v9.26.7 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
27
72
|
|
|
28
73
|
## [0.6.37](https://github.com/microsoft/fluentui/tree/@fluentui/react-datepicker-compat_v0.6.37)
|
|
29
74
|
|
package/README.md
CHANGED
|
@@ -40,3 +40,15 @@ We will take a similar approach as v0 where we will follow this pattern:
|
|
|
40
40
|
|
|
41
41
|
- `breaking change (major)`: Since this is a compat component, we will allow breaking changes if absolutely necessary. To accommodate for this, we will denote those changes as a minor version in semver, i.e. `0.(change will be reflected here).x`.
|
|
42
42
|
- `minor and patch`: These changes will be reflected in the patch version in semver as `0.x.(change will be reflected here)`.
|
|
43
|
+
|
|
44
|
+
## Opt-in CSS Modules styles
|
|
45
|
+
|
|
46
|
+
The DatePicker style hook has an opt-in CSS Modules alternative. Griffel remains
|
|
47
|
+
the default. Configure a CSS Modules-capable bundler to replace
|
|
48
|
+
`useDatePickerStyles.styles` with `useDatePickerStyles.styles.css`, including
|
|
49
|
+
`.styles.js` → `.styles.css.js` for built imports, and retain the layered CSS
|
|
50
|
+
assets. The alternative preserves caller classes and styles the popup surface
|
|
51
|
+
independently so portaled and inline popups both work.
|
|
52
|
+
|
|
53
|
+
This alternative covers DatePicker's own slots only. Its composed Input and
|
|
54
|
+
Calendar components retain their existing style selection.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["'use client';\n\nimport * 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"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,yBAAyB,QAAQ,wBAAqB;AAC/D,SAASC,sBAAsB,QAAQ,qBAAkB;AACzD,SAASC,4BAA4B,QAAQ,kCAA+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,32 @@
|
|
|
1
|
+
@layer fluentui {
|
|
2
|
+
.root {
|
|
3
|
+
position: relative;
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
}
|
|
6
|
+
.root input {
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
}
|
|
9
|
+
.disabled {
|
|
10
|
+
cursor: default;
|
|
11
|
+
}
|
|
12
|
+
.disabled input {
|
|
13
|
+
cursor: default;
|
|
14
|
+
}
|
|
15
|
+
.inline {
|
|
16
|
+
z-index: 1;
|
|
17
|
+
}
|
|
18
|
+
.popupSurface {
|
|
19
|
+
background-color: var(--colorNeutralBackground1);
|
|
20
|
+
box-shadow: var(--shadow16);
|
|
21
|
+
border-radius: var(--borderRadiusMedium);
|
|
22
|
+
border-width: 1px;
|
|
23
|
+
border-style: solid;
|
|
24
|
+
border-color: var(--colorTransparentStroke);
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
color: var(--colorNeutralForeground1);
|
|
27
|
+
font-family: var(--fontFamilyBase);
|
|
28
|
+
font-size: var(--fontSizeBase300);
|
|
29
|
+
font-weight: var(--fontWeightRegular);
|
|
30
|
+
line-height: var(--lineHeightBase300);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/DatePicker/DatePicker.types.ts"],"sourcesContent":["import type { DayOfWeek, FirstWeekOfYear } from '@fluentui/react-calendar-compat';\nimport type { 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":[],"mappings":"AA4OA;;CAEC,GACD,WAAuF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
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"],"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
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"],"mappings":"AAAA,SAASA,6BAA6B,EAAEC,wBAAwB,QAAQ,gBAAa;AACrF,SAASC,UAAU,QAAQ,kBAAe;AAQ1C,SAASC,yBAAyB,QAAQ,wBAAqB;AAC/D,SAASC,sBAAsB,QAAQ,qBAAkB;AACzD,SAASC,oBAAoB,EAAEC,4BAA4B,QAAQ,kCAA+B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { Portal } from "@fluentui/react-portal";
|
|
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
3
|
import { assertSlots } from "@fluentui/react-utilities";
|
|
4
4
|
/**
|
|
5
5
|
* Render the final JSX of DatePicker
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
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 { JSXElement } 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): JSXElement => {\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"],"mappings":";AAAA,0BAA0B,GAC1B,iDAAiD,GAEjD,SAASA,MAAM,QAAQ,yBAAyB;AAChD,SAASC,WAAW,QAAQ,4BAA4B;AAIxD;;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"}
|
|
@@ -94,6 +94,7 @@ const defaultParseDateFromString = (dateStr)=>{
|
|
|
94
94
|
* @param props - props from this instance of DatePicker
|
|
95
95
|
* @param ref - reference to root Input slot
|
|
96
96
|
*/ export const useDatePicker_unstable = (props, ref)=>{
|
|
97
|
+
var _ref, _props_id;
|
|
97
98
|
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: initialPickerDateProp, inlinePopup = false, isMonthPickerVisible = true, maxDate, minDate, mountNode, onOpenChange, onSelectDate: onUserSelectDate, openOnClick = true, onValidationResult, parseDateFromString = defaultParseDateFromString, showCloseButton = false, showGoToToday = true, showMonthPickerAsOverlay = false, showWeekNumbers = false, strings = defaultDatePickerStrings, today, underlined = false, value, ...restOfProps } = props;
|
|
98
99
|
const initialPickerDate = React.useMemo(()=>initialPickerDateProp !== null && initialPickerDateProp !== void 0 ? initialPickerDateProp : new Date(), [
|
|
99
100
|
initialPickerDateProp
|
|
@@ -107,8 +108,7 @@ const defaultParseDateFromString = (dateStr)=>{
|
|
|
107
108
|
});
|
|
108
109
|
const [open, setOpenState] = usePopupVisibility(props);
|
|
109
110
|
const fieldContext = useFieldContext();
|
|
110
|
-
|
|
111
|
-
const required = (_fieldContext_required = fieldContext === null || fieldContext === void 0 ? void 0 : fieldContext.required) !== null && _fieldContext_required !== void 0 ? _fieldContext_required : props.required;
|
|
111
|
+
const required = (_ref = fieldContext === null || fieldContext === void 0 ? void 0 : fieldContext.required) !== null && _ref !== void 0 ? _ref : props.required;
|
|
112
112
|
const defaultId = useId('datePicker-input');
|
|
113
113
|
const popupSurfaceId = useId('datePicker-popupSurface');
|
|
114
114
|
const validateTextInput = React.useCallback((date = null)=>{
|
|
@@ -325,7 +325,6 @@ const defaultParseDateFromString = (dateStr)=>{
|
|
|
325
325
|
// Props to create a semantic but non-focusable button on the element with the click-to-open handler
|
|
326
326
|
// Used for voice control and touch screen reader accessibility
|
|
327
327
|
const inputLabelledBy = props['aria-labelledby'];
|
|
328
|
-
var _props_id;
|
|
329
328
|
const inputId = (_props_id = props.id) !== null && _props_id !== void 0 ? _props_id : defaultId;
|
|
330
329
|
const iconA11yProps = React.useMemo(()=>({
|
|
331
330
|
role: 'button',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/DatePicker/useDatePicker.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ArrowDown, Enter, Escape } from '@fluentui/keyboard-keys';\nimport { Calendar, compareDatePart, DayOfWeek, FirstWeekOfYear } from '@fluentui/react-calendar-compat';\nimport { CalendarMonthRegular } from '@fluentui/react-icons';\nimport { defaultDatePickerStrings } from './defaults';\nimport { Input } from '@fluentui/react-input';\nimport {\n mergeCallbacks,\n useControllableState,\n useEventCallback,\n useId,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n slot,\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 '@fluentui/react-calendar-compat';\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 = React.useCallback(() => {\n inputRef.current?.focus?.();\n }, []);\n\n const preventNextFocusOpeningPicker = React.useCallback(() => {\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 // eslint-disable-next-line react-hooks/set-state-in-effect\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<HTMLInputElement>): 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: initialPickerDateProp,\n inlinePopup = false,\n isMonthPickerVisible = true,\n maxDate,\n minDate,\n mountNode,\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\n const initialPickerDate = React.useMemo(() => initialPickerDateProp ?? new Date(), [initialPickerDateProp]);\n\n const calendar = React.useRef<ICalendar | null>(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 defaultId = useId('datePicker-input');\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 if (!open && !props.disabled) {\n focus();\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [focus, onOpenChange, props.disabled, 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 (_: 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 if (open) {\n ev.stopPropagation();\n ev.preventDefault();\n calendarDismissed();\n }\n break;\n\n case ArrowDown:\n ev.preventDefault();\n if (!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 // eslint-disable-next-line react-hooks/immutability\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.preventDefault();\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\n const inputRoot = slot.always(props.root, {\n defaultProps: {\n ref: triggerWrapperRef,\n },\n elementType: 'span',\n });\n inputRoot.ref = useMergedRefs(inputRoot.ref, triggerWrapperRef);\n\n const input = slot.always(props.input, {\n elementType: 'input',\n });\n input.ref = useMergedRefs(input.ref, ref, rootRef);\n\n // Props to create a semantic but non-focusable button on the element with the click-to-open handler\n // Used for voice control and touch screen reader accessibility\n const inputLabelledBy = props['aria-labelledby'];\n const inputId = props.id ?? defaultId;\n const iconA11yProps = React.useMemo(\n () => ({\n role: 'button',\n 'aria-expanded': open,\n 'aria-labelledby': inputLabelledBy ?? inputId,\n }),\n [open, inputLabelledBy, inputId],\n );\n\n const contentAfter = slot.always(props.contentAfter || {}, {\n defaultProps: {\n children: <CalendarMonthRegular />,\n ...iconA11yProps,\n },\n elementType: 'span',\n });\n contentAfter.onClick = useEventCallback(mergeCallbacks(contentAfter.onClick, onIconClick));\n\n const root = slot.always(restOfProps, {\n defaultProps: {\n appearance: inputAppearance,\n 'aria-controls': open ? popupSurfaceId : undefined,\n 'aria-expanded': open,\n 'aria-haspopup': 'dialog',\n readOnly: !allowTextInput,\n role: 'combobox',\n id: inputId,\n },\n elementType: Input,\n });\n root.root = inputRoot;\n root.input = input;\n root.contentAfter = contentAfter;\n root.onChange = useEventCallback(mergeCallbacks(root.onChange, onInputChange));\n root.onBlur = useEventCallback(mergeCallbacks(root.onBlur, onInputBlur));\n root.onKeyDown = useEventCallback(mergeCallbacks(root.onKeyDown, onInputKeyDown));\n root.onFocus = useEventCallback(mergeCallbacks(root.onFocus, onInputFocus));\n root.onClick = useEventCallback(mergeCallbacks(root.onClick, onInputClick));\n\n const { modalAttributes } = useModalAttributes({ trapFocus: true, alwaysFocusable: true, legacyTrapFocus: true });\n const popupSurface = open\n ? slot.optional(props.popupSurface, {\n renderByDefault: true,\n defaultProps: {\n 'aria-label': 'Calendar',\n 'aria-modal': true,\n id: popupSurfaceId,\n role: 'dialog',\n ref: popupRef,\n ...modalAttributes,\n },\n elementType: 'div',\n })\n : undefined;\n const { targetDocument } = useFluent();\n useOnClickOutside({\n element: targetDocument,\n callback: ev => dismissDatePickerPopup(),\n refs: [triggerWrapperRef, popupRef],\n disabled: !open,\n });\n useOnScrollOutside({\n element: targetDocument,\n callback: ev => dismissDatePickerPopup(),\n refs: [triggerWrapperRef, popupRef],\n disabled: !open,\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 // eslint-disable-next-line react-hooks/refs\n const calendarShorthand = slot.always(props.calendar, {\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 elementType: Calendar,\n });\n calendarShorthand.onDismiss = useEventCallback(mergeCallbacks(calendarShorthand.onDismiss, calendarDismissed));\n calendarShorthand.onSelectDate = useEventCallback(mergeCallbacks(calendarShorthand.onSelectDate, calendarDismissed));\n const state: DatePickerState = {\n disabled: !!props.disabled,\n inlinePopup,\n components: { root: Input, calendar: Calendar as React.FC<Partial<CalendarProps>>, popupSurface: 'div' },\n calendar: calendarShorthand,\n mountNode,\n root,\n popupSurface,\n };\n\n state.root.value = formattedDate;\n\n return state;\n};\n"],"names":["React","ArrowDown","Enter","Escape","Calendar","compareDatePart","DayOfWeek","FirstWeekOfYear","CalendarMonthRegular","defaultDatePickerStrings","Input","mergeCallbacks","useControllableState","useEventCallback","useId","useMergedRefs","useOnClickOutside","useOnScrollOutside","slot","useFieldContext_unstable","useFieldContext","useFluent_unstable","useFluent","useModalAttributes","usePopupPositioning","isDateOutOfBounds","date","minDate","maxDate","useFocusLogic","inputRef","useRef","preventFocusOpeningPicker","focus","useCallback","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","initialPickerDateProp","inlinePopup","isMonthPickerVisible","mountNode","onUserSelectDate","openOnClick","onValidationResult","parseDateFromString","showCloseButton","showGoToToday","showMonthPickerAsOverlay","showWeekNumbers","strings","today","underlined","restOfProps","useMemo","calendar","rootRef","setOpenState","fieldContext","required","defaultId","popupSurfaceId","validateTextInput","error","isNaN","getTime","newState","disabled","dismissDatePickerPopup","newlySelectedDate","showDatePickerPopup","calendarDismissed","onInputChange","_","data","newValue","onInputBlur","onInputKeyDown","ev","key","preventDefault","stopPropagation","onInputFocus","onInputClick","onIconClick","inputAppearance","triggerWrapperRef","popupRef","inputRoot","always","root","defaultProps","elementType","input","inputLabelledBy","inputId","id","iconA11yProps","role","contentAfter","children","onClick","appearance","undefined","readOnly","onChange","onBlur","onKeyDown","onFocus","modalAttributes","trapFocus","alwaysFocusable","legacyTrapFocus","popupSurface","optional","renderByDefault","targetDocument","element","callback","refs","calendarShorthand","componentRef","onDismiss","components"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,SAAS,EAAEC,KAAK,EAAEC,MAAM,QAAQ,0BAA0B;AACnE,SAASC,QAAQ,EAAEC,eAAe,EAAEC,SAAS,EAAEC,eAAe,QAAQ,kCAAkC;AACxG,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,wBAAwB,QAAQ,gBAAa;AACtD,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SACEC,cAAc,EACdC,oBAAoB,EACpBC,gBAAgB,EAChBC,KAAK,EACLC,aAAa,EACbC,iBAAiB,EACjBC,kBAAkB,EAClBC,IAAI,QACC,4BAA4B;AACnC,SAASC,4BAA4BC,eAAe,QAAQ,wBAAwB;AACpF,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,mBAAmB,QAAQ,qCAAkC;AAKtE,SAASC,kBAAkBC,IAAU,EAAEC,OAAc,EAAEC,OAAc;IACnE,OAAO,AAA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BvC,MAAM8C,SAAS,CAAC;QACd,IAAIP,QAAQ,CAACD,MAAMsE,QAAQ,IAAIZ,SAAS7D,OAAO,EAAE;YAC/C6D,SAAS7D,OAAO,CAACF,KAAK;QACxB;IACF,GAAG;QAACsC;QAAkBhC;QAAMD,MAAMsE,QAAQ;KAAC;IAC3C,4CAA4C;IAC5C,MAAMqD,oBAAoB/I,KAAKgH,MAAM,CAAC5F,MAAM0D,QAAQ,EAAE;QACpDoC,cAAc;YACZhE;YACA8F,cAAclE;YACd1B;YACAE;YACAE;YACAE;YACAC;YACAI;YACArD;YACAD;YACA4D;YACAC;YACAC;YACAC;YACAC;YACAC;YACAxC,OAAOC,gBAAgByB;QACzB;QACAuD,aAAajI;IACf;IACA6J,kBAAkBE,SAAS,GAAGtJ,iBAAiBF,eAAesJ,kBAAkBE,SAAS,EAAEnD;IAC3FiD,kBAAkB9G,YAAY,GAAGtC,iBAAiBF,eAAesJ,kBAAkB9G,YAAY,EAAE6D;IACjG,MAAMpE,QAAyB;QAC7BgE,UAAU,CAAC,CAACtE,MAAMsE,QAAQ;QAC1B5B;QACAoF,YAAY;YAAEjC,MAAMzH;YAAOsF,UAAU5F;YAA8CsJ,cAAc;QAAM;QACvG1D,UAAUiE;QACV/E;QACAiD;QACAuB;IACF;IAEA9G,MAAMuF,IAAI,CAAC/E,KAAK,GAAGG;IAEnB,OAAOX;AACT,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/DatePicker/useDatePicker.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ArrowDown, Enter, Escape } from '@fluentui/keyboard-keys';\nimport { Calendar, compareDatePart, DayOfWeek, FirstWeekOfYear } from '@fluentui/react-calendar-compat';\nimport { CalendarMonthRegular } from '@fluentui/react-icons';\nimport { defaultDatePickerStrings } from './defaults';\nimport { Input } from '@fluentui/react-input';\nimport {\n mergeCallbacks,\n useControllableState,\n useEventCallback,\n useId,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n slot,\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 '@fluentui/react-calendar-compat';\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 = React.useCallback(() => {\n inputRef.current?.focus?.();\n }, []);\n\n const preventNextFocusOpeningPicker = React.useCallback(() => {\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 // eslint-disable-next-line react-hooks/set-state-in-effect\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<HTMLInputElement>): 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: initialPickerDateProp,\n inlinePopup = false,\n isMonthPickerVisible = true,\n maxDate,\n minDate,\n mountNode,\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\n const initialPickerDate = React.useMemo(() => initialPickerDateProp ?? new Date(), [initialPickerDateProp]);\n\n const calendar = React.useRef<ICalendar | null>(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 defaultId = useId('datePicker-input');\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 if (!open && !props.disabled) {\n focus();\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [focus, onOpenChange, props.disabled, 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 (_: 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 if (open) {\n ev.stopPropagation();\n ev.preventDefault();\n calendarDismissed();\n }\n break;\n\n case ArrowDown:\n ev.preventDefault();\n if (!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 // eslint-disable-next-line react-hooks/immutability\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.preventDefault();\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\n const inputRoot = slot.always(props.root, {\n defaultProps: {\n ref: triggerWrapperRef,\n },\n elementType: 'span',\n });\n inputRoot.ref = useMergedRefs(inputRoot.ref, triggerWrapperRef);\n\n const input = slot.always(props.input, {\n elementType: 'input',\n });\n input.ref = useMergedRefs(input.ref, ref, rootRef);\n\n // Props to create a semantic but non-focusable button on the element with the click-to-open handler\n // Used for voice control and touch screen reader accessibility\n const inputLabelledBy = props['aria-labelledby'];\n const inputId = props.id ?? defaultId;\n const iconA11yProps = React.useMemo(\n () => ({\n role: 'button',\n 'aria-expanded': open,\n 'aria-labelledby': inputLabelledBy ?? inputId,\n }),\n [open, inputLabelledBy, inputId],\n );\n\n const contentAfter = slot.always(props.contentAfter || {}, {\n defaultProps: {\n children: <CalendarMonthRegular />,\n ...iconA11yProps,\n },\n elementType: 'span',\n });\n contentAfter.onClick = useEventCallback(mergeCallbacks(contentAfter.onClick, onIconClick));\n\n const root = slot.always(restOfProps, {\n defaultProps: {\n appearance: inputAppearance,\n 'aria-controls': open ? popupSurfaceId : undefined,\n 'aria-expanded': open,\n 'aria-haspopup': 'dialog',\n readOnly: !allowTextInput,\n role: 'combobox',\n id: inputId,\n },\n elementType: Input,\n });\n root.root = inputRoot;\n root.input = input;\n root.contentAfter = contentAfter;\n root.onChange = useEventCallback(mergeCallbacks(root.onChange, onInputChange));\n root.onBlur = useEventCallback(mergeCallbacks(root.onBlur, onInputBlur));\n root.onKeyDown = useEventCallback(mergeCallbacks(root.onKeyDown, onInputKeyDown));\n root.onFocus = useEventCallback(mergeCallbacks(root.onFocus, onInputFocus));\n root.onClick = useEventCallback(mergeCallbacks(root.onClick, onInputClick));\n\n const { modalAttributes } = useModalAttributes({ trapFocus: true, alwaysFocusable: true, legacyTrapFocus: true });\n const popupSurface = open\n ? slot.optional(props.popupSurface, {\n renderByDefault: true,\n defaultProps: {\n 'aria-label': 'Calendar',\n 'aria-modal': true,\n id: popupSurfaceId,\n role: 'dialog',\n ref: popupRef,\n ...modalAttributes,\n },\n elementType: 'div',\n })\n : undefined;\n const { targetDocument } = useFluent();\n useOnClickOutside({\n element: targetDocument,\n callback: ev => dismissDatePickerPopup(),\n refs: [triggerWrapperRef, popupRef],\n disabled: !open,\n });\n useOnScrollOutside({\n element: targetDocument,\n callback: ev => dismissDatePickerPopup(),\n refs: [triggerWrapperRef, popupRef],\n disabled: !open,\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 // eslint-disable-next-line react-hooks/refs\n const calendarShorthand = slot.always(props.calendar, {\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 elementType: Calendar,\n });\n calendarShorthand.onDismiss = useEventCallback(mergeCallbacks(calendarShorthand.onDismiss, calendarDismissed));\n calendarShorthand.onSelectDate = useEventCallback(mergeCallbacks(calendarShorthand.onSelectDate, calendarDismissed));\n const state: DatePickerState = {\n disabled: !!props.disabled,\n inlinePopup,\n components: { root: Input, calendar: Calendar as React.FC<Partial<CalendarProps>>, popupSurface: 'div' },\n calendar: calendarShorthand,\n mountNode,\n root,\n popupSurface,\n };\n\n state.root.value = formattedDate;\n\n return state;\n};\n"],"names":["React","ArrowDown","Enter","Escape","Calendar","compareDatePart","DayOfWeek","FirstWeekOfYear","CalendarMonthRegular","defaultDatePickerStrings","Input","mergeCallbacks","useControllableState","useEventCallback","useId","useMergedRefs","useOnClickOutside","useOnScrollOutside","slot","useFieldContext_unstable","useFieldContext","useFluent_unstable","useFluent","useModalAttributes","usePopupPositioning","isDateOutOfBounds","date","minDate","maxDate","useFocusLogic","inputRef","useRef","preventFocusOpeningPicker","focus","useCallback","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","initialPickerDateProp","inlinePopup","isMonthPickerVisible","mountNode","onUserSelectDate","openOnClick","onValidationResult","parseDateFromString","showCloseButton","showGoToToday","showMonthPickerAsOverlay","showWeekNumbers","strings","today","underlined","restOfProps","useMemo","calendar","rootRef","setOpenState","fieldContext","required","defaultId","popupSurfaceId","validateTextInput","error","isNaN","getTime","newState","disabled","dismissDatePickerPopup","newlySelectedDate","showDatePickerPopup","calendarDismissed","onInputChange","_","data","newValue","onInputBlur","onInputKeyDown","ev","key","preventDefault","stopPropagation","onInputFocus","onInputClick","onIconClick","inputAppearance","triggerWrapperRef","popupRef","inputRoot","always","root","defaultProps","elementType","input","inputLabelledBy","inputId","id","iconA11yProps","role","contentAfter","children","onClick","appearance","undefined","readOnly","onChange","onBlur","onKeyDown","onFocus","modalAttributes","trapFocus","alwaysFocusable","legacyTrapFocus","popupSurface","optional","renderByDefault","targetDocument","element","callback","refs","calendarShorthand","componentRef","onDismiss","components"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,SAAS,EAAEC,KAAK,EAAEC,MAAM,QAAQ,0BAA0B;AACnE,SAASC,QAAQ,EAAEC,eAAe,EAAEC,SAAS,EAAEC,eAAe,QAAQ,kCAAkC;AACxG,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,wBAAwB,QAAQ,gBAAa;AACtD,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SACEC,cAAc,EACdC,oBAAoB,EACpBC,gBAAgB,EAChBC,KAAK,EACLC,aAAa,EACbC,iBAAiB,EACjBC,kBAAkB,EAClBC,IAAI,QACC,4BAA4B;AACnC,SAASC,4BAA4BC,eAAe,QAAQ,wBAAwB;AACpF,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,mBAAmB,QAAQ,qCAAkC;AAKtE,SAASC,kBAAkBC,IAAU,EAAEC,OAAc,EAAEC,OAAc;IACnE,OAAO,AAAC,CAAC,CAACD,WAAWtB,gBAAgBsB,SAAUD,QAAQ,KAAO,CAAC,CAACE,WAAWvB,gBAAgBuB,SAAUF,QAAQ;AAC/G;AAEA,SAASG;IACP,MAAMC,WAAW9B,MAAM+B,MAAM,CAAmB;IAChD,MAAMC,4BAA4BhC,MAAM+B,MAAM,CAAC;IAE/C,MAAME,QAAQjC,MAAMkC,WAAW,CAAC;YAC9BJ,yBAAAA;SAAAA,oBAA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ACd1B;YACAE;YACAE;YACAE;YACAC;YACAI;YACArD;YACAD;YACA4D;YACAC;YACAC;YACAC;YACAC;YACAC;YACAxC,OAAOC,gBAAgByB;QACzB;QACAuD,aAAajI;IACf;IACA6J,kBAAkBE,SAAS,GAAGtJ,iBAAiBF,eAAesJ,kBAAkBE,SAAS,EAAEnD;IAC3FiD,kBAAkB9G,YAAY,GAAGtC,iBAAiBF,eAAesJ,kBAAkB9G,YAAY,EAAE6D;IACjG,MAAMpE,QAAyB;QAC7BgE,UAAU,CAAC,CAACtE,MAAMsE,QAAQ;QAC1B5B;QACAoF,YAAY;YAAEjC,MAAMzH;YAAOsF,UAAU5F;YAA8CsJ,cAAc;QAAM;QACvG1D,UAAUiE;QACV/E;QACAiD;QACAuB;IACF;IAEA9G,MAAMuF,IAAI,CAAC/E,KAAK,GAAGG;IAEnB,OAAOX;AACT,EAAE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import styles from "./DatePicker.module.css";
|
|
3
|
+
export const datePickerClassNames = {
|
|
4
|
+
root: 'fui-DatePicker',
|
|
5
|
+
calendar: 'fui-DatePicker__calendar',
|
|
6
|
+
popupSurface: 'fui-DatePicker__popupSurface'
|
|
7
|
+
};
|
|
8
|
+
export const useDatePickerStyles_unstable = (state)=>{
|
|
9
|
+
state.root.className = clsx(datePickerClassNames.root, styles.root, state.disabled && styles.disabled, state.root.className);
|
|
10
|
+
if (state.popupSurface) {
|
|
11
|
+
state.popupSurface.className = clsx(datePickerClassNames.popupSurface, styles.popupSurface, state.inlinePopup && styles.inline, state.popupSurface.className);
|
|
12
|
+
}
|
|
13
|
+
state.calendar.className = clsx(datePickerClassNames.calendar, state.calendar.className);
|
|
14
|
+
return state;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/DatePicker/useDatePickerStyles.styles.css.ts"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { DatePickerSlots, DatePickerState } from './DatePicker.types';\nimport styles from './DatePicker.module.css';\n\nexport const datePickerClassNames: SlotClassNames<DatePickerSlots> = {\n root: 'fui-DatePicker',\n calendar: 'fui-DatePicker__calendar',\n popupSurface: 'fui-DatePicker__popupSurface',\n};\n\nexport const useDatePickerStyles_unstable = (state: DatePickerState): DatePickerState => {\n state.root.className = clsx(\n datePickerClassNames.root,\n styles.root,\n state.disabled && styles.disabled,\n state.root.className,\n );\n if (state.popupSurface) {\n state.popupSurface.className = clsx(\n datePickerClassNames.popupSurface,\n styles.popupSurface,\n state.inlinePopup && styles.inline,\n state.popupSurface.className,\n );\n }\n state.calendar.className = clsx(datePickerClassNames.calendar, state.calendar.className);\n return state;\n};\n"],"names":["clsx","styles","datePickerClassNames","root","calendar","popupSurface","useDatePickerStyles_unstable","state","className","disabled","inlinePopup","inline"],"mappings":"AAAA,SAASA,IAAI,QAAQ,OAAO;AAG5B,OAAOC,YAAY,0BAA0B;AAE7C,OAAO,MAAMC,uBAAwD;IACnEC,MAAM;IACNC,UAAU;IACVC,cAAc;AAChB,EAAE;AAEF,OAAO,MAAMC,+BAA+B,CAACC;IAC3CA,MAAMJ,IAAI,CAACK,SAAS,GAAGR,KACrBE,qBAAqBC,IAAI,EACzBF,OAAOE,IAAI,EACXI,MAAME,QAAQ,IAAIR,OAAOQ,QAAQ,EACjCF,MAAMJ,IAAI,CAACK,SAAS;IAEtB,IAAID,MAAMF,YAAY,EAAE;QACtBE,MAAMF,YAAY,CAACG,SAAS,GAAGR,KAC7BE,qBAAqBG,YAAY,EACjCJ,OAAOI,YAAY,EACnBE,MAAMG,WAAW,IAAIT,OAAOU,MAAM,EAClCJ,MAAMF,YAAY,CAACG,SAAS;IAEhC;IACAD,MAAMH,QAAQ,CAACI,SAAS,GAAGR,KAAKE,qBAAqBE,QAAQ,EAAEG,MAAMH,QAAQ,CAACI,SAAS;IACvF,OAAOD;AACT,EAAE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import styles from "./DatePicker.module.css";
|
|
3
|
+
export const datePickerClassNames = {
|
|
4
|
+
root: 'fui-DatePicker',
|
|
5
|
+
calendar: 'fui-DatePicker__calendar',
|
|
6
|
+
popupSurface: 'fui-DatePicker__popupSurface'
|
|
7
|
+
};
|
|
8
|
+
export const useDatePickerStyles_unstable = (state)=>{
|
|
9
|
+
state.root.className = clsx(datePickerClassNames.root, styles.root, state.disabled && styles.disabled, state.root.className);
|
|
10
|
+
if (state.popupSurface) {
|
|
11
|
+
state.popupSurface.className = clsx(datePickerClassNames.popupSurface, styles.popupSurface, state.inlinePopup && styles.inline, state.popupSurface.className);
|
|
12
|
+
}
|
|
13
|
+
state.calendar.className = clsx(datePickerClassNames.calendar, state.calendar.className);
|
|
14
|
+
return state;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/DatePicker/useDatePickerStyles.styles.css.ts"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { DatePickerSlots, DatePickerState } from './DatePicker.types';\nimport styles from './DatePicker.module.css';\n\nexport const datePickerClassNames: SlotClassNames<DatePickerSlots> = {\n root: 'fui-DatePicker',\n calendar: 'fui-DatePicker__calendar',\n popupSurface: 'fui-DatePicker__popupSurface',\n};\n\nexport const useDatePickerStyles_unstable = (state: DatePickerState): DatePickerState => {\n state.root.className = clsx(\n datePickerClassNames.root,\n styles.root,\n state.disabled && styles.disabled,\n state.root.className,\n );\n if (state.popupSurface) {\n state.popupSurface.className = clsx(\n datePickerClassNames.popupSurface,\n styles.popupSurface,\n state.inlinePopup && styles.inline,\n state.popupSurface.className,\n );\n }\n state.calendar.className = clsx(datePickerClassNames.calendar, state.calendar.className);\n return state;\n};\n"],"names":["clsx","styles","datePickerClassNames","root","calendar","popupSurface","useDatePickerStyles_unstable","state","className","disabled","inlinePopup","inline"],"mappings":"AAAA,SAASA,IAAI,QAAQ,OAAO;AAG5B,OAAOC,YAAY,0BAA0B;AAE7C,OAAO,MAAMC,uBAAwD;IACnEC,MAAM;IACNC,UAAU;IACVC,cAAc;AAChB,EAAE;AAEF,OAAO,MAAMC,+BAA+B,CAACC;IAC3CA,MAAMJ,IAAI,CAACK,SAAS,GAAGR,KACrBE,qBAAqBC,IAAI,EACzBF,OAAOE,IAAI,EACXI,MAAME,QAAQ,IAAIR,OAAOQ,QAAQ,EACjCF,MAAMJ,IAAI,CAACK,SAAS;IAEtB,IAAID,MAAMF,YAAY,EAAE;QACtBE,MAAMF,YAAY,CAACG,SAAS,GAAGR,KAC7BE,qBAAqBG,YAAY,EACjCJ,OAAOI,YAAY,EACnBE,MAAMG,WAAW,IAAIT,OAAOU,MAAM,EAClCJ,MAAMF,YAAY,CAACG,SAAS;IAEhC;IACAD,MAAMH,QAAQ,CAACI,SAAS,GAAGR,KAAKE,qBAAqBE,QAAQ,EAAEG,MAAMH,QAAQ,CAACI,SAAS;IACvF,OAAOD;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/DatePicker/useDatePickerStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { DatePickerSlots, DatePickerState } from './DatePicker.types';\n\nexport const datePickerClassNames: SlotClassNames<DatePickerSlots> = {\n root: 'fui-DatePicker',\n calendar: 'fui-DatePicker__calendar',\n popupSurface: 'fui-DatePicker__popupSurface',\n};\n\nconst useStyles = makeStyles({\n base: {\n position: 'relative',\n cursor: 'pointer',\n '& input': {\n cursor: 'pointer',\n },\n },\n disabled: {\n cursor: 'default',\n '& input': {\n cursor: 'default',\n },\n },\n inline: {\n // When rendering inline, the popupSurface will be rendered under relatively positioned elements such as Input.\n // This is due to the surface being positioned as absolute, therefore zIndex: 1 ensures that won't happen.\n zIndex: 1,\n },\n});\n\nconst usePopupSurfaceClassName = makeResetStyles({\n backgroundColor: tokens.colorNeutralBackground1,\n boxShadow: tokens.shadow16,\n borderRadius: tokens.borderRadiusMedium,\n borderWidth: '1px',\n borderStyle: 'solid',\n borderColor: tokens.colorTransparentStroke,\n display: 'inline-flex',\n color: tokens.colorNeutralForeground1,\n ...typographyStyles.body1,\n});\n\n/**\n * Apply styling to the DatePicker slots based on the state\n */\nexport const useDatePickerStyles_unstable = (state: DatePickerState): DatePickerState => {\n const styles = useStyles();\n const popupSurfaceClassName = usePopupSurfaceClassName();\n const { disabled, inlinePopup } = state;\n\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(\n datePickerClassNames.root,\n styles.base,\n disabled && styles.disabled,\n state.root.className,\n );\n\n if (state.popupSurface) {\n // eslint-disable-next-line react-hooks/immutability\n state.popupSurface.className = mergeClasses(\n datePickerClassNames.popupSurface,\n popupSurfaceClassName,\n state.popupSurface.className,\n inlinePopup && styles.inline,\n );\n }\n\n // eslint-disable-next-line react-hooks/immutability\n state.calendar.className = mergeClasses(datePickerClassNames.calendar, state.calendar.className);\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","tokens","typographyStyles","datePickerClassNames","root","calendar","popupSurface","useStyles","base","position","cursor","disabled","inline","zIndex","usePopupSurfaceClassName","backgroundColor","colorNeutralBackground1","boxShadow","shadow16","borderRadius","borderRadiusMedium","borderWidth","borderStyle","borderColor","colorTransparentStroke","display","color","colorNeutralForeground1","body1","useDatePickerStyles_unstable","state","styles","popupSurfaceClassName","inlinePopup","className"],"mappings":"AAAA;AAEA,SAASA,eAAe,EAAEC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC3E,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,wBAAwB;AAIjE,OAAO,MAAMC,uBAAwD;IACnEC,MAAM;IACNC,UAAU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{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/usePopupPositioning.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { resolvePositioningShorthand, usePositioning } from '@fluentui/react-positioning';\nimport type { DatePickerProps } from '../DatePicker';\n\n/**\n * Hook used to handle positioning of the popup.\n *\n * @param props - DatePicker props\n * @returns tuple of trigger and popup refs\n * @internal\n */\nexport function usePopupPositioning(\n props: DatePickerProps,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n): [triggerRef: React.MutableRefObject<HTMLElement | null>, popupRef: React.MutableRefObject<HTMLDivElement | null>] {\n const { positioning } = props;\n\n const popupOptions = {\n position: 'below' as const,\n align: 'start' as const,\n ...resolvePositioningShorthand(positioning),\n };\n\n const { targetRef, containerRef } = usePositioning(popupOptions);\n\n return [targetRef, containerRef];\n}\n"],"names":["resolvePositioningShorthand","usePositioning","usePopupPositioning","props","positioning","popupOptions","position","align","targetRef","containerRef"],"mappings":"AAAA;AAGA,SAASA,2BAA2B,EAAEC,cAAc,QAAQ,8BAA8B;AAG1F;;;;;;CAMC,GACD,OAAO,SAASC,oBACdC,KAAsB;IAGtB,MAAM,EAAEC,WAAW,EAAE,GAAGD;IAExB,MAAME,eAAe;QACnBC,UAAU;QACVC,OAAO;QACP,GAAGP,4BAA4BI,YAAY;IAC7C;IAEA,MAAM,EAAEI,SAAS,EAAEC,YAAY,EAAE,GAAGR,eAAeI;IAEnD,OAAO;QAACG;QAAWC;KAAa;AAClC"}
|
|
@@ -5,29 +5,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
DatePicker
|
|
12
|
+
get DatePicker () {
|
|
13
13
|
return _index.DatePicker;
|
|
14
14
|
},
|
|
15
|
-
datePickerClassNames
|
|
15
|
+
get datePickerClassNames () {
|
|
16
16
|
return _index.datePickerClassNames;
|
|
17
17
|
},
|
|
18
|
-
defaultDatePickerErrorStrings
|
|
18
|
+
get defaultDatePickerErrorStrings () {
|
|
19
19
|
return _index.defaultDatePickerErrorStrings;
|
|
20
20
|
},
|
|
21
|
-
defaultDatePickerStrings
|
|
21
|
+
get defaultDatePickerStrings () {
|
|
22
22
|
return _index.defaultDatePickerStrings;
|
|
23
23
|
},
|
|
24
|
-
renderDatePicker_unstable
|
|
24
|
+
get renderDatePicker_unstable () {
|
|
25
25
|
return _index.renderDatePicker_unstable;
|
|
26
26
|
},
|
|
27
|
-
useDatePickerStyles_unstable
|
|
27
|
+
get useDatePickerStyles_unstable () {
|
|
28
28
|
return _index.useDatePickerStyles_unstable;
|
|
29
29
|
},
|
|
30
|
-
useDatePicker_unstable
|
|
30
|
+
get useDatePicker_unstable () {
|
|
31
31
|
return _index.useDatePicker_unstable;
|
|
32
32
|
}
|
|
33
33
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["'use client';\n\nimport * 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"],"mappings":"AAAA;;;;;;;;;;;;iEAEuB,QAAQ;kCACW,wBAAqB;+BACxB,qBAAkB;2CACZ,kCAA+B;AAIrE,MAAMI,aAAAA,WAAAA,GAAmDJ,OAAMK,UAAU,CAAC,CAACC,OAAOC;IACvF,MAAMC,YAAQN,qCAAAA,EAAuBI,OAAOC;QAE5CJ,uDAAAA,EAA6BK;IAC7B,WAAOP,2CAAAA,EAA0BO;AACnC,GAA2C;AAC3CJ,WAAWK,WAAW,GAAG"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
@layer fluentui {
|
|
2
|
+
.root {
|
|
3
|
+
position: relative;
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
}
|
|
6
|
+
.root input {
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
}
|
|
9
|
+
.disabled {
|
|
10
|
+
cursor: default;
|
|
11
|
+
}
|
|
12
|
+
.disabled input {
|
|
13
|
+
cursor: default;
|
|
14
|
+
}
|
|
15
|
+
.inline {
|
|
16
|
+
z-index: 1;
|
|
17
|
+
}
|
|
18
|
+
.popupSurface {
|
|
19
|
+
background-color: var(--colorNeutralBackground1);
|
|
20
|
+
box-shadow: var(--shadow16);
|
|
21
|
+
border-radius: var(--borderRadiusMedium);
|
|
22
|
+
border-width: 1px;
|
|
23
|
+
border-style: solid;
|
|
24
|
+
border-color: var(--colorTransparentStroke);
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
color: var(--colorNeutralForeground1);
|
|
27
|
+
font-family: var(--fontFamilyBase);
|
|
28
|
+
font-size: var(--fontSizeBase300);
|
|
29
|
+
font-weight: var(--fontWeightRegular);
|
|
30
|
+
line-height: var(--lineHeightBase300);
|
|
31
|
+
}
|
|
32
|
+
}
|