@progressive-development/pd-calendar 0.6.8 → 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 (141) hide show
  1. package/LICENSE +21 -2
  2. package/README.md +32 -57
  3. package/dist/generated/locales/be.d.ts +7 -0
  4. package/dist/generated/locales/be.d.ts.map +1 -1
  5. package/dist/generated/locales/de.d.ts +7 -0
  6. package/dist/generated/locales/de.d.ts.map +1 -1
  7. package/dist/generated/locales/en.d.ts +7 -0
  8. package/dist/generated/locales/en.d.ts.map +1 -1
  9. package/dist/index.d.ts +12 -2
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +23 -10
  12. package/dist/locales/be.js +10 -4
  13. package/dist/locales/de.js +10 -4
  14. package/dist/locales/en.js +10 -4
  15. package/dist/pd-calendar/PdCalendar.d.ts +133 -0
  16. package/dist/pd-calendar/PdCalendar.d.ts.map +1 -0
  17. package/dist/pd-calendar/PdCalendar.js +550 -0
  18. package/dist/pd-calendar/pd-calendar-cell/PdCalendarCell.d.ts +56 -0
  19. package/dist/pd-calendar/pd-calendar-cell/PdCalendarCell.d.ts.map +1 -0
  20. package/dist/pd-calendar/pd-calendar-cell/PdCalendarCell.js +337 -0
  21. package/dist/pd-calendar/pd-calendar-cell/pd-calendar-cell.d.ts +3 -0
  22. package/dist/pd-calendar/pd-calendar-cell/pd-calendar-cell.d.ts.map +1 -0
  23. package/dist/pd-calendar/pd-calendar-cell/pd-calendar-cell.js +8 -0
  24. package/dist/pd-calendar/pd-calendar-day-events-panel/PdCalendarDayEventsPanel.d.ts +27 -0
  25. package/dist/pd-calendar/pd-calendar-day-events-panel/PdCalendarDayEventsPanel.d.ts.map +1 -0
  26. package/dist/pd-calendar/pd-calendar-day-events-panel/PdCalendarDayEventsPanel.js +160 -0
  27. package/dist/pd-calendar/pd-calendar-day-events-panel/pd-calendar-day-events-panel.d.ts +3 -0
  28. package/dist/pd-calendar/pd-calendar-day-events-panel/pd-calendar-day-events-panel.d.ts.map +1 -0
  29. package/dist/pd-calendar/pd-calendar-day-events-panel/pd-calendar-day-events-panel.js +8 -0
  30. package/dist/pd-calendar/pd-calendar-event-cell/PdCalendarEventCell.d.ts +55 -0
  31. package/dist/pd-calendar/pd-calendar-event-cell/PdCalendarEventCell.d.ts.map +1 -0
  32. package/dist/pd-calendar/pd-calendar-event-cell/PdCalendarEventCell.js +341 -0
  33. package/dist/pd-calendar/pd-calendar-event-cell/pd-calendar-event-cell.d.ts +3 -0
  34. package/dist/pd-calendar/pd-calendar-event-cell/pd-calendar-event-cell.d.ts.map +1 -0
  35. package/dist/pd-calendar/pd-calendar-event-cell/pd-calendar-event-cell.js +8 -0
  36. package/dist/pd-calendar/pd-calendar-event-info-panel/PdCalendarEventInfoPanel.d.ts +29 -0
  37. package/dist/pd-calendar/pd-calendar-event-info-panel/PdCalendarEventInfoPanel.d.ts.map +1 -0
  38. package/dist/pd-calendar/pd-calendar-event-info-panel/PdCalendarEventInfoPanel.js +211 -0
  39. package/dist/pd-calendar/pd-calendar-event-info-panel/pd-calendar-event-info-panel.d.ts +3 -0
  40. package/dist/pd-calendar/pd-calendar-event-info-panel/pd-calendar-event-info-panel.d.ts.map +1 -0
  41. package/dist/pd-calendar/pd-calendar-event-info-panel/pd-calendar-event-info-panel.js +8 -0
  42. package/dist/pd-calendar/pd-calendar-list-cell/PdCalendarListCell.d.ts +28 -0
  43. package/dist/pd-calendar/pd-calendar-list-cell/PdCalendarListCell.d.ts.map +1 -0
  44. package/dist/pd-calendar/pd-calendar-list-cell/PdCalendarListCell.js +252 -0
  45. package/dist/pd-calendar/pd-calendar-list-cell/pd-calendar-list-cell.d.ts +3 -0
  46. package/dist/pd-calendar/pd-calendar-list-cell/pd-calendar-list-cell.d.ts.map +1 -0
  47. package/dist/pd-calendar/pd-calendar-list-cell/pd-calendar-list-cell.js +8 -0
  48. package/dist/pd-calendar/pd-calendar-list-view/PdCalendarListView.d.ts +26 -0
  49. package/dist/pd-calendar/pd-calendar-list-view/PdCalendarListView.d.ts.map +1 -0
  50. package/dist/pd-calendar/pd-calendar-list-view/PdCalendarListView.js +165 -0
  51. package/dist/pd-calendar/pd-calendar-list-view/pd-calendar-list-view.d.ts +3 -0
  52. package/dist/pd-calendar/pd-calendar-list-view/pd-calendar-list-view.d.ts.map +1 -0
  53. package/dist/pd-calendar/pd-calendar-list-view/pd-calendar-list-view.js +8 -0
  54. package/dist/pd-calendar/pd-calendar-month-view/PdCalendarMonthView.d.ts +55 -0
  55. package/dist/pd-calendar/pd-calendar-month-view/PdCalendarMonthView.d.ts.map +1 -0
  56. package/dist/pd-calendar/pd-calendar-month-view/PdCalendarMonthView.js +461 -0
  57. package/dist/pd-calendar/pd-calendar-month-view/pd-calendar-month-view.d.ts +3 -0
  58. package/dist/pd-calendar/pd-calendar-month-view/pd-calendar-month-view.d.ts.map +1 -0
  59. package/dist/pd-calendar/pd-calendar-month-view/pd-calendar-month-view.js +8 -0
  60. package/dist/pd-calendar/pd-calendar-time-grid-view/PdCalendarTimeGridView.d.ts +32 -0
  61. package/dist/pd-calendar/pd-calendar-time-grid-view/PdCalendarTimeGridView.d.ts.map +1 -0
  62. package/dist/pd-calendar/pd-calendar-time-grid-view/PdCalendarTimeGridView.js +468 -0
  63. package/dist/pd-calendar/pd-calendar-time-grid-view/pd-calendar-time-grid-view.d.ts +3 -0
  64. package/dist/pd-calendar/pd-calendar-time-grid-view/pd-calendar-time-grid-view.d.ts.map +1 -0
  65. package/dist/pd-calendar/pd-calendar-time-grid-view/pd-calendar-time-grid-view.js +8 -0
  66. package/dist/pd-calendar/pd-calendar-week-cell/PdCalendarWeekCell.d.ts +31 -0
  67. package/dist/pd-calendar/pd-calendar-week-cell/PdCalendarWeekCell.d.ts.map +1 -0
  68. package/dist/pd-calendar/pd-calendar-week-cell/PdCalendarWeekCell.js +134 -0
  69. package/dist/pd-calendar/pd-calendar-week-cell/pd-calendar-week-cell.d.ts +3 -0
  70. package/dist/pd-calendar/pd-calendar-week-cell/pd-calendar-week-cell.d.ts.map +1 -0
  71. package/dist/pd-calendar/pd-calendar-week-cell/pd-calendar-week-cell.js +8 -0
  72. package/dist/pd-calendar/pd-calendar.d.ts +3 -0
  73. package/dist/pd-calendar/pd-calendar.d.ts.map +1 -0
  74. package/dist/pd-calendar/pd-calendar.stories.d.ts +83 -0
  75. package/dist/pd-calendar/pd-calendar.stories.d.ts.map +1 -0
  76. package/dist/pd-calendar/pd-year-popup/PdYearPopup.d.ts +38 -0
  77. package/dist/pd-calendar/pd-year-popup/PdYearPopup.d.ts.map +1 -0
  78. package/dist/pd-calendar/pd-year-popup/PdYearPopup.js +249 -0
  79. package/dist/pd-calendar/pd-year-popup/pd-year-popup.d.ts +3 -0
  80. package/dist/pd-calendar/pd-year-popup/pd-year-popup.d.ts.map +1 -0
  81. package/dist/pd-calendar/pd-year-popup/pd-year-popup.js +8 -0
  82. package/dist/pd-calendar.d.ts +2 -48
  83. package/dist/pd-calendar.js +6 -437
  84. package/dist/pd-datepicker/PdDatepicker.d.ts +181 -0
  85. package/dist/pd-datepicker/PdDatepicker.d.ts.map +1 -0
  86. package/dist/pd-datepicker/PdDatepicker.js +701 -0
  87. package/dist/pd-datepicker/pd-date-picker.stories.d.ts +81 -0
  88. package/dist/pd-datepicker/pd-date-picker.stories.d.ts.map +1 -0
  89. package/dist/pd-datepicker/pd-datepicker.d.ts +3 -0
  90. package/dist/pd-datepicker/pd-datepicker.d.ts.map +1 -0
  91. package/dist/pd-datepicker.d.ts +2 -0
  92. package/dist/pd-datepicker.js +8 -0
  93. package/dist/pd-slot-picker/PdSlotPicker.d.ts +102 -0
  94. package/dist/pd-slot-picker/PdSlotPicker.d.ts.map +1 -0
  95. package/dist/pd-slot-picker/PdSlotPicker.js +339 -0
  96. package/dist/pd-slot-picker/pd-slot-cell/PdSlotCell.d.ts +35 -0
  97. package/dist/pd-slot-picker/pd-slot-cell/PdSlotCell.d.ts.map +1 -0
  98. package/dist/pd-slot-picker/pd-slot-cell/PdSlotCell.js +188 -0
  99. package/dist/pd-slot-picker/pd-slot-cell/pd-slot-cell.d.ts +3 -0
  100. package/dist/pd-slot-picker/pd-slot-cell/pd-slot-cell.d.ts.map +1 -0
  101. package/dist/pd-slot-picker/pd-slot-cell/pd-slot-cell.js +8 -0
  102. package/dist/pd-slot-picker/pd-slot-picker.d.ts +3 -0
  103. package/dist/pd-slot-picker/pd-slot-picker.d.ts.map +1 -0
  104. package/dist/pd-slot-picker/pd-slot-picker.stories.d.ts +67 -0
  105. package/dist/pd-slot-picker/pd-slot-picker.stories.d.ts.map +1 -0
  106. package/dist/pd-slot-picker.d.ts +2 -0
  107. package/dist/pd-slot-picker.js +8 -0
  108. package/dist/shared/PdBaseCell.d.ts +68 -0
  109. package/dist/shared/PdBaseCell.d.ts.map +1 -0
  110. package/dist/shared/PdBaseCell.js +120 -0
  111. package/dist/shared/PdBaseView.d.ts +22 -0
  112. package/dist/shared/PdBaseView.d.ts.map +1 -0
  113. package/dist/shared/PdBaseView.js +46 -0
  114. package/dist/shared/PdCalendarPanelBase.d.ts +34 -0
  115. package/dist/shared/PdCalendarPanelBase.d.ts.map +1 -0
  116. package/dist/shared/PdCalendarPanelBase.js +169 -0
  117. package/dist/shared/calendar-button-bar/calendar-button-bar.d.ts +41 -0
  118. package/dist/shared/calendar-button-bar/calendar-button-bar.d.ts.map +1 -0
  119. package/dist/shared/calendar-button-bar/calendar-button-bar.js +435 -0
  120. package/dist/shared/calendar-locales.d.ts +9 -0
  121. package/dist/shared/calendar-locales.d.ts.map +1 -0
  122. package/dist/shared/calendar-locales.js +30 -0
  123. package/dist/shared/calendar-utils.d.ts +34 -0
  124. package/dist/shared/calendar-utils.d.ts.map +1 -0
  125. package/dist/shared/calendar-utils.js +99 -0
  126. package/dist/shared/calendar-utils.test.d.ts +2 -0
  127. package/dist/shared/calendar-utils.test.d.ts.map +1 -0
  128. package/dist/types.d.ts +102 -1
  129. package/dist/types.d.ts.map +1 -1
  130. package/package.json +35 -47
  131. package/dist/pd-calendar-cell.d.ts +0 -47
  132. package/dist/pd-calendar-cell.d.ts.map +0 -1
  133. package/dist/pd-calendar-cell.js +0 -282
  134. package/dist/pd-calendar.d.ts.map +0 -1
  135. package/dist/pd-year-popup.d.ts +0 -25
  136. package/dist/pd-year-popup.d.ts.map +0 -1
  137. package/dist/pd-year-popup.js +0 -136
  138. package/dist/stories/cell.stories.d.ts +0 -15
  139. package/dist/stories/cell.stories.d.ts.map +0 -1
  140. package/dist/stories/index.stories.d.ts +0 -23
  141. package/dist/stories/index.stories.d.ts.map +0 -1
