@progressive-development/pd-calendar 0.9.2 → 1.0.1

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 (118) hide show
  1. package/LICENSE +21 -2
  2. package/README.md +32 -57
  3. package/dist/generated/locales/be.d.ts +3 -0
  4. package/dist/generated/locales/be.d.ts.map +1 -1
  5. package/dist/generated/locales/de.d.ts +3 -0
  6. package/dist/generated/locales/de.d.ts.map +1 -1
  7. package/dist/generated/locales/en.d.ts +3 -0
  8. package/dist/generated/locales/en.d.ts.map +1 -1
  9. package/dist/index.d.ts +10 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +16 -0
  12. package/dist/locales/be.js +4 -1
  13. package/dist/locales/de.js +3 -0
  14. package/dist/locales/en.js +4 -1
  15. package/dist/pd-calendar/PdCalendar.d.ts +101 -18
  16. package/dist/pd-calendar/PdCalendar.d.ts.map +1 -1
  17. package/dist/pd-calendar/PdCalendar.js +380 -264
  18. package/dist/pd-calendar/pd-calendar-cell/PdCalendarCell.d.ts +40 -33
  19. package/dist/pd-calendar/pd-calendar-cell/PdCalendarCell.d.ts.map +1 -1
  20. package/dist/pd-calendar/pd-calendar-cell/PdCalendarCell.js +173 -113
  21. package/dist/pd-calendar/pd-calendar-day-events-panel/PdCalendarDayEventsPanel.d.ts +27 -0
  22. package/dist/pd-calendar/pd-calendar-day-events-panel/PdCalendarDayEventsPanel.d.ts.map +1 -0
  23. package/dist/pd-calendar/pd-calendar-day-events-panel/PdCalendarDayEventsPanel.js +160 -0
  24. package/dist/pd-calendar/pd-calendar-day-events-panel/pd-calendar-day-events-panel.d.ts +3 -0
  25. package/dist/pd-calendar/pd-calendar-day-events-panel/pd-calendar-day-events-panel.d.ts.map +1 -0
  26. package/dist/pd-calendar/pd-calendar-day-events-panel/pd-calendar-day-events-panel.js +8 -0
  27. package/dist/pd-calendar/pd-calendar-event-cell/PdCalendarEventCell.d.ts +55 -0
  28. package/dist/pd-calendar/pd-calendar-event-cell/PdCalendarEventCell.d.ts.map +1 -0
  29. package/dist/pd-calendar/pd-calendar-event-cell/PdCalendarEventCell.js +341 -0
  30. package/dist/pd-calendar/pd-calendar-event-cell/pd-calendar-event-cell.d.ts +3 -0
  31. package/dist/pd-calendar/pd-calendar-event-cell/pd-calendar-event-cell.d.ts.map +1 -0
  32. package/dist/pd-calendar/pd-calendar-event-cell/pd-calendar-event-cell.js +8 -0
  33. package/dist/pd-calendar/pd-calendar-event-info-panel/PdCalendarEventInfoPanel.d.ts +29 -0
  34. package/dist/pd-calendar/pd-calendar-event-info-panel/PdCalendarEventInfoPanel.d.ts.map +1 -0
  35. package/dist/pd-calendar/pd-calendar-event-info-panel/PdCalendarEventInfoPanel.js +211 -0
  36. package/dist/pd-calendar/pd-calendar-event-info-panel/pd-calendar-event-info-panel.d.ts +3 -0
  37. package/dist/pd-calendar/pd-calendar-event-info-panel/pd-calendar-event-info-panel.d.ts.map +1 -0
  38. package/dist/pd-calendar/pd-calendar-event-info-panel/pd-calendar-event-info-panel.js +8 -0
  39. package/dist/pd-calendar/pd-calendar-list-cell/PdCalendarListCell.d.ts +28 -0
  40. package/dist/pd-calendar/pd-calendar-list-cell/PdCalendarListCell.d.ts.map +1 -0
  41. package/dist/pd-calendar/pd-calendar-list-cell/PdCalendarListCell.js +252 -0
  42. package/dist/pd-calendar/pd-calendar-list-cell/pd-calendar-list-cell.d.ts +3 -0
  43. package/dist/pd-calendar/pd-calendar-list-cell/pd-calendar-list-cell.d.ts.map +1 -0
  44. package/dist/pd-calendar/pd-calendar-list-cell/pd-calendar-list-cell.js +8 -0
  45. package/dist/pd-calendar/pd-calendar-list-view/PdCalendarListView.d.ts +26 -0
  46. package/dist/pd-calendar/pd-calendar-list-view/PdCalendarListView.d.ts.map +1 -0
  47. package/dist/pd-calendar/pd-calendar-list-view/PdCalendarListView.js +165 -0
  48. package/dist/pd-calendar/pd-calendar-list-view/pd-calendar-list-view.d.ts +3 -0
  49. package/dist/pd-calendar/pd-calendar-list-view/pd-calendar-list-view.d.ts.map +1 -0
  50. package/dist/pd-calendar/pd-calendar-list-view/pd-calendar-list-view.js +8 -0
  51. package/dist/pd-calendar/pd-calendar-month-view/PdCalendarMonthView.d.ts +55 -0
  52. package/dist/pd-calendar/pd-calendar-month-view/PdCalendarMonthView.d.ts.map +1 -0
  53. package/dist/pd-calendar/pd-calendar-month-view/PdCalendarMonthView.js +461 -0
  54. package/dist/pd-calendar/pd-calendar-month-view/pd-calendar-month-view.d.ts +3 -0
  55. package/dist/pd-calendar/pd-calendar-month-view/pd-calendar-month-view.d.ts.map +1 -0
  56. package/dist/pd-calendar/pd-calendar-month-view/pd-calendar-month-view.js +8 -0
  57. package/dist/pd-calendar/pd-calendar-time-grid-view/PdCalendarTimeGridView.d.ts +32 -0
  58. package/dist/pd-calendar/pd-calendar-time-grid-view/PdCalendarTimeGridView.d.ts.map +1 -0
  59. package/dist/pd-calendar/pd-calendar-time-grid-view/PdCalendarTimeGridView.js +468 -0
  60. package/dist/pd-calendar/pd-calendar-time-grid-view/pd-calendar-time-grid-view.d.ts +3 -0
  61. package/dist/pd-calendar/pd-calendar-time-grid-view/pd-calendar-time-grid-view.d.ts.map +1 -0
  62. package/dist/pd-calendar/pd-calendar-time-grid-view/pd-calendar-time-grid-view.js +8 -0
  63. package/dist/pd-calendar/pd-calendar-week-cell/PdCalendarWeekCell.d.ts +31 -0
  64. package/dist/pd-calendar/pd-calendar-week-cell/PdCalendarWeekCell.d.ts.map +1 -0
  65. package/dist/pd-calendar/pd-calendar-week-cell/PdCalendarWeekCell.js +134 -0
  66. package/dist/pd-calendar/pd-calendar-week-cell/pd-calendar-week-cell.d.ts +3 -0
  67. package/dist/pd-calendar/pd-calendar-week-cell/pd-calendar-week-cell.d.ts.map +1 -0
  68. package/dist/pd-calendar/pd-calendar-week-cell/pd-calendar-week-cell.js +8 -0
  69. package/dist/pd-calendar/pd-calendar.stories.d.ts +79 -19
  70. package/dist/pd-calendar/pd-calendar.stories.d.ts.map +1 -1
  71. package/dist/pd-calendar/pd-year-popup/PdYearPopup.d.ts +22 -11
  72. package/dist/pd-calendar/pd-year-popup/PdYearPopup.d.ts.map +1 -1
  73. package/dist/pd-calendar/pd-year-popup/PdYearPopup.js +152 -34
  74. package/dist/pd-datepicker/PdDatepicker.d.ts +76 -7
  75. package/dist/pd-datepicker/PdDatepicker.d.ts.map +1 -1
  76. package/dist/pd-datepicker/PdDatepicker.js +257 -50
  77. package/dist/pd-datepicker/pd-date-picker.stories.d.ts +78 -20
  78. package/dist/pd-datepicker/pd-date-picker.stories.d.ts.map +1 -1
  79. package/dist/pd-slot-picker/PdSlotPicker.d.ts +102 -0
  80. package/dist/pd-slot-picker/PdSlotPicker.d.ts.map +1 -0
  81. package/dist/pd-slot-picker/PdSlotPicker.js +339 -0
  82. package/dist/pd-slot-picker/pd-slot-cell/PdSlotCell.d.ts +35 -0
  83. package/dist/pd-slot-picker/pd-slot-cell/PdSlotCell.d.ts.map +1 -0
  84. package/dist/pd-slot-picker/pd-slot-cell/PdSlotCell.js +188 -0
  85. package/dist/pd-slot-picker/pd-slot-cell/pd-slot-cell.d.ts +3 -0
  86. package/dist/pd-slot-picker/pd-slot-cell/pd-slot-cell.d.ts.map +1 -0
  87. package/dist/pd-slot-picker/pd-slot-cell/pd-slot-cell.js +8 -0
  88. package/dist/pd-slot-picker/pd-slot-picker.d.ts +3 -0
  89. package/dist/pd-slot-picker/pd-slot-picker.d.ts.map +1 -0
  90. package/dist/pd-slot-picker/pd-slot-picker.stories.d.ts +67 -0
  91. package/dist/pd-slot-picker/pd-slot-picker.stories.d.ts.map +1 -0
  92. package/dist/pd-slot-picker.d.ts +2 -0
  93. package/dist/pd-slot-picker.js +8 -0
  94. package/dist/shared/PdBaseCell.d.ts +68 -0
  95. package/dist/shared/PdBaseCell.d.ts.map +1 -0
  96. package/dist/shared/PdBaseCell.js +120 -0
  97. package/dist/shared/PdBaseView.d.ts +22 -0
  98. package/dist/shared/PdBaseView.d.ts.map +1 -0
  99. package/dist/shared/PdBaseView.js +46 -0
  100. package/dist/shared/PdCalendarPanelBase.d.ts +34 -0
  101. package/dist/shared/PdCalendarPanelBase.d.ts.map +1 -0
  102. package/dist/shared/PdCalendarPanelBase.js +169 -0
  103. package/dist/shared/calendar-button-bar/calendar-button-bar.d.ts +41 -0
  104. package/dist/shared/calendar-button-bar/calendar-button-bar.d.ts.map +1 -0
  105. package/dist/shared/calendar-button-bar/calendar-button-bar.js +435 -0
  106. package/dist/shared/calendar-locales.d.ts +9 -0
  107. package/dist/shared/calendar-locales.d.ts.map +1 -0
  108. package/dist/shared/calendar-locales.js +30 -0
  109. package/dist/shared/calendar-utils.d.ts +34 -0
  110. package/dist/shared/calendar-utils.d.ts.map +1 -0
  111. package/dist/shared/calendar-utils.js +99 -0
  112. package/dist/shared/calendar-utils.test.d.ts +2 -0
  113. package/dist/shared/calendar-utils.test.d.ts.map +1 -0
  114. package/dist/types.d.ts +102 -1
  115. package/dist/types.d.ts.map +1 -1
  116. package/package.json +10 -5
  117. package/dist/pd-calendar/pd-calendar-cell/pd-calendar-cell.stories.d.ts +0 -15
  118. package/dist/pd-calendar/pd-calendar-cell/pd-calendar-cell.stories.d.ts.map +0 -1
