react-timelane 0.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 (72) hide show
  1. package/.github/workflows/static.yml +55 -0
  2. package/README.md +54 -0
  3. package/docs/README.md +54 -0
  4. package/docs/eslint.config.js +28 -0
  5. package/docs/index.html +12 -0
  6. package/docs/package-lock.json +5101 -0
  7. package/docs/package.json +35 -0
  8. package/docs/src/App.css +5 -0
  9. package/docs/src/App.tsx +59 -0
  10. package/docs/src/assets/react.svg +1 -0
  11. package/docs/src/components/AllocationComponent.tsx +82 -0
  12. package/docs/src/components/Timeline.tsx +183 -0
  13. package/docs/src/constants.ts +42 -0
  14. package/docs/src/hooks/useLocalStorage.ts +21 -0
  15. package/docs/src/main.tsx +9 -0
  16. package/docs/src/models/Allocation.ts +11 -0
  17. package/docs/src/models/AllocationId.ts +1 -0
  18. package/docs/src/models/Resource.ts +8 -0
  19. package/docs/src/models/ResourceId.ts +1 -0
  20. package/docs/src/vite-env.d.ts +1 -0
  21. package/docs/tsconfig.json +27 -0
  22. package/docs/vite.config.ts +8 -0
  23. package/eslint.config.js +28 -0
  24. package/index.html +13 -0
  25. package/package.json +43 -0
  26. package/src/components/Timeline.scss +297 -0
  27. package/src/components/TimelineAside.tsx +81 -0
  28. package/src/components/TimelineBackground.tsx +53 -0
  29. package/src/components/TimelineBody.tsx +54 -0
  30. package/src/components/TimelineHeader/DaysHeader.tsx +44 -0
  31. package/src/components/TimelineHeader/MonthsHeader.tsx +62 -0
  32. package/src/components/TimelineHeader/TimelineHeader.tsx +64 -0
  33. package/src/components/TimelineHeader/WeeksHeader.tsx +63 -0
  34. package/src/components/TimelineHeader/index.ts +9 -0
  35. package/src/components/TimelineHeader/renderingUtils.tsx +57 -0
  36. package/src/components/TimelineSelectionLayer.tsx +179 -0
  37. package/src/components/TimelineSettingsContext.tsx +27 -0
  38. package/src/components/TimelineSettingsProvider.tsx +24 -0
  39. package/src/components/TimelineWrapper.tsx +51 -0
  40. package/src/components/core/CoreItem/CoreItemComponent.tsx +69 -0
  41. package/src/components/core/CoreItem/DragResizeComponent.tsx +180 -0
  42. package/src/components/core/CoreSwimlane/AvailableSpaceIndicator.tsx +156 -0
  43. package/src/components/core/CoreSwimlane/CoreSwimlane.tsx +245 -0
  44. package/src/components/core/CoreSwimlane/DropPreview.tsx +30 -0
  45. package/src/components/core/CoreSwimlane/DropTarget.tsx +83 -0
  46. package/src/components/core/CoreSwimlane/OverlapIndicator.tsx +22 -0
  47. package/src/components/core/CoreSwimlane/utils.ts +375 -0
  48. package/src/components/core/utils.ts +154 -0
  49. package/src/components/layout/TimelineLayout.tsx +93 -0
  50. package/src/components/layout/layout.scss +107 -0
  51. package/src/global.d.ts +9 -0
  52. package/src/hooks/useScroll.tsx +71 -0
  53. package/src/hooks/useTimelineContext.tsx +6 -0
  54. package/src/index.ts +15 -0
  55. package/src/types/AvailableSpace.ts +6 -0
  56. package/src/types/CoreItem.ts +23 -0
  57. package/src/types/DateBounds.ts +4 -0
  58. package/src/types/Dimensions.ts +4 -0
  59. package/src/types/GrabInfo.ts +6 -0
  60. package/src/types/Grid.ts +6 -0
  61. package/src/types/ItemId.ts +1 -0
  62. package/src/types/OffsetBounds.ts +4 -0
  63. package/src/types/Pixels.ts +4 -0
  64. package/src/types/Position.ts +4 -0
  65. package/src/types/Rectangle.ts +6 -0
  66. package/src/types/SwimlaneId.ts +1 -0
  67. package/src/types/SwimlaneT.ts +6 -0
  68. package/src/types/TimeRange.ts +4 -0
  69. package/src/types/TimelineSettings.ts +11 -0
  70. package/src/types/index.ts +15 -0
  71. package/tsconfig.json +32 -0
  72. package/vite.config.ts +32 -0
