calendarkit-prov2 2.0.6 → 2.0.8

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/README.md CHANGED
@@ -318,6 +318,7 @@ const sidebarMenus: SidebarMenuItem[] = [
318
318
  - [Documentation](https://react-calendarkit-prov2.vercel.app/)
319
319
  - [GitHub Repository](https://github.com/Sayzera/calendarkit-prov2)
320
320
  - [npm Package](https://www.npmjs.com/package/calendarkit-prov2)
321
+ - [Publishing to npm](PUBLISHING.md)
321
322
  - [Issues](https://github.com/Sayzera/calendarkit-prov2/issues)
322
323
 
323
324
  ---
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[];
@@ -239,6 +264,11 @@ interface CalendarProps {
239
264
  isDarkMode?: boolean;
240
265
  onThemeToggle?: () => void;
241
266
  hideViewSwitcher?: boolean;
267
+ /**
268
+ * When true, hides the mobile floating action button (FAB) used to create events.
269
+ * Defaults to false (FAB is shown on viewports under 768px when not read-only).
270
+ */
271
+ hideFab?: boolean;
242
272
  /**
243
273
  * Hour (0–23) the Day and Week views initially scroll to on mount.
244
274
  * Defaults to 8 (08:00 AM).
@@ -319,10 +349,30 @@ interface CalendarProps {
319
349
  customViews?: CustomView[];
320
350
  }
321
351
 
352
+ /** Icon node for each built-in badge id. */
353
+ declare const EVENT_BADGE_ICONS: Record<BuiltInEventBadgeId, React.ReactNode>;
354
+ /** Type guard for backend string → BuiltInEventBadgeId. */
355
+ declare function isBuiltInEventBadgeId(id: string): id is BuiltInEventBadgeId;
356
+ /**
357
+ * Build a localized EventBadge for a built-in id.
358
+ * Optional `name` overrides the localized default label.
359
+ */
360
+ declare function getEventBadge(id: BuiltInEventBadgeId, language?: LanguageCode, name?: string): EventBadge;
361
+ /**
362
+ * Resolve the display badge for an event.
363
+ * Priority: explicit `badge` object → `badgeId` from the backend.
364
+ */
365
+ declare function resolveEventBadge(event: Pick<CalendarEvent, 'badge' | 'badgeId'>, language?: LanguageCode): EventBadge | undefined;
366
+ /**
367
+ * Ready-made badges with Turkish labels (package default language).
368
+ * Prefer `badgeId` + `resolveEventBadge` when data comes from an API.
369
+ */
370
+ declare const EVENT_BADGES: Record<BuiltInEventBadgeId, EventBadge>;
371
+
322
372
  declare function cn(...inputs: ClassValue[]): string;
323
373
 
324
374
  declare const Scheduler: React.FC<CalendarProps>;
325
375
  /** Primary export — backward-compatible alias for v1 `@calendarkit/react` consumers. */
326
376
  declare const ProScheduler: React.FC<CalendarProps>;
327
377
 
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 };
378
+ 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[];
@@ -239,6 +264,11 @@ interface CalendarProps {
239
264
  isDarkMode?: boolean;
240
265
  onThemeToggle?: () => void;
241
266
  hideViewSwitcher?: boolean;
267
+ /**
268
+ * When true, hides the mobile floating action button (FAB) used to create events.
269
+ * Defaults to false (FAB is shown on viewports under 768px when not read-only).
270
+ */
271
+ hideFab?: boolean;
242
272
  /**
243
273
  * Hour (0–23) the Day and Week views initially scroll to on mount.
244
274
  * Defaults to 8 (08:00 AM).
@@ -319,10 +349,30 @@ interface CalendarProps {
319
349
  customViews?: CustomView[];
320
350
  }
321
351
 
352
+ /** Icon node for each built-in badge id. */
353
+ declare const EVENT_BADGE_ICONS: Record<BuiltInEventBadgeId, React.ReactNode>;
354
+ /** Type guard for backend string → BuiltInEventBadgeId. */
355
+ declare function isBuiltInEventBadgeId(id: string): id is BuiltInEventBadgeId;
356
+ /**
357
+ * Build a localized EventBadge for a built-in id.
358
+ * Optional `name` overrides the localized default label.
359
+ */
360
+ declare function getEventBadge(id: BuiltInEventBadgeId, language?: LanguageCode, name?: string): EventBadge;
361
+ /**
362
+ * Resolve the display badge for an event.
363
+ * Priority: explicit `badge` object → `badgeId` from the backend.
364
+ */
365
+ declare function resolveEventBadge(event: Pick<CalendarEvent, 'badge' | 'badgeId'>, language?: LanguageCode): EventBadge | undefined;
366
+ /**
367
+ * Ready-made badges with Turkish labels (package default language).
368
+ * Prefer `badgeId` + `resolveEventBadge` when data comes from an API.
369
+ */
370
+ declare const EVENT_BADGES: Record<BuiltInEventBadgeId, EventBadge>;
371
+
322
372
  declare function cn(...inputs: ClassValue[]): string;
323
373
 
324
374
  declare const Scheduler: React.FC<CalendarProps>;
325
375
  /** Primary export — backward-compatible alias for v1 `@calendarkit/react` consumers. */
326
376
  declare const ProScheduler: React.FC<CalendarProps>;
327
377
 
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 };
378
+ 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 };