@fluentui/react-datepicker-compat 0.0.0 → 0.1.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.json +191 -5
- package/CHANGELOG.md +49 -6
- package/README.md +1 -1
- package/dist/index.d.ts +13 -8
- package/lib/components/Calendar/Calendar.js +1 -1
- package/lib/components/Calendar/Calendar.js.map +1 -1
- package/lib/components/Calendar/index.js +1 -1
- package/lib/components/Calendar/index.js.map +1 -1
- package/lib/components/Calendar/{useCalendarStyles.js → useCalendarStyles.styles.js} +1 -1
- package/lib/components/Calendar/useCalendarStyles.styles.js.map +1 -0
- package/lib/components/CalendarDay/CalendarDay.js +1 -1
- package/lib/components/CalendarDay/CalendarDay.js.map +1 -1
- package/lib/components/CalendarDay/index.js +1 -1
- package/lib/components/CalendarDay/index.js.map +1 -1
- package/lib/components/CalendarDay/{useCalendarDayStyles.js → useCalendarDayStyles.styles.js} +1 -1
- package/lib/components/CalendarDay/useCalendarDayStyles.styles.js.map +1 -0
- package/lib/components/CalendarDayGrid/CalendarDayGrid.js +2 -2
- package/lib/components/CalendarDayGrid/CalendarDayGrid.js.map +1 -1
- package/lib/components/CalendarDayGrid/CalendarGridDayCell.js +2 -2
- package/lib/components/CalendarDayGrid/CalendarGridDayCell.js.map +1 -1
- package/lib/components/CalendarDayGrid/CalendarGridRow.js.map +1 -1
- package/lib/components/CalendarDayGrid/index.js +2 -2
- package/lib/components/CalendarDayGrid/index.js.map +1 -1
- package/lib/components/CalendarDayGrid/{useCalendarDayGridStyles.js → useCalendarDayGridStyles.styles.js} +2 -2
- package/lib/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js.map +1 -0
- package/lib/components/CalendarDayGrid/{useWeekCornerStyles.js → useWeekCornerStyles.styles.js} +1 -1
- package/lib/components/CalendarDayGrid/useWeekCornerStyles.styles.js.map +1 -0
- package/lib/components/CalendarMonth/useCalendarMonthStyles.js +1 -1
- package/lib/components/CalendarMonth/useCalendarMonthStyles.js.map +1 -1
- package/lib/components/CalendarPicker/index.js +1 -1
- package/lib/components/CalendarPicker/index.js.map +1 -1
- package/lib/components/CalendarPicker/{useCalendarPickerStyles.js → useCalendarPickerStyles.styles.js} +1 -1
- package/lib/components/CalendarPicker/useCalendarPickerStyles.styles.js.map +1 -0
- package/lib/components/CalendarYear/CalendarYear.js +1 -1
- package/lib/components/CalendarYear/CalendarYear.js.map +1 -1
- package/lib/components/CalendarYear/index.js +1 -1
- package/lib/components/CalendarYear/index.js.map +1 -1
- package/lib/components/CalendarYear/{useCalendarYearStyles.js → useCalendarYearStyles.styles.js} +2 -2
- package/lib/components/CalendarYear/useCalendarYearStyles.styles.js.map +1 -0
- package/lib/components/DatePicker/DatePicker.js +1 -1
- package/lib/components/DatePicker/DatePicker.js.map +1 -1
- 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 +1 -1
- package/lib/components/DatePicker/index.js.map +1 -1
- package/lib/components/DatePicker/useDatePicker.js +10 -14
- package/lib/components/DatePicker/useDatePicker.js.map +1 -1
- package/lib/components/DatePicker/{useDatePickerStyles.js → useDatePickerStyles.styles.js} +1 -1
- package/lib/components/DatePicker/useDatePickerStyles.styles.js.map +1 -0
- package/lib/index.js.map +1 -1
- package/lib-commonjs/components/Calendar/Calendar.js +2 -2
- package/lib-commonjs/components/Calendar/Calendar.js.map +1 -1
- package/lib-commonjs/components/Calendar/index.js +1 -1
- package/lib-commonjs/components/Calendar/index.js.map +1 -1
- package/lib-commonjs/components/Calendar/{useCalendarStyles.js → useCalendarStyles.styles.js} +2 -2
- package/lib-commonjs/components/Calendar/useCalendarStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CalendarDay/CalendarDay.js +2 -2
- package/lib-commonjs/components/CalendarDay/CalendarDay.js.map +1 -1
- package/lib-commonjs/components/CalendarDay/index.js +1 -1
- package/lib-commonjs/components/CalendarDay/index.js.map +1 -1
- package/lib-commonjs/components/CalendarDay/{useCalendarDayStyles.js → useCalendarDayStyles.styles.js} +2 -2
- package/lib-commonjs/components/CalendarDay/useCalendarDayStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.js +4 -4
- package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/CalendarGridDayCell.js +8 -8
- package/lib-commonjs/components/CalendarDayGrid/CalendarGridDayCell.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/index.js +3 -3
- package/lib-commonjs/components/CalendarDayGrid/index.js.map +1 -1
- package/lib-commonjs/components/CalendarDayGrid/{useCalendarDayGridStyles.js → useCalendarDayGridStyles.styles.js} +2 -2
- package/lib-commonjs/components/CalendarDayGrid/useCalendarDayGridStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CalendarDayGrid/{useWeekCornerStyles.js → useWeekCornerStyles.styles.js} +2 -2
- package/lib-commonjs/components/CalendarDayGrid/useWeekCornerStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CalendarMonth/useCalendarMonthStyles.js +2 -2
- package/lib-commonjs/components/CalendarMonth/useCalendarMonthStyles.js.map +1 -1
- package/lib-commonjs/components/CalendarPicker/index.js +1 -1
- package/lib-commonjs/components/CalendarPicker/index.js.map +1 -1
- package/lib-commonjs/components/CalendarPicker/{useCalendarPickerStyles.js → useCalendarPickerStyles.styles.js} +2 -2
- package/lib-commonjs/components/CalendarPicker/useCalendarPickerStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CalendarYear/CalendarYear.js +8 -8
- package/lib-commonjs/components/CalendarYear/CalendarYear.js.map +1 -1
- package/lib-commonjs/components/CalendarYear/index.js +1 -1
- package/lib-commonjs/components/CalendarYear/index.js.map +1 -1
- package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.styles.js +14 -0
- package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.styles.js.map +1 -0
- package/lib-commonjs/components/DatePicker/DatePicker.js +2 -2
- package/lib-commonjs/components/DatePicker/DatePicker.js.map +1 -1
- package/lib-commonjs/components/DatePicker/index.js +1 -1
- package/lib-commonjs/components/DatePicker/index.js.map +1 -1
- package/lib-commonjs/components/DatePicker/useDatePicker.js +10 -14
- package/lib-commonjs/components/DatePicker/useDatePicker.js.map +1 -1
- package/lib-commonjs/components/DatePicker/{useDatePickerStyles.js → useDatePickerStyles.styles.js} +2 -2
- package/lib-commonjs/components/DatePicker/useDatePickerStyles.styles.js.map +1 -0
- package/package.json +15 -14
- package/.swcrc +0 -30
- package/lib/components/Calendar/useCalendarStyles.js.map +0 -1
- package/lib/components/CalendarDay/useCalendarDayStyles.js.map +0 -1
- package/lib/components/CalendarDayGrid/useCalendarDayGridStyles.js.map +0 -1
- package/lib/components/CalendarDayGrid/useWeekCornerStyles.js.map +0 -1
- package/lib/components/CalendarPicker/useCalendarPickerStyles.js.map +0 -1
- package/lib/components/CalendarYear/useCalendarYearStyles.js.map +0 -1
- package/lib/components/DatePicker/useDatePickerStyles.js.map +0 -1
- package/lib-commonjs/components/Calendar/useCalendarStyles.js.map +0 -1
- package/lib-commonjs/components/CalendarDay/useCalendarDayStyles.js.map +0 -1
- package/lib-commonjs/components/CalendarDayGrid/useCalendarDayGridStyles.js.map +0 -1
- package/lib-commonjs/components/CalendarDayGrid/useWeekCornerStyles.js.map +0 -1
- package/lib-commonjs/components/CalendarPicker/useCalendarPickerStyles.js.map +0 -1
- package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.js +0 -14
- package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.js.map +0 -1
- package/lib-commonjs/components/DatePicker/useDatePickerStyles.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Enter","Space","ArrowDownRegular","ArrowUpRegular","useFluent_unstable","useArrowNavigationGroup","mergeClasses","useCalendarYearStyles_unstable","CELL_COUNT","CELLS_PER_ROW","DefaultCalendarYearStrings","prevRangeAriaLabel","undefined","nextRangeAriaLabel","CalendarYearGridCell","props","className","highlightCurrentYear","highlightSelectedYear","year","selected","disabled","componentRef","onSelectYear","onRenderYear","buttonRef","useRef","useImperativeHandle","focus","_buttonRef_current","_buttonRef_current_focus","current","call","onClick","onKeyDown","ev","key","classNames","highlightCurrent","highlightSelected","_onRenderYear","createElement","itemButton","type","role","ref","displayName","CalendarYearGrid","fromYear","toYear","animationDirection","animateBackwards","minYear","maxYear","selectedYear","selectedCellRef","currentCellRef","_ref","_ref_focus","renderCell","yearToRender","Date","getFullYear","value","_props_onRenderYear","_props_onRenderYear1","gridAriaLabel","cells","i","push","j","arrowNavigationAttributes","axis","gridContainer","map","cellRow","index","buttonRow","CalendarYearNavDirection","Previous","Next","CalendarYearNavArrow","strings","direction","onSelectPrev","onSelectNext","ariaLabel","newRangeOffset","newRange","ariaLabelString","onNavigate","dir","isLeftNavigation","navigationButton","title","CalendarYearNav","navigationButtonsContainer","CalendarYearTitle","onHeaderSelect","_props_onHeaderSelect","onHeaderKeyDown","hasHeaderClickCallback","rangeAriaLabel","headerAriaLabelFormatString","currentDateRange","replace","currentItemButton","CalendarYearHeader","onRenderTitle","_onRenderTitle","headerContainer","useAnimateBackwards","navigatedYear","rangeYear","Math","floor","previousFromYearRef","previousFromYear","NavigationDirection","useYearRangeState","navigate","useReducer","state","action","onNavNext","onNavPrevious","CalendarYear","gridRef","_gridRef_current","_gridRef_current_focus","root"],"sources":["../../../src/components/CalendarYear/CalendarYear.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Enter, Space } from '@fluentui/keyboard-keys';\nimport { ArrowDownRegular, ArrowUpRegular } from '@fluentui/react-icons';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { mergeClasses } from '@griffel/react';\nimport { useCalendarYearStyles_unstable } from './useCalendarYearStyles';\nimport type {\n CalendarYearStrings,\n CalendarYearProps,\n CalendarYearRange,\n CalendarYearHeaderProps,\n} from './CalendarYear.types';\n\nconst CELL_COUNT = 12;\nconst CELLS_PER_ROW = 4;\n\nconst DefaultCalendarYearStrings: CalendarYearStrings = {\n prevRangeAriaLabel: undefined,\n nextRangeAriaLabel: undefined,\n};\ninterface CalendarYearGrid {\n focus(): void;\n}\n\ninterface CalendarYearGridCellProps extends CalendarYearProps {\n year: number;\n current?: boolean;\n selected?: boolean;\n disabled?: boolean;\n onSelectYear?: (year: number) => void;\n onRenderYear?: (year: number) => React.ReactNode;\n}\n\ninterface CalendarYearGridProps extends CalendarYearProps, CalendarYearRange {\n selectedYear?: number;\n animateBackwards?: boolean;\n componentRef?: React.RefObject<CalendarYearGridCell>;\n}\n\ninterface CalendarYearGridCell {\n focus(): void;\n}\n\nconst CalendarYearGridCell: React.FunctionComponent<CalendarYearGridCellProps> = props => {\n const {\n className,\n highlightCurrentYear,\n highlightSelectedYear,\n year,\n selected,\n disabled,\n componentRef,\n onSelectYear,\n onRenderYear,\n } = props;\n\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n\n React.useImperativeHandle(\n componentRef,\n () => ({\n focus() {\n buttonRef.current?.focus?.();\n },\n }),\n [],\n );\n\n const onClick = () => {\n onSelectYear?.(year);\n };\n\n const onKeyDown = (ev: React.KeyboardEvent<HTMLElement>) => {\n if (ev.key === Enter) {\n onSelectYear?.(year);\n }\n };\n\n const classNames = useCalendarYearStyles_unstable({\n className,\n highlightCurrent: highlightCurrentYear,\n highlightSelected: highlightSelectedYear,\n });\n\n return (\n <button\n className={mergeClasses(classNames.itemButton, selected && classNames.selected, disabled && classNames.disabled)}\n type=\"button\"\n role=\"gridcell\"\n onClick={!disabled ? onClick : undefined}\n onKeyDown={!disabled ? onKeyDown : undefined}\n disabled={disabled}\n aria-selected={selected}\n ref={buttonRef}\n >\n {onRenderYear?.(year) ?? year}\n </button>\n );\n};\nCalendarYearGridCell.displayName = 'CalendarYearGridCell';\n\nconst CalendarYearGrid: React.FunctionComponent<CalendarYearGridProps> = props => {\n const {\n className,\n fromYear,\n toYear,\n animationDirection,\n animateBackwards,\n minYear,\n maxYear,\n onSelectYear,\n selectedYear,\n componentRef,\n } = props;\n\n const selectedCellRef = React.useRef<CalendarYearGridCell>(null);\n const currentCellRef = React.useRef<CalendarYearGridCell>(null);\n\n React.useImperativeHandle(\n componentRef,\n () => ({\n focus() {\n (selectedCellRef.current || currentCellRef.current)?.focus?.();\n },\n }),\n [],\n );\n\n const renderCell = (yearToRender: number): React.ReactNode => {\n const selected = yearToRender === selectedYear;\n const disabled =\n (minYear !== undefined && yearToRender < minYear) || (maxYear !== undefined && yearToRender > maxYear);\n const current = yearToRender === new Date().getFullYear();\n\n return (\n <CalendarYearGridCell\n {...props}\n key={yearToRender}\n year={yearToRender}\n selected={selected}\n current={current}\n disabled={disabled}\n onSelectYear={onSelectYear}\n componentRef={selected ? selectedCellRef : current ? currentCellRef : undefined}\n />\n );\n };\n\n const classNames = useCalendarYearStyles_unstable({\n className,\n animateBackwards,\n animationDirection,\n });\n\n const onRenderYear = (value: number) => {\n return props.onRenderYear?.(value) ?? value;\n };\n\n const gridAriaLabel = `${onRenderYear(fromYear)} - ${onRenderYear(toYear)}`;\n\n let year = fromYear;\n const cells: React.ReactNode[][] = [];\n\n for (let i = 0; i < (toYear - fromYear + 1) / CELLS_PER_ROW; i++) {\n cells.push([]);\n for (let j = 0; j < CELLS_PER_ROW; j++) {\n cells[i].push(renderCell(year));\n year++;\n }\n }\n\n const arrowNavigationAttributes = useArrowNavigationGroup({ axis: 'both' });\n\n return (\n <div {...arrowNavigationAttributes}>\n <div className={classNames.gridContainer} role=\"grid\" aria-label={gridAriaLabel}>\n {cells.map((cellRow: React.ReactNode[], index: number) => {\n return (\n <div key={'yearPickerRow_' + index + '_' + fromYear} role=\"row\" className={classNames.buttonRow}>\n {cellRow}\n </div>\n );\n })}\n </div>\n </div>\n );\n};\nCalendarYearGrid.displayName = 'CalendarYearGrid';\n\nconst CalendarYearNavDirection = {\n Previous: 0 as const,\n Next: 1 as const,\n};\n\ninterface CalendarYearNavArrowProps extends CalendarYearHeaderProps {\n direction: (typeof CalendarYearNavDirection)[keyof typeof CalendarYearNavDirection];\n}\n\nconst CalendarYearNavArrow: React.FunctionComponent<CalendarYearNavArrowProps> = props => {\n const {\n className,\n strings = DefaultCalendarYearStrings,\n direction,\n onSelectPrev,\n onSelectNext,\n fromYear,\n toYear,\n maxYear,\n minYear,\n } = props;\n\n const classNames = useCalendarYearStyles_unstable({\n className,\n });\n\n const ariaLabel =\n direction === CalendarYearNavDirection.Previous ? strings.prevRangeAriaLabel : strings.nextRangeAriaLabel;\n const newRangeOffset = direction === CalendarYearNavDirection.Previous ? -CELL_COUNT : CELL_COUNT;\n const newRange = { fromYear: fromYear + newRangeOffset, toYear: toYear + newRangeOffset };\n const ariaLabelString = ariaLabel ? (typeof ariaLabel === 'string' ? ariaLabel : ariaLabel(newRange)) : undefined;\n const disabled =\n direction === CalendarYearNavDirection.Previous\n ? minYear !== undefined && fromYear < minYear\n : maxYear !== undefined && props.fromYear + CELL_COUNT > maxYear;\n\n const onNavigate = () => {\n direction === CalendarYearNavDirection.Previous ? onSelectPrev?.() : onSelectNext?.();\n };\n\n const onKeyDown = (ev: React.KeyboardEvent<HTMLElement>) => {\n if (ev.key === Enter) {\n onNavigate();\n }\n };\n\n const { dir } = useFluent_unstable();\n\n // can be condensed, but leaving verbose for clarity due to regressions\n const isLeftNavigation =\n dir === 'rtl' ? direction === CalendarYearNavDirection.Next : direction === CalendarYearNavDirection.Previous;\n\n return (\n <button\n className={mergeClasses(classNames.navigationButton, disabled && classNames.disabled)}\n onClick={!disabled ? onNavigate : undefined}\n onKeyDown={!disabled ? onKeyDown : undefined}\n type=\"button\"\n title={ariaLabelString}\n disabled={disabled}\n >\n {isLeftNavigation ? <ArrowUpRegular /> : <ArrowDownRegular />}\n </button>\n );\n};\nCalendarYearNavArrow.displayName = 'CalendarYearNavArrow';\n\nconst CalendarYearNav: React.FunctionComponent<CalendarYearHeaderProps> = props => {\n const { className } = props;\n\n const classNames = useCalendarYearStyles_unstable({\n className,\n });\n\n return (\n <div className={classNames.navigationButtonsContainer}>\n <CalendarYearNavArrow {...props} direction={CalendarYearNavDirection.Previous} />\n <CalendarYearNavArrow {...props} direction={CalendarYearNavDirection.Next} />\n </div>\n );\n};\nCalendarYearNav.displayName = 'CalendarYearNav';\n\nconst CalendarYearTitle: React.FunctionComponent<CalendarYearHeaderProps> = props => {\n const {\n className,\n fromYear,\n toYear,\n strings = DefaultCalendarYearStrings,\n animateBackwards,\n animationDirection,\n } = props;\n\n const onHeaderSelect = () => {\n props.onHeaderSelect?.(true);\n };\n\n const onHeaderKeyDown = (ev: React.KeyboardEvent<HTMLElement>) => {\n if (ev.key === Enter || ev.key === Space) {\n onHeaderSelect();\n }\n };\n\n const onRenderYear = (year: number) => {\n return props.onRenderYear?.(year) ?? year;\n };\n\n const classNames = useCalendarYearStyles_unstable({\n className,\n hasHeaderClickCallback: !!props.onHeaderSelect,\n animateBackwards,\n animationDirection,\n });\n\n if (props.onHeaderSelect) {\n const rangeAriaLabel = strings.rangeAriaLabel;\n const headerAriaLabelFormatString = strings.headerAriaLabelFormatString;\n const currentDateRange = rangeAriaLabel\n ? typeof rangeAriaLabel === 'string'\n ? rangeAriaLabel\n : rangeAriaLabel(props)\n : undefined;\n\n const ariaLabel = headerAriaLabelFormatString\n ? headerAriaLabelFormatString.replace('{0}', currentDateRange ?? '')\n : currentDateRange;\n\n return (\n <button\n className={classNames.currentItemButton}\n onClick={onHeaderSelect}\n onKeyDown={onHeaderKeyDown}\n aria-label={ariaLabel}\n role=\"button\"\n type=\"button\"\n >\n <span aria-live=\"assertive\" aria-atomic=\"true\">\n {onRenderYear(fromYear)} - {onRenderYear(toYear)}\n </span>\n </button>\n );\n }\n\n return (\n <div className={classNames.current}>\n {onRenderYear(fromYear)} - {onRenderYear(toYear)}\n </div>\n );\n};\nCalendarYearTitle.displayName = 'CalendarYearTitle';\n\nconst CalendarYearHeader: React.FunctionComponent<CalendarYearHeaderProps> = props => {\n const { className, animateBackwards, animationDirection, onRenderTitle } = props;\n\n const classNames = useCalendarYearStyles_unstable({\n className,\n hasHeaderClickCallback: !!props.onHeaderSelect,\n animateBackwards,\n animationDirection,\n });\n\n return (\n <div className={classNames.headerContainer}>\n {onRenderTitle?.(props) ?? <CalendarYearTitle {...props} />}\n <CalendarYearNav {...props} />\n </div>\n );\n};\nCalendarYearHeader.displayName = 'CalendarYearHeader';\n\nfunction useAnimateBackwards({ selectedYear, navigatedYear }: CalendarYearProps) {\n const rangeYear = selectedYear || navigatedYear || new Date().getFullYear();\n const fromYear = Math.floor(rangeYear / 10) * 10;\n\n const previousFromYearRef = React.useRef<number | undefined>(fromYear);\n React.useRef(() => {\n previousFromYearRef.current = fromYear;\n });\n const previousFromYear = previousFromYearRef.current;\n\n if (!previousFromYear || previousFromYear === fromYear) {\n return undefined;\n } else if (previousFromYear > fromYear) {\n return true;\n } else {\n return false;\n }\n}\n\nconst NavigationDirection = {\n Previous: 0 as const,\n Next: 1 as const,\n};\n\nfunction useYearRangeState({ selectedYear, navigatedYear }: CalendarYearProps) {\n const [fromYear, navigate] = React.useReducer(\n (state: number, action: (typeof NavigationDirection)[keyof typeof NavigationDirection]): number => {\n return state + (action === NavigationDirection.Next ? CELL_COUNT : -CELL_COUNT);\n },\n undefined,\n () => {\n const rangeYear = selectedYear || navigatedYear || new Date().getFullYear();\n return Math.floor(rangeYear / 10) * 10;\n },\n );\n const toYear = fromYear + CELL_COUNT - 1;\n\n const onNavNext = () => navigate(NavigationDirection.Next);\n const onNavPrevious = () => navigate(NavigationDirection.Previous);\n\n return [fromYear, toYear, onNavNext, onNavPrevious] as const;\n}\n\n/**\n * @internal\n */\nexport const CalendarYear: React.FunctionComponent<CalendarYearProps> = props => {\n const animateBackwards = useAnimateBackwards(props);\n const [fromYear, toYear, onNavNext, onNavPrevious] = useYearRangeState(props);\n\n const gridRef = React.useRef<CalendarYearGrid>(null);\n\n React.useImperativeHandle(props.componentRef, () => ({\n focus() {\n gridRef.current?.focus?.();\n },\n }));\n\n const { className } = props;\n\n const classNames = useCalendarYearStyles_unstable({\n className,\n });\n\n return (\n <div className={classNames.root}>\n <CalendarYearHeader\n {...props}\n fromYear={fromYear}\n toYear={toYear}\n onSelectPrev={onNavPrevious}\n onSelectNext={onNavNext}\n animateBackwards={animateBackwards}\n />\n <CalendarYearGrid\n {...props}\n fromYear={fromYear}\n toYear={toYear}\n animateBackwards={animateBackwards}\n componentRef={gridRef}\n />\n </div>\n );\n};\nCalendarYear.displayName = 'CalendarYear';\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,KAAK,EAAEC,KAAK,QAAQ;AAC7B,SAASC,gBAAgB,EAAEC,cAAc,QAAQ;AACjD,SAASC,kBAAkB,QAAQ;AACnC,SAASC,uBAAuB,QAAQ;AACxC,SAASC,YAAY,QAAQ;AAC7B,SAASC,8BAA8B,QAAQ;AAQ/C,MAAMC,UAAA,GAAa;AACnB,MAAMC,aAAA,GAAgB;AAEtB,MAAMC,0BAAA,GAAkD;EACtDC,kBAAA,EAAoBC,SAAA;EACpBC,kBAAA,EAAoBD;AACtB;AAwBA,MAAME,oBAAA,GAA2EC,KAAA,IAAS;EACxF,MAAM;IACJC,SAAA;IACAC,oBAAA;IACAC,qBAAA;IACAC,IAAA;IACAC,QAAA;IACAC,QAAA;IACAC,YAAA;IACAC,YAAA;IACAC;EAAY,CACb,GAAGT,KAAA;EAEJ,MAAMU,SAAA,GAAY1B,KAAA,CAAM2B,MAAM,CAAoB,IAAI;EAEtD3B,KAAA,CAAM4B,mBAAmB,CACvBL,YAAA,EACA;IAAO;MACLM,MAAA,EAAQ;YACNC,kBAAA,EAAAC,wBAAA;QAAA,CAAAD,kBAAA,GAAAJ,SAAA,CAAUM,OAAO,cAAjBF,kBAAA,wBAAAC,wBAAA,GAAAD,kBAAA,CAAmBD,KAAA,cAAAE,wBAAA,cAAnB,SAAAA,wBAAA,CAAAE,IAAA,CAAAH,kBAAA;M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cyG;;AAItB;AACAD,YAAA,CAAahF,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"names":["React","Enter","Space","ArrowDownRegular","ArrowUpRegular","useFluent_unstable","useArrowNavigationGroup","mergeClasses","useCalendarYearStyles_unstable","CELL_COUNT","CELLS_PER_ROW","DefaultCalendarYearStrings","prevRangeAriaLabel","undefined","nextRangeAriaLabel","CalendarYearGridCell","props","className","highlightCurrentYear","highlightSelectedYear","year","selected","disabled","componentRef","onSelectYear","onRenderYear","buttonRef","useRef","useImperativeHandle","focus","_buttonRef_current","_buttonRef_current_focus","current","call","onClick","onKeyDown","ev","key","classNames","highlightCurrent","highlightSelected","_onRenderYear","createElement","itemButton","type","role","ref","displayName","CalendarYearGrid","fromYear","toYear","animationDirection","animateBackwards","minYear","maxYear","selectedYear","selectedCellRef","currentCellRef","_ref","_ref_focus","renderCell","yearToRender","Date","getFullYear","value","_props_onRenderYear","_props_onRenderYear1","gridAriaLabel","cells","i","push","j","arrowNavigationAttributes","axis","gridContainer","map","cellRow","index","buttonRow","CalendarYearNavDirection","Previous","Next","CalendarYearNavArrow","strings","direction","onSelectPrev","onSelectNext","ariaLabel","newRangeOffset","newRange","ariaLabelString","onNavigate","dir","isLeftNavigation","navigationButton","title","CalendarYearNav","navigationButtonsContainer","CalendarYearTitle","onHeaderSelect","_props_onHeaderSelect","onHeaderKeyDown","hasHeaderClickCallback","rangeAriaLabel","headerAriaLabelFormatString","currentDateRange","replace","currentItemButton","CalendarYearHeader","onRenderTitle","_onRenderTitle","headerContainer","useAnimateBackwards","navigatedYear","rangeYear","Math","floor","previousFromYearRef","previousFromYear","NavigationDirection","useYearRangeState","navigate","useReducer","state","action","onNavNext","onNavPrevious","CalendarYear","gridRef","_gridRef_current","_gridRef_current_focus","root"],"sources":["../../../src/components/CalendarYear/CalendarYear.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Enter, Space } from '@fluentui/keyboard-keys';\nimport { ArrowDownRegular, ArrowUpRegular } from '@fluentui/react-icons';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { mergeClasses } from '@griffel/react';\nimport { useCalendarYearStyles_unstable } from './useCalendarYearStyles.styles';\nimport type {\n CalendarYearStrings,\n CalendarYearProps,\n CalendarYearRange,\n CalendarYearHeaderProps,\n} from './CalendarYear.types';\n\nconst CELL_COUNT = 12;\nconst CELLS_PER_ROW = 4;\n\nconst DefaultCalendarYearStrings: CalendarYearStrings = {\n prevRangeAriaLabel: undefined,\n nextRangeAriaLabel: undefined,\n};\ninterface CalendarYearGrid {\n focus(): void;\n}\n\ninterface CalendarYearGridCellProps extends CalendarYearProps {\n year: number;\n current?: boolean;\n selected?: boolean;\n disabled?: boolean;\n onSelectYear?: (year: number) => void;\n onRenderYear?: (year: number) => React.ReactNode;\n}\n\ninterface CalendarYearGridProps extends CalendarYearProps, CalendarYearRange {\n selectedYear?: number;\n animateBackwards?: boolean;\n componentRef?: React.RefObject<CalendarYearGridCell>;\n}\n\ninterface CalendarYearGridCell {\n focus(): void;\n}\n\nconst CalendarYearGridCell: React.FunctionComponent<CalendarYearGridCellProps> = props => {\n const {\n className,\n highlightCurrentYear,\n highlightSelectedYear,\n year,\n selected,\n disabled,\n componentRef,\n onSelectYear,\n onRenderYear,\n } = props;\n\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n\n React.useImperativeHandle(\n componentRef,\n () => ({\n focus() {\n buttonRef.current?.focus?.();\n },\n }),\n [],\n );\n\n const onClick = () => {\n onSelectYear?.(year);\n };\n\n const onKeyDown = (ev: React.KeyboardEvent<HTMLElement>) => {\n if (ev.key === Enter) {\n onSelectYear?.(year);\n }\n };\n\n const classNames = useCalendarYearStyles_unstable({\n className,\n highlightCurrent: highlightCurrentYear,\n highlightSelected: highlightSelectedYear,\n });\n\n return (\n <button\n className={mergeClasses(classNames.itemButton, selected && classNames.selected, disabled && classNames.disabled)}\n type=\"button\"\n role=\"gridcell\"\n onClick={!disabled ? onClick : undefined}\n onKeyDown={!disabled ? onKeyDown : undefined}\n disabled={disabled}\n aria-selected={selected}\n ref={buttonRef}\n >\n {onRenderYear?.(year) ?? year}\n </button>\n );\n};\nCalendarYearGridCell.displayName = 'CalendarYearGridCell';\n\nconst CalendarYearGrid: React.FunctionComponent<CalendarYearGridProps> = props => {\n const {\n className,\n fromYear,\n toYear,\n animationDirection,\n animateBackwards,\n minYear,\n maxYear,\n onSelectYear,\n selectedYear,\n componentRef,\n } = props;\n\n const selectedCellRef = React.useRef<CalendarYearGridCell>(null);\n const currentCellRef = React.useRef<CalendarYearGridCell>(null);\n\n React.useImperativeHandle(\n componentRef,\n () => ({\n focus() {\n (selectedCellRef.current || currentCellRef.current)?.focus?.();\n },\n }),\n [],\n );\n\n const renderCell = (yearToRender: number): React.ReactNode => {\n const selected = yearToRender === selectedYear;\n const disabled =\n (minYear !== undefined && yearToRender < minYear) || (maxYear !== undefined && yearToRender > maxYear);\n const current = yearToRender === new Date().getFullYear();\n\n return (\n <CalendarYearGridCell\n {...props}\n key={yearToRender}\n year={yearToRender}\n selected={selected}\n current={current}\n disabled={disabled}\n onSelectYear={onSelectYear}\n componentRef={selected ? selectedCellRef : current ? currentCellRef : undefined}\n />\n );\n };\n\n const classNames = useCalendarYearStyles_unstable({\n className,\n animateBackwards,\n animationDirection,\n });\n\n const onRenderYear = (value: number) => {\n return props.onRenderYear?.(value) ?? value;\n };\n\n const gridAriaLabel = `${onRenderYear(fromYear)} - ${onRenderYear(toYear)}`;\n\n let year = fromYear;\n const cells: React.ReactNode[][] = [];\n\n for (let i = 0; i < (toYear - fromYear + 1) / CELLS_PER_ROW; i++) {\n cells.push([]);\n for (let j = 0; j < CELLS_PER_ROW; j++) {\n cells[i].push(renderCell(year));\n year++;\n }\n }\n\n const arrowNavigationAttributes = useArrowNavigationGroup({ axis: 'both' });\n\n return (\n <div {...arrowNavigationAttributes}>\n <div className={classNames.gridContainer} role=\"grid\" aria-label={gridAriaLabel}>\n {cells.map((cellRow: React.ReactNode[], index: number) => {\n return (\n <div key={'yearPickerRow_' + index + '_' + fromYear} role=\"row\" className={classNames.buttonRow}>\n {cellRow}\n </div>\n );\n })}\n </div>\n </div>\n );\n};\nCalendarYearGrid.displayName = 'CalendarYearGrid';\n\nconst CalendarYearNavDirection = {\n Previous: 0 as const,\n Next: 1 as const,\n};\n\ninterface CalendarYearNavArrowProps extends CalendarYearHeaderProps {\n direction: (typeof CalendarYearNavDirection)[keyof typeof CalendarYearNavDirection];\n}\n\nconst CalendarYearNavArrow: React.FunctionComponent<CalendarYearNavArrowProps> = props => {\n const {\n className,\n strings = DefaultCalendarYearStrings,\n direction,\n onSelectPrev,\n onSelectNext,\n fromYear,\n toYear,\n maxYear,\n minYear,\n } = props;\n\n const classNames = useCalendarYearStyles_unstable({\n className,\n });\n\n const ariaLabel =\n direction === CalendarYearNavDirection.Previous ? strings.prevRangeAriaLabel : strings.nextRangeAriaLabel;\n const newRangeOffset = direction === CalendarYearNavDirection.Previous ? -CELL_COUNT : CELL_COUNT;\n const newRange = { fromYear: fromYear + newRangeOffset, toYear: toYear + newRangeOffset };\n const ariaLabelString = ariaLabel ? (typeof ariaLabel === 'string' ? ariaLabel : ariaLabel(newRange)) : undefined;\n const disabled =\n direction === CalendarYearNavDirection.Previous\n ? minYear !== undefined && fromYear < minYear\n : maxYear !== undefined && props.fromYear + CELL_COUNT > maxYear;\n\n const onNavigate = () => {\n direction === CalendarYearNavDirection.Previous ? onSelectPrev?.() : onSelectNext?.();\n };\n\n const onKeyDown = (ev: React.KeyboardEvent<HTMLElement>) => {\n if (ev.key === Enter) {\n onNavigate();\n }\n };\n\n const { dir } = useFluent_unstable();\n\n // can be condensed, but leaving verbose for clarity due to regressions\n const isLeftNavigation =\n dir === 'rtl' ? direction === CalendarYearNavDirection.Next : direction === CalendarYearNavDirection.Previous;\n\n return (\n <button\n className={mergeClasses(classNames.navigationButton, disabled && classNames.disabled)}\n onClick={!disabled ? onNavigate : undefined}\n onKeyDown={!disabled ? onKeyDown : undefined}\n type=\"button\"\n title={ariaLabelString}\n disabled={disabled}\n >\n {isLeftNavigation ? <ArrowUpRegular /> : <ArrowDownRegular />}\n </button>\n );\n};\nCalendarYearNavArrow.displayName = 'CalendarYearNavArrow';\n\nconst CalendarYearNav: React.FunctionComponent<CalendarYearHeaderProps> = props => {\n const { className } = props;\n\n const classNames = useCalendarYearStyles_unstable({\n className,\n });\n\n return (\n <div className={classNames.navigationButtonsContainer}>\n <CalendarYearNavArrow {...props} direction={CalendarYearNavDirection.Previous} />\n <CalendarYearNavArrow {...props} direction={CalendarYearNavDirection.Next} />\n </div>\n );\n};\nCalendarYearNav.displayName = 'CalendarYearNav';\n\nconst CalendarYearTitle: React.FunctionComponent<CalendarYearHeaderProps> = props => {\n const {\n className,\n fromYear,\n toYear,\n strings = DefaultCalendarYearStrings,\n animateBackwards,\n animationDirection,\n } = props;\n\n const onHeaderSelect = () => {\n props.onHeaderSelect?.(true);\n };\n\n const onHeaderKeyDown = (ev: React.KeyboardEvent<HTMLElement>) => {\n if (ev.key === Enter || ev.key === Space) {\n onHeaderSelect();\n }\n };\n\n const onRenderYear = (year: number) => {\n return props.onRenderYear?.(year) ?? year;\n };\n\n const classNames = useCalendarYearStyles_unstable({\n className,\n hasHeaderClickCallback: !!props.onHeaderSelect,\n animateBackwards,\n animationDirection,\n });\n\n if (props.onHeaderSelect) {\n const rangeAriaLabel = strings.rangeAriaLabel;\n const headerAriaLabelFormatString = strings.headerAriaLabelFormatString;\n const currentDateRange = rangeAriaLabel\n ? typeof rangeAriaLabel === 'string'\n ? rangeAriaLabel\n : rangeAriaLabel(props)\n : undefined;\n\n const ariaLabel = headerAriaLabelFormatString\n ? headerAriaLabelFormatString.replace('{0}', currentDateRange ?? '')\n : currentDateRange;\n\n return (\n <button\n className={classNames.currentItemButton}\n onClick={onHeaderSelect}\n onKeyDown={onHeaderKeyDown}\n aria-label={ariaLabel}\n role=\"button\"\n type=\"button\"\n >\n <span aria-live=\"assertive\" aria-atomic=\"true\">\n {onRenderYear(fromYear)} - {onRenderYear(toYear)}\n </span>\n </button>\n );\n }\n\n return (\n <div className={classNames.current}>\n {onRenderYear(fromYear)} - {onRenderYear(toYear)}\n </div>\n );\n};\nCalendarYearTitle.displayName = 'CalendarYearTitle';\n\nconst CalendarYearHeader: React.FunctionComponent<CalendarYearHeaderProps> = props => {\n const { className, animateBackwards, animationDirection, onRenderTitle } = props;\n\n const classNames = useCalendarYearStyles_unstable({\n className,\n hasHeaderClickCallback: !!props.onHeaderSelect,\n animateBackwards,\n animationDirection,\n });\n\n return (\n <div className={classNames.headerContainer}>\n {onRenderTitle?.(props) ?? <CalendarYearTitle {...props} />}\n <CalendarYearNav {...props} />\n </div>\n );\n};\nCalendarYearHeader.displayName = 'CalendarYearHeader';\n\nfunction useAnimateBackwards({ selectedYear, navigatedYear }: CalendarYearProps) {\n const rangeYear = selectedYear || navigatedYear || new Date().getFullYear();\n const fromYear = Math.floor(rangeYear / 10) * 10;\n\n const previousFromYearRef = React.useRef<number | undefined>(fromYear);\n React.useRef(() => {\n previousFromYearRef.current = fromYear;\n });\n const previousFromYear = previousFromYearRef.current;\n\n if (!previousFromYear || previousFromYear === fromYear) {\n return undefined;\n } else if (previousFromYear > fromYear) {\n return true;\n } else {\n return false;\n }\n}\n\nconst NavigationDirection = {\n Previous: 0 as const,\n Next: 1 as const,\n};\n\nfunction useYearRangeState({ selectedYear, navigatedYear }: CalendarYearProps) {\n const [fromYear, navigate] = React.useReducer(\n (state: number, action: (typeof NavigationDirection)[keyof typeof NavigationDirection]): number => {\n return state + (action === NavigationDirection.Next ? CELL_COUNT : -CELL_COUNT);\n },\n undefined,\n () => {\n const rangeYear = selectedYear || navigatedYear || new Date().getFullYear();\n return Math.floor(rangeYear / 10) * 10;\n },\n );\n const toYear = fromYear + CELL_COUNT - 1;\n\n const onNavNext = () => navigate(NavigationDirection.Next);\n const onNavPrevious = () => navigate(NavigationDirection.Previous);\n\n return [fromYear, toYear, onNavNext, onNavPrevious] as const;\n}\n\n/**\n * @internal\n */\nexport const CalendarYear: React.FunctionComponent<CalendarYearProps> = props => {\n const animateBackwards = useAnimateBackwards(props);\n const [fromYear, toYear, onNavNext, onNavPrevious] = useYearRangeState(props);\n\n const gridRef = React.useRef<CalendarYearGrid>(null);\n\n React.useImperativeHandle(props.componentRef, () => ({\n focus() {\n gridRef.current?.focus?.();\n },\n }));\n\n const { className } = props;\n\n const classNames = useCalendarYearStyles_unstable({\n className,\n });\n\n return (\n <div className={classNames.root}>\n <CalendarYearHeader\n {...props}\n fromYear={fromYear}\n toYear={toYear}\n onSelectPrev={onNavPrevious}\n onSelectNext={onNavNext}\n animateBackwards={animateBackwards}\n />\n <CalendarYearGrid\n {...props}\n fromYear={fromYear}\n toYear={toYear}\n animateBackwards={animateBackwards}\n componentRef={gridRef}\n />\n </div>\n );\n};\nCalendarYear.displayName = 'CalendarYear';\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,KAAK,EAAEC,KAAK,QAAQ;AAC7B,SAASC,gBAAgB,EAAEC,cAAc,QAAQ;AACjD,SAASC,kBAAkB,QAAQ;AACnC,SAASC,uBAAuB,QAAQ;AACxC,SAASC,YAAY,QAAQ;AAC7B,SAASC,8BAA8B,QAAQ;AAQ/C,MAAMC,UAAA,GAAa;AACnB,MAAMC,aAAA,GAAgB;AAEtB,MAAMC,0BAAA,GAAkD;EACtDC,kBAAA,EAAoBC,SAAA;EACpBC,kBAAA,EAAoBD;AACtB;AAwBA,MAAME,oBAAA,GAA2EC,KAAA,IAAS;EACxF,MAAM;IACJC,SAAA;IACAC,oBAAA;IACAC,qBAAA;IACAC,IAAA;IACAC,QAAA;IACAC,QAAA;IACAC,YAAA;IACAC,YAAA;IACAC;EAAY,CACb,GAAGT,KAAA;EAEJ,MAAMU,SAAA,GAAY1B,KAAA,CAAM2B,MAAM,CAAoB,IAAI;EAEtD3B,KAAA,CAAM4B,mBAAmB,CACvBL,YAAA,EACA;IAAO;MACLM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A;IACdxC,YAAA,EAAcuC,SAAA;IACdzE,gBAAA,EAAkBA;mBAEpBpD,KAAA,CAAA0C,aAAA,CAACM,gBAAA;IACE,GAAGhC,KAAK;IACTiC,QAAA,EAAUA,QAAA;IACVC,MAAA,EAAQA,MAAA;IACRE,gBAAA,EAAkBA,gBAAA;IAClB7B,YAAA,EAAcyG;;AAItB;AACAD,YAAA,CAAahF,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/components/CalendarYear/index.ts"],"sourcesContent":["export * from './CalendarYear';\nexport * from './CalendarYear.types';\nexport * from './useCalendarYearStyles';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc"}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/components/CalendarYear/index.ts"],"sourcesContent":["export * from './CalendarYear';\nexport * from './CalendarYear.types';\nexport * from './useCalendarYearStyles.styles';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc"}
|
package/lib/components/CalendarYear/{useCalendarYearStyles.js → useCalendarYearStyles.styles.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCalendarPickerStyles_unstable } from '../CalendarPicker/useCalendarPickerStyles';
|
|
1
|
+
import { useCalendarPickerStyles_unstable } from '../CalendarPicker/useCalendarPickerStyles.styles';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*
|
|
@@ -7,4 +7,4 @@ import { useCalendarPickerStyles_unstable } from '../CalendarPicker/useCalendarP
|
|
|
7
7
|
export const useCalendarYearStyles_unstable = props => {
|
|
8
8
|
return useCalendarPickerStyles_unstable(props);
|
|
9
9
|
};
|
|
10
|
-
//# sourceMappingURL=useCalendarYearStyles.js.map
|
|
10
|
+
//# sourceMappingURL=useCalendarYearStyles.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCalendarPickerStyles_unstable","useCalendarYearStyles_unstable","props"],"sources":["../../../src/components/CalendarYear/useCalendarYearStyles.styles.ts"],"sourcesContent":["import { useCalendarPickerStyles_unstable } from '../CalendarPicker/useCalendarPickerStyles.styles';\nimport type { CalendarYearStyleProps, CalendarYearStyles } from './CalendarYear.types';\n\n/**\n * @internal\n *\n * Apply styling to the CalendarYear slots based on the state\n */\nexport const useCalendarYearStyles_unstable = (props: CalendarYearStyleProps): CalendarYearStyles => {\n return useCalendarPickerStyles_unstable(props);\n};\n"],"mappings":"AAAA,SAASA,gCAAgC,QAAQ;AAGjD;;;;;AAKA,OAAO,MAAMC,8BAAA,GAAkCC,KAAA,IAAsD;EACnG,OAAOF,gCAAA,CAAiCE,KAAA;AAC1C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { renderDatePicker_unstable } from './renderDatePicker';
|
|
3
3
|
import { useDatePicker_unstable } from './useDatePicker';
|
|
4
|
-
import { useDatePickerStyles_unstable } from './useDatePickerStyles';
|
|
4
|
+
import { useDatePickerStyles_unstable } from './useDatePickerStyles.styles';
|
|
5
5
|
export const DatePicker = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
6
6
|
const state = useDatePicker_unstable(props, ref);
|
|
7
7
|
useDatePickerStyles_unstable(state);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","renderDatePicker_unstable","useDatePicker_unstable","useDatePickerStyles_unstable","DatePicker","forwardRef","props","ref","state","displayName"],"sources":["../../../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport { renderDatePicker_unstable } from './renderDatePicker';\nimport { useDatePicker_unstable } from './useDatePicker';\nimport { useDatePickerStyles_unstable } from './useDatePickerStyles';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { DatePickerProps } from './DatePicker.types';\n\nexport const DatePicker: ForwardRefComponent<DatePickerProps> = React.forwardRef((props, ref) => {\n const state = useDatePicker_unstable(props, ref);\n\n useDatePickerStyles_unstable(state);\n return renderDatePicker_unstable(state);\n}) as ForwardRefComponent<DatePickerProps>;\nDatePicker.displayName = 'DatePicker';\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,sBAAsB,QAAQ;AACvC,SAASC,4BAA4B,QAAQ;AAI7C,OAAO,MAAMC,UAAA,gBAAmDJ,KAAA,CAAMK,UAAU,CAAC,CAACC,KAAA,EAAOC,GAAA,KAAQ;EAC/F,MAAMC,KAAA,GAAQN,sBAAA,CAAuBI,KAAA,EAAOC,GAAA;EAE5CJ,4BAAA,CAA6BK,KAAA;EAC7B,OAAOP,yBAAA,CAA0BO,KAAA;AACnC;AACAJ,UAAA,CAAWK,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"names":["React","renderDatePicker_unstable","useDatePicker_unstable","useDatePickerStyles_unstable","DatePicker","forwardRef","props","ref","state","displayName"],"sources":["../../../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport { renderDatePicker_unstable } from './renderDatePicker';\nimport { useDatePicker_unstable } from './useDatePicker';\nimport { useDatePickerStyles_unstable } from './useDatePickerStyles.styles';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { DatePickerProps } from './DatePicker.types';\n\nexport const DatePicker: ForwardRefComponent<DatePickerProps> = React.forwardRef((props, ref) => {\n const state = useDatePicker_unstable(props, ref);\n\n useDatePickerStyles_unstable(state);\n return renderDatePicker_unstable(state);\n}) as ForwardRefComponent<DatePickerProps>;\nDatePicker.displayName = 'DatePicker';\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,sBAAsB,QAAQ;AACvC,SAASC,4BAA4B,QAAQ;AAI7C,OAAO,MAAMC,UAAA,gBAAmDJ,KAAA,CAAMK,UAAU,CAAC,CAACC,KAAA,EAAOC,GAAA,KAAQ;EAC/F,MAAMC,KAAA,GAAQN,sBAAA,CAAuBI,KAAA,EAAOC,GAAA;EAE5CJ,4BAAA,CAA6BK,KAAA;EAC7B,OAAOP,yBAAA,CAA0BO,KAAA;AACnC;AACAJ,UAAA,CAAWK,WAAW,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React"],"sources":["../../../src/components/DatePicker/DatePicker.types.ts"],"sourcesContent":["import * as React from 'react';\nimport { DayOfWeek, FirstWeekOfYear } from '../../utils';\nimport { Input } from '@fluentui/react-input';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { CalendarProps } from '../Calendar/Calendar.types';\nimport type { CalendarStrings, DateFormatting } from '../../utils';\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\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface IDatePicker {\n /** Sets focus to the input */\n focus(): void;\n\n /** Reset the state of the picker to the default */\n reset(): void;\n\n /** Open the datepicker popup */\n showDatePickerPopup(): void;\n}\n\nexport type DatePickerProps = Omit<ComponentProps<Partial<DatePickerSlots>>, 'defaultValue' | 'value'> & {\n /**\n * Optional callback to access the IDatePicker interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<IDatePicker>;\n\n /**\n * Callback issued when a date is selected\n */\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 onOpenChange?: (open: boolean) => void;\n\n /**\n * Callback to run
|
|
1
|
+
{"version":3,"names":["React"],"sources":["../../../src/components/DatePicker/DatePicker.types.ts"],"sourcesContent":["import * as React from 'react';\nimport { DayOfWeek, FirstWeekOfYear } from '../../utils';\nimport { Input } from '@fluentui/react-input';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { CalendarProps } from '../Calendar/Calendar.types';\nimport type { CalendarStrings, DateFormatting } from '../../utils';\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\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport interface IDatePicker {\n /** Sets focus to the input */\n focus(): void;\n\n /** Reset the state of the picker to the default */\n reset(): void;\n\n /** Open the datepicker popup */\n showDatePickerPopup(): void;\n}\n\nexport type DatePickerProps = Omit<ComponentProps<Partial<DatePickerSlots>>, 'defaultValue' | 'value'> & {\n /**\n * Optional callback to access the IDatePicker interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: React.RefObject<IDatePicker>;\n\n /**\n * Callback issued when a date is selected\n */\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 onOpenChange?: (open: boolean) => void;\n\n /**\n * Callback to run after the DatePicker's input has been validated\n */\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 value?: Date;\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 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"],"mappings":"AAAA,YAAYA,KAAA,MAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["defaultCalendarStrings","defaultDatePickerStrings","prevMonthAriaLabel","nextMonthAriaLabel","prevYearAriaLabel","nextYearAriaLabel","closeButtonAriaLabel","defaultDatePickerErrorStrings"],"sources":["../../../src/components/DatePicker/defaults.ts"],"sourcesContent":["import { defaultCalendarStrings } from '../Calendar/defaults';\nimport type { CalendarStrings } from '../../utils/index';\nimport type {
|
|
1
|
+
{"version":3,"names":["defaultCalendarStrings","defaultDatePickerStrings","prevMonthAriaLabel","nextMonthAriaLabel","prevYearAriaLabel","nextYearAriaLabel","closeButtonAriaLabel","defaultDatePickerErrorStrings"],"sources":["../../../src/components/DatePicker/defaults.ts"],"sourcesContent":["import { defaultCalendarStrings } from '../Calendar/defaults';\nimport type { CalendarStrings } from '../../utils/index';\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"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ;AAIvC,OAAO,MAAMC,wBAAA,GAA4C;EACvD,GAAGD,sBAAsB;EACzBE,kBAAA,EAAoB;EACpBC,kBAAA,EAAoB;EACpBC,iBAAA,EAAmB;EACnBC,iBAAA,EAAmB;EACnBC,oBAAA,EAAsB;AACxB;AAEA,OAAO,MAAMC,6BAAA,GAAqE;EAChF,iBAAiB;EACjB,iBAAiB;EACjB,kBAAkB;AACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/components/DatePicker/index.ts"],"sourcesContent":["export * from './defaults';\nexport * from './DatePicker';\nexport * from './DatePicker.types';\nexport * from './renderDatePicker';\nexport * from './useDatePicker';\nexport * from './useDatePickerStyles';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/components/DatePicker/index.ts"],"sourcesContent":["export * from './defaults';\nexport * from './DatePicker';\nexport * from './DatePicker.types';\nexport * from './renderDatePicker';\nexport * from './useDatePicker';\nexport * from './useDatePickerStyles.styles';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
|
|
@@ -103,7 +103,7 @@ export const useDatePicker_unstable = (props, ref) => {
|
|
|
103
103
|
onOpenChange,
|
|
104
104
|
onSelectDate: onUserSelectDate,
|
|
105
105
|
openOnClick = true,
|
|
106
|
-
|
|
106
|
+
onValidationResult,
|
|
107
107
|
parseDateFromString = defaultParseDateFromString,
|
|
108
108
|
showCloseButton = false,
|
|
109
109
|
showGoToToday = true,
|
|
@@ -128,6 +128,7 @@ export const useDatePicker_unstable = (props, ref) => {
|
|
|
128
128
|
const required = (_fieldContext_required = fieldContext === null || fieldContext === void 0 ? void 0 : fieldContext.required) !== null && _fieldContext_required !== void 0 ? _fieldContext_required : props.required;
|
|
129
129
|
const popupSurfaceId = useId('datePicker-popoverSurface');
|
|
130
130
|
const validateTextInput = React.useCallback((date = null) => {
|
|
131
|
+
let error;
|
|
131
132
|
if (allowTextInput) {
|
|
132
133
|
if (formattedDate || date) {
|
|
133
134
|
// Don't parse if the selected date has the same formatted string as what we're about to parse.
|
|
@@ -141,32 +142,27 @@ export const useDatePicker_unstable = (props, ref) => {
|
|
|
141
142
|
if (!date || isNaN(date.getTime())) {
|
|
142
143
|
// Reset input if formatting is available
|
|
143
144
|
setSelectedDate(selectedDate);
|
|
144
|
-
|
|
145
|
-
error: 'invalid-input'
|
|
146
|
-
});
|
|
145
|
+
error = 'invalid-input';
|
|
147
146
|
} else {
|
|
148
147
|
if (isDateOutOfBounds(date, minDate, maxDate)) {
|
|
149
|
-
|
|
150
|
-
error: 'out-of-bounds'
|
|
151
|
-
});
|
|
148
|
+
error = 'out-of-bounds';
|
|
152
149
|
} else {
|
|
153
150
|
setSelectedDate(date);
|
|
154
151
|
}
|
|
155
152
|
}
|
|
156
153
|
} else {
|
|
157
154
|
if (required) {
|
|
158
|
-
|
|
159
|
-
error: 'required-input'
|
|
160
|
-
});
|
|
155
|
+
error = 'required-input';
|
|
161
156
|
}
|
|
162
157
|
onUserSelectDate === null || onUserSelectDate === void 0 ? void 0 : onUserSelectDate(date);
|
|
163
158
|
}
|
|
164
159
|
} else if (required && !formattedDate) {
|
|
165
|
-
|
|
166
|
-
error: 'required-input'
|
|
167
|
-
});
|
|
160
|
+
error = 'required-input';
|
|
168
161
|
}
|
|
169
|
-
|
|
162
|
+
onValidationResult === null || onValidationResult === void 0 ? void 0 : onValidationResult({
|
|
163
|
+
error
|
|
164
|
+
});
|
|
165
|
+
}, [allowTextInput, formatDate, formattedDate, maxDate, minDate, onUserSelectDate, onValidationResult, parseDateFromString, required, selectedDate, setSelectedDate]);
|
|
170
166
|
const setOpen = React.useCallback(newState => {
|
|
171
167
|
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(newState);
|
|
172
168
|
setOpenState(newState);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","ArrowDown","Enter","Escape","Calendar","CalendarMonthRegular","compareDatePart","DayOfWeek","FirstWeekOfYear","defaultDatePickerStrings","Input","mergeCallbacks","resolveShorthand","useControllableState","useEventCallback","useId","useMergedRefs","useOnClickOutside","useOnScrollOutside","useFieldContext_unstable","useFieldContext","useFluent_unstable","useFluent","useFocusFinders","useModalAttributes","usePopupPositioning","isDateOutOfBounds","date","minDate","maxDate","useFocusLogic","inputRef","useRef","preventFocusOpeningPicker","focus","_inputRef_current","_inputRef_current_focus","current","call","preventNextFocusOpeningPicker","usePopupVisibility","props","open","setOpen","initialState","defaultState","defaultOpen","state","isMounted","useEffect","_props_onOpenChange","onOpenChange","allowTextInput","useSelectedDate","formatDate","onSelectDate","value","selectedDate","setSelectedDateState","undefined","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","inlinePopup","isMonthPickerVisible","onUserSelectDate","openOnClick","onValidationError","parseDateFromString","showCloseButton","showGoToToday","showMonthPickerAsOverlay","showWeekNumbers","strings","today","underlined","restOfProps","calendar","rootRef","setOpenState","fieldContext","_fieldContext_required","required","popupSurfaceId","validateTextInput","useCallback","isNaN","getTime","error","newState","dismissDatePickerPopup","newlySelectedDate","showDatePickerPopup","calendarDismissed","onInputChange","ev","data","newValue","onInputBlur","onInputKeyDown","key","preventDefault","stopPropagation","altKey","onInputFocus","onInputClick","disabled","onIconClick","inputAppearance","triggerWrapperRef","popupRef","rootShorthand","defaultProps","appearance","contentAfter","createElement","onClick","readOnly","role","root","input","onChange","onBlur","onKeyDown","onFocus","modalAttributes","trapFocus","alwaysFocusable","legacyTrapFocus","popupSurfaceShorthand","popupSurface","id","targetDocument","element","callback","refs","findFirstFocusable","firstFocusable","popupOnClick","_rootRef_current","calendarShorthand","componentRef","onDismiss","useImperativeHandle","reset","components"],"sources":["../../../src/components/DatePicker/useDatePicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ArrowDown, Enter, Escape } from '@fluentui/keyboard-keys';\nimport { Calendar } from '../Calendar/Calendar';\nimport { CalendarMonthRegular } from '@fluentui/react-icons';\nimport { compareDatePart, DayOfWeek, FirstWeekOfYear } from '../../utils';\nimport { defaultDatePickerStrings } from './defaults';\nimport { Input } from '@fluentui/react-input';\nimport {\n mergeCallbacks,\n resolveShorthand,\n useControllableState,\n useEventCallback,\n useId,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\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 { useFocusFinders, useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopupPositioning } from '../../utils/usePopupPositioning';\nimport type { CalendarProps, ICalendar } from '../Calendar/Calendar.types';\nimport type { DatePickerProps, DatePickerState } 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 = () => {\n inputRef.current?.focus?.();\n };\n\n const preventNextFocusOpeningPicker = () => {\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({\n initialState: undefined,\n state: value,\n });\n const [formattedDate, setFormattedDate] = React.useState(() => (value && formatDate ? formatDate(value) : ''));\n\n const setSelectedDate = (newDate: Date | undefined) => {\n if (\n (selectedDate === undefined && newDate !== undefined) ||\n (selectedDate !== undefined && newDate === undefined) ||\n (newDate && selectedDate && (newDate > selectedDate || newDate < selectedDate))\n ) {\n onSelectDate?.(newDate);\n }\n\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<HTMLElement>): 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 = new Date(),\n inlinePopup = false,\n isMonthPickerVisible = true,\n maxDate,\n minDate,\n onOpenChange,\n onSelectDate: onUserSelectDate,\n openOnClick = true,\n onValidationError,\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 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 popupSurfaceId = useId('datePicker-popoverSurface');\n\n const validateTextInput = React.useCallback(\n (date: Date | null = null): void => {\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 onValidationError?.({ error: 'invalid-input' });\n } else {\n if (isDateOutOfBounds(date, minDate, maxDate)) {\n onValidationError?.({ error: 'out-of-bounds' });\n } else {\n setSelectedDate(date);\n }\n }\n } else {\n if (required) {\n onValidationError?.({ error: 'required-input' });\n }\n\n onUserSelectDate?.(date);\n }\n } else if (required && !formattedDate) {\n onValidationError?.({ error: 'required-input' });\n }\n },\n [\n allowTextInput,\n formatDate,\n formattedDate,\n maxDate,\n minDate,\n onUserSelectDate,\n onValidationError,\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 [onOpenChange, setOpenState],\n );\n\n const dismissDatePickerPopup = React.useCallback(\n (newlySelectedDate?: Date): 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 (ev: 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 (ev.altKey && !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 ((openOnClick || !disableAutoFocus) && !open && !props.disabled) {\n showDatePickerPopup();\n return;\n }\n\n if (allowTextInput) {\n dismissDatePickerPopup();\n }\n }, [\n allowTextInput,\n disableAutoFocus,\n dismissDatePickerPopup,\n openOnClick,\n open,\n props.disabled,\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 const rootShorthand = resolveShorthand(restOfProps, {\n required: true,\n defaultProps: {\n appearance: inputAppearance,\n 'aria-controls': open ? popupSurfaceId : undefined,\n 'aria-expanded': open,\n 'aria-haspopup': 'dialog',\n contentAfter: <CalendarMonthRegular onClick={onIconClick as unknown as React.MouseEventHandler<SVGElement>} />,\n readOnly: !allowTextInput,\n role: 'combobox',\n root: {\n ref: useMergedRefs(triggerWrapperRef, ref),\n 'aria-owns': popupSurfaceId,\n },\n input: {\n ref: rootRef,\n },\n },\n });\n rootShorthand.onChange = mergeCallbacks(rootShorthand.onChange, onInputChange);\n rootShorthand.onBlur = mergeCallbacks(rootShorthand.onBlur, onInputBlur);\n rootShorthand.onKeyDown = mergeCallbacks(rootShorthand.onKeyDown, onInputKeyDown);\n rootShorthand.onFocus = mergeCallbacks(rootShorthand.onFocus, onInputFocus);\n rootShorthand.onClick = mergeCallbacks(rootShorthand.onClick, onInputClick);\n\n const { modalAttributes } = useModalAttributes({ trapFocus: true, alwaysFocusable: true, legacyTrapFocus: false });\n const popupSurfaceShorthand = open\n ? resolveShorthand(props.popupSurface, {\n required: true,\n defaultProps: {\n 'aria-label': 'Calendar',\n 'aria-modal': true,\n id: popupSurfaceId,\n role: 'dialog',\n ref: popupRef,\n ...modalAttributes,\n },\n })\n : undefined;\n\n const { targetDocument } = useFluent();\n useOnClickOutside({\n element: targetDocument,\n callback: ev => dismissDatePickerPopup(),\n refs: [triggerWrapperRef, popupRef],\n disabled: !open,\n });\n\n useOnScrollOutside({\n element: targetDocument,\n callback: ev => dismissDatePickerPopup(),\n refs: [triggerWrapperRef, popupRef],\n disabled: !open,\n });\n\n const { findFirstFocusable } = useFocusFinders();\n React.useEffect(() => {\n if (disableAutoFocus) {\n return;\n }\n\n if (open && popupRef.current) {\n const firstFocusable = findFirstFocusable(popupRef.current);\n firstFocusable?.focus();\n }\n }, [disableAutoFocus, findFirstFocusable, open, popupRef]);\n\n const popupOnClick = useEventCallback(\n mergeCallbacks((ev: React.MouseEvent<HTMLDivElement>) => {\n rootRef.current?.focus();\n }, popupSurfaceShorthand?.onClick),\n );\n\n if (popupSurfaceShorthand) {\n popupSurfaceShorthand.onClick = popupOnClick;\n }\n\n const calendarShorthand = resolveShorthand(props.calendar, {\n required: true,\n defaultProps: {\n allFocusable,\n componentRef: calendar,\n dateTimeFormatter,\n firstDayOfWeek,\n firstWeekOfYear,\n highlightCurrentMonth,\n highlightSelectedMonth,\n isMonthPickerVisible,\n maxDate,\n minDate,\n onDismiss: calendarDismissed,\n showCloseButton,\n showGoToToday,\n showMonthPickerAsOverlay,\n showWeekNumbers,\n strings,\n today,\n value: selectedDate || initialPickerDate,\n },\n });\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n focus,\n reset() {\n setOpen(false);\n setSelectedDate(undefined);\n },\n showDatePickerPopup,\n }),\n [focus, setOpen, setSelectedDate, showDatePickerPopup],\n );\n\n const state: DatePickerState = {\n disabled: !!props.disabled,\n inlinePopup,\n\n components: {\n root: Input,\n calendar: Calendar as React.FC<Partial<CalendarProps>>,\n popupSurface: 'div',\n },\n\n calendar: calendarShorthand,\n root: rootShorthand,\n popupSurface: popupSurfaceShorthand,\n };\n\n state.root.value = formattedDate;\n state.calendar.onSelectDate = mergeCallbacks(state.calendar.onSelectDate, calendarDismissed);\n\n return state;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,SAAS,EAAEC,KAAK,EAAEC,MAAM,QAAQ;AACzC,SAASC,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AMlI,KAAA;MACNwF,QAAA,EAAU9F,QAAA;MACVmJ,YAAA,EAAc;IAChB;IAEArD,QAAA,EAAU+D,iBAAA;IACVrB,IAAA,EAAMR,aAAA;IACNmB,YAAA,EAAcD;EAChB;EAEAvG,KAAA,CAAM6F,IAAI,CAACpF,KAAK,GAAGI,aAAA;EACnBb,KAAA,CAAMmD,QAAQ,CAAC3C,YAAY,GAAG5C,cAAA,CAAeoC,KAAA,CAAMmD,QAAQ,CAAC3C,YAAY,EAAE2D,iBAAA;EAE1E,OAAOnE,KAAA;AACT"}
|
|
1
|
+
{"version":3,"names":["React","ArrowDown","Enter","Escape","Calendar","CalendarMonthRegular","compareDatePart","DayOfWeek","FirstWeekOfYear","defaultDatePickerStrings","Input","mergeCallbacks","resolveShorthand","useControllableState","useEventCallback","useId","useMergedRefs","useOnClickOutside","useOnScrollOutside","useFieldContext_unstable","useFieldContext","useFluent_unstable","useFluent","useFocusFinders","useModalAttributes","usePopupPositioning","isDateOutOfBounds","date","minDate","maxDate","useFocusLogic","inputRef","useRef","preventFocusOpeningPicker","focus","_inputRef_current","_inputRef_current_focus","current","call","preventNextFocusOpeningPicker","usePopupVisibility","props","open","setOpen","initialState","defaultState","defaultOpen","state","isMounted","useEffect","_props_onOpenChange","onOpenChange","allowTextInput","useSelectedDate","formatDate","onSelectDate","value","selectedDate","setSelectedDateState","undefined","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","inlinePopup","isMonthPickerVisible","onUserSelectDate","openOnClick","onValidationResult","parseDateFromString","showCloseButton","showGoToToday","showMonthPickerAsOverlay","showWeekNumbers","strings","today","underlined","restOfProps","calendar","rootRef","setOpenState","fieldContext","_fieldContext_required","required","popupSurfaceId","validateTextInput","useCallback","error","isNaN","getTime","newState","dismissDatePickerPopup","newlySelectedDate","showDatePickerPopup","calendarDismissed","onInputChange","ev","data","newValue","onInputBlur","onInputKeyDown","key","preventDefault","stopPropagation","altKey","onInputFocus","onInputClick","disabled","onIconClick","inputAppearance","triggerWrapperRef","popupRef","rootShorthand","defaultProps","appearance","contentAfter","createElement","onClick","readOnly","role","root","input","onChange","onBlur","onKeyDown","onFocus","modalAttributes","trapFocus","alwaysFocusable","legacyTrapFocus","popupSurfaceShorthand","popupSurface","id","targetDocument","element","callback","refs","findFirstFocusable","firstFocusable","popupOnClick","_rootRef_current","calendarShorthand","componentRef","onDismiss","useImperativeHandle","reset","components"],"sources":["../../../src/components/DatePicker/useDatePicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ArrowDown, Enter, Escape } from '@fluentui/keyboard-keys';\nimport { Calendar } from '../Calendar/Calendar';\nimport { CalendarMonthRegular } from '@fluentui/react-icons';\nimport { compareDatePart, DayOfWeek, FirstWeekOfYear } from '../../utils';\nimport { defaultDatePickerStrings } from './defaults';\nimport { Input } from '@fluentui/react-input';\nimport {\n mergeCallbacks,\n resolveShorthand,\n useControllableState,\n useEventCallback,\n useId,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\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 { useFocusFinders, useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopupPositioning } from '../../utils/usePopupPositioning';\nimport type { CalendarProps, ICalendar } from '../Calendar/Calendar.types';\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 = () => {\n inputRef.current?.focus?.();\n };\n\n const preventNextFocusOpeningPicker = () => {\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({\n initialState: undefined,\n state: value,\n });\n const [formattedDate, setFormattedDate] = React.useState(() => (value && formatDate ? formatDate(value) : ''));\n\n const setSelectedDate = (newDate: Date | undefined) => {\n if (\n (selectedDate === undefined && newDate !== undefined) ||\n (selectedDate !== undefined && newDate === undefined) ||\n (newDate && selectedDate && (newDate > selectedDate || newDate < selectedDate))\n ) {\n onSelectDate?.(newDate);\n }\n\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<HTMLElement>): 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 = new Date(),\n inlinePopup = false,\n isMonthPickerVisible = true,\n maxDate,\n minDate,\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 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 popupSurfaceId = useId('datePicker-popoverSurface');\n\n const validateTextInput = React.useCallback(\n (date: Date | null = null): void => {\n let error: DatePickerValidationResultData['error'] | undefined;\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 [onOpenChange, setOpenState],\n );\n\n const dismissDatePickerPopup = React.useCallback(\n (newlySelectedDate?: Date): 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 (ev: 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 (ev.altKey && !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 ((openOnClick || !disableAutoFocus) && !open && !props.disabled) {\n showDatePickerPopup();\n return;\n }\n\n if (allowTextInput) {\n dismissDatePickerPopup();\n }\n }, [\n allowTextInput,\n disableAutoFocus,\n dismissDatePickerPopup,\n openOnClick,\n open,\n props.disabled,\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 const rootShorthand = resolveShorthand(restOfProps, {\n required: true,\n defaultProps: {\n appearance: inputAppearance,\n 'aria-controls': open ? popupSurfaceId : undefined,\n 'aria-expanded': open,\n 'aria-haspopup': 'dialog',\n contentAfter: <CalendarMonthRegular onClick={onIconClick as unknown as React.MouseEventHandler<SVGElement>} />,\n readOnly: !allowTextInput,\n role: 'combobox',\n root: {\n ref: useMergedRefs(triggerWrapperRef, ref),\n 'aria-owns': popupSurfaceId,\n },\n input: {\n ref: rootRef,\n },\n },\n });\n rootShorthand.onChange = mergeCallbacks(rootShorthand.onChange, onInputChange);\n rootShorthand.onBlur = mergeCallbacks(rootShorthand.onBlur, onInputBlur);\n rootShorthand.onKeyDown = mergeCallbacks(rootShorthand.onKeyDown, onInputKeyDown);\n rootShorthand.onFocus = mergeCallbacks(rootShorthand.onFocus, onInputFocus);\n rootShorthand.onClick = mergeCallbacks(rootShorthand.onClick, onInputClick);\n\n const { modalAttributes } = useModalAttributes({ trapFocus: true, alwaysFocusable: true, legacyTrapFocus: false });\n const popupSurfaceShorthand = open\n ? resolveShorthand(props.popupSurface, {\n required: true,\n defaultProps: {\n 'aria-label': 'Calendar',\n 'aria-modal': true,\n id: popupSurfaceId,\n role: 'dialog',\n ref: popupRef,\n ...modalAttributes,\n },\n })\n : undefined;\n\n const { targetDocument } = useFluent();\n useOnClickOutside({\n element: targetDocument,\n callback: ev => dismissDatePickerPopup(),\n refs: [triggerWrapperRef, popupRef],\n disabled: !open,\n });\n\n useOnScrollOutside({\n element: targetDocument,\n callback: ev => dismissDatePickerPopup(),\n refs: [triggerWrapperRef, popupRef],\n disabled: !open,\n });\n\n const { findFirstFocusable } = useFocusFinders();\n React.useEffect(() => {\n if (disableAutoFocus) {\n return;\n }\n\n if (open && popupRef.current) {\n const firstFocusable = findFirstFocusable(popupRef.current);\n firstFocusable?.focus();\n }\n }, [disableAutoFocus, findFirstFocusable, open, popupRef]);\n\n const popupOnClick = useEventCallback(\n mergeCallbacks((ev: React.MouseEvent<HTMLDivElement>) => {\n rootRef.current?.focus();\n }, popupSurfaceShorthand?.onClick),\n );\n\n if (popupSurfaceShorthand) {\n popupSurfaceShorthand.onClick = popupOnClick;\n }\n\n const calendarShorthand = resolveShorthand(props.calendar, {\n required: true,\n defaultProps: {\n allFocusable,\n componentRef: calendar,\n dateTimeFormatter,\n firstDayOfWeek,\n firstWeekOfYear,\n highlightCurrentMonth,\n highlightSelectedMonth,\n isMonthPickerVisible,\n maxDate,\n minDate,\n onDismiss: calendarDismissed,\n showCloseButton,\n showGoToToday,\n showMonthPickerAsOverlay,\n showWeekNumbers,\n strings,\n today,\n value: selectedDate || initialPickerDate,\n },\n });\n\n React.useImperativeHandle(\n props.componentRef,\n () => ({\n focus,\n reset() {\n setOpen(false);\n setSelectedDate(undefined);\n },\n showDatePickerPopup,\n }),\n [focus, setOpen, setSelectedDate, showDatePickerPopup],\n );\n\n const state: DatePickerState = {\n disabled: !!props.disabled,\n inlinePopup,\n\n components: {\n root: Input,\n calendar: Calendar as React.FC<Partial<CalendarProps>>,\n popupSurface: 'div',\n },\n\n calendar: calendarShorthand,\n root: rootShorthand,\n popupSurface: popupSurfaceShorthand,\n };\n\n state.root.value = formattedDate;\n state.calendar.onSelectDate = mergeCallbacks(state.calendar.onSelectDate, calendarDismissed);\n\n return state;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,SAAS,EAAEC,KAAK,EAAEC,MAAM,QAAQ;AACzC,SAASC,QAAQ,QAAQ;AACzB,SAASC,oBAAoB,QAAQ;AACrC,SAASC,eAAe,EAAEC,SAAS,EAAEC,eAAe,QAAQ;AAC5D,SAASC,wBAAwB,QAAQ;AACzC,SAASC,KAAK,QAAQ;AACtB,SACEC,cAAc,EACdC,gBAAgB,EAChBC,oBAAoB,EACpBC,gBAAgB,EAChBC,KAAK,EACLC,aAAa,EACbC,iBAAiB,EACjBC,kBAAkB,QACb;AACP,SAASC,wBAAA,IAA4BC,eAAe,QAAQ;AAC5D,SAASC,kBAAA,IAAsBC,SAAS,QAAQ;AAChD,SAASC,eAAe,EAAEC,kBAAkB,QAAQ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,EAAc;MACZ5D,YAAA;MACAyF,YAAA,EAAchE,QAAA;MACdvB,iBAAA;MACAE,cAAA;MACAE,eAAA;MACAE,qBAAA;MACAC,sBAAA;MACAG,oBAAA;MACAxD,OAAA;MACAD,OAAA;MACAuI,SAAA,EAAWjD,iBAAA;MACXxB,eAAA;MACAC,aAAA;MACAC,wBAAA;MACAC,eAAA;MACAC,OAAA;MACAC,KAAA;MACAvC,KAAA,EAAOC,YAAA,IAAgB0B;IACzB;EACF;EAEAnF,KAAA,CAAMoK,mBAAmB,CACvB3H,KAAA,CAAMyH,YAAY,EAClB,OAAO;IACLhI,KAAA;IACAmI,MAAA,EAAQ;MACN1H,OAAA,CAAQ,KAAK;MACboB,eAAA,CAAgBJ,SAAA;IAClB;IACAsD;EACF,IACA,CAAC/E,KAAA,EAAOS,OAAA,EAASoB,eAAA,EAAiBkD,mBAAA,CAAoB;EAGxD,MAAMlE,KAAA,GAAyB;IAC7BgF,QAAA,EAAU,CAAC,CAACtF,KAAA,CAAMsF,QAAQ;IAC1B3C,WAAA;IAEAkF,UAAA,EAAY;MACV1B,IAAA,EAAMlI,KAAA;MACNwF,QAAA,EAAU9F,QAAA;MACVmJ,YAAA,EAAc;IAChB;IAEArD,QAAA,EAAU+D,iBAAA;IACVrB,IAAA,EAAMR,aAAA;IACNmB,YAAA,EAAcD;EAChB;EAEAvG,KAAA,CAAM6F,IAAI,CAACpF,KAAK,GAAGI,aAAA;EACnBb,KAAA,CAAMmD,QAAQ,CAAC3C,YAAY,GAAG5C,cAAA,CAAeoC,KAAA,CAAMmD,QAAQ,CAAC3C,YAAY,EAAE2D,iBAAA;EAE1E,OAAOnE,KAAA;AACT"}
|
|
@@ -35,4 +35,4 @@ export const useDatePickerStyles_unstable = state => {
|
|
|
35
35
|
state.calendar.className = mergeClasses(datePickerClassNames.calendar, state.calendar.className);
|
|
36
36
|
return state;
|
|
37
37
|
};
|
|
38
|
-
//# sourceMappingURL=useDatePickerStyles.js.map
|
|
38
|
+
//# sourceMappingURL=useDatePickerStyles.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__resetStyles","__styles","mergeClasses","tokens","typographyStyles","datePickerClassNames","root","calendar","popupSurface","useStyles","base","qhf8xq","Bceei9c","xfaavh","disabled","d","usePopupSurfaceClassName","useDatePickerStyles_unstable","state","styles","popupSurfaceClassName","className"],"sources":["../../../src/components/DatePicker/useDatePickerStyles.styles.ts"],"sourcesContent":["import { 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});\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 } = state;\n\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 state.popupSurface.className = mergeClasses(\n datePickerClassNames.popupSurface,\n popupSurfaceClassName,\n state.popupSurface.className,\n );\n }\n\n state.calendar.className = mergeClasses(datePickerClassNames.calendar, state.calendar.className);\n\n return state;\n};\n"],"mappings":"AAAA,SAAAA,aAAA,EAAAC,QAAA,EAAsCC,YAAY,QAAQ;AAC1D,SAASC,MAAM,EAAEC,gBAAgB,QAAQ;AAIzC,OAAO,MAAMC,oBAAA,GAAwD;EACnEC,IAAA,EAAM;EACNC,QAAA,EAAU;EACVC,YAAA,EAAc;AAChB;AAEA,MAAMC,SAAA,gBAAYR,QAAA;EAAAS,IAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;EAAA;EAAAC,QAAA;IAAAF,OAAA;IAAAC,MAAA;EAAA;AAAA;EAAAE,CAAA;AAAA,EAclB;AAEA,MAAMC,wBAAA,gBAA2BhB,aAAA,6fAUjC;AAEA;;;AAGA,OAAO,MAAMiB,4BAAA,GAAgCC,KAAA,IAA4C;EACvF,MAAMC,MAAA,GAASV,SAAA;EACf,MAAMW,qBAAA,GAAwBJ,wBAAA;EAC9B,MAAM;IAAEF;EAAQ,CAAE,GAAGI,KAAA;EAErBA,KAAA,CAAMZ,IAAI,CAACe,SAAS,GAAGnB,YAAA,CACrBG,oBAAA,CAAqBC,IAAI,EACzBa,MAAA,CAAOT,IAAI,EACXI,QAAA,IAAYK,MAAA,CAAOL,QAAQ,EAC3BI,KAAA,CAAMZ,IAAI,CAACe,SAAS;EAGtB,IAAIH,KAAA,CAAMV,YAAY,EAAE;IACtBU,KAAA,CAAMV,YAAY,CAACa,SAAS,GAAGnB,YAAA,CAC7BG,oBAAA,CAAqBG,YAAY,EACjCY,qBAAA,EACAF,KAAA,CAAMV,YAAY,CAACa,SAAS;EAEhC;EAEAH,KAAA,CAAMX,QAAQ,CAACc,SAAS,GAAGnB,YAAA,CAAaG,oBAAA,CAAqBE,QAAQ,EAAEW,KAAA,CAAMX,QAAQ,CAACc,SAAS;EAE/F,OAAOH,KAAA;AACT"}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AnimationDirection","DatePicker","datePickerClassNames","defaultDatePickerErrorStrings","defaultDatePickerStrings","renderDatePicker_unstable","useDatePicker_unstable","useDatePickerStyles_unstable","DAYS_IN_WEEK","DateRangeType","DayOfWeek","FirstWeekOfYear","MonthOfYear","TimeConstants","addDays","addMonths","addWeeks","addYears","compareDatePart","compareDates","getDatePartHashValue","getDateRangeArray","getEndDateOfWeek","getMonthEnd","getMonthStart","getStartDateOfWeek","getWeekNumber","getWeekNumbersInMonth","getYearEnd","getYearStart","isInDateRangeArray","setMonth"],"sources":["../src/index.ts"],"sourcesContent":["export { AnimationDirection } from './Calendar';\nexport type { CalendarProps, ICalendar } from './Calendar';\n\nexport type { CalendarDayProps, ICalendarDay } from './CalendarDay';\n\nexport type { CalendarMonthProps, ICalendarMonth } from './CalendarMonth';\n\nexport {\n DatePicker,\n datePickerClassNames,\n defaultDatePickerErrorStrings,\n defaultDatePickerStrings,\n renderDatePicker_unstable,\n useDatePicker_unstable,\n useDatePickerStyles_unstable,\n} from './DatePicker';\nexport type {
|
|
1
|
+
{"version":3,"names":["AnimationDirection","DatePicker","datePickerClassNames","defaultDatePickerErrorStrings","defaultDatePickerStrings","renderDatePicker_unstable","useDatePicker_unstable","useDatePickerStyles_unstable","DAYS_IN_WEEK","DateRangeType","DayOfWeek","FirstWeekOfYear","MonthOfYear","TimeConstants","addDays","addMonths","addWeeks","addYears","compareDatePart","compareDates","getDatePartHashValue","getDateRangeArray","getEndDateOfWeek","getMonthEnd","getMonthStart","getStartDateOfWeek","getWeekNumber","getWeekNumbersInMonth","getYearEnd","getYearStart","isInDateRangeArray","setMonth"],"sources":["../src/index.ts"],"sourcesContent":["export { AnimationDirection } from './Calendar';\nexport type { CalendarProps, ICalendar } from './Calendar';\n\nexport type { CalendarDayProps, ICalendarDay } from './CalendarDay';\n\nexport type { CalendarMonthProps, ICalendarMonth } from './CalendarMonth';\n\nexport {\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, IDatePicker } from './DatePicker';\n\nexport {\n DAYS_IN_WEEK,\n DateRangeType,\n DayOfWeek,\n FirstWeekOfYear,\n MonthOfYear,\n TimeConstants,\n addDays,\n addMonths,\n addWeeks,\n addYears,\n compareDatePart,\n compareDates,\n getDatePartHashValue,\n getDateRangeArray,\n getEndDateOfWeek,\n getMonthEnd,\n getMonthStart,\n getStartDateOfWeek,\n getWeekNumber,\n getWeekNumbersInMonth,\n getYearEnd,\n getYearStart,\n isInDateRangeArray,\n setMonth,\n} from './utils';\nexport type { CalendarStrings, DateFormatting, DateGridStrings } from './utils';\n"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ;AAOnC,SACEC,UAAU,EACVC,oBAAoB,EACpBC,6BAA6B,EAC7BC,wBAAwB,EACxBC,yBAAyB,EACzBC,sBAAsB,EACtBC,4BAA4B,QACvB;AAGP,SACEC,YAAY,EACZC,aAAa,EACbC,SAAS,EACTC,eAAe,EACfC,WAAW,EACXC,aAAa,EACbC,OAAO,EACPC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,eAAe,EACfC,YAAY,EACZC,oBAAoB,EACpBC,iBAAiB,EACjBC,gBAAgB,EAChBC,WAAW,EACXC,aAAa,EACbC,kBAAkB,EAClBC,aAAa,EACbC,qBAAqB,EACrBC,UAAU,EACVC,YAAY,EACZC,kBAAkB,EAClBC,QAAQ,QACH"}
|
|
@@ -13,7 +13,7 @@ const _reactUtilities = require("@fluentui/react-utilities");
|
|
|
13
13
|
const _utils = require("../../utils");
|
|
14
14
|
const _calendarDay = require("../CalendarDay/CalendarDay");
|
|
15
15
|
const _calendarMonth = require("../CalendarMonth/CalendarMonth");
|
|
16
|
-
const
|
|
16
|
+
const _useCalendarStylesStyles = require("./useCalendarStyles.styles");
|
|
17
17
|
const MIN_SIZE_FORCE_OVERLAY = 440;
|
|
18
18
|
const defaultWorkWeekDays = [
|
|
19
19
|
_utils.DayOfWeek.Monday,
|
|
@@ -224,7 +224,7 @@ const Calendar = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
224
224
|
};
|
|
225
225
|
const showMonthPickerAsOverlay = getShowMonthPickerAsOverlay(props);
|
|
226
226
|
const monthPickerOnly = !showMonthPickerAsOverlay && !isDayPickerVisible;
|
|
227
|
-
const classes = (0,
|
|
227
|
+
const classes = (0, _useCalendarStylesStyles.useCalendarStyles_unstable)({
|
|
228
228
|
className,
|
|
229
229
|
isDayPickerVisible,
|
|
230
230
|
isMonthPickerVisible,
|