@xcelsior/ui-spreadsheets 1.1.5 → 1.1.7

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,28 +1,28 @@
1
1
 
2
- > @xcelsior/ui-spreadsheets@1.1.5 build /home/circleci/repo/packages/ui/ui-spreadsheets
2
+ > @xcelsior/ui-spreadsheets@1.1.4 build /Users/tuannguyen/Work/xcelsior-packages/packages/ui/ui-spreadsheets
3
3
  > tsup && tsc --noEmit
4
4
 
5
5
  CLI Building entry: src/index.ts, src/styles/globals.css
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v8.5.1
8
- CLI Using tsup config: /home/circleci/repo/packages/ui/ui-spreadsheets/tsup.config.ts
8
+ CLI Using tsup config: /Users/tuannguyen/Work/xcelsior-packages/packages/ui/ui-spreadsheets/tsup.config.ts
9
9
  CLI Target: es2020
10
10
  CLI Cleaning output folder
11
11
  CJS Build start
12
12
  ESM Build start
13
- DTS Build start
13
+ DTS Build start
14
+ CJS dist/styles/globals.css 33.16 KB
15
+ CJS dist/index.js 173.50 KB
16
+ CJS dist/styles/globals.css.map 55.29 KB
17
+ CJS dist/index.js.map 4.65 MB
18
+ CJS ⚡️ Build success in 397ms
14
19
  ESM dist/styles/globals.css 33.16 KB
15
20
  ESM dist/index.mjs 162.16 KB
16
21
  ESM dist/styles/globals.css.map 55.29 KB
17
22
  ESM dist/index.mjs.map 4.65 MB
