design-zystem 1.0.294 → 1.0.296
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/index.d.mts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +75 -0
- package/dist/index.mjs +73 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1219,6 +1219,7 @@ declare const GanttSwatch: ({ color, filled, }: {
|
|
|
1219
1219
|
* - "weekdayYear": short weekday + day + month + year
|
|
1220
1220
|
* - "weekdayTime": weekday/date + time (24h)
|
|
1221
1221
|
* - "longDate": day + full month + year, no weekday (ex: 16 mai 2024)
|
|
1222
|
+
* - "dayMonth": day + full month, no weekday (year only if different)
|
|
1222
1223
|
* - "dateISO": ISO format YYYY-MM-DD (timezone-safe for backend)
|
|
1223
1224
|
*/
|
|
1224
1225
|
declare const formatDate: (dateString: Date | string | number | null | undefined, type?: string, language?: string) => string;
|
|
@@ -1261,6 +1262,8 @@ declare const optimizeImage: (file: File | null | undefined, desiredBaseName: st
|
|
|
1261
1262
|
|
|
1262
1263
|
declare const getRelativeTime: (date: Date | string) => string;
|
|
1263
1264
|
|
|
1265
|
+
declare const getElapsedTime: (date: Date | string) => string;
|
|
1266
|
+
|
|
1264
1267
|
declare const formatTime: (time: string | null | undefined) => string;
|
|
1265
1268
|
|
|
1266
1269
|
declare const easterDate: (year: number) => Date;
|
|
@@ -1314,6 +1317,19 @@ declare const getInitials: (author: AuthorLike | null | undefined) => string;
|
|
|
1314
1317
|
|
|
1315
1318
|
declare const getAvatarColor: (key: string) => string;
|
|
1316
1319
|
|
|
1320
|
+
declare const PASTEL_COLORS: {
|
|
1321
|
+
background: string;
|
|
1322
|
+
text: string;
|
|
1323
|
+
}[];
|
|
1324
|
+
type PastelColorPair = (typeof PASTEL_COLORS)[number];
|
|
1325
|
+
/**
|
|
1326
|
+
* Couleur d'avatar déterministe pour un nom, en pastel avec sa couleur de texte
|
|
1327
|
+
* lisible. `generateHexColor` et `getAvatarColor` renvoient un hex saturé et
|
|
1328
|
+
* seul : ils ne conviennent ni au rendu pastel attendu, ni aux props
|
|
1329
|
+
* `backgroundColor` + `textColor` de l'`Avatar`.
|
|
1330
|
+
*/
|
|
1331
|
+
declare const getPastelColorPair: (firstName?: string, lastName?: string) => PastelColorPair;
|
|
1332
|
+
|
|
1317
1333
|
declare const formatNameWithInitial: (firstname: string | null, lastname: string | null) => string | null;
|
|
1318
1334
|
|
|
1319
1335
|
declare const getFileNameFromUrl: (url: string | null | undefined, fallback?: string) => string;
|
|
@@ -1336,4 +1352,4 @@ declare const formatKM: (value: string | number | null | undefined) => string;
|
|
|
1336
1352
|
|
|
1337
1353
|
declare const parseAmount: (value: string) => number | null;
|
|
1338
1354
|
|
|
1339
|
-
export { Accordion, type AccordionItem, Avatar, Banner, type BannerAction, type BannerProps, Box, Bubble, Bulk, Button, Card, type CardProps, CardSkeleton, Checkbox, Col, Collapse, ColorPicker, DatePicker, type DatePickerProps, type DatePreset, Divider, Drawer, EmptyState, FileUploadZone, type FloatingAction, FloatingButton, type FloatingButtonProps, Gantt, type GanttBand, type GanttBar, type GanttDay, GanttDot, type GanttProps, type GanttRow, GanttSwatch, Grid, Icon, IconTabs, Image, Input, Link, List, ListItem, MetricCard, Modal, ModalConfirmation, MultiSelect, NewModal, Options, PageContainer, Pagination, Popover, ProgressBar, Radio, Row, Select, type SelectOption, type SelectProps, SkeletonRow, SliderInput, type SortOrder, Spinner, Stepper, Switch, Table, TableBody, TableCell, TableFooter, TableFooterCell, TableFooterRow, TableHeader, TableHeaderCell, type TableHeaderCellProps, TableHeaderRow, TableRow, Tabs, TagBubble, Text, Timeline, type TimelineItem, type ToastOptions, type ToastType, Toaster, Tooltip, addBusinessDays, appendCacheBuster, appendQueryParam, capitalizeFirstLetter, colors, easterDate, formatAddress, formatCityFromFormattedAddress, formatCityWithPostalCode, formatDate, formatDateWithTime, formatDistance, formatDuration, formatEuro, formatKM, formatLocality, formatName, formatNameWithInitial, formatPhoneNumber, formatPlate, formatPlateWithoutDashes, formatPostalCodeFromFormattedAddress, formatRegionCode, formatTime, formatVin, generateHexColor, getAvatarColor, getCleanFileName, getFileIconByMimeType, getFileKind, getFileNameFromUrl, getInitials, getMimeCategory, getRelativeTime, isHoliday, isSameDay, isolateCity, optimizeImage, parseAmount, parseIsoDate, toast, truncateFileName, truncateText };
|
|
1355
|
+
export { Accordion, type AccordionItem, Avatar, Banner, type BannerAction, type BannerProps, Box, Bubble, Bulk, Button, Card, type CardProps, CardSkeleton, Checkbox, Col, Collapse, ColorPicker, DatePicker, type DatePickerProps, type DatePreset, Divider, Drawer, EmptyState, FileUploadZone, type FloatingAction, FloatingButton, type FloatingButtonProps, Gantt, type GanttBand, type GanttBar, type GanttDay, GanttDot, type GanttProps, type GanttRow, GanttSwatch, Grid, Icon, IconTabs, Image, Input, Link, List, ListItem, MetricCard, Modal, ModalConfirmation, MultiSelect, NewModal, Options, PageContainer, Pagination, type PastelColorPair, Popover, ProgressBar, Radio, Row, Select, type SelectOption, type SelectProps, SkeletonRow, SliderInput, type SortOrder, Spinner, Stepper, Switch, Table, TableBody, TableCell, TableFooter, TableFooterCell, TableFooterRow, TableHeader, TableHeaderCell, type TableHeaderCellProps, TableHeaderRow, TableRow, Tabs, TagBubble, Text, Timeline, type TimelineItem, type ToastOptions, type ToastType, Toaster, Tooltip, addBusinessDays, appendCacheBuster, appendQueryParam, capitalizeFirstLetter, colors, easterDate, formatAddress, formatCityFromFormattedAddress, formatCityWithPostalCode, formatDate, formatDateWithTime, formatDistance, formatDuration, formatEuro, formatKM, formatLocality, formatName, formatNameWithInitial, formatPhoneNumber, formatPlate, formatPlateWithoutDashes, formatPostalCodeFromFormattedAddress, formatRegionCode, formatTime, formatVin, generateHexColor, getAvatarColor, getCleanFileName, getElapsedTime, getFileIconByMimeType, getFileKind, getFileNameFromUrl, getInitials, getMimeCategory, getPastelColorPair, getRelativeTime, isHoliday, isSameDay, isolateCity, optimizeImage, parseAmount, parseIsoDate, toast, truncateFileName, truncateText };
|
package/dist/index.d.ts
CHANGED
|
@@ -1219,6 +1219,7 @@ declare const GanttSwatch: ({ color, filled, }: {
|
|
|
1219
1219
|
* - "weekdayYear": short weekday + day + month + year
|
|
1220
1220
|
* - "weekdayTime": weekday/date + time (24h)
|
|
1221
1221
|
* - "longDate": day + full month + year, no weekday (ex: 16 mai 2024)
|
|
1222
|
+
* - "dayMonth": day + full month, no weekday (year only if different)
|
|
1222
1223
|
* - "dateISO": ISO format YYYY-MM-DD (timezone-safe for backend)
|
|
1223
1224
|
*/
|
|
1224
1225
|
declare const formatDate: (dateString: Date | string | number | null | undefined, type?: string, language?: string) => string;
|
|
@@ -1261,6 +1262,8 @@ declare const optimizeImage: (file: File | null | undefined, desiredBaseName: st
|
|
|
1261
1262
|
|
|
1262
1263
|
declare const getRelativeTime: (date: Date | string) => string;
|
|
1263
1264
|
|
|
1265
|
+
declare const getElapsedTime: (date: Date | string) => string;
|
|
1266
|
+
|
|
1264
1267
|
declare const formatTime: (time: string | null | undefined) => string;
|
|
1265
1268
|
|
|
1266
1269
|
declare const easterDate: (year: number) => Date;
|
|
@@ -1314,6 +1317,19 @@ declare const getInitials: (author: AuthorLike | null | undefined) => string;
|
|
|
1314
1317
|
|
|
1315
1318
|
declare const getAvatarColor: (key: string) => string;
|
|
1316
1319
|
|
|
1320
|
+
declare const PASTEL_COLORS: {
|
|
1321
|
+
background: string;
|
|
1322
|
+
text: string;
|
|
1323
|
+
}[];
|
|
1324
|
+
type PastelColorPair = (typeof PASTEL_COLORS)[number];
|
|
1325
|
+
/**
|
|
1326
|
+
* Couleur d'avatar déterministe pour un nom, en pastel avec sa couleur de texte
|
|
1327
|
+
* lisible. `generateHexColor` et `getAvatarColor` renvoient un hex saturé et
|
|
1328
|
+
* seul : ils ne conviennent ni au rendu pastel attendu, ni aux props
|
|
1329
|
+
* `backgroundColor` + `textColor` de l'`Avatar`.
|
|
1330
|
+
*/
|
|
1331
|
+
declare const getPastelColorPair: (firstName?: string, lastName?: string) => PastelColorPair;
|
|
1332
|
+
|
|
1317
1333
|
declare const formatNameWithInitial: (firstname: string | null, lastname: string | null) => string | null;
|
|
1318
1334
|
|
|
1319
1335
|
declare const getFileNameFromUrl: (url: string | null | undefined, fallback?: string) => string;
|
|
@@ -1336,4 +1352,4 @@ declare const formatKM: (value: string | number | null | undefined) => string;
|
|
|
1336
1352
|
|
|
1337
1353
|
declare const parseAmount: (value: string) => number | null;
|
|
1338
1354
|
|
|
1339
|
-
export { Accordion, type AccordionItem, Avatar, Banner, type BannerAction, type BannerProps, Box, Bubble, Bulk, Button, Card, type CardProps, CardSkeleton, Checkbox, Col, Collapse, ColorPicker, DatePicker, type DatePickerProps, type DatePreset, Divider, Drawer, EmptyState, FileUploadZone, type FloatingAction, FloatingButton, type FloatingButtonProps, Gantt, type GanttBand, type GanttBar, type GanttDay, GanttDot, type GanttProps, type GanttRow, GanttSwatch, Grid, Icon, IconTabs, Image, Input, Link, List, ListItem, MetricCard, Modal, ModalConfirmation, MultiSelect, NewModal, Options, PageContainer, Pagination, Popover, ProgressBar, Radio, Row, Select, type SelectOption, type SelectProps, SkeletonRow, SliderInput, type SortOrder, Spinner, Stepper, Switch, Table, TableBody, TableCell, TableFooter, TableFooterCell, TableFooterRow, TableHeader, TableHeaderCell, type TableHeaderCellProps, TableHeaderRow, TableRow, Tabs, TagBubble, Text, Timeline, type TimelineItem, type ToastOptions, type ToastType, Toaster, Tooltip, addBusinessDays, appendCacheBuster, appendQueryParam, capitalizeFirstLetter, colors, easterDate, formatAddress, formatCityFromFormattedAddress, formatCityWithPostalCode, formatDate, formatDateWithTime, formatDistance, formatDuration, formatEuro, formatKM, formatLocality, formatName, formatNameWithInitial, formatPhoneNumber, formatPlate, formatPlateWithoutDashes, formatPostalCodeFromFormattedAddress, formatRegionCode, formatTime, formatVin, generateHexColor, getAvatarColor, getCleanFileName, getFileIconByMimeType, getFileKind, getFileNameFromUrl, getInitials, getMimeCategory, getRelativeTime, isHoliday, isSameDay, isolateCity, optimizeImage, parseAmount, parseIsoDate, toast, truncateFileName, truncateText };
|
|
1355
|
+
export { Accordion, type AccordionItem, Avatar, Banner, type BannerAction, type BannerProps, Box, Bubble, Bulk, Button, Card, type CardProps, CardSkeleton, Checkbox, Col, Collapse, ColorPicker, DatePicker, type DatePickerProps, type DatePreset, Divider, Drawer, EmptyState, FileUploadZone, type FloatingAction, FloatingButton, type FloatingButtonProps, Gantt, type GanttBand, type GanttBar, type GanttDay, GanttDot, type GanttProps, type GanttRow, GanttSwatch, Grid, Icon, IconTabs, Image, Input, Link, List, ListItem, MetricCard, Modal, ModalConfirmation, MultiSelect, NewModal, Options, PageContainer, Pagination, type PastelColorPair, Popover, ProgressBar, Radio, Row, Select, type SelectOption, type SelectProps, SkeletonRow, SliderInput, type SortOrder, Spinner, Stepper, Switch, Table, TableBody, TableCell, TableFooter, TableFooterCell, TableFooterRow, TableHeader, TableHeaderCell, type TableHeaderCellProps, TableHeaderRow, TableRow, Tabs, TagBubble, Text, Timeline, type TimelineItem, type ToastOptions, type ToastType, Toaster, Tooltip, addBusinessDays, appendCacheBuster, appendQueryParam, capitalizeFirstLetter, colors, easterDate, formatAddress, formatCityFromFormattedAddress, formatCityWithPostalCode, formatDate, formatDateWithTime, formatDistance, formatDuration, formatEuro, formatKM, formatLocality, formatName, formatNameWithInitial, formatPhoneNumber, formatPlate, formatPlateWithoutDashes, formatPostalCodeFromFormattedAddress, formatRegionCode, formatTime, formatVin, generateHexColor, getAvatarColor, getCleanFileName, getElapsedTime, getFileIconByMimeType, getFileKind, getFileNameFromUrl, getInitials, getMimeCategory, getPastelColorPair, getRelativeTime, isHoliday, isSameDay, isolateCity, optimizeImage, parseAmount, parseIsoDate, toast, truncateFileName, truncateText };
|
package/dist/index.js
CHANGED
|
@@ -151,11 +151,13 @@ __export(index_exports, {
|
|
|
151
151
|
generateHexColor: () => generateHexColor,
|
|
152
152
|
getAvatarColor: () => getAvatarColor,
|
|
153
153
|
getCleanFileName: () => getCleanFileName,
|
|
154
|
+
getElapsedTime: () => getElapsedTime,
|
|
154
155
|
getFileIconByMimeType: () => getFileIconByMimeType,
|
|
155
156
|
getFileKind: () => getFileKind,
|
|
156
157
|
getFileNameFromUrl: () => getFileNameFromUrl,
|
|
157
158
|
getInitials: () => getInitials2,
|
|
158
159
|
getMimeCategory: () => getMimeCategory,
|
|
160
|
+
getPastelColorPair: () => getPastelColorPair,
|
|
159
161
|
getRelativeTime: () => getRelativeTime,
|
|
160
162
|
isHoliday: () => isHoliday,
|
|
161
163
|
isSameDay: () => isSameDay,
|
|
@@ -6711,6 +6713,14 @@ var formatDate = (dateString, type = "date", language = "en") => {
|
|
|
6711
6713
|
}
|
|
6712
6714
|
case "longDate":
|
|
6713
6715
|
return format({ day: "numeric", month: "long", year: "numeric" });
|
|
6716
|
+
case "dayMonth": {
|
|
6717
|
+
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
6718
|
+
const dateYear = date.getFullYear();
|
|
6719
|
+
return format(__spreadValues({
|
|
6720
|
+
day: "numeric",
|
|
6721
|
+
month: "long"
|
|
6722
|
+
}, dateYear !== currentYear && { year: "numeric" }));
|
|
6723
|
+
}
|
|
6714
6724
|
case "monthYear":
|
|
6715
6725
|
return format({ month: "long", year: "numeric" });
|
|
6716
6726
|
default:
|
|
@@ -6925,6 +6935,27 @@ var getRelativeTime = (date) => {
|
|
|
6925
6935
|
return "\xE0 l'instant";
|
|
6926
6936
|
};
|
|
6927
6937
|
|
|
6938
|
+
// src/utils/date/getElapsedTime.ts
|
|
6939
|
+
var UNITS2 = [
|
|
6940
|
+
{ name: "an", seconds: 31536e3, pluralize: true },
|
|
6941
|
+
{ name: "mois", seconds: 2592e3, pluralize: false },
|
|
6942
|
+
{ name: "semaine", seconds: 604800, pluralize: true },
|
|
6943
|
+
{ name: "jour", seconds: 86400, pluralize: true }
|
|
6944
|
+
];
|
|
6945
|
+
var getElapsedTime = (date) => {
|
|
6946
|
+
const elapsedSeconds = Math.floor(
|
|
6947
|
+
(Date.now() - new Date(date).getTime()) / 1e3
|
|
6948
|
+
);
|
|
6949
|
+
for (const unit of UNITS2) {
|
|
6950
|
+
const interval = Math.floor(elapsedSeconds / unit.seconds);
|
|
6951
|
+
if (interval >= 1) {
|
|
6952
|
+
const suffix = unit.pluralize && interval > 1 ? "s" : "";
|
|
6953
|
+
return `${interval} ${unit.name}${suffix}`;
|
|
6954
|
+
}
|
|
6955
|
+
}
|
|
6956
|
+
return "aujourd'hui";
|
|
6957
|
+
};
|
|
6958
|
+
|
|
6928
6959
|
// src/utils/date/formatTime.ts
|
|
6929
6960
|
var formatTime = (time) => {
|
|
6930
6961
|
if (!time) return "";
|
|
@@ -7179,6 +7210,48 @@ var getAvatarColor = (key) => {
|
|
|
7179
7210
|
return AVATAR_COLORS[hashString(key) % AVATAR_COLORS.length];
|
|
7180
7211
|
};
|
|
7181
7212
|
|
|
7213
|
+
// src/utils/string/getPastelColorPair.ts
|
|
7214
|
+
var PASTEL_COLORS = [
|
|
7215
|
+
{ background: "#ffe5e5", text: "#993333" },
|
|
7216
|
+
{ background: "#ffd9cc", text: "#994d33" },
|
|
7217
|
+
{ background: "#ffedcc", text: "#996633" },
|
|
7218
|
+
{ background: "#fff5cc", text: "#997a33" },
|
|
7219
|
+
{ background: "#f9ffcc", text: "#7a9933" },
|
|
7220
|
+
{ background: "#ecffcc", text: "#669933" },
|
|
7221
|
+
{ background: "#ddffcc", text: "#339933" },
|
|
7222
|
+
{ background: "#ccffd9", text: "#33996b" },
|
|
7223
|
+
{ background: "#ccffe5", text: "#339988" },
|
|
7224
|
+
{ background: "#ccfff5", text: "#339999" },
|
|
7225
|
+
{ background: "#ccf5ff", text: "#337a99" },
|
|
7226
|
+
{ background: "#ccecff", text: "#336699" },
|
|
7227
|
+
{ background: "#ccdfff", text: "#334d99" },
|
|
7228
|
+
{ background: "#ccd1ff", text: "#333399" },
|
|
7229
|
+
{ background: "#e5ccff", text: "#5c3399" },
|
|
7230
|
+
{ background: "#f2ccff", text: "#7a3399" },
|
|
7231
|
+
{ background: "#ffccf9", text: "#99337a" },
|
|
7232
|
+
{ background: "#ffcce5", text: "#993366" },
|
|
7233
|
+
{ background: "#ffccd9", text: "#99334d" },
|
|
7234
|
+
{ background: "#dbffcc", text: "#4d9933" },
|
|
7235
|
+
{ background: "#ccffe8", text: "#33997a" },
|
|
7236
|
+
{ background: "#daccff", text: "#443399" },
|
|
7237
|
+
{ background: "#ecccff", text: "#663399" },
|
|
7238
|
+
{ background: "#cce0ff", text: "#334d99" },
|
|
7239
|
+
{ background: "#f5ccff", text: "#7a3399" },
|
|
7240
|
+
{ background: "#ffcce8", text: "#993366" },
|
|
7241
|
+
{ background: "#f0ffcc", text: "#669933" },
|
|
7242
|
+
{ background: "#ccffd2", text: "#33994d" },
|
|
7243
|
+
{ background: "#ccffe0", text: "#339966" }
|
|
7244
|
+
];
|
|
7245
|
+
var getPastelColorPair = (firstName = "", lastName = "") => {
|
|
7246
|
+
var _a, _b, _c, _d;
|
|
7247
|
+
const fullName = ((_b = (_a = firstName == null ? void 0 : firstName.trim()) == null ? void 0 : _a.toLowerCase()) != null ? _b : "") + ((_d = (_c = lastName == null ? void 0 : lastName.trim()) == null ? void 0 : _c.toLowerCase()) != null ? _d : "");
|
|
7248
|
+
let hash = 0;
|
|
7249
|
+
for (let i = 0; i < fullName.length; i++) {
|
|
7250
|
+
hash = fullName.charCodeAt(i) + ((hash << 5) - hash);
|
|
7251
|
+
}
|
|
7252
|
+
return PASTEL_COLORS[Math.abs(hash) % PASTEL_COLORS.length];
|
|
7253
|
+
};
|
|
7254
|
+
|
|
7182
7255
|
// src/utils/string/formatNameWithInitial.ts
|
|
7183
7256
|
var formatNameWithInitial = (firstname, lastname) => {
|
|
7184
7257
|
if (!firstname && !lastname) return null;
|
|
@@ -7363,11 +7436,13 @@ var parseAmount = (value) => {
|
|
|
7363
7436
|
generateHexColor,
|
|
7364
7437
|
getAvatarColor,
|
|
7365
7438
|
getCleanFileName,
|
|
7439
|
+
getElapsedTime,
|
|
7366
7440
|
getFileIconByMimeType,
|
|
7367
7441
|
getFileKind,
|
|
7368
7442
|
getFileNameFromUrl,
|
|
7369
7443
|
getInitials,
|
|
7370
7444
|
getMimeCategory,
|
|
7445
|
+
getPastelColorPair,
|
|
7371
7446
|
getRelativeTime,
|
|
7372
7447
|
isHoliday,
|
|
7373
7448
|
isSameDay,
|
package/dist/index.mjs
CHANGED
|
@@ -6592,6 +6592,14 @@ var formatDate = (dateString, type = "date", language = "en") => {
|
|
|
6592
6592
|
}
|
|
6593
6593
|
case "longDate":
|
|
6594
6594
|
return format({ day: "numeric", month: "long", year: "numeric" });
|
|
6595
|
+
case "dayMonth": {
|
|
6596
|
+
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
6597
|
+
const dateYear = date.getFullYear();
|
|
6598
|
+
return format(__spreadValues({
|
|
6599
|
+
day: "numeric",
|
|
6600
|
+
month: "long"
|
|
6601
|
+
}, dateYear !== currentYear && { year: "numeric" }));
|
|
6602
|
+
}
|
|
6595
6603
|
case "monthYear":
|
|
6596
6604
|
return format({ month: "long", year: "numeric" });
|
|
6597
6605
|
default:
|
|
@@ -6806,6 +6814,27 @@ var getRelativeTime = (date) => {
|
|
|
6806
6814
|
return "\xE0 l'instant";
|
|
6807
6815
|
};
|
|
6808
6816
|
|
|
6817
|
+
// src/utils/date/getElapsedTime.ts
|
|
6818
|
+
var UNITS2 = [
|
|
6819
|
+
{ name: "an", seconds: 31536e3, pluralize: true },
|
|
6820
|
+
{ name: "mois", seconds: 2592e3, pluralize: false },
|
|
6821
|
+
{ name: "semaine", seconds: 604800, pluralize: true },
|
|
6822
|
+
{ name: "jour", seconds: 86400, pluralize: true }
|
|
6823
|
+
];
|
|
6824
|
+
var getElapsedTime = (date) => {
|
|
6825
|
+
const elapsedSeconds = Math.floor(
|
|
6826
|
+
(Date.now() - new Date(date).getTime()) / 1e3
|
|
6827
|
+
);
|
|
6828
|
+
for (const unit of UNITS2) {
|
|
6829
|
+
const interval = Math.floor(elapsedSeconds / unit.seconds);
|
|
6830
|
+
if (interval >= 1) {
|
|
6831
|
+
const suffix = unit.pluralize && interval > 1 ? "s" : "";
|
|
6832
|
+
return `${interval} ${unit.name}${suffix}`;
|
|
6833
|
+
}
|
|
6834
|
+
}
|
|
6835
|
+
return "aujourd'hui";
|
|
6836
|
+
};
|
|
6837
|
+
|
|
6809
6838
|
// src/utils/date/formatTime.ts
|
|
6810
6839
|
var formatTime = (time) => {
|
|
6811
6840
|
if (!time) return "";
|
|
@@ -7060,6 +7089,48 @@ var getAvatarColor = (key) => {
|
|
|
7060
7089
|
return AVATAR_COLORS[hashString(key) % AVATAR_COLORS.length];
|
|
7061
7090
|
};
|
|
7062
7091
|
|
|
7092
|
+
// src/utils/string/getPastelColorPair.ts
|
|
7093
|
+
var PASTEL_COLORS = [
|
|
7094
|
+
{ background: "#ffe5e5", text: "#993333" },
|
|
7095
|
+
{ background: "#ffd9cc", text: "#994d33" },
|
|
7096
|
+
{ background: "#ffedcc", text: "#996633" },
|
|
7097
|
+
{ background: "#fff5cc", text: "#997a33" },
|
|
7098
|
+
{ background: "#f9ffcc", text: "#7a9933" },
|
|
7099
|
+
{ background: "#ecffcc", text: "#669933" },
|
|
7100
|
+
{ background: "#ddffcc", text: "#339933" },
|
|
7101
|
+
{ background: "#ccffd9", text: "#33996b" },
|
|
7102
|
+
{ background: "#ccffe5", text: "#339988" },
|
|
7103
|
+
{ background: "#ccfff5", text: "#339999" },
|
|
7104
|
+
{ background: "#ccf5ff", text: "#337a99" },
|
|
7105
|
+
{ background: "#ccecff", text: "#336699" },
|
|
7106
|
+
{ background: "#ccdfff", text: "#334d99" },
|
|
7107
|
+
{ background: "#ccd1ff", text: "#333399" },
|
|
7108
|
+
{ background: "#e5ccff", text: "#5c3399" },
|
|
7109
|
+
{ background: "#f2ccff", text: "#7a3399" },
|
|
7110
|
+
{ background: "#ffccf9", text: "#99337a" },
|
|
7111
|
+
{ background: "#ffcce5", text: "#993366" },
|
|
7112
|
+
{ background: "#ffccd9", text: "#99334d" },
|
|
7113
|
+
{ background: "#dbffcc", text: "#4d9933" },
|
|
7114
|
+
{ background: "#ccffe8", text: "#33997a" },
|
|
7115
|
+
{ background: "#daccff", text: "#443399" },
|
|
7116
|
+
{ background: "#ecccff", text: "#663399" },
|
|
7117
|
+
{ background: "#cce0ff", text: "#334d99" },
|
|
7118
|
+
{ background: "#f5ccff", text: "#7a3399" },
|
|
7119
|
+
{ background: "#ffcce8", text: "#993366" },
|
|
7120
|
+
{ background: "#f0ffcc", text: "#669933" },
|
|
7121
|
+
{ background: "#ccffd2", text: "#33994d" },
|
|
7122
|
+
{ background: "#ccffe0", text: "#339966" }
|
|
7123
|
+
];
|
|
7124
|
+
var getPastelColorPair = (firstName = "", lastName = "") => {
|
|
7125
|
+
var _a, _b, _c, _d;
|
|
7126
|
+
const fullName = ((_b = (_a = firstName == null ? void 0 : firstName.trim()) == null ? void 0 : _a.toLowerCase()) != null ? _b : "") + ((_d = (_c = lastName == null ? void 0 : lastName.trim()) == null ? void 0 : _c.toLowerCase()) != null ? _d : "");
|
|
7127
|
+
let hash = 0;
|
|
7128
|
+
for (let i = 0; i < fullName.length; i++) {
|
|
7129
|
+
hash = fullName.charCodeAt(i) + ((hash << 5) - hash);
|
|
7130
|
+
}
|
|
7131
|
+
return PASTEL_COLORS[Math.abs(hash) % PASTEL_COLORS.length];
|
|
7132
|
+
};
|
|
7133
|
+
|
|
7063
7134
|
// src/utils/string/formatNameWithInitial.ts
|
|
7064
7135
|
var formatNameWithInitial = (firstname, lastname) => {
|
|
7065
7136
|
if (!firstname && !lastname) return null;
|
|
@@ -7243,11 +7314,13 @@ export {
|
|
|
7243
7314
|
generateHexColor,
|
|
7244
7315
|
getAvatarColor,
|
|
7245
7316
|
getCleanFileName,
|
|
7317
|
+
getElapsedTime,
|
|
7246
7318
|
getFileIconByMimeType,
|
|
7247
7319
|
getFileKind,
|
|
7248
7320
|
getFileNameFromUrl,
|
|
7249
7321
|
getInitials2 as getInitials,
|
|
7250
7322
|
getMimeCategory,
|
|
7323
|
+
getPastelColorPair,
|
|
7251
7324
|
getRelativeTime,
|
|
7252
7325
|
isHoliday,
|
|
7253
7326
|
isSameDay,
|