@appcorp/fusion-storybook 0.2.17 → 0.2.18
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/components/timeline.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
2
|
+
import { useState, useCallback } from "react";
|
|
3
3
|
import { EnhancedDropzone } from "@appcorp/shadcn/components/enhanced-dropzone";
|
|
4
4
|
import { Button } from "@appcorp/shadcn/components/ui/button";
|
|
5
5
|
export const Timeline = ({ heading, events, handleOnBulkCreate, }) => {
|
|
6
6
|
const [files, setFiles] = useState([]);
|
|
7
|
-
|
|
7
|
+
const handleDropzoneChange = useCallback((f) => {
|
|
8
|
+
// Defer state update to avoid "setState during render" if
|
|
9
|
+
// EnhancedDropzone calls onChange synchronously during render.
|
|
10
|
+
queueMicrotask(() => setFiles(f));
|
|
11
|
+
}, []);
|
|
12
|
+
return (_jsxs("div", { className: "space-y-6", children: [_jsx("h2", { className: "text-foreground text-xl font-semibold", children: heading }), _jsxs("div", { className: "space-y-4", children: [events.map((event) => (_jsxs("div", { className: "flex items-start gap-2", children: [_jsx("div", { className: "z-10 flex h-6 w-6 items-center justify-center", children: _jsx("div", { className: "bg-muted-foreground h-3 w-3 rounded-full" }) }), _jsxs("div", { className: "min-w-0 flex-1 pb-1", children: [_jsx("div", { onClick: event.handleOnClick, className: `text-muted-foreground text-sm ${event.handleOnClick ? "cursor-pointer underline" : ""}`, children: event.title }), event.description && (_jsx("div", { className: "text-foreground mt-1 text-sm", children: event.description }))] })] }, event.id))), _jsx(EnhancedDropzone, { className: "", label: "Upload CSV", id: "timeline-dropzone", info: "Drag and drop your CSV file here, or click to select.", error: "", accept: { "text/csv": [".csv"] }, maxFiles: 1, onChange: handleDropzoneChange, onRemoveRemote: () => {
|
|
8
13
|
// Handle remote file removal if needed
|
|
9
14
|
} }), _jsx(Button, { disabled: files.length === 0, onClick: () => handleOnBulkCreate === null || handleOnBulkCreate === void 0 ? void 0 : handleOnBulkCreate(files), children: "Upload and Process CSV" })] })] }));
|
|
10
15
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appcorp/fusion-storybook",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.18",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build-storybook": "storybook build",
|
|
6
6
|
"build:next": "next build",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@appcorp/app-corp-vista": "^1.0.0",
|
|
41
|
-
"@appcorp/shadcn": "^1.1.
|
|
41
|
+
"@appcorp/shadcn": "^1.1.92",
|
|
42
42
|
"@chromatic-com/storybook": "^5.1.2",
|
|
43
43
|
"@commitlint/cli": "^20.5.0",
|
|
44
44
|
"@commitlint/config-conventional": "^20.5.0",
|