@progressive-development/pd-calendar 0.9.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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
@@ -1,47 +1,54 @@
1
- import { LitElement, CSSResultGroup } from 'lit';
1
+ import { CSSResultGroup } from 'lit';
2
+ import { PdBaseCell } from '../../shared/PdBaseCell.js';
2
3
  /**
3
- * Ein einzelnes Kalendertag-Element zur Anzeige in Monatsübersichten.
4
- *
5
- * Events:
6
- * - `select-date`: Wird bei Klick auf ein auswählbares Feld ausgelöst
7
- * - `mouse-enter-date`: Wird beim Hover über ein auswählbares Feld ausgelöst
8
- * - `mouse-leave-date`: Wird beim Verlassen des Feldes ausgelöst
4
+ * A single calendar day cell component for use within monthly calendar views.
9
5
  *
10
6
  * @tagname pd-calendar-cell
7
+ * @summary Single day cell with info text, selection, hover, and focus states.
8
+ *
9
+ * @event select-date - Fired when a selectable cell is clicked. Detail: `{ dateKey: string, date: Date }`.
10
+ * @event mouse-enter-date - Fired when hovering over a selectable cell. Detail: `{ dateKey: string, date: Date }`.
11
+ * @event mouse-leave-date - Fired when leaving a cell.
12
+ *
13
+ * @cssprop --pd-calendar-cell-day-bg-col - Background color for day cells. Default: `var(--pd-default-light-col)`.
14
+ * @cssprop --pd-calendar-cell-day-we-bg-col - Background color for weekend cells. Default: `var(--pd-default-bg-light-col)`.
15
+ * @cssprop --pd-calendar-cell-day-free-bg-col - Background color for selectable cells. Default: `var(--pd-default-col)`.
16
+ * @cssprop --pd-calendar-cell-day-category-bg-col - Background color for categorized cells. Set dynamically via categoryColor.
17
+ * @cssprop --pd-calendar-cell-day-category-text-col - Text color for categorized cells. Set dynamically via categoryTextColor.
18
+ * @cssprop --pd-calendar-cell-day-bg-col-hover - Background color on hover. Default: `var(--pd-default-hover-col)`.
19
+ * @cssprop --pd-calendar-cell-day-info-col - Text color for info text. Default: `var(--pd-on-primary-col)`.
20
+ * @cssprop --pd-calendar-cell-day-number-col - Text color for day numbers. Default: `var(--pd-default-dark-col)`.
21
+ * @cssprop --pd-calendar-cell-day-info-free-col - Text color for selectable cells. Default: `var(--pd-on-primary-col)`.
22
+ * @cssprop --pd-calendar-cell-selectable-shadow - Box shadow for selectable cells. Default: `var(--pd-shadow-sm)`.
23
+ * @cssprop --pd-calendar-cell-focus-outline-col - Focus outline color for keyboard navigation. Default: `var(--pd-default-info-col)`.
24
+ * @cssprop --pd-calendar-cell-today-border-col - Border color for today's date. Default: `var(--pd-default-error-col)`.
25
+ * @cssprop --pd-calendar-cell-selected-bg-col - Background color for selected date. Default: `var(--pd-default-col)`.
26
+ * @cssprop --pd-calendar-info-font-size - Font size for info text. Default: `1.5em`.
27
+ * @cssprop --pd-calendar-number-font-size - Font size for day number. Default: `0.9em`.
28
+ * @cssprop --pd-calendar-cell-day-info-selection-col - Text color for day number when the cell is selected. Default: `var(--pd-on-primary-col)`.
11
29
  */
