@rainersoft/utils 1.0.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.
@@ -0,0 +1,108 @@
1
+ import { L as Locale } from './types-tUMATEGI.js';
2
+ export { C as CURRENCY_MAP, D as DEFAULT_LOCALE, a as LocaleConfig } from './types-tUMATEGI.js';
3
+ export { textToSlug } from './string/index.js';
4
+ export { formatDate, formatDateTime, formatRelativeDate, isValidDate, toISOString } from './date/index.js';
5
+ export { formatCurrency } from './number/index.js';
6
+ export { GenericStatus, getStatusColor, getStatusVariant, translateStatus } from './status/index.js';
7
+
8
+ declare function extractInitials(name: string | null | undefined, maxChars?: number): string;
9
+ declare function generateUniqueId(text: string, prefix?: string, suffix?: string): string;
10
+ declare function truncateText(text: string, maxLength: number, suffix?: string): string;
11
+ declare function capitalize(text: string, options?: {
12
+ firstWordOnly?: boolean;
13
+ lowerRest?: boolean;
14
+ }): string;
15
+ declare function cleanText(text: string, allowSpaces?: boolean): string;
16
+ declare function countWords(text: string): number;
17
+ declare function isEmpty(text: string | null | undefined): boolean;
18
+ declare function normalizeSpaces(text: string, options?: {
19
+ newlines?: boolean;
20
+ }): string;
21
+
22
+ interface ValidationResult {
23
+ isValid: boolean;
24
+ errors?: string[];
25
+ }
26
+ declare function validateEmail(email: string, locale?: Locale): ValidationResult;
27
+ declare function validatePassword(password: string, options?: {
28
+ minLength?: number;
29
+ requireUppercase?: boolean;
30
+ requireLowercase?: boolean;
31
+ requireNumbers?: boolean;
32
+ requireSpecialChars?: boolean;
33
+ }, locale?: Locale): ValidationResult;
34
+ declare function validateUrl(url: string, locale?: Locale): ValidationResult;
35
+ declare function validatePhone(phone: string, locale?: Locale): ValidationResult;
36
+ declare function validateUsername(username: string, options?: {
37
+ minLength?: number;
38
+ maxLength?: number;
39
+ allowSpecialChars?: boolean;
40
+ }, locale?: Locale): ValidationResult;
41
+ declare function validateSlug(slug: string, options?: {
42
+ minLength?: number;
43
+ maxLength?: number;
44
+ }, locale?: Locale): ValidationResult;
45
+ declare function validateText(text: string, options?: {
46
+ minLength?: number;
47
+ maxLength?: number;
48
+ fieldName?: string;
49
+ }, locale?: Locale): ValidationResult;
50
+
51
+ declare function prefersReducedMotion(): boolean;
52
+ declare function onReducedMotionChange(callback: (prefersReduced: boolean) => void): () => void;
53
+ declare function scrollToPosition(x?: number, y?: number, options?: {
54
+ smooth?: boolean;
55
+ behavior?: ScrollBehavior;
56
+ }): void;
57
+ declare function scrollToTop(smooth?: boolean): void;
58
+ declare function smoothScrollTo(x: number, y: number, duration?: number): void;
59
+ declare function scrollToElement(element: string | Element, options?: {
60
+ smooth?: boolean;
61
+ offset?: number;
62
+ behavior?: ScrollBehavior;
63
+ }): void;
64
+ declare function isElementVisible(element: string | Element, threshold?: number): boolean;
65
+ declare function getElementPosition(element: string | Element): {
66
+ x: number;
67
+ y: number;
68
+ } | null;
69
+ declare function isMobile(): boolean;
70
+ declare function isDarkMode(): boolean;
71
+ declare function onDarkModeChange(callback: (isDark: boolean) => void): () => void;
72
+ declare function copyToClipboard(text: string): Promise<boolean>;
73
+ declare function downloadFile(blob: Blob, filename: string): void;
74
+
75
+ declare function formatNumber$1(num: number): string;
76
+ declare function calculateChange(current: number, previous: number): number;
77
+ declare function formatPercentage(value: number, options?: {
78
+ showSign?: boolean;
79
+ decimals?: number;
80
+ }): string;
81
+ declare function generateMockChartData(days: number, locale?: string): Array<Record<string, any>>;
82
+ declare function groupDataByPeriod<T extends Record<string, any>>(data: T[]): T[];
83
+ declare function calculateMovingAverage(data: number[], window: number): number[];
84
+ declare function findMinMax<T extends Record<string, any>>(data: T[], field: keyof T): {
85
+ min: number;
86
+ max: number;
87
+ };
88
+
89
+ declare function formatDate(date: string | Date, format?: 'short' | 'long' | 'full'): string;
90
+ declare function formatDateTime(date: string | Date): string;
91
+ declare function formatRelativeDate(date: string | Date): string;
92
+ declare function formatCurrency(value: number, options?: Intl.NumberFormatOptions): string;
93
+ declare function formatNumber(value: number, decimals?: number): string;
94
+ declare function formatCompact(value: number, decimals?: number): string;
95
+ declare function translateStatus(status: string): string;
96
+
97
+ declare const ptBr_formatCompact: typeof formatCompact;
98
+ declare const ptBr_formatCurrency: typeof formatCurrency;
99
+ declare const ptBr_formatDate: typeof formatDate;
100
+ declare const ptBr_formatDateTime: typeof formatDateTime;
101
+ declare const ptBr_formatNumber: typeof formatNumber;
102
+ declare const ptBr_formatRelativeDate: typeof formatRelativeDate;
103
+ declare const ptBr_translateStatus: typeof translateStatus;
104
+ declare namespace ptBr {
105
+ export { ptBr_formatCompact as formatCompact, ptBr_formatCurrency as formatCurrency, ptBr_formatDate as formatDate, ptBr_formatDateTime as formatDateTime, ptBr_formatNumber as formatNumber, ptBr_formatRelativeDate as formatRelativeDate, ptBr_translateStatus as translateStatus };
106
+ }
107
+
108
+ export { Locale, type ValidationResult, calculateChange, calculateMovingAverage, capitalize, cleanText, copyToClipboard, countWords, downloadFile, extractInitials, findMinMax, formatNumber$1 as formatNumber, formatPercentage, generateMockChartData, generateUniqueId, getElementPosition, groupDataByPeriod, isDarkMode, isElementVisible, isEmpty, isMobile, normalizeSpaces, onDarkModeChange, onReducedMotionChange, prefersReducedMotion, ptBr as ptBR, scrollToElement, scrollToPosition, scrollToTop, smoothScrollTo, truncateText, validateEmail, validatePassword, validatePhone, validateSlug, validateText, validateUrl, validateUsername };