@mortenbrudvik/waveui 0.9.0 → 0.11.0

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 (264) hide show
  1. package/README.md +758 -152
  2. package/dist/components/button/Toolbar.cjs +1 -1
  3. package/dist/components/button/Toolbar.cjs.map +1 -1
  4. package/dist/components/button/Toolbar.mjs +25 -30
  5. package/dist/components/button/Toolbar.mjs.map +1 -1
  6. package/dist/components/button/Toolbar.navigation.cjs +2 -0
  7. package/dist/components/button/Toolbar.navigation.cjs.map +1 -0
  8. package/dist/components/button/Toolbar.navigation.mjs +17 -0
  9. package/dist/components/button/Toolbar.navigation.mjs.map +1 -0
  10. package/dist/components/data-display/Avatar.cjs +1 -1
  11. package/dist/components/data-display/Avatar.cjs.map +1 -1
  12. package/dist/components/data-display/Avatar.context.cjs +2 -0
  13. package/dist/components/data-display/Avatar.context.cjs.map +1 -0
  14. package/dist/components/data-display/Avatar.context.mjs +9 -0
  15. package/dist/components/data-display/Avatar.context.mjs.map +1 -0
  16. package/dist/components/data-display/Avatar.mjs +66 -61
  17. package/dist/components/data-display/Avatar.mjs.map +1 -1
  18. package/dist/components/data-display/InteractionTag.cjs +2 -0
  19. package/dist/components/data-display/InteractionTag.cjs.map +1 -0
  20. package/dist/components/data-display/InteractionTag.mjs +234 -0
  21. package/dist/components/data-display/InteractionTag.mjs.map +1 -0
  22. package/dist/components/data-display/Tag.cjs +1 -1
  23. package/dist/components/data-display/Tag.cjs.map +1 -1
  24. package/dist/components/data-display/Tag.mjs +222 -90
  25. package/dist/components/data-display/Tag.mjs.map +1 -1
  26. package/dist/components/data-display/TagGroup.cjs +2 -0
  27. package/dist/components/data-display/TagGroup.cjs.map +1 -0
  28. package/dist/components/data-display/TagGroup.context.cjs +2 -0
  29. package/dist/components/data-display/TagGroup.context.cjs.map +1 -0
  30. package/dist/components/data-display/TagGroup.context.mjs +113 -0
  31. package/dist/components/data-display/TagGroup.context.mjs.map +1 -0
  32. package/dist/components/data-display/TagGroup.mjs +149 -0
  33. package/dist/components/data-display/TagGroup.mjs.map +1 -0
  34. package/dist/components/data-display/tagStyles.cjs +2 -0
  35. package/dist/components/data-display/tagStyles.cjs.map +1 -0
  36. package/dist/components/data-display/tagStyles.mjs +108 -0
  37. package/dist/components/data-display/tagStyles.mjs.map +1 -0
  38. package/dist/components/feedback/Toaster.cjs +1 -1
  39. package/dist/components/feedback/Toaster.cjs.map +1 -1
  40. package/dist/components/feedback/Toaster.mjs +213 -181
  41. package/dist/components/feedback/Toaster.mjs.map +1 -1
  42. package/dist/components/input/Calendar.cjs +2 -0
  43. package/dist/components/input/Calendar.cjs.map +1 -0
  44. package/dist/components/input/Calendar.mjs +352 -0
  45. package/dist/components/input/Calendar.mjs.map +1 -0
  46. package/dist/components/input/Calendar.views.cjs +2 -0
  47. package/dist/components/input/Calendar.views.cjs.map +1 -0
  48. package/dist/components/input/Calendar.views.mjs +194 -0
  49. package/dist/components/input/Calendar.views.mjs.map +1 -0
  50. package/dist/components/input/ColorArea.cjs +1 -1
  51. package/dist/components/input/ColorArea.cjs.map +1 -1
  52. package/dist/components/input/ColorArea.mjs +18 -18
  53. package/dist/components/input/ColorArea.mjs.map +1 -1
  54. package/dist/components/input/Combobox.cjs +1 -1
  55. package/dist/components/input/Combobox.cjs.map +1 -1
  56. package/dist/components/input/Combobox.expand.cjs +1 -1
  57. package/dist/components/input/Combobox.expand.cjs.map +1 -1
  58. package/dist/components/input/Combobox.expand.mjs +7 -7
  59. package/dist/components/input/Combobox.expand.mjs.map +1 -1
  60. package/dist/components/input/Combobox.mjs +232 -156
  61. package/dist/components/input/Combobox.mjs.map +1 -1
  62. package/dist/components/input/Combobox.text.cjs +2 -0
  63. package/dist/components/input/Combobox.text.cjs.map +1 -0
  64. package/dist/components/input/Combobox.text.mjs +24 -0
  65. package/dist/components/input/Combobox.text.mjs.map +1 -0
  66. package/dist/components/input/DatePicker.cjs +1 -1
  67. package/dist/components/input/DatePicker.cjs.map +1 -1
  68. package/dist/components/input/DatePicker.mjs +203 -288
  69. package/dist/components/input/DatePicker.mjs.map +1 -1
  70. package/dist/components/input/Dropdown.cjs +1 -1
  71. package/dist/components/input/Dropdown.cjs.map +1 -1
  72. package/dist/components/input/Dropdown.mjs +135 -109
  73. package/dist/components/input/Dropdown.mjs.map +1 -1
  74. package/dist/components/input/Listbox.cjs +2 -0
  75. package/dist/components/input/Listbox.cjs.map +1 -0
  76. package/dist/components/input/Listbox.mjs +134 -0
  77. package/dist/components/input/Listbox.mjs.map +1 -0
  78. package/dist/components/input/Option.cjs +1 -1
  79. package/dist/components/input/Option.cjs.map +1 -1
  80. package/dist/components/input/Option.mjs +163 -97
  81. package/dist/components/input/Option.mjs.map +1 -1
  82. package/dist/components/input/SwatchPicker.cjs +1 -1
  83. package/dist/components/input/SwatchPicker.cjs.map +1 -1
  84. package/dist/components/input/SwatchPicker.context.cjs +2 -0
  85. package/dist/components/input/SwatchPicker.context.cjs.map +1 -0
  86. package/dist/components/input/SwatchPicker.context.mjs +35 -0
  87. package/dist/components/input/SwatchPicker.context.mjs.map +1 -0
  88. package/dist/components/input/SwatchPicker.mjs +131 -103
  89. package/dist/components/input/SwatchPicker.mjs.map +1 -1
  90. package/dist/components/input/SwatchPicker.swatches.cjs +2 -0
  91. package/dist/components/input/SwatchPicker.swatches.cjs.map +1 -0
  92. package/dist/components/input/SwatchPicker.swatches.mjs +207 -0
  93. package/dist/components/input/SwatchPicker.swatches.mjs.map +1 -0
  94. package/dist/components/input/TagPicker.cjs +1 -1
  95. package/dist/components/input/TagPicker.cjs.map +1 -1
  96. package/dist/components/input/TagPicker.context.cjs +2 -0
  97. package/dist/components/input/TagPicker.context.cjs.map +1 -0
  98. package/dist/components/input/TagPicker.context.mjs +20 -0
  99. package/dist/components/input/TagPicker.context.mjs.map +1 -0
  100. package/dist/components/input/TagPicker.create.cjs +2 -0
  101. package/dist/components/input/TagPicker.create.cjs.map +1 -0
  102. package/dist/components/input/TagPicker.create.mjs +24 -0
  103. package/dist/components/input/TagPicker.create.mjs.map +1 -0
  104. package/dist/components/input/TagPicker.mjs +13 -274
  105. package/dist/components/input/TagPicker.mjs.map +1 -1
  106. package/dist/components/input/TagPicker.option.cjs +2 -0
  107. package/dist/components/input/TagPicker.option.cjs.map +1 -0
  108. package/dist/components/input/TagPicker.option.mjs +45 -0
  109. package/dist/components/input/TagPicker.option.mjs.map +1 -0
  110. package/dist/components/input/TagPicker.overflow.cjs +2 -0
  111. package/dist/components/input/TagPicker.overflow.cjs.map +1 -0
  112. package/dist/components/input/TagPicker.overflow.mjs +153 -0
  113. package/dist/components/input/TagPicker.overflow.mjs.map +1 -0
  114. package/dist/components/input/TagPicker.parts.cjs +2 -0
  115. package/dist/components/input/TagPicker.parts.cjs.map +1 -0
  116. package/dist/components/input/TagPicker.parts.mjs +425 -0
  117. package/dist/components/input/TagPicker.parts.mjs.map +1 -0
  118. package/dist/components/input/TagPicker.root.cjs +2 -0
  119. package/dist/components/input/TagPicker.root.cjs.map +1 -0
  120. package/dist/components/input/TagPicker.root.mjs +416 -0
  121. package/dist/components/input/TagPicker.root.mjs.map +1 -0
  122. package/dist/components/input/TimePicker.cjs +1 -1
  123. package/dist/components/input/TimePicker.cjs.map +1 -1
  124. package/dist/components/input/TimePicker.mjs +77 -77
  125. package/dist/components/input/TimePicker.mjs.map +1 -1
  126. package/dist/components/input/dateUtils.cjs +1 -1
  127. package/dist/components/input/dateUtils.cjs.map +1 -1
  128. package/dist/components/input/dateUtils.mjs +114 -96
  129. package/dist/components/input/dateUtils.mjs.map +1 -1
  130. package/dist/components/input/pickerLabels.cjs +2 -0
  131. package/dist/components/input/pickerLabels.cjs.map +1 -0
  132. package/dist/components/input/pickerLabels.mjs +16 -0
  133. package/dist/components/input/pickerLabels.mjs.map +1 -0
  134. package/dist/components/input/pickerValues.cjs +2 -0
  135. package/dist/components/input/pickerValues.cjs.map +1 -0
  136. package/dist/components/input/pickerValues.mjs +24 -0
  137. package/dist/components/input/pickerValues.mjs.map +1 -0
  138. package/dist/components/layout/Accordion.cjs.map +1 -1
  139. package/dist/components/layout/Accordion.mjs.map +1 -1
  140. package/dist/components/navigation/Hamburger.cjs +2 -0
  141. package/dist/components/navigation/Hamburger.cjs.map +1 -0
  142. package/dist/components/navigation/Hamburger.mjs +54 -0
  143. package/dist/components/navigation/Hamburger.mjs.map +1 -0
  144. package/dist/components/navigation/Nav.cjs +1 -1
  145. package/dist/components/navigation/Nav.cjs.map +1 -1
  146. package/dist/components/navigation/Nav.context.cjs +2 -0
  147. package/dist/components/navigation/Nav.context.cjs.map +1 -0
  148. package/dist/components/navigation/Nav.context.mjs +137 -0
  149. package/dist/components/navigation/Nav.context.mjs.map +1 -0
  150. package/dist/components/navigation/Nav.mjs +151 -258
  151. package/dist/components/navigation/Nav.mjs.map +1 -1
  152. package/dist/components/navigation/Nav.parts.cjs +2 -0
  153. package/dist/components/navigation/Nav.parts.cjs.map +1 -0
  154. package/dist/components/navigation/Nav.parts.mjs +77 -0
  155. package/dist/components/navigation/Nav.parts.mjs.map +1 -0
  156. package/dist/components/navigation/Nav.root.cjs +2 -0
  157. package/dist/components/navigation/Nav.root.cjs.map +1 -0
  158. package/dist/components/navigation/Nav.root.mjs +78 -0
  159. package/dist/components/navigation/Nav.root.mjs.map +1 -0
  160. package/dist/components/navigation/NavDrawer.cjs +2 -0
  161. package/dist/components/navigation/NavDrawer.cjs.map +1 -0
  162. package/dist/components/navigation/NavDrawer.context.cjs +2 -0
  163. package/dist/components/navigation/NavDrawer.context.cjs.map +1 -0
  164. package/dist/components/navigation/NavDrawer.context.mjs +11 -0
  165. package/dist/components/navigation/NavDrawer.context.mjs.map +1 -0
  166. package/dist/components/navigation/NavDrawer.mjs +179 -0
  167. package/dist/components/navigation/NavDrawer.mjs.map +1 -0
  168. package/dist/components/overlays/Dialog.cjs +1 -1
  169. package/dist/components/overlays/Dialog.cjs.map +1 -1
  170. package/dist/components/overlays/Dialog.mjs +190 -125
  171. package/dist/components/overlays/Dialog.mjs.map +1 -1
  172. package/dist/components/overlays/Dialog.shared.cjs +1 -1
  173. package/dist/components/overlays/Dialog.shared.cjs.map +1 -1
  174. package/dist/components/overlays/Dialog.shared.mjs +157 -81
  175. package/dist/components/overlays/Dialog.shared.mjs.map +1 -1
  176. package/dist/components/overlays/Dialog.slots.cjs +2 -0
  177. package/dist/components/overlays/Dialog.slots.cjs.map +1 -0
  178. package/dist/components/overlays/Dialog.slots.mjs +129 -0
  179. package/dist/components/overlays/Dialog.slots.mjs.map +1 -0
  180. package/dist/components/overlays/Drawer.cjs +1 -1
  181. package/dist/components/overlays/Drawer.cjs.map +1 -1
  182. package/dist/components/overlays/Drawer.context.cjs +2 -0
  183. package/dist/components/overlays/Drawer.context.cjs.map +1 -0
  184. package/dist/components/overlays/Drawer.context.mjs +29 -0
  185. package/dist/components/overlays/Drawer.context.mjs.map +1 -0
  186. package/dist/components/overlays/Drawer.mjs +12 -187
  187. package/dist/components/overlays/Drawer.mjs.map +1 -1
  188. package/dist/components/overlays/Drawer.panel.cjs +2 -0
  189. package/dist/components/overlays/Drawer.panel.cjs.map +1 -0
  190. package/dist/components/overlays/Drawer.panel.mjs +159 -0
  191. package/dist/components/overlays/Drawer.panel.mjs.map +1 -0
  192. package/dist/components/overlays/Drawer.parts.cjs +2 -0
  193. package/dist/components/overlays/Drawer.parts.cjs.map +1 -0
  194. package/dist/components/overlays/Drawer.parts.mjs +152 -0
  195. package/dist/components/overlays/Drawer.parts.mjs.map +1 -0
  196. package/dist/components/overlays/Drawer.root.cjs +2 -0
  197. package/dist/components/overlays/Drawer.root.cjs.map +1 -0
  198. package/dist/components/overlays/Drawer.root.mjs +207 -0
  199. package/dist/components/overlays/Drawer.root.mjs.map +1 -0
  200. package/dist/components/overlays/Drawer.scroll.cjs +2 -0
  201. package/dist/components/overlays/Drawer.scroll.cjs.map +1 -0
  202. package/dist/components/overlays/Drawer.scroll.mjs +42 -0
  203. package/dist/components/overlays/Drawer.scroll.mjs.map +1 -0
  204. package/dist/components/table/useGridNavigation.cjs +1 -1
  205. package/dist/components/table/useGridNavigation.cjs.map +1 -1
  206. package/dist/components/table/useGridNavigation.mjs +67 -70
  207. package/dist/components/table/useGridNavigation.mjs.map +1 -1
  208. package/dist/hooks/useActiveDescendant.cjs +2 -0
  209. package/dist/hooks/useActiveDescendant.cjs.map +1 -0
  210. package/dist/hooks/useActiveDescendant.mjs +56 -0
  211. package/dist/hooks/useActiveDescendant.mjs.map +1 -0
  212. package/dist/hooks/useDismiss.cjs.map +1 -1
  213. package/dist/hooks/useDismiss.mjs.map +1 -1
  214. package/dist/hooks/useFocusTrap.cjs +1 -1
  215. package/dist/hooks/useFocusTrap.cjs.map +1 -1
  216. package/dist/hooks/useFocusTrap.mjs +115 -98
  217. package/dist/hooks/useFocusTrap.mjs.map +1 -1
  218. package/dist/hooks/useListbox.cjs +1 -1
  219. package/dist/hooks/useListbox.cjs.map +1 -1
  220. package/dist/hooks/useListbox.mjs +250 -210
  221. package/dist/hooks/useListbox.mjs.map +1 -1
  222. package/dist/hooks/useModalLayer.cjs +1 -1
  223. package/dist/hooks/useModalLayer.cjs.map +1 -1
  224. package/dist/hooks/useModalLayer.mjs +35 -22
  225. package/dist/hooks/useModalLayer.mjs.map +1 -1
  226. package/dist/hooks/useRestoreFocus.cjs +1 -1
  227. package/dist/hooks/useRestoreFocus.cjs.map +1 -1
  228. package/dist/hooks/useRestoreFocus.mjs +91 -78
  229. package/dist/hooks/useRestoreFocus.mjs.map +1 -1
  230. package/dist/hooks/useRovingGrid.cjs +2 -0
  231. package/dist/hooks/useRovingGrid.cjs.map +1 -0
  232. package/dist/hooks/useRovingGrid.mjs +69 -0
  233. package/dist/hooks/useRovingGrid.mjs.map +1 -0
  234. package/dist/hooks/useRovingTabIndex.cjs +1 -1
  235. package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
  236. package/dist/hooks/useRovingTabIndex.mjs +102 -78
  237. package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
  238. package/dist/index.cjs +1 -1
  239. package/dist/index.d.cts +4391 -394
  240. package/dist/index.d.ts +4391 -394
  241. package/dist/index.mjs +115 -101
  242. package/dist/lib/classNames.cjs +1 -1
  243. package/dist/lib/classNames.cjs.map +1 -1
  244. package/dist/lib/classNames.mjs +170 -74
  245. package/dist/lib/classNames.mjs.map +1 -1
  246. package/dist/lib/date.cjs +2 -0
  247. package/dist/lib/date.cjs.map +1 -0
  248. package/dist/lib/date.mjs +44 -0
  249. package/dist/lib/date.mjs.map +1 -0
  250. package/dist/lib/focus.cjs +1 -1
  251. package/dist/lib/focus.cjs.map +1 -1
  252. package/dist/lib/focus.mjs +5 -2
  253. package/dist/lib/focus.mjs.map +1 -1
  254. package/dist/lib/icons.cjs +1 -1
  255. package/dist/lib/icons.cjs.map +1 -1
  256. package/dist/lib/icons.mjs +13 -6
  257. package/dist/lib/icons.mjs.map +1 -1
  258. package/dist/lib/layers.cjs +1 -1
  259. package/dist/lib/layers.cjs.map +1 -1
  260. package/dist/lib/layers.mjs +53 -47
  261. package/dist/lib/layers.mjs.map +1 -1
  262. package/dist/styles.css +1 -1
  263. package/package.json +1 -1
  264. package/src/styles/tokens.css +25 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Calendar.mjs","names":["useId","_Fragment","useId$1","React","NAV_BUTTON_CLASSES","HEADING_BUTTON_CLASSES","FOOTER_BUTTON_CLASSES","DEFAULT_WORK_WEEK_DAYS","toWeeks","weeks","i","days","inDecadeGrid","year","decade","clampYear","min","max","CalendarView","todayProp","Heading","today","startOfDay","viewState","setView","view","showMonthPicker","viewMonth","setViewMonth","startOfMonth","clampDate","value","initialVisibleDate","minDate","maxDate","focusedDay","setFocusedDay","monthViewYear","setMonthViewYear","focusedMonth","setFocusedMonth","setDecade","getDecadeStart","focusedYear","setFocusedYear","gridRef","focusGridRef","focusRequest","setFocusRequest","gridId","hintId","valueIso","formatISODate","seenValueIso","setSeenValueIso","isSameMonth","isUnavailable","isDayUnavailable","date","disabledDates","selectedDays","getSelectionRange","selectionRange","firstDayOfWeek","workWeekDays","getCalendarDays","inView","inGrid","clampedToday","firstInRange","focusTarget","focusIso","moveFocus","target","next","navigateMonth","nextView","addMonths","delta","moved","handleDayFocus","isSameDay","day","minMonth","maxMonth","clampMonth","month","inMonthView","firstMonthInRange","makeDate","monthTarget","moveMonthFocus","navigateYear","nextYear","firstYearInRange","yearTarget","moveYearFocus","preferredDecade","navigateDecade","nextDecade","changeView","goToToday","request","showMonths","showYears","pickMonth","monthsAway","pickYear","yearDate","handleEscape","event","isOwnEvent","periodKey","cellKey","headerRef","viewHadFocusRef","onFocusIn","previousViewRef","viewChanged","requested","grid","active","lost","button","previousLabel","nextLabel","previousDisabled","nextDisabled","navigate","headingText","labels","addDays","formatMonthYear","locale","isYearOutOfRange","formatYear","formatDecade","todayOutOfRange","isDateInRange","headingButtonTarget","hint","CalendarDayGrid","months","getYearMonths","CalendarPickerGrid","formatMonthShort","isMonthOutOfRange","direction","partClassNames","years","getDecadeYears","Fragment","cn","focusableDisabledProps","preventIfDisabled","focusRing","disabledStyles","ChevronLeftIcon","headingId","ChevronRightIcon","showGoToToday","onClose","closeLabel","CALENDAR_PART_CLASS_NAMES","calendarClassNames","Calendar","valueProp","ariaLabel","ariaLabelledBy","ariaDescribedBy","ariaInvalid","ariaRequired","rest","setValue","useControllable","defaultValue","onValueChange","commit","normalized","isClient","useIsClient","isValidLocaleTag","warnOnce","hasDate","field","useFieldContext","fieldAriaRequired","fieldDescribedBy","fieldProps","useFieldControl","required","isRequired","requiredHintId","showRequiredHint","rootRef","mergedRef","useMergedRefs","ref","form","focusTabStop","joinIds","className","HiddenInput"],"sources":["../../../src/components/input/Calendar.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { DayOfWeek, FirstWeekOfYear } from '../../lib/types';\nimport { cn } from '../../lib/cn';\nimport { focusableDisabledProps, joinIds, preventIfDisabled } from '../../lib/aria';\nimport { calendarClassNames } from '../../lib/classNames';\nimport { warnOnce } from '../../lib/dev';\nimport { isOwnEvent } from '../../lib/events';\nimport { ChevronLeftIcon, ChevronRightIcon } from '../../lib/icons';\nimport { disabledStyles, focusRing } from '../../lib/styles';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useFieldContext, useFieldControl } from '../../hooks/useFieldControl';\nimport { useFormReset } from '../../hooks/useFormReset';\nimport { useId } from '../../hooks/useId';\nimport { useIsClient } from '../../hooks/useIsClient';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { HiddenInput } from '../internal/HiddenInput';\nimport { makeDate } from '../../lib/date';\nimport {\n CalendarDayGrid,\n CalendarPickerGrid,\n type CalendarDayGridPartClassNames,\n} from './Calendar.views';\nimport {\n addDays,\n addMonths,\n clampDate,\n formatDecade,\n formatISODate,\n formatMonthShort,\n formatMonthYear,\n formatYear,\n getCalendarDays,\n getDecadeStart,\n getDecadeYears,\n getSelectionRange,\n getYearMonths,\n isDateInRange,\n isDayUnavailable,\n isMonthOutOfRange,\n isSameDay,\n isSameMonth,\n isValidLocaleTag,\n isYearOutOfRange,\n startOfDay,\n startOfMonth,\n type CalendarSelectionRange,\n} from './dateUtils';\n\n/**\n * The built-in texts of the calendar, for localization: the names of the navigation buttons in\n * the day, month and year views, the hints of the heading button, the \"Go to today\" button, the\n * week-number column and the marked days, and (Calendar only) the required hint. Each member is\n * optional and falls back to its English default. Month and weekday names and the day labels follow\n * `locale`. DatePicker's labels extend this type.\n */\nexport interface CalendarLabels {\n /** Name of the previous-month button.\n * @default 'Previous month'\n */\n previousMonth?: string;\n /** Name of the next-month button.\n * @default 'Next month'\n */\n nextMonth?: string;\n /** Name of the previous-year button of the month view.\n * @default 'Previous year'\n */\n previousYear?: string;\n /** Name of the next-year button of the month view.\n * @default 'Next year'\n */\n nextYear?: string;\n /** Name of the previous-decade button of the year view.\n * @default 'Previous decade'\n */\n previousDecade?: string;\n /** Name of the next-decade button of the year view.\n * @default 'Next decade'\n */\n nextDecade?: string;\n /** Description of the heading button that shows the month view.\n * @default 'Choose a month'\n */\n chooseMonth?: string;\n /** Description of the heading button that shows the year view.\n * @default 'Choose a year'\n */\n chooseYear?: string;\n /** Name of the \"Go to today\" button.\n * @default 'Go to today'\n */\n goToToday?: string;\n /** Hidden text of the week-number column header.\n * @default 'Week'\n */\n week?: string;\n /** Name of a week-number row header.\n * @default (week) => `Week ${week}`\n */\n weekNumber?: (week: number) => string;\n /** Name of a marked day, built from its default name.\n * @default (dayLabel) => `${dayLabel}, marked`\n */\n markedDay?: (dayLabel: string) => string;\n /**\n * Said in the calendar's description while it is required (`required`, a required Field, or a\n * consumer `aria-required` alone), since its role cannot carry `aria-required`.\n * @default 'Required'\n */\n required?: string;\n}\n\n/** Second argument of `Calendar`'s `onValueChange`. */\nexport interface CalendarValueChangeDetails {\n /**\n * The selected days in order (local midnight): the picked day, or with `selectionRange` its\n * week, work week or month (the days that are not available left out); `[]` for `null`.\n */\n range: Date[];\n}\n\n/** Properties for the Calendar component. */\nexport interface CalendarProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue'\n> {\n /** Controlled selected day (`null` for none). */\n value?: Date | null;\n /**\n * Initial selected day for uncontrolled usage.\n * @default null\n */\n defaultValue?: Date | null;\n /**\n * Called with the new day (local midnight) when the selected day changes: a pick of another day\n * or a form reset (Fluent's `onSelectDate` fires on every pick). Picking the selected day again\n * does nothing. WaveUI always passes `details`.\n */\n onValueChange?: (date: Date | null, details?: CalendarValueChangeDetails) => void;\n /** Earliest available day (the whole day is included). */\n minDate?: Date;\n /** Latest available day (the whole day is included). */\n maxDate?: Date;\n /** Returns `true` for days that cannot be picked (called with local-midnight dates). */\n disabledDates?: (date: Date) => boolean;\n /**\n * First day of the week (0 = Sunday, 1 = Monday, etc.).\n * @default 0\n */\n firstDayOfWeek?: DayOfWeek;\n /**\n * BCP 47 locale of the month text, the weekday names and the day labels. Pass it when rendering\n * on the server, so the server and the browser render the same text. The grid is Gregorian, as\n * in DatePicker. A tag `Intl` rejects (the POSIX `de_DE`, a typo) falls back to the runtime\n * default locale (development warning).\n * @default the runtime default locale\n */\n locale?: string;\n /**\n * The day marked as today (`aria-current=\"date\"`), and the tab stop when no day is selected in\n * the shown month. Without it, the server HTML and the hydration render mark no day and the\n * browser applies the current date once hydrated: pass it when rendering on the server, so the\n * mark is in the HTML.\n * @default the current date (applied after hydration when not passed)\n */\n today?: Date;\n /**\n * The month shown first when there is no value (Fluent's `initialPickerDate`), clamped into\n * `minDate`/`maxDate` like the value's month and today's.\n * @default today's month\n */\n initialVisibleDate?: Date;\n /**\n * Turns the month text into a button that shows the month view (the 12 months of the year),\n * whose heading, the year, is a button to the year view (a decade with the year before and\n * after it). A picked year shows its months and a picked month its days; Escape goes back a\n * level to the period shown before. Fluent's `isMonthPickerVisible`, here as a drill-down in one\n * pane.\n * @default true\n */\n showMonthPicker?: boolean;\n /**\n * Adds a leading column of week numbers: a row header per week (`Week 23`, from\n * `labels.weekNumber`) under a header cell named `labels.week`. The numbers follow\n * `firstDayOfWeek` and `firstWeekOfYear`; the column is not focusable and the keys skip it.\n * @default false\n */\n showWeekNumbers?: boolean;\n /**\n * Which week is week 1 of a year. ISO 8601 is `'first-four-day-week'` with `firstDayOfWeek={1}`.\n * @default 'first-day'\n */\n firstWeekOfYear?: FirstWeekOfYear;\n /**\n * Adds a footer button that shows today's month in the day view and focuses today without\n * selecting it. It is disabled while today is outside `minDate`/`maxDate`.\n * @default false\n */\n showGoToToday?: boolean;\n /**\n * Days that draw a dot under the number (in the text colour of the day) and say \"marked\" in\n * their name (`labels.markedDay`); also `data-marked` on the day's button (Fluent's\n * `getMarkedDays`). Called with local-midnight dates.\n */\n markedDates?: (date: Date) => boolean;\n /**\n * Replaces the content inside a day's button, which keeps its role, state and keys;\n * `defaultContent` is the day number. The content must be non-interactive (no buttons or links),\n * and the button's name does not follow it: set the name with `dayLabel`. The marked-day dot is\n * drawn next to the content.\n */\n renderDay?: (date: Date, defaultContent: React.ReactNode) => React.ReactNode;\n /**\n * The accessible name of a day, from its default name (the date in words, `Monday, June 2,\n * 2025`, with `labels.markedDay` applied for a marked day). Use it to say what `renderDay` shows.\n */\n dayLabel?: (date: Date, defaultLabel: string) => string;\n /**\n * What a pick selects: the day, or its week, work week (`workWeekDays`) or month. The value is\n * the picked day, `details.range` the selected days, and every day of the range is\n * `aria-selected`, `aria-pressed` and `data-selected`. Days that are not available are left\n * out. Fluent's `dateRangeType`.\n * @default 'day'\n */\n selectionRange?: CalendarSelectionRange;\n /**\n * The days of `selectionRange=\"work-week\"` (0 = Sunday), within the week that starts on\n * `firstDayOfWeek`.\n * @default [1, 2, 3, 4, 5]\n */\n workWeekDays?: readonly DayOfWeek[];\n /**\n * Names of the navigation buttons, the heading button's hints, the \"Go to today\" button, the\n * week-number column, the marked days and the required hint, for localization.\n */\n labels?: CalendarLabels;\n /** Form field name: the day is submitted as ISO `yyyy-mm-dd` (hidden input). */\n name?: string;\n /** Id of the `<form>` the value belongs to, when the calendar is outside it. */\n form?: string;\n /**\n * Blocks form submission while no day is selected; the form's report focuses the calendar's\n * tab stop. Said in the description (`labels.required`), as the group cannot carry\n * `aria-required`. A consumer `aria-required` alone also shows that hint (assistive technology\n * only: it does not block submission).\n */\n required?: boolean;\n /** Ref to the root element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * Internal: the stable classes of a calendar view's parts, passed in by the component that\n * renders the view (DatePicker passes its own).\n */\nexport interface CalendarViewPartClassNames extends CalendarDayGridPartClassNames {\n /** On the row of the navigation buttons and the heading. */\n header?: string;\n /** On the previous button (previous month, year or decade). */\n previousMonthButton?: string;\n /** On the heading (the month, the year or the decade). */\n heading?: string;\n /** On the heading's button, which shows the month or the year view. */\n headingButton?: string;\n /** On the next button (next month, year or decade). */\n nextMonthButton?: string;\n /** On each month button of the month view. */\n month?: string;\n /** On each year button of the year view. */\n year?: string;\n /** On the row of the footer buttons. */\n footer?: string;\n /** On the \"Go to today\" button. */\n todayButton?: string;\n /** On the \"Close\" button. */\n closeButton?: string;\n}\n\n/** Internal props of {@link CalendarView}. */\nexport interface CalendarViewProps {\n /** The selected day, or `null` for none. */\n value: Date | null;\n /** Called with an available day the user picks (click, Enter or Space on a day button). */\n onPick: (date: Date) => void;\n /** Earliest available day (the whole day is included). */\n minDate?: Date;\n /** Latest available day (the whole day is included). */\n maxDate?: Date;\n /** Returns `true` for days that cannot be picked (called with local-midnight dates). */\n disabledDates?: (date: Date) => boolean;\n /** First day of the week (0 = Sunday). */\n firstDayOfWeek: DayOfWeek;\n /** BCP 47 locale of the heading, the weekday names and the day labels. */\n locale?: string;\n /**\n * The day marked as today; `null` while it is unknown (the server HTML and the hydration render\n * of a Calendar without `today`): no day is marked, and the tab stop skips today.\n * @default the current date\n */\n today?: Date | null;\n /** The month shown first when there is no value (else today's, else the clock's). */\n initialVisibleDate?: Date;\n /**\n * The heading is a button that shows the month view, whose heading shows the year view.\n * @default true\n */\n showMonthPicker?: boolean;\n /** Adds a leading column of week numbers to the day view. @default false */\n showWeekNumbers?: boolean;\n /** Which week is week 1 of a year. @default 'first-day' */\n firstWeekOfYear?: FirstWeekOfYear;\n /** Returns `true` for days that draw a dot and are named \"marked\". */\n markedDates?: (date: Date) => boolean;\n /** Replaces the content of a day button. */\n renderDay?: (date: Date, defaultContent: React.ReactNode) => React.ReactNode;\n /** The accessible name of a day, from its default name. */\n dayLabel?: (date: Date, defaultLabel: string) => string;\n /**\n * What a pick selects (the day, or its week, work week or month): the days drawn selected. The\n * parent receives only the picked day.\n * @default 'day'\n */\n selectionRange?: CalendarSelectionRange;\n /** The days of the `'work-week'` range. @default [1, 2, 3, 4, 5] */\n workWeekDays?: readonly DayOfWeek[];\n /** Adds a footer button that shows today's month and focuses today. @default false */\n showGoToToday?: boolean;\n /** Adds a footer \"Close\" button that calls this (DatePicker closes its dialog). */\n onClose?: () => void;\n /** Name of the \"Close\" button. @default 'Close' */\n closeLabel?: string;\n /** Names of the navigation buttons, the heading button's hints and the footer buttons. */\n labels?: CalendarLabels;\n /** Element of the heading: `h2` in DatePicker's dialog (its title), else `div`. */\n headingAs: 'h2' | 'div';\n /** Id of the heading (it labels the grid; DatePicker also labels its dialog with it). */\n headingId: string;\n /** Stable classes of the view's parts. */\n partClassNames?: CalendarViewPartClassNames;\n}\n\n// Every button sets its own padding and background (C-NATIVE): an app-wide `button` rule would\n// otherwise pad and fill them.\nconst NAV_BUTTON_CLASSES =\n 'flex h-8 w-8 items-center justify-center rounded bg-transparent p-0 text-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover';\n\n// The heading's button keeps the heading's text style, set on itself (C-NATIVE).\nconst HEADING_BUTTON_CLASSES =\n 'flex h-8 items-center justify-center rounded bg-transparent p-0 px-2 text-body-1 font-semibold text-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover';\n\n// The footer's text buttons (C-NATIVE: their own padding and background).\nconst FOOTER_BUTTON_CLASSES =\n 'flex h-8 items-center justify-center rounded bg-transparent p-0 px-3 text-body-1 text-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover';\n\n/** The days of `'work-week'` unless `workWeekDays` says otherwise (Monday to Friday). */\nconst DEFAULT_WORK_WEEK_DAYS: readonly DayOfWeek[] = [1, 2, 3, 4, 5];\n\n/** The 42 grid days as 6 weeks. */\nfunction toWeeks(days: Date[]): Date[][] {\n const weeks: Date[][] = [];\n for (let i = 0; i < days.length; i += 7) weeks.push(days.slice(i, i + 7));\n return weeks;\n}\n\n/** The years of the year view of the decade starting at `decade` (the year before and after it). */\nfunction inDecadeGrid(year: number, decade: number): boolean {\n return year >= decade - 1 && year <= decade + 10;\n}\n\n/** `year` clamped into the years of `[min, max]` (as `clampDate` clamps a day). */\nfunction clampYear(year: number, min?: Date, max?: Date): number {\n if (min && year < min.getFullYear()) return min.getFullYear();\n if (max && year > max.getFullYear()) return max.getFullYear();\n return year;\n}\n\n/** Which grid a calendar view shows. */\ntype CalendarViewKind = 'day' | 'month' | 'year';\n\n/**\n * Internal: the header (the previous button, the heading, the next button), the grid and the\n * optional footer (Go to today, Close) of a calendar, in one of three views: the days of a month, the months of a year (the month view) and\n * the years of a decade (the year view). It renders no element of its own (a fragment). It opens\n * on the day view of the month of `value`, else `initialVisibleDate`'s, else today's, clamped into\n * `minDate`/`maxDate`, and keeps that month until navigated or until `value` changes to a day of\n * another month, whose month it then shows (DatePicker mounts it with each opening of its dialog).\n *\n * With `showMonthPicker`, the day view's heading is a button to the month view, and the month\n * view's heading a button to the year view; a picked year shows its months and a picked month its\n * days. Escape in the year and month views goes back one level to the period shown before (and is\n * consumed, also on the footer's buttons). Each view change moves focus into the new grid in the\n * same commit. The day view can add a week-number column, a dot and a name suffix for marked\n * days, custom day content, and a range around the picked day (`selectionRange`); the footer has\n * \"Go to today\" (`showGoToToday`) and a Close button (`onClose`).\n */\nexport const CalendarView = ({\n value,\n onPick,\n minDate,\n maxDate,\n disabledDates,\n firstDayOfWeek,\n locale,\n today: todayProp,\n initialVisibleDate,\n showMonthPicker = true,\n showWeekNumbers,\n firstWeekOfYear,\n markedDates,\n renderDay,\n dayLabel,\n selectionRange = 'day',\n workWeekDays = DEFAULT_WORK_WEEK_DAYS,\n showGoToToday = false,\n onClose,\n closeLabel,\n labels,\n headingAs: Heading,\n headingId,\n partClassNames,\n}: CalendarViewProps) => {\n const today =\n todayProp === undefined ? startOfDay(new Date()) : todayProp && startOfDay(todayProp);\n const [viewState, setView] = React.useState<CalendarViewKind>('day');\n // Without the month picker the headings are no buttons: only the day view exists.\n const view = showMonthPicker ? viewState : 'day';\n if (viewState !== view) setView(view);\n // Day view: the shown month and the day moved to.\n const [viewMonth, setViewMonth] = React.useState<Date>(() =>\n // Without a value, an `initialVisibleDate` or a known today the month comes from the clock:\n // on the server, the server's (the Calendar warns after such a hydration render).\n startOfMonth(clampDate(value ?? initialVisibleDate ?? today ?? new Date(), minDate, maxDate)),\n );\n const [focusedDay, setFocusedDay] = React.useState<Date | null>(null);\n // Month view: the shown year and the month moved to. Year view: the first year of the shown\n // decade and the year moved to. Each view keeps its state while a higher view is shown, so\n // Escape shows the period it showed before.\n const [monthViewYear, setMonthViewYear] = React.useState(() => viewMonth.getFullYear());\n const [focusedMonth, setFocusedMonth] = React.useState<Date | null>(null);\n const [decade, setDecade] = React.useState(() => getDecadeStart(viewMonth.getFullYear()));\n const [focusedYear, setFocusedYear] = React.useState<number | null>(null);\n const gridRef = React.useRef<HTMLTableElement | null>(null);\n /** Set by a view change: the next layout effect moves focus into the new grid. */\n const focusGridRef = React.useRef(false);\n /** Bumped by \"Go to today\": the next layout effect moves focus to the focused day. */\n const [focusRequest, setFocusRequest] = React.useState(0);\n const gridId = useId('calendar-grid');\n const hintId = useId('calendar-heading-hint');\n\n // A value that changes to a day of another month shows that month (adjusted during render,\n // C-HOOKS): a controlled value set by the parent, a form reset, or a picked day of the next\n // month.\n const valueIso = value ? formatISODate(value) : '';\n const [seenValueIso, setSeenValueIso] = React.useState(valueIso);\n if (seenValueIso !== valueIso) {\n setSeenValueIso(valueIso);\n if (value) {\n if (!isSameMonth(value, viewMonth)) {\n setViewMonth(startOfMonth(clampDate(value, minDate, maxDate)));\n setFocusedDay(null);\n }\n // The month and year views follow the value too, to its year and its decade.\n const year = clampYear(value.getFullYear(), minDate, maxDate);\n setMonthViewYear(year);\n setFocusedMonth(null);\n setDecade(getDecadeStart(year));\n setFocusedYear(null);\n }\n }\n\n const isUnavailable = (date: Date) => isDayUnavailable(date, minDate, maxDate, disabledDates);\n\n // The days drawn selected: the range around the value (its available days).\n const selectedDays = new Set(\n value\n ? getSelectionRange(value, selectionRange, firstDayOfWeek, workWeekDays, isUnavailable).map(\n formatISODate,\n )\n : [],\n );\n\n const weeks = React.useMemo(\n () => toWeeks(getCalendarDays(viewMonth, firstDayOfWeek)),\n [viewMonth, firstDayOfWeek],\n );\n\n /* ---- day view ----------------------------------------------------- */\n\n // The focused day is derived: the day moved to while it is shown (a pointer-focused day of the\n // previous/next month counts too), else the selected day of the month, else today (clamped into\n // the range; skipped while today is unknown), else the first day of the month in range (it may\n // be unavailable: unavailable days are focusable).\n const inView = (date: Date | null | undefined): date is Date =>\n !!date && isSameMonth(date, viewMonth);\n const inGrid = (date: Date | null | undefined): date is Date =>\n !!date && date >= weeks[0][0] && date <= weeks[weeks.length - 1][6];\n const clampedToday = today && clampDate(today, minDate, maxDate);\n const firstInRange = clampDate(viewMonth, minDate, maxDate);\n const focusTarget = inGrid(focusedDay)\n ? focusedDay\n : inView(value)\n ? startOfDay(value)\n : inView(clampedToday)\n ? clampedToday\n : inView(firstInRange)\n ? firstInRange\n : viewMonth;\n const focusIso = formatISODate(focusTarget);\n\n const moveFocus = (next: Date) => {\n const target = clampDate(next, minDate, maxDate);\n setFocusedDay(target);\n if (!isSameMonth(target, viewMonth)) setViewMonth(startOfMonth(target));\n };\n\n const navigateMonth = (delta: number) => {\n const nextView = addMonths(viewMonth, delta);\n const moved = clampDate(addMonths(focusTarget, delta), minDate, maxDate);\n setViewMonth(nextView);\n // From a day of the previous/next month the moved day may fall outside the new month: the\n // focused day is then derived again (selected, today or the first day of the month).\n setFocusedDay(isSameMonth(moved, nextView) ? moved : null);\n };\n\n /** Pointer (or assistive technology) focus on a day makes it the roving day; the month stays. */\n const handleDayFocus = (day: Date) => {\n if (!isSameDay(day, focusTarget)) setFocusedDay(day);\n };\n\n /* ---- month view --------------------------------------------------- */\n\n const minMonth = minDate && startOfMonth(minDate);\n const maxMonth = maxDate && startOfMonth(maxDate);\n const clampMonth = (month: Date) => clampDate(startOfMonth(month), minMonth, maxMonth);\n const inMonthView = (date: Date | null | undefined): date is Date =>\n !!date && date.getFullYear() === monthViewYear;\n const firstMonthInRange = clampMonth(makeDate(monthViewYear, 0, 1));\n const monthTarget = inMonthView(focusedMonth)\n ? focusedMonth\n : inMonthView(value)\n ? startOfMonth(value)\n : inMonthView(clampedToday)\n ? startOfMonth(clampedToday)\n : inMonthView(firstMonthInRange)\n ? firstMonthInRange\n : makeDate(monthViewYear, 0, 1);\n\n /** A key moves the focused month; the shown year follows it. */\n const moveMonthFocus = (next: Date) => {\n const target = clampMonth(next);\n setFocusedMonth(target);\n setMonthViewYear(target.getFullYear());\n };\n\n const navigateYear = (delta: number) => {\n const nextYear = monthViewYear + delta;\n const moved = clampMonth(addMonths(monthTarget, delta * 12));\n setMonthViewYear(nextYear);\n setFocusedMonth(moved.getFullYear() === nextYear ? moved : null);\n };\n\n /* ---- year view ---------------------------------------------------- */\n\n const firstYearInRange = clampYear(decade, minDate, maxDate);\n const yearTarget =\n focusedYear !== null && inDecadeGrid(focusedYear, decade)\n ? focusedYear\n : value && inDecadeGrid(value.getFullYear(), decade)\n ? value.getFullYear()\n : clampedToday && inDecadeGrid(clampedToday.getFullYear(), decade)\n ? clampedToday.getFullYear()\n : inDecadeGrid(firstYearInRange, decade)\n ? firstYearInRange\n : decade;\n\n /**\n * A key moves the focused year. The arrows keep the decade while the year is in its grid (the\n * year before and after it included), PageUp/PageDown show the previous and next decade; a\n * year the bounds clamp outside that grid shows its own decade.\n */\n const moveYearFocus = (next: number, preferredDecade: number) => {\n const target = clampYear(next, minDate, maxDate);\n setFocusedYear(target);\n setDecade(inDecadeGrid(target, preferredDecade) ? preferredDecade : getDecadeStart(target));\n };\n\n const navigateDecade = (delta: number) => {\n const nextDecade = decade + delta * 10;\n const moved = clampYear(yearTarget + delta * 10, minDate, maxDate);\n setDecade(nextDecade);\n setFocusedYear(inDecadeGrid(moved, nextDecade) ? moved : null);\n };\n\n /* ---- view changes ------------------------------------------------- */\n\n const changeView = (next: CalendarViewKind) => {\n focusGridRef.current = true;\n setView(next);\n };\n\n /** \"Go to today\": today's month in the day view, today focused; nothing is selected. */\n const goToToday = () => {\n const target = clampDate(today ?? startOfDay(new Date()), minDate, maxDate);\n setViewMonth(startOfMonth(target));\n setFocusedDay(target);\n setFocusRequest((request) => request + 1);\n changeView('day');\n };\n\n /** The day view's heading button: the months of the focused day's year, its month focused. */\n const showMonths = () => {\n setFocusedDay(focusTarget);\n setMonthViewYear(focusTarget.getFullYear());\n setFocusedMonth(startOfMonth(focusTarget));\n changeView('month');\n };\n\n /** The month view's heading button: the decade of the focused month, its year focused. */\n const showYears = () => {\n setFocusedMonth(monthTarget);\n setDecade(getDecadeStart(monthTarget.getFullYear()));\n setFocusedYear(monthTarget.getFullYear());\n changeView('year');\n };\n\n /** A picked month shows its days; the focused day keeps its day of the month, clamped. */\n const pickMonth = (month: Date) => {\n const monthsAway =\n (month.getFullYear() - focusTarget.getFullYear()) * 12 +\n (month.getMonth() - focusTarget.getMonth());\n const day = clampDate(addMonths(focusTarget, monthsAway), minDate, maxDate);\n setViewMonth(month);\n setFocusedDay(isSameMonth(day, month) ? day : null);\n changeView('day');\n };\n\n /** A picked year shows its months; the focused month keeps its month, clamped. */\n const pickYear = (yearDate: Date) => {\n const year = yearDate.getFullYear();\n const month = clampMonth(makeDate(year, monthTarget.getMonth(), 1));\n setMonthViewYear(year);\n setFocusedMonth(month.getFullYear() === year ? month : null);\n changeView('month');\n };\n\n // Escape goes back one level (C-POPUPS: an inner widget that consumes Escape prevents its\n // default, so a DatePicker stays open); the day view leaves it to the surroundings.\n const handleEscape = (event: React.KeyboardEvent<HTMLElement>) => {\n if (event.key !== 'Escape' || view === 'day' || !isOwnEvent(event)) return;\n if (event.defaultPrevented || event.nativeEvent.isComposing) return;\n event.preventDefault();\n changeView(view === 'year' ? 'month' : 'day');\n };\n\n /* ---- focus -------------------------------------------------------- */\n\n const periodKey =\n view === 'day' ? formatISODate(viewMonth) : view === 'month' ? monthViewYear : decade;\n const cellKey =\n view === 'day' ? focusIso : view === 'month' ? formatISODate(monthTarget) : yearTarget;\n\n // Roving focus: while the grid holds focus, focus follows the focused cell, also when the\n // period changes under it (the buttons are keyed by position, so the focused one shows another\n // cell). A view change moves focus into the new grid in the same commit, since the element that\n // had it (the heading button that becomes text, a picked cell) may be gone.\n const headerRef = React.useRef<HTMLDivElement | null>(null);\n /** Whether focus last rested in the header or the grid (a removed element fires no event). */\n const viewHadFocusRef = React.useRef(false);\n React.useEffect(() => {\n const onFocusIn = (event: FocusEvent) => {\n const target = event.target as Node | null;\n viewHadFocusRef.current =\n !!target && (!!gridRef.current?.contains(target) || !!headerRef.current?.contains(target));\n };\n document.addEventListener('focusin', onFocusIn);\n return () => document.removeEventListener('focusin', onFocusIn);\n }, []);\n const previousViewRef = React.useRef(view);\n React.useLayoutEffect(() => {\n const viewChanged = previousViewRef.current !== view;\n previousViewRef.current = view;\n const requested = focusGridRef.current;\n focusGridRef.current = false;\n const grid = gridRef.current;\n if (!grid) return;\n const active = grid.ownerDocument.activeElement;\n // A view change the props made (the month picker turned off) removed the element that had\n // focus: focus then moves into the new grid, if the view had focus and it now rests on\n // nothing. A calendar that did not have focus keeps it where it is.\n const lost =\n viewChanged && viewHadFocusRef.current && (!active || active === grid.ownerDocument.body);\n if (!requested && !lost && (!active || !grid.contains(active))) return;\n const button = grid.querySelector<HTMLElement>('button[tabindex=\"0\"]');\n if (button && button !== active) button.focus();\n }, [view, periodKey, cellKey, focusRequest]);\n\n /* ---- render ------------------------------------------------------- */\n\n let previousLabel: string;\n let nextLabel: string;\n let previousDisabled: boolean;\n let nextDisabled: boolean;\n let navigate: (delta: number) => void;\n let headingText: string;\n if (view === 'day') {\n previousLabel = labels?.previousMonth ?? 'Previous month';\n nextLabel = labels?.nextMonth ?? 'Next month';\n previousDisabled = !!minDate && addDays(viewMonth, -1) < startOfDay(minDate);\n nextDisabled = !!maxDate && addMonths(viewMonth, 1) > startOfDay(maxDate);\n navigate = navigateMonth;\n headingText = formatMonthYear(viewMonth, locale);\n } else if (view === 'month') {\n previousLabel = labels?.previousYear ?? 'Previous year';\n nextLabel = labels?.nextYear ?? 'Next year';\n previousDisabled = isYearOutOfRange(monthViewYear - 1, minDate, maxDate);\n nextDisabled = isYearOutOfRange(monthViewYear + 1, minDate, maxDate);\n navigate = navigateYear;\n headingText = formatYear(makeDate(monthViewYear, 0, 1), locale);\n } else {\n previousLabel = labels?.previousDecade ?? 'Previous decade';\n nextLabel = labels?.nextDecade ?? 'Next decade';\n // A decade is wholly outside when its last year is before minDate or its first after maxDate.\n previousDisabled =\n isYearOutOfRange(decade - 1, minDate, undefined) ||\n isYearOutOfRange(decade - 10, undefined, maxDate);\n nextDisabled =\n isYearOutOfRange(decade + 10, undefined, maxDate) ||\n isYearOutOfRange(decade + 19, minDate, undefined);\n navigate = navigateDecade;\n headingText = formatDecade(decade, locale);\n }\n\n // Unknown today (before hydration) leaves the button enabled; the clock decides once it is known.\n const todayOutOfRange = !!today && !isDateInRange(today, minDate, maxDate);\n\n const headingButtonTarget = showMonthPicker && view !== 'year' ? view : null;\n const hint =\n view === 'day'\n ? (labels?.chooseMonth ?? 'Choose a month')\n : (labels?.chooseYear ?? 'Choose a year');\n\n let grid: React.ReactNode;\n if (view === 'day') {\n grid = (\n <CalendarDayGrid\n ref={gridRef}\n id={gridId}\n headingId={headingId}\n viewMonth={viewMonth}\n weeks={weeks}\n focusTarget={focusTarget}\n selectedDays={selectedDays}\n today={today}\n firstDayOfWeek={firstDayOfWeek}\n locale={locale}\n showWeekNumbers={showWeekNumbers}\n firstWeekOfYear={firstWeekOfYear}\n markedDates={markedDates}\n renderDay={renderDay}\n dayLabel={dayLabel}\n labels={labels}\n isUnavailable={isUnavailable}\n onMoveFocus={moveFocus}\n onDayFocus={handleDayFocus}\n onPick={onPick}\n partClassNames={partClassNames}\n />\n );\n } else if (view === 'month') {\n const months = getYearMonths(monthViewYear);\n grid = (\n <CalendarPickerGrid\n ref={gridRef}\n id={gridId}\n headingId={headingId}\n cells={months.map((month) => ({\n date: month,\n text: formatMonthShort(month, locale),\n label: formatMonthYear(month, locale),\n selected: !!value && isSameMonth(month, value),\n current: !!today && isSameMonth(month, today),\n outside: false,\n unavailable: isMonthOutOfRange(month, minDate, maxDate),\n }))}\n focusIndex={monthTarget.getMonth()}\n onMoveFocus={(delta) => moveMonthFocus(addMonths(monthTarget, delta))}\n onPage={(direction) => moveMonthFocus(addMonths(monthTarget, direction * 12))}\n onCellFocus={(month) => {\n if (!isSameMonth(month, monthTarget)) setFocusedMonth(month);\n }}\n onPick={pickMonth}\n onKeyDown={handleEscape}\n partClassNames={{ grid: partClassNames?.grid, cell: partClassNames?.month }}\n />\n );\n } else {\n const years = getDecadeYears(decade);\n grid = (\n <CalendarPickerGrid\n ref={gridRef}\n id={gridId}\n headingId={headingId}\n cells={years.map((yearDate) => {\n const year = yearDate.getFullYear();\n return {\n date: yearDate,\n text: formatYear(yearDate, locale),\n selected: value?.getFullYear() === year,\n current: today?.getFullYear() === year,\n outside: year < decade || year > decade + 9,\n unavailable: isYearOutOfRange(year, minDate, maxDate),\n };\n })}\n focusIndex={yearTarget - (decade - 1)}\n onMoveFocus={(delta) => moveYearFocus(yearTarget + delta, decade)}\n onPage={(direction) => moveYearFocus(yearTarget + direction * 10, decade + direction * 10)}\n onCellFocus={(yearDate) => {\n if (yearDate.getFullYear() !== yearTarget) setFocusedYear(yearDate.getFullYear());\n }}\n onPick={pickYear}\n onKeyDown={handleEscape}\n partClassNames={{ grid: partClassNames?.grid, cell: partClassNames?.year }}\n />\n );\n }\n\n return (\n <>\n <div\n ref={headerRef}\n className={cn(partClassNames?.header, 'mb-2 flex items-center justify-between gap-2')}\n onKeyDown={handleEscape}\n >\n <button\n type=\"button\"\n aria-label={previousLabel}\n aria-controls={gridId}\n {...focusableDisabledProps(previousDisabled)}\n onClick={preventIfDisabled(previousDisabled, () => navigate(-1))}\n className={cn(\n partClassNames?.previousMonthButton,\n NAV_BUTTON_CLASSES,\n focusRing,\n disabledStyles,\n )}\n >\n <ChevronLeftIcon className=\"wave-rtl:-scale-x-100\" />\n </button>\n <Heading\n id={headingId}\n aria-live=\"polite\"\n className={cn(partClassNames?.heading, 'text-body-1 font-semibold')}\n >\n {headingButtonTarget ? (\n // Named by its text, so the grid and a DatePicker's dialog keep their names; the hint\n // is outside the heading, which names them.\n <button\n type=\"button\"\n aria-describedby={hintId}\n onClick={headingButtonTarget === 'day' ? showMonths : showYears}\n className={cn(partClassNames?.headingButton, HEADING_BUTTON_CLASSES, focusRing)}\n >\n {headingText}\n </button>\n ) : (\n headingText\n )}\n </Heading>\n {headingButtonTarget && (\n <span id={hintId} hidden>\n {hint}\n </span>\n )}\n <button\n type=\"button\"\n aria-label={nextLabel}\n aria-controls={gridId}\n {...focusableDisabledProps(nextDisabled)}\n onClick={preventIfDisabled(nextDisabled, () => navigate(1))}\n className={cn(\n partClassNames?.nextMonthButton,\n NAV_BUTTON_CLASSES,\n focusRing,\n disabledStyles,\n )}\n >\n <ChevronRightIcon className=\"wave-rtl:-scale-x-100\" />\n </button>\n </div>\n {grid}\n {(showGoToToday || onClose) && (\n <div\n className={cn(partClassNames?.footer, 'mt-2 flex items-center justify-end gap-2')}\n onKeyDown={handleEscape}\n >\n {showGoToToday && (\n <button\n type=\"button\"\n // Natively disabled, since it never disables itself by its own activation.\n disabled={todayOutOfRange}\n onClick={goToToday}\n className={cn(\n partClassNames?.todayButton,\n FOOTER_BUTTON_CLASSES,\n focusRing,\n disabledStyles,\n )}\n >\n {labels?.goToToday ?? 'Go to today'}\n </button>\n )}\n {onClose && (\n <button\n type=\"button\"\n onClick={onClose}\n className={cn(\n partClassNames?.closeButton,\n FOOTER_BUTTON_CLASSES,\n focusRing,\n disabledStyles,\n )}\n >\n {closeLabel ?? 'Close'}\n </button>\n )}\n </div>\n )}\n </>\n );\n};\n\nCalendarView.displayName = 'CalendarView';\n\n// The Calendar's parts carry its own stable classes (the view's keys name the day view's buttons;\n// the navigation buttons of every view share them).\nconst CALENDAR_PART_CLASS_NAMES: CalendarViewPartClassNames = {\n header: calendarClassNames.header,\n previousMonthButton: calendarClassNames.previousButton,\n heading: calendarClassNames.heading,\n headingButton: calendarClassNames.headingButton,\n nextMonthButton: calendarClassNames.nextButton,\n grid: calendarClassNames.grid,\n weekday: calendarClassNames.weekday,\n day: calendarClassNames.day,\n month: calendarClassNames.month,\n year: calendarClassNames.year,\n weekNumberHeader: calendarClassNames.weekNumberHeader,\n weekNumber: calendarClassNames.weekNumber,\n markedDot: calendarClassNames.markedDot,\n footer: calendarClassNames.footer,\n todayButton: calendarClassNames.todayButton,\n};\n\n/**\n * A month calendar for picking one day, without a text input: the grid of DatePicker's dialog,\n * placed in the page (APG date picker grid).\n *\n * - **Structure**: a `role=\"group\"` root, named with `aria-label`/`aria-labelledby` or by a\n * surrounding `Field`, around the previous-month button, the month text (a polite live region\n * that labels the grid), the next-month button and a `role=\"grid\"` table of six weeks, with an\n * optional leading column of week numbers (`showWeekNumbers`, `firstWeekOfYear`) and an\n * optional footer button, \"Go to today\" (`showGoToToday`), which shows today's month and focuses\n * today without selecting it. The month text is no heading, since a component cannot know the\n * page's heading levels.\n * - **Month and year views** (`showMonthPicker`, on by default): the month text is a button\n * (named by that text, its hint `labels.chooseMonth`) that shows the 12 months of the year; their\n * heading, the year, is a button to the year view, a decade with the year before and after it\n * (muted). The header buttons move by a year, then by a decade. A picked year shows its months\n * and a picked month its days (the focused day keeps its day of the month, clamped); Escape\n * goes back a level to the period shown before. Each view change moves focus into the new\n * grid. Months and years wholly outside `minDate`/`maxDate` stay focusable, `aria-disabled`.\n * - **Keyboard**: one tab stop in the grid, the focused day (the selected day of the shown month,\n * else today, else the first day of the month in range, which may be unavailable). Arrow keys\n * move by day and week (mirrored in RTL), PageUp/PageDown by month, Shift+PageUp/PageDown by\n * year (the day is clamped to the month), Home/End to the start and end of the week; Enter,\n * Space and a click pick the day. Unavailable days (`minDate`, `maxDate`, `disabledDates`) stay\n * focusable and are `aria-disabled`. In the month and year views the arrows move by a cell and a\n * row of four, Home/End to the row's ends, PageUp/PageDown by a year (months) or ten (years).\n * - **Value**: `onValueChange` fires only when the day changes, with local midnight and `details`;\n * picking the selected day again does nothing. A value that moves to another month shows that\n * month. The selected day is `aria-selected` on its gridcell and `aria-pressed` on its button;\n * today is `aria-current=\"date\"`. With `selectionRange` a pick selects the day's week, work\n * week (`workWeekDays`) or month: every available day of it is drawn and marked selected, the\n * value is the picked day, and `details.range` lists the selected days in order.\n * - **Marked days and custom content**: `markedDates` draws a dot in the text colour under the\n * number, sets `data-marked` and says \"marked\" in the day's name; `renderDay` replaces the\n * content of the day button (non-interactive content only) and `dayLabel` sets its name.\n * - **Forms and Field**: `name`/`required` add a hidden input (ISO `yyyy-mm-dd`) that resets with\n * its form (to `defaultValue`); a required calendar that the form reports missing focuses its\n * tab stop. Inside a `Field` the group takes the label, the description and `aria-invalid`; it\n * says \"required\" in its description (`labels.required`), since a group cannot carry\n * `aria-required`.\n * - **Server rendering**: pass `locale`, and `today`, `initialVisibleDate` or a value, so the\n * server and the browser render the same month. Only `today` marks a day in the server HTML:\n * without it the server HTML marks none and the browser marks today once hydrated. Without any\n * of the three the month shown first comes from the server's clock (development warning).\n *\n * @example\n * <Calendar aria-label=\"Due date\" defaultValue={new Date(2025, 5, 12)} onValueChange={setDue} />\n */\nexport const Calendar = ({\n value: valueProp,\n defaultValue,\n onValueChange,\n minDate,\n maxDate,\n disabledDates,\n firstDayOfWeek = 0,\n locale,\n today: todayProp,\n initialVisibleDate,\n showMonthPicker = true,\n showWeekNumbers,\n firstWeekOfYear,\n showGoToToday,\n markedDates,\n renderDay,\n dayLabel,\n selectionRange = 'day',\n workWeekDays,\n labels,\n name,\n form,\n required,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n className,\n ref,\n ...rest\n}: CalendarProps) => {\n const isUnavailable = (date: Date) => isDayUnavailable(date, minDate, maxDate, disabledDates);\n const [value, setValue] = useControllable<Date | null>(valueProp, defaultValue ?? null, (next) =>\n onValueChange?.(next, {\n range: next\n ? getSelectionRange(\n next,\n selectionRange,\n firstDayOfWeek,\n workWeekDays ?? DEFAULT_WORK_WEEK_DAYS,\n isUnavailable,\n )\n : [],\n }),\n );\n\n /** Commits a day (or `null`) as local midnight; nothing is emitted when it is the same day. */\n const commit = (next: Date | null) => {\n const normalized = next ? startOfDay(next) : null;\n const unchanged = normalized ? isSameDay(normalized, value) : value === null;\n if (!unchanged) setValue(normalized);\n };\n\n // Today is unknown in the server HTML and the hydration render (the two clocks may name\n // different days); the browser applies it once hydrated.\n const isClient = useIsClient();\n const today = todayProp ?? (isClient ? new Date() : null);\n\n React.useEffect(() => {\n if (locale !== undefined && !isValidLocaleTag(locale)) {\n warnOnce(\n `Calendar:invalid-locale:${locale}`,\n `Calendar: \\`locale\\` \"${locale}\" is not a valid BCP 47 language tag (use hyphens, as in ` +\n '\"en-US\"). The runtime default locale formats the dates instead, so the server and the ' +\n 'browser may render different text.',\n );\n }\n }, [locale]);\n const hasDate = todayProp !== undefined || initialVisibleDate !== undefined || value !== null;\n React.useEffect(() => {\n // Effects run only in the browser, where `isClient` is false after a hydration render alone.\n if (!isClient && !hasDate) {\n warnOnce(\n 'Calendar:hydration-date',\n 'Calendar: rendered on the server without `today`, `initialVisibleDate` or `value`, so ' +\n \"the month shown first comes from the server's clock and the browser may show another \" +\n 'month. Pass `today` or `initialVisibleDate`.',\n );\n }\n }, [isClient, hasDate]);\n\n const field = useFieldContext();\n const {\n 'aria-required': fieldAriaRequired,\n 'aria-describedby': fieldDescribedBy,\n ...fieldProps\n } = useFieldControl(\n {\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n 'aria-invalid': ariaInvalid,\n // An explicit `required={false}` wins over a required Field, so the hint matches\n // `isRequired`.\n 'aria-required': ariaRequired ?? required,\n },\n { labelable: false },\n );\n const isRequired = required ?? field?.required ?? false;\n // `group` does not allow aria-required (a consumer's included): the description says it.\n const requiredHintId = useId('calendar-required');\n const showRequiredHint = fieldAriaRequired !== undefined && String(fieldAriaRequired) !== 'false';\n\n const headingId = useId('calendar-heading');\n const rootRef = React.useRef<HTMLDivElement | null>(null);\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, rootRef);\n\n useFormReset(rootRef, () => commit(defaultValue ?? null), form);\n\n const focusTabStop = () => {\n rootRef.current\n ?.querySelector<HTMLElement>('[data-wave-calendar-grid] button[tabindex=\"0\"]')\n ?.focus();\n };\n\n return (\n <div\n role=\"group\"\n {...fieldProps}\n aria-describedby={joinIds(fieldDescribedBy, showRequiredHint && requiredHintId)}\n className={cn(\n calendarClassNames.root,\n 'relative inline-flex flex-col text-foreground',\n className,\n )}\n {...rest}\n ref={mergedRef}\n >\n <CalendarView\n value={value}\n onPick={commit}\n minDate={minDate}\n maxDate={maxDate}\n disabledDates={disabledDates}\n firstDayOfWeek={firstDayOfWeek}\n locale={locale}\n today={today}\n initialVisibleDate={initialVisibleDate}\n showMonthPicker={showMonthPicker}\n showWeekNumbers={showWeekNumbers}\n firstWeekOfYear={firstWeekOfYear}\n showGoToToday={showGoToToday}\n markedDates={markedDates}\n renderDay={renderDay}\n dayLabel={dayLabel}\n selectionRange={selectionRange}\n workWeekDays={workWeekDays}\n labels={labels}\n headingAs=\"div\"\n headingId={headingId}\n partClassNames={CALENDAR_PART_CLASS_NAMES}\n />\n {showRequiredHint && (\n <span id={requiredHintId} hidden>\n {labels?.required ?? 'Required'}\n </span>\n )}\n <HiddenInput\n type=\"text\"\n name={name}\n form={form}\n value={value ? formatISODate(value) : ''}\n required={isRequired}\n onInvalid={focusTabStop}\n />\n </div>\n );\n};\n\nCalendar.displayName = 'Calendar';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuVA,IAAMI,KACJ,4IAGIC,KACJ,uKAGIC,KACJ,yJAGIC,KAA+C;CAAC;CAAG;CAAG;CAAG;CAAG;AAAC;AAGnE,SAASC,GAAQ,GAAwB;CACvC,IAAMC,IAAkB,CAAC;CACzB,KAAK,IAAIC,IAAI,GAAGA,IAAIC,EAAK,QAAQ,KAAK,GAAG,EAAM,KAAKA,EAAK,MAAMD,GAAGA,IAAI,CAAC,CAAC;CACxE,OAAOD;AACT;AAGA,SAASG,EAAa,GAAc,GAAyB;CAC3D,OAAOC,KAAQC,IAAS,KAAKD,KAAQC,IAAS;AAChD;AAGA,S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Q;GACZ,CAAA;EACE;;AAET;AAEA,EAAS,cAAc"}
@@ -0,0 +1,2 @@
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/composeEventHandlers.cjs"),r=require("../../lib/date.cjs"),i=require("../../lib/direction.cjs"),a=require("../../lib/aria.cjs"),o=require("../../lib/styles.cjs"),s=require("./dateUtils.cjs");let c=require("react");c=e.__toESM(c,1);let l=require("react/jsx-runtime");var u=`relative flex h-8 w-8 items-center justify-center rounded bg-transparent p-0 text-caption-1 text-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover data-[outside]:text-muted-foreground data-[today]:border data-[today]:border-primary data-[today]:font-semibold data-[selected]:bg-primary data-[selected]:font-semibold data-[selected]:text-primary-foreground not-disabled:not-aria-disabled:data-[selected]:hover:bg-primary-hover aria-disabled:line-through`,d=({id:e,headingId:n,viewMonth:d,weeks:m,focusTarget:h,selectedDays:g,today:_,firstDayOfWeek:v,locale:y,showWeekNumbers:b=!1,firstWeekOfYear:x=`first-day`,markedDates:S,renderDay:C,dayLabel:w,labels:T,isUnavailable:E,onMoveFocus:D,onDayFocus:O,onPick:k,partClassNames:A,ref:j})=>{let M=c.useMemo(()=>s.getWeekdayNames(y,v),[y,v]),N=s.formatISODate(h);return(0,l.jsxs)(`table`,{ref:j,id:e,role:`grid`,"aria-labelledby":n,"data-wave-calendar-grid":``,onKeyDown:e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;let t=(h.getDay()-v+7)%7,n;switch(e.key){case`ArrowLeft`:case`ArrowRight`:{let t=i.getArrowIntent(e.key,{orientation:`horizontal`,dir:i.getDirection(e.currentTarget)});n=r.addDays(h,t===`next`?1:-1);break}case`ArrowDown`:n=r.addDays(h,7);break;case`ArrowUp`:n=r.addDays(h,-7);break;case`PageDown`:n=r.addMonths(h,e.shiftKey?12:1);break;case`PageUp`:n=r.addMonths(h,e.shiftKey?-12:-1);break;case`Home`:n=r.addDays(h,-t);break;case`End`:n=r.addDays(h,6-t);break;default:return}e.preventDefault(),D(n)},className:t.cn(A?.grid,`border-collapse`),children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[b&&(0,l.jsxs)(`th`,{scope:`col`,className:t.cn(A?.weekNumberHeader,`h-8 w-8 text-center text-caption-1 font-normal text-muted-foreground`),children:[(0,l.jsx)(`span`,{"aria-hidden":`true`,children:`#`}),(0,l.jsx)(`span`,{className:`sr-only`,children:T?.week??`Week`})]}),M.map(e=>(0,l.jsxs)(`th`,{scope:`col`,abbr:e.long,"aria-label":e.long,className:t.cn(A?.weekday,`h-8 w-8 text-center text-caption-1 font-normal text-muted-foreground`),children:[(0,l.jsx)(`span`,{"aria-hidden":`true`,children:e.short}),(0,l.jsx)(`span`,{className:`sr-only`,children:e.long})]},e.long))]})}),(0,l.jsx)(`tbody`,{children:m.map((e,n)=>(0,l.jsxs)(`tr`,{children:[b&&(0,l.jsx)(`th`,{scope:`row`,"aria-label":(T?.weekNumber??p)(r.getWeekNumber(e[0],{firstDayOfWeek:v,firstWeekOfYear:x})),className:t.cn(A?.weekNumber,`h-8 w-8 text-center text-caption-1 font-normal text-muted-foreground`),children:r.getWeekNumber(e[0],{firstDayOfWeek:v,firstWeekOfYear:x})}),e.map((e,n)=>{let i=s.formatISODate(e),c=g.has(i),p=!!S?.(e),m=s.formatDayNumber(e,y),h=s.formatDayLabel(e,y),v=p?(T?.markedDay??f)(h):h,b=r.isSameDay(e,_),x=i===N,D=E(e);return(0,l.jsx)(`td`,{role:`gridcell`,"aria-selected":c,className:`p-0`,children:(0,l.jsxs)(`button`,{type:`button`,tabIndex:x?0:-1,"aria-label":w?w(e,v):v,"aria-pressed":c||void 0,"aria-current":b?`date`:void 0,...a.focusableDisabledProps(D),"data-date":i,"data-selected":c?``:void 0,"data-today":b?``:void 0,"data-marked":p?``:void 0,"data-outside":s.isSameMonth(e,d)?void 0:``,onFocus:()=>O(e),onClick:()=>{D||k(e)},className:t.cn(A?.day,u,o.focusRing,o.disabledStyles,c&&o.forcedColors.selectedLeaf),children:[C?C(e,m):m,p&&(0,l.jsx)(`span`,{"aria-hidden":`true`,className:t.cn(A?.markedDot,`pointer-events-none absolute inset-x-0 bottom-0.5 mx-auto h-1 w-1 rounded-full bg-current forced-colors:forced-color-adjust-none`)})]})},n)})]},n))})]})};d.displayName=`CalendarDayGrid`;var f=e=>`${e}, marked`,p=e=>`Week ${e}`,m=`flex h-12 w-14 items-center justify-center rounded bg-transparent p-0 text-caption-1 text-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover data-[outside]:text-muted-foreground data-[today]:border data-[today]:border-primary data-[today]:font-semibold data-[selected]:bg-primary data-[selected]:font-semibold data-[selected]:text-primary-foreground not-disabled:not-aria-disabled:data-[selected]:hover:bg-primary-hover aria-disabled:line-through`,h=4,g=({id:e,headingId:r,cells:s,focusIndex:c,onMoveFocus:u,onPage:d,onCellFocus:f,onPick:p,onKeyDown:g,partClassNames:_,ref:v})=>{let y=e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;let t=c%h;switch(e.key){case`ArrowLeft`:case`ArrowRight`:{let t=i.getArrowIntent(e.key,{orientation:`horizontal`,dir:i.getDirection(e.currentTarget)});e.preventDefault(),u(t===`next`?1:-1);return}case`ArrowDown`:e.preventDefault(),u(h);return;case`ArrowUp`:e.preventDefault(),u(-4);return;case`Home`:e.preventDefault(),u(-t);return;case`End`:e.preventDefault(),u(3-t);return;case`PageDown`:case`PageUp`:e.preventDefault(),d(e.key===`PageDown`?1:-1);return}},b=[];for(let e=0;e<s.length;e+=h)b.push(s.slice(e,e+h));return(0,l.jsx)(`table`,{ref:v,id:e,role:`grid`,"aria-labelledby":r,"data-wave-calendar-grid":``,onKeyDown:n.composeEventHandlers(g,y),className:t.cn(_?.grid,`border-collapse`),children:(0,l.jsx)(`tbody`,{children:b.map((e,n)=>(0,l.jsx)(`tr`,{children:e.map((e,r)=>{let i=n*h+r;return(0,l.jsx)(`td`,{role:`gridcell`,"aria-selected":e.selected,className:`p-0`,children:(0,l.jsx)(`button`,{type:`button`,tabIndex:i===c?0:-1,"aria-label":e.label,"aria-pressed":e.selected||void 0,"aria-current":e.current?`date`:void 0,...a.focusableDisabledProps(e.unavailable),"data-selected":e.selected?``:void 0,"data-today":e.current?``:void 0,"data-outside":e.outside?``:void 0,onFocus:()=>f(e.date),onClick:()=>{e.unavailable||p(e.date)},className:t.cn(_?.cell,m,o.focusRing,o.disabledStyles,e.selected&&o.forcedColors.selectedLeaf),children:e.text})},r)})},n))})})};g.displayName=`CalendarPickerGrid`,exports.CalendarDayGrid=d,exports.CalendarPickerGrid=g;
2
+ //# sourceMappingURL=Calendar.views.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Calendar.views.cjs","names":["React","getWeekdayNames","formatISODate","getArrowIntent","getDirection","addDays","addMonths","cn","getWeekNumber","formatDayNumber","formatDayLabel","isSameDay","focusableDisabledProps","isSameMonth","focusRing","disabledStyles","forcedColors","composeEventHandlers","require_runtime","require_cn","require_composeEventHandlers","require_date","require_direction","require_aria","require_styles","require_dateUtils","react","react_jsx_runtime","DAY_CLASSES","CalendarDayGrid","weekdays","locale","firstDayOfWeek","focusIso","focusTarget","headingId","event","weekOffset","next","intent","onMoveFocus","partClassNames","showWeekNumbers","labels","weekday","weeks","defaultWeekNumber","week","iso","day","isSelected","selectedDays","isMarked","markedDates","number","baseLabel","defaultLabel","defaultMarkedDay","isToday","today","isFocused","unavailable","isUnavailable","dayLabel","viewMonth","onDayFocus","onPick","renderDay","column","row","PICKER_CELL_CLASSES","PICKER_COLUMNS","CalendarPickerGrid","handleKeyDown","focusIndex","onPage","rows","i","cells","onKeyDown","index","rowIndex","cell","onCellFocus"],"sources":["../../../src/components/input/Calendar.views.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { DayOfWeek, FirstWeekOfYear } from '../../lib/types';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { focusableDisabledProps } from '../../lib/aria';\nimport { getArrowIntent, getDirection } from '../../lib/direction';\nimport { disabledStyles, focusRing, forcedColors } from '../../lib/styles';\nimport { getWeekNumber } from '../../lib/date';\nimport type { CalendarLabels } from './Calendar';\nimport {\n addDays,\n addMonths,\n formatDayLabel,\n formatDayNumber,\n formatISODate,\n getWeekdayNames,\n isSameDay,\n isSameMonth,\n} from './dateUtils';\n\n// An unavailable day stays focusable in the roving grid (`aria-disabled`); the day button adds\n// `disabledStyles`, whose dimmed look lifts while the focus ring shows (opacity would dim the ring).\nconst DAY_CLASSES =\n 'relative flex h-8 w-8 items-center justify-center rounded bg-transparent p-0 text-caption-1 text-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover data-[outside]:text-muted-foreground data-[today]:border data-[today]:border-primary data-[today]:font-semibold data-[selected]:bg-primary data-[selected]:font-semibold data-[selected]:text-primary-foreground not-disabled:not-aria-disabled:data-[selected]:hover:bg-primary-hover aria-disabled:line-through';\n\n/** Internal: the stable classes of the day view's parts (see `CalendarDayGridProps.partClassNames`). */\nexport interface CalendarDayGridPartClassNames {\n /** On the `role=\"grid\"` table. */\n grid?: string;\n /** On each weekday header cell. */\n weekday?: string;\n /** On each day button. */\n day?: string;\n /** On the header cell of the week-number column. */\n weekNumberHeader?: string;\n /** On each week's row header (its number). */\n weekNumber?: string;\n /** On the dot inside the button of a marked day. */\n markedDot?: string;\n}\n\n/** Internal props of {@link CalendarDayGrid}. */\nexport interface CalendarDayGridProps {\n /** Id of the table (the header's month buttons control it). */\n id: string;\n /** Id of the month heading, which labels the table. */\n headingId: string;\n /** The month the grid shows; days of other months are marked `data-outside`. */\n viewMonth: Date;\n /** The 42 days of the grid as 6 weeks. */\n weeks: Date[][];\n /** The roving day: the only day button in the tab order, and the start of the arrow keys. */\n focusTarget: Date;\n /**\n * The selected days as ISO dates (`yyyy-mm-dd`): `aria-selected` on their cells, `aria-pressed`\n * and `data-selected` on their buttons.\n */\n selectedDays: ReadonlySet<string>;\n /** Today's day (`aria-current=\"date\"`), or `null` while it is unknown (no day is marked). */\n today: Date | null;\n /** First day of the week, the first column (Home and End move to the row's ends). */\n firstDayOfWeek: DayOfWeek;\n /** BCP 47 locale of the weekday names, the day numbers and the day labels. */\n locale?: string;\n /** Adds a leading column of week numbers. @default false */\n showWeekNumbers?: boolean;\n /** Which week is week 1 of a year. @default 'first-day' */\n firstWeekOfYear?: FirstWeekOfYear;\n /** Returns `true` for days that draw a dot and are named \"marked\". */\n markedDates?: (date: Date) => boolean;\n /** Replaces the content of a day button (`defaultContent` is the day number). */\n renderDay?: (date: Date, defaultContent: React.ReactNode) => React.ReactNode;\n /** The accessible name of a day, from its default name (marked included). */\n dayLabel?: (date: Date, defaultLabel: string) => string;\n /** Names of the week-number column and the marked days. */\n labels?: CalendarLabels;\n /** Whether a day cannot be picked; it stays focusable and is `aria-disabled`. */\n isUnavailable: (date: Date) => boolean;\n /** Called with the day a key moves to (before clamping into the bounds). */\n onMoveFocus: (date: Date) => void;\n /** Called when a day button receives focus (pointer or assistive technology). */\n onDayFocus: (date: Date) => void;\n /** Called with an available day that is clicked (Enter and Space click the focused button). */\n onPick: (date: Date) => void;\n /** Stable classes of the grid's parts, from the component that renders the view. */\n partClassNames?: CalendarDayGridPartClassNames;\n /** Ref to the table. */\n ref?: React.Ref<HTMLTableElement>;\n}\n\n/**\n * Internal: the day view of a calendar, a `role=\"grid\"` table of 6 weeks with one roving day\n * button in the tab order. Arrow keys move by day and week (mirrored in RTL), PageUp/PageDown by\n * month, Shift+PageUp/PageDown by year, Home/End to the start and end of the week; Enter and Space\n * click the focused day button. Marked `data-wave-calendar-grid`, so a surrounding focus trap\n * finds its tab stop.\n */\nexport const CalendarDayGrid = ({\n id,\n headingId,\n viewMonth,\n weeks,\n focusTarget,\n selectedDays,\n today,\n firstDayOfWeek,\n locale,\n showWeekNumbers = false,\n firstWeekOfYear = 'first-day',\n markedDates,\n renderDay,\n dayLabel,\n labels,\n isUnavailable,\n onMoveFocus,\n onDayFocus,\n onPick,\n partClassNames,\n ref,\n}: CalendarDayGridProps) => {\n const weekdays = React.useMemo(\n () => getWeekdayNames(locale, firstDayOfWeek),\n [locale, firstDayOfWeek],\n );\n const focusIso = formatISODate(focusTarget);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTableElement>) => {\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n const weekOffset = (focusTarget.getDay() - firstDayOfWeek + 7) % 7;\n let next: Date;\n switch (event.key) {\n case 'ArrowLeft':\n case 'ArrowRight': {\n const intent = getArrowIntent(event.key, {\n orientation: 'horizontal',\n dir: getDirection(event.currentTarget),\n });\n next = addDays(focusTarget, intent === 'next' ? 1 : -1);\n break;\n }\n case 'ArrowDown':\n next = addDays(focusTarget, 7);\n break;\n case 'ArrowUp':\n next = addDays(focusTarget, -7);\n break;\n case 'PageDown':\n next = addMonths(focusTarget, event.shiftKey ? 12 : 1);\n break;\n case 'PageUp':\n next = addMonths(focusTarget, event.shiftKey ? -12 : -1);\n break;\n case 'Home':\n next = addDays(focusTarget, -weekOffset);\n break;\n case 'End':\n next = addDays(focusTarget, 6 - weekOffset);\n break;\n default:\n // Enter and Space activate the focused day button natively (click).\n return;\n }\n event.preventDefault();\n onMoveFocus(next);\n };\n\n return (\n <table\n ref={ref}\n id={id}\n role=\"grid\"\n aria-labelledby={headingId}\n data-wave-calendar-grid=\"\"\n onKeyDown={handleKeyDown}\n className={cn(partClassNames?.grid, 'border-collapse')}\n >\n <thead>\n <tr>\n {showWeekNumbers && (\n // The weekday headers' pattern: a visible symbol hidden from assistive technology and\n // a visually hidden name (an aria-label alone on an empty header fails axe).\n <th\n scope=\"col\"\n className={cn(\n partClassNames?.weekNumberHeader,\n 'h-8 w-8 text-center text-caption-1 font-normal text-muted-foreground',\n )}\n >\n <span aria-hidden=\"true\">#</span>\n <span className=\"sr-only\">{labels?.week ?? 'Week'}</span>\n </th>\n )}\n {weekdays.map((weekday) => (\n <th\n key={weekday.long}\n scope=\"col\"\n abbr={weekday.long}\n aria-label={weekday.long}\n className={cn(\n partClassNames?.weekday,\n 'h-8 w-8 text-center text-caption-1 font-normal text-muted-foreground',\n )}\n >\n <span aria-hidden=\"true\">{weekday.short}</span>\n <span className=\"sr-only\">{weekday.long}</span>\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {weeks.map((week, row) => (\n // Rows and cells are keyed by position, so the focused button survives a month change\n // and focus stays in the grid while it moves to the new day.\n <tr key={row}>\n {showWeekNumbers && (\n <th\n scope=\"row\"\n aria-label={(labels?.weekNumber ?? defaultWeekNumber)(\n getWeekNumber(week[0], { firstDayOfWeek, firstWeekOfYear }),\n )}\n className={cn(\n partClassNames?.weekNumber,\n 'h-8 w-8 text-center text-caption-1 font-normal text-muted-foreground',\n )}\n >\n {getWeekNumber(week[0], { firstDayOfWeek, firstWeekOfYear })}\n </th>\n )}\n {week.map((day, column) => {\n const iso = formatISODate(day);\n const isSelected = selectedDays.has(iso);\n const isMarked = !!markedDates?.(day);\n const number = formatDayNumber(day, locale);\n const baseLabel = formatDayLabel(day, locale);\n const defaultLabel = isMarked\n ? (labels?.markedDay ?? defaultMarkedDay)(baseLabel)\n : baseLabel;\n const isToday = isSameDay(day, today);\n const isFocused = iso === focusIso;\n const unavailable = isUnavailable(day);\n return (\n <td key={column} role=\"gridcell\" aria-selected={isSelected} className=\"p-0\">\n {/* Focus rests on the button, and screen readers do not reliably announce the\n gridcell's aria-selected from inside it: the selected day's button is also\n pressed. */}\n <button\n type=\"button\"\n tabIndex={isFocused ? 0 : -1}\n aria-label={dayLabel ? dayLabel(day, defaultLabel) : defaultLabel}\n aria-pressed={isSelected || undefined}\n aria-current={isToday ? 'date' : undefined}\n {...focusableDisabledProps(unavailable)}\n data-date={iso}\n data-selected={isSelected ? '' : undefined}\n data-today={isToday ? '' : undefined}\n data-marked={isMarked ? '' : undefined}\n data-outside={isSameMonth(day, viewMonth) ? undefined : ''}\n onFocus={() => onDayFocus(day)}\n onClick={() => {\n if (!unavailable) onPick(day);\n }}\n className={cn(\n partClassNames?.day,\n DAY_CLASSES,\n focusRing,\n disabledStyles,\n isSelected && forcedColors.selectedLeaf,\n )}\n >\n {renderDay ? renderDay(day, number) : number}\n {isMarked && (\n // Decorative: the day's name says \"marked\". It is drawn in the text colour\n // of the day, so it follows the selected and forced-colors looks.\n <span\n aria-hidden=\"true\"\n className={cn(\n partClassNames?.markedDot,\n 'pointer-events-none absolute inset-x-0 bottom-0.5 mx-auto h-1 w-1 rounded-full bg-current forced-colors:forced-color-adjust-none',\n )}\n />\n )}\n </button>\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nCalendarDayGrid.displayName = 'CalendarDayGrid';\n\nconst defaultMarkedDay = (dayLabel: string) => `${dayLabel}, marked`;\nconst defaultWeekNumber = (week: number) => `Week ${week}`;\n\n// The month and year cells: the day buttons' look in a wider cell (C-NATIVE padding and\n// background, the gated hover, the selected fill, and an unavailable cell struck through besides\n// the dimming of `disabledStyles`).\nconst PICKER_CELL_CLASSES =\n 'flex h-12 w-14 items-center justify-center rounded bg-transparent p-0 text-caption-1 text-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover data-[outside]:text-muted-foreground data-[today]:border data-[today]:border-primary data-[today]:font-semibold data-[selected]:bg-primary data-[selected]:font-semibold data-[selected]:text-primary-foreground not-disabled:not-aria-disabled:data-[selected]:hover:bg-primary-hover aria-disabled:line-through';\n\n/** The cells of a row of the month and year grids. */\nconst PICKER_COLUMNS = 4;\n\n/** Internal: one cell of the month or the year grid. */\nexport interface CalendarPickerCell {\n /** The month (its 1st) or the year (its January 1). */\n date: Date;\n /** The visible text (`Jun`, `2025`). */\n text: string;\n /** The accessible name when it differs from the text (`June 2025`). */\n label?: string;\n /** The value's month or year (`aria-selected` on the cell, `aria-pressed` on the button). */\n selected: boolean;\n /** Today's month or year (`aria-current=\"date\"`). */\n current: boolean;\n /** A year before or after the decade (muted). */\n outside: boolean;\n /** Wholly outside `minDate`/`maxDate`: `aria-disabled`, focusable, not pickable. */\n unavailable: boolean;\n}\n\n/** Internal: the stable classes of a month or year grid's parts. */\nexport interface CalendarPickerGridPartClassNames {\n /** On the `role=\"grid\"` table. */\n grid?: string;\n /** On each cell button. */\n cell?: string;\n}\n\n/** Internal props of {@link CalendarPickerGrid}. */\nexport interface CalendarPickerGridProps {\n /** Id of the table (the header's buttons control it). */\n id: string;\n /** Id of the heading, which labels the table. */\n headingId: string;\n /** The 12 cells, in reading order (3 rows of 4). */\n cells: readonly CalendarPickerCell[];\n /** Index of the roving cell: the only cell button in the tab order. */\n focusIndex: number;\n /** Called with the number of cells a key moves by (arrows, Home and End). */\n onMoveFocus: (delta: number) => void;\n /** Called with the direction of PageUp (`-1`) and PageDown (`1`). */\n onPage: (direction: -1 | 1) => void;\n /** Called when a cell button receives focus (pointer or assistive technology). */\n onCellFocus: (date: Date) => void;\n /** Called with an available cell that is clicked (Enter and Space click the focused button). */\n onPick: (date: Date) => void;\n /** Called before the grid's own key handling (the calendar's Escape levels). */\n onKeyDown?: React.KeyboardEventHandler<HTMLTableElement>;\n /** Stable classes of the grid's parts. */\n partClassNames?: CalendarPickerGridPartClassNames;\n /** Ref to the table. */\n ref?: React.Ref<HTMLTableElement>;\n}\n\n/**\n * Internal: the month view (the 12 months of a year) or the year view (a decade with the year\n * before and after it) of a calendar, a `role=\"grid\"` table of 3 rows of 4 cells with one roving\n * button in the tab order. Arrow keys move by a cell and a row (mirrored in RTL), Home/End to the\n * row's ends; PageUp/PageDown are passed to the view. Marked `data-wave-calendar-grid`, as the day\n * grid.\n */\nexport const CalendarPickerGrid = ({\n id,\n headingId,\n cells,\n focusIndex,\n onMoveFocus,\n onPage,\n onCellFocus,\n onPick,\n onKeyDown,\n partClassNames,\n ref,\n}: CalendarPickerGridProps) => {\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTableElement>) => {\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n const column = focusIndex % PICKER_COLUMNS;\n switch (event.key) {\n case 'ArrowLeft':\n case 'ArrowRight': {\n const intent = getArrowIntent(event.key, {\n orientation: 'horizontal',\n dir: getDirection(event.currentTarget),\n });\n event.preventDefault();\n onMoveFocus(intent === 'next' ? 1 : -1);\n return;\n }\n case 'ArrowDown':\n event.preventDefault();\n onMoveFocus(PICKER_COLUMNS);\n return;\n case 'ArrowUp':\n event.preventDefault();\n onMoveFocus(-PICKER_COLUMNS);\n return;\n case 'Home':\n event.preventDefault();\n onMoveFocus(-column);\n return;\n case 'End':\n event.preventDefault();\n onMoveFocus(PICKER_COLUMNS - 1 - column);\n return;\n case 'PageDown':\n case 'PageUp':\n event.preventDefault();\n onPage(event.key === 'PageDown' ? 1 : -1);\n return;\n default:\n // Enter and Space activate the focused cell button natively (click).\n }\n };\n\n const rows: CalendarPickerCell[][] = [];\n for (let i = 0; i < cells.length; i += PICKER_COLUMNS) {\n rows.push(cells.slice(i, i + PICKER_COLUMNS));\n }\n\n return (\n <table\n ref={ref}\n id={id}\n role=\"grid\"\n aria-labelledby={headingId}\n data-wave-calendar-grid=\"\"\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyDown)}\n className={cn(partClassNames?.grid, 'border-collapse')}\n >\n <tbody>\n {rows.map((row, rowIndex) => (\n // Keyed by position, so the focused button survives a change of the year or decade.\n <tr key={rowIndex}>\n {row.map((cell, column) => {\n const index = rowIndex * PICKER_COLUMNS + column;\n return (\n <td key={column} role=\"gridcell\" aria-selected={cell.selected} className=\"p-0\">\n <button\n type=\"button\"\n tabIndex={index === focusIndex ? 0 : -1}\n aria-label={cell.label}\n aria-pressed={cell.selected || undefined}\n aria-current={cell.current ? 'date' : undefined}\n {...focusableDisabledProps(cell.unavailable)}\n data-selected={cell.selected ? '' : undefined}\n data-today={cell.current ? '' : undefined}\n data-outside={cell.outside ? '' : undefined}\n onFocus={() => onCellFocus(cell.date)}\n onClick={() => {\n if (!cell.unavailable) onPick(cell.date);\n }}\n className={cn(\n partClassNames?.cell,\n PICKER_CELL_CLASSES,\n focusRing,\n disabledStyles,\n cell.selected && forcedColors.selectedLeaf,\n )}\n >\n {cell.text}\n </button>\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nCalendarPickerGrid.displayName = 'CalendarPickerGrid';\n"],"mappings":"kYAsBA,IAAM4B,EACJ,qdA0EWC,GAAmB,CAC9B,KACA,YACA,YACA,QACA,cACA,eACA,QACA,iBACA,SACA,kBAAkB,GAClB,kBAAkB,YAClB,cACA,YACA,WACA,SACA,gBACA,cACA,aACA,SACA,iBACA,SAC0B,CAC1B,IAAMC,EAAW9B,EAAM,YACfC,EAAAA,gBAAgB8B,EAAQC,CAAc,EAC5C,CAACD,EAAQC,CAAc,CACzB,EACMC,EAAW/B,EAAAA,cAAcgC,CAAW,EA0C1C,OACE,EAAAP,EAAA,KAAA,CAAC,QAAD,CACO,MACD,KACJ,KAAK,OACL,kBAAiBQ,EACjB,0BAAwB,GACxB,UA/CmB,GAAiD,CACtE,GAAIC,EAAM,QAAUA,EAAM,SAAWA,EAAM,QAAS,OACpD,IAAMC,GAAcH,EAAY,OAAO,EAAIF,EAAiB,GAAK,EAC7DM,EACJ,OAAQF,EAAM,IAAd,CACE,IAAK,YACL,IAAK,aAAc,CACjB,IAAMG,EAASpC,EAAAA,eAAeiC,EAAM,IAAK,CACvC,YAAa,aACb,IAAKhC,EAAAA,aAAagC,EAAM,aAAa,CACvC,CAAC,EACD,EAAO/B,EAAAA,QAAQ6B,EAAaK,IAAW,OAAS,EAAI,EAAE,EACtD,KACF,CACA,IAAK,YACH,EAAOlC,EAAAA,QAAQ6B,EAAa,CAAC,EAC7B,MACF,IAAK,UACH,EAAO7B,EAAAA,QAAQ6B,EAAa,EAAE,EAC9B,MACF,IAAK,WACH,EAAO5B,EAAAA,UAAU4B,EAAaE,EAAM,SAAW,GAAK,CAAC,EACrD,MACF,IAAK,SACH,EAAO9B,EAAAA,UAAU4B,EAAaE,EAAM,SAAW,IAAM,EAAE,EACvD,MACF,IAAK,OACH,EAAO/B,EAAAA,QAAQ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AAc"}
@@ -0,0 +1,194 @@
1
+ "use client";
2
+ import { cn as e } from "../../lib/cn.mjs";
3
+ import { composeEventHandlers as t } from "../../lib/composeEventHandlers.mjs";
4
+ import { addDays as n, addMonths as r, getWeekNumber as i, isSameDay as a } from "../../lib/date.mjs";
5
+ import { getArrowIntent as o, getDirection as s } from "../../lib/direction.mjs";
6
+ import { focusableDisabledProps as c } from "../../lib/aria.mjs";
7
+ import { disabledStyles as l, focusRing as u, forcedColors as d } from "../../lib/styles.mjs";
8
+ import { formatDayLabel as f, formatDayNumber as p, formatISODate as m, getWeekdayNames as h, isSameMonth as g } from "./dateUtils.mjs";
9
+ import * as _ from "react";
10
+ import { jsx as v, jsxs as y } from "react/jsx-runtime";
11
+ //#region src/components/input/Calendar.views.tsx
12
+ var b = "relative flex h-8 w-8 items-center justify-center rounded bg-transparent p-0 text-caption-1 text-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover data-[outside]:text-muted-foreground data-[today]:border data-[today]:border-primary data-[today]:font-semibold data-[selected]:bg-primary data-[selected]:font-semibold data-[selected]:text-primary-foreground not-disabled:not-aria-disabled:data-[selected]:hover:bg-primary-hover aria-disabled:line-through", x = ({ id: t, headingId: x, viewMonth: w, weeks: T, focusTarget: E, selectedDays: D, today: O, firstDayOfWeek: k, locale: A, showWeekNumbers: j = !1, firstWeekOfYear: M = "first-day", markedDates: N, renderDay: P, dayLabel: F, labels: I, isUnavailable: L, onMoveFocus: R, onDayFocus: z, onPick: B, partClassNames: V, ref: H }) => {
13
+ let U = _.useMemo(() => h(A, k), [A, k]), W = m(E);
14
+ return /* @__PURE__ */ y("table", {
15
+ ref: H,
16
+ id: t,
17
+ role: "grid",
18
+ "aria-labelledby": x,
19
+ "data-wave-calendar-grid": "",
20
+ onKeyDown: (e) => {
21
+ if (e.altKey || e.ctrlKey || e.metaKey) return;
22
+ let t = (E.getDay() - k + 7) % 7, i;
23
+ switch (e.key) {
24
+ case "ArrowLeft":
25
+ case "ArrowRight": {
26
+ let t = o(e.key, {
27
+ orientation: "horizontal",
28
+ dir: s(e.currentTarget)
29
+ });
30
+ i = n(E, t === "next" ? 1 : -1);
31
+ break;
32
+ }
33
+ case "ArrowDown":
34
+ i = n(E, 7);
35
+ break;
36
+ case "ArrowUp":
37
+ i = n(E, -7);
38
+ break;
39
+ case "PageDown":
40
+ i = r(E, e.shiftKey ? 12 : 1);
41
+ break;
42
+ case "PageUp":
43
+ i = r(E, e.shiftKey ? -12 : -1);
44
+ break;
45
+ case "Home":
46
+ i = n(E, -t);
47
+ break;
48
+ case "End":
49
+ i = n(E, 6 - t);
50
+ break;
51
+ default: return;
52
+ }
53
+ e.preventDefault(), R(i);
54
+ },
55
+ className: e(V?.grid, "border-collapse"),
56
+ children: [/* @__PURE__ */ v("thead", { children: /* @__PURE__ */ y("tr", { children: [j && /* @__PURE__ */ y("th", {
57
+ scope: "col",
58
+ className: e(V?.weekNumberHeader, "h-8 w-8 text-center text-caption-1 font-normal text-muted-foreground"),
59
+ children: [/* @__PURE__ */ v("span", {
60
+ "aria-hidden": "true",
61
+ children: "#"
62
+ }), /* @__PURE__ */ v("span", {
63
+ className: "sr-only",
64
+ children: I?.week ?? "Week"
65
+ })]
66
+ }), U.map((t) => /* @__PURE__ */ y("th", {
67
+ scope: "col",
68
+ abbr: t.long,
69
+ "aria-label": t.long,
70
+ className: e(V?.weekday, "h-8 w-8 text-center text-caption-1 font-normal text-muted-foreground"),
71
+ children: [/* @__PURE__ */ v("span", {
72
+ "aria-hidden": "true",
73
+ children: t.short
74
+ }), /* @__PURE__ */ v("span", {
75
+ className: "sr-only",
76
+ children: t.long
77
+ })]
78
+ }, t.long))] }) }), /* @__PURE__ */ v("tbody", { children: T.map((t, n) => /* @__PURE__ */ y("tr", { children: [j && /* @__PURE__ */ v("th", {
79
+ scope: "row",
80
+ "aria-label": (I?.weekNumber ?? C)(i(t[0], {
81
+ firstDayOfWeek: k,
82
+ firstWeekOfYear: M
83
+ })),
84
+ className: e(V?.weekNumber, "h-8 w-8 text-center text-caption-1 font-normal text-muted-foreground"),
85
+ children: i(t[0], {
86
+ firstDayOfWeek: k,
87
+ firstWeekOfYear: M
88
+ })
89
+ }), t.map((t, n) => {
90
+ let r = m(t), i = D.has(r), o = !!N?.(t), s = p(t, A), h = f(t, A), _ = o ? (I?.markedDay ?? S)(h) : h, x = a(t, O), C = r === W, T = L(t);
91
+ return /* @__PURE__ */ v("td", {
92
+ role: "gridcell",
93
+ "aria-selected": i,
94
+ className: "p-0",
95
+ children: /* @__PURE__ */ y("button", {
96
+ type: "button",
97
+ tabIndex: C ? 0 : -1,
98
+ "aria-label": F ? F(t, _) : _,
99
+ "aria-pressed": i || void 0,
100
+ "aria-current": x ? "date" : void 0,
101
+ ...c(T),
102
+ "data-date": r,
103
+ "data-selected": i ? "" : void 0,
104
+ "data-today": x ? "" : void 0,
105
+ "data-marked": o ? "" : void 0,
106
+ "data-outside": g(t, w) ? void 0 : "",
107
+ onFocus: () => z(t),
108
+ onClick: () => {
109
+ T || B(t);
110
+ },
111
+ className: e(V?.day, b, u, l, i && d.selectedLeaf),
112
+ children: [P ? P(t, s) : s, o && /* @__PURE__ */ v("span", {
113
+ "aria-hidden": "true",
114
+ className: e(V?.markedDot, "pointer-events-none absolute inset-x-0 bottom-0.5 mx-auto h-1 w-1 rounded-full bg-current forced-colors:forced-color-adjust-none")
115
+ })]
116
+ })
117
+ }, n);
118
+ })] }, n)) })]
119
+ });
120
+ };
121
+ x.displayName = "CalendarDayGrid";
122
+ var S = (e) => `${e}, marked`, C = (e) => `Week ${e}`, w = "flex h-12 w-14 items-center justify-center rounded bg-transparent p-0 text-caption-1 text-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover data-[outside]:text-muted-foreground data-[today]:border data-[today]:border-primary data-[today]:font-semibold data-[selected]:bg-primary data-[selected]:font-semibold data-[selected]:text-primary-foreground not-disabled:not-aria-disabled:data-[selected]:hover:bg-primary-hover aria-disabled:line-through", T = 4, E = ({ id: n, headingId: r, cells: i, focusIndex: a, onMoveFocus: f, onPage: p, onCellFocus: m, onPick: h, onKeyDown: g, partClassNames: _, ref: y }) => {
123
+ let b = (e) => {
124
+ if (e.altKey || e.ctrlKey || e.metaKey) return;
125
+ let t = a % T;
126
+ switch (e.key) {
127
+ case "ArrowLeft":
128
+ case "ArrowRight": {
129
+ let t = o(e.key, {
130
+ orientation: "horizontal",
131
+ dir: s(e.currentTarget)
132
+ });
133
+ e.preventDefault(), f(t === "next" ? 1 : -1);
134
+ return;
135
+ }
136
+ case "ArrowDown":
137
+ e.preventDefault(), f(T);
138
+ return;
139
+ case "ArrowUp":
140
+ e.preventDefault(), f(-4);
141
+ return;
142
+ case "Home":
143
+ e.preventDefault(), f(-t);
144
+ return;
145
+ case "End":
146
+ e.preventDefault(), f(3 - t);
147
+ return;
148
+ case "PageDown":
149
+ case "PageUp":
150
+ e.preventDefault(), p(e.key === "PageDown" ? 1 : -1);
151
+ return;
152
+ }
153
+ }, x = [];
154
+ for (let e = 0; e < i.length; e += T) x.push(i.slice(e, e + T));
155
+ return /* @__PURE__ */ v("table", {
156
+ ref: y,
157
+ id: n,
158
+ role: "grid",
159
+ "aria-labelledby": r,
160
+ "data-wave-calendar-grid": "",
161
+ onKeyDown: t(g, b),
162
+ className: e(_?.grid, "border-collapse"),
163
+ children: /* @__PURE__ */ v("tbody", { children: x.map((t, n) => /* @__PURE__ */ v("tr", { children: t.map((t, r) => {
164
+ let i = n * T + r;
165
+ return /* @__PURE__ */ v("td", {
166
+ role: "gridcell",
167
+ "aria-selected": t.selected,
168
+ className: "p-0",
169
+ children: /* @__PURE__ */ v("button", {
170
+ type: "button",
171
+ tabIndex: i === a ? 0 : -1,
172
+ "aria-label": t.label,
173
+ "aria-pressed": t.selected || void 0,
174
+ "aria-current": t.current ? "date" : void 0,
175
+ ...c(t.unavailable),
176
+ "data-selected": t.selected ? "" : void 0,
177
+ "data-today": t.current ? "" : void 0,
178
+ "data-outside": t.outside ? "" : void 0,
179
+ onFocus: () => m(t.date),
180
+ onClick: () => {
181
+ t.unavailable || h(t.date);
182
+ },
183
+ className: e(_?.cell, w, u, l, t.selected && d.selectedLeaf),
184
+ children: t.text
185
+ })
186
+ }, r);
187
+ }) }, n)) })
188
+ });
189
+ };
190
+ E.displayName = "CalendarPickerGrid";
191
+ //#endregion
192
+ export { x as CalendarDayGrid, E as CalendarPickerGrid };
193
+
194
+ //# sourceMappingURL=Calendar.views.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Calendar.views.mjs","names":["React","DAY_CLASSES","CalendarDayGrid","weekdays","getWeekdayNames","locale","firstDayOfWeek","focusIso","formatISODate","focusTarget","headingId","event","weekOffset","next","intent","getArrowIntent","getDirection","addDays","addMonths","onMoveFocus","cn","partClassNames","showWeekNumbers","labels","weekday","weeks","defaultWeekNumber","getWeekNumber","week","iso","day","isSelected","selectedDays","isMarked","markedDates","number","formatDayNumber","baseLabel","formatDayLabel","defaultLabel","defaultMarkedDay","isToday","isSameDay","today","isFocused","unavailable","isUnavailable","dayLabel","focusableDisabledProps","isSameMonth","viewMonth","onDayFocus","onPick","focusRing","disabledStyles","forcedColors","renderDay","column","row","PICKER_CELL_CLASSES","PICKER_COLUMNS","CalendarPickerGrid","handleKeyDown","focusIndex","onPage","rows","i","cells","composeEventHandlers","onKeyDown","index","rowIndex","cell","onCellFocus"],"sources":["../../../src/components/input/Calendar.views.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { DayOfWeek, FirstWeekOfYear } from '../../lib/types';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { focusableDisabledProps } from '../../lib/aria';\nimport { getArrowIntent, getDirection } from '../../lib/direction';\nimport { disabledStyles, focusRing, forcedColors } from '../../lib/styles';\nimport { getWeekNumber } from '../../lib/date';\nimport type { CalendarLabels } from './Calendar';\nimport {\n addDays,\n addMonths,\n formatDayLabel,\n formatDayNumber,\n formatISODate,\n getWeekdayNames,\n isSameDay,\n isSameMonth,\n} from './dateUtils';\n\n// An unavailable day stays focusable in the roving grid (`aria-disabled`); the day button adds\n// `disabledStyles`, whose dimmed look lifts while the focus ring shows (opacity would dim the ring).\nconst DAY_CLASSES =\n 'relative flex h-8 w-8 items-center justify-center rounded bg-transparent p-0 text-caption-1 text-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover data-[outside]:text-muted-foreground data-[today]:border data-[today]:border-primary data-[today]:font-semibold data-[selected]:bg-primary data-[selected]:font-semibold data-[selected]:text-primary-foreground not-disabled:not-aria-disabled:data-[selected]:hover:bg-primary-hover aria-disabled:line-through';\n\n/** Internal: the stable classes of the day view's parts (see `CalendarDayGridProps.partClassNames`). */\nexport interface CalendarDayGridPartClassNames {\n /** On the `role=\"grid\"` table. */\n grid?: string;\n /** On each weekday header cell. */\n weekday?: string;\n /** On each day button. */\n day?: string;\n /** On the header cell of the week-number column. */\n weekNumberHeader?: string;\n /** On each week's row header (its number). */\n weekNumber?: string;\n /** On the dot inside the button of a marked day. */\n markedDot?: string;\n}\n\n/** Internal props of {@link CalendarDayGrid}. */\nexport interface CalendarDayGridProps {\n /** Id of the table (the header's month buttons control it). */\n id: string;\n /** Id of the month heading, which labels the table. */\n headingId: string;\n /** The month the grid shows; days of other months are marked `data-outside`. */\n viewMonth: Date;\n /** The 42 days of the grid as 6 weeks. */\n weeks: Date[][];\n /** The roving day: the only day button in the tab order, and the start of the arrow keys. */\n focusTarget: Date;\n /**\n * The selected days as ISO dates (`yyyy-mm-dd`): `aria-selected` on their cells, `aria-pressed`\n * and `data-selected` on their buttons.\n */\n selectedDays: ReadonlySet<string>;\n /** Today's day (`aria-current=\"date\"`), or `null` while it is unknown (no day is marked). */\n today: Date | null;\n /** First day of the week, the first column (Home and End move to the row's ends). */\n firstDayOfWeek: DayOfWeek;\n /** BCP 47 locale of the weekday names, the day numbers and the day labels. */\n locale?: string;\n /** Adds a leading column of week numbers. @default false */\n showWeekNumbers?: boolean;\n /** Which week is week 1 of a year. @default 'first-day' */\n firstWeekOfYear?: FirstWeekOfYear;\n /** Returns `true` for days that draw a dot and are named \"marked\". */\n markedDates?: (date: Date) => boolean;\n /** Replaces the content of a day button (`defaultContent` is the day number). */\n renderDay?: (date: Date, defaultContent: React.ReactNode) => React.ReactNode;\n /** The accessible name of a day, from its default name (marked included). */\n dayLabel?: (date: Date, defaultLabel: string) => string;\n /** Names of the week-number column and the marked days. */\n labels?: CalendarLabels;\n /** Whether a day cannot be picked; it stays focusable and is `aria-disabled`. */\n isUnavailable: (date: Date) => boolean;\n /** Called with the day a key moves to (before clamping into the bounds). */\n onMoveFocus: (date: Date) => void;\n /** Called when a day button receives focus (pointer or assistive technology). */\n onDayFocus: (date: Date) => void;\n /** Called with an available day that is clicked (Enter and Space click the focused button). */\n onPick: (date: Date) => void;\n /** Stable classes of the grid's parts, from the component that renders the view. */\n partClassNames?: CalendarDayGridPartClassNames;\n /** Ref to the table. */\n ref?: React.Ref<HTMLTableElement>;\n}\n\n/**\n * Internal: the day view of a calendar, a `role=\"grid\"` table of 6 weeks with one roving day\n * button in the tab order. Arrow keys move by day and week (mirrored in RTL), PageUp/PageDown by\n * month, Shift+PageUp/PageDown by year, Home/End to the start and end of the week; Enter and Space\n * click the focused day button. Marked `data-wave-calendar-grid`, so a surrounding focus trap\n * finds its tab stop.\n */\nexport const CalendarDayGrid = ({\n id,\n headingId,\n viewMonth,\n weeks,\n focusTarget,\n selectedDays,\n today,\n firstDayOfWeek,\n locale,\n showWeekNumbers = false,\n firstWeekOfYear = 'first-day',\n markedDates,\n renderDay,\n dayLabel,\n labels,\n isUnavailable,\n onMoveFocus,\n onDayFocus,\n onPick,\n partClassNames,\n ref,\n}: CalendarDayGridProps) => {\n const weekdays = React.useMemo(\n () => getWeekdayNames(locale, firstDayOfWeek),\n [locale, firstDayOfWeek],\n );\n const focusIso = formatISODate(focusTarget);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTableElement>) => {\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n const weekOffset = (focusTarget.getDay() - firstDayOfWeek + 7) % 7;\n let next: Date;\n switch (event.key) {\n case 'ArrowLeft':\n case 'ArrowRight': {\n const intent = getArrowIntent(event.key, {\n orientation: 'horizontal',\n dir: getDirection(event.currentTarget),\n });\n next = addDays(focusTarget, intent === 'next' ? 1 : -1);\n break;\n }\n case 'ArrowDown':\n next = addDays(focusTarget, 7);\n break;\n case 'ArrowUp':\n next = addDays(focusTarget, -7);\n break;\n case 'PageDown':\n next = addMonths(focusTarget, event.shiftKey ? 12 : 1);\n break;\n case 'PageUp':\n next = addMonths(focusTarget, event.shiftKey ? -12 : -1);\n break;\n case 'Home':\n next = addDays(focusTarget, -weekOffset);\n break;\n case 'End':\n next = addDays(focusTarget, 6 - weekOffset);\n break;\n default:\n // Enter and Space activate the focused day button natively (click).\n return;\n }\n event.preventDefault();\n onMoveFocus(next);\n };\n\n return (\n <table\n ref={ref}\n id={id}\n role=\"grid\"\n aria-labelledby={headingId}\n data-wave-calendar-grid=\"\"\n onKeyDown={handleKeyDown}\n className={cn(partClassNames?.grid, 'border-collapse')}\n >\n <thead>\n <tr>\n {showWeekNumbers && (\n // The weekday headers' pattern: a visible symbol hidden from assistive technology and\n // a visually hidden name (an aria-label alone on an empty header fails axe).\n <th\n scope=\"col\"\n className={cn(\n partClassNames?.weekNumberHeader,\n 'h-8 w-8 text-center text-caption-1 font-normal text-muted-foreground',\n )}\n >\n <span aria-hidden=\"true\">#</span>\n <span className=\"sr-only\">{labels?.week ?? 'Week'}</span>\n </th>\n )}\n {weekdays.map((weekday) => (\n <th\n key={weekday.long}\n scope=\"col\"\n abbr={weekday.long}\n aria-label={weekday.long}\n className={cn(\n partClassNames?.weekday,\n 'h-8 w-8 text-center text-caption-1 font-normal text-muted-foreground',\n )}\n >\n <span aria-hidden=\"true\">{weekday.short}</span>\n <span className=\"sr-only\">{weekday.long}</span>\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {weeks.map((week, row) => (\n // Rows and cells are keyed by position, so the focused button survives a month change\n // and focus stays in the grid while it moves to the new day.\n <tr key={row}>\n {showWeekNumbers && (\n <th\n scope=\"row\"\n aria-label={(labels?.weekNumber ?? defaultWeekNumber)(\n getWeekNumber(week[0], { firstDayOfWeek, firstWeekOfYear }),\n )}\n className={cn(\n partClassNames?.weekNumber,\n 'h-8 w-8 text-center text-caption-1 font-normal text-muted-foreground',\n )}\n >\n {getWeekNumber(week[0], { firstDayOfWeek, firstWeekOfYear })}\n </th>\n )}\n {week.map((day, column) => {\n const iso = formatISODate(day);\n const isSelected = selectedDays.has(iso);\n const isMarked = !!markedDates?.(day);\n const number = formatDayNumber(day, locale);\n const baseLabel = formatDayLabel(day, locale);\n const defaultLabel = isMarked\n ? (labels?.markedDay ?? defaultMarkedDay)(baseLabel)\n : baseLabel;\n const isToday = isSameDay(day, today);\n const isFocused = iso === focusIso;\n const unavailable = isUnavailable(day);\n return (\n <td key={column} role=\"gridcell\" aria-selected={isSelected} className=\"p-0\">\n {/* Focus rests on the button, and screen readers do not reliably announce the\n gridcell's aria-selected from inside it: the selected day's button is also\n pressed. */}\n <button\n type=\"button\"\n tabIndex={isFocused ? 0 : -1}\n aria-label={dayLabel ? dayLabel(day, defaultLabel) : defaultLabel}\n aria-pressed={isSelected || undefined}\n aria-current={isToday ? 'date' : undefined}\n {...focusableDisabledProps(unavailable)}\n data-date={iso}\n data-selected={isSelected ? '' : undefined}\n data-today={isToday ? '' : undefined}\n data-marked={isMarked ? '' : undefined}\n data-outside={isSameMonth(day, viewMonth) ? undefined : ''}\n onFocus={() => onDayFocus(day)}\n onClick={() => {\n if (!unavailable) onPick(day);\n }}\n className={cn(\n partClassNames?.day,\n DAY_CLASSES,\n focusRing,\n disabledStyles,\n isSelected && forcedColors.selectedLeaf,\n )}\n >\n {renderDay ? renderDay(day, number) : number}\n {isMarked && (\n // Decorative: the day's name says \"marked\". It is drawn in the text colour\n // of the day, so it follows the selected and forced-colors looks.\n <span\n aria-hidden=\"true\"\n className={cn(\n partClassNames?.markedDot,\n 'pointer-events-none absolute inset-x-0 bottom-0.5 mx-auto h-1 w-1 rounded-full bg-current forced-colors:forced-color-adjust-none',\n )}\n />\n )}\n </button>\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nCalendarDayGrid.displayName = 'CalendarDayGrid';\n\nconst defaultMarkedDay = (dayLabel: string) => `${dayLabel}, marked`;\nconst defaultWeekNumber = (week: number) => `Week ${week}`;\n\n// The month and year cells: the day buttons' look in a wider cell (C-NATIVE padding and\n// background, the gated hover, the selected fill, and an unavailable cell struck through besides\n// the dimming of `disabledStyles`).\nconst PICKER_CELL_CLASSES =\n 'flex h-12 w-14 items-center justify-center rounded bg-transparent p-0 text-caption-1 text-foreground not-disabled:not-aria-disabled:hover:bg-subtle-hover data-[outside]:text-muted-foreground data-[today]:border data-[today]:border-primary data-[today]:font-semibold data-[selected]:bg-primary data-[selected]:font-semibold data-[selected]:text-primary-foreground not-disabled:not-aria-disabled:data-[selected]:hover:bg-primary-hover aria-disabled:line-through';\n\n/** The cells of a row of the month and year grids. */\nconst PICKER_COLUMNS = 4;\n\n/** Internal: one cell of the month or the year grid. */\nexport interface CalendarPickerCell {\n /** The month (its 1st) or the year (its January 1). */\n date: Date;\n /** The visible text (`Jun`, `2025`). */\n text: string;\n /** The accessible name when it differs from the text (`June 2025`). */\n label?: string;\n /** The value's month or year (`aria-selected` on the cell, `aria-pressed` on the button). */\n selected: boolean;\n /** Today's month or year (`aria-current=\"date\"`). */\n current: boolean;\n /** A year before or after the decade (muted). */\n outside: boolean;\n /** Wholly outside `minDate`/`maxDate`: `aria-disabled`, focusable, not pickable. */\n unavailable: boolean;\n}\n\n/** Internal: the stable classes of a month or year grid's parts. */\nexport interface CalendarPickerGridPartClassNames {\n /** On the `role=\"grid\"` table. */\n grid?: string;\n /** On each cell button. */\n cell?: string;\n}\n\n/** Internal props of {@link CalendarPickerGrid}. */\nexport interface CalendarPickerGridProps {\n /** Id of the table (the header's buttons control it). */\n id: string;\n /** Id of the heading, which labels the table. */\n headingId: string;\n /** The 12 cells, in reading order (3 rows of 4). */\n cells: readonly CalendarPickerCell[];\n /** Index of the roving cell: the only cell button in the tab order. */\n focusIndex: number;\n /** Called with the number of cells a key moves by (arrows, Home and End). */\n onMoveFocus: (delta: number) => void;\n /** Called with the direction of PageUp (`-1`) and PageDown (`1`). */\n onPage: (direction: -1 | 1) => void;\n /** Called when a cell button receives focus (pointer or assistive technology). */\n onCellFocus: (date: Date) => void;\n /** Called with an available cell that is clicked (Enter and Space click the focused button). */\n onPick: (date: Date) => void;\n /** Called before the grid's own key handling (the calendar's Escape levels). */\n onKeyDown?: React.KeyboardEventHandler<HTMLTableElement>;\n /** Stable classes of the grid's parts. */\n partClassNames?: CalendarPickerGridPartClassNames;\n /** Ref to the table. */\n ref?: React.Ref<HTMLTableElement>;\n}\n\n/**\n * Internal: the month view (the 12 months of a year) or the year view (a decade with the year\n * before and after it) of a calendar, a `role=\"grid\"` table of 3 rows of 4 cells with one roving\n * button in the tab order. Arrow keys move by a cell and a row (mirrored in RTL), Home/End to the\n * row's ends; PageUp/PageDown are passed to the view. Marked `data-wave-calendar-grid`, as the day\n * grid.\n */\nexport const CalendarPickerGrid = ({\n id,\n headingId,\n cells,\n focusIndex,\n onMoveFocus,\n onPage,\n onCellFocus,\n onPick,\n onKeyDown,\n partClassNames,\n ref,\n}: CalendarPickerGridProps) => {\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTableElement>) => {\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n const column = focusIndex % PICKER_COLUMNS;\n switch (event.key) {\n case 'ArrowLeft':\n case 'ArrowRight': {\n const intent = getArrowIntent(event.key, {\n orientation: 'horizontal',\n dir: getDirection(event.currentTarget),\n });\n event.preventDefault();\n onMoveFocus(intent === 'next' ? 1 : -1);\n return;\n }\n case 'ArrowDown':\n event.preventDefault();\n onMoveFocus(PICKER_COLUMNS);\n return;\n case 'ArrowUp':\n event.preventDefault();\n onMoveFocus(-PICKER_COLUMNS);\n return;\n case 'Home':\n event.preventDefault();\n onMoveFocus(-column);\n return;\n case 'End':\n event.preventDefault();\n onMoveFocus(PICKER_COLUMNS - 1 - column);\n return;\n case 'PageDown':\n case 'PageUp':\n event.preventDefault();\n onPage(event.key === 'PageDown' ? 1 : -1);\n return;\n default:\n // Enter and Space activate the focused cell button natively (click).\n }\n };\n\n const rows: CalendarPickerCell[][] = [];\n for (let i = 0; i < cells.length; i += PICKER_COLUMNS) {\n rows.push(cells.slice(i, i + PICKER_COLUMNS));\n }\n\n return (\n <table\n ref={ref}\n id={id}\n role=\"grid\"\n aria-labelledby={headingId}\n data-wave-calendar-grid=\"\"\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyDown)}\n className={cn(partClassNames?.grid, 'border-collapse')}\n >\n <tbody>\n {rows.map((row, rowIndex) => (\n // Keyed by position, so the focused button survives a change of the year or decade.\n <tr key={rowIndex}>\n {row.map((cell, column) => {\n const index = rowIndex * PICKER_COLUMNS + column;\n return (\n <td key={column} role=\"gridcell\" aria-selected={cell.selected} className=\"p-0\">\n <button\n type=\"button\"\n tabIndex={index === focusIndex ? 0 : -1}\n aria-label={cell.label}\n aria-pressed={cell.selected || undefined}\n aria-current={cell.current ? 'date' : undefined}\n {...focusableDisabledProps(cell.unavailable)}\n data-selected={cell.selected ? '' : undefined}\n data-today={cell.current ? '' : undefined}\n data-outside={cell.outside ? '' : undefined}\n onFocus={() => onCellFocus(cell.date)}\n onClick={() => {\n if (!cell.unavailable) onPick(cell.date);\n }}\n className={cn(\n partClassNames?.cell,\n PICKER_CELL_CLASSES,\n focusRing,\n disabledStyles,\n cell.selected && forcedColors.selectedLeaf,\n )}\n >\n {cell.text}\n </button>\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nCalendarPickerGrid.displayName = 'CalendarPickerGrid';\n"],"mappings":";;;;;;;;;;;AAsBA,IAAMC,IACJ,sdA0EWC,KAAmB,EAC9B,OACA,cACA,cACA,UACA,gBACA,iBAC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U,KAAK,KAAA;KAChC,gBAAcA,EAAK,UAAU,KAAK,KAAA;KAClC,eAAeC,EAAYD,EAAK,IAAI;KACpC,eAAe;MACb,AAAKA,EAAK,eAAapB,EAAOoB,EAAK,IAAI;KACzC;KACA,WAAWpD,EACTC,GAAgB,MAChBsC,GACAN,GACAC,GACAkB,EAAK,YAAYjB,EAAa,YAChC;KAEC,UAAAiB,EAAK;IACA,CAAA;GACN,GAzBKf,CAyBL;EAER,CAAC,EACC,GAhCKc,CAgCL,CACL,EACI,CAAA;CACF,CAAA;AAEX;AAEA,EAAmB,cAAc"}
@@ -1,2 +1,2 @@
1
- "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/composeEventHandlers.cjs"),r=require("../../lib/classNames.cjs"),i=require("../../lib/color.cjs"),a=require("../../hooks/useEventCallback.cjs"),o=require("../../lib/direction.cjs"),s=require("../../hooks/useMergedRefs.cjs"),c=require("../../hooks/useFieldControl.cjs"),ee=require("../../hooks/useMediaQuery.cjs"),l=require("../../hooks/useFormReset.cjs"),u=require("../internal/HiddenInput.cjs"),d=require("./colorUtils.cjs"),f=require("./ColorPicker.parts.cjs"),p=require("../../lib/events.cjs");let m=require("react");m=e.__toESM(m,1);let h=require("react/jsx-runtime");var te={saturation:`Saturation`,brightness:`Brightness`,roleDescription:`2D slider`};function g(e){return Math.min(100,Math.max(0,e))}var _=`(pointer: coarse)`,v=({value:e,defaultValue:v,onValueChange:y,shape:b,labels:x,disabled:S=!1,name:C,form:w,required:ne,controlRef:re,className:ie,style:ae,id:oe,"aria-label":se,"aria-labelledby":T,"aria-describedby":ce,"aria-invalid":le,"aria-required":E,"aria-errormessage":ue,autoFocus:de,tabIndex:fe,onKeyDown:D,onPointerDown:O,onPointerMove:k,ref:A,...j})=>{let M=f.useColorPartState({value:e,defaultValue:v,onValueChange:y,disabled:S}),{picker:N}=M,P={...te,...N&&{saturation:N.labels.saturation,brightness:N.labels.brightness,roleDescription:N.labels.roleDescription,colorName:N.labels.colorName,valueText:N.labels.valueText},...x},F=b??N?.shape??`rounded`,I=M.color,L=d.displayColor(I),R=d.toPercent(L.s),z=d.toPercent(L.v),[B,V]=m.useState(`saturation`),pe=ee.useMediaQuery(_),H=m.useRef(null),[U,me]=m.useState(0),W=m.useRef(null),G=m.useRef(null),K=m.useRef(null),he=s.useMergedRefs(A,W),ge=s.useMergedRefs(G,re),q=m.useRef(0);m.useLayoutEffect(()=>{q.current!==U&&(q.current=U,(B===`saturation`?G:K).current?.focus({preventScroll:!0}))},[B,U]);let _e=c.useFieldContext(),{"aria-invalid":J,"aria-required":ve,required:ye,...be}=c.useFieldControl({id:oe,"aria-label":se??(N&&T===void 0?N.labels.area:void 0),"aria-labelledby":T,"aria-describedby":ce,"aria-invalid":le},{labelable:!1}),xe=J!==void 0&&J!==!1&&J!==`false`&&ue||void 0,Se=ne??(E===!0||E===`true`||(_e?.required??!1));l.useFormReset(W,M.reset,w);let Y=(e,t)=>{t!==(e===`saturation`?R:z)&&M.setColor(e===`saturation`?{...I,s:t/100}:{...I,v:t/100})},Ce=n.composeEventHandlers(D,e=>{if(M.disabled||!p.isOwnEvent(e)||e.nativeEvent.isComposing||e.altKey||e.ctrlKey||e.metaKey)return;let t=e.shiftKey?10:1,n,r;switch(e.key){case`ArrowLeft`:case`ArrowRight`:{let i=o.getArrowIntent(e.key,{orientation:`horizontal`,dir:o.getDirection(e.currentTarget)});n=`saturation`,r=R+(i===`next`?t:-t);break}case`ArrowUp`:n=`value`,r=z+t;break;case`ArrowDown`:n=`value`,r=z-t;break;case`PageUp`:n=`value`,r=z+10;break;case`PageDown`:n=`value`,r=z-10;break;case`Home`:n=`saturation`,r=0;break;case`End`:n=`saturation`,r=100;break;default:return}e.preventDefault(),n!==B&&V(n),me(e=>e+1),Y(n,g(r))}),X=e=>t=>{M.disabled||(e!==B&&V(e),Y(e,g(Math.round(Number(t.currentTarget.value)))))},we=e=>()=>{e!==B&&V(e)},Z=a.useEventCallback(e=>{let t=H.current;if(!t)return;let n=t.getBoundingClientRect();if(n.width<=0||n.height<=0)return;let r=Math.min(1,Math.max(0,(e.clientX-n.left)/n.width)),i=o.getDirection(e.currentTarget)===`rtl`?1-r:r,a=Math.min(1,Math.max(0,1-(e.clientY-n.top)/n.height));(i!==L.s||a!==L.v)&&M.setColor({...I,s:i,v:a})}),Te=a.useEventCallback(()=>{(B===`saturation`?G:K).current?.focus({preventScroll:!0,focusVisible:!1})}),Ee=n.composeEventHandlers(O,e=>{!M.disabled&&e.button===0&&e.isPrimary&&p.isOwnEvent(e)&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),Z(e),Te())}),De=n.composeEventHandlers(k,e=>{!M.disabled&&e.currentTarget.hasPointerCapture(e.pointerId)&&Z(e)}),Q={saturation:P.saturation,brightness:P.brightness,colorName:P.colorName,valueText:P.valueText},Oe={...ae,"--wave-color-area-gradient":d.colorAreaGradient(L.h),"--wave-color-area-x":d.toPosition(L.s),"--wave-color-area-y":d.toPosition(L.v),"--wave-color-thumb":i.hsvToHex({h:L.h,s:L.s,v:L.v})},$=e=>({type:`range`,min:0,max:100,step:1,disabled:M.disabled,"aria-roledescription":P.roleDescription,"aria-invalid":J,"aria-errormessage":xe,tabIndex:e===B?fe??0:-1,"aria-hidden":e!==B&&!pe||void 0,onChange:X(e),onFocus:we(e),className:`sr-only`});return(0,h.jsxs)(`div`,{role:`group`,"data-disabled":M.disabled?``:void 0,...be,className:t.cn(r.colorAreaClassNames.root,`group/color-area relative h-40 w-full min-w-40 touch-none select-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,F===`square`?`rounded-none`:`rounded`,ie),style:Oe,...j,ref:he,onKeyDown:Ce,onPointerDown:Ee,onPointerMove:De,children:[(0,h.jsx)(`div`,{ref:H,"aria-hidden":`true`,className:t.cn(r.colorAreaClassNames.field,`absolute inset-0 rounded-[inherit] bg-(image:--wave-color-area-gradient) wave-rtl:-scale-x-100 forced-colors:forced-color-adjust-none`)}),(0,h.jsx)(`span`,{"aria-hidden":`true`,className:t.cn(r.colorAreaClassNames.thumb,d.COLOR_THUMB_CLASSES,`start-(--wave-color-area-x) bottom-(--wave-color-area-y) -translate-x-1/2 wave-rtl:translate-x-1/2 translate-y-1/2`,`group-has-[:focus-visible]/color-area:ring-2 group-has-[:focus-visible]/color-area:ring-background forced-colors:group-has-[:focus-visible]/color-area:ring-[Canvas] group-has-[:focus-visible]/color-area:outline-2 group-has-[:focus-visible]/color-area:outline-offset-2 group-has-[:focus-visible]/color-area:outline-ring forced-colors:group-has-[:focus-visible]/color-area:outline-[Highlight]`)}),(0,h.jsx)(`input`,{...$(`saturation`),ref:ge,value:R,"aria-label":P.saturation,"aria-valuetext":d.areaValueText(L,`saturation`,Q),autoFocus:de}),(0,h.jsx)(`input`,{...$(`value`),ref:K,value:z,"aria-label":P.brightness,"aria-orientation":`vertical`,"aria-valuetext":d.areaValueText(L,`value`,Q)}),!N&&(0,h.jsx)(u.HiddenInput,{type:`text`,name:C,form:w,disabled:M.disabled,value:i.hsvToHex(I),required:Se,onInvalid:()=>(B===`saturation`?G:K).current?.focus()})]})};v.displayName=`ColorArea`,exports.ColorArea=v;
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/cn.cjs"),n=require("../../lib/composeEventHandlers.cjs"),r=require("../../lib/classNames.cjs"),i=require("../../lib/color.cjs"),a=require("../../hooks/useEventCallback.cjs"),o=require("../../lib/direction.cjs"),s=require("../../hooks/useMergedRefs.cjs"),c=require("../../hooks/useFieldControl.cjs"),ee=require("../../hooks/useMediaQuery.cjs"),l=require("../../hooks/useFormReset.cjs"),u=require("../internal/HiddenInput.cjs"),d=require("../../lib/events.cjs"),f=require("./colorUtils.cjs"),p=require("./ColorPicker.parts.cjs");let m=require("react");m=e.__toESM(m,1);let h=require("react/jsx-runtime");var te={saturation:`Saturation`,brightness:`Brightness`,roleDescription:`2D slider`};function g(e){return Math.min(100,Math.max(0,e))}var _=`(pointer: coarse)`,v=({value:e,defaultValue:v,onValueChange:y,shape:b,labels:x,disabled:S=!1,name:C,form:w,required:ne,controlRef:re,className:ie,style:ae,id:oe,"aria-label":se,"aria-labelledby":T,"aria-describedby":ce,"aria-invalid":le,"aria-required":E,"aria-errormessage":ue,autoFocus:de,tabIndex:fe,onKeyDown:D,onPointerDown:O,onPointerMove:k,ref:A,...j})=>{let M=p.useColorPartState({value:e,defaultValue:v,onValueChange:y,disabled:S}),{picker:N}=M,P={...te,...N&&{saturation:N.labels.saturation,brightness:N.labels.brightness,roleDescription:N.labels.roleDescription,colorName:N.labels.colorName,valueText:N.labels.valueText},...x},F=b??N?.shape??`rounded`,I=M.color,L=f.displayColor(I),R=f.toPercent(L.s),z=f.toPercent(L.v),[B,V]=m.useState(`saturation`),pe=ee.useMediaQuery(_),H=m.useRef(null),[U,me]=m.useState(0),W=m.useRef(null),G=m.useRef(null),K=m.useRef(null),he=s.useMergedRefs(A,W),ge=s.useMergedRefs(G,re),q=m.useRef(0);m.useLayoutEffect(()=>{q.current!==U&&(q.current=U,(B===`saturation`?G:K).current?.focus({preventScroll:!0}))},[B,U]);let _e=c.useFieldContext(),{"aria-invalid":J,"aria-required":ve,required:ye,...be}=c.useFieldControl({id:oe,"aria-label":se??(N&&T===void 0?N.labels.area:void 0),"aria-labelledby":T,"aria-describedby":ce,"aria-invalid":le},{labelable:!1}),xe=J!==void 0&&J!==!1&&J!==`false`&&ue||void 0,Se=ne??(E===!0||E===`true`||(_e?.required??!1));l.useFormReset(W,M.reset,w);let Y=(e,t)=>{t!==(e===`saturation`?R:z)&&M.setColor(e===`saturation`?{...I,s:t/100}:{...I,v:t/100})},Ce=n.composeEventHandlers(D,e=>{if(M.disabled||!d.isOwnEvent(e)||e.nativeEvent.isComposing||e.altKey||e.ctrlKey||e.metaKey)return;let t=e.shiftKey?10:1,n,r;switch(e.key){case`ArrowLeft`:case`ArrowRight`:{let i=o.getArrowIntent(e.key,{orientation:`horizontal`,dir:o.getDirection(e.currentTarget)});n=`saturation`,r=R+(i===`next`?t:-t);break}case`ArrowUp`:n=`value`,r=z+t;break;case`ArrowDown`:n=`value`,r=z-t;break;case`PageUp`:n=`value`,r=z+10;break;case`PageDown`:n=`value`,r=z-10;break;case`Home`:n=`saturation`,r=0;break;case`End`:n=`saturation`,r=100;break;default:return}e.preventDefault(),n!==B&&V(n),me(e=>e+1),Y(n,g(r))}),X=e=>t=>{M.disabled||(e!==B&&V(e),Y(e,g(Math.round(Number(t.currentTarget.value)))))},we=e=>()=>{e!==B&&V(e)},Z=a.useEventCallback(e=>{let t=H.current;if(!t)return;let n=t.getBoundingClientRect();if(n.width<=0||n.height<=0)return;let r=Math.min(1,Math.max(0,(e.clientX-n.left)/n.width)),i=o.getDirection(e.currentTarget)===`rtl`?1-r:r,a=Math.min(1,Math.max(0,1-(e.clientY-n.top)/n.height));(i!==L.s||a!==L.v)&&M.setColor({...I,s:i,v:a})}),Te=a.useEventCallback(()=>{(B===`saturation`?G:K).current?.focus({preventScroll:!0,focusVisible:!1})}),Ee=n.composeEventHandlers(O,e=>{!M.disabled&&e.button===0&&e.isPrimary&&d.isOwnEvent(e)&&(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),Z(e),Te())}),De=n.composeEventHandlers(k,e=>{!M.disabled&&e.currentTarget.hasPointerCapture(e.pointerId)&&Z(e)}),Q={saturation:P.saturation,brightness:P.brightness,colorName:P.colorName,valueText:P.valueText},Oe={...ae,"--wave-color-area-gradient":f.colorAreaGradient(L.h),"--wave-color-area-x":f.toPosition(L.s),"--wave-color-area-y":f.toPosition(L.v),"--wave-color-thumb":i.hsvToHex({h:L.h,s:L.s,v:L.v})},$=e=>({type:`range`,min:0,max:100,step:1,disabled:M.disabled,"aria-roledescription":P.roleDescription,"aria-invalid":J,"aria-errormessage":xe,tabIndex:e===B?fe??0:-1,"aria-hidden":e!==B&&!pe||void 0,onChange:X(e),onFocus:we(e),className:`sr-only`});return(0,h.jsxs)(`div`,{role:`group`,"data-disabled":M.disabled?``:void 0,...be,className:t.cn(r.colorAreaClassNames.root,`group/color-area relative h-40 w-full min-w-40 touch-none select-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,F===`square`?`rounded-none`:`rounded`,ie),style:Oe,...j,ref:he,onKeyDown:Ce,onPointerDown:Ee,onPointerMove:De,children:[(0,h.jsx)(`div`,{ref:H,"aria-hidden":`true`,className:t.cn(r.colorAreaClassNames.field,`absolute inset-0 rounded-[inherit] bg-(image:--wave-color-area-gradient) wave-rtl:-scale-x-100 forced-colors:forced-color-adjust-none`)}),(0,h.jsx)(`span`,{"aria-hidden":`true`,className:t.cn(r.colorAreaClassNames.thumb,f.COLOR_THUMB_CLASSES,`start-(--wave-color-area-x) bottom-(--wave-color-area-y) -translate-x-1/2 wave-rtl:translate-x-1/2 translate-y-1/2`,`group-has-[:focus-visible]/color-area:ring-2 group-has-[:focus-visible]/color-area:ring-background forced-colors:group-has-[:focus-visible]/color-area:ring-[Canvas] group-has-[:focus-visible]/color-area:outline-2 group-has-[:focus-visible]/color-area:outline-offset-2 group-has-[:focus-visible]/color-area:outline-ring forced-colors:group-has-[:focus-visible]/color-area:outline-[Highlight]`)}),(0,h.jsx)(`input`,{...$(`saturation`),ref:ge,value:R,"aria-label":P.saturation,"aria-valuetext":f.areaValueText(L,`saturation`,Q),autoFocus:de}),(0,h.jsx)(`input`,{...$(`value`),ref:K,value:z,"aria-label":P.brightness,"aria-orientation":`vertical`,"aria-valuetext":f.areaValueText(L,`value`,Q)}),!N&&(0,h.jsx)(u.HiddenInput,{type:`text`,name:C,form:w,disabled:M.disabled,value:i.hsvToHex(I),required:Se,onInvalid:()=>(B===`saturation`?G:K).current?.focus()})]})};v.displayName=`ColorArea`,exports.ColorArea=v;
2
2
  //# sourceMappingURL=ColorArea.cjs.map