@tracktor/design-system 4.28.0 → 4.29.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.
@@ -1,5 +1,6 @@
1
- import { ChipProps } from '@mui/material';
2
- import { CSSProperties, MouseEvent, ReactElement, ReactNode } from 'react';
1
+ import { CSSProperties } from 'react';
2
+ import { KanbanDataItemProps, KanbanProps } from './types';
3
+ export * from './types';
3
4
  type KanbanItemProps = {
4
5
  index: number;
5
6
  style: CSSProperties;
@@ -10,132 +11,6 @@ type KanbanItemProps = {
10
11
  items: KanbanDataItemProps[];
11
12
  };
12
13
  };
13
- export declare const VirtualizedKanbanItem: ({ index, style, data }: KanbanItemProps) => import("@emotion/react/jsx-runtime").JSX.Element;
14
- export type KanbanChipFormat = {
15
- color: ChipProps["color"];
16
- variant?: ChipProps["variant"];
17
- };
18
- export type HeaderColumnChip = Record<string, KanbanChipFormat>;
19
- /**
20
- * Mapping of booking statuses to their corresponding chip variants and colors.
21
- * This is used to style the status chips in the Kanban columns.
22
- */
23
- export declare const defaultKanbanChip: Record<string, KanbanChipFormat>;
24
- /**
25
- * Props for configuring the empty state of the Kanban component.
26
- */
27
- export interface EmptyStateProps {
28
- title: string;
29
- description?: string;
30
- buttonText?: string;
31
- onButtonClick?: () => void;
32
- }
33
- /**
34
- * Props for each subtitle item in a Kanban card.
35
- */
36
- export interface SubtitleDataItemProps {
37
- text: ReactNode;
38
- LeftIcon?: ReactElement;
39
- onClick?: (event: MouseEvent<HTMLElement>) => void;
40
- }
41
- /**
42
- * Props for each item in a Kanban column.
43
- * Each item represents a card in the Kanban board.
44
- */
45
- export interface KanbanDataItemProps {
46
- id: string;
47
- image: string | undefined;
48
- imageTitle?: string;
49
- secondaryImage?: string;
50
- secondaryImageText?: string;
51
- subtitles?: SubtitleDataItemProps[];
52
- tag: string;
53
- title: string;
54
- Footer?: ReactElement;
55
- Alert?: ReactElement;
56
- RightFooter?: ReactElement;
57
- headerTitle?: string;
58
- }
59
- /**
60
- * Props for each column in the Kanban board.
61
- * Each column contains multiple Kanban items.
62
- */
63
- export interface KanbanDataProps {
64
- name: string;
65
- label?: string;
66
- count?: number;
67
- isLoading?: boolean;
68
- isFetching?: boolean;
69
- isFetched?: boolean;
70
- items: KanbanDataItemProps[];
71
- }
72
- export interface KanbanProps {
73
- /**
74
- * The height of the Kanban component.
75
- */
76
- height?: string | number;
77
- /**
78
- * The width of each Kanban list.
79
- */
80
- listWidth?: string | number;
81
- /**
82
- * Disables the count of items in the Kanban list.
83
- */
84
- disableCount?: boolean;
85
- /**
86
- * Total number of items in the list. Note that only a few items will be rendered and displayed at a time.
87
- */
88
- itemCount?: number;
89
- /**
90
- * The number of items to display per page.
91
- */
92
- itemPerPage?: number;
93
- /**
94
- * Variant for the chip column.
95
- */
96
- chipColumVariant?: "filled" | "outlined";
97
- /**
98
- * If true, the Kanban column will display a dot indicator in the chip.
99
- */
100
- chipColumDot?: boolean;
101
- /**
102
- * Status of the chip in the Kanban column.
103
- */
104
- chipStatus?: string;
105
- /**
106
- * Function to load more items when the user scrolls to the end of the list.
107
- * @param startIndex
108
- * @param stopIndex
109
- * @param status
110
- */
111
- loadMoreItems?: (startIndex: number, stopIndex: number, status?: string) => Promise<void> | void;
112
- /**
113
- * Function triggered when an item is clicked.
114
- * @param id
115
- */
116
- onClickItem?: (id: string) => void;
117
- /**
118
- * Trigger when column is visible
119
- * @param listName
120
- */
121
- onColumnInView?: (name: string) => void;
122
- /**
123
- * The ID of the currently active item.
124
- */
125
- activeItemId?: string;
126
- /**
127
- * Custom mapping of booking statuses to chip variants/colors.
128
- * Keys can be any string, but the value must be { color, variant? }.
129
- */
130
- headerColumnChip?: HeaderColumnChip;
131
- /**
132
- * The Kanban data to be displayed.
133
- */
134
- data: KanbanDataProps[];
135
- /**
136
- * Optional empty state configuration.
137
- */
138
- emptyState?: ReactElement | EmptyStateProps;
139
- }
140
- declare const Kanban: ({ data, onClickItem, disableCount, onColumnInView, emptyState, chipColumVariant, chipStatus, headerColumnChip, activeItemId, chipColumDot, height, itemPerPage, listWidth, itemCount, loadMoreItems, }: KanbanProps) => import("@emotion/react/jsx-runtime").JSX.Element;
14
+ export declare const VirtualizedKanbanItem: ({ index, data }: KanbanItemProps) => import("@emotion/react/jsx-runtime").JSX.Element;
15
+ declare const Kanban: ({ data, onClickItem, disableCount, onColumnInView, emptyState, chipColumVariant, chipStatus, headerColumnChip, activeItemId, variant, chipColumDot, height, itemPerPage, listWidth, itemCount, loadMoreItems, }: KanbanProps) => import("@emotion/react/jsx-runtime").JSX.Element;
141
16
  export default Kanban;
