react-timelane 0.0.5 → 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 (45) 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 +3464 -3405
  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 +12 -3
  42. package/dist/components/Timelane.d.ts +0 -17
  43. package/dist/components/TimelaneSettingsProvider.d.ts +0 -7
  44. package/dist/components/TimelaneWrapper.d.ts +0 -20
  45. /package/dist/components/{TimelaneSelectionLayer.d.ts → TimelaneBody/TimelaneSelectionLayer.d.ts} +0 -0
@@ -0,0 +1,4 @@
1
+ import { TimelaneProps } from '../../components/Timelane/Timelane';
2
+ export interface FullExamplePageProps extends TimelaneProps {
3
+ }
4
+ export declare function FullExamplePage(settings: FullExamplePageProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { StoryObj } from '@storybook/react-vite';
2
+ import { FullExamplePage } from './FullExamplePage';
3
+ declare const meta: {
4
+ title: string;
5
+ component: typeof FullExamplePage;
6
+ parameters: {
7
+ layout: string;
8
+ };
9
+ argTypes: {
10
+ showDays: {
11
+ control: {
12
+ type: "boolean";
13
+ };
14
+ };
15
+ };
16
+ };
17
+ export default meta;
18
+ type Story = StoryObj<typeof meta>;
19
+ export declare const Example: Story;
@@ -0,0 +1,20 @@
1
+ import { MouseEvent } from 'react';
2
+ import { default as Allocation } from '../models/Allocation';
3
+ import { default as Resource } from '../models/Resource';
4
+ import { TimelaneProps } from '../../components/Timelane/Timelane';
5
+ interface MyTimelaneProps {
6
+ resources: Resource[];
7
+ allocations: Allocation[];
8
+ focusedDay?: Date | null;
9
+ timelaneParameters: TimelaneProps;
10
+ setFocusedResource?: (resource: Resource | null) => void;
11
+ setFocusedDay?: (day: Date | null) => void;
12
+ onAllocationCreate?: (allocation: Allocation) => void;
13
+ onAllocationUpdate?: (allocation: Allocation) => void;
14
+ onAllocationDelete?: (allocation: Allocation) => void;
15
+ onAllocationClick?: (allocation: Allocation, e: MouseEvent | null) => void;
16
+ onAllocationContextMenu?: (allocation: Allocation, e: MouseEvent) => void;
17
+ onAreaClick?: (area: Resource, e: MouseEvent) => void;
18
+ }
19
+ export declare function MyTimelane({ resources, allocations, focusedDay, timelaneParameters, setFocusedDay, onAllocationCreate, onAllocationUpdate, }: MyTimelaneProps): import("react/jsx-runtime").JSX.Element;
20
+ export {};
@@ -0,0 +1,7 @@
1
+ import { default as Allocation } from './models/Allocation';
2
+ import { default as Resource } from './models/Resource';
3
+ export declare const DEFAULT_ALLOCATION_COLOR = "#A7C7E7";
4
+ export declare const DEFAULT_ALLOCATION_DESCRIPTION = "empty description";
5
+ export declare const DEFAULT_ALLOCATION_NAME = "New Allocation";
6
+ export declare const DEFAULT_RESOURCES: Resource[];
7
+ export declare const DEFAULT_ALLOCATIONS: Allocation[];
@@ -0,0 +1,2 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ export default function useLocalStorage<T>(key: string, defaultValue: T): [T, Dispatch<SetStateAction<T>>];
@@ -0,0 +1,11 @@
1
+ export default interface Allocation {
2
+ id: number;
3
+ resourceId: number;
4
+ name: string;
5
+ description: string;
6
+ start: Date;
7
+ end: Date;
8
+ size: number;
9
+ offset: number;
10
+ color: string;
11
+ }
@@ -0,0 +1 @@
1
+ export type AllocationId = number;
@@ -0,0 +1,7 @@
1
+ import { ResourceId } from './ResourceId';
2
+ export default interface Resource {
3
+ id: ResourceId;
4
+ name: string;
5
+ description: string;
6
+ capacity: number;
7
+ }
@@ -0,0 +1 @@
1
+ export type ResourceId = number;
@@ -0,0 +1,6 @@
1
+ export interface EnableResizing {
2
+ top?: boolean;
3
+ left?: boolean;
4
+ bottom?: boolean;
5
+ right?: boolean;
6
+ }
@@ -1,4 +1,4 @@
1
1
  export interface Pixels {
2
2
  pixelsPerDay: number;
3
- pixelsPerResource: number;
3
+ pixelsPerLane: number;
4
4
  }
@@ -1,11 +1,14 @@
1
+ import { EnableResizing } from './EnableResizing';
1
2
  export interface TimelaneSettings {
2
3
  start: Date;
3
4
  end: Date;
4
5
  pixelsPerDay: number;
5
- pixelsPerResource: number;
6
+ pixelsPerLane: number;
6
7
  showMonths: boolean;
7
8
  showWeeks: boolean;
8
9
  showDays: boolean;
9
10
  allowOverlaps: boolean;
10
11
  focusedDate: Date | null;
12
+ enableItemResizing: boolean | EnableResizing;
13
+ enableItemDragging: boolean;
11
14
  }
@@ -13,3 +13,4 @@ export { type Lane } from './Lane';
13
13
  export { type DateBounds } from './DateBounds';
14
14
  export { type OffsetBounds } from './OffsetBounds';
15
15
  export { type TimelaneSettings } from './TimelaneSettings';
16
+ export { type EnableResizing } from './EnableResizing';
package/eslint.config.js CHANGED
@@ -1,28 +1,28 @@
1
+ // For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
2
+ import storybook from "eslint-plugin-storybook";
3
+
1
4
  import js from '@eslint/js'
2
5
  import globals from 'globals'
3
6
  import reactHooks from 'eslint-plugin-react-hooks'
4
7
  import reactRefresh from 'eslint-plugin-react-refresh'
5
8
  import tseslint from 'typescript-eslint'
6
9
 
7
- export default tseslint.config(
8
- { ignores: ['dist'] },
9
- {
10
- extends: [js.configs.recommended, ...tseslint.configs.recommended],
11
- files: ['**/*.{ts,tsx}'],
12
- languageOptions: {
13
- ecmaVersion: 2020,
14
- globals: globals.browser,
15
- },
16
- plugins: {
17
- 'react-hooks': reactHooks,
18
- 'react-refresh': reactRefresh,
19
- },
20
- rules: {
21
- ...reactHooks.configs.recommended.rules,
22
- 'react-refresh/only-export-components': [
23
- 'warn',
24
- { allowConstantExport: true },
25
- ],
26
- },
10
+ export default tseslint.config({ ignores: ['dist'] }, {
11
+ extends: [js.configs.recommended, ...tseslint.configs.recommended],
12
+ files: ['**/*.{ts,tsx}'],
13
+ languageOptions: {
14
+ ecmaVersion: 2020,
15
+ globals: globals.browser,
16
+ },
17
+ plugins: {
18
+ 'react-hooks': reactHooks,
19
+ 'react-refresh': reactRefresh,
20
+ },
21
+ rules: {
22
+ ...reactHooks.configs.recommended.rules,
23
+ 'react-refresh/only-export-components': [
24
+ 'warn',
25
+ { allowConstantExport: true },
26
+ ],
27
27
  },
28
- )
28
+ }, storybook.configs["flat/recommended"]);
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "react-timelane",
3
- "version": "0.0.5",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",
7
7
  "build": "tsc -b && vite build",
8
8
  "lint": "eslint .",
9
- "preview": "vite preview"
9
+ "preview": "vite preview",
10
+ "storybook": "storybook dev -p 6006",
11
+ "build-storybook": "storybook build"
10
12
  },
11
13
  "dependencies": {
12
14
  "@atlaskit/pragmatic-drag-and-drop": "^1.7.2",
@@ -17,7 +19,11 @@
17
19
  "tiny-invariant": "^1.3.3"
18
20
  },
19
21
  "devDependencies": {
22
+ "@chromatic-com/storybook": "^4.0.1",
20
23
  "@eslint/js": "^9.25.0",
24
+ "@storybook/addon-docs": "^9.0.12",
25
+ "@storybook/addon-onboarding": "^9.0.12",
26
+ "@storybook/react-vite": "^9.0.12",
21
27
  "@types/node": "^24.0.1",
22
28
  "@types/react": "^19.1.2",
23
29
  "@types/react-dom": "^19.1.2",
@@ -25,9 +31,12 @@
25
31
  "eslint": "^9.25.0",
26
32
  "eslint-plugin-react-hooks": "^5.2.0",
27
33
  "eslint-plugin-react-refresh": "^0.4.19",
34
+ "eslint-plugin-storybook": "^9.0.12",
28
35
  "globals": "^16.0.0",
36
+ "react-styleguidist": "^13.1.4",
29
37
  "sass": "^1.89.2",
30
38
  "sass-embedded": "^1.89.2",
39
+ "storybook": "^9.0.12",
31
40
  "typescript": "~5.8.3",
32
41
  "typescript-eslint": "^8.30.1",
33
42
  "vite": "^6.3.5",
@@ -40,4 +49,4 @@
40
49
  },
41
50
  "./style.css": "./dist/react-timelane.css"
42
51
  }
