origam 2.38.0 → 2.38.2

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 (228) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/src/assets/locales/en.json +1 -1
  3. package/dist/src/assets/locales/fr.json +2 -2
  4. package/dist/src/components/Alert/OrigamAlert.vue +739 -165
  5. package/dist/src/components/App/OrigamApp.vue +95 -19
  6. package/dist/src/components/App/OrigamAppBar.vue +751 -158
  7. package/dist/src/components/Audio/OrigamAudio.vue +1288 -346
  8. package/dist/src/components/Audio/OrigamAudioWaveform.vue +63 -7
  9. package/dist/src/components/Avatar/OrigamAvatar.vue +678 -126
  10. package/dist/src/components/Avatar/OrigamAvatarGroup.vue +700 -153
  11. package/dist/src/components/Badge/OrigamBadge.vue +548 -135
  12. package/dist/src/components/Blockquote/OrigamBlockquote.vue +698 -140
  13. package/dist/src/components/BottomNav/OrigamBottomNav.vue +864 -156
  14. package/dist/src/components/Bracket/OrigamBracket.vue +1013 -380
  15. package/dist/src/components/Bracket/OrigamBracketCompetitor.vue +674 -154
  16. package/dist/src/components/Bracket/OrigamBracketMatch.vue +663 -163
  17. package/dist/src/components/Bracket/OrigamBracketRound.vue +116 -34
  18. package/dist/src/components/Breadcrumb/OrigamBreadcrumb.vue +654 -119
  19. package/dist/src/components/Breadcrumb/OrigamBreadcrumbDivider.vue +292 -54
  20. package/dist/src/components/Breadcrumb/OrigamBreadcrumbItem.vue +657 -126
  21. package/dist/src/components/Btn/OrigamBtn.vue +928 -249
  22. package/dist/src/components/Btn/OrigamBtnGroup.vue +658 -141
  23. package/dist/src/components/Btn/OrigamBtnToggle.vue +578 -91
  24. package/dist/src/components/Calendar/OrigamCalendar.vue +1142 -484
  25. package/dist/src/components/Card/OrigamCard.vue +938 -194
  26. package/dist/src/components/Card/OrigamCardHeader.vue +593 -104
  27. package/dist/src/components/Card/OrigamCardText.vue +536 -84
  28. package/dist/src/components/Carousel/OrigamCarousel.vue +778 -202
  29. package/dist/src/components/Carousel/OrigamCarouselItem.vue +660 -109
  30. package/dist/src/components/Chart/OrigamChart.vue +942 -452
  31. package/dist/src/components/Chart/OrigamChartAxis.vue +111 -19
  32. package/dist/src/components/Chart/OrigamChartBoxPlot.vue +713 -297
  33. package/dist/src/components/Chart/OrigamChartBullet.vue +701 -286
  34. package/dist/src/components/Chart/OrigamChartCandlestick.vue +663 -243
  35. package/dist/src/components/Chart/OrigamChartCartesian.vue +1055 -487
  36. package/dist/src/components/Chart/OrigamChartGauge.vue +563 -164
  37. package/dist/src/components/Chart/OrigamChartHeatmap.vue +677 -251
  38. package/dist/src/components/Chart/OrigamChartHoneycomb.vue +700 -288
  39. package/dist/src/components/Chart/OrigamChartLegend.vue +108 -16
  40. package/dist/src/components/Chart/OrigamChartMap.vue +723 -299
  41. package/dist/src/components/Chart/OrigamChartPareto.vue +721 -276
  42. package/dist/src/components/Chart/OrigamChartPictorial.vue +777 -355
  43. package/dist/src/components/Chart/OrigamChartPolar.vue +603 -210
  44. package/dist/src/components/Chart/OrigamChartPolarBar.vue +674 -271
  45. package/dist/src/components/Chart/OrigamChartPyramid.vue +685 -250
  46. package/dist/src/components/Chart/OrigamChartRadar.vue +515 -165
  47. package/dist/src/components/Chart/OrigamChartRangeSelector.vue +50 -25
  48. package/dist/src/components/Chart/OrigamChartSankey.vue +913 -467
  49. package/dist/src/components/Chart/OrigamChartSparkline.vue +711 -268
  50. package/dist/src/components/Chart/OrigamChartStreamgraph.vue +810 -368
  51. package/dist/src/components/Chart/OrigamChartSunburst.vue +779 -368
  52. package/dist/src/components/Chart/OrigamChartTooltip.vue +78 -19
  53. package/dist/src/components/Chart/OrigamChartTreemap.vue +750 -288
  54. package/dist/src/components/Chart/OrigamChartVariwide.vue +679 -251
  55. package/dist/src/components/Chart/OrigamChartWordCloud.vue +674 -265
  56. package/dist/src/components/Checkbox/OrigamCheckbox.vue +781 -136
  57. package/dist/src/components/Checkbox/OrigamCheckboxBtn.vue +465 -81
  58. package/dist/src/components/Checkbox/OrigamCheckboxGroup.vue +824 -137
  59. package/dist/src/components/Chip/OrigamChip.vue +867 -202
  60. package/dist/src/components/Chip/OrigamChipGroup.vue +633 -121
  61. package/dist/src/components/ClientOnly/OrigamClientOnly.vue +30 -4
  62. package/dist/src/components/Clipboard/OrigamClipboard.vue +624 -105
  63. package/dist/src/components/Code/OrigamCode.vue +844 -206
  64. package/dist/src/components/CodeGroup/OrigamCodeGroup.vue +494 -83
  65. package/dist/src/components/ColorPicker/OrigamColorPicker.vue +777 -159
  66. package/dist/src/components/ColorPicker/OrigamColorPickerCanvas.vue +295 -181
  67. package/dist/src/components/ColorPicker/OrigamColorPickerEdit.vue +108 -45
  68. package/dist/src/components/ColorPicker/OrigamColorPickerPreview.vue +131 -46
  69. package/dist/src/components/ColorPicker/OrigamColorPickerSwatches.vue +128 -39
  70. package/dist/src/components/ColorPickerField/OrigamColorPickerField.vue +1123 -258
  71. package/dist/src/components/CommandPalette/OrigamCommandPalette.vue +415 -162
  72. package/dist/src/components/ConfirmWrapper/OrigamConfirmWrapper.vue +389 -145
  73. package/dist/src/components/ContextualMenu/OrigamContextualMenu.vue +852 -147
  74. package/dist/src/components/Counter/OrigamCounter.vue +588 -96
  75. package/dist/src/components/DataList/OrigamDataList.vue +619 -113
  76. package/dist/src/components/DataList/OrigamDataText.vue +295 -65
  77. package/dist/src/components/DataList/OrigamDataTitle.vue +295 -65
  78. package/dist/src/components/DataTable/OrigamDataTable.vue +934 -222
  79. package/dist/src/components/DataTable/OrigamDataTableColumnCell.vue +196 -51
  80. package/dist/src/components/DataTable/OrigamDataTableFooter.vue +319 -78
  81. package/dist/src/components/DataTable/OrigamDataTableGroupHeaderRow.vue +124 -44
  82. package/dist/src/components/DataTable/OrigamDataTableHeaderCell.vue +181 -70
  83. package/dist/src/components/DataTable/OrigamDataTableHeaders.vue +155 -46
  84. package/dist/src/components/DataTable/OrigamDataTableHeadersCell.vue +145 -27
  85. package/dist/src/components/DataTable/OrigamDataTableHeadersCellMobile.vue +126 -43
  86. package/dist/src/components/DataTable/OrigamDataTableRow.vue +151 -73
  87. package/dist/src/components/DataTable/OrigamDataTableRows.vue +261 -106
  88. package/dist/src/components/DatePicker/OrigamDatePicker.vue +1048 -261
  89. package/dist/src/components/DatePicker/OrigamDatePickerControls.vue +155 -51
  90. package/dist/src/components/DatePicker/OrigamDatePickerHeader.vue +147 -46
  91. package/dist/src/components/DatePicker/OrigamDatePickerMonth.vue +312 -134
  92. package/dist/src/components/DatePicker/OrigamDatePickerMonths.vue +151 -61
  93. package/dist/src/components/DatePicker/OrigamDatePickerYears.vue +154 -67
  94. package/dist/src/components/DatePickerField/OrigamDatePickerField.vue +1147 -306
  95. package/dist/src/components/DefaultsProvider/OrigamDefaultsProvider.vue +74 -14
  96. package/dist/src/components/Dialog/OrigamDialog.vue +953 -196
  97. package/dist/src/components/Dialog/OrigamDialogConfirmation.vue +886 -148
  98. package/dist/src/components/Divider/OrigamDivider.vue +210 -50
  99. package/dist/src/components/Drawer/OrigamDrawer.vue +909 -207
  100. package/dist/src/components/EmptyState/OrigamEmptyState.vue +146 -35
  101. package/dist/src/components/ExpansionPanel/OrigamExpansionPanel.vue +746 -159
  102. package/dist/src/components/ExpansionPanel/OrigamExpansionPanelContent.vue +591 -95
  103. package/dist/src/components/ExpansionPanel/OrigamExpansionPanelHeader.vue +663 -143
  104. package/dist/src/components/ExpansionPanel/OrigamExpansionPanels.vue +675 -134
  105. package/dist/src/components/Field/OrigamField.vue +1118 -306
  106. package/dist/src/components/FileField/OrigamFileField.vue +1188 -311
  107. package/dist/src/components/FileField/OrigamFileFieldDragNDropItem.vue +155 -36
  108. package/dist/src/components/FileField/OrigamFileFieldListItem.vue +155 -36
  109. package/dist/src/components/Form/OrigamForm.vue +197 -74
  110. package/dist/src/components/Grid/OrigamGrid.vue +707 -147
  111. package/dist/src/components/Grid/OrigamGridItem.vue +110 -37
  112. package/dist/src/components/Grids/OrigamCol.vue +593 -110
  113. package/dist/src/components/Grids/OrigamContainer.vue +461 -80
  114. package/dist/src/components/Grids/OrigamRow.vue +573 -112
  115. package/dist/src/components/Grids/OrigamSpacer.vue +54 -17
  116. package/dist/src/components/Icon/OrigamClassIcon.vue +573 -98
  117. package/dist/src/components/Icon/OrigamComponentIcon.vue +561 -101
  118. package/dist/src/components/Icon/OrigamIcon.vue +561 -98
  119. package/dist/src/components/Icon/OrigamLigatureIcon.vue +558 -98
  120. package/dist/src/components/Icon/OrigamSvgIcon.vue +593 -100
  121. package/dist/src/components/Img/OrigamImg.vue +869 -228
  122. package/dist/src/components/InfiniteScroll/OrigamInfiniteScroll.vue +319 -111
  123. package/dist/src/components/InfiniteScroll/OrigamInfiniteScrollIntersect.vue +80 -17
  124. package/dist/src/components/InlineEdit/OrigamInlineEdit.vue +476 -140
  125. package/dist/src/components/Input/OrigamInput.vue +747 -180
  126. package/dist/src/components/ItemGroup/OrigamItemGroup.vue +112 -36
  127. package/dist/src/components/ItemGroup/OrigamItemGroupItem.vue +80 -29
  128. package/dist/src/components/Kbd/OrigamKbd.vue +450 -75
  129. package/dist/src/components/Label/OrigamLabel.vue +584 -95
  130. package/dist/src/components/Layout/OrigamLayout.vue +563 -94
  131. package/dist/src/components/Lazy/OrigamLazy.vue +131 -34
  132. package/dist/src/components/List/OrigamList.vue +755 -170
  133. package/dist/src/components/List/OrigamListChildren.vue +59 -19
  134. package/dist/src/components/List/OrigamListGroup.vue +631 -134
  135. package/dist/src/components/List/OrigamListGroupActivator.vue +45 -17
  136. package/dist/src/components/List/OrigamListItem.vue +890 -224
  137. package/dist/src/components/List/OrigamListItemWrapper.vue +20 -10
  138. package/dist/src/components/List/OrigamListSubheader.vue +542 -93
  139. package/dist/src/components/Loader/OrigamLoader.vue +110 -25
  140. package/dist/src/components/Main/OrigamMain.vue +565 -96
  141. package/dist/src/components/Masonry/OrigamMasonry.vue +799 -187
  142. package/dist/src/components/Media/OrigamMediaController.vue +465 -182
  143. package/dist/src/components/Media/OrigamMediaScrubber.vue +389 -152
  144. package/dist/src/components/Media/OrigamMediaVolumeControl.vue +174 -44
  145. package/dist/src/components/Menu/OrigamMenu.vue +1079 -255
  146. package/dist/src/components/Messages/OrigamMessages.vue +606 -97
  147. package/dist/src/components/NumberField/OrigamNumberField.vue +1208 -333
  148. package/dist/src/components/NumberFormat/OrigamNumberFormat.vue +177 -57
  149. package/dist/src/components/OtpInputField/OrigamOtpInputField.vue +1016 -272
  150. package/dist/src/components/Overlay/OrigamOverlay.vue +446 -158
  151. package/dist/src/components/Overlay/OrigamOverlayScrim.vue +122 -30
  152. package/dist/src/components/Pagination/OrigamPagination.vue +982 -313
  153. package/dist/src/components/Parallax/OrigamParallax.vue +800 -259
  154. package/dist/src/components/Parallax/OrigamParallaxElement.vue +694 -178
  155. package/dist/src/components/Parallax/OrigamParallaxLayer.vue +132 -47
  156. package/dist/src/components/PasswordField/OrigamPasswordField.vue +1098 -265
  157. package/dist/src/components/Picker/OrigamPicker.vue +655 -108
  158. package/dist/src/components/Picker/OrigamPickerTitle.vue +108 -26
  159. package/dist/src/components/Progress/OrigamProgress.vue +436 -70
  160. package/dist/src/components/Progress/OrigamProgressCircular.vue +399 -82
  161. package/dist/src/components/Progress/OrigamProgressLinear.vue +468 -115
  162. package/dist/src/components/QrCode/OrigamQrCode.vue +642 -126
  163. package/dist/src/components/Radio/OrigamRadio.vue +772 -132
  164. package/dist/src/components/Radio/OrigamRadioBtn.vue +446 -71
  165. package/dist/src/components/Radio/OrigamRadioGroup.vue +808 -135
  166. package/dist/src/components/RatingField/OrigamRatingField.vue +963 -194
  167. package/dist/src/components/RatingField/OrigamRatingFieldItem.vue +657 -106
  168. package/dist/src/components/Responsive/OrigamResponsive.vue +548 -91
  169. package/dist/src/components/Select/OrigamSelect.vue +1639 -567
  170. package/dist/src/components/SelectionControl/OrigamSelectionControl.vue +564 -151
  171. package/dist/src/components/SelectionControl/OrigamSelectionControlGroup.vue +178 -62
  172. package/dist/src/components/Sheet/OrigamSheet.vue +773 -199
  173. package/dist/src/components/Skeleton/OrigamSkeleton.vue +249 -46
  174. package/dist/src/components/Skeleton/OrigamSkeletonGroup.vue +66 -11
  175. package/dist/src/components/Slide/OrigamSlideGroup.vue +772 -257
  176. package/dist/src/components/SliderField/OrigamSliderField.vue +1157 -335
  177. package/dist/src/components/SliderField/OrigamSliderFieldTrack.vue +236 -112
  178. package/dist/src/components/Snackbar/OrigamSnackbar.vue +871 -214
  179. package/dist/src/components/Snackbar/OrigamSnackbarGroup.vue +218 -51
  180. package/dist/src/components/Snackbar/OrigamSnackbarItem.vue +175 -43
  181. package/dist/src/components/Stepper/OrigamStepper.vue +618 -126
  182. package/dist/src/components/Stepper/OrigamStepperItem.vue +98 -37
  183. package/dist/src/components/Switch/OrigamSwitch.vue +879 -156
  184. package/dist/src/components/Switch/OrigamSwitchTrack.vue +431 -78
  185. package/dist/src/components/SystemBar/OrigamSystemBar.vue +517 -87
  186. package/dist/src/components/Table/OrigamTable.vue +585 -124
  187. package/dist/src/components/Tabs/OrigamTab.vue +239 -73
  188. package/dist/src/components/Tabs/OrigamTabPanel.vue +125 -39
  189. package/dist/src/components/Tabs/OrigamTabPanels.vue +148 -57
  190. package/dist/src/components/Tabs/OrigamTabs.vue +381 -109
  191. package/dist/src/components/TextField/OrigamTextField.vue +1077 -258
  192. package/dist/src/components/TextMask/OrigamTextMask.vue +150 -43
  193. package/dist/src/components/TextareaField/OrigamTextareaField.vue +1162 -310
  194. package/dist/src/components/TextareaField/OrigamTextareaFieldRichToolbar.vue +77 -79
  195. package/dist/src/components/ThemeProvider/OrigamThemeProvider.vue +44 -9
  196. package/dist/src/components/Timeline/OrigamTimeline.vue +113 -43
  197. package/dist/src/components/Timeline/OrigamTimelineItem.vue +163 -76
  198. package/dist/src/components/Title/OrigamTitle.vue +505 -82
  199. package/dist/src/components/Toolbar/OrigamToolbar.vue +679 -142
  200. package/dist/src/components/Tooltip/OrigamTooltip.vue +288 -72
  201. package/dist/src/components/Transition/OrigamExpandX.vue +219 -106
  202. package/dist/src/components/Transition/OrigamExpandY.vue +219 -106
  203. package/dist/src/components/Transition/OrigamFade.vue +47 -9
  204. package/dist/src/components/Transition/OrigamReverseTranslatePicker.vue +52 -10
  205. package/dist/src/components/Transition/OrigamScaleRotate.vue +52 -10
  206. package/dist/src/components/Transition/OrigamSlideX.vue +52 -10
  207. package/dist/src/components/Transition/OrigamSlideY.vue +52 -10
  208. package/dist/src/components/Transition/OrigamSnack.vue +52 -10
  209. package/dist/src/components/Transition/OrigamTransition.vue +40 -12
  210. package/dist/src/components/Transition/OrigamTranslateBottom.vue +52 -10
  211. package/dist/src/components/Transition/OrigamTranslatePicker.vue +52 -10
  212. package/dist/src/components/Transition/OrigamTranslateScale.vue +209 -97
  213. package/dist/src/components/Transition/OrigamWindowXReverseTranslate.vue +40 -7
  214. package/dist/src/components/Transition/OrigamWindowXTranslate.vue +40 -7
  215. package/dist/src/components/Transition/OrigamWindowYReverseTranslate.vue +40 -7
  216. package/dist/src/components/Transition/OrigamWindowYTranslate.vue +40 -7
  217. package/dist/src/components/Treeview/OrigamTreeview.vue +258 -118
  218. package/dist/src/components/Treeview/OrigamTreeviewNode.vue +126 -88
  219. package/dist/src/components/Video/OrigamVideo.vue +1178 -331
  220. package/dist/src/components/VirtualScroll/OrigamVirtualScroll.vue +147 -55
  221. package/dist/src/components/VirtualScroll/OrigamVirtualScrollItem.vue +94 -19
  222. package/dist/src/components/Watermark/OrigamWatermark.vue +224 -124
  223. package/dist/src/components/Window/OrigamWindow.vue +745 -175
  224. package/dist/src/components/Window/OrigamWindowItem.vue +162 -69
  225. package/dist/src/composables/Commons/display.composable.cjs +2 -0
  226. package/dist/src/composables/Commons/display.composable.js +1 -1
  227. package/dist/src/interfaces/Pagination/pagination.interface.d.ts +1 -1
  228. package/package.json +8 -8
