calendarkit-prov2 2.0.5 → 2.0.7

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 CHANGED
@@ -1,6 +1,7 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Sayzera
3
+ Copyright (c) 2026 Sayzera (https://github.com/Sayzera)
4
+ Portions Copyright (c) 2025 CalendarKit (original project)
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -324,4 +324,7 @@ const sidebarMenus: SidebarMenuItem[] = [
324
324
 
325
325
  ## License
326
326
 
327
- MIT — see [LICENSE](LICENSE). Copyright (c) 2026 [Sayzera](https://github.com/Sayzera).
327
+ MIT — see [LICENSE](LICENSE).
328
+
329
+ Copyright (c) 2026 [Sayzera](https://github.com/Sayzera)
330
+ Portions Copyright (c) 2025 CalendarKit (original project, forked and extended)
package/dist/index.d.mts CHANGED
@@ -62,6 +62,21 @@ interface EventReminder {
62
62
  time: number;
63
63
  label?: string;
64
64
  }
65
+ /**
66
+ * Optional badge rendered on timed event cards (e.g. Week view).
67
+ * Shown in the top-left corner when both icon and name are provided.
68
+ */
69
+ interface EventBadge {
70
+ /** Icon node (e.g. Lucide icon or any JSX). */
71
+ icon: React.ReactNode;
72
+ /** Short label displayed next to the icon. */
73
+ name: string;
74
+ }
75
+ /**
76
+ * Built-in badge identifiers for common lesson / session types.
77
+ * Prefer sending `badgeId` from the backend (JSON-safe) over a full `badge` object.
78
+ */
79
+ type BuiltInEventBadgeId = 'privateLesson' | 'groupLesson' | 'packageLesson' | 'online' | 'inPerson' | 'homeVisit' | 'trial' | 'makeup' | 'exam' | 'workshop' | 'priority' | 'holiday' | 'cancelled' | 'listening';
65
80
  interface CalendarEvent {
66
81
  id: string;
67
82
  title: string;
@@ -74,6 +89,16 @@ interface CalendarEvent {
74
89
  resourceId?: string;
75
90
  type?: string;
76
91
  icon?: string;
92
+ /**
93
+ * Optional corner badge (icon + name) for timed event cards.
94
+ * Prefer `badgeId` when data comes from a JSON API — icons cannot travel over the wire.
95
+ */
96
+ badge?: EventBadge;
97
+ /**
98
+ * Built-in badge key from the backend (e.g. "packageLesson").
99
+ * Resolved to icon + label on the client via `getEventBadge` / `resolveEventBadge`.
100
+ */
101
+ badgeId?: BuiltInEventBadgeId;
77
102
  attachments?: EventAttachment[];
78
103
  guests?: string[];
79
104
  reminders?: EventReminder[];
@@ -319,10 +344,30 @@ interface CalendarProps {
319
344
  customViews?: CustomView[];
320
345
  }
321
346
 
347
+ /** Icon node for each built-in badge id. */
348
+ declare const EVENT_BADGE_ICONS: Record<BuiltInEventBadgeId, React.ReactNode>;
349
+ /** Type guard for backend string → BuiltInEventBadgeId. */
350
+ declare function isBuiltInEventBadgeId(id: string): id is BuiltInEventBadgeId;
351
+ /**
352
+ * Build a localized EventBadge for a built-in id.
353
+ * Optional `name` overrides the localized default label.
354
+ */
355
+ declare function getEventBadge(id: BuiltInEventBadgeId, language?: LanguageCode, name?: string): EventBadge;
356
+ /**
357
+ * Resolve the display badge for an event.
358
+ * Priority: explicit `badge` object → `badgeId` from the backend.
359
+ */
360
+ declare function resolveEventBadge(event: Pick<CalendarEvent, 'badge' | 'badgeId'>, language?: LanguageCode): EventBadge | undefined;
361
+ /**
362
+ * Ready-made badges with Turkish labels (package default language).
363
+ * Prefer `badgeId` + `resolveEventBadge` when data comes from an API.
364
+ */
365
+ declare const EVENT_BADGES: Record<BuiltInEventBadgeId, EventBadge>;
366
+
322
367
  declare function cn(...inputs: ClassValue[]): string;
323
368
 
324
369
  declare const Scheduler: React.FC<CalendarProps>;
325
370
  /** Primary export — backward-compatible alias for v1 `@calendarkit/react` consumers. */
326
371
  declare const ProScheduler: React.FC<CalendarProps>;
327
372
 
328
- export { type CalendarEvent, type CalendarProps, type CalendarTheme, type CalendarTranslations, type CustomView, DATE_FNS_LOCALES, type EventAttachment, type EventReminder, type EventType, LANGUAGE_META, LOCALES, type LanguageCode, ProScheduler, type CalendarProps as ProSchedulerProps, type Resource, Scheduler, type SidebarMenuItem, type ThemeColors, type ViewType, cn, getTranslations };
373
+ export { type BuiltInEventBadgeId, type CalendarEvent, type CalendarProps, type CalendarTheme, type CalendarTranslations, type CustomView, DATE_FNS_LOCALES, EVENT_BADGES, EVENT_BADGE_ICONS, type EventAttachment, type EventBadge, type EventReminder, type EventType, LANGUAGE_META, LOCALES, type LanguageCode, ProScheduler, type CalendarProps as ProSchedulerProps, type Resource, Scheduler, type SidebarMenuItem, type ThemeColors, type ViewType, cn, getEventBadge, getTranslations, isBuiltInEventBadgeId, resolveEventBadge };
package/dist/index.d.ts CHANGED
@@ -62,6 +62,21 @@ interface EventReminder {
62
62
  time: number;
63
63
  label?: string;
64
64
  }
65
+ /**
66
+ * Optional badge rendered on timed event cards (e.g. Week view).
67
+ * Shown in the top-left corner when both icon and name are provided.
68
+ */
69
+ interface EventBadge {
70
+ /** Icon node (e.g. Lucide icon or any JSX). */
71
+ icon: React.ReactNode;
72
+ /** Short label displayed next to the icon. */
73
+ name: string;
74
+ }
75
+ /**
76
+ * Built-in badge identifiers for common lesson / session types.
77
+ * Prefer sending `badgeId` from the backend (JSON-safe) over a full `badge` object.
78
+ */
79
+ type BuiltInEventBadgeId = 'privateLesson' | 'groupLesson' | 'packageLesson' | 'online' | 'inPerson' | 'homeVisit' | 'trial' | 'makeup' | 'exam' | 'workshop' | 'priority' | 'holiday' | 'cancelled' | 'listening';
65
80
  interface CalendarEvent {
66
81
  id: string;
67
82
  title: string;
@@ -74,6 +89,16 @@ interface CalendarEvent {
74
89
  resourceId?: string;
75
90
  type?: string;
76
91
  icon?: string;
92
+ /**
93
+ * Optional corner badge (icon + name) for timed event cards.
94
+ * Prefer `badgeId` when data comes from a JSON API — icons cannot travel over the wire.
95
+ */
96
+ badge?: EventBadge;
97
+ /**
98
+ * Built-in badge key from the backend (e.g. "packageLesson").
99
+ * Resolved to icon + label on the client via `getEventBadge` / `resolveEventBadge`.
100
+ */
101
+ badgeId?: BuiltInEventBadgeId;
77
102
  attachments?: EventAttachment[];
78
103
  guests?: string[];
79
104
  reminders?: EventReminder[];
@@ -319,10 +344,30 @@ interface CalendarProps {
319
344
  customViews?: CustomView[];
320
345
  }
321
346
 
347
+ /** Icon node for each built-in badge id. */
348
+ declare const EVENT_BADGE_ICONS: Record<BuiltInEventBadgeId, React.ReactNode>;
349
+ /** Type guard for backend string → BuiltInEventBadgeId. */
350
+ declare function isBuiltInEventBadgeId(id: string): id is BuiltInEventBadgeId;
351
+ /**
352
+ * Build a localized EventBadge for a built-in id.
353
+ * Optional `name` overrides the localized default label.
354
+ */
355
+ declare function getEventBadge(id: BuiltInEventBadgeId, language?: LanguageCode, name?: string): EventBadge;
356
+ /**
357
+ * Resolve the display badge for an event.
358
+ * Priority: explicit `badge` object → `badgeId` from the backend.
359
+ */
360
+ declare function resolveEventBadge(event: Pick<CalendarEvent, 'badge' | 'badgeId'>, language?: LanguageCode): EventBadge | undefined;
361
+ /**
362
+ * Ready-made badges with Turkish labels (package default language).
363
+ * Prefer `badgeId` + `resolveEventBadge` when data comes from an API.
364
+ */
365
+ declare const EVENT_BADGES: Record<BuiltInEventBadgeId, EventBadge>;
366
+
322
367
  declare function cn(...inputs: ClassValue[]): string;
323
368
 
324
369
  declare const Scheduler: React.FC<CalendarProps>;
325
370
  /** Primary export — backward-compatible alias for v1 `@calendarkit/react` consumers. */
326
371
  declare const ProScheduler: React.FC<CalendarProps>;
327
372
 
328
- export { type CalendarEvent, type CalendarProps, type CalendarTheme, type CalendarTranslations, type CustomView, DATE_FNS_LOCALES, type EventAttachment, type EventReminder, type EventType, LANGUAGE_META, LOCALES, type LanguageCode, ProScheduler, type CalendarProps as ProSchedulerProps, type Resource, Scheduler, type SidebarMenuItem, type ThemeColors, type ViewType, cn, getTranslations };
373
+ export { type BuiltInEventBadgeId, type CalendarEvent, type CalendarProps, type CalendarTheme, type CalendarTranslations, type CustomView, DATE_FNS_LOCALES, EVENT_BADGES, EVENT_BADGE_ICONS, type EventAttachment, type EventBadge, type EventReminder, type EventType, LANGUAGE_META, LOCALES, type LanguageCode, ProScheduler, type CalendarProps as ProSchedulerProps, type Resource, Scheduler, type SidebarMenuItem, type ThemeColors, type ViewType, cn, getEventBadge, getTranslations, isBuiltInEventBadgeId, resolveEventBadge };