18
- ESM ⚡️ Build success in 892ms
19
- CJS dist/index.js 173.50 KB
20
- CJS dist/styles/globals.css 33.16 KB
21
- CJS dist/index.js.map 4.65 MB
22
- CJS dist/styles/globals.css.map 55.29 KB
23
- CJS ⚡️ Build success in 893ms
24
- DTS ⚡️ Build success in 5596ms
25
- DTS dist/styles/globals.d.ts 13.00 B
26
- DTS dist/index.d.ts 26.27 KB
27
- DTS dist/styles/globals.d.mts 13.00 B
28
- DTS dist/index.d.mts 26.27 KB
23
+ ESM ⚡️ Build success in 396ms
24
+ DTS ⚡️ Build success in 2168ms
25
+ DTS dist/styles/globals.d.ts 13.00 B
26
+ DTS dist/index.d.ts 26.27 KB
27
+ DTS dist/styles/globals.d.mts 13.00 B
28
+ DTS dist/index.d.mts 26.27 KB
@@ -0,0 +1,185 @@
1
+
2
+ > @xcelsior/ui-spreadsheets@1.1.4 lint /Users/tuannguyen/Work/xcelsior-packages/packages/ui/ui-spreadsheets
3
+ > biome check . && tsc --noEmit
4
+
5
+  at src/components/CommentModals.tsx:57:21 ]8;;https://biomejs.dev/linter/rules/no-autofocus\lint/a11y/noAutofocus]8;;\  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
6
+
7
+  ⚠ Avoid the autoFocus attribute.
8
+  
9
+   55 │                     placeholder="Enter your comment..."
10
+   56 │                     className="w-full h-24 p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 resize-none"
11
+  > 57 │                     autoFocus
12
+     │                     ^^^^^^^^^
13
+   58 │                 />
14
+   59 │                 <div className="flex justify-end gap-2 mt-4">
15
+  
16
+  ℹ Unsafe fix: Remove the autoFocus attribute.
17
+  
18
+    55  55 │                       placeholder="Enter your comment..."
19
+    56  56 │                       className="w-full h-24 p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 resize-none"
20
+    57     │ - ····················autoFocus
21
+    58  57 │                   />
22
+    59  58 │                   <div className="flex justify-end gap-2 mt-4">
23
+  
24
+ 
25
+  at src/components/Spreadsheet.tsx:845:45 ]8;;https://biomejs.dev/linter/rules/use-key-with-click-events\lint/a11y/useKeyWithClickEvents]8;;\ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
26
+
27
+  ⚠ Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.
28
+  
29
+   843 │                                         >
30
+   844 │                                             {/* Row Index Column */}
31
+  > 845 │                                             <td
32
+      │                                             ^^^
33
+  > 846 │                                                 onClick={(e) => handleRowSelect(rowId, e)}
34
+      ...
35
+  > 874 │                                                 }}
36
+  > 875 │                                             >
37
+      │                                             ^
38
+   876 │                                                 <div className="relative flex items-center justify-center w-full h-full">
39
+   877 │                                                     {/* Row number - centered */}
40
+  
41
+  ℹ Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
42
+  
43
+ 
44
+  at src/components/Spreadsheet.tsx:29:15 ]8;;https://biomejs.dev/linter/rules/no-unused-imports\lint/correctness/noUnusedImports]8;;\  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
45
+
46
+  ⚠ Several of these imports are unused.
47
+  
48
+   27 │ import { useSpreadsheetKeyboardShortcuts } from '../hooks/useSpreadsheetKeyboardShortcuts';
49
+   28 │ import { useSpreadsheetSelection } from '../hooks/useSpreadsheetSelection';
50
+  > 29 │ import type { CellEdit, SpreadsheetProps } from '../types';
51
+     │               ^^^^^^^^
52
+   30 │ 
53
+   31 │ type SingleCellEdit = {
54
+  
55
+  ℹ Unused imports might be the result of an incomplete refactoring.
56
+  
57
+  ℹ Unsafe fix: Remove the unused imports.
58
+  
59
+   29 │ import·type·{·CellEdit,·SpreadsheetProps·}·from·'../types';
60
+   │               ----------                                   
61
+ 
62
+  at src/components/SpreadsheetCell.tsx:54:5 ]8;;https://biomejs.dev/linter/rules/no-unused-function-parameters\lint/correctness/noUnusedFunctionParameters]8;;\ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
63
+
64
+  ⚠ This parameter is unused.
65
+  
66
+   52 │     onMouseDown,
67
+   53 │     onMouseEnter,
68
+  > 54 │     onChange,
69
+     │     ^^^^^^^^
70
+   55 │     onConfirm,
71
+   56 │     onCancel,
72
+  
73
+  ℹ Unused parameters might be the result of an incomplete refactoring.
74
+  
75
+ 
76
+  at src/components/SpreadsheetFilterDropdown.tsx:188:9 ]8;;https://biomejs.dev/linter/rules/no-static-element-interactions\lint/a11y/noStaticElementInteractions]8;;\ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
77
+
78
+  ⚠ Static Elements should not be interactive.
79
+  
80
+   187 │     return (
81
+  > 188 │         <div
82
+      │         ^^^^
83
+  > 189 │             ref={dropdownRef}
84
+      ...
85
+  > 194 │             onClick={(e) => e.stopPropagation()}
86
+  > 195 │         >
87
+      │         ^
88
+   196 │             <div className="px-3 py-2 border-b border-gray-200 bg-gray-50">
89
+   197 │                 <span className="text-xs font-medium text-gray-700">Filter: {column.label}</span>
90
+  
91
+  ℹ To add interactivity such as a mouse or key event listener to a static element, give the element an appropriate role value.
92
+  
93
+ 
94
+  at src/components/SpreadsheetFilterDropdown.tsx:188:9 ]8;;https://biomejs.dev/linter/rules/use-key-with-click-events\lint/a11y/useKeyWithClickEvents]8;;\ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
95
+
96
+  ⚠ Enforce to have the onClick mouse event with the onKeyUp, the onKeyDown, or the onKeyPress keyboard event.
97
+  
98
+   187 │     return (
99
+  > 188 │         <div
100
+      │         ^^^^
101
+  > 189 │             ref={dropdownRef}
102
+      ...
103
+  > 194 │             onClick={(e) => e.stopPropagation()}
104
+  > 195 │         >
105
+      │         ^
106
+   196 │             <div className="px-3 py-2 border-b border-gray-200 bg-gray-50">
107
+   197 │                 <span className="text-xs font-medium text-gray-700">Filter: {column.label}</span>
108
+  
109
+  ℹ Actions triggered using mouse events should have corresponding keyboard events to account for keyboard-only navigation.
110
+  
111
+ 
112
+  at src/hooks/useSpreadsheetSelection.ts:602:37 ]8;;https://biomejs.dev/linter/rules/no-global-is-nan\lint/suspicious/noGlobalIsNan]8;;\  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
113
+
114
+  ⚠ isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.
115
+  
116
+   600 │                     if (column.type === 'number' && typeof cellValue === 'string') {
117
+   601 │                         const parsed = parseFloat(cellValue);
118
+  > 602 │                         cellValue = isNaN(parsed) ? cellValue : parsed;
119
+      │                                     ^^^^^
120
+   603 │                     }
121
+   604 │ 
122
+  
123
+  ℹ See ]8;;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN#description\the MDN documentation]8;;\ for more details.
124
+  
125
+  ℹ Unsafe fix: Use Number.isNaN instead.
126
+  
127
+   600 600 │                       if (column.type === 'number' && typeof cellValue === 'string') {
128
+   601 601 │                           const parsed = parseFloat(cellValue);
129
+   602     │ - ························cellValue·=·isNaN(parsed)·?·cellValue·:·parsed;
130
+       602 │ + ························cellValue·=·Number.isNaN(parsed)·?·cellValue·:·parsed;
131
+   603 603 │                       }
132
+   604 604 │   
133
+  
134
+ 
135
+  at src/components/Spreadsheet.stories.tsx format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
136
+
137
+  ✖ Formatter would have printed the following content:
138
+  
139
+    489  489 │                   icon: <HiEye className="h-4 w-4" />,
140
+    490  490 │                   onClick: (row) => {
141
+    491      │ - ····················alert(`Viewing·user:·${row.name}\nEmail:·${row.email}\nDepartment:·${row.department}`);
142
+         491 │ + ····················alert(
143
+         492 │ + ························`Viewing·user:·${row.name}\nEmail:·${row.email}\nDepartment:·${row.department}`
144
+         493 │ + ····················);
145
+    492  494 │                   },
146
+    493  495 │               },
147
+   ········· │
148
+    533  535 │                   <div className="mb-4 text-sm text-gray-600">
149
+    534  536 │                       <p className="font-medium mb-2">Row Context Menu Example</p>
150
+    535      │ - ····················<p>Hover·over·a·row·and·click·the·3-dot·icon·(⋮)·to·see·the·context·menu·with·actions.</p>
151
+    536      │ - ····················<p·className="text-xs·mt-1·text-gray-500">Note:·Delete·is·only·visible·for·non-Active·users.</p>
152
+         537 │ + ····················<p>
153
+         538 │ + ························Hover·over·a·row·and·click·the·3-dot·icon·(⋮)·to·see·the·context·menu·with
154
+         539 │ + ························actions.
155
+         540 │ + ····················</p>
156
+         541 │ + ····················<p·className="text-xs·mt-1·text-gray-500">
157
+         542 │ + ························Note:·Delete·is·only·visible·for·non-Active·users.
158
+         543 │ + ····················</p>
159
+    537  544 │                   </div>
160
+    538  545 │                   <Spreadsheet
161
+  
162
+ 
163
+  at src/components/Spreadsheet.tsx format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
164
+
165
+  ✖ Formatter would have printed the following content:
166
+  
167
+    887  887 │                                                                       rowId={rowId}
168
+    888  888 │                                                                       items={rowContextMenuItems}
169
+    889      │ - ····································································compactMode={effectiveCompactMode}
170
+         889 │ + ····································································compactMode={
171
+         890 │ + ········································································effectiveCompactMode
172
+         891 │ + ····································································}
173
+    890  892 │                                                                   />
174
+    891  893 │                                                               )}
175
+  
176
+ 
177
+ Checked 31 files in 25ms. No fixes applied.
178
+ Found 2 errors.
179
+ Found 7 warnings.
180
+ check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
181
+
182
+  ✖ Some errors were emitted while running checks.
183
+  
184
+ 
185
+  ELIFECYCLE  Command failed with exit code 1.
package/dist/index.d.mts CHANGED
@@ -24,7 +24,7 @@ interface SpreadsheetColumn<T = any> {
24
24
  /** Whether the column can be pinned */
25
25
  pinnable?: boolean;
26
26
  /** Type of data in the column (for filtering/formatting) */
27
- type?: 'text' | 'number' | 'date' | 'select' | 'boolean';
27
+ type?: 'text' | 'number' | 'date' | 'select' | 'boolean' | 'checkbox';
28
28
  /** Options for select type columns */
29
29
  options?: string[];
30
30
  /** Custom render function for cell content */
package/dist/index.d.ts CHANGED
@@ -24,7 +24,7 @@ interface SpreadsheetColumn<T = any> {
24
24
  /** Whether the column can be pinned */
25
25
  pinnable?: boolean;
26
26
  /** Type of data in the column (for filtering/formatting) */
27
- type?: 'text' | 'number' | 'date' | 'select' | 'boolean';
27
+ type?: 'text' | 'number' | 'date' | 'select' | 'boolean' | 'checkbox';
28
28
  /** Options for select type columns */
29
29
  options?: string[];
30
30
  /** Custom render function for cell content */
package/dist/index.js CHANGED
@@ -257,10 +257,31 @@ var SpreadsheetCell = ({
257
257
  if (isRowHovered) return "rgb(243 244 246)";
258
258
  return "white";
259
259
  };
260
+ const handleCheckboxChange = (e) => {
261
+ e.stopPropagation();
262
+ const newValue = e.target.checked;
263
+ onConfirm?.(newValue);
264
+ };
260
265
  const renderContent = () => {
261
266
  if (column.render) {
262
267
  return column.render(value, row, rowIndex);
263
268
  }
269
+ if (column.type === "checkbox") {
270
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
271
+ "input",
272
+ {
273
+ type: "checkbox",
274
+ checked: Boolean(value),
275
+ onChange: handleCheckboxChange,
276
+ onClick: (e) => e.stopPropagation(),
277
+ disabled: !isEditable,
278
+ className: cn(
279
+ "h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 cursor-pointer",
280
+ !isEditable && "cursor-not-allowed opacity-60"
281
+ )
282
+ }
283
+ );
284
+ }
264
285
  if (value === null || value === void 0 || value === "") {
265
286
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-gray-400", children: "-" });
266
287
  }
@@ -273,6 +294,9 @@ var SpreadsheetCell = ({
273
294
  return String(value);
274
295
  };
275
296
  const renderEditInput = () => {
297
+ if (column.type === "checkbox") {
298
+ return renderContent();
299
+ }
276
300
  if (column.type === "select" && column.options) {
277
301
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
278
302
  "select",
@@ -2260,7 +2284,10 @@ function RowContextMenu({
2260
2284
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2261
2285
  import_design_system.ContextMenuItem,
2262
2286
  {
2263
- onClick: () => item.onClick(row, rowId),
2287
+ onClick: (e) => {
2288
+ e.stopPropagation();
2289
+ item.onClick(row, rowId);
2290
+ },
2264
2291
  disabled: isDisabled,
2265
2292
  className: `${variantClass} ${item.className || ""}`,
2266
2293
  children: [