@fluentui/react-datepicker-compat 0.0.0-beta.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.
Files changed (263) hide show
  1. package/.swcrc +30 -0
  2. package/CHANGELOG.json +56 -0
  3. package/CHANGELOG.md +19 -0
  4. package/LICENSE +15 -0
  5. package/README.md +42 -0
  6. package/dist/index.d.ts +1156 -0
  7. package/lib/Calendar.js +2 -0
  8. package/lib/Calendar.js.map +1 -0
  9. package/lib/CalendarDay.js +2 -0
  10. package/lib/CalendarDay.js.map +1 -0
  11. package/lib/CalendarDayGrid.js +2 -0
  12. package/lib/CalendarDayGrid.js.map +1 -0
  13. package/lib/CalendarMonth.js +2 -0
  14. package/lib/CalendarMonth.js.map +1 -0
  15. package/lib/CalendarPicker.js +2 -0
  16. package/lib/CalendarPicker.js.map +1 -0
  17. package/lib/CalendarYear.js +2 -0
  18. package/lib/CalendarYear.js.map +1 -0
  19. package/lib/DatePicker.js +2 -0
  20. package/lib/DatePicker.js.map +1 -0
  21. package/lib/components/Calendar/Calendar.js +319 -0
  22. package/lib/components/Calendar/Calendar.js.map +1 -0
  23. package/lib/components/Calendar/Calendar.types.js +15 -0
  24. package/lib/components/Calendar/Calendar.types.js.map +1 -0
  25. package/lib/components/Calendar/defaults.js +3 -0
  26. package/lib/components/Calendar/defaults.js.map +1 -0
  27. package/lib/components/Calendar/index.js +5 -0
  28. package/lib/components/Calendar/index.js.map +1 -0
  29. package/lib/components/Calendar/useCalendarStyles.js +149 -0
  30. package/lib/components/Calendar/useCalendarStyles.js.map +1 -0
  31. package/lib/components/CalendarDay/CalendarDay.js +143 -0
  32. package/lib/components/CalendarDay/CalendarDay.js.map +1 -0
  33. package/lib/components/CalendarDay/CalendarDay.types.js +2 -0
  34. package/lib/components/CalendarDay/CalendarDay.types.js.map +1 -0
  35. package/lib/components/CalendarDay/index.js +4 -0
  36. package/lib/components/CalendarDay/index.js.map +1 -0
  37. package/lib/components/CalendarDay/useCalendarDayStyles.js +180 -0
  38. package/lib/components/CalendarDay/useCalendarDayStyles.js.map +1 -0
  39. package/lib/components/CalendarDayGrid/CalendarDayGrid.js +183 -0
  40. package/lib/components/CalendarDayGrid/CalendarDayGrid.js.map +1 -0
  41. package/lib/components/CalendarDayGrid/CalendarDayGrid.types.js +2 -0
  42. package/lib/components/CalendarDayGrid/CalendarDayGrid.types.js.map +1 -0
  43. package/lib/components/CalendarDayGrid/CalendarGridDayCell.js +193 -0
  44. package/lib/components/CalendarDayGrid/CalendarGridDayCell.js.map +1 -0
  45. package/lib/components/CalendarDayGrid/CalendarGridRow.js +40 -0
  46. package/lib/components/CalendarDayGrid/CalendarGridRow.js.map +1 -0
  47. package/lib/components/CalendarDayGrid/CalendarMonthHeaderRow.js +46 -0
  48. package/lib/components/CalendarDayGrid/CalendarMonthHeaderRow.js.map +1 -0
  49. package/lib/components/CalendarDayGrid/index.js +5 -0
  50. package/lib/components/CalendarDayGrid/index.js.map +1 -0
  51. package/lib/components/CalendarDayGrid/useCalendarDayGridStyles.js +443 -0
  52. package/lib/components/CalendarDayGrid/useCalendarDayGridStyles.js.map +1 -0
  53. package/lib/components/CalendarDayGrid/useWeekCornerStyles.js +98 -0
  54. package/lib/components/CalendarDayGrid/useWeekCornerStyles.js.map +1 -0
  55. package/lib/components/CalendarDayGrid/useWeeks.js +47 -0
  56. package/lib/components/CalendarDayGrid/useWeeks.js.map +1 -0
  57. package/lib/components/CalendarMonth/CalendarMonth.js +282 -0
  58. package/lib/components/CalendarMonth/CalendarMonth.js.map +1 -0
  59. package/lib/components/CalendarMonth/CalendarMonth.types.js +2 -0
  60. package/lib/components/CalendarMonth/CalendarMonth.types.js.map +1 -0
  61. package/lib/components/CalendarMonth/index.js +4 -0
  62. package/lib/components/CalendarMonth/index.js.map +1 -0
  63. package/lib/components/CalendarMonth/useCalendarMonthStyles.js +10 -0
  64. package/lib/components/CalendarMonth/useCalendarMonthStyles.js.map +1 -0
  65. package/lib/components/CalendarPicker/CalendarPicker.types.js +2 -0
  66. package/lib/components/CalendarPicker/CalendarPicker.types.js.map +1 -0
  67. package/lib/components/CalendarPicker/index.js +3 -0
  68. package/lib/components/CalendarPicker/index.js.map +1 -0
  69. package/lib/components/CalendarPicker/useCalendarPickerStyles.js +371 -0
  70. package/lib/components/CalendarPicker/useCalendarPickerStyles.js.map +1 -0
  71. package/lib/components/CalendarYear/CalendarYear.js +350 -0
  72. package/lib/components/CalendarYear/CalendarYear.js.map +1 -0
  73. package/lib/components/CalendarYear/CalendarYear.types.js +2 -0
  74. package/lib/components/CalendarYear/CalendarYear.types.js.map +1 -0
  75. package/lib/components/CalendarYear/index.js +4 -0
  76. package/lib/components/CalendarYear/index.js.map +1 -0
  77. package/lib/components/CalendarYear/useCalendarYearStyles.js +10 -0
  78. package/lib/components/CalendarYear/useCalendarYearStyles.js.map +1 -0
  79. package/lib/components/DatePicker/DatePicker.js +11 -0
  80. package/lib/components/DatePicker/DatePicker.js.map +1 -0
  81. package/lib/components/DatePicker/DatePicker.types.js +2 -0
  82. package/lib/components/DatePicker/DatePicker.types.js.map +1 -0
  83. package/lib/components/DatePicker/defaults.js +13 -0
  84. package/lib/components/DatePicker/defaults.js.map +1 -0
  85. package/lib/components/DatePicker/index.js +7 -0
  86. package/lib/components/DatePicker/index.js.map +1 -0
  87. package/lib/components/DatePicker/renderDatePicker.js +35 -0
  88. package/lib/components/DatePicker/renderDatePicker.js.map +1 -0
  89. package/lib/components/DatePicker/useDatePicker.js +453 -0
  90. package/lib/components/DatePicker/useDatePicker.js.map +1 -0
  91. package/lib/components/DatePicker/useDatePickerStyles.js +62 -0
  92. package/lib/components/DatePicker/useDatePickerStyles.js.map +1 -0
  93. package/lib/index.js +4 -0
  94. package/lib/index.js.map +1 -0
  95. package/lib/utils/animations.js +98 -0
  96. package/lib/utils/animations.js.map +1 -0
  97. package/lib/utils/constants.js +64 -0
  98. package/lib/utils/constants.js.map +1 -0
  99. package/lib/utils/dateFormatting/dateFormatting.defaults.js +58 -0
  100. package/lib/utils/dateFormatting/dateFormatting.defaults.js.map +1 -0
  101. package/lib/utils/dateFormatting/dateFormatting.types.js +2 -0
  102. package/lib/utils/dateFormatting/dateFormatting.types.js.map +1 -0
  103. package/lib/utils/dateFormatting/index.js +3 -0
  104. package/lib/utils/dateFormatting/index.js.map +1 -0
  105. package/lib/utils/dateGrid/dateGrid.types.js +2 -0
  106. package/lib/utils/dateGrid/dateGrid.types.js.map +1 -0
  107. package/lib/utils/dateGrid/findAvailableDate.js +29 -0
  108. package/lib/utils/dateGrid/findAvailableDate.js.map +1 -0
  109. package/lib/utils/dateGrid/getBoundedDateRange.js +18 -0
  110. package/lib/utils/dateGrid/getBoundedDateRange.js.map +1 -0
  111. package/lib/utils/dateGrid/getDateRangeTypeToUse.js +18 -0
  112. package/lib/utils/dateGrid/getDateRangeTypeToUse.js.map +1 -0
  113. package/lib/utils/dateGrid/getDayGrid.js +85 -0
  114. package/lib/utils/dateGrid/getDayGrid.js.map +1 -0
  115. package/lib/utils/dateGrid/index.js +6 -0
  116. package/lib/utils/dateGrid/index.js.map +1 -0
  117. package/lib/utils/dateGrid/isAfterMaxDate.js +13 -0
  118. package/lib/utils/dateGrid/isAfterMaxDate.js.map +1 -0
  119. package/lib/utils/dateGrid/isBeforeMinDate.js +13 -0
  120. package/lib/utils/dateGrid/isBeforeMinDate.js.map +1 -0
  121. package/lib/utils/dateGrid/isContiguous.js +19 -0
  122. package/lib/utils/dateGrid/isContiguous.js.map +1 -0
  123. package/lib/utils/dateGrid/isRestrictedDate.js +21 -0
  124. package/lib/utils/dateGrid/isRestrictedDate.js.map +1 -0
  125. package/lib/utils/dateMath/dateMath.js +358 -0
  126. package/lib/utils/dateMath/dateMath.js.map +1 -0
  127. package/lib/utils/dateMath/index.js +2 -0
  128. package/lib/utils/dateMath/index.js.map +1 -0
  129. package/lib/utils/dom.js +9 -0
  130. package/lib/utils/dom.js.map +1 -0
  131. package/lib/utils/focus.js +28 -0
  132. package/lib/utils/focus.js.map +1 -0
  133. package/lib/utils/index.js +8 -0
  134. package/lib/utils/index.js.map +1 -0
  135. package/lib-commonjs/Calendar.js +9 -0
  136. package/lib-commonjs/Calendar.js.map +1 -0
  137. package/lib-commonjs/CalendarDay.js +9 -0
  138. package/lib-commonjs/CalendarDay.js.map +1 -0
  139. package/lib-commonjs/CalendarDayGrid.js +9 -0
  140. package/lib-commonjs/CalendarDayGrid.js.map +1 -0
  141. package/lib-commonjs/CalendarMonth.js +9 -0
  142. package/lib-commonjs/CalendarMonth.js.map +1 -0
  143. package/lib-commonjs/CalendarPicker.js +9 -0
  144. package/lib-commonjs/CalendarPicker.js.map +1 -0
  145. package/lib-commonjs/CalendarYear.js +9 -0
  146. package/lib-commonjs/CalendarYear.js.map +1 -0
  147. package/lib-commonjs/DatePicker.js +9 -0
  148. package/lib-commonjs/DatePicker.js.map +1 -0
  149. package/lib-commonjs/components/Calendar/Calendar.js +306 -0
  150. package/lib-commonjs/components/Calendar/Calendar.js.map +1 -0
  151. package/lib-commonjs/components/Calendar/Calendar.types.js +21 -0
  152. package/lib-commonjs/components/Calendar/Calendar.types.js.map +1 -0
  153. package/lib-commonjs/components/Calendar/defaults.js +12 -0
  154. package/lib-commonjs/components/Calendar/defaults.js.map +1 -0
  155. package/lib-commonjs/components/Calendar/index.js +16 -0
  156. package/lib-commonjs/components/Calendar/index.js.map +1 -0
  157. package/lib-commonjs/components/Calendar/useCalendarStyles.js +286 -0
  158. package/lib-commonjs/components/Calendar/useCalendarStyles.js.map +1 -0
  159. package/lib-commonjs/components/CalendarDay/CalendarDay.js +124 -0
  160. package/lib-commonjs/components/CalendarDay/CalendarDay.js.map +1 -0
  161. package/lib-commonjs/components/CalendarDay/CalendarDay.types.js +9 -0
  162. package/lib-commonjs/components/CalendarDay/CalendarDay.types.js.map +1 -0
  163. package/lib-commonjs/components/CalendarDay/index.js +11 -0
  164. package/lib-commonjs/components/CalendarDay/index.js.map +1 -0
  165. package/lib-commonjs/components/CalendarDay/useCalendarDayStyles.js +356 -0
  166. package/lib-commonjs/components/CalendarDay/useCalendarDayStyles.js.map +1 -0
  167. package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.js +181 -0
  168. package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.js.map +1 -0
  169. package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.types.js +9 -0
  170. package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.types.js.map +1 -0
  171. package/lib-commonjs/components/CalendarDayGrid/CalendarGridDayCell.js +173 -0
  172. package/lib-commonjs/components/CalendarDayGrid/CalendarGridDayCell.js.map +1 -0
  173. package/lib-commonjs/components/CalendarDayGrid/CalendarGridRow.js +35 -0
  174. package/lib-commonjs/components/CalendarDayGrid/CalendarGridRow.js.map +1 -0
  175. package/lib-commonjs/components/CalendarDayGrid/CalendarMonthHeaderRow.js +45 -0
  176. package/lib-commonjs/components/CalendarDayGrid/CalendarMonthHeaderRow.js.map +1 -0
  177. package/lib-commonjs/components/CalendarDayGrid/index.js +21 -0
  178. package/lib-commonjs/components/CalendarDayGrid/index.js.map +1 -0
  179. package/lib-commonjs/components/CalendarDayGrid/useCalendarDayGridStyles.js +916 -0
  180. package/lib-commonjs/components/CalendarDayGrid/useCalendarDayGridStyles.js.map +1 -0
  181. package/lib-commonjs/components/CalendarDayGrid/useWeekCornerStyles.js +103 -0
  182. package/lib-commonjs/components/CalendarDayGrid/useWeekCornerStyles.js.map +1 -0
  183. package/lib-commonjs/components/CalendarDayGrid/useWeeks.js +54 -0
  184. package/lib-commonjs/components/CalendarDayGrid/useWeeks.js.map +1 -0
  185. package/lib-commonjs/components/CalendarMonth/CalendarMonth.js +271 -0
  186. package/lib-commonjs/components/CalendarMonth/CalendarMonth.js.map +1 -0
  187. package/lib-commonjs/components/CalendarMonth/CalendarMonth.types.js +9 -0
  188. package/lib-commonjs/components/CalendarMonth/CalendarMonth.types.js.map +1 -0
  189. package/lib-commonjs/components/CalendarMonth/index.js +11 -0
  190. package/lib-commonjs/components/CalendarMonth/index.js.map +1 -0
  191. package/lib-commonjs/components/CalendarMonth/useCalendarMonthStyles.js +14 -0
  192. package/lib-commonjs/components/CalendarMonth/useCalendarMonthStyles.js.map +1 -0
  193. package/lib-commonjs/components/CalendarPicker/CalendarPicker.types.js +7 -0
  194. package/lib-commonjs/components/CalendarPicker/CalendarPicker.types.js.map +1 -0
  195. package/lib-commonjs/components/CalendarPicker/index.js +10 -0
  196. package/lib-commonjs/components/CalendarPicker/index.js.map +1 -0
  197. package/lib-commonjs/components/CalendarPicker/useCalendarPickerStyles.js +746 -0
  198. package/lib-commonjs/components/CalendarPicker/useCalendarPickerStyles.js.map +1 -0
  199. package/lib-commonjs/components/CalendarYear/CalendarYear.js +307 -0
  200. package/lib-commonjs/components/CalendarYear/CalendarYear.js.map +1 -0
  201. package/lib-commonjs/components/CalendarYear/CalendarYear.types.js +9 -0
  202. package/lib-commonjs/components/CalendarYear/CalendarYear.types.js.map +1 -0
  203. package/lib-commonjs/components/CalendarYear/index.js +11 -0
  204. package/lib-commonjs/components/CalendarYear/index.js.map +1 -0
  205. package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.js +14 -0
  206. package/lib-commonjs/components/CalendarYear/useCalendarYearStyles.js.map +1 -0
  207. package/lib-commonjs/components/DatePicker/DatePicker.js +21 -0
  208. package/lib-commonjs/components/DatePicker/DatePicker.js.map +1 -0
  209. package/lib-commonjs/components/DatePicker/DatePicker.types.js +9 -0
  210. package/lib-commonjs/components/DatePicker/DatePicker.types.js.map +1 -0
  211. package/lib-commonjs/components/DatePicker/defaults.js +22 -0
  212. package/lib-commonjs/components/DatePicker/defaults.js.map +1 -0
  213. package/lib-commonjs/components/DatePicker/index.js +14 -0
  214. package/lib-commonjs/components/DatePicker/index.js.map +1 -0
  215. package/lib-commonjs/components/DatePicker/renderDatePicker.js +33 -0
  216. package/lib-commonjs/components/DatePicker/renderDatePicker.js.map +1 -0
  217. package/lib-commonjs/components/DatePicker/useDatePicker.js +486 -0
  218. package/lib-commonjs/components/DatePicker/useDatePicker.js.map +1 -0
  219. package/lib-commonjs/components/DatePicker/useDatePickerStyles.js +100 -0
  220. package/lib-commonjs/components/DatePicker/useDatePickerStyles.js.map +1 -0
  221. package/lib-commonjs/index.js +50 -0
  222. package/lib-commonjs/index.js.map +1 -0
  223. package/lib-commonjs/utils/animations.js +126 -0
  224. package/lib-commonjs/utils/animations.js.map +1 -0
  225. package/lib-commonjs/utils/constants.js +82 -0
  226. package/lib-commonjs/utils/constants.js.map +1 -0
  227. package/lib-commonjs/utils/dateFormatting/dateFormatting.defaults.js +102 -0
  228. package/lib-commonjs/utils/dateFormatting/dateFormatting.defaults.js.map +1 -0
  229. package/lib-commonjs/utils/dateFormatting/dateFormatting.types.js +7 -0
  230. package/lib-commonjs/utils/dateFormatting/dateFormatting.types.js.map +1 -0
  231. package/lib-commonjs/utils/dateFormatting/index.js +10 -0
  232. package/lib-commonjs/utils/dateFormatting/index.js.map +1 -0
  233. package/lib-commonjs/utils/dateGrid/dateGrid.types.js +7 -0
  234. package/lib-commonjs/utils/dateGrid/dateGrid.types.js.map +1 -0
  235. package/lib-commonjs/utils/dateGrid/findAvailableDate.js +29 -0
  236. package/lib-commonjs/utils/dateGrid/findAvailableDate.js.map +1 -0
  237. package/lib-commonjs/utils/dateGrid/getBoundedDateRange.js +23 -0
  238. package/lib-commonjs/utils/dateGrid/getBoundedDateRange.js.map +1 -0
  239. package/lib-commonjs/utils/dateGrid/getDateRangeTypeToUse.js +20 -0
  240. package/lib-commonjs/utils/dateGrid/getDateRangeTypeToUse.js.map +1 -0
  241. package/lib-commonjs/utils/dateGrid/getDayGrid.js +76 -0
  242. package/lib-commonjs/utils/dateGrid/getDayGrid.js.map +1 -0
  243. package/lib-commonjs/utils/dateGrid/index.js +13 -0
  244. package/lib-commonjs/utils/dateGrid/index.js.map +1 -0
  245. package/lib-commonjs/utils/dateGrid/isAfterMaxDate.js +15 -0
  246. package/lib-commonjs/utils/dateGrid/isAfterMaxDate.js.map +1 -0
  247. package/lib-commonjs/utils/dateGrid/isBeforeMinDate.js +15 -0
  248. package/lib-commonjs/utils/dateGrid/isBeforeMinDate.js.map +1 -0
  249. package/lib-commonjs/utils/dateGrid/isContiguous.js +28 -0
  250. package/lib-commonjs/utils/dateGrid/isContiguous.js.map +1 -0
  251. package/lib-commonjs/utils/dateGrid/isRestrictedDate.js +21 -0
  252. package/lib-commonjs/utils/dateGrid/isRestrictedDate.js.map +1 -0
  253. package/lib-commonjs/utils/dateMath/dateMath.js +274 -0
  254. package/lib-commonjs/utils/dateMath/dateMath.js.map +1 -0
  255. package/lib-commonjs/utils/dateMath/index.js +9 -0
  256. package/lib-commonjs/utils/dateMath/index.js.map +1 -0
  257. package/lib-commonjs/utils/dom.js +18 -0
  258. package/lib-commonjs/utils/dom.js.map +1 -0
  259. package/lib-commonjs/utils/focus.js +31 -0
  260. package/lib-commonjs/utils/focus.js.map +1 -0
  261. package/lib-commonjs/utils/index.js +15 -0
  262. package/lib-commonjs/utils/index.js.map +1 -0
  263. package/package.json +72 -0
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "renderDatePicker_unstable", {
6
+ enumerable: true,
7
+ get: ()=>renderDatePicker_unstable
8
+ });
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _reactPopover = require("@fluentui/react-popover");
12
+ const _reactUtilities = require("@fluentui/react-utilities");
13
+ const renderDatePicker_unstable = (state)=>{
14
+ const { slots , slotProps } = (0, _reactUtilities.getSlots)(state);
15
+ return /*#__PURE__*/ _react.createElement(slots.root, slotProps.root, /*#__PURE__*/ _react.createElement(slots.wrapper, slotProps.wrapper, /*#__PURE__*/ _react.createElement(slots.popover, slotProps.popover, /*#__PURE__*/ _react.createElement(_reactPopover.PopoverTrigger, null, (popoverTriggerChildProps)=>{
16
+ // onKeyDown/Up and onClick are not needed as DatePicker handles opening and closing the popover
17
+ // internally. These also cause issues when typing in the input and clicking the input to open, not
18
+ // letting the user open the popover by clicking the input and causing issues with BACKSPACE and SPACE
19
+ // keys.
20
+ const { onClick , onKeyDown , onKeyUp , role , ...inputTriggerProps } = popoverTriggerChildProps;
21
+ const inputProps = {
22
+ input: {
23
+ ...inputTriggerProps
24
+ }
25
+ };
26
+ return /*#__PURE__*/ _react.createElement(slots.field, slotProps.field, /*#__PURE__*/ _react.createElement(slots.input, {
27
+ ...slotProps.input,
28
+ ...inputProps
29
+ }));
30
+ }), /*#__PURE__*/ _react.createElement(slots.popoverSurface, slotProps.popoverSurface, /*#__PURE__*/ _react.createElement(slots.calendar, slotProps.calendar)))));
31
+ }; //# sourceMappingURL=renderDatePicker.js.map
32
+
33
+ //# sourceMappingURL=renderDatePicker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../lib/components/DatePicker/renderDatePicker.js"],"sourcesContent":["import * as React from 'react';\nimport { PopoverTrigger } from '@fluentui/react-popover';\nimport { getSlots } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of DatePicker\n */\nexport const renderDatePicker_unstable = state => {\n const {\n slots,\n slotProps\n } = getSlots(state);\n return /*#__PURE__*/React.createElement(slots.root, slotProps.root, /*#__PURE__*/React.createElement(slots.wrapper, slotProps.wrapper, /*#__PURE__*/React.createElement(slots.popover, slotProps.popover, /*#__PURE__*/React.createElement(PopoverTrigger, null, popoverTriggerChildProps => {\n // onKeyDown/Up and onClick are not needed as DatePicker handles opening and closing the popover\n // internally. These also cause issues when typing in the input and clicking the input to open, not\n // letting the user open the popover by clicking the input and causing issues with BACKSPACE and SPACE\n // keys.\n const {\n onClick,\n onKeyDown,\n onKeyUp,\n role,\n ...inputTriggerProps\n } = popoverTriggerChildProps;\n const inputProps = {\n input: {\n ...inputTriggerProps\n }\n };\n return /*#__PURE__*/React.createElement(slots.field, slotProps.field, /*#__PURE__*/React.createElement(slots.input, {\n ...slotProps.input,\n ...inputProps\n }));\n }), /*#__PURE__*/React.createElement(slots.popoverSurface, slotProps.popoverSurface, /*#__PURE__*/React.createElement(slots.calendar, slotProps.calendar)))));\n};\n//# sourceMappingURL=renderDatePicker.js.map"],"names":["renderDatePicker_unstable","state","slots","slotProps","getSlots","React","createElement","root","wrapper","popover","PopoverTrigger","popoverTriggerChildProps","onClick","onKeyDown","onKeyUp","role","inputTriggerProps","inputProps","input","field","popoverSurface","calendar"],"mappings":";;;;+BAMaA;;aAAAA;;;6DANU;8BACQ;gCACN;AAIlB,MAAMA,4BAA4BC,CAAAA,QAAS;IAChD,MAAM,EACJC,MAAK,EACLC,UAAS,EACV,GAAGC,IAAAA,wBAAQ,EAACH;IACb,OAAO,WAAW,GAAEI,OAAMC,aAAa,CAACJ,MAAMK,IAAI,EAAEJ,UAAUI,IAAI,EAAE,WAAW,GAAEF,OAAMC,aAAa,CAACJ,MAAMM,OAAO,EAAEL,UAAUK,OAAO,EAAE,WAAW,GAAEH,OAAMC,aAAa,CAACJ,MAAMO,OAAO,EAAEN,UAAUM,OAAO,EAAE,WAAW,GAAEJ,OAAMC,aAAa,CAACI,4BAAc,EAAE,IAAI,EAAEC,CAAAA,2BAA4B;QAC3R,gGAAgG;QAChG,mGAAmG;QACnG,sGAAsG;QACtG,QAAQ;QACR,MAAM,EACJC,QAAO,EACPC,UAAS,EACTC,QAAO,EACPC,KAAI,EACJ,GAAGC,mBACJ,GAAGL;QACJ,MAAMM,aAAa;YACjBC,OAAO;gBACL,GAAGF,iBAAiB;YACtB;QACF;QACA,OAAO,WAAW,GAAEX,OAAMC,aAAa,CAACJ,MAAMiB,KAAK,EAAEhB,UAAUgB,KAAK,EAAE,WAAW,GAAEd,OAAMC,aAAa,CAACJ,MAAMgB,KAAK,EAAE;YAClH,GAAGf,UAAUe,KAAK;YAClB,GAAGD,UAAU;QACf;IACF,IAAI,WAAW,GAAEZ,OAAMC,aAAa,CAACJ,MAAMkB,cAAc,EAAEjB,UAAUiB,cAAc,EAAE,WAAW,GAAEf,OAAMC,aAAa,CAACJ,MAAMmB,QAAQ,EAAElB,UAAUkB,QAAQ;AAC1J,GACA,4CAA4C"}
@@ -0,0 +1,486 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useDatePicker_unstable", {
6
+ enumerable: true,
7
+ get: ()=>useDatePicker_unstable
8
+ });
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _keyboardKeys = require("@fluentui/keyboard-keys");
12
+ const _reactIcons = require("@fluentui/react-icons");
13
+ const _reactInput = require("@fluentui/react-input");
14
+ const _reactField = require("@fluentui/react-field");
15
+ const _reactUtilities = require("@fluentui/react-utilities");
16
+ const _utils = require("../../utils");
17
+ const _calendar = require("../Calendar/Calendar");
18
+ const _defaults = require("./defaults");
19
+ const _reactPopover = require("@fluentui/react-popover");
20
+ function isDateOutOfBounds(date, minDate, maxDate) {
21
+ return !!minDate && (0, _utils.compareDatePart)(minDate, date) > 0 || !!maxDate && (0, _utils.compareDatePart)(maxDate, date) < 0;
22
+ }
23
+ function useFocusLogic() {
24
+ const inputRef = _react.useRef(null);
25
+ const preventFocusOpeningPicker = _react.useRef(false);
26
+ const focus = ()=>{
27
+ var _inputRef_current, _inputRef_current_focus;
28
+ (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : (_inputRef_current_focus = _inputRef_current.focus) === null || _inputRef_current_focus === void 0 ? void 0 : _inputRef_current_focus.call(_inputRef_current);
29
+ };
30
+ const preventNextFocusOpeningPicker = ()=>{
31
+ preventFocusOpeningPicker.current = true;
32
+ };
33
+ return [
34
+ focus,
35
+ inputRef,
36
+ preventFocusOpeningPicker,
37
+ preventNextFocusOpeningPicker
38
+ ];
39
+ }
40
+ function useCalendarVisibility({ allowTextInput , onAfterMenuDismiss }, focus) {
41
+ const [isCalendarShown, setIsCalendarShown] = _react.useState(false);
42
+ const isMounted = _react.useRef(false);
43
+ _react.useEffect(()=>{
44
+ if (isMounted.current && !isCalendarShown) {
45
+ // If DatePicker's menu (Calendar) is closed, run onAfterMenuDismiss
46
+ onAfterMenuDismiss === null || onAfterMenuDismiss === void 0 ? void 0 : onAfterMenuDismiss();
47
+ }
48
+ isMounted.current = true;
49
+ }, // Should only run on allowTextInput or isCalendarShown change
50
+ // eslint-disable-next-line react-hooks/exhaustive-deps
51
+ [
52
+ allowTextInput,
53
+ isCalendarShown
54
+ ]);
55
+ return [
56
+ isCalendarShown,
57
+ setIsCalendarShown
58
+ ];
59
+ }
60
+ function useSelectedDate({ formatDate , onSelectDate , value }) {
61
+ const [selectedDate, setSelectedDateState] = (0, _reactUtilities.useControllableState)({
62
+ initialState: undefined,
63
+ state: value
64
+ });
65
+ const [formattedDate, setFormattedDate] = _react.useState(()=>value && formatDate ? formatDate(value) : '');
66
+ const setSelectedDate = (newDate)=>{
67
+ if (selectedDate === undefined && newDate !== undefined || selectedDate !== undefined && newDate === undefined || newDate && selectedDate && (newDate > selectedDate || newDate < selectedDate)) {
68
+ onSelectDate === null || onSelectDate === void 0 ? void 0 : onSelectDate(newDate);
69
+ }
70
+ setSelectedDateState(newDate);
71
+ setFormattedDate(newDate && formatDate ? formatDate(newDate) : '');
72
+ };
73
+ _react.useEffect(()=>{
74
+ setFormattedDate(value && formatDate ? formatDate(value) : '');
75
+ }, [
76
+ formatDate,
77
+ value
78
+ ]);
79
+ return [
80
+ selectedDate,
81
+ formattedDate,
82
+ setSelectedDate,
83
+ setFormattedDate
84
+ ];
85
+ }
86
+ function useErrorMessage({ allowTextInput , formatDate , isRequired , maxDate , minDate , onSelectDate , parseDateFromString , strings }, selectedDate, setSelectedDate, inputValue, isCalendarShown) {
87
+ const [errorMessage, setErrorMessage] = _react.useState();
88
+ const [statusMessage, setStatusMessage] = _react.useState();
89
+ const validateTextInput = (date = null)=>{
90
+ if (allowTextInput) {
91
+ if (inputValue || date) {
92
+ // Don't parse if the selected date has the same formatted string as what we're about to parse.
93
+ // The formatted string might be ambiguous (ex: "1/2/3" or "New Year Eve") and the parser might
94
+ // not be able to come up with the exact same date.
95
+ if (selectedDate && !errorMessage && formatDate && formatDate(date !== null && date !== void 0 ? date : selectedDate) === inputValue) {
96
+ return;
97
+ }
98
+ date = date || parseDateFromString(inputValue);
99
+ // Check if date is null, or date is Invalid Date
100
+ if (!date || isNaN(date.getTime())) {
101
+ // Reset invalid input field, if formatting is available
102
+ setSelectedDate(selectedDate);
103
+ // default the newer isResetStatusMessage string to invalidInputErrorMessage for legacy support
104
+ const selectedText = formatDate ? formatDate(selectedDate) : '';
105
+ const statusText = strings.isResetStatusMessage ? strings.isResetStatusMessage.replace('{0}', inputValue).replace('{1}', selectedText) : strings.invalidInputErrorMessage || '';
106
+ setStatusMessage(statusText);
107
+ } else {
108
+ // Check against optional date boundaries
109
+ if (isDateOutOfBounds(date, minDate, maxDate)) {
110
+ setErrorMessage(strings.isOutOfBoundsErrorMessage || ' ');
111
+ } else {
112
+ setSelectedDate(date);
113
+ setErrorMessage(undefined);
114
+ setStatusMessage(undefined);
115
+ }
116
+ }
117
+ } else {
118
+ // Only show error for empty inputValue if it is a required field
119
+ setErrorMessage(isRequired ? strings.isRequiredErrorMessage || ' ' : undefined);
120
+ // If no input date string or input date string is invalid
121
+ // date variable will be null, callback should expect null value for this case
122
+ onSelectDate === null || onSelectDate === void 0 ? void 0 : onSelectDate(date);
123
+ }
124
+ } else if (isRequired && !inputValue) {
125
+ // Check when DatePicker is a required field but has NO input value
126
+ setErrorMessage(strings.isRequiredErrorMessage || ' ');
127
+ } else {
128
+ // Cleanup the error message and status message
129
+ setErrorMessage(undefined);
130
+ setStatusMessage(undefined);
131
+ }
132
+ };
133
+ const minDatePartHashValue = minDate && (0, _utils.getDatePartHashValue)(minDate);
134
+ const maxDatePartHashValue = maxDate && (0, _utils.getDatePartHashValue)(maxDate);
135
+ const selectedDatePartHashValue = selectedDate && (0, _utils.getDatePartHashValue)(selectedDate);
136
+ _react.useEffect(()=>{
137
+ if (isRequired && !selectedDate) {
138
+ setErrorMessage(strings.isRequiredErrorMessage || ' ');
139
+ } else if (selectedDate && isDateOutOfBounds(selectedDate, minDate, maxDate)) {
140
+ setErrorMessage(strings.isOutOfBoundsErrorMessage || ' ');
141
+ } else {
142
+ setErrorMessage(undefined);
143
+ }
144
+ // eslint-disable-next-line react-hooks/exhaustive-deps
145
+ }, [
146
+ // We don't want to compare the date itself, since two instances of date at the same time are not equal
147
+ minDatePartHashValue,
148
+ maxDatePartHashValue,
149
+ selectedDatePartHashValue,
150
+ isRequired
151
+ ]);
152
+ return [
153
+ isCalendarShown ? undefined : errorMessage,
154
+ validateTextInput,
155
+ setErrorMessage,
156
+ isCalendarShown ? undefined : statusMessage,
157
+ setStatusMessage
158
+ ];
159
+ }
160
+ const defaultFormatDate = (date)=>date ? date.toDateString() : '';
161
+ const defaultParseDateFromString = (dateStr)=>{
162
+ const date = Date.parse(dateStr);
163
+ return date ? new Date(date) : null;
164
+ };
165
+ const useDatePicker_unstable = (props, ref)=>{
166
+ var _props_input;
167
+ const { allowTextInput =false , allFocusable =false , borderless =false , dateTimeFormatter , disabled , disableAutoFocus =true , firstDayOfWeek =_utils.DayOfWeek.Sunday , firstWeekOfYear =_utils.FirstWeekOfYear.FirstDay , formatDate =defaultFormatDate , highlightCurrentMonth =false , highlightSelectedMonth =false , initialPickerDate =new Date() , isMonthPickerVisible =true , isRequired =false , label , maxDate , minDate , onAfterMenuDismiss , onSelectDate: onUserSelectDate , parseDateFromString =defaultParseDateFromString , placeholder , showCloseButton =false , showGoToToday =true , showMonthPickerAsOverlay =false , showWeekNumbers =false , strings =_defaults.defaultDatePickerStrings , tabIndex , today , underlined =false , value } = props;
168
+ const id = (0, _reactUtilities.useId)('DatePicker', props.id);
169
+ const calloutId = (0, _reactUtilities.useId)('DatePicker-Callout');
170
+ const calendar = _react.useRef(null);
171
+ const [focus, _, preventFocusOpeningPicker, preventNextFocusOpeningPicker] = useFocusLogic();
172
+ const [isCalendarShown, setIsCalendarShown] = useCalendarVisibility({
173
+ allowTextInput,
174
+ onAfterMenuDismiss
175
+ }, focus);
176
+ const [selectedDate, formattedDate, setSelectedDate, setFormattedDate] = useSelectedDate({
177
+ formatDate,
178
+ onSelectDate: onUserSelectDate,
179
+ value
180
+ });
181
+ const [errorMessage, validateTextInput, setErrorMessage, statusMessage, setStatusMessage] = useErrorMessage({
182
+ allowTextInput,
183
+ formatDate,
184
+ isRequired,
185
+ maxDate,
186
+ minDate,
187
+ onSelectDate: onUserSelectDate,
188
+ parseDateFromString,
189
+ strings
190
+ }, selectedDate, setSelectedDate, formattedDate, isCalendarShown);
191
+ const dismissDatePickerPopup = _react.useCallback((newlySelectedDate)=>{
192
+ if (isCalendarShown) {
193
+ setIsCalendarShown(false);
194
+ validateTextInput(newlySelectedDate);
195
+ if (!allowTextInput && newlySelectedDate) {
196
+ setSelectedDate(newlySelectedDate);
197
+ }
198
+ }
199
+ }, [
200
+ allowTextInput,
201
+ isCalendarShown,
202
+ setIsCalendarShown,
203
+ setSelectedDate,
204
+ validateTextInput
205
+ ]);
206
+ const showDatePickerPopup = _react.useCallback(()=>{
207
+ if (!isCalendarShown) {
208
+ preventNextFocusOpeningPicker();
209
+ setIsCalendarShown(true);
210
+ }
211
+ }, [
212
+ isCalendarShown,
213
+ preventNextFocusOpeningPicker,
214
+ setIsCalendarShown
215
+ ]);
216
+ /**
217
+ * Callback for closing the calendar callout
218
+ */ const calendarDismissed = _react.useCallback((newlySelectedDate)=>{
219
+ preventNextFocusOpeningPicker();
220
+ dismissDatePickerPopup(newlySelectedDate);
221
+ // don't need to focus the text box, if necessary the focusTrapZone will do it
222
+ }, [
223
+ dismissDatePickerPopup,
224
+ preventNextFocusOpeningPicker
225
+ ]);
226
+ const handleEscKey = _react.useCallback((ev)=>{
227
+ if (isCalendarShown) {
228
+ ev.stopPropagation();
229
+ calendarDismissed();
230
+ }
231
+ }, [
232
+ calendarDismissed,
233
+ isCalendarShown
234
+ ]);
235
+ _react.useImperativeHandle(props.componentRef, ()=>({
236
+ focus,
237
+ reset () {
238
+ setIsCalendarShown(false);
239
+ setSelectedDate(undefined);
240
+ setErrorMessage(undefined);
241
+ setStatusMessage(undefined);
242
+ },
243
+ showDatePickerPopup
244
+ }), [
245
+ focus,
246
+ setErrorMessage,
247
+ setIsCalendarShown,
248
+ setSelectedDate,
249
+ setStatusMessage,
250
+ showDatePickerPopup
251
+ ]);
252
+ const onInputFocus = _react.useCallback(()=>{
253
+ if (disableAutoFocus) {
254
+ return;
255
+ }
256
+ if (!allowTextInput) {
257
+ if (!preventFocusOpeningPicker.current) {
258
+ showDatePickerPopup();
259
+ }
260
+ preventFocusOpeningPicker.current = false;
261
+ }
262
+ }, [
263
+ allowTextInput,
264
+ disableAutoFocus,
265
+ preventFocusOpeningPicker,
266
+ showDatePickerPopup
267
+ ]);
268
+ const onInputBlur = _react.useCallback(()=>{
269
+ validateTextInput();
270
+ }, [
271
+ validateTextInput
272
+ ]);
273
+ const onInputChange = _react.useCallback((ev, data)=>{
274
+ const { value: newValue } = data;
275
+ if (allowTextInput) {
276
+ if (isCalendarShown) {
277
+ dismissDatePickerPopup();
278
+ }
279
+ setFormattedDate(newValue);
280
+ }
281
+ }, [
282
+ allowTextInput,
283
+ dismissDatePickerPopup,
284
+ isCalendarShown,
285
+ setFormattedDate
286
+ ]);
287
+ const onInputKeyDown = _react.useCallback((ev)=>{
288
+ switch(ev.key){
289
+ case _keyboardKeys.Enter:
290
+ ev.preventDefault();
291
+ ev.stopPropagation();
292
+ if (!isCalendarShown) {
293
+ validateTextInput();
294
+ showDatePickerPopup();
295
+ } else {
296
+ // When DatePicker allows input date string directly,
297
+ // it is expected to hit another enter to close the popup
298
+ if (props.allowTextInput) {
299
+ dismissDatePickerPopup();
300
+ }
301
+ }
302
+ break;
303
+ case _keyboardKeys.Escape:
304
+ handleEscKey(ev);
305
+ break;
306
+ case _keyboardKeys.ArrowDown:
307
+ if (ev.altKey && !isCalendarShown) {
308
+ showDatePickerPopup();
309
+ }
310
+ break;
311
+ default:
312
+ break;
313
+ }
314
+ }, [
315
+ dismissDatePickerPopup,
316
+ handleEscKey,
317
+ isCalendarShown,
318
+ props.allowTextInput,
319
+ showDatePickerPopup,
320
+ validateTextInput
321
+ ]);
322
+ const onInputClick = _react.useCallback(()=>{
323
+ // default openOnClick to !props.disableAutoFocus for legacy support of disableAutoFocus behavior
324
+ const openOnClick = props.openOnClick || !props.disableAutoFocus;
325
+ if (openOnClick && !isCalendarShown && !props.disabled) {
326
+ showDatePickerPopup();
327
+ return;
328
+ }
329
+ if (props.allowTextInput) {
330
+ dismissDatePickerPopup();
331
+ }
332
+ }, [
333
+ dismissDatePickerPopup,
334
+ isCalendarShown,
335
+ props.allowTextInput,
336
+ props.disabled,
337
+ props.disableAutoFocus,
338
+ props.openOnClick,
339
+ showDatePickerPopup
340
+ ]);
341
+ const onIconClick = (ev)=>{
342
+ ev.stopPropagation();
343
+ if (!isCalendarShown && !props.disabled) {
344
+ showDatePickerPopup();
345
+ } else if (props.allowTextInput) {
346
+ dismissDatePickerPopup();
347
+ }
348
+ };
349
+ const inputId = props.id && props.id !== id ? props.id : id + '-label';
350
+ const inputAppearance = underlined ? 'underline' : borderless ? 'filled-lighter' : 'outline';
351
+ const onPopoverOpenChange = _react.useCallback((ev, data)=>{
352
+ if (!data.open) {
353
+ calendarDismissed();
354
+ }
355
+ }, [
356
+ calendarDismissed
357
+ ]);
358
+ const root = (0, _reactUtilities.getNativeElementProps)('div', {
359
+ ref,
360
+ ...props
361
+ });
362
+ const inputRef = _react.useRef(null);
363
+ const inputShorthand = (0, _reactUtilities.resolveShorthand)(props.input, {
364
+ required: true,
365
+ defaultProps: {
366
+ appearance: inputAppearance,
367
+ 'aria-controls': isCalendarShown ? calloutId : undefined,
368
+ 'aria-expanded': isCalendarShown,
369
+ 'aria-haspopup': 'dialog',
370
+ 'aria-label': props['aria-label'],
371
+ contentAfter: /*#__PURE__*/ _react.createElement(_reactIcons.CalendarMonthRegular, {
372
+ onClick: onIconClick
373
+ }),
374
+ disabled,
375
+ id: inputId,
376
+ placeholder,
377
+ readOnly: !allowTextInput,
378
+ required: isRequired,
379
+ role: 'combobox',
380
+ tabIndex,
381
+ root: {
382
+ ref: inputRef
383
+ }
384
+ }
385
+ });
386
+ inputShorthand.onBlur = onInputBlur;
387
+ inputShorthand.onClick = onInputClick;
388
+ inputShorthand.onFocus = onInputFocus;
389
+ inputShorthand.onKeyDown = onInputKeyDown;
390
+ inputShorthand.onChange = (0, _reactUtilities.mergeCallbacks)(onInputChange, (_props_input = props.input) === null || _props_input === void 0 ? void 0 : _props_input.onChange);
391
+ inputShorthand.value = formattedDate;
392
+ const fieldShorthand = (0, _reactUtilities.resolveShorthand)(props.field, {
393
+ defaultProps: {
394
+ label,
395
+ required: isRequired,
396
+ validationMessage: errorMessage !== null && errorMessage !== void 0 ? errorMessage : statusMessage,
397
+ validationState: errorMessage ? 'error' : undefined
398
+ },
399
+ required: true
400
+ });
401
+ const wrapperShorthand = (0, _reactUtilities.resolveShorthand)(props.wrapper, {
402
+ defaultProps: {
403
+ 'aria-owns': isCalendarShown ? calloutId : undefined
404
+ },
405
+ required: true
406
+ });
407
+ const positioningRef = _react.useRef(null);
408
+ const popoverShorthand = (0, _reactUtilities.resolveShorthand)(props.popover, {
409
+ defaultProps: {
410
+ onOpenChange: onPopoverOpenChange,
411
+ open: isCalendarShown,
412
+ positioning: {
413
+ align: 'start',
414
+ position: 'below',
415
+ positioningRef
416
+ },
417
+ trapFocus: true
418
+ },
419
+ required: true
420
+ });
421
+ const popoverSurfaceShorthand = (0, _reactUtilities.resolveShorthand)(props.popoverSurface, {
422
+ defaultProps: {
423
+ 'aria-label': 'Calendar',
424
+ id: calloutId,
425
+ role: 'dialog'
426
+ },
427
+ required: true
428
+ });
429
+ const calendarShorthand = (0, _reactUtilities.resolveShorthand)(props.calendar, {
430
+ required: true,
431
+ defaultProps: {
432
+ allFocusable,
433
+ componentRef: calendar,
434
+ dateTimeFormatter,
435
+ firstDayOfWeek,
436
+ firstWeekOfYear,
437
+ highlightCurrentMonth,
438
+ highlightSelectedMonth,
439
+ isMonthPickerVisible,
440
+ maxDate,
441
+ minDate,
442
+ onDismiss: calendarDismissed,
443
+ showCloseButton,
444
+ showGoToToday,
445
+ showMonthPickerAsOverlay,
446
+ showWeekNumbers,
447
+ strings,
448
+ today,
449
+ value: selectedDate || initialPickerDate
450
+ }
451
+ });
452
+ const state = {
453
+ disabled: !!disabled,
454
+ isDatePickerShown: isCalendarShown,
455
+ // Slots definition
456
+ components: {
457
+ root: 'div',
458
+ field: _reactField.Field,
459
+ input: _reactInput.Input,
460
+ wrapper: 'div',
461
+ popover: _reactPopover.Popover,
462
+ popoverSurface: _reactPopover.PopoverSurface,
463
+ calendar: _calendar.Calendar
464
+ },
465
+ calendar: calendarShorthand,
466
+ input: inputShorthand,
467
+ field: fieldShorthand,
468
+ popover: popoverShorthand,
469
+ popoverSurface: popoverSurfaceShorthand,
470
+ root,
471
+ wrapper: wrapperShorthand
472
+ };
473
+ state.calendar.onSelectDate = (0, _reactUtilities.mergeCallbacks)(state.calendar.onSelectDate, calendarDismissed);
474
+ _react.useEffect(()=>{
475
+ if (inputRef.current) {
476
+ var _positioningRef_current;
477
+ (_positioningRef_current = positioningRef.current) === null || _positioningRef_current === void 0 ? void 0 : _positioningRef_current.setTarget(inputRef.current);
478
+ }
479
+ }, [
480
+ inputRef,
481
+ positioningRef
482
+ ]);
483
+ return state;
484
+ }; //# sourceMappingURL=useDatePicker.js.map
485
+
486
+ //# sourceMappingURL=useDatePicker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../lib/components/DatePicker/useDatePicker.js"],"sourcesContent":["import * as React from 'react';\nimport { ArrowDown, Enter, Escape } from '@fluentui/keyboard-keys';\nimport { CalendarMonthRegular } from '@fluentui/react-icons';\nimport { Input } from '@fluentui/react-input';\nimport { Field } from '@fluentui/react-field';\nimport { getNativeElementProps, mergeCallbacks, resolveShorthand, useControllableState, useId } from '@fluentui/react-utilities';\nimport { compareDatePart, getDatePartHashValue, DayOfWeek, FirstWeekOfYear } from '../../utils';\nimport { Calendar } from '../Calendar/Calendar';\nimport { defaultDatePickerStrings } from './defaults';\nimport { Popover } from '@fluentui/react-popover';\nimport { PopoverSurface } from '@fluentui/react-popover';\nfunction isDateOutOfBounds(date, minDate, maxDate) {\n return !!minDate && compareDatePart(minDate, date) > 0 || !!maxDate && compareDatePart(maxDate, date) < 0;\n}\nfunction useFocusLogic() {\n const inputRef = React.useRef(null);\n const preventFocusOpeningPicker = React.useRef(false);\n const focus = () => {\n var _inputRef_current, _inputRef_current_focus;\n (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : (_inputRef_current_focus = _inputRef_current.focus) === null || _inputRef_current_focus === void 0 ? void 0 : _inputRef_current_focus.call(_inputRef_current);\n };\n const preventNextFocusOpeningPicker = () => {\n preventFocusOpeningPicker.current = true;\n };\n return [focus, inputRef, preventFocusOpeningPicker, preventNextFocusOpeningPicker];\n}\nfunction useCalendarVisibility({\n allowTextInput,\n onAfterMenuDismiss\n}, focus) {\n const [isCalendarShown, setIsCalendarShown] = React.useState(false);\n const isMounted = React.useRef(false);\n React.useEffect(() => {\n if (isMounted.current && !isCalendarShown) {\n // If DatePicker's menu (Calendar) is closed, run onAfterMenuDismiss\n onAfterMenuDismiss === null || onAfterMenuDismiss === void 0 ? void 0 : onAfterMenuDismiss();\n }\n isMounted.current = true;\n },\n // Should only run on allowTextInput or isCalendarShown change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [allowTextInput, isCalendarShown]);\n return [isCalendarShown, setIsCalendarShown];\n}\nfunction useSelectedDate({\n formatDate,\n onSelectDate,\n value\n}) {\n const [selectedDate, setSelectedDateState] = useControllableState({\n initialState: undefined,\n state: value\n });\n const [formattedDate, setFormattedDate] = React.useState(() => value && formatDate ? formatDate(value) : '');\n const setSelectedDate = newDate => {\n if (selectedDate === undefined && newDate !== undefined || selectedDate !== undefined && newDate === undefined || newDate && selectedDate && (newDate > selectedDate || newDate < selectedDate)) {\n onSelectDate === null || onSelectDate === void 0 ? void 0 : onSelectDate(newDate);\n }\n setSelectedDateState(newDate);\n setFormattedDate(newDate && formatDate ? formatDate(newDate) : '');\n };\n React.useEffect(() => {\n setFormattedDate(value && formatDate ? formatDate(value) : '');\n }, [formatDate, value]);\n return [selectedDate, formattedDate, setSelectedDate, setFormattedDate];\n}\nfunction useErrorMessage({\n allowTextInput,\n formatDate,\n isRequired,\n maxDate,\n minDate,\n onSelectDate,\n parseDateFromString,\n strings\n}, selectedDate, setSelectedDate, inputValue, isCalendarShown) {\n const [errorMessage, setErrorMessage] = React.useState();\n const [statusMessage, setStatusMessage] = React.useState();\n const validateTextInput = (date = null) => {\n if (allowTextInput) {\n if (inputValue || 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 && !errorMessage && formatDate && formatDate(date !== null && date !== void 0 ? date : selectedDate) === inputValue) {\n return;\n }\n date = date || parseDateFromString(inputValue);\n // Check if date is null, or date is Invalid Date\n if (!date || isNaN(date.getTime())) {\n // Reset invalid input field, if formatting is available\n setSelectedDate(selectedDate);\n // default the newer isResetStatusMessage string to invalidInputErrorMessage for legacy support\n const selectedText = formatDate ? formatDate(selectedDate) : '';\n const statusText = strings.isResetStatusMessage ? strings.isResetStatusMessage.replace('{0}', inputValue).replace('{1}', selectedText) : strings.invalidInputErrorMessage || '';\n setStatusMessage(statusText);\n } else {\n // Check against optional date boundaries\n if (isDateOutOfBounds(date, minDate, maxDate)) {\n setErrorMessage(strings.isOutOfBoundsErrorMessage || ' ');\n } else {\n setSelectedDate(date);\n setErrorMessage(undefined);\n setStatusMessage(undefined);\n }\n }\n } else {\n // Only show error for empty inputValue if it is a required field\n setErrorMessage(isRequired ? strings.isRequiredErrorMessage || ' ' : undefined);\n // If no input date string or input date string is invalid\n // date variable will be null, callback should expect null value for this case\n onSelectDate === null || onSelectDate === void 0 ? void 0 : onSelectDate(date);\n }\n } else if (isRequired && !inputValue) {\n // Check when DatePicker is a required field but has NO input value\n setErrorMessage(strings.isRequiredErrorMessage || ' ');\n } else {\n // Cleanup the error message and status message\n setErrorMessage(undefined);\n setStatusMessage(undefined);\n }\n };\n const minDatePartHashValue = minDate && getDatePartHashValue(minDate);\n const maxDatePartHashValue = maxDate && getDatePartHashValue(maxDate);\n const selectedDatePartHashValue = selectedDate && getDatePartHashValue(selectedDate);\n React.useEffect(() => {\n if (isRequired && !selectedDate) {\n setErrorMessage(strings.isRequiredErrorMessage || ' ');\n } else if (selectedDate && isDateOutOfBounds(selectedDate, minDate, maxDate)) {\n setErrorMessage(strings.isOutOfBoundsErrorMessage || ' ');\n } else {\n setErrorMessage(undefined);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n // We don't want to compare the date itself, since two instances of date at the same time are not equal\n minDatePartHashValue, maxDatePartHashValue, selectedDatePartHashValue, isRequired]);\n return [isCalendarShown ? undefined : errorMessage, validateTextInput, setErrorMessage, isCalendarShown ? undefined : statusMessage, setStatusMessage];\n}\nconst defaultFormatDate = date => date ? date.toDateString() : '';\nconst defaultParseDateFromString = dateStr => {\n const date = Date.parse(dateStr);\n return date ? new Date(date) : null;\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 HTMLElement of DatePicker\n */\nexport const useDatePicker_unstable = (props, ref) => {\n var _props_input;\n const {\n allowTextInput = false,\n allFocusable = false,\n borderless = false,\n dateTimeFormatter,\n disabled,\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 isMonthPickerVisible = true,\n isRequired = false,\n label,\n maxDate,\n minDate,\n onAfterMenuDismiss,\n onSelectDate: onUserSelectDate,\n parseDateFromString = defaultParseDateFromString,\n placeholder,\n showCloseButton = false,\n showGoToToday = true,\n showMonthPickerAsOverlay = false,\n showWeekNumbers = false,\n strings = defaultDatePickerStrings,\n tabIndex,\n today,\n underlined = false,\n value\n } = props;\n const id = useId('DatePicker', props.id);\n const calloutId = useId('DatePicker-Callout');\n const calendar = React.useRef(null);\n const [focus, _, preventFocusOpeningPicker, preventNextFocusOpeningPicker] = useFocusLogic();\n const [isCalendarShown, setIsCalendarShown] = useCalendarVisibility({\n allowTextInput,\n onAfterMenuDismiss\n }, focus);\n const [selectedDate, formattedDate, setSelectedDate, setFormattedDate] = useSelectedDate({\n formatDate,\n onSelectDate: onUserSelectDate,\n value\n });\n const [errorMessage, validateTextInput, setErrorMessage, statusMessage, setStatusMessage] = useErrorMessage({\n allowTextInput,\n formatDate,\n isRequired,\n maxDate,\n minDate,\n onSelectDate: onUserSelectDate,\n parseDateFromString,\n strings\n }, selectedDate, setSelectedDate, formattedDate, isCalendarShown);\n const dismissDatePickerPopup = React.useCallback(newlySelectedDate => {\n if (isCalendarShown) {\n setIsCalendarShown(false);\n validateTextInput(newlySelectedDate);\n if (!allowTextInput && newlySelectedDate) {\n setSelectedDate(newlySelectedDate);\n }\n }\n }, [allowTextInput, isCalendarShown, setIsCalendarShown, setSelectedDate, validateTextInput]);\n const showDatePickerPopup = React.useCallback(() => {\n if (!isCalendarShown) {\n preventNextFocusOpeningPicker();\n setIsCalendarShown(true);\n }\n }, [isCalendarShown, preventNextFocusOpeningPicker, setIsCalendarShown]);\n /**\n * Callback for closing the calendar callout\n */\n const calendarDismissed = React.useCallback(newlySelectedDate => {\n preventNextFocusOpeningPicker();\n dismissDatePickerPopup(newlySelectedDate);\n // don't need to focus the text box, if necessary the focusTrapZone will do it\n }, [dismissDatePickerPopup, preventNextFocusOpeningPicker]);\n const handleEscKey = React.useCallback(ev => {\n if (isCalendarShown) {\n ev.stopPropagation();\n calendarDismissed();\n }\n }, [calendarDismissed, isCalendarShown]);\n React.useImperativeHandle(props.componentRef, () => ({\n focus,\n reset() {\n setIsCalendarShown(false);\n setSelectedDate(undefined);\n setErrorMessage(undefined);\n setStatusMessage(undefined);\n },\n showDatePickerPopup\n }), [focus, setErrorMessage, setIsCalendarShown, setSelectedDate, setStatusMessage, showDatePickerPopup]);\n const onInputFocus = React.useCallback(() => {\n if (disableAutoFocus) {\n return;\n }\n if (!allowTextInput) {\n if (!preventFocusOpeningPicker.current) {\n showDatePickerPopup();\n }\n preventFocusOpeningPicker.current = false;\n }\n }, [allowTextInput, disableAutoFocus, preventFocusOpeningPicker, showDatePickerPopup]);\n const onInputBlur = React.useCallback(() => {\n validateTextInput();\n }, [validateTextInput]);\n const onInputChange = React.useCallback((ev, data) => {\n const {\n value: newValue\n } = data;\n if (allowTextInput) {\n if (isCalendarShown) {\n dismissDatePickerPopup();\n }\n setFormattedDate(newValue);\n }\n }, [allowTextInput, dismissDatePickerPopup, isCalendarShown, setFormattedDate]);\n const onInputKeyDown = React.useCallback(ev => {\n switch (ev.key) {\n case Enter:\n ev.preventDefault();\n ev.stopPropagation();\n if (!isCalendarShown) {\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 case Escape:\n handleEscKey(ev);\n break;\n case ArrowDown:\n if (ev.altKey && !isCalendarShown) {\n showDatePickerPopup();\n }\n break;\n default:\n break;\n }\n }, [dismissDatePickerPopup, handleEscKey, isCalendarShown, props.allowTextInput, showDatePickerPopup, validateTextInput]);\n const onInputClick = React.useCallback(() => {\n // default openOnClick to !props.disableAutoFocus for legacy support of disableAutoFocus behavior\n const openOnClick = props.openOnClick || !props.disableAutoFocus;\n if (openOnClick && !isCalendarShown && !props.disabled) {\n showDatePickerPopup();\n return;\n }\n if (props.allowTextInput) {\n dismissDatePickerPopup();\n }\n }, [dismissDatePickerPopup, isCalendarShown, props.allowTextInput, props.disabled, props.disableAutoFocus, props.openOnClick, showDatePickerPopup]);\n const onIconClick = ev => {\n ev.stopPropagation();\n if (!isCalendarShown && !props.disabled) {\n showDatePickerPopup();\n } else if (props.allowTextInput) {\n dismissDatePickerPopup();\n }\n };\n const inputId = props.id && props.id !== id ? props.id : id + '-label';\n const inputAppearance = underlined ? 'underline' : borderless ? 'filled-lighter' : 'outline';\n const onPopoverOpenChange = React.useCallback((ev, data) => {\n if (!data.open) {\n calendarDismissed();\n }\n }, [calendarDismissed]);\n const root = getNativeElementProps('div', {\n ref,\n ...props\n });\n const inputRef = React.useRef(null);\n const inputShorthand = resolveShorthand(props.input, {\n required: true,\n defaultProps: {\n appearance: inputAppearance,\n 'aria-controls': isCalendarShown ? calloutId : undefined,\n 'aria-expanded': isCalendarShown,\n 'aria-haspopup': 'dialog',\n 'aria-label': props['aria-label'],\n contentAfter: /*#__PURE__*/React.createElement(CalendarMonthRegular, {\n onClick: onIconClick\n }),\n disabled,\n id: inputId,\n placeholder,\n readOnly: !allowTextInput,\n required: isRequired,\n role: 'combobox',\n tabIndex,\n root: {\n ref: inputRef\n }\n }\n });\n inputShorthand.onBlur = onInputBlur;\n inputShorthand.onClick = onInputClick;\n inputShorthand.onFocus = onInputFocus;\n inputShorthand.onKeyDown = onInputKeyDown;\n inputShorthand.onChange = mergeCallbacks(onInputChange, (_props_input = props.input) === null || _props_input === void 0 ? void 0 : _props_input.onChange);\n inputShorthand.value = formattedDate;\n const fieldShorthand = resolveShorthand(props.field, {\n defaultProps: {\n label,\n required: isRequired,\n validationMessage: errorMessage !== null && errorMessage !== void 0 ? errorMessage : statusMessage,\n validationState: errorMessage ? 'error' : undefined\n },\n required: true\n });\n const wrapperShorthand = resolveShorthand(props.wrapper, {\n defaultProps: {\n 'aria-owns': isCalendarShown ? calloutId : undefined\n },\n required: true\n });\n const positioningRef = React.useRef(null);\n const popoverShorthand = resolveShorthand(props.popover, {\n defaultProps: {\n onOpenChange: onPopoverOpenChange,\n open: isCalendarShown,\n positioning: {\n align: 'start',\n position: 'below',\n positioningRef\n },\n trapFocus: true\n },\n required: true\n });\n const popoverSurfaceShorthand = resolveShorthand(props.popoverSurface, {\n defaultProps: {\n 'aria-label': 'Calendar',\n id: calloutId,\n role: 'dialog'\n },\n required: true\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 const state = {\n disabled: !!disabled,\n isDatePickerShown: isCalendarShown,\n // Slots definition\n components: {\n root: 'div',\n field: Field,\n input: Input,\n wrapper: 'div',\n popover: Popover,\n popoverSurface: PopoverSurface,\n calendar: Calendar\n },\n calendar: calendarShorthand,\n input: inputShorthand,\n field: fieldShorthand,\n popover: popoverShorthand,\n popoverSurface: popoverSurfaceShorthand,\n root,\n wrapper: wrapperShorthand\n };\n state.calendar.onSelectDate = mergeCallbacks(state.calendar.onSelectDate, calendarDismissed);\n React.useEffect(() => {\n if (inputRef.current) {\n var _positioningRef_current;\n (_positioningRef_current = positioningRef.current) === null || _positioningRef_current === void 0 ? void 0 : _positioningRef_current.setTarget(inputRef.current);\n }\n }, [inputRef, positioningRef]);\n return state;\n};\n//# sourceMappingURL=useDatePicker.js.map"],"names":["useDatePicker_unstable","isDateOutOfBounds","date","minDate","maxDate","compareDatePart","useFocusLogic","inputRef","React","useRef","preventFocusOpeningPicker","focus","_inputRef_current","_inputRef_current_focus","current","call","preventNextFocusOpeningPicker","useCalendarVisibility","allowTextInput","onAfterMenuDismiss","isCalendarShown","setIsCalendarShown","useState","isMounted","useEffect","useSelectedDate","formatDate","onSelectDate","value","selectedDate","setSelectedDateState","useControllableState","initialState","undefined","state","formattedDate","setFormattedDate","setSelectedDate","newDate","useErrorMessage","isRequired","parseDateFromString","strings","inputValue","errorMessage","setErrorMessage","statusMessage","setStatusMessage","validateTextInput","isNaN","getTime","selectedText","statusText","isResetStatusMessage","replace","invalidInputErrorMessage","isOutOfBoundsErrorMessage","isRequiredErrorMessage","minDatePartHashValue","getDatePartHashValue","maxDatePartHashValue","selectedDatePartHashValue","defaultFormatDate","toDateString","defaultParseDateFromString","dateStr","Date","parse","props","ref","_props_input","allFocusable","borderless","dateTimeFormatter","disabled","disableAutoFocus","firstDayOfWeek","DayOfWeek","Sunday","firstWeekOfYear","FirstWeekOfYear","FirstDay","highlightCurrentMonth","highlightSelectedMonth","initialPickerDate","isMonthPickerVisible","label","onUserSelectDate","placeholder","showCloseButton","showGoToToday","showMonthPickerAsOverlay","showWeekNumbers","defaultDatePickerStrings","tabIndex","today","underlined","id","useId","calloutId","calendar","_","dismissDatePickerPopup","useCallback","newlySelectedDate","showDatePickerPopup","calendarDismissed","handleEscKey","ev","stopPropagation","useImperativeHandle","componentRef","reset","onInputFocus","onInputBlur","onInputChange","data","newValue","onInputKeyDown","key","Enter","preventDefault","Escape","ArrowDown","altKey","onInputClick","openOnClick","onIconClick","inputId","inputAppearance","onPopoverOpenChange","open","root","getNativeElementProps","inputShorthand","resolveShorthand","input","required","defaultProps","appearance","contentAfter","createElement","CalendarMonthRegular","onClick","readOnly","role","onBlur","onFocus","onKeyDown","onChange","mergeCallbacks","fieldShorthand","field","validationMessage","validationState","wrapperShorthand","wrapper","positioningRef","popoverShorthand","popover","onOpenChange","positioning","align","position","trapFocus","popoverSurfaceShorthand","popoverSurface","calendarShorthand","onDismiss","isDatePickerShown","components","Field","Input","Popover","PopoverSurface","Calend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