@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 @@
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"}
@@ -0,0 +1,169 @@
1
+ import { LitElement, css, html } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import { calculateFloatingPosition } from '@progressive-development/pd-utils';
4
+ import { pdIcons } from '@progressive-development/pd-icon';
5
+ import '@progressive-development/pd-icon/pd-icon';
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __decorateClass = (decorators, target, key, kind) => {
9
+ var result = void 0 ;
10
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
11
+ if (decorator = decorators[i])
12
+ result = (decorator(target, key, result) ) || result;
13
+ if (result) __defProp(target, key, result);
14
+ return result;
15
+ };
16
+ class PdCalendarPanelBase extends LitElement {
17
+ constructor() {
18
+ super(...arguments);
19
+ this._boundClickOutside = this._handleClickOutside.bind(this);
20
+ this._boundKeyDown = this._handleKeyDown.bind(this);
21
+ this._boundScroll = this._handleScroll.bind(this);
22
+ }
23
+ static {
24
+ this.panelBaseStyles = css`
25
+ :host {
26
+ display: block;
27
+ position: fixed;
28
+ z-index: 9999;
29
+ }
30
+
31
+ .panel {
32
+ width: var(--pd-calendar-panel-width, 280px);
33
+ max-height: var(--pd-calendar-panel-max-height, 70vh);
34
+ background: var(--pd-calendar-panel-bg, var(--pd-default-bg-col, #fff));
35
+ border-radius: var(--pd-radius-md, 8px);
36
+ box-shadow: var(
37
+ --pd-calendar-panel-shadow,
38
+ 0 4px 12px rgba(0, 0, 0, 0.15)
39
+ );
40
+ font-family: var(--pd-default-font-content-family);
41
+ display: flex;
42
+ flex-direction: column;
43
+ overflow: hidden;
44
+ }
45
+
46
+ .panel-header {
47
+ display: flex;
48
+ align-items: center;
49
+ gap: var(--pd-spacing-xs, 0.25rem);
50
+ padding: var(--pd-spacing-sm, 0.5rem);
51
+ min-height: 32px;
52
+ flex-shrink: 0;
53
+ }
54
+
55
+ .panel-header-content {
56
+ flex: 1;
57
+ min-width: 0;
58
+ display: flex;
59
+ align-items: center;
60
+ gap: var(--pd-spacing-xs, 0.25rem);
61
+ }
62
+
63
+ .panel-close {
64
+ cursor: pointer;
65
+ opacity: 0.5;
66
+ transition: opacity 0.15s ease;
67
+ flex-shrink: 0;
68
+ --pd-icon-size: 16px;
69
+ }
70
+
71
+ .panel-close:hover {
72
+ opacity: 1;
73
+ }
74
+
75
+ .panel-body {
76
+ padding: 0 var(--pd-spacing-sm, 0.5rem) var(--pd-spacing-sm, 0.5rem);
77
+ display: flex;
78
+ flex-direction: column;
79
+ gap: var(--pd-spacing-xs, 0.25rem);
80
+ overflow-y: auto;
81
+ min-height: 0;
82
+ }
83
+ `;
84
+ }
85
+ // ===========================================================================
86
+ // Lifecycle
87
+ // ===========================================================================
88
+ connectedCallback() {
89
+ super.connectedCallback();
90
+ requestAnimationFrame(() => {
91
+ document.addEventListener("click", this._boundClickOutside);
92
+ document.addEventListener("keydown", this._boundKeyDown);
93
+ window.addEventListener("scroll", this._boundScroll, true);
94
+ });
95
+ }
96
+ disconnectedCallback() {
97
+ super.disconnectedCallback();
98
+ document.removeEventListener("click", this._boundClickOutside);
99
+ document.removeEventListener("keydown", this._boundKeyDown);
100
+ window.removeEventListener("scroll", this._boundScroll, true);
101
+ }
102
+ updated(changed) {
103
+ if (changed.has("anchorRect") && this.anchorRect) {
104
+ this._updatePosition();
105
+ }
106
+ }
107
+ // ===========================================================================
108
+ // Render
109
+ // ===========================================================================
110
+ render() {
111
+ return html`
112
+ <div class="panel">
113
+ <div class="panel-header">
114
+ <div class="panel-header-content">${this.renderHeaderContent()}</div>
115
+ <pd-icon
116
+ class="panel-close"
117
+ icon="${pdIcons.ICON_CLOSE}"
118
+ @click="${this._onClose}"
119
+ ></pd-icon>
120
+ </div>
121
+ <div class="panel-body">${this.renderBody()}</div>
122
+ </div>
123
+ `;
124
+ }
125
+ // ===========================================================================
126
+ // Positioning
127
+ // ===========================================================================
128
+ _updatePosition() {
129
+ if (!this.anchorRect) return;
130
+ const panelEl = this.shadowRoot?.querySelector(
131
+ ".panel"
132
+ );
133
+ const width = panelEl?.offsetWidth || 280;
134
+ const height = panelEl?.offsetHeight || 200;
135
+ const pos = calculateFloatingPosition({
136
+ anchor: this.anchorRect,
137
+ floating: { width, height },
138
+ preferY: "below"
139
+ });
140
+ this.style.top = `${pos.top}px`;
141
+ this.style.left = `${pos.left}px`;
142
+ }
143
+ // ===========================================================================
144
+ // Close
145
+ // ===========================================================================
146
+ _onClose() {
147
+ this.dispatchEvent(
148
+ new CustomEvent("close-panel", { bubbles: true, composed: true })
149
+ );
150
+ }
151
+ _handleClickOutside(e) {
152
+ if (!e.composedPath().includes(this)) {
153
+ this._onClose();
154
+ }
155
+ }
156
+ _handleKeyDown(e) {
157
+ if (e.key === "Escape") {
158
+ this._onClose();
159
+ }
160
+ }
161
+ _handleScroll() {
162
+ this._onClose();
163
+ }
164
+ }
165
+ __decorateClass([
166
+ property({ type: Object })
167
+ ], PdCalendarPanelBase.prototype, "anchorRect");
168
+
169
+ export { PdCalendarPanelBase };
@@ -0,0 +1,41 @@
1
+ import { CSSResultGroup, LitElement, PropertyValues } from 'lit';
2
+ import { ButtonData } from '@progressive-development/pd-forms';
3
+ import { AvailableCalendarPeriods, AvailableCalendarViewTypes } from '../../types';
4
+ export declare class CalendarButtonBar extends LitElement {
5
+ availableViewTypes: AvailableCalendarViewTypes;
6
+ availablePeriods: AvailableCalendarPeriods;
7
+ withYearPopup: string[];
8
+ currentTitle?: string;
9
+ currentDate?: Date;
10
+ year: number;
11
+ withSettings?: boolean;
12
+ hideNext?: boolean;
13
+ hidePrev?: boolean;
14
+ /** When true, navigation buttons are not rendered at all (as opposed to disabled). */
15
+ hideNavigation: boolean;
16
+ isCompact?: boolean;
17
+ _currentViewOptions: ButtonData[];
18
+ _currentPeriodOptions: ButtonData[];
19
+ /** Currently selected view type index for the button group. */
20
+ private _currentViewTypeIndex;
21
+ /** Currently selected period index for the button select group. */
22
+ private _currentPeriodIndex;
23
+ private _viewTypeSelectionEl;
24
+ private _periodSelectionEl;
25
+ private _openYearPopupState;
26
+ static styles: CSSResultGroup;
27
+ willUpdate(changedProps: PropertyValues<this>): void;
28
+ render(): import('lit').TemplateResult<1>;
29
+ private _navigationEvent;
30
+ private _changeViewEvent;
31
+ private _changePeriodEvent;
32
+ /**
33
+ * Opens the year selection popup with keyboard support.
34
+ */
35
+ private _onTriggerKeyDown;
36
+ /**
37
+ * Opens the year popup and manages focus.
38
+ */
39
+ private _openYearPopup;
40
+ }
41
+ //# sourceMappingURL=calendar-button-bar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar-button-bar.d.ts","sourceRoot":"","sources":["../../../src/shared/calendar-button-bar/calendar-button-bar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAa,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAK5E,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAE/D,OAAO,6CAA6C,CAAC;AACrD,OAAO,mDAAmD,CAAC;AAC3D,OAAO,0DAA0D,CAAC;AAElE,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAG3B,MAAM,aAAa,CAAC;AAgBrB,qBAEa,iBAAkB,SAAQ,UAAU;IAE/C,kBAAkB,EAAG,0BAA0B,CAAC;IAGhD,gBAAgB,EAAG,wBAAwB,CAAC;IAG5C,aAAa,EAAE,MAAM,EAAE,CAAM;IAG7B,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,WAAW,CAAC,EAAE,IAAI,CAAC;IAGnB,IAAI,EAAE,MAAM,CAAK;IAGjB,YAAY,CAAC,EAAE,OAAO,CAAC;IAGvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAGnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,sFAAsF;IAEtF,cAAc,UAAS;IAGvB,SAAS,CAAC,EAAE,OAAO,CAAC;IAIpB,mBAAmB,EAAE,UAAU,EAAE,CAI/B;IAGF,qBAAqB,EAAE,UAAU,EAAE,CAKjC;IAEF,+DAA+D;IAE/D,OAAO,CAAC,qBAAqB,CAAc;IAE3C,mEAAmE;IAEnE,OAAO,CAAC,mBAAmB,CAAc;IAGzC,OAAO,CAAC,oBAAoB,CAAM;IAGlC,OAAO,CAAC,kBAAkB,CAAM;IAEhC,OAAO,CAAC,mBAAmB,CAAkB;IAE7C,OAAgB,MAAM,EAAE,cAAc,CAyIpC;IAEO,UAAU,CAAC,YAAY,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAgCpD,MAAM;IAsFf,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,gBAAgB;IAwBxB,OAAO,CAAC,kBAAkB;IA2B1B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAOzB;;OAEG;IACH,OAAO,CAAC,cAAc;CA8CvB"}