react-timelane 0.0.4 → 0.0.6

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 (139) hide show
  1. package/.storybook/main.ts +11 -0
  2. package/.storybook/package.json +3 -0
  3. package/.storybook/preview.ts +14 -0
  4. package/LICENSE +21 -0
  5. package/README.md +5 -16
  6. package/dist/components/Timelane/Timelane.d.ts +38 -0
  7. package/dist/components/Timelane/Timelane.stories.d.ts +19 -0
  8. package/dist/components/TimelaneAllocation/TimelaneAllocation.d.ts +10 -0
  9. package/dist/components/{TimelaneAside.d.ts → TimelaneAside/TimelaneAside.d.ts} +2 -3
  10. package/dist/components/{TimelaneBackground.d.ts → TimelaneBackground/TimelaneBackground.d.ts} +1 -2
  11. package/dist/components/{TimelaneBody.d.ts → TimelaneBody/TimelaneBody.d.ts} +1 -2
  12. package/dist/components/{TimelaneBodyInner.d.ts → TimelaneBody/TimelaneBodyInner.d.ts} +1 -1
  13. package/dist/components/TimelaneHeader/DaysHeader.d.ts +1 -2
  14. package/dist/components/TimelaneHeader/MonthsHeader.d.ts +1 -2
  15. package/dist/components/TimelaneHeader/TimelaneHeader.d.ts +1 -2
  16. package/dist/components/TimelaneHeader/WeeksHeader.d.ts +1 -2
  17. package/dist/components/TimelaneHeader/index.d.ts +4 -4
  18. package/dist/components/TimelaneLane/TimelaneLane.d.ts +1 -2
  19. package/dist/components/TimelaneLane/TimelaneLane.stories.d.ts +9 -0
  20. package/dist/components/{TimelaneSettingsContext.d.ts → TimelaneSettingsProvider/TimelaneSettingsContext.d.ts} +1 -1
  21. package/dist/components/TimelaneSettingsProvider/TimelaneSettingsProvider.d.ts +11 -0
  22. package/dist/components/TimelaneSettingsProvider/TimelaneSettingsProvider.stories.d.ts +9 -0
  23. package/dist/hooks/useTimelaneContext.d.ts +1 -1
  24. package/dist/index.d.ts +7 -7
  25. package/dist/react-timelane.css +1 -1
  26. package/dist/react-timelane.js +3465 -3406
  27. package/dist/stories/FullExamplePage/FullExamplePage.d.ts +4 -0
  28. package/dist/stories/FullExamplePage/FullExamplePage.stories.d.ts +19 -0
  29. package/dist/stories/FullExamplePage/MyTimelane.d.ts +20 -0
  30. package/dist/stories/constants.d.ts +7 -0
  31. package/dist/stories/hooks/useLocalStorage.d.ts +2 -0
  32. package/dist/stories/models/Allocation.d.ts +11 -0
  33. package/dist/stories/models/AllocationId.d.ts +1 -0
  34. package/dist/stories/models/Resource.d.ts +7 -0
  35. package/dist/stories/models/ResourceId.d.ts +1 -0
  36. package/dist/types/EnableResizing.d.ts +6 -0
  37. package/dist/types/Pixels.d.ts +1 -1
  38. package/dist/types/TimelaneSettings.d.ts +4 -1
  39. package/dist/types/index.d.ts +1 -0
  40. package/eslint.config.js +21 -21
  41. package/package.json +11 -2
  42. package/storybook-static/addon-visual-tests-assets/visual-test-illustration.mp4 +0 -0
  43. package/storybook-static/assets/Color-AVL7NMMY-B90CyoR2.js +1 -0
  44. package/storybook-static/assets/DocsRenderer-PQXLIZUC-Bq83urOe.js +2 -0
  45. package/storybook-static/assets/FullExamplePage-DfmTY2HY.css +1 -0
  46. package/storybook-static/assets/FullExamplePage.stories-2F7rFo1o.js +18 -0
  47. package/storybook-static/assets/Timelane-Dz9QoO0k.css +1 -0
  48. package/storybook-static/assets/Timelane-S9mAxniK.js +177 -0
  49. package/storybook-static/assets/Timelane.stories-eJTFFqOc.js +15 -0
  50. package/storybook-static/assets/TimelaneLane.stories-D-gkVkkl.js +37 -0
  51. package/storybook-static/assets/TimelaneSettingsProvider.stories-Ca_yRNCX.js +28 -0
  52. package/storybook-static/assets/blocks-Cs-T3qmo.js +658 -0
  53. package/storybook-static/assets/iframe-CoOaxin5.js +1124 -0
  54. package/storybook-static/assets/index-BFqcmZp8.js +9 -0
  55. package/storybook-static/assets/index-CKqcs_aQ.js +9 -0
  56. package/storybook-static/assets/index-Dn1Kba0m.js +1 -0
  57. package/storybook-static/assets/react-18-CSTqcdyU.js +25 -0
  58. package/storybook-static/components/Timelane/Timelane.d.ts +38 -0
  59. package/storybook-static/components/Timelane/Timelane.stories.d.ts +19 -0
  60. package/storybook-static/components/TimelaneAllocation/TimelaneAllocation.d.ts +10 -0
  61. package/storybook-static/components/TimelaneAside/TimelaneAside.d.ts +12 -0
  62. package/storybook-static/components/TimelaneBackground/TimelaneBackground.d.ts +4 -0
  63. package/storybook-static/components/TimelaneBody/TimelaneBody.d.ts +5 -0
  64. package/storybook-static/components/TimelaneBody/TimelaneBodyInner.d.ts +16 -0
  65. package/storybook-static/components/TimelaneBody/TimelaneSelectionLayer.d.ts +6 -0
  66. package/storybook-static/components/TimelaneHeader/DaysHeader.d.ts +14 -0
  67. package/storybook-static/components/TimelaneHeader/MonthsHeader.d.ts +14 -0
  68. package/storybook-static/components/TimelaneHeader/TimelaneHeader.d.ts +23 -0
  69. package/storybook-static/components/TimelaneHeader/WeeksHeader.d.ts +14 -0
  70. package/storybook-static/components/TimelaneHeader/index.d.ts +5 -0
  71. package/storybook-static/components/TimelaneHeader/renderingUtils.d.ts +4 -0
  72. package/storybook-static/components/TimelaneItem/DragResizeComponent.d.ts +20 -0
  73. package/storybook-static/components/TimelaneItem/TimelaneItem.d.ts +14 -0
  74. package/storybook-static/components/TimelaneLane/AvailableSpaceIndicator.d.ts +21 -0
  75. package/storybook-static/components/TimelaneLane/DropPreview.d.ts +9 -0
  76. package/storybook-static/components/TimelaneLane/DropTarget.d.ts +11 -0
  77. package/storybook-static/components/TimelaneLane/OverlapIndicator.d.ts +6 -0
  78. package/storybook-static/components/TimelaneLane/TimelaneLane.d.ts +15 -0
  79. package/storybook-static/components/TimelaneLane/TimelaneLane.stories.d.ts +9 -0
  80. package/storybook-static/components/TimelaneLayout/TimelaneLayout.d.ts +23 -0
  81. package/storybook-static/components/TimelaneSettingsProvider/TimelaneSettingsContext.d.ts +7 -0
  82. package/storybook-static/components/TimelaneSettingsProvider/TimelaneSettingsProvider.d.ts +11 -0
  83. package/storybook-static/components/TimelaneSettingsProvider/TimelaneSettingsProvider.stories.d.ts +9 -0
  84. package/storybook-static/components/utils.d.ts +27 -0
  85. package/storybook-static/favicon.svg +1 -0
  86. package/storybook-static/hooks/useScroll.d.ts +10 -0
  87. package/storybook-static/hooks/useTimelaneContext.d.ts +1 -0
  88. package/storybook-static/iframe.html +685 -0
  89. package/storybook-static/index.d.ts +12 -0
  90. package/storybook-static/index.html +152 -0
  91. package/storybook-static/index.json +1 -0
  92. package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
  93. package/storybook-static/nunito-sans-bold.woff2 +0 -0
  94. package/storybook-static/nunito-sans-italic.woff2 +0 -0
  95. package/storybook-static/nunito-sans-regular.woff2 +0 -0
  96. package/storybook-static/project.json +1 -0
  97. package/storybook-static/sb-addons/chromatic-com-storybook-1/manager-bundle.js +356 -0
  98. package/storybook-static/sb-addons/chromatic-com-storybook-1/manager-bundle.js.LEGAL.txt +40 -0
  99. package/storybook-static/sb-addons/docs-2/manager-bundle.js +151 -0
  100. package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +188 -0
  101. package/storybook-static/sb-common-assets/favicon.svg +1 -0
  102. package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
  103. package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
  104. package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
  105. package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
  106. package/storybook-static/sb-manager/globals-module-info.js +797 -0
  107. package/storybook-static/sb-manager/globals-runtime.js +72136 -0
  108. package/storybook-static/sb-manager/globals.js +34 -0
  109. package/storybook-static/sb-manager/runtime.js +13002 -0
  110. package/storybook-static/stories/FullExamplePage/FullExamplePage.d.ts +4 -0
  111. package/storybook-static/stories/FullExamplePage/FullExamplePage.stories.d.ts +19 -0
  112. package/storybook-static/stories/FullExamplePage/MyTimelane.d.ts +20 -0
  113. package/storybook-static/stories/constants.d.ts +7 -0
  114. package/storybook-static/stories/hooks/useLocalStorage.d.ts +2 -0
  115. package/storybook-static/stories/models/Allocation.d.ts +11 -0
  116. package/storybook-static/stories/models/AllocationId.d.ts +1 -0
  117. package/storybook-static/stories/models/Resource.d.ts +7 -0
  118. package/storybook-static/stories/models/ResourceId.d.ts +1 -0
  119. package/storybook-static/types/AvailableSpace.d.ts +6 -0
  120. package/storybook-static/types/DateBounds.d.ts +4 -0
  121. package/storybook-static/types/Dimensions.d.ts +4 -0
  122. package/storybook-static/types/EnableResizing.d.ts +6 -0
  123. package/storybook-static/types/GrabInfo.d.ts +5 -0
  124. package/storybook-static/types/Grid.d.ts +6 -0
  125. package/storybook-static/types/Item.d.ts +12 -0
  126. package/storybook-static/types/ItemId.d.ts +1 -0
  127. package/storybook-static/types/Lane.d.ts +5 -0
  128. package/storybook-static/types/LaneId.d.ts +1 -0
  129. package/storybook-static/types/OffsetBounds.d.ts +4 -0
  130. package/storybook-static/types/Pixels.d.ts +4 -0
  131. package/storybook-static/types/Position.d.ts +4 -0
  132. package/storybook-static/types/Rectangle.d.ts +6 -0
  133. package/storybook-static/types/TimeRange.d.ts +4 -0
  134. package/storybook-static/types/TimelaneSettings.d.ts +14 -0
  135. package/storybook-static/types/index.d.ts +16 -0
  136. package/dist/components/Timelane.d.ts +0 -17
  137. package/dist/components/TimelaneSettingsProvider.d.ts +0 -7
  138. package/dist/components/TimelaneWrapper.d.ts +0 -20
  139. /package/dist/components/{TimelaneSelectionLayer.d.ts → TimelaneBody/TimelaneSelectionLayer.d.ts} +0 -0