@@ -341,12 +341,7 @@
341
341
  </template>
342
342
 
343
343
  <script lang="ts" setup>
344
- import {
345
- computed,
346
- nextTick,
347
- ref,
348
- watch
349
- } from "vue";
344
+ import { computed, nextTick, ref, watch } from "vue";
350
345
  import OrigamBtn from "../Btn/OrigamBtn.vue";
351
346
  import OrigamBtnGroup from "../Btn/OrigamBtnGroup.vue";
352
347
  import { CALENDAR_NAVIGATE, CALENDAR_VIEW } from "../../enums/Calendar/calendar.enum";
@@ -359,127 +354,644 @@ import { useDensity } from "../../composables/Commons/density.composable";
359
354
  import { useDimension } from "../../composables/Commons/dimension.composable";
360
355
  import { useLocale } from "../../composables/Commons/locale.composable";
361
356
  import { useStateEffect } from "../../composables/Commons/stateEffect.composable";
362
- import {
363
- getForeground,
364
- isCssColor,
365
- isIntent,
366
- parseColor,
367
- tokenForegroundForIntent,
368
- tokenStylesForIntent
369
- } from "../../utils/Commons/color.util";
370
- import {
371
- buildDisabledPredicate,
372
- formatDate,
373
- formatTime,
374
- getWeekdayNames,
375
- isAfter,
376
- isBefore,
377
- isoWeekNumber,
378
- isPast,
379
- isSameDay,
380
- isToday,
381
- isWeekend,
382
- startOfDay,
383
- toDate
384
- } from "../../utils/Calendar/date.util";
357
+ import { getForeground, isCssColor, isIntent, parseColor, tokenForegroundForIntent, tokenStylesForIntent } from "../../utils/Commons/color.util";
358
+ import { buildDisabledPredicate, formatDate, formatTime, getWeekdayNames, isAfter, isBefore, isoWeekNumber, isPast, isSameDay, isToday, isWeekend, startOfDay, toDate } from "../../utils/Calendar/date.util";
359
+ /*********************************************************
360
+ * Global — `<OrigamCalendar>` props + defaults.
361
+ *
362
+ * Defaults are inlined here (no `CALENDAR_DEFAULTS.*` indirection)
363
+ * because the Vue SFC compiler analyses `withDefaults` statically
364
+ * and only resolves literals — cf. CLAUDE.md "withDefaults() —
365
+ * inline literals only" rule.
366
+ ********************************************************/
385
367
  const props = defineProps({
386
- view: { type: null, required: false, default: "month" },
387
- currentDate: { type: [Date, String], required: false, default: () => /* @__PURE__ */ new Date() },
388
- events: { type: Array, required: false, default: () => [] },
389
- firstDayOfWeek: { type: Number, required: false, default: 1 },
390
- timeFormat: { type: null, required: false, default: "24h" },
391
- locale: { type: String, required: false, default: void 0 },
392
- selectable: { type: Boolean, required: false, default: true },
393
- eventColorKey: { type: String, required: false, default: "category" },
394
- categoryColors: { type: Object, required: false, default: () => ({}) },
395
- weekendHighlight: { type: Boolean, required: false, default: true },
396
- showWeekNumbers: { type: Boolean, required: false, default: false },
397
- dayStartHour: { type: Number, required: false, default: 0 },
398
- dayEndHour: { type: Number, required: false, default: 24 },
399
- slotDuration: { type: Number, required: false, default: 30 },
400
- minDate: { type: [Date, String], required: false, default: void 0 },
401
- maxDate: { type: [Date, String], required: false, default: void 0 },
402
- disabledDates: { type: [Array, Function], required: false, default: void 0 },
403
- id: { type: String, required: false },
404
- class: { type: [String, Array, Object], required: false },
405
- style: { type: [String, Array, Object, Boolean, null], required: false, skipCheck: true },
406
- color: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
407
- bgColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
408
- rounded: { type: [Boolean, Number, String, null], required: false, skipCheck: true },
409
- roundedTopRight: { type: [Boolean, Number, String], required: false },
410
- roundedTopLeft: { type: [Boolean, Number, String], required: false },
411
- roundedBottomLeft: { type: [Boolean, Number, String], required: false },
412
- roundedBottomRight: { type: [Boolean, Number, String], required: false },
413
- roundedStartStart: { type: [Boolean, Number, String], required: false },
414
- roundedStartEnd: { type: [Boolean, Number, String], required: false },
415
- roundedEndStart: { type: [Boolean, Number, String], required: false },
416
- roundedEndEnd: { type: [Boolean, Number, String], required: false },
417
- elevation: { type: [Number, String], required: false },
418
- border: { type: [Boolean, Number, String, Array], required: false, skipCheck: true },
419
- borderTop: { type: [Boolean, Number, String], required: false },
420
- borderLeft: { type: [Boolean, Number, String], required: false },
421
- borderBottom: { type: [Boolean, Number, String], required: false },
422
- borderRight: { type: [Boolean, Number, String], required: false },
423
- borderBlock: { type: [Boolean, Number, String], required: false },
424
- borderInline: { type: [Boolean, Number, String], required: false },
425
- borderInlineStart: { type: [Boolean, Number, String], required: false },
426
- borderInlineEnd: { type: [Boolean, Number, String], required: false },
427
- borderBlockStart: { type: [Boolean, Number, String], required: false },
428
- borderBlockEnd: { type: [Boolean, Number, String], required: false },
429
- borderColor: { type: String, required: false },
430
- borderStyle: { type: String, required: false },
431
- borderTopColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
432
- borderRightColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
433
- borderBottomColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
434
- borderLeftColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
435
- borderInlineStartColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
436
- borderInlineEndColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
437
- borderBlockStartColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
438
- borderBlockEndColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
439
- density: { type: null, required: false },
440
- height: { type: [Number, String], required: false },
441
- maxHeight: { type: [Number, String], required: false },
442
- maxWidth: { type: [Number, String], required: false },
443
- minHeight: { type: [Number, String], required: false },
444
- minWidth: { type: [Number, String], required: false },
445
- width: { type: [Number, String], required: false },
446
- padding: { type: [Boolean, Number, String], required: false },
447
- paddingTop: { type: [Boolean, Number, String], required: false },
448
- paddingLeft: { type: [Boolean, Number, String], required: false },
449
- paddingBottom: { type: [Boolean, Number, String], required: false },
450
- paddingRight: { type: [Boolean, Number, String], required: false },
451
- paddingBlock: { type: [Boolean, Number, String], required: false },
452
- paddingInline: { type: [Boolean, Number, String], required: false },
453
- paddingInlineStart: { type: [Boolean, Number, String], required: false },
454
- paddingInlineEnd: { type: [Boolean, Number, String], required: false },
455
- paddingBlockStart: { type: [Boolean, Number, String], required: false },
456
- paddingBlockEnd: { type: [Boolean, Number, String], required: false },
457
- margin: { type: [Boolean, Number, String], required: false },
458
- marginTop: { type: [Boolean, Number, String], required: false },
459
- marginLeft: { type: [Boolean, Number, String], required: false },
460
- marginBottom: { type: [Boolean, Number, String], required: false },
461
- marginRight: { type: [Boolean, Number, String], required: false },
462
- marginBlock: { type: [Boolean, Number, String], required: false },
463
- marginInline: { type: [Boolean, Number, String], required: false },
464
- marginInlineStart: { type: [Boolean, Number, String], required: false },
465
- marginInlineEnd: { type: [Boolean, Number, String], required: false },
466
- marginBlockStart: { type: [Boolean, Number, String], required: false },
467
- marginBlockEnd: { type: [Boolean, Number, String], required: false }
368
+ view: {
369
+ type: null,
370
+ required: false,
371
+ default: "month"
372
+ },
373
+ currentDate: {
374
+ type: [Date, String],
375
+ required: false,
376
+ default: () => new Date()
377
+ },
378
+ events: {
379
+ type: Array,
380
+ required: false,
381
+ default: () => []
382
+ },
383
+ firstDayOfWeek: {
384
+ type: Number,
385
+ required: false,
386
+ default: 1
387
+ },
388
+ timeFormat: {
389
+ type: null,
390
+ required: false,
391
+ default: "24h"
392
+ },
393
+ locale: {
394
+ type: String,
395
+ required: false,
396
+ default: undefined
397
+ },
398
+ selectable: {
399
+ type: Boolean,
400
+ required: false,
401
+ default: true
402
+ },
403
+ eventColorKey: {
404
+ type: String,
405
+ required: false,
406
+ default: "category"
407
+ },
408
+ categoryColors: {
409
+ type: Object,
410
+ required: false,
411
+ default: () => ({})
412
+ },
413
+ weekendHighlight: {
414
+ type: Boolean,
415
+ required: false,
416
+ default: true
417
+ },
418
+ showWeekNumbers: {
419
+ type: Boolean,
420
+ required: false,
421
+ default: false
422
+ },
423
+ dayStartHour: {
424
+ type: Number,
425
+ required: false,
426
+ default: 0
427
+ },
428
+ dayEndHour: {
429
+ type: Number,
430
+ required: false,
431
+ default: 24
432
+ },
433
+ slotDuration: {
434
+ type: Number,
435
+ required: false,
436
+ default: 30
437
+ },
438
+ minDate: {
439
+ type: [Date, String],
440
+ required: false,
441
+ default: undefined
442
+ },
443
+ maxDate: {
444
+ type: [Date, String],
445
+ required: false,
446
+ default: undefined
447
+ },
448
+ disabledDates: {
449
+ type: [Array, Function],
450
+ required: false,
451
+ default: undefined
452
+ },
453
+ id: {
454
+ type: String,
455
+ required: false
456
+ },
457
+ class: {
458
+ type: [
459
+ String,
460
+ Array,
461
+ Object
462
+ ],
463
+ required: false
464
+ },
465
+ style: {
466
+ type: [
467
+ String,
468
+ Array,
469
+ Object,
470
+ Boolean,
471
+ null
472
+ ],
473
+ required: false,
474
+ skipCheck: true
475
+ },
476
+ color: {
477
+ type: [
478
+ String,
479
+ Object,
480
+ Boolean,
481
+ null
482
+ ],
483
+ required: false,
484
+ skipCheck: true
485
+ },
486
+ bgColor: {
487
+ type: [
488
+ String,
489
+ Object,
490
+ Boolean,
491
+ null
492
+ ],
493
+ required: false,
494
+ skipCheck: true
495
+ },
496
+ rounded: {
497
+ type: [
498
+ Boolean,
499
+ Number,
500
+ String,
501
+ null
502
+ ],
503
+ required: false,
504
+ skipCheck: true
505
+ },
506
+ roundedTopRight: {
507
+ type: [
508
+ Boolean,
509
+ Number,
510
+ String
511
+ ],
512
+ required: false
513
+ },
514
+ roundedTopLeft: {
515
+ type: [
516
+ Boolean,
517
+ Number,
518
+ String
519
+ ],
520
+ required: false
521
+ },
522
+ roundedBottomLeft: {
523
+ type: [
524
+ Boolean,
525
+ Number,
526
+ String
527
+ ],
528
+ required: false
529
+ },
530
+ roundedBottomRight: {
531
+ type: [
532
+ Boolean,
533
+ Number,
534
+ String
535
+ ],
536
+ required: false
537
+ },
538
+ roundedStartStart: {
539
+ type: [
540
+ Boolean,
541
+ Number,
542
+ String
543
+ ],
544
+ required: false
545
+ },
546
+ roundedStartEnd: {
547
+ type: [
548
+ Boolean,
549
+ Number,
550
+ String
551
+ ],
552
+ required: false
553
+ },
554
+ roundedEndStart: {
555
+ type: [
556
+ Boolean,
557
+ Number,
558
+ String
559
+ ],
560
+ required: false
561
+ },
562
+ roundedEndEnd: {
563
+ type: [
564
+ Boolean,
565
+ Number,
566
+ String
567
+ ],
568
+ required: false
569
+ },
570
+ elevation: {
571
+ type: [Number, String],
572
+ required: false
573
+ },
574
+ border: {
575
+ type: [
576
+ Boolean,
577
+ Number,
578
+ String,
579
+ Array
580
+ ],
581
+ required: false,
582
+ skipCheck: true
583
+ },
584
+ borderTop: {
585
+ type: [
586
+ Boolean,
587
+ Number,
588
+ String
589
+ ],
590
+ required: false
591
+ },
592
+ borderLeft: {
593
+ type: [
594
+ Boolean,
595
+ Number,
596
+ String
597
+ ],
598
+ required: false
599
+ },
600
+ borderBottom: {
601
+ type: [
602
+ Boolean,
603
+ Number,
604
+ String
605
+ ],
606
+ required: false
607
+ },
608
+ borderRight: {
609
+ type: [
610
+ Boolean,
611
+ Number,
612
+ String
613
+ ],
614
+ required: false
615
+ },
616
+ borderBlock: {
617
+ type: [
618
+ Boolean,
619
+ Number,
620
+ String
621
+ ],
622
+ required: false
623
+ },
624
+ borderInline: {
625
+ type: [
626
+ Boolean,
627
+ Number,
628
+ String
629
+ ],
630
+ required: false
631
+ },
632
+ borderInlineStart: {
633
+ type: [
634
+ Boolean,
635
+ Number,
636
+ String
637
+ ],
638
+ required: false
639
+ },
640
+ borderInlineEnd: {
641
+ type: [
642
+ Boolean,
643
+ Number,
644
+ String
645
+ ],
646
+ required: false
647
+ },
648
+ borderBlockStart: {
649
+ type: [
650
+ Boolean,
651
+ Number,
652
+ String
653
+ ],
654
+ required: false
655
+ },
656
+ borderBlockEnd: {
657
+ type: [
658
+ Boolean,
659
+ Number,
660
+ String
661
+ ],
662
+ required: false
663
+ },
664
+ borderColor: {
665
+ type: String,
666
+ required: false
667
+ },
668
+ borderStyle: {
669
+ type: String,
670
+ required: false
671
+ },
672
+ borderTopColor: {
673
+ type: [
674
+ String,
675
+ Object,
676
+ Boolean,
677
+ null
678
+ ],
679
+ required: false,
680
+ skipCheck: true
681
+ },
682
+ borderRightColor: {
683
+ type: [
684
+ String,
685
+ Object,
686
+ Boolean,
687
+ null
688
+ ],
689
+ required: false,
690
+ skipCheck: true
691
+ },
692
+ borderBottomColor: {
693
+ type: [
694
+ String,
695
+ Object,
696
+ Boolean,
697
+ null
698
+ ],
699
+ required: false,
700
+ skipCheck: true
701
+ },
702
+ borderLeftColor: {
703
+ type: [
704
+ String,
705
+ Object,
706
+ Boolean,
707
+ null
708
+ ],
709
+ required: false,
710
+ skipCheck: true
711
+ },
712
+ borderInlineStartColor: {
713
+ type: [
714
+ String,
715
+ Object,
716
+ Boolean,
717
+ null
718
+ ],
719
+ required: false,
720
+ skipCheck: true
721
+ },
722
+ borderInlineEndColor: {
723
+ type: [
724
+ String,
725
+ Object,
726
+ Boolean,
727
+ null
728
+ ],
729
+ required: false,
730
+ skipCheck: true
731
+ },
732
+ borderBlockStartColor: {
733
+ type: [
734
+ String,
735
+ Object,
736
+ Boolean,
737
+ null
738
+ ],
739
+ required: false,
740
+ skipCheck: true
741
+ },
742
+ borderBlockEndColor: {
743
+ type: [
744
+ String,
745
+ Object,
746
+ Boolean,
747
+ null
748
+ ],
749
+ required: false,
750
+ skipCheck: true
751
+ },
752
+ density: {
753
+ type: null,
754
+ required: false
755
+ },
756
+ height: {
757
+ type: [Number, String],
758
+ required: false
759
+ },
760
+ maxHeight: {
761
+ type: [Number, String],
762
+ required: false
763
+ },
764
+ maxWidth: {
765
+ type: [Number, String],
766
+ required: false
767
+ },
768
+ minHeight: {
769
+ type: [Number, String],
770
+ required: false
771
+ },
772
+ minWidth: {
773
+ type: [Number, String],
774
+ required: false
775
+ },
776
+ width: {
777
+ type: [Number, String],
778
+ required: false
779
+ },
780
+ padding: {
781
+ type: [
782
+ Boolean,
783
+ Number,
784
+ String
785
+ ],
786
+ required: false
787
+ },
788
+ paddingTop: {
789
+ type: [
790
+ Boolean,
791
+ Number,
792
+ String
793
+ ],
794
+ required: false
795
+ },
796
+ paddingLeft: {
797
+ type: [
798
+ Boolean,
799
+ Number,
800
+ String
801
+ ],
802
+ required: false
803
+ },
804
+ paddingBottom: {
805
+ type: [
806
+ Boolean,
807
+ Number,
808
+ String
809
+ ],
810
+ required: false
811
+ },
812
+ paddingRight: {
813
+ type: [
814
+ Boolean,
815
+ Number,
816
+ String
817
+ ],
818
+ required: false
819
+ },
820
+ paddingBlock: {
821
+ type: [
822
+ Boolean,
823
+ Number,
824
+ String
825
+ ],
826
+ required: false
827
+ },
828
+ paddingInline: {
829
+ type: [
830
+ Boolean,
831
+ Number,
832
+ String
833
+ ],
834
+ required: false
835
+ },
836
+ paddingInlineStart: {
837
+ type: [
838
+ Boolean,
839
+ Number,
840
+ String
841
+ ],
842
+ required: false
843
+ },
844
+ paddingInlineEnd: {
845
+ type: [
846
+ Boolean,
847
+ Number,
848
+ String
849
+ ],
850
+ required: false
851
+ },
852
+ paddingBlockStart: {
853
+ type: [
854
+ Boolean,
855
+ Number,
856
+ String
857
+ ],
858
+ required: false
859
+ },
860
+ paddingBlockEnd: {
861
+ type: [
862
+ Boolean,
863
+ Number,
864
+ String
865
+ ],
866
+ required: false
867
+ },
868
+ margin: {
869
+ type: [
870
+ Boolean,
871
+ Number,
872
+ String
873
+ ],
874
+ required: false
875
+ },
876
+ marginTop: {
877
+ type: [
878
+ Boolean,
879
+ Number,
880
+ String
881
+ ],
882
+ required: false
883
+ },
884
+ marginLeft: {
885
+ type: [
886
+ Boolean,
887
+ Number,
888
+ String
889
+ ],
890
+ required: false
891
+ },
892
+ marginBottom: {
893
+ type: [
894
+ Boolean,
895
+ Number,
896
+ String
897
+ ],
898
+ required: false
899
+ },
900
+ marginRight: {
901
+ type: [
902
+ Boolean,
903
+ Number,
904
+ String
905
+ ],
906
+ required: false
907
+ },
908
+ marginBlock: {
909
+ type: [
910
+ Boolean,
911
+ Number,
912
+ String
913
+ ],
914
+ required: false
915
+ },
916
+ marginInline: {
917
+ type: [
918
+ Boolean,
919
+ Number,
920
+ String
921
+ ],
922
+ required: false
923
+ },
924
+ marginInlineStart: {
925
+ type: [
926
+ Boolean,
927
+ Number,
928
+ String
929
+ ],
930
+ required: false
931
+ },
932
+ marginInlineEnd: {
933
+ type: [
934
+ Boolean,
935
+ Number,
936
+ String
937
+ ],
938
+ required: false
939
+ },
940
+ marginBlockStart: {
941
+ type: [
942
+ Boolean,
943
+ Number,
944
+ String
945
+ ],
946
+ required: false
947
+ },
948
+ marginBlockEnd: {
949
+ type: [
950
+ Boolean,
951
+ Number,
952
+ String
953
+ ],
954
+ required: false
955
+ }
468
956
  });