@@ -0,0 +1,468 @@
1
+ import { css, nothing, html } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import { localized } from '@lit/localize';
4
+ import { format } from 'fecha';
5
+ import { PdBaseView } from '../../shared/PdBaseView.js';
6
+ import { LOCALES } from '../../shared/calendar-locales.js';
7
+ import { isToday, layoutOverlappingEvents } from '../../shared/calendar-utils.js';
8
+ import '../pd-calendar-week-cell/pd-calendar-week-cell.js';
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __decorateClass = (decorators, target, key, kind) => {
13
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
14
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
15
+ if (decorator = decorators[i])
16
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
17
+ if (kind && result) __defProp(target, key, result);
18
+ return result;
19
+ };
20
+ let PdCalendarTimeGridView = class extends PdBaseView {
21
+ constructor() {
22
+ super(...arguments);
23
+ this.hideWeekend = false;
24
+ }
25
+ render() {
26
+ if (!this.currentWeekStart) return nothing;
27
+ const visibleDays = this._getVisibleDays();
28
+ const { startHour, endHour } = this._getTimeWindow();
29
+ const totalHours = endHour - startHour;
30
+ const hourHeight = 60;
31
+ const dayColumns = visibleDays.map((dayIdx) => {
32
+ const date = this._getDateForDayIndex(dayIdx);
33
+ const key = format(date, "YYYY-MM-DD");
34
+ const cellDataArray = this.data?.[key] ?? [];
35
+ const weekdayName = LOCALES.weekdaysShort[dayIdx];
36
+ const dayNumber = date.getDate();
37
+ const today = isToday(date);
38
+ const fullDayEvents = [];
39
+ const timedEvents = [];
40
+ cellDataArray.forEach((info, eventIndex) => {
41
+ if (info.fullDay) {
42
+ fullDayEvents.push({ info, eventIndex });
43
+ } else if (info.startTime) {
44
+ const start = this._parseTimeToDecimal(info.startTime);
45
+ const end = info.endTime ? this._parseTimeToDecimal(info.endTime) : Math.min(start + 1, 24);
46
+ if (end > startHour && start < endHour) {
47
+ timedEvents.push({
48
+ info,
49
+ eventIndex,
50
+ startDecimal: start,
51
+ endDecimal: end
52
+ });
53
+ }
54
+ }
55
+ });
56
+ return {
57
+ dayIdx,
58
+ date,
59
+ key,
60
+ weekdayName,
61
+ dayNumber,
62
+ today,
63
+ fullDayEvents,
64
+ timedEvents
65
+ };
66
+ });
67
+ const hasFullDayEvents = dayColumns.some((d) => d.fullDayEvents.length > 0);
68
+ const columnsStyle = `--_week-columns: ${visibleDays.length}`;
69
+ return html`
70
+ <div class="week-view" style="${columnsStyle}">
71
+ <!-- Header row with day names and numbers -->
72
+ <div class="week-header-row">
73
+ <div class="week-header-gutter"></div>
74
+ ${dayColumns.map(
75
+ (d) => html`
76
+ <div class="week-header-day ${d.today ? "is-today" : ""}">
77
+ <span class="week-header-day-name">${d.weekdayName}</span>
78
+ <span class="week-header-day-number">${d.dayNumber}</span>
79
+ </div>
80
+ `
81
+ )}
82
+ </div>
83
+
84
+ <!-- All-day strip (only if there are fullDay events) -->
85
+ ${hasFullDayEvents ? html`
86
+ <div class="week-allday-strip">
87
+ <div class="week-allday-gutter"></div>
88
+ ${dayColumns.map(
89
+ (d) => html`
90
+ <div class="week-allday-day">
91
+ ${d.fullDayEvents.map((ev) => {
92
+ const category = ev.info.category || "";
93
+ const categoryConfig = this._resolveCategoryConfig(category);
94
+ return html`
95
+ <pd-calendar-week-cell
96
+ fullDay
97
+ key="${d.key}"
98
+ .title="${ev.info.info || ""}"
99
+ .desc="${ev.info.desc || ""}"
100
+ .category="${category}"
101
+ .categoryColor="${categoryConfig?.color || ""}"
102
+ .categoryTextColor="${categoryConfig?.textColor || ""}"
103
+ ?disabled="${ev.info.disabled ?? false}"
104
+ .startTime="${ev.info.startTime || ""}"
105
+ .endTime="${ev.info.endTime || ""}"
106
+ .entry="${ev.info}"
107
+ .entryIndex="${ev.eventIndex}"
108
+ ></pd-calendar-week-cell>
109
+ `;
110
+ })}
111
+ </div>
112
+ `
113
+ )}
114
+ </div>
115
+ ` : nothing}
116
+
117
+ <!-- Scrollable time grid -->
118
+ <div class="week-scroll-container">
119
+ <div
120
+ class="week-time-grid"
121
+ style="height: ${totalHours * hourHeight}px"
122
+ >
123
+ <!-- Gutter with hour labels -->
124
+ <div class="week-gutter">
125
+ ${this._renderHourLabels(startHour, endHour, hourHeight)}
126
+ </div>
127
+
128
+ <!-- Day columns with events -->
129
+ ${dayColumns.map((d) => {
130
+ const layoutInput = d.timedEvents.map((ev, i) => ({
131
+ startDecimal: ev.startDecimal,
132
+ endDecimal: ev.endDecimal,
133
+ index: i
134
+ }));
135
+ const layoutResult = layoutOverlappingEvents(layoutInput);
136
+ return html`
137
+ <div class="week-day-column ${d.today ? "is-today" : ""}">
138
+ ${this._renderHourLines(startHour, endHour, hourHeight)}
139
+ ${layoutResult.map((layout) => {
140
+ const ev = d.timedEvents[layout.index];
141
+ const clampedStart = Math.max(ev.startDecimal, startHour);
142
+ const clampedEnd = Math.min(ev.endDecimal, endHour);
143
+ const topPercent = (clampedStart - startHour) / totalHours * 100;
144
+ const heightPercent = (clampedEnd - clampedStart) / totalHours * 100;
145
+ const leftPercent = layout.column / layout.totalColumns * 100;
146
+ const widthPercent = 100 / layout.totalColumns;
147
+ const category = ev.info.category || "";
148
+ const categoryConfig = this._resolveCategoryConfig(category);
149
+ return html`
150
+ <pd-calendar-week-cell
151
+ style="top: ${topPercent}%; height: ${heightPercent}%; left: ${leftPercent}%; width: ${widthPercent}%;"
152
+ key="${d.key}"
153
+ .title="${ev.info.info || ""}"
154
+ .desc="${ev.info.desc || ""}"
155
+ .category="${category}"
156
+ .categoryColor="${categoryConfig?.color || ""}"
157
+ .categoryTextColor="${categoryConfig?.textColor || ""}"
158
+ ?disabled="${ev.info.disabled ?? false}"
159
+ .startTime="${ev.info.startTime || ""}"
160
+ .endTime="${ev.info.endTime || ""}"
161
+ .entry="${ev.info}"
162
+ .entryIndex="${ev.eventIndex}"
163
+ ></pd-calendar-week-cell>
164
+ `;
165
+ })}
166
+ </div>
167
+ `;
168
+ })}
169
+ </div>
170
+ </div>
171
+ </div>
172
+ `;
173
+ }
174
+ // ===========================================================================
175
+ // Helpers
176
+ // ===========================================================================
177
+ /** Returns effective visible day indices from config, hideWeekend flag, or all 7 days. */
178
+ _getVisibleDays() {
179
+ if (this.weekViewConfig?.visibleDays) {
180
+ return this.weekViewConfig.visibleDays;
181
+ }
182
+ if (this.hideWeekend) {
183
+ return [0, 1, 2, 3, 4];
184
+ }
185
+ return [0, 1, 2, 3, 4, 5, 6];
186
+ }
187
+ /** Returns { startHour, endHour } from config or defaults. */
188
+ _getTimeWindow() {
189
+ return {
190
+ startHour: this.weekViewConfig?.startHour ?? 0,
191
+ endHour: this.weekViewConfig?.endHour ?? 24
192
+ };
193
+ }
194
+ /** Parses "HH:mm" -> decimal hours (e.g. "09:30" -> 9.5). */
195
+ _parseTimeToDecimal(time) {
196
+ const [h, m] = time.split(":").map(Number);
197
+ return h + (m || 0) / 60;
198
+ }
199
+ /** Calculates the actual Date for a given monday-based day index. */
200
+ _getDateForDayIndex(dayIndex) {
201
+ if (!this.currentWeekStart) return void 0;
202
+ const d = new Date(this.currentWeekStart);
203
+ d.setDate(d.getDate() + dayIndex);
204
+ return d;
205
+ }
206
+ // ===========================================================================
207
+ // Render Helpers
208
+ // ===========================================================================
209
+ /** Renders hour labels in the gutter. */
210
+ _renderHourLabels(startHour, endHour, hourHeight) {
211
+ const labels = [];
212
+ for (let h = startHour; h <= endHour; h++) {
213
+ const top = (h - startHour) * hourHeight;
214
+ if (h > startHour && h < endHour) {
215
+ labels.push(html`
216
+ <span class="week-hour-label" style="top: ${top}px"
217
+ >${h.toString().padStart(2, "0")}:00</span
218
+ >
219
+ `);
220
+ } else if (h === endHour && h < 24) {
221
+ labels.push(html`
222
+ <span class="week-hour-label" style="top: ${top}px"
223
+ >${h.toString().padStart(2, "0")}:00</span
224
+ >
225
+ `);
226
+ }
227
+ }
228
+ return labels;
229
+ }
230
+ /** Renders horizontal hour lines within a day column. */
231
+ _renderHourLines(startHour, endHour, hourHeight) {
232
+ const lines = [];
233
+ for (let h = startHour; h <= endHour; h++) {
234
+ const top = (h - startHour) * hourHeight;
235
+ if (h > startHour) {
236
+ lines.push(
237
+ html`<div class="week-hour-line" style="top: ${top}px"></div>`
238
+ );
239
+ }
240
+ if (h < endHour) {
241
+ const halfTop = top + hourHeight / 2;
242
+ lines.push(
243
+ html`<div
244
+ class="week-hour-line half-hour"
245
+ style="top: ${halfTop}px"
246
+ ></div>`
247
+ );
248
+ }
249
+ }
250
+ return lines;
251
+ }
252
+ };
253
+ PdCalendarTimeGridView.styles = [
254
+ PdBaseView.baseStyles,
255
+ css`
256
+ .week-view {
257
+ display: flex;
258
+ flex-direction: column;
259
+ border-radius: var(--pd-radius-md);
260
+ overflow: hidden;
261
+ }
262
+
263
+ .week-header-row {
264
+ display: grid;
265
+ grid-template-columns:
266
+ var(--pd-calendar-week-gutter-width, 50px)
267
+ repeat(var(--_week-columns, 5), 1fr);
268
+ background-color: var(
269
+ --pd-calendar-week-title-bg-col,
270
+ var(--pd-default-dark-col)
271
+ );
272
+ }
273
+
274
+ .week-header-gutter {
275
+ /* empty top-left corner */
276
+ }
277
+
278
+ .week-header-day {
279
+ display: flex;
280
+ flex-direction: column;
281
+ align-items: center;
282
+ justify-content: center;
283
+ padding: var(--pd-spacing-xs, 0.25rem) 0;
284
+ color: var(--pd-calendar-week-title-font-col, var(--pd-on-primary-col));
285
+ font-family: var(--pd-default-font-title-family);
286
+ font-size: 0.8em;
287
+ font-weight: 600;
288
+ text-transform: uppercase;
289
+ letter-spacing: 0.05em;
290
+ }
291
+
292
+ .week-header-day.is-today {
293
+ color: var(--pd-default-info-light-col, #93c5fd);
294
+ }
295
+
296
+ .week-header-day-number {
297
+ font-size: 1.3em;
298
+ line-height: 1;
299
+ }
300
+
301
+ .week-header-day-name {
302
+ font-size: 0.75em;
303
+ opacity: 0.85;
304
+ }
305
+
306
+ /* All-day strip */
307
+ .week-allday-strip {
308
+ display: grid;
309
+ grid-template-columns:
310
+ var(--pd-calendar-week-gutter-width, 50px)
311
+ repeat(var(--_week-columns, 5), 1fr);
312
+ background-color: var(
313
+ --pd-calendar-week-allday-bg-col,
314
+ var(--pd-default-lightest-col, #f8fafc)
315
+ );
316
+ border-bottom: 1px solid
317
+ var(
318
+ --pd-calendar-week-grid-line-col,
319
+ var(--pd-default-disabled-light-col, #e2e8f0)
320
+ );
321
+ min-height: 28px;
322
+ }
323
+
324
+ .week-allday-gutter {
325
+ display: flex;
326
+ align-items: center;
327
+ justify-content: center;
328
+ font-size: 0.65em;
329
+ color: var(--pd-default-font-light-col, #6b7280);
330
+ }
331
+
332
+ .week-allday-day {
333
+ position: relative;
334
+ display: flex;
335
+ flex-direction: column;
336
+ gap: 2px;
337
+ padding: 2px;
338
+ border-left: 1px solid
339
+ var(
340
+ --pd-calendar-week-grid-line-col,
341
+ var(--pd-default-disabled-light-col, #e2e8f0)
342
+ );
343
+ min-width: 0;
344
+ }
345
+
346
+ /* Scrollable time grid area */
347
+ .week-scroll-container {
348
+ max-height: var(--pd-calendar-week-max-height, 600px);
349
+ overflow-y: var(--pd-calendar-week-overflow-y, auto);
350
+ position: relative;
351
+ }
352
+
353
+ .week-time-grid {
354
+ display: grid;
355
+ grid-template-columns:
356
+ var(--pd-calendar-week-gutter-width, 50px)
357
+ repeat(var(--_week-columns, 5), 1fr);
358
+ position: relative;
359
+ }
360
+
361
+ .week-gutter {
362
+ position: relative;
363
+ }
364
+
365
+ .week-hour-label {
366
+ position: absolute;
367
+ right: 6px;
368
+ font-size: 0.7em;
369
+ color: var(--pd-default-font-light-col, #6b7280);
370
+ font-family: var(--pd-default-font-content-family);
371
+ transform: translateY(-50%);
372
+ line-height: 1;
373
+ }
374
+
375
+ .week-day-column {
376
+ position: relative;
377
+ border-left: 1px solid
378
+ var(
379
+ --pd-calendar-week-grid-line-col,
380
+ var(--pd-default-disabled-light-col, #e2e8f0)
381
+ );
382
+ }
383
+
384
+ .week-day-column.is-today {
385
+ background-color: var(
386
+ --pd-calendar-week-today-bg-col,
387
+ rgba(59, 130, 246, 0.04)
388
+ );
389
+ }
390
+
391
+ .week-hour-line {
392
+ position: absolute;
393
+ left: 0;
394
+ right: 0;
395
+ height: 1px;
396
+ background-color: var(
397
+ --pd-calendar-week-grid-line-col,
398
+ var(--pd-default-disabled-light-col, #e2e8f0)
399
+ );
400
+ pointer-events: none;
401
+ z-index: 0;
402
+ }
403
+
404
+ .week-hour-line.half-hour {
405
+ background-color: var(
406
+ --pd-calendar-week-grid-line-col,
407
+ var(--pd-default-disabled-lightest-col, #f1f5f9)
408
+ );
409
+ }
410
+
411
+ /* Container Queries for week view */
412
+ @container (max-width: 500px) {
413
+ .week-header-row,
414
+ .week-allday-strip,
415
+ .week-time-grid {
416
+ grid-template-columns: 35px repeat(var(--_week-columns, 5), 1fr);
417
+ }
418
+
419
+ .week-header-day {
420
+ font-size: 0.7em;
421
+ }
422
+
423
+ .week-header-day-number {
424
+ font-size: 1.1em;
425
+ }
426
+
427
+ .week-hour-label {
428
+ font-size: 0.6em;
429
+ right: 2px;
430
+ }
431
+ }
432
+
433
+ @container (max-width: 300px) {
434
+ .week-header-row,
435
+ .week-allday-strip,
436
+ .week-time-grid {
437
+ grid-template-columns: 28px repeat(var(--_week-columns, 5), 1fr);
438
+ }
439
+
440
+ .week-header-day {
441
+ font-size: 0.6em;
442
+ }
443
+
444
+ .week-header-day-number {
445
+ font-size: 1em;
446
+ }
447
+
448
+ .week-hour-label {
449
+ font-size: 0.55em;
450
+ right: 1px;
451
+ }
452
+ }
453
+ `
454
+ ];
455
+ __decorateClass([
456
+ property({ type: Object })
457
+ ], PdCalendarTimeGridView.prototype, "currentWeekStart", 2);
458
+ __decorateClass([
459
+ property({ type: Object })
460
+ ], PdCalendarTimeGridView.prototype, "weekViewConfig", 2);
461
+ __decorateClass([
462
+ property({ type: Boolean, reflect: true })
463
+ ], PdCalendarTimeGridView.prototype, "hideWeekend", 2);
464
+ PdCalendarTimeGridView = __decorateClass([
465
+ localized()
466
+ ], PdCalendarTimeGridView);
467
+
468
+ export { PdCalendarTimeGridView };
@@ -0,0 +1,3 @@
1
+ import { PdCalendarTimeGridView } from './PdCalendarTimeGridView.js';
2
+ export { PdCalendarTimeGridView };
3
+ //# sourceMappingURL=pd-calendar-time-grid-view.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pd-calendar-time-grid-view.d.ts","sourceRoot":"","sources":["../../../src/pd-calendar/pd-calendar-time-grid-view/pd-calendar-time-grid-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAOrE,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { PdCalendarTimeGridView } from './PdCalendarTimeGridView.js';
2
+
3
+ const tag = "pd-calendar-time-grid-view";
4
+ if (!customElements.get(tag)) {
5
+ customElements.define(tag, PdCalendarTimeGridView);
6
+ }
7
+
8
+ export { PdCalendarTimeGridView };
@@ -0,0 +1,31 @@
1
+ import { CSSResultGroup } from 'lit';
2
+ import { PdBaseCell } from '../../shared/PdBaseCell.js';
3
+ import { CalendarCellInfo } from '../../types.js';
4
+ /**
5
+ * A calendar event block for the week (timeGrid) view.
6
+ *
7
+ * Positioned absolutely within its day column by the parent (top/height/left/width via inline style).
8
+ * For full-day events, `:host([fullDay])` switches to relative positioning.
9
+ *
10
+ * @tagname pd-calendar-week-cell
11
+ * @summary Single event block in the week view with title, time, description, and category accent.
12
+ *
13
+ * @event select-event - Fired when the event block is clicked. Detail: `{ dateKey: string, entry: CalendarCellInfo, index: number, anchorRect: DOMRect }`.
14
+ *
15
+ * @cssprop --pd-week-cell-bg-col - Background color. Default: `var(--pd-default-lightest-col, #e0f2fe)`.
16
+ * @cssprop --pd-week-cell-text-col - Text color. Default: `var(--pd-default-font-col, #1e293b)`.
17
+ * @cssprop --pd-week-cell-border-left-col - Left border accent color. Default: `var(--pd-default-info-col, #3b82f6)`.
18
+ * @cssprop --pd-week-cell-category-bg-col - Category background color (set via inline style).
19
+ * @cssprop --pd-week-cell-category-text-col - Category text color (set via inline style).
20
+ */
21
+ export declare class PdCalendarWeekCell extends PdBaseCell {
22
+ /** The full entry object for this cell. */
23
+ entry?: CalendarCellInfo;
24
+ /** Index of this entry within the day's entries array. */
25
+ entryIndex: number;
26
+ static styles: CSSResultGroup;
27
+ render(): import('lit').TemplateResult<1>;
28
+ protected _handleSelect(): void;
29
+ private _handleClick;
30
+ }
31
+ //# sourceMappingURL=PdCalendarWeekCell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PdCalendarWeekCell.d.ts","sourceRoot":"","sources":["../../../src/pd-calendar/pd-calendar-week-cell/PdCalendarWeekCell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,cAAc,EAAW,MAAM,KAAK,CAAC;AAGzD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,kBAAmB,SAAQ,UAAU;IAChD,2CAA2C;IAE3C,KAAK,CAAC,EAAE,gBAAgB,CAAC;IAEzB,0DAA0D;IAE1D,UAAU,SAAK;IAEf,OAAgB,MAAM,EAAE,cAAc,CAwEpC;IAEO,MAAM;cAsBI,aAAa,IAAI,IAAI;IAgBxC,OAAO,CAAC,YAAY;CAGrB"}
@@ -0,0 +1,134 @@
1
+ import { css, nothing, html } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import { PdBaseCell } from '../../shared/PdBaseCell.js';
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __decorateClass = (decorators, target, key, kind) => {
7
+ var result = void 0 ;
8
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
9
+ if (decorator = decorators[i])
10
+ result = (decorator(target, key, result) ) || result;
11
+ if (result) __defProp(target, key, result);
12
+ return result;
13
+ };
14
+ class PdCalendarWeekCell extends PdBaseCell {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.entryIndex = 0;
18
+ }
19
+ static {
20
+ this.styles = [
21
+ css`
22
+ :host {
23
+ display: block;
24
+ position: absolute;
25
+ box-sizing: border-box;
26
+ overflow: hidden;
27
+ border-radius: var(--pd-radius-sm, 4px);
28
+ border-left: 3px solid
29
+ var(
30
+ --pd-week-cell-border-left-col,
31
+ var(
32
+ --pd-week-cell-category-bg-col,
33
+ var(--pd-default-info-col, #3b82f6)
34
+ )
35
+ );
36
+ background-color: var(
37
+ --pd-week-cell-category-bg-col,
38
+ var(--pd-week-cell-bg-col, var(--pd-default-lightest-col, #e0f2fe))
39
+ );
40
+ color: var(
41
+ --pd-week-cell-category-text-col,
42
+ var(--pd-week-cell-text-col, var(--pd-default-font-col, #1e293b))
43
+ );
44
+ cursor: pointer;
45
+ font-family: var(--pd-default-font-content-family);
46
+ z-index: 1;
47
+ transition: box-shadow 0.15s ease;
48
+ }
49
+
50
+ :host(:hover) {
51
+ box-shadow: var(--pd-shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
52
+ z-index: 2;
53
+ }
54
+
55
+ :host([fullDay]) {
56
+ position: relative;
57
+ border-left-width: 3px;
58
+ min-width: 0;
59
+ }
60
+
61
+ .week-cell {
62
+ padding: 2px 4px;
63
+ height: 100%;
64
+ display: flex;
65
+ flex-direction: column;
66
+ gap: 1px;
67
+ line-height: 1.2;
68
+ }
69
+
70
+ .week-cell-title {
71
+ font-size: 0.75rem;
72
+ font-weight: 600;
73
+ overflow: hidden;
74
+ text-overflow: ellipsis;
75
+ white-space: nowrap;
76
+ }
77
+
78
+ .week-cell-time {
79
+ font-size: 0.65rem;
80
+ opacity: 0.8;
81
+ white-space: nowrap;
82
+ }
83
+
84
+ .week-cell-desc {
85
+ font-size: 0.65rem;
86
+ opacity: 0.7;
87
+ overflow: hidden;
88
+ text-overflow: ellipsis;
89
+ white-space: nowrap;
90
+ }
91
+ `
92
+ ];
93
+ }
94
+ render() {
95
+ const timeInfo = this._formatTime(" - ");
96
+ const style = this._getCategoryStyle(
97
+ "--pd-week-cell-category-bg-col",
98
+ "--pd-week-cell-category-text-col"
99
+ );
100
+ return html`
101
+ <div class="week-cell" style="${style}" @click="${this._handleClick}">
102
+ ${this.title ? html`<span class="week-cell-title">${this.title}</span>` : nothing}
103
+ ${timeInfo ? html`<span class="week-cell-time">${timeInfo}</span>` : nothing}
104
+ ${this.desc ? html`<span class="week-cell-desc">${this.desc}</span>` : nothing}
105
+ </div>
106
+ `;
107
+ }
108
+ _handleSelect() {
109
+ if (this.disabled || !this.entry) return;
110
+ this.dispatchEvent(
111
+ new CustomEvent("select-event", {
112
+ detail: {
113
+ dateKey: this.key,
114
+ entry: this.entry,
115
+ index: this.entryIndex,
116
+ anchorRect: this.getBoundingClientRect()
117
+ },
118
+ bubbles: true,
119
+ composed: true
120
+ })
121
+ );
122
+ }
123
+ _handleClick() {
124
+ this._handleSelect();
125
+ }
126
+ }
127
+ __decorateClass([
128
+ property({ type: Object })
129
+ ], PdCalendarWeekCell.prototype, "entry");
130
+ __decorateClass([
131
+ property({ type: Number })
132
+ ], PdCalendarWeekCell.prototype, "entryIndex");
133
+
134
+ export { PdCalendarWeekCell };
@@ -0,0 +1,3 @@
1
+ import { PdCalendarWeekCell } from './PdCalendarWeekCell.js';
2
+ export { PdCalendarWeekCell };
3
+ //# sourceMappingURL=pd-calendar-week-cell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pd-calendar-week-cell.d.ts","sourceRoot":"","sources":["../../../src/pd-calendar/pd-calendar-week-cell/pd-calendar-week-cell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAO7D,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { PdCalendarWeekCell } from './PdCalendarWeekCell.js';
2
+
3
+ const tag = "pd-calendar-week-cell";
4
+ if (!customElements.get(tag)) {
5
+ customElements.define(tag, PdCalendarWeekCell);
6
+ }
7
+
8
+ export { PdCalendarWeekCell };