@homefile/components-v2 2.60.2 → 2.61.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.
@@ -266,7 +266,8 @@
266
266
  "placeholderDescription": "Enter a description",
267
267
  "title": "Files",
268
268
  "errorSize": "Please select a file less than 25MB",
269
- "errorType": "File type must be .jpeg, .jpg, .pdf, .txt, .doc or .docx"
269
+ "errorType": "File type must be .jpeg, .jpg, .pdf, .txt, .doc or .docx",
270
+ "errorTypeWithSpreadsheets": "File type must be .jpeg, .jpg, .pdf, .txt, .doc, .docx, .xlsx, .xls or .csv"
270
271
  },
271
272
  "fileThumbnail": "File Thumbnail",
272
273
  "filters": {
@@ -1131,7 +1132,7 @@
1131
1132
  "signin": {
1132
1133
  "forgotBt": "Forgot Password?",
1133
1134
  "title": "Please Log in",
1134
- "titleSocial": "Please login with",
1135
+ "titleSocial": "Please login",
1135
1136
  "signinBt": "Log in",
1136
1137
  "signupBt": "Sign up",
1137
1138
  "signup": "Don’t have a Homefile account?",
@@ -6,6 +6,7 @@ export const FilesUploader = ({ displayType, initialHeight, onUpload, totalFiles
6
6
  const { acceptedFiles, errorMessage, getInputProps, getRootProps } = useFilesUploader({
7
7
  onUpload,
8
8
  uploading,
9
+ acceptSpreadsheets: true,
9
10
  });
10
11
  const isGrid = displayType === 'grid';
11
12
  const hasFiles = totalFiles > 0;
@@ -1,7 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Container, Flex, IconButton, Stack, Text } from '@chakra-ui/react';
2
+ import { Box, Container, Flex, IconButton, Stack, Text } from '@chakra-ui/react';
3
3
  import { Close } from '../../components';
4
- import { formatDateWithAt } from '../../utils';
4
+ import { formatNotificationDate } from '../../utils';
5
+ // Matt's notification design (2026-10): a soft shadow, the title in Poppins
6
+ // semibold caps, "11:35 AM · Wed, Oct 12, 2024" in grey, the message in
7
+ // Assistant 16px / 20px line height, 20px padding under it, 13px left and
8
+ // right, a 16px close X, a 12px title (Matt, 2026-10-05). Every line height
9
+ // is at most font size + 4px (his rule): title 16px, date 14px, message 20px.
10
+ // Each kind keeps its own colour.
11
+ const DATE_GREY = '#707070';
12
+ const MESSAGE_COLOR = '#3E4045';
13
+ const CLOSE_BLUE = '#3C80BA';
5
14
  export const NotificationCard = ({ _id, createdAt, label, message, onDismiss, status, }) => {
6
15
  const bgColors = {
7
16
  added: 'lightGreen.3',
@@ -15,5 +24,6 @@ export const NotificationCard = ({ _id, createdAt, label, message, onDismiss, st
15
24
  shared: 'yellow.1',
16
25
  updated: 'lightBlue.9',
17
26
  };
18
- return (_jsx(Container, { p: "2", bg: bgColors[status], children: _jsxs(Stack, { spacing: "3", children: [_jsxs(Flex, { justify: "space-between", align: "center", children: [_jsx(Text, { fontSize: "10px", fontWeight: "semibold", textTransform: "uppercase", color: colors[status], children: label }), _jsxs(Flex, { gap: "1", align: "center", children: [_jsx(Text, { variant: "date", children: formatDateWithAt({ date: createdAt }) }), _jsx(IconButton, { variant: "ghost", "aria-label": "close", maxW: "fit-content", onClick: () => onDismiss(_id), icon: _jsx(Close, { size: 11 }) })] })] }), _jsx(Text, { fontSize: "sm", fontFamily: "secondary", children: message })] }) }));
27
+ const { time, day } = formatNotificationDate({ date: createdAt });
28
+ return (_jsx(Container, { pt: "2", pb: "20px", px: "13px", bg: bgColors[status], boxShadow: "0 3px 6px rgba(0, 0, 0, 0.16)", children: _jsxs(Stack, { spacing: "3", children: [_jsxs(Flex, { justify: "space-between", align: "center", children: [_jsx(Text, { fontSize: "12px", lineHeight: "16px", fontFamily: "primary", fontWeight: "semibold", textTransform: "uppercase", color: colors[status], children: label }), _jsxs(Flex, { gap: "2", align: "center", children: [_jsxs(Flex, { gap: "1.5", align: "center", children: [_jsx(Text, { variant: "date", lineHeight: "14px", color: DATE_GREY, children: time }), _jsx(Box, { "aria-hidden": true, w: "2px", h: "2px", borderRadius: "full", bg: DATE_GREY }), _jsx(Text, { variant: "date", lineHeight: "14px", color: DATE_GREY, children: day })] }), _jsx(IconButton, { variant: "ghost", "aria-label": "close", maxW: "fit-content", onClick: () => onDismiss(_id), icon: _jsx(Close, { size: 16, stroke: CLOSE_BLUE }) })] })] }), _jsx(Text, { fontSize: "16px", lineHeight: "20px", fontFamily: "secondary", color: MESSAGE_COLOR, children: message })] }) }));
19
29
  };
@@ -3,8 +3,9 @@ interface FilesUploaderHookI {
3
3
  onUpload?: (files: FolderFileI[]) => void;
4
4
  uploading: boolean;
5
5
  displayImages?: string[];
6
+ acceptSpreadsheets?: boolean;
6
7
  }
7
- export declare const useFilesUploader: ({ onUpload, uploading, displayImages, }: FilesUploaderHookI) => {
8
+ export declare const useFilesUploader: ({ onUpload, uploading, displayImages, acceptSpreadsheets, }: FilesUploaderHookI) => {
8
9
  acceptedFiles: FolderFileI[];
9
10
  errorMessage: string;
10
11
  getRootProps: <T extends import("react-dropzone").DropzoneRootProps>(props?: T) => T;
@@ -2,19 +2,21 @@ import { handleMapFile } from '../../utils';
2
2
  import { t } from 'i18next';
3
3
  import { useEffect, useState } from 'react';
4
4
  import { useDropzone } from 'react-dropzone';
5
- export const useFilesUploader = ({ onUpload, uploading, displayImages = [], }) => {
5
+ const SPREADSHEETS = {
6
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': [
7
+ '.xlsx',
8
+ ],
9
+ 'application/vnd.ms-excel': ['.xls'],
10
+ 'text/csv': ['.csv'],
11
+ };
12
+ export const useFilesUploader = ({ onUpload, uploading, displayImages = [], acceptSpreadsheets = false, }) => {
6
13
  const [isUploading, setIsUploading] = useState(false);
7
14
  const [thumbnails, setThumbnails] = useState(displayImages);
8
15
  const [acceptedFiles, setAcceptedFiles] = useState([]);
9
16
  const [errorMessage, setErrorMessage] = useState('');
10
17
  const hasError = errorMessage !== '';
11
18
  const { getRootProps, getInputProps } = useDropzone({
12
- accept: {
13
- 'image/*': ['.jpeg', '.jpg', '.pdf', '.txt', '.doc', '.docx', '.heic'],
14
- 'video/mp4': ['.mp4', '.MP4'],
15
- 'video/mov': ['.mov', '.MOV'],
16
- 'video/quicktime': ['.mov', '.MOV'],
17
- },
19
+ accept: Object.assign({ 'image/*': ['.jpeg', '.jpg', '.pdf', '.txt', '.doc', '.docx', '.heic'], 'video/mp4': ['.mp4', '.MP4'], 'video/mov': ['.mov', '.MOV'], 'video/quicktime': ['.mov', '.MOV'] }, (acceptSpreadsheets ? SPREADSHEETS : {})),
18
20
  disabled: isUploading,
19
21
  maxSize: 25000000,
20
22
  onDrop: (uploadedFiles) => {
@@ -24,7 +26,9 @@ export const useFilesUploader = ({ onUpload, uploading, displayImages = [], }) =
24
26
  onDropRejected: (rejectFiles) => {
25
27
  setErrorMessage(rejectFiles[0].errors[0].code === 'file-too-large'
26
28
  ? t('folderSharing.details.errorSize')
27
- : t('folderSharing.details.errorType'));
29
+ : t(acceptSpreadsheets
30
+ ? 'folderSharing.details.errorTypeWithSpreadsheets'
31
+ : 'folderSharing.details.errorType'));
28
32
  },
29
33
  });
30
34
  useEffect(() => {
@@ -6,6 +6,10 @@ interface FormatDateI {
6
6
  export declare const formatDate: ({ date, locale }: FormatDateI) => string;
7
7
  export declare const formatDateWithAt: ({ date, locale, }: FormatDateI) => string;
8
8
  export declare const formatLongDateWithAt: ({ date }: FormatDateI) => string;
9
+ export declare const formatNotificationDate: ({ date }: FormatDateI) => {
10
+ time: string;
11
+ day: string;
12
+ };
9
13
  export declare const shortFormatDate: ({ date, locale, }: FormatDateI) => string;
10
14
  export declare const monthAndYearFormatDate: ({ date, locale, }: FormatDateI) => string;
11
15
  export declare const dayAndMonthFormatDate: ({ date, locale, }: FormatDateI) => string;
@@ -43,6 +43,16 @@ export const formatLongDateWithAt = ({ date }) => {
43
43
  const timeFormat = format(parsedDate, 'h:mm a');
44
44
  return `${dateFormat} @${timeFormat}`;
45
45
  };
46
+ // Notification cards (Matt's design, 2026-10): "11:35 AM" · "Wed, Oct 12, 2024".
47
+ export const formatNotificationDate = ({ date }) => {
48
+ if (!date)
49
+ return { time: '', day: '' };
50
+ const parsedDate = new Date(date);
51
+ return {
52
+ time: format(parsedDate, 'h:mm a'),
53
+ day: format(parsedDate, 'EEE, MMM d, yyyy'),
54
+ };
55
+ };
46
56
  export const shortFormatDate = ({ date, locale = 'en-US', }) => {
47
57
  if (!date)
48
58
  return '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homefile/components-v2",
3
- "version": "2.60.2",
3
+ "version": "2.61.0",
4
4
  "author": "Homefile",
5
5
  "license": "UNLICENSED",
6
6
  "typings": "dist/index.d.ts",