@@ -0,0 +1,11 @@
1
+ import type { StorybookConfig } from "@storybook/react-vite";
2
+
3
+ const config: StorybookConfig = {
4
+ stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
5
+ addons: ["@chromatic-com/storybook", "@storybook/addon-docs"],
6
+ framework: {
7
+ name: "@storybook/react-vite",
8
+ options: {},
9
+ },
10
+ };
11
+ export default config;
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,14 @@
1
+ import type { Preview } from '@storybook/react-vite'
2
+
3
+ const preview: Preview = {
4
+ parameters: {
5
+ controls: {
6
+ matchers: {
7
+ color: /(background|color)$/i,
8
+ date: /Date$/i,
9
+ },
10
+ },
11
+ },
12
+ };
13
+
14
+ export default preview;
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 David Hansmair
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  A React/TypeScript library to build timelines / horizontally scrollable calendars with multiple lanes.
4
4
 
5
+ <img width="1145" alt="image" src="https://github.com/user-attachments/assets/a051f665-37ac-4292-9b85-7e1baa1bb84f" />
6
+
7
+
5
8
  ## Features
6
9
 
7
10
  react-timelane has a particular focus on usability and comes with many neat features:
@@ -23,7 +26,7 @@ npm install react-timelane
23
26
 
24
27
  ## Code Example