469
- const emit = defineEmits(["update:view", "update:currentDate", "event-click", "date-click", "range-select", "create-event-request", "view-change", "navigate"]);
957
+ const emit = defineEmits([
958
+ "update:view",
959
+ "update:currentDate",
960
+ "event-click",
961
+ "date-click",
962
+ "range-select",
963
+ "create-event-request",
964
+ "view-change",
965
+ "navigate"
966
+ ]);
470
967
  defineSlots();
471
- const VIEW_OPTIONS = [CALENDAR_VIEW.MONTH, CALENDAR_VIEW.WEEK, CALENDAR_VIEW.DAY, CALENDAR_VIEW.AGENDA];
968
+ /*********************************************************
969
+ * Constants — view enumeration, default event limits, ARIA copy.
970
+ *
971
+ * Kept in-file (not in a const file) because they're internal to
972
+ * the SFC; the public surface that consumers extend is the
973
+ * `ICalendarProps`/`IEvent` interface pair.
974
+ ********************************************************/
975
+ const VIEW_OPTIONS = [
976
+ CALENDAR_VIEW.MONTH,
977
+ CALENDAR_VIEW.WEEK,
978
+ CALENDAR_VIEW.DAY,
979
+ CALENDAR_VIEW.AGENDA
980
+ ];
472
981
  const MONTH_EVENT_LIMIT = 3;
