@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
|
@@ -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"}
|
|
@@ -5,14 +5,14 @@ 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
|
-
defaultDatePickerErrorStrings
|
|
12
|
+
get defaultDatePickerErrorStrings () {
|
|
13
13
|
return defaultDatePickerErrorStrings;
|
|
14
14
|
},
|
|
15
|
-
defaultDatePickerStrings
|
|
15
|
+
get defaultDatePickerStrings () {
|
|
16
16
|
return defaultDatePickerStrings;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -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":";;;;;;;;;;;;;;;;;;qCAAuC,kCAAkC;AAIlE,MAAMC,2BAA4C;IACvD,GAAGD,2CAAsB;IACzBE,oBAAoB;IACpBC,oBAAoB;IACpBC,mBAAmB;IACnBC,mBAAmB;IACnBC,sBAAsB;AACxB,EAAE;AAEK,MAAMC,gCAAqE;IAChF,iBAAiB;IACjB,iBAAiB;IACjB,kBAAkB;AACpB,EAAE"}
|
|
@@ -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 _DatePicker.DatePicker;
|
|
14
14
|
},
|
|
15
|
-
datePickerClassNames
|
|
15
|
+
get datePickerClassNames () {
|
|
16
16
|
return _useDatePickerStylesstyles.datePickerClassNames;
|
|
17
17
|
},
|
|
18
|
-
defaultDatePickerErrorStrings
|
|
18
|
+
get defaultDatePickerErrorStrings () {
|
|
19
19
|
return _defaults.defaultDatePickerErrorStrings;
|
|
20
20
|
},
|
|
21
|
-
defaultDatePickerStrings
|
|
21
|
+
get defaultDatePickerStrings () {
|
|
22
22
|
return _defaults.defaultDatePickerStrings;
|
|
23
23
|
},
|
|
24
|
-
renderDatePicker_unstable
|
|
24
|
+
get renderDatePicker_unstable () {
|
|
25
25
|
return _renderDatePicker.renderDatePicker_unstable;
|
|
26
26
|
},
|
|
27
|
-
useDatePickerStyles_unstable
|
|
27
|
+
get useDatePickerStyles_unstable () {
|
|
28
28
|
return _useDatePickerStylesstyles.useDatePickerStyles_unstable;
|
|
29
29
|
},
|
|
30
|
-
useDatePicker_unstable
|
|
30
|
+
get useDatePicker_unstable () {
|
|
31
31
|
return _useDatePicker.useDatePicker_unstable;
|
|
32
32
|
}
|
|
33
33
|
});
|
|
@@ -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":";;;;;;;;;;;;eACSE,sBAAU;;;eAUVG,+CAAoB;;;eAXpBL,uCAA6B;;;eAAEC,kCAAwB;;;eASvDE,2CAAyB;;;eAEHG,uDAA4B;;;eADlDF,qCAAsB;;;0BAVyC,gBAAa;4BAC1D,kBAAe;kCAQA,wBAAqB;+BACxB,qBAAkB;2CACU,kCAA+B"}
|
|
@@ -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":";;;;+BAWaE;;;;;;;6BAXb,CAA0B,GAC1B,iDAAiD,GAEjD,SAASF,MAAM,QAAQ,yBAAyB;gCACpB,4BAA4B;AAOjD,kCAAkC,CAACG;QACxCF,2BAAAA,EAA6BE;IAC7B,MAAM,EAAEC,WAAW,EAAE,GAAGD;IAExB,OAAA,WAAA,OACE,gBAAA,EAAA,oBAAA,EAAA;;8BACE,eAAA,EAACA,MAAME,IAAI,EAAA,CAAA;YACVF,MAAMG,YAAY,IAChBF,CAAAA,cAAAA,WAAAA,OACC,eAAA,EAACD,MAAMG,YAAY,EAAA;0BACjB,WAAA,GAAA,mBAAA,EAACH,MAAMI,QAAQ,EAAA,CAAA;mCAGjB,eAAA,EAACP,mBAAAA,EAAAA;gBAAOQ,WAAWL,MAAMK,SAAS;0BAChC,WAAA,OAAA,eAAA,EAACL,MAAMG,YAAY,EAAA;8BACjB,WAAA,OAAA,eAAA,EAACH,MAAMI,QAAQ,EAAA,CAAA;;eAGrB;;;AAGR,EAAE"}
|
|
@@ -95,6 +95,7 @@ const defaultParseDateFromString = (dateStr)=>{
|
|
|
95
95
|
return date ? new Date(date) : null;
|
|
96
96
|
};
|
|
97
97
|
const useDatePicker_unstable = (props, ref)=>{
|
|
98
|
+
var _ref, _props_id;
|
|
98
99
|
const { allowTextInput = false, allFocusable = false, borderless = false, dateTimeFormatter, defaultOpen = false, disableAutoFocus = true, firstDayOfWeek = _reactcalendarcompat.DayOfWeek.Sunday, firstWeekOfYear = _reactcalendarcompat.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 = _defaults.defaultDatePickerStrings, today, underlined = false, value, ...restOfProps } = props;
|
|
99
100
|
const initialPickerDate = _react.useMemo(()=>initialPickerDateProp !== null && initialPickerDateProp !== void 0 ? initialPickerDateProp : new Date(), [
|
|
100
101
|
initialPickerDateProp
|
|
@@ -108,8 +109,7 @@ const useDatePicker_unstable = (props, ref)=>{
|
|
|
108
109
|
});
|
|
109
110
|
const [open, setOpenState] = usePopupVisibility(props);
|
|
110
111
|
const fieldContext = (0, _reactfield.useFieldContext_unstable)();
|
|
111
|
-
|
|
112
|
-
const required = (_fieldContext_required = fieldContext === null || fieldContext === void 0 ? void 0 : fieldContext.required) !== null && _fieldContext_required !== void 0 ? _fieldContext_required : props.required;
|
|
112
|
+
const required = (_ref = fieldContext === null || fieldContext === void 0 ? void 0 : fieldContext.required) !== null && _ref !== void 0 ? _ref : props.required;
|
|
113
113
|
const defaultId = (0, _reactutilities.useId)('datePicker-input');
|
|
114
114
|
const popupSurfaceId = (0, _reactutilities.useId)('datePicker-popupSurface');
|
|
115
115
|
const validateTextInput = _react.useCallback((date = null)=>{
|
|
@@ -325,7 +325,6 @@ const useDatePicker_unstable = (props, ref)=>{
|
|
|
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;;;;;;;;eAyGakE;;;;iEAvGU,QAAQ;8BACU,0BAA0B;qCACG,kCAAkC;4BACnE,wBAAwB;0BACpB,gBAAa;4BAChC,wBAAwB;gCAUvC,4BAA4B;4BACyB,wBAAwB;qCACpC,kCAAkC;8BAC/C,0BAA0B;qCACzB,qCAAkC;AAKtE,SAASzC,kBAAkBC,IAAU,EAAEC,OAAc,EAAEC,OAAc;IACnE,OAAQ,CAAC,CAACD,eAAWtB,oCAAAA,EAAgBsB,SAAUD,QAAQ,KAAO,CAAC,CAACE,eAAWvB,oCAAAA,EAAgBuB,SAAUF,QAAQ;AAC/G;AAEA,SAASG;IACP,MAAMC,WAAW9B,OAAM+B,MAAM,CAAmB;IAChD,MAAMC,4BAA4BhC,OAAM+B,MAAM,CAAC;IAE/C,MAAME,QAAQjC,OAAMkC,WAAW,CAAC;YAC9BJ,yBAAAA;SAAAA,oBAAAA,SAASK,OAAAA,AAAO,MAAA,QAAhBL,sBAAAA,KAAAA,IAAAA,KAAAA,IA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ACAuB;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;;;;;;;;eAyGakE;;;;iEAvGU,QAAQ;8BACU,0BAA0B;qCACG,kCAAkC;4BACnE,wBAAwB;0BACpB,gBAAa;4BAChC,wBAAwB;gCAUvC,4BAA4B;4BACyB,wBAAwB;qCACpC,kCAAkC;8BAC/C,0BAA0B;qCACzB,qCAAkC;AAKtE,SAASzC,kBAAkBC,IAAU,EAAEC,OAAc,EAAEC,OAAc;IACnE,OAAQ,CAAC,CAACD,eAAWtB,oCAAAA,EAAgBsB,SAAUD,QAAQ,KAAO,CAAC,CAACE,eAAWvB,oCAAAA,EAAgBuB,SAAUF,QAAQ;AAC/G;AAEA,SAASG;IACP,MAAMC,WAAW9B,OAAM+B,MAAM,CAAmB;IAChD,MAAMC,4BAA4BhC,O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,CAACtE,MAAMsE,QAAQ;QAC1B5B;QACAoF,YAAY;YAAEjC,MAAMzH,iBAAAA;YAAOsF,UAAU5F,6BAAAA;YAA8CsJ,cAAc;QAAM;QACvG1D,UAAUiE;QACV/E;QACAiD;QACAuB;IACF;IAEA9G,MAAMuF,IAAI,CAAC/E,KAAK,GAAGG;IAEnB,OAAOX;AACT,EAAE"}
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
function _export(target, all) {
|
|
7
7
|
for(var name in all)Object.defineProperty(target, name, {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: all
|
|
9
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
-
datePickerClassNames
|
|
13
|
+
get datePickerClassNames () {
|
|
14
14
|
return datePickerClassNames;
|
|
15
15
|
},
|
|
16
|
-
useDatePickerStyles_unstable
|
|
16
|
+
get useDatePickerStyles_unstable () {
|
|
17
17
|
return useDatePickerStyles_unstable;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useDatePickerStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeResetStyles, makeStyles, mergeClasses } from \"@griffel/react\";\nimport { tokens, typographyStyles } from \"@fluentui/react-theme\";\nexport const datePickerClassNames = {\n root: 'fui-DatePicker',\n calendar: 'fui-DatePicker__calendar',\n popupSurface: 'fui-DatePicker__popupSurface'\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});\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 * Apply styling to the DatePicker slots based on the state\n */ export const useDatePickerStyles_unstable = (state)=>{\n const styles = useStyles();\n const popupSurfaceClassName = usePopupSurfaceClassName();\n const { disabled, inlinePopup } = state;\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(datePickerClassNames.root, styles.base, disabled && styles.disabled, state.root.className);\n if (state.popupSurface) {\n // eslint-disable-next-line react-hooks/immutability\n state.popupSurface.className = mergeClasses(datePickerClassNames.popupSurface, popupSurfaceClassName, state.popupSurface.className, inlinePopup && styles.inline);\n }\n // eslint-disable-next-line react-hooks/immutability\n state.calendar.className = mergeClasses(datePickerClassNames.calendar, state.calendar.className);\n return state;\n};\n"],"names":["__resetStyles","__styles","mergeClasses","tokens","typographyStyles","datePickerClassNames","root","calendar","popupSurface","useStyles","base","qhf8xq","Bceei9c","xfaavh","disabled","inline","Bj3rh1h","d","usePopupSurfaceClassName","useDatePickerStyles_unstable","state","styles","popupSurfaceClassName","inlinePopup","className"],"mappings":"AAAA,YAAY;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["useDatePickerStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeResetStyles, makeStyles, mergeClasses } from \"@griffel/react\";\nimport { tokens, typographyStyles } from \"@fluentui/react-theme\";\nexport const datePickerClassNames = {\n root: 'fui-DatePicker',\n calendar: 'fui-DatePicker__calendar',\n popupSurface: 'fui-DatePicker__popupSurface'\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});\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 * Apply styling to the DatePicker slots based on the state\n */ export const useDatePickerStyles_unstable = (state)=>{\n const styles = useStyles();\n const popupSurfaceClassName = usePopupSurfaceClassName();\n const { disabled, inlinePopup } = state;\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(datePickerClassNames.root, styles.base, disabled && styles.disabled, state.root.className);\n if (state.popupSurface) {\n // eslint-disable-next-line react-hooks/immutability\n state.popupSurface.className = mergeClasses(datePickerClassNames.popupSurface, popupSurfaceClassName, state.popupSurface.className, inlinePopup && styles.inline);\n }\n // eslint-disable-next-line react-hooks/immutability\n state.calendar.className = mergeClasses(datePickerClassNames.calendar, state.calendar.className);\n return state;\n};\n"],"names":["__resetStyles","__styles","mergeClasses","tokens","typographyStyles","datePickerClassNames","root","calendar","popupSurface","useStyles","base","qhf8xq","Bceei9c","xfaavh","disabled","inline","Bj3rh1h","d","usePopupSurfaceClassName","useDatePickerStyles_unstable","state","styles","popupSurfaceClassName","inlinePopup","className"],"mappings":"AAAA,YAAY;;;;;;;;;;;;QAGCK,oBAAoB;;;;eAsChBc,4BAA4B;;;uBAxCa,gBAAgB;AAEnE,6BAA6B;IAChCb,IAAI,EAAE,gBAAgB;IACtBC,QAAQ,EAAE,0BAA0B;IACpCC,YAAY,EAAE;AAClB,CAAC;AACD,MAAMC,SAAS,GAAA,WAAA,OAAGR,eAAA,EAAA;IAAAS,IAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;IAAA;IAAAC,QAAA,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in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get datePickerClassNames () {
|
|
13
|
+
return datePickerClassNames;
|
|
14
|
+
},
|
|
15
|
+
get useDatePickerStyles_unstable () {
|
|
16
|
+
return useDatePickerStyles_unstable;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
20
|
+
const _clsx = require("clsx");
|
|
21
|
+
const _DatePickermodulecss = /*#__PURE__*/ _interop_require_default._(require("./DatePicker.module.css"));
|
|
22
|
+
const datePickerClassNames = {
|
|
23
|
+
root: 'fui-DatePicker',
|
|
24
|
+
calendar: 'fui-DatePicker__calendar',
|
|
25
|
+
popupSurface: 'fui-DatePicker__popupSurface'
|
|
26
|
+
};
|
|
27
|
+
const useDatePickerStyles_unstable = (state)=>{
|
|
28
|
+
state.root.className = (0, _clsx.clsx)(datePickerClassNames.root, _DatePickermodulecss.default.root, state.disabled && _DatePickermodulecss.default.disabled, state.root.className);
|
|
29
|
+
if (state.popupSurface) {
|
|
30
|
+
state.popupSurface.className = (0, _clsx.clsx)(datePickerClassNames.popupSurface, _DatePickermodulecss.default.popupSurface, state.inlinePopup && _DatePickermodulecss.default.inline, state.popupSurface.className);
|
|
31
|
+
}
|
|
32
|
+
state.calendar.className = (0, _clsx.clsx)(datePickerClassNames.calendar, state.calendar.className);
|
|
33
|
+
return state;
|
|
34
|
+
};
|
|
@@ -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":";;;;;;;;;;;QAKaE;;;;;;;;sBALQ,OAAO;8EAGT,0BAA0B;AAEtC,6BAA8D;IACnEC,MAAM;IACNC,UAAU;IACVC,cAAc;AAChB,EAAE;AAEK,MAAMC,+BAA+B,CAACC;IAC3CA,MAAMJ,IAAI,CAACK,SAAS,OAAGR,UAAAA,EACrBE,qBAAqBC,IAAI,EACzBF,4BAAAA,CAAOE,IAAI,EACXI,MAAME,QAAQ,IAAIR,4BAAAA,CAAOQ,QAAQ,EACjCF,MAAMJ,IAAI,CAACK,SAAS;IAEtB,IAAID,MAAMF,YAAY,EAAE;QACtBE,MAAMF,YAAY,CAACG,SAAS,OAAGR,UAAAA,EAC7BE,qBAAqBG,YAAY,EACjCJ,4BAAAA,CAAOI,YAAY,EACnBE,MAAMG,WAAW,IAAIT,4BAAAA,CAAOU,MAAM,EAClCJ,MAAMF,YAAY,CAACG,SAAS;IAEhC;IACAD,MAAMH,QAAQ,CAACI,SAAS,OAAGR,UAAAA,EAAKE,qBAAqBE,QAAQ,EAAEG,MAAMH,QAAQ,CAACI,SAAS;IACvF,OAAOD;AACT,EAAE"}
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
function _export(target, all) {
|
|
7
7
|
for(var name in all)Object.defineProperty(target, name, {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: all
|
|
9
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
-
datePickerClassNames
|
|
13
|
+
get datePickerClassNames () {
|
|
14
14
|
return datePickerClassNames;
|
|
15
15
|
},
|
|
16
|
-
useDatePickerStyles_unstable
|
|
16
|
+
get useDatePickerStyles_unstable () {
|
|
17
17
|
return useDatePickerStyles_unstable;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
@@ -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;;;;;;;;;;;;QAOaK;;;;eA0CA0B;;;uBA/C6C,iBAAiB;4BAClC,wBAAwB;AAI1D,6BAA8D;IACnEzB,MAAM;IACNC,UAAU;IACVC,cAAc;AAChB,EAAE;AAEF,MAAMC,gBAAYR,iBAAAA,EAAW;IAC3BS,MAAM;QACJC,UAAU;QACVC,QAAQ;QACR,WAAW;YACTA,QAAQ;QACV;IACF;IACAC,UAAU;QACRD,QAAQ;QACR,WAAW;YACTA,QAAQ;QACV;IACF;IACAE,QAAQ;QACN,+GAA+G;QAC/G,0GAA0G;QAC1GC,QAAQ;IACV;AACF;AAEA,MAAMC,+BAA2BhB,sBAAAA,EAAgB;IAC/CiB,iBAAiBd,kBAAAA,CAAOe,uBAAuB;IAC/CC,WAAWhB,kBAAAA,CAAOiB,QAAQ;IAC1BC,cAAclB,kBAAAA,CAAOmB,kBAAkB;IACvCC,aAAa;IACbC,aAAa;IACbC,aAAatB,kBAAAA,CAAOuB,sBAAsB;IAC1CC,SAAS;IACTC,OAAOzB,kBAAAA,CAAO0B,uBAAuB;IACrC,GAAGzB,4BAAAA,CAAiB0B,KAAK;AAC3B;AAKO,qCAAqC,CAACE;IAC3C,MAAMC,SAASxB;IACf,MAAMyB,wBAAwBlB;IAC9B,MAAM,EAAEH,QAAQ,EAAEsB,WAAW,EAAE,GAAGH;IAElC,oDAAoD;IACpDA,MAAM1B,IAAI,CAAC8B,SAAS,OAAGlC,mBAAAA,EACrBG,qBAAqBC,IAAI,EACzB2B,OAAOvB,IAAI,EACXG,YAAYoB,OAAOpB,QAAQ,EAC3BmB,MAAM1B,IAAI,CAAC8B,SAAS;IAGtB,IAAIJ,MAAMxB,YAAY,EAAE;QACtB,oDAAoD;QACpDwB,MAAMxB,YAAY,CAAC4B,SAAS,OAAGlC,mBAAAA,EAC7BG,qBAAqBG,YAAY,EACjC0B,uBACAF,MAAMxB,YAAY,CAAC4B,SAAS,EAC5BD,eAAeF,OAAOnB,MAAM;IAEhC;IAEA,oDAAoD;IACpDkB,MAAMzB,QAAQ,CAAC6B,SAAS,OAAGlC,mBAAAA,EAAaG,qBAAqBE,QAAQ,EAAEyB,MAAMzB,QAAQ,CAAC6B,SAAS;IAE/F,OAAOJ;AACT,EAAE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get datePickerClassNames () {
|
|
13
|
+
return datePickerClassNames;
|
|
14
|
+
},
|
|
15
|
+
get useDatePickerStyles_unstable () {
|
|
16
|
+
return useDatePickerStyles_unstable;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
20
|
+
const _clsx = require("clsx");
|
|
21
|
+
const _DatePickermodulecss = /*#__PURE__*/ _interop_require_default._(require("./DatePicker.module.css"));
|
|
22
|
+
const datePickerClassNames = {
|
|
23
|
+
root: 'fui-DatePicker',
|
|
24
|
+
calendar: 'fui-DatePicker__calendar',
|
|
25
|
+
popupSurface: 'fui-DatePicker__popupSurface'
|
|
26
|
+
};
|
|
27
|
+
const useDatePickerStyles_unstable = (state)=>{
|
|
28
|
+
state.root.className = (0, _clsx.clsx)(datePickerClassNames.root, _DatePickermodulecss.default.root, state.disabled && _DatePickermodulecss.default.disabled, state.root.className);
|
|
29
|
+
if (state.popupSurface) {
|
|
30
|
+
state.popupSurface.className = (0, _clsx.clsx)(datePickerClassNames.popupSurface, _DatePickermodulecss.default.popupSurface, state.inlinePopup && _DatePickermodulecss.default.inline, state.popupSurface.className);
|
|
31
|
+
}
|
|
32
|
+
state.calendar.className = (0, _clsx.clsx)(datePickerClassNames.calendar, state.calendar.className);
|
|
33
|
+
return state;
|
|
34
|
+
};
|
|
@@ -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":";;;;;;;;;;;QAKaE;;;;;;;;sBALQ,OAAO;8EAGT,0BAA0B;AAEtC,6BAA8D;IACnEC,MAAM;IACNC,UAAU;IACVC,cAAc;AAChB,EAAE;AAEK,MAAMC,+BAA+B,CAACC;IAC3CA,MAAMJ,IAAI,CAACK,SAAS,OAAGR,UAAAA,EACrBE,qBAAqBC,IAAI,EACzBF,4BAAAA,CAAOE,IAAI,EACXI,MAAME,QAAQ,IAAIR,4BAAAA,CAAOQ,QAAQ,EACjCF,MAAMJ,IAAI,CAACK,SAAS;IAEtB,IAAID,MAAMF,YAAY,EAAE;QACtBE,MAAMF,YAAY,CAACG,SAAS,OAAGR,UAAAA,EAC7BE,qBAAqBG,YAAY,EACjCJ,4BAAAA,CAAOI,YAAY,EACnBE,MAAMG,WAAW,IAAIT,4BAAAA,CAAOU,MAAM,EAClCJ,MAAMF,YAAY,CAACG,SAAS;IAEhC;IACAD,MAAMH,QAAQ,CAACI,SAAS,OAAGR,UAAAA,EAAKE,qBAAqBE,QAAQ,EAAEG,MAAMH,QAAQ,CAACI,SAAS;IACvF,OAAOD;AACT,EAAE"}
|
package/lib-commonjs/index.cjs
CHANGED
|
@@ -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 _DatePicker.DatePicker;
|
|
14
14
|
},
|
|
15
|
-
datePickerClassNames
|
|
15
|
+
get datePickerClassNames () {
|
|
16
16
|
return _DatePicker.datePickerClassNames;
|
|
17
17
|
},
|
|
18
|
-
defaultDatePickerErrorStrings
|
|
18
|
+
get defaultDatePickerErrorStrings () {
|
|
19
19
|
return _DatePicker.defaultDatePickerErrorStrings;
|
|
20
20
|
},
|
|
21
|
-
defaultDatePickerStrings
|
|
21
|
+
get defaultDatePickerStrings () {
|
|
22
22
|
return _DatePicker.defaultDatePickerStrings;
|
|
23
23
|
},
|
|
24
|
-
renderDatePicker_unstable
|
|
24
|
+
get renderDatePicker_unstable () {
|
|
25
25
|
return _DatePicker.renderDatePicker_unstable;
|
|
26
26
|
},
|
|
27
|
-
useDatePickerStyles_unstable
|
|
27
|
+
get useDatePickerStyles_unstable () {
|
|
28
28
|
return _DatePicker.useDatePickerStyles_unstable;
|
|
29
29
|
},
|
|
30
|
-
useDatePicker_unstable
|
|
30
|
+
get useDatePicker_unstable () {
|
|
31
31
|
return _DatePicker.useDatePicker_unstable;
|
|
32
32
|
}
|
|
33
33
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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;;;;;;;;;;;kCAG4D,8BAA8B;AAUnF,SAASE,oBACdC,KAAsB;IAGtB,MAAM,EAAEC,WAAW,EAAE,GAAGD;IAExB,MAAME,eAAe;QACnBC,UAAU;QACVC,OAAO;QACP,OAAGP,6CAAAA,EAA4BI,YAAY;IAC7C;IAEA,MAAM,EAAEI,SAAS,EAAEC,YAAY,EAAE,OAAGR,gCAAAA,EAAeI;IAEnD,OAAO;QAACG;QAAWC;KAAa;AAClC"}
|
package/package.json
CHANGED
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-datepicker-compat",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
4
4
|
"description": "React components for building web experiences",
|
|
5
5
|
"main": "lib-commonjs/index.cjs",
|
|
6
6
|
"module": "lib/index.js",
|
|
7
7
|
"typings": "./dist/index.d.ts",
|
|
8
|
-
"sideEffects":
|
|
8
|
+
"sideEffects": [
|
|
9
|
+
"**/*.css"
|
|
10
|
+
],
|
|
9
11
|
"repository": {
|
|
10
12
|
"type": "git",
|
|
11
13
|
"url": "https://github.com/microsoft/fluentui"
|
|
12
14
|
},
|
|
13
15
|
"license": "MIT",
|
|
14
16
|
"dependencies": {
|
|
15
|
-
"@fluentui/keyboard-keys": "9.
|
|
16
|
-
"@fluentui/react-calendar-compat": "9.
|
|
17
|
-
"@fluentui/react-field": "9.
|
|
17
|
+
"@fluentui/keyboard-keys": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
18
|
+
"@fluentui/react-calendar-compat": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
19
|
+
"@fluentui/react-field": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
18
20
|
"@fluentui/react-icons": "^2.0.245",
|
|
19
|
-
"@fluentui/react-input": "9.
|
|
20
|
-
"@fluentui/react-jsx-runtime": "9.
|
|
21
|
-
"@fluentui/react-popover": "9.
|
|
22
|
-
"@fluentui/react-portal": "9.
|
|
23
|
-
"@fluentui/react-positioning": "9.
|
|
24
|
-
"@fluentui/react-shared-contexts": "9.
|
|
25
|
-
"@fluentui/react-tabster": "9.
|
|
26
|
-
"@fluentui/react-theme": "9.
|
|
27
|
-
"@fluentui/react-utilities": "9.
|
|
21
|
+
"@fluentui/react-input": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
22
|
+
"@fluentui/react-jsx-runtime": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
23
|
+
"@fluentui/react-popover": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
24
|
+
"@fluentui/react-portal": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
25
|
+
"@fluentui/react-positioning": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
26
|
+
"@fluentui/react-shared-contexts": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
27
|
+
"@fluentui/react-tabster": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
28
|
+
"@fluentui/react-theme": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
29
|
+
"@fluentui/react-utilities": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
28
30
|
"@griffel/react": "^1.5.32",
|
|
29
|
-
"@swc/helpers": "^0.5.1"
|
|
31
|
+
"@swc/helpers": "^0.5.1",
|
|
32
|
+
"clsx": "^2.1.1"
|
|
30
33
|
},
|
|
31
34
|
"peerDependencies": {
|
|
32
35
|
"@types/react": ">=16.14.0 <20.0.0",
|
|
@@ -49,7 +52,6 @@
|
|
|
49
52
|
"default": "./lib-commonjs/index.cjs"
|
|
50
53
|
}
|
|
51
54
|
},
|
|
52
|
-
"./metadata.json": "./dist/metadata/index.json",
|
|
53
55
|
"./package.json": "./package.json"
|
|
54
56
|
},
|
|
55
57
|
"files": [
|
|
@@ -57,9 +59,7 @@
|
|
|
57
59
|
"dist/*.d.ts",
|
|
58
60
|
"dist/*.d.cts",
|
|
59
61
|
"lib",
|
|
60
|
-
"lib-commonjs"
|
|
61
|
-
"dist/metadata"
|
|
62
|
+
"lib-commonjs"
|
|
62
63
|
],
|
|
63
|
-
"type": "module"
|
|
64
|
-
"fluentuiCatalog": "./metadata.json"
|
|
64
|
+
"type": "module"
|
|
65
65
|
}
|