@oicl/openbridge-webcomponents 0.0.20260410061657 → 0.0.20260410085854
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/dist/components/calendar/calendar-utils.d.ts +26 -0
- package/dist/components/calendar/calendar-utils.d.ts.map +1 -0
- package/dist/components/calendar/calendar-utils.js +96 -0
- package/dist/components/calendar/calendar-utils.js.map +1 -0
- package/dist/components/calendar/calendar.css.js +228 -0
- package/dist/components/calendar/calendar.css.js.map +1 -0
- package/dist/components/calendar/calendar.d.ts +107 -0
- package/dist/components/calendar/calendar.d.ts.map +1 -0
- package/dist/components/calendar/calendar.js +409 -0
- package/dist/components/calendar/calendar.js.map +1 -0
- package/dist/components/date-item/date-item.css.js +74 -50
- package/dist/components/date-item/date-item.css.js.map +1 -1
- package/dist/components/date-item/date-item.d.ts +4 -10
- package/dist/components/date-item/date-item.d.ts.map +1 -1
- package/dist/components/date-item/date-item.js +25 -40
- package/dist/components/date-item/date-item.js.map +1 -1
- package/dist/components/dropdown-button/dropdown-button.css.js +68 -0
- package/dist/components/dropdown-button/dropdown-button.css.js.map +1 -1
- package/dist/components/dropdown-button/dropdown-button.d.ts +1 -0
- package/dist/components/dropdown-button/dropdown-button.d.ts.map +1 -1
- package/dist/components/dropdown-button/dropdown-button.js +5 -0
- package/dist/components/dropdown-button/dropdown-button.js.map +1 -1
- package/dist/components/event-item/event-item.css.js +3 -3
- package/dist/components/event-list/event-list.css.js +11 -21
- package/dist/components/event-list/event-list.css.js.map +1 -1
- package/dist/components/event-list/event-list.d.ts +1 -1
- package/dist/components/event-list/event-list.d.ts.map +1 -1
- package/dist/components/event-list/event-list.js +3 -7
- package/dist/components/event-list/event-list.js.map +1 -1
- package/dist/components/navigation-item/navigation-item.d.ts +2 -0
- package/dist/components/navigation-item/navigation-item.d.ts.map +1 -1
- package/dist/components/navigation-item/navigation-item.js +5 -0
- package/dist/components/navigation-item/navigation-item.js.map +1 -1
- package/dist/components/scrollbar/scrollbar.css.js +47 -2
- package/dist/components/scrollbar/scrollbar.css.js.map +1 -1
- package/dist/components/scrollbar/scrollbar.d.ts +7 -0
- package/dist/components/scrollbar/scrollbar.d.ts.map +1 -1
- package/dist/components/scrollbar/scrollbar.js +84 -15
- package/dist/components/scrollbar/scrollbar.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DateItemEvent, EventItemType } from '../event-item/event-item.js';
|
|
2
|
+
export type { DateItemEvent };
|
|
3
|
+
export { EventItemType };
|
|
4
|
+
export declare enum CalendarType {
|
|
5
|
+
Small = "small",
|
|
6
|
+
Regular = "regular",
|
|
7
|
+
Large = "large",
|
|
8
|
+
XLarge = "xlarge"
|
|
9
|
+
}
|
|
10
|
+
export interface CalendarEvent extends DateItemEvent {
|
|
11
|
+
date: Date;
|
|
12
|
+
}
|
|
13
|
+
export interface DateCellInfo {
|
|
14
|
+
date: Date;
|
|
15
|
+
dayNumber: number;
|
|
16
|
+
isCurrentMonth: boolean;
|
|
17
|
+
isToday: boolean;
|
|
18
|
+
events: DateItemEvent[];
|
|
19
|
+
}
|
|
20
|
+
export declare function isSameDay(a: Date, b: Date): boolean;
|
|
21
|
+
export declare function toDateKey(date: Date): string;
|
|
22
|
+
export declare function groupEventsByDate(events: CalendarEvent[]): Map<string, CalendarEvent[]>;
|
|
23
|
+
export declare function getMonthYearLabel(date: Date, locale?: string): string;
|
|
24
|
+
export declare function getWeekdayNames(locale?: string, firstDayOfWeek?: number): string[];
|
|
25
|
+
export declare function getMonthGrid(year: number, month: number, firstDayOfWeek?: number, events?: CalendarEvent[], today?: Date): DateCellInfo[][];
|
|
26
|
+
//# sourceMappingURL=calendar-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-utils.d.ts","sourceRoot":"","sources":["../../../src/components/calendar/calendar-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAEzE,YAAY,EAAC,aAAa,EAAC,CAAC;AAC5B,OAAO,EAAC,aAAa,EAAC,CAAC;AAEvB,oBAAY,YAAY;IACtB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED,MAAM,WAAW,aAAc,SAAQ,aAAa;IAClD,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,aAAa,EAAE,CAAC;CACzB;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,OAAO,CAMnD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAK5C;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,aAAa,EAAE,GACtB,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,CAAC,CAe9B;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAKrE;AAED,wBAAgB,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,cAAc,SAAI,GAAG,MAAM,EAAE,CAe7E;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,cAAc,SAAI,EAClB,MAAM,CAAC,EAAE,aAAa,EAAE,EACxB,KAAK,CAAC,EAAE,IAAI,GACX,YAAY,EAAE,EAAE,CAoClB"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { EventItemType } from "../event-item/event-item.js";
|
|
2
|
+
var CalendarType = /* @__PURE__ */ ((CalendarType2) => {
|
|
3
|
+
CalendarType2["Small"] = "small";
|
|
4
|
+
CalendarType2["Regular"] = "regular";
|
|
5
|
+
CalendarType2["Large"] = "large";
|
|
6
|
+
CalendarType2["XLarge"] = "xlarge";
|
|
7
|
+
return CalendarType2;
|
|
8
|
+
})(CalendarType || {});
|
|
9
|
+
function isSameDay(a, b) {
|
|
10
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
11
|
+
}
|
|
12
|
+
function toDateKey(date) {
|
|
13
|
+
const y = date.getFullYear();
|
|
14
|
+
const m = String(date.getMonth() + 1).padStart(2, "0");
|
|
15
|
+
const d = String(date.getDate()).padStart(2, "0");
|
|
16
|
+
return `${y}-${m}-${d}`;
|
|
17
|
+
}
|
|
18
|
+
function groupEventsByDate(events) {
|
|
19
|
+
const map = /* @__PURE__ */ new Map();
|
|
20
|
+
for (const event of events) {
|
|
21
|
+
const key = toDateKey(event.date);
|
|
22
|
+
let group = map.get(key);
|
|
23
|
+
if (!group) {
|
|
24
|
+
group = [];
|
|
25
|
+
map.set(key, group);
|
|
26
|
+
}
|
|
27
|
+
group.push(event);
|
|
28
|
+
}
|
|
29
|
+
map.forEach((group) => {
|
|
30
|
+
group.sort((a, b) => a.startTime.localeCompare(b.startTime));
|
|
31
|
+
});
|
|
32
|
+
return map;
|
|
33
|
+
}
|
|
34
|
+
function getMonthYearLabel(date, locale) {
|
|
35
|
+
return new Intl.DateTimeFormat(locale, {
|
|
36
|
+
month: "long",
|
|
37
|
+
year: "numeric"
|
|
38
|
+
}).format(date);
|
|
39
|
+
}
|
|
40
|
+
function getWeekdayNames(locale, firstDayOfWeek = 1) {
|
|
41
|
+
const baseDate = new Date(2024, 0, 7);
|
|
42
|
+
const formatter = new Intl.DateTimeFormat(locale, { weekday: "short" });
|
|
43
|
+
const names = [];
|
|
44
|
+
for (let i = 0; i < 7; i++) {
|
|
45
|
+
const d = new Date(baseDate);
|
|
46
|
+
d.setDate(baseDate.getDate() + i);
|
|
47
|
+
const formatted = formatter.format(d);
|
|
48
|
+
names.push(formatted.slice(0, 2));
|
|
49
|
+
}
|
|
50
|
+
const rotated = [
|
|
51
|
+
...names.slice(firstDayOfWeek),
|
|
52
|
+
...names.slice(0, firstDayOfWeek)
|
|
53
|
+
];
|
|
54
|
+
return rotated;
|
|
55
|
+
}
|
|
56
|
+
function getMonthGrid(year, month, firstDayOfWeek = 1, events, today) {
|
|
57
|
+
const actualToday = today ?? /* @__PURE__ */ new Date();
|
|
58
|
+
const eventMap = events ? groupEventsByDate(events) : /* @__PURE__ */ new Map();
|
|
59
|
+
const firstOfMonth = new Date(year, month, 1);
|
|
60
|
+
const rawDay = firstOfMonth.getDay();
|
|
61
|
+
const offset = (rawDay - firstDayOfWeek + 7) % 7;
|
|
62
|
+
const startDate = new Date(year, month, 1 - offset);
|
|
63
|
+
const grid = [];
|
|
64
|
+
for (let row = 0; row < 6; row++) {
|
|
65
|
+
const week = [];
|
|
66
|
+
for (let col = 0; col < 7; col++) {
|
|
67
|
+
const cellDate = new Date(
|
|
68
|
+
startDate.getFullYear(),
|
|
69
|
+
startDate.getMonth(),
|
|
70
|
+
startDate.getDate() + row * 7 + col
|
|
71
|
+
);
|
|
72
|
+
const key = toDateKey(cellDate);
|
|
73
|
+
const matchedEvents = eventMap.get(key) ?? [];
|
|
74
|
+
week.push({
|
|
75
|
+
date: cellDate,
|
|
76
|
+
dayNumber: cellDate.getDate(),
|
|
77
|
+
isCurrentMonth: cellDate.getMonth() === month && cellDate.getFullYear() === year,
|
|
78
|
+
isToday: isSameDay(cellDate, actualToday),
|
|
79
|
+
events: matchedEvents
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
grid.push(week);
|
|
83
|
+
}
|
|
84
|
+
return grid;
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
CalendarType,
|
|
88
|
+
EventItemType,
|
|
89
|
+
getMonthGrid,
|
|
90
|
+
getMonthYearLabel,
|
|
91
|
+
getWeekdayNames,
|
|
92
|
+
groupEventsByDate,
|
|
93
|
+
isSameDay,
|
|
94
|
+
toDateKey
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=calendar-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-utils.js","sources":["../../../src/components/calendar/calendar-utils.ts"],"sourcesContent":["import {DateItemEvent, EventItemType} from '../event-item/event-item.js';\n\nexport type {DateItemEvent};\nexport {EventItemType};\n\nexport enum CalendarType {\n Small = 'small',\n Regular = 'regular',\n Large = 'large',\n XLarge = 'xlarge',\n}\n\nexport interface CalendarEvent extends DateItemEvent {\n date: Date;\n}\n\nexport interface DateCellInfo {\n date: Date;\n dayNumber: number;\n isCurrentMonth: boolean;\n isToday: boolean;\n events: DateItemEvent[];\n}\n\nexport function isSameDay(a: Date, b: Date): boolean {\n return (\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate()\n );\n}\n\nexport function toDateKey(date: Date): string {\n const y = date.getFullYear();\n const m = String(date.getMonth() + 1).padStart(2, '0');\n const d = String(date.getDate()).padStart(2, '0');\n return `${y}-${m}-${d}`;\n}\n\nexport function groupEventsByDate(\n events: CalendarEvent[]\n): Map<string, CalendarEvent[]> {\n const map = new Map<string, CalendarEvent[]>();\n for (const event of events) {\n const key = toDateKey(event.date);\n let group = map.get(key);\n if (!group) {\n group = [];\n map.set(key, group);\n }\n group.push(event);\n }\n map.forEach((group) => {\n group.sort((a, b) => a.startTime.localeCompare(b.startTime));\n });\n return map;\n}\n\nexport function getMonthYearLabel(date: Date, locale?: string): string {\n return new Intl.DateTimeFormat(locale, {\n month: 'long',\n year: 'numeric',\n }).format(date);\n}\n\nexport function getWeekdayNames(locale?: string, firstDayOfWeek = 1): string[] {\n const baseDate = new Date(2024, 0, 7); // Sunday 2024-01-07\n const formatter = new Intl.DateTimeFormat(locale, {weekday: 'short'});\n const names: string[] = [];\n for (let i = 0; i < 7; i++) {\n const d = new Date(baseDate);\n d.setDate(baseDate.getDate() + i);\n const formatted = formatter.format(d);\n names.push(formatted.slice(0, 2));\n }\n const rotated = [\n ...names.slice(firstDayOfWeek),\n ...names.slice(0, firstDayOfWeek),\n ];\n return rotated;\n}\n\nexport function getMonthGrid(\n year: number,\n month: number,\n firstDayOfWeek = 1,\n events?: CalendarEvent[],\n today?: Date\n): DateCellInfo[][] {\n const actualToday = today ?? new Date();\n const eventMap = events\n ? groupEventsByDate(events)\n : new Map<string, CalendarEvent[]>();\n\n const firstOfMonth = new Date(year, month, 1);\n const rawDay = firstOfMonth.getDay();\n const offset = (rawDay - firstDayOfWeek + 7) % 7;\n\n const startDate = new Date(year, month, 1 - offset);\n\n const grid: DateCellInfo[][] = [];\n for (let row = 0; row < 6; row++) {\n const week: DateCellInfo[] = [];\n for (let col = 0; col < 7; col++) {\n const cellDate = new Date(\n startDate.getFullYear(),\n startDate.getMonth(),\n startDate.getDate() + row * 7 + col\n );\n const key = toDateKey(cellDate);\n const matchedEvents = eventMap.get(key) ?? [];\n week.push({\n date: cellDate,\n dayNumber: cellDate.getDate(),\n isCurrentMonth:\n cellDate.getMonth() === month && cellDate.getFullYear() === year,\n isToday: isSameDay(cellDate, actualToday),\n events: matchedEvents,\n });\n }\n grid.push(week);\n }\n\n return grid;\n}\n"],"names":["CalendarType"],"mappings":"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"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
const componentStyle = css`
|
|
3
|
+
* {
|
|
4
|
+
-webkit-tap-highlight-color: transparent;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
:host {
|
|
8
|
+
display: block;
|
|
9
|
+
height: 100%;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.wrapper {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
height: 100%;
|
|
16
|
+
background: var(--container-global-color);
|
|
17
|
+
overflow: clip;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.wrapper.type-small,.wrapper.type-regular,.wrapper.type-large {
|
|
21
|
+
border-radius: var(
|
|
22
|
+
--menu-navigation-components-calendar-border-radius,
|
|
23
|
+
12px
|
|
24
|
+
);
|
|
25
|
+
box-shadow: var(--shadow-floating);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.title-container {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
padding-left: 8px;
|
|
32
|
+
flex-shrink: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.type-xlarge .title-container {
|
|
36
|
+
padding-left: var(--app-components-system-menu-margin-horizontal, 16px);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.navigation-container {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
flex-shrink: 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.xlarge-label {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
gap: 8px;
|
|
49
|
+
flex: 1 1 0;
|
|
50
|
+
min-width: 0;
|
|
51
|
+
font-family: var(--font-family-main);
|
|
52
|
+
font-weight: var(--global-typography-ui-body-font-weight);
|
|
53
|
+
font-size: var(--global-typography-ui-body-font-size);
|
|
54
|
+
line-height: var(--global-typography-ui-body-line-height);
|
|
55
|
+
font-feature-settings:
|
|
56
|
+
"liga" off,
|
|
57
|
+
"clig" off,
|
|
58
|
+
"ss04" on;
|
|
59
|
+
color: var(--on-container-active-color);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.month-label {
|
|
63
|
+
white-space: nowrap;
|
|
64
|
+
overflow: hidden;
|
|
65
|
+
text-overflow: ellipsis;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.content-container {
|
|
69
|
+
display: flex;
|
|
70
|
+
border-top: 1px solid var(--border-divider-color);
|
|
71
|
+
flex: 1 1 0;
|
|
72
|
+
min-height: 0;
|
|
73
|
+
overflow: clip;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.type-small .content-container,.type-regular .content-container {
|
|
77
|
+
flex-direction: column;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.type-large .content-container,.type-xlarge .content-container {
|
|
81
|
+
flex-direction: row;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.calendar-container {
|
|
85
|
+
background: var(--container-background-color);
|
|
86
|
+
padding: var(--menu-navigation-components-calendar-margin-vertical, 16px)
|
|
87
|
+
var(--menu-navigation-components-calendar-margin-horizontal, 16px);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.type-small .calendar-container,.type-regular .calendar-container,.type-large .calendar-container {
|
|
91
|
+
flex-shrink: 0;
|
|
92
|
+
display: grid;
|
|
93
|
+
grid-template-columns: repeat(7, minmax(0, 1fr));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.type-xlarge .calendar-container {
|
|
97
|
+
flex: 1 1 0;
|
|
98
|
+
min-width: 0;
|
|
99
|
+
min-height: 0;
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-direction: column;
|
|
102
|
+
box-sizing: border-box;
|
|
103
|
+
overflow: hidden;
|
|
104
|
+
padding-left: var(--app-components-system-menu-margin-horizontal, 16px);
|
|
105
|
+
padding-right: var(--app-components-system-menu-margin-horizontal, 16px);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.days-container {
|
|
109
|
+
font-family: var(--font-family-main);
|
|
110
|
+
font-weight: var(--font-weight-semibold);
|
|
111
|
+
font-size: var(--global-typography-ui-overline-font-size);
|
|
112
|
+
line-height: var(--global-typography-ui-overline-line-height);
|
|
113
|
+
letter-spacing: var(--global-typography-ui-overline-letter-spacing);
|
|
114
|
+
font-feature-settings:
|
|
115
|
+
"liga" off,
|
|
116
|
+
"clig" off,
|
|
117
|
+
"ss04" on;
|
|
118
|
+
color: var(--element-inactive-color);
|
|
119
|
+
text-align: center;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.type-small .days-container,.type-regular .days-container,.type-large .days-container {
|
|
123
|
+
display: contents;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.type-xlarge .days-container {
|
|
127
|
+
display: flex;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.day-label {
|
|
131
|
+
height: 24px;
|
|
132
|
+
display: flex;
|
|
133
|
+
align-items: center;
|
|
134
|
+
justify-content: center;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.type-xlarge .day-label {
|
|
138
|
+
flex: 1 0 0;
|
|
139
|
+
min-width: 0;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.type-small .grid-container,.type-regular .grid-container,.type-large .grid-container {
|
|
143
|
+
display: contents;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.type-xlarge .grid-container {
|
|
147
|
+
flex: 1 1 0;
|
|
148
|
+
min-height: 0;
|
|
149
|
+
display: grid;
|
|
150
|
+
grid-template-columns: repeat(7, minmax(0, 1fr));
|
|
151
|
+
grid-template-rows: repeat(6, minmax(0, 1fr));
|
|
152
|
+
gap: 1px;
|
|
153
|
+
background-color: var(--border-outline-color);
|
|
154
|
+
border: 1px solid var(--border-outline-color);
|
|
155
|
+
border-radius: 6px;
|
|
156
|
+
overflow: clip;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.type-small .grid-row,.type-regular .grid-row,.type-large .grid-row {
|
|
160
|
+
display: contents;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.type-xlarge .grid-row {
|
|
164
|
+
display: contents;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.type-xlarge .grid-container obc-date-item {
|
|
168
|
+
--normal-enabled-border-color: transparent;
|
|
169
|
+
--normal-disabled-border-color: transparent;
|
|
170
|
+
--normal-hover-border-color: transparent;
|
|
171
|
+
--normal-pressed-border-color: transparent;
|
|
172
|
+
--normal-disabled-background-color: var(--container-background-color);
|
|
173
|
+
height: 100%;
|
|
174
|
+
width: 100%;
|
|
175
|
+
overflow: clip;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.type-xlarge .grid-container .grid-row:first-child obc-date-item:first-child {
|
|
179
|
+
--_obc-date-item-border-top-left-radius: 5px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.type-xlarge .grid-container .grid-row:first-child obc-date-item:last-child {
|
|
183
|
+
--_obc-date-item-border-top-right-radius: 5px;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.type-xlarge .grid-container .grid-row:last-child obc-date-item:first-child {
|
|
187
|
+
--_obc-date-item-border-bottom-left-radius: 5px;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.type-xlarge .grid-container .grid-row:last-child obc-date-item:last-child {
|
|
191
|
+
--_obc-date-item-border-bottom-right-radius: 5px;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.event-panel {
|
|
195
|
+
flex: 1 1 0;
|
|
196
|
+
min-height: 0;
|
|
197
|
+
min-width: 0;
|
|
198
|
+
overflow: hidden;
|
|
199
|
+
display: flex;
|
|
200
|
+
flex-direction: column;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.type-small .event-panel,.type-regular .event-panel {
|
|
204
|
+
border-top: 1px solid var(--border-divider-color);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.type-large .event-panel,.type-xlarge .event-panel {
|
|
208
|
+
border-left: 1px solid var(--border-divider-color);
|
|
209
|
+
width: var(--menu-navigation-components-calendar-event-width, 420px);
|
|
210
|
+
flex: none;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.event-panel obc-scrollbar {
|
|
214
|
+
flex: 1 1 0;
|
|
215
|
+
min-height: 0;
|
|
216
|
+
width: 100%;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.footer-container {
|
|
220
|
+
border-top: 1px solid var(--border-divider-color);
|
|
221
|
+
padding: var(--menu-navigation-components-calendar-padding-horizontal, 4px);
|
|
222
|
+
flex-shrink: 0;
|
|
223
|
+
}
|
|
224
|
+
`;
|
|
225
|
+
export {
|
|
226
|
+
componentStyle as default
|
|
227
|
+
};
|
|
228
|
+
//# sourceMappingURL=calendar.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
import { CalendarType, CalendarEvent } from './calendar-utils.js';
|
|
3
|
+
import '../date-item/date-item.js';
|
|
4
|
+
import '../event-list/event-list.js';
|
|
5
|
+
import '../button/button.js';
|
|
6
|
+
import '../icon-button/icon-button.js';
|
|
7
|
+
import '../dropdown-button/dropdown-button.js';
|
|
8
|
+
import '../divider/divider.js';
|
|
9
|
+
import '../scrollbar/scrollbar.js';
|
|
10
|
+
import '../navigation-item/navigation-item.js';
|
|
11
|
+
import '../../icons/icon-calendar-google.js';
|
|
12
|
+
import '../../icons/icon-chevron-left-google.js';
|
|
13
|
+
import '../../icons/icon-chevron-right-google.js';
|
|
14
|
+
import '../../icons/icon-up-iec.js';
|
|
15
|
+
import '../../icons/icon-calendar-date-google.js';
|
|
16
|
+
import '../../icons/icon-application-open-google.js';
|
|
17
|
+
export { CalendarType, type CalendarEvent, type DateCellInfo, } from './calendar-utils.js';
|
|
18
|
+
/**
|
|
19
|
+
* `<obc-calendar>` – A composite calendar component for date selection and event browsing.
|
|
20
|
+
*
|
|
21
|
+
* **Synonyms:** calendar widget, date picker, schedule view, planner, agenda calendar
|
|
22
|
+
*
|
|
23
|
+
* Displays a month-view date grid with selectable dates, event indicators, and an optional
|
|
24
|
+
* scrollable event panel. Supports four size variants that adapt header layout, grid density,
|
|
25
|
+
* and event panel placement to fit different viewport sizes and use cases.
|
|
26
|
+
*
|
|
27
|
+
* ## Features / Variants
|
|
28
|
+
*
|
|
29
|
+
* - **Small:** Single-week strip with compact cells. Ideal for inline or dropdown use.
|
|
30
|
+
* - **Regular:** Full month grid stacked above the event list. The standard calendar layout.
|
|
31
|
+
* - **Large:** Side-by-side month grid (left) and event panel (right). Adds a "New event" button.
|
|
32
|
+
* - **XLarge:** Full-page layout with `large` date cells showing inline events. No floating chrome
|
|
33
|
+
* or footer. Raised "New event" button and a static month/year label replace the dropdown.
|
|
34
|
+
* - **Month navigation:** Previous/next chevron buttons and a "Today" shortcut.
|
|
35
|
+
* - **Date selection:** Clicking a date highlights it, auto-navigates if out-of-month, and
|
|
36
|
+
* dispatches `date-select`.
|
|
37
|
+
* - **Event panel:** Chronologically sorted event lists starting from the selected date, rendered
|
|
38
|
+
* inside a scrollable area. Controlled via `hasEventList`.
|
|
39
|
+
* - **Footer:** Optional navigation link row, always hidden in `xlarge` or via `hasFooter = false`.
|
|
40
|
+
* - **Locale-aware:** Weekday labels, month names, and formatting respect the `locale` property.
|
|
41
|
+
* - **Configurable week start:** `firstDayOfWeek` (0 = Sunday, 1 = Monday default).
|
|
42
|
+
*
|
|
43
|
+
* ## Usage Guidelines
|
|
44
|
+
*
|
|
45
|
+
* Use `regular` for dropdown/popover calendars, `small` for inline date strips, `large` for
|
|
46
|
+
* side panels with room for events, and `xlarge` for dedicated full-page calendar views. Provide
|
|
47
|
+
* events as a flat `CalendarEvent[]` array; the component groups and distributes them into the
|
|
48
|
+
* grid and event panel automatically.
|
|
49
|
+
*
|
|
50
|
+
* ## Example
|
|
51
|
+
*
|
|
52
|
+
* ```html
|
|
53
|
+
* <obc-calendar
|
|
54
|
+
* type="large"
|
|
55
|
+
* .date=${new Date(2026, 0, 15)}
|
|
56
|
+
* .selectedDate=${new Date(2026, 0, 15)}
|
|
57
|
+
* .events=${myEvents}
|
|
58
|
+
* hasEventList
|
|
59
|
+
* @date-select=${(e) => console.log('Selected:', e.detail.date)}
|
|
60
|
+
* ></obc-calendar>
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @fires {CustomEvent<{date: Date}>} month-change - Fired when the displayed month changes via navigation.
|
|
64
|
+
* @fires {CustomEvent<{date: Date, events: CalendarEvent[]}>} date-select - Fired when a date cell is clicked.
|
|
65
|
+
* @fires {CustomEvent<void>} today-click - Fired when the "Today" button is clicked.
|
|
66
|
+
* @fires {CustomEvent<void>} new-event-click - Fired when the "+ New event" button is clicked (Large/XLarge only).
|
|
67
|
+
* @fires {CustomEvent<void>} calendar-click - Fired when the footer "Calendar" navigation link is clicked.
|
|
68
|
+
*/
|
|
69
|
+
export declare class ObcCalendar extends LitElement {
|
|
70
|
+
type: CalendarType;
|
|
71
|
+
date: Date;
|
|
72
|
+
selectedDate: Date | null;
|
|
73
|
+
events: CalendarEvent[];
|
|
74
|
+
hasEventList: boolean;
|
|
75
|
+
hasFooter: boolean;
|
|
76
|
+
locale?: string;
|
|
77
|
+
firstDayOfWeek: number;
|
|
78
|
+
footerLabel: string;
|
|
79
|
+
footerHref?: string;
|
|
80
|
+
private _displayMonth;
|
|
81
|
+
willUpdate(changed: PropertyValues): void;
|
|
82
|
+
private _getEventsForDate;
|
|
83
|
+
private get _monthOptions();
|
|
84
|
+
private get _monthValue();
|
|
85
|
+
private _navigateDay;
|
|
86
|
+
private _handlePrevDay;
|
|
87
|
+
private _handleNextDay;
|
|
88
|
+
private _handleTodayClick;
|
|
89
|
+
private _handleNewEventClick;
|
|
90
|
+
private _handleDateClick;
|
|
91
|
+
private _handleMonthDropdownChange;
|
|
92
|
+
private _handleCalendarClick;
|
|
93
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
94
|
+
private _renderHeader;
|
|
95
|
+
private _renderNavigation;
|
|
96
|
+
private _renderContent;
|
|
97
|
+
private _renderCalendarGrid;
|
|
98
|
+
private _renderEventPanel;
|
|
99
|
+
private _renderFooter;
|
|
100
|
+
static styles: import('lit').CSSResult;
|
|
101
|
+
}
|
|
102
|
+
declare global {
|
|
103
|
+
interface HTMLElementTagNameMap {
|
|
104
|
+
'obc-calendar': ObcCalendar;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=calendar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../src/components/calendar/calendar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAA4B,KAAK,cAAc,EAAC,MAAM,KAAK,CAAC;AAM9E,OAAO,EACL,YAAY,EACZ,KAAK,aAAa,EAQnB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,2BAA2B,CAAC;AACnC,OAAO,6BAA6B,CAAC;AACrC,OAAO,qBAAqB,CAAC;AAC7B,OAAO,+BAA+B,CAAC;AACvC,OAAO,uCAAuC,CAAC;AAC/C,OAAO,uBAAuB,CAAC;AAC/B,OAAO,2BAA2B,CAAC;AACnC,OAAO,uCAAuC,CAAC;AAC/C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,yCAAyC,CAAC;AACjD,OAAO,0CAA0C,CAAC;AAClD,OAAO,4BAA4B,CAAC;AACpC,OAAO,0CAA0C,CAAC;AAClD,OAAO,6CAA6C,CAAC;AAErD,OAAO,EACL,YAAY,EACZ,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,qBACa,WAAY,SAAQ,UAAU;IACf,IAAI,eAAwB;IACxB,IAAI,EAAE,IAAI,CAAc;IACxB,YAAY,EAAE,IAAI,GAAG,IAAI,CAAQ;IACjC,MAAM,EAAE,aAAa,EAAE,CAAM;IACd,YAAY,UAAQ;IACpB,SAAS,UAAQ;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,SAAK;IACnB,WAAW,SAAc;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IAErC,OAAO,CAAC,aAAa,CAAoB;IAEzC,UAAU,CAAC,OAAO,EAAE,cAAc;IAoB3C,OAAO,CAAC,iBAAiB;IAIzB,OAAO,KAAK,aAAa,GAcxB;IAED,OAAO,KAAK,WAAW,GAEtB;IAED,OAAO,CAAC,YAAY;IA8BpB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,gBAAgB;IAkBxB,OAAO,CAAC,0BAA0B;IAalC,OAAO,CAAC,oBAAoB;IAMnB,MAAM;IAqBf,OAAO,CAAC,aAAa;IAqDrB,OAAO,CAAC,iBAAiB;IA0BzB,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,mBAAmB;IAqD3B,OAAO,CAAC,iBAAiB;IAoCzB,OAAO,CAAC,aAAa;IAmBrB,OAAgB,MAAM,0BAA6B;CACpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
|