473
982
  const DEFAULT_SLOT_HEIGHT_PX = 32;
983
+ // UI chrome is localised through the DS i18n provider (`useLocale`) —
984
+ // keys under `origam.calendar.*` in the shipped locale messages. Dates /
985
+ // month / weekday names stay `Intl`-localised from the `locale` prop.
474
986
  const { t } = useLocale();
475
987
  const VIEW_LABEL_FALLBACK = {
476
- [CALENDAR_VIEW.MONTH]: "Month",
477
- [CALENDAR_VIEW.WEEK]: "Week",
478
- [CALENDAR_VIEW.DAY]: "Day",
479
- [CALENDAR_VIEW.AGENDA]: "Agenda"
988
+ [CALENDAR_VIEW.MONTH]: "Month",
989
+ [CALENDAR_VIEW.WEEK]: "Week",
990
+ [CALENDAR_VIEW.DAY]: "Day",
991
+ [CALENDAR_VIEW.AGENDA]: "Agenda"
480
992
  };
481
993
  function viewLabel(view) {
482
- return t(`origam.calendar.view.${view}`, VIEW_LABEL_FALLBACK[view]);
994
+ return t(`origam.calendar.view.${view}`, VIEW_LABEL_FALLBACK[view]);
483
995
  }
484
996
  const ariaLabel = computed(() => t("origam.calendar.aria_label"));
485
997
  const ariaToolbarLabel = computed(() => t("origam.calendar.toolbar"));
@@ -496,509 +1008,655 @@ const dayStartHour = computed(() => props.dayStartHour);
496
1008
  const dayEndHour = computed(() => props.dayEndHour);
497
1009
  const showWeekNumbers = computed(() => props.showWeekNumbers);
498
1010
  const weekendHighlight = computed(() => props.weekendHighlight);
1011
+ /*********************************************************
1012
+ * Reactive normalisation — coerce string dates to Date once, build
1013
+ * the disabled-date predicate once. Anything downstream consumes
1014
+ * the normalised forms.
1015
+ ********************************************************/
1016
+ // View + current date are UNCONTROLLED-capable: the calendar owns its
1017
+ // own state so a standalone `<origam-calendar>` (no v-model) stays
1018
+ // interactive — the toolbar switches views / navigates on click. When
1019
+ // the parent binds `v-model:view` / `v-model:current-date`, the watchers
1020
+ // sync the controlled value back in.
1021
+ //
1022
+ // ⛔ ADR-005 — the seed used to be `props.view ?? CALENDAR_VIEW.MONTH`
1023
+ // read directly inside `ref(...)`, which runs during `setup()` —
1024
+ // BEFORE the theme-props-resolver's `beforeCreate` patches `instance.props`.
1025
+ // A theme naming a default `view` (or `currentDate`) for every calendar
1026
+ // was therefore silently ignored on first render (mirrors the `useVModel`
1027
+ // fix, #448 / #487): the ref starts `UNSEEDED` and the prop is read lazily,
1028
+ // inside the `resolvedView` / `resolvedDate` computed getters, which only
1029
+ // evaluate at render — comfortably after `beforeCreate`.
499
1030
  const internalView = ref(UNSEEDED);
500
1031
  const internalDate = ref(UNSEEDED);
501
1032
  watch(() => props.view, (next) => {
502
- if (next != null) internalView.value = next;
1033
+ if (next != null) internalView.value = next;
503
1034
  });
504
1035
  watch(() => props.currentDate, (next) => {
505
- const parsed = toDate(next);
506
- if (parsed) internalDate.value = parsed;
1036
+ const parsed = toDate(next);
1037
+ if (parsed) internalDate.value = parsed;
507
1038
  });
508
1039
  const resolvedView = computed(() => internalView.value !== UNSEEDED ? internalView.value : props.view ?? CALENDAR_VIEW.MONTH);
509
- const resolvedDate = computed(() => internalDate.value !== UNSEEDED ? internalDate.value : toDate(props.currentDate) ?? /* @__PURE__ */ new Date());
1040
+ const resolvedDate = computed(() => internalDate.value !== UNSEEDED ? internalDate.value : toDate(props.currentDate) ?? new Date());
510
1041
  const resolvedLocale = computed(() => {
511
- if (props.locale) return props.locale;
512
- if (typeof document !== "undefined" && document.documentElement.lang) {
513
- return document.documentElement.lang;
514
- }
515
- return "en-US";
1042
+ if (props.locale) return props.locale;
1043
+ if (typeof document !== "undefined" && document.documentElement.lang) {
1044
+ return document.documentElement.lang;
1045
+ }
1046
+ return "en-US";
516
1047
  });