43
- }
52
+ }
@@ -1,17 +0,0 @@
1
- import { PropsWithChildren } from 'react';
2
- import { TimelaneLane } from './TimelaneLane/TimelaneLane';
3
- import { TimelaneBody } from './TimelaneBody';
4
- import { TimelaneLayout } from './TimelaneLayout/TimelaneLayout';
5
- import { TimelaneHeader } from './TimelaneHeader/TimelaneHeader';
6
- import { TimelaneBackground } from './TimelaneBackground';
7
- import { TimelaneAside } from './TimelaneAside';
8
- export declare function Timelane({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
9
- export declare namespace Timelane {
10
- var Container: typeof Timelane;
11
- var Header: typeof TimelaneHeader;
12
- var Body: typeof TimelaneBody;
13
- var Background: typeof TimelaneBackground;
14
- var Aside: typeof TimelaneAside;
15
- var Lane: typeof TimelaneLane;
16
- var Layout: typeof TimelaneLayout;
17
- }
@@ -1,7 +0,0 @@
1
- import { PropsWithChildren } from 'react';
2
- import { TimelaneSettings } from '../types/TimelaneSettings';
3
- interface TimelaneSettingsProviderProps {
4
- settings: TimelaneSettings;
5
- }
6
- export declare const TimelaneSettingsProvider: ({ settings: _settings, children, }: PropsWithChildren<TimelaneSettingsProviderProps>) => import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -1,20 +0,0 @@
1
- import { PropsWithChildren } from 'react';
2
- import { Lane } from '../types';
3
- interface TimelaneWrapperProps {
4
- focusedDay?: Date | null;
5
- focusedLane?: Lane | null;
6
- start?: Date;
7
- end?: Date;
8
- pixelsPerDay?: number;
9
- pixelsPerResource?: number;
10
- showMonths?: boolean;
11
- showWeeks?: boolean;
12
- showDays?: boolean;
13
- allowOverlaps?: boolean;
14
- focusedDate?: Date | null;
15
- }
16
- /**
17
- * @deprecated The component should not be used
18
- */
19
- export default function TimelaneWrapper({ children, start, end, pixelsPerDay, pixelsPerResource, showMonths, showWeeks, showDays, allowOverlaps, focusedDate, }: PropsWithChildren<TimelaneWrapperProps>): import("react/jsx-runtime").JSX.Element;
20
- export {};