@cocoar/vue-ui 3.4.0-beta.36 → 3.4.0-beta.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/skills/cocoar-vue-ui/SKILL.md +2 -0
- package/skills/cocoar-vue-ui/references/components/calendar/board.md +207 -0
- package/skills/cocoar-vue-ui/references/components/calendar/coar-calendar.md +32 -1
- package/skills/cocoar-vue-ui/references/components/calendar/day-view.md +21 -0
- package/skills/cocoar-vue-ui/references/components/calendar/mini-month.md +59 -0
- package/skills/cocoar-vue-ui/references/components/calendar/month-view.md +47 -1
- package/skills/cocoar-vue-ui/references/foundations/theming.md +2 -0
- package/skills/cocoar-vue-ui/references/guide/mobile.md +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocoar/vue-ui",
|
|
3
|
-
"version": "3.4.0-beta.
|
|
3
|
+
"version": "3.4.0-beta.39",
|
|
4
4
|
"description": "Cocoar Design System — a tablet-first Vue 3 component library with 30+ accessible, themeable components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"skills"
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@cocoar/vue-localization": "3.4.0-beta.
|
|
61
|
+
"@cocoar/vue-localization": "3.4.0-beta.39",
|
|
62
62
|
"@fontsource/cascadia-code": "^5.2.3",
|
|
63
63
|
"@fontsource/inter": "^5.2.8",
|
|
64
64
|
"@fontsource/onest": "^5.3.1",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"vue": "^3.5.32",
|
|
85
85
|
"vue-router": "^5.0.4"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "15cb0ccca38f7a45bdfbeb0875f155f464c86149",
|
|
88
88
|
"scripts": {
|
|
89
89
|
"build": "vite build",
|
|
90
90
|
"test": "vitest run",
|
|
@@ -242,6 +242,8 @@ of each other.
|
|
|
242
242
|
- [Calendar (Preview)](references/components/calendar/index.md) — @cocoar/vue-calendar — Temporal-based Vue 3 calendar with Year, Month, Week, Day and Agenda views, iOS-style display variations, recurrence and standalone sub-views
|
|
243
243
|
- [`<CoarCalendar>` — Composer (Preview)](references/components/calendar/coar-calendar.md) — CoarCalendar — top-level calendar shell wiring the iOS-style Year, Month, Day and Agenda hierarchy plus Week and Work Week, driven by the chainable useCalendar builder
|
|
244
244
|
- [`<CoarYearView>` — Year View (Preview)](references/components/calendar/year-view.md) — CoarYearView — responsive twelve-month calendar overview with today marker and drill-in to the continuous Month view
|
|
245
|
+
- [`<CoarCalendarBoard>` — Board (Preview)](references/components/calendar/board.md) — CoarCalendarBoard — rows of day cells with bars running across: a week by parts of the day, a week per resource, a year wall planner
|
|
246
|
+
- [`<CoarMiniMonth>` — Mini Month (Preview)](references/components/calendar/mini-month.md) — CoarMiniMonth — a small month for picking a day, with its own paging, week highlight and keyboard navigation, without a builder
|
|
245
247
|
- [Month Views (Preview)](references/components/calendar/month-view.md) — Month views — continuously scrolling Compact, Stacked and Details months, responsive Month List, and the lower-level CoarMonthView section
|
|
246
248
|
- [`<CoarDayView>` — Day View (Preview)](references/components/calendar/day-view.md) — CoarDayView — one-day or width-aware multi-day time grid with hour axis, all-day band, configurable columns, time range and slot duration
|
|
247
249
|
- [`<CoarWeekView>` — Week View (Preview)](references/components/calendar/week-view.md) — CoarWeekView — 7-day time-grid calendar view with hour axis, all-day band, locale-aware first day of week and a customizable day-header slot
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
<!-- Generated from apps/docs/components/calendar/board.md by apps/docs/scripts/sync-skill.mjs. Do not edit; edit the docs page. -->
|
|
2
|
+
|
|
3
|
+
# `<CoarCalendarBoard>` — Board (Preview)
|
|
4
|
+
|
|
5
|
+
**Devices:** desktop ready · tablet ready · phone partial — The grid works on touch; on a phone seven columns are narrow, so a week usually reads better as rows of days.
|
|
6
|
+
|
|
7
|
+
A board is a grid of day cells with bars running across them. Its **rows** decide what it shows, so the same component draws a week by morning, afternoon and evening, a week with one row per resource, and a year wall planner. What a row means stays with your app.
|
|
8
|
+
|
|
9
|
+
**Demo — `calendar/demos/BoardWeek.vue`**
|
|
10
|
+
|
|
11
|
+
```vue
|
|
12
|
+
<template>
|
|
13
|
+
<div style="border: 1px solid var(--coar-border-neutral-tertiary); border-radius: var(--coar-radius-xs); overflow: hidden;">
|
|
14
|
+
<CoarCalendarBoard :builder="builder" :rows="rows">
|
|
15
|
+
<template #rowLabel="{ row }">{{ labels[row.key] }}</template>
|
|
16
|
+
<template #cell="{ row, date }">
|
|
17
|
+
<span v-if="row.key === 'meals'" style="color: var(--coar-text-subtle)">{{ meals[date.dayOfWeek - 1] }}</span>
|
|
18
|
+
</template>
|
|
19
|
+
</CoarCalendarBoard>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script setup lang="ts">
|
|
24
|
+
import { ref } from 'vue';
|
|
25
|
+
import {
|
|
26
|
+
BOARD_ALL_DAY_ROW,
|
|
27
|
+
CoarCalendarBoard,
|
|
28
|
+
Temporal,
|
|
29
|
+
useCalendar,
|
|
30
|
+
weekBoardRows,
|
|
31
|
+
type BoardRowsContext,
|
|
32
|
+
type CalendarEvent,
|
|
33
|
+
type CalendarPeriod,
|
|
34
|
+
} from '@cocoar/vue-calendar';
|
|
35
|
+
|
|
36
|
+
const periods: CalendarPeriod[] = [
|
|
37
|
+
{ key: 'morning', startMinutes: 0, endMinutes: 12 * 60 },
|
|
38
|
+
{ key: 'afternoon', startMinutes: 12 * 60, endMinutes: 18 * 60 },
|
|
39
|
+
{ key: 'evening', startMinutes: 18 * 60, endMinutes: 24 * 60 },
|
|
40
|
+
];
|
|
41
|
+
const labels: Record<string, string> = {
|
|
42
|
+
[BOARD_ALL_DAY_ROW]: 'All day',
|
|
43
|
+
morning: 'Morning',
|
|
44
|
+
afternoon: 'Afternoon',
|
|
45
|
+
evening: 'Evening',
|
|
46
|
+
meals: 'Dinner',
|
|
47
|
+
};
|
|
48
|
+
const meals = ['Soup', 'Pasta', 'Curry', 'Tacos', 'Fish', 'Pizza', 'Roast'];
|
|
49
|
+
|
|
50
|
+
const zdt = (iso: string) => Temporal.ZonedDateTime.from(`${iso}[Europe/Vienna]`);
|
|
51
|
+
const events = ref<CalendarEvent[]>([
|
|
52
|
+
{ id: 'camp', start: Temporal.PlainDate.from('2026-11-17'), end: Temporal.PlainDate.from('2026-11-20'), meta: { title: 'Project week', color: '#7c3aed' } },
|
|
53
|
+
{ id: 'dentist', start: zdt('2026-11-16T09:00'), end: zdt('2026-11-16T10:00'), meta: { title: 'Dentist', color: '#0891b2' } },
|
|
54
|
+
{ id: 'training', start: zdt('2026-11-19T15:30'), end: zdt('2026-11-19T17:00'), meta: { title: 'Training', color: '#2f855a' } },
|
|
55
|
+
{ id: 'parents', start: zdt('2026-11-19T19:00'), end: zdt('2026-11-19T20:30'), meta: { title: 'Parents evening', color: '#c05621' } },
|
|
56
|
+
{ id: 'hike', start: zdt('2026-11-22T10:00'), end: zdt('2026-11-22T15:00'), meta: { title: 'Hike', color: '#2563eb' } },
|
|
57
|
+
]);
|
|
58
|
+
|
|
59
|
+
const { builder } = useCalendar();
|
|
60
|
+
builder
|
|
61
|
+
.view('week')
|
|
62
|
+
.date(Temporal.PlainDate.from('2026-11-19'))
|
|
63
|
+
.timezone('Europe/Vienna')
|
|
64
|
+
.locale('en-GB')
|
|
65
|
+
.firstDayOfWeek(1)
|
|
66
|
+
.events(events);
|
|
67
|
+
|
|
68
|
+
const rows = (context: BoardRowsContext) =>
|
|
69
|
+
weekBoardRows({ dates: context.dates, periods, timezone: context.timezone, extraRows: ['meals'] });
|
|
70
|
+
</script>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## A week by parts of the day
|
|
74
|
+
|
|
75
|
+
```vue
|
|
76
|
+
<script setup lang="ts">
|
|
77
|
+
import { CoarCalendarBoard, useCalendar, weekBoardRows, type BoardRowsContext } from '@cocoar/vue-calendar';
|
|
78
|
+
|
|
79
|
+
const { builder } = useCalendar();
|
|
80
|
+
const periods = [
|
|
81
|
+
{ key: 'morning', startMinutes: 0, endMinutes: 12 * 60 },
|
|
82
|
+
{ key: 'afternoon', startMinutes: 12 * 60, endMinutes: 18 * 60 },
|
|
83
|
+
{ key: 'evening', startMinutes: 18 * 60, endMinutes: 24 * 60 },
|
|
84
|
+
];
|
|
85
|
+
const rows = (context: BoardRowsContext) =>
|
|
86
|
+
weekBoardRows({ dates: context.dates, periods, timezone: context.timezone, extraRows: ['meals'] });
|
|
87
|
+
</script>
|
|
88
|
+
|
|
89
|
+
<template>
|
|
90
|
+
<CoarCalendarBoard :builder="builder" :rows="rows">
|
|
91
|
+
<template #rowLabel="{ row }">{{ row.key }}</template>
|
|
92
|
+
<template #cell="{ row, date }">
|
|
93
|
+
<MealOfTheDay v-if="row.key === 'meals'" :date="date" />
|
|
94
|
+
</template>
|
|
95
|
+
</CoarCalendarBoard>
|
|
96
|
+
</template>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
A timed event stands in the period it **starts** in. All-day and multi-day events run as bars in the all-day row (`BOARD_ALL_DAY_ROW`). A timed event outside every period goes to the next one, so it is never lost.
|
|
100
|
+
|
|
101
|
+
## A week per resource
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
const rows = (context: BoardRowsContext) =>
|
|
105
|
+
resourceWeekRows({
|
|
106
|
+
dates: context.dates,
|
|
107
|
+
resources: ['emma', 'jonas'],
|
|
108
|
+
resourcesOf: (event) => event.meta.personIds,
|
|
109
|
+
extraRows: ['allFree'],
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
A shared event stands in the row of each of its resources. Events of no listed resource get the row `BOARD_UNASSIGNED_ROW`, which appears only when there are any. For "who is free", use [`computeOccupancy`](./coar-calendar.md#occupancy).
|
|
114
|
+
|
|
115
|
+
## A year wall planner
|
|
116
|
+
|
|
117
|
+
Twelve rows of 31 columns keep holidays readable as continuous bands, which twelve small month grids would tear apart.
|
|
118
|
+
|
|
119
|
+
```vue
|
|
120
|
+
<CoarCalendarBoard
|
|
121
|
+
:builder="builder"
|
|
122
|
+
range="year"
|
|
123
|
+
:columns="yearWallColumns()"
|
|
124
|
+
:rows="(context) => yearWallRows({ year: context.year, locale: 'de-AT' })"
|
|
125
|
+
>
|
|
126
|
+
<template #cell="{ events }">
|
|
127
|
+
<span v-if="events.length" class="dot" />
|
|
128
|
+
</template>
|
|
129
|
+
</CoarCalendarBoard>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Multi-day events run as bands through each month and show their title where it fits. Single-day events are not drawn; they reach the `#cell` slot, so you decide what a dot means. A month's missing days stay as empty cells.
|
|
133
|
+
|
|
134
|
+
## Moving, selecting, paging
|
|
135
|
+
|
|
136
|
+
Dragging an event runs through the same drop pipeline as the other views: `onEventDrop`, `canDrop` and the DST policy apply. On another day the event keeps its time. In another part of the day it starts where that part starts, or at the period's `dropMinutes`, which you want for a morning that begins at 00:00. The duration always stays.
|
|
137
|
+
|
|
138
|
+
The payload's `target.rowKey` and `target.sourceRowKey` say which rows were involved, and `canDrop` gets `rowKey`. What a change of row means, such as another person, is for your `onEventDrop` to apply.
|
|
139
|
+
|
|
140
|
+
Enter, Space and `element.click()` on an event or bar fire `onEventClick` like a press without movement does.
|
|
141
|
+
|
|
142
|
+
With `selectable`, dragging across the days of a row emits `rangeSelect` with `{ rowKey, start, end, native }`, both days inclusive. A mouse selects at once, a touch after a long press. A horizontal swipe turns the page unless `swipeNavigation(false)` is set.
|
|
143
|
+
|
|
144
|
+
## Your own rows
|
|
145
|
+
|
|
146
|
+
A row is plain data, so you can build any set:
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
interface BoardRow<TMeta> {
|
|
150
|
+
key: string;
|
|
151
|
+
dates: (Temporal.PlainDate | null)[]; // one per column, null = no day here
|
|
152
|
+
kind: 'cells' | 'bars' | 'custom';
|
|
153
|
+
match?: (event: CalendarEvent<TMeta>) => boolean;
|
|
154
|
+
hideWhenEmpty?: boolean;
|
|
155
|
+
period?: CalendarPeriod; // a drop onto this row starts in this period
|
|
156
|
+
label?: string; // default: key
|
|
157
|
+
class?: string; // extra class, to set tokens for this row
|
|
158
|
+
showCellEvents?: boolean; // false: single-day events only reach #cell
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
`cells` puts single-day events into their cell and runs multi-day events as bars. `bars` runs every event as a bar. `custom` shows no events and leaves the cells to the `#cell` slot.
|
|
163
|
+
|
|
164
|
+
## Props and slots
|
|
165
|
+
|
|
166
|
+
| Prop | Type | Description |
|
|
167
|
+
|---|---|---|
|
|
168
|
+
| `builder` | `CalendarBuilder` | **Required.** Events, cursor, zone, locale and the click handlers. |
|
|
169
|
+
| `rows` | `BoardRow[] \| (context) => BoardRow[]` | **Required.** The function form gets the visible `dates`, `year` and `timezone`. |
|
|
170
|
+
| `range` | `'week' \| 'year'` | The window to load and page. Default `week`. |
|
|
171
|
+
| `columns` | `{ key, label }[]` | Column headers. Default: the dates of the first row. |
|
|
172
|
+
| `selectable` | `boolean` | Drag across days to select them. Default `false`. |
|
|
173
|
+
| `fill` | `boolean` | Take the parent's height; rows of cells share what the others leave. Default `false`. |
|
|
174
|
+
| `hideHeader` | `boolean` | Leave out the column headers, for rows that name their own day. Default `false`. |
|
|
175
|
+
|
|
176
|
+
| Event | Payload | Description |
|
|
177
|
+
|---|---|---|
|
|
178
|
+
| `rangeSelect` | `{ rowKey, start, end, native }` | Days selected in one row, both inclusive. |
|
|
179
|
+
|
|
180
|
+
| Slot | Scope | Purpose |
|
|
181
|
+
|---|---|---|
|
|
182
|
+
| `rowLabel` | `{ row }` | The label at the start of a row. |
|
|
183
|
+
| `columnHeader` | `{ date, column, index, isToday }` | A column header. |
|
|
184
|
+
| `event` | `{ event, row, date }` | An event in a cell. |
|
|
185
|
+
| `bar` | `{ event, row, bar }` | A bar. |
|
|
186
|
+
| `cell` | `{ row, date, events, isToday, isPast }` | All of a `custom` cell, or content above the events of the others. |
|
|
187
|
+
|
|
188
|
+
## Styling tokens
|
|
189
|
+
|
|
190
|
+
| Token | Default |
|
|
191
|
+
|---|---|
|
|
192
|
+
| `--coar-calendar-board-label-width` | `88px` |
|
|
193
|
+
| `--coar-calendar-board-label-padding` | `8px` |
|
|
194
|
+
| `--coar-calendar-board-column-min-width` | `0` |
|
|
195
|
+
| `--coar-calendar-board-cell-min-height` | `48px` |
|
|
196
|
+
| `--coar-calendar-board-cell-padding` | `3px` |
|
|
197
|
+
| `--coar-calendar-board-bar-row-min-height` | `8px` |
|
|
198
|
+
| `--coar-calendar-board-cell-gap` / `-cell-bg` / `-cell-today-bg` | `2px` / none / today's tint |
|
|
199
|
+
| `--coar-calendar-board-line` / `-row-line` | the calendar border |
|
|
200
|
+
| `--coar-calendar-board-header-bg` / `-today-bg` / `-padding` / `-line` | none / same / weekday padding / the line |
|
|
201
|
+
| `--coar-calendar-board-header-direction` / `-align` / `-justify` | `column` / `center` / `flex-start` |
|
|
202
|
+
| `--coar-calendar-board-label-font-size` / `-font-weight` / `-color` / `-letter-spacing` / `-transform` / `-align` | caption role, `stretch` |
|
|
203
|
+
| `--coar-calendar-board-bar-margin` / `-padding` / `-radius` / `-font-size` / `-font-weight` / `-gap` | `0` / event padding / pill radius / inherited / inherited / `2px` |
|
|
204
|
+
| `--coar-calendar-board-bars-padding` | `2px 0` |
|
|
205
|
+
| `--coar-calendar-board-row-gap` / `-column-gap` | `0` |
|
|
206
|
+
|
|
207
|
+
Events use the event tokens of the [month view](./month-view.md#styling-tokens).
|
|
@@ -17,7 +17,7 @@ The primary switcher follows iOS while keeping the fixed web time grids as usefu
|
|
|
17
17
|
| Primary view | Display choices |
|
|
18
18
|
|---|---|
|
|
19
19
|
| Year | Responsive twelve-month overview; selecting a day or month drills into Month. |
|
|
20
|
-
| Month | Compact, Stacked, Details, List. The first three use continuously scrolling 4–6-week month sections. |
|
|
20
|
+
| Month | Compact, Stacked, Details, List. The first three use continuously scrolling 4–6-week month sections, or [one month at a time](./month-view.md#paged-month) with `monthPresentation('paged')`. |
|
|
21
21
|
| Week | Fixed seven-day time grid. |
|
|
22
22
|
| Work week | The Week grid filtered by `workDays(...)`. |
|
|
23
23
|
| Day | One day or width-aware Multi-day (1–7 complete columns). |
|
|
@@ -1412,6 +1412,37 @@ builder
|
|
|
1412
1412
|
</script>
|
|
1413
1413
|
```
|
|
1414
1414
|
|
|
1415
|
+
## Who is busy, and where a day has room (Preview) {#occupancy}
|
|
1416
|
+
|
|
1417
|
+
Two pure functions from the core answer the questions behind views like "when does everyone have time". What a resource or a part of the day means stays with your app.
|
|
1418
|
+
|
|
1419
|
+
```ts
|
|
1420
|
+
import { computeOccupancy, findDayGaps } from '@cocoar/vue-calendar';
|
|
1421
|
+
|
|
1422
|
+
const parts = [
|
|
1423
|
+
{ key: 'morning', startMinutes: 0, endMinutes: 12 * 60 },
|
|
1424
|
+
{ key: 'afternoon', startMinutes: 12 * 60, endMinutes: 18 * 60 },
|
|
1425
|
+
{ key: 'evening', startMinutes: 18 * 60, endMinutes: 24 * 60 },
|
|
1426
|
+
];
|
|
1427
|
+
|
|
1428
|
+
const occupancy = computeOccupancy(events, {
|
|
1429
|
+
dates,
|
|
1430
|
+
periods: parts,
|
|
1431
|
+
resources: ['emma', 'jonas'],
|
|
1432
|
+
timezone: 'Europe/Vienna',
|
|
1433
|
+
resourcesOf: (event) => event.meta.personIds,
|
|
1434
|
+
});
|
|
1435
|
+
occupancy.busyResources(date, 'evening'); // ['emma']
|
|
1436
|
+
occupancy.isFree(date, 'evening', ['jonas']); // true
|
|
1437
|
+
|
|
1438
|
+
const gaps = findDayGaps(entriesOfTheDay, { date, timezone: 'Europe/Vienna', minMinutes: 60 });
|
|
1439
|
+
// [{ start, end, minutes: 120 }]
|
|
1440
|
+
```
|
|
1441
|
+
|
|
1442
|
+
- Periods are wall-clock minutes in the display zone, from `0` to `1440`, and half-open: an event ending at 18:00 leaves an evening from 18:00 free.
|
|
1443
|
+
- `computeOccupancy` counts events with a time. Pass `counts` to decide per event, also for all-day entries, which then cover their whole days.
|
|
1444
|
+
- `findDayGaps` takes any `{ start, end }`, so entries that are not calendar events can count. It merges overlaps, ignores all-day entries, and treats the time before the first and after the last entry as no gap.
|
|
1445
|
+
|
|
1415
1446
|
## Imperative API
|
|
1416
1447
|
|
|
1417
1448
|
The builder exposes an `api` object — same shape regardless of whether the calendar component has mounted yet. Stash it from `useCalendar()` and call methods directly:
|
|
@@ -456,6 +456,27 @@ builder
|
|
|
456
456
|
|
|
457
457
|
Web only for now: the iOS and Android calendars draw the vertical grid.
|
|
458
458
|
|
|
459
|
+
## One column per resource {#resources} (Preview)
|
|
460
|
+
|
|
461
|
+
With `resources` and `eventResources`, a single day shows one hour column per resource, for example per person or room.
|
|
462
|
+
|
|
463
|
+
```ts
|
|
464
|
+
builder
|
|
465
|
+
.view('day')
|
|
466
|
+
.resources([
|
|
467
|
+
{ id: 'emma', label: 'Emma' },
|
|
468
|
+
{ id: 'jonas', label: 'Jonas' },
|
|
469
|
+
])
|
|
470
|
+
.eventResources((event) => event.meta.personIds)
|
|
471
|
+
.dayOverlays((date) => mealsOn(date));
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
- A shared event is **one block** across neighbouring columns as long as it is alone in each of them. Otherwise it falls apart into a piece per column. Columns that are not neighbours get separate blocks of the same event, and dragging any of them moves the event.
|
|
475
|
+
- An event without a listed resource is never lost: it stands in an extra column that appears only when needed.
|
|
476
|
+
- `onEventDrop`, `canDrop`, `onTimeClick` and `onTimeRangeSelect` report `resourceId`, a drop also `sourceResourceId`. The library does not change the assignment; apply it in `onEventDrop`.
|
|
477
|
+
- `dayOverlays` lies across all columns, behind the events, and is drawn by the `#overlay` slot. `#resourceHeader` draws the head of a column and `#hourLabel` a label of the hour axis.
|
|
478
|
+
- It applies to one day on the vertical grid. Several days or the horizontal orientation show the regular grid, with a console warning. Events cannot be resized here yet.
|
|
479
|
+
|
|
459
480
|
## Touch paging
|
|
460
481
|
|
|
461
482
|
On touch devices a horizontal pan on the day columns moves the grid with the finger — header cells, all-day band and columns together, the hour axis stays put — and pages to the previous / next range on release past a quarter of the width or on a fast flick. Below that the grid settles back. A touch that never moves is a tap and reaches `onTimeClick` right after the click that follows the lift, so a swipe never starts with a stray slot click and an overlay the handler opens is not hit by that click. Vertical pans stay native scrolling. A mouse keeps its click-on-press semantics; a pen tap counts like a finger tap.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<!-- Generated from apps/docs/components/calendar/mini-month.md by apps/docs/scripts/sync-skill.mjs. Do not edit; edit the docs page. -->
|
|
2
|
+
|
|
3
|
+
# `<CoarMiniMonth>` — Mini Month (Preview)
|
|
4
|
+
|
|
5
|
+
**Devices:** desktop ready · tablet ready · phone ready
|
|
6
|
+
|
|
7
|
+
A small month for picking a day, for example in a sidebar next to the calendar. It needs no builder, leafs through months on its own and follows `v-model` when that moves to another month. It always shows six rows, so nothing below it jumps.
|
|
8
|
+
|
|
9
|
+
**Demo — `calendar/demos/MiniMonthBasic.vue`**
|
|
10
|
+
|
|
11
|
+
```vue
|
|
12
|
+
<template>
|
|
13
|
+
<CoarMiniMonth v-model="day" locale="en-GB" :first-day-of-week="1" />
|
|
14
|
+
<p>Selected: {{ day }}</p>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
import { ref } from 'vue';
|
|
19
|
+
import { CoarMiniMonth, Temporal } from '@cocoar/vue-calendar';
|
|
20
|
+
|
|
21
|
+
const day = ref(Temporal.PlainDate.from('2026-11-19'));
|
|
22
|
+
</script>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```vue
|
|
26
|
+
<CoarMiniMonth v-model="day" />
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
To drive a calendar with it, pass the day to `api.goTo(day)`.
|
|
30
|
+
|
|
31
|
+
## Props, events and slots
|
|
32
|
+
|
|
33
|
+
| Prop | Type | Default | Description |
|
|
34
|
+
|---|---|---|---|
|
|
35
|
+
| `modelValue` | `Temporal.PlainDate \| null` | `null` | The selected day. |
|
|
36
|
+
| `locale` | `string` | the app's localization | Month and weekday names. |
|
|
37
|
+
| `firstDayOfWeek` | `0..6` | from the locale | `0` = Sunday. |
|
|
38
|
+
| `timezone` | `string` | the system's | Decides which day is today. |
|
|
39
|
+
| `highlightWeek` | `boolean` | `true` | Tints the week of the selected day. |
|
|
40
|
+
|
|
41
|
+
| Event | Payload | Description |
|
|
42
|
+
|---|---|---|
|
|
43
|
+
| `update:modelValue` | `Temporal.PlainDate` | A day was picked. |
|
|
44
|
+
|
|
45
|
+
| Slot | Scope | Purpose |
|
|
46
|
+
|---|---|---|
|
|
47
|
+
| `day` | `{ date, isToday, isSelected, isOtherMonth }` | The content of a day, for example with a mark. |
|
|
48
|
+
| `title` | `{ month, label }` | The heading. `month` is a `Temporal.PlainYearMonth`, `label` the month and year in the locale. |
|
|
49
|
+
|
|
50
|
+
The arrow keys move between days and `Page Up` / `Page Down` between months.
|
|
51
|
+
|
|
52
|
+
| Token | Default | Sets |
|
|
53
|
+
|---|---|---|
|
|
54
|
+
| `--coar-calendar-mini-month-day-size` | `26px` | The size of a day. |
|
|
55
|
+
| `--coar-calendar-mini-month-max-width` | `280px` | The width of the month. |
|
|
56
|
+
| `--coar-calendar-mini-month-day-font-size` | inherited | The type size of the days. |
|
|
57
|
+
| `--coar-calendar-mini-month-weekday-font-size` | inherited | The type size of the weekdays. |
|
|
58
|
+
| `--coar-calendar-mini-month-weekday-font-weight` | inherited | The weight of the weekdays. |
|
|
59
|
+
| `--coar-calendar-mini-month-week-radius` | `0` | The corners of each day in the highlighted week. |
|
|
@@ -42,6 +42,16 @@ Only the month in view and the next one render on mount. Every other section sta
|
|
|
42
42
|
<CoarMonthListView :builder="builder" />
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
+
## One month at a time {#paged-month} (Preview)
|
|
46
|
+
|
|
47
|
+
`monthPresentation('paged')` replaces the endless list with a single month that is turned by swiping. The finger pulls the page and it snaps in, while `api.next()` and `api.prev()` slide it. All rows stay equally high (`uniform`, or `fill` when `monthRowSizing('fill')` is set), so the grid never jumps between months. The neighbouring months are loaded with the visible window.
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
builder.view('month').monthPresentation('paged').monthRowSizing('fill');
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
A swipe that starts on an event belongs to its drag, and a vertical pan stays with the page. A tap on a day of a neighbouring month fires `onDateClick`; whether that also turns the page is up to the host. Standalone, the same surface is `<CoarPagedMonthView :builder="builder" />`, with the slots of `<CoarMonthView>`.
|
|
54
|
+
|
|
45
55
|
## Single month section {#single-month-section}
|
|
46
56
|
|
|
47
57
|
`<CoarMonthView>` renders the fixed single-section grid used internally by the continuous composition. Multi-day events render as continuous **bars** across the rows they touch; single-day events render as **pills** inside cells. A timed event counts as multi-day when it ends on a later day than it starts in the display zone (Thu 15:30 → Sun 18:00 is a Thu–Sun bar); its end is exclusive, so an end at the start of a day (00:00, or 01:00 where DST skips midnight) does not reach into that day. Its bar stops a third of a day short of the outer edges of its first and last day — the same fixed inset whatever the clock times are — so it never reads as an all-day event; an edge cut by a week row or by the edge of a continuous month's section keeps running to the border. Use it directly when the host owns pagination or needs a compact embedded month.
|
|
@@ -454,6 +464,10 @@ Full reference: see [the composer's API reference](./coar-calendar.md#api-refere
|
|
|
454
464
|
|---|---|---|---|
|
|
455
465
|
| `firstDayOfWeek(d)` | `0..6 \| undefined` | locale-aware | `0` = Sunday, `1` = Monday, … |
|
|
456
466
|
| `monthDensity(d)` | `'compact' \| 'stacked' \| 'details'` | `'details'` | Presentation used by continuous Month. |
|
|
467
|
+
| `monthPresentation(p)` (Preview) | `'continuous' \| 'paged'` | `'continuous'` | The month of `<CoarCalendar>`: the endless list or [one month at a time](#paged-month). |
|
|
468
|
+
| `monthRowSizing(s)` (Preview) | `'auto' \| 'uniform' \| 'fill'` | `'auto'` | `auto` grows a row with its multi-day lanes. `uniform` keeps all rows equal, so the grid never jumps. `fill` shares the height of the view between the rows and needs a parent with a height; a continuous month treats it as `uniform`. In `uniform` and `fill`, what does not fit folds into `+N`. |
|
|
469
|
+
| `weekdayFormat(f)` (Preview) | `'narrow' \| 'short' \| null` | `null` | Weekday names of the month header, the year and the day agenda's week strip. `null` keeps each view's own format. |
|
|
470
|
+
| `dayClass(fn)` (Preview) | `(date) => class value` | — | Extra classes of a month cell, read per day on every render, for example to highlight free days. |
|
|
457
471
|
| `shadeWeekends(b)` | `MaybeRefOrGetter<boolean>` | `true` | Shades Saturday / Sunday cells and weekday headers. Set `false` for an unshaded appearance. |
|
|
458
472
|
| `selectedDate(d)` | `MaybeRefOrGetter<Temporal.PlainDate \| null>` | `null` | The host's selected day: a filled circle around the day number (iOS selection decoration, `--coar-calendar-selection-fill`). Independent of the cursor — pass the day a companion pane follows, e.g. from `onDateClick`. |
|
|
459
473
|
| `maxEventsPerCell(n)` | `MaybeRefOrGetter<number>` | `2` | Single-day pills a **Details** cell shows before the rest fold into the `+N` row. Stacked and Compact use fixed limits (2 marks / 6 capsule segments) like iOS. |
|
|
@@ -465,7 +479,7 @@ Full reference: see [the composer's API reference](./coar-calendar.md#api-refere
|
|
|
465
479
|
|
|
466
480
|
Month rows have a fixed height per density plus the height of the week's multi-day lane band, and that band is capped too: a row shows at most `monthMaxVisibleLanes` lanes (default **2**). A multi-day bar past the cap leaves the band entirely — it is never clipped mid-row — and counts into the `+N` of every day it covers. `null` restores the unbounded band of the iOS port, where a week grows with every lane.
|
|
467
481
|
|
|
468
|
-
A Details cell renders its first `maxEventsPerCell` single-day pills (default **2**) and folds the rest, together with the folded bars covering the day, into one `+N` row in the subtle text colour. The Details base row is the iOS 94 px or, if the host's styling needs more, the measured height of the day-number row plus `maxEventsPerCell` pills plus the `+N` row — the view measures its own rendered cells (`useMonthMetrics`), so a `:deep()` override that makes pills or the day-number row taller never clips the marker. Details multi-day bars take the measured pill height, so bars and pills in one row are always the same size. Stacked shows 2 marks and Compact 6 capsule segments and, like iOS, cap silently — their marks carry no titles, so the day has to be opened either way. Cells never scroll, and there is no per-cell menu or row expansion.
|
|
482
|
+
A Details cell renders its first `maxEventsPerCell` single-day pills (default **2**) and folds the rest, together with the folded bars covering the day, into one `+N` row in the subtle text colour. The Details base row is the iOS 94 px or, if the host's styling needs more, the measured height of the day-number row plus `maxEventsPerCell` pills plus the `+N` row — the view measures its own rendered cells (`useMonthMetrics`), so a `:deep()` override that makes pills or the day-number row taller never clips the marker. Details multi-day bars take the measured pill height, so bars and pills in one row are always the same size. In a row of fixed height (`uniform`, `fill`) a day gives up only the lanes of its own bars, and it takes the `+N` row's place for a pill when nothing is folded, so `maxEventsPerCell(3)` shows three lines wherever they fit. Stacked shows 2 marks and Compact 6 capsule segments and, like iOS, cap silently — their marks carry no titles, so the day has to be opened either way. Cells never scroll, and there is no per-cell menu or row expansion.
|
|
469
483
|
|
|
470
484
|
On the web the `+N` row is a button (accessible name "N more events", `aria-haspopup="dialog"`). It opens a **day sheet** over that one cell: a small dialog aligned to the cell's top-left edge that lists every event of the day — the multi-day events covering it first (visible lanes, then folded ones), then the single-day pills — and scrolls when the list is long. The sheet opens downward and flips upward when the space below inside the scroll container is short; it never expands the row or the grid. Every pill in the sheet is a live pill with the grid's own wiring — drag it onto any other day, move it with the keyboard, double-click it for `onEventDoubleClick`. The sheet closes on Escape, its close control, a pointerdown outside it, another `+N`, or when the month changes; focus returns to the `+N` button.
|
|
471
485
|
|
|
@@ -504,6 +518,36 @@ interface CalendarApi<TMeta> {
|
|
|
504
518
|
|
|
505
519
|
`scrollToTime` / `scrollToDate` are not month operations. `api.goTo(...)`, `next()`, and `prev()` align the continuous surface to the requested month; a standalone `<CoarContinuousMonthView>` additionally exposes `scrollToMonth(...)` on its component ref.
|
|
506
520
|
|
|
521
|
+
## Styling tokens (Preview)
|
|
522
|
+
|
|
523
|
+
Set these on the calendar or a parent. Without them everything keeps its look. A custom `#pill` or `#event` that draws its own card can clear the built-in surface with `--coar-calendar-event-surface-bg: transparent`, `--coar-calendar-event-border-left: 0` and `--coar-calendar-event-padding: 0`.
|
|
524
|
+
|
|
525
|
+
| Token | Default | Applies to |
|
|
526
|
+
|---|---|---|
|
|
527
|
+
| `--coar-calendar-day-number-font-size` | label size | Day number |
|
|
528
|
+
| `--coar-calendar-day-number-font-weight` | label weight | Day number |
|
|
529
|
+
| `--coar-calendar-month-selected-frame` | `none` | A `box-shadow` around the selected day, drawn above the multi-day bars |
|
|
530
|
+
| `--coar-calendar-day-number-row-height` | `24px`, continuous `31px` | Row of the day number |
|
|
531
|
+
| `--coar-calendar-day-number-row-padding` | `4px 6px`, continuous `2px 6px` | Row of the day number |
|
|
532
|
+
| `--coar-calendar-today-font-weight` | day number weight | Today's number |
|
|
533
|
+
| `--coar-calendar-today-marker-size` | `27px` | Today and selection circle of the continuous month |
|
|
534
|
+
| `--coar-calendar-weekday-color` | subtle text | Weekday header |
|
|
535
|
+
| `--coar-calendar-weekday-font-size` | caption size | Weekday header |
|
|
536
|
+
| `--coar-calendar-weekday-font-weight` | caption weight | Weekday header |
|
|
537
|
+
| `--coar-calendar-weekday-bg` / `-border` | calendar background / border | Weekday header |
|
|
538
|
+
| `--coar-calendar-weekday-letter-spacing` / `-transform` / `-align` | `0.04em` / `uppercase` / inherited | Weekday header |
|
|
539
|
+
| `--coar-calendar-day-number-row-direction` / `-align` / `-justify` / `-gap` / `-flex` | `row` / `center` / `flex-start` / `0` / `0 1 auto` | Row of the day number, to stack the number and `#dayContent` |
|
|
540
|
+
| `--coar-calendar-day-content-flex` | `1 1 auto` | The `#dayContent` box |
|
|
541
|
+
| `--coar-calendar-section-title-padding` | `20px 16px 10px` | Month title of the continuous month |
|
|
542
|
+
| `--coar-calendar-pill-font-size` | event size | Pills and bars |
|
|
543
|
+
| `--coar-calendar-pill-line-height` | `16px` | Pills |
|
|
544
|
+
| `--coar-calendar-pill-radius` | event radius | Pills and bars |
|
|
545
|
+
| `--coar-calendar-event-surface-bg` | the event's colour | Pills, bars, all-day bars, timed cards |
|
|
546
|
+
| `--coar-calendar-event-border-left` | `3px` in the event's colour | Pills, bars, all-day bars, timed cards |
|
|
547
|
+
| `--coar-calendar-event-padding` | `1px 6px` | Pills, bars, all-day bars |
|
|
548
|
+
|
|
549
|
+
Weekend columns of the continuous header keep their own `--coar-calendar-continuous-weekday-weekend-color`.
|
|
550
|
+
|
|
507
551
|
## Month component props + slots
|
|
508
552
|
|
|
509
553
|
| Prop | Type | Description |
|
|
@@ -514,3 +558,5 @@ interface CalendarApi<TMeta> {
|
|
|
514
558
|
|---|---|---|
|
|
515
559
|
| `pill` | `{ event, pill }` | Single-day pill renderer. `pill` is the `MonthCellPill` (event + visual order in the cell). |
|
|
516
560
|
| `multiDayBar` | `{ event, bar }` | Multi-day bar renderer. `bar` is the `MonthMultiDayBar` (lane / startCol / endCol / clipping flags). |
|
|
561
|
+
| `dayNumber` (Preview) | `{ date, isToday, isSelected, isOtherMonth }` | Replaces the day number. |
|
|
562
|
+
| `dayContent` (Preview) | `{ date, isToday, isSelected, isOtherMonth }` | Content beside the day number, also on the neighbouring months' days. Keep it within the height of the day-number row. |
|
|
@@ -192,6 +192,8 @@ import './coar-theme--myapp.css';
|
|
|
192
192
|
|
|
193
193
|
`--coar-role-derivation` (an empty value) is what makes the library derive palette steps, aliases and component roles from the values of the theme, on its class and on the scopes nested in it. The app needs the theme class and this file, loaded after the Cocoar stylesheet; it does not need `.coar-compact`. Dark mode and `.coar-mobile` stay separate choices of the app and combine with the theme.
|
|
194
194
|
|
|
195
|
+
The calendar derives its `--coar-calendar-*` tokens on its outermost element, so with an active theme a value on a wrapper does not arrive. Put the class of a calendar skin on the component, `<CoarMonthView class="my-skin" />`: a rule on that element wins. `--coar-role-derivation: initial` on a wrapper also lets the values through, but it turns off the derivation for every component inside it, vue-ui included.
|
|
196
|
+
|
|
195
197
|
The file is written into the cascade layer of the library's tokens, where `.coar-compact` is too. Your own unlayered styles therefore keep the last word, exactly as with the class: the theme sets body text to 14 px on its scope, and an app that declares `html { font-size: 16px }` itself keeps its 16 px (and the `rem` sizes that follow from it).
|
|
196
198
|
|
|
197
199
|
The file names a font, it does not ship one, and it starts with a comment saying what to load. Load the font your theme uses yourself: `import '@cocoar/vue-ui/fonts/compact'` for the Inter weights of the Compact preset, `import '@cocoar/vue-ui/fonts/onest'` for Onest, or your own `@font-face` rules for another family.
|
|
@@ -428,6 +428,8 @@ are only being added, and testing on real devices remains the job of the app.
|
|
|
428
428
|
| [Calendar](../components/calendar/index.md) | ready | partial | planned | Touch taps, paging and long-press selection work; legacy resize targets are 6 px. Compact targets stay smaller on short/crowded events. |
|
|
429
429
|
| [`<CoarCalendar>` — Composer](../components/calendar/coar-calendar.md) | ready | partial | planned | Taps, swipe paging and long-press selection work on touch; event resize handles are only 6 px tall. |
|
|
430
430
|
| [`<CoarYearView>` — Year View](../components/calendar/year-view.md) | ready | ready | planned | Tap to drill in works on touch; a phone presentation of the calendar is planned. |
|
|
431
|
+
| [`<CoarCalendarBoard>` — Board](../components/calendar/board.md) | ready | ready | partial | The grid works on touch; on a phone seven columns are narrow, so a week usually reads better as rows of days. |
|
|
432
|
+
| [`<CoarMiniMonth>` — Mini Month](../components/calendar/mini-month.md) | ready | ready | ready | |
|
|
431
433
|
| [Month Views](../components/calendar/month-view.md) | ready | partial | planned | Taps work on touch; multi-day bar resize handles are only 6 px and a touch on a pill always drags it. |
|
|
432
434
|
| [`<CoarDayView>` — Day View](../components/calendar/day-view.md) | ready | partial | planned | Taps, swipe paging and long-press selection work on touch; event resize handles are only 6 px tall. |
|
|
433
435
|
| [`<CoarWeekView>` — Week View](../components/calendar/week-view.md) | ready | partial | planned | Taps, swipe paging and long-press selection work on touch; event resize handles are only 6 px tall. |
|