25
28
 
26
- see `docs/src/components/MyTimelane.tsx` for the full example:
29
+ The following code example shows a basic custom Timelane, focusing on the component structure. See [docs/src/components/MyTimelane.tsx](https://github.com/dhansmair/react-timelane/blob/main/docs/src/components/MyTimelane.tsx) for the full example:
27
30
 
28
31
  ```typescript
29
32
  import { addDays, min } from "date-fns";
@@ -32,10 +35,7 @@ import {
32
35
  type AvailableSpace,
33
36
  type Lane,
34
37
  type Item,
35
- type ItemId,
36
- type TimelaneSettings,
37
- TimelaneSettingsProvider,
38
- useScroll,
38
+ type ItemId
39
39
  } from "react-timelane";
40
40
  import type Allocation from "../models/Allocation";
41
41
  import type Resource from "../models/Resource";
@@ -43,17 +43,6 @@ import AllocationComponent from "./AllocationComponent";
43
43
 
44
44
  import { Timelane as TL } from "react-timelane";
45
45
 
46
- const defaultSettings: TimelaneSettings = {
47
- showMonths: true,
48
- showWeeks: true,
49
- showDays: true,
50
- start: new Date(2025, 3, 1),
51
- end: new Date(2025, 6, 2),
52
- pixelsPerDay: 50,
53
- pixelsPerResource: 100,
54
- allowOverlaps: false,
55
- focusedDate: null,
56
- };
57
46
 
58
47
  interface MyTimelaneProps {
59
48
  resources: Resource[];
@@ -0,0 +1,38 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { TimelaneLane } from '../TimelaneLane/TimelaneLane';
3
+ import { TimelaneBody } from '../TimelaneBody/TimelaneBody';
4
+ import { TimelaneLayout } from '../TimelaneLayout/TimelaneLayout';
5
+ import { TimelaneHeader } from '../TimelaneHeader/TimelaneHeader';
6
+ import { TimelaneBackground } from '../TimelaneBackground/TimelaneBackground';
7
+ import { TimelaneAside } from '../TimelaneAside/TimelaneAside';
8
+ import { EnableResizing } from '../../types';
9
+ export interface TimelaneProps {
10
+ /**
11
+ * start of the time range
12
+ */
13
+ start?: Date;
14
+ /**
15
+ * end of the time range
16
+ */
17
+ end?: Date;
18
+ pixelsPerDay?: number;
19
+ pixelsPerLane?: number;
20
+ showMonths?: boolean;
21
+ showWeeks?: boolean;
22
+ showDays?: boolean;
23
+ allowOverlaps?: boolean;
24
+ enableItemResizing?: boolean | EnableResizing;
25
+ enableItemDragging?: boolean;
26
+ }
27
+ /**
28
+ * a component
29
+ */
30
+ export declare function Timelane({ start, end, pixelsPerDay, pixelsPerLane, showMonths, showWeeks, showDays, allowOverlaps, enableItemResizing, enableItemDragging, children, }: PropsWithChildren<TimelaneProps>): import("react/jsx-runtime").JSX.Element;
31
+ export declare namespace Timelane {
32
+ var Header: typeof TimelaneHeader;
33
+ var Body: typeof TimelaneBody;
34
+ var Background: typeof TimelaneBackground;
35
+ var Aside: typeof TimelaneAside;
36
+ var Lane: typeof TimelaneLane;
37
+ var Layout: typeof TimelaneLayout;
38
+ }
@@ -0,0 +1,19 @@
1
+ import { StoryObj } from '@storybook/react-vite';
2
+ import { Timelane as TL } from './Timelane';
3
+ import { TimelaneHeader } from '../TimelaneHeader';
4
+ import { TimelaneBody } from '../TimelaneBody/TimelaneBody';
5
+ import { TimelaneBackground } from '../TimelaneBackground/TimelaneBackground';
6
+ import { TimelaneLane } from '../TimelaneLane/TimelaneLane';
7
+ declare const meta: {
8
+ component: typeof TL;
9
+ tags: string[];
10
+ subcomponents: {
11
+ TimelaneHeader: typeof TimelaneHeader;
12
+ TimelaneBody: typeof TimelaneBody;
13
+ TimelaneBackground: typeof TimelaneBackground;
14
+ TimelaneLane: typeof TimelaneLane;
15
+ };
16
+ };
17
+ export default meta;
18
+ type Story = StoryObj<typeof meta>;
19
+ export declare const Primary: Story;
@@ -0,0 +1,10 @@
1
+ import { MouseEvent } from 'react';
2
+ export interface TimelaneAllocationProps {
3
+ name: string;
4
+ description: string;
5
+ isSelected?: boolean;
6
+ isDragged?: boolean;
7
+ onClick?: (e: MouseEvent) => void;
8
+ onContextMenu?: (e: MouseEvent) => void;
9
+ }
10
+ export declare function TimelaneAllocation({ name, description, isSelected, isDragged, onClick, onContextMenu, }: TimelaneAllocationProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import { MouseEvent, ReactElement } from 'react';
2
- import { Lane } from '../types';
3
- interface TimelaneAsideProps {
2
+ import { Lane } from '../../types';
3
+ export interface TimelaneAsideProps {
4
4
  lanes: Lane[];
5
5
  focusedLane?: Lane | null;
6
6
  setFocusedLane?: (lane: Lane | null) => void;
@@ -10,4 +10,3 @@ interface TimelaneAsideProps {
10
10
  renderLaneHeader?: (lane: Lane) => ReactElement;
11
11
  }
12
12
  export declare function TimelaneAside({ lanes, focusedLane, setFocusedLane, onLaneHeaderClick, onLaneHeaderDoubleClick, onLaneHeaderContextMenu, renderLaneHeader, }: TimelaneAsideProps): import("react/jsx-runtime").JSX.Element;
13
- export {};
@@ -1,5 +1,4 @@
1
- interface TimelaneBackgroundProps {
1
+ export interface TimelaneBackgroundProps {
2
2
  focusedDay?: Date | null;
3
3
  }
4
4
  export declare function TimelaneBackground({ focusedDay }: TimelaneBackgroundProps): import("react/jsx-runtime").JSX.Element;
5
- export {};
@@ -1,6 +1,5 @@
1
1
  import { PropsWithChildren } from 'react';
2
- interface TimelaneBodyProps {
2
+ export interface TimelaneBodyProps {
3
3
  onSelect?: (selection: number[]) => void;
4
4
  }
5
5
  export declare function TimelaneBody({ onSelect, children, }: PropsWithChildren<TimelaneBodyProps>): import("react/jsx-runtime").JSX.Element;
6
- export {};
@@ -1,5 +1,5 @@
1
1
  import { MouseEvent, ReactElement } from 'react';
2
- import { AvailableSpace, Item, Lane } from '../types';
2
+ import { AvailableSpace, Item, Lane } from '../../types';
3
3
  interface TimelaneBodyInnerProps<T> {
4
4
  lanes: Lane[];
5
5
  items: Item<T>[];
@@ -1,6 +1,6 @@
1
1
  import { MouseEvent, ReactElement } from 'react';
2
2
  import { Pixels, TimeRange } from '../../types';
3
- interface DaysHeaderProps {
3
+ export interface DaysHeaderProps {
4
4
  range: TimeRange;
5
5
  pixels: Pixels;
6
6
  focusedDay?: Date | null;
@@ -12,4 +12,3 @@ interface DaysHeaderProps {
12
12
  }) => void;
13
13
  }
14
14
  export declare function DaysHeader({ range, pixels, focusedDay, setFocusedDay, render, onDayClick, }: DaysHeaderProps): import("react/jsx-runtime").JSX.Element;
15
- export {};
@@ -1,6 +1,6 @@
1
1
  import { MouseEvent, ReactElement } from 'react';
2
2
  import { Pixels, TimeRange } from '../../types';
3
- interface MonthsHeaderProps {
3
+ export interface MonthsHeaderProps {
4
4
  range: TimeRange;
5
5
  pixels: Pixels;
6
6
  setFocusedDay?: (day: Date | null) => void;
@@ -12,4 +12,3 @@ interface MonthsHeaderProps {
12
12
  }) => void;
13
13
  }
14
14
  export declare function MonthsHeader({ range, pixels, setFocusedDay, render, onMonthClick, }: MonthsHeaderProps): import("react/jsx-runtime").JSX.Element;
15
- export {};
@@ -1,5 +1,5 @@
1
1
  import { MouseEvent, ReactElement } from 'react';
2
- interface TimelaneHeaderProps {
2
+ export interface TimelaneHeaderProps {
3
3
  focusedDay?: Date | null;
4
4
  setFocusedDay?: (day: Date | null) => void;
5
5
  renderMonthHeader?: (firstDay: Date, lastDay: Date) => ReactElement;
@@ -21,4 +21,3 @@ interface TimelaneHeaderProps {
21
21
  }) => void;
22
22
  }
23
23
  export declare function TimelaneHeader({ focusedDay, setFocusedDay, renderMonthHeader, renderWeekHeader, renderDayHeader, onMonthClick, onDayClick, onWeekClick, }: TimelaneHeaderProps): import("react/jsx-runtime").JSX.Element;
24
- export {};
@@ -1,6 +1,6 @@
1
1
  import { MouseEvent, ReactElement } from 'react';
2
2
  import { Pixels, TimeRange } from '../../types';
3
- interface WeeksHeaderProps {
3
+ export interface WeeksHeaderProps {
4
4
  range: TimeRange;
5
5
  pixels: Pixels;
6
6
  setFocusedDay?: (day: Date | null) => void;
@@ -12,4 +12,3 @@ interface WeeksHeaderProps {
12
12
  }) => void;
13
13
  }
14
14
  export declare function WeeksHeader({ range, pixels, setFocusedDay, render, onWeekClick, }: WeeksHeaderProps): import("react/jsx-runtime").JSX.Element;
15
- export {};
@@ -1,5 +1,5 @@
1
- export { DaysHeader } from './DaysHeader';
2
- export { WeeksHeader } from './WeeksHeader';
3
- export { MonthsHeader } from './MonthsHeader';
4
- export { TimelaneHeader } from './TimelaneHeader';
1
+ export { DaysHeader, type DaysHeaderProps } from './DaysHeader';
2
+ export { WeeksHeader, type WeeksHeaderProps } from './WeeksHeader';
3
+ export { MonthsHeader, type MonthsHeaderProps } from './MonthsHeader';
4
+ export { TimelaneHeader, type TimelaneHeaderProps } from './TimelaneHeader';
5
5
  export { renderDayHeader, renderMonthHeader, renderWeekHeader, } from './renderingUtils';
@@ -1,6 +1,6 @@
1
1
  import { MouseEvent, ReactElement } from 'react';
2
2
  import { AvailableSpace, Item, Lane } from '../../types';
3
- interface TimelaneLaneProps<T> {
3
+ export interface TimelaneLaneProps<T> {
4
4
  lane: Lane;
5
5
  items: Item<T>[];
6
6
  focused?: boolean;
@@ -13,4 +13,3 @@ interface TimelaneLaneProps<T> {
13
13
  onResizeStart?: (data: T) => void;
14
14
  }
15
15
  export declare function TimelaneLane<T>({ lane, items, focused, onItemUpdate, onMouseUp, onClick, onDoubleClick, onContextMenu, renderItem, onResizeStart, }: TimelaneLaneProps<T>): import("react/jsx-runtime").JSX.Element;
16
- export {};
@@ -0,0 +1,9 @@
1
+ import { StoryObj } from '@storybook/react-vite';
2
+ import { TimelaneLane } from '../TimelaneLane/TimelaneLane';
3
+ declare const meta: {
4
+ component: typeof TimelaneLane;
5
+ tags: string[];
6
+ };
7
+ export default meta;
8
+ type Story = StoryObj<typeof meta>;
9
+ export declare const Primary: Story;
@@ -1,5 +1,5 @@
1
1
  import { Dispatch, SetStateAction } from 'react';
2
- import { TimelaneSettings } from '../types/';
2
+ import { TimelaneSettings } from '../../types';
3
3
  export interface TimelaneContextOuter {
4
4
  settings: TimelaneSettings;
5
5
  setSettings: Dispatch<SetStateAction<TimelaneSettings>>;
@@ -0,0 +1,11 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { TimelaneSettings } from '../../types/TimelaneSettings';
3
+ export interface TimelaneSettingsProviderProps {
4
+ settings: TimelaneSettings;
5
+ }
6
+ /**
7
+ * this is an example docstring
8
+ * @param param0
9
+ * @returns
10
+ */
11
+ export declare function TimelaneSettingsProvider({ settings: _settings, children, }: PropsWithChildren<TimelaneSettingsProviderProps>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { StoryObj } from '@storybook/react-vite';
2
+ import { TimelaneSettingsProvider } from './TimelaneSettingsProvider';
3
+ declare const meta: {
4
+ component: typeof TimelaneSettingsProvider;
5
+ tags: string[];
6
+ };
7
+ export default meta;
8
+ type Story = StoryObj<typeof meta>;
9
+ export declare const Primary: Story;
@@ -1 +1 @@
1
- export declare const useTimelaneContext: () => import('../components/TimelaneSettingsContext').TimelaneContextOuter;
1
+ export declare const useTimelaneContext: () => import('../components/TimelaneSettingsProvider/TimelaneSettingsContext').TimelaneContextOuter;
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
+ export { Timelane, type TimelaneProps } from './components/Timelane/Timelane';
1
2
  export { TimelaneLayout } from './components/TimelaneLayout/TimelaneLayout';
2
- export { TimelaneAside } from './components/TimelaneAside';
3
- export { TimelaneBackground } from './components/TimelaneBackground';
4
- export { TimelaneLane } from './components/TimelaneLane/TimelaneLane';
5
- export { TimelaneBody } from './components/TimelaneBody';
6
- export { Timelane } from './components/Timelane';
7
- export { TimelaneSettingsProvider } from './components/TimelaneSettingsProvider';
3
+ export { TimelaneAside, type TimelaneAsideProps, } from './components/TimelaneAside/TimelaneAside';
4
+ export { TimelaneBackground, type TimelaneBackgroundProps, } from './components/TimelaneBackground/TimelaneBackground';
5
+ export { TimelaneLane, type TimelaneLaneProps, } from './components/TimelaneLane/TimelaneLane';
6
+ export { TimelaneBody, type TimelaneBodyProps, } from './components/TimelaneBody/TimelaneBody';
7
+ export { TimelaneSettingsProvider, type TimelaneSettingsProviderProps, } from './components/TimelaneSettingsProvider/TimelaneSettingsProvider';
8
+ export { TimelaneAllocation, type TimelaneAllocationProps, } from './components/TimelaneAllocation/TimelaneAllocation';
8
9
  export * from './components/TimelaneHeader';
9
10
  export * from './types';
10
- export * from './components/utils';
11
11
  export { useScroll } from './hooks/useScroll';
12
12
  export { useTimelaneContext } from './hooks/useTimelaneContext';
@@ -1 +1 @@
1
- .timelane-layout{position:relative;width:100%;height:100%;overflow:auto}.timelane-layout .timelane-layout-inner{position:relative;width:fit-content;height:fit-content;display:grid;grid-template-areas:"corner-tl header corner-tr" "aside-l body aside-r" "corner-bl footer corner-br"}.timelane-layout .timelane-layout-inner .timelane-layout-header,.timelane-layout .timelane-layout-inner .timelane-layout-footer,.timelane-layout .timelane-layout-inner .timelane-layout-aside,.timelane-layout .timelane-layout-inner .timelane-layout-corner{background:#fff}.timelane-layout .timelane-layout-inner .timelane-layout-header{grid-area:header;position:sticky;position:-webkit-sticky;top:0;z-index:101;overflow:hidden}.timelane-layout .timelane-layout-inner .timelane-layout-body{grid-area:body;z-index:100}.timelane-layout .timelane-layout-inner .timelane-layout-background{grid-area:body;z-index:-1}.timelane-layout .timelane-layout-inner .timelane-layout-footer{grid-area:footer;position:sticky;position:-webkit-sticky;bottom:0;z-index:101;border-top:1px solid lightgray}.timelane-layout .timelane-layout-inner .timelane-layout-aside{grid-area:aside-l;position:sticky;position:-webkit-sticky;left:0;z-index:101}.timelane-layout .timelane-layout-inner .timelane-layout-aside.timelane-layout-aside-right{grid-area:aside-r;right:0;left:initial;border-left:1px solid lightgray}.timelane-layout .timelane-layout-inner .timelane-layout-corner{position:sticky;position:-webkit-sticky;z-index:102}.timelane-layout .timelane-layout-inner .timelane-layout-corner.timelane-layout-corner-top-left{grid-area:corner-tl;top:0;left:0;border-bottom:1px solid lightgray;border-right:1px solid lightgray}.timelane-layout .timelane-layout-inner .timelane-layout-corner.timelane-layout-corner-top-right{grid-area:corner-tr;top:0;right:0;border-bottom:1px solid lightgray;border-left:1px solid lightgray}.timelane-layout .timelane-layout-inner .timelane-layout-corner.timelane-layout-corner-bottom-left{grid-area:corner-bl;bottom:0;left:0;border-top:1px solid lightgray;border-right:1px solid lightgray}.timelane-layout .timelane-layout-inner .timelane-layout-corner.timelane-layout-corner-bottom-right{grid-area:corner-br;bottom:0;right:0;border-top:1px solid lightgray;border-left:1px solid lightgray}*{box-sizing:border-box}.timelane{--timelane-aside-width: 150px;--timelane-border-color-light: #f0f0f0;--timelane-border-color-normal: lightgray;--timelane-border-color-dark: gray;--timelane-highlight-color: #f8f8f8;--timelane-focused-color: rgba(0, 0, 255, .1);--timelane-hover-color: rgba(0, 0, 0, .05);overflow:auto;position:relative;width:100%;height:100%;border-left:1px solid var(--timelane-border-color-normal)}.timelane .timelane-header{top:0;z-index:101;background:#fff}.timelane .timelane-header .timelane-header-months{display:flex;flex-flow:row nowrap}.timelane .timelane-header .timelane-header-months .timelane-header-month-label{border-right:1px solid var(--timelane-border-color-normal);border-bottom:1px solid var(--timelane-border-color-normal);overflow:hidden;font-size:1em;height:30px;line-height:30px;text-align:center;cursor:pointer}.timelane .timelane-header .timelane-header-months .timelane-header-month-label:hover{background:var(--timelane-hover-color)}.timelane .timelane-header .timelane-header-weeks{display:flex;flex-flow:row nowrap}.timelane .timelane-header .timelane-header-weeks .timelane-header-week-label{border-right:1px solid var(--timelane-border-color-normal);border-bottom:1px solid var(--timelane-border-color-normal);overflow:hidden;font-size:1em;height:30px;line-height:30px;text-align:center;cursor:pointer}.timelane .timelane-header .timelane-header-weeks .timelane-header-week-label:hover{background:var(--timelane-hover-color)}.timelane .timelane-header .timelane-header-days{display:flex;flex-flow:row nowrap}.timelane .timelane-header .timelane-header-days .timelane-header-day-label{border-right:1px solid var(--timelane-border-color-normal);border-bottom:1px solid var(--timelane-border-color-normal);overflow:hidden;font-size:.8em;height:20px;line-height:20px;text-align:center;cursor:pointer}.timelane .timelane-header .timelane-header-days .timelane-header-day-label:hover{background:var(--timelane-hover-color)}.timelane .timelane-header .timelane-header-days .timelane-header-day-label.timelane-header-day-label-focused{background:var(--timelane-focused-color)}.timelane .timelane-header-corner{z-index:102;background:#fff;border-right:1px solid var(--timelane-border-color-normal);border-bottom:1px solid var(--timelane-border-color-normal)}.timelane .timelane-body{z-index:99;position:relative;width:fit-content}.timelane .timelane-body .timelane-lane{border-color:var(--timelane-border-color-normal)!important;border-top:1px solid gray;border-bottom:1px solid gray;margin-top:-1px;overflow:hidden}.timelane .timelane-body .timelane-lane .timelane-drop-target{position:relative;width:100%;height:100%}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item{position:absolute;cursor:pointer;border-radius:3px;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item.timelane-item-marked .timelane-allocation{border:2px dashed rgba(0,0,0,.5)}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-item-drag-handle{height:100%}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-item-resize-handle{background:#bed7dc;border-radius:5px;top:4px!important;bottom:4px!important;height:auto!important;width:6px!important;z-index:2;background:transparent!important;transition:.2s}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-item-resize-handle:hover{background:#0000001a!important}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-item-resize-handle.timelane-item-resize-handle-left{left:0!important;margin-left:1px}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-item-resize-handle.timelane-item-resize-handle-right{right:0!important}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-allocation{background:#92a8d1;border-radius:2px;border:2px solid transparent;height:calc(100% - 1px);overflow:hidden;cursor:pointer;padding:0 4px;margin-left:1px;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;container-type:size;container-name:timelane-allocation}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-allocation .timelane-allocation-title{font-weight:700;transform-origin:top left;line-height:30px;white-space:nowrap}@container timelane-allocation (max-height: 30px){.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-allocation .timelane-allocation-title{margin:0}}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-allocation.timelane-allocation-selected{border:2px dashed rgba(0,0,0,.5)}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item.dragging{opacity:0}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-drop-preview{background:#00f;position:absolute;border-radius:2px;color:#fff}.timelane .timelane-body .timelane-lane.timelane-row-focused{background:var(--timelane-focused-color)}.timelane .timelane-aside{border-right:1px solid var(--timelane-border-color-normal);width:var(--timelane-aside-width);background:#fff}.timelane .timelane-aside .timelane-aside-lane-header{border:1px solid var(--timelane-border-color-normal);border-right:none;border-left:none;margin-top:-1px;padding:10px;overflow:hidden;position:relative;cursor:pointer}.timelane .timelane-aside .timelane-aside-lane-header.timelane-aside-lane-header-focused{background:var(--timelane-focused-color)}.timelane .timelane-aside .timelane-aside-lane-header:hover .timelane-aside-resource-menu{opacity:1}.timelane .timelane-aside .timelane-aside-lane-header .timelane-aside-resource-menu{position:absolute;top:5px;right:5px;opacity:0;transition:.15s}.timelane .timelane-aside .timelane-aside-lane-header .timelane-aside-resource-menu.timelane-aside-resource-menu-open{opacity:1}.timelane .timelane-background{position:relative;width:100%;height:100%}.timelane .timelane-background .timelane-background-inner{display:flex;flex-flow:row nowrap;height:100%}.timelane .timelane-background .timelane-background-inner .timelane-background-day-label{border-right:1px solid var(--timelane-border-color-light);overflow:hidden;font-size:.8em;height:100%;z-index:-100}.timelane .timelane-background .timelane-background-inner .timelane-background-day-label.timelane-background-day-label-sunday{border-right:1px solid var(--timelane-border-color-normal)}.timelane .timelane-background .timelane-background-inner .timelane-background-day-label.timelane-background-day-label-focused{background:var(--timelane-focused-color)}.timelane .timelane-background .timelane-background-inner .timelane-background-focused-day-position{position:absolute;height:100%;background:var(--timelane-focused-color);z-index:-101}.timelane-header-tooltip,.timelane-header-day-tooltip{font-size:2em}
1
+ .timelane-layout{position:relative;width:100%;height:100%;overflow:auto}.timelane-layout .timelane-layout-inner{position:relative;width:fit-content;height:fit-content;display:grid;grid-template-areas:"corner-tl header corner-tr" "aside-l body aside-r" "corner-bl footer corner-br"}.timelane-layout .timelane-layout-inner .timelane-layout-header,.timelane-layout .timelane-layout-inner .timelane-layout-footer,.timelane-layout .timelane-layout-inner .timelane-layout-aside,.timelane-layout .timelane-layout-inner .timelane-layout-corner{background:#fff}.timelane-layout .timelane-layout-inner .timelane-layout-header{grid-area:header;position:sticky;position:-webkit-sticky;top:0;z-index:101;overflow:hidden}.timelane-layout .timelane-layout-inner .timelane-layout-body{grid-area:body;z-index:100}.timelane-layout .timelane-layout-inner .timelane-layout-background{grid-area:body;z-index:-1}.timelane-layout .timelane-layout-inner .timelane-layout-footer{grid-area:footer;position:sticky;position:-webkit-sticky;bottom:0;z-index:101;border-top:1px solid lightgray}.timelane-layout .timelane-layout-inner .timelane-layout-aside{grid-area:aside-l;position:sticky;position:-webkit-sticky;left:0;z-index:101}.timelane-layout .timelane-layout-inner .timelane-layout-aside.timelane-layout-aside-right{grid-area:aside-r;right:0;left:initial;border-left:1px solid lightgray}.timelane-layout .timelane-layout-inner .timelane-layout-corner{position:sticky;position:-webkit-sticky;z-index:102}.timelane-layout .timelane-layout-inner .timelane-layout-corner.timelane-layout-corner-top-left{grid-area:corner-tl;top:0;left:0;border-bottom:1px solid lightgray;border-right:1px solid lightgray}.timelane-layout .timelane-layout-inner .timelane-layout-corner.timelane-layout-corner-top-right{grid-area:corner-tr;top:0;right:0;border-bottom:1px solid lightgray;border-left:1px solid lightgray}.timelane-layout .timelane-layout-inner .timelane-layout-corner.timelane-layout-corner-bottom-left{grid-area:corner-bl;bottom:0;left:0;border-top:1px solid lightgray;border-right:1px solid lightgray}.timelane-layout .timelane-layout-inner .timelane-layout-corner.timelane-layout-corner-bottom-right{grid-area:corner-br;bottom:0;right:0;border-top:1px solid lightgray;border-left:1px solid lightgray}*{box-sizing:border-box}.timelane{--timelane-aside-width: 150px;--timelane-border-color-light: #f0f0f0;--timelane-border-color-normal: lightgray;--timelane-border-color-dark: gray;--timelane-highlight-color: #f8f8f8;--timelane-focused-color: rgba(0, 0, 255, .1);--timelane-hover-color: rgba(0, 0, 0, .05);overflow:auto;position:relative;width:100%;height:100%;border:1px solid var(--timelane-border-color-normal)}.timelane .timelane-header{top:0;z-index:101;background:#fff}.timelane .timelane-header .timelane-header-months{display:flex;flex-flow:row nowrap}.timelane .timelane-header .timelane-header-months .timelane-header-month-label{border-right:1px solid var(--timelane-border-color-normal);border-bottom:1px solid var(--timelane-border-color-normal);overflow:hidden;font-size:1em;height:30px;line-height:30px;text-align:center;cursor:pointer}.timelane .timelane-header .timelane-header-months .timelane-header-month-label:hover{background:var(--timelane-hover-color)}.timelane .timelane-header .timelane-header-weeks{display:flex;flex-flow:row nowrap}.timelane .timelane-header .timelane-header-weeks .timelane-header-week-label{border-right:1px solid var(--timelane-border-color-normal);border-bottom:1px solid var(--timelane-border-color-normal);overflow:hidden;font-size:1em;height:30px;line-height:30px;text-align:center;cursor:pointer}.timelane .timelane-header .timelane-header-weeks .timelane-header-week-label:hover{background:var(--timelane-hover-color)}.timelane .timelane-header .timelane-header-days{display:flex;flex-flow:row nowrap}.timelane .timelane-header .timelane-header-days .timelane-header-day-label{border-right:1px solid var(--timelane-border-color-normal);border-bottom:1px solid var(--timelane-border-color-normal);overflow:hidden;font-size:.8em;height:20px;line-height:20px;text-align:center;cursor:pointer}.timelane .timelane-header .timelane-header-days .timelane-header-day-label:hover{background:var(--timelane-hover-color)}.timelane .timelane-header .timelane-header-days .timelane-header-day-label.timelane-header-day-label-focused{background:var(--timelane-focused-color)}.timelane .timelane-header-corner{z-index:102;background:#fff;border-right:1px solid var(--timelane-border-color-normal);border-bottom:1px solid var(--timelane-border-color-normal)}.timelane .timelane-body{z-index:99;position:relative;width:fit-content}.timelane .timelane-body .timelane-lane{border-color:var(--timelane-border-color-normal)!important;border-top:1px solid gray;border-bottom:1px solid gray;margin-top:-1px;overflow:hidden}.timelane .timelane-body .timelane-lane:last-child{margin-bottom:-1px}.timelane .timelane-body .timelane-lane .timelane-drop-target{position:relative;width:100%;height:100%}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item{position:absolute;cursor:pointer;border-radius:3px;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item.timelane-item-marked .timelane-allocation{border:2px dashed rgba(0,0,0,.5)}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-item-drag-handle{height:100%}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-item-resize-handle{background:#bed7dc;border-radius:5px;top:4px!important;bottom:4px!important;height:auto!important;width:6px!important;z-index:2;background:transparent!important;transition:.2s}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-item-resize-handle:hover{background:#0000001a!important}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-item-resize-handle.timelane-item-resize-handle-left{left:0!important;margin-left:1px}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-item-resize-handle.timelane-item-resize-handle-right{right:0!important}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-allocation{background:#92a8d1;border-radius:2px;border:2px solid transparent;height:calc(100% - 1px);overflow:hidden;cursor:pointer;padding:0 4px;margin-left:1px;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;container-type:size;container-name:timelane-allocation}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-allocation .timelane-allocation-title{font-weight:700;transform-origin:top left;line-height:30px;white-space:nowrap}@container timelane-allocation (max-height: 30px){.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-allocation .timelane-allocation-title{margin:0}}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-allocation.timelane-allocation-selected{border:2px dashed rgba(0,0,0,.5)}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item.dragging{opacity:0}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-drop-preview{background:#00f;position:absolute;border-radius:2px;color:#fff}.timelane .timelane-body .timelane-lane.timelane-row-focused{background:var(--timelane-focused-color)}.timelane .timelane-aside{border-right:1px solid var(--timelane-border-color-normal);width:var(--timelane-aside-width);background:#fff}.timelane .timelane-aside .timelane-aside-lane-header{border:1px solid var(--timelane-border-color-normal);border-right:none;border-left:none;margin-top:-1px;padding:10px;overflow:hidden;position:relative;cursor:pointer}.timelane .timelane-aside .timelane-aside-lane-header.timelane-aside-lane-header-focused{background:var(--timelane-focused-color)}.timelane .timelane-aside .timelane-aside-lane-header:hover .timelane-aside-resource-menu{opacity:1}.timelane .timelane-aside .timelane-aside-lane-header .timelane-aside-resource-menu{position:absolute;top:5px;right:5px;opacity:0;transition:.15s}.timelane .timelane-aside .timelane-aside-lane-header .timelane-aside-resource-menu.timelane-aside-resource-menu-open{opacity:1}.timelane .timelane-background{position:relative;width:100%;height:100%}.timelane .timelane-background .timelane-background-inner{display:flex;flex-flow:row nowrap;height:100%}.timelane .timelane-background .timelane-background-inner .timelane-background-day-label{border-right:1px solid var(--timelane-border-color-light);overflow:hidden;font-size:.8em;height:100%;z-index:-100}.timelane .timelane-background .timelane-background-inner .timelane-background-day-label.timelane-background-day-label-sunday{border-right:1px solid var(--timelane-border-color-normal)}.timelane .timelane-background .timelane-background-inner .timelane-background-day-label.timelane-background-day-label-focused{background:var(--timelane-focused-color)}.timelane .timelane-background .timelane-background-inner .timelane-background-focused-day-position{position:absolute;height:100%;background:var(--timelane-focused-color);z-index:-101}.timelane-header-tooltip,.timelane-header-day-tooltip{font-size:2em}