517
1048
  const minDate = computed(() => props.minDate ? toDate(props.minDate) : null);
518
1049
  const maxDate = computed(() => props.maxDate ? toDate(props.maxDate) : null);
519
- const disabledPredicate = computed(
520
- () => buildDisabledPredicate(props.disabledDates)
521
- );
522
- const calendar = useCalendar(
523
- {
524
- events: () => props.events ?? [],
525
- view: () => resolvedView.value,
526
- currentDate: () => resolvedDate.value,
527
- firstDayOfWeek: () => props.firstDayOfWeek,
528
- slotDuration: () => slotDuration.value,
529
- dayStartHour: () => dayStartHour.value,
530
- dayEndHour: () => dayEndHour.value,
531
- minDate: () => minDate.value,
532
- maxDate: () => maxDate.value,
533
- locale: () => resolvedLocale.value
534
- },
535
- (next) => {
536
- internalView.value = next;
537
- emit("update:view", next);
538
- emit("view-change", next);
539
- },
540
- (next) => {
541
- internalDate.value = next;
542
- emit("update:currentDate", next);
543
- }
544
- );
1050
+ const disabledPredicate = computed(() => buildDisabledPredicate(props.disabledDates));
1051
+ /*********************************************************
1052
+ * Composable wiring — driven by getter thunks so we never
1053
+ * accidentally close over a stale value.
1054
+ ********************************************************/
1055
+ const calendar = useCalendar({
1056
+ events: () => props.events ?? [],
1057
+ view: () => resolvedView.value,
1058
+ currentDate: () => resolvedDate.value,
1059
+ firstDayOfWeek: () => props.firstDayOfWeek,
1060
+ slotDuration: () => slotDuration.value,
1061
+ dayStartHour: () => dayStartHour.value,
1062
+ dayEndHour: () => dayEndHour.value,
1063
+ minDate: () => minDate.value,
1064
+ maxDate: () => maxDate.value,
1065
+ locale: () => resolvedLocale.value
1066
+ }, (next) => {
1067
+ internalView.value = next;
1068
+ emit("update:view", next);
1069
+ emit("view-change", next);
1070
+ }, (next) => {
1071
+ internalDate.value = next;
1072
+ emit("update:currentDate", next);
1073
+ });
545
1074
  function onSetView(next) {
546
- calendar.setView(next);
1075
+ calendar.setView(next);
547
1076
  }
548
1077
  function onNavigate(direction) {
549
- calendar.navigate(direction);
550
- emit("navigate", direction);
1078
+ calendar.navigate(direction);
1079
+ emit("navigate", direction);
551
1080
  }
552
- const prevGlyph = "\u2039";
553
- const nextGlyph = "\u203A";
1081
+ /*********************************************************
1082
+ * Toolbar — rendered with `<OrigamBtn>` (never raw `<button>`).
1083
+ * The selected view reads as a raised, primary-tinted pill
1084
+ * (`variant="elevated"` + `active`) so it stands out clearly on ANY
1085
+ * header surface, including a painted `bgColor` band; the other views
1086
+ * stay flat/transparent and inherit the header foreground.
1087
+ ********************************************************/
1088
+ const prevGlyph = "‹";
1089
+ const nextGlyph = "›";
554
1090
  function isViewActive(view) {
555
- return resolvedView.value === view;
1091
+ return resolvedView.value === view;
556
1092
  }
557
1093
  function viewBtnVariant(view) {
558
- return isViewActive(view) ? VARIANT.FLAT : VARIANT.TEXT;
1094
+ return isViewActive(view) ? VARIANT.FLAT : VARIANT.TEXT;
559
1095
  }
1096
+ // The active view segment follows the calendar's OWN intent — the
1097
+ // header's `bgColor`, else the `color` accent, else the primary
1098
+ // default. Never a hardcoded colour: a `success` calendar paints a
1099
+ // darker-success active segment, not a stray primary one.
560
1100
  const toolbarIntent = computed(() => {
561
- const bg = props.bgColor;
562
- if (bg && isIntent(bg)) return bg;
563
- const fg = props.color;
564
- if (fg && isIntent(fg)) return fg;
565
- return INTENT.PRIMARY;
1101
+ const bg = props.bgColor;
1102
+ if (bg && isIntent(bg)) return bg;
1103
+ const fg = props.color;
1104
+ if (fg && isIntent(fg)) return fg;
1105
+ return INTENT.PRIMARY;
566
1106
  });
567
1107
  function viewBtnBgColor(view) {
568
- return isViewActive(view) ? toolbarIntent.value : void 0;
1108
+ return isViewActive(view) ? toolbarIntent.value : undefined;
569
1109
  }
1110
+ /*********************************************************
1111
+ * Header — view-dependent title format. Uses `Intl.DateTimeFormat`
1112
+ * so the user's locale drives month / weekday names.
1113
+ ********************************************************/
570
1114
  const headerTitle = computed(() => {
571
- const date = resolvedDate.value;
572
- const locale = resolvedLocale.value;
573
- switch (resolvedView.value) {
574
- case CALENDAR_VIEW.WEEK: {
575
- const range = calendar.visibleDateRange.value;
576
- const startLabel = formatDate(range.start, locale, { month: "short", day: "numeric" });
577
- const endLabel = formatDate(range.end, locale, { month: "short", day: "numeric", year: "numeric" });
578
- return `${startLabel} \u2014 ${endLabel}`;
579
- }
580
- case CALENDAR_VIEW.DAY:
581
- return formatDate(date, locale, {
582
- weekday: "long",
583
- month: "long",
584
- day: "numeric",
585
- year: "numeric"
586
- });
587
- case CALENDAR_VIEW.MONTH:
588
- case CALENDAR_VIEW.AGENDA:
589
- default:
590
- return formatDate(date, locale, { month: "long", year: "numeric" });
591
- }
1115
+ const date = resolvedDate.value;
1116
+ const locale = resolvedLocale.value;
1117
+ switch (resolvedView.value) {
1118
+ case CALENDAR_VIEW.WEEK: {
1119
+ const range = calendar.visibleDateRange.value;
1120
+ const startLabel = formatDate(range.start, locale, {
1121
+ month: "short",
1122
+ day: "numeric"
1123
+ });
1124
+ const endLabel = formatDate(range.end, locale, {
1125
+ month: "short",
1126
+ day: "numeric",
1127
+ year: "numeric"
1128
+ });
1129
+ return `${startLabel} — ${endLabel}`;
1130
+ }
1131
+ case CALENDAR_VIEW.DAY: return formatDate(date, locale, {
1132
+ weekday: "long",
1133
+ month: "long",
1134
+ day: "numeric",
1135
+ year: "numeric"
1136
+ });
1137
+ case CALENDAR_VIEW.MONTH:
1138
+ case CALENDAR_VIEW.AGENDA:
1139
+ default: return formatDate(date, locale, {
1140
+ month: "long",
1141
+ year: "numeric"
1142
+ });
1143
+ }
592
1144
  });
593
1145
  const canPrev = computed(() => {
594
- if (!minDate.value) return true;
595
- return isAfter(resolvedDate.value, minDate.value);
1146
+ if (!minDate.value) return true;
1147
+ return isAfter(resolvedDate.value, minDate.value);
596
1148
  });
597
1149
  const canNext = computed(() => {
598
- if (!maxDate.value) return true;
599
- return isBefore(resolvedDate.value, maxDate.value);
1150
+ if (!maxDate.value) return true;
1151
+ return isBefore(resolvedDate.value, maxDate.value);
600
1152
  });
1153
+ /*********************************************************
1154
+ * Month view bindings.
1155
+ ********************************************************/
601
1156
  const monthGrid = computed(() => calendar.buildMonthGrid(resolvedDate.value));
602
1157
  const weekdayNames = computed(() => getWeekdayNames(resolvedLocale.value, props.firstDayOfWeek, "short"));
603
1158
  function dayCellKey(date) {
604
- return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
1159
+ return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
605
1160
  }
606
- const dayCellRefs = /* @__PURE__ */ new Map();
1161
+ /*********************************************************
1162
+ * Roving tabindex (issue #390) — WAI-ARIA APG grid pattern.
1163
+ *
1164
+ * @description
1165
+ * Every `.origam-calendar__day-cell` used to carry `tabindex="0"`
1166
+ * unconditionally (35-42 tab stops per month). Only the cell matching
1167
+ * `resolvedDate` — the SAME value the existing arrow-key handler
1168
+ * already navigates — is now a tab stop; every other cell is `-1`.
1169
+ * `resolvedDate` is always inside the currently rendered `monthGrid`
1170
+ * by construction (`buildMonthGrid(resolvedDate.value)`), so exactly
1171
+ * one cell is always reachable by Tab.
1172
+ *
1173
+ * `dayCellRefs` is a plain Map (not a ref) populated via the `:ref`
1174
+ * callback on each cell — it never needs to be reactive itself, only
1175
+ * READ imperatively from `focusDayCell` after a keyboard move.
1176
+ ********************************************************/
1177
+ const dayCellRefs = new Map();
607
1178
  function setDayCellRef(date, el) {
608
- const key = dayCellKey(date);
609
- if (el instanceof HTMLElement) dayCellRefs.set(key, el);
610
- else dayCellRefs.delete(key);
1179
+ const key = dayCellKey(date);
1180
+ if (el instanceof HTMLElement) dayCellRefs.set(key, el);
1181
+ else dayCellRefs.delete(key);
611
1182
  }
612
1183
  function isRovingTabStop(date) {
613
- return isSameDay(date, resolvedDate.value);
1184
+ return isSameDay(date, resolvedDate.value);
614
1185
  }
615
1186
  function focusDayCell(date) {
616
- dayCellRefs.get(dayCellKey(date))?.focus();
1187
+ dayCellRefs.get(dayCellKey(date))?.focus();
617
1188
  }
618
1189
  function isCellToday(date) {
619
- return isToday(date);
1190
+ return isToday(date);
620
1191
  }
621
1192
  function isCellPast(date) {
622
- return isPast(startOfDay(date)) && !isCellToday(date);
1193
+ return isPast(startOfDay(date)) && !isCellToday(date);
623
1194
  }
624
1195
  function isCellWeekend(date) {
625
- return isWeekend(date);
1196
+ return isWeekend(date);
626
1197
  }
627
1198
  function isOutsideMonth(date) {
628
- return date.getMonth() !== resolvedDate.value.getMonth();
1199
+ return date.getMonth() !== resolvedDate.value.getMonth();
629
1200
  }
630
1201
  function isDayDisabled(date) {
631
- if (disabledPredicate.value(date)) return true;
632
- if (minDate.value && isBefore(startOfDay(date), startOfDay(minDate.value))) return true;
633
- if (maxDate.value && isAfter(startOfDay(date), startOfDay(maxDate.value))) return true;
634
- return false;
1202
+ if (disabledPredicate.value(date)) return true;
1203
+ if (minDate.value && isBefore(startOfDay(date), startOfDay(minDate.value))) return true;
1204
+ if (maxDate.value && isAfter(startOfDay(date), startOfDay(maxDate.value))) return true;
1205
+ return false;
635
1206
  }
