@mezzanine-ui/react 1.0.0-canary.2 → 1.0.0-canary.4

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 (333) hide show
  1. package/AlertBanner/AlertBanner.d.ts +93 -0
  2. package/AlertBanner/AlertBanner.js +154 -0
  3. package/AlertBanner/index.d.ts +2 -0
  4. package/AlertBanner/index.js +1 -0
  5. package/{Overlay/Overlay.d.ts → Backdrop/Backdrop.d.ts} +12 -16
  6. package/Backdrop/Backdrop.js +40 -0
  7. package/Backdrop/index.d.ts +2 -0
  8. package/Backdrop/index.js +1 -0
  9. package/Badge/Badge.d.ts +20 -14
  10. package/Badge/Badge.js +14 -16
  11. package/Badge/BadgeContainer.d.ts +1 -1
  12. package/Badge/BadgeContainer.js +1 -1
  13. package/Badge/index.d.ts +1 -2
  14. package/Badge/typings.d.ts +48 -0
  15. package/Breadcrumb/Breadcrumb.d.ts +6 -0
  16. package/Breadcrumb/Breadcrumb.js +25 -0
  17. package/Breadcrumb/BreadcrumbItem.d.ts +4 -0
  18. package/Breadcrumb/BreadcrumbItem.js +45 -0
  19. package/Breadcrumb/index.d.ts +2 -0
  20. package/Breadcrumb/index.js +1 -0
  21. package/Breadcrumb/typings.d.ts +70 -0
  22. package/Button/Button.js +2 -2
  23. package/Calendar/Calendar.d.ts +31 -2
  24. package/Calendar/Calendar.js +73 -19
  25. package/Calendar/CalendarCell.d.ts +4 -0
  26. package/Calendar/CalendarCell.js +3 -3
  27. package/Calendar/CalendarContext.d.ts +14 -7
  28. package/Calendar/CalendarContext.js +7 -13
  29. package/Calendar/CalendarControls.d.ts +16 -0
  30. package/Calendar/CalendarControls.js +3 -7
  31. package/Calendar/CalendarDayOfWeek.js +3 -3
  32. package/Calendar/CalendarDays.d.ts +9 -1
  33. package/Calendar/CalendarDays.js +62 -37
  34. package/Calendar/CalendarFooterActions.d.ts +13 -0
  35. package/Calendar/CalendarFooterActions.js +14 -0
  36. package/Calendar/CalendarFooterControl.d.ts +16 -0
  37. package/Calendar/CalendarFooterControl.js +14 -0
  38. package/Calendar/CalendarHalfYears.d.ts +39 -0
  39. package/Calendar/CalendarHalfYears.js +62 -0
  40. package/Calendar/CalendarMonths.js +15 -4
  41. package/Calendar/CalendarQuarters.d.ts +37 -0
  42. package/Calendar/CalendarQuarters.js +64 -0
  43. package/Calendar/CalendarQuickSelect.d.ts +21 -0
  44. package/Calendar/CalendarQuickSelect.js +15 -0
  45. package/Calendar/CalendarWeeks.d.ts +1 -1
  46. package/Calendar/CalendarWeeks.js +88 -43
  47. package/Calendar/CalendarYears.js +12 -3
  48. package/Calendar/RangeCalendar.d.ts +59 -0
  49. package/Calendar/RangeCalendar.js +232 -0
  50. package/Calendar/index.d.ts +8 -1
  51. package/Calendar/index.js +4 -0
  52. package/Calendar/useCalendarControlModifiers.d.ts +4 -4
  53. package/Calendar/useCalendarControlModifiers.js +39 -8
  54. package/Calendar/useCalendarControls.d.ts +2 -0
  55. package/Calendar/useCalendarControls.js +18 -2
  56. package/Calendar/useRangeCalendarControls.d.ts +18 -0
  57. package/Calendar/useRangeCalendarControls.js +115 -0
  58. package/Checkbox/CheckAll.d.ts +16 -6
  59. package/Checkbox/CheckAll.js +40 -26
  60. package/Checkbox/Checkbox.d.ts +100 -22
  61. package/Checkbox/Checkbox.js +72 -16
  62. package/Checkbox/CheckboxGroup.d.ts +100 -18
  63. package/Checkbox/CheckboxGroup.js +169 -24
  64. package/Checkbox/CheckboxGroupContext.d.ts +0 -2
  65. package/Checkbox/index.d.ts +15 -6
  66. package/Checkbox/index.js +6 -2
  67. package/Checkbox/typings.d.ts +37 -0
  68. package/ClearActions/ClearActions.d.ts +41 -0
  69. package/ClearActions/ClearActions.js +23 -0
  70. package/ClearActions/index.d.ts +3 -0
  71. package/ClearActions/index.js +5 -0
  72. package/DatePicker/DatePicker.d.ts +12 -1
  73. package/DatePicker/DatePicker.js +40 -9
  74. package/DatePicker/DatePickerCalendar.d.ts +2 -5
  75. package/DatePicker/DatePickerCalendar.js +36 -37
  76. package/DateRangePicker/DateRangePicker.d.ts +18 -2
  77. package/DateRangePicker/DateRangePicker.js +142 -100
  78. package/DateRangePicker/DateRangePickerCalendar.d.ts +13 -9
  79. package/DateRangePicker/DateRangePickerCalendar.js +6 -94
  80. package/DateRangePicker/useDateRangeCalendarControls.js +6 -2
  81. package/DateRangePicker/useDateRangePickerValue.d.ts +38 -15
  82. package/DateRangePicker/useDateRangePickerValue.js +141 -63
  83. package/DateTimePicker/DateTimePicker.d.ts +31 -10
  84. package/DateTimePicker/DateTimePicker.js +178 -94
  85. package/DateTimePicker/index.d.ts +0 -2
  86. package/DateTimePicker/index.js +0 -1
  87. package/Drawer/Drawer.js +2 -2
  88. package/Dropdown/Dropdown.js +12 -22
  89. package/Empty/Empty.d.ts +1 -16
  90. package/Empty/Empty.js +36 -7
  91. package/Empty/icons/EmptyMainInitialDataIcon.d.ts +4 -0
  92. package/Empty/icons/EmptyMainInitialDataIcon.js +9 -0
  93. package/Empty/icons/EmptyMainResultIcon.d.ts +4 -0
  94. package/Empty/icons/EmptyMainResultIcon.js +9 -0
  95. package/Empty/icons/EmptyMainSystemIcon.d.ts +4 -0
  96. package/Empty/icons/EmptyMainSystemIcon.js +9 -0
  97. package/Empty/index.d.ts +1 -1
  98. package/Empty/typings.d.ts +52 -0
  99. package/Form/FormHintText.d.ts +18 -0
  100. package/Form/FormHintText.js +17 -0
  101. package/Form/index.d.ts +2 -2
  102. package/Form/index.js +1 -1
  103. package/InlineMessage/InlineMessage.d.ts +33 -0
  104. package/InlineMessage/InlineMessage.js +42 -0
  105. package/InlineMessage/InlineMessageGroup.d.ts +24 -0
  106. package/InlineMessage/InlineMessageGroup.js +21 -0
  107. package/InlineMessage/index.d.ts +4 -0
  108. package/InlineMessage/index.js +2 -0
  109. package/Input/ActionButton/ActionButton.d.ts +26 -0
  110. package/Input/ActionButton/ActionButton.js +14 -0
  111. package/Input/ActionButton/index.d.ts +2 -0
  112. package/Input/ActionButton/index.js +1 -0
  113. package/Input/Input.d.ts +147 -42
  114. package/Input/Input.js +194 -27
  115. package/Input/PasswordStrengthIndicator/PasswordStrengthIndicator.d.ts +31 -0
  116. package/Input/PasswordStrengthIndicator/PasswordStrengthIndicator.js +18 -0
  117. package/Input/PasswordStrengthIndicator/index.d.ts +2 -0
  118. package/Input/PasswordStrengthIndicator/index.js +1 -0
  119. package/Input/SelectButton/SelectButton.d.ts +20 -0
  120. package/Input/SelectButton/SelectButton.js +21 -0
  121. package/Input/SelectButton/index.d.ts +2 -0
  122. package/Input/SelectButton/index.js +1 -0
  123. package/Input/SpinnerButton/SpinnerButton.d.ts +19 -0
  124. package/Input/SpinnerButton/SpinnerButton.js +14 -0
  125. package/Input/SpinnerButton/index.d.ts +2 -0
  126. package/Input/SpinnerButton/index.js +1 -0
  127. package/Input/index.d.ts +2 -2
  128. package/Message/Message.d.ts +6 -4
  129. package/Message/Message.js +86 -9
  130. package/Message/MessageTimerController.d.ts +14 -0
  131. package/Message/MessageTimerController.js +27 -0
  132. package/Modal/Modal.js +2 -2
  133. package/Modal/useModalContainer.d.ts +1 -1
  134. package/Modal/useModalContainer.js +2 -4
  135. package/Navigation/NavigationSubMenu.js +15 -26
  136. package/Notifier/NotifierManager.d.ts +15 -2
  137. package/Notifier/NotifierManager.js +60 -18
  138. package/Notifier/createNotifier.d.ts +9 -0
  139. package/Notifier/createNotifier.js +3 -2
  140. package/Notifier/typings.d.ts +3 -1
  141. package/OverflowTooltip/OverflowCounterTag.d.ts +12 -0
  142. package/OverflowTooltip/OverflowCounterTag.js +48 -0
  143. package/OverflowTooltip/OverflowTooltip.d.ts +34 -0
  144. package/OverflowTooltip/OverflowTooltip.js +53 -0
  145. package/OverflowTooltip/index.d.ts +2 -0
  146. package/OverflowTooltip/index.js +2 -0
  147. package/PageFooter/PageFooter.d.ts +73 -8
  148. package/PageFooter/PageFooter.js +34 -3
  149. package/PageHeader/PageHeader.d.ts +36 -0
  150. package/PageHeader/PageHeader.js +65 -0
  151. package/PageHeader/index.d.ts +2 -0
  152. package/PageHeader/index.js +1 -0
  153. package/PageToolbar/PageToolbar.d.ts +67 -0
  154. package/PageToolbar/PageToolbar.js +114 -0
  155. package/PageToolbar/index.d.ts +2 -0
  156. package/PageToolbar/index.js +1 -0
  157. package/Picker/FormattedInput.d.ts +17 -0
  158. package/Picker/FormattedInput.js +74 -0
  159. package/Picker/MaskFormat.d.ts +39 -0
  160. package/Picker/MaskFormat.js +94 -0
  161. package/Picker/PickerTrigger.d.ts +13 -3
  162. package/Picker/PickerTrigger.js +17 -2
  163. package/Picker/PickerTriggerWithSeparator.d.ts +124 -0
  164. package/Picker/PickerTriggerWithSeparator.js +80 -0
  165. package/Picker/RangePickerTrigger.d.ts +55 -4
  166. package/Picker/RangePickerTrigger.js +65 -7
  167. package/Picker/formatUtils.d.ts +34 -0
  168. package/Picker/formatUtils.js +124 -0
  169. package/Picker/index.d.ts +7 -2
  170. package/Picker/index.js +4 -1
  171. package/Picker/useDateInputFormatter.d.ts +52 -0
  172. package/Picker/useDateInputFormatter.js +382 -0
  173. package/Picker/usePickerValue.d.ts +1 -2
  174. package/Picker/usePickerValue.js +8 -13
  175. package/Popover/Popover.js +4 -8
  176. package/Popper/Popper.d.ts +15 -10
  177. package/Popper/Popper.js +88 -17
  178. package/Popper/index.d.ts +1 -1
  179. package/Portal/Portal.d.ts +13 -5
  180. package/Portal/Portal.js +25 -10
  181. package/Portal/index.d.ts +2 -0
  182. package/Portal/index.js +1 -0
  183. package/Portal/portalRegistry.d.ts +17 -0
  184. package/Portal/portalRegistry.js +92 -0
  185. package/Progress/Progress.d.ts +23 -30
  186. package/Progress/Progress.js +70 -21
  187. package/Progress/index.d.ts +2 -2
  188. package/Provider/ConfigProvider.d.ts +1 -0
  189. package/Provider/ConfigProvider.js +1 -0
  190. package/ResultState/ResultState.d.ts +52 -0
  191. package/ResultState/ResultState.js +24 -0
  192. package/ResultState/index.d.ts +2 -0
  193. package/ResultState/index.js +1 -0
  194. package/Select/AutoComplete.d.ts +1 -1
  195. package/Select/Select.d.ts +1 -1
  196. package/Select/SelectTrigger.d.ts +1 -87
  197. package/Select/SelectTrigger.js +26 -21
  198. package/Select/SelectTriggerTags.d.ts +1 -1
  199. package/Select/SelectTriggerTags.js +47 -18
  200. package/Select/TreeSelect.d.ts +1 -1
  201. package/Select/typings.d.ts +99 -0
  202. package/Select/useSelectTriggerTags.d.ts +15 -8
  203. package/Select/useSelectTriggerTags.js +83 -44
  204. package/Selection/Selection.d.ts +98 -0
  205. package/Selection/Selection.js +46 -0
  206. package/Selection/index.d.ts +12 -0
  207. package/Selection/index.js +5 -0
  208. package/Skeleton/Skeleton.d.ts +10 -3
  209. package/Skeleton/Skeleton.js +12 -4
  210. package/Slider/Slider.d.ts +44 -7
  211. package/Slider/Slider.js +17 -13
  212. package/Spin/Spin.d.ts +39 -0
  213. package/{Loading/Loading.js → Spin/Spin.js} +8 -8
  214. package/Spin/index.d.ts +2 -0
  215. package/Spin/index.js +1 -0
  216. package/Stepper/Step.d.ts +1 -35
  217. package/Stepper/Step.js +43 -10
  218. package/Stepper/Stepper.d.ts +1 -14
  219. package/Stepper/Stepper.js +49 -15
  220. package/Stepper/index.d.ts +3 -2
  221. package/Stepper/index.js +1 -0
  222. package/Stepper/typings.d.ts +77 -0
  223. package/Stepper/useStepDistance.d.ts +10 -0
  224. package/Stepper/useStepDistance.js +81 -0
  225. package/Stepper/useStepper.d.ts +21 -0
  226. package/Stepper/useStepper.js +26 -0
  227. package/Table/Table.js +2 -2
  228. package/Table/TableBody.js +2 -2
  229. package/Table/rowSelection/TableRowSelection.js +1 -1
  230. package/Tag/Tag.d.ts +2 -25
  231. package/Tag/Tag.js +22 -13
  232. package/Tag/TagGroup.d.ts +12 -0
  233. package/Tag/TagGroup.js +41 -0
  234. package/Tag/index.d.ts +1 -1
  235. package/Tag/typings.d.ts +78 -0
  236. package/TextField/TextField.d.ts +78 -19
  237. package/TextField/TextField.js +57 -20
  238. package/TextField/index.d.ts +1 -1
  239. package/Textarea/Textarea.d.ts +19 -51
  240. package/Textarea/Textarea.js +12 -19
  241. package/Textarea/index.d.ts +0 -1
  242. package/TimePanel/TimePanel.d.ts +1 -22
  243. package/TimePanel/TimePanel.js +30 -26
  244. package/TimePanel/TimePanelAction.d.ts +2 -8
  245. package/TimePanel/TimePanelAction.js +2 -2
  246. package/TimePanel/TimePanelColumn.d.ts +0 -13
  247. package/TimePanel/TimePanelColumn.js +9 -11
  248. package/TimePicker/TimePicker.d.ts +10 -1
  249. package/TimePicker/TimePicker.js +85 -35
  250. package/TimePicker/TimePickerPanel.d.ts +1 -2
  251. package/TimePicker/TimePickerPanel.js +2 -2
  252. package/Toggle/Toggle.d.ts +46 -0
  253. package/Toggle/Toggle.js +29 -0
  254. package/Toggle/index.d.ts +3 -0
  255. package/Toggle/index.js +1 -0
  256. package/Tooltip/Tooltip.d.ts +13 -2
  257. package/Tooltip/Tooltip.js +56 -10
  258. package/Tooltip/useDelayMouseEnterLeave.d.ts +1 -2
  259. package/Tooltip/useDelayMouseEnterLeave.js +0 -4
  260. package/Transition/Collapse.d.ts +2 -0
  261. package/Transition/Collapse.js +3 -2
  262. package/Transition/Fade.js +4 -4
  263. package/Transition/Rotate.d.ts +42 -0
  264. package/Transition/Rotate.js +30 -0
  265. package/Transition/Scale.d.ts +13 -0
  266. package/Transition/{Grow.js → Scale.js} +17 -12
  267. package/Transition/Slide.d.ts +7 -0
  268. package/Transition/{Zoom.js → Slide.js} +14 -12
  269. package/Transition/SlideFade.d.ts +3 -0
  270. package/Transition/SlideFade.js +5 -4
  271. package/Transition/Transition.d.ts +1 -1
  272. package/Transition/Translate.d.ts +14 -0
  273. package/Transition/Translate.js +94 -0
  274. package/Transition/index.d.ts +8 -4
  275. package/Transition/index.js +4 -2
  276. package/Tree/TreeNode.js +6 -6
  277. package/Upload/Upload.d.ts +175 -0
  278. package/Upload/Upload.js +279 -0
  279. package/Upload/UploadItem.d.ts +82 -0
  280. package/Upload/UploadItem.js +118 -0
  281. package/Upload/UploadPictureCard.d.ts +110 -0
  282. package/Upload/UploadPictureCard.js +101 -0
  283. package/Upload/Uploader.d.ts +161 -0
  284. package/Upload/Uploader.js +120 -0
  285. package/Upload/index.d.ts +8 -11
  286. package/Upload/index.js +4 -5
  287. package/Upload/upload-utils.d.ts +41 -0
  288. package/Upload/upload-utils.js +65 -0
  289. package/_internal/InputTriggerPopper/InputTriggerPopper.js +15 -25
  290. package/_internal/SlideFadeOverlay/SlideFadeOverlay.d.ts +2 -2
  291. package/_internal/SlideFadeOverlay/SlideFadeOverlay.js +4 -27
  292. package/hooks/useScrollLock.d.ts +28 -0
  293. package/hooks/useScrollLock.js +134 -0
  294. package/index.d.ts +99 -84
  295. package/index.js +92 -78
  296. package/package.json +7 -7
  297. package/utils/get-css-variable-value.d.ts +1 -0
  298. package/utils/get-css-variable-value.js +9 -0
  299. package/DateTimePicker/DateTimePickerPanel.d.ts +0 -28
  300. package/DateTimePicker/DateTimePickerPanel.js +0 -50
  301. package/Form/FormMessage.d.ts +0 -7
  302. package/Form/FormMessage.js +0 -19
  303. package/Form/useInputWithTagsModeValue.js +0 -88
  304. package/Loading/Loading.d.ts +0 -33
  305. package/Loading/index.d.ts +0 -2
  306. package/Loading/index.js +0 -1
  307. package/Overlay/Overlay.js +0 -31
  308. package/Overlay/index.d.ts +0 -2
  309. package/Overlay/index.js +0 -1
  310. package/Picker/useRangePickerValue.d.ts +0 -23
  311. package/Picker/useRangePickerValue.js +0 -99
  312. package/Switch/Switch.d.ts +0 -43
  313. package/Switch/Switch.js +0 -29
  314. package/Switch/index.d.ts +0 -3
  315. package/Switch/index.js +0 -1
  316. package/Transition/Grow.d.ts +0 -12
  317. package/Transition/Zoom.d.ts +0 -7
  318. package/Upload/UploadButton.d.ts +0 -9
  319. package/Upload/UploadButton.js +0 -23
  320. package/Upload/UploadInput.d.ts +0 -20
  321. package/Upload/UploadInput.js +0 -23
  322. package/Upload/UploadPicture.d.ts +0 -49
  323. package/Upload/UploadPicture.js +0 -51
  324. package/Upload/UploadPictureBlock.d.ts +0 -20
  325. package/Upload/UploadPictureBlock.js +0 -79
  326. package/Upload/UploadPictureWall.d.ts +0 -81
  327. package/Upload/UploadPictureWall.js +0 -168
  328. package/Upload/UploadPictureWallItem.d.ts +0 -15
  329. package/Upload/UploadPictureWallItem.js +0 -18
  330. package/Upload/UploadResult.d.ts +0 -35
  331. package/Upload/UploadResult.js +0 -30
  332. package/utils/scroll-lock.d.ts +0 -2
  333. package/utils/scroll-lock.js +0 -24
