@vrobots/storybook 0.1.62 → 0.1.64

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vrobots/storybook",
3
3
  "private": false,
4
- "version": "0.1.62",
4
+ "version": "0.1.64",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -5,7 +5,7 @@ export const Breadcrumbs = React.forwardRef(({ breadcrumbs }, ref) => {
5
5
  if (!!breadcrumbs) {
6
6
  const crumbs = breadcrumbs.map(({ title, nav, color: itemColor, onClick }, key) => {
7
7
  if (!!nav) {
8
- return (_jsxs(HStack, { children: [_jsx(Text, { as: 'button', color: itemColor || 'blue.500', whiteSpace: 'nowrap', wordBreak: 'break-word', fontSize: 'sm', truncate: true, onClick: () => onClick?.(nav), children: title }), _jsx(Text, { ml: 2, mr: 2, fontSize: 'sm', children: ">" })] }, `${title}-${key}`));
8
+ return (_jsxs(HStack, { children: [_jsx(Text, { as: 'button', color: itemColor || 'blue.500', whiteSpace: 'nowrap', wordBreak: 'break-word', fontSize: 'sm', cursor: 'pointer', truncate: true, onClick: () => onClick?.(nav), children: title }), _jsx(Text, { ml: 2, mr: 2, fontSize: 'sm', children: ">" })] }, `${title}-${key}`));
9
9
  }
10
10
  return (_jsx(Text, { whiteSpace: 'nowrap', wordBreak: 'break-word', color: 'gray.500', fontSize: 'sm', truncate: true, children: title }, `${title}-${key}`));
11
11
  });
@@ -7,6 +7,7 @@ export interface IFileUploaderProps extends CardRootProps {
7
7
  accept?: string;
8
8
  multiple?: boolean;
9
9
  onFilesSelected?: (files: File[]) => void;
10
+ children?: React.ReactNode;
10
11
  }
11
- declare const FileUploader: ({ title, description, buttonLabel, helperText, accept, multiple, onFilesSelected, ...props }: IFileUploaderProps) => import("react/jsx-runtime").JSX.Element;
12
+ declare const FileUploader: ({ title, description, buttonLabel, helperText, accept, multiple, onFilesSelected, children, ...props }: IFileUploaderProps) => import("react/jsx-runtime").JSX.Element;
12
13
  export default FileUploader;
@@ -27,7 +27,7 @@ const filterFilesByAccept = (files, accept) => {
27
27
  return files;
28
28
  return files.filter((file) => rules.some((rule) => fileMatchesRule(file, rule)));
29
29
  };
30
- const FileUploader = ({ title, description, buttonLabel, helperText, accept, multiple = true, onFilesSelected, ...props }) => {
30
+ const FileUploader = ({ title, description, buttonLabel, helperText, accept, multiple = true, onFilesSelected, children, ...props }) => {
31
31
  const [isDragging, setIsDragging] = useState(false);
32
32
  const [files, setFiles] = useState([]);
33
33
  const fileInputRef = useRef(null);
@@ -54,6 +54,6 @@ const FileUploader = ({ title, description, buttonLabel, helperText, accept, mul
54
54
  const droppedFiles = Array.from(event.dataTransfer.files ?? []);
55
55
  handleFiles(droppedFiles);
56
56
  };
57
- return (_jsx(Card.Root, { ...props, children: _jsxs(Card.Body, { children: [_jsx(Card.Title, { children: title || "Upload Files" }), !!description && _jsx(Card.Description, { children: description }), _jsxs(Box, { mt: 4, p: 6, borderWidth: "2px", borderStyle: "dashed", borderColor: isDragging ? "teal.500" : "border.emphasized", borderRadius: "md", bg: isDragging ? "teal.subtle" : "bg.muted", textAlign: "center", transition: "background 0.2s ease, border-color 0.2s ease", onDragEnter: handleDrag(true), onDragOver: handleDrag(true), onDragLeave: handleDrag(false), onDrop: handleDrop, children: [_jsx(Text, { fontWeight: "medium", children: "Drag and drop files here" }), _jsx(Text, { fontSize: "sm", color: "fg.muted", mt: 1, children: "or click the button below to browse from your device" }), _jsx("input", { ref: fileInputRef, type: "file", hidden: true, accept: accept, multiple: multiple, onChange: handleFileInputChange }), _jsx(Button, { mt: 4, onClick: () => fileInputRef.current?.click(), children: buttonLabel || "Choose Files" }), !!helperText && (_jsx(Text, { fontSize: "xs", color: "fg.muted", mt: 3, children: helperText }))] }), files.length > 0 && (_jsxs(Box, { mt: 4, children: [_jsx(Text, { fontSize: "sm", fontWeight: "medium", mb: 2, children: "Selected Files" }), _jsx(List.Root, { gap: "1", children: files.map((file) => (_jsx(List.Item, { children: file.name }, `${file.name}-${file.size}`))) })] }))] }) }));
57
+ return (_jsx(Card.Root, { ...props, children: _jsxs(Card.Body, { children: [_jsx(Card.Title, { children: title || "Upload Files" }), !!description && _jsx(Card.Description, { children: description }), _jsxs(Box, { mt: 4, p: 6, borderWidth: "2px", borderStyle: "dashed", borderColor: isDragging ? "teal.500" : "border.emphasized", borderRadius: "md", bg: isDragging ? "teal.subtle" : "bg.muted", textAlign: "center", transition: "background 0.2s ease, border-color 0.2s ease", onDragEnter: handleDrag(true), onDragOver: handleDrag(true), onDragLeave: handleDrag(false), onDrop: handleDrop, children: [_jsx(Text, { fontWeight: "medium", children: "Drag and drop files here" }), _jsx(Text, { fontSize: "sm", color: "fg.muted", mt: 1, children: "or click the button below to browse from your device" }), _jsx("input", { ref: fileInputRef, type: "file", hidden: true, accept: accept, multiple: multiple, onChange: handleFileInputChange }), _jsx(Button, { mt: 4, onClick: () => fileInputRef.current?.click(), children: buttonLabel || "Choose Files" }), !!helperText && (_jsx(Text, { fontSize: "xs", color: "fg.muted", mt: 3, children: helperText }))] }), files.length > 0 && (_jsxs(Box, { mt: 4, mb: 4, children: [_jsx(Text, { fontSize: "sm", fontWeight: "medium", mb: 2, children: "Selected Files" }), _jsx(List.Root, { gap: "1", children: files.map((file) => (_jsx(List.Item, { children: file.name }, `${file.name}-${file.size}`))) })] })), children] }) }));
58
58
  };
59
59
  export default FileUploader;
@@ -5,6 +5,6 @@ declare const Form: {
5
5
  (): null;
6
6
  Login: ({ title, description, onLogin, ...props }: import("./Login").ILoginProps) => import("react/jsx-runtime").JSX.Element;
7
7
  SecondFactorAuth: ({ title, description, onSecondFactorAuth, onResendAuthCode, ...props }: import("./SecondFactorAuth").ISecondFactorAuthProps) => import("react/jsx-runtime").JSX.Element;
8
- FileUploader: ({ title, description, buttonLabel, helperText, accept, multiple, onFilesSelected, ...props }: import("./FileUploader").IFileUploaderProps) => import("react/jsx-runtime").JSX.Element;
8
+ FileUploader: ({ title, description, buttonLabel, helperText, accept, multiple, onFilesSelected, children, ...props }: import("./FileUploader").IFileUploaderProps) => import("react/jsx-runtime").JSX.Element;
9
9
  };
10
10
  export default Form;
@@ -1,7 +1,7 @@
1
1
  import type { StoryObj } from '@storybook/react-vite';
2
2
  declare const meta: {
3
3
  title: string;
4
- component: ({ title, description, buttonLabel, helperText, accept, multiple, onFilesSelected, ...props }: import("../components").IFileUploaderProps) => import("react/jsx-runtime").JSX.Element;
4
+ component: ({ title, description, buttonLabel, helperText, accept, multiple, onFilesSelected, children, ...props }: import("../components").IFileUploaderProps) => import("react/jsx-runtime").JSX.Element;
5
5
  tags: string[];
6
6
  parameters: {
7
7
  layout: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vrobots/storybook",
3
3
  "private": false,
4
- "version": "0.1.62",
4
+ "version": "0.1.64",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",