calendar-components 0.0.0 → 0.7.3

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.
@@ -0,0 +1,416 @@
1
+ @import "./base.css";
2
+
3
+ /*
4
+ * Google Calendar's week and day views, to its own numbers: read from the
5
+ * computed styles of calendar.google.com (November 2026). An hour is 48px;
6
+ * set `hourHeight={48}`.
7
+ *
8
+ * an event is its colour, solid, with white 12px/15px words, the name at
9
+ * 500; 6px corners; its words 8px in and 4px down; it stops 2px short
10
+ * of the next hour and 12px short of its column's far edge
11
+ * a column ends in a 1px #dde3ea line
12
+ * events that overlap in time: each starts a lane on from the last and is 1.7 lanes
13
+ * wide (the last, one lane), a later one over an earlier, with a 1px rim of the
14
+ * page round each. Give the grid `laneOverlap={0.7}`.
15
+ * a day's heading is its weekday (11px, 500, upper case, tracked 0.8px)
16
+ * over its date (26px in a 46px circle); today's are #0b57d0
17
+ * an hour's label is 11px, 500, #444746
18
+ * an all-day event is a 22px pill in a 24px row, 12px/20px, 500
19
+ * the time now is a 2px #db372d line across today, a 12px dot at its start
20
+ *
21
+ * These are Google's colours, which do not all meet WCAG contrast (white on
22
+ * its lighter event colours): this theme matches Google, not the guideline.
23
+ */
24
+ .calendar-google {
25
+ /* These are the app's own light colours: the system's (Canvas, form controls) stay light with them. */
26
+ color-scheme: light;
27
+ --calendar-font: 12px / 15px "Google Sans Text", "Google Sans", "Google Sans Flex", Roboto, Helvetica, Arial, sans-serif;
28
+ --calendar-line: #dde3ea;
29
+ --calendar-muted: #444746;
30
+ --calendar-today: #0b57d0;
31
+ --calendar-now: #db372d;
32
+ --calendar-color: #7cb342;
33
+ /* The last 13px of a day (12px, and its line) are the day's own, to press on: events share what is before them. */
34
+ --time-grid-lane-inset: 12px;
35
+ color: #1f1f1f;
36
+ }
37
+ .calendar-google [data-slot="time-grid-hour"] {
38
+ padding-inline-end: 8px;
39
+ font-size: 11px;
40
+ font-weight: 500;
41
+ line-height: 16px;
42
+ color: var(--calendar-muted);
43
+ }
44
+ /* Google Calendar does not write the first hour: its place is under the time zone, in the corner. */
45
+ .calendar-google [data-slot="time-grid-hour"]:first-child {
46
+ visibility: hidden;
47
+ }
48
+ .calendar-google [data-slot="time-grid-column"] {
49
+ border-inline-start: 0;
50
+ border-inline-end: 1px solid var(--calendar-line);
51
+ }
52
+
53
+ .calendar-google [data-slot="time-grid-event"] {
54
+ /* The space under an event is a clear border; the space after it is the day's own (see --time-grid-lane-inset). */
55
+ border-style: solid;
56
+ border-color: transparent;
57
+ border-block-width: 0 2px;
58
+ border-inline-width: 0;
59
+ /* 6px corners on what is seen: the lower radii are 2px more, for the clear border under them. */
60
+ border-start-start-radius: 6px;
61
+ border-start-end-radius: 6px;
62
+ border-end-end-radius: 6px 8px;
63
+ border-end-start-radius: 6px 8px;
64
+ padding-block: 4px 0;
65
+ padding-inline: 8px 0;
66
+ color: white;
67
+ background-color: var(--calendar-color);
68
+ }
69
+ /* Where events overlap, each has a hair of the page round it, so one reads apart from the one it is over. */
70
+ .calendar-google [data-slot="time-grid-event"]:not([data-lanes="1"]) {
71
+ box-shadow: inset 0 0 0 1px var(--calendar-surface);
72
+ }
73
+ .calendar-google [data-slot="time-grid-event"] > [data-slot="time-grid-event-content"] > :first-child {
74
+ font-weight: 500;
75
+ }
76
+ .calendar-google [data-slot="time-grid-event"] > [data-slot="time-grid-event-content"] > :not(:first-child) {
77
+ font-weight: 400;
78
+ }
79
+ .calendar-google [data-slot="time-grid-event"][data-selected] {
80
+ z-index: 1;
81
+ filter: drop-shadow(0 4px 4px rgb(0 0 0 / 0.3)) drop-shadow(0 8px 12px rgb(0 0 0 / 0.15));
82
+ }
83
+
84
+ .calendar-google [data-slot="time-grid-day-header"] {
85
+ padding: 2px 0 8px;
86
+ border-inline-start: 0;
87
+ font-size: 11px;
88
+ font-weight: 500;
89
+ line-height: 32px;
90
+ letter-spacing: 0.8px;
91
+ text-transform: uppercase;
92
+ color: var(--calendar-muted);
93
+ }
94
+ .calendar-google [data-slot="time-grid-day-header"] .calendar-day-number {
95
+ display: grid;
96
+ place-items: center;
97
+ width: 46px;
98
+ height: 46px;
99
+ margin: -4px auto 0;
100
+ border-radius: 9999px;
101
+ font-size: 26px;
102
+ font-weight: 400;
103
+ line-height: 46px;
104
+ letter-spacing: normal;
105
+ color: #1f1f1f;
106
+ }
107
+ .calendar-google [data-slot="time-grid-day-header"][data-today] {
108
+ color: var(--calendar-today);
109
+ }
110
+ .calendar-google [data-slot="time-grid-day-header"][data-today] .calendar-day-number {
111
+ font-size: 25px;
112
+ color: white;
113
+ background: var(--calendar-today);
114
+ }
115
+
116
+ .calendar-google [data-slot="time-grid-all-day"] {
117
+ min-height: 24px;
118
+ padding: 0;
119
+ padding-inline-end: 12px;
120
+ border-inline-start: 0;
121
+ border-inline-end: 1px solid var(--calendar-line);
122
+ }
123
+ .calendar-google [data-slot="time-grid-all-day-event"] {
124
+ height: 22px;
125
+ margin-bottom: 2px;
126
+ border-radius: 6px;
127
+ padding: 0 8px;
128
+ font-size: 12px;
129
+ font-weight: 500;
130
+ line-height: 22px;
131
+ color: white;
132
+ background-color: var(--calendar-color);
133
+ }
134
+ .calendar-google .calendar-all-day-label {
135
+ font-size: 11px;
136
+ font-weight: 500;
137
+ }
138
+
139
+ .calendar-google [data-slot="time-grid-now"] {
140
+ height: 2px;
141
+ background: var(--calendar-now);
142
+ }
143
+ .calendar-google [data-slot="time-grid-now"]::before {
144
+ content: "";
145
+ position: absolute;
146
+ inset-inline-start: -6.5px;
147
+ top: -5px;
148
+ width: 12px;
149
+ height: 12px;
150
+ border-radius: 50%;
151
+ background: var(--calendar-now);
152
+ }
153
+
154
+ /*
155
+ * A month: add `calendar-month`. Put the date in `.calendar-date` and the
156
+ * day's events in the cell's `details`: `.calendar-chip` for
157
+ * an all-day event and `.calendar-timed` (its name, then its time) for a
158
+ * timed one. Read from calendar.google.com's month view:
159
+ *
160
+ * weekdays 11px, 500, upper case, #444746, in a 20px row, their words 7px down
161
+ * a day ends in a 1px #dde3ea line, and a week in one under it; its
162
+ * date is 12px, 500, in a 24px circle 3px down; today's is white
163
+ * on #0b57d0
164
+ * events start 30px down, each in a 24px row and stopping 8px short of
165
+ * the day's far edge. All-day: a 22px pill, 6px corners, its
166
+ * 12px/20px name at 500, 8px in. Timed: an 8px dot of its
167
+ * colour 8px in, then 6px, its time at 400, then 4px, its name
168
+ * at 500
169
+ */
170
+ .calendar-google.calendar-month {
171
+ --calendar-week: 120px;
172
+ }
173
+ .calendar-google [data-slot="date-grid-grid"] {
174
+ width: 100%;
175
+ border-collapse: separate;
176
+ border-spacing: 0;
177
+ table-layout: fixed;
178
+ }
179
+ .calendar-google [data-slot="date-grid-header-cell"] {
180
+ height: 20px;
181
+ padding: 7px 0 0;
182
+ box-sizing: border-box;
183
+ vertical-align: top;
184
+ border-inline-end: 1px solid var(--calendar-line);
185
+ font-size: 11px;
186
+ line-height: 20px;
187
+ font-weight: 500;
188
+ text-transform: uppercase;
189
+ color: var(--calendar-muted);
190
+ overflow: visible;
191
+ }
192
+ .calendar-google [data-slot="date-grid-header-cell"] > * {
193
+ display: block;
194
+ }
195
+ .calendar-google [data-slot="date-grid-cell-wrapper"] {
196
+ height: var(--calendar-week);
197
+ padding: 0;
198
+ vertical-align: top;
199
+ text-align: start;
200
+ border-inline-end: 1px solid var(--calendar-line);
201
+ border-bottom: 1px solid var(--calendar-line);
202
+ }
203
+ .calendar-google [data-slot="date-grid-cell"] {
204
+ display: flex;
205
+ justify-content: center;
206
+ height: 30px;
207
+ padding-top: 3px;
208
+ box-sizing: border-box;
209
+ outline: none;
210
+ cursor: default;
211
+ }
212
+ .calendar-google .calendar-date {
213
+ display: grid;
214
+ place-items: center;
215
+ width: 24px;
216
+ height: 24px;
217
+ border-radius: 9999px;
218
+ font-size: 12px;
219
+ line-height: 24px;
220
+ font-weight: 500;
221
+ letter-spacing: 0.1px;
222
+ color: #1f1f1f;
223
+ }
224
+ .calendar-google [data-slot="date-grid-cell"][data-outside-month] .calendar-date {
225
+ color: var(--calendar-muted);
226
+ }
227
+ .calendar-google [data-slot="date-grid-cell"][data-today] .calendar-date {
228
+ color: white;
229
+ background: var(--calendar-today);
230
+ }
231
+ .calendar-google [data-slot="date-grid-cell"][data-focus-visible] .calendar-date {
232
+ outline: 2px solid var(--calendar-today);
233
+ outline-offset: 2px;
234
+ }
235
+ .calendar-google [data-slot="date-grid-cell-details"] {
236
+ display: flex;
237
+ flex-direction: column;
238
+ gap: 2px;
239
+ min-width: 0;
240
+ padding-inline-end: 8px;
241
+ }
242
+ .calendar-google .calendar-chip,
243
+ .calendar-google .calendar-timed {
244
+ display: flex;
245
+ align-items: center;
246
+ height: 22px;
247
+ box-sizing: border-box;
248
+ padding-inline: 8px;
249
+ border: 1px solid transparent;
250
+ border-radius: 6px;
251
+ font-size: 12px;
252
+ line-height: 20px;
253
+ font-weight: 500;
254
+ white-space: nowrap;
255
+ overflow: hidden;
256
+ }
257
+ .calendar-google .calendar-chip {
258
+ color: white;
259
+ background: var(--calendar-color);
260
+ }
261
+ .calendar-google .calendar-timed {
262
+ padding-inline-end: 0;
263
+ color: #1f1f1f;
264
+ }
265
+ .calendar-google .calendar-timed::before {
266
+ content: "";
267
+ flex: none;
268
+ order: 0;
269
+ width: 8px;
270
+ height: 8px;
271
+ margin-inline-end: 6px;
272
+ border-radius: 8px;
273
+ background: var(--calendar-color);
274
+ }
275
+ .calendar-google .calendar-timed > :last-child:not(:first-child) {
276
+ order: 1;
277
+ margin-inline-end: 4px;
278
+ font-weight: 400;
279
+ }
280
+ .calendar-google .calendar-timed > :first-child {
281
+ order: 2;
282
+ min-width: 0;
283
+ overflow: hidden;
284
+ text-overflow: ellipsis;
285
+ }
286
+
287
+ /*
288
+ * On a phone this is Google Calendar's app, not its site: measured from the app on an iPhone (402pt wide, its
289
+ * three-day view at 3x). An hour is 44pt there; set `hourHeight={44}` by the same query.
290
+ *
291
+ * gutter 57.5pt; an hour is 12pt in #5f6367, ending 16.5pt short of the days
292
+ * lines 1pt #e8eaed
293
+ * heading the weekday 10pt medium upper case in #5e6166, then the date 18pt in a 33pt disc, its centre
294
+ * 26pt under the weekday's capitals; today's are #3771e0. 6pt under the disc the days begin
295
+ * all-day 20pt tall and 2pt apart, 3pt corners, from the day's line to 3pt short of the next
296
+ * event the same from side to side, 4pt corners, its name 12pt semibold on 12pt lines, 5pt in;
297
+ * what is under it 11pt
298
+ * now a 1pt line in #1f1f1f with a 7pt dot on the day's leading edge
299
+ * a drag the event stays, faded, where it was; where it would start is written among the hours
300
+ */
301
+ @media (width < 640px) {
302
+ .calendar-google {
303
+ --calendar-gutter: 57.5px;
304
+ --calendar-line: #e8eaed;
305
+ --calendar-today: #3771e0;
306
+ --calendar-now: #1f1f1f;
307
+ --time-grid-lane-inset: 3px;
308
+ }
309
+ .calendar-google [data-slot="time-grid-hour"] {
310
+ padding-inline-end: 16.5px;
311
+ font-size: 12px;
312
+ font-weight: 400;
313
+ color: #5f6367;
314
+ }
315
+ .calendar-google [data-slot="time-grid-day-header"] {
316
+ padding: 1px 0 6px;
317
+ font-size: 10px;
318
+ line-height: 12px;
319
+ color: #5e6166;
320
+ }
321
+ .calendar-google [data-slot="time-grid-day-header"] .calendar-day-number,
322
+ .calendar-google [data-slot="time-grid-day-header"][data-today] .calendar-day-number {
323
+ width: 33px;
324
+ height: 33px;
325
+ margin-top: 0;
326
+ font-size: 18px;
327
+ line-height: 33px;
328
+ }
329
+ .calendar-google [data-slot="time-grid-all-day"] {
330
+ min-height: 22px;
331
+ padding-inline-end: 3px;
332
+ }
333
+ .calendar-google [data-slot="time-grid-all-day-event"] {
334
+ height: 20px;
335
+ border-radius: 3px;
336
+ padding: 0 5px;
337
+ line-height: 20px;
338
+ }
339
+ /* The app writes no time zone in the corner. The corner is still there, over the days that scroll under it. */
340
+ .calendar-google .calendar-all-day-label {
341
+ color: transparent;
342
+ }
343
+ .calendar-google [data-slot="time-grid-event"] {
344
+ border-block-end-width: 1px;
345
+ border-start-start-radius: 4px;
346
+ border-start-end-radius: 4px;
347
+ border-end-end-radius: 4px 5px;
348
+ border-end-start-radius: 4px 5px;
349
+ padding-block-start: 2.5px;
350
+ padding-inline-start: 5px;
351
+ }
352
+ .calendar-google [data-slot="time-grid-event"] > [data-slot="time-grid-event-content"] > :first-child {
353
+ font-size: 12px;
354
+ line-height: 12px;
355
+ font-weight: 600;
356
+ }
357
+ .calendar-google [data-slot="time-grid-event"] > [data-slot="time-grid-event-content"] > :not(:first-child) {
358
+ font-size: 11px;
359
+ line-height: 12px;
360
+ }
361
+ .calendar-google [data-slot="time-grid-now"] {
362
+ height: 1px;
363
+ }
364
+ /* While an event is dragged the app writes where it would start, among the hours, in its blue: "6:45", or "7 AM" on the hour. */
365
+ .calendar-google [data-slot="time-grid-drag-time"] {
366
+ display: block;
367
+ z-index: 1;
368
+ transform: translateY(-50%);
369
+ padding-inline-end: 16.5px;
370
+ text-align: end;
371
+ font-size: 11px;
372
+ font-weight: 500;
373
+ line-height: 16px;
374
+ color: var(--calendar-today);
375
+ background: var(--calendar-surface);
376
+ }
377
+ .calendar-google [data-slot="time-grid-drag-time"]:not([data-on-hour]) > :last-child {
378
+ display: none;
379
+ }
380
+ /* What the app says after a change, over the foot of the screen: add `calendar-snackbar` to an element of yours, with a button to undo. */
381
+ .calendar-google.calendar-snackbar {
382
+ position: fixed;
383
+ inset-inline: 8px;
384
+ bottom: 8px;
385
+ z-index: 10;
386
+ display: flex;
387
+ align-items: center;
388
+ justify-content: space-between;
389
+ min-height: 48px;
390
+ padding-inline: 16px 8px;
391
+ border-radius: 4px;
392
+ font-size: 14px;
393
+ line-height: 20px;
394
+ color: #f2f2f2;
395
+ background: #323232;
396
+ }
397
+ .calendar-google.calendar-snackbar > button {
398
+ min-width: 44px;
399
+ min-height: 44px;
400
+ border: 0;
401
+ padding-inline: 8px;
402
+ font: inherit;
403
+ font-weight: 500;
404
+ text-transform: uppercase;
405
+ letter-spacing: 0.25px;
406
+ color: #8ab4f8;
407
+ background: none;
408
+ }
409
+
410
+ .calendar-google [data-slot="time-grid-now"]::before {
411
+ inset-inline-start: -3.5px;
412
+ top: -3px;
413
+ width: 7px;
414
+ height: 7px;
415
+ }
416
+ }