@@ -0,0 +1,13 @@
1
+ import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
2
+ import { ButtonProps } from '../Button';
3
+ export interface CalendarFooterActionsProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'onClick'> {
4
+ actions: {
5
+ secondaryButtonProps: ButtonProps;
6
+ primaryButtonProps: ButtonProps;
7
+ };
8
+ }
9
+ /**
10
+ * The react component for `mezzanine` calendar footer actions.
11
+ */
12
+ declare function CalendarFooterActions(props: CalendarFooterActionsProps): import("react/jsx-runtime").JSX.Element;
13
+ export default CalendarFooterActions;
@@ -0,0 +1,14 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { calendarClasses } from '@mezzanine-ui/core/calendar';
3
+ import Button from '../Button/Button.js';
4
+ import cx from 'clsx';
5
+
6
+ /**
7
+ * The react component for `mezzanine` calendar footer actions.
8
+ */
9
+ function CalendarFooterActions(props) {
10
+ const { actions, className, ...restElementProps } = props;
11
+ return (jsxs("div", { ...restElementProps, className: cx(calendarClasses.footerActions, className), children: [jsx(Button, { variant: "base-tertiary", size: "minor", ...actions.secondaryButtonProps }), jsx(Button, { variant: "base-primary", size: "minor", ...actions.primaryButtonProps })] }));
12
+ }
13
+
14
+ export { CalendarFooterActions as default };
@@ -0,0 +1,16 @@
1
+ import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
2
+ export interface CalendarFooterControlProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'onClick'> {
3
+ /**
4
+ * The name of children content.
5
+ */
6
+ children?: string;
7
+ /**
8
+ * The onClick handler for button
9
+ */
10
+ onClick?: VoidFunction;
11
+ }
12
+ /**
13
+ * The react component for `mezzanine` calendar footer control.
14
+ */
15
+ declare function CalendarFooterControl(props: CalendarFooterControlProps): import("react/jsx-runtime").JSX.Element;
16
+ export default CalendarFooterControl;
@@ -0,0 +1,14 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { calendarClasses } from '@mezzanine-ui/core/calendar';
3
+ import Button from '../Button/Button.js';
4
+ import cx from 'clsx';
5
+
6
+ /**
7
+ * The react component for `mezzanine` calendar footer control.
8
+ */
9
+ function CalendarFooterControl(props) {
10
+ const { children, className, onClick, ...restElementProps } = props;
11
+ return (jsx("div", { ...restElementProps, className: cx(calendarClasses.footerControl, className), children: jsx(Button, { variant: "base-ghost", size: "minor", onClick: onClick, children: children }) }));
12
+ }
13
+
14
+ export { CalendarFooterControl as default };
@@ -0,0 +1,39 @@
1
+ import { DateType } from '@mezzanine-ui/core/calendar';
2
+ import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
3
+ export interface CalendarHalfYearsProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'onClick' | 'children'> {
4
+ /**
5
+ * Provide if you have a custom disabling logic.
6
+ * The method takes the date object as its parameter.
7
+ */
8
+ isHalfYearDisabled?: (date: DateType) => boolean;
9
+ /**
10
+ * Provide if you have a custom logic for checking if the half-year is in range.
11
+ * The method takes the date object as its parameter.
12
+ */
13
+ isHalfYearInRange?: (date: DateType) => boolean;
14
+ /**
15
+ * Click handler for the button of each half-year.
16
+ * The method takes the date object as its parameter.
17
+ */
18
+ onClick?: (target: DateType) => void;
19
+ /**
20
+ * Mouse enter handler for the button of each half-year.
21
+ * The method takes the date object as its parameter.
22
+ */
23
+ onHalfYearHover?: (target: DateType) => void;
24
+ /**
25
+ * The reference date for getting the half-years range and computing the date object.
26
+ */
27
+ referenceDate: DateType;
28
+ /**
29
+ * The half-year will be marked as active if it matches the same half-year of any value in the array.
30
+ */
31
+ value?: DateType[];
32
+ }
33
+ /**
34
+ * The react component for `mezzanine` calendar half-years.
35
+ * This component displays half-years for 5 years.
36
+ * You may use it to compose your own calendar.
37
+ */
38
+ declare function CalendarHalfYears(props: CalendarHalfYearsProps): import("react/jsx-runtime").JSX.Element;
39
+ export default CalendarHalfYears;
@@ -0,0 +1,62 @@
1
+ 'use client';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { getYearRange, calendarHalfYearYearsCount, calendarHalfYears, calendarClasses } from '@mezzanine-ui/core/calendar';
4
+ import { useMemo } from 'react';
5
+ import { useCalendarContext } from './CalendarContext.js';
6
+ import CalendarCell from './CalendarCell.js';
7
+ import cx from 'clsx';
8
+
9
+ /**
10
+ * The react component for `mezzanine` calendar half-years.
11
+ * This component displays half-years for 5 years.
12
+ * You may use it to compose your own calendar.
13
+ */
14
+ function CalendarHalfYears(props) {
15
+ const { getYear, getCurrentHalfYearFirstDate, isHalfYearIncluded, setYear, setMonth, } = useCalendarContext();
16
+ const { className, isHalfYearDisabled, isHalfYearInRange, onClick: onClickProp, onHalfYearHover, referenceDate, value, ...rest } = props;
17
+ const currentYear = getYear(referenceDate);
18
+ const [start] = useMemo(() => getYearRange(currentYear, calendarHalfYearYearsCount), [currentYear]);
19
+ const years = useMemo(() => {
20
+ return Array.from({ length: calendarHalfYearYearsCount }, (_, i) => start + i);
21
+ }, [start]);
22
+ return (jsx("div", { className: cx(calendarClasses.board, className), ...rest, children: years.map((year, yearIndex) => {
23
+ return (jsxs("div", { className: cx(calendarClasses.row, {
24
+ [calendarClasses.rowWithBorder]: yearIndex > 0,
25
+ }), children: [jsx(CalendarCell, { disabled: true, children: year }), calendarHalfYears.map((halfYear) => {
26
+ const halfYearStartMonth = (halfYear - 1) * 6;
27
+ const halfYearDate = setMonth(setYear(getCurrentHalfYearFirstDate(referenceDate), year), halfYearStartMonth);
28
+ const disabled = isHalfYearDisabled && isHalfYearDisabled(halfYearDate);
29
+ const inRange = !disabled &&
30
+ isHalfYearInRange &&
31
+ isHalfYearInRange(halfYearDate);
32
+ const active = !disabled && value && isHalfYearIncluded(halfYearDate, value);
33
+ const onClick = () => {
34
+ if (disabled)
35
+ return;
36
+ onClickProp === null || onClickProp === void 0 ? void 0 : onClickProp(halfYearDate);
37
+ };
38
+ const onMouseEnter = () => {
39
+ if (disabled)
40
+ return;
41
+ onHalfYearHover === null || onHalfYearHover === void 0 ? void 0 : onHalfYearHover(halfYearDate);
42
+ };
43
+ // Accessible half-year label for screen readers
44
+ const halfYearMonths = halfYear === 1 ? 'January to June' : 'July to December';
45
+ const ariaLabel = [
46
+ `Half ${halfYear}, ${year}`,
47
+ halfYearMonths,
48
+ active && 'Selected',
49
+ disabled && 'Not available',
50
+ ]
51
+ .filter(Boolean)
52
+ .join(', ');
53
+ return (jsxs("button", { type: "button", disabled: disabled, "aria-disabled": disabled, "aria-label": ariaLabel, "aria-pressed": active, className: cx(calendarClasses.button, {
54
+ [calendarClasses.buttonDisabled]: disabled,
55
+ [calendarClasses.buttonInRange]: inRange,
56
+ [calendarClasses.buttonActive]: active,
57
+ }), onClick: onClick, onMouseEnter: onMouseEnter, children: ["H", halfYear] }, halfYear));
58
+ })] }, year));
59
+ }) }));
60
+ }
61
+
62
+ export { CalendarHalfYears as default };
@@ -10,11 +10,11 @@ import cx from 'clsx';
10
10
  * You may use it to compose your own calendar.
