@rokoyfa/calendar 0.1.0 → 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.
Files changed (77) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/README.md +107 -142
  3. package/api/openapi.yaml +10 -2
  4. package/dist-lib/cdn/calendar-widget.js +7 -7
  5. package/dist-lib/cdn/calendar-widget.js.map +1 -1
  6. package/dist-lib/cdn/de-BPZBZXaZ.js +2 -0
  7. package/dist-lib/cdn/de-BPZBZXaZ.js.map +1 -0
  8. package/dist-lib/cdn/es-DsIckdik.js +2 -0
  9. package/dist-lib/cdn/es-DsIckdik.js.map +1 -0
  10. package/dist-lib/cdn/fr-DWAs3O6J.js +2 -0
  11. package/dist-lib/cdn/fr-DWAs3O6J.js.map +1 -0
  12. package/dist-lib/cdn/it-CbhjxqIb.js +2 -0
  13. package/dist-lib/cdn/it-CbhjxqIb.js.map +1 -0
  14. package/dist-lib/cdn/nl-mjTHznX5.js +2 -0
  15. package/dist-lib/cdn/nl-mjTHznX5.js.map +1 -0
  16. package/dist-lib/cdn/pl-CXT0jb2D.js +2 -0
  17. package/dist-lib/cdn/pl-CXT0jb2D.js.map +1 -0
  18. package/dist-lib/cdn/pt-D0oXlVdU.js +2 -0
  19. package/dist-lib/cdn/pt-D0oXlVdU.js.map +1 -0
  20. package/dist-lib/npm/de-CCzGjeTd.js +573 -0
  21. package/dist-lib/npm/de-CCzGjeTd.js.map +1 -0
  22. package/dist-lib/npm/es-Ciaf66rH.js +559 -0
  23. package/dist-lib/npm/es-Ciaf66rH.js.map +1 -0
  24. package/dist-lib/npm/fr-CAqNm10Z.js +559 -0
  25. package/dist-lib/npm/fr-CAqNm10Z.js.map +1 -0
  26. package/dist-lib/npm/index.js +1130 -908
  27. package/dist-lib/npm/index.js.map +1 -1
  28. package/dist-lib/npm/it-Cqqdu2ua.js +565 -0
  29. package/dist-lib/npm/it-Cqqdu2ua.js.map +1 -0
  30. package/dist-lib/npm/nl-CkchSA8q.js +559 -0
  31. package/dist-lib/npm/nl-CkchSA8q.js.map +1 -0
  32. package/dist-lib/npm/pl-CCBDUr8k.js +565 -0
  33. package/dist-lib/npm/pl-CCBDUr8k.js.map +1 -0
  34. package/dist-lib/npm/pt-DucaCaoY.js +566 -0
  35. package/dist-lib/npm/pt-DucaCaoY.js.map +1 -0
  36. package/dist-lib/npm/types/components/DateTimeField.d.ts +2 -1
  37. package/dist-lib/npm/types/components/PageSection.d.ts +2 -1
  38. package/dist-lib/npm/types/config/routes.d.ts +1 -0
  39. package/dist-lib/npm/types/context/HostContext.d.ts +2 -0
  40. package/dist-lib/npm/types/features/calendar/components/DayColumn.d.ts +4 -1
  41. package/dist-lib/npm/types/features/calendar/components/EventChip.d.ts +3 -1
  42. package/dist-lib/npm/types/features/calendar/components/TimeGridView.d.ts +1 -1
  43. package/dist-lib/npm/types/features/calendar/context/DragContext.d.ts +2 -0
  44. package/dist-lib/npm/types/features/calendar/hooks/useEventDrag.d.ts +15 -0
  45. package/dist-lib/npm/types/features/calendar/types/view.d.ts +1 -0
  46. package/dist-lib/npm/types/features/calendar/utils/allDay.d.ts +12 -0
  47. package/dist-lib/npm/types/features/calendar/utils/eventDrag.d.ts +12 -0
  48. package/dist-lib/npm/types/features/calendar/utils/eventLabels.d.ts +1 -0
  49. package/dist-lib/npm/types/features/calendars/components/InvitationList.d.ts +1 -1
  50. package/dist-lib/npm/types/features/calendars/components/settings/RoleOverview.d.ts +1 -0
  51. package/dist-lib/npm/types/features/calendars/index.d.ts +1 -0
  52. package/dist-lib/npm/types/features/events/components/TimeZoneField.d.ts +6 -0
  53. package/dist-lib/npm/types/features/events/index.d.ts +2 -0
  54. package/dist-lib/npm/types/i18n/I18nContext.d.ts +1 -0
  55. package/dist-lib/npm/types/i18n/I18nProvider.d.ts +3 -1
  56. package/dist-lib/npm/types/i18n/index.d.ts +2 -2
  57. package/dist-lib/npm/types/i18n/locale.d.ts +13 -6
  58. package/dist-lib/npm/types/i18n/messages/en/calendars.d.ts +2 -0
  59. package/dist-lib/npm/types/i18n/messages/en/events.d.ts +4 -0
  60. package/dist-lib/npm/types/i18n/messages/en/index.d.ts +8 -6
  61. package/dist-lib/npm/types/i18n/messages/en/settings.d.ts +2 -6
  62. package/dist-lib/npm/types/i18n/messages/es/index.d.ts +2 -0
  63. package/dist-lib/npm/types/i18n/messages/fr/index.d.ts +2 -0
  64. package/dist-lib/npm/types/i18n/messages/index.d.ts +473 -4
  65. package/dist-lib/npm/types/i18n/messages/it/index.d.ts +2 -0
  66. package/dist-lib/npm/types/i18n/messages/nl/index.d.ts +2 -0
  67. package/dist-lib/npm/types/i18n/messages/pl/index.d.ts +2 -0
  68. package/dist-lib/npm/types/i18n/messages/pt/index.d.ts +2 -0
  69. package/dist-lib/npm/types/i18n/messages/types.d.ts +5 -0
  70. package/dist-lib/npm/types/lib/CalendarWidget.d.ts +1 -1
  71. package/dist-lib/npm/types/lib/config.d.ts +3 -0
  72. package/dist-lib/npm/types/lib/element.d.ts +4 -1
  73. package/dist-lib/npm/types/lib/index.d.ts +1 -0
  74. package/dist-lib/npm/types/utils/event.d.ts +19 -7
  75. package/dist-lib/npm/types/utils/preferences.d.ts +1 -2
  76. package/dist-lib/npm/types/utils/timeZone.d.ts +11 -0
  77. package/package.json +11 -5