12
- export declare class PdCalendarCell extends LitElement {
13
- /**
14
- * If enabled, cell could be selected (with visible hover element and pointer)
15
- * vy the user => results in fire cell-selected.
16
- */
30
+ export declare class PdCalendarCell extends PdBaseCell {
31
+ /** Whether the cell can be selected by the user. */
17
32
  selectEnabled: boolean;
18
- /**
19
- * If enabled, highlight the current day
20
- */
33
+ /** Highlight as today's date. */
21
34
  today: boolean;
35
+ /** Whether this cell has keyboard focus. */
36
+ focused: boolean;
37
+ /** CSS class for day number positioning ('top-left' or 'center'). */
38
+ numberClass: string;
39
+ static styles: CSSResultGroup;
40
+ render(): import('lit').TemplateResult<1>;
41
+ protected _handleSelect(): void;
22
42
  /**
23
- * If enabled, highlight the selected day
24
- */
25
- selected: boolean;
26
- /**
27
- * If enabled the cell gets an special class (e.g. green day).
28
- */
29
- special: boolean;
30
- /**
31
- * If set shows info text in the middle (hack) of the cell (e.g. price info).
43
+ * Determines if this is a weekend day.
32
44
  */
33
- infoTxt: string;
45
+ private _isWeekend;
34
46
  /**
35
- * CSS class for day number inside the cell, top-left and center available
47
+ * Builds CSS class string for the cell.
36
48
  */
37
- numberClass: string;
38
- key: string;
39
- weekDayNumber: number;
40
- dayNumber: number;
41
- static styles: CSSResultGroup;
42
- render(): import('lit').TemplateResult<1>;
49
+ private _getCellClasses;
43
50
  private _renderSelectableCell;
44
- private _renderEmptyCell;
51
+ private _renderNonSelectableCell;
45
52
  private _selectableCellClicked;
46
53
  private _mouseEnter;
47
54
  private _mouseLeave;
@@ -1 +1 @@
1
- {"version":3,"file":"PdCalendarCell.d.ts","sourceRoot":"","sources":["../../../src/pd-calendar/pd-calendar-cell/PdCalendarCell.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAI5D;;;;;;;;;GASG;AACH,qBAAa,cAAe,SAAQ,UAAU;IAC5C;;;OAGG;IAEH,aAAa,UAAS;IAEtB;;OAEG;IAEH,KAAK,UAAS;IAEd;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;OAEG;IAEH,OAAO,UAAS;IAEhB;;OAEG;IAEH,OAAO,SAAM;IAEb;;OAEG;IAEH,WAAW,SAAc;IAKzB,GAAG,SAAM;IAGT,aAAa,SAAM;IAGnB,SAAS,SAAM;IAEf,OAAgB,MAAM,EAAE,cAAc,CAkJpC;IAEO,MAAM;IAMf,OAAO,CAAC,qBAAqB;IA6B7B,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,sBAAsB;IAe9B,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,WAAW;CAQpB"}
1
+ {"version":3,"file":"PdCalendarCell.d.ts","sourceRoot":"","sources":["../../../src/pd-calendar/pd-calendar-cell/PdCalendarCell.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAa,cAAc,EAAW,MAAM,KAAK,CAAC;AAKzD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,cAAe,SAAQ,UAAU;IAC5C,oDAAoD;IAEpD,aAAa,UAAS;IAEtB,iCAAiC;IAEjC,KAAK,UAAS;IAEd,4CAA4C;IAE5C,OAAO,UAAS;IAEhB,qEAAqE;IAErE,WAAW,SAAc;IAEzB,OAAgB,MAAM,EAAE,cAAc,CA4MpC;IAEO,MAAM;cAOI,aAAa,IAAI,IAAI;IAaxC;;OAEG;IACH,OAAO,CAAC,UAAU;IAIlB;;OAEG;IACH,OAAO,CAAC,eAAe;IAmBvB,OAAO,CAAC,qBAAqB;IA8B7B,OAAO,CAAC,wBAAwB;IAWhC,OAAO,CAAC,sBAAsB;IAI9B,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,WAAW;CAQpB"}
@@ -1,6 +1,8 @@
1
- import { LitElement, css, html } from 'lit';
1
+ import { css, nothing, html } from 'lit';
2
2
  import { property } from 'lit/decorators.js';
3
+ import { classMap } from 'lit/directives/class-map.js';
3
4
  import { parse } from 'fecha';
5
+ import { PdBaseCell } from '../../shared/PdBaseCell.js';
4
6
 
5
7
  var __defProp = Object.defineProperty;
6
8
  var __decorateClass = (decorators, target, key, kind) => {
@@ -11,18 +13,13 @@ var __decorateClass = (decorators, target, key, kind) => {
11
13
  if (result) __defProp(target, key, result);
12
14
  return result;
13
15
  };
14
- class PdCalendarCell extends LitElement {
16
+ class PdCalendarCell extends PdBaseCell {
15
17
  constructor() {
16
18
  super(...arguments);
17
19
  this.selectEnabled = false;
18
20
  this.today = false;
19
- this.selected = false;
20
- this.special = false;
21
- this.infoTxt = "";
21
+ this.focused = false;
22
22
  this.numberClass = "top-left";
23
- this.key = "";
24
- this.weekDayNumber = -1;
25
- this.dayNumber = -1;
26
23
  }
27
24
  static {
28
25
  this.styles = [
@@ -35,197 +32,275 @@ class PdCalendarCell extends LitElement {
35
32
  width: 100%;
36
33
  height: 100%;
37
34
  min-height: 30px;
38
- }
39
-
40
- .cell-empty {
41
- background-color: var(
42
- --pd-calendar-cell-empty-bg-col,
43
- var(--pd-default-bg)
44
- );
35
+ border-radius: var(--pd-radius-sm, 2px);
36
+ transition:
37
+ background-color 0.15s ease,
38
+ box-shadow 0.15s ease,
39
+ transform 0.1s ease;
45
40
  }
46
41
 
47
42
  .cell-day {
48
43
  position: relative;
49
- /*background-image: linear-gradient(to right, rgb(51, 101, 138) , rgb(38, 76, 104)); */
50
- /*box-shadow: 2px 2px 3px;*/
51
44
  background-color: var(
52
45
  --pd-calendar-cell-day-bg-col,
53
- var(--pd-default-light-col)
46
+ var(--pd-default-bg-col)
54
47
  );
55
- /*border-radius: 2px 2px 2px 2px;*/
56
48
  }
57
49
 
58
50
  .cell-day.we {
59
51
  background-color: var(
60
52
  --pd-calendar-cell-day-we-bg-col,
61
- var(--pd-default-disabled-light-col)
53
+ var(--pd-default-light-col)
62
54
  );
63
55
  }
64
56
 
57
+ /* Selectable (free) cells */
65
58
  .free {
66
- /*background-image: linear-gradient(to right, green, darkgreen);
67
- background-color: var(--my-info-cell-bg1-color);*/
68
59
  background-color: var(
69
60
  --pd-calendar-cell-day-free-bg-col,
70
61
  var(--pd-default-col)
71
62
  );
72
- /*background-image: linear-gradient(to right, var(--my-info-cell-bg1-color), var(--my-info-cell-bg2-color));*/
73
- box-shadow: var(--pd-calendar-cell-selectable-shadow, 1px 2px 2px);
63
+ box-shadow: var(
64
+ --pd-calendar-cell-selectable-shadow,
65
+ var(--pd-shadow-md)
66
+ );
74
67
  }
75
68
 
76
- .special {
77
- /*background-image: linear-gradient(to right, green, darkgreen);
78
- background-color: var(--my-info-cell-bg1-color);*/
69
+ /* Categorized cells - color set via inline style */
70
+ .categorized {
79
71
  background-color: var(
80
- --pd-calendar-cell-day-special-bg-col,
72
+ --pd-calendar-cell-day-category-bg-col,
81
73
  var(--pd-default-success-col)
82
74
  );
83
- /*background-image: linear-gradient(to right, var(--my-info-cell-bg1-color), var(--my-info-cell-bg2-color));*/
84
- box-shadow: var(--pd-calendar-cell-selectable-shadow, 1px 2px 2px);
75
+ box-shadow: var(
76
+ --pd-calendar-cell-selectable-shadow,
77
+ var(--pd-shadow-md)
78
+ );
85
79
  }
86
80
 
87
- .special:hover,
81
+ /* Hover states for selectable cells */
82
+ .categorized:hover,
88
83
  .free:hover {
89
84
  background-color: var(
90
85
  --pd-calendar-cell-day-bg-col-hover,
91
86
  var(--pd-default-hover-col)
92
87
  );
93
- /*background-image: linear-gradient(to right, var(--my-info-cell-bg1-hover), var(--my-info-cell-bg2-hover));*/
94
88
  cursor: pointer;
89
+ box-shadow: var(--pd-shadow-md);
90
+ transform: translateY(-1px);
95
91
  }
96
92
 
93
+ .categorized:active,
94
+ .free:active {
95
+ transform: translateY(0);
96
+ box-shadow: var(--pd-shadow-md);
97
+ }
98
+
99
+ /* Focus styles for keyboard navigation */
100
+ :host([focused]) .cell-day {
101
+ outline: 2px solid
102
+ var(--pd-calendar-cell-focus-outline-col, var(--pd-default-info-col));
103
+ outline-offset: -2px;
104
+ z-index: 1;
105
+ }
106
+
107
+ /* Disabled state */
108
+ :host([disabled]) .cell-day {
109
+ opacity: 0.4;
110
+ cursor: not-allowed;
111
+ pointer-events: none;
112
+ }
113
+
114
+ /* Info text (e.g., price) */
97
115
  .cell-info {
98
116
  display: flex;
99
117
  align-items: center;
100
118
  justify-content: center;
101
119
  height: 100%;
102
- color: var(--pd-calendar-cell-day-info-col, var(--pd-default-bg-col));
120
+ /* Task? */
121
+ color: var(--pd-calendar-cell-day-info-col, var(--pd-on-primary-col));
103
122
  font-family: var(--pd-default-font-title-family);
104
- font-weight: bold;
123
+ font-weight: 600;
105
124
  font-size: var(--pd-calendar-info-font-size, 1.5em);
106
- text-shadow: 1px 1px var(--pd-default-dark-col);
125
+ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
107
126
  pointer-events: none;
108
127
  }
109
128
 
129
+ /* Day number */
110
130
  .cell-number {
111
131
  pointer-events: none;
112
- font-size: var(--pd-calendar-number-font-size, 1em);
113
- font-weight: bold;
114
- color: var(--pd-calendar-cell-day-info-col, var(--pd-default-bg-col));
132
+ font-size: var(--pd-calendar-number-font-size, 0.9em);
133
+ font-weight: 600;
134
+ color: var(
135
+ --pd-calendar-cell-day-number-col,
136
+ var(--pd-default-dark-col)
137
+ );
115
138
  font-family: var(--pd-default-font-content-family);
139
+ position: relative;
140
+ z-index: 1;
116
141
  }
117
142
 
118
143
  .cell-number.top-left {
119
144
  position: absolute;
120
- left: 3px;
121
- top: 2px;
145
+ left: var(--pd-spacing-xs);
146
+ top: var(--pd-spacing-xs);
122
147
  }
123
148
 
124
- /* Noch umstellen, passt nicht für alle größen (die anderen auf flex/center umgestellt) */
125
149
  .center {
126
150
  display: flex;
127
151
  align-items: center;
128
152
  justify-content: center;
153
+ height: 100%;
129
154
  }
130
155
 
156
+ /* Selectable cells have light text on colored background */
131
157
  .free .cell-number,
132
- .special .cell-number {
158
+ .categorized .cell-number {
133
159
  color: var(
134
- --pd-calendar-cell-day-info-free-col,
135
- var(--pd-default-bg-col)
160
+ --pd-calendar-cell-day-category-text-col,
161
+ var(--pd-calendar-cell-day-info-free-col, var(--pd-on-primary-col))
162
+ );
163
+ }
164
+
165
+ .free .cell-info,
166
+ .categorized .cell-info {
167
+ color: var(
168
+ --pd-calendar-cell-day-category-text-col,
169
+ var(--pd-calendar-cell-day-info-free-col, var(--pd-on-primary-col))
170
+ );
171
+ }
172
+
173
+ .selection .cell-number {
174
+ color: var(
175
+ --pd-calendar-cell-day-info-selection-col,
176
+ var(--pd-on-primary-col)
136
177
  );
137
178
  }
138
179
 
180
+ /* Today and selected indicators */
139
181
  .number-ring {
140
182
  position: absolute;
141
- height: 28px;
142
- width: 28px;
143
- border-radius: 50%;
144
- display: inline-block;
183
+ inset: 15% 10%;
184
+ border-radius: var(--pd-radius-sm, 3px);
145
185
  }
146
186
 
147
187
  .today {
148
- border: 2px solid blue;
149
- pointer-events: none;
188
+ border: 2px solid
189
+ var(--pd-calendar-cell-today-border-col, var(--pd-default-error-col));
150
190
  }
151
191
 
152
192
  .selected {
153
- border: 2px solid red;
193
+ border: 2px solid transparent;
194
+ background-color: var(
195
+ --pd-calendar-cell-selected-bg-col,
196
+ var(--pd-default-col)
197
+ );
154
198
  }
155
199
 
156
- /* ToDo: Dont work for calendars sized by custom properties. Needed to calculate from calendar size
157
- not from window size, this is a topic for container queries, which are not available right now... */
158
- @media (max-width: 800px) {
200
+ @container (max-width: 800px) {
159
201
  .cell-info {
160
- font-size: 1.3em;
202
+ font-size: 1.2em;
161
203
  }
162
204
  .cell-number {
163
205
  font-size: 0.8em;
164
206
  }
165
207
  }
166
208
 
167
- @media (max-width: 500px) {
209
+ @container (max-width: 500px) {
168
210
  .cell-info {
169
- font-weight: normal;
170
- font-size: 1em;
211
+ font-weight: 500;
212
+ font-size: 0.95em;
213
+ }
214
+ .cell-number {
215
+ font-size: 0.75em;
216
+ }
217
+ }
218
+
219
+ @container (max-width: 300px) {
220
+ .cell-number.top-left {
221
+ left: 2px;
222
+ top: 2px;
223
+ }
224
+ .cell-info {
225
+ font-size: 0.85em;
171
226
  }
172
227
  }
173
228
  `
174
229
  ];
175
230
  }
176
231
  render() {
177
- return this.selectEnabled ? this._renderSelectableCell() : this._renderEmptyCell();
232
+ return this.selectEnabled && !this.disabled ? this._renderSelectableCell() : this._renderNonSelectableCell();
233
+ }
234
+ _handleSelect() {
235
+ const userSelectedDate = parse(this.key, "YYYY-MM-DD");
236
+ if (this.key && userSelectedDate) {
237
+ this.dispatchEvent(
238
+ new CustomEvent("select-date", {
239
+ detail: { dateKey: this.key, date: userSelectedDate },
240
+ bubbles: true,
241
+ composed: true
242
+ })
243
+ );
244
+ }
245
+ }
246
+ /**
247
+ * Determines if this is a weekend day.
248
+ */
249
+ _isWeekend() {
250
+ return this.weekDayNumber === 0 || this.weekDayNumber === 6;
251
+ }
252
+ /**
253
+ * Builds CSS class string for the cell.
254
+ */
255
+ _getCellClasses(isSelectable) {
256
+ const classes = ["cell", "cell-day", this.numberClass];
257
+ const hasCategory = !!this.category;
258
+ if (isSelectable) {
259
+ classes.push(hasCategory ? "categorized" : "free");
260
+ }
261
+ if (this._isWeekend() && !hasCategory) {
262
+ classes.push("we");
263
+ }
264
+ if (this.selected) {
265
+ classes.push("selection");
266
+ }
267
+ return classes.join(" ");
178
268
  }
179
269
  _renderSelectableCell() {
180
- const baseClasses = [
181
- "cell",
182
- "cell-day",
183
- this.numberClass,
184
- this.special ? "special" : "free",
185
- (this.weekDayNumber === 6 || this.weekDayNumber === 0) && !this.special ? "we" : ""
186
- ].join(" ");
270
+ const style = this._getCategoryStyle(
271
+ "--pd-calendar-cell-day-category-bg-col",
272
+ "--pd-calendar-cell-day-category-text-col"
273
+ );
187
274
  return html`
188
275
  <div
189
- @click=${this._selectableCellClicked}
190
- @mouseenter=${this._mouseEnter}
191
- @mouseleave=${this._mouseLeave}
192
- class="${baseClasses}"
193
- data-date=${this.key}
276
+ @click="${this._selectableCellClicked}"
277
+ @mouseenter="${this._mouseEnter}"
278
+ @mouseleave="${this._mouseLeave}"
279
+ class="${this._getCellClasses(true)}"
280
+ style="${style}"
281
+ data-date="${this.key}"
194
282
  >
195
- ${this.infoTxt ? html`<div class="cell-info">${this.infoTxt}</div>` : ""}
196
- ${this.today ? html`<div class="number-ring today"></div>` : ""}
197
- ${this.selected ? html`<div class="number-ring selected"></div>` : ""}
283
+ ${this.title ? html`<div class="cell-info">${this.title}</div>` : nothing}
284
+ ${this.today || this.selected ? html`<div
285
+ class="number-ring ${classMap({
286
+ today: this.today,
287
+ selected: this.selected
288
+ })}"
289
+ ></div>` : nothing}
198
290
  <div class="cell-number ${this.numberClass}">${this.dayNumber}</div>
199
291
  </div>
200
292
  `;
201
293
  }
202
- _renderEmptyCell() {
203
- const baseClasses = [
204
- "cell",
205
- "cell-day",
206
- this.numberClass,
207
- (this.weekDayNumber === 6 || this.weekDayNumber === 0) && !this.special ? "we" : ""
208
- ].join(" ");
294
+ _renderNonSelectableCell() {
209
295
  return html`
210
- <div class="${baseClasses}">
211
- ${this.infoTxt ? html`<div class="cell-info">${this.infoTxt}</div>` : ""}
296
+ <div class="${this._getCellClasses(false)}">
297
+ ${this.title ? html`<div class="cell-info">${this.title}</div>` : nothing}
212
298
  <div class="cell-number ${this.numberClass}">${this.dayNumber}</div>
213
299
  </div>
214
300
  `;
215
301
  }
216
- _selectableCellClicked(e) {
217
- const target = e.currentTarget;
218
- const dateKey = target.dataset.date;
219
- if (dateKey) {
220
- const userSelectedDate = parse(dateKey, "YYYY-MM-DD");
221
- this.dispatchEvent(
222
- new CustomEvent("select-date", {
223
- detail: { dateKey, date: userSelectedDate },
224
- bubbles: true,
225
- composed: true
226
- })
227
- );
228
- }
302
+ _selectableCellClicked() {
303
+ this._handleSelect();
229
304
  }
230
305
  _mouseEnter() {
231
306
  const userSelectedDate = parse(this.key, "YYYY-MM-DD");
@@ -253,25 +328,10 @@ __decorateClass([
253
328
  property({ type: Boolean })
254
329
  ], PdCalendarCell.prototype, "today");
255
330
  __decorateClass([
256
- property({ type: Boolean })
257
- ], PdCalendarCell.prototype, "selected");
258
- __decorateClass([
259
- property({ type: Boolean })
260
- ], PdCalendarCell.prototype, "special");
261
- __decorateClass([
262
- property({ type: String })
263
- ], PdCalendarCell.prototype, "infoTxt");
331
+ property({ type: Boolean, reflect: true })
332
+ ], PdCalendarCell.prototype, "focused");
264
333
  __decorateClass([
265
334
  property({ type: String })
266
335
  ], PdCalendarCell.prototype, "numberClass");
267
- __decorateClass([
268
- property({ type: String })
269
- ], PdCalendarCell.prototype, "key");
270
- __decorateClass([
271
- property({ type: Number })
272
- ], PdCalendarCell.prototype, "weekDayNumber");
273
- __decorateClass([
274
- property({ type: Number })
275
- ], PdCalendarCell.prototype, "dayNumber");
276
336
 
277
337
  export { PdCalendarCell };
@@ -0,0 +1,27 @@
1
+ import { nothing, CSSResultGroup } from 'lit';
2
+ import { PdCalendarPanelBase } from '../../shared/PdCalendarPanelBase.js';
3
+ import { CalendarCellInfo, CalendarConfig } from '../../types.js';
4
+ /**
5
+ * Panel showing all events for a given day.
6
+ * Opens when clicking the overflow indicator ("+N weitere") in the month view.
7
+ *
8
+ * @tagname pd-calendar-day-events-panel
9
+ *
10
+ * @event select-event - Fired when an entry row is clicked.
11
+ * Detail: `{ dateKey: string, entry: CalendarCellInfo, index: number, anchorRect: DOMRect }`.
12
+ * @event close-panel - Fired when the panel should close.
13
+ */
14
+ export declare class PdCalendarDayEventsPanel extends PdCalendarPanelBase {
15
+ entries: CalendarCellInfo[];
16
+ dateKey: string;
17
+ config?: CalendarConfig;
18
+ static styles: CSSResultGroup;
19
+ render(): typeof nothing | import('lit').TemplateResult;
20
+ protected renderHeaderContent(): import('lit').TemplateResult<1>;
21
+ protected renderBody(): import('lit').TemplateResult<1>;
22
+ private _onEntryClick;
23
+ private _formatDateShort;
24
+ private _formatEntryTime;
25
+ private _resolveCategoryConfig;
26
+ }
27
+ //# sourceMappingURL=PdCalendarDayEventsPanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PdCalendarDayEventsPanel.d.ts","sourceRoot":"","sources":["../../../src/pd-calendar/pd-calendar-day-events-panel/PdCalendarDayEventsPanel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,OAAO,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAKzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EAEf,MAAM,gBAAgB,CAAC;AAGxB;;;;;;;;;GASG;AACH,qBAAa,wBAAyB,SAAQ,mBAAmB;IACpC,OAAO,EAAE,gBAAgB,EAAE,CAAM;IAChC,OAAO,SAAM;IACb,MAAM,CAAC,EAAE,cAAc,CAAC;IAEpD,OAAgB,MAAM,EAAE,cAAc,CAkDpC;IAEO,MAAM;cAKI,mBAAmB;cAQnB,UAAU;IA4B7B,OAAO,CAAC,aAAa;IAwBrB,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,sBAAsB;CAM/B"}