636
1207
  function dayCellClasses(date) {
637
- return {
638
- "origam-calendar__day-cell--today": isCellToday(date),
639
- "origam-calendar__day-cell--past": isCellPast(date),
640
- "origam-calendar__day-cell--outside": isOutsideMonth(date),
641
- "origam-calendar__day-cell--weekend": isCellWeekend(date) && weekendHighlight.value,
642
- "origam-calendar__day-cell--disabled": isDayDisabled(date),
643
- "origam-calendar__day-cell--selected": isInDragSelection(date)
644
- };
1208
+ return {
1209
+ "origam-calendar__day-cell--today": isCellToday(date),
1210
+ "origam-calendar__day-cell--past": isCellPast(date),
1211
+ "origam-calendar__day-cell--outside": isOutsideMonth(date),
1212
+ "origam-calendar__day-cell--weekend": isCellWeekend(date) && weekendHighlight.value,
1213
+ "origam-calendar__day-cell--disabled": isDayDisabled(date),
1214
+ "origam-calendar__day-cell--selected": isInDragSelection(date)
1215
+ };
645
1216
  }
646
1217
  function eventsOnDay(date) {
647
- return calendar.eventsOnDay(date);
1218
+ return calendar.eventsOnDay(date);
648
1219
  }
649
1220
  function dayEventsCapped(date) {
650
- return eventsOnDay(date).slice(0, MONTH_EVENT_LIMIT);
1221
+ return eventsOnDay(date).slice(0, MONTH_EVENT_LIMIT);
651
1222
  }
652
1223
  function weekNumberOf(date) {
653
- return isoWeekNumber(date);
1224
+ return isoWeekNumber(date);
654
1225
  }
655
1226
  function ariaWeekNumberLabel(date) {
656
- return `Week ${weekNumberOf(date)}`;
1227
+ return `Week ${weekNumberOf(date)}`;
657
1228
  }
658
1229
  function ariaDayLabel(date) {
659
- return formatDate(date, resolvedLocale.value, {
660
- weekday: "long",
661
- month: "long",
662
- day: "numeric",
663
- year: "numeric"
664
- });
1230
+ return formatDate(date, resolvedLocale.value, {
1231
+ weekday: "long",
1232
+ month: "long",
1233
+ day: "numeric",
1234
+ year: "numeric"
1235
+ });
665
1236
  }
1237
+ /*********************************************************
1238
+ * Week / day view bindings.
1239
+ ********************************************************/
666
1240
  const timelineDays = computed(() => {
667
- if (resolvedView.value === CALENDAR_VIEW.DAY) return [startOfDay(resolvedDate.value)];
668
- const range = calendar.visibleDateRange.value;
669
- const out = [];
670
- let cursor = startOfDay(range.start);
671
- for (let i = 0; i < 7; i++) {
672
- out.push(cursor);
673
- cursor = calendar.helpers.addDays(cursor, 1);
674
- }
675
- return out;
1241
+ if (resolvedView.value === CALENDAR_VIEW.DAY) return [startOfDay(resolvedDate.value)];
1242
+ const range = calendar.visibleDateRange.value;
1243
+ const out = [];
1244
+ let cursor = startOfDay(range.start);
1245
+ for (let i = 0; i < 7; i++) {
1246
+ out.push(cursor);
1247
+ cursor = calendar.helpers.addDays(cursor, 1);
1248
+ }
1249
+ return out;
676
1250
  });
677
1251
  const hourLabels = computed(() => {
678
- const out = [];
679
- const date = new Date(resolvedDate.value);
680
- date.setMinutes(0, 0, 0);
681
- for (let h = dayStartHour.value; h < dayEndHour.value; h++) {
682
- date.setHours(h);
683
- out.push(formatTime(date, props.timeFormat, resolvedLocale.value));
684
- }
685
- return out;
1252
+ const out = [];
1253
+ const date = new Date(resolvedDate.value);
1254
+ date.setMinutes(0, 0, 0);
1255
+ for (let h = dayStartHour.value; h < dayEndHour.value; h++) {
1256
+ date.setHours(h);
1257
+ out.push(formatTime(date, props.timeFormat, resolvedLocale.value));
1258
+ }
1259
+ return out;
686
1260
  });
687
1261
  function dayGridFor(date) {
688
- return calendar.buildDayGrid(date);
1262
+ return calendar.buildDayGrid(date);
689
1263
  }
690
1264
  function eventsOnTimeline(day) {
691
- return eventsOnDay(day).filter((event) => !event.allDay);
1265
+ return eventsOnDay(day).filter((event) => !event.allDay);
692
1266
  }
693
1267
  function timelineEventStyle(event, day) {
694
- const dayStartTime = new Date(day);
695
- dayStartTime.setHours(dayStartHour.value, 0, 0, 0);
696
- const pxPerMin = slotPx / slotDuration.value;
697
- const pos = calendar.positionEvent(event, dayStartTime, pxPerMin);
698
- if (!pos) return {};
699
- return {
700
- top: `${pos.top}px`,
701
- height: `${pos.height}px`,
702
- ...colorStyleFor(event)
703
- };
1268
+ const dayStartTime = new Date(day);
1269
+ dayStartTime.setHours(dayStartHour.value, 0, 0, 0);
1270
+ const pxPerMin = slotPx / slotDuration.value;
1271
+ const pos = calendar.positionEvent(event, dayStartTime, pxPerMin);
1272
+ if (!pos) return {};
1273
+ return {
1274
+ top: `${pos.top}px`,
1275
+ height: `${pos.height}px`,
1276
+ ...colorStyleFor(event)
1277
+ };
704
1278
  }
705
1279
  function weekdayShort(date) {
706
- return formatDate(date, resolvedLocale.value, { weekday: "short" });
1280
+ return formatDate(date, resolvedLocale.value, { weekday: "short" });
707
1281
  }
708
1282
  function eventTimeLabel(event) {
709
- const start = toDate(event.start);
710
- if (!start) return "";
711
- return formatTime(start, props.timeFormat, resolvedLocale.value);
1283
+ const start = toDate(event.start);
1284
+ if (!start) return "";
1285
+ return formatTime(start, props.timeFormat, resolvedLocale.value);
712
1286
  }
1287
+ /*********************************************************
1288
+ * Agenda view bindings.
1289
+ ********************************************************/
713
1290
  const agendaEntries = computed(() => calendar.buildAgenda());
714
1291
  function agendaDayHeader(date) {
715
- return formatDate(date, resolvedLocale.value, {
716
- weekday: "long",
717
- month: "short",
718
- day: "numeric"
719
- });
1292
+ return formatDate(date, resolvedLocale.value, {
1293
+ weekday: "long",
1294
+ month: "short",
1295
+ day: "numeric"
1296
+ });
720
1297
  }
1298
+ /*********************************************************
1299
+ * Color resolution — `eventColorKey` selects the source. We map
1300
+ * tokenised intents to the matching CSS variable so the calendar
1301
+ * inherits theme-aware colours without re-implementing the
1302
+ * intent → color matrix.
1303
+ ********************************************************/
721
1304
  const INTENT_NAMES = Object.values(INTENT);
722
1305
  function colorFor(event) {
723
- if (props.eventColorKey === "color" && event.color) {
724
- return resolveColor(event.color);
725
- }
726
- if (event.color) return resolveColor(event.color);
727
- const cat = event.category;
728
- if (!cat) return null;
729
- const mapped = props.categoryColors?.[cat];
730
- if (!mapped) return null;
731
- return resolveColor(mapped);
1306
+ if (props.eventColorKey === "color" && event.color) {
1307
+ return resolveColor(event.color);
1308
+ }
1309
+ if (event.color) return resolveColor(event.color);
1310
+ const cat = event.category;
1311
+ if (!cat) return null;
1312
+ const mapped = props.categoryColors?.[cat];
1313
+ if (!mapped) return null;
1314
+ return resolveColor(mapped);
732
1315
  }
733
1316
  function resolveColor(value) {
734
- if (INTENT_NAMES.includes(value)) {
735
- return `var(--origam-color__action--${value}---bg, var(--origam-color__feedback--${value}---bg, currentColor))`;
736
- }
737
- return value;
1317
+ if (INTENT_NAMES.includes(value)) {
1318
+ return `var(--origam-color__action--${value}---bg, var(--origam-color__feedback--${value}---bg, currentColor))`;
1319
+ }
1320
+ return value;
738
1321
  }
739
1322
  function colorStyleFor(event) {
740
- const c = colorFor(event);
741
- if (!c) return {};
742
- return {
743
- "background-color": c,
744
- "border-color": c
745
- };
1323
+ const c = colorFor(event);
1324
+ if (!c) return {};
1325
+ return {
1326
+ "background-color": c,
1327
+ "border-color": c
1328
+ };
746
1329
  }
747
1330
  function eventStyle(event) {
748
- return colorStyleFor(event);
1331
+ return colorStyleFor(event);
749
1332
  }
750
1333
  function isEventPast(event) {
751
- const start = toDate(event.start);
752
- return start ? isPast(start) : false;
1334
+ const start = toDate(event.start);
1335
+ return start ? isPast(start) : false;
753
1336
  }
754
1337
  function isEventToday(event) {
755
- const start = toDate(event.start);
756
- return start ? isToday(start) : false;
1338
+ const start = toDate(event.start);
1339
+ return start ? isToday(start) : false;
757
1340
  }
758
1341
  function ariaEventLabel(event) {
759
- const start = toDate(event.start);
760
- if (!start) return event.title;
761
- return `${event.title} \u2014 ${formatDate(start, resolvedLocale.value, {
762
- weekday: "short",
763
- month: "short",
764
- day: "numeric",
765
- hour: "numeric",
766
- minute: "numeric"
767
- })}`;
1342
+ const start = toDate(event.start);
1343
+ if (!start) return event.title;
1344
+ return `${event.title} — ${formatDate(start, resolvedLocale.value, {
1345
+ weekday: "short",
1346
+ month: "short",
1347
+ day: "numeric",
1348
+ hour: "numeric",
1349
+ minute: "numeric"
1350
+ })}`;
768
1351
  }
1352
+ /*********************************************************
1353
+ * Click + drag-select wiring.
1354
+ *
1355
+ * Month view: `mousedown` on a cell starts a drag, `mouseenter` on
1356
+ * subsequent cells extends it, `mouseup` (window-level) emits the
1357
+ * range. We listen to `mouseup` on the document to catch drags
1358
+ * that end outside the calendar root.
1359
+ *
1360
+ * Week / day view: same idea but on individual slots, with a
1361
+ * pixel-level overlay that paints the in-progress range.
1362
+ ********************************************************/
769
1363
  const monthDrag = ref(null);
770
1364
  const dragSelection = ref(null);
771
1365
  const isMouseDown = ref(false);
772
1366
  function onDayClick(date, _event) {
773
- if (isDayDisabled(date)) return;
774
- if (monthDrag.value && !isSameDay(monthDrag.value.startDate, monthDrag.value.endDate)) return;
775
- emit("date-click", date);
1367
+ if (isDayDisabled(date)) return;
1368
+ if (monthDrag.value && !isSameDay(monthDrag.value.startDate, monthDrag.value.endDate)) return;
1369
+ emit("date-click", date);
776
1370
  }