@@ -0,0 +1,188 @@
1
+ import { css, nothing, html } from 'lit';
2
+ import { property, customElement } from 'lit/decorators.js';
3
+ import { PdBaseCell } from '../../shared/PdBaseCell.js';
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __decorateClass = (decorators, target, key, kind) => {
8
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
9
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
10
+ if (decorator = decorators[i])
11
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
12
+ if (kind && result) __defProp(target, key, result);
13
+ return result;
14
+ };
15
+ let PdSlotCell = class extends PdBaseCell {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.index = 0;
19
+ }
20
+ render() {
21
+ const timeInfo = this._formatTime();
22
+ const cellClasses = this.category ? "slot-cell categorized" : "slot-cell";
23
+ const style = this._getCategoryStyle(
24
+ "--pd-slot-cell-category-bg-col",
25
+ "--pd-slot-cell-category-text-col"
26
+ );
27
+ return html`
28
+ <div
29
+ class="${cellClasses}"
30
+ style="${style}"
31
+ data-date="${this.key}"
32
+ @click="${this._handleClick}"
33
+ @keydown="${this._handleKeyDown}"
34
+ >
35
+ ${timeInfo ? html`<span class="time">${timeInfo}</span>` : ""}
36
+ <div class="content-group">
37
+ ${this.title ? html`<span class="title">${this.title}</span>` : ""}
38
+ ${this.desc ? html`<span class="description">${this.desc}</span>` : ""}
39
+ </div>
40
+ ${this.capacity != null ? html`<span class="availability"
41
+ >${Math.max(0, this.capacity - (this.booked ?? 0))}/${this.capacity}</span
42
+ >` : nothing}
43
+ </div>
44
+ `;
45
+ }
46
+ _handleSelect() {
47
+ if (this.disabled) return;
48
+ this.dispatchEvent(
49
+ new CustomEvent("select-slot", {
50
+ detail: {
51
+ dateKey: this.key,
52
+ startTime: this.startTime,
53
+ endTime: this.endTime,
54
+ index: this.index
55
+ },
56
+ bubbles: true,
57
+ composed: true
58
+ })
59
+ );
60
+ }
61
+ _handleClick() {
62
+ this._handleSelect();
63
+ }
64
+ };
65
+ PdSlotCell.styles = [
66
+ css`
67
+ :host {
68
+ display: block;
69
+ }
70
+
71
+ .slot-cell {
72
+ display: flex;
73
+ align-items: center;
74
+ gap: var(--pd-spacing-sm, 0.5rem);
75
+ padding: var(--pd-spacing-sm, 0.5rem) var(--pd-spacing-md, 1rem);
76
+ background-color: var(
77
+ --pd-slot-cell-bg-col,
78
+ var(--pd-default-lightest-col, #f9fafb)
79
+ );
80
+ border-radius: var(--pd-radius-sm, 4px);
81
+ cursor: pointer;
82
+ transition: background-color 0.15s ease;
83
+ }
84
+
85
+ .slot-cell:hover {
86
+ background-color: var(
87
+ --pd-slot-cell-bg-col-hover,
88
+ var(--pd-default-light-col, #f3f4f6)
89
+ );
90
+ }
91
+
92
+ :host([selected]) .slot-cell {
93
+ background-color: var(
94
+ --pd-slot-cell-selected-bg-col,
95
+ var(--pd-default-success-light-col, #dcfce7)
96
+ );
97
+ border-left: 3px solid
98
+ var(
99
+ --pd-slot-cell-selected-border-col,
100
+ var(--pd-default-success-col, #22c55e)
101
+ );
102
+ }
103
+
104
+ :host([disabled]) .slot-cell {
105
+ opacity: 0.4;
106
+ cursor: not-allowed;
107
+ pointer-events: none;
108
+ }
109
+
110
+ /* Categorized cells - colors set via inline style from category config */
111
+ .slot-cell.categorized {
112
+ background-color: var(
113
+ --pd-slot-cell-category-bg-col,
114
+ var(--pd-default-success-light-col, #dcfce7)
115
+ );
116
+ }
117
+
118
+ .slot-cell.categorized .time,
119
+ .slot-cell.categorized .title,
120
+ .slot-cell.categorized .description {
121
+ color: var(--pd-slot-cell-category-text-col);
122
+ }
123
+
124
+ .time {
125
+ font-size: var(--pd-slot-cell-time-size, 0.95rem);
126
+ font-weight: 600;
127
+ color: var(
128
+ --pd-slot-cell-time-col,
129
+ var(--pd-default-font-col, #374151)
130
+ );
131
+ white-space: nowrap;
132
+ min-width: 5em;
133
+ }
134
+
135
+ .content-group {
136
+ display: flex;
137
+ flex-direction: column;
138
+ flex: 1;
139
+ min-width: 0;
140
+ gap: 2px;
141
+ }
142
+
143
+ .title {
144
+ font-size: var(--pd-slot-cell-title-size, 0.875rem);
145
+ font-weight: 500;
146
+ color: var(
147
+ --pd-slot-cell-title-col,
148
+ var(--pd-default-font-col, #111827)
149
+ );
150
+ overflow: hidden;
151
+ text-overflow: ellipsis;
152
+ white-space: nowrap;
153
+ }
154
+
155
+ .description {
156
+ font-size: var(--pd-slot-cell-desc-size, 0.8rem);
157
+ color: var(
158
+ --pd-slot-cell-desc-col,
159
+ var(--pd-default-font-light-col, #6b7280)
160
+ );
161
+ }
162
+
163
+ .availability {
164
+ font-size: var(--pd-slot-cell-availability-size, 0.75rem);
165
+ color: var(
166
+ --pd-slot-cell-availability-col,
167
+ var(--pd-default-font-light-col, #6b7280)
168
+ );
169
+ white-space: nowrap;
170
+ margin-left: auto;
171
+ }
172
+
173
+ /* Focus styles for keyboard navigation */
174
+ :host(:focus-visible) .slot-cell {
175
+ outline: 2px solid
176
+ var(--pd-focus-ring-col, var(--pd-default-info-col, #3b82f6));
177
+ outline-offset: 2px;
178
+ }
179
+ `
180
+ ];
181
+ __decorateClass([
182
+ property({ type: Number })
183
+ ], PdSlotCell.prototype, "index", 2);
184
+ PdSlotCell = __decorateClass([
185
+ customElement("pd-slot-cell")
186
+ ], PdSlotCell);
187
+
188
+ export { PdSlotCell };
@@ -0,0 +1,3 @@
1
+ import { PdSlotCell } from './PdSlotCell.js';
2
+ export { PdSlotCell };
3
+ //# sourceMappingURL=pd-slot-cell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pd-slot-cell.d.ts","sourceRoot":"","sources":["../../../src/pd-slot-picker/pd-slot-cell/pd-slot-cell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAO7C,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { PdSlotCell } from './PdSlotCell.js';
2
+
3
+ const tag = "pd-slot-cell";
4
+ if (!customElements.get(tag)) {
5
+ customElements.define(tag, PdSlotCell);
6
+ }
7
+
8
+ export { PdSlotCell };
@@ -0,0 +1,3 @@
1
+ import { PdSlotPicker } from './PdSlotPicker.js';
2
+ export { PdSlotPicker };
3
+ //# sourceMappingURL=pd-slot-picker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pd-slot-picker.d.ts","sourceRoot":"","sources":["../../src/pd-slot-picker/pd-slot-picker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAOjD,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,67 @@
1
+ import { Meta, StoryObj } from '@storybook/web-components-vite';
2
+ import { CalendarData, CalendarConfig } from '../types.js';
3
+ /**
4
+ * Story arguments interface for pd-slot-picker component.
5
+ * Maps to the component's public API.
6
+ */
7
+ interface PdSlotPickerArgs {
8
+ /** Calendar data with slots per date */
9
+ data: CalendarData;
10
+ /** Calendar configuration including category definitions */
11
+ config?: CalendarConfig;
12
+ /** Whether weekends should be hidden */
13
+ hideWeekend: boolean;
14
+ /** Number of months allowed to navigate backwards (-1 = unlimited) */
15
+ prevMonthConstraint: number;
16
+ /** Number of months allowed to navigate forwards (-1 = unlimited) */
17
+ nextMonthConstraint: number;
18
+ /** Year selection popup values */
19
+ withYearPopup: string[];
20
+ /** Enable mouse wheel navigation between months */
21
+ withWheelNavigation: boolean;
22
+ /** Enable touch swipe navigation between months */
23
+ withTouchNavigation: boolean;
24
+ }
25
+ /**
26
+ * ## pd-slot-picker
27
+ *
28
+ * Appointment slot picker component (Calendly-style) that combines a monthly
29
+ * calendar view with a time slot list for booking appointments.
30
+ *
31
+ * ### Features
32
+ * - **Calendar + Slots**: Side-by-side layout (responsive flex-wrap)
33
+ * - **Day Selection**: Click a highlighted day to see its available time slots
34
+ * - **Slot Selection**: Click a time slot to select it (fires `select-slot` event)
35
+ * - **Categories**: Color-coded slot types via CalendarConfig
36
+ * - **Disabled Slots**: Mark already-booked slots as disabled
37
+ * - **Capacity Tracking**: Show remaining spots per slot, auto-disable when full
38
+ * - **Responsive**: Wraps to vertical layout on smaller screens
39
+ * - **Navigation Constraints**: Limit forward/backward month navigation
40
+ * - **Weekend Hiding**: Option to hide Saturday and Sunday
41
+ *
42
+ * ### Accessibility
43
+ * - Slot list uses `role="list"` with `role="listitem"` on each slot cell
44
+ * - Slot cells are focusable via `tabindex="0"`
45
+ * - Calendar keyboard navigation inherited from pd-calendar
46
+ * - Disabled slots are visually distinct and non-interactive
47
+ */
48
+ declare const meta: Meta<PdSlotPickerArgs>;
49
+ export default meta;
50
+ type Story = StoryObj<PdSlotPickerArgs>;
51
+ /** Default slot picker with appointment data. Click a highlighted day to see available time slots. */
52
+ export declare const Default: Story;
53
+ /** Slot picker without category colors -- simple uniform slot styling. */
54
+ export declare const WithoutCategories: Story;
55
+ /** Responsive layout behavior: side-by-side on wide screens, stacked on narrow screens. */
56
+ export declare const ResponsiveLayout: Story;
57
+ /** Mix of available and disabled (already booked) slots. */
58
+ export declare const WithDisabledSlots: Story;
59
+ /** Slots with capacity tracking -- shows remaining spots and auto-disables when full. */
60
+ export declare const WithCapacity: Story;
61
+ /** Many 15-minute slots to demonstrate the scrollable slot list behavior. */
62
+ export declare const ManySlots: Story;
63
+ /** Slot picker with hidden weekends and year popup. */
64
+ export declare const HiddenWeekends: Story;
65
+ /** CSS Custom Properties -- Branded and Redesigned slot picker variants. */
66
+ export declare const CustomStyling: Story;
67
+ //# sourceMappingURL=pd-slot-picker.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pd-slot-picker.stories.d.ts","sourceRoot":"","sources":["../../src/pd-slot-picker/pd-slot-picker.stories.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAKrE,OAAO,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAMhE;;;GAGG;AACH,UAAU,gBAAgB;IACxB,wCAAwC;IACxC,IAAI,EAAE,YAAY,CAAC;IACnB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,wCAAwC;IACxC,WAAW,EAAE,OAAO,CAAC;IACrB,sEAAsE;IACtE,mBAAmB,EAAE,MAAM,CAAC;IAC5B,qEAAqE;IACrE,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kCAAkC;IAClC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,mDAAmD;IACnD,mBAAmB,EAAE,OAAO,CAAC;IAC7B,mDAAmD;IACnD,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AA4LD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,gBAAgB,CA+EhC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AAMxC,sGAAsG;AACtG,eAAO,MAAM,OAAO,EAAE,KAmBrB,CAAC;AAMF,0EAA0E;AAC1E,eAAO,MAAM,iBAAiB,EAAE,KAc/B,CAAC;AAMF,2FAA2F;AAC3F,eAAO,MAAM,gBAAgB,EAAE,KA+D9B,CAAC;AAMF,4DAA4D;AAC5D,eAAO,MAAM,iBAAiB,EAAE,KAuE/B,CAAC;AAMF,yFAAyF;AACzF,eAAO,MAAM,YAAY,EAAE,KAoJ1B,CAAC;AAMF,6EAA6E;AAC7E,eAAO,MAAM,SAAS,EAAE,KA8CvB,CAAC;AAMF,uDAAuD;AACvD,eAAO,MAAM,cAAc,EAAE,KAmB5B,CAAC;AAMF,4EAA4E;AAC5E,eAAO,MAAM,aAAa,EAAE,KAyG3B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './pd-slot-picker/pd-slot-picker'
2
+ export {}
@@ -0,0 +1,8 @@
1
+ import { PdSlotPicker } from './pd-slot-picker/PdSlotPicker.js';
2
+
3
+ const tag = "pd-slot-picker";
4
+ if (!customElements.get(tag)) {
5
+ customElements.define(tag, PdSlotPicker);
6
+ }
7
+
8
+ export { PdSlotPicker };
@@ -0,0 +1,68 @@
1
+ import { LitElement } from 'lit';
2
+ /**
3
+ * Abstract base class for all calendar cell components.
4
+ *
5
+ * Provides shared properties from `CalendarCellInfo` and common utility methods
6
+ * for category styling, time formatting, and keyboard accessibility.
7
+ *
8
+ * Subclasses must implement `_handleSelect()` for their specific selection behavior
9
+ * and provide their own `render()` and `static styles`.
10
+ */
11
+ export declare abstract class PdBaseCell extends LitElement {
12
+ /** Date key in YYYY-MM-DD format. */
13
+ key: string;
14
+ /** Day number (1-31). */
15
+ dayNumber: number;
16
+ /** Weekday number (0=Sunday, 6=Saturday). */
17
+ weekDayNumber: number;
18
+ /** Title/info text (from CalendarCellInfo.info). */
19
+ title: string;
20
+ /** Description text (from CalendarCellInfo.desc). */
21
+ desc: string;
22
+ /** Start time for the event (e.g., "08:30"). */
23
+ startTime: string;
24
+ /** End time for the event (e.g., "14:30"). */
25
+ endTime: string;
26
+ /** Whether this is a full-day event. */
27
+ fullDay: boolean;
28
+ /** Maximum capacity for this slot (number of bookable spots). */
29
+ capacity?: number;
30
+ /** Number of already booked spots. */
31
+ booked?: number;
32
+ /** Category key (references CalendarConfig.categories). */
33
+ category: string;
34
+ /** Background color for the category (from CalendarCategoryConfig.color). */
35
+ categoryColor: string;
36
+ /** Text color for the category (from CalendarCategoryConfig.textColor). */
37
+ categoryTextColor: string;
38
+ /** Whether this cell is disabled (cannot be selected). */
39
+ disabled: boolean;
40
+ /** Whether this cell is selected. */
41
+ selected: boolean;
42
+ /**
43
+ * Builds inline style string for category colors.
44
+ * Each cell passes its own CSS variable names.
45
+ *
46
+ * @param bgVar - CSS variable name for category background color
47
+ * @param textVar - CSS variable name for category text color
48
+ */
49
+ protected _getCategoryStyle(bgVar: string, textVar: string): string;
50
+ /**
51
+ * Formats time info string based on startTime, endTime, fullDay.
52
+ *
53
+ * @param separator - Separator between start and end time. Default: `" - "`.
54
+ * @returns Formatted time string or empty string if no time info is set.
55
+ */
56
+ protected _formatTime(separator?: string): string;
57
+ /**
58
+ * Keyboard handler for Enter/Space key accessibility.
59
+ * Delegates to `_handleSelect()` which each cell implements.
60
+ */
61
+ protected _handleKeyDown(e: KeyboardEvent): void;
62
+ /**
63
+ * Called when the cell is activated (click or keyboard).
64
+ * Each cell implements its own selection behavior and event dispatching.
65
+ */
66
+ protected abstract _handleSelect(): void;
67
+ }
68
+ //# sourceMappingURL=PdBaseCell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PdBaseCell.d.ts","sourceRoot":"","sources":["../../src/shared/PdBaseCell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAGjC;;;;;;;;GAQG;AACH,8BAAsB,UAAW,SAAQ,UAAU;IAKjD,qCAAqC;IAErC,GAAG,SAAM;IAET,yBAAyB;IAEzB,SAAS,SAAM;IAEf,6CAA6C;IAE7C,aAAa,SAAM;IAMnB,oDAAoD;IAEpD,KAAK,SAAM;IAEX,qDAAqD;IAErD,IAAI,SAAM;IAEV,gDAAgD;IAEhD,SAAS,SAAM;IAEf,8CAA8C;IAE9C,OAAO,SAAM;IAEb,wCAAwC;IAExC,OAAO,UAAS;IAMhB,iEAAiE;IAEjE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,sCAAsC;IAEtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAMhB,2DAA2D;IAE3D,QAAQ,SAAM;IAEd,6EAA6E;IAE7E,aAAa,SAAM;IAEnB,2EAA2E;IAE3E,iBAAiB,SAAM;IAMvB,0DAA0D;IAE1D,QAAQ,UAAS;IAEjB,qCAAqC;IAErC,QAAQ,UAAS;IAMjB;;;;;;OAMG;IACH,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAWnE;;;;;OAKG;IACH,SAAS,CAAC,WAAW,CAAC,SAAS,SAAQ,GAAG,MAAM;IAQhD;;;OAGG;IACH,SAAS,CAAC,cAAc,CAAC,CAAC,EAAE,aAAa,GAAG,IAAI;IAOhD;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,aAAa,IAAI,IAAI;CACzC"}
@@ -0,0 +1,120 @@
1
+ import { LitElement } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __decorateClass = (decorators, target, key, kind) => {
6
+ var result = void 0 ;
7
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
8
+ if (decorator = decorators[i])
9
+ result = (decorator(target, key, result) ) || result;
10
+ if (result) __defProp(target, key, result);
11
+ return result;
12
+ };
13
+ class PdBaseCell extends LitElement {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.key = "";
17
+ this.dayNumber = -1;
18
+ this.weekDayNumber = -1;
19
+ this.title = "";
20
+ this.desc = "";
21
+ this.startTime = "";
22
+ this.endTime = "";
23
+ this.fullDay = false;
24
+ this.category = "";
25
+ this.categoryColor = "";
26
+ this.categoryTextColor = "";
27
+ this.disabled = false;
28
+ this.selected = false;
29
+ }
30
+ // ============================================================================
31
+ // Protected Methods
32
+ // ============================================================================
33
+ /**
34
+ * Builds inline style string for category colors.
35
+ * Each cell passes its own CSS variable names.
36
+ *
37
+ * @param bgVar - CSS variable name for category background color
38
+ * @param textVar - CSS variable name for category text color
39
+ */
40
+ _getCategoryStyle(bgVar, textVar) {
41
+ const styles = [];
42
+ if (this.categoryColor) {
43
+ styles.push(`${bgVar}: ${this.categoryColor}`);
44
+ }
45
+ if (this.categoryTextColor) {
46
+ styles.push(`${textVar}: ${this.categoryTextColor}`);
47
+ }
48
+ return styles.join("; ");
49
+ }
50
+ /**
51
+ * Formats time info string based on startTime, endTime, fullDay.
52
+ *
53
+ * @param separator - Separator between start and end time. Default: `" - "`.
54
+ * @returns Formatted time string or empty string if no time info is set.
55
+ */
56
+ _formatTime(separator = " - ") {
57
+ if (this.fullDay) return "24h";
58
+ if (this.startTime && this.endTime)
59
+ return `${this.startTime}${separator}${this.endTime}`;
60
+ if (this.startTime) return this.startTime;
61
+ return "";
62
+ }
63
+ /**
64
+ * Keyboard handler for Enter/Space key accessibility.
65
+ * Delegates to `_handleSelect()` which each cell implements.
66
+ */
67
+ _handleKeyDown(e) {
68
+ if (e.key === "Enter" || e.key === " ") {
69
+ e.preventDefault();
70
+ this._handleSelect();
71
+ }
72
+ }
73
+ }
74
+ __decorateClass([
75
+ property({ type: String })
76
+ ], PdBaseCell.prototype, "key");
77
+ __decorateClass([
78
+ property({ type: Number })
79
+ ], PdBaseCell.prototype, "dayNumber");
80
+ __decorateClass([
81
+ property({ type: Number })
82
+ ], PdBaseCell.prototype, "weekDayNumber");
83
+ __decorateClass([
84
+ property({ type: String })
85
+ ], PdBaseCell.prototype, "title");
86
+ __decorateClass([
87
+ property({ type: String })
88
+ ], PdBaseCell.prototype, "desc");
89
+ __decorateClass([
90
+ property({ type: String })
91
+ ], PdBaseCell.prototype, "startTime");
92
+ __decorateClass([
93
+ property({ type: String })
94
+ ], PdBaseCell.prototype, "endTime");
95
+ __decorateClass([
96
+ property({ type: Boolean })
97
+ ], PdBaseCell.prototype, "fullDay");
98
+ __decorateClass([
99
+ property({ type: Number })
100
+ ], PdBaseCell.prototype, "capacity");
101
+ __decorateClass([
102
+ property({ type: Number })
103
+ ], PdBaseCell.prototype, "booked");
104
+ __decorateClass([
105
+ property({ type: String })
106
+ ], PdBaseCell.prototype, "category");
107
+ __decorateClass([
108
+ property({ type: String })
109
+ ], PdBaseCell.prototype, "categoryColor");
110
+ __decorateClass([
111
+ property({ type: String })
112
+ ], PdBaseCell.prototype, "categoryTextColor");
113
+ __decorateClass([
114
+ property({ type: Boolean, reflect: true })
115
+ ], PdBaseCell.prototype, "disabled");
116
+ __decorateClass([
117
+ property({ type: Boolean, reflect: true })
118
+ ], PdBaseCell.prototype, "selected");
119
+
120
+ export { PdBaseCell };
@@ -0,0 +1,22 @@
1
+ import { LitElement, CSSResultGroup } from 'lit';
2
+ import { CalendarData, CalendarConfig, CalendarCategoryConfig } from '../types.js';
3
+ /**
4
+ * Abstract base class for all calendar view components.
5
+ *
6
+ * Provides shared properties for data, config, and selection,
7
+ * plus a utility to resolve category configuration.
8
+ */
9
+ export declare abstract class PdBaseView extends LitElement {
10
+ /** Calendar data with info per date key (YYYY-MM-DD). */
11
+ data: CalendarData;
12
+ /** Calendar configuration including category definitions. */
13
+ config?: CalendarConfig;
14
+ /** Reference date for initial calendar view. */
15
+ refDate?: Date;
16
+ /** Show selection highlight on selected date. */
17
+ showSelection: boolean;
18
+ /** Resolves a category key to its configuration. */
19
+ protected _resolveCategoryConfig(category?: string): CalendarCategoryConfig | undefined;
20
+ static baseStyles: CSSResultGroup;
21
+ }
22
+ //# sourceMappingURL=PdBaseView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PdBaseView.d.ts","sourceRoot":"","sources":["../../src/shared/PdBaseView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAO,cAAc,EAAE,MAAM,KAAK,CAAC;AAGtD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAErB;;;;;GAKG;AACH,8BAAsB,UAAW,SAAQ,UAAU;IACjD,yDAAyD;IAEzD,IAAI,EAAE,YAAY,CAAM;IAExB,6DAA6D;IAE7D,MAAM,CAAC,EAAE,cAAc,CAAC;IAExB,gDAAgD;IAEhD,OAAO,CAAC,EAAE,IAAI,CAAC;IAEf,iDAAiD;IAEjD,aAAa,UAAS;IAEtB,oDAAoD;IACpD,SAAS,CAAC,sBAAsB,CAC9B,QAAQ,CAAC,EAAE,MAAM,GAChB,sBAAsB,GAAG,SAAS;IAKrC,MAAM,CAAC,UAAU,EAAE,cAAc,CAK/B;CACH"}
@@ -0,0 +1,46 @@
1
+ import { LitElement, css } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+
4
+ var __defProp = Object.defineProperty;
5
+ var __decorateClass = (decorators, target, key, kind) => {
6
+ var result = void 0 ;
7
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
8
+ if (decorator = decorators[i])
9
+ result = (decorator(target, key, result) ) || result;
10
+ if (result) __defProp(target, key, result);
11
+ return result;
12
+ };
13
+ class PdBaseView extends LitElement {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.data = {};
17
+ this.showSelection = false;
18
+ }
19
+ /** Resolves a category key to its configuration. */
20
+ _resolveCategoryConfig(category) {
21
+ if (!category) return void 0;
22
+ return this.config?.categories?.[category];
23
+ }
24
+ static {
25
+ this.baseStyles = css`
26
+ :host {
27
+ display: block;
28
+ container-type: inline-size;
29
+ }
30
+ `;
31
+ }
32
+ }
33
+ __decorateClass([
34
+ property({ type: Object })
35
+ ], PdBaseView.prototype, "data");
36
+ __decorateClass([
37
+ property({ type: Object })
38
+ ], PdBaseView.prototype, "config");
39
+ __decorateClass([
40
+ property({ type: Object })
41
+ ], PdBaseView.prototype, "refDate");
42
+ __decorateClass([
43
+ property({ type: Boolean })
44
+ ], PdBaseView.prototype, "showSelection");
45
+
46
+ export { PdBaseView };
@@ -0,0 +1,34 @@
1
+ import { LitElement, nothing, CSSResultGroup, TemplateResult } from 'lit';
2
+ /**
3
+ * Abstract base class for calendar floating panels.
4
+ *
5
+ * Provides the shared panel shell: fixed positioning, auto-placement via
6
+ * `calculateFloatingPosition`, close-on-click-outside / Escape / scroll,
7
+ * and a consistent header with a close icon.
8
+ *
9
+ * Subclasses override `renderHeaderContent()` and `renderBody()`.
10
+ *
11
+ * @event close-panel - Fired when the panel should close.
12
+ */
13
+ export declare abstract class PdCalendarPanelBase extends LitElement {
14
+ /** Anchor rect for positioning (from the clicked element). */
15
+ anchorRect?: DOMRect;
16
+ private _boundClickOutside;
17
+ private _boundKeyDown;
18
+ private _boundScroll;
19
+ static panelBaseStyles: CSSResultGroup;
20
+ connectedCallback(): void;
21
+ disconnectedCallback(): void;
22
+ updated(changed: Map<PropertyKey, unknown>): void;
23
+ render(): TemplateResult | typeof nothing;
24
+ /** Override to render content inside the header (left of close icon). */
25
+ protected abstract renderHeaderContent(): TemplateResult | typeof import('lit').nothing;
26
+ /** Override to render the scrollable body content. */
27
+ protected abstract renderBody(): TemplateResult | typeof import('lit').nothing;
28
+ private _updatePosition;
29
+ protected _onClose(): void;
30
+ private _handleClickOutside;
31
+ private _handleKeyDown;
32
+ private _handleScroll;
33
+ }
34
+ //# sourceMappingURL=PdCalendarPanelBase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PdCalendarPanelBase.d.ts","sourceRoot":"","sources":["../../src/shared/PdCalendarPanelBase.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAGV,OAAO,EACP,cAAc,EACd,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAKb,OAAO,0CAA0C,CAAC;AAElD;;;;;;;;;;GAUG;AACH,8BAAsB,mBAAoB,SAAQ,UAAU;IAC1D,8DAA8D;IAE9D,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,OAAO,CAAC,kBAAkB,CAAuC;IACjE,OAAO,CAAC,aAAa,CAAkC;IACvD,OAAO,CAAC,YAAY,CAAiC;IAErD,MAAM,CAAC,eAAe,EAAE,cAAc,CA2DpC;IAMO,iBAAiB,IAAI,IAAI;IASzB,oBAAoB,IAAI,IAAI;IAO5B,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,GAAG,IAAI;IAUjD,MAAM,IAAI,cAAc,GAAG,OAAO,OAAO;IAgBlD,yEAAyE;IACzE,SAAS,CAAC,QAAQ,CAAC,mBAAmB,IAClC,cAAc,GACd,cAAc,KAAK,EAAE,OAAO;IAEhC,sDAAsD;IACtD,SAAS,CAAC,QAAQ,CAAC,UAAU,IACzB,cAAc,GACd,cAAc,KAAK,EAAE,OAAO;IAMhC,OAAO,CAAC,eAAe;IAuBvB,SAAS,CAAC,QAAQ,IAAI,IAAI;IAM1B,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,aAAa;CAGtB"}