@dxos/react-ui-calendar 0.9.0 → 0.9.1-main.c7dcc2e112

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 (29) hide show
  1. package/dist/lib/browser/index.mjs +582 -107
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +582 -107
  5. package/dist/lib/node-esm/index.mjs.map +4 -4
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/components/Calendar/Calendar.d.ts +25 -35
  8. package/dist/types/src/components/Calendar/Calendar.d.ts.map +1 -1
  9. package/dist/types/src/components/Calendar/Calendar.stories.d.ts +2 -0
  10. package/dist/types/src/components/Calendar/Calendar.stories.d.ts.map +1 -1
  11. package/dist/types/src/components/Calendar/Week.d.ts +30 -0
  12. package/dist/types/src/components/Calendar/Week.d.ts.map +1 -0
  13. package/dist/types/src/components/Calendar/Weekdays.d.ts +18 -0
  14. package/dist/types/src/components/Calendar/Weekdays.d.ts.map +1 -0
  15. package/dist/types/src/components/Calendar/context.d.ts +40 -0
  16. package/dist/types/src/components/Calendar/context.d.ts.map +1 -0
  17. package/dist/types/src/components/Calendar/util.d.ts +36 -0
  18. package/dist/types/src/components/Calendar/util.d.ts.map +1 -1
  19. package/dist/types/src/components/Calendar/util.test.d.ts +2 -0
  20. package/dist/types/src/components/Calendar/util.test.d.ts.map +1 -0
  21. package/dist/types/tsconfig.tsbuildinfo +1 -1
  22. package/package.json +12 -12
  23. package/src/components/Calendar/Calendar.stories.tsx +43 -3
  24. package/src/components/Calendar/Calendar.tsx +117 -96
  25. package/src/components/Calendar/Week.tsx +488 -0
  26. package/src/components/Calendar/Weekdays.tsx +57 -0
  27. package/src/components/Calendar/context.ts +60 -0
  28. package/src/components/Calendar/util.test.ts +90 -0
  29. package/src/components/Calendar/util.ts +92 -1
@@ -1,4 +1,9 @@
1
1
  import { type Day } from 'date-fns';
2
+ /**
3
+ * Fixed origin (row 0, column 0 anchor) for the infinite month grid. All row-index math is relative
4
+ * to this epoch, so any view that reports a row index to the shared context must use the same value.
5
+ */
6
+ export declare const gridEpoch: Date;
2
7
  export declare const getDate: (start: Date, weekNumber: number, dayOfWeek: number, weekStartsOn: Day) => Date;
3
8
  /**
4
9
  * Inverse of {@link getDate}: returns the row index for a given date, matching
@@ -12,4 +17,35 @@ export declare const getDate: (start: Date, weekNumber: number, dayOfWeek: numbe
12
17
  */
13
18
  export declare const getRowIndex: (start: Date, date: Date, weekStartsOn: Day) => number;
14
19
  export declare const isSameDay: (date1: Date, date2: Date | undefined) => boolean;
20
+ export declare const MINUTES_PER_DAY: number;
21
+ /** Default snap granularity for create/move/resize gestures, in minutes. */
22
+ export declare const SNAP_MINUTES = 15;
23
+ /** Minutes elapsed since the start of `date`'s day (0 .. 1439). */
24
+ export declare const minutesOfDay: (date: Date) => number;
25
+ /** Return a new Date on the same calendar day as `date`, at `minutes` past midnight. */
26
+ export declare const setMinutesOfDay: (date: Date, minutes: number) => Date;
27
+ /** Convert a vertical offset (px from the top of the day column) into minutes past midnight. */
28
+ export declare const yToMinutes: (y: number, hourHeight: number) => number;
29
+ /** Convert minutes past midnight into a vertical offset (px from the top of the day column). */
30
+ export declare const minutesToY: (minutes: number, hourHeight: number) => number;
31
+ /** Round `minutes` to the nearest `step`, clamped to a single day. */
32
+ export declare const snapMinutes: (minutes: number, step?: number) => number;
33
+ /**
34
+ * Side-by-side layout slot for an overlapping-event cluster: the event occupies
35
+ * `1 / columnCount` of the day column width, offset by `columnIndex` columns.
36
+ */
37
+ export type EventLayout = {
38
+ columnIndex: number;
39
+ columnCount: number;
40
+ };
41
+ /**
42
+ * Compute side-by-side columns for events within a single day. Events that overlap in
43
+ * time (transitively) form a cluster and split the column width evenly; non-overlapping
44
+ * events each get the full width. Input order is irrelevant; results are keyed by index
45
+ * into `events`.
46
+ */
47
+ export declare const layoutDayEvents: <T extends {
48
+ start: Date;
49
+ end: Date;
50
+ }>(events: T[]) => Map<number, EventLayout>;
15
51
  //# sourceMappingURL=util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../../src/components/Calendar/util.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,GAAG,EAA4B,MAAM,UAAU,CAAC;AAE9D,eAAO,MAAM,OAAO,UAAW,IAAI,cAAc,MAAM,aAAa,MAAM,gBAAgB,GAAG,KAAG,IAM/F,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,UAAW,IAAI,QAAQ,IAAI,gBAAgB,GAAG,KAAG,MAMxE,CAAC;AAEF,eAAO,MAAM,SAAS,UAAW,IAAI,SAAS,IAAI,GAAG,SAAS,KAAG,OAOhE,CAAC"}
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../../src/components/Calendar/util.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,GAAG,EAAwC,MAAM,UAAU,CAAC;AAE1E;;;GAGG;AACH,eAAO,MAAM,SAAS,MAAyB,CAAC;AAEhD,eAAO,MAAM,OAAO,UAAW,IAAI,cAAc,MAAM,aAAa,MAAM,gBAAgB,GAAG,KAAG,IAM/F,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,UAAW,IAAI,QAAQ,IAAI,gBAAgB,GAAG,KAAG,MAMxE,CAAC;AAEF,eAAO,MAAM,SAAS,UAAW,IAAI,SAAS,IAAI,GAAG,SAAS,KAAG,OAOhE,CAAC;AAMF,eAAO,MAAM,eAAe,QAAU,CAAC;AAEvC,4EAA4E;AAC5E,eAAO,MAAM,YAAY,KAAK,CAAC;AAE/B,mEAAmE;AACnE,eAAO,MAAM,YAAY,SAAU,IAAI,KAAG,MAAgE,CAAC;AAE3G,wFAAwF;AACxF,eAAO,MAAM,eAAe,SAAU,IAAI,WAAW,MAAM,KAAG,IACL,CAAC;AAE1D,gGAAgG;AAChG,eAAO,MAAM,UAAU,MAAO,MAAM,cAAc,MAAM,KAAG,MAA+B,CAAC;AAE3F,gGAAgG;AAChG,eAAO,MAAM,UAAU,YAAa,MAAM,cAAc,MAAM,KAAG,MAAqC,CAAC;AAEvG,sEAAsE;AACtE,eAAO,MAAM,WAAW,YAAa,MAAM,SAAQ,MAAM,KAAkB,MAG1E,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvE;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,IAAI,CAAA;CAAE,UAAU,CAAC,EAAE,KAAG,GAAG,CAAC,MAAM,EAAE,WAAW,CA2C1G,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=util.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.test.d.ts","sourceRoot":"","sources":["../../../../../src/components/Calendar/util.test.ts"],"names":[],"mappings":""}