@devalok/shilp-sutra-karm 0.18.0 → 0.19.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.
- package/dist/_chunks/task-detail-panel.js +1339 -1144
- package/dist/tasks/activity-tab.d.ts +2 -11
- package/dist/tasks/activity-tab.d.ts.map +1 -1
- package/dist/tasks/conversation-tab.d.ts +2 -21
- package/dist/tasks/conversation-tab.d.ts.map +1 -1
- package/dist/tasks/files-tab.d.ts +2 -18
- package/dist/tasks/files-tab.d.ts.map +1 -1
- package/dist/tasks/index.d.ts +12 -6
- package/dist/tasks/index.d.ts.map +1 -1
- package/dist/tasks/index.js +765 -8
- package/dist/tasks/pickers/index.d.ts +16 -0
- package/dist/tasks/pickers/index.d.ts.map +1 -0
- package/dist/tasks/pickers/task-assignee-picker.d.ts +14 -0
- package/dist/tasks/pickers/task-assignee-picker.d.ts.map +1 -0
- package/dist/tasks/pickers/task-column-picker.d.ts +13 -0
- package/dist/tasks/pickers/task-column-picker.d.ts.map +1 -0
- package/dist/tasks/pickers/task-date-picker.d.ts +12 -0
- package/dist/tasks/pickers/task-date-picker.d.ts.map +1 -0
- package/dist/tasks/pickers/task-label-editor.d.ts +13 -0
- package/dist/tasks/pickers/task-label-editor.d.ts.map +1 -0
- package/dist/tasks/pickers/task-member-picker.d.ts +14 -0
- package/dist/tasks/pickers/task-member-picker.d.ts.map +1 -0
- package/dist/tasks/pickers/task-priority-picker.d.ts +12 -0
- package/dist/tasks/pickers/task-priority-picker.d.ts.map +1 -0
- package/dist/tasks/pickers/task-visibility-picker.d.ts +13 -0
- package/dist/tasks/pickers/task-visibility-picker.d.ts.map +1 -0
- package/dist/tasks/review-tab.d.ts +4 -20
- package/dist/tasks/review-tab.d.ts.map +1 -1
- package/dist/tasks/subtasks-tab.d.ts +2 -18
- package/dist/tasks/subtasks-tab.d.ts.map +1 -1
- package/dist/tasks/tabs/activity-entry.d.ts +9 -0
- package/dist/tasks/tabs/activity-entry.d.ts.map +1 -0
- package/dist/tasks/tabs/activity-timeline.d.ts +8 -0
- package/dist/tasks/tabs/activity-timeline.d.ts.map +1 -0
- package/dist/tasks/tabs/file-drop-zone.d.ts +10 -0
- package/dist/tasks/tabs/file-drop-zone.d.ts.map +1 -0
- package/dist/tasks/tabs/file-item.d.ts +11 -0
- package/dist/tasks/tabs/file-item.d.ts.map +1 -0
- package/dist/tasks/tabs/file-list.d.ts +8 -0
- package/dist/tasks/tabs/file-list.d.ts.map +1 -0
- package/dist/tasks/tabs/index.d.ts +34 -0
- package/dist/tasks/tabs/index.d.ts.map +1 -0
- package/dist/tasks/tabs/message-bubble.d.ts +14 -0
- package/dist/tasks/tabs/message-bubble.d.ts.map +1 -0
- package/dist/tasks/tabs/message-input.d.ts +16 -0
- package/dist/tasks/tabs/message-input.d.ts.map +1 -0
- package/dist/tasks/tabs/message-list.d.ts +9 -0
- package/dist/tasks/tabs/message-list.d.ts.map +1 -0
- package/dist/tasks/tabs/review-card.d.ts +10 -0
- package/dist/tasks/tabs/review-card.d.ts.map +1 -0
- package/dist/tasks/tabs/review-request-button.d.ts +10 -0
- package/dist/tasks/tabs/review-request-button.d.ts.map +1 -0
- package/dist/tasks/tabs/review-response-form.d.ts +11 -0
- package/dist/tasks/tabs/review-response-form.d.ts.map +1 -0
- package/dist/tasks/tabs/subtask-add-form.d.ts +9 -0
- package/dist/tasks/tabs/subtask-add-form.d.ts.map +1 -0
- package/dist/tasks/tabs/subtask-item.d.ts +12 -0
- package/dist/tasks/tabs/subtask-item.d.ts.map +1 -0
- package/dist/tasks/tabs/subtask-list.d.ts +8 -0
- package/dist/tasks/tabs/subtask-list.d.ts.map +1 -0
- package/dist/tasks/tabs/subtask-progress.d.ts +9 -0
- package/dist/tasks/tabs/subtask-progress.d.ts.map +1 -0
- package/dist/tasks/tabs/visibility-warning.d.ts +7 -0
- package/dist/tasks/tabs/visibility-warning.d.ts.map +1 -0
- package/dist/tasks/task-panel.d.ts +104 -0
- package/dist/tasks/task-panel.d.ts.map +1 -0
- package/dist/tasks/task-properties.d.ts +2 -12
- package/dist/tasks/task-properties.d.ts.map +1 -1
- package/dist/tasks/task-types.d.ts +104 -0
- package/dist/tasks/task-types.d.ts.map +1 -0
- package/docs/components/admin/admin-dashboard.md +215 -0
- package/docs/components/admin/admin-types.md +167 -0
- package/docs/components/admin/admin-utils.md +165 -0
- package/docs/components/admin/break-admin.md +167 -0
- package/docs/components/board/board-column.md +35 -0
- package/docs/components/board/board-provider.md +89 -0
- package/docs/components/board/board-toolbar.md +36 -0
- package/docs/components/board/board-types.md +62 -0
- package/docs/components/board/bulk-action-bar.md +38 -0
- package/docs/components/board/column-empty.md +33 -0
- package/docs/components/board/column-header.md +36 -0
- package/docs/components/board/kanban-board.md +53 -0
- package/docs/components/board/task-card.md +62 -0
- package/docs/components/board/task-context-menu.md +36 -0
- package/docs/components/chat/chat-input.md +37 -0
- package/docs/components/chat/chat-panel.md +58 -0
- package/docs/components/chat/conversation-list.md +47 -0
- package/docs/components/chat/message-list.md +44 -0
- package/docs/components/chat/streaming-text.md +29 -0
- package/docs/components/client/accent-provider.md +29 -0
- package/docs/components/client/client-portal-header.md +40 -0
- package/docs/components/client/project-card.md +39 -0
- package/docs/components/dashboard/attendance-cta.md +47 -0
- package/docs/components/dashboard/daily-brief.md +45 -0
- package/docs/components/dashboard/scratchpad-widget.md +52 -0
- package/docs/components/dashboard/sidebar-scratchpad.md +39 -0
- package/docs/components/other/karm-command-registry.md +61 -0
- package/docs/components/other/page-skeletons.md +52 -0
- package/docs/components/tasks/activity-tab.md +45 -0
- package/docs/components/tasks/conversation-tab.md +56 -0
- package/docs/components/tasks/files-tab.md +55 -0
- package/docs/components/tasks/review-tab.md +53 -0
- package/docs/components/tasks/subtasks-tab.md +61 -0
- package/docs/components/tasks/task-assignee-picker.md +36 -0
- package/docs/components/tasks/task-column-picker.md +37 -0
- package/docs/components/tasks/task-date-picker.md +49 -0
- package/docs/components/tasks/task-detail-panel.md +275 -0
- package/docs/components/tasks/task-label-editor.md +42 -0
- package/docs/components/tasks/task-member-picker.md +35 -0
- package/docs/components/tasks/task-panel.md +89 -0
- package/docs/components/tasks/task-priority-picker.md +37 -0
- package/docs/components/tasks/task-properties.md +84 -0
- package/docs/components/tasks/task-visibility-picker.md +38 -0
- package/llms.txt +40 -13
- package/package.json +82 -80
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Admin Utilities
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra-karm/admin
|
|
4
|
+
- Server-safe: Partial (date/emoji utils are server-safe; renderAdjustmentType and renderStatus return JSX)
|
|
5
|
+
- Category: admin
|
|
6
|
+
|
|
7
|
+
Utility functions for date formatting, status rendering, and emoji handling.
|
|
8
|
+
|
|
9
|
+
Exports: AdjustmentType, renderAdjustmentType, renderStatus, formatDate, formatDateIST, formatTimeIST, formatDateWithWeekday, formatOptionalDate, getDaySuffix, isSameDay, getWeekDays, getMonthDays, getStartOfDay, getEndOfDay, removeAllEmojis, removeEmojiAtStart
|
|
10
|
+
|
|
11
|
+
## Functions
|
|
12
|
+
|
|
13
|
+
### renderAdjustmentType
|
|
14
|
+
```ts
|
|
15
|
+
function renderAdjustmentType(type: keyof typeof AdjustmentType): JSX.Element
|
|
16
|
+
```
|
|
17
|
+
Maps an adjustment type key to a human-readable label wrapped in a `<div>`.
|
|
18
|
+
|
|
19
|
+
### AdjustmentType (constant)
|
|
20
|
+
```ts
|
|
21
|
+
const AdjustmentType = {
|
|
22
|
+
YEARLY_BALANCE: 'YEARLY_BALANCE',
|
|
23
|
+
CARRY_FORWARD: 'CARRY_FORWARD',
|
|
24
|
+
CASHOUT: 'CASHOUT',
|
|
25
|
+
OTHER: 'OTHER',
|
|
26
|
+
} as const
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### renderStatus
|
|
30
|
+
```ts
|
|
31
|
+
function renderStatus(status: string, correction?: boolean): ReactNode
|
|
32
|
+
```
|
|
33
|
+
Returns a `<Badge>` with color and label based on status. When `correction=true`, uses correction-specific labels (e.g. "Corrected" instead of "Approved", "Denied" instead of "Rejected").
|
|
34
|
+
|
|
35
|
+
Status map (default): APPROVED=success "Approved", PENDING=warning "Pending", REJECTED=error "Denied", CANCELLED=error "Redacted", MISSING=error "Missed"
|
|
36
|
+
|
|
37
|
+
Status map (correction): APPROVED=accent "Corrected", PENDING=warning "Pending", REJECTED=error "Denied", MISSING=error "Missed"
|
|
38
|
+
|
|
39
|
+
### formatDate
|
|
40
|
+
```ts
|
|
41
|
+
function formatDate(date: Date | string): string
|
|
42
|
+
```
|
|
43
|
+
Formats to IST locale short date, e.g. `"14 Mar '26"`. Uses `en-IN` locale with `Asia/Kolkata` timezone.
|
|
44
|
+
|
|
45
|
+
### formatDateIST
|
|
46
|
+
```ts
|
|
47
|
+
function formatDateIST(date: Date | string, options?: Intl.DateTimeFormatOptions): string
|
|
48
|
+
```
|
|
49
|
+
Formats date to IST locale string with custom options. Defaults to `Asia/Kolkata` timezone.
|
|
50
|
+
|
|
51
|
+
### formatTimeIST
|
|
52
|
+
```ts
|
|
53
|
+
function formatTimeIST(date: Date | string, options?: Intl.DateTimeFormatOptions): string
|
|
54
|
+
```
|
|
55
|
+
Formats time to IST locale string with custom options. Defaults to `Asia/Kolkata` timezone.
|
|
56
|
+
|
|
57
|
+
### formatDateWithWeekday
|
|
58
|
+
```ts
|
|
59
|
+
function formatDateWithWeekday(date: Date): string
|
|
60
|
+
```
|
|
61
|
+
Returns formatted date with weekday, e.g. `"14 Mar '26, Thursday"`.
|
|
62
|
+
|
|
63
|
+
### formatOptionalDate
|
|
64
|
+
```ts
|
|
65
|
+
function formatOptionalDate(date: Date | string | '-'): string
|
|
66
|
+
```
|
|
67
|
+
Like `formatDate` but returns `"-"` if input is `"-"`.
|
|
68
|
+
|
|
69
|
+
### getDaySuffix
|
|
70
|
+
```ts
|
|
71
|
+
function getDaySuffix(day: number): string
|
|
72
|
+
```
|
|
73
|
+
Returns day with ordinal suffix: `1` -> `"1st"`, `2` -> `"2nd"`, `11` -> `"11th"`, etc.
|
|
74
|
+
|
|
75
|
+
### isSameDay
|
|
76
|
+
```ts
|
|
77
|
+
function isSameDay(date1: Date, date2: Date): boolean
|
|
78
|
+
```
|
|
79
|
+
Checks if two dates are the same calendar day. Returns `false` if either argument is not a valid Date.
|
|
80
|
+
|
|
81
|
+
### getWeekDays
|
|
82
|
+
```ts
|
|
83
|
+
function getWeekDays(currentDate: string | Date, selectedDate: string | Date): WeekDay[]
|
|
84
|
+
```
|
|
85
|
+
Returns 7-day array (Sun-Sat) for the week containing `currentDate`. Each entry has `{ day, date, fullDate, isToday, isActive, hasBreak?, isAbsent? }`.
|
|
86
|
+
|
|
87
|
+
### getMonthDays
|
|
88
|
+
```ts
|
|
89
|
+
function getMonthDays(currentDate: Date | string, selectedDate: Date | string): MonthDay[]
|
|
90
|
+
```
|
|
91
|
+
Returns full month grid including padding days from adjacent months. Each entry has `{ day, date, fullDate, isToday, isActive, isPadding }`.
|
|
92
|
+
|
|
93
|
+
### getStartOfDay
|
|
94
|
+
```ts
|
|
95
|
+
function getStartOfDay(date?: Date): Date
|
|
96
|
+
```
|
|
97
|
+
Returns start of day (00:00:00.000). Defaults to current date.
|
|
98
|
+
|
|
99
|
+
### getEndOfDay
|
|
100
|
+
```ts
|
|
101
|
+
function getEndOfDay(date?: Date): Date
|
|
102
|
+
```
|
|
103
|
+
Returns end of day (23:59:59.999). Defaults to current date.
|
|
104
|
+
|
|
105
|
+
### removeAllEmojis
|
|
106
|
+
```ts
|
|
107
|
+
function removeAllEmojis(text?: string): string
|
|
108
|
+
```
|
|
109
|
+
Strips all emoji characters from a string. Returns `""` if input is undefined.
|
|
110
|
+
|
|
111
|
+
### removeEmojiAtStart
|
|
112
|
+
```ts
|
|
113
|
+
function removeEmojiAtStart(text: string): string
|
|
114
|
+
```
|
|
115
|
+
Strips emoji characters only from the beginning of a string.
|
|
116
|
+
|
|
117
|
+
### ApprovedAdjustments (ApprovedAdjustmentsProps) — component
|
|
118
|
+
adjustments: Adjustment[] (REQUIRED)
|
|
119
|
+
adminId: string (REQUIRED)
|
|
120
|
+
...HTMLDivElement attributes
|
|
121
|
+
|
|
122
|
+
Renders a table of approved adjustments showing user, date, days, type, reason, and approver. Displays "You" for self-approved items.
|
|
123
|
+
|
|
124
|
+
## Example
|
|
125
|
+
```jsx
|
|
126
|
+
import {
|
|
127
|
+
renderStatus,
|
|
128
|
+
renderAdjustmentType,
|
|
129
|
+
formatDate,
|
|
130
|
+
formatDateIST,
|
|
131
|
+
removeAllEmojis,
|
|
132
|
+
ApprovedAdjustments,
|
|
133
|
+
} from '@devalok/shilp-sutra-karm/admin'
|
|
134
|
+
|
|
135
|
+
// Render a status badge
|
|
136
|
+
{renderStatus('APPROVED')} // -> <Badge color="success">Approved</Badge>
|
|
137
|
+
{renderStatus('PENDING', true)} // -> <Badge color="warning">Pending</Badge>
|
|
138
|
+
|
|
139
|
+
// Render adjustment type
|
|
140
|
+
{renderAdjustmentType('CASHOUT')} // -> <div>Cashout</div>
|
|
141
|
+
|
|
142
|
+
// Format dates
|
|
143
|
+
formatDate(new Date()) // "14 Mar '26"
|
|
144
|
+
formatDateIST(new Date(), { weekday: 'long' }) // "Thursday"
|
|
145
|
+
formatDateWithWeekday(new Date()) // "14 Mar '26, Thursday"
|
|
146
|
+
getDaySuffix(3) // "3rd"
|
|
147
|
+
|
|
148
|
+
// Clean emoji text
|
|
149
|
+
removeAllEmojis("Hello World") // "Hello World"
|
|
150
|
+
removeEmojiAtStart("Hello") // "Hello"
|
|
151
|
+
|
|
152
|
+
// Approved adjustments table
|
|
153
|
+
<ApprovedAdjustments adjustments={approvedList} adminId="admin-1" />
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Gotchas
|
|
157
|
+
- All date functions use `Asia/Kolkata` timezone and `en-IN` locale by default
|
|
158
|
+
- `renderAdjustmentType` and `renderStatus` return JSX — call them as functions, not as components
|
|
159
|
+
- `renderStatus` falls back to the REJECTED config for unknown status values
|
|
160
|
+
- `getWeekDays` starts weeks on Sunday (weekStartsOn: 0)
|
|
161
|
+
- `getMonthDays` includes padding days from previous/next months with `isPadding: true`
|
|
162
|
+
|
|
163
|
+
## Changes
|
|
164
|
+
### v0.9.0
|
|
165
|
+
- **Added** Initial release with all admin utility functions
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# BreakAdmin
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra-karm/admin
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: admin
|
|
6
|
+
|
|
7
|
+
Compound component for break/leave management admin page. Uses React Context internally.
|
|
8
|
+
Supports both compound usage (with children) and default layout (without children).
|
|
9
|
+
|
|
10
|
+
Exports: BreakAdmin (compound), BreakAdminHeader, Breaks, LeaveRequest, BreakBalance, EditBreak, EditBreakBalance, DeleteBreak, BreakAdminSkeleton
|
|
11
|
+
|
|
12
|
+
## Props
|
|
13
|
+
|
|
14
|
+
### BreakAdmin.Root / BreakAdmin (BreakAdminProps)
|
|
15
|
+
currentUser: Pick<AdminUser, "id" | "name" | "role"> (REQUIRED)
|
|
16
|
+
breaks: BreakRequest[] (REQUIRED)
|
|
17
|
+
pendingRequests: BreakRequest[] (REQUIRED)
|
|
18
|
+
cashoutRequests: BreakRequest[] (default: [])
|
|
19
|
+
breakBalanceData: BreakBalanceData[] (REQUIRED)
|
|
20
|
+
breakBalance: { remainingDays: number; breakBalance: number } | null
|
|
21
|
+
userImages: Record<string, string> (REQUIRED)
|
|
22
|
+
users: AdminUser[] (REQUIRED)
|
|
23
|
+
isLoading: boolean (default: false)
|
|
24
|
+
isLoadingBreaks: boolean (default: false)
|
|
25
|
+
isLoadingRequests: boolean (default: false)
|
|
26
|
+
isLoadingBalance: boolean (default: false)
|
|
27
|
+
existingBreaks?: BreakRequest[]
|
|
28
|
+
filters?: BreakAdminFilters
|
|
29
|
+
onFilterChange?: (filters: BreakAdminFilters) => void
|
|
30
|
+
onApproveRequest?: (requestId: string, comment?: string, isCorrection?: boolean, request?: BreakRequest) => void
|
|
31
|
+
onRejectRequest?: (requestId: string, comment?: string, isCorrection?: boolean, request?: BreakRequest) => void
|
|
32
|
+
onApproveCashout?: (requestId: string) => void
|
|
33
|
+
onRejectCashout?: (requestId: string) => void
|
|
34
|
+
onRefresh?: () => void
|
|
35
|
+
onSaveBreak?: (data: { requestId: string; userId: string; status: string; adminComment: string; startDate: string; endDate: string; isEditing: boolean }) => void
|
|
36
|
+
onDeleteBreak?: () => void
|
|
37
|
+
onSaveBalance?: (data: { userId: string; cashOutDays: number; carryForward: number; year: number }) => void
|
|
38
|
+
onFetchMonthBreaks?: (month: number, year: number) => Promise<BreakRequest[]>
|
|
39
|
+
realtimeCallbacks?: RealtimeCallbacks
|
|
40
|
+
children?: ReactNode
|
|
41
|
+
...HTMLDivElement attributes
|
|
42
|
+
|
|
43
|
+
### BreakAdmin.Header
|
|
44
|
+
...HTMLDivElement attributes (className, etc.)
|
|
45
|
+
Reads from context: filters, breakBalance, userImages, users
|
|
46
|
+
|
|
47
|
+
### BreakAdmin.TabBar
|
|
48
|
+
...HTMLDivElement attributes
|
|
49
|
+
Reads from context: activeTab, pendingRequests, breakBalanceData
|
|
50
|
+
|
|
51
|
+
### BreakAdmin.BreaksPanel
|
|
52
|
+
...HTMLDivElement attributes
|
|
53
|
+
Reads from context: breaks, userImages, existingBreaks, onFetchMonthBreaks, onSaveBreak, onDeleteBreak, onRefresh
|
|
54
|
+
|
|
55
|
+
### BreakAdmin.RequestsPanel
|
|
56
|
+
...HTMLDivElement attributes
|
|
57
|
+
Reads from context: pendingRequests, userImages, approve/reject handlers
|
|
58
|
+
|
|
59
|
+
### BreakAdmin.BalancePanel
|
|
60
|
+
...HTMLDivElement attributes
|
|
61
|
+
Reads from context: breakBalanceData, userImages, onSaveBalance
|
|
62
|
+
|
|
63
|
+
### BreakAdminHeader (BreakAdminHeaderProps) — standalone
|
|
64
|
+
filters: BreakAdminFilters (REQUIRED)
|
|
65
|
+
onFilterChange: (filters: BreakAdminFilters) => void (REQUIRED)
|
|
66
|
+
breakBalance: { remainingDays: number; breakBalance: number } | null
|
|
67
|
+
userImages: Record<string, string> (REQUIRED)
|
|
68
|
+
users: AdminUser[] (REQUIRED)
|
|
69
|
+
...HTMLDivElement attributes
|
|
70
|
+
|
|
71
|
+
### Breaks (BreaksProps) — standalone
|
|
72
|
+
breaks: BreakRequest[] (REQUIRED)
|
|
73
|
+
userImages: Record<string, string> (REQUIRED)
|
|
74
|
+
existingBreaks: BreakRequest[]
|
|
75
|
+
onFetchMonthBreaks: (month: number, year: number) => Promise<BreakRequest[]>
|
|
76
|
+
onSave: (data: { requestId: string; userId: string; status: string; adminComment: string; startDate: string; endDate: string; isEditing: boolean }) => void
|
|
77
|
+
onDelete: () => void
|
|
78
|
+
onRefresh: () => void
|
|
79
|
+
...HTMLDivElement attributes
|
|
80
|
+
|
|
81
|
+
### LeaveRequest (LeaveRequestProps) — standalone
|
|
82
|
+
request: BreakRequest (REQUIRED)
|
|
83
|
+
userImages: Record<string, string> (REQUIRED)
|
|
84
|
+
handleRejectRequest: (event: MouseEvent | undefined, id: string, comment?: string) => void (REQUIRED)
|
|
85
|
+
handleApproveRequest: (event: MouseEvent | undefined, id: string, comment?: string) => void (REQUIRED)
|
|
86
|
+
commentBoxOpen: boolean (REQUIRED)
|
|
87
|
+
onCommentBoxClose: () => void (REQUIRED)
|
|
88
|
+
clickedAction: "approve" | "reject" | null (REQUIRED)
|
|
89
|
+
userId: string (REQUIRED)
|
|
90
|
+
...HTMLDivElement attributes
|
|
91
|
+
|
|
92
|
+
### BreakBalance (BreakBalanceProps) — standalone
|
|
93
|
+
breakBalanceData: BreakBalanceData[] (REQUIRED)
|
|
94
|
+
userImages: Record<string, string> (REQUIRED)
|
|
95
|
+
onSaveBalance: (data: { userId: string; cashOutDays: number; carryForward: number; year: number }) => void
|
|
96
|
+
...HTMLDivElement attributes
|
|
97
|
+
|
|
98
|
+
### EditBreak (EditBreakProps) — standalone
|
|
99
|
+
selectedLeave: BreakRequest & { numberOfDays: number } (REQUIRED)
|
|
100
|
+
existingBreaks: BreakRequest[]
|
|
101
|
+
onFetchMonthBreaks: (month: number, year: number) => Promise<BreakRequest[]>
|
|
102
|
+
onSave: (data: { requestId: string; userId: string; status: string; adminComment: string; startDate: string; endDate: string; isEditing: boolean }) => void
|
|
103
|
+
onDelete: () => void
|
|
104
|
+
...HTMLDivElement attributes
|
|
105
|
+
|
|
106
|
+
### EditBreakBalance (EditBreakBalanceProps) — standalone
|
|
107
|
+
selectedLeave: BreakBalanceData (REQUIRED)
|
|
108
|
+
onSave: (data: { userId: string; cashOutDays: number; carryForward: number; year: number }) => void
|
|
109
|
+
...HTMLDivElement attributes
|
|
110
|
+
|
|
111
|
+
### DeleteBreak (DeleteBreakProps) — standalone
|
|
112
|
+
id: string (REQUIRED)
|
|
113
|
+
userId: string (REQUIRED)
|
|
114
|
+
onDelete: () => void
|
|
115
|
+
...HTMLDivElement attributes
|
|
116
|
+
|
|
117
|
+
### BreakAdminSkeleton
|
|
118
|
+
...HTMLDivElement attributes (className, etc.)
|
|
119
|
+
|
|
120
|
+
## Supporting Types
|
|
121
|
+
BreakAdminFilters: { selectedAssociate: AdminUser | null; dateFilterStart: string | Date | null; dateFilterEnd: string | Date | null; currMonth: number; currYear: number; isOpen: boolean }
|
|
122
|
+
|
|
123
|
+
## Defaults
|
|
124
|
+
isLoading=false, cashoutRequests=[], isLoadingBreaks=false, isLoadingRequests=false, isLoadingBalance=false
|
|
125
|
+
|
|
126
|
+
## Example
|
|
127
|
+
```jsx
|
|
128
|
+
// Default layout (no children needed)
|
|
129
|
+
<BreakAdmin
|
|
130
|
+
currentUser={{ id: "admin-1", name: "Admin", role: "Admin" }}
|
|
131
|
+
breaks={allBreaks}
|
|
132
|
+
pendingRequests={pending}
|
|
133
|
+
breakBalanceData={balanceData}
|
|
134
|
+
userImages={imageMap}
|
|
135
|
+
users={allUsers}
|
|
136
|
+
isLoading={isLoading}
|
|
137
|
+
onApproveRequest={handleApprove}
|
|
138
|
+
onRejectRequest={handleReject}
|
|
139
|
+
onSaveBreak={handleSaveBreak}
|
|
140
|
+
onSaveBalance={handleSaveBalance}
|
|
141
|
+
/>
|
|
142
|
+
|
|
143
|
+
// Compound layout (custom arrangement)
|
|
144
|
+
<BreakAdmin.Root currentUser={user} breaks={b} pendingRequests={p} breakBalanceData={bd} userImages={ui} users={u}>
|
|
145
|
+
<BreakAdmin.Header />
|
|
146
|
+
<BreakAdmin.TabBar />
|
|
147
|
+
<BreakAdmin.BreaksPanel />
|
|
148
|
+
<BreakAdmin.RequestsPanel />
|
|
149
|
+
<BreakAdmin.BalancePanel />
|
|
150
|
+
</BreakAdmin.Root>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Gotchas
|
|
154
|
+
- Without children, renders the default layout (Header + TabBar + all three panels)
|
|
155
|
+
- With children, renders only the provided sub-components — you control the layout
|
|
156
|
+
- Approve/reject with Cmd/Ctrl+click opens a comment box before confirming
|
|
157
|
+
- `BreakAdmin.BreaksPanel` only renders when `activeTab === "breaks"`
|
|
158
|
+
- `BreakAdmin.RequestsPanel` only renders when `activeTab === "requests"`
|
|
159
|
+
- `BreakAdmin.BalancePanel` only renders when `activeTab === "balance"`
|
|
160
|
+
- `isLoading=true` renders `BreakAdminSkeleton` instead of children
|
|
161
|
+
- `onApproveRequest` receives `isCorrection` boolean and the full `request` object as 3rd/4th args
|
|
162
|
+
- Toast notifications fire automatically on approve/reject success or error
|
|
163
|
+
|
|
164
|
+
## Changes
|
|
165
|
+
### v0.9.0
|
|
166
|
+
- **Added** Compound component API replacing monolith
|
|
167
|
+
- **Added** Standalone exports for BreakAdminHeader, Breaks, LeaveRequest, BreakBalance, EditBreak, EditBreakBalance, DeleteBreak
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# BoardColumn
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra-karm/board
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: board
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
column: BoardColumn (REQUIRED)
|
|
9
|
+
index: number (REQUIRED)
|
|
10
|
+
isOverlay: boolean
|
|
11
|
+
dragPreview: { taskId: string; columnId: string; index: number }
|
|
12
|
+
draggedTask: BoardTask | null
|
|
13
|
+
...HTMLAttributes<HTMLDivElement>
|
|
14
|
+
|
|
15
|
+
## Defaults
|
|
16
|
+
isOverlay=undefined, dragPreview=undefined, draggedTask=undefined
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
```jsx
|
|
20
|
+
<BoardColumn column={column} index={0} />
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Gotchas
|
|
24
|
+
- Must be rendered inside a BoardProvider context.
|
|
25
|
+
- Reads viewMode from context to switch between TaskCard and TaskCardCompact.
|
|
26
|
+
- Renders ColumnHeader, TaskContextMenu wrappers, and ColumnEmpty automatically.
|
|
27
|
+
- When column.wipLimit is set and exceeded, the column background turns error-colored.
|
|
28
|
+
- Fixed width defined by COLUMN_WIDTH constant.
|
|
29
|
+
- Forwards ref to outer div.
|
|
30
|
+
- Uses @dnd-kit useDroppable for drop target and SortableContext for task reordering.
|
|
31
|
+
- Ghost silhouette (TaskGhost) is rendered at the dragPreview position during cross-column drags.
|
|
32
|
+
|
|
33
|
+
## Changes
|
|
34
|
+
### v0.18.0
|
|
35
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# BoardProvider
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra-karm/board
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: board
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
initialData: BoardData (REQUIRED)
|
|
9
|
+
currentUserId: string | null (default: null)
|
|
10
|
+
members: BoardMember[] (explicit member list for assignment dropdowns; falls back to deriving from task assignees)
|
|
11
|
+
children: ReactNode (REQUIRED)
|
|
12
|
+
onTaskMove: (taskId: string, toColumnId: string, newOrder: number) => void
|
|
13
|
+
onTaskAdd: (columnId: string, options: NewTaskOptions) => void
|
|
14
|
+
onBulkAction: (action: BulkAction) => void
|
|
15
|
+
onColumnReorder: (columnId: string, newIndex: number) => void
|
|
16
|
+
onColumnRename: (columnId: string, name: string) => void
|
|
17
|
+
onColumnDelete: (columnId: string) => void
|
|
18
|
+
onColumnToggleVisibility: (columnId: string, visible: boolean) => void
|
|
19
|
+
onColumnWipLimitChange: (columnId: string, limit: number | null) => void
|
|
20
|
+
onClickTask: (taskId: string) => void
|
|
21
|
+
onAddColumn: () => void
|
|
22
|
+
onQuickPriorityChange: (taskId: string, priority: string) => void
|
|
23
|
+
onQuickAssign: (taskId: string, userId: string) => void
|
|
24
|
+
onQuickDueDateChange: (taskId: string, date: string | null) => void
|
|
25
|
+
onQuickLabelAdd: (taskId: string, label: string) => void
|
|
26
|
+
onQuickVisibilityChange: (taskId: string, visibility: string) => void
|
|
27
|
+
onQuickDelete: (taskId: string) => void
|
|
28
|
+
|
|
29
|
+
## Defaults
|
|
30
|
+
currentUserId=null
|
|
31
|
+
|
|
32
|
+
## Context Value (useBoardContext)
|
|
33
|
+
columns: BoardColumn[] (filtered)
|
|
34
|
+
rawColumns: BoardColumn[] (unfiltered)
|
|
35
|
+
members: BoardMember[]
|
|
36
|
+
viewMode: BoardViewMode
|
|
37
|
+
setViewMode: (mode: BoardViewMode) => void
|
|
38
|
+
filters: BoardFilters
|
|
39
|
+
setFilters: (updates: Partial<BoardFilters>) => void
|
|
40
|
+
clearFilters: () => void
|
|
41
|
+
hasActiveFilters: boolean
|
|
42
|
+
selectedTaskIds: Set<string>
|
|
43
|
+
toggleTaskSelection: (taskId: string) => void
|
|
44
|
+
selectRange: (fromId: string, toId: string) => void
|
|
45
|
+
selectAll: () => void
|
|
46
|
+
clearSelection: () => void
|
|
47
|
+
focusedTaskId: string | null
|
|
48
|
+
setFocusedTaskId: (id: string | null) => void
|
|
49
|
+
currentUserId: string | null
|
|
50
|
+
highlightMyTasks: boolean
|
|
51
|
+
setHighlightMyTasks: (on: boolean) => void
|
|
52
|
+
activeTask: BoardTask | null
|
|
53
|
+
setActiveTask: (task: BoardTask | null) => void
|
|
54
|
+
onTaskMove: (taskId: string, toColumnId: string, newOrder: number) => void
|
|
55
|
+
onTaskAdd: (columnId: string, options: NewTaskOptions) => void
|
|
56
|
+
onBulkAction: (action: BulkAction) => void
|
|
57
|
+
onColumnReorder: (columnId: string, newIndex: number) => void
|
|
58
|
+
onColumnRename: (columnId: string, name: string) => void
|
|
59
|
+
onColumnDelete: (columnId: string) => void
|
|
60
|
+
onColumnToggleVisibility: (columnId: string, visible: boolean) => void
|
|
61
|
+
onColumnWipLimitChange: (columnId: string, limit: number | null) => void
|
|
62
|
+
onClickTask: (taskId: string) => void
|
|
63
|
+
onAddColumn: () => void
|
|
64
|
+
onQuickPriorityChange: (taskId: string, priority: string) => void
|
|
65
|
+
onQuickAssign: (taskId: string, userId: string) => void
|
|
66
|
+
onQuickDueDateChange: (taskId: string, date: string | null) => void
|
|
67
|
+
onQuickLabelAdd: (taskId: string, label: string) => void
|
|
68
|
+
onQuickVisibilityChange: (taskId: string, visibility: string) => void
|
|
69
|
+
onQuickDelete: (taskId: string) => void
|
|
70
|
+
|
|
71
|
+
## Example
|
|
72
|
+
```jsx
|
|
73
|
+
<BoardProvider initialData={data} currentUserId="user-1" onTaskMove={handleMove}>
|
|
74
|
+
<BoardToolbar />
|
|
75
|
+
<BulkActionBar />
|
|
76
|
+
{/* custom layout */}
|
|
77
|
+
</BoardProvider>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Gotchas
|
|
81
|
+
- Must wrap all board sub-components (BoardColumn, BoardToolbar, BulkActionBar, etc.).
|
|
82
|
+
- useBoardContext() throws if used outside BoardProvider.
|
|
83
|
+
- All callback props default to no-op internally.
|
|
84
|
+
- columns in context are filtered; use rawColumns for unfiltered data.
|
|
85
|
+
- Syncs with initialData changes via useEffect.
|
|
86
|
+
|
|
87
|
+
## Changes
|
|
88
|
+
### v0.18.0
|
|
89
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# BoardToolbar
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra-karm/board
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: board
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
...HTMLAttributes<HTMLDivElement>
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
- Debounced search input (200ms)
|
|
12
|
+
- Priority filter (multi-select checkbox dropdown: LOW, MEDIUM, HIGH, URGENT)
|
|
13
|
+
- Assignee filter (multi-select checkbox dropdown, derived from board members)
|
|
14
|
+
- Label filter (multi-select checkbox dropdown, derived from task labels)
|
|
15
|
+
- Due date filter (radio: overdue, today, this-week)
|
|
16
|
+
- "Highlight my tasks" toggle button
|
|
17
|
+
- View mode toggle (SegmentedControl: Board / Compact)
|
|
18
|
+
- Active filter chips with individual dismiss and "Clear all" button
|
|
19
|
+
|
|
20
|
+
## Example
|
|
21
|
+
```jsx
|
|
22
|
+
{/* Rendered automatically by KanbanBoard, or manually inside BoardProvider */}
|
|
23
|
+
<BoardProvider initialData={data}>
|
|
24
|
+
<BoardToolbar />
|
|
25
|
+
</BoardProvider>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Gotchas
|
|
29
|
+
- Must be rendered inside a BoardProvider context.
|
|
30
|
+
- No props needed — all state comes from context.
|
|
31
|
+
- Assignee and Label filter dropdowns only render when members/labels exist.
|
|
32
|
+
- Forwards ref to outer div.
|
|
33
|
+
|
|
34
|
+
## Changes
|
|
35
|
+
### v0.18.0
|
|
36
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Board Types
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra-karm/board
|
|
4
|
+
- Category: board
|
|
5
|
+
|
|
6
|
+
## BoardTask
|
|
7
|
+
id: string
|
|
8
|
+
taskId: string (display ID, e.g. "KRM-42")
|
|
9
|
+
title: string
|
|
10
|
+
priority: 'LOW' | 'MEDIUM' | 'HIGH' | 'URGENT'
|
|
11
|
+
labels: string[]
|
|
12
|
+
dueDate: string | null
|
|
13
|
+
isBlocked: boolean
|
|
14
|
+
visibility: 'INTERNAL' | 'EVERYONE'
|
|
15
|
+
owner: BoardMember | null
|
|
16
|
+
assignees: BoardMember[]
|
|
17
|
+
subtaskCount: number
|
|
18
|
+
subtasksDone: number
|
|
19
|
+
|
|
20
|
+
## BoardMember
|
|
21
|
+
id: string
|
|
22
|
+
name: string
|
|
23
|
+
image: string | null
|
|
24
|
+
|
|
25
|
+
## BoardColumn
|
|
26
|
+
id: string
|
|
27
|
+
name: string
|
|
28
|
+
isClientVisible: boolean (optional)
|
|
29
|
+
wipLimit: number (optional)
|
|
30
|
+
tasks: BoardTask[]
|
|
31
|
+
|
|
32
|
+
## BoardData
|
|
33
|
+
columns: BoardColumn[]
|
|
34
|
+
|
|
35
|
+
## BoardFilters
|
|
36
|
+
search: string
|
|
37
|
+
assignees: string[]
|
|
38
|
+
priorities: string[]
|
|
39
|
+
labels: string[]
|
|
40
|
+
dueDateRange: 'overdue' | 'today' | 'this-week' | 'none' | null
|
|
41
|
+
|
|
42
|
+
## BoardViewMode
|
|
43
|
+
'default' | 'compact'
|
|
44
|
+
|
|
45
|
+
## NewTaskOptions
|
|
46
|
+
title: string
|
|
47
|
+
ownerId: string | null (optional)
|
|
48
|
+
dueDate: string | null (optional)
|
|
49
|
+
|
|
50
|
+
## BulkAction
|
|
51
|
+
type: 'move' | 'priority' | 'assign' | 'label' | 'dueDate' | 'delete' | 'visibility'
|
|
52
|
+
taskIds: string[]
|
|
53
|
+
value: string | null (optional)
|
|
54
|
+
|
|
55
|
+
## Gotchas
|
|
56
|
+
- BoardTask.taskId is the human-readable display ID (e.g. "KRM-42"), not the same as BoardTask.id (database UUID).
|
|
57
|
+
- BoardColumn.wipLimit is optional; when set and exceeded, the column renders in error state.
|
|
58
|
+
- BoardFilters.dueDateRange can be null or 'none' to indicate no filter.
|
|
59
|
+
|
|
60
|
+
## Changes
|
|
61
|
+
### v0.18.0
|
|
62
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# BulkActionBar
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra-karm/board
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: board
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
...HTMLAttributes<HTMLDivElement>
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
- Animates in/out when tasks are selected (AnimatePresence)
|
|
12
|
+
- Shows selection count with clear button
|
|
13
|
+
- Dropdown actions: Move to column, Set priority, Assign, Set visibility
|
|
14
|
+
- Delete button (right-aligned, error-colored)
|
|
15
|
+
- All actions trigger onBulkAction from context then clear selection
|
|
16
|
+
|
|
17
|
+
## Bulk Action Shape
|
|
18
|
+
{ type: 'move' | 'priority' | 'assign' | 'label' | 'dueDate' | 'delete' | 'visibility', taskIds: string[], value?: string | null }
|
|
19
|
+
|
|
20
|
+
## Example
|
|
21
|
+
```jsx
|
|
22
|
+
{/* Rendered automatically by KanbanBoard, or manually inside BoardProvider */}
|
|
23
|
+
<BoardProvider initialData={data} onBulkAction={handleBulk}>
|
|
24
|
+
<BulkActionBar />
|
|
25
|
+
</BoardProvider>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Gotchas
|
|
29
|
+
- Must be rendered inside a BoardProvider context.
|
|
30
|
+
- No props needed — all state comes from context.
|
|
31
|
+
- Only visible when selectedTaskIds.size > 0.
|
|
32
|
+
- Assign dropdown only renders when members exist.
|
|
33
|
+
- Forwards ref to outer div.
|
|
34
|
+
- Uses aria-live="polite" for screen reader announcements.
|
|
35
|
+
|
|
36
|
+
## Changes
|
|
37
|
+
### v0.18.0
|
|
38
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# ColumnEmpty
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra-karm/board
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: board
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
index: number (REQUIRED) — used to cycle through 4 illustration variants
|
|
9
|
+
onAddTask: () => void
|
|
10
|
+
isDropTarget: boolean (default: false)
|
|
11
|
+
...HTMLAttributes<HTMLDivElement>
|
|
12
|
+
|
|
13
|
+
## Defaults
|
|
14
|
+
isDropTarget=false
|
|
15
|
+
|
|
16
|
+
## Illustrations
|
|
17
|
+
Cycles through 4 SVG illustrations by column index:
|
|
18
|
+
0: Clipboard, 1: Stacked Cards, 2: Checkmark Circle, 3: Inbox
|
|
19
|
+
|
|
20
|
+
## Example
|
|
21
|
+
```jsx
|
|
22
|
+
<ColumnEmpty index={0} onAddTask={() => addTask(columnId)} />
|
|
23
|
+
<ColumnEmpty index={1} isDropTarget />
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Gotchas
|
|
27
|
+
- When isDropTarget=true, shows "Drop tasks here" text instead of the default empty state ("No tasks yet" + "Add a task" button).
|
|
28
|
+
- Illustrations use currentColor (inherits text-surface-fg-subtle).
|
|
29
|
+
- Forwards ref to outer div.
|
|
30
|
+
|
|
31
|
+
## Changes
|
|
32
|
+
### v0.18.0
|
|
33
|
+
- **Added** Initial release
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# ColumnHeader
|
|
2
|
+
|
|
3
|
+
- Import: @devalok/shilp-sutra-karm/board
|
|
4
|
+
- Server-safe: No
|
|
5
|
+
- Category: board
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
column: BoardColumn (REQUIRED)
|
|
9
|
+
index: number (REQUIRED)
|
|
10
|
+
...HTMLAttributes<HTMLDivElement>
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
- Color-coded accent dot (cycles through COLUMN_ACCENT_COLORS by index)
|
|
14
|
+
- Column name with task count badge
|
|
15
|
+
- Double-click to rename (inline Input)
|
|
16
|
+
- WIP limit display with exceeded state (error color)
|
|
17
|
+
- Inline WIP limit editor
|
|
18
|
+
- Quick-add task form (title, owner picker, due date picker)
|
|
19
|
+
- Column options dropdown: Rename, Set WIP Limit, Show/Hide from client, Delete column
|
|
20
|
+
- Avatar stack of unique members in the column (AvatarGroup, max 3)
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
```jsx
|
|
24
|
+
{/* Rendered automatically by BoardColumn */}
|
|
25
|
+
<ColumnHeader column={column} index={0} />
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Gotchas
|
|
29
|
+
- Must be rendered inside a BoardProvider context.
|
|
30
|
+
- Reads members, onColumnRename, onColumnDelete, onColumnToggleVisibility, onTaskAdd from context.
|
|
31
|
+
- Quick-add form expands with animation (AnimatePresence + framer-motion).
|
|
32
|
+
- Forwards ref to outer div.
|
|
33
|
+
|
|
34
|
+
## Changes
|
|
35
|
+
### v0.18.0
|
|
36
|
+
- **Added** Initial release
|