@@ -11,6 +11,7 @@ export declare const ROUTES: {
11
11
  };
12
12
  export declare const calendarSettingsPath: (calendarId: string) => string;
13
13
  export declare const SETTINGS_CALENDARS_PATH: string;
14
+ export declare const SETTINGS_INVITATIONS_PATH: string;
14
15
  export declare const TOKEN_PARAM = "token";
15
16
  export declare const isSafeRedirect: (path: string | null) => path is string;
16
17
  export declare const getRedirectTarget: (searchParams: URLSearchParams) => string;
@@ -4,6 +4,8 @@ export type HostOptions = {
4
4
  teams: boolean;
5
5
  theme?: HostTheme;
6
6
  initialView?: CalendarView;
7
+ timeZone?: string;
7
8
  };
8
9
  export declare const HostContext: import("react").Context<HostOptions>;
9
10
  export declare const useHost: () => HostOptions;
11
+ export declare const useViewerTimeZone: () => string;
@@ -1,18 +1,21 @@
1
1
  import type { EventOccurrence } from '../../../utils/event.js';
2
2
  import type { EventSegment } from '../types/eventLayout.js';
3
+ import type { AllDaySegment } from '../utils/allDay.js';
3
4
  type DayColumnProps = {
4
5
  date: string;
5
6
  isToday: boolean;
6
7
  nowMinutes: number | null;
7
8
  segments: readonly EventSegment[];
9
+ allDaySegments: readonly AllDaySegment[];
8
10
  selection?: {
9
11
  fromHour: number;
10
12
  toHour: number;
11
13
  label: string | null;
12
14
  } | null;
13
15
  onSlotSelect: (date: string, hour: number) => void;
16
+ onAllDaySelect: (date: string) => void;
14
17
  onEventSelect: (event: EventOccurrence) => void;
15
18
  onHeaderSelect?: (date: string) => void;
16
19
  };
17
- export declare function DayColumn({ date, isToday, nowMinutes, segments, selection, onSlotSelect, onEventSelect, onHeaderSelect, }: DayColumnProps): import("react").JSX.Element;
20
+ export declare function DayColumn({ date, isToday, nowMinutes, segments, allDaySegments, selection, onSlotSelect, onAllDaySelect, onEventSelect, onHeaderSelect, }: DayColumnProps): import("react").JSX.Element;
18
21
  export {};
@@ -2,7 +2,9 @@ import type { EventOccurrence } from '../../../utils/event.js';
2
2
  import type { EventSegment } from '../types/eventLayout.js';
