@fluentui/react-timepicker-compat 0.2.15 → 0.2.17

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 CHANGED
@@ -1,12 +1,34 @@
1
1
  # Change Log - @fluentui/react-timepicker-compat
2
2
 
3
- This log was last generated on Mon, 20 May 2024 12:36:43 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 06 Jun 2024 15:22:23 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [0.2.17](https://github.com/microsoft/fluentui/tree/@fluentui/react-timepicker-compat_v0.2.17)
8
+
9
+ Thu, 06 Jun 2024 15:22:23 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-timepicker-compat_v0.2.16..@fluentui/react-timepicker-compat_v0.2.17)
11
+
12
+ ### Patches
13
+
14
+ - fix: clear icon not working with freeform ([PR #31324](https://github.com/microsoft/fluentui/pull/31324) by yuanboxue@microsoft.com)
15
+ - Bump @fluentui/react-combobox to v9.11.7 ([PR #31586](https://github.com/microsoft/fluentui/pull/31586) by beachball)
16
+ - Bump @fluentui/react-field to v9.1.67 ([PR #31586](https://github.com/microsoft/fluentui/pull/31586) by beachball)
17
+ - Bump @fluentui/react-jsx-runtime to v9.0.39 ([PR #31586](https://github.com/microsoft/fluentui/pull/31586) by beachball)
18
+ - Bump @fluentui/react-utilities to v9.18.10 ([PR #31586](https://github.com/microsoft/fluentui/pull/31586) by beachball)
19
+
20
+ ## [0.2.16](https://github.com/microsoft/fluentui/tree/@fluentui/react-timepicker-compat_v0.2.16)
21
+
22
+ Thu, 23 May 2024 08:02:52 GMT
23
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-timepicker-compat_v0.2.15..@fluentui/react-timepicker-compat_v0.2.16)
24
+
25
+ ### Patches
26
+
27
+ - Bump @fluentui/react-combobox to v9.11.6 ([commit](https://github.com/microsoft/fluentui/commit/03599d609e8310b08c57d1f871cffbf717d79207) by beachball)
28
+
7
29
  ## [0.2.15](https://github.com/microsoft/fluentui/tree/@fluentui/react-timepicker-compat_v0.2.15)
8
30
 
9
- Mon, 20 May 2024 12:36:43 GMT
31
+ Mon, 20 May 2024 12:45:07 GMT
10
32
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-timepicker-compat_v0.2.14..@fluentui/react-timepicker-compat_v0.2.15)
11
33
 
12
34
  ### Patches
@@ -13,6 +13,7 @@ import { dateToKey, keyToDate, formatDateToTimeString as defaultFormatDateToTime
13
13
  * @param props - props from this instance of TimePicker
14
14
  * @param ref - reference to root HTMLElement of TimePicker
15
15
  */ export const useTimePicker_unstable = (props, ref)=>{
16
+ var _baseState_clearIcon;
16
17
  const { dateAnchor: dateAnchorInProps, defaultSelectedTime: defaultSelectedTimeInProps, endHour = 24, formatDateToTimeString = defaultFormatDateToTimeString, hourCycle, increment = 30, onTimeChange, selectedTime: selectedTimeInProps, showSeconds = false, startHour = 0, parseTimeStringToDate: parseTimeStringToDateInProps, ...rest } = props;
17
18
  const { freeform = false } = rest;
18
19
  var _ref;
@@ -53,8 +54,9 @@ import { dateToKey, keyToDate, formatDateToTimeString as defaultFormatDateToTime
53
54
  options,
54
55
  selectedTime
55
56
  ]);
57
+ const clearIconRef = React.useRef(null);
56
58
  const handleOptionSelect = useEventCallback((e, data)=>{
57
- if (freeform && data.optionValue === undefined) {
59
+ if (freeform && data.optionValue === undefined && !(rest.clearable && e.type === 'click' && e.currentTarget === clearIconRef.current)) {
58
60
  // Combobox clears selection when input value not matching any option; but we allow this case in freeform TimePicker.
59
61
  return;
60
62
  }
@@ -85,8 +87,13 @@ import { dateToKey, keyToDate, formatDateToTimeString as defaultFormatDateToTime
85
87
  hourCycle,
86
88
  showSeconds
87
89
  ]);
90
+ const mergedClearIconRef = useMergedRefs((_baseState_clearIcon = baseState.clearIcon) === null || _baseState_clearIcon === void 0 ? void 0 : _baseState_clearIcon.ref, clearIconRef);
88
91
  const state = {
89
92
  ...baseState,
93
+ clearIcon: baseState.clearIcon ? {
94
+ ...baseState.clearIcon,
95
+ ref: mergedClearIconRef
96
+ } : undefined,
90
97
  freeform,
91
98
  parseTimeStringToDate: parseTimeStringToDateInProps !== null && parseTimeStringToDateInProps !== void 0 ? parseTimeStringToDateInProps : defaultParseTimeStringToDate,
92
99
  submittedText
@@ -1 +1 @@
1
- {"version":3,"sources":["useTimePicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n elementContains,\n mergeCallbacks,\n useControllableState,\n useEventCallback,\n useId,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport { Enter } from '@fluentui/keyboard-keys';\nimport type { Hour, TimePickerOption, TimePickerProps, TimePickerState, TimeSelectionData } from './TimePicker.types';\nimport { ComboboxProps, useCombobox_unstable, Option } from '@fluentui/react-combobox';\nimport { useFieldContext_unstable as useFieldContext } from '@fluentui/react-field';\nimport {\n dateToKey,\n keyToDate,\n formatDateToTimeString as defaultFormatDateToTimeString,\n getDateStartAnchor,\n getDateEndAnchor,\n getTimesBetween,\n getDateFromTimeString,\n} from './timeMath';\n\n/**\n * Create the state required to render TimePicker.\n *\n * The returned state can be modified with hooks such as useTimePickerStyles_unstable,\n * before being passed to renderTimePicker_unstable.\n *\n * @param props - props from this instance of TimePicker\n * @param ref - reference to root HTMLElement of TimePicker\n */\nexport const useTimePicker_unstable = (props: TimePickerProps, ref: React.Ref<HTMLInputElement>): TimePickerState => {\n const {\n dateAnchor: dateAnchorInProps,\n defaultSelectedTime: defaultSelectedTimeInProps,\n endHour = 24,\n formatDateToTimeString = defaultFormatDateToTimeString,\n hourCycle,\n increment = 30,\n onTimeChange,\n selectedTime: selectedTimeInProps,\n showSeconds = false,\n startHour = 0,\n parseTimeStringToDate: parseTimeStringToDateInProps,\n ...rest\n } = props;\n const { freeform = false } = rest;\n\n const { dateStartAnchor, dateEndAnchor } = useStableDateAnchor(\n dateAnchorInProps ?? selectedTimeInProps ?? defaultSelectedTimeInProps,\n startHour,\n endHour,\n );\n\n const options: TimePickerOption[] = React.useMemo(\n () =>\n getTimesBetween(dateStartAnchor, dateEndAnchor, increment).map(time => ({\n date: time,\n key: dateToKey(time),\n text: formatDateToTimeString(time, { showSeconds, hourCycle }),\n })),\n [dateEndAnchor, dateStartAnchor, formatDateToTimeString, hourCycle, increment, showSeconds],\n );\n\n const [selectedTime, setSelectedTime] = useControllableState<Date | null>({\n state: selectedTimeInProps,\n defaultState: defaultSelectedTimeInProps,\n initialState: null,\n });\n\n const [submittedText, setSubmittedText] = React.useState<string | undefined>(undefined);\n\n const selectTime: TimePickerProps['onTimeChange'] = useEventCallback((e, data) => {\n setSelectedTime(data.selectedTime);\n setSubmittedText(data.selectedTimeText);\n onTimeChange?.(e, data);\n });\n\n const selectedOptions = React.useMemo(() => {\n const selectedTimeKey = dateToKey(selectedTime);\n const selectedOption = options.find(date => date.key === selectedTimeKey);\n return selectedOption ? [selectedOption.key] : [];\n }, [options, selectedTime]);\n\n const handleOptionSelect: ComboboxProps['onOptionSelect'] = useEventCallback((e, data) => {\n if (freeform && data.optionValue === undefined) {\n // Combobox clears selection when input value not matching any option; but we allow this case in freeform TimePicker.\n return;\n }\n const timeSelectionData: TimeSelectionData = {\n selectedTime: keyToDate(data.optionValue ?? ''),\n selectedTimeText: data.optionText,\n errorType: undefined,\n };\n selectTime(e, timeSelectionData);\n });\n\n const baseState = useCombobox_unstable(\n {\n autoComplete: 'off',\n ...rest,\n selectedOptions,\n onOptionSelect: handleOptionSelect,\n children: options.map(date => (\n <Option key={date.key} value={date.key}>\n {date.text}\n </Option>\n )),\n },\n ref,\n );\n\n const defaultParseTimeStringToDate = React.useCallback(\n (time: string | undefined) =>\n getDateFromTimeString(time, dateStartAnchor, dateEndAnchor, { hourCycle, showSeconds }),\n [dateEndAnchor, dateStartAnchor, hourCycle, showSeconds],\n );\n\n const state: TimePickerState = {\n ...baseState,\n freeform,\n parseTimeStringToDate: parseTimeStringToDateInProps ?? defaultParseTimeStringToDate,\n submittedText,\n };\n\n useDefaultChevronIconLabel(state);\n useSelectTimeFromValue(state, selectTime);\n\n return state;\n};\n\n/**\n * Provides stable start and end date anchors based on the provided date and time parameters.\n * The hook ensures that the memoization remains consistent even if new Date objects representing the same date are provided.\n */\nconst useStableDateAnchor = (providedDate: Date | undefined, startHour: Hour, endHour: Hour) => {\n const [fallbackDateAnchor] = React.useState(() => new Date());\n\n const providedDateKey = dateToKey(providedDate ?? null);\n\n return React.useMemo(() => {\n const dateAnchor = providedDate ?? fallbackDateAnchor;\n\n const dateStartAnchor = getDateStartAnchor(dateAnchor, startHour);\n const dateEndAnchor = getDateEndAnchor(dateAnchor, startHour, endHour);\n\n return { dateStartAnchor, dateEndAnchor };\n // `providedDate`'s stable key representation is used as dependency instead of the Date object. This ensures that the memoization remains stable when a new Date object representing the same date is passed in.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [endHour, fallbackDateAnchor, providedDateKey, startHour]);\n};\n\n/**\n * Mimics the behavior of the browser's change event for a freeform TimePicker.\n * The provided callback is called when input changed and:\n * - Enter/Tab key is pressed on the input.\n * - TimePicker loses focus, signifying a possible change.\n */\nconst useSelectTimeFromValue = (state: TimePickerState, callback: TimePickerProps['onTimeChange']) => {\n const { getOptionById, freeform, parseTimeStringToDate, submittedText, value, activeDescendantController } = state;\n const getActiveOption = React.useCallback(() => {\n const activeOptionId = activeDescendantController.active();\n return activeOptionId ? getOptionById(activeOptionId) : null;\n }, [activeDescendantController, getOptionById]);\n\n // Base Combobox has activeOption default to first option in dropdown even if it doesn't match input value, and Enter key will select it.\n // This effect ensures that the activeOption is cleared when the input doesn't match any option.\n // This behavior is specific to a freeform TimePicker where the input value is treated as a valid time even if it's not in the dropdown.\n React.useEffect(() => {\n if (freeform && value) {\n const activeOption = getActiveOption();\n if (!activeOption) {\n return;\n }\n\n const valueMatchesActiveOption = activeOption.text.toLowerCase().indexOf(value.toLowerCase()) === 0;\n if (!valueMatchesActiveOption) {\n activeDescendantController.blur();\n }\n }\n }, [freeform, value, activeDescendantController, getActiveOption]);\n\n const selectTimeFromValue = useEventCallback(\n (e: React.KeyboardEvent<HTMLInputElement> | React.FocusEvent<HTMLInputElement>) => {\n if (!freeform) {\n return;\n }\n\n const { date: selectedTime, errorType } = parseTimeStringToDate(value);\n\n // Only triggers callback when the text in input has changed.\n if (submittedText !== value) {\n callback?.(e, { selectedTime, selectedTimeText: value, errorType });\n }\n },\n );\n\n const handleKeyDown: ComboboxProps['onKeyDown'] = useEventCallback(e => {\n const activeOption = getActiveOption();\n if (!activeOption && e.key === Enter) {\n selectTimeFromValue(e);\n }\n });\n state.root.onKeyDown = mergeCallbacks(handleKeyDown, state.root.onKeyDown);\n\n const rootRef = React.useRef<HTMLDivElement>(null);\n state.root.ref = useMergedRefs(state.root.ref, rootRef);\n\n if (state.listbox) {\n state.listbox.tabIndex = -1; // allows it to be the relatedTarget of a blur event.\n }\n\n if (state.expandIcon) {\n state.expandIcon.tabIndex = -1; // allows it to be the relatedTarget of a blur event.\n }\n\n const handleInputBlur = useEventCallback((e: React.FocusEvent<HTMLInputElement>) => {\n const isOutside = e.relatedTarget ? !elementContains(rootRef.current, e.relatedTarget) : true;\n if (isOutside) {\n selectTimeFromValue(e);\n }\n });\n state.input.onBlur = mergeCallbacks(handleInputBlur, state.input.onBlur);\n};\n\n/**\n * Provides a default aria-labelledby for the chevron icon if the TimePicker is wrapped in a Field.\n */\nconst useDefaultChevronIconLabel = (state: TimePickerState) => {\n const fieldContext = useFieldContext();\n const chevronDefaultId = useId('timepicker-chevron-');\n const defaultLabelFromCombobox = 'Open';\n\n if (fieldContext?.labelId && state.expandIcon?.['aria-label'] === defaultLabelFromCombobox) {\n const chevronId = state.expandIcon.id ?? chevronDefaultId;\n state.expandIcon['aria-labelledby'] = `${chevronId} ${fieldContext.labelId}`;\n }\n};\n"],"names":["React","elementContains","mergeCallbacks","useControllableState","useEventCallback","useId","useMergedRefs","Enter","useCombobox_unstable","Option","useFieldContext_unstable","useFieldContext","dateToKey","keyToDate","formatDateToTimeString","defaultFormatDateToTimeString","getDateStartAnchor","getDateEndAnchor","getTimesBetween","getDateFromTimeString","useTimePicker_unstable","props","ref","dateAnchor","dateAnchorInProps","defaultSelectedTime","defaultSelectedTimeInProps","endHour","hourCycle","increment","onTimeChange","selectedTime","selectedTimeInProps","showSeconds","startHour","parseTimeStringToDate","parseTimeStringToDateInProps","rest","freeform","dateStartAnchor","dateEndAnchor","useStableDateAnchor","options","useMemo","map","time","date","key","text","setSelectedTime","state","defaultState","initialState","submittedText","setSubmittedText","useState","undefined","selectTime","e","data","selectedTimeText","selectedOptions","selectedTimeKey","selectedOption","find","handleOptionSelect","optionValue","timeSelectionData","optionText","errorType","baseState","autoComplete","onOptionSelect","children","value","defaultParseTimeStringToDate","useCallback","useDefaultChevronIconLabel","useSelectTimeFromValue","providedDate","fallbackDateAnchor","Date","providedDateKey","callback","getOptionById","activeDescendantController","getActiveOption","activeOptionId","active","useEffect","activeOption","valueMatchesActiveOption","toLowerCase","indexOf","blur","selectTimeFromValue","handleKeyDown","root","onKeyDown","rootRef","useRef","listbox","tabIndex","expandIcon","handleInputBlur","isOutside","relatedTarget","current","input","onBlur","fieldContext","chevronDefaultId","defaultLabelFromCombobox","labelId","chevronId","id"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,eAAe,EACfC,cAAc,EACdC,oBAAoB,EACpBC,gBAAgB,EAChBC,KAAK,EACLC,aAAa,QACR,4BAA4B;AACnC,SAASC,KAAK,QAAQ,0BAA0B;AAEhD,SAAwBC,oBAAoB,EAAEC,MAAM,QAAQ,2BAA2B;AACvF,SAASC,4BAA4BC,eAAe,QAAQ,wBAAwB;AACpF,SACEC,SAAS,EACTC,SAAS,EACTC,0BAA0BC,6BAA6B,EACvDC,kBAAkB,EAClBC,gBAAgB,EAChBC,eAAe,EACfC,qBAAqB,QAChB,aAAa;AAEpB;;;;;;;;CAQC,GACD,OAAO,MAAMC,yBAAyB,CAACC,OAAwBC;IAC7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MAAMqD,UAAU,CAAC,kBAAkB,GAAG,CAAC,EAAEW,UAAU,CAAC,EAAEJ,aAAaG,OAAO,CAAC,CAAC;IAC9E;AACF"}
1
+ {"version":3,"sources":["useTimePicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n elementContains,\n mergeCallbacks,\n useControllableState,\n useEventCallback,\n useId,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport { Enter } from '@fluentui/keyboard-keys';\nimport type { Hour, TimePickerOption, TimePickerProps, TimePickerState, TimeSelectionData } from './TimePicker.types';\nimport { ComboboxProps, useCombobox_unstable, Option } from '@fluentui/react-combobox';\nimport { useFieldContext_unstable as useFieldContext } from '@fluentui/react-field';\nimport {\n dateToKey,\n keyToDate,\n formatDateToTimeString as defaultFormatDateToTimeString,\n getDateStartAnchor,\n getDateEndAnchor,\n getTimesBetween,\n getDateFromTimeString,\n} from './timeMath';\n\n/**\n * Create the state required to render TimePicker.\n *\n * The returned state can be modified with hooks such as useTimePickerStyles_unstable,\n * before being passed to renderTimePicker_unstable.\n *\n * @param props - props from this instance of TimePicker\n * @param ref - reference to root HTMLElement of TimePicker\n */\nexport const useTimePicker_unstable = (props: TimePickerProps, ref: React.Ref<HTMLInputElement>): TimePickerState => {\n const {\n dateAnchor: dateAnchorInProps,\n defaultSelectedTime: defaultSelectedTimeInProps,\n endHour = 24,\n formatDateToTimeString = defaultFormatDateToTimeString,\n hourCycle,\n increment = 30,\n onTimeChange,\n selectedTime: selectedTimeInProps,\n showSeconds = false,\n startHour = 0,\n parseTimeStringToDate: parseTimeStringToDateInProps,\n ...rest\n } = props;\n const { freeform = false } = rest;\n\n const { dateStartAnchor, dateEndAnchor } = useStableDateAnchor(\n dateAnchorInProps ?? selectedTimeInProps ?? defaultSelectedTimeInProps,\n startHour,\n endHour,\n );\n\n const options: TimePickerOption[] = React.useMemo(\n () =>\n getTimesBetween(dateStartAnchor, dateEndAnchor, increment).map(time => ({\n date: time,\n key: dateToKey(time),\n text: formatDateToTimeString(time, { showSeconds, hourCycle }),\n })),\n [dateEndAnchor, dateStartAnchor, formatDateToTimeString, hourCycle, increment, showSeconds],\n );\n\n const [selectedTime, setSelectedTime] = useControllableState<Date | null>({\n state: selectedTimeInProps,\n defaultState: defaultSelectedTimeInProps,\n initialState: null,\n });\n\n const [submittedText, setSubmittedText] = React.useState<string | undefined>(undefined);\n\n const selectTime: TimePickerProps['onTimeChange'] = useEventCallback((e, data) => {\n setSelectedTime(data.selectedTime);\n setSubmittedText(data.selectedTimeText);\n onTimeChange?.(e, data);\n });\n\n const selectedOptions = React.useMemo(() => {\n const selectedTimeKey = dateToKey(selectedTime);\n const selectedOption = options.find(date => date.key === selectedTimeKey);\n return selectedOption ? [selectedOption.key] : [];\n }, [options, selectedTime]);\n\n const clearIconRef = React.useRef<HTMLSpanElement>(null);\n const handleOptionSelect: ComboboxProps['onOptionSelect'] = useEventCallback((e, data) => {\n if (\n freeform &&\n data.optionValue === undefined &&\n !(rest.clearable && e.type === 'click' && e.currentTarget === clearIconRef.current)\n ) {\n // Combobox clears selection when input value not matching any option; but we allow this case in freeform TimePicker.\n return;\n }\n const timeSelectionData: TimeSelectionData = {\n selectedTime: keyToDate(data.optionValue ?? ''),\n selectedTimeText: data.optionText,\n errorType: undefined,\n };\n selectTime(e, timeSelectionData);\n });\n\n const baseState = useCombobox_unstable(\n {\n autoComplete: 'off',\n ...rest,\n selectedOptions,\n onOptionSelect: handleOptionSelect,\n children: options.map(date => (\n <Option key={date.key} value={date.key}>\n {date.text}\n </Option>\n )),\n },\n ref,\n );\n\n const defaultParseTimeStringToDate = React.useCallback(\n (time: string | undefined) =>\n getDateFromTimeString(time, dateStartAnchor, dateEndAnchor, { hourCycle, showSeconds }),\n [dateEndAnchor, dateStartAnchor, hourCycle, showSeconds],\n );\n\n const mergedClearIconRef = useMergedRefs(baseState.clearIcon?.ref, clearIconRef);\n const state: TimePickerState = {\n ...baseState,\n clearIcon: baseState.clearIcon\n ? {\n ...baseState.clearIcon,\n ref: mergedClearIconRef,\n }\n : undefined,\n freeform,\n parseTimeStringToDate: parseTimeStringToDateInProps ?? defaultParseTimeStringToDate,\n submittedText,\n };\n\n useDefaultChevronIconLabel(state);\n useSelectTimeFromValue(state, selectTime);\n\n return state;\n};\n\n/**\n * Provides stable start and end date anchors based on the provided date and time parameters.\n * The hook ensures that the memoization remains consistent even if new Date objects representing the same date are provided.\n */\nconst useStableDateAnchor = (providedDate: Date | undefined, startHour: Hour, endHour: Hour) => {\n const [fallbackDateAnchor] = React.useState(() => new Date());\n\n const providedDateKey = dateToKey(providedDate ?? null);\n\n return React.useMemo(() => {\n const dateAnchor = providedDate ?? fallbackDateAnchor;\n\n const dateStartAnchor = getDateStartAnchor(dateAnchor, startHour);\n const dateEndAnchor = getDateEndAnchor(dateAnchor, startHour, endHour);\n\n return { dateStartAnchor, dateEndAnchor };\n // `providedDate`'s stable key representation is used as dependency instead of the Date object. This ensures that the memoization remains stable when a new Date object representing the same date is passed in.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [endHour, fallbackDateAnchor, providedDateKey, startHour]);\n};\n\n/**\n * Mimics the behavior of the browser's change event for a freeform TimePicker.\n * The provided callback is called when input changed and:\n * - Enter/Tab key is pressed on the input.\n * - TimePicker loses focus, signifying a possible change.\n */\nconst useSelectTimeFromValue = (state: TimePickerState, callback: TimePickerProps['onTimeChange']) => {\n const { getOptionById, freeform, parseTimeStringToDate, submittedText, value, activeDescendantController } = state;\n const getActiveOption = React.useCallback(() => {\n const activeOptionId = activeDescendantController.active();\n return activeOptionId ? getOptionById(activeOptionId) : null;\n }, [activeDescendantController, getOptionById]);\n\n // Base Combobox has activeOption default to first option in dropdown even if it doesn't match input value, and Enter key will select it.\n // This effect ensures that the activeOption is cleared when the input doesn't match any option.\n // This behavior is specific to a freeform TimePicker where the input value is treated as a valid time even if it's not in the dropdown.\n React.useEffect(() => {\n if (freeform && value) {\n const activeOption = getActiveOption();\n if (!activeOption) {\n return;\n }\n\n const valueMatchesActiveOption = activeOption.text.toLowerCase().indexOf(value.toLowerCase()) === 0;\n if (!valueMatchesActiveOption) {\n activeDescendantController.blur();\n }\n }\n }, [freeform, value, activeDescendantController, getActiveOption]);\n\n const selectTimeFromValue = useEventCallback(\n (e: React.KeyboardEvent<HTMLInputElement> | React.FocusEvent<HTMLInputElement>) => {\n if (!freeform) {\n return;\n }\n\n const { date: selectedTime, errorType } = parseTimeStringToDate(value);\n\n // Only triggers callback when the text in input has changed.\n if (submittedText !== value) {\n callback?.(e, { selectedTime, selectedTimeText: value, errorType });\n }\n },\n );\n\n const handleKeyDown: ComboboxProps['onKeyDown'] = useEventCallback(e => {\n const activeOption = getActiveOption();\n if (!activeOption && e.key === Enter) {\n selectTimeFromValue(e);\n }\n });\n state.root.onKeyDown = mergeCallbacks(handleKeyDown, state.root.onKeyDown);\n\n const rootRef = React.useRef<HTMLDivElement>(null);\n state.root.ref = useMergedRefs(state.root.ref, rootRef);\n\n if (state.listbox) {\n state.listbox.tabIndex = -1; // allows it to be the relatedTarget of a blur event.\n }\n\n if (state.expandIcon) {\n state.expandIcon.tabIndex = -1; // allows it to be the relatedTarget of a blur event.\n }\n\n const handleInputBlur = useEventCallback((e: React.FocusEvent<HTMLInputElement>) => {\n const isOutside = e.relatedTarget ? !elementContains(rootRef.current, e.relatedTarget) : true;\n if (isOutside) {\n selectTimeFromValue(e);\n }\n });\n state.input.onBlur = mergeCallbacks(handleInputBlur, state.input.onBlur);\n};\n\n/**\n * Provides a default aria-labelledby for the chevron icon if the TimePicker is wrapped in a Field.\n */\nconst useDefaultChevronIconLabel = (state: TimePickerState) => {\n const fieldContext = useFieldContext();\n const chevronDefaultId = useId('timepicker-chevron-');\n const defaultLabelFromCombobox = 'Open';\n\n if (fieldContext?.labelId && state.expandIcon?.['aria-label'] === defaultLabelFromCombobox) {\n const chevronId = state.expandIcon.id ?? chevronDefaultId;\n state.expandIcon['aria-labelledby'] = `${chevronId} ${fieldContext.labelId}`;\n }\n};\n"],"names":["React","elementContains","mergeCallbacks","useControllableState","useEventCallback","useId","useMergedRefs","Enter","useCombobox_unstable","Option","useFieldContext_unstable","useFieldContext","dateToKey","keyToDate","formatDateToTimeString","defaultFormatDateToTimeString","getDateStartAnchor","getDateEndAnchor","getTimesBetween","getDateFromTimeString","useTimePicker_unstable","props","ref","baseState","dateAnchor","dateAnchorInProps","defaultSelectedTime","defaultSelectedTimeInProps","endHour","hourCycle","increment","onTimeChange","selectedTime","selectedTimeInProps","showSeconds","startHour","parseTimeStringToDate","parseTimeStringToDateInProps","rest","freeform","dateStartAnchor","dateEndAnchor","useStableDateAnchor","options","useMemo","map","time","date","key","text","setSelectedTime","state","defaultState","initialState","submittedText","setSubmittedText","useState","undefined","selectTime","e","data","selectedTimeText","selectedOptions","selectedTimeKey","selectedOption","find","clearIconRef","useRef","handleOptionSelect","optionValue","clearable","type","currentTarget","current","timeSelectionData","optionText","errorType","autoComplete","onOptionSelect","children","value","defaultParseTimeStringToDate","useCallback","mergedClearIconRef","clearIcon","useDefaultChevronIconLabel","useSelectTimeFromValue","providedDate","fallbackDateAnchor","Date","providedDateKey","callback","getOptionById","activeDescendantController","getActiveOption","activeOptionId","active","useEffect","activeOption","valueMatchesActiveOption","toLowerCase","indexOf","blur","selectTimeFromValue","handleKeyDown","root","onKeyDown","rootRef","listbox","tabIndex","expandIcon","handleInputBlur","isOutside","relatedTarget","input","onBlur","fieldContext","chevronDefaultId","defaultLabelFromCombobox","labelId","chevronId","id"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,eAAe,EACfC,cAAc,EACdC,oBAAoB,EACpBC,gBAAgB,EAChBC,KAAK,EACLC,aAAa,QACR,4BAA4B;AACnC,SAASC,KAAK,QAAQ,0BAA0B;AAEhD,SAAwBC,oBAAoB,EAAEC,MAAM,QAAQ,2BAA2B;AACvF,SAASC,4BAA4BC,eAAe,QAAQ,wBAAwB;AACpF,SACEC,SAAS,EACTC,SAAS,EACTC,0BAA0BC,6BAA6B,EACvDC,k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F;IACAR,MAAM+D,KAAK,CAACC,MAAM,GAAGjH,eAAe6G,iBAAiB5D,MAAM+D,KAAK,CAACC,MAAM;AACzE;AAEA;;CAEC,GACD,MAAM9B,6BAA6B,CAAClC;QAKLA;IAJ7B,MAAMiE,eAAezG;IACrB,MAAM0G,mBAAmBhH,MAAM;IAC/B,MAAMiH,2BAA2B;IAEjC,IAAIF,CAAAA,yBAAAA,mCAAAA,aAAcG,OAAO,KAAIpE,EAAAA,oBAAAA,MAAM2D,UAAU,cAAhB3D,wCAAAA,iBAAkB,CAAC,aAAa,MAAKmE,0BAA0B;YACxEnE;QAAlB,MAAMqE,YAAYrE,CAAAA,uBAAAA,MAAM2D,UAAU,CAACW,EAAE,cAAnBtE,kCAAAA,uBAAuBkE;QACzClE,MAAM2D,UAAU,CAAC,kBAAkB,GAAG,CAAC,EAAEU,UAAU,CAAC,EAAEJ,aAAaG,OAAO,CAAC,CAAC;IAC9E;AACF"}
@@ -16,6 +16,7 @@ const _reactcombobox = require("@fluentui/react-combobox");
16
16
  const _reactfield = require("@fluentui/react-field");
17
17
  const _timeMath = require("./timeMath");
18
18
  const useTimePicker_unstable = (props, ref)=>{
19
+ var _baseState_clearIcon;
19
20
  const { dateAnchor: dateAnchorInProps, defaultSelectedTime: defaultSelectedTimeInProps, endHour = 24, formatDateToTimeString = _timeMath.formatDateToTimeString, hourCycle, increment = 30, onTimeChange, selectedTime: selectedTimeInProps, showSeconds = false, startHour = 0, parseTimeStringToDate: parseTimeStringToDateInProps, ...rest } = props;
20
21
  const { freeform = false } = rest;
21
22
  var _ref;
@@ -56,8 +57,9 @@ const useTimePicker_unstable = (props, ref)=>{
56
57
  options,
57
58
  selectedTime
58
59
  ]);
60
+ const clearIconRef = _react.useRef(null);
59
61
  const handleOptionSelect = (0, _reactutilities.useEventCallback)((e, data)=>{
60
- if (freeform && data.optionValue === undefined) {
62
+ if (freeform && data.optionValue === undefined && !(rest.clearable && e.type === 'click' && e.currentTarget === clearIconRef.current)) {
61
63
  // Combobox clears selection when input value not matching any option; but we allow this case in freeform TimePicker.
62
64
  return;
63
65
  }
@@ -88,8 +90,13 @@ const useTimePicker_unstable = (props, ref)=>{
88
90
  hourCycle,
89
91
  showSeconds
90
92
  ]);
93
+ const mergedClearIconRef = (0, _reactutilities.useMergedRefs)((_baseState_clearIcon = baseState.clearIcon) === null || _baseState_clearIcon === void 0 ? void 0 : _baseState_clearIcon.ref, clearIconRef);
91
94
  const state = {
92
95
  ...baseState,
96
+ clearIcon: baseState.clearIcon ? {
97
+ ...baseState.clearIcon,
98
+ ref: mergedClearIconRef
99
+ } : undefined,
93
100
  freeform,
94
101
  parseTimeStringToDate: parseTimeStringToDateInProps !== null && parseTimeStringToDateInProps !== void 0 ? parseTimeStringToDateInProps : defaultParseTimeStringToDate,
95
102
  submittedText
@@ -1 +1 @@
1
- {"version":3,"sources":["useTimePicker.js"],"sourcesContent":["import * as React from 'react';\nimport { elementContains, mergeCallbacks, useControllableState, useEventCallback, useId, useMergedRefs } from '@fluentui/react-utilities';\nimport { Enter } from '@fluentui/keyboard-keys';\nimport { useCombobox_unstable, Option } from '@fluentui/react-combobox';\nimport { useFieldContext_unstable as useFieldContext } from '@fluentui/react-field';\nimport { dateToKey, keyToDate, formatDateToTimeString as defaultFormatDateToTimeString, getDateStartAnchor, getDateEndAnchor, getTimesBetween, getDateFromTimeString } from './timeMath';\n/**\n * Create the state required to render TimePicker.\n *\n * The returned state can be modified with hooks such as useTimePickerStyles_unstable,\n * before being passed to renderTimePicker_unstable.\n *\n * @param props - props from this instance of TimePicker\n * @param ref - reference to root HTMLElement of TimePicker\n */ export const useTimePicker_unstable = (props, ref)=>{\n const { dateAnchor: dateAnchorInProps, defaultSelectedTime: defaultSelectedTimeInProps, endHour = 24, formatDateToTimeString = defaultFormatDateToTimeString, hourCycle, increment = 30, onTimeChange, selectedTime: selectedTimeInProps, showSeconds = false, startHour = 0, parseTimeStringToDate: parseTimeStringToDateInProps, ...rest } = props;\n const { freeform = false } = rest;\n var _ref;\n const { dateStartAnchor, dateEndAnchor } = useStableDateAnchor((_ref = dateAnchorInProps !== null && dateAnchorInProps !== void 0 ? dateAnchorInProps : selectedTimeInProps) !== null && _ref !== void 0 ? _ref : defaultSelectedTimeInProps, startHour, endHour);\n const options = React.useMemo(()=>getTimesBetween(dateStartAnchor, dateEndAnchor, increment).map((time)=>({\n date: time,\n key: dateToKey(time),\n text: formatDateToTimeString(time, {\n showSeconds,\n hourCycle\n })\n })), [\n dateEndAnchor,\n dateStartAnchor,\n formatDateToTimeString,\n hourCycle,\n increment,\n showSeconds\n ]);\n const [selectedTime, setSelectedTime] = useControllableState({\n state: selectedTimeInProps,\n defaultState: defaultSelectedTimeInProps,\n initialState: null\n });\n const [submittedText, setSubmittedText] = React.useState(undefined);\n const selectTime = useEventCallback((e, data)=>{\n setSelectedTime(data.selectedTime);\n setSubmittedText(data.selectedTimeText);\n onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(e, data);\n });\n const selectedOptions = React.useMemo(()=>{\n const selectedTimeKey = dateToKey(selectedTime);\n const selectedOption = options.find((date)=>date.key === selectedTimeKey);\n return selectedOption ? [\n selectedOption.key\n ] : [];\n }, [\n options,\n selectedTime\n ]);\n const handleOptionSelect = useEventCallback((e, data)=>{\n if (freeform && data.optionValue === undefined) {\n // Combobox clears selection when input value not matching any option; but we allow this case in freeform TimePicker.\n return;\n }\n var _data_optionValue;\n const timeSelectionData = {\n selectedTime: keyToDate((_data_optionValue = data.optionValue) !== null && _data_optionValue !== void 0 ? _data_optionValue : ''),\n selectedTimeText: data.optionText,\n errorType: undefined\n };\n selectTime(e, timeSelectionData);\n });\n const baseState = useCombobox_unstable({\n autoComplete: 'off',\n ...rest,\n selectedOptions,\n onOptionSelect: handleOptionSelect,\n children: options.map((date)=>/*#__PURE__*/ React.createElement(Option, {\n key: date.key,\n value: date.key\n }, date.text))\n }, ref);\n const defaultParseTimeStringToDate = React.useCallback((time)=>getDateFromTimeString(time, dateStartAnchor, dateEndAnchor, {\n hourCycle,\n showSeconds\n }), [\n dateEndAnchor,\n dateStartAnchor,\n hourCycle,\n showSeconds\n ]);\n const state = {\n ...baseState,\n freeform,\n parseTimeStringToDate: parseTimeStringToDateInProps !== null && parseTimeStringToDateInProps !== void 0 ? parseTimeStringToDateInProps : defaultParseTimeStringToDate,\n submittedText\n };\n useDefaultChevronIconLabel(state);\n useSelectTimeFromValue(state, selectTime);\n return state;\n};\n/**\n * Provides stable start and end date anchors based on the provided date and time parameters.\n * The hook ensures that the memoization remains consistent even if new Date objects representing the same date are provided.\n */ const useStableDateAnchor = (providedDate, startHour, endHour)=>{\n const [fallbackDateAnchor] = React.useState(()=>new Date());\n const providedDateKey = dateToKey(providedDate !== null && providedDate !== void 0 ? providedDate : null);\n return React.useMemo(()=>{\n const dateAnchor = providedDate !== null && providedDate !== void 0 ? providedDate : fallbackDateAnchor;\n const dateStartAnchor = getDateStartAnchor(dateAnchor, startHour);\n const dateEndAnchor = getDateEndAnchor(dateAnchor, startHour, endHour);\n return {\n dateStartAnchor,\n dateEndAnchor\n };\n // `providedDate`'s stable key representation is used as dependency instead of the Date object. This ensures that the memoization remains stable when a new Date object representing the same date is passed in.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n endHour,\n fallbackDateAnchor,\n providedDateKey,\n startHour\n ]);\n};\n/**\n * Mimics the behavior of the browser's change event for a freeform TimePicker.\n * The provided callback is called when input changed and:\n * - Enter/Tab key is pressed on the input.\n * - TimePicker loses focus, signifying a possible change.\n */ const useSelectTimeFromValue = (state, callback)=>{\n const { getOptionById, freeform, parseTimeStringToDate, submittedText, value, activeDescendantController } = state;\n const getActiveOption = React.useCallback(()=>{\n const activeOptionId = activeDescendantController.active();\n return activeOptionId ? getOptionById(activeOptionId) : null;\n }, [\n activeDescendantController,\n getOptionById\n ]);\n // Base Combobox has activeOption default to first option in dropdown even if it doesn't match input value, and Enter key will select it.\n // This effect ensures that the activeOption is cleared when the input doesn't match any option.\n // This behavior is specific to a freeform TimePicker where the input value is treated as a valid time even if it's not in the dropdown.\n React.useEffect(()=>{\n if (freeform && value) {\n const activeOption = getActiveOption();\n if (!activeOption) {\n return;\n }\n const valueMatchesActiveOption = activeOption.text.toLowerCase().indexOf(value.toLowerCase()) === 0;\n if (!valueMatchesActiveOption) {\n activeDescendantController.blur();\n }\n }\n }, [\n freeform,\n value,\n activeDescendantController,\n getActiveOption\n ]);\n const selectTimeFromValue = useEventCallback((e)=>{\n if (!freeform) {\n return;\n }\n const { date: selectedTime, errorType } = parseTimeStringToDate(value);\n // Only triggers callback when the text in input has changed.\n if (submittedText !== value) {\n callback === null || callback === void 0 ? void 0 : callback(e, {\n selectedTime,\n selectedTimeText: value,\n errorType\n });\n }\n });\n const handleKeyDown = useEventCallback((e)=>{\n const activeOption = getActiveOption();\n if (!activeOption && e.key === Enter) {\n selectTimeFromValue(e);\n }\n });\n state.root.onKeyDown = mergeCallbacks(handleKeyDown, state.root.onKeyDown);\n const rootRef = React.useRef(null);\n state.root.ref = useMergedRefs(state.root.ref, rootRef);\n if (state.listbox) {\n state.listbox.tabIndex = -1; // allows it to be the relatedTarget of a blur event.\n }\n if (state.expandIcon) {\n state.expandIcon.tabIndex = -1; // allows it to be the relatedTarget of a blur event.\n }\n const handleInputBlur = useEventCallback((e)=>{\n const isOutside = e.relatedTarget ? !elementContains(rootRef.current, e.relatedTarget) : true;\n if (isOutside) {\n selectTimeFromValue(e);\n }\n });\n state.input.onBlur = mergeCallbacks(handleInputBlur, state.input.onBlur);\n};\n/**\n * Provides a default aria-labelledby for the chevron icon if the TimePicker is wrapped in a Field.\n */ const useDefaultChevronIconLabel = (state)=>{\n var _state_expandIcon;\n const fieldContext = useFieldContext();\n const chevronDefaultId = useId('timepicker-chevron-');\n const defaultLabelFromCombobox = 'Open';\n if ((fieldContext === null || fieldContext === void 0 ? void 0 : fieldContext.labelId) && ((_state_expandIcon = state.expandIcon) === null || _state_expandIcon === void 0 ? void 0 : _state_expandIcon['aria-label']) === defaultLabelFromCombobox) {\n var _state_expandIcon_id;\n const chevronId = (_state_expandIcon_id = state.expandIcon.id) !== null && _state_expandIcon_id !== void 0 ? _state_expandIcon_id : chevronDefaultId;\n state.expandIcon['aria-labelledby'] = `${chevronId} ${fieldContext.labelId}`;\n }\n};\n"],"names":["useTimePicker_unstable","props","ref","dateAnchor","dateAnchorInProps","defaultSelectedTime","defaultSelectedTimeInProps","endHour","formatDateToTimeString","defaultFormatDateToTimeString","hourCycle","increment","onTimeChange","selectedTime","selectedTimeInProps","showSeconds","startHour","parseTimeStringToDate","parseTimeStringToDateInProps","rest","freeform","_ref","dateStartAnchor","dateEndAnchor","useStableDateAnchor","options","React","useMemo","getTimesBetween","map","time","date","key","dateToKey","text","setSelectedTime","useControllableState","state","defaultState","initialState","submittedText","setSubmittedText","useState","undefined","selectTime","useEventCallback","e","data","selectedTimeText","selectedOptions","selectedTimeKey","selectedOption","find","handleOptionSelect","optionValue","_data_optionValue","timeSelectionData","keyToDate","optionText","errorType","baseState","useCombobox_unstable","autoComplete","onOptionSelect","children","createElement","Option","value","defaultParseTimeStringToDate","useCallback","getDateFromTimeString","useDefaultChevronIconLabel","useSelectTimeFromValue","providedDate","fallbackDateAnchor","Date","providedDateKey","getDateStartAnchor","getDateEndAnchor","callback","getOptionById","activeDescendantController","getActiveOption","activeOptionId","active","useEffect","activeOption","valueMatchesActiveOption","toLowerCase","indexOf","blur","selectTimeFromValue","handleKeyDown","Enter","root","onKeyDown","mergeCallbacks","rootRef","useRef","useMergedRefs","listbox","tabIndex","expandIcon","handleInputBlur","isOutside","relatedTarget","elementContains","current","input","onBlur","_state_expandIcon","fieldContext","useFieldContext","chevronDefaultId","useId","defaultLabelFromCombobox","labelId","_state_expandIcon_id","chevronId","id"],"mappings":";;;;+BAciBA;;;eAAAA;;;;iEAdM;gCACuF;8BACxF;+BACuB;4BACe;0BACgH;AASjK,MAAMA,yBAAyB,CAACC,OAAOC;IAC9C,MAAM,EAAEC,YAAYC,iBAAiB,EA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MtC,6BAA6B,CAAClC;IACpC,IAAIyE;IACJ,MAAMC,eAAeC,IAAAA,oCAAe;IACpC,MAAMC,mBAAmBC,IAAAA,qBAAK,EAAC;IAC/B,MAAMC,2BAA2B;IACjC,IAAI,AAACJ,CAAAA,iBAAiB,QAAQA,iBAAiB,KAAK,IAAI,KAAK,IAAIA,aAAaK,OAAO,AAAD,KAAM,AAAC,CAAA,AAACN,CAAAA,oBAAoBzE,MAAMiE,UAAU,AAAD,MAAO,QAAQQ,sBAAsB,KAAK,IAAI,KAAK,IAAIA,iBAAiB,CAAC,aAAa,AAAD,MAAOK,0BAA0B;QACjP,IAAIE;QACJ,MAAMC,YAAY,AAACD,CAAAA,uBAAuBhF,MAAMiE,UAAU,CAACiB,EAAE,AAAD,MAAO,QAAQF,yBAAyB,KAAK,IAAIA,uBAAuBJ;QACpI5E,MAAMiE,UAAU,CAAC,kBAAkB,GAAG,CAAC,EAAEgB,UAAU,CAAC,EAAEP,aAAaK,OAAO,CAAC,CAAC;IAChF;AACJ"}
1
+ {"version":3,"sources":["useTimePicker.js"],"sourcesContent":["import * as React from 'react';\nimport { elementContains, mergeCallbacks, useControllableState, useEventCallback, useId, useMergedRefs } from '@fluentui/react-utilities';\nimport { Enter } from '@fluentui/keyboard-keys';\nimport { useCombobox_unstable, Option } from '@fluentui/react-combobox';\nimport { useFieldContext_unstable as useFieldContext } from '@fluentui/react-field';\nimport { dateToKey, keyToDate, formatDateToTimeString as defaultFormatDateToTimeString, getDateStartAnchor, getDateEndAnchor, getTimesBetween, getDateFromTimeString } from './timeMath';\n/**\n * Create the state required to render TimePicker.\n *\n * The returned state can be modified with hooks such as useTimePickerStyles_unstable,\n * before being passed to renderTimePicker_unstable.\n *\n * @param props - props from this instance of TimePicker\n * @param ref - reference to root HTMLElement of TimePicker\n */ export const useTimePicker_unstable = (props, ref)=>{\n var _baseState_clearIcon;\n const { dateAnchor: dateAnchorInProps, defaultSelectedTime: defaultSelectedTimeInProps, endHour = 24, formatDateToTimeString = defaultFormatDateToTimeString, hourCycle, increment = 30, onTimeChange, selectedTime: selectedTimeInProps, showSeconds = false, startHour = 0, parseTimeStringToDate: parseTimeStringToDateInProps, ...rest } = props;\n const { freeform = false } = rest;\n var _ref;\n const { dateStartAnchor, dateEndAnchor } = useStableDateAnchor((_ref = dateAnchorInProps !== null && dateAnchorInProps !== void 0 ? dateAnchorInProps : selectedTimeInProps) !== null && _ref !== void 0 ? _ref : defaultSelectedTimeInProps, startHour, endHour);\n const options = React.useMemo(()=>getTimesBetween(dateStartAnchor, dateEndAnchor, increment).map((time)=>({\n date: time,\n key: dateToKey(time),\n text: formatDateToTimeString(time, {\n showSeconds,\n hourCycle\n })\n })), [\n dateEndAnchor,\n dateStartAnchor,\n formatDateToTimeString,\n hourCycle,\n increment,\n showSeconds\n ]);\n const [selectedTime, setSelectedTime] = useControllableState({\n state: selectedTimeInProps,\n defaultState: defaultSelectedTimeInProps,\n initialState: null\n });\n const [submittedText, setSubmittedText] = React.useState(undefined);\n const selectTime = useEventCallback((e, data)=>{\n setSelectedTime(data.selectedTime);\n setSubmittedText(data.selectedTimeText);\n onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(e, data);\n });\n const selectedOptions = React.useMemo(()=>{\n const selectedTimeKey = dateToKey(selectedTime);\n const selectedOption = options.find((date)=>date.key === selectedTimeKey);\n return selectedOption ? [\n selectedOption.key\n ] : [];\n }, [\n options,\n selectedTime\n ]);\n const clearIconRef = React.useRef(null);\n const handleOptionSelect = useEventCallback((e, data)=>{\n if (freeform && data.optionValue === undefined && !(rest.clearable && e.type === 'click' && e.currentTarget === clearIconRef.current)) {\n // Combobox clears selection when input value not matching any option; but we allow this case in freeform TimePicker.\n return;\n }\n var _data_optionValue;\n const timeSelectionData = {\n selectedTime: keyToDate((_data_optionValue = data.optionValue) !== null && _data_optionValue !== void 0 ? _data_optionValue : ''),\n selectedTimeText: data.optionText,\n errorType: undefined\n };\n selectTime(e, timeSelectionData);\n });\n const baseState = useCombobox_unstable({\n autoComplete: 'off',\n ...rest,\n selectedOptions,\n onOptionSelect: handleOptionSelect,\n children: options.map((date)=>/*#__PURE__*/ React.createElement(Option, {\n key: date.key,\n value: date.key\n }, date.text))\n }, ref);\n const defaultParseTimeStringToDate = React.useCallback((time)=>getDateFromTimeString(time, dateStartAnchor, dateEndAnchor, {\n hourCycle,\n showSeconds\n }), [\n dateEndAnchor,\n dateStartAnchor,\n hourCycle,\n showSeconds\n ]);\n const mergedClearIconRef = useMergedRefs((_baseState_clearIcon = baseState.clearIcon) === null || _baseState_clearIcon === void 0 ? void 0 : _baseState_clearIcon.ref, clearIconRef);\n const state = {\n ...baseState,\n clearIcon: baseState.clearIcon ? {\n ...baseState.clearIcon,\n ref: mergedClearIconRef\n } : undefined,\n freeform,\n parseTimeStringToDate: parseTimeStringToDateInProps !== null && parseTimeStringToDateInProps !== void 0 ? parseTimeStringToDateInProps : defaultParseTimeStringToDate,\n submittedText\n };\n useDefaultChevronIconLabel(state);\n useSelectTimeFromValue(state, selectTime);\n return state;\n};\n/**\n * Provides stable start and end date anchors based on the provided date and time parameters.\n * The hook ensures that the memoization remains consistent even if new Date objects representing the same date are provided.\n */ const useStableDateAnchor = (providedDate, startHour, endHour)=>{\n const [fallbackDateAnchor] = React.useState(()=>new Date());\n const providedDateKey = dateToKey(providedDate !== null && providedDate !== void 0 ? providedDate : null);\n return React.useMemo(()=>{\n const dateAnchor = providedDate !== null && providedDate !== void 0 ? providedDate : fallbackDateAnchor;\n const dateStartAnchor = getDateStartAnchor(dateAnchor, startHour);\n const dateEndAnchor = getDateEndAnchor(dateAnchor, startHour, endHour);\n return {\n dateStartAnchor,\n dateEndAnchor\n };\n // `providedDate`'s stable key representation is used as dependency instead of the Date object. This ensures that the memoization remains stable when a new Date object representing the same date is passed in.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n endHour,\n fallbackDateAnchor,\n providedDateKey,\n startHour\n ]);\n};\n/**\n * Mimics the behavior of the browser's change event for a freeform TimePicker.\n * The provided callback is called when input changed and:\n * - Enter/Tab key is pressed on the input.\n * - TimePicker loses focus, signifying a possible change.\n */ const useSelectTimeFromValue = (state, callback)=>{\n const { getOptionById, freeform, parseTimeStringToDate, submittedText, value, activeDescendantController } = state;\n const getActiveOption = React.useCallback(()=>{\n const activeOptionId = activeDescendantController.active();\n return activeOptionId ? getOptionById(activeOptionId) : null;\n }, [\n activeDescendantController,\n getOptionById\n ]);\n // Base Combobox has activeOption default to first option in dropdown even if it doesn't match input value, and Enter key will select it.\n // This effect ensures that the activeOption is cleared when the input doesn't match any option.\n // This behavior is specific to a freeform TimePicker where the input value is treated as a valid time even if it's not in the dropdown.\n React.useEffect(()=>{\n if (freeform && value) {\n const activeOption = getActiveOption();\n if (!activeOption) {\n return;\n }\n const valueMatchesActiveOption = activeOption.text.toLowerCase().indexOf(value.toLowerCase()) === 0;\n if (!valueMatchesActiveOption) {\n activeDescendantController.blur();\n }\n }\n }, [\n freeform,\n value,\n activeDescendantController,\n getActiveOption\n ]);\n const selectTimeFromValue = useEventCallback((e)=>{\n if (!freeform) {\n return;\n }\n const { date: selectedTime, errorType } = parseTimeStringToDate(value);\n // Only triggers callback when the text in input has changed.\n if (submittedText !== value) {\n callback === null || callback === void 0 ? void 0 : callback(e, {\n selectedTime,\n selectedTimeText: value,\n errorType\n });\n }\n });\n const handleKeyDown = useEventCallback((e)=>{\n const activeOption = getActiveOption();\n if (!activeOption && e.key === Enter) {\n selectTimeFromValue(e);\n }\n });\n state.root.onKeyDown = mergeCallbacks(handleKeyDown, state.root.onKeyDown);\n const rootRef = React.useRef(null);\n state.root.ref = useMergedRefs(state.root.ref, rootRef);\n if (state.listbox) {\n state.listbox.tabIndex = -1; // allows it to be the relatedTarget of a blur event.\n }\n if (state.expandIcon) {\n state.expandIcon.tabIndex = -1; // allows it to be the relatedTarget of a blur event.\n }\n const handleInputBlur = useEventCallback((e)=>{\n const isOutside = e.relatedTarget ? !elementContains(rootRef.current, e.relatedTarget) : true;\n if (isOutside) {\n selectTimeFromValue(e);\n }\n });\n state.input.onBlur = mergeCallbacks(handleInputBlur, state.input.onBlur);\n};\n/**\n * Provides a default aria-labelledby for the chevron icon if the TimePicker is wrapped in a Field.\n */ const useDefaultChevronIconLabel = (state)=>{\n var _state_expandIcon;\n const fieldContext = useFieldContext();\n const chevronDefaultId = useId('timepicker-chevron-');\n const defaultLabelFromCombobox = 'Open';\n if ((fieldContext === null || fieldContext === void 0 ? void 0 : fieldContext.labelId) && ((_state_expandIcon = state.expandIcon) === null || _state_expandIcon === void 0 ? void 0 : _state_expandIcon['aria-label']) === defaultLabelFromCombobox) {\n var _state_expandIcon_id;\n const chevronId = (_state_expandIcon_id = state.expandIcon.id) !== null && _state_expandIcon_id !== void 0 ? _state_expandIcon_id : chevronDefaultId;\n state.expandIcon['aria-labelledby'] = `${chevronId} ${fieldContext.labelId}`;\n }\n};\n"],"names":["useTimePicker_unstable","props","ref","_baseState_clearIcon","dateAnchor","dateAnchorInProps","defaultSelectedTime","defaultSelectedTimeInProps","endHour","formatDateToTimeString","defaultFormatDateToTimeString","hourCycle","increment","onTimeChange","selectedTime","selectedTimeInProps","showSeconds","startHour","parseTimeStringToDate","parseTimeStringToDateInProps","rest","freeform","_ref","dateStartAnchor","dateEndAnchor","useStableDateAnchor","options","React","useMemo","getTimesBetween","map","time","date","key","dateToKey","text","setSelectedTime","useControllableState","state","defaultState","initialState","submittedText","setSubmittedText","useState","undefined","selectTime","useEventCallback","e","data","selectedTimeText","selectedOptions","selectedTimeKey","selectedOption","find","clearIconRef","useRef","handleOptionSelect","optionValue","clearable","type","currentTarget","current","_data_optionValue","timeSelectionData","keyToDate","optionText","errorType","baseState","useCombobox_unstable","autoComplete","onOptionSelect","children","createElement","Option","value","defaultParseTimeStringToDate","useCallback","getDateFromTimeString","mergedClearIconRef","useMergedRefs","clearIcon","useDefaultChevronIconLabel","useSelectTimeFromValue","providedDate","fallbackDateAnchor","Date","providedDateKey","getDateStartAnchor","getDateEndAnchor","callback","getOptionById","activeDescendantController","getActiveOption","activeOptionId","active","useEffect","activeOption","valueMatchesActiveOption","toLowerCase","indexOf","blur","selectTimeFromValue","handleKeyDown","Enter","root","onKeyDown","mergeCallbacks","rootRef","listbox","tabIndex","expandIcon","handleInputBlur","isOutside","relatedTarget","elementContains","input","onBlur","_state_expandIcon","fieldContext","useFieldContext","chevronDefaultId","useId","defaultLabelFromCombobox","labelId","_state_expandIcon_id","chevronId","id"],"mappings":";;;;+BAciBA;;;eAAAA;;;;iEAdM;gCACuF;8BACxF;+BACuB;4BACe;0BACgH;AASjK,MAAMA,yBAAyB,CAACC,OAAOC;IAC9C,IAAIC;IACJ,MAAM,EAAEC,YAAYC,iBAAiB,EAAEC,qBAAqBC,0BAA0B,EAAEC,UAAU,EAAE,EAAEC,yBAAyBC,gCAA6B,EAAEC,SAAS,EAAEC,YAAY,EAAE,EAAEC,YAAY,EAAEC,cAAcC,mBAAmB,EAAEC,cAAc,KAAK,EAAEC,YAAY,CAAC,EAAEC,uBAAuBC,4BAA4B,EAAE,GAAGC,MAAM,GAAGnB;IAC/U,MAAM,EAAEoB,WAAW,KAAK,EAAE,GAAGD;IAC7B,IAAIE;IACJ,MAAM,EAAEC,eAAe,EAAEC,aAAa,EAAE,GAAGC,oBAAoB,AAACH,CAAAA,OAAOjB,sBAAsB,QAAQA,sBAAsB,KAAK,IAAIA,oBAAoBU,mBAAkB,MAAO,QAAQO,SAAS,KAAK,IAAIA,OAAOf,4BAA4BU,WAAWT;IACzP,MAAMkB,UAAUC,OAAMC,OAAO,CAAC,IAAIC,IAAAA,yBAAe,EAACN,iBAAiBC,eAAeZ,WAAWkB,GAAG,CAAC,CAACC,OAAQ,CAAA;gBAC9FC,MAAMD;gBACNE,KAAKC,IAAAA,mBAAS,EAACH;gBACfI,MAAM1B,uBAAuBsB,MAAM;oBAC/Bf;oBACAL;gBACJ;YACJ,CAAA,IAAK;QACTa;QACAD;QACAd;QACAE;QACAC;QACAI;KACH;IACD,MAAM,C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0BAA0B;QACjP,IAAIE;QACJ,MAAMC,YAAY,AAACD,CAAAA,uBAAuBtF,MAAMwE,UAAU,CAACgB,EAAE,AAAD,MAAO,QAAQF,yBAAyB,KAAK,IAAIA,uBAAuBJ;QACpIlF,MAAMwE,UAAU,CAAC,kBAAkB,GAAG,CAAC,EAAEe,UAAU,CAAC,EAAEP,aAAaK,OAAO,CAAC,CAAC;IAChF;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-timepicker-compat",
3
- "version": "0.2.15",
3
+ "version": "0.2.17",
4
4
  "description": "Fluent UI TimePicker Compat Component",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -40,12 +40,12 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@fluentui/keyboard-keys": "^9.0.7",
43
- "@fluentui/react-combobox": "^9.11.5",
44
- "@fluentui/react-field": "^9.1.66",
45
- "@fluentui/react-jsx-runtime": "^9.0.38",
43
+ "@fluentui/react-combobox": "^9.11.7",
44
+ "@fluentui/react-field": "^9.1.67",
45
+ "@fluentui/react-jsx-runtime": "^9.0.39",
46
46
  "@fluentui/react-shared-contexts": "^9.19.0",
47
47
  "@fluentui/react-theme": "^9.1.19",
48
- "@fluentui/react-utilities": "^9.18.9",
48
+ "@fluentui/react-utilities": "^9.18.10",
49
49
  "@griffel/react": "^1.5.22",
50
50
  "@swc/helpers": "^0.5.1"
51
51
  },