@@ -0,0 +1,55 @@
1
+ # Simple workflow for deploying static content to GitHub Pages
2
+ name: Deploy static content to Pages
3
+
4
+ on:
5
+ # Runs on pushes targeting the default branch
6
+ push:
7
+ branches: ["main"]
8
+
9
+ # Allows you to run this workflow manually from the Actions tab
10
+ workflow_dispatch:
11
+
12
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13
+ permissions:
14
+ contents: read
15
+ pages: write
16
+ id-token: write
17
+
18
+ # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19
+ # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20
+ concurrency:
21
+ group: "pages"
22
+ cancel-in-progress: false
23
+
24
+ jobs:
25
+ # Single deploy job since we're just deploying
26
+ deploy:
27
+ environment:
28
+ name: github-pages
29
+ url: ${{ steps.deployment.outputs.page_url }}
30
+ runs-on: ubuntu-latest
31
+ defaults:
32
+ run:
33
+ working-directory: "./docs"
34
+ steps:
35
+ - name: Checkout
36
+ uses: actions/checkout@v4
37
+ - name: Set up Node
38
+ uses: actions/setup-node@v4
39
+ with:
40
+ node-version: lts/*
41
+ cache: "npm"
42
+ - name: Install dependencies
43
+ run: npm ci
44
+ - name: Build
45
+ run: npm run build
46
+ - name: Setup Pages
47
+ uses: actions/configure-pages@v5
48
+ - name: Upload artifact
49
+ uses: actions/upload-pages-artifact@v3
50
+ with:
51
+ # Upload entire repository
52
+ path: "./dist"
53
+ - name: Deploy to GitHub Pages
54
+ id: deployment
55
+ uses: actions/deploy-pages@v4
package/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # React + TypeScript + Vite
2
+
3
+ This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
+
5
+ Currently, two official plugins are available:
6
+
7
+ - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
8
+ - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9
+
10
+ ## Expanding the ESLint configuration
11
+
12
+ If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
13
+
14
+ ```js
15
+ export default tseslint.config({
16
+ extends: [
17
+ // Remove ...tseslint.configs.recommended and replace with this
18
+ ...tseslint.configs.recommendedTypeChecked,
19
+ // Alternatively, use this for stricter rules
20
+ ...tseslint.configs.strictTypeChecked,
21
+ // Optionally, add this for stylistic rules
22
+ ...tseslint.configs.stylisticTypeChecked,
23
+ ],
24
+ languageOptions: {
25
+ // other options...
26
+ parserOptions: {
27
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
28
+ tsconfigRootDir: import.meta.dirname,
29
+ },
30
+ },
31
+ })
32
+ ```
33
+
34
+ You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
35
+
36
+ ```js
37
+ // eslint.config.js
38
+ import reactX from 'eslint-plugin-react-x'
39
+ import reactDom from 'eslint-plugin-react-dom'
40
+
41
+ export default tseslint.config({
42
+ plugins: {
43
+ // Add the react-x and react-dom plugins
44
+ 'react-x': reactX,
45
+ 'react-dom': reactDom,
46
+ },
47
+ rules: {
48
+ // other rules...
49
+ // Enable its recommended typescript rules
50
+ ...reactX.configs['recommended-typescript'].rules,
51
+ ...reactDom.configs.recommended.rules,
52
+ },
53
+ })
54
+ ```
package/docs/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # React + TypeScript + Vite
2
+
3
+ This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
+
5
+ Currently, two official plugins are available:
6
+
7
+ - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
8
+ - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9
+
10
+ ## Expanding the ESLint configuration
11
+
12
+ If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
13
+
14
+ ```js
15
+ export default tseslint.config({
16
+ extends: [
17
+ // Remove ...tseslint.configs.recommended and replace with this
18
+ ...tseslint.configs.recommendedTypeChecked,
19
+ // Alternatively, use this for stricter rules
20
+ ...tseslint.configs.strictTypeChecked,
21
+ // Optionally, add this for stylistic rules
22
+ ...tseslint.configs.stylisticTypeChecked,
23
+ ],
24
+ languageOptions: {
25
+ // other options...
26
+ parserOptions: {
27
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
28
+ tsconfigRootDir: import.meta.dirname,
29
+ },
30
+ },
31
+ })
32
+ ```
33
+
34
+ You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
35
+
36
+ ```js
37
+ // eslint.config.js
38
+ import reactX from 'eslint-plugin-react-x'
39
+ import reactDom from 'eslint-plugin-react-dom'
40
+
41
+ export default tseslint.config({
42
+ plugins: {
43
+ // Add the react-x and react-dom plugins
44
+ 'react-x': reactX,
45
+ 'react-dom': reactDom,
46
+ },
47
+ rules: {
48
+ // other rules...
49
+ // Enable its recommended typescript rules
50
+ ...reactX.configs['recommended-typescript'].rules,
51
+ ...reactDom.configs.recommended.rules,
52
+ },
53
+ })
54
+ ```
@@ -0,0 +1,28 @@
1
+ import js from '@eslint/js'
2
+ import globals from 'globals'
3
+ import reactHooks from 'eslint-plugin-react-hooks'
4
+ import reactRefresh from 'eslint-plugin-react-refresh'
5
+ import tseslint from 'typescript-eslint'
6
+
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
+ },
27
+ },
28
+ )
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>react-timelane demo</title>
7
+ </head>
8
+ <body>
9
+ <div id="root"></div>
10
+ <script type="module" src="/src/main.tsx"></script>
11
+ </body>
12
+ </html>