3
3
  type EventChipProps = {
4
4
  segment: EventSegment;
5
+ row?: number;
6
+ isContinuation?: boolean;
5
7
  onSelect: (event: EventOccurrence) => void;
6
8
  };
7
- export declare function EventChip({ segment, onSelect }: EventChipProps): import("react").JSX.Element;
9
+ export declare function EventChip({ segment, row, isContinuation, onSelect }: EventChipProps): import("react").JSX.Element;
8
10
  export {};
@@ -1,2 +1,2 @@
1
1
  import type { CalendarViewProps } from '../types/view.js';
2
- export declare function TimeGridView({ dates, today, currentMinutes, segmentsByDate, canCreate, onCreate, onCreateRange, onEventSelect, onShowDay, }: CalendarViewProps): import("react").JSX.Element;
2
+ export declare function TimeGridView({ dates, today, currentMinutes, segmentsByDate, canCreate, onCreate, onCreateRange, onCreateAllDay, onEventSelect, onShowDay, }: CalendarViewProps): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export declare const DraggingEventContext: import("react").Context<string | null>;
2
+ export declare const useIsDragging: (occurrenceKey: string) => boolean;
@@ -0,0 +1,15 @@
1
+ import { type RefObject } from 'react';
2
+ import type { EventOccurrence, EventPeriod } from '../../../utils/event.js';
3
+ export type DragPreview = {
4
+ occurrenceKey: string;
5
+ period: EventPeriod;
6
+ };
7
+ type UseEventDragOptions = {
8
+ containerRef: RefObject<HTMLElement | null>;
9
+ enabled: boolean;
10
+ occurrences: ReadonlyMap<string, EventOccurrence>;
11
+ onPreview: (preview: DragPreview | null) => void;
12
+ onDrop: (occurrence: EventOccurrence, period: EventPeriod) => void;
13
+ };
14
+ export declare function useEventDrag({ containerRef, enabled, occurrences, onPreview, onDrop }: UseEventDragOptions): void;
15
+ export {};
@@ -19,6 +19,7 @@ export type CalendarViewProps = {
19
19
  segmentsByDate: ReadonlyMap<string, readonly EventSegment[]>;
20
20
  onCreate: (date: string, hour: number) => void;
21
21
  onCreateRange: (range: SlotRange) => void;
22
+ onCreateAllDay: (date: string) => void;
22
23
  canCreate: boolean;
23
24
  onEventSelect: (event: EventOccurrence) => void;
24
25
  onShowDay: (date: string) => void;
@@ -0,0 +1,12 @@
1
+ import type { EventSegment } from '../types/eventLayout.js';
2
+ export type AllDaySegment = {
3
+ segment: EventSegment;
4
+ row: number;
5
+ isFirst: boolean;
6
+ };
7
+ export type AllDayLanes = {
8
+ allDay: ReadonlyMap<string, readonly AllDaySegment[]>;
9
+ timed: ReadonlyMap<string, readonly EventSegment[]>;
10
+ rows: number;
11
+ };
12
+ export declare function splitAllDay(dates: readonly string[], segmentsByDate: ReadonlyMap<string, readonly EventSegment[]>): AllDayLanes;
@@ -0,0 +1,12 @@
1
+ import { type EditScope, type EventInput, type EventOccurrence, type EventPeriod } from '../../../utils/event.js';
2
+ export type DragMode = 'move' | 'resize';
3
+ export type DragUnit = 'minutes' | 'days';
4
+ export type DragPoint = {
5
+ date: string;
6
+ minutes: number;
7
+ };
8
+ export declare const DRAG_STEP_MINUTES = 15;
9
+ export declare const getDragDelta: (unit: DragUnit, from: DragPoint, to: DragPoint) => number;
10
+ export declare const applyDragDelta: (period: EventPeriod, mode: DragMode, delta: number) => EventPeriod;
11
+ export declare const isSamePeriod: (a: EventPeriod, b: EventPeriod) => boolean;
12
+ export declare const toDropInput: (occurrence: EventOccurrence, viewerPeriod: EventPeriod, viewerTimeZone: string, scope: EditScope) => EventInput;
@@ -9,6 +9,7 @@ export declare const getSourceText: (source: EventSource, { m }: LabelI18n) => s
9
9
  export declare const getEventTooltip: (event: EventOccurrence, source: EventSource | undefined, i18n: LabelI18n) => string;
10
10
  export declare const getSegmentAttributes: ({ event, continuesBefore, continuesAfter }: EventSegment, source: EventSource | undefined, i18n: LabelI18n, ...classNamesToMerge: ClassNameValue[]) => {
11
11
  title: string;
12
+ 'data-occurrence-key': string;
12
13
  className?: string;
13
14
  style?: import("react").CSSProperties;
14
15
  };
@@ -1 +1 @@
1
- export declare function InvitationList(): import("react").JSX.Element | null;
1
+ export declare function InvitationList(): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function RoleOverview(): import("react").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  export { CalendarsProvider } from './context/CalendarsProvider.js';
2
2
  export { useCalendars } from './hooks/useCalendars.js';
3
3
  export { CalendarSettings } from './components/CalendarSettings.js';
4
+ export { InvitationList } from './components/InvitationList.js';
4
5
  export { CalendarSettingsPage } from './components/settings/CalendarSettingsPage.js';
5
6
  export { CreateCalendarPage } from './components/create/CreateCalendarPage.js';
6
7
  export { CalendarSwitcher } from './components/CalendarSwitcher.js';
@@ -0,0 +1,6 @@
1
+ type TimeZoneFieldProps = {
2
+ value: string | null;
3
+ onChange: (timeZone: string | null) => void;
4
+ };
5
+ export declare function TimeZoneField({ value, onChange }: TimeZoneFieldProps): import("react").JSX.Element;
6
+ export {};
@@ -1,5 +1,7 @@
1
1
  export { useEvents } from './hooks/useEvents.js';
2
2
  export { EventModal } from './components/EventModal.js';
3
3
  export { DeleteEventModal } from './components/DeleteEventModal.js';
4
+ export { RecurrenceScopeModal } from './components/RecurrenceScopeModal.js';
5
+ export { getScopeOptions } from './utils/scopeOptions.js';
4
6
  export { CustomColorSettings } from './components/CustomColorSettings.js';
5
7
  export { ColorPicker } from './components/ColorPicker.js';
@@ -5,6 +5,7 @@ import type { WeekInfo } from './weekInfo.js';
5
5
  export type I18n = {
6
6
  locale: string;
7
7
  language: Language;
8
+ languages: ReadonlySet<string>;
8
9
  m: Messages;
9
10
  format: Formatter;
10
11
  weekInfo: WeekInfo;
@@ -1,7 +1,9 @@
1
1
  import { type ReactNode } from 'react';
2
+ import { type MessageOverrides } from './messages/index.js';
2
3
  type I18nProviderProps = {
3
4
  locale?: string;
5
+ messages?: MessageOverrides;
4
6
  children: ReactNode;
5
7
  };
6
- export declare function I18nProvider({ locale: hostLocale, children }: I18nProviderProps): import("react").JSX.Element;
8
+ export declare function I18nProvider({ locale: hostLocale, messages: overrides, children }: I18nProviderProps): import("react").JSX.Element | null;
7
9
  export {};
@@ -2,7 +2,7 @@ export { getErrorMessage } from './errorMessage.js';
2
2
  export type { Formatter } from './format.js';
3
3
  export type { I18n } from './I18nContext.js';
4
4
  export { I18nProvider } from './I18nProvider.js';
5
- export { LOCALE_CHOICES, type LocaleChoice } from './locale.js';
6
- export type { Messages } from './messages/index.js';
5
+ export { getLocaleChoices, getLocaleName } from './locale.js';
6
+ export type { DeepPartial, MessageOverrides, Messages, PartialMessages } from './messages/index.js';
7
7
  export { useI18n } from './useI18n.js';
8
8
  export { useLocaleGetter } from './useLocaleGetter.js';
@@ -1,14 +1,21 @@
1
- export declare const SUPPORTED_LANGUAGES: readonly ["en", "de"];
2
- export type Language = (typeof SUPPORTED_LANGUAGES)[number];
1
+ export declare const BUILT_IN_LANGUAGES: readonly ["en", "de", "fr", "es", "it", "nl", "pl", "pt"];
2
+ export type BuiltInLanguage = (typeof BUILT_IN_LANGUAGES)[number];
3
+ export type Language = string;
4
+ export declare const DEFAULT_LANGUAGE: BuiltInLanguage;
3
5
  export declare const DEFAULT_LOCALE = "en-US";
4
- export declare const LOCALE_CHOICES: readonly ["auto", "en-US", "en-GB", "de-DE"];
5
- export type LocaleChoice = (typeof LOCALE_CHOICES)[number];
6
- export declare const getLanguage: (locale: string) => Language;
6
+ export declare const AUTO_LOCALE = "auto";
7
+ export declare const BUILT_IN_LOCALES: readonly ["en-US", "en-GB", "de-DE", "fr-FR", "es-ES", "it-IT", "nl-NL", "pl-PL", "pt-BR", "pt-PT"];
8
+ export declare const isBuiltInLanguage: (language: string) => language is BuiltInLanguage;
9
+ export declare const canonicalizeLocale: (tag: unknown) => string | null;
10
+ export declare const getLanguage: (locale: string, languages?: ReadonlySet<string>) => Language;
7
11
  type LocaleSources = {
8
12
  user?: string | null;
9
13
  host?: string | null;
10
14
  browser?: readonly string[];
15
+ languages?: ReadonlySet<string>;
11
16
  };
12
- export declare function resolveLocale({ user, host, browser }: LocaleSources): string;
17
+ export declare function resolveLocale({ user, host, browser, languages }: LocaleSources): string;
18
+ export declare const getLocaleChoices: (extraLanguages?: Iterable<string>) => string[];
19
+ export declare const getLocaleName: (locale: string) => string;
13
20
  export declare const getBrowserLanguages: () => readonly string[];
14
21
  export {};
@@ -18,6 +18,7 @@ export declare const calendars: {
18
18
  contributor: string;
19
19
  viewer: string;
20
20
  };
21
+ roleOverview: string;
21
22
  roleHint: (role: string, description: string) => string;
22
23
  kind: {
23
24
  personal: string;
@@ -43,6 +44,7 @@ export declare const calendars: {
43
44
  invitations: {
44
45
  title: string;
45
46
  description: string;
47
+ empty: string;
46
48
  invitedBy: (name: string) => string;
47
49
  invited: string;
48
50
  validUntil: (date: string) => string;
@@ -6,6 +6,10 @@ export declare const events: {
6
6
  startTime: string;
7
7
  endDate: string;
8
8
  endTime: string;
9
+ allDay: string;
10
+ timeZone: string;
11
+ floatingTimeZone: string;
12
+ inYourTimeZone: (period: string) => string;
9
13
  description: string;
10
14
  color: string;
11
15
  addCustomColor: string;
@@ -125,6 +125,10 @@ export declare const en: {
125
125
  startTime: string;
126
126
  endDate: string;
127
127
  endTime: string;
128
+ allDay: string;
129
+ timeZone: string;
130
+ floatingTimeZone: string;
131
+ inYourTimeZone: (period: string) => string;
128
132
  description: string;
129
133
  color: string;
130
134
  addCustomColor: string;
@@ -170,18 +174,14 @@ export declare const en: {
170
174
  tabsLabel: string;
171
175
  tabs: {
172
176
  calendars: string;
177
+ invitations: string;
173
178
  appearance: string;
174
179
  account: string;
175
180
  };
176
181
  languageTitle: string;
177
182
  languageDescription: string;
178
183
  languageLabel: string;
179
- languages: {
180
- auto: string;
181
- 'en-US': string;
182
- 'en-GB': string;
183
- 'de-DE': string;
184
- };
184
+ languageAuto: string;
185
185
  themeTitle: string;
186
186
  themeLabel: string;
187
187
  startViewTitle: string;
@@ -306,6 +306,7 @@ export declare const en: {
306
306
  contributor: string;
307
307
  viewer: string;
308
308
  };
309
+ roleOverview: string;
309
310
  roleHint: (role: string, description: string) => string;
310
311
  kind: {
311
312
  personal: string;
@@ -331,6 +332,7 @@ export declare const en: {
331
332
  invitations: {
332
333
  title: string;
333
334
  description: string;
335
+ empty: string;
334
336
  invitedBy: (name: string) => string;
335
337
  invited: string;
336
338
  validUntil: (date: string) => string;
@@ -2,18 +2,14 @@ export declare const settings: {
2
2
  tabsLabel: string;
3
3
  tabs: {
4
4
  calendars: string;
5
+ invitations: string;
5
6
  appearance: string;
6
7
  account: string;
7
8
  };
8
9
  languageTitle: string;
9
10
  languageDescription: string;
10
11
  languageLabel: string;
11
- languages: {
12
- auto: string;
13
- 'en-US': string;
14
- 'en-GB': string;
15
- 'de-DE': string;
16
- };
12
+ languageAuto: string;
17
13
  themeTitle: string;
18
14
  themeLabel: string;
19
15
  startViewTitle: string;
@@ -0,0 +1,2 @@
1
+ import type { Messages } from '../types.js';
2
+ export declare const es: Messages;
@@ -0,0 +1,2 @@
1
+ import type { Messages } from '../types.js';
2
+ export declare const fr: Messages;