@fluentui/react-datepicker-compat 0.0.0-nightly-20250423-0405.1 → 0.0.0-nightly-20250423-1415.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -19
- package/dist/index.d.ts +245 -0
- package/lib/DatePicker.js +1 -0
- package/lib/DatePicker.js.map +1 -0
- package/lib/components/DatePicker/DatePicker.js +10 -0
- package/lib/components/DatePicker/DatePicker.js.map +1 -0
- package/lib/components/DatePicker/DatePicker.types.js +3 -0
- package/lib/components/DatePicker/DatePicker.types.js.map +1 -0
- package/lib/components/DatePicker/defaults.js +14 -0
- package/lib/components/DatePicker/defaults.js.map +1 -0
- package/lib/components/DatePicker/index.js +5 -0
- package/lib/components/DatePicker/index.js.map +1 -0
- package/lib/components/DatePicker/renderDatePicker.js +22 -0
- package/lib/components/DatePicker/renderDatePicker.js.map +1 -0
- package/lib/components/DatePicker/useDatePicker.js +451 -0
- package/lib/components/DatePicker/useDatePicker.js.map +1 -0
- package/lib/components/DatePicker/useDatePickerStyles.styles.js +43 -0
- package/lib/components/DatePicker/useDatePickerStyles.styles.js.map +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -0
- package/lib/utils/usePopupPositioning.js +21 -0
- package/lib/utils/usePopupPositioning.js.map +1 -0
- package/lib-commonjs/DatePicker.js +34 -0
- package/lib-commonjs/DatePicker.js.map +1 -0
- package/lib-commonjs/components/DatePicker/DatePicker.js +21 -0
- package/lib-commonjs/components/DatePicker/DatePicker.js.map +1 -0
- package/lib-commonjs/components/DatePicker/DatePicker.types.js +6 -0
- package/lib-commonjs/components/DatePicker/DatePicker.types.js.map +1 -0
- package/lib-commonjs/components/DatePicker/defaults.js +32 -0
- package/lib-commonjs/components/DatePicker/defaults.js.map +1 -0
- package/lib-commonjs/components/DatePicker/index.js +38 -0
- package/lib-commonjs/components/DatePicker/index.js.map +1 -0
- package/lib-commonjs/components/DatePicker/renderDatePicker.js +30 -0
- package/lib-commonjs/components/DatePicker/renderDatePicker.js.map +1 -0
- package/lib-commonjs/components/DatePicker/useDatePicker.js +451 -0
- package/lib-commonjs/components/DatePicker/useDatePicker.js.map +1 -0
- package/lib-commonjs/components/DatePicker/useDatePickerStyles.styles.js +62 -0
- package/lib-commonjs/components/DatePicker/useDatePickerStyles.styles.js.map +1 -0
- package/lib-commonjs/index.js +34 -0
- package/lib-commonjs/index.js.map +1 -0
- package/lib-commonjs/utils/usePopupPositioning.js +26 -0
- package/lib-commonjs/utils/usePopupPositioning.js.map +1 -0
- package/package.json +16 -16
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/DatePicker/useDatePicker.tsx"],"sourcesContent":["import * 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 'use no memo';\n\n const [open, setOpen] = useControllableState({\n initialState: false,\n defaultState: props.defaultOpen,\n state: props.open,\n });\n const isMounted = React.useRef(false);\n\n React.useEffect(\n () => {\n if (isMounted.current && !open) {\n // If DatePicker's menu (Calendar) is closed, run onAfterMenuDismiss\n props.onOpenChange?.(false);\n }\n isMounted.current = true;\n },\n // Should only run on allowTextInput or open change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [props.allowTextInput, open],\n );\n\n return [open, setOpen] as const;\n}\n\nfunction useSelectedDate({ formatDate, onSelectDate, value }: DatePickerProps) {\n const [selectedDate, setSelectedDateState] = useControllableState<Date | null | undefined>({\n initialState: null,\n state: value,\n });\n const [formattedDate, setFormattedDate] = React.useState(() => (value && formatDate ? formatDate(value) : ''));\n\n const setSelectedDate = (newDate: Date | null | undefined) => {\n onSelectDate?.(newDate);\n setSelectedDateState(newDate);\n setFormattedDate(newDate && formatDate ? formatDate(newDate) : '');\n };\n\n React.useEffect(() => {\n setFormattedDate(value && formatDate ? formatDate(value) : '');\n }, [formatDate, value]);\n\n return [selectedDate, formattedDate, setSelectedDate, setFormattedDate] as const;\n}\n\nconst defaultFormatDate = (date?: Date) => (date ? date.toDateString() : '');\nconst defaultParseDateFromString = (dateStr: string) => {\n const date = Date.parse(dateStr);\n return date ? new Date(date) : null;\n};\n\n/**\n * Create the state required to render DatePicker.\n *\n * The returned state can be modified with hooks such as useDatePickerStyles_unstable,\n * before being passed to renderDatePicker_unstable.\n *\n * @param props - props from this instance of DatePicker\n * @param ref - reference to root Input slot\n */\nexport const useDatePicker_unstable = (props: DatePickerProps, ref: React.Ref<HTMLInputElement>): DatePickerState => {\n 'use no memo';\n\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);\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 ev.stopPropagation();\n ev.preventDefault();\n if (open) {\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 preventFocusOpeningPicker.current = false;\n }\n }, [allowTextInput, disableAutoFocus, preventFocusOpeningPicker, showDatePickerPopup]);\n\n const onInputClick: React.MouseEventHandler<HTMLInputElement> = React.useCallback((): void => {\n // default openOnClick to !props.disableAutoFocus for legacy support of disableAutoFocus behavior\n if ((props.openOnClick || !props.disableAutoFocus) && !open && !props.disabled) {\n showDatePickerPopup();\n return;\n }\n\n if (allowTextInput) {\n dismissDatePickerPopup();\n }\n }, [\n allowTextInput,\n dismissDatePickerPopup,\n open,\n props.disabled,\n props.disableAutoFocus,\n props.openOnClick,\n showDatePickerPopup,\n ]);\n\n const onIconClick = (ev: React.MouseEvent<HTMLElement>): void => {\n ev.stopPropagation();\n if (!open && !props.disabled) {\n showDatePickerPopup();\n } else if (props.allowTextInput) {\n dismissDatePickerPopup();\n }\n };\n\n const inputAppearance: InputProps['appearance'] = underlined\n ? 'underline'\n : borderless\n ? 'filled-lighter'\n : 'outline';\n\n const [triggerWrapperRef, popupRef] = usePopupPositioning(props);\n\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 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":["useDatePicker_unstable","isDateOutOfBounds","date","minDate","maxDate","compareDatePart","useFocusLogic","inputRef","React","useRef","preventFocusOpeningPicker","focus","useCallback","current","preventNextFocusOpeningPicker","usePopupVisibility","props","open","setOpen","useControllableState","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","ref","allFocusable","borderless","dateTimeFormatter","disableAutoFocus","firstDayOfWeek","DayOfWeek","Sunday","firstWeekOfYear","FirstWeekOfYear","FirstDay","highlightCurrentMonth","highlightSelectedMonth","initialPickerDate","initialPickerDateProp","inlinePopup","isMonthPickerVisible","mountNode","onUserSelectDate","openOnClick","onValidationResult","parseDateFromString","showCloseButton","showGoToToday","showMonthPickerAsOverlay","showWeekNumbers","strings","defaultDatePickerStrings","today","underlined","restOfProps","useMemo","calendar","rootRef","setOpenState","fieldContext","useFieldContext","required","defaultId","useId","popupSurfaceId","validateTextInput","error","isNaN","getTime","newState","disabled","dismissDatePickerPopup","newlySelectedDate","showDatePickerPopup","calendarDismissed","onInputChange","_","data","newValue","onInputBlur","onInputKeyDown","ev","key","Enter","preventDefault","stopPropagation","Escape","ArrowDown","onInputFocus","onInputClick","onIconClick","inputAppearance","triggerWrapperRef","popupRef","usePopupPositioning","inputRoot","slot","always","root","defaultProps","elementType","useMergedRefs","input","inputLabelledBy","inputId","id","iconA11yProps","role","contentAfter","children","createElement","CalendarMonthRegular","onClick","useEventCallback","mergeCallbacks","appearance","undefined","readOnly","Input","onChange","onBlur","onKeyDown","onFocus","modalAttributes","useModalAttributes","trapFocus","alwaysFocusable","legacyTrapFocus","popupSurface","optional","renderByDefault","targetDocument","useFluent","useOnClickOutside","element","callback","refs","useOnScrollOutside","calendarShorthand","componentRef","Calendar","onDismiss","components"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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IAAI,6DAA6D;IACjE,+GAA+G;IAC/G,kBAAkB;IAClBT,OAAMiB,SAAS,CAAC;QACd,IAAIR,QAAQ,CAACD,MAAM2E,QAAQ,IAAId,SAAShE,OAAO,EAAE;YAC/CgE,SAAShE,OAAO,CAACF,KAAK;QACxB;IACF,GAAG;QAACsC;QAAkBhC;QAAMD,MAAM2E,QAAQ;KAAC;IAC3C,MAAMoE,oBAAoB1C,oBAAAA,CAAKC,MAAM,CAACtG,MAAM6D,QAAQ,EAAE;QACpD2C,cAAc;YACZ1E;YACAkH,cAAcnF;YACd7B;YACAE;YACAG;YACAG;YACAC;YACAI;YACAzD;YACAD;YACAgE;YACAC;YACAC;YACAC;YACAC;YACAE;YACA1C,OAAOC,gBAAgB0B;QACzB;QACA+D,aAAawC,6BAAAA;IACf;IACAF,kBAAkBG,SAAS,GAAG5B,IAAAA,gCAAAA,EAAiBC,IAAAA,8BAAAA,EAAewB,kBAAkBG,SAAS,EAAEnE;IAC3FgE,kBAAkBjI,YAAY,GAAGwG,IAAAA,gCAAAA,EAAiBC,IAAAA,8BAAAA,EAAewB,kBAAkBjI,YAAY,EAAEiE;IACjG,MAAMxE,QAAyB;QAC7BoE,UAAU,CAAC,CAAC3E,MAAM2E,QAAQ;QAC1B/B;QACAuG,YAAY;YAAE5C,MAAMoB,iBAAAA;YAAO9D,UAAUoF,6BAAAA;YAA8CZ,cAAc;QAAM;QACvGxE,UAAUkF;QACVjG;QACAyD;QACA8B;IACF;IAEA9H,MAAMgG,IAAI,CAACxF,KAAK,GAAGG;IAEnB,OAAOX;AACT"}
|
|
@@ -0,0 +1,62 @@
|
|
|
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: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
datePickerClassNames: function() {
|
|
13
|
+
return datePickerClassNames;
|
|
14
|
+
},
|
|
15
|
+
useDatePickerStyles_unstable: function() {
|
|
16
|
+
return useDatePickerStyles_unstable;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _react = require("@griffel/react");
|
|
20
|
+
const datePickerClassNames = {
|
|
21
|
+
root: 'fui-DatePicker',
|
|
22
|
+
calendar: 'fui-DatePicker__calendar',
|
|
23
|
+
popupSurface: 'fui-DatePicker__popupSurface'
|
|
24
|
+
};
|
|
25
|
+
const useStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
26
|
+
base: {
|
|
27
|
+
qhf8xq: "f10pi13n",
|
|
28
|
+
Bceei9c: "f1k6fduh",
|
|
29
|
+
xfaavh: "faxec97"
|
|
30
|
+
},
|
|
31
|
+
disabled: {
|
|
32
|
+
Bceei9c: "f158kwzp",
|
|
33
|
+
xfaavh: "f19qwlmg"
|
|
34
|
+
},
|
|
35
|
+
inline: {
|
|
36
|
+
Bj3rh1h: "f19g0ac"
|
|
37
|
+
}
|
|
38
|
+
}, {
|
|
39
|
+
d: [
|
|
40
|
+
".f10pi13n{position:relative;}",
|
|
41
|
+
".f1k6fduh{cursor:pointer;}",
|
|
42
|
+
".faxec97 input{cursor:pointer;}",
|
|
43
|
+
".f158kwzp{cursor:default;}",
|
|
44
|
+
".f19qwlmg input{cursor:default;}",
|
|
45
|
+
".f19g0ac{z-index:1;}"
|
|
46
|
+
]
|
|
47
|
+
});
|
|
48
|
+
const usePopupSurfaceClassName = /*#__PURE__*/ (0, _react.__resetStyles)("r1ytv1z8", null, [
|
|
49
|
+
".r1ytv1z8{background-color:var(--colorNeutralBackground1);box-shadow:var(--shadow16);border-radius:var(--borderRadiusMedium);border-width:1px;border-style:solid;border-color:var(--colorTransparentStroke);display:inline-flex;color:var(--colorNeutralForeground1);font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase300);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase300);}"
|
|
50
|
+
]);
|
|
51
|
+
const useDatePickerStyles_unstable = (state)=>{
|
|
52
|
+
'use no memo';
|
|
53
|
+
const styles = useStyles();
|
|
54
|
+
const popupSurfaceClassName = usePopupSurfaceClassName();
|
|
55
|
+
const { disabled, inlinePopup } = state;
|
|
56
|
+
state.root.className = (0, _react.mergeClasses)(datePickerClassNames.root, styles.base, disabled && styles.disabled, state.root.className);
|
|
57
|
+
if (state.popupSurface) {
|
|
58
|
+
state.popupSurface.className = (0, _react.mergeClasses)(datePickerClassNames.popupSurface, popupSurfaceClassName, state.popupSurface.className, inlinePopup && styles.inline);
|
|
59
|
+
}
|
|
60
|
+
state.calendar.className = (0, _react.mergeClasses)(datePickerClassNames.calendar, state.calendar.className);
|
|
61
|
+
return state;
|
|
62
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useDatePickerStyles.styles.js"],"sourcesContent":["import { 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 'use no memo';\n const styles = useStyles();\n const popupSurfaceClassName = usePopupSurfaceClassName();\n const { disabled, inlinePopup } = state;\n state.root.className = mergeClasses(datePickerClassNames.root, styles.base, disabled && styles.disabled, state.root.className);\n if (state.popupSurface) {\n state.popupSurface.className = mergeClasses(datePickerClassNames.popupSurface, popupSurfaceClassName, state.popupSurface.className, inlinePopup && styles.inline);\n }\n state.calendar.className = mergeClasses(datePickerClassNames.calendar, state.calendar.className);\n return state;\n};\n"],"names":["datePickerClassNames","useDatePickerStyles_unstable","root","calendar","popupSurface","useStyles","__styles","base","qhf8xq","Bceei9c","xfaavh","disabled","inline","Bj3rh1h","d","usePopupSurfaceClassName","__resetStyles","state","styles","popupSurfaceClassName","inlinePopup","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAEaA,oBAAoB;eAApBA;;IAsCIC,4BAA4B;eAA5BA;;;uBAxCyC;AAEnD,MAAMD,uBAAuB;IAChCE,MAAM;IACNC,UAAU;IACVC,cAAc;AAClB;AACA,MAAMC,YAAS,WAAA,GAAGC,IAAAA,eAAA,EAAA;IAAAC,MAAA;QAAAC,QAAA;QAAAC,SAAA;QAAAC,QAAA;IAAA;IAAAC,UAAA;QAAAF,SAAA;QAAAC,QAAA;IAAA;IAAAE,QAAA;QAAAC,SAAA;IAAA;AAAA,GAAA;IAAAC,GAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;KAAA;AAAA;AAoBlB,MAAMC,2BAAwB,WAAA,GAAGC,IAAAA,oBAAA,EAAA,YAAA,MAAA;IAAA;CAUhC;AAGU,MAAMf,+BAAgCgB,CAAAA;IAC7C;IACA,MAAMC,SAASb;IACf,MAAMc,wBAAwBJ;IAC9B,MAAM,EAAEJ,QAAQ,EAAES,WAAAA,EAAa,GAAGH;IAClCA,MAAMf,IAAI,CAACmB,SAAS,GAAGC,IAAAA,mBAAY,EAACtB,qBAAqBE,IAAI,EAAEgB,OAAOX,IAAI,EAAEI,YAAYO,OAAOP,QAAQ,EAAEM,MAAMf,IAAI,CAACmB,SAAS;IAC7H,IAAIJ,MAAMb,YAAY,EAAE;QACpBa,MAAMb,YAAY,CAACiB,SAAS,GAAGC,IAAAA,mBAAY,EAACtB,qBAAqBI,YAAY,EAAEe,uBAAuBF,MAAMb,YAAY,CAACiB,SAAS,EAAED,eAAeF,OAAON,MAAM;IACpK;IACAK,MAAMd,QAAQ,CAACkB,SAAS,GAAGC,IAAAA,mBAAY,EAACtB,qBAAqBG,QAAQ,EAAEc,MAAMd,QAAQ,CAACkB,SAAS;IAC/F,OAAOJ;AACX"}
|
|
@@ -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: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
DatePicker: function() {
|
|
13
|
+
return _DatePicker.DatePicker;
|
|
14
|
+
},
|
|
15
|
+
datePickerClassNames: function() {
|
|
16
|
+
return _DatePicker.datePickerClassNames;
|
|
17
|
+
},
|
|
18
|
+
defaultDatePickerErrorStrings: function() {
|
|
19
|
+
return _DatePicker.defaultDatePickerErrorStrings;
|
|
20
|
+
},
|
|
21
|
+
defaultDatePickerStrings: function() {
|
|
22
|
+
return _DatePicker.defaultDatePickerStrings;
|
|
23
|
+
},
|
|
24
|
+
renderDatePicker_unstable: function() {
|
|
25
|
+
return _DatePicker.renderDatePicker_unstable;
|
|
26
|
+
},
|
|
27
|
+
useDatePickerStyles_unstable: function() {
|
|
28
|
+
return _DatePicker.useDatePickerStyles_unstable;
|
|
29
|
+
},
|
|
30
|
+
useDatePicker_unstable: function() {
|
|
31
|
+
return _DatePicker.useDatePicker_unstable;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const _DatePicker = require("./DatePicker");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n DatePicker,\n datePickerClassNames,\n defaultDatePickerErrorStrings,\n defaultDatePickerStrings,\n renderDatePicker_unstable,\n useDatePicker_unstable,\n useDatePickerStyles_unstable,\n} from './DatePicker';\nexport type { DatePickerErrorType, DatePickerProps, DatePickerValidationResultData } from './DatePicker';\n// Re-exporting so there's no need to add @fluentui/react-calendar-compat to dependencies just to localize.\nexport type { CalendarStrings } from '@fluentui/react-calendar-compat';\n"],"names":["DatePicker","datePickerClassNames","defaultDatePickerErrorStrings","defaultDatePickerStrings","renderDatePicker_unstable","useDatePickerStyles_unstable","useDatePicker_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IACEA,UAAU;eAAVA,sBAAU;;IACVC,oBAAoB;eAApBA,gCAAoB;;IACpBC,6BAA6B;eAA7BA,yCAA6B;;IAC7BC,wBAAwB;eAAxBA,oCAAwB;;IACxBC,yBAAyB;eAAzBA,qCAAyB;;IAEzBC,4BAA4B;eAA5BA,wCAA4B;;IAD5BC,sBAAsB;eAAtBA,kCAAsB;;;4BAEjB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "usePopupPositioning", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return usePopupPositioning;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
const _reactpositioning = require("@fluentui/react-positioning");
|
|
14
|
+
function usePopupPositioning(props) {
|
|
15
|
+
const { positioning } = props;
|
|
16
|
+
const popupOptions = {
|
|
17
|
+
position: 'below',
|
|
18
|
+
align: 'start',
|
|
19
|
+
...(0, _reactpositioning.resolvePositioningShorthand)(positioning)
|
|
20
|
+
};
|
|
21
|
+
const { targetRef, containerRef } = (0, _reactpositioning.usePositioning)(popupOptions);
|
|
22
|
+
return [
|
|
23
|
+
targetRef,
|
|
24
|
+
containerRef
|
|
25
|
+
];
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/usePopupPositioning.ts"],"sourcesContent":["import * 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): [triggerRef: React.MutableRefObject<HTMLElement>, popupRef: React.MutableRefObject<HTMLDivElement>] {\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":["usePopupPositioning","props","positioning","popupOptions","position","align","resolvePositioningShorthand","targetRef","containerRef","usePositioning"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWgBA;;;eAAAA;;;;iEAXO;kCACqC;AAUrD,SAASA,oBACdC,KAAsB;IAEtB,MAAM,EAAEC,WAAW,EAAE,GAAGD;IAExB,MAAME,eAAe;QACnBC,UAAU;QACVC,OAAO;QACP,GAAGC,IAAAA,6CAAAA,EAA4BJ,YAAY;IAC7C;IAEA,MAAM,EAAEK,SAAS,EAAEC,YAAY,EAAE,GAAGC,IAAAA,gCAAAA,EAAeN;IAEnD,OAAO;QAACI;QAAWC;KAAa;AAClC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-datepicker-compat",
|
|
3
|
-
"version": "0.0.0-nightly-20250423-
|
|
3
|
+
"version": "0.0.0-nightly-20250423-1415.1",
|
|
4
4
|
"description": "React components for building web experiences",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -12,27 +12,27 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@fluentui/react-provider": "0.0.0-nightly-20250423-
|
|
15
|
+
"@fluentui/react-provider": "0.0.0-nightly-20250423-1415.1",
|
|
16
16
|
"@fluentui/eslint-plugin": "*",
|
|
17
|
-
"@fluentui/react-conformance": "0.0.0-nightly-20250423-
|
|
18
|
-
"@fluentui/react-conformance-griffel": "0.0.0-nightly-20250423-
|
|
17
|
+
"@fluentui/react-conformance": "0.0.0-nightly-20250423-1415.1",
|
|
18
|
+
"@fluentui/react-conformance-griffel": "0.0.0-nightly-20250423-1415.1",
|
|
19
19
|
"@fluentui/scripts-api-extractor": "*",
|
|
20
20
|
"@fluentui/scripts-cypress": "*"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@fluentui/keyboard-keys": "0.0.0-nightly-20250423-
|
|
24
|
-
"@fluentui/react-calendar-compat": "0.0.0-nightly-20250423-
|
|
25
|
-
"@fluentui/react-field": "0.0.0-nightly-20250423-
|
|
23
|
+
"@fluentui/keyboard-keys": "0.0.0-nightly-20250423-1415.1",
|
|
24
|
+
"@fluentui/react-calendar-compat": "0.0.0-nightly-20250423-1415.1",
|
|
25
|
+
"@fluentui/react-field": "0.0.0-nightly-20250423-1415.1",
|
|
26
26
|
"@fluentui/react-icons": "^2.0.245",
|
|
27
|
-
"@fluentui/react-input": "0.0.0-nightly-20250423-
|
|
28
|
-
"@fluentui/react-jsx-runtime": "0.0.0-nightly-20250423-
|
|
29
|
-
"@fluentui/react-popover": "0.0.0-nightly-20250423-
|
|
30
|
-
"@fluentui/react-portal": "0.0.0-nightly-20250423-
|
|
31
|
-
"@fluentui/react-positioning": "0.0.0-nightly-20250423-
|
|
32
|
-
"@fluentui/react-shared-contexts": "0.0.0-nightly-20250423-
|
|
33
|
-
"@fluentui/react-tabster": "0.0.0-nightly-20250423-
|
|
34
|
-
"@fluentui/react-theme": "0.0.0-nightly-20250423-
|
|
35
|
-
"@fluentui/react-utilities": "0.0.0-nightly-20250423-
|
|
27
|
+
"@fluentui/react-input": "0.0.0-nightly-20250423-1415.1",
|
|
28
|
+
"@fluentui/react-jsx-runtime": "0.0.0-nightly-20250423-1415.1",
|
|
29
|
+
"@fluentui/react-popover": "0.0.0-nightly-20250423-1415.1",
|
|
30
|
+
"@fluentui/react-portal": "0.0.0-nightly-20250423-1415.1",
|
|
31
|
+
"@fluentui/react-positioning": "0.0.0-nightly-20250423-1415.1",
|
|
32
|
+
"@fluentui/react-shared-contexts": "0.0.0-nightly-20250423-1415.1",
|
|
33
|
+
"@fluentui/react-tabster": "0.0.0-nightly-20250423-1415.1",
|
|
34
|
+
"@fluentui/react-theme": "0.0.0-nightly-20250423-1415.1",
|
|
35
|
+
"@fluentui/react-utilities": "0.0.0-nightly-20250423-1415.1",
|
|
36
36
|
"@griffel/react": "^1.5.22",
|
|
37
37
|
"@swc/helpers": "^0.5.1"
|
|
38
38
|
},
|