@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.
- package/LICENSE +21 -2
- package/README.md +32 -57
- package/dist/generated/locales/be.d.ts +7 -0
- package/dist/generated/locales/be.d.ts.map +1 -1
- package/dist/generated/locales/de.d.ts +7 -0
- package/dist/generated/locales/de.d.ts.map +1 -1
- package/dist/generated/locales/en.d.ts +7 -0
- package/dist/generated/locales/en.d.ts.map +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -10
- package/dist/locales/be.js +10 -4
- package/dist/locales/de.js +10 -4
- package/dist/locales/en.js +10 -4
- package/dist/pd-calendar/PdCalendar.d.ts +133 -0
- package/dist/pd-calendar/PdCalendar.d.ts.map +1 -0
- package/dist/pd-calendar/PdCalendar.js +550 -0
- package/dist/pd-calendar/pd-calendar-cell/PdCalendarCell.d.ts +56 -0
- package/dist/pd-calendar/pd-calendar-cell/PdCalendarCell.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-cell/PdCalendarCell.js +337 -0
- package/dist/pd-calendar/pd-calendar-cell/pd-calendar-cell.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar-cell/pd-calendar-cell.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-cell/pd-calendar-cell.js +8 -0
- package/dist/pd-calendar/pd-calendar-day-events-panel/PdCalendarDayEventsPanel.d.ts +27 -0
- package/dist/pd-calendar/pd-calendar-day-events-panel/PdCalendarDayEventsPanel.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-day-events-panel/PdCalendarDayEventsPanel.js +160 -0
- package/dist/pd-calendar/pd-calendar-day-events-panel/pd-calendar-day-events-panel.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar-day-events-panel/pd-calendar-day-events-panel.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-day-events-panel/pd-calendar-day-events-panel.js +8 -0
- package/dist/pd-calendar/pd-calendar-event-cell/PdCalendarEventCell.d.ts +55 -0
- package/dist/pd-calendar/pd-calendar-event-cell/PdCalendarEventCell.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-event-cell/PdCalendarEventCell.js +341 -0
- package/dist/pd-calendar/pd-calendar-event-cell/pd-calendar-event-cell.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar-event-cell/pd-calendar-event-cell.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-event-cell/pd-calendar-event-cell.js +8 -0
- package/dist/pd-calendar/pd-calendar-event-info-panel/PdCalendarEventInfoPanel.d.ts +29 -0
- package/dist/pd-calendar/pd-calendar-event-info-panel/PdCalendarEventInfoPanel.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-event-info-panel/PdCalendarEventInfoPanel.js +211 -0
- package/dist/pd-calendar/pd-calendar-event-info-panel/pd-calendar-event-info-panel.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar-event-info-panel/pd-calendar-event-info-panel.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-event-info-panel/pd-calendar-event-info-panel.js +8 -0
- package/dist/pd-calendar/pd-calendar-list-cell/PdCalendarListCell.d.ts +28 -0
- package/dist/pd-calendar/pd-calendar-list-cell/PdCalendarListCell.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-list-cell/PdCalendarListCell.js +252 -0
- package/dist/pd-calendar/pd-calendar-list-cell/pd-calendar-list-cell.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar-list-cell/pd-calendar-list-cell.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-list-cell/pd-calendar-list-cell.js +8 -0
- package/dist/pd-calendar/pd-calendar-list-view/PdCalendarListView.d.ts +26 -0
- package/dist/pd-calendar/pd-calendar-list-view/PdCalendarListView.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-list-view/PdCalendarListView.js +165 -0
- package/dist/pd-calendar/pd-calendar-list-view/pd-calendar-list-view.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar-list-view/pd-calendar-list-view.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-list-view/pd-calendar-list-view.js +8 -0
- package/dist/pd-calendar/pd-calendar-month-view/PdCalendarMonthView.d.ts +55 -0
- package/dist/pd-calendar/pd-calendar-month-view/PdCalendarMonthView.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-month-view/PdCalendarMonthView.js +461 -0
- package/dist/pd-calendar/pd-calendar-month-view/pd-calendar-month-view.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar-month-view/pd-calendar-month-view.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-month-view/pd-calendar-month-view.js +8 -0
- package/dist/pd-calendar/pd-calendar-time-grid-view/PdCalendarTimeGridView.d.ts +32 -0
- package/dist/pd-calendar/pd-calendar-time-grid-view/PdCalendarTimeGridView.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-time-grid-view/PdCalendarTimeGridView.js +468 -0
- package/dist/pd-calendar/pd-calendar-time-grid-view/pd-calendar-time-grid-view.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar-time-grid-view/pd-calendar-time-grid-view.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-time-grid-view/pd-calendar-time-grid-view.js +8 -0
- package/dist/pd-calendar/pd-calendar-week-cell/PdCalendarWeekCell.d.ts +31 -0
- package/dist/pd-calendar/pd-calendar-week-cell/PdCalendarWeekCell.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-week-cell/PdCalendarWeekCell.js +134 -0
- package/dist/pd-calendar/pd-calendar-week-cell/pd-calendar-week-cell.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar-week-cell/pd-calendar-week-cell.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar-week-cell/pd-calendar-week-cell.js +8 -0
- package/dist/pd-calendar/pd-calendar.d.ts +3 -0
- package/dist/pd-calendar/pd-calendar.d.ts.map +1 -0
- package/dist/pd-calendar/pd-calendar.stories.d.ts +83 -0
- package/dist/pd-calendar/pd-calendar.stories.d.ts.map +1 -0
- package/dist/pd-calendar/pd-year-popup/PdYearPopup.d.ts +38 -0
- package/dist/pd-calendar/pd-year-popup/PdYearPopup.d.ts.map +1 -0
- package/dist/pd-calendar/pd-year-popup/PdYearPopup.js +249 -0
- package/dist/pd-calendar/pd-year-popup/pd-year-popup.d.ts +3 -0
- package/dist/pd-calendar/pd-year-popup/pd-year-popup.d.ts.map +1 -0
- package/dist/pd-calendar/pd-year-popup/pd-year-popup.js +8 -0
- package/dist/pd-calendar.d.ts +2 -48
- package/dist/pd-calendar.js +6 -437
- package/dist/pd-datepicker/PdDatepicker.d.ts +181 -0
- package/dist/pd-datepicker/PdDatepicker.d.ts.map +1 -0
- package/dist/pd-datepicker/PdDatepicker.js +701 -0
- package/dist/pd-datepicker/pd-date-picker.stories.d.ts +81 -0
- package/dist/pd-datepicker/pd-date-picker.stories.d.ts.map +1 -0
- package/dist/pd-datepicker/pd-datepicker.d.ts +3 -0
- package/dist/pd-datepicker/pd-datepicker.d.ts.map +1 -0
- package/dist/pd-datepicker.d.ts +2 -0
- package/dist/pd-datepicker.js +8 -0
- package/dist/pd-slot-picker/PdSlotPicker.d.ts +102 -0
- package/dist/pd-slot-picker/PdSlotPicker.d.ts.map +1 -0
- package/dist/pd-slot-picker/PdSlotPicker.js +339 -0
- package/dist/pd-slot-picker/pd-slot-cell/PdSlotCell.d.ts +35 -0
- package/dist/pd-slot-picker/pd-slot-cell/PdSlotCell.d.ts.map +1 -0
- package/dist/pd-slot-picker/pd-slot-cell/PdSlotCell.js +188 -0
- package/dist/pd-slot-picker/pd-slot-cell/pd-slot-cell.d.ts +3 -0
- package/dist/pd-slot-picker/pd-slot-cell/pd-slot-cell.d.ts.map +1 -0
- package/dist/pd-slot-picker/pd-slot-cell/pd-slot-cell.js +8 -0
- package/dist/pd-slot-picker/pd-slot-picker.d.ts +3 -0
- package/dist/pd-slot-picker/pd-slot-picker.d.ts.map +1 -0
- package/dist/pd-slot-picker/pd-slot-picker.stories.d.ts +67 -0
- package/dist/pd-slot-picker/pd-slot-picker.stories.d.ts.map +1 -0
- package/dist/pd-slot-picker.d.ts +2 -0
- package/dist/pd-slot-picker.js +8 -0
- package/dist/shared/PdBaseCell.d.ts +68 -0
- package/dist/shared/PdBaseCell.d.ts.map +1 -0
- package/dist/shared/PdBaseCell.js +120 -0
- package/dist/shared/PdBaseView.d.ts +22 -0
- package/dist/shared/PdBaseView.d.ts.map +1 -0
- package/dist/shared/PdBaseView.js +46 -0
- package/dist/shared/PdCalendarPanelBase.d.ts +34 -0
- package/dist/shared/PdCalendarPanelBase.d.ts.map +1 -0
- package/dist/shared/PdCalendarPanelBase.js +169 -0
- package/dist/shared/calendar-button-bar/calendar-button-bar.d.ts +41 -0
- package/dist/shared/calendar-button-bar/calendar-button-bar.d.ts.map +1 -0
- package/dist/shared/calendar-button-bar/calendar-button-bar.js +435 -0
- package/dist/shared/calendar-locales.d.ts +9 -0
- package/dist/shared/calendar-locales.d.ts.map +1 -0
- package/dist/shared/calendar-locales.js +30 -0
- package/dist/shared/calendar-utils.d.ts +34 -0
- package/dist/shared/calendar-utils.d.ts.map +1 -0
- package/dist/shared/calendar-utils.js +99 -0
- package/dist/shared/calendar-utils.test.d.ts +2 -0
- package/dist/shared/calendar-utils.test.d.ts.map +1 -0
- package/dist/types.d.ts +102 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +35 -47
- package/dist/pd-calendar-cell.d.ts +0 -47
- package/dist/pd-calendar-cell.d.ts.map +0 -1
- package/dist/pd-calendar-cell.js +0 -282
- package/dist/pd-calendar.d.ts.map +0 -1
- package/dist/pd-year-popup.d.ts +0 -25
- package/dist/pd-year-popup.d.ts.map +0 -1
- package/dist/pd-year-popup.js +0 -136
- package/dist/stories/cell.stories.d.ts +0 -15
- package/dist/stories/cell.stories.d.ts.map +0 -1
- package/dist/stories/index.stories.d.ts +0 -23
- package/dist/stories/index.stories.d.ts.map +0 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/web-components-vite';
|
|
2
|
+
import { CalendarData, AvailableCalendarViewTypes } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Story arguments interface for pd-calendar component.
|
|
5
|
+
* Maps to the component's public API.
|
|
6
|
+
*/
|
|
7
|
+
interface PdCalendarArgs {
|
|
8
|
+
/** Reference date for initial calendar view */
|
|
9
|
+
refDate?: Date;
|
|
10
|
+
/** Whether weekends should be hidden */
|
|
11
|
+
hideWeekend: boolean;
|
|
12
|
+
/** Calendar data with info per date */
|
|
13
|
+
data: CalendarData;
|
|
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
|
+
/** Whether dates are selectable */
|
|
19
|
+
selectableDates: boolean;
|
|
20
|
+
/** Whether to show selection highlight */
|
|
21
|
+
showSelection: boolean;
|
|
22
|
+
/** Year selection popup values */
|
|
23
|
+
withYearPopup: string[];
|
|
24
|
+
/** CSS class for number positioning */
|
|
25
|
+
numberClass: string;
|
|
26
|
+
/** Enable mouse wheel navigation between months */
|
|
27
|
+
withWheelNavigation: boolean;
|
|
28
|
+
/** Enable touch swipe navigation between months */
|
|
29
|
+
withTouchNavigation: boolean;
|
|
30
|
+
/** Available view types for view toggle */
|
|
31
|
+
availableViewTypes?: AvailableCalendarViewTypes;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* ## pd-calendar
|
|
35
|
+
*
|
|
36
|
+
* A full-featured calendar component supporting month, list, and week views with
|
|
37
|
+
* date info, selection, navigation, and event management.
|
|
38
|
+
*
|
|
39
|
+
* ### Features
|
|
40
|
+
* - **Month View**: Displays a full month with navigation controls and date info
|
|
41
|
+
* - **List View**: Shows only dates with data in a compact list format
|
|
42
|
+
* - **Week View (timeGrid)**: Displays a weekly time grid with overlapping events
|
|
43
|
+
* - **Event Calendar**: Month view with event bars and info panel (`cellType="events"`)
|
|
44
|
+
* - **Special Days**: Highlight specific dates with category-based styling
|
|
45
|
+
* - **Navigation**: Arrow buttons, keyboard, mouse wheel, touch swipe, year popup
|
|
46
|
+
* - **Navigation Constraints**: Limit forward/backward month navigation
|
|
47
|
+
* - **Weekend Hiding**: Option to hide Saturday and Sunday
|
|
48
|
+
* - **Custom Date Range**: List view can display a specific date range
|
|
49
|
+
*
|
|
50
|
+
* ### Accessibility
|
|
51
|
+
* - `role="grid"` on the calendar grid with `aria-label` for current month/year
|
|
52
|
+
* - Arrow keys navigate between dates, Enter/Space selects
|
|
53
|
+
* - Home/End for first/last day of month
|
|
54
|
+
* - `aria-selected` on selected dates
|
|
55
|
+
* - `tabindex` management for keyboard focus (0 when selectable, -1 when read-only)
|
|
56
|
+
* - Focus-visible styling for keyboard users
|
|
57
|
+
*/
|
|
58
|
+
declare const meta: Meta<PdCalendarArgs>;
|
|
59
|
+
export default meta;
|
|
60
|
+
type Story = StoryObj<PdCalendarArgs>;
|
|
61
|
+
/** Default calendar without data or constraints. Interactive via Controls panel. */
|
|
62
|
+
export declare const Default: Story;
|
|
63
|
+
/** Calendar with price info per date and forward/backward navigation constraints. */
|
|
64
|
+
export declare const WithInfoAndConstraints: Story;
|
|
65
|
+
/** Calendar with category-highlighted special days (green background). */
|
|
66
|
+
export declare const WithSpecialDays: Story;
|
|
67
|
+
/** Compact selectable calendar with year popup, centered numbers, and reduced width. */
|
|
68
|
+
export declare const Selectable: Story;
|
|
69
|
+
/** List view with title, description, time, and category colors. Toggle between month and list view. */
|
|
70
|
+
export declare const ListView: Story;
|
|
71
|
+
/** All time display variants in list view: no time, start only, start+end, and full day. */
|
|
72
|
+
export declare const ListViewTimeVariants: Story;
|
|
73
|
+
/** List view with a custom date range spanning multiple months. Navigation is disabled in range mode. */
|
|
74
|
+
export declare const ListViewCustomRange: Story;
|
|
75
|
+
/** Week view (timeGrid) with timed events, full-day events, and overlapping events. */
|
|
76
|
+
export declare const WeekView: Story;
|
|
77
|
+
/** Week view with custom time window (8:00-18:00) and visible days configuration. */
|
|
78
|
+
export declare const WeekViewBusinessHours: Story;
|
|
79
|
+
/** Month view with event bars per day using `cellType="events"`. Click an event bar to open the info panel. */
|
|
80
|
+
export declare const EventCalendar: Story;
|
|
81
|
+
/** CSS Custom Properties -- Branded and Redesigned calendar variants. */
|
|
82
|
+
export declare const CustomStyling: Story;
|
|
83
|
+
//# sourceMappingURL=pd-calendar.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pd-calendar.stories.d.ts","sourceRoot":"","sources":["../../src/pd-calendar/pd-calendar.stories.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAKrE,OAAO,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACV,YAAY,EACZ,0BAA0B,EAI3B,MAAM,aAAa,CAAC;AAMrB;;;GAGG;AACH,UAAU,cAAc;IACtB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,wCAAwC;IACxC,WAAW,EAAE,OAAO,CAAC;IACrB,uCAAuC;IACvC,IAAI,EAAE,YAAY,CAAC;IACnB,sEAAsE;IACtE,mBAAmB,EAAE,MAAM,CAAC;IAC5B,qEAAqE;IACrE,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mCAAmC;IACnC,eAAe,EAAE,OAAO,CAAC;IACzB,0CAA0C;IAC1C,aAAa,EAAE,OAAO,CAAC;IACvB,kCAAkC;IAClC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,mBAAmB,EAAE,OAAO,CAAC;IAC7B,mDAAmD;IACnD,mBAAmB,EAAE,OAAO,CAAC;IAC7B,2CAA2C;IAC3C,kBAAkB,CAAC,EAAE,0BAA0B,CAAC;CACjD;AA+ED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,cAAc,CAoG9B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;AAMtC,oFAAoF;AACpF,eAAO,MAAM,OAAO,EAAE,KAgBrB,CAAC;AAMF,qFAAqF;AACrF,eAAO,MAAM,sBAAsB,EAAE,KAiBpC,CAAC;AAMF,0EAA0E;AAC1E,eAAO,MAAM,eAAe,EAAE,KAgB7B,CAAC;AAMF,wFAAwF;AACxF,eAAO,MAAM,UAAU,EAAE,KAwCxB,CAAC;AAMF,wGAAwG;AACxG,eAAO,MAAM,QAAQ,EAAE,KA4FtB,CAAC;AAMF,4FAA4F;AAC5F,eAAO,MAAM,oBAAoB,EAAE,KAiElC,CAAC;AAMF,yGAAyG;AACzG,eAAO,MAAM,mBAAmB,EAAE,KAkEjC,CAAC;AAMF,uFAAuF;AACvF,eAAO,MAAM,QAAQ,EAAE,KAuHtB,CAAC;AAMF,qFAAqF;AACrF,eAAO,MAAM,qBAAqB,EAAE,KA2EnC,CAAC;AAMF,+GAA+G;AAC/G,eAAO,MAAM,aAAa,EAAE,KAmI3B,CAAC;AAMF,yEAAyE;AACzE,eAAO,MAAM,aAAa,EAAE,KAyF3B,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { LitElement, CSSResultGroup } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* Accessible year selection popup component.
|
|
4
|
+
*
|
|
5
|
+
* Displays a listbox of selectable years with full keyboard navigation
|
|
6
|
+
* and ARIA support for screen readers.
|
|
7
|
+
*
|
|
8
|
+
* @event change-year-selection - Fired when a year is selected. Detail: `{ year: string }`.
|
|
9
|
+
* @event abort-year-selection - Fired when popup is closed without selection (Escape, click outside).
|
|
10
|
+
*
|
|
11
|
+
* @tagname pd-year-popup
|
|
12
|
+
*
|
|
13
|
+
* @cssprop --pd-year-popup-bg-col - Background color. Default: `var(--pd-default-bg-col)`.
|
|
14
|
+
* @cssprop --pd-year-popup-border-col - Border color. Default: `var(--pd-default-disabled-light-col)`.
|
|
15
|
+
*/
|
|
16
|
+
export declare class PdYearPopup extends LitElement {
|
|
17
|
+
/** List of selectable years. */
|
|
18
|
+
yearSelection: string[];
|
|
19
|
+
/** Currently selected year (highlighted). */
|
|
20
|
+
currentYear: string;
|
|
21
|
+
/** @ignore - Index of currently focused item for keyboard navigation */
|
|
22
|
+
private _focusedIndex;
|
|
23
|
+
private _listEl;
|
|
24
|
+
private _boundHandleClickOutside;
|
|
25
|
+
static styles: CSSResultGroup;
|
|
26
|
+
connectedCallback(): void;
|
|
27
|
+
disconnectedCallback(): void;
|
|
28
|
+
firstUpdated(): void;
|
|
29
|
+
render(): import('lit').TemplateResult<1>;
|
|
30
|
+
private _getItemClasses;
|
|
31
|
+
private _onKeyDown;
|
|
32
|
+
private _scrollToFocused;
|
|
33
|
+
private _yearSelection;
|
|
34
|
+
private _selectYear;
|
|
35
|
+
private _closeSelection;
|
|
36
|
+
private _handleClickOutside;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=PdYearPopup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PdYearPopup.d.ts","sourceRoot":"","sources":["../../../src/pd-calendar/pd-year-popup/PdYearPopup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAG5D;;;;;;;;;;;;;GAaG;AACH,qBAAa,WAAY,SAAQ,UAAU;IACzC,gCAAgC;IAEhC,aAAa,EAAE,MAAM,EAAE,CAAM;IAE7B,6CAA6C;IAE7C,WAAW,SAAM;IAEjB,wEAAwE;IAExE,OAAO,CAAC,aAAa,CAAM;IAG3B,OAAO,CAAC,OAAO,CAAoB;IAEnC,OAAO,CAAC,wBAAwB,CAAuC;IAEvE,OAAgB,MAAM,EAAE,cAAc,CAgFpC;IAEO,iBAAiB,IAAI,IAAI;IAQzB,oBAAoB,IAAI,IAAI;IAK5B,YAAY,IAAI,IAAI;IAYpB,MAAM;IA8Bf,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,UAAU;IAiDlB,OAAO,CAAC,gBAAgB;IAOxB,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,mBAAmB;CAM5B"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { LitElement, css, html } from 'lit';
|
|
2
|
+
import { property, state, query } 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 PdYearPopup extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.yearSelection = [];
|
|
17
|
+
this.currentYear = "";
|
|
18
|
+
this._focusedIndex = -1;
|
|
19
|
+
this._boundHandleClickOutside = this._handleClickOutside.bind(this);
|
|
20
|
+
}
|
|
21
|
+
static {
|
|
22
|
+
this.styles = [
|
|
23
|
+
css`
|
|
24
|
+
:host {
|
|
25
|
+
position: absolute;
|
|
26
|
+
z-index: 10;
|
|
27
|
+
top: 25px;
|
|
28
|
+
right: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
ul {
|
|
32
|
+
list-style: none;
|
|
33
|
+
max-height: 250px;
|
|
34
|
+
overflow-y: auto;
|
|
35
|
+
|
|
36
|
+
margin: 0;
|
|
37
|
+
padding: var(--pd-spacing-xs) 0;
|
|
38
|
+
width: 90px;
|
|
39
|
+
background: var(--pd-year-popup-bg-col, var(--pd-default-bg-col));
|
|
40
|
+
box-shadow: var(--pd-shadow-lg);
|
|
41
|
+
border-radius: var(--pd-radius-lg);
|
|
42
|
+
border: 1px solid
|
|
43
|
+
var(--pd-year-popup-border-col, var(--pd-default-disabled-light-col));
|
|
44
|
+
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
|
|
48
|
+
scrollbar-width: thin;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
ul:focus {
|
|
52
|
+
outline: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
ul:focus-visible {
|
|
56
|
+
outline: 2px solid var(--pd-focus-ring-col);
|
|
57
|
+
outline-offset: 2px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
ul::-webkit-scrollbar {
|
|
61
|
+
width: 6px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
ul::-webkit-scrollbar-thumb {
|
|
65
|
+
background-color: var(--pd-default-disabled-col);
|
|
66
|
+
border-radius: var(--pd-radius-sm);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
li {
|
|
70
|
+
text-align: center;
|
|
71
|
+
padding: var(--pd-spacing-xs) var(--pd-spacing-sm);
|
|
72
|
+
margin: 0 var(--pd-spacing-xs);
|
|
73
|
+
font-size: 0.9em;
|
|
74
|
+
font-family: var(--pd-default-font-content-family);
|
|
75
|
+
border-radius: var(--pd-radius-sm);
|
|
76
|
+
color: var(--pd-default-dark-col);
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
transition:
|
|
79
|
+
background-color 0.15s ease,
|
|
80
|
+
color 0.15s ease;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
li:hover {
|
|
84
|
+
background-color: var(--pd-default-bg-light-col);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
li.focused {
|
|
88
|
+
outline: 2px solid var(--pd-focus-ring-col);
|
|
89
|
+
outline-offset: -2px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
li.current {
|
|
93
|
+
background-color: var(--pd-default-col);
|
|
94
|
+
color: var(--pd-on-primary-col);
|
|
95
|
+
font-weight: 600;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
li.current:hover {
|
|
99
|
+
background-color: var(--pd-default-dark-col);
|
|
100
|
+
}
|
|
101
|
+
`
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
connectedCallback() {
|
|
105
|
+
super.connectedCallback();
|
|
106
|
+
setTimeout(() => {
|
|
107
|
+
document.addEventListener("click", this._boundHandleClickOutside);
|
|
108
|
+
}, 0);
|
|
109
|
+
}
|
|
110
|
+
disconnectedCallback() {
|
|
111
|
+
super.disconnectedCallback();
|
|
112
|
+
document.removeEventListener("click", this._boundHandleClickOutside);
|
|
113
|
+
}
|
|
114
|
+
firstUpdated() {
|
|
115
|
+
const currentIndex = this.yearSelection.indexOf(this.currentYear);
|
|
116
|
+
this._focusedIndex = currentIndex >= 0 ? currentIndex : 0;
|
|
117
|
+
this.updateComplete.then(() => {
|
|
118
|
+
this._listEl?.focus();
|
|
119
|
+
this._scrollToFocused();
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
render() {
|
|
123
|
+
return html`
|
|
124
|
+
<ul
|
|
125
|
+
role="listbox"
|
|
126
|
+
aria-label="Jahr auswählen"
|
|
127
|
+
aria-activedescendant="${this._focusedIndex >= 0 ? `year-option-${this._focusedIndex}` : ""}"
|
|
128
|
+
tabindex="0"
|
|
129
|
+
@keydown=${this._onKeyDown}
|
|
130
|
+
>
|
|
131
|
+
${this.yearSelection.map(
|
|
132
|
+
(year, index) => html`
|
|
133
|
+
<li
|
|
134
|
+
id="year-option-${index}"
|
|
135
|
+
role="option"
|
|
136
|
+
aria-selected="${this.currentYear === year}"
|
|
137
|
+
class="${this._getItemClasses(year, index)}"
|
|
138
|
+
data-year="${year}"
|
|
139
|
+
data-index="${index}"
|
|
140
|
+
@click=${this._yearSelection}
|
|
141
|
+
>
|
|
142
|
+
${year}
|
|
143
|
+
</li>
|
|
144
|
+
`
|
|
145
|
+
)}
|
|
146
|
+
</ul>
|
|
147
|
+
`;
|
|
148
|
+
}
|
|
149
|
+
_getItemClasses(year, index) {
|
|
150
|
+
const classes = [];
|
|
151
|
+
if (this.currentYear === year) {
|
|
152
|
+
classes.push("current");
|
|
153
|
+
}
|
|
154
|
+
if (this._focusedIndex === index) {
|
|
155
|
+
classes.push("focused");
|
|
156
|
+
}
|
|
157
|
+
return classes.join(" ");
|
|
158
|
+
}
|
|
159
|
+
_onKeyDown(e) {
|
|
160
|
+
const lastIndex = this.yearSelection.length - 1;
|
|
161
|
+
switch (e.key) {
|
|
162
|
+
case "ArrowDown":
|
|
163
|
+
e.preventDefault();
|
|
164
|
+
this._focusedIndex = Math.min(this._focusedIndex + 1, lastIndex);
|
|
165
|
+
this._scrollToFocused();
|
|
166
|
+
break;
|
|
167
|
+
case "ArrowUp":
|
|
168
|
+
e.preventDefault();
|
|
169
|
+
this._focusedIndex = Math.max(this._focusedIndex - 1, 0);
|
|
170
|
+
this._scrollToFocused();
|
|
171
|
+
break;
|
|
172
|
+
case "Home":
|
|
173
|
+
e.preventDefault();
|
|
174
|
+
this._focusedIndex = 0;
|
|
175
|
+
this._scrollToFocused();
|
|
176
|
+
break;
|
|
177
|
+
case "End":
|
|
178
|
+
e.preventDefault();
|
|
179
|
+
this._focusedIndex = lastIndex;
|
|
180
|
+
this._scrollToFocused();
|
|
181
|
+
break;
|
|
182
|
+
case "Enter":
|
|
183
|
+
case " ":
|
|
184
|
+
e.preventDefault();
|
|
185
|
+
if (this._focusedIndex >= 0) {
|
|
186
|
+
this._selectYear(this.yearSelection[this._focusedIndex]);
|
|
187
|
+
}
|
|
188
|
+
break;
|
|
189
|
+
case "Escape":
|
|
190
|
+
e.preventDefault();
|
|
191
|
+
e.stopPropagation();
|
|
192
|
+
this._closeSelection();
|
|
193
|
+
break;
|
|
194
|
+
case "Tab":
|
|
195
|
+
this._closeSelection();
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
_scrollToFocused() {
|
|
200
|
+
const focusedEl = this.shadowRoot?.getElementById(
|
|
201
|
+
`year-option-${this._focusedIndex}`
|
|
202
|
+
);
|
|
203
|
+
focusedEl?.scrollIntoView({ block: "nearest" });
|
|
204
|
+
}
|
|
205
|
+
_yearSelection(event) {
|
|
206
|
+
const target = event.currentTarget;
|
|
207
|
+
const year = target.dataset.year;
|
|
208
|
+
if (year) {
|
|
209
|
+
this._selectYear(year);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
_selectYear(year) {
|
|
213
|
+
this.dispatchEvent(
|
|
214
|
+
new CustomEvent("change-year-selection", {
|
|
215
|
+
detail: { year },
|
|
216
|
+
bubbles: true,
|
|
217
|
+
composed: true
|
|
218
|
+
})
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
_closeSelection() {
|
|
222
|
+
this.dispatchEvent(
|
|
223
|
+
new CustomEvent("abort-year-selection", {
|
|
224
|
+
bubbles: true,
|
|
225
|
+
composed: true
|
|
226
|
+
})
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
_handleClickOutside(event) {
|
|
230
|
+
const path = event.composedPath();
|
|
231
|
+
if (!path.includes(this)) {
|
|
232
|
+
this._closeSelection();
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
__decorateClass([
|
|
237
|
+
property({ type: Array })
|
|
238
|
+
], PdYearPopup.prototype, "yearSelection");
|
|
239
|
+
__decorateClass([
|
|
240
|
+
property({ type: String })
|
|
241
|
+
], PdYearPopup.prototype, "currentYear");
|
|
242
|
+
__decorateClass([
|
|
243
|
+
state()
|
|
244
|
+
], PdYearPopup.prototype, "_focusedIndex");
|
|
245
|
+
__decorateClass([
|
|
246
|
+
query("ul")
|
|
247
|
+
], PdYearPopup.prototype, "_listEl");
|
|
248
|
+
|
|
249
|
+
export { PdYearPopup };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pd-year-popup.d.ts","sourceRoot":"","sources":["../../../src/pd-calendar/pd-year-popup/pd-year-popup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAO/C,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/pd-calendar.d.ts
CHANGED
|
@@ -1,48 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* PdCalendar displays monthly view with information (selectable day cell).
|
|
5
|
-
*
|
|
6
|
-
* @fires change-month
|
|
7
|
-
* @fires select-date
|
|
8
|
-
* @fires mouse-enter-date
|
|
9
|
-
* @fires mouse-leave-date
|
|
10
|
-
*/
|
|
11
|
-
export declare class PdCalendar extends LitElement {
|
|
12
|
-
refDate?: Date;
|
|
13
|
-
selectableDates: boolean;
|
|
14
|
-
withYearPopup: string[];
|
|
15
|
-
withWheelNavigation: boolean;
|
|
16
|
-
withTouchNavigation: boolean;
|
|
17
|
-
showSelection: boolean;
|
|
18
|
-
hideWeekend: boolean;
|
|
19
|
-
prevMonthConstraint: number;
|
|
20
|
-
nextMonthConstraint: number;
|
|
21
|
-
data: CalendarData;
|
|
22
|
-
numberClass: string;
|
|
23
|
-
private _viewType;
|
|
24
|
-
private _currentDate;
|
|
25
|
-
private _wheelDelta;
|
|
26
|
-
private _monthName;
|
|
27
|
-
private _year;
|
|
28
|
-
private _numberOfDays;
|
|
29
|
-
private _daysFromPreviousMonth;
|
|
30
|
-
private _currentMonthNavNr;
|
|
31
|
-
static styles: CSSResultGroup;
|
|
32
|
-
connectedCallback(): void;
|
|
33
|
-
update(changedProperties: PropertyValues<this>): void;
|
|
34
|
-
render(): import('lit-html').TemplateResult<1>;
|
|
35
|
-
private renderMonthCalendar;
|
|
36
|
-
private _openYearPopup;
|
|
37
|
-
private _getWeekDays;
|
|
38
|
-
private _nextMonth;
|
|
39
|
-
private _previousMonth;
|
|
40
|
-
private _wheelEvent;
|
|
41
|
-
private _touchStartEvent;
|
|
42
|
-
private _touchEndEvent;
|
|
43
|
-
private _initFromDate;
|
|
44
|
-
private static _getPreviousMonthDays;
|
|
45
|
-
private _checkNextMonthConstraint;
|
|
46
|
-
private _checkPrevMonthConstraint;
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=pd-calendar.d.ts.map
|
|
1
|
+
export * from './pd-calendar/pd-calendar'
|
|
2
|
+
export {}
|