@xcelsior/ui-spreadsheets 1.0.3 → 1.0.5
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/.turbo/turbo-lint.log +61 -0
- package/CHANGELOG.md +6 -0
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +280 -174
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +280 -174
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/ColumnHeaderActions.tsx +3 -2
- package/src/components/CommentModals.tsx +28 -3
- package/src/components/Spreadsheet.stories.tsx +1 -2
- package/src/components/Spreadsheet.tsx +250 -145
- package/src/components/SpreadsheetCell.tsx +38 -48
- package/src/hooks/useSpreadsheetComments.ts +56 -54
- package/src/hooks/useSpreadsheetFiltering.ts +38 -4
- package/src/hooks/useSpreadsheetHighlighting.ts +27 -4
- package/src/types.ts +4 -4
- package/.turbo/turbo-build.log +0 -22
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { HiFilter } from 'react-icons/hi';
|
|
3
|
+
import { AiFillHighlight } from 'react-icons/ai';
|
|
3
4
|
import { MdOutlinePushPin, MdPushPin } from 'react-icons/md';
|
|
4
5
|
import { cn } from '../utils';
|
|
5
6
|
|
|
@@ -105,7 +106,7 @@ export function ColumnHeaderActions({
|
|
|
105
106
|
)}
|
|
106
107
|
title={highlightTitle}
|
|
107
108
|
>
|
|
108
|
-
<
|
|
109
|
+
<AiFillHighlight className="h-3 w-3" />
|
|
109
110
|
</button>
|
|
110
111
|
)}
|
|
111
112
|
|
|
@@ -8,6 +8,8 @@ export interface AddCommentModalProps {
|
|
|
8
8
|
isOpen: boolean;
|
|
9
9
|
/** Current comment text */
|
|
10
10
|
commentText: string;
|
|
11
|
+
/** Column label for the cell (optional) */
|
|
12
|
+
columnLabel?: string;
|
|
11
13
|
/** Callback to update comment text */
|
|
12
14
|
onCommentTextChange: (text: string) => void;
|
|
13
15
|
/** Callback to add the comment */
|
|
@@ -19,6 +21,7 @@ export interface AddCommentModalProps {
|
|
|
19
21
|
export function AddCommentModal({
|
|
20
22
|
isOpen,
|
|
21
23
|
commentText,
|
|
24
|
+
columnLabel,
|
|
22
25
|
onCommentTextChange,
|
|
23
26
|
onAdd,
|
|
24
27
|
onClose,
|
|
@@ -28,7 +31,9 @@ export function AddCommentModal({
|
|
|
28
31
|
return (
|
|
29
32
|
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50">
|
|
30
33
|
<div className="bg-white rounded-lg shadow-xl p-6 w-96 max-w-full mx-4">
|
|
31
|
-
<h3 className="text-lg font-semibold mb-4">
|
|
34
|
+
<h3 className="text-lg font-semibold mb-4">
|
|
35
|
+
Add Comment{columnLabel ? ` - ${columnLabel}` : ''}
|
|
36
|
+
</h3>
|
|
32
37
|
<textarea
|
|
33
38
|
value={commentText}
|
|
34
39
|
onChange={(e) => onCommentTextChange(e.target.value)}
|
|
@@ -66,8 +71,12 @@ export interface ViewCommentsModalProps {
|
|
|
66
71
|
isOpen: boolean;
|
|
67
72
|
/** Comments to display */
|
|
68
73
|
comments: CellComment[];
|
|
74
|
+
/** Column label for the cell (optional) */
|
|
75
|
+
columnLabel?: string;
|
|
69
76
|
/** Callback to toggle comment resolved status */
|
|
70
77
|
onToggleResolved: (commentId: string) => void;
|
|
78
|
+
/** Callback to add a new comment */
|
|
79
|
+
onAddComment?: () => void;
|
|
71
80
|
/** Callback to close the modal */
|
|
72
81
|
onClose: () => void;
|
|
73
82
|
}
|
|
@@ -75,7 +84,9 @@ export interface ViewCommentsModalProps {
|
|
|
75
84
|
export function ViewCommentsModal({
|
|
76
85
|
isOpen,
|
|
77
86
|
comments,
|
|
87
|
+
columnLabel,
|
|
78
88
|
onToggleResolved,
|
|
89
|
+
onAddComment,
|
|
79
90
|
onClose,
|
|
80
91
|
}: ViewCommentsModalProps) {
|
|
81
92
|
if (!isOpen) return null;
|
|
@@ -84,7 +95,9 @@ export function ViewCommentsModal({
|
|
|
84
95
|
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50">
|
|
85
96
|
<div className="bg-white rounded-lg shadow-xl p-6 w-[480px] max-w-full mx-4 max-h-[80vh] flex flex-col">
|
|
86
97
|
<div className="flex items-center justify-between mb-4">
|
|
87
|
-
<h3 className="text-lg font-semibold">
|
|
98
|
+
<h3 className="text-lg font-semibold">
|
|
99
|
+
Comments{columnLabel ? ` - ${columnLabel}` : ''}
|
|
100
|
+
</h3>
|
|
88
101
|
<button
|
|
89
102
|
type="button"
|
|
90
103
|
onClick={onClose}
|
|
@@ -126,9 +139,21 @@ export function ViewCommentsModal({
|
|
|
126
139
|
</div>
|
|
127
140
|
))}
|
|
128
141
|
{comments.length === 0 && (
|
|
129
|
-
<p className="text-center text-gray-500 py-8">No comments for this
|
|
142
|
+
<p className="text-center text-gray-500 py-8">No comments for this cell.</p>
|
|
130
143
|
)}
|
|
131
144
|
</div>
|
|
145
|
+
{/* Add Comment button at the bottom */}
|
|
146
|
+
{onAddComment && (
|
|
147
|
+
<div className="mt-4 pt-4 border-t border-gray-200">
|
|
148
|
+
<button
|
|
149
|
+
type="button"
|
|
150
|
+
onClick={onAddComment}
|
|
151
|
+
className="w-full px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors flex items-center justify-center gap-2"
|
|
152
|
+
>
|
|
153
|
+
<span>+ Add Comment</span>
|
|
154
|
+
</button>
|
|
155
|
+
</div>
|
|
156
|
+
)}
|
|
132
157
|
</div>
|
|
133
158
|
</div>
|
|
134
159
|
);
|
|
@@ -215,7 +215,6 @@ A feature-rich spreadsheet component with Excel-like functionality.
|
|
|
215
215
|
onRowClick: { action: 'onRowClick' },
|
|
216
216
|
onRowDoubleClick: { action: 'onRowDoubleClick' },
|
|
217
217
|
onRowClone: { action: 'onRowClone' },
|
|
218
|
-
onAddRowComment: { action: 'onAddRowComment' },
|
|
219
218
|
onRowHighlight: { action: 'onRowHighlight' },
|
|
220
219
|
showToolbar: {
|
|
221
220
|
control: 'boolean',
|
|
@@ -525,7 +524,7 @@ export const WithHighlightsAndComments: Story = {
|
|
|
525
524
|
// Large dataset (performance test)
|
|
526
525
|
export const LargeDataset: Story = {
|
|
527
526
|
args: {
|
|
528
|
-
data: Array.from({ length:
|
|
527
|
+
data: Array.from({ length: 3000 }, (_, i) => ({
|
|
529
528
|
id: i + 1,
|
|
530
529
|
name: `User ${i + 1}`,
|
|
531
530
|
email: `user${i + 1}@example.com`,
|