777
1371
  function onCellMouseDown(date, _ev) {
778
- if (!props.selectable) return;
779
- if (isDayDisabled(date)) return;
780
- isMouseDown.value = true;
781
- monthDrag.value = { startDate: date, endDate: date };
1372
+ if (!props.selectable) return;
1373
+ if (isDayDisabled(date)) return;
1374
+ isMouseDown.value = true;
1375
+ monthDrag.value = {
1376
+ startDate: date,
1377
+ endDate: date
1378
+ };
782
1379
  }
783
1380
  function onCellMouseEnter(date) {
784
- if (!isMouseDown.value || !monthDrag.value) return;
785
- monthDrag.value = { startDate: monthDrag.value.startDate, endDate: date };
1381
+ if (!isMouseDown.value || !monthDrag.value) return;
1382
+ monthDrag.value = {
1383
+ startDate: monthDrag.value.startDate,
1384
+ endDate: date
1385
+ };
786
1386
  }
787
1387
  function onMonthMouseUp() {
788
- if (!monthDrag.value || !isMouseDown.value) {
789
- isMouseDown.value = false;
790
- return;
791
- }
792
- const { startDate, endDate } = monthDrag.value;
793
- isMouseDown.value = false;
794
- if (!isSameDay(startDate, endDate)) {
795
- const [from, to] = startDate.getTime() <= endDate.getTime() ? [startDate, endDate] : [endDate, startDate];
796
- emit("range-select", from, to);
797
- emit("create-event-request", from, to);
798
- }
799
- monthDrag.value = null;
1388
+ if (!monthDrag.value || !isMouseDown.value) {
1389
+ isMouseDown.value = false;
1390
+ return;
1391
+ }
1392
+ const { startDate, endDate } = monthDrag.value;
1393
+ isMouseDown.value = false;
1394
+ if (!isSameDay(startDate, endDate)) {
1395
+ const [from, to] = startDate.getTime() <= endDate.getTime() ? [startDate, endDate] : [endDate, startDate];
1396
+ emit("range-select", from, to);
1397
+ emit("create-event-request", from, to);
1398
+ }
1399
+ monthDrag.value = null;
800
1400
  }
801
1401
  function isInDragSelection(date) {
802
- if (!monthDrag.value) return false;
803
- const { startDate, endDate } = monthDrag.value;
804
- const [from, to] = startDate.getTime() <= endDate.getTime() ? [startDate, endDate] : [endDate, startDate];
805
- return date.getTime() >= startOfDay(from).getTime() && date.getTime() <= startOfDay(to).getTime() + 24 * 60 * 60 * 1e3 - 1;
1402
+ if (!monthDrag.value) return false;
1403
+ const { startDate, endDate } = monthDrag.value;
1404
+ const [from, to] = startDate.getTime() <= endDate.getTime() ? [startDate, endDate] : [endDate, startDate];
1405
+ return date.getTime() >= startOfDay(from).getTime() && date.getTime() <= startOfDay(to).getTime() + 24 * 60 * 60 * 1e3 - 1;
806
1406
  }
807
1407
  function slotMinutesFromY(event) {
808
- const target = event.currentTarget;
809
- const rect = target.getBoundingClientRect();
810
- const y = event.clientY - rect.top;
811
- const pxPerMin = slotPx / slotDuration.value;
812
- return Math.max(0, Math.round(y / pxPerMin));
1408
+ const target = event.currentTarget;
1409
+ const rect = target.getBoundingClientRect();
1410
+ const y = event.clientY - rect.top;
1411
+ const pxPerMin = slotPx / slotDuration.value;
1412
+ return Math.max(0, Math.round(y / pxPerMin));
813
1413
  }
814
1414
  function onSlotMouseDown(day, event) {
815
- if (!props.selectable) return;
816
- if (event.button !== 0) return;
817
- const minutes = slotMinutesFromY(event);
818
- const start = new Date(day);
819
- start.setHours(dayStartHour.value, 0, 0, 0);
820
- start.setMinutes(start.getMinutes() + minutes);
821
- dragSelection.value = { day, startMin: minutes, endMin: minutes + slotDuration.value };
822
- isMouseDown.value = true;
1415
+ if (!props.selectable) return;
1416
+ if (event.button !== 0) return;
1417
+ const minutes = slotMinutesFromY(event);
1418
+ const start = new Date(day);
1419
+ start.setHours(dayStartHour.value, 0, 0, 0);
1420
+ start.setMinutes(start.getMinutes() + minutes);
1421
+ dragSelection.value = {
1422
+ day,
1423
+ startMin: minutes,
1424
+ endMin: minutes + slotDuration.value
1425
+ };
1426
+ isMouseDown.value = true;
823
1427
  }
824
1428
  function onSlotMouseMove(day, event) {
825
- if (!isMouseDown.value || !dragSelection.value) return;
826
- if (!isSameDayLocal(dragSelection.value.day, day)) return;
827
- const minutes = slotMinutesFromY(event);
828
- dragSelection.value = {
829
- day: dragSelection.value.day,
830
- startMin: dragSelection.value.startMin,
831
- endMin: Math.max(minutes, dragSelection.value.startMin + slotDuration.value)
832
- };
1429
+ if (!isMouseDown.value || !dragSelection.value) return;
1430
+ if (!isSameDayLocal(dragSelection.value.day, day)) return;
1431
+ const minutes = slotMinutesFromY(event);
1432
+ dragSelection.value = {
1433
+ day: dragSelection.value.day,
1434
+ startMin: dragSelection.value.startMin,
1435
+ endMin: Math.max(minutes, dragSelection.value.startMin + slotDuration.value)
1436
+ };
833
1437
  }
834
1438
  function onSlotMouseUp(day, _event) {
835
- if (!isMouseDown.value || !dragSelection.value) {
836
- isMouseDown.value = false;
837
- return;
838
- }
839
- const start = new Date(day);
840
- start.setHours(dayStartHour.value, 0, 0, 0);
841
- start.setMinutes(start.getMinutes() + dragSelection.value.startMin);
842
- const end = new Date(start);
843
- end.setMinutes(start.getMinutes() + (dragSelection.value.endMin - dragSelection.value.startMin));
844
- const dragged = dragSelection.value.endMin - dragSelection.value.startMin > slotDuration.value;
845
- isMouseDown.value = false;
846
- dragSelection.value = null;
847
- if (dragged) {
848
- emit("range-select", start, end);
849
- emit("create-event-request", start, end);
850
- }
1439
+ if (!isMouseDown.value || !dragSelection.value) {
1440
+ isMouseDown.value = false;
1441
+ return;
1442
+ }
1443
+ const start = new Date(day);
1444
+ start.setHours(dayStartHour.value, 0, 0, 0);
1445
+ start.setMinutes(start.getMinutes() + dragSelection.value.startMin);
1446
+ const end = new Date(start);
1447
+ end.setMinutes(start.getMinutes() + (dragSelection.value.endMin - dragSelection.value.startMin));
1448
+ const dragged = dragSelection.value.endMin - dragSelection.value.startMin > slotDuration.value;
1449
+ isMouseDown.value = false;
1450
+ dragSelection.value = null;
1451
+ if (dragged) {
1452
+ emit("range-select", start, end);
1453
+ emit("create-event-request", start, end);
1454
+ }
851
1455
  }
852
1456
  function onSlotClick(day, event) {
853
- const minutes = slotMinutesFromY(event);
854
- const slotDate = new Date(day);
855
- slotDate.setHours(dayStartHour.value, 0, 0, 0);
856
- slotDate.setMinutes(slotDate.getMinutes() + minutes);
857
- const wasDrag = dragSelection.value !== null;
858
- if (!wasDrag) emit("date-click", slotDate);
1457
+ const minutes = slotMinutesFromY(event);
1458
+ const slotDate = new Date(day);
1459
+ slotDate.setHours(dayStartHour.value, 0, 0, 0);
1460
+ slotDate.setMinutes(slotDate.getMinutes() + minutes);
1461
+ // Only emit when this wasn't part of a drag.
1462
+ const wasDrag = dragSelection.value !== null;
1463
+ if (!wasDrag) emit("date-click", slotDate);
859
1464
  }
860
1465
  const dragOverlayStyle = computed(() => {
861
- if (!dragSelection.value) return {};
862
- const pxPerMin = slotPx / slotDuration.value;
863
- return {
864
- top: `${dragSelection.value.startMin * pxPerMin}px`,
865
- height: `${(dragSelection.value.endMin - dragSelection.value.startMin) * pxPerMin}px`
866
- };
1466
+ if (!dragSelection.value) return {};
1467
+ const pxPerMin = slotPx / slotDuration.value;
1468
+ return {
1469
+ top: `${dragSelection.value.startMin * pxPerMin}px`,
1470
+ height: `${(dragSelection.value.endMin - dragSelection.value.startMin) * pxPerMin}px`
1471
+ };
867
1472
  });
868
1473
  function isSameDayLocal(a, b) {
869
- return isSameDay(a, b);
1474
+ return isSameDay(a, b);
870
1475
  }
1476
+ /*********************************************************
1477
+ * Global mouseup listener — attached on mount so drags that end
1478
+ * outside the calendar root still emit. SSR-safe because the
1479
+ * onMounted hook only runs client-side.
1480
+ ********************************************************/
871
1481
  if (typeof window !== "undefined") {
872
- window.addEventListener("mouseup", () => {
873
- if (monthDrag.value) onMonthMouseUp();
874
- else if (dragSelection.value) {
875
- dragSelection.value = null;
876
- isMouseDown.value = false;
877
- }
878
- });
1482
+ window.addEventListener("mouseup", () => {
1483
+ if (monthDrag.value) onMonthMouseUp();
1484
+ else if (dragSelection.value) {
1485
+ dragSelection.value = null;
1486
+ isMouseDown.value = false;
1487
+ }
1488
+ });
879
1489
  }
880
1490
  function onEventClick(event, originalEvent) {
881
- emit("event-click", event, originalEvent);
1491
+ emit("event-click", event, originalEvent);
882
1492
  }