@@ -1,6 +1,6 @@
1
1
  import { ChipProps } from '@mui/material';
2
2
  import { ReactElement } from 'react';
3
- import { defaultKanbanChip, HeaderColumnChip } from '../Kanban';
3
+ import { defaultKanbanChip, HeaderColumnChip } from '../types';
4
4
  interface ChipStatusProps {
5
5
  status?: keyof typeof defaultKanbanChip | keyof HeaderColumnChip | string;
6
6
  size?: ChipProps["size"];
@@ -1,4 +1,4 @@
1
- import { KanbanProps } from '../Kanban';
1
+ import { KanbanProps } from '../types';
2
2
  declare const EmptyStateOverlay: ({ emptyState }: {
3
3
  emptyState?: KanbanProps["emptyState"];
4
4
  }) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { KanbanCardVariant, KanbanDataItemProps } from '../types';
2
+ export interface KanbanCardProps {
3
+ item: KanbanDataItemProps;
4
+ activeItemId: string;
5
+ gutterSize: number;
6
+ onClickItem?: (id: string) => void;
7
+ variant?: KanbanCardVariant;
8
+ }
9
+ declare const KanbanCard: import('react').MemoExoticComponent<({ item, activeItemId, gutterSize, onClickItem, variant }: KanbanCardProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
10
+ export default KanbanCard;
@@ -0,0 +1,25 @@
1
+ import { HeaderColumnChip, KanbanCardVariant, KanbanDataItemProps } from '../types';
2
+ export interface KanbanColumnProps {
3
+ name: string;
4
+ label?: string;
5
+ count?: number;
6
+ items: KanbanDataItemProps[];
7
+ chipColumVariant?: "filled" | "outlined";
8
+ chipColumDot?: boolean;
9
+ chipStatus?: string;
10
+ isLoading?: boolean;
11
+ isFetching?: boolean;
12
+ gutterSize: number;
13
+ itemPerPage?: number;
14
+ listWidth: number | string;
15
+ disableCount?: boolean;
16
+ itemCount: number;
17
+ activeItemId: string;
18
+ onClickItem?: (id: string) => void;
19
+ loadMoreItems?: (startIndex: number, stopIndex: number, status?: string) => void;
20
+ onInView?: (name: string) => void;
21
+ headerColumnChip?: HeaderColumnChip;
22
+ variant?: KanbanCardVariant;
23
+ }
24
+ declare const KanbanColumn: import('react').MemoExoticComponent<({ name, label, count, items, isFetching, isLoading, gutterSize, itemPerPage, listWidth, disableCount, loadMoreItems, itemCount, activeItemId, onClickItem, onInView, chipColumVariant, chipColumDot, chipStatus, headerColumnChip, variant, }: KanbanColumnProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
25
+ export default KanbanColumn;
@@ -1,6 +1,5 @@
1
1
  import { MouseEvent, RefObject } from 'react';
2
2
  declare const useDragScroll: (ref: RefObject<HTMLDivElement | null>) => {
3
- isDragging: boolean;
4
3
  onMouseDown: (e: MouseEvent<HTMLElement>) => void;
5
4
  onMouseMove: (e: MouseEvent<HTMLElement>) => void;
6
5
  onMouseUp: () => void;
@@ -0,0 +1,133 @@
1
+ import { ChipProps } from '@mui/material';
2
+ import { MouseEvent, ReactElement, ReactNode } from 'react';
3
+ export type KanbanCardVariant = "primary" | "secondary";
4
+ export type KanbanChipFormat = {
5
+ color: ChipProps["color"];
6
+ variant?: ChipProps["variant"];
7
+ };
8
+ export type HeaderColumnChip = Record<string, KanbanChipFormat>;
9
+ /**
10
+ * Mapping of booking statuses to their corresponding chip variants and colors.
11
+ * This is used to style the status chips in the Kanban columns.
12
+ */
13
+ export declare const defaultKanbanChip: Record<string, KanbanChipFormat>;
14
+ /**
15
+ * Props for configuring the empty state of the Kanban component.
16
+ */
17
+ export interface EmptyStateProps {
18
+ title: string;
19
+ description?: string;
20
+ buttonText?: string;
21
+ onButtonClick?: () => void;
22
+ }
23
+ /**
24
+ * Props for each subtitle item in a Kanban card.
25
+ */
26
+ export interface SubtitleDataItemProps {
27
+ text: ReactNode;
28
+ LeftIcon?: ReactElement;
29
+ onClick?: (event: MouseEvent<HTMLElement>) => void;
30
+ }
31
+ /**
32
+ * Props for each item in a Kanban column.
33
+ * Each item represents a card in the Kanban board.
34
+ */
35
+ export interface KanbanDataItemProps {
36
+ id: string;
37
+ image: string | undefined;
38
+ imageTitle?: string;
39
+ headerTitle?: string;
40
+ title: string;
41
+ secondaryImage?: string;
42
+ secondaryImageText?: string;
43
+ subtitles?: SubtitleDataItemProps[];
44
+ tag: string;
45
+ Footer?: ReactElement;
46
+ RightFooter?: ReactElement;
47
+ }
48
+ /**
49
+ * Props for each column in the Kanban board.
50
+ * Each column contains multiple Kanban items.
51
+ */
52
+ export interface KanbanDataProps {
53
+ name: string;
54
+ label?: string;
55
+ count?: number;
56
+ isLoading?: boolean;
57
+ isFetching?: boolean;
58
+ isFetched?: boolean;
59
+ items: KanbanDataItemProps[];
60
+ }
61
+ export interface KanbanProps {
62
+ /**
63
+ * The height of the Kanban component.
64
+ */
65
+ height?: string | number;
66
+ /**
67
+ * The width of each Kanban list.
68
+ */
69
+ listWidth?: string | number;
70
+ /**
71
+ * Disables the count of items in the Kanban list.
72
+ */
73
+ disableCount?: boolean;
74
+ /**
75
+ * Total number of items in the list. Note that only a few items will be rendered and displayed at a time.
76
+ */
77
+ itemCount?: number;
78
+ /**
79
+ * The number of items to display per page.
80
+ */
81
+ itemPerPage?: number;
82
+ /**
83
+ * Variant for the chip column.
84
+ */
85
+ chipColumVariant?: "filled" | "outlined";
86
+ /**
87
+ * If true, the Kanban column will display a dot indicator in the chip.
88
+ */
89
+ chipColumDot?: boolean;
90
+ /**
91
+ * Status of the chip in the Kanban column.
92
+ */
93
+ chipStatus?: string;
94
+ /**
95
+ * Function to load more items when the user scrolls to the end of the list.
96
+ * @param startIndex
97
+ * @param stopIndex
98
+ * @param status
99
+ */
100
+ loadMoreItems?: (startIndex: number, stopIndex: number, status?: string) => Promise<void> | void;
101
+ /**
102
+ * Function triggered when an item is clicked.
103
+ * @param id
104
+ */
105
+ onClickItem?: (id: string) => void;
106
+ /**
107
+ * Trigger when column is visible
108
+ * @param listName
109
+ */
110
+ onColumnInView?: (name: string) => void;
111
+ /**
112
+ * The ID of the currently active item.
113
+ */
114
+ activeItemId?: string;
115
+ /**
116
+ * Custom mapping of booking statuses to chip variants/colors.
117
+ * Keys can be any string, but the value must be { color, variant? }.
118
+ */
119
+ headerColumnChip?: HeaderColumnChip;
120
+ /**
121
+ * The Kanban data to be displayed.
122
+ */
123
+ data: KanbanDataProps[];
124
+ /**
125
+ * Variant of the Kanban cards.
126
+ * @default "primary"
127
+ */
128
+ variant?: KanbanCardVariant;
129
+ /**
130
+ * Optional empty state configuration.
131
+ */
132
+ emptyState?: ReactElement | EmptyStateProps;
133
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tracktor/design-system",
3
3
  "description": "Tracktor Design System",
4
4
  "sideEffects": false,
5
- "version": "4.28.0",
5
+ "version": "4.29.0",
6
6
  "license": "ISC",
7
7
  "type": "module",
8
8
  "types": "./dist/src/main.d.ts",
@@ -83,8 +83,8 @@
83
83
  "@emotion/react": "^11.0.0",
84
84
  "@emotion/styled": "^11.0.0",
85
85
  "@mui/material": "^7.0.0",
86
- "@tanstack/react-virtual": "^3.13.13",
87
- "@tracktor/react-utils": "^1.24.0"
86
+ "@tanstack/react-virtual": "^3.13.23",
87
+ "@tracktor/react-utils": "^1.28.1"
88
88
  },
89
89
  "peerDependencies": {
90
90
  "@emotion/react": ">=11.0.0",