11
11
  */
12
12
  function CalendarMonths(props) {
13
- const { displayMonthLocale: displayMonthLocaleFromConfig, getMonthShortNames, isMonthIncluded, setMonth, } = useCalendarContext();
14
- const { className, displayMonthLocale = displayMonthLocaleFromConfig, isMonthDisabled, isMonthInRange, isYearDisabled, onClick: onClickProp, onMonthHover, referenceDate, value, ...rest } = props;
13
+ const { locale, getMonthShortNames, isMonthIncluded, getCurrentMonthFirstDate, setMonth, } = useCalendarContext();
14
+ const { className, displayMonthLocale = locale, isMonthDisabled, isMonthInRange, isYearDisabled, onClick: onClickProp, onMonthHover, referenceDate, value, ...rest } = props;
15
15
  const monthNames = getMonthShortNames(displayMonthLocale);
16
16
  return (jsx("div", { className: cx(calendarClasses.board, className), ...rest, children: jsx("div", { className: calendarClasses.twelveGrid, children: calendarMonths.map((month) => {
17
- const monthDateType = setMonth(referenceDate, month);
17
+ const monthDateType = setMonth(getCurrentMonthFirstDate(referenceDate), month);
18
18
  const active = value && isMonthIncluded(monthDateType, value);
19
19
  /** @NOTE Current month should be disabled when current year is disabled */
20
20
  const disabled = (isYearDisabled === null || isYearDisabled === void 0 ? void 0 : isYearDisabled(monthDateType)) ||
@@ -31,7 +31,18 @@ function CalendarMonths(props) {
31
31
  onMonthHover(monthDateType);
32
32
  }
33
33
  : undefined;
34
- return (jsx("button", { type: "button", "aria-disabled": disabled, disabled: disabled, className: cx(calendarClasses.button, {
34
+ // Accessible month label for screen readers
35
+ const monthDate = new Date(monthDateType);
36
+ const fullMonthName = monthDate.toLocaleDateString(displayMonthLocale, { month: 'long' });
37
+ const year = monthDate.getFullYear();
38
+ const ariaLabel = [
39
+ `${fullMonthName} ${year}`,
40
+ active && 'Selected',
41
+ disabled && 'Not available',
42
+ ]
43
+ .filter(Boolean)
44
+ .join(', ');
45
+ return (jsx("button", { type: "button", "aria-disabled": disabled, disabled: disabled, "aria-label": ariaLabel, "aria-pressed": active, className: cx(calendarClasses.button, {
35
46
  [calendarClasses.buttonActive]: active,
36
47
  [calendarClasses.buttonInRange]: inRange,
37
48
  [calendarClasses.buttonDisabled]: disabled,
@@ -0,0 +1,37 @@
1
+ import { DateType } from '@mezzanine-ui/core/calendar';
2
+ import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
3
+ export interface CalendarQuartersProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'onClick' | 'children'> {
4
+ /**
5
+ * Provide if you have a custom disabling logic.
6
+ * The method takes the date object as its parameter.
7
+ */
8
+ isQuarterDisabled?: (date: DateType) => boolean;
9
+ /**
10
+ * Provide if you have a custom logic for checking if the quarter is in range.
11
+ * The method takes the date object as its parameter.
12
+ */
13
+ isQuarterInRange?: (date: DateType) => boolean;
14
+ /**
15
+ * Click handler for the button of each quarter.
16
+ * The method takes the date object as its parameter.
17
+ */
18
+ onClick?: (target: DateType) => void;
19
+ /**
20
+ * Mouse enter handler for the button of each quarter.
21
+ * The method takes the date object as its parameter.
22
+ */
23
+ onQuarterHover?: (target: DateType) => void;
24
+ /**
25
+ * The reference date for getting the quarters range and computing the date object.
26
+ */
27
+ referenceDate: DateType;
28
+ /**
29
+ * The quarter will be marked as active if it matches the same quarter of any value in the array.
30
+ */
31
+ value?: DateType[];
32
+ }
33
+ /**
34
+ * The react component for `mezzanine` calendar quarters.
35
+ */
36
+ declare function CalendarQuarters(props: CalendarQuartersProps): import("react/jsx-runtime").JSX.Element;
37
+ export default CalendarQuarters;
@@ -0,0 +1,64 @@
1
+ 'use client';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { getYearRange, calendarQuarterYearsCount, calendarQuarters, calendarClasses } from '@mezzanine-ui/core/calendar';
4
+ import { useMemo } from 'react';
5
+ import { useCalendarContext } from './CalendarContext.js';
6
+ import CalendarCell from './CalendarCell.js';
7
+ import cx from 'clsx';
8
+
9
+ /**
10
+ * The react component for `mezzanine` calendar quarters.
11
+ */
12
+ function CalendarQuarters(props) {
13
+ const { getYear, getCurrentQuarterFirstDate, isQuarterIncluded, setYear, setMonth, } = useCalendarContext();
14
+ const { className, isQuarterDisabled, isQuarterInRange, onClick: onClickProp, onQuarterHover, referenceDate, value, ...rest } = props;
15
+ const currentYear = getYear(referenceDate);
16
+ const [start] = useMemo(() => getYearRange(currentYear, calendarQuarterYearsCount), [currentYear]);
17
+ const years = useMemo(() => {
18
+ return Array.from({ length: calendarQuarterYearsCount }, (_, i) => start + i);
19
+ }, [start]);
20
+ return (jsx("div", { className: cx(calendarClasses.board, className), ...rest, children: years.map((year, yearIndex) => {
21
+ return (jsxs("div", { className: cx(calendarClasses.row, {
22
+ [calendarClasses.rowWithBorder]: yearIndex > 0,
23
+ }), children: [jsx(CalendarCell, { disabled: true, children: year }), calendarQuarters.map((quarter) => {
24
+ const quarterStartMonth = (quarter - 1) * 3;
25
+ const quarterDate = setMonth(setYear(getCurrentQuarterFirstDate(getCurrentQuarterFirstDate(referenceDate)), year), quarterStartMonth);
26
+ const active = value && isQuarterIncluded(quarterDate, value);
27
+ const disabled = isQuarterDisabled && isQuarterDisabled(quarterDate);
28
+ const inRange = isQuarterInRange && isQuarterInRange(quarterDate);
29
+ const onClick = onClickProp
30
+ ? () => {
31
+ onClickProp(quarterDate);
32
+ }
33
+ : undefined;
34
+ const onMouseEnter = onQuarterHover
35
+ ? () => {
36
+ onQuarterHover(quarterDate);
37
+ }
38
+ : undefined;
39
+ // Accessible quarter label for screen readers
40
+ const quarterMonths = [
41
+ ['January', 'February', 'March'],
42
+ ['April', 'May', 'June'],
43
+ ['July', 'August', 'September'],
44
+ ['October', 'November', 'December'],
45
+ ];
46
+ const monthNames = quarterMonths[quarter - 1].join(', ');
47
+ const ariaLabel = [
48
+ `Quarter ${quarter}, ${year}`,
49
+ `${monthNames}`,
50
+ active && 'Selected',
51
+ disabled && 'Not available',
52
+ ]
53
+ .filter(Boolean)
54
+ .join(', ');
55
+ return (jsxs("button", { type: "button", disabled: disabled, "aria-disabled": disabled, "aria-label": ariaLabel, "aria-pressed": active, className: cx(calendarClasses.button, {
56
+ [calendarClasses.buttonActive]: active,
57
+ [calendarClasses.buttonInRange]: inRange,
58
+ [calendarClasses.buttonDisabled]: disabled,
59
+ }), onClick: onClick, onMouseEnter: onMouseEnter, children: ["Q", quarter] }, quarter));
60
+ })] }, year));
61
+ }) }));
62
+ }
63
+
64
+ export { CalendarQuarters as default };
@@ -0,0 +1,21 @@
1
+ import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
2
+ export interface CalendarQuickSelectProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'onClick'> {
3
+ /**
4
+ * The id of active quick select button.
5
+ */
6
+ activeId?: string;
7
+ /**
8
+ * The options for quick select buttons.
9
+ */
10
+ options: {
11
+ id: string;
12
+ name: string;
13
+ disabled?: boolean;
14
+ onClick: VoidFunction;
15
+ }[];
16
+ }
17
+ /**
18
+ * The react component for `mezzanine` calendar quick select.
19
+ */
20
+ declare function CalendarQuickSelect(props: CalendarQuickSelectProps): import("react/jsx-runtime").JSX.Element;
21
+ export default CalendarQuickSelect;
@@ -0,0 +1,15 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { calendarClasses } from '@mezzanine-ui/core/calendar';
3
+ import { CheckedIcon } from '@mezzanine-ui/icons';
4
+ import Icon from '../Icon/Icon.js';
5
+ import cx from 'clsx';
6
+
7
+ /**
8
+ * The react component for `mezzanine` calendar quick select.
9
+ */
10
+ function CalendarQuickSelect(props) {
11
+ const { className, activeId, options, ...restElementProps } = props;
12
+ return (jsx("div", { ...restElementProps, className: cx(calendarClasses.quickSelect, className), children: options.map(({ id, name, disabled, onClick }) => (jsxs("button", { type: "button", disabled: disabled, "aria-disabled": disabled, className: cx(calendarClasses.quickSelectButton, id === activeId && calendarClasses.quickSelectButtonActive), onClick: onClick, children: [jsx("span", { children: name }), id === activeId && jsx(Icon, { icon: CheckedIcon, size: 16 })] }, id))) }));
13
+ }
14
+
15
+ export { CalendarQuickSelect as default };
@@ -25,7 +25,7 @@ export interface CalendarWeeksProps extends Pick<CalendarDayOfWeekProps, 'displa
25
25
  */
26
26
  onWeekHover?: (firstDateOfWeek: DateType) => void;
27
27
  /**
28
- * The refernce date for getting the dates of calendar.
28
+ * The reference date for getting the dates of calendar.
29
29
  */
30
30
  referenceDate: DateType;
31
31
  /**
@@ -13,49 +13,94 @@ import cx from 'clsx';
13
13
  * You may use it to compose your own calendar.
14
14
  */
15
15
  function CalendarWeeks(props) {
16
- const { displayWeekDayLocale: displayWeekDayLocaleFromConfig, getCalendarGrid, getDate, getMonth, getNow, isInMonth, isSameDate, isWeekIncluded, setDate, setMonth, } = useCalendarContext();
17
- const { className, displayWeekDayLocale = displayWeekDayLocaleFromConfig, isYearDisabled, isMonthDisabled, isWeekDisabled, isWeekInRange, onClick: onClickProp, onWeekHover, referenceDate, value, ...rest } = props;
18
- const daysGrid = useMemo(() => getCalendarGrid(referenceDate), [getCalendarGrid, referenceDate]);
19
- return (jsxs("div", { ...rest, className: cx(calendarClasses.board, className), children: [jsx(CalendarDayOfWeek, { displayWeekDayLocale: displayWeekDayLocale }), daysGrid.map((week, index) => {
20
- const dates = [];
21
- const weekStartInPrevMonth = index === 0 && week[0] > 7;
22
- const weekStartInNextMonth = index > 3 && week[0] <= 14;
23
- week.forEach((dateNum) => {
24
- const isPrevMonth = index === 0 && dateNum > 7;
25
- const isNextMonth = index > 3 && dateNum <= 14;
26
- const thisMonth = getMonth(referenceDate);
27
- const month = isPrevMonth
28
- ? thisMonth - 1
29
- : isNextMonth
30
- ? thisMonth + 1
31
- : thisMonth;
32
- const date = setDate(setMonth(referenceDate, month), dateNum);
33
- dates.push(date);
34
- });
35
- const disabled = (isYearDisabled === null || isYearDisabled === void 0 ? void 0 : isYearDisabled(dates[0])) ||
36
- (isMonthDisabled === null || isMonthDisabled === void 0 ? void 0 : isMonthDisabled(dates[0])) ||
37
- (isWeekDisabled === null || isWeekDisabled === void 0 ? void 0 : isWeekDisabled(dates[0])) ||
38
- false;
39
- const inactive = !disabled && (weekStartInPrevMonth || weekStartInNextMonth);
40
- const active = !disabled && !inactive && value && isWeekIncluded(dates[0], value);
41
- const inRange = !disabled && !inactive && isWeekInRange && isWeekInRange(dates[0]);
42
- const onMouseEnter = onWeekHover
43
- ? () => {
44
- onWeekHover(dates[0]);
45
- }
46
- : undefined;
47
- const onClick = onClickProp
48
- ? () => {
49
- onClickProp(dates[0]);
50
- }
51
- : undefined;
52
- return (jsx("button", { type: "button", className: cx(calendarClasses.button, calendarClasses.row, {
53
- [calendarClasses.buttonActive]: active,
54
- [calendarClasses.buttonInRange]: inRange,
55
- [calendarClasses.buttonDisabled]: disabled,
56
- }), disabled: disabled, "aria-disabled": disabled, onClick: onClick, onMouseEnter: onMouseEnter, children: week.map((dateNum, dateIndex) => (jsx(CalendarCell, { today: isSameDate(dates[dateIndex], getNow()), disabled: disabled ||
57
- !isInMonth(dates[dateIndex], getMonth(referenceDate)), active: active, children: dateNum }, `${getMonth(dates[dateIndex])}/${getDate(dates[dateIndex])}`))) }, `CALENDAR_WEEKS/WEEK_OF/${index}`));
58
- })] }));
16
+ const { locale, getCalendarGrid, getWeek, getDate, getMonth, getNow, isInMonth, isSameDate, isWeekIncluded, setDate, setMonth, setHour, setMinute, setSecond, setMillisecond, getCurrentWeekFirstDate, } = useCalendarContext();
17
+ const { className, displayWeekDayLocale = locale, isYearDisabled, isMonthDisabled, isWeekDisabled, isWeekInRange, onClick: onClickProp, onWeekHover, referenceDate, value, ...rest } = props;
18
+ const daysGrid = useMemo(() => getCalendarGrid(referenceDate, displayWeekDayLocale), [getCalendarGrid, referenceDate, displayWeekDayLocale]);
19
+ const weekFirstDates = useMemo(() => {
20
+ return daysGrid.map((week, index) => {
21
+ const dateNum = week[0];
22
+ const isPrevMonth = index === 0 && dateNum > 7;
23
+ const isNextMonth = index > 3 && dateNum <= 14;
24
+ const thisMonth = getMonth(referenceDate);
25
+ const month = isPrevMonth
26
+ ? thisMonth - 1
27
+ : isNextMonth
28
+ ? thisMonth + 1
29
+ : thisMonth;
30
+ const weekFirstDate = setDate(setMonth(referenceDate, month), dateNum);
31
+ return getCurrentWeekFirstDate(weekFirstDate, displayWeekDayLocale);
32
+ });
33
+ }, [
34
+ daysGrid,
35
+ getMonth,
36
+ referenceDate,
37
+ setDate,
38
+ setMonth,
39
+ getCurrentWeekFirstDate,
40
+ displayWeekDayLocale,
41
+ ]);
42
+ return (jsxs("div", { ...rest, className: cx(calendarClasses.board, className), children: [jsx("div", { className: calendarClasses.week, children: weekFirstDates.map((firstDate, idx) => (jsx("div", { className: calendarClasses.weekRow, children: jsx(CalendarCell, { disabled: true, children: getWeek(firstDate, displayWeekDayLocale) }) }, idx))) }), jsxs("div", { className: calendarClasses.daysGrid, children: [jsx(CalendarDayOfWeek, { displayWeekDayLocale: displayWeekDayLocale }), daysGrid.map((week, index) => {
43
+ const dates = [];
44
+ const weekStartInPrevMonth = index === 0 && week[0] > 7;
45
+ const weekStartInNextMonth = index > 3 && week[0] <= 14;
46
+ week.forEach((dateNum) => {
47
+ const isPrevMonth = index === 0 && dateNum > 7;
48
+ const isNextMonth = index > 3 && dateNum <= 14;
49
+ const thisMonth = getMonth(referenceDate);
50
+ const month = isPrevMonth
51
+ ? thisMonth - 1
52
+ : isNextMonth
53
+ ? thisMonth + 1
54
+ : thisMonth;
55
+ const date = setMillisecond(setSecond(setMinute(setHour(setDate(setMonth(referenceDate, month), dateNum), 0), 0), 0), 0);
56
+ dates.push(date);
57
+ });
58
+ const disabled = (isYearDisabled === null || isYearDisabled === void 0 ? void 0 : isYearDisabled(dates[0])) ||
59
+ (isMonthDisabled === null || isMonthDisabled === void 0 ? void 0 : isMonthDisabled(dates[0])) ||
60
+ (isWeekDisabled === null || isWeekDisabled === void 0 ? void 0 : isWeekDisabled(dates[0])) ||
61
+ false;
62
+ const inactive = !disabled && (weekStartInPrevMonth || weekStartInNextMonth);
63
+ const active = !disabled &&
64
+ !inactive &&
65
+ value &&
66
+ isWeekIncluded(dates[0], value, displayWeekDayLocale);
67
+ const inRange = !disabled && !inactive && isWeekInRange && isWeekInRange(dates[0]);
68
+ const onMouseEnter = onWeekHover
69
+ ? () => {
70
+ onWeekHover(getCurrentWeekFirstDate(dates[0], displayWeekDayLocale));
71
+ }
72
+ : undefined;
73
+ const onClick = onClickProp
74
+ ? () => {
75
+ onClickProp(getCurrentWeekFirstDate(dates[0], displayWeekDayLocale));
76
+ }
77
+ : undefined;
78
+ // Accessible week label for screen readers
79
+ const firstDate = new Date(dates[0]);
80
+ const lastDate = new Date(dates[dates.length - 1]);
81
+ const weekNum = getWeek(dates[0], displayWeekDayLocale);
82
+ const startMonth = firstDate.toLocaleDateString(displayWeekDayLocale, { month: 'short' });
83
+ const endMonth = lastDate.toLocaleDateString(displayWeekDayLocale, {
84
+ month: 'short',
85
+ });
86
+ const startDay = firstDate.getDate();
87
+ const endDay = lastDate.getDate();
88
+ const ariaLabel = [
89
+ `Week ${weekNum}`,
90
+ `${startMonth} ${startDay} to ${endMonth} ${endDay}`,
91
+ active && 'Selected',
92
+ disabled && 'Not available',
93
+ inactive && 'Outside current month',
94
+ ]
95
+ .filter(Boolean)
96
+ .join(', ');
97
+ return (jsx("button", { type: "button", className: cx(calendarClasses.button, calendarClasses.row, {
98
+ [calendarClasses.buttonActive]: active,
99
+ [calendarClasses.buttonInRange]: inRange,
100
+ [calendarClasses.buttonDisabled]: disabled,
101
+ }), disabled: disabled, "aria-disabled": disabled, "aria-label": ariaLabel, "aria-pressed": active, onClick: onClick, onMouseEnter: onMouseEnter, children: week.map((dateNum, dateIndex) => (jsx(CalendarCell, { today: isSameDate(dates[dateIndex], getNow()), disabled: disabled ||
102
+ !isInMonth(dates[dateIndex], getMonth(referenceDate)), active: active, children: dateNum }, `${getMonth(dates[dateIndex])}/${getDate(dates[dateIndex])}`))) }, `CALENDAR_WEEKS/WEEK_OF/${index}`));
103
+ })] })] }));
59
104
  }
60
105
 
61
106
  export { CalendarWeeks as default };
@@ -11,12 +11,12 @@ import cx from 'clsx';
11
11
  * You may use it to compose your own calendar.
12
12
  */
13
13
  function CalendarYears(props) {
14
- const { getNow, getYear, isYearIncluded, setYear } = useCalendarContext();
14
+ const { getNow, getYear, isYearIncluded, setYear, getCurrentYearFirstDate } = useCalendarContext();
15
15
  const { className, isYearDisabled, isYearInRange, onClick: onClickProp, onYearHover, referenceDate, value, ...rest } = props;
16
16
  const [start] = useMemo(() => getCalendarYearRange(getYear(referenceDate)), [getYear, referenceDate]);
17
17
  return (jsx("div", { className: cx(calendarClasses.board, className), ...rest, children: jsx("div", { className: calendarClasses.twelveGrid, children: calendarYearsBase.map((base) => {
18
18
  const thisYear = base + start;
19
- const yearDateType = setYear(getNow(), thisYear);
19
+ const yearDateType = setYear(getCurrentYearFirstDate(getNow()), thisYear);
20
20
  const disabled = isYearDisabled && isYearDisabled(yearDateType);
21
21
  const inactive = !disabled && (base === 0 || base === 11);
22
22
  const active = !disabled &&
@@ -34,7 +34,16 @@ function CalendarYears(props) {
34
34
  onYearHover(yearDateType);
35
35
  }
36
36
  : undefined;
37
- return (jsx("button", { type: "button", "aria-disabled": disabled, disabled: disabled, className: cx(calendarClasses.button, {
37
+ // Accessible year label for screen readers
38
+ const ariaLabel = [
39
+ `Year ${thisYear}`,
40
+ active && 'Selected',
41
+ disabled && 'Not available',
42
+ inactive && 'Outside range',
43
+ ]
44
+ .filter(Boolean)
45
+ .join(', ');
46
+ return (jsx("button", { type: "button", "aria-disabled": disabled, disabled: disabled, "aria-label": ariaLabel, "aria-pressed": active, className: cx(calendarClasses.button, {
38
47
  [calendarClasses.buttonActive]: active,
39
48
  [calendarClasses.buttonInRange]: inRange,
40
49
  [calendarClasses.buttonDisabled]: disabled,
@@ -0,0 +1,59 @@
1
+ import { CalendarMode, DateType } from '@mezzanine-ui/core/calendar';
2
+ import { RefObject } from 'react';
3
+ import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
4
+ import { CalendarProps } from './Calendar';
5
+ import { CalendarFooterActionsProps } from './CalendarFooterActions';
6
+ import { CalendarQuickSelectProps } from './CalendarQuickSelect';
7
+ export interface RangeCalendarProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'onChange' | 'children'>, Pick<CalendarProps, 'renderAnnotations' | 'isDateDisabled' | 'isDateInRange' | 'onDateHover' | 'displayWeekDayLocale' | 'isMonthDisabled' | 'isMonthInRange' | 'onMonthHover' | 'displayMonthLocale' | 'isWeekDisabled' | 'isWeekInRange' | 'onWeekHover' | 'isYearDisabled' | 'isYearInRange' | 'onYearHover' | 'isQuarterDisabled' | 'isQuarterInRange' | 'onQuarterHover' | 'isHalfYearDisabled' | 'isHalfYearInRange' | 'onHalfYearHover' | 'disabledMonthSwitch' | 'disabledYearSwitch' | 'disableOnNext' | 'disableOnPrev' | 'disableOnDoubleNext' | 'disableOnDoublePrev'> {
8
+ /**
9
+ * Footer action buttons props
10
+ */
11
+ actions?: CalendarFooterActionsProps['actions'];
12
+ /**
13
+ * Other props you may provide to each `Calendar`
14
+ */
15
+ calendarProps?: Omit<CalendarProps, 'mode' | 'value' | 'onChange' | 'referenceDate' | 'renderAnnotations' | 'onNext' | 'onPrev' | 'onDoubleNext' | 'onDoublePrev' | 'onMonthControlClick' | 'onYearControlClick'>;
16
+ /**
17
+ * React Ref for the first (left) calendar
18
+ */
19
+ firstCalendarRef?: RefObject<HTMLDivElement | null>;
20
+ /**
21
+ * Use this prop to switch calendars.
22
+ * @default 'day'
23
+ */
24
+ mode?: CalendarMode;
25
+ /**
26
+ * Click handler for every cell on calendars.
27
+ * When completing a range (second click), returns normalized [start, end].
28
+ * When starting a new range (first click), returns the clicked date.
29
+ * The normalization ensures start is beginning of period and end is end of period based on mode.
30
+ */
31
+ onChange?: (value: [DateType, DateType | undefined]) => void;
32
+ /**
33
+ * Quick select options for range calendar.
34
+ * Provide options for users to quickly select specific date ranges.
35
+ */
36
+ quickSelect?: Pick<CalendarQuickSelectProps, 'activeId' | 'options'>;
37
+ /**
38
+ * The reference date for getting the calendar.
39
+ * **The type of `referenceDate` should be the same as your declared `DateType`.**
40
+ */
41
+ referenceDate: DateType;
42
+ /**
43
+ * React Ref for the second (right) calendar
44
+ */
45
+ secondCalendarRef?: RefObject<HTMLDivElement | null>;
46
+ /**
47
+ * The displaying cells will be marked as active
48
+ * if the single value of it matches any date object in the array.
49
+ * **The type of `value` should be the same as your declared `DateType`.**
50
+ */
51
+ value?: DateType | DateType[];
52
+ }
53
+ /**
54
+ * The react component for `mezzanine` range calendar.
55
+ * Displays two calendars side by side for range selection.
56
+ * Notice that any component related to calendar should be used along with `CalendarContext`.
57
+ */
58
+ declare const RangeCalendar: import("react").ForwardRefExoticComponent<RangeCalendarProps & import("react").RefAttributes<HTMLDivElement>>;
59
+ export default RangeCalendar;