1493
+ /*********************************************************
1494
+ * Keyboard navigation — arrow keys move the current date by the
1495
+ * unit relevant to the view. Page Up / Page Down jump month.
1496
+ *
1497
+ * @description
1498
+ * ⛔ issue #390 — moving `internalDate` alone changed no visible
1499
+ * focus: `document.activeElement` never moved because nothing ever
1500
+ * called `.focus()` on the new cell (measured: `ArrowRight` on a
1501
+ * focused cell left `activeElement` unchanged). `focusDayCell` closes
1502
+ * that gap — `nextTick` because the roving tabindex (`isRovingTabStop`)
1503
+ * must repaint to `0` on the new cell before it becomes a valid
1504
+ * `.focus()` target for AT / Tab semantics, even though a script-driven
1505
+ * `.focus()` call itself would technically still land on a `tabindex="-1"`
1506
+ * element.
1507
+ *
1508
+ * ⛔ issue #443 — Enter/Space on a day cell had NO keyboard equivalent
1509
+ * to a mouse click (`onDayClick`) at all. Gated on the event target
1510
+ * actually being a grid cell so it doesn't fire from Enter/Space
1511
+ * pressed on the toolbar buttons or an event chip that also bubble
1512
+ * through this ONE delegated root listener.
1513
+ ********************************************************/
883
1514
  function onKeydown(event) {
884
- const target = event.target;
885
- if (target && (target.tagName === "INPUT" || target.tagName === "TEXTAREA")) return;
886
- if (event.key === KEYBOARD_VALUES.ENTER || event.key === KEYBOARD_VALUES.EMPTY) {
887
- if (target?.getAttribute("role") !== "gridcell") return;
888
- event.preventDefault();
889
- onDayClick(resolvedDate.value, event);
890
- return;
891
- }
892
- let next = null;
893
- const current = resolvedDate.value;
894
- switch (event.key) {
895
- case "ArrowRight":
896
- next = calendar.helpers.addDays(current, 1);
897
- break;
898
- case "ArrowLeft":
899
- next = calendar.helpers.addDays(current, -1);
900
- break;
901
- case "ArrowUp":
902
- next = calendar.helpers.addDays(current, -7);
903
- break;
904
- case "ArrowDown":
905
- next = calendar.helpers.addDays(current, 7);
906
- break;
907
- case "PageUp":
908
- next = calendar.helpers.addMonths(current, -1);
909
- break;
910
- case "PageDown":
911
- next = calendar.helpers.addMonths(current, 1);
912
- break;
913
- }
914
- if (next) {
915
- event.preventDefault();
916
- internalDate.value = next;
917
- emit("update:currentDate", next);
918
- const focusTarget = next;
919
- nextTick(() => focusDayCell(focusTarget));
920
- }
1515
+ const target = event.target;
1516
+ if (target && (target.tagName === "INPUT" || target.tagName === "TEXTAREA")) return;
1517
+ if (event.key === KEYBOARD_VALUES.ENTER || event.key === KEYBOARD_VALUES.EMPTY) {
1518
+ if (target?.getAttribute("role") !== "gridcell") return;
1519
+ event.preventDefault();
1520
+ onDayClick(resolvedDate.value, event);
1521
+ return;
1522
+ }
1523
+ let next = null;
1524
+ const current = resolvedDate.value;
1525
+ switch (event.key) {
1526
+ case "ArrowRight":
1527
+ next = calendar.helpers.addDays(current, 1);
1528
+ break;
1529
+ case "ArrowLeft":
1530
+ next = calendar.helpers.addDays(current, -1);
1531
+ break;
1532
+ case "ArrowUp":
1533
+ next = calendar.helpers.addDays(current, -7);
1534
+ break;
1535
+ case "ArrowDown":
1536
+ next = calendar.helpers.addDays(current, 7);
1537
+ break;
1538
+ case "PageUp":
1539
+ next = calendar.helpers.addMonths(current, -1);
1540
+ break;
1541
+ case "PageDown":
1542
+ next = calendar.helpers.addMonths(current, 1);
1543
+ break;
1544
+ }
1545
+ if (next) {
1546
+ event.preventDefault();
1547
+ internalDate.value = next;
1548
+ emit("update:currentDate", next);
1549
+ const focusTarget = next;
1550
+ /*********************************************************
1551
+ * Promesse flottante, deliberement
1552
+ *
1553
+ * @description
1554
+ * Le focus se pose au tick suivant et rien n'attend la promesse.
1555
+ * Le `void` qui marquait cette intention est retire (Sonar #771) :
1556
+ * la valeur de retour reste ignoree a l'identique.
1557
+ ********************************************************/
1558
+ nextTick(() => focusDayCell(focusTarget));
1559
+ }
921
1560
  }
922
- const {
923
- borderClasses,
924
- borderStyles,
925
- roundedClasses,
926
- roundedStyles,
927
- elevationClasses,
928
- elevationStyles,
929
- paddingClasses,
930
- paddingStyles,
931
- marginClasses,
932
- marginStyles
933
- } = useStateEffect(props);
1561
+ /*********************************************************
1562
+ * Cross-cutting surface — same contract as every other origam
1563
+ * component for the non-colour axes (border / rounded / elevation /
1564
+ * padding / margin via `useStateEffect`, dimension via
1565
+ * `useDimension`, density via `useDensity`).
1566
+ ********************************************************/
1567
+ const { borderClasses, borderStyles, roundedClasses, roundedStyles, elevationClasses, elevationStyles, paddingClasses, paddingStyles, marginClasses, marginStyles } = useStateEffect(props);
934
1568
  const { dimensionStyles } = useDimension(props);
935
1569
  const { densityClasses } = useDensity(props, "origam-calendar");
1570
+ // `useBorder` (via useStateEffect) emits the raw `borderColor` value,
1571
+ // invalid for an intent keyword — resolve intents to their token here.
936
1572
  const borderColorStyle = computed(() => {
937
- const value = props.borderColor;
938
- return value && isIntent(value) ? [`border-color: ${tokenForegroundForIntent(value)}`] : [];
1573
+ const value = props.borderColor;
1574
+ return value && isIntent(value) ? [`border-color: ${tokenForegroundForIntent(value)}`] : [];
939
1575
  });
1576
+ /*********************************************************
1577
+ * Colour surface — REGION-AWARE. `bgColor` paints ONLY the header
1578
+ * (the toolbar), never the root: the body (weekday row, month grid,
1579
+ * week / day timeline, agenda) is transparent and would otherwise let
1580
+ * the colour bleed through everything that isn't an opaque cell — which
1581
+ * is exactly what happens in the timeline views.
1582
+ *
1583
+ * - TOOLBAR (painted by `bgColor`) → its text CONTRASTS that surface.
1584
+ * - BODY (everything else, on the calendar's own light surface) →
1585
+ * text uses the `color` intent directly (coloured-on-light).
1586
+ ********************************************************/
940
1587
  const surfaceVars = computed(() => {
941
- const vars = {};
942
- const bg = props.bgColor;
943
- const fg = props.color;
944
- const bgIntent = Boolean(bg) && isIntent(bg);
945
- const bgCss = Boolean(bg) && typeof bg === "string" && isCssColor(bg);
946
- const fgIntent = Boolean(fg) && isIntent(fg);
947
- const fgCss = Boolean(fg) && typeof fg === "string" && isCssColor(fg);
948
- if (bgIntent) {
949
- vars["--origam-calendar__toolbar---background-color"] = tokenStylesForIntent(bg, "default")["background-color"];
950
- } else if (bgCss) {
951
- vars["--origam-calendar__toolbar---background-color"] = bg;
952
- }
953
- let headerFg;
954
- if (bgIntent) {
955
- headerFg = tokenStylesForIntent(bg, "default").color;
956
- } else if (bgCss) {
957
- headerFg = getForeground(parseColor(bg));
958
- } else if (fgIntent) {
959
- headerFg = tokenForegroundForIntent(fg);
960
- } else if (fgCss) {
961
- headerFg = fg;
962
- }
963
- if (headerFg) vars["--origam-calendar__toolbar---color"] = headerFg;
964
- let bodyFg;
965
- if (fgIntent) bodyFg = tokenForegroundForIntent(fg);
966
- else if (fgCss) bodyFg = fg;
967
- if (bodyFg) {
968
- vars["--origam-calendar__day-cell---color"] = bodyFg;
969
- vars["--origam-calendar__weekday---color"] = bodyFg;
970
- }
971
- return vars;
1588
+ const vars = {};
1589
+ const bg = props.bgColor;
1590
+ const fg = props.color;
1591
+ const bgIntent = Boolean(bg) && isIntent(bg);
1592
+ const bgCss = Boolean(bg) && typeof bg === "string" && isCssColor(bg);
1593
+ const fgIntent = Boolean(fg) && isIntent(fg);
1594
+ const fgCss = Boolean(fg) && typeof fg === "string" && isCssColor(fg);
1595
+ // 1. Toolbar paint — the HEADER only. Never the root, so no view
1596
+ // (month / week / day / agenda) ever tints its body.
1597
+ if (bgIntent) {
1598
+ vars["--origam-calendar__toolbar---background-color"] = tokenStylesForIntent(bg, "default")["background-color"];
1599
+ } else if (bgCss) {
1600
+ vars["--origam-calendar__toolbar---background-color"] = bg;
1601
+ }
1602
+ // 2. Toolbar foreground — contrasts the painted toolbar; falls back
1603
+ // to the `color` accent when the toolbar isn't painted.
1604
+ let headerFg;
1605
+ if (bgIntent) {
1606
+ headerFg = tokenStylesForIntent(bg, "default").color;
1607
+ } else if (bgCss) {
1608
+ headerFg = getForeground(parseColor(bg));
1609
+ } else if (fgIntent) {
1610
+ headerFg = tokenForegroundForIntent(fg);
1611
+ } else if (fgCss) {
1612
+ headerFg = fg;
1613
+ }
1614
+ if (headerFg) vars["--origam-calendar__toolbar---color"] = headerFg;
1615
+ // 3. Body foreground — weekday labels + day cells sit on the light
1616
+ // body surface, so they use the `color` intent directly. Left
1617
+ // unset when `color` is absent so they keep their natural text.
1618
+ let bodyFg;
1619
+ if (fgIntent) bodyFg = tokenForegroundForIntent(fg);
1620
+ else if (fgCss) bodyFg = fg;
1621
+ if (bodyFg) {
1622
+ vars["--origam-calendar__day-cell---color"] = bodyFg;
1623
+ vars["--origam-calendar__weekday---color"] = bodyFg;
1624
+ }
1625
+ return vars;
972
1626
  });
1627
+ /*********************************************************
1628
+ * Class & Style
1629
+ ********************************************************/
973
1630
  const rootClasses = computed(() => [
974
- `origam-calendar--${resolvedView.value}`,
975
- {
976
- "origam-calendar--week-numbers": showWeekNumbers.value
977
- },
978
- borderClasses.value,
979
- roundedClasses.value,
980
- elevationClasses.value,
981
- paddingClasses.value,
982
- marginClasses.value,
983
- densityClasses.value,
984
- props.class
1631
+ `origam-calendar--${resolvedView.value}`,
1632
+ { "origam-calendar--week-numbers": showWeekNumbers.value },
1633
+ borderClasses.value,
1634
+ roundedClasses.value,
1635
+ elevationClasses.value,
1636
+ paddingClasses.value,
1637
+ marginClasses.value,
1638
+ densityClasses.value,
1639
+ props.class
985
1640
  ]);
986
1641
  const rootStyles = computed(() => [
987
- surfaceVars.value,
988
- borderStyles.value,
989
- borderColorStyle.value,
990
- roundedStyles.value,
991
- elevationStyles.value,
992
- paddingStyles.value,
993
- marginStyles.value,
994
- dimensionStyles.value,
995
- props.style
1642
+ surfaceVars.value,
1643
+ borderStyles.value,
1644
+ borderColorStyle.value,
1645
+ roundedStyles.value,
1646
+ elevationStyles.value,
1647
+ paddingStyles.value,
1648
+ marginStyles.value,
1649
+ dimensionStyles.value,
1650
+ props.style
996
1651
  ]);
1652
+ /*********************************************************
1653
+ * Expose
1654
+ ********************************************************/
997
1655
  defineExpose({
998
- visibleDateRange: calendar.visibleDateRange,
999
- expandedEvents: calendar.expandedEvents,
1000
- navigate: onNavigate,
1001
- setView: onSetView
1656
+ visibleDateRange: calendar.visibleDateRange,
1657
+ expandedEvents: calendar.expandedEvents,
1658
+ navigate: onNavigate,
1659
+ setView: onSetView
1002
1660
  });
1003
